/**
  *	Log out user
  */
 public static function logout()
 {
     session::del(array('uid', 'ulogin', 'uhash'), AUTH_DI);
     // Get instance of authentification data interface
     $auth = data_interface::get_instance(AUTH_DI);
     $auth->is_logged = FALSE;
 }
 function logout_action() {
     cookie::del('login_username');
     cookie::del('login_password');
     session::del('username');
     session::del('roles');
     require_once ROOT.'/celive/include/config.inc.php';
     require_once ROOT.'/celive/include/celive.class.php';
     $login=new celive();
     $login->auth();
     $GLOBALS['auth']->logout();
     $GLOBALS['auth']->check_logout1();
     front::redirect(url::create('index'));
 }
 function edit_action() {
     if (front::post('submit') &&$this->manage->vaild()) {
         $this->manage->filter($this->Exc);
         $this->manage->edit_before();
         $this->manage->save_before();
         $update=$this->_table->rec_update(front::$post,front::get('id'));
         if ($update <1) {
             front::flash("{$this->tname}修改失败!");
         }
         else {
             $this->manage->save_after(front::get('id'));
             $info='';
             front::flash("{$this->tname}修改成功!$info");
             $from=session::get('from');
             session::del('from');
             if (!front::post('onlymodify')) front::redirect(url::modify('act/list',true));
         }
     }
     if (!session::get('from')) session::set('from',front::$from);
     if (!front::get('id')) exit("PAGE_NOT FOUND!");
     $this->_view_table=$this->_table->getrow(front::get('id'),'1',$this->_table->getcols('modify'));
     if (!is_array($this->_view_table)) exit("PAGE_NOT FOUND!");
     $this->manage->view_before($this->_view_table);
 }
 function save_after($aid) {
     //$tag=preg_replace('/\s+/',' ',trim(front::$post['tag']));
     $tags=explode(',',trim(front::$post['tag']));
     //var_dump($tags);
     $tag_table=new tag();
     $arctag_table=new arctag();
     foreach($tags as $tag) {
         if($tag)
             if(!$tag_table->getrow('tagname="'.$tag.'"'))
                 $tag_table->rec_insert(array('tagname'=>$tag));
         $tag=$tag_table->getrow('tagname="'.$tag.'"');
         $arctag_table->rec_replace(array('aid'=>$aid,'tagid'=>$tag['tagid']));
     }
     //exit;
     $doit = false;
     if(session::get('attachment_id') ||front::post('attachment_id')) {
         $attachment_id=session::get('attachment_id')?session::get('attachment_id'):front::post('attachment_id');
         $attachment=new attachment();
         $attachment->rec_update(array('aid'=>$aid,'intro'=>front::post('attachment_intro')),$attachment_id);
         $doit = true;
         if(session::get('attachment_id')) session::del('attachment_id');
     }
     if(front::post('attachment_path') != '' && $doit == false) {
         $attachment=new attachment();
         $attachment->rec_insert(array('aid'=>$aid,'path'=>front::post('attachment_path'),'intro'=>front::post('attachment_intro'),'adddate'=>date('Y-m-d H:i:s')));
         $doit = false;
     }
     if(front::post('_ranks')) {
         $_ranks=serialize(front::post('_ranks'));
         $rank=new rank();
         if(is_array($rank->getrow(array('aid'=>$aid))))
             $rank->rec_update(array('ranks'=>$_ranks),'aid='.$aid);
         else
             $rank->rec_insert(array('aid'=>$aid,'ranks'=>$_ranks));
     }
     else {
         $rank=new rank();
         $rank->rec_delete('aid='.$aid);
     }
     if(front::post('vote')) {
         $votes=front::$post['vote'];
         $images=front::$post['vote_image'];
         $vote=new vote();
         $_vote=$vote->getrow('aid='.$aid);
         if(!$_vote) $_vote=array('aid'=>$aid);
         $_vote['titles']=serialize($votes);
         $_vote['images']=serialize($images);
         $vote->rec_replace($_vote,$aid);
     }
 }
 static function showflash($key='message') {
     $message=session::get($key);
     session::del($key);
     return $message;
 }
 function index_action() {
     session::del('mod');
 }
