예제 #1
0
 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);
     }
 }
예제 #2
0
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);
예제 #3
0
파일: make.php 프로젝트: GadgetStrike/Zeus
    //Копируем лицензию, если она суще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();
예제 #4
0
    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) {
예제 #5
0
 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);
         }
     }
 }
예제 #6
0
파일: index.php 프로젝트: vipmorgana/PHP
    //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);
예제 #7
0
 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);
     }
 }
    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) {
                        $result['shop']['logo'] = $image['path'];
                        $result['shop']['server_code'] = $image['server_code'];
                    }
                }
                $result['shop']['shop_id'] = $shop['sid'];
                $result['shop']['url'] = 'http://shop' . $shop['sid'] . '.taobao.com';
                if (!empty($shop_click_url)) {
                    $result['shop']['taoke_url'] = $shop_click_url;
                }
            }
        }
        return $result;
    }
예제 #9
0
 function inserisci($_POST)
 {
     $query = "insert into " . $this->cosa . " (";
     $value = " values(";
     $i = 0;
     $foto = array();
     $file = array();
     $url = '';
     if ($this->cosa == 'utenti') {
         $url = HOMEPATH . "registrazione.php";
     } else {
         $url = ADMINPATH . "inserisci.php?cosa=" . $this->cosa;
     }
     if (isset($_REQUEST['url'])) {
         $url = $_REQUEST['url'];
     }
     $int = new interfaccia($this->_properties);
     $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;
     }
 }
    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'] = '';
                            }
                        }
                        if ($image !== false) {
                            $result['shop']['logo'] = $image['path'];
                            $result['shop']['server_code'] = $image['server_code'];
                        }
                    }
                }
            }
        }
        return $result;
    }
예제 #11
0
                        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>";
    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;
    }
