本文整理汇总了PHP中dircopy函数的典型用法代码示例。如果您正苦于以下问题:PHP dircopy函数的具体用法?PHP dircopy怎么用?PHP dircopy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dircopy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processBlogSettingsForm
function processBlogSettingsForm()
{
global $manager;
$upload_path = $_POST['upload_path'];
$upload_url = "http://" . str_replace("http://", "", $_POST['upload_url']);
$old_uploadpath = $_POST['old_uploadpath'];
// Prepare path and url...
if (strrchr($upload_path, "/") != "/") {
$upload_path .= "/";
}
if (strrchr($upload_url, "/") != "/") {
$upload_url .= "/";
}
if ($upload_path != $old_uploadpath) {
// Need to move files then...
dircopy($old_uploadpath, $upload_path);
rmdirr($old_uploadpath);
}
$manager->clerk->updateSetting("blog_path", array($upload_path, $upload_url, ""));
$thumbWidth = empty($_POST['thumbWidth']) ? 0 : $_POST['thumbWidth'];
$thumbHeight = empty($_POST['thumbHeight']) ? 0 : $_POST['thumbHeight'];
$intelliScaling = $_POST['intelligentScaling'];
$manager->clerk->updateSetting("blog_thumbnail", array($thumbWidth, $thumbHeight, ""));
$manager->clerk->updateSetting("blog_intelliscaling", array($intelliScaling, "", ""));
$manager->message(1, false, "Settings updated!");
}
示例2: dircopy
function dircopy($path, $dest)
{
if (is_dir($path)) {
@mkdir($dest);
$objects = scandir($path);
if (sizeof($objects) > 0) {
foreach ($objects as $file) {
if ($file == "." || $file == "..") {
continue;
}
// go on
if (is_dir($path . DS . $file)) {
dircopy($path . DS . $file, $dest . DS . $file);
} else {
copy($path . DS . $file, $dest . DS . $file);
}
}
}
return true;
} elseif (is_file($path)) {
return copy($path, $dest);
} else {
return false;
}
}
示例3: index
/**
* This method is called via AJAX
*/
function index($database, $code_template)
{
$data_path = array();
$data_path['code_template'] = $code_template;
$data_path['app_dir'] = $database;
$this->idb->connect($database);
$manifest = json_decode(file_get_contents('templates' . DS . $code_template . DS . 'manifest.json'), TRUE);
$path_output = $manifest['output_directory'] . DS . $database;
// Load the folder model
$this->load->model('folder_model');
// Get the folder permissions
$folder_info = $this->folder_model->check_permissions($manifest['output_directory']);
// Validate the folder permissions
if ($folder_info['is_writeable'] == true) {
$tables = $this->db->list_tables();
$path_templates = 'templates';
/**
* Create input / output paths for the model_iscaffold.
*/
foreach ($manifest['working_directories'] as $dir) {
if (is_array($dir)) {
list($source, $target) = $dir;
$data_path['input_' . $dir[0]] = $path_templates . DS . $code_template . DS . $manifest['working_root_directory'] . DS . $source . DS;
$data_path['output_' . $dir[0]] = $path_output . DS . $manifest['working_root_directory'] . DS . $target . DS;
} else {
$data_path['input_' . $dir] = $path_templates . DS . $code_template . DS . $manifest['working_root_directory'] . DS . $dir . DS;
$data_path['output_' . $dir] = $path_output . DS . $manifest['working_root_directory'] . DS . $dir . DS;
}
}
/**
* Nuke the output directory if neccessery
*/
if ($manifest['dump_output_directory'] === TRUE) {
delete_files($path_output, TRUE);
}
@mkdir($path_output, 0777);
/**
* Copdy additional resources
*/
foreach ($manifest['copy_directories'] as $dir) {
dircopy($dir, $path_output);
}
/**
* This is wehere the code generation is invoked
* Each table is processed here
*/
foreach ($tables as $table) {
if ($table !== 'sf_config') {
$this->model_iscaffold->Process_Table($table, $data_path, $code_template, $manifest);
}
}
echo '{ "result": "success" }';
} else {
echo '{ "result": "error", "message": "There was a problem generating your application, ther output directory <strong>(' . $manifest['output_directory'] . ')</strong> is not writable." }';
}
}
示例4: processPrefsForm
function processPrefsForm()
{
global $manager;
$username = $_POST['username'];
$name = $_POST['display_name'];
$password = $_POST['password'];
$passwordConf = $_POST['password_conf'];
$email = $_POST['email'];
$siteName = $_POST['site_name'];
$siteUrl = $_POST['site_url'];
$cleanUrls = $_POST['clean_urls'];
$cache_path = $_POST['cache_path'];
$cache_url = $_POST['cache_url'];
$old_cache_path = $_POST['old_cache_path'];
// User wants to change their password
if (!empty($_POST['password']) && !empty($_POST['password_conf'])) {
if ($_POST['password'] != $_POST['password_conf']) {
$manager->message(0, false, "Password do not match! Please re-confirm.");
} elseif (strlen($_POST['password']) < 6 || strlen($_POST['password_conf']) < 6) {
$manager->message(0, false, "Password must be at least 6 characters long!");
} else {
//hash password securely
if ($manager->clerk->query_edit("users", "password= '" . password_hash($password, PASSWORD_DEFAULT) . "'", "WHERE id= '" . $manager->guard->user('USER_ID') . "'")) {
$manager->message(1, false, "Password changed!");
} else {
$manager->message(0, true, "Could not save your Settings!");
}
}
}
$personal = $manager->clerk->query_edit("users", "username= '{$username}', display_name= '{$name}', email= '{$email}'", "WHERE id= '" . $manager->guard->user('USER_ID') . "'");
$manager->clerk->updateSetting("site", array($siteName, $siteUrl));
if (strrchr($cache_path, "/") != "/") {
$cache_path .= "/";
}
if (strrchr($cache_url, "/") != "/") {
$cache_url .= "/";
}
if ($cache_path != $old_cache_path) {
// Need to move files then...
dircopy($old_cache_path, $cache_path);
rmdirr($old_cache_path);
}
$manager->clerk->updateSetting("clean_urls", array($cleanUrls));
$manager->clerk->updateSetting("cache_path", array($cache_path, $cache_url));
if ($personal) {
$manager->message(1, false, "Settings saved!");
} else {
$manager->message(0, true, "Could not save your Settings!");
}
}
示例5: processProjectSettingsForm
function processProjectSettingsForm()
{
global $manager;
$upload_path = $_POST['upload_path'];
$upload_url = "http://" . str_replace("http://", "", $_POST['upload_url']);
$old_uploadpath = $_POST['old_uploadpath'];
// Prepare path and url...
if (strrchr($upload_path, "/") != "/") {
$upload_path .= "/";
}
if (strrchr($upload_url, "/") != "/") {
$upload_url .= "/";
}
if ($upload_path != $old_uploadpath) {
// Need to move files then...
dircopy($old_uploadpath, $upload_path);
rmdirr($old_uploadpath);
}
$manager->clerk->updateSetting("projects_path", array($upload_path, $upload_url, ""));
$projThumbWidth = empty($_POST['projThumbWidth']) ? 0 : $_POST['projThumbWidth'];
$projThumbHeight = empty($_POST['projThumbHeight']) ? 0 : $_POST['projThumbHeight'];
$fileThumbWidth = empty($_POST['fileThumbWidth']) ? 0 : $_POST['fileThumbWidth'];
$fileThumbHeight = empty($_POST['fileThumbHeight']) ? 0 : $_POST['fileThumbHeight'];
$intelliScaling = empty($_POST['image_intelligentScaling']) ? 0 : $_POST['image_intelligentScaling'];
$hideSections = (int) $_POST['hideSections'];
$hideFileInfo = (int) $_POST['hideFileInfo'];
$resizeProjThumb = (int) $_POST['resizeProjThumb'];
$manager->clerk->updateSetting("projects_thumbnailIntelliScaling", array($_POST['projects_thumbnailIntelliScaling']));
$manager->clerk->updateSetting("projects_fullsizeimg", array($_POST['fullsizeimg_width'] . "x" . $_POST['fullsizeimg_height'], $_POST['fullsizeimg_intelli'], $_POST['fullsizeimg_do_scale']));
$nav_opts = serialize(array('prev' => $_POST['prev'], 'divider' => $_POST['divider'], 'next' => $_POST['next'], 'of' => $_POST['of'], 'nav_pos' => $_POST['slideshow_nav_pos'], 'fx' => $_POST['slideshow_fx']));
$manager->clerk->updateSetting("slideshow_opts", array($nav_opts));
$updates = array('projThumb' => array("data1= '{$projThumbWidth}', data2= '{$projThumbHeight}'", "WHERE name= 'projects_thumbnail'"), 'fileThumb' => array("data1= '{$fileThumbWidth}', data2= '{$fileThumbHeight}'", "WHERE name= 'projects_filethumbnail'"), 'projects_intelliscaling' => array("data1= '{$intelliScaling}'", "WHERE name= 'projects_intelliscaling'"), 'hideSections' => array("data1= '{$hideSections}'", "WHERE name= 'projects_hideSections'"), 'hideFileInfo' => array("data1= '{$hideFileInfo}'", "WHERE name= 'projects_hideFileInfo'"), 'resizeProjThumb' => array("data1= '{$resizeProjThumb}'", "WHERE name= 'resizeProjThumb'"));
$ok = true;
foreach ($updates as $update) {
if (!$manager->clerk->query_edit("global_settings", $update[0], $update[1])) {
$ok = false;
}
}
if ($ok) {
$manager->message(1, false, "Settings updated!");
} else {
$manager->message(0, true, "Could not update all settings!");
}
}
示例6: dircopy
function dircopy($source, $target)
{
$permissions = fileperms($source);
if (is_dir($source)) {
@mkdir($target);
$d = dir($source);
while (FALSE !== ($entry = $d->read())) {
if ($entry == '.' || $entry == '..') {
continue;
}
$Entry = $source . '/' . $entry;
if (is_dir($Entry)) {
dircopy($Entry, $target . '/' . $entry);
continue;
}
copy($Entry, $target . '/' . $entry);
chmod($target . '/' . $entry, $permissions);
}
$d->close();
} else {
copy($source, $target);
}
chmod($target, $permissions);
}
示例7: dircopy
/**
* Copy a complete directory
*
* @param string $srcdir Source directory
* @param string $dstdir Destination directory
* @return int Number of copied files
*/
function dircopy($srcdir, $dstdir, $verbose = false)
{
$num = 0;
if (!is_dir($dstdir) && !shouldIgnore($dstdir)) {
mkdir($dstdir);
}
if ($curdir = opendir($srcdir)) {
while ($file = readdir($curdir)) {
if ($file != '.' && $file != '..') {
$srcfile = $srcdir . '\\' . $file;
$dstfile = $dstdir . '\\' . $file;
if (is_file($srcfile) && !shouldIgnore($srcfile)) {
if (is_file($dstfile)) {
$ow = filemtime($srcfile) - filemtime($dstfile);
} else {
$ow = 1;
}
if ($ow > 0) {
if ($verbose) {
echo "Copying '{$srcfile}' to '{$dstfile}'...";
}
if (copy($srcfile, $dstfile)) {
touch($dstfile, filemtime($srcfile));
$num++;
if ($verbose) {
echo "OK\n";
}
} else {
echo "Error: File '{$srcfile}' could not be copied!\n";
}
}
} else {
if (is_dir($srcfile) && !shouldIgnore($srcfile)) {
$num += dircopy($srcfile, $dstfile, $verbose);
}
}
}
}
closedir($curdir);
}
return $num;
}
示例8: explode
$returnText .= '<h2>Gestione Package di "' . $collection_short . '"</h2>';
//
// CREATE PACKAGE
if ($isCreatePackage) {
if ($package_short != '') {
if (!in_array($package_ext, $EXTENSION_PACKAGE)) {
$resultMsg .= '<span class="error">ERRORE: estensione "' . $package_ext . '" non riconosciuta!</span><br />';
} else {
$package_short = explode('_', $package_short);
$package_short = strtoupper($package_short[0] . $package_ext);
getPackageList($collectionPath, &$packageList, true);
$package_id = strtolower(normalize($package_short));
if (array_search($package_id, $packageList['package_id']) === FALSE) {
$packageTemplate = DCTL_SETTINGS_TEMPLATES_PACKAGE;
$packagePath = $collectionPath . $package_id . SYS_PATH_SEP;
dircopy($packageTemplate, $packagePath);
$idx = 0;
$idx = sprintf("%03d", $idx + 1);
$from = $packagePath . DCTL_PACKAGE_BODY;
$to = $packagePath . str_ireplace('$', $idx, DCTL_PACKAGE_BODY);
rename($from, $to);
$header = $packagePath . DCTL_FILE_HEADER;
if (is_file($header)) {
$contents = cleanUpIndentation(file_get_contents($header));
$contents = str_ireplace('package_id ""', 'package_id "' . $package_id . '"', $contents);
$contents = str_ireplace('package_short ""', 'package_short "' . $package_short . '"', $contents);
if (file_put_contents($header, forceUTF8($contents, $header)) !== FALSE) {
@chmod($header, CHMOD);
getPackageList($collectionPath, &$packageList, true);
$prosecute = array_search($package_short, $packageList['package_short']) !== FALSE;
if ($prosecute) {
示例9: dircopy
function dircopy($srcdir, $dstdir, &$files = array())
{
if (!is_dir($dstdir)) {
mkdir($dstdir, CHMOD);
}
@chmod($dstdir, CHMOD);
$handle = opendir($srcdir);
while ($entry = readdir($handle)) {
if (substr($entry, 0, 1) != '.') {
$fullsrc = $srcdir . SYS_PATH_SEP . $entry;
$fulldst = $dstdir . SYS_PATH_SEP . $entry;
if (is_dir($fullsrc)) {
if (!is_dir($fulldst)) {
mkdir($fulldst, CHMOD);
}
@chmod($fulldst, CHMOD);
dircopy($fullsrc, $fulldst, &$files);
} else {
if (is_file($fullsrc)) {
copy($fullsrc, $fulldst);
@chmod($fulldst, CHMOD);
}
$files[] = $entry;
}
}
}
@chmod($dstdir, CHMOD);
}
示例10: OpenLibrary
<?php
OpenLibrary('misc.library');
dircopy($this->basedir . '/var/adodb/', MODULE_PATH . 'adodb/adodb/');
示例11: foreach
if ($_POST['demo_install'] == 'true') {
$zc_install->fileExists('sql/current/demo_data.php', ERROR_TEXT_DEMO_SQL_NOTEXIST, ERROR_CODE_DEMO_SQL_NOTEXIST);
}
if ($zc_install->error == false) {
if ($_POST['demo_install'] == 'true') {
require 'sql/current/demo_data.php';
foreach ($extra_sqls as $extra_sql) {
if (!$db->Execute($extra_sql)) {
$zc_install->error = true;
}
}
// db_executeSql('sql/current/demo_data.sql', DB_DATABASE, DB_PREFIX);
// copy the demo image files to company directory
$source_dir = DIR_FS_ADMIN . 'themes/default/images/demo';
$dest_dir = DIR_FS_ADMIN . 'my_files/' . $_SESSION['company'] . '/inventory/images/demo';
dircopy($source_dir, $dest_dir);
}
$db->updateConfigureValue('COMPANY_ID', $store_id);
$db->updateConfigureValue('COMPANY_NAME', $store_name);
$db->updateConfigureValue('COMPANY_ADDRESS1', $store_address1);
$db->updateConfigureValue('COMPANY_ADDRESS2', $store_address2);
$db->updateConfigureValue('COMPANY_CITY_TOWN', $store_city_town);
$db->updateConfigureValue('COMPANY_ZONE', $store_zone);
$db->updateConfigureValue('COMPANY_POSTAL_CODE', $store_postal_code);
$db->updateConfigureValue('COMPANY_COUNTRY', $store_country);
$db->updateConfigureValue('COMPANY_EMAIL', $store_email);
$db->updateConfigureValue('COMPANY_WEBSITE', $store_website);
$db->updateConfigureValue('COMPANY_TELEPHONE1', $store_telephone1);
$db->updateConfigureValue('COMPANY_TELEPHONE2', $store_telephone2);
$db->updateConfigureValue('COMPANY_FAX', $store_fax);
$db->updateConfigureValue('DEFAULT_CURRENCY', $store_default_currency);
示例12: die
global $flutter_domain;
if (!(is_user_logged_in() && current_user_can(FLUTTER_CAPABILITY_MODULES))) {
die(__('Athentication failed!', $flutter_domain));
}
require_once 'RCCWP_CustomWriteModule.php';
require_once 'RCCWP_CustomWritePanel.php';
require_once 'RCCWP_Application.php';
require_once 'RCCWP_CustomWritePanel.php';
$moduleID = (int) $_REQUEST['custom-write-module-id'];
$module = RCCWP_CustomWriteModule::Get($moduleID);
if (isset($_POST["write_panels"])) {
//$write_panels = json_decode(stripslashes($_POST["write_panels"]));
$modulePath = FLUTTER_MODULES_DIR . $module->name . DIRECTORY_SEPARATOR;
$tmpPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR;
// Copy dir to tmp folder
dircopy($modulePath, $tmpPath . $module->name);
$moduleTmpPath = "{$tmpPath}{$module->name}";
chmod_R($moduleTmpPath, 0777);
// Export write panels
//check if arrary the write modules is empty
if ($_POST["write_panels"] != NULL) {
$write_panels = split(",", $_POST["write_panels"]);
foreach ($write_panels as $panelID) {
$writePanel = RCCWP_CustomWritePanel::Get($panelID);
$exportedFilename = $moduleTmpPath . DIRECTORY_SEPARATOR . '_' . $writePanel->name . '.pnl';
RCCWP_CustomWritePanel::Export($panelID, $exportedFilename);
}
}
// Export duplicates and description
$moduleInfoFilename = $moduleTmpPath . DIRECTORY_SEPARATOR . 'module_info.exp';
$moduleInfo_exported_data['duplicates'] = RCCWP_ModuleDuplicate::GetCustomModulesDuplicates($moduleID);
示例13: dircopy
function dircopy($srcdir, $dstdir, $verbose = false)
{
$num = 0;
if (!is_dir($dstdir)) {
mkdir($dstdir);
}
if ($curdir = opendir($srcdir)) {
while ($file = readdir($curdir)) {
if ($file != '.' && $file != '..') {
$srcfile = $srcdir . DS . $file;
$dstfile = $dstdir . DS . $file;
if (is_file($srcfile)) {
if (is_file($dstfile)) {
$ow = filemtime($srcfile) - filemtime($dstfile);
} else {
$ow = 1;
}
if ($ow > 0) {
if ($verbose) {
$tmpstr = _KUNENA_COPY_FILE;
$tmpstr = str_replace('%src%', $srcfile, $tmpstr);
$tmpstr = str_replace('%dst%', $dstfile, $tmpstr);
echo $tmpstr;
}
if (copy($srcfile, $dstfile)) {
touch($dstfile, filemtime($srcfile));
$num++;
if ($verbose) {
echo _KUNENA_COPY_OK;
}
} else {
echo "" . _KUNENA_DIRCOPERR . " '{$srcfile}' " . _KUNENA_DIRCOPERR1 . "";
}
}
} else {
if (is_dir($srcfile)) {
$num += dircopy($srcfile, $dstfile, $verbose);
}
}
}
}
closedir($curdir);
}
return $num;
}
示例14: OpenLibrary
<?php
OpenLibrary('misc.library');
recremovedir(CGI_PATH . 'htmlarea/');
dircopy($this->basedir . '/www/cgi/htmlarea/', CGI_PATH . 'htmlarea/');
示例15: copyAlbum
/**
* Copy this album to the location specified by $newfolder, copying all
* metadata, subalbums, and subalbums' metadata with it.
* @param $newfolder string the folder to copy to, including the name of the current folder (possibly renamed).
* @return boolean true on success and false on failure.
*
*/
function copyAlbum($newfolder)
{
// First, ensure the new base directory exists.
$oldfolder = $this->name;
$dest = getAlbumFolder() . '/' . UTF8ToFilesystem($newfolder);
// Check to see if the destination directory already exists
if (file_exists($dest)) {
// Disallow moving an album over an existing one.
return false;
}
if (substr($newfolder, count($oldfolder)) == $oldfolder) {
// Disallow copying to a subfolder of the current folder (infinite loop).
return false;
}
if ($this->isDynamic()) {
if (@copy($this->localpath, $dest)) {
$oldf = mysql_real_escape_string($oldfolder);
$sql = "SELECT * FROM " . prefix('albums') . " WHERE `id` = '" . $this->getAlbumID() . "'";
$subrow = query_single_row($sql);
$success = $this->replicateDBRow($subrow, $oldfolder, $newfolder, true);
return $success;
} else {
return false;
}
} else {
if (mkdir_recursive(dirname($dest)) === TRUE) {
// Make the move (rename).
$num = dircopy($this->localpath, $dest);
// Get the subalbums.
$oldf = mysql_real_escape_string($oldfolder);
$sql = "SELECT * FROM " . prefix('albums') . " WHERE folder LIKE '{$oldf}%'";
$result = query_full_array($sql);
$allsuccess = true;
foreach ($result as $subrow) {
$success = $this->replicateDBRow($subrow, $oldfolder, $newfolder, $subrow['folder'] == $oldfolder);
if (!($success == true && mysql_affected_rows() == 1)) {
$allsuccess = false;
}
}
return $allsuccess;
}
}
return false;
}