Ejemplo n.º 1
0
/**
 * utf8::strcasecmp
 *
 * @package    Core
 * @author     Kohana Team
 * @copyright  (c) 2007 Kohana Team
 * @copyright  (c) 2005 Harry Fuecks
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
 */
function _strcasecmp($str1, $str2)
{
    if (utf8::is_ascii($str1) and utf8::is_ascii($str2)) {
        return strcasecmp($str1, $str2);
    }
    $str1 = utf8::strtolower($str1);
    $str2 = utf8::strtolower($str2);
    return strcmp($str1, $str2);
}
Ejemplo n.º 2
0
 /**
  * Magic setter
  *
  * @param  string  $key
  * @param  mixed   $value
  */
 public function __set($key, $value)
 {
     switch ($key) {
         // Date of birth
         case 'dob':
             $value = date::format(date::DATE_SQL, $value);
             break;
             // Always lowercase e-mail
         // Always lowercase e-mail
         case 'email':
             $value = utf8::strtolower($value);
             break;
     }
     parent::__set($key, $value);
 }
Ejemplo n.º 3
0
/**
 * utf8::stristr
 *
 * @package    Core
 * @author     Kohana Team
 * @copyright  (c) 2007 Kohana Team
 * @copyright  (c) 2005 Harry Fuecks
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
 */
function _stristr($str, $search)
{
    if (utf8::is_ascii($str) and utf8::is_ascii($search)) {
        return stristr($str, $search);
    }
    if ($search == '') {
        return $str;
    }
    $str_lower = utf8::strtolower($str);
    $search_lower = utf8::strtolower($search);
    preg_match('/^(.*?)' . preg_quote($search, '/') . '/s', $str_lower, $matches);
    if (isset($matches[1])) {
        return substr($str, strlen($matches[1]));
    }
    return FALSE;
}
Ejemplo n.º 4
0
Archivo: user.php Proyecto: anqqa/Anqh
 /**
  * Magic setter
  *
  * @param  string  $key
  * @param  mixed   $value
  */
 public function __set($key, $value)
 {
     switch ($key) {
         // Date of birth
         case 'dob':
             $value = date::format(date::DATE_SQL, $value);
             break;
             // Always lowercase e-mail
         // Always lowercase e-mail
         case 'email':
             $value = utf8::strtolower($value);
             break;
             // Use Auth to hash the password
         // Use Auth to hash the password
         case 'password':
             $value = Visitor::instance()->hash_password($value);
             break;
     }
     parent::__set($key, $value);
 }
Ejemplo n.º 5
0
/**
 * utf8::str_ireplace
 *
 * @package    Core
 * @author     Kohana Team
 * @copyright  (c) 2007 Kohana Team
 * @copyright  (c) 2005 Harry Fuecks
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
 */
function _str_ireplace($search, $replace, $str, &$count = NULL)
{
    if (utf8::is_ascii($search) and utf8::is_ascii($replace) and utf8::is_ascii($str)) {
        return str_ireplace($search, $replace, $str, $count);
    }
    if (is_array($str)) {
        foreach ($str as $key => $val) {
            $str[$key] = utf8::str_ireplace($search, $replace, $val, $count);
        }
        return $str;
    }
    if (is_array($search)) {
        $keys = array_keys($search);
        foreach ($keys as $k) {
            if (is_array($replace)) {
                if (array_key_exists($k, $replace)) {
                    $str = utf8::str_ireplace($search[$k], $replace[$k], $str, $count);
                } else {
                    $str = utf8::str_ireplace($search[$k], '', $str, $count);
                }
            } else {
                $str = utf8::str_ireplace($search[$k], $replace, $str, $count);
            }
        }
        return $str;
    }
    $search = utf8::strtolower($search);
    $str_lower = utf8::strtolower($str);
    $total_matched_strlen = 0;
    $i = 0;
    while (preg_match('/(.*?)' . preg_quote($search, '/') . '/s', $str_lower, $matches)) {
        $matched_strlen = strlen($matches[0]);
        $str_lower = substr($str_lower, $matched_strlen);
        $offset = $total_matched_strlen + strlen($matches[1]) + $i * (strlen($replace) - 1);
        $str = substr_replace($str, $replace, $offset, strlen($search));
        $total_matched_strlen += $matched_strlen;
        $i++;
    }
    $count += $i;
    return $str;
}
Ejemplo n.º 6
0
 /**
  * Retrieve User by UserName or Real Name
  */
 public function get_user()
 {
     $db = Database::instance();
     $this->template = "";
     $this->auto_render = FALSE;
     $name = isset($_GET['q']) ? utf8::strtolower('%' . str_replace(array('%', '_'), array('|%', '|_'), $_GET['q']) . '%') : "";
     if ($name) {
         $users = $db->query("SELECT * from users where id != :id AND LOWER(name) LIKE :name ESCAPE '|'", array(':id' => $this->user->id, ':name' => $name));
         foreach ($users as $user) {
             echo "{$user->name}\n";
         }
     } else {
         return;
     }
 }
