Beispiel #1
0
function format_ad_material($mat, $mtype = '', $imgwidth = '', $imgheight = '')
{
    //素材路径
    $murl = '';
    //素材原始数组
    if (!is_array($mat)) {
        $isserial = unserialize($mat);
    }
    if ($isserial) {
        $mat = $isserial;
    }
    switch ($mtype) {
        case 'image':
            $murl = hg_fetchimgurl($mat, $imgwidth, $imgheight);
            break;
        case 'flash':
            $murl = hg_fetchimgurl($mat);
            break;
        case 'video':
            $murl = hg_fetchimgurl($mat['img'], $imgwidth, $imgheight);
            break;
        case 'text':
        case 'javascript':
            return $mat;
        default:
            return '';
    }
    return $murl;
}
Beispiel #2
0
 public function get_content($field, $tablename, $array_field, $condition, $offset, $count, $data = array())
 {
     $result = array();
     $sql = "SELECT " . $field . " FROM " . DB_PREFIX . $tablename . " WHERE 1 " . $condition . " LIMIT " . $offset . " , " . $count;
     $info = $this->db->query($sql);
     if ($array_field_arr = explode(',', $array_field)) {
         while ($row = $this->db->fetch_array($info)) {
             $tag = true;
             foreach ($array_field_arr as $v) {
                 $row[$v] = unserialize($row[$v]) ? unserialize($row[$v]) : $row[$v];
                 if (0 && !empty($data['indexpic'])) {
                     if ($v == 'pic' && !empty($row[$v])) {
                         $indexpic = hg_fetchimgurl($data['indexpic']);
                         $nowpic = hg_fetchimgurl($row[$v]);
                         if ($indexpic == $nowpic) {
                             $tag = false;
                         }
                     }
                 }
             }
             if ($tag) {
                 $result[] = $row;
             }
         }
     } else {
         while ($row = $this->db->fetch_array($info)) {
             $result[] = $row;
         }
     }
     $result = to_htmlspecialchars_decode($result);
     return $result;
 }
Beispiel #3
0
 public function show()
 {
     $host = $this->settings['App_publishsys']['host'];
     $dir = $this->settings['App_publishsys']['dir'] . 'admin/';
     $curl = new curl($host, $dir);
     $curl->setSubmitType('post');
     $curl->initPostData();
     $curl->addRequestData('a', 'show');
     $curl->addRequestData('sign', '1');
     $curl->addRequestData('count', '1000');
     $layout_info = $curl->request('layout.php');
     if ($layout_info && is_array($layout_info)) {
         foreach ($layout_info as $k => $v) {
             if ($v['indexpic']) {
                 $v['indexpic'] = $v['indexpic'] ? hg_fetchimgurl($v['indexpic'], 0, 0) : '';
             }
             $layouts[$v['id']] = $v;
         }
     }
     $list_fields = array('id' => array('title' => 'ID', 'exper' => '$v[id]'), 'indexpic' => array('title' => '示意图', 'exper' => '$v[indexpic]'), 'name' => array('title' => '名称', 'exper' => '$v[title]'));
     $op = array('pub_setting' => array('name' => '发布', 'brief' => '', 'attr' => ' onclick="return hg_ajax_post(this, \'发布\', 1);"', 'link' => '?a=publish'));
     $batch_op = array('update' => array('name' => '发布', 'brief' => '', 'attr' => ' onclick="return hg_ajax_batchpost(this, \'publish\', \'发布\', 1,\'\',\'\',\'ajax\');"'));
     $str = 'var gBatchAction = new Array();gBatchAction[\'publish\'] = \'?a=publish\';';
     hg_add_head_element('js-c', $str);
     $this->tpl->addHeaderCode(hg_add_head_element('echo'));
     $this->tpl->addVar('list_fields', $list_fields);
     $this->tpl->addVar('op', $op);
     $this->tpl->addVar('batch_op', $batch_op);
     $this->tpl->addVar('primary_key', 'sign');
     $this->tpl->addVar('list', $layouts);
     $this->tpl->outTemplate('layout');
 }
Beispiel #4
0
 public function detail($condition = '')
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "manage_unit WHERE 1 " . $condition;
     $info = $this->db->query_first($sql);
     if (!$info) {
         return false;
     }
     $info['logo'] = hg_fetchimgurl(unserialize($info['logo']), 80, 60);
     return $info;
 }
 public function detail($id)
 {
     $condition = ' AND id =' . intval($id);
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'staricon WHERE 1' . $condition;
     $starinfo = $this->db->query_first($sql);
     $starinfo['star'] = hg_fetchimgurl(unserialize($starinfo['star']));
     $starinfo['moon'] = hg_fetchimgurl(unserialize($starinfo['moon']));
     $starinfo['sun'] = hg_fetchimgurl(unserialize($starinfo['sun']));
     return $starinfo;
 }
