Ejemplo n.º 1
0
 */
if (is_logged_in() && $current_User->get('locale') != $current_locale && !$locale_from_get) {
    // change locale to users preference
    /*
     * User locale selection:
     * TODO: this should get done before instantiating $current_User, because we already use T_() there...
     */
    locale_activate($current_User->get('locale'));
    if ($current_locale == $current_User->get('locale')) {
        $default_locale = $current_locale;
        $Debuglog->add('default_locale from user profile: ' . $default_locale, 'locale');
    } else {
        $Debuglog->add('locale from user profile could not be activated: ' . $current_User->get('locale'), 'locale');
    }
}
// Init charset handling:
init_charsets($current_charset);
// Display login errors (and form). This uses $io_charset, so it's at the end.
if ($Messages->count('login_error')) {
    require $htsrv_path . 'login.php';
    exit;
}
$Timer->pause('_main.inc');
/**
 * Load hacks file if it exists
 */
if (file_exists($conf_path . 'hacks.php')) {
    $Timer->resume('hacks.php');
    include_once $conf_path . 'hacks.php';
    $Timer->pause('hacks.php');
}
Ejemplo n.º 2
0
/**
 * Activate the blog locale and the corresponding charset
 *
 * @param integer the blog Id
 */
function activate_blog_locale($blog)
{
    global $current_charset;
    if (empty($blog) || $blog <= 0) {
        // $blog is not a valid blog ID
        return;
    }
    $BlogCache =& get_BlogCache();
    $Blog = $BlogCache->get_by_ID($blog, false, false);
    if (!empty($Blog)) {
        // Activate the blog locale
        locale_activate($Blog->get('locale'));
        // Re-Init charset handling, in case current_charset has changed:
        init_charsets($current_charset);
    }
}
Ejemplo n.º 3
0
param('comment_type', 'string', 'feedback');
param('redirect_to', 'url', '');
param('reply_ID', 'integer', 0);
// Only logged in users can post the meta comments
$comment_type = is_logged_in() ? $comment_type : 'feedback';
$action = param_arrayindex('submit_comment_post_' . $comment_item_ID, 'save');
$ItemCache =& get_ItemCache();
$commented_Item =& $ItemCache->get_by_ID($comment_item_ID);
// Make sure Blog is loaded
$commented_Item->load_Blog();
$blog = $commented_Item->Blog->ID;
// Initialize global $Blog to avoid restriction of redirect to external URL, for example, when collection URL is subdomain:
$Blog = $commented_Item->Blog;
// Re-Init charset handling, in case current_charset has changed:
locale_activate($commented_Item->Blog->get('locale'));
if (init_charsets($current_charset)) {
    // Reload Blog(s) (for encoding of name, tagline etc):
    $BlogCache->clear();
    $commented_Item->load_Blog();
}
header('Content-Type: text/html; charset=' . $io_charset);
if ($Settings->get('system_lock')) {
    // System is locked for maintenance, users cannot send a comment
    $Messages->add(T_('You cannot leave a comment at this time because the system is under maintenance. Please try again in a few moments.'), 'error');
    header_redirect();
    // Will save $Messages into Session
}
// Check user permissions to post this comment:
if ($comment_type == 'meta') {
    // Meta comment
    if (!$current_User->check_perm('meta_comment', 'view', false, $commented_Item)) {
Ejemplo n.º 4
0
/**
 * TODO: not sure, if we should really load everything. We'd need at least
 *       to define EVO_MAIN_INIT to load single class files, ...
 */
define('EVO_MAIN_INIT', 'SIMPLETEST');
require_once EVODIR . 'blogs/conf/_config.php';
require_once $inc_path . '_core/_class' . floor(PHP_VERSION) . '.funcs.php';
require_once $inc_path . '_core/_misc.funcs.php';
require_once $inc_path . 'locales/_locale.funcs.php';
// Load vars, e.g. $is_cli
// TODO: this should get done in EvoUnitTestCase::setup (clean state), but needs global massaging.
load_class('_core/model/_log.class.php', 'Log_noop');
$Debuglog = new Log_noop();
require_once $inc_path . '_main.inc.php';
// Bootstrap charset handling (e.g. setting $io_charset)
init_charsets('utf-8');
load_class('_core/model/_module.class.php', 'Module');
foreach ($modules as $module) {
    require_once $inc_path . $module . '/_' . $module . '.init.php';
}
/**
 * MySQL settings for the tests.
 *
 * These settings override the defaults from {@link $db_config}
 *
 * This is used to create {@link EvoDbUnitTestCase::test_DB the test DB object}
 * in the class {@link EvoDbUnitTestCase}, which gets used for tests that
 * need a real database connection.
 *
 * @global array $testDB_conf
 */