Beispiel #1
1
 /**
  * Custom validation for this model - complements the default validate()
  *
  * @param   array  array to validate
  * @param   Auth   instance of Auth class; used for testing purposes
  * @return bool TRUE if validation succeeds, FALSE otherwise
  */
 public static function custom_validate(array &$post, Auth $auth = null)
 {
     // Initalize validation
     $post = Validation::factory($post)->pre_filter('trim', TRUE);
     if ($auth === null) {
         $auth = new Auth();
     }
     $post->add_rules('username', 'required', 'length[3,100]', 'alpha_numeric');
     $post->add_rules('name', 'required', 'length[3,100]');
     $post->add_rules('email', 'required', 'email', 'length[4,64]');
     // If user id is not specified, check if the username already exists
     if (empty($post->user_id)) {
         $post->add_callbacks('username', array('User_Model', 'unique_value_exists'));
         $post->add_callbacks('email', array('User_Model', 'unique_value_exists'));
     }
     // Only check for the password if the user id has been specified
     if (empty($post->user_id)) {
         $post->add_rules('password', 'required', 'length[5,50]', 'alpha_numeric');
     }
     // If Password field is not blank
     if (!empty($post->password) or empty($post->password) and !empty($post->password_again)) {
         $post->add_rules('password', 'required', 'length[5,50]', 'alpha_numeric', 'matches[password_again]');
     }
     $post->add_rules('role', 'required', 'length[3,30]', 'alpha_numeric');
     $post->add_rules('notify', 'between[0,1]');
     if (!$auth->logged_in('superadmin')) {
         $post->add_callbacks('role', array('User_Model', 'prevent_superadmin_modification'));
     }
     // Additional validation checks
     Event::run('ushahidi_action.user_submit_admin', $post);
     // Return
     return $post->validate();
 }
Beispiel #2
0
 public function article($uri)
 {
     $this->template->content = View::factory('blog/view')->bind('post', $post)->bind('comments', $comments)->bind('form', $form);
     $post = ORM::factory('blog_post', (string) $uri);
     // Show 404 if we don't find posts
     if (!$post->loaded) {
         Event::run('system.404');
     }
     $comments = $post->blog_comments;
     $this->head->title->prepend($post->title);
     if (!($post->comment_status === 'open' and config::get('blog.comment_status') === 'open')) {
         return;
     }
     $form = Formo::factory()->plugin('csrf')->add('text', 'author', array('label' => __('Name')))->add('text', 'email', array('label' => __('Email')))->add('text', 'url', array('label' => __('Homepage')))->add('textarea', 'content', array('label' => __('Comment')))->add('submit', 'submit', array('label' => __('Submit')))->pre_filter('all', 'trim')->pre_filter('author', 'security::xss_clean')->pre_filter('content', 'security::xss_clean')->pre_filter('url', 'security::xss_clean')->pre_filter('url', 'format::url')->add_rule('author', 'required', __('You must provide your name'))->add_rule('author', 'length[2,40]', __('Your Name is too long'))->add_rule('email', 'valid::email', __('Email address is not valid'))->add_rule('content', 'required', __('You must enter a comment'));
     if (config::get('blog.enable_captcha') === 'yes') {
         $form->add('captcha', 'security', array('label' => __('Security code')));
         $form->security->error_msg = __('Invalid security code');
     }
     if ($form->validate()) {
         $comment = ORM::factory('blog_comment');
         $comment->author = $form->author->value;
         $comment->email = $form->email->value;
         $comment->content = $form->content->value;
         $comment->url = $form->url->value;
         $comment->ip = $this->input->ip_address();
         $comment->agent = Kohana::$user_agent;
         $comment->date = date("Y-m-d H:i:s", time());
         $post->add_comment($comment);
         Event::run('blog.comment_added', $comment);
         Cache::instance()->delete('s7n_blog_feed');
         Cache::instance()->delete('s7n_blog_feed_comments');
         url::redirect($post->url());
     }
     $form = View::factory('blog/form_comment', $form->get(TRUE));
 }
