public function getContentByName($name, $options = array()) { $this->options = array_merge($this->options, $options); $WebPage = new Webpage(); $webpage = $WebPage->findByName($name); return $this->_parseOptions($webpage, $options); }
/** * @return array: */ public function findAllQuestionIds() { $allLinks = array(); $maxScrapes = $this->maxScrapes; do { $this->webpage->setUrlToNextPage(); $links = $this->scrapeCurrentUrlForQuestionIds(); $allLinks = array_merge($allLinks, $links); } while (--$maxScrapes !== 0 && !empty($links)); return array_unique($allLinks); }
public function __construct() { parent::__construct(); $this->breadcrumbs[] = array('text' => 'App List', 'link' => '/apps/apps'); if (isset($sideNav_current)) { $this->smarty->assign('sideNav_current', $sideNav_current); } $this->tab_current = 'apps'; }
public function webpage_statistics($webpage_id) { //取出domain list $this->load->library('kals_resource/Domain'); $all_domains = $this->domain->find_all(); $this->load->library('kals_resource/Webpage'); $webpage = new Webpage($webpage_id); $domain = $webpage->get_domain(); $all_webpages = $domain->get_webpages(); //取出domain list $this->load->library('kals_resource/Domain'); $all_domains = $this->domain->find_all(); $title = 'webpage_view'; $this->load->view('admin_apps/header', array('title' => $title)); $this->load->view('admin_apps/domain_select', array('all_domains' => $all_domains, 'selected_domain' => $domain)); $this->load->view('admin_apps/webpage_select', array('all_webpages' => $all_webpages, 'selected_webpage' => $webpage)); $this->load->view('admin_apps/webpage_statistics', array('webpage' => $webpage)); $this->load->view('admin_apps/footer'); }
/** * 取得原本網站的網址 * @param Int $webpage_id * @param Int $topic_id * @param Int $annotation_id * @return string */ private function _get_webpage_url($webpage_id, $topic_id, $annotation_id) { // 轉接到網站 $this->load->library('kals_resource/Webpage'); $webpage = new Webpage($webpage_id); $url = $webpage->get_url(); /* $url = $url . "#mobile=true"; if (isset($topic_id)) { $url = $url . "&topic_id=" . $topic_id; } if (isset($annotation_id)) { $url = $url . "&annotation_id=" . $annotation_id; } */ return $url; }
public function __construct() { parent::__construct(); if (!isset($_GET['end]']) && !isset($_GET['start']) && isset($_SESSION['start']) && isset($_SESSION['end'])) { $this->endDate = $_SESSION['end']; $this->startDate = $_SESSION['start']; } else { $this->endDate = isset($_GET['end']) ? $_GET['end'] : date('Y-m-d'); $this->startDate = isset($_GET['start']) ? $_GET['start'] : date('Y-m-d', strtotime('-7 day')); } $_SESSION['start'] = $this->startDate; $_SESSION['end'] = $this->endDate; fb($_SESSION); $this->selectedDate = '?start=' . $this->startDate . '&end=' . $this->endDate; $days = (strtotime($this->endDate, 0) - strtotime($this->startDate, 0)) / (60 * 60 * 24); if ($days < 2) { $this->interval = '+ 3hour'; } elseif ($days < 8) { $this->interval = '+ 1day'; } elseif ($days < 31) { $this->interval = '+ 3day'; } elseif ($days < 91) { $this->interval = '+ 15day'; } elseif ($days < 366) { $this->interval = '+ 30day'; } elseif ($days < 730) { $this->interval = '+ 60day'; } else { $this->interval = '+ ' . floor($days / 365) * 30 . 'day'; } fb("interval", $this->interval); $this->dateOptions = array('?start=' . date('Y-m-d', strtotime('-7 day')) . '&end=' . date('Y-m-d') => 'Last 7 days', '?start=' . date('Y-m-d', strtotime('-30 day')) . '&end=' . date('Y-m-d') => 'Last 30 days', '?start=' . date('Y-m-d', strtotime('-90 day')) . '&end=' . date('Y-m-d') => 'Last 90 days', '?start=' . date('Y-m-d', strtotime('-365 day')) . '&end=' . date('Y-m-d') => 'Last 365 days'); $this->breadcrumbs[] = array('text' => 'Reports', 'link' => '/reports/applicationReports'); $this->tab_current = 'reports'; $this->jsFiles[] = "/FusionCharts/FusionCharts.js"; }
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ function __autoload($class_name) { require_once $class_name . '.php'; } $user = new User(); $page = new Webpage("Remove User Event", $user); $C = new Connection(); $eID = $page->_GET_checkEventID($_GET['event'], $C, FALSE); if (!isset($eID)) { exit(0); } $uID = $user->get_UserID(); if (isset($_GET['confirm'])) { // they have confirmed they wish to delete the event $q = "DELETE FROM userSchedule WHERE us_userID = {$uID} AND us_eventID = {$eID};"; $C->query($q); $page->printError("Event removed successfully."); echo "<center>"; $page->addURL("userSchedule.php", "Return to your custom schedule."); echo "<br /><br />"; $page->addURL("index.php", "Return to event schedule.");
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ function __autoload($class_name) { require_once $class_name . '.php'; } $user = new User(); $page = new Webpage("Delete Event", $user); $connection = new Connection(); $eventID = $page->_GET_checkEventID($_GET['event'], $connection, FALSE); if (!isset($eventID)) { exit(0); } if ($user->is_Admin()) { if (isset($_GET['confirm'])) { // they want to delete it so lets delete it $query = "DELETE FROM events WHERE e_eventID = {$eventID};"; $connection->query($query); //also remove the event from user schedules $query = "DELETE FROM userSchedule WHERE us_eventID = {$eventID};"; $connection->query($query); $page->printError("Event successfully deleted."); echo "<center>";
public function __construct() { parent::__construct(); $this->breadcrumbs[] = array('text' => 'House Ads', 'link' => '/houseAds/houseAds'); $this->tab_current = 'houseAds'; }
/** * 取得我在班上的名次(以標註數量計算) * * @param Webpage $webpage * @param User $user * @return Int ranking * @author Wyfan 20141211 */ public function get_user_annotation_count_ranking($user, $webpage) { $webpage_id = $webpage->get_id(); $user_id = $user->get_id(); //------------------------------------- $this->db->from('user_annotation_count_ranking'); $this->db->select('rank'); $this->db->where('webpage_id', $webpage_id); $this->db->where('user_id', $user_id); //--------------------------------------- $query = $this->db->get(); //$user_annotation_count_rank = array(); $user_annotation_count_rank = 0; if ($query->num_rows() > 0) { $row = $query->row(); $user_annotation_count_rank = $row->rank; } //var_dump($row); return $user_annotation_count_rank; }
if (version_compare("5.2", PHP_VERSION, ">")) { die("PHP 5.2 or greater is required!!!"); } require_once APP_ROOT . '/includes/autoloader.inc.php'; // Load configuration require_once APP_ROOT . '/config.php'; if (!defined('PSI_CONFIG_FILE') || !defined('PSI_DEBUG')) { $tpl = new Template("/templates/html/error_config.html"); echo $tpl->fetch(); die; } // redirect to page with and without javascript $display = isset($_GET['disp']) ? $_GET['disp'] : strtolower(PSI_DEFAULT_DISPLAY_MODE); switch ($display) { case "static": $webpage = new WebpageXSLT(); $webpage->run(); break; case "dynamic": $webpage = new Webpage(); $webpage->run(); break; case "xml": $webpage = new WebpageXML(true, null); $webpage->run(); break; default: $tpl = new Template("/templates/html/index_all.html"); echo $tpl->fetch(); break; }
This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. this software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this software. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ require_once "../config/config_base.php"; require_once CONFIG_DIR . "/config_db.php"; require_once INC_DIR . "/autoload.function.php"; $p = new Webpage("Gestion des Types de Billets"); $p->appendCssUrl("../css/index.css"); $p->appendJsUrl("../lib/jquery.min.js"); $content = ""; if (isset($_GET['id']) && $_GET['id'] != null) { $request = new Request('SELECT', 'Utilisateur'); $request->setparams("id_user ,firstName, lastName"); $request->setConditions("id_user = "******"<p>" . $joueur['firstName'] . " " . $joueur['lastName'] . "</p>"; } } $p->appendContent($content); echo $p->toHTML();
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ function __autoload($class_name) { require_once $class_name . '.php'; } #first login info $user = new User(); $page = new Webpage("Add Event", $user); $connection = new Connection(); #only admins can add events if (!$user->is_Admin()) { $page->printError("Only Admins can create new events."); echo "<center>"; $page->addURL("index.php", "Return to event schedule."); echo "</center>"; exit(0); } if (isset($_GET['action']) && count($_POST) == 15) { //ok we'll add the entry here. $name = $connection->validate_string($_POST['name']); $name = trim($name); if (str_word_count($name) == 0) { $page->printError("Name cannot be blank.");
<?php /** * The page edit form. */ $page->layout = 'admin'; $this->require_acl('admin', 'admin/pages', 'admin/edit'); $lock = new Lock('Webpage', $_GET['page']); if ($lock->exists()) { $page->title = __('Editing Locked'); echo $tpl->render('admin/locked', $lock->info()); return; } else { $lock->add(); } $wp = new Webpage($_GET['page']); $f = new Form('post', 'admin/edit'); $f->verify_csrf = false; if ($f->submit()) { $wp->id = $_POST['id']; $wp->title = $_POST['title']; $wp->menu_title = $_POST['menu_title']; $wp->window_title = $_POST['window_title']; $wp->access = $_POST['access']; $wp->layout = $_POST['layout']; $wp->description = $_POST['description']; $wp->keywords = $_POST['keywords']; $wp->body = $_POST['body']; $wp->update_extended(); $wp->put(); if (!$wp->error) {
/** * Make sending email available to models (as well as controllers) * Subject and message have duel meanigns if it starts with webpages. we are using the db to genetrate the message were the subject is the recored we are using * * @param string String - address to send email to * @param sring $subject: subject of email |OR| Webpage to use as a template (eg. Webpages.name-of-template) * @param string $message['html'] in the layout will be replaced with this text |OR| data array available to use for message replacement * @param string $template to be picked from folder for email. By default, if $mail is given in any template. * @param array address/name pairs (e.g.: array(example@address.com => name, ...) * @param UNKNOWN Have not used it don't know what it does or if it works. * @return bool */ public function __sendMail($toEmail = null, $subject = null, $message = null, $template = 'default', $from = array(), $attachment = null) { if ($this->notifications !== false) { App::uses('AppController', 'Controller'); $Controller = new AppController(); if (is_array($subject)) { // a new and improved subject over the template, this one includes a fallback message if the template doesn't exist App::uses('Webpage', 'Webpages.Model'); $Webpage = new Webpage(); $name = str_replace('Webpages.', '', $subject['message']); $webpage = $Webpage->findByName($name); if (!empty($webpage)) { // $message should be something like this : array('SomeModel' => array('some_field' => 'some_value')); $message = $Webpage->replaceTokens($webpage['Webpage']['content'], $subject['data']); $subject = $webpage['Webpage']['title']; } elseif (!empty($toEmail) && !empty($subject['subjectFallback']) && !empty($subject['messageFallback'])) { // send the fallback return $Controller->__sendMail($toEmail, $subject['subjectFallback'], $subject['messageFallback'], $template, $from, $attachment); } else { throw new Exception(__('Please create an email template or fallback message.')); } } elseif (strpos($subject, 'Webpages.') === 0) { App::uses('Webpage', 'Webpages.Model'); $Webpage = new Webpage(); $name = str_replace('Webpages.', '', $subject); $webpage = $Webpage->findByName($name); if (!empty($webpage)) { // $message should be something like this : array('SomeModel' => array('some_field' => 'some_value')); $message = $Webpage->replaceTokens($webpage['Webpage']['content'], $message); $subject = $webpage['Webpage']['title']; } else { //Should we auto gen instead of throwing exception???? throw new Exception(__('Please create a email template named %s', $name)); } } return $Controller->__sendMail($toEmail, $subject, $message, $template, $from, $attachment); } return true; // return true when notifications are off, so that checks don't fail }
/** * webpage_list * @param Int $page 頁數 */ public function webpage_list($page = 1) { $this->load->library('kals_resource/Webpage'); $this->load->library('kals_resource/Domain'); $user = get_context_user(); $user_id = $user->get_id(); // get domain's all pages $data = array(); //$webpage_list = Domain::get_all_domain_webpages(); //$domain = new Domain(); //$all_webpages = $domain->get_all_domain_webpages(); //array $all_webpages = Webpage::get_all_webpages_order_by_read($user_id, $page - 1); //test_msg("all_webpage", count($all_webpages)); //echo $all_webpages; $data['all_webpages'] = array(); $webpage_array = array(); //換頁 $webpage_count = Webpage::get_all_webpages_count(); $page_count = ceil($webpage_count / 10); $next_page = $page + 1; $prev_page = -1; if ($page > 1 && $page < $page_count) { $next_page = $page + 1; $prev_page = $page - 1; } else { if ($page == $page_count) { $next_page = -1; $prev_page = $page - 1; } } $data['page'] = $page; $data['next_page'] = $next_page; $data['prev_page'] = $prev_page; //test_msg( 'context_id = '.get_context_user()->get_id() ); //test_msg( '$user->get_id = '.$user_id.'//' ); //test_msg( $this->session->userdata('logged_in') ); //test_msg( 'session_user_id ='.$this->session->userdata('user_id') ); if ($user_id !== 0) { $unread_search = $this->db->query("SELECT DISTINCT topic_annotation.webpage_id, count(topic_annotation.is_topic_id) AS unread\nFROM \n(SELECT webpage2annotation.webpage_id, annotation_id AS is_topic_id,\n MAX(CASE WHEN res.update_timestamp IS NULL THEN annotation.update_timestamp\n ELSE res.update_timestamp\n END)AS annotation_timestamp\nFROM annotation JOIN webpage2annotation using (annotation_id) \n LEFT JOIN ( \n SELECT webpage_id, annotation_id AS res_id, annotation.topic_id AS res_topic_id, annotation.update_timestamp\n FROM annotation JOIN webpage2annotation using (annotation_id) \n WHERE topic_id IS NOT NULL ) AS res ON (annotation.annotation_id = res.res_topic_id)\nWHERE annotation.topic_id IS NULL \nGROUP BY webpage2annotation.webpage_id, is_topic_id) AS topic_annotation\n\nLEFT JOIN\n\n(select \nuser_id, webpage_id, note, max(log_timestamp) AS log_timestamp\n from log\nwhere\nuser_id = '" . $user_id . "' and\n( action = '16' OR action = '40') \ngroup by user_id, webpage_id, note) AS log_view_thread\n\nON log_view_thread.note like concat('%\"topic_id\":' , topic_annotation.is_topic_id , '%')\n\nGROUP BY topic_annotation.webpage_id, annotation_timestamp, topic_annotation.is_topic_id\nHAVING max(log_timestamp) < annotation_timestamp OR max(log_timestamp) IS NULL"); $unread_array = array(); foreach ($unread_search->result_array() as $row) { $webpage_id = $row['webpage_id']; $unread = $row['unread']; // TST MSG //echo $webpage_id . " - " . $unread_count . " / <br />"; $unread_array[$webpage_id] = $unread; } } // array:$all_webpages value:array array中為webpage_id foreach ($all_webpages as $webpage) { // get page's title and id $webpage_id = $webpage->get_id(); $webpage_array['webpage_id'] = $webpage_id; //test_msg($webpage_id); //continue; //$webpage = new Webpage($webpage_id); $webpage_title = $webpage->get_title(); //echo 'msg= '.$webpage_title.'<br>'; //msg $webpage_array['webpage_title'] = $webpage_title; // get page's annotation count $annotation_count = $webpage->get_written_annotations_count(); //$annotation_count = 0; $webpage_array['annotation_count'] = $annotation_count; // 判斷有無read if ($user_id !== 0) { if (isset($unread_array[$webpage_id])) { $webpage_array['is_unread'] = 'inline'; } else { $webpage_array['is_unread'] = 'none'; } } else { $webpage_array['is_unread'] = 'none'; } $data['all_webpages'][] = $webpage_array; } // session test msg /*echo $this->session->userdata('user_id').'/'; echo $this->session->userdata('user_name').'/'; echo $this->session->userdata('logged_in');*/ $this->load->view('mobile/mobile_views_header'); $this->load->view('mobile/webpage_list_view', $data); $this->load->view('mobile/mobile_views_footer'); }
public function __construct(Escaper $escaper, HTML $html, Cipher $cipher) { parent::__construct($escaper, $html, $cipher); }
<?php require_once "autoload.function.php"; require_once "../config/config_db.php"; $p = new Webpage("Authentification"); $p->appendCssUrl('../css/index.css'); $p->appendBootstrap("../bootstrap"); if (!isset($_POST['mail']) || !isset($_POST['pass'])) { header('Location: formConnexion.php?err'); } else { $user = User::createFromAuth($_POST); if ($user == null) { header('Location: formConnexion.php?err'); } else { $p->appendContent(<<<HTML \t\t<p>Bonjour {$user->getFirstName()}</p> HTML ); } echo $p->toHTML(); }
<?php require_once "../inc/autoload.function.php"; require_once "../config/config_db.php"; $p = new Webpage("Hebergement"); $p->appendCssUrl('../css/index.css'); $p->appendJsUrl('../js/liens.js'); $p->appendBootstrap("../bootstrap"); $pdo = Connection_DB::getInstance(); $query = $pdo->prepare(<<<SQL \tSELECT id_hebergeur, id_hebergement, nom, description, id_adresse, image \tFROM Hebergement ; SQL ); $query->setFetchMode(PDO::FETCH_CLASS, "Hebergement"); $query->execute(); $tabHeb = $query->fetchAll(); foreach ($tabHeb as $heb) { $p->appendContent($heb->afficher()); } echo $p->toHTML();
<?php /** * Deletes a web page. */ $this->require_acl('admin', 'admin/pages', 'admin/delete'); $page->layout = 'admin'; if (!isset($_POST['page'])) { $this->redirect('/'); } $lock = new Lock('Webpage', $_POST['page']); if ($lock->exists()) { $page->title = __('Editing Locked'); echo $tpl->render('admin/locked', $lock->info()); return; } $wp = new Webpage($_POST['page']); $_POST = array_merge($_POST, (array) $wp->orig()); if (!$wp->remove()) { $page->title = __('An Error Occurred'); echo __('Error Message') . ': ' . $wp->error; return; } $cache->delete('_admin_page_' . $_POST['page']); $this->add_notification(__('Page deleted.')); $this->hook('admin/delete', $_POST); $this->redirect(isset($_POST['admin']) ? '/admin/pages' : '/');
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ function __autoload($class_name) { require_once $class_name . '.php'; } $connection = new Connection(); $user = new User(); $page = new Webpage("Test View Event", $user); $event = $page->_GET_checkEventID($_GET['event'], $connection); if ($event == NULL) { exit(0); } $page->printEvent($event); echo "<center>"; echo "<div id=\"addBox\">"; if ($user->is_User()) { // figure out if the event is already in the user's schedule $eventID = $event->getEventID(); $userID = $user->get_UserID(); $query = "\n\t\tSELECT us_eventID \n\t\tFROM userSchedule \n\t\tWHERE us_eventID = {$eventID}\n\t\t\tAND us_userID = {$userID};"; $connection->query($query); if ($connection->result_size() == 0) { $page->addURL("addUserEvent.php?event={$eventID}", "Add this event to your schedule.");
<?php /** * Show a list of all pages for admins. */ $this->require_acl('admin', 'admin/pages'); $page->layout = 'admin'; $page->title = __('Web Pages'); $limit = 20; $num = isset($_GET['offset']) ? $_GET['offset'] : 1; $offset = ($num - 1) * $limit; $q = isset($_GET['q']) ? $_GET['q'] : ''; // search query $q_fields = array('id', 'title', 'menu_title', 'window_title', 'access', 'keywords', 'description', 'body'); $q_exact = array('id', 'title', 'access'); $url = !empty($q) ? '/admin/pages?q=' . urlencode($q) . '&offset=%d' : '/admin/pages?offset=%d'; $lock = new Lock(); $pages = Webpage::query('id, title, access')->where_search($q, $q_fields, $q_exact)->order('title asc')->fetch_orig($limit, $offset); $count = Webpage::query()->where_search($q, $q_fields, $q_exact)->count(); foreach ($pages as $k => $p) { $pages[$k]->locked = $lock->exists('Webpage', $p->id); } echo $tpl->render('admin/pages', array('limit' => $limit, 'total' => $count, 'pages' => $pages, 'count' => count($pages), 'url' => $url, 'q' => $q));
<?php include '../inc/autoload.function.php'; $p = new Webpage("Inscription"); $p->appendCssUrl('../css/index.css'); $p->appendBootstrap("../bootstrap"); if (isset($_GET['pass'])) { $p->appendContent(<<<HTML \t<div class="alert alert-danger" role="alert"><b>Mots de passe incorrects</b></div> HTML ); } elseif (isset($_GET['mail'])) { $p->appendContent(<<<HTML \t<div class="alert alert-danger" role="alert"><b>Mail déjà utilisé</b></div> HTML ); } elseif (isset($_GET['login'])) { $p->appendContent(<<<HTML \t<div class="alert alert-danger" role="alert"><b>Pseudo déjà utilisé</b></div> HTML ); } $p->appendContent(<<<HTML \t<form class="form-horizontal" name="inscription" method="POST" action="../inc/inscription.php"> \t\t<div class="form-group"> \t\t\t<label for="lastName" class="col-sm-2 control-label">Nom *</label> \t\t\t<div class="col-sm-4"> \t\t\t\t<input class="form-control" name="lastName" type="text" required> \t\t\t</div> \t\t</div>
* The page edit form. */ $page->layout = 'admin'; if (!User::require_admin()) { $this->redirect('/admin'); } $lock = new Lock('Webpage', $_GET['page']); if ($lock->exists()) { $page->title = i18n_get('Editing Locked'); echo $tpl->render('admin/locked', $lock->info()); return; } else { $lock->add(); } require_once 'apps/admin/lib/Functions.php'; $wp = new Webpage($_GET['page']); $f = new Form('post', 'admin/edit'); $f->verify_csrf = false; if ($f->submit()) { $wp->id = $_POST['id']; $wp->title = $_POST['title']; $wp->menu_title = $_POST['menu_title']; $wp->window_title = $_POST['window_title']; $wp->access = $_POST['access']; $wp->layout = $_POST['layout']; $wp->description = $_POST['description']; $wp->keywords = $_POST['keywords']; $wp->body = $_POST['body']; $wp->put(); if (!$wp->error) { Versions::add($wp);
/** * 讀取RSS * * 範例:http://localhost/kals/web_apps/rss/webpage/1573 */ public function webpage($webpage_id = NULL) { if (is_null($webpage_id)) { $webpage = get_context_webpage(); $webpage_id = $webpage->get_id(); redirect("/web_apps/rss/webpage/" . $webpage_id); return; } $this->load->library('kals_resource/Webpage'); $this->load->library('kals_resource/Annotation'); $this->load->library('search/Search_annotation_collection'); $this->lang->load('kals_web_apps'); //語系 //echo $webpage_id; $webpage = new Webpage($webpage_id); //$search = $webpage->get_search_annotation(); $search = new Search_annotation_collection(); $search->set_target_webpage($webpage_id); $search->set_limit(10); $order_type_id = 6; $desc = TRUE; $search->add_order($order_type_id, $desc); // ------------------------------ // 以下開始建立RSS清單 // // 請使用php-rss-writer來建立 // // 專案首頁:https://github.com/suin/php-rss-writer // 程式碼位置:https://github.com/suin/php-rss-writer/tree/master/Source/Suin/RSSWriter // ------------------------------ $this->load->library("web_apps/Suin/RSSWriter/Feed"); $this->load->library("web_apps/Suin/RSSWriter/Channel"); $this->load->library("web_apps/Suin/RSSWriter/Item"); $feed = new Feed(); $webpage_title = $webpage->get_title(); //$webpage_topics_path = '/mobile_apps/annotation_topics/webpade_id/'.$webpage_id; //$webpage_topics_url = get_kals_base_url($webpage_topics_path); //$webpage_topics_url = site_url('/mobile_apps/annotation_topics/webpade_id/'.$webpage_id); //$webpage_topics_url = $webpage->get_url() . "#mobile=true"; $webpage_topics_url = get_kals_base_url("mobile_apps/redirect/load/" . $webpage_id); $channel = new Channel(); $channel->title($webpage_title)->description("Channel Description")->url($webpage_topics_url)->appendTo($feed); foreach ($search as $annotation) { $item = new Item(); $type = $annotation->get_type(); $type_name = $type->get_name(); $type_show; if ($type_name != 'annotation.type.custom') { //自定標註顯示 $type_show = $this->lang->line("web_apps." . $type_name); } else { $type_show = $type->get_custom_name(); } // anchor text // user name // date // annotation type // note $annotation_id = $annotation->get_id(); if (isset($annotation_id)) { //$topic_array = $this->db->query("SELECT topic_id // FROM annotation // WHERE annotation_id ='".$annotation_id."'"); $topic_array = $this->db->select("topic_id")->from("annotation")->where("annotation_id", $annotation_id)->where("deleted", "false")->get(); } foreach ($topic_array->result_array() as $row) { $topic_id = $row['topic_id']; } /** * @author Pulipuli Chen 20140429 * 要記得沒有topic的標註啊…… */ $topic_id = trim($topic_id); if ($topic_id == "") { $topic_id = $annotation_id; } //$item_url = 'http://140.119.61.137/kals/mobile/annotation_thread/'.$topic_id.'#annotation_'.$annotation_id; //$annotation_thread_path = "mobile_apps/annotation_thread/topic_id/".$topic_id."#annotation_".$annotation_id; //$item_url = site_url($annotation_thread_path); //$item_url = get_kals_base_url($annotation_thread_path); //$item_url = $webpage->get_url() . "#mobile=true&topic_id=" . $topic_id . "&annotation_id=" . $annotation_id; $item_url = get_kals_base_url("mobile_apps/redirect/load/" . $webpage_id . "/" . $topic_id . "/" . $annotation_id); //$item_url = $_SERVER["HTTP_HOST"] //test_msg($_SERVER["HTTP_HOST"]); $item->title("[" . $type_show . "] " . '"' . $annotation->get_anchor_text() . '"')->description("<div> " . $this->lang->line("web_apps.window.content.search.field.author") . ": " . $annotation->get_user()->get_name() . " </div>" . "<div> " . $this->lang->line("web_apps.window.content.search.field.author") . ": " . $annotation->get_user()->get_name() . " </div>" . "<div>" . $annotation->get_note() . " </div> \n ")->url($item_url)->appendTo($channel); } echo $feed; }
<?php $this->require_admin(); $page->layout = 'admin'; $page->title = i18n_get('All Pages'); $limit = 20; $_GET['offset'] = isset($_GET['offset']) ? $_GET['offset'] : 0; $lock = new Lock(); $pages = Webpage::query('id, title, access')->order('title asc')->fetch_orig($limit, $_GET['offset']); $count = Webpage::query()->count(); foreach ($pages as $k => $p) { $pages[$k]->locked = $lock->exists('Webpage', $p->id); } echo $tpl->render('admin/pages', array('pages' => $pages, 'count' => $count, 'offset' => $_GET['offset'], 'more' => $count > $_GET['offset'] + $limit ? true : false, 'prev' => $_GET['offset'] - $limit, 'next' => $_GET['offset'] + $limit));
/** * Generates the javascript code handle the "watchdog" associated with the concurrent access locking mechanism * @param Webpage $oPage * @param string $sOwnershipToken */ protected function GetOwnershipJSHandler($oPage, $sOwnershipToken) { $iInterval = max(MIN_WATCHDOG_INTERVAL, MetaModel::GetConfig()->Get('concurrent_lock_expiration_delay')) * 1000 / 2; // Minimum interval for the watchdog is MIN_WATCHDOG_INTERVAL $sJSClass = json_encode(get_class($this)); $iKey = (int) $this->GetKey(); $sJSToken = json_encode($sOwnershipToken); $sJSTitle = json_encode(Dict::S('UI:DisconnectedDlgTitle')); $sJSOk = json_encode(Dict::S('UI:Button:Ok')); $oPage->add_ready_script(<<<EOF \t\twindow.setInterval(function() { \t\t\tif (window.bInSubmit || window.bInCancel) return; \t\t\t \t\t\t\$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', {operation: 'extend_lock', obj_class: {$sJSClass}, obj_key: {$iKey}, token: {$sJSToken} }, function(data) { \t\t\t\tif (!data.status) \t\t\t\t{ \t\t\t\t\tif (\$('.lock_owned').length == 0) \t\t\t\t\t{ \t\t\t\t\t\t\$('.ui-layout-content').prepend('<div class="header_message message_error lock_owned">'+data.message+'</div>'); \t\t\t\t\t\t\$('<div>'+data.popup_message+'</div>').dialog({title: {$sJSTitle}, modal: true, autoOpen: true, buttons:[ {text: {$sJSOk}, click: function() { \$(this).dialog('close'); } }], close: function() { \$(this).remove(); }}); \t\t\t\t\t} \t\t\t\t\t\$('.wizContainer form button.action:not(.cancel)').attr('disabled', 'disabled'); \t\t\t\t} \t\t\t\telse if ((data.operation == 'lost') || (data.operation == 'expired')) \t\t\t\t{ \t\t\t\t\tif (\$('.lock_owned').length == 0) \t\t\t\t\t{ \t\t\t\t\t\t\$('.ui-layout-content').prepend('<div class="header_message message_error lock_owned">'+data.message+'</div>'); \t\t\t\t\t\t\$('<div>'+data.popup_message+'</div>').dialog({title: {$sJSTitle}, modal: true, autoOpen: true, buttons:[ {text: {$sJSOk}, click: function() { \$(this).dialog('close'); } }], close: function() { \$(this).remove(); }}); \t\t\t\t\t} \t\t\t\t\t\$('.wizContainer form button.action:not(.cancel)').attr('disabled', 'disabled'); \t\t\t\t} \t\t\t}, 'json'); \t\t}, {$iInterval}); EOF ); }
foreach ($this->myUrl as $value) { $breadcrumbs[] = $value === $this->anchorText ? '<li> / <a href="/' . implode('/', $this->myUrl) . '">' . $value . '</a></li>' : '<li> / ' . $value . '</li>'; } $breadcrumbs[] = '</ol>'; $this->breadcrumbs = implode('', $breadcrumbs); } public function getBreadcrumbs() { return $this->breadcrumbs; } } class Webpage extends Template { public $anchorText; public $myUrl; public function __construct() { $this->myUrl = explode('/', ltrim($_SERVER['REQUEST_URI'], '/')); if (strlen(trim($this->myUrl[count($this->myUrl) - 1])) === 0) { $this->anchorText = $this->myUrl[count($this->myUrl) - 2]; unset($this->myUrl[count($this->myUrl) - 1]); } else { $this->anchorText = $this->myUrl[count($this->myUrl) - 1]; } $this->getBreadcrumbNavigation(); } } print_r('<pre>'); $webpage = new Webpage(); echo $webpage->getBreadcrumbs(); exit;
<?php /** * Returns a list of internal page links to the WYSIWYG editor's * link dialog. * * Note: Only includes public pages. */ function admin_links_sort($a, $b) { if ($a['title'] == $b['title']) { return 0; } return $a['title'] < $b['title'] ? -1 : 1; } $page->layout = false; $menu = Webpage::query('id, title, menu_title')->where('access', 'public')->fetch_orig(); $out = array(); foreach ($menu as $pg) { $mt = !empty($pg->menu_title) ? $pg->menu_title : $pg->title; $out[] = array('url' => Link::href($pg->id), 'title' => $mt); } usort($out, 'admin_links_sort'); echo json_encode($out);
public function __construct() { parent::__construct(); $this->jsFiles[] = "/js/validate.js"; $this->jsFiles[] = "/js/jquery.validate.min.js"; }