• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP fixer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中fixer的典型用法代码示例。如果您正苦于以下问题:PHP fixer类的具体用法?PHP fixer怎么用?PHP fixer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了fixer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: update

 /**
  * update an address. 
  * 
  * @param  int    $id 
  * @access public
  * @return void
  */
 public function update($id)
 {
     $product = new stdclass();
     $address = fixer::input('post')->add('account', $this->app->user->account)->get();
     $this->dao->update(TABLE_ADDRESS)->data($address)->where('id')->eq($id)->beginIf(RUN_MODE == 'front')->andWhere('account')->eq($this->app->user->account)->fi()->batchCheck($this->config->address->require->edit, 'notempty')->exec();
     return !dao::isError();
 }
开发者ID:qiaqiali,项目名称:chanzhieps,代码行数:14,代码来源:model.php


示例2: gererateCustomField

 public function gererateCustomField($type = 'info', $method = 'add')
 {
     $this->app->loadClass('infoextdao', $static = true);
     //echo $_REQUEST['Null'][0]."\n";
     $oldField = '';
     if (empty($_REQUEST['Field']) && $_REQUEST['Field'] != '0') {
         echo js::alert($this->lang->custom->fieldEmpty);
         return false;
     }
     if (!(empty($_REQUEST['oldField']) && $_REQUEST['oldField'] != '0')) {
         $oldField = $_REQUEST['oldField'];
         $oldField = infoextdao::backquote($this->config->customFieldPrefix . $oldField);
         //echo js::alert($oldField);
     }
     $custom = fixer::input('post')->setDefault('Collation', 'utf8_general_ci')->setDefault('Attribute', '')->setDefault('Extra', false)->get();
     $field_primary = array();
     //var_dump($custom);
     $definition = ' ' . strtoupper($method) . ' ' . $oldField . ' ' . infoextdao::generateFieldSpec($this->config->customFieldPrefix . $custom->Field, $custom->Type, $custom->Length, $custom->Attribute, $custom->Collation, isset($_REQUEST['NULL'][0]) ? $_REQUEST['NULL'][0] : 'NOT NULL', $custom->DefaultType, $custom->DefaultValue, $custom->Extra, $custom->Comment, $field_primary, 0);
     $table = $this->config->custom->typeToTable[$type];
     $sql_query = 'ALTER TABLE ' . infoextdao::backquote($table) . ' ' . $definition;
     //echo js::alert($sql_query);
     try {
         $result = $this->app->dbh->query($sql_query);
     } catch (Exception $e) {
         //echo 'Message: ' .$e->getMessage();
         echo js::alert(addslashes($sql_query));
         echo js::alert($this->lang->custom->alterTableFailed);
         return false;
     }
     return true;
 }
开发者ID:huokedu,项目名称:zentao,代码行数:31,代码来源:model.php


示例3: deleteSunyard

 /**
  * Delete all data for Sunyard 
  * 
  * @access public
  * @return void
  */
 public function deleteSunyard()
 {
     $deleteProjects = fixer::input('post')->get();
     foreach ($deleteProjects->projects as $projectID) {
         $this->dao->delete()->from(TABLE_SUNEFFORTEVERYDAY)->where('project')->eq($projectID)->exec();
         $this->dao->delete()->from(TABLE_SUNPROJECTESTIMATE)->where('project')->eq($projectID)->exec();
     }
 }
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:14,代码来源:project.php


示例4: update

 /**
  * Update a release.
  * 
  * @param  int    $releaseID 
  * @access public
  * @return void
  */
 public function update($releaseID)
 {
     $oldRelease = $this->getByID($releaseID);
     $release = fixer::input('post')->stripTags('name')->setDefault('stories', '')->setDefault('bugs', '')->join('stories', ',')->join('bugs', ',')->get();
     $this->dao->update(TABLE_RELEASE)->data($release)->autoCheck()->batchCheck($this->config->release->edit->requiredFields, 'notempty')->check('name', 'unique', "id != {$releaseID}")->where('id')->eq((int) $releaseID)->exec();
     $this->dao->update(TABLE_STORY)->set('stage')->eq('released')->where('id')->in($release->stories)->exec();
     if (!dao::isError()) {
         return common::createChanges($oldRelease, $release);
     }
 }
开发者ID:huokedu,项目名称:zentao,代码行数:17,代码来源:model.php


