当前位置: 首页>>代码示例>>PHP>>正文


PHP Singleton::cache_config方法代码示例

本文整理汇总了PHP中Singleton::cache_config方法的典型用法代码示例。如果您正苦于以下问题:PHP Singleton::cache_config方法的具体用法?PHP Singleton::cache_config怎么用?PHP Singleton::cache_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Singleton的用法示例。


在下文中一共展示了Singleton::cache_config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addUsergroup

 /**
  * Adds this User to a Usergroup
  *
  * @param int $usergroupId Usergroup Id
  */
 function addUsergroup($usergroupId)
 {
     if ($this->hasUsergroup($usergroupId)) {
         return true;
     }
     $this->_usergroups = false;
     $uid = (int) $this->id;
     if (sUsergroups()->permissions->check($this->_uid, 'RUSERS') || $uid == $this->_uid) {
         $usergroupId = (int) $usergroupId;
         if ($usergroupId > 0) {
             $sql = "INSERT INTO `yg_user_lnk_usergroups` (`UID`, `USERGROUPID`) VALUES (?, ?);";
             sYDB()->Execute($sql, $uid, $usergroupId);
         }
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PERMISSION_CHANGE") == "true") {
             Singleton::FC()->emptyBucket();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:26,代码来源:user.php

示例2: setPName

 /**
  * Sets the permanent name of this Mailing
  *
  * @param string $pname Pname
  * @return bool TRUE on success FALSE in case of an error
  * @throws Exception
  */
 public function setPName($pname)
 {
     $mailingID = $this->_id;
     if ($this->permissions->checkInternal($this->_uid, $mailingID, "RWRITE")) {
         $pname = $this->filterPName($pname);
         if (is_numeric($pname)) {
             return false;
         }
         $mailingMgr = new MailingMgr();
         $checkpinfo = $mailingMgr->getMailingIdByPName($pname);
         if ($checkpinfo["ID"] != $mailingID && $checkpinfo["ID"] > 0) {
             $pname = $pname . $mailing;
         }
         $sql = "UPDATE yg_mailing_tree SET PNAME = ? WHERE (ID = ?);";
         $result = sYDB()->Execute($sql, $pname, $mailingID);
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
         }
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PNAME_CHANGE") == "true") {
             Singleton::FC()->emptyBucket();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:33,代码来源:mailing.php

示例3: setByUsergroup

 /**
  * Sets a Permission for a specific Usergroup
  *
  * @param int $usergroupId
  * @param string $permission Permission (RREAD, RWRITE, RDELETE, RSUB, RSTAGE, RMODERATE, RCOMMENT, RSEND)
  * @param $objectId Object Id
  * @param int $value Permission value (1 for allowed, 0 for not allowed)
  * @return bool TRUE on success or FALSE if not allowed
  * @throws Exception
  */
 public function setByUsergroup($usergroupId, $permission, $objectId, $value)
 {
     $usergroupId = (int) $usergroupId;
     $objectId = (int) $objectId;
     $permission = sYDB()->escape_string(sanitize($permission));
     $value = sYDB()->escape_string(sanitize($value));
     if ($value < 1) {
         $value = 0;
     }
     // Check if current user has permissions to change usergroup-permissions
     if (!sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $usergroupId, 'RWRITE')) {
         return false;
     }
     $pinfo = $this->getByUsergroup($usergroupId, $objectId);
     if (count($pinfo) > 0) {
         // Update
         $sql = "UPDATE " . $this->_table . " SET `{$permission}` = ? WHERE OID = ? AND USERGROUPID = ?;";
         $result = sYDB()->Execute($sql, $value, $objectId, $usergroupId);
     } else {
         // Insert
         $sql = "INSERT INTO " . $this->_table . " SET USERGROUPID = ?, `{$permission}` = ?, OID = ?;";
         $result = sYDB()->Execute($sql, $usergroupId, $value, $objectId);
     }
     if ($result === false) {
         throw new Exception(sYDB()->ErrorMsg());
     }
     sUsergroups()->setByUsergroupHashPermission($this->_table, $usergroupId, $objectId, $permission, $value);
     // Call callback, if present
     if ($this->_object) {
         $this->_object->onPermissionChange($usergroupId, $permission, $value, $objectId);
     }
     if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PERMISSION_CHANGE") == "true") {
         Singleton::FC()->emptyBucket();
     }
     return true;
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:46,代码来源:permissions.php

示例4: hitCache

 public function hitCache()
 {
     $this->base = $this->request->script_name . "/" . strtolower($this->applicationname);
     $this->cached = false;
     $this->cache_config = new \framework\Config("config/cache.xml.php");
     Singleton::register("cache_config", $this->cache_config);
     $reverse_proxy = Singleton::cache_config()->getVar("CONFIG/REVERSE_PROXY/ENABLED");
     if ($reverse_proxy == "true") {
         $reverse_proxy_purge = Singleton::cache_config()->getVar("CONFIG/REVERSE_PROXY/PURGE_COMMAND");
     } else {
         $reverse_proxy_purge = "";
     }
     Singleton::register("FC", new \framework\Cache("page", 0, $this->tmpdir, $reverse_proxy_purge));
     if ($this->session->getCookie('version') == 'working') {
         return false;
     }
     if ($this->frontendMode == "true") {
         $frontendCache = (string) $this->config->getVar('CONFIG/CACHE/FRONTEND');
         if ($frontendCache == "true") {
             //\framework\import("org.yeager.framework.cache.controller");
             $cacheBucket = (string) $this->config->getVar('CONFIG/PAGES/' . strtoupper($this->page) . '/CACHE');
             if ($cacheBucket != "") {
                 $requestHash = md5($_SERVER['REQUEST_URI']);
                 if (strstr($_SERVER['REQUEST_URI'], "nocache=true")) {
                     return;
                 }
                 if (strstr($_SERVER['REQUEST_URI'], "version=working")) {
                     return;
                 }
                 if (implode("", $_POST) != "") {
                     return;
                 }
                 $pattern = $this->cache_config->getVars("CONFIG/" . strtoupper($cacheBucket) . "/URIS");
                 foreach ($pattern as $p) {
                     if (preg_match($p["URI"], $_SERVER['REQUEST_URI'])) {
                         $ttl = $p["TTL"];
                         $key = $p["KEY"];
                         break;
                     }
                 }
                 if ($ttl == 0 || strtolower($key) == 'none') {
                     return;
                 }
                 // zero ttl means no-cache
                 if ($key == "UserGroup") {
                     $roles = $this->session->getSessionVar("userroles");
                     $roleHash = "";
                     foreach ($roles as $r) {
                         $roleHash .= $r["ID"] . "-";
                     }
                 } elseif ($key == "ProtoUserGroup") {
                     $roles = $this->session->getSessionVar("userroles");
                     $roleHash = $this->request->prefix . "-";
                     foreach ($roles as $r) {
                         $roleHash .= $r["ID"] . "-";
                     }
                 } else {
                     $userID = $this->session->getCookie("yg-userid");
                     if ($userID < 1) {
                         $userID = (int) $this->config->getVar("CONFIG/SYSTEMUSERS/ANONUSERID");
                     }
                     $roleHash = $userID;
                     // per user cache
                 }
                 $cacheId = $requestHash . "-" . $roleHash;
                 Singleton::FC()->setCacheId($cacheId);
                 Singleton::FC()->setTTL($ttl);
                 $cached_OB = Singleton::FC()->getvalue("output");
                 $this->cached = true;
                 if ($cached_OB != false) {
                     header("X-YG-CACHEHIT: true");
                     header("X-YG-CACHEKEY: {$key}");
                     ob_end_clean();
                     ob_start();
                     echo $cached_OB;
                     return true;
                 }
             }
         }
     }
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:81,代码来源:y.php

示例5: remove

 /**
  * Removes a specific Tag
  *
  * @param int $tagId Tag Id
  *
  * @return array Array with all elements which were successfully deleted
  */
 function remove($tagId)
 {
     $tagId = $origTagId = (int) $tagId;
     $rootNode = $this->tree->getRoot();
     if ($tagId == $rootNode) {
         return array();
     }
     // Get all nodes
     $successNodes = array();
     $allNodes = $this->tree->get($tagId, 1000);
     foreach ($allNodes as $allNodesItem) {
         $tagId = (int) $allNodesItem['ID'];
         if ($this->permissions->checkInternal($this->_uid, $tagId, "RDELETE")) {
             $sql = "DELETE FROM yg_tags_properties WHERE OBJECTID = ?;";
             sYDB()->Execute($sql, $tagId);
             $successNodes[] = $tagId;
         }
     }
     if (in_array($origTagId, $successNodes)) {
         $this->tree->remove($origTagId);
     }
     if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/TAG_DELETE") == "true") {
         Singleton::FC()->emptyBucket();
     }
     return $successNodes;
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:33,代码来源:tags.php

示例6: setValue

 /**
  * Sets a Property value
  *
  * @param string $identifier Property identifier
  * @param mixed $value Property value
  * @return bool TRUE on success or FALSE in case of an error
  * @throws Exception
  */
 function setValue($identifier, $value)
 {
     if ($this->_object == NULL || $this->_object->permissions->checkInternal($this->_uid, $this->_object->getID(), 'RWRITE')) {
         $oid = (int) $this->_property_id;
         $identifier = sYDB()->escape_string(sanitize($identifier));
         $sql = "SELECT OID FROM `" . $this->_table . "v` WHERE OID = ?;";
         $result = sYDB()->Execute($sql, $oid);
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
             return false;
         }
         $resultarray = $result->GetArray();
         $sql = "SELECT TYPE FROM `" . $this->_table . "` WHERE IDENTIFIER = ?;";
         $result = sYDB()->Execute($sql, $identifier);
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
             return false;
         }
         $typeresultarray = $result->GetArray();
         if ($typeresultarray[0]['TYPE'] == 'PAGE') {
             if (is_array($value)) {
                 $value = json_encode($value);
             }
         }
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PROPERTY_CHANGE") == "true") {
             Singleton::FC()->emptyBucket();
         }
         if ($this->_object) {
             $this->_object->markAsChanged();
         }
         if (count($resultarray) > 0) {
             $sql = "UPDATE `" . $this->_table . "v` SET `{$identifier}` = ? WHERE OID = ?;";
             $result = sYDB()->Execute($sql, $value, $oid);
             if ($result === false) {
                 throw new Exception(sYDB()->ErrorMsg());
             }
             return true;
         } else {
             $sql = "INSERT INTO `" . $this->_table . "v` ( `OID` ,  `{$identifier}`) VALUES (?, ?);";
             $result = sYDB()->Execute($sql, $oid, $value);
             if ($result === false) {
                 throw new Exception(sYDB()->ErrorMsg());
             }
             return true;
         }
     } else {
         return false;
     }
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:57,代码来源:properties.php

示例7: setByUsergroup

 /**
  * Sets a Privilege for a specific Usergroup
  *
  * @param int $usergroupId
  * @param string $privilege Privilege
  * @param int $value Privilege value (1 for allowed, 0 for not allowed)
  * @return bool TRUE on success or FALSE if not allowed
  * @throws Exception
  */
 public function setByUsergroup($usergroupId, $privilege, $value)
 {
     $usergroupId = (int) $usergroupId;
     $privilege = sYDB()->escape_string(sanitize($privilege));
     $value = sYDB()->escape_string(sanitize($value));
     if ($value < 1) {
         $value = 0;
     }
     // Check if current user has permissions to change usergroup-permissions
     if (!sUsergroups()->usergroupPermissions->checkInternal(sUserMgr()->getCurrentUserID(), $usergroupId, 'RWRITE')) {
         return false;
     }
     $sql = "SELECT ID FROM " . $this->_table . " WHERE PRIVILEGE = ?;";
     $result = sYDB()->Execute($sql, $privilege);
     $resultarray = @$result->GetArray();
     $privilegeId = (int) $resultarray[0]['ID'];
     if ($privilegeId) {
         $pinfo = $this->getByUsergroup($usergroupId);
         if ($pinfo[$privilege] === NULL) {
             // Insert
             $sql = "INSERT INTO " . $this->_table_values . "\n\t\t\t\t\t\t\t(`USERGROUPID`, `PRIVILEGEID`, `VALUE`)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(?, ?, ?);";
             $result = sYDB()->Execute($sql, $usergroupId, $privilegeId, $value);
         } else {
             // Update
             $sql = "UPDATE " . $this->_table_values . " SET VALUE = ? WHERE USERGROUPID = ? AND PRIVILEGEID = ?;";
             $result = sYDB()->Execute($sql, $value, $usergroupId, $privilegeId);
         }
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
         }
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PERMISSION_CHANGE") == "true") {
             Singleton::FC()->emptyBucket();
         }
         return true;
     }
     return false;
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:46,代码来源:privileges.php

