plugins/admin/PageGroups.php
changeset 207 861807631f70
parent 187 9dbbec5e6096
child 228 b0a4d179be85
equal deleted inserted replaced
203:8e2fffc5c622 207:861807631f70
     1 <?php
     1 <?php
     2 
     2 
     3 /*
     3 /*
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     5  * Version 1.0.2 (Coblynau)
     5  * Version 1.1.1
     6  * Copyright (C) 2006-2007 Dan Fuhry
     6  * Copyright (C) 2006-2007 Dan Fuhry
     7  *
     7  *
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
    10  *
    10  *
   598                 $q = $db->sql_query('UPDATE '.table_prefix.'page_groups SET pg_target=\'' . $target . '\' WHERE pg_id=' . $edit_id . ';');
   598                 $q = $db->sql_query('UPDATE '.table_prefix.'page_groups SET pg_target=\'' . $target . '\' WHERE pg_id=' . $edit_id . ';');
   599                 if ( !$q )
   599                 if ( !$q )
   600                   $db->_die();
   600                   $db->_die();
   601                 else
   601                 else
   602                   echo '<div class="info-box">The affecting tag was updated.</div>';
   602                   echo '<div class="info-box">The affecting tag was updated.</div>';
   603               }
       
   604             }
       
   605             else if ( $_POST['pg_type'] == PAGE_GRP_REGEX )
       
   606             {
       
   607               $target = $_POST['pg_target'];
       
   608               if ( empty($target) )
       
   609               {
       
   610                 echo '<div class="error-box">Please enter an expression to match against..</div>';
       
   611               }
       
   612               else
       
   613               {
       
   614                 $target = $db->escape($target);
       
   615                 $q = $db->sql_query('UPDATE '.table_prefix.'page_groups SET pg_target=\'' . $target . '\' WHERE pg_id=' . $edit_id . ';');
       
   616                 if ( !$q )
       
   617                   $db->_die();
       
   618                 else
       
   619                   echo '<div class="info-box">The expression to match against was updated.</div>';
       
   620               }
   603               }
   621             }
   604             }
   622             else if ( $_POST['pg_type'] == PAGE_GRP_CATLINK )
   605             else if ( $_POST['pg_type'] == PAGE_GRP_CATLINK )
   623             {
   606             {
   624               $target = $_POST['pg_target'];
   607               $target = $_POST['pg_target'];
   875                   <td class="row1">
   858                   <td class="row1">
   876                     <input type="text" name="pg_target" value="' . htmlspecialchars($row['pg_target']) . '" size="30" />
   859                     <input type="text" name="pg_target" value="' . htmlspecialchars($row['pg_target']) . '" size="30" />
   877                   </td>
   860                   </td>
   878                 </tr>';
   861                 </tr>';
   879           break;
   862           break;
   880         case PAGE_GRP_REGEX:
       
   881           echo '<tr>
       
   882                   <td class="row2">
       
   883                     Regular expression to use:<br />
       
   884                     <small>Be sure to include the starting and ending delimiters and any flags you might need.<br />
       
   885                            These pages might help: <a href="http://us.php.net/manual/en/reference.pcre.pattern.modifiers.php">Pattern modifiers</a> &bull;
       
   886                            <a href="http://us.php.net/manual/en/reference.pcre.pattern.syntax.php">Pattern syntax</a><br />
       
   887                            Examples: <tt>/^(Special|Admin):/i</tt> &bull; <tt>/^Image:([0-9]+)$/</tt><br />
       
   888                            Developers, remember that this will be matched against the full page identifier string. This means that <tt>/^About_Enano$/</tt>
       
   889                            will NOT match the page Special:About_Enano.</small>
       
   890                   </td>
       
   891                   <td class="row1">
       
   892                     <input type="text" name="pg_target" value="' . htmlspecialchars($row['pg_target']) . '" size="30" />
       
   893                   </td>
       
   894                 </tr>';
       
   895           break;
       
   896         case PAGE_GRP_CATLINK:
   863         case PAGE_GRP_CATLINK:
   897           
   864           
   898           // Build category list
   865           // Build category list
   899           $q = $db->sql_query('SELECT name,urlname FROM '.table_prefix.'pages WHERE namespace=\'Category\';');
   866           $q = $db->sql_query('SELECT name,urlname FROM '.table_prefix.'pages WHERE namespace=\'Category\';');
   900           if ( !$q )
   867           if ( !$q )