예제 #13
0
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);
        }
    }
}
예제 #14
0
    /**
     * 保存分享数据
     * 注:所有图片地址经处理过并转存过的临时图片或远程图片
     * $data = array( //分享的基本数据
     *  'share'=>array(
     * 	  'uid'=> xxx, //分享的会员ID
     * 	  'parent_id'	=>	xxx //转发的分享ID
     * 	  'content'	=>	xxx //分享的内容
     * 	  'type'=> xxx  //分享的来源,默认为default
     *    'title' => xxx //分享的标题
     *    'base_id' => xxx //原创ID
     * 	),
     *
     *  'share_photo'=>array( //图库  #可选#
     *    array(  //多张图
     *    'img' => xxx //原图
     *    )
     *  ),
     *  'share_goods'=>array( //分享的商品 #可选#
     *    array(
     *    'img' => xxx  //商品图
     *    'name' => xxx //品名
     *    'url'  => xxx //商品地址
     *    'price' => xxx  //价格
     *    'shop_name' => xxx //商户名称
     *    'shop_logo' => xxx //商户的logo
     *    'shop_url' => xxx //商户地址
     *    ) //多个商品
     *  ),
     *  'share_tag' => array(xxx,xxx,xxx),  //该分享的标签
     * );
     *
     * 返回
     * array(
     *   'status' => xxx  状态  bool
     *   'share_id' => share_id
     * )
     */
    public function save($data, $is_score = true)
    {
        global $_FANWE;
        //保存分享数据
        $share_data = $data['share'];
        $share_album_id = (int) $share_data['albumid'];
        unset($share_data['albumid']);
        $share_data['create_time'] = TIME_UTC;
        $share_data['day_time'] = getTodayTime();
        $share_id = FDB::insert('share', $share_data, true);
        if (intval($share_id) > 0) {
            $share_data_now_type = $share_data['type'];
            $share_data_rec_id = $share_data['rec_id'];
            $share_server_code = array();
            if (empty($share_data_now_type)) {
                $share_data_now_type = 'default';
            }
            /*//是否是回复 是的 话 添加评论消息提示
            		if(intval($share_data['parent_id']) > 0)
            		{
            			$base_share_id = FDB::resultFirst("select uid from ".FDB::table('share')." where share_id = ".$share_data['parent_id']);
            			$result = FDB::query("INSERT INTO ".FDB::table('user_notice')."(uid, type, num, create_time) VALUES('$base_share_id',3,1,'".TIME_UTC."')", 'SILENT');
            			if(!$result)
            				FDB::query("UPDATE ".FDB::table('user_notice')." SET num = num + 1, create_time='".TIME_UTC."' WHERE uid='$base_share_id' AND type=3");
            		}*/
            //保存话题
            $is_event = false;
            $event_list = array();
            $pattern = "/#([^\f\n\r\t\v]{1,80}?)#/";
            preg_match_all($pattern, $share_data['content'], $event_list);
            if (!empty($event_list[1])) {
                array_unique($event_list[1]);
                foreach ($event_list[1] as $v) {
                    $event_id = (int) FDB::resultFirst("select id from " . FDB::table("event") . " where `title`='" . $v . "'");
                    if ($event_id == 0) {
                        $event_data = array();
                        $event_data['uid'] = $share_data['uid'];
                        $event_data['title'] = $v;
                        $event_data['share_id'] = $share_id;
                        $event_data['create_time'] = TIME_UTC;
                        $event_data['last_share'] = $share_id;
                        $event_data['last_time'] = TIME_UTC;
                        FDB::insert("event", $event_data);
                    } else {
                        $event_data = array();
                        $event_data['event_id'] = $event_id;
                        $event_data['uid'] = $share_data['uid'];
                        $event_data['share_id'] = $share_id;
                        FDB::insert("event_share", $event_data);
                        FDB::query("update " . FDB::table("event") . " set thread_count = thread_count+1,last_share=" . $share_id . ",last_time=" . TIME_UTC . " where id = {$event_id}");
                    }
                }
            }
            $share_cates = array();
            $result['status'] = true;
            $result['share_id'] = $share_id;
            /*$content_match = FS('Words')->segment(clearExpress($share_data['content']),100);
            		$title_tags = FS('Words')->segment($share_data['title'],100);
                       if(!empty($title_tags))
            			$content_match = array_merge($content_match, $title_tags);*/
            $content_match = clearExpress($share_data['content']);
            $content_match .= $share_data['title'];
            $is_rel_imgage = false;
            $weibo_img = '';
            $weibo_img_sort = 100000;
            $photo_count = 0;
            $server_args = array();
            FS("Image")->getImageArgs(&$server_args);
            //保存分享图片
            $share_photo = $data['share_photo'];
            foreach ($share_photo as $k => $photo) {
                if ($photo_count >= $_FANWE['setting']['share_pic_count']) {
                    break;
                }
                $o_img = false;
                if (FS("Image")->getIsServer() && !empty($photo['server_code'])) {
                    $server = FS("Image")->getServer($photo['server_code']);
                    if (!empty($server)) {
                        $server_args['share_id'] = $share_id;
                        $server_args['img_path'] = $photo['img'];
                        $server = FS("Image")->getImageUrlToken($server_args, $server, 1);
                        $body = FS("Image")->sendRequest($server, 'saveshare', true);
                        if (!empty($body)) {
                            $o_img = unserialize($body);
                            FS("Image")->setServerUploadCount($o_img['server_code']);
                            $share_server_code[] = $o_img['server_code'];
                            $o_img['url'] = str_replace('./', './' . $o_img['server_code'] . '/', $o_img['url']);
                            $weibo_img_url = FS("Image")->getImageUrl($o_img['url'], 1);
                        }
                    }
                } else {
                    $o_img = copyImage($photo['img'], array(), 'share', true, $share_id);
                    $weibo_img_url = FS("Image")->getImageUrl($o_img['url'], 1);
                }
                if (!empty($o_img)) {
                    if ($photo['sort'] < $weibo_img_sort) {
                        $weibo_img = $weibo_img_url;
                        $weibo_img_sort = $photo['sort'];
                    }
                    $share_photo_data['uid'] = $_FANWE['uid'];
                    $share_photo_data['share_id'] = $share_id;
                    $share_photo_data['img'] = $o_img['url'];
                    $share_photo_data['type'] = $photo['type'];
                    $share_photo_data['sort'] = $photo['sort'];
                    $share_photo_data['img_width'] = $o_img['width'];
                    $share_photo_data['img_height'] = $o_img['height'];
                    $share_photo_data['server_code'] = $photo['server_code'];
                    FDB::insert('share_photo', $share_photo_data, true);
                    $photo_count++;
                }
            }
            //保存引用图片
            if (isset($data['rel_photo'])) {
                $share_photo = $data['rel_photo'];
                foreach ($share_photo as $share_photo_data) {
                    if ($photo_count >= $_FANWE['setting']['share_pic_count']) {
                        break;
                    }
                    $is_rel_imgage = true;
                    if ($share_photo_data['sort'] < $weibo_img_sort) {
                        $weibo_img = FS("Image")->getImageUrl($share_photo_data['img'], 1);
                        $weibo_img_sort = $share_photo_data['sort'];
                    }
                    $share_photo_data['uid'] = $_FANWE['uid'];
                    $share_photo_data['share_id'] = $share_id;
                    FDB::insert('share_photo', $share_photo_data, true);
                    $photo_count++;
                }
            }
            $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);
                    }
                    if (!empty($goods_img)) {
                        if ($goods['sort'] < $weibo_img_sort) {
                            $weibo_img = $weibo_img_url;
                            $weibo_img_sort = $goods['sort'];
                        }
                        $shop_id = intval($shop_id);
                        //开始保存分享的商品
                        $share_goods_data['uid'] = $_FANWE['uid'];
                        $share_goods_data['share_id'] = $share_id;
                        $share_goods_data['shop_id'] = $shop_id;
                        $share_goods_data['img'] = $goods_img['url'];
                        $share_goods_data['name'] = $goods['name'];
                        $share_goods_data['url'] = $goods['url'];
                        $share_goods_data['price'] = $goods['price'];
                        $share_goods_data['sort'] = $goods['sort'];
                        $share_goods_data['taoke_url'] = $goods['taoke_url'];
                        $share_goods_data['goods_key'] = $goods['goods_key'];
                        $share_goods_data['img_width'] = $goods_img['width'];
                        $share_goods_data['img_height'] = $goods_img['height'];
                        $share_goods_data['server_code'] = $goods['server_code'];
                        FDB::insert('share_goods', $share_goods_data, true);
                        $goods_tags = FS('Words')->segment($goods['name'], 10);
                        if (!empty($goods_tags)) {
                            $share_cates[] = ShareService::getCateByTags($goods_tags);
                        }
                        $content_match .= $goods['name'];
                        $goods_count++;
                    }
                }
            }
            //保存引用商品
            if (isset($data['rel_goods'])) {
                $share_goods = $data['rel_goods'];
                foreach ($share_goods as $share_goods_data) {
                    if ($goods_count >= $_FANWE['setting']['share_goods_count']) {
                        break;
                    }
                    $is_rel_imgage = true;
                    $shop_ids[] = $share_goods_data['shop_id'];
                    if ($share_goods_data['sort'] < $weibo_img_sort) {
                        $weibo_img = $weibo_img = FS("Image")->getImageUrl($share_goods_data['img'], 1);
                        $weibo_img_sort = $share_goods_data['sort'];
                    }
                    $share_goods_data['uid'] = $_FANWE['uid'];
                    $share_goods_data['share_id'] = $share_id;
                    FDB::insert('share_goods', $share_goods_data, true);
                    $goods_tags = FS('Words')->segment($goods['name'], 10);
                    if (!empty($goods_tags)) {
                        $share_cates[] = ShareService::getCateByTags($goods_tags);
                    }
                    $content_match .= $goods['name'];
                    $goods_count++;
                }
            }
            if ($goods_count > 0 && $photo_count > 0) {
                $share_data_type = 'goods_photo';
            } elseif ($goods_count > 0) {
                $share_data_type = 'goods';
            } elseif ($photo_count > 0) {
                $share_data_type = 'photo';
            } else {
                $share_data_type = 'default';
            }
            $update_share = array();
            $update_share['share_data'] = $share_data_type;
            if (count($share_server_code) > 0) {
                $share_server_code = array_unique($share_server_code);
                $update_share['server_code'] = implode(',', $share_server_code);
            }
            if ($share_album_id > 0 && in_array($share_data_type, array('goods', 'photo', 'goods_photo'))) {
                $album = FDB::fetchFirst('SELECT cid,id,title FROM ' . FDB::table('album') . ' WHERE id = ' . $share_album_id);
                if ($album) {
                    $update_share['type'] = 'album_item';
                    $share_data_now_type = 'album_item';
                    $share_data_rec_id = $album['id'];
                    $share_data_rec_cate = $album['cid'];
                    $update_share['rec_id'] = $album['id'];
                    $update_share['title'] = addslashes($album['title']);
                } else {
                    $update_share['rec_id'] = 0;
                    $share_data_rec_id = 0;
                }
            } else {
                $share_data_rec_id = 0;
            }
            FDB::update("share", $update_share, "share_id=" . $share_id);
            //更新会员统计
            FDB::query('UPDATE ' . FDB::table('user_count') . '
				SET shares = shares + 1,goods = goods + ' . $goods_count . ',photos = photos + ' . $photo_count . '
				WHERE uid = ' . $share_data['uid']);
            FS('Medal')->runAuto($share_data['uid'], 'shares');
            FS('User')->medalBehavior($share_data['uid'], 'continue_share');
            switch ($share_data_type) {
                case 'goods_photo':
                    FS('Medal')->runAuto($share_data['uid'], 'goods');
                    FS('User')->medalBehavior($share_data['uid'], 'continue_goods');
                    FS('Medal')->runAuto($share_data['uid'], 'photos');
                    FS('User')->medalBehavior($share_data['uid'], 'continue_photo');
                    break;
                case 'goods':
                    FS('Medal')->runAuto($share_data['uid'], 'goods');
                    FS('User')->medalBehavior($share_data['uid'], 'continue_goods');
                    break;
                case 'photo':
                    FS('Medal')->runAuto($share_data['uid'], 'photos');
                    FS('User')->medalBehavior($share_data['uid'], 'continue_photo');
                    break;
            }
            if (in_array($share_data_type, array('goods', 'photo', 'goods_photo'))) {
                //更新会员发布的有图分享编号
                //FS('User')->setShareIds($share_data['uid'],$share_id);
                if (!empty($share_cates)) {
                    $cids = ShareService::getCidsByCates($share_cates);
                }
                if (!empty($data['share_tag'])) {
                    if (empty($cids)) {
                        $share_cates = array();
                        $share_cates[] = ShareService::getCateByTags($data['share_tag']);
                        $cids = ShareService::getCidsByCates($share_cates);
                    }
                    //$content_match = array_merge($content_match, $data['share_tag']);
                }
                //保存标签
                $share_tags = array();
                foreach ($data['share_tag'] as $tag) {
                    if (trim($tag) != '' && !in_array($tag, $share_tags)) {
                        array_push($share_tags, $tag);
                        //为已存在的tags更新统计
                        FDB::query('UPDATE ' . FDB::table('goods_tags') . '
							SET count = count + 1
							WHERE tag_name = \'' . $tag . '\'');
                        //数量大于100时为热门标签
                        FDB::query('UPDATE ' . FDB::table('goods_tags') . '
							SET is_hot = 1
							WHERE tag_name = \'' . $tag . '\' AND count >= 100');
                        $content_match .= $tag;
                        $tag_data = array();
                        $tag_data['share_id'] = $share_id;
                        $tag_data['tag_name'] = $tag;
                        FDB::insert('share_tags', $tag_data);
                    }
                }
                unset($share_tags);
                if (!empty($cids)) {
                    foreach ($cids as $cid) {
                        $cate_data = array();
                        $cate_data['share_id'] = $share_id;
                        $cate_data['cate_id'] = $cid;
                        FDB::insert('share_category', $cate_data);
                    }
                }
                //保存匹配查询
                $share_match['share_id'] = $share_id;
                $share_match['content_match'] = segmentToUnicode(clearSymbol($content_match));
                FDB::insert("share_match", $share_match);
            }
            ShareService::updateShareCache($share_id);
            if ($share_data_rec_id > 0) {
                $album_share = array();
                $album_share['album_id'] = $share_data_rec_id;
                $album_share['share_id'] = $share_id;
                $album_share['cid'] = $share_data_rec_cate;
                $album_share['create_day'] = getTodayTime();
                FDB::insert("album_share", $album_share);
                FS('Album')->updateAlbumByShare($share_data_rec_id, $share_id);
                FS('Album')->updateAlbum($share_data_rec_id);
            }
            if (count($shop_ids) > 0) {
                FS("Shop")->updateShopStatistic($shop_ids);
            }
            //保存提到我的
            $atme_share_type = FDB::resultFirst("select `type` from " . FDB::table("share") . " where `share_id`='" . $share_id . "'");
            if ($atme_share_type != "fav") {
                $atme_list = array();
                $pattern = "/@([^\f\n\r\t\v@ ]{2,20}?)(?:\\:| )/";
                preg_match_all($pattern, $share_data['content'], $atme_list);
                if (!empty($atme_list[1])) {
                    $atme_list[1] = array_unique($atme_list[1]);
                    $users = array();
                    foreach ($atme_list[1] as $user) {
                        if (!empty($user)) {
                            $users[] = $user;
                        }
                    }
                    $res = FDB::query('SELECT uid 
						FROM ' . FDB::table('user') . '
						WHERE user_name ' . FDB::createIN($users));
                    while ($data = FDB::fetch($res)) {
                        FS("User")->setUserTips($data['uid'], 4, $share_id);
                    }
                }
            }
            if ($is_score && !in_array($share_data_now_type, array('fav', 'album_best', 'album_rec'))) {
                if (!$is_rel_imgage && in_array($share_data_type, array('goods', 'photo', 'goods_photo'))) {
                    FS("User")->updateUserScore($share_data['uid'], 'share', 'image', $share_data['content'], $share_id);
                } else {
                    FS("User")->updateUserScore($share_data['uid'], 'share', 'default', $share_data['content'], $share_id);
                }
            }
            if ($data['pub_out_check']) {
                $weibo = array();
                $weibo['content'] = $share_data['content'];
                $weibo['img'] = $weibo_img;
                $weibo['ip'] = $_FANWE['client_ip'];
                $weibo['url'] = $_FANWE['site_url'] . FU('note/index', array('sid' => $share_id));
                $weibo['url'] = str_replace('//', '/', $weibo['url']);
                $weibo['url'] = str_replace(':/', '://', $weibo['url']);
                $weibo = base64_encode(serialize($weibo));
                if (empty($share_data['type'])) {
                    $share_data['type'] = 'default';
                }
                //转发到外部微博
                $uid = $_FANWE['uid'];
                $user_binds = FS("User")->getUserBindList($uid);
                $is_open = false;
                foreach ($user_binds as $class => $bind) {
                    if ($bind['sync'] && file_exists(FANWE_ROOT . "login/" . $class . ".php")) {
                        $check_field = "";
                        if (in_array($share_data['type'], array('bar', 'ask'))) {
                            $check_field = "topic";
                        } elseif ($share_data['type'] == 'default') {
                            $check_field = "weibo";
                        }
                        if ($bind['sync'][$check_field] == 1) {
                            $is_open = true;
                            //开始推送
                            $schedule['uid'] = $uid;
                            $schedule['type'] = $class;
                            $schedule['data'] = $weibo;
                            $schedule['pub_time'] = TIME_UTC;
                            FDB::insert('pub_schedule', $schedule, true);
                        }
                    }
                }
                if ($is_open) {
                    $fp = fsockopen($_SERVER['HTTP_HOST'], 80, &$errno, &$errstr, 5);
                    if ($fp) {
                        $request = "GET " . SITE_URL . "login.php?loop=true&uid=" . $uid . " HTTP/1.0\r\n";
                        $request .= "Host: " . $_SERVER['HTTP_HOST'] . "\r\n";
                        $request .= "Connection: Close\r\n\r\n";
                        fwrite($fp, $request);
                        while (!feof($fp)) {
                            fgets($fp, 128);
                            break;
                        }
                        fclose($fp);
                    }
                }
            }
        } else {
            $result['status'] = false;
        }
        return $result;
    }
