UserController.php 23 KB

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