/** * Add file change to the notification queue in the database * trigger on file/folder change/upload * @param $path Path of the modified file. * @return void */ public static function queue_fileChange_notification($path) { $fileInfo = OC_Files::getFileInfo($path['path']); $timestamp = time(); //TODO timestamp nust be a constant. self::db_insert_upload(OCP\User::getUser(), $timestamp, $fileInfo['fileid']); }
//echo json_encode('WP is here !'); // //echo $baseuri; $RUNTIME_APPTYPES = array('filesystem', 'authentication', 'share'); // OC_App::loadApps($RUNTIME_APPTYPES); $normalize_path = str_replace('\\', '/', OC_APP::getAppPath('user_wordpress')); $path_array = explode('/', $normalize_path); array_pop($path_array); $app_folder = array_pop($path_array); require_once $app_folder . '/lib/autoauth.php'; //require_once('apps/user_wordpress/lib/autoauth.php'); if (isset($_REQUEST['share_link'])) { if (OC_App::isEnabled('files_sharing')) { $file_path = urldecode(substr(implode('/', array_slice($vars, 5)), 0, -11)); $file_infos = OC_Files::getFileInfo($file_path); $token = ''; // is the file allready shared ? $shares = OCP\Share::getItemShared('file', $file_infos['id'], OCP\Share::FORMAT_NONE, null, true); foreach ($shares as $share) { if ($share['path'] == $file_infos['path']) { $token = $share['token']; } } // if not, let's share the file if (empty($token)) { $token = OCP\Share::shareItem('file', $file_infos['id'], 3, NULL, 1); } // return token echo trim($token); }
/** * Returns a specific child node, referenced by its name * * @param string $name * @throws Sabre_DAV_Exception_FileNotFound * @return Sabre_DAV_INode */ public function getChild($name, $info = null) { $path = $this->path . '/' . $name; if (is_null($info)) { $info = OC_Files::getFileInfo($path); } if (!$info) { throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located'); } if ($info['mimetype'] == 'httpd/unix-directory') { $node = new OC_Connector_Sabre_Directory($path); } else { $node = new OC_Connector_Sabre_File($path); } $node->setFileinfoCache($info); return $node; }