Example #1
0
 function run()
 {
     $base = publish(__DIR__ . '/google-code-prettify');
     js_file($base . '/prettify.js');
     css_file($base . '/theme/' . $this->theme . '.css');
     js("prettyPrint();");
 }
Example #2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // Put in cache all of route which are tag
     $routes = Cache::remember('tags', 120, function () {
         return Route::all();
     });
     $results = [];
     // Check if current route has tags
     foreach ($routes as $route) {
         if (preg_match('%^' . $route->route . '$%', $request->url())) {
             array_push($results, $route->tag_container_id);
         }
     }
     // Get all container tag of the current route and add this to the layout
     $contents = Tag::whereIn('tag_container_id', $results)->get();
     if ($contents) {
         foreach ($contents as $content) {
             // if data content format this to integrate them into the script
             if ($content->data) {
                 $data = explode(',', $content->data);
                 $params = [];
                 foreach ($data as $value) {
                     $params[] = "'+ {$value} +'";
                 }
                 $script = sprintf($content->content, ...$params);
             } else {
                 $script = $content->content;
             }
             // add script to namespace declared in database
             js($content->position . '-tag')->append($script);
         }
     }
     return $next($request);
 }
Example #3
0
 public function form()
 {
     $this->load->library('cart');
     $total_amount = $this->cart->format_number($this->cart->total());
     $this->paypallib->add_field('business', '*****@*****.**');
     $this->paypallib->add_field('return', site_url('pyrocart/paypal/success'));
     $this->paypallib->add_field('cancel_return', site_url('pyrocart/paypal/cancel'));
     $this->paypallib->add_field('notify_url', site_url('pyrocart/paypal/ipn'));
     // <-- IPN url
     $this->paypallib->add_field('custom', '1234567890');
     // <-- Verify return
     $this->paypallib->add_field('item_name', 'Paypal Test Transaction');
     $this->paypallib->add_field('item_number', '6941');
     $this->paypallib->add_field('amount', $total_amount);
     // if you want an image button use this:
     $this->paypallib->image('button_03.gif');
     // otherwise, don't write anything or (if you want to
     // change the default button text), write this:
     // $this->paypallib->button('Click to Pay!');
     $this->data->paypal_form = $this->paypallib->paypal_form();
     $this->data->countries = $this->checkout_m->retrieve_countries();
     $this->data->zones = $this->checkout_m->retrieve_zones();
     $this->data->cart_contents = $this->cart->contents();
     $this->template->append_metadata(css('smart_wizard.css', 'pyrocart'))->append_metadata(css('checkout.css', 'pyrocart'))->append_metadata(js('jquery.smartWizard-2.0.min.js', 'pyrocart'))->append_metadata(js('jquery.chained.mini.js', 'pyrocart'))->append_metadata(js('checkout.js', 'pyrocart'))->build('paypal/form', $this->data);
 }
function body($data)
{
    srand(seed());
    $body = array();
    array_push($body, js($data));
    return implode("\r\n", $body);
}
Example #5
0
 static function ajaxForm($id, $script = null, $replace = '##ajax-form-alert##:')
 {
     $update = "ajaxForm" . md5(uniqid(microtime()));
     js("\n\t\t\t\$('#" . $id . "').ajaxForm(function(data) {  \n\t\t\t\tdata = data.substr(strrpos(data,'" . $replace . "'));\n\t\t\t\tdata = str_replace('" . $replace . "','',data);\n\t\t\t\t" . $script . " \n\t\t\t}); \n\t\t");
     js('misc/php.js');
     js('misc/jquery.form.js');
 }
 public function profile()
 {
     $user_id = app('auth')->user()->getKey();
     $user = User::with('wishlists', 'wishlists.givingCircle', 'wishlists.items')->where('id', '=', $user_id)->get()->first();
     js(['user' => $user->getAttributes(), 'wishlists' => $user->wishlists->toArray()]);
     return view('profile', ['user' => $user]);
 }
