예제 #1
0
 public function aboutPage($title, $text)
 {
     $view = new View();
     $view->title = $title;
     $view->text = $text;
     $view->render("index");
 }
예제 #2
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request        	
  * @param \Closure $next        	
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $ignore = ['222.20.35.168', '127.0.0.1'];
     if (array_search($request->ip(), $ignore) === false) {
         $ip = $request->ip();
         $path = $request->path();
         $view = new View();
         $view->ip = $ip;
         $view->url = $path;
         $view->location = GeoipParser::parse($ip);
         $view->save();
     }
     return $next($request);
 }
예제 #3
0
 public static function detectAllLocation()
 {
     $views = View::all();
     foreach ($views as $view) {
         if ($view->location != "") {
             continue;
         }
         $ip = $view->ip;
         $client = new Client(['base_uri' => 'http://ip.taobao.com', 'timeout' => 5.0]);
         try {
             $response = $client->request('GET', '/service/getIpInfo.php', ['query' => "ip={$ip}"]);
             $body = json_decode($response->getBody());
             if ($body->code == 0) {
                 $country = $body->data->country;
                 $area = $body->data->area;
                 $region = $body->data->region;
                 $city = $body->data->city;
                 $isp = $body->data->isp;
                 $location = "{$country}-{$area}-{$region}-{$city}-{$isp}";
             } else {
                 $location = "获取失败";
             }
             $view->location = $location;
         } catch (\Exception $e) {
             Log::warning($e->getMessage());
         }
         $view->save();
     }
 }
예제 #4
0
 public function getViews()
 {
     $views = View::orderBy('count', 'desc')->get();
     if (is_null($views)) {
         return [];
     }
     return $views->toArray();
 }
예제 #5
0
파일: page.php 프로젝트: smith46102/koda
 public function run()
 {
     Assets\Less::compile('index.less', 'style.css');
     Assets\Javascript::compile('gui/root.js', 'gui_min.js');
     Assets\Javascript::compile('interface/root.js', 'interface_min.js');
     Assets\Javascript::compile('layouts/root.js', 'layouts_min.js');
     $sidebarMod = new Modules\Sidebar\Sidebar();
     $sidebar = $sidebarMod->render();
     $user = User::$model;
     View::set(compact('sidebar', 'user'));
     View::render('html');
 }
예제 #6
0
 public function __construct($widget_id)
 {
     // Find or fail widget
     $this->widget = Widget::findOrFail($widget_id);
     $session_id = Session::getId();
     $referrer = filter_var(Request::server('HTTP_REFERER'), FILTER_SANITIZE_URL);
     // Add new resource?
     $this->resource = Resource::firstOrNew(['uri' => $referrer, 'widget_id' => $this->widget->id]);
     $this->resource->uri = $referrer;
     $this->resource->widget_id = $this->widget->id;
     $this->resource->save();
     // Add new visitor?
     $this->visitor = Visitor::firstOrCreate(['session_id' => $session_id]);
     $this->visitor->touch();
     // Add new view?
     $this->view = View::firstOrCreate(['resource_id' => $this->resource->id, 'visitor_id' => $this->visitor->id]);
     $this->view->touch();
 }
예제 #7
0
<?php

use App\Models\News;
use App\View;
require __DIR__ . '/../../autoload.php';
$view = new View();
$view->title = 'Страница редактирование статьи';
$view->display(__DIR__ . '/../templates/form.php');
예제 #8
0
 public function actionIndex()
 {
     $view = new View('site');
     echo $view->render();
 }
예제 #9
0
 /**
  * Returns the fully rendered HTML of a post in the JSON output.
  *
  * @return string
  */
 public function getHtmlAttribute()
 {
     if (!$this->trashed()) {
         return \View::make('content.board.thread', ['board' => $this->board, 'thread' => $this, 'op' => false, 'reply_to' => $this->reply_to ?: $this->board_id])->render();
     }
     return null;
 }
예제 #10
0
 public function makeAssignRoleFeatureForm($rid)
 {
     $role = Role::find($rid);
     $feature_not_in_role = Role::getFeaturesNotAssignedToCurrentRole($rid);
     return View::make('backend.role.feature_assign')->with('feature_not_in_role', $feature_not_in_role)->with('role', $role)->with('module', $this->module);
 }
