public function before() { parent::before(); \Asset::add_path('assets/news'); $manager = new StoryManager(); $this->side_data['SectionList'] = $manager->sideData; }
public function _index($id = 0, $fileType = 'i') { // if (!$this->input->is_ajax_request()) { // die('Ajax requests only...'); // } //$this->template->set_layout(FALSE); $data = new stdClass(); $data->showSizeSlider = $showSizeSlider; $data->showAlignButtons = $showAlignButtons; $data->fileType = $fileType; $data->folders = $this->file_folders_m->get_folders(); $data->subfolders = array(); $data->current_folder = $id && isset($data->folders[$id]) ? $data->folders[$id] : ($data->folders ? current($data->folders) : array()); // Select the images for the current folder. In the future the selection of the type could become dynamic. // For future reference: a => audio, v => video, i => image, d => document, o => other. if ($data->current_folder) { $data->current_folder->items = $this->file_m->order_by('date_added', 'DESC')->where('type', $fileType)->get_many_by('folder_id', $data->current_folder->id); $subfolders = $this->file_folders_m->folder_tree($data->current_folder->id); foreach ($subfolders as $subfolder) { $data->subfolders[$subfolder->id] = repeater('» ', $subfolder->depth) . $subfolder->name; } // Set a default label $data->subfolders = $data->subfolders ? array($data->current_folder->id => lang('files.dropdown_root')) + $data->subfolders : array($data->current_folder->id => lang('files.dropdown_no_subfolders')); } // Array for select $data->folders_tree = array(); foreach ($data->folders as $folder) { $data->folders_tree[$folder->id] = repeater('» ', $folder->depth) . $folder->name; } Asset::add_path('imagepicker', IMAGEPICKER_PATH . 'imagepicker/'); $this->template->set_layout('modal')->append_js('imagepicker::imagepicker.js')->append_css('imagepicker::imagepicker.css')->build('files/admin/index', $data); }
/** * @todo Document this please. */ public function __construct() { parent::__construct(); // Not logged in or not an admin and don't have permission to see files if (!$this->current_user or $this->current_user->group !== 'admin' and (!isset($this->permissions['files']) or !isset($this->permissions['files']['wysiwyg']))) { $this->load->language('files/files'); show_error(lang('files:no_permissions')); } ci()->admin_theme = $this->theme_m->get_admin(); // Using a bad slug? Weak if (empty($this->admin_theme->slug)) { show_error('This site has been set to use an admin theme that does not exist.'); } // Make a constant as this is used in a lot of places defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug); // Set the location of assets Asset::add_path('module', APPPATH . 'modules/wysiwyg/'); Asset::add_path('theme', $this->admin_theme->web_path . '/'); Asset::set_path('theme'); $this->load->library('files/files'); $this->lang->load('files/files'); $this->lang->load('wysiwyg'); $this->lang->load('buttons'); $this->template->set_theme(ADMIN_THEME)->set_layout('wysiwyg', 'admin')->enable_parser(false)->append_css('module::wysiwyg.css')->append_css('jquery/ui-lightness/jquery-ui.css')->append_js('jquery/jquery.js')->append_js('jquery/jquery-ui.min.js')->append_js('plugins.js')->append_js('module::wysiwyg.js'); }
public function __construct() { parent::__construct(); $this->config_path = FCPATH . 'app/config'; $this->upload_path = FCPATH . 'uploads/'; include_once FCPATH . 'app/libraries/Asset.php'; Asset::add_path(APPPATH . 'assets/', BASE_URL); Asset::set_asset_url(BASE_URL); }
public function __construct() { parent::__construct(); $this->data = array(); $this->error = array(); // Load theme and template $this->load->helper('themes'); load_layout('default'); $CI = get_instance(); $CI->load->library('Asset'); // Work out module, controller and method and make them accessable throught the CI instance $CI->module = $this->module = $this->router->fetch_module(); $CI->controller = $this->controller = $this->router->fetch_class(); $CI->method = $this->method = $this->router->fetch_method(); // Get meta data for the module $this->template->module_details = $CI->module_details = $this->module_details = $CI->module; Asset::add_path('module', APPPATH . 'modules/' . $CI->module . '/views/'); // Theme directory path Asset::add_path('theme', APPPATH . 'themes/default/'); Asset::set_path('theme'); // Load language //Get language that was set in db $lang_cd = 'en'; $lang_name = 'english'; $CI->load->model('setting/setting_model'); $row = $CI->setting_model->getSetting('config', 'config_language'); if (isset($row)) { $lang_cd = isset($row['config_language']) ? $row['config_language'] : 'en'; if ($lang_cd === 'vi') { $lang_name = 'vietnamese'; } } $CI->session->set_userdata('config_language', $lang_cd); // Get language id from language table and set to session $where = array(); $where['status'] = 1; $where['code'] = $lang_cd; $CI->db->select('language_id'); $query = $CI->db->get_where('language', $where); $result = $query->row_array(); if (isset($result['language_id'])) { $CI->session->set_userdata('config_language_id', $result['language_id']); } // Load config $this->load->helper('setting'); get_setting_to_session(); // Load information for header $this->data['logo_img'] = base_url() . 'uploads/' . $this->session->userdata('config_logo'); // Load menu $this->load->helper('menu_page'); menu_page($this->data); // Load footer $this->data['shop_name'] = $this->session->userdata('config_name'); $this->data['shop_address'] = $this->session->userdata('config_address'); $this->data['shop_telephone'] = $this->session->userdata('config_telephone'); $this->data['shop_email'] = $this->session->userdata('config_email'); }
public function before() { parent::before(); if (!\Auth::check()) { \Output::redirect('myauth'); } \Asset::remove_path('assets/'); \Asset::add_path('assets/uploadify/'); $this->template->css = \Asset::css(array('style.css'), array(), 'layout', false); $this->template->js = \Asset::js(array('jquery-1.3.2.min.js', 'swfobject.js', 'jquery.uploadify.v2.1.0.min.js', 'jquery.application.js'), array(), 'layout', false); }
public function run() { $this->ci->load->model(array('pam/pams_m')); // get settings $settings = $this->ci->pams_m->get_settings(); // add path to module assets // MODIFY THIS PATH IF YOU'D LIKE TO KEEP THE MODULE ELSEWHERE Asset::add_path('pam', 'addons/shared_addons/modules/pam/'); if ($settings->jquery == 1) { $this->ci->template->append_js('pam::jquery.min.js'); } $this->ci->template->append_js('pam::jquery.nivo.pams.pack.js'); $this->ci->template->append_css(array('pam::nivo-pams.css')); $this->ci->template->append_css(array('pam::nivo-pams.theme.css')); }
public function __construct() { parent::__construct(); // First off set the db prefix $this->db->set_dbprefix('core_'); // If we're on the MSM then we turn the session table off. $this->config->set_item('sess_use_database', false); // If using a URL not defined as a site, set this to stop the world ending defined('SITE_REF') or define('SITE_REF', 'core'); // make sure they've ran the installer before trying to view our shiny panel $this->db->table_exists('sites') or redirect('installer'); defined('ADMIN_THEME') or define('ADMIN_THEME', 'msm'); defined('MSMPATH') or redirect('404'); // define folders that we need to create for each new site ci()->locations = $this->locations = array(APPPATH . 'cache' => array('simplepie'), 'addons' => array('modules', 'widgets', 'themes'), 'data' => array()); // Since we don't need to lock the lang with a setting like /admin and // the front-end we just define CURRENT_LANGUAGE exactly the same as AUTO_LANGUAGE defined('CURRENT_LANGUAGE') or define('CURRENT_LANGUAGE', AUTO_LANGUAGE); // Load the Language files ready for output $this->lang->load(array('admin', 'buttons', 'global', 'sites/sites', 'users/user')); // Load all the required classes $this->load->model(array('sites_m', 'user_m', 'settings_m')); $this->load->library(array('session', 'form_validation', 'settings/settings')); $this->load->dbforge(); // Work out module, controller and method and make them accessable throught the CI instance ci()->module = $this->module = $this->router->fetch_module(); ci()->controller = $this->controller = $this->router->fetch_class(); ci()->method = $this->method = $this->router->fetch_method(); ci()->module_details = $this->module_details = array('slug' => 'sites'); // Load helpers $this->load->helper('admin_theme'); $this->load->helper('file'); $this->load->helper('number'); $this->load->helper('date'); $this->load->helper('cookie'); // Load ion_auth config so our user's settings (password length, etc) are in sync $this->load->config('users/ion_auth'); // Set the theme as a path for Asset library Asset::add_path('theme', MSMPATH . 'themes/' . ADMIN_THEME . '/'); Asset::set_path('theme'); // check to make sure they're logged in if ($this->method !== 'login' and !$this->user_m->logged_in()) { redirect('sites/login'); } $this->template->add_theme_location(MSMPATH . 'themes/'); // Template configuration $this->template->append_css('theme::common.css')->append_js('jquery/jquery.cooki.js')->enable_parser(false)->set('super_username', $this->session->userdata('super_username'))->set_theme(ADMIN_THEME)->set_layout('default', 'admin'); }
public function run($options) { //load library class_exists('Pmslider_m') or $this->load->model('pmaker/pmslider_m'); class_exists('Pmslide_m') or $this->load->model('pmaker/pmslide_m'); //get slider $slider = $this->pmslider_m->get_by('id', $options['slider']); //get slides $slides = $this->pmslide_m->get_slides($options['slider']); // add path to widget's assets // MODIFY THIS PATH IF YOU'D LIKE TO KEEP THE MODULE ELSEWHERE Asset::add_path('pmcamera', 'addons/shared_addons/modules/pmaker/widgets/pm_camera/assets/'); Asset::css('pmcamera::camera.css', false, 'camera'); Asset::js('pmcamera::camera.js', false, 'camera'); Asset::js('pmcamera::jquery.mobile.customized.min.js', false, 'camera'); return array('options' => $options, 'slider' => $slider, 'slides' => $slides); }
/** * The construct checks for authorization then loads in settings for * all of the admin controllers. * * @access public * @return void */ public function __construct() { parent::__construct(); $this->benchmark->mark('public_controller_start'); Events::trigger('public_controller'); // Check the frontend hasnt been disabled by an admin if (!$this->settings->frontend_enabled && (empty($this->current_user) or $this->current_user->group != 'admin')) { header('Retry-After: 600'); $error = $this->settings->unavailable_message ? $this->settings->unavailable_message : lang('cms_fatal_error'); show_error($error, 503); } // Load the current theme so we can set the assets right away ci()->theme = $this->theme_m->get(); if (empty($this->theme->slug)) { show_error('This site has been set to use a theme that does not exist. If you are an administrator please ' . anchor('admin/themes', 'change the theme') . '.'); } // Set the theme as a path for Asset library Asset::add_path('theme', $this->theme->path . '/'); Asset::set_path('theme'); // Support CDN URL's like Amazon CloudFront // if (Settings::get('cdn_domain')) { // $protocol = (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? 'https' : 'http'; // Asset::set_url($protocol . '://' . rtrim(Settings::get('cdn_domain'), '/') . '/'); // } // Set the theme view folder $this->template->set_theme($this->theme->slug)->append_metadata(' <script type="text/javascript"> var APPPATH_URI = "' . APPPATH_URI . '"; var BASE_URI = "' . BASE_URI . '"; </script>'); // Is there a layout file for this module? if ($this->template->layout_exists($this->module . '.html')) { $this->template->set_layout($this->module . '.html'); } elseif ($this->template->layout_exists('default.html')) { $this->template->set_layout('default.html'); } // Make sure whatever page the user loads it by, its telling search robots the correct formatted URL // $this -> template -> set_metadata('canonical', site_url($this -> uri -> uri_string()), 'link'); // grab the theme options if there are any // $this -> theme -> options = $this -> appcache -> model('theme_m', 'get_values_by', array( array('theme' => $this -> theme -> slug))); // $this -> template -> settings = $this -> settings -> get_all(); $this->template->server = $_SERVER; $this->template->theme = $this->theme; // $this -> benchmark -> mark('public_controller_end'); }
/** * Load language, check flashdata, define https, load and setup the data * for the admin theme */ public function __construct() { parent::__construct(); // Load the Language files ready for output $this->lang->load('admin'); $this->lang->load('buttons'); // Show error and exit if the user does not have sufficient permissions if (!self::_check_access()) { $this->session->set_flashdata('error', lang('cp_access_denied')); redirect(); } // If the setting is enabled redirect request to HTTPS if ($this->settings->admin_force_https and strtolower(substr(current_url(), 4, 1)) != 's') { redirect(str_replace('http:', 'https:', current_url()) . '?session=' . session_id()); } $this->load->helper('admin_theme'); ci()->admin_theme = $this->theme_m->get_admin(); // Using a bad slug? Weak if (empty($this->admin_theme->slug)) { show_error('This site has been set to use an admin theme that does not exist.'); } // make a constant as this is used in a lot of places defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug); // Set the location of assets Asset::add_path('theme', $this->admin_theme->web_path . '/'); Asset::set_path('theme'); // grab the theme options if there are any ci()->theme_options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => ADMIN_THEME))); // Active Admin Section (might be null, but who cares) $this->template->active_section = $this->section; Events::trigger('admin_controller'); // Template configuration $this->template->enable_parser(FALSE)->set('theme_options', $this->theme_options)->set_theme(ADMIN_THEME)->set_layout('default', 'admin'); // trigger the run() method in the selected admin theme $class = 'Theme_' . ucfirst($this->admin_theme->slug); call_user_func(array(new $class(), 'run')); }
/** * Loads the gazillion of stuff, in Flash Gordon speed. * @todo Document properly please. */ public function __construct() { parent::__construct(); $this->benchmark->mark('public_controller_start'); // Check redirects if GET and Not AJAX if (!$this->input->is_ajax_request() and $_SERVER['REQUEST_METHOD'] == 'GET') { $this->load->model('redirects/redirect_m'); $uri = trim(uri_string(), '/'); if ($redirect = $this->redirect_m->get_from($uri)) { // Check if it was direct match if ($redirect->from == $uri) { redirect($redirect->to, 'location', $redirect->type); } // If it has back reference if (strpos($redirect->to, '$') !== FALSE) { $from = str_replace('%', '(.*?)', $redirect->from); $redirect->to = preg_replace('#^' . $from . '$#', $redirect->to, $uri); } // Redirect with wanted redirect header type redirect($redirect->to, 'location', $redirect->type); } } Events::trigger('public_controller'); // Check the frontend hasnt been disabled by an admin if (!$this->settings->frontend_enabled && (empty($this->current_user) or $this->current_user->group != 'admin')) { header('Retry-After: 600'); $error = $this->settings->unavailable_message ? $this->settings->unavailable_message : lang('cms_fatal_error'); show_error($error, 503); } // -- Navigation menu ----------------------------------- $this->load->model('pages/page_m'); // Load the current theme so we can set the assets right away ci()->theme = $this->theme_m->get(); if (empty($this->theme->slug)) { show_error('This site has been set to use a theme that does not exist. If you are an administrator please ' . anchor('admin/themes', 'change the theme') . '.'); } // Set the theme as a path for Asset library Asset::add_path('theme', $this->theme->path . '/'); Asset::set_path('theme'); // Support CDN URL's like Amazon CloudFront if (Settings::get('cdn_domain')) { $protocol = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http'; // Make cdn.pyrocms.com into https://cdn.pyrocms.com/ Asset::set_url($protocol . '://' . rtrim(Settings::get('cdn_domain'), '/') . '/'); } // Set the theme view folder $this->template->set_theme($this->theme->slug)->append_metadata(' <script type="text/javascript"> var APPPATH_URI = "' . APPPATH_URI . '"; var BASE_URI = "' . BASE_URI . '"; </script>'); // Is there a layout file for this module? if ($this->template->layout_exists($this->module . '.html')) { $this->template->set_layout($this->module . '.html'); } elseif ($this->template->layout_exists('default.html')) { $this->template->set_layout('default.html'); } // Make sure whatever page the user loads it by, its telling search robots the correct formatted URL $this->template->set_metadata('canonical', site_url($this->uri->uri_string()), 'link'); // If there is a blog module, link to its RSS feed in the head if (module_exists('blog')) { $this->template->append_metadata('<link rel="alternate" type="application/rss+xml" title="' . $this->settings->site_name . '" href="' . site_url('blog/rss/all.rss') . '" />'); } // Frontend data $this->load->library('variables/variables'); // grab the theme options if there are any $this->theme->options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => $this->theme->slug))); // Assign segments to the template the new way $this->template->variables = $this->variables->get_all(); $this->template->settings = $this->settings->get_all(); $this->template->server = $_SERVER; $this->template->theme = $this->theme; $this->benchmark->mark('public_controller_end'); }
<?php if (count($images) > 0) { $nivotheme = isset($options['theme']) ? $options['theme'] : 'default'; $settings = isset($options['settings']) ? $options['settings'] : ''; Asset::add_path('nivoslider', 'addons/shared_addons/widgets/nivoslider/'); Asset::css('nivoslider::themes/' . $nivotheme . '/' . $nivotheme . '.css', false, 'nivoslider'); Asset::css('nivoslider::nivo-slider.css', false, 'nivoslider'); Asset::js('nivoslider::jquery.nivo.slider.pack.js', false, 'nivoslider'); echo Asset::render_js('nivoslider'); echo Asset::render_css('nivoslider'); ?> <script type="text/javascript"> $(function(){ if($.isFunction($.fn.nivoSlider)){ $('.nivoSlider').nivoSlider(<?php echo $settings; ?> ); } }); </script> <div class="slider-wrapper theme-<?php echo $nivotheme; ?> clearfix"> <div class="nivoSlider"> <?php foreach ($images as $image) { ?> <img
<script type="text/javascript">var SITE_URL = "<?php echo site_url(); ?> ";</script> <?php $this->admin_theme = $this->theme_m->get_admin(); Asset::add_path('admin', $this->admin_theme->web_path . '/'); ?> <script type="text/javascript">pyro = {};</script> <script src="<?php echo Asset::get_filepath_js('admin::ckeditor/ckeditor.js'); ?> "></script> <script src="<?php echo Asset::get_filepath_js('admin::ckeditor/adapters/jquery.js'); ?> "></script> <script type="text/javascript"> var instance; function update_instance() { instance = CKEDITOR.currentInstance; } (function($) { $(function(){
/** * Load and set data for some common used libraries. */ public function __construct() { parent::__construct(); $this->benchmark->mark('my_controller_start'); // No record? Probably DNS'ed but not added to multisite if (!defined('SITE_REF')) { show_error('This domain is not set up correctly. Please go to ' . anchor('sites') . ' and log in to add this site.'); } // By changing the prefix we are essentially "namespacing" each site $this->db->set_dbprefix(SITE_REF . '_'); // Load the cache library now that we know the siteref $this->load->library('pyrocache'); // Add the site specific theme folder $this->template->add_theme_location(ADDONPATH . 'themes/'); // Migration logic helps to make sure PyroCMS is running the latest changes $this->load->library('migration'); if (!($schema_version = $this->migration->current())) { show_error($this->migration->error_string()); } elseif (is_numeric($schema_version)) { log_message('debug', 'PyroCMS was migrated to version: ' . $schema_version); } // With that done, load settings $this->load->library(array('session', 'settings/settings')); // Lock front-end language if (!(is_a($this, 'Admin_Controller') and $site_lang = AUTO_LANGUAGE)) { $site_public_lang = explode(',', Settings::get('site_public_lang')); if (in_array(AUTO_LANGUAGE, $site_public_lang)) { $site_lang = AUTO_LANGUAGE; } else { $site_lang = Settings::get('site_lang'); } } // We can't have a blank language. If there happens // to be a blank language, let's default to English. if (!$site_lang) { $site_lang = 'en'; } // What language us being used defined('CURRENT_LANGUAGE') or define('CURRENT_LANGUAGE', $site_lang); $langs = $this->config->item('supported_languages'); $pyro['lang'] = $langs[CURRENT_LANGUAGE]; $pyro['lang']['code'] = CURRENT_LANGUAGE; $this->load->vars($pyro); // Set php locale time if (isset($langs[CURRENT_LANGUAGE]['codes']) and sizeof($locale = (array) $langs[CURRENT_LANGUAGE]['codes']) > 1) { array_unshift($locale, LC_TIME); call_user_func_array('setlocale', $locale); unset($locale); } // Reload languages if (AUTO_LANGUAGE !== CURRENT_LANGUAGE) { $this->config->set_item('language', $langs[CURRENT_LANGUAGE]['folder']); $this->lang->is_loaded = array(); $this->lang->load(array('errors', 'global', 'users/user', 'settings/settings', 'files/files')); } else { $this->lang->load(array('global', 'users/user', 'files/files')); } $this->load->library('users/ion_auth'); // Use this to define hooks with a nicer syntax ci()->hooks =& $GLOBALS['EXT']; // Get user data $this->template->current_user = ci()->current_user = $this->current_user = $this->ion_auth->get_user(); // Work out module, controller and method and make them accessable throught the CI instance ci()->module = $this->module = $this->router->fetch_module(); ci()->controller = $this->controller = $this->router->fetch_class(); ci()->method = $this->method = $this->router->fetch_method(); // Loaded after $this->current_user is set so that data can be used everywhere $this->load->model(array('permissions/permission_m', 'addons/module_m', 'addons/theme_m', 'pages/page_m')); // List available module permissions for this user ci()->permissions = $this->permissions = $this->current_user ? $this->permission_m->get_group($this->current_user->group_id) : array(); // load all modules (the Events library uses them all) and make their details widely available ci()->enabled_modules = $this->module_m->get_all(); // now that we have a list of enabled modules $this->load->library('events'); // set defaults $this->template->module_details = ci()->module_details = $this->module_details = false; // now pick our current module out of the enabled modules array foreach (ci()->enabled_modules as $module) { if ($module['slug'] === $this->module) { // Set meta data for the module to be accessible system wide $this->template->module_details = ci()->module_details = $this->module_details = $module; continue; } } // certain places (such as the Dashboard) we aren't running a module, provide defaults if (!$this->module) { $this->module_details = array('name' => null, 'slug' => null, 'version' => null, 'description' => null, 'skip_xss' => null, 'is_frontend' => null, 'is_backend' => null, 'menu' => false, 'enabled' => 1, 'sections' => array(), 'shortcuts' => array(), 'is_core' => null, 'is_current' => null, 'current_version' => null, 'updated_on' => null); } // added by ttg if ($this->module && $this->module != 'pages' && $this->uri->segment(1) != 'admin') { $this->page_m->hit_counter(); } // If the module is disabled, then show a 404. empty($this->module_details['enabled']) and show_404(); if (!$this->module_details['skip_xss']) { $_POST = $this->security->xss_clean($_POST); } if ($this->module and isset($this->module_details['path'])) { Asset::add_path('module', $this->module_details['path'] . '/'); } $this->load->vars($pyro); $this->benchmark->mark('my_controller_end'); // Enable profiler on local box if (isset($this->current_user->group) and $this->current_user->group === 'admin' and is_array($_GET) and array_key_exists('_debug', $_GET)) { unset($_GET['_debug']); $this->output->enable_profiler(true); } }
public function import($news_id = 0) { $this->load->library('excel'); if ($this->input->post()) { $upload_data = $this->upload_file(); $this->form_validation->set_rules('import', 'Import', 'max_length[255]'); if (isset($upload_data['upload_data']['file_name'])) { $excel = $upload_data['upload_data']['file_name']; } else { $this->session->set_flashdata('flashError', 'Unable to save the news.'); redirect(site_url('admin/subjects/import/' . $id)); } $file = './uploads/excel/' . $excel; $objPHPExcel = $this->excel->load($file); $sheetData = $this->excel->reader->getActiveSheet()->toArray(null, true, true, true); if ($sheetData != NULL || !empty($sheetData) || is_array($sheetData)) { foreach ($sheetData as $key => $subjects) { if (is_numeric($subjects['A'])) { $subjectdata['subject_code'] = $subjects['A']; $subjectdata['subject_name'] = $subjects['B']; $subjectdata['full_marks'] = $subjects['C']; $subjectdata['pass_marks'] = $subjects['D']; $subjectdata['type'] = $subjects['E']; $this->db->insert('subjects', $subjectdata); $this->session->set_flashdata('flashConfirm', 'The Excel file has Sucessfully Imported.'); } } } } Asset::add_path('imagepicker', BASE_URL . 'addons/shared_addons/modules/imagepicker/'); $this->template->append_js('imagepicker::imagepicker.js')->append_css('imagepicker::admin.css'); $this->data->news_options = $this->news_m->dropdown('id', 'title'); $this->template->title($this->module_details['name'])->append_js('module::news.js')->build('admin/import', $this->data); }
/** * The construct loads sets up items needed application wide. * * @access public * @return void */ public function __construct() { global $post_buffer; parent::__construct(); $this->benchmark->mark('my_controller_start'); $this->method = $this->router->fetch_method(); // No record? Probably DNS'ed but not added to multisite if (!defined('SITE_REF')) { show_error('This domain is not set up correctly. Please go to ' . anchor('sites') . ' and log in to add this site.'); } // Load the cache library now that we know the siteref $this->load->library('appcache'); // Migrate DB to the latest version // $this->load->library('migration'); # If App was just automatically updated, the update system will force a refresh. // With that done, load settings $this->load->library(array('session', 'settings/settings')); // Lock front-end language if (!(is_a($this, 'Admin_Controller') && ($site_lang = AUTO_LANGUAGE))) { $site_public_lang = explode(',', Settings::get('site_public_lang')); if (in_array(AUTO_LANGUAGE, $site_public_lang)) { $site_lang = AUTO_LANGUAGE; } else { $site_lang = Settings::get('site_lang'); } } // What language us being used defined('CURRENT_LANGUAGE') or define('CURRENT_LANGUAGE', $site_lang); $langs = $this->config->item('supported_languages'); $sitelang['lang'] = $langs[CURRENT_LANGUAGE]; $sitelang['lang']['code'] = CURRENT_LANGUAGE; $this->load->vars($sitelang); // Set php locale time if (isset($langs[CURRENT_LANGUAGE]['codes']) && sizeof($locale = (array) $langs[CURRENT_LANGUAGE]['codes']) > 1) { array_unshift($locale, LC_TIME); call_user_func_array('setlocale', $locale); unset($locale); } // Reload languages if (AUTO_LANGUAGE !== CURRENT_LANGUAGE) { $this->config->set_item('language', $langs[CURRENT_LANGUAGE]['folder']); $this->lang->is_loaded = array(); $this->lang->load(array('errors', 'global', 'users/user', 'settings/settings')); } else { $this->lang->load(array('global', 'users/user')); } $this->load->library(array('events', 'users/ion_auth')); $this->output->enable_profiler(FALSE); define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); define('IS_CLI', defined('STDIN')); // Create a hook point with access to instance but before custom code $this->hooks->call_hook('post_core_controller_constructor'); $this->current_user = $this->template->current_user = $this->ion_auth->get_user(); // Work out module, controller and method and make them accessable throught the CI instance $this->module = $this->module = $this->router->fetch_module(); $this->controller = $this->controller = $this->router->fetch_class(); $this->method = $this->method = $this->router->fetch_method(); // Loaded after $this->current_user is set so that data can be used everywhere $this->load->model(array('users/permission_m', 'modules/module_m', 'themes/theme_m')); // List available module permissions for this user $this->permissions = $this->current_user ? $this->permission_m->get_group($this->current_user->group_id) : array(); // ! empty($this->permissions['users']['']); // Get meta data for the module $this->template->module_details = $this->module_details = $this->module_m->get($this->router->fetch_module()); // If the module is disabled, then show a 404. empty($this->module_details['enabled']) and show_404(); if (!$this->module_details['skip_xss']) { $_POST = $this->security->xss_clean($_POST); } if ($this->module and isset($this->module_details['path'])) { Asset::add_path('module', $this->module_details['path'] . '/'); } $this->load->vars($sitelang); $this->benchmark->mark('my_controller_end'); log_message('debug', "My_Controller Class Initialized"); $_POST = $this->process_input($_POST, $post_buffer); unset($post_buffer); # Fix a bug with send_x_days_before. if (!Settings::get('send_x_days_before')) { Settings::create('send_x_days_before', 7); } }
<!-- --><?php //= (isset($navigation) ? $navigation : '' ); ?> </nav> </div><!-- End /.row--> <div class="row"> <h1 > <?php echo isset($pageTitle) ? $pageTitle : ''; ?> </h1> <hr> </div><!-- End /.row--> <?php echo isset($content) ? $content : ''; ?> </div> <!-- End /#wrapper .container-fluid --> <!-- Add path to AngularJS app--> <?php echo Asset::add_path('app/', 'ngApp', ['js', 'html']); ?> <!-- JS Libs --> <?php echo Asset::js(['//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular-animate.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.min.js', Asset::get_file('app.module.js', 'ngApp'), Asset::get_file('common/frontCover/frontCoverController.js', 'ngApp'), Asset::get_file('common/sidebar/sidebarController.js', 'ngApp'), Asset::get_file('common/header/headerController.js', 'ngApp'), Asset::get_file('components/blog/blogController.js', 'ngApp'), Asset::get_file('components/authentication/authenticationController.js', 'ngApp')]); ?> </body> </html>
function retrieve_assets($page, &$parent) { if (isset($this->assets[$page])) { $dir = BASE_URL . 'addons/shared_addons/modules/'; while (list($key, $options) = each($this->assets[$page])) { Asset::add_path($options[1], $dir . $options[1] . '/'); $func = 'append_' . $options[0]; $parent->template->{$func}($options[1] . '::' . $key); } } }
public function before() { parent::before(); \Asset::add_path('assets/admin'); }
public function get_login() { \Asset::add_path('assets/admin'); return \Response::forge(\View::forge('login')); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title><?php echo Config::get('project_name', ''); ?> Admin</title> <?php Asset::add_path(ADMINPATH . 'assets/'); echo Asset::css(Config::get('admin.css'), array(), NULL, TRUE); echo Asset::js(Config::get('admin.js'), array(), NULL, TRUE); ?> </head> <body> <?php if (Auth::instance('SimpleAuth')->check()) { ?> <form action="/admin" method="get"> <input type="submit" value="Logout" name="logout" /> </form> <br /> <div id="admin-tabs"> <?php foreach ($tabs as $key => $val) { ?> <div class="tab <?php if ($key == $table) { echo 'active'; } ?> ">
/** * Load and set data for some common used libraries. */ public function __construct() { parent::__construct(); $this->benchmark->mark('my_controller_start'); // No record? Probably DNS'ed but not added to multisite if (!defined('SITE_REF')) { show_error('This domain is not set up correctly. Please go to ' . anchor('sites') . ' and log in to add this site.'); } // TODO: Work out what the hell this is...? Phil if (defined('STATUS')) { show_error(STATUS); } // By changing the prefix we are essentially "namespacing" each site $this->db->set_dbprefix(SITE_REF . '_'); // Load the cache library now that we know the siteref $this->load->library('pyrocache'); // Add the site specific theme folder $this->template->add_theme_location(ADDONPATH . 'themes/'); // Migration logic helps to make sure PyroCMS is running the latest changes $this->load->library('migration'); if (!($schema_version = $this->migration->current())) { show_error($this->migration->error_string()); } else { if (is_numeric($schema_version)) { log_message('debug', 'PyroCMS was migrated to version: ' . $schema_version); } } // With that done, load settings $this->load->library(array('session', 'settings/settings')); // Lock front-end language if (!(is_a($this, 'Admin_Controller') && ($site_lang = AUTO_LANGUAGE))) { $site_public_lang = explode(',', Settings::get('site_public_lang')); if (in_array(AUTO_LANGUAGE, $site_public_lang)) { $site_lang = AUTO_LANGUAGE; } else { $site_lang = Settings::get('site_lang'); } } // What language us being used defined('CURRENT_LANGUAGE') or define('CURRENT_LANGUAGE', $site_lang); $langs = $this->config->item('supported_languages'); $pyro['lang'] = $langs[CURRENT_LANGUAGE]; $pyro['lang']['code'] = CURRENT_LANGUAGE; $this->load->vars($pyro); // Set php locale time if (isset($langs[CURRENT_LANGUAGE]['codes']) && sizeof($locale = (array) $langs[CURRENT_LANGUAGE]['codes']) > 1) { array_unshift($locale, LC_TIME); call_user_func_array('setlocale', $locale); unset($locale); } // Reload languages if (AUTO_LANGUAGE !== CURRENT_LANGUAGE) { $this->config->set_item('language', $langs[CURRENT_LANGUAGE]['folder']); $this->lang->is_loaded = array(); $this->lang->load(array('errors', 'global', 'users/user', 'settings/settings', 'files/files')); } else { $this->lang->load(array('global', 'users/user', 'files/files')); } $this->load->library(array('events', 'users/ion_auth')); // Use this to define hooks with a nicer syntax ci()->hooks =& $GLOBALS['EXT']; // Create a hook point with access to instance but before custom code $this->hooks->_call_hook('post_core_controller_constructor'); // Get user data $this->template->current_user = ci()->current_user = $this->current_user = $this->ion_auth->get_user(); // Work out module, controller and method and make them accessable throught the CI instance ci()->module = $this->module = $this->router->fetch_module(); ci()->controller = $this->controller = $this->router->fetch_class(); ci()->method = $this->method = $this->router->fetch_method(); // Loaded after $this->current_user is set so that data can be used everywhere $this->load->model(array('permissions/permission_m', 'modules/module_m', 'pages/page_m', 'themes/theme_m')); // List available module permissions for this user ci()->permissions = $this->permissions = $this->current_user ? $this->permission_m->get_group($this->current_user->group_id) : array(); // Get meta data for the module $this->template->module_details = ci()->module_details = $this->module_details = $this->module_m->get($this->module); // If the module is disabled, then show a 404. empty($this->module_details['enabled']) and show_404(); if (!$this->module_details['skip_xss']) { $_POST = $this->security->xss_clean($_POST); } if ($this->module and isset($this->module_details['path'])) { Asset::add_path('module', $this->module_details['path'] . '/'); } $this->benchmark->mark('my_controller_end'); // Enable profiler on local box if (isset($this->current_user->group) and $this->current_user->group == 'admin' and is_array($_GET) and array_key_exists('_debug', $_GET)) { unset($_GET['_debug']); $this->output->enable_profiler(TRUE); } }
/** * The construct checks for authorization then loads in settings for * all of the admin controllers. * * @access public * @return void */ public function __construct() { parent::__construct(); // Load the Language files ready for output $this->lang->load('admin'); $this->lang->load('buttons'); if (in_array($this->method, $this->secured_methods) || in_array('_all_', $this->secured_methods)) { if (!$this->ion_auth->logged_in() and $this->method != 'no_internet_access') { $this->session->set_userdata('login_redirect', $this->uri->uri_string()); redirect('admin/users/login'); } // Be an admin or have access to this module a bit $module = $this->router->fetch_module(); if (!$this->ion_auth->is_sadmin() and (empty($this->permissions) or $module !== 'dashboard' and empty($this->permissions[$module]))) { $this->session->set_userdata('error', lang('cp_access_denied')); redirect('dashboard'); // show_error('Permission Denied'); } } // If the setting is enabled redirect request to HTTPS if ($this->settings->admin_force_https and strtolower(substr(current_url(), 4, 1)) != 's') { redirect(str_replace('http:', 'https:', current_url()) . '?session=' . session_id()); } $this->load->helper('admin_theme'); ci()->admin_theme = $this->theme_m->get_admin(); // Using a bad slug? Weak if (empty($this->admin_theme->slug)) { show_error('This site has been set to use an admin theme that does not exist.'); } // make a constant as this is used in a lot of places defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug); $this->load->library('form_validation'); // Set the location of assets Asset::add_path('theme', $this->admin_theme->web_path . '/'); Asset::set_path('theme'); // grab the theme options if there are any ci()->theme_options = $this->appcache->model('theme_m', 'get_values_by', array(array('theme' => ADMIN_THEME))); // Active Admin Section (might be null, but who cares) $this->template->active_section = $this->section; Events::trigger('admin_controller'); // Template configuration $this->template->enable_parser(FALSE)->set('theme_options', $this->theme_options)->set_theme('' . PAN::setting('admin_theme'))->set_layout('index'); $this->template->set_partial('notifications', 'partials/notifications'); $this->template->module = $this->router->fetch_module(); // Active Admin Section (might be null, but who cares) $this->template->active_section = $this->section; // Get the diskspace library $this->load->library('system/diskSpace'); // Get detils about the server $dUsage = new diskSpace("."); $this->template->perentagefree = $dUsage->percentage_free; // will output: Percentage Free: 93% $this->template->percentageused = $dUsage->percentage_used; // Setting up the base pagination config $this->pagination_config['per_page'] = Settings::get('items_per_page'); $this->pagination_config['num_links'] = 5; $this->pagination_config['full_tag_open'] = ''; $this->pagination_config['full_tag_close'] = ''; $this->pagination_config['first_tag_open'] = ''; $this->pagination_config['first_tag_close'] = ''; $this->pagination_config['last_tag_open'] = ''; $this->pagination_config['last_tag_close'] = ''; $this->pagination_config['prev_tag_open'] = ''; $this->pagination_config['prev_tag_close'] = ''; $this->pagination_config['next_tag_open'] = ''; $this->pagination_config['next_tag_close'] = ''; $this->pagination_config['cur_tag_open'] = ''; $this->pagination_config['cur_tag_close'] = ''; $this->pagination_config['num_tag_open'] = ''; $this->pagination_config['num_tag_close'] = ''; // Try to determine the pagination base_url $segments = $this->uri->segment_array(); if ($this->uri->total_segments() >= 4) { array_pop($segments); } if (Settings::get('application_debug') == true) { $this->output->enable_profiler(true); } else { $this->output->enable_profiler(false); } $this->pagination_config['base_url'] = site_url(implode('/', $segments)); $this->pagination_config['uri_segment'] = 4; // Add the theme path to the asset paths // trigger the run() method in the selected admin theme - $class = 'Theme_' . ucfirst($this->admin_theme->slug); call_user_func(array(new $class(), 'run')); log_message('debug', "Main_Controller Class Initialized"); }
<?php $this->load->helper('excerpt'); $this->lang->load('news/news'); Asset::add_path('news', 'addons/shared_addons/modules/news/'); Asset::js('news::jquery.bootstrap.newsbox.js', false, 'news'); Asset::js('news::init.js', false, 'news'); echo Asset::render_js('news'); ?> {{ if options.type == 'scroll' }} {{ news_widget }} <marquee scrollamount="3" onmouseover="this.setAttribute('scrollamount', 0, 0);" onmouseout="this.setAttribute('scrollamount', 6, 0);"> {{ news }} <a href="{{url:site}}news/{{id}}" title="{{intro}}">{{intro}}</a> {{ /news }} </marquee> {{ /news_widget }} {{ endif }} {{ if options.type == 'notice' }} {{ news_widget }} <ul class="news-notice"> {{ news }} <li><a href="{{url:site}}news/{{id}}" title="{{name}}">{{name}}</a> <p>{{ excerpt:excerpt text=body word_count="40" }}</p> </li> {{ /news }} </ul> {{ /news_widget }}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <?php \Asset::add_path('public/assets'); ?> <?php echo $head; ?> </head> <body> <div id="wrapper"> <div id="navigation"> <?php echo $navigation; ?> </div> <div id="header"> <?php echo $header; ?> </div> <div id="content"> <?php echo $content; ?> </div>
/** * Load language, check flashdata, define https, load and setup the data * for the admin theme */ public function __construct() { parent::__construct(); // Load the Language files ready for output $this->lang->load('admin'); $this->lang->load('buttons'); // Show error and exit if the user does not have sufficient permissions if (!self::_check_access()) { $this->session->set_flashdata('error', lang('cp:access_denied')); redirect(); } // If the setting is enabled redirect request to HTTPS if ($this->settings->admin_force_https and strtolower(substr(current_url(), 4, 1)) != 's') { redirect(str_replace('http:', 'https:', current_url()) . '?session=' . session_id()); } $this->load->helper('admin_theme'); ci()->admin_theme = $this->theme_m->get_admin(); // Using a bad slug? Weak if (empty($this->admin_theme->slug)) { show_error('This site has been set to use an admin theme that does not exist.'); } // make a constant as this is used in a lot of places defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug); // Set the location of assets Asset::add_path('theme', $this->admin_theme->web_path . '/'); Asset::set_path('theme'); // grab the theme options if there are any ci()->theme_options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => ADMIN_THEME))); // Active Admin Section (might be null, but who cares) $this->template->active_section = $this->section; Events::trigger('admin_controller'); // ------------------------------------- // Build Admin Navigation // ------------------------------------- // We'll get all of the backend modules // from the DB and run their module items. // ------------------------------------- if (is_logged_in()) { // Here's our menu array. $menu_items = array(); // This array controls the order of the admin items. $this->template->menu_order = array('lang:cp:nav_content', 'lang:cp:nav_structure', 'lang:cp:nav_data', 'lang:cp:nav_users', 'lang:cp:nav_settings', 'lang:global:profile'); // $this->template->menu_order = array('lang:cp:nav_content', 'lang:cp:nav_structure', 'lang:cp:nav_data', 'lang:cp:nav_users', 'lang:cp:nav_settings', 'lang:global:profile'); $modules = $this->module_m->get_all(array('is_backend' => true, 'group' => $this->current_user->group, 'lang' => CURRENT_LANGUAGE)); foreach ($modules as $module) { // If we do not have an admin_menu function, we use the // regular way of checking out the details.php data. if ($module['menu'] and (isset($this->permissions[$module['slug']]) or $this->current_user->group == 'admin')) { // Legacy module routing. This is just a rough // re-route and modules should change using their // upgrade() details.php functions. if ($module['menu'] == 'utilities') { $module['menu'] = 'data'; } if ($module['menu'] == 'design') { $module['menu'] = 'structure'; } $menu_items['lang:cp:nav_' . $module['menu']][$module['name']] = 'admin/' . $module['slug']; } // If a module has an admin_menu function, then // we simply run that and allow it to manipulate the // menu array. if (method_exists($module['module'], 'admin_menu')) { //echo "<pre>"; // print_r($menu_items);; $module['module']->admin_menu($menu_items); } } // We always have our // edit profile links and such. $menu_items['lang:global:profile'] = array('lang:cp:edit_profile_label' => 'edit-profile', 'lang:cp:logout_label' => 'admin/logout'); // Order the menu items. We go by our menu_order array. $ordered_menu = array(); foreach ($this->template->menu_order as $order) { if (isset($menu_items[$order])) { $ordered_menu[lang_label($order)] = $menu_items[$order]; unset($menu_items[$order]); } } // Any stragglers? if ($menu_items) { $translated_menu_items = array(); // translate any additional top level menu keys so the array_merge works foreach ($menu_items as $key => $menu_item) { $translated_menu_items[lang_label($key)] = $menu_item; } $ordered_menu = array_merge_recursive($ordered_menu, $translated_menu_items); } //unset($ordered_menu['Content']); // And there we go! These are the admin menu items. $this->template->menu_items = $ordered_menu; } // ------------------------------ // Template configuration $this->template->enable_parser(false)->set('theme_options', $this->theme_options)->set_theme(ADMIN_THEME)->set_layout('default', 'admin'); // trigger the run() method in the selected admin theme $class = 'Theme_' . ucfirst($this->admin_theme->slug); call_user_func(array(new $class(), 'run')); }
/** * Prepare template * * @access protected */ protected function _prepare_template() { $theme_path = \Config::get('app.frontend.template'); if (null === $theme_path) { $theme_path = DOCROOT . 'themes/default/'; \Config::set('app.frontend.template', $theme_path); } \Hybrid\View::set_path($theme_path); \Asset::add_path($theme_path . 'assets/'); if (true === $this->auto_render) { $this->template = \Hybrid\View::factory(); $this->template->auto_encode(false); $this->template->set_filename('index'); } }
{{ if showcase_widget }} <?php Asset::add_path('showcase', 'addons/shared_addons/modules/product/widgets/cat_showcase/'); ?> {{ asset:css file="showcase::logo_perspective.css" group="showcase" }} {{ asset:js file="showcase::jquery-ui.1.9.2.js" group="showcase" }} {{ asset:js file="showcase::jquery.ui.touch-punch.min.js" group="showcase" }} {{ asset:js file="showcase::logo_perspective.js" group="showcase" }} {{ asset:render_js group="showcase" }} {{ asset:render_css group="showcase" }} <script> $(function() { $('#logo_perspective_black').logo_perspective({ skin: 'black', width: 1060, imageWidth:95, imageHeight:55, responsive:true, elementsHorizontalSpacing:110, elementsVerticalSpacing:0, showNavArrows:false, showBottomNav:false, border:1, borderColorOFF:'#cccccc', autoPlay: 2, numberOfVisibleItems:8, borderColorON: '#4672a7' }); });
<?php if (count($images) > 0) { $settings = isset($options['settings']) ? $options['settings'] : ''; Asset::add_path('flexslider', 'addons/shared_addons/widgets/flexslider/'); Asset::css('flexslider::flexslider.css', false, 'flexslider'); Asset::js('flexslider::jquery.flexslider-min.js', false, 'flexslider'); echo Asset::render_js('flexslider'); echo Asset::render_css('flexslider'); ?> <script type="text/javascript"> $(function(){ if($.isFunction($.fn.flexslider)){ $('.myflexslider').flexslider(<?php echo $settings; ?> ); } }); </script> <div class="myflexslider"> <ul class="slides"> <?php foreach ($images as $image) { ?> <li><img src="<?php echo $image->path; ?> " <?php echo $options['captions'] === 'true' ? 'title="' . $image->name . '"' : null; ?>