public function load($key) { $data = $this->redis->get($key); if (\cx\application\main_functions::is_serialized($data) === true) { $data = cx\app\main_functions::safe_unserialize($data); } return $data; }
function format_rights($rights) { $rights = cx\app\main_functions::is_serialized($rights) === true ? cx\app\main_functions::safe_unserialize($rights) : $rights; if (is_array($rights)) { $out = ''; foreach ($rights as $right) { $out .= $right . ", "; } return rtrim($out, ', '); } return $rights; }
public function load($key) { $files = glob(DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\\._-]/i', '', $key) . '.*'); if ($files) { $handle = fopen($files[0], 'r'); flock($handle, LOCK_SH); $data = fread($handle, filesize($files[0])); flock($handle, LOCK_UN); fclose($handle); return cx\app\main_functions::safe_unserialize($data); } return false; }
public function main() { $this->set_title_and_header('Main Page'); $index = $this->get_url('app/home', 'index'); $this->breadcrumb = array($index => "Index"); $this->active_crumb = "Main"; $id = $this->session->get_int(CX_LOGIN . 'id'); /** * @todo add api check / auth */ if ($this->request->is_not_valid_id($id)) { cx_redirect_url($this->get_url('/app/' . DEFAULT_PROJECT, 'login')); } $page['fname'] = $this->session->session_var(CX_LOGIN . 'fname'); $page['lname'] = $this->session->session_var(CX_LOGIN . 'lname'); $rights = $this->session->session_var(CX_LOGIN . 'rights'); $page['rights'] = cx\app\main_functions::is_serialized($rights) === true ? cx\app\main_functions::safe_unserialize($rights) : $rights; $this->load_view('app' . DS . 'main', $page); }