示例5: update

 /**
  * Update a product.
  * 
  * @param  int $productID 
  * @access public
  * @return void
  */
 public function update($productID)
 {
     $oldProduct = $this->getByID($productID);
     $product = fixer::input('post')->add('editedBy', $this->app->user->account)->add('editedDate', helper::now())->get();
     $this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck()->batchCheck($this->config->product->require->edit, 'notempty')->where('id')->eq($productID)->exec();
     if (dao::isError()) {
         return false;
     }
     return commonModel::createChanges($oldProduct, $product);
 }
开发者ID:leowh,项目名称:colla,代码行数:17,代码来源:model.php


示例6: lang

 /**
  * Set lang. 
  * 
  * @param  string    $module 
  * @param  string    $field 
  * @access public
  * @return void
  */
 public function lang($module, $field, $appName = '')
 {
     $clientLang = $this->app->getClientLang();
     if (empty($appName)) {
         $appName = $this->app->getAppName();
     }
     $this->app->loadLang($module, $appName);
     if ($module == 'user' and $field == 'roleList' and $appName == 'sys') {
         $this->lang->menuGroups->setting = 'user';
     }
     if (!empty($_POST)) {
         if ($module == 'common' and $field == 'currencyList') {
             $setting = fixer::input('post')->join('currency', ',')->setDefault('currency', '')->get();
             $this->setting->setItems('system.sys.setting', $setting);
             if (dao::isError()) {
                 $this->send(array('result' => 'fail', 'message' => dao::getError()));
             }
             $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('lang', "module={$module}&field={$field}&appName={$appName}")));
         }
         $lang = $_POST['lang'];
         $appendField = isset($this->config->setting->appendLang[$module][$field]) ? $this->config->setting->appendLang[$module][$field] : '';
         $this->setting->deleteItems("lang={$lang}&app={$appName}&module={$module}&section={$field}", $type = 'lang');
         if ($appendField) {
             $this->setting->deleteItems("lang={$lang}&app={$appName}&module={$module}&section={$appendField}", $type = 'lang');
         }
         foreach ($_POST['keys'] as $index => $key) {
             $value = $_POST['values'][$index];
             if (!$value or !$key) {
                 continue;
             }
             $system = $_POST['systems'][$index];
             $this->setting->setItem("{$lang}.{$appName}.{$module}.{$field}.{$key}.{$system}", $value, $type = 'lang');
             /* Save additional item. */
             if ($appendField) {
                 $this->setting->setItem("{$lang}.{$appName}.{$module}.{$appendField}.{$key}.{$system}", $_POST[$appendField][$index], $type = 'lang');
             }
         }
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('lang', "module={$module}&field={$field}&appName={$appName}")));
     }
     $dbFields = $this->setting->getItems("lang={$clientLang},all&app={$appName}&module={$module}&section={$field}", 'lang');
     $systemField = array();
     foreach ($dbFields as $dbField) {
         $systemField[$dbField->key] = $dbField->system;
     }
     $this->view->fieldList = $module == 'common' ? $this->lang->{$field} : $this->lang->{$module}->{$field};
     $this->view->module = $module;
     $this->view->field = $field;
     $this->view->clientLang = $clientLang;
     $this->view->systemField = $systemField;
     $this->view->appName = $appName;
     $this->display();
 }
开发者ID:leowh,项目名称:colla,代码行数:63,代码来源:control.php


示例7: update

 /**
  * Update a company.
  * 
  * @access public
  * @return void
  */
 public function update()
 {
     $company = fixer::input('post')->get();
     if ($company->website == 'http://') {
         $company->website = '';
     }
     if ($company->backyard == 'http://') {
         $company->backyard = '';
     }
     $companyID = $this->app->company->id;
     $this->dao->update(TABLE_COMPANY)->data($company)->autoCheck()->batchCheck($this->config->company->edit->requiredFields, 'notempty')->batchCheck('name', 'unique', "id != '{$companyID}'")->where('id')->eq($companyID)->exec();
 }
开发者ID:caiwenhao,项目名称:zentao,代码行数:18,代码来源:model.php


