[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/include/admin/ -> default.php (source)

   1  <?php
   2  
   3  ////////////////////////////////////////////////////////////////////////////////
   4  //                                                                            //
   5  //   Copyright (C) 2006  Phorum Development Team                              //
   6  //   http://www.phorum.org                                                    //
   7  //                                                                            //
   8  //   This program is free software. You can redistribute it and/or modify     //
   9  //   it under the terms of either the current Phorum License (viewable at     //
  10  //   phorum.org) or the Phorum License that was distributed with this file    //
  11  //                                                                            //
  12  //   This program is distributed in the hope that it will be useful,          //
  13  //   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
  14  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
  15  //                                                                            //
  16  //   You should have received a copy of the Phorum License                    //
  17  //   along with this program.                                                 //
  18  ////////////////////////////////////////////////////////////////////////////////
  19  
  20  if(!defined("PHORUM_ADMIN")) return;
  21  
  22  $parent_id = (int)((isset($_GET["parent_id"])) ? $_GET["parent_id"] : 0);
  23  $parent_parent_id = (int)((isset($_GET["pparent"])) ? $_GET["pparent"] : 0);
  24  
  25  $forums=phorum_db_get_forums(0, $parent_id);
  26  
  27  // change the display-order
  28  if(isset($_GET['display_up']) || isset($_GET['display_down'])) {
  29  
  30      // load all the forums up for ordering
  31      foreach($forums as $forum_id=>$forum_data){
  32          $forum_order[]=$forum_id;
  33      }
  34  
  35      // find the one we are moving
  36      $key=array_search(isset($_GET['display_up'])?$_GET['display_up']:$_GET['display_down'], $forum_order);
  37  
  38      $newkey=NULL;
  39  
  40      // set the new key for it
  41      if($key>0 && isset($_GET['display_up'])){
  42          $newkey=$key-1;
  43      }
  44  
  45      if($key<count($forum_order)-1 && isset($_GET['display_down'])){
  46          $newkey=$key+1;
  47      }
  48  
  49      // if we have a newkey, make the move
  50      if(isset($newkey)){
  51          $tmp=$forum_order[$key];
  52          $forum_order[$key]=$forum_order[$newkey];
  53          $forum_order[$newkey]=$tmp;
  54  
  55  
  56          // loop through all the forums and updated the ones that changed.
  57          // We have to look at them all because the default value for
  58          // display order is 0 for all forums.  So, in an unsorted forlder
  59          // all the values are set to 0 until you move one.
  60          foreach($forum_order as $new_display_order=>$forum_id){
  61              if($forums[$forum_id]["display_order"]!=$new_display_order){
  62                  $forums[$forum_id]["display_order"]=$new_display_order;
  63  
  64                  $update_forum = array('forum_id'=>$forum_id,'display_order'=>$new_display_order);
  65                  phorum_db_update_forum($update_forum);
  66              }
  67          }
  68  
  69          // get a fresh forum list with updated order.
  70          $forums=phorum_db_get_forums(0, $parent_id);
  71      }
  72  
  73  }
  74  
  75  foreach($forums as $forum_id => $forum){
  76  
  77  
  78  
  79      if($forum["folder_flag"]){
  80          $type="Folder";
  81          $actions="<a href=\"{$PHORUM["admin_http_path"]}?module=default&parent_id=$forum_id&pparent=$parent_id\">Browse</a>&nbsp;&#149;&nbsp;<a href=\"{$PHORUM["admin_http_path"]}?module=editfolder&forum_id=$forum_id\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"{$PHORUM["admin_http_path"]}?module=deletefolder&forum_id=$forum_id\">Delete</a>";
  82          $editurl="{$PHORUM["admin_http_path"]}?module=editfolder&forum_id=$forum_id";
  83      } else {
  84          $type="Forum";
  85          $actions="<a href=\"{$PHORUM["admin_http_path"]}?module=editforum&forum_id=$forum_id\">Edit</a>&nbsp;&#149;&nbsp;<a href=\"{$PHORUM["admin_http_path"]}?module=deleteforum&forum_id=$forum_id\">Delete</a>";
  86          $editurl="{$PHORUM["admin_http_path"]}?module=editforum&forum_id=$forum_id";
  87      }
  88  
  89      $rows.="<tr><td class=\"PhorumAdminTableRow\"><a href=\"$editurl\">$forum[name]</a><br />$forum[description]</td><td class=\"PhorumAdminTableRow\">$type</td><td class=\"PhorumAdminTableRow\"><a href=\"{$PHORUM["admin_http_path"]}?module=default&display_up=$forum_id&parent_id=$parent_id\">Up</a>&nbsp;&#149;&nbsp;<a href=\"{$PHORUM["admin_http_path"]}?module=default&display_down=$forum_id&parent_id=$parent_id\">Down</a></td><td class=\"PhorumAdminTableRow\">$actions</td></tr>\n";
  90  }
  91  
  92  if(empty($rows)){
  93      $rows="<tr><td colspan=\"4\" class=\"PhorumAdminTableRow\">There are no forums or folders in this folder.</td></tr>\n";
  94  }
  95  
  96  if($parent_id>0){
  97      $folder_data=phorum_get_folder_info();
  98  
  99      $path=$folder_data[$parent_id];
 100  } else {
 101      $path="Choose a forum or folder.";
 102  }
 103  
 104  
 105  
 106  ?>
 107  
 108  <div class="PhorumAdminTitle"><?php echo "$path &nbsp;&nbsp; <a href=\"{$PHORUM["admin_http_path"]}?module=default&parent_id={$parent_parent_id}\"><span class=\"PhorumAdminTitle\">Go Up</span></a>";?></div>
 109  <table border="0" cellspacing="2" cellpadding="3" width="100%">
 110  <tr>
 111      <td class="PhorumAdminTableHead">Name</td>
 112      <td class="PhorumAdminTableHead">Type</td>
 113      <td class="PhorumAdminTableHead">Move</td>
 114      <td class="PhorumAdminTableHead">Actions</td>
 115  </tr>
 116  <?php echo $rows; ?>
 117  </table>


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