예제 #1
0
 public function uploadCalendar()
 {
     //$data = json_decode(file_get_contents('php://input'), true);
     $data = $_POST;
     $data['username'] = user_decrypt($data['username']);
     $file = $_FILES['file'];
     $return['error'] = 0;
     $return['value'] = "Uploaded successfully";
     $weights = array();
     if (isset($data['weights'])) {
         //print_r($data['weights']);
         //file_put_contents('aaa.txt', print_r(json_decode($data['weights'],true),true),FILE_APPEND | LOCK_EX);
         foreach (json_decode($data['weights'], true) as $sw) {
             $pat = '/' . str_replace(' ', '.*', $sw['string']) . '/i';
             $weights[] = array('pattern' => $pat, 'weight' => $sw['weight']);
         }
     }
     if (getUserUID($data['username'])) {
         if ($data['calname'] == "UNSW") {
             if (isset($file)) {
                 if (!$this->unsw_addToDatabase($data['username'], $data['calname'], $file['tmp_name'], $weights)) {
                     $return['error'] = -3;
                     $return['value'] = "File couldn't convert, broken metadata";
                 }
             } else {
                 $return['error'] = -3;
                 $return['value'] = "Invalid file type";
             }
         } else {
             //Do nothing for now
         }
     } else {
         $return['error'] = -1;
         $return['value'] = "Invalid username";
     }
     $jsonString = json_encode($return);
     echo $jsonString;
 }
예제 #2
0
파일: group.php 프로젝트: tonyward/Teameet
 public function json_Meeting()
 {
     $data = json_decode(file_get_contents('php://input'), true);
     $data['username'] = user_decrypt($data['username']);
     $check = $this->checkInput($data, array('username', 'gid', 'start', 'end', 'length'));
     if ($check = '') {
         if ($this->memberCheck($data['username'], $data['gid'])) {
             $return['error'] = -3;
             $return['value'] = "Not implemented f**k off";
         } else {
             $return['error'] = -2;
             $return['value'] = "You are not a member of this group";
         }
     } else {
         $return['error'] = -1;
         $return['value'] = $check;
     }
     $jsonstring = json_encode($return);
     echo $jsonstring;
 }
예제 #3
0
파일: events.php 프로젝트: tonyward/Teameet
 public function json_GetEvents()
 {
     $data = json_decode(file_get_contents('php://input'), true);
     $check = $this->checkInput($data, array('username', 'calname', 'month', 'year'));
     $data['username'] = user_decrypt($data['username']);
     if ($check == '') {
         if (getUserUID($data['username']) <= 0) {
             $return['error'] = -2;
             $return['value'] = "Invalid username";
             $return['passed'] = $data;
         } else {
             $return = getEventsForAMonth($data['username'], $data['calname'], $data['month'], $data['year']);
             foreach ($return as &$r) {
                 $r['title'] = $r['name'];
                 $r['id'] = $r['eid'];
             }
         }
     } else {
         $return['error'] = -1;
         $return['value'] = $check;
     }
     $jsonstring = json_encode($return);
     echo $jsonstring;
 }