function showAuditorProjects($info = "")
 {
     $userId = isLoggedIn();
     if (isAdmin()) {
         $sql = "select ap.*,w.name,u.username from websites w,users u,auditorprojects ap where ap.website_id=w.id and u.id=w.user_id";
         $sql .= empty($info['userid']) ? "" : " and w.user_id=" . $info['userid'];
         $sql .= " order by ap.score DESC,ap.id";
         $this->set('isAdmin', 1);
         $userCtrler = new UserController();
         $userList = $userCtrler->__getAllUsers();
         $this->set('userList', $userList);
     } else {
         $sql = "select w.name,ap.* from websites w, auditorprojects ap where ap.website_id=w.id and user_id={$userId} order by ap.id";
     }
     $this->set('userId', empty($info['userid']) ? 0 : $info['userid']);
     # pagination setup
     $this->db->query($sql, true);
     $this->paging->setDivClass('pagingdiv');
     $this->paging->loadPaging($this->db->noRows, SP_PAGINGNO);
     $pagingDiv = $this->paging->printPages('siteauditor.php?userid=' . $info['userid']);
     $this->set('pagingDiv', $pagingDiv);
     $sql .= " limit " . $this->paging->start . "," . $this->paging->per_page;
     $projectList = $this->db->select($sql);
     foreach ($projectList as $i => $projectInfo) {
         $projectList[$i]['total_links'] = $this->getCountcrawledLinks($projectInfo['id']);
         $projectList[$i]['crawled_links'] = $this->getCountcrawledLinks($projectInfo['id'], true);
         $projectList[$i]['last_updated'] = $this->getProjectLastUpdate($projectInfo['id']);
     }
     $this->set('pageNo', $info['pageno']);
     $this->set('list', $projectList);
     $this->render('siteauditor/list');
 }
Esempio n. 2
0
 function executeCron($includeList = array())
 {
     $this->loadCronJobTools($includeList);
     $lastGenerated = date('Y-m-d 00:00:00');
     $userCtrler = new UserController();
     $userList = $userCtrler->__getAllUsers();
     foreach ($userList as $userInfo) {
         // create report controller
         $reportCtrler = new ReportController();
         $lastGenerated = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
         // check for user report schedule
         $repSetInfo = $reportCtrler->isGenerateReportsForUser($userInfo['id']);
         if (!empty($repSetInfo['generate_report'])) {
             $websiteCtrler = new WebsiteController();
             $websiteList = $websiteCtrler->__getAllWebsites($userInfo['id']);
             // if websites are available
             if (count($websiteList) > 0) {
                 foreach ($websiteList as $websiteInfo) {
                     $this->websiteInfo = $websiteInfo;
                     $this->routeCronJob($websiteInfo['id'], '', true);
                 }
                 // save report generated time
                 $reportCtrler->updateUserReportSetting($userInfo['id'], 'last_generated', $lastGenerated);
                 // send email notification if enabled
                 if (SP_REPORT_EMAIL_NOTIFICATION && $repSetInfo['email_notification']) {
                     $reportCtrler->sentEmailNotificationForReportGen($userInfo, $repSetInfo['last_generated'], $lastGenerated);
                 }
             }
         }
     }
 }
Esempio n. 3
0
 function editWebsite($websiteId, $listInfo = '')
 {
     $websiteId = intval($websiteId);
     if (!empty($websiteId)) {
         if (empty($listInfo)) {
             $listInfo = $this->__getWebsiteInfo($websiteId);
             $listInfo['oldName'] = $listInfo['name'];
         }
         $listInfo['title'] = stripslashes($listInfo['title']);
         $listInfo['description'] = stripslashes($listInfo['description']);
         $listInfo['keywords'] = stripslashes($listInfo['keywords']);
         $this->set('post', $listInfo);
         # get all users
         if (isAdmin()) {
             $userCtrler = new UserController();
             $userList = $userCtrler->__getAllUsers();
             $this->set('userList', $userList);
             $this->set('isAdmin', 1);
         }
         $this->render('website/edit');
         exit;
     }
     $this->listWebsites();
 }
Esempio n. 4
0
 function showReportsScheduler($success = false, $postInfo = '')
 {
     $userId = isLoggedIn();
     if (isAdmin()) {
         $userId = empty($postInfo['user_id']) ? $userId : $postInfo['user_id'];
     }
     $repSetInfo = $this->getUserReportSettings($userId);
     $this->set('repSetInfo', $repSetInfo);
     $reportInterval = !isset($postInfo['report_interval']) ? $repSetInfo['report_interval'] : $postInfo['report_interval'];
     $this->set('reportInterval', $reportInterval);
     if ($reportInterval == 30) {
         $nextGenTime = mktime(0, 0, 0, date('m') + 1, 1, date('Y'));
     } else {
         $nextGenTime = $repSetInfo['last_generated'] + $repSetInfo['report_interval'] * 86400;
     }
     $this->set('nextReportTime', date('d M Y', $nextGenTime));
     $scheduleList = array(1 => $_SESSION['text']['label']['Daily'], 2 => $this->spTextReport['2 Days'], 7 => $_SESSION['text']['label']['Weekly'], 30 => $_SESSION['text']['label']['Monthly']);
     $userCtrler = new UserController();
     $userList = $userCtrler->__getAllUsers();
     $this->set('userList', $userList);
     $this->set('success', $success);
     $this->set('scheduleList', $scheduleList);
     $this->render('report/reportscheduler');
 }
Esempio n. 5
0
 function executeCron($includeList = array())
 {
     $this->loadCronJobTools($includeList);
     $userCtrler = new UserController();
     $userList = $userCtrler->__getAllUsers();
     $websiteCtrler = new WebsiteController();
     foreach ($userList as $userInfo) {
         $websiteList = $websiteCtrler->__getAllWebsites($userInfo['id']);
         foreach ($websiteList as $websiteInfo) {
             $this->websiteInfo = $websiteInfo;
             $this->routeCronJob($websiteInfo['id'], '', true);
         }
     }
 }