Beispiel #6
0
 public function detail($condition = '')
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "carpark_type WHERE 1 " . $condition;
     $info = $this->db->query_first($sql);
     if (!$info) {
         return false;
     }
     $info['map_marker'] = hg_fetchimgurl(unserialize($info['map_marker']), 80, 60);
     return $info;
 }
 public function callBack()
 {
     $video_info = json_decode(html_entity_decode($this->input['data']), 1);
     if (!$video_info['id']) {
         $this->errorOutput(NO_VIDEO_ID);
         //没有视频id
     }
     if (!$video_info['callback_data'] || !$video_info['callback_data']['tv_play_id']) {
         $this->errorOutput(NO_TV_PLAY_ID);
         //没有电视剧id
     }
     $video_id = $video_info['id'];
     $tv_play_id = $video_info['callback_data']['tv_play_id'];
     $img_info = $video_info['img'];
     $title = $video_info['callback_data']['title'];
     $index_num = $video_info['callback_data']['index_num'];
     //转码成功回调
     if ($video_info['callback_data']['after_callback']) {
         //更新剧集转码状态
         $sql = "UPDATE " . DB_PREFIX . "tv_episode SET transcode_status = 1 WHERE tv_play_id = " . $tv_play_id . " AND video_id = " . $video_id;
         $this->db->query($sql);
         //查询电视剧的信息
         $tv_play_info = $this->mode->get_tv_play_info($tv_play_id);
         $tv_play_info = $tv_play_info[0];
         //设置了逐集发布
         if ($tv_play_info && $tv_play_info['publish_auto']) {
             $column_id_arr = array();
             if ($tv_play_info['column_id']) {
                 $column_id_arr = array_keys(unserialize($tv_play_info['column_id']));
             }
             //审核
             if (intval($tv_play_info['status']) == 2 && !empty($column_id_arr)) {
                 if (!empty($tv_play_info['expand_id'])) {
                     $op = "update";
                     publish_insert_query($tv_play_info, $op, $column_id_arr);
                     $this->insertQueueToLivmediaByVideoID($tv_play_id, $video_id, 'insert', $column_id_arr, $tv_play_info['column_id'], $tv_play_info['pub_time']);
                 }
             }
         }
         return true;
     }
     $data = array('tv_play_id' => $tv_play_id, 'video_id' => $video_id, 'title' => $title, 'index_num' => $index_num, 'img' => serialize($img_info), 'user_name' => $this->user['user_name'], 'user_id' => $this->user['user_id'], 'org_id' => $this->user['org_id'], 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'ip' => hg_getip());
     //开始绑定剧集
     $ret = $this->mode->createEpisode($data);
     if ($ret) {
         $data['id'] = $ret['id'];
         $this->addLogs('新增剧集', '', $data, '新增剧集:' . $ret['id']);
         //返回的数据
         $data['img_index'] = hg_fetchimgurl($img_info);
         $data['title'] = $ret['title'];
         $data['index_num'] = $ret['index_num'];
         $this->addItem($data);
         $this->output();
     }
 }
