本文整理匯總了PHP中JFTP::chmod方法的典型用法代碼示例。如果您正苦於以下問題:PHP JFTP::chmod方法的具體用法?PHP JFTP::chmod怎麽用?PHP JFTP::chmod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JFTP
的用法示例。
在下文中一共展示了JFTP::chmod方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: set_permissions
private function set_permissions($filename, $permissions)
{
jimport("joomla.client.helper");
$ftp_config = JClientHelper::getCredentials('ftp');
if ($ftp_config['enabled']) {
jimport("joomla.client.ftp");
jimport("joomla.filesystem.path");
$jpath_root = JPATH_ROOT;
$filename = JPath::clean(str_replace(JPATH_ROOT, $ftp_config['root'], $filename), '/');
$ftp = new JFTP($ftp_config);
$result = intval($ftp->chmod($filename, $permissions));
} else {
$result = intval(@chmod($filename, $permissions));
}
$this->InstallLog->Write("setting permissions for [{$filename}]... [{$result}]");
return $result;
}
示例2: uploadFile
/**
* @param string The name of the php (temporary) uploaded file
* @param string The name of the file to put in the temp directory
* @param string The message to return
*/
function uploadFile($filename, $userfile_name, $msg)
{
$baseDir = JPATH_SITE . '/media';
if (file_exists($baseDir)) {
if (is_writable($baseDir)) {
if (move_uploaded_file($filename, $baseDir . $userfile_name)) {
if (JFTP::chmod($baseDir . $userfile_name)) {
return true;
} else {
$msg = JText::_('Failed to change the permissions of the uploaded file.');
}
} else {
$msg = JText::_('Failed to move uploaded file to <code>/media</code> directory.');
}
} else {
$msg = JText::_('Upload failed as <code>/media</code> directory is not writable.');
}
} else {
$msg = JText::_('Upload failed as <code>/media</code> directory does not exist.');
}
return false;
}