Example #7
0
 function Admin_Controller()
 {
     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()) {
         show_error($this->lang->line('cp_access_denied'));
         exit;
     }
     // Get a list of all modules available to this user / group
     if ($this->user) {
         $this->template->core_modules = $this->cache->model('module_m', 'get_all', array(array('is_backend_menu' => TRUE, 'is_backend' => TRUE, 'group' => $this->user->group, 'lang' => CURRENT_LANGUAGE)), $this->config->item('navigation_cache'));
         $addon_modules = $this->cache->model('module_m', 'get_all', array(array('is_core' => FALSE, 'is_backend' => TRUE, 'group' => $this->user->group, 'lang' => CURRENT_LANGUAGE)), $this->config->item('navigation_cache'));
         // This takes the modules array and creates a keyed array with the slug as the key.
         $modules_keyed = array();
         foreach ($addon_modules as $mod) {
             $modules_keyed[$mod['slug']] = $mod;
         }
         $this->template->addon_modules = $modules_keyed;
     }
     // Template configuration
     $this->template->set_layout('admin/layout');
     $this->template->enable_parser(FALSE);
     $this->template->append_metadata(css('admin/style.css'))->append_metadata(css('jquery/jquery-ui.css'))->append_metadata(css('jquery/colorbox.css'))->append_metadata('<script type="text/javascript">jQuery.noConflict();</script>')->append_metadata(js('jquery/jquery-ui-1.8.4.min.js'))->append_metadata(js('jquery/jquery.colorbox.min.js'))->append_metadata(js('jquery/jquery.livequery.js'))->append_metadata(js('admin/jquery.uniform.min.js'))->append_metadata(js('admin/functions.js'))->append_metadata('<script type="text/javascript">pyro.apppath_uri="' . APPPATH_URI . '";pyro.base_uri="' . BASE_URI . '";</script>');
     $this->template->set_partial('header', 'admin/partials/header', FALSE);
     $this->template->set_partial('navigation', 'admin/partials/navigation', FALSE);
     $this->template->set_partial('metadata', 'admin/partials/metadata', FALSE);
     $this->template->set_partial('footer', 'admin/partials/footer', FALSE);
     //	    $this->output->enable_profiler(TRUE);
 }
 public function rules($groupID)
 {
     $this->js = js(array('jquery-1.9.0.min'));
     $data['groupID'] = $groupID;
     $groupID = (int) $groupID;
     $get['table'] = MSTABLE_GROUPS;
     $get['display'] = array('gro_name_en', 'gro_name_en as groupName', 'permission');
     $data['group'] = $this->dbObject_model->get($get, array('gro_id' => $groupID));
     $vars['table'] = MSTABLE_RULES;
     $vars['display'] = array('rul_name_en', 'rul_id', 'parent', 'rul_slug');
     $vars['orderby'] = "parent";
     $rule = $this->dbObject_model->get($vars);
     //print_r($rule);
     $data['rules'] = array();
     for ($i = 0; $i < count($rule); $i++) {
         if ($rule[$i]['parent'] == 0 || $rule[$i]['parent'] == "") {
             $data['rules'][$rule[$i]['rul_id']] = $rule[$i];
         } else {
             $data['rules'][$rule[$i]['parent']]['child'][] = $rule[$i];
         }
     }
     //        print_r($rule);
     //        exit();
     unset($rule);
     $this->load->view('dash/permission/rules', $data);
 }
Example #9
0
 /**
  * 管理中心。如果未登陆,跳转至登陆页
  *
  * @author          mrmsl
  * @date            2012-07-02 11:12:49
  * @lastmodify      2013-03-29 15:58:41 by mrmsl
  *
  * @return void 无返回值。如果未登陆跳转至登陆页
  */
 function indexAction()
 {
     if (!($admin_info = $this->_admin_info)) {
         $this->_redirect(WEB_ADMIN_ENTRY . '/login', false);
         return false;
     }
     $admin_priv = strtolower(json_encode(array_values($this->_role_info['priv'])));
     $role_info = $this->_getCache($admin_info['role_id'], 'Role');
     //css文件
     $css_file = $this->_loadTimeScript('START_TIME');
     //,extjs/v4.1.1/resources/css/ext-patch.css
     $css_file .= css('extjs/v4.1.1a//resources/css/ext-all-gray.css,extjs/v4.1.1a/resources/css/ext-patch.css', COMMON_IMGCACHE);
     $css_file .= css('app.css', ADMIN_IMGCACHE . 'css/');
     $js_file = $this->_loadTimeScript('LOAD_CSS_TIME');
     $js_file .= js('', true, COMMON_IMGCACHE . 'extjs/v4.1.1a/');
     $js_file .= $this->_loadTimeScript('LOAD_EXT_TIME');
     $js_file .= js('System.js', false, '/static/js/');
     $js_file .= js('System.sys_base_admin_entry = "' . WEB_ADMIN_ENTRY . '"', 'script');
     //后台入口
     $js_file .= js(MODULE_NAME . '.' . LANG . '.js', false, '/static/js/lang/') . ('en' != LANG ? js('ext-lang-' . LANG . '.js', false, '/static/js/lang/') : '');
     if (APP_DEBUG) {
         $js_arr = (include APP_PATH . 'include/required_js.php');
         $js_file .= js($js_arr, false, ADMIN_IMGCACHE . 'app/');
     } else {
         $js_file .= js('app/pack/app.js', false);
     }
     //$js_file  .= js('editor_config.js', false, COMMON_IMGCACHE . 'ueditor/v1.2.5/');
     $js_file .= $this->_loadTimeScript('LOAD_JS_TIME');
     include TEMPLATE_FILE;
 }
