Exemplo n.º 1
0
function load_ads($data)
{
    $level = 1;
    $catid = 8;
    foreach ($data->category as $cat) {
        $catid = addCategory(['title' => ucfirst($cat), 'alias' => JFilterOutput::stringURLSafe(ucfirst($cat)), 'extension' => 'com_content', 'path' => JFilterOutput::stringURLSafe(ucfirst($cat)), 'published' => 1, 'created_time' => date('Y-m-d H:i:s'), 'created_user_id' => 657, 'language' => '*', 'level' => $level++, 'parent_id' => $catid]);
    }
    $ad = $data->ad;
    $ad->description = "<p>" . html_entity_decode($ad->description) . "</p>";
    $dataMinicck = new stdClass();
    $dataMinicck->ad = $ad;
    $dataMinicck->location = $data->location;
    $dataMinicck->person = $data->person;
    addArticle(array('id' => 0, 'title' => $ad->title, 'alias' => JFilterOutput::stringURLSafe($ad->title), 'catid' => $catid, 'state' => 1, 'introtext' => '', 'fulltext' => $ad->description, 'created' => date('Y-m-d H:i:s'), 'created_by' => 657, 'language' => '*'), $dataMinicck);
}
Exemplo n.º 2
0
function getinfodetail(&$data)
{
    global $model, $_root, $cid, $strreplace, $pregreplace, $movieCid;
    echo $data['ourl'], "\n";
    $html = getHtml($data['ourl']);
    //  file_put_contents('error_view.html',$html);
    if (!$html) {
        echo "获取html失败";
        exit;
    }
    /**/
    $data['keyword'] = '';
    //
    $data['ptime'] = time();
    $data['utime'] = time();
    preg_match('#<div class="detail-desc-cnt">(.+)</div>#Uis', $html, $match);
    $match[1] = isset($match[1]) ? $match[1] : '';
    $match[1] = @iconv("UTF-8", "UTF-8//TRANSLIT", $match[1]);
    //echo $match[1],"\n";
    $data['intro'] = strip_tags($match[1]);
    $data['intro'] = preg_replace('#&\\S+;#Uis', '', $data['intro']);
    $data['intro'] = trim($data['intro']);
    if (strlen($data['intro']) > 1024) {
        $data['intro'] = mb_substr($data['intro'], 0, 510, 'UTF-8') . '...';
    }
    preg_match('#<p \\s*class="play-list"><a \\s*target="_blank" \\s*href="(/videos/\\d+vod-play-id-\\d+-sid-\\d+-pid-\\d+\\.html)">.+</a>#Uis', $html, $match);
    $purl = isset($match[1]) ? $match[1] : '';
    //$purl = '/videos/57122vod-play-id-57122-sid-0-pid-15.html';
    if (!$purl) {
        file_put_contents('play_url_html.html', $html);
        die("\n Ourl: {$data['ourl']} Get PlayUrl Error!\n");
    }
    $data['purl'] = $_root . $purl;
    $playhtml = getArticlePlayData($data['purl']);
    if (empty($playhtml)) {
        echo "\n++ Ourl:{$data['ourl']} Purl:{$data['purl']} playdata vols decode error!++\n";
        //return 0;
    }
    $data['vols'] = $playhtml;
    unset($data['purl']);
    if (!$data['name']) {
        echo "抓取失败 {$data['ourl']} \r\n";
        return false;
    }
    if (empty($data['vols'])) {
        $data['status'] = 5;
        echo "\nOurl: {$data['ourl']} Get PlayVols Empty!\n";
    }
    $data['ourl'] = str_replace($_root, '', $data['ourl']);
    echo '<pre>';
    var_dump($data);
    exit;
    /**
    //在判断是否更新
      $oname = $data['name'];
      $aid = checkArticleByOname($oname);
      if($aid && !empty($data['vols'])){
        $vdata = array('name'=>$data['name'],'vols'=>$data['vols']);
        $aid = addArticleVols($vdata);
        echo "{$aid}已存在更新!\r\n";
        return 6;
      }
      if($aid && empty($data['vols'])){
        echo "{$aid}已存在更新!\r\n";
        return 6;
      }
    /**/
    $aid = addArticle($data);
    //echo '|',$aid,'|';exit;
    if (!$aid) {
        var_dump($data);
        echo "\r\n添加失败! {$data['ourl']} \r\n";
        exit;
        return false;
    }
    echo "添加成功! {$aid} \r\n";
}
Exemplo n.º 3
0
                <div id="buttons">
                    <a class="MenuButtonDesign MenuButtonSize" href="index.php">Home</a> 
                    <a class="MenuButtonDesign MenuButtonSize" href="products.php">Unsere Produkte</a>
                    <a class="MenuButtonDesign MenuButtonSize" href="offer.php">Angebote</a>
                    <a class="MenuButtonDesign MenuButtonSize" href="contact.php">Kontakt</a>
                    <a class="MenuButtonDesign LastButtonSize" href="about.php">Über uns</a>
                </div>
                    <?php 