Beispiel #3
0
 public function delete($uuid)
 {
     $base = strtolower($this->baseModel);
     $this->createView();
     $this->loadBaseModel($uuid);
     if ($action = $this->submitted(array('submitString' => 'delete'))) {
         Event::run('bluebox.deleteOnSubmit', $action);
         if ($action == self::SUBMIT_CONFIRM) {
             if (($msg = Doctrine::getTable('VoicemailMessage')->findOneByUuid($uuid, Doctrine::HYDRATE_ARRAY)) === NULL) {
                 messge::set('Unable to delete voicemail message.');
                 $this->exitQtipAjaxForm();
                 url::redirect(Router_Core::$controller);
             } else {
                 VoicemailManager::delete($msg['username'], $msg['domain'], $uuid);
                 Doctrine_Query::create()->delete('VoicemailMessage')->addWhere('uuid = ?', $msg['uuid'])->execute();
             }
             $this->returnQtipAjaxForm(NULL);
             url::redirect(Router_Core::$controller);
         } else {
             if ($action == self::SUBMIT_DENY) {
                 $this->exitQtipAjaxForm();
                 url::redirect(Router_Core::$controller);
             }
         }
     }
     $this->prepareDeleteView(NULL, $uuid);
 }
 public function __call($method, $args)
 {
     // Concat all the arguments into a filepath
     array_unshift($args, $method);
     $path = join(DIRECTORY_SEPARATOR, $args);
     // Straightforwarding loading of file
     if (!$this->process_imports) {
         // Strip the extension from the filepath
         $path = substr($path, 0, -strlen($this->extension) - 1);
         // Search for file using cascading file system
         $filename = Kohana::find_file($this->directory, $path, FALSE, $this->extension);
         if (!$filename) {
             Event::run('system.404');
         }
         $output = Kohana::$instance->_kohana_load_view($filename, $this->vars);
     } else {
         $protocol = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] === 'off') ? 'http' : 'https';
         $this->site_domain = $protocol . '://' . $_SERVER['HTTP_HOST'];
         // TODO: This needs to be worked out properly
         $this->path_prefix = '/assets/css/';
         // Load file, along with all dependencies
         $output = $this->import_and_process($this->path_prefix . $path);
     }
     if ($this->compress) {
         $output = $this->compress($output, $this->compress_config);
     }
     echo $output;
 }
