/** * 获取用户详情 */ 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 classifyList() { $customer = Auth::user()->name; $cus_id = Auth::id(); $classify = Classify::where('cus_id', $cus_id)->orderBy('sort')->orderBy('id')->get()->toArray(); $showtypetotal = WebsiteInfo::where('website_info.cus_id', $cus_id)->LeftJoin('template', 'mobile_tpl_id', '=', 'template.id')->select('template.list1showtypetotal', 'template.list2showtypetotal', 'template.list3showtypetotal', 'template.list4showtypetotal')->first(); if (count($classify)) { foreach ($classify as &$c_arr) { $liststr = 'list' . $c_arr['type'] . 'showtypetotal'; $c_arr['showtypetotal'] = $showtypetotal->{$liststr}; if ($c_arr['mobile_show']) { $c_arr['show'] = MobileHomepage::where('c_id', $c_arr['id'])->where('cus_id', $cus_id)->pluck('index_show'); } } } $result['err'] = 0; $result['msg'] = ''; $result['data'] = $this->toTree($classify); 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 mhomepageModify() { $cus_id = Auth::id(); $template_id = WebsiteInfo::where('cus_id', $cus_id)->pluck('mobile_tpl_id'); $data = Input::all(); $keys = array_keys($data); if ($keys[0] == 'slidepics') { if ($data['slidepics'] != '') { foreach ($data['slidepics'] as $key => $val) { $data['slidepics'][$key]['title'] = $data['slidepics'][$key]['PC_name']; $data['slidepics'][$key]['image'] = basename($data['slidepics'][$key]['phone_info_pic']); $data['slidepics'][$key]['link'] = $data['slidepics'][$key]['PC_link']; unset($data['slidepics'][$key]['PC_name']); unset($data['slidepics'][$key]['phone_info_pic']); unset($data['slidepics'][$key]['PC_link']); } } } $config_str = WebsiteConfig::where('cus_id', $cus_id)->where('type', 2)->where('template_id', $template_id)->pluck('value'); if ($config_str) { $config_arr = unserialize($config_str); $config_arr[$keys[0]]['value'] = $data[$keys[0]]; } else { $mobile = new PrintController('preview', 'mobile'); $config_arr = $mobile->mobilePageList('global', true); $config_arr[$keys[0]]['value'] = $data[$keys[0]]; } $new_config_str = serialize($config_arr); if ($config_str) { $result = DB::table('website_config')->where('cus_id', $cus_id)->where('type', 2)->where('template_id', $template_id)->update(array('value' => $new_config_str)); } else { $result = DB::table('website_config')->insert(array('cus_id' => $cus_id, 'type' => 2, 'template_id' => $template_id, 'key' => 'global', 'value' => $new_config_str)); } if ($result) { $return_msg = array('err' => 0, 'msg' => ''); } else { $return_msg = array('err' => 3001, 'msg' => '修改失败', 'data' => array()); } return Response::json($return_msg); }
if (!isset($_SESSION['csrfKey'])) { $_SESSION['csrfKey'] = md5(uniqid()); } include $prevFolder . "_config.php"; define("BASE_DIRECTORY", $BASE_DIRECTORY); //define("BASE_DIRECTORY", str_replace("//", "/", $_SERVER['DOCUMENT_ROOT'].$MAIN_ROOT)); define("MAIN_ROOT", $MAIN_ROOT); $PAGE_NAME = ""; include_once BASE_DIRECTORY . "_functions.php"; define("FULL_SITE_URL", getHTTP() . $_SERVER['SERVER_NAME'] . MAIN_ROOT); $mysqli = new btmysql($dbhost, $dbuser, $dbpass, $dbname); $mysqli->set_tablePrefix($dbprefix); $mysqli->set_testingMode(true); $logObj = new Basic($mysqli, "logs", "log_id"); // Get Clan Info $webInfoObj = new WebsiteInfo($mysqli); $webInfoObj->select(1); $websiteInfo = $webInfoObj->get_info_filtered(); $CLAN_NAME = $websiteInfo['clanname']; $THEME = $websiteInfo['theme']; define("THEME", $THEME); $arrWebsiteLogoURL = parse_url($websiteInfo['logourl']); if (!isset($arrWebsiteLogoURL['scheme']) || $arrWebsiteLogoURL['scheme'] == "") { $websiteInfo['logourl'] = $MAIN_ROOT . "themes/" . $THEME . "/" . $websiteInfo['logourl']; } $IP_ADDRESS = $_SERVER['REMOTE_ADDR']; // Check Debug Mode if ($websiteInfo['debugmode'] == 1) { ini_set('display_errors', 1); ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT); } else {
/** * 文件上传 * ===点击选择图片后上传=== */ public function fileupload() { $customer = Auth::user()->name; $cus_id = Auth::id(); $target = Input::get('target'); $files = Input::file(); $dir = public_path('customers/' . $customer . '/cache_images/'); $customerinfo = Customer::find($cus_id); if (!is_dir($dir)) { $this->CreateAllDir(); mkdir($dir, 0777, true); } // $size = 0; //===文件大小 if ($files) { if ($target == 'imgcache') { $id = $cus_id; $filename = Input::get('filename'); $filename = explode('.', $filename); $filetype = end($filename); $name = WebsiteInfo::leftJoin('template', 'pc_tpl_id', '=', 'template.id')->where('website_info.cus_id', $id)->pluck('name'); if ($files['upload_file0']->isValid()) { $type = $files['upload_file0']->getClientOriginalExtension(); $truth_name = time() . mt_rand(100, 999) . '.' . $type; $up_result = $files['upload_file0']->move(public_path('templates/' . $name . '/img_cache/'), $truth_name); if ($up_result) { $load['name'] = $truth_name; if ($filetype == 'html') { $load['url'] = '{$site_url}images/' . $truth_name; } elseif ($filetype == 'json') { $load['url'] = 'images/' . $truth_name; } else { $load['url'] = '../images/' . $truth_name; } $return = ['err' => 0, 'msg' => '图片上传成功', 'data' => $load]; } else { $return = ['err' => 1001, 'msg' => '图片上传失败', 'data' => '']; } } return Response::json($return); } else { $data = array(); $i = 0; foreach ($files as $file) { if ($file->isValid()) { $type = $file->getClientOriginalExtension(); $fileName = time() . str_random(4) . '.' . $type; $up_result = $file->move($dir . '/', $fileName); if ($up_result) { $data[$i]['name'] = $fileName; $data[$i]['url'] = asset('customers/' . $customer . '/cache_images/' . $fileName); $i++; } } } return Response::json(['err' => 0, 'msg' => '$target!=imgcache', 'data' => $data]); } } else { $file = Input::get('image'); if (strpos($file, 'jpeg')) { $type = 'jpg'; } else { $type = 'png'; } $fileName = time() . str_random(4) . '.' . $type; if (strpos($file, 'jpeg')) { $upload = file_put_contents($dir . '/' . $fileName, base64_decode(preg_replace('/data\\:image\\/jpeg\\;base64\\,/i', '', $file))); } else { $upload = file_put_contents($dir . '/' . $fileName, base64_decode(preg_replace('/data\\:image\\/png\\;base64\\,/i', '', $file))); } if ($upload) { return Response::json(['err' => 0, 'msg' => 'empty($file)&&$upload', 'data' => ['name' => $fileName, 'url' => asset('customers/' . $customer . '/cache_images/' . $fileName), 's_url' => '/images/s/' . $target . '/' . $fileName]]); } else { return Response::json(['err' => 1001, 'msg' => '上传文件失败', 'data' => []]); } } }
public function notifyNewMember($accepted = true) { $webInfoObj = new WebsiteInfo($this->MySQL); $webInfoObj->select(1); $webInfo = $webInfoObj->get_info_filtered(); $to = $this->arrObjInfo['email']; if ($accepted) { $subject = $webInfo['clanname'] . ": Member Application Accepted"; $message = "You have been accepted to become a full member of " . $webInfo['clanname'] . "! Go to <a href='" . FULL_SITE_URL . "'>" . FULL_SITE_URL . "</a> to log in to your account."; } else { $subject = $webInfo['clanname'] . ": Member Application Declined"; $message = "Your application to become a member of " . $webInfo['clanname'] . " has been declined. You may try signing up again by going to <a href='" . FULL_SITE_URL . "'>" . FULL_SITE_URL . "</a>."; } $webInfoObj->objBTMail->sendMail($to, $subject, $message); }
/** * 定义用户id、用户名、 * @param string $showtpye * @param string $type */ function __construct($showtpye = 'preview', $type = 'pc') { $this->showtype = $showtpye; $this->type = $type; $this->cus_id = Auth::id(); $this->customer = Auth::user()->name; if ($this->showtype == 'preview') { $this->source_dir = '/customers/' . $this->customer . '/images/'; //asset('customers/' . $this->customer . '/images/') . '/'; if ($this->type == 'mobile') { $this->domain = '/mobile'; //url() . '/mobile'; $this->tpl_id = WebsiteInfo::where('cus_id', $this->cus_id)->pluck('mobile_tpl_id'); $this->themename = DB::table('template')->leftJoin('website_info', 'website_info.mobile_tpl_id', '=', 'template.id')->where('website_info.cus_id', '=', $this->cus_id)->pluck('template.name'); $this->source_dir = '/customers/' . $this->customer . '/mobile/images/'; //asset('customers/' . $this->customer . '/mobile/images/') . '/'; self::$cus_domain = ''; //CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_domain'); } else { $this->domain = ''; //url(); $this->tpl_id = WebsiteInfo::where('cus_id', $this->cus_id)->pluck('pc_tpl_id'); $this->themename = DB::table('template')->leftJoin('website_info', 'website_info.pc_tpl_id', '=', 'template.id')->where('website_info.cus_id', '=', $this->cus_id)->pluck('template.name'); self::$cus_domain = ''; //CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_domain'); } $this->site_url = '/templates/' . $this->themename . '/'; } else { if ($this->type == 'mobile') { $this->tpl_id = WebsiteInfo::where('cus_id', $this->cus_id)->pluck('mobile_tpl_id'); $this->themename = DB::table('template')->leftJoin('website_info', 'website_info.mobile_tpl_id', '=', 'template.id')->where('website_info.cus_id', '=', $this->cus_id)->pluck('template.name'); $mobile_domain = CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_domain'); $mobile_domain = str_replace('http://', '', $mobile_domain); if (strpos($mobile_domain, '/mobile')) { $this->domain = '/mobile'; } //$this->domain = '';//CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_domain'); } else { $this->tpl_id = WebsiteInfo::where('cus_id', $this->cus_id)->pluck('pc_tpl_id'); $this->themename = DB::table('template')->leftJoin('website_info', 'website_info.pc_tpl_id', '=', 'template.id')->where('website_info.cus_id', '=', $this->cus_id)->pluck('template.name'); $this->domain = ''; //CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_domain'); } self::$cus_domain = ''; // $this->domain; $this->site_url = $this->domain . '/'; $this->source_dir = '/images/'; //$this->domain . '/images/'; } }
public function templateUploadZip() { set_time_limit(0); $files = Input::file(); $cus_id = Auth::id(); $temptype = Input::get("type"); $customization = Customer::where('id', $cus_id)->pluck('customization'); if ($customization <= 0 || $customization != 3 && $customization != $temptype) { return Response::json(['err' => 1001, 'msg' => '您未开启相应的高级定制,高级定制需要付费,如需要,请联系客服', 'data' => '您未开启高级定制,高级定制需要付费,如需要,请联系客服']); } $files = Input::file(); $file = $files['upload_zip']; if ($file->isValid()) { $type = $file->getClientOriginalExtension(); $truth_name = date('ymd') . mt_rand(100, 999) . '.' . $type; if ($type == "zip") { if (file_exists(public_path("temp_templates/{$truth_name}"))) { $result = ['err' => 1000, 'msg' => '模板覆盖成功']; } else { $up_result = $file->move(public_path("temp_templates/"), $truth_name); if ($up_result) { if ($temptype == 1) { $name = WebsiteInfo::leftJoin('template', 'pc_tpl_id', '=', 'template.id')->where('website_info.cus_id', $cus_id)->pluck('name'); } else { $name = WebsiteInfo::leftJoin('template', 'mobile_tpl_id', '=', 'template.id')->where('website_info.cus_id', $cus_id)->pluck('name'); } $tpl_name = $name; $result = $this->saveTemplate($truth_name, $tpl_name, $temptype); $pushed = WebsiteInfo::where("cus_id", $cus_id)->pluck("pushed"); if ($temptype == 1) { if ($pushed == 0 || $pushed == 2) { $pushed = 2; } else { $pushed = 1; } } else { if ($pushed == 0 || $pushed == 3) { $pushed = 3; } else { $pushed = 1; } } WebsiteInfo::where("cus_id", $cus_id)->update(array("pushed" => $pushed)); } else { $result = ['err' => 1001, 'msg' => '模板覆盖失败']; } } } else { $result = ['err' => 1002, 'msg' => '模板覆盖失败,请上传正确的文件类型']; } } else { $result = ['err' => 1002, 'msg' => '模板覆盖失败,请上传正确的文件类型']; } return Response::json($result); }
/** * 判断一个用户是否需要推送并返回修改的次数 */ public function isNeedPush() { $count = Classify::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count(); $count += Articles::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count(); $count += WebsiteConfig::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count(); $count += WebsiteInfo::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count(); $count += MobileHomepage::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count(); $count += CustomerInfo::where('cus_id', $this->cus_id)->where('pushed', '>', 0)->count(); $data_final = ['err' => 0, 'msg' => '', 'data' => ['cache_num' => $count]]; return Response::json($data_final); }
$consoleOptionObj->addNew($arrColumns, $arrValues); $newOrderNum++; } $arrValues = array($tempCatID, $consoleOptionName, $arrConsoleOptionInfo[$key]['filename'], $newOrderNum, "1", $arrConsoleOptionInfo[$key]['hide'], ""); $consoleOptionObj->addNew($arrColumns, $arrValues); $consoleOptionObj->resortOrder(); } elseif ($consoleOptionName == "Private Messages" && $checkConsole !== false && $pmCatID != "") { $consoleOptionObj->select($checkConsole); $consoleOptionObj->update(array("consolecategory_id", "sortnum"), array($pmCatID, 0)); $consoleOptionObj->resortOrder(); } } // Check for valid theme $arrValidThemes = array(); $themeOptions .= ""; $websiteInfoObj = new WebsiteInfo($mysqli); $websiteInfoObj->select(1); $themeName = $websiteInfoObj->get_info("theme"); // Add New Websiteinfo $websiteInfoObj->multiUpdate(array("default_timezone", "date_format", "display_date"), array("America/New_York", "l, F j, Y", "1")); $verifyTheme = file_exists("../themes/" . $themeName . "/themeinfo.xml"); $_SESSION['btUsername'] = $member->get_info("username"); $_SESSION['btPassword'] = $member->get_info("password"); if (!$verifyTheme) { $arrThemes = scandir("../themes"); $themeOptions = ""; foreach ($arrThemes as $themeName) { $themeURL = "../themes/" . $themeName; if (is_dir($themeURL) && $themeName != "." && $themeName != ".." && is_readable($themeURL . "/THEMENAME.txt") && file_exists("../themes/" . $themeName . "/themeinfo.xml")) { $arrValidThemes[] = $themeName; $dispThemeName = file_get_contents($themeURL . "/THEMENAME.txt");
public function fileedit() { $cus_id = Auth::id(); $filename = Input::get('filename'); $content = Input::get('code'); if ($filename === NULL || $content === NULL) { $result = ['err' => 1001, 'msg' => '提交数据错误']; } else { $file_type = explode('.', $filename); $file_type = end($file_type); $template = WebsiteInfo::join('template', 'pc_tpl_id', '=', 'template.id')->where('website_info.cus_id', $cus_id)->pluck('name'); if ($file_type == 'css') { $dst = public_path('templates/' . $template . '/css/' . $filename); } elseif ($file_type == 'js') { $dst = public_path('templates/' . $template . '/js/' . $filename); } elseif ($file_type == 'json') { $dst = public_path('templates/' . $template . '/json/' . $filename); } else { if ($file_type == 'html') { $dst = app_path('views/templates/' . $template . '/' . $filename); } } if (file_exists($dst)) { $edit = file_put_contents($dst, $content); if ($edit == FALSE) { $result = ['err' => 1001, 'msg' => '无法编辑文件']; } else { $result = ['err' => 0, 'msg' => '']; } } else { $result = ['err' => 1001, 'msg' => '文件不存在']; } } return Response::json($result); }
public function modifyCustomer() { if ($this->authData()) { $update['name'] = trim(Input::get('name')); $update['email'] = trim(Input::get('email')); $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'); $cus_id = Customer::where('name', $update['name'])->pluck('id'); if ($cus_id) { //修改操作 $save = Customer::where('id', $cus_id)->update($update); if ($save) { $result = ['err' => 1000, 'msg' => '更新用户成功']; } else { $result = ['err' => 1002, 'msg' => '更新用户失败']; } } else { //print_r($_POST);exit; //增加操作 $update['password'] = Hash::make($update['name']); $insert_id = Customer::insertGetId($update); if ($insert_id) { WebsiteInfo::insert(['cus_id' => $insert_id]); CustomerInfo::insert(['cus_id' => $insert_id]); //创建客户目录 mkdir(public_path('customers/' . $update['name'])); mkdir(public_path('customers/' . $update['name']) . '/datail'); 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/s'); mkdir(public_path('customers/' . $update['name']) . '/images/ueditor'); mkdir(public_path('customers/' . $update['name']) . '/mobile'); mkdir(public_path('customers/' . $update['name']) . '/mobile/datail'); 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/s'); mkdir(public_path('customers/' . $update['name']) . '/mobile/images/ueditor'); $ftp_array = explode(':', $update['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, $update['ftp_user'], $update['ftp_pwd']); ftp_mkdir($conn, '/images'); ftp_mkdir($conn, '/images/ueditor'); ftp_mkdir($conn, '/images/l'); ftp_mkdir($conn, '/images/l/category'); ftp_mkdir($conn, '/images/l/articles'); ftp_mkdir($conn, '/images/l/common'); ftp_mkdir($conn, '/images/l/page_index'); ftp_mkdir($conn, '/images/s'); ftp_mkdir($conn, '/images/l/category'); ftp_mkdir($conn, '/images/l/articles'); ftp_mkdir($conn, '/images/l/common'); ftp_mkdir($conn, '/images/l/page_index'); ftp_mkdir($conn, '/mobile/images'); ftp_mkdir($conn, '/mobile//images/ueditor'); ftp_mkdir($conn, '/mobile//images/l'); ftp_mkdir($conn, '/mobile//images/l/category'); ftp_mkdir($conn, '/mobile//images/l/articles'); ftp_mkdir($conn, '/mobile//images/l/common'); ftp_mkdir($conn, '/mobile//images/l/page_index'); ftp_mkdir($conn, '/mobile//images/s'); ftp_mkdir($conn, '/mobile//images/l/category'); ftp_mkdir($conn, '/mobile//images/l/articles'); ftp_mkdir($conn, '/mobile//images/l/common'); ftp_mkdir($conn, '/mobile//images/l/page_index'); ftp_close($conn); } $result = ['err' => 1000, 'msg' => '创建用户成功']; } else { $result = ['err' => 1001, 'msg' => '创建用户失败']; } } } else { $result = ['err' => 1003, 'msg' => '验证不通过']; } return Response::json($result); }
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; }
/** * 还原用户 * @param ftp_connect $conn ftp对象 * @param string $dir 路径 * @param string $username 用户名 * @return null */ function reductionCustomer() { if ($this->authData()) { $result = ''; $name = Input::get('username'); // $name = Input::get('name'); $Customer = Customer::where('name', $name)->where('is_del', 0)->get(); if (!isset($Customer[0])) { return Response::json(['err' => 1004, 'msg' => '用户不存在或未删除']); exit; } //修改静态服务器文件名 $conn = @ftp_connect($Customer[0]['ftp_address'], $Customer[0]['ftp_port']); if (!$conn) { return Response::json(['err' => 1004, 'msg' => 'FTP服务器连接失败']); exit; } if (!@ftp_login($conn, $Customer[0]['ftp_user'], $Customer[0]['ftp_pwd'])) { return Response::json(['err' => 1004, 'msg' => 'FTP服务器登陆失败']); exit; } @ftp_pasv($conn, 1); // 打开被动模拟 if (!@ftp_rename($conn, $name . "_beifen", $name)) { return Response::json(['err' => 1004, 'msg' => 'FTP服务器静态没有备份']); exit; } @ftp_close($conn); //解压备份的图片文件 $zip = new ZipArchive(); if (!is_dir(public_path("customers/" . $name))) { mkdir("customers/" . $name); } if ($zip->open(public_path("customers_backups/" . $name . '.zip')) === TRUE) { $zip->extractTo(public_path("customers/" . $name)); $zip->close(); } else { return Response::json(['err' => 1004, 'msg' => '解压失败']); exit; } if ($zip->open(public_path("packages/customernull.zip")) === TRUE) { $zip->extractTo(public_path("customers/" . $name)); } else { return Response::json(['err' => 1004, 'msg' => '解压失败2']); exit; } $zip->close(); //更新数据库 $update['is_del'] = 1; $cus_id = $Customer[0]['id']; $WebsiteInfo = WebsiteInfo::where('cus_id', $cus_id)->where('is_del', 0)->get(); if ($WebsiteInfo) { WebsiteInfo::where('cus_id', $cus_id)->update($update); } $CustomerInfo = CustomerInfo::where('cus_id', $cus_id)->where('is_del', 0)->get(); if ($CustomerInfo) { CustomerInfo::where('cus_id', $cus_id)->update($update); } Customer::where('id', $cus_id)->update($update); unlink(public_path("customers_backups/" . $name . ".zip")); $result = ['err' => 1000, 'msg' => '还原用户成功']; } else { $result = ['err' => 1002, 'msg' => '验证不通过']; } return Response::json($result); }