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'); }
/** * Remove resources from disk * @param <type> $id * @param boolean $admin * @return boolean */ function osc_deleteResource($id, $admin) { if (defined('DEMO')) { return false; } if (is_array($id)) { $id = $id[0]; } $resource = ItemResource::newInstance()->findByPrimaryKey($id); if (!is_null($resource)) { Log::newInstance()->insertLog('item', 'delete resource', $resource['pk_i_id'], $id, $admin ? 'admin' : 'user', $admin ? osc_logged_admin_id() : osc_logged_user_id()); $backtracel = ''; foreach (debug_backtrace() as $k => $v) { if ($v['function'] == "include" || $v['function'] == "include_once" || $v['function'] == "require_once" || $v['function'] == "require") { $backtracel .= "#" . $k . " " . $v['function'] . "(" . $v['args'][0] . ") called@ [" . $v['file'] . ":" . $v['line'] . "] / "; } else { $backtracel .= "#" . $k . " " . $v['function'] . " called@ [" . $v['file'] . ":" . $v['line'] . "] / "; } } Log::newInstance()->insertLog('item', 'delete resource backtrace', $resource['pk_i_id'], $backtracel, $admin ? 'admin' : 'user', $admin ? osc_logged_admin_id() : osc_logged_user_id()); @unlink(osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "." . $resource['s_extension']); @unlink(osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "_original." . $resource['s_extension']); @unlink(osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "_thumbnail." . $resource['s_extension']); @unlink(osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "_preview." . $resource['s_extension']); osc_run_hook('delete_resource', $resource); } }
function doView($file) { osc_run_hook('before_html'); osc_current_web_theme_path($file); Session::newInstance()->_clearVariables(); osc_run_hook('after_html'); }
function showAuthFailPage() { // juanramon: we add here de init_admin hook becuase if not, it's not called osc_run_hook('init_admin'); require osc_admin_base_path() . 'gui/login.php'; exit; }
function doView($file) { osc_run_hook("before_admin_html"); osc_current_admin_theme_path($file); Session::newInstance()->_clearVariables(); osc_run_hook("after_admin_html"); }
private function addTableHeader() { $arg_date = '&sort=date'; if (Params::getParam('sort') == 'date') { if (Params::getParam('direction') == 'desc') { $arg_date .= '&direction=asc'; } } $arg_item = '&sort=attached_to'; if (Params::getParam('sort') == 'attached_to') { if (Params::getParam('direction') == 'desc') { $arg_item .= '&direction=asc'; } } Rewrite::newInstance()->init(); $page = (int) Params::getParam('iPage'); if ($page == 0) { $page = 1; } Params::setParam('iPage', $page); $url_base = preg_replace('|&direction=([^&]*)|', '', preg_replace('|&sort=([^&]*)|', '', osc_base_url() . Rewrite::newInstance()->get_raw_request_uri())); $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('file', __('File')); $this->addColumn('action', __('Action')); $this->addColumn('attached_to', '<a href="' . osc_esc_html($url_base . $arg_item) . '">' . __('Attached to') . '</a>'); $this->addColumn('date', '<a href="' . osc_esc_html($url_base . $arg_date) . '">' . __('Date') . '</a>'); $dummy =& $this; osc_run_hook("admin_media_table", $dummy); }
function __construct() { parent::__construct(); // @deprecated: to be removed osc_run_hook('init_admin'); osc_run_hook('init_admin_insecure'); }
function __construct() { $this->action = Params::getParam('action'); $this->ajax = false; $this->time = list($sm, $ss) = explode(' ', microtime()); WebThemes::newInstance(); osc_run_hook('init'); }
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'); } }
private function addTableHeader() { $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('internal_name', __('Internal name')); $this->addColumn('title', __('Title')); $this->addColumn('order', __('Order')); $dummy =& $this; osc_run_hook("admin_pages_table", $dummy); }
private function addTableHeader() { $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('name', __('Ban name / Reason')); $this->addColumn('ip', __('IP rule')); $this->addColumn('email', __('E-mail rule')); $dummy =& $this; osc_run_hook("admin_rules_table", $dummy); }
function footer_js() { echo '<script type="text/javascript"><!--//--><![CDATA[//><!--'; osc_run_hook('footer_js'); echo "\n"; echo "\$('#error_list').append('<div class=\"hide_errors\">x</div>');\n"; echo "\$('.hide_errors').click(function(){ \$(this).parent().hide();});\n"; echo '//--><!]]></script>'; }
private function addTableHeader() { $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('email', __('E-mail')); $this->addColumn('alert', __('Alert')); $this->addColumn('date', __('Date')); $dummy =& $this; osc_run_hook("admin_alerts_table", $dummy); }
function osc_runAlert($type = null, $last_exec = null) { if (!in_array($type, array('HOURLY', 'DAILY', 'WEEKLY', 'INSTANT'))) { return; } if ($last_exec == null) { $cron = Cron::newInstance()->getCronByType($type); if (is_array($cron)) { $last_exec = $cron['d_last_exec']; } else { $last_exec = '0000-00-00 00:00:00'; } } $internal_name = 'alert_email_hourly'; switch ($type) { case 'HOURLY': $internal_name = 'alert_email_hourly'; break; case 'DAILY': $internal_name = 'alert_email_daily'; break; case 'WEEKLY': $internal_name = 'alert_email_weekly'; break; case 'INSTANT': $internal_name = 'alert_email_instant'; break; } $active = TRUE; $searches = Alerts::newInstance()->findByTypeGroup($type, $active); foreach ($searches as $s_search) { // Get if there're new ads on this search $json = $s_search['s_search']; $array_conditions = (array) json_decode($json); $new_search = Search::newInstance(); $new_search->setJsonAlert($array_conditions); $new_search->addConditions(sprintf(" %st_item.dt_pub_date > '%s' ", DB_TABLE_PREFIX, $last_exec)); $items = $new_search->doSearch(); $totalItems = $new_search->count(); if (count($items) > 0) { // If we have new items from last check // Catch the user subscribed to this search $users = Alerts::newInstance()->findUsersBySearchAndType($s_search['s_search'], $type, $active); if (count($users) > 0) { $ads = ''; foreach ($items as $item) { $ads .= '<a href="' . osc_item_url_ns($item['pk_i_id']) . '">' . $item['s_title'] . '</a><br/>'; } foreach ($users as $user) { osc_run_hook('hook_' . $internal_name, $user, $ads, $s_search, $items, $totalItems); AlertsStats::newInstance()->increase(date('Y-m-d')); } } } } }
private function addTableHeader() { $this->addColumn('id', __('Code', 'payment_pro')); $this->addColumn('description', __('Product', 'payment_pro')); $this->addColumn('amount', __('Price', 'payment_pro')); $this->addColumn('quantity', __('Quantity', 'payment_pro')); $this->addColumn('total', __('Total', 'payment_pro')); $this->addColumn('delete', __('Delete', 'payment_pro')); $dummy =& $this; osc_run_hook("payment_pro_table", $dummy); }
/** * Add toolbar menus and add menus running hook add_admin_toolbar_menus */ function add_menus() { // User related, aligned right. osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_menu', 0); osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_comments', 0); osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_spam', 0); osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_update_themes', 0); osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_update_plugins', 0); osc_add_hook('add_admin_toolbar_menus', 'osc_admin_toolbar_logout', 0); osc_run_hook('add_admin_toolbar_menus'); }
private function addTableHeader() { $this->addColumn('status-border', ''); $this->addColumn('status', __('Status')); $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('author', __('Author')); $this->addColumn('comment', __('Comment')); $this->addColumn('date', __('Date')); $dummy =& $this; osc_run_hook("admin_comments_table", $dummy); }
public function deleteLocale($locale) { osc_run_hook('delete_locale', $locale); $this->conn->osc_dbExec("DELETE FROM %st_category_description WHERE fk_c_locale_code = '" . $locale . "'", DB_TABLE_PREFIX); $this->conn->osc_dbExec("DELETE FROM %st_item_description WHERE fk_c_locale_code = '" . $locale . "'", DB_TABLE_PREFIX); $this->conn->osc_dbExec("DELETE FROM %st_keywords WHERE fk_c_locale_code = '" . $locale . "'", DB_TABLE_PREFIX); $this->conn->osc_dbExec("DELETE FROM %st_user_description WHERE fk_c_locale_code = '" . $locale . "'", DB_TABLE_PREFIX); $this->conn->osc_dbExec("DELETE FROM %st_pages_description WHERE fk_c_locale_code = '" . $locale . "'", DB_TABLE_PREFIX); $this->conn->osc_dbExec("DELETE FROM %st_country WHERE fk_c_locale_code = '" . $locale . "'", DB_TABLE_PREFIX); $this->conn->osc_dbExec("DELETE FROM %st_locale WHERE pk_c_code = '" . $locale . "'", DB_TABLE_PREFIX); }
private function addTableHeader() { $this->addColumn('status', __('Status')); $this->addColumn('date', __('Date')); $this->addColumn('items', __('Items')); $this->addColumn('amount', __('Amount')); $this->addColumn('user', __('User')); $this->addColumn('email', __('Email')); $this->addColumn('code', __('Tx ID')); $this->addColumn('source', __('source')); $dummy =& $this; osc_run_hook("admin_payment_pro_invoices_table", $dummy); }
private function addTableHeader() { $this->addColumn('status-border', ''); $this->addColumn('status', __('Status')); $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('email', __('E-mail')); $this->addColumn('username', __('Username')); $this->addColumn('name', __('Name')); $this->addColumn('date', __('Date')); $this->addColumn('items', __('Items')); $this->addColumn('update_date', __('Update date')); $dummy =& $this; osc_run_hook("admin_users_table", $dummy); }
/** * Remove resources from disk * @param <type> $id * @return boolean */ function osc_deleteResource($id) { if (is_array($id)) { $id = $id[0]; } $resource = ItemResource::newInstance()->findByPrimaryKey($id); if (!is_null($resource)) { $resource_original = osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "." . $resource['s_extension']; $resource_thum = osc_base_path() . $resource['s_path'] . $resource['pk_i_id'] . "_*" . "." . $resource['s_extension']; array_map("unlink", glob($resource_thum)); array_map("unlink", glob($resource_original)); osc_run_hook('delete_resource', $resource); } }
private function addTableHeader() { $arg_date = '&sort=date'; if (Params::getParam('sort') == 'date') { if (Params::getParam('direction') == 'desc') { $arg_date .= '&direction=asc'; } } $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('email', __('E-mail')); $this->addColumn('alert', __('Alert')); $this->addColumn('date', __('Date')); $dummy =& $this; osc_run_hook("admin_alerts_table", $dummy); }
private function addTableHeader() { $arg_date = '&sort=date'; if (Params::getParam('sort') == 'date') { if (Params::getParam('direction') == 'desc') { $arg_date .= '&direction=asc'; } } $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('internal_name', __('Internal name')); $this->addColumn('title', __('Title')); $this->addColumn('order', __('Order')); $dummy =& $this; osc_run_hook("admin_users_table", $dummy); }
private function addTableHeader() { $arg_date = '&sort=date'; if (Params::getParam('sort') == 'date') { if (Params::getParam('direction') == 'desc') { $arg_date .= '&direction=asc'; } } $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />'); $this->addColumn('file', __('File')); $this->addColumn('action', __('Action')); $this->addColumn('attached_to', __('Attached to')); $this->addColumn('date', __('Date')); $dummy =& $this; osc_run_hook("admin_media_table", $dummy); }
public function deleteUser($id = null) { if ($id != null) { osc_run_hook('delete_user', $id); $items = $this->conn->osc_dbFetchResults("SELECT pk_i_id FROM %st_item WHERE fk_i_user_id = %d", DB_TABLE_PREFIX, $id); $itemManager = Item::newInstance(); foreach ($items as $item) { $itemManager->deleteByPrimaryKey($item['pk_i_id']); } $this->conn->osc_dbExec('DELETE FROM %st_user_email_tmp WHERE fk_i_user_id = %d', DB_TABLE_PREFIX, $id); $this->conn->osc_dbExec('DELETE FROM %st_user_description WHERE fk_i_user_id = %d', DB_TABLE_PREFIX, $id); $this->conn->osc_dbExec('DELETE FROM %st_alerts WHERE fk_i_user_id = %d', DB_TABLE_PREFIX, $id); $this->conn->osc_dbExec('DELETE FROM %st_user WHERE pk_i_id = %d', DB_TABLE_PREFIX, $id); return true; } return false; }
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'); }
<div class="controls"> <?php UserForm::info_textarea('s_info', osc_current_user_locale(), @$osc_user['locale'][osc_current_user_locale()]['s_info']); ?> </div> </div> <?php osc_run_hook('user_profile_form', osc_user()); ?> <div class="form-group"> <div class="controls"> <button type="submit" class="btn btn-success"> <?php _e("Update", OSCLASSWIZARDS_THEME_FOLDER); ?> </button> </div> </div> <div class="form-group"> <div class="controls"> <?php osc_run_hook('user_form', osc_user()); ?> </div> </div> </form> </div> </div> </div> <?php osc_current_web_theme_path('footer.php');
<div class="controls textarea"> <?php SendFriendForm::your_message(); ?> </div> </div> <div class="control-group"> <div class="controls"> <?php osc_run_hook('contact_form'); ?> <?php osc_show_recaptcha(); ?> <button type="submit" class="ui-button ui-button-middle ui-button-main"><?php _e("Send", 'bender'); ?> </button> <?php osc_run_hook('admin_contact_form'); ?> </div> </div> </form> <?php SendFriendForm::js_validation(); ?> </div> </div> <?php osc_current_web_theme_path('footer.php');
public function sendEmails($aItem){ $item = $aItem['item']; View::newInstance()->_exportVariableToView('item', $item); /** * Send email to non-reg user requesting item activation */ if( Session::newInstance()->_get('userId') == '' && $aItem['active']=='INACTIVE' ) { osc_run_hook('hook_email_item_validation_non_register_user', $item); } else if ( $aItem['active']=='INACTIVE' ) { // USER IS REGISTERED osc_run_hook('hook_email_item_validation', $item); } else if( Session::newInstance()->_get('userId') == '' ){ // USER IS NOT REGISTERED osc_run_hook('hook_email_new_item_non_register_user', $item); } /** * Send email to admin about the new item */ if (osc_notify_new_item()) { osc_run_hook('hook_email_admin_new_item', $item); } }
/** * Delete by primary key, delete dependencies too * * @access public * @since unknown * @param int $id Item id * @return bool */ public function deleteByPrimaryKey($id) { $item = $this->findByPrimaryKey($id); if ( is_null($item) ) { return false; } if( $item['b_active'] == 1 && $item['b_enabled']==1 && $item['b_spam']==0 && !osc_isExpired($item['dt_expiration'])) { if($item['fk_i_user_id']!=null) { User::newInstance()->decreaseNumItems($item['fk_i_user_id']); } CategoryStats::newInstance()->decreaseNumItems($item['fk_i_category_id']); CountryStats::newInstance()->decreaseNumItems($item['fk_c_country_code']); RegionStats::newInstance()->decreaseNumItems($item['fk_i_region_id']); CityStats::newInstance()->decreaseNumItems($item['fk_i_city_id']); } $this->deleteResourcesFromHD($id); $this->dao->delete(DB_TABLE_PREFIX.'t_item_description', "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_comment' , "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_resource', "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_location', "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_stats' , "fk_i_item_id = $id"); $this->dao->delete(DB_TABLE_PREFIX.'t_item_meta' , "fk_i_item_id = $id"); osc_run_hook('delete_item', $id); $res = parent::deleteByPrimaryKey($id); return $res; }