Changeset 2232 for trunk/admin


Ignore:
Timestamp:
Mar 1, 2008, 2:23:51 PM (16 years ago)
Author:
rub
Message:

0000809: Use more php classes implementation

Use class for c13y

Location:
trunk/admin
Files:
1 added
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/check_integrity.class.php

    r2230 r2232  
    2525// +-----------------------------------------------------------------------+
    2626
    27 /**
    28  * Check integrity
    29  *
    30  * @param void
    31  * @return void
    32  */
    33 function check_integrity()
     27class check_integrity
    3428{
    35   global $page, $header_notes, $conf;
    36 
    37   // Ignore list
    38   $conf_c13y_ignore = unserialize($conf['c13y_ignore']);
    39   if (
    40         is_array($conf_c13y_ignore) and
    41         isset($conf_c13y_ignore['version']) and
    42         ($conf_c13y_ignore['version'] == PHPWG_VERSION) and
    43         is_array($conf_c13y_ignore['list'])
    44       )
    45   {
    46     $ignore_list_changed = false;
    47     $page['check_integrity']['ignore_list'] = $conf_c13y_ignore['list'];
    48   }
    49   else
    50   {
    51     $ignore_list_changed = true;
    52     $page['check_integrity']['ignore_list'] = array();
    53   }
    54 
    55   // Retrieve list
    56   $page['check_integrity']['list'] = array();
    57   $page['check_integrity']['build_ignore_list'] = array();
    58 
    59   add_event_handler('list_check_integrity', 'c13y_exif');
    60   add_event_handler('list_check_integrity', 'c13y_user');
    61   trigger_action('list_check_integrity');
    62 
    63   // Information
    64   if (count($page['check_integrity']['list']) > 0)
    65   {
    66     $header_notes[] =
    67       l10n_dec('c13y_anomaly_count', 'c13y_anomalies_count',
    68         count($page['check_integrity']['list']));
    69   }
    70 
    71   // Treatments
    72   if (!is_adviser())
    73   {
    74     if (isset($_POST['c13y_submit_correction']) and isset($_POST['c13y_selection']))
    75     {
    76       $corrected_count = 0;
    77       $not_corrected_count = 0;
    78 
    79       foreach ($page['check_integrity']['list'] as $i => $c13y)
    80       {
    81         if (!empty($c13y['correction_fct']) and
    82             $c13y['is_callable'] and
    83             in_array($c13y['id'], $_POST['c13y_selection']))
    84         {
    85           if (is_array($c13y['correction_fct_args']))
    86           {
    87             $args = $c13y['correction_fct_args'];
     29  var $ignore_list;
     30  var $retrieve_list;
     31  var $build_ignore_list;
     32
     33  function check_integrity()
     34  {
     35    $this->ignore_list = array();
     36    $this->retrieve_list = array();
     37    $this->build_ignore_list = array();
     38  }
     39
     40  /**
     41   * Check integrities
     42   *
     43   * @param void
     44   * @return void
     45   */
     46  function check()
     47  {
     48    global $page, $header_notes, $conf;
     49
     50    // Ignore list
     51    $conf_c13y_ignore = unserialize($conf['c13y_ignore']);
     52    if (
     53          is_array($conf_c13y_ignore) and
     54          isset($conf_c13y_ignore['version']) and
     55          ($conf_c13y_ignore['version'] == PHPWG_VERSION) and
     56          is_array($conf_c13y_ignore['list'])
     57        )
     58    {
     59      $ignore_list_changed = false;
     60      $this->ignore_list = $conf_c13y_ignore['list'];
     61    }
     62    else
     63    {
     64      $ignore_list_changed = true;
     65      $this->ignore_list = array();
     66    }
     67
     68    // Retrieve list
     69    $this->retrieve_list = array();
     70    $this->build_ignore_list = array();
     71
     72    trigger_action('list_check_integrity', &$this);
     73
     74    // Information
     75    if (count($this->retrieve_list) > 0)
     76    {
     77      $header_notes[] =
     78        l10n_dec('c13y_anomaly_count', 'c13y_anomalies_count',
     79          count($this->retrieve_list));
     80    }
     81
     82    // Treatments
     83    if (!is_adviser())
     84    {
     85      if (isset($_POST['c13y_submit_correction']) and isset($_POST['c13y_selection']))
     86      {
     87        $corrected_count = 0;
     88        $not_corrected_count = 0;
     89
     90        foreach ($this->retrieve_list as $i => $c13y)
     91        {
     92          if (!empty($c13y['correction_fct']) and
     93              $c13y['is_callable'] and
     94              in_array($c13y['id'], $_POST['c13y_selection']))
     95          {
     96            if (is_array($c13y['correction_fct_args']))
     97            {
     98              $args = $c13y['correction_fct_args'];
     99            }
     100            else
     101            if (!is_null($c13y['correction_fct_args']))
     102            {
     103              $args = array($c13y['correction_fct_args']);
     104            }
     105            else
     106            {
     107              $args = array();
     108            }
     109            $this->retrieve_list[$i]['corrected'] = call_user_func_array($c13y['correction_fct'], $args);
     110
     111            if ($this->retrieve_list[$i]['corrected'])
     112            {
     113              $corrected_count += 1;
     114            }
     115            else
     116            {
     117              $not_corrected_count += 1;
     118            }
     119          }
     120        }
     121
     122        if ($corrected_count > 0)
     123        {
     124          $page['infos'][] =
     125            l10n_dec('c13y_anomaly_corrected_count', 'c13y_anomalies_corrected_count',
     126              $corrected_count);
     127        }
     128        if ($not_corrected_count > 0)
     129        {
     130          $page['errors'][] =
     131            l10n_dec('c13y_anomaly_not_corrected_count', 'c13y_anomalies_not_corrected_count',
     132              $not_corrected_count);
     133        }
     134      }
     135      else
     136      {
     137        if (isset($_POST['c13y_submit_ignore']) and isset($_POST['c13y_selection']))
     138        {
     139          $ignored_count = 0;
     140
     141          foreach ($this->retrieve_list as $i => $c13y)
     142          {
     143            if (in_array($c13y['id'], $_POST['c13y_selection']))
     144            {
     145              $this->build_ignore_list[] = $c13y['id'];
     146              $this->retrieve_list[$i]['ignored'] = true;
     147              $ignored_count += 1;
     148            }
     149          }
     150
     151          if ($ignored_count > 0)
     152          {
     153            $page['infos'][] =
     154              l10n_dec('c13y_anomaly_ignored_count', 'c13y_anomalies_ignored_count',
     155                $ignored_count);
     156          }
     157        }
     158      }
     159    }
     160
     161    $ignore_list_changed =
     162      (
     163        ($ignore_list_changed) or
     164        (count(array_diff($this->ignore_list, $this->build_ignore_list)) > 0) or
     165        (count(array_diff($this->build_ignore_list, $this->ignore_list)) > 0)
     166        );
     167
     168    if ($ignore_list_changed)
     169    {
     170      $this->update_conf($this->build_ignore_list);
     171    }
     172  }
     173
     174  /**
     175   * Display anomalies list
     176   *
     177   * @param void
     178   * @return void
     179   */
     180  function display()
     181  {
     182    global $template;
     183
     184    $check_automatic_correction = false;
     185    $submit_automatic_correction = false;
     186    $submit_ignore = false;
     187
     188    if (isset($this->retrieve_list) and count($this->retrieve_list) > 0)
     189    {
     190      $template->set_filenames(array('check_integrity' => 'admin/check_integrity.tpl'));
     191
     192      foreach ($this->retrieve_list as $i => $c13y)
     193      {
     194        $can_select = false;
     195
     196        $template->assign_block_vars('c13y',
     197          array(
     198           'CLASS' => ($i % 2 == 1) ? 'row2' : 'row1',
     199           'ID' => $c13y['id'],
     200           'ANOMALY' => $c13y['anomaly']
     201          ));
     202
     203
     204        if (isset($c13y['ignored']))
     205        {
     206          if ($c13y['ignored'])
     207          {
     208            $template->assign_block_vars('c13y.ignore_msg', array());
    88209          }
    89210          else
    90           if (!is_null($c13y['correction_fct_args']))
    91           {
    92             $args = array($c13y['correction_fct_args']);
     211          {
     212            die('$c13y[\'ignored\'] cannot be false');
     213          }
     214        }
     215        else
     216        {
     217          if (!empty($c13y['correction_fct']))
     218          {
     219            if (isset($c13y['corrected']))
     220            {
     221              if ($c13y['corrected'])
     222              {
     223                $template->assign_block_vars('c13y.correction_success_fct', array());
     224              }
     225              else
     226              {
     227                $template->assign_block_vars('c13y.correction_error_fct',
     228                  array('WIKI_FOROM_LINKS' => $this->get_htlm_links_more_info()));
     229              }
     230            }
     231            else if ($c13y['is_callable'])
     232            {
     233              $template->assign_block_vars('c13y.correction_fct', array());
     234              $template->assign_block_vars('c13y_link_check_automatic_correction.c13y_do_check', array('ID' => $c13y['id']));
     235              $submit_automatic_correction = true;
     236              $can_select = true;
     237            }
     238            else
     239            {
     240              $template->assign_block_vars('c13y.correction_bad_fct', array());
     241              $can_select = true;
     242            }
    93243          }
    94244          else
    95245          {
    96             $args = array();
    97           }
    98           $page['check_integrity']['list'][$i]['corrected'] = call_user_func_array($c13y['correction_fct'], $args);
    99 
    100           if ($page['check_integrity']['list'][$i]['corrected'])
    101           {
    102             $corrected_count += 1;
    103           }
    104           else
    105           {
    106             $not_corrected_count += 1;
    107           }
    108         }
    109       }
    110 
    111       if ($corrected_count > 0)
    112       {
    113         $page['infos'][] =
    114           l10n_dec('c13y_anomaly_corrected_count', 'c13y_anomalies_corrected_count',
    115             $corrected_count);
    116       }
    117       if ($not_corrected_count > 0)
    118       {
    119         $page['errors'][] =
    120           l10n_dec('c13y_anomaly_not_corrected_count', 'c13y_anomalies_not_corrected_count',
    121             $not_corrected_count);
    122       }
     246            $can_select = true;
     247          }
     248
     249          if (!empty($c13y['correction_fct']) and !empty($c13y['correction_msg']))
     250          {
     251            $template->assign_block_vars('c13y.br', array());
     252          }
     253
     254          if (!empty($c13y['correction_msg']) and !isset($c13y['corrected']))
     255          {
     256            $template->assign_block_vars('c13y.correction_msg',
     257              array(
     258               'DATA' => nl2br($c13y['correction_msg'])
     259              ));
     260          }
     261        }
     262
     263        if ($can_select)
     264        {
     265          $template->assign_block_vars('c13y.can_select', array());
     266          $submit_ignore = true;
     267        }
     268      }
     269
     270      if ($submit_automatic_correction)
     271      {
     272        $template->assign_block_vars('c13y_submit_automatic_correction', array());
     273      }
     274
     275      if ($submit_ignore)
     276      {
     277        $template->assign_block_vars('c13y_link_check_uncheck', array());
     278        $template->assign_block_vars('c13y_submit_ignore', array());
     279      }
     280
     281      $template->concat_var('ADMIN_CONTENT', $template->parse('check_integrity', true) );
     282    }
     283  }
     284
     285  /**
     286   * Add anomaly data
     287   *
     288   * @param anomaly arguments
     289   * @return void
     290   */
     291  function add_anomaly($anomaly, $correction_fct = null, $correction_fct_args = null, $correction_msg = null)
     292  {
     293    $id = md5($anomaly.$correction_fct.serialize($correction_fct_args).$correction_msg);
     294
     295    if (in_array($id, $this->ignore_list))
     296    {
     297      $this->build_ignore_list[] = $id;
    123298    }
    124299    else
    125300    {
    126       if (isset($_POST['c13y_submit_ignore']) and isset($_POST['c13y_selection']))
    127       {
    128         $ignored_count = 0;
    129 
    130         foreach ($page['check_integrity']['list'] as $i => $c13y)
    131         {
    132           if (in_array($c13y['id'], $_POST['c13y_selection']))
    133           {
    134             $page['check_integrity']['build_ignore_list'][] = $c13y['id'];
    135             $page['check_integrity']['list'][$i]['ignored'] = true;
    136             $ignored_count += 1;
    137           }
    138         }
    139 
    140         if ($ignored_count > 0)
    141         {
    142           $page['infos'][] =
    143             l10n_dec('c13y_anomaly_ignored_count', 'c13y_anomalies_ignored_count',
    144               $ignored_count);
    145         }
    146       }
    147     }
    148   }
    149 
    150   $ignore_list_changed =
    151     (
    152       ($ignore_list_changed) or
    153       (count(array_diff($page['check_integrity']['ignore_list'], $page['check_integrity']['build_ignore_list'])) > 0) or
    154       (count(array_diff($page['check_integrity']['build_ignore_list'], $page['check_integrity']['ignore_list'])) > 0)
     301      $this->retrieve_list[] =
     302        array(
     303          'id' => $id,
     304          'anomaly' => $anomaly,
     305          'correction_fct' => $correction_fct,
     306          'correction_fct_args' => $correction_fct_args,
     307          'correction_msg' => $correction_msg,
     308          'is_callable' => is_callable($correction_fct));
     309    }
     310  }
     311
     312  /**
     313   * Update table config
     314   *
     315   * @param ignore list array
     316   * @return void
     317   */
     318  function update_conf($conf_ignore_list = array())
     319  {
     320    $conf_c13y_ignore =  array();
     321    $conf_c13y_ignore['version'] = PHPWG_VERSION;
     322    $conf_c13y_ignore['list'] = $conf_ignore_list;
     323    $query = 'update '.CONFIG_TABLE.' set value =\''.serialize($conf_c13y_ignore).'\'where param = \'c13y_ignore\';';
     324    pwg_query($query);
     325  }
     326
     327  /**
     328   * Apply maintenance
     329   *
     330   * @param void
     331   * @return void
     332   */
     333  function maintenance()
     334  {
     335    $this->update_conf();
     336  }
     337
     338  /**
     339   * Returns links more informations
     340   *
     341   * @param void
     342   * @return html links
     343   */
     344  function get_htlm_links_more_info()
     345  {
     346    $pwg_links = pwg_URL();
     347    $link_fmt = '<a href="%s" onclick="window.open(this.href, \'\'); return false;">%s</a>';
     348    return
     349      sprintf
     350      (
     351        l10n('c13y_more_info'),
     352        sprintf($link_fmt, $pwg_links['FORUM'], l10n('c13y_more_info_forum')),
     353        sprintf($link_fmt, $pwg_links['WIKI'], l10n('c13y_more_info_wiki'))
    155354      );
    156 
    157   if ($ignore_list_changed)
    158   {
    159     c13y_update_conf($page['check_integrity']['build_ignore_list']);
    160   }
     355  }
     356
    161357}
    162358
    163 /**
    164  * Display anomalies list
    165  *
    166  * @param void
    167  * @return void
    168  */
    169 function display_check_integrity()
    170 {
    171   global $template, $page;
    172 
    173   $check_automatic_correction = false;
    174   $submit_automatic_correction = false;
    175   $submit_ignore = false;
    176 
    177   if (isset($page['check_integrity']['list']) and count($page['check_integrity']['list']) > 0)
    178   {
    179     $template->set_filenames(array('check_integrity' => 'admin/check_integrity.tpl'));
    180 
    181     foreach ($page['check_integrity']['list'] as $i => $c13y)
    182     {
    183       $can_select = false;
    184 
    185       $template->assign_block_vars('c13y',
    186         array(
    187          'CLASS' => ($i % 2 == 1) ? 'row2' : 'row1',
    188          'ID' => $c13y['id'],
    189          'ANOMALY' => $c13y['anomaly']
    190         ));
    191 
    192 
    193       if (isset($c13y['ignored']))
    194       {
    195         if ($c13y['ignored'])
    196         {
    197           $template->assign_block_vars('c13y.ignore_msg', array());
    198         }
    199         else
    200         {
    201           die('$c13y[\'ignored\'] cannot be false');
    202         }
    203       }
    204       else
    205       {
    206         if (!empty($c13y['correction_fct']))
    207         {
    208           if (isset($c13y['corrected']))
    209           {
    210             if ($c13y['corrected'])
    211             {
    212               $template->assign_block_vars('c13y.correction_success_fct', array());
    213             }
    214             else
    215             {
    216               $template->assign_block_vars('c13y.correction_error_fct',
    217                 array('WIKI_FOROM_LINKS' => get_htlm_links_more_info()));
    218             }
    219           }
    220           else if ($c13y['is_callable'])
    221           {
    222             $template->assign_block_vars('c13y.correction_fct', array());
    223             $template->assign_block_vars('c13y_link_check_automatic_correction.c13y_do_check', array('ID' => $c13y['id']));
    224             $submit_automatic_correction = true;
    225             $can_select = true;
    226           }
    227           else
    228           {
    229             $template->assign_block_vars('c13y.correction_bad_fct', array());
    230             $can_select = true;
    231           }
    232         }
    233         else
    234         {
    235           $can_select = true;
    236         }
    237 
    238         if (!empty($c13y['correction_fct']) and !empty($c13y['correction_msg']))
    239         {
    240           $template->assign_block_vars('c13y.br', array());
    241         }
    242 
    243         if (!empty($c13y['correction_msg']) and !isset($c13y['corrected']))
    244         {
    245           $template->assign_block_vars('c13y.correction_msg',
    246             array(
    247              'DATA' => nl2br($c13y['correction_msg'])
    248             ));
    249         }
    250       }
    251 
    252       if ($can_select)
    253       {
    254         $template->assign_block_vars('c13y.can_select', array());
    255         $submit_ignore = true;
    256       }
    257     }
    258 
    259     if ($submit_automatic_correction)
    260     {
    261       $template->assign_block_vars('c13y_submit_automatic_correction', array());
    262     }
    263 
    264     if ($submit_ignore)
    265     {
    266       $template->assign_block_vars('c13y_link_check_uncheck', array());
    267       $template->assign_block_vars('c13y_submit_ignore', array());
    268     }
    269 
    270     $template->concat_var('ADMIN_CONTENT', $template->parse('check_integrity', true) );
    271   }
    272 }
    273 
    274 /**
    275  * Returns structured anomaly data
    276  *
    277  * @param anomaly arguments
    278  * @return c13y anomaly array
    279  */
    280 function add_c13y($anomaly, $correction_fct = null, $correction_fct_args = null, $correction_msg = null)
    281 {
    282   global $page;
    283 
    284   $id = md5($anomaly.$correction_fct.serialize($correction_fct_args).$correction_msg);
    285 
    286   if (in_array($id, $page['check_integrity']['ignore_list']))
    287   {
    288     $page['check_integrity']['build_ignore_list'][] = $id;
    289   }
    290   else
    291   {
    292     $page['check_integrity']['list'][] =
    293       array(
    294         'id' => $id,
    295         'anomaly' => $anomaly,
    296         'correction_fct' => $correction_fct,
    297         'correction_fct_args' => $correction_fct_args,
    298         'correction_msg' => $correction_msg,
    299         'is_callable' => is_callable($correction_fct));
    300   }
    301 }
    302 
    303 /**
    304  * Update table config
    305  *
    306  * @param ignore list array
    307  * @return void
    308  */
    309 function c13y_update_conf($ignore_list = array())
    310 {
    311   $conf_c13y_ignore =  array();
    312   $conf_c13y_ignore['version'] = PHPWG_VERSION;
    313   $conf_c13y_ignore['list'] = $ignore_list;
    314   $query = 'update '.CONFIG_TABLE.' set value =\''.serialize($conf_c13y_ignore).'\'where param = \'c13y_ignore\';';
    315   pwg_query($query);
    316 }
    317 
    318 /**
    319  * Apply maintenance
    320  *
    321  * @param void
    322  * @return void
    323  */
    324 function c13y_maintenance()
    325 {
    326   c13y_update_conf();
    327 }
    328 
    329 /**
    330  * Returns links more informations
    331  *
    332  * @param void
    333  * @return html links
    334  */
    335 function get_htlm_links_more_info()
    336 {
    337   $pwg_links = pwg_URL();
    338   $link_fmt = '<a href="%s" onclick="window.open(this.href, \'\'); return false;">%s</a>';
    339   return
    340     sprintf
    341     (
    342       l10n('c13y_more_info'),
    343       sprintf($link_fmt, $pwg_links['FORUM'], l10n('c13y_more_info_forum')),
    344       sprintf($link_fmt, $pwg_links['WIKI'], l10n('c13y_more_info_wiki'))
    345     );
    346 }
    347 
    348 /**
    349  * Check exif
    350  *
    351  * @param void
    352  * @return void
    353  */
    354 function c13y_exif()
    355 {
    356   global $conf;
    357 
    358   foreach (array('show_exif', 'use_exif') as $value)
    359   {
    360     if (($conf[$value]) and (!function_exists('read_exif_data')))
    361     {
    362       add_c13y(
    363         sprintf(l10n('c13y_exif_anomaly'), '$conf[\''.$value.'\']'),
    364         null,
    365         null,
    366         sprintf(l10n('c13y_exif_correction'), '$conf[\''.$value.'\']')
    367         .'<BR />'.
    368         get_htlm_links_more_info());
    369     }
    370   }
    371 }
    372 
    373 /**
    374  * Check user
    375  *
    376  * @param void
    377  * @return void
    378  */
    379 function c13y_user()
    380 {
    381   global $conf;
    382 
    383   $c13y_users = array();
    384   $c13y_users[$conf['guest_id']] = array(
    385     'status' => 'guest',
    386     'l10n_non_existent' => 'c13y_guest_non_existent',
    387     'l10n_bad_status' => 'c13y_bad_guest_status');
    388 
    389   if ($conf['guest_id'] != $conf['default_user_id'])
    390   {
    391     $c13y_users[$conf['default_user_id']] = array(
    392       'password' => null,
    393       'l10n_non_existent' => 'c13y_default_non_existent');
    394   }
    395 
    396   $c13y_users[$conf['webmaster_id']] = array(
    397     'status' => 'webmaster',
    398     'l10n_non_existent' => 'c13y_webmaster_non_existent',
    399     'l10n_bad_status' => 'c13y_bad_webmaster_status');
    400 
    401     $query = '
    402 select u.'.$conf['user_fields']['id'].' as id, ui.status
    403 from '.USERS_TABLE.' as u
    404   left join '.USER_INFOS_TABLE.' as ui
    405       on u.'.$conf['user_fields']['id'].' = ui.user_id
    406 where
    407   u.'.$conf['user_fields']['id'].' in ('.implode(',', array_keys($c13y_users)).')
    408 ;';
    409 
    410 
    411   $status = array();
    412 
    413   $result = pwg_query($query);
    414   while ($row = mysql_fetch_array($result))
    415   {
    416     $status[$row['id']] = $row['status'];
    417   }
    418 
    419   foreach ($c13y_users as $id => $data)
    420   {
    421     if (!array_key_exists($id, $status))
    422     {
    423       add_c13y(l10n($data['l10n_non_existent']), 'c13y_correction_user',
    424         array('id' => $id, 'action' => 'creation'));
    425     }
    426     else
    427     if (!empty($data['status']) and $status[$id] != $data['status'])
    428     {
    429       add_c13y(l10n($data['l10n_bad_status']), 'c13y_correction_user',
    430         array('id' => $id, 'action' => 'status'));
    431     }
    432   }
    433 }
    434 
    435 /**
    436  * Do correction user
    437  *
    438  * @param user_id, action
    439  * @return boolean true if ok else false
    440  */
    441 function c13y_correction_user($id, $action)
    442 {
    443   global $conf, $page;
    444 
    445   $result = false;
    446 
    447   if (!empty($id))
    448   {
    449     switch ($action)
    450     {
    451       case 'creation':
    452         if ($id == $conf['guest_id'])
    453         {
    454           $name = 'guest';
    455           $password = null;
    456         }
    457         else if  ($id == $conf['default_user_id'])
    458         {
    459           $name = 'guest';
    460           $password = null;
    461         }
    462         else if  ($id == $conf['webmaster_id'])
    463         {
    464           $name = 'webmaster';
    465           $password = generate_key(6);
    466         }
    467 
    468         if (isset($name))
    469         {
    470           $name_ok = false;
    471           while (!$name_ok)
    472           {
    473             $name_ok = (get_userid($name) === false);
    474             if (!$name_ok)
    475             {
    476               $name .= generate_key(1);
    477             }
    478           }
    479 
    480           $inserts = array(
    481             array(
    482               'id'       => $id,
    483               'username' => $name,
    484               'password' => $password
    485               ),
    486             );
    487           mass_inserts(USERS_TABLE, array_keys($inserts[0]), $inserts);
    488 
    489           create_user_infos($id);
    490 
    491           $page['infos'][] = sprintf(l10n('c13y_user_created'), $name, $password);
    492 
    493           $result = true;
    494         }
    495         break;
    496       case 'status':
    497         if ($id == $conf['guest_id'])
    498         {
    499           $status = 'guest';
    500         }
    501         else if  ($id == $conf['default_user_id'])
    502         {
    503           $status = 'guest';
    504         }
    505         else if  ($id == $conf['webmaster_id'])
    506         {
    507           $status = 'webmaster';
    508         }
    509 
    510         if (isset($status))
    511         {
    512           $updates = array(
    513             array(
    514               'user_id' => $id,
    515               'status'  => $status
    516               ),
    517             );
    518           mass_updates(USER_INFOS_TABLE,
    519             array('primary' => array('user_id'),'update' => array('status')),
    520             $updates);
    521 
    522           $page['infos'][] = sprintf(l10n('c13y_user_status_updated'), get_username($id));
    523 
    524           $result = true;
    525         }
    526         break;
    527     }
    528   }
    529 
    530   return $result;
    531 }
    532 
    533359?>
  • trunk/admin/intro.php

    r2230 r2232  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | file          : $Id$
     
    3131
    3232include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     33include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
     34include_once(PHPWG_ROOT_PATH.'admin/include/c13y_internal.class.php');
    3335
    3436// +-----------------------------------------------------------------------+
     
    272274// Add the PhpWebGallery Official menu
    273275  $template->assign( 'pwgmenu', pwg_URL() );
    274  
     276
    275277// +-----------------------------------------------------------------------+
    276278// |                           sending html code                           |
     
    279281$template->assign_var_from_handle('ADMIN_CONTENT', 'intro');
    280282
    281 display_check_integrity();
     283// Check integrity
     284$c13y = new check_integrity();
     285// add internal checks
     286new c13y_internal();
     287// check and display
     288$c13y->check();
     289$c13y->display();
    282290
    283291?>
  • trunk/admin/maintenance.php

    r2208 r2232  
    100100  case 'c13y' :
    101101  {
    102     include_once(PHPWG_ROOT_PATH.'admin/include/functions_check_integrity.inc.php');
    103     c13y_maintenance();
     102    include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
     103    $c13y = new check_integrity();
     104    $c13y->maintenance();
    104105    break;
    105106  }
Note: See TracChangeset for help on using the changeset viewer.