* @copyright 2003-2006 Rg Lab * @license Private * @version SVN: $Id: error.lib.php 351 2008-10-31 15:38:32Z nikita $ */ /** * Global error stack (default) * * @see ErrorStack::addWarning() * @access private * @global array $GLOBALS['_ERROR_STACK'] */ $GLOBALS["_ERROR_STACK"] = array(); /** * ErrorInfo data structure */ class ErrorInfo { /** * Error number * @var integer * @access private */ public $No; /** * Error message * @var string * @access private */ public $Message; /** * Error script name * @var string * @access private */ public $FileName; /** * Error line number * @var integer * @access private */ public $LineNum; /** * Supplemental information * @var string * @access private */ public $Additions; /** * Class constructor * * @param integer $No * @param string $Message * @param string $FileName * @param integer $LineNum * @return boolean */ function ErrorInfo($No, $Message, $FileName, $LineNum, $Additions=false) { $this->No = $No; $this->Message = $Message; $this->FileName = $FileName; $this->LineNum = $LineNum; $this->Additions = $Additions; return true; } } /** * Error Stack Implementation * * @package ss3 * @since Site Sapiens v 3.0 */ class Error { /** * Class constructor * * @return object $this */ function Error() { return $this; } /** * Apply warning * * @param integer $No * @param string $Message * @param string $FileName * @param integer $LineNum * @return boolean */ function addWarning($No, $Message, $FileName, $LineNum, $Additions=false) { if(!is_numeric($No) or !is_numeric($LineNum) or !is_string($Message) or !is_string($FileName)) trigger_error("Invalid parameters \$No/\$Message/\$FileName/\$LineNum"); if(isset($GLOBALS["env"]) && $GLOBALS["env"]->URI->RequestStatus=="XMLHttpRequest") { toLog("Warning: {$Message} in {$FileName} on line {$LineNum}\n{$Additions}\n\n", "a"); } $GLOBALS["_ERROR_STACK"][] = new ErrorInfo($No, $Message, $FileName, $LineNum, $Additions); return true; } /** * Print critical error message and stop all processes * * @param string $Message * @param string $Title * @return boolean */ function printCriticalError($Message, $Title="Critical alert") { if(!is_string($Message) or !is_string($Title)) trigger_error("Invalid parameters \$Message/\$Title"); if($GLOBALS["env"]->URI->RequestStatus=="XMLHttpRequest") { print "\r\n{$Message}"; tolog("{$Message}\n"); exit; } if(@include_once(ROOT_PATH."libs/view/templates/errors/criticalmessage.tpl.php")) { die( str_replace(array("&message.value;","&title.value;"), array($Message,$Title), $CriticalMessageTemplate)); } else { $backtrace = debug_backtrace(); $index = 1; if($backtrace[$index]["function"] == "usererrorhandler") $index = 2; // If error came from UserErrorHandler die("$Title: ".$Message." in ".$backtrace[$index]["file"]." on line ".$backtrace[$index]["line"].""); } return true; } /** * Class destructor */ function destroy() { unset($this); } } ?> $position) { $ending = $char; $position = $cur_position; } } //Raw cut if no ending chars if($position == 0) { return mb_substr($cut_text, 0, $length - 1).'…'; } //Substitute ',' with '…' if($ending == ',') { return mb_substr($cut_text, 0, $position - 1).'…'; } if($ending == ' ') { $prev_char = mb_substr($cut_text, $position - 1, 1); if($prev_char == ',') { return mb_substr($cut_text, 0, $position - 1).'…'; } if($prev_char == '.' || $prev_char == '!' || $prev_char == '?' || $prev_char == '…') { return mb_substr($cut_text, 0, $position + 1); } else { return mb_substr($cut_text, 0, $position).'…'; } } } } function setCache($var, $value) { @session_start(); $_SESSION[$var] = $value; set($var, $_SESSION[$var]); } function getCache($var, $default = '') { @session_start(); if(isset($_SESSION[$var])) { set($var, $_SESSION[$var]); } else { set($var, $default); } } function redirect($url) { @header('HTTP/1.1 301 Found'); @header('Status: 301 Found'); @header('Location: '.$url); echo 'Страница автоматической переадресацииНажмине сюда, если ваш браузер не потдерживает автоматическую переадресацию.'; exit(); } function rn2br($string) { $string = str_replace("\r\n", "\n", $string); $string = str_replace("\n", "
", $string); return $string; } /** * @param integer $int * @param array $expression = array('День', 'Дня', 'Дней') * @return string */ function declension($int, $expressions) { $result = null; if(count($expressions) < 3) { $expressions[2] = $expressions[1]; } if(count($expressions) < 4) { $expressions[3] = $expressions[2]; } settype($int, "integer"); $count = $int % 100; if($int == 0 && isset($expressions[3])) { $result = $expressions[3]; } elseif($count >= 5 && $count <= 20) { $result = $expressions[2]; } else { $count = $count % 10; if($count == 1) { $result = $expressions[0]; } elseif($count >= 2 && $count <= 4) { $result = $expressions[1]; } else { $result = $expressions[2]; } } return $result; } function create_thumbnail($image, $width, $height, $alt = '', $extraparams = '', $method = 'adaptiveResize') { require_once ROOT_PATH."vendors/Thumbnail/ThumbLib.inc.php"; $file = ROOT_PATH.$image; $file = str_replace("\\", "/", $file); $file = str_replace("//", "/", $file); if(is_file($file)) { $root = DELIVERY_WEBROOT_ROOTPATH; $root = str_replace("\\", "/", $root); $root = str_replace("//", "/", $root); $imageinfo = pathinfo($file); $thumbpath = $imageinfo['dirname']; $thumbpath = str_replace($root."img", $root."thumbnails", $thumbpath); $thumbpath = str_replace($root."images", $root."thumbnails", $thumbpath); $thumbimage = $thumbpath.'/'.$width."x".$height."_".basename($file); $httpimage = str_replace($root, DELIVERY_WEBROOT_HTTPPATH, $thumbimage); if(!is_file($thumbimage) or (filemtime($thumbimage) < filemtime($file))) { $thumb = PhpThumbFactory::create($file); $thumb->$method($width, $height); installFolder($thumbpath); $thumb->save($thumbimage); $sizes = $thumb->getCurrentDimensions(); return ''.$alt.''; } else { $size = getimagesize($thumbimage); return ''.$alt.''; } } } function redirect_to_first_child() { global $env; $data = get_tree(array('root' => $env->Values['document_url'], 'levellimitation' => $env->Values['this_level']+1, 'limit' => '0,1')); foreach($data as $id => $page) { redirect(HTTP_PATH.$page['url']); } } function getRecordName($unified_id) { global $db; $res = $db->one("SELECT entry_name FROM rn_sentries_index WHERE unified_id = '".$db->prepare($unified_id)."'"); if(!empty($res)) { return $res['entry_name']; } else { return ''; } } function getDocName($unified_id) { global $db; $res = $db->one("SELECT item_name FROM rn_sitems WHERE unified_id = '".$db->prepare($unified_id)."'"); if(!empty($res)) { return $res['item_name']; } else { return ''; } } function getDocNameByURL($url) { global $db; $res = $db->one("SELECT item_name FROM rn_sitems WHERE url = '".$db->prepare($url)."'"); if(!empty($res)) { return $res['item_name']; } else { return ''; } } function getDocField($unified_id, $field) { $_array = array(); $data=get_documentdata(array("unified_id" => $unified_id), $_array, $_array); $env->Values["document_id"]=$data[0]["unified_id"]; if(!empty($data) and isset($data[0][$field])) { return $data[0][$field]; } else { return ''; } } function getParentDocID($unified_id) { global $db; $res = $db->one("SELECT parent_id FROM rn_sitems WHERE unified_id = '".$db->prepare($unified_id)."'"); if(!empty($res)) { return $res['parent_id']; } else { return ''; } } function getDocUrl($unified_id) { global $db; $res = $db->one("SELECT url FROM rn_sitems WHERE unified_id = '".$db->prepare($unified_id)."'"); if(!empty($res)) { return $res['url']; } else { return ''; } } function getDocUrlByTemplate($template) { global $db; $res = $db->one("SELECT url FROM rn_sitems WHERE template = '".$db->prepare($template)."'"); if(!empty($res)) { return $res['url']; } else { return ''; } } 'services/', "filter" => " and unified_id IN (SELECT unified_id FROM rn_ditems WHERE qc = 'featured' and data = '1') and unified_id IN (SELECT unified_id FROM rn_relationship_m2m_index WHERE variable = 'menu') ", "withdata" => true), $_array, $_array); } return $services; } function get_photogallery_photos($Commands=false, $ddc_params=array(), $ddc_parents=array()) { $res = array(); $counter = 0; for($i=1;$i<=$Commands['photos_count'];$i++) { $counter++; $res[] = array( "image" => $Commands['directory'].$counter.'.jpg', "counter" => $counter, "length" => $Commands['photos_count'] ); } return $res; } * @copyright 2003-2006 Rg Lab * @license Private * @version SVN: $Id: acl.lib.php 351 2008-10-31 15:38:32Z nikita $ */ /** * Error Stack Implementation * * @package ss3 * @since Site Sapiens v 3.0 */ class ACL { public $UserPermissions; /** * Class constructor * * @return object $this */ function ACL() { $this->UserPermissions = array(); return $this; } /** * Update object reading permission * * @param integer Unified ID * @param string User * @param string Action "add" or "delete" * @return boolean */ function setReadingPermissionToIndex($UnifiedID=false, $UserID=false, $Action="add") { global $db; $UnifiedID = (int)$UnifiedID; if(!$UnifiedID) trigger_error("Invalid parameters \$UnifiedID"); if(!$UserID) trigger_error("Invalid parameters \$UserID"); $db->StartTransaction(); // Inser user permission $access = ''; $ulist = $db->all("SELECT user FROM ".PERMISSIONSTABLE." WHERE unified_id={$UnifiedID} AND SUBSTRING(BIN(permission),1,1)='1'"); if($ulist) { $access = ','; foreach($ulist as $uid) { $access .= $uid["user"].","; } } $db->update("UPDATE `".UNIFIEDINDEXTABLE."` SET `access`='{$access}' WHERE unified_id={$UnifiedID}"); $db->CompleteTransaction(); return true; } /** * Update object permission * * Use cases: * $this->setPermission(7, 1032, "user1"); * $this->setPermission("101", 1032, $env->User->Groups); * * @param integer Unified ID * @param string/array User * @param integer/binary Permission * @return boolean */ function setPermission($Permission=false, $UnifiedID=false, $UserIDs=false) { global $db; $UnifiedID = (int)$UnifiedID; if(!$UnifiedID) trigger_error("Invalid parameters \$UnifiedID in setPermission()"); if(!$Permission) trigger_error("Invalid parameters \$Permission in setPermission()"); if(!$UserIDs) trigger_error("Invalid parameters \$UserIDs in setPermission()"); $db->StartTransaction(); if(strlen($Permission)>1) $Permission = bindec($Permission); $BinPermission = decbin($Permission); $BinPermission = substr("00000000",0,3 - strlen($BinPermission)) . $BinPermission; if(is_array($UserIDs)) { // Insert groups pemission foreach($UserIDs as $group) { $db->update("DELETE FROM `".PERMISSIONSTABLE."` WHERE unified_id=".$UnifiedID." and user='{$group}'"); $db->update("INSERT INTO `".PERMISSIONSTABLE."` (id, unified_id, user, permission) VALUES (NULL, '{$UnifiedID}', '{$group}', '{$Permission}')"); if(substr($BinPermission,0,1)=="1") $this->setReadingPermissionToIndex($UnifiedID, $group, "add"); } } else { if(!is_string($UserIDs)) trigger_error("Invalid parameters \$UserIDs in setPermission()"); // Inser user permission $db->update("DELETE FROM `".PERMISSIONSTABLE."` WHERE unified_id=".$UnifiedID." and user='{$UserIDs}'"); $db->update("INSERT INTO `".PERMISSIONSTABLE."` (id, unified_id, user, permission) VALUES (NULL, '{$UnifiedID}', '".$UserIDs."', '{$Permission}')"); if(substr($BinPermission,0,1)=="1") $this->setReadingPermissionToIndex($UnifiedID, $UserIDs, "add"); } $db->CompleteTransaction(); return true; } /** * Copy element permission * * @param integer * @param integer * @return boolean */ function copyPermission($SourceID=false, $TargetID=false) { global $db; if(!$SourceID) trigger_error("Invalid parameters \$SourceID"); if(!$TargetID) trigger_error("Invalid parameters \$TargetID"); $db->StartTransaction(); $everyone_perm=$db->one("SELECT everyone FROM " . DOCSTRUCTTABLE . " where unified_id=" . $SourceID); $db->update("UPDATE ".DOCSTRUCTTABLE." set everyone='" . ($everyone_perm["everyone"]?$everyone_perm["everyone"]:"0") . "' WHERE unified_id=" . $TargetID); $db->update("DELETE FROM `".PERMISSIONSTABLE."` WHERE unified_id={$TargetID}"); $ulist = $db->all("SELECT user, permission FROM ".PERMISSIONSTABLE." WHERE unified_id={$SourceID}"); if($ulist) { foreach($ulist as $row) { $db->update("INSERT INTO `".PERMISSIONSTABLE."` (id, unified_id, user, permission) VALUES (NULL, '{$TargetID}', '{$row["user"]}', '{$row["permission"]}')"); } } $attrs = $db->one("SELECT access FROM `".UNIFIEDINDEXTABLE."` WHERE unified_id={$SourceID}"); $db->update("UPDATE `".UNIFIEDINDEXTABLE."` SET access='{$attrs["access"]}' WHERE unified_id={$TargetID}"); $db->CompleteTransaction(); return true; } /** * Empty object permission * * Use cases: * $this->emptyPermission(1032, "user1"); * $this->emptyPermission(1032, $env->User->Groups); * * @param integer Unified ID * @param string/array User * @return boolean */ function emptyPermission($UnifiedID=false, $UserIDs=false) { global $db; $UnifiedID = (int)$UnifiedID; if(!$UnifiedID) trigger_error("Invalid parameters \$UnifiedID in setPermission()"); $db->StartTransaction(); $env=Environment::getInstance(); if(!$UserIDs) { if(!$env->User->SysadminPermission) return false; $db->update("DELETE FROM `".PERMISSIONSTABLE."` WHERE unified_id=".$UnifiedID.""); } elseif(is_array($UserIDs)) { foreach($UserIDs as $group) { $db->update("DELETE FROM `".PERMISSIONSTABLE."` WHERE unified_id=".$UnifiedID." and user='{$group}'"); $this->setReadingPermissionToIndex($UnifiedID, $group, "delete"); } } else { if(!is_string($UserIDs)) trigger_error("Invalid parameters \$UserIDs in setPermission()"); $db->update("DELETE FROM `".PERMISSIONSTABLE."` WHERE unified_id=".$UnifiedID." and user='{$UserIDs}'"); $this->setReadingPermissionToIndex($UnifiedID, $UserIDs, "delete"); } $db->CompleteTransaction(); return true; } /** * Check permission * * Use cases: * $this->checkPermission(MODIFYING, 7); * * @param binary Mask, that may be READING/MODIFYING/EXECUTING or complex READING|MODIFYING * @param integer Unified ID * @return boolean Success code */ function checkPermission($Mask=READING, $Permission=false) { if(strlen($Mask)!=3) trigger_error("Invalid parameters \$Mask in ACL::checkPermission(). You can use READING/MODIFYING/EXECUTING constants or masks based on they"); $Permission = (int)$Permission; if(!$Permission) return false; $Permission = decbin($Permission); if(substr($Mask,0,1)==1 AND substr($Permission,0,1)!=1) return false; if(substr($Mask,1,1)==1 AND substr($Permission,1,1)!=1) return false; if(substr($Mask,2,1)==1 AND substr($Permission,2,1)!=1) return false; return true; } /** * Find out object reading right * * Use cases: * $this->getRightTo(MODIFYING, 125, "user1"); * $this->getRightTo(MODIFYING, 125, $env->User->Groups); * $this->getRightTo(READING | EXECUTING, 125); // Check access to document for current user and its groups * * @param binary Mask, that may be READING/MODIFYING/EXECUTING or complex READING|MODIFYING * @param integer Unified ID * @param string/array User * @return boolean */ function getRightTo($Mask=READING, $UnifiedID=false, $UserIDs=false) { global $db, $env; $str = ''; $pfilter = ''; if(strlen($Mask)!=3) trigger_error("Invalid parameters \$Mask in ACL::getRightTo(). You can use READING/MODIFYING/EXECUTING constants or masks based on they"); //toLog($this->env); if(!$UserIDs) { $UserIDs = $this->env->User->Groups; $UserIDs[$this->env->User->ID]=$this->env->User->ID; } if(!$UnifiedID) trigger_error("Invalid parameters \$UnifiedID in ACL::getRightTo()"); if(!$UserIDs) trigger_error("Invalid parameters \$UserIDs in ACL::getRightTo()"); if(substr($Mask,0,1)==1) $pfilter .= " AND SUBSTRING(BIN(permission),1,1)='1'"; if(substr($Mask,1,1)==1) $pfilter .= " AND SUBSTRING(BIN(permission),2,1)='1'"; if(substr($Mask,2,1)==1) $pfilter .= " AND SUBSTRING(BIN(permission),3,1)='1'"; // Use case: Perhaps everyone has appropriate permissions // First, wee must to find out that the document has not everone permission $docloc = $db->one("SELECT tablename FROM ".UNIFIEDINDEXTABLE." WHERE unified_id={$UnifiedID}"); $rec = new Rec($env); if($docloc["tablename"]=="RECSTRUCTTABLE") $sql= "SELECT everyone FROM ".$rec->defineTableName(RECSTRUCTTABLE, "index")." WHERE unified_id={$UnifiedID} ".preg_replace("/\(permission\)/s","(everyone)",$pfilter).""; else $sql= "SELECT everyone FROM ".constant($docloc["tablename"])." WHERE unified_id={$UnifiedID} ".preg_replace("/\(permission\)/s","(everyone)",$pfilter).""; $res = $db->query($sql,0,1); $rec->destroy(); if( $db->lastNumRows() ) return true; // Use case: Everyone has not appropriate permissions // Gave list of user if(is_array($UserIDs)) { foreach ($UserIDs as $group) { $str .= "'{$group}',"; } $str = preg_replace("/,$/", "", $str); $sql = "SELECT id FROM `".PERMISSIONSTABLE."` WHERE unified_id={$UnifiedID} AND user in ({$str}) ".$pfilter; } else { if(!is_integer($UserIDs)) trigger_error("Invalid parameters \$UserIDs in getRightTo()"); $sql = "SELECT id FROM `".PERMISSIONSTABLE."` WHERE unified_id={$UnifiedID} AND user ='{$UserIDs}' ".$pfilter; } $db->query($sql); $res = $db->lastNumRows(); toLog("HERE","a"); toLog($sql,"a"); toLog($res,"a"); return (int)$res; } /** * find out permissions * * @param integer * @param string * @return boolean Success code */ function getPermissions($UnifiedID, $User) { global $db; $sql = "SELECT permission FROM `".PERMISSIONSTABLE."` WHERE unified_id={$UnifiedID} AND user ='{$User}' "; $data = $db->one($sql); return $data["permission"]; } /** * Update everyone permissions by UnifiedID * * @param array * @return * @access public */ function updateEveryone($UnifiedID, $Perm) { global $db, $env; if(!$UnifiedID) return false; $obj = new Model($env); if(strlen($Perm)==3) $Perm = bindec($Perm); $TableName = $obj->getTableNameByID($UnifiedID); switch($TableName) { case "RECSTRUCTTABLE": $rec = new Rec($env); $db->update("UPDATE ".$rec->defineTableName(RECSTRUCTTABLE, $obj->ParentID)." SET everyone='{$Perm}' WHERE unified_id={$UnifiedID}"); $rec->destroy(); break; case "DOCSTRUCTTABLE": $db->update("UPDATE ".DOCSTRUCTTABLE." SET everyone='{$Perm}' WHERE unified_id={$UnifiedID}"); break; } return 1; } /** * Merge ACL XMLs * @param string * @param string * @return string */ function mergeACLXML($ACLXML) { $dir = ROOT_PATH."plugins/acl/"; if(file_exists($dir)) { if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(preg_match("/\.xml$/isU", $file)) { $ExtraXML = trim(file_get_contents(ROOT_PATH."plugins/acl/".$file)); if(!preg_match("/^]*?)id=\"id_(\d+)\"/isU", $ExtraXML)) { trigger_error("Incorrect format of file pugins/acl/".$file, E_USER_WARNING); return $ACLXML; } // Case: insert before ID if(preg_match("/^]*?)beforeid=\"id_(\d+)\"/isU", $ExtraXML)) { preg_match("/^]*?beforeid=\"id_(\d+)\"/isU", $ExtraXML, $Match ); $ExtraXML = preg_replace("/ beforeid=\"id_(\d+)\"/isU", "", $ExtraXML ); if(!preg_match("/]*)>/isU", $ACLXML)) { trigger_error("There is not specified section ({$Match[1]})", E_USER_WARNING); return $ACLXML; } $ACLXML = preg_replace("/]*)>/isU", "\n".$ExtraXML."\n", $ACLXML); } else { // Case: the first element of his parent preg_match("/^]*)>/isU", $ACLXML)) { trigger_error("There is not specified section ({$paren_id})", E_USER_WARNING); return $ACLXML; } $ACLXML = preg_replace("/]*)>/isU", "\n".$ExtraXML, $ACLXML); } } } closedir($dh); } } } return $ACLXML; } /** * Check permission * * Use cases: * $this->checkPermission(MODIFYING, 7); * * @param binary Mask, that may be READING/MODIFYING/EXECUTING or complex READING|MODIFYING * @param integer Unified ID * @return boolean Success code */ function getInterfacesACL() { // Tree Building Optimization if(file_exists(ACLCACHEFILE) AND !file_exists(ROOT_PATH."plugins/acl") AND filemtime ( ACLCACHEFILE ) > filemtime ( ROOT_PATH."config/admintree.acl.xml" )) { return unserialize(file_get_contents(ACLCACHEFILE)); } if(!file_exists(ROOT_PATH."config/admintree.acl.xml")) trigger_error("File 'admintree.acl.xml' is not found in ACL::getInterfacesACL()", E_USER_ERROR); $FileContent = file_get_contents(ROOT_PATH."config/admintree.acl.xml"); if(file_exists(ROOT_PATH."plugins/acl")) $FileContent = $this->mergeACLXML($FileContent); if(!$FileContent) trigger_error("File 'admintree.acl.xml' is empty in ACL::getInterfacesACL()", E_USER_ERROR); $p = xml_parser_create(); xml_parse_into_struct($p,$FileContent,$vals,$index); xml_parser_free($p); if(!$vals OR !is_array($vals)) trigger_error("Parsing error in ACL::getInterfacesACL()", E_USER_ERROR); $LastKey = array(); foreach($vals as $el) { if(!isset($LastKey[$el["level"]])) $LastKey[$el["level"]] = ""; if($el["tag"]=="TREEITEM") { if(isset($el["attributes"]["VARIABLE"]) AND $el["attributes"]["VARIABLE"] AND $el["level"]>2) { if(!isset( $el["attributes"]["ID"] )) trigger_error("Incorrect 'admintree.acl.xml' in ACL::getInterfacesACL(). ID attribute is not found", E_USER_ERROR); if(!isset( $el["attributes"]["TITLEKEY"] )) trigger_error("Incorrect 'admintree.acl.xml' in ACL::getInterfacesACL(). TITLEKEY attribute is not found", E_USER_ERROR); if($el["type"]=="open") $LastKey[$el["level"]] = $el["attributes"]["VARIABLE"]; $InterfacesACL[ $el["attributes"]["VARIABLE"] ] ["id"] = $el["attributes"]["ID"]; $InterfacesACL[ $el["attributes"]["VARIABLE"] ] ["parent_var"] = $LastKey[$el["level"]-1]; $InterfacesACL[ $el["attributes"]["VARIABLE"] ] ["level"] = $el["level"]-2; $InterfacesACL[ $el["attributes"]["VARIABLE"] ] ["title"] = $el["attributes"]["TITLEKEY"]; $InterfacesACL[ $el["attributes"]["VARIABLE"] ] ["showinmenu"] = false; if(isset($el["attributes"]["SHOWINMENU"])) $InterfacesACL[ $el["attributes"]["VARIABLE"] ] ["showinmenu"] = $el["attributes"]["SHOWINMENU"]; } } if($el["tag"]=="GROUP") { $InterfacesACL[ $LastKey[$el["level"]-2] ]["permissions"][$el["attributes"]["NAME"]] = $el["attributes"]["PERMISSIONS"]; } } // Tree Building Optimization if( !file_exists(ROOT_PATH."plugins/acl") AND $fp = @fopen(ACLCACHEFILE, "w" )) { fwrite($fp, serialize($InterfacesACL)); fclose($fp); } return $InterfacesACL; } /** * Class destructor */ function destroy() { unset($this); } } ?>