本文整理汇总了PHP中Template::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::where方法的具体用法?PHP Template::where怎么用?PHP Template::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::where方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* 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);
}
示例2: customerInfo
/**
* 获取用户详情
*/
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);
}
示例3: customerInfo
/**
* 获取用户详情
*/
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);
}
示例4: getMail
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('support@propinvestorsalliance.com');
$message->attach(public_path() . '/storage/pdf/' . $prop['propertyId'] . '.pdf');
});
print json_encode(array('result' => 'OK'));
}
示例5: getPrint
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);
}
示例6: edit
/**
* 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);
}
示例7: array
<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>
示例8: homepageManage
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);
}
示例9: pushPrecent
/**
* 推送
*
*
*/
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 />';
//.........这里部分代码省略.........
示例10: pushPrecent
/**
* 推送
*
*
*/
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();
//.........这里部分代码省略.........
示例11: unpack
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;
}
}
示例12: quickBarDefaultColor
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;
}
示例13: action_step1
public function action_step1()
{
$view = View::make('home.step1');
$view->templates = Template::where('visible', '=', true)->get();
$this->layout->content = $view;
}
示例14: modifyCustomer
/**
* 创建用户 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');
//.........这里部分代码省略.........