Changeset 1554

Show
Ignore:
Timestamp:
03/14/08 21:04:15 (2 months ago)
Author:
Neal
Message:

Fixed a bug where we redefined $pun_useris_admmod?, which caused some problems with moderator accounts.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/punbb-1.3-dev/upload/delete.php

    r1533 r1554  
    7272// Sort out who the moderators are and if we are currently a moderator (or an admin) 
    7373$mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array(); 
    74 $pun_user['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
     74$pun_page['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
    7575 
    7676$cur_post['is_topic'] = ($id == $cur_post['first_post_id']) ? true : false; 
     
    8181        $cur_post['poster_id'] != $pun_user['id'] || 
    8282        $cur_post['closed'] == '1') && 
    83         !$pun_user['is_admmod']) 
     83        !$pun_page['is_admmod']) 
    8484        message($lang_common['No permission']); 
    8585 
  • branches/punbb-1.3-dev/upload/edit.php

    r1534 r1554  
    7272// Sort out who the moderators are and if we are currently a moderator (or an admin) 
    7373$mods_array = ($cur_post['moderators'] != '') ? unserialize($cur_post['moderators']) : array(); 
    74 $pun_user['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
     74$pun_page['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
    7575 
    7676// Do we have permission to edit this post? 
     
    7878        $cur_post['poster_id'] != $pun_user['id'] || 
    7979        $cur_post['closed'] == '1') && 
    80         !$pun_user['is_admmod']) 
     80        !$pun_page['is_admmod']) 
    8181        message($lang_common['No permission']); 
    8282 
     
    8585$errors = array(); 
    8686 
    87 $can_edit_subject = ($id == $cur_post['first_post_id'] && (($pun_user['g_edit_subjects_interval'] == '0' || (time() - $cur_post['posted']) < $pun_user['g_edit_subjects_interval']) || $pun_user['is_admmod'])) ? true : false; 
     87$can_edit_subject = ($id == $cur_post['first_post_id'] && (($pun_user['g_edit_subjects_interval'] == '0' || (time() - $cur_post['posted']) < $pun_user['g_edit_subjects_interval']) || $pun_page['is_admmod'])) ? true : false; 
    8888 
    8989if (isset($_POST['form_sent'])) 
     
    100100                else if (pun_strlen($subject) > 70) 
    101101                        $errors[] = $lang_post['Too long subject']; 
    102                 else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && !$pun_user['is_admmod']) 
     102                else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && !$pun_page['is_admmod']) 
    103103                        $subject = ucwords(strtolower($subject)); 
    104104        } 
     
    111111        else if (strlen($message) > PUN_MAX_POSTSIZE) 
    112112                $errors[] = $lang_post['Too long message']; 
    113         else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && !$pun_user['is_admmod']) 
     113        else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && !$pun_page['is_admmod']) 
    114114                $message = ucwords(strtolower($message)); 
    115115 
     
    159159                ); 
    160160 
    161                 if (!isset($_POST['silent']) || !$pun_user['is_admmod']) 
     161                if (!isset($_POST['silent']) || !$pun_page['is_admmod']) 
    162162                        $query['SET'] .= ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\''; 
    163163 
     
    313313} 
    314314 
    315 if ($pun_user['is_admmod']) 
     315if ($pun_page['is_admmod']) 
    316316{ 
    317317        if ((isset($_POST['form_sent']) && isset($_POST['silent'])) || !isset($_POST['form_sent'])) 
  • branches/punbb-1.3-dev/upload/post.php

    r1534 r1554  
    9797// Sort out who the moderators are and if we are currently a moderator (or an admin) 
    9898$mods_array = ($cur_posting['moderators'] != '') ? unserialize($cur_posting['moderators']) : array(); 
    99 $pun_user['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
     99$pun_page['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
    100100 
    101101// Do we have permission to post? 
     
    103103        ($fid && (($cur_posting['post_topics'] == '' && $pun_user['g_post_topics'] == '0') || $cur_posting['post_topics'] == '0')) || 
    104104        (isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) && 
    105         !$pun_user['is_admmod']) 
     105        !$pun_page['is_admmod']) 
    106106        message($lang_common['No permission']); 
    107107 
     
    132132                else if (pun_strlen($subject) > 70) 
    133133                        $errors[] = $lang_post['Too long subject']; 
    134                 else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && !$pun_user['is_admmod']) 
     134                else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && !$pun_page['is_admmod']) 
    135135                        $subject = ucwords(strtolower($subject)); 
    136136        } 
     
    173173        else if (strlen($message) > PUN_MAX_POSTSIZE) 
    174174                $errors[] = $lang_post['Too long message']; 
    175         else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && !$pun_user['is_admmod']) 
     175        else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && !$pun_page['is_admmod']) 
    176176                $message = ucwords(strtolower($message)); 
    177177 
  • branches/punbb-1.3-dev/upload/viewforum.php

    r1533 r1554  
    7676        $mods_array = unserialize($cur_forum['moderators']); 
    7777 
    78 $pun_user['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
     78$pun_page['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
    7979 
    8080// Sort out whether or not this user can post 
    81 $pun_user['may_post'] = (($cur_forum['post_topics'] == '' && $pun_user['g_post_topics'] == '1') || $cur_forum['post_topics'] == '1' || $pun_user['is_admmod']) ? true : false; 
     81$pun_user['may_post'] = (($cur_forum['post_topics'] == '' && $pun_user['g_post_topics'] == '1') || $cur_forum['post_topics'] == '1' || $pun_page['is_admmod']) ? true : false; 
    8282 
    8383// Get topic/forum tracking data 
     
    160160        $pun_page['main_foot_options'][] = '<a class="user-option" href="'.pun_link($pun_url['mark_forum_read'], $id).'"><span>'.$lang_forum['Mark forum read'].'</span></a>'; 
    161161 
    162         if ($pun_user['is_admmod']) 
     162        if ($pun_page['is_admmod']) 
    163163                $pun_page['main_foot_options'][] = '<a class="mod-option" href="'.pun_sublink($pun_url['moderate_forum'], $pun_url['page'], $pun_page['page'], $id).'"><span>'.$lang_forum['Moderate forum'].'</span></a>'; 
    164164} 
  • branches/punbb-1.3-dev/upload/viewtopic.php

    r1542 r1554  
    157157// Sort out who the moderators are and if we are currently a moderator (or an admin) 
    158158$mods_array = ($cur_topic['moderators'] != '') ? unserialize($cur_topic['moderators']) : array(); 
    159 $pun_user['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
     159$pun_page['is_admmod'] = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; 
    160160 
    161161// Can we or can we not post replies? 
    162 if ($cur_topic['closed'] == '0' || $pun_user['is_admmod']) 
    163         $pun_user['may_post'] = (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1' || $pun_user['is_admmod']) ? true : false; 
     162if ($cur_topic['closed'] == '0' || $pun_page['is_admmod']) 
     163        $pun_user['may_post'] = (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1' || $pun_page['is_admmod']) ? true : false; 
    164164else 
    165165        $pun_user['may_post'] = false; 
     
    218218 
    219219$pun_page['main_foot_options'] = array(); 
    220 if ($pun_user['is_admmod']) 
     220if ($pun_page['is_admmod']) 
    221221{ 
    222222        $pun_page['main_foot_options'][] = '<a class="mod-option" href="'.pun_link($pun_url['move'], array($cur_topic['forum_id'], $id)).'">'.$lang_topic['Move'].'</a>'; 
     
    396396                $pun_page['post_options'][] = '<a href="'.pun_link($pun_url['report'], $cur_post['id']).'"><span>'.$lang_topic['Report'].'<span>&#160;'.$lang_topic['Post'].' '.($pun_page['start_from'] + $pun_page['item_count']).'</span></span></a>'; 
    397397 
    398                 if (!$pun_user['is_admmod']) 
     398                if (!$pun_page['is_admmod']) 
    399399                { 
    400400                        if ($cur_topic['closed'] == '0') 
     
    522522        !$pun_user['is_guest'] && 
    523523        ($cur_topic['post_replies'] == '1' || ($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1')) && 
    524         ($cur_topic['closed'] == '0' || $pun_user['is_admmod'])) 
     524        ($cur_topic['closed'] == '0' || $pun_page['is_admmod'])) 
    525525{ 
    526526