public static function &get_instance()
 {
     if (!is_object(self::$_instance)) {
         self::$_instance = new TemplateOperations();
     }
     return self::$_instance;
 }
Example #2
0
function display_content_list($themeObject = null)
{
    $gCms = cmsms();
    global $thisurl;
    global $urlext;
    check_login();
    $userid = get_userid();
    // setup which columns to display.
    $mypages = author_pages($userid);
    $columnstodisplay = array();
    $columnstodisplay['expand'] = 1;
    $columnstodisplay['hier'] = 1;
    $columnstodisplay['page'] = 1;
    $columnstodisplay['alias'] = get_site_preference('listcontent_showalias', 1);
    $columnstodisplay['url'] = get_site_preference('listcontent_showurl', 1);
    $columnstodisplay['template'] = 1;
    $columnstodisplay['friendlyname'] = 1;
    $columnstodisplay['owner'] = 1;
    $columnstodisplay['active'] = check_permission($userid, 'Manage All Content');
    $columnstodisplay['default'] = check_permission($userid, 'Manage All Content');
    $columnstodisplay['move'] = check_permission($userid, 'Manage All Content') || check_permission($userid, 'Reorder Content');
    $columnstodisplay['view'] = 1;
    $columnstodisplay['copy'] = check_permission($userid, 'Add Pages') || check_permission($userid, 'Manage All Content');
    $columnstodisplay['edit'] = 1;
    $columnstodisplay['delete'] = check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content');
    $columnstodisplay['multiselect'] = check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content');
    $page = 1;
    if (isset($_GET['page'])) {
        $page = $_GET['page'];
    }
    //$limit = get_preference($userid, 'paging', 0);
    $limit = 0;
    //Took out pagination
    $thelist = '';
    $count = 0;
    $currow = "row1";
    if ($themeObject == null) {
        $themeObject = AdminTheme::GetThemeObject();
    }
    // construct true/false button images
    $image_true = $themeObject->DisplayImage('icons/system/true.gif', lang('true'), '', '', 'systemicon');
    $image_set_false = $themeObject->DisplayImage('icons/system/true.gif', lang('setfalse'), '', '', 'systemicon');
    $image_set_true = $themeObject->DisplayImage('icons/system/false.gif', lang('settrue'), '', '', 'systemicon');
    $expandImg = $themeObject->DisplayImage('icons/system/expand.gif', lang('expand'), '', '', 'systemicon');
    $contractImg = $themeObject->DisplayImage('icons/system/contract.gif', lang('contract'), '', '', 'systemicon');
    $downImg = $themeObject->DisplayImage('icons/system/arrow-d.gif', lang('down'), '', '', 'systemicon');
    $upImg = $themeObject->DisplayImage('icons/system/arrow-u.gif', lang('up'), '', '', 'systemicon');
    $viewImg = $themeObject->DisplayImage('icons/system/view.gif', lang('view'), '', '', 'systemicon');
    $editImg = $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'), '', '', 'systemicon');
    $copyImg = $themeObject->DisplayImage('icons/system/copy.gif', lang('copy'), '', '', 'systemicon');
    $deleteImg = $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'), '', '', 'systemicon');
    #Setup array so we don't load more templates than we need to
    $templateops = TemplateOperations::get_instance()->LoadTemplates();
    #Ditto with users
    $users = array();
    $menupos = array();
    $openedArray = array();
    if (get_preference($userid, 'collapse', '') != '') {
        $tmp = explode('.', get_preference($userid, 'collapse'));
        foreach ($tmp as $thisCol) {
            $colind = substr($thisCol, 0, strpos($thisCol, '='));
            if ($colind != "") {
                $openedArray[] = $colind;
            }
        }
    }
    debug_buffer('At Start of Display Content List');
    $hierarchy = $gCms->GetHierarchyManager();
    $rowcount = 0;
    if ($hierarchy->hasChildren()) {
        $pagelist = array();
        $children = $hierarchy->getChildren(false, true);
        $author_allpages = check_permission($userid, 'Reorder Content') && check_peer_authorship($userid, $children[0]->getId());
        foreach ($children as $child) {
            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);
        }
        $rowcount += count($pagelist);
        foreach ($pagelist as $item) {
            $thelist .= $item;
        }
        $thelist .= '</tbody>';
        $thelist .= "</table>\n";
    }
    $headoflist = '';
    $headoflist .= '<div class="pageoverflow"><p class="pageoptions">';
    if (check_permission($userid, 'Add Pages') || check_permission($userid, 'Manage All Content')) {
        $headoflist .= '<a href="addcontent.php' . $urlext . '" class="pageoptions">';
        $headoflist .= $themeObject->DisplayImage('icons/system/newobject.gif', lang('addcontent'), '', '', 'systemicon') . '</a>';
        $headoflist .= ' <a class="pageoptions" href="addcontent.php' . $urlext . '">' . lang("addcontent") . '</a>';
    }
    $headoflist .= '<a style="margin-left: 10px;" href="' . $thisurl . '&amp;expandall=1" onclick="xajax_content_expandall(); return false;">';
    $headoflist .= $themeObject->DisplayImage('icons/system/expandall.gif', lang('expandall'), '', '', 'systemicon') . '</a>';
    $headoflist .= ' <a class="pageoptions" href="' . $thisurl . '&amp;expandall=1" onclick="xajax_content_expandall(); return false;">' . lang("expandall") . '</a>&nbsp;&nbsp;&nbsp;';
    $headoflist .= ' <a href="' . $thisurl . '&amp;collapseall=1" onclick="xajax_content_collapseall(); return false;">';
    $headoflist .= $themeObject->DisplayImage('icons/system/contractall.gif', lang('contractall'), '', '', 'systemicon') . '</a>';
    $headoflist .= ' <a class="pageoptions" href="' . $thisurl . '&amp;collapseall=1" onclick="xajax_content_collapseall(); return false;">' . lang("contractall") . '</a>';
    if (check_permission($userid, 'Manage All Content')) {
        $reorderurl = "ordercontent.php?" . CMS_SECURE_PARAM_NAME . "=" . $_SESSION[CMS_USER_KEY];
        $headoflist .= '&nbsp;&nbsp;&nbsp;<a href="' . $reorderurl . '">';
        $headoflist .= $themeObject->DisplayImage('icons/system/reorder.gif', lang('reorderpages'), '', '', 'systemicon') . '</a>';
        $headoflist .= ' <a class="pageoptions" href="' . $reorderurl . '">' . lang('reorderpages') . '</a>';
    }
    $headoflist .= '</p></div>';
    $headoflist .= '<form action="multicontent.php" method="post">';
    $headoflist .= '<div class="hidden" ><input type="hidden" name="' . CMS_SECURE_PARAM_NAME . '" value="' . $_SESSION[CMS_USER_KEY] . '"/></div>' . "\n";
    $headoflist .= '<table cellspacing="0" class="pagetable">' . "\n";
    $headoflist .= '<thead>';
    $headoflist .= "<tr>\n";
    // setup column titles.
    if ($columnstodisplay['expand']) {
        $headoflist .= "<th>&nbsp;</th>";
    }
    if ($columnstodisplay['hier']) {
        $headoflist .= "<th>&nbsp;</th>";
    }
    if ($columnstodisplay['page']) {
        $str = lang('menutext');
        if (get_site_preference('listcontent_showtitle')) {
            $str = lang('title');
        }
        $headoflist .= '<th scope="col" class="pagew25" title="' . lang('lctitle_page') . '">' . lang('page') . " <em>({$str})</em></th>\n";
    }
    if ($columnstodisplay['alias']) {
        $headoflist .= '<th scope="col" title="' . lang('lctitle_alias') . '">' . lang('pagealias') . "</th>\n";
    }
    if ($columnstodisplay['url']) {
        $headoflist .= '<th scope="col" title="' . lang('lctitle_url') . '">' . lang('url') . "</th>\n";
    }
    if ($columnstodisplay['template']) {
        $headoflist .= '<th scope="col" title="' . lang('lctitle_template') . '">' . lang('template') . "</th>\n";
    }
    if ($columnstodisplay['friendlyname']) {
        $headoflist .= "<th scope=\"col\" >" . lang('type') . "</th>\n";
    }
    if ($columnstodisplay['owner']) {
        $headoflist .= '<th scope="col" title="' . lang('lctitle_owner') . '">' . lang('owner') . "</th>\n";
    }
    if ($columnstodisplay['active']) {
        $headoflist .= '<th scope="col" title="' . lang('lctitle_active') . '" class="pagepos">' . lang('active') . "</th>\n";
    }
    if ($columnstodisplay['default']) {
        $headoflist .= '<th scope="col" title="' . lang('lctitle_default') . '" class="pagepos">' . lang('default') . "</th>\n";
    }
    if ($columnstodisplay['move']) {
        $headoflist .= '<th scope="col" title="' . lang('lctitle_move') . '" class="move">' . lang('move') . "</th>\n";
    }
    if ($columnstodisplay['view']) {
        $headoflist .= "<th class=\"pageicon\">&nbsp;</th>\n";
    }
    if ($columnstodisplay['copy']) {
        $headoflist .= "<th class=\"pageicon\">&nbsp;</th>\n";
    }
    if ($columnstodisplay['edit']) {
        $headoflist .= "<th class=\"pageicon\">&nbsp;</th>\n";
    }
    if ($columnstodisplay['delete']) {
        $headoflist .= "<th class=\"pageicon\">&nbsp;</th>\n";
    }
    if ($columnstodisplay['multiselect']) {
        $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
    }
    $headoflist .= "</tr>\n";
    $headoflist .= '</thead>';
    $headoflist .= '<tbody>';
    ob_start();
    $opts = array();
    if (check_permission($userid, 'Remove Pages') || check_permission($userid, 'Manage All Content')) {
        bulkcontentoperations::register_function(lang('delete'), 'delete');
    }
    if (check_permission($userid, 'Manage All Content')) {
        bulkcontentoperations::register_function(lang('active'), 'active');
        bulkcontentoperations::register_function(lang('inactive'), 'inactive');
        bulkcontentoperations::register_function(lang('cachable'), 'setcachable');
        bulkcontentoperations::register_function(lang('noncachable'), 'setnoncachable');
        bulkcontentoperations::register_function(lang('showinmenu'), 'showinmenu');
        bulkcontentoperations::register_function(lang('hidefrommenu'), 'hidefrommenu');
        bulkcontentoperations::register_function(lang('secure'), 'secure');
        bulkcontentoperations::register_function(lang('insecure'), 'insecure');
        bulkcontentoperations::register_function(lang('settemplate'), 'settemplate');
        bulkcontentoperations::register_function(lang('changeowner'), 'changeowner');
    }
    $opts = bulkcontentoperations::get_operation_list();
    if (!empty($opts)) {
        echo '<div class="pageoptions">' . "\n";
        echo '<div style="margin-top: 0; float: right; text-align: right">' . "\n";
        echo '<label for="multiaction">' . lang('selecteditems') . '</label>:&nbsp;&nbsp;';
        echo '<select name="multiaction" id="multiaction">';
        foreach ($opts as $key => $value) {
            echo '<option value="' . $key . '">' . $value . '</option>';
        }
        echo '</select>' . "\n";
        echo '<input type="submit" accesskey="s" value="' . lang('submit') . '"/></div></div>' . "\n";
    }
    /*    } */
    ?>
			<div style="float: left;">
