Beispiel #1
0
 public function classifyList()
 {
     $customer = Auth::user()->name;
     $cus_id = Auth::id();
     //$classify = Classify::where('cus_id', $cus_id)->whereNotIn('type',array(5,6,7,8))->orderBy('sort')->orderBy('id')->get()->toArray();
     $classify = Classify::where('cus_id', $cus_id)->orderBy('sort')->orderBy('id')->get()->toArray();
     return $this->toTree($classify);
 }
Beispiel #2
0
 /**
  * Konstrukor zapewniaj±cy ogóln± inicjalizacjê systemu przygotowywania danych:
  * tokenizer, korekta ortograficzna, uzupe³nianie polskich znaków, wulgaryzmy.
  *
  * @param mysqli $dbconn Obiekt po³±czenia z baz± danych u¿ywany w podklasach.
  * @param string $dictdir Folder ze s³ownikami, stoplistami itp.
  * @param int $idc Identyfikator wykorzystywanego zestawu komentarzy.
  * @param bool $copy_unknown Czy pozostawiaæ nierozpoznane wyrazy?
  * @param array $options Parametry konkretnego klasyfikatora jako tab. asocjacyjna.
  */
 function __construct($dbconn, $dictdir, $idc, $copy_unknown, $options = null)
 {
     parent::__construct($dbconn, $dictdir, $idc, $copy_unknown, null);
     if (is_null($options)) {
         return;
     }
     foreach ($options as $k => $v) {
         $this->{$k} = $v;
     }
 }
Beispiel #3
0
 public function articleMoveClassify()
 {
     $ids = explode(',', Input::get('id'));
     $c_id = Input::get('target_catid');
     $data = array();
     $err = false;
     $c_c_id = Classify::where('p_id', $c_id)->pluck('id');
     if ($c_c_id) {
         $return_msg = array('err' => 3001, 'msg' => '移动失败,节点栏目不能存在文章', 'data' => array());
     } else {
         if (count($ids) > 1) {
             foreach ($ids as $id) {
                 $article = Articles::find($id);
                 $article->c_id = $c_id;
                 $result = $article->save();
                 if ($result) {
                     $data[] = $id;
                 } else {
                     $err = true;
                 }
             }
             if ($err) {
                 $return_msg = array('err' => 3001, 'msg' => '部分移动失败', 'data' => $data);
             } else {
                 $return_msg = array('err' => 0, 'msg' => '');
             }
         } else {
             $article = Articles::find($ids[0]);
             $article->c_id = $c_id;
             $result = $article->save();
             if ($result) {
                 $return_msg = array('err' => 0, 'msg' => '');
             } else {
                 $return_mag = array('err' => 3001, 'msg' => '移动失败');
             }
         }
     }
     return Response::json($return_msg);
 }
 public function getMobilePageData()
 {
     $cus_id = Auth::id();
     $mobile = new PrintController('preview', 'mobile');
     $m_catlist = Classify::where('mobile_show', 1)->where('cus_id', $mobile->cus_id)->whereIn('type', [1, 2, 3, 4])->orderBy('sort')->select('id', 'name', 'p_id', 'type')->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($m_catlist) > 0) {
         foreach ($m_catlist as &$m_arr) {
             $liststr = 'list' . $m_arr['type'] . 'showtypetotal';
             $mobilehome_config = MobileHomepage::where('c_id', $m_arr['id'])->first();
             if ($mobilehome_config) {
                 $m_arr['showtypetotal'] = $showtypetotal->{$liststr};
                 if ($m_arr['showtypetotal']) {
                     $m_arr['index_show'] = $mobilehome_config->index_show;
                     if ($m_arr['showtypetotal'] < $mobilehome_config->m_index_showtype) {
                         $m_arr['showtype'] = 1;
                     } else {
                         $m_arr['showtype'] = $mobilehome_config->m_index_showtype;
                     }
                 } else {
                     $m_arr['showtype'] = 1;
                     $m_arr['index_show'] = 0;
                 }
                 MobileHomepage::where('id', $mobilehome_config->id)->update(array('m_index_showtype' => $m_arr['showtype'], 'index_show' => $m_arr['index_show']));
                 $m_arr['show_num'] = $mobilehome_config->show_num;
                 $m_arr['star_only'] = $mobilehome_config->star_only;
                 $m_arr['s_sort'] = $mobilehome_config->s_sort;
             } else {
                 $m_arr['index_show'] = 0;
                 $m_arr['show_num'] = 0;
                 $m_arr['star_only'] = 0;
                 $m_arr['s_sort'] = 0;
                 $m_arr['showtypetotal'] = $showtypetotal->{$liststr};
                 $m_arr['showtype'] = 0;
             }
             $sort_key[] = $m_arr['s_sort'];
         }
     }
     if (!empty($sort_key) || !empty($m_catlist)) {
         array_multisort($sort_key, $m_catlist);
     }
     //$m_catlist=$this->toTree($m_catlist);
     $data = array();
     $pagelist[] = array('page' => 'index', 'title' => '栏目排序', 'type' => 'category');
     $template_id = WebsiteInfo::where('cus_id', $mobile->cus_id)->pluck('mobile_tpl_id');
     $config_str = WebsiteConfig::where('cus_id', $mobile->cus_id)->where('type', 2)->where('template_id', $template_id)->pluck('value');
     if ($config_str) {
         $config_arr = unserialize($config_str);
         if ($config_arr['slidepics']['value']) {
             ksort($config_arr['slidepics']['value'], SORT_NUMERIC);
         }
         if ($config_arr['slidepics']['value']) {
             $config_arr['slidepics']['value'] = array_merge($config_arr['slidepics']['value']);
         }
     } else {
         $config_arr = $mobile->mobilePageList('global', true);
     }
     foreach ($config_arr as $key => $val) {
         $pagelist[] = array('page' => $key, 'title' => $config_arr[$key]['description'], 'type' => $config_arr[$key]['type']);
         $data[$key] = $config_arr[$key];
     }
     $templatedata['templatedata'] = $data;
     $templatedata['pagelist'] = $pagelist;
     $templatedata['m_catlist'] = $m_catlist;
     $mobile->replaceUrl($templatedata);
     $return_msg = array('err' => 0, 'msg' => '', 'data' => $templatedata);
     return Response::json($return_msg);
 }
