function theme_install() { $categories = osc_get_categories(); $categories_ids = array(); addSubCategoories($categories, $categories_ids); if (!osc_get_preference('keyword_placeholder', 'seeker')) { osc_set_preference('keyword_placeholder', __('ie. PHP Programmer'), 'seeker'); } if (!Field::newInstance()->findBySlug('s_department')) { Field::newInstance()->insertField(__('Department or Unit', 'seeker'), 'TEXT', 's_department', 0, '', $categories_ids); } if (!Field::newInstance()->findBySlug('s_position_type')) { Field::newInstance()->insertField(__('Employment Type', 'seeker'), 'DROPDOWN', 's_position_type', 0, __('Full Time', 'seeker') . ',' . __('Part Time', 'seeker') . ',' . __('Part Time to Full Time', 'seeker') . ',' . __('Temporary', 'seeker') . ',' . __('Temporary to Full Time', 'seeker') . ',' . __('Full Time', 'seeker') . ',' . __('Contracted', 'seeker') . ',' . __('Contracted to Full Time', 'seeker') . ',' . __('Internship', 'seeker') . ',' . __('Internship to Full Time', 'seeker') . ',' . __('Seasonal', 'seeker') . ',' . __('Volunteer', 'seeker'), $categories_ids); } if (!Field::newInstance()->findBySlug('s_job_experience')) { Field::newInstance()->insertField(__('Minimum Experience', 'seeker'), 'DROPDOWN', 's_job_experience', 0, __('Student (High School)', 'seeker') . ',' . __('Student (College)', 'seeker') . ',' . __('Entry Level', 'seeker') . ',' . __('Mid Level', 'seeker') . ',' . __('Experienced', 'seeker') . ',' . __('Manager/Supervisor', 'seeker') . ',' . __('Senior Manager/Supervisor', 'seeker') . ',' . __('Executive', 'seeker') . ',' . __('Senior Executive'), $categories_ids); } if (!Field::newInstance()->findBySlug('s_number_positions')) { Field::newInstance()->insertField(__('Number of positions', 'seeker'), 'TEXT', 's_number_positions', 0, '', $categories_ids); } if (!Field::newInstance()->findBySlug('s_salary')) { Field::newInstance()->insertField(__('Salary', 'seeker'), 'TEXT', 's_salary', 0, '', $categories_ids); } $version = theme_version_info(); //Save that theme has installed osc_set_preference($version['name'], $version['version'], 'seeker'); }
function doModel() { switch ($this->action) { case 'latestsearches': //calling the comments settings view $this->doView('settings/searches.php'); break; case 'latestsearches_post': // updating comment osc_csrf_check(); if (Params::getParam('save_latest_searches') == 'on') { osc_set_preference('save_latest_searches', 1); } else { osc_set_preference('save_latest_searches', 0); } if (Params::getParam('customPurge') == '') { osc_add_flash_error_message(_m('Custom number could not be left empty'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches'); } else { osc_set_preference('purge_latest_searches', Params::getParam('customPurge')); osc_add_flash_ok_message(_m('Last search settings have been updated'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches'); } break; } }
function classified_theme_install() { osc_set_preference('keyword_placeholder', __('ie. PHP Programmer', 'classified'), 'classified'); osc_set_preference('version', '1.0.0', 'classified'); osc_set_preference('default_logo', '1', 'classified'); osc_reset_preferences(); }
function youtube_update() { // convert version $version = osc_get_preference('youtube_version', 'youtube'); if ($version == '') { $version = 12; } if ($version < 200) { $conn = DBConnectionClass::newInstance(); $data = $conn->getOsclassDb(); $dbCommand = new DBCommandClass($data); $dbCommand->query(sprintf('ALTER TABLE %s ADD COLUMN s_id VARCHAR(15) NOT NULL DEFAULT \'-no-id-\' AFTER s_youtube', YOUTUBE_TABLE)); // update s_id $dbCommand->select(); $dbCommand->from(YOUTUBE_TABLE); $rs = $dbCommand->get(); if ($rs !== false) { $result = $rs->result(); foreach ($result as $video) { $video_code = youtube_get_code_from_url($video['s_youtube']); $dbCommand->update(YOUTUBE_TABLE, array('s_id' => $video_code), array('fk_i_item_id' => $video['fk_i_item_id'])); } } osc_set_preference('youtube_version', '200', 'youtube', 'STRING'); osc_reset_preferences(); } }
function __construct() { parent::__construct(); osc_run_hook('init_admin'); // check if exist a new version each day if (time() - osc_last_version_check() > 24 * 3600) { $data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?'); $data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data); $json = json_decode($data); if ($json->version > osc_version()) { osc_set_preference('update_core_json', $data); } else { osc_set_preference('update_core_json', ''); } osc_set_preference('last_version_check', time()); osc_reset_preferences(); } $config_version = str_replace('.', '', OSCLASS_VERSION); $config_version = preg_replace('|-.*|', '', $config_version); if ($config_version > Preference::newInstance()->get('version')) { if (get_class($this) == 'CAdminTools') { } else { if (get_class($this) != 'CAdminUpgrade') { $this->redirectTo(osc_admin_base_url(true) . '?page=upgrade'); } } } }
function doModel() { switch ($this->action) { case 'advanced': //calling the advanced settings view $this->doView('settings/advanced.php'); break; case 'advanced_post': // updating advanced settings 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=settings&action=advanced'); } osc_csrf_check(); $subdomain_type = Params::getParam('e_type'); if (!in_array($subdomain_type, array('category', 'country', 'region', 'city', 'user'))) { $subdomain_type = ''; } $iUpdated = osc_set_preference('subdomain_type', $subdomain_type); $iUpdated += osc_set_preference('subdomain_host', Params::getParam('s_host')); if ($iUpdated > 0) { osc_add_flash_ok_message(_m("Advanced settings have been updated"), 'admin'); } osc_calculate_location_slug(osc_subdomain_type()); $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=advanced'); break; case 'advanced_cache_flush': osc_cache_flush(); osc_add_flash_ok_message(_m("Cache flushed correctly"), 'admin'); $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=advanced'); break; } }
function allSeo_call_after_install() { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/robots.txt")) { $rob = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/robots.txt"); } else { $rob = ''; } if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/.htaccess")) { $hta = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/.htaccess"); } else { $hta = ''; } ModelSeo::newInstance()->import('all_in_one/model/struct.sql'); osc_set_preference('allSeo_description', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_keywords', 'classified, free classified, classified web, free listings, cars for sale, sale', 'plugin-all_in_one', 'STRING'); osc_set_preference('allSeo_title_first', '0', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_robots', $rob, 'plugin-all_in_one', 'STRING'); osc_set_preference('allSeo_robots_enabled', '0', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_htaccess', $hta, 'plugin-all_in_one', 'STRING'); osc_set_preference('allSeo_htaccess_enabled', '0', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_delimiter', '|', 'plugin-all_in_one', 'STRING'); osc_set_preference('allSeo_city_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_city_order', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_region_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_region_order', '2', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_country_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_country_order', '3', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_category_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_category_order', '4', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_title_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_title_order', '5', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_body_order', '6', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_page_title', '', 'plugin-all_in_one', 'STRING'); osc_set_preference('allSeo_search_city_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_city_order', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_region_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_region_order', '2', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_country_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_country_order', '3', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_category_order', '4', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_pattern_order', '6', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_title_show', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_title_order', '5', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_search_page_title', '', 'plugin-all_in_one', 'STRING'); osc_set_preference('allSeo_search_improve_desc', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_other_page_title', '', 'plugin-all_in_one', 'STRING'); osc_set_preference('allSeo_sitemap_freq', 'weekly', 'plugin-all_in_one', 'STRING'); osc_set_preference('allSeo_links_footer', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_sitemap_items', '1', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_sitemap_items_limit', '1000', 'plugin-all_in_one', 'INTEGER'); osc_set_preference('allSeo_allow_custom_meta', '1', 'plugin-all_in_one', 'INTEGER'); //upload email templates foreach (osc_listLocales() as $loc) { //bo_mgr_email_expired template $des_link[$loc['code']]['s_title'] = '{WEB_TITLE} - There is problem with backlink placed on your site'; $des_link[$loc['code']]['s_text'] = '<p>Dear Partner!</p> <p>Let us inform you, that we were not able to find link referring to our site: <strong>{LINK_TO}</strong> on your website <strong>{LINK_FROM}</strong>.</p> <p>Please add our link to your site or our cooperation in backlink building will be cancelled. If reason of removing link is maintenance or similar, please inform us about this.</p> <p>Regards, <br />{WEB_TITLE}</p>'; } Page::newInstance()->insert(array('s_internal_name' => 'seo_link_problem', 'b_indelible' => '1'), $des_link); }
function digitalgoods_install() { DGModel::newInstance()->import('digitalgoods/struct.sql'); @mkdir(osc_content_path() . 'uploads/digitalgoods/'); osc_set_preference('upload_path', osc_content_path() . 'uploads/digitalgoods/', 'digitalgoods', 'STRING'); osc_set_preference('max_files', '1', 'digitalgoods', 'INTEGER'); osc_set_preference('allowed_ext', 'zip,rar,tgz', 'digitalgoods', 'INTEGER'); }
function modern_compactmode_actions(){ $compactMode = osc_get_preference('compact_mode','modern_admin_theme'); $modeStatus = array('compact_mode'=>true); if($compactMode == true){ $modeStatus['compact_mode'] = false; } osc_set_preference('compact_mode', $modeStatus['compact_mode'], 'modern_admin_theme'); echo json_encode($modeStatus); }
function qrcode_install() { @mkdir(osc_content_path() . 'uploads/qrcode/'); $conn = getConnection(); osc_set_preference('upload_path', osc_content_path() . 'uploads/qrcode/', 'qrcode', 'STRING'); osc_set_preference('upload_url', osc_base_url() . 'oc-content/uploads/qrcode/', 'qrcode', 'STRING'); osc_set_preference('code_size', '2', 'qrcode', 'INTEGER'); $conn->commit(); }
function __construct() { parent::__construct(); // check if is moderator and can enter to this page if ($this->isModerator()) { if (!in_array($this->page, array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats', ''))) { osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin'); $this->redirectTo(osc_admin_base_url()); } } osc_run_hook('init_admin'); // check if exist a new version each day if (time() - osc_last_version_check() > 24 * 3600) { $data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?'); $data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data); $json = json_decode($data); if ($json->version > osc_version()) { osc_set_preference('update_core_json', $data); } else { osc_set_preference('update_core_json', ''); } osc_set_preference('last_version_check', time()); osc_reset_preferences(); } $config_version = str_replace('.', '', OSCLASS_VERSION); $config_version = preg_replace('|-.*|', '', $config_version); if ($config_version > Preference::newInstance()->get('version')) { if (get_class($this) == 'CAdminTools') { } else { if (get_class($this) != 'CAdminUpgrade') { $this->redirectTo(osc_admin_base_url(true) . '?page=upgrade'); } } } // show messages subscribed $status_subscribe = Params::getParam('subscribe_osclass'); if ($status_subscribe != '') { switch ($status_subscribe) { case -1: osc_add_flash_error_message(_m('Entered an invalid email'), 'admin'); break; case 0: osc_add_flash_warning_message(_m("You're already subscribed"), 'admin'); break; case 1: osc_add_flash_ok_message(_m('Subscribed correctly'), 'admin'); break; default: osc_add_flash_warning_message(_m("Error subscribing"), 'admin'); break; } } // show donation successful if (Params::getParam('donation') == 'successful') { osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin'); } }
/** * Set plugin preferences */ function voting_install() { ModelVoting::newInstance()->import('voting/struct.sql'); // vote items osc_set_preference('item_voting', '1', 'voting', 'BOOLEAN'); osc_set_preference('open', '1', 'voting', 'BOOLEAN'); // vote users osc_set_preference('user', '0', 'voting', 'BOOLEAN'); osc_set_preference('user_voting', '0', 'voting', 'BOOLEAN'); }
function moreedit_install() { osc_set_preference('moderate_all', '0', 'moreedit', 'BOOLEAN'); osc_set_preference('moderate_edit', '0', 'moreedit', 'BOOLEAN'); osc_set_preference('disable_edit', '0', 'moreedit', 'BOOLEAN'); osc_set_preference('max_ads_week', '0', 'moreedit', 'INTEGER'); osc_set_preference('max_ads_month', '0', 'moreedit', 'INTEGER'); osc_set_preference('notify_edit', '0', 'moreedit', 'INTEGER'); ModelMoreedit::newInstance()->install(); }
function payment_pro_blockchain_conf_save() { osc_set_preference('blockchain_btc_address', Params::getParam("blockchain_btc_address") ? Params::getParam("blockchain_btc_address") : '', 'payment_pro', 'STRING'); osc_set_preference('blockchain_confirmations', is_numeric(Params::getParam("blockchain_confirmations")) ? Params::getParam("blockchain_confirmations") : '6', 'payment_pro', 'INTEGER'); osc_set_preference('blockchain_enabled', Params::getParam("blockchain_enabled") ? Params::getParam("blockchain_enabled") : '0', 'payment_pro', 'BOOLEAN'); if (Params::getParam("blockchain_enabled") == 1) { payment_pro_register_service('Blockchain', __FILE__); } else { payment_pro_unregister_service('Blockchain'); } }
function item_success_update_version() { $version = osc_get_preference('item_success_version', 'item_success'); if ($version == '') { $version = 0; } if ($version < 110) { osc_set_preference('item_success_add_meta_og', 'true', 'item_success', 'BOOLEAN'); osc_set_preference('item_success_version', '110', 'item_success', 'STRING'); osc_reset_preferences(); } }
function payment_pro_ccavenue_conf_save() { osc_set_preference('ccavenue_merchant_id', payment_pro_crypt(Params::getParam("ccavenue_merchant_id")), 'payment_pro', 'STRING'); osc_set_preference('ccavenue_working_key', payment_pro_crypt(Params::getParam("ccavenue_working_key")), 'payment_pro', 'STRING'); osc_set_preference('ccavenue_sandbox', Params::getParam("ccavenue_sandbox") ? Params::getParam("ccavenue_sandbox") : '0', 'payment_pro', 'BOOLEAN'); osc_set_preference('ccavenue_enabled', Params::getParam("ccavenue_enabled") ? Params::getParam("ccavenue_enabled") : '0', 'payment_pro', 'BOOLEAN'); if (Params::getParam("ccavenue_enabled") == 1) { payment_pro_register_service('Ccavenue', __FILE__); } else { payment_pro_unregister_service('Ccavenue'); } }
function nm_copypaste_plugin_actions() { $dao_preference = new Preference(); $option = Params::getParam('nomoreoption'); if (Params::getParam('file') != 'nm_copypaste_plugin/admin/settings.php') { return ''; } if ($option == 'nomoresettings') { osc_set_preference('nm_id', Params::getParam("nm_id") ? Params::getParam("nm_id") : '0', 'nm_copypaste_plugin', 'STRING'); osc_add_flash_ok_message(__('Nomore copy/paste settings has been updated', 'nm_copypaste_plugin'), 'admin'); osc_redirect_to(osc_admin_render_plugin_url('nm_copypaste_plugin/admin/settings.php')); } }
function osclass_pm_install() { ModelPM::newInstance()->import('osclass_pm/struct.sql'); osc_set_preference('sendEmail', '1', 'plugin-osclass_pm', 'INTEGER'); osc_set_preference('maxPMs', '100', 'plugin-osclass_pm', 'INTEGER'); osc_set_preference('deletePM', '3', 'plugin-osclass_pm', 'INTEGER'); osc_set_preference('pmBlocking', '1', 'plugin-osclass_pm', 'INTEGER'); osc_set_preference('pmDrafts', '0', 'plugin-osclass_pm', 'INTEGER'); osc_set_preference('pmSent', '1', 'plugin-osclass_pm', 'INTEGER'); osc_set_preference('pmAdmin', 'Admin', 'plugin-osclass_pm', 'STRING'); ModelPM::newInstance()->insertUsersPmSettings(); ModelPM::newInstance()->insertEmailTemplates(); }
function doModel() { switch ($this->action) { case 'spamNbots': // calling the spam and bots view $akismet_key = osc_akismet_key(); $akismet_status = 3; if ($akismet_key != '') { require_once osc_lib_path() . 'Akismet.class.php'; $akismet_obj = new Akismet(osc_base_url(), $akismet_key); $akismet_status = 2; if ($akismet_obj->isKeyValid()) { $akismet_status = 1; } } View::newInstance()->_exportVariableToView('akismet_status', $akismet_status); $this->doView('settings/spamNbots.php'); break; case 'akismet_post': // updating spam and bots option osc_csrf_check(); $updated = 0; $akismetKey = Params::getParam('akismetKey'); $akismetKey = trim($akismetKey); $updated = osc_set_preference('akismetKey', $akismetKey); if ($akismetKey == '') { osc_add_flash_info_message(_m('Your Akismet key has been cleared'), 'admin'); } else { osc_add_flash_ok_message(_m('Your Akismet key has been updated'), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots'); break; case 'recaptcha_post': // updating spam and bots option osc_csrf_check(); $iUpdated = 0; $recaptchaPrivKey = Params::getParam('recaptchaPrivKey'); $recaptchaPrivKey = trim($recaptchaPrivKey); $recaptchaPubKey = Params::getParam('recaptchaPubKey'); $recaptchaPubKey = trim($recaptchaPubKey); $iUpdated += osc_set_preference('recaptchaPrivKey', $recaptchaPrivKey); $iUpdated += osc_set_preference('recaptchaPubKey', $recaptchaPubKey); if ($recaptchaPubKey == '') { osc_add_flash_info_message(_m('Your reCAPTCHA key has been cleared'), 'admin'); } else { osc_add_flash_ok_message(_m('Your reCAPTCHA key has been updated'), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots'); break; } }
function doModel() { switch ($this->action) { case 'comments': //calling the comments settings view $this->doView('settings/comments.php'); break; case 'comments_post': // updating comment osc_csrf_check(); $iUpdated = 0; $enabledComments = Params::getParam('enabled_comments'); $enabledComments = $enabledComments != '' ? true : false; $moderateComments = Params::getParam('moderate_comments'); $moderateComments = $moderateComments != '' ? true : false; $numModerateComments = Params::getParam('num_moderate_comments'); $commentsPerPage = Params::getParam('comments_per_page'); $notifyNewComment = Params::getParam('notify_new_comment'); $notifyNewComment = $notifyNewComment != '' ? true : false; $notifyNewCommentUser = Params::getParam('notify_new_comment_user'); $notifyNewCommentUser = $notifyNewCommentUser != '' ? true : false; $regUserPostComments = Params::getParam('reg_user_post_comments'); $regUserPostComments = $regUserPostComments != '' ? true : false; $msg = ''; if (!osc_validate_int(Params::getParam("num_moderate_comments"))) { $msg .= _m("Number of moderate comments must only contain numeric characters") . "<br/>"; } if (!osc_validate_int(Params::getParam("comments_per_page"))) { $msg .= _m("Comments per page must only contain numeric characters") . "<br/>"; } if ($msg != '') { osc_add_flash_error_message($msg, 'admin'); $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=comments'); } $iUpdated += osc_set_preference('enabled_comments', $enabledComments); if ($moderateComments) { $iUpdated += osc_set_preference('moderate_comments', $numModerateComments); } else { $iUpdated += osc_set_preference('moderate_comments', '-1'); } $iUpdated += osc_set_preference('notify_new_comment', $notifyNewComment); $iUpdated += osc_set_preference('notify_new_comment_user', $notifyNewCommentUser); $iUpdated += osc_set_preference('comments_per_page', $commentsPerPage); $iUpdated += osc_set_preference('reg_user_post_comments', $regUserPostComments); if ($iUpdated > 0) { osc_add_flash_ok_message(_m("Comment settings have been updated"), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=comments'); break; } }
function __construct() { parent::__construct(); // check if is moderator and can enter to this page if( $this->isModerator() ) { if( !in_array($this->page, osc_apply_filter('moderator_access', array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats',''))) ) { osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin'); $this->redirectTo(osc_admin_base_url()); } } osc_run_hook( 'init_admin' ); // check if exist a new version each day if( (time() - osc_last_version_check()) > (24 * 3600) ) { $data = osc_file_get_contents('http://osclass.org/latest_version_v1.php?callback=?'); $data = preg_replace('|^\?\((.*?)\);$|', '$01', $data); $json = json_decode($data); if( $json->version > osc_version() ) { osc_set_preference( 'update_core_json', $data ); } else { osc_set_preference( 'update_core_json', '' ); } osc_set_preference( 'last_version_check', time() ); osc_reset_preferences(); } $config_version = str_replace('.', '', OSCLASS_VERSION); $config_version = preg_replace('|-.*|', '', $config_version); if( $config_version > osc_get_preference('version') ) { if(get_class($this) == 'CAdminTools') { } else { if(get_class($this) != 'CAdminUpgrade' ) $this->redirectTo(osc_admin_base_url(true) . '?page=upgrade'); } } // show donation successful if( Params::getParam('donation') == 'successful' ) { osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin'); } // enqueue scripts osc_enqueue_script('jquery'); osc_enqueue_script('jquery-ui'); osc_enqueue_script('admin-osc'); osc_enqueue_script('admin-ui-osc'); }
function payment_pro_stripe_conf_save() { osc_set_preference('stripe_secret_key', payment_pro_crypt(Params::getParam("stripe_secret_key")), 'payment_pro', 'STRING'); osc_set_preference('stripe_public_key', payment_pro_crypt(Params::getParam("stripe_public_key")), 'payment_pro', 'STRING'); osc_set_preference('stripe_secret_key_test', payment_pro_crypt(Params::getParam("stripe_secret_key_test")), 'payment_pro', 'STRING'); osc_set_preference('stripe_public_key_test', payment_pro_crypt(Params::getParam("stripe_public_key_test")), 'payment_pro', 'STRING'); osc_set_preference('stripe_sandbox', Params::getParam("stripe_sandbox") ? Params::getParam("stripe_sandbox") : '0', 'payment_pro', 'BOOLEAN'); osc_set_preference('stripe_enabled', Params::getParam("stripe_enabled") ? Params::getParam("stripe_enabled") : '0', 'payment_pro', 'BOOLEAN'); if (Params::getParam("stripe_enabled") == 1) { payment_pro_register_service('Stripe', __FILE__); } else { payment_pro_unregister_service('Stripe'); } }
function payment_pro_braintree_conf_save() { osc_set_preference('braintree_merchant_id', payment_pro_crypt(Params::getParam("braintree_merchant_id")), 'payment_pro', 'STRING'); osc_set_preference('braintree_public_key', payment_pro_crypt(Params::getParam("braintree_public_key")), 'payment_pro', 'STRING'); osc_set_preference('braintree_private_key', payment_pro_crypt(Params::getParam("braintree_private_key")), 'payment_pro', 'STRING'); osc_set_preference('braintree_encryption_key', payment_pro_crypt(Params::getParam("braintree_encryption_key")), 'payment_pro', 'STRING'); osc_set_preference('braintree_sandbox', Params::getParam("braintree_sandbox") == 'sandbox' ? 'sandbox' : 'production', 'payment_pro', 'STRING'); osc_set_preference('braintree_enabled', Params::getParam("braintree_enabled") ? Params::getParam("braintree_enabled") : '0', 'payment_pro', 'BOOLEAN'); if (Params::getParam("braintree_enabled") == 1) { payment_pro_register_service('Braintree', __FILE__); } else { payment_pro_unregister_service('Braintree'); } }
function doModel() { switch ($this->action) { case 'mailserver': // calling the mailserver view $this->doView('settings/mailserver.php'); break; case 'mailserver_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=settings&action=mailserver'); } osc_csrf_check(); // updating mailserver $iUpdated = 0; $mailserverAuth = Params::getParam('mailserver_auth'); $mailserverAuth = $mailserverAuth != '' ? true : false; $mailserverPop = Params::getParam('mailserver_pop'); $mailserverPop = $mailserverPop != '' ? true : false; $mailserverType = Params::getParam('mailserver_type'); $mailserverHost = Params::getParam('mailserver_host'); $mailserverPort = Params::getParam('mailserver_port'); $mailserverUsername = Params::getParam('mailserver_username'); $mailserverPassword = Params::getParam('mailserver_password', false, false); $mailserverSsl = Params::getParam('mailserver_ssl'); $mailserverMailFrom = Params::getParam('mailserver_mail_from'); $mailserverNameFrom = Params::getParam('mailserver_name_from'); if (!in_array($mailserverType, array('custom', 'gmail'))) { osc_add_flash_error_message(_m('Mail server type is incorrect'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver'); } $iUpdated += osc_set_preference('mailserver_auth', $mailserverAuth); $iUpdated += osc_set_preference('mailserver_pop', $mailserverPop); $iUpdated += osc_set_preference('mailserver_type', $mailserverType); $iUpdated += osc_set_preference('mailserver_host', $mailserverHost); $iUpdated += osc_set_preference('mailserver_port', $mailserverPort); $iUpdated += osc_set_preference('mailserver_username', $mailserverUsername); $iUpdated += osc_set_preference('mailserver_password', $mailserverPassword); $iUpdated += osc_set_preference('mailserver_ssl', $mailserverSsl); $iUpdated += osc_set_preference('mailserver_mail_from', $mailserverMailFrom); $iUpdated += osc_set_preference('mailserver_name_from', $mailserverNameFrom); if ($iUpdated > 0) { osc_add_flash_ok_message(_m('Mail server configuration has changed'), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver'); break; } }
function payment_pro_paypal_conf_save() { osc_set_preference('paypal_api_username', payment_pro_crypt(Params::getParam("paypal_api_username")), 'payment_pro', 'STRING'); osc_set_preference('paypal_api_password', payment_pro_crypt(Params::getParam("paypal_api_password")), 'payment_pro', 'STRING'); osc_set_preference('paypal_api_signature', payment_pro_crypt(Params::getParam("paypal_api_signature")), 'payment_pro', 'STRING'); osc_set_preference('paypal_email', Params::getParam("paypal_email"), 'payment_pro', 'STRING'); osc_set_preference('paypal_standard', '1', 'payment_pro', 'BOOLEAN'); //osc_set_preference('paypal_standard', Params::getParam("paypal_standard") ? Params::getParam("paypal_standard") : '0', 'payment_pro', 'BOOLEAN'); osc_set_preference('paypal_sandbox', Params::getParam("paypal_sandbox") ? Params::getParam("paypal_sandbox") : '0', 'payment_pro', 'BOOLEAN'); osc_set_preference('paypal_enabled', Params::getParam("paypal_enabled") ? Params::getParam("paypal_enabled") : '0', 'payment_pro', 'BOOLEAN'); if (Params::getParam("paypal_enabled") == 1) { payment_pro_register_service('Paypal', __FILE__); } else { payment_pro_unregister_service('Paypal'); } }
function adManage_install() { $conn = getConnection(); $path = osc_plugin_resource('advanced_ad_management/struct.sql'); $sql = file_get_contents($path); $conn->osc_dbImportSQL($sql); osc_set_preference('adManageed_expire', '4', 'plugin-item_adManage', 'INTEGER'); osc_set_preference('adManageed_payperpost', '1', 'plugin-item_adManage', 'INTEGER'); osc_set_preference('adManageed_repubTimes', '5', 'plugin-item_adManage', 'INTEGER'); osc_set_preference('adManageed_installed', '0', 'plugin-item_adManage', 'INTEGER'); osc_set_preference('adManageed_freeRepubs', '0', 'plugin-item_adManage', 'INTEGER'); osc_set_preference('adManageed_expireEmail', '1', 'plugin-item_adManage', 'INTEGER'); osc_set_preference('adManageed_deleteDays', '0', 'plugin-item_adManage', 'INTEGER'); //used for email template $conn->osc_dbExec("INSERT IGNORE INTO %st_pages (s_internal_name, b_indelible, dt_pub_date) VALUES ('email_ad_expire', 1, NOW() )", DB_TABLE_PREFIX); $conn->osc_dbExec("INSERT IGNORE INTO %st_pages_description (fk_i_pages_id, fk_c_locale_code, s_title, s_text) VALUES (%d, '%s', '{WEB_TITLE} - Your ad {ITEM_TITLE} is about to expire.', '<p>Hi {CONTACT_NAME}!</p>\r\n<p> </p>\r\n<p>Your ad is about to expire, click on the link if you would like to extend your ad {REPUBLISH_URL}</p><p> </p>\r\n<p>This is an automatic email, Please do not respond to this email.</p>\r\n<p> </p>\r\n<p>Thanks</p>\r\n<p>{WEB_TITLE}</p>')", DB_TABLE_PREFIX, $conn->get_last_id(), osc_language()); $conn->osc_dbExec("INSERT IGNORE INTO %st_pages (s_internal_name, b_indelible, dt_pub_date) VALUES ('email_ad_expired', 1, NOW() )", DB_TABLE_PREFIX); $conn->osc_dbExec("INSERT IGNORE INTO %st_pages_description (fk_i_pages_id, fk_c_locale_code, s_title, s_text) VALUES (%d, '%s', '{WEB_TITLE} - Your ad {ITEM_TITLE} has expired.', '<p>Hi {CONTACT_NAME}!</p>\r\n<p> </p>\r\n<p>Your ad has expired. You may renew your ad by clicking on the link {REPUBLISH_URL}. Otherwise your ad will be permanently deleted in {PERM_DELETED} days</p><p> </p>\r\n<p>This is an automatic email, Please do not respond to this email.</p>\r\n<p> </p>\r\n<p>Thanks</p>\r\n<p>{WEB_TITLE}</p>')", DB_TABLE_PREFIX, $conn->get_last_id(), osc_language()); }
function seo_init_admin() { //scripts osc_enqueue_style('seoCSS', osc_plugin_url(SEO_PLUGIN_FOLDER . '/css/style.css') . 'style.css'); //admin menu pages osc_add_admin_menu_page(__('SEO Wiz', SEO_PLUGIN_FOLDER), osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'configure.php'), 'seo_dashboard'); osc_add_admin_submenu_page('seo_dashboard', __('Configure Plugin', SEO_PLUGIN_FOLDER), osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'configure.php'), 'configure'); osc_add_admin_submenu_page('seo_dashboard', __('Titles & Metas', SEO_PLUGIN_FOLDER), osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'titles_metas.php'), 'titles_metas'); //form actions switch (Params::getParam('seo_action')) { //configure page case 'seo_configure': $page_title_separator = Params::getParam('page_title_separator', false, false, false); osc_set_preference('page_title_separator', $page_title_separator, 'seo_plugin'); osc_add_flash_ok_message(__('Saved correctly', SEO_PLUGIN_FOLDER), 'admin'); osc_redirect_to(osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'configure.php')); break; //titles_metas_home //titles_metas_home case 'titles_metas_home': $seo_titles = Params::getParam('seo_titles'); if (!empty($seo_titles)) { foreach ($seo_titles as $key => $value) { osc_set_preference($key, trim($value), 'seo_plugin'); } } osc_add_flash_ok_message(__('Saved correctly', SEO_PLUGIN_FOLDER), 'admin'); osc_redirect_to(osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'titles_metas.php#home')); break; //titles_metas_pages //titles_metas_pages case 'titles_metas_pages': $seo_titles = Params::getParam('seo_titles'); if (!empty($seo_titles)) { foreach ($seo_titles as $key => $value) { osc_set_preference($key, trim($value), 'seo_plugin'); } } osc_add_flash_ok_message(__('Saved correctly', SEO_PLUGIN_FOLDER), 'admin'); osc_redirect_to(osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'titles_metas.php#pages')); break; } }
function fb_page_plugin_actions() { $dao_preference = new Preference(); $option = Params::getParam('fbpageoption'); if (Params::getParam('file') != 'fb_page_plugin/admin.php') { return ''; } if ($option == 'fbpagesettings') { osc_set_preference('fb_page_url', Params::getParam("fb_page_url") ? Params::getParam("fb_page_url") : '0', 'fb_page_plugin', 'STRING'); osc_set_preference('fb_page_width', Params::getParam("fb_page_width") ? Params::getParam("fb_page_width") : '0', 'fb_page_plugin', 'STRING'); osc_set_preference('fb_page_height', Params::getParam("fb_page_height") ? Params::getParam("fb_page_height") : '0', 'fb_page_plugin', 'STRING'); osc_set_preference('fb_show_faces', Params::getParam("fb_show_faces") ? Params::getParam("fb_show_faces") : '0', 'fb_page_plugin', 'STRING'); osc_set_preference('show_page_posts', Params::getParam("show_page_posts") ? Params::getParam("show_page_posts") : '0', 'fb_page_plugin', 'STRING'); osc_set_preference('hide_page_cover', Params::getParam("hide_page_cover") ? Params::getParam("hide_page_cover") : '0', 'fb_page_plugin', 'STRING'); osc_set_preference('use_small_header', Params::getParam("use_small_header") ? Params::getParam("use_small_header") : '0', 'fb_page_plugin', 'STRING'); osc_set_preference('adapt_container_width', Params::getParam("adapt_container_width") ? Params::getParam("adapt_container_width") : '0', 'fb_page_plugin', 'STRING'); osc_add_flash_ok_message(__('Facebook page plugin has been updated', 'fb_page_plugin'), 'admin'); osc_redirect_to(osc_admin_render_plugin_url('fb_page_plugin/admin.php')); } }
<?php $num_ads = ''; if (Params::getParam('num_ads') != '') { $num_ads = Params::getParam('num_ads'); } else { $num_ads = popular_ads_num_ads(); } if (Params::getParam('option') == 'update') { osc_set_preference('popularads_num_ads', $num_ads, 'plugin-popular_ads', 'INTEGER'); osc_add_flash_ok_message(__('Number of ads to display successfully updated'), 'admin'); echo '<script>location.href="' . osc_admin_render_plugin_url('popular_ads/admin_config.php') . '"</script>'; } ?> <div style="border: 5px solid #ccc; padding:10px; background: #eee; -moz-border-radius:20px; -webkit-border-radius:20px; border-radius: 20px;"> <fieldset style="border-color:#ccc;"> <legend><h2>Popular Ads - Configure</h2></legend> There is currently only one option that needs to be set for this plugin, and that is the number of popular ads you wish to display. <br><br> How are popular ads determined? - They are based on the total number of active item/ad views. That means an item <i>must</i> be active in order to be included. <br><br> <form name="adexpiration" action="<?php echo osc_admin_base_url(true);
function butler_delete_activated_users($days = 30, $limit = 1000) { $users = ModelButler::newInstance()->inactivatedUsers($days, $limit); $mUsers = User::newInstance(); $numSuccess = 0; foreach ($users as $user) { $success = $mUsers->deleteUser($user['pk_i_id']); if ($success) { $numSuccess++; } } osc_set_preference('activated_users', (int) osc_get_preference('activated_users', 'butler') + $numSuccess, 'butler', 'INTEGER'); }