Changeset 1654 in ExiteCMS


Ignore:
Timestamp:
08/19/08 11:02:58 (3 years ago)
Author:
hverton
Message:

added a new forum setting to limit forum message visibility for guests to a set number of days. Older threads will not be accessable. This may encourage visitors to become a member

Location:
trunk
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/settings_forum.php

    r1423 r1654  
    3939    $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".(isNum($_POST['unread_threshold']) ? $_POST['unread_threshold'] : "0")."' WHERE cfg_name = 'unread_threshold'"); 
    4040    $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".(isNum($_POST['forum_edit_timeout']) ? $_POST['forum_edit_timeout'] : "0")."' WHERE cfg_name = 'forum_edit_timeout'"); 
     41    $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".(isNum($_POST['forum_guest_limit']) ? $_POST['forum_guest_limit'] : "0")."' WHERE cfg_name = 'forum_guest_limit'"); 
    4142} 
    4243 
  • trunk/administration/tools/language_pack_English.php

    r1648 r1654  
    10401040        $localestrings['541'] = ", then "; 
    10411041        $localestrings['542'] = ", with OpenID"; 
     1042        $localestrings['543'] = "Limit forum posts for guests to:"; 
     1043        $localestrings['544'] = "No Limit"; 
    10421044        $localestrings['550'] = "Security"; 
    10431045        $localestrings['551'] = "Enable registration system?"; 
     
    23132315        $localestrings['460'] = "Sticky Thread."; 
    23142316        $localestrings['461'] = "You are not authorised to view this Forum."; 
     2317        $localestrings['462'] = "For guest users, only the active threads of the last %s are visible. Please consider becoming a member"; 
    23152318        $localestrings['500'] = "View Thread"; 
    23162319        $localestrings['501'] = "Author"; 
  • trunk/administration/tools/language_pack_Nederlands.php

    r1648 r1654  
    10401040        $localestrings['541'] = ", daarna "; 
    10411041        $localestrings['542'] = ", met OpenID"; 
     1042        $localestrings['543'] = "Forumberichten voor gasten limiteren tot:"; 
     1043        $localestrings['544'] = "Geen limiet"; 
    10421044        $localestrings['550'] = "Beveiliging"; 
    10431045        $localestrings['551'] = "Activeer registratie systeem?"; 
     
    23132315        $localestrings['460'] = "Belangrijke topic."; 
    23142316        $localestrings['461'] = "U bent niet geauthoriseerd om dit forum te bekijken."; 
     2317        $localestrings['462'] = "Voor gasten zijn alleen de topics van de laatste %s zichtbaar. Wordt lid om alles te kunnen zien"; 
    23152318        $localestrings['500'] = "Bekijk topic"; 
    23162319        $localestrings['501'] = "Auteur"; 
  • trunk/files/locales/en.main.global.php

    r1648 r1654  
    33// locale       : English 
    44// locale name  : main.global 
    5 // generated on : Sun Aug 17 2008, 18:14:24 CEST 
     5// generated on : Mon Aug 18 2008, 22:18:00 CEST 
    66// translators  : ExiteCMS team,WanWizard 
    77// ---------------------------------------------------------- 
  • trunk/forum/viewforum.php

    r1549 r1654  
    146146$variables['rowstart'] = $rowstart; 
    147147 
     148// is a thread time limit defined for guest users? 
     149$thread_limit = iMEMBER ? 0 : (time() - $settings['forum_guest_limit'] * 86400); 
     150 
    148151// get the threads to fill this page 
    149152$result = dbquery( 
     
    153156        LEFT JOIN ".$db_prefix."users tu1 ON t.thread_author = tu1.user_id 
    154157        LEFT JOIN ".$db_prefix."users tu2 ON t.thread_lastuser = tu2.user_id 
    155         WHERE t.forum_id = '".$forum_id."' 
     158        WHERE t.forum_id = '".$forum_id."'".($thread_limit==0?"":" AND t.thread_lastpost > ".$thread_limit)." 
    156159        GROUP BY thread_id 
    157160        ORDER BY thread_sticky DESC, thread_lastpost DESC 
  • trunk/forum/viewposts.php

    r1405 r1654  
    3131if (!isset($forum_id) || !isNum($forum_id)) $forum_id = false; 
    3232 
     33// is a thread time limit defined for guest users? 
     34$thread_limit = iMEMBER ? 0 : (time() - $settings['forum_guest_limit'] * 86400); 
     35 
    3336// check if we have anything to display 
    3437$result = dbquery( 
    3538    "SELECT tp.*, tf.* FROM ".$db_prefix."posts tp 
     39    INNER JOIN ".$db_prefix."threads th USING(thread_id) 
    3640    INNER JOIN ".$db_prefix."forums tf USING(forum_id) 
    37     WHERE ".groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "") 
     41    WHERE ".($thread_limit==0?"":" th.thread_lastpost > ".$thread_limit." AND ").groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "") 
    3842); 
     43 
    3944$rows = dbrows($result); 
    4045$variables['rows'] = $rows; 
     
    4651$result = dbquery( 
    4752    "SELECT tp.*, tf.* FROM ".$db_prefix."posts tp 
     53    INNER JOIN ".$db_prefix."threads th USING(thread_id) 
    4854    INNER JOIN ".$db_prefix."forums tf USING(forum_id) 
    49     WHERE ".groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "")." 
     55    WHERE ".($thread_limit==0?"":" th.thread_lastpost > ".$thread_limit." AND ").groupaccess('forum_access').($forum_id ? " AND tp.forum_id = '$forum_id'" : "")." 
    5056    ORDER BY post_datestamp DESC  
    5157    LIMIT $rowstart,".ITEMS_PER_PAGE 
  • trunk/forum/viewthread.php

    r1598 r1654  
    118118$variables['user_can_blacklist'] = checkrights("B"); 
    119119 
     120// check if there is a thread time limit defined for guests 
     121$thread_limit = iMEMBER ? 0 : (time() - $settings['forum_guest_limit'] * 86400); 
     122 
    120123// get information about the current thread 
    121124$result = dbquery( 
    122125    "SELECT * FROM ".$db_prefix."threads  
    123     WHERE thread_id='".$thread_id."' AND forum_id='".$fdata['forum_id']."'" 
     126    WHERE thread_id='".$thread_id."' AND forum_id='".$fdata['forum_id']."'".($thread_limit==0?"":" AND thread_lastpost > ".$thread_limit) 
    124127); 
    125 // bail out if the requested forum does not exist 
     128// bail out if the requested thread does not exist 
    126129if (!dbrows($result)) { 
    127     fallback("index.php"); 
    128 } 
     130    fallback("viewforum.php?forum_id=".$forum_id); 
     131} 
     132 
    129133// store the thread information 
    130134$tdata = dbarray($result); 
     
    342346        } else { 
    343347            // check if the post timestamp within the set unread threshold 
    344             if ($data['post_datestamp'] > $settings['unread_threshold'] || $data['post_editttime'] > $settings['unread_threshold']) { 
     348            if ($data['post_datestamp'] > $settings['unread_threshold'] || $data['post_edittime'] > $settings['unread_threshold']) { 
    345349                // check if it is newer that the first and last marker in the threads_read record 
    346350                if ($data['post_datestamp'] > $thread_last_read || $data['post_edittime'] > $thread_last_read || $data['post_datestamp'] < $thread_first_read || ($data['post_edittime'] != 0 && $data['post_edittime'] < $thread_first_read))  { 
     
    349353                    $data['unread'] = false; 
    350354                } 
     355            } else { 
     356                $data['unread'] = false; 
    351357            } 
    352358        } 
  • trunk/includes/templates/admin.settings_forum.tpl

    r1639 r1654  
    8282                <select name='unread_threshold' class='textbox'> 
    8383                {section name=days start=0 loop=361 step=30} 
    84                 <option value='{$smarty.section.days.index}' {if $smarty.section.days.index == $settings2.unread_threshold|default:0}selected='selected'{/if}>{if $smarty.section.days.index == 0}{$locale.714}{else}{$smarty.section.days.index} {$locale.518}{/if}</option> 
     84                <option value='{$smarty.section.days.index}' {if $smarty.section.days.index == $settings2.unread_threshold|default:0}selected='selected'{/if}>{if $smarty.section.days.index == 0}{$locale.544}{else}{$smarty.section.days.index} {$locale.518}{/if}</option> 
    8585                {/section} 
    8686                </select> 
     
    108108                {section name=hours start=1 loop=25} 
    109109                <option value='{$smarty.section.hours.index}' {if $settings2.forum_edit_timeout == $smarty.section.hours.index}selected='selected'{/if}>{$smarty.section.hours.index} {if $smarty.section.hours.index == 1}{$locale.535}{else}{$locale.536}{/if}</option> 
     110                {/section} 
     111                </select> 
     112            </td> 
     113        </tr> 
     114        <tr> 
     115            <td width='60%' class='tbl'> 
     116                {$locale.543} 
     117            </td> 
     118            <td width='40%' class='tbl'> 
     119                <select name='forum_guest_limit' class='textbox'> 
     120                <option value='0' {if $settings2.forum_guest_limit}selected='selected'{/if}>{$locale.544}</option> 
     121                {section name=days start=1 loop=91} 
     122                <option value='{$smarty.section.days.index}' {if $settings2.forum_guest_limit == $smarty.section.days.index}selected='selected'{/if}>{$smarty.section.days.index} {if $smarty.section.days.index == 1}{$locale.527}{else}{$locale.518}{/if}</option> 
    110123                {/section} 
    111124                </select> 
  • trunk/includes/templates/forum.index.tpl

    r1486 r1654  
    4848                        </td> 
    4949                    </tr> 
     50                    {if !iMEMBER && $settings.forum_guest_limit} 
     51                        <tr> 
     52                            <td class='tbl2' align='center' colspan='6'> 
     53                                <span class='small' style='font-size:90%;font-weight:bold;'>{if $settings.forum_guest_limit == 1}{$locale.462|sprintf:$locale.074}{else}{assign var=days value=$settings.forum_guest_limit|cat:" "|cat:$locale.075}{$locale.462|sprintf:$days}{/if}</span> 
     54                            </td> 
     55                        </tr> 
     56                    {/if} 
    5057                    {/if} 
    5158                    <tr> 
  • trunk/includes/templates/forum.viewforum.tpl

    r1616 r1654  
    165165                </tr> 
    166166            {/section} 
     167                {if !iMEMBER && $settings.forum_guest_limit} 
     168                <tr> 
     169                    <td class='tbl2' align='center' colspan='7'> 
     170                        <span class='small' style='font-size:90%;font-weight:bold;'>{if $settings.forum_guest_limit == 1}{$locale.462|sprintf:$locale.074}{else}{assign var=days value=$settings.forum_guest_limit|cat:" "|cat:$locale.075}{$locale.462|sprintf:$days}{/if}</span> 
     171                    </td> 
     172                </tr> 
     173                {/if} 
    167174            </table> 
    168175        </td> 
Note: See TracChangeset for help on using the changeset viewer.