Ignore:
Timestamp:
Mar 28, 2007, 9:57:00 PM (17 years ago)
Author:
rub
Message:

Issue 578
User guest must be real user

Step 1: guest is a real user

On next commit, I finish installation and use of guest of user list and group

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r1920 r1926  
    7474{
    7575  $int_pattern = '/^\d+$/';
     76
    7677  switch ($page['section'])
    7778  {
     
    114115    case 'default' :
    115116    {
    116       // periods must be integer values, they represents number of days
    117       if (!preg_match($int_pattern, $_POST['recent_period'])
    118           or $_POST['recent_period'] <= 0)
    119       {
    120         array_push($page['errors'], $lang['periods_error']);
    121       }
    122       // maxwidth
    123       if (isset($_POST['default_maxwidth'])
    124           and !empty($_POST['default_maxwidth'])
    125           and (!preg_match($int_pattern, $_POST['default_maxwidth'])
    126                or $_POST['default_maxwidth'] < 50))
    127       {
    128         array_push($page['errors'], $lang['maxwidth_error']);
    129       }
    130       // maxheight
    131       if (isset($_POST['default_maxheight'])
    132           and !empty($_POST['default_maxheight'])
    133           and (!preg_match($int_pattern, $_POST['default_maxheight'])
    134                or $_POST['default_maxheight'] < 50))
    135       {
    136         array_push($page['errors'], $lang['maxheight_error']);
    137       }
     117      // Never go here
    138118      break;
    139119    }
     
    161141        $query = '
    162142UPDATE '.CONFIG_TABLE.'
    163   SET value = \''. str_replace("\'", "''", $value).'\'
    164   WHERE param = \''.$row['param'].'\'
     143SET value = \''. str_replace("\'", "''", $value).'\'
     144WHERE param = \''.$row['param'].'\'
    165145;';
    166146        pwg_query($query);
     
    224204$html_check='checked="checked"';
    225205
     206$include_submit_buttons = true;
     207
    226208switch ($page['section'])
    227209{
     
    289271  case 'default' :
    290272  {
    291     $show_yes = ($conf['show_nb_comments']==true)?'checked="checked"':'';
    292     $show_no = ($conf['show_nb_comments']==false)?'checked="checked"':'';
    293     $hits_yes = ($conf['show_nb_hits']==true)?'checked="checked"':'';
    294     $hits_no = ($conf['show_nb_hits']==false)?'checked="checked"':'';
    295     $expand_yes = ($conf['auto_expand']==true)?'checked="checked"':'';
    296     $expand_no  = ($conf['auto_expand']==false)?'checked="checked"':'';
    297 
    298     $template->assign_block_vars(
    299       'default',
    300       array(
    301         'NB_IMAGE_LINE'=>$conf['nb_image_line'],
    302         'NB_ROW_PAGE'=>$conf['nb_line_page'],
    303         'CONF_RECENT'=>$conf['recent_period'],
    304         'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
    305         'MAXWIDTH'=>$conf['default_maxwidth'],
    306         'MAXHEIGHT'=>$conf['default_maxheight'],
    307         'EXPAND_YES'=>$expand_yes,
    308         'EXPAND_NO'=>$expand_no,
    309         'SHOW_COMMENTS_YES'=>$show_yes,
    310         'SHOW_COMMENTS_NO'=>$show_no,
    311         'SHOW_HITS_YES'=>$hits_yes,
    312         'SHOW_HITS_NO'=>$hits_no,
    313         ));
    314 
    315     $blockname = 'default.language_option';
    316 
    317     foreach (get_languages() as $language_code => $language_name)
    318     {
    319       if (isset($_POST['submit']))
    320       {
    321         $selected =
    322           $_POST['default_language'] == $language_code
    323             ? 'selected="selected"' : '';
    324       }
    325       else if ($conf['default_language'] == $language_code)
    326       {
    327         $selected = 'selected="selected"';
    328       }
    329       else
    330       {
    331         $selected = '';
    332       }
    333 
    334       $template->assign_block_vars(
    335         $blockname,
    336         array(
    337           'VALUE'=> $language_code,
    338           'CONTENT' => $language_name,
    339           'SELECTED' => $selected
    340           ));
    341     }
    342 
    343     $blockname = 'default.template_option';
    344 
    345     foreach (get_pwg_themes() as $pwg_template)
    346     {
    347       if (isset($_POST['submit']))
    348       {
    349         $selected =
    350           $_POST['default_template'] == $pwg_template
    351             ? 'selected="selected"' : '';
    352       }
    353       else if ($conf['default_template'] == $pwg_template)
    354       {
    355         $selected = 'selected="selected"';
    356       }
    357       else
    358       {
    359         $selected = '';
    360       }
    361 
    362       $template->assign_block_vars(
    363         $blockname,
    364         array(
    365           'VALUE'=> $pwg_template,
    366           'CONTENT' => $pwg_template,
    367           'SELECTED' => $selected
    368           )
    369         );
    370     }
    371 
    372 
     273    $edit_user = build_user($conf['default_user_id'], false);
     274    include_once(PHPWG_ROOT_PATH.'profile.php');
     275
     276    $errors = array();
     277    if ( !is_adviser() )
     278    {
     279      if (save_profile_from_post($edit_user, $errors))
     280      {
     281        // Reload user
     282        $edit_user = build_user($conf['default_user_id'], false);
     283        array_push($page['infos'], $lang['conf_confirmation']);
     284      }
     285    }
     286    $page['errors'] = array_merge($page['errors'], $errors);
     287
     288    load_profile_in_template(
     289      $action,
     290      '',
     291      $edit_user
     292      );
     293    $template->assign_block_vars('default', array());
     294    $include_submit_buttons = false;
    373295    break;
    374296  }
    375297}
     298
     299if ($include_submit_buttons)
     300{
     301  $template->assign_block_vars('include_submit_buttons', array());
     302}
     303
    376304//----------------------------------------------------------- sending html code
    377305$template->assign_var_from_handle('ADMIN_CONTENT', 'config');
Note: See TracChangeset for help on using the changeset viewer.