<?php 
    if (check_permission($userid, 'Add Pages') || check_permission($userid, 'Manage All Content')) {
        ?>
			<a href="addcontent.php<?php 
        echo $urlext;
        ?>
" class="pageoptions">
<?php 
        echo $themeObject->DisplayImage('icons/system/newobject.gif', lang('addcontent'), '', '', 'systemicon') . '</a>';
        echo ' <a class="pageoptions" href="addcontent.php' . $urlext . '">' . lang("addcontent");
        ?>
			</a>
<?php 
    }
    ?>
		<a style="margin-left: 10px;" href="'.$thisurl.'&amp;expandall=1" onclick="xajax_content_expandall(); return false;">
<?php 
    echo $themeObject->DisplayImage('icons/system/expandall.gif', lang('expandall'), '', '', 'systemicon') . '</a>';
    echo ' <a class="pageoptions" href="' . $thisurl . '&amp;expandall=1" onclick="xajax_content_expandall(); return false;">' . lang("expandall");
    ?>
			</a>&nbsp;&nbsp;&nbsp;
		<a href="<?php 
    echo $thisurl;
    ?>
&amp;collapseall=1" onclick="xajax_content_collapseall(); return false;">
<?php 
    echo $themeObject->DisplayImage('icons/system/contractall.gif', lang('contractall'), '', '', 'systemicon') . '</a>';
    echo ' <a class="pageoptions" href="' . $thisurl . '&amp;collapseall=1" onclick="xajax_content_collapseall(); return false;">' . lang("contractall") . '</a>';
    if (check_permission($userid, 'Manage All Content')) {
        $image_reorder = $themeObject->DisplayImage('icons/system/reorder.gif', lang('reorderpages'), '', '', 'systemicon');
        $reorderurl = "ordercontent.php?" . CMS_SECURE_PARAM_NAME . "=" . $_SESSION[CMS_USER_KEY];
        echo '&nbsp;&nbsp;&nbsp; <a class="pageoptions" href="' . $reorderurl . '">' . $image_reorder . '</a> <a class="pageoptions" href="' . $reorderurl . '">' . lang('reorderpages') . '</a>';
    }
    ?>
			</div>

			<br />

			<div class="clearb"></div>