示例8: save

 /**
  * Save params 
  * 
  * @param  int    $index 
  * @param  string $type 
  * @param  string $appName 
  * @param  int    $blockID 
  * @access public
  * @return void
  */
 public function save($index, $type = 'system', $appName = 'sys', $blockID = 0)
 {
     $data = fixer::input('post')->add('account', $this->app->user->account)->add('order', $index)->add('app', $appName)->add('hidden', 0)->setIF($type != 'system', 'block', $type)->setIF($blockID, 'id', $blockID)->setDefault('grid', '4')->setDefault('source', $appName)->setDefault('params', array())->get();
     if ($type != 'system') {
         $data->source = '';
     }
     if ($type == 'html') {
         $data->params['html'] = $data->html;
         unset($data->html);
     }
     $data->params = helper::jsonEncode($data->params);
     $this->dao->replace(TABLE_BLOCK)->data($data, 'uid')->exec();
 }
开发者ID:leowh,项目名称:colla,代码行数:23,代码来源:model.php


示例9: link

 /**
  * Set link for a tag.
  * 
  * @param  int    $tagID 
  * @access public
  * @return void
  */
 public function link($tagID)
 {
     if ($_POST) {
         $link = fixer::input('post')->stripTags('link', $this->config->allowedTags->admin)->get();
         $this->dao->update(TABLE_TAG)->data($link)->autoCheck()->where('id')->eq($tagID)->exec();
         if (!dao::isError()) {
             $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
         }
         $this->send(array('result' => 'fail', 'message' => dao::getError()));
     }
     $this->view->title = "<i class='icon-edit'></i> " . $this->lang->tag->editLink;
     $this->view->tag = $this->dao->select('*')->from(TABLE_TAG)->where('id')->eq($tagID)->fetch();
     $this->display();
 }
开发者ID:dyp8848,项目名称:chanzhieps,代码行数:21,代码来源:control.php


示例10: set

 /**
  * Custom 
  * 
  * @param  string $module 
  * @param  string $field 
  * @access public
  * @return void
  */
 public function set($module = 'story', $field = 'priList')
 {
     if ($module == 'user' and $field == 'priList') {
         $field = 'roleList';
     }
     $currentLang = $this->app->getClientLang();
     $this->app->loadLang($module);
     $this->app->loadConfig('story');
     $fieldList = $this->lang->{$module}->{$field};
     if ($module == 'bug' and $field == 'typeList') {
         unset($fieldList['designchange']);
         unset($fieldList['newfeature']);
         unset($fieldList['trackthings']);
     }
     if (!empty($_POST)) {
         if ($module == 'story' && $field == 'review') {
             $this->loadModel('setting')->setItem('system.story.needReview', fixer::input('post')->get()->needReview);
         } else {
             $lang = $_POST['lang'];
             $this->custom->deleteItems("lang={$lang}&module={$module}&section={$field}");
             foreach ($_POST['keys'] as $index => $key) {
                 $value = $_POST['values'][$index];
                 if (!$value or !$key) {
                     continue;
                 }
                 $system = $_POST['systems'][$index];
                 /* the length of role is 20, check it when save. */
                 if ($module == 'user' and $field == 'roleList' and strlen($key) > 20) {
                     die(js::alert($this->lang->custom->notice->userRole));
                 }
                 $this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value);
             }
         }
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         die(js::reload('parent'));
     }
     $this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->{$module}->common;
     $this->view->position[] = $this->lang->custom->common;
     $this->view->position[] = $this->lang->{$module}->common;
     $this->view->needReview = $this->config->story->needReview;
     $this->view->fieldList = $fieldList;
     $this->view->dbFields = $this->custom->getItems("lang={$currentLang},all&module={$module}&section={$field}");
     $this->view->field = $field;
     $this->view->module = $module;
     $this->view->currentLang = $currentLang;
     $this->view->canAdd = strpos($this->config->custom->canAdd[$module], $field) !== false;
     $this->display();
 }
开发者ID:caiwenhao,项目名称:zentao,代码行数:58,代码来源:control.php


示例11: setBasic

 /**
  * set company basic info.
  * 
  * @access public
  * @return void
  */
 public function setBasic()
 {
     if (!empty($_POST)) {
         $now = helper::now();
         $company = fixer::input('post')->add('setDate', $now)->stripTags('desc,content', $this->config->allowedTags->admin)->remove('uid')->get();
         $result = $this->loadModel('setting')->setItems('system.common.company', $company);
         if ($result) {
             $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess));
         }
         $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
     }
     $this->view->title = $this->lang->company->setBasic;
     $this->display();
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:20,代码来源:control.php