Beispiel #8
0
 public function fortuneinfo($fun)
 {
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'astro_app_fortuneinfo WHERE astrofun = ' . '\'' . $fun . '\'';
     $res = $this->db->query_first($sql);
     $astrofunimg = unserialize($res['astrofunimg']) ? unserialize($res['astrofunimg']) : array();
     $astrofun['astrofuncn'] = $res['astrofuncn'];
     $astrofun['astrofunimg'] = hg_fetchimgurl($astrofunimg);
     $astrofun['fortuneinfostart'] = date("Y年m月d日", $res['fortuneinfostart']);
     $astrofun['fortuneinfoend'] = date("Y年m月d日", $res['fortuneinfoend']);
     return $astrofun;
 }
 public function get_tuji_image()
 {
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     $sql = "SELECT COUNT(*) AS total_num FROM " . DB_PREFIX . "pics WHERE tuji_id = '" . intval($this->input['id']) . "'";
     $arr = $this->db->query_first($sql);
     //如果该图集里面没有图片
     $return = array();
     if (!$arr['total_num']) {
         $return['pic_url'] = 0;
         $return['total_num'] = 0;
         $return['nochild'] = 1;
         $return['prev_page'] = 0;
         $return['next_page'] = 0;
         $return['current_page'] = 0;
         $return['over'] = 1;
     } else {
         $start = intval($this->input['start']);
         if ($start > intval($arr['total_num']) - 1) {
             $start = intval($arr['total_num']) - 1;
         }
         $order = " ORDER BY p.order_id ASC ";
         $sql = "SELECT p.*,t.default_comment,t.is_namecomment FROM " . DB_PREFIX . "pics p LEFT JOIN " . DB_PREFIX . "tuji t ON t.id = p.tuji_id WHERE p.tuji_id = '" . intval($this->input['id']) . "' {$order} LIMIT {$start},1";
         /*
         $order = " ORDER BY order_id ASC ";
         $sql = "SELECT * FROM ".DB_PREFIX."pics WHERE tuji_id = '".intval($this->input['id'])."' {$order} LIMIT {$start},1";
         */
         $return = $this->db->query_first($sql);
         $return['img_info'] = unserialize($return['img_info']);
         $return['pic_url'] = hg_fetchimgurl($return['img_info']);
         $return['total_num'] = $arr['total_num'];
         $current_page = $start;
         $last_page = intval($arr['total_num']) - 1;
         /*下一页*/
         $over = 0;
         if ($current_page == $last_page) {
             $over = 1;
             $return['next_page'] = $current_page;
         } else {
             $return['next_page'] = $current_page + 1;
         }
         /*前一页*/
         if ($current_page == 0) {
             $return['prev_page'] = 0;
         } else {
             $return['prev_page'] = $current_page - 1;
         }
         $return['current_page'] = intval($current_page) + 1;
         $return['over'] = $over;
     }
     $this->addItem($return);
     $this->output();
 }
Beispiel #10
0
 function detail()
 {
     $id = intval($this->input['id']);
     $sql = "SELECT * FROM " . DB_PREFIX . "astro_app_fortuneinfo WHERE id = " . $id;
     $info = $this->db->query_first($sql);
     $info['astrofunimg'] = unserialize($info['astrofunimg']);
     $info['logo'] = hg_fetchimgurl($info['astrofunimg']);
     $info['fortuneinfostart'] = date("Y年m月d日", $info['fortuneinfostart']);
     $info['fortuneinfoend'] = date("Y年m月d日", $info['fortuneinfoend']);
     $this->addItem($info);
     $this->output();
 }
Beispiel #11
0
 public function detail()
 {
     $ret = array();
     $id = intval($this->input['id']) ? intval($this->input['id']) : 0;
     if (!empty($id)) {
         $ret = $this->obj->detail($id);
         $ret['logo_info'] = unserialize($ret['logo_info']);
         $ret['logo_url'] = hg_fetchimgurl($ret['logo_info'], 100, 100);
     }
     $this->addItem($ret);
     $this->output();
 }
Beispiel #12
0
 public function show($condition = '', $orderby = '', $limit = '')
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "guest  WHERE 1 " . $condition . $orderby . $limit;
     $q = $this->db->query($sql);
     $info = array();
     while ($r = $this->db->fetch_array($q)) {
         $r['create_time'] = date('Y-m-d H:i', $r['create_time']);
         $r['avatar'] = $r['avatar'] ? @unserialize($r['avatar']) : array();
         $r['avatar_url'] = $r['avatar'] ? hg_fetchimgurl($r['avatar']) : '';
         $info[] = $r;
     }
     return $info;
 }
Beispiel #13
0
 public function show($condition = '', $orderby = '', $limit = '')
 {
     $sql = "SELECT m.*,a.guest_type FROM " . DB_PREFIX . "member m LEFT JOIN " . DB_PREFIX . "activation_code a ON a.id = m.activate_code_id WHERE 1 " . $condition . $orderby . $limit;
     $q = $this->db->query($sql);
     $info = array();
     while ($r = $this->db->fetch_array($q)) {
         $r['create_time'] = date('Y-m-d H:i', $r['create_time']);
         $r['avatar'] = $r['avatar'] ? @unserialize($r['avatar']) : array();
         $r['avatar_url'] = $r['avatar'] ? hg_fetchimgurl($r['avatar']) : '';
         $info[] = $r;
     }
     return $info;
 }
