public function process() { if (Hm_Page_Cache::get('nux_dev_news')) { $this->out('nux_dev_news', Hm_Page_Cache::get('nux_dev_news')); return; } $ch = Hm_Functions::c_init(); $res = array(); Hm_Functions::c_setopt($ch, CURLOPT_URL, 'http://cypht.org/git.txt'); Hm_Functions::c_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $curl_result = Hm_Functions::c_exec($ch); if (trim($curl_result)) { foreach (explode("\n", $curl_result) as $line) { if (preg_match("/^([a-z0-9]{40})\\|([a-z0-9]{7})\\|([^\\|]+)\\|([^\\|]+)\\|([^\\|]+)\$/", $line, $matches)) { $res[] = array('hash' => $matches[1], 'shash' => $matches[2], 'name' => $matches[3], 'age' => date('D, M d', strtotime($matches[4])), 'note' => $matches[5]); } } } Hm_Page_Cache::add('nux_dev_news', $res); $this->out('nux_dev_news', $res); }
/** * Close and save the session * @return bool true if the session is active */ private function save_session() { $res = $this->session->is_active(); Hm_Page_Cache::save($this->session); $this->session->end(); return $res; }
/** * Load cached pages from session data * @param object $session session interface * @return void */ public static function load($session) { self::$pages = $session->get('page_cache', array()); self::$pages = array_merge(self::$pages, $session->get('saved_pages', array())); }
/** * Perform a new login if the form was submitted, otherwise check for and continue a session if it exists */ public function process() { if (!$this->get('create_username', false)) { list($success, $form) = $this->process_form(array('username', 'password')); if ($success) { $this->session->check($this->request, rtrim($form['username']), $form['password']); $this->session->set('username', rtrim($form['username'])); } else { $this->session->check($this->request); } if ($this->session->is_active()) { Hm_Page_Cache::load($this->session); $this->out('changed_settings', $this->session->get('changed_settings', array()), false); } } Hm_Request_Key::load($this->session, $this->request, $this->session->loaded); $this->process_key(); }
/** * Remove an IMAP server completely, used on the servers page */ public function process() { if (isset($this->request->post['imap_delete'])) { list($success, $form) = $this->process_form(array('imap_server_id')); if ($success) { $res = Hm_IMAP_List::del($form['imap_server_id']); if ($res) { $this->out('deleted_server_id', $form['imap_server_id']); Hm_Msgs::add('Server deleted'); $this->session->record_unsaved('IMAP server deleted'); Hm_Page_Cache::flush($this->session); } } else { $this->out('old_form', $form); } } }
public function process() { $content = ''; $headers = array(); list($success, $form) = $this->process_form(array('feed_uid', 'feed_list_path')); if ($success) { $path = explode('_', $form['feed_list_path']); $id = $path[1]; $cache = Hm_Page_Cache::get($id . '_' . $form['feed_uid']); $feed_items = array(); if ($cache) { $feed_items = array($cache); } else { $feed_data = Hm_Feed_List::dump($id); if ($feed_data) { $feed = is_feed($feed_data['server']); if ($feed && $feed->parsed_data) { $feed_items = $feed->parsed_data; } } } foreach ($feed_items as $item) { if (isset($item['id']) && !isset($item['guid'])) { $item['guid'] = $item['id']; unset($item['id']); } elseif (isset($item['title']) && !isset($item['guid'])) { $item['guid'] = md5($item['title']); } if (isset($item['guid']) && md5($item['guid']) == $form['feed_uid']) { if (isset($item['description'])) { $content = $item['description']; unset($item['description']); } elseif (isset($item['summary'])) { $content = $item['summary']; unset($item['summary']); } $title = $item['title']; $headers = $item; unset($headers['title']); $headers = array_merge(array('title' => $title), $headers); if (!$cache) { Hm_Page_Cache::add($id . '_' . md5($item['guid']), $item, true); } break; } } if ($content) { Hm_Feed_Uid_Cache::read($form['feed_uid']); $this->out('feed_message_content', $content); $this->out('feed_message_headers', $headers); } } }