示例8: remove

 /**
  * Removes a Mailing from the Trash
  *
  * @param int $mailingId Mailing Id
  *
  * @return array Array with all elements which were successfully deleted
  */
 function remove($mailingId)
 {
     $mailingId = $origMailingId = (int) $mailingId;
     $rootNode = $this->tree->getRoot();
     if ($mailingId == $rootNode) {
         return array();
     }
     // Get all nodes
     $successNodes = array();
     $allNodes = $this->tree->get($mailingId, 1000);
     foreach ($allNodes as $allNodesItem) {
         $mailingId = (int) $allNodesItem['ID'];
         if ($this->permissions->checkInternal($this->_uid, $mailingId, "RDELETE")) {
             // Collect and remove all linked blind contentblocks
             $sql = "SELECT * FROM `yg_mailing_lnk_cb` WHERE PID = {$mailingId};";
             $linked_cos = $this->cacheExecuteGetArray($sql);
             $c = sCblockMgr();
             foreach ($linked_cos as $linked_co) {
                 $cblock = $c->getCblock($linked_co['CBID']);
                 if ($cblock) {
                     $coInfo = $cblock->get();
                     // Blind contentblock?
                     if ($coInfo['EMBEDDED'] == 1) {
                         $cblock->delete();
                         $c->remove($linked_co['CBID']);
                     }
                 }
             }
             $tmpMailing = $this->getMailing($mailingId);
             $mailingInfo = $tmpMailing->get();
             $tmpMailing->tags->clear();
             $tmpMailing->history->clear();
             // Remove mailing
             $sql = "DELETE FROM `yg_mailing_properties` WHERE OBJECTID = ?;";
             sYDB()->Execute($sql, $mailingId);
             // Remove content object links
             $sql = "DELETE FROM `yg_mailing_lnk_cb` WHERE PID = ?;";
             sYDB()->Execute($sql, $mailingId);
             // Remove statusinfo
             $sql = "DELETE FROM `yg_mailing_status` WHERE OID = ?;";
             sYDB()->Execute($sql, $mailingId);
             $this->callExtensionHook('onRemove', $mailingId, 0, $mailingInfo);
             $successNodes[] = $mailingId;
         }
     }
     if (in_array($origMailingId, $successNodes)) {
         $this->tree->remove($origMailingId);
     }
     if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/MAILING_DELETE") == "true") {
         Singleton::FC()->emptyBucket();
     }
     return $successNodes;
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:60,代码来源:mailingmgr.php

