Beispiel #1
0
 public static function load()
 {
     global $Settings;
     if (is_array(self::$Modules) && count(self::$Modules)) {
         return;
     }
     // Load the various modules (search for the "tv" subdirectory in case it might
     // find some other "modules" directory, too.
     if (modules_path && modules_path != 'modules_path') {
         foreach (get_sorted_files(modules_path) as $module) {
             if (preg_match('/^_/', $module)) {
                 continue;
             }
             if (!is_dir(modules_path . "/{$module}")) {
                 continue;
             }
             if (!file_exists(modules_path . "/{$module}/init.php")) {
                 continue;
             }
             require_once modules_path . "/{$module}/init.php";
         }
     }
     if (empty($Modules)) {
         tailored_error('no_modules');
     }
     // Sort the modules
     uasort($Modules, 'Modules::by_module_sort');
     self::$Modules = $Modules;
     unset($Modules);
 }
Beispiel #2
0
            }
        }
        if (!isset($_SESSION['upnp_db'])) {
            custom_error("UPnP Database Discovery failed!");
        }
        $db = Database::connect($_SESSION['upnp_db']['name'], $_SESSION['upnp_db']['user'], $_SESSION['upnp_db']['pass'], $_SESSION['upnp_db']['host'], NULL, 'mysql');
    }
    if (!is_object($db)) {
        custom_error("Database connection is not valid!");
    }
    $db->register_global_name('db');
}
// Access denied -- probably means that there is no database
if ($db->errno == 1045) {
    tailored_error('db_access_denied');
}
// We don't need these security risks hanging around taking up memory.
unset($_SERVER['db_name'], $_SERVER['db_login'], $_SERVER['db_password'], $_SERVER['db_server']);
//
//  If there was a database connection error, this will send an email to
//    the administrator, and then present the user with a static page
//    informing them of the trouble.
//
if ($db->error) {
    // Notify the admin that the database is offline!
    if (strstr(error_email, '@')) {
        mail(error_email, 'Database Connection Error', $db->error, 'From:  MythWeb Error <' . error_email . ">\n");
    }
    // Let the user know in a nice way that something's wrong
    tailored_error('site_down');
}
Beispiel #3
0
<?php

/**
 * To attempt to curve the massive amounts of (unintentionally) open mythweb installs, we are attempting to
 * protect the users by having a automatic lockdown if we detect a 'bot' or if it's specifically requested by a user
 *
 * You can disable this feature with the apache env var of MYTHWEB_LOCKDOWN_DISABLE being set to true
 *
 * @license     GPL
 *
 * @package     MythWeb
 *
 **/
if ($_SERVER['MYTHWEB_LOCKDOWN_DISABLE'] != true) {
    if (stristr('bot', $_SERVER['HTTP_USER_AGENT']) !== false || stristr('spider', $_SERVER['HTTP_USER_AGENT']) !== false || stristr('crawler', $_SERVER['HTTP_USER_AGENT']) !== false || stristr('search', $_SERVER['HTTP_USER_AGENT']) !== false || stristr('yahoo', $_SERVER['HTTP_USER_AGENT']) !== false || isset($_GET['TRIGGER_MYTHWEB_LOCKDOWN'])) {
        touch('lockdown');
    }
}
if ($_SERVER['MYTHWEB_LOCKDOWN_DISABLE'] != true && file_exists('lockdown')) {
    tailored_error('lockdown');
}
Beispiel #4
0
 *
 * @package     MythWeb
 *
 **/
// Add a custom include path?
if (!empty($_SERVER['include_path']) && $_SERVER['include_path'] != '.') {
    ini_set('include_path', $_SERVER['include_path'] . PATH_SEPARATOR . ini_get('include_path'));
}
// Path to the MythTV bindings that are now installed by the MythTV package
ini_set('include_path', '/usr/local/share/mythtv/bindings/php/' . PATH_SEPARATOR . '/usr/share/mythtv/bindings/php/' . PATH_SEPARATOR . ini_get('include_path'));
// Init
require_once 'includes/init.php';
// Handle Feed requests
if ($Path[0] == 'rss' || $Path[0] == 'ical') {
    unset($Path[0]);
    $Path = array_values($Path);
}
// Standard module?  Pass along the
if (Modules::getModule($Path[0])) {
    // Add the current module directory to our search path, so modules can
    // define includes, etc.
    ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . modules_path . '/' . $Path[0]);
    // Load the module handler
    require_once 'handler.php';
} elseif ($Path[0] == 'dcss') {
    include_once 'skins/default/' . $Path[1];
} elseif (!empty($Path[0]) && preg_match('/\\w/', $Path[0])) {
    tailored_error('unknown_module');
} else {
    require_once 'modules/welcome.php';
}