예제 #1
0
파일: page.php 프로젝트: acharei/OSClass
 function doModel()
 {
     $id = Params::getParam('id');
     $page = $this->pageManager->findByPrimaryKey($id);
     if ($page == false) {
         $this->do404();
         return;
     }
     if ($page['b_indelible'] == 1) {
         $this->do404();
         return;
     }
     if (file_exists(osc_themes_path() . osc_theme() . '/' . $page['s_internal_name'] . ".php")) {
         $this->doView($page['s_internal_name'] . ".php");
     } else {
         if (file_exists(osc_themes_path() . osc_theme() . '/pages/' . $page['s_internal_name'] . ".php")) {
             $this->doView("pages/" . $page['s_internal_name'] . ".php");
         } else {
             if (Params::getParam('lang') != '') {
                 Session::newInstance()->_set('userLocale', Params::getParam('lang'));
             }
             $this->_exportVariableToView('page', $page);
             $this->doView('page.php');
         }
     }
 }
예제 #2
0
 function doModel()
 {
     $id = Params::getParam('id');
     $page = false;
     if (is_numeric($id)) {
         $page = $this->pageManager->findByPrimaryKey($id);
     } else {
         $page = $this->pageManager->findByInternalName(Params::getParam('slug'));
     }
     // page not found
     if ($page == false) {
         $this->do404();
         return;
     }
     // this page shouldn't be shown (i.e.: e-mail templates)
     if ($page['b_indelible'] == 1) {
         $this->do404();
         return;
     }
     // export $page content to View
     $this->_exportVariableToView('page', $page);
     if (Params::getParam('lang') != '') {
         Session::newInstance()->_set('userLocale', Params::getParam('lang'));
     }
     // load the right template file
     if (file_exists(osc_themes_path() . osc_theme() . '/page-' . $page['s_internal_name'] . '.php')) {
         $this->doView('page-' . $page['s_internal_name'] . '.php');
     } else {
         $this->doView('page.php');
     }
 }
예제 #3
0
        public function __construct()
        {
            parent::__construct();
            $this->path = osc_themes_path();

            if( Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '' ) {
                $this->setCurrentTheme( Params::getParam('theme') );
            } else {
                $this->setCurrentTheme( osc_theme() );
            }

            $functions_path = $this->getCurrentThemePath() . 'functions.php';
            if( file_exists($functions_path) ) {
                require_once $functions_path;
            }

            $info = $this->loadThemeInfo($this->theme);
            if($info['template'] != '' ) {
				//$this->setCurrentTheme($info['template']);
				$parent_functions_path = osc_base_path() . 'oc-content/themes/' . $info['template'] . '/functions.php';
				if( file_exists($parent_functions_path) ) {
					require_once $parent_functions_path;
				}
			}
        }
예제 #4
0
파일: WebThemes.php 프로젝트: semul/Osclass
 public function __construct()
 {
     $this->path = osc_themes_path();
     if (Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '') {
         $this->setCurrentTheme(Params::getParam('theme'));
     } else {
         $this->setCurrentTheme(osc_theme());
     }
     $functions_path = $this->getCurrentThemePath() . 'functions.php';
     if (file_exists($functions_path)) {
         require_once $functions_path;
     }
 }
예제 #5
0
 public function __construct()
 {
     //#dev.conquer this fix is needed for the preview of appearance in oc-admin
     if (Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '') {
         $this->setCurrentTheme(Params::getParam('theme'));
     } else {
         $this->setCurrentTheme(osc_theme());
     }
     //#juanramon: check if exists functions.php
     $functions_path = $this->getCurrentThemePath() . 'functions.php';
     if (file_exists($functions_path)) {
         require_once $functions_path;
     }
 }
