/**
 *     功能:
      *       by:
      *     参数:
      * $data=array(
           'condition'=>array(
             '列名'=>array('值','条件','列类型'),   
             '列名'=>array('值','条件','列类型'),
             ...
            ),
           'pg'=>'当前页',
           'order'=>'排序处理',
           'cols'=>'列1,列2,列3...',
           'pageSize'=>'查询限制:15', 
           'pageStrategy'=>'分页策略,默认为getNormalPage',
           'trueTableName'=>'表全名',
           'extWhere'=>'拓展条件查询'
         );
      *     返回:
      *     日期:
      *   修改人:
      * 修改时间:
      *     备注:
      *  1.支持的列类型有 int,smallint,tinyint,mediumint,float,double,BOOL
      *  2.条件包括:= != LIKE IN BETWEEN % %%
 */
 public function getPager(&$data)
 {
     //基本数据处理
     $this->pageSize = isset($data['pageSize']) ? (int) $data['pageSize'] : $this->pageSize;
     $this->PG = getPage();
     $where = $this->getWhere($data['condition']);
     if (isset($data['extWhere']) && $data['extWhere']) {
         $this->extWhere = ' ' . $data['extWhere'];
     }
     $this->trueTableName = $data['trueTableName'];
     $this->handle = M($this->trueTableName);
     $cols = isset($data['cols']) ? $data['cols'] : '*';
     $total = $this->getTotal($where);
     $this->pageCount = ceil($total / $this->pageSize);
     $s = ($this->PG - 1) * $this->pageSize;
     $order = isset($data['order']) ? $this->getOrder($data['order']) : '';
     $limit = $this->getLimit($s);
     $rs = $this->getData($cols, $where, $order, $limit);
     $pageHTML = $this->getNormalPage($this->PG, $this->pageCount);
     //策略处理
     if (isset($data['pageStrategy']) && !empty($data['pageStrategy'])) {
         if (is_array($data['pageStrategy'])) {
             $pageHTML = call_user_func($data['pageStrategy'], $this->PG, $this->pageCount, $total);
         } else {
             $pageHTML = call_user_func(array($this, $data['pageStrategy'] . 'Strategy'), $this->PG, $this->pageCount, $total);
         }
     } else {
         $pageHTML = $this->getNormalPage($this->PG, $this->pageCount);
     }
     return array('data' => $rs, 'paging' => $pageHTML);
 }
 static function parseMovie($id, $p_code)
 {
     $url = replaceStr(SinaTeachParse::BASE_SHOW_EPISODE, '{COURSE_ID}', $id);
     $content = getPage($url, $p_code);
     $content = json_decode($content);
     if (is_object($content) && property_exists($content, 'result') && property_exists($content->result, 'data') && property_exists($content->result->data, 'lessoninfo')) {
         $contents = $content->result->data->lessoninfo;
         if (is_array($contents) && count($contents) > 0) {
             $sites = array();
             $site = array();
             $site['site_url'] = "sina";
             $site['site_name'] = "sinahd";
             $site['max_episode'] = 'true';
             $episodes = array();
             foreach ($contents as $content) {
                 $episodes[] = array('name' => property_exists($content, 'name') ? $content->name : "1", 'guest' => property_exists($content, 'short_name') ? $content->short_name : "1", 'episode' => property_exists($content, 'jieci') ? $content->jieci : "1", 'url' => property_exists($content, 'burl') ? $content->burl : "", 'img_url' => property_exists($content, 'thumb') ? $content->thumb : "", 'time' => property_exists($content, 'length') ? $content->length : "", 'stream_url' => property_exists($content, 'stream_url') && !isN($content->stream_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->stream_url : "", 'androidUrl' => property_exists($content, 'android_url') && !isN($content->android_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->android_url : "", 'videoAddressUrl' => property_exists($content, 'ipad_url') && !isN($content->ipad_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->ipad_url : "");
             }
             $site['episodes'] = $episodes;
             $sites[] = $site;
             //  	 	 	 var_dump($episodes);
             return $sites;
         }
     }
     return false;
 }
function scrap_amazon_all($asin)
{
    $url = "http://www.amazon.com/dp/" . $asin;
    $result['url'] = $url;
    //$url="http://www.amazon.com/gp/offer-listing/".$asin."/ref=dp_olp_new&condition=new";
    $data = getPage($url);
    preg_match_all("%http://ecx.images-amazon.com/images/I/\\w+.jpg%", $data, $matches);
    $imgs = array_unique($matches[0]);
    $html = str_get_html($data);
    $ok = 0;
    foreach ($html->find('h1[id=title]') as $title) {
        $ok = 1;
    }
    if ($ok == 1) {
        $result['scrapok'] = 1;
    } else {
        $result['scrapok'] = 0;
        return $result;
    }
    $price = floatval(str_replace('$', '', $html->find('#priceblock_saleprice,#priceblock_ourprice', 0)->plaintext));
    $q = count((array) $html->find('#quantity option'));
    $prime = (!$price or @$html->find('#soldByThirdParty', 0)->plaintext) ? 'No' : 'Yes';
    $features = array_map(function ($el) {
        return $el->plaintext;
    }, (array) $html->find('#feature-bullets li'));
    $desc = @$html->find('#productDescription', 0)->plaintext || '';
    $result = array('quantity' => intval($q), 'offerprice' => $price, 'sku' => $asin, 'prime' => $prime, 'url' => $url, 'title' => $html->find('#productTitle', 0)->plaintext, 'features' => $features, 'desc' => $desc, 'img' => $imgs);
    return $result;
}
 static function parseMovie($id, $p_code, $info)
 {
     $url = replaceStr(NeteaseTeachParse::BASE_SHOW_EPISODE, '{COURSE_ID}', $id);
     $content = getPage($url, $p_code);
     $content = json_decode($content);
     if (is_object($content)) {
         $info->actor = property_exists($content, 'director') ? $content->director : "";
         $info->brief = property_exists($content, 'description') ? $content->description : "";
         $contents = property_exists($content, 'videoList') ? $content->videoList : array();
         if (is_array($contents) && count($contents) > 0) {
             $sites = array();
             $site = array();
             $site['site_url'] = "126";
             $site['site_name'] = "126";
             $site['max_episode'] = 'true';
             $episodes = array();
             foreach ($contents as $content) {
                 $episodes[] = array('name' => property_exists($content, 'title') ? $content->title : "", 'guest' => property_exists($content, 'subtitle') ? $content->subtitle : "", 'episode' => property_exists($content, 'pnumber') ? $content->pnumber : "", 'url' => property_exists($content, 'weburl') ? $content->weburl : "", 'img_url' => property_exists($content, 'imgpath') ? $content->imgpath : "", 'androidUrl' => property_exists($content, 'repovideourl') && !isN($content->repovideourl) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->repovideourl : "", 'videoAddressUrl' => property_exists($content, 'repoMP3url') && !isN($content->repoMP3url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->repoMP3url : "");
             }
             $site['episodes'] = $episodes;
             $sites[] = $site;
             //  	 	 	 var_dump($episodes);
             return $sites;
         }
     }
     return false;
 }
function parseVideoIOSUrls($sql)
{
    global $db;
    writetofile("parseVideo.txt", $sql);
    $rs = $db->query($sql);
    $rscount = $db->num_rows($rs);
    if ($rscount == 0) {
        errmsg("没有可用的数据");
    } else {
        while ($row = $db->fetch_array($rs)) {
            $u_id = $row["u_id"];
            $u_weburl = $row["u_weburl"];
            $p_id = $row["p_id"];
            $m_urltest = $row["m_urltest"];
            if (isN($u_weburl)) {
                $u_weburl = $m_urltest;
            }
            $project = getProgject($p_id);
            $webCode = getPage($u_weburl, $project->p_coding);
            //	    		$videoUrl = crawleVideoByPlayUrl($webCode,$project);
            $videoUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseIOSVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
            writetofile("android_log.txt", $strlink . '{===}' . $androidUrl);
            if (!isN($videoUrl)) {
                $sql = "update {pre}cj_vod_url set iso_video_url='" . $videoUrl . "', u_weburl='" . $u_weburl . "',android_vedio_url ='" . $androidUrl . "' where u_id=" . $u_id;
                writetofile("parseVideo.txt", $sql);
                $db->query($sql);
            } else {
                writetofile("videoUrlErrors.txt", '{===}' . $p_id . '{===}' . $u_id . '{===}' . $u_weburl);
            }
        }
    }
    unset($rs);
}
function parseChannel($area, $url, $stationname)
{
    global $db;
    $contents = getPage($url, "");
    $content = getBody($contents, '<div class="listmenu2" >', '<div class="listmenu" >');
    if ($content === false || isN($content)) {
        $content = getBodys($contents, '<div class="listmenu2" >');
    }
    // 	var_dump($content);
    $codes = getArray($content, "/program/", '</a>');
    //
    $codesArray = explode("{Array}", $codes);
    ////http://epg.tvsou.com/program/
    $channels = array();
    $currentStation = getBody($content, '<font color="#FF6600">', '</font>');
    $channels[$area . '{Array}' . $stationname . '{Array}' . $currentStation] = $url;
    foreach ($codesArray as $code) {
        $ste = explode('"class=blue2>', $code);
        if (!isN($ste[1])) {
            $channels[$area . '{Array}' . $stationname . '{Array}' . $ste[1]] = 'http://epg.tvsou.com/program/' . $ste[0];
        }
    }
    //var_dump($channels);
    return $channels;
}
function crawleAndroidVideoByPlayUrl($url, $project)
{
    $webCode = getPage($url, $project->p_coding);
    $androidUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseAndroidVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
    writetofile("android_log.txt", $strlink . '{===}' . $androidUrl);
    return $androidUrl;
}
 public function parseIOSVideoUrl($url, $p_coding, $p_script)
 {
     $content = getPage($this->p_videocodeApiUrl . $this->from . '/?url=' . $url, "utf-8");
     //  		var_dump($url);
     writetofile("joyplus.log", $this->p_videocodeApiUrl . $this->from . '/?url=' . $url);
     return $this->parseIOSVideoUrlByContent($content, $p_coding, $p_script);
 }
Exemple #9
0
function from_tumblr()
{
    global $sessionkey;
    $db = get_db_connectiuon();
    list($sessionkey, $cookies, $u) = get_login_cookie($db);
    $page = getPage();
    $agent = Net_UserAgent_Mobile::singleton();
    // paging a page
    if ($agent->isDoCoMo()) {
        $page = ceil($page / 2);
    }
    //$postid = getPostId();
    $url = 'http://www.tumblr.com/dashboard/';
    if ($page > 1) {
        $url .= $page;
    }
    if ($postid > 1) {
        $url .= "/{$postid}";
    }
    #print "<!--$url-->";
    $retry = 2;
    while ($retry--) {
        $req =& new HTTP_Request($url);
        $req->setMethod(HTTP_REQUEST_METHOD_GET);
        foreach ($cookies as $v) {
            $req->addCookie($v['name'], $v['value']);
        }
        if (PEAR::isError($req->sendRequest())) {
            $err = 1;
        }
        $code = $req->getResponseCode();
        if ($code == 302) {
            $err = true;
            if ($u['email']) {
                list($err, $cookies) = update_cookie_info($u['email'], $u['password'], true, $u['hash']);
            }
            if ($err) {
                $retry = 0;
                break;
            }
        } else {
            if ($code == 200) {
                return $req->getResponseBody();
            } else {
                print '<html><body><pre>x_x';
                print " {$code} ";
                print '</body></html>';
                exit;
            }
        }
    }
    if ($retry == 0) {
        header('Location: /login');
    } else {
        print '<html><body><pre>x_x';
        print '</body></html>';
    }
    exit;
}
Exemple #10
0
 function __construct()
 {
     $post_id = $_REQUEST['id'];
     $this->db = $db = get_db_connectiuon();
     list($sessionkey, $cookies) = get_login_cookie($db);
     $this->sessionkey = $sessionkey;
     $this->page = $page = getPage();
 }
 public function messager()
 {
     $ip = ipDecode(get_client_ip());
     $messagers = D('Messagers');
     $page = getPage($messagers, 5, "ip = {$ip}");
     $list = $messagers->field(true)->order('id DESC')->limit($page->firstRow . ',' . $page->listRows)->select();
     $this->assign('page', $page->show());
     $this->assign('messagers', $list);
     $this->display();
 }
 public function getLZLReplyList($to_f_reply_id, $order, $page = 1, $limit = 3)
 {
     $list = M('GroupLzlReply')->where('status=1 and to_f_reply_id=' . $to_f_reply_id)->order($order)->select();
     foreach ($list as $k => &$v) {
         $v['userInfo'] = query_user(array('avatar128', 'nickname', 'uid', 'space_url'), $v['uid']);
         $v['content'] = parse_weibo_mobile_content($v['content']);
     }
     unset($v);
     $list = getPage($list, $limit, $page);
     return $list;
 }
function scrape_overstock($itemid)
{
    $result = array();
    $url = "http://www.overstock.com/search/" . $itemid;
    //echo $url;
    $data = getPage($url);
    $result['itemid'] = $itemid;
    $html = str_get_html($data);
    foreach ($html->find('div[id=prod_mainCenter] h1') as $title) {
        $result['title'] = $title->plaintext;
        break;
    }
    foreach ($html->find('ul[class=bulleted-list]') as $description) {
        $result['description'] = $description->plaintext;
        break;
    }
    $result['description'] = str_replace('more', '', $result['description']);
    foreach ($html->find('div[id=proImageHero] div[class=proImageStack] img') as $image) {
        $result['imageurl'] = $image->src;
        break;
    }
    $result['imageurl'] = str_replace('_320', '_1000', $result['imageurl']);
    $i = 0;
    foreach ($html->find('div[id=proImageHero]') as $divimage) {
        //echo $divimage;die;
        foreach ($divimage->find('img') as $img) {
            $result['pictures' . $i] = $img->src;
            $result['pictures' . $i] = str_replace('_320', '_80', $result['pictures' . $i]);
            $i++;
        }
    }
    //}
    foreach ($html->find('span[class=price_sale main-price-red] span[class=Ovalue main-price-red]') as $price) {
        $result['price'] = $price->plaintext;
        break;
    }
    $qte = 0;
    foreach ($html->find('div[id=addCartMain_quantity] select') as $select) {
        foreach ($select->find('option') as $opt) {
            $qte++;
        }
    }
    $result['quantity'] = $qte;
    foreach ($html->find('ul[id=details_descFull]') as $features) {
        $result['features'] = $features;
        break;
    }
    foreach ($html->find('div[class=product-brand-name] a') as $brand) {
        $result['brand'] = $brand->plaintext;
        break;
    }
    $result['prime'] = 'Yes';
    return $result;
}
function getVideoUrlByProjectAndUrl($url, $pid)
{
    //    	global $db;
    $project = getProgject($pid);
    $webCode = getPage($url, $project->p_coding);
    $videoUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseIOSVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
    $androidUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseAndroidVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
    if (!isN($videoUrl) || !isN($androidUrl)) {
        return $videoUrl . MovieType::VIDEO_SEP_VERSION . $androidUrl;
    } else {
        return "Can't find";
    }
}
 static function crawlerProgramItems($date, $chnnel)
 {
     $dateTime = strtotime($date);
     $date = date('w', $dateTime);
     if ($date === '0') {
         $date = '7';
     }
     $url = replaceStr(TVSouLiveParse::BASE_EPISODE, '{DATE}', $date);
     $url = replaceStr($url, '{TV_CODE}', $chnnel);
     $content = getPage($url, "gb2312");
     writetofile("program_live_item_crawler.log", "url:[" . $url . "]");
     //  	 	var_dump($url);
     return TVSouLiveParse::parseMovieInfoByContent($content, $p_code, $type);
 }
 public function getReplyList($map, $order, $page, $limit)
 {
     $replyList = S('post_replylist_' . $map['post_id']);
     if ($replyList == null) {
         $replyList = M('ForumPostReply')->where($map)->order($order)->select();
         foreach ($replyList as &$reply) {
             $reply['user'] = query_user(array('avatar128', 'nickname', 'space_url', 'rank_link'), $reply['uid']);
             $reply['lzl_count'] = M('forum_lzl_reply')->where('is_del=0 and to_f_reply_id=' . $reply['id'])->count();
         }
         unset($reply);
         S('post_replylist_' . $map['post_id'], $replyList, 60);
     }
     $replyList = getPage($replyList, $limit, $page);
     return $replyList;
 }
 public function getLZLReplyList($to_f_reply_id, $order, $page = 1, $limit)
 {
     $list = S('post_replylzllist_' . $to_f_reply_id);
     if ($list == null) {
         $list = D('forum_lzl_reply')->where('is_del=0 and to_f_reply_id=' . $to_f_reply_id)->order($order)->select();
         foreach ($list as $k => &$v) {
             $v['userInfo'] = query_user(array('avatar', 'username', 'uid', 'space_url', 'icons_html'), $v['uid']);
             $v['content'] = op_t($v['content']);
         }
         unset($v);
         S('post_replylzllist_' . $to_f_reply_id, $list, 60);
     }
     $list = getPage($list, $limit, $page);
     return $list;
 }
 function getPayedUser($pageNum = NULL)
 {
     $model = new Model();
     $sql = "SELECT username,name,gender,phone,nicker ,coachid, FROM_UNIXTIME(time_end,'%Y-%m-%d %H:%m:%s') AS pay_time,money/100 AS money FROM xorder,user_info WHERE xorder.uid=user_info.id ORDER BY time_end DESC";
     $result = $model->query($sql);
     $rowCount = count($result);
     $pageSize = 10;
     $offset = 0;
     $url = "Admin/getPayedUser";
     $rowPage = getPage($rowCount, $pageSize, $pageNum, $url);
     $offset = $rowPage['offset'];
     $sql = "SELECT username,name,gender,phone,nicker,coachid, FROM_UNIXTIME(time_end,'%Y-%m-%d %H:%m:%s') AS pay_time,money/100 AS money FROM xorder,user_info WHERE xorder.uid=user_info.id ORDER BY time_end DESC LIMIT {$offset},{$pageSize}";
     $result = $model->query($sql);
     foreach ($result as $k => $v) {
         $result[$k]['coach'] = M("user_info")->where("id={$v['coachid']}")->getField("name");
     }
     $this->assign("offset", $offset + 1);
     $this->assign("count", $rowCount);
     $this->assign("pageList", $rowPage['show']);
     $this->assign("result", $result);
     $this->display();
     /*		echo "<pre>";
     		print_r($result);
     		echo "</pre>";*/
     /*		$title = "用户名&nbsp&nbsp&nbsp&nbsp姓名&nbsp&nbsp&nbsp&nbsp电话&nbsp&nbsp&nbsp&nbsp昵称&nbsp&nbsp&nbsp&nbsp付款时间&nbsp&nbsp&nbsp&nbsp金额<br>";
     		echo $title;
     		for ($i=0; $i < count($result); $i++) { 
     			$username = $result[$i]['username'];
     			$name = $result[$i]['name'];
     			$gender = $result[$i]['gender'] == 0 ? '男' : '女';
     			$phone = $result[$i]['phone'];
     			$nicker = $result[$i]['nicker'];
     			$pay_time = $result[$i]['pay_time'];
     			$money = $result[$i]['money'];
     
     			$line = $username.'&nbsp&nbsp&nbsp&nbsp'.$name.'&nbsp&nbsp&nbsp&nbsp'.$gender.'&nbsp&nbsp&nbsp&nbsp'.$phone.'&nbsp&nbsp&nbsp&nbsp'.$nicker.'&nbsp&nbsp&nbsp&nbsp'.$pay_time.'&nbsp&nbsp&nbsp&nbsp'.$money.'<br>';
     			echo $line;
     			
     		}
     
     		echo "<br>总共".count($result).'个付款的健友';*/
 }
function scrap_hayneedle($url)
{
    return array('offerprice' => 0, 'quantity' => 0, 'prime' => 'No', 'scrapok' => true);
    if (!filter_var($url, FILTER_VALIDATE_URL)) {
        $url = "http://search.hayneedle.com/search/index.cfm?Ntt=" . $url;
    }
    $data = getPage($url);
    $html = str_get_html($data);
    $result['scrapok'] = 0;
    if ($html) {
        foreach ($html->find('span[class=standard-style noWrap]') as $item) {
            $itemnumber = $item->plaintext;
            $result['scrapok'] = 1;
            break;
        }
        $result['scrapok'] = 1;
        $result['itemid'] = $itemnumber;
        preg_match("|<span.*?itemprop=\"price\".*?>(.*?)</span>|s", $html, $match_item_price);
        if (isset($match_item_price[1])) {
            $item_price = trim($match_item_price[1]);
        }
        $result['offerprice'] = $item_price;
        $result['offerprice'] = str_replace('$', '', $result['offerprice']);
        $result['offerprice'] = str_replace(',', '', $result['offerprice']);
        /*
        $qte=0;
        foreach($html->find('div[id=addCartMain_quantity] select') as $select) {
        foreach($select->find('option') as $opt) {
        $qte++;
        }
        }
        */
        $result['quantity'] = 100;
        $result['prime'] = 'Yes';
        $result['url'] = $url;
        return $result;
    } else {
        return -1;
    }
}
 public function getStudent($pageNum = NULL)
 {
     $coachid = $_GET['coachid'];
     $url = "User/getStudent";
     if ($coachid != "") {
         $sql1 = "SELECT count(*) AS count FROM xorder WHERE coachid={$coachid} ORDER BY time_end DESC";
         $rowCount = M()->query($sql1);
         $rowCount = $rowCount[0]['count'];
         $pageSize = 10;
         $offset = 0;
         $rowPage = getPageC($rowCount, $pageSize, $pageNum, $url, $coachid);
         $offset = $rowPage['offset'];
         $sql2 = "SELECT x.time_end,u.id,u.name,u.gender FROM xorder AS x LEFT JOIN user_info AS u ON x.uid=u.id WHERE x.coachid={$coachid} ORDER BY x.time_end DESC LIMIT {$offset},{$pageSize}";
         $student = M()->query($sql2);
         foreach ($student as $k => $v) {
             $time_end = $student[$k]['time_end'];
             $student[$k]['time_end'] = date("Y-m-d H:i:s", $time_end);
         }
     } else {
         $rowCount = M("xorder")->where("status=1")->count();
         $pageSize = 10;
         $offset = 0;
         $rowPage = getPage($rowCount, $pageSize, $pageNum, $url);
         $offset = $rowPage['offset'];
         $sql = "SELECT * FROM xorder AS x INNER JOIN user_info AS u ON x.uid=u.id WHERE x.status=1 ORDER BY x.time_end DESC LIMIT {$offset},{$pageSize}";
         $student = M()->query($sql);
         foreach ($student as $k => $v) {
             $time_end = $student[$k]['time_end'];
             $student[$k]['time_end'] = date("Y-m-d H:i:s", $time_end);
         }
     }
     $managerTip = ":后台管理:学员管理";
     $this->assign("managerTip", $managerTip);
     $this->assign("offset", $offset + 1);
     $this->assign("pageList", $rowPage['show']);
     $this->assign("count", $rowCount);
     $this->assign("student", $student);
     $this->display("student");
 }
Exemple #21
0
 function __construct()
 {
     $post_id = $_REQUEST['id'];
     $this->db = $db = get_db_connectiuon();
     list($sessionkey, $cookies) = get_login_cookie($db);
     $this->sessionkey = $sessionkey;
     $this->page = $page = getPage();
     $pid = getmypid();
     $this->postid = $postid = (int) $_REQUEST['postid'];
     if (preg_match('%^http://([a-z\\-_.]+\\.)+\\w{2,4}(/mobile)?/post/\\d+$%i', $link = (string) $_REQUEST['permalink'])) {
         $this->permalink = $link;
     } else {
         $link = '';
     }
     $uniqkey = "{$pid}-{$postid}-{$sessionkey}";
     $set = new Net_Gearman_Set();
     $task = new Net_Gearman_Task('reblog', array(cookies => $cookies, postid => $postid, sessionkey => $sessionkey, permalink => $this->permalink, token => $_REQUEST['token'], uniqkey => $uniqkey), $uniqkey, Net_Gearman_Task::JOB_BACKGROUND);
     //   $task->attachCallback('result');
     $set->addTask($task);
     $client = new Net_Gearman_Client(array('localhost:37003'));
     $client->runSet($set);
 }
Exemple #22
0
function aws_signed_request($region, $params)
{
    $public_key = "PUBLIC_KEY";
    $private_key = "PRIVATE_KEY";
    $method = "GET";
    $host = "ecs.amazonaws." . $region;
    $host = "webservices.amazon." . $region;
    $uri = "/onca/xml";
    $params["Service"] = "AWSECommerceService";
    $params["AssociateTag"] = "affiliate-20";
    // Put your Affiliate Code here
    $params["AWSAccessKeyId"] = $public_key;
    $params["Timestamp"] = gmdate("Y-m-d\\TH:i:s\\Z");
    $params["Version"] = "2011-08-01";
    ksort($params);
    $canonicalized_query = array();
    foreach ($params as $param => $value) {
        $param = str_replace("%7E", "~", rawurlencode($param));
        $value = str_replace("%7E", "~", rawurlencode($value));
        $canonicalized_query[] = $param . "=" . $value;
    }
    $canonicalized_query = implode("&", $canonicalized_query);
    $string_to_sign = $method . "\n" . $host . "\n" . $uri . "\n" . $canonicalized_query;
    $signature = base64_encode(hash_hmac("sha256", $string_to_sign, $private_key, True));
    $signature = str_replace("%7E", "~", rawurlencode($signature));
    $request = "http://" . $host . $uri . "?" . $canonicalized_query . "&Signature=" . $signature;
    $response = getPage($request);
    var_dump($response);
    $pxml = @simplexml_load_string($response);
    if ($pxml === False) {
        return False;
        // no xml
    } else {
        return $pxml;
    }
}
Exemple #23
0
 /**
  * displayUserNews 
  * 
  * @return void
  */
 function displayUserNews()
 {
     $this->displayHeader();
     $user = (int) $_GET['getnews'];
     $page = getPage();
     $this->fcmsFamilyNews->displayUserFamilyNews($user, $page);
     $this->displayFooter();
 }
Exemple #24
0
            $results[$i]['header_webm'] = $header_webm;
            $results[$i]['video_embed'] = $video_embed;
            $results[$i]['content_header'] = $content_header;
            $results[$i]['content'] = $content;
            $results[$i]['meta_keywords'] = $meta_keywords;
            $results[$i]['meta_desc'] = $meta_desc;
            $results[$i]['theme_class'] = $theme_class;
            $i++;
        }
        return $results;
    }
    $stmt->close();
    $mysqli->close();
    return $results;
}
$pageDetails = getPage($friendly_url, $DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
$fetchSuccess = false;
foreach ($pageDetails as $pageDetail) {
    if (isset($pageDetail['id'])) {
        $pageId = $pageDetail['id'];
        $isLandingPage = intval('0' . $pageDetail['is_landing_page']);
        $pageTitle = $pageDetail['title'];
        $pageNavTitle = $pageDetail['nav_title'];
        $pageHeading = $pageDetail['heading'];
        $pagePullout = $pageDetail['heading_pullout'];
        $pageSubHeading = $pageDetail['sub_heading'];
        $pageHeaderImage = $pageDetail['header_image'];
        $pageHeaderMP4 = $pageDetail['header_mp4'];
        $pageHeaderWebm = $pageDetail['header_webm'];
        $videoEmbed = $pageDetail['video_embed'];
        $pageContentHeader = $pageDetail['content_header'];
Exemple #25
0
                			<td width="110"><strong>FECHA</strong></td>
                			<td width="300"><strong>PROVEEDOR</strong></td>
                			<td width="80" align="center"><strong>REM</strong></td>
                			<td width="80" align="center"><strong>FAC</strong></td>
                			<td width="400"><strong>CLIENTE</strong></td>
                			<td width="150"><strong>DESTINO</strong></td>
                    		<td width="130"><strong>ESTATUS</strong></td>
                            <td width="120"><strong>ACCIONES</strong></td>
                		</tr>
            			<tr>
                    		<td class="text" colspan="11"><hr></td>
                		</tr>
                		<?php 
// Paginacion
$rowsPerPage = getRowsPerPage($link);
$page = getPage();
$offset = ($page - 1) * $rowsPerPage;
// Determino el numero de paginas
$query = "SELECT e.*, u.login \r\n\t\t\t\t\t\t            FROM ts_envio e, ts_usuario u,\r\n\t\t\t\t\t\t                 ts_proveedor p, ts_cliente c,\r\n\t\t\t\t\t\t                 ts_destino d \r\n\t\t\t\t\t\t           WHERE e.id_usuario = u.id \r\n\t\t\t\t\t\t             AND e.ind_activo < 2\r\n\t\t\t\t\t\t             AND e.id_proveedor = p.id \r\n\t\t\t\t\t\t             AND e.id_cliente = c.id \r\n\t\t\t\t\t\t             AND e.id_destino = d.id ";
if ($_REQUEST["txtBusqueda"] != "") {
    $query .= " AND (c.nombre LIKE '%" . $_REQUEST["txtBusqueda"] . "%'\r\n\t\t\t\t\t\t\t\t\t\t  OR p.nombre LIKE '%" . $_REQUEST["txtBusqueda"] . "%' \r\n\t\t\t\t\t\t\t\t\t\t  OR d.nombre LIKE '%" . $_REQUEST["txtBusqueda"] . "%' \r\n\t\t\t\t\t\t\t\t\t\t  OR e.remesa LIKE '%" . $_REQUEST["txtBusqueda"] . "%' \r\n\t\t\t\t\t\t\t\t\t\t  OR e.factura LIKE '%" . $_REQUEST["txtBusqueda"] . "%'  \t\t\t\r\n\t\t\t\t\t\t\t\t\t\t) ";
}
if ($_REQUEST["cmbEstatusEnvio"] != "") {
    $query .= " AND e.ind_envio=" . $_REQUEST["cmbEstatusEnvio"];
}
$fechaI = $_REQUEST["cmbAnoI"] . "-" . $_REQUEST["cmbMesI"] . "-" . $_REQUEST["cmbDiaI"];
if ($fechaI != "--") {
    $query .= " AND e.fecha_creacion='" . $fechaI . "' ";
}
$query .= " ORDER BY e.fecha_creacion DESC, e.ind_envio, e.id DESC, e.remesa, e.factura ";
$result = obtenerResultset($link, $query);
 public function checkHtmlCanPlay($url, $p_coding)
 {
     $content = getPage($url, $this->p_code);
     return false;
 }
Exemple #27
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php 
$d = getPage();
$error = $d['error'];
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title><?php 
echo $d['title'];
?>
</title>
		<script type="text/javascript" src="/jquery.js"></script>
		<script type="text/javascript" src="/jquery-cookie.js"></script>
		<script type="text/javascript" src="/camera.js"></script>
		<link rel="stylesheet" href="/style.css" type="text/css" />
	</head>
	<body>
		<div id="main">
			<div id="debug"></div>
			<?php 
if ($auth->getUser()) {
    include 'usernavbar.php';
}
include $d['page'];
?>
		</div>
	</body>
</html>
  <meta name="keywords" content="PHP, tutorial, howto, infoschool, lernen" />
  <meta name="robots" content="index,follow" />
  <link rel="shortcut icon" href="../img/IS_16.png" />
  <link rel="stylesheet" type="text/css" href="style.css" />
  <title>Infoschool-Tutorial - Lerne PHP anhand von Infoschool</title>
 </head>
 <body>
  <div class="text">
<?php 
/*
 * This file is part of Infoschool - a web based school intranet.
 * Copyright (C) 2008 Maikel Linke
 */
require_once 'TutorialLoader.php';
function getPage()
{
    $standardPage = 'start.html';
    $page =& $_GET['page'];
    if (isset($page)) {
        if (ereg('^([a-zA-Z0-9_\\-]+)$', $page)) {
            return $page . '.html';
        }
    }
    return $standardPage;
}
echo TutorialLoader::load(getPage());
?>
  </div>
 </body>
</html>
			</li>
            <li <?php 
getPage("feedback");
getPage("slack-register");
getPage("teamspeak");
?>
 ><a href="#">Tools</a>
                <ul class="i6">
					<li><a href="/feedback">Feedback Form</a> </li>
					<li class="col1"><a href="/teamspeak">Teamspeak 3</a> </li>
					<li class="col1"><hr><li>
					<li class="col1"><a href="https://spectrefleet.slack.com/messages/general/" target="_blank">Open Slack</a></li>
					<li class="col1"><a href="/slack-about">About Slack</a></li>
					<li class="col1"><a href="/slack-register">Register</a></li>
					</li>
                </ul>
            </li>
            <li <?php 
getPage("stream");
?>
><a href="/stream">Stream</a>
			<li <?php 
getPage("donate");
?>
 ><a href="/donate">Donate</a>
            </li>
        </ul>
    </nav>
</section>

{
    if (!file_exists($filepath)) {
        copy('compress.zlib://' . $url, $filepath, stream_context_create(['http' => ['header' => 'Accept-Encoding: gzip']]));
    }
    return SimpleDOM::loadHTMLFile($filepath);
}
$attributes = [];
$query = '/html/body/table/tr/td[@title = "Type"]/a';
$page = getPage('/tmp/html40attributes.html', 'http://www.w3.org/TR/html4/index/attributes.html');
foreach ($page->xpath($query) as $a) {
    if (strpos($a->textContent(), 'URI') !== false) {
        $attributes['URL'][] = trim($a->parentNode()->parentNode()->firstChild()->textContent());
    }
}
$query = '/html/body/section/section/table[@id="attributes-1"]/tbody/tr';
$page = getPage('/tmp/html51attributes.html', 'http://www.w3.org/html/wg/drafts/html/master/index.html');
foreach ($page->xpath($query) as $tr) {
    foreach (['CSS', 'URL'] as $type) {
        if (strpos($tr->td[2]->textContent(), $type) !== false) {
            foreach (preg_split('/[;\\s]+/', $tr->th->textContent(), -1, PREG_SPLIT_NO_EMPTY) as $attrName) {
                $attributes[$type][] = $attrName;
            }
        }
    }
}
// Prefill with known attributes from HTML 5.0 and HTML 4.01
$regexps = ['CSS' => ['^style$'], 'JS' => ['^on', '^data-s9e-livepreview-postprocess$'], 'URL' => ['^action$', '^cite$', '^data$', '^formaction$', '^href$', '^icon$', '^manifest$', '^pluginspage$', '^poster$', 'src$']];
foreach ($attributes as $type => $attrNames) {
    foreach ($attrNames as $attrName) {
        foreach ($regexps[$type] as $regexp) {
            // Test whether this attribute is already covered