Changeset 1863


Ignore:
Timestamp:
Feb 27, 2007, 1:32:23 PM (17 years ago)
Author:
rvelices
Message:
  • function delete_user now clears asssociated data in the caddie table and the sessions table
  • xml writer improvement for web service
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r1817 r1863  
    215215{
    216216  global $conf;
    217 
    218   // destruction of the access linked to the user
    219   $query = '
    220 DELETE FROM '.USER_ACCESS_TABLE.'
     217  $tables = array(
     218    // destruction of the access linked to the user
     219    USER_ACCESS_TABLE,
     220    // destruction of data notification by mail for this user
     221    USER_MAIL_NOTIFICATION_TABLE,
     222    // destruction of data RSS notification for this user
     223    USER_FEED_TABLE,
     224    // deletion of calculated permissions linked to the user
     225    USER_CACHE_TABLE,
     226    // deletion of computed cache data linked to the user
     227    USER_CACHE_CATEGORIES_TABLE,
     228    // destruction of the group links for this user
     229    USER_GROUP_TABLE,
     230    // destruction of the favorites associated with the user
     231    FAVORITES_TABLE,
     232    // destruction of the caddie associated with the user
     233    CADDIE_TABLE,
     234    // deletion of phpwebgallery specific informations
     235    USER_INFOS_TABLE,
     236    );
     237
     238  foreach ($tables as $table)
     239  {
     240    $query = '
     241DELETE FROM '.$table.'
    221242  WHERE user_id = '.$user_id.'
    222243;';
    223   pwg_query($query);
    224 
    225   // destruction of data notification by mail for this user
    226   $query = '
    227 DELETE FROM '.USER_MAIL_NOTIFICATION_TABLE.'
    228   WHERE user_id = '.$user_id.'
    229 ;';
    230   pwg_query($query);
    231 
    232   // destruction of data RSS notification for this user
    233   $query = '
    234 DELETE FROM '.USER_FEED_TABLE.'
    235   WHERE user_id = '.$user_id.'
    236 ;';
    237   pwg_query($query);
    238 
    239   // destruction of the group links for this user
    240   $query = '
    241 DELETE FROM '.USER_GROUP_TABLE.'
    242   WHERE user_id = '.$user_id.'
    243 ;';
    244   pwg_query($query);
    245 
    246   // destruction of the favorites associated with the user
    247   $query = '
    248 DELETE FROM '.FAVORITES_TABLE.'
    249   WHERE user_id = '.$user_id.'
    250 ;';
    251   pwg_query($query);
    252 
    253   // deletion of calculated permissions linked to the user
    254   $query = '
    255 DELETE FROM '.USER_CACHE_TABLE.'
    256   WHERE user_id = '.$user_id.'
    257 ;';
    258   pwg_query($query);
    259 
    260   // deletion of computed cache data linked to the user
    261   $query = '
    262 DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.'
    263   WHERE user_id = '.$user_id.'
    264 ;';
    265   pwg_query($query);
    266 
    267   // deletion of phpwebgallery specific informations
    268   $query = '
    269 DELETE FROM '.USER_INFOS_TABLE.'
    270   WHERE user_id = '.$user_id.'
     244    pwg_query($query);
     245  }
     246
     247  // destruction of the user
     248  $query = '
     249DELETE FROM '.SESSIONS_TABLE.'
     250  WHERE data LIKE "pwg_uid|i:'.(int)$user_id.';%"
    271251;';
    272252  pwg_query($query);
     
    525505  {
    526506    $first = true;
    527      
     507
    528508    $query = 'SHOW VARIABLES LIKE \'max_allowed_packet\';';
    529509    list(, $packet_size) = mysql_fetch_row(pwg_query($query));
     
    540520        $first = true;
    541521      }
    542      
     522
    543523      if ($first)
    544524      {
     
    554534    , ';
    555535      }
    556      
     536
    557537      $query .= '(';
    558538      foreach ($dbfields as $field_id => $dbfield)
     
    574554      $query .= ')';
    575555    }
    576    
     556
    577557    $query .= '
    578558;';
     
    19421922      {
    19431923        array_push($all_tag_ids, $row['tag_id']);
    1944        
     1924
    19451925        if (!isset($tags_of[ $row['image_id'] ])) {
    19461926          $tags_of[ $row['image_id'] ] = array();
    19471927        }
    1948        
     1928
    19491929        array_push(
    19501930          $tags_of[ $row['image_id'] ],
     
    19871967      $xml_string.= "    <tag>".$tag_name_of[$tag_id]."</tag>\n";
    19881968    }
    1989    
     1969
    19901970    $xml_string.= "  </photo>\n";
    19911971  }
    1992  
     1972
    19931973  $xml_string.= '</export>';
    19941974  fwrite($fp, $xml_string);
     
    20492029    'EXTENSIONS' => 'http://'.PHPWG_DOMAIN.'/ext',
    20502030    );
    2051   if ( isset($lang_info['code']) and 
     2031  if ( isset($lang_info['code']) and
    20522032       in_array($lang_info['code'], array('fr','en')) )
    20532033  { /* current wiki languages are French or English */
  • trunk/include/ws_protocols/rest_encoder.php

    • Property svn:keywords set to Author Date Id Revision
    r1698 r1863  
    44// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    55// +-----------------------------------------------------------------------+
    6 // | branch        : BSF (Best So Far)
    7 // | file          : $URL: svn+ssh://rvelices@svn.gna.org/svn/phpwebgallery/trunk/action.php $
    8 // | last update   : $Date: 2006-12-21 18:49:12 -0500 (Thu, 21 Dec 2006) $
    9 // | last modifier : $Author: rvelices $
    10 // | revision      : $Rev: 1678 $
     6// | file          : $Id$
     7// | last update   : $Date$
     8// | last modifier : $Author$
     9// | revision      : $Revision$
    1110// +-----------------------------------------------------------------------+
    1211// | This program is free software; you can redistribute it and/or modify  |
     
    8584    $this->_end_prev(false);
    8685    $value = (string)$value;
    87     $need_cdata = (strpos($value, "\r")!==false)?true:false;
    88     if ($need_cdata)
    89     {
    90       $this->_output( '<![CDATA[' . $value . ']]>' );
    91     }
    92     else
    93     {
    94       $this->_output( htmlspecialchars( $value ) );
    95     }
     86    $this->_output( htmlspecialchars( $value ) );
     87  }
     88
     89  function write_cdata($value)
     90  {
     91    $this->_end_prev(false);
     92    $value = (string)$value;
     93    $this->_output(
     94      '<![CDATA['
     95      . str_replace(']]>', ']]&gt;', $value)
     96      . ']]>' );
    9697  }
    9798
     
    164165      return $ret;
    165166    }
    166 
    167 //parent::flattenResponse($response);
    168167
    169168    $this->_writer = new PwgXmlWriter();
Note: See TracChangeset for help on using the changeset viewer.