Пример #1
0
 /**
  * Create the database connection
  * @see ssciDatabase::__construct()
  */
 function __construct()
 {
     global $SSC_SETTINGS;
     // Check if mysqli is available
     if (!function_exists('mysqli_connect')) {
         ssc_die(array('title' => 'Installation Error', 'body' => 'The MySQLI interface for PHP is not available'));
         return;
     }
     // Perform connection
     $this->link = new mysqli($SSC_SETTINGS['db-host'], $SSC_SETTINGS['db-user'], $SSC_SETTINGS['db-password'], $SSC_SETTINGS['db-database'], $SSC_SETTINGS['db-port']);
 }
Пример #2
0
/**
 * Loads up the specified theme for usage
 * @param string $theme Theme 'folder' name to be loaded
 * @return array Array containing the theme's .info data
 */
function theme_get_info($theme = null)
{
    global $ssc_site_path, $ssc_site_url;
    static $info = null;
    if ($theme) {
        // Get the theme data
        $info = ssc_parse_ini_file('theme', "{$ssc_site_path}/themes/{$theme}/{$theme}.info");
        if (!$info) {
            ssc_die(array('title' => 'Invalid Theme', 'body' => 'The selected theme is borked'));
        }
        if (isset($info['js']) && is_array($info['js'])) {
            foreach ($info['js'] as $path) {
                ssc_add_js("/themes/{$theme}/{$path}");
            }
        }
        if (isset($info['css']) && is_array($info['css'])) {
            foreach ($info['css'] as $path) {
                $tmp = explode("#", $path);
                ssc_add_css("/themes/{$theme}/{$tmp['0']}", $tmp[1]);
            }
        }
    }
    return $info;
}
Пример #3
0
/**
 * Start the display of the page by booting up the theme
 */
function ssc_frontend_init()
{
    global $SSC_SETTINGS, $ssc_site_path, $ssc_database;
    // Include the language file
    $file = "{$ssc_site_path}/lang/" . $SSC_SETTINGS['lang']['tag'] . ".inc.php";
    if (file_exists($file)) {
        require_once $file;
    } else {
        ssc_die(array('title' => 'Bad language', 'body' => "Language '" . $SSC_SETTINGS['lang']['tag'] . "' is currently not installed"));
    }
    // Set up the theme
    require_once "{$ssc_site_path}/includes/core.theme.inc.php";
    $theme = ssc_var_get('theme_default', SSC_DEFAULT_THEME);
    $file = "{$ssc_site_path}/themes/{$theme}/{$theme}.";
    if (!file_exists($file . 'theme.php') && !file_exists($file . 'info')) {
        ssc_die(array('title' => 'Bad theme', 'body' => 'Specified theme ' . $theme . ' is not installed'));
    }
    theme_get_info($theme);
    ssc_add_js("/includes/core.js");
}