|
@@ -5,25 +5,25 @@
|
|
|
*/
|
|
|
class SettingController extends DooController {
|
|
|
|
|
|
+ public $staff=array();
|
|
|
+
|
|
|
public function beforeRun($resource, $action) {
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
function __construct() {
|
|
|
if (isset ( $_COOKIE ["staff"] )) {
|
|
|
if (! empty ( $_COOKIE ["staff"] )) {
|
|
|
Doo::loadModel ( 'staff' );
|
|
|
$staff = new staff ();
|
|
|
-
|
|
|
- $this->staff= $staff->getStaffBySid( $_COOKIE ["staff"] );
|
|
|
+
|
|
|
+ $this->staff = $staff->getStaffBySid ( $_COOKIE ["staff"] );
|
|
|
return "/";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Doo::loadCore ( 'uri/DooUriRouter' );
|
|
|
$router = new DooUriRouter ();
|
|
|
$routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );
|
|
|
-
|
|
|
+
|
|
|
if ($routeRs ['1'] != "login") {
|
|
|
header ( 'Content-Type:text/html;charset=utf-8' );
|
|
|
@header ( "Location: /login" );
|
|
@@ -33,7 +33,7 @@ class SettingController extends DooController {
|
|
|
/**
|
|
|
* 员工信息
|
|
|
*/
|
|
|
- function settingEmployeeInfo(){
|
|
|
+ function settingEmployeeInfo() {
|
|
|
$this->data ['staff'] = $this->staff;
|
|
|
$this->data ['memu'] = "adminmyinfo";
|
|
|
$this->data ['hrMemu'] = "settingEmployeeInfo";
|
|
@@ -43,7 +43,7 @@ class SettingController extends DooController {
|
|
|
/**
|
|
|
* 证件信息
|
|
|
*/
|
|
|
- function settingCredentialInfo(){
|
|
|
+ function settingCredentialInfo() {
|
|
|
$this->data ['staff'] = $this->staff;
|
|
|
$this->data ['memu'] = "adminmyinfo";
|
|
|
$this->data ['hrMemu'] = "settingEmployeeInfo";
|
|
@@ -53,13 +53,511 @@ class SettingController extends DooController {
|
|
|
/**
|
|
|
* 财务信息
|
|
|
*/
|
|
|
- function settingFinanceInfo(){
|
|
|
+ function settingFinanceInfo() {
|
|
|
$this->data ['staff'] = $this->staff;
|
|
|
$this->data ['memu'] = "adminmyinfo";
|
|
|
$this->data ['hrMemu'] = "settingEmployeeInfo";
|
|
|
|
|
|
$this->render ( "/setting/settingFinanceInfo", $this->data );
|
|
|
}
|
|
|
+ function settingPW() {
|
|
|
+ $this->data ['msg'] = urldecode ( $this->params ['msg'] );
|
|
|
+
|
|
|
+ $this->data ['staff'] = $this->staff;
|
|
|
+ $this->data ['memu'] = "adminmyinfo";
|
|
|
+ $this->data ['hrMemu'] = "settingPW";
|
|
|
+
|
|
|
+ $this->render ( "/setting/settingPW", $this->data );
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 更新密码
|
|
|
+ */
|
|
|
+ function updateMyPW() {
|
|
|
+ $oldpassword = $this->get_args ( 'oldpassword' ) ? $this->get_args ( 'oldpassword' ) : "";
|
|
|
+ $newpassword = $this->get_args ( 'newpassword' ) ? $this->get_args ( 'newpassword' ) : "";
|
|
|
+ $rnewpassword = $this->get_args ( 'rnewpassword' ) ? $this->get_args ( 'rnewpassword' ) : "";
|
|
|
+
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+ Doo::loadModel ( 'staffDynamic' );
|
|
|
+ $staffDynamic = new staffDynamic ();
|
|
|
+
|
|
|
+ $staff->sid = $this->staff ['sid'];
|
|
|
+
|
|
|
+ $msg = "更新成功";
|
|
|
+
|
|
|
+ if ($this->staff ['passwork'] == md5 ( $oldpassword )) {
|
|
|
+ if ($newpassword == $rnewpassword && (! empty ( $newpassword )))
|
|
|
+ $staff->passwork = md5 ( $newpassword );
|
|
|
+ else
|
|
|
+ $msg = "密码不一致";
|
|
|
+ } else {
|
|
|
+ if ($oldpassword != "")
|
|
|
+ $msg = "密码错误";
|
|
|
+ }
|
|
|
+
|
|
|
+ $staff->update ( array (
|
|
|
+ 'where' => ' sid=' . $this->staff ['sid']
|
|
|
+ ) );
|
|
|
+
|
|
|
+ return "/settingPW/" . $msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 微信通知设置
|
|
|
+ */
|
|
|
+ function notificationConf() {
|
|
|
+ Doo::loadModel ( "notificationConf" );
|
|
|
+ $notificationConf = new notificationConf ();
|
|
|
+
|
|
|
+ $detail = $notificationConf->getNotificationConfBySid ( $this->staff ['sid'] );
|
|
|
+
|
|
|
+ $rule = json_decode ( $detail ['conf'], true );
|
|
|
+ if (! isset ( $rule ['approval'] ))
|
|
|
+ $rule ['approval'] = '';
|
|
|
+ if (! isset ( $rule ['print'] ))
|
|
|
+ $rule ['print'] = '';
|
|
|
+ if (! isset ( $rule ['receivables'] ))
|
|
|
+ $rule ['receivables'] = '';
|
|
|
+
|
|
|
+ $this->data ['rule'] = $rule;
|
|
|
+ $this->data ['memu'] = "adminmyinfo";
|
|
|
+ $this->data ['hrMemu'] = "notificationConf";
|
|
|
+ $this->data ['staff'] = $this->staff;
|
|
|
+
|
|
|
+ $this->render ( "/setting/invoiceNotificationConf", $this->data );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 异步设置微信通知
|
|
|
+ */
|
|
|
+ function ajaxSetNotificationConf() {
|
|
|
+ $notificationType = $this->get_args ( 'notificationType' ) ? $this->get_args ( 'notificationType' ) : "";
|
|
|
+ $notificationValue = $this->get_args ( 'notificationValue' ) ? $this->get_args ( 'notificationValue' ) : '';
|
|
|
+
|
|
|
+ if (! empty ( $notificationType ) && ! empty ( $notificationValue ) && ! empty ( $this->staff ['sid'] )) {
|
|
|
+ Doo::loadModel ( "notificationConf" );
|
|
|
+ $notificationConf = new notificationConf ();
|
|
|
+
|
|
|
+ $detail = $notificationConf->getNotificationConfBySid ( $this->staff ['sid'] );
|
|
|
+
|
|
|
+ if (empty ( $detail )) {
|
|
|
+ $rule = array (
|
|
|
+ $notificationType => $notificationValue
|
|
|
+ );
|
|
|
+ $rule = json_encode ( $rule );
|
|
|
+ $item = array (
|
|
|
+ 'sid' => $this->staff ['sid'],
|
|
|
+ 'conf' => $rule
|
|
|
+ );
|
|
|
+
|
|
|
+ $notificationConf->addNotification ( $item );
|
|
|
+ } else {
|
|
|
+ $rule = json_decode ( $detail ['conf'], true );
|
|
|
+ $rule [$notificationType] = $notificationValue;
|
|
|
+ $rule = json_encode ( $rule );
|
|
|
+ $item = array (
|
|
|
+ 'nid' => $detail ['nid'],
|
|
|
+ 'conf' => $rule
|
|
|
+ );
|
|
|
+ $notificationConf->setNotificationByCondition ( $item );
|
|
|
+ }
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'msgType' => $notificationType,
|
|
|
+ 'msg' => ''
|
|
|
+ ) );
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2,
|
|
|
+ 'msgType' => $notificationType,
|
|
|
+ 'msg' => 'illegal request'
|
|
|
+ ) );
|
|
|
+ die ();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新员工信息
|
|
|
+ */
|
|
|
+ function staffUpdate() {
|
|
|
+ $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
|
|
|
+
|
|
|
+ $username = $this->get_args ( 'username' ) ? $this->get_args ( 'username' ) : "";
|
|
|
+ $cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : '';
|
|
|
+ $position = $this->get_args ( 'position' ) ? $this->get_args ( 'position' ) : '';
|
|
|
+ $hiredate = $this->get_args ( 'hiredate' ) ? $this->get_args ( 'hiredate' ) : '';
|
|
|
+ $telephone = $this->get_args ( 'telephone' ) ? $this->get_args ( 'telephone' ) : '';
|
|
|
+ // $baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
|
|
|
+ // $postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
|
|
|
+ // $achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
|
|
|
+ $gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';
|
|
|
+
|
|
|
+ $qq = is_numeric ( $this->get_args ( 'qq' ) ) ? $this->get_args ( 'qq' ) : 0;
|
|
|
+ $phone = is_numeric ( $this->get_args ( 'phone' ) ) ? $this->get_args ( 'phone' ) : 0;
|
|
|
+ $wecat = $this->get_args ( 'wecat' ) ? $this->get_args ( 'wecat' ) : '';
|
|
|
+ $email = $this->get_args ( 'email' ) ? $this->get_args ( 'email' ) : '';
|
|
|
+
|
|
|
+ $birthday = $this->get_args ( 'birthday' ) ? $this->get_args ( 'birthday' ) : '';
|
|
|
+ $qualifications = $this->get_args ( 'qualifications' ) ? $this->get_args ( 'qualifications' ) : '';
|
|
|
+ $marriage = $this->get_args ( 'marriage' ) ? $this->get_args ( 'marriage' ) : '';
|
|
|
+ $IDcards = $this->get_args ( 'IDcards' ) ? $this->get_args ( 'IDcards' ) : '';
|
|
|
+
|
|
|
+ $living = $this->get_args ( 'living' ) ? $this->get_args ( 'living' ) : '';
|
|
|
+ $nativePlace = $this->get_args ( 'nativePlace' ) ? $this->get_args ( 'nativePlace' ) : '';
|
|
|
+ $emergencyContacts = $this->get_args ( 'emergencyContacts' ) ? $this->get_args ( 'emergencyContacts' ) : '';
|
|
|
+ $remittanceName = $this->get_args ( 'remittanceName' ) ? $this->get_args ( 'remittanceName' ) : '';
|
|
|
+ $coupletNumber = $this->get_args ( 'coupletNumber' ) ? $this->get_args ( 'coupletNumber' ) : '';
|
|
|
+ $bankName = $this->get_args ( 'bankName' ) ? $this->get_args ( 'bankName' ) : '';
|
|
|
+ $bankNumber = $this->get_args ( 'bankNumber' ) ? $this->get_args ( 'bankNumber' ) : '';
|
|
|
+
|
|
|
+ $salaryCard = $this->get_args ( 'salaryCard' ) ? $this->get_args ( 'salaryCard' ) : '';
|
|
|
+ $salaryBank = $this->get_args ( 'salaryBank' ) ? $this->get_args ( 'salaryBank' ) : '';
|
|
|
+
|
|
|
+ $employeeInfo = $this->get_args ( 'employeeInfo' ) ? $this->get_args ( 'employeeInfo' ) : 'employeeInfo';
|
|
|
+
|
|
|
+ if (! empty ( $sidKey )) {
|
|
|
+
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+ Doo::loadModel ( 'L_category' );
|
|
|
+ $L_category = new L_category ();
|
|
|
+ Doo::loadModel ( 'tag' );
|
|
|
+ Doo::loadModel ( 'holidaystaff' );
|
|
|
+ Doo::loadModel ( 'staffManage' );
|
|
|
+ $staffManage = new staffManage ();
|
|
|
+
|
|
|
+ // 用户名检测
|
|
|
+ if (! empty ( $username )) {
|
|
|
+ $detail = $staff->getStaffByName ( $username );
|
|
|
+ if (empty ( $detail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+ $detail = $staff->getStaffBySid ( $sidKey );
|
|
|
+ if (empty ( $detail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ // if (!empty($username))
|
|
|
+ // $staff->username = $username;
|
|
|
+ if (! empty ( $hiredate ))
|
|
|
+ $staff->hiredate = $hiredate;
|
|
|
+ if (! empty ( $position ))
|
|
|
+ $staff->position = $position;
|
|
|
+
|
|
|
+ // 办事处-部门
|
|
|
+ if (! empty ( $cid_did )) {
|
|
|
+ $department = explode ( '_', $cid_did );
|
|
|
+ $cid = $XDeode->decode ( $department [0] );
|
|
|
+ // 加入默认总部分类
|
|
|
+ if (! is_numeric ( $cid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ $cagegory = $L_category->getCategoryById ( $cid );
|
|
|
+ // 部门
|
|
|
+ if (! empty ( $department [1] )) {
|
|
|
+ $did = $XDeode->decode ( $department [1] );
|
|
|
+ if (! is_numeric ( $did ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ $staff->departmentID = $did;
|
|
|
+ }
|
|
|
+ $staff->cid = $cagegory [0] ['cid'];
|
|
|
+ $staff->category = $cagegory [0] ['title'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (! empty ( $telephone ))
|
|
|
+ $staff->telephone = $telephone;
|
|
|
+ // if (!empty($baseWage))
|
|
|
+ // $staff->baseWage = $baseWage;
|
|
|
+ // if (!empty($postWage))
|
|
|
+ // $staff->postWage = $postWage;
|
|
|
+ // if (!empty($achievementBonus))
|
|
|
+ // $staff->achievementBonus = $achievementBonus;
|
|
|
+ if (! empty ( $gender ))
|
|
|
+ $staff->gender = $gender;
|
|
|
+
|
|
|
+ if (! empty ( $qq ))
|
|
|
+ $staff->qq = $qq;
|
|
|
+ if (! empty ( $phone ))
|
|
|
+ $staff->phone = $phone;
|
|
|
+ if (! empty ( $wecat ))
|
|
|
+ $staff->wecat = $wecat;
|
|
|
+ if (! empty ( $email ))
|
|
|
+ $staff->email = $email;
|
|
|
+ if (! empty ( $birthday ))
|
|
|
+ $staff->birthday = $birthday;
|
|
|
+ if (! empty ( $$qualifications ))
|
|
|
+ $staff->qualifications = $qualifications;
|
|
|
+ if (! empty ( $marriage ))
|
|
|
+ $staff->marriage = $marriage;
|
|
|
+ if (! empty ( $IDcards ))
|
|
|
+ $staff->IDcards = $IDcards;
|
|
|
+ if (! empty ( $living ))
|
|
|
+ $staff->living = $living;
|
|
|
+ if (! empty ( $nativePlace ))
|
|
|
+ $staff->nativePlace = $nativePlace;
|
|
|
+ if (! empty ( $emergencyContacts ))
|
|
|
+ $staff->emergencyContacts = $emergencyContacts;
|
|
|
+ if (! empty ( $coupletNumber ))
|
|
|
+ $staff->coupletNumber = $coupletNumber;
|
|
|
+ if (! empty ( $bankName ))
|
|
|
+ $staff->bankName = $bankName;
|
|
|
+ if (! empty ( $bankNumber ))
|
|
|
+ $staff->bankNumber = $bankNumber;
|
|
|
+ if (! empty ( $remittanceName ))
|
|
|
+ $staff->remittanceName = $remittanceName;
|
|
|
+
|
|
|
+ if (! empty ( $salaryCard ))
|
|
|
+ $staff->salaryCard = $salaryCard;
|
|
|
+ if (! empty ( $salaryBank ))
|
|
|
+ $staff->salaryBank = $salaryBank;
|
|
|
+
|
|
|
+ $staff->update ( array (
|
|
|
+ 'where' => 'sid=' . $detail ['sid']
|
|
|
+ ) );
|
|
|
+
|
|
|
+ if ($employeeInfo == 'employeeInfo') {
|
|
|
+ return '/hr';
|
|
|
+ } elseif ($employeeInfo == 'settingEmployeeInfo') {
|
|
|
+ return '/settingEmployeeInfo';
|
|
|
+ } elseif ($employeeInfo == 'settingFinanceInfo') {
|
|
|
+ return '/settingFinanceInfo';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 证件文件上传
|
|
|
+ */
|
|
|
+ function settingCredentialInfoDo() {
|
|
|
+
|
|
|
+ $IDcards = is_numeric ( $this->get_args ( 'IDcards' ) ) ? $this->get_args ( 'IDcards' ) : 0;
|
|
|
+ $certificate = $this->get_args ( 'certificate' ) ? $this->get_args ( 'certificate' ) : '';
|
|
|
+ $diploma = $this->get_args ( 'diploma' ) ? $this->get_args ( 'diploma' ) : '';
|
|
|
+ $professionalTitle = $this->get_args ( 'professionalTitle' ) ? $this->get_args ( 'professionalTitle' ) : '';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+
|
|
|
+ $save_path = DOO::conf ()->SITE_PATH . "upload/credentialInfo/";
|
|
|
+ $webSite=WEB_SITE.'/upload/credentialInfo/';
|
|
|
+
|
|
|
+ if (!empty($IDcards))
|
|
|
+ $staff->IDcards=$IDcards;
|
|
|
+
|
|
|
+ $msg = '';
|
|
|
+ $file_name = 'IDcardsImgA_'. $this->staff['sid'].'.'. $this->_GetFileEXT ( $_FILES ["IDcardsImgA"] ['name'] );
|
|
|
+ if (!empty($_FILES ["IDcardsImgA"] ["size"])){
|
|
|
+ if (! @move_uploaded_file ( $_FILES ["IDcardsImgA"] ["tmp_name"], $save_path . $file_name ))
|
|
|
+ $msg .= "文件无法保存";
|
|
|
+ else{
|
|
|
+ $staff->IDcardsImgA=$webSite . $file_name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $file_name = 'IDcardsImgB_'. $this->staff['sid'].'.' . $this->_GetFileEXT ( $_FILES ["IDcardsImgB"] ['name'] );
|
|
|
+ if (!empty($_FILES ["IDcardsImgB"] ["size"]))
|
|
|
+ if (! @move_uploaded_file ( $_FILES ["IDcardsImgB"] ["tmp_name"], $save_path . $file_name )) {
|
|
|
+ $msg .= "文件无法保存";
|
|
|
+ }else{
|
|
|
+ $staff->IDcardsImgB=$webSite . $file_name;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($certificate)){
|
|
|
+ $certificateArray=explode("-", $certificate);
|
|
|
+ $staff->certificate=json_encode($certificateArray);
|
|
|
+ }
|
|
|
+
|
|
|
+// $file_name = 'certificate_'. $this->staff['sid'].'.' . $this->_GetFileEXT ( $_FILES ["certificate"] ['name'] );
|
|
|
+// if (!empty($_FILES ["certificate"] ["size"]))
|
|
|
+// if (! @move_uploaded_file ( $_FILES ["certificate"] ["tmp_name"], $save_path . $file_name )) {
|
|
|
+// $msg .= "文件无法保存";
|
|
|
+// }else{
|
|
|
+// $staff->certificate=$webSite . $file_name;
|
|
|
+// }
|
|
|
+
|
|
|
+// $file_name = 'diploma_'. $this->staff['sid'].'.' . $this->_GetFileEXT ( $_FILES ["diploma"] ['name'] );
|
|
|
+// if (!empty($_FILES ["diploma"] ["size"]))
|
|
|
+// if (! @move_uploaded_file ( $_FILES ["diploma"] ["tmp_name"], $save_path . $file_name )) {
|
|
|
+// $msg .= "文件无法保存";
|
|
|
+// }else{
|
|
|
+// $staff->diploma=$webSite . $file_name;
|
|
|
+// }
|
|
|
+
|
|
|
+ $staff->update(array('where'=>'sid='.$this->staff['sid']));
|
|
|
+ //return '/settingCredentialInfo';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传学位证书
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ function settingCredentialInfoDo3() {
|
|
|
+ $POST_MAX_SIZE = ini_get ( 'post_max_size' );
|
|
|
+ $unit = strtoupper ( substr ( $POST_MAX_SIZE, - 1 ) );
|
|
|
+ $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)));
|
|
|
+
|
|
|
+ if (( int ) $_SERVER ['CONTENT_LENGTH'] > $multiplier * ( int ) $POST_MAX_SIZE && $POST_MAX_SIZE) {
|
|
|
+ header ( "HTTP/1.1 500 Internal Server Error" );
|
|
|
+ echo "POST exceeded maximum allowed size.";
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ // Settings
|
|
|
+ $save_path = DOO::conf ()->SITE_PATH . "upload/credentialInfo/"; // The path were we will save the file (getcwd() may not be reliable and should be tested in your environment)
|
|
|
+ $upload_name = "Filedata";
|
|
|
+ $max_file_size_in_bytes = 2147483647; // 2GB in bytes
|
|
|
+ $extension_whitelist = array (
|
|
|
+ "doc",
|
|
|
+ "txt",
|
|
|
+ "jpg",
|
|
|
+ "gif",
|
|
|
+ "png"
|
|
|
+ ); // Allowed file extensions
|
|
|
+ $valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\]\',~`-'; // Characters allowed in the file name (in a Regular Expression format)
|
|
|
+
|
|
|
+ // Other variables
|
|
|
+ $MAX_FILENAME_LENGTH = 260;
|
|
|
+ $file_name = "";
|
|
|
+ $file_extension = "";
|
|
|
+ $uploadErrors = array (
|
|
|
+ 0 => "文件上传成功",
|
|
|
+ 1 => "上传的文件超过了 php.ini 文件中的 upload_max_filesize directive 里的设置",
|
|
|
+ 2 => "上传的文件超过了 HTML form 文件中的 MAX_FILE_SIZE directive 里的设置",
|
|
|
+ 3 => "上传的文件仅为部分文件",
|
|
|
+ 4 => "没有文件上传",
|
|
|
+ 6 => "缺少临时文件夹"
|
|
|
+ );
|
|
|
+
|
|
|
+ $nk = time ();
|
|
|
+ $file_name = 'diploma_'. $this->staff['sid'].'_'.$nk.'.' . $this->_GetFileEXT ( $_FILES [$upload_name] ['name'] );
|
|
|
+
|
|
|
+ if (! @move_uploaded_file ( $_FILES [$upload_name] ["tmp_name"], $save_path . $file_name )) {
|
|
|
+ echo "文件无法保存.";
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'filename' => $file_name,
|
|
|
+ 'id' => $nk
|
|
|
+ ) );
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传职称证书
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ function settingCredentialInfoDo4() {
|
|
|
+ $POST_MAX_SIZE = ini_get ( 'post_max_size' );
|
|
|
+ $unit = strtoupper ( substr ( $POST_MAX_SIZE, - 1 ) );
|
|
|
+ $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)));
|
|
|
+
|
|
|
+ if (( int ) $_SERVER ['CONTENT_LENGTH'] > $multiplier * ( int ) $POST_MAX_SIZE && $POST_MAX_SIZE) {
|
|
|
+ header ( "HTTP/1.1 500 Internal Server Error" );
|
|
|
+ echo "POST exceeded maximum allowed size.";
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ // Settings
|
|
|
+ $save_path = DOO::conf ()->SITE_PATH . "upload/credentialInfo/"; // The path were we will save the file (getcwd() may not be reliable and should be tested in your environment)
|
|
|
+ $upload_name = "Filedata";
|
|
|
+ $max_file_size_in_bytes = 2147483647; // 2GB in bytes
|
|
|
+ $extension_whitelist = array (
|
|
|
+ "doc",
|
|
|
+ "txt",
|
|
|
+ "jpg",
|
|
|
+ "gif",
|
|
|
+ "png"
|
|
|
+ ); // Allowed file extensions
|
|
|
+ $valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\]\',~`-'; // Characters allowed in the file name (in a Regular Expression format)
|
|
|
+
|
|
|
+ // Other variables
|
|
|
+ $MAX_FILENAME_LENGTH = 260;
|
|
|
+ $file_name = "";
|
|
|
+ $file_extension = "";
|
|
|
+ $uploadErrors = array (
|
|
|
+ 0 => "文件上传成功",
|
|
|
+ 1 => "上传的文件超过了 php.ini 文件中的 upload_max_filesize directive 里的设置",
|
|
|
+ 2 => "上传的文件超过了 HTML form 文件中的 MAX_FILE_SIZE directive 里的设置",
|
|
|
+ 3 => "上传的文件仅为部分文件",
|
|
|
+ 4 => "没有文件上传",
|
|
|
+ 6 => "缺少临时文件夹"
|
|
|
+ );
|
|
|
+
|
|
|
+ $nk = time ();
|
|
|
+ $file_name = 'professionalTitle_'. $this->staff['sid'].'_'.$nk.'.' . $this->_GetFileEXT ( $_FILES [$upload_name] ['name'] );
|
|
|
+
|
|
|
+ if (! @move_uploaded_file ( $_FILES [$upload_name] ["tmp_name"], $save_path . $file_name )) {
|
|
|
+ echo "文件无法保存.";
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'filename' => $file_name,
|
|
|
+ 'id' => $nk
|
|
|
+ ) );
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传毕业证书
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ function settingCredentialInfoDo2() {
|
|
|
+ $POST_MAX_SIZE = ini_get ( 'post_max_size' );
|
|
|
+ $unit = strtoupper ( substr ( $POST_MAX_SIZE, - 1 ) );
|
|
|
+ $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)));
|
|
|
+
|
|
|
+ if (( int ) $_SERVER ['CONTENT_LENGTH'] > $multiplier * ( int ) $POST_MAX_SIZE && $POST_MAX_SIZE) {
|
|
|
+ header ( "HTTP/1.1 500 Internal Server Error" );
|
|
|
+ echo "POST exceeded maximum allowed size.";
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ // Settings
|
|
|
+ $save_path = DOO::conf ()->SITE_PATH . "upload/credentialInfo/"; // The path were we will save the file (getcwd() may not be reliable and should be tested in your environment)
|
|
|
+ $upload_name = "Filedata";
|
|
|
+ $max_file_size_in_bytes = 2147483647; // 2GB in bytes
|
|
|
+ $extension_whitelist = array (
|
|
|
+ "doc",
|
|
|
+ "txt",
|
|
|
+ "jpg",
|
|
|
+ "gif",
|
|
|
+ "png"
|
|
|
+ ); // Allowed file extensions
|
|
|
+ $valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\]\',~`-'; // Characters allowed in the file name (in a Regular Expression format)
|
|
|
+
|
|
|
+ // Other variables
|
|
|
+ $MAX_FILENAME_LENGTH = 260;
|
|
|
+ $file_name = "";
|
|
|
+ $file_extension = "";
|
|
|
+ $uploadErrors = array (
|
|
|
+ 0 => "文件上传成功",
|
|
|
+ 1 => "上传的文件超过了 php.ini 文件中的 upload_max_filesize directive 里的设置",
|
|
|
+ 2 => "上传的文件超过了 HTML form 文件中的 MAX_FILE_SIZE directive 里的设置",
|
|
|
+ 3 => "上传的文件仅为部分文件",
|
|
|
+ 4 => "没有文件上传",
|
|
|
+ 6 => "缺少临时文件夹"
|
|
|
+ );
|
|
|
+
|
|
|
+ $nk = time ();
|
|
|
+ $file_name = 'certificate_'. $this->staff['sid'].'_'.$nk.'.' . $this->_GetFileEXT ( $_FILES [$upload_name] ['name'] );
|
|
|
+
|
|
|
+ if (! @move_uploaded_file ( $_FILES [$upload_name] ["tmp_name"], $save_path . $file_name )) {
|
|
|
+ echo "文件无法保存.";
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'filename' => $file_name,
|
|
|
+ 'id' => $nk
|
|
|
+ ) );
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取get或者POST值
|
|
@@ -71,16 +569,26 @@ class SettingController extends DooController {
|
|
|
if (isset ( $_GET [$name] )) {
|
|
|
if (is_array ( $_GET [$name] ))
|
|
|
return $_GET [$name];
|
|
|
- else
|
|
|
- return addslashes ( $_GET [$name] );
|
|
|
+ else
|
|
|
+ return addslashes ( $_GET [$name] );
|
|
|
} elseif (isset ( $_POST [$name] )) {
|
|
|
if (is_array ( $_POST [$name] ))
|
|
|
return $_POST [$name];
|
|
|
- else
|
|
|
- return addslashes ( $_POST [$name] );
|
|
|
+ else
|
|
|
+ return addslashes ( $_POST [$name] );
|
|
|
} else
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 旧输入导入
|
|
|
+ */
|
|
|
+ function _GetFileEXT($filename) {
|
|
|
+ $pics = explode ( '.', $filename );
|
|
|
+ $num = count ( $pics );
|
|
|
+ return $pics [$num - 1];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
?>
|