예제 #11
0
 /**
  * 
  * @access public
  * 
  * @param string $render Nome do arquivo php 
  * @param arary $param  Valores para ser carreagodo na render
  * 
  * 
  * @description Monta o path da render escolhida
  * Caso não tenha o arquivo na view serar mostrando uma mensagem de erro.
  * 
  */
 public function render($render, $param = [])
 {
     $render = View::pathView(self::$namespace_module) . '/views/' . self::$view . '/' . $render . '.php';
     $layout = View::pathView(self::$namespace_module) . '/views/layout/' . $this->layout . '.php';
     return View::render($render, $param, $layout);
 }
예제 #12
0
파일: index.php 프로젝트: Mike0712/dom8
<?php

require __DIR__ . '/serv/autoload.php';
use App\View;
$view = new View();
$view->asign('bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous');
$view->asign('bootstraploc', 'css/bootstrap.css');
$view->asign('bootstraptheme', 'css/bootstrap-theme.css');
$view->asign('style', 'css/style.css');
use App\model\Main;
$view->asign('main', new Main());
use App\model\Gallery;
$view->asign('gall', new Gallery());
use App\model\Shedule;
$view->asign('shedule', new Shedule());
use App\model\Nav;
$view->asign('nav', new Nav());
$view->display();
예제 #13
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function test_1()
 {
     return View::getAdminTeacherView();
 }
예제 #14
0
use App\View;
require __DIR__ . '/autoload.php';
/**
 * При создании модели передаём ей свойства - массив
 * методом getProperties() - перебираем их с использование Итератора
 */
$news = new News(['news' => 'First', 'title' => 'Экспериментальная новость', 'description' => 'Описание экспериментальной новости']);
$news->getProperties();
?>
<pre><?php 
var_dump($news);
?>
</pre><?php 
/**
 * Перебор итератором объектов News
 */
$news = News::findAll();
foreach ($news as $key => $value) {
    ?>
<pre><?php 
    var_dump($key, $value);
    ?>
</pre><?php 
}
var_dump($news[0]);
$view = new View();
$view->title = 'Урок 3';
$view->news = News::findLastRecords(3);
// Вывод колличества объектов с использованием интефейса Countable
//echo count($view); die;
$view->display(__DIR__ . '/App/templates/index.html');
예제 #15
0
파일: error.php 프로젝트: smith46102/koda
 public function run()
 {
     View::render('404');
 }
예제 #16
0
 public function proposal_invite($user)
 {
     $unsubscribelink = unsubscribe_link($user->id, $user->email, 'job_invite_cron');
     $targetlink = Autologin::to($user, $this->plink() . '?utm_source=proposal_invite&utm_medium=email&utm_campaign=Notifications');
     $data = array('targetlink' => $targetlink, 'unsubscribelink' => $unsubscribelink, 'job' => $this, 'from' => UPDATE_EMAIL, 'from_name' => SENDER_NAME, 'to' => $user->email, 'fname' => $user->fname, 'subject' => $user->fname . ', you have received a job request from ' . $this->user->fname);
     $mailer = new Mailer();
     $mailer->sender_email = $data['from'];
     $mailer->sender_name = $data['from_name'];
     $mailer->receiver_email = $data['to'];
     $mailer->receiver_name = $data['fname'];
     $mailer->subject = $data['subject'];
     $mailer->message = View::make('emails.jobs/proposal_invite', $data)->render();
     $mailer->status = '0';
     $mailer->priority = '1';
     $mailer->save();
     return TRUE;
 }
예제 #17
0
파일: Admin.php 프로젝트: roslairy/phil
 public function teacherDelete()
 {
     $v = Validator::make(Input::all(), ['id' => 'required|numeric']);
     if ($v->fails()) {
         return View::getBadRequstView($v->messages());
     } else {
         if (Teacher::find(Input::get('id')) == null) {
             return View::getBadRequstView('no teach of this id. id is ' . Input::get('id'));
         }
     }
     Teacher::find(Input::get('id'))->delete();
     return redirect('/admin/teacher');
 }
