/** * Show the form for editing the specified resource. * * @param string $permalink * @return Response */ public function edit($full_permalink) { $category = Category::where('full_permalink', '=', $full_permalink)->firstOrFail(); $template_options = Template::where('type', '=', '3')->get()->lists('name', 'id'); $data = ['category' => $category, 'options' => \App::make('WorkInProgress\\Blog\\ArticleController')->getHierarchy(0, 0, 'blog::partials.option', \Input::old('blog_category_id') ?: $category->blog_category_id), 'template_options' => $template_options]; //Grab the image URLs foreach ($this->image_labels as $key => $image_label) { $image = $category->images()->where('order', '=', $key + 1)->first(); $data[$image_label] = $image ? $image->src : null; } return \View::make('blog::category.edit', $data); }
/** * 获取用户详情 */ public function customerInfo() { $cus_id = Auth::id(); $customer = Auth::user()->name; $customer_info = CustomerInfo::where('cus_id', $cus_id)->first(); $data['company_name'] = $customer_info->company; $domain_pc = $customer_info->pc_domain; $data['domain_pc'] = str_replace('http://', '', $domain_pc); $domain_m = $customer_info->mobile_domain; $data['domain_m'] = str_replace('http://', '', $domain_m); if ($customer_info->favicon != '') { $data['favicon'] = asset('customers/' . $customer . '/images/l/common/' . $customer_info->favicon); } if ($customer_info->logo != '') { $data['logo_large'] = asset('customers/' . $customer . '/images/l/common/' . $customer_info->logo); } if ($customer_info->logo_small != '') { $data['logo_small'] = asset('customers/' . $customer . '/images/l/common/' . $customer_info->logo_small); } $data['pc_header_script'] = $customer_info->pc_header_script; $data['mobile_header_script'] = $customer_info->mobile_header_script; $data['title'] = $customer_info->title; $data['keywords'] = $customer_info->keywords; $data['description'] = $customer_info->description; $data['footer'] = $customer_info->footer; $data['mobile_footer'] = $customer_info->mobile_footer; $data['pc_footer_script'] = $customer_info->pc_footer_script; $data['mobile_footer_script'] = $customer_info->mobile_footer_script; $data['pc_num_per_page'] = $customer_info->pc_page_count; $data['pc_num_pagenav'] = $customer_info->pc_page_links; $data['m_num_per_page'] = $customer_info->mobile_page_count; $data['m_num_pagenav'] = $customer_info->mobile_page_links; $data['contactor'] = $customer_info->contact_name; $data['telephone'] = $customer_info->telephone; $data['mobile'] = $customer_info->mobile; $data['fax'] = $customer_info->fax; $data['mail'] = $customer_info->email; $data['qq'] = $customer_info->qq; $data['address'] = $customer_info->address; $websiteinfo = WebsiteInfo::where('cus_id', $cus_id)->select('pc_tpl_id', 'mobile_tpl_id')->first(); $pc_tpl_name = Template::where('id', $websiteinfo->pc_tpl_id)->pluck('name'); $pc_ini = parse_ini_file(public_path('/templates/' . $pc_tpl_name . '/config.ini'), true); $data['pc_logo_size'] = isset($pc_ini['Config']['LogoSize']) ? strtr($pc_ini['Config']['LogoSize'], '*', '/') : 0; $mobile_tpl_name = Template::where('id', $websiteinfo->mobile_tpl_id)->pluck('name'); $mobile_ini = parse_ini_file(public_path('/templates/' . $mobile_tpl_name . '/config.ini'), true); $data['m_logo_size'] = isset($mobile_ini['Config']['LogoSize']) ? strtr($mobile_ini['Config']['LogoSize'], '*', '/') : 0; $result['err'] = 0; $result['msg'] = ''; $result['data'] = $data; return Response::json($result); }
/** * 获取用户详情 */ public function customerInfo() { $cus_id = Auth::id(); $customer = Auth::user()->name; $weburl = Customer::where('id', $cus_id)->pluck('weburl'); $suf_url = str_replace('http://c', '', $weburl); $customer_info = CustomerInfo::where('cus_id', $cus_id)->first(); $data['company_name'] = $customer_info->company; $domain_pc = $customer_info->pc_domain; $data['domain_pc'] = str_replace('http://', '', $domain_pc); $domain_m = $customer_info->mobile_domain; $data['domain_m'] = str_replace('http://', '', $domain_m); $data['def_domain_pc'] = $customer . $suf_url; $data['def_domain_m'] = "m." . $customer . $suf_url; if ($customer_info->favicon != '') { $data['favicon'] = asset('customers/' . $customer . '/images/l/common/' . $customer_info->favicon); } if ($customer_info->logo != '') { $data['logo_large'] = asset('customers/' . $customer . '/images/l/common/' . $customer_info->logo); } if ($customer_info->logo_small != '') { $data['logo_small'] = asset('customers/' . $customer . '/images/l/common/' . $customer_info->logo_small); } $data['pc_header_script'] = $customer_info->pc_header_script; $data['mobile_header_script'] = $customer_info->mobile_header_script; $data['title'] = $customer_info->title; $data['keywords'] = $customer_info->keywords; $data['description'] = $customer_info->description; $data['footer'] = $customer_info->footer; $data['mobile_footer'] = $customer_info->mobile_footer; $data['pc_footer_script'] = $customer_info->pc_footer_script; $data['mobile_footer_script'] = $customer_info->mobile_footer_script; $data['pc_num_per_page'] = $customer_info->pc_page_count; $data['pc_imgtxt_per_page'] = $customer_info->pc_page_imgtxt_count; $data['pc_txt_per_page'] = $customer_info->pc_page_txt_count; $data['pc_img_per_page'] = $customer_info->pc_page_img_count; $data['pc_page_count_switch'] = $customer_info->pc_page_count_switch; $data['copyright'] = $customer_info->copyright; $data['pc_num_pagenav'] = $customer_info->pc_page_links; $data['m_num_per_page'] = $customer_info->mobile_page_count; $data['m_num_pagenav'] = $customer_info->mobile_page_links; $data['contactor'] = $customer_info->contact_name; $data['telephone'] = $customer_info->telephone; $data['mobile'] = $customer_info->mobile; $data['fax'] = $customer_info->fax; $data['mail'] = $customer_info->email; $data['qq'] = $customer_info->qq; $data['address'] = $customer_info->address; $data['enlarge'] = $customer_info->enlarge; $data['lang'] = $customer_info->lang; $data['background_music'] = $customer_info->background_music; $data['talent_support'] = $customer_info->talent_support; $data['lastpushtime'] = strtotime($customer_info->lastpushtime); $data['floatadv'] = json_decode($customer_info->floatadv); foreach ((array) $data['floatadv'] as $key => $val) { if (!isset($val->type) || $val->type == 'adv') { $data['floatadv'][$key]->url = asset('customers/' . $customer . '/images/l/common/' . $val->adv); } } $websiteinfo = WebsiteInfo::where('cus_id', $cus_id)->select('pc_tpl_id', 'mobile_tpl_id')->first(); $pc_tpl_name = Template::where('id', $websiteinfo->pc_tpl_id)->pluck('name'); if ($pc_tpl_name != null) { $pc_ini = parse_ini_file(public_path('/templates/' . $pc_tpl_name . '/config.ini'), true); } else { $pc_ini = false; } $data['pc_logo_size'] = isset($pc_ini['Config']['LogoSize']) ? strtr($pc_ini['Config']['LogoSize'], '*', '/') : 0; $mobile_tpl_name = Template::where('id', $websiteinfo->mobile_tpl_id)->pluck('name'); if ($mobile_tpl_name != null) { $mobile_ini = parse_ini_file(public_path('/templates/' . $mobile_tpl_name . '/config.ini'), true); } else { $mobile_ini = false; } $data['m_logo_size'] = isset($mobile_ini['Config']['LogoSize']) ? strtr($mobile_ini['Config']['LogoSize'], '*', '/') : 0; $result['err'] = 0; $result['msg'] = ''; $result['data'] = $data; return Response::json($result); }
public function getMail($id) { $prop = Property::find($id)->toArray(); $tmpl = Template::where('type', 'brochure')->where('status', 'active')->first(); $template = $tmpl->template; //$content = View::make('print.brochure')->with('prop',$prop)->render(); $brochurepdf = PDF::loadView('brochuretmpl.' . $template, array('prop' => $prop))->setOption('margin-top', '0mm')->setOption('margin-left', '0mm')->setOption('margin-right', '0mm')->setOption('margin-bottom', '0mm')->setOption('dpi', 200)->setPaper('A4')->output(); file_put_contents(public_path() . '/storage/pdf/' . $prop['propertyId'] . '.pdf', $brochurepdf); //$mailcontent = View::make('emails.brochure')->with('prop',$prop)->render(); Mail::send('emails.brochure', $prop, function ($message) use($prop, &$prop) { $to = Input::get('to'); $tos = explode(',', $to); if (is_array($tos) && count($tos) > 1) { foreach ($tos as $to) { $message->to($to, $to); } } else { $message->to($to, $to); } $message->subject('Investors Alliance - ' . $prop['propertyId']); $message->cc('*****@*****.**'); $message->attach(public_path() . '/storage/pdf/' . $prop['propertyId'] . '.pdf'); }); print json_encode(array('result' => 'OK')); }
public function getPrint($session_id) { $trx = Transaction::where('sessionId', $session_id)->get()->toArray(); $pay = Payment::where('sessionId', $session_id)->get()->toArray(); $tab = array(); foreach ($trx as $t) { $tab[$t['SKU']]['description'] = $t['productDetail']['itemDescription']; $tab[$t['SKU']]['qty'] = isset($tab[$t['SKU']]['qty']) ? $tab[$t['SKU']]['qty'] + 1 : 1; $tab[$t['SKU']]['tagprice'] = $t['productDetail']['priceRegular']; $tab[$t['SKU']]['total'] = isset($tab[$t['SKU']]['total']) ? $tab[$t['SKU']]['total'] + $t['productDetail']['priceRegular'] : $t['productDetail']['priceRegular']; } $tab_data = array(); $gt = 0; foreach ($tab as $k => $v) { $tab_data[] = array(array('value' => $v['description'], 'attr' => 'class="left"'), array('value' => $v['qty'], 'attr' => 'class="center"'), array('value' => Ks::idr($v['tagprice']), 'attr' => 'class="right"'), array('value' => Ks::idr($v['total']), 'attr' => 'class="right"')); $gt += $v['tagprice']; } $tab_data[] = array('', '', '', Ks::idr($gt)); $header = array('things to buy', 'unit', 'tagprice', array('value' => 'price to pay', 'attr' => 'style="text-align:right"')); $attr = array('class' => 'table', 'id' => 'transTab', 'style' => 'width:100%;', 'border' => '0'); $t = new HtmlTable($tab_data, $attr, $header); $tr_tab = $t->build(); $viewmodel = Template::where('type', 'invoice')->where('status', 'active')->first(); return DbView::make($viewmodel)->field('body')->with('transtab', $tr_tab)->with('trx', $trx)->with('pay', $pay); }
/** * Show the form for editing the specified resource. * * @param string $permalink * @return Response */ public function edit($full_permalink) { $article = Article::where('full_permalink', '=', $full_permalink)->firstOrFail(); $template_options = Template::where('type', '=', '3')->get()->lists('name', 'id'); $data = ['article' => $article, 'options' => $this->getHierarchy(0, 0, 'blog::partials.option', \Input::old('blog_category_id') ?: $article->blog_category_id), 'template_options' => $template_options]; return \View::make('blog::article.edit', $data); }
<div class="col-xs-10 col-md-offset-1"> <div class='maincolumn CW_box_style'> <div class='tab'> <div> <div class="panel panel-default"> <div class="panel-heading"> <h4>Provide job and template details</h4> </div> <div class="panel-body"> {{ Form::open(array('class' => 'form-horizontal jobconf', 'action' => array('JobsController2@postLoadt', 'sandbox'), 'method' => 'POST')) }} <fieldset> <?php $aTypes = array(null => '---'); $_format = Session::get('format_t'); $_aTypes = Template::where("format", $_format)->distinct('type')->get(); $_aTypes = array_flatten($_aTypes->toArray()); foreach ($_aTypes as $key => $value) { if (!isset($aTypes[$value]) and $value !== "NONE") { $aTypes[$value] = $value; } } ?> {{ Form::label('templateType', 'Select a template-type ', array('class' => 'col-xs-4 control-label')) }} {{ Form::select('templateType', $aTypes, null, array('class' => 'selectpicker', 'data-container' =>'body', 'data-toggle'=> 'tooltip', 'templateType'=>'')) }} </fieldset> <br/><br/> {{ Form::submit('Load', array('class' => 'btn btn-lg btn-primary pull-right', 'style' => 'margin-right:20px')); }} {{ Form::close()}} </div>
public function homepageManage() { $page = Input::get('page') ? Input::get('page') : 'index'; $pagelist = $this->buttonList(); $templedata = $this->homepageInfo($page); $cus_id = Auth::id(); //$template_user = websiteInfo::leftJoin('template','template.id','=','website_info.pc_tpl_id')->where('website_info.cus_id',$cus_id)->pluck('template.cus_id'); $pc_tpl_id = WebsiteInfo::where('cus_id', $cus_id)->pluck('pc_tpl_id'); $my_tpl_name = Template::where('former_id', $pc_tpl_id)->where('cus_id', $cus_id)->pluck('name'); $is_my_tpl = Template::where('id', $pc_tpl_id)->where('cus_id', $cus_id)->pluck('name'); $my_tpl_num = count(Template::where('cus_id', $cus_id)->lists('id')); if ($my_tpl_name || $is_my_tpl || $my_tpl_num >= 3) { $coded = 1; } else { $coded = 0; } $data_final = ['err' => 0, 'msg' => '', 'data' => ['pagelist' => $pagelist, 'templedata' => $templedata, 'coded' => $coded]]; return Response::json($data_final); }
/** * 推送 * * */ public function pushPrecent() { if (ob_get_level() == 0) { ob_start(); } $indexhtml = $this->homgepagehtml('pc'); $customer_data_get = CustomerPushfile::where('cus_id', $this->cus_id)->pluck('files'); if ($customer_data_get) { $new_data = 0; $customer_data = unserialize($customer_data_get); } else { $new_data = 1; $customer_data = []; } $mindexhtml = $this->homgepagehtml('mobile'); $pc_classify_ids = Classify::where('cus_id', $this->cus_id)->where('pc_show', 1)->lists('id'); $mobile_classify_ids = Classify::where('cus_id', $this->cus_id)->where('mobile_show', 1)->lists('id'); $pc_article_ids = Articles::where('cus_id', $this->cus_id)->where('pc_show', 1)->lists('id'); $mobile_article_ids = Articles::where('cus_id', $this->cus_id)->where('mobile_show', 1)->lists('id'); $count = $this->htmlPagecount($pc_classify_ids, $mobile_classify_ids, $pc_article_ids, $mobile_article_ids); $this->html_precent = 70 / $count; $categoryhtml = $this->categoryhtml($pc_classify_ids, 'pc'); $mcategoryhtml = $this->categoryhtml($mobile_classify_ids, 'mobile'); $articlehtml = $this->articlehtml($pc_article_ids, 'pc'); $marticlehtml = $this->articlehtml($mobile_article_ids, 'mobile'); $this->percent = 20 / $count; $path = public_path('customers/' . $this->customer . '/' . $this->customer . '.zip'); $template = new PrintController('online', 'mobile'); $quickbar_json = $template->quickBarJson(); $zip = new ZipArchive(); if ($zip->open($path, ZipArchive::CREATE) === TRUE) { $zip->addFile($indexhtml, 'index.html'); $nowpercent = $this->percent + $this->lastpercent; if (floor($nowpercent) != $this->lastpercent) { echo floor($nowpercent) . '%<script type="text/javascript">parent.refresh(' . floor($nowpercent) . ');</script><br />'; ob_flush(); flush(); } $this->lastpercent += 70 + $this->percent; $zip->addFile($mindexhtml, 'mobile/index.html'); $nowpercent = $this->percent + $this->lastpercent; if (floor($nowpercent) != floor($this->lastpercent)) { echo floor($nowpercent) . '%<script type="text/javascript">parent.refresh(' . floor($nowpercent) . ');</script><br />'; ob_flush(); flush(); } $this->lastpercent += $this->percent; $zip->close(); } //$customer_data = $this->compareZip($categoryhtml,$customer_data,'p','category',$path); //$customer_data = $this->compareZip($mcategoryhtml,$customer_data,'m','mobile/category',$path); //$customer_data = $this->compareZip($articlehtml,$customer_data,'pf','detail',$path); //$customer_data = $this->compareZip($marticlehtml,$customer_data,'mf','mobile/detail',$path); $this->compareZip($categoryhtml, $customer_data, 'p', 'category', $path); $this->compareZip($mcategoryhtml, $customer_data, 'm', 'mobile/category', $path); $this->compareZip($articlehtml, $customer_data, 'pf', 'detail', $path); $this->compareZip($marticlehtml, $customer_data, 'mf', 'mobile/detail', $path); if (90 > floor($this->lastpercent)) { echo '90%<script type="text/javascript">parent.refresh(90);</script><br />'; ob_flush(); flush(); } if ($zip->open($path, ZipArchive::CREATE) === TRUE) { $pc_dir = Template::where('website_info.cus_id', $this->cus_id)->Leftjoin('website_info', 'website_info.pc_tpl_id', '=', 'template.id')->pluck('name'); $mobile_dir = Template::where('website_info.cus_id', $this->cus_id)->Leftjoin('website_info', 'template.id', '=', 'website_info.mobile_tpl_id')->pluck('name'); $aim_dir = public_path("templates/{$pc_dir}/"); $maim_dir = public_path("templates/{$mobile_dir}/"); //$images_dir=public_path("customers/".$this->customer."/images/"); $this->addDir($aim_dir, $zip); //$this->addDir($images_dir,$zip,'images/'); $this->addDir($maim_dir, $zip, 'mobile/'); $zip->close(); $data = serialize($customer_data); if ($new_data) { $customerpushfile = new CustomerPushfile(); $customerpushfile->cus_id = $this->cus_id; $customerpushfile->files = $data; $customerpushfile->save(); } else { CustomerPushfile::where('cus_id', $this->cus_id)->update(['files' => $data]); } $customerinfo = Customer::find($this->cus_id); $ftp_array = explode(':', $customerinfo->ftp_address); $ftp_array[1] = isset($ftp_array[1]) ? $ftp_array[1] : '21'; $conn = ftp_connect($ftp_array[0], $ftp_array[1]); if ($conn) { ftp_login($conn, $customerinfo->ftp_user, $customerinfo->ftp_pwd); ftp_pasv($conn, 1); ftp_put($conn, "site.zip", $path, FTP_BINARY); ftp_put($conn, "unzip.php", public_path("packages/unzip.php"), FTP_ASCII); ftp_put($conn, "quickbar.json", public_path('customers/' . $this->customer . '/quickbar.json'), FTP_ASCII); ftp_put($conn, "mobile/quickbar.json", public_path('customers/' . $this->customer . '/quickbar.json'), FTP_ASCII); ftp_close($conn); } echo '100%<script type="text/javascript">parent.refresh(100);</script><br />'; Classify::where('cus_id', $this->cus_id)->where('pushed', 1)->update(['pushed' => 0]); Articles::where('cus_id', $this->cus_id)->where('pushed', 1)->update(['pushed' => 0]); $search_data = new TemplatesController(); $search_data->sendData(); $pc_domain = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_domain'); @file_get_contents("{$pc_domain}/unzip.php"); } else { echo '打包失败'; } ob_end_flush(); }
/** * 推送 * * */ public function pushPrecent() { set_time_limit(0); if (Input::has("pushgrad") == 1) { echo '<script type="text/javascript">function refresh(str){parent.refresh(str);};</script>'; if (Input::has("push_c_id")) { $pushcid = Input::get("push_c_id"); } if (Input::has("end")) { $end = Input::get("end"); } // $pushcid = $this->pushcid; // $end = $this->end; // $this->percent=0; // $this->lastpercent=0; // $this->html_precent=0; // $this->last_html_precent=0; // $this->pcpush=0; // $this->mobilepush=0; // $this->quickbarpush=0; // $this->mobilehomepagepush=0; } else { if (!Input::has("name")) { echo '<script type="text/javascript">function refresh(str){parent.refresh(str);};</script>'; } if (Input::has("push_c_id")) { $pushcid = Input::get("push_c_id"); } if (Input::has("end")) { $end = Input::get("end"); } } $have_article = Articles::where('cus_id', $this->cus_id)->count(); if (!$have_article) { echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; echo '<div class="prompt">没有文章不可推送</div><script type="text/javascript">alert("没有文章不可推送");refresh("没有文章不可推送");</script>'; ob_flush(); flush(); exit; } if (!isset($_GET['gradpush'])) { $this->needpush(); } else { $pc_domain = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_domain'); $mobile_domain = CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_domain'); $pc = str_replace('http://', '', $pc_domain); $mobile = str_replace('http://', '', $mobile_domain); if ($pc != '') { $this->pcpush = 1; } if ($mobile != '') { $this->mobilepush = 1; } $this->quickbarpush = 1; $this->mobilehomepagepush = 0; } echo '<div class="prompt">'; var_dump('pcpush:' . $this->pcpush); var_dump('mobilepush:' . $this->mobilepush); var_dump('quickbarpush:' . $this->quickbarpush); var_dump('mobilehomepagepush:' . $this->mobilehomepagepush); echo '</div>'; ob_flush(); flush(); $this->pushinit(); if (!isset($end) || $end == 1) { if ($this->quickbarpush) { $this->pushQuickbar(); } if (!$this->mobilepush) { if ($this->mobilehomepagepush) { $this->mobilehomepage_push(); } } } if ($this->pcpush || $this->mobilepush) { if (!$this->pcpush && $this->mobilepush) { $this->mobile_push(); return true; } if (ob_get_level() == 0) { ob_start(); } $pc_classify_ids = array(); $mobile_classify_ids = array(); $pc_article_ids = array(); $mobile_article_ids = array(); if ($this->mobilepush) { if (isset($pushcid)) { if (!isset($end) || $end == 1) { $mindexhtml = $this->homgepagehtml('mobile'); $msearchhtml = $this->sendData('mobile'); } $mobile_classify_ids = array(); $mobile_article_ids = array(); $mobile_show = Classify::where('cus_id', $this->cus_id)->where("id", $pushcid)->pluck("mobile_show"); if ($mobile_show) { $mobile_classify_ids[] = $pushcid; $mobile_article_ids = Articles::where('cus_id', $this->cus_id)->where('mobile_show', 1)->where("c_id", $pushcid)->lists('id'); } } else { $mindexhtml = $this->homgepagehtml('mobile'); $msearchhtml = $this->sendData('mobile'); $mobile_classify_ids = Classify::where('cus_id', $this->cus_id)->where('mobile_show', 1)->lists('id'); $mobile_article_ids = Articles::where('cus_id', $this->cus_id)->where('mobile_show', 1)->lists('id'); } } if ($this->pcpush) { if (isset($pushcid)) { if (!isset($end) || $end == 1) { $indexhtml = $this->homgepagehtml('pc'); $searchhtml = $this->sendData('pc'); } $pc_classify_ids = array(); $pc_article_ids = array(); $pc_show = Classify::where('cus_id', $this->cus_id)->where("id", $pushcid)->pluck("pc_show"); if ($pc_show) { $pc_classify_ids[] = $pushcid; $pc_article_ids = Articles::where('cus_id', $this->cus_id)->where('pc_show', 1)->where("c_id", $pushcid)->lists('id'); } } else { $indexhtml = $this->homgepagehtml('pc'); $searchhtml = $this->sendData('pc'); $pc_classify_ids = Classify::where('cus_id', $this->cus_id)->where('pc_show', 1)->lists('id'); $pc_article_ids = Articles::where('cus_id', $this->cus_id)->where('pc_show', 1)->lists('id'); } } $count = $this->htmlPagecount($pc_classify_ids, $mobile_classify_ids, $pc_article_ids, $mobile_article_ids); $this->html_precent = 70 / $count; if ($this->pcpush) { $categoryhtml = $this->categoryhtml($pc_classify_ids, 'pc'); $articlehtml = $this->articlehtml($pc_classify_ids, 'pc'); } if ($this->mobilepush) { $mcategoryhtml = $this->categoryhtml($mobile_classify_ids, 'mobile'); $marticlehtml = $this->articlehtml($mobile_classify_ids, 'mobile'); } $this->percent = 20 / $count; $path = public_path('customers/' . $this->customer . '/' . $this->customer . '.zip'); if (file_exists($path)) { @unlink($path); } $zip = new ZipArchive(); if ((!isset($end) || $end == 1) && $zip->open($path, ZipArchive::CREATE) === TRUE) { if ($this->pcpush) { $this->addFileToZip(public_path("quickbar/"), $zip, "quickbar"); $zip->addFile($indexhtml, 'index.html'); $zip->addFile($searchhtml, 'search.html'); $zip->addFile(public_path('customers/' . $this->customer . '/article_data.json'), 'article_data.json'); $nowpercent = $this->percent + $this->lastpercent; if (floor($nowpercent) != $this->lastpercent) { echo '<div class="prompt">' . floor($nowpercent) . '%</div><script type="text/javascript">refresh(' . floor($nowpercent) . ');</script>'; ob_flush(); flush(); $this->clearpushqueue(); } } $this->lastpercent += 70 + $this->percent; if ($this->mobilepush) { $this->addFileToZip(public_path("quickbar/"), $zip, "mobile/quickbar"); $zip->addFile($mindexhtml, 'mobile/index.html'); $zip->addFile($msearchhtml, 'mobile/search.html'); $zip->addFile(public_path('customers/' . $this->customer . '/mobile/article_data.json'), 'mobile/article_data.json'); $nowpercent = $this->percent + $this->lastpercent; if (floor($nowpercent) != floor($this->lastpercent)) { echo '<div class="prompt">' . floor($nowpercent) . '%</div><script type="text/javascript">refresh(' . floor($nowpercent) . ');</script>'; ob_flush(); flush(); $this->clearpushqueue(); } } $this->lastpercent += $this->percent; $zip->close(); } else { $this->lastpercent += 70 + $this->percent; } if ($this->pcpush) { $this->compareZip($categoryhtml, 'category', $path); $this->compareZip($articlehtml, 'detail', $path); } if ($this->mobilepush) { $this->compareZip($mcategoryhtml, 'mobile/category', $path); $this->compareZip($marticlehtml, 'mobile/detail', $path); } if (90 > floor($this->lastpercent)) { echo '<div class="prompt">' . '90%</div><script type="text/javascript">refresh(90);</script>'; ob_flush(); flush(); $this->clearpushqueue(); } PushQueue::where('cus_id', $this->cus_id)->delete(); $nextpush = PushQueue::where('push', 0)->first(); if ($nextpush) { PushQueue::where('id', $nextpush->id)->update(['push' => 1]); } if ($zip->open($path, ZipArchive::CREATE) === TRUE) { if ((!isset($end) || $end == 1) && $this->pcpush) { $pc_dir = Template::where('website_info.cus_id', $this->cus_id)->Leftjoin('website_info', 'website_info.pc_tpl_id', '=', 'template.id')->pluck('name'); $aim_dir = public_path("templates/{$pc_dir}/"); $this->addDir($aim_dir, $zip); } if ((!isset($end) || $end == 1) && $this->mobilepush) { $mobile_dir = Template::where('website_info.cus_id', $this->cus_id)->Leftjoin('website_info', 'template.id', '=', 'website_info.mobile_tpl_id')->pluck('name'); $maim_dir = public_path("templates/{$mobile_dir}/"); $this->addDir($maim_dir, $zip, 'mobile/'); } $zip->close(); $customerinfo = Customer::find($this->cus_id); $ftp_array = explode(':', $customerinfo->ftp_address); $port = $customerinfo->ftp_port; $ftpdir = $customerinfo->ftp_dir; $ftp = $customerinfo->ftp; $ftp_array[1] = isset($ftp_array[1]) ? $ftp_array[1] : $port; $conn = ftp_connect($ftp_array[0], $ftp_array[1]); $del_imgs = ImgDel::where('cus_id', $this->cus_id)->get()->toArray(); if (trim($ftp) == '1') { if ($conn) { ftp_login($conn, $customerinfo->ftp_user, $customerinfo->ftp_pwd); ftp_pasv($conn, 1); if (@ftp_chdir($conn, $this->customer) == FALSE) { ftp_mkdir($conn, $this->customer); } foreach ((array) $del_imgs as $v) { $this->delimg($v); @ftp_delete($conn, "/" . $this->customer . '/images/l/' . $v['target'] . '/' . $v['img']); @ftp_delete($conn, "/" . $this->customer . '/images/s/' . $v['target'] . '/' . $v['img']); @ftp_delete($conn, "/" . $this->customer . '/mobile/images/l/' . $v['target'] . '/' . $v['img']); @ftp_delete($conn, "/" . $this->customer . '/mobile/images/s/' . $v['target'] . '/' . $v['img']); } ImgDel::where('cus_id', $this->cus_id)->delete(); if ($this->pcpush) { @ftp_put($conn, "/" . $this->customer . "/search.php", public_path("packages/search.php"), FTP_ASCII); //@ftp_put($conn,"/".$this->customer."/quickbar.json",public_path('customers/'.$this->customer.'/quickbar.json'),FTP_ASCII); } if (file_exists($path)) { ftp_put($conn, "/" . $this->customer . "/site.zip", $path, FTP_BINARY); } ftp_put($conn, "/" . $this->customer . "/unzip.php", public_path("packages/unzip.php"), FTP_ASCII); if ($this->mobilepush) { ftp_put($conn, "/" . $this->customer . "/mobile/search.php", public_path("packages/search.php"), FTP_ASCII); if (@ftp_chdir($conn, "/" . $this->customer . "/mobile") == FALSE) { ftp_mkdir($conn, "/" . $this->customer . "/mobile"); } //ftp_put($conn,"/".$this->customer."/mobile/quickbar.json",public_path('customers/'.$this->customer.'/mobile/quickbar.json'),FTP_ASCII); } ftp_close($conn); } } else { if ($conn) { ftp_login($conn, $customerinfo->ftp_user, $customerinfo->ftp_pwd); ftp_pasv($conn, 1); foreach ((array) $del_imgs as $v) { $this->delimg($v); @ftp_delete($conn, $ftpdir . '/images/l/' . $v['target'] . '/' . $v['img']); @ftp_delete($conn, $ftpdir . '/images/s/' . $v['target'] . '/' . $v['img']); @ftp_delete($conn, $ftpdir . '/mobile/images/l/' . $v['target'] . '/' . $v['img']); @ftp_delete($conn, $ftpdir . '/mobile/images/s/' . $v['target'] . '/' . $v['img']); } ImgDel::where('cus_id', $this->cus_id)->delete(); if ($this->pcpush) { ftp_put($conn, $ftpdir . "/search.php", public_path("packages/search.php"), FTP_ASCII); //ftp_put($conn,$ftpdir."/quickbar.json",public_path('customers/'.$this->customer.'/quickbar.json'),FTP_ASCII); } ftp_put($conn, $ftpdir . "/unzip.php", public_path("packages/unzip.php"), FTP_ASCII); if (file_exists($path)) { ftp_put($conn, $ftpdir . "/site.zip", $path, FTP_BINARY); } if ($this->mobilepush) { ftp_put($conn, $ftpdir . "/mobile/search.php", public_path("packages/search.php"), FTP_ASCII); //ftp_put($conn,$ftpdir."/mobile/quickbar.json",public_path('customers/'.$this->customer.'/mobile/quickbar.json'),FTP_ASCII); } ftp_close($conn); } } $this->folderClear(); echo '<div class="prompt">' . '100%</div><script type="text/javascript">refresh(100);</script>'; if (!isset($end) || $end == 1) { Classify::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->update(['pushed' => 0]); Articles::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->update(['pushed' => 0]); WebsiteConfig::where('cus_id', $this->cus_id)->update(['pushed' => 0]); WebsiteInfo::where('cus_id', $this->cus_id)->update(['pushed' => 0]); MobileHomepage::where('cus_id', $this->cus_id)->update(['pushed' => 0]); CustomerInfo::where('cus_id', $this->cus_id)->update(['pushed' => 0, 'lastpushtime' => date('Y-m-d H:i:s', time())]); //date('Y-m-d H:i:s',time()) } /** * pc使用本服务器自带域名推送,后期需要改进! */ $weburl = Customer::where('id', $this->cus_id)->pluck('weburl'); $suf_url = str_replace('http://c', '', $weburl); $cus_name = strtolower(Customer::where('id', $this->cus_id)->pluck('name')); if (trim($ftp) == '1') { $ftp_pcdomain = "http://" . $cus_name . $suf_url; } else { $ftp_pcdomain = $customerinfo->pc_domain; } @file_get_contents("{$ftp_pcdomain}/unzip.php"); } else { echo '打包失败'; } ob_end_flush(); } else { echo '<div class="prompt">' . '100%</div><script type="text/javascript">refresh(100);</script>'; if (!isset($end) || $end == 1) { Classify::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->update(['pushed' => 0]); Articles::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->update(['pushed' => 0]); WebsiteConfig::where('cus_id', $this->cus_id)->update(['pushed' => 0]); WebsiteInfo::where('cus_id', $this->cus_id)->update(['pushed' => 0]); MobileHomepage::where('cus_id', $this->cus_id)->update(['pushed' => 0]); CustomerInfo::where('cus_id', $this->cus_id)->update(['pushed' => 0, 'lastpushtime' => date('Y-m-d H:i:s', time())]); //date('Y-m-d H:i:s',time()) ob_end_flush(); } } }
private function unpack($tpl_pack, $tpl_name, $tpl_exists = false, $temptype = 0) { $zip = new ZipArchive(); if ($zip->open(public_path("temp_templates/{$tpl_pack}")) === true) { $file_info = pathinfo($tpl_pack); @mkdir(public_path('temp_templates/' . $file_info['filename'])); // for($i = 0; $i < $zip->numFiles; $i++) { // $filename = $zip->getNameIndex($i); // if(!mb_detect_encoding($filename,array('GBK'))){ // $filename= mb_convert_encoding($filename, 'GBK',mb_detect_encoding($filename)); // } // dd(zip_read($filename)); // $zip->extractTo(public_path('temp_templates/'.$file_info['filename']),$filename); // } $zip->extractTo(public_path('temp_templates/' . $file_info['filename'])); $zip->close(); if (file_exists(public_path('temp_templates/' . $file_info['filename'] . '/config.ini'))) { $dir_site = public_path('temp_templates/' . $file_info['filename']); } else { $child_dir = $this->getDir(public_path('temp_templates/' . $file_info['filename']) . '/'); $dir_site = public_path('temp_templates/' . $file_info['filename'] . '/' . $child_dir[0]); } // 其他json文件验证 $config_arr = parse_ini_file($dir_site . '/config.ini', true); if (!is_array($config_arr)) { dd('【config.ini】文件不存在!文件格式说明详见:http://pme.eexx.me/doku.php?id=ued:template:config'); } $type = $config_arr['Config']['Type']; if ($tpl_exists) { if (substr_count(strtolower($type), 'pc')) { $type = 1; } else { $type = 2; } if ($temptype != 0) { if ($type != $temptype) { return false; } } $tpl_dir = $tpl_name; $new_num = ''; } else { if (substr_count(strtolower($type), 'pc')) { $type = 1; $tpl_dir = "GP"; } else { $type = 2; $tpl_dir = "GM"; } $last_num = Template::where('type', $type)->max('tpl_num'); $new_num = $last_num + 1; $tpl_dir = $tpl_dir . str_repeat('0', 4 - strlen($new_num)) . $new_num; } //正则匹配tpl_num if (!isset($_SERVER['HTTP_REFERER'])) { preg_match('/[A-Z]{2}[0]*(\\d*)/', $tpl_name, $have); $new_num = $have[1]; } //配置数据 $data = array(); $data['template'] = array('tpl_name' => $config_arr['Template']['Name'], 'classify' => $config_arr['Config']['Category'], 'demo' => $config_arr['Template']['URL'], 'type' => $type, 'description' => $config_arr['Template']['Description'], 'list1showtypetotal' => $type == 1 ? 0 : $config_arr['Config']['List1ShowtypeTotal'], 'list2showtypetotal' => $type == 1 ? 0 : $config_arr['Config']['List2ShowtypeTotal'], 'list3showtypetotal' => $type == 1 ? 0 : $config_arr['Config']['List3ShowtypeTotal'], 'list4showtypetotal' => $type == 1 ? 0 : $config_arr['Config']['List4ShowtypeTotal']); if (trim($config_arr['Config']['StyleColors']) != "") { $color_arr = explode(',', $config_arr['Config']['StyleColors']); } else { $color_arr = array(); } $data['tpl_color'] = $color_arr; @unlink(public_path("temp_templates/{$tpl_pack}")); @unlink($dir_site . '/preview.js'); if (!file_exists(app_path("views/templates/{$tpl_dir}"))) { mkdir(app_path("views/templates/{$tpl_dir}")); } $this->rcopy($dir_site, public_path("templates/{$tpl_dir}")); @$this->_remove_Dir(public_path('temp_templates/' . $file_info['filename'])); $file_list = $this->getFile(public_path("templates/{$tpl_dir}")); if (!file_exists(public_path("templates/{$tpl_dir}/json"))) { mkdir(public_path("templates/{$tpl_dir}/json")); } foreach ($file_list as $file_name) { $file_type = explode('.', $file_name); $file_type = end($file_type); switch ($file_type) { case "json": rename(public_path("templates/{$tpl_dir}/{$file_name}"), public_path("templates/{$tpl_dir}/json/{$file_name}")); break; case "html": $pattern = array("/\\<script(.*)preview\\.js(.*)\\<\\/script\\>/i", "/\\<!--(.*)\\{(.*)\\}(.*)--\\>/i"); file_put_contents(public_path("templates/{$tpl_dir}/{$file_name}"), preg_replace($pattern, '', file_get_contents(public_path("templates/{$tpl_dir}/{$file_name}")))); rename(public_path("templates/{$tpl_dir}/{$file_name}"), app_path("views/templates/{$tpl_dir}/{$file_name}")); break; } } return array('tpl_dir' => $tpl_dir, 'tpl_num' => $new_num, 'config' => $data); } else { @unlink(public_path("temp_templates/{$tpl_pack}")); return false; } }
private function quickBarDefaultColor() { $id = Auth::id(); $search = "/QuickBar=(.*)/i"; $template = WebsiteInfo::where('cus_id', $id)->first(); //===获取PC端颜色=== $pc_name = Template::where('id', $template->pc_tpl_id)->pluck('name'); $config_str = file_get_contents(public_path('/templates/' . $pc_name) . '/config.ini'); $result = preg_match($search, $config_str, $config_arr); if (!$result) { $config_arr = array(); $config_arr[1] = '#AAA,#BBB,#FFF|totop'; } $color_str = preg_replace("/\\|(.*)/i", '', $config_arr[1]); $colors['pc'] = explode(',', ltrim($color_str, ',')); //===获取手机端颜色=== $mobile_name = Template::where('id', $template->mobile_tpl_id)->pluck('name'); $config_str = file_get_contents(public_path('/templates/' . $mobile_name) . '/config.ini'); $result = preg_match($search, $config_str, $config_arr); if ($result) { if (trim($config_arr[1]) != 'custom') { $color_str = preg_replace("/\\|(.*)/i", '', $config_arr[1]); $colors['mobile'] = explode(',', ltrim($color_str, ',')); } } return $colors; }
public function action_step1() { $view = View::make('home.step1'); $view->templates = Template::where('visible', '=', true)->get(); $this->layout->content = $view; }
/** * 创建用户 modifyCustomer * @param type name 用户名 * @param type email 用户邮箱 * @param type ftp_address ftp地址 * @param type ftp_user ftp帐号 * @param type ftp_pwd ftp密码 * @param type ended_at 用户终止时间 * @param type status 用户状态 * @return type data 用户id */ public function modifyCustomer() { if ($this->authData()) { $update['name'] = trim(Input::get('name')); $update['email'] = trim(Input::get('email')); $update['weburl'] = trim(Input::get('weburl')); $update['pc_domain'] = trim(Input::get('pc_domain')); $update['mobile_domain'] = trim(Input::get('mobile_domain')); if (trim(Input::get('pc_tpl_id')) == '0') { $update['pc_tpl_num'] = 1; } else { $update['pc_tpl_num'] = trim(Input::get('pc_tpl_id')); } if (trim(Input::get('mobile_tpl_id')) == '0') { $update['mobile_tpl_num'] = 1; } else { $update['mobile_tpl_num'] = trim(Input::get('mobile_tpl_id')); } $update['stage'] = trim(Input::get('stage')); $update['ftp'] = trim(Input::get('ftp')); $update['ftp_port'] = trim(Input::get('ftp_port')); $update['ftp_dir'] = trim(Input::get('ftp_dir')); $update['ftp_address'] = trim(Input::get('ftp_address')); $update['ftp_user'] = trim(Input::get('ftp_user')); $update['ftp_pwd'] = trim(Input::get('ftp_pwd')); $update['ended_at'] = trim(Input::get('ended_at')); $update['status'] = Input::get('status'); $update['customization'] = Input::get('customization'); //===绑定账户=== $switch_cus_name = Input::get('switch_cus_name'); if (!empty($switch_cus_name)) { $update['switch_cus_id'] = Customer::where('name', $switch_cus_name)->pluck('id'); } else { $update['switch_cus_id'] = 0; } //===end=== //===不能用update数组,因为Customer表中没有capacity/capacity_use字段=== $capacity = Input::get('capacity') ? trim(Input::get('capacity')) : 300 * 1024 * 1024; //默认100MB $cus_id = Customer::where('name', $update['name'])->pluck('id'); if ($cus_id) { //修改操作 $coustomer_old = Customer::where('id', $cus_id)->first(); $save = Customer::where('id', $cus_id)->update($update); $pc_id = Template::where('tpl_num', $update['pc_tpl_num'])->where('type', 1)->pluck('id'); $mobile_id = Template::where('tpl_num', $update['mobile_tpl_num'])->where('type', 2)->pluck('id'); $pc_templateid = Template::where('cus_id', $cus_id)->where('type', 1)->pluck('id'); $mobile_templateid = Template::where('cus_id', $cus_id)->where('type', 2)->pluck('id'); if ($pc_templateid != NULL) { WebsiteInfo::where('cus_id', $cus_id)->update(['pc_tpl_id' => $pc_templateid]); } else { WebsiteInfo::where('cus_id', $cus_id)->update(['pc_tpl_id' => $pc_id]); } if ($mobile_templateid != NULL) { WebsiteInfo::where('cus_id', $cus_id)->update(['mobile_tpl_id' => $mobile_templateid]); } else { WebsiteInfo::where('cus_id', $cus_id)->update(['mobile_tpl_id' => $mobile_id]); } //WebsiteInfo::where('cus_id',$cus_id)->update(['pc_tpl_id'=>$pc_id,'mobile_tpl_id'=>$mobile_id]); //===更新CustomerInfo时,更新capacity字段=== CustomerInfo::where('cus_id', $cus_id)->update(['pc_domain' => $update['pc_domain'], 'mobile_domain' => $update['mobile_domain'], 'capacity' => $capacity]); if ($update['stage'] != $coustomer_old['stage'] or $update['pc_domain'] != $coustomer_old['pc_domain'] or $update['mobile_domain'] != $coustomer_old['mobile_domain']) { $common = new CommonController(); @$common->postsend(trim($update['weburl'], '/') . "/urlbind.php", array('cus_name' => $update['name'], 'stage' => $update['stage'], 'pc_domain' => $update['pc_domain'], 'mobile_domain' => $update['mobile_domain'], 'stage_old' => $coustomer_old['stage'], 'pc_domain_old' => $coustomer_old['pc_domain'], 'mobile_domain_old' => $coustomer_old['mobile_domain'])); } if ($save) { $result = ['err' => 1000, 'msg' => '更新用户成功']; } else { $result = ['err' => 1002, 'msg' => '更新用户失败']; } } else { //增加操作 $update['password'] = Hash::make($update['name']); $insert_id = Customer::insertGetId($update); if ($insert_id) { $pc_id = Template::where('tpl_num', $update['pc_tpl_num'])->where('type', 1)->pluck('id'); $mobile_id = Template::where('tpl_num', $update['mobile_tpl_num'])->where('type', 2)->pluck('id'); WebsiteInfo::insert(['cus_id' => $insert_id, 'pc_tpl_id' => $pc_id, 'mobile_tpl_id' => $mobile_id]); CustomerInfo::insert(['cus_id' => $insert_id, 'pc_domain' => $update['pc_domain'], 'mobile_domain' => $update['mobile_domain'], 'capacity' => $capacity, 'capacity_use' => 0]); //创建客户目录 mkdir(public_path('customers/' . $update['name'])); mkdir(public_path('customers/' . $update['name']) . '/detail'); mkdir(public_path('customers/' . $update['name']) . '/category'); mkdir(public_path('customers/' . $update['name']) . '/images'); mkdir(public_path('customers/' . $update['name']) . '/images/l'); mkdir(public_path('customers/' . $update['name']) . '/images/l/category'); mkdir(public_path('customers/' . $update['name']) . '/images/l/articles'); mkdir(public_path('customers/' . $update['name']) . '/images/l/common'); mkdir(public_path('customers/' . $update['name']) . '/images/l/page_index'); mkdir(public_path('customers/' . $update['name']) . '/images/s'); mkdir(public_path('customers/' . $update['name']) . '/images/s/category'); mkdir(public_path('customers/' . $update['name']) . '/images/s/articles'); mkdir(public_path('customers/' . $update['name']) . '/images/s/common'); mkdir(public_path('customers/' . $update['name']) . '/images/s/page_index'); mkdir(public_path('customers/' . $update['name']) . '/images/ueditor'); mkdir(public_path('customers/' . $update['name']) . '/mobile'); mkdir(public_path('customers/' . $update['name']) . '/mobile/detail'); mkdir(public_path('customers/' . $update['name']) . '/mobile/category'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l/category'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l/articles'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l/common'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/l/page_index'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s/category'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s/articles'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s/common'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/s/page_index'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/ueditor'); $ftp_array = explode(':', $update['ftp_address']); $port = $update['ftp_port']; $ftp_array[1] = isset($ftp_array[1]) ? $ftp_array[1] : $port; $conn = ftp_connect($ftp_array[0], $ftp_array[1]); if ($conn) { if (trim(Input::get('ftp')) == '1') { ftp_login($conn, $update['ftp_user'], $update['ftp_pwd']); ftp_mkdir($conn, $update['name']); ftp_mkdir($conn, $update['name'] . '/images'); ftp_mkdir($conn, $update['name'] . '/detail'); ftp_mkdir($conn, $update['name'] . '/category'); ftp_mkdir($conn, $update['name'] . '/images/ueditor'); ftp_mkdir($conn, $update['name'] . '/images/l'); ftp_mkdir($conn, $update['name'] . '/images/l/category'); ftp_mkdir($conn, $update['name'] . '/images/l/articles'); ftp_mkdir($conn, $update['name'] . '/images/l/common'); ftp_mkdir($conn, $update['name'] . '/images/l/page_index'); ftp_mkdir($conn, $update['name'] . '/images/s'); ftp_mkdir($conn, $update['name'] . '/images/s/category'); ftp_mkdir($conn, $update['name'] . '/images/s/articles'); ftp_mkdir($conn, $update['name'] . '/images/s/common'); ftp_mkdir($conn, $update['name'] . '/images/s/page_index'); ftp_mkdir($conn, $update['name'] . '/mobile'); ftp_mkdir($conn, $update['name'] . '/mobile/images'); ftp_mkdir($conn, $update['name'] . '/mobile/detail'); ftp_mkdir($conn, $update['name'] . '/mobile/category'); ftp_mkdir($conn, $update['name'] . '/mobile/images/ueditor'); ftp_mkdir($conn, $update['name'] . '/mobile/images/l'); ftp_mkdir($conn, $update['name'] . '/mobile/images/l/category'); ftp_mkdir($conn, $update['name'] . '/mobile/images/l/articles'); ftp_mkdir($conn, $update['name'] . '/mobile/images/l/common'); ftp_mkdir($conn, $update['name'] . '/mobile/images/l/page_index'); ftp_mkdir($conn, $update['name'] . '/mobile/images/s'); ftp_mkdir($conn, $update['name'] . '/mobile/images/s/category'); ftp_mkdir($conn, $update['name'] . '/mobile/images/s/articles'); ftp_mkdir($conn, $update['name'] . '/mobile/images/s/common'); ftp_mkdir($conn, $update['name'] . '/mobile/images/s/page_index'); ftp_close($conn); } else { ftp_login($conn, $update['ftp_user'], $update['ftp_pwd']); ftp_mkdir($conn, $update['ftp_dir'] . '/images'); ftp_mkdir($conn, $update['ftp_dir'] . '/detail'); ftp_mkdir($conn, $update['ftp_dir'] . '/category'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/ueditor'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/l'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/l/category'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/l/articles'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/l/common'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/l/page_index'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/s'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/s/category'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/s/articles'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/s/common'); ftp_mkdir($conn, $update['ftp_dir'] . '/images/s/page_index'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/detail'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/category'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/ueditor'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l/category'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l/articles'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l/common'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/l/page_index'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s/category'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s/articles'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s/common'); ftp_mkdir($conn, $update['ftp_dir'] . '/mobile/images/s/page_index'); ftp_close($conn); } $common = new CommonController(); @$common->postsend(trim($update['weburl'], '/') . "/urlbind.php", array('cus_name' => $update['name'], 'stage' => $update['stage'], 'pc_domain' => $update['pc_domain'], 'mobile_domain' => $update['mobile_domain'])); $result = ['err' => 1000, 'msg' => '创建用户成功']; } else { $result = ['err' => 1001, 'msg' => '创建用户失败,创建文件失败']; } } else { $result = ['err' => 1001, 'msg' => '创建用户失败']; } } } else { $result = ['err' => 1003, 'msg' => '验证信息不正确']; } return Response::json($result); }