当前位置: 首页>>代码示例>>PHP>>正文


PHP copy_file函数代码示例

本文整理汇总了PHP中copy_file函数的典型用法代码示例。如果您正苦于以下问题:PHP copy_file函数的具体用法?PHP copy_file怎么用?PHP copy_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了copy_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: moveAttachment

function moveAttachment($row, $db, $from_prefix, $attachmentUploadDir)
{
    static $smf_folders = null;
    if ($smf_folders === null) {
        $request = $db->query("\n\t\t\tSELECT value\n\t\t\tFROM {$from_prefix}settings\n\t\t\tWHERE variable='attachmentUploadDir';");
        list($smf_attachments_dir) = $db->fetch_row($request);
        $smf_folders = @unserialize($smf_attachments_dir);
        if (!is_array($smf_folders)) {
            $smf_folders = array(1 => $smf_attachments_dir);
        }
    }
    $smf_attachments_dir = $smf_folders[$row['id_folder']];
    if (empty($row['file_hash'])) {
        $row['file_hash'] = createAttachmentFileHash($row['filename']);
        $source_file = $row['filename'];
    } else {
        $source_file = $row['id_attach'] . '_' . $row['file_hash'];
    }
    copy_file($smf_attachments_dir . '/' . $source_file, $attachmentUploadDir . '/' . $row['id_attach'] . '_' . $row['file_hash'] . '.elk');
}
开发者ID:kddlb,项目名称:openimporter,代码行数:20,代码来源:smf2-0_importer.php