예제 #6
0
파일: page.php 프로젝트: jmcclenon/Osclass
 function doModel()
 {
     $id = Params::getParam('id');
     $page = false;
     if (is_numeric($id)) {
         $page = $this->pageManager->findByPrimaryKey($id);
     } else {
         $page = $this->pageManager->findByInternalName(Params::getParam('slug'));
     }
     // page not found
     if ($page == false) {
         $this->do404();
         return;
     }
     // this page shouldn't be shown (i.e.: e-mail templates)
     if ($page['b_indelible'] == 1) {
         $this->do404();
         return;
     }
     $kwords = array('{WEB_URL}', '{WEB_TITLE}');
     $rwords = array(osc_base_url(), osc_page_title());
     foreach ($page['locale'] as $k => $v) {
         $page['locale'][$k]['s_title'] = str_ireplace($kwords, $rwords, osc_apply_filter('email_description', $v['s_title']));
         $page['locale'][$k]['s_text'] = str_ireplace($kwords, $rwords, osc_apply_filter('email_description', $v['s_text']));
     }
     // export $page content to View
     $this->_exportVariableToView('page', $page);
     if (Params::getParam('lang') != '') {
         Session::newInstance()->_set('userLocale', Params::getParam('lang'));
     }
     $meta = json_decode($page['s_meta'], true);
     // load the right template file
     if (file_exists(osc_themes_path() . osc_theme() . '/page-' . $page['s_internal_name'] . '.php')) {
         $this->doView('page-' . $page['s_internal_name'] . '.php');
     } else {
         if (isset($meta['template']) && file_exists(osc_themes_path() . osc_theme() . '/' . $meta['template'])) {
             $this->doView($meta['template']);
         } else {
             if (isset($meta['template']) && file_exists(osc_plugins_path() . '/' . $meta['template'])) {
                 osc_run_hook('before_html');
                 require osc_plugins_path() . '/' . $meta['template'];
                 Session::newInstance()->_clearVariables();
                 osc_run_hook('after_html');
             } else {
                 $this->doView('page.php');
             }
         }
     }
 }
예제 #7
0
/**
 * Render the specified file
 *
 * @param string $file must be a relative path, from PLUGINS_PATH
 */
function osc_render_file($file = '')
{
    if ($file == '') {
        $file = __get('file');
    }
    // Clean $file to prevent hacking of some type
    osc_sanitize_url($file);
    $file = str_replace("../", "", str_replace("..\\", "", str_replace("://", "", preg_replace("|http([s]*)|", "", $file))));
    if (file_exists(osc_theme() . $file)) {
        include osc_themes_path() . $file;
    } else {
        if (file_exists(osc_plugins_path() . $file)) {
            include osc_plugins_path() . $file;
        }
    }
}
예제 #8
0
 function __construct($install = false)
 {
     if (!$install) {
         // get user/admin locale
         if (OC_ADMIN) {
             $locale = osc_current_admin_locale();
         } else {
             $locale = osc_current_user_locale();
         }
         // load core
         $core_file = osc_translations_path() . $locale . '/core.mo';
         $this->_load($core_file, 'core');
         // load messages
         $messages_file = osc_themes_path() . osc_theme() . '/languages/' . $locale . '/messages.mo';
         if (!file_exists($messages_file)) {
             $messages_file = osc_translations_path() . $locale . '/messages.mo';
         }
         $this->_load($messages_file, 'messages');
         // load theme
         $domain = osc_theme();
         $theme_file = osc_themes_path() . $domain . '/languages/' . $locale . '/theme.mo';
         if (!file_exists($theme_file)) {
             if (!file_exists(osc_themes_path() . $domain)) {
                 $domain = 'modern';
             }
             $theme_file = osc_translations_path() . $locale . '/theme.mo';
         }
         $this->_load($theme_file, $domain);
         // load plugins
         $aPlugins = Plugins::listInstalled();
         foreach ($aPlugins as $plugin) {
             $domain = preg_replace('|/.*|', '', $plugin);
             $plugin_file = osc_plugins_path() . $domain . '/languages/' . $locale . '/messages.mo';
             if (file_exists($plugin_file)) {
                 $this->_load($plugin_file, $domain);
             }
         }
     } else {
         $core_file = osc_translations_path() . osc_current_admin_locale() . '/core.mo';
         $this->_load($core_file, 'core');
     }
 }
예제 #9
0
파일: index.php 프로젝트: mylastof/os-class
                        <div class="clear"></div>
                    </div>
                </div>
                <h2 class="render-title"><?php 
