Вход Регистрация
Файл: public_html/admin/cron-all.php
Строк: 184
<?php
error_reporting
(E_ALL);
session_start();
include 
'config.php';
echo 
dbconn();
if (!isset(
$_SESSION['autoblg'])) {
header( 'Location: index.php' ) ;
}

if (isset(
$_GET['res'])) {
unset(
$_SESSION['autoblg']);
header( 'Location: index.php' ) ;
}
?>

<!DOCTYPE html>
<html class="no-js">
    
    <head>
        <title>Autoblog Admin</title>
        <!-- Bootstrap -->
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
        <link href="vendors/easypiechart/jquery.easy-pie-chart.css" rel="stylesheet" media="screen">
        <link href="assets/styles.css" rel="stylesheet" media="screen">
        <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <script src="vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
    </head>
    
    <body>
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                    </a>
                    <a class="brand" href="#">Autoblog Admin</a>
                    <div class="nav-collapse collapse">
                        <ul class="nav pull-right">
                            <li class="dropdown">
                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-user"></i> Admin <i class="caret"></i>

                                </a>
                                <ul class="dropdown-menu">
                                    
                                    <li>
                                        <a tabindex="-1" href="?res">Logout</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                      
                    </div>
                    <!--/.nav-collapse -->
                </div>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">         
                <div class="span3" id="sidebar">
                    <ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
                        <li class="active">
                            <a href="home.php"><i class="icon-chevron-right"></i> Manage Feeds</a>
                        </li>
                        <li>
                            <a href="manage-articles.php"><i class="icon-chevron-right"></i> Manage Articles</a>
                        </li>
                         <li>
                            <a href=""><i class="icon-chevron-right"></i> Updating All Feeds</a>
                        </li>
                    </ul>
                </div>
                
                <!--/span-->
                <div class="span9" id="content">

                 
                   <div class="row-fluid">
                   <div style="background-color:#ffffff;border-radius: 15px;">
                   <div style="margin:20px">
                  <?php
    

    



function bm_extract_string($start, $end, $original) {
    
$original1 = stripos($original, $start);
    
$trimmed = stripos($original, $end);
    return 
substr($original, $original1+strlen($start), $trimmed-$original1-strlen($start));
}

