[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_tmpl/ -> admin.filecat.tmpl.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  if(isset($_GET["open"])) {
  32      list($open_id, $open_value) = explode(":", $_GET["open"]);
  33      $_SESSION["fcatlist"][intval($open_id)] = intval($open_value);
  34  }
  35  ?>
  36  <table width="538" border="0" cellpadding="0" cellspacing="0" summary="">
  37            <tr><td colspan="2" class="title"><?php echo $BL['be_admin_fcat_title'] ?></td></tr>
  38            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="4" /></td></tr>
  39            <?php
  40            if(isset($_GET["fcatid"])) {
  41            ?>
  42            <tr><td colspan="2"><img src="img/lines/l538_70.gif" alt="" width="538" height="1" /></td>
  43      </tr>
  44            <tr bgcolor="#F0F2F4"><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td>
  45      </tr>
  46            <?php
  47                $fcat["id"] = intval($_GET["fcatid"]);
  48              if($fcat["id"]) {    
  49                  $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_filecat WHERE fcat_id=".$fcat["id"]." LIMIT 1";
  50                  if($result = mysql_query($sql, $db) or die("error while getting file category infos")) {
  51                      if($row = mysql_fetch_array($result)) {
  52                          $fcat["name"]    = $row["fcat_name"];
  53                          $fcat["active"]    = $row["fcat_aktiv"];
  54                          $fcat["needed"]    = $row["fcat_needed"];
  55                          $fcat["sort"]    = $row["fcat_sort"];
  56                      }
  57                      mysql_free_result($result);
  58                  }
  59                  $sendbutton = $BL['be_admin_fcat_button1'];
  60              } else {
  61                  $sendbutton = $BL['be_admin_fcat_button2'];
  62              }
  63            
  64              if(isset($_POST["fcat_aktion"]) && intval($_POST["fcat_aktion"])) { //Formular zum Bearbeiten der Dateikategorie-Namen
  65                  
  66                  $fcat["name"]    = clean_slweg($_POST["fcat_name"], 250);
  67                  $fcat["id"]        = intval($_POST["fcat_id"]);
  68                  $fcat["active"]    = empty($_POST["fcat_active"]) ? 0 : 1;
  69                  $fcat["needed"]    = empty($_POST["fcat_needed"]) ? 0 : 1;
  70                  $fcat["sort"]    = empty($_POST["fcat_sort"]) ? 0 : intval($_POST["fcat_sort"]);
  71              
  72                  if(isEmpty($fcat["name"])) {
  73                      $fcat["error"] = 1; 
  74                  } else {
  75                      if(!$fcat["id"]) {
  76                          $sql  = "INSERT INTO ".DB_PREPEND."phpwcms_filecat (fcat_name, fcat_aktiv, fcat_needed, fcat_sort) VALUES ('";
  77                          $sql .= aporeplace($fcat["name"])."', ".$fcat["active"].", ".$fcat["needed"].", ".$fcat["sort"].")";                        
  78                      } else {
  79                          $sql  = "UPDATE ".DB_PREPEND."phpwcms_filecat SET fcat_name='".aporeplace($fcat["name"]);
  80                          $sql .= "', fcat_aktiv=".$fcat["active"].", fcat_needed=".$fcat["needed"].", fcat_sort=".$fcat["sort"]." WHERE fcat_id=".$fcat["id"];
  81                      }
  82                      if($result = mysql_query($sql, $db) or die("error while inserting/updating file category")) {
  83                          if(!$fcat["id"]) $fcat["id"] = mysql_insert_id($db);
  84                          headerRedirect(PHPWCMS_URL."phpwcms.php?do=admin&p=7");
  85                      }            
  86                  }
  87              
  88              }
  89            
  90            ?>
  91            <form action="phpwcms.php?do=admin&amp;p=7&amp;fcatid=<?php echo $fcat["id"] ?>" method="post" name="filecategory" id="filecategory">
  92            <tr align="center" bgcolor="#F0F2F4"><td colspan="2"><table border="0" cellpadding="0" cellspacing="0" summary="">
  93                <?php if(!empty($fcat["error"])) { ?>
  94              <tr>
  95                <td align="right" class="chatlist"><font color="#FF3300"><?php echo $BL['be_admin_usr_err'] ?>:</font>&nbsp;</td>
  96                <td class="error"><strong><?php echo $BL['be_admin_fcat_err'] ?></strong></td>
  97              </tr>
  98              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="3" /></td>
  99              </tr>
 100              <?php } ?>
 101              <tr>
 102                <td align="right" class="chatlist"><?php echo $BL['be_admin_fcat_name'] ?>:&nbsp;</td>
 103                <td><input name="fcat_name" type="text" id="fcat_name" class="width400" value="<?php echo  empty($fcat["name"]) ? '' : html_specialchars($fcat["name"]) ?>" size="40" maxlength="250" /></td>
 104              </tr>
 105              
 106  
 107              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6" /></td></tr>
 108  
 109              <tr>
 110                <td align="right" class="chatlist"><?php echo $BL['be_cnt_sorting'] ?>:&nbsp;</td>
 111                <td><input name="fcat_sort" type="text" id="fcat_sort" class="width75" value="<?php echo empty($fcat["sort"]) ? 0 : $fcat["sort"] ?>" size="10" maxlength="8" /></td>
 112              </tr>            
 113          
 114              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6" /></td></tr>
 115              <tr>
 116                <td align="right" class="chatlist"><?php echo $BL['be_ftptakeover_status'] ?>:&nbsp;</td>
 117                <td><table border="0" cellpadding="0" cellspacing="0" bgcolor="#D9DEE3" summary="">
 118                  <tr>
 119                    <td><input name="fcat_active" type="checkbox" id="fcat_active" value="1"<?php is_checked(1, empty($fcat["active"]) ? 0 : $fcat["active"]); ?> /></td>
 120                    <td><label for="fcat_active"><?php echo $BL['be_ftptakeover_active'] ?></label>&nbsp;&nbsp;</td>
 121                    <td><input name="fcat_needed" type="checkbox" id="fcat_needed" value="1"<?php is_checked(1, empty($fcat["needed"]) ? 0 : $fcat["needed"]); ?> /></td>
 122                    <td><label for="fcat_needed"><?php echo $BL['be_admin_fcat_needed'] ?></label>&nbsp;&nbsp;</td>
 123                  </tr>
 124                </table></td>
 125                </tr>
 126              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td>
 127              </tr>
 128              <tr>
 129                <td>
 130                &nbsp;
 131                <input name="fcat_id" type="hidden" id="fcat_id" value="<?php echo intval($fcat["id"]) ?>" />
 132                <input name="fcat_aktion" type="hidden" id="fcat_aktion" value="1" />
 133                </td>
 134                <td>
 135                <input name="Submit" type="submit" class="button10" value="<?php echo $sendbutton ?>" />
 136                &nbsp;&nbsp;
 137                <input name="donotsubmit" type="button" class="button10" value="<?php echo $BL['be_admin_fcat_exit'] ?>" onclick="location.href='phpwcms.php?do=admin&amp;p=7';" /></td>
 138                </tr>
 139              </table></td>
 140            </tr>
 141            <tr bgcolor="#F0F2F4"><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="15" /></td>
 142            </tr>
 143            </form>
 144  <?php
 145            } //Ende Anzeige Category Name Formular
 146            
 147            if(isset($_GET["fkeyid"])) { //Keyname
 148            ?>
 149            <tr><td colspan="2"><img src="img/lines/l538_70.gif" alt="" width="538" height="1" /></td>
 150      </tr>
 151            <tr bgcolor="#F0F2F4"><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td>
 152      </tr>
 153            <?php
 154                $fkey["id"] = intval($_GET["fkeyid"]);
 155              $fkey["cid"] = intval($_GET["cid"]);
 156              if($fkey["id"]) {    
 157                  $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_filekey WHERE fkey_id=".$fkey["id"]." LIMIT 1";
 158                  if($result = mysql_query($sql, $db) or die("error while getting file key infos")) {
 159                      if($row = mysql_fetch_array($result)) {
 160                          $fkey["name"]    = $row["fkey_name"];
 161                          $fkey["active"]    = $row["fkey_aktiv"];
 162                          $fkey["cid"]    = $row["fkey_cid"];
 163                          $fkey["sort"]    = $row["fkey_sort"];
 164                      }
 165                      mysql_free_result($result);
 166                  }
 167                  $sendbutton = $BL['be_admin_fcat_button1'];
 168              } else {
 169                  $sendbutton = $BL['be_admin_fcat_button2'];
 170              }
 171            
 172              if(!empty($_POST["fkey_aktion"])) { //Formular zum Bearbeiten der Dateischlüssel-Namen
 173                  
 174                  $fkey["name"]    = clean_slweg($_POST["fkey_name"], 250);
 175                  $fkey["id"]        = intval($_POST["fkey_id"]);
 176                  $fkey["active"]    = intval($_POST["fkey_active"]);
 177                  $fkey["cid"]    = intval($_POST["fkey_cid"]);
 178                  $fkey["sort"]    = empty($_POST["fkey_sort"]) ? 0 : intval($_POST["fkey_sort"]);
 179              
 180                  if(isEmpty($fkey["name"])) {
 181                      $fkey["error"] = 1; 
 182                  } else {
 183                      if(!$fkey["id"]) {
 184                          $sql  = "INSERT INTO ".DB_PREPEND."phpwcms_filekey (fkey_name, fkey_aktiv, fkey_cid, fkey_sort) VALUES ('";
 185                          $sql .= aporeplace($fkey["name"])."', ".$fkey["active"].", ".$fkey["cid"].", ".$fkey["sort"].")";                        
 186                      } else {
 187                          $sql  = "UPDATE ".DB_PREPEND."phpwcms_filekey SET fkey_name='".aporeplace($fkey["name"]);
 188                          $sql .= "', fkey_aktiv=".$fkey["active"].", fkey_cid=".$fkey["cid"].", fkey_sort=".$fkey["sort"]." WHERE fkey_id=".$fkey["id"];
 189                      }
 190                      if($result = mysql_query($sql, $db) or die("error while inserting/updating file key")) {
 191                          if(!$fkey["id"]) $fkey["id"] = mysql_insert_id($db);
 192                          headerRedirect(PHPWCMS_URL."phpwcms.php?do=admin&p=7");
 193                      }            
 194                  }
 195              
 196              }
 197            
 198            ?>
 199            <form action="phpwcms.php?do=admin&amp;p=7&amp;fkeyid=<?php echo $fkey["id"]."&cid=".$fkey["cid"] ?>" method="post" name="filekey" id="filekey">
 200            <tr align="center" bgcolor="#F0F2F4"><td colspan="2"><table border="0" cellpadding="0" cellspacing="0" summary="">
 201            <tr>
 202                <td align="right" class="chatlist"><?php echo $BL['be_admin_fcat_fcat'] ?>:&nbsp;</td>
 203                <td><select name="fkey_cid" id="fkey_cid">
 204                <?php
 205                    $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_filecat WHERE fcat_deleted=0 ORDER BY fcat_name";
 206                  if($result = mysql_query($sql, $db) or die("error while creating file category list")) {
 207                      while($row = mysql_fetch_array($result)) {
 208                          echo "<option value=\"".$row["fcat_id"]."\"".
 209                               (($row["fcat_id"]==$fkey["cid"])?" selected":"").
 210                               ">".html_specialchars($row["fcat_name"])."</option>\n";
 211                      }
 212                      mysql_free_result($result);
 213                  }
 214                
 215                ?>
 216                  </select></td>
 217              </tr>
 218              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="3" /></td>
 219              </tr>
 220                <?php if(!empty($fkey["error"])) { ?>
 221              <tr>
 222                <td align="right" class="chatlist"><span style="color:#FF3300"><?php echo $BL['be_admin_usr_err'] ?>:</span>&nbsp;</td>
 223                <td class="error"><strong><?php echo $BL['be_admin_fcat_err1']  ?></strong></td>
 224              </tr>
 225              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="3" /></td>
 226              </tr>
 227              <?php } ?>
 228              <tr>
 229                <td align="right" class="chatlist"><?php echo $BL['be_admin_fcat_fkeyname'] ?>:&nbsp;</td>
 230                <td><input name="fkey_name" type="text" id="fkey_name" class="width400" value="<?php echo html_specialchars(empty($fkey["name"]) ? '' : $fkey["name"]) ?>" size="40" maxlength="250" /></td>
 231              </tr>
 232              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6" /></td></tr>
 233              
 234              <tr>
 235                <td align="right" class="chatlist"><?php echo $BL['be_cnt_sorting'] ?>:&nbsp;</td>
 236                <td><input name="fkey_sort" type="text" id="fkey_sort" class="width75" value="<?php echo empty($fkey["sort"]) ? 0 : $fkey["sort"] ?>" size="10" maxlength="8" /></td>
 237              </tr>            
 238          
 239              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="6" /></td></tr>
 240              
 241              
 242              <tr>
 243                <td align="right" class="chatlist"><?php echo $BL['be_ftptakeover_status'] ?>:&nbsp;</td>
 244                <td><table border="0" cellpadding="0" cellspacing="0" bgcolor="#D9DEE3" summary="">
 245                  <tr>
 246                    <td><input name="fkey_active" type="checkbox" id="fkey_active" value="1"<?php is_checked(1, empty($fkey["active"]) ? 0 : $fkey["active"]); ?> /></td>
 247                    <td><label for="fkey_active"><?php echo $BL['be_ftptakeover_active'] ?></label>&nbsp;&nbsp;</td>
 248                  </tr>
 249                </table></td>
 250                </tr>
 251              <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td>
 252              </tr>
 253              <tr>
 254                <td>
 255                &nbsp;
 256                <input name="fkey_id" type="hidden" id="fkey_id" value="<?php echo intval($fkey["id"]) ?>" />
 257                <input name="fkey_aktion" type="hidden" id="fkey_aktion" value="1" /></td>
 258                <td>
 259                <input name="Submit" type="submit" class="button10" value="<?php echo $sendbutton ?>" />
 260                &nbsp;&nbsp;
 261                <input name="donotsubmit" type="button" class="button10" value="<?php echo $BL['be_admin_fcat_exit'] ?>" onclick="location.href='phpwcms.php?do=admin&amp;p=7';" /></td>
 262              </tr>
 263              </table></td>
 264            </tr>
 265            <tr bgcolor="#F0F2F4"><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="15" /></td>
 266            </tr>
 267            </form>
 268  <?php
 269            } //Ende Anzeige Key Name Formular
 270            
 271            
 272            ?>
 273            <tr><td colspan="2"><img src="img/lines/l538_70.gif" alt="" width="538" height="1" /></td>
 274      </tr>
 275            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 276      </tr>
 277            <?php
 278              $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_filecat WHERE fcat_deleted=0 ORDER BY fcat_sort, fcat_name";
 279              if($result = mysql_query($sql, $db) or die("error while browsing file categories")) {
 280                  while($row = mysql_fetch_array($result)) {
 281                      
 282                       echo "<tr onmouseover=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
 283                      echo "<td width=\"483\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n";
 284                      
 285                      $child_count = get_filecat_childcount ($row["fcat_id"], $db);
 286                      
 287                      echo "<td>";
 288                      echo ($child_count) ? "<a href=\"phpwcms.php?do=admin&p=7&open=".$row["fcat_id"].":".(empty($_SESSION["fcatlist"][$row["fcat_id"]])?1:0)."\">" : "";
 289                      echo "<img src=\"img/symbole/plus_".(($child_count) ? (empty($_SESSION["fcatlist"][$row["fcat_id"]]) ? "open" : "close") : "empty");
 290                      echo ".gif\" width=\"15\" height=\"15\" border=\"0\">".(($child_count) ? "</a>" : "")."</td>\n";
 291                          
 292                        echo "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n";
 293                      echo "<td><strong".(($row["fcat_needed"])?" style=\"color:#FF3300\"":"").">".html_specialchars($row["fcat_name"])."</strong> [".$row["fcat_sort"]."]</td>\n";
 294                        echo "</tr>\n</table></td>".LF;
 295                      
 296                      echo "<td width=\"55\">";
 297                      
 298                      echo "<a href=\"phpwcms.php?do=admin&p=7&fkeyid=0&cid=".$row["fcat_id"]."\" title=\"".$BL['be_admin_fcat_addkey']."\">";
 299                      echo "<img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
 300                      
 301                      echo "<a href=\"phpwcms.php?do=admin&p=7&fcatid=".$row["fcat_id"]."\" title =\"".$BL['be_admin_fcat_editcat']."\">";
 302                      echo "<img src=\"img/button/edit_22x11.gif\" width=\"22\" height=\"11\" border=\"0\"></a>";
 303                      
 304                      echo "<a href=\"include/inc_act/act_filecat.php?do=1,".$row["fcat_id"].",".(($row["fcat_aktiv"])?0:1)."\" title =\"".$BL['be_fprivfunc_cactivefile']."\">";
 305                      echo "<img src=\"img/button/active_11x11_".$row["fcat_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
 306                      
 307                      echo "<a href=\"include/inc_act/act_filecat.php?do=8,".$row["fcat_id"]."\" title =\"".$BL['be_admin_fcat_delcat']."\" ";
 308                      echo "onclick=\"return confirm('".$BL['be_admin_fcat_delcatmsg']."\\n[".html_specialchars($row["fcat_name"])."] ');\">";
 309                      echo "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
 310                      
 311                      echo "</td>\n</tr>\n";
 312                      
 313                      
 314                      if(isset($_SESSION["fcatlist"]) && isset($_SESSION["fcatlist"][$row["fcat_id"]]) && $_SESSION["fcatlist"][$row["fcat_id"]]) { //List key names for this categroy
 315                          $ksql = "SELECT * FROM ".DB_PREPEND."phpwcms_filekey WHERE fkey_cid=".$row["fcat_id"].
 316                                  " AND fkey_deleted=0 ORDER BY fkey_sort, fkey_name";
 317                          if($kresult = mysql_query($ksql, $db)) {
 318                              while($krow = mysql_fetch_array($kresult)) {
 319                                  echo "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
 320                                  echo "<td><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n";
 321                                  echo "<td><img src=\"img/leer.gif\" width=\"16\" height=\"1\">";
 322                                  echo "<img src=\"img/symbole/key_1.gif\" width=\"11\" height=\"15\"></td>\n";
 323                                  echo "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n";
 324                                  echo "<td>".html_specialchars($krow["fkey_name"])." [".$krow["fkey_sort"]."]</td>\n";
 325                                  echo "</tr>\n</table></td>\n";
 326                                  echo "<td><img src=\"img/leer.gif\" width=\"11\" height=\"11\">";
 327                              
 328                                  echo "<a href=\"phpwcms.php?do=admin&p=7&fkeyid=".$krow["fkey_id"]."&cid=".$row["fcat_id"]."\" title =\"".$BL['be_admin_fcat_editkey']."\">";
 329                                  echo "<img src=\"img/button/edit_22x11.gif\" width=\"22\" height=\"11\" border=\"0\"></a>";
 330                              
 331                                  echo "<a href=\"include/inc_act/act_filecat.php?do=2,".$krow["fkey_id"].",".(($krow["fkey_aktiv"])?0:1)."\" title =\"".$BL['be_fprivfunc_cactivefile']."\">";
 332                                  echo "<img src=\"img/button/active_11x11_".$krow["fkey_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
 333                                  
 334                                  echo "<a href=\"include/inc_act/act_filecat.php?do=9,".$krow["fkey_id"].",".($krow["fkey_cid"])."\" title =\"".$BL['be_admin_fcat_delkey']."\" ";
 335                                  echo "onclick=\"return confirm('".$BL['be_admin_fcat_delmsg']."\\n[".html_specialchars($krow["fkey_name"])."] ');\">";
 336                                  echo "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
 337                                  echo "</td>\n</tr>\n";
 338                              }
 339                              mysql_free_result($kresult);
 340                          }
 341                      } //Ende List Keynames
 342                    }
 343                    mysql_free_result($result);
 344              }
 345          ?>
 346            <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 347      </tr>
 348            <tr><td colspan="2"><img src="img/lines/l538_70.gif" alt="" width="538" height="1" /></td>
 349      </tr>
 350            <tr>
 351              <td><img src="img/leer.gif" alt="" width="483" height="1" /></td>
 352              <td><img src="img/leer.gif" alt="" width="55" height="5" /></td>
 353      </tr>
 354            <tr>
 355              <td colspan="2"><form action="phpwcms.php?do=admin&amp;p=7&amp;fcatid=0" method="post">
 356                  <input type="submit" value="<?php echo $BL['be_admin_fcat_addcat'] ?>" class="button10" title="<?php echo $BL['be_admin_fcat_addcat'] ?>" />
 357              </form></td>
 358            </tr>
 359  </table>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7