本文整理汇总了PHP中sFileMgr函数的典型用法代码示例。如果您正苦于以下问题:PHP sFileMgr函数的具体用法?PHP sFileMgr怎么用?PHP sFileMgr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sFileMgr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process($objectid, $params)
{
$view = $params["VIEW"];
$fileMgr = sFileMgr();
$view = $fileMgr->views->get($view["ID"]);
$fileinfo = $params["FILEINFO"];
$filedir = getrealpath(getcwd() . "/" . sConfig()->getVar('CONFIG/DIRECTORIES/FILESDIR')) . "/";
$filename = $fileinfo['OBJECTID'] . '-' . $fileinfo['VIEWVERSION'] . $fileinfo['FILENAME'];
$file = $filedir . $filename;
$imgsize = getimagesize($file);
$info = $this->generateThumbnail($filename, $imgsize, $view['IDENTIFIER'], $view['WIDTH'], $view['HEIGHT'], $filedir, $file, $view['CONSTRAINWIDTH'], $view['CONSTRAINHEIGHT'], $view['WIDTHCROP'], $view['HEIGHTCROP']);
if ($info) {
$file = new File($fileinfo['OBJECTID'], $fileinfo['VERSION']);
$file->views->addGenerated($view["ID"], $info["WIDTH"], $info["HEIGHT"], $info["VIEWTYPE"]);
}
return true;
}
示例2: explode
$confirmed = $this->params['confirmed'];
$positive = $this->params['positive'];
$objectYGID = explode('-', $objectYGID);
$siteID = $objectYGID[1];
$objectID = $objectYGID[0];
switch ($objectType) {
case 'page':
$pageMgr = new PageMgr($siteID);
$page = $pageMgr->getPage($objectID);
$objectInfo = $page->get();
$commentsObject = $page->comments;
$historyObject = $page->history;
$historyType = HISTORYTYPE_PAGE;
break;
case 'file':
$file = sFileMgr()->getFile($objectID);
$objectInfo = $file->get();
$commentsObject = $file->comments;
$historyObject = $file->history;
$historyType = HISTORYTYPE_FILE;
break;
case 'cblock':
$cb = sCblockMgr()->getCblock($objectID);
$objectInfo = $cb->get();
$commentsObject = $cb->comments;
$historyObject = $cb->history;
$historyType = HISTORYTYPE_CO;
break;
}
$hadError = false;
$errorCode = NULL;
示例3: sGuiUS
$tp2[$p]['ID'] = $tinfo['ID'];
$tp2[$p]['NAME'] = $tinfo['NAME'];
}
$tp2[count($tp2) - 1]['NAME'] = $itext['TXT_TAGS'] != '' ? $itext['TXT_TAGS'] : '$TXT_TAGS';
$tags[$t]['PARENTS'] = $tp2;
}
$fileinfo['TAGS'] = $tags;
$jsQueue->add($id, HISTORYTYPE_FILE, 'OBJECT_DELETE', sGuiUS(), 'file', NULL, NULL, $id . '-file', 'name');
$jsQueue->add($id, HISTORYTYPE_FILE, 'ADD_FILE', sGuiUS(), NULL);
$jsQueue->add($id, HISTORYTYPE_FILE, 'CLEAR_REFRESH', sGuiUS(), 'file');
} else {
// replace view
$version = (int) $version;
$versions = false;
$zoom = $zoom * 100;
$file = sFileMgr()->getFile($id, $version);
if ($file) {
$views = $file->views->getAssigned();
for ($i = 0; $i < count($views); $i++) {
if ($views[$i]["IDENTIFIER"] == $view) {
$viewinfo = $views[$i];
}
}
$params = array();
$params["FILEINFO"] = $fileinfo;
$params["VIEW"] = $viewinfo;
$params["FROMTMPFILE"] = $filetmpname;
//copy($filetmpname, $filedir.$viewinfo["IDENTIFIER"].$fileinfo['OBJECTID'].'-'.$fileinfo['VIEWVERSION'].$filename);
$moduleclass->process($fileinfo['OBJECTID'], $params);
//$info = $moduleclass->generateThumbnail($fileinfo['OBJECTID'].'-'.$fileinfo['VIEWVERSION'].$fileinfo['FILENAME'], 0, $viewinfo['IDENTIFIER'], $viewinfo['WIDTH'], $viewinfo['HEIGHT'], $filedir, $filetmpname, $viewinfo['CONSTRAINWIDTH'], $viewinfo['CONSTRAINHEIGHT'], $viewinfo['WIDTHCROP'], $viewinfo['HEIGHTCROP'] );
//$file->views->addGenerated($viewinfo["ID"], $info["WIDTH"], $info["HEIGHT"], FILE_TYPE_WEBIMAGE);
示例4: str_replace
$value = str_replace("\r", '', str_replace("\n", '\\n', $this->reponsedata[$property]->value));
if ($oldname == $value) {
// No update needed, henceforth break
break;
}
// Check for empty name
if (trim($value) == '') {
//$jsQueue->add ($data[0], HISTORYTYPE_ENTRYMASK, 'OBJECT_CHANGE', sGuiUS(), 'entrymask', NULL, NULL, $this->reponsedata[$property]->yg_id, 'name', $oldvalue);
//$jsQueue->add ($data[0], HISTORYTYPE_FILE, 'REFRESH_WINDOW', sGuiUS(), 'name');
$koala->alert($itext['TXT_CANT_CHANGE_ENTRYMASKTITLE_TO_EMPTY_VALUE']);
break;
}
// Special handling for files
if ($propertyInfo[0]['TYPE'] == 'FILE') {
if (substr($value, 0, 7) == '/image/') {
$realValue = sFileMgr()->getFileIdByPname(substr($value, 7));
if ($realValue) {
$value = $realValue;
}
}
}
// Special handling for links
if ($propertyInfo[0]['TYPE'] == 'LINK') {
$value = trim(prettifyUrl($value));
$result = checkLinkInternalExternal($value);
if ($result['TYPE'] != 'external') {
$value = createSpecialURLfromShortURL($value);
}
}
// Special handling for textareas
if ($propertyInfo[0]['TYPE'] == 'TEXTAREA') {
示例5: sCblockMgr
if ($cb) {
$base = $cb->get();
$maxlevels = $base['LEVEL'] + 2;
$objects = sCblockMgr()->getList($obj_id, array('SUBNODES'), $maxlevels, $roleid);
$objects = sCblockMgr()->getAdditionalTreeInfo(false, $objects);
// Check if the folder for blind contentblocks already exists and create it if it doesn't exist
$embeddedCblockFolder = (int) sConfig()->getVar("CONFIG/EMBEDDED_CBLOCKFOLDER");
$smarty->assign("embeddedCblockFolder", $embeddedCblockFolder);
}
sUserMgr()->unimpersonate();
break;
case 'files':
sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
$filetypeMgr = new Filetypes();
$objects = sFileMgr()->getList($obj_id, array('SUBNODES'), 'group2.LFT', $maxlevels, $roleid);
$objects = sFileMgr()->getAdditionalTreeInfo(false, $objects);
$filetypes = $filetypeMgr->getList();
foreach ($objects as $objects_idx => $objects_item) {
foreach ($filetypes as $filetypes_item) {
if ($objects_item['FILETYPE'] == $filetypes_item['OBJECTID']) {
$objects[$objects_idx]['TYPEINFO'] = $filetypes_item;
}
}
}
sUserMgr()->unimpersonate();
break;
case 'tags':
sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
$tagMgr = new Tags();
$objects = $tagMgr->getList($obj_id, array('SUBNODES'), true, $maxlevels, $roleid);
$objects = $tagMgr->getAdditionalTreeInfo(false, $objects);
示例6: sCblockMgr
// Add to history
$myObject->history->add($historyType, $contentarea, $cblockInfo['NAME'], 'TXT_' . $historyStr . '_H_COADD', $contentblockID);
for ($i = 0; $i < count($contentareas); $i++) {
if ($contentareas[$i]['CODE'] == $contentarea) {
$colist = $myObject->getCblockList($contentareas[$i]['CODE']);
for ($x = 0; $x < count($colist); $x++) {
$coid = $colist[$x]['OBJECTID'];
$lcb = sCblockMgr()->getCblock($coid, $colist[$x]['VERSION']);
if ($coid > 0) {
$colist[$x]['CBVERSION'] = $colist[$x]['VERSION'];
$colist[$x]['ENTRYMASKS'] = $lcb->getEntrymasks();
for ($c = 0; $c < count($colist[$x]['ENTRYMASKS']); $c++) {
$controlFormfields = $lcb->getFormfieldsInternal($colist[$x]['ENTRYMASKS'][$c]['LINKID']);
for ($w = 0; $w < count($controlFormfields); $w++) {
if ($controlFormfields[$w]['FORMFIELD'] == 6 || $controlFormfields[$w]['FORMFIELD'] == 16) {
$file = sFileMgr()->getFile($controlFormfields[$w]['VALUE01']);
if ($file) {
$fileInfo = $file->get();
$controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
}
}
if ($controlFormfields[$w]['FORMFIELD'] == 7) {
$clcb = sCblockMgr()->getCblock($controlFormfields[$w]['VALUE01']);
if ($clcb) {
$info = $clcb->get();
$controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
}
}
if ($controlFormfields[$w]['FORMFIELD'] == 8) {
$info = $myObject->tags->get($controlFormfields[$w]['VALUE01']);
$controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
示例7: getStyleForContentblock
if ($acb) {
$assignedComments[$assignedCommentIdx]['CBLOCKINFO'] = $acb->get();
$assignedComments[$assignedCommentIdx]['CBLOCKINFO']['RWRITE'] = $acb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], "RWRITE");
$assignedComments[$assignedCommentIdx]['CBLOCKINFO']['RDELETE'] = $acb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], "RDELETE");
$styleData = getStyleForContentblock($assignedComments[$assignedCommentIdx]['CBLOCKINFO']);
$assignedComments[$assignedCommentIdx]['STYLE'] = $styleData;
$assignedComments[$assignedCommentIdx]['HASCHANGED'] = $assignedComments[$assignedCommentIdx]['CBLOCKINFO']['HASCHANGED'];
$assignedComments[$assignedCommentIdx]['RMODERATE'] = $acb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], 'RMODERATE');
$assignedComments[$assignedCommentIdx]['RCOMMENT'] = $acb->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], 'RCOMMENT');
$commentsObject = $acb->comments;
}
break;
case 'FILE':
$assignedComments[$assignedCommentIdx]['PARENTS'] = $fileMgr->getParents($assignedComment['OBJECTID']);
array_pop($assignedComments[$assignedCommentIdx]['PARENTS']);
$file = sFileMgr()->getFile($assignedComment['OBJECTID']);
if ($file) {
$assignedComments[$assignedCommentIdx]['FILEINFO'] = $file->get();
$assignedComments[$assignedCommentIdx]['RMODERATE'] = $file->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], 'RMODERATE');
$assignedComments[$assignedCommentIdx]['RCOMMENT'] = $file->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $assignedComment['OBJECTID'], 'RCOMMENT');
$commentsObject = $file->comments;
}
break;
}
if ($assignedComments[$assignedCommentIdx]['CREATEDTS']) {
$assignedComments[$assignedCommentIdx]['CREATEDTS'] = TStoLocalTS($assignedComments[$assignedCommentIdx]['CREATEDTS']);
$assignedComments[$assignedCommentIdx]['CHANGEDTS'] = TStoLocalTS($assignedComments[$assignedCommentIdx]['CHANGEDTS']);
}
$assignedComments[$assignedCommentIdx]['STATUS'] = $commentsObject->getStatus($assignedComment['OBJECTID']);
}
} else {
示例8: postProcessValue
/**
* Post processes a property value (resolves urls, permanent names, etc.)
*
* @param string $type Property type
* @param string $value Property value
* @return mixed Post processed property value
*/
function postProcessValue($type, $value)
{
switch ($type) {
case 'LINK':
$linkInfo = checkLinkInternalExternal(resolveSpecialURL($value));
if ($linkInfo['TYPE'] == 'internal') {
return resolveSpecialURL($linkInfoJSON['href']);
} elseif ($linkInfo['TYPE'] == 'file') {
$pname = sFileMgr()->getPNameByFileId($linkInfo['INFO']['FILE_ID']);
if ($pname) {
return sApp()->webroot . 'download/' . $pname;
}
} else {
if ($value != '') {
return $value;
} else {
return NULL;
}
}
case 'PAGE':
$pageInfo = json_decode($value, true);
$tmpPageMgr = sPageMgr($pageInfo['site']);
$tmpPage = $tmpPageMgr->getPage($pageInfo['page']);
if ($tmpPage) {
$tmpUrl = $tmpPage->getUrl();
$tmpPname = $tmpPageMgr->getPNameByPageId($pageInfo['page']);
return array('SITE_ID' => $pageInfo['site'], 'PAGE_ID' => $pageInfo['page'], 'URL' => $tmpUrl, 'PNAME' => $tmpPname, 'VALUE' => $value);
} else {
return NULL;
}
case 'FILE':
$pname = sFileMgr()->getPNameByFileId($value);
if ($pname) {
return array('FILE_ID' => $value, 'URL' => sApp()->webroot . 'download/' . $pname, 'IMAGE_URL' => sApp()->webroot . 'image/' . $pname, 'PNAME' => $pname, 'VALUE' => $value);
} else {
return NULL;
}
case 'RICHTEXT':
return replaceSpecialURLs($value);
break;
case 'CBLOCK':
$pname = sCblockMgr()->getPNameByCblockId($value);
if ($pname) {
return array('CBLOCK_ID' => $value, 'PNAME' => $pname, 'VALUE' => $value);
} else {
return NULL;
}
case 'TAG':
$tagInfo = sTags()->get($value);
if ($tagInfo) {
return array('TAG_ID' => $value, 'NAME' => $tagInfo['NAME'], 'VALUE' => $value);
} else {
return NULL;
}
default:
return $value;
}
}
示例9: File
case 'filefolder':
$file = new File($objectID);
$latestFinalVersion = $file->getLatestApprovedVersion();
$file = new File($objectID, $latestFinalVersion);
$objectInfo = $file->get();
$tags = $file->tags->getAssigned();
$object_permissions = array();
$object_permissions['RWRITE'] = $file->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE");
$object_permissions['READONLY'] = !$file->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectID, "RWRITE");
if ($objectInfo['DELETED'] == 1) {
$object_permissions['RWRITE'] = false;
$object_permissions['READONLY'] = true;
}
// Get current locks for this token (and unlock them)
$lockToken = sGuiUS() . '_' . $this->request->parameters['win_no'];
$lockedObjects = sFileMgr()->getLocksByToken($lockToken);
foreach ($lockedObjects as $lockedObject) {
$currentObject = new File($lockedObject['OBJECTID']);
$currentObject->releaseLock($lockedObject['TOKEN']);
}
// Check for lock, and lock if not locked
$lockStatus = $file->getLock();
if ($lockStatus['LOCKED'] == 0) {
$lockedFailed = !$file->acquireLock($lockToken);
} else {
$lockedFailed = true;
}
for ($i = 0; $i < count($tags); $i++) {
$myparents = $file->tags->tree->getParents($tags[$i]['ID']);
$parents = array();
for ($p = 0; $p < count($myparents) - 1; $p++) {
示例10: sFileMgr
$latestVersion = $file->getLatestApprovedVersion();
$file = sFileMgr()->getFile($fileID, $latestVersion);
$fileInfo = $file->get();
$url = $file->getUrl();
$fileTypes = $fileMgr->getFiletypes();
$fileInfo['RDELETE'] = $file->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $fileID, 'RDELETE');
$fileInfo['RWRITE'] = $file->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $fileID, 'RWRITE');
if ($fileInfo['DELETED'] == 1) {
$fileInfo['RDELETE'] = false;
$fileInfo['RWRITE'] = false;
}
// Get current locks for this token (and unlock them)
$lockToken = sGuiUS() . '_' . $this->request->parameters['win_no'];
$lockedObjects = $fileMgr->getLocksByToken($lockToken);
foreach ($lockedObjects as $lockedObject) {
$currentObject = sFileMgr()->getFile($lockedObject['OBJECTID']);
$currentObject->releaseLock($lockedObject['TOKEN']);
}
// Check for lock, and lock if not locked
$lockStatus = $file->getLock();
if ($lockStatus['LOCKED'] == 0) {
$lockedFailed = !$file->acquireLock($lockToken);
} else {
$lockedFailed = true;
}
$views = $file->views->getAssigned(true);
$viewInfo = $file->views->getGeneratedViewInfo($views[0]["ID"]);
$fileInfo['WIDTH'] = $viewInfo[0]["WIDTH"];
$fileInfo['HEIGHT'] = $viewInfo[0]["HEIGHT"];
foreach ($fileTypes as $fileTypes_item) {
if ($fileTypes_item['ID'] == $fileInfo['FILETYPE']) {
示例11: elseif
if ($refinfo["OBJECTID"] < 1) {
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["BAD"] = 1;
} else {
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["NAME"] = $refinfo["NAME"];
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["IDENTIFIER"] = $refinfo["IDENTIFIER"];
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["CODE"] = $refinfo["CODE"];
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["COLOR"] = $refinfo["COLOR"];
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["ID"] = $oref[$i]["TGTOID"];
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["SITE"] = 'file';
}
}
} elseif ($oref[$i]["TGTTYPE"] == REFTYPE_IMAGE) {
$pr = sFileMgr()->getParents($oref[$i]["TGTOID"]);
array_pop($pr);
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["PARENTS"] = $pr;
$file = sFileMgr()->getFile($oref[$i]["TGTOID"]);
if ($file) {
$refinfo = $file->get();
if ($refinfo["OBJECTID"] < 1) {
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["BAD"] = 1;
} else {
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["NAME"] = $refinfo["NAME"];
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["IDENTIFIER"] = $refinfo["IDENTIFIER"];
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["CODE"] = $refinfo["CODE"];
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["COLOR"] = $refinfo["COLOR"];
}
}
} elseif ($oref[$i]["TGTTYPE"] == REFTYPE_EMAIL) {
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["NAME"] = $oref[$i]["TGTOID"];
} elseif ($oref[$i]["TGTTYPE"] == REFTYPE_EXTERNAL) {
$outgoing[$refcohash[$hash]]["VIATARGETS"][$viacnt]["NAME"] = $oref[$i]["TGTOID"];
示例12: setFormfield
/**
* Saves content to a Formfield
*
* @param int $linkId Entrymask Formfield Link Id
* @param string $value01 Content for Formfield parameter 1
* @param string $value02 Content for Formfield parameter 2
* @param string $value02 Content for Formfield parameter 3
* @param string $value04 Content for Formfield parameter 4
* @param string $value05 Content for Formfield parameter 5
* @param string $value06 Content for Formfield parameter 6
* @param string $value07 Content for Formfield parameter 7
* @param string $value08 Content for Formfield parameter 8
* @return bool TRUE on success or FALSE in case of an error
* @throws Exception
*/
function setFormfield($linkId, $value01, $value02, $value03, $value04, $value05, $value06, $value07, $value08)
{
$cbId = $this->_id;
$linkId = (int) $linkId;
if ($this->permissions->checkInternal($this->_uid, $cbId, "RWRITE")) {
$value01 = sYDB()->escape_string($value01);
$value02 = sYDB()->escape_string($value02);
$value03 = sYDB()->escape_string($value03);
$value04 = sYDB()->escape_string($value04);
$value05 = sYDB()->escape_string($value05);
$value06 = sYDB()->escape_string($value06);
$value07 = sYDB()->escape_string($value07);
$value08 = sYDB()->escape_string($value08);
// Check if an URL needs to be generated
$sql = "SELECT\n\t\t\t\t\t\tt.TYPE\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`yg_contentblocks_lnk_entrymasks_c` AS c,\n\t\t\t\t\t\t`yg_formfields` AS t\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(c.FORMFIELD = t.ID) AND\n\t\t\t\t\t\t(c.ID = ?);";
$ra = $this->cacheExecuteGetArray($sql, $linkId);
$webRoot = (string) sConfig()->getVar("CONFIG/DIRECTORIES/WEBROOT");
switch ($ra[0]['TYPE']) {
case 'PAGE':
if (strlen(trim($value02)) && strlen(trim($value01))) {
$siteMgr = new Sites();
$sitePName = $siteMgr->getPName($value02);
$pageMgr = sPageMgr($value02);
$tmpPage = $pageMgr->getPage($value01);
$tmpPageInfo = $tmpPage->get();
$value03 = $webRoot . $sitePName . '/' . $tmpPageInfo['PNAME'] . '/';
$value04 = $tmpPageInfo['PNAME'];
$value05 = $sitePName;
} else {
$value01 = $value02 = $value03 = $value04 = '';
}
break;
case 'FILE':
if (strlen(trim($value01))) {
$tmpFile = sFileMgr()->getFile($value01);
if ($tmpFile) {
$tmpFileInfo = $tmpFile->get();
$value02 = $webRoot . 'download/' . $tmpFileInfo['PNAME'] . '/';
$value03 = $tmpFileInfo['PNAME'];
$value04 = $webRoot . 'image/' . $tmpFileInfo['PNAME'] . '/';
}
} else {
$value01 = $value02 = $value03 = '';
}
break;
}
$sql = "UPDATE `yg_contentblocks_lnk_entrymasks_c` SET\n\t\t\t\t\t\tVALUE01 = ?,\n\t\t\t\t\t\tVALUE02 = ?,\n\t\t\t\t\t\tVALUE03 = ?,\n\t\t\t\t\t\tVALUE04 = ?,\n\t\t\t\t\t\tVALUE05 = ?,\n\t\t\t\t\t\tVALUE06 = ?,\n\t\t\t\t\t\tVALUE07 = ?,\n\t\t\t\t\t\tVALUE08 = ?\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(ID = ?);";
$result = sYDB()->Execute($sql, $value01, $value02, $value03, $value04, $value05, $value06, $value07, $value08, $linkId);
if ($result === false) {
throw new Exception(sYDB()->ErrorMsg());
}
// Check to which object this entrymask belongs to
$CblockInfo = $this->get();
// Check if it is an embedded entrymask
if ($CblockInfo['EMBEDDED']) {
$sql = "SELECT PID, PVERSION FROM yg_mailing_lnk_cb WHERE CBID = " . $CblockInfo['OBJECTID'] . " AND CBVERSION = " . $CblockInfo['VERSION'] . ";";
$linkedMailings = $this->cacheExecuteGetArray($sql);
if (count($linkedMailings) > 0) {
// Yes, it links to a Mailing
$mailingMgr = new MailingMgr();
foreach ($linkedMailings as $linkedMailing) {
$mailing = $mailingMgr->getMailing($linkedMailing['PID'], $linkedMailing['PVERSION']);
if ($mailing) {
$mailing->markAsChanged();
}
}
} else {
// Check if it is related to a Page
$sites = sSites()->getList(true, false);
for ($i = 0; $i < count($sites); $i++) {
$sql = "SELECT PID, PVERSION FROM yg_site_" . (int) $sites[$i]['ID'] . "_lnk_cb WHERE CBID = " . (int) $CblockInfo['OBJECTID'] . " AND CBVERSION = " . (int) $CblockInfo['VERSION'] . ";";
$linkedPages = $this->cacheExecuteGetArray($sql);
if (count($linkedPages) > 0) {
// Yes, it links to a Pages
$pageMgr = sPageMgr($sites[$i]['ID']);
foreach ($linkedPages as $linkedPage) {
$page = $pageMgr->getPage($linkedPage['PID'], $linkedPage['PVERSION']);
if ($page) {
$page->markAsChanged();
}
}
}
}
}
} else {
//.........这里部分代码省略.........
示例13: updateFile
/**
* Updates filename, filetype and source file of this File
*
* @param string $filename New filename
* @param int $filetypeId New Filetype Id
* @param $tmpfile Temporary file
* @param $produceNewVersion (optional) TRUE if a new version should be produced
* @return int|false New File version or FALSE in case of an error
*/
public function updateFile($filename, $filetypeId, $tmpfile, $produceNewVersion = true)
{
if ($this->permissions->checkInternal($this->_uid, $this->getID(), "RWRITE")) {
if ($produceNewVersion == true) {
$newVersion = $this->newVersion();
} else {
$newVersion = $this->getVersion();
}
$filetypeId = (int) $filetypeId;
if ($filetypeId == 0) {
return false;
}
if (!file_exists($tmpfile)) {
return false;
}
$filedir = sConfig()->getVar('CONFIG/DIRECTORIES/FILESDIR') . "/";
$fprefix = $this->getID() . "-" . $newVersion;
copy($tmpfile, $filedir . $fprefix . $filename);
unlink($tmpfile);
$fileSize = filesize($filedir . $fprefix . $filename);
$this->setFilename($filename);
$this->setFileSize($fileSize);
$this->setFileType($filetypeId);
$this->setViewVersion($newVersion);
$this->views->scheduleUpdate();
sFileMgr()->callExtensionHook('onUpdate', (int) $this->_id, $newVersion);
return $newVersion;
} else {
return false;
}
}
示例14: array_pop
for ($p = 0; $p < count($tp); $p++) {
$tinfo = $file->tags->get($tp[$p]);
$tp2[$p]['ID'] = $tinfo['ID'];
$tp2[$p]['NAME'] = $tinfo['NAME'];
}
$tp2[count($tp2) - 1]['NAME'] = $itext['TXT_TAGS'] != '' ? $itext['TXT_TAGS'] : '$TXT_TAGS';
array_pop($tp2);
$tags[$t]['PARENTS'] = $tp2;
}
$filelist[$i]['TAGS'] = $tags;
$filelist[$i]['THUMB'] = 0;
$filelist[$i]['CLASSNAME'] = '';
$filelist[$i]['IMAGE'] = 0;
$webroot = sApp()->webroot;
$filelist[$i]['DOWNLOAD_URL'] = $webroot . 'download/' . $filelist[$i]['PNAME'];
$scheduledJobs = sFileMgr()->scheduler->getSchedule($filelist[$i]['OBJECTID']);
$hiddenViewsToProcess = 0;
foreach ($scheduledJobs as $scheduledJob) {
if ($scheduledJob['PARAMETERS']['VIEW']['HIDDEN']) {
$hiddenViewsToProcess++;
}
}
$hiddenviews = $file->views->getHiddenViews();
foreach ($hiddenviews as $hiddenview) {
if ($hiddenview['IDENTIFIER'] == 'yg-thumb' || $hiddenview['IDENTIFIER'] == 'yg-list') {
$tmpviewinfo = $file->views->getGeneratedViewInfo($hiddenview['ID']);
if ($tmpviewinfo[0]['TYPE'] == FILE_TYPE_WEBIMAGE) {
$filelist[$i]['THUMB'] = 1;
}
foreach ($scheduledJobs as $scheduledJob) {
if ($scheduledJob['PARAMETERS']['VIEW']['IDENTIFIER'] == $hiddenview['IDENTIFIER']) {
示例15: getContentInternal
/**
* Gets all Contentareas of this Page including Cblocks and content
*
* @return array
*/
function getContentInternal()
{
$pageId = $this->_id;
if ($this->permissions->checkInternal($this->_uid, $pageId, "RREAD")) {
$templateMgr = new Templates();
$pageInfo = $this->get();
$contentareas = $templateMgr->getContentareas($pageInfo['TEMPLATEID']);
for ($i = 0; $i < count($contentareas); $i++) {
$colist = $this->getCblockList($contentareas[$i]['CODE']);
for ($x = 0; $x < count($colist); $x++) {
if ($colist[$x]['OBJECTID'] > 0) {
if ($colist[$x]['EMBEDDED'] == 0) {
$cb = sCblockMgr()->getPublishedCblock($colist[$x]['OBJECTID']);
if ($cb) {
$cbInfo = $cb->get();
$colist[$x]['CBVERSION'] = $colist[$x]['VERSION'] = $cbInfo['VERSIONPUBLISHED'];
}
} else {
$cb = sCblockMgr()->getCblock($colist[$x]['OBJECTID'], $colist[$x]['VERSION']);
$colist[$x]['CBVERSION'] = $colist[$x]['VERSION'];
}
if ($cb) {
$colist[$x]['ENTRYMASKS'] = $cb->getEntrymasks();
for ($c = 0; $c < count($colist[$x]['ENTRYMASKS']); $c++) {
$controlFormfields = $cb->getFormfieldsInternal($colist[$x]['ENTRYMASKS'][$c]['LINKID']);
for ($w = 0; $w < count($controlFormfields); $w++) {
if ($controlFormfields[$w]['FORMFIELD'] == 6 || $controlFormfields[$w]['FORMFIELD'] == 16) {
if (trim($controlFormfields[$w]['VALUE01'])) {
$file = sFileMgr()->getFile($controlFormfields[$w]['VALUE01']);
if ($file) {
$fileInfo = $file->get();
$controlFormfields[$w]['DISPLAYNAME'] = $fileInfo['NAME'];
}
}
}
if ($controlFormfields[$w]['FORMFIELD'] == 7) {
if (trim($controlFormfields[$w]['VALUE01'])) {
$icb = sCblockMgr()->getCblock($controlFormfields[$w]['VALUE01']);
if ($icb) {
$info = $icb->get();
$controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
}
}
}
if ($controlFormfields[$w]['FORMFIELD'] == 8) {
if (trim($controlFormfields[$w]['VALUE01'])) {
$info = $this->tags->get($controlFormfields[$w]['VALUE01']);
$controlFormfields[$w]['DISPLAYNAME'] = $info['NAME'];
}
}
}
$colist[$x]['ENTRYMASKS'][$c]['FORMFIELDS'] = $controlFormfields;
}
} else {
// dummy
$colist[$x] = NULL;
}
}
}
// Clear all "NULL" entries
$realCoList = array();
foreach ($colist as $colistIdx => $colistItem) {
if ($colistItem !== NULL) {
$realCoList[] = $colistItem;
}
}
$contentareas[$i]['LIST'] = $realCoList;
}
return $contentareas;
} else {
return false;
}
}