function __construct() { // this is necessary because if HTTP_HOST doesn't have the PORT the parse_url is null $current_host = parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_HOST); if ($current_host === null) { $current_host = Params::getServerParam('HTTP_HOST'); } if (parse_url(osc_base_url(), PHP_URL_HOST) !== $current_host) { // first check if it's http or https $url = 'http://'; if (osc_is_ssl()) { $url = 'https://'; } // append the domain $url .= parse_url(osc_base_url(), PHP_URL_HOST); // append the port number if it's necessary $http_port = parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_PORT); if ($http_port !== 80) { $url .= ':' . parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_PORT); } // append the request $url .= Params::getServerParam('REQUEST_URI', false, false); $this->redirectTo($url); } $this->subdomain_params($current_host); $this->page = Params::getParam('page'); $this->action = Params::getParam('action'); $this->ajax = false; $this->time = list($sm, $ss) = explode(' ', microtime()); WebThemes::newInstance(); osc_run_hook('init'); }
function add_logo_header() { $html = '<img border="0" alt="' . osc_page_title() . '" src="' . osc_current_web_theme_url('images/logo.jpg') . '">'; $js = "<script>\n \$(document).ready(function () {\n \$('#logo').html('" . $html . "');\n });\n </script>"; if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { echo $js; } }
function __construct() { $this->action = Params::getParam('action'); $this->ajax = false; $this->time = list($sm, $ss) = explode(' ', microtime()); WebThemes::newInstance(); osc_run_hook('init'); }
function logo_header() { $html = '<img border="0" alt="' . osc_page_title() . '" src="' . osc_current_web_theme_url('images/logo.jpg') . '" />'; if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { return $html; } else { return osc_page_title(); } }
function logo_header() { $html = '<img style="border:0px" alt="' . osc_page_title() . '" src="' . osc_current_web_theme_url('images/logo.jpg') . '" />'; if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { return $html; } else { if (osc_get_preference('default_logo', 'classified') && file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/default-logo.jpg")) { return '<img style="border:0px" alt="' . osc_page_title() . '" src="' . osc_current_web_theme_url('images/default-logo.jpg') . '" />'; } else { return osc_page_title(); } } }
function __construct() { if (parse_url(WEB_PATH, PHP_URL_HOST) !== $_SERVER['HTTP_HOST']) { $url = 'http://'; if ($this->is_ssl()) { $url = 'https://'; } $url .= parse_url(WEB_PATH, PHP_URL_HOST) . $_SERVER['REQUEST_URI']; $this->redirectTo($url); } $this->page = Params::getParam('page'); $this->action = Params::getParam('action'); $this->ajax = false; $this->time = list($sm, $ss) = explode(' ', microtime()); WebThemes::newInstance(); osc_run_hook('init'); }
function getImage() { if (getUrl() == osc_base_url()) { if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { $image = osc_current_web_theme_url('images/logo.jpg'); } else { $image = osc_current_web_theme_url('images/default-logo.jpg'); } } else { if (osc_images_enabled_at_items()) { if (osc_count_item_resources() > 0) { $image = osc_resource_url(); } else { $image = osc_current_web_theme_url('images/logo.jpg'); } } else { $image = osc_current_web_theme_url('images/logo.jpg'); } } return $image; }
function _osc_check_themes_update() { $total = 0; $array = array(); $array_downloaded = array(); $themes = WebThemes::newInstance()->getListThemes(); foreach ($themes as $theme) { $info = WebThemes::newInstance()->loadThemeInfo($theme); if (osc_check_theme_update(@$info['theme_update_uri'], @$info['version'])) { $array[] = $theme; $total++; } $array_downloaded[] = @$info['theme_update_uri']; } osc_set_preference('themes_to_update', json_encode($array)); osc_set_preference('themes_downloaded', json_encode($array_downloaded)); osc_set_preference('themes_update_count', $total); osc_set_preference('themes_last_version_check', time()); osc_reset_preferences(); return $total; }
/** * Gets the complete path of a given js file using the theme path as a root * * @param string $file * @return string */ function osc_current_web_theme_js_url($file = '') { return WebThemes::newInstance()->getCurrentThemeJs() . $file; }
function osc_check_themes_update( $force = false ) { $total = 0; $array = array(); $array_downloaded = array(); // check if exist a new version each day if( (time() - osc_themes_last_version_check()) > (24 * 3600) || $force ) { $themes = WebThemes::newInstance()->getListThemes(); foreach($themes as $theme) { $info = WebThemes::newInstance()->loadThemeInfo($theme); if(osc_check_theme_update(@$info['theme_update_uri'], @$info['version'])) { $array[] = $theme; $total++; } $array_downloaded[] = @$info['theme_update_uri']; } osc_set_preference( 'themes_to_update', json_encode($array) ); osc_set_preference( 'themes_downloaded', json_encode($array_downloaded) ); osc_set_preference( 'themes_update_count', $total ); osc_set_preference( 'themes_last_version_check', time() ); osc_reset_preferences(); } else { $total = getPreference('themes_update_count'); } return $total; }
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'); } }
function doModel() { parent::doModel(); //specific things for this class switch ($this->action) { case 'edit': if (Params::getParam("id") == '') { $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); } $form = count(Session::newInstance()->_getForm()); $keepForm = count(Session::newInstance()->_getKeepForm()); if ($form == 0 || $form == $keepForm) { Session::newInstance()->_dropKeepForm(); } $this->_exportVariableToView("page", $this->pageManager->findByPrimaryKey(Params::getParam("id"))); $this->doView("pages/frm.php"); break; case 'edit_post': $id = Params::getParam("id"); $s_internal_name = Params::getParam("s_internal_name"); $s_internal_name = osc_sanitizeString($s_internal_name); $aFieldsDescription = array(); $postParams = Params::getParamsAsArray('', false); $not_empty = false; foreach ($postParams as $k => $v) { if (preg_match('|(.+?)#(.+)|', $k, $m)) { if ($m[2] == 's_title' && $v != '') { $not_empty = true; } $aFieldsDescription[$m[1]][$m[2]] = $v; } } Session::newInstance()->_setForm('aFieldsDescription', $aFieldsDescription); if ($s_internal_name == '') { osc_add_flash_error_message(_m('You have to set an internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id); } if (!WebThemes::newInstance()->isValidPage($s_internal_name)) { osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id); } Session::newInstance()->_setForm('s_internal_name', $s_internal_name); if ($not_empty) { foreach ($aFieldsDescription as $k => $_data) { $this->pageManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']); } if (!$this->pageManager->internalNameExists($id, $s_internal_name)) { if (!$this->pageManager->isIndelible($id)) { $this->pageManager->updateInternalName($id, $s_internal_name); } Session::newInstance()->_clearVariables(); osc_add_flash_ok_message(_m('The page has been updated'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); } osc_add_flash_error_message(_m("You can't repeat internal name"), 'admin'); } else { osc_add_flash_error_message(_m("The page couldn't be updated, at least one title should not be empty"), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id); break; case 'add': $form = count(Session::newInstance()->_getForm()); $keepForm = count(Session::newInstance()->_getKeepForm()); if ($form == 0 || $form == $keepForm) { Session::newInstance()->_dropKeepForm(); } $this->_exportVariableToView("page", array()); $this->doView("pages/frm.php"); break; case 'add_post': $s_internal_name = Params::getParam("s_internal_name"); $s_internal_name = osc_sanitizeString($s_internal_name); $aFieldsDescription = array(); $postParams = Params::getParamsAsArray('', false); $not_empty = false; foreach ($postParams as $k => $v) { if (preg_match('|(.+?)#(.+)|', $k, $m)) { if ($m[2] == 's_title' && $v != '') { $not_empty = true; } $aFieldsDescription[$m[1]][$m[2]] = $v; } } Session::newInstance()->_setForm('aFieldsDescription', $aFieldsDescription); if ($s_internal_name == '') { osc_add_flash_error_message(_m('You have to set an internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add"); } if (!WebThemes::newInstance()->isValidPage($s_internal_name)) { osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add"); } $aFields = array('s_internal_name' => $s_internal_name, 'b_indelible' => '0'); Session::newInstance()->_setForm('s_internal_name', $s_internal_name); $page = $this->pageManager->findByInternalName($s_internal_name); if (!isset($page['pk_i_id'])) { if ($not_empty) { $result = $this->pageManager->insert($aFields, $aFieldsDescription); Session::newInstance()->_clearVariables(); osc_add_flash_ok_message(_m('The page has been added'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); } else { osc_add_flash_error_message(_m("The page couldn't be added, at least one title should not be empty"), 'admin'); } } else { osc_add_flash_error_message(_m("Oops! That internal name is already in use. We can't make the changes"), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add"); break; case 'delete': $id = Params::getParam("id"); $page_deleted_correcty = 0; $page_deleted_error = 0; $page_indelible = 0; if (!is_array($id)) { $id = array($id); } foreach ($id as $_id) { $result = (int) $this->pageManager->deleteByPrimaryKey($_id); switch ($result) { case -1: $page_indelible++; break; case 0: $page_deleted_error++; break; case 1: $page_deleted_correcty++; } } if ($page_indelible > 0) { if ($page_indelible == 1) { osc_add_flash_error_message(_m("One page can't be deleted because it is indelible"), 'admin'); } else { osc_add_flash_error_message(sprintf(_m("%s pages couldn't be deleted because they are indelible"), $page_indelible), 'admin'); } } if ($page_deleted_error > 0) { if ($page_deleted_error == 1) { osc_add_flash_error_message(_m("One page couldn't be deleted"), 'admin'); } else { osc_add_flash_error_message(sprintf(_m("%s pages couldn't be deleted"), $page_deleted_error), 'admin'); } } if ($page_deleted_correcty > 0) { if ($page_deleted_correcty == 1) { osc_add_flash_ok_message(_m('One page has been deleted correctly'), 'admin'); } else { osc_add_flash_ok_message(sprintf(_m('%s pages have been deleted correctly'), $page_deleted_correcty), 'admin'); } } $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); break; default: if (Params::getParam('iDisplayLength') == '') { Params::setParam('iDisplayLength', 10); } $this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength')); require_once osc_admin_base_path() . 'ajax/pages_processing.php'; $params = Params::getParamsAsArray('get'); $pages_processing = new PagesProcessing($params); $aData = $pages_processing->result($params); $page = (int) Params::getParam('iPage'); if (count($aData['aaData']) == 0 && $page != 1) { $total = (int) $aData['iTotalDisplayRecords']; $maxPage = ceil($total / (int) $aData['iDisplayLength']); $url = osc_admin_base_url(true) . '?' . $_SERVER['QUERY_STRING']; if ($maxPage == 0) { $url = preg_replace('/&iPage=(\\d)+/', '&iPage=1', $url); $this->redirectTo($url); } if ($page > 1) { $url = preg_replace('/&iPage=(\\d)+/', '&iPage=' . $maxPage, $url); $this->redirectTo($url); } } $this->_exportVariableToView('aPages', $aData); $this->doView("pages/index.php"); break; } }
* * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public * License along with this program. If not, see <http://www.gnu.org/licenses/>. */ define('ABS_PATH', dirname(dirname($_SERVER['SCRIPT_FILENAME'])) . '/'); define('OC_ADMIN', 'true'); require_once ABS_PATH . 'oc-load.php'; if (file_exists(ABS_PATH . '.maintenance')) { define('__OSC_MAINTENANCE__', true); } WebThemes::newInstance(); switch (Params::getParam('page')) { case 'items': require_once osc_admin_base_path() . 'items.php'; $do = new CAdminItems(); $do->doModel(); break; case 'comments': require_once osc_admin_base_path() . 'comments.php'; $do = new CAdminItemComments(); $do->doModel(); break; case 'media': require_once osc_admin_base_path() . 'media.php'; $do = new CAdminMedia(); $do->doModel();
function add_logo_header() { $title = osc_page_title(); $logo = osc_current_web_theme_url('images/logo.jpg'); $js = <<<JAVASCRIPT <script> var title = '{$title}' ; var logo = '{$logo}' ; var img = \$("<img>").attr('border', '0').attr('alt', '{$title}').attr('title', '{$title}').attr('src', '{$logo}') ; \$(document).ready(function () { \$('.logo').html(img) ; }); </script> JAVASCRIPT; if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { echo $js; } }
function doModel() { parent::doModel(); //specific things for this class switch ($this->action) { case 'edit': if (Params::getParam("id") == '') { $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); } $form = count(Session::newInstance()->_getForm()); $keepForm = count(Session::newInstance()->_getKeepForm()); if ($form == 0 || $form == $keepForm) { Session::newInstance()->_dropKeepForm(); } $templates = osc_apply_filter('page_templates', WebThemes::newInstance()->getAvailableTemplates()); $this->_exportVariableToView('templates', $templates); $this->_exportVariableToView("page", $this->pageManager->findByPrimaryKey(Params::getParam("id"))); $this->doView("pages/frm.php"); break; case 'edit_post': osc_csrf_check(); $id = Params::getParam("id"); $b_link = Params::getParam("b_link") != '' ? 1 : 0; $s_internal_name = Params::getParam("s_internal_name"); $s_internal_name = osc_sanitizeString($s_internal_name); $meta = Params::getParam('meta'); $this->pageManager->updateMeta($id, json_encode($meta)); $aFieldsDescription = array(); $postParams = Params::getParamsAsArray('', false); $not_empty = false; foreach ($postParams as $k => $v) { if (preg_match('|(.+?)#(.+)|', $k, $m)) { if ($m[2] == 's_title' && $v != '') { $not_empty = true; } $aFieldsDescription[$m[1]][$m[2]] = $v; } } Session::newInstance()->_setForm('aFieldsDescription', $aFieldsDescription); if ($s_internal_name == '') { osc_add_flash_error_message(_m('You have to set an internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id); } if (!WebThemes::newInstance()->isValidPage($s_internal_name)) { osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id); } Session::newInstance()->_setForm('s_internal_name', $s_internal_name); if ($not_empty) { foreach ($aFieldsDescription as $k => $_data) { $this->pageManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']); } if (!$this->pageManager->internalNameExists($id, $s_internal_name)) { if (!$this->pageManager->isIndelible($id)) { $this->pageManager->updateInternalName($id, $s_internal_name); $this->pageManager->updateLink($id, $b_link); } osc_run_hook('edit_page', $id); Session::newInstance()->_clearVariables(); osc_add_flash_ok_message(_m('The page has been updated'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); } osc_add_flash_error_message(_m("You can't repeat internal name"), 'admin'); } else { osc_add_flash_error_message(_m("The page couldn't be updated, at least one title should not be empty"), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id); break; case 'add': $form = count(Session::newInstance()->_getForm()); $keepForm = count(Session::newInstance()->_getKeepForm()); if ($form == 0 || $form == $keepForm) { Session::newInstance()->_dropKeepForm(); } $templates = osc_apply_filter('page_templates', WebThemes::newInstance()->getAvailableTemplates()); $this->_exportVariableToView('templates', $templates); $this->_exportVariableToView("page", array()); $this->doView("pages/frm.php"); break; case 'add_post': osc_csrf_check(); $s_internal_name = Params::getParam("s_internal_name"); $b_link = Params::getParam("b_link") != '' ? 1 : 0; $s_internal_name = osc_sanitizeString($s_internal_name); $meta = Params::getParam('meta'); $aFieldsDescription = array(); $postParams = Params::getParamsAsArray('', false); $not_empty = false; foreach ($postParams as $k => $v) { if (preg_match('|(.+?)#(.+)|', $k, $m)) { if ($m[2] == 's_title' && $v != '') { $not_empty = true; } $aFieldsDescription[$m[1]][$m[2]] = $v; } } Session::newInstance()->_setForm('aFieldsDescription', $aFieldsDescription); if ($s_internal_name == '') { osc_add_flash_error_message(_m('You have to set an internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add"); } if (!WebThemes::newInstance()->isValidPage($s_internal_name)) { osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add"); } $aFields = array('s_internal_name' => $s_internal_name, 'b_indelible' => '0', 's_meta' => json_encode($meta), 'b_link' => $b_link); Session::newInstance()->_setForm('s_internal_name', $s_internal_name); $page = $this->pageManager->findByInternalName($s_internal_name); if (!isset($page['pk_i_id'])) { if ($not_empty) { $result = $this->pageManager->insert($aFields, $aFieldsDescription); Session::newInstance()->_clearVariables(); osc_add_flash_ok_message(_m('The page has been added'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); } else { osc_add_flash_error_message(_m("The page couldn't be added, at least one title should not be empty"), 'admin'); } } else { osc_add_flash_error_message(_m("Oops! That internal name is already in use. We can't make the changes"), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add"); break; case 'delete': osc_csrf_check(); $id = Params::getParam("id"); $page_deleted_correcty = 0; $page_deleted_error = 0; $page_indelible = 0; if (!is_array($id)) { $id = array($id); } foreach ($id as $_id) { $result = (int) $this->pageManager->deleteByPrimaryKey($_id); switch ($result) { case -1: $page_indelible++; break; case 0: $page_deleted_error++; break; case 1: $page_deleted_correcty++; } } if ($page_indelible > 0) { if ($page_indelible == 1) { osc_add_flash_error_message(_m("One page can't be deleted because it is indelible"), 'admin'); } else { osc_add_flash_error_message(sprintf(_m("%s pages couldn't be deleted because they are indelible"), $page_indelible), 'admin'); } } if ($page_deleted_error > 0) { if ($page_deleted_error == 1) { osc_add_flash_error_message(_m("One page couldn't be deleted"), 'admin'); } else { osc_add_flash_error_message(sprintf(_m("%s pages couldn't be deleted"), $page_deleted_error), 'admin'); } } if ($page_deleted_correcty > 0) { if ($page_deleted_correcty == 1) { osc_add_flash_ok_message(_m('One page has been deleted correctly'), 'admin'); } else { osc_add_flash_ok_message(sprintf(_m('%s pages have been deleted correctly'), $page_deleted_correcty), 'admin'); } } $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); break; default: if (Params::getParam("action") != "") { osc_run_hook("page_bulk_" . Params::getParam("action"), Params::getParam('id')); } require_once osc_lib_path() . "osclass/classes/datatables/PagesDataTable.php"; // set default iDisplayLength if (Params::getParam('iDisplayLength') != '') { Cookie::newInstance()->push('listing_iDisplayLength', Params::getParam('iDisplayLength')); Cookie::newInstance()->set(); } else { // set a default value if it's set in the cookie $listing_iDisplayLength = (int) Cookie::newInstance()->get_value('listing_iDisplayLength'); if ($listing_iDisplayLength == 0) { $listing_iDisplayLength = 10; } Params::setParam('iDisplayLength', $listing_iDisplayLength); } $this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength')); // Table header order by related if (Params::getParam('sort') == '') { Params::setParam('sort', 'date'); } if (Params::getParam('direction') == '') { Params::setParam('direction', 'desc'); } $page = (int) Params::getParam('iPage'); if ($page == 0) { $page = 1; } Params::setParam('iPage', $page); $params = Params::getParamsAsArray(); $pagesDataTable = new PagesDataTable(); $pagesDataTable->table($params); $aData = $pagesDataTable->getData(); if (count($aData['aRows']) == 0 && $page != 1) { $total = (int) $aData['iTotalDisplayRecords']; $maxPage = ceil($total / (int) $aData['iDisplayLength']); $url = osc_admin_base_url(true) . '?' . Params::getServerParam('QUERY_STRING', false, false); if ($maxPage == 0) { $url = preg_replace('/&iPage=(\\d)+/', '&iPage=1', $url); $this->redirectTo($url); } if ($page > 1) { $url = preg_replace('/&iPage=(\\d)+/', '&iPage=' . $maxPage, $url); $this->redirectTo($url); } } $this->_exportVariableToView('aData', $aData); $this->_exportVariableToView('aRawRows', $pagesDataTable->rawRows()); $bulk_options = array(array('value' => '', 'data-dialog-content' => '', 'label' => __('Bulk actions')), array('value' => 'delete', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected pages?'), strtolower(__('Delete'))), 'label' => __('Delete'))); $bulk_options = osc_apply_filter("page_bulk_filter", $bulk_options); $this->_exportVariableToView('bulk_options', $bulk_options); $this->doView("pages/index.php"); break; } }
?> </a></li> <?php $i++; } ?> </ul> </li> </ul> <?php } ?> </div> <div class="logo"> <?php if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { ?> <a href="<?php echo osc_base_url(); ?> "> <img src="<?php echo osc_current_web_theme_url('images/logo.jpg'); ?> " alt="<?php echo osc_page_title(); ?> " title="<?php echo osc_page_title(); ?> " />
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'); } }
echo Params::getParam('page'); ?> <?php if ((osc_is_search_page() || osc_is_home_page()) && Params::getParam('hook') != 'load_more_listing') { ?> <div class="item stamp sidebar"> <?php require WebThemes::newInstance()->getCurrentThemePath() . 'inc.search.filters.php'; ?> </div> <?php if (osc_is_search_page() && Params::getParam('hook') != 'load_more_listing') { ?> <div class="item stamp stamp-alert"> <?php require WebThemes::newInstance()->getCurrentThemePath() . 'inc.alert.form.php'; ?> </div> <?php } ?> <?php } ?> <?php // get premium ads if (!osc_is_list_items() && !osc_is_public_profile()) { $max = osc_get_preference('pop_max_premium', 'pop_theme'); osc_get_premiums($max); if (osc_count_premiums() > 0) { while (osc_has_premiums()) {
Params::setParam('cron-type', $cli_params['t']); if (Params::getParam('page') == 'upgrade') { require_once osc_lib_path() . 'osclass/upgrade-funcs.php'; exit(1); } else { if (!in_array(Params::getParam('page'), array('cron')) && !in_array(Params::getParam('cron-type'), array('hourly', 'daily', 'weekly'))) { exit(1); } } } if (file_exists(ABS_PATH . '.maintenance')) { if (!osc_is_admin_user_logged_in()) { header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 900'); if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . 'maintenance.php')) { osc_current_web_theme_path('maintenance.php'); die; } else { require_once LIB_PATH . 'osclass/helpers/hErrors.php'; $title = sprintf(__('Режим обслуживания » %s'), osc_page_title()); $message = sprintf(__('Мы приносим извинения за возможные неудобства. %s зак рыт на обслуживание.') . '.', osc_page_title()); osc_die($title, $message); } } else { define('__OSC_MAINTENANCE__', true); } } if (!osc_users_enabled() && osc_is_web_user_logged_in()) { Session::newInstance()->_drop('userId'); Session::newInstance()->_drop('userName');
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; } }
<?php $i++; } ?> </div> </div> <div class="search-dropdown"> <a> <i class="fa fa-search"></i> <?php _e('Search', 'pop'); ?> </a> <div class="header-search"> <?php require WebThemes::newInstance()->getCurrentThemePath() . 'inc.quick.search.php'; ?> </div> </div> </div> </div> </div> <div id="content"> <div class="error_list"> <?php osc_show_flash_message(); ?> </div> <?php
?> " class="btn btn-submit"> </div> </div> </fieldset> </form> <?php } else { ?> <div class="flashmessage flashmessage-error" style="display: block;"> <p> <?php $msg = sprintf(__('The images folder <strong>%s</strong> is not writable on your server', 'pop'), WebThemes::newInstance()->getCurrentThemePath() . "images/") . ", "; $msg .= __("Osclass can't upload the logo image from the administration panel.", 'pop') . ' '; $msg .= __('Please make the aforementioned image folder writable.', 'pop') . ' '; echo $msg; ?> </p> <p> <?php _e('To make a directory writable under UNIX execute this command from the shell:', 'pop'); ?> </p> <p class="command"> chmod a+w <?php echo WebThemes::newInstance()->getCurrentThemePath() . "images/"; ?> </p> </div> <?php }
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; } }
function pop_draw_item($class = false, $admin = false, $premium = false) { $filename = 'loop-single'; if ($premium) { $filename .= '-premium'; } require WebThemes::newInstance()->getCurrentThemePath() . $filename . '.php'; }
function doModel() { parent::doModel(); //specific things for this class switch ($this->action) { case 'edit': if (Params::getParam("id") == '') { $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); } $this->_exportVariableToView("page", $this->pageManager->findByPrimaryKey(Params::getParam("id"))); $this->doView("pages/frm.php"); break; case 'edit_post': $id = Params::getParam("id"); $s_internal_name = Params::getParam("s_internal_name"); // sanitize internal name $s_internal_name = osc_sanitizeString($s_internal_name); if (!WebThemes::newInstance()->isValidPage($s_internal_name)) { osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages?action=edit&id=" . $id); } $aFieldsDescription = array(); $postParams = Params::getParamsAsArray('', false); $not_empty = false; foreach ($postParams as $k => $v) { if (preg_match('|(.+?)#(.+)|', $k, $m)) { if ($m[2] == 's_title' && $v != '') { $not_empty = true; } $aFieldsDescription[$m[1]][$m[2]] = $v; } } if ($not_empty) { foreach ($aFieldsDescription as $k => $_data) { $this->pageManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']); } if (!$this->pageManager->internalNameExists($id, $s_internal_name)) { if (!$this->pageManager->isIndelible($id)) { $this->pageManager->updateInternalName($id, $s_internal_name); } osc_add_flash_ok_message(_m('The page has been updated'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); } osc_add_flash_error_message(_m("You can't repeat internal name"), 'admin'); } else { osc_add_flash_error_message(_m("The page couldn't be updated, at least one title should not be empty"), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . "?page=pages?action=edit&id=" . $id); break; case 'add': $this->_exportVariableToView("page", array()); $this->doView("pages/frm.php"); break; case 'add_post': // setForm just in case the form fails foreach (Params::getParamsAsArray('', false) as $k => $v) { Session::newInstance()->_setForm($k, $v); } $s_internal_name = Params::getParam("s_internal_name"); // sanitize internal name $s_internal_name = osc_sanitizeString($s_internal_name); if ($s_internal_name == '') { osc_add_flash_error_message(_m('You have to set an internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add"); } if (!WebThemes::newInstance()->isValidPage($s_internal_name)) { osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add"); } $page = $this->pageManager->findByInternalName($s_internal_name); if (!isset($page['pk_i_id'])) { $aFields = array('s_internal_name' => $s_internal_name, 'b_indelible' => '0'); $aFieldsDescription = array(); $postParams = Params::getParamsAsArray('', false); $not_empty = false; foreach ($postParams as $k => $v) { if (preg_match('|(.+?)#(.+)|', $k, $m)) { if ($m[2] == 's_title' && $v != '') { $not_empty = true; } $aFieldsDescription[$m[1]][$m[2]] = $v; } } if ($not_empty) { $result = $this->pageManager->insert($aFields, $aFieldsDescription); osc_add_flash_ok_message(_m('The page has been added'), 'admin'); } else { osc_add_flash_error_message(_m("The page couldn't be added, at least one title should not be empty"), 'admin'); } } else { osc_add_flash_error_message(_m("Oops! That internal name is already in use. We can't made the changes"), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); break; case 'delete': $id = Params::getParam("id"); $page_deleted_correcty = 0; $page_deleted_error = 0; $page_indelible = 0; if (!is_array($id)) { $id = array($id); } foreach ($id as $_id) { $result = (int) $this->pageManager->deleteByPrimaryKey($_id); switch ($result) { case -1: $page_indelible++; break; case 0: $page_deleted_error++; break; case 1: $page_deleted_correcty++; } } if ($page_indelible > 0) { if ($page_indelible == 1) { osc_add_flash_error_message(_m("One page can't be deleted because it is indelible"), 'admin'); } else { osc_add_flash_error_message(sprintf(_m("%s pages couldn't be deleted because are indelible"), $page_indelible), 'admin'); } } if ($page_deleted_error > 0) { if ($page_deleted_error == 1) { osc_add_flash_error_message(_m("One page couldn't be deleted"), 'admin'); } else { osc_add_flash_error_message(sprintf(_m("%s pages couldn't be deleted"), $page_deleted_error), 'admin'); } } if ($page_deleted_correcty > 0) { if ($page_deleted_correcty == 1) { osc_add_flash_ok_message(_m('One page has been deleted correctly'), 'admin'); } else { osc_add_flash_ok_message(sprintf(_m('%s pages have been deleted correctly'), $page_deleted_correcty), 'admin'); } } $this->redirectTo(osc_admin_base_url(true) . "?page=pages"); break; default: $this->_exportVariableToView("prefLocale", osc_current_admin_locale()); $this->_exportVariableToView("pages", $this->pageManager->listAll(0)); $this->doView("pages/index.php"); } }
<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']; ?> " alt="<?php echo $info['name']; ?>
osc_set_preference('keyword_placeholder', __('Luxury Villas', 'realestate'), 'realestate'); } if (osc_get_preference('theme_version', 'realestate') == '') { osc_set_preference('theme_version', '0', 'realestate'); } if (osc_get_preference('defaultLocationShowAs', 'realestate') == '') { osc_set_preference('defaultLocationShowAs', 'dropdown', 'realestate'); } // update THEME_VERSION preference if (osc_get_preference('theme_version', 'realestate') == '') { // Update logo destination, now is uploaded to oc-content/uploads/ if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { rename(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg", osc_uploads_path() . "realestate-logo.jpg"); } if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo-footer.jpg")) { rename(WebThemes::newInstance()->getCurrentThemePath() . "images/logo-footer.jpg", osc_uploads_path() . "realestate-logo-footer.jpg"); } osc_set_preference('theme_version', 201, 'realestate'); } function item_realestate_attributes() { //get_realestate_attributes if (function_exists('get_realestate_attributes')) { $data = get_realestate_attributes(); $print = array(); if (isset($data['attributes']['property_type'])) { $print[] = $data['attributes']['property_type']['value']; } if (isset($data['attributes']['plot_area'])) { $print[] = $data['attributes']['plot_area']['value'] . ' m<sup>2</sup>'; }