本文整理汇总了PHP中OC_Filesystem::is_writable方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Filesystem::is_writable方法的具体用法?PHP OC_Filesystem::is_writable怎么用?PHP OC_Filesystem::is_writable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Filesystem
的用法示例。
在下文中一共展示了OC_Filesystem::is_writable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$breadcrumb = array();
$pathtohere = "";
foreach (explode("/", $dir) as $i) {
if ($i != "") {
$pathtohere .= "/" . str_replace('+', '%20', urlencode($i));
$breadcrumb[] = array("dir" => $pathtohere, "name" => $i);
}
}
// make breadcrumb und filelist markup
$list = new OC_Template("files", "part.list", "");
$list->assign("files", $files);
$list->assign("baseURL", OC_Helper::linkTo("files", "index.php") . "?dir=");
$list->assign("downloadURL", OC_Helper::linkTo("files", "download.php") . "?file=");
$breadcrumbNav = new OC_Template("files", "part.breadcrumb", "");
$breadcrumbNav->assign("breadcrumb", $breadcrumb);
$breadcrumbNav->assign("baseURL", OC_Helper::linkTo("files", "index.php") . "?dir=");
$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$freeSpace = OC_Filesystem::free_space('/');
$freeSpace = max($freeSpace, 0);
$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
$tmpl = new OC_Template("files", "index", "user");
$tmpl->assign("fileList", $list->fetchPage());
$tmpl->assign("breadcrumb", $breadcrumbNav->fetchPage());
$tmpl->assign('dir', $dir);
$tmpl->assign('readonly', !OC_Filesystem::is_writable($dir));
$tmpl->assign("files", $files);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign('uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
$tmpl->printPage();
示例2: isset
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
// Check if we are a user
OCP\JSON::checkLoggedIn();
// Set the session key for the file we are about to edit.
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
$filename = isset($_GET['file']) ? $_GET['file'] : '';
if (!empty($filename)) {
$path = $dir . '/' . $filename;
if (OC_Filesystem::is_writable($path)) {
$mtime = OC_Filesystem::filemtime($path);
$filecontents = OC_Filesystem::file_get_contents($path);
$filecontents = iconv(mb_detect_encoding($filecontents), "UTF-8", $filecontents);
OCP\JSON::success(array('data' => array('filecontents' => $filecontents, 'write' => 'true', 'mtime' => $mtime)));
} else {
$mtime = OC_Filesystem::filemtime($path);
$filecontents = OC_Filesystem::file_get_contents($path);
$filecontents = iconv(mb_detect_encoding($filecontents), "UTF-8", $filecontents);
OCP\JSON::success(array('data' => array('filecontents' => $filecontents, 'write' => 'false', 'mtime' => $mtime)));
}
} else {
OCP\JSON::error(array('data' => array('message' => 'Invalid file path supplied.')));
}
示例3:
// load required style sheets:
OC_Util::addStyle('files_svgedit', 'ocsvg');
// load required javascripts:
OC_Util::addScript('files_svgedit', 'svg-edit/embedapi');
OC_Util::addScript('files_svgedit', 'ocsvgEditor');
OC_Util::addScript('files_svgedit', 'canvg/canvg');
OC_Util::addScript('files_svgedit', 'canvg/rgbcolor');
OC_Util::addScript('files_svgedit', 'base64');
//OC_Util::addScript('files_svgedit', 'jsPDF/libs/sprintf');
//OC_Util::addScript('files_svgedit', 'jsPDF/jspdf');
OC_Util::addScript('files_svgedit', 'jsPDF/jspdf.min');
OC_Util::addScript('files_svgedit', 'svgToPdf');
OC_App::setActiveNavigationEntry('files_index');
$path = $_GET['file'];
if (method_exists('OC_Filesystem', 'is_writable')) {
$writable = OC_Filesystem::is_writable($path);
} else {
$writable = OC_Filesystem::is_writeable($path);
}
if (isset($_GET['file']) and $writable) {
$filecontents = OC_Filesystem::file_get_contents($path);
$filemtime = OC_Filesystem::filemtime($path);
} else {
$filecontents = "";
$filemtime = 0;
}
$tmpl = new OC_TEMPLATE("files_svgedit", "editor", "user");
$tmpl->assign('fileContents', json_encode($filecontents));
$tmpl->assign('filemTime', $filemtime);
$tmpl->assign('filePath', json_encode($path));
$tmpl->printPage();