Exemple #1
0
 /**
  * 保存成员信息
  */
 function actionSave()
 {
     __TRY();
     $this->_modelMembers->saveMember($_POST);
     $ex = __CATCH();
     if (__IS_EXCEPTION($ex)) {
         return $this->_editMember($_POST, $ex->getMessage());
     }
     js_alert(_T('ui_m_member_success'), '', $this->_url('index'));
 }
Exemple #2
0
 /**
  * 保存帖子
  */
 function actionSave()
 {
     $post = array('post_id' => $_POST['post_id'], 'title' => $_POST['title'], 'body' => strip_tags($_POST['body']));
     __TRY();
     $this->_modelPosts->savePost($post);
     $ex = __CATCH();
     if (__IS_EXCEPTION($ex)) {
         return $this->_editComment($post, $ex->getMessage());
     }
     js_alert(_T('ui_c_success_post'), '', $this->_url('index'));
 }
 /**
  * 写入指定 id 的 session 数据
  *
  * @param string $sessid
  * @param string $data
  *
  * @return boolean
  */
 function sessionWrite($sessid, $data)
 {
     $sessid = $this->dbo->qstr($sessid);
     $sql = "SELECT COUNT(*) FROM {$this->tableName} WHERE {$this->fieldId} = {$sessid}";
     $data = $this->dbo->qstr($data);
     $activity = time();
     $fields = (array) $this->_beforeWrite($sessid);
     if ((int) $this->dbo->getOne($sql) > 0) {
         $sql = "UPDATE {$this->tableName} SET {$this->fieldData} = {$data}, {$this->fieldActivity} = {$activity}";
         if (!empty($fields)) {
             $arr = array();
             foreach ($fields as $field => $value) {
                 $arr[] = $this->dbo->qfield($field) . ' = ' . $this->dbo->qstr($value);
             }
             $sql .= ', ' . implode(', ', $arr);
         }
         $sql .= " WHERE {$this->fieldId} = {$sessid}";
     } else {
         $extraFields = '';
         $extraValues = '';
         if (!empty($fields)) {
             foreach ($fields as $field => $value) {
                 $extraFields .= ', ' . $this->dbo->qfield($field);
                 $extraValues .= ', ' . $this->dbo->qstr($value);
             }
         }
         $sql = "INSERT INTO {$this->tableName} ({$this->fieldId}, {$this->fieldData}, {$this->fieldActivity}{$extraFields}) VALUES ({$sessid}, {$data}, {$activity}{$extraValues})";
     }
     __TRY();
     $this->dbo->execute($sql);
     $ex = __CATCH();
     return !__IS_EXCEPTION($ex);
 }
Exemple #4
0
 /**
  * 保存帖子
  */
 function actionSave()
 {
     __TRY();
     $this->_modelProjects->saveProject($_POST);
     $ex = __CATCH();
     if (__IS_EXCEPTION($ex)) {
         return $this->_editProject($post, $ex->getMessage());
     }
     js_alert(_T('ui_c_success_post'), '', $this->_url('index'));
 }