$resultrss = mysql_query("SELECT * FROM feeds"); 
while(
$rowfeeds = mysql_fetch_array( $resultrss )) {
$feed = $rowfeeds["link"];
$feedid = $rowfeeds["id"];
$feedtitle = $rowfeeds["title"];
$category = $rowfeeds["category"];


$feed_url = $feed;


    echo 
"Starting to work with feed URL '" . $feed_url . "'";


    
$RSS_DOC = simpleXML_load_file($feed_url);




    
$rss_title = $RSS_DOC->channel->title;
    
$rss_link = $RSS_DOC->channel->link;
    
$rss_editor = $RSS_DOC->channel->managingEditor;
    
$rss_copyright = $RSS_DOC->channel->copyright;
    
$rss_date = $RSS_DOC->channel->pubDate;



    foreach(
$RSS_DOC->channel->item as $RSSitem)
    {

        
$item_id     = md5($RSSitem->title);
        
$fetch_date = date("Y-m-j G:i:s"); 
        
$item_title = $RSSitem->title;
        
$item_content = $RSSitem->description;
        
$searchit = array(
    
'&#8220;', // 1. Left Double Quotation Mark “
    
'&#8221;', // 2. Right Double Quotation Mark ”
    
'&#8216;', // 3. Left Single Quotation Mark ‘
    
'&#8217;', // 4. Right Single Quotation Mark ’
    
'&#039;',  // 5. Normal Single Quotation Mark '
    
'&amp;',   // 6. Ampersand &
    
'&quot;',  // 7. Normal Double Qoute
    
'&lt;',    // 8. Less Than <
    
'&gt;',    // 9. Greater Than >
    
'’',     // 10. Crappy apostrphe
    
"'"     // 10. Crappy apostrphe
    
);

$replaceit = array(
    
'"', // 1
    
'"', // 2
    
"'", // 3
    
"'", // 4
    
"'", // 5
    
"'", // 6
    
'"', // 7
    
"<", // 8
    
">",  // 9
    
"'",  // 10
    
"'" //11
);
$fixed_string = htmlspecialchars($item_content, ENT_QUOTES);
$fixed_string = str_replace($searchit, $replaceit, $fixed_string);        
$fixed_string2 = htmlspecialchars($item_title, ENT_QUOTES);
$fixed_string2 = str_replace($searchit, $replaceit, $fixed_string2);
$item_title2 = mysql_real_escape_string($fixed_string2);
$item_title2 = str_replace(" ","-",$item_title2);
$item_title2 = str_replace(".com","",$item_title2);
$item_title2 = str_replace(".net","",$item_title2);
$item_title2 = str_replace(".org","",$item_title2);
$item_title2 = str_replace(".co.uk","",$item_title2);
$item_title2 = str_replace(".","",$item_title2);
$item_title2 = str_replace(",","",$item_title2);
$item_title2 = str_replace("/","",$item_title2);
$item_title2 = str_replace("?","",$item_title2);
$item_content2 = mysql_real_escape_string($fixed_string);

        
    
//    $item_date  = date("Y-m-j", strtotime($RSSitem->pubDate));
        
$item_date = date('Y-m-d H:i:s', strtotime($RSSitem->pubDate));
    
//    $item_date = $RSSitem->pubDate;
        
$iso8601 = date('c', strtotime($RSSitem->pubDate));
        
$item_url    = $RSSitem->link;

    if (
preg_match_all('/<img[^>]+>/i',$item_content, $matches)) {
    if (
strpos($item_content,'height="1"') !== false) {
    
$aticleimage = '';
    
$item_status = '1';
} else if (
strpos($item_content,'height="1px"') !== false) {
    
$aticleimage = '';
    
$item_status = '1';
} else {
    
$aticleimage = $matches[0][0];
    
$item_status = '1';
    }
    } else {
    
$aticleimage = '';
    
$item_status = '1';
    }
        
        echo 
"Processing item '" , $item_id , "' on " , $fetch_date     , "<br/>";
        echo 
$item_title, " - ";
        echo 
$item_date, "<br/>";
        echo 
$item_url, "<br/>";

        
$querytitleexists = mysql_query("SELECT * FROM rssarticles WHERE item_title='$item_title'");
$querytitleexistsurl = mysql_query("SELECT * FROM rssarticles WHERE item_url='$item_url'");
$item_exists = mysql_query("SELECT * FROM rssarticles where item_id = '$item_id'");

    
        
        if(
mysql_num_rows($item_exists) == 0)
        {
        echo 
"<font color=green>Inserting new item..</font><br/>";
        
mysql_query("INSERT INTO rssarticles (item_id, feed_url, item_content, item_title, item_date, item_url, item_image, item_status, item_category_id) VALUES('$item_id', '$feed_url', '$item_content2','$item_title2', '$iso8601', '$item_url', '$aticleimage', '$item_status', '$category')");
        
        }
        else
        {
            echo 
"<font color=blue>Article Already Exists</font><br/>";
        }

        echo 
"<br/>";
    }
echo 
'FINISHED - Waiting for next item...';
$newdate = date("c");
mysql_query("UPDATE feeds set lastupdate='$newdate' WHERE id='$feedid'");
}
                  
?>
                    </div>
                                 
                  
                </div>      
                </div>   
                </div>
            </div>
            <hr>
            <footer>
                <p>&copy; GroupPiex 2013</p>
            </footer>
        </div>
        <!--/.fluid-container-->
        <script src="vendors/jquery-1.9.1.min.js"></script>
        <script src="bootstrap/js/bootstrap.min.js"></script>
        <script src="assets/scripts.js"></script>
    </body>

</html>
Онлайн: 3
Реклама