Beispiel #1
0
 function saveHistory()
 {
     $data = ['content' => $_POST['content']];
     $result = Connect::update("text", $data, " WHERE key_t='history' ");
     if ($result) {
         echo json_encode(['status' => true]);
     } else {
         echo json_encode(['status' => false]);
     }
     exit(0);
 }
 public function setStatus($message, $status = NULL)
 {
     $id = is_array($message) && $message['id'] ? $message['id'] : $message;
     if (isset($status) && $status) {
         $mstatus = $status;
     } elseif (is_array($message) && $message['status'] >= 0) {
         $mstatus = $message['status'];
     } else {
         return;
     }
     $message = $this->connect->update($this->tableName, ['status' => $mstatus], 'id = ' . $id);
     return $message;
 }
Beispiel #3
0
 /**
  * @param $fid
  * @param $uid
  * @param $wUid
  * @return bool|string
  * @throws \Exception
  * @throws \OC\HintException
  */
 public function shareFile($uid, $wUid, $fid, $permission = 1)
 {
     $isEnabled = \OCP\Share::isEnabled();
     $isAllowed = \OCP\Share::isResharingAllowed();
     $sharedWith = \OCP\Share::getUsersItemShared('file', $fid, $uid, false, true);
     //$file = $this->connect->files()->getInfoById($fid);
     if ($isEnabled && $isAllowed && !in_array($wUid, $sharedWith)) {
         // \OCP\Constants::PERMISSION_READ
         // \OCP\Constants::PERMISSION_ALL
         // \OCP\Share::SHARE_TYPE_LINK
         // \OCP\Share::SHARE_TYPE_USER,
         $shareIsSuccess = \OC\Share\Share::shareItem('file', $fid, \OCP\Share::SHARE_TYPE_USER, $wUid, $permission);
         if ($shareIsSuccess) {
             $this->connect->update('*PREFIX*share', ['uid_initiator' => $uid], 'share_with = :share_with AND uid_owner = :uid_owner AND file_source = :file_source', [':share_with' => $wUid, ':uid_owner' => $uid, ':file_source' => $fid]);
             $token = \OC\Share\Share::shareItem('file', $fid, \OCP\Share::SHARE_TYPE_LINK, $wUid, $permission);
             $this->connect->update('*PREFIX*share', ['uid_initiator' => $uid, 'share_with' => null], 'uid_owner = :uid_owner AND file_source = :file_source AND token = :token', [':uid_owner' => $uid, ':file_source' => $fid, ':token' => $token]);
             return $token;
         }
     }
 }
 public function updateTask($id, $data)
 {
     return $this->connect->update($this->tableName, $data, 'id = ?', [(int) $id]);
 }
 public function update($data)
 {
     $this->connect->update($this->tableName, $data, 'id = ' . $data['id']);
 }