public static function init()
 {
     pts_core::init();
     if (defined('QUICK_START') && QUICK_START) {
         return true;
     }
     if (function_exists('cli_set_process_title') && PHP_OS == 'Linux') {
         cli_set_process_title('Phoronix Test Suite');
     }
     pts_define('PHP_BIN', pts_client::read_env('PHP_BIN'));
     $dir_init = array(PTS_USER_PATH);
     foreach ($dir_init as $dir) {
         pts_file_io::mkdir($dir);
     }
     if (PTS_IS_CLIENT) {
         pts_network::client_startup();
     }
     self::core_storage_init_process();
     if (!is_file(PTS_TEMP_STORAGE)) {
         self::build_temp_cache();
     }
     pts_define('PTS_TEST_INSTALL_DEFAULT_PATH', pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/EnvironmentDirectory', '~/.phoronix-test-suite/installed-tests/')));
     pts_define('PTS_SAVE_RESULTS_PATH', pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Testing/ResultsDirectory', '~/.phoronix-test-suite/test-results/')));
     self::extended_init_process();
     $openbenchmarking = pts_storage_object::read_from_file(PTS_CORE_STORAGE, 'openbenchmarking');
     $openbenchmarking_account_settings = pts_storage_object::read_from_file(PTS_CORE_STORAGE, 'openbenchmarking_account_settings');
     if ($openbenchmarking != null) {
         // OpenBenchmarking.org Account
         pts_openbenchmarking_client::init_account($openbenchmarking, $openbenchmarking_account_settings);
     }
     return true;
 }
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// INIT
define('PHOROMATIC_SERVER', true);
//ini_set('memory_limit', '64M');
define('PTS_MODE', 'WEB_CLIENT');
define('PTS_AUTO_LOAD_OBJECTS', true);
//error_reporting(E_ALL);
include '../../pts-core.php';
pts_core::init();
if (isset($_GET['index'])) {
    $requested_repo = str_replace(array('..', '/'), null, $_GET['repo']);
    $repo_index = pts_openbenchmarking::read_repository_index($requested_repo, false);
    echo $repo_index;
    pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' downloaded a copy of the ' . $requested_repo . ' OpenBenchmarking.org repository index');
} else {
    if (isset($_GET['repos'])) {
        $index_files = pts_file_io::glob(PTS_OPENBENCHMARKING_SCRATCH_PATH . '*.index');
        $json_repos = array();
        foreach ($index_files as $index_file) {
            $index_data = json_decode(file_get_contents($index_file), true);
            $json_repos['repos'][basename($index_file, '.index')] = array('title' => basename($index_file, '.index'), 'generated' => $index_data['main']['generated']);
        }
        echo json_encode($json_repos);
    } else {
function phoromatic_init_web_page_setup()
{
    if (session_save_path() == null) {
        // This is needed since on at least EL6 by default there is no session_save_path set
        if (is_writable('/var/lib/php') && is_dir('/var/lib/php')) {
            session_save_path('/var/lib/php');
        } else {
            if (is_writable('/var/lib/php5') && is_dir('/var/lib/php5')) {
                session_save_path('/var/lib/php5');
            } else {
                session_save_path('/tmp');
            }
        }
    }
    define('PHOROMATIC_SERVER', true);
    if (PTS_IS_DEV_BUILD) {
        error_reporting(E_ALL);
    }
    session_start();
    define('PTS_MODE', 'WEB_CLIENT');
    define('PTS_AUTO_LOAD_OBJECTS', true);
    define('PHOROMATIC_USER_IS_VIEWER', !isset($_SESSION['AdminLevel']) || $_SESSION['AdminLevel'] >= 10 || $_SESSION['AdminLevel'] < 1 ? true : false);
    include '../../pts-core.php';
    pts_core::init();
}