_e('Available themes');
?>
</h2>
                <div class="available-theme">
                    <?php 
$aThemesToUpdate = json_decode(osc_get_preference('themes_to_update'));
$bThemesToUpdate = is_array($aThemesToUpdate) ? true : false;
$csrf_token = osc_csrf_token_url();
foreach ($themes as $theme) {
    ?>
                    <?php 
    if ($theme == osc_theme()) {
        continue;
    }
    $info = WebThemes::newInstance()->loadThemeInfo($theme);
    ?>
                    <div class="theme">
                        <div class="theme-stage">
                            <img src="<?php 
    echo osc_base_url();
    ?>
/oc-content/themes/<?php 
    echo $theme;
    ?>
/screenshot.png" title="<?php 
    echo $info['name'];
    ?>
예제 #10
0
 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'add':
             $this->doView("appearance/add.php");
             break;
         case 'add_post':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action cannot be done because is a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=appearance');
             }
             $filePackage = Params::getFiles('package');
             if (isset($filePackage['size']) && $filePackage['size'] != 0) {
                 $path = osc_themes_path();
                 (int) ($status = osc_unzip_file($filePackage['tmp_name'], $path));
             } else {
                 $status = 3;
             }
             switch ($status) {
                 case 0:
                     $msg = _m('The theme folder is not writable');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
                 case 1:
                     $msg = _m('The theme has been installed correctly');
                     osc_add_flash_ok_message($msg, 'admin');
                     break;
                 case 2:
                     $msg = _m('The zip file is not valid');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
                 case 3:
                     $msg = _m('No file was uploaded');
                     osc_add_flash_error_message($msg, 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=add");
                     break;
                 case -1:
                 default:
                     $msg = _m('There was a problem adding the theme');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
         case 'widgets':
             $info = WebThemes::newInstance()->loadThemeInfo(osc_theme());
             $this->_exportVariableToView("info", $info);
             $this->doView('appearance/widgets.php');
             break;
         case 'add_widget':
             $this->doView('appearance/add_widget.php');
             break;
         case 'edit_widget':
             $id = Params::getParam('id');
             $widget = Widget::newInstance()->findByPrimaryKey($id);
             $this->_exportVariableToView("widget", $widget);
             $this->doView('appearance/add_widget.php');
             break;
         case 'delete_widget':
             Widget::newInstance()->delete(array('pk_i_id' => Params::getParam('id')));
             osc_add_flash_ok_message(_m('Widget removed correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'edit_widget_post':
             if (!osc_validate_text(Params::getParam("description"))) {
                 osc_add_flash_error_message(_m('Description field is required'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             }
             $res = Widget::newInstance()->update(array('s_description' => Params::getParam('description'), 's_content' => Params::getParam('content', false, false)), array('pk_i_id' => Params::getParam('id')));
             if ($res) {
                 osc_add_flash_ok_message(_m('Widget updated correctly'), 'admin');
             } else {
                 osc_add_flash_ok_message(_m('Widget cannot be updated correctly'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'add_widget_post':
             if (!osc_validate_text(Params::getParam("description"))) {
                 osc_add_flash_error_message(_m('Description field is required'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             }
             Widget::newInstance()->insert(array('s_location' => Params::getParam('location'), 'e_kind' => 'html', 's_description' => Params::getParam('description'), 's_content' => Params::getParam('content', false, false)));
             osc_add_flash_ok_message(_m('Widget added correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'activate':
             Preference::newInstance()->update(array('s_value' => Params::getParam('theme')), array('s_section' => 'osclass', 's_name' => 'theme'));
             osc_add_flash_ok_message(_m('Theme activated correctly'), 'admin');
             osc_run_hook("theme_activate", Params::getParam('theme'));
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
         default:
             $themes = WebThemes::newInstance()->getListThemes();
             $info = WebThemes::newInstance()->loadThemeInfo(osc_theme());
             //preparing variables for the view
             $this->_exportVariableToView("themes", $themes);
             $this->_exportVariableToView("info", $info);
             $this->doView('appearance/index.php');
     }
 }
예제 #11
0
 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'add':
             $this->doView("appearance/add.php");
             break;
         case 'add_post':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=appearance');
             }
             osc_csrf_check();
             $filePackage = Params::getFiles('package');
             if (isset($filePackage['size']) && $filePackage['size'] != 0) {
                 $path = osc_themes_path();
                 (int) ($status = osc_unzip_file($filePackage['tmp_name'], $path));
                 @unlink($filePackage['tmp_name']);
             } else {
                 $status = 3;
             }
             switch ($status) {
                 case 0:
                     $msg = _m('The theme folder is not writable');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
                 case 1:
                     $msg = _m('The theme has been installed correctly');
                     osc_add_flash_ok_message($msg, 'admin');
                     break;
                 case 2:
                     $msg = _m('The zip file is not valid');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
                 case 3:
                     $msg = _m('No file was uploaded');
                     osc_add_flash_error_message($msg, 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=add");
                     break;
                 case -1:
                 default:
                     $msg = _m('There was a problem adding the theme');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
         case 'delete':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=appearance');
             }
             osc_csrf_check();
             $theme = Params::getParam('webtheme');
             if ($theme != '') {
                 if ($theme != osc_current_web_theme()) {
                     if (file_exists(osc_content_path() . "themes/" . $theme . "/functions.php")) {
                         include osc_content_path() . "themes/" . $theme . "/functions.php";
                     }
                     osc_run_hook("theme_delete_" . $theme);
                     if (osc_deleteDir(osc_content_path() . "themes/" . $theme . "/")) {
                         osc_add_flash_ok_message(_m("Theme removed successfully"), "admin");
                     } else {
                         osc_add_flash_error_message(_m("There was a problem removing the theme"), "admin");
                     }
                 } else {
                     osc_add_flash_error_message(_m("Current theme can not be deleted"), "admin");
                 }
             } else {
                 osc_add_flash_error_message(_m("No theme selected"), "admin");
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
             /* widgets */
         /* widgets */
         case 'widgets':
             $info = WebThemes::newInstance()->loadThemeInfo(osc_theme());
             $this->_exportVariableToView("info", $info);
             $this->doView('appearance/widgets.php');
             break;
         case 'add_widget':
             $this->doView('appearance/add_widget.php');
             break;
         case 'edit_widget':
             $id = Params::getParam('id');
             $widget = Widget::newInstance()->findByPrimaryKey($id);
             $this->_exportVariableToView("widget", $widget);
             $this->doView('appearance/add_widget.php');
             break;
         case 'delete_widget':
             osc_csrf_check();
             Widget::newInstance()->delete(array('pk_i_id' => Params::getParam('id')));
             osc_add_flash_ok_message(_m('Widget removed correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'edit_widget_post':
             osc_csrf_check();
             if (!osc_validate_text(Params::getParam("description"))) {
                 osc_add_flash_error_message(_m('Description field is required'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             }
             $res = Widget::newInstance()->update(array('s_description' => Params::getParam('description'), 's_content' => Params::getParam('content', false, false)), array('pk_i_id' => Params::getParam('id')));
             if ($res) {
                 osc_add_flash_ok_message(_m('Widget updated correctly'), 'admin');
             } else {
                 osc_add_flash_error_message(_m('Widget cannot be updated correctly'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'add_widget_post':
             osc_csrf_check();
             if (!osc_validate_text(Params::getParam("description"))) {
                 osc_add_flash_error_message(_m('Description field is required'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             }
             Widget::newInstance()->insert(array('s_location' => Params::getParam('location'), 'e_kind' => 'html', 's_description' => Params::getParam('description'), 's_content' => Params::getParam('content', false, false)));
             osc_add_flash_ok_message(_m('Widget added correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
             /* /widget */
         /* /widget */
         case 'activate':
             osc_csrf_check();
             osc_set_preference('theme', Params::getParam('theme'));
             osc_add_flash_ok_message(_m('Theme activated correctly'), 'admin');
             osc_run_hook("theme_activate", Params::getParam('theme'));
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
         case 'render':
             if (Params::existParam('route')) {
                 $routes = Rewrite::newInstance()->getRoutes();
                 $rid = Params::getParam('route');
                 $file = '../';
                 if (isset($routes[$rid]) && isset($routes[$rid]['file'])) {
                     $file = $routes[$rid]['file'];
                 }
             } else {
                 // DEPRECATED: Disclosed path in URL is deprecated, use routes instead
                 // This will be REMOVED in 3.6
                 $file = Params::getParam('file');
                 // We pass the GET variables (in case we have somes)
                 if (preg_match('|(.+?)\\?(.*)|', $file, $match)) {
                     $file = $match[1];
                     if (preg_match_all('|&([^=]+)=([^&]*)|', urldecode('&' . $match[2] . '&'), $get_vars)) {
                         for ($var_k = 0; $var_k < count($get_vars[1]); $var_k++) {
                             Params::setParam($get_vars[1][$var_k], $get_vars[2][$var_k]);
                         }
                     }
                 } else {
                     $file = Params::getParam('file');
                 }
             }
             if (strpos($file, '../') !== false || strpos($file, '..\\') !== false || !file_exists(osc_base_path() . $file)) {
                 osc_add_flash_warning_message(__('Error loading theme custom file'), 'admin');
             }
             $this->_exportVariableToView('file', osc_base_path() . $file);
             $this->doView('appearance/view.php');
             break;
         default:
             if (Params::getParam('checkUpdated') != '') {
                 osc_admin_toolbar_update_themes(true);
             }
             $themes = WebThemes::newInstance()->getListThemes();
             //preparing variables for the view
             $this->_exportVariableToView("themes", $themes);
             $this->doView('appearance/index.php');
             break;
     }
 }
예제 #12
0
 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'add':
             $this->doView("appearance/add.php");
             break;
         case 'add_post':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=appearance');
             }
             osc_csrf_check();
             $filePackage = Params::getFiles('package');
             if (isset($filePackage['size']) && $filePackage['size'] != 0) {
                 $path = osc_themes_path();
                 (int) ($status = osc_unzip_file($filePackage['tmp_name'], $path));
             } else {
                 $status = 3;
             }
             switch ($status) {
                 case 0:
                     $msg = _m('The theme folder is not writable');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
                 case 1:
                     $msg = _m('The theme has been installed correctly');
                     osc_add_flash_ok_message($msg, 'admin');
                     break;
                 case 2:
                     $msg = _m('The zip file is not valid');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
                 case 3:
                     $msg = _m('No file was uploaded');
                     osc_add_flash_error_message($msg, 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=add");
                     break;
                 case -1:
                 default:
                     $msg = _m('There was a problem adding the theme');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
         case 'delete':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=appearance');
             }
             osc_csrf_check();
             $theme = Params::getParam('webtheme');
             if ($theme != '') {
                 if ($theme != osc_current_web_theme()) {
                     if (osc_deleteDir(osc_content_path() . "themes/" . $theme . "/")) {
                         osc_add_flash_ok_message(_m("Theme removed successfully"), "admin");
                     } else {
                         osc_add_flash_error_message(_m("There was a problem removing the theme"), "admin");
                     }
                 } else {
                     osc_add_flash_error_message(_m("Current theme can not be deleted"), "admin");
                 }
             } else {
                 osc_add_flash_error_message(_m("No theme selected"), "admin");
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
             /* widgets */
         /* widgets */
         case 'widgets':
             $info = WebThemes::newInstance()->loadThemeInfo(osc_theme());
             $this->_exportVariableToView("info", $info);
             $this->doView('appearance/widgets.php');
             break;
         case 'add_widget':
             $this->doView('appearance/add_widget.php');
             break;
         case 'edit_widget':
             $id = Params::getParam('id');
             $widget = Widget::newInstance()->findByPrimaryKey($id);
             $this->_exportVariableToView("widget", $widget);
             $this->doView('appearance/add_widget.php');
             break;
         case 'delete_widget':
             osc_csrf_check();
             Widget::newInstance()->delete(array('pk_i_id' => Params::getParam('id')));
             osc_add_flash_ok_message(_m('Widget removed correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'edit_widget_post':
             osc_csrf_check();
             if (!osc_validate_text(Params::getParam("description"))) {
                 osc_add_flash_error_message(_m('Description field is required'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             }
             $res = Widget::newInstance()->update(array('s_description' => Params::getParam('description'), 's_content' => Params::getParam('content', false, false)), array('pk_i_id' => Params::getParam('id')));
             if ($res) {
                 osc_add_flash_ok_message(_m('Widget updated correctly'), 'admin');
             } else {
                 osc_add_flash_ok_message(_m('Widget cannot be updated correctly'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'add_widget_post':
             osc_csrf_check();
             if (!osc_validate_text(Params::getParam("description"))) {
                 osc_add_flash_error_message(_m('Description field is required'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             }
             Widget::newInstance()->insert(array('s_location' => Params::getParam('location'), 'e_kind' => 'html', 's_description' => Params::getParam('description'), 's_content' => Params::getParam('content', false, false)));
             osc_add_flash_ok_message(_m('Widget added correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
             /* /widget */
         /* /widget */
         case 'activate':
             osc_csrf_check();
             Preference::newInstance()->update(array('s_value' => Params::getParam('theme')), array('s_section' => 'osclass', 's_name' => 'theme'));
             osc_add_flash_ok_message(_m('Theme activated correctly'), 'admin');
             osc_run_hook("theme_activate", Params::getParam('theme'));
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
         case 'render':
             $this->_exportVariableToView('file', osc_base_path() . Params::getParam("file"));
             $this->doView('appearance/view.php');
             break;
         default:
             //                    $marketError = Params::getParam('marketError');
             //                    $slug = Params::getParam('slug');
             //                    if($marketError!='') {
             //                        if($marketError == '0') { // no error installed ok
             //                            $help = '<br/><br/><b>' . __('You only need to activate or preview the theme').'</b>';
             //                            osc_add_flash_ok_message( __('Everything was OK!') . ' ( ' . $slug .' ) ' . $help, 'admin');
             //                        } else {
             //                            osc_add_flash_error_message( __('Error occurred') . ' ( ' . $slug .' ) ', 'admin');
             //                        }
             //                    }
             // force the recount of themes that need to be updated
             if (Params::getParam('checkUpdated') != '') {
                 osc_admin_toolbar_update_themes(true);
             }
             $themes = WebThemes::newInstance()->getListThemes();
             //preparing variables for the view
             $this->_exportVariableToView("themes", $themes);
             $this->doView('appearance/index.php');
             break;
     }
 }
예제 #13
0
 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'add':
             $this->doView("appearance/add.php");
             break;
         case 'add_post':
             $filePackage = Params::getFiles('package');
             $path = osc_themes_path();
             (int) ($status = osc_unzip_file($filePackage['tmp_name'], $path));
             switch ($status) {
                 case 0:
                     $msg = _m('The theme folder is not writable');
                     break;
                 case 1:
                     $msg = _m('The theme has been installed correctly');
                     break;
                 case 2:
                     $msg = _m('The zip file is not valid');
                     break;
                 case -1:
                 default:
                     $msg = _m('There was a problem adding the theme');
                     break;
             }
             osc_add_flash_message($msg, 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
             /*case 'delete':
                   $themes = Params::getParam('theme') ;
                   if ( isset( $themes ) && is_array( $themes ) ) {
                       foreach ($themes as $theme) {
                           if (!osc_deleteDir(THEMES_PATH . $theme))
                               osc_add_flash_message( _m('Directory "%s" can\'t be removed'), $theme);
                       }
                   } else if (isset( $themes )) {
                       if (!osc_deleteDir(THEMES_PATH . $themes)){
                           osc_add_flash_message( _m('Directory "%s" can\'t be removed'), $themes);
                       }
                   } else {
                       osc_add_flash_message( _m('No theme selected'));
                   }
                   $this->redirectTo( osc_admin_base_url(true) . "?page=appearance" );
               break;*/
         /*case 'delete':
               $themes = Params::getParam('theme') ;
               if ( isset( $themes ) && is_array( $themes ) ) {
                   foreach ($themes as $theme) {
                       if (!osc_deleteDir(THEMES_PATH . $theme))
                           osc_add_flash_message( _m('Directory "%s" can\'t be removed'), $theme);
                   }
               } else if (isset( $themes )) {
                   if (!osc_deleteDir(THEMES_PATH . $themes)){
                       osc_add_flash_message( _m('Directory "%s" can\'t be removed'), $themes);
                   }
               } else {
                   osc_add_flash_message( _m('No theme selected'));
               }
               $this->redirectTo( osc_admin_base_url(true) . "?page=appearance" );
           break;*/
         case 'widgets':
             $info = WebThemes::newInstance()->loadThemeInfo(osc_theme());
             $this->_exportVariableToView("info", $info);
             $this->doView('appearance/widgets.php');
             break;
         case 'add_widget':
             $this->doView('appearance/add_widget.php');
             break;
         case 'delete_widget':
             Widget::newInstance()->delete(array('pk_i_id' => Params::getParam('id')));
             osc_add_flash_message(_m('Widget removed correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'add_widget_post':
             Widget::newInstance()->insert(array('s_location' => Params::getParam('location'), 'e_kind' => 'html', 's_description' => Params::getParam('description'), 's_content' => Params::getParam('content')));
             osc_add_flash_message(_m('Widget added correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance&action=widgets");
             break;
         case 'activate':
             Preference::newInstance()->update(array('s_value' => Params::getParam('theme')), array('s_section' => 'osclass', 's_name' => 'theme'));
             osc_add_flash_message(_m('Theme activated correctly'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . "?page=appearance");
             break;
         default:
             $themes = WebThemes::newInstance()->getListThemes();
             $info = WebThemes::newInstance()->loadThemeInfo(osc_theme());
             //preparing variables for the view
             $this->_exportVariableToView("themes", $themes);
             $this->_exportVariableToView("info", $info);
             $this->doView('appearance/index.php');
     }
 }
예제 #14
0
_e('Available themes');
?>
</div>

                        <?php 
$i = 1;
$colnums = 2;
$c = 1;
?>

                        <div>
                            <?php 
foreach ($themes as $theme) {
    ?>
                                <?php 
    if ($theme != osc_theme()) {
        ?>
                                    <?php 
        $info = WebThemes::newInstance()->loadThemeInfo($theme);
        ?>
                                    <center>
                                        <div style="width: 49%; float: left; padding-top: 10px; padding-bottom: 20px; <?php 
        if ($c == 1) {
            ?>
 border-right: 1px solid #ccc;<?php 
        }
        ?>
">
                                            <div id="available_theme_info">
                                                <strong><?php 
        echo $info['name'];
예제 #15
0
    if ($price == null) {
        return osc_apply_filter('item_price_null', __('Check with seller'));
    }
    if ($price == 0) {
        return osc_apply_filter('item_price_zero', __('Free'));
    }
    $price = $price / 1000000;
    $currencyFormat = osc_locale_currency_format();
    $currencyFormat = str_replace('{NUMBER}', number_format($price, osc_locale_num_dec(), osc_locale_dec_point(), osc_locale_thousands_sep()), $currencyFormat);
    $currencyFormat = str_replace('{CURRENCY}', osc_premium_currency_symbol(), $currencyFormat);
    return osc_apply_filter('item_price', $currencyFormat);
}
/**
THEME VERSION
**/
$info = WebThemes::newInstance()->loadThemeInfo(osc_theme());
/**
THEME SETTINGS BUTTONS
**/
function editBtn()
{
    ?>
 <script>
 $(document).ready(function(){
 $('.current-theme .theme-description').append("<br/><br/><a href='<?php 
    echo osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php');
    ?>
' class='btn btn-green'><?php 
    _e('Flatter Settings', 'flatter');
    ?>
</a> <a class='btn btn-blue' target='_blank' href='http://www.drizzledesigns.in/forums'><?php