Beispiel #5
0
 public static function initSampleData()
 {
     $account_id = Event::$data['account_id'];
     $location_id = Event::$data['Location'][0]['location_id'];
     $user_id = Event::$data['Location'][0]['User'][0]['user_id'];
     $keys = array();
     // TODO: THIS NEEDS TO BE MOVED to the Feature Code module once we can ensure these items happen in order!
     if ($number_id = self::voicemailQuickAuth($account_id, $location_id, $user_id)) {
         $keys[] = array('digits' => '*', 'number_id' => $number_id);
     }
     if ($number_id = self::ivrReturn($account_id, $location_id, $user_id)) {
         $keys[] = array('digits' => '0', 'number_id' => $number_id);
     }
     // TODO: THIS NEEDS TO BE MOVED to the Voicemail module once we can ensure these items happen in order!
     if ($number_id = self::genericVoicemail($account_id, $location_id, $user_id)) {
         $keys[] = array('digits' => '9', 'number_id' => $number_id);
     }
     $autoAttendant = new AutoAttendant();
     $autoAttendant['name'] = 'Main Auto-Attendant';
     $autoAttendant['description'] = 'Main Company Auto-Attendant';
     $autoAttendant['timeout'] = 5;
     $autoAttendant['digit_timeout'] = 3;
     $context = Doctrine::getTable('Context')->findOneByName('Inbound Routes');
     $autoAttendant['extension_context_id'] = $context['context_id'];
     $autoAttendant['extension_digits'] = (int) 4;
     $autoAttendant['keys'] = $keys;
     $autoAttendant['plugins'] = array('media' => array('type' => 'text_to_speech', 'tts_voice' => 'Flite/kal', 'tts_text' => 'Thank you for calling. Please dial the extension you wish to reach.'));
     $autoAttendant->save();
     // Let anyone who cares initialize things related to auto-attendants
     Event::run('bluebox.autoattendant.initialize', $autoAttendant);
 }
 /**
  * get the list of gallery items
  *
  * @param int $gid 
  * @return array
  * @author Andy Bennett
  */
 function get_list($gid)
 {
     $data = array('action' => 'list', 'name' => $this->name, 'role' => Steamauth::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     // which model are we using? one passed through or the default?
     $model = $this->model;
     $controller = Kohana::instance()->uri->segment(1);
     $tdata = array();
     $limit = 10;
     $where = null;
     if ($this->uri->segment(3)) {
         $where = array('gallery' => $gid);
     }
     // query the model
     $pagination = pagination_helper::get_pagination($limit, $model->get_total($where));
     $l = steamcore::array_object(array('limit' => $limit, 'offset' => $pagination->sql_offset()));
     $data['query'] = $model->get_list($where, $order = null, $limit = $l);
     $data['controller'] = $controller;
     $data['pagination'] = $pagination->render();
     // pass the order direction
     // $data['od'] = (!isset($lc->query_config->order_dir) || $lc->query_config->order_dir == 'DESC')?'ASC':'DESC';
     // merge any passed data and the data returned from the model
     $tdata = array_merge($tdata, $data);
     // return the result
     return $tdata;
 }
 public function github($argument = 'page', $index = 1)
 {
     if (!IN_PRODUCTION) {
         $profiler = new Profiler();
     }
     if (strtolower($argument) != 'page' || !$index || !preg_match('/^[0-9]+$/', $index)) {
         Event::run('system.404');
     }
     $pages = array('Intro', 'User Model', 'User View', 'User Search');
     $this->add_js_head_file('js/shBrushXml.js');
     $this->prepend_title('How to build a GitHub iPhone app with three20');
     $content = new View('tutorials/github/page' . $index);
     $navLinks = array();
     for ($ix = 0; $ix < count($pages); ++$ix) {
         $link = '';
         if ($ix + 1 != $index) {
             $link .= '<a href="/tutorials/github/page/' . ($ix + 1) . '">';
         }
         $link .= $pages[$ix];
         if ($ix + 1 != $index) {
             $link .= '</a>';
         }
         $navLinks[] = $link;
     }
     $content->navLinks = implode(' - ', $navLinks);
     $this->render_markdown_template($content);
 }
Beispiel #8
0
 /**
  * Render the profiler. Output is added to the bottom of the page by default.
  *
  * @param   boolean  return the output if TRUE
  * @return  void|string
  */
 public function render($return = FALSE)
 {
     $start = microtime(TRUE);
     $get = isset($_GET['profiler']) ? explode(',', $_GET['profiler']) : array();
     $this->show = empty($get) ? Kohana::config('profiler.show') : $get;
     Event::run('profiler.run', $this);
     $styles = '';
     foreach ($this->profiles as $profile) {
         $styles .= $profile->styles();
     }
     // Don't display if there's no profiles
     if (empty($this->profiles)) {
         return;
     }
     // Load the profiler view
     $data = array('profiles' => $this->profiles, 'styles' => $styles, 'execution_time' => microtime(TRUE) - $start);
     $view = new View('kohana_profiler', $data);
     // Return rendered view if $return is TRUE
     if ($return == TRUE) {
         return $view->render();
     }
     // Add profiler data to the output
     if (stripos(Kohana::$output, '</body>') !== FALSE) {
         // Closing body tag was found, insert the profiler data before it
         Kohana::$output = str_ireplace('</body>', $view->render() . '</body>', Kohana::$output);
     } else {
         // Append the profiler data to the output
         Kohana::$output .= $view->render();
     }
 }
 public function __call($method, $args)
 {
     // Concat all the arguments into a filepath
     array_unshift($args, $method);
     $path = join('/', $args);
     // Strip the extension from the filepath
     $path = substr($path, 0, -strlen($this->extension) - 1);
     // Search for file using cascading file system
     $filename = Kohana::find_file($this->directory, $path, FALSE, $this->extension);
     if (!$filename) {
         Event::run('system.404');
     }
     // Add all the module JavaScript directories to the include paths list
     foreach (Kohana::include_paths() as $path) {
         $this->include_paths[] = $path . $this->directory;
     }
     // Load file, along with all dependencies
     $preprocessor = new JavaScriptPreprocessor($this->include_paths, $this->vars);
     $output = $preprocessor->requires($filename);
     // Compress JavaScript, if desired
     if ($this->compress) {
         $output = $this->compress($output, $this->compress_config);
     }
     echo $output;
 }
 public function __construct()
 {
     if (!Auth::instance()->logged_in('admin')) {
         Event::run('system.404');
     }
     parent::__construct();
 }
Beispiel #11
0
 public function index($page_id = 1)
 {
     $this->template->header->this_page = "page_" . $page_id;
     $this->template->content = new View('page');
     if (!$page_id) {
         url::redirect('main');
     }
     $page = ORM::factory('page', $page_id)->find($page_id);
     if ($page->loaded) {
         $page_title = $page->page_title;
         $page_description = $page->page_description;
         // Special "REDIRECT:" behavior
         $testDesc = trim(strip_tags(htmlspecialchars_decode($page_description)));
         if (preg_match('/redirect:\\s*(.*)/i', $testDesc, $matches)) {
             url::redirect($matches[1]);
             return;
         }
         // Filter::page_title - Modify Page Title
         Event::run('ushahidi_filter.page_title', $page_title);
         // Filter::page_description - Modify Page Description
         Event::run('ushahidi_filter.page_description', $page_description);
         $this->template->content->page_title = $page_title;
         $this->template->content->page_description = $page_description;
         $this->template->content->page_id = $page->id;
     } else {
         url::redirect('main');
     }
     $this->template->header->header_block = $this->themes->header_block();
 }
Beispiel #12
0
 public function index($page_id = 1)
 {
     $this->template->header->this_page = "page_" . $page_id;
     $this->template->content = new View('page');
     if (!$page_id) {
         url::redirect('main');
     }
     $page = ORM::factory('page', $page_id)->find($page_id);
     if ($page->loaded) {
         $page_title = $page->page_title;
         $page_description = $page->page_description;
         // Filter::page_title - Modify Page Title
         Event::run('ushahidi_filter.page_title', $page_title);
         // Filter::page_description - Modify Page Description
         Event::run('ushahidi_filter.page_description', $page_description);
         $this->template->content->page_title = $page_title;
         $this->template->content->page_description = $page_description;
         $this->template->content->page_id = $page->id;
     } else {
         url::redirect('main');
     }
     $this->template->header->page_title .= $page_title . Kohana::config('settings.title_delimiter');
     $this->template->header->header_block = $this->themes->header_block();
     $this->template->footer->footer_block = $this->themes->footer_block();
 }
Beispiel #13
0
 public function delete($mediafile_id)
 {
     $base = strtolower($this->baseModel);
     $this->createView();
     $this->loadBaseModel($mediafile_id);
     if ($action = $this->submitted(array('submitString' => 'delete'))) {
         Event::run('bluebox.deleteOnSubmit', $action);
         if ($action == self::SUBMIT_CONFIRM) {
             if (($mf = Doctrine::getTable('MediaFile')->findOneByMediafileId($mediafile_id, Doctrine::HYDRATE_ARRAY)) === NULL) {
                 messge::set('Unable to delete media file.');
                 $this->exitQtipAjaxForm();
                 url::redirect(Router_Core::$controller);
             } else {
                 kohana::log('debug', 'Found db entry to delete: ' . print_r($mf, TRUE));
                 while (($fullPath = $this->locateFile($mf)) !== FALSE) {
                     $result = @unlink($fullPath);
                     kohana::log('debug', 'Deleting ' . $fullPath . ' with result ' . ($result ? 'TRUE' : 'FALSE'));
                 }
                 Doctrine_Query::create()->delete('MediaFile')->where('mediafile_id = ?', $mf['mediafile_id'])->execute();
                 message::set('Removed ' . basename($mf['file']));
                 $this->returnQtipAjaxForm(NULL);
                 url::redirect(Router_Core::$controller);
             }
         } else {
             if ($action == self::SUBMIT_DENY) {
                 $this->exitQtipAjaxForm();
                 url::redirect(Router_Core::$controller);
             }
         }
     }
     $this->prepareDeleteView(NULL, $mediafile_id);
 }
Beispiel #14
0
 /**
  * Used to display the index page but also uses a jquery and the pagination to do preload of next pages
  * of the news articles. Which are then displaye don scroll 
  * @param integer $page the page number  (Matt are you sure this is needed, the pagination is smart enough not to need this). 
  */
 public function index($page = 1)
 {
     $total = orm::factory('news')->where('group', 'site')->where('status', 'approved')->count_all();
     $paging = new Pagination(array('total_items' => $total, 'items_per_page' => 3));
     $articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all($paging->items_per_page, $paging->sql_offset);
     $view = new View(url::location());
     $view->articles = $articles;
     $view->pagination = $paging->render();
     $view->page_number = $paging->page_number();
     // If the request is an ajax request, then the page is attempting to autoupdate
     // the items with in the news, so just send through the news items.
     if (request::is_ajax()) {
         // if the ajax is attempting to get a page which doesnt exist, send 404
         if ($page > $paging->total_pages) {
             Event::run('system.404');
         } else {
             $this->ajax['view'] = $view;
         }
     } else {
         // otherwise its a http request, send throught he entire page with template.
         $this->template->title = 'About Us &rsaquo; News &amp; Updates Archive';
         $this->breadcrumbs->add()->url(false)->title('Archive');
         $view->breadcrumbs = $this->breadcrumbs->cut();
         $this->template->content = $view;
     }
 }
Beispiel #15
0
 static function day($day)
 {
     if (NULL == $day or !is_numeric($day) or 31 < $day or 1 > $day) {
         Event::run('system.404');
         die;
     }
     return $day;
 }
Beispiel #16
0
 public function qtipAjaxReturn($data)
 {
     if (!empty($data['external_xfer_id'])) {
         $object['numbermanager'] = array('object_name' => $data['name'], 'object_description' => 'External Transfer', 'object_number_type' => 'ExternalXferNumber', 'object_id' => $data['external_xfer_id'], 'short_name' => 'externalxfer');
         Event::run('ajax.updateobject', $object);
     }
     parent::qtipAjaxReturn($data);
 }
Beispiel #17
0
 /**
  * Render the profiler. Output is added to FirePHP
  *
  * @param   boolean  return the output if TRUE
  * @return  void|string
  */
 public static function render()
 {
     // If in production mode then exit
     if (IN_PRODUCTION and Kohana::config('fire_profiler.production_mode_off')) {
         return FALSE;
     }
     Event::run('fire-profiler.run', $this);
 }
Beispiel #18
0
 public function index()
 {
     if (!isset($_GET['pw']) or 'willow' !== $_GET['pw']) {
         Event::run('system.404');
     }
     $this->session->set('to_dashboard', TRUE);
     url::redirect('/pinky/dashboard');
 }
Beispiel #19
0
 public function qtipAjaxReturn($data)
 {
     if (!empty($data['device_id'])) {
         $object['numbermanager'] = array('object_name' => $data['name'], 'object_description' => str_replace('Device', ' Phone', $data['type']), 'object_number_type' => 'DeviceNumber', 'object_id' => $data['device_id'], 'short_name' => 'device');
         Event::run('ajax.updateobject', $object);
     }
     parent::qtipAjaxReturn($data);
 }
Beispiel #20
0
 public function qtipAjaxReturn($data)
 {
     if (!empty($data['conference_id'])) {
         $object['numbermanager'] = array('object_name' => $data['name'], 'object_description' => 'Conference Bridge', 'object_number_type' => 'ConferenceNumber', 'object_id' => $data['conference_id'], 'short_name' => 'conference');
         Event::run('ajax.updateobject', $object);
     }
     parent::qtipAjaxReturn($data);
 }
Beispiel #21
0
 /**
  * Renders a view.
  * 
  * Add an additional filter to modify view data
  *
  * @param   boolean   set to TRUE to echo the output instead of returning it
  * @param   callback  special renderer to pass the output through
  * @return  string    if print is FALSE
  * @return  void      if print is TRUE
  */
 public function render($print = FALSE, $renderer = FALSE)
 {
     // Run view_pre_render filter to allow plugins/themes to add extra data to a view
     Event::run('ushahidi_filter.view_pre_render', $this->kohana_local_data);
     // View specific hook pre render hook ie. ushahidi_filter.view_pre_render.reports_main
     Event::run('ushahidi_filter.view_pre_render.' . str_replace('/', '_', $this->name), $this->kohana_local_data);
     return parent::render($print, $renderer);
 }
Beispiel #22
0
 public function qtipAjaxReturn($data)
 {
     if (!empty($data['auto_attendant_id'])) {
         $object['numbermanager'] = array('object_name' => $data['name'], 'object_description' => 'Auto Attendant', 'object_number_type' => 'AutoAttendantNumber', 'object_id' => $data['auto_attendant_id'], 'short_name' => 'autoattendant');
         Event::run('ajax.updateobject', $object);
     }
     parent::qtipAjaxReturn($data);
 }
Beispiel #23
0
 public function qtipAjaxReturn($data)
 {
     if (!empty($data['voicemail_id'])) {
         $object['numbermanager'] = array('object_name' => $data['name'], 'object_description' => 'Voicemail Box', 'object_number_type' => 'VoicemailNumber', 'object_id' => $data['voicemail_id'], 'short_name' => 'voicemail');
         Event::run('ajax.updateobject', $object);
     }
     parent::qtipAjaxReturn($data);
 }
Beispiel #24
0
 public function qtipAjaxReturn($data)
 {
     if (!empty($data['time_of_day_id'])) {
         $object['numbermanager'] = array('object_name' => $data['name'], 'object_description' => 'Time Of Day', 'object_number_type' => 'TimeOfDayNumber', 'object_id' => $data['time_of_day_id'], 'short_name' => 'timeofday');
         Event::run('ajax.updateobject', $object);
     }
     parent::qtipAjaxReturn($data);
 }
 function __construct()
 {
     Event::add('steamcore.aclcheck', array('acl_listeners', 'redirect'));
     $data = array('action' => 'admin', 'name' => null, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     Assets::instance()->add_css('admin');
     parent::__construct();
 }
Beispiel #26
0
 static function init($mode = 'SAFE')
 {
     if ((self::$featureDrivers != null || self::$moduleFeatures) && $mode == 'SAFE') {
         throw new featureException('Driver registry has already been built and init is running in safe mode', 0);
     }
     self::$drivers = array();
     self::$moduleDrivers = array();
     Event::run('featureDriver.register');
 }
Beispiel #27
0
 /**
  * Generate Alerts Sub Tab Menus
  * @param string $this_sub_page
  * @return string $menu
  */
 public static function alerts_subtabs($this_sub_page = FALSE)
 {
     $menu = "";
     $menu .= $this_sub_page == "view" ? Kohana::lang('ui_admin.my_alerts') : "<a href=\"" . url::base() . "members/alerts\">" . Kohana::lang('ui_admin.my_alerts') . "</a>";
     //$menu .= ($this_sub_page == "edit") ? Kohana::lang('ui_admin.new_alert') : "<a href=\"".url::base()."members/alerts/edit\">".Kohana::lang('ui_admin.new_alert')."</a>";
     echo $menu;
     // Action::nav_members_alerts - Add items to the members alerts navigation tabs
     Event::run('ushahidi_action.nav_members_alerts', $this_sub_page);
 }
Beispiel #28
0
 public function login($userId)
 {
     if (users::getAttr('user_type') == User::TYPE_SYSTEM_ADMIN) {
         users::masqueradeUser($userId);
         url::redirect('/');
     } else {
         Event::run('system.404');
         die;
     }
 }
Beispiel #29
0
 /**
  * Generate Main Tabs
  * @param string $this_page
  * @param array $dontshow
  * @return string $menu
  */
 public static function main_tabs($this_page = FALSE, $dontshow = FALSE)
 {
     $menu = "";
     if (!is_array($dontshow)) {
         // Set $dontshow as an array to prevent errors
         $dontshow = array();
     }
     // Home
     if (!in_array('home', $dontshow)) {
         $menu .= "<li><a href=\"" . url::site() . "main\" ";
         $menu .= $this_page == 'home' ? " class=\"active\"" : "";
         $menu .= ">" . Kohana::lang('ui_main.home') . "</a></li>";
     }
     // Reports List
     if (!in_array('reports', $dontshow)) {
         $menu .= "<li><a href=\"" . url::site() . "reports\" ";
         $menu .= $this_page == 'reports' ? " class=\"active\"" : "";
         $menu .= ">" . Kohana::lang('ui_main.reports') . "</a></li>";
     }
     // Reports Submit
     if (!in_array('reports_submit', $dontshow)) {
         if (Kohana::config('settings.allow_reports')) {
             $menu .= "<li><a href=\"" . url::site() . "reports/submit\" ";
             $menu .= $this_page == 'reports_submit' ? " class=\"active\"" : "";
             $menu .= ">" . Kohana::lang('ui_main.submit') . "</a></li>";
         }
     }
     // Alerts
     if (!in_array('alerts', $dontshow)) {
         if (Kohana::config('settings.allow_alerts')) {
             $menu .= "<li><a href=\"" . url::site() . "alerts\" ";
             $menu .= $this_page == 'alerts' ? " class=\"active\"" : "";
             $menu .= ">" . Kohana::lang('ui_main.alerts') . "</a></li>";
         }
     }
     // Contacts
     if (!in_array('contact', $dontshow)) {
         if (Kohana::config('settings.site_contact_page')) {
             $menu .= "<li><a href=\"" . url::site() . "contact\" ";
             $menu .= $this_page == 'contact' ? " class=\"active\"" : "";
             $menu .= ">" . Kohana::lang('ui_main.contact') . "</a></li>";
         }
     }
     // Custom Pages
     $pages = ORM::factory('page')->where('page_active', '1')->find_all();
     foreach ($pages as $page) {
         $menu .= "<li><a href=\"" . url::site() . "page/index/" . $page->id . "\" ";
         $menu .= $this_page == 'page_' . $page->id ? " class=\"active\"" : "";
         $menu .= ">" . $page->page_tab . "</a></li>";
     }
     echo $menu;
     // Action::nav_admin_reports - Add items to the admin reports navigation tabs
     Event::run('ushahidi_action.nav_main_top', $this_page);
 }
Beispiel #30
0
 public static function generateConfig(&$base, &$xml = NULL)
 {
     if (empty($base['plugins']['media']['type'])) {
         kohana::log('error', 'Attempted to configure media without a type');
         return;
     }
     $type = $base['plugins']['media']['type'];
     $data = array($base['plugins']['media'], $xml, $base);
     kohana::log('debug', 'Attempting to configure media type ' . $type);
     Event::run('bluebox.media.' . $type, $data);
 }