本文整理汇总了PHP中Sites::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Sites::getList方法的具体用法?PHP Sites::getList怎么用?PHP Sites::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sites
的用法示例。
在下文中一共展示了Sites::getList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Sites
<?php
header('Content-type: text/xml');
$newsite = (int) $this->request->parameters['site'];
$action = $this->request->parameters['action'];
$node_id = $this->request->parameters['nid'];
if ($node_id) {
$node_id = str_replace('page_', '', $node_id);
}
$maxlevels = 1;
// Check if we need special handling for the root-nodes
if ($action == 'copy' || $action == 'move') {
$root_link = 'javascript:void(0);';
}
$siteMgr = new Sites();
$sites = $siteMgr->getList();
if ($newsite != 0) {
$siteID = $newsite;
}
if ($newsite != 0) {
$siteID = $newsite;
foreach ($sites as $currSite) {
if ($siteID == $currSite['PNAME']) {
$sitePNAME = $currSite['PNAME'];
}
}
$sitePNAME = '';
} else {
$siteID = $sites[0]['ID'];
$sitePNAME = $sites[0]['PNAME'];
}
示例2: sConfig
$roleid = $roleid[0];
$isRORole = false;
// Check if role is rootrole
$rootGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTGROUPID");
$anonGroupId = (int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ANONGROUPID");
if ($rootGroupId == $roleid) {
$isRORole = true;
}
$maxlevels = 3;
switch (strtolower($this->page)) {
case 'tab_usergroup_pages':
case 'tab_usergroup_pages_inner':
$icons = new Icons();
$objecttype = 'pages';
$siteMgr = new Sites();
$sites = $siteMgr->getList(true);
$siteID = $this->request->parameters['site'];
if (!$siteID) {
$siteID = $sites[0]['ID'];
}
foreach ($sites as $sites_item) {
if ($sites_item['ID'] == $siteID) {
$sitename = $sites_item['NAME'];
}
}
if ($siteID) {
$pageMgr = new PageMgr($siteID);
$objects = $pageMgr->getList(0, array(), $maxlevels, $roleid);
$objects = $pageMgr->getAdditionalTreeInfo(false, $objects);
foreach ($objects as $objectIndex => $object_item) {
$iconData = getIconForPage($object_item);
示例3: explode
$templatePreview = $templateInfo['PREVIEWPATH'];
}
$koala->callJSFunction('Koala.windows[\'wid_' . $parentwindow . '\'].refreshSiteTemplate', $templateInfo['NAME'], $templateInfo['FILENAME'], $template, $templatePreview);
}
break;
case 'saveSiteInfo':
$wid = $this->params['wid'];
$objectID = $this->params['objectID'];
$name = $this->params['site_name'];
$pname = $this->params['site_pname'];
$pname = $siteMgr->filterPName($pname);
$favicon = $this->params['site_favicon'];
$defaulttemplate = $this->params['site_defaulttemplate'];
$templateroot = $this->params['site_templateroot'];
// Check if PNAME is already used or in blacklist
$siteList = $siteMgr->getList();
$siteBlackList = explode(',', (string) sConfig()->getVar("CONFIG/RESERVED_SITENAMES"));
$isError = false;
$errorType = null;
foreach ($siteList as $siteListItem) {
if ($pname != '' && $siteListItem['PNAME'] == $pname && $objectID != $siteListItem['ID']) {
$isError = true;
$errorType = 1;
$koala->queueScript("if (\$('" . $wid . "_site_pname')) \$('" . $wid . "_site_pname').addClassName('error');");
}
}
foreach ($siteBlackList as $siteBlackListItem) {
if ($pname != '' && strtolower($siteBlackListItem) == strtolower($pname)) {
$isError = true;
$errorType = 2;
$koala->queueScript("if (\$('" . $wid . "_site_pname')) \$('" . $wid . "_site_pname').addClassName('error');");
示例4: substr
<?php
$prefix = '/';
$special_url = substr($this->request->parameters['special_url'], count($prefix));
$special_url = resolveSpecialURL($special_url);
if ($special_url !== false) {
$smarty->assign("presetURL", $special_url);
} else {
$smarty->assign("presetURL", trim(prettifyUrl($this->request->parameters['special_url'])));
}
$siteMgr = new Sites();
// Check if coming from Contenteditor
if (substr($this->request->parameters['opener_reference'], 0, 8) == 'textarea') {
$smarty->assign("fromContentEditor", true);
}
$smarty->assign("action", $this->request->parameters['action']);
$smarty->assign("opener_reference", $this->request->parameters['opener_reference']);
$smarty->assign("win_no", $this->request->parameters['win_no']);
$smarty->assign("sites", $siteMgr->getList());
$smarty->assign("site", $this->request->parameters['site']);
$smarty->display('file:' . $this->page_template);
示例5: getLinkedPages
/**
* Gets all published Pages linked to this Cblock
*
* @param bool $onlyPublished TRUE if only published Pageversions should be returned (optional)
* @return array|false Array of linked Pages or FALSE in case of an error
*/
function getLinkedPages($onlyPublished = false)
{
$cbId = $this->_id;
if ($this->permissions->checkInternal($this->_uid, $cbId, "RREAD")) {
$siteMgr = new Sites();
$sites = $siteMgr->getList();
$a = 0;
for ($i = 0; $i < count($sites); $i++) {
$linkedtosite = $this->getLinkedPageVersions($sites[$i]['ID'], true);
if (count($linkedtosite) > 0) {
for ($x = 0; $x < count($linkedtosite); $x++) {
$linkpageid = $linkedtosite[$x]['ID'];
$PageMgr = new PageMgr($sites[$i]['ID']);
$linkpageparents = $PageMgr->getParents($linkpageid);
$p = $PageMgr->getPage($linkpageid);
$pageversions = $p->getVersionsByCblockId($cbId);
$linkedPageInfo = $p->get();
$linkedpages[$a]['SITEID'] = $sites[$i]['ID'];
$linkedpages[$a]['SITENAME'] = $sites[$i]['NAME'];
$linkedpages[$a]['PAGEID'] = $linkpageid;
$linkedpages[$a]['PAGENAME'] = $linkedPageInfo['NAME'];
$linkedpages[$a]['HASCHANGED'] = $linkedtosite[$x]['HASCHANGED'];
$linkedpages[$a]['PARENTS'] = $linkpageparents;
if ($onlyPublished) {
$tmpVersion = $p->getPublishedVersion(true);
$linkedpages[$a]['VERSION'] = $tmpVersion;
$linkedInPublishedVersion = false;
foreach ($pageversions as $pageversionsItem) {
if ($pageversionsItem['VERSION'] == $tmpVersion) {
$linkedInPublishedVersion = true;
}
}
if (!$linkedInPublishedVersion) {
unset($linkedpages[$a]);
} else {
$a++;
}
} else {
$linkedpages[$a]['VERSIONS'] = $pageversions;
$a++;
}
}
}
}
return $linkedpages;
} else {
return false;
}
}
示例6: remove
/**
* Removes a Cblock from the Trash
*
* @param int $cbId Cblock Id
*
* @return array Array with all elements which were successfully removed
*/
function remove($cbId)
{
$cbId = $origCbId = (int) $cbId;
$rootNode = $this->tree->getRoot();
if ($cbId == $rootNode) {
return array();
}
// Get folder for embedded cblocks
$embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER");
// Get all nodes
$hadError = false;
$allNodes = $this->tree->get($cbId, 1000);
foreach ($allNodes as $allNodesItem) {
$cbId = $allNodesItem['ID'];
// Check if object is really in trash
$cb = $this->getCblock($cbId);
$cblockInfo = $cb->get();
if ($cbId != $embeddedCblockFolder && $cb->permissions->checkInternal($this->_uid, $cbId, "RDELETE") && $cblockInfo['DELETED']) {
$lc = $cb->getEntrymasks();
$sql = "DELETE FROM yg_contentblocks_properties WHERE OBJECTID = ?;";
$result = sYDB()->Execute($sql, $cbId);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$s = new Sites();
$sites = $s->getList();
for ($i = 0; $i < count($sites); $i++) {
$this->removeAllPageLinks($cbId, $sites[$i]["ID"]);
}
for ($i = 0; $i < count($lc); $i++) {
$lnkid = $lc[$i]["LINKID"];
$sql = "DELETE FROM yg_contentblocks_lnk_entrymasks WHERE ID = ?;";
$result = sYDB()->Execute($sql, $lnkid);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$sql = "DELETE FROM yg_contentblocks_lnk_entrymasks_c WHERE LNK = ?;";
$result = sYDB()->Execute($sql, $lnkid);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
}
$cb->history->clear();
$cb->tags->clear();
$cb->permissions->clear();
$this->callExtensionHook("onRemove", $cbId, 0, $cblockInfo);
} else {
$hadError = true;
}
}
if ($hadError) {
return array();
} else {
$this->tree->remove($origCbId);
return array($origCbId);
}
}
示例7: list2Action
public function list2Action()
{
$list = Sites::getList();
$this->view->disable();
echo json_encode(array("data" => $list->toArray()));
}
示例8: getAllComments
/**
* Gets all Comments
*
* @param array $filterArray Filter array
* @param string $filterLimit Filter limit
* @return array Array of Comments
*/
function getAllComments($filterArray, $filterLimit)
{
if ($filterArray) {
$filterSelect = $filterFrom = $filterWhere = $filterLimit = $filterOrder = $filterHaving = '';
buildBackendFilter('CommentsFilterCB', $filterArray, $filterSelect, $filterFrom, $filterWhere, $filterLimit, $filterOrder, $filterHaving);
}
if ($filterLimit) {
$filterLimit = "LIMIT " . $filterLimit;
}
if ($filterHaving) {
$filterHaving = "AND " . $filterHaving;
}
$filterOrder = 'DESC';
$siteMgr = new Sites();
$allSites = $siteMgr->getList();
$sitesIfExpressionSQL = '';
$sitesIfExpressionSQL2 = '';
$sitesJoinExpressionSQL = '';
$sitesIDCoalesceSQL = '';
$sitesNAMECoalesceSQL = '';
$sitesRREADCoalesceSQL = '';
$sitesRMODERATECoalesceSQL = '';
$sitesRCOMMENTCoalesceSQL = '';
$sitesUSERGROUPIDCoalesceSQL = '';
$sitesUSERGROUPIDHavingSQL = '';
$currUser = new User($this->_uid);
$roles = $currUser->getUsergroups();
foreach ($allSites as $site) {
$sitesIfExpressionSQL .= "\n\t\t\t\tIF(yg_site_" . $site['ID'] . "_tree.id IS NOT NULL, 'PAGE', ";
$sitesIfExpressionSQL2 .= "\n\t\t\t\tIF(yg_site_" . $site['ID'] . "_tree.id IS NOT NULL, '" . $site['ID'] . "', ";
$sitesJoinExpressionSQL .= "\n\t\t\t\tLEFT JOIN yg_comments_lnk_pages_" . $site['ID'] . "\n\t\t\t\tON (c.id = yg_comments_lnk_pages_" . $site['ID'] . ".commentid)\n\t\t\t\tLEFT JOIN yg_site_" . $site['ID'] . "_tree\n\t\t\t\tON (yg_site_" . $site['ID'] . "_tree.id = yg_comments_lnk_pages_" . $site['ID'] . ".OID)\n\t\t\t\tLEFT JOIN yg_site_" . $site['ID'] . "_permissions\n\t\t\t\tON (yg_site_" . $site['ID'] . "_permissions.OID = yg_comments_lnk_pages_" . $site['ID'] . ".OID)\n\t\t\t\t";
$sitesIDCoalesceSQL .= ", yg_site_" . $site['ID'] . "_tree.ID";
$sitesNAMECoalesceSQL .= ", yg_site_" . $site['ID'] . "_tree.ID";
$sitesRREADCoalesceSQL .= ", (yg_site_" . $site['ID'] . "_permissions.RREAD)";
$sitesRMODERATECoalesceSQL .= ", (yg_site_" . $site['ID'] . "_permissions.RMODERATE)";
$sitesRCOMMENTCoalesceSQL .= ", (yg_site_" . $site['ID'] . "_permissions.RCOMMENT)";
$sitesUSERGROUPIDCoalesceSQL .= ", yg_site_" . $site['ID'] . "_permissions.USERGROUPID";
}
$sitesUSERGROUPIDHavingSQL .= " AND (";
for ($r = 0; $r < count($roles); $r++) {
$sitesUSERGROUPIDHavingSQL .= "(USERGROUPID = " . $roles[$r]["ID"] . ")";
if (count($roles) - $r > 1) {
$sitesUSERGROUPIDHavingSQL .= " OR ";
}
}
$sitesUSERGROUPIDHavingSQL .= ")";
$sitesIfExpressionSQL .= "NULL ))" . str_repeat(')', count($allSites));
$sitesIfExpressionSQL2 .= "NULL " . str_repeat(')', count($allSites));
$sql = "SELECT\n\t\t\tc.*,\n\t\t\tCOALESCE(yg_contentblocks_tree.PNAME, yg_files_tree.TITLE {$sitesNAMECoalesceSQL}) AS `NAME`,\n\t\t\tIF(yg_contentblocks_tree.id IS NOT NULL, 'CO',\n\t\t\tIF(yg_files_tree.id IS NOT NULL, 'FILE',\n\t\t\t{$sitesIfExpressionSQL} AS OBJECTTYPE,\n\t\t\tCOALESCE(yg_contentblocks_tree.ID, yg_files_tree.ID {$sitesIDCoalesceSQL}) AS `OBJECTID`,\n\t\t\t{$sitesIfExpressionSQL2} AS SITEID,\n\n\t\t\tCOALESCE((yg_contentblocks_permissions.RREAD), (yg_files_permissions.RREAD) {$sitesRREADCoalesceSQL}) AS `RREAD`,\n\t\t\tCOALESCE((yg_contentblocks_permissions.RMODERATE), (yg_files_permissions.RMODERATE) {$sitesRMODERATECoalesceSQL}) AS `RMODERATE`,\n\t\t\tCOALESCE((yg_contentblocks_permissions.RCOMMENT), (yg_files_permissions.RCOMMENT) {$sitesRCOMMENTCoalesceSQL}) AS `RCOMMENT`,\n\n\t\t\tCOALESCE(yg_contentblocks_permissions.USERGROUPID, yg_files_permissions.USERGROUPID {$sitesUSERGROUPIDCoalesceSQL}) AS `USERGROUPID`\n\t\t\tFROM\n\t\t\tyg_comments AS c\n\n\t\t\tLEFT JOIN yg_comments_lnk_cb\n\t\t\t\tON (c.id = yg_comments_lnk_cb.commentid)\n\t\t\tLEFT JOIN yg_contentblocks_tree\n\t\t\t\tON (yg_contentblocks_tree.id = yg_comments_lnk_cb.oid)\n\n\t\t\tLEFT JOIN yg_comments_lnk_files\n\t\t\t\tON (c.id = yg_comments_lnk_files.commentid)\n\t\t\tLEFT JOIN yg_files_tree\n\t\t\t\tON (yg_files_tree.id = yg_comments_lnk_files.oid)\n\n\t\t\tLEFT JOIN yg_contentblocks_permissions\n\t\t\t\tON (yg_contentblocks_permissions.OID = yg_comments_lnk_cb.OID)\n\t\t\tLEFT JOIN yg_files_permissions\n\t\t\t\tON (yg_files_permissions.OID = yg_comments_lnk_files.OID)\n\n\t\t\t{$sitesJoinExpressionSQL}\n\t\t\tWHERE\n\t\t\t\t(1)\n\t\t\t{$filterWhere}\n\t\t\tGROUP BY\n\t\t\t\tc.ID\n\t\t\tHAVING\n\t\t\t\t(RREAD > 0)\n\t\t\t{$sitesUSERGROUPIDHavingSQL}\n\t\t\t{$filterHaving}\n\t\t\tORDER BY\n\t\t\tc.CREATEDTS {$filterOrder} {$filterLimit};";
$resultarray = $this->cacheExecuteGetArray($sql);
if ($resultarray === false) {
return ERROR_COMMENTS_UNKNOWN;
}
return $resultarray;
}