示例9: uninstall

 /**
  * Uninstalls this Extension
  *
  * @return bool TRUE on success or FALSE in case of an error
  * @throws Exception
  */
 public function uninstall()
 {
     if (parent::uninstall()) {
         if ($this->uninstallPropertyTables("yg_ext_" . $this->_code . "_cblocks")) {
             $sql = "DELETE FROM yg_extensions_lnk_cblocks WHERE CODE = ?";
             $result = sYDB()->Execute($sql, $this->_code);
             if ($result === false) {
                 throw new Exception(sYDB()->ErrorMsg());
             }
             if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/EXTENSION_UNINSTALL") == "true") {
                 Singleton::FC()->emptyBucket();
             }
             return true;
         }
     } else {
         return false;
     }
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:24,代码来源:extensions.php

示例10: fixAndMovePLUploads

             }
             // Remove old contentareas in frontend
             if (count($rfilecontentareas) > 0) {
                 for ($i = 0; $i < count($rfilecontentareas); $i++) {
                     $koala->callJSFunction('Koala.yg_removeTemplateContentareaField', $window_id, $rfilecontentareas[$i]['CODE']);
                 }
             }
             // Remove old navigations in frontend
             if (count($rfilenavis) > 0) {
                 for ($i = 0; $i < count($rfilenavis); $i++) {
                     $koala->callJSFunction('Koala.yg_removeTemplateNavigationField', $window_id, $rfilenavis[$i]['CODE']);
                 }
             }
             $koala->queueScript("Koala.yg_setTemplateFileName( '" . $window_id . "', '" . $filename . "' );");
             $koala->queueScript("window.noprocessing = true;");
             if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/TEMPLATE_CHANGE") == "true") {
                 Singleton::FC()->emptyBucket();
             }
         }
     }
     break;
 case 'uploadTemplatePreview':
     $filetype = $this->params['type'];
     $filetitle = $this->params['title'];
     if ($_FILES['Filedata']['tmp_name']) {
         $fileTmpName = $_FILES['Filedata']['tmp_name'];
         $filename = $_FILES['Filedata']['name'];
     } else {
         $fileTmpName = fixAndMovePLUploads();
         $filename = $_REQUEST['name'];
     }