예제 #15
0
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);
 }


}
예제 #16
0
function restoreDevelopmentConfigFile()
{
    copyFile('config.ini', 'config.test.ini');
    copyFile('config.development.ini', 'config.ini');
}
예제 #17
0
	function saveFile() {
		GLOBAL $app;

		if (isset($this->ftp_name) && $this->ftp_name!='') {
		// WORK WITH FTP UPLOAD FILE
			$server_file_name = basename($this->ftp_name);
			$server_file = SYS_ROOT.$this->ftp_name;

			// check file
			if (!file_exists($server_file)) {
				$app->setError('File you selected was not found on ftp. Please check it.');
				return '';
			}

			// create folder(s) if not exist(s)
			if (!file_exists($this->path)) {
				createDir($this->path);
			}

			if (!copyFile($server_file, $this->path.'/'.$this->id.'_'.$server_file_name, '0777')) {
				return '';
			}

			return $server_file_name;

		} else {
		// WORK WITH UPLOADED FROM USER'S COMPUTER FILE
			if (!isset($_FILES[$this->field_name]['name']) && !isset($_FILES[$this->field_name]['tmp_name'])) {
				return '';	// no file where uploaded
			}

			$real_name = $_FILES[$this->field_name]['name'];
			$tmp_name = $_FILES[$this->field_name]['tmp_name'];

			$bad_format = false;
			if ($real_name != '' && !is_uploaded_file($tmp_name)) {
				$app->setError('File is not received');
				return '';
			}

			if (filesize($tmp_name)>$this->max_size) {
				$app->setError('File is too large.');
				return '';
			}

			// create folder(s) if not exist(s)
			if (!file_exists($this->path)) {
				createDir($this->path);
			}

			if (!copyFile($tmp_name, $this->path.'/'.$this->id.'_'.$real_name, '0777')) {
				return '';
			}

			return $real_name;
		}
	}
