CMS Made Simple PHP Cross Reference Content Management Systems

Source: /admin/listcontent.php - 1299 lines - 41076 bytes - Summary - Text - Print

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004 by Ted Kulp (wishy@users.sf.net)
   4  #This project's homepage is: http://www.cmsmadesimple.org
   5  #
   6  #This program is free software; you can redistribute it and/or modify
   7  #it under the terms of the GNU General Public License as published by
   8  #the Free Software Foundation; either version 2 of the License, or
   9  #(at your option) any later version.
  10  #
  11  #This program is distributed in the hope that it will be useful,
  12  #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  #GNU General Public License for more details.
  15  #You should have received a copy of the GNU General Public License
  16  #along with this program; if not, write to the Free Software
  17  #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  #
  19  #$Id: listcontent.php 8955 2013-09-16 17:41:42Z calguy1000 $
  20  
  21  $CMS_ADMIN_PAGE=1;
  22  require_once ("../include.php");
  23  require_once(cms_join_path($dirname,'lib','html_entity_decode_utf8.php'));
  24  
  25  check_login();
  26  $userid = get_userid();
  27  $urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY];
  28  $thisurl=basename(__FILE__).$urlext;
  29  
  30  include_once ("../lib/classes/class.admintheme.inc.php");
  31  
  32  define('XAJAX_DEFAULT_CHAR_ENCODING', $config['admin_encoding']);
  33  
  34  require_once(dirname(dirname(__FILE__)) . '/lib/xajax/xajax_core/xajax.inc.php');
  35  $xajax = new xajax();
  36  //$xajax->configure('requestURI',$config['admin_url'].'/listcontent.php?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY]);
  37  $xajax->register(XAJAX_FUNCTION,'content_list_ajax');
  38  $xajax->register(XAJAX_FUNCTION,'content_setactive');
  39  $xajax->register(XAJAX_FUNCTION,'content_setinactive');
  40  $xajax->register(XAJAX_FUNCTION,'content_setdefault');
  41  $xajax->register(XAJAX_FUNCTION,'content_expandall');
  42  $xajax->register(XAJAX_FUNCTION,'content_collapseall');
  43  $xajax->register(XAJAX_FUNCTION,'content_toggleexpand');
  44  $xajax->register(XAJAX_FUNCTION,'content_move');
  45  $xajax->register(XAJAX_FUNCTION,'content_delete');
  46  // $xajax->register(XAJAX_FUNCTION,'reorder_display_list');
  47  // $xajax->register(XAJAX_FUNCTION,'reorder_process');
  48  $xajax->processRequest();
  49  $headtext = $xajax->getJavascript('../lib/xajax')."\n";
  50  include_once ("header.php");
  51  
  52  function prettyurls_ok()
  53  {
  54    static $_prettyurls_ok = -1;
  55    if( -1 < $_prettyurls_ok ) return $_prettyurls_ok;
  56  
  57    $config = cmsms()->GetConfig();
  58    if( isset($config['url_rewriting']) && $config['url_rewriting'] != 'none' )
  59      $_prettyurls_ok = 1;
  60    else
  61      $_prettyurls_ok = 0;
  62    return $_prettyurls_ok;
  63  }
  64  
  65  function content_list_ajax()
  66  {
  67      $objResponse = new xajaxResponse();
  68      $objResponse->clear("contentlist", "innerHTML");
  69      $objResponse->assign("contentlist", "innerHTML", display_content_list());
  70      return $objResponse;
  71  }
  72  
  73  function check_modify_all($userid)
  74  {
  75    return check_permission($userid, 'Modify Any Page') || check_permission($userid,'Manage All Content');
  76  }
  77  
  78  function setdefault($contentid)
  79  {
  80    $gCms = cmsms();
  81      $userid = get_userid();
  82      
  83      $result = false;
  84  
  85      if (check_permission($userid,'Manage All Content'))
  86      {
  87          $hierManager = $gCms->GetHierarchyManager();
  88          $node = $hierManager->getNodeById($contentid);
  89          if (isset($node))
  90          {
  91            $value = $node->getContent(false,false);
  92              if (isset($value))
  93              {
  94                  if (!$value->Active())
  95                  {
  96                      #Modify the object inline
  97                      $value->SetActive(true);
  98                      $value->Save();
  99                  }
 100              }
 101          }
 102          
 103          $db = $gCms->GetDb();
 104          $query = "SELECT content_id FROM ".cms_db_prefix()."content WHERE default_content=1";
 105          $old_id = $db->GetOne($query);
 106          if (isset($old_id))
 107          {
 108              $node = $hierManager->getNodeById($old_id);
 109              if (isset($node))
 110              {
 111                $value = $node->getContent(false,false);
 112                  if (isset($value))
 113                  {
 114                      $value->SetDefaultContent(false);
 115                      $value->Save();
 116                  }
 117              }
 118          }
 119          
 120          $node = $hierManager->getNodeById($contentid);
 121          if (isset($node))
 122          {
 123            $value = $node->getContent(false,false);
 124              if (isset($value))
 125              {
 126                  $value->SetDefaultContent(true);
 127                  $value->Save();
 128              }
 129          }
 130  
 131          audit($contentid,'Core','Content item set as default');
 132  
 133          $result = true;
 134          $contentops = $gCms->GetContentOperations();
 135          $contentops->ClearCache();
 136      }
 137      return $result;
 138  }
 139  
 140  function content_setdefault($contentid)
 141  {
 142      $objResponse = new xajaxResponse();
 143      
 144      setdefault($contentid);
 145  
 146      $objResponse->assign("contentlist", "innerHTML", display_content_list());
 147      $objResponse->script("$('#tr_$contentid').effect('highlight', [], 3000);");
 148      return $objResponse;
 149  }
 150  
 151  function content_setactive($contentid)
 152  {
 153      $objResponse = new xajaxResponse();
 154      
 155      setactive($contentid);
 156  
 157      $objResponse->assign("contentlist", "innerHTML", display_content_list());
 158      $objResponse->script("$('#tr_$contentid').effect('highlight', [], 3000);");
 159      return $objResponse;
 160  }
 161  
 162  function content_setinactive($contentid)
 163  {
 164      $objResponse = new xajaxResponse();
 165      
 166      setactive($contentid, false);
 167  
 168      $objResponse->assign("contentlist", "innerHTML", display_content_list());
 169      $objResponse->script("$('#tr_$contentid').effect('highlight', [], 3000);");
 170      return $objResponse;
 171  }
 172  
 173  function content_expandall()
 174  {
 175      $objResponse = new xajaxResponse();
 176      
 177      expandall();
 178  
 179      $objResponse->assign("contentlist", "innerHTML", display_content_list());
 180      return $objResponse;
 181  }
 182  
 183  function content_collapseall()
 184  {
 185      $objResponse = new xajaxResponse();
 186      
 187      collapseall();
 188  
 189      $objResponse->assign("contentlist", "innerHTML", display_content_list());
 190      return $objResponse;
 191  }
 192  
 193  function expandall()
 194  {
 195      $userid = get_userid();
 196      $hiermanager = cmsms()->GetHierarchyManager();
 197  
 198  	function _expandall_sub($node,&$list)
 199      {
 200        if( $node->has_children() ) {
 201          if( ($id = $node->get_tag('id')) > 0 ) $list[] = "$id=1";
 202          $children = $node->get_children();
 203          for( $i = 0; $i < count($children); $i++ ) {
 204            _expandall_sub($children[$i],$list);
 205          }
 206        }
 207      }
 208  
 209      $list = array();
 210      _expandall_sub($hiermanager,$list);
 211      $cs = implode('.',$list);
 212      set_preference($userid, 'collapse', $cs);
 213  }
 214  
 215  function collapseall()
 216  {
 217      $userid = get_userid();
 218      set_preference($userid, 'collapse', '');
 219  }
 220  
 221  function content_toggleexpand($contentid, $collapse)
 222  {
 223      $objResponse = new xajaxResponse();
 224      
 225      toggleexpand($contentid, $collapse=='true'?true:false);
 226  
 227      $objResponse->assign("contentlist", "innerHTML", display_content_list());
 228      $objResponse->script("$('#tr_$contentid').effect('highlight', [], 3000);");
 229      return $objResponse;
 230  }
 231  
 232  function content_delete($contentid)
 233  {
 234      $objResponse = new xajaxResponse();
 235      
 236      deletecontent($contentid);
 237  
 238      $objResponse->script("$('#tr_$contentid').effect('fade', [], 3000);");
 239      $objResponse->clear("contentlist", "innerHTML");
 240      $objResponse->assign("contentlist", "innerHTML", display_content_list());
 241      return $objResponse;
 242  }
 243  
 244  function toggleexpand($contentid, $collapse = false)
 245  {
 246      $userid = get_userid();
 247      $openedArray=array();
 248      if (get_preference($userid, 'collapse', '') != '')
 249      {
 250          $tmp  = explode('.',get_preference($userid, 'collapse'));
 251          foreach ($tmp as $thisCol)
 252          {
 253              $colind = substr($thisCol,0,strpos($thisCol,'='));
 254              $openedArray[$colind] = 1;
 255          }
 256      }
 257      if ($collapse)
 258      {
 259          $openedArray[$contentid] = 0;
 260      }
 261      else
 262      {
 263          $openedArray[$contentid] = 1;
 264      }
 265      $cs = '';
 266      foreach ($openedArray as $key=>$val)
 267      {
 268          if ($val == 1)
 269          {
 270              $cs .= $key.'=1.';
 271          }
 272      }
 273      set_preference($userid, 'collapse', $cs);
 274  }
 275  
 276  function setactive($contentid, $active = true)
 277  {
 278      $userid = get_userid();
 279      
 280      $hierManager = cmsms()->GetHierarchyManager();
 281      
 282      // to activate a page, you must be admin, owner, or additional author
 283      $permission = (    check_ownership($userid, $contentid) ||
 284              check_authorship($userid, $contentid) ||
 285              check_permission($userid, 'Manage All Content')
 286      );
 287  
 288      if($permission)
 289        {
 290          $node = $hierManager->getNodeById($contentid);
 291          $value = $node->getContent(false,false);
 292          $value->SetActive($active);
 293          $value->Save();
 294          $contentops = cmsms()->GetContentOperations();
 295          $contentops->ClearCache();
 296      }
 297  }
 298  
 299  function content_move($contentid, $parentid, $direction)
 300  {
 301    $objResponse = new xajaxResponse();
 302  
 303    $time = time();
 304    $tmp = get_site_preference('__listcontent_timelock__',0);
 305    if( (time() - $tmp) < 3 )
 306      {
 307        return $objResponse; // delay between requests
 308      }
 309    set_site_preference('__listcontent_timelock__',$time);
 310      
 311      movecontent($contentid, $parentid, $direction);
 312  
 313      $objResponse->assign("contentlist", "innerHTML", display_content_list());
 314      $objResponse->script("$('#tr_$contentid').effect('highlight', [], 3000);");
 315  
 316    // reset lock
 317    return $objResponse;
 318  
 319  }
 320  
 321  function movecontent($contentid, $parentid, $direction = 'down')
 322  {
 323    $db = cmsms()->GetDb();
 324    $userid = get_userid();
 325  
 326    if (check_permission($userid, 'Manage All Content') ||
 327        (check_permission($userid, 'Reorder Content') && check_peer_authorship($userid,$contentid)) )
 328      {
 329        $order = 1;
 330        
 331        // Grab necessary info for fixing the item_order
 332        $query = "SELECT item_order FROM ".cms_db_prefix()."content WHERE content_id = ?";
 333        $order = $db->GetOne($query, array($contentid));
 334        
 335        $time = $db->DBTimeStamp(time());
 336        if ($direction == "down")
 337      {
 338        $query = 'UPDATE '.cms_db_prefix().'content SET item_order = (item_order - 1), modified_date = '.$time.' WHERE item_order = ? AND parent_id = ?';
 339        // echo $query, $order + 1, $parent_id;
 340        $db->Execute($query, array($order + 1, $parentid));
 341        $query = 'UPDATE '.cms_db_prefix().'content SET item_order = (item_order + 1), modified_date = '.$time.' WHERE content_id = ? AND parent_id = ?';
 342        // echo $query, $content_id, $parent_id;
 343        $db->Execute($query, array($contentid, $parentid));
 344      }
 345        else if ( ($direction == "up") && ($order > 1) )
 346      {
 347        $query = 'UPDATE '.cms_db_prefix().'content SET item_order = (item_order + 1), modified_date = '.$time.' WHERE item_order = ? AND parent_id = ?';
 348        // echo $query;
 349        $db->Execute($query, array($order - 1, $parentid));
 350        $query = 'UPDATE '.cms_db_prefix().'content SET item_order = (item_order - 1), modified_date = '.$time.' WHERE content_id = ? AND parent_id = ?';
 351        // echo $query;
 352        $db->Execute($query, array($contentid, $parentid));
 353      }
 354  
 355        //sleep(15); //waiting for updating DB. Better 5 but 15 is good for testing concurrent processes and work!
 356        $contentops = cmsms()->GetContentOperations();
 357        $contentops->SetAllHierarchyPositions();
 358        $contentops->ClearCache();
 359      }
 360  }
 361  
 362  function deletecontent($contentid)
 363  {
 364      $userid = get_userid();
 365      $mypages = author_pages($userid);
 366  
 367      $access = (check_permission($userid, 'Remove Pages') &&
 368        (check_ownership($userid,$contentid) ||
 369         quick_check_authorship($contentid,$mypages)))
 370        || check_permission($userid, 'Manage All Content') 
 371        || check_permission($userid, 'Modify Any Page');
 372  
 373      $gCms = cmsms();
 374      $hierManager = $gCms->GetHierarchyManager();
 375  
 376      if ($access)
 377      {
 378          $node = $hierManager->getNodeById($contentid);
 379          if ($node)
 380          {
 381                  $contentobj = $node->getContent(true,false,true);
 382              $childcount = 0;
 383              $parentid = -1;
 384              $parent = $node->getParent();
 385              if ($parent)
 386              {
 387                $parentContent = $parent->getContent(true,false,true);
 388                if (is_object($parentContent))
 389                  {
 390                    $parentid = $parentContent->Id();
 391                    $childcount = $parent->getChildrenCount();
 392                  }
 393              }
 394  
 395              if ($contentobj)
 396              {
 397                  $title = $contentobj->Name();
 398      
 399                  #Check for children
 400                  if ($contentobj->HasChildren())
 401                  {
 402                      $_GET['error'] = 'errorchildcontent';
 403                  }
 404      
 405                  #Check for default
 406                  if ($contentobj->DefaultContent())
 407                  {
 408                      $_GET['error'] = 'errordefaultpage';
 409                  }
 410              
 411                  $title = $contentobj->Name();
 412                  $contentobj->Delete();
 413  
 414                  $contentops = $gCms->GetContentOperations();
 415                  $contentops->SetAllHierarchyPositions();
 416                  
 417                  #See if this is the last child... if so, remove
 418                  #the expand for it
 419                  if ($childcount == 1 && $parentid > -1)
 420                  {
 421                      toggleexpand($parentid, true);
 422                  }
 423                  
 424                  #Do the same with this page as well
 425                  toggleexpand($contentid, true);
 426                  
 427                  // put mention into the admin log
 428                  audit($contentid, 'Core', 'Content Item: '.$title, 'Deleted');
 429                  
 430                  $contentops->ClearCache();
 431              
 432                  $_GET['message'] = 'contentdeleted';
 433              }
 434          }
 435      }
 436  }
 437  
 438  
 439  /** check to make sure that the user has authorship of all of the peers of the
 440   * specified page
 441   *
 442   * @author calguy1000
 443   * @since 1.10
 444   * @returns boolean
 445   */
 446  function check_peer_authorship($userid,$contentid)
 447  {
 448    if( $userid <= 0 || $contentid <= 0 ) return FALSE;
 449    if( check_permission($userid,'Modify Any Page') ) return TRUE;
 450  
 451    $hm = cmsms()->GetHierarchyManager();
 452    $node = $hm->getNodeById($contentid);
 453    if( !$node ) return FALSE;
 454    
 455    $parent = $node->getParentNode();
 456    if( !$node )
 457      {
 458        // no parent means that $contentid is at the root level
 459        $parent = $hm;
 460      }
 461  
 462    $children = $parent->getChildren();
 463    if( !$children ) return FALSE;
 464  
 465    $mypages = author_pages($userid);
 466    for( $i = 0; $i < count($children); $i++ )
 467      {
 468        $the_id = $children[$i]->getId();
 469        if( !check_ownership($userid,$the_id) && !quick_check_authorship($the_id,$mypages) )
 470      {
 471        return FALSE;
 472      }
 473      }
 474    return TRUE;
 475  }
 476  
 477  function check_children(&$root, &$mypages, &$userid)
 478  {
 479      $result = false;
 480      $content = $root->getContent();
 481      if (isset($content))
 482      {
 483          $result = in_array($content->Id(), $mypages, false);
 484          if (!$result)
 485          {
 486            $children = $root->getChildren(false,true);
 487            if( is_array($children) && count($children) > 0 )
 488            {
 489              foreach ($children as $child)
 490                {
 491              $result = check_children($child, $mypages, $userid);
 492              if ($result)
 493                break;
 494                }
 495            }
 496          }
 497      }
 498      return $result;
 499  }
 500  
 501  function display_hierarchy(&$root, &$userid, $modifyall, &$users, &$menupos, &$openedArray, &$pagelist, &$image_true, &$image_set_false, &$image_set_true, &$upImg, &$downImg, &$viewImg, &$editImg, &$copyImg, &$deleteImg, &$expandImg, &$contractImg, &$mypages, &$page, $columnstodisplay, $author_allpages )
 502  {
 503    global $thisurl;
 504    global $urlext;
 505    global $currow;
 506    global $config;
 507    global $page;
 508    global $indent;
 509    
 510    if(empty($currow)) $currow = 'row1';
 511    
 512    $children = $root->getChildren(false,true);
 513    $one = $root->getContent();
 514    $thelist = '';
 515  
 516    if (!(isset($one) && $one != NULL))
 517      {
 518        audit($root->get_tag('id'),'Core','failed to get content for valid content id '.$root->get_tag('id'));
 519        return;
 520      }
 521    
 522    if (!array_key_exists($one->Owner(), $users))
 523      {
 524        $userops = cmsms()->GetUserOperations();
 525        $users[$one->Owner()] = $userops->LoadUserById($one->Owner());
 526      }
 527    
 528    $display = 'none';
 529    if (check_modify_all($userid) || check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages))
 530      {
 531        $display = 'edit';
 532      }
 533    else if (check_children($root, $mypages, $userid))
 534      {
 535        $display = 'view';
 536      }
 537    else if (check_permission($userid, 'Manage All Content'))
 538      {
 539        $display = 'structure';
 540      }
 541  
 542    $columns = array();
 543    if ($display != 'none')
 544      {
 545        $thelist .= "<tr id=\"tr_".$one->Id()."\" class=\"$currow\">\n";
 546        
 547        /* expand/collapse column */
 548        $columns['expand'] = '&nbsp;';
 549        if( $columnstodisplay['expand'] )
 550      {
 551        $txt = '';
 552        if ($root->hasChildren())
 553          {
 554            if (!in_array($one->Id(),$openedArray))
 555          {
 556            $txt .= "<a class=\"expand\" href=\"{$thisurl}&amp;content_id=".$one->Id()."&amp;col=0&amp;page=".$page."\" onclick=\"xajax_content_toggleexpand(".$one->Id().", 'false'); return false;\">";
 557            $txt .= $expandImg;
 558            $txt .= "</a>";
 559          }
 560            else
 561          {
 562            $txt .= "<a class=\"contract\" href=\"{$thisurl}&amp;content_id=".$one->Id()."&amp;col=1&amp;page=".$page."\" onclick=\"xajax_content_toggleexpand(".$one->Id().", 'true'); return false;\">";
 563            $txt .= $contractImg;
 564            $txt .= "</a>";
 565          }
 566          }
 567        if( !empty($txt) ) $columns['expand'] = $txt;
 568      }
 569        
 570  
 571        /* hierarchy column */
 572        if( $columnstodisplay['hier'] )
 573      {
 574        $columns['hier'] = $one->Hierarchy();
 575      }
 576  
 577  
 578        /* page column */
 579        if( $columnstodisplay['page'] )
 580      {
 581        $columns['page'] = '&nbsp;';
 582        $txt = '';
 583        if( $one->MenuText() != CMS_CONTENT_HIDDEN_NAME )
 584          {
 585            if ($indent)
 586          {
 587            for ($i=0;$i < $root->getLevel();$i++)
 588              {
 589                $txt .= "-&nbsp;&nbsp;&nbsp;";
 590              }
 591          } 
 592            $str = $one->MenuText();
 593            if( get_site_preference('listcontent_showtitle',0) )
 594          {
 595            $str = $one->Name();
 596          }
 597            if ($display == 'edit')
 598          $txt .= '<a class="tooltip" href="editcontent.php'.$urlext.'&amp;content_id='.$one->Id().'&amp;page='.$page.'" title="'. cms_htmlentities($one->Name().' ('.$one->Alias().')', '', '', true). '" onmouseover="document.getElementById(\'' .$one->Id().'_info\').style.display = \'inline-block\';" onmouseout="document.getElementById(\''.$one->Id().'_info\').style.display = \'none\';">
 599              ' . cms_htmlentities($str, '', '', true) . '<span id="'.$one->Id().'_info"><strong>'.lang('content_id').':</strong> '.$one->Id().'<br /> <strong>'.lang('title').':</strong> '. cms_htmlentities($one->Name()).'<br /> <strong>'.lang('pagealias').':</strong> '.$one->Alias().'</span></a>';
 600            else
 601          $txt .= cms_htmlentities($str, '', '', true);
 602          }
 603        if( !empty($txt) ) $columns['page'] = $txt;
 604      }
 605  
 606        /* alias column */
 607        if( $columnstodisplay['alias'] )
 608      {
 609        $columns['alias'] = '&nbsp;';
 610        $txt = '';
 611        if( $one->HasUsableLink() && $one->Alias() != '' )
 612          {
 613            $txt = $one->Alias();
 614          }
 615        if( !empty($txt) ) $columns['alias'] = $txt;
 616      }
 617         
 618        /* url column */
 619        if( $columnstodisplay['url'] )
 620      {
 621        $columns['url'] = '&nbsp;';
 622        $txt = '';
 623        if( $one->HasUsableLink() && $one->URL() != '' )
 624          {
 625            $url = $one->URL();
 626            if( strlen($url) > 30 )
 627          {
 628            $url = '...'.substr($url,strlen($url)-27);
 629          }
 630            $txt = $url;
 631          }
 632        if( !empty($txt) ) {
 633          if( !prettyurls_ok() ) {
 634            $txt = '<span style="color: red;" title="'.lang('prettyurls_noeffect').'">'.$txt.'<span>';
 635          }
 636        }
 637        if( !empty($txt) ) $columns['url'] = $txt;
 638      }
 639  
 640        /* template column */
 641        if( $columnstodisplay['template'] )
 642      {
 643        $columns['template'] = '&nbsp;';
 644        $txt = '';
 645        if( $one->Type() != 'pagelink' && 
 646            $one->Type() != 'link' && 
 647            $one->Type() != 'sectionheader' && 
 648            $one->Type() != 'separator' )
 649          {
 650            $template = TemplateOperations::get_instance()->LoadTemplateById($one->TemplateId());
 651            if( $template && check_permission($userid,'Modify Template') )
 652          {
 653            $txt .= "<a title=\"".lang('edittemplate')."\" href=\"edittemplate.php".$urlext."&amp;template_id=".$one->TemplateId()."&amp;from=content\">".cms_htmlentities($template->name, '', '', true)."</a>";
 654          }
 655               else if( $template )
 656          {
 657            $txt .= $template->name;
 658          }
 659          }
 660        if( !empty($txt) )
 661          {
 662            $columns['template'] = $txt;
 663          }
 664      }
 665  
 666  
 667        /* friendly name column */
 668        if( $columnstodisplay['friendlyname'] )
 669      {
 670        $columns['friendlyname'] = $one->FriendlyName();
 671      }
 672  
 673  
 674        /* owner column */
 675        if( $columnstodisplay['owner'] )
 676      {
 677        $columns['owner'] = '&nbsp;';
 678        if( $one->Owner() > - 1 )
 679          {
 680            $columns['owner'] = $users[$one->Owner()]->username;
 681          }
 682      }
 683  
 684  
 685        /* active column */
 686        if( $columnstodisplay['active'] )
 687      {
 688        $columns['active'] = '&nbsp;';
 689        $txt = '';
 690        if (check_permission($userid, 'Manage All Content') && $one->Type() != 'errorpage' )
 691          {
 692            if($one->Active())
 693          {
 694            $txt = ($one->DefaultContent()?$image_true:"<a href=\"{$thisurl}&amp;setinactive=".$one->Id()."\" onclick=\"xajax_content_setinactive(".$one->Id().");return false;\">".$image_set_false."</a>");
 695          }
 696            else
 697          {
 698            $txt = "<a href=\"{$thisurl}&amp;setactive=".$one->Id()."\" onclick=\"xajax_content_setactive(".$one->Id().");return false;\">".$image_set_true."</a>";
 699          }
 700          }
 701        if( !empty($txt) )
 702          {
 703            $columns['active'] = $txt;
 704          }
 705      }
 706  
 707  
 708        /* default content */
 709        if( $columnstodisplay['default'] )
 710      {
 711        $columns['default'] = '&nbsp;';
 712        $txt = '';
 713        if (check_permission($userid,'Manage All Content'))
 714          {
 715            if ($one->IsDefaultPossible())
 716          {
 717            $txt = ($one->DefaultContent()?$image_true:"<a href=\"{$thisurl}&amp;makedefault=".$one->Id()."\" onclick=\"if(confirm('".cms_html_entity_decode_utf8(lang("confirmdefault", $one->Name()), true)."')) xajax_content_setdefault(".$one->Id().");return false;\">".$image_set_true."</a>");
 718          }
 719          }
 720        if( !empty($txt) )
 721          {
 722            $columns['default'] = $txt;
 723          }
 724      }
 725  
 726  
 727        /* move column */
 728        if( $columnstodisplay['move'] )
 729      {
 730        // code for move up is simple
 731        $columns['move'] = '&nbsp;';
 732        $txt = '';
 733        if (check_permission($userid, 'Manage All Content') || $author_allpages )
 734          {
 735            $sameLevel = $root->getSiblingCount();
 736            if ($sameLevel>1)
 737          {
 738            if (($one->ItemOrder() - 1) <= 0) #first
 739              { 
 740                $txt .= "<a onclick=\"xajax_content_move(".$one->Id().", ".$one->ParentId().", 'down'); return false;\" href=\"{$thisurl}&amp;direction=down&amp;content_id=".$one->Id()."&amp;parent_id=".$one->ParentId()."&amp;page=".$page."\">";
 741                $txt .= $downImg;
 742                $txt .= "</a>&nbsp;&nbsp;";
 743              }
 744            else if (($one->ItemOrder() - 1) == $sameLevel-1) #last
 745              {
 746                $txt .= "&nbsp;&nbsp;<a class=\"move_up\" onclick=\"xajax_content_move(".$one->Id().", ".$one->ParentId().", 'up'); return false;\" href=\"{$thisurl}&amp;direction=up&amp;content_id=".$one->Id()."&amp;parent_id=".$one->ParentId()."&amp;page=".$page."\">";
 747                $txt .= $upImg;
 748                $txt .= "</a>";
 749              }
 750            else #middle
 751              {
 752                $txt .= "<a onclick=\"xajax_content_move(".$one->Id().", ".$one->ParentId().", 'down'); return false;\" href=\"{$thisurl}&amp;direction=down&amp;content_id=".$one->Id()."&amp;parent_id=".$one->ParentId()."&amp;page=".$page."\">";
 753                $txt .= $downImg;
 754                $txt .= "</a>&nbsp;<a onclick=\"xajax_content_move(".$one->Id().", ".$one->ParentId().", 'up'); return false;\" href=\"{$thisurl}&amp;direction=up&amp;content_id=".$one->Id()."&amp;parent_id=".$one->ParentId()."&amp;page=".$page."\">";
 755                $txt .= $upImg;
 756                $txt .= "</a>";
 757              }
 758          }
 759            
 760            // $txt .= '<input clsss="hidden" type="text" name="order-'. $one->Id().'" value="'.$one->ItemOrder().'" class="order" />';
 761          }
 762        if( !empty($txt) )
 763          {
 764            $columns['move'] = $txt;
 765          }
 766        // end of move code
 767      }
 768      
 769  
 770        /* view column */
 771        if( $columnstodisplay['view'] )
 772      {
 773        $columns['view'] = '&nbsp;';
 774        $txt = '';
 775        {
 776          $url = $one->GetURL();
 777          if ($url != '' && $url != '#' && $one->IsViewable() && $one->Active())
 778            {
 779          $txt .= "<a href=\"".$url."\" rel=\"external\" target=\"_blank\">";
 780          $txt .= $viewImg."</a>";
 781            }
 782        }
 783        if( !empty($txt) )
 784          {
 785            $columns['view'] = $txt;
 786          }
 787      }
 788  
 789  
 790        /* copy column */
 791        if( $columnstodisplay['copy'] )
 792      {
 793        $columns['copy'] = '&nbsp;';
 794        $txt = '';
 795        if( $one->IsCopyable() && 
 796            ((check_permission($userid,'Add Pages') &&
 797          (check_ownership($userid, $one->Id()) || quick_check_authorship($one->Id(), $mypages)))
 798             || check_permission($userid,'Manage All Content')) )
 799          {
 800            $txt .= '<a href="copycontent.php'.$urlext.'&amp;content_id='.$one->Id().'">';
 801            $txt .= $copyImg."</a>";
 802          }
 803        if( !empty($txt) )
 804          {
 805            $columns['copy'] = $txt;
 806          }
 807      }
 808  
 809  
 810        /* edit column */
 811        if( $columnstodisplay['edit'] )
 812      {
 813        $columns['edit'] = '&nbsp;';
 814        $txt = '';
 815        if (check_modify_all($userid) || 
 816            check_ownership($userid, $one->Id()) || 
 817            quick_check_authorship($one->Id(), $mypages) ||
 818            check_permission($userid, 'Manage All Content'))
 819          {
 820            // edit link
 821            $txt .= "<a href=\"editcontent.php".$urlext."&amp;content_id=".$one->Id()."\">";
 822            $txt .= $editImg;
 823            $txt .= "</a>";
 824          }
 825        if( !empty($txt) )
 826          {
 827            $columns['edit'] = $txt;
 828          }
 829      }
 830  
 831  
 832        /* delete column */
 833        if( $columnstodisplay['delete'] )
 834      {
 835        $columns['delete'] = '&nbsp;';
 836        $txt = '';
 837        if ($one->DefaultContent() != true)
 838          {
 839            if ($root->getChildrenCount() == 0 && 
 840            ((check_permission($userid, 'Remove Pages') &&
 841              (check_ownership($userid,$one->Id()) || quick_check_authorship($one->Id(),$mypages))) || check_permission($userid,'Manage All Content') || check_permission($userid,'Modify Any Page'))
 842           )
 843          {
 844            //$txt .= "<a href=\"{$thisurl}&amp;deletecontent=".$one->Id()."\" onclick=\"confirm('".cms_html_entity_decode_utf8(lang('deleteconfirm', $one->mName), true)."');\">";
 845            $txt .= "<a href=\"{$thisurl}&amp;deletecontent=".$one->Id()."\" onclick=\"if (confirm('".cms_html_entity_decode_utf8(lang('deleteconfirm', $one->Name()), true)."')) xajax_content_delete(".$one->Id()."); return false;\">";
 846            $txt .= $deleteImg;
 847            $txt .= "</a>";
 848          }
 849          }
 850        if( !empty($txt) )
 851          {
 852            $columns['delete'] = $txt;
 853          }
 854      }
 855          
 856        if( $columnstodisplay['multiselect'] )
 857      {
 858        /* multiselect */
 859        $columns['multiselect'] = '&nbsp;';
 860        $txt = '';
 861  
 862        $remove    = check_permission($userid, 'Remove Pages')?1:0;
 863        $structure = check_permission($userid, 'Manage All Content')?1:0;
 864        $editperms = (check_permission($userid, 'Modify Any Page') ||
 865              quick_check_authorship($one->Id(),$mypages) ||
 866              check_ownership($userid,$one->Id()))?1:0;
 867        if ( (($structure == 1) || (($remove == 1) && ($editperms == 1))) &&
 868             ($one->Type() != 'errorpage' ))
 869          {
 870            $txt .= '<label class="invisible" for="multicontent-'.$one->Id().'">'.lang('toggle').'</label><input type="checkbox" id="multicontent-'.$one->Id().'" name="multicontent-'.$one->Id().'" title="'.lang('toggle').'"/>';
 871          }
 872        if( !empty($txt) )
 873          {
 874            $columns['multiselect'] = $txt;
 875          }
 876      }
 877        
 878        /* done */
 879        foreach( $columns as $name => $value )
 880      {
 881        if( !$columnstodisplay[$name] ) continue;
 882  
 883        switch( $name )
 884          {
 885          case 'edit':
 886          case 'default':
 887          case 'view':
 888          case 'copy':
 889          case 'delete':
 890          case 'active':
 891            $thelist .= '<td class="pagepos">'.$value."</td>\n";
 892            break;
 893            
 894          case 'move':
 895            $thelist .= '<td class="move">'.$value."</td>\n";
 896            break;
 897  
 898          case 'multiselect':
 899            $thelist .= '<td class="checkbox">'.$value."</td>\n";
 900            break;
 901            
 902          default:
 903            $thelist .= '<td>'.$value."</td>\n";
 904            break;
 905          }
 906      }
 907        $thelist .= "</tr>\n";
 908        ($currow == "row1"?$currow="row2":$currow="row1");
 909      }
 910  
 911      $pagelist[] = $thelist;
 912  
 913      $indent = get_preference($userid, 'indent', true);
 914  
 915      if (in_array($one->Id(),$openedArray) && is_array($children) && count($children) )
 916      {
 917        // count through all the children and see if we can display the move column.
 918        $author_allpages = check_permission($userid,'Reorder Content') && check_peer_authorship($userid,$children[0]->getId());
 919  
 920        foreach ($children as $child)
 921          { 
 922        display_hierarchy($child, $userid, $modifyall, $users, $menupos, $openedArray, $pagelist, $image_true, $image_set_false, $image_set_true, $upImg, $downImg, $viewImg, $editImg, $copyImg, $deleteImg, $expandImg, $contractImg, $mypages, $page, $columnstodisplay, $author_allpages);
 923          }
 924      }
 925  } // function display_hierarchy
 926  
 927  function display_content_list($themeObject = null)
 928  {
 929          $gCms = cmsms();
 930      global $thisurl;
 931      global $urlext;
 932  
 933      check_login();
 934      $userid = get_userid();
 935      
 936      // setup which columns to display.
 937      $mypages = author_pages($userid);
 938      $columnstodisplay = array();
 939      $columnstodisplay['expand'] = 1;
 940      $columnstodisplay['hier'] = 1;
 941      $columnstodisplay['page'] = 1;
 942      $columnstodisplay['alias'] = get_site_preference('listcontent_showalias',1);
 943      $columnstodisplay['url'] = get_site_preference('listcontent_showurl',1);
 944      $columnstodisplay['template'] = 1;
 945      $columnstodisplay['friendlyname'] = 1;
 946      $columnstodisplay['owner'] = 1;
 947      $columnstodisplay['active'] = check_permission($userid, 'Manage All Content');
 948      $columnstodisplay['default'] = check_permission($userid, 'Manage All Content');
 949      $columnstodisplay['move'] = check_permission($userid, 'Manage All Content') || check_permission($userid,'Reorder Content');
 950      $columnstodisplay['view'] = 1;
 951      $columnstodisplay['copy'] = check_permission($userid,'Add Pages') || check_permission($userid,'Manage All Content');
 952      $columnstodisplay['edit'] = 1;
 953      $columnstodisplay['delete'] = check_permission($userid, 'Remove Pages') || check_permission($userid,'Manage All Content');
 954      $columnstodisplay['multiselect'] = check_permission($userid, 'Remove Pages') || check_permission($userid,'Manage All Content');
 955      
 956      $page = 1;
 957      if (isset($_GET['page']))
 958          $page = $_GET['page'];
 959      //$limit = get_preference($userid, 'paging', 0);
 960      $limit = 0; //Took out pagination
 961  
 962      $thelist = '';
 963      $count = 0;
 964  
 965      $currow = "row1";
 966      
 967      if ($themeObject == null)
 968          $themeObject = AdminTheme::GetThemeObject();
 969  
 970      // construct true/false button images
 971      $image_true = $themeObject->DisplayImage('icons/system/true.gif', lang('true'),'','','systemicon');
 972      $image_set_false = $themeObject->DisplayImage('icons/system/true.gif', lang('setfalse'),'','','systemicon');
 973      $image_set_true = $themeObject->DisplayImage('icons/system/false.gif', lang('settrue'),'','','systemicon');
 974      $expandImg = $themeObject->DisplayImage('icons/system/expand.gif', lang('expand'),'','','systemicon');
 975      $contractImg = $themeObject->DisplayImage('icons/system/contract.gif', lang('contract'),'','','systemicon');
 976      $downImg = $themeObject->DisplayImage('icons/system/arrow-d.gif', lang('down'),'','','systemicon');
 977      $upImg = $themeObject->DisplayImage('icons/system/arrow-u.gif', lang('up'),'','','systemicon');
 978      $viewImg = $themeObject->DisplayImage('icons/system/view.gif', lang('view'),'','','systemicon');
 979      $editImg = $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'),'','','systemicon');
 980      $copyImg = $themeObject->DisplayImage('icons/system/copy.gif', lang('copy'),'','','systemicon');
 981      $deleteImg = $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'),'','','systemicon');
 982  
 983      #Setup array so we don't load more templates than we need to
 984      $templateops = TemplateOperations::get_instance()->LoadTemplates();
 985  
 986      #Ditto with users
 987      $users = array();
 988  
 989      $menupos = array();
 990      
 991      $openedArray=array();
 992      if (get_preference($userid, 'collapse', '') != '')
 993      {
 994          $tmp  = explode('.',get_preference($userid, 'collapse'));
 995          foreach ($tmp as $thisCol)
 996          {
 997              $colind = substr($thisCol,0,strpos($thisCol,'='));
 998              if ($colind!="")
 999                  $openedArray[] = $colind;
1000          }
1001      }
1002  
1003      debug_buffer('At Start of Display Content List');
1004          $hierarchy = $gCms->GetHierarchyManager();
1005  
1006      $rowcount = 0;
1007      if ($hierarchy->hasChildren())
1008      {
1009          $pagelist = array();
1010  
1011          $children = $hierarchy->getChildren(false,true);
1012          $author_allpages = check_permission($userid,'Reorder Content') && check_peer_authorship($userid,$children[0]->getId());
1013  
1014          foreach ($children as $child)
1015          { 
1016            display_hierarchy($child, $userid, check_modify_all($userid), $users, $menupos, $openedArray, $pagelist, $image_true, $image_set_false, $image_set_true, $upImg, $downImg, $viewImg, $editImg, $copyImg, $deleteImg, $expandImg, $contractImg, $mypages, $page, $columnstodisplay, $author_allpages );
1017          }
1018          $rowcount += count($pagelist);
1019          foreach ($pagelist as $item)
1020          {
1021              $thelist.=$item;
1022          }
1023  
1024          $thelist .= '</tbody>';
1025          $thelist .= "</table>\n";
1026      }
1027  
1028  
1029      $headoflist = '';
1030  
1031      $headoflist .= '<div class="pageoverflow"><p class="pageoptions">';
1032      if (check_permission($userid, 'Add Pages') || check_permission($userid,'Manage All Content'))
1033      {
1034        $headoflist .=  '<a href="addcontent.php'.$urlext.'" class="pageoptions">';
1035        $headoflist .= $themeObject->DisplayImage('icons/system/newobject.gif', lang('addcontent'),'','','systemicon').'</a>';
1036        $headoflist .= ' <a class="pageoptions" href="addcontent.php'.$urlext.'">'.lang("addcontent").'</a>';
1037      }
1038  
1039      $headoflist .= '<a style="margin-left: 10px;" href="'.$thisurl.'&amp;expandall=1" onclick="xajax_content_expandall(); return false;">';
1040      $headoflist .= $themeObject->DisplayImage('icons/system/expandall.gif', lang('expandall'),'','','systemicon').'</a>';
1041      $headoflist .= ' <a class="pageoptions" href="'.$thisurl.'&amp;expandall=1" onclick="xajax_content_expandall(); return false;">'.lang("expandall").'</a>&nbsp;&nbsp;&nbsp;';
1042      $headoflist .= ' <a href="'.$thisurl.'&amp;collapseall=1" onclick="xajax_content_collapseall(); return false;">';
1043      $headoflist .= $themeObject->DisplayImage('icons/system/contractall.gif', lang('contractall'),'','','systemicon').'</a>';
1044      $headoflist .= ' <a class="pageoptions" href="'.$thisurl.'&amp;collapseall=1" onclick="xajax_content_collapseall(); return false;">'.lang("contractall").'</a>';
1045  
1046      if (check_permission($userid, 'Manage All Content'))
1047      {
1048        $reorderurl = "ordercontent.php?".CMS_SECURE_PARAM_NAME."=".$_SESSION[CMS_USER_KEY];
1049        $headoflist .= '&nbsp;&nbsp;&nbsp;<a href="'.$reorderurl.'">';
1050        $headoflist .= $themeObject->DisplayImage('icons/system/reorder.gif', lang('reorderpages'),'','','systemicon').'</a>';
1051        $headoflist .= ' <a class="pageoptions" href="'.$reorderurl.'">'.lang('reorderpages').'</a>';
1052      }
1053  
1054      $headoflist .='</p></div>';
1055      $headoflist .= '<form action="multicontent.php" method="post">';
1056      $headoflist .= '<div class="hidden" ><input type="hidden" name="'.CMS_SECURE_PARAM_NAME.'" value="'.$_SESSION[CMS_USER_KEY].'"/></div>'."\n";
1057      $headoflist .= '<table cellspacing="0" class="pagetable">'."\n";
1058      $headoflist .= '<thead>';
1059      $headoflist .= "<tr>\n";
1060  
1061      // setup column titles.
1062      if( $columnstodisplay['expand'] )
1063        {
1064          $headoflist .= "<th>&nbsp;</th>";
1065        }
1066      if( $columnstodisplay['hier'] )
1067        {
1068          $headoflist .= "<th>&nbsp;</th>";
1069        }
1070      if( $columnstodisplay['page'] )
1071        {
1072          $str = lang('menutext');
1073          if( get_site_preference('listcontent_showtitle') )
1074            {
1075          $str = lang('title');
1076            }
1077          $headoflist .= '<th scope="col" class="pagew25" title="'.lang('lctitle_page').'">'.lang('page')." <em>({$str})</em></th>\n";
1078        }
1079      if( $columnstodisplay['alias'] )
1080        {
1081          $headoflist .= '<th scope="col" title="'.lang('lctitle_alias').'">'.lang('pagealias')."</th>\n";
1082        }
1083      if( $columnstodisplay['url'] )
1084        {
1085          $headoflist .= '<th scope="col" title="'.lang('lctitle_url').'">'.lang('url')."</th>\n";
1086        }
1087      if( $columnstodisplay['template'] )
1088        {
1089          $headoflist .= '<th scope="col" title="'.lang('lctitle_template').'">'.lang('template')."</th>\n";
1090        }
1091      if( $columnstodisplay['friendlyname'] )
1092        {
1093          $headoflist .= "<th scope=\"col\" >".lang('type')."</th>\n";
1094        }
1095      if( $columnstodisplay['owner'] )
1096        {
1097          $headoflist .= '<th scope="col" title="'.lang('lctitle_owner').'">'.lang('owner')."</th>\n";
1098        }
1099      if( $columnstodisplay['active'] )
1100        {
1101          $headoflist .= '<th scope="col" title="'.lang('lctitle_active').'" class="pagepos">'.lang('active')."</th>\n";
1102        }
1103      if( $columnstodisplay['default'] )
1104        {
1105          $headoflist .= '<th scope="col" title="'.lang('lctitle_default').'" class="pagepos">'.lang('default')."</th>\n";
1106        }
1107      if( $columnstodisplay['move'] )
1108        {
1109          $headoflist .= '<th scope="col" title="'.lang('lctitle_move').'" class="move">'.lang('move')."</th>\n";
1110        }
1111      if( $columnstodisplay['view'] )
1112        {
1113          $headoflist .= "<th class=\"pageicon\">&nbsp;</th>\n";
1114        }
1115      if( $columnstodisplay['copy'] )
1116        {
1117          $headoflist .= "<th class=\"pageicon\">&nbsp;</th>\n";
1118        }
1119      if( $columnstodisplay['edit'] )
1120        {
1121          $headoflist .= "<th class=\"pageicon\">&nbsp;</th>\n";
1122        }
1123      if( $columnstodisplay['delete'] )
1124        {
1125          $headoflist .= "<th class=\"pageicon\">&nbsp;</th>\n";
1126        }
1127      if( $columnstodisplay['multiselect'] )
1128        {
1129          $headoflist .= '<th scope="col" title="'.lang('lctitle_multiselect').'" class="checkbox"><input id="selectall" type="checkbox" onclick="select_all();" /><label for="selectall" class="invisible">'.lang('toggle').'</label></th>'."\n"; // checkbox column
1130        }
1131      $headoflist .= "</tr>\n";
1132      $headoflist .= '</thead>';
1133      $headoflist .= '<tbody>';
1134  
1135      ob_start();
1136      $opts = array();
1137      if( check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content') )
1138        {
1139          bulkcontentoperations::register_function(lang('delete'),'delete');
1140        }
1141      if (check_permission($userid, 'Manage All Content')) 
1142        {
1143          bulkcontentoperations::register_function(lang('active'),'active');
1144          bulkcontentoperations::register_function(lang('inactive'),'inactive');
1145          bulkcontentoperations::register_function(lang('cachable'),'setcachable');
1146          bulkcontentoperations::register_function(lang('noncachable'),'setnoncachable');
1147          bulkcontentoperations::register_function(lang('showinmenu'),'showinmenu');
1148          bulkcontentoperations::register_function(lang('hidefrommenu'),'hidefrommenu');
1149          bulkcontentoperations::register_function(lang('secure'),'secure');
1150          bulkcontentoperations::register_function(lang('insecure'),'insecure');
1151          bulkcontentoperations::register_function(lang('settemplate'),'settemplate');
1152          bulkcontentoperations::register_function(lang('changeowner'),'changeowner');
1153        }
1154      $opts = bulkcontentoperations::get_operation_list();
1155      if( !empty($opts) )
1156        {
1157          echo '<div class="pageoptions">'."\n";
1158          echo '<div style="margin-top: 0; float: right; text-align: right">'."\n";
1159          echo '<label for="multiaction">'.lang('selecteditems').'</label>:&nbsp;&nbsp;'; 
1160          echo '<select name="multiaction" id="multiaction">';
1161          foreach( $opts as $key => $value )
1162            {
1163          echo '<option value="'.$key.'">'.$value.'</option>';
1164            }
1165          echo '</select>'."\n";
1166              echo '<input type="submit" accesskey="s" value="'.lang('submit').'"/></div></div>'."\n";
1167        }
1168      /*    } */
1169  ?>
1170              <div style="float: left;">
1171  <?php
1172      if (check_permission($userid, 'Add Pages')|| check_permission($userid,'Manage All Content'))
1173      {
1174  ?>
1175              <a href="addcontent.php<?php echo $urlext ?>" class="pageoptions">
1176  <?php 
1177              echo $themeObject->DisplayImage('icons/system/newobject.gif', lang('addcontent'),'','','systemicon').'</a>';
1178              echo ' <a class="pageoptions" href="addcontent.php'.$urlext.'">'.lang("addcontent");
1179  ?>
1180              </a>
1181  <?php 
1182      } 
1183  ?>
1184          <a style="margin-left: 10px;" href="'.$thisurl.'&amp;expandall=1" onclick="xajax_content_expandall(); return false;">
1185  <?php 
1186              echo $themeObject->DisplayImage('icons/system/expandall.gif', lang('expandall'),'','','systemicon').'</a>';
1187          echo ' <a class="pageoptions" href="'.$thisurl.'&amp;expandall=1" onclick="xajax_content_expandall(); return false;">'.lang("expandall");
1188  ?>
1189              </a>&nbsp;&nbsp;&nbsp;
1190          <a href="<?php echo $thisurl ?>&amp;collapseall=1" onclick="xajax_content_collapseall(); return false;">
1191  <?php 
1192              echo $themeObject->DisplayImage('icons/system/contractall.gif', lang('contractall'),'','','systemicon').'</a>';
1193          echo ' <a class="pageoptions" href="'.$thisurl.'&amp;collapseall=1" onclick="xajax_content_collapseall(); return false;">'.lang("contractall").'</a>';
1194          if (check_permission($userid, 'Manage All Content'))
1195          {
1196              $image_reorder = $themeObject->DisplayImage('icons/system/reorder.gif', lang('reorderpages'),'','','systemicon');
1197              $reorderurl = "ordercontent.php?".CMS_SECURE_PARAM_NAME."=".$_SESSION[CMS_USER_KEY];
1198              echo '&nbsp;&nbsp;&nbsp; <a class="pageoptions" href="'.$reorderurl.'">'.$image_reorder.'</a> <a class="pageoptions" href="'.$reorderurl.'">'.lang('reorderpages').'</a>';
1199          }
1200  ?>
1201              </div>
1202  
1203              <br />
1204  
1205              <div class="clearb"></div>
1206  <?php
1207      $footer = ob_get_contents();
1208      ob_end_clean();
1209  
1210      return $headoflist . $thelist . $footer .'</form></div>';
1211  }
1212  
1213  
1214  echo $themeObject->ShowMessage('', 'message');
1215  echo $themeObject->ShowErrors('' ,'error');
1216  ?>
1217  <div class="pagecontainer">
1218  <?php
1219  
1220  $hierManager = cmsms()->GetHierarchyManager();
1221  
1222  if (isset($_GET["makedefault"]))
1223  {
1224      setdefault($_GET['makedefault']);
1225      redirect($thisurl);
1226  }
1227  
1228  // check if we're activating a page
1229  if (isset($_GET["setactive"]))
1230  {
1231      setactive($_GET["setactive"]);
1232  }
1233  
1234  // perhaps we're deactivating a page instead?
1235  if (isset($_GET["setinactive"]))
1236  {
1237      setactive($_GET["setinactive"], false);
1238  }
1239  
1240  if (isset($_GET['expandall']))
1241  {
1242      expandall();
1243  }
1244  
1245  if (isset($_GET['collapseall']))
1246  {
1247      collapseall();
1248  }
1249  
1250  if (isset($_GET['deletecontent']))
1251  {
1252      deletecontent($_GET['deletecontent']);
1253      redirect($thisurl);
1254  }
1255  
1256  if (isset($_GET['direction']))
1257  {
1258      movecontent($_GET['content_id'], $_GET['parent_id'], $_GET['direction']);
1259  }
1260  
1261  if (isset($_GET['col']) && isset($_GET['content_id']))
1262  {
1263      toggleexpand($_GET['content_id'], $_GET['col']=='1'?true:false);
1264  }
1265  
1266  echo '<div class="pageoverflow">';
1267  echo $themeObject->ShowHeader('currentpages').'</div>';
1268  debug_buffer('test before loadallcontent');
1269  cmsms()->GetContentOperations()->LoadAllContent(FALSE,TRUE);
1270  
1271  debug_buffer('test after loadallcontent');
1272  echo '<div id="contentlist">'.display_content_list($themeObject).'</div>';
1273  
1274  ?>
1275  
1276          <p class="pageback"><a class="pageback" href="<?php echo $themeObject->BackUrl(); ?>">&#171; <?php echo lang('back')?></a></p>
1277          <script type="text/javascript">
1278          //<![CDATA[
1279  		function select_all()
1280          {
1281              checkboxes = document.getElementsByTagName("input");
1282                  elem = document.getElementById('selectall');
1283          state = elem.checked;
1284              for (i=0; i<checkboxes.length ; i++)
1285              {
1286                      if (checkboxes[i].type == "checkbox") 
1287                {
1288                  checkboxes[i].checked=state;
1289                }
1290              }
1291          }
1292          //]]>
1293          </script>
1294          <?php
1295  
1296  include_once ("footer.php");
1297  
1298  # vim:ts=4 sw=4 noet
1299  ?>

title

Description

title

Description

title

Description

title

title

Body