本文整理汇总了PHP中ftp_chmod函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_chmod函数的具体用法?PHP ftp_chmod怎么用?PHP ftp_chmod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ftp_chmod函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preparePath
private function preparePath($subfolder)
{
if (!ftp_chdir($this->stream, $this->path)) {
$this->throwException('Cannot change directory to path "%s"', $this->path);
}
$p = $path = $this->path . $subfolder;
$folders = array();
while ($p != $this->path) {
if (!ftp_chdir($this->stream, $p)) {
$folders[] = basename($p);
$p = dirname($p);
} else {
krsort($folders);
foreach ($folders as $folder) {
$p .= '/' . $folder;
if (!ftp_mkdir($this->stream, $p)) {
$this->throwException('Cannot create path "%s"', $p);
}
ftp_chmod($this->stream, 0777, $p);
}
break;
}
}
ftp_chdir($this->stream, $path);
}
示例2: putFile
function putFile($filename)
{
if (!$this->connection || !$this->login_result) {
$this->connect();
}
$directories = dirname($filename);
$file = basename($filename);
$dir_array = explode('/', $directories);
$empty = array_shift($dir_array);
// Change into MIRROR_REMOTE_DIR.
ftp_chdir($this->connection, MIRROR_REMOTE_DIR);
// Create any folders that are needed.
foreach ($dir_array as $dir) {
// If it doesn't exist, create it.
// Then chdir to it.
if (@ftp_chdir($this->connection, $dir)) {
// Do nothing.
} else {
if (ftp_mkdir($this->connection, $dir)) {
ftp_chmod($this->connection, 0775, $dir);
ftp_chdir($this->connection, $dir);
} else {
NDebug::debug('Cannot create a folder via ftp.', N_DEBUGTYPE_INFO);
}
}
}
// Put the file into the folder.
$full_path = $_SERVER['DOCUMENT_ROOT'] . $filename;
if (ftp_put($this->connection, $file, $full_path, FTP_BINARY)) {
ftp_chmod($this->connection, 0775, $file);
NDebug::debug("FTP Mirror: {$filename} was uploaded successfully", N_DEBUGTYPE_INFO);
} else {
NDebug::debug("FTP Mirror: {$filename} was NOT uploaded successfully", N_DEBUGTYPE_INFO);
}
}
示例3: chmod
/**
* Set folder permission
* @param string $folderChmod folder name
* @param integer $permission permission value
* @return string success message
*/
public function chmod($folderChmod, $permission)
{
if (ftp_chmod($this->conn, $permission, $folderChmod) !== false) {
return true;
}
return false;
}
示例4: ftp_chmod
public function ftp_chmod($mode, $file)
{
if (!$this->ftp_conn) {
return false;
}
return @ftp_chmod($this->ftp_conn, $mode, $file);
}
示例5: Upload
protected function Upload($dir, $files)
{
global $lang;
$sum = 0;
foreach ($files as $key => $val) {
$sum += $_FILES[$val]['size'];
}
if ($sum <= 2097152) {
$rel_dir = 'Uploads/';
$make_dir = FALSE;
if (get_setting('ftp', 'use_ftp') || intval(get_setting('ftp', 'use_ftp')) == 1) {
if ($conn_id = ftp_connect(get_setting('ftp', 'server'))) {
if (@ftp_login($conn_id, get_setting('ftp', 'username'), get_setting('ftp', 'password'))) {
@ftp_mkdir($conn_id, $rel_dir . $dir);
@ftp_chmod($conn_id, 0777, $rel_dir . $dir);
$make_dir = TRUE;
}
}
} else {
if (@mkdir($rel_dir . $dir)) {
$make_dir = TRUE;
}
}
if ($make_dir) {
foreach ($files as $key => $file) {
@move_uploaded_file($_FILES[$file]['tmp_name'], $rel_dir . $dir . '/' . $_FILES[$file]['name']);
}
}
} else {
return SetError::Set($lang['L_ERRORFILESTOOBIG']);
}
return TRUE;
}
示例6: prepare
/**
* preprocess Index action.
*
* @access public
* @return string Forward name (null if no errors.)
*/
function prepare()
{
/* $this->af->setApp('xoops_cookie_path', '/itoh/hodajuku/html');
$this->af->set('xoops_root_path', '/home/smbuser/Site/main/public_html/itoh/hodajuku/html');
$this->af->set('xoops_trust_path', '/home/smbuser/Site/main/public_html/itoh/hodajuku/xoops_trust_path');
$this->af->setApp('result', 1);
return 'json_copyfile'; */
if ($this->af->validate() == 0) {
$username = $this->af->get('ftp_username');
$password = $this->af->get('ftp_password');
// let's copy
if ($conn_id = ftp_connect('localhost')) {
if (ftp_login($conn_id, $username, $password)) {
$ftp_root = $this->seekFTPRoot($conn_id);
$chroot = substr(BASE, strlen($ftp_root));
$xoops_root_path = substr($this->af->get('xoops_root_path'), strlen($ftp_root));
$remote_path = $chroot . '/tmp/html';
$this->ftpPut($remote_path, $xoops_root_path, $conn_id);
$xoops_trust_path = substr($this->af->get('xoops_trust_path'), strlen($ftp_root));
$remote_path = $chroot . '/tmp/xoops_trust_path';
$this->ftpPut($remote_path, $xoops_trust_path, $conn_id);
//// after script
$dir777 = array($xoops_root_path . '/uploads', $xoops_root_path . '/uploads/fckeditor', $xoops_root_path . '/uploads/wizmobile', $xoops_trust_path . '/templates_c', $xoops_trust_path . '/cache', $xoops_trust_path . '/templates_c', $xoops_trust_path . '/uploads', $xoops_trust_path . '/session', $xoops_trust_path . '/log', $xoops_trust_path . '/tmp', $xoops_trust_path . '/modules/protector/configs', $xoops_trust_path . '/uploads/d3downloads', $xoops_trust_path . '/uploads/pico');
foreach ($dir777 as $_d) {
ftp_chmod($conn_id, 0777, $_d);
}
/// mainfile.php
ftp_chmod($conn_id, 0666, $xoops_root_path . '/mainfile.php');
ftp_close($conn_id);
return null;
}
}
}
return 'json_error_reload';
}
示例7: doChmod
protected function doChmod($remote_file, $chmod_code)
{
// try to chmod
$chmod_code = octdec(str_pad($chmod_code, 4, '0', STR_PAD_LEFT));
$chmod_code = (int) $chmod_code;
return ftp_chmod($this->getConnection(), $chmod_code, $remote_file);
}
示例8: changeMode
public static function changeMode($path, $chmodValue)
{
$fake = new ftpAccessWrapper();
$parts = $fake->parseUrl($path);
$link = $fake->createFTPLink();
$serverPath = AJXP_Utils::securePath($fake->path . "/" . $parts["path"]);
ftp_chmod($link, $chmodValue, $serverPath);
}
示例9: chmod
public function chmod($mode = '0755', $file = '')
{
$this->dirlink = $file;
if (FALSE === ftp_chmod($this->link, $mode, $this->dirlink)) {
$this->errormsg = "Can't change this File/Dir";
return FALSE;
}
return TRUE;
}
示例10: ftp_image_put_file
static function ftp_image_put_file($destFileName, $sourceFileName, $mode = FTP_BINARY)
{
if (self::ftp_image_connect()) {
if (@ftp_put(ImageLib::$ftp_image_connect_id, $destFileName, $sourceFileName, $mode)) {
@ftp_chmod(ImageLib::$ftp_image_connect_id, 0777, $destFileName);
return true;
}
}
return false;
}
示例11: myftpchmod
/**
* write the compiled resource
*
* @param string $compile_path
* @param string $compiled_content
* @return true
*/
function myftpchmod($file)
{
$ftp_server = fvSite::$fvConfig->get("ftp.server_name");
$ftp_user_name = fvSite::$fvConfig->get("ftp.user");
$ftp_user_pass = fvSite::$fvConfig->get("ftp.pass");
$file = $file;
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$result = ftp_chmod($conn_id, 0777, $file);
ftp_close($conn_id);
return $result;
}
示例12: myftpchmod
function myftpchmod($file)
{
$ftp_server = "spo.ua";
$ftp_user_name = "spo";
$ftp_user_pass = "8i7PgfG1";
$file = $file;
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$result = ftp_chmod($conn_id, 0777, $file);
ftp_close($conn_id);
return $result;
}
示例13: chmod
public function chmod($mode, $file)
{
if ($this->_ftpStream) {
if (function_exists('ftp_chmod')) {
return ftp_chmod($this->_ftpStream, $mode, $file);
} else {
//echo "<h1>$file</h1>";
return ftp_site($this->_ftpStream, "chmod {$mode} {$file}");
//return ftp_exec($this->ftpStream, "chmod $mode $file");
}
}
return false;
}
示例14: changeMode
/**
* Changes element CHMOD
*
* The param can be also instance of cFTP_Chmod
*
* @param int $chmod CHMOD
* @throws cFTP_Exception
*/
public function changeMode($chmod)
{
if($chmod instanceof cFTP_Chmod)
$chmod = $chmod->getChmod();
$success = @ftp_chmod($this->handle, $chmod, $filename);
if( !$success )
throw new cFTP_Exception( "Could not change element CHMOD" );
return $this;
}
示例15: doLog
/**
* Log-Methode der erweiterten Query-Methode.
*
* Für jeden Monat wird eine Log-Datei erstellt.
* Jede SQL-Anfrage wird protokolliert mit SQL-Anfrage, Zeitpunkt und Urheberskript.
*
* @param string $sqlQuery: SQL-Anfrage
*/
private function doLog($sqlQuery)
{
//Datei zum Schreiben bestimmen
$logfile = PROJECT_DOCUMENT_ROOT . '/log/DB/dbEvents' . date('m_Y') . '.txt';
//Lokale Variable an globales FTP-Objekt anbinden
$FTP = $GLOBALS['FTP'];
ftp_chmod($FTP->FTPConn, 0757, PROJECT_DOCUMENT_ROOT . '/log/DB');
//String bereitstellen inkl. escapen
$data = date("d.m.Y H:i:s", time()) . ' : ' . $sqlQuery . ' [' . $_SERVER['SCRIPT_FILENAME'] . ']' . "\n";
if (!file_put_contents($logfile, $data, FILE_APPEND)) {
echo "Daten konnten nicht in Datei geschrieben werden.";
}
ftp_chmod($FTP->FTPConn, 0750, PROJECT_DOCUMENT_ROOT . '/log/DB');
}