예제 #18
0
function copyHtmlToWeb()
{
    $webDir = '';
    $toWebDir = '';
    $toFilePath = '';
    $filePath = '';
    $fileName = '';
    $fileList = '';
    $splStr = '';
    $content = '';
    $s = '';
    $s1 = '';
    $c = '';
    $webImages = '';
    $webCss = '';
    $webJs = '';
    $splJs = '';
    $webFolderName = '';
    $jsFileList = '';
    $setFileCode = '';
    $nErrLevel = '';
    $jsFilePath = '';
    $url = '';
    $setFileCode = @$_REQUEST['setcode'];
    //设置文件保存编码
    handlePower('复制生成HTML页面');
    //管理权限处理
    writeSystemLog('', '复制生成HTML页面');
    //系统日志
    $webFolderName = $GLOBALS['cfg_webTemplate'];
    if (left($webFolderName, 1) == '/') {
        $webFolderName = mid($webFolderName, 2, -1);
    }
    if (right($webFolderName, 1) == '/') {
        $webFolderName = mid($webFolderName, 1, len($webFolderName) - 1);
    }
    if (inStr($webFolderName, '/') > 0) {
        $webFolderName = mid($webFolderName, inStr($webFolderName, '/') + 1, -1);
    }
    $webDir = '/htmladmin/' . $webFolderName . '/';
    $toWebDir = '/htmlw' . 'eb/viewweb/';
    CreateDirFolder($toWebDir);
    $toWebDir = $toWebDir . pinYin2($webFolderName) . '/';
    deleteFolder($toWebDir);
    //删除
    CreateFolder('/htmlweb/web');
    //创建文件夹 防止web文件夹不存在20160504
    deleteFolder($webDir);
    CreateDirFolder($webDir);
    $webImages = $webDir . 'Images/';
    $webCss = $webDir . 'Css/';
    $webJs = $webDir . 'Js/';
    copyFolder($GLOBALS['cfg_webImages'], $webImages);
    copyFolder($GLOBALS['cfg_webCss'], $webCss);
    CreateFolder($webJs);
    //创建Js文件夹
    //处理Js文件夹
    $splJs = aspSplit(getDirJsList($webJs), vbCrlf());
    foreach ($splJs as $key => $filePath) {
        if ($filePath != '') {
            $toFilePath = $webJs . getFileName($filePath);
            aspEcho('js', $filePath);
            moveFile($filePath, $toFilePath);
        }
    }
    //处理Css文件夹
    $splStr = aspSplit(getDirCssList($webCss), vbCrlf());
    foreach ($splStr as $key => $filePath) {
        if ($filePath != '') {
            $content = getFText($filePath);
            $content = replace($content, $GLOBALS['cfg_webImages'], '../images/');
            $content = deleteCssNote($content);
            $content = PHPTrim($content);
            //设置为utf-8编码 20160527
            if (lCase($setFileCode) == 'utf-8') {
                $content = replace($content, 'gb2312', 'utf-8');
            }
            WriteToFile($filePath, $content, $setFileCode);
            aspEcho('css', $GLOBALS['cfg_webImages']);
        }
    }
    //复制栏目HTML
    $GLOBALS['isMakeHtml'] = true;
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'webcolumn where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_filePath'] = replace(getColumnUrl($rss['columnname'], 'name'), $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('导航', $GLOBALS['glb_filePath']);
        }
    }
    //复制文章HTML
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'articledetail where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_url'] = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/detail/detail' . $rss['id']);
        $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('文章' . $rss['title'], $GLOBALS['glb_filePath']);
        }
    }
    //复制单面HTML
    $rssObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'onepage where isonhtml=true');
    while ($rss = $GLOBALS['conn']->fetch_array($rssObj)) {
        $GLOBALS['glb_url'] = getHandleRsUrl($rss['filename'], $rss['customaurl'], '/page/page' . $rss['id']);
        $GLOBALS['glb_filePath'] = replace($GLOBALS['glb_url'], $GLOBALS['cfg_webSiteUrl'] . '/', '');
        if (right($GLOBALS['glb_filePath'], 1) == '/' || right($GLOBALS['glb_filePath'], 1) == '') {
            $GLOBALS['glb_filePath'] = $GLOBALS['glb_filePath'] . 'index.html';
        }
        if (right($GLOBALS['glb_filePath'], 5) == '.html') {
            if (right($GLOBALS['glb_filePath'], 11) == '/index.html') {
                $fileList = $fileList . $GLOBALS['glb_filePath'] . vbCrlf();
            } else {
                $fileList = $GLOBALS['glb_filePath'] . vbCrlf() . $fileList;
            }
            $fileName = replace($GLOBALS['glb_filePath'], '/', '_');
            $toFilePath = $webDir . $fileName;
            copyFile($GLOBALS['glb_filePath'], $toFilePath);
            aspEcho('单页' . $rss['title'], $GLOBALS['glb_filePath']);
        }
    }
    //批量处理html文件列表
    //call echo(cfg_webSiteUrl,cfg_webTemplate)
    //call rwend(fileList)
    $sourceUrl = '';
    $replaceUrl = '';
    $splStr = aspSplit($fileList, vbCrlf());
    foreach ($splStr as $key => $filePath) {
        if ($filePath != '') {
            $filePath = $webDir . replace($filePath, '/', '_');
            aspEcho('filePath', $filePath);
            $content = getFText($filePath);
            foreach ($splStr as $key => $s) {
                $s1 = $s;
                if (right($s1, 11) == '/index.html') {
                    $s1 = left($s1, len($s1) - 11) . '/';
                }
                $sourceUrl = $GLOBALS['cfg_webSiteUrl'] . $s1;
                $replaceUrl = $GLOBALS['cfg_webSiteUrl'] . replace($s, '/', '_');
                //Call echo(sourceUrl, replaceUrl) 							'屏蔽  否则大量显示20160613
                $content = replace($content, $sourceUrl, $replaceUrl);
            }
            $content = replace($content, $GLOBALS['cfg_webSiteUrl'], '');
            //删除网址
            $content = replace($content, $GLOBALS['cfg_webTemplate'] . '/', '');
            //删除模板路径 记
            //content=nullLinkAddDefaultName(content)
            foreach ($splJs as $key => $s) {
                if ($s != '') {
                    $fileName = getFileName($s);
                    $content = replace($content, 'Images/' . $fileName, 'js/' . $fileName);
                }
            }
            if (inStr($content, '/Jquery/Jquery.Min.js') > 0) {
                $content = replace($content, '/Jquery/Jquery.Min.js', 'js/Jquery.Min.js');
                copyFile('/Jquery/Jquery.Min.js', $webJs . '/Jquery.Min.js');
            }
            $content = replace($content, '<a href="" ', '<a href="index.html" ');
            //让首页加index.html
            createFileGBK($filePath, $content);
        }
    }
    //把复制网站夹下的images/文件夹下的js移到js/文件夹下  20160315
    $htmlFileList = '';
    $splHtmlFile = '';
    $splJsFile = '';
    $htmlFilePath = '';
    $jsFileName = '';
    $jsFileList = getDirJsNameList($webImages);
    $htmlFileList = getDirHtmlList($webDir);
    $splHtmlFile = aspSplit($htmlFileList, vbCrlf());
    $splJsFile = aspSplit($jsFileList, vbCrlf());
    foreach ($splHtmlFile as $key => $htmlFilePath) {
        $content = getFText($htmlFilePath);
        foreach ($splJsFile as $key => $jsFileName) {
            $content = regExp_Replace($content, 'Images/' . $jsFileName, 'js/' . $jsFileName);
        }
        $nErrLevel = 0;
        $content = handleHtmlFormatting($content, false, $nErrLevel, '|删除空行|');
        //|删除空行|
        $content = handleCloseHtml($content, true, '');
        //闭合标签
        $nErrLevel = checkHtmlFormatting($content);
        if (checkHtmlFormatting($content) == false) {
            echoRed($htmlFilePath . '(格式化错误)', $nErrLevel);
            //注意
        }
        //设置为utf-8编码
        if (lCase($setFileCode) == 'utf-8') {
            $content = replace($content, '<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />', '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
        }
        $content = PHPTrim($content);
        WriteToFile($htmlFilePath, $content, $setFileCode);
    }
    //images下js移动到js下
    foreach ($splJsFile as $key => $jsFileName) {
        $jsFilePath = $webImages . $jsFileName;
        $content = getFText($jsFilePath);
        $content = PHPTrim($content);
        WriteToFile($webJs . $jsFileName, $content, $setFileCode);
        DeleteFile($jsFilePath);
    }
    copyFolder($webDir, $toWebDir);
    //使htmlWeb文件夹用php压缩
    if (@$_REQUEST['isMakeZip'] == '1') {
        makeHtmlWebToZip($webDir);
    }
    //使网站用xml打包20160612
    if (@$_REQUEST['isMakeXml'] == '1') {
        makeHtmlWebToXmlZip('/htmladmin/', $webFolderName);
    }
    //浏览地址
    $url = 'http://10.10.10.57/' . $toWebDir;
    aspEcho('浏览', '<a href=\'' . $url . '\' target=\'_blank\'>' . $url . '</a>');
}
예제 #19
0
            break;
        case 'prod':
            $envName = "Production";
            break;
    }
}
if (!in_array($envName, ['Development', 'Production'])) {
    echo "Wrong environemnt choosen.";
    die;
}
$env = $envs[$envName];
echo "\n  Start initialization ...\n\n";
// Copy all files to respective directories
$files = getFileList("{$root}/environments/{$env['path']}");
foreach ($files as $file) {
    if (!copyFile($root, "environments/{$env['path']}/{$file}", $file)) {
        break;
    }
}
// Set the CSRF keys
$callbacks = ['setCookieValidationKey', 'setWritable', 'setExecutable'];
foreach ($callbacks as $callback) {
    if (!empty($env[$callback])) {
        $callback($root, $env[$callback]);
    }
}
echo "\n  ... initialization completed.\n\n";
function getFileList($root, $basePath = '')
{
    $files = [];
    $handle = opendir($root);
예제 #20
0
				}
				
				
				for($i = 1; $i <= 12; $i++)
				{				
					$file = "uploadedfile" . $i;
					
					if(is_uploaded_file($_FILES[$file]['tmp_name']))
					{	
						/* normal for apartment's page */	

						$target_dir = "../pictures/apartments/".$_GET['apartmentid']."";
						
						$new_number = substr((getHighestNumberInDir($target_dir)+1)+100,1);
						$new_name = $new_number ."_(395x330).jpg";
						copyFile($_FILES[$file]['tmp_name'], $new_name);				
						
						/* thumb for apartments page */					
						$dst_image = imagecreatetruecolor(54, 36);
						$src_image = imagecreatefromjpeg($_FILES[$file]['tmp_name']);						
						imagecopyresampled($dst_image, $src_image, 0, 0, 0, 0, 54, 36, 495, 330);
						$new_name = $new_number ."_(54x36).jpg";
						imagejpeg($dst_image, $target_dir ."/".$new_name, 100);				
						imagedestroy($dst_image); imagedestroy($src_image);
						
						/* thumb for list */
						$dst_image = imagecreatetruecolor(135, 90);
						$src_image = imagecreatefromjpeg($_FILES[$file]['tmp_name']);						
						imagecopyresampled($dst_image, $src_image, 0, 0, 0, 0, 135, 90, 495, 330);
						$new_name = $new_number ."_(135x90).jpg";
						imagejpeg($dst_image, $target_dir ."/".$new_name, 100);				
예제 #21
0
<?php

require_once '../dir.func.php';
require_once '../file.func.php';
require_once '../common.func.php';
//目标目录
$mubiaopath = "../" . $_POST['mubiaopath'];
//原路径
$sourcepath = $_POST['path'];
//文件名
$filename = "../" . $_POST['filename'];
//echo $filename;die();
$mes = copyFile($filename, $mubiaopath);
echo "<script>parent.location.href='../file_gl.php?path=" . $sourcepath . "&info=" . $mes . "'</script>";
    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;
        }
        //http://container.open.taobao.com/container?appkey=12324287&encode=utf-8
        $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;
        }
        $image = copyFile($goods['pic_url'], "temp", md5(microtime(true)) . random('6') . ".jpg", false);
        if ($image === false) {
            return false;
        }
        $result['item']['key'] = $key;
        $result['item']['name'] = $goods['title'];
        $result['item']['price'] = $goods['price'];
        $result['item']['img'] = $image['url'];
        $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'])) {
                    $image = copyFile('http://logo.taobao.com/shop-logo' . $shop['pic_path'], "temp", md5(microtime(true)) . random('6') . ".jpg", false);
                    if ($image !== false) {
                        $result['shop']['logo'] = $image['url'];
                    }
                }
                $result['shop']['shop_id'] = $shop['sid'];
                $result['shop']['url'] = 'http://shop' . $shop['sid'] . '.taobao.com';
                if (!empty($shop_click_url)) {
                    $result['shop']['taoke_url'] = $shop_click_url;
                }
            }
        }
        return $result;
    }
