コード例 #1
0
 function submitSnapshotWebcam()
 {
     $title = $this->input->post('title');
     $myPhoto = $this->input->post('image_name');
     $price = round($this->input->post('price'), 2);
     if (!$price or $price <= 0) {
         echo json_encode(array('result' => 'error', 'message' => 'Price must greater than 0.'));
         exit;
     }
     $webcamDir = APP_ROOT . "webcamtemp/";
     $uploadDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_orig'] . "photos/";
     $thumbnailDir = APP_ROOT . $GLOBALS['global']['IMAGE']['image_thumb'] . "photos/";
     $thumb_height = $GLOBALS['global']['IMAGE']['thumb_height'];
     $thumb_width = $GLOBALS['global']['IMAGE']['thumb_width'];
     $orig_width = $GLOBALS['global']['IMAGE']['orig_width'];
     $orig_height = $GLOBALS['global']['IMAGE']['orig_height'];
     if (!$myPhoto) {
         echo json_encode(array('result' => 'error', 'message' => 'Upload picture failure.'));
         exit;
     } else {
         copy($webcamDir . $myPhoto, $thumbnailDir . $myPhoto);
         copy($webcamDir . $myPhoto, $uploadDir . $myPhoto);
         //chmod( $thumbnailDir.$myPhoto, 0777 );
         //chmod( $uploadDir.$myPhoto, 0777 );
         makeThumb($myPhoto, $uploadDir, $orig_width, $orig_height);
         makeThumb($myPhoto, $thumbnailDir, $thumb_width, $thumb_height);
         $data['image'] = $myPhoto;
         $data['id_user'] = getAccountUserId();
         $data['image_type'] = $GLOBALS['global']['IMAGE_STATUS']['private'];
         $data['price'] = $price;
         $data['comment'] = $title;
         $data['prof_flag'] = 0;
         $data['v_count'] = 0;
         $data['rate_num'] = 0;
         $data['rating'] = 0;
         $data['added_date'] = mysqlDate();
         $id_photo = $this->gallery_io_m->insert_map($data);
         $array['id_parent'] = 0;
         $array['id_user'] = getAccountUserId();
         $array['description'] = "priced at {$price}J\$";
         $array['add_date_post'] = mysqlDate();
         $array['post_name'] = getAccountUserId() . '_' . filterCharacter($title);
         $array['post_id'] = $id_photo;
         $array['post_code'] = $GLOBALS['global']['CHATTER_CODE']['backstage_photo'];
         $id_wall = $this->mod_io_m->insert_map($array, TBL_WALL);
         $this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_BACKSTAGE_PHOTO);
         $_SESSION['BACKSTAGE_PRICE'] = $price;
         echo json_encode(array('result' => 'ok', 'message' => 'Upload your backstage photo successfully.'));
         exit;
     }
     echo 'Unknown error';
     exit;
 }
コード例 #2
0
ファイル: rate_m.php プロジェクト: phonglanpls/jz-proj-2012
 function rateHentai($id_video, $score)
 {
     $videodata = $this->mod_io_m->init('id_video', $id_video, TBL_VIDEO);
     $data['rate_by'] = getAccountUserId();
     $data['rate_to'] = 1;
     $data['id_whom'] = $id_video;
     $data['rate_type'] = $GLOBALS['global']['RATING']['hentai'];
     $data['rate'] = $score;
     $data['rate_date'] = mysqlDate();
     $data['ip'] = $this->geo_lib->getIpAddress();
     $this->mod_io_m->insert_map($data, TBL_RATE);
     //update image rating record
     $rateArr = $this->getRateObject($id_video, $data['rate_type'], $data['rate_to']);
     $update['rate_num'] = $rateArr['rate_num'];
     $update['rating'] = $rateArr['rating'];
     $this->mod_io_m->update_map($update, array('id_video' => $id_video), TBL_VIDEO);
     //insert to wall
     $array['id_parent'] = 0;
     $array['id_user'] = getAccountUserId();
     $array['description'] = slugify($videodata->name);
     $array['add_date_post'] = mysqlDate();
     $array['post_name'] = $score . '_' . filterCharacter($videodata->name);
     $array['post_id'] = $id_video;
     $array['post_code'] = $GLOBALS['global']['CHATTER_CODE']['rating_hentai'];
     $array['rate_num'] = $rateArr['rate_num'];
     $array['rating'] = $rateArr['rating'];
     $id_wall = $this->mod_io_m->insert_map($array, TBL_WALL);
     $this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_RATE_VIDEO);
 }