Beispiel #5
0
 /**
  * 用户修改设置
  */
 public function customerSetting()
 {
     $cus_id = Auth::id();
     $data['company'] = Input::get('company_name');
     $pc_domain = Input::get('domain_pc');
     $data['pc_domain'] = strstr($pc_domain, 'http') ? $pc_domain : 'http://' . $pc_domain;
     $mobile_domain = Input::get('domain_m');
     $data['mobile_domain'] = strstr($mobile_domain, 'http') ? $mobile_domain : 'http://' . $mobile_domain;
     $data['favicon'] = basename(Input::get('favicon'));
     $data['logo'] = basename(Input::get('logo_large'));
     $data['logo_small'] = basename(Input::get('logo_small'));
     $data['pc_header_script'] = Input::get('pc_header_script');
     $data['mobile_header_script'] = Input::get('mobile_header_script');
     $data['title'] = Input::get('title');
     $data['keywords'] = Input::get('keywords');
     $data['description'] = Input::get('description');
     $data['footer'] = Input::get('footer');
     $data['mobile_footer'] = Input::get('mobile_footer');
     $data['pc_footer_script'] = Input::get('pc_footer_script');
     $data['mobile_footer_script'] = Input::get('mobile_footer_script');
     $data['pc_page_count'] = Input::get('pc_num_per_page') ? Input::get('pc_num_per_page') : 12;
     $data['pc_page_links'] = Input::get('pc_num_pagenav') ? Input::get('pc_num_pagenav') : 8;
     $data['mobile_page_count'] = Input::get('m_num_per_page') ? Input::get('m_num_per_page') : 12;
     $data['mobile_page_links'] = Input::get('m_num_pagenav') ? Input::get('m_num_pagenav') : 3;
     $data['contact_name'] = Input::get('contactor');
     $data['telephone'] = Input::get('telephone');
     $data['mobile'] = Input::get('mobile');
     $data['fax'] = Input::get('fax');
     $data['email'] = Input::get('mail');
     $data['qq'] = Input::get('qq');
     $data['address'] = Input::get('address');
     $update = CustomerInfo::where('cus_id', $cus_id)->update($data);
     if ($update) {
         Articles::where('cus_id', $cus_id)->where('pushed', 0)->update(array('pushed' => 1));
         Classify::where('cus_id', $cus_id)->where('pushed', 0)->update(array('pushed' => 1));
         $result = ['err' => 0, 'msg' => '', 'data' => ''];
     } else {
         $result = ['err' => 1002, 'msg' => '无法保存数据', 'data' => ''];
     }
     return Response::json($result);
 }
