Dotclear

Changeset 3030:1c346de31ad1


Ignore:
Timestamp:
07/03/15 10:44:49 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add an blog option to disable internal search (404 on ?q= queries, search widget hidden), fixes #1888

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • admin/blog_pref.php

    r2987 r3030  
    251251          $blog_settings->system->put('nb_post_per_page',$nb_post_per_page); 
    252252          $blog_settings->system->put('use_smilies',!empty($_POST['use_smilies'])); 
     253          $blog_settings->system->put('no_search',!empty($_POST['no_search'])); 
    253254          $blog_settings->system->put('inc_subcats',!empty($_POST['inc_subcats'])); 
    254255          $blog_settings->system->put('media_img_t_size',$media_img_t_size); 
     
    542543     form::checkbox('use_smilies','1',$blog_settings->system->use_smilies). 
    543544     __('Display smilies on entries and comments').'</label></p>'. 
     545 
     546     '<p><label for="no_search" class="classic">'. 
     547     form::checkbox('no_search','1',$blog_settings->system->no_search). 
     548     __('Disable internal search system').'</label></p>'. 
    544549     '</div>'. 
    545550 
  • inc/core/class.dc.core.php

    r3006 r3030  
    14301430                    array('use_smilies','boolean',false, 
    14311431                    'Show smilies on entries and comments'), 
     1432                    array('no_search','boolean',false, 
     1433                    'Disable search'), 
    14321434                    array('inc_subcats','boolean',false, 
    14331435                    'Include sub-categories in category page and category posts feed'), 
  • inc/dbschema/upgrade.php

    r3027 r3030  
    448448                              " AND setting_value = '/\\.php\$/i' "; 
    449449                    $core->con->execute($strReq); 
     450                    # Some new settings should be initialized, prepare db queries 
     451                    $strReq = 'INSERT INTO '.$core->prefix.'setting'. 
     452                              ' (setting_id,setting_ns,setting_value,setting_type,setting_label)'. 
     453                              ' VALUES(\'%s\',\'system\',\'%s\',\'boolean\',\'%s\')'; 
     454                    $core->con-execute(sprintf($strReq,'no_search','0','Disable internal search system')); 
    450455               } 
    451456 
  • inc/public/lib.urlhandlers.php

    r2919 r3030  
    226226          $core =& $GLOBALS['core']; 
    227227 
    228           $core->url->type='search'; 
    229  
    230           $GLOBALS['_search'] = !empty($_GET['q']) ? rawurldecode($_GET['q']) : ''; 
    231           if ($GLOBALS['_search']) { 
    232                $params = new ArrayObject(array('search' => $GLOBALS['_search'])); 
    233                $core->callBehavior('publicBeforeSearchCount',$params); 
    234                $GLOBALS['_search_count'] = $core->blog->getPosts($params,true)->f(0); 
    235           } 
    236  
    237           self::serveDocument('search.html'); 
     228          if ($core->blog->settings->system->no_search) { 
     229 
     230               # Search is disabled for this blog. 
     231               self::p404(); 
     232 
     233          } else { 
     234 
     235               $core->url->type='search'; 
     236 
     237               $GLOBALS['_search'] = !empty($_GET['q']) ? rawurldecode($_GET['q']) : ''; 
     238               if ($GLOBALS['_search']) { 
     239                    $params = new ArrayObject(array('search' => $GLOBALS['_search'])); 
     240                    $core->callBehavior('publicBeforeSearchCount',$params); 
     241                    $GLOBALS['_search_count'] = $core->blog->getPosts($params,true)->f(0); 
     242               } 
     243 
     244               self::serveDocument('search.html'); 
     245          } 
    238246     } 
    239247 
  • locales/fr/main.po

    r3029 r3030  
    405405msgstr "Afficher des émoticônes dans les billets, pages et commentaires" 
    406406 
     407msgid "Disable internal search system" 
     408msgstr "Désactiver la recherche interne" 
     409 
    407410#, php-format 
    408411msgid "Display %s entries on home page" 
  • locales/fr/plugins.po

    r3029 r3030  
    26282628msgid "Do not encapsulate breadcrumb in a &lt;p id="breadcrumb"&gt;...&lt;/p&gt; tag." 
    26292629msgstr "Ne pas encadrer le fil d'Ariane avec une balise &lt;p id="breadcrumb"&gt;...&lt;/p&gt;." 
     2630 
     2631msgid "Search:" 
     2632msgstr "Recherche :" 
  • plugins/widgets/_widgets_functions.php

    r3019 r3030  
    1919          global $core; 
    2020 
     21          if ($core->blog->settings->system->no_search) 
     22               return; 
     23 
    2124          if ($w->offline) 
    2225               return; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map