• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xml2Array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xml2Array函数的典型用法代码示例。如果您正苦于以下问题:PHP xml2Array函数的具体用法?PHP xml2Array怎么用?PHP xml2Array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xml2Array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: sendSms

 public function sendSms($telephone = '', $content = '', $is_meeting = 0)
 {
     if (!$telephone || !$content) {
         return false;
     }
     $config = $this->settings['sms_code'];
     if ($is_meeting) {
         $config['sign'] = '【厚建软件】';
         $config['subcode'] = '';
     }
     $message = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "<message>" . "<account>" . $config['account'] . "</account>" . "<password>" . md5($config['password']) . "</password>" . "<msgid></msgid>" . "<phones>" . $telephone . "</phones>" . "<content>" . $content . "</content>" . "<sign>" . $config['sign'] . "</sign>" . "<subcode>" . $config['subcode'] . "</subcode>" . "<sendtime></sendtime>" . "</message>";
     $params = array('message' => $message);
     $data = http_build_query($params);
     $context = array('http' => array('method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => $data));
     $reponse = file_get_contents($config['request_send_url'], false, stream_context_create($context));
     if ($reponse) {
         $ret = xml2Array($reponse);
         if ($ret && is_array($ret) && !$ret['result']) {
             return true;
         }
         return false;
     } else {
         return false;
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:25,代码来源:authcode.php


示例2: detail

 public function detail($id)
 {
     $arr = array();
     $xml = '<?xml version="1.0" encoding="utf-8"?>';
     $xml .= '<paras>';
     $xml .= '<IdentityGuid>Epoint_WebSerivce_**##0601</IdentityGuid>';
     $xml .= '<infoid>' . $id . '</infoid>';
     $xml .= '</paras>';
     $cilentOptions = array('trace' => true, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE);
     $client = new SoapClient(WEB_URL, $cilentOptions);
     $ret_str = $client->SelectBMZX(array('xmlWebInfo' => $xml));
     //var_dump($ret_str);exit();
     $ret_str = $ret_str->SelectBMZXResult;
     $ret_str = xml2Array($ret_str);
     //hg_pre($ret_str);exit();
     if (!$ret_str['DATA']['ReturnInfo']['Status']) {
         return $arr;
     }
     $data = $ret_str['DATA']['UserArea'];
     //hg_pre($data);exit();
     $arr['id'] = $data['infoid'];
     $arr['create_time'] = strtotime($data['infodate']);
     $arr['title'] = $data['title'];
     $arr['content'] = str_replace("&nbsp;", "", strip_tags($data['InfoContent']));
     $arr['click_times'] = $data['ClickTimes'];
     //点击次数
     //hg_pre($arr);exit();
     return $arr;
 }
开发者ID:h3len,项目名称:Project,代码行数:29,代码来源:service_rdwd.class.php


示例3: show

 public function show()
 {
     if (!$this->input['user_number']) {
         $this->errorOutput(NO_USER_NUMBER);
         //没有户号
     }
     if (!$this->input['month']) {
         $this->errorOutput(NO_QUERY_MONTH);
         //没有查询最近几个月
     } else {
         if (intval($this->input['month']) > 12 || intval($this->input['month']) < 0) {
             $this->errorOutput(MONTH_ERROR);
         }
     }
     $data = $this->water->query($this->input['user_number'], $this->input['month']);
     if (!$data) {
         $this->errorOutput(NO_DATA);
     }
     $data_arr = xml2Array($data);
     if (!$data_arr) {
         $this->errorOutput(DATA_ERROR);
     }
     foreach ($data_arr['record'] as $k => $v) {
         if ($v['status'] == '已销') {
             $data_arr['record'][$k]['state'] = 1;
         } else {
             $data_arr['record'][$k]['state'] = 0;
         }
     }
     $this->addItem($data_arr);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:32,代码来源:water_query.php


示例4: proccessSiteMapUrl

function proccessSiteMapUrl($url)
{
    $siteMapXml = file_get_contents($url);
    $siteMapXmlArray = xml2Array($siteMapXml);
    if (isset($siteMapXmlArray['sitemapindex'])) {
        proccessSiteMapIndex($siteMapXmlArray);
    } elseif (isset($siteMapXmlArray['urlset'])) {
        proccessSiteMap($siteMapXmlArray);
    }
}
开发者ID:NeoCortexBg,项目名称:sitemap_checker,代码行数:10,代码来源:check_sitemap.php


示例5: get_version

 public function get_version($url)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 2);
     $ret = curl_exec($ch);
     curl_close($ch);
     $ret = xml2Array($ret);
     return $ret;
 }
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:server.class.php


示例6: cn_com_weather_update

 function cn_com_weather_update($city = array(), $weather_source_id = 0, $userinfo = array(), $cityEngName = array(), $cityCode = array(), $update = true)
 {
     $weather_info = array();
     if (!$weather_source_id || empty($city) || empty($cityEngName)) {
         return $weather_info;
     }
     //hg_pre($cityCode);exit();
     foreach ($city as $key => $val) {
         $url = 'http://flash.weather.com.cn/wmaps/xml/' . $cityEngName[$val] . '.xml';
         $rss = @simplexml_load_file($url);
         if (!$rss) {
             continue;
         }
         $temp[$val] = xml2Array($url);
     }
     //hg_pre($temp);exit();
     $return = array();
     if (!empty($temp) && $temp && is_array($temp)) {
         foreach ($temp as $city_id => $val) {
             //hg_pre($val['city']);exit();
             $data = array();
             $forcast = array();
             foreach ($val['city'] as $kk => $vv) {
                 if ($vv['url'] == $cityCode[$city_id]) {
                     $extra = array('humidity' => $vv['humidity']);
                     $data = array('id' => $city_id, 'source_id' => intval($weather_source_id), 'w_date' => date('Y-m-d', TIMENOW), 'w_time' => $vv['time'], 'temperature' => $vv['temNow'], 'wind_direction' => $vv['windDir'], 'wind_level' => $vv['windPower'], 'extra' => addslashes(serialize($extra)), 'user_id' => $userinfo['user_id'], 'user_name' => $userinfo['user_name'], 'ip' => hg_getip());
                     $forcast = array('report' => $vv['stateDetailed'], 'fx' => $vv['windDir'], 'fl' => $vv['windState'], 'temp' => $vv['tem1'] . '℃~' . $vv['tem2'] . '℃', 'sd' => $vv['humidity'], 'time' => $vv['time']);
                 }
             }
             if (empty($data)) {
                 //hg_pre($val['city'][0]);exit();
             }
             if (empty($data)) {
                 $extra = array('humidity' => $val['city'][0]['humidity']);
                 $data = array('id' => $city_id, 'source_id' => intval($weather_source_id), 'w_date' => date('Y-m-d', TIMENOW), 'w_time' => $val['city'][0]['time'], 'temperature' => $val['city'][0]['temNow'], 'wind_direction' => $val['city'][0]['windDir'], 'wind_level' => $val['city'][0]['windPower'], 'extra' => addslashes(serialize($extra)), 'user_id' => $userinfo['user_id'], 'user_name' => $userinfo['user_name'], 'ip' => hg_getip());
                 $forcast = array('report' => $val['city'][0]['stateDetailed'], 'fx' => $val['city'][0]['windDir'], 'fl' => $val['city'][0]['windState'], 'temp' => $val['city'][0]['tem1'] . '℃~' . $val['city'][0]['tem2'] . '℃', 'sd' => $val['city'][0]['humidity'], 'time' => $val['city'][0]['time']);
             }
             $return[$city_id] = $data;
             $ret = $this->pubWeather->storedIntoDB($data, 'weather_information');
             $this->update_day_weather($city_id, $data);
             $this->update_forcast_weather($city_id, $forcast);
         }
     }
     return $return;
 }
开发者ID:h3len,项目名称:Project,代码行数:45,代码来源:newRealtime.class.php


示例7: detail

 public function detail($id)
 {
     $arr = array();
     $xml = '<?xml version="1.0" encoding="utf-8"?>';
     $xml .= '<paras>';
     $xml .= '<IdentityGuid>Epoint_WebSerivce_**##0601</IdentityGuid>';
     $xml .= '<CaseGuid>' . $id . '</CaseGuid>';
     $xml .= '</paras>';
     $cilentOptions = array('trace' => true, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE);
     $client = new SoapClient(WEB_URL, $cilentOptions);
     $ret_str = $client->SelectCaseInfoDetail_GGFW(array('xmlCaseInfo' => $xml));
     //var_dump($ret_str);exit();
     $ret_str = $ret_str->SelectCaseInfoDetail_GGFWResult;
     $ret_str = xml2Array($ret_str);
     //hg_pre($ret_str);exit();
     if (!$ret_str['DATA']['ReturnInfo']['Status']) {
         return $arr;
     }
     $data = $ret_str['DATA']['UserArea'];
     //hg_pre($data);exit();
     $arr['id'] = $data['CaseGuid'];
     $arr['case_serial'] = $data['CaseSerial'];
     //编号
     $arr['create_time'] = $data['RequestDate'] ? strtotime($data['RequestDate']) : $data['RequestDate'];
     $arr['tel'] = $data['RequestNumber'];
     $arr['user_name'] = $data['RequestPerson'];
     $arr['email'] = $data['Email'];
     $arr['address'] = $data['Address'];
     $arr['area'] = $this->settings['service_area'][$data['RequestAddress']];
     $arr['title'] = $data['RequestTitle'];
     $arr['content'] = cdata($data['Description']);
     $arr['note'] = $data['RequestNote'];
     //备注;
     $arr['case_status'] = $this->settings['service_case_status'][$data['CaseStatus']];
     //工单状态
     $arr['case_type'] = $this->settings['service_case_type'][$data['CaseType']];
     //工单类型
     $arr['answer_date'] = $data['AnswerDate'] ? strtotime($data['AnswerDate']) : $data['AnswerDate'];
     $arr['answer_content'] = cdata($data['AnswerContent']);
     $arr['manyidu'] = $data['ManYiDu'];
     return $arr;
 }
开发者ID:h3len,项目名称:Project,代码行数:42,代码来源:service_ggfw.class.php


示例8: xml2Array

function xml2Array($xml, $root = true)
{
    if (is_string($xml)) {
        $xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
    }
    if (!$xml->children()) {
        return (string) $xml;
    }
    $array = array();
    foreach ($xml->children() as $element => $node) {
        $totalElement = count($xml->{$element});
        if (!isset($array[$element])) {
            $array[$element] = "";
        }
        // Has attributes
        if ($attributes = $node->attributes()) {
            $data = array('value' => count($node) > 0 ? xml2Array($node, false) : (string) $node);
            foreach ($attributes as $attr => $value) {
                $data['@' . $attr] = (string) $value;
            }
            if ($totalElement > 1) {
                $array[$element][] = $data;
            } else {
                $array[$element] = $data;
            }
            // Just a value
        } else {
            if ($totalElement > 1) {
                $array[$element][] = xml2Array($node, false);
            } else {
                $array[$element] = xml2Array($node, false);
            }
        }
    }
    if ($root) {
        return array($xml->getName() => $array);
    } else {
        return $array;
    }
}
开发者ID:vsa-partners,项目名称:typologycms,代码行数:40,代码来源:misc_helper.php


示例9: update_day


//.........这里部分代码省略.........
                 $this->db->query($sql);
                 if ($info['item'] > 0) {
                     $record_create = array('title' => $info['theme'], 'channel_id' => $this->input['channel_id'], 'program_id' => $info['id'], 'start_time' => $info['start_time'], 'toff' => $info['toff'], 'item' => $info['item'], 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'ip' => hg_getip());
                     $sql = "SELECT * FROM " . DB_PREFIX . "program_record WHERE program_id=" . $info['id'];
                     $tmp_senc = $this->db->query_first($sql);
                     if (empty($tmp_senc)) {
                         $createsql = "INSERT INTO " . DB_PREFIX . "program_record SET ";
                         $space = "";
                         foreach ($record_create as $k => $v) {
                             $createsql .= $space . $k . "=" . "'" . $v . "'";
                             $space = ",";
                         }
                         $this->db->query($createsql);
                         $record_id = $this->db->insert_id();
                         $this->insert_relation($record_create['channel_id'], $record_id, $record_create['start_time'], $record_create['toff'], 0);
                         $sql = "UPDATE " . DB_PREFIX . "program SET record_id='" . $record_id . "' WHERE id=" . $info['id'];
                         $this->db->query($sql);
                     } else {
                         $record_update = array('title' => $info['theme'], 'start_time' => $info['start_time'], 'toff' => $info['toff'], 'item' => $info['item'], 'update_time' => TIMENOW);
                         $sql = "SELECT id,log_id,conid FROM " . DB_PREFIX . "program_queue WHERE id=" . $tmp_senc['conid'];
                         $sen = $this->db->query_first($sql);
                         if ($sen) {
                             $this->curl->mPostContentType('string');
                             $this->curl->setSubmitType('get');
                             $this->curl->setReturnFormat('json');
                             $this->curl->initPostData();
                             if (!defined('IS_WOZA') || !IS_WOZA) {
                                 $this->curl->addRequestData('action', 'DELETE');
                             } else {
                                 $this->curl->addRequestData('action', 'delete');
                             }
                             $this->curl->addRequestData('id', $sen['conid']);
                             $record_xml = $this->curl->request('');
                             $record_array = xml2Array($record_xml);
                             if ($record_array['result']) {
                                 $sql = "DELETE FROM " . DB_PREFIX . "program_record_log WHERE id IN (" . $sen['log_id'] . ")";
                                 $this->db->query($sql);
                                 $sql = "DELETE FROM " . DB_PREFIX . "program_queue WHERE id=" . $sen['id'];
                                 $this->db->query($sql);
                             }
                         }
                         if (empty($tmp_senc['week_day'])) {
                             if ($record_update['start_time'] <= TIMENOW) {
                                 //相当于重置录制
                                 $record_update['is_out'] = 1;
                             }
                             $updatesql = "UPDATE " . DB_PREFIX . "program_record SET ";
                             $space = "";
                             foreach ($record_update as $k => $v) {
                                 $updatesql .= $space . $k . "=" . "'" . $v . "'";
                                 $space = ",";
                             }
                             $updatesql .= " WHERE program_id=" . $info['id'];
                             $this->db->query($updatesql);
                         } else {
                             if ($record_update['start_time'] <= TIMENOW) {
                                 $week_now = date('N', TIMENOW);
                                 $week_num = unserialize($tmp_senc['week_day']);
                                 if (in_array($week_now, $week_num)) {
                                     $dates = date('Y-m-d', TIMENOW);
                                 }
                                 $i = 0;
                                 $next_day = $next_week_day = 0;
                                 foreach ($week_num as $k => $v) {
                                     if (!$i && $v > $week_now) {
                                         $next_day = $v;
开发者ID:h3len,项目名称:Project,代码行数:67,代码来源:program_update.php


示例10: show


//.........这里部分代码省略.........
         $dates = date('Y-m-d', $v['start_time']);
         $channel_id = $v['channel_id'];
         $start_time = $v['start_time'];
         $week_day = unserialize($v['week_day']);
         $v['start_time'] = date('H:i:s', $start_time);
         $v['end_time'] = date('H:i:s', $v['toff'] + $start_time);
         $mins = floor($v['toff'] / 60);
         $sen = $v['toff'] - $mins * 60;
         $v['toff_decode'] = ($mins ? $mins . "'" : '') . ($sen ? $sen . "''" : '');
         $v['dates'] = $dates;
         //$v['w'] = date('w',strtotime($start_time));
         $v['sort_name'] = $sort_name[$v['item']];
         $tmp = $log[$v['id']];
         if (!empty($week_day)) {
             if (count($week_day) == 7) {
                 $v['cycle'] = '每天';
             } else {
                 $spac = '';
                 foreach ($week_day as $kk => $vv) {
                     $v['cycle'] .= $spac . $week_day_arr[$vv];
                     $spac = '&nbsp;|&nbsp;';
                 }
             }
         } else {
             $v['cycle'] = date('Y-m-d', $start_time);
         }
         if ($server_config && $server_config[$v['server_id']]) {
             if ($tmp) {
                 $obj_curl = new curl($server_config[$v['server_id']]['host'] . ':' . $server_config[$v['server_id']]['port'], $server_config[$v['server_id']]['dir']);
                 switch (intval($tmp['state'])) {
                     case 0:
                         //录制等待录制
                         $obj_curl->setSubmitType('get');
                         $obj_curl->initPostData();
                         $obj_curl->addRequestData('action', 'SELECT');
                         $obj_curl->addRequestData('id', $tmp['conid']);
                         $record_xml = $obj_curl->request('');
                         $record_array = xml2Array($record_xml);
                         if (!empty($record_array) && $record_array['result']) {
                             if ($record_array['record']['status'] == 'running') {
                                 $v['action'] = '录制中';
                             }
                             if ($record_array['record']['status'] == 'waiting') {
                                 if ($start_time + $v['toff'] <= ($record_array['record']['serverTime'] ? $record_array['record']['serverTime'] : TIMENOW)) {
                                     $v['action'] = '录制超时';
                                 } else {
                                     $v['action'] = '等待录制';
                                 }
                             }
                         } else {
                             $v['action'] = '录制超时';
                         }
                         break;
                     case 1:
                         //录制成功
                         if ($tmp['week_day']) {
                             $v['action'] = '等待录制';
                         } else {
                             $v['action'] = $tmp['text'] ? $tmp['text'] : '录制超时';
                         }
                         break;
                     case 2:
                         //录制失败
                         if ($tmp['week_day']) {
                             $v['action'] = '等待录制';
                         } else {
                             $v['action'] = $tmp['text'] ? $tmp['text'] : '录制超时';
                         }
                         break;
                 }
             } else {
                 if ($start_time >= TIMENOW) {
                     $v['action'] = '等待录制';
                 } else {
                     if (TIMENOW > $start_time && TIMENOW < $v['toff'] + $start_time) {
                         $v['action'] = empty($week_day) ? '录制超时' : '等待录制';
                     } else {
                         if ($v['toff'] + $start_time <= TIMENOW) {
                             $v['action'] = empty($week_day) ? '录制超时' : '等待录制';
                             //假如is_record 存在video 在上传,否则就是录制成功
                         }
                     }
                 }
             }
         } else {
             $v['action'] = '服务停止';
         }
         if ($v['is_out']) {
             //$row['action'] = '录制超时';
         }
         if (!$v['status']) {
             $v['action'] = '频道关闭';
         }
         if (!$v['server_id']) {
             $v['action'] = '服务停止';
         }
         $info[] = $v;
     }
     return $info;
 }
开发者ID:h3len,项目名称:Project,代码行数:101,代码来源:program_record.class.php


示例11: recordOperate

 /**
  * 时移抓取
  * Enter description here ...
  * @param unknown_type $host
  * @param unknown_type $apidir
  * @param unknown_type $action TIMESHIFT
  * @param unknown_type $id
  * @param unknown_type $uploadFile 0
  * @param unknown_type $access_token
  * @param unknown_type $channel_id
  * @param unknown_type $url
  * @param unknown_type $callback
  */
 function recordOperate($host, $apidir, $data = array())
 {
     if (!$this->mRecordServer) {
         return array();
     }
     $this->mRecordServer->setUrlHost($host, $apidir);
     $this->mRecordServer->setSubmitType('get');
     $this->mRecordServer->initPostData();
     $this->mRecordServer->setReturnFormat('json');
     $action = array('TIMESHIFT');
     if (!in_array($data['action'], $action)) {
         return false;
     }
     foreach ($data as $k => $v) {
         $this->mRecordServer->addRequestData($k, $v);
     }
     $ret = $this->mRecordServer->request('');
     return xml2Array($ret);
 }
开发者ID:h3len,项目名称:Project,代码行数:32,代码来源:livemms.class.php


示例12: delete_all

 public function delete_all()
 {
     if ($this->mNeedCheckIn && !$this->prms['manage']) {
         $this->errorOutput(NO_OPRATION_PRIVILEGE);
     }
     $id = urldecode($this->input['id']);
     if (!$id) {
         $this->errorOutput(OBJECT_NULL);
     } else {
         $sql = "SELECT * FROM " . DB_PREFIX . "program_record WHERE id IN (" . $id . ")";
         $q = $this->db->query($sql);
         include_once ROOT_PATH . 'lib/class/curl.class.php';
         $this->curl = new curl($this->settings['mms']['record_server']['host'], $this->settings['mms']['record_server']['dir']);
         $id_success = array();
         $ret = array();
         while ($row = $this->db->fetch_array($q)) {
             if ($row['conid'] && $row['start_time'] > TIMENOW + 5) {
                 $sql = "SELECT * FROM " . DB_PREFIX . "program_queue WHERE id=" . $row['conid'];
                 $tmp_first = $this->db->query_first($sql);
                 if (!empty($tmp_first)) {
                     $this->curl->mPostContentType('string');
                     $this->curl->setSubmitType('get');
                     $this->curl->setReturnFormat('json');
                     $this->curl->initPostData();
                     if (!defined('IS_WOZA') || !IS_WOZA) {
                         $this->curl->addRequestData('action', 'DELETE');
                     } else {
                         $this->curl->addRequestData('action', 'delete');
                     }
                     $this->curl->addRequestData('id', $tmp_first['conid']);
                     $record_xml = $this->curl->request('');
                     $record_array = xml2Array($record_xml);
                     if ($record_array['result']) {
                         $id_success[] = $row['id'];
                     }
                 }
             }
             $ret[] = $row;
         }
         $sql = "DELETE FROM " . DB_PREFIX . "program_record WHERE id IN (" . $id . ")";
         $this->db->query($sql);
         $sql = "DELETE FROM " . DB_PREFIX . "program_record_relation WHERE record_id IN (" . $id . ")";
         $this->db->query($sql);
         $sql = "DELETE FROM " . DB_PREFIX . "program_record_log WHERE record_id IN (" . $id . ")";
         $this->db->query($sql);
         $sql = "DELETE FROM " . DB_PREFIX . "program_queue WHERE record_id IN (" . $id . ")";
         $this->db->query($sql);
         $this->addLogs('delete', $ret, '');
     }
     $re = array();
     $re['id'] = $id;
     $this->setXmlNode('program_record', 'info');
     $this->addItem($re);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:55,代码来源:program_record_update.php


示例13: show

 /**
  * 显示录播节目单
  */
 function show()
 {
     if ($this->mNeedCheckIn && !$this->prms['show']) {
         $this->errorOutput(NO_OPRATION_PRIVILEGE);
     }
     $condition = $this->get_condition();
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $data_limit = " LIMIT " . $offset . " , " . $count;
     $sql = "select p.*,c.name as channel,c.stream_state from " . DB_PREFIX . "program_record p left join " . DB_PREFIX . "channel c on c.id=p.channel_id ";
     $sql .= " where 1 " . $condition . " ORDER BY p.is_record ASC,p.start_time ASC " . $data_limit;
     $q = $this->db->query($sql);
     $week_day_arr = array('1' => '一', '2' => '二', '3' => '三', '4' => '四', '5' => '五', '6' => '六', '7' => '日');
     include_once ROOT_PATH . 'lib/class/livmedia.class.php';
     $livmedia = new livmedia();
     $sort_name = $livmedia->getAutoItem();
     $conid = $space = "";
     $data = array();
     while ($row = $this->db->fetch_array($q)) {
         $conid .= $space . $row['conid'];
         $space = ',';
         $data[] = $row;
     }
     $log = array();
     if ($conid) {
         $sql = "SELECT log_id FROM " . DB_PREFIX . "program_queue WHERE id IN(" . $conid . ")";
         $log_id = $space = '';
         $q = $this->db->query($sql);
         while ($row = $this->db->fetch_array($q)) {
             $log_id .= $space . $row['log_id'];
             $space = ',';
         }
         if ($log_id) {
             $sql = "SELECT a.*,q.conid FROM " . DB_PREFIX . "program_record_log a LEFT JOIN " . DB_PREFIX . "program_queue q ON a.id=q.log_id WHERE a.id IN (" . $log_id . ")";
             $q = $this->db->query($sql);
             $log = array();
             while ($row = $this->db->fetch_array($q)) {
                 $log[$row['record_id']] = $row;
             }
         }
     }
     include_once ROOT_PATH . 'lib/class/curl.class.php';
     $obj_curl = new curl($this->settings['mms']['record_server']['host'], $this->settings['mms']['record_server']['dir']);
     foreach ($data as $k => $v) {
         $dates = date('Y-m-d', $v['start_time']);
         $channel_id = $v['channel_id'];
         $start_time = $v['start_time'];
         $week_day = unserialize($v['week_day']);
         $v['start_time'] = date('H:i:s', $start_time);
         $v['end_time'] = date('H:i:s', $v['toff'] + $start_time);
         $mins = floor($v['toff'] / 60);
         $sen = $v['toff'] - $mins * 60;
         $v['toff_decode'] = ($mins ? $mins . "'" : '') . ($sen ? $sen . "''" : '');
         $v['dates'] = $dates;
         //$v['w'] = date('w',strtotime($start_time));
         $v['sort_name'] = $sort_name[$v['item']];
         $tmp = $log[$v['id']];
         if (!empty($week_day)) {
             if (count($week_day) == 7) {
                 $v['cycle'] = '每天';
             } else {
                 $spac = '';
                 foreach ($week_day as $kk => $vv) {
                     $v['cycle'] .= $spac . $week_day_arr[$vv];
                     $spac = '&nbsp;|&nbsp;';
                 }
             }
         } else {
             $v['cycle'] = date('Y-m-d', $start_time);
         }
         if ($tmp) {
             switch (intval($tmp['state'])) {
                 case 0:
                     //录制等待录制
                     $obj_curl->setSubmitType('get');
                     $obj_curl->initPostData();
                     $obj_curl->addRequestData('action', 'SELECT');
                     $obj_curl->addRequestData('id', $tmp['conid']);
                     $record_xml = $obj_curl->request('');
                     $record_array = xml2Array($record_xml);
                     if (!empty($record_array) && $record_array['result']) {
                         if ($record_array['record']['status'] == 'running') {
                             $v['action'] = '录制中';
                         }
                         if ($record_array['record']['status'] == 'waiting') {
                             if ($start_time + $v['toff'] <= ($record_array['record']['serverTime'] ? $record_array['record']['serverTime'] : TIMENOW)) {
                                 $v['action'] = '录制超时';
                             } else {
                                 $v['action'] = '等待录制';
                             }
                         }
                     } else {
                         $v['action'] = '录制超时';
                     }
                     break;
                 case 1:
                     //录制成功
//.........这里部分代码省略.........
开发者ID:h3len,项目名称:Project,代码行数:101,代码来源:program_record.php


示例14: dvrOperate

 /**
  * 删除时移
  * $action	delete
  * 
  * Enter description here ...
  * @param unknown_type $id
  * @param unknown_type $time
  * @param unknown_type $callback
  * @param unknown_type $action
  */
 function dvrOperate($id, $time, $duration, $callback, $action = 'delete')
 {
     if (!$this->output) {
         return array();
     }
     $this->output->setSubmitType('post');
     $this->output->initPostData();
     $this->output->setReturnFormat('xml');
     $this->output->addRequestData('action', $action);
     $this->output->addRequestData('id', $id);
     $this->output->addRequestData('time', $time);
     $this->output->addRequestData('duration', $duration);
     $this->output->addRequestData('callback', $callback);
     $ret = $this->output->request('dvr');
     return xml2Array($ret);
 }
开发者ID:h3len,项目名称:Project,代码行数:26,代码来源:livmms.class.php


示例15: recordDelete

 /**
  * 删除录制后的时移
  * Enter description here ...
  * @param unknown_type $id
  */
 function recordDelete($host, $apidir, $id)
 {
     if (!$this->mRecordServer) {
         return array();
     }
     $this->mRecordServer->setUrlHost($host, $apidir);
     $this->mRecordServer->setSubmitType('get');
     $this->mRecordServer->initPostData();
     $this->mRecordServer->setReturnFormat('json');
     $this->mRecordServer->addRequestData('action', 'DELETE');
     $this->mRecordServer->addRequestData('id', $id);
     $ret = $this->mRecordServer->request('');
     return xml2Array($ret);
 }
开发者ID:h3len,项目名称:Project,代码行数:19,代码来源:livemms.class.php


示例16: mediaServerOperate

 private function mediaServerOperate($host, $dir, $data = array())
 {
     $this->curl = new curl();
     if (!$this->curl) {
         return array();
     }
     $this->curl->setUrlHost($host, $dir);
     $this->curl->setSubmitType('get');
     $this->curl->initPostData();
     $this->curl->setReturnFormat('json');
     $action = array('MODIFY_CONFIG', 'GET_CONFIG');
     if (!in_array($data['action'], $action)) {
         return array();
     }
     foreach ($data as $k => $v) {
         $this->curl->addRequestData($k, $v);
     }
     $ret = $this->curl->request('');
     return xml2Array($ret);
 }
开发者ID:h3len,项目名称:Project,代码行数:20,代码来源:server.php


示例17: delete

 public function delete()
 {
     $id = urldecode($this->input['id']);
     if (!$id) {
         $this->errorOutput(OBJECT_NULL);
     } else {
         $sql = "SELECT * FROM " . DB_PREFIX . "server_config WHERE 1 AND state=1";
         $q = $this->db->query($sql);
         $server_config = array();
         while ($row = $this->db->fetch_array($q)) {
             $server_config[$row['id']] = $row;
         }
         $sql = "SELECT * FROM " . DB_PREFIX . "program_record WHERE id IN (" . $id . ")";
         $q = $this->db->query($sql);
         include_once ROOT_PATH . 'lib/class/live.class.php';
         $newLive = new live();
         $info = array();
         $channel_id = array();
         while ($row = $this->db->fetch_array($q)) {
             $info[] = $row;
             $channel_id[$row['channel_id']] = $row['channel_id'];
         }
         $channel_node = $channel_parent_node = array();
         if ($channel_id) {
             $channel = $newLive->getChannelById(implode(',', $channel_id), -1);
             if (!empty($channel)) {
                 foreach ($channel as $k => $v) {
                     $tmp_data = $newLive->getFatherNodeByid($v['node_id']);
                     $channel_node[$v['id']] = $tmp_data[0];
                     $channel_parent_node[$v['id']] = $v['node_id'];
                 }
             }
         }
         include_once ROOT_PATH . 'lib/class/curl.class.php';
         $id_success = array();
         $delete_id = $space = "";
         $ret = array();
         foreach ($info as $k => $row) {
             $this->curl = new curl($server_config[$row['server_id']]['host'] . ':' . $server_config[$row['server_id']]['port'], $server_config[$row['server_id']]['dir']);
             #####整合数据进行权限
             $nodes = array();
             $nodes['nodes'][$row['channel_id']] = $row['channel_id'];
             //hg_pre($nodes);exit;
             $this->verify_content_prms($nodes);
             if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
                 switch ($this->user['prms']['default_setting']['manage_other_data']) {
                     case 1:
                         //组织内,修改者和作者是否在同一组织
                         if ($this->user['org_id'] != $row['org_id']) {
                             $this->errorOutput(NO_PRIVILEGE);
                         }
                         break;
                     case 5:
                         //全部
                         break;
                     case 0:
                         //只能自己修改
                         if ($this->user['user_id'] != $row['user_id']) {
                             $this->errorOutput(NO_PRIVILEGE);
                         }
                         break;
                     default:
                         break;
                 }
             }
             #####整合数据进行权限结束
             if ($row['conid'] && $row['start_time'] > TIMENOW + 5) {
                 $sql = "SELECT * FROM " . DB_PREFIX . "program_queue WHERE id=" . $row['conid'];
                 $tmp_first = $this->db->query_first($sql);
                 if (!empty($tmp_first)) {
                     $this->curl->mPostContentType('string');
                     $this->curl->setSubmitType('get');
                     $this->curl->setReturnFormat('json');
                     $this->curl->initPostData();
                     if (!defined('IS_WOZA') || !IS_WOZA) {
                         $this->curl->addRequestData('action', 'DELETE');
                     } else {
                         $this->curl->addRequestData('action', 'delete');
                     }
                     $this->curl->addRequestData('id', $tmp_first['conid']);
                     $record_xml = $this->curl->request('');
                     $record_array = xml2Array($record_xml);
                     if ($record_array['result']) {
                         $id_success[] = $row['id'];
                     }
                 }
             }
             $delete_id .= $space . $row['id'];
             $space = ',';
             $ret[] = $row;
         }
         if ($delete_id) {
             $sql = "DELETE FROM " . DB_PREFIX . "program_record WHERE id IN (" . $delete_id . ")";
             $this->db->query($sql);
             $sql = "DELETE FROM " . DB_PREFIX . "program_record_relation WHERE record_id IN (" . $delete_id . ")";
             $this->db->query($sql);
             $sql = "DELETE FROM " . DB_PREFIX . "program_record_log WHERE record_id IN (" . $delete_id . ")";
             $this->db->query($sql);
             $sql = "DELETE FROM " . DB_PREFIX . "program_queue WHERE record_id IN (" . $delete_id . ")";
             $this->db->query($sql);
//.........这里部分代码省略.........
开发者ID:h3len,项目名称:Project,代码行数:101,代码来源:program_record_update.php


示例18: restart

 function restart()
 {
     switch (intval($this->input['sort'])) {
         case 0:
             //重建当前时间之后所有的
             $sql = "SELECT * FROM " . DB_PREFIX . "program_record WHERE start_time > " . TIMENOW . " AND conid <> 0";
             //. " AND (start_time+toff)<" . strtotime(date('Y-m-d',TIMENOW) . ' 23:59:59')
             //录制等待中的,并未开始录制,并且是当天,删除录制,重新提交
             $q = $this->db->query($sql);
             $queue_id = $record_id = $space = "";
             while ($row = $this->db->fetch_array($q)) {
                 $queue_id .= $space . $row['conid'];
                 //$record_id .= $space . $row['id'];
                 $space = ',';
             }
             if ($queue_id) {
                 $sql = "SELECT * FROM " . DB_PREFIX . "program_queue WHERE id IN(" . $queue_id . ")";
                 $q = $this->db->query($sql);
                 include_once ROOT_PATH . 'lib/class/curl.class.php';
                 $obj_curl = new curl($this->settings['mms']['record_server']['host'], $this->settings['mms']['record_server']['dir']);
                 while ($row = $this->db->fetch_array($q)) {
                     $obj_curl->setSubmitType('get');
                     $obj_curl->initPostData();
                     $obj_curl->addRequestData('action', 'SELECT');
                     $obj_curl->addRequestData('id', $row['conid']);
                     $record_xml = $obj_curl->request('');
                     $record_array = xml2Array($record_xml);
                     if ($record_array) {
                         if ($record_array['result']) {
                             if ($record_array['record']['status'] == 'waiting') {
                                 $obj_curl->mPostContentType('string');
                                 $obj_curl->setSubmitType('get');
                                 $obj_curl->setReturnFormat('json');
                                 $obj_curl->initPostData();
                                 $obj_curl->addRequestData('action', 'DELETE');
                                 $obj_curl->addRequestData('id', $row['conid']);
                                 $record_xml = $obj_curl->request('');
                                 $record_array_delete = xml2Array($record_xml);
                                 /*
                                 if($record_array_delete['result'])
                                 {
                                 
                                 }
                                 */
                             }
       

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xml2array函数代码示例发布时间:2022-05-23
下一篇:
PHP xml函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap