[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/mods/replace/ -> settings.php (source)

   1  <?php
   2  
   3      if(!defined("PHORUM_ADMIN")) return;
   4  
   5      $error="";
   6      $curr="NEW";
   7  
   8      $match_types = array("string", "PCRE");
   9  
  10      if(count($_POST) && $_POST["search"]!="" && $_POST["replace"]!=""){
  11  
  12          $item = array("search"=>$_POST["search"], "replace"=>$_POST["replace"], "pcre"=>$_POST["pcre"]);
  13  
  14          if($_POST["curr"]!="NEW"){
  15              $PHORUM["mod_replace"][$_POST["curr"]]=$item;
  16          } else {
  17              $PHORUM["mod_replace"][]=$item;
  18          }
  19  
  20          if(empty($error)){
  21              if(!phorum_db_update_settings(array("mod_replace"=>$PHORUM["mod_replace"]))){
  22                  $error="Database error while updating settings.";
  23              } else {
  24                  echo "Replacement Updated<br />";
  25              }
  26          }
  27      }
  28  
  29      if(isset($_GET["curr"])){
  30          if(isset($_GET["delete"])){
  31              unset($PHORUM["mod_replace"][$_GET["curr"]]);
  32              phorum_db_update_settings(array("mod_replace"=>$PHORUM["mod_replace"]));
  33              echo "Replacement Deleted<br />";
  34          } else {
  35              $curr = $_GET["curr"];
  36          }
  37      }
  38  
  39  
  40      if($curr!="NEW"){
  41          extract($PHORUM["mod_replace"][$curr]);
  42          $title="Edit Replacement";
  43          $submit="Update";
  44      } else {
  45          settype($string, "string");
  46          settype($type, "int");
  47          settype($pcre, "int");
  48          $title="Add A Replacement";
  49          $submit="Add";
  50      }
  51  
  52      include_once  "./include/admin/PhorumInputForm.php";
  53  
  54      $frm =& new PhorumInputForm ("", "post", $submit);
  55  
  56      $frm->hidden("module", "modsettings");
  57  
  58      $frm->hidden("mod", "replace");
  59  
  60      $frm->hidden("curr", "$curr");
  61  
  62      $frm->addbreak($title);
  63  
  64      $frm->addrow("String To Match", $frm->text_box("search", $search, 50));
  65  
  66      $frm->addrow("Replacement", $frm->text_box("replace", $replace, 50));
  67  
  68      $frm->addrow("Compare As", $frm->select_tag("pcre", $match_types, $pcre));
  69  
  70      $frm->show();
  71  
  72      echo "If using PCRE for comparison, \"Sting To Match\" should be a valid PCRE expression. See <a href=\"http://php.net/pcre\">the PHP manual</a> for more information.";
  73  
  74      if($curr=="NEW"){
  75  
  76          echo "<hr class=\"PhorumAdminHR\" />";
  77  
  78          if(count($PHORUM["mod_replace"])){
  79  
  80              echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
  81              echo "<tr>\n";
  82              echo "    <td class=\"PhorumAdminTableHead\">Search</td>\n";
  83              echo "    <td class=\"PhorumAdminTableHead\">Replace</td>\n";
  84              echo "    <td class=\"PhorumAdminTableHead\">Compare Method</td>\n";
  85              echo "    <td class=\"PhorumAdminTableHead\">&nbsp;</td>\n";
  86              echo "</tr>\n";
  87  
  88              foreach($PHORUM["mod_replace"] as $key => $item){
  89                  echo "<tr>\n";
  90                  echo "    <td class=\"PhorumAdminTableRow\">".htmlspecialchars($item["search"])."</td>\n";
  91                  echo "    <td class=\"PhorumAdminTableRow\">".htmlspecialchars($item["replace"])."</td>\n";
  92                  echo "    <td class=\"PhorumAdminTableRow\">".$match_types[$item["pcre"]]."</td>\n";
  93                  echo "    <td class=\"PhorumAdminTableRow\"><a href=\"$_SERVER[PHP_SELF]?module=modsettings&mod=replace&curr=$key&?edit=1\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"$_SERVER[PHP_SELF]?module=modsettings&mod=replace&curr=$key&delete=1\">Delete</a></td>\n";
  94                  echo "</tr>\n";
  95              }
  96  
  97              echo "</table>\n";
  98  
  99          } else {
 100  
 101              echo "No replacements in list currently.";
 102  
 103          }
 104  
 105      }
 106  
 107  ?>


Généré le : Thu Nov 29 12:22:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics