Example #1
0
 public function before()
 {
     parent::before();
     $auth = \Auth::instance('SimpleAuth');
     if (\Input::get('logout')) {
         $auth->logout();
         \Response::redirect(\Uri::base(false) . 'admin/login');
     }
     $uri = explode('/', \Uri::string());
     if ($auth->check()) {
         if (count($uri) < 3 && (empty($uri[1]) || $uri[1] == 'login')) {
             \Response::redirect(\Uri::base(false) . 'admin/list');
         }
         // Load admin Config for List View and default to first tab
         $this->data['tabs'] = $this->template->tabs = \Config::get('admin.tabs');
         $this->data['table'] = $this->param('item', '');
         // get item from URI
         if (!$this->data['table']) {
             list($this->data['table']) = array_slice(array_keys($this->data['tabs']), 0, 1);
         }
         $this->template->table = $this->data['table'];
     } elseif (count($uri) > 1 && $uri[1] != 'login') {
         \Response::redirect(\Uri::base(false) . 'admin/login');
     }
     if ($this->auto_render === true) {
         // set up defaults
         $this->template->body = '';
     }
     return true;
 }
Example #2
0
 public function before()
 {
     if (!\CMF\Auth::check(null, 'view', 'admin_site')) {
         \Response::redirect("/admin/login?next=" . \Uri::string(), 'location');
     }
     \Lang::$autosave = false;
     // Find the lang from the session, or from the user
     if ($this->lang_enabled = \Config::get('cmf.languages.enabled', false)) {
         $lang = \Session::get('cmf.admin.language');
         if ($lang === null) {
             $user = \CMF\Auth::current_user();
             $lang = $user->default_language;
         }
         if (!empty($lang) && strlen($lang) !== 0 && $lang !== null) {
             \CMF::setLang($lang);
         }
     }
     // Allows us to set the interface template via an integer
     $this->mode = \Input::param('_mode', 'default');
     $this->interface_template = \Config::get('cmf.admin.interface_templates.' . $this->mode);
     // A unique ID that can be passed through
     $this->cid = \Input::param('_cid', 'none');
     // Lang info
     $this->current_lang = \Lang::get_lang();
     $this->fallback_lang = \Lang::$fallback;
     $this->lang_lines = \Lang::$lines;
 }
Example #3
0
 /**
  * @param   none
  * @throws  none
  * @returns	void
  */
 public function before()
 {
     $result = array();
     // users need to be logged in to access this controller
     if (!\Sentry::check()) {
         $result = array('message' => 'You need to be logged in to access that page.', 'url' => '/admin/login');
         // Don't show this message if url is just 'admin'
         if (\Uri::string() == 'admin/admin/index') {
             unset($result['message']);
         }
         \Session::set('redirect_to', \Uri::admin('current'));
     } else {
         if (!\Sentry::user()->is_admin()) {
             $result = array('message' => 'Access denied. You need to be a member of staff to access that page.', 'url' => '/admin/login');
             \Session::set('redirect_to', \Uri::admin('current'));
         }
     }
     if (!empty($result)) {
         if (\Input::is_ajax()) {
             \Messages::error('You need to be logged in to complete this action.');
             echo \Messages::display('left', false);
             exit;
         } else {
             if (isset($result['message'])) {
                 \Messages::warning($result['message']);
             }
             \Response::redirect($result['url']);
         }
     }
     parent::before();
 }
Example #4
0
 public function before()
 {
     $this->nocversion = 'none';
     $path = $this->request->route->path;
     if ($path != 'auth/login') {
         $this->check_license($path);
     }
     parent::before();
     //$auth = Auth::instance();
     //Auth::instance()->login('hrvoje','hajduk81');
     /*
     if(!$this->check_license())
     \Response::redirect(\Config::get('base_url').'/ajax/license');
     */
     $uri_string = explode('/', Uri::string());
     if (count($uri_string) > 1 and $uri_string[0] == 'auth' and $uri_string[1] == 'login') {
         return;
     }
     if ($path != '_root_') {
         if (\Sentry::check()) {
             $this->user = Sentry::user()->get('id');
             $this->username = Sentry::user()->get('username');
             return;
         } else {
             $this->user = false;
             $this->username = '';
             \Response::redirect(\Config::get('base_url') . 'auth/login');
         }
     }
 }
Example #5
0
 public function before()
 {
     parent::before();
     if (Request::active()->controller !== 'Controller_Admin' or !in_array(Request::active()->action, array('login', 'logout'))) {
         if (Auth::check()) {
         } else {
             \Cookie::set('redirect_back_url', \Uri::string(), 60 * 10);
             \Response::redirect('admin/login');
         }
     }
 }
Example #6
0
 public function before()
 {
     parent::before();
     $uri_string = explode('/', Uri::string());
     $this->template->logged_in = false;
     if (count($uri_string) > 1 and $uri_string[0] == 'users' and $uri_string[1] == 'login') {
         return;
     } else {
         if (\Auth::check()) {
             $user = \Auth::instance()->get_user_id();
             $this->user_id = $user[1];
             $this->template->logged_in = true;
         } else {
             \Response::redirect('/users/login');
         }
     }
 }
Example #7
0
 public function before()
 {
     $uri_string = explode('/', Uri::string());
     if (count($uri_string) > 1 and $uri_string[0] == 'user' and $uri_string[1] == 'login') {
         return;
     } else {
         $user_id = \Auth\Auth::instance()->get_user_id()[1];
         /*($user_id);
           exit();*/
         if ($user_id) {
             $user = Model_User::find($user_id);
             if (!$user || $user->group != 100) {
                 Response::redirect('/user/login');
             }
         } else {
             Response::redirect('/user/login');
         }
     }
 }
Example #8
0
 public function before()
 {
     parent::before();
     \Session::set("current_page", \Uri::string());
     $segments = implode(\Uri::segments());
     if (Auth::check() || $segments == 'userlogin') {
         list($driver, $user_id) = Auth::get_user_id();
         $this->current_user = Model_User::find($user_id);
     } else {
         if ($segments != 'userlogin') {
             Session::set("lastpage", implode("/", \Uri::segments()));
         }
         $this->current_user = null;
         Response::redirect('user/login');
     }
     if ($segments != 'userlogin') {
         View::set_global('group_name', Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
         View::set_global('current_user', $this->current_user);
     }
 }
Example #9
0
 protected function check_ssl_required_request_and_redirect()
 {
     if (IS_SSL) {
         return;
     }
     if (!FBD_SSL_MODE || !in_array(FBD_SSL_MODE, array('ALL', 'PARTIAL'))) {
         return;
     }
     $ssl_url = Uri::create(Uri::string_with_query(), array(), array(), true);
     if (FBD_SSL_MODE == 'ALL') {
         Response::redirect($ssl_url);
     }
     $module = Site_Util::get_module_name();
     if ($module && in_array($module, conf('ssl_required.modules'))) {
         Response::redirect($ssl_url);
     }
     if (Site_Util::check_ssl_required_uri(Uri::string(), false, false)) {
         Response::redirect($ssl_url);
     }
 }
Example #10
0
 public function action_index()
 {
     echo 'uri::string = ' . \Uri::string() . '<br><br>';
     echo "\n\n";
     echo __FILE__ . '<br><br>';
     echo "\n\n";
     echo '\\' . __NAMESPACE__ . '<br>';
     echo "\n";
     echo __CLASS__ . '::' . __FUNCTION__ . '<br><br>';
     echo "\n\n";
     echo \Html::anchor('', 'root') . '<br>';
     echo "\n";
     echo \Html::anchor('admin', 'root admin') . '<br>';
     echo "\n";
     echo \Html::anchor('tmd', 'test module') . '<br>';
     echo "\n";
     echo \Html::anchor('tmd/admin', 'test module admin') . '<br>';
     echo "\n";
     echo \Html::anchor('tmd/admin/cont', 'test module admin controller') . '<br>';
     echo "\n";
 }
Example #11
0
 /**
  * Display detailed page of Article
  *
  * @param void
  * @access public
  * @author Nguyen Van Hiep
  *
  * @version 1.0
  * @since 1.0
  */
 public function action_view()
 {
     $art_check = Model_Article::get_art_from_slug(Uri::segment(2));
     if (!$art_check) {
         Response::redirect('common/error');
     }
     $uri = explode('-', Uri::string());
     $id = array_pop($uri);
     $art = Model_Article::find($id);
     $cat = Model_Categories::get_cat_from_slug(Uri::segment(1));
     $related_arts = Model_Article::articles_of_cat_limit($cat->id, $this->lang, $id);
     if (!$art) {
         Session::set_flash('error', __('message.art_not_exist'));
         Response::redirect('common/404');
     }
     $art->views = $art->views + 1;
     $art->save();
     if ($cat->display_type == DS_SANPHAM) {
         $this->template = \View::forge('customer/template_sanpham_detail');
         $view = View::forge('customer/article/detail_sp_slide');
     } elseif ($cat->display_type == DS_MONAN) {
         $this->template = \View::forge('customer/template_monan');
         $view = View::forge('customer/article/detail_monan_slide');
     } elseif ($cat->display_type == QUY_TRINH_SX) {
         $view = View::forge('customer/article/detail_quytrinhsx');
     } else {
         $view = View::forge('customer/article/detail');
     }
     $view->art = $art;
     $view->related_arts = $related_arts;
     $view->cat = $cat;
     if (!empty($cat->parent_id)) {
         $view->p_cat = Model_Categories::find($cat->parent_id);
     }
     // data to display menu
     $this->template->cats = Model_Categories::get_cats_home($this->lang);
     $this->template->pepper_arts = Model_Article::pepper_artilces($this->lang);
     $this->template->title = Security::strip_tags($art->title);
     $this->template->content = $view;
 }
Example #12
0
 /**
  * Display articles in category
  *
  * @param void
  * @access public
  * @author Nguyen Van Hiep
  *
  * @version 1.0
  * @since 1.0
  */
 public function action_view()
 {
     $uri = explode('/', Uri::string());
     $slug = str_replace('.html', '', $uri[1]);
     $cat = Model_Categories::get_cat_from_slug($slug);
     if (!$cat) {
         Response::redirect('common/404');
     }
     $arts = Model_Article::articles_of_cat($cat->id, $this->lang, $cat->art_display_by_order);
     switch ($cat->display_type) {
         case DS_SANPHAM:
             //Hien thi phan [san pham]
             $this->ds_sanpham($arts, $cat);
             break;
         case CHUNGNHAN:
             //Hien thi phan [san pham]
             $this->chungnhan($arts, $cat);
             break;
         case VECHUNGTOI:
             //Hien thi phan [chung toi]
             $this->vechungtoi($arts, $cat);
             break;
         case THUONGHIEU:
             $this->thuonghieu($arts, $cat);
             break;
         case DS_TINTUC:
             $ret = $this->article_list($arts, $cat);
             break;
             // hien thi khi click vao AM THUC
         // hien thi khi click vao AM THUC
         case DS_MONAN:
             $this->ds_monan($arts, $cat);
             break;
         case QUY_TRINH_SX:
             $ret = $this->quytrinh_sx($arts, $cat);
             break;
         default:
             break;
     }
 }
Example #13
0
 public function before()
 {
     $this->template = $this->newIntranet() ? "templates/layout" : "template";
     \Session::set("current_page", \Uri::string());
     $segments = implode(\Uri::segments());
     if (\Auth::check() || $segments == 'userlogin') {
         list($driver, $user_id) = \Auth::get_user_id();
         $this->current_user = \Model_User::find($user_id);
     } else {
         if ($segments != 'userlogin') {
             \Session::set("lastpage", implode("/", \Uri::segments()));
         }
         $this->current_user = null;
         \Response::redirect('user/login');
     }
     if ($segments != 'userlogin') {
         \View::set_global('group_name', \Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
         \View::set_global('current_user', $this->current_user);
     }
     parent::before();
     // Remove when login implemented
 }
Example #14
0
 /**
  * constructor de Link y Ajax javascript
  * requiere obligadamente algunos Atributos como el Nombre del Model actual
  * argumentos : db_table 
  */
 protected function AjaxConstruct($field_html)
 {
     $table_this = substr($this->attributes->NameModel, '4', '-6');
     $uri = new Uri();
     $uri_string = $uri->string();
     $uri_string = str_replace($table_this, $this->args->db_table, $uri_string);
     $uri_string_save = $uri_string;
     $uri_string = explode('/edit/', $uri_string);
     $bl = count($uri_string);
     if (count($uri_string) == 1) {
         $uri_string = explode('/add', $uri_string_save);
     }
     $uri_string_ajax = url::base(FALSE) . $uri_string[0] . '/ajax/' . $this->PkID . '/ajaxfield/' . $this->field_name;
     $uri_string_ajax = str_replace(array("mod/" . $this->args->db_table, 'tbl_' . $this->args->db_table), array("mod/" . $table_this, 'tbl_' . $table_this), $uri_string_ajax);
     $_SESSION['PKID'] = $this->PkID;
     $uri_string = $uri_string[0] . '/add';
     $href = fpp::iconify('Agregar', 'plusthick');
     $props = array("class" => 'AjaxOTO', "id" => 'AjaxTBL_' . $this->field_name, "logme" => $bl, 'refresh_to' => $uri_string_ajax, 'field_name' => $this->field_name);
     $href = html::anchor($uri_string, $href, $props);
     $div = "<div class='AjaxTBL_{$this->field_name} DIVJAX' style='display:none;' ></div>";
     return $div . "<table border=0><tr><td>" . $field_html . '</td><td>' . $href . '</td></tr></table>';
 }
Example #15
0
 public function action_index()
 {
     // check permission
     if (\Model_AccountLevelPermission::checkAdminPermission('cacheman_perm', 'cacheman_clearcache_perm') == false) {
         \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
         \Response::redirect(\Uri::create('admin'));
     }
     // read flash message for display errors.
     $form_status = \Session::get_flash('form_status');
     if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
         $output['form_status'] = $form_status['form_status'];
         $output['form_status_message'] = $form_status['form_status_message'];
     }
     unset($form_status);
     // if form submitted
     if (\Input::method() == 'POST') {
         $act = \Input::post('act');
         if ($act == 'clear') {
             \Extension\Cache::deleteCache('ALL');
             \Session::set_flash('form_status', array('form_status' => 'success', 'form_status_message' => \Lang::get('cacheman_all_cleared')));
         }
         // go back
         \Response::redirect(\Uri::create('admin/cacheman'));
     }
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('cacheman'));
     // <head> output ----------------------------------------------------------------------------------------------
     // breadcrumb -------------------------------------------------------------------------------------------------
     $page_breadcrumb = [];
     $page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
     $page_breadcrumb[1] = ['name' => \Lang::get('cacheman'), 'url' => \Uri::create('admin/cacheman')];
     $output['page_breadcrumb'] = $page_breadcrumb;
     unset($page_breadcrumb);
     // breadcrumb -------------------------------------------------------------------------------------------------
     return $this->generatePage('admin/templates/cacheman/index_v', $output, false);
 }
Example #16
0
 public function action_multiple()
 {
     $ids = \Input::post('id');
     $act = trim(\Input::post('act'));
     // set redirect url
     $redirect = $this->getAndSetSubmitRedirection();
     if (\Extension\NoCsrf::check()) {
         if ($act == 'del') {
             // check permission.
             if (\Model_AccountLevelPermission::checkAdminPermission('siteman_perm', 'siteman_delete_perm') == false) {
                 \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
                 \Response::redirect($redirect);
             }
             if (is_array($ids)) {
                 foreach ($ids as $id) {
                     \Model_Sites::deleteSite($id);
                 }
                 // clear cache
                 \Extension\Cache::deleteCache('model.sites-getSiteId');
                 \Extension\Cache::deleteCache('model.sites-isSiteEnabled');
                 \Extension\Cache::deleteCache('controller.AdminController-generatePage-fs_list_sites');
             }
         } elseif ($act == 'enable') {
             // check permission.
             if (\Model_AccountLevelPermission::checkAdminPermission('siteman_perm', 'siteman_edit_perm') == false) {
                 \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
                 \Response::redirect($redirect);
             }
             if (is_array($ids)) {
                 foreach ($ids as $id) {
                     if ($id == '1') {
                         continue;
                     }
                     \DB::update(\Model_Sites::getTableName())->where('site_id', $id)->set(['site_status' => 1])->execute();
                 }
                 // clear cache
                 \Extension\Cache::deleteCache('model.sites-getSiteId');
                 \Extension\Cache::deleteCache('model.sites-isSiteEnabled');
                 \Extension\Cache::deleteCache('controller.AdminController-generatePage-fs_list_sites');
                 unset($entry);
             }
         } elseif ($act == 'disable') {
             // check permission.
             if (\Model_AccountLevelPermission::checkAdminPermission('siteman_perm', 'siteman_edit_perm') == false) {
                 \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
                 \Response::redirect($redirect);
             }
             if (is_array($ids)) {
                 foreach ($ids as $id) {
                     if ($id == '1') {
                         continue;
                     }
                     \DB::update(\Model_Sites::getTableName())->where('site_id', $id)->set(['site_status' => 0])->execute();
                 }
                 // clear cache
                 \Extension\Cache::deleteCache('model.sites-getSiteId');
                 \Extension\Cache::deleteCache('model.sites-isSiteEnabled');
                 \Extension\Cache::deleteCache('controller.AdminController-generatePage-fs_list_sites');
                 unset($entry);
             }
         }
     }
     // go back
     \Response::redirect($redirect);
 }
 /**
  * Generate values for the "properties" key for the page() method.
  * 
  * @return array The array of data for the "properties" key.
  */
 private function _get_page_properties()
 {
     $properties_data['properties'] = array('url' => \Uri::base() . 'SEGMENT_PACKAGE_NO_URL_SET', 'referrer' => \Input::referrer(), 'path' => '/' . \Uri::string());
     /*
      * Fix: When \Request::main() is false, \Uri::main() tryies to get a property of the non-object
      * \Request::main().
      */
     if (\Request::main() instanceof \Request) {
         $properties_data['properties']['url'] = \Uri::main();
     }
     return $properties_data;
 }
Example #18
0
File: app.php Project: ratiw/petro
 public function router($method, $args)
 {
     if (in_array(\Uri::string(), static::$ignore_login)) {
         return call_user_func_array(array($this, 'action_' . $method), $args);
     }
     $right = $this->app . '.[' . str_replace(array('edit', 'view'), array('update', 'read'), $method) . ']';
     if (\Auth::has_access($right)) {
         return call_user_func_array(array($this, 'action_' . $method), $args);
     }
     \Session::delete('redirect_url');
     \Response::redirect($this->app . '/not_allow');
 }
Example #19
0
 /**
  * Gets a list of all the files in a given directory inside all of the
  * loaded search paths (e.g. the cascading file system).  This is useful
  * for things like finding all the config files in all the search paths.
  *
  * @param   string  The directory to look in
  * @param   string  The file filter
  * @return  array   the array of files
  */
 public function list_files($directory = null, $filter = '*.php')
 {
     $paths = $this->paths;
     // get extra information of the active request
     if (class_exists('Request', false) and ($uri = \Uri::string()) !== null) {
         $paths = array_merge(\Request::active()->get_paths(), $paths);
     }
     // Merge in the flash paths then reset the flash paths
     $paths = array_merge($this->flash_paths, $paths);
     $this->clear_flash();
     $found = array();
     foreach ($paths as $path) {
         $files = new \GlobIterator(rtrim($path . $directory, DS) . DS . $filter);
         foreach ($files as $file) {
             $found[] = $file->getPathname();
         }
     }
     return $found;
 }
Example #20
0
">
<?php 
        echo render('_parts/member_profile', array('member' => !empty($related_member_table_name) ? $obj->{$related_member_table_name} : $obj, 'next_id' => $next_id, 'access_from' => Auth::check() ? 'member' : 'guest', 'is_list' => true, 'page_type' => 'list', 'display_type' => 'summary', 'is_simple_list' => $is_simple_list));
        ?>
	</div>
<?php 
    }
    ?>
</div>
<?php 
}
?>

<?php 
if ($next_id) {
    $gete_data_list = array();
    $gete_data_list['max_id'] = $next_id;
    if (!empty($since_id)) {
        $gete_data_list['since_id'] = $since_id;
    }
    $load_after_link_attr = array('data-get_data' => json_encode($gete_data_list));
    $href = IS_API ? '#' : Uri::create_url(Uri::string(), array('max_id' => $next_id));
    echo Html::anchor($href, icon_label('site.see_more', 'both', false, null, 'fa fa-'), array_merge($load_after_link_attr, $load_link_attr_default));
}
?>

<?php 
if (IS_API) {
    ?>
</body></html><?php 
}
Example #21
0
// Custom PHP error Handler
set_error_handler(array('Core', 'errorphp'));
// Custom shutdown handler (used to show those errors thar errorphp isn't supposed to handle)
register_shutdown_function(array('Core', 'shutdown'));
// set timezone
date_default_timezone_set(Core::config('time_zone'));
// start the session
Session::start();
// -------------------------------------------------------------  Launch Framework
// Process the Routing and show Output only if this isn't an EXTERNAL call
if (!_EX) {
    //  Include the corresponding class & method
    include Router::classpath();
    $class = Router::classname();
    $method = Router::methodname();
    $uri = Uri::string();
    // Check that no system functions or methods starting
    // with an underscore can be called via the URI.
    if (array_key_exists(strtolower($method), Core::libraries()) || substr($method, 0, 1) == '_') {
        Core::error404($uri);
    }
    // instantiate the controller (and run its constructor)
    $class = Core::controller($class);
    // Call the remapping function if it's present in the controller
    if (method_exists($class, '_remap')) {
        call_user_func(array($class, '_remap'));
    } else {
        if (!method_exists($class, $method)) {
            Core::error404($uri);
        }
        // Call the requested method. Any URI segments present
Example #22
0
 public function action_index()
 {
     // check permission
     if (\Model_AccountLevelPermission::checkAdminPermission('config_global', 'config_global') == false) {
         \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
         \Response::redirect(\Uri::create('admin'));
     }
     // get timezone list for select box
     \Config::load('timezone', 'timezone');
     $output['timezone_list'] = \Config::get('timezone.timezone', array());
     // read flash message for display errors.
     $form_status = \Session::get_flash('form_status');
     if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
         $output['form_status'] = $form_status['form_status'];
         $output['form_status_message'] = $form_status['form_status_message'];
     }
     unset($form_status);
     $allowed_field = array();
     // load config to form.
     $result = \DB::select('*')->from(\Model_Config::getTableName())->as_object('Model_Config')->where('config_core', '1')->execute();
     if ((is_array($result) || is_object($result)) && !empty($result)) {
         foreach ($result as $row) {
             $allowed_field[] = $row->config_name;
             $output[$row->config_name] = $row->config_value;
         }
     }
     unset($result, $row);
     // if form submitted
     if (\Input::method() == 'POST') {
         // store data to variable for update to db.
         $data = array();
         foreach (\Input::post() as $key => $value) {
             if (in_array($key, $allowed_field)) {
                 $data[$key] = $value;
             }
         }
         unset($allowed_field);
         // check again for some required default value config data.
         // tab website
         $data['site_name'] = \Security::htmlentities($data['site_name']);
         $data['page_title_separator'] = \Security::htmlentities($data['page_title_separator']);
         // tab account
         if (!isset($data['member_allow_register']) || $data['member_allow_register'] != '1') {
             $data['member_allow_register'] = '0';
         }
         if (!isset($data['member_register_notify_admin']) || $data['member_register_notify_admin'] != '1') {
             $data['member_register_notify_admin'] = '0';
         }
         if (!isset($data['simultaneous_login']) || $data['simultaneous_login'] != '1') {
             $data['simultaneous_login'] = '******';
         }
         if (!is_numeric($data['member_max_login_fail'])) {
             $data['member_max_login_fail'] = '10';
         }
         if (!is_numeric($data['member_login_fail_wait_time'])) {
             $data['member_login_fail_wait_time'] = '30';
         }
         if (!is_numeric($data['member_login_remember_length'])) {
             $data['member_login_remember_length'] = '30';
         }
         if (!is_numeric($data['member_confirm_wait_time'])) {
             $data['member_confirm_wait_time'] = '10';
         }
         if (!isset($data['member_email_change_need_confirm']) || $data['member_email_change_need_confirm'] != '1') {
             $data['member_email_change_need_confirm'] = '0';
         }
         if (!isset($data['allow_avatar']) || $data['allow_avatar'] != '1') {
             $data['allow_avatar'] = '0';
         }
         if (!is_numeric($data['avatar_size'])) {
             $data['avatar_size'] = '200';
         }
         if (empty($data['avatar_allowed_types'])) {
             $data['avatar_allowed_types'] = 'jpg|jpeg';
         }
         if ($data['avatar_path'] == null) {
             unset($data['avatar_path']);
         }
         // tab email
         if ($data['mail_protocol'] == null) {
             $data['mail_protocol'] = 'mail';
         }
         if (!is_numeric($data['mail_smtp_port'])) {
             $data['mail_smtp_port'] = '0';
         }
         // tab content
         if (!is_numeric($data['content_items_perpage'])) {
             $data['content_items_perpage'] = '10';
         }
         if (!is_numeric($data['content_admin_items_perpage'])) {
             $data['content_admin_items_perpage'] = '10';
         }
         // tab media
         if (empty($data['media_allowed_types'])) {
             $data['media_allowed_types'] = 'avi|doc|docx|flv|gif|jpeg|jpg|mid|midi|mov|mp3|mpeg|mpg|pdf|png|swf|xls|xlsx|zip';
         }
         // tab ftp
         if (!is_numeric($data['ftp_port'])) {
             $data['ftp_port'] = '21';
         }
         if (!isset($data['ftp_passive']) || $data['ftp_passive'] != 'false') {
             $data['ftp_passive'] = 'true';
         }
         // validate form.
         $validate = \Validation::forge();
         if (!\Extension\NoCsrf::check()) {
             // validate token failed
             $output['form_status'] = 'error';
             $output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token');
         } elseif (!$validate->run()) {
             // validate failed
             $output['form_status'] = 'error';
             $output['form_status_message'] = $validate->show_errors();
         } else {
             // try to save config.
             $result = \Model_Config::saveData($data);
             // save change site name to sites table
             $site_id = \Model_Sites::getSiteId(false);
             $entry = \Model_Sites::find($site_id);
             $entry->site_name = $data['site_name'];
             $entry->save();
             unset($entry, $site_id);
             if ($result === true) {
                 \Session::set_flash('form_status', array('form_status' => 'success', 'form_status_message' => \Lang::get('admin_saved')));
                 \Response::redirect(\Uri::main());
             } else {
                 $output['form_status'] = 'error';
                 $output['form_status_message'] = $result;
             }
         }
         // re-populate form.
         foreach ($data as $key => $value) {
             $output[$key] = html_entity_decode($value);
         }
     }
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('config_global_configuration'));
     // <head> output ----------------------------------------------------------------------------------------------
     // breadcrumb -------------------------------------------------------------------------------------------------
     $page_breadcrumb = [];
     $page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
     $page_breadcrumb[1] = ['name' => \Lang::get('config_global_configuration'), 'url' => \Uri::create('admin/config')];
     $output['page_breadcrumb'] = $page_breadcrumb;
     unset($page_breadcrumb);
     // breadcrumb -------------------------------------------------------------------------------------------------
     return $this->generatePage('admin/templates/config/index_v', $output, false);
 }
Example #23
0
<h1><?php 
echo ucfirst(\Uri::string());
?>
</h1>
<h3>Hello <?php 
if (isset($name)) {
    echo $name;
}
?>
</h3>
<p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id velit et neque tempor convallis et eget neque. Vestibulum convallis tempus lectus, nec imperdiet leo auctor ut. Aliquam a dapibus urna, in dapibus arcu. Etiam massa nunc, convallis at urna dapibus, consequat elementum velit. Quisque sit amet sem et ipsum ultrices feugiat a non nunc. Praesent et eleifend massa, in porttitor ipsum. Etiam sit amet feugiat ligula. Proin sed malesuada lorem. Donec tincidunt viverra interdum. In hac habitasse platea dictumst. Maecenas eget ligula egestas, adipiscing mi eget, interdum risus. Nullam consequat vehicula eleifend. Nunc ut egestas neque. Fusce hendrerit tortor vel ligula gravida lobortis.
</p>
<p>
    Nam posuere nunc et leo auctor, id dictum magna elementum. Nam condimentum arcu eget libero cursus aliquam. Maecenas porttitor iaculis lacus, vitae imperdiet ligula interdum a. Sed sit amet venenatis libero, eget auctor turpis. In hac habitasse platea dictumst. Fusce dignissim mauris vel pharetra tempor. Aenean vehicula dui ut orci mattis, nec placerat nisi gravida. Quisque iaculis odio ac risus pretium ullamcorper. 
</p>
<p>
    Vivamus vel faucibus dolor. Maecenas sapien metus, aliquet id venenatis sit amet, elementum et nulla. Cras fermentum porttitor euismod. Aliquam id justo felis. Donec a hendrerit orci. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin sit amet risus in neque scelerisque posuere et venenatis nibh. Sed facilisis facilisis interdum. Vivamus elit turpis, feugiat non tortor eu, faucibus commodo dolor. Cras dignissim euismod arcu vitae mattis. 
</p>
<p>
    Nunc non molestie nunc. Donec eros ligula, pretium et dui eget, laoreet fermentum orci. Vivamus dictum libero at sem condimentum, a molestie magna dictum. Donec bibendum sagittis enim, vehicula ornare lorem. Sed scelerisque iaculis odio dictum pellentesque. Sed viverra ac dui non tincidunt. Fusce arcu ipsum, luctus elementum lacus et, consequat ultricies lorem. Sed congue ante accumsan arcu malesuada, vel auctor eros accumsan.
</p>
<p>
    <i class="glyphicon glyphicon-link"></i> <a href="<?php 
echo \Uri::create('test');
?>
">Go to 1 column test.</a><br>
    <i class="glyphicon glyphicon-link"></i> <a href="<?php 
echo \Uri::create('test/2column');
?>
">Go to 2 column test.</a><br>
Example #24
0
<?php

// start Theme class
$theme = \Theme::instance();
// set page class
$page_class = 'page_' . str_replace(['\\', '/'], '-', \Uri::string());
// check for mobile, tablet, pc device
// get browser class for use instead of fuelphp agent which is does not work.
include_once APPPATH . 'vendor' . DS . 'browser' . DS . 'lib' . DS . 'Browser.php';
$browser = new Browser();
$pc_class = '';
if (!$browser->isMobile() && !$browser->isTablet()) {
    $pc_class .= ' pc_device';
} elseif ($browser->isMobile()) {
    $pc_class .= ' mobile_device';
} elseif ($browser->isTablet()) {
    $pc_class .= ' tablet_device';
}
unset($browser);
// get admin cookie.
if (!isset($cookie_admin) || !isset($cookie_admin['account_display_name'])) {
    $model_account = new \Model_Accounts();
    $cookie_admin = $model_account->getAccountCookie('admin');
    if ($cookie_admin == null) {
        $cookie_admin = $model_account->getAccountCookie();
    }
    unset($model_account);
    if (is_array($cookie_admin) && array_key_exists('account_id', $cookie_admin)) {
        $account_id = $cookie_admin['account_id'];
    }
}
Example #25
0
 public function set_base_uri($uristr = null)
 {
     $ext_uri = '/' . 'fpp_actions/tbl_' . $this->_Table . '/';
     if ($uristr != null) {
         $this->base_uri = $uristr . $ext_uri;
         return true;
     }
     $uri = new Uri();
     $uri_string = $uri->string();
     $urixplode = explode('fpp_actions', $uri_string);
     $this->base_uri = $uri_string . $ext_uri;
     if (count($urixplode) > 1) {
         $this->base_uri = $urixplode[0] . $ext_uri;
     }
 }
Example #26
0
 public function action_viewlogins($account_id = '')
 {
     // set redirect url
     $redirect = $this->getAndSetSubmitRedirection();
     // check permission
     if (\Model_AccountLevelPermission::checkAdminPermission('account_perm', 'account_viewlogin_log_perm') == false) {
         \Session::set_flash('form_status', array('form_status' => 'error', 'form_status_message' => \Lang::get('admin_permission_denied', array('page' => \Uri::string()))));
         \Response::redirect($redirect);
     }
     // viewing guest logins?
     if ($account_id == '0') {
         \Response::redirect($redirect);
     }
     // load language
     \Lang::load('account');
     \Lang::load('accountlogins');
     // read flash message for display errors.
     $form_status = \Session::get_flash('form_status');
     if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
         $output['form_status'] = $form_status['form_status'];
         $output['form_status_message'] = $form_status['form_status_message'];
     }
     unset($form_status);
     // get accounts data for this account.
     $account = \Model_Accounts::find($account_id);
     if ($account == null) {
         // not found account.
         \Response::redirect($redirect);
     }
     $output['account'] = $account;
     $output['account_id'] = $account_id;
     unset($account);
     // set sort variable for sortable in views.
     $next_sort = \Security::strip_tags(trim(\Input::get('sort')));
     if ($next_sort == null || $next_sort == 'DESC') {
         $next_sort = 'ASC';
     } else {
         $next_sort = 'DESC';
     }
     $output['next_sort'] = $next_sort;
     unset($next_sort);
     // list logins -----------------------------------------------------------------------------------------------------
     $option['limit'] = \Model_Config::getval('content_admin_items_perpage');
     $option['offset'] = trim(\Input::get('page')) != null ? ((int) \Input::get('page') - 1) * $option['limit'] : 0;
     if (\Security::strip_tags(trim(\Input::get('orders'))) != null) {
         $option['orders'] = \Security::strip_tags(trim(\Input::get('orders')));
     }
     if (\Security::strip_tags(trim(\Input::get('sort'))) != null) {
         $option['sort'] = \Security::strip_tags(trim(\Input::get('sort')));
     }
     $list_logins = \Model_AccountLogins::listLogins(array('account_id' => $account_id), $option);
     // pagination config
     $config['pagination_url'] = \Uri::main() . \Uri::getCurrentQuerystrings(true, true, false);
     $config['total_items'] = $list_logins['total'];
     $config['per_page'] = $option['limit'];
     $config['uri_segment'] = 'page';
     $config['num_links'] = 3;
     $config['show_first'] = true;
     $config['show_last'] = true;
     $config['first-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
     $config['first-inactive-link'] = '<a href="#">{page}</a>';
     $config['first-marker'] = '&laquo;';
     $config['last-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
     $config['last-inactive-link'] = '<a href="#">{page}</a>';
     $config['last-marker'] = '&raquo;';
     $config['previous-marker'] = '&lsaquo;';
     $config['next-marker'] = '&rsaquo;';
     $pagination = \Pagination::forge('viewlogins_pagination', $config);
     $output['list_logins'] = $list_logins;
     $output['pagination'] = $pagination;
     unset($config, $list_logins, $option, $pagination);
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('account_view_login_history'));
     // <head> output ----------------------------------------------------------------------------------------------
     // breadcrumb -------------------------------------------------------------------------------------------------
     $page_breadcrumb = [];
     $page_breadcrumb[0] = ['name' => \Lang::get('admin_admin_home'), 'url' => \Uri::create('admin')];
     $page_breadcrumb[1] = ['name' => \Lang::get('account_accounts'), 'url' => \Uri::create('admin/account')];
     $page_breadcrumb[2] = ['name' => \Lang::get('account_view_login_history'), 'url' => \Uri::main()];
     $output['page_breadcrumb'] = $page_breadcrumb;
     unset($page_breadcrumb);
     // breadcrumb -------------------------------------------------------------------------------------------------
     return $this->generatePage('admin/templates/account/viewlogins_v', $output, false);
 }
Example #27
0
?>
				||
				<?php 
echo '' == $action || 'list' == Uri::string() ? 'Read' : Html::anchor($name, 'Read');
?>
				|
				<?php 
echo '' != $action || 'list' == Uri::string() ? 'Edit' : Html::anchor($name . '/edit', 'Edit');
?>
				|
				<?php 
echo 'revision' == $action && !isset($match[2]) || 'revision' != $action && '' != $action || 'list' == Uri::string() ? 'Revision' : Html::anchor($name . '/revision', 'Revision');
?>
				|
				<?php 
echo '' != $action || '' == Uri::string() || 'list' == Uri::string() ? 'Delete' : Html::anchor($name . '/delete', 'Delete');
?>
			</div>
			<h1><?php 
echo $title;
?>
</h1>
			<hr>
<?php 
if (Session::get_flash('success')) {
    ?>
			<div class="alert alert-success">
				<strong>Success</strong>
				<p>
				<?php 
    echo implode('</p><p>', e((array) Session::get_flash('success')));
Example #28
0
 /**
  * Locates a given file in the search paths.
  *
  * @param   string  $dir       Directory to look in
  * @param   string  $file      File to find
  * @param   string  $ext       File extension
  * @param   bool    $multiple  Whether to find multiple files
  * @param   bool    $cache     Whether to cache this path or not
  * @return  mixed  Path, or paths, or false
  */
 public function locate($dir, $file, $ext = '.php', $multiple = false, $cache = true)
 {
     $found = $multiple ? array() : false;
     // absolute path requested?
     if ($file[0] === '/' or isset($file[1]) and $file[1] === ':') {
         if (!is_file($file)) {
             // at this point, found would be either empty array or false
             return $found;
         }
         return $multiple ? array($file) : $file;
     }
     $cache_id = $multiple ? 'M.' : 'S.';
     $paths = array();
     // If a filename contains a :: then it is trying to be found in a namespace.
     // This is sometimes used to load a view from a non-loaded module.
     if ($pos = strripos($file, '::')) {
         // get the namespace path
         if ($path = \Autoloader::namespace_path('\\' . ucfirst(substr($file, 0, $pos)))) {
             $cache_id .= substr($file, 0, $pos);
             // and strip the classes directory as we need the module root
             $paths = array(substr($path, 0, -8));
             // strip the namespace from the filename
             $file = substr($file, $pos + 2);
         }
     } else {
         $paths = $this->paths;
         // get extra information of the active request
         if (class_exists('Request', false) and ($uri = \Uri::string()) !== null) {
             $cache_id .= $uri;
             $paths = array_merge(\Request::active()->get_paths(), $paths);
         }
     }
     // Merge in the flash paths then reset the flash paths
     $paths = array_merge($this->flash_paths, $paths);
     $this->clear_flash();
     $file = $this->prep_path($dir) . $file . $ext;
     $cache_id .= $file;
     if ($cached_path = $this->from_cache($cache_id)) {
         return $cached_path;
     }
     foreach ($paths as $dir) {
         $file_path = $dir . $file;
         if (is_file($file_path)) {
             if (!$multiple) {
                 $found = $file_path;
                 break;
             }
             $found[] = $file_path;
         }
     }
     if (!empty($found) and $cache) {
         $this->add_to_cache($cache_id, $found);
         $this->cache_valid = false;
     }
     return $found;
 }
?>
"><?php 
echo $site_name;
?>
</a>
    
        <!-- Place everything within .navbar-collapse to hide it until above 768px -->
        <div class="nav-collapse collapse navbar-responsive-collapse <?php 
if (Uri::base(false) . Uri::string() == Uri::Base()) {
    echo "responsive-margin";
}
?>
">
            <ul class="nav navbar-nav pull-right">
                <?php 
if (Uri::base(false) . Uri::string() != Uri::Base()) {
    ?>
                    <li><a href="<?php 
    echo Uri::Base();
    ?>
" title="Home">Home</a></li>
                <?php 
}
?>
                <?php 
if (Auth::check()) {
    ?>
                    <?php 
    if (Auth::member(5)) {
        ?>
                        <li><a href="<?php 
Example #30
0
 public static function check_error_response()
 {
     return preg_match('#^error/?#', Uri::string());
 }