Beispiel #7
0
 /**
  * 修改用户手机
  * PUT /user/1/phone {code:"C09E"}
  * @method GET_infoAction
  * @param  integer        $id [description]
  * @author NewFuture
  */
 public function PUT_phoneAction($id = 0)
 {
     $id = $this->auth($id);
     $response['status'] = 0;
     if (!Input::put('code', $code, 'ctype_alnum')) {
         $response['info'] = '验证码格式不对';
     } elseif (!($verify = Session::get('code_phone'))) {
         $response['info'] = '验证码已过期,请重新生成';
     } elseif (!Safe::checkTry('phone_code_' . $id)) {
         $response['info'] = '此验证码尝试次数过多,请重新发送短信';
         Session::del('code_phone');
     } elseif (key($verify) != strtoupper($code)) {
         $response['info'] = '验证码错误';
     } else {
         session::del('code_phone');
         Safe::del('phone_code_' . $id);
         $phone = $verify[strtoupper($code)];
         //读取号码
         if (UserModel::SavePhone($phone)) {
             $response['info'] = '手机号已经更新';
             $response['status'] = 1;
         } else {
             $response['info'] = '手机号保存失败';
         }
     }
     $this->response = $response;
 }
 function mail_action() {
 	chkpw('seo_mail_usersend');
     $where=null;
     $ordre='1 desc';
     if ($this->table == 'archive') {
         $ordre="`order`,1 DESC";
         $where=$this->_table->get_where('manage');
         if (!front::post('_typeid'))
             session::del('_typeid');
         if (get('_typeid')) {
             $typeid=get('_typeid');
             session::set('_typeid',$typeid);
             $this->type=type::getInstance();
             $types=$this->type->sons($typeid);
             $types[]=$typeid;
             $where .=' and typeid in('.trim(implode(',',$types),',').')';
         }
         if (get('typeid')) {
             $typeid=get('typeid');
             $where .=' and typeid='.$typeid;
         }
         if (!front::post('_title'))
             session::del('_title');
         if (get('_title')) {
             $title=get('_title');
             session::set('_title',$title);
             $where .=" and title like '%$title%' ";
         }
     }
     if ($this->table == 'templatetag') {
         if (front::get('tagfrom')) {
             $where="tagfrom='".front::get('tagfrom')."'";
         }
         else
             $where="tagfrom='define'";
         $where .=" and (`tagvar` IS NULL OR `tagvar` = '') ";
     }
     if ($this->table == 'option') {
         $ballot=new ballot();
         $where=array('bid'=>front::$get['bid']);
         session::set('bid',front::$get['bid']);
         $row=$ballot->getrow(array('id'=>front::$get['bid']));
         $this->view->ballot=$row;
     }
     $limit=((front::get('page') -1) * $this->_pagesize).','.$this->_pagesize;
     $this->_view_table=$this->_table->getrows($where,$limit,$ordre,$this->_table->getcols('manage'));
     $this->view->record_count=$this->_table->record_count;
 }
 function edit_action() {
     $from=session::get('from');
     front::check_type(front::get('id'));
     if(front::post('submit') &&$this->manage->vaild()) {
         $this->manage->filter();
         $info=$this->_table->getrow(front::get('id'));
         if($info['userid'] != $this->view->user['userid'] ) {
             front::flash('记录修改失败!(原因:未经授权!)');
             header("Location: ".$from,TRUE,302);
             exit;
         }
         if($info['checked']) {
             front::flash('记录修改失败!(原因:已通过审核!)');
             header("Location: ".$from,TRUE,302);
             exit;
         }
         $this->manage->save_before();
         $data=array();
         $fieldlimit=$this->_table->getcols(front::$act=='list'?'user_manage':'user_modify');
         $fieldlimits=explode(',',$fieldlimit);
         foreach(front::$post as $key=>$value) {
         	if(preg_match('/(select|union|and|\'|"|\))/i',$value)){
         		exit('非法参数');
         	}
             if(in_array($key,$fieldlimits))
                 $data[$key]=$value;
         }
         $update=$this->_table->rec_update($data,front::get('id'));
         if($update<1) {
             front::flash(lang('记录修改失败!'));
         }
         else {
             front::flash(lang('记录修改成功!'));
             $from=session::get('from');
             session::del('from');
             header("Location: ".$from,TRUE,302);
             exit;
         }
     }
     if(!session::get('from')) session::set('from',front::$from);
     $this->_view_table=$this->_table->getrow(front::get('id'),'1',$this->_table->getcols('modify'));
 }
