function mozBookmarkDump(){ $parsed = array(); $file = "/home/eljimbo/www/socialsoop/controller/bookmarks.html"; $input = fopen($file, "r"); $line = ""; echo "Begin mozBookmark: " . memory_get_usage() . "
"; while(!feof($input)){ // Is it a link line? $dt = strpos($line, '
', $stop); for($j=$stop;$j>0;$j--){ if($line[$j] == ">"){ $j++; array_push(&$entry, substr($line, $j, $stop-$j)); break; } } // Check if description $line = fgets($input); // GOTO next line $dd = strpos($line, '
'); if($dd !== false){ $dd = $dd + 4; $dsc = substr($line, $dd, strlen($line)-4); array_push(&$entry, $dsc); } // Save entry array_push(&$parsed, $entry); } else { // GOTO nextline $line = fgets($input); } } fclose($input); unset($file); unset($line); unset($entry); // See if its an article or blog echo "End mozBookmark: " . memory_get_usage() . "
"; enterMassData($parsed); } // function enterMassData(){ function enterMassData($parsed){ echo "Begin enterMassData: " . memory_get_usage() . "
"; //require_once(HELPERS . 'Sanitize.php'); require_once(DTOS . 'Blogs_dto.class.php'); require_once(HELPERS . 'Simplepie.inc.php'); require_once(MODEL . 'Items.inc.php'); /* $parsed = array(array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description'), array('www.google.com', 'Google', 'some description') ); */ session(); $userId = $_SESSION['user']['id']; $undecided = array(); $feed = new SimplePie(); $feed->set_cache_location(HELPERS.'cache'); $feed->set_stupidly_fast(true); $itemDb = new Items(); $dto = new Blogs_dto(array( 'url'=>'', 'name'=>'', 'rss_url'=>'', 'description'=>'' )); // Determine if its article or blog foreach($parsed as $entry) { echo "loop - " . ": " . memory_get_usage() . "
"; // Check for a feed $feed->set_feed_url($entry[0]); $feed->init(); $feed->handle_content_type(); //$feed->handle_content_type(); $rss= $feed->subscribe_url(); // Check databases $dto->data['url']=$entry[0]; $dto->data['name']=$entry[1]; $dto->data['rss_url']=$rss; $dto->data['description']=$entry[2]; echo $entry[1] . " - "; $rs = $itemDb->selectItemsAll($dto); // echo $row[0] . " - " . $row[1] . " - "; // return; if($rs == false){ // Not in the database if(strlen($rss) < 5){ // If no feed, must be article //addArticle($dto); echo "addarticle
"; } else { // Anyones guess? echo "anyoneguess
"; array_push(&$undecided, $entry); } } else { // In the database $row = $rs->FetchRow(); echo $row[0] . " - "; if( $row != false){ // subscribe user //addUserToItem($row[0], $userId); echo "insystem
"; } } } print_r($undecided); return; }