Пример #1
0
 /**
  * Initialize properties before running the controller methods (actions),
  * so they are available to our action.
  * @param  string $template view to use as template
  * @return void           
  */
 public function before($template = NULL)
 {
     Theme::checker();
     $this->maintenance();
     $this->private_site();
     if ($this->auto_render === TRUE) {
         // Load the template
         $this->template = $template === NULL ? 'oc-panel/main' : $template;
         //if its and ajx request I want only the content
         if (Core::get('rel') == 'ajax') {
             $this->template = 'oc-panel/content';
         }
         $this->template = View::factory($this->template);
         // Initialize empty values
         $this->template->title = __('Panel') . ' - ' . core::config('general.site_name');
         $this->template->meta_keywords = '';
         $this->template->meta_description = '';
         $this->template->meta_copyright = 'Open Classifieds ' . Core::VERSION;
         $this->template->header = '';
         $this->template->content = '';
         $this->template->footer = '';
         $this->template->styles = array();
         $this->template->scripts = array();
         $this->template->user = Auth::instance()->get_user();
         //non ajax request
         if (Core::get('rel') != 'ajax') {
             $this->template->header = View::factory('oc-panel/header');
             $this->template->footer = View::factory('oc-panel/footer');
             /**
              * custom options for the theme
              * @var array
              */
             Theme::$options = Theme::get_options();
             //we load earlier the theme since we need some info
             Theme::load();
             if (Theme::get('cdn_files') == FALSE) {
                 //other color
                 if (Theme::get('admin_theme') != 'bootstrap' and Theme::get('admin_theme') != '') {
                     $theme_css = array('css/' . Theme::get('admin_theme') . '-bootstrap.min.css' => 'screen');
                 } else {
                     $theme_css = array('css/style.css' => 'screen');
                 }
                 $common_css = array('css/other.css' => 'screen');
                 Theme::$styles = array_merge($common_css, $theme_css);
                 Theme::$scripts['footer'] = array('js/jquery.min.js', 'js/jquery.cookie.min.js', 'js/iconPicker.min.js', 'js/jquery.sceditor.bbcode.min.js', 'js/summernote.min.js', 'js/bootstrap.min.js', 'js/chosen.jquery.min.js', 'js/mousetrap.min.js', 'js/bootstrap-tour.min.js', Route::url('jslocalization', array('controller' => 'jslocalization', 'action' => 'bstour')), 'js/oc-panel/tour.js', Route::url('jslocalization', array('controller' => 'jslocalization', 'action' => 'chosen')), 'http://' . (Kohana::$environment !== Kohana::DEVELOPMENT ? 'market.' . Core::DOMAIN . '' : 'eshop.lo') . '/embed.js', 'js/sweet-alert.min.js', 'js/favico.min.js', '//maps.google.com/maps/api/js?sensor=false&libraries=geometry&v=3.7', '//cdn.jsdelivr.net/gmaps/0.4.15/gmaps.min.js', 'js/bootstrap-colorpicker.min.js', 'js/jquery.bootgrid.min.js', 'js/query.bootgrid.fa.min.js', 'js/oc-panel/metismenu.min.js', 'js/oc-panel/fastclick.min.js', 'js/oc-panel/theme.init.js?v=' . Core::VERSION, 'js/oc-panel/sidebar.js?v=' . Core::VERSION);
             } else {
                 //other color
                 if (Theme::get('admin_theme') != 'bootstrap' and Theme::get('admin_theme') != '') {
                     $theme_css = array('//cdn.jsdelivr.net/bootswatch/3.3.6/' . Theme::get('admin_theme') . '/bootstrap.min.css' => 'screen');
                 } else {
                     $theme_css = array('css/style.css' => 'screen');
                 }
                 $common_css = array('css/other.css' => 'screen');
                 Theme::$styles = array_merge($theme_css, $common_css);
                 Theme::$scripts['footer'] = array('//cdn.jsdelivr.net/jquery/1.12.3/jquery.min.js', '//cdn.jsdelivr.net/jquery.cookie/1.4.1/jquery.cookie.min.js', 'js/iconPicker.min.js', 'js/jquery.sceditor.bbcode.min.js', '//cdn.jsdelivr.net/summernote/0.8.1/summernote.min.js', '//cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js', '//cdn.jsdelivr.net/chosen/1.0.0/chosen.jquery.min.js', '//cdn.jsdelivr.net/mousetrap/1.6.0/mousetrap.min.js', 'js/bootstrap-tour.min.js', Route::url('jslocalization', array('controller' => 'jslocalization', 'action' => 'bstour')), 'js/oc-panel/tour.js', Route::url('jslocalization', array('controller' => 'jslocalization', 'action' => 'chosen')), 'http://' . (Kohana::$environment !== Kohana::DEVELOPMENT ? 'market.' . Core::DOMAIN . '' : 'eshop.lo') . '/embed.js', 'js/sweet-alert.min.js', 'js/favico.min.js', '//maps.google.com/maps/api/js?sensor=false&libraries=geometry&v=3', '//cdn.jsdelivr.net/gmaps/0.4.15/gmaps.min.js', 'js/bootstrap-colorpicker.min.js', 'js/jquery.bootgrid.min.js', 'js/query.bootgrid.fa.min.js', 'js/oc-panel/metismenu.min.js', 'js/oc-panel/fastclick.min.js', 'js/oc-panel/theme.init.js?v=' . Core::VERSION, 'js/oc-panel/sidebar.js?v=' . Core::VERSION);
             }
         }
     }
 }