Ejemplo n.º 7
0
</h3>
				<sup><?php 
    echo $venue_category->description;
    ?>
</sup>
				<ul>
				<?php 
    $city_id = false;
    foreach ($venue_category->venues->find_all() as $venue) {
        if ($venue->city_id == $city_id) {
            continue;
        }
        $city_id = $venue->city_id;
        ?>
					<li><?php 
        echo html::anchor(url::model($venue_category) . '#' . utf8::strtolower($venue->city->city), $venue->city->city);
        ?>
</li>
				<?php 
    }
    ?>
				</ul>

			</li>
		<?php 
}
?>

		</ul>
	</div>
</section>
Ejemplo n.º 8
0
 /**
  * Formatted title text
  *
  * @param	  string  $title
  * @param   bool    $format text
  * @return  string
  */
 public static function title($title, $format = true)
 {
     return html::specialchars($title);
     return html::specialchars($format ? utf8::ucwords(utf8::strtolower($title)) : $title);
 }
Ejemplo n.º 9
0
 protected function _saveField($plugin, $table, $categoryID, $fieldID, $fieldOld, $configs, $hidden)
 {
     // Check if demo mode is enabled
     if (input::demo()) {
         return false;
     }
     // Rules array
     $rules = array();
     // Data array
     $inputData = array('keyword', 'type', 'style', 'class', 'required', 'system', 'multilang');
     // Name
     foreach (config::item('languages', 'core', 'keywords') as $languageID => $lang) {
         $rules['name_' . $lang] = array('label' => __('name', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'required', 'max_length' => 255));
         $rules['vname_' . $lang] = array('label' => __('name_view', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'max_length' => 255));
         $rules['sname_' . $lang] = array('label' => __('name_search', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'max_length' => 255));
         $rules['validate_error_' . $lang] = array('label' => __('validate_error', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'max_length' => 255));
         $inputData[] = 'name_' . $lang;
         $inputData[] = 'vname_' . $lang;
         $inputData[] = 'sname_' . $lang;
         $inputData[] = 'validate_error_' . $lang;
     }
     // Keyword
     $rules['keyword'] = array('label' => __('keyword', 'system'), 'rules' => array('trim', 'required', 'alpha_dash', 'max_length' => 128, 'callback__is_unique_keyword' => array($plugin, $categoryID, $fieldID), 'callback__is_system_field' => array($fieldID ? $fieldOld['keyword'] : '', $fieldID ? $fieldOld['system'] : '')));
     // Type
     $rules['type'] = array('label' => __('field_type', 'system_fields'), 'rules' => array('required', 'callback__is_system_field' => array($fieldID ? $fieldOld['type'] : '', $fieldID ? $fieldOld['system'] : '')));
     // Style value
     $rules['style'] = array('label' => __('style', 'system_fields'), 'rules' => array('trim'));
     // Class value
     $rules['class'] = array('label' => __('class', 'system_fields'), 'rules' => array('trim'));
     // Required
     $rules['required'] = array('label' => __('required', 'system_fields'), 'rules' => array('intval'));
     // Regular expression
     $rules['validate'] = array('label' => __('validate', 'system_fields'), 'rules' => array('trim'));
     $inputData[] = 'validate';
     // Configuration array
     $inputConfig = array();
     foreach (array('custom', input::post('type')) as $conf) {
         if (isset($configs[$conf])) {
             foreach ($configs[$conf] as $option) {
                 $rules['config_' . $conf . '_' . $option['keyword']] = array('label' => utf8::strtolower($option['label']), 'rules' => isset($option['rules']) ? $option['rules'] : array());
                 $inputConfig[$option['keyword']] = 'config_' . $conf . '_' . $option['keyword'];
             }
         }
     }
     // Add items rules
     $items = array();
     $oldItems = $fieldID ? $fieldOld['items'] : array();
     if ($this->fields_model->isMultiValue(input::post('type'))) {
         $itemsPost = input::post('items');
         $sitemsPost = input::post('sitems');
         foreach (config::item('languages', 'core', 'keywords') as $languageID => $lang) {
             $orderID = 1;
             if (isset($itemsPost[$lang]) && is_array($itemsPost[$lang])) {
                 foreach ($itemsPost[$lang] as $itemID => $itemName) {
                     // Trim name
                     $itemName = utf8::trim($itemName);
                     // Assign item data
                     $items[$itemID]['order_id'] = $orderID;
                     $items[$itemID]['name_' . $lang] = $itemName;
                     $items[$itemID]['sname_' . $lang] = $sitemsPost[$lang][$itemID];
                     $orderID++;
                     // Add rule
                     $rules['items[' . $lang . '][' . $itemID . ']'] = array();
                     if ($itemName == '') {
                         validate::setRule('items', '', '');
                         validate::setFieldError('items', __('empty_item', 'system_fields') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''));
                     }
                 }
             }
         }
         if (!$items) {
             validate::setRule('items', '', '');
             validate::setFieldError('items', __('no_items', 'system_fields'));
         }
         view::assign(array('field' => array('items' => $items)));
     }
     // Assign rules
     validate::setRules($rules);
     // Validate fields
     if (!validate::run()) {
         return false;
     }
     // Get post data
     $fieldData = input::post($inputData);
     // Default data
     $fieldData['system'] = isset($hidden['system']) ? $hidden['system'] : 0;
     $fieldData['multilang'] = isset($hidden['multilang']) ? $hidden['multilang'] : 0;
     // Get config data
     $fieldData['config'] = array();
     foreach ($inputConfig as $key => $val) {
         $fieldData['config'][$key] = input::post($val);
     }
     // Set additional config data
     $fieldData['config']['html'] = input::post('html') ? 1 : 0;
     $fieldData['config']['in_search'] = input::post('in_search') ? 1 : 0;
     $fieldData['config']['in_search_advanced'] = input::post('in_search_advanced') ? 1 : 0;
     if ($fieldData['config']['in_search'] || $fieldData['config']['in_search_advanced']) {
         $fieldData['config']['search_options'] = input::post('search_options') ? input::post('search_options') : '';
     }
     if (input::post('type') == 'checkbox' || input::post('search_options') == 'multiple') {
         $fieldData['config']['columns_number'] = input::post('columns_number') && input::post('columns_number') >= 1 && input::post('columns_number') <= 4 ? input::post('columns_number') : 1;
     }
     // Save field
     if (!($newFieldID = $this->fieldsdb_model->saveField($plugin, $table, $categoryID, $fieldID, $fieldData, $items))) {
         view::setError(__('db_no_alter', 'system_fields'));
         return false;
     }
     // Check if order of items have changed
     if ($fieldID && $this->fields_model->isMultiValue(input::post('type')) && $this->fields_model->isValueColumn(input::post('type'))) {
         // Get old and new item IDs
         $itemsOldIDs = $itemsNewIDs = array();
         foreach ($oldItems as $itemID => $item) {
             $itemsOldIDs[$itemID] = $item['order_id'];
         }
         foreach ($items as $itemID => $item) {
             $itemsNewIDs[$itemID] = $item['order_id'];
         }
         // Do we have any differences?
         if (array_diff_assoc($itemsOldIDs, $itemsNewIDs)) {
             // Update items IDs
             $this->fieldsdb_model->updateItemsIDs($table, $fieldData['keyword'], $itemsOldIDs, $itemsNewIDs);
         }
     }
     // Adjust table column
     $this->fieldsdb_model->adjustColumn($table, $fieldData['keyword'], $newFieldID, $fieldData);
     // Success
     view::setInfo(__('field_saved', 'system_fields'));
     router::redirect('cp/system/fields/' . $plugin . '/edit/' . $categoryID . '/' . $newFieldID);
 }
