Example #1
0
 public function addone($cond)
 {
     $this->setTableName('stud_baseinfo');
     $o = $this->selectA(array('stud_no' => $cond['s_no']));
     if (empty($o)) {
         $this->error_message .= $cond['s_no'] . '学号不存在!<br />';
         return;
     }
     $data['app_item_code'] = $cond['item_code'];
     $data['app_stud_no'] = $cond['s_no'];
     $data['app_item_type'] = $cond['item_type'];
     if ($_SESSION['admin_super'] == 1) {
         $data['app_state'] = 2;
         $data['app_unitime'] = getNowDate();
     } else {
         $data['app_state'] = 1;
     }
     $data['stud_orgcode'] = $o[0]['stud_orgcode'];
     $data['app_time'] = getNowDate();
     $this->setTableName('item_apply');
     if ($this->count(array('app_item_code' => $data['app_item_code'], 'app_stud_no' => $data['app_stud_no'])) > 0) {
         $this->error_message .= $cond['s_no'] . '同一项目只能申报一次!<br />';
         return;
     }
     $this->error_message .= $cond['s_no'] . '添加成功!<br />';
     $this->insert($data);
 }
Example #2
0
 public function onclick()
 {
     $this->setTableName('item_apply');
     if (empty($_POST['app_id'])) {
         return;
     }
     switch ($_POST['action']) {
         case 'yes':
             if ($_SESSION['admin_super'] == 1) {
                 $state = 2;
                 //校审核
                 $time = 'app_unitime';
             } else {
                 $state = 1;
                 //院审核
                 $time = 'app_coltime ';
             }
             foreach ($_POST['app_id'] as $id) {
                 $this->update(array('app_state' => $state, $time => getNowDate()), array('app_id' => $id));
             }
             break;
         case 'no':
             if ($_SESSION['admin_super'] == 1) {
                 $state = 4;
                 //校审核
                 $time = 'app_unitime';
             } else {
                 $state = 3;
                 //院审核
                 $time = 'app_coltime ';
             }
             foreach ($_POST['app_id'] as $id) {
                 $this->update(array('app_state' => $state, $time => getNowDate()), array('app_id' => $id));
             }
             break;
         case 'del':
             if ($_SESSION['admin_super'] == 1) {
                 foreach ($_POST['app_id'] as $id) {
                     $this->delete(array('app_id' => $id));
                 }
             } else {
                 foreach ($_POST['app_id'] as $id) {
                     $this->delete(array('app_id' => $id, 'app_state' => 0));
                 }
             }
             break;
         case 'quxiao':
             foreach ($_POST['app_id'] as $id) {
                 $this->update(array('app_state' => 0), array('app_id' => $id));
             }
     }
 }
Example #3
0
 public function add()
 {
     $id = intval($_GET['id']);
     $data['notic_title'] = $_POST['n_title'];
     $data['notic_user'] = $_SESSION['admin_id'];
     $data['notic_time'] = getNowDate();
     $data['notic_body'] = $_POST['notic_content'];
     if ($id) {
         $this->setTableName('notic');
         $this->update($data, array('notic_id' => $id));
     } else {
         $this->setTableName('notic');
         $this->insert($data);
         $id = $this->getInsertId();
     }
     header('Location: noticlist.php');
 }
Example #4
0
    echo $action->error_message;
    ?>
</p>
	   <table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" class="t1">
    <tr>
      <td height="50" colspan=6 align="center" ><?php 
    if (isset($_GET['i_time'])) {
        echo date('Y年m月', $time[0]), '到', date('Y年m月', $time[1]);
    } else {
        if ($_GET['i_time_year']) {
            echo date('Y年', $time[0]);
        }
    }
    ?>
