Esempio n. 1
0
 public function Image($id)
 {
     $upload = new TUpload();
     $result = $upload->Save('image');
     $url = str_replace('../upload/', UR_UPLOAD, $result['value']['path']);
     $this->model->Edit($id, array('topic_image' => $url));
     GoBack();
 }
 public function Update($id)
 {
     if ($_FILES['image']) {
         $up = new TUpload(UPLOAD_BY_OTHER, 'category');
         $up->Save('image', $id);
     }
     $this->model->Edit($id, $_POST, 'category_');
     Redirect(UR_MP . 'Category/Edit/' . $id);
 }
Esempio n. 3
0
 public function UploadAttach($file_name, $destination, $type = REALTION_ATTACH)
 {
     $upload = new TUpload();
     $result = $upload->Save($file_name);
     if ($result['success']) {
         $res = $this->model->AddAttach($result, $destination, $type);
     } else {
         $res = false;
     }
     GoBack();
 }
Esempio n. 4
0
     if (strlen($insert['req_title']) < 5 || strlen($insert['req_text']) < 10) {
         Redirect('/msg/' . ' عنوان یا درخواست خیلی کوتاه است');
     } else {
         $m = new TModel('req', 'req_');
         $insert['req_member_id'] = $_COOKIE['mid'];
         $a = $m->Create($insert);
         Redirect('/msg/' . ' برنامه درخواستی شما ثبت شد و به زودی ترتیب اثر داده خواهد شد');
     }
     break;
 case 'profile':
     $valid = array('member_name', 'member_degree', 'member_field', 'member_number', 'member_city', 'member_status');
     $edit = promis($clean, $valid);
     $m = new TModel('member', 'member_');
     $m->Edit($_COOKIE['mid'], $edit);
     if (isset($_FILES['member_avatar'])) {
         $up = new TUpload();
         $up->SaveAvatar('member_avatar', $_COOKIE['mid']);
     }
     GoBack();
     $result['success'] = false;
     $result['value'] = 'ویرایش با موفقیت انجام شد';
     echo json_encode($result);
     die;
     break;
 case 'like':
     if (isset($_COOKIE['mid'])) {
         $r = TRelation::GetInstance();
         if ($clean['like'] == 1) {
             $b = $r->Has($_COOKIE['mid'], $clean['id'], REALTION_LIKE);
             if ($b) {
                 $result['success'] = false;