Esempio n. 1
0
 /**
  * Process the archives found in the incoming folders
  * 
  * @param string $detection
  * @param string $type
  * @param bool $help
  * @param bool $clearlock
  * @return void 
  */
 public function actionProcess($detection = '', $type = '', $help = false, $clearlock = false)
 {
     if (!in_array($detection, array('', 'detected', 'clean'))) {
         $help = true;
     }
     if (!in_array($type, array('', 'daily', 'monthly', 'bogus', 'url'))) {
         $help = true;
     }
     if ($help) {
         echo "\r\nUSAGE EXAMPLE:\r\n    archives process                                        // extracts all files from all archives\r\n    archives process --type=daily                           // extracts all files from daily archives (both detected and clean)\r\n    archives process --detection=clean --type=monthly       // extracts all files from clean monthly archives\r\n\r\nOPTIONS:\r\n    detection = [clean|detected]\r\n    type = [daily|monthly|bogus|url]\r\n";
         die;
     }
     if (!$this->handleFolderLock(VIREX_INCOMING_PATH, $clearlock)) {
         return;
     }
     $this->pending_actions();
     $errors_count = 0;
     if ($detection) {
         $dees = array($detection);
     } else {
         $dees = array('detected', 'clean');
     }
     if ($type) {
         $tees = array($type);
     } else {
         $tees = array('daily', 'monthly', 'url', 'bogus');
     }
     $archiver = new AFileArchive();
     $urchiver = new AUrlArchive();
     foreach ($tees as $tee) {
         foreach ($dees as $dee) {
             if ($tee == 'url') {
                 $files = $urchiver->return_all();
             }
             if (in_array($tee, array('daily', 'monthly'))) {
                 $files = $archiver->process_archives($dee, $tee);
                 $this->show_files($files, ucfirst($tee) . ' ' . $dee);
             }
         }
     }
     $this->actionSendemails();
     ALogger::end_step();
     $this->clearLock(VIREX_INCOMING_PATH);
 }
Esempio n. 2
0
 public function actionUrls()
 {
     if (isset($_POST['interval'])) {
         $_SESSION['interval_start'] = $_POST['interval_start'] . ' 00:00:00';
         $_SESSION['interval_end'] = $_POST['interval_end'] . ' 23:59:59';
     } elseif (isset($_POST['interval_reset'])) {
         unset($_SESSION['interval_start']);
         unset($_SESSION['interval_end']);
     }
     if (isset($_POST['add'])) {
         $urlScanner = new AUrlArchive();
         $urlScanner->add_new();
     }
     $action = isset($_GET['action']) ? $_GET['action'] : false;
     if ($action == 'delete') {
         Url::model()->deleteByPk($_GET['idf']);
         die;
     } elseif ($action == 'enable') {
         Yii::app()->db->createCommand("UPDATE urls_url SET enabled_url=1 WHERE id_url=" . (int) $_GET['idf'])->execute();
     } elseif ($action == 'disable') {
         Yii::app()->db->createCommand("UPDATE urls_url SET enabled_url=0 WHERE id_url=" . (int) $_GET['idf'])->execute();
     }
     $model = new Url('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Url'])) {
         $model->attributes = $_GET['Url'];
     }
     $this->render('urls', array('model' => $model));
 }