各学院素拓申报统计表<small>(导出时间:<?php 
    echo getNowDate();
    ?>
)</small></td>
    </tr>
    <tr align="center" color="blue" border >
     <td>学院名称</td>
     <td>申报总人数</td>
     <td>申报总项目数</td>
     <td>总申报学分</td>
     <td>总有效学分</td>
     <td>总课程学分</td>
	</tr>
   <tr>
   	<td align="center">&nbsp;东方院</td>
			<?php 
    $DFitem = $tongji->countDFItem($time);
 /**
  * 封禁用户
  * @access public
  * @param string $fid 贴吧id
  * @param string $id 用户id
  * @param int $day 天数
  */
 public function blockUser($fid, $id, $day)
 {
     if ($this->uid == null) {
         $this->ajaxReturn('need-login');
         return;
     }
     if (A('Forum')->getManageStatus($fid) != 0) {
         $this->ajaxReturn('invalid-authority');
         return;
     }
     if ($day != 1 && $day != 3 && $day != 10) {
         $this->ajaxReturn('invalid-day');
     } else {
         //先检测有无封禁情况
         $old_status = A('Forum')->getUserStatus($id, $fid);
         $uuid = getMikuInt();
         $uuid_2 = getMikuInt();
         if ($old_status == 'normal') {
             $data_1['data_id'] = $uuid;
             $data_1['user_id'] = $id;
             $data_1['forum_id'] = $fid;
             $data_1['user_status'] = 'block';
             $re_1 = M('user_status')->data($data_1)->add();
             $data_2['data_id'] = $uuid_2;
             $data_2['user_id'] = $id;
             $data_2['forum_id'] = $fid;
             $data_2['block_date'] = getNowDate();
             $data_2['block_days'] = $day;
             $re_2 = M('block_users')->data($data_2)->add();
         } elseif ($old_status == 'block') {
             $re_1 = 1;
             $data_2['data_id'] = $uuid_2;
             $data_2['user_id'] = $id;
             $data_2['forum_id'] = $fid;
             $data_2['block_date'] = getNowDate();
             $data_2['block_days'] = $day;
             $re_2 = M('block_users')->data($data_2)->add();
         } elseif ($old_status == 'black') {
             $re_1 = M('user_status')->where(array('user_id' => $id, 'forum_id' => $fid))->setField('user_status', 'block,black');
             $data_2['data_id'] = $uuid_2;
             $data_2['user_id'] = $id;
             $data_2['forum_id'] = $fid;
             $data_2['block_date'] = getNowDate();
             $data_2['block_days'] = $day;
             $re_2 = M('block_users')->data($data_2)->add();
         } elseif ($old_status == 'block,black') {
             $re_1 = 1;
             $data_2['data_id'] = $uuid_2;
             $data_2['user_id'] = $id;
             $data_2['forum_id'] = $fid;
             $data_2['block_date'] = getNowDate();
             $data_2['block_days'] = $day;
             $re_2 = M('block_users')->data($data_2)->add();
         }
         $re_3 = $this->setLog('block-user', $uuid_2, $fid);
         if ($re_1 && $re_2 && $re_3) {
             $this->ajaxReturn('block-success');
         } else {
             $this->ajaxReturn('block-failure');
         }
     }
 }
 /**
  * 收藏帖子
  * @access public
  * @param string $tid 帖子id
  */
 public function storeThread($tid)
 {
     if ($this->uid == null) {
         $this->ajaxReturn('need-login');
     }
     $uid = $this->uid;
     $store_status = $this->getStoreStatus($tid, $uid);
     if ($store_status == null) {
         $data['data_id'] = getMikuInt();
         $data['user_id'] = $uid;
         $data['thread_id'] = $tid;
         $data['stored_date'] = getNowDate();
         $re = M('stored_thread')->data($data)->add();
         $this->ajaxReturn('do-success');
     } else {
         $re = M('stored_thread')->where(array('thread_id' => $tid, 'user_id' => $uid))->delete();
         $this->ajaxReturn('do-success');
     }
 }
    /**
     * 发送邮件
     * @access public
     * @param string $to 收件人地址
     * @param stirng $user_name 用户名
     * @param string $user_id 用户id
     * @return boolen
     */
    private function sendMail($to, $user_name, $user_id)
    {
        $info = M('password_key')->where(array('user_id' => $user_id))->find();
        if (!empty($info)) {
            return false;
        }
        $data['user_id'] = $user_id;
        $data['key'] = getRandChar($length = 64);
        $re = M('password_key')->data($data)->add();
        if ($re) {
            $url = 'http://post.kotori.love' . U('User/forgetPassword/step/3/key/' . $data['key']);
        } else {
            return false;
        }
        $title = 'Posutoba贴吧系统:重置密码';
        $content = '<div style="margin: 16px 40px;background-color: #eef2fa;border: 1px solid #d8e3e8;padding: 0 15px;-moz-border-radius: 5px;-webkit-border-radius: 5px;-khtml-border-radius: 5px;border-radius: 5px">
    <p>' . $user_name . ':您收到这封邮件,是由于这个邮箱地址在 Posutoba贴吧系统 被登记为用户邮箱, 且该用户请求使用 Email 密码重置功能所致。</p>
    <p><strong>!!!重要!!!</strong></p>
    <p>如果您没有提交密码重置的请求或不是 Posutoba贴吧系统 的注册用户,请立即忽略 并删除这封邮件。只有在您确认需要重置密码的情况下,才需要继续阅读下面的 内容。</p>
    <p><strong>!!!密码重置说明!!!</strong></p>
    <p>您只需在提交请求后的三天内,通过点击下面的链接重置您的密码:</p>
    <p><a href="' . $url . '">' . $url . '</a></p>
    <p>(如果上面不是链接形式,请将该地址手工粘贴到浏览器地址栏再访问)
在上面的链接所打开的页面中输入新的密码后提交,您即可使用新的密码登录网站了。您可以在用户控制面板中随时修改您的密码。</p>
    <p>时间:' . getNowDate() . '</p>
    <p>此致</p>
    <p>Posutoba贴吧系统 管理团队. http://post.kotori.love/</p>
</div>';
        Vendor('PHPMailer.PHPMailerAutoload');
        $mail = new \PHPMailer();
        //实例化
        $mail->IsSMTP();
        // 启用SMTP
        $mail->Host = 'smtp.exmail.qq.com';
        //smtp服务器的名称(这里以QQ邮箱为例)
        $mail->SMTPAuth = true;
        //启用smtp认证
        $mail->Username = '******';
        //你的邮箱名
        $mail->Password = '******';
        //邮箱密码
        $mail->From = '*****@*****.**';
        //发件人地址(也就是你的邮箱地址)
        $mail->FromName = 'Posutoba贴吧系统';
        //发件人姓名
        $mail->AddAddress($to, $user_name);
        $mail->WordWrap = 50;
        //设置每行字符长度
        $mail->IsHTML(true);
        // 是否HTML格式邮件
        $mail->CharSet = 'utf-8';
        //设置邮件编码
        $mail->Subject = $title;
        //邮件主题
        $mail->Body = $content;
        //邮件内容
        $mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端";
        //邮件正文不支持HTML的备用显示
        return $mail->Send();
    }
 /**
  * 申请小吧主表单
  * @access public
  */
 public function doApplySmallManager()
 {
     $param = I('post.');
     $fid = $param['fid'];
     $content = $param['content'];
     if ($this->uid == null) {
         $this->ajaxReturn('need-login');
     }
     $uid = $this->uid;
     $info = M('forum_manager_apply')->where(array('forum_id' => $fid, 'user_id' => $uid, 'is_pass' => 0))->find();
     if (!empty($info)) {
         $this->ajaxReturn('already-apply');
     }
     $info_2 = M('forum_manager')->where(array('forum_id' => $fid, 'user_id' => $uid))->find();
     if (!empty($info_2)) {
         $this->ajaxReturn('already-apply');
     }
     $data['data_id'] = getMikuInt();
     $data['user_id'] = $uid;
     $data['forum_id'] = $fid;
     $data['apply_date'] = getNowDate();
     $data['apply_type'] = 1;
     $data['apply_content'] = $content;
     $data['is_pass'] = 0;
     $re = M('forum_manager_apply')->data($data)->add();
     if ($re) {
         $this->ajaxReturn('apply-success');
     } else {
         $this->ajaxReturn('apply-failure');
     }
 }