Beispiel #10
0
 function logout_action() {
     cookie::del('login_username');
     cookie::del('login_password');
     session::del('username');
     front::redirect(url::create('user/login'));
     exit;
 }
 function edit_action() {
     if (front::post('submit') &&$this->manage->vaild()) {
         $this->manage->filter($this->Exc);
         $this->manage->edit_before();
         $this->manage->save_before();
         front::$post['ologin_config'] = array();
         if (isset(front::$post['cfg_value']) &&is_array(front::$post['cfg_value'])) {
             for ($i = 0;$i <count(front::$post['cfg_value']);$i++) {
                 $ologin_config[] = array('name'=>trim(front::$post['cfg_name'][$i]),
                         'type'=>trim(front::$post['cfg_type'][$i]),
                         'value'=>trim(front::$post['cfg_value'][$i])
                 );
             }
         }
         front::$post['ologin_config'] = serialize($ologin_config);
         front::$post['enabled'] = 1;
         $update=$this->_table->rec_update(front::$post,front::get('id'));
         if ($update <1) {
             front::flash("{$this->tname}修改失败!");
         }
         else {
             $this->manage->save_after(front::get('id'));
             $info='';
             front::flash("{$this->tname}修改成功!$info");
             $from=session::get('from');
             session::del('from');
             if (!front::post('onlymodify')) front::redirect(url::modify('act/list',true));
         }
     }
     if (!session::get('from')) session::set('from',front::$from);
     if (!front::get('id')) exit("PAGE_NOT FOUND!");
     $this->_view_table=$this->_table->getrow(front::get('id'),'1',$this->_table->getcols('modify'));
     $set_modules = true;
     global $_LANG;
     include_once(ROOT.'/lib/plugins/ologin/'.$this->_view_table['ologin_code'].'.php');
     $data = $modules[0];
     $ologin = $this->_view_table;
     if (is_string($ologin['ologin_config'])) {
         $store = unserialize($ologin['ologin_config']);
         $code_list = array();
         foreach ($store as $key=>$value) {
             $code_list[$value['name']] = $value['value'];
         }
         $ologin['ologin_config'] = array();
         foreach ($data['config'] as $key =>$value) {
             $ologin['ologin_config'][$key]['desc'] = (isset($_LANG[$value['name'] .'_desc'])) ?$_LANG[$value['name'] .'_desc'] : '';
             $ologin['ologin_config'][$key]['label'] = $_LANG[$value['name']];
             $ologin['ologin_config'][$key]['name'] = $value['name'];
             $ologin['ologin_config'][$key]['type'] = $value['type'];
             if (isset($code_list[$value['name']])) {
                 $ologin['ologin_config'][$key]['value'] = $code_list[$value['name']];
             }
             else {
                 $ologin['ologin_config'][$key]['value'] = $value['value'];
             }
             if ($ologin['ologin_config'][$key]['type'] == 'select'||
                     $ologin['ologin_config'][$key]['type'] == 'radiobox') {
                 $ologin['ologin_config'][$key]['range'] = $_LANG[$ologin['ologin_config'][$key]['name'] .'_range'];
             }
         }
     }
     if (!is_array($this->_view_table)) exit("PAGE_NOT FOUND!");
     $this->_view_table['ologincfg'] = unserialize($this->_view_table['ologincfg']);
     $this->_view_table['ologin'] = $ologin;
     $this->manage->view_before($this->_view_table);
 }
Beispiel #12
0
var FCKDialog		= E.FCKDialog ;
var FCKBrowserInfo	= E.FCKBrowserInfo ;
var FCKConfig		= E.FCKConfig ;*/

/*var oEditor= window.parent.InnerDialogLoaded() ;
var oDOM= oEditor.FCK.EditorDocument ;
var FCK = oEditor.FCK;
var FCKDialog	=  oEditor.FCKDialog ;
*/
var oEditor= window.parent.InnerDialogLoaded() ;
var FCKeditorAPI=oEditor.FCKeditorAPI;
<?php
$fcid=session::get('fcid');
if(!$fcid || time()>session::get('fcid_life')) $fcid='content';
session::del('fcid');
session::del('fcid_life');
?>
var FCKoEditor = FCKeditorAPI.GetInstance('{$fcid}');

function ImageOK(img)
{
	inImg  = '<img src="'+img+'"/>';
	FCKoEditor.InsertHtml(inImg) ;
	window.parent.Cancel();

/*	//获得焦点,否则图片会飞出去~
	FCKoEditor.Focus();
	if(document.all) oDOM.selection.createRange().pasteHTML(inImg);
	else FCK.InsertHtml(inImg);
	window.parent.Cancel();*/