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


PHP copyFile函数代码示例

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


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

示例1: bindUser

 public function bindUser($user)
 {
     if ($user) {
         global $_FANWE;
         $data = array();
         $data['uid'] = $_FANWE['uid'];
         $data['type'] = $this->type;
         $data['keyid'] = $user['id'];
         unset($user['id']);
         $data['refresh_time'] = 0;
         $info = array();
         $info['access_token'] = $user['access_token'];
         unset($user['access_token']);
         $info['user'] = $user;
         $data['info'] = addslashes(serialize($info));
         if (!empty($user['figureurl_2']) && FS('User')->getAvatar($_FANWE['uid']) == 0) {
             $img = copyFile($user['figureurl_2'], "temp", false);
             if ($img !== false) {
                 FS('User')->saveAvatar($_FANWE['uid'], $img['path']);
             }
         }
         FDB::insert('user_bind', $data, false, true);
     }
 }
开发者ID:yakrsa,项目名称:football,代码行数:24,代码来源:douban.class.php

示例2: savePluginFile

G::mk_dir($pathPublic);
G::mk_dir($pathPublic . 'images');
//  file_put_contents ( PATH_DATA . 'skins' . PATH_SEP . $id  , "hello world" );
$fields['className'] = $id;
$fields['version'] = $oConf->version;
$fields['description'] = $oConf->description;
$fields['PMversion'] = System::getVersion();
savePluginFile('skinPluginMainClass', $pathHome . $id . '.php', $fields);
savePluginFile('skinPluginClass', $pathBase . 'class.' . $id . '.php', $fields);
copyFile(PATH_SKINS . $id . '.php', $pathBase . 'data');
copyFile(PATH_SKINS . $id . '.html', $pathBase . 'data');
copyFile(PATH_SKINS . $id . '.cnf', $pathBase . 'data');
copyFile(PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc', $pathPublic);
copyFile(PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css', $pathPublic);
$aFiles = array();
if ($handle = opendir($pathImages)) {
    while (false !== ($file = readdir($handle))) {
        if (substr($file, 0, 1) != '.') {
            if (isset($aFiles[$file])) {
                $aFiles[$file] = 0;
            }
            copyFile($pathImages . $file, $pathPublic . 'images' . PATH_SEP);
        }
    }
    closedir($handle);
}
$fileTar = packPlugin($id, $oConf->version);
$bDownload = true;
G::streamFile($fileTar, $bDownload, basename($fileTar));
@G::rm_dir($pathHome);
@unlink($fileTar);
开发者ID:nshong,项目名称:processmaker,代码行数:31,代码来源:skinsExport.php

示例3: copyFileIfExists

    //Копируем лицензию, если она сущеcтвует.
    copyFileIfExists("{$configDir}\\license.key", $dir['output']['builder'] . '\\license.key');
}
if (configBool('manual')) {
    writeStep("BUILDING MANUAL");
    copyFile($dir['docs'] . '\\manual_ru.html', $dir['output'][0] . '\\manual_ru.html');
}
if (platformEnabled('server', 'php')) {
    writeStep("BUILDING PHP SERVER");
    if (!configBool('jabber_notifier')) {
        $commandLineOptions['server']['php']['exclude_files'][] = 'system\\jabberclass.php';
        $commandLineOptions['server']['php']['exclude_files'][] = 'system\\reports_jn.*';
    }
    buildBinary('server', 0, false, false);
    //Копируем гео-базу.
    copyFile($dir['geobase'] . '\\country[maxmind].txt', $dir['output']['server'] . '[php]\\install\\geobase.txt');
    createSubDir($dir['source']['server'] . '[php]\\tmp');
    //Копируем дополнения.
    createSubDir($dir['output']['other']);
    copyFile($dir['source']['other'] . '\\redir.php', $dir['output']['other'] . '\\redir.php');
    copyFile($dir['source']['other'] . '\\sockslist.php', $dir['output']['other'] . '\\sockslist.php');
}
if (configBool('bcserver_platforms')) {
    writeStep("BUILDING BACKCONNECT SERVER");
    buildBinary('bcserver', 1, true, false);
}
if (configBool('builder_platforms') || configBool('bcserver_platforms') || platformEnabled('server', 'php')) {
    writeStep("CREATING DISTRIBUTED PACKAGE");
    packDir(array($dir['output']['builder'], $dir['output']['server'] . '[php]', $dir['output']['server'], $dir['output']['other'], $dir['output'][0] . '\\manual_??.txt'), $dir['output'][0] . '\\ZS_' . BO_CLIENT_VERSION);
}
goodEnd();
开发者ID:GadgetStrike,项目名称:Zeus,代码行数:31,代码来源:make.php

示例4: copyFile

    copyFile($itemID, $filename, $baseCard, $targetCard);
}
echo 'cards done, copy base files<br />';
foreach ($itemnames_fr as $itemID => $filename) {
    $result = copyFile($itemID, $filename, $baseItem, $targetItem);
    // File not found, try base name
    if ($result == -1) {
        if (isset($itemnames_base[$itemID])) {
            copyFile($itemID, $itemnames_base[$itemID], $baseItem, $targetItem);
        }
    }
    copyFile($itemID, $filename, $baseCollection, $targetCollection);
    // File not found, try base name
    if ($result == -1) {
        if (isset($itemnames_base[$itemID])) {
            copyFile($itemID, $itemnames_base[$itemID], $baseCollection, $targetCollection);
        }
    }
}
exit('done');
function parseFile($filepath)
{
    $lines = file($filepath);
    $names = array();
    foreach ($lines as $line) {
        $line = trim($line);
        if (empty($line) || substr($line, 0, 2) == '//') {
            continue;
        }
        // id#koreaname#
        if (preg_match('/([0-9]+)#([^#]+)#$/', $line, $match) == false) {
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:31,代码来源:sprite_rename.php

示例5: bindUser

 public function bindUser($user, $sync = '')
 {
     if ($user) {
         global $_FANWE;
         $data = array();
         $data['uid'] = $_FANWE['uid'];
         $data['type'] = $this->type;
         $data['keyid'] = $user['id'];
         $data['refresh_time'] = 0;
         $info = array();
         $info['oauth_token'] = $user['last_key']['oauth_token'];
         $info['oauth_token_secret'] = $user['last_key']['oauth_token_secret'];
         unset($user['last_key']);
         $info['user'] = $user;
         $data['info'] = addslashes(serialize($info));
         $sync = array();
         $sync['weibo'] = 1;
         $sync['topic'] = 1;
         $sync['medal'] = 1;
         $data['sync'] = serialize($sync);
         if (!empty($user['profile_image_url']) && !FS('User')->getIsAvatar($_FANWE['uid'])) {
             $img = copyFile(str_replace('/50/', '/180/', $user['profile_image_url']));
             if ($img !== false) {
                 FS('User')->saveAvatar($_FANWE['uid'], $img['path']);
             }
         }
         FDB::insert('user_bind', $data, false, true);
         //绑定后推送网站信息
         if ((int) $_FANWE['setting']['bind_push_weibo'] == 1) {
             $weibo = array();
             $weibo['content'] = sprintf(lang('user', 'bind_weibo_message'), $_FANWE['setting']['site_name'], $_FANWE['setting']['site_description'], $_FANWE['setting']['site_name']);
             $weibo['img'] = "";
             $weibo['ip'] = $_FANWE['client_ip'];
             $weibo['url'] = $_FANWE['site_url'] . FU('u/me', array('uid' => $_FANWE['uid']));
             $this->sentShare($_FANWE['uid'], $weibo);
         }
     }
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:38,代码来源:sina.class.php

示例6: delFolder

    //echo "文件夹被删除了";
    $mes = delFolder($dirname);
    alertMes($mes, $redirect);
} elseif ($act == "copyFile") {
    $str = <<<EOF
\t<form action="index.php?act=doCopyFile" method="post"> 
\t将文件复制到:<input type="text" name="dstname" placeholder="将文件复制到"/>
\t<input type="hidden" name="path" value="{$path}" />
\t<input type='hidden' name='filename' value='{$filename}' />
\t<input type="submit" value="复制文件"/>
\t</form>
EOF;
    echo $str;
} elseif ($act == "doCopyFile") {
    $dstname = $_REQUEST['dstname'];
    $mes = copyFile($filename, $path . "/" . $dstname);
    alertMes($mes, $redirect);
} elseif ($act == "cutFile") {
    $str = <<<EOF
\t<form action="index.php?act=doCutFile" method="post"> 
\t将文件剪切到:<input type="text" name="dstname" placeholder="将文件剪切到"/>
\t<input type="hidden" name="path" value="{$path}" />
\t<input type='hidden' name='filename' value='{$filename}' />
\t<input type="submit" value="剪切文件"/>
\t</form>
EOF;
    echo $str;
} elseif ($act == "doCutFile") {
    $dstname = $_REQUEST['dstname'];
    $mes = cutFile($filename, $path . "/" . $dstname);
    alertMes($mes, $redirect);
开发者ID:vipmorgana,项目名称:PHP,代码行数:31,代码来源:index.php

示例7: bindUser

 public function bindUser($user, $parameters, $session)
 {
     if ($user) {
         global $_FANWE;
         $data = array();
         $data['uid'] = $_FANWE['uid'];
         $data['type'] = $this->type;
         $data['keyid'] = $user['user_id'];
         $info = array();
         $info['session_key'] = $session;
         $info['refresh_token'] = $parameters['refresh_token'];
         $info['user'] = $user;
         $data['info'] = addslashes(serialize($info));
         if ((int) $parameters['expires_in'] > 0) {
             $data['refresh_time'] = TIME_UTC + (int) $parameters['expires_in'];
         } else {
             $data['refresh_time'] = 0;
         }
         $update = array();
         $update['buyer_level'] = $user['buyer_credit']['level'];
         $update['seller_level'] = $user['seller_credit']['level'];
         FDB::update('user', $update, 'uid = ' . $_FANWE['uid']);
         $buyer = array();
         $buyer['is_buyer'] = 1;
         if ($update['buyer_level'] < 2 || $update['seller_level'] > 6) {
             $buyer['is_buyer'] = 0;
         }
         FDB::update('user', $buyer, 'uid = ' . $_FANWE['uid'] . ' AND is_buyer > -1');
         if (!empty($user['avatar']) && !FS('User')->getIsAvatar($_FANWE['uid'])) {
             $img = copyFile($user['avatar']);
             if ($img !== false) {
                 FS('User')->saveAvatar($_FANWE['uid'], $img['path']);
             }
         }
         FDB::insert('user_bind', $data, false, true);
     }
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:37,代码来源:taobao.class.php

示例8: fetch

    public function fetch($url)
    {
        global $_FANWE;
        $id = $this->getID($url);
        if ($id == 0) {
            return false;
        }
        $key = 'taobao_' . $id;
        $share_goods = FDB::resultFirst('SELECT share_id,goods_id FROM ' . FDB::table('share_goods') . ' 
			WHERE uid = ' . $_FANWE['uid'] . " AND goods_key = '{$key}'");
        if ($share_goods) {
            $result['status'] = -1;
            $result['share_id'] = $share_goods['share_id'];
            $result['goods_id'] = $share_goods['goods_id'];
            return $result;
        }
        $client = new TopClient();
        $client->appkey = $_FANWE['cache']['business']['taobao']['app_key'];
        $client->secretKey = $_FANWE['cache']['business']['taobao']['app_secret'];
        $req = new ItemGetRequest();
        $req->setFields("detail_url,title,nick,pic_url,price");
        $req->setNumIid($id);
        $resp = $client->execute($req);
        if (!isset($resp->item)) {
            return false;
        }
        $result = array();
        $goods = (array) $resp->item;
        if (empty($goods['detail_url']) || empty($goods['pic_url'])) {
            return false;
        }
        if (FS("Image")->getIsServer()) {
            $args = array();
            $args['pic_url'] = $goods['pic_url'];
            $server = FS("Image")->formatServer($_FANWE['request']['image_server'], 'DE');
            $server = FS("Image")->getImageUrlToken($args, $server, 1);
            $body = FS("Image")->sendRequest($server, 'savetemp', true);
            if (empty($body)) {
                return false;
            }
            $image = unserialize($body);
            $result['image_server'] = $server['image_server'];
        } else {
            $image = copyFile($goods['pic_url'], "temp", false);
            if ($image === false) {
                return false;
            }
            $image['server_code'] = '';
        }
        $result['item']['key'] = $key;
        $result['item']['name'] = $goods['title'];
        $result['item']['price'] = $goods['price'];
        $result['item']['img'] = $image['path'];
        $result['item']['server_code'] = $image['server_code'];
        $result['item']['pic_url'] = $goods['pic_url'] . '_100x100.jpg';
        $result['item']['url'] = $goods['detail_url'];
        $tao_ke_pid = $_FANWE['cache']['business']['taobao']['tk_pid'];
        $shop_click_url = '';
        if (!empty($tao_ke_pid)) {
            $req = new TaobaokeItemsDetailGetRequest();
            $req->setFields("click_url,shop_click_url");
            $req->setNumIids($id);
            $req->setPid($tao_ke_pid);
            $resp = $client->execute($req);
            if (isset($resp->taobaoke_item_details)) {
                $taoke = (array) $resp->taobaoke_item_details->taobaoke_item_detail;
                if (!empty($taoke['click_url'])) {
                    $result['item']['taoke_url'] = $taoke['click_url'];
                }
                if (!empty($taoke['shop_click_url'])) {
                    $shop_click_url = $taoke['shop_click_url'];
                }
            }
        }
        if (!empty($goods['nick'])) {
            $req = new ShopGetRequest();
            $req->setFields("sid,nick,pic_path");
            $req->setNick($goods['nick']);
            $resp = $client->execute($req);
            if (isset($resp->shop)) {
                $shop = (array) $resp->shop;
                $result['shop']['name'] = $shop['nick'];
                if (!empty($shop['pic_path'])) {
                    if (FS("Image")->getIsServer()) {
                        $args = array();
                        $args['pic_url'] = 'http://logo.taobao.com/shop-logo' . $shop['pic_path'];
                        $server = FS("Image")->getImageUrlToken($args, '', 1);
                        $body = FS("Image")->sendRequest($server, 'savetemp', true);
                        if (!empty($body)) {
                            $image = unserialize($body);
                        } else {
                            $image = false;
                        }
                    } else {
                        $image = copyFile('http://logo.taobao.com/shop-logo' . $shop['pic_path'], "temp", false);
                        if ($image === false) {
                            $image['server_code'] = '';
                        }
                    }
                    if ($image !== false) {
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:concourse,代码行数:101,代码来源:taobao_sharegoods.class.php

示例9: inserisci


//.........这里部分代码省略.........
     $int->genera_controlli_php($url);
     foreach ($this->_properties as $s) {
         print $s['tipo'] . '<br />';
         if ($s['tipo'] != 'file' && $s['tipo'] != 'tab' && $s['tipo'] != 'tabs' && $s['tipo'] != 'titolo' && !isset($s['onsubmit'])) {
             if ($s['tipo'] == 'checkbox' && $s['nome'] != 'privacy') {
                 if (isset($s['unico']) && $_POST[$s['nome']] == '1') {
                     $query2 = "update " . $cosa . ' set ' . $s['nome'] . '=0';
                 }
                 if ($_POST[$s['nome']] != '1') {
                     $_POST[$s['nome']] = 0;
                 } else {
                     $_POST[$s['nome']] = 1;
                 }
             } elseif ($s['tipo'] == 'textarea' || $s['tipo'] == 'text') {
                 if (isset($s['unico']) && $_POST[$s['nome']] != '') {
                     $unico = mysql_query("select * from " . $cosa . " where " . $s['nome'] . "='" . $_POST[$s['nome']] . "'");
                     if (mysql_num_rows($unico) > 0) {
                         header("Location: ../index.php?ins=err2");
                         exit;
                     }
                 }
                 if ($s['controllo'] == 'data') {
                     $_POST[$s['nome']] = my_date($_POST[$s['nome']]);
                 } else {
                     if ($s['tipo'] == 'textarea' && !isset($s['codice'])) {
                         if (isset($s['editor'])) {
                             $_POST[$s['nome']] = htmlentities($_POST[$s['nome']]);
                         }
                     } elseif (!isset($s['codice'])) {
                         $_POST[$s['nome']] = addslashes(htmlentities($_POST[$s['nome']]));
                     } else {
                         $_POST[$s['nome']] = addslashes($_POST[$s['nome']]);
                     }
                 }
             }
             if ($i == 0) {
                 if ($s['nome'] != 'privacy') {
                     $query .= $s['nome'];
                     $value .= "'" . $_POST[$s['nome']] . "'";
                     $i++;
                 }
             } else {
                 if ($s['nome'] != 'privacy') {
                     $query .= ',' . $s['nome'];
                     $value .= ",'" . $_POST[$s['nome']] . "'";
                 }
             }
         } elseif (isset($s['genere']) && !isset($s['onsubmit'])) {
             $file[] = $s;
         } elseif (!isset($s['onsubmit'])) {
             $foto[] = $s;
         }
     }
     if (isset($query2)) {
         mysql_query($query2) or die(mysql_error());
     }
     if ($this->cosa == 'utenti') {
         $_POST['verificato'] = gen_password();
         $query .= ',verificato';
         $value .= ",'" . $_POST['verificato'] . "'";
     }
     $query .= ')';
     $value .= ')';
     //print $query.$value;
     mysql_query($query . $value) or die(mysql_error());
     $id_modello = mysql_insert_id();
     $descrizione = $id_modello;
     $_POST['id'] = $id_modello;
     $i = 0;
     if (isset($foto)) {
         foreach ($foto as $f) {
             if ($_FILES[$f['nome']]['tmp_name'] != '') {
                 $nome = ins_foto($_FILES[$f['nome']], $cosa . $i, $descrizione);
             } else {
                 $nome = '';
             }
             if (strpos($nome, $cosa) || $nome == '') {
                 $i++;
                 mysql_query("update " . $cosa . " set " . $f['nome'] . "='" . $nome . "' where id_" . $cosa . "='" . $id_modello . "'") or die(mysql_error());
             }
         }
     }
     if (isset($file)) {
         foreach ($file as $fi) {
             $newName = 'tool' . $id_modello;
             $nome = copyFile($_FILES[$fi['nome']], $newName);
             if ($nome !== false) {
                 $i++;
                 mysql_query("update " . $cosa . " set " . $fi['nome'] . "='" . $nome . "' where id_" . $cosa . "='" . $id_modello . "'") or die(mysql_error());
             }
         }
     }
     if ($i == count($foto) + count($file)) {
         header("Location:" . $url . "&ins=ok");
         exit;
     } else {
         header("Location:" . $url . "&ins=err");
         exit;
     }
 }
开发者ID:gimoz71,项目名称:Agenzia-Radar,代码行数:101,代码来源:azioni.class.php

示例10: fetch

    public function fetch($url)
    {
        global $_FANWE;
        $id = $this->getID($url);
        if (empty($id)) {
            return false;
        }
        $key = 'dangdang_' . $id;
        $share_goods = FDB::resultFirst('SELECT share_id,goods_id FROM ' . FDB::table('share_goods') . ' 
			WHERE uid = ' . $_FANWE['uid'] . " AND goods_key = '{$key}'");
        if ($share_goods) {
            $result['status'] = -1;
            $result['share_id'] = $share_goods['share_id'];
            $result['goods_id'] = $share_goods['goods_id'];
            return $result;
        }
        //请求数据
        $content = getUrlContent("http://product.dangdang.com/product.aspx?product_id=" . $id);
        if (empty($content)) {
            return false;
        }
        $content = gbToUTF8($content);
        $content = preg_replace("/[\r\n]/", '', $content);
        @preg_match("/<h1>(.*?)<\\/h1>/", $content, $title);
        if (empty($title)) {
            return false;
        }
        @preg_match("/var oldimage \\= '(.*?)';/", $content, $img);
        if (empty($img)) {
            return false;
        }
        @preg_match("/<span class=\"promotions_price_d\">¥<b>(.*?)<\\/b><\\/span>/u", $content, $price);
        if (empty($price)) {
            @preg_match("/<span.*?id=\"salePriceTag\">¥(.*?)<\\/span>/u", $content, $price);
            if (empty($price)) {
                return false;
            } else {
                $price = (double) $price[1];
            }
        } else {
            $price = (double) $price[1];
        }
        if (FS("Image")->getIsServer()) {
            $args = array();
            $args['pic_url'] = $img[1];
            $server = FS("Image")->formatServer($_FANWE['request']['image_server'], 'DE');
            $server = FS("Image")->getImageUrlToken($args, $server, 1);
            $body = FS("Image")->sendRequest($server, 'savetemp', true);
            if (empty($body)) {
                return false;
            }
            $image = unserialize($body);
            $result['image_server'] = $server['image_server'];
        } else {
            $image = copyFile($img[1], "temp", false);
            if ($image === false) {
                return false;
            }
            $image['server_code'] = '';
        }
        $result['item']['key'] = $key;
        $result['item']['name'] = strip_tags(str_replace('[当当自营]', '', $title[1]));
        $result['item']['price'] = $price;
        $result['item']['img'] = $image['path'];
        $result['item']['server_code'] = $image['server_code'];
        $result['item']['pic_url'] = $img[1];
        $result['item']['url'] = "http://product.dangdang.com/product.aspx?product_id=" . $id;
        $from = $_FANWE['cache']['business']['dangdang']['from'];
        if (!empty($from)) {
            $result['item']['taoke_url'] = "http://union.dangdang.com/transfer.php?from=" . $from . "&ad_type=10&sys_id=1&backurl=" . $result['item']['url'];
        }
        @preg_match("/<div class=\"legend\"><a href=\"http:\\/\\/shop\\.dangdang\\.com\\/(.*?)\".*?>(.*?)<\\/a><a.*?>.*?<\\/a><\\/div>/", $content, $shop);
        if (!empty($shop)) {
            $result['shop']['name'] = $shop[2];
            $result['shop']['url'] = "http://shop.dangdang.com/" . $shop[1];
            if (!empty($from)) {
                $result['shop']['taoke_url'] = "http://union.dangdang.com/transfer.php?from=" . $from . "&ad_type=10&sys_id=1&backurl=" . $result['shop']['url'];
            }
            if (!FS("Shop")->getShopExistsByUrl($result['shop']['url'])) {
                $content = getUrlContent($result['shop']['url']);
                if (!empty($content)) {
                    $content = preg_replace("/[\r\n]/", '', $content);
                    @preg_match("/<dl.*?id=\"hslice_shop_basic_info_" . $shop[1] . "\">.*?<dt><a.*?><img src=\"(.*?)\".*?\\/><\\/a><\\/dt>/", $content, $shop_img);
                    if (!empty($shop_img)) {
                        if (FS("Image")->getIsServer()) {
                            $args = array();
                            $args['pic_url'] = $shop_img[1];
                            $server = FS("Image")->getImageUrlToken($args, '', 1);
                            $body = FS("Image")->sendRequest($server, 'savetemp', true);
                            if (!empty($body)) {
                                $image = unserialize($body);
                            } else {
                                $image = false;
                            }
                        } else {
                            $image = copyFile($shop_img[1], "temp", false);
                            if ($image === false) {
                                $image['server_code'] = '';
                            }
                        }
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:101,代码来源:dangdang_sharegoods.class.php

示例11: renameFile

                        if ($mode == 'renameFile') {
                            $str = " <form action='index.php?mode=doRenameFile' method ='post'>\n            <input type='hidden' name ='filename' value ='{$filename}' />\n            <input type='hidden' name='path' value='{$path}' />\n            <label>请输入名称</label>\n            <input type='name'   name='newName'  placeholder='请输入重命名'>\n            <input type='submit' value='确定' />\n        </form>";
                            echo $str;
                        } else {
                            if ($mode == 'doRenameFile') {
                                $newFilename = $_REQUEST['newName'];
                                $msg = renameFile($filename, $newFilename);
                                alertMsg($msg, $url);
                            } else {
                                if ($mode == 'copyFile') {
                                    $str = "\n        <form action='index.php?mode=doCopyFile' method ='post'>\n            <input type='hidden' name='filename' value='{$filename}'/>\n            <input type='hidden' name='path' value='{$path}'/>\n               <label>文件复制</label>\n            <input type='name'   name='newName'  placeholder='{$filename}'>\n            <input type='submit' value='确定' />\n</form>";
                                    echo $str;
                                } else {
                                    if ($mode == 'doCopyFile') {
                                        $disname = $_REQUEST['newName'];
                                        $msg = copyFile($filename, $path . "/" . $disname);
                                        // echo $msg;
                                        alertMsg($msg, $url);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
#剪切文件
if ($mode == 'cutFile') {
    $str = "\n        <form action='index.php?mode=doCutFile' method='post'>\n            <input type='hidden' name='filename' value='{$filename}' />\n            <input type='hidden' name='path' value='{$path}' />\n            <label>前切:</label>\n            <input type='text' name='disFile' placeholder='前切到'>\n            <input type='submit' value='确定'/>\n        </form>";
开发者ID:cengjing,项目名称:fileManager-1,代码行数:31,代码来源:index.php

示例12: fetch

    public function fetch($url)
    {
        global $_FANWE;
        //QQ号
        define('PAIPAI_API_UIN', $_FANWE['cache']['business']['paipai']['uin']);
        //令牌
        define('PAIPAI_API_TOKEN', $_FANWE['cache']['business']['paipai']['token']);
        //APP_KEY
        define('PAIPAI_API_SECRETKEY', $_FANWE['cache']['business']['paipai']['seckey']);
        define('PAIPAI_API_SPID', $_FANWE['cache']['business']['paipai']['spid']);
        $id = $this->getID($url);
        if (empty($id)) {
            return false;
        }
        $key = 'paipai_' . $id;
        $share_goods = FDB::resultFirst('SELECT share_id,goods_id FROM ' . FDB::table('share_goods') . ' 
			WHERE uid = ' . $_FANWE['uid'] . " AND goods_key = '{$key}'");
        if ($share_goods) {
            $result['status'] = -1;
            $result['share_id'] = $share_goods['share_id'];
            $result['goods_id'] = $share_goods['goods_id'];
            return $result;
        }
        $paipaiParamArr = array('uin' => PAIPAI_API_UIN, 'token' => PAIPAI_API_TOKEN, 'spid' => PAIPAI_API_SPID);
        //API用户参数
        $userParamArr = array('charset' => 'utf-8', 'format' => 'xml', 'itemCode' => $id);
        $paramArr = $paipaiParamArr + $userParamArr;
        //请求数据
        $goods = Util::getResult($paramArr, '/item/getItem.xhtml');
        //解析xml结果
        $goods = Util::getXmlData($goods);
        if ($goods['errorCode'] > 0) {
            return false;
        }
        if (empty($goods['picLink'])) {
            return false;
        }
        if (FS("Image")->getIsServer()) {
            $args = array();
            $args['pic_url'] = $goods['picLink'];
            $server = FS("Image")->formatServer($_FANWE['request']['image_server'], 'DE');
            $server = FS("Image")->getImageUrlToken($args, $server, 1);
            $body = FS("Image")->sendRequest($server, 'savetemp', true);
            if (empty($body)) {
                return false;
            }
            $image = unserialize($body);
            $result['image_server'] = $server['image_server'];
        } else {
            $image = copyFile($goods['picLink'], "temp", false);
            if ($image === false) {
                return false;
            }
            $image['server_code'] = '';
        }
        $result['item']['key'] = $key;
        $result['item']['name'] = $goods['itemName'];
        $result['item']['price'] = $goods['itemPrice'] / 100;
        $result['item']['img'] = $image['path'];
        $result['item']['server_code'] = $image['server_code'];
        $result['item']['pic_url'] = $goods['picLink'];
        $result['item']['url'] = 'http://auction1.paipai.com/' . $goods['itemCode'];
        if (!empty($goods['sellerUin'])) {
            //API用户参数
            $userParamArr = array('charset' => 'utf-8', 'format' => 'xml', 'sellerUin' => $goods['sellerUin']);
            $paramArr = $paipaiParamArr + $userParamArr;
            //请求数据
            $shop = Util::getResult($paramArr, '/shop/getShopInfo.xhtml');
            //解析xml结果
            $shop = Util::getXmlData($shop);
            if ($shop['errorCode'] == 0) {
                $result['shop']['name'] = $shop['shopName'];
                $result['shop']['shop_id'] = $shop['sellerUin'];
                $result['shop']['url'] = 'http://shop.paipai.com/' . $shop['sellerUin'];
            }
        }
        return $result;
    }
开发者ID:dalinhuang,项目名称:concourse,代码行数:78,代码来源:paipai_sharegoods.class.php

示例13: addIndex

function addIndex($path, $cli = false)
{
    $is_dot = array('.', '..');
    $file_extension = substr(strrchr($path, '.'), 1);
    if (is_dir($path)) {
        if (version_compare((double) phpversion(), (double) '5.3', '<')) {
            $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
        } else {
            $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
        }
        foreach ($iterator as $pathname => $file) {
            if (version_compare((double) phpversion(), (double) '5.2.17', '<=')) {
                if (in_array($file->getBasename(), $is_dot)) {
                    continue;
                }
            } elseif (version_compare((double) phpversion(), '(float)5.3', '<')) {
                if ($file->isDot()) {
                    continue;
                }
            }
            $name = (string) trim($file->getFilename());
            $exp = explode('\\', $pathname);
            $dirname = isset($exp[0]) ? $exp[0] . '/' : '';
            if (count($exp) === 2 && $file->isFile()) {
                if (!file_exists($dirname . 'index.php')) {
                    if (copyFile('sources/index.php', $dirname . 'index.php') === true) {
                        continue;
                    }
                }
            } else {
                if ($file->isDir()) {
                    $dirname = str_replace('\\', '/', $file->getPathname() . '/');
                    if (!file_exists($dirname . 'index.php')) {
                        if (copyFile('sources/index.php', $dirname . 'index.php') === true) {
                            continue;
                        }
                    }
                }
            }
        }
        unset($iterator, $pathname, $file);
        $msg = 'index.php added in ' . $path;
        if ($cli === true) {
            echo $msg . "\n";
        } else {
            p($msg);
        }
    } elseif ($file_extension === 'zip') {
        if (class_exists('ZipArchive')) {
            $add_index = array();
            $zip = new ZipArchive();
            $res = $zip->open($path);
            if ($res === true) {
                for ($i = 0; $i < $zip->numFiles; $i++) {
                    $stat = $zip->statIndex($i);
                    if (!empty($stat)) {
                        $file_info = pathinfo($stat['name']);
                        if (!empty($file_info)) {
                            $dirname = trim($file_info['dirname']);
                            $filename = trim($file_info['filename']);
                            $basename = trim($file_info['basename']);
                            if (!in_array($dirname, $is_dot)) {
                                $getFromName = $zip->getFromName($dirname . '/index.php');
                                if (empty($getFromName)) {
                                    $add_index[] = $dirname . '/';
                                }
                            }
                        }
                    }
                }
                $add_index = array_unique($add_index);
                foreach ($add_index as $dir_path) {
                    if ($zip->addFile('sources/index.php', $dir_path . 'index.php') === true) {
                        continue;
                    }
                }
                unset($add_index, $dir_path);
                $zip->close();
                unset($zip);
                $msg = 'index.php added in ' . $path;
                if ($cli === true) {
                    echo $msg . "\n";
                } else {
                    p($msg);
                }
            }
        } else {
            if ($cli === true) {
                echo "You need to install ZipArchive\npecl install zip\n";
            } else {
                p('You need to install ZipArchive<br />pecl install zip');
            }
        }
    } else {
        $msg = $path . ' isn\'t a directory or zip file';
        if ($cli === true) {
            echo $msg . "\n";
        } else {
            p($msg);
        }
//.........这里部分代码省略.........
开发者ID:johnulist,项目名称:autoindex,代码行数:101,代码来源:index.php

示例14: save


//.........这里部分代码省略.........
            }
            $shop_ids = array();
            $goods_count = 0;
            //保存分享的商品
            if (isset($data['share_goods'])) {
                $share_goods = $data['share_goods'];
                foreach ($share_goods as $goods) {
                    if ($goods_count >= $_FANWE['setting']['share_goods_count']) {
                        break;
                    }
                    $shop_id = 0;
                    if (!empty($goods['shop_url'])) {
                        $shop_id = FDB::resultFirst('SELECT shop_id
							FROM ' . FDB::table('shop') . '
							WHERE shop_url = \'' . $goods['shop_url'] . '\'');
                        if (intval($shop_id) == 0) {
                            $content_match .= $goods['shop_name'];
                            $shop_logo['url'] = '';
                            if (!empty($goods['shop_logo'])) {
                                if (FS("Image")->getIsServer() && !empty($goods['shop_server_code'])) {
                                    $server = FS("Image")->getServer($goods['shop_server_code']);
                                    if (!empty($server)) {
                                        $args = array();
                                        $args['pic_url'] = $goods['shop_logo'];
                                        $server = FS("Image")->getImageUrlToken($args, $server, 1);
                                        $body = FS("Image")->sendRequest($server, 'saveshop', true);
                                        if (!empty($body)) {
                                            $shop_logo = unserialize($body);
                                            FS("Image")->setServerUploadCount($shop_logo['server_code']);
                                            $shop_logo['url'] = str_replace('./', './' . $shop_logo['server_code'] . '/', $shop_logo['url']);
                                        }
                                    }
                                } else {
                                    $shop_logo = copyFile($goods['shop_logo'], 'shop', true);
                                }
                            }
                            $shop_data['shop_name'] = $goods['shop_name'];
                            $shop_data['shop_logo'] = $shop_logo['url'];
                            $shop_data['server_code'] = $goods['shop_server_code'];
                            $shop_data['shop_url'] = $goods['shop_url'];
                            $shop_data['taoke_url'] = $goods['shop_taoke_url'];
                            $shop_id = FDB::insert('shop', $shop_data, true);
                        }
                        if ($shop_id > 0) {
                            $shop_ids[] = $shop_id;
                        }
                    }
                    if (FS("Image")->getIsServer() && !empty($goods['server_code'])) {
                        $server = FS("Image")->getServer($goods['server_code']);
                        if (!empty($server)) {
                            $server_args['share_id'] = $share_id;
                            $server_args['img_path'] = $goods['img'];
                            $server = FS("Image")->getImageUrlToken($server_args, $server, 1);
                            $body = FS("Image")->sendRequest($server, 'saveshare', true);
                            if (!empty($body)) {
                                $goods_img = unserialize($body);
                                FS("Image")->setServerUploadCount($goods_img['server_code']);
                                $share_server_code[] = $goods_img['server_code'];
                                $goods_img['url'] = str_replace('./', './' . $goods_img['server_code'] . '/', $goods_img['url']);
                                $weibo_img_url = FS("Image")->getImageUrl($goods_img['url'], 1);
                            }
                        }
                    } else {
                        $goods_img = copyImage($goods['img'], array(), 'share', true, $share_id);
                        $weibo_img_url = FS("Image")->getImageUrl($goods_img['url'], 1);
                    }
开发者ID:dalinhuang,项目名称:concourse,代码行数:67,代码来源:share.service.php

示例15: checkfile

function checkfile($path, $move) {
 global $dirs;
 global $current_dir;
 global $current_dest;
 global $acc;
 global $ignores;
 global $files_copied;

 foreach($ignores as $ptn) {
  if (preg_match("/".$ptn."/is", $path)) return;
 }

 $tmdiff=0;

 if (!$current_dest) {
  $dest=$dirs[$current_dir];
 } else {
  $dest=$current_dest;
 }

 $path=str_replace('NET:', '//', $path);
 $current_dir=str_replace('NET:', '//', $current_dir);

 $mtime=filemtime($path);

 $dest=str_replace('NET:', '//', $dest);
 $dest=str_replace($current_dir, $dest, $path);
 $dest_path=str_replace(basename($dest), '', $dest);

  $new_dest_path=preparePathTime($dest_path, $mtime);
  $dest=str_replace($dest_path, $new_dest_path, $dest);
  $dest_path=$new_dest_path;


 if (!is_dir2($dest_path)) {
  //echo "\n\n make dir: $dest_path \n\n";
  if (!makedir($dest_path)) return 0;
 }

 if (!file_exists($dest)) {
  echo $path." -> ".$dest." (new)\n";
  copyFile($path, $dest);
 } else {
  $dest_size=filesize($dest);
  $src_size=filesize($path);
  $tmdiff=filemtime($path)-filemtime($dest);
  if ($tmdiff>$acc || ($dest_size==0 && $src_size!=0)) { 
   $status="updated $tmdiff";
   echo $path." -> ".$dest." (updated ".round($tmdiff/60/60, 1)." h)\n";
   copyFile($path, $dest);
  } else {
   //echo $path." -> ".$dest." (OK ".round($tmdiff/60/60, 1)." h)\n";
   $fs=filesize($path);
   if ($fs>(2*1024*1024)) {
    $k=basename($path).'_'.$fs;
    //$files_copied[$k]=$dest;
   }
  }
 }

 if ($move) {
  unlink($path);
 }


}
开发者ID:novozhenets,项目名称:majordomo,代码行数:66,代码来源:syncfiles.class.php


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