UserController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <?php
  2. ini_set('display_errors', 1);
  3. Doo::loadClass('auth');
  4. Doo::loadClass('attfile');
  5. Doo::loadClass('profile');
  6. Doo::loadClass('project');
  7. Doo::loadClass('contractact');
  8. Doo::loadClass('actmeasure');
  9. Doo::loadClass('numofperact');
  10. Doo::loadClass('user');
  11. Doo::loadClass('PasswordHash');
  12. Doo::loadClass('sms');
  13. Doo::loadModelAt('aconfig', 'admin');
  14. Doo::loadClass('measureauditact');
  15. /* * proDetail
  16. * MainController
  17. * Feel free to delete the methods and replace them with your own code.
  18. *
  19. * @author darkredz
  20. */
  21. class UserController extends DooController
  22. {
  23. private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $user, $ph, $sms, $aconfig;
  24. public function beforeRun($resource, $action)
  25. {
  26. // $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  27. // $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  28. // if (!$falg)
  29. // return Doo::acl()->defaultFailedRoute;
  30. if ($this->auth->getUid()) {
  31. $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  32. $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  33. if (!$falg)
  34. return Doo::acl()->defaultFailedRoute;
  35. } else {
  36. return Doo::acl()->defaultFailedRoute;
  37. }
  38. }
  39. public function __construct()
  40. {
  41. $this->data['numofchecking'] = null;
  42. $this->auth = new Auth();
  43. $this->attfile = new attFile();
  44. $this->profile = new Profile();
  45. $this->project = new Project();
  46. $this->contractact = new Contractact();
  47. $this->actmeasure = new actMeasure();
  48. $this->numofperact = new NumofperAct();
  49. $this->user = new User();
  50. $this->ph = new PasswordHash(8, FALSE);
  51. $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
  52. $this->aconfig = new AConfig();
  53. $this->measureauditact = new MeasureauditAct();
  54. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  55. $this->data['currChannle'] = 'p';
  56. $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
  57. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  58. if (isset($mpidArray[0]['pid'])) {
  59. foreach ($mpidArray as $key => $value) {
  60. // 审批操作按照时间排序多标段
  61. $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
  62. }
  63. }
  64. if ($this->data['numofchecking'] == 0) {
  65. $this->data['numofchecking'] = null;
  66. }
  67. }
  68. /**
  69. *
  70. * @return type
  71. */
  72. public function index()
  73. {
  74. $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
  75. $this->data['uprofile']['email'] = $this->auth->getUemail();
  76. if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone'])) {
  77. $this->profile->upProfile($this->auth->getUid(), $_POST);
  78. return DOO::conf()->APP_URL . 'user/profile';
  79. }
  80. $this->render('edit-profile', $this->data, TRUE);
  81. }
  82. public function avatar()
  83. {
  84. // TODO:加入目录可否写入判断
  85. if (count($_FILES) == 3) {
  86. $result = array();
  87. $result['success'] = false;
  88. $successNum = 0;
  89. $avatarNumber = 1;
  90. $i = 0;
  91. $msg = '';
  92. $dir = 'global/avatar';
  93. while (list($key, $val) = each($_FILES)) {
  94. if ($_FILES[$key]['error'] > 0) {
  95. $msg .= $_FILES[$key]['error'];
  96. } else {
  97. $fileName = date("YmdHis") . '_' . floor(microtime() * 1000) . '_' . self::createRandomCode(8);
  98. if ($key == '__source') {
  99. $initParams = $_POST["__initParams"];
  100. $virtualPath = "$dir/php_source_$fileName.jpg";
  101. $result['sourceUrl'] = '/' . $virtualPath . $initParams;
  102. move_uploaded_file($_FILES[$key]["tmp_name"], Doo::conf()->SITE_PATH . $virtualPath);
  103. $successNum++;
  104. } else if (strpos($key, '__avatar') === 0) {
  105. $virtualPath = "$dir/php_avatar" . $avatarNumber . "_$fileName.jpg";
  106. $result['avatarUrls'][$i] = $virtualPath;
  107. if ($i == 2) {
  108. $this->profile->setAvatar($this->auth->getUid(), $result['avatarUrls'][$i]);
  109. }
  110. move_uploaded_file($_FILES[$key]["tmp_name"], $virtualPath);
  111. $successNum++;
  112. $i++;
  113. }
  114. }
  115. }
  116. $result['msg'] = $msg;
  117. if ($successNum > 0) {
  118. $result['success'] = true;
  119. }
  120. print json_encode($result);
  121. die;
  122. }
  123. $this->render('edit-profile-avtra', $this->data, TRUE);
  124. }
  125. /* * ************************************************************
  126. * 生成指定长度的随机码。
  127. * @param int $length 随机码的长度。
  128. * @access public
  129. * ************************************************************ */
  130. function createRandomCode($length)
  131. {
  132. $randomCode = "";
  133. $randomChars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  134. for ($i = 0; $i < $length; $i++) {
  135. $randomCode .= $randomChars{mt_rand(0, 35)};
  136. }
  137. return $randomCode;
  138. }
  139. public function proSection()
  140. {
  141. /**
  142. * 计量期数
  143. * 完成进度
  144. *
  145. */
  146. $this->getFav();
  147. $contractArray = $this->contractact->getRowByPid($this->params['pid']); // 获取合同段
  148. $htmlstr = NULL;
  149. foreach ($contractArray as $k => $v) {
  150. $retval = $this->actmeasure->getAllbyStid($v['stid']); // 获取标段
  151. $bdhtmlstr = NULL;
  152. $biaoduantotalmoney = 0;
  153. $currTotal = 0;
  154. $progress = $otherprogress = '0%';
  155. $currTotal = $this->numofperact->getCountTotalSTID($v['stid']);
  156. //
  157. foreach ($retval as $key => $value) {
  158. $snTotalProgress = $currTotalProgress = $lessTotalProgress = '0%';
  159. $numCount = $this->numofperact->getCountTotalnum($value['pmid']);
  160. $totalplus = $this->numofperact->getCountTotalplus($value['pmid']);
  161. $snTotal = $this->numofperact->getStopNow($value['pmid']); //截止目前
  162. $currcomTotal = $this->numofperact->getCurrTotal($value['pmid']); //截止目前
  163. if ($numCount > 0) {
  164. $nTotalProgress = number_format($snTotal['sntotal'], 2, '.', ',');
  165. $ncurrTotalProgress = number_format($currcomTotal['currtotal'], 2, '.', ',');
  166. $nlessTotalProgress = number_format($totalplus['totalplus'] - $currcomTotal['currtotal'] - $snTotal['sntotal'], 2, '.', ',');
  167. $snTotalProgress = round(($snTotal['sntotal'] / $totalplus['totalplus']) * 100) . '%';
  168. $currTotalProgress = round(($currcomTotal['currtotal'] / $totalplus['totalplus']) * 100) . '%';
  169. $lessTotalProgress = round((($totalplus['totalplus'] - $currcomTotal['currtotal'] - $snTotal['sntotal']) / $totalplus['totalplus']) * 100) . '%';
  170. }
  171. $biaoduantotalmoney += $value['contracttotal'];
  172. $totalmoney = number_format($value['contracttotal'], 2, '.', ',');
  173. $bdhtmlstr .= '
  174. <thead>
  175. <tr><th class="taC" width="225">标段名</th><th class="taC" width="140">计量期数</th><th width="115" class="taC">总价</th><th class="taC" width="">截止本期累计完成/本期完成/未完成</th></tr></thead>
  176. <tbody>
  177. <tr>
  178. <td><a href="/project/1/section/' . $value['pmid'] . '/detail">' . $value['pmname'] . '</a></td>
  179. <td class="">共 ' . $numCount . ' 期(本期 <span class="colOrange">审批中</span>)</td>
  180. <td class="taR">¥' . $totalmoney . '</td>
  181. <td>
  182. <div class="progress">
  183. <div class="bar bar-success" style="width: ' . $snTotalProgress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="截止本期累计完成:¥' . $nTotalProgress . '">' . $snTotalProgress . '</div>
  184. <div class="bar" style="width:' . $currTotalProgress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="本期完成:¥' . $ncurrTotalProgress . '">' . $currTotalProgress . '</div>
  185. <div class="bar bar-gary" style="width:' . $lessTotalProgress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $nlessTotalProgress . '">' . $lessTotalProgress . '</div>
  186. </div>
  187. </td>
  188. </tr>';
  189. }
  190. if ($biaoduantotalmoney > 0 && ($currTotal['totalplus'] > 0)) {
  191. $nprogress = number_format($currTotal['totalplus'], 2, '.', ',');
  192. $notherprogress = number_format($biaoduantotalmoney - $currTotal['totalplus'], 2, '.', ',');
  193. $progress = round(($currTotal['totalplus'] / $biaoduantotalmoney) * 100) . '%';
  194. $otherprogress = round((($biaoduantotalmoney - $currTotal['totalplus']) / $biaoduantotalmoney) * 100) . '%';
  195. $biaoduantotalmoney = number_format($biaoduantotalmoney, 2, '.', ',');
  196. }
  197. $htmlstr .= '<div class="project">
  198. <div class="proSection">
  199. <table class="table">
  200. <thead>
  201. <tr>
  202. <td width="150"><span aria-hidden="true" data-icon="u"></span> ' . $v['stname'] . '(' . $v['stkey'] . ') <a href="#secoption" data-toggle="modal" title="编辑/查看KEY"><span data-icon="S" aria-hidden="true" value="' . $v['stid'] . '" class="closePanel"></span></a></td>
  203. <td width="90">总价:</td><td width="165">¥<b style="font-size:16px">' . $biaoduantotalmoney . '</b></td>
  204. <td width="60">完成进度:</td><td><div class="progress">
  205. <div class="bar bar-success" style="width:' . $progress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="累计完成:¥' . $nprogress . '">' . $progress . '</div>
  206. <div class="bar bar-danger" style="width:' . $otherprogress . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $notherprogress . '">' . $otherprogress . '</div>
  207. </div></td>
  208. </tr>
  209. </thead>
  210. </table>
  211. <table class="table table-striped table-hover">
  212. ' . $bdhtmlstr . '
  213. </tbody>
  214. </table>
  215. </div>
  216. </div>';
  217. }
  218. $this->data['htmlstr'] = $htmlstr;
  219. if (isset($_POST['secname']) && $_POST['secname']) {
  220. $this->contractact->insertContract($this->params['pid'], $this->auth->getUid(), $_POST['secname']);
  221. return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
  222. }
  223. $this->data['pid'] = $this->params['pid'];
  224. $this->render('w-project-section', $this->data, TRUE);
  225. }
  226. /**
  227. *
  228. * @return type
  229. */
  230. public function sms()
  231. {
  232. if (isset($_POST['mobile']) && isset($_POST['verifycode'])) {
  233. $vmArray = $this->auth->getVerifyMobile();
  234. if (isset($vmArray) && $vmArray) {
  235. if (md5($_POST['mobile'] . $_POST['verifycode']) == md5($vmArray['mobile'] . $vmArray['code'])) {
  236. $this->profile->updateMobile($this->auth->getUid(), $vmArray['mobile']);
  237. return Doo::conf()->APP_URL . 'user/profile/sms';
  238. }
  239. }
  240. }
  241. $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
  242. $this->data['smsNoticeSwitch'] = $this->aconfig->getOne(array('select' => 'smsswitch', 'asArray' => TRUE))['smsswitch'];
  243. $this->render('edit-profile-sms', $this->data, TRUE);
  244. }
  245. /**
  246. *
  247. * @return type
  248. */
  249. public function smsEdit()
  250. {
  251. if (isset($_POST['mobile']) && isset($_POST['verifycode'])) {
  252. $vmArray = $this->auth->getVerifyMobile();
  253. if (isset($vmArray) && $vmArray) {
  254. if (md5($_POST['mobile'] . $_POST['verifycode']) == md5($vmArray['mobile'] . $vmArray['code'])) {
  255. $this->profile->updateMobile($this->auth->getUid(), $vmArray['mobile']);
  256. return Doo::conf()->APP_URL . 'user/profile/sms/edit';
  257. }
  258. }
  259. }
  260. $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
  261. $this->render('edit-profile-sms-edit', $this->data, TRUE);
  262. }
  263. /**
  264. *
  265. * @return type
  266. */
  267. public function checkMobile()
  268. {
  269. // $this->data['uprofile']['email'] = $this->auth->getUemail();
  270. // if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
  271. // $this->profile->upProfile($this->auth->getUid(), $_POST);
  272. // return DOO::conf()->APP_URL . 'user/profile';
  273. // }
  274. die(json_encode(array('mobile' => (int)$this->profile->checkMobile($_POST['mobile']))));
  275. }
  276. /**
  277. *
  278. * @return type
  279. */
  280. public function mobileVerify()
  281. {
  282. // $this->data['uprofile']['email'] = $this->auth->getUemail();
  283. // if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
  284. // $this->profile->upProfile($this->auth->getUid(), $_POST);
  285. // return DOO::conf()->APP_URL . 'user/profile';
  286. // }
  287. die(json_encode(array('mobile' => (int)$this->profile->checkMobile($_POST['mobile']))));
  288. }
  289. /**
  290. *
  291. * @return type
  292. */
  293. public function smsSend()
  294. {
  295. $randNum = rand(1000, 9999);
  296. $this->auth->setVerifyMobile(array('mobile' => $_POST['mobile'], 'code' => $randNum));
  297. $res = $this->sms->sendSms($_POST['mobile'], Doo::conf()->SMS_TIPS['AUDIT_NOTICE'] . $randNum . Doo::conf()->SMS_TIPS['END_MSG']);
  298. die(json_encode(array('verify' => $res)));
  299. }
  300. Function fNumber($number)
  301. {
  302. if ($number == '')
  303. Return "-";
  304. $nlen = strlen($number);
  305. while ($nlen > 3) {
  306. $fNumber = "," . substr($number, $nlen - 3, 3);
  307. $number = substr($number, 0, -3);
  308. $nlen = strlen($number);
  309. }
  310. if ($nlen <= 3) {
  311. $fNumber = $number . $fNumber;
  312. }
  313. Return $fNumber;
  314. }
  315. private function getFav()
  316. {
  317. $proArray = $this->project->getAll();
  318. $this->data['othrPro'] = [];
  319. foreach ($proArray as $key => $value) {
  320. if ($value['pid'] == $this->params['pid']) {
  321. $this->data['currProName'] = $value['pname'];
  322. $this->data['currProID'] = $value['pid'];
  323. } else {
  324. $this->data['othrPro'][] = $proArray[$key];
  325. }
  326. }
  327. }
  328. public function proSectionMeasure()
  329. {
  330. //此处未做更改,JSON文件已经固定名称
  331. $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  332. if (isset($jsonpath['dirname'])) {
  333. $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  334. if ($handle = opendir($extPathdir)) {
  335. while (false !== ($file = readdir($handle))) {
  336. $filename = NULL;
  337. $filename = pathinfo($file);
  338. if ($filename['extension'] == 'json')
  339. $proArray = json_decode(file_get_contents($extPathdir . '/' . $file), TRUE, JSON_UNESCAPED_UNICODE);
  340. }
  341. closedir($handle);
  342. }
  343. $this->data['proArray'] = $proArray['Bills'];
  344. } else {
  345. $this->data['proArray'] = [];
  346. }
  347. $this->data['mpid'] = $this->params['mpid'];
  348. $this->data['pid'] = $this->params['pid'];
  349. $this->render('w-project-section-measure', $this->data, TRUE);
  350. }
  351. public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0)
  352. {
  353. $count = mb_strlen($string, 'UTF-8'); //此处传入编码,建议使用utf-8。此处编码要与下面mb_substr()所使用的一致
  354. if (!$count) {
  355. return $string;
  356. }
  357. if ($len == 0) {
  358. $end = $count; //传入0则替换到最后
  359. } else {
  360. $end = $start + $len; //传入指定长度则为开始长度+指定长度
  361. }
  362. $i = 0;
  363. $returnString = '';
  364. while ($i < $count) { //循环该字符串
  365. $tmpString = mb_substr($string, $i, 1, 'UTF-8'); // 与mb_strlen编码一致
  366. if ($start <= $i && $i < $end) {
  367. $returnString .= $repalce;
  368. } else {
  369. $returnString .= $tmpString;
  370. }
  371. $i++;
  372. }
  373. return $returnString;
  374. }
  375. function unicode_encode($name)
  376. {//to Unicode
  377. $name = iconv('UTF-8', 'UCS-2', $name);
  378. $len = strlen($name);
  379. $str = '';
  380. for ($i = 0; $i < $len - 1; $i = $i + 2) {
  381. $c = $name[$i];
  382. $c2 = $name[$i + 1];
  383. if (ord($c) > 0) {// 两个字节的字
  384. $str .= '\\' . base_convert(ord($c), 10, 16) . base_convert(ord($c2), 10, 16);
  385. } else {
  386. $str .= $c2;
  387. }
  388. }
  389. $str = strtoupper($str);
  390. return $str;
  391. }
  392. function unicode_decode($name)
  393. {//Unicode to
  394. $pattern = '/([\w]+)|(\\\u([\w]{4}))/i';
  395. preg_match_all($pattern, $name, $matches);
  396. if (!empty($matches)) {
  397. $name = '';
  398. for ($j = 0; $j < count($matches[0]); $j++) {
  399. $str = $matches[0][$j];
  400. if (strpos($str, '\\u') === 0) {
  401. $code = base_convert(substr($str, 2, 2), 16, 10);
  402. $code2 = base_convert(substr($str, 4), 16, 10);
  403. $c = chr($code) . chr($code2);
  404. $c = iconv('UCS-2', 'UTF-8', $c);
  405. $name .= $c;
  406. } else {
  407. $name .= $str;
  408. }
  409. }
  410. }
  411. return $name;
  412. }
  413. public function proDetail()
  414. {
  415. // 面包屑导航项目
  416. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  417. $allproArray = $this->project->getAll();
  418. foreach ($allproArray as $kk => $vv) {
  419. if ($vv['pid'] == $this->params['pid']) {
  420. $this->data['currproArray'] = $vv;
  421. } else {
  422. $this->data['allproArray'][] = $vv;
  423. }
  424. }
  425. // 面包屑导航合同
  426. $conArray = $this->contractact->getAll();
  427. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  428. if (isset($measureArray['stid'])) {
  429. foreach ($conArray as $kkk => $vvv) {
  430. if ($vvv['stid'] == $measureArray['stid']) {
  431. $this->data['currconArray'] = $vvv;
  432. } else {
  433. $this->data['allconArray'][] = $vvv;
  434. }
  435. }
  436. } else {
  437. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  438. }
  439. // 面包屑导航标段
  440. $this->data['curractmeasureArray'] = NULL;
  441. $this->data['allactmeasureArray'] = [];
  442. $actmeasureArray = $this->actmeasure->getAll();
  443. foreach ($actmeasureArray as $kkkk => $vvvv) {
  444. if ($vvvv['stid'] == $measureArray['stid']) {
  445. if (($vvvv['pmid'] == $this->params['pmid'])) {
  446. $this->data['curractmeasureArray'] = $vvvv;
  447. } else {
  448. $this->data['allactmeasureArray'][] = $vvvv;
  449. }
  450. }
  451. }
  452. // 图标
  453. $this->data['MeasureArray'] = $this->numofperact->getRowByPmid($this->params['pmid']);
  454. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  455. foreach ($this->data['MeasureArray'] as $key => $value) {
  456. if ($measureArray['contracttotal'] > ($value['currdone'] > 0)) {
  457. $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  458. } else {
  459. $this->data['MeasureArray'][$key]['lessTotal'] = 0;
  460. }
  461. }
  462. $this->data['pmid'] = $this->params['pmid'];
  463. $this->data['pid'] = $this->params['pid'];
  464. $this->render('w-project-section-detail', $this->data, TRUE);
  465. }
  466. public function welcome()
  467. {
  468. // if (!$this->auth->isLoggedIn())
  469. // return Doo::conf()->APP_URL;
  470. if ($this->profile->getProWithUid($this->auth->getUid())['userid'])
  471. return Doo::conf()->APP_URL . 'project/list';
  472. if (isset($_POST['welform'])) {
  473. $profileUserArray = $_POST;
  474. $profileUserArray['userid'] = $this->auth->getUid();
  475. $this->profile->insertProfile($profileUserArray); // 无自增字段返回0
  476. return Doo::conf()->APP_URL . 'project/list';
  477. }
  478. $this->render('welcome', $this->data);
  479. }
  480. public function prolist()
  481. {
  482. // if (!$this->auth->isLoggedIn())
  483. // return Doo::conf()->APP_URL;
  484. // $proArray = new stdClass();
  485. // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  486. // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  487. // if ($handle = opendir($extPathdir)) {
  488. // while (false !== ($file = readdir($handle))) {
  489. // $filename = pathinfo($file);
  490. // if ($filename['extension'] == 'json')
  491. // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file));
  492. // }
  493. // closedir($handle);
  494. // }
  495. // $this->data['proArray'] = null;
  496. $this->render('s-project', $this->data);
  497. }
  498. // ajax提取密码名称
  499. public function getAjaxSection()
  500. {
  501. if (!$this->isAjax())
  502. return;
  503. echo json_encode($_POST);
  504. }
  505. public function repasswd()
  506. {
  507. if (isset($_POST['oldpasswd']) && isset($_POST['newpasswd']) && isset($_POST['renewpasswd']) && ($_POST['newpasswd'] == $_POST['renewpasswd'])) {
  508. $userArray = $this->user->getRowUser($this->auth->getUid());
  509. if ($this->ph->CheckPassword($_POST['oldpasswd'], $userArray['upass'])) {
  510. if ($this->user->updatePassWd($this->auth->getUid(), $_POST['newpasswd']))
  511. return Doo::conf()->APP_URL . 'signout';
  512. }
  513. }
  514. $this->render('edit-profile-pw', $this->data, TRUE);
  515. }
  516. }
  517. ?>