开发者ID:nrueckmann,项目名称:yeager,代码行数:31,代码来源:templates.php

示例11: setPName

 /**
  * Sets the permanent name of the specified Site
  *
  * @param int $siteId Site Id
  * @param string $PName Permanent name
  * @return bool TRUE on success or FALSE in case of an error
  */
 public function setPName($siteId, $PName)
 {
     if (sUsergroups()->permissions->check($this->_uid, 'RSITES')) {
         $siteId = (int) $siteId;
         $PName = sYDB()->escape_string(sanitize($PName));
         if (is_numeric($PName)) {
             return false;
         }
         $sql = "UPDATE yg_site SET PNAME = ? WHERE ID = ?;";
         $result = $this->_db->execute($sql, $PName, $siteId);
         if ($result === false) {
             return false;
         }
         $sql = "UPDATE `yg_site_" . $siteId . "_tree` SET PNAME = ? WHERE ID = 1;";
         $result = $this->_db->execute($sql, $PName);
         if ($result === false) {
             return false;
         }
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PNAME_CHANGE") == "true") {
             Singleton::FC()->emptyBucket();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:33,代码来源:sites.php

示例12: setPName

 /**
  * Sets the permanent name of this Cblock
  *
  * @param string $pname Permanent name
  * @return bool TRUE on success or FALSE in case of an error
  * @throws Exception
  */
 public function setPName($pname)
 {
     $cbId = $this->_id;
     $pname = sYDB()->escape_string(sanitize($pname));
     if ($this->permissions->checkInternal($this->_uid, $cbId, "RWRITE")) {
         $pname = $this->filterPName($pname);
         if (is_numeric($pname)) {
             return false;
         }
         $checkpinfo = sCblockMgr()->getCblockIdByPName($pname);
         if ($checkpinfo["ID"] != $cbId && $checkpinfo["ID"] > 0) {
             $pname = $pname . $cbId;
         } else {
             if ($checkpinfo["ID"] > 0 && $checkpinfo["ID"] == $cbId) {
             } else {
             }
         }
         $sql = "SELECT PNAME AS STATE FROM yg_contentblocks_tree WHERE (ID = ?);";
         $result = sYDB()->Execute($sql, $cbId);
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
         }
         $sql = "UPDATE yg_contentblocks_tree SET PNAME = '{$pname}' WHERE (ID = ?);";
         $result = sYDB()->Execute($sql, $cbId);
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
         }
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/PNAME_CHANGE") == "true") {
             Singleton::FC()->emptyBucket();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:42,代码来源:cblock.php

示例13: elseif

                require_once $this->approot . $this->filesprocdir . $procs[$p]["dir"] . "/" . $procs[$p]["classname"] . ".php";
            } elseif (file_exists($this->approot . $this->processordir . $procs[$p]["dir"] . "/" . $procs[$p]["classname"] . ".php")) {
                require_once $this->approot . $this->processordir . $procs[$p]["dir"] . "/" . $procs[$p]["classname"] . ".php";
            } else {
                continue;
            }
            sUserMgr()->impersonate($jobs[$j]['USERID']);
            $classname = (string) $procs[$p]["classname"];
            $namespace = (string) $procs[$p]["namespace"];
            if (strlen($namespace)) {
                $classname = $namespace . "\\" . $classname;
            }
            $moduleclass = new $classname();
            if ($fileMgr->scheduler->pickJob($jobs[$j]["ID"])) {
                if ($moduleclass->process($jobs[$j]["OBJECTID"], $jobs[$j]["PARAMETERS"])) {
                    if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/FILE_PROCESSVIEW") == "true") {
                        Singleton::FC()->emptyBucket();
                    }
                    if ($jobs[$j]['PARAMETERS']['VIEW']['ID'] && $jobs[$j]['PARAMETERS']['VIEW']['ID'] != "") {
                        $jsQueue->add($jobs[$j]['PARAMETERS']['FILEINFO']['OBJECTID'], HISTORYTYPE_FILE, 'FILE_GENERATEDVIEW', sGuiUS(), $jobs[$j]['PARAMETERS']['VIEW']['ID'], $jobs[$j]['PARAMETERS']['VIEW']['IDENTIFIER']);
                    }
                    $fileMgr->scheduler->finishJob($jobs[$j]["ID"]);
                } else {
                    $fileMgr->scheduler->finishJob($jobs[$j]["ID"], SCHEDULER_STATE_FAILED);
                }
            }
        }
    }
}
// Pages (for every site)
sUserMgr()->impersonate((int) sConfig()->getVar("CONFIG/SYSTEMUSERS/ROOTUSERID"));
开发者ID:nrueckmann,项目名称:yeager,代码行数:31,代码来源:scheduler.php

