Exemplo n.º 1
0
 public function scandir()
 {
     if (isset($_POST) && !empty($_POST)) {
         $file = $_POST['pushFile'];
         foreach ($file as $item) {
             if ($item != '//errorlog.html') {
                 $file_path[] = BASE_PATH . DS . 'app' . $item;
             }
         }
         $destination = BASE_PATH . DS . 'app' . DS . 'templates' . DS . 'push' . DS . 'update.zip';
         $folderpath = BASE_PATH . DS . 'app' . DS;
         $zip = \helpers\document::zip($folderpath, $destination, $file_path, true);
     }
     $scanner = new \helpers\scanner();
     $config = $scanner->get_config();
     $original_cwd = getcwd();
     if (isset($config['start_dir'])) {
         chdir($config['start_dir']);
     }
     $results = $scanner->scan();
     if ($results) {
         $this->data['report'] = 'Scan Results - For ' . $results['current_scan'] . "<br>";
         unset($results['current_scan']);
         $count = count($results['Changed']) + count($results['Added']) + count($results['Deleted']);
         foreach ($results as $key => $entries) {
             $this->data['report'] .= $key . "<br>";
             foreach ($entries as $entry) {
                 $pushFile = ltrim($entry, '.');
                 $this->data['report'] .= '<input type="checkbox" class="checkbox1" name="pushFile[]" value="' . $pushFile . '" > ' . $pushFile . "<br>";
             }
             $this->data['report'] .= "<br>";
         }
     }
     chdir($original_cwd);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('update/push.index', $this->data);
     View::rendertemplate('footer', $this->data);
 }