[ PHPXref.com ] [ Generated: Sun Jul 20 17:32:23 2008 ] [ ErfurtWiki 1.02b ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/tools/ -> t_flags.php (source)

   1  <?php
   2    include ("t_config.php");
   3  ?>
   4  <html>
   5  <head>
   6   <title>edit ewiki page flags</title>
   7   <link rel="stylesheet" type="text/css" href="t_config.css">
   8  </head>
   9  <body bgcolor="#ffffff" text="#000000">
  10  <h1>edit page flags</h1>
  11  <?php
  12  
  13  
  14    $FD = array(
  15       EWIKI_DB_F_TEXT => "TXT",
  16       EWIKI_DB_F_BINARY => "BIN",
  17       EWIKI_DB_F_DISABLED => "OFF",
  18       EWIKI_DB_F_HTML => "HTM",
  19       EWIKI_DB_F_READONLY => "RO",
  20       EWIKI_DB_F_WRITEABLE => "WR",
  21    );
  22  
  23    if (empty($_REQUEST["set"])) {
  24  
  25       $result = ewiki_db::GETALL(array("version", "flags"));
  26  
  27       echo '<form action="t_flags.php" method="POST" enctype="multipart/form-data">';
  28       echo '<table class="list" border="0" cellspacing="3" cellpadding="2" width="96%">' . "\n";
  29  
  30       while ($row = $result->get()) {
  31          $id = $row["id"];
  32  
  33          $data = ewiki_db::GET($row);
  34  
  35          echo '<tr><td width="40%">';
  36          if ($data["flags"] & EWIKI_DB_F_TEXT) {
  37             echo '<a href="' . ewiki_script("", $id) . '">';
  38          }
  39          else {
  40             echo '<a href="' . ewiki_script_binary("", $id) . '">';
  41          }
  42          echo htmlentities($id) . '</a><small>' .  (".".$row["version"]) . '</small></td>';
  43  
  44          echo '<td><small>';
  45          foreach ($FD as $n=>$str) {
  46             echo '<input type="checkbox" name="set['. rawurlencode($id)
  47                  . '][' . $n . ']" value="1" '
  48                  . (($data["flags"] & $n) ? "CHECKED" : "")
  49                  . '>'.$str. ' ';
  50          }
  51          echo "</small></td>";
  52  
  53          echo "</tr>\n";
  54  
  55       }
  56  
  57       echo '</table><input type="submit" value="&nbsp;    change settings    &nbsp;"></form>';
  58  
  59    }
  60    else {
  61  
  62       foreach($_REQUEST["set"] as $page=>$fa) {
  63  
  64          $page = rawurldecode($page);
  65  
  66          $flags = 0;
  67          $fstr = "";
  68          foreach($fa as $num=>$isset) {
  69             if ($isset) {
  70                $flags += $num;
  71                $fstr .= ($fstr?",":""). $FD[$num];
  72             }
  73          }
  74  
  75          echo " ".htmlentities($page)." ({$flags}=<small>[{$fstr}]</small>)";
  76  
  77          $data = ewiki_db::GET($page);
  78  
  79          if ($data["flags"] != $flags) {
  80             $data["flags"] = $flags;
  81             $data["author"] = "ewiki-tools, " . ewiki_author();
  82             $data["version"]++;
  83             ewiki_db::WRITE($data);
  84             echo " <b>[set]</b>";
  85          }
  86          else {
  87             echo " [not changed]";
  88          }
  89  
  90          echo "<br>\n";
  91  
  92       }
  93  
  94    }
  95  
  96  
  97    function strong_htmlentities($str) {
  98       return preg_replace('/([^-., \w\d])/e', '"&#".ord("\\1").";"', $str);
  99    }
 100  
 101  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]