/** * @return array * @throws Exception */ function analyzeModels() { $excludedFiles = ['DataMapper', 'DataMapperException']; $filesInDirectory = getFilesInDirectory($this->modelDirectory, ".php"); $knownClasses = []; foreach ($filesInDirectory as $name => $object) { $skip = false; foreach ($excludedFiles as $excludedFile) { if (strpos($name, $excludedFile) !== false) { $skip = true; } } if ($skip == true) { continue; } if (!$object instanceof \SplFileInfo) { throw new \Exception("Trying to analyze something that is not a file."); } $className = 'GithubService\\Model\\' . $object->getBasename(".php"); $signature = getClassSignature($className); if ($signature) { $this->knownClasses[$className] = $signature; } } return $knownClasses; }
return array_diff(scandir($dir), array('.', '..')); } // Serve a random banner and exit. function serveRandomBanner($dir, $files) { $name = $files[array_rand($files)]; // snags the extension $ext = pathinfo($name, PATHINFO_EXTENSION); // send the right headers header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1 header('Pragma: no-cache'); // HTTP 1.0 header('Expires: 0'); // Proxies header("Content-type: image/" . ext); header("Content-Disposition: inline; filename=" . $name); // readfile displays the image, passthru seems to spits stream. readfile($dir . $name); exit; } // Get all the banners $bannerDir = "banners/"; $priorityDir = "banners_priority/"; $banners = getFilesInDirectory($bannerDir); $priority = getFilesInDirectory($priorityDir); // If there are priority banners, serve 1/3rd of the time. if ($priority !== null && count($priority) !== 0 && rand(0, 2) === 0) { serveRandomBanner($priorityDir, $priority); } serveRandomBanner($bannerDir, $banners);
$oTpl->set('s', 'LABEL_START_BACKUP', i18n("Start a new backup", $plugin_name)); $oTpl->set('s', 'LABEL_PREVIOUS_BACKUPS', i18n("Created backups", $plugin_name)); $aFiles = getFilesInDirectory($backup_path, '*.sql*', SORT_DESC); for ($i = 0, $n = count($aFiles); $i < $n; $i++) { $oTpl->set('d', 'NO', $i + 1); $oTpl->set('d', 'FILENAME', $aFiles[$i]); $oTpl->set('d', 'FILESIZE', number_format(filesize($backup_path . $aFiles[$i]) / 1024 / 1024, 2)); $oTpl->set('d', 'LINK_DELETE', $sess->url('main.php?area=' . $plugin_name . '&frame=4&mode=0&action=3&file=' . $aFiles[$i])); $oTpl->set('d', 'LABEL_DELETE', '<img src="images/delete.gif" alt="X" title="' . i18n("Delete") . '" />'); $oTpl->next(); } $oTpl->generate($cfg[$plugin_name]['templates']['backup']); break; case 1: $oTpl->set('s', 'LABEL_RESTORE', i18n("Restore", $plugin_name)); $aFiles = getFilesInDirectory($backup_path, '*.sql*', SORT_DESC); for ($i = 0, $n = count($aFiles); $i < $n; $i++) { $oTpl->set('d', 'NO', $i + 1); $oTpl->set('d', 'FILENAME', $aFiles[$i]); $oTpl->set('d', 'FILESIZE', number_format(filesize($backup_path . $aFiles[$i]) / 1024 / 1024, 2)); $oTpl->set('d', 'LINK_RESTORE', $sess->url('main.php?area=' . $plugin_name . '&frame=4&mode=1&action=2&file=' . $aFiles[$i])); $oTpl->set('d', 'LABEL_RESTORE', '<img src="images/importieren.gif" alt="X" title="' . i18n("Restore") . '" />'); $oTpl->next(); } $oTpl->generate($cfg[$plugin_name]['templates']['restore']); break; default: $sMsg = ''; break; } }