Пример #2
0
<?php

require_once "../../global.php";
$user = User::load(Session::getUserID());
$action = Filter::text($_POST['action']);
if ($action == 'theme') {
    // get the new theme
    $themeID = Filter::numeric($_POST['themeID']);
    $theme = Theme::load($themeID);
    // validate the theme
    if (empty($theme)) {
        $json = array('error' => 'That theme does not exist.');
        exit(json_encode($json));
    }
    // save the new theme
    $user->setThemeID($theme->getID());
    $user->save();
    // send us back
    Session::setMessage("Theme changed.");
    $json = array('success' => '1');
    echo json_encode($json);
} elseif ($action == 'notification') {
    $notificationType = Filter::alphanum($_POST['notificationType']);
    $notificationValue = Filter::alphanum($_POST['notificationValue']);
    // convert checkbox value to database-friendly 1 or 0
    $value = $notificationValue == 'notify' ? 1 : 0;
    // figure out which User setter to use based on notification type
    switch ($notificationType) {
        case 'chkCommentTaskLeading':
            $user->setNotifyCommentTaskLeading($value);
            break;
 /**
  * Loads a partial view from a FTL tag
  * Callback function linked to the tag <ion:partial />
  * 
  * @param	FTL_Binding		The binded tag to parse
  *
  */
 public static function tag_partial($tag)
 {
     // Compatibility reason
     $view = !empty($tag->attr['view']) ? $tag->attr['view'] : NULL;
     if (is_null($view)) {
         $view = !empty($tag->attr['path']) ? $tag->attr['path'] : NULL;
     }
     if (!is_null($view)) {
         if (isset($tag->attr['php']) && $tag->attr['php'] == 'true') {
             $data = !empty($tag->attr['data']) ? $tag->attr['data'] : array();
             return self::$ci->load->view($view, $data, true);
         } else {
             $file = Theme::load($view);
             return $tag->parse_as_nested($file);
         }
     } else {
         show_error('TagManager : Please use the attribute <b>"view"</b> when using the tag <b>partial</b>');
     }
 }
Пример #4
0
 public function load()
 {
     $this->css('style')->js('dungeon');
     return parent::load();
 }
Пример #5
0
 * Tags: HTML5, Advanced Confiuration, prettyPhoto, Slider.
 * Version: 2.2.0
 * Author: Chema <*****@*****.**>
 * License: GPL v3
 */
/**
 * placeholders & widgets for this theme
 */
Widgets::$theme_placeholders = array('header', 'sidebar', 'footer');
/**
 * custom options for the theme
 * @var array
 */
Theme::$options = Theme::get_options();
//we load earlier the theme since we need some info
Theme::load();
//local files
$theme_css = array('//cdn.jsdelivr.net/bootswatch/3.3.6/yeti/bootstrap.min.css' => 'screen', '//cdn.jsdelivr.net/fontawesome/4.5.0/css/font-awesome.min.css' => 'screen', '//cdn.jsdelivr.net/chosen/1.0.0/chosen.css' => 'screen', '//cdn.jsdelivr.net/prettyphoto/3.1.5/css/prettyPhoto.css' => 'screen', 'css/style.css?v=' . Core::VERSION => 'screen', 'css/yeti-style.css' => 'screen', 'css/slider.css' => 'screen');
if (Theme::get('rtl')) {
    $theme_css = array_merge($theme_css, array('css/bootstrap-rtl.min.css' => 'screen'));
}
Theme::$styles = $theme_css;
Theme::$scripts['footer'] = array('//code.jquery.com/jquery-1.10.2.min.js', '//cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js', '//cdn.jsdelivr.net/prettyphoto/3.1.5/js/jquery.prettyPhoto.js', '//cdn.jsdelivr.net/chosen/1.0.0/chosen.jquery.min.js', Route::url('jslocalization', array('controller' => 'jslocalization', 'action' => 'chosen')), 'js/bootstrap-slider.js', 'js/jquery.validate.min.js', Route::url('jslocalization', array('controller' => 'jslocalization', 'action' => 'validate')), 'js/theme.init.js?v=' . Core::VERSION);
/**
 * custom error alerts
 */
Form::$errors_tpl = '<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a>
                        <h4 class="alert-heading">%s</h4>
                        <ul>%s</ul></div>';
Form::$error_tpl = '<div class="alert"><a class="close" data-dismiss="alert">×</a>%s</div>';
Alert::$tpl = '<div class="alert alert-%s">
Пример #6
0
if (Session::isLoggedIn()) {
    $user = Session::getUser();
    // update last login
    $user->setLastLogin(date("Y-m-d H:i:s"));
    $user->save();
    // load unread messages
    $numUnread = $user->getNumUnreadMessages();
    // load custom theme, if specified
    if ($user->getThemeID() != null) {
        $theme = Theme::load($user->getThemeID());
    } else {
        $theme = Theme::load(DEFAULT_THEME_ID);
        // load default theme
    }
} else {
    $theme = Theme::load(DEFAULT_THEME_ID);
    // load default theme
}
// set up stylesheet variables
$jqueryuiStylesheet = $theme->getJqueryuiStylesheet();
$pipelineStylesheet = $theme->getPipelineStylesheet();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title><?php 
echo PIPELINE_NAME;
?>
 - <?php 
echo $pageTitle;
?>
Пример #7
0
 /**
  * Loads a partial view from a FTL tag
  * Callback function linked to the tag <ion:partial />
  *
  * @param	FTL_Binding
  * @return 	string
  *
  */
 public static function tag_partial(FTL_Binding $tag)
 {
     // Set this tag as "process tag"
     $tag->setAsProcessTag();
     $view = $tag->getAttribute('view');
     // Compatibility reason
     if (is_null($view)) {
         $tag->getAttribute('path');
     }
     if (!is_null($view)) {
         $attributes = $tag->getAttributes();
         foreach ($attributes as $key => $value) {
             self::register($key, $value, 'attr');
         }
         if ($tag->getAttribute('php') == TRUE) {
             $data = $tag->getAttribute('data', array());
             return self::$ci->load->view($view, $data, TRUE);
         } else {
             $file = Theme::load($view);
             return $tag->parse_as_nested($file);
         }
     } else {
         show_error('TagManager : Please use the attribute <b>"view"</b> when using the tag <b>partial</b>');
     }
 }
Пример #8
0
 /**
  * theme selector
  * @return [view] 
  */
 public function action_license()
 {
     $theme = $this->request->param('id', Theme::$theme);
     // save only changed values
     if (core::request('license')) {
         if (Theme::license(core::request('license'), $theme) == TRUE) {
             //activating a mobile theme
             if (in_array($theme, array_keys(Theme::get_installed_themes(TRUE)))) {
                 Theme::set_mobile_theme($theme);
             } else {
                 Theme::set_theme($theme);
             }
             Theme::$options = Theme::get_options($theme);
             Theme::load($theme);
             Theme::$data['license'] = core::request('license');
             Theme::$data['license_date'] = time() + 7 * 24 * 60 * 60;
             Theme::save($theme);
             Alert::set(Alert::SUCCESS, __('Theme activated, thanks.'));
             $this->redirect(Route::url('oc-panel', array('controller' => 'theme', 'action' => 'options')));
         } else {
             Alert::set(Alert::INFO, __('There was an error activating your license.'));
         }
     }
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Theme License')));
     $this->template->title = __('Theme License');
     $this->template->scripts['footer'][] = 'js/oc-panel/license.js';
     $this->template->content = View::factory('oc-panel/pages/themes/license', array('theme' => Theme::$theme));
 }
Пример #9
0
<?php

namespace Rarst\Hybrid_Wing;

if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    require __DIR__ . '/vendor/autoload.php';
}
global $hybrid_wing;
$hybrid_wing = new Theme();
$hybrid_wing->load();
 /**
  * read all themes
  *
  * @return bool true
  * @access public
  */
 public function loadThemes()
 {
     $this->themes = array();
     if (false === ($handleThemes = opendir($this->getThemesPath()))) {
         trigger_error('phpMyAdmin-ERROR: cannot open themes folder: ' . $this->getThemesPath(), E_USER_WARNING);
         return false;
     }
     // check for themes directory
     while (false !== ($PMA_Theme = readdir($handleThemes))) {
         // Skip non dirs, . and ..
         if ($PMA_Theme == '.' || $PMA_Theme == '..' || !is_dir($this->getThemesPath() . '/' . $PMA_Theme)) {
             continue;
         }
         if (array_key_exists($PMA_Theme, $this->themes)) {
             continue;
         }
         $new_theme = Theme::load($this->getThemesPath() . '/' . $PMA_Theme);
         if ($new_theme) {
             $new_theme->setId($PMA_Theme);
             $this->themes[$PMA_Theme] = $new_theme;
         }
     }
     // end get themes
     closedir($handleThemes);
     ksort($this->themes);
     return true;
 }
Пример #11
0
 /**
  * Sends Emails as defined in the forms.php config file.
  * Important : This method receives the "form" tag
  *
  * @param FTL_Binding	Form tag
  * @param string
  * @param array       	Array of data send to the Email view.
  * 						Each key of this array will be available in the view by :
  * 						<ion:data:key />
  *
  * 						The passed array should look like this :
  * 						array(
  * 							'email' => 'user email',		// Email of the user (POST, DB...)
  * 							'key1' => 'value1,				// Makes <ion:data:key1 /> available in the Email view
  * 						);
  *
  */
 public static function send_form_emails(FTL_Binding $tag, $form_name, $data = array())
 {
     // Set the 'data' tag from the received data array
     self::$context->define_tag('data', array(__CLASS__, 'tag_expand'));
     foreach ($data as $key => $value) {
         if (!is_array($value) && !is_object($value)) {
             self::$context->define_tag('data:' . $key, array(__CLASS__, 'tag_simple_value'));
         }
     }
     // Get all declared emails configuration data from forms.php config file
     $emails = TagManager_Form::get_form_emails($form_name);
     // Get the 'sender' email : Must be set in Ionize : Settings > Advanced settings > Email
     $website_email = Settings::get('site_email') ? Settings::get('site_email') : NULL;
     // Send all defined emails
     foreach ($emails as $email_setting) {
         $email = $email_setting['email'];
         $reply_to = isset($email_setting['reply_to']) ? $email_setting['reply_to'] : NULL;
         // Get potential website / form email
         switch ($email) {
             case 'site':
                 $email = Settings::get('site_email') != '' ? Settings::get('site_email') : NULL;
                 break;
             case 'form':
                 $email = isset($data['email']) ? $data['email'] : self::$ci->input->post('email');
                 break;
             case $email == 'contact' || $email == 'technical' || $email == 'info':
                 $email = Settings::get('email_' . $email) != '' ? Settings::get('email_' . $email) : NULL;
                 break;
             default:
                 $email = $email;
                 $_email = explode('::', $email);
                 if (!empty($_email[1])) {
                     $email = self::$ci->input->post($_email[1]);
                 }
                 break;
         }
         if (!is_null($reply_to)) {
             switch ($reply_to) {
                 case 'site':
                     $reply_to = Settings::get('site_email') != '' ? Settings::get('site_email') : NULL;
                     break;
                 case 'form':
                     $reply_to = isset($data['email']) ? $data['email'] : self::$ci->input->post('email');
                     break;
                 default:
                     $reply_to = Settings::get('email_' . $email) != '' ? Settings::get('email_' . $email) : NULL;
                     break;
             }
         }
         // Send the email
         if ($email) {
             // Subject, adds the website title as swap text : displayed in title if the %s key is used.
             $subject = lang($email_setting['subject'], Settings::get('site_title'));
             $data['subject'] = $subject;
             // Set the "data tag" array of data.
             $tag->set('data', $data);
             // Email Lib
             if (!isset(self::$ci->email)) {
                 self::$ci->load->library('email');
             }
             self::$ci->email->clear();
             // Subject / From / To
             self::$ci->email->subject($subject);
             self::$ci->email->from($website_email, Settings::get("site_title"));
             self::$ci->email->to($email);
             if (!is_null($reply_to)) {
                 self::$ci->email->reply_to($reply_to);
             }
             // View & Message content
             $view_content = $tag->parse_as_standalone(self::$tag_prefix, Theme::load($email_setting['view']));
             self::$ci->email->message($view_content);
             // Send silently
             $result = @self::$ci->email->send();
             if (!$result) {
                 log_message('error', 'Error : Tagmanager/Email->send_form_emails() : Email was not sent.');
             }
         } else {
             log_message('error', 'Error : Tagmanager/Email->send_form_emails() : Email not found');
         }
     }
 }