Example #10
0
 function jsErrors($errors)
 {
     if (is_string($errors)) {
         $errors = ['message' => $errors];
     }
     js(['errors' => $errors]);
 }
Example #11
0
 function Admin_Controller()
 {
     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()) {
         show_error($this->lang->line('cp_access_denied'));
         exit;
     }
     // Get a list of all modules available to this user / group
     if ($this->user) {
         $modules = $this->module_m->get_all(array('is_backend' => TRUE, 'group' => $this->user->group, 'lang' => CURRENT_LANGUAGE));
         $grouped_modules = array();
         $grouped_menu[] = 'content';
         foreach ($modules as $module) {
             if ($module['menu'] != 'content' && $module['menu'] != 'design' && $module['menu'] != 'users' && $module['menu'] != 'utilities' && $module['menu'] != '0') {
                 $grouped_menu[] = $module['menu'];
             }
         }
         array_push($grouped_menu, 'design', 'users', 'utilities');
         $grouped_menu = array_unique($grouped_menu);
         foreach ($modules as $module) {
             $grouped_modules[$module['menu']][$module['name']] = $module;
         }
         $this->template->menu_items = $grouped_menu;
         $this->template->modules = $grouped_modules;
     }
     // Template configuration
     $this->template->set_layout('default', 'admin')->enable_parser(FALSE)->append_metadata(css('admin/style.css'))->append_metadata(css('jquery/jquery-ui.css'))->append_metadata(css('jquery/colorbox.css'))->append_metadata('<script type="text/javascript">jQuery.noConflict();</script>')->append_metadata(js('jquery/jquery-ui-1.8.4.min.js'))->append_metadata(js('jquery/jquery.colorbox.min.js'))->append_metadata(js('jquery/jquery.livequery.js'))->append_metadata(js('admin/jquery.uniform.min.js'))->append_metadata(js('admin/functions.js'))->append_metadata('<script type="text/javascript">pyro.apppath_uri="' . APPPATH_URI . '";pyro.base_uri="' . BASE_URI . '";</script>')->set('user', $this->user)->set_partial('header', 'admin/partials/header')->set_partial('navigation', 'admin/partials/navigation')->set_partial('metadata', 'admin/partials/metadata')->set_partial('footer', 'admin/partials/footer');
     //	    $this->output->enable_profiler(TRUE);
 }
