$dom; $input; $root; $host; $links; $ds; $categoryid; $logService; $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'];
function getThreadForPost($postid) { global $conf; require_once '..\\d4server\\nodemanager_data_service.php'; // $d4s= new D4DataService($conf['d4dsn'], $conf['d4dbname'], $conf['d4dbpassword'], array(PDO::ATTR_PERSISTENT => false)); $nmDataService = new NodemanagerDataService($conf['d4nmdsn'], $conf['d4nmdbname'], $conf['d4nmdbpassword'], array(PDO::ATTR_PERSISTENT => false)); $thread_url = $nmDataService->findThreadURLForPost($postid); global $ds; $topic = $ds->getThreadByUrl($thread_url); if ($topic) { echo json_encode(array("success" => true, "topic" => $topic)); } else { echo json_encode(array("success" => false, "msg" => 'Thread does not exist on the server', "topic" => '')); } }
} if (isset($_COOKIE['identity'])) { $global_identity = $_COOKIE['identity']; } $anon = 0; if (empty($global_identity)) { if (isset($_COOKIE['anon_identity'])) { $global_identity = $_COOKIE['anon_identity']; $anon = 1; } } $global_nodeid = 1; if (isset($_COOKIE['nodeid'])) { $global_nodeid = $_COOKIE['nodeid']; } $nmDataService = new NodemanagerDataService($conf['dsn'], $conf['dbname'], $conf['dbpassword'], array(PDO::ATTR_PERSISTENT => false)); $um = new UserManager($nmDataService); $param = ""; $environment = $nmDataService->getEnvironment(); if ($forumname) { $logService->log('D4TRACE', 'LANDING forumname ', var_log($forumname, '$forumname'), ''); if ($task && $task == 'start_account') { $fid = $nmDataService->getForumIdByName($forumname); $nmDataService->configureForumApp($fid); // this will make sure that the app is private, not preview } $keys = $nmDataService->getDisqusApp($forumname); if ($keys) { $logService->log('D4TRACE', 'LANDING found app ', var_log($forumname, '$forumname'), ''); $environment['public_key'] = $keys['public_key']; $environment['secret_key'] = $keys['secret_key'];
if (isset($_GET['iu'])) { $iu = $_GET['iu']; if ($iu == 'null') { $iu = null; } } if (isset($_GET['iu'])) { $iu = $_GET['iu']; if ($iu == 'null') { $iu = null; } } $view = 0; //done with views $logService = new LogDataService($d4conf['logdsn'], $d4conf['logdbname'], $d4conf['logdbpassword'], array(PDO::ATTR_PERSISTENT => false)); $nmDataService = new NodemanagerDataService($d4conf['dsn'], $d4conf['dbname'], $d4conf['dbpassword'], array(PDO::ATTR_PERSISTENT => false)); $t = microtime(TRUE) * 1000000; try { $environment = $nmDataService->getEnvironment(); /** 4/9/2015 Multi-app support **/ //get the keys from the correct disqus app: if ($forumname) { // $logService->log('TRACE','API forumname ',var_log($forumname,'$forumname'),''); $keys = $nmDataService->getDisqusApp($forumname); if ($keys) { // $logService->log('TRACE','API found app ',var_log($forumname,'$forumname'),''); $environment['public_key'] = $keys['public_key']; $environment['secret_key'] = $keys['secret_key']; } else {