<?php 
    $footer = ob_get_contents();
    ob_end_clean();
    return $headoflist . $thelist . $footer . '</form></div>';
}
Example #3
0
 /**
  * Get a handle to the CMS TemplateOperations object. If it does not yet
  * exist, this method will instantiate it.
  *
  * @final
  * @see TemplateOperations
  * @return TemplateOperations handle to the TemplateOperations object
  */
 public function &GetTemplateOperations()
 {
     return TemplateOperations::get_instance();
 }
Example #4
0
    $result = $db->Execute($query);
}
echo '[done]</p>';
@ob_flush();
echo '<p>Adding module_deps table...';
$dbdict = NewDataDictionary($db);
$flds = "\n\tparent_module C(25),\n\tchild_module C(25),\n\tminimum_version C(25),\n\tcreate_date DT,\n\tmodified_date DT\n";
$taboptarray = array('mysql' => 'TYPE=MyISAM');
$sqlarray = $dbdict->CreateTableSQL(cms_db_prefix() . "module_deps", $flds, $taboptarray);
$dbdict->ExecuteSQLArray($sqlarray);
echo '[done]</p>';
echo '<p>Updating hierarchy positions...';
@ContentManager::SetAllHierarchyPositions();
echo '[done]</p>';
echo '<p>Changing dhtmlmenu to phplayers module on templates...';
$alltemplates = TemplateOperations::LoadTemplates();
foreach ($alltemplates as $onetemplate) {
    #Fix for dhtmlmenu
    $onetemplate->content = str_replace('{dhtmlmenu', "{cms_module module='phplayers'", $onetemplate->content);
    $onetemplate->Save();
}
echo '[done]</p>';
echo '<p>"Installing" phplayers module (if necessary)... ';
$query = "SELECT * from " . cms_db_prefix() . "modules WHERE module_name = 'PHPLayers'";
$result = $db->Execute($query);
if ($result && $result->RecordCount() < 1) {
    $query = "INSERT INTO " . cms_db_prefix() . "modules (module_name, status, version, active) VALUES ('PHPLayers', 'Installed', '1.0', 1)";
    $result = $db->Execute($query);
}
echo '[done]</p>';
echo '<p>Updating additional_users to new content ids...';