Example #12
0
function daemons_servers_delete()
{
    $cfg = $GLOBALS['cfg'];
    $db = $GLOBALS['db'];
    $server_id = intval(params('server_id'));
    $daemon_id = intval(params('daemon_id'));
    $arrService = $db->select("SELECT id\n        FROM {$cfg['tblService']}\n        WHERE server_id='{$server_id}'\n        AND daemon_id='{$daemon_id}'");
    if (!$arrService) {
        halt(SERVER_ERROR);
        return;
    }
    $id = $arrService[0]['id'];
    $result = $db->delete("DELETE FROM {$cfg['tblService']}\n        WHERE id='{$id}'\n        LIMIT 1");
    $resultForeign = $db->delete("DELETE FROM {$cfg['tblAccess']}\n        WHERE dienst_id='{$id}'");
    if (!$result || !$resultForeign) {
        halt(SERVER_ERROR);
        return;
    }
    set('server', array('id' => $server_id));
    set('daemon', array('id' => $daemon_id));
    if (isAjaxRequest()) {
        return js('daemons_servers/delete.js.php', null);
    } else {
        halt(HTTP_NOT_IMPLEMENTED);
    }
}
Example #13
0
 function Public_Controller()
 {
     parent::MY_Controller();
     $this->benchmark->mark('public_controller_start');
     // Check the frontend hasnt been disabled by an admin
     if (!$this->settings->item('frontend_enabled')) {
         $error = $this->settings->item('unavailable_message') ? $this->settings->item('unavailable_message') : lang('cms_fatal_error');
         show_error($error);
     }
     // -- Navigation menu -----------------------------------
     $this->load->model('pages/pages_m');
     // Set the theme view folder
     $this->template->set_theme($this->settings->item('default_theme'));
     $this->asset->set_theme($this->settings->item('default_theme'));
     $this->template->set_layout('layout');
     $this->template->append_metadata(js('jquery/jquery.js'))->append_metadata(js('jquery/jquery.fancybox.js'))->append_metadata(css('jquery/jquery.fancybox.css'))->append_metadata(js('front.js'));
     // 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 news module, link to its RSS feed in the head
     if (module_exists('news')) {
         $this->template->append_metadata('<link rel="alternate" type="application/rss+xml" title="' . $this->settings->item('site_name') . '" href="' . site_url('news/rss/all|rss') . '" />');
     }
     // Enable profiler on local box
     if (ENV == 'local' && $this->input->get('_debug')) {
         $this->output->enable_profiler(TRUE);
     }
     // Frontend data
     $this->load->library('variables/variables');
     $this->load->vars('variable', $this->variables->get());
     $this->benchmark->mark('public_controller_end');
 }
Example #14
0
 /**
  * Show the control panel
  *
  * @access public
  * @return void
  */
 public function index()
 {
     if (CMS_VERSION !== $this->settings->version) {
         $this->data->messages['notice'] = sprintf(lang('cp_upgrade_message'), CMS_VERSION, $this->settings->version, site_url('upgrade'));
     } else {
         if (is_dir('./installer')) {
             $this->data->messages['notice'] = lang('cp_delete_installer_message');
         }
     }
     $this->load->model('comments/comments_m');
     $this->load->model('pages/pages_m');
     $this->load->model('users/users_m');
     $this->lang->load('comments/comments');
     $this->data->recent_users = $this->users_m->get_recent(5);
     $recent_comments = $this->comments_m->get_recent(5);
     $this->data->recent_comments = process_comment_items($recent_comments);
     // Dashboard RSS feed (using SimplePie)
     $this->load->library('simplepie');
     $this->simplepie->set_cache_location(APPPATH . 'cache/simplepie/');
     $this->simplepie->set_feed_url($this->settings->dashboard_rss);
     $this->simplepie->init();
     $this->simplepie->handle_content_type();
     // Dashboard Analytics
     //$this->load->library('analytics');
     // Just use dummy data for now - we need more settings to make this work...
     // Note: Data will need to be in javascript timestamps (multiply unix timestamp by 1000)
     $times = array(time() - 7 * 24 * 60 * 60 * 5 * 1000, time() - 7 * 24 * 60 * 60 * 4 * 1000, time() - 7 * 24 * 60 * 60 * 3 * 1000, time() - 7 * 24 * 60 * 60 * 2 * 1000, time() - 7 * 24 * 60 * 60 * 1000);
     $this->data->ga_visits = '[[' . $times[0] . ', 300], [' . $times[1] . ', 800], [' . $times[2] . ', 500], [' . $times[3] . ', 800], [' . $times[4] . ', 1300]]';
     $this->template->append_metadata(js('jquery/jquery.flot.js'));
     // Store the feed items
     $this->data->rss_items = $this->simplepie->get_items(0, $this->settings->dashboard_rss_count);
     $this->template->set_partial('sidebar', 'admin/partials/sidebar', FALSE);
     $this->template->title(lang('cp_admin_home_title'))->build('admin/dashboard', $this->data);
 }
