예제 #1
0
$level;
$start;
$error;
$logService = new LogDataService();
require_once '..\\d4server\\nodemanager_data_service.php';
$ds = new PovDataService($conf['dsn'], $conf['dbname'], $conf['dbpassword'], array(PDO::ATTR_PERSISTENT => false));
//$lastTimestamp=$ds->getD4CrawlerTimestamp();
$nmDataService = new NodemanagerDataService($conf['d4nmdsn'], $conf['d4nmdbname'], $conf['d4nmdbpassword'], array(PDO::ATTR_PERSISTENT => false));
$forums = $ds->getAllForums();
$logService->log('D4CRAWLER', 'Forums length=' . sizeof($forums), var_log($forums, '$forums'), 'd4crawler');
foreach ($forums as $forum) {
    $logService->log('D4CRAWLER', 'Starting forum=' . $forum['forum'], var_log($forum, '$forum'), 'd4crawler');
    $forumid = $forum['forumid'];
    $categoryid = $forum['categoryid'];
    $lastCrawled = $forum['last_crawled'];
    $d4ds = $nmDataService->getForumHubDataService($forumid);
    $threads = $d4ds->getNewThreads($forumid, $lastCrawled);
    $createdat = 0;
    foreach ($threads as $t) {
        $url = $t['url'];
        $exist = $ds->getThreadByUrl($url);
        if (!$exist) {
            $current_createdat = $t['createdat'];
            if ($current_createdat > $createdat) {
                $createdat = $current_createdat;
            }
            libxml_use_internal_errors(true);
            $start = time();
            $logService->log('D4CRAWLER', 'd4crawler new thread forumid=' . $forumid, var_log($url, '$url'), 'd4crawler');
            try {
                @crawl($url, '', '', '', '', '', false);
예제 #2
0
     		                            3/12/2015   -   Need to determine if the user has a role in any of the forums and select the highest available with the most recent post
     
     
     		                        **/
     $unDataService = $nmDataService->getUsernodeDataService($global_nodeid);
     $forumid = $unDataService->getUserViewForum($identity, $view);
     if (!$forumid) {
         $forums = null;
         // an OUT parameter in loadForums (yes,yes, I know)
         $um->loadForums(true, 0, 1000);
         $foundRole = -1;
         $forumid = 0;
         $role = 0;
         foreach ($forums as $forum) {
             $id = $forum['forumid'];
             $hubDS = $nmDataService->getForumHubDataService($id);
             $logService->log('DEBUG', 'Calling updateIdentity', '', 'login');
             $hubDS->updateIdentity($forumid, $global_emailHash, $obj);
             $role = $forum['role'];
             if ($role > $foundRole) {
                 $foundRole = $role;
                 $forumid = $id;
             }
         }
         if ($forumid && $role < 5 && $role >= 0) {
             // do not set if moderator, UI will take care of that. Also do not set if no role - the forum may need preloading
             $control = array('forumid' => 0);
             $um->selectForum($forumid, false);
         }
     }
 }