[ Index ]

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

title

Body

[close]

/include/inc_lib/ -> admin.functions.inc.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  //26-04-2004 Oliver Georgi -> $level seems to be unused
  24  //19-11-2004 Fernando Batista -> Copy article, Copy strutures :http://fernandobatista.web.pt
  25  //31-03-2005 Fernando Batista -> copy&cut Article Content :http://fernandobatista.web.pt
  26  
  27  function struct_list ($id, $dbcon, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode=1, $forbid_cut=0, $forbid_copy=0, $counter=0) {
  28  
  29      $counter++;
  30      $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".intval($id)." ORDER BY acat_sort";
  31      if($result = mysql_query($sql, $dbcon) or die("error while browsing structure".$sql)) {
  32          $count_row = 0;
  33          while($row = mysql_fetch_assoc($result)) {
  34              $struct[$count_row] = $row;
  35              $count_row++;
  36          }
  37          mysql_free_result($result);
  38  
  39          if(isset($struct[0])) {
  40              foreach($struct as $key => $value) {
  41                  struct_levellist($struct, $key, $counter, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $forbid_cut, $forbid_copy, $listmode, $cut_article, $count_row, $dbcon);
  42              }
  43          }
  44      }
  45  }
  46  
  47  function struct_levellist($struct, $key, $counter, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $forbid_cut, $forbid_copy, $listmode, $cut_article, $count_row, $dbcon) {
  48  
  49      global $BL;
  50  
  51      $page_val        = ($listmode) ? "do=admin&amp;p=6" : "do=articles";
  52      $child_count    = get_root_childcount($struct[$key]["acat_id"], $dbcon);
  53      $child_sort        = (($child_count+1)*10);
  54      
  55      $forbid_cut        = ($struct[$key]["acat_struct"] == $cut_id || $forbid_cut) ? 1 : 0;
  56      $forbid_copy    = ($struct[$key]["acat_struct"] == $copy_id || $forbid_copy) ? 1 : 0;
  57      
  58      $an = html_specialchars($struct[$key]["acat_name"]);
  59      $a  = "<tr onmouseover=\"this.bgColor='#CCFF00';\" onmouseout=\"this.bgColor='#FFFFFF';\">\n";
  60      $a .= "<td width=\"428\">";
  61      $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">\n<tr>\n";
  62      $a .= '<td nowrap="nowrap"><img src="img/leer.gif" width="'.(14+(14*($counter-1)))."\" height=\"1\" alt=\"\" />"; //14
  63      $a .= ($child_count) ? "<a href=\"phpwcms.php?".$page_val."&amp;open=".rawurlencode($struct[$key]["acat_id"].":".((!empty($_SESSION["structure"][$struct[$key]["acat_id"]]))?0:1))."\">" : "";
  64      $a .= "<img src=\"img/symbole/plus_".(($child_count) ? ((!empty($_SESSION["structure"][ $struct[$key]["acat_id"] ])) ? "close" : "open") : "empty");
  65      $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\" alt=\"\" />".(($child_count) ? "</a>" : "");
  66      $a .= "<img src=\"img/symbole/page_".(!$struct[$key]["acat_hidden"]?1:7);
  67      if($struct[$key]["acat_regonly"]) {
  68          $a .= '_locked';
  69      }
  70      $a .= ".gif\" width=\"11\" height=\"15\" ";
  71  
  72      $info  = 'ID: <b>'.$struct[$key]["acat_id"].'</b><br />';
  73      $info .= 'ALIAS: '.html_specialchars($struct[$key]["acat_alias"]).'<br />';
  74      $info .= $BL['be_cnt_sortvalue'].': '.$struct[$key]["acat_sort"];
  75      
  76      $a .= 'onmouseover="Tip(\''.$info.'\');" alt=""';    
  77      
  78      $a .= "></td>\n";
  79      $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\" alt=\"\" /></td>\n";
  80      $a .= "<td class=\"dir\"><strong>".$an."</strong></td>\n</tr>\n</table></td>\n<td width=\"110\" nowrap=\"nowrap\">";
  81      
  82      $a .= listmode_edits ($listmode, $struct, $key, $an, $copy_article_content, $cut_article_content, $copy_article, $copy_id, $cut_article, $cut_id, $forbid_cut, $forbid_copy, $count_row, $child_sort);
  83      
  84      $a .= "</td>\n</tr>\n";
  85      echo $a;
  86      
  87      if(isset($_SESSION["structure"][$struct[$key]["acat_id"]]) && $_SESSION["structure"][$struct[$key]["acat_id"]]) {
  88      
  89          if(!$listmode) {
  90              struct_articlelist ($struct[$key]["acat_id"], $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $struct[$key]["acat_order"]);
  91          }
  92          
  93          struct_list ($struct[$key]["acat_id"], $dbcon, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode, $forbid_cut, $forbid_copy, $counter);
  94      
  95      }
  96  
  97  }
  98  
  99  function get_root_childcount($id, $dbcon) {
 100  //Ermittelt Anzahl bereits vorhandener aktiver Unterlevels
 101      $p1_count = $p2_count = 0;
 102      $id = intval($id);
 103      if($p_result = mysql_query("SELECT COUNT(*) FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".$id, $dbcon)) {
 104          if($p_row = mysql_fetch_row($p_result)) $p1_count = $p_row[0];
 105          mysql_free_result($p_result);
 106      }
 107      if($p_result = mysql_query("SELECT COUNT(*) FROM ".DB_PREPEND."phpwcms_article WHERE article_deleted=0 AND article_cid=".$id, $dbcon)) {
 108          if($p_row = mysql_fetch_row($p_result)) $p2_count = $p_row[0];
 109          mysql_free_result($p_result);
 110      }
 111      return $p1_count + $p2_count;
 112  }
 113  
 114  function get_article_content_count($id, $dbcon) {
 115          $p_count = 0;
 116          $id = intval($id);
 117          if($p_result = mysql_query("SELECT COUNT(*) FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_trash=0 AND acontent_aid=".$id, $dbcon)) {
 118                  if($p_row = mysql_fetch_row($p_result)) $p_count = $p_row[0];
 119                  mysql_free_result($p_result);
 120          }
 121          return $p_count;
 122  }
 123  
 124  function struct_articlelist ($struct_id, $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $article_order=0) {
 125  
 126      global $BL;
 127  
 128      $article            = array();    // empty article array
 129      $sort_array            = array();    // empty array to store all sort values for the category
 130      $article_order        = intval($article_order);
 131      $max_article_count    = 0;
 132      $show_sort            = (!$article_order || $article_order == 1) ? 1 : 0;
 133      $ao                 = get_order_sort($article_order);
 134      $count_article        = 0;
 135      $sbutton_string        = array();
 136      
 137      $sql  = "SELECT *, ";
 138      $sql .= "DATE_FORMAT(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date "; //, article_deleted
 139      $sql .= "FROM ".DB_PREPEND."phpwcms_article ";
 140      $sql .= "WHERE article_cid='".$struct_id."' AND article_deleted=0 ORDER BY ".$ao[2];
 141      
 142      if($result = mysql_query($sql, $GLOBALS['db']) or die ("error while browsing related articles")) {
 143      
 144          // 1st get max count to know the last index ($max_article_count - 1)
 145          $max_article_count = mysql_num_rows($result);
 146      
 147          // take all entryies and build new array with it
 148          while($row = mysql_fetch_assoc($result)) {
 149  
 150              $article[$count_article]    = $row;
 151              if($row['article_sort'] > 0) {
 152                  $sort_array[$count_article]    = $row['article_sort'];
 153              }
 154  
 155              // count up for article array index
 156              $count_article++;
 157  
 158          }
 159          mysql_free_result($result);
 160      }
 161      
 162      // now check if all sort values are unique
 163      // if not do a re-sort for all articles
 164      
 165      if($max_article_count > count(array_unique($sort_array)) ) {
 166          $article = getArticleReSorted($struct_id, $article_order);
 167      }
 168      
 169      // reset article counter
 170      $count_article = 0;
 171      
 172      /*
 173       * now we know ALL articles and can run array index +/-
 174       * to set correct sorting UP and DOWN based on article
 175       * listing -> so the correct sort value is used
 176       */
 177      foreach($article as $akey => $avalue) {
 178      
 179          // set up correct article sorting
 180          
 181          // can be sorted UP
 182          if($count_article == 0) {
 183              // this is the first in list -> so no sorting up possible
 184              // the sort up icon will be invisible
 185              $sort_up = false;
 186          } else {
 187              // this article has a pre entry
 188              // so use these by setting (current index - 1)
 189              $article[$akey]['sort_up'] = $article[$akey-1]['article_sort'];
 190              $sort_up = $show_sort ? true : false;
 191          }
 192          
 193          // count up for article array index
 194          $count_article++;
 195          
 196          // can be sorted DOWN
 197          if($count_article == $max_article_count) {
 198              // this is the last in list -> so no sorting down possible
 199              // the sort up icon will be invisible
 200              $sort_down = false;
 201          } else {
 202              // this article has a follower
 203              // so use these by setting (current index + 1)
 204              $article[$akey]['sort_down'] = $article[$akey+1]['article_sort'];
 205              $sort_down = $show_sort ? true : false;
 206          }
 207          
 208          // now do some checks to be sure that all sort values
 209          // are different to have it sorting in the correct way
 210          
 211          // sort up
 212          if($sort_up) {
 213              
 214              $sort_up  = '<a href="include/inc_act/act_structure.php?do=4%7C';
 215              $sort_up .= $article[$akey]["article_id"] . '%7C' . $article[$akey]['sort_up'] . '%7C';
 216              $sort_up .= $article[$akey-1]["article_id"] . '%7C' . $article[$akey]['article_sort'];
 217              $sort_up .= '" title="'.$BL['be_func_struct_sort_up'].'">';
 218              $sort_up .= '<img src="img/button/sort_1_1.gif" width="11" height="11" border="0" alt="" /></a>';
 219          
 220          } else {
 221          
 222              $sort_up  = '<img src="img/button/sort_1_0.gif" width="11" height="11" border="0" alt="" />';
 223          
 224          }
 225          // sort down
 226          if($sort_down) {
 227              
 228              $sort_down  = '<a href="include/inc_act/act_structure.php?do=4%7C';
 229              $sort_down .= $article[$akey]["article_id"] . '%7C' . $article[$akey]['sort_down'] . '%7C';
 230              $sort_down .= $article[$akey+1]["article_id"] . '%7C' . $article[$akey]['article_sort'];
 231              $sort_down .= '" title="'.$BL['be_func_struct_sort_down'].'">';
 232              $sort_down .= '<img src="img/button/sort_2_1.gif" width="11" height="11" border="0" alt="" /></a>';
 233          
 234          } else {
 235          
 236              $sort_down  = '<img src="img/button/sort_2_0.gif" width="11" height="11" border="0" alt="" />';
 237          
 238          }
 239          
 240          $at = html_specialchars($article[$akey]["article_title"]); 
 241                                  
 242          if($cut_article == $article[$akey]["article_id"] ) {
 243              $a = "<tr bgColor='#B4E101'>\n";
 244          } elseif($copy_article == $article[$akey]["article_id"]){  
 245              $a = "<tr bgColor='#B4E101'>\n";  
 246          } else {
 247              $a = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
 248          }    
 249  
 250          $a .= "<td width=\"428\">";
 251          $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">\n<tr>\n";
 252  
 253          $acontent_count =  get_article_content_count($article[$akey]["article_id"], $GLOBALS['db']);
 254  
 255          if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
 256              $a .= "<td nowrap=\"nowrap\"><img src=\"img/leer.gif\" width=\"".(14+14+(14*($counter-1)))."\" height=\"1\" alt=\"\" />";
 257              $a .= ($acontent_count) ? "<a href=\"phpwcms.php?do=articles&amp;opena=".rawurlencode($article[$akey]["article_id"].":".((!empty($_SESSION["structure"]["article"][$article[$akey]["article_id"]]))?0:1))."\">" : "";
 258              $a .= "<img src=\"img/symbole/plus_".(($acontent_count) ? ((!empty($_SESSION["structure"]["article"][ $article[$akey]["article_id"] ])) ? "close" : "open") : "empty");
 259              $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\" alt=\"\" />".(($acontent_count) ? "</a>" : "");
 260          }else{
 261              $a .= "<td nowrap=\"nowrap\"><img src=\"img/leer.gif\" width=\"".(14+29+(14*($counter-1)))."\" height=\"1\" alt=\"\" />";
 262          }
 263  
 264          $a .= "<img src=\"img/symbole/text_1.gif\" width=\"11\" height=\"15\" ";
 265          
 266          $info  = '<table cellspacing=0 cellpadding=1 border=0>';
 267          $info .= '<tr><td>'.$BL['be_func_struct_articleID'].':</td><td><b>'.$article[$akey]["article_id"].'</b></td></tr>';
 268          if(!empty($article[$akey]["article_alias"])) {
 269              $info .= '<tr><td>ALIAS:</td><td><b>'.$article[$akey]["article_alias"].'</b></td></tr>';
 270          }
 271          if(!empty($article[$akey]["article_begin"])) {
 272              $info .= '<tr><td>'.$BL['be_article_cnt_start'].':</td><td><b>'.date($BL['be_longdatetime'], strtotime($article[$akey]["article_begin"])).'</b></td></tr>';
 273          }
 274          if(!empty($article[$akey]["article_end"])) {
 275              $info .= '<tr><td>'.$BL['be_article_cnt_end'].':</td><td><b>'.date($BL['be_longdatetime'], strtotime($article[$akey]["article_end"])).'</b></td></tr>';
 276          }
 277          $info .= '<tr><td>'.$BL['be_cnt_sortvalue'].':</td><td>'.$article[$akey]["article_sort"].'</td></tr>';
 278          if(isset($article[$akey]["article_end"])) {
 279              $info .= '<tr><td>'.$BL['be_priorize'].':</td><td>'.$article[$akey]["article_priorize"].'</td></tr>';
 280          }
 281          $info .= '</table>';
 282          
 283          $a .= 'onmouseover="Tip(\''. $info .'\');" alt=""';
 284          //$a .= getAltTitle($info);
 285          $a .= " /></td>\n";
 286          $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\" alt=\"\" /></td>\n";
 287          $a .= "<td class=\"dir\"><a href=\"index.php?aid=".$article[$akey]["article_id"].'"';
 288          $a .= "target=\"_blank\" title=\"".$BL['be_func_struct_preview'].": ".$at."\">";
 289          $a .= $at."</a></td>\n</tr>\n</table></td>\n<td width=\"110\" nowrap=\"nowrap\">";
 290  
 291          if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
 292              $a .= "<a href=\"phpwcms.php?do=articles&amp;p=2&amp;s=1&amp;id=".$article[$akey]["article_id"];
 293              $a .= "\" title=\"".$BL['be_func_struct_edit']." \n[".$at."]\">";
 294              $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"></a>";
 295          } else {
 296              $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 297          }
 298  
 299          if($cut_article != $article[$akey]["article_id"] && !$cut_article_content) {
 300              $a .= "<a href=\"phpwcms.php?do=articles&amp;acut=".$article[$akey]["article_id"];
 301              $a .= "\" title=\"".$BL['be_func_struct_cut']." \n[".$at."]\">";
 302              $a .= "<img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 303         } elseif($cut_article_content) {
 304              $a .= '<a href="include/inc_act/act_structure.php?do='.rawurlencode('7|'.$cut_article_content.'|'.$article[$akey]["article_id"].'|-10');
 305              $a .= '" title="'.$BL['be_func_content_paste0'];
 306              $a .= " [".$at."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";                    
 307          } else {
 308              $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$BL['be_func_struct_nocut'].'">';
 309              $a .= "<img src=\"img/button/cut_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 310          }
 311  
 312          if($copy_article != $article[$akey]["article_id"] && !$copy_article_content) {
 313              $a .= "<a href=\"phpwcms.php?do=articles&amp;acopy=".$article[$akey]["article_id"];
 314              $a .= "\" title=\"".$BL['be_func_struct_copy']." \n[".$at."]\">";
 315              $a .= "<img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 316          } elseif($copy_article_content) {
 317              $a .= '<a href="include/inc_act/act_structure.php?do='.rawurlencode('8|'.$copy_article_content.'|'.$article[$akey]["article_id"].'|-10');
 318              $a .= "\" title=\"".$BL['be_func_content_paste0'];
 319              $a .= " [".$at."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";                    
 320          } else {
 321              $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$BL['be_func_struct_nocopy'].'">';
 322              $a .= "<img src=\"img/button/copy_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 323          }
 324  
 325          //Sortierungslink
 326          
 327          //davor sortieren
 328          $a .= $sort_up;
 329          //dahinter sortieren
 330          $a .= $sort_down;
 331  
 332          //active und visible Status wechseln
 333          $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=3,".$article[$akey]["article_id"].",,".(($article[$akey]["article_aktiv"])?0:1);
 334          $a .= '" title="'.$BL['be_func_struct_svisible'].'">';
 335          $a .= "<img src=\"img/button/visible_11x11_".$article[$akey]["article_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 336          $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=4,".$article[$akey]["article_id"].",,".(($article[$akey]["article_public"])?0:1);
 337          $a .= '" title="'.$BL['be_func_struct_spublic'].'">';
 338          $a .= "<img src=\"img/button/public_11x11_".$article[$akey]["article_public"].".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 339  
 340          //Article Löschen
 341          if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
 342              $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=1,".$article[$akey]["article_id"];
 343              $a .= "\" title=\"".$BL['be_func_struct_del_article']." \n[".$at."]\" ";
 344              $a .= "onclick=\"return confirm('".$BL['be_func_struct_del_jsmsg']." \\n[".js_singlequote($at)."] ');\">";
 345              $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 346          } else {
 347              $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 348          }
 349          $a .= "</td>\n</tr>\n";
 350          echo $a;
 351  
 352          $sql  = "SELECT acontent_id, acontent_sorting, acontent_trash, acontent_block FROM ".DB_PREPEND."phpwcms_articlecontent ";
 353          $sql .= "WHERE acontent_aid=".$article[$akey]["article_id"]." ORDER BY acontent_block, acontent_sorting, acontent_id";
 354          if($result = mysql_query($sql, $GLOBALS['db']) or die("error while listing contents for this article")) {
 355              $sc = 0; $scc = 0; //Sort-Zwischenzähler
 356              while($row = mysql_fetch_row($result)) {
 357                  $scc++;
 358                  if($row[2] == 0) {
 359                      $sc++;
 360                      $sbutton[$sc]["id"]    = $row[0];
 361                      $sbutton[$sc]["sort"]  = $row[1];
 362                      $sbutton[$sc]["block"] = $row[3];
 363                  }
 364              }
 365          }
 366          if($sc) {
 367              //Jetzt aufbauen der Sortieranweisung
 368              foreach($sbutton as $key => $value) {
 369                  if($key == 1) {
 370                      // if 1st content part in list
 371                      $sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\" alt=\"\" />";
 372                      
 373                  } elseif(isset($sbutton[$key-1]["block"]) && $sbutton[$key-1]["block"] != $sbutton[$key]["block"]) {
 374                      // if this content part is selected for different block than previous
 375                      $sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\" alt=\"\" />";
 376                      
 377                  } else {
 378                      $sbutton[$key]["top"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
 379                      rawurlencode($sbutton[$key]["id"].":".$sbutton[$key-1]["sort"]."|".
 380                      $sbutton[$key-1]["id"].":".$sbutton[$key]["sort"]).
 381                      "\" title=\"".$BL['be_article_cnt_up']."\"><img src=\"img/button/sort_1_1.gif\" border=\"0\" alt=\"\" /></a>";
 382      
 383                  }
 384                  if($key == $sc) {
 385                      // if this is the last content part in list
 386                      $sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\" alt=\"\" />";
 387                  
 388                  } elseif(isset($sbutton[$key+1]["block"]) && $sbutton[$key+1]["block"] != $sbutton[$key]["block"]) {
 389                      // if this is the last content part in current block and next is different
 390                      $sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\" alt=\"\" />";
 391                          
 392                  } else {
 393                      $sbutton[$key]["bottom"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
 394                      rawurlencode($sbutton[$key]["id"].":".$sbutton[$key+1]["sort"]."|".
 395                      $sbutton[$key+1]["id"].":".$sbutton[$key]["sort"]).
 396                      "\" title=\"".$BL['be_article_cnt_down']."\"><img src=\"img/button/sort_2_1.gif\" border=\"0\" alt=\"\" /></a>";
 397                  }
 398                  $sbutton_string[$sbutton[$key]["id"]] = $sbutton[$key]["top"].
 399                  $sbutton[$key]["bottom"];
 400              }
 401              unset($sbutton);
 402          }
 403  
 404          if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
 405              if(isset($_SESSION["structure"]["article"][$article[$akey]["article_id"]]) && $_SESSION["structure"]["article"][$article[$akey]["article_id"]]) {
 406                  struct_articlecontentlist ($article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $GLOBALS['db']);
 407              }
 408          }
 409  
 410      }
 411  }
 412  
 413  
 414  function struct_articlecontentlist(& $article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $db){
 415  
 416      $a    = '';
 417      
 418      $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent ";
 419      $sql .= "WHERE acontent_aid=".$article[$akey]["article_id"]." AND acontent_trash=0 ";
 420      $sql .= "ORDER BY acontent_block, acontent_sorting, acontent_id";
 421      
 422      if($result = mysql_query($sql, $db) or die("error while listing contents for this article")) {
 423      
 424          while($article_content = mysql_fetch_assoc($result)) {
 425          
 426              // if type of content part not enabled available 
 427              if(!isset($GLOBALS['wcs_content_type'][ $article_content["acontent_type"] ]) || ($article_content['acontent_type'] == 30 && !isset($GLOBALS['phpwcms']['modules'][$article_content["acontent_module"]]))) {
 428                  continue;
 429              }
 430              
 431              $info  = "Tip('";
 432              $info .= 'ID: '.$article_content["acontent_id"];
 433              if($article_content['acontent_title']) {
 434                  $info .= '<br /><nobr>' . $GLOBALS['BL']['be_article_cnt_ctitle'].': '.html_specialchars(js_singlequote($article_content['acontent_title'])).'</nobr>';
 435              }
 436              if($article_content['acontent_title']) {
 437                  $info .= '<br /><nobr>' . $GLOBALS['BL']['be_article_asubtitle'].': '.html_specialchars(js_singlequote($article_content['acontent_subtitle'])).'</nobr>';
 438              }
 439              if($article_content["acontent_comment"]) {
 440                  $info .= '<br />' . nl2br( html_specialchars(js_singlequote($article_content["acontent_comment"])) );
 441              }
 442              $info .= "');";
 443                      
 444              if($cut_article_content == $article_content["acontent_id"] ) {
 445                  $a .= "<tr bgcolor=\"#FFA801\">\n";
 446              } elseif($copy_article_content == $article_content["acontent_id"]) {       
 447                  $a .= "<tr bgcolor=\"#FFA801\">\n";
 448              } else {
 449                  $a .= "<tr onmouseover=\"this.bgColor='#FFDE01';\" onmouseout=\"this.bgColor='#FFFFFF';\">\n";                        
 450              }
 451              $gk = 14+14+29+(14*($counter-1));
 452              $a .= "<td width=\"".$gk."\"><img src=\"img/leer.gif\" width=\"".$gk."\" height=\"1\" alt=\"\" /></td>";    //$counter-1           
 453              $a .= "<td width=\"14\"><img src=\"img/symbole/content_9x11.gif\" width=\"9\" height=\"11\" border=\"0\" alt=\"\" onmouseover=\"".$info."\" /></td>";
 454              $a .= "<td class=\"v09\" style=\"color:#727889;padding:1px 0 1px 0;\" width=\"".(538-$gk-14-15-110-98)."\" onmouseover=\"".$info."\">";
 455              
 456              $ab  = '[ID:'.$article_content["acontent_id"].'] ';
 457              $ab .= $GLOBALS["wcs_content_type"][$article_content["acontent_type"]];    
 458              if($article_content["acontent_type"] == 30) {
 459                  $ab .= ': '.$GLOBALS['BL']['modules'][$article_content["acontent_module"]]['listing_title'];
 460              }                   
 461              
 462              $a .= $ab;
 463              
 464              $a .= "</td>";                                                   
 465              $a .= "<td width=\"15\"><img src=\"img/symbole/block.gif\" width=\"9\" height=\"11\" border=\"0\" alt=\"\" style=\"margin:0 3px 0 3px;\" /></td>";  
 466              $a .= "<td class=\"v09\" style=\"color:#727889;\" width=\"100\">".html_specialchars(' {'.$article_content['acontent_block'].'} ')."</td>";                     
 467              $a .= '<td nowrap="nowrap" style="padding:1px 0 1px 0;" onmouseover="'.$info.'">'; //width="110"
 468              
 469              $at  = ' '.$ab.' ';                       
 470              
 471              if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
 472                  $a .= "<a href=\"phpwcms.php?do=articles&amp;p=2&amp;s=1&amp;aktion=2&amp;id=".$article[$akey]["article_id"]."&amp;acid=".$article_content["acontent_id"];
 473                  $a .= "\" title=\"".$GLOBALS["BL"]['be_func_content_edit']." [".$at."]\">";
 474                  $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 475              } else {
 476                  $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 477              }
 478                                                                      
 479              if($cut_article_content) {
 480                  if($cut_article_content != $article_content["acontent_id"]) {
 481                      $a .= '<a href="include/inc_act/act_structure.php?do='.rawurlencode('7|'.$cut_article_content."|".$article_content["acontent_aid"]."|".$article_content["acontent_sorting"]);
 482                      $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste'];
 483                      $a .= " [".$at."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 484                  } else {
 485                      $a .= "<a href=\"phpwcms.php?do=articles\" title=\"";
 486                      $a .= $GLOBALS['BL']['be_func_content_paste_cancel']." [".$at."]";
 487                      $a .= "\"><img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 488                  }
 489              } else {
 490                  if($article_content["acontent_id"]) {
 491                          $a .= "<a href=\"phpwcms.php?do=articles&amp;accut=".$article_content["acontent_id"]."\" title=\"";
 492                          $a .= $GLOBALS['BL']['be_func_content_cut']." [".$at;
 493                          $a .= "]\"><img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 494                  } else {
 495                          $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS['BL']['be_func_content_no_cut']."\">";
 496                          $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 497                  }
 498              }
 499              if($copy_article_content) {
 500                  if($copy_article_content != $article_content["acontent_id"]) {
 501                      $a .= '<a href="include/inc_act/act_structure.php?do='.rawurlencode('8|'.$copy_article_content.'|'.$article_content["acontent_aid"].'|'.$article_content["acontent_sorting"]);
 502                      $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste'];
 503                      $a .= " [".$at."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 504                  } else {
 505                      $a .= "<a href=\"phpwcms.php?do=articles\" title=\"";
 506                      $a .= $GLOBALS['BL']['be_func_content_paste_cancel']." [".$at."]";
 507                      $a .= "\"><img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 508                  }
 509              } else {
 510                  if($article_content["acontent_id"]) {
 511                      $a .= "<a href=\"phpwcms.php?do=articles&amp;accopy=".$article_content["acontent_id"]."\" title=\"";
 512                      $a .= $GLOBALS['BL']['be_func_content_copy']." [".$at;
 513                      $a .= "]\"><img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 514                  } else {
 515                      $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS['BL']['be_func_content_no_copy']."\">";
 516                      $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 517                  }
 518              } 
 519              
 520              $a .= $sbutton_string[$article_content["acontent_id"]];
 521       
 522              $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=2,".$article_content["acontent_aid"].",".$article_content["acontent_id"].",".(($article_content["acontent_visible"])?0:1);
 523              $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_svisible'].'">';
 524              $a .= "<img src=\"img/button/visible_11x11_".$article_content["acontent_visible"].".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 525              
 526              // added space between visible icon and delete icon
 527              $a .= '<img src="img/leer.gif" width="11" height="1" border="0" alt="" />';
 528      
 529              if($article_content["acontent_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
 530                  $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=9,".$article_content["acontent_aid"].",".$article_content["acontent_id"];
 531                  $a .= "\" title=\"".$GLOBALS['BL']['be_article_cnt_delpart']." [".$at."]\" ";
 532                  $a .= "onclick=\"return confirm('".$GLOBALS['BL']['be_article_cnt_delpart']." \\n[".js_singlequote($at)."] ');\">";
 533                  $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 534              } else {
 535                  $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 536              }
 537                                                           
 538              $a .= "</td>\n</tr>";
 539          }
 540          
 541          if($a) {
 542              $aa  = "<tr>\n<td colspan=\"2\">";
 543              $aa .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\" width=\"538\">\n";
 544              $aa .= $a;    
 545              $aa .= "</table></td></tr>";    
 546              echo $aa;
 547          }                                                       
 548      }
 549  }
 550  
 551  function listmode_edits ($listmode, $struct, $key, $an, $copy_article_content, $cut_article_content, $copy_article, $copy_id, $cut_article, $cut_id, $forbid_cut, $forbid_copy, $count_row, $child_sort) {
 552  
 553      // Decide which action available
 554      $a = ''; 
 555      switch($listmode) {
 556      
 557          case 0:    $a .= "<a href=\"phpwcms.php?do=articles&amp;p=1&amp;struct=".$struct[$key]["acat_id"]."\" ";
 558                  $a .= "title=\"".$GLOBALS['BL']['be_func_struct_new_article']." \n[".$an."]\">";
 559                  $a .= "<img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 560                  if($cut_article) { // Cut
 561                      $a .= '<a href="include/inc_act/act_structure.php?do=3'.'%7C'.$cut_article.'%7C';
 562                      $a .= $struct[$key]["acat_id"]."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_article']." \n[".$an;
 563                      $a .= "]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 564                  } else {
 565                      $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 566                  }
 567                  if($copy_article) {
 568                      $a .= '<a href="include/inc_act/act_structure.php?do=5'.'%7C'.$copy_article.'%7C';
 569                      $a .= $struct[$key]["acat_id"]."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_article']." \n[".$an;
 570                      $a .= "]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 571                  } else {
 572                      $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 573                  }
 574          
 575                  $a .= "<img src=\"img/button/sort_1_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 576                  $a .= "<img src=\"img/button/sort_2_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 577                  $a .= "<img src=\"img/button/visible_11x11a_".$struct[$key]["acat_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 578                  $a .= "<img src=\"img/button/public_11x11a_".$struct[$key]["acat_public"].".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 579                  
 580                  break;
 581  
 582          case 1:    $a .= "<a href=\"phpwcms.php?do=admin&amp;p=6&amp;struct=".$struct[$key]["acat_id"]."&amp;sort=".$child_sort."\" title=\"";
 583                  $a .= $GLOBALS['BL']['be_func_struct_insert_level']." [".$an."]\"><img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 584          
 585                  if($cut_id) {
 586                      if($cut_id != $struct[$key]["acat_id"] && !$forbid_cut) {
 587                          $a .= '<a href="include/inc_act/act_structure.php?do=1'.'%7C'.$cut_id.'%7C'.$struct[$key]["acat_id"].'%7C';
 588                          $a .= $child_sort."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_level'];
 589                          $a .= " [".$an."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 590                      } else {
 591                          $a .= "<a href=\"phpwcms.php?do=admin&amp;p=6\" title=\"";
 592                          $a .= ($forbid_cut) ? $GLOBALS['BL']['be_func_struct_no_paste1']."\n[".$an."]\n".
 593                          $GLOBALS['BL']['be_func_struct_no_paste2']."\n".
 594                          $GLOBALS['BL']['be_func_struct_no_paste3'] :
 595                          $GLOBALS['BL']['be_func_struct_paste_cancel']." [".$an."]";
 596                          $a .= "\"><img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 597                      }
 598                  } else {
 599                      if($struct[$key]["acat_id"]) {
 600                          $a .= "<a href=\"phpwcms.php?do=admin&amp;p=6&amp;cut=".$struct[$key]["acat_id"]."\" title=\"";
 601                          $a .= $GLOBALS['BL']['be_func_struct_cut_level']." [".$an;
 602                          $a .= "]\"><img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 603                      } else {
 604                          $a .= "<a href=\"phpwcms.php?do=admin&amp;p=6\" title=\"".$GLOBALS['BL']['be_func_struct_no_cut']."\">";
 605                          $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 606                      }
 607                  }
 608                  if($copy_id) {
 609                      if($copy_id != $struct[$key]["acat_id"] && !$forbid_copy) {
 610                          $a .= '<a href="include/inc_act/act_structure.php?do=6'.'%7C'.$copy_id.'%7C'.$struct[$key]["acat_id"].'%7C';
 611                          $a .= $child_sort."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_level'];
 612                          $a .= " [".$an."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 613                      } else {
 614                          $a .= "<a href=\"phpwcms.php?do=admin&amp;p=6\" title=\"";
 615                          $a .= ($forbid_copy) ? $GLOBALS['BL']['be_func_struct_no_paste1']."\n[".$an."]\n".
 616                          $GLOBALS['BL']['be_func_struct_no_paste2']."\n".
 617                          $GLOBALS['BL']['be_func_struct_no_paste3'] :
 618                          $GLOBALS['BL']['be_func_struct_paste_cancel']." [".$an."]";
 619                          $a .= "\"><img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 620                      }
 621                  } else {
 622                      if($struct[$key]["acat_id"]) {
 623                          $a .= "<a href=\"phpwcms.php?do=admin&amp;p=6&amp;cop=".$struct[$key]["acat_id"]."\" title=\"";
 624                          $a .= $GLOBALS['BL']['be_func_struct_copy_level']." [".$an;
 625                          $a .= "]\"><img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 626                      } else {
 627                          $a .= "<a href=\"phpwcms.php?do=admin&amp;p=6\" title=\"".$GLOBALS['BL']['be_func_struct_no_copy']."\">";
 628                          $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 629                      }
 630                  }
 631                  $a .= "<a href=\"phpwcms.php?do=admin&amp;p=6&amp;struct=";
 632                  if($struct[$key]["acat_id"]) {
 633                      $a .= $struct[$key]["acat_struct"]."&amp;cat=".$struct[$key]["acat_id"];
 634                  } else {
 635                      $a .= 'index';
 636                  }
 637                  $a .= '" title="'.$GLOBALS['BL']['be_func_struct_sedit'].' ['.$an.']">';
 638                  $a .= "<img src=\"img/button/edit_22x11.gif\" width=\"22\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 639          
 640                  //Sortierungslink
 641                  $sort_up        = (($count_row>1 && $key)?1:0);
 642                  $sort_down        = (($count_row>1 && $key+1<$count_row)?1:0);
 643          
 644                  //davor sortieren
 645                  $a .= ($sort_up)? '<a href="include/inc_act/act_structure.php?do=2'.'%7C'.$struct[$key]["acat_id"].'%7C'.($key*10).'%7C'.$struct[$key-1]["acat_id"].
 646                  '%7C'.(($key+1)*10).'" title="'.$GLOBALS['BL']['be_func_struct_sort_up'].'">':'';
 647                  $a .= "<img src=\"img/button/sort_1_".$sort_up.".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />".(($sort_up)?"</a>":"");
 648                  //dahinter sortieren
 649                  $a .= ($sort_down)? '<a href="include/inc_act/act_structure.php?do=2'.'%7C'.$struct[$key]["acat_id"].'%7C'.(($key+2)*10).'%7C'.$struct[$key+1]["acat_id"].
 650                  '%7C'.(($key+1)*10).'" title="'.$GLOBALS['BL']['be_func_struct_sort_down'].'">':'';
 651                  $a .= "<img src=\"img/button/sort_2_".$sort_down.".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />".(($sort_down)?"</a>":"");
 652                  
 653                  
 654                  $a .= "<img src=\"img/button/visible_11x11_".$struct[$key]["acat_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 655                  $a .= "<img src=\"img/button/public_11x11_".$struct[$key]["acat_public"].".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
 656                  
 657                  
 658          
 659                  if($struct[$key]["acat_id"]) {
 660                      $a .= '<a href="include/inc_act/act_structure.php?do=9'.'%7C'.$struct[$key]["acat_id"];
 661                      $a .= "\" title=\"".$GLOBALS['BL']['be_func_struct_del_struct']." [".$an."]\" ";
 662                      $a .= "onclick=\"return confirm('".$GLOBALS['BL']['be_func_struct_del_sjsmsg']." \\n\\n[".js_singlequote($an)."] ');\">";
 663                      $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
 664                  }
 665                  break;
 666  
 667          default: $a .= "&nbsp;";
 668      
 669      }
 670      return $a;
 671  }
 672  
 673  ?>


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