Example #15
0
 /**
  * Render a modal
  *
  * @param \FrenchFrogs\Modal\Modal\Modal $modal
  * @return string
  */
 public function modal(Modal\Modal $modal)
 {
     $html = '';
     // header
     if ($modal->hasCloseButton()) {
         $html .= html('button', ['type' => 'button', 'class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => $modal->getCloseButtonLabel()], '<span aria-hidden="true">&times;</span>');
     }
     if ($modal->hasTitle()) {
         $html .= html('h4', ['class' => Style::MODAL_HEADER_TITLE_CLASS], $modal->getTitle());
         $html = html('div', ['class' => Style::MODAL_HEADER_CLASS], $html);
     }
     // body
     $html .= html('div', ['class' => Style::MODAL_BODY_CLASS], $modal->getBody());
     // footer
     if ($modal->hasActions()) {
         $actions = '';
         if ($modal->hasCloseButton()) {
             $actions .= html('button', ['type' => 'button', 'class' => 'btn btn-default', 'data-dismiss' => 'modal'], $modal->getCloseButtonLabel());
         }
         foreach ($modal->getActions() as $action) {
             /** @var Element\Button $action */
             $actions .= $this->render('action', $action);
         }
         $html .= html('div', ['class' => Style::MODAL_FOOTER_CLASS], $actions);
     }
     // container
     if (!$modal->isRemote()) {
         $html = html('div', ['class' => Style::MODAL_CONTENT_CLASS], $html);
         $html = html('div', ['class' => Style::MODAL_DIALOG_CLASS, 'role' => 'document'], $html);
         $html = html('div', ['class' => Style::MODAL_CLASS, 'role' => 'dialog'], $html);
     }
     $html .= html('script', ['type' => 'text/javascript'], js('onload'));
     return $html;
 }
Example #16
0
    /**
     * Constructor method
     * @access public
     * @return void
     */
    public function __construct()
    {
        // Call the parent's constructor
        parent::__construct();
        $this->load->model('permissions_m');
        $this->load->helper('array');
        $this->lang->load('permissions');
        $this->load->library('form_validation');
        // Validation rules
        $this->validation_rules = array(array('field' => 'module', 'label' => lang('perm_module_label'), 'rules' => 'trim|required'), array('field' => 'controller', 'label' => lang('perm_controller_label'), 'rules' => 'trim|required'), array('field' => 'method', 'label' => lang('perm_method_label'), 'rules' => 'trim|required'), array('field' => 'role_type', 'label' => lang('perm_type_label'), 'rules' => 'trim|required'), array('field' => 'user_id', 'label' => lang('perm_user_label'), 'rules' => 'trim|numeric'), array('field' => 'permission_role_id', 'label' => lang('perm_role_label'), 'rules' => 'trim|numeric'));
        // Get "roles" (like access levels)
        $this->data->roles = $this->permissions_m->get_roles(array('except' => array('admin')));
        $this->data->roles_select = array_for_select($this->data->roles, 'id', 'title');
        $this->data->users = $this->users_m->get_all();
        $this->data->users_select = array_for_select($this->data->users, 'id', 'full_name');
        $modules = $this->modules_m->get_modules(array('is_backend' => true));
        $this->data->modules_select = array('*' => lang('perm_module_select_default')) + array_for_select($modules, 'slug', 'name');
        $this->template->append_metadata('
			<script type="text/javascript">
				var roleDeleteConfirm = "' . $this->lang->line('perm_role_delete_confirm') . '";
				var permControllerSelectDefault = "' . $this->lang->line('perm_controller_select_default') . '";
				var permMethodSelectDefault = "' . $this->lang->line('perm_method_select_default') . '";
			</script>
		');
        $this->template->append_metadata(js('permissions.js', 'permissions'));
        $this->template->set_partial('sidebar', 'admin/sidebar');
    }
Example #17
0
 public function index()
 {
     //do they want to delete the template?
     if ($this->input->post()) {
         if ($_POST['btnAction'] == 'delete') {
             $delete = $this->input->post('template_list');
             if ($this->templates_m->delete_template($delete)) {
             }
             $this->session->set_flashdata(array('success' => lang('newsletters.template_delete_success')));
             redirect('admin/newsletters/templates');
         }
     }
     //else go on with normal business
     $this->form_validation->set_rules($this->template_rules);
     if ($this->form_validation->run()) {
         if ($this->templates_m->save_template($this->input->post())) {
             $this->session->set_flashdata(array('success' => sprintf(lang('newsletters.template_add_success'), $this->input->post('title'))));
             redirect('admin/newsletters/templates');
         }
     }
     //get all templates so we can populate the dropdown
     $template_list = $this->templates_m->get_templates();
     $this->data->template_list[0] = '';
     foreach ($template_list as $template) {
         $this->data->template_list[$template->id] = $template->title;
     }
     $this->template->title($this->module_details['name'], lang('newsletters.templates'))->set('active_section', 'templates')->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE))->append_metadata(js('functions.js', 'newsletters'))->append_metadata(css('admin.css', 'newsletters'))->build('admin/templates', $this->data);
 }
Example #18
0
 function create()
 {
     $this->load->library('validation');
     $this->rules['slug'] .= '|callback__check_slug';
     $this->validation->set_rules($this->rules);
     $this->validation->set_fields();
     // Go through all the known fields and get the post values
     foreach (array_keys($this->rules) as $field) {
         $article->{$field} = set_value($field);
     }
     if ($this->validation->run()) {
         $id = $this->news_m->insert(array('title' => $this->input->post('title'), 'slug' => $this->input->post('slug'), 'category_id' => $this->input->post('category_id'), 'intro' => $this->input->post('intro'), 'body' => $this->input->post('body'), 'status' => $this->input->post('status'), 'created_on_hour' => $this->input->post('created_on_hour'), 'created_on_minute' => $this->input->post('created_on_minute'), 'created_on_day' => $this->input->post('created_on_day'), 'created_on_month' => $this->input->post('created_on_month'), 'created_on_year' => $this->input->post('created_on_year')));
         if (!empty($id)) {
             $this->session->set_flashdata('success', sprintf($this->lang->line('news_article_add_success'), $this->input->post('title')));
             // The twitter module is here, and enabled!
             if ($this->settings->item('twitter_news') == 1 && $this->input->post('status') == 'live') {
                 $url = shorten_url('news/' . $this->input->post('created_on_year') . '/' . $this->input->post('created_on_month') . '/' . url_title($this->input->post('title')));
                 $this->load->model('twitter/twitter_m');
                 if (!$this->twitter_m->update(sprintf($this->lang->line('news_twitter_posted'), $this->input->post('title'), $url))) {
                     $this->session->set_flashdata('error', lang('news_twitter_error') . ": " . $this->twitter->last_error['error']);
                 }
             }
             // End twitter code
         } else {
             $this->session->set_flashdata('error', $this->lang->line('news_article_add_error'));
         }
         redirect('admin/news');
     }
     $this->data->article =& $article;
     // Load WYSIWYG editor
     $this->template->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE))->append_metadata(js('news_form.js', 'news'));
     $this->template->build('admin/form', $this->data);
 }
Example #19
0
 /**
  *  Загрузка скриптов
  */
 public function load()
 {
     $this->toolbar = Core_ArrayObject::transform($this->toolbar);
     $folder = cogear()->redactor->folder . DS . 'redactor' . DS;
     $options = new Core_ArrayObject();
     event('redactor.options', $options);
     $options->lang = config('i18n.lang', 'ru');
     $options->shortcuts = TRUE;
     $options->minHeight = 300;
     $options->buttons = array('formatting', 'alignment', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'table', 'link', 'image', '|', 'fontcolor', 'backcolor', '|', 'horizontalrule', '|', 'html');
     //        $options->imageUpload = l('/redactor/upload/');
     $options->fixed = TRUE;
     $options->observeImages = TRUE;
     $options->convertLinks = TRUE;
     $options->cleanup = FALSE;
     $options->focus = TRUE;
     $options->convertDivs = FALSE;
     role() == 1 && ($options->fixedTop = 40);
     js($folder . $options->lang . '.js', 'after');
     //        $this->toolbar->markupSet->uasort('Core_ArrayObject::sortByOrder');
     //            $(document).ready(function(){
     css($folder . 'redactor.css');
     js($folder . 'redactor.min.js', 'after');
     inline_js("\$('[name={$this->name}]').redactor(" . $options->toJSON() . ")", 'after');
 }
 public static function admin_theme_header()
 {
     echo js('jquery');
     echo "<script type='text/javascript'>jQuery.noConflict() ;</script>";
     echo js('controlledvocab', 'javascripts');
     echo "<link rel='stylesheet' href='" . css('controlledvocab') . "' />";
 }
 public function __construct()
 {
     parent::__construct();
     // Not an admin and not allowed to see files
     if ($this->current_user->group !== 'admin' and !array_key_exists('files', $this->permissions)) {
         $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);
     // Prepare Asset library
     $this->asset->set_theme(ADMIN_THEME);
     // Set the location of assets
     $this->config->set_item('asset_dir', dirname($this->admin_theme->web_path) . '/');
     $this->config->set_item('asset_url', BASE_URL . dirname($this->admin_theme->web_path) . '/');
     $this->config->set_item('theme_asset_dir', dirname($this->admin_theme->web_path) . '/');
     $this->config->set_item('theme_asset_url', BASE_URL . dirname($this->admin_theme->web_path) . '/');
     $this->load->model('files/file_folders_m');
     $this->load->model('files/file_m');
     $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)->set('editor_path', config_item('asset_dir') . 'js/ckeditor/')->append_metadata(css('wysiwyg.css', 'wysiwyg'))->append_metadata(css('jquery/ui-lightness/jquery-ui.css'))->append_metadata(js('jquery/jquery.min.js'))->append_metadata(js('plugins.js'))->append_metadata(js('jquery/jquery-ui.min.js'))->append_metadata(js('wysiwyg.js', 'wysiwyg'));
 }