示例14: delete

 /**
  * Moves this File to the trashcan
  *
  * @return array Array with all elements which were successfully deleted
  */
 function delete()
 {
     $fileID = (int) $this->_id;
     $rootNode = sFileMgr()->tree->getRoot();
     if ($fileID == $rootNode) {
         return array();
     }
     // Check if object is a folder
     $successNodes = array();
     $currFile = sFileMgr()->getFile($fileID);
     $fileInfo = $currFile->get();
     if ($fileInfo['FOLDER'] == 1) {
         $subNodes = sFileMgr()->getList($fileID, array('SUBNODES'), 'group2.LFT', 1000);
         if (count($subNodes) > 0) {
             foreach ($subNodes as $subNode) {
                 $file = sFileMgr()->getFile($subNode['ID']);
                 $successfullyDeleted = $file->delete();
                 if (in_array($subNode['ID'], $successfullyDeleted) === true) {
                     foreach ($successfullyDeleted as $successfullyDeletedItem) {
                         $successNodes[] = $successfullyDeletedItem;
                     }
                 }
             }
         }
     }
     if ($this->permissions->checkInternal($this->_uid, $fileID, "RDELETE")) {
         // Move to root level
         sFileMgr()->tree->moveTo($fileID, $rootNode);
         $sql = "UPDATE yg_files_properties SET DELETED = 1 WHERE OBJECTID = ?;";
         sYDB()->Execute($sql, $fileID);
         $successNodes[] = $fileID;
         sFileMgr()->callExtensionHook('onDelete', (int) $this->_id, (int) $this->_version);
     }
     if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/FILE_DELETE") == "true") {
         Singleton::FC()->emptyBucket();
     }
     return $successNodes;
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:43,代码来源:file.php