示例12: setBasic

 /**
  * set company basic info.
  * 
  * @access public
  * @return void
  */
 public function setBasic()
 {
     if (!empty($_POST)) {
         $now = helper::now();
         $company = fixer::input('post')->stripTags('content', $this->config->allowedTags->admin)->get();
         $company = $this->loadModel('file')->processEditor($company, $this->config->company->editor->setbasic['id']);
         $result = $this->loadModel('setting')->setItems('system.sys.common.company', $company);
         if ($result) {
             $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess));
         }
         $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
     }
     $this->view->title = $this->lang->company->setBasic;
     $this->display();
 }
开发者ID:leowh,项目名称:colla,代码行数:21,代码来源:control.php


示例13: create

 /**
  * Create an consulting.
  * 
  * @param  string $type 
  * @access public
  * @return int|bool
  */
 public function create()
 {
     $now = helper::now();
     $consulting = fixer::input('post')->setDefault('addedDate', $now)->get();
     $consult = $this->dao->select('*')->from(TABLE_CONSULTING)->where('realname')->eq($consulting->realname)->andWhere('mobile')->eq($consulting->mobile)->andWhere('email')->eq($consulting->email)->fetch();
     if ($consult) {
         return array('result' => 'fail', 'message' => '请不要重复提交!<a href="javascript:history.back();">返回</a>');
     } else {
         $this->dao->insert(TABLE_CONSULTING)->data($consulting)->exec();
         $consultingID = $this->dao->lastInsertID();
         if (dao::isError()) {
             return array('result' => 'fail', 'message' => dao::getError());
         }
         return array('result' => 'success', 'message' => '提交成功!');
     }
 }
开发者ID:hansen1416,项目名称:eastsoft,代码行数:23,代码来源:model.php


示例14: update

 /**
  * Update a slide.
  *
  * @param int $id
  * @access public
  * @return bool
  */
 public function update($id)
 {
     $image = $this->uploadImage();
     $slide = fixer::input('post')->stripTags('summary', $this->config->allowedTags->front)->setIf(!empty($image), 'image', $image)->remove('files')->get();
     if ($slide->backgroundType == 'color') {
         $this->dao->insert('slide')->data($slide, 'label,buttonClass,buttonUrl,buttonTarget')->batchCheck($this->config->slide->require->edit, 'notempty')->check('height', 'ge', 100);
         if (dao::isError()) {
             return false;
         }
     }
     $slide->label = array_values($slide->label);
     $slide->buttonClass = array_values($slide->buttonClass);
     $slide->buttonUrl = array_values($slide->buttonUrl);
     $slide->buttonTarget = array_values($slide->buttonTarget);
     $slide->createdDate = time();
     $this->dao->update(TABLE_CONFIG)->set('value')->eq(helper::jsonEncode($slide))->where('id')->eq($id)->exec();
     return !dao::isError();
 }
开发者ID:mustafakarali,项目名称:b2c-1,代码行数:25,代码来源:model.php


示例15: copy

 /**
  * Copy a group.
  * 
  * @param  int    $groupID 
  * @access public
  * @return void
  */
 public function copy($groupID)
 {
     $group = fixer::input('post')->remove('options')->get();
     $this->dao->insert(TABLE_GROUP)->data($group)->check('name', 'unique')->check('name', 'notempty')->exec();
     if ($this->post->options == false) {
         return;
     }
     if (!dao::isError()) {
         $newGroupID = $this->dao->lastInsertID();
         $options = join(',', $this->post->options);
         if (strpos($options, 'copyPriv') !== false) {
             $this->copyPriv($groupID, $newGroupID);
         }
         if (strpos($options, 'copyUser') !== false) {
             $this->copyUser($groupID, $newGroupID);
         }
     }
 }
开发者ID:caiwenhao,项目名称:zentao,代码行数:25,代码来源:model.php