Example #22
0
 /**
  * Constructor method
  * @access public
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     // Load the required classes
     $this->load->library('form_validation');
     $this->load->model('navigation_m');
     $this->load->model('pages/pages_m');
     $this->lang->load('navigation');
     $this->template->set_partial('shortcuts', 'admin/partials/shortcuts');
     $this->template->append_metadata(js('navigation.js', 'navigation'));
     // Get Navigation Groups
     $this->data->groups = $this->navigation_m->get_groups();
     $this->data->groups_select = array_for_select($this->data->groups, 'id', 'title');
     $all_modules = $this->module_m->get_all(array('is_frontend' => true));
     //only allow modules that user has permissions for
     foreach ($all_modules as $module) {
         if (in_array($module['slug'], $this->permissions) or $this->user->group == 'admin') {
             $modules[] = $module;
         }
     }
     $this->data->modules_select = array_for_select($modules, 'slug', 'name');
     // Get Pages and create pages tree
     $tree = array();
     if ($pages = $this->pages_m->get_all()) {
         foreach ($pages as $page) {
             $tree[$page->parent_id][] = $page;
         }
     }
     unset($pages);
     $this->data->pages_select = $tree;
     // Set the validation rules for the navigation items
     $this->form_validation->set_rules($this->validation_rules);
 }
Example #23
0
 /**
  * Constructor method
  * @access public
  * @return void
  */
 public function __construct()
 {
     // Call the parent's contstructor
     parent::__construct();
     // Load the required classes
     $this->load->library('form_validation');
     $this->load->model('navigation_m');
     $this->load->model('pages/pages_m');
     $this->lang->load('navigation');
     $this->template->set_partial('shortcuts', 'admin/partials/shortcuts');
     $this->template->append_metadata(js('navigation.js', 'navigation'));
     // Get Navigation Groups
     $this->data->groups = $this->navigation_m->get_groups();
     $this->data->groups_select = array_for_select($this->data->groups, 'id', 'title');
     $modules = $this->module_m->get_all(array('is_frontend' => true));
     $this->data->modules_select = array_for_select($modules, 'slug', 'name');
     // Get Pages and create pages tree
     $tree = array();
     if ($pages = $this->pages_m->get_all()) {
         foreach ($pages as $page) {
             $tree[$page->parent_id][] = $page;
         }
     }
     unset($pages);
     $this->data->pages_select = $tree;
     // Set the validation rules for the navigation items
     $this->validation_rules = array(array('field' => 'title', 'label' => lang('nav_title_label'), 'rules' => 'trim|required|max_length[40]'), array('field' => 'link_type', 'label' => lang('nav_type_label'), 'rules' => 'trim|alpha'), array('field' => 'url', 'label' => lang('nav_url_label'), 'rules' => 'trim'), array('field' => 'uri', 'label' => lang('nav_uri_label'), 'rules' => 'trim'), array('field' => 'module_name', 'label' => lang('nav_module_label'), 'rules' => 'trim|alpha_dash'), array('field' => 'page_id', 'label' => lang('nav_page_label'), 'rules' => 'trim|numeric'), array('field' => 'navigation_group_id', 'label' => lang('nav_group_label'), 'rules' => 'trim|numeric|required'), array('field' => 'target', 'label' => lang('nav_target_label'), 'rules' => 'trim|max_length[10]'));
     $this->form_validation->set_rules($this->validation_rules);
 }
