$desp_long = preg_replace($preg2, '', $desp_long); if (empty($desp_long)) { //$preg_desp_long = '#<div\s*class="num_2">((?:.|\s)*?<table\s+border="1"\s+width="547">((?:.|\s)+?)</table>)#'; //preg_match($preg_desp_long, $html_page, $arr_desp_long); } //产品详细描述中的图片 if (!empty($desp_long)) { $preg_desp_img = '~<img\\s*src="([^"]+)"~'; preg_match_all($preg_desp_img, $desp_long, $arr_desp_img); //echo "<pre>";print_r($arr_desp_img); if (!empty($arr_desp_img[1])) { foreach ($arr_desp_img[1] as $desp_img) { $tmp_image_file = str_replace('http://www.myefox.com/images/', '', $desp_img); $tmp_image_file = str_replace('http://www.myefox.it/images/', '', $tmp_image_file); $tmp_image_file = preg_replace("#^images/#", "", $tmp_image_file); createDirIfNotExists($img_new_dir . $tmp_image_file); if (strpos($desp_img, 'http://') === false) { $desp_img = 'http://www.myefox.com/' . $desp_img; } $img_data = file_get_contents($desp_img); $tmp_image_file = str_replace('%20', ' ', $tmp_image_file); file_put_contents(DIR_WS_IMAGES . $img_new_dir . $tmp_image_file, $img_data); } } } $desp_long = str_replace('http://www.myefox.com/images/', HTTP_SERVER . DIR_WS_CATALOG . 'images/', $desp_long); $desp_long = str_replace('http://www.myefox.it/images/', HTTP_SERVER . DIR_WS_CATALOG . 'images/', $desp_long); if (empty($desp_long)) { //die('empty product description.'); } $insert_product_desp['products_description'] = $desp_long;
$remote_img_url = $remote_host . '/' . $pic_main; $local_img_url = './images/' . $save_img_dir . '/' . basename($pic_main); //保存产品主图 createDirIfNotExists($local_img_url); saveFile($remote_img_url, $local_img_url); $insert_product['products_image'] = '/images/' . $save_img_dir . '/' . basename($pic_main); //产品主图----end //产品详情图----begin $preg = '~<img src="([^"]+)" width="769" height="307" />~'; preg_match($preg, $content, $arr); //print_r($arr); $pic_desp = $arr[1]; $remote_img_url = $remote_host . '/' . $pic_desp; $local_img_url = './images/' . $save_img_dir . '/' . basename($pic_desp); //保存产品详情图 createDirIfNotExists($local_img_url); saveFile($remote_img_url, $local_img_url); //产品详情图----end //产品详情1 $preg = '~<td class="news3"> Product Specifications</td>(?:\\s|.)+?<td height="165" valign="top" style="color:#333333;">((?:\\s|.)+?)</td>~'; preg_match($preg, $content, $arr); $pro_desp = $arr[1]; //print_r($arr); //产品详情2 $preg = '~<td class="news3"> User Guide</td>(?:\\s|.)+?<td height="165" valign="top" style="color:#333333;">((?:\\s|.)+?)</td>~'; preg_match($preg, $content, $arr); $pro_desp2 = $arr[1]; //print_r($arr); $insert_product_desp['products_description'] = $pro_desp . $pro_desp2 . '<img src="/images/' . $save_img_dir . '/' . basename($pic_desp); //添加记录 addProductBackEver(array('products' => $insert_product, 'products_description' => $insert_product_desp, 'categories_id' => $products_cat));
echo "Running as:"; exec('/usr/bin/whoami 2>&1', $result); foreach ($result as $row) { echo $row, "\n"; } } //Create and flush assets directory rmdirRecursive(pth($root . "frontend/www/assets")); createDirIfNotExists(pth($root . "frontend/www/assets")); //Create and flush assets directory rmdirRecursive(pth($root . "backend/www/assets")); createDirIfNotExists(pth($root . "backend/www/assets")); // runtime createDirIfNotExists(pth($root . "frontend/runtime")); createDirIfNotExists(pth($root . "console/runtime")); createDirIfNotExists(pth($root . "backend/runtime")); //Setting permissions if (!$runningOnWindows) { chmod(pth($root . "frontend/runtime"), 02775); //permissions with setguid chmod(pth($root . "console/runtime"), 02775); chmod(pth($root . "backend/runtime"), 02775); chmod(pth($root . "frontend/www/assets"), 02775); chmod(pth($root . "backend/www/assets"), 02775); } //applying migrations //adding in ability to specify to not migrate even when not in local environment. Needed for our newclient script if ($envType != 'private' && !in_array('no-migrate', $argv) || in_array('migrate', $argv)) { runCommand(getPhpPath() . ' ' . $root . "yiic migrate --interactive=0"); if (in_array($envType, array('private', 'int', 'qa'))) { runCommand(getPhpPath() . ' ' . $root . "yiic migrate --interactive=0 --connectionID=testdb");
$result = array(); echo "Running as:"; exec('/usr/bin/whoami 2>&1', $result); foreach ($result as $row) { echo $row, "\n"; } } // Flush assets and create directory if not existing rmDirRecursive(pth($root . "frontend/www/assets")); createDirIfNotExists(pth($root . "frontend/www/assets")); rmDirRecursive(pth($root . "backend/www/assets")); createDirIfNotExists(pth($root . "backend/www/assets")); // runtime createDirIfNotExists(pth($root . "frontend/runtime")); createDirIfNotExists(pth($root . "backend/runtime")); createDirIfNotExists(pth($root . "console/runtime")); // permissions chmod(pth($root . "frontend/runtime"), 02777); // permissions with setguid chmod(pth($root . "backend/runtime"), 02777); chmod(pth($root . "console/runtime"), 02777); chmod(pth($root . "frontend/www/assets"), 02777); chmod(pth($root . "backend/www/assets"), 02777); //Copy *-environmnetName.php to *-env.php $directories = array(pth($root . "common/config/"), pth($root . "frontend/config/"), pth($root . "backend/config/"), pth($root . "console/config/")); // console //choose environment specific configs foreach ($directories as $dir) { $files = glob(pth($dir . "environments/" . "*-" . $envType . '.php')); foreach ($files as $srcFile) { $pattern = "/-" . $envType . ".php\$/";
$DIS_Application = "Save"; include INC_DIR . "layout_helper.inc"; include LIB_DIR . "date.inc"; require INC_DIR . "reporting_lib.inc"; $username = value_from_POST('username'); $week = value_from_POST('week'); $year = value_from_POST('year'); $op = value_from_POST('op'); if (isset($op)) { // echo "<BR>###".$op."###<BR>"; $has_confirmation = $op == "Confirmation"; if ($has_confirmation) { ob_start(); $report_content = stripslashes($_POST['report_content']); createDirIfNotExists($year); $target_file = userFilename($username, $year, $week); $DIS_SaveMessage = "Saving to {$target_file} <br/>"; postUserReport($username, $year, $week, $report_content); $DIS_SaveMessage .= ob_get_contents(); ob_end_clean(); $week_filename = weekFilename($year, $week); $week_url = weekUrl($year, $week); $DIS_SaveMessage .= "<br><a href='{$week_url}'>{$week_filename}</a><br>\n"; } else { switch ($op) { case "SaveUrl": @($reporturl = $_POST['reporturl']); if (!isset($reporturl) or $reporturl != "http://" or strlen($reporturl) > 0) { $report_content = ContentOfUrl($reporturl); }