function __construct() { $url = isset($_GET['url']) ? $_GET['url'] : null; $url = rtrim($url, '/'); $url = explode('/', $url); if (empty($url[0])) { require 'Controller/HomeController.php'; $controller = new HomeController(); $controller->index(); return false; } $file = 'Controller/' . ucfirst($url[0]) . 'Controller.php'; if (file_exists($file)) { require $file; } else { throw new Exception("The file: {$file} Does not exists"); } $controller_url = ucfirst($url[0]) . "Controller"; $controller = new $controller_url(); // Carregando o Modelo $controller->loadModel($controller_url); // Verificar se foi especificado um método (action) if (isset($url[2])) { // adicionar parametro no método $controller->{$url[1]}($url[2]); } else { if (isset($url[1])) { $controller->{$url[1]}(); } else { $controller->index(); } } }
public function logout() { session_start(); session_unset(); $home = new HomeController(); return $home->index(); }
function save() { include "config/site.php"; if ($commentswitch === "0") { echo "-1"; return; } session_start(); if (strcasecmp($_POST['validationCode'], $_SESSION['validationCode']) != 0) { echo "0"; return; } $this->reply = new Reply(); $this->reply->save(); include "config/site.php"; $model = new BaseModel(); //reconnect to the msyql $fname = $tpl_root . "/static/" . $_POST['par_id'] . ".html"; ob_start(); $_GET["id"] = $_POST['par_id']; $home = new HomeController(); $home->info(); $content = ob_get_contents(); ob_end_clean(); $fp = fopen($fname, "w"); fwrite($fp, $content); fclose($fp); echo "true"; }
/** * Execute the console command. * Creates a HomeController and calls its cleanLeases function which terminates all expired leases. * * @return mixed */ public function fire() { $home_controller = new HomeController(new LaravelDuo\LaravelDuo()); $cleaner = $home_controller->cleanLeases(); if ($cleaner) { $this->info($cleaner); } }
public function showFellowSelect($city_id) { $fellowName = "Propel Fellow"; $home = new HomeController(); $year = $home->get_year(); $fellows = Group::where('name', '=', $fellowName)->first()->fellow()->distinct()->where('city_id', '=', $city_id)->where('year', '=', $year)->where('status', '=', '1')->where('user_type', '=', 'volunteer')->get(); //return $fellows; return View::make('city.select-fellow')->with('fellows', $fellows); }
public function foundController() { if ($this->url == "home") { $controller = new HomeController(); $controller->index(); } elseif ($this->url == "conversor") { $controller = new ConversorController(); $controller->index(); } }
function GET($matches) { $home = new HomeController($matches); if (array_key_exists(1, $matches)) { if ($matches[1] == "json") { $home->renderJson(); } } else { $home->render(); } }
public function _initialize() { parent::_initialize(); $this->assign('check_all', false); $this->assign('search_url', U('lists')); define('ADDON_PUBLIC_PATH', ''); defined('_ADDONS') or define('_ADDONS', MODULE_NAME); defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME); defined('_ACTION') or define('_ACTION', ACTION_NAME); $this->model = M('model')->getByName('public'); $this->assign('model', $this->model); // dump ( $this->model ); $res['title'] = $this->model['title']; $res['url'] = U('lists'); $res['class'] = ACTION_NAME != 'help' ? 'current' : ''; $nav[] = $res; // $res ['title'] = '管理员配置'; // $res ['url'] = U ( 'Home/Admin/lists' ); // $res ['class'] = ''; // $nav [] = $res; if (ACTION_NAME == 'help') { $res['title'] = '接口配置帮助'; $res['url'] = U('help', array('public_id' => $_GET['public_id'])); $res['class'] = 'current'; $nav[] = $res; } $this->assign('nav', $nav); }
public static function getInstance($params = array()) { if (!self::$instance instanceof self) { self::$instance = new self($params); } return self::$instance; }
/** * 模板显示 调用内置的模板引擎显示方法, * @access protected * @param string $templateFile 指定要调用的模板文件 * @return void */ protected function display($template) { $file = T('Addons://' . parse_name($_GET['_addons'], 1) . '@./' . ucfirst($_GET['_controller']) . '/' . $_GET['_action']); define('IS_ADDON', true); parent::display($file); // 重要:要避免陷入$this->display()循环 }
function __construct() { parent::__construct(); $this->uid = is_login(); if (!$this->uid) { $this->redirect('User/login'); } }
public function _initialize() { parent::_initialize(); $this->Notice = M('notice'); $this->Ndetail = M('noticeDetail'); $this->Youpin = M('youpin'); $this->Ydetail = M('youpinDetail'); }
public static function HomeAction() { if (!isset($_SESSION["usuarioActual"])) { HomeController::LoginAction(); return; } require_once './views/Home/index.php'; }
function __construct() { parent::__construct(); $this->load->library('session'); $this->load->model('user_model', 'users'); if ($this->session->userdata('admin') or $this->session->userdata('user')) { $this->authen = true; } }
function __construct() { parent::__construct(); $this->uid = is_login(); if (!$this->uid && ACTION_NAME != 'callback') { $this->redirect('User/login'); } $this->pageTitle = "快捷支付"; }
public function perguntasSemelhantes($texto) { $perguntas = DB::table('perguntas')->orderBy('data_hora', 'desc')->get(); $arRetorno = array(); foreach ($perguntas as $pergunta) { if (HomeController::cosineSimilarity($texto, $pergunta->pergunta)) { array_push($arRetorno, $pergunta); } } return Response::json($arRetorno); }
public function _initialize() { parent::_initialize(); $this->assign('check_all', false); $this->assign('search_url', U('lists')); define('ADDON_PUBLIC_PATH', ''); defined('_ADDONS') or define('_ADDONS', MODULE_NAME); defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME); defined('_ACTION') or define('_ACTION', ACTION_NAME); $this->model = M('model')->getByName('public'); $this->assign('model', $this->model); // dump ( $this->model ); }
protected function _initialize() { parent::_initialize(); /** * 获取登录者用户的信息 */ $map = array(); $map['uid'] = session('user_auth')['uid']; $user = M('User')->where($map)->find(); //获取共有几个相册 $user['album_num'] = M('Album')->where($map)->count(); //获取共有几张照片 $album_ids = M('Album')->where($map)->getField('id', true); if ($album_ids) { $map1 = array(); $map1['album_id'] = array('in', $album_ids); $user['pic_num'] = M('Pic')->where($map1)->count(); } else { $user['pic_num'] = 0; } //获取收藏 $user['collect_num'] = M('Collect')->where($map)->count(); $this->assign('user', $user); /** * 获取相册列表 */ $Album = M('Album'); $map = array(); $map['a.uid'] = session('user_auth')['uid']; $album_list = $Album->alias('a')->join('__PIC__ p on a.cover_id = p.id', 'left')->field('a.*,p.path')->where($map)->select(); $Pic = M('Pic'); $Thumb = M('Thumb'); foreach ($album_list as $key => $val) { //获取相册的图片数量 $map = array(); $map['album_id'] = $val['id']; $album_list[$key]['number'] = $Pic->where($map)->count(); //如果没有设置封面,则获取相册的第一章图片为封面 if (empty($val['cover_id'])) { $cover_id = $Pic->where($map)->getField('id'); } else { $cover_id = $val['cover_id']; } //获取封面图片的路径 --- 相册封面要足够清晰,这里不使用缩略图 $map = array(); $map['id'] = $cover_id; $album_list[$key]['cover'] = $Thumb->where($map)->getField('path'); } $this->assign('album_list', $album_list); }
/** * "Start" the application: * Analyze the URL elements and calls the according controller/method or the fallback */ public function __construct() { // create array with URL parts in $url $this->splitUrl(); // check for controller: no controller given ? then load start-page if (!$this->url_controller) { require APP . 'controller/home.php'; $page = new HomeController(); $page->index(); } elseif (file_exists(APP . 'controller/' . $this->url_controller . '.php')) { // here we did check for controller: does such a controller exist ? // if so, then load this file and create this controller // example: if controller would be "car", then this line would translate into: $this->car = new car(); require APP . 'controller/' . $this->url_controller . '.php'; $controller = ucfirst($this->url_controller) . 'Controller'; $this->url_controller = new $controller(); // check for method: does such a method exist in the controller ? if (method_exists($this->url_controller, $this->url_action)) { if (!empty($this->url_params)) { // Call the method and pass arguments to it call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params); } else { // If no parameters are given, just call the method without parameters, like $this->home->method(); $this->url_controller->{$this->url_action}(); } } else { if (strlen($this->url_action) == 0) { // no action defined: call the default index() method of a selected controller $this->url_controller->index(); } else { header('location: ' . URL . 'error'); } } } else { header('location: ' . URL . 'error'); } }
public function _initialize($userid) { parent::_initialize(); // header("Cache-control:no-cache,no-store,must-revalidate"); //header("Pragma:no-cache"); // header("Expires:0"); //C('HTTP_CACHE_CONTROL','no-cache, no-store'); //dump($_SERVER); $userid = I('uid', $_SESSION['cs_home']['user_auth']['uid'], 'int'); //判断进入个人中心的是谁,两种情况,一种没有参数,直接访问,可以访问自己的个人中心,带参数则是访问别人的个人中心 //如果访问别人的个人中心,是可以访问的,但是不能发给对方发私信,在消息哪里提示登录 if ($_SESSION['cs_home']['user_auth']['uid'] < 1) { $this->error('你还未登录,请登录后重试!', U('User/login')); } if ($userid == 0 || $_SESSION['cs_home']['user_auth']['uid'] == $userid) { $cxuid = $_SESSION['cs_home']['user_auth']['uid']; $ucenter = true; $userart = '5,2,1'; } else { $cxuid = $userid; $ucenter = false; $userart = '1'; } $cxuser = query_user(array('pos_province', 'pos_community', 'pos_city', 'pos_district', 'zan', 'fensi', 'focusnum', 'scartnum', 'tagfocusnum', 'supportnum', 'score', 'signature', 'commentnum', 'artnum', 'allartnum', 'email', 'uid', 'username', 'nickname', 'name', 'login', 'reg_time', 'space_url', 'last_login_time', 'avatar32', 'avatar64', 'avatar128', 'avatar256'), $cxuid); $hasfocususer = hasguanzhu($cxuid, $_SESSION['cs_home']['user_auth']['uid'], 0); $this->assign('hasfocususer', $hasfocususer); $map['uid'] = $cxuid; $map['status'] = 1; $map['tag'] = array('neq', 'null'); $tagarr = array_filter(M('article')->where($map)->getField('tag', true)); if ($tagarr != null) { $taglist = implode(',', $tagarr); $taglistcache = explode(',', $taglist); $taglistcache = array_unique($taglistcache); foreach ($taglistcache as $key => $vo) { $usertaglist[$key] = gettaginfobytitle($vo); } } $usertaglist = array_filter($usertaglist); $this->assign('usertaglist', $usertaglist); timetonow(); $this->assign('cxuid', $cxuid); $this->assign('ucenter', $ucenter); $this->assign('cxuser', $cxuser); $this->assign('userid', $userid); $this->assign('webdescription', '用户中心'); $this->assign('webkeyword', '用户中心'); $this->assign('webtitle', '用户中心'); }
public function estimateReport($company_symbol, $second_title) { $second_title_found = Company::find_company_name_comp_id($company_symbol); if ($second_title_found) { if (!$second_title || $second_title == $company_symbol) { return Redirect::route('home-estimate', array($company_symbol, url_maker($second_title_found))); } } else { return Redirect::route('404'); } $interval = Input::get('interval'); $total = Input::get('total'); Company::update_chapter_view($company_symbol); //<---this updates the view count of chapter $previous_data = CompanyData::Check_recod_exists_by_company_symbol($company_symbol); $interval = isset($interval) && !empty($interval) ? $interval : 'd'; $precision = $previous_data ? $previous_data : 1; $stock_market = new StockMarket($company_symbol, $interval, $precision); //<---class declared here and passed the datas $company_name = $stock_market->find_company_name_from_symbol(); if ($company_name) { //<-- if company name given is not false go further $stock_records = $stock_market->get_the_market_data(); //<--function to collect Historical data for given company symbol } if (!$stock_records) { return Redirect::route('404'); } else { $buy_level = $stock_market->get_prediction_buy_level(); //<--this function helps to predict the buying level mark $sell_level = $stock_market->get_prediction_sell_level(); //<--this function helps to predict the selling level mark $compan_details = $stock_market->get_company_description(); //<--get the stored company Descriptions $prediction = Prediction::update_predicted_data($company_symbol, $precision); //<--class declaration/ find to update for prediction if ($prediction) { $company_id = Company::find_company_id_company_symbol($company_symbol); $ipLite = new ip2locationlite(); $ipLite->setKey('516921f89d86829aafa20f18ff7408fe4f2e974d114b53593f56a91ab7a286cc'); $locations = $ipLite->getCity($_SERVER['REMOTE_ADDR']); $ge_countryName = !empty($locations) && is_array($locations) ? $locations['cityName'] : "undeclared"; $prediction = Prediction::where('comp_id_fk', '=', $company_id)->delete(); $company = Prediction::create(array('comp_id_fk' => $company_id, 'buy_level' => trim($buy_level), 'sell_level' => trim($sell_level), 'accuracy' => $precision, 'updated' => date("Y-m-d H:i:s", time()), 'host' => $ge_countryName)); } } $meta_data = array('title' => ucwords($company_name) . " Stock Market Value Prediction Result :: StockLength.com To Check Your Risk Level On Stock Market", 'metaDescription' => ucwords($company_name) . ' find online Prediction Stock Market Informer, Online free tool to check stockmarket future ' . ucwords($company_name) . ', Online free selling buyer sujection, Featured Predict Stock Market, free fast Online Check and reviews ' . ucwords($company_name) . '. Latest updates on everything Predict Stock Market related.', 'company_symbol' => $company_symbol, 'precision' => $precision, 'fb_image' => return_image($company_symbol . '.jpeg')); return View::make('estimate', array('meta_data' => $meta_data, 'company_name' => $company_name, 'compan_details' => $compan_details, 'stock_records' => $stock_records, 'stock_market' => $stock_market, 'buy_level' => $buy_level, 'sell_level' => $sell_level, 'precision' => $precision, 'records' => parent::latestPredictions(), 'tickers' => parent::getTicker(), 'company_symbol' => $company_symbol, 'page_checker' => true)); }
private function runModule() { switch ($this->sModule) { case "Home": $oController = new HomeController(); $oController->run($this->sAction, $this->asArgs, $this->sView); break; case "ShowRoom": $oController = new ShowRoomController(); $oController->run($this->sAction, $this->asArgs, $this->sView); break; case "Basic": $oController = new BasicController(); $oController->run($this->sAction, $this->asArgs, $this->sView); break; case "Products": $oController = new ProdutosController(); $oController->run($this->sAction, $this->asArgs, $this->sView); break; default: echo "Erro: Módulo não existe"; } /* switch ( $this->sModule ) */ }
public function getPage($type, $slug = '') { $type_post = Type::where('type', $type)->first(); $posts_child = $galleries = $posts = $row = array(); if (empty($type_post)) { return Response::view('errors.not-found')->header('Content-Type', '404 Not Found'); } if ($type_post->template == 'gallery') { $row = Post::where('slug', $type)->first(); $type_post = Type::where('id', $row->type_id)->first(); $galleries = Gallery::where('post_id', $row->id)->get(); } else { if ($type_post->template == 'news') { if ($slug == '') { $posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('created_at', 'desc')->paginate(6); } else { $row = Post::where('slug', $slug)->first(); } foreach ($posts as $key => $post) { $preview = HomeController::previewFirstSimbol($post->text, 500); $post->preview = $preview['text']; } } else { if ($type_post->template == 'portfolio') { $posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('order', 'asc')->get(); foreach ($posts as $key => $post) { $post->galleries = Gallery::where('post_id', $post->id)->get(); } } else { $posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('order', 'asc')->get(); $posts_child = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', '!=', 0)->orderBy('order', 'asc')->get(); if ($slug != '') { $row = Post::where('slug', $slug)->first(); if ($row->parent != 0) { $parent = Post::where('id', $row->parent)->first(); $row->parent_title = $parent->name; $row->parent_slug = $parent->slug; } $galleries = Gallery::where('post_id', $row->id)->get(); } } } } $view = array('type' => $type_post, 'posts' => $posts, 'posts_child' => $posts_child, 'row' => $row, 'galleries' => $galleries); return View::make('home.' . $type_post->template, $view); }
/** * Envoie un mail de contact **/ public function contact() { if ($this->request->is('post')) { HomeController::loadModel('Contact'); if (!empty($this->request->data['Contact']['website'])) { $this->Session->setFlash('Merci pour votre message', 'flash'); $this->request->data = array(); } else { if ($this->Contact->sendMail($this->request->data['Contact'])) { $this->Session->setFlash('Merci pour votre message', 'flash'); $this->request->data = array(); } else { $this->Session->setFlash('Oups, quelque chose s\'est mal passé', 'flash', array('class' => 'danger')); } } } }
function __construct() { parent::__construct(); $this->load->library('user_agent'); if ($this->agent->is_mobile() or $this->input->get('theme') === 'mobile') { Theme::set_theme('mobile'); } if ($this->data['mobile_state'] === 'yes') { Theme::set_theme('mobile'); } $this->data['noresult'] = '没有内容'; $this->load->library('contentfactory'); //分类 $this->config->load('cache_categories'); $this->cats = $this->config->item('categories'); //类型 $this->types = $this->config->item('types'); }
function _initialize() { parent::_initialize(); $act = strtolower(ACTION_NAME); $res['title'] = '消息列表'; $res['url'] = U('lists'); $res['class'] = $act == 'lists' ? 'current' : ''; $nav[] = $res; $res['title'] = '收藏列表'; $res['url'] = U('collect'); $res['class'] = $act == 'collect' ? 'current' : ''; $nav[] = $res; $res['title'] = '待处理列表'; $res['url'] = U('deal'); $res['class'] = $act == 'deal' ? 'current' : ''; $nav[] = $res; $this->assign('nav', $nav); }
public function pageCode() { $html = ''; $model = FrontData::getInstance(); $home = HomeController::getInstance(); $pache = $GLOBALS['pache']; $page = $home->page; if (isset($home->tag)) { $listingType = 'tag'; $listingTypeValue = $home->tag; } else { if (isset($home->categories)) { $listingType = 'categories'; $listingTypeValue = $home->categories; } else { $listingType = ''; $listingTypeValue = NULL; } } $countPage = ceil($model->articleCount($listingType, $listingTypeValue) / $pache->pagelimit); $i = $page; if ($i - 4 < 1) { $i = 5; } for ($i = $i - 4; $i < $page + 5; ++$i) { if ($i > $countPage) { break; } $url = '?'; if (isset($_GET[$listingType])) { $url .= $listingType . '=' . urlencode($_GET[$listingType]) . '&'; } if ($page == $i) { $html .= '<a class="pagecode current"><div class="code">' . $i . '</div><div class="bg"></div></a>'; } else { $html .= '<a class="pagecode" href="' . $url . 'page=' . $i . '">' . $i . '</a> '; } } $form = '<form method="get" style="display:none;"><input name="page" size="4" /></form>'; $html = '<div id="page">' . $html . $form . '</div>'; return $html; }
public function _initialize() { parent::_initialize(); if (!session('userDetail')) { $this->error("非法访问!", U('Index/index')); } else { $this->userDetail = $userDetail = session('userDetail'); $this->user_id = $userDetail[0]['user_id']; } //输出用户基本信息 $this->assign("userBase", $this->userBase); //根据当前时间,显示问候语 date_default_timezone_set('Asia/Shanghai'); $h = date("H"); if ($h < 11) { $hello = "早上好!"; } else { if ($h < 13) { $hello = "中午好!"; } else { if ($h < 17) { $hello = "下午好!"; } else { $hello = "晚上好!"; } } } $this->assign("hello", $hello); //判断用户名长度,对用户名进行截取 $length_nickname = strlen($this->userBase[nick_name]); if ($length_nickname > 6) { $nickname = substr($this->userBase[nick_name], 0, 6) . "···"; $this->assign("nickname", $nickname); } else { $this->assign("nickname", $this->userBase[nick_name]); } //我的项目数 $Project = M("ProjectBase"); $pro_count = $Project->where("user_id = '{$this->user_id}'")->count(); $this->assign("pro_count", $pro_count); }
public function _initialize() { parent::_initialize(); $this->assign('check_all', false); $this->assign('search_url', U('lists')); define('ADDON_PUBLIC_PATH', ''); defined('_ADDONS') or define('_ADDONS', MODULE_NAME); defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME); defined('_ACTION') or define('_ACTION', ACTION_NAME); $this->model = M('Model')->getByName('member_public'); $this->assign('model', $this->model); // dump ( $this->model ); $res['title'] = $this->model['title']; $res['url'] = U('lists'); $res['class'] = ACTION_NAME != 'help' ? 'current' : ''; $nav[] = $res; $res['title'] = '接口配置帮助'; $res['url'] = U('help'); $res['class'] = ACTION_NAME == 'help' ? 'current' : ''; $nav[] = $res; $this->assign('nav', $nav); }
public function _initialize() { parent::_initialize(); $this->assign('check_all', false); $this->assign('search_url', U('lists')); define('ADDON_PUBLIC_PATH', ''); defined('_ADDONS') or define('_ADDONS', MODULE_NAME); defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME); defined('_ACTION') or define('_ACTION', ACTION_NAME); $this->model = M('model')->getByName('user'); $this->assign('model', $this->model); // dump ( $this->model ); $res['title'] = '公众号管理'; $res['url'] = U('Home/Public/lists'); $res['class'] = ''; $nav[] = $res; $res['title'] = '管理员配置'; $res['url'] = U('Home/Admin/lists'); $res['class'] = 'current'; $nav[] = $res; $this->assign('nav', $nav); }