if (isset($pageLocation)) {
    switch ($pageLocation) {
        case PageLocation::Home:
            echo 'Home';
            break;
        case PageLocation::Home:
            // echo 'Article';
            addArticle();
            break;
        case PageLocation::Products:
            displayOurProducts();
            //showAllArticles();
            break;
        case PageLocation::SpecialOffer:
            editArticle($edit);
            //showAllArticles();
            break;
        case PageLocation::Contact:
            echo 'User';
            break;
        case PageLocation::AboutUs:
            editArticle($edit);
            //showAllArticles();
Exemplo n.º 4
0
        $data['vols'] = $vinfo;
        //var_dump($data);exit;
        if (empty($vinfo)) {
            echo "\n==== Get Parse Info Failed Ourl: {$infoUrl} Purl: {$sourceUrl}  Page: {$start_page} =====\n";
            if (stripos($uv, '/resource/id/') !== false) {
                continue;
            }
            exit;
        }
        $aid = checkArticleByOname($data['name']);
        if ($aid) {
            $vdata = array('name' => $data['name'], 'vols' => $data['vols']);
            $aid = addArticleVols($vdata);
            echo "{$aid}已存在更新! ovid: {$ovid} Page: {$start_page} \r\n";
            $m->addid97vid($ovid);
            continue;
        }
        $aid = addArticle($data);
        if ($aid) {
            $m->addid97vid($ovid);
            echo "\n=== Add Aid: {$aid}  ovid: {$ovid} Page: {$start_page} OK ====\n";
        } else {
            var_dump($data);
            echo "\r\n添加失败! Ourl: {$infoUrl} \r\n";
            exit;
        }
        //exit;
        sleep(6);
    }
    // exit;
}
Exemplo n.º 5
0
    $results2 = $conn->query($query);
    if (mysqli_num_rows($results1) >= 1 or mysqli_num_rows($results2) >= 1) {
        return true;
    } else {
        return false;
    }
}
function getArticle($conn)
{
    //Fetch article, display to user.
    $query = "SELECT * FROM `articles_enabled` ORDER BY RAND() LIMIT 1";
    $result = $conn->query($query);
    foreach ($result as $rec) {
        return $rec;
    }
}
$str = json_encode(getArticle($conn));
echo $str;
$size = ob_get_length();
header("Content-Length: {$size}");
ob_end_flush();
// Strange behaviour, will not work
flush();
// Unless both are called !
ob_end_clean();
$array = getTitles();
foreach ($array as $rec) {
    if (!articleExists($rec, $conn)) {
        addArticle($rec, $conn);
    }
}
Exemplo n.º 6
0
function getinfodetail(&$data)
{
    global $model, $_root, $cid, $strreplace, $pregreplace;
    echo $data['ourl'], "\n";
    $html = getHtml($data['ourl']);
    //  file_put_contents('error_view.html',$html);
    //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ;
    $html = mb_convert_encoding($html, "UTF-8", "GBK");
    if (!$html) {
        echo "获取html失败";
        exit;
    }
    $data['keyword'] = '';
    $data['actor'] = @iconv("UTF-8", "UTF-8//TRANSLIT", $data['actor']);
    //
    $data['ptime'] = time();
    $data['utime'] = time();
    preg_match('#<div class="introduction" itemprop="description"><p>(.+)</p></div>#Uis', $html, $match);
    $match[1] = isset($match[1]) ? $match[1] : '';
    $match[1] = @iconv("UTF-8", "UTF-8//TRANSLIT", $match[1]);
    //echo $match[1],"\n";
    $data['intro'] = strip_tags($match[1]);
    $data['intro'] = preg_replace('#&\\S+;#Uis', '', $data['intro']);
    $data['intro'] = mb_strlen($data['intro']) > 300 ? mb_substr($data['intro'], 0, 256, 'UTF-8') : $data['intro'];
    $data['intro'] = trim($data['intro']);
    $playhtml = getArticlePlayData($data['purl']);
    if (empty($playhtml)) {
        echo "\n++ Ourl:{$data['ourl']} Purl:{$data['purl']} playdata vols decode error!++\n";
        return 0;
    }
    $data['vols'] = $playhtml;
    unset($data['purl']);
    if (!$data['name'] || empty($data['vols'])) {
        echo "抓取失败 {$data['ourl']} \r\n";
        exit;
        return false;
    }
    $data['ourl'] = str_replace($_root, '', $data['ourl']);
    #  echo '<pre>';var_dump($data);exit;
    /**/
    //在判断是否更新
    $oname = $data['name'];
    $aid = checkArticleByOname($oname);
    if ($aid) {
        $vdata = array('name' => $data['name'], 'vols' => $data['vols']);
        $aid = addArticleVols($vdata);
        echo "{$aid}已存在更新!\r\n";
        return 6;
    }
    /**/
    $aid = addArticle($data);
    //echo '|',$aid,'|';exit;
    if (!$aid) {
        var_dump($data);
        echo "\r\n添加失败! {$data['ourl']} \r\n";
        exit;
        return false;
    }
    echo "添加成功! {$aid} \r\n";
}
Exemplo n.º 7
0
                        $result->copy($as);
                        break;
                    case 'delete':
                        $reports[] = deleteArticle($result);
                        break;
                }
            }
        } else {
            $result = new ZenpageNews('');
            $result->setPermalink(1);
            $result->setDateTime(date('Y-m-d H:i:s'));
        }
    }
    if (isset($_GET['save'])) {
        XSRFdefender('save');
        $result = addArticle($reports);
    }
    if (isset($_GET['delete'])) {
        XSRFdefender('delete');
        $msg = deleteArticle($_GET['delete']);
        if (!empty($msg)) {
            $reports[] = $msg;
        }
    }
}
if (is_AdminEditPage('category')) {
    $tab = 'news';
    $_GET['tab'] = 'categories';
    if (isset($_GET['save'])) {
        XSRFdefender('save');
        addCategory($reports);
Exemplo n.º 8
0
<?
require_once('articleModel.php');

$title = 'Добавление названия новости';
$text = 'Добавление текста новости';

addArticle( $title, $text );

//header('Location: http://mysite/index.php');
Exemplo n.º 9
0
function getinfodetail(&$data)
{
    global $model, $_root, $cid, $strreplace, $pregreplace;
    echo $data['ourl'], "\n";
    $html = getHtml($data['ourl']);
    //  file_put_contents('error_view.html',$html);
    //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ;
    $html = mb_convert_encoding($html, "UTF-8", "GBK");
    if (!$html) {
        echo "获取html失败";
        exit;
    }
    //kw
    /*/
      preg_match('#<meta name="keywords" content="(.+)" />#U',$html,$match);
      $data['keyword']=trim($match[1]);
      /**/
    $data['keyword'] = '';
    //
    $data['ptime'] = time();
    $data['utime'] = time();
    preg_match('#<h3 class="ph3">影片介绍</h3>\\s+<ul>(.+)</ul>\\s+</div>\\s+</div>#Uis', $html, $match);
    $match[1] = isset($match[1]) ? $match[1] : '';
    $match[1] = @iconv("UTF-8", "UTF-8//TRANSLIT", $match[1]);
    //echo $match[1],"\n";
    $data['intro'] = strip_tags($match[1]);
    $data['intro'] = preg_replace('#&\\S+;#Uis', '', $data['intro']);
    $data['intro'] = trim($data['intro']);
    $playhtml = getArticlePlayData($data['purl']);
    if (empty($playhtml)) {
        echo "\n++ Ourl:{$data['ourl']} Purl:{$data['purl']} playdata vols decode error!++\n";
        return 0;
    }
    $data['vols'] = jsary2phpary($playhtml);
    unset($data['purl']);
    if (!$data['name'] || empty($data['vols'])) {
        echo "抓取失败 {$data['ourl']} \r\n";
        return false;
    }
    $data['ourl'] = str_replace($_root, '', $data['ourl']);
    //  echo '<pre>';var_dump($data);exit;
    //在判断是否更新
    $oname = $data['name'];
    $aid = checkArticleByOname($oname);
    if ($aid) {
        $vdata = array('name' => $data['name'], 'vols' => $data['vols']);
        $aid = addArticleVols($vdata);
        echo "{$aid}已存在更新!\r\n";
        return 6;
    }
    $aid = addArticle($data);
    //echo '|',$aid,'|';exit;
    if (!$aid) {
        var_dump($data);
        echo "\r\n添加失败! {$data['ourl']} \r\n";
        exit;
        return false;
    }
    echo "添加成功! {$aid} \r\n";
}
Exemplo n.º 10
0
function getinfodetail(&$data)
{
    global $model, $_root, $cid, $strreplace, $pregreplace;
    echo $data['ourl'], "\n";
    $html = getHtml($data['ourl']);
    $html = mb_convert_encoding($html, "UTF-8", "GBK");
    if (!$html) {
        echo "获取html失败";
        exit;
    }
    //kw
    $data['keyword'] = '';
    //
    $data['ptime'] = time();
    $data['utime'] = time();
    preg_match('#剧情介绍:</h2>\\s*</div>\\s*<div style="[^"]+">(.+)<p>#Uis', $html, $match);
    $match[1] = isset($match[1]) ? $match[1] : '';
    //echo $match[1],"\n";
    $data['intro'] = strip_tags($match[1]);
    $data['intro'] = preg_replace('#&\\S+;#Uis', '', $data['intro']);
    $data['intro'] = mb_strlen($data['intro']) > 300 ? mb_substr($data['intro'], 0, 300, 'utf-8') : $data['intro'];
    $data['intro'] = str_replace('?', '', $data['intro']);
    $data['intro'] = trim($data['intro']);
    $data['intro'] = preg_replace("#(\r\n)+#is", "\r\n", $data['intro']);
    $data['intro'] = preg_replace("#\n+#is", "\n", $data['intro']);
    $data['intro'] = preg_replace('#\\s\\s+#is', ' ', $data['intro']);
    $data['intro'] = @iconv("UTF-8", "UTF-8//TRANSLIT", $data['intro']);
    $data['intro'] = str_replace('?', '', $data['intro']);
    preg_match('#<li><a title=\'[^\']+\' href=\'(/.+/player-0-0\\.html)\' target="_blank">.+</a></li>#Uis', $html, $match);
    $data['purl'] = @$match[1];
    $playhtml = getArticlePlayData($data['purl']);
    if (empty($playhtml)) {
        echo "\n++ Ourl:{$data['ourl']} Purl:{$data['purl']} playdata vols decode error!++\n";
        return 0;
    }
    $data['vols'] = getParseVideoInfo($playhtml);
    unset($data['purl']);
    if (!$data['name'] || empty($data['vols'])) {
        echo "抓取失败 {$data['ourl']} \r\n";
        return false;
    }
    $data['ourl'] = str_replace($_root, '', $data['ourl']);
    #  echo '<pre>';var_dump($data);exit;
    /**/
    //在判断是否更新
    $oname = $data['name'];
    $aid = checkArticleByOname($oname);
    if ($aid) {
        $vdata = array('name' => $data['name'], 'vols' => $data['vols']);
        $aid = addArticleVols($vdata);
        echo "{$aid}已存在更新!\r\n";
        return 6;
    }
    /**/
    $aid = addArticle($data);
    //echo '|',$aid,'|';exit;
    if (!$aid) {
        var_dump($data);
        echo "\r\n添加失败! {$data['ourl']} \r\n";
        exit;
        return false;
    }
    echo "添加成功! {$aid} \r\n";
}
Exemplo n.º 11
0
function addArticleGUI()
{
    if ($_REQUEST['submit'] == "Avbryt") {
        deleteArticleFromSession();
        if (isset($_REQUEST['comment_to']) && $_REQUEST['comment_to'] != "NULL") {
            h3("Kommentar slettet eller artikkelredigering avbrutt");
            echo '<a href="index.php?articleid=' . $_REQUEST['comment_to'] . '&m_c=va">Klikk her for å gå tilbake til artikkelen</a>';
        } else {
            h3("Artikkel slettet eller redigering avbrutt");
        }
        return;
    }
    // Call addArticle with the correct variables from REQUEST. This is internal
    // to the GUI - it knows which values are actually sent from enterArticleGUI
    // and which are irrelevant.
    // Get the return values from addArticle and print user feedback accordingly
    $articleArray = buildArticleArray($_REQUEST);
    if (!userMayPost($articleArray)) {
        h3("Du er ikke innlogget eller har ikke rettigheter til å poste.");
        div_open();
        echo "Dette skjer automatisk etter omkring 20 minutters inaktivitet. Teksten du forsøkte å sende inn følger. Merk den, klipp den ut og lim den inn i artikkel/kommentarskjemaet når du har logget inn på ny.";
        form_textarea("body", $articleArray['body'], 50, 10);
        div_close();
        return;
    }
    backupToSession($articleArray);
    // So IE users can go 'back' and keep form contents
    $feedback = verifyArticle($articleArray);
    // If we get anything other than a "true" from verification
    // we print the error messages and exit
    if ($feedback[0] != "1") {
        foreach ($feedback as $message) {
            echo $message;
            br();
        }
        form_start_post();
        form_submit("submit", "Tilbake til redigering");
        if ($articleArray['comment_to'] != "NULL") {
            form_hidden("m_c", "va");
            form_hidden("articleid", $articleArray['comment_to']);
        } else {
            form_hidden("m_c", "editArticle");
        }
        $_SESSION['save_attempted'] = 1;
        form_end();
        return;
    }
    // Check if we want to add the article or just preview it
    if ($_REQUEST['submit'] == "Forhåndsvis") {
        h3("Forhåndsvisning :)");
        previewArticle($articleArray);
        table_open();
        tr_open();
        td_open(1);
        // Inserting the previewed data into the webpage
        // so addArticle function can operate as if the data
        // came straight from the input form.
        // EXCEPTION: The body contents, which can contain HTML tags,
        // is stored in a session variable.
        form_start_post();
        $_SESSION['newbody'] = $articleArray['body'];
        $_SESSION['newtitle'] = $articleArray['title'];
        form_hidden("is_draft", $articleArray['is_draft']);
        form_hidden("category", $articleArray['category']);
        form_hidden("intro", $articleArray['intro']);
        form_hidden("priority", $articleArray['priority']);
        form_hidden("year", $articleArray['year']);
        form_hidden("month", $articleArray['month']);
        form_hidden("day", $articleArray['day']);
        form_hidden("hours", $articleArray['hours']);
        form_hidden("minutes", $articleArray['minutes']);
        form_hidden("articleid", $articleArray['articleid']);
        form_hidden("author_username", $articleArray['author_username']);
        form_hidden("author", $articleArray['author_username']);
        if (isset($articleArray['comment_to'])) {
            form_hidden("comment_to", $articleArray['comment_to']);
        }
        form_hidden("m_c", "addArticleGUI");
        form_submit("submit", "Legg opp");
        form_submit("submit", "Avbryt");
        form_end();
        form_start_post();
        form_submit("submit", "Tilbake til redigering");
        form_hidden("m_c", "editArticle");
        if ($articleArray['comment_to'] == "NULL") {
            form_hidden("articleid", $articleArray['articleid']);
        } else {
            form_hidden("articleid", $articleArray['comment_to']);
            form_hidden("comment_to", $articleArray['articleid']);
        }
        $_SESSION['save_attempted'] = 1;
        form_end();
        td_close();
        td_open(1);
        td_close();
        tr_close();
        table_close();
    } else {
        // Add article
        $result = addArticle($articleArray);
        if ($result[0] != -1) {
            deleteArticleFromSession();
            if ($articleArray['comment_to'] != "NULL") {
                echo 'Godt sagt, forhåpentligvis! Og husk <a href="http://www.presse.no/varsom.asp">Vær Varsom-plakaten</a>. <br/>';
                echo '<a href="index.php?articleid=' . $articleArray['comment_to'] . '&m_c=va#lastcomment">Klikk her for å gå tilbake til artikkelen</a>';
            } else {
                if ($articleArray['articleid'] > 0 && $articleArray['comment_to'] != "NULL") {
                    echo 'Kommentaren er redigert. ';
                    echo '<a href="index.php?articleid=' . $articleArray['comment_to'] . '&m_c=va">Klikk her for å gå til artikkelen</a>';
                } else {
                    if ($articleArray['articleid'] > 0) {
                        echo 'Artikkelen er redigert. ';
                        if ($articleArray['is_draft'] == "1") {
                            echo "Artikkelen er ikke publisert, men kan hentes frem fra din profilside.";
                        } else {
                            echo '<a href="index.php?articleid=' . $articleArray['articleid'] . '&m_c=va">Klikk her for å gå til artikkelen</a>';
                        }
                    } else {
                        if ($articleArray['articleid'] == -1) {
                            echo 'Artikkelen er opprettet. ';
                            if ($articleArray['is_draft'] == "1") {
                                echo "Artikkelen er ikke publisert, men kan hentes frem fra din profilside.";
                            } else {
                                $idofnewarticle = $result[0];
                                echo '<a href="index.php?articleid=' . $idofnewarticle . '&m_c=va">Klikk her for å gå til artikkelen</a>';
                            }
                        }
                    }
                }
            }
        }
        foreach ($result as $message) {
            //echo($message);	br();
        }
    }
}
Exemplo n.º 12
0
function getinfodetail(&$data)
{
    global $model, $_root, $cid, $strreplace, $pregreplace;
    echo $data['ourl'], "\n";
    $html = getHtml($data['ourl']);
    //  file_put_contents('error_view.html',$html);
    //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ;
    $html = mb_convert_encoding($html, "UTF-8", "GBK");
    if (!$html) {
        echo "获取html失败";
        exit;
    }
    $data['keyword'] = '';
    $data['actor'] = @iconv("UTF-8", "UTF-8//TRANSLIT", $data['actor']);
    //
    $data['ptime'] = time();
    $data['utime'] = time();
    preg_match('#<div class="description b mb">\\s*<h2>.+剧情介绍:</h2>(.+)</div>#Uis', $html, $match);
    $match[1] = isset($match[1]) ? $match[1] : '';
    $match[1] = @iconv("UTF-8", "UTF-8//TRANSLIT", $match[1]);
    #echo $match[1],"\n";exit;
    $data['intro'] = strip_tags($match[1]);
    $data['intro'] = preg_replace('#&\\S+;#Uis', '', $data['intro']);
    $data['intro'] = preg_replace('#《[^》]+》全集在线观看由琪琪影院www.77vcd.com提供如果您觉得本站不错 请推荐给您的好友#Uis', '', $data['intro']);
    $data['intro'] = str_replace('琪琪影院', 'web_title', $data['intro']);
    $data['intro'] = str_replace('www.77vcd.com', 'web_domain', $data['intro']);
    $data['intro'] = mb_strlen($data['intro']) > 300 ? mb_substr($data['intro'], 0, 256, 'UTF-8') : $data['intro'];
    $data['intro'] = trim($data['intro']);
    #var_dump($data['intro']);exit;
    preg_match('#<ul><li><a title=\'[^\']*\' href=\'(/[^\']+/player-\\d+-\\d+\\.html)\' target="_blank">.*</a></li></ul>#Uis', $html, $match);
    $purl = isset($match[1]) ? $match[1] : '';
    #var_dump($match);exit;
    $playhtml = getArticlePlayData($purl);
    if (empty($playhtml)) {
        echo "\n++ Ourl:{$data['ourl']} Purl:{$data['purl']} playdata vols decode error!++\n";
        return 0;
    }
    $data['vols'] = $playhtml;
    unset($data['purl']);
    if (!$data['name'] || empty($data['vols'])) {
        echo "抓取失败 {$data['ourl']} \r\n";
        exit;
        return false;
    }
    $data['ourl'] = str_replace($_root, '', $data['ourl']);
    echo '<pre>';
    var_dump($data);
    exit;
    /*
    //在判断是否更新
      $oname = $data['name'];
      $aid = checkArticleByOname($oname);
      if($aid){
        $vdata = array('name'=>$data['name'],'vols'=>$data['vols']);
        $aid = addArticleVols($vdata);
        echo "{$aid}已存在更新!\r\n";
        return 6;
      }
    /**/
    $aid = addArticle($data);
    //echo '|',$aid,'|';exit;
    if (!$aid) {
        var_dump($data);
        echo "\r\n添加失败! {$data['ourl']} \r\n";
        exit;
        return false;
    }
    echo "添加成功! {$aid} \r\n";
}
Exemplo n.º 13
0
function getinfodetail(&$data)
{
    global $model, $start_page, $_root, $cid, $strreplace, $pregreplace;
    echo $data['ourl'], "\n";
    $html = getHtml($data['ourl']);
    //  $html = mb_convert_encoding($html,"UTF-8","GBK");
    if (!$html) {
        echo "获取html失败";
        exit;
    }
    //kw
    $data['keyword'] = '';
    //
    $data['ptime'] = time();
    $data['utime'] = time();
    preg_match('#<span class="more" txt="([^"]+)"\\s*>#Uis', $html, $match);
    $match[1] = isset($match[1]) ? $match[1] : '';
    //echo $match[1],"\n";exit;
    $data['intro'] = strip_tags($match[1]);
    $data['intro'] = preg_replace('#&\\S+;#Uis', '', $data['intro']);
    $data['intro'] = mb_strlen($data['intro']) > 300 ? mb_substr($data['intro'], 0, 300, 'utf-8') : $data['intro'];
    $data['intro'] = str_replace('?', '', $data['intro']);
    $data['intro'] = trim($data['intro']);
    $data['intro'] = preg_replace("#(\r\n)+#is", "\r\n", $data['intro']);
    $data['intro'] = preg_replace("#\n+#is", "\n", $data['intro']);
    $playhtml = getArticlePlayData($data['purl']);
    if (empty($playhtml)) {
        echo "\n++ Ourl:{$data['ourl']} Purl:{$data['purl']} playdata vols decode error!++\n";
        return 0;
    }
    $data['vols'] = getParseVideoInfo($playhtml);
    unset($data['purl']);
    if (!$data['name'] || empty($data['vols'])) {
        echo "抓取失败 {$data['ourl']} \r\n";
        return false;
    }
    $data['ourl'] = str_replace($_root, '', $data['ourl']);
    //  echo '<pre>';var_dump($data);exit;
    /**/
    //在判断是否更新
    $oname = $data['name'];
    $aid = checkArticleByOname($oname);
    if ($aid) {
        $vdata = array('name' => $data['name'], 'vols' => $data['vols']);
        $aid = addArticleVols($vdata);
        echo "{$aid}已存在更新!\r\n";
        return 6;
    }
    /**/
    $aid = addArticle($data);
    //echo '|',$aid,'|';exit;
    if (!$aid) {
        var_dump($data);
        echo "\r\n添加失败! {$data['ourl']} \r\n";
        exit;
        return false;
    }
    echo "添加成功! {$aid} \r\n";
}
Exemplo n.º 14
0
         echo query($_POST['checksum'], str_replace("#", "=", $_POST['query']));
     }
     break;
 case "2":
     if (notNull($_POST['query'])) {
         echo roles(str_replace("#", "=", $_POST['query']));
     }
     break;
 case "add_raider":
     if (notNull($_POST)) {
         addRaider($_POST);
     }
     break;
 case "add_article":
     if (notNull($_POST)) {
         addArticle($_POST);
     }
     break;
 case "edit_article":
     if (notNull($_POST)) {
         editArticle($_POST);
     }
     break;
 case "update_articles":
     if (notNull($_POST)) {
         updateArticles($_POST['order']);
     }
     break;
 case "delete_article":
     if (notNull($_POST)) {
         deleteArticle($_POST['id']);
Exemplo n.º 15
0
	<?php 
addArticle('A-Friday-Night-in-New-Haven');
?>
	<?php 
addArticle('8-Signs-You-Went-to-a-Boarding-School');
?>
	<?php 
addArticle('20-Comfort-Foods-All-Yalies-Love');
?>
	<?php 
addArticle('Are-You-a-Payne-Whitney-GymRat');
?>
	<!--<h4>March 24, 2014</h4>-->
	<?php 
addArticle('6-Fun-New-Haven-Dining-Options');
?>
	<?php 
addArticle('Dos-and-Donts-of-Dating-at-Yale');
?>
	<!--<h4>March 7, 2014</h4>-->
	<?php 
addArticle('5-Steps-to-Your-Dream-Beach-Body');
?>
	<!--<h4>February 22, 2014</h4>-->
	<?php 
addArticle('8-Studying-Tips-From-Phi-Beta-Kappa');
?>
	<?php 
addArticle('5-Apps-That-Should-Be-A-Thing-But-Arent');
?>
</div>