private function processData($products) { if (!empty($products)) { $total = 0; foreach ($products as $aRow) { $row = array(); $row['id'] = $aRow['id']; $row['description'] = $aRow['description']; $row['amount'] = osc_format_price(1000000 * $aRow['amount'], osc_get_preference('currency', 'payment_pro')); $row['quantity'] = $aRow['quantity']; $row['total'] = osc_format_price(1000000 * $aRow['amount'] * $aRow['quantity'], osc_get_preference('currency', 'payment_pro')); $row['delete'] = '<a href="' . osc_route_url('payment-pro-cart-delete', array('id' => $aRow['id'])) . '" >' . __('Delete', 'payment_pro') . '</a>'; $row = osc_apply_filter('payment_pro_processing_row', $row, $aRow); $this->addRow($row); $this->rawRows[] = $aRow; $total += $aRow['amount'] * $aRow['quantity']; } $row = array(); $row['id'] = ''; $row['description'] = ''; $row['amount'] = ''; $row['quantity'] = '<b>' . __('Total', 'payment_pro') . '</b>'; $row['total'] = '<b>' . osc_format_price(1000000 * $total, osc_get_preference('currency', 'payment_pro')) . '</b>'; $row['delete'] = ''; $this->addRow($row); //$this->rawRows[] = $row; } }
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'); $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 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 fjs_search() { echo "\n"; ?> var sQuery = '<?php echo osc_esc_js(osc_get_preference('keyword_placeholder', 'seeker')); ?> ' ; $(document).ready(function(){ var element = $('input[name="sPattern"]'); element.focus(function(){ $(this).prev().hide(); }).blur(function(){ if($(this).val() == '') { $(this).prev().show(); } }).prev().click(function(){ $(this).hide(); $(this).next().focus(); }); if(element.val() != ''){ element.prev().hide(); } }); function doSearch() { var sPattern = $('input[name=sPattern]'); if(sPattern.val() == ''){ return false; } return true; } <?php }
public function __construct() { parent::__construct(); $this->setTableName('t_facebook_connect'); $this->setPrimaryKey('fk_i_user_id'); $this->setFields(array('fk_i_user_id', 'i_facebook_uid')); self::$facebook = new Facebook(array('appId' => osc_get_preference('fbc_appId', 'facebook_connect'), 'secret' => osc_get_preference('fbc_secret', 'facebook_connect'))); }
function show_qrcode() { $filename = osc_item_id() . "_" . md5(osc_item_url()) . "_" . osc_get_preference("code_size", "qrcode") . ".png"; if (!file_exists(osc_get_preference('upload_path', 'qrcode') . $filename)) { qrcode_generateqr(osc_item_url(), osc_item_id()); } echo '<img src="' . osc_get_preference('upload_url', 'qrcode') . $filename . '" alt="QR CODE" id="qrcode_' . osc_item_id() . '" class="qrcode" />'; }
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 customHead() { $all = osc_get_preference('location_todo'); if ($all == '') { $all = 0; } $worktodo = LocationsTmp::newInstance()->count(); ?> <script type="text/javascript"> function reload() { window.location = '<?php echo osc_admin_base_url(true) . '?page=tools&action=locations'; ?> '; } function ajax_() { $.ajax({ type: "POST", url: '<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=location_stats&<?php echo osc_csrf_token_url(); ?> ', dataType: 'json', success: function(data) { if(data.status=='done') { $('span#percent').html(100); }else{ var pending = data.pending; var all = <?php echo osc_esc_js($all); ?> ; var percent = parseInt( ((all-pending)*100) / all ); $('span#percent').html(percent); ajax_(); } } }); } $(document).ready(function(){ if(<?php echo $worktodo; ?> > 0) { ajax_(); } }); </script> <?php }
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(); } }
public static function button($amount = '0.00', $description = '', $itemnumber = '101', $extra_array = null) { $extra = payment_prepare_custom($extra_array); $r = rand(0, 1000); $extra .= 'random,' . $r; $apcs = self::customToAPC($extra); $RETURNURL = osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__) . 'return.php?extra=' . $extra; $CANCELURL = osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__) . 'cancel.php?extra=' . $extra; ?> <form method="post" action="https://secure.payza.com/checkout" > <input type="hidden" name="ap_merchant" value="*****@*****.**"/> <input type="hidden" name="ap_purchasetype" value="service"/> <input type="hidden" name="ap_itemname" value="<?php echo $description; ?> "/> <input type="hidden" name="ap_amount" value="<?php echo $amount; ?> "/> <input type="hidden" name="ap_currency" value="<?php echo osc_get_preference('currency', 'payment'); ?> "/> <input type="hidden" name="ap_quantity" value="1"/> <input type="hidden" name="ap_itemcode" value="<?php echo $itemnumber; ?> "/> <input type="hidden" name="ap_description" value="Audio equipment"/> <input type="hidden" name="ap_returnurl" value="<?php echo $RETURNURL; ?> "/> <input type="hidden" name="ap_cancelurl" value="<?php echo $CANCELURL; ?> "/> <?php foreach ($apcs as $k => $v) { echo '<input type="hidden" name="apc_' . $k . '" value="' . $v . '"/>'; } ?> <input type="image" src="<?php echo osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__); ?> payza-buy-now.png"/> </form> <?php }
/** * List all email datas stored in the database. * @return Array the complete list of datas for emails and footer. Ready to use. */ public function listAll() { // Retrieve email datas from database. $datas = json_decode(osc_get_preference("email_datas", mdh_current_preferences_section()), true); if (!is_array($datas)) { // TODO. Handle error. } // Retrieve all emails from database; $emails = Page::newInstance()->listAll(true); $activeLocales = Madhouse_Utils_Collections::getFieldsFromList(osc_get_locales(), "pk_c_code"); // Complete the list of emails with new mails (not already in the JSON). foreach ($emails as $e) { if (!in_array($e["s_internal_name"], Madhouse_Utils_Collections::getFieldsFromList($datas["emails"], "s_internal_name"))) { array_push($datas["emails"], Madhouse_EmailMagick_Utils::newEmptyEmail($e["s_internal_name"])); } } // Complete, filter and sort emails. $datas["emails"] = Madhouse_Utils_Collections::sortListByField(array_map(function ($e) use($emails, $activeLocales) { $row = Madhouse_Utils_Collections::findByField($emails, "s_internal_name", $e["s_internal_name"]); $e["pk_i_id"] = $row["pk_i_id"]; // Compute the filling rate. $e["i_filled"] = Madhouse_EmailMagick_Utils::computeFillingRate($e); // Is the email still exists ? (in oc_t_pages) if (!in_array($e["s_internal_name"], Madhouse_Utils_Collections::getFieldsFromList($emails, "s_internal_name"))) { $e["b_deleted"] = true; } // Add a locale for locales that have not been provided. foreach ($activeLocales as $al) { $el = Madhouse_Utils_Collections::findByField($e["locales"], "fk_c_locale_code", $al); if (is_null($el)) { array_push($e["locales"], Madhouse_EmailMagick_Utils::newEmptyLocale($al)); } } $e["locales"] = array_values(array_filter($e["locales"], function ($v) use($activeLocales) { return in_array($v["fk_c_locale_code"], $activeLocales); })); return $e; }, $datas["emails"]), "s_internal_name"); // Filter the footer datas (only active locales are left). $datas["footer"]["locales"] = array_values(array_filter($datas["footer"]["locales"], function ($v) use($activeLocales) { return in_array($v["fk_c_locale_code"], $activeLocales); })); // Add a locale for locales that have not been provided. foreach ($activeLocales as $al) { $fl = Madhouse_Utils_Collections::findByField($datas["footer"]["locales"], "fk_c_locale_code", $al); if (is_null($fl)) { array_push($datas["footer"]["locales"], Madhouse_EmailMagick_Utils::newEmptyLocale($al)); } } return $datas; }
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 cookie_load() { ?> <script type="text/javascript" > $(document).ready(function () { var options = new Object(); <?php if (osc_get_preference('accept', 'cookie') == 1) { echo 'options.cookieAcceptButton = true;'; } if (osc_get_preference('decline', 'cookie') == 1) { echo 'options.cookieDeclineButton = true;'; } if (osc_get_preference('reset', 'cookie') == 1) { echo 'options.cookieResetButton = true;'; } echo "options.cookiePolicyLink = '" . osc_esc_js(osc_get_preference('policy_link', 'cookie')) . "';"; echo "options.cookieWhatAreTheyLink = '" . osc_esc_js(osc_get_preference('what_are_link', 'cookie')) . "';"; echo "options.cookieAnalyticsMessage = '" . str_replace("'", "\\'", osc_get_preference('analytics_msg', 'cookie')) . "';"; echo "options.cookieMessage = '" . str_replace("'", "\\'", osc_get_preference('non_analytics_msg', 'cookie')) . "';"; if (osc_get_preference('analytics_id', 'cookie') != '') { ?> options.cookieAnalytics = true; if (jQuery.cookie('cc_cookie_decline') == "cc_cookie_decline") { } else { var _gaq = _gaq || []; _gaq.push(['_setAccount', '<?php echo osc_get_preference('analytics_id', 'cookie'); ?> ']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document. getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); } <?php } else { echo 'options.cookieAnalytics = false;'; } ?> $.cookieCuttr(options); }); </script> <?php }
/** * Generates emails from the templates & datas. * - For each emails and for each active locale : * - Check if the emails is empty or does not exists anymore. If so, do nothing. * - Combines templates and datas to produce the s_title and s_text fields. * - Saves those settings for next run. * @return void. */ public function update() { // Decode and transform into a PHP array (true as a second parameter). $data = json_decode(Params::getParam("email_datas", false, false), true); if (!is_array($data)) { mdh_handle_error(sprintf(__("Given JSON datas are not correct (Error #%d)", mdh_current_plugin_name()), json_last_error()), mdh_emailmagick_url()); } // Get the HTML template. $template = Params::getParam("email_template", false, false); // This is current emails datas (stored in the database). $currentDatas = json_decode(osc_get_preference("email_datas", mdh_current_preferences_section()), true); // Create a new array, merge of the old and the new one. $newDatas = array("emails" => array(), "footer" => array("locales" => Madhouse_EmailMagick_Utils::mergeLocales($currentDatas["footer"]["locales"], $data["footer"]["locales"]))); // Iterate through new submitted emails data to update. $i = 0; foreach ($data["emails"] as $e) { // Get the old email datas, as they are right now. $oe = Madhouse_Utils_Collections::findByField($currentDatas["emails"], "s_internal_name", $e["s_internal_name"]); if (is_null($oe)) { // Not found in old emails. => new email has been installed. $locales = $e["locales"]; } else { // Found in old emails. Merge with new locales. $locales = Madhouse_EmailMagick_Utils::mergeLocales($oe["locales"], $e["locales"]); } // Email exists, create in order to be filled and pushed to the new datas (at the end). $nEmail = array("s_internal_name" => $e["s_internal_name"], "locales" => $locales); // Get the email from the database. $email = Page::newInstance()->findByInternalName($e["s_internal_name"]); if ($email !== false && count($email) > 0) { // Update the email. $updated = Madhouse_EmailMagick_Models_Emails::newInstance()->update($template, $email["pk_i_id"], $newDatas, $nEmail); $i += $updated; } array_push($newDatas["emails"], $nEmail); } // Saves the settings. Madhouse_Utils_Controllers::doSettingsPost(array("email_template", "email_datas"), array("email_template" => $template, "email_datas" => json_encode($newDatas)), mdh_emailmagick_url(), null, sprintf(__("Sucessfully updated %d emails (out of %d)!", mdh_current_plugin_name()), $i, count($data["emails"]) * count(osc_get_locales()))); }
function osc_google_analytics_id() { return osc_get_preference('google_analytics_id', 'plugin-google_analytics'); }
public static function processPayment() { if (osc_get_preference('coinjar_sandbox', 'payment') != 1) { $coinjar = new CoinJar(payment_decrypt(osc_get_preference('coinjar_merchant_user', 'payment')), payment_decrypt(osc_get_preference('coinjar_merchant_password', 'payment')), payment_decrypt(osc_get_preference('coinjar_api_key', 'payment'))); } else { $coinjar = new CoinJar(payment_decrypt(osc_get_preference('coinjar_sb_merchant_user', 'payment')), payment_decrypt(osc_get_preference('coinjar_sb_merchant_password', 'payment')), payment_decrypt(osc_get_preference('coinjar_sb_api_key', 'payment')), true); } // data from the post (it's supposed to be sent by CoinJar, is sent by POST!) if (Params::existParam('uuid') && Params::existParam('amount') && Params::existParam('currency') && Params::existParam('status') && Params::existParam('ipn_digest')) { if (Params::getParam('status') == 'COMPLETED') { $digest = $coinjar->IPNDigest(Params::getParam('uuid'), Params::getParam('amount'), Params::getParam('currency'), Params::getParam('status')); if ($digest == Params::getParam('ipn_digest')) { $order = json_decode($coinjar->order(Params::getParam('uuid'))); if ($order != null) { if (Params::getParam('amount') == $order->order->amount && Params::getParam('currency') == $order->order->currency && Params::getParam('status') == $order->order->status) { $payment = ModelPayment::newInstance()->getPayment($order->order->uuid); if (!$payment) { $data = payment_get_custom(Params::getParam('extra')); $product_type = explode('x', Params::getParam('item_number')); // SAVE TRANSACTION LOG $payment_id = ModelPayment::newInstance()->saveLog($data['concept'], $order->order->uuid, $order->order->amount, $order->order->currenct, $data['email'], $data['user'], $data['itemid'], $product_type[0], 'COINJAR'); //source if ($product_type[0] == '101') { ModelPayment::newInstance()->payPublishFee($product_type[2], $payment_id); } else { if ($product_type[0] == '201') { ModelPayment::newInstance()->payPremiumFee($product_type[2], $payment_id); } else { ModelPayment::newInstance()->addWallet($data['user'], $order->order->amount); } } return PAYMENT_COMPLETED; } else { return PAYMENT_ALREADY_PAID; } } } } } } return PAYMENT_PENDING; }
public static function currency_select($currencies = null, $item = null) { if ($currencies == null) { $currencies = osc_get_currencies(); } if ($item == null) { $item = osc_item(); } if (Session::newInstance()->_getForm('currency') != '') { $item['fk_c_currency_code'] = Session::newInstance()->_getForm('currency'); } if (count($currencies) > 1) { $default_key = null; $currency = osc_get_preference('currency'); if (isset($item['fk_c_currency_code'])) { $default_key = $item['fk_c_currency_code']; } elseif (isset($currency)) { $default_key = $currency; } parent::generic_select('currency', $currencies, 'pk_c_code', 's_description', null, $default_key); } else { if (count($currencies) == 1) { parent::generic_input_hidden("currency", $currencies[0]["pk_c_code"]); echo $currencies[0]['s_description']; } } }
* Copyright (C) 2010 OSCLASS * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * 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/>. */ $sQuery = osc_get_preference('keyword_placeholder', 'modern_theme'); ?> <script type="text/javascript"> var sQuery = '<?php echo osc_esc_js($sQuery); ?> ' ; $(document).ready(function(){ if($('input[name=sPattern]').val() == sQuery) { $('input[name=sPattern]').css('color', 'gray'); } $('input[name=sPattern]').click(function(){ if($('input[name=sPattern]').val() == sQuery) { $('input[name=sPattern]').val(''); $('input[name=sPattern]').css('color', '');
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'); }
<div class="form-controls"><?php printf(__('Inactivated listings deleted: %d', 'butler'), osc_get_preference('activated_listings', 'butler')); ?> </div> </div> <div class="form-row"> <div class="form-controls"><?php printf(__('Spam listings deleted: %d', 'butler'), osc_get_preference('spam_listings', 'butler')); ?> </div> </div> <div class="form-row"> <div class="form-controls"><?php printf(__('Inactivated users deleted: %d', 'butler'), osc_get_preference('activated_users', 'butler')); ?> </div> </div> <div class="clear"></div> <div class="form-actions"> <input type="submit" id="save_changes" value="<?php echo osc_esc_html(__('Run Butler now')); ?> " class="btn btn-submit" /> </div> </div> </fieldset> </form>
foreach ($descriptions as $d) { $sql = sprintf("INSERT INTO %st_item_description_tmp (`fk_i_item_id` ,`fk_c_locale_code` ,`s_title` ,`s_description` ,`s_what`) VALUES ('%d', '%s', '%s', '%s', '%s')", DB_TABLE_PREFIX, $d['fk_i_item_id'], $d['fk_c_locale_code'], $comm->connId->real_escape_string($d['s_title']), $comm->connId->real_escape_string($d['s_description']), $comm->connId->real_escape_string($d['s_what'])); $comm->query($sql); } $comm->query(sprintf("RENAME TABLE `%st_item_description` TO `%st_item_description_old`", DB_TABLE_PREFIX, DB_TABLE_PREFIX)); $comm->query(sprintf("RENAME TABLE `%st_item_description_tmp` TO `%st_item_description`", DB_TABLE_PREFIX, DB_TABLE_PREFIX)); $comm->query(sprintf("ALTER TABLE %st_item_description ADD FULLTEXT s_description (s_description, s_title);", DB_TABLE_PREFIX)); // remove old tables if have the same number of rows $nItemDesc = $comm->query(sprintf('SELECT count(*) as total FROM %st_item_description', DB_TABLE_PREFIX)); $nItemDesc = $nItemDesc->row(); $nItemDescOld = $comm->query(sprintf('SELECT count(*) as total FROM %st_item_description_old', DB_TABLE_PREFIX)); $nItemDescOld = $nItemDescOld->row(); if ($nItemDesc['total'] == $nItemDescOld['total']) { $comm->query(sprintf('DROP TABLE %st_item_description_old', DB_TABLE_PREFIX)); } $comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'installed_plugins', '%s', 'STRING')", DB_TABLE_PREFIX, osc_get_preference('active_plugins'))); $comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'mailserver_pop', '', 'STRING')", DB_TABLE_PREFIX)); $comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'use_imagick', '0', 'BOOLEAN')", DB_TABLE_PREFIX)); $timezone = 'Europe/Madrid'; if (ini_get('date.timezone') != '') { $timezone = ini_get('date.timezone'); } if (date_default_timezone_get() != '') { $timezone = date_default_timezone_get(); } $comm->query(sprintf("INSERT INTO %st_preference VALUES ('osclass', 'timezone', '%s', 'STRING')", DB_TABLE_PREFIX, $timezone)); // alert table pages order improvement $comm->query(sprintf("ALTER TABLE %st_pages ADD COLUMN i_order INT(3) NOT NULL DEFAULT 0 AFTER dt_mod_date;", DB_TABLE_PREFIX)); // order pages $result = $comm->query(sprintf("SELECT pk_i_id FROM %st_pages WHERE b_indelible = 0", DB_TABLE_PREFIX)); $aPages = $result->result();
public static function recurringButton($subscription, $extra = null) { $r = rand(0, 1000); $extra['random'] = $r; $extra = payment_pro_set_custom($extra); if (osc_get_preference('paypal_sandbox', 'payment_pro') == 1) { $ENDPOINT = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } else { $ENDPOINT = 'https://www.paypal.com/cgi-bin/webscr'; } ?> <form class="nocsrf" action="<?php echo $ENDPOINT; ?> " method="post" id="paypal_<?php echo $r; ?> "> <input type="hidden" name="cmd" value="_xclick-subscriptions" /> <input type="hidden" name="notify_url" value="<?php echo osc_route_url('paypal-notify', array('extra' => $extra)); ?> " /> <input type="hidden" name="return" value="<?php echo osc_route_url('paypal-return', array('extra' => $extra)); ?> " /> <input type="hidden" name="cancel_return" value="<?php echo osc_route_url('paypal-cancel', array('extra' => $extra)); ?> " /> <input type="hidden" name="business" value="<?php echo osc_get_preference('paypal_email', 'payment_pro'); ?> " /> <input type="hidden" name="item_name" value="<?php echo $subscription['description']; ?> " /> <input type="hidden" name="a3" value="<?php echo $subscription['amount']; ?> " /> <input type="hidden" name="p3" value="<?php echo $subscription['duration']; ?> " /> <input type="hidden" name="t3" value="<?php echo $subscription['period']; ?> " /> <input type="hidden" name="src" value="1" /> <input type="hidden" name="currency_code" value="<?php echo osc_get_preference('currency', 'payment_pro'); ?> " /> <input type="hidden" name="custom" value="<?php echo $extra; ?> " /> <input type="hidden" name="no_note" value="1" /> <input type="hidden" name="charset" value="utf-8" /> </form> <div class="buttons"> <div class="right"><a style="cursor:pointer;cursor:hand" id="button-confirm" class="button" onclick="$('#paypal_<?php echo $r; ?> ').submit();"><span><img src='<?php echo PAYMENT_PRO_URL; ?> payments/paypal/subscription.gif' border='0' /></span></a></div> </div> <?php }
public static function processPayment() { require_once osc_plugins_path() . osc_plugin_folder(__FILE__) . 'lib/Braintree.php'; Braintree_Configuration::environment(osc_get_preference('braintree_sandbox', 'payment')); Braintree_Configuration::merchantId(payment_decrypt(osc_get_preference('braintree_merchant_id', 'payment'))); Braintree_Configuration::publicKey(payment_decrypt(osc_get_preference('braintree_public_key', 'payment'))); Braintree_Configuration::privateKey(payment_decrypt(osc_get_preference('braintree_private_key', 'payment'))); $data = payment_get_custom(Params::getParam('extra')); $tmp = explode('x', $data['product']); if (count($tmp) > 1) { $amount = $tmp[1]; } else { return PAYMENT_FAILED; } $result = Braintree_Transaction::sale(array('amount' => $amount, 'creditCard' => array('number' => Params::getParam('braintree_number'), 'cvv' => Params::getParam('braintree_cvv'), 'expirationMonth' => Params::getParam('braintree_month'), 'expirationYear' => Params::getParam('braintree_year')), 'options' => array('submitForSettlement' => true))); print_r($result); if ($result->success == 1) { Params::setParam('braintree_transaction_id', $result->transaction->id); $exists = ModelPayment::newInstance()->getPaymentByCode($result->transaction->id, 'BRAINTREE'); if (isset($exists['pk_i_id'])) { return PAYMENT_ALREADY_PAID; } $product_type = explode('x', $data['product']); // SAVE TRANSACTION LOG $payment_id = ModelPayment::newInstance()->saveLog($data['concept'], $result->transaction->id, $result->transaction->amount, $result->transaction->currencyIsoCode, $data['email'], $data['user'], $data['itemid'], $product_type[0], 'BRAINTREE'); //source if ($product_type[0] == '101') { ModelPayment::newInstance()->payPublishFee($product_type[2], $payment_id); } else { if ($product_type[0] == '201') { ModelPayment::newInstance()->payPremiumFee($product_type[2], $payment_id); } else { ModelPayment::newInstance()->addWallet($data['user'], $result->transaction->amount); } } return PAYMENT_COMPLETED; } else { return PAYMENT_FAILED; } }
<?php ItemForm::region_text(osc_user()); ?> <?php } ?> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label" for="city"><?php _e('City', 'flatter'); ?> </label> <div class="col-sm-8"> <?php if (osc_get_preference('location_input', 'flatter_theme') == '1') { ?> <?php ItemForm::city_select(osc_get_cities(), osc_user()); ?> <?php } else { ?> <?php ItemForm::city_text(osc_user()); ?> <?php } ?> </div> </div>
echo osc_get_preference('blockchain_enabled', 'payment_pro') ? 'checked="true"' : ''; ?> name="blockchain_enabled" value="1" /> <?php _e('Enable Blockchain as a method of payment', 'payment_pro'); ?> </label> </div> </div> </div> <div class="form-row blockchain hide"> <div class="form-label"><?php _e('Bitcoin address', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="blockchain_btc_address" value="<?php echo osc_get_preference('blockchain_btc_address', 'payment_pro'); ?> " /></div> </div> <div class="form-row blockchain hide"> <div class="form-label"><?php _e('Bitcoin confirmations (default = 6)', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xsmall" name="blockchain_confirmations" value="<?php echo osc_get_preference('blockchain_confirmations', 'payment_pro'); ?> " /></div> </div>
function doModel() { osc_run_hook('before_search'); $mCategories = Category::newInstance(); if (osc_rewrite_enabled()) { // IF rewrite is not enabled, skip this part, preg_match is always time&resources consuming task $p_sParams = "/" . Params::getParam('sParams', false, false); if (preg_match_all('|\\/([^,]+),([^\\/]*)|', $p_sParams, $m)) { $l = count($m[0]); for ($k = 0; $k < $l; $k++) { switch ($m[1][$k]) { case osc_get_preference('rewrite_search_country'): $m[1][$k] = 'sCountry'; break; case osc_get_preference('rewrite_search_region'): $m[1][$k] = 'sRegion'; break; case osc_get_preference('rewrite_search_city'): $m[1][$k] = 'sCity'; break; case osc_get_preference('rewrite_search_city_area'): $m[1][$k] = 'sCityArea'; break; case osc_get_preference('rewrite_search_category'): $m[1][$k] = 'sCategory'; break; case osc_get_preference('rewrite_search_user'): $m[1][$k] = 'sUser'; break; case osc_get_preference('rewrite_search_pattern'): $m[1][$k] = 'sPattern'; break; default: break; } $_REQUEST[$m[1][$k]] = $m[2][$k]; $_GET[$m[1][$k]] = $m[2][$k]; unset($_REQUEST['sParams']); unset($_GET['sParams']); unset($_POST['sParams']); } } } //////////////////////////////// //GETTING AND FIXING SENT DATA// //////////////////////////////// $p_sCategory = Params::getParam('sCategory'); if (!is_array($p_sCategory)) { if ($p_sCategory == '') { $p_sCategory = array(); } else { $p_sCategory = explode(",", $p_sCategory); } } $p_sCityArea = Params::getParam('sCityArea'); if (!is_array($p_sCityArea)) { if ($p_sCityArea == '') { $p_sCityArea = array(); } else { $p_sCityArea = explode(",", $p_sCityArea); } } $p_sCity = Params::getParam('sCity'); if (!is_array($p_sCity)) { if ($p_sCity == '') { $p_sCity = array(); } else { $p_sCity = explode(",", $p_sCity); } } $p_sRegion = Params::getParam('sRegion'); if (!is_array($p_sRegion)) { if ($p_sRegion == '') { $p_sRegion = array(); } else { $p_sRegion = explode(",", $p_sRegion); } } $p_sCountry = Params::getParam('sCountry'); if (!is_array($p_sCountry)) { if ($p_sCountry == '') { $p_sCountry = array(); } else { $p_sCountry = explode(",", $p_sCountry); } } $p_sUser = Params::getParam('sUser'); if (!is_array($p_sUser)) { if ($p_sUser == '') { $p_sUser = ''; } else { $p_sUser = explode(",", $p_sUser); } } $p_sPattern = strip_tags(Params::getParam('sPattern')); // ADD TO THE LIST OF LAST SEARCHES if (osc_save_latest_searches()) { if (trim($p_sPattern) != '') { LatestSearches::newInstance()->insert(array('s_search' => trim($p_sPattern), 'd_date' => date('Y-m-d H:i:s'))); } } $p_bPic = Params::getParam('bPic'); $p_bPic == 1 ? $p_bPic = 1 : ($p_bPic = 0); $p_sPriceMin = Params::getParam('sPriceMin'); $p_sPriceMax = Params::getParam('sPriceMax'); //WE CAN ONLY USE THE FIELDS RETURNED BY Search::getAllowedColumnsForSorting() $p_sOrder = Params::getParam('sOrder'); if (!in_array($p_sOrder, Search::getAllowedColumnsForSorting())) { $p_sOrder = osc_default_order_field_at_search(); } $old_order = $p_sOrder; //ONLY 0 ( => 'asc' ), 1 ( => 'desc' ) AS ALLOWED VALUES $p_iOrderType = Params::getParam('iOrderType'); $allowedTypesForSorting = Search::getAllowedTypesForSorting(); $orderType = osc_default_order_type_at_search(); foreach ($allowedTypesForSorting as $k => $v) { if ($p_iOrderType == $v) { $orderType = $k; break; } } $p_iOrderType = $orderType; $p_sFeed = Params::getParam('sFeed'); $p_iPage = 0; if (is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') > 0) { $p_iPage = intval(Params::getParam('iPage')) - 1; } if ($p_sFeed != '') { $p_sPageSize = 1000; } $p_sShowAs = Params::getParam('sShowAs'); $aValidShowAsValues = array('list', 'gallery'); if (!in_array($p_sShowAs, $aValidShowAsValues)) { $p_sShowAs = osc_default_show_as_at_search(); } // search results: it's blocked with the maxResultsPerPage@search defined in t_preferences $p_iPageSize = intval(Params::getParam('iPagesize')); if ($p_iPageSize > 0) { if ($p_iPageSize > osc_max_results_per_page_at_search()) { $p_iPageSize = osc_max_results_per_page_at_search(); } } else { $p_iPageSize = osc_default_results_per_page_at_search(); } //FILTERING CATEGORY $bAllCategoriesChecked = false; if (count($p_sCategory) > 0) { foreach ($p_sCategory as $category) { $this->mSearch->addCategory($category); } } else { $bAllCategoriesChecked = true; } //FILTERING CITY_AREA foreach ($p_sCityArea as $city_area) { $this->mSearch->addCityArea($city_area); } $p_sCityArea = implode(", ", $p_sCityArea); //FILTERING CITY foreach ($p_sCity as $city) { $this->mSearch->addCity($city); } $p_sCity = implode(", ", $p_sCity); //FILTERING REGION foreach ($p_sRegion as $region) { $this->mSearch->addRegion($region); } $p_sRegion = implode(", ", $p_sRegion); //FILTERING COUNTRY foreach ($p_sCountry as $country) { $this->mSearch->addCountry($country); } $p_sCountry = implode(", ", $p_sCountry); // FILTERING PATTERN if ($p_sPattern != '') { $this->mSearch->addPattern($p_sPattern); $osc_request['sPattern'] = $p_sPattern; } else { // hardcoded - if there isn't a search pattern, order by dt_pub_date desc if ($p_sOrder == 'relevance') { $p_sOrder = 'dt_pub_date'; foreach ($allowedTypesForSorting as $k => $v) { if ($p_iOrderType == 'desc') { $orderType = $k; break; } } $p_iOrderType = $orderType; } } // FILTERING USER if ($p_sUser != '') { $this->mSearch->fromUser($p_sUser); } // FILTERING IF WE ONLY WANT ITEMS WITH PICS if ($p_bPic) { $this->mSearch->withPicture(true); } //FILTERING BY RANGE PRICE $this->mSearch->priceRange($p_sPriceMin, $p_sPriceMax); //ORDERING THE SEARCH RESULTS $this->mSearch->order($p_sOrder, $allowedTypesForSorting[$p_iOrderType]); //SET PAGE $this->mSearch->page($p_iPage, $p_iPageSize); osc_run_hook('search_conditions', Params::getParamsAsArray()); if (!Params::existParam('sFeed')) { // RETRIEVE ITEMS AND TOTAL $aItems = $this->mSearch->doSearch(); $iTotalItems = $this->mSearch->count(); $iStart = $p_iPage * $p_iPageSize; $iEnd = min(($p_iPage + 1) * $p_iPageSize, $iTotalItems); $iNumPages = ceil($iTotalItems / $p_iPageSize); osc_run_hook('search', $this->mSearch); //preparing variables... $regionName = $p_sRegion; if (is_numeric($p_sRegion)) { $r = Region::newInstance()->findByPrimaryKey($p_sRegion); if ($r) { $regionName = $r['s_name']; } } $cityName = $p_sCity; if (is_numeric($p_sCity)) { $c = City::newInstance()->findByPrimaryKey($p_sCity); if ($c) { $cityName = $c['s_name']; } } //$this->_exportVariableToView('non_empty_categories', $aCategories) ; $this->_exportVariableToView('search_start', $iStart); $this->_exportVariableToView('search_end', $iEnd); $this->_exportVariableToView('search_category', $p_sCategory); // hardcoded - non pattern and order by relevance $p_sOrder = $old_order; $this->_exportVariableToView('search_order_type', $p_iOrderType); $this->_exportVariableToView('search_order', $p_sOrder); $this->_exportVariableToView('search_pattern', $p_sPattern); $this->_exportVariableToView('search_from_user', $p_sUser); $this->_exportVariableToView('search_total_pages', $iNumPages); $this->_exportVariableToView('search_page', $p_iPage); $this->_exportVariableToView('search_has_pic', $p_bPic); $this->_exportVariableToView('search_region', $regionName); $this->_exportVariableToView('search_city', $cityName); $this->_exportVariableToView('search_price_min', $p_sPriceMin); $this->_exportVariableToView('search_price_max', $p_sPriceMax); $this->_exportVariableToView('search_total_items', $iTotalItems); $this->_exportVariableToView('items', $aItems); $this->_exportVariableToView('search_show_as', $p_sShowAs); $this->_exportVariableToView('search', $this->mSearch); // json $json = $this->mSearch->toJson(); $this->_exportVariableToView('search_alert', base64_encode($json)); //calling the view... $this->doView('search.php'); } else { $this->mSearch->page(0, osc_num_rss_items()); // RETRIEVE ITEMS AND TOTAL $iTotalItems = $this->mSearch->count(); $aItems = $this->mSearch->doSearch(); $this->_exportVariableToView('items', $aItems); if ($p_sFeed == '' || $p_sFeed == 'rss') { // FEED REQUESTED! header('Content-type: text/xml; charset=utf-8'); $feed = new RSSFeed(); $feed->setTitle(__('Latest listings added') . ' - ' . osc_page_title()); $feed->setLink(osc_base_url()); $feed->setDescription(__('Latest listings added in') . ' ' . osc_page_title()); if (osc_count_items() > 0) { while (osc_has_items()) { if (osc_count_item_resources() > 0) { osc_has_item_resources(); $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8"), 'description' => osc_item_description(), 'dt_pub_date' => osc_item_pub_date(), 'image' => array('url' => htmlentities(osc_resource_thumbnail_url(), ENT_COMPAT, "UTF-8"), 'title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8")))); } else { $feed->addItem(array('title' => osc_item_title(), 'link' => htmlentities(osc_item_url(), ENT_COMPAT, "UTF-8"), 'description' => osc_item_description(), 'dt_pub_date' => osc_item_pub_date())); } } } osc_run_hook('feed', $feed); $feed->dumpXML(); } else { osc_run_hook('feed_' . $p_sFeed, $aItems); } } }
/** * Return layout optimized for sidebar at main web page, with the best user voted with a limit * * @param int $num number of users */ function echo_users_best_rated($num = 5) { if (osc_get_preference('user_voting', 'voting') == 1) { $filter = array('order' => 'desc', 'num_items' => $num); $results = get_user_votes($filter); if (count($results) > 0) { $locale = osc_current_user_locale(); require 'set_results_user.php'; } } }
/** * Function that getting api settings. */ function facebookall_get_fb_contents($url) { $connection = osc_get_preference('connection', 'classified'); if ($connection == 'curl') { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($curl); } else { $response = @file_get_contents($url); } return $response; }
} ?> <?php } ?> </div><!-- owl carousel --> </div> </div><!-- row --> </div> </div> </div><!-- Section 4 --> <div class="section"> <div class="postadspace"> <div class="container"> <h2><?php echo osc_get_preference("fpromo_text", "flatter_theme"); ?> </h2> <p><?php _e("Over", 'flatter'); ?> <strong><?php echo osc_total_active_items(); ?> <?php _e("Ads", 'flatter'); ?> </strong> <?php _e("listed in", 'flatter'); ?> <strong><?php
_e("Mark as offensive", 'bender'); ?> </option> </select> </form> <?php } ?> <?php if (osc_get_preference('sidebar-300x250', 'bender') != '') { ?> <!-- sidebar ad 350x250 --> <div class="ads_300"> <?php echo osc_get_preference('sidebar-300x250', 'bender'); ?> </div> <!-- /sidebar ad 350x250 --> <?php } ?> <div id="contact" class="widget-box form-container form-vertical"> <h2><?php _e("Contact publisher", 'bender'); ?> </h2> <?php if (osc_item_is_expired()) { ?>