/**
  * [home 网站设置]
  * @return [type] [description]
  */
 public function home()
 {
     if (IS_POST) {
         $data = ['web_title' => I('post.web_title'), 'web_keyword' => I('post.web_keyword'), 'web_desription' => I('post.web_desription'), 'web_footer' => I('post.web_footer')];
         Website::where(['id' => 1])->update($data);
         View::success('更新成功');
         die;
     }
     $webData = Website::find(1)->toArray();
     //print_r($webData);
     $this->smarty->assign('webData', $webData);
     $this->smarty->assign('title', '网站设置_ISisWeb中文网后台管理_ISirPHPFramework');
     $this->smarty->display('Admin/System/home.html');
     die;
     // $this->view = View::make('/Admin/System/home')
     // 			   ->with('webData',$webData)
     // 			   ->with('title','网站设置_ISirWeb中文网');
 }
Example #2
0
 public function doEditWebsite($id)
 {
     $user_id = Auth::user()->id;
     $rules = array('title' => 'required', 'type' => 'required', 'account_id' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/websites/' . $id)->withErrors($validator)->withInput();
     } else {
         $title = Input::get('title');
         $tagline = Input::get('tagline');
         $about = Input::get('about');
         $type = Input::get('type');
         $account_id = Input::get('account_id');
         $domain_name = Input::get('domain_name');
         $is_public = 0;
         if (Input::has('public')) {
             $is_public = 1;
         }
         $website = Website::where('user_id', '=', $user_id)->where('id', '=', $id)->first();
         $website->user_id = $user_id;
         $website->type = $type;
         $website->account_id = $account_id;
         $website->domain_name = $domain_name;
         $website->title = $title;
         $website->tagline = $tagline;
         $website->about = $about;
         $website->public = $is_public;
         $website->save();
         return Redirect::to('/websites/' . $id)->with('message', array('type' => 'success', 'text' => 'You have successfully updated the website!'));
     }
 }
Example #3
0
    }
});
$app->post('/checkWebsite', function () {
    session_start();
    session_regenerate_id();
    if (isset($_SESSION['userId'])) {
        $url = $_POST['url'];
        $userId = $_SESSION['userId'];
        // Need to check for an active session
        $session = Session::where('endTime', "=", null)->where('userId', '=', $userId)->first();
        // If there is an active session, grab the environment and websites.
        // Compare the url to the urls of the websites.
        // If it is blacklisted, update the session accordingly.
        if (isset($session) && !empty($session)) {
            $environmentId = $session->environmentId;
            $websites = Website::where('environmentId', '=', $environmentId)->get();
            foreach ($websites as $website) {
                $blacklistedUrl = $website->domainName;
                if (strpos($url, $blacklistedUrl) !== false) {
                    $session->blacklistedSitesVisited++;
                } else {
                    $session->nonBlacklistedSitesVisited++;
                }
                $session->save();
                break;
            }
            $response['success'] = 1;
            $response['session'] = $session->toArray();
            echo json_encode($response);
        } else {
            $response['success'] = 0;