示例16: manage

 public function manage($productID)
 {
     $oldBranches = $this->getPairs($productID, 'noempty');
     $data = fixer::input('post')->get();
     if (isset($data->branch)) {
         foreach ($data->branch as $branchID => $branch) {
             if ($oldBranches[$branchID] != $branch) {
                 $this->dao->update(TABLE_BRANCH)->set('name')->eq($branch)->where('id')->eq($branchID)->exec();
             }
         }
     }
     foreach ($data->newbranch as $branch) {
         if (empty($branch)) {
             continue;
         }
         $this->dao->insert(TABLE_BRANCH)->set('name')->eq($branch)->set('product')->eq($productID)->exec();
     }
     return dao::isError();
 }
开发者ID:heeeello,项目名称:zentaopms,代码行数:19,代码来源:model.php


示例17: setBasic

 /**
  * set site basic info.
  *
  * @access public
  * @return void
  */
 public function setBasic()
 {
     $allowedTags = $this->app->user->admin == 'super' ? $this->config->allowedTags->admin : $this->config->allowedTags->front;
     if (!empty($_POST)) {
         $setting = fixer::input('post')->stripTags('meta', $allowedTags)->stripTags('tongji', $allowedTags)->join('modules', ',')->remove('allowedFiles')->setDefault('modules', '')->stripTags('pauseTip', $allowedTags)->remove('uid,lang,cn2tw,defaultLang,requestType')->get();
         if (strpos($setting->modules, 'shop') !== false && strpos($setting->modules, 'user') === false) {
             $setting->modules = 'user,' . $setting->modules;
         }
         if ($setting->modules == 'initial') {
             unset($setting->modules);
         }
         $result = $this->loadModel('setting')->setItems('system.common.site', $setting);
         if (!$result) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
         }
         /* Set global settings. */
         $globalSetting = new stdclass();
         if ($this->post->lang) {
             $globalSetting->lang = join(',', $this->post->lang);
             $globalSetting->cn2tw = join('', $this->post->cn2tw);
             $globalSetting->defaultLang = $this->post->defaultLang;
         }
         if ($this->post->requestType) {
             $globalSetting->requestType = $this->post->requestType;
         }
         $result = $this->loadModel('setting')->setItems('system.common.site', $globalSetting, 'all');
         if (!$result) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
         }
         /* Switch to desktop device if mobile template closed. */
         if ($setting->mobileTemplate == 'close') {
             $this->session->set('device', 'desktop');
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess, 'locate' => inlink('setbasic')));
     }
     $this->view->title = $this->lang->site->common;
     $this->display();
 }
开发者ID:easysoft,项目名称:chanzhi_extension,代码行数:44,代码来源:setbasic.php


示例18: update

 public function update($assetID)
 {
     $skipFields = '';
     $skipFields .= $this->loadModel('custom')->dealWithCustomArrayField();
     $oldAsset = $this->getAssetById($assetID);
     $now = helper::now();
     $address = fixer::input('post')->get('address');
     $extendaddress = fixer::input('post')->get('extendaddress');
     $devicenumber = fixer::input('post')->get('devicenumber');
     $code = fixer::input('post')->get('code');
     $module = $this->loadModel('info')->getAllChildId(fixer::input('post')->cleanInt('module')->setDefault('module', 0)->get('module'), 'asset');
     $result1 = $this->dao->select('*')->from(TABLE_INFOASSET)->where('address')->eq($extendaddress)->andWhere('address')->ne('IP Format Error')->andWhere('address')->ne('Conflict!')->andWhere('address')->ne('')->beginIF($module)->andWhere('module')->in($module)->fi()->fetchAll();
     $result2 = $this->dao->select('*')->from(TABLE_INFOASSET)->where('extendaddress')->eq($address)->andWhere('extendaddress')->ne('IP Format Error')->andWhere('extendaddress')->ne('Conflict!')->andWhere('extendaddress')->ne('')->beginIF($module)->andWhere('module')->in($module)->fi()->fetchAll();
     $asset = fixer::input('post')->cleanInt('module')->setDefault('module', 0)->add('lastEditedBy', $this->app->user->account)->add('lastEditedDate', $now)->setDefault('lenddate', '0000-00-00')->setDefault('returndate', '0000-00-00')->setDefault('product', '0')->setDefault('project', '0')->setIF(!(strlen(trim($extendaddress)) == 0) && !validater::checkIP($extendaddress), 'extendaddress', 'IP Format Error')->setIF(!(strlen(trim($address)) == 0) && !validater::checkIP($address), 'address', 'IP Format Error')->removeIF(trim($address) == trim($extendaddress), 'extendaddress')->setIF($result1, 'extendaddress', 'Conflict!')->setIF($result2, 'address', 'Conflict!')->get();
     $condition = "`lib` = '{$asset->lib}' AND module = '{$asset->module}' and id != '{$assetID}'";
     $conditionaddress = $condition . " and address != 'IP Format Error' and address != 'Conflict!'";
     $conditionextaddress = $condition . " and extendaddress != 'IP Format Error' and extendaddress != 'Conflict!'";
     $this->dao->update(TABLE_INFOASSET)->data($asset)->autoCheck($skipFields)->batchCheck($this->config->asset->edit->requiredFields, 'notempty')->check('hostname', 'unique', $condition)->checkIF(!(strlen(trim($address)) == 0), 'address', 'unique', $conditionaddress)->checkIF(!(strlen(trim($extendaddress)) == 0), 'extendaddress', 'unique', $conditionextaddress)->checkIF(!(strlen(trim($devicenumber)) == 0), 'devicenumber', 'unique', $condition)->checkIF(!(strlen(trim($code)) == 0), 'code', 'unique', $condition)->where('id')->eq((int) $assetID)->exec();
     $asset->editedCount = $asset->editedCount - 1;
     if (!dao::isError()) {
         return common::createChanges($oldAsset, $asset);
     }
 }
