本文整理汇总了PHP中kfm_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP kfm_lang函数的具体用法?PHP kfm_lang怎么用?PHP kfm_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了kfm_lang函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _renameDirectory
function _renameDirectory($fid, $newname)
{
if (!$GLOBALS['kfm']->setting('allow_directory_edit')) {
return 'error: ' . kfm_lang('permissionDeniedEditDirectory');
}
$dir = kfmDirectory::getInstance($fid);
$dir->rename($newname);
return _loadDirectories($dir->pid);
}
示例2: _renameDirectory
function _renameDirectory($fid, $newname)
{
global $kfm_allow_directory_edit;
if (!$kfm_allow_directory_edit) {
return 'error: ' . kfm_lang('permissionDeniedEditDirectory');
}
$dir = kfmDirectory::getInstance($fid);
$dir->rename($newname);
return _loadDirectories($dir->pid);
}
示例3: crop
function crop($x1, $y1, $width, $height, $newname = false)
{
if (!$GLOBALS['kfm']->setting('allow_image_manipulation')) {
return $this->error(kfm_lang('permissionDeniedManipImage'));
}
if (!$newname) {
$this->deleteThumbs();
if (!$this->isWritable()) {
return $this->error(kfm_lang('imageNotWritable'));
}
}
if ($GLOBALS['kfm']->setting('use_imagemagick') && $newname && !$this->useImageMagick($this->path, 'crop ' . $width . 'x' . $height . '+' . $x1 . '+' . $y1 . ' +repage', dirname($this->path) . '/' . $newname)) {
return;
} else {
if ($GLOBALS['kfm']->setting('use_imagemagick') && !$this->useImageMagick($this->path, 'crop ' . $width . 'x' . $height . '+' . $x1 . '+' . $y1 . ' +repage', $this->path)) {
return;
}
}
# else use GD
$load = 'imagecreatefrom' . $this->type;
$save = 'image' . $this->type;
$im = $load($this->path);
$cropped = imagecreatetruecolor($width, $height);
imagecopyresized($cropped, $im, 0, 0, $x1, $y1, $width, $height, $width, $height);
imagedestroy($im);
if ($newname) {
$save($cropped, dirname($this->path) . '/' . $newname, $this->type == 'jpeg' ? 100 : 9);
} else {
$save($cropped, $this->path, $this->type == 'jpeg' ? 100 : 9);
}
imagedestroy($cropped);
}
示例4: setContent
/**
* Write content to the file
* @param mixed $content
*/
function setContent($content)
{
global $kfm;
if (!$kfm->setting('allow_file_edit')) {
return $this->error(kfm_lang('permissionDeniedEditFile'));
}
$result = file_put_contents($this->path, $content);
if (!$result) {
return $this->error(kfm_lang('errorSettingFileContent'));
}
return true;
}
示例5: rename
function rename($newname)
{
global $kfm, $kfmDirectoryInstances;
if (!$kfm->setting('allow_directory_edit')) {
return $this->error(kfm_lang('permissionDeniedEditDirectory'));
}
if ($this->isLink()) {
return $this->error(kfm_lang('cannotRenameLink'));
}
if (!$this->isWritable()) {
return $this->error(kfm_lang('permissionDeniedRename', $this->name));
}
if (!$this->checkName($newname)) {
return $this->error(kfm_lang('cannotRenameFromTo', $this->name, $newname));
}
$parent = kfmDirectory::getInstance($this->pid);
if (file_exists($parent->path() . $newname)) {
return $this->error(kfm_lang('aDirectoryNamedAlreadyExists', $newname));
}
rename(rtrim($this->path(), ' /'), file_join($parent->path(), rtrim($newname, ' /')));
if (file_exists($this->path())) {
return $this->error(kfm_lang('failedRenameDirectory'));
}
$kfm->db->query("update " . KFM_DB_PREFIX . "directories set name='" . sql_escape($newname) . "' where id=" . $this->id);
$this->name = $newname;
$this->cached_path = $this->path();
$kfmDirectoryInstances[$this->id] = $this;
}
示例6: _zip
function _zip($filename, $files)
{
global $kfm_session;
$cwd_id = $kfm_session->get('cwd_id');
$dir = kfmDirectory::getInstance($cwd_id);
$cwd = $dir->path();
if (!$kfm->setting('allow_file_create')) {
return kfm_error(kfm_lang('permissionDeniedCreateFile'));
}
global $rootdir;
if (!kfmFile::checkName($filename)) {
return kfm_error(kfm_lang('illegalFileName', $filename));
}
$arr = array();
foreach ($files as $f) {
$file = kfmFile::getInstance($f);
if (!$file) {
return kfm_error(kfm_lang('missingFileInSelection'));
}
$arr[] = $file->path;
}
# try native system zip command
$res = -1;
$pdir = $cwd . '/';
$zipfile = $pdir . $filename;
for ($i = 0; $i < count($arr); ++$i) {
$arr[$i] = str_replace($pdir, '', $arr[$i]);
}
exec('cd "' . escapeshellcmd($cwd) . '" && zip -D "' . escapeshellcmd($zipfile) . '" "' . join('" "', $arr) . '"', $arr, $res);
if ($res) {
return kfm_error(kfm_lang('noNativeZipCommand'));
}
return kfm_loadFiles($cwd_id);
}
示例7: join
$comment = join("\n", $data['COMMENT']);
}
}
$file->setCaption($comment);
} else {
if (isset($_POST['kfm_unzipWhenUploaded']) && $_POST['kfm_unzipWhenUploaded']) {
kfm_extractZippedFile($fid);
$file->delete();
}
}
}
}
}
}
} else {
$errors[] = kfm_lang('permissionDeniedUpload');
}
if (isset($_REQUEST['swf']) && $_REQUEST['swf'] == 1) {
if (count($errors)) {
echo join("\n", $errors);
} else {
echo 'OK';
}
exit;
}
?>
<html>
<head>
<script type="text/javascript">
<?php
$js = isset($_REQUEST['js']) ? $js : '';
示例8: list
$height = $image->height;
}
$h = 0;
$s = 0;
$l = 0;
if (isset($_GET['hsl'])) {
list($h, $s, $l) = explode(':', $_GET['hsl']);
}
$image->setThumbnail($width, $height, $h, $s, $l);
$name = $image->thumb_id;
$path = $image->thumb_path;
$extension = $image->getExtension();
} else {
$file = kfmFile::getInstance($id);
if (!$file) {
echo kfm_lang('errorFileIDNotFound', $id);
exit;
}
$path = $file->path;
$name = $file->name;
$extension = $file->getExtension();
}
}
// { headers
if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
$name = preg_replace('/\\./', '%2e', $name, substr_count($name, '.') - 1);
}
@set_time_limit(0);
header('Cache-Control: max-age = 2592000');
header('Expires-Active: On');
header('Expires: Fri, 1 Jan 2500 01:01:01 GMT');
示例9: addFile
function addFile($file)
{
if (!$GLOBALS['kfm_allow_file_create']) {
return $this->error(kfm_lang('permissionDeniedCreateFile'));
}
if (is_numeric($file)) {
$file = kfmFile::getInstance($file);
}
if (!$this->isWritable()) {
return $this->error(kfm_lang('fileNotCreatedDirUnwritable', $file->name));
}
copy($file->path, $this->path . '/' . $file->name);
$id = $file->addToDb($file->name, $this->id);
if ($file->isImage()) {
$file = kfmImage::getInstance($file->id);
$newFile = kfmImage::getInstance($id);
$newFile->setCaption($file->caption);
} else {
$newFile = kfmFile::getInstance($id);
}
$newFile->setTags($file->getTags());
return true;
}