Ejemplo n.º 10
0
 public function _is_comments_delay()
 {
     if (session::permission('comments_delay_limit', 'comments')) {
         $comments = $this->comments_model->countRecentComments();
         if ($comments >= session::permission('comments_delay_limit', 'comments')) {
             validate::setError('_is_comments_delay', __('comments_delay_reached', 'comments', array('%comments' => session::permission('comments_delay_limit', 'comments'), '%time' => session::permission('comments_delay_time', 'comments'), '%type' => utf8::strtolower(__((session::permission('comments_delay_type', 'comments') == 'minutes' ? 'minute' : 'hour') . (session::permission('comments_delay_time', 'comments') > 1 ? 's' : ''), 'date')))));
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 11
0
 function mb_strtolower($str)
 {
     return utf8::strtolower($str);
 }
Ejemplo n.º 12
0
 /**
  * Build filter items
  *
  * @param   ORM_Iterator  $events
  * @return  array
  */
 public function _build_filters(ORM_Iterator $events)
 {
     $filters = array();
     if ($events->count()) {
         $cities = array();
         // Build filter list
         foreach ($events as $event) {
             // Build city
             $city = $event->city_id ? $event->city->city : $event->city_name;
             $filter = url::title($city);
             if (!isset($cities[$filter])) {
                 $cities[$filter] = utf8::ucfirst(utf8::strtolower($city));
             }
         }
         // Drop empty to last
         ksort($cities);
         if (isset($cities[''])) {
             $cities[url::title(__('Elsewhere'))] = utf8::ucfirst(utf8::strtolower(__('Elsewhere')));
             unset($cities['']);
         }
         // Build city filter
         $filters['city'] = array('name' => __('City'), 'filters' => $cities);
     }
     return $filters;
 }
Ejemplo n.º 13
0
 /**
  * Validate this input based on the set rules.
  *
  * @return  bool
  */
 public function validate()
 {
     // Validation has already run
     if (is_bool($this->is_valid)) {
         return $this->is_valid;
     }
     // No data to validate
     if ($this->input_value() == FALSE) {
         return $this->is_valid = FALSE;
     }
     // Load the submitted value
     $this->load_value();
     // No rules to validate
     if (count($this->rules) == 0 and count($this->matches) == 0 and count($this->callbacks) == 0) {
         return $this->is_valid = TRUE;
     }
     if (!empty($this->rules)) {
         foreach ($this->rules as $rule) {
             if (($offset = strpos($rule, '[')) !== FALSE) {
                 // Get the args
                 $args = preg_split('/, ?/', trim(substr($rule, $offset), '[]'));
                 // Remove the args from the rule
                 $rule = substr($rule, 0, $offset);
             }
             if (substr($rule, 0, 6) === 'valid_' and method_exists('valid', substr($rule, 6))) {
                 $func = substr($rule, 6);
                 if ($this->value and !valid::$func($this->value)) {
                     $this->errors[$rule] = TRUE;
                 }
             } elseif (method_exists($this, 'rule_' . $rule)) {
                 // The rule function is always prefixed with rule_
                 $rule = 'rule_' . $rule;
                 if (isset($args)) {
                     // Manually call up to 2 args for speed
                     switch (count($args)) {
                         case 1:
                             $this->{$rule}($args[0]);
                             break;
                         case 2:
                             $this->{$rule}($args[0], $args[1]);
                             break;
                         default:
                             call_user_func_array(array($this, $rule), $args);
                             break;
                     }
                 } else {
                     // Just call the rule
                     $this->{$rule}();
                 }
                 // Prevent args from being re-used
                 unset($args);
             } else {
                 throw new Kohana_Exception('validation.invalid_rule', $rule);
             }
             // Stop when an error occurs
             if (!empty($this->errors)) {
                 break;
             }
         }
     }
     if (!empty($this->matches)) {
         foreach ($this->matches as $input) {
             if ($this->value != $input->value) {
                 // Field does not match
                 $this->errors['matches'] = array($input->label ? utf8::strtolower($input->label) : $input->name);
                 break;
             }
         }
     }
     if (!empty($this->callbacks)) {
         foreach ($this->callbacks as $callback) {
             call_user_func($callback, $this);
             // Stop when an error occurs
             if (!empty($this->errors)) {
                 break;
             }
         }
     }
     // If there are errors, validation failed
     return $this->is_valid = empty($this->errors);
 }
Ejemplo n.º 14
0
 /**
  * Construct new page controller
  */
 function __construct()
 {
     parent::__construct();
     // Init page values
     $this->country = Session::instance()->get('country', false);
     // AJAX requests output without template
     if (request::is_ajax()) {
         $this->auto_render = false;
         $this->history = false;
         return;
     }
     // Use profiler only when an admin is logged in
     if ($this->visitor->logged_in('admin')) {
         Profiler::enable();
     }
     // Bind the generic page variables
     $this->template->bind('skin', $this->skin)->bind('skin_imports', $this->skin_imports)->bind('stylesheets', $this->stylesheets)->bind('language', $this->language)->bind('page_width', $this->page_width)->bind('page_main', $this->page_main)->bind('page_id', $this->page_id)->bind('page_class', $this->page_class)->bind('page_title', $this->page_title)->bind('page_subtitle', $this->page_subtitle);
     // Add controller name as default page id
     $this->page_id = Router::$controller;
     // Init page values
     $this->menu = Kohana::config('site.menu');
     $skin_path = 'ui/' . Kohana::config('site.skin') . '/';
     $this->skin = $skin_path . 'skin.less';
     $this->skin_imports = array('ui/layout.less', 'ui/widget.less', 'ui/jquery-ui.css', 'ui/site.css', $skin_path . 'jquery-ui.css');
     $this->page_width = Session::instance()->get('page_width', 'fixed');
     $this->page_main = Session::instance()->get('page_main', 'left');
     //$this->stylesheets = array('ui/' . Kohana::config('site.skin') . '/skin', 'ui/' . Kohana::config('site.skin') . '/jquery-ui');
     $this->breadcrumb = array();
     //html::anchor('/', __('Home')));
     $this->tabs = array();
     // If a country is seleced, add custom stylesheet
     if ($this->country && Kohana::config('site.country_css')) {
         widget::add('head', html::stylesheet('ui/' . utf8::strtolower($this->country) . '/skin'));
     }
     // Generic views
     widget::add('actions', View::factory('generic/actions')->bind('actions', $this->page_actions));
     // widget::add('breadcrumb', View::factory('generic/breadcrumb')->bind('breadcrumb', $this->breadcrumb));
     widget::add('navigation', View::factory('generic/navigation')->bind('items', $this->menu)->bind('selected', $this->page_id));
     widget::add('tabs', View::factory('generic/tabs_top')->bind('tabs', $this->tabs)->bind('selected', $this->tab_id));
     // Header
     widget::add('header', View::factory('generic/header'));
     // Footer
     widget::add('footer', View_Mod::factory('events/events_list', array('mod_id' => 'footer-events-new', 'mod_class' => 'article unit size1of4 cut events', 'mod_title' => __('New events'), 'events' => ORM::factory('event')->order_by('id', 'DESC')->find_all(10))));
     widget::add('footer', View_Mod::factory('forum/topics_list', array('mod_id' => 'footer-topics-active', 'mod_class' => 'article unit size1of4 cut topics', 'mod_title' => __('New posts'), 'topics' => ORM::factory('forum_topic')->order_by('last_post_id', 'DESC')->find_all(10))));
     widget::add('footer', View_Mod::factory('blog/entries_list', array('mod_id' => 'footer-blog-entries', 'mod_class' => 'article unit size1of4 cut blogentries', 'mod_title' => __('New blogs'), 'entries' => ORM::factory('blog_entry')->find_latest(10))));
     // Dock
     $classes = array(html::anchor('set/width/narrow', __('Narrow'), array('onclick' => '$("body").addClass("fixed").removeClass("liquid"); $.get(this.href); return false;')), html::anchor('set/width/wide', __('Wide'), array('onclick' => '$("body").addClass("liquid").removeClass("narrow"); $.get(this.href); return false;')), html::anchor('set/main/left', __('Left'), array('onclick' => '$("body").addClass("left").removeClass("right"); $.get(this.href); return false;')), html::anchor('set/main/right', __('Right'), array('onclick' => '$("body").addClass("right").removeClass("left"); $.get(this.href); return false;')));
     widget::add('dock2', __('Layout: ') . implode(', ', $classes));
     // Language selection
     $available_languages = Kohana::config('locale.languages');
     if (count($available_languages)) {
         $languages = array();
         foreach ($available_languages as $lang => $locale) {
             $languages[] = html::anchor('set/lang/' . $lang, html::chars($locale[2]));
         }
         widget::add('dock2', ' | ' . __('Language: ') . implode(', ', $languages));
     }
     if ($this->user) {
         // Authenticated view
         widget::add('dock', __('[#:id] :user', array(':id' => $this->user->id, ':user' => html::nick($this->user->id, $this->user->username))));
         $new_messages = array();
         if ($this->user->newcomments) {
             $new_messages[] = html::anchor(url::user($this->user), __(':commentsC', array(':comments' => $this->user->newcomments)), array('title' => __('New comments'), 'class' => 'new-comments'));
         }
         if (!empty($new_messages)) {
             widget::add('dock', ' - ' . __('New messages: ') . implode(' ', $new_messages));
         }
         // Logout also from Facebook
         if (FB::enabled() && Visitor::instance()->get_provider()) {
             widget::add('dock', ' - ' . html::anchor('sign/out', FB::icon() . __('Sign out'), array('onclick' => "FB.Connect.logoutAndRedirect('/sign/out'); return false;")));
         } else {
             widget::add('dock', ' - ' . html::anchor('sign/out', __('Sign out')));
         }
         if (Kohana::config('site.inviteonly')) {
             //				widget::add('dock', ' | ' . html::anchor('sign/up', __('Send invite')));
         }
         // Admin functions
         if ($this->visitor->logged_in('admin')) {
             widget::add('dock2', ' | ' . __('Admin: ') . html::anchor('roles', __('Roles')) . ', ' . html::anchor('tags', __('Tags')) . ', ' . html::anchor('#kohana-profiler', __('Profiler'), array('onclick' => '$("#kohana-profiler").toggle();')));
         }
     } else {
         // Non-authenticated view
         $form = form::open('sign/in');
         $form .= form::input('username', null, 'title="' . __('Username') . '"');
         $form .= form::password('password', '', 'title="' . __('Password') . '"');
         $form .= form::submit('submit', __('Sign in'));
         $form .= form::close();
         $form .= html::anchor('/sign/up', __('Sign up'));
         if (FB::enabled()) {
             $form .= ' | ' . FB::fbml_login();
         }
         widget::add('dock', $form);
     }
     // End
     widget::add('end', View::factory('generic/end'));
     // Analytics
     $google_analytics = Kohana::config('site.google_analytics');
     if ($google_analytics) {
         widget::add('head', html::script_source("\nvar _gaq = _gaq || []; _gaq.push(['_setAccount', '" . $google_analytics . "']); _gaq.push(['_trackPageview']);\n(function() {\n\tvar ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n\tga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n\t(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);\n})();\n"));
     }
     // Ads
     $ads = Kohana::config('site.ads');
     if ($ads && $ads['enabled']) {
         foreach ($ads['slots'] as $ad => $slot) {
             widget::add($slot, View::factory('ads/' . $ad));
         }
     }
     // Facebook connect
     if (FB::enabled()) {
         FB::init();
     }
 }
Ejemplo n.º 15
0
 public function manage()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // Assign user from session to variable
     $user = session::section('session');
     $user['config'] = session::section('config');
     // Get user counters
     $counters = hook::filter('users/profile/view/counters', array(), $user);
     // Merge user and counters
     if ($counters) {
         $user = array_merge($user, $counters);
     }
     // Get fields
     $fields = $this->fields_model->getFields('users', session::item('type_id'), 'view', 'in_view');
     // Delete empty sections
     $this->fields_model->deleteEmptySections($fields, $user);
     // Assign vars
     view::assign(array('user' => $user, 'fields' => $fields));
     // Set title
     view::setMetaTitle(__('my_profile', 'system_navigation'));
     // Set trail
     view::setTrail($user['slug'], __('my_profile', 'system_navigation'));
     if (config::item('user_last_visit', 'users')) {
         if (!$user['invisible']) {
             if ($user['online']) {
                 view::setTrail(false, '<span class="users online">' . __('status_online', 'users') . '</span>', array('side' => true));
             } else {
                 view::setTrail(false, '<span class="users date">' . __('status_visit_date', 'users', array('%span' => utf8::strtolower(date_helper::humanSpan($user['visit_date'])))) . '</span>', array('side' => true));
             }
         }
     }
     // Load view
     view::load('users/profile/view');
 }
Ejemplo n.º 16
0
<h3<?php 
echo isset($id) ? ' id="' . html::specialchars(utf8::strtolower($id)) . '"' : '';
?>
><?php 
echo html::specialchars($title);
?>
</h3>
<ul>
	<?php 
foreach ($venues as $venue) {
    ?>
	<li class="venue venue-<?php 
    echo $venue->id;
    ?>
 grid-2">
		<?php 
    echo View::factory('venues/venue_mini', array('venue' => $venue));
    ?>
	</li>
	<?php 
}
?>
</ul>