开发者ID:huokedu,项目名称:zentao,代码行数:23,代码来源:model.php


示例19: updateDefaultPwd

 public function updateDefaultPwd()
 {
     $data = fixer::input('post')->get();
     $pwdList = $this->post->pwdList ? $this->post->pwdList : array();
     if (!empty($pwdList)) {
         /* Initialize todos from the post data. */
         foreach ($pwdList as $pwdID) {
             $pwd = $data->password[$pwdID];
             if ('' === $pwd) {
                 continue;
             }
             if ($pwdID > 0) {
                 $this->updatePwd($pwdID, $pwd);
             } else {
                 $this->setdefaultpwd($pwd);
             }
         }
     }
     if (dao::isError()) {
         echo js::error(dao::getError());
         die(js::reload('parent'));
     }
 }
开发者ID:xupnge1314,项目名称:project,代码行数:23,代码来源:model.php


示例20: bind

 /**
  * Bind user. 
  * 
  * @access public
  * @return object
  */
 public function bind()
 {
     $data = fixer::input('post')->get();
     if ($data->bindType == 'bind') {
         if (empty($data->bindPassword)) {
             die(js::alert($this->lang->sso->bindNoPassword));
         }
         $password = md5($data->bindPassword);
         $user = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($data->bindUser)->andWhere('password')->eq($password)->andWhere('deleted')->eq('0')->fetch();
         if (empty($user)) {
             die(js::alert($this->lang->sso->bindNoUser));
         }
         $user->ranzhi = $this->session->ssoData->account;
         $this->dao->update(TABLE_USER)->set('ranzhi')->eq($user->ranzhi)->where('id')->eq($user->id)->exec();
     } elseif ($data->bindType == 'add') {
         if (!$this->loadModel('user')->checkPassword()) {
             return;
         }
         $user = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($data->account)->fetch();
         if ($user) {
             die(js::alert($this->lang->sso->bindHasAccount));
         }
         if (isset($this->config->safe->mode) and $this->user->computePasswordStrength($data->password1) < $this->config->safe->mode) {
             dao::$errors['password1'][] = $this->lang->user->weakPassword;
             return false;
         }
         $user = new stdclass();
         $user->account = $data->account;
         $user->password = md5($data->password1);
         $user->realname = $data->realname;
         $user->gender = isset($data->gender) ? $data->gender : '';
         $user->email = $data->email;
         $user->ranzhi = $this->session->ssoData->account;
         $this->dao->insert(TABLE_USER)->data($user)->autoCheck()->batchCheck($this->config->user->create->requiredFields, 'notempty')->check('account', 'unique')->check('account', 'account')->checkIF($user->email != false, 'email', 'email')->exec();
     }
     return $user;
 }
开发者ID:caiwenhao,项目名称:zentao,代码行数:43,代码来源:model.php



注:本文中的fixer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP flexible_table类代码示例发布时间:2022-05-23
下一篇:
PHP finfo类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap