public function index($feedtype = 'rss2') { if (!Kohana::config('settings.allow_feed')) { throw new Kohana_404_Exception(); } if ($feedtype != 'atom' and $feedtype != 'rss2') { throw new Kohana_404_Exception(); } // How Many Items Should We Retrieve? $limit = (isset($_GET['l']) and !empty($_GET['l']) and (int) $_GET['l'] <= 200) ? (int) $_GET['l'] : 20; // Start at which page? $page = (isset($_GET['p']) and !empty($_GET['p']) and (int) $_GET['p'] >= 1) ? (int) $_GET['p'] : 1; $page_position = $page == 1 ? 0 : $page * $limit; // Query position $site_url = url::base(); // Cache the Feed with subdomain in the cache name if mhi is set $subdomain = ''; if (substr_count($_SERVER["HTTP_HOST"], '.') > 1 and Kohana::config('config.enable_mhi') == TRUE) { $subdomain = substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], '.')); } $cache = Cache::instance(); $feed_items = $cache->get($subdomain . '_feed_' . $limit . '_' . $page); if ($feed_items == NULL) { // Cache is Empty so Re-Cache $incidents = ORM::factory('incident')->where('incident_active', '1')->orderby('incident_date', 'desc')->limit($limit, $page_position)->find_all(); $items = array(); foreach ($incidents as $incident) { $categories = array(); foreach ($incident->category as $category) { $categories[] = (string) $category->category_title; } $item = array(); $item['id'] = $incident->id; $item['title'] = $incident->incident_title; $item['link'] = $site_url . 'reports/view/' . $incident->id; $item['description'] = $incident->incident_description; $item['date'] = $incident->incident_date; $item['categories'] = $categories; if ($incident->location_id != 0 and $incident->location->longitude and $incident->location->latitude) { $item['point'] = array($incident->location->latitude, $incident->location->longitude); $items[] = $item; } } $cache->set($subdomain . '_feed_' . $limit . '_' . $page, $items, array('feed'), 3600); // 1 Hour $feed_items = $items; } $feedpath = $feedtype == 'atom' ? 'feed/atom/' : 'feed/'; header('Content-Type: application/' . ($feedtype == 'atom' ? 'atom' : 'rss') . '+xml; charset=utf-8'); $view = new View('feed/' . $feedtype); $view->feed_title = Kohana::config('settings.site_name'); $view->site_url = $site_url; $view->georss = 1; // this adds georss namespace in the feed $view->feed_url = $site_url . $feedpath; $view->feed_date = gmdate("D, d M Y H:i:s T", time()); $view->feed_description = Kohana::lang('ui_admin.incident_feed') . ' ' . Kohana::config('settings.site_name'); $view->items = $feed_items; $view->render(TRUE); }
/** * Adds all the events to the main Ushahidi application */ public function add() { $session = Session::instance(); // Has user switched to Full Website? if (isset($_GET['full']) and $_GET['full'] == 1) { // Create the Full website session $session->set('full', 1); } if (!$session->get('full')) { //error_log($_GET['full']); // If Mobile Configure Mobile Settings if (isset($_SERVER['HTTP_USER_AGENT']) and !$this->_is_keitai() and $this->_is_mobile() and strrpos(url::current(), "mobile") === FALSE and strrpos(url::current(), "page/index/9") === FALSE and strrpos(url::current(), "contact") === FALSE and strrpos(url::current(), "alerts/verify") === FALSE and Router::$controller != 'api') { // Only add the events if we are on that controller $request_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; $replace_url1 = "http://" . $_SERVER["HTTP_HOST"] . "/ushahidi/mobile/"; $replace_url2 = "http://" . $_SERVER["HTTP_HOST"] . "/mobile/"; if (strpos($request_url, "ushahidi") === false) { $url = str_replace("http://" . $_SERVER["HTTP_HOST"] . "/", $replace_url2, $request_url); } else { $url = str_replace(url::base(), $replace_url1, $request_url); } //url::redirect(url::base()."mobile"); url::redirect($url); } } }
/** * 增加设备上传文件历史 * @param string $md5 MD5 * @param string $guid GUID * @param int $client_id 来源 * @return Database_Result */ public function add_device_history($md5, $guid, $client_id) { $this->url = url::base(FALSE) . 'graph/download/' . $md5; $this->guid = $guid; $this->result = $this->db->insert('cs_contact_device_history', array('file_md5' => $md5, 'guid' => $guid, 'client_id' => $client_id, 'dateline' => time())); return $this->result; }
public static function AvailLink($hostname, $servicedesc, $start, $end) { $config = new Config_Model(); $config->read_config(); $hostname = urlencode($hostname); $servicedesc = urlencode($servicedesc); $smon = date('m', $start); $sday = date('d', $start); $syear = date('Y', $start); $shour = date('G', $start); $smin = date('i', $start); $ssec = date('s', $start); $emon = date('m', $end); $eday = date('d', $end); $eyear = date('Y', $end); $ehour = date('G', $end); $emin = date('i', $end); $esec = date('s', $end); $nagios_base = $config->conf['nagios_base']; if ($servicedesc == "Host+Perfdata") { print "<a href=\"{$nagios_base}/avail.cgi?show_log_entries=&host={$hostname}&timeperiod=custom&smon={$smon}&sday={$sday}&syear={$syear}&shour={$shour}&smin={$smin}&ssec={$ssec}&emon={$emon}&eday={$eday}&eyear={$eyear}&ehour={$ehour}&emin={$emin}&esec={$esec}&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=yes&initialassumedservicestate=6&backtrack=4\""; } else { print "<a href=\"{$nagios_base}/avail.cgi?show_log_entries=&host={$hostname}&service={$servicedesc}&timeperiod=custom&smon={$smon}&sday={$sday}&syear={$syear}&shour={$shour}&smin={$smin}&ssec={$ssec}&emon={$emon}&eday={$eday}&eyear={$eyear}&ehour={$ehour}&emin={$emin}&esec={$esec}&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=yes&initialassumedservicestate=6&backtrack=4\""; } print " title=\"" . Kohana::lang('common.nagios-avail-link-title') . "\"><img src=\"" . url::base() . "media/images/trends.gif\" ></a>\n"; }
/** * Read in new layer KML via file_get_contents * @param int $layer_id - ID of the new KML Layer */ public function layer($layer_id = 0) { $this->template = ""; $this->auto_render = FALSE; $layer = ORM::factory('layer') ->where('layer_visible', 1) ->find($layer_id); if ($layer->loaded) { $layer_url = $layer->layer_url; $layer_file = $layer->layer_file; $layer_link = (!$layer_url) ? url::base().Kohana::config('upload.relative_directory').'/'.$layer_file : $layer_url; $content = file_get_contents($layer_link); if ($content !== false) { echo $content; } else { echo ""; } } else { echo ""; } }
/** * Tests the protocol in $config['site_protocol'] against the URL */ public function testSiteProtocol() { // Build the regular expression for site protocol $site_protocol = '/' . Kohana::config('core.site_protocol') . ':\\/\\//'; // Check if the url base contains the site protocol $this->assertRegExp($site_protocol, url::base()); }
public static function header($page = array()) { $page['js'] = array_merge(array('jquery' => url::common() . '/js/jquery.js', 'plugins' => url::common() . '/js/jquery.plugins.js', 'zotop' => url::common() . '/js/zotop.js'), (array) $page['js']); $page['css'] = array_merge(array('zotop' => url::theme() . '/css/zotop.css', 'global' => url::theme() . '/css/global.css'), (array) $page['css']); $page = self::settings($page); $html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $html[] = '<html xmlns="http://www.w3.org/1999/xhtml">'; $html[] = '<head>'; $html[] = ' <title>' . $page['title'] . ' Powered by ' . zotop::config("zotop.title") . '</title>'; $html[] = self::meta($page['meta']); $html[] = self::stylesheet($page['css']); $html[] = self::script($page['js']); $html[] = ' ' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'shortcut icon', 'type' => 'image/x-icon')); $html[] = ' ' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'icon', 'type' => 'image/x-icon')); $html[] = ' ' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'bookmark', 'type' => 'image/x-icon')); $html[] = ' <script type="text/javascript">'; $html[] = ' zotop.url.base = "' . url::base() . '";'; $html[] = ' zotop.url.common = "' . url::common() . '";'; $html[] = ' zotop.page.id = "' . page::id() . '";'; $html[] = ' zotop.user.id =0;'; $html[] = ' zotop.user.username = "";'; $html[] = ' </script>'; $html[] = '</head>'; $html[] = '<body' . html::attributes($page['body']) . '>'; $html[] = '<div id="wrapper">'; $html[] = ''; $str = implode("\n", $html); echo $str; }
public static function render($type) { $files = $type.'s'; $html = ''; foreach (self::$$files as $key => $file) { switch ($type) { case 'stylesheet': if (substr_compare($file, '.css', -3, 3, FALSE) !== 0) { // Add the javascript suffix $file .= '.css'; } $html .= '<link rel="stylesheet" type="text/css" href="'.url::base()."plugins/".$file.'" />'; break; case 'javascript': if (substr_compare($file, '.js', -3, 3, FALSE) !== 0) { // Add the javascript suffix $file .= '.js'; } $html .= '<script type="text/javascript" src="'.url::base()."plugins/".$file.'"></script>'; break; } } return $html; }
public function login() { // user is logged in.... if (Auth::instance()->logged_in()) { echo 'u are logged in.... <a href="' . url::base() . 'login/logout">Logout</a>'; } else { echo ' <a href="' . url::base() . 'login_test/create">Click here to create a user</a><br><br> Login form:<br> <form method="post" action="' . url::base() . 'login_test/login"> name:<input type="text" name="username"><br> pass:<input type="text" name="password"><br> <input type="submit" value="login"> </form> '; $form = $_POST; if ($form) { // Load the user $user = ORM::factory('user', $form['username']); // orm user object or $form['username'] could be used if (Auth::instance()->login($user, $form['password'])) { // Login successful, redirect // or do some other things u like url::redirect('login_test/login'); } else { echo 'login_failed Invalid username or password.'; } } } }
public function notify_admins($subject = NULL, $message = NULL) { // Don't show the exceptions for this operation to the user. Log them // instead try { if ($subject && $message) { $settings = kohana::config('settings'); $from = array(); $from[] = $settings['site_email']; $from[] = $settings['site_name']; $users = ORM::factory('user')->where('notify', 1)->find_all(); foreach ($users as $user) { if ($user->has(ORM::factory('role', 'admin'))) { $address = $user->email; $message .= "\n\n\n\n~~~~~~~~~~~~\n" . Kohana::lang('notifications.admin_footer') . "\n" . url::base() . "\n\n" . Kohana::lang('notifications.admin_login_url') . "\n" . url::base() . "admin"; if (!email::send($address, $from, $subject, $message, FALSE)) { Kohana::log('error', "email to {$address} could not be sent"); } } } } else { Kohana::log('error', "email to {$address} could not be sent\n\t\t\t\t - Missing Subject or Message"); } } catch (Exception $e) { Kohana::log('error', "An exception occured " . $e->__toString()); } }
/** * Loads ushahidi themes */ public function register() { // Array to hold all the CSS files $theme_css = array(); // 1. Load the default theme Kohana::config_set('core.modules', array_merge(array(THEMEPATH . "default"), Kohana::config("core.modules"))); $css_url = Kohana::config("cache.cdn_css") ? Kohana::config("cache.cdn_css") : url::base(); // HACK: don't include the default style.css if using the ccnz theme if (Kohana::config("settings.site_style") != "ccnz") { $theme_css[] = $css_url . "themes/default/css/style.css"; } // 2. Extend the default theme if (Kohana::config("settings.site_style") != "default") { $theme = THEMEPATH . Kohana::config("settings.site_style"); Kohana::config_set('core.modules', array_merge(array($theme), Kohana::config("core.modules"))); if (is_dir($theme . '/css')) { $css = dir($theme . '/css'); // Load all the themes css files while (($css_file = $css->read()) !== FALSE) { if (preg_match('/\\.css/i', $css_file)) { $theme_css[] = url::base() . "themes/" . Kohana::config("settings.site_style") . "/css/" . $css_file; } } } } Kohana::config_set('settings.site_style_css', $theme_css); }
public function login() { // Load the view $view = new view(url::location()); // populate the post information if it exists $view->post = array(); // assign the form post information, if it exists $view->post['unique'] = isset($this->post['unique']) ? $this->post['unique'] : ''; // HAXXX $view->title = 'Spicers | Admin Login'; $view->base_href = isset($this->base_href) ? $this->base_href : 'http://' . $_SERVER['HTTP_HOST'] . url::base(); if ($this->notification->count()) { $view->notifications = View::factory('templates/notification_ajax', array('notifications' => $this->notification->get())); } $this->auth = new Security(); if ($this->auth->logged_in()) { // note if they do not have access to the dashboard and they are signed in, this will // start an infinate loop. @todo fix this. maybe just a check to see if they have access // before the redirect - jpeake url::redirect('home'); die; } echo $view; die; }
public function index($feedtype = 'rss2') { if (!Kohana::config('settings.allow_feed')) { throw new Kohana_404_Exception(); } if ($feedtype != 'atom' and $feedtype != 'rss2') { throw new Kohana_404_Exception(); } $feedpath = $feedtype == 'atom' ? 'feed/atom/' : 'feed/'; $site_url = url::base(); $incidents = ORM::factory('incident')->where('incident_active', '1')->orderby('incident_date', 'desc')->limit(20)->find_all(); $items = array(); foreach ($incidents as $incident) { $item = array(); $item['title'] = $incident->incident_title; $item['link'] = $site_url . 'reports/view/' . $incident->id; $item['description'] = $incident->incident_description; $item['date'] = $incident->incident_date; if ($incident->location_id != 0 and $incident->location->longitude and $incident->location->latitude) { $item['point'] = array($incident->location->latitude, $incident->location->longitude); $items[] = $item; } } header("Content-Type: text/xml; charset=utf-8"); $view = new View('feed_' . $feedtype); $view->feed_title = htmlspecialchars(Kohana::config('settings.site_name')); $view->site_url = $site_url; $view->georss = 1; // this adds georss namespace in the feed $view->feed_url = $site_url . $feedpath; $view->feed_date = gmdate("D, d M Y H:i:s T", time()); $view->feed_description = 'Incident feed for ' . Kohana::config('settings.site_name'); $view->items = $items; $view->render(TRUE); }
/** * Methode : page de détail d'un article */ public function show($idActualite = FALSE) { if (!$idActualite || !is_numeric($idActualite)) { return parent::redirect_erreur('articles'); } cookie::set('UserFilesPath', url::base() . '../images/articles/' . $idActualite); cookie::set('UserFilesAbsolutePath', DOCROOT . '../images/articles/' . $idActualite); if (!cookie::get('UserFilesPath')) { return url::redirect('articles/show/' . $idActualite); } if (!($actualite = $this->acticles->select(array('id_article' => $idActualite), TRUE))) { return parent::redirect_erreur('articles'); } $actualiteCategories = $this->acticles->selectListeCategories(); $this->script = array('js/lib/jquery.validate', 'js/articles'); $this->css = array('form', 'article'); $this->template->titre = array(Kohana::lang('article.all_article') => 'articles', $actualite->title => NULL); $this->template->button = TRUE; $this->template->navigation = $this->acticles->navigation($idActualite, 'id_article', 'articles'); $this->template->navigationURL = 'articles/show'; $this->template->contenu = new View('formulaire/form'); $this->template->contenu->action = 'articles/save'; $this->template->contenu->id = $idActualite; $this->template->contenu->formulaire = new View('articles/show'); $this->template->contenu->formulaire->row = $actualite; $this->template->contenu->formulaire->actualiteCategories = $actualiteCategories; $this->template->contenu->formulaire->regions = Region_Model::instance()->listing_parent(); }
public function __construct($api_service) { $this->db = new Database(); $this->api_settings = new Api_Settings_Model(1); // Set the list limit $this->list_limit = ((int) $this->api_settings->default_record_limit > 0) ? $this->api_settings->default_record_limit : (int) Kohana::config('settings.items_per_api_request'); $this->domain = url::base(); $this->record_count = 1; $this->table_prefix = Kohana::config('database.default.table_prefix'); $this->api_service = $api_service; // Check if the response type for the API service has already been set if ( ! is_null($api_service->get_response_type())) { $this->request = $api_service->get_request(); $this->response_type = $api_service->get_response_type(); } else { $this->set_request($api_service->get_request()); } }
protected function setUp() { // $_SERVER values $_SERVER = array_merge($_SERVER, array('REQUEST_METHOD' => 'GET', 'REQUEST_URI' => url::base() . 'api/?task=countries')); // Instantiate the API controller $this->api_controller = new Api_Controller(); }
/** * Loads all ushahidi plugins */ public function register() { $db = Database::instance(); $plugins = array(); // Get the list of plugins from the db foreach ($db->getwhere('plugin', array('plugin_active' => 1, 'plugin_installed' => 1)) as $plugin) { $plugins[$plugin->plugin_name] = PLUGINPATH . $plugin->plugin_name; } // Now set the plugins Kohana::config_set('core.modules', array_merge(Kohana::config('core.modules'), $plugins)); // We need to manually include the hook file for each plugin, // because the additional plugins aren't loaded until after the application hooks are loaded. foreach ($plugins as $key => $plugin) { if (file_exists($plugin . '/hooks')) { $d = dir($plugin . '/hooks'); // Load all the hooks while (($entry = $d->read()) !== FALSE) { if ($entry[0] != '.') { // $plugin_base Variable gives plugin hook access to the base location of the plugin $plugin_base = url::base() . "plugins/" . $key . "/"; include $plugin . '/hooks/' . $entry; } } } } }
public function index() { define('DEBUG', true); // an array of file extensions to accept $accepted_extensions = array("png", "jpg", "gif"); // http://your-web-site.domain/base/url $base_url = url::base() . Kohana::config('upload.relative_directory', TRUE) . "jwysiwyg"; // the root path of the upload directory on the server $uploads_dir = Kohana::config('upload.directory', TRUE) . "jwysiwyg"; // the root path that the files are available from the webserver $uploads_access_dir = Kohana::config('upload.directory', TRUE) . "jwysiwyg"; if (!file_exists($uploads_access_dir)) { mkdir($uploads_access_dir, 0775); } if (DEBUG) { if (!file_exists($uploads_access_dir)) { $error = 'Folder "' . $uploads_access_dir . '" doesn\'t exists.'; header('Content-type: text/html; charset=UTF-8'); print '{"error":"config.php: ' . htmlentities($error) . '","success":false}'; exit; } } $capabilities = array("move" => false, "rename" => true, "remove" => true, "mkdir" => false, "upload" => true); if (extension_loaded('mbstring')) { mb_internal_encoding('UTF-8'); mb_regex_encoding('UTF-8'); } require_once Kohana::find_file('libraries/jwysiwyg', 'common', TRUE); require_once Kohana::find_file('libraries/jwysiwyg', 'handlers', TRUE); ResponseRouter::getInstance()->run(); }
/** * Converts a file location to an absolute URL or returns the absolute URL if absolute URL * is passed. This function is for uploaded files since it uses the configured upload dir * * @param string file location or full URL * @return string */ public static function convert_uploaded_to_abs($file) { if (valid::url($file) == true) { return $file; } return url::base() . Kohana::config('upload.relative_directory') . '/' . $file; }
public function min() { $css = $this->input; $options = ""; $options = $options == "" ? array() : (is_array($options) ? $options : explode(",", $options)); // Remove comments $css = preg_replace("/\\/\\*[\\d\\D]*?\\*\\/|\t+/", " ", $css); // Replace CR, LF and TAB to spaces $css = str_replace(array("\n", "\r", "\t"), " ", $css); // Replace multiple to single space $css = preg_replace("/\\s\\s+/", " ", $css); // Remove unneeded spaces $css = preg_replace("/\\s*({|}|\\[|\\]|=|~|\\+|>|\\||;|:|,)\\s*/", "\$1", $css); if (in_array("remove-last-semicolon", $options)) { // Removes the last semicolon of every style definition $css = str_replace(";}", "}", $css); } $css = trim($css); // prevent url $path = url::base(FALSE); if (strrpos($this->file, '/') !== FALSE) { $path .= substr($this->file, 0, strrpos($this->file, '/') + 1); } // Fix all paths within this CSS file, ignoring absolute paths. //$css = preg_replace('/url\(([\'"]?)(?![a-z]+:)/i', 'url(\1'. $path . '\2', $css); return $css; }
/** * Methode : page de détail d'une user */ public function show($idQuete = false) { if (!$idQuete || !is_numeric($idQuete)) { return parent::redirect_erreur('quetes'); } cookie::set('UserFilesPath', url::base() . '../images/quetes/' . $idQuete); cookie::set('UserFilesAbsolutePath', DOCROOT . '../images/quetes/' . $idQuete); if (!cookie::get('UserFilesPath')) { return url::redirect('quetes/show/' . $idQuete); } if (!($quete = $this->quete->select(array('id_quete' => $idQuete), 1))) { return parent::redirect_erreur('quetes'); } if (!($module = Map_Model::instance()->select(array('module_map' => 'quete'), false))) { return url::redirect('regions?msg=' . urlencode(Kohana::lang('quete.no_module'))); } $this->script = array('js/lib/jquery.validate', 'js/lib/jquery.facebox', 'js/quetes'); $this->css = array('form', 'quete', 'facebox'); $this->template->titre = array(Kohana::lang('quete.all_quetes') => 'quetes', Kohana::lang('quete.show_title', ucfirst(mb_strtolower($quete->title))) => NULL); $this->template->button = TRUE; $this->template->navigation = parent::navigation($idQuete, 'id_quete', 'quetes'); $this->template->contenu = new View('formulaire/form'); $this->template->contenu->action = 'quetes/save'; $this->template->contenu->id = $idQuete; $this->template->contenu->formulaire = new View('quetes/show'); $this->template->contenu->formulaire->row = $quete; $this->template->contenu->formulaire->module = $module; $this->template->contenu->formulaire->bots = Map_Model::instance()->select(array('module_map' => 'fight'), false); $this->template->contenu->formulaire->quete = $this->quete->select(array('id_quete !=' => $idQuete)); }
/** * Default constructor */ public function __construct() { $this->_set_db(new Database()); $this->_set_list_limit(20); $this->_set_domain(url::base()); $this->_set_table_prefix(Kohana::config('database.default.table_prefix')); }
private function collect_themes() { $themes = array(); try { $dir = DOCROOT . "/themes"; $dirItterator = new \DirectoryIterator($dir); foreach ($dirItterator as $directory) { if ($directory->isDir()) { $dirname = $directory->getFilename(); $innerItterator = new DirectoryIterator($directory->getPathname()); foreach ($innerItterator as $file) { if ($file->isFile()) { $filePath = $file->getPathname(); $fileName = $file->getFilename(); if ($fileName == "style.css") { $theme->cssFilePath = url::base() . "themes/" . $dirname . "/style.css"; $theme->thumbnail = str_replace("style.css", "thumbnail.png", $filePath); $theme->title = ""; $theme->description = ""; $theme->author = ""; $theme->email = ""; $theme->url = ""; $theme->notes = ""; $file = file($filePath); foreach ($file as $line) { if (strpos($line, "@title") != 0) { $theme->title = trim(substr($line, strpos($line, "@title") + 6)); } else { if (strpos($line, "@description") != 0) { $theme->description = trim(substr($line, strpos($line, "@description") + 12)); } else { if (strpos($line, "@author") != 0) { $theme->author = trim(substr($line, strpos($line, "@author") + 7)); } else { if (strpos($line, "@email") != 0) { $theme->email = trim(substr($line, strpos($line, "@email") + 6)); } else { if (strpos($line, "@url") != 0) { $theme->url = trim(substr($line, strpos($line, "@url") + 4)); } else { if (strpos($line, "@notes") != 0) { $theme->notes = trim(substr($line, strpos($line, "@notes") + 6)); } } } } } } } $themes[] = $theme; } } } } } } catch (Exception $e) { } return $themes; }
public static function getlastnews() { $orm = new fpp_news_Model(); $orm = $orm->db2cls(); $q = $orm->limit(0, 5)->fetch_all('id_news', 'DESC'); $pages = html::anchor(url::base() . 'webserv/listnews/', "Ver mas"); return View::factory("extras/news/lastnews")->set("news", $q)->set("pages", $pages)->render(); }
public static function getActionLink($params, $linktype = 'image') { self::checkRequiredParams('getActionLink', $params); self::assignEmptyParams($params, 1); list($uuid) = $params; $linkattr = array('name' => 'park', 'id' => 'park_' . $uuid, 'class' => 'button_blue action_button qtipAjaxForm', 'href' => url::base() . 'index.php/callmanager/valetpark/' . $uuid, 'image' => url::base() . 'modules/callmanager-1.0/assets/img/valetpark.png', 'text' => 'Park'); return parent::getActionLink($linkattr, $linktype); }
public function related_image($relative_uri, $title = "", $image_type = "jpeg") { if (empty($title)) { $title = t("Get related image"); } $this->rel("related")->type("image/" . $image_type)->title($title)->href(sprintf("%s%s", url::base(true, "http"), $relative_uri)); return $this; }
public function stats() { $view = new Admin_View("admin.html"); $view->content = new View("admin_akismet_stats.html"); $view->content->api_key = module::get_var("akismet", "api_key"); $view->content->blog_url = url::base(false, "http"); print $view; }
/** * Gets the default js scripts for the rte * * @return string */ public static function get_scripts_html() { $html = array(); foreach (self::_get_config('scripts') as $script) { $html[] = HTML::script(url::base() . $script); } return implode("\n", $html); }
/** * test * * @param string $title * @param int $image_width * @return void * @author Andy Bennett */ function image($title = 'Header', $image_width = 80) { echo ' <div style="background: red"> <img src="' . url::base() . '/title/render?title=' . urlencode($title) . '&size=20" /> </div> '; }
public static function xbase_url($string) { if (Kohana::config('config.index_page')) { return url::base() . Kohana::config('config.index_page') . '/' . $string; } else { return url::base() . $string; } }