Beispiel #14
0
 public function detail()
 {
     $id = isset($this->input['id']) ? intval($this->input['id']) : 0;
     if ($id <= 0) {
         $this->errorOutput(PARAM_WRONG);
     }
     $sql = "SELECT ai.appid as id,ai.*,ci.* FROM " . DB_PREFIX . "authinfo as ai LEFT JOIN " . DB_PREFIX . "custominfo as ci ON ci.appid=ai.appid WHERE ai.appid =" . $id;
     $data = $this->db->query_first($sql);
     $data['avatar'] = hg_fetchimgurl(maybe_unserialize($data['avatar']), '40', '30');
     $data['create_time'] = date('Y-m-d H:i:s', $data['create_time']);
     $data['update_time'] = date('Y-m-d H:i:s', $data['update_time']);
     $this->addItem($data);
     $this->output();
 }
Beispiel #15
0
 public function show()
 {
     $this->verify_setting_prms();
     $condition = $this->get_condition();
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'staricon WHERE 1' . $condition . ' ORDER BY id DESC';
     $query = $this->db->query($sql);
     while ($ret = $this->db->fetch_array($query)) {
         $ret['star'] = hg_fetchimgurl(unserialize($ret['star']));
         $ret['moon'] = hg_fetchimgurl(unserialize($ret['moon']));
         $ret['sun'] = hg_fetchimgurl(unserialize($ret['sun']));
         $this->addItem($ret);
     }
     $this->output();
 }
Beispiel #16
0
 public function show()
 {
     $sql = 'SELECT id,astrofun,astrofun,astrofuncn,astrofunimg,fortuneinfostart,fortuneinfoend FROM ' . DB_PREFIX . 'astro_app_fortuneinfo WHERE 1 ';
     $query = $this->db->query($sql);
     $data = array();
     while ($row = $this->db->fetch_array($query)) {
         $row['astrofunimg'] = unserialize($row['astrofunimg']);
         $row['logo'] = hg_fetchimgurl($row['astrofunimg']);
         $row['fortuneinfostart'] = date("Y年m月d日", $row['fortuneinfostart']);
         $row['fortuneinfoend'] = date("Y年m月d日", $row['fortuneinfoend']);
         $data[$row['id']] = $row;
     }
     return $data;
 }
Beispiel #17
0
 public function doset()
 {
     $url = trim($this->input['define']['DOWNLOAD_URL']);
     is_file(CACHE_DIR . 'client_link.txt') && @unlink(CACHE_DIR . 'client_link.txt');
     if ($url) {
         //生成二维码
         include_once ROOT_PATH . 'lib/class/qrcode.class.php';
         $qrcode_server = new qrcode();
         $data = array('content' => $url);
         $qrcode = $qrcode_server->create($data, -1);
         $img_url = is_array($qrcode) ? hg_fetchimgurl($qrcode) : '';
         file_put_contents(CACHE_DIR . 'client_link.txt', $img_url);
     }
     parent::doset();
 }
Beispiel #18
0
 function detail()
 {
     $id = intval($this->input['id']);
     if ($id < 1 || $id > 12) {
         $this->errorOutput('Id is error');
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "astro_app_info WHERE id = " . $id;
     $info = $this->db->query_first($sql);
     $info['astroimg'] = unserialize($info['astroimg']);
     $info['logo'] = hg_fetchimgurl($info['astroimg']);
     $info['astrostart'] = date("m-d", $info['astrostart']);
     $info['astroend'] = date("m-d", $info['astroend']);
     $this->addItem($info);
     $this->output();
 }
Beispiel #19
0
 public function show()
 {
     if (!$this->user['user_id']) {
         $this->errorOutput(NO_LOGIN);
     }
     $condition = $this->get_condition();
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $dataLimit = " ORDER BY create_time DESC LIMIT " . $offset . ", " . $count;
     $data = array();
     $data = $this->obj->show($condition . $dataLimit);
     if ($data) {
         foreach ($data as $key => $value) {
             $value['img'] = unserialize($value['img']);
             $value['img_url'] = hg_fetchimgurl($value['img'], 200, 200);
             $this->addItem($value);
         }
     }
     $this->output();
 }
Beispiel #20
0
 public function detail($id)
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "medal WHERE id = " . $id;
     $row = $this->db->query_first($sql);
     if (is_array($row) && $row) {
         $row['image_url'] = '';
         if ($row['image']) {
             $row['image'] = maybe_unserialize($row['image']);
             $row['image_url'] = hg_fetchimgurl($row['image']);
         }
         if ($row['start_date']) {
             $row['start_date'] = date('Y-m-d', $row['start_date']);
         }
         if ($row['end_date']) {
             $row['end_date'] = date('Y-m-d', $row['end_date']);
         }
         if ($row['start_date'] || $row['end_date']) {
             $row['is_award_time'] = 1;
         }
         return $row;
     }
     return false;
 }