示例15: remove

 /**
  * Removes a specific Comment
  *
  * @param int $objectId Object Id
  * @param int $commentId Comment Id
  * @return int ERROR_NONE on success or ERROR_COMMENTS_NO_MOD_RIGHTS
  */
 function remove($objectId = 0, $commentId = 0)
 {
     $objectId = (int) $objectId;
     $commentId = (int) $commentId;
     if ((int) $objectId == 0) {
         $objectId = (int) $this->_object->getID();
     }
     // Check permissions (RCOMMENT is required)
     if ($commentId > 0 && $this->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $objectId, 'RMODERATE')) {
         $sql = "DELETE FROM yg_comments WHERE (ID = ?);";
         $result = sYDB()->Execute($sql, $commentId);
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
         }
         $sql = "DELETE FROM " . $this->_object->getCommentsLinkTable() . " WHERE (COMMENTID = ?);";
         $result = sYDB()->Execute($sql, $commentId);
         if ($result === false) {
             throw new Exception(sYDB()->ErrorMsg());
         }
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/COMMENT_REMOVE") == "true") {
             Singleton::FC()->emptyBucket();
         }
         return ERROR_NONE;
     } else {
         return ERROR_COMMENTS_NO_MOD_RIGHTS;
     }
 }
开发者ID:nrueckmann,项目名称:yeager,代码行数:34,代码来源:comments.php


注:本文中的Singleton::cache_config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。