示例#1
0
 public static function get($id, $type = FALSE)
 {
     // Type specified
     if ($type) {
         if ($note = input::cookie("note-{$type}-{$id}")) {
             self::delete($id);
             return array('id' => $id, 'type' => $type, 'content' => $note);
         } else {
             return FALSE;
         }
     } else {
         // Regular
         if ($note = input::cookie("note-regular-{$id}")) {
             self::delete($id);
             return array('id' => $id, 'type' => 'regular', 'content' => $note);
         } elseif ($note = input::cookie("note-error-{$id}")) {
             self::delete($id);
             return array('id' => $id, 'type' => 'error', 'content' => $note);
         } elseif ($note = input::cookie("note-warning-{$id}")) {
             self::delete($id);
             return array('id' => $id, 'type' => 'warning', 'content' => $note);
         } elseif ($note = input::cookie("note-success-{$id}")) {
             self::delete($id);
             return array('id' => $id, 'type' => 'success', 'content' => $note);
         } else {
             return FALSE;
         }
     }
 }
示例#2
0
 static function index()
 {
     $head = array('title' => 'EQPHP开源中文WEB应用开发框架');
     input::cookie('frame_name', 'EQPHP');
     $logo_file = DATA_STORE . 'txt/logo_pic.txt';
     $source = base64_decode(file_get_contents($logo_file));
     file_put_contents(FILE_CREATE . 'eqphp_logo.png', $source);
     $logo = '<img src="' . URL_CREATE . 'eqphp_logo.png">';
     smarty()->assign(compact('head', 'logo'))->display('index');
 }
示例#3
0
 static function index()
 {
     $url = U_R_L;
     $head = array('title' => 'EQPHP开源中文WEB应用开发框架');
     input::cookie('frame_name', 'EQPHP');
     $logo_file = DATA_STORE . 'txt/logo_pic.txt';
     $source = base64_decode(file_get_contents($logo_file));
     file_put_contents(FILE_TEMP . 'eqphp_logo.png', $source);
     $logo = '<img src="' . URL_TEMP . 'eqphp_logo.png">';
     $data = compact('url', 'head', 'logo');
     return with('view')->assign($data)->display('index.html');
 }
示例#4
0
 static function csrf($mode, $csrf = '')
 {
     $key = config('secure.csrf_name', 'secure');
     if ($mode === 'get') {
         return session::get($key);
     }
     if ($mode === 'check') {
         //Notice 是否只用一次并清掉cookie
         // input::cookie($key,$value,1);
         return $csrf && $csrf === session::get($key);
     }
     if ($mode === 'set') {
         $value = substr(secure::token(time()), 5, 8);
         session::set($key, $value);
         input::cookie($key, $value, 7200);
     }
     return true;
 }
示例#5
0
 public static function delete($name, $cookie = FALSE)
 {
     if (!$cookie) {
         $cookie = self::$config['cookie'];
     }
     $t = db(self::$config['table'], NULL, self::$config['connection']);
     $t->delete('cookie', '=', input::cookie($name));
     $cookie['name'] = $name;
     cookie::delete($cookie);
     unset(self::$table[$name]);
 }