Beispiel #21
0
 public function detail($member_id)
 {
     if (!$member_id) {
         $condition = " ORDER BY member_id DESC LIMIT 1 ";
     } else {
         $condition = " WHERE member_id IN (" . $member_id . ")";
     }
     $sql = "SELECT m.*,g.name as groupname,gra.name as graname,gra.digital FROM " . DB_PREFIX . "member as m\r\n\t\tLEFT JOIN " . DB_PREFIX . "group as g on g.id=m.gid \r\n\t\tLEFT JOIN " . DB_PREFIX . "grade as gra ON gra.id=m.gradeid" . $condition;
     $row = $this->db->query_first($sql);
     if (is_array($row) && $row) {
         $row['digitalname'] = (defined('GRADEDIGITAL_PREFIX') ? GRADEDIGITAL_PREFIX : 'LV.') . $row['digital'];
         $row['create_time'] = date('Y-m-d H:i:s', $row['create_time']);
         $row['update_time'] = date('Y-m-d H:i:s', $row['update_time']);
         if (!empty($row['groupexpiry'])) {
             $row['groupexpiry'] = date('Y-m-d', $row['groupexpiry']);
         }
         $row['avatar'] = $row['avatar'] && $row['avatar'] != 'a:0:{}' ? hg_fetchimgurl(maybe_unserialize($row['avatar'])) : '';
         if ($row['myData']) {
             $row['myData'] = maybe_unserialize($row['myData']);
         }
         return $row;
     }
     return false;
 }
Beispiel #22
0
 public function show($condition = '', $orderby = '', $limit = '')
 {
     $sql = "SELECT c.*,co.*,m.img_info FROM " . DB_PREFIX . "cinema c \n\t\t\t\tLEFT JOIN " . DB_PREFIX . "content co \n\t\t\t\t\tON c.id=co.cinema_id  \n\t\t\t\tLEFT JOIN " . DB_PREFIX . "material m\n\t\t\t\t\tON c.indexpic = m.id \n\t\t\t\tWHERE 1 " . $condition . $orderby . $limit;
     $q = $this->db->query($sql);
     $info = array();
     while ($r = $this->db->fetch_array($q)) {
         switch ($r['status']) {
             case 0:
                 $r['audit'] = '待审核';
                 break;
                 //审核
             //审核
             case 1:
                 $r['audit'] = '已审核';
                 break;
                 //审核
             //审核
             case 2:
                 $r['audit'] = '已打回';
                 break;
                 //打回
         }
         if ($r['img_info']) {
             $r['img_info'] = hg_fetchimgurl(unserialize($r['img_info']), '128', '128');
         }
         //此处根据情况做一些格式化的处理,如:date('Y-m-d',TIMENOW);
         $r['stime'] = date('H:i', $r['stime']);
         $r['etime'] = date('H:i', $r['etime']);
         $r['create_time'] = date('Y-m-d H:i', $r['create_time']);
         //$r['release_time'] = date('Y-m-d H:i:s',$r['release_time']);
         $r['content'] = stripslashes($r['content']);
         $r['tel'] = @unserialize($r['tel']);
         $info[] = $r;
     }
     return $info;
 }
