public function run() { echo "ThreadUnit v" . self::VERSION . " by Michail Buylov. "; echo "A multithread wrapper of\n"; exec("phpunit --version", $out, $exitCode); if ($exitCode) { throw new EnvironmentException("phpunit, that not found"); } echo trim(implode("\n", $out)) . "\n"; if ($this->params->needHelp()) { $this->params->displayHelp(); return 0; } $testMap = new TestMap($this->params); $tests = $testMap->getWorkers(); $tests->prepare(); $startTime = microtime(1); do { $tests->tic(); } while (!$tests->done()); $execTime = round(microtime(1) - $startTime, 2); $pidCount = count($tests); $log = $testMap->getLogBuilder(); $logPath = $this->params->getJlog(); if ($logPath) { $log->save($logPath); } $log->echoStatus($pidCount, $execTime); return $log->getExitStatus(); }
function browse($p, $pagesize, $pos) { #取最上圖片資料 if ($this->func == "COM") { $keys = array("COM_IMG1"); } $d = new Params($this->db_conn); $keydata = array(); foreach ($keys as $k) { $d->getData($k); $keydata[$k] = clone $d; } $this->assign('keydata', $keydata); $this->assign('func', $this->func); #取最列表片資料 $c = new Comb($this->db_conn); $rows = $c->getList($p); $total = mysql_num_rows($rows); $limit_str = $this->limit($total, $pagesize, $pos); $lists = $c->getListArray($p, $limit_str); $query_str = ""; $this->assign('p', $p); $this->assign('data', $c); $this->assign('lists', $lists); $this->assign('content_page', $this->template . $this->list_tpl); $this->pager($lists, $query_str); $this->output(); }
public function __construct(Params $params) { $threadsCount = $params->getThreads(); for ($i = 0; $i < $threadsCount; $i++) { $this->pack[] = new Worker($params, $i, $this); $this->map[] = 0; } }
/** * @return bool */ protected static function isEnable() { if (self::$isEnable === null) { self::$isEnable = (bool) Params::get('debug', false); } return self::$isEnable; }
private function getDBParams() { $p_iPage = 1; if (!is_numeric(Params::getParam('iPage')) || Params::getParam('iPage') < 1) { Params::setParam('iPage', $p_iPage); $this->iPage = $p_iPage; } else { $this->iPage = Params::getParam('iPage'); } $this->showAll = Params::getParam('showAll'); foreach ($this->_get as $k => $v) { if ($k == 'resourceId' && !empty($v)) { $this->resourceID = intval($v); } if ($k == 'iDisplayStart') { $this->start = intval($v); } if ($k == 'iDisplayLength') { $this->limit = intval($v); } } // set start and limit using iPage param $start = ((int) $this->iPage - 1) * $this->_get['iDisplayLength']; $this->start = intval($start); $this->limit = intval($this->_get['iDisplayLength']); }
function doModel() { $id = Params::getParam('id'); $page = false; if (is_numeric($id)) { $page = $this->pageManager->findByPrimaryKey($id); } else { $page = $this->pageManager->findByInternalName(Params::getParam('slug')); } // page not found if ($page == false) { $this->do404(); return; } // this page shouldn't be shown (i.e.: e-mail templates) if ($page['b_indelible'] == 1) { $this->do404(); return; } // export $page content to View $this->_exportVariableToView('page', $page); if (Params::getParam('lang') != '') { Session::newInstance()->_set('userLocale', Params::getParam('lang')); } // load the right template file if (file_exists(osc_themes_path() . osc_theme() . '/page-' . $page['s_internal_name'] . '.php')) { $this->doView('page-' . $page['s_internal_name'] . '.php'); } else { $this->doView('page.php'); } }
function customPageHeader() { $action = Params::getParam("action"); ?> <div class="header-title-market"> <h1><?php _e('Discover how to improve your Osclass!'); ?></h1> <h2>Osclass offers many templates and plugins.<br/>Turn your Osclass installation into a classifieds site in a minute!</h2> </div> <div class="banner-market"> </div> <ul class="tabs"> <li <?php if($action == ''){ echo 'class="active"';} ?>><a href="<?php echo osc_admin_base_url(true).'?page=market'; ?>"><?php _e('Market'); ?></a></li> <li <?php if($action == 'plugins'){ echo 'class="active"';} ?>><a href="<?php echo osc_admin_base_url(true).'?page=market&action=plugins'; ?>"><?php _e('Plugins'); ?></a></li> <li <?php if($action == 'themes'){ echo 'class="active"';} ?>><a href="<?php echo osc_admin_base_url(true).'?page=market&action=themes'; ?>"><?php _e('Themes'); ?></a></li> <li <?php if($action == 'languages'){ echo 'class="active"';} ?>><a href="<?php echo osc_admin_base_url(true).'?page=market&action=languages'; ?>"><?php _e('Languages'); ?></a></li> </ul> <script type="text/javascript"> $(document).ready(function() { $.getJSON( '<?php echo osc_admin_base_url(true); ?>?page=ajax&action=market_header', function(data){ if(data.error==1) { } else { $('#content-head div.banner-market').html(data.html); } }); }); </script> <?php }
function doModel() { $id = Params::getParam('id'); $page = $this->pageManager->findByPrimaryKey($id); if ($page == false) { $this->do404(); return; } if ($page['b_indelible'] == 1) { $this->do404(); return; } if (file_exists(osc_themes_path() . osc_theme() . '/' . $page['s_internal_name'] . ".php")) { $this->doView($page['s_internal_name'] . ".php"); } else { if (file_exists(osc_themes_path() . osc_theme() . '/pages/' . $page['s_internal_name'] . ".php")) { $this->doView("pages/" . $page['s_internal_name'] . ".php"); } else { if (Params::getParam('lang') != '') { Session::newInstance()->_set('userLocale', Params::getParam('lang')); } $this->_exportVariableToView('page', $page); $this->doView('page.php'); } } }
function customHead() { ?> <script type="text/javascript"> $(document).ready(function(){ if (typeof $.uniform != 'undefined') { $('textarea, button,select, input:file').uniform(); } <?php if (Params::getParam('confirm') == 'true') { ?> $('#output').show(); $('#tohide').hide(); $.get('<?php echo osc_admin_base_url(true); ?> ?page=upgrade&action=upgrade-funcs' , function(data) { $('#loading_immage').hide(); $('#result').append(data+"<br/>"); }); <?php } ?> }); </script> <?php }
public function __construct() { parent::__construct(); $this->path = osc_themes_path(); if( Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '' ) { $this->setCurrentTheme( Params::getParam('theme') ); } else { $this->setCurrentTheme( osc_theme() ); } $functions_path = $this->getCurrentThemePath() . 'functions.php'; if( file_exists($functions_path) ) { require_once $functions_path; } $info = $this->loadThemeInfo($this->theme); if($info['template'] != '' ) { //$this->setCurrentTheme($info['template']); $parent_functions_path = osc_base_path() . 'oc-content/themes/' . $info['template'] . '/functions.php'; if( file_exists($parent_functions_path) ) { require_once $parent_functions_path; } } }
function youtube_item_edit_post($catID = null, $itemID = null) { $youtube_video = addslashes(Params::getParam('s_youtube')); $youtube_video = convert_youtube_url($youtube_video); $conn = getConnection(); $conn->osc_dbExec("REPLACE INTO %st_item_youtube (fk_i_item_id, s_youtube) VALUES (%d, '%s')", DB_TABLE_PREFIX, $itemID, $youtube_video); }
function payment_pro_blockchain_load_lib() { if (Params::getParam('page') == 'custom' && Params::getParam('route') == 'payment-pro-checkout') { osc_register_script('blockchain', 'https://blockchain.info/Resources/wallet/pay-now-button.js', array('jquery')); osc_enqueue_script('blockchain'); } }
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 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 __Construct($dictionary) { parent::__Construct(get_class(), "desktop.html", $dictionary); //get input params $paymentConfigCode = Params::Get('state'); $authCode = Params::Get('code'); //load provider (verify code) $provider = Provider::FromPaymentConfigCode($paymentConfigCode); if (is_null($provider)) { //TODO: deal with this } else { //check stripe id isn't already set if (!is_null($provider->getStripeAccountId())) { //TODO: deal with this } else { $stripeAccount = StripeConnector::ConstructAccount($authCode); if (is_null($stripeAccount)) { //TODO: deal with this } else { //add to provider - clear code $provider->setStripeAccountId($stripeAccount->getId()); $provider->setPaymentConfigCode(null); $provider->save(); //notify success $this->connected = true; } } } }
function payment_pro_stripe_load_lib() { if (Params::getParam('page') == 'custom' && Params::getParam('route') == 'payment-pro-checkout') { osc_register_script('payment-pro-stripe', 'https://checkout.stripe.com/v2/checkout.js', array('jquery')); osc_enqueue_script('payment-pro-stripe'); } }
/** * UPLOAD and REMOVE Site's LOGO */ function theme_classified_actions_admin() { switch (Params::getParam('action_specific')) { case 'upload_logo': $package = Params::getFiles('logo'); if ($package['error'] == UPLOAD_ERR_OK) { if (move_uploaded_file($package['tmp_name'], WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { osc_add_flash_ok_message(__('The logo image has been uploaded correctly', 'classified'), 'admin'); } else { osc_add_flash_error_message(__("An error has occurred, please try again", 'classified'), 'admin'); } } else { osc_add_flash_error_message(__("An error has occurred, please try again", 'classified'), 'admin'); } header('Location: ' . osc_admin_render_theme_url('oc-content/themes/classified/admin/header.php')); exit; break; case 'remove': if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) { @unlink(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg"); osc_add_flash_ok_message(__('The logo image has been removed', 'classified'), 'admin'); } else { osc_add_flash_error_message(__("Image not found", 'classified'), 'admin'); } header('Location: ' . osc_admin_render_theme_url('oc-content/themes/classified/admin/header.php')); exit; break; } }
/** * 获取实例 * */ public static function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; }
function doModel() { parent::doModel(); //specific things for this class switch ($this->action) { case 'add_post': if (Params::getParam('field_name') != '') { $field = $this->fieldManager->findByName(Params::getParam('field_name')); if (!isset($field['pk_i_id'])) { $slug = preg_replace('|([-]+)|', '-', preg_replace('|[^a-z0-9_-]|', '-', strtolower(Params::getParam("field_slug")))); $this->fieldManager->insertField(Params::getParam("field_name"), Params::getParam("field_type_new"), $slug, Params::getParam("field_required") == "1" ? 1 : 0, Params::getParam('field_options'), Params::getParam('categories')); osc_add_flash_ok_message(_m("New custom field added"), "admin"); } else { osc_add_flash_error_message(_m("Sorry, you already have one field with that name"), "admin"); } } else { osc_add_flash_error_message(_m("Name can not be empty"), "admin"); } $this->redirectTo(osc_admin_base_url(true) . "?page=cfields"); break; default: $categories = Category::newInstance()->toTreeAll(); $selected = array(); foreach ($categories as $c) { $selected[] = $c['pk_i_id']; foreach ($c['categories'] as $cc) { $selected[] = $cc['pk_i_id']; } } $this->_exportVariableToView("categories", $categories); $this->_exportVariableToView("default_selected", $selected); $this->_exportVariableToView("fields", $this->fieldManager->listAll()); $this->doView("fields/index.php"); } }
function doModel() { parent::doModel(); //specific things for this class switch ($this->action) { case 'delete': $ids = Params::getParam("id"); if ($ids != '') { foreach ($ids as $id) { osc_deleteResource($id); } $this->resourcesManager->delete(array(DB_CUSTOM_COND => 'pk_i_id IN (' . implode(', ', $ids) . ')')); } osc_add_flash_message(_m('Resource deleted'), 'admin'); $this->redirectTo(osc_admin_base_url(true) . "?page=media"); break; default: $resourceId = Params::getParam("id"); if ($resourceId != '') { $resources = $this->resourcesManager->getAllResources($resourceId); } else { $resources = $this->resourcesManager->getAllResources(NULL); } //calling the view... $this->_exportVariableToView("resources", $resources); $this->_exportVariableToView("resourceId", $resourceId); $this->doView('media/index.php'); } }
/** * 构造 * * @param string $controller * @param string $action * @return Action */ function __construct() { $this->view = new View(); $this->params = Params::getInstance(); if (method_exists($this, '_init')) { $this->_init(); } }
function __construct() { $this->action = Params::getParam('action'); $this->ajax = false; $this->time = list($sm, $ss) = explode(' ', microtime()); WebThemes::newInstance(); osc_run_hook('init'); }
public function applyParams($text, $key) { if ($this->params) { return strtr($text, $this->params->produce($key)); } else { return $text; } }
public function save() { $values = $this->getValues(); Doctrine::getTable('Params')->createQuery('p')->delete()->execute(); foreach ($values as $space => $vs) { foreach ($vs as $name => $v) { $p = new Params(); $p->space = $space; $p->name = $name; if (is_array($v)) { $v = serialize($v); } $p->value = $v; $p->save(); } } }
/** * 订单列表 */ public function actionIndex() { $pageIndex = isset($_GET['page']) ? $_GET['page'] : 1; $view = isset($_GET['view']) ? $_GET['view'] : 0; $conditionArr = array(); //待发货 pay_status:1;ship_status:0 if ($view == 0) { $conditionArr = array('pay_status' => 1, 'ship_status' => 0); } //已发货 ship_status:1 if ($view == 1) { $conditionArr = array('ship_status' => 1); } //待支付 pay_status:0 if ($view == 2) { $conditionArr = array('pay_status' => 0); } //已支付到担保方 pay_status:2 if ($view == 3) { $conditionArr = array('pay_status' => 2); } //已支付 pay_status:1 if ($view == 4) { $conditionArr = array('pay_status' => 1); } //货到付款 if ($view == 5) { $conditionArr = array('pay_status' => 10); } //活动 status:active if ($view == 6) { $conditionArr = array('status' => 'active', 'pay_status' => 0); } //已作废 status:dead if ($view == 7) { $conditionArr = array('status' => 'dead'); } //已完成 status:finish if ($view == 8) { $conditionArr = array('status' => 'finish'); } //全部 if ($view == 9) { $conditionArr = array(); } $Order = new Orders(); $result = $Order->orderList($conditionArr, $pageIndex, $this->pagesize); $order_list = array(); foreach ($result['items'] as $k => $v) { $order_list[$k] = $v; $order_list[$k]['pay_status_name'] = Params::PayStatus($v['pay_status']); $order_list[$k]['ship_status_name'] = Params::ShipStatus($v['ship_status']); $order_list[$k]['member_name'] = Params::PamMember($v['member_id']); } //分页 $pages = new CPagination($result['count']); $this->render('index', array('dataProvider' => $order_list, 'view' => $view, 'pages' => $pages, 'pageIndex' => $pageIndex - 1)); }
function doModel() { switch ($this->action) { case 'change_email_confirm': //change email confirm if (Params::getParam('userId') && Params::getParam('code')) { $userManager = new User(); $user = $userManager->findByPrimaryKey(Params::getParam('userId')); if ($user['s_pass_code'] == Params::getParam('code') && $user['b_enabled'] == 1) { $userEmailTmp = UserEmailTmp::newInstance()->findByPk(Params::getParam('userId')); $code = osc_genRandomPassword(50); $userManager->update(array('s_email' => $userEmailTmp['s_new_email']), array('pk_i_id' => $userEmailTmp['fk_i_user_id'])); Item::newInstance()->update(array('s_contact_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); ItemComment::newInstance()->update(array('s_author_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); Alerts::newInstance()->update(array('s_email' => $userEmailTmp['s_new_email']), array('fk_i_user_id' => $userEmailTmp['fk_i_user_id'])); Session::newInstance()->_set('userEmail', $userEmailTmp['s_new_email']); UserEmailTmp::newInstance()->delete(array('s_new_email' => $userEmailTmp['s_new_email'])); osc_add_flash_ok_message(_m('Your email has been changed successfully')); $this->redirectTo(osc_user_profile_url()); } else { osc_add_flash_error_message(_m('Sorry, the link is not valid')); $this->redirectTo(osc_base_url()); } } else { osc_add_flash_error_message(_m('Sorry, the link is not valid')); $this->redirectTo(osc_base_url()); } break; case 'activate_alert': $email = Params::getParam('email'); $secret = Params::getParam('secret'); $result = 0; if ($email != '' && $secret != '') { $result = Alerts::newInstance()->activate($email, $secret); } if ($result == 1) { osc_add_flash_ok_message(_m('Alert activated')); } else { osc_add_flash_error_message(_m('Ops! There was a problem trying to activate alert. Please contact the administrator')); } $this->redirectTo(osc_base_url(true)); break; case 'unsub_alert': $email = Params::getParam('email'); $secret = Params::getParam('secret'); if ($email != '' && $secret != '') { Alerts::newInstance()->delete(array('s_email' => $email, 'S_secret' => $secret)); osc_add_flash_ok_message(_m('Unsubscribed correctly')); } else { osc_add_flash_error_message(_m('Ops! There was a problem trying to unsubscribe you. Please contact the administrator')); } $this->redirectTo(osc_base_url()); break; default: $this->redirectTo(osc_user_login_url()); break; } }
function loadInputData($params = null) { if ($params === null) { Params::importFromPost(); Params::importFromGet(true); } else { Params::importFromArray($params); } }
function send() { $success_message = Params::get("success_message"); $em = new EMail(Params::get("email"), Params::get("dest_address"), "Nuovo messaggio ricevuto", EMail::HTML_FORMAT); $vars = array("first_name" => Params::get("first_name"), "last_name" => Params::get("last_name"), "message" => Params::get("message")); $em->render_and_send("include/mail/message.php.inc", $vars); Flash::ok(Params::get($success_message)); return Redirect::success(); }
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'); } }
public function genParams() { if (!$this->_params) { $viewPath = \Path::instance()->evaluate(':' . $this->project()->name() . ".apps.layout.+{$this->name()}.@params.php"); $this->_params = Params::create($viewPath . '/params.php'); return $this->_params->generate(); } return false; }