Example #24
0
 public function layout($type, $data = array())
 {
     $version = panel()->version();
     $base = panel()->urls()->index();
     $cssbase = panel()->urls()->css();
     $jsbase = panel()->urls()->js();
     $defaults = array('title' => panel()->site()->title() . ' | Panel', 'direction' => panel()->direction(), 'meta' => $this->snippet('meta'), 'css' => css($cssbase . '/panel.css?v=' . $version), 'js' => js($jsbase . '/dist/panel.min.js?v=' . $version), 'content' => '', 'bodyclass' => '');
     switch ($type) {
         case 'app':
             $defaults['topbar'] = '';
             $defaults['csrf'] = panel()->csrf();
             $defaults['formcss'] = css($cssbase . '/form.min.css?v=' . $version);
             $defaults['formjs'] = js($jsbase . '/dist/form.min.js?v=' . $version);
             $defaults['appjs'] = js($jsbase . '/dist/app.min.js?v=' . $version);
             // plugin stuff
             $defaults['pluginscss'] = css($base . '/plugins/css?v=' . $version);
             $defaults['pluginsjs'] = js($base . '/plugins/js?v=' . $version);
             break;
         case 'base':
             break;
     }
     $data = array_merge($defaults, $data);
     if (r::ajax() and $type == 'app') {
         $panel = panel();
         $user = $panel->site()->user();
         $response = array('user' => $user ? $user->username() : false, 'direction' => $panel->direction(), 'title' => $data['title'], 'content' => $data['topbar'] . $data['content']);
         return response::json($response);
     } else {
         return new Layout($type, $data);
     }
 }
 /**
  * Entries Index
  *
  * @access	private
  * @return	void
  */
 public function index()
 {
     $offset_uri = 6;
     $pagination_uri = 'admin/streams/entries/index/' . $this->data->stream->id;
     // -------------------------------------
     // Get fields for headers and add specials
     // -------------------------------------
     $this->data->stream_fields = $this->streams_m->get_stream_fields($this->data->stream_id);
     $this->data->stream_fields->id->field_name = lang('streams.id');
     $this->data->stream_fields->created->field_name = lang('streams.created_date');
     $this->data->stream_fields->updated->field_name = lang('streams.updated_date');
     $this->data->stream_fields->created_by->field_name = lang('streams.created_by');
     $offset = $this->uri->segment($offset_uri, 0);
     if ($this->data->stream->sorting == 'custom') {
         // We need some variables to use in the sort. I guess.
         $this->template->append_metadata('<script type="text/javascript" language="javascript">var stream_id=' . $this->data->stream->id . ';var stream_offset=' . $offset . ';</script>');
         // We want to sort this shit
         $this->template->append_metadata(js('entry_sorting.js', 'streams'));
         // Comeon' Livequery! You're goin' in!
         $this->template->append_metadata(js('jquery.livequery.js', 'streams'));
     }
     // -------------------------------------
     // Get data
     // -------------------------------------
     $this->db->limit($this->settings->item('records_per_page'), $offset);
     $this->data->data = $this->streams_m->get_stream_data($this->data->stream, $this->data->stream_fields, $this->settings->item('records_per_page'), $this->uri->segment($offset_uri));
     // -------------------------------------
     // Pagination
     // -------------------------------------
     $this->data->pagination = create_pagination($pagination_uri, $this->db->count_all(STR_PRE . $this->data->stream->stream_slug), $this->settings->item('records_per_page'), 6);
     // -------------------------------------
     // Build Pages
     // -------------------------------------
     $this->template->build('admin/entries/index', $this->data);
 }
function closing_html()
{
    js(array('jquery.js', 'bootstrap.min.js'));
    echo '
			</body>
		</html>
	';
}
Example #27
0
 public function __construct()
 {
     parent::__construct();
     // Load the required classes
     $this->load->model('sample_m');
     $this->lang->load('sample');
     $this->template->append_metadata(css('sample.css', 'sample'))->append_metadata(js('sample.js', 'sample'));
 }
Example #28
0
function smarty_function_js($params, $template)
{
    $CI =& get_instance();
    $CI->load->helper('parser');
    $file = $params['file'];
    unset($params['file']);
    js($file, $params);
}
Example #29
0
 /**
  * Constructor method
  *
  * @access	public
  * @return	void
  */
 public function __construct()
 {
     parent::__construct();
     $this->load->library('widgets');
     $this->lang->load('widgets');
     $this->input->is_ajax_request() and $this->template->set_layout(FALSE);
     $this->template->append_metadata(js('widgets.js', 'widgets'))->append_metadata(css('widgets.css', 'widgets'));
 }
Example #30
0
function include_editable_libs()
{
    $libs = '<link href="' . css() . "editable.css" . '" rel="stylesheet">';
    $libs .= '<script src="' . js() . "bootstrap-editable.min.js" . '"></script>';
    if ($_SESSION['role'] == 1) {
        echo $libs;
    }
}