Beispiel #6
0
 private function delChildClassify($c_id)
 {
     $cus_id = Auth::id();
     $child_ids = Classify::where('p_id', $c_id)->where('cus_id', $cus_id)->lists('id');
     if (count($child_ids)) {
         foreach ($child_ids as $id) {
             Classify::where('id', $id)->where('cus_id', $cus_id)->delete();
             Articles::where('c_id', $id)->where('cus_id', $cus_id)->delete();
             $this->delMobileHomepage($id);
             $this->delChildClassify($id);
         }
     }
 }
Beispiel #7
0
 /**
  * 判断一个用户是否需要推送并返回修改的次数
  */
 public function isNeedPush()
 {
     $count = Classify::where('cus_id', $this->cus_id)->where('pushed', 1)->count();
     $count += Articles::where('cus_id', $this->cus_id)->where('pushed', 1)->count();
     $data_final = ['err' => 0, 'msg' => '', 'data' => ['cache_num' => $count]];
     return Response::json($data_final);
 }
Beispiel #8
0
 /**
  * ===获取当前栏目===
  * 若c_id空,获取默认栏目导航
  * @param type $c_id        当前栏目id
  * @param type $posnavs     当前栏目导航内容
  * @return type
  */
 private function getPosNavs($c_id, &$posnavs = array())
 {
     $classify = Classify::where('id', $c_id)->first();
     $arr['name'] = $classify->name;
     $arr['en_name'] = $classify->en_name;
     if ($classify->type == 6) {
         if ($classify->open_page == 2) {
             $arr['link'] = $classify->url . '" target="_blank';
         } else {
             $arr['link'] = $classify->url;
         }
     } else {
         if ($this->showtype == 'preview') {
             $arr['link'] = $this->domain . '/category/' . $c_id;
         } else {
             $arr['link'] = $this->domain . '/category/' . $c_id . '.html';
         }
     }
     $arr['icon'] = '<i class="iconfont">' . $classify->icon . '</i>';
     array_unshift($posnavs, $arr);
     if ($classify->p_id > 0) {
         $this->getPosNavs($classify->p_id, $posnavs);
     }
     return $posnavs;
 }
Beispiel #9
0
 /**
  * 删除用户数据
  */
 public function deleteFormUserdata()
 {
     $form_id = Input::get('form_id');
     $id = Input::get('id');
     $param['form_id'] = $form_id;
     $param['id'] = $id;
     $param['flag'] = 1;
     $param['host'] = $_SERVER['HTTP_HOST'];
     Classify::where('form_id', $form_id)->update(['pushed' => 1]);
     //		$res = DB::table('form_data_' . $form_id % 10)->where('id', $id)->delete();
     $postFun = new CommonController();
     $res = $postFun->postsend("http://swap.5067.org/admin/form_userdata_delete.php", $param);
     if ($res == 1) {
         $json = Response::json(['err' => 0, 'msg' => '删除成功', 'data' => $res]);
     } else {
         $json = Response::json(['err' => 1, 'msg' => '删除失败', 'data' => '']);
     }
     return $json;
 }
Beispiel #10
0
 /**
  * 判断一个用户是否需要推送并返回修改的次数
  */
 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);
 }
Beispiel #11
0
 private function getPosNavs($c_id, &$posnavs = array())
 {
     $classify = Classify::where('id', $c_id)->first();
     $arr['name'] = $classify->name;
     $arr['en_name'] = $classify->en_name;
     if ($this->showtype == 'preview') {
         $arr['link'] = $this->domain . '/category/' . $c_id;
     } else {
         $arr['link'] = $this->domain . '/category/' . $c_id . '.html';
     }
     array_unshift($posnavs, $arr);
     if ($classify->p_id > 0) {
         $this->getPosNavs($classify->p_id, $posnavs);
     }
     return $posnavs;
 }
Beispiel #12
0
 public function classifyNameModify()
 {
     $cus_id = Auth::id();
     $id = Input::get('id');
     $name = Input::get('name');
     $result = Classify::where('id', $id)->where('cus_id', $cus_id)->update(['name' => $name, 'pushed' => 1]);
     if ($result) {
         return Response::json(['err' => 0, 'msg' => '修改成功']);
     } else {
         return Response::json(['err' => 3001, 'msg' => '修改失败']);
     }
 }
Beispiel #13
0
 public function pushFile()
 {
     $cus_id = Auth::id();
     $customerinfo = CustomerInfo::where('cus_id', $cus_id)->first();
     $pushed_at = strtotime($customerinfo->pushed_at);
     $updated_at = strtotime($customerinfo->updated_at);
     if ($pushed_at == NULL || $pushed_at < $updated_at) {
         //整站重新生成html
         //只需推送$customer.'.zip',不生成$customer.'_update.zip'
     } else {
         $pc_classify_updated = FALSE;
         $mobile_classify_updated = FALSE;
         $pc_classify_updated_at = Classify::where('cus_id', $cus_id)->where('pc_show', 1)->lists('updated_at');
         $mobile_classify_updated_at = Classify::where('cus_id', $cus_id)->where('mobile_show', 1)->lists('updated_at');
         foreach ($pc_classify_updated_at as $v) {
             if ($pushed_at < strtotime($v)) {
                 $pc_classify_updated = TRUE;
                 break;
             }
         }
         foreach ($mobile_classify_updated_at as $v) {
             if ($pushed_at < strtotime($v)) {
                 $mobile_classify_updated = TRUE;
                 break;
             }
         }
         /*
          /*找出PC生成html的部分
         */
         if ($pc_classify_updated || 'PC模版更换') {
             //PC所有页面重新生成html
         } else {
             $pc_article_updated_at = Articles::where('cus_id', $cus_id)->where('pc_show', 1)->lists('updated_at');
             $cids = explode(',', $this->getChirldenCid($v['value']['id']));
             //取得所有栏目id
             //PC文章修改--->其栏目、父级及长辈级栏目、文章页重新生成html
             //PC模版颜色更换
         }
         /*
          /*找出手机生成html的部分
         */
         if ($pc_classify_updated) {
             //手机所有页面重新生成html
         } else {
             //手机文章修改--->其栏目、父级及长辈级栏目、文章页重新生成html
             //手机模版颜色更换
         }
         //更新$customer.'.zip',创建$customer.'_update.zip',推送$customer.'_update.zip',删除$customer.'_update.zip'
     }
 }
Beispiel #14
0
 /**
  * Konstrukor zapewniaj±cy ogóln± inicjalizacjê systemu przygotowywania danych:
  * tokenizer, korekta ortograficzna, uzupe³nianie polskich znaków, wulgaryzmy.
  *
  * @param mysqli $dbconn Obiekt po³±czenia z baz± danych u¿ywany w podklasach.
  * @param string $dictdir Folder ze s³ownikami, stoplistami itp.
  * @param int $idc Identyfikator wykorzystywanego zestawu komentarzy.
  * @param bool $copy_unknown Czy pozostawiaæ nierozpoznane wyrazy?
  * @param array $options Parametry konkretnego klasyfikatora jako tab. asocjacyjna.
  */
 function __construct($dbconn, $dictdir, $idc, $copy_unknown, $options = null)
 {
     $this->idc = $idc;
     $this->copy_unknown = $copy_unknown;
     $this->dbconn = $dbconn;
     if (is_null(self::$validation)) {
         self::$validation = new Validation($dictdir . '/vulgarism.txt');
     }
     if (is_null(self::$tokenizer)) {
         self::$tokenizer = new Tokenizer($dictdir . '/stoplist.txt');
     }
     if (is_null(self::$fsaa)) {
         self::$fsaa = new Fsaa($dictdir . '/lort_acc_full.fsa');
     }
     if (is_null(self::$fsal)) {
         self::$fsal = new Fsal($dictdir . '/llems_full.fsa');
     }
     if (is_null(self::$pspell)) {
         $pspell_config = pspell_config_create("pl");
         // opcje zapewniaj±ce wiêksz± szybko¶æ dzia³ania aspell
         pspell_config_ignore($pspell_config, 4);
         pspell_config_mode($pspell_config, PSPELL_FAST);
         pspell_config_runtogether($pspell_config, false);
         self::$pspell = pspell_new_config($pspell_config);
     }
 }