Example #1
0
 public function update_weight()
 {
     if ($this->mNeedCheckIn && !$this->prms['weight']) {
         $this->errorOutput(NO_OPRATION_PRIVILEGE);
     }
     $data = json_decode(html_entity_decode($this->input['data']), 1);
     if (!is_array($data) || !$data) {
         $this->errorOutput('NO_FORMAT');
     }
     foreach ($data as $rid => $weight) {
         if ($rid) {
             $this->obj->update_content_relation_by_id($rid, array('weight' => $weight));
             //$this->obj->update('content_client_relation', 'relation_id=' . $rid, array('weight' => $weight));
         }
     }
     if ($this->settings['is_syn_clouds']) {
         include_once CUR_CONF_PATH . 'lib/content_syn.class.php';
         $content_syn = new content_syn();
         $content_syn->update_syn_weight($data);
     }
     //清除memcache缓存
     $this->memcache_flush(APP_UNIQUEID);
     $this->addItem('success');
     $this->output();
 }
Example #2
0
 public function check_mk_publish_content($data = array())
 {
     if (!$data) {
         $sql = "SELECT * FROM " . DB_PREFIX . "content_publish_time ORDER BY id LIMIT 1";
         $data = $this->db->query_first($sql);
         if (empty($data)) {
             echo "没有可执行计划";
             exit;
         }
         $sql = "DELETE FROM " . DB_PREFIX . "content_publish_time WHERE id=" . $data['id'];
         $this->db->query($sql);
     }
     if ($this->settings['App_mk_publish_content']) {
         $this->curl = new curl($this->settings['App_mk_publish_content']['host'], $this->settings['App_mk_publish_content']['dir']);
         $this->curl->setSubmitType('post');
         $this->curl->setReturnFormat('json');
         $this->curl->initPostData();
         $this->curl->addRequestData('html', true);
         $this->curl->addRequestData('cmid', $data['content_id']);
         $this->curl->request('mk_publish_content.php');
     }
     if ($this->settings['is_syn_clouds']) {
         $content_data = $this->obj->get_all_content_by_relationid($data['content_id']);
         include_once CUR_CONF_PATH . 'lib/content_syn.class.php';
         $content_syn = new content_syn();
         if (!$content_data) {
             $content_syn->delete_syn_content($data['content_id']);
         } else {
             $content_syn->content($data['content_id']);
         }
     }
     if ($this->settings['App_mkpublish']) {
         $content_data = $content_data ? $content_data : $this->obj->get_all_content_by_relationid($data['content_id'], true);
         if ($this->settings['is_need_audit']) {
             if ($content_data && is_array($content_data)) {
                 if ($content_data['status'] != 1) {
                     $this->mk->del_publish(array('rid' => $data['content_id']));
                     //请求访问统计,更改对应已被删除内容
                     if ($data['cid']) {
                         @(include ROOT_PATH . 'lib/class/access.class.php');
                         if (class_exists('access')) {
                             $access = new access();
                             $access->delete($data['cid']);
                         }
                     }
                     @(include DATA_DIR . 'hooks/publish.php');
                     exit;
                 }
             }
         }
         if (!$content_data) {
             $this->mk->del_publish(array('rid' => $data['content_id']));
             //请求访问统计,更改对应已被删除内容
             if ($data['cid']) {
                 @(include ROOT_PATH . 'lib/class/access.class.php');
                 if (class_exists('access')) {
                     $access = new access();
                     $access->delete($data['cid']);
                 }
             }
             @(include DATA_DIR . 'hooks/publish.php');
             exit;
         }
         $sql = "SELECT id FROM " . DB_PREFIX . "content_field WHERE bundle_id='" . $content_data['bundle_id'] . "' AND module_id='" . $content_data['module_id'] . "' AND content_type!='' AND struct_ast_id='' ORDER  BY id";
         $content_type = $this->db->query_first($sql);
         $plan['title'] = $content_data['title'];
         $plan['site_id'] = $content_data['site_id'];
         $plan['page_data_id'] = $content_data['column_id'];
         $plan['content_type'] = intval($content_type['id']);
         $plan['template_sign'] = $content_data['template_sign'];
         $plan['rid'] = $content_data['id'];
         $plan['content_type_sign'] = $content_data['bundle_id'];
         $plan['client_type'] = 2;
         $plan['content_detail'] = array('content_url' => $content_data['content_url'], 'id' => $content_data['id'], 'rid' => $content_data['id'], 'cid' => $content_data['cid'], 'content_fromid' => $content_data['content_fromid'], 'file_name' => $content_data['file_name'], 'template_sign' => $content_data['template_sign'], 'content_type_sign' => $content_data['bundle_id'], 'column_id' => $content_data['column_id'], 'site_id' => $content_data['site_id']);
         $error_data = $plan;
         //取栏目的page_id
         include_once ROOT_PATH . 'lib/class/publishsys.class.php';
         $this->pub_sys = new publishsys();
         $page_data = $this->pub_sys->get_page_by_sign('column', $content_data['site_id']);
         if (!$page_data['id']) {
             //插入错误日志;
             $error_data['failure'] = '模板->页面管理:可能没有栏目页面类型,或者栏目配置错误';
             $this->insert_error_log($error_data);
             return;
         }
         $plan['page_id'] = $page_data['id'];
         if ($content_data['template_sign'] && in_array($content_data['bundle_id'], array('special'))) {
             //查询页面类型id
             $page_data_c = $this->pub_sys->get_page_by_sign($content_data['bundle_id']);
             if ($page_data_c['id']) {
                 $plan['page_data_id_c'] = $content_data['content_fromid'];
                 $plan['page_id_c'] = $page_data_c['id'];
             } else {
                 $plan['template_sign'] = '';
                 //插入错误日志;
                 $error_data['failure'] = '模板->页面管理:可能没有专题页面类型,或者专题配置,专题添加参数错误';
                 $this->insert_error_log($error_data);
                 return;
             }
         } else {
             $plan['template_sign'] = '';
         }
         $this->mk->mk_publish($plan);
         @(include DATA_DIR . 'hooks/publish.php');
     }
 }