Beispiel #23
0
 function tuji_info($condition = '', $orderby = ' t.create_time DESC ', $offset = 0, $count = 20, $pub_column = 0)
 {
     $limit = " limit {$offset}, {$count}";
     if (!$pub_column) {
         $sql = "SELECT p.img_info as cover_img,t.*,s.id as sid,s.name as sort_name,s.brief,s.create_time as tuji_time,t.path  FROM " . DB_PREFIX . 'tuji as t LEFT JOIN ' . DB_PREFIX . 'pics as p ON p.id = t.index_id LEFT JOIN ' . DB_PREFIX . 'tuji_node as s ON t.tuji_sort_id=s.id WHERE 1 ' . $condition . $orderby . $limit;
     } else {
         $sql = "SELECT p.img_info as cover_img,t.*,s.id as sid,s.name as sort_name,s.brief,s.create_time as tuji_time,t.path  \r\n                    FROM " . DB_PREFIX . "tuji as t \r\n                    LEFT JOIN " . DB_PREFIX . "pics as p \r\n                        ON p.id = t.index_id \r\n                    LEFT JOIN " . DB_PREFIX . "tuji_node as s \r\n                        ON t.tuji_sort_id=s.id \r\n                    LEFT JOIN " . DB_PREFIX . "pub_column pc\r\n                         ON t.id = pc.aid\r\n                    WHERE 1 " . $condition . $orderby . $limit;
     }
     //图集信息
     $tuji_info = array();
     $tuji_ids = array();
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $tuji_ids[] = $r['id'];
         $r['create_time'] = date('Y-m-d H:i', $r['create_time']);
         $r['update_time'] = date('Y-m-d H:i:s', $r['update_time']);
         $r['tuji_time'] = date('Y-m-d h:i:s', $r['tuji_time']);
         $r['status_display'] = $r['status'];
         $r['status'] = $this->settings['image_upload_status'][$r['status']];
         $r['brief'] = $r['comment'];
         $r['cover_array'] = unserialize($r['cover_url']);
         $r['cover_url'] = hg_fetchimgurl($r['cover_array'], 160);
         $r['cover_img'] = hg_fetchimgurl(unserialize($r['cover_img']), 40, 30);
         $r['img_count'] = $r['total_pic'];
         //获取每个图集里面对应的图片的个数,兼容原统计数
         $tuji_info[$r['id']] = $r;
     }
     if ($tuji_ids) {
         $sql = "SELECT * FROM " . DB_PREFIX . "pics WHERE tuji_id IN (" . implode(',', $tuji_ids) . ")";
         $q_s = $this->db->query($sql);
         while ($row = $this->db->fetch_array($q_s)) {
             $tuji_info[$row['tuji_id']]['img_src'][] = hg_fetchimgurl(unserialize($row['img_info']), 60, 45);
         }
     }
     return $tuji_info;
 }
Beispiel #24
0
 function detail()
 {
     $ret = array();
     if ($this->input['id']) {
         $condition = ' WHERE id in(' . urldecode($this->input['id']) . ') ORDER BY order_id DESC ';
         $sql = " SELECT * FROM " . DB_PREFIX . "pics " . $condition;
         $q = $this->db->query($sql);
         while ($r = $this->db->fetch_array($q)) {
             $r['img_info'] = unserialize($r['img_info']);
             $r['pic_url'] = hg_fetchimgurl($r['img_info'], 160);
             $ret['info'][] = $r;
         }
     } else {
         $ret['mode'] = intval($this->input['mode']);
     }
     $this->addItem($ret);
     $this->output();
 }
Beispiel #25
0
 public function get_player_code()
 {
     $id = $this->input['id'];
     if (!$id) {
         $this->errorOutput('无效视频id');
     }
     $diy_data = array();
     if ($this->input['diy']) {
         $diy_data = json_decode($this->input['diy'], 1);
     }
     //获取播放器参数
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir'] . 'admin/');
     $curl->initPostData();
     $data = array('flag' => 'player', 'admin_id' => $this->user['user_id']);
     foreach ($data as $k => $v) {
         $curl->addRequestData($k, $v);
     }
     $paramters = $curl->request('preferences.php');
     $all_player = array();
     if (!$paramters || $paramters['ErrorCode'] || $paramters['ErrorText']) {
         $paramters = array('width' => $diy_data['width'] ? $diy_data['width'] : 640, 'height' => $diy_data['height'] ? $diy_data['height'] : 480, 'auto_play' => $diy_data['auto_play'] ? $diy_data['auto_play'] : 0, 'config_xml' => $this->settings['player']['config_xml']);
     } else {
         $default_player = array();
         $all_player = $paramters;
         foreach ($paramters as $val) {
             if ($val['status'] == 1) {
                 $default_player = $val;
             }
             if ($diy_data && $val['id'] == $diy_data['player_id']) {
                 $default_player = $val;
                 break;
             }
         }
         if (!$default_player) {
             $default_player = $paramters[0];
         }
         $default_config_xml = $this->settings['player']['config_xml_prefix'] . $this->user['user_id'] . '_' . $default_player['id'] . 'vod.xml';
         $paramters = $default_player['admin_settings'];
         $paramters = array('width' => $diy_data['width'] ? $diy_data['width'] : $paramters['player_width'], 'height' => $diy_data['height'] ? $diy_data['height'] : $paramters['player_height'], 'auto_play' => isset($diy_data['auto_play']) ? $diy_data['auto_play'] : $paramters['auto_play'], 'config_xml' => $default_config_xml);
     }
     $player_code = player_code($id, $paramters);
     $player_code['player'] = $all_player;
     //追加所有播放器用于选择
     if (!$diy_data) {
         //只有首次加载返回二维码
         $qrcode = $this->get_qrcode(array('content' => $player_code['url']));
         $player_code['qrcode'] = is_array($qrcode) ? hg_fetchimgurl($qrcode) : '';
     }
     if ($player_code) {
         $this->addItem($player_code);
         $this->output();
     }
 }