예제 #23
0
checkFile("_conf/my.cnf", "Required file is missing from your configuration source");
checkFile("_conf/httpd-vhosts.conf", "Required file is missing from your configuration source");
checkFile("_conf/php.ini", "Required file is missing from your configuration source");
checkFile("_conf/apache.conf", "Required file is missing from your configuration source");
checkFile("~/.bash_profile", "Required file is missing from home directory");
output("\nCopying configuration");
// copy base configuration
copyFile("_conf/httpd.conf", "/opt/local/apache2/conf/httpd.conf", "sudo");
copyFile("_conf/httpd-vhosts.conf", "/opt/local/apache2/conf/extra/httpd-vhosts.conf", "sudo");
// copy apache log rotation conf
copyFile("_conf/newsyslog-apache.conf", "/etc/newsyslog.d/apache.conf", "sudo");
// copy php.ini
copyFile("_conf/php.ini", "/opt/local/etc/php55/php.ini", "sudo");
// copy my.cnf for MySQL (to override macports settings)
copyFile("_conf/my.cnf", "/opt/local/etc/mysql56/my.cnf", "sudo");
// copy php.ini.default for native configuration
copyFile("_conf/php_ini_native.ini", "/etc/php.ini", "sudo");
// copy wkhtmltox static executables
copyFile("_conf/static_wkhtmltoimage", "/usr/local/bin/static_wkhtmltoimage", "sudo");
copyFile("_conf/static_wkhtmltopdf", "/usr/local/bin/static_wkhtmltopdf", "sudo");
output("\nConfiguration copied");
// Add alias' to .bash_profile
checkFileContent("~/.bash_profile", "_conf/bash_profile.default");
// Add local domains to /etc/hosts
command("sudo chmod 777 /etc/hosts");
checkFileContent("/etc/hosts", "_conf/hosts.default");
command("sudo chmod 644 /etc/hosts");
// restart apache
command("sudo /opt/local/apache2/bin/apachectl restart");
// DONE
output("\n\nUpdate is completed - please restart your terminal");
    } else {
        $db->query("INSERT INTO hlstats_Games (code,name,hidden,realgame) SELECT '{$game2}', '{$game2name}', '0', realgame FROM hlstats_Games WHERE code='{$game1}'");
        echo 'OK</li>';
        $dbtables = array();
        array_push($dbtables, 'hlstats_Actions', 'hlstats_Awards', 'hlstats_Ribbons', 'hlstats_Ranks', 'hlstats_Roles', 'hlstats_Teams', 'hlstats_Weapons');
        foreach ($dbtables as $dbt) {
            echo "<li>{$dbt} ... ";
            echo copySettings($dbt, $game1, $game2);
        }
        echo '</ul><br /><br /><br />';
        echo '<ul>';
        $files = array(array('', ''));
        scanCopyFiles("{$game1}/", "{$game2}/");
        foreach ($files as $f) {
            echo '<li>';
            echo copyFile($f[0], $f[1]);
        }
        echo '</ul><br /><br /><br />';
        echo 'Done.<br /><br />';
    }
} else {
    $result = $db->query("SELECT code, name FROM hlstats_Games ORDER BY code;");
    unset($games);
    $games[] = '<option value="" selected="selected">Please select</option>';
    while ($rowdata = $db->fetch_row($result)) {
        $games[] = "<option value=\"{$rowdata['0']}\">{$rowdata['0']} - {$rowdata['1']}</option>";
    }
    ?>

<form method="post">
<table width="60%" align="center" border="0" cellspacing="0" cellpadding="0" class="border">
function convertAndCreate($convertedData)
{
    switch ($convertedData['fileType']) {
        case 'pdf':
            //pp($convertedData['rowNumber'].' - pdf');
            copyFile($convertedData);
            //logFileBasic("Please check File Type -> ".$convertedData['previousLocation'],$rowNumber);
            break;
        case 'tif':
            //pp($convertedData['rowNumber'].' - tif');
            convertTifToPdf($convertedData);
            break;
        case 'dwg':
            //pp($convertedData['rowNumber'].' - dwg');
            copyFile($convertedData);
            break;
        default:
            logFileBasic("Please check File Type -> " . $convertedData['previousLocation'], $convertedData['rowNumber']);
            //pp('burp');
            break;
    }
}
예제 #26
0
     if ($_FILES[$f['nome']]['tmp_name'] != '' && !isset($f['diretta'])) {
         $nome = ins_foto($_FILES[$f['nome']], $_GET['cosa'] . $i, $descrizione);
     } elseif ($_FILES[$f['nome']]['tmp_name'] != '' && isset($f['diretta'])) {
         $nome = ins_file($_FILES[$f['nome']], $_GET['cosa'] . $i, $descrizione);
     } else {
         $nome = '';
     }
     if (substr($_GET['cosa'], $nome) || $nome == '') {
         $i++;
         mysql_query("update " . $_GET['cosa'] . " set " . $f['nome'] . "='" . $nome . "' where id_" . $_GET['cosa'] . "='" . $id_modello . "'") or die(mysql_error());
     }
 }
 if (isset($file)) {
     foreach ($file as $fi) {
         $newName = 'file_' . $id_modello;
         $nome = copyFile($_FILES[$fi['nome']], $newName);
         if ($nome !== false) {
             $i++;
             mysql_query("update " . $_GET['cosa'] . " set " . $fi['nome'] . "='" . $nome . "' where id_" . $_GET['cosa'] . "='" . $id_modello . "'") or die(mysql_error());
         }
     }
 }
 if ($i == count($foto) + count($file)) {
     if (isset($_GET['url'])) {
         header('Location: ../../' . $_GET['url'] . '?ins=ok&cosa=' . $_GET['cosa']);
         exit;
     } elseif (isset($_POST['url'])) {
         header('Location: ../../' . $dove . '/' . $_POST['url']);
         exit;
     } else {
         header("Location: ../../" . $dove . "/inserisci.php?ins=ok&cosa=" . $_GET['cosa']);
예제 #27
0
<?php

require_once '../dir.func.php';
require_once '../file.func.php';
require_once '../common.func.php';
//目标目录
$mubiaopath = "../" . $_POST['mubiaopath'];
//原路径
$sourcepath = $_POST['path'];
//文件名
$folderp = $_REQUEST['folderp'];
$filep = $_REQUEST['filep'];
$folderp1 = explode(",", $folderp);
$filep1 = explode(",", $filep);
for ($i = 0; $i < count($folderp1); $i++) {
    copyFolder("../" . $folderp1[$i], $mubiaopath . "/" . basename("../" . $folderp1[$i]));
}
for ($i1 = 0; $i1 < count($filep1); $i1++) {
    copyFile("../" . $filep1[$i1], $mubiaopath);
}
echo "<script>parent.location.href='../file_gl.php?path=" . $sourcepath . "&info=操作成功'</script>";
예제 #28
0
function insertArchivoContenido(stdClass $subtema)
{
    $return = array('success' => false, 'lastInsertId' => 0);
    if (!empty($subtema)) {
        $TipoProducto = getTipoProducto($subtema->TipoTema, $subtema->TipoSubtema);
        $dataInsert = array('Nombre' => $subtema->TituloArticulo, 'TipoProducto' => $TipoProducto, 'Categoria' => 1, 'Formato' => validFormato($subtema->Formato), 'Archivo' => $subtema->NombreArchivo, 'Embebido' => $subtema->ContenidoArticulo, 'Entidad' => $subtema->EntidadCreadora, 'Usuario' => $subtema->Codigo, 'FechReg' => date('Y-m-d H:i:s'));
        if ($subtema->TipoTema == 'Documento' || $subtema->TipoTema == 'Video') {
            $file = copyFile($subtema);
            if ($file->success) {
                $return = insert('archivocontenido', $dataInsert);
                $dataInsert['EmpresaNombre'] = $subtema->EmpresaNombre;
                $dataInsert['UsuarioNombre'] = $subtema->username;
                $dataInsert['userEmail'] = $subtema->Usuario;
                $dataInsert['id'] = $return['lastInsertId'];
                $return['data'] = (object) $dataInsert;
            }
        } elseif ($subtema->TipoTema == 'Embebido') {
            $return = insert('archivocontenido', $dataInsert);
            $dataInsert['EmpresaNombre'] = $subtema->EmpresaNombre;
            $dataInsert['UsuarioNombre'] = $subtema->username;
            $dataInsert['userEmail'] = $subtema->Usuario;
            $dataInsert['id'] = $return['lastInsertId'];
            $return['data'] = (object) $dataInsert;
        }
    }
    return $return;
}
    public function fetch($url)
    {
        global $_FANWE;
        $id = $this->getID($url);
        if (empty($id)) {
            return false;
        }
        $key = '360buy_' . $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://www.360buy.com/product/" . $id . ".html");
        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("/<div id=\"preview\".*?>.*?<img.*?src=\"(.*?)\".*?jqimg=\"(.*?)\"\\/><\\/div>/", $content, $img);
        if (empty($img)) {
            return false;
        }
        @preg_match("/<strong class=\"price\"><img.*?src =\"(.*?)\"\\/><\\/strong>/", $content, $price);
        if (empty($price)) {
            return false;
        } else {
            $price = $this->getPrice($price[1]);
            if ($price === false) {
                return false;
            }
        }
        if (FS("Image")->getIsServer()) {
            $args = array();
            $args['pic_url'] = $img[2];
            $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[2], "temp", false);
            if ($image === false) {
                return false;
            }
            $image['server_code'] = '';
        }
        $result['item']['key'] = $key;
        $result['item']['name'] = strip_tags(trim($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://www.360buy.com/product/" . $id . ".html";
        $unionId = $_FANWE['cache']['business']['jdbuy']['unionId'];
        if (!empty($unionId)) {
            $result['item']['taoke_url'] = "http://click.union.360buy.com/JdClick/?unionId=" . $unionId . "&t=4&to=" . $result['item']['url'];
        }
        return $result;
    }
예제 #30
0
function copyFileDir()
{
    if ($_SESSION['adminType'] == 'sadmin') {
        $fileManPath = RAZOR_SADMIN_PATH;
    } else {
        $fileManPath = RAZOR_FILEMAN_PATH;
    }
    $dirSelected = '';
    if (isset($_POST['copyfile'])) {
        $copyFrom = $_POST['copyfile'];
    }
    if (isset($_POST['copydir'])) {
        $copyDir = $_POST['copydir'];
    }
    if (isset($_POST['dirselected'])) {
        $dirSelected = $_POST['dirselected'];
    }
    // copy file to directory //
    if (isset($copyFrom) && isset($dirSelected)) {
        $copyTo = $dirSelected . '/' . basename($copyFrom);
        if (!file_exists(getSystemRoot(RAZOR_ADMIN_FILENAME) . $fileManPath . $copyTo)) {
            copyFile($fileManPath . $copyFrom, $fileManPath . $copyTo);
        } else {
            MsgBox(lt('Error copying, filename already exists in chosen directory'), 'redbox');
        }
    }
    if (isset($copyDir) && isset($dirSelected)) {
        $copyTo = $dirSelected . '/' . basename($copyDir);
        if (!is_dir(getSystemRoot(RAZOR_ADMIN_FILENAME) . $fileManPath . $copyTo)) {
            if (copyDirR($fileManPath . $copyDir, $fileManPath . $copyTo)) {
                MsgBox(lt('Directory and contents copy complete'), 'greenbox');
            }
        } else {
            MsgBox(lt('Error copying, directory name already exists in chosen directory'), 'redbox');
        }
    }
}