本文整理汇总了PHP中sCblockMgr函数的典型用法代码示例。如果您正苦于以下问题:PHP sCblockMgr函数的具体用法?PHP sCblockMgr怎么用?PHP sCblockMgr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sCblockMgr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onRender
public function onRender()
{
// get page
$page = $this->getPage();
// get tags assigned to this page
$tags = $page->tags->getAssigned();
$dynamicContent = array();
// loop through tags
for ($i = 0; $i < count($tags); $i++) {
// get all content blocks which got a tag assigned
$cbs = sCblockMgr()->tags->getByTag($tags[$i]['ID']);
for ($j = 0; $j < count($cbs); $j++) {
// instance content block object
$cb = sCblockMgr()->getCblock($cbs[$j]['OBJECTID']);
if ($cb) {
// get additional information like name and push it to the $dynamicContent
$info = $cb->get();
$cbs[$j] = array_merge($cbs[$j], $info);
/* optionally get the full content of each content block
gets slow if performed for a large number of content blocks
$cbs[$j]["CONTENT"] = $cb->getContent();*/
array_push($dynamicContent, $cbs[$j]);
}
}
}
// assign array
sSmarty()->assign("dynamicContent", $dynamicContent);
}
示例2: getCblockList
public function getCblockList($id = 0, $maxlevel = 0, $roleid = 0, $filterArray)
{
if ($filterArray[0]['CBID']) {
$limit = array('CBID' => $filterArray[0]['CBID']);
$coList = \sCblockMgr()->filterEntrymasks(false, $this->getFilter(), $limit, false);
} else {
$limit = array('FOLDER' => $id);
$coList = \sCblockMgr()->filterEntrymasks(false, $this->getFilter(), $limit, false);
}
// Get additional data for each formfield (and strip folders)
$finalCoList = array();
foreach ($coList as $coListItem) {
if ($coListItem['FOLDER'] == 0) {
// get last modifier
$history = \sCblockMgr()->history->getList($coListItem['CBID']);
if ($allMailingsItem['CHANGEDBY']) {
$userObj = new \user($history[0]['UID'] ? $history[0]['UID'] : $coListItem['CHANGEDBY']);
} else {
$userObj = new \user($history[0]['UID'] ? $history[0]['UID'] : $coListItem['CREATEDBY']);
}
$userInfo = $userObj->get();
$userProps = $userObj->properties->getValues($userInfo['ID']);
$userInfo['PROPS'] = $userProps;
// Get controls
$cb = new \Cblock($coListItem['CBID']);
$coListItem['ENTRYMASKS'] = $cb->getEntrymasks();
// Get additional control info
$col1Data = array(array('CO_NAME' => $coListItem['NAME'], 'FORMFIELD' => 101, 'OBJECTIDENTIFIER' => true));
$col2Data = array(array('USER_NAME' => trim($userInfo['PROPS']['FIRSTNAME'] . ' ' . $userInfo['PROPS']['LASTNAME']), 'USER_ID' => $userInfo['ID'], 'FORMFIELD' => 100));
$col3Data = array(array('CHANGEDTS' => TStoLocalTS($coListItem['CHANGEDTS']), 'FORMFIELD' => 103));
$result[0] = $col1Data;
$result[1] = $col2Data;
$result[2] = $col3Data;
$data = array('CBID' => $coListItem['CBID'], 'CBVERSION' => $coListItem['CBVERSION'], 'NAME' => $coListItem['NAME'], 'HASCHANGED' => $coListItem['HASCHANGED'], 'FIELDS' => $result, 'RREAD' => $coListItem['RREAD'], 'RWRITE' => $coListItem['RWRITE'], 'RDELETE' => $coListItem['RDELETE'], 'RSUB' => $coListItem['RSUB'], 'RSTAGE' => $coListItem['RSTAGE'], 'RMODERATE' => $coListItem['RMODERATE'], 'RCOMMENT' => $coListItem['RCOMMENT']);
array_push($finalCoList, $data);
}
}
if (!$filterArray[0]['CBID']) {
$pageDirOrderBy = $filterArray[1]['VALUE'];
$pageDirOrderDir = $filterArray[1]['VALUE2'];
if (strlen($pageDirOrderBy) && strlen($pageDirOrderDir)) {
$listColumns = $this->getListColumns();
usort($finalCoList, array('com\\nt\\DefaultCblockListView', $listColumns['COLUMNS'][$pageDirOrderBy]['SORTFUNC']));
if ($pageDirOrderDir == -1) {
$finalCoList = array_reverse($finalCoList);
}
}
$pageDirFrom = $filterArray[0]['VALUE'];
$pageDirCount = $filterArray[0]['VALUE2'];
if (strlen($pageDirFrom) && strlen($pageDirCount)) {
$finalCoList = array_slice($finalCoList, $pageDirFrom, $pageDirCount);
}
}
return $finalCoList;
}
示例3: process
public function process($objectId, $params)
{
$objectId = (int) $objectId;
$publishVersion = (int) $params['VERSION'];
$cb = sCblockMgr()->getCblock($objectId);
if ($cb) {
$objectInfo = $cb->get();
if (count($objectInfo) > 0) {
$cb->publishVersion($publishVersion);
// Add to history
if ($publishVersion != ALWAYS_LATEST_APPROVED_VERSION) {
$cb->history->add(HISTORYTYPE_CO, NULL, $publishVersion, 'TXT_CBLOCK_H_PUBLISH');
} else {
$lastfinalversion = $cb->getLatestApprovedVersion();
$cb->history->add(HISTORYTYPE_CO, NULL, $lastfinalversion, 'TXT_CBLOCK_H_PUBLISH');
}
return true;
} else {
return false;
}
}
}
示例4: getQueuedCommands
/**
* Function to get the queued commands from the history
*/
public function getQueuedCommands()
{
$entrymaskMgr = new Entrymasks();
$jsQueue = new JSQueue(NULL);
$tagMgr = new Tags();
$queuedCommands = array();
$currentQueueId = sGuiLH();
if (!$currentQueueId || $currentQueueId == 'false') {
return;
// if running first time (only)
//$currentQueueId = $jsQueue->getLastQueueId();
}
if ($currentQueueId) {
$queuedCommandsRaw = $jsQueue->getQueue($currentQueueId, sGuiUS());
$templateMgr = new Templates();
$viewMgr = new Views();
foreach ($queuedCommandsRaw as $queuedCommandRaw) {
// Check permissions
$permissionsObj = NULL;
$objectID = $queuedCommandRaw['OID'];
$siteID = $queuedCommandRaw['SITEID'];
$icons = new Icons();
$url = $imgurl = '';
switch ($queuedCommandRaw['TYPE']) {
case HISTORYTYPE_MAILING:
$mailingMgr = new MailingMgr();
$mailingObj = $mailingMgr->getMailing($objectID);
$permissionsObj = $mailingObj->permissions;
break;
case HISTORYTYPE_PAGE:
if ($siteID > 0 && $objectID > 0) {
$pageMgr = new PageMgr($siteID);
$pageObj = $pageMgr->getPage($objectID);
if ($pageObj) {
$url = $pageObj->getUrl();
$permissionsObj = $pageObj->permissions;
}
}
break;
case HISTORYTYPE_CO:
if (!$objectID) {
continue;
}
$cb = sCblockMgr()->getCblock($objectID);
$permissionsObj = $cb->permissions;
break;
case HISTORYTYPE_ENTRYMASK:
$permissionsObj = $entrymaskMgr->permissions;
break;
case HISTORYTYPE_FILE:
$permissionsObj = sFileMgr()->permissions;
if ($objectID) {
$file = sFileMgr()->getFile($objectID);
if ($file) {
$info = $file->get();
$url = sApp()->webroot . "download/" . $info['PNAME'] . "/";
$hiddenviews = $file->views->getHiddenViews();
foreach ($hiddenviews as $hiddenview) {
if ($hiddenview['IDENTIFIER'] == "YGSOURCE") {
$tmpviewinfo = $file->views->getGeneratedViewInfo($hiddenview['ID']);
if ($tmpviewinfo[0]['TYPE'] == FILE_TYPE_WEBIMAGE) {
$imgurl = sApp()->webroot . "image/" . $info['PNAME'] . "/";
}
}
}
}
}
break;
case HISTORYTYPE_TEMPLATE:
$permissionsObj = $templateMgr->permissions;
break;
case HISTORYTYPE_TAG:
$permissionsObj = $tagMgr->permissions;
break;
case HISTORYTYPE_SITE:
$pageMgr = new PageMgr($siteID);
$sitePages = $pageMgr->tree->get(0, 1);
$tmpPageID = $sitePages[0]["ID"];
if ($tmpPageID) {
$pageObj = $pageMgr->getPage($tmpPageID);
$permissionsObj = $pageObj->permissions;
}
break;
case HISTORYTYPE_USER:
$permissionsObj = sUsergroups()->usergroupPermissions;
break;
case HISTORYTYPE_USERGROUP:
case HISTORYTYPE_EXTERNAL:
case HISTORYTYPE_IMAGE:
case HISTORYTYPE_FILETYPES:
case HISTORYTYPE_FILEVIEWS:
case HISTORYTYPE_JSQUEUE:
case HISTORYTYPE_PERMISSION:
default:
break;
}
if ($queuedCommandRaw['TEXT'] == 'NOPERMISSIONCHECK' || strpos($queuedCommandRaw['OLDVALUE'], 'HIGHLIGHT') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'UNHIGHLIGHT') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_MOVE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_HIDE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_UNHIDE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'PAGE_ACTIVATE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'RELOAD_WINDOW') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'CLEAR_USERINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'SET_USERINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'CLEAR_FILEINFOS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'REFRESH_WINDOW') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'ADD_FILE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_DELETE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_ADD_TAG') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGECLASS') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGEPNAME') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGEBGIMAGE') === 0 || strpos($queuedCommandRaw['OLDVALUE'], 'OBJECT_CHANGE_LOCK_STATE') === 0) {
//.........这里部分代码省略.........
示例5: sGuiUS
$jsQueue->add($objectid, HISTORYTYPE_MAILING, 'HIGHLIGHT_MAILING', sGuiUS(), 'name');
// Add to history
$mailing->history->add(HISTORYTYPE_PAGE, NULL, $tagInfo[NAME], "TXT_TAG_H_REMOVE", $tag);
}
break;
}
break;
case 'orderObjectTag':
$objectid = $this->params['objectID'];
$objectType = $this->params['objectType'];
$siteID = $this->params['site'];
$taglist = $this->params['listArray'];
switch ($objectType) {
case 'cblock':
// For Contentblocks
$cb = sCblockMgr()->getCblock($objectid);
$cblockInfo = $cb->get();
for ($i = 0; $i < count($taglist); $i++) {
$cb->tags->setOrder($taglist[$i], $i);
}
// Add to history
$cb->history->add(HISTORYTYPE_CO, NULL, NULL, "TXT_TAG_H_TAGORDER", NULL);
break;
case 'file':
// For Files
// For Files
case 'filefolder':
$file = sFileMgr()->getFile($objectid);
$fileinfo = $file->get();
for ($i = 0; $i < count($taglist); $i++) {
$file->tags->setOrder($taglist[$i], $i);
示例6: addCblockLink
/**
* Assigns a Cblock to a specific Contentarea in this Mailing
*
* @param int $cbId Cblock Id
* @param string $contentarea Contentarea code
* @return int|false Link Id of the newly assigned Cblock or FALSE in case of an error
* @throws Exception
*/
function addCblockLink($cbId, $contentarea)
{
$mailingID = (int) $this->_id;
if ($this->permissions->checkInternal($this->_uid, $mailingID, "RWRITE")) {
$cbId = (int) $cbId;
$contentarea = sYDB()->escape_string(sanitize($contentarea));
// Check if contentblock is blind or not
$sql = "SELECT\n\t\t\t*, pv.*\n\t\t\tFROM (yg_contentblocks_properties, yg_contentblocks_tree)\n\t\t\tLEFT JOIN yg_contentblocks_propsv AS pv ON pv.OID = yg_contentblocks_properties.ID\n\t\t\tWHERE OBJECTID = {$cbId} AND yg_contentblocks_properties.OBJECTID = yg_contentblocks_tree.ID";
$ra = $this->cacheExecuteGetArray($sql);
if (count($ra) > 0 && $ra[0]['EMBEDDED'] == 1) {
// Blind contentblock
$tmpCblock = sCblockMgr()->getCblock($cbId);
$cbVersion = $tmpCblock->getVersion();
} else {
// Normal contentblock
$cbVersion = ALWAYS_LATEST_APPROVED_VERSION;
}
$version = (int) $this->getVersion();
$sql = "INSERT INTO `yg_mailing_lnk_cb`\n\t\t\t(`CBID`, `CBVERSION`, `PID`, `PVERSION`, `TEMPLATECONTENTAREA`)\n\t\t\tVALUES\n\t\t\t(?, ?, ?, ?, ?);";
$result = sYDB()->Execute($sql, $cbId, $cbVersion, $mailingID, $version, $contentarea);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$insertid = sYDB()->Insert_ID();
$this->markAsChanged();
return $insertid;
} else {
return false;
}
}
示例7: switch
}
}
$co['ALLOWED'] = true;
if ($childNotAllowed) {
$co['ALLOWED'] = false;
}
$output[] = $co;
$loop++;
}
}
}
if ($siteID && $pageID && $siteID != 'dummy' && $pageID != 'dummy' && $siteID != 'cblock_copy' && $pageID != 'cblock_copy') {
switch ($siteID) {
case 'cblock':
// For contentblocks
$contentblockMgr = sCblockMgr();
$page = $contentblockMgr->getCblock($pageID);
// Get current locks for this token (and unlock them)
$lockToken = sGuiUS() . '_' . $this->request->parameters['win_no'];
$lockedObjects = $contentblockMgr->getLocksByToken($lockToken);
foreach ($lockedObjects as $lockedObject) {
$currentObject = $contentblockMgr->getCblock($lockedObject['OBJECTID']);
$currentObject->releaseLock($lockedObject['TOKEN']);
}
break;
case 'file':
// For files
$fileMgr = sFileMgr();
$page = $fileMgr->getFile($pageID);
// Get current locks for this token (and unlock them)
$lockToken = sGuiUS() . '_' . $this->request->parameters['win_no'];
示例8: sCblockMgr
$cb = sCblockMgr()->getCblock($contentblockID);
$cblockInfo = $cb->get();
if ($contentblockID > 0) {
$cb = sCblockMgr()->getCblock($contentblockID);
$targetcb = sCblockMgr()->getCblock($target_co);
// Get original order of controls
$co_oldlink_info = $targetcb->getEntrymasks();
$co_oldlinks = array();
foreach ($co_oldlink_info as $co_oldlink_info_item) {
array_push($co_oldlinks, $co_oldlink_info_item['LINKID']);
}
$co_controllinks = $cb->getEntrymasks();
$new_controls = array();
foreach ($co_controllinks as $co_controllink) {
$controlinfo = sCblockMgr()->getCblockLinkByEntrymaskLinkId($co_controllink['LINKID']);
$lcb = sCblockMgr()->getCblock($controlinfo['CBLOCKID']);
$new_control = $targetcb->addEntrymask($controlinfo['ENTRYMASK']);
array_push($new_controls, $new_control);
$controlFormfields = $lcb->getFormfieldsInternal($co_controllink['LINKID']);
// Get Formfields for control
$controlFormfields_new = $targetcb->getFormfieldsInternal($new_control);
for ($c = 0; $c < count($controlFormfields); $c++) {
$formfield = $controlFormfields[$c]['FORMFIELD'];
$targetcb->setFormfield($controlFormfields_new[$c]['LINKID'], $controlFormfields[$c]['VALUE01'], $controlFormfields[$c]['VALUE02'], $controlFormfields[$c]['VALUE03'], $controlFormfields[$c]['VALUE04'], $controlFormfields[$c]['VALUE05'], $controlFormfields[$c]['VALUE06'], $controlFormfields[$c]['VALUE07'], $controlFormfields[$c]['VALUE08']);
}
// Change the id in the $newcolist array
foreach ($newcolists[0] as $idx => $item) {
if ($item[0] == $moved_co) {
$newcolists[0][$idx][0] = $target_co;
$newcolists[0][$idx][1] = $new_control;
}
示例9: User
$user = new User(sUserMgr()->getCurrentUserID());
// Last changes from pages per site into an array
$lastchanges['PAGES'] = array();
$startx = 0;
for ($i = 0; $i < count($sites); $i++) {
$msites[] = $sites[$i];
$PageMgr = sPageMgr($sites[$i]["ID"]);
$changeslist = $PageMgr->history->getLastChange(HISTORYTYPE_PAGE, $sites[$i]["ID"]);
for ($x = $startx; $x < count($changeslist) + $startx; $x++) {
$lastchanges['PAGES'][$x] = $changeslist[$x - $startx];
$lastchanges['PAGES'][$x]['SITE'] = $sites[$i]['ID'];
}
$startx = $x;
}
// Last changes from content, files, mailings and comments
$lastchanges['CONTENT'] = sCblockMgr()->history->getLastChange(HISTORYTYPE_CO);
$fileMgr = sFileMgr();
$lastchanges['FILES'] = $fileMgr->history->getLastChange(HISTORYTYPE_FILE);
$mailingMgr = new MailingMgr();
$lastchanges['MAILING'] = $mailingMgr->history->getLastChange(HISTORYTYPE_MAILING);
/*
$commentMgr = new Comments();
$lastchanges['COMMENT'] = $commentMgr->getAllComments( $filterArray, $pageDirLimit );
*/
// Enrich information for pages, content, files, mailing
foreach (array('PAGES', 'CONTENT', 'FILES', 'MAILING') as $item) {
foreach ($lastchanges[$item] as $lastchanges_idx => $lastchanges_item) {
$lastchanges[$item][$lastchanges_idx]['DATETIME'] = TStoLocalTS($lastchanges_item['DATETIME']);
$user = new User($lastchanges_item['UID']);
$userinfo = $user->get();
if ($userinfo['ID']) {
示例10: sCblockMgr
if ($objectID) {
$cblock = sCblockMgr()->getCblock($objectID);
$cblockInfo = $cblock->get();
$cblockInfo['RWRITE'] = $cblock->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE");
$cblockInfo['RSTAGE'] = $cblock->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RSTAGE");
if ($cblockInfo['DELETED']) {
$cblockInfo['RWRITE'] = false;
$cblockInfo['READONLY'] = true;
$cblockInfo['RSTAGE'] = false;
}
// Get current locks for this token (and unlock them)
$lockToken = sGuiUS() . '_' . $this->request->parameters['win_no'];
$lockedObjects = sCblockMgr()->getLocksByToken($lockToken);
foreach ($lockedObjects as $lockedObject) {
if ($lockedObject['OBJECTID']) {
$currentObject = sCblockMgr()->getCblock($lockedObject['OBJECTID']);
$currentObject->releaseLock($lockedObject['TOKEN']);
}
}
// Check for lock, and lock if not locked
$lockStatus = $cblock->getLock();
if ($lockStatus['LOCKED'] == 0) {
$lockedFailed = !$cblock->acquireLock($lockToken);
} else {
$lockedFailed = true;
}
$all_cblock_extensions = $extensionMgr->getList(EXTENSION_CBLOCK, true);
$used_extensions = array();
$used_extensions_info = array();
foreach ($all_cblock_extensions as $all_cblock_extension) {
$extension = $extensionMgr->getExtension($all_cblock_extension["CODE"]);
示例11: JSQueue
$refresh = $this->params['refresh'];
$target_id = $this->params['targetId'];
$target_pos = $this->params['targetPosition'];
$objectInfo = $extensionMgr->get($extension);
if ($objectInfo["CODE"]) {
$extension = $extensionMgr->getExtension($objectInfo["CODE"]);
if ($extension) {
$jsQueue = new JSQueue(NULL);
switch ($siteID) {
case 'cblock':
$addFunc = 'addToCBlock';
$isUsedFunc = 'usedByCblock';
$historySuffix = 'CBLOCK';
$historyType = HISTORYTYPE_CO;
$extensionType = EXTENSION_CBLOCK;
$cblock = sCblockMgr()->getCblock($pageID);
$pageInfo = $cblock->get();
$object = $cblock;
break;
case 'file':
$addFunc = 'addToFile';
$isUsedFunc = 'usedByFile';
$historyType = HISTORYTYPE_FILE;
$extensionType = EXTENSION_FILE;
$fileMgr = sFileMgr();
$file = $fileMgr->getFile($pageID);
$pageInfo = $file->get();
$object = $file;
break;
case 'mailing':
$addFunc = 'addToMailing';
示例12: sumchanges_new
function sumchanges_new($newchangeslist)
{
for ($i = 0; $i < count($newchangeslist); $i++) {
if ($newchangeslist[$i]['TYPE'] == HISTORYTYPE_PAGE) {
if ($newchangeslist[$i]["SITEID"] && $newchangeslist[$i]["OID"]) {
try {
$PageMgr = new PageMgr($newchangeslist[$i]["SITEID"]);
$page = $PageMgr->getPage($newchangeslist[$i]["OID"]);
if ($page) {
$oidinfo = $page->get();
$name = $oidinfo["NAME"];
}
} catch (Exception $ex) {
}
}
}
if ($newchangeslist[$i]['TYPE'] == HISTORYTYPE_CO) {
try {
$cb = sCblockMgr()->getCblock($newchangeslist[$i]["OID"]);
if ($cb) {
$oidinfo = $cb->get();
$name = $oidinfo["NAME"];
}
} catch (Exception $ex) {
}
}
if ($newchangeslist[$i]['TYPE'] == HISTORYTYPE_FILE) {
try {
$file = sFileMgr()->getFile($newchangeslist[$i]["OID"]);
if ($file) {
$oidinfo = $file->get();
$name = $oidinfo["NAME"];
}
} catch (Exception $ex) {
}
}
if ($newchangeslist[$i]['TYPE'] == HISTORYTYPE_MAILING) {
try {
$mailing = sMailingMgr()->getMailing($newchangeslist[$i]["OID"]);
if ($mailing) {
$oidinfo = $mailing->get();
$name = $oidinfo["NAME"];
}
} catch (Exception $ex) {
}
}
if (strlen($name) > 0) {
$changeslist[$i] = $newchangeslist[$i];
$changeslist[$i]["NAME"] = $name;
}
}
return $changeslist;
}
示例13: getLastChanges
/**
* Gets n last History entries
*
* @param int $max (optional) Maximum number of entries
* @param string|array $text (optional) One or multiple text filters
* @return array List of History entries
* @throws Exception
*/
function getLastChanges($max = 8, $text = '')
{
$max = (int) $max;
$tmpTableName = 'TMP_' . strtoupper(sApp()->request->parameters['us']) . '_' . rand() . '_HISTORY';
$sql = "DROP TEMPORARY TABLE IF EXISTS `{$tmpTableName}`;";
$result = sYDB()->Execute($sql);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$sql = "CREATE TEMPORARY TABLE `{$tmpTableName}` (\n\t\t\t\t\t`ID` int(11) NOT NULL,\n\t\t\t\t\t`SOURCEID` varchar(20) NOT NULL,\n\t\t\t\t\t`OID` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t`DATETIME` int(11) DEFAULT NULL,\n\t\t\t\t\t`TEXT` text NOT NULL,\n\t\t\t\t\t`UID` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t`TYPE` int(11) NOT NULL,\n\t\t\t\t\t`TARGETID` int(11) NOT NULL,\n\t\t\t\t\t`OLDVALUE` text NOT NULL,\n\t\t\t\t\t`NEWVALUE` text NOT NULL,\n\t\t\t\t\t`SITEID` int(11) NOT NULL,\n\t\t\t\t\t`FROM` int(11) DEFAULT '0',\n\t\t\t\t\t`TYPE_OID` int(11) DEFAULT NULL,\n\t\t\t\t\tPRIMARY KEY (`ID`),\n\t\t\t\t\tKEY `OID` (`OID`)\n\t\t\t\t);";
$result = sYDB()->Execute($sql);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$sqlargs = array();
if (!is_array($text) && strlen($text) > 1) {
$wheresql .= "TEXT=?";
array_push($sqlargs, $text);
} else {
if (is_array($text) && count($text) > 0) {
for ($t = 0; $t < count($text); $t++) {
$wheresql .= "TEXT = ? ";
array_push($sqlargs, $text[$t]);
if ($t < count($text) - 1) {
$wheresql .= " OR ";
}
}
} else {
$wheresql .= "1";
}
}
if ($this->_sourceid != "") {
$sourcesql = "AND SOURCEID = ?";
array_push($sqlargs, $this->_sourceid);
}
$sql = "INSERT INTO `{$tmpTableName}`\n\t\t\t\tSELECT\n\t\t\t\t\t*,\n\t\t\t\t\t((TYPE *1000000) + OID) AS `TYPE_OID`\n\t\t\t\tFROM " . $this->_table . "\n\t\t\t\tWHERE {$wheresql} {$sourcesql}\n\t\t\t\tORDER BY `DATETIME` DESC\n\t\t\t\tLIMIT 0, 2000;";
array_unshift($sqlargs, $sql);
$dbr = call_user_func_array(array(sYDB(), 'Execute'), $sqlargs);
if ($dbr === false) {
throw new Exception(sYDB()->ErrorMsg());
}
// Get folder for embedded cblocks
$embeddedCblockFolder = (int) sConfig()->getVar('CONFIG/EMBEDDED_CBLOCKFOLDER');
// Remove all embedded Cblocks from temporary table
$sql = "DELETE\n\t\t\t\tFROM\n\t\t\t\t\t`{$tmpTableName}`\n\t\t\t\tUSING\n\t\t\t\t\t`{$tmpTableName}`\n\t\t\t\tINNER JOIN\n\t\t\t\t\t`yg_contentblocks_tree`\n\t\t\t\tWHERE\n\t\t\t\t\t(`{$tmpTableName}`.OID = `yg_contentblocks_tree`.ID) AND\n\t\t\t\t\t(`yg_contentblocks_tree`.PARENT = " . $embeddedCblockFolder . ") AND\n\t\t\t\t\t(TYPE = " . HISTORYTYPE_CO . ");";
$result = sYDB()->Execute($sql);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$sql = "SELECT *, (SELECT\n\t\t\t\t\t\tMAX(`DATETIME`)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t" . $this->_table . " AS `h2`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`h2`.`OID` = `lft`.`OID`) AS `MAXDATETIME`\n\t\t\t\tFROM `{$tmpTableName}` AS `lft`\n\t\t\t\tGROUP BY `TYPE_OID`\n\t\t\t\tORDER BY `DATETIME` DESC\n\t\t\t\tLIMIT 0, {$max};";
$result = sYDB()->Execute($sql);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
$resultarray = $result->GetArray();
for ($i = 0; $i < count($resultarray); $i++) {
$oid = $resultarray[$i]['OID'];
$rread = false;
if ($this->permissions == NULL) {
if ($resultarray[$i]['SITEID'] && $resultarray[$i]['TYPE'] == HISTORYTYPE_PAGE) {
$tmpPageMgr = new PageMgr($resultarray[$i]['SITEID']);
if ($tmpPageMgr->permissions->checkInternal($this->_uid, $oid, "RREAD")) {
$rread = true;
}
}
if ($resultarray[$i]['TYPE'] == HISTORYTYPE_CO) {
if (sCblockMgr()->permissions->checkInternal($this->_uid, $oid, "RREAD")) {
$rread = true;
}
}
if ($resultarray[$i]['TYPE'] == HISTORYTYPE_FILE) {
if (sFileMgr()->permissions->checkInternal($this->_uid, $oid, "RREAD")) {
$file = sFileMgr()->getFile($oid);
if ($file) {
$fileinfo = $file->get();
if ($fileinfo["FOLDER"] == 0) {
$rread = true;
}
}
}
}
} else {
if ($this->permissions->checkInternal($this->_uid, $oid, "RREAD")) {
$rread = true;
}
}
if ($rread) {
if ($resultarray[$i]['TYPE'] == HISTORYTYPE_CO) {
$tmpCblock = sCblockMgr()->getCblock($resultarray[$i]['OID']);
if ($tmpCblock) {
$tmpCblockInfo = $tmpCblock->get();
$embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER");
//.........这里部分代码省略.........
示例14: setDefaultPermissions
/**
* Sets the default permissions for Objects without an Admin
*
* @param int $usergroupId Usergroup Id
* @return bool TRUE on success or FALSE in case of an error
*/
function setDefaultPermissions($usergroupId)
{
// For Templates
$templateMgr = new Templates();
$allTemplates = $templateMgr->getList();
$permissionList = array();
foreach ($allTemplates as $allTemplate) {
$permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allTemplate['ID'], 'USERGROUPID' => $usergroupId);
}
$templateMgr->permissions->setPermissions($permissionList);
// For Views
$viewMgr = new Views();
$allViews = $viewMgr->getList();
$permissionList = array();
foreach ($allViews as $allView) {
$permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allView['ID'], 'USERGROUPID' => $usergroupId);
}
$viewMgr->permissions->setPermissions($permissionList);
// For Entrymasks
$entrymaskMgr = new Entrymasks();
$allEntrymasks = $entrymaskMgr->getList();
$permissionList = array();
foreach ($allEntrymasks as $allEntrymask) {
$permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'RDELETE' => 1, 'OID' => $allEntrymask['ID'], 'USERGROUPID' => $usergroupId);
}
$entrymaskMgr->permissions->setPermissions($permissionList);
// For Cblock blindfolder
$embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER");
$permissionList = array();
$permissionList[] = array('RREAD' => 1, 'RSUB' => 1, 'RWRITE' => 1, 'OID' => $embeddedCblockFolder, 'USERGROUPID' => $usergroupId);
sCblockMgr()->permissions->setPermissions($permissionList);
// Remove rights for Cblock root node
$cblockRootNodeId = sCblockMgr()->tree->getRoot();
$permissionList = array();
$permissionList[] = array('RREAD' => 0, 'RSUB' => 0, 'RWRITE' => 0, 'RDELETE' => 0, 'OID' => $cblockRootNodeId, 'USERGROUPID' => $usergroupId);
sCblockMgr()->permissions->setPermissions($permissionList);
}
示例15: sCblockMgr
if ($tmpFile) {
$fileInfo = $tmpFile->get();
$objectdynprops[$objectdynprops_cnt]['FILETITLE'] = $fileInfo['NAME'];
$objectdynprops[$objectdynprops_cnt]['FILECOLOR'] = $fileInfo['COLOR'];
$objectdynprops[$objectdynprops_cnt]['FILEIDENTIFIER'] = $fileInfo['IDENTIFIER'];
$objectdynprops[$objectdynprops_cnt]['FILEABBREVIATION'] = $fileInfo['ABBREVIATION'];
}
}
}
if ($object_property['TYPE'] == 'TAG') {
$tagInfo = $tagMgr->get($objectdynprops[$objectdynprops_cnt]['VALUE']);
$objectdynprops[$objectdynprops_cnt]['TAGTITLE'] = $tagInfo['NAME'];
}
if ($object_property['TYPE'] == 'CBLOCK') {
if ($objectdynprops[$objectdynprops_cnt]['VALUE']) {
$tmpCb = sCblockMgr()->getCblock($objectdynprops[$objectdynprops_cnt]['VALUE']);
if ($tmpCb) {
$cblockInfo = $tmpCb->get();
$objectdynprops[$objectdynprops_cnt]['CBLOCKTITLE'] = $cblockInfo['NAME'];
}
}
}
if ($object_property['TYPE'] == 'PAGE') {
if ($objectdynprops[$objectdynprops_cnt]['VALUE']['site'] && $objectdynprops[$objectdynprops_cnt]['VALUE']['page']) {
$pageMgr = new PageMgr($objectdynprops[$objectdynprops_cnt]['VALUE']['site']);
$currPage = $pageMgr->getPage($objectdynprops[$objectdynprops_cnt]['VALUE']['page']);
$pageInfo = $currPage->get();
$objectdynprops[$objectdynprops_cnt]['PAGETITLE'] = $pageInfo['NAME'];
}
}
if ($object_property['TYPE'] == 'DATETIME' || $object_property['TYPE'] == 'DATE') {