本文整理汇总了PHP中makeDirectory函数的典型用法代码示例。如果您正苦于以下问题:PHP makeDirectory函数的具体用法?PHP makeDirectory怎么用?PHP makeDirectory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeDirectory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rpcCache
public function rpcCache()
{
$this->dir = getSettingsPath() . "/httprpc";
if (!is_dir($this->dir)) {
makeDirectory($this->dir);
}
}
示例2: gravaArquivos
function gravaArquivos($media_folder)
{
$media_path = realpath($_SERVER['DOCUMENT_ROOT']) . '\\files\\fotos\\' . $media_folder;
if (isset($_FILES)) {
//ksort($_FILES);
if (!makeDirectory($media_path)) {
return 2;
}
//Não foi possível criar o diretório
$media_items = array();
$media_name = array('antena', 'lnb', 'base', 'cabo', 'conector', 'checkup_sky');
$indice = 0;
foreach ($_FILES as $key => $media_file) {
$media_items[$key] = '';
if ($media_file['size'] > 0) {
$media_file_name = $_POST['os'] . '-' . $media_name[$indice] . '.jpeg';
$media_items[$key] = $media_file_name;
$media_file_path = $media_path . '/' . $media_file_name;
if (!move_uploaded_file($media_file['tmp_name'], $media_file_path)) {
return 3;
}
//Não foi possível enviar o arquivo
}
$indice++;
}
} else {
return 0;
//Sem arquivos para gravar
}
return 1;
//Arquivos gravados com sucesso
}
示例3: moverImagen
function moverImagen($img) {
global $conn;
if ($img != "") {
$fileOrigen = IMAGES_EDICION_PATH.$img;
$partes_ruta = pathinfo($img);
$filename = $_POST["id"].".".$partes_ruta["extension"];
$fileDest = IMAGES_BANNERS_PATH.$_POST["id"]."/".$filename;
if (!file_exists(IMAGES_BANNERS_PATH.$_POST["id"]))
makeDirectory(IMAGES_BANNERS_PATH.$_POST["id"]);
unlink($fileDest);
if (rename($fileOrigen, $fileDest)) {
$params = array(":id" => $_POST["id"],
":imagen" => $filename);
$sql =
"UPDATE rrhh.rbr_banners
SET br_imagen = :imagen
WHERE br_id = :id";
DBExecSql($conn, $sql, $params, OCI_DEFAULT);
}
else
unlink($fileOrigen);
}
}
示例4: subirArchivo
function subirArchivo($arch, $folder, $extensionesPermitidas, $maxFileSize, &$file, &$msgError) {
$tmpfile = $arch["tmp_name"];
$partes_ruta = pathinfo(strtolower($arch["name"]));
$filename = $arch["name"];
$ruta = $folder.$_POST["id"]."/";
$file = $ruta.$filename;
if (!makeDirectory($ruta)) {
$msgError = "ERROR: No se puede crear la carpeta.";
return false;
}
if (!in_array($partes_ruta["extension"], $extensionesPermitidas)) {
$msgError = "ERROR: El archivo debe tener alguna de las siguientes extensiones: ".implode(" o ", $extensionesPermitidas).".";
return false;
}
if (!is_uploaded_file($tmpfile)) {
$msgError = "ERROR: El archivo no subió correctamente.";
return false;
}
if (filesize($tmpfile) > $maxFileSize) {
$msgError = "ERROR: El archivo no puede ser mayor a ".tamanoArchivo($maxFileSize).".";
return false;
}
if (!move_uploaded_file($tmpfile, $file)) {
$msgError = "ERROR: El archivo no pudo ser guardado.";
return false;
}
return true;
}
示例5: __construct
public function __construct()
{
$this->dir = getSettingsPath() . "/httprpc";
if (!is_dir($this->dir)) {
makeDirectory($this->dir);
}
}
示例6: __construct
public function __construct($name = '')
{
$this->dir = getSettingsPath() . $name;
if (!is_dir($this->dir)) {
makeDirectory($this->dir);
}
}
示例7: gravaArquivos
function gravaArquivos($media_folder)
{
$media_path = realpath($_SERVER['DOCUMENT_ROOT']) . '\\files\\fotos\\' . $media_folder;
if (isset($_FILES)) {
ksort($_FILES);
if (!makeDirectory($media_path)) {
return 2;
}
//Não foi possível criar o diretório
$media_items = array();
foreach ($_FILES as $key => $media_file) {
$media_items[$key] = '';
if ($media_file['size'] > 0) {
$media_file_name = $_POST['os'] . '-' . $media_file['name'];
$media_items[$key] = $media_file_name;
$media_file_path = $media_path . '/' . $media_file_name;
if (!move_uploaded_file($media_file['tmp_name'], $media_file_path)) {
return 3;
}
//Não foi possível enviar o arquivo
} else {
return 0;
//Arquivo corrompido: 0 bytes
}
$indice++;
}
} else {
return 0;
//Sem arquivos para gravar
}
return 1;
//Arquivos gravados com sucesso
}
示例8: start
public static function start($commands, $flags = self::FLG_DEFAULT)
{
$taskNo = time();
$dir = self::formatPath($taskNo);
if (count($commands)) {
makeDirectory($dir);
if (($sh = fopen($dir . "/start.sh", "w")) !== false) {
fputs($sh, '#!/bin/sh' . "\n");
fputs($sh, 'dir="$(dirname $0)"' . "\n");
fputs($sh, 'echo $$ > "${dir}"/pid' . "\n");
fputs($sh, 'chmod a+rw "${dir}"/pid' . "\n");
file_put_contents($dir . "/flags", $flags);
@chmod($dir . "/flags", 0666);
fputs($sh, 'touch "${dir}"/status' . "\n");
fputs($sh, 'chmod a+rw "${dir}"/status' . "\n");
fputs($sh, 'touch "${dir}"/errors' . "\n");
fputs($sh, 'chmod a+rw "${dir}"/errors' . "\n");
fputs($sh, 'touch "${dir}"/log' . "\n");
fputs($sh, 'chmod a+rw "${dir}"/log' . "\n");
fputs($sh, 'last=0' . "\n");
$err = $flags & self::FLG_ONE_LOG ? "log" : "errors";
foreach ($commands as $ndx => $cmd) {
if ($cmd == '{') {
fputs($sh, 'if [ $last -eq 0 ] ; then ' . "\n");
} else {
if ($cmd == '}') {
fputs($sh, 'fi' . "\n");
} else {
if ($cmd[0] == '>') {
fputs($sh, 'echo "' . substr($cmd, 1) . '" >> "${dir}"/log' . "\n");
} else {
if ($flags & self::FLG_ECHO_CMD) {
fputs($sh, 'echo "' . $cmd . '" >> "${dir}"/log' . "\n");
}
if ($flags & self::FLG_NO_ERR) {
fputs($sh, $cmd . ' >> "${dir}"/log' . "\n");
} else {
fputs($sh, $cmd . ' 2>> "${dir}"/' . $err . ' >> "${dir}"/log' . "\n");
}
fputs($sh, 'if [ $? -ne 0 ] ; then ' . "\n\t" . 'last=1' . "\n" . 'fi' . "\n");
}
}
}
}
fputs($sh, 'echo $last > "${dir}"/status' . "\n");
fclose($sh);
@chmod($dir . "/start.sh", 0755);
if (!self::run($dir . "/start.sh", $flags)) {
if (!($flags & self::FLG_WAIT)) {
sleep(1);
}
return self::check($taskNo, $flags);
}
}
self::clean($dir);
}
return array("no" => $taskNo, "pid" => 0, "status" => 255, "log" => array(), "errors" => array("Can't start operation"));
}
示例9: makeDirectory
function makeDirectory($dir, $mode = 0755)
{
if (is_dir($dir) || @mkdir($dir, $mode)) {
return true;
}
if (!makeDirectory(dirname($dir), $mode)) {
return false;
}
return @mkdir($dir, $mode);
}
示例10: __construct
public function __construct()
{
$pathToDatabase = getSettingsPath() . '/peers.dat';
@makeDirectory(dirname($pathToDatabase));
$needCreate = !is_readable($pathToDatabase);
if ($this->handle = sqlite_open($pathToDatabase, 0666, $this->error)) {
if ($needCreate) {
sqlite_exec($this->handle, 'create table comments( ' . 'id integer primary key,' . 'ip text unique,' . 'comment text)', $this->error);
@chmod($pathToDatabase, 0666);
}
}
}
示例11: moverImagen
function moverImagen($img) {
global $conn;
if (($img != "") and ($img != "old")) {
$fileOrigen = IMAGES_EDICION_PATH.$img;
$partes_ruta = pathinfo($img);
$filename = $_POST["id"].".".$partes_ruta["extension"];
$fileDest = DATA_CELEBRACIONES_PATH.$filename;
if (!file_exists(DATA_CELEBRACIONES_PATH.$_POST["id"]))
makeDirectory(DATA_CELEBRACIONES_PATH.$_POST["id"]);
unlink($fileDest);
if (!rename($fileOrigen, $fileDest))
unlink($fileOrigen);
}
}
示例12: uploadFile
function uploadFile($arch, $folder, &$archPath) {
$tempfile = $arch["tmp_name"];
$partes_ruta = pathinfo($arch["name"]);
$uploadOk = false;
if (is_uploaded_file($tempfile)) {
if (!file_exists($folder))
makeDirectory($folder);
if (move_uploaded_file($tempfile, $folder.$partes_ruta['basename'])) {
$uploadOk = true;
$archPath = $partes_ruta["basename"];
}
}
return $uploadOk;
}
示例13: makeDirectory
public function makeDirectory()
{
$dir = self::formatPath($this->id);
makeDirectory($dir);
return $dir;
}
示例14: dirname
$name = dirname(__FILE__) . "/labels/" . $label . ".png";
if (is_readable($name)) {
sendFile($name, "image/png");
exit;
}
}
if (isset($_REQUEST["tracker"])) {
$tracker = rawurldecode($_REQUEST["tracker"]);
$name = dirname(__FILE__) . "/trackers/" . $tracker . ".png";
if (is_readable($name)) {
sendFile($name, "image/png");
exit;
}
$name = getSettingsPath() . '/trackers';
if (!is_dir($name)) {
makeDirectory($name);
}
$name .= '/';
if (strlen($tracker)) {
$name .= $tracker;
$name .= '.ico';
if (!is_readable($name)) {
$url = Snoopy::linkencode("http://" . $tracker . "/favicon.ico");
$client = new Snoopy();
@$client->fetchComplex($url);
if ($client->status == 200) {
file_put_contents($name, $client->results);
}
}
if (is_readable($name)) {
sendFile($name, "image/x-icon");
示例15: array
$settingsFlags = array("showDownloadsPage" => 0x1, "showConnectionPage" => 0x2, "showBittorentPage" => 0x4, "showAdvancedPage" => 0x8, "showPluginsTab" => 0x10, "canChangeULRate" => 0x20, "canChangeDLRate" => 0x40, "canChangeTorrentProperties" => 0x80, "canAddTorrentsWithoutPath" => 0x100, "canAddTorrentsWithoutStarting" => 0x200, "canAddTorrentsWithResume" => 0x400, "canAddTorrentsWithRandomizeHash" => 0x800);
$perms = 0;
foreach ($settingsFlags as $flagName => $flagVal) {
if (!array_key_exists($flagName, $permissions) || $permissions[$flagName]) {
$perms |= $flagVal;
}
}
$jResult .= "theWebUI.showFlags = " . $perms . ";\n";
$jResult .= "theURLs.XMLRPCMountPoint = '" . $XMLRPCMountPoint . "';\n";
$jResult .= "theWebUI.systemInfo = {};\ntheWebUI.systemInfo.php = { canHandleBigFiles : " . (PHP_INT_SIZE <= 4 ? "false" : "true") . " };\n";
if ($handle = opendir('../plugins')) {
ignore_user_abort(true);
set_time_limit(0);
$tmp = getTempDirectory();
if ($tmp != '/tmp/') {
makeDirectory($tmp);
}
if (!@file_exists($tempDirectory . '/.') || !is_readable($tempDirectory) || !is_writable($tempDirectory)) {
$jResult .= "noty(theUILang.badTempPath+' (" . $tempDirectory . ")','error');";
}
if (!function_exists('preg_match_all')) {
$jResult .= "noty(theUILang.PCRENotFound,'error');";
$jResult .= "theWebUI.systemInfo.rTorrent = { started: false, iVersion : 0, version : '?', libVersion : '?' };\n";
} else {
$remoteRequests = array();
$theSettings = rTorrentSettings::get(true);
if (!$theSettings->linkExist) {
$jResult .= "noty(theUILang.badLinkTorTorrent,'error');";
$jResult .= "theWebUI.systemInfo.rTorrent = { started: false, iVersion : 0, version : '?', libVersion : '?', apiVersion : 0 };\n";
} else {
if ($theSettings->idNotFound) {