Exemplo n.º 1
0
require_once YOURLS_INC . '/functions-compat.php';
require_once YOURLS_INC . '/functions-html.php';
require_once YOURLS_INC . '/functions-http.php';
require_once YOURLS_INC . '/functions-infos.php';
// Load auth functions if needed
if (yourls_is_private()) {
    require_once YOURLS_INC . '/functions-auth.php';
}
// Load locale
yourls_load_default_textdomain();
// Check if we are in maintenance mode - if yes, it will die here.
yourls_check_maintenance_mode();
// Fix REQUEST_URI for IIS
yourls_fix_request_uri();
// If request for an admin page is http:// and SSL is required, redirect
if (yourls_is_admin() && yourls_needs_ssl() && !yourls_is_ssl()) {
    if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
        yourls_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
        exit;
    } else {
        yourls_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
        exit;
    }
}
// Create the YOURLS object $ydb that will contain everything we globally need
global $ydb;
// Allow drop-in replacement for the DB engine
if (file_exists(YOURLS_USERDIR . '/db.php')) {
    require_once YOURLS_USERDIR . '/db.php';
} else {
    require_once YOURLS_INC . '/class-mysql.php';
Exemplo n.º 2
0
/**
 * Return admin link, with SSL preference if applicable.
 *
 */
function yourls_admin_url($page = '')
{
    $admin = YOURLS_SITE . '/admin/' . $page;
    if (yourls_is_ssl() or yourls_needs_ssl()) {
        $admin = yourls_set_url_scheme($admin, 'https');
    }
    return yourls_apply_filter('admin_url', $admin, $page);
}
Exemplo n.º 3
0
/**
 * Return the URL of the directory a plugin
 */
function yourls_plugin_url($file)
{
    $url = YOURLS_PLUGINURL . '/' . yourls_plugin_basename($file);
    if (yourls_is_ssl() or yourls_needs_ssl()) {
        $url = str_replace('http://', 'https://', $url);
    }
    return yourls_apply_filter('plugin_url', $url, $file);
}
Exemplo n.º 4
0
/**
 * Return admin link, with SSL preference if applicable.
 *
 */
function yourls_admin_url($page = '')
{
    $admin = YOURLS_SITE . '/admin/' . $page;
    if (yourls_is_ssl() or yourls_needs_ssl()) {
        $admin = str_replace('http://', 'https://', $admin);
    }
    return yourls_apply_filter('admin_url', $admin, $page);
}