示例2: msgOK

}
# create default 404.xml page
$init = GSDATAOTHERPATH . GSHTTPPREFIX . '404.xml';
$temp = GSADMININCPATH . 'tmp/tmp-404.xml';
if (!file_exists($init)) {
    if (copy_file($temp, $init)) {
        $message .= msgOK(sprintf(i18n_r('COPY_SUCCESS'), 'tmp/404.xml'));
    } else {
        $message .= msgError(sprintf(i18n_r('COPY_FAILURE'), 'tmp/404.xml'));
    }
}
# create default 403.xml page
$init = GSDATAOTHERPATH . GSHTTPPREFIX . '403.xml';
$temp = GSADMININCPATH . 'tmp/tmp-403.xml';
if (!file_exists($init)) {
    if (copy_file($temp, $init)) {
        $message .= msgOK(sprintf(i18n_r('COPY_SUCCESS'), 'tmp/403.xml'));
    } else {
        $message .= msgError(sprintf(i18n_r('COPY_FAILURE'), 'tmp/403.xml'));
    }
}
/* create new folders */
foreach ($create_dirs as $dir) {
    if (!file_exists($dir)) {
        if (getDef('GSCHMOD')) {
            $chmod_value = GSCHMOD;
        } else {
            $chmod_value = 0755;
        }
        $status = create_dir($dir, $chmod_value);
        if ($status) {
开发者ID:HelgeSverre,项目名称:GetSimpleCMS,代码行数:31,代码来源:update.php

示例3: rename_file

/**
 * Rename a file (overwrites existing)
 * renames a file, moving between dirs if necessary
 *
 * @since  3.4
 *
 * @param  str  $src  filepath to rename
 * @param  str  $dest filepath destination
 * @param  str $filename optional filename will be appended to src and destf
 * @return bool           success
 */
function rename_file($src, $dest, $filename = null)
{
    if (isset($filename)) {
        $src .= DIRECTORY_SEPARATOR . $filename;
        $dest .= DIRECTORY_SEPARATOR . $filename;
    }
    if (!($status = rename($src, $dest))) {
        // php rename
        fileLog(__FUNCTION__, false, 'calling copy_file & delete_file');
        $status = copy_file($src, $dest) && delete_file($src);
        return $status;
    }
    return fileLog(__FUNCTION__, $status, $src, $dest);
}
开发者ID:kix23,项目名称:GetSimpleCMS,代码行数:25,代码来源:basic.php

示例4: phpbb_import_avatar

/**
 * Import user's avatar
 *
 * @param integer User ID (from b2evo)
 * @param string Path avatars
 * @param string File name of user's avatar
 */
function phpbb_import_avatar($user_ID, $path_avatars, $user_avatar)
{
    global $DB, $tableprefix;
    if (!empty($user_avatar) && file_exists($path_avatars . $user_avatar)) {
        // Import user's avatar
        $FileRootCache =& get_FileRootCache();
        $root_ID = FileRoot::gen_ID('user', $user_ID);
        $imported_file_ID = copy_file($path_avatars . $user_avatar, $root_ID, 'profile_pictures', false);
        if (!empty($imported_file_ID)) {
            // Update user's avatar
            mysql_query('UPDATE ' . $tableprefix . 'users
					  SET user_avatar_file_ID = ' . $DB->quote($imported_file_ID) . '
					WHERE user_ID = ' . $DB->quote($user_ID) . '
					  AND user_avatar_file_ID IS NULL', $DB->dbhandle);
        }
    }
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:24,代码来源:_phpbb.funcs.php

示例5: copy

 $init = GSDATAOTHERPATH . '404.xml';
 $temp = GSADMININCPATH . 'tmp/tmp-404.xml';
 if (!file_exists($init)) {
     copy($temp, $init);
 }
 # create default 404.xml page
 $init = GSDATAOTHERPATH . '403.xml';
 $temp = GSADMININCPATH . 'tmp/tmp-403.xml';
 if (!file_exists($init)) {
     copy($temp, $init);
 }
 # create default components.xml page if not exist
 $init = GSDATAOTHERPATH . 'components.xml';
 $temp = GSADMININCPATH . 'tmp/tmp-components.xml';
 if (!file_exists($init)) {
     copy_file($temp, $init);
 }
 # create root .htaccess file if it does not exist
 # remove temp, verify and throw errors
 $temp = GSROOTPATH . 'temp.htaccess';
 $init = GSROOTPATH . '.htaccess';
 if (file_exists($temp) && !file_exists($init)) {
     // open temp htaccess and replace the root holder and save as new file
     $temp_data = read_file(GSROOTPATH . 'temp.htaccess');
     $temp_data = str_replace('**REPLACE**', tsl($path_parts), $temp_data);
     save_file($init, $temp_data);
     if (!file_exists($init)) {
         $err .= sprintf(i18n_r('ROOT_HTACCESS_ERROR'), 'temp.htaccess', '**REPLACE**', tsl($path_parts)) . '<br />';
     } else {
         if (file_exists($temp)) {
             delete_file($temp);
开发者ID:kix23,项目名称:GetSimpleCMS,代码行数:31,代码来源:setup.php

示例6: main_upgrade


//.........这里部分代码省略.........
            }
        }
    }
    if ($oldversion < 2006022301) {
        // This handles upgrades from _files/data to $CFG->dataroot too...
        // Alter file repository to remove path information
        echo "<h2>" . gettext("Adjusting file repository information") . "</h2>";
        // Get all files with path in the location
        $tostrip = $CFG->dirroot . '_files/data/';
        if ($files = get_records_select('files', 'location LIKE ?', array($tostrip . '%'))) {
            foreach ($files as $file) {
                $ident = $file->ident;
                $filename = str_replace($tostrip, "files/", $file->location);
                set_field('files', 'location', $filename, 'ident', $ident);
                echo "<p>" . sprintf(gettext("Updating file %d: %s"), $ident, $filename) . "</p>";
            }
        }
        // Get all files that start with _files
        $tostrip = '_files/data/';
        if ($files = get_records_select('files', 'location LIKE ?', array($tostrip . '%'))) {
            foreach ($files as $file) {
                $ident = $file->ident;
                $filename = str_replace($tostrip, "files/", $file->location);
                set_field('files', 'location', $filename, 'ident', $ident);
                echo "<p>" . sprintf(gettext("Updating file %d: %s"), $ident, $filename) . "</p>";
            }
        }
        // copy the files across.
        if ($dir = opendir($CFG->dirroot . '_files/data/')) {
            while ($file = readdir($dir)) {
                if ($file == "." || $file == ".." || $file == '.htaccess') {
                    continue;
                }
                copy_file($CFG->dirroot . "_files/data/{$file}", $CFG->dataroot . "files/{$file}");
            }
        }
        // now the profile images.. this is harder.
        if ($icons = get_records_sql("SELECT i.*,u.username FROM {$CFG->prefix}icons i JOIN {$CFG->prefix}users u ON i.owner = u.ident")) {
            foreach ($icons as $icon) {
                $upload_folder = $textlib->substr($icon->username, 0, 1);
                $fromfile = $CFG->dirroot . '_icons/data/' . $icon->filename;
                $tofile = $CFG->dataroot . 'icons/' . $upload_folder . '/' . $icon->username . '/' . $icon->filename;
                copy_file($fromfile, $tofile);
            }
        }
    }
    if ($oldversion < 2006052100) {
        // add some missing indexes
        modify_database('', 'CREATE INDEX {$CFG->prefix}tags_access_idx ON {$CFG->prefix}tags (access)');
    }
    if ($oldversion < 2006052200) {
        // homogenise access field, shortest one was vc16, longest vc255
        table_column('file_folders', 'access', 'access', 'varchar', 20, '', 'PUBLIC');
        table_column('files', 'access', 'access', 'varchar', 20, '', 'PUBLIC');
        table_column('groups', 'access', 'access', 'varchar', 20, '', 'PUBLIC');
        table_column('profile_data', 'access', 'access', 'varchar', 20, '', 'PUBLIC');
        table_column('tags', 'access', 'access', 'varchar', 20, '', 'PUBLIC');
        table_column('weblog_posts', 'access', 'access', 'varchar', 20, '', 'PUBLIC');
    }
    if ($oldversion < 2006052300) {
        // shorten another keyword field
        table_column('tags', 'tagtype', 'tagtype', 'varchar', 20);
    }
    if ($oldversion < 2006052400) {
        // purge owner=0 watchlist entries from watchlist-on-comment bug
        delete_records('weblog_watchlist', 'owner', 0);
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:67,代码来源:postgres7.php

示例7: set_forumDB

 /**
  * MYSQL update and save forum
  */
 private function set_forumDB()
 {
     global $aidlink;
     // Save_permission
     if (isset($_POST['save_permission'])) {
         $this->data['forum_id'] = form_sanitizer($_POST['forum_id'], '', 'forum_id');
         $this->data = self::get_forum($this->data['forum_id']);
         if (!empty($this->data)) {
             $this->data['forum_access'] = form_sanitizer($_POST['forum_access'], USER_LEVEL_PUBLIC, 'forum_access');
             $this->data['forum_post'] = form_sanitizer($_POST['forum_post'], USER_LEVEL_MEMBER, 'forum_post');
             $this->data['forum_reply'] = form_sanitizer($_POST['forum_reply'], USER_LEVEL_MEMBER, 'forum_reply');
             $this->data['forum_post_ratings'] = form_sanitizer($_POST['forum_post_ratings'], USER_LEVEL_MEMBER, 'forum_post_ratings');
             $this->data['forum_poll'] = form_sanitizer($_POST['forum_poll'], USER_LEVEL_MEMBER, 'forum_poll');
             $this->data['forum_vote'] = form_sanitizer($_POST['forum_vote'], USER_LEVEL_MEMBER, 'forum_vote');
             $this->data['forum_answer_threshold'] = form_sanitizer($_POST['forum_answer_threshold'], 0, 'forum_answer_threshold');
             $this->data['forum_attach'] = form_sanitizer($_POST['forum_attach'], USER_LEVEL_MEMBER, 'forum_attach');
             $this->data['forum_attach_download'] = form_sanitizer($_POST['forum_attach_download'], USER_LEVEL_PUBLIC, 'forum_attach_download');
             $this->data['forum_mods'] = isset($_POST['forum_mods']) ? form_sanitizer($_POST['forum_mods'], '', 'forum_mods') : "";
             dbquery_insert(DB_FORUMS, $this->data, 'update');
             addnotice('success', self::$locale['forum_notice_10']);
             if (\defender::safe()) {
                 redirect(FUSION_SELF . $aidlink . $this->ext);
             }
         }
     }
     if (isset($_POST['save_forum'])) {
         $this->data = array('forum_id' => form_sanitizer($_POST['forum_id'], 0, 'forum_id'), 'forum_name' => form_sanitizer($_POST['forum_name'], '', 'forum_name'), 'forum_description' => form_sanitizer($_POST['forum_description'], '', 'forum_description'), 'forum_cat' => form_sanitizer($_POST['forum_cat'], 0, 'forum_cat'), 'forum_type' => form_sanitizer($_POST['forum_type'], '', 'forum_type'), 'forum_language' => form_sanitizer($_POST['forum_language'], '', 'forum_language'), 'forum_alias' => form_sanitizer($_POST['forum_alias'], '', 'forum_alias'), 'forum_meta' => form_sanitizer($_POST['forum_meta'], '', 'forum_meta'), 'forum_rules' => form_sanitizer($_POST['forum_rules'], '', 'forum_rules'), 'forum_image_enable' => isset($_POST['forum_image_enable']) ? 1 : 0, 'forum_merge' => isset($_POST['forum_merge']) ? 1 : 0, 'forum_allow_attach' => isset($_POST['forum_allow_attach']) ? 1 : 0, 'forum_quick_edit' => isset($_POST['forum_quick_edit']) ? 1 : 0, 'forum_allow_poll' => isset($_POST['forum_allow_poll']) ? 1 : 0, 'forum_poll' => USER_LEVEL_MEMBER, 'forum_users' => isset($_POST['forum_users']) ? 1 : 0, 'forum_lock' => isset($_POST['forum_lock']) ? 1 : 0, 'forum_permissions' => isset($_POST['forum_permissions']) ? form_sanitizer($_POST['forum_permissions'], 0, 'forum_permissions') : 0, 'forum_order' => isset($_POST['forum_order']) ? form_sanitizer($_POST['forum_order']) : '', 'forum_branch' => get_hkey(DB_FORUMS, 'forum_id', 'forum_cat', $this->data['forum_cat']), 'forum_image' => '', 'forum_mods' => "");
         $this->data['forum_alias'] = $this->data['forum_alias'] ? str_replace(' ', '-', $this->data['forum_alias']) : '';
         // Checks for unique forum alias
         if ($this->data['forum_alias']) {
             if ($this->data['forum_id']) {
                 $alias_check = dbcount("('alias_id')", DB_PERMALINK_ALIAS, "alias_url='" . $this->data['forum_alias'] . "' AND alias_item_id !='" . $this->data['forum_id'] . "'");
             } else {
                 $alias_check = dbcount("('alias_id')", DB_PERMALINK_ALIAS, "alias_url='" . $this->data['forum_alias'] . "'");
             }
             if ($alias_check) {
                 \defender::stop();
                 addNotice('warning', self::$locale['forum_error_6']);
             }
         }
         // check forum name unique
         $this->data['forum_name'] = $this->check_validForumName($this->data['forum_name'], $this->data['forum_id']);
         // Uploads or copy forum image or use back the forum image existing
         if (!empty($_FILES) && is_uploaded_file($_FILES['forum_image']['tmp_name'])) {
             $upload = form_sanitizer($_FILES['forum_image'], '', 'forum_image');
             if ($upload['error'] == 0) {
                 if (!empty($upload['thumb1_name'])) {
                     $this->data['forum_image'] = $upload['thumb1_name'];
                 } else {
                     $this->data['forum_image'] = $upload['image_name'];
                 }
             }
         } elseif (isset($_POST['forum_image_url']) && $_POST['forum_image_url'] != "") {
             require_once INCLUDES . "photo_functions_include.php";
             // if forum_image_header is not empty
             $type_opts = array('0' => BASEDIR, '1' => '');
             // the url
             $this->data['forum_image'] = $type_opts[intval($_POST['forum_image_header'])] . form_sanitizer($_POST['forum_image_url'], '', 'forum_image_url');
             $upload = copy_file($this->data['forum_image'], FORUM . "images/");
             if ($upload['error'] == TRUE) {
                 \defender::stop();
                 addNotice('danger', self::$locale['forum_error_9']);
             } else {
                 $this->data['forum_image'] = $upload['name'];
             }
         } else {
             $this->data['forum_image'] = isset($_POST['forum_image']) ? form_sanitizer($_POST['forum_image'], '', 'forum_image') : "";
         }
         if (!$this->data['forum_id']) {
             $this->data += array('forum_access' => USER_LEVEL_PUBLIC, 'forum_post' => USER_LEVEL_MEMBER, 'forum_reply' => USER_LEVEL_MEMBER, 'forum_post_ratings' => USER_LEVEL_MEMBER, 'forum_poll' => USER_LEVEL_MEMBER, 'forum_vote' => USER_LEVEL_MEMBER, 'forum_mods' => "");
         }
         // Set last order
         if (!$this->data['forum_order']) {
             $this->data['forum_order'] = dbresult(dbquery("SELECT MAX(forum_order) FROM " . DB_FORUMS . " " . (multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "' AND" : "WHERE") . " forum_cat='" . $this->data['forum_cat'] . "'"), 0) + 1;
         }
         if (\defender::safe()) {
             if ($this->verify_forum($this->data['forum_id'])) {
                 $result = dbquery_order(DB_FORUMS, $this->data['forum_order'], 'forum_order', $this->data['forum_id'], 'forum_id', $this->data['forum_cat'], 'forum_cat', 1, 'forum_language', 'update');
                 if ($result) {
                     dbquery_insert(DB_FORUMS, $this->data, 'update');
                 }
                 addNotice('success', self::$locale['forum_notice_9']);
                 redirect(FUSION_SELF . $aidlink . $this->ext);
             } else {
                 $new_forum_id = 0;
                 $result = dbquery_order(DB_FORUMS, $this->data['forum_order'], 'forum_order', FALSE, FALSE, $this->data['forum_cat'], 'forum_cat', 1, 'forum_language', 'save');
                 if ($result) {
                     dbquery_insert(DB_FORUMS, $this->data, 'save');
                     $new_forum_id = dblastid();
                 }
                 if ($this->data['forum_cat'] == 0) {
                     redirect(FUSION_SELF . $aidlink . "&amp;action=p_edit&amp;forum_id=" . $new_forum_id . "&amp;parent_id=0");
                 } else {
                     switch ($this->data['forum_type']) {
                         case '1':
                             addNotice('success', self::$locale['forum_notice_1']);
                             break;
//.........这里部分代码省略.........
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:101,代码来源:view.php

示例8: copy_dir

function copy_dir($from_file, $to_file)
{
    global $CFG;
    if (!is_dir($to_file)) {
        umask(00);
        $status = mkdir($to_file, $CFG->directorypermissions);
    }
    $dir = opendir($from_file);
    while ($file = readdir($dir)) {
        if ($file == "." || $file == "..") {
            continue;
        }
        $status = copy_file("{$from_file}/{$file}", "{$to_file}/{$file}");
    }
    closedir($dir);
    return $status;
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:17,代码来源:elgglib.php

示例9: file

        echo "Scuessfully created file(s)!";
    }
    exit;
}
if (isset($_GET['edit'])) {
    echo "<center><table border=\"1\" width=600 rules=\"groups\">\n  <thead>\n    <tr><td>";
    if (@file_exists($filename)) {
        echo "<form action=" . $surl . "?&" . $word . "&save method=post><textarea rows=15 cols=90 name=text>";
        read_file($filename);
        echo "</textarea><br><br><input type=hidden name=file value=" . urlencode($_GET['file']) . "><input type=submit name=sub value=Save>";
    }
    exit;
}
if (isset($_GET['copy_start'])) {
    echo "<center><table border=\"1\" width=600 rules=\"groups\">\n  <thead>\n    <tr><td>";
    copy_file($_POST['from'], $_POST['to']);
    exit;
}
if (isset($_GET['copy_file'])) {
    echo "<center><table border=\"1\" width=600 rules=\"groups\">\n\n  <thead>\n    <tr><td>";
    ?>
<form action=<?php 
    echo $surl;
    ?>
?&<?php 
    echo $word;
    ?>
&copy_start method="post">
New:<br><textarea rows=4 cols=70 name="to"><?php 
    echo realpath($filename);
    ?>
开发者ID:Theov,项目名称:webshells,代码行数:31,代码来源:dC3_Security_Crew_Shell_PRiV.php

示例10: ccXML


//.........这里部分代码省略.........
       $CC = substr($aCCInput[0], -17);
    }else{
       $CC = substr($aCCInput[0], -16);
    }
    */
    $expYear = substr($aCCInput[1], 0, 2);
    $expMonth = substr($aCCInput[1], 2, 2);
    //-----added 03/31/05 CvR
    if ($amountIn > 0) {
        $command = "1";
        //action code for transaction sale = 1
    } else {
        $command = "2";
        //action code for return = 2
    }
    //-----
    // in the PCCharge DevKit manual, 'MANUAL_FLAG' is defined as '0=manual, 1=swiped'  --atf 5/18/07
    $manual = 1;
    if ($_SESSION["ccManual"] != 0) {
        $manual = 0;
        $_SESSION["ccManual"] = 0;
    }
    $expDate = $expMonth . $expYear;
    //set expDate
    $present = 1;
    //card present
    $proc = 'BPAS';
    //processor (will be set to CCRD when done testing)
    $TID = merchantNum();
    //merchant ID for processor
    $user = $_SESSION["CashierNo"];
    $trackII = $_SESSION["ccSwipe"];
    $amount = truncate2(abs($amountIn));
    // $string_out creates the string that will be saved to the *.inx file
    // of the XML format that PC Charge expects
    // Note: ref to x-schema requires specific order sequence
    // could not resolve 'Incomplete Trans' errors; last resort, just turn off XML validation --atf 5/18/07
    //'<XML_FILE xmlns="x-schema:.\dtd\stnd.xdr">
    $string_out = '<XML_FILE>
	<XML_REQUEST>
		<USER_ID>' . $user . '</USER_ID>
		<COMMAND>' . $command . '</COMMAND>
		<PROCESSOR_ID>' . $proc . '</PROCESSOR_ID>
		<MERCH_NUM>' . $TID . '</MERCH_NUM>
		<ACCT_NUM>' . $CC . '</ACCT_NUM>
		<EXP_DATE>' . $expDate . '</EXP_DATE>
		<MANUAL_FLAG>' . $manual . '</MANUAL_FLAG>
		<TRANS_AMOUNT>' . $amount . '</TRANS_AMOUNT>';
    if ($manual == 1) {
        // counter-intuitive: manual==1 means swiped, not manual, so pass the track data --atf 5/24/07
        $string_out .= '
		<TRACK_DATA>' . $trackII . '</TRACK_DATA>';
    }
    $string_out .= '
		<TICKET_NUM>' . $transno . '</TICKET_NUM> 
		<PRESENT_FLAG>1</PRESENT_FLAG>
	</XML_REQUEST>
</XML_FILE>
';
    //------added 04/01/05 Tak & CvR-----provide for voiding CC entry on receipt
    if (substr($input, 0, 1) == 'V' || substr($input, 0, 1) == 'v') {
        $troutd = $getCCOutW[2];
        $command = 3;
        $string_out = '<XML_FILE xmlns="x-schema:.\\dtd\\stnd.xdr">
	<XML_REQUEST>
		<USER_ID>' . $user . '</USER_ID>
		<COMMAND>' . $command . '</COMMAND>
		<TROUTD>' . $troutd . '</TROUTD>
	</XML_REQUEST>
</XML_FILE>
';
        // echo $string_out;
    }
    //----
    //below added to log .inx info. To be tested on lane9, etc
    //added 07/07/05 CvR
    $trans_id = $_SESSION["LastID"] + 1;
    $lane = $_SESSION["laneno"];
    $trans_no = $_SESSION["transno"];
    $now = date('Y-m-d H:i:s');
    $dbinx = tDataconnect();
    $inxQ = "INSERT INTO INX\r\n         VALUES('{$user}','{$command}','{$proc}','{$TID}','{$CC}','{$expDate}','{$manual}','{$trackII}','{$transno}',1,{$amount},'','{$now}','{$trans_id}','{$trans_no}','{$lane}')";
    if (sql_query($inxQ, $dbinx)) {
        //---------
        // changed all filename functions (remote_oux(), local_inx(), etc) to variables, cached up top --atf 5/24/07
        delete_file($local_inx);
        // ***** changed local_inx function to variable abpw 3/05/07 *****
        $fp = fopen($local_inx, 'w');
        // open the file with write permissions -- ***** changed local_inx function to variable abpw 3/05/07 *****
        fwrite($fp, $string_out);
        // write $string_out to the *.inx file
        fclose($fp);
        // close the file
        delete_file($remote_inx);
        delete_file($remote_oux);
        $inxUploaded = copy_file($local_inx, $remote_inx);
        //***** changed local_inx function to variable abpw 3/05/07 *****
    }
    return $inxUploaded;
}
开发者ID:blynch-newpi,项目名称:IS4C,代码行数:101,代码来源:ccLib.php

示例11: foreach

<?php

foreach ($files as $fl) {
    $fl_nm = explode("_", $fl);
    $fl_timest = explode(".", $fl_nm[2]);
    if (count($fl_timest[0]) != 12) {
        if (substr($fl_timest[0], 2) != 10) {
            $new_fl_nm = substr_replace($fl_nm[2], "0" . substr($fl_timest[0], 2, 2), 2, count($fl_nm));
            $new_fl_nm = $fl_nm[0] . "_" . $fl_nm[1] . "_" . $new_fl_nm;
            //echo $new_fl_nm;die;
            if (copy_file($fl, $dir, $files_to_rename)) {
                // copy file to be rename
                if (renameFile($fl, $new_fl_nm, $dir, $dir)) {
                    // rename file
                    echo "file '{$fl}' renamed to '{$new_fl_nm}'.";
                } else {
                    echo "file '{$fl}' not renamed.";
                }
            }
        }
    }
}
开发者ID:jns4u,项目名称:ToDo,代码行数:22,代码来源:scan_rename_dir.php

示例12: copy_dir

/**
 *  Copy a directory with all its contents
 *
 *  When a file whose filename ends '.log' is created, its permissions
 *  are set to be world writable.
 *  @param string $src_path  Path to source directory
 *  @param string $dst_path  Path to destination directory
 *  @return boolean true=>success, false=>failure.
 */
function copy_dir($src_path, $dst_path)
{
    global $quiet;
    //  Make sure we have directories as arguments
    if (!is_dir($src_path)) {
        echo $src_path . " is not a directory\n";
        return false;
    }
    if (!is_dir($dst_path)) {
        echo $dst_path . " is not a directory\n";
        return false;
    }
    //  Open the source directory
    $src_handle = opendir($src_path);
    if (!$src_handle) {
        echo "unable to open {$src_path}\n";
        return false;
    }
    //  Copy contents of source directory
    while (false !== ($src_file = readdir($src_handle))) {
        if (!is_dir($src_path . $src_file)) {
            //  If this file exists only to make the directory
            //  non-empty so that PackageFileManager will add it to
            //  the installable package, don't bother to copy it.
            if ($src_file == '.delete_this_file') {
                continue;
            }
            //  This is a regular file, need to copy it
            if (file_exists($dst_path . $src_file)) {
                //  A destination file or directory with this name exists
                if (is_file($dst_path . $src_file)) {
                    //  A regular destination file with this name exists.
                    //  Check whether it's different from source.
                    $src_content = file_get_contents($src_path . $src_file);
                    $dst_content = file_get_contents($dst_path . $src_file);
                    if ($src_content == $dst_content) {
                        //  Source and destination are identical
                        if (!$quiet) {
                            echo "\texists {$dst_path}{$src_file}\n";
                        }
                        continue;
                    }
                }
                //  New and old files differ.  Save the old file.
                $stat = stat($dst_path . $src_file);
                $new_name = $dst_path . $src_file . '.' . $stat[9];
                if (!rename($dst_path . $src_file, $new_name)) {
                    echo "unable to rename {$dst_path}{$src_file} to {$new_name}\n";
                    return false;
                }
                if (!$quiet) {
                    echo "\trenamed {$src_file} to " . ($src_file . '.' . $stat[9]) . "\n";
                }
            }
            //  Destination file does not exist.  Create it
            if (!copy_file($src_path . $src_file, $dst_path . $src_file)) {
                return false;
            }
            //  Log files need to be world writeable
            if (substr($src_file, -4, 4) == '.log') {
                chmod($dst_path . $src_file, 0666);
            }
            // Generator & Console needs to be executable
            if ($src_file == 'generate.php' || $src_file == 'console.php') {
                chmod($dst_path . $src_file, 0754);
            }
            if (!$quiet) {
                echo "\tcreate {$dst_path}{$src_file}\n";
            }
        } else {
            //  This is a directory.  Ignore '.' and '..'
            if ($src_file == '.' || $src_file == '..') {
                continue;
            }
            //  This directory needs to be copied.
            if (!create_dir($dst_path . $src_file)) {
                return false;
            }
            //  Recursive call to copy directory
            if (!copy_dir($src_path . $src_file . DIRECTORY_SEPARATOR, $dst_path . $src_file . DIRECTORY_SEPARATOR)) {
                return false;
            }
        }
    }
    closedir($src_handle);
    return true;
}
开发者ID:phpontrax,项目名称:trax,代码行数:96,代码来源:trax.php

示例13: create_dir

create_dir(path($app_path, 'static'), 0777, TRUE);
create_dir(path($app_path, 'static', 'font'), 0777);
create_dir(path($app_path, 'static', 'css'), 0777);
create_dir(path($app_path, 'static', 'img'), 0777);
create_dir(path($app_path, 'static', 'js'), 0777);
create_dir(path($app_path, 'tasks'), 0777);
create_dir(path($app_path, 'app', 'assets'));
create_dir(path($app_path, 'app', 'assets', 'img'));
create_dir(path($app_path, 'app', 'assets', 'font'));
copy_file(path($app_path, 'app', 'assets', 'css'), path($skel_dir, 'config', 'app.css'));
copy_file(path($app_path, 'app', 'assets', 'css', 'app'), path($skel_dir, 'styles', 'styles.css.less'));
copy_file(path($app_path, 'app', 'assets', 'css'), path($skel_dir, 'styles', 'sauce.less'));
copy_file(path($app_path, 'app', 'assets', 'css'), path($skel_dir, 'styles', 'media.less'));
copy_file(path($app_path, 'app', 'assets', 'js'), path($skel_dir, 'config', 'app.js'));
copy_file(path($app_path, 'app', 'assets', 'js', 'app'), path($skel_dir, 'scripts', 'script.js.coffee'));
create_dir(path($app_path, 'app', 'assets', 'js', 'lib'), 0777, TRUE);
create_dir(path($app_path, 'app', 'views'));
copy_file(path($app_path, 'app', 'views', 'layouts'), path($skel_dir, 'views', 'raising.php.neddle'));
copy_file(path($app_path, 'app', 'views', 'layouts'), path($skel_dir, 'views', 'default.php.neddle'));
copy_file(path($app_path, 'app', 'views', 'home'), path($skel_dir, 'views', 'index.php.neddle'));
create_file(path($app_path, 'bower.json'), template(path($skel_dir, 'bower.json'), $vars));
create_file(path($app_path, '.gitignore'), read(path($skel_dir, 'gitignore.txt')), 0777);
copy_file($app_path, path($skel_dir, '.bowerrc'));
copy_file($app_path, path($skel_dir, '.htaccess'));
copy_file($app_path, path($skel_dir, 'composer.json'));
copy_file($app_path, path($skel_dir, 'exclude.txt'));
copy_file($app_path, path($skel_dir, 'deploy.sh'));
copy_file($app_path, path($skel_dir, 'favicon.ico'));
copy_file($app_path, path($skel_dir, 'config.php'));
copy_file($app_path, path($skel_dir, 'index.php'));
开发者ID:hbnro,项目名称:habanero,代码行数:30,代码来源:create_application.php

示例14: run_new_project


//.........这里部分代码省略.........
    G::mk_dir($pathHome . PATH_SEP . 'public_html' . PATH_SEP . 'skins');
    G::mk_dir($pathHome . PATH_SEP . 'public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green');
    G::mk_dir($pathHome . PATH_SEP . 'public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images');
    G::mk_dir($pathHome . PATH_SEP . 'engine');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'classes');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'map');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'om');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'config');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'content');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'content' . PATH_SEP . 'languages');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'content' . PATH_SEP . 'translations');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'data');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'data' . PATH_SEP . 'mysql');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'js');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'js' . PATH_SEP . 'labels');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'menus');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'methods');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'users');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'skins');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'templates');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'test');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'test' . PATH_SEP . 'bootstrap');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'test' . PATH_SEP . 'fixtures');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'test' . PATH_SEP . 'unit');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'xmlform');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'gulliver');
    G::mk_dir($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'users');
    //create project.conf for httpd conf
    create_file_from_tpl('httpd.conf', $projectName . '.conf');
    create_file_from_tpl('sysGeneric.php', 'public_html' . PATH_SEP . 'sysGeneric.php');
    copy_file_from_tpl('bm.jpg', 'public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'bm.jpg');
    copy_file_from_tpl('bsm.jpg', 'public_html' . PATH_SEP . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images' . PATH_SEP . 'bsm.jpg');
    create_file_from_tpl('index.html', 'public_html' . PATH_SEP . 'index.html');
    create_file_from_tpl('paths.php', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
    create_file_from_tpl('defines.php', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'defines.php');
    create_file_from_tpl('databases.php', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'databases.php');
    $fields['dbName'] = 'mysql';
    create_file_from_tpl('propel.ini', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'propel.ini', $fields);
    create_file_from_tpl('propel.ini', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'propel.mysql.ini', $fields);
    if (file_exists($pathHome . PATH_SEP . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'schema.xml')) {
        $createSchema = strtolower(prompt("schema.xml exists!. Do you want to overwrite the schema.xml file? [y/N]"));
        if ($createSchema == 'y') {
            create_file_from_tpl('schema.xml', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'schema.xml');
        }
    } else {
        create_file_from_tpl('schema.xml', 'engine' . PATH_SEP . 'config' . PATH_SEP . 'schema.xml');
    }
    create_file_from_tpl('sysLogin.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'sysLogin.php');
    create_file_from_tpl('login.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'login.php');
    create_file_from_tpl('authentication.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'authentication.php');
    create_file_from_tpl('welcome.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'welcome.php');
    create_file_from_tpl('dbInfo.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'login' . PATH_SEP . 'dbInfo.php');
    create_file_from_tpl('usersList.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'users' . PATH_SEP . 'usersList.php');
    create_file_from_tpl('rolesList.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'users' . PATH_SEP . 'rolesList.php');
    create_file_from_tpl('permissionsList.php', 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'users' . PATH_SEP . 'permissionsList.php');
    create_file_from_tpl('sysLogin.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'sysLogin.xml');
    create_file_from_tpl('login.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'login.xml');
    create_file_from_tpl('showMessage.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'showMessage.xml');
    create_file_from_tpl('welcome.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'welcome.xml');
    copy_file_from_tpl('xmlform.html', 'engine' . PATH_SEP . 'templates' . PATH_SEP . 'xmlform.html');
    copy_file_from_tpl('publish.php', 'engine' . PATH_SEP . 'templates' . PATH_SEP . 'publish.php');
    copy_file_from_tpl('publish-treeview.php', 'engine' . PATH_SEP . 'templates' . PATH_SEP . 'publish-treeview.php');
    create_file_from_tpl('dbInfo.xml', 'engine' . PATH_SEP . 'xmlform' . PATH_SEP . 'login' . PATH_SEP . 'dbInfo.xml');
开发者ID:bqevin,项目名称:processmaker,代码行数:67,代码来源:pakeGulliver.php

示例15: main_upgrade


//.........这里部分代码省略.........
            }
        }
    }
    if ($oldversion < 2006022301) {
        // This handles upgrades from _files/data to $CFG->dataroot too...
        // Alter file repository to remove path information
        echo "<h2>" . gettext("Adjusting file repository information") . "</h2>";
        // Get all files with path in the location
        $tostrip = $CFG->dirroot . '_files/data/';
        if ($files = get_records_select('files', 'location LIKE ?', array($tostrip . '%'))) {
            foreach ($files as $file) {
                $ident = $file->ident;
                $filename = str_replace($tostrip, "files/", $file->location);
                set_field('files', 'location', $filename, 'ident', $ident);
                echo "<p>" . sprintf(gettext("Updating file %d: %s"), $ident, $filename) . "</p>";
            }
        }
        // Get all files that start with _files
        $tostrip = '_files/data/';
        if ($files = get_records_select('files', 'location LIKE ?', array($tostrip . '%'))) {
            foreach ($files as $file) {
                $ident = $file->ident;
                $filename = str_replace($tostrip, "files/", $file->location);
                set_field('files', 'location', $filename, 'ident', $ident);
                echo "<p>" . sprintf(gettext("Updating file %d: %s"), $ident, $filename) . "</p>";
            }
        }
        // copy the files across.
        if ($dir = opendir($CFG->dirroot . '_files/data/')) {
            while ($file = readdir($dir)) {
                if ($file == "." || $file == ".." || $file == '.htaccess') {
                    continue;
                }
                copy_file($CFG->dirroot . "_files/data/{$file}", $CFG->dataroot . "files/{$file}");
            }
        }
        // now the profile images.. this is harder.
        if ($icons = get_records_sql("SELECT i.*,u.username FROM {$CFG->prefix}icons i JOIN {$CFG->prefix}users u ON i.owner = u.ident")) {
            foreach ($icons as $icon) {
                $upload_folder = $textlib->substr($icon->username, 0, 1);
                $fromfile = $CFG->dirroot . '_icons/data/' . $icon->filename;
                $tofile = $CFG->dataroot . 'icons/' . $upload_folder . '/' . $icon->username . '/' . $icon->filename;
                echo "<p>" . sprintf(gettext("Moving icon file %s to %s"), $fromfile, $tofile) . "</p>";
                if (!is_dir($CFG->dataroot . 'icons/' . $upload_folder)) {
                    umask(00);
                    $status = mkdir($CFG->dataroot . 'icons/' . $upload_folder, $CFG->directorypermissions);
                }
                if (!is_dir($CFG->dataroot . 'icons/' . $upload_folder . '/' . $icon->username)) {
                    umask(00);
                    $status = mkdir($CFG->dataroot . 'icons/' . $upload_folder . '/' . $icon->username, $CFG->directorypermissions);
                }
                copy_file($fromfile, $tofile);
            }
        }
    }
    if ($oldversion < 2006052100) {
        // add some missing indexes
        execute_sql("ALTER TABLE `{$CFG->prefix}tags` ADD INDEX `tagliteral` (`tag`(20)) ;", false);
        execute_sql("ALTER TABLE `{$CFG->prefix}tags` ADD INDEX `access` (`access`(20)) ;", false);
    }
    if ($oldversion < 2006052200) {
        // homogenise access field, shortest one was vc16, longest vc255
        execute_sql("ALTER TABLE `{$CFG->prefix}file_folders` CHANGE `access` `access` VARCHAR(20) NOT NULL DEFAULT 'PUBLIC' ;", false);
        execute_sql("ALTER TABLE `{$CFG->prefix}files` CHANGE `access` `access` VARCHAR(20) NOT NULL DEFAULT 'PUBLIC' ;", false);
        execute_sql("ALTER TABLE `{$CFG->prefix}groups` CHANGE `access` `access` VARCHAR(20) NOT NULL DEFAULT 'PUBLIC' ;", false);
        execute_sql("ALTER TABLE `{$CFG->prefix}profile_data` CHANGE `access` `access` VARCHAR(20) NOT NULL DEFAULT 'PUBLIC' ;", false);
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:67,代码来源:mysql.php


注:本文中的copy_file函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。