예제 #18
0
 public function makeCreatePermissionForm($fid)
 {
     $feature = Feature::find($fid);
     if (!isset($feature)) {
         return Redirect::to('/crm/feature')->withMessage(Generate::message('Invalid', 'Invalid Feature or Feature has been deleted'));
     }
     $all_positions = Permission::getAllCurrentPosition();
     $icons = SysConfig::getSystemConfig('Icons');
     $icon_bgs = SysConfig::getSystemConfig('IconBG');
     $all_pages = Permission::getAllCurrentPages();
     $all_prompt_types = Permission::getAllCurrentPromptTypes();
     return View::make('backend.feature.create_permission')->with('feature', $feature)->with('icons', $icons)->with('icon_bgs', $icon_bgs)->with('all_prompt_types', $all_prompt_types)->with('all_pages', $all_pages)->with('all_positions', $all_positions)->with('module', $this->module);
 }
예제 #19
0
 /**
  *Renders a single post.
  *
  * @return string  HTML
  */
 public function toHTML($catalog, $multiboard, $preview)
 {
     $rememberTags = ["board.{$this->board->board_uri}", "post_{$this->post_id}", "post_html"];
     $rememberTimer = 30;
     $rememberKey = "board.{$this->board->board_uri}.post_html.{$this->board_id}";
     $rememberClosure = function () use($catalog, $multiboard, $preview) {
         $this->setRelation('attachments', $this->attachments->reverse());
         return \View::make('content.board.post', ['board' => $this->board, 'post' => $this, 'user' => user(), 'catalog' => $catalog, 'reply_to' => $this->reply_to ?: false, 'multiboard' => $multiboard, 'preview' => $preview])->render();
     };
     if (!user()->isAnonymous()) {
         return $rememberClosure();
     }
     if ($catalog) {
         $rememberTags[] = "catalog_post";
         $rememberTimer += 30;
     }
     if ($multiboard) {
         $rememberTags[] = "multiboard_post";
         $rememberTimer -= 20;
     }
     if ($preview) {
         $rememberTags[] = "preview_post";
         $rememberTimer -= 20;
     }
     switch (env('CACHE_DRIVER')) {
         case "file":
         case "database":
             break;
         default:
             return Cache::tags($rememberTags)->remember($rememberKey, $rememberTimer, $rememberClosure);
     }
     return $rememberClosure();
 }
예제 #20
0
파일: index.php 프로젝트: Mike0712/dom8
<?php

require __DIR__ . '/../serv/autoload.php';
use App\View;
$view = new View();
$view->asign('bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous');
$view->asign('bootstraploc', '../css/bootstrap.css');
$view->asign('style', '../css/style.css');
use App\model\Admin;
$view->asign('su', new admin());
use App\model\Nav;
$view->asign('nav', new Nav());
$view->AdminDisplay();
예제 #21
0
파일: login.php 프로젝트: smith46102/koda
 public function run()
 {
     View::set($this->get(['login', 'password', 'error']));
     View::render('login');
 }
예제 #22
0
파일: HomeCtrl.php 프로젝트: mini-mvc/php
 public function __construct()
 {
     $view = new View('home.php');
     $view->vars(array('msg' => 'Bem vindo!'));
 }
예제 #23
0
 /**
  * Returns the fully rendered HTML of a post in the JSON output.
  *
  * @return string
  */
 public function getHtmlAttribute()
 {
     if (!$this->trashed()) {
         return \View::make('content.board.post', ['board' => $this->board, 'post' => $this, 'user' => user(), 'op' => false, 'reply_to' => $this->reply_to ?: $this->board_id, 'preview' => false])->render();
     }
     return null;
 }
예제 #24
0
<?php

use App\Models\News;
use App\View;
const STATUS_ACTIVE = 1;
require __DIR__ . '/../../autoload.php';
$post = $_POST;
if (!empty($post)) {
    if (empty($post['id_news'])) {
        $article = new News();
    } else {
        $article = News::findById($post['id_news']);
    }
    $article->title = trim($post['title']);
    $article->description = trim($post['description']);
    $article->published = date("Y-m-d H:i:s");
    $article->status = STATUS_ACTIVE;
    $article->author_id = 1;
    $article->save();
    $view = new View();
    $view->title = 'Страница статьи';
    $view->article = $article;
    $view->display(__DIR__ . '/../templates/one.html');
} else {
    header('Location: /');
    exit(0);
}