Beispiel #26
0
 function save_image_info()
 {
     $pic_ids = $this->input['image_ids'];
     //将要保存的图片id放入数组中
     $pic_order_ids = $this->input['order_ids'];
     //图片排序id放入数组中
     $pic_comment = $this->input['pic_comment'];
     $tuji_id = intval($this->input['tuji_id']);
     if ($pic_ids) {
         //查出原图集下面所有的图片
         $sql = "SELECT * FROM " . DB_PREFIX . "pics WHERE tuji_id = '" . $tuji_id . "'";
         $q = $this->db->query($sql);
         $all_pic_ids = array();
         while ($r = $this->db->fetch_array($q)) {
             $all_pic_ids[] = $r['id'];
         }
         //求出两个数组的差集(要删除的图片)
         $del_pic_ids = array_diff($all_pic_ids, $pic_ids);
         $del_ids = implode(',', $del_pic_ids);
         if ($del_ids) {
             $sql = "DELETE FROM " . DB_PREFIX . "pics WHERE id IN (" . $del_ids . ")";
             $this->db->query($sql);
         }
         //对图片进行编辑
         for ($i = 0; $i < count($pic_ids); $i++) {
             $p_comment = trim(urldecode($pic_comment[$i])) == '这里输入图片描述' ? '' : trim(urldecode($pic_comment[$i]));
             $sql = "UPDATE " . DB_PREFIX . "pics SET description = '" . $p_comment . "',order_id = '" . $pic_order_ids[$i] . "' WHERE id = '" . $pic_ids[$i] . "'";
             $this->db->query($sql);
         }
         //如果设置了某一张的图为封面
         if ($this->input['pic_cover_id']) {
             //查出这张图片的信息
             $sql = "SELECT * FROM " . DB_PREFIX . "pics WHERE id = '" . intval($this->input['pic_cover_id']) . "'";
             $pic_info = $this->db->query_first($sql);
             //更新该图集封面
             $sql = "UPDATE " . DB_PREFIX . "tuji SET cover_url = '" . $pic_info['path'] . $pic_info['new_name'] . "' WHERE id = '" . intval($this->input['tuji_id']) . "'";
             $this->db->query($sql);
             $pic_info['img_info'] = unserialize($pic_info['img_info']);
             $imgurl = hg_fetchimgurl($pic_info['img_info']);
             $change_info = array('tuji_id' => intval($this->input['tuji_id']), 'img' => $imgurl, 'flag' => 1);
         }
     } else {
         $sql = "DELETE FROM " . DB_PREFIX . "pics WHERE tuji_id = '" . $tuji_id . "'";
         $this->db->query($sql);
     }
     if ($change_info) {
         $this->addItem($change_info);
     } else {
         $this->addItem(array('flag' => 0));
     }
     $this->output();
 }
Beispiel #27
0
/**
 *
 * 数据库表单值转换为数组 ...
 * @param unknown_type $type
 * @param unknown_type $value
 */
