Esempio n. 1
0
}
// Load smiliebox JavaScript code and template
if ($_load_smiliebox) {
    $_js_files[] = './js/base/smiliebox.js';
    $template->addVar('smiliebox_tpl', 'display', true);
}
// Load context menu user options template
if ($_load_cm_user_options) {
    $template->addVar('context_menu_user_options', 'display', true);
    $_js_files[] = './js/context_menu_user_options.js';
}
// Add JavaScript files to template
foreach ($_js_files as $file) {
    if (file_exists($file)) {
        $template->addVar('js_files', 'file', $file . '?' . filemtime($file));
        $template->parseTemplate('js_files', 'a');
    }
}
// Add CSS files to template
foreach ($_css_files as $file) {
    if (file_exists($file)) {
        $template->addVar('css_files', 'file', $file . '?' . filemtime($file));
        $template->parseTemplate('css_files', 'a');
    }
}
// Add OnLoad event handlers for BODY element
if (!empty($_body_onload) && is_array($_body_onload)) {
    $template->addVar('main', 'body_onload', implode(' ; ', $_body_onload));
}
// Add "oncontextmenu" handler
$template->addVar('main', 'body_oncontextmenu', PCPIN_DEBUGMODE ? 'return true' : 'return false');
        case 'ban':
        case 'mute':
        case 'unmute':
        case 'ipban':
            // Command can be called by chat administrator only
            $cmd_allowed = $current_user->is_admin === 'y';
            break;
        case 'kick':
            // Command can be called by chat administrator or current room moderator only
            $cmd_allowed = $current_user->is_admin === 'y' || true === $_is_moderator;
            break;
    }
    if (true === $cmd_allowed) {
        $expr = str_replace("\n", '@BR@', str_replace("\r\n", "\n", $expr));
        $tpl->addVars('cmd_help_records', array('cmd' => htmlspecialchars(substr($code, 9)), 'text' => htmlspecialchars($expr)));
        $tpl->parseTemplate('cmd_help_records', 'a');
    }
}
// "Attachment" button
$tpl->addVar('msg_attachment_btn', 'display', !empty($session->_conf_all['msg_attachments_limit']));
// "Leave this room" menu topic
$tpl->addVar('leave_room_link', 'display', empty($session->_conf_all['default_room']));
// "Sounds On/Off" button
$tpl->addVar('invert_sounds_btn', 'display', !empty($session->_conf_all['allow_sounds']));
// "Your profile" menu topic
$tpl->addVar('your_profile_button', 'display', !PCPIN_SLAVE_MODE);
// Room selection
$tpl->addVar('room_selection', 'display', empty($session->_conf_all['default_room']));
// Room background image
if (!empty($background_image)) {
    $tpl->addVar('main', 'room_background_image_url', PCPIN_FORMLINK . '?s_id=' . $session->_s_id . '&b_id=' . $background_image);
$_js_lng[] = 'password_too_short';
$_js_lng[] = 'passwords_not_ident';
// Add global vars to template
foreach ($global_tpl_vars as $key => $val) {
    $tpl->addGlobalVar($key, htmlspecialchars($val));
}
// Add language expressions to template
foreach ($tpl->tpl_vars_plain as $var) {
    if (0 === strpos($var, 'LNG_')) {
        $var = strtolower($var);
        $tpl->addGlobalVar($var, htmlspecialchars($l->g(substr($var, 4))));
    }
}
$tpl->addVar('main', 'login_maxlength', htmlspecialchars($session->_conf_all['login_length_max']));
$tpl->addVar('guest_login', 'display', empty($hide_account_options) && $session->_conf_all['allow_guests']);
$tpl->addVar('account_options', 'display', empty($hide_account_options));
$tpl->addVars('chat_summary', array('display' => !empty($session->_conf_all['display_startup_summary']), 'height' => htmlspecialchars($session->_conf_all['startup_summary_height'])));
if (!empty($direct_login) && !empty($login) && !empty($password)) {
    $tpl->addVars('main', array('login_username' => htmlspecialchars($login), 'login_password' => htmlspecialchars($password)));
    $_body_onload[] = 'doLogin()';
}
// Language selection
if (!empty($session->_conf_all['allow_language_selection']) && !empty($session->_conf_all['login_language_selection'])) {
    $tpl->addVar('language_selection', 'display', true);
    foreach ($languages as $data) {
        $tpl->addVars('language_selection_option', array('id' => htmlspecialchars($data['id']), 'local_name' => htmlspecialchars($data['local_name']), 'selected' => $data['id'] == $l->id ? 'selected="selected"' : ''));
        $tpl->parseTemplate('language_selection_option', 'a');
    }
}
// Display "Register" link
$tpl->addVar('account_options_register', 'display', $session->_conf_all['allow_user_registration']);
// Init template
_pcpin_loadClass('pcpintpl');
$tpl = new PcpinTpl();
$tpl->setBasedir('./tpl');
$tpl->readTemplatesFromFile('./avatar_gallery.tpl');
// Add language expressions to template
foreach ($tpl->tpl_vars_plain as $var) {
    if (0 === strpos($var, 'LNG_')) {
        $var = strtolower($var);
        $tpl->addGlobalVar($var, htmlspecialchars($l->g(substr($var, 4))));
    }
}
// Add global vars to template
foreach ($global_tpl_vars as $key => $val) {
    $tpl->addGlobalVar($key, htmlspecialchars($val));
}
// Add avatars
$tpl->addVar('main', 'header_colspan', htmlspecialchars($session->_conf_all['gallery_avatars_per_row']));
while (count($avatars) % $session->_conf_all['gallery_avatars_per_row'] > 0) {
    $avatars[] = array('id' => 0, 'binaryfile_id' => 0, 'width' => 0, 'height' => 0);
}
$col = 0;
foreach ($avatars as $avatar_data) {
    $tpl->addVars('avatar_gallery_col', array('id' => htmlspecialchars($avatar_data['id']), 'binaryfile_id' => htmlspecialchars($avatar_data['binaryfile_id'])));
    $tpl->parseTemplate('avatar_gallery_col', 'a');
    if (++$col == $session->_conf_all['gallery_avatars_per_row']) {
        $tpl->parseTemplate('avatar_gallery_row', 'a');
        $tpl->clearTemplate('avatar_gallery_col');
        $col = 0;
    }
}