Example #1
0
 private function _edit_process($json)
 {
     $data = json_to_object($json);
     //先將權限設成管理者
     set_ignore_authorize(true);
     //取得參考網址資料跟位於session的user
     $user = $this->user;
     $annotation = NULL;
     if (isset($data->annotation_id)) {
         $annotation = new Annotation($data->annotation_id);
         $annotation_user = $annotation->get_user();
         if ($user->get_id() == $annotation_user->get_id()) {
             $data = $this->_setup_annotation($annotation, $data);
         } else {
             $data = create_json_excpetion('Edit Annnotation Error', 'You cannot edit annotation whick is not yours.');
         }
     } else {
         $data = create_json_excpetion('Edit Annnotation Error', 'Annotation ID is NULL');
     }
     //log區
     $array_data = NULL;
     if (isset($annotation)) {
         $array_data = $annotation->export_webpage_data($this->url);
     }
     $action = "image_spot.edit";
     kals_log($this->db, $action, $array_data);
     return $data;
 }
Example #2
0
 public function recommend_reject($json, $callback)
 {
     $annotation_id = $json;
     $annotation = new Annotation($annotation_id);
     $annotation_user = $annotation->get_user();
     $user = $this->user;
     if ($annotation_user->equals($user) == false) {
         $data = create_json_excpetion('Set Annnotation Recommend Error', 'You cannot set annotation recommend whick is not yours.');
         return $this->_display_jsonp($data, $callback);
     }
     $recommend = $annotation->get_recommend();
     //log區
     $array_data = $recommend->get_id();
     $action = 26;
     $user_id = NULL;
     if (isset($user)) {
         $user_id = $user->get_id();
     }
     kals_log($this->db, $action, array('memo' => $array_data, 'user_id' => $user_id));
     set_ignore_authorize(true);
     $recommend->set_accept(FALSE);
     set_ignore_authorize(false);
     context_complete();
     $data = TRUE;
     return $this->_display_jsonp($data, $callback);
 }