function write($log_file_data, $string) { $log_dir = $log_file_data[0]; $log_name = $log_file_data[1]; $file_name = $log_dir . $log_name; if (!is_dir($log_dir)) { fs::mkdir($log_dir, 0775, true); } $oldumask = @umask(0); $file_existed = @file_exists($file_name); $log_file = @fopen($file_name, 'a'); if ($log_file) { $time = strftime("%b %d %Y %H:%M:%S", strtotime('now')); $notice = '[ ' . $time . " ]\n"; $user =& user::instance(); if (($user_id = $user->get_id()) != DEFAULT_USER_ID) { $notice .= '[ ' . $user_id . ' ] [ ' . $user->get_login() . ' ] [ ' . $user->get_email() . ' ] '; } $notice .= '[' . sys::client_ip() . '] [' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "]\n" . $string . "\n\n"; @fwrite($log_file, $notice); @fclose($log_file); if (!$file_existed) { @chmod($file_name, 0664); } @umask($oldumask); $result = true; } else { @umask($oldumask); $result = false; debug::write_error("Cannot open log file '{$file_name}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$file_name}' is disabled.", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, false); } return $result; }
public static function set($autoattendant) { $xml = FreeSwitch::setSection('autoattendant', $autoattendant['auto_attendant_id']); media::generateConfig($autoattendant, $xml); if (!empty($autoattendant['extension_context_id'])) { $xml->setAttributeValue('', 'digit-len', $autoattendant['extension_digits']); } $xml->setAttributeValue('', 'timeout', $autoattendant['timeout'] * 1000); $xml->setAttributeValue('', 'inter-digit-timeout', $autoattendant['digit_timeout'] * 1000); if (!empty($autoattendant['registry']['max-failures'])) { $xml->setAttributeValue('', 'max-failures', $autoattendant['registry']['max-failures']); } else { $xml->setAttributeValue('', 'max-failures', '3'); } $xml->deleteChildren(); if (!empty($autoattendant['extension_context_id'])) { $xml->update(sprintf('/entry[@action="menu-exec-app"][@name="catch_all"][@digits="\\/^([0-9]{%s})$\\/"][@param="execute_extension $1 XML context_%s"]', $autoattendant['extension_digits'], $autoattendant['extension_context_id'])); } foreach ($autoattendant['keys'] as $key) { if (!isset($key['digits'])) { continue; } if (!($transferString = fs::getTransferToNumber($key['number_id']))) { continue; } $xml->update(sprintf('/entry[@action="menu-exec-app"][@digits="%s"][@param="transfer %s"]', $key['digits'], $transferString)); } }
function _clean_up() { parent::_clean_up(); fs::rm(MEDIA_DIR); $this->db->sql_delete('file_object'); $this->db->sql_delete('media'); }
function _add_project_controllers(&$result) { $items = fs::find_subitems(PROJECT_DIR . '/core/controllers/', 'f', '', false); sort($items); foreach ($items as $item) { $class = $this->_clean_class_path($item); $result[$class] = $class; } }
function _get_ini_cache_size() { $size = 0; $files = fs :: find_subitems(CACHE_DIR, 'f'); foreach($files as $file) $size += filesize($file); return $size; }
function _get_directory_file_size($dir) { $size = 0; $files = fs :: find($dir, 'f'); foreach($files as $file) $size += filesize($file); return $size; }
public function actionOperation() { Yii::import('mod.core.components.fs'); if (isset($_GET['operation'])) { //$fs = new fs(dirname(__FILE__) . DS . 'data' . DS . 'root' . DS); $fs = new fs(Yii::getPathOfAlias('webroot.themes')); try { $rslt = null; switch ($_GET['operation']) { case 'get_node': $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; $rslt = $fs->lst($node, isset($_GET['id']) && $_GET['id'] === '#'); break; case "get_content": $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; $rslt = $fs->data($node); break; case 'create_node': $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; $rslt = $fs->create($node, isset($_GET['text']) ? $_GET['text'] : '', !isset($_GET['type']) || $_GET['type'] !== 'file'); break; case 'rename_node': $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; $rslt = $fs->rename($node, isset($_GET['text']) ? $_GET['text'] : ''); break; case 'delete_node': $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; $rslt = $fs->remove($node); break; case 'move_node': $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; $parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? $_GET['parent'] : '/'; $rslt = $fs->move($node, $parn); break; case 'copy_node': $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; $parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? $_GET['parent'] : '/'; $rslt = $fs->copy($node, $parn); break; default: throw new Exception('Unsupported operation: ' . $_GET['operation']); break; } header('Content-Type: application/json; charset=utf-8'); echo json_encode($rslt); } catch (Exception $e) { header($_SERVER["SERVER_PROTOCOL"] . ' 500 Server Error'); header('Status: 500 Server Error'); echo $e->getMessage(); } die; } }
/** * Writes a compiled template file * * @param string $ filename * @param string $ content to write to the file * @return void * @access protected */ function write_template_file($file, $data) { if (!is_dir(dirname($file))) { fs::mkdir(dirname($file), 0777, true); } $fp = fopen($file, "wb"); if (fwrite($fp, $data, strlen($data))) { fclose($fp); } }
function _add_project_site_objects(&$result) { $items = fs :: find_subitems(PROJECT_DIR . '/core/model/site_objects/', 'f', '', false); foreach($items as $item) { $class = $this->_clean_class_path($item); $result[$class] = $class; } }
function perform(&$request, &$response) { $files = fs :: find(VAR_DIR . '/compiled', 'f'); foreach($files as $file) unlink($file); if($request->has_attribute('popup')) $response->write(close_popup_response($request)); $request->set_status(REQUEST_STATUS_SUCCESS); }
function get_classes_list() { $contents = array_merge(fs::ls(LIMB_DIR . '/core/model/site_objects/'), fs::ls(PROJECT_DIR . '/core/model/site_objects/')); $classes_list = array(); foreach ($contents as $file_name) { if (substr($file_name, -10, 10) == '.class.php') { $classes_list[] = substr($file_name, 0, strpos($file_name, '.')); } } return $classes_list; }
function perform(&$request, &$response) { $files = fs::find_subitems(CACHE_DIR, 'f'); foreach ($files as $file) { unlink($file); } if ($request->has_attribute('popup')) { $response->write(close_popup_response($request)); } $request->set_status(REQUEST_STATUS_SUCCESS); }
/** * Register module * @throws modules_exception * @return object|bool module */ public function register($module) { core::dprint('[mod_register] ' . $module); $module_class = loader::CLASS_PREFIX . $module; $module_path = loader::get_root() . loader::DIR_MODULES . $module . '/'; $module_file = $module_path . 'module' . loader::DOT_PHP; if (!fs::file_exists($module_file)) { throw new modules_exception('Failed to register module ' . $module . '. File does not exists'); } require_once $module_file; $this->set($module, new $module_class($module_path)); return $this->get($module); }
public static function set($autoattendant) { $xml = FreeSwitch::setSection('autoattendant', $autoattendant['auto_attendant_id']); if (empty($autoattendant['registry']['mediafile_id']) or !class_exists('Media')) { $type = 'tty'; } else { $type = $autoattendant['registry']['type']; } switch ($type) { case 'audio': $xml->setAttributeValue('', 'greet-long', Media::getMediaFile($autoattendant['registry']['mediafile_id'])); $xml->setAttributeValue('', 'greet-short', Media::getMediaFile($autoattendant['registry']['mediafile_id'])); break; default: if (empty($autoattendant['registry']['tts_string'])) { $tts_string = 'Thank you for calling, your call is important to us.'; } else { $tts_string = $autoattendant['registry']['tts_string']; } $tts_string = 'say:' . preg_replace('/[^A-Za-z0-9.,!? ]/', '', $tts_string); $xml->setAttributeValue('', 'tts-engine', 'flite'); $xml->setAttributeValue('', 'tts-voice', 'kal'); $xml->setAttributeValue('', 'greet-long', $tts_string); $xml->setAttributeValue('', 'greet-short', $tts_string); } if (!empty($autoattendant['extension_context_id'])) { $xml->setAttributeValue('', 'digit-len', $autoattendant['extension_digits']); } $xml->setAttributeValue('', 'timeout', $autoattendant['timeout'] * 1000); $xml->setAttributeValue('', 'inter-digit-timeout', $autoattendant['digit_timeout'] * 1000); if (!empty($autoattendant['registry']['max-failures'])) { $xml->setAttributeValue('', 'max-failures', $autoattendant['registry']['max-failures']); } else { $xml->setAttributeValue('', 'max-failures', '3'); } $xml->deleteChildren(); if (!empty($autoattendant['extension_context_id'])) { $xml->update(sprintf('/entry[@action="menu-exec-app"][@name="catch_all"][@digits="\\/^([0-9]{%s})$\\/"][@param="execute_extension $1 XML context_%s"]', $autoattendant['extension_digits'], $autoattendant['extension_context_id'])); } foreach ($autoattendant['keys'] as $key) { if (!isset($key['digits'])) { continue; } if (!($transferString = fs::getTransferToNumber($key['number_id']))) { continue; } $xml->update(sprintf('/entry[@action="menu-exec-app"][@digits="%s"][@param="transfer %s"]', $key['digits'], $transferString)); } }
function clear_static() { if (!$this->get_domain()) { return false; } $root = core::module('sat')->get_static_root($this); $data = array(); fs::build_tree($root, $data); foreach ($data['files'] as $f) { fs::unlink($f); } $data['dirs'] = array_reverse($data['dirs']); foreach ($data['dirs'] as $f) { fs::unlink($f, true); } }
public static function dialplan($number) { $xml = Telephony::getDriver()->xml; $destination = $number['Destination']; if (!empty($destination['time'])) { $parts = explode(';', $destination['time']); if (count($parts) != 2) { kohana::log('error', 'Time was not comprised of two parts'); return FALSE; } if ($parts[0] == $parts[1]) { $time = $parts; } else { $time = $parts[0] . '-' . $parts[1]; } } else { kohana::log('error', 'Time of day route had no time'); return FALSE; } $weekDayColumns = array('sun', 'mon', 'tue', 'wen', 'thur', 'fri', 'sat'); $wday = ''; foreach ($weekDayColumns as $pos => $weekDayColumn) { if (!empty($destination[$weekDayColumn])) { $wday .= $pos + 1 . ','; } } $wday = rtrim($wday, ','); // TODO: This makes no sense.... if (empty($wday)) { $wday = '1-7'; } $xml->setXmlRoot($xml->getExtensionRoot()); $xml->update('/condition[@wday="' . $wday . '"]{@minute-of-day="' . $time . '"}'); if ($action = fs::getTransferToNumber($destination['during_number_id'])) { $action = str_replace('transfer ', '', $action); $xml->update('/condition[@wday="' . $wday . '"]/action[@application="transfer"]{@data="' . $action . '"}'); } else { $xml->update('/condition[@wday="' . $wday . '"]/action[@application="hangup"]'); } if ($antiAction = fs::getTransferToNumber($destination['outside_number_id'])) { $antiAction = str_replace('transfer ', '', $antiAction); $xml->update('/condition[@wday="' . $wday . '"]/anti-action[@application="transfer"]{@data="' . $antiAction . '"}'); } else { $xml->update('/condition[@wday="' . $wday . '"]/action[@application="hangup"]'); } }
static function create($options) { if (isset($options->cache)) { $cache = $options->cache . 'cache.tmp'; if ($www = fs::read($cache)) { $www = unserialize($www); $www->locale->setup($options->language, $options->country); return $www; } else { $www = new www($options); fs::write($cache, serialize($www)); return $www; } } else { return new www($options); } }
public static function dialplan($number) { $xml = Telephony::getDriver()->xml; $destination = $number['Destination']; if ($destination instanceof Device) { $domain = '$${location_' . $destination['User']['location_id'] . '}'; $numberOptions = fs::getNumberOptions($number); $xml->update('/action[@application="set"][@bluebox="settingTimeout"]{@data="call_timeout=' . $numberOptions['timeout'] . '"}'); $xml->update('/action[@application="set"][@bluebox="settingRing"]{@data="ringback=' . $numberOptions['ringtype'] . '"}'); $xml->update('/action[@application="set"][@bluebox="settingRingXfer"]{@data="transfer_ringback=' . $numberOptions['ringtype'] . '"}'); if (!empty($destination['plugins']['callerid']['internal_name'])) { $xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['plugins']['callerid']['internal_name'] . '"}'); } else { $xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['name'] . '"}'); } $xml->update('/action[@application="export"][@bluebox="sipCalleeIdNumber"]{@data="sip_callee_id_number=' . $number['number'] . '"}'); $xml->update('/action[@application="bridge"]{@data="user\\/' . $destination['plugins']['sip']['username'] . '@' . $domain . '"}'); } }
/** * Create a database handle * Factory method * @param array params */ public static function get(array $config) { $engine = $config['engine']; if (isset(self::$dbs[$engine])) { return self::$dbs[$engine]; } $engine_script = loader::get_root() . loader::DIR_MODULES . 'core/dbal/' . $engine . loader::DOT_PHP; core::dprint('[db] ' . $engine_script); fs::req($engine_script, true); if (!isset($config['server'])) { $config['server'] = 'localhost'; } // create instance $class = "{$engine}_db"; try { return self::$dbs[$engine] = new $class($config['server'], $config['login'], $config['password'], $config['database'], $config['prefix']); } catch (dbal_exception $e) { return false; } }
static function create($options) { if (isset($options->cache)) { $cache = $options->cache . 'cache.tmp'; if ($www = fs::read($cache)) { $www = unserialize($www); $www->bind(); return $www; } else { $www = new www($options); fs::write($cache, serialize($www)); $www->bind(); return $www; } } else { $www = new www($options); $www->bind(); return $www; } }
public static function dialplan($number) { $xml = Telephony::getDriver()->xml; $destination = $number['Destination']; if ($destination instanceof Device) { $domain = '$${location_' . $destination['User']['location_id'] . '}'; $numberOptions = fs::getNumberOptions($number); $xml->update('/action[@application="set"][@bluebox="settingTimeout"]{@data="call_timeout=' . $numberOptions['timeout'] . '"}'); $xml->update('/action[@application="set"][@bluebox="settingRing"]{@data="ringback=' . $numberOptions['ringtype'] . '"}'); $xml->update('/action[@application="set"][@bluebox="settingRingXfer"]{@data="transfer_ringback=' . $numberOptions['ringtype'] . '"}'); if (!empty($destination['plugins']['callerid']['internal_name'])) { $xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['plugins']['callerid']['internal_name'] . '"}'); } else { $xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['name'] . '"}'); } $xml->update('/action[@application="export"][@bluebox="sipCalleeIdNumber"]{@data="sip_callee_id_number=' . $number['number'] . '"}'); if (arr::get($destination, 'plugins', 'sip', 'sip_invite_format') == Sip_Plugin::SIP_FORMAT_DIGITS) { $xml->update('/action[@application="export"][@bluebox="settingXmlInviteFormat"]{@data="sip_invite_req_uri=sip:' . $number['number'] . '${regex(${sofia_contact(' . $destination['plugins']['sip']['username'] . '\\@' . $domain . ')}|(\\@.*)|$1)}"}'); } else { $xml->deleteNode('/action[@application="export"][@bluebox="settingXmlInviteFormat"]'); } $condition = '/condition[@field="${privacy_hide_number}"][@expression="false"][@break="never"]'; $extenRoot = $xml->getExtensionRoot(); //If allowing multi sip interfaces, then we need to change the @data field with sofia_contact. $dataString = 'user\\/' . $destination['plugins']['sip']['username'] . '@' . $domain; if (arr::get($destination, 'registry', 'multi_sipinterface')) { $dataString = '${sofia_contact(*\\/' . $destination['plugins']['sip']['username'] . '@' . $domain . ')}'; } if (arr::get($destination, 'registry', 'anonymous_reject')) { $xml->setXmlRoot($extenRoot . $condition); //$xml->update('/action[@application="bridge"]{@data="user\/' .$destination['plugins']['sip']['username'] .'@' .$domain .'"}'); $xml->update('/action[@application="bridge"]{@data="' . $dataString . '"}'); $xml->setXmlRoot($extenRoot . '/condition[@bluebox="no_answer"]'); } else { //$xml->update('/action[@application="bridge"]{@data="user\/' .$destination['plugins']['sip']['username'] .'@' .$domain .'"}'); $xml->update('/action[@application="bridge"]{@data="' . $dataString . '"}'); $xml->deleteNode($extenRoot . $condition); $xml->deleteNode($extenRoot . '/condition[@bluebox="no_answer"]'); } } }
public static function dialplan($number) { $xml = Telephony::getDriver()->xml; $destination = $number['Destination']; switch ($destination['strategy']) { case RingGroup::STRATEGY_SEQUENTIAL: $memberSeperator = '|'; break; case RingGroup::STRATEGY_ENTERPRISE: $memberSeperator = ':_:'; break; case RingGroup::STRATEGY_PARALLEL: default: $memberSeperator = ','; } $numberOptions = fs::getNumberOptions($number); $xml->update('/action[@application="set"][@bluebox="settingTimeout"]{@data="call_timeout=' . $numberOptions['timeout'] . '"}'); $xml->update('/action[@application="set"][@bluebox="settingRing"]{@data="ringback=' . $numberOptions['ringtype'] . '"}'); $xml->update('/action[@application="set"][@bluebox="settingRingXfer"]{@data="transfer_ringback=' . $numberOptions['ringtype'] . '"}'); $xml->update('/action[@application="export"][@bluebox="sipCalleeIdName"]{@data="sip_callee_id_name=' . $destination['name'] . '"}'); $xml->update('/action[@application="export"][@bluebox="sipCalleeIdNumber"]{@data="sip_callee_id_number=' . $number['number'] . '"}'); $xml->update('/action[@application="export"][@bluebox="settingContinueOnTimeout"]{@data="originate_continue_on_timeout=true"}'); $dialstring = ''; foreach ($destination['members'] as $member) { if (!empty($member['options']) or !empty($numberOptions['timeout'])) { $dialstring .= '['; foreach ($member['options'] as $parameter => $value) { $dialstring .= $parameter . '=' . $value . ','; } if (!empty($numberOptions['timeout'])) { $dialstring .= 'leg_timeout=' . $numberOptions['timeout']; } $dialstring = rtrim($dialstring, ',') . ']'; } $dialstring .= $member['bridge'] . $memberSeperator; } $dialstring = substr($dialstring, 0, strlen($memberSeperator) * -1); $dialstring = str_replace('/', '\\/', $dialstring); $dialstring = str_replace('@', '\\@', $dialstring); $xml->update('/action[@application="bridge"]{@data="' . $dialstring . '"}'); }
/** * Create a database handle * Factory method * @param array params * engine - pdo * type - mysql */ public static function get(array $config) { require_once 'modules/core/dbal/dbal.php'; $engine = $config['engine']; $type = @$config['type']; $key = $engine . $type; if (isset(self::$dbs[$key])) { return self::$dbs[$key]; } $engine_script = loader::DIR_MODULES . 'core/dbal/' . $engine . loader::DOT_PHP; core::dprint('[db] ' . $engine_script); fs::req($engine_script, true); // create instance $class = "{$engine}_db"; try { return self::$dbs[$key] = new $class($config); } catch (dbal_exception $e) { core::dprint($e->getMessage()); return false; } }
function &_getRecursiveFileList($directory, $file_test_function) { if (!is_dir($directory)) { return array(); } $dh = opendir($directory); $file_list = array(); while ($file = readdir($dh)) { $file_path = $directory . '/' . $file; if (0 === strpos($file, '.')) { continue; } if (is_dir($file_path)) { $file_list = array_merge($file_list, $this->_getRecursiveFileList($file_path, $file_test_function)); } if ($file_test_function[0]->{$file_test_function}[1]($file)) { $file_list[] = fs::clean_path($file_path); } } closedir($dh); return $file_list; }
function _update_media_record($id, $tmp_file_path, $file_name, $mime_type) { if (!file_exists($tmp_file_path)) { debug::write_error('file doesnt exist', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('tmp' => $tmp_file_path)); return false; } if (function_exists('md5_file')) { $etag = md5_file($tmp_file_path); } else { $fd = fopen($data['tmp_name'], 'rb'); $contents = fread($fd, filesize($tmp_file_path)); fclose($fd); $etag = md5($contents); } fs::mkdir(MEDIA_DIR); if (!copy($tmp_file_path, MEDIA_DIR . $id . '.media')) { debug::write_error('temporary file copy failed', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('src' => $tmp_file_path, 'dst' => MEDIA_DIR . $id . '.media')); return false; } $media_db_table = db_table_factory::instance('media'); $media_db_table->update_by_id($id, array('file_name' => $file_name, 'mime_type' => $mime_type, 'size' => filesize($tmp_file_path), 'etag' => $etag)); $this->set_attribute('etag', $etag); return true; }
/** * Create handle * @param array params */ public static function factory($parms = 'smarty') { $smarty = false; // $test = loader::$root_path . loader::DIR_MODULES . 'core/tplparser/smarty/Smarty.class.php'; $test = loader::get_root() . loader::DIR_EXT . 'smarty/Smarty.class.php'; if (fs::file_exists($test)) { require $test; $smarty = new Smarty(); $smarty->compile_check = true; $smarty->force_compile = false; // true; $template = core::get_instance()->get_cfg_var('template'); $smarty->caching = false; //TRUE; //$smarty->cache_lifetime = 3600; $smarty->debugging = core::get_instance()->get_cfg_var('debug_templates'); } else { $smarty = new tplparser_mock(); core::dprint('[tplparser] using mock'); } self::$parser = $smarty; self::set_template($template); return $smarty; }
function camila_export_action_select() { global $_CAMILA; $mySelect = new CHAW_select('camila_export_action'); require_once 'fs.class.php'; $fs = new fs($_CAMILA['adm_user_group']); $mySelect->add_option(camila_get_translation('camila.export.download'), 'download'); if (!CAMILA_FM_EXTFS_ENABLED) { if (!CAMILA_FM_EXPORT_SAVETO_DISABLED) { $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents'), '/', $_REQUEST['camila_export_last_action'] == '/' ? HAW_SELECTED : HAW_NOTSELECTED); $arr = $fs->scandir(CAMILA_FM_ROOTDIR, true, false); sort($arr); foreach ($arr as $value) { $item = substr($value, strlen(CAMILA_FM_ROOTDIR) + 1); if ($item != camila_get_translation('camila.documents.recyclebin')) { if ('/' . $item == $_REQUEST['camila_export_last_action']) { $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $item, '/' . $item, HAW_SELECTED); } else { $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $item, '/' . $item); } } } } } else { $node = $fs->_tree_get_group_root_node($_CAMILA['adm_user_group']); $attributes = array('name'); $wlk = $fs->_tree_walk_preorder($node); while ($curr = $fs->_tree_walk_next($wlk)) { $level = $fs->_tree_walk_level($wlk); $spaces = str_repeat('--', $level - 1); $att = reset($attributes); while ($att) { if ($level == 0) { $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents'), $wlk['row']['id']); } elseif ($wlk['row']['file'] == '') { $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $spaces . $wlk['row'][$att], $wlk['row']['id']); } $att = next($attributes); } } } return $mySelect; }
/** * on editor action * * Called in editor to module * * @return array( * 'layout' = false * 'template' = false * ) */ function on_editor() { core::lib('editor')->assign_module_menu($this->get_editor_actions()); // Controller action $controller_action = ''; // modify ident var 'c' (if empty) if (empty(core::get_params()->c) && !empty($this->editor_default_action)) { core::get_params()->c = $this->editor_default_action; } $controller_action = preg_replace('/[^a-z\\d\\_]/i', '', core::get_params()->c); core::dprint("on_editor controller: " . $controller_action); if (empty($controller_action)) { throw new editor_exception('Empty action'); } // check user has access core::lib('editor')->on_editor($this); // dispatch if (!empty($controller_action)) { $controller_action_file = $this->root_dir . "editor/controllers/{$controller_action}" . loader::DOT_PHP; if (fs::file_exists($controller_action_file, false)) { require $controller_action_file; // run controller object, if present $controller_class = $this->get_name() . '_' . $controller_action . '_controller'; if (class_exists($controller_class, 0)) { core::dprint("run controller object : {$controller_class}"); /** @var editor_controller $controller */ $controller = new $controller_class($this); $controller->run(); $layout = $controller->get_layout(); $template = $controller->get_template(); $this->renderer->set_page_template($layout)->set_main_template($template); } else { throw new core_exception('Bad controller class name ' . $controller_class); } } else { core::dprint('[ERROR] Unable to execute ' . $controller_action_file); } } /* @return main template */ /* return array( 'layout' => $layout, 'template' => $template ); */ }
function get_cache_size() { fs::mkdir(PAGE_CACHE_DIR); $files = fs::find_subitems(PAGE_CACHE_DIR, 'f', '~^[^p]~'); $size = 0; foreach ($files as $file) { $size += filesize($file); } return $size; }
function get_cache_size() { $files = fs :: find_subitems(IMAGE_CACHE_DIR, 'f'); $size = 0; foreach($files as $file) { $size += (filesize($file)); } return $size; }