Changeset 2360 in ExiteCMS


Ignore:
Timestamp:
07/26/10 12:06:04 (19 months ago)
Author:
WanWizard
Message:

added a forum option to enable/disable the use of subject prefixes per forum

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/forums.php

    r2341 r2360  
    215215    $forum_attach = isset($_POST['forum_attach'])?"1":"0"; 
    216216    $forum_attachtypes = stripinput($_POST['forum_attachtypes']); 
     217    $forum_prefix = isset($_POST['forum_prefix'])?"1":"0"; 
    217218    $forum_prefixes = stripinput($_POST['forum_prefixes']); 
    218219    if ($action == "edit" && $t == "forum") { 
     
    240241        } 
    241242        // update the forum record 
    242         $result = dbquery("UPDATE ".$db_prefix."forums SET forum_name='".mysql_real_escape_string($forum_name)."', forum_cat='$forum_cat', forum_description='".mysql_real_escape_string($forum_description)."', forum_access='$forum_access', forum_posting='$forum_posting', forum_modgroup='$forum_modgroup', forum_attach='$forum_attach', forum_attachtypes='$forum_attachtypes', forum_prefixes='".mysql_real_escape_string($forum_prefixes)."', forum_rulespage='$forum_rulespage', forum_banners='$forum_banners' WHERE forum_id='$forum_id'"); 
     243        $result = dbquery("UPDATE ".$db_prefix."forums SET forum_name='".mysql_real_escape_string($forum_name)."', forum_cat='$forum_cat', forum_description='".mysql_real_escape_string($forum_description)."', forum_access='$forum_access', forum_posting='$forum_posting', forum_modgroup='$forum_modgroup', forum_attach='$forum_attach', forum_attachtypes='$forum_attachtypes', forum_prefix='$forum_prefix', forum_prefixes='".mysql_real_escape_string($forum_prefixes)."', forum_rulespage='$forum_rulespage', forum_banners='$forum_banners' WHERE forum_id='$forum_id'"); 
    243244        redirect(FUSION_SELF.$aidlink."&status=savefe"); 
    244245    } else { 
     
    248249            if(!$forum_order) $forum_order=dbfunction("MAX(forum_order)", "forums", "forum_cat='$forum_cat'")+1; 
    249250            $result = dbquery("UPDATE ".$db_prefix."forums SET forum_order=forum_order+1 WHERE forum_cat='$forum_cat' AND forum_order>='$forum_order'"); 
    250             $result = dbquery("INSERT INTO ".$db_prefix."forums (forum_cat, forum_name, forum_order, forum_description, forum_moderators, forum_access, forum_posting, forum_modgroup, forum_attach, forum_attachtypes, forum_prefixes, forum_rulespage, forum_banners, forum_lastpost, forum_lastuser) VALUES ('$forum_cat', '$forum_name', '$forum_order', '$forum_description', '$forum_mods', '$forum_access', '$forum_posting', '$forum_modgroup', '$forum_attach', '$forum_attachtypes', '".mysql_real_escape_string($forum_prefixes)."', '$forum_rulespage', '$forum_banners', '0', '0')"); 
     251            $result = dbquery("INSERT INTO ".$db_prefix."forums (forum_cat, forum_name, forum_order, forum_description, forum_moderators, forum_access, forum_posting, forum_modgroup, forum_attach, forum_attachtypes, forum_prefix, forum_prefixes, forum_rulespage, forum_banners, forum_lastpost, forum_lastuser) VALUES ('$forum_cat', '$forum_name', '$forum_order', '$forum_description', '$forum_mods', '$forum_access', '$forum_posting', '$forum_modgroup', '$forum_attach', '$forum_attachtypes', '$forum_prefix', '".mysql_real_escape_string($forum_prefixes)."', '$forum_rulespage', '$forum_banners', '0', '0')"); 
    251252            redirect(FUSION_SELF.$aidlink."&status=savefu"); 
    252253        } 
     
    321322            $forum_attach = $data['forum_attach']?true:false; 
    322323            $forum_attachtypes = $data['forum_attachtypes']; 
     324            $forum_prefix = $data['forum_prefix']; 
    323325            $forum_prefixes = $data['forum_prefixes']; 
    324326            $forum_title = $locale['422']; 
     
    346348        $forum_attach = ($settings['attachments'] == 1); 
    347349        $forum_attachtypes = $settings['attachtypes']; 
     350        $forum_prefix = 0; 
    348351        $forum_prefixes = ""; 
    349352        $forum_title = $locale['421']; 
     
    420423        $variables['forum_attach'] = $forum_attach; 
    421424        $variables['forum_attachtypes'] = $forum_attachtypes; 
     425        $variables['forum_prefix'] = $forum_prefix; 
    422426        $variables['forum_prefixes'] = $forum_prefixes; 
    423427        $variables['forum_rulespage'] = $forum_rulespage; 
  • trunk/administration/tools/language_pack_English.php

    r2354 r2360  
    1 <?php  
     1<?php 
    22/*---------------------------------------------------------------------+ 
    33| ExiteCMS Content Management System                                   | 
     
    368368        $localestrings['493'] = "Refresh Forum Ordering"; 
    369369        $localestrings['494'] = "Subject prefix list:"; 
     370        $localestrings['495'] = "Use subject prefixes in this forum"; 
    370371        load_localestrings($localestrings, LP_LOCALE, "admin.forums", $step); 
    371372 
     
    38203821    function load_localestrings($localestrings, $locales_code, $locales_name, $step="") { 
    38213822        global $db_prefix, $_db_log; 
    3822      
     3823 
    38233824        // if this is an upgrade, remove the old locale strings first 
    38243825        if ($step == "upgrade") { 
     
    38633864        locale_load("admin.main"); 
    38643865    } 
    3865      
     3866 
    38663867    if (defined('CMS_SETUP') && !defined('CMS_SETUP_LOAD')) { 
    38673868        // skip if in setup and no load request was given 
     
    38743875        require_once PATH_INCLUDES."theme_functions.php"; 
    38753876    } 
    3876      
     3877 
    38773878    // used to store template variables 
    38783879    $variables = array(); 
    3879      
     3880 
    38803881    // message variable 
    38813882    $variables['message'] = ""; 
    3882      
     3883 
    38833884    // make sure step has a value 
    38843885    if (!isset($step)) $step = ""; 
    3885      
     3886 
    38863887    // de-install the language pack 
    38873888    if ($step == "remove") { 
     
    39033904        } 
    39043905    } 
    3905      
     3906 
    39063907    // install the language pack 
    39073908    if ($step == "install" || $step == "upgrade") { 
     
    39273928        } 
    39283929    } 
    3929      
     3930 
    39303931    if (defined('CMS_SETUP')) { 
    3931      
     3932 
    39323933        // no output at all in setup mode 
    3933          
     3934 
    39343935    } elseif (CMS_CLI) { 
    3935      
     3936 
    39363937        // output in CLI mode 
    39373938        echo "Language pack installed.\n"; 
    3938          
     3939 
    39393940    } else { 
    3940      
     3941 
    39413942        // interactive mode 
    39423943        require_once PATH_INCLUDES."theme_functions.php"; 
    3943      
     3944 
    39443945        // countries for which this language pack applies 
    39453946        $variables['flags'] = explode("|", LP_COUNTRIES); 
     
    39473948        // check the last update of the locale 
    39483949        $variables['last_update'] = isset($settings['LanguagePack.'.LP_LANGUAGE]) ? $settings['LanguagePack.'.LP_LANGUAGE] : min(LP_DATE - 1, dbfunction("MAX(locales_datestamp)", "locales", "locales_code = '".LP_LOCALE."' AND locales_name NOT LIKE 'modules%'")); 
    3949          
     3950 
    39503951        // check if this language pack has been installed 
    39513952        $variables['can_install'] = dbcount("(*)", "locale", "locale_code = '".LP_LOCALE."'") == 0; 
    39523953        $variables['can_remove'] = LP_LOCALE != $settings['default_locale'] && $variables['can_install'] == false; 
    39533954        $variables['can_upgrade'] = $variables['can_install'] == false && $variables['last_update'] < LP_DATE; 
    3954      
     3955 
    39553956        // define the body panel variables 
    39563957        $template_panels[] = array('type' => 'body', 'name' => 'admin.tools.languagepack', 'title' => "ExiteCMS Language Packs", 'template' => 'admin.tools.languagepack.tpl', 'locale' => "admin.main"); 
    39573958        $template_variables['admin.tools.languagepack'] = $variables; 
    3958          
     3959 
    39593960        // Call the theme code to generate the output for this webpage 
    39603961        require_once PATH_THEME."/theme.php"; 
  • trunk/administration/tools/language_pack_Nederlands.php

    r2354 r2360  
    1 <?php  
     1<?php 
    22/*---------------------------------------------------------------------+ 
    33| ExiteCMS Content Management System                                   | 
     
    368368        $localestrings['493'] = "Volgorde herrekenen"; 
    369369        $localestrings['494'] = "Topic prefix lijst:"; 
     370        $localestrings['495'] = "Gebruik topic prefixen voor dit forum"; 
    370371        load_localestrings($localestrings, LP_LOCALE, "admin.forums", $step); 
    371372 
     
    38203821    function load_localestrings($localestrings, $locales_code, $locales_name, $step="") { 
    38213822        global $db_prefix, $_db_log; 
    3822      
     3823 
    38233824        // if this is an upgrade, remove the old locale strings first 
    38243825        if ($step == "upgrade") { 
     
    38633864        locale_load("admin.main"); 
    38643865    } 
    3865      
     3866 
    38663867    if (defined('CMS_SETUP') && !defined('CMS_SETUP_LOAD')) { 
    38673868        // skip if in setup and no load request was given 
     
    38743875        require_once PATH_INCLUDES."theme_functions.php"; 
    38753876    } 
    3876      
     3877 
    38773878    // used to store template variables 
    38783879    $variables = array(); 
    3879      
     3880 
    38803881    // message variable 
    38813882    $variables['message'] = ""; 
    3882      
     3883 
    38833884    // make sure step has a value 
    38843885    if (!isset($step)) $step = ""; 
    3885      
     3886 
    38863887    // de-install the language pack 
    38873888    if ($step == "remove") { 
     
    39033904        } 
    39043905    } 
    3905      
     3906 
    39063907    // install the language pack 
    39073908    if ($step == "install" || $step == "upgrade") { 
     
    39273928        } 
    39283929    } 
    3929      
     3930 
    39303931    if (defined('CMS_SETUP')) { 
    3931      
     3932 
    39323933        // no output at all in setup mode 
    3933          
     3934 
    39343935    } elseif (CMS_CLI) { 
    3935      
     3936 
    39363937        // output in CLI mode 
    39373938        echo "Language pack installed.\n"; 
    3938          
     3939 
    39393940    } else { 
    3940      
     3941 
    39413942        // interactive mode 
    39423943        require_once PATH_INCLUDES."theme_functions.php"; 
    3943      
     3944 
    39443945        // countries for which this language pack applies 
    39453946        $variables['flags'] = explode("|", LP_COUNTRIES); 
     
    39473948        // check the last update of the locale 
    39483949        $variables['last_update'] = isset($settings['LanguagePack.'.LP_LANGUAGE]) ? $settings['LanguagePack.'.LP_LANGUAGE] : min(LP_DATE - 1, dbfunction("MAX(locales_datestamp)", "locales", "locales_code = '".LP_LOCALE."' AND locales_name NOT LIKE 'modules%'")); 
    3949          
     3950 
    39503951        // check if this language pack has been installed 
    39513952        $variables['can_install'] = dbcount("(*)", "locale", "locale_code = '".LP_LOCALE."'") == 0; 
    39523953        $variables['can_remove'] = LP_LOCALE != $settings['default_locale'] && $variables['can_install'] == false; 
    39533954        $variables['can_upgrade'] = $variables['can_install'] == false && $variables['last_update'] < LP_DATE; 
    3954      
     3955 
    39553956        // define the body panel variables 
    39563957        $template_panels[] = array('type' => 'body', 'name' => 'admin.tools.languagepack', 'title' => "ExiteCMS Language Packs", 'template' => 'admin.tools.languagepack.tpl', 'locale' => "admin.main"); 
    39573958        $template_variables['admin.tools.languagepack'] = $variables; 
    3958          
     3959 
    39593960        // Call the theme code to generate the output for this webpage 
    39603961        require_once PATH_THEME."/theme.php"; 
  • trunk/forum/post.php

    r2358 r2360  
    7272 
    7373    // is a prefix required? 
    74     if (!empty($fdata['forum_prefixes']) && empty($_POST['new_prefix'])) { 
     74    if ($fdata['forum_prefix'] && !empty($fdata['forum_prefixes']) && empty($_POST['new_prefix'])) { 
    7575        return $locale['475']; 
    7676    } 
     
    691691                        } 
    692692                    } 
    693                     $subject = add_prefix($subject, stripinput($_POST['new_prefix'])); 
     693                    if ($fdata['forum_prefix']) { 
     694                        $subject = add_prefix($subject, stripinput($_POST['new_prefix'])); 
     695                    } 
    694696                    $message = trim(stripmessageinput(censorwords($_POST['message']))); 
    695697                    if ($action == 'edit') { 
  • trunk/includes/templates/admin.forums.tpl

    r2341 r2360  
    6565            <tr> 
    6666                <td colspan='2' class='tbl'> 
     67                    <input type='checkbox' name='forum_prefix' value='1' onchange='togglefields("prefixes");'{if $forum_prefix} checked="checked"{/if} /> {$locale.495} 
     68                </td> 
     69            </tr> 
     70            <tr id='prefixes'{if !$forum_prefix} style='display:none'{/if}> 
     71                <td colspan='2' class='tbl'> 
    6772                    {$locale.494} 
    6873                    <br /> 
     
    145150            <tr> 
    146151                <td colspan='2' class='tbl'> 
    147                     <input type='checkbox' name='forum_attach' value='1' onchange='togglefields();'{if $forum_attach} checked="checked"{/if} /> {$locale.469} 
     152                    <input type='checkbox' name='forum_attach' value='1' onchange='togglefields("attachtypes");'{if $forum_attach} checked="checked"{/if} /> {$locale.469} 
    148153                </td> 
    149154            </tr> 
     
    167172    </form> 
    168173{literal}<script type='text/javascript'> 
    169 function togglefields() { 
     174function togglefields(name) { 
    170175    if(navigator.appName.indexOf('Microsoft') > -1) { 
    171176        state = 'block'; 
     
    173178        state = 'table-row'; 
    174179    } 
    175     if (document.getElementById('attachtypes').style.display == 'none') { 
    176         document.getElementById('attachtypes').style.display = state; 
     180    if (document.getElementById(name).style.display == 'none') { 
     181        document.getElementById(name).style.display = state; 
    177182    } else { 
    178         document.getElementById('attachtypes').style.display = 'none'; 
     183        document.getElementById(name).style.display = 'none'; 
    179184    } 
    180185} 
  • trunk/includes/templates/forum.post.tpl

    r2353 r2360  
    124124            <td> 
    125125                <table width='100%' border='0' cellspacing='1' cellpadding='0'> 
    126                     <tr> 
     126                    <tr {if $forum.forum_prefix == 0}style="display:none;"{/if}> 
    127127                        <td align='right' width='145' valign='top' class='tbl2'> 
    128128                            {$locale.533}: 
Note: See TracChangeset for help on using the changeset viewer.