function outPutFormat($type, $value, $params = array())
{
    if ($type == 'checkbox' && $value) {
        return explode("\n", $value);
    } elseif ($type == 'img' && $value) {
        $re = maybe_unserialize($value);
        if ($params[$type]) {
            return hg_fetchimgurl($re);
        }
        return $re;
    }
    return $value;
}
Beispiel #28
0
 public function preview()
 {
     $person_id = $this->input['id'];
     $feedback_id = $this->input['fid'];
     if (!$person_id) {
         $this->errorOutput(NOID);
     }
     if (!$feedback_id) {
         $this->errorOutput('没有输入反馈的id');
     }
     $forms = $this->mode->get_forms($feedback_id, SORT_ASC);
     if (!$forms) {
         $this->errorOutput('该反馈没有设置表单!');
     }
     if (!file_exists(DATA_DIR . 'preview/' . $feedback_id . '_preview.html')) {
         $template = $this->template($forms, $feedback_id);
     } else {
         $template = file_get_contents(DATA_DIR . 'preview/' . $feedback_id . '_preview.html');
     }
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'materials WHERE content_id = ' . $feedback_id;
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $file = array('host' => $r['host'], 'dir' => $r['dir'], 'filepath' => $r['material_path'], 'filename' => $r['pic_name']);
         $mat[$r['id']] = $file ? hg_fetchimgurl($file, 100) : '';
     }
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'record WHERE person_id = ' . $person_id . ' ORDER BY order_id';
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         if ($r['value'] && $r['type'] == 'file') {
             $mat_ids = explode(',', $r['value']);
             foreach ($mat_ids as $k => $v) {
                 if ($v) {
                     $mat_id = @explode('_', $v);
                     if ($mat_id[1]) {
                         $file_value = $mat[$mat_id[1]] ? '<img src="' . $mat[$mat_id[1]] . '" /> ' : '';
                     } else {
                         $file_value = $mat[$mat_id[0]] ? '<img src="' . $mat[$mat_id[0]] . '" /> ' : '';
                     }
                 }
             }
             $r['type'] = 'standard';
             $r['value'] = $file_value;
         }
         $mr[$r['type'] . '_' . $r['form_id']]['name'] = $r['form_name'];
         $mr[$r['type'] . '_' . $r['form_id']]['value'] = $r['value'];
     }
     foreach ($forms as $v) {
         $td = $v['type'] . '_' . $v['id'];
         if ($v['mode_type'] != 'split') {
             $result[$td]['name'] = $v['name'] ? $v['name'] : '组件' . $v['id'];
             $result[$td]['value'] = $mr[$td] && $mr[$td]['value'] ? $mr[$td]['value'] : '';
         }
     }
     $sql = 'SELECT rp.*,f.title FROM ' . DB_PREFIX . 'record_person rp LEFT JOIN ' . DB_PREFIX . 'feedback f ON rp.feedback_id = f.id WHERE rp.id = ' . $person_id;
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $result['title'] = array('name' => '表单名', 'value' => $r['title']);
         $result['user_name'] = array('name' => '会员名', 'value' => $r['user_name']);
         $result['create_time'] = array('name' => '回收时间', 'value' => $r['create_time'] ? date('Y-m-d H:i:s', $r['create_time']) : '');
         $result['ip'] = array('name' => '来源IP', 'value' => $r['ip']);
         $result['device_token'] = array('name' => '设备号', 'value' => $r['device_token']);
         $result['appname'] = array('name' => '来自客户端', 'value' => $r['appname']);
     }
     preg_match_all('/{#(.*?)}/s', $template, $match);
     $keys = array_keys($result);
     if ($match) {
         $match_all = array_unique($match[1]);
         foreach ($match_all as $k => $v) {
             $find[] = $match[0][$k];
             $find2[] = '{$' . $v . '$}';
             if (in_array($v, $keys)) {
                 $replace[] = $result[$v]['name'];
             } else {
                 if (in_array(str_replace('_value', '', $v), $keys)) {
                     $replace[] = $result[str_replace('_value', '', $v)]['value'];
                 } else {
                     $replace[] = '';
                 }
             }
         }
         $template = str_replace($find2, $replace, $template);
         $html = str_replace($find, $replace, $template);
     }
     $data['preview'] = $html;
     $data['edit'] = $template;
     $this->addItem($data);
     $this->output();
 }
Beispiel #29
0
 public function detail($id)
 {
     if ($id) {
         $sql = "SELECT * FROM " . DB_PREFIX . "qingjia_record WHERE id=" . $id;
     } else {
         $sql = "SELECT * FROM " . DB_PREFIX . "qingjia_record WHERE 1";
     }
     $f = $this->db->query_first($sql);
     $f['img'] = unserialize($f['img']);
     $f['img_url'] = hg_fetchimgurl($f['img'], 200, 200);
     return $f;
 }
Beispiel #30
0
 public function get_split_live_videos()
 {
     if (!$this->input['live_id']) {
         return false;
     }
     $video = array();
     $sql = "SELECT v.*,vm.start_time AS split_start,vm.duration AS split_duration FROM " . DB_PREFIX . "vodinfo v LEFT JOIN " . DB_PREFIX . "vod_mark_video vm ON vm.vodinfo_id = v.id WHERE v.marktype = 1 AND v.original_id = '" . $this->input['live_id'] . "' ORDER BY v.video_order_id DESC, v.id DESC ";
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $r['column_id'] = $r['column_id'] ? unserialize($r['column_id']) : '';
         $r['split_end'] = intval($r['split_start']) + intval($r['split_duration']);
         $r['duration_format'] = time_format($r['duration']);
         $r['transcode_server'] = unserialize($r['transcode_server']);
         $r['img_info'] = hg_fetchimgurl(unserialize($r['img_info']), 80, 60);
         $video[] = $r;
     }
     $this->addItem($video);
     $this->output();
 }