/** * Run block * Called from module::run_block * * Params passed to 'block.data' * action converted to object! * * Extended params passed to {$block.params} * * @throws modules_exception */ function run($action, $params) { $_tag = $this->get_context()->get_tag(); core::dprint('[BLOCK] start ' . $_tag . '::' . $action, core::E_DEBUG); $return = false; // @todo check for callable if (is_callable(array($this, $action))) { if (!empty($params)) { // convert parameters to object $c_params = functions::array2object($params); $data = call_user_func(array($this, $action), $c_params); } else { $data = call_user_func(array($this, $action)); } // get block builtin properties $props = $this->get_block($action); // assign params $props['params'] = $params; $return = $this->get_context()->get_core()->lib('renderer')->render_block($props, $data); } else { throw new modules_exception('Not callable action supplied - ' . $action); } core::dprint('[/BLOCK] end ' . $_tag . '::' . $action, core::E_DEBUG); return $return; }
private function getAreaInfo($idno) { $user = core::Singleton('user.area'); $result = $user->getArea($idno); unset($user); return $result; }
private function getDescription($bid) { $user = core::Singleton('user.borrow_info'); $result = $user->getBorrowDescription($bid); unset($user); return $result; }
/** 默认页 @param void @return void */ function indexAction() { $data = []; $cond = []; $url = '/admin/replace/index?1=1'; if ($this->getRequest()->getQuery('dosubmit')) { $url .= '&dosubmit=dosubmit'; if ($id = intval($this->getRequest()->getQuery('id'))) { $cond['id'] = $id; $url .= '&id=' . $cond['id']; } if ($Keywords = core::safe_str($this->getRequest()->getQuery('keywords'))) { $cond['keywords'] = $Keywords; $url .= '&Keywords=' . $cond['keywords']; } $this->getView()->assign('cond', $cond); } $page = $this->getRequest()->getQuery('page') ? intval($this->getRequest()->getQuery('page')) : 1; //每页显示数 $offset = 15; $start = ($page - 1) * $offset; $data['data'] = $this->Keyword->search_replacewords_list($cond, $start, $offset); $total = $this->Keyword->count($cond, 'keywords'); $totalpage = ceil($total / $offset); //超过一页显示分页 if ($totalpage > 1) { $url .= '&page='; $data['page'] = (new multi())->getSubContent($url, '', $totalpage, $page, 20, ' target="_self" ', '', '', 'no'); } //每页实际显示数 $data['perNum'] = $page > $totalpage ? 0 : $page == $totalpage ? $total % $offset : $offset; $this->getView()->assign('data', $data); }
public function index() { $crontabs_model = core::instance('crontabs_model'); $data = $crontabs_model->getList(array(), '*', 'id DESC'); $this->assign('data', $data); $this->display('index.html'); }
public static function send($event) { $conf = core::conf(); $db = core::db(); // Поиск шаблона письма по имени события $template = $db->Execute(sprintf("SELECT `subject`,`text`,`tags` FROM {$conf->db_prefix}mail WHERE `event`='%s' AND `active`='1'", $event))->fields; $subject = htmlspecialchars_decode($template['subject']); $message = htmlspecialchars_decode($template['text']); $tags = explode(',', $template['tags']); // Замена тегов в письме на значения переменных foreach ($tags as $tag) { $tag = explode('.', $tag); if (is_array($GLOBALS[$tag[0]])) { $value = $GLOBALS[$tag[0]][$tag[1]]; } elseif (is_object($GLOBALS[$tag[0]])) { $value = $GLOBALS[$tag[0]]->{$tag}[1]; } else { $value = $GLOBALS[$tag[0]]; } $subject = str_replace('{' . $tag[0] . '.' . $tag[1] . '}', $value, $subject); $message = str_replace('{' . $tag[0] . '.' . $tag[1] . '}', $value, $message); } $mail_to = $user->email; $mail_from = $conf->site_mail; // Отправка письма if ($subject != '' && $message != '') { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'To: ' . $user->name . ' <' . $mail_to . '>' . "\r\n"; $headers .= 'From: ' . $conf->site_name . ' <' . $mail_from . '>' . "\r\n"; mail($mail_to, $subject, $message, $headers); } }
public function action_edit() { $this->template->scripts['footer'] = array('js/oc-panel/edit_profile.js'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit profile'))); // $this->template->title = $user->name; //$this->template->meta_description = $user->name;//@todo phpseo $user = Auth::instance()->get_user(); $this->template->bind('content', $content); $this->template->content = View::factory('oc-panel/profile/edit', array('user' => $user, 'custom_fields' => Model_UserField::get_all())); if ($this->request->post()) { $user->name = core::post('name'); $user->description = core::post('description'); $user->email = core::post('email'); $user->subscriber = core::post('subscriber', 0); //$user->seoname = $user->gen_seo_title(core::post('name')); $user->last_modified = Date::unix2mysql(); //modify custom fields foreach ($this->request->post() as $custom_field => $value) { if (strpos($custom_field, 'cf_') !== FALSE) { $user->{$custom_field} = $value; } } try { $user->save(); Alert::set(Alert::SUCCESS, __('You have successfully changed your data')); } catch (Exception $e) { //throw 500 throw HTTP_Exception::factory(500, $e->getMessage()); } $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'edit'))); } }
public function getTodayInvest($userId) { $lj = core::Singleton('user.borrow_info'); $result = $lj->getTodayInvest($userId); unset($lj); return $result; }
private function getReceivePlan($userId, $year, $search_month) { $user = core::Singleton('user.receive'); $result = $user->getMyInvest($userId, $year, $search_month); unset($user); return $result; }
/** * 获取实例并初始化对像 * * @param String $plugName 缓存插件名 * @return void */ public static function factory($plugName = null, $setting = '') { require_once 'config/config.log.php'; //判断是否调用系统配置 if (empty($plugName)) { $plugName = _LOG_SYSTEM; //$setting = _LOG_PATH; } $setting = strtoupper($setting); if (!empty($setting) && isset($GLOBALS['lOG_CONFIG'][$setting])) { $setting = $GLOBALS['lOG_CONFIG'][$setting]; } else { $setting = $GLOBALS['lOG_CONFIG']['WWW']; } $plugName = strtolower($plugName); $sKey = self::getSKey($plugName, $setting); if (core::registry($sKey)) { return core::register($sKey); } else { $obj = self::instance($plugName); $obj->init($setting); core::register($sKey, $obj); //print_r($obj); return $obj; } }
public function setApplicationBorrow($data) { $db = core::db()->getConnect('CAILAI', true); $sql = sprintf('INSERT INTO `%s`(`user_phone`,`borrow_use`,`borrow_duration`,`borrow_money`) VALUES("%s","%s","%s","%s")', $this->tbl, $data['user_phone'], $data['borrow_use'], $data['borrow_duration'], $data['borrow_money']); $db->query($sql); return mysql_insert_id(); }
function make_urls() { if (core::in_editor()) { $this->append_urls('children', sprintf('?m=sat&c=menu&pid=%d', $this->id)); $this->append_urls('self', sprintf('?m=sat&c=menu&pid=%d', $this->pid)); } }
public function get_account_infor($account_name) { $db = core::db()->getConnect('DTS'); $account_name = addslashes($account_name); $sql = sprintf("SELECT * FROM %s WHERE partner_name='%s' LIMIT 1", $this->tbl, $account_name); return $db->query($sql, 'array'); }
/** * expired featured ads * @return void */ public static function renew() { if (Core::config('general.subscriptions') == TRUE) { //get expired subscription that are active $subscriptions = new Model_Subscription(); $subscriptions = $subscriptions->where('status', '=', 1)->where('expire_date', '<=', Date::unix2mysql())->order_by('created', 'desc')->find_all(); foreach ($subscriptions as $s) { //disable the plan $s->status = 0; try { $s->save(); } catch (Exception $e) { throw HTTP_Exception::factory(500, $e->getMessage()); } $plan = $s->plan; if ($plan->loaded() and $plan->status == 1) { //generate a new order $order = Model_Order::new_order(NULL, $s->user, $plan->id_plan, $plan->price, core::config('payment.paypal_currency'), __('Subscription to ') . $plan->name); //free plan no checkout if ($plan->price == 0) { $order->confirm_payment('cash'); } else { $checkout_url = $s->user->ql('default', array('controller' => 'plan', 'action' => 'checkout', 'id' => $order->id_order)); $s->user->email('plan-expired', array('[PLAN.NAME]' => $plan->name, '[URL.CHECKOUT]' => $checkout_url)); } } //if plan loaded } //end foreach } //if subscription active }
/** @return anket_answer_collection */ function get_answers() { if (!isset($this->_answers)) { $this->_answers = core::module('anket')->get_answer_handle()->set_where('pid = %d', $this->id)->load(); } return $this->_answers; }
/** @return anket_result_option_collection */ function get_result_options() { if (!isset($this->_result_options)) { $this->_result_options = core::module('anket')->get_result_option_handle()->set_where('pid = %d', $this->id)->load(); } return $this->_result_options; }
private function getPact($bid) { $user = core::Singleton('user.borrow_info'); $bpact = $user->getPact($bid); unset($user); return $bpact; }
function lili($item, $key, $cats) { ?> <option value="<?php echo $cats[$key]['seoname']; ?> " <?php echo core::get('category') == $cats[$key]['seoname'] ? 'selected' : ''; ?> > <?php echo $cats[$key]['name']; ?> </option> <?php if (count($item) > 0) { ?> <optgroup label="<?php echo HTML::chars($cats[$key]['name']); ?> "> <?php if (is_array($item)) { array_walk($item, 'lili', $cats); } ?> <?php } ?> <?php }
public static function drop_command($nick, $ircdata = array()) { $chan = core::get_chan(&$ircdata, 0); // get the channel. if (self::_drop_check($nick, $chan) === false) { return false; } // do nessicary checks if ($channel = services::chan_exists($chan, array('channel', 'suspended'))) { if ($channel->suspended == 1) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_1, array('chan' => $chan)); return false; } } // is the channel suspended? database::delete('chans', array('channel', '=', $chan)); database::delete('chans_levels', array('channel', '=', $chan)); // delete all associated records services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_CHAN_DROPPED, array('chan' => $chan)); // let the user know if (isset(core::$chans[$chan])) { ircd::part_chan(core::$config->chanserv->nick, $chan); // now lets leave the channel if we're in it } // is the channel in existance? if so unregister mode // remember we DON'T unset the channel record, because the channel // is still there, just isnt registered, completely different things core::alog(core::$config->chanserv->nick . ': ' . $chan . ' has been dropped by ' . core::get_full_hostname($nick)); // logchan it core::alog('drop_command(): ' . $chan . ' has been dropped by ' . core::get_full_hostname($nick), 'BASIC'); // log what we need to log. }
public static function getInstance() { if (null === self::$instance) { self::$instance = new self(true); } return self::$instance; }
public function action_create() { try { if (!Valid::email(core::request('email'))) { $this->_error(__('Invalid email'), 501); } elseif (!is_numeric(core::request('id_product'))) { $this->_error(__('Invalid product'), 501); } else { $product = new Model_Product(core::request('id_product')); if ($product->loaded()) { $user = Model_User::create_email(core::request('email'), core::request('name')); $order = Model_Order::new_order($user, $product); $order->confirm_payment(core::request('paymethod', 'API'), core::request('txn_id'), core::request('pay_date'), core::request('amount'), core::request('currency'), core::request('fee')); //adding the notes $order->notes = core::request('notes'); $order->save(); $this->rest_output(array('order' => self::get_order_array($order))); } else { $this->_error(__('Something went wrong'), 501); } } } catch (Kohana_HTTP_Exception $khe) { $this->_error($khe); } }
private function getTotal() { $user = core::Singleton('user.dts_user'); $total = $user->getBorrowTotal(); unset($user); return $total; }
public function action_index() { //template header $this->template->title = ''; // $this->template->meta_keywords = 'keywords'; $this->template->meta_description = Core::config('general.site_description'); //setting main view/template and render pages // swith to decide on ads_in_home $ads = new Model_Ad(); $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED); switch (core::config('advertisement.ads_in_home')) { case 2: $id_ads = array_keys(Model_Visit::popular_ads()); if (count($id_ads) > 0) { $ads->where('id_ad', 'IN', $id_ads); } break; case 1: $ads->where('featured', 'IS NOT', NULL)->where('featured', 'BETWEEN', array(DB::expr('NOW()'), Date::unix2mysql(time() + core::config('payment.featured_days') * 24 * 60 * 60)))->order_by('featured', 'desc'); break; case 0: default: $ads->order_by('published', 'desc'); break; } //if ad have passed expiration time dont show if (core::config('advertisement.expire_date') > 0) { $ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', DB::expr('NOW()')); } $ads = $ads->limit(Theme::get('num_home_latest_ads', 4))->cached()->find_all(); $this->ads = $ads; $categs = Model_Category::get_category_count(); $this->template->bind('content', $content); $this->template->content = View::factory('pages/home', array('ads' => $ads, 'categs' => $categs)); }
/** * Activate filter */ function activate() { core::dprint('Activate RSS'); tpl_loader::set_template('rss'); core::lib('renderer')->set_content_type('text/xml'); // 'application/rss+xml' }
/** * Update new forum */ public function action_update() { Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Topic'))); $topic = new Model_Topic($this->request->param('id')); $get_all = Model_Forum::get_all(); //get all forums to build forum parents in select $forum_parents = array(); foreach ($get_all[0] as $parent) { $forum_parents[$parent['id']] = $parent['name']; } $this->template->content = View::factory('oc-panel/pages/forum/topic', array('topic' => $topic, 'forum_parents' => $forum_parents)); if ($_POST) { $topic->title = core::post('title'); $topic->id_forum = core::post('id_forum'); $topic->description = core::post('description'); if (core::post('seotitle') != $topic->seotitle) { $topic->seotitle = $topic->gen_seotitle(core::post('seotitle')); } if (core::post('status') == 'on') { $topic->status = 1; } else { $topic->status = 0; } try { $topic->save(); Alert::set(Alert::SUCCESS, __('Topic is updated.')); } catch (Exception $e) { Alert::set(Alert::ERROR, $e->getMessage()); } HTTP::redirect(Route::url('oc-panel', array('controller' => 'topic', 'action' => 'index'))); } }
private function getTending($userId) { $user = core::Singleton('user.borrow_info'); $investList = $user->getTending($userId); unset($user); return $investList; }
/** * Function to notify subscribers */ public static function notify(Model_Ad $ad) { $subscribers = new Model_Subscribe(); if ($ad->price > 0) { $subscribers->where_open()->where(DB::EXPR((int) $ad->price), 'BETWEEN', array('min_price', 'max_price'))->or_where('max_price', '=', 0)->where_close(); } //location is set if (is_numeric($ad->id_location)) { $subscribers->where('id_location', 'in', array($ad->id_location, 0)); } //filter by category, 0 means all the cats, in case was not set $subscribers->where('id_category', 'in', array($ad->id_category, 0)); $subscribers = $subscribers->find_all(); $subscribers_id = array(); // array to be filled with user emails foreach ($subscribers as $subs) { // do not repeat same users. if (!in_array($subs->id_user, $subscribers_id)) { $subscribers_id[] = $subs->id_user; } } // query for getting users, transform it to array and pass to email function if (count($subscribers_id) > 0) { $query = DB::select('email')->select('name')->from('users')->where('id_user', 'IN', $subscribers_id)->where('status', '=', Model_User::STATUS_ACTIVE)->execute(); $users = $query->as_array(); // Send mails like in newsletter, to multiple users simultaneously if (count($users) > 0) { $url_ad = Route::url('ad', array('category' => $ad->category->seoname, 'seotitle' => $ad->seotitle)); $replace = array('[URL.AD]' => $url_ad, '[AD.TITLE]' => $ad->title); Email::content($users, '', core::config('email.notify_email'), core::config('general.site_name'), 'ads-subscribers', $replace); } } }
/** * Automatically executed before the widget action. Can be used to set * class properties, do authorization checks, and execute other custom code. * * @return void */ public function before() { // get all categories if ($this->advanced != FALSE) { $this->cat_items = Model_Category::get_as_array(); $this->cat_order_items = Model_Category::get_multidimensional(); $this->selected_category = NULL; if (core::request('category')) { $this->selected_category = core::request('category'); } elseif (Model_Category::current()->loaded()) { $this->selected_category = core::config('general.search_multi_catloc') ? array(Model_Category::current()->seoname) : Model_Category::current()->seoname; } // get all locations $this->loc_items = Model_Location::get_as_array(); $this->loc_order_items = Model_Location::get_multidimensional(); $this->selected_location = NULL; if (core::request('location')) { $this->selected_location = core::request('location'); } elseif (Model_Location::current()->loaded()) { $this->selected_location = core::config('general.search_multi_catloc') ? array(Model_Location::current()->seoname) : Model_Location::current()->seoname; } } if ($this->custom != FALSE) { $fields = Model_Field::get_all(); $this->custom_fields = $fields; } }
public static function ghost_command($nick, $ircdata = array()) { $unick = $ircdata[0]; $password = $ircdata[1]; // get the parameters. if (trim($unick) == '' || trim($password) == '') { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'GHOST')); return false; } // invalid syntax if (!isset(core::$nicks[$unick])) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NOT_IN_USE, array('nick' => $unick)); return false; // nickname isn't in use } if ($user = services::user_exists($unick, false, array('display', 'pass', 'salt'))) { if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) { ircd::kill(core::$config->nickserv->nick, $unick, 'GHOST command used by ' . core::get_full_hostname($nick)); core::alog(core::$config->nickserv->nick . ': GHOST command used on ' . $unick . ' by ' . core::get_full_hostname($nick)); } else { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD); // password isn't correct } } else { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick)); return false; // doesn't even exist.. } }
public function initialize() { $this->config = core::Singleton('comm.application.config.config'); $this->urlParams = $_GET[$this->paramsName]; $this->prepareParms(); $this->parse(); }