if (!$download) { message($lang_common['No permission']); } if (($attachment['extension'] == 'jpg' || $attachment['extension'] == 'jpeg' || $attachment['extension'] == 'gif' || $attachment['extension'] == 'png') && !isset($_GET['download'])) { ($hook = get_extensions('attachment_image_view')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_attach['Image view'], $attachment['filename']); define('PANTHER_ALLOW_INDEX', 1); define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; $tpl = load_template('attachment.tpl'); echo $tpl->render(array('lang_attach' => $lang_attach, 'lang_common' => $lang_common, 'name' => $attachment['filename'], 'download_link' => panther_link($panther_url['attachment_download'], array($id)))); require PANTHER_ROOT . 'footer.php'; } $data = array(':id' => $id); $db->run('UPDATE ' . $db->prefix . 'attachments SET downloads=downloads+1 WHERE id=:id', $data); ($hook = get_extensions('attachment_before_output')) ? eval($hook) : null; $db->end_transaction(); $fp = fopen($panther_config['o_attachments_dir'] . $attachment['location'], "rb"); if (!$fp) { message($lang_common['Bad request']); } $attachment['filename'] = rawurlencode($attachment['filename']); // send some headers header('Content-Disposition: attachment; filename=' . $attachment['filename']); if (strlen($attachment['mime']) > 0) { header('Content-Type: ' . $attachment['mime']); } else { header('Content-type: application/octet-stream'); } header('Pragma: no-cache'); header('Expires: 0');
$start_from = $panther_user['disp_posts'] * ($p - 1); ($hook = get_extensions('online_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_online['viewing online']); define('PANTHER_ACTIVE_PAGE', 'online'); require PANTHER_ROOT . 'header.php'; $bots = $online = array(); $ps = $db->run('SELECT o.user_id, o.ident, o.currently, o.logged, u.group_id FROM ' . $db->prefix . 'online AS o INNER JOIN ' . $db->prefix . 'users AS u ON o.user_id=u.id WHERE o.idle=0'); foreach ($ps as $panther_user_online) { if (strpos($panther_user_online['ident'], '[Bot]') !== false) { $name = explode('[Bot]', $panther_user_online['ident']); if (empty($bots[$name[1]])) { $bots[$name[1]] = 1; } else { ++$bots[$name[1]]; } foreach ($bots as $online_name => $online_id) { $ident = $online_name . ' [Bot]'; } } else { if ($panther_user_online['user_id'] == 1) { $ident = $lang_common['Guest']; } else { $ident = $panther_user_online['ident']; } } $online[] = array('username' => colourize_group($ident, $panther_user_online['group_id'], $panther_user_online['user_id']), 'location' => generate_user_location($panther_user_online['currently']), 'last_active' => format_time_difference($panther_user_online['logged'], $lang_online)); } $tpl = load_template('online.tpl'); echo $tpl->render(array('pagination' => paginate($num_pages, $p, $panther_url['online']), 'lang_online' => $lang_online, 'lang_common' => $lang_common, 'users_online' => $online, 'num_pages' => $num_pages)); ($hook = get_extensions('online_after_display')) ? eval($hook) : null; require PANTHER_ROOT . 'footer.php';
/** * Fix teh extensions */ function extensions() { global $db; foreach ($this->db_cleaner->data->extensions as $group => $data) { $group_id = 0; $existing_extensions = get_extensions($group, $group_id); $extensions = array_unique(array_merge($data, $existing_extensions)); sort($extensions); foreach ($extensions as $extension) { if (!in_array($extension, $data) && in_array($extension, $existing_extensions)) { // Delete $db->sql_query('DELETE FROM ' . EXTENSIONS_TABLE . ' WHERE group_id = ' . (int) $group_id . "\n\t\t\t\t\t\t\tAND extension = '" . $db->sql_escape($extension) . '\''); } else { if (in_array($extension, $data) && !in_array($extension, $existing_extensions)) { $insert = array('group_id' => $group_id, 'extension' => $extension); $db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $insert)); } } } } }
if ($cur_poll['password'] != '') { check_forum_login_cookie($cur_poll['id'], $cur_poll['password']); } $mods_array = $cur_poll['moderators'] != '' ? unserialize($cur_poll['moderators']) : array(); $is_admmod = $panther_user['is_admin'] || ($panther_user['g_moderator'] == '1' && $panther_user['g_global_moderator'] || array_key_exists($panther_user['username'], $mods_array)) ? true : false; // Make sure we have permission to vote if (($cur_poll['post_replies'] == '' && $panther_user['g_post_replies'] == '0' || $cur_poll['post_replies'] == '0' || $panther_user['is_guest'] || $cur_poll['closed'] == '1') && !$is_admmod || $cur_poll['archived'] == '1') { message($lang_common['No permission'], false, '403 Forbidden'); } require PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/poll.php'; if (isset($_POST['form_sent'])) { confirm_referrer('viewtopic.php'); $options = $cur_poll['options'] != '' ? unserialize($cur_poll['options']) : array(); $voters = $cur_poll['voters'] != '' ? unserialize($cur_poll['voters']) : array(); $votes = $cur_poll['votes'] != '' ? unserialize($cur_poll['votes']) : array(); ($hook = get_extensions('poll_vote_before_validation')) ? eval($hook) : null; if (in_array($panther_user['id'], $voters)) { message($lang_poll['Already voted']); } if ($cur_poll['type'] == '1') { $vote = isset($_POST['vote']) ? intval($_POST['vote']) : -1; if ($vote < 0) { message($lang_common['Bad request'], false, '404 Not Found'); } // Increment the amount of votes for this option $votes[$vote] = isset($votes[$vote]) ? $votes[$vote]++ : 1; } else { $vote = isset($_POST['options']) && is_array($_POST['options']) ? array_map('intval', $_POST['options']) : array(); if (empty($vote)) { message($lang_common['Bad request'], false, '404 Not Found'); }
$can_upload = true; } else { $can_delete = ($is_admmod || $panther_user['g_delete_posts'] == '1') && ($cur_post['delete_files'] == '1' || $cur_post['delete_files'] == '') ? true : false; $can_upload = $panther_user['g_attach_files'] == '1' && ($cur_post['upload'] == '1' || $cur_post['upload'] == '') ? true : false; } $max_size = 1; $attachments = array(); if ($can_delete || $can_upload) { $max_size = $panther_user['g_max_size'] == '0' && $panther_user['g_attach_files'] == '1' ? $panther_config['o_max_upload_size'] : $panther_user['g_max_size']; $data = array(':id' => $id); $ps = $db->select('attachments', 'id, owner, filename, extension, size, downloads', $data, 'post_id=:id'); foreach ($ps as $attachment) { $attachments[] = array('id' => $attachment['id'], 'icon' => attach_icon($attachment['extension']), 'link' => panther_link($panther_url['attachment'], array($attachment['id'])), 'name' => $attachment['filename'], 'size' => sprintf($lang_post['Attachment size'], file_size($attachment['size'])), 'downloads' => sprintf($lang_post['Attachment downloads'], forum_number_format($attachment['downloads']))); } } ($hook = get_extensions('edit_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_post['Edit post']); $required_fields = array('req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']); $focus_element = array('edit', 'req_message'); define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; $checkboxes = array(); if ($can_edit_subject && $is_admmod) { $checkboxes[] = array('name' => 'stick_topic', 'title' => $lang_common['Stick topic'], 'checked' => isset($_POST['form_sent']) && isset($_POST['stick_topic']) || !isset($_POST['form_sent']) && $cur_post['sticky'] == '1' ? true : false); } if ($can_edit_subject && $cur_post['post_polls'] != '0' && $panther_user['g_post_polls'] == '1' && $panther_config['o_polls'] == '1') { $checkboxes[] = array('name' => 'add_poll', 'title' => $lang_post['Add poll'], 'checked' => isset($_POST['add_poll']) ? true : false); } if ($panther_config['o_smilies'] == '1') { $checkboxes[] = array('name' => 'hide_smilies', 'title' => $lang_post['Hide smilies'], 'checked' => isset($_POST['form_sent']) && isset($_POST['hide_smilies']) || !isset($_POST['form_sent']) && $cur_post['hide_smilies'] == '1' ? true : false); }
// Fix the request URI (both IIS6 & IIS7 break it) if (!isset($_SERVER['REQUEST_URI']) || isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) && strpos($_SERVER['REQUEST_URI'], '?') === false) { // Workaround for a bug in IIS7 if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; } else { if ($panther_config['o_url_type'] == 'default.php') { $requested_page = str_replace(array('%26', '%3D', '%2F', '%3F'), array('&', '=', '/', '?'), rawurlencode($_SERVER['PHP_SELF'])); $_SERVER['REQUEST_URI'] = $requested_page . (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''); } else { // Nothing can be done message($lang_common['Request URI error']); } } } ($hook = get_extensions('rewrite_before_rewrite')) ? eval($hook) : null; // If query string is not set properly, create one and set $_GET manually if ((!isset($_SERVER['QUERY_STRING']) || empty($_SERVER['QUERY_STRING'])) && strpos($_SERVER['REQUEST_URI'], '?') !== false) { $_SERVER['QUERY_STRING'] = parse_url('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); $_SERVER['QUERY_STRING'] = isset($_SERVER['QUERY_STRING']['query']) ? $_SERVER['QUERY_STRING']['query'] : ''; parse_str($_SERVER['QUERY_STRING'], $_GET); } // We determine the path to the script, since we need to separate the path from the data to be rewritten $path_to_script = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); if (substr($path_to_script, -1) != '/') { $path_to_script = $path_to_script . '/'; } // We create our own request URI with the path removed and only the parts to rewrite included $request_uri = substr(urldecode($_SERVER['REQUEST_URI']), strlen($path_to_script) - 8); if (strpos($request_uri, '?') !== false) { $request_uri = substr($request_uri, 0, strpos($request_uri, '?'));
// Initialize the admin components //----------------------------------------------------------------- if (is_admin()) { include_once 'core/admin-object.php'; db_json_sync(); check_theme_ID(); prepare_translate_files(); } load_data_types(); load_framework_libraries(); //----------------------------------------------------------------- // Extensions //----------------------------------------------------------------- // Get available extensions //................................................................ $extensions = get_extensions(); // Set filters on get option and update option for extensions //................................................................ foreach ($extensions as $extension_name => $extension_path) { $key = $shortname . $extension_name; add_filter('pre_option_' . $key, 'theme_option_filter', 10, 1); add_action('update_option', 'theme_option_dual_save_filter', 10, 3); } // Set filters on get option and update option for all forms, which build with FormsBuilder //................................................................ $forms = new FormsBuilder(); if (!empty($forms->options_pages)) { foreach ($forms->options_pages as $key => $value) { $key = $shortname . $key; add_filter('pre_option_' . $key, 'theme_option_filter', 10, 1); add_action('update_option', 'theme_option_dual_save_filter', 10, 3);
$abuse['negative'][$rep['poster_id']] = '1'; } } } $positive = !empty($abuse['positive']) ? array_search(max(array_values($abuse['positive'])), $abuse['positive']) : '0'; $negative = !empty($abuse['negative']) ? array_search(max(array_values($abuse['negative'])), $abuse['negative']) : '0'; $rep_abuse = $positive < $negative ? array('user' => $negative, 'votes' => $abuse['negative'][$negative], 'type' => 'negative') : array('user' => $positive, 'votes' => $abuse['positive'][$positive], 'type' => 'positive'); if ($rep_abuse['votes'] >= $panther_config['o_rep_abuse'] && $panther_config['o_mailing_list'] != '') { require PANTHER_ROOT . 'include/email.php'; $info = array('message' => array('<abuser>' => $panther_user['username'], '<amount>' => $panther_config['o_rep_abuse'], '<type>' => $rep_abuse['type'], '<user>' => $cur_forum['poster'], '<profile_url>' => panther_link($panther_url['profile_rep_received'], array($rep_abuse['user'])))); $mail_tpl = $mailer->parse(PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/mail_templates/rep_abuse.tpl', $info); $mailer->send($panther_config['o_mailing_list'], $mail_tpl['subject'], $mail_tpl['message']); } } } ($hook = get_extensions('reputation_after_rep_abuse')) ? eval($hook) : null; // Has the user issue issued the opposite vote? If so, remove it first ... $opposite_rep = false; $data = array(':uid' => $panther_user['id'], ':id' => $id); $ps = $db->select('reputation', 1, $data, 'given_by=:uid AND post_id=:id'); if ($ps->rowCount()) { $opposite_rep = true; $vote_add = $vote == '-1' ? '-1' : '+1'; $data = array(':uid' => $panther_user['id'], ':id' => $id); $db->delete('reputation', 'given_by=:uid AND post_id=:id', $data); $data = array(':id' => $id); $db->run('UPDATE ' . $db->prefix . 'posts SET reputation=reputation' . $vote_add . ' WHERE id=:id', $data); $data = array(':id' => $cur_forum['poster_id']); $db->run('UPDATE ' . $db->prefix . 'users SET reputation=reputation' . $vote_add . ' WHERE id=:id', $data); } $insert = array('post_id' => $id, 'given_by' => $panther_user['id'], 'vote' => $vote == '-1' ? '-1' : '1', 'time_given' => time());
if ($panther_config['o_feed_type'] == '2') { $feed = array('type' => 'atom', 'link' => panther_link($panther_url['forum_atom'], array($id)), 'lang' => $lang_common['Atom forum feed']); } } break; case 'viewtopic': if ($panther_config['o_feed_type'] == '1') { $feed = array('type' => 'rss', 'link' => panther_link($panther_url['topic_rss'], array($id)), 'lang' => $lang_common['RSS topic feed']); } else { if ($panther_config['o_feed_type'] == '2') { $feed = array('type' => 'atom', 'link' => panther_link($panther_url['topic_atom'], array($id)), 'lang' => $lang_common['Atom topic feed']); } } break; } ($hook = get_extensions('footer_feedsr')) ? eval($hook) : null; } // Display debug info (if enabled/defined) if ($panther_config['o_debug_mode'] == '1') { // Calculate script generation time $time_diff = sprintf('%.3f', microtime(true) - $panther_start); $debug_info = sprintf($lang_common['Querytime'], $time_diff, $db->get_num_queries()); if (function_exists('memory_get_usage')) { $debug_info .= ' - ' . sprintf($lang_common['Memory usage'], file_size(memory_get_usage())); if (function_exists('memory_get_peak_usage')) { $debug_info .= ' ' . sprintf($lang_common['Peak usage'], file_size(memory_get_peak_usage())); } } } else { $debug_info = ''; }
$type = 'positive'; break; case $cur_announcement['reputation'] < '0': $type = 'negative'; break; default: $type = 'zero'; break; } $cur_announcement['reputation'] = array('type' => $type, 'title' => sprintf($lang_topic['reputation'], forum_number_format($cur_announcement['reputation']))); } if ($cur_announcement['g_image'] != '') { $image_dir = $panther_config['o_image_group_dir'] != '' ? $panther_config['o_image_group_dir'] : get_base_url() . '/' . $panther_config['o_image_group_path'] . '/'; $img_size = @getimagesize($panther_config['o_image_group_path'] . '/' . $cur_announcement['group_id'] . '.' . $cur_announcement['g_image']); $group_image = array('src' => $image_dir . $cur_announcement['group_id'] . '.' . $cur_announcement['g_image'], 'size' => $img_size[3], 'alt' => $cur_announcement['g_user_title']); } else { $group_image = array(); } $announcement_type = $afid != '0' ? 'announcement_fid' : 'announcement'; ($hook = get_extensions('announcement_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $cur_announcement['forum_name'], $cur_announcement['subject']); define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; $render = array('index_link' => panther_link($panther_url['index']), 'lang_common' => $lang_common, 'forum_link' => panther_link($panther_url['forum'], array($cur_announcement['fid'], url_friendly($cur_announcement['forum_name']))), 'announce_link' => panther_link($panther_url[$announcement_type], array($id, $cur_announcement['fid'], url_friendly($cur_announcement['subject']))), 'cur_announcement' => $cur_announcement, 'username' => colourize_group($cur_announcement['username'], $cur_announcement['group_id'], $cur_announcement['user_id']), 'user_title' => get_title($cur_announcement), 'user_avatar' => $user_avatar, 'message' => $parser->parse_message($cur_announcement['message'], 0), 'panther_config' => $panther_config, 'post_actions' => $post_actions, 'user_info' => $user_info, 'user_contacts' => $user_contacts, 'group_image' => $group_image); if ($cur_announcement['parent']) { $render['parent_link'] = panther_link($panther_url['forum'], array($cur_announcement['parent_forum'], url_friendly($cur_announcement['parent']))); } $tpl = load_template('announcement.tpl'); echo $tpl->render($render); ($hook = get_extensions('announcement_after_display')) ? eval($hook) : null; require PANTHER_ROOT . 'footer.php';
require PANTHER_ROOT . 'header.php'; $tpl = load_template('forgot_password.tpl'); echo $tpl->render(array('lang_login' => $lang_login, 'form_url' => panther_link($panther_url['request_password']), 'csrf_token' => generate_csrf_token(), 'lang_common' => $lang_common, 'errors' => $errors)); require PANTHER_ROOT . 'footer.php'; } } } if (!$panther_user['is_guest']) { header('Location: ' . panther_link($panther_url['index'])); exit; } // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login) if (!empty($_SERVER['HTTP_REFERER'])) { $redirect_url = validate_redirect($_SERVER['HTTP_REFERER'], null); } if (!isset($redirect_url)) { $redirect_url = panther_link($panther_url['index']); } else { if (preg_match('%viewtopic\\.php\\?pid=(\\d+)$%', $redirect_url, $matches)) { $redirect_url .= '#p' . $matches[1]; } } $page_title = array($panther_config['o_board_title'], $lang_common['Login']); $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']); $focus_element = array('login', 'req_username'); ($hook = get_extensions('login_before_header')) ? eval($hook) : null; define('PANTHER_ACTIVE_PAGE', 'login'); require PANTHER_ROOT . 'header.php'; $tpl = load_template('login.tpl'); echo $tpl->render(array('lang_login' => $lang_login, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['login_in']), 'redirect_url' => $redirect_url, 'register' => panther_link($panther_url['register']), 'request_password' => panther_link($panther_url['request_password']), 'errors' => $errors)); require PANTHER_ROOT . 'footer.php';
/** * Validate the extensions */ function extensions() { global $user; $user->add_lang('acp/attachments'); // Build the output $last_extension_group = ''; foreach ($this->db_cleaner->data->extensions as $group => $data) { $group_ids = array(); $existing_extensions = get_extensions($group, $group_ids); $extensions = array_unique(array_merge($data, $existing_extensions)); sort($extensions); foreach ($extensions as $extension) { if (!in_array($extension, $data) && in_array($extension, $existing_extensions) || in_array($extension, $data) && !in_array($extension, $existing_extensions)) { // Output the table block if it's not been done yet if ($last_extension_group != $group) { $last_extension_group = $group; $this->_section_data[$group] = array('NAME' => user_lang($group), 'TITLE' => 'COLUMNS'); } // Add the data $this->_section_data[$group]['ITEMS'][] = array('NAME' => $extension, 'FIELD_NAME' => $group . '_' . $extension, 'MISSING' => !in_array($extension, $existing_extensions) ? true : false); if ($this->_has_changes === false) { $this->_has_changes = true; } } } } $this->success_message = 'EXTENSION_GROUPS_SUCCESS'; }
<?php END_MODULE != 'admin' && die('Access Denied'); load_modules_config(); $view_data['modules'] = $end_module; $action = $_GET['action']; $module = $_GET['module']; $extension = $_GET['extension']; if ($module) { get_extensions('end_' . $module); $view_data['page_name'] = $end_module[$module]['name']; } else { get_extensions(); $view_data['page_name'] = lang('all_extension'); } if ($action == 'edit') { if ($_GET['delete']) { if ($ext = $end_extension[$_GET['delete']]) { if (end_rmdir(END_ROOT . $ext['path'])) { end_exit(lang('delete_success'), 'admin.php?p=extension&action=edit', 1); } else { end_exit(lang('delete_failed'), 'admin.php?p=extension&action=edit', 3); } } } } else { if ($action == 'running') { if ($hid = intval($_GET['pause'])) { if (model('hook')->update($hid, array('status' => 'pause'))) { $view_data['info'] = lang('Success'); } else {
* License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher */ if (!defined('PANTHER')) { define('PANTHER_ROOT', __DIR__ . '/'); require PANTHER_ROOT . 'include/common.php'; } if ($panther_user['g_read_board'] == '0') { message($lang_common['No view'], false, '403 Forbidden'); } // Load the help.php language file require PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/help.php'; $page_title = array($panther_config['o_board_title'], $lang_help['Help']); define('PANTHER_ACTIVE_PAGE', 'help'); require PANTHER_ROOT . 'header.php'; // Display the smiley set require PANTHER_ROOT . 'include/parser.php'; $smiley_groups = array(); foreach ($parser->smilies as $smiley_text => $smiley_img) { $smiley_groups[$smiley_img][] = $smiley_text; } ($hook = get_extensions('help_before_display')) ? eval($hook) : null; $ps = $db->select('topics', 'subject, id', array(), '', 'id ASC LIMIT 1'); $cur_topic = $ps->fetch(); $ps = $db->select('posts', 'id', array(), '', 'id ASC LIMIT 1'); $cur_post = $ps->fetchColumn(); $ps = $db->select('users', 'id, username, group_id', array(), 'id>1', 'id ASC LIMIT 1'); $user = $ps->fetch(); $forum = $panther_forums[key($panther_forums)]; $tpl = load_template('help.tpl'); echo $tpl->render(array('lang_help' => $lang_help, 'panther_config' => $panther_config, 'lang_common' => $lang_common, 'base_url' => panther_link($panther_url['index']), 'help_page' => panther_link($panther_url['help'], array('url')), 'topic_link' => panther_link($panther_url['topic'], array($cur_topic['id'], url_friendly($cur_topic['subject']))), 'topic_id' => $cur_topic['id'], 'post_id' => $cur_post, 'post_link' => panther_link($panther_url['post'], array($cur_post)), 'forum_id' => $forum['id'], 'forum_link' => panther_link($panther_url['forum'], array($forum['id'], url_friendly($forum['forum_name']))), 'formatted_username' => colourize_group($user['username'], $user['group_id'], $user['id']), 'username' => $user['username'], 'smiley_path' => $panther_config['o_smilies_dir'] != '' ? $panther_config['o_smilies_dir'] : get_base_url() . '/' . $panther_config['o_smilies_path'] . '/', 'smiley_groups' => $smiley_groups)); $db->end_transaction();
require PANTHER_ROOT . 'header.php'; $tpl = load_template('recent_warnings.tpl'); echo $tpl->render(array('lang_warnings' => $lang_warnings, 'lang_common' => $lang_common, 'warnings' => $warnings, 'num_pages' => $num_pages, 'pagination' => paginate($num_pages, $p, $panther_url['warnings_recent']))); } else { $ps = $db->select('warning_types', 'id, title, description, points, expiration_time', array(), '', 'points, id'); $ps1 = $db->select('warning_levels', 'id, points, period', array(), '', 'points, id'); // If neither have been configured if (!$ps->rowCount() && !$ps1->rowCount()) { message($lang_common['Bad request']); } $warning_types = array(); foreach ($ps as $cur_type) { $warning_types[] = array('title' => $cur_type['title'], 'description' => $cur_type['description'], 'points' => $cur_type['points']); } $warning_levels = array(); foreach ($ps1 as $cur_level) { $ban_title = $cur_level['period'] == '0' ? $lang_warnings['Permanent ban'] : format_expiration_time($cur_level['period']); $warning_levels[] = array('title' => $ban_title, 'points' => $cur_level['points']); } ($hook = get_extensions('view_warnings_before_header')) ? eval($hook) : null; define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; $tpl = load_template('warnings.tpl'); echo $tpl->render(array('lang_warnings' => $lang_warnings, 'warning_levels' => $warning_levels, 'warning_types' => $warning_types)); } } } } } $footer_style = 'warnings'; require PANTHER_ROOT . 'footer.php';
} ($hook = get_extensions('pms_delete_folder_before_deletion')) ? eval($hook) : null; $update = array('folder_id' => 2); $update_data = array(':id' => $id); $db->update('pms_data', $update, 'folder_id=:id', $update_data); $db->delete('folders', 'id=:id AND user_id=:uid', $data); redirect(panther_link($panther_url['pms_folders']), $lang_pm['Folder del redirect']); } } } $data = array(':uid' => $panther_user['id']); $folders = array(); $ps = $db->select('folders', 'name, id', $data, 'user_id=:uid'); foreach ($ps as $cur_folder) { $folders[] = array('id' => $cur_folder['id'], 'name' => $cur_folder['name']); } $required_fields = array('req_folder' => $lang_pm['Folder']); $focus_element = array('folder', 'req_folder'); ($hook = get_extensions('pms_message_folders_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_common['PM'], $lang_pm['My folders 2']); define('PANTHER_ALLOW_INDEX', 1); define('PANTHER_ACTIVE_PAGE', 'pm'); require PANTHER_ROOT . 'header.php'; $tpl = load_template('message_folders.tpl'); echo $tpl->render(array('errors' => $errors, 'lang_pm' => $lang_pm, 'lang_common' => $lang_common, 'pm_menu' => generate_pm_menu('folders'), 'form_action' => panther_link($panther_url['pms_folders']), 'folder' => isset($folder) ? $folder : '', 'folders' => $folders)); require PANTHER_ROOT . 'footer.php'; } else { message($lang_common['Bad request']); } } }
} // get the extensions which have a default page template defined // active template $sql = "select page_ttyyp_id from keel where on_default = '1'"; $result = new SQL($sql); $active_template_id = $result->fetchsingle(); // extensions with page templates $extensions = array(); if ($site->fdat['extension']) { $where = $site->db->prepare('and templ_tyyp.extension = ?', $site->fdat['extension']); } $sql = "select * from templ_tyyp where on_page_templ = '1' and is_default = 1 {$where}"; $result = new SQL($sql); while ($template = $result->fetch('ASSOC')) { if ($template['extension']) { $extension = get_extensions('DB', false, $template['extension']); $extension = $extension[$template['extension']]; // for sorting $extension_titles[$extension['extension_id']] = $extension['title']; // preview if ($template['preview']) { if (strpos($template['preview'], 'http') !== 0) { // relative, add site url $template['preview'] = $site->CONF['wwwroot'] . '/' . $extension['path'] . $template['preview']; } } else { $template['preview'] = $site->CONF['wwwroot'] . $site->CONF['styles_path'] . '/gfx/general/no_preview.gif'; } // preview thumb if ($template['preview_thumb']) { if (strpos($template['preview_thumb'], 'http') !== 0) {
} $categories = $forums = array(); $render['can_delete'] = $admins[$panther_user['id']]['admin_users'] == '1' ? true : false; if ($user['g_moderator'] == '1' || $user['g_id'] == PANTHER_ADMIN) { $render['user_is_moderator'] = true; $ps = $db->run('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.moderators FROM ' . $db->prefix . 'categories AS c INNER JOIN ' . $db->prefix . 'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position'); foreach ($ps as $cur_forum) { if (!isset($categories[$cur_forum['cid']])) { $categories[$cur_forum['cid']] = array('name' => $cur_forum['cat_name'], 'cid' => $cur_forum['cid']); } $moderators = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array(); $forums[] = array('id' => $cur_forum['fid'], 'name' => $cur_forum['forum_name'], 'category_id' => $cur_forum['cid'], 'checked' => in_array($id, $moderators) ? true : false); } $render['categories'] = $categories; $render['forums'] = $forums; } } $tpl = load_template('profile_admin.tpl'); echo $tpl->render($render); ($hook = get_extensions('profile_admin_after_form')) ? eval($hook) : null; } else { message($lang_common['Bad request'], false, '404 Not Found'); } } } } } } } require PANTHER_ROOT . 'footer.php'; }
$ps = $db->run('SELECT p.poster, p.message, p.hide_smilies, p.posted, u.group_id FROM ' . $db->prefix . 'posts AS p LEFT JOIN ' . $db->prefix . 'users AS u ON (p.poster=u.username) WHERE p.topic_id=:id ORDER BY p.id DESC LIMIT ' . $panther_config['o_topic_review'], $data); foreach ($ps as $cur_post) { $posts[] = array('username' => colourize_group($cur_post['poster'], $cur_post['group_id']), 'posted' => format_time($cur_post['posted']), 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies'])); } } $render = array('lang_common' => $lang_common, 'lang_post' => $lang_post, 'posts' => $posts, 'errors' => $errors, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_posting['id'], url_friendly($cur_posting['forum_name']))), 'cur_posting' => $cur_posting, 'POST' => $_POST, 'action' => $action, 'fid' => $fid, 'tid' => $tid, 'csrf_token' => generate_csrf_token(), 'panther_config' => $panther_config, 'message' => isset($_POST['req_message']) ? $orig_message : (isset($quote) ? $quote : ''), 'panther_user' => $panther_user, 'can_upload' => $can_upload, 'checkboxes' => $checkboxes, 'quickpost_links' => array('bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies')))); if (isset($cur_posting['subject'])) { $render['topic_link'] = panther_link($panther_url['topic'], array($tid, url_friendly($cur_posting['subject']))); } if (isset($_POST['preview'])) { require_once PANTHER_ROOT . 'include/parser.php'; $render['preview'] = $parser->parse_message($message, $hide_smilies); } if ($panther_user['is_guest']) { $email_form_name = $panther_config['p_force_guest_email'] == '1' ? 'req_email' : 'email'; $render['username'] = isset($username) ? $username : ''; $render['email'] = isset($_POST[$email_form_name]) ? $email : ''; $render['email_form_name'] = $email_form_name; } if ($can_upload) { $render['max_size'] = $max_size; } if (!empty($panther_robots) && $panther_user['g_robot_test'] == '1') { $id = array_rand($panther_robots); $render['robot_id'] = $id; $render['test'] = $panther_robots[$id]; } ($hook = get_extensions('post_before_submit')) ? eval($hook) : null; $tpl = load_template('post.tpl'); echo $tpl->render($render); require PANTHER_ROOT . 'footer.php';
/** * edit_artikkel.php * */ function edit_objekt() { function print_profiles() { global $site, $objekt; $sql = $site->db->prepare("SELECT profile_id AS id, source_table AS parent, name FROM object_profiles WHERE source_table=? ORDER BY name",'obj_artikkel'); $sth = new SQL($sql); # get object profile if($objekt->all['profile_id']) { $profile_def = $site->get_profile(array("id"=>$objekt->all['profile_id'])); $site->fdat['profile_id'] = $profile_def['profile_id']; } # if still not found then use default profile for this class if(!$profile_def['profile_id'] && !$site->fdat['profile_id']) { $site->fdat['profile_id'] = $site->get_default_profile_id(array("source_table" => 'obj_artikkel')); $profile_def = $site->get_profile(array("id"=>$site->fdat['profile_id'])); } ?> <fieldset> <legend> <select onchange="changeProfile(this)" name="profile_id"> <?php $all_profiles_hash = array(); while ($profile_data = $sth->fetch()){ $all_profiles_hash[] = $profile_data['id']; print "<option value='".$profile_data['id']."' ".($profile_data['id']==$site->fdat['profile_id'] ? ' selected':'').">".$site->sys_sona(array(sona => $profile_data['name'], tyyp=>"custom"))."</option>"; } ?> </select> </legend> <?php foreach($all_profiles_hash as $profile_id) { ?> <div id="profile_<?= $profile_id ?>" style="display: <?=($site->fdat['profile_id'] == $profile_id ? 'block' : 'none');?>;"> <table cellpadding="0" cellspacing="0"> <?php $profile_def = $site->get_profile(array("id"=>$profile_id)); $profile_fields = unserialize($profile_def['data']); # if profile fields exist if(is_array($profile_fields) && sizeof($profile_fields)>0){ ## add suffix for each field, to get unique id-s foreach($profile_fields as $key=>$tmp_prof){ $profile_fields[$key]['html_fieldname'] = $profile_fields[$key]['name']."_".$profile_id; # field can be INPUT or READ-ONLY value - this info may be passed from triggers file "actions.inc.php", using "$site->fdat" array $profile_fields[$key]['is_readonly'] = $site->fdat['is_readonly_'.$key]; } #printr($profile_fields); ################### # print profile fields rows print_profile_fields(array( 'profile_fields' => $profile_fields, 'field_values' => $objekt->all, )); } # if profile fields exist ?> </table> </div> <?php } //foreach ?> </fieldset> <fieldset> <legend><?=$site->sys_sona(array('sona' => 'visible_to_visitors', 'tyyp' => 'editor'))?></legend> <input type="radio" name="publish" id="object_published" value="1"<?=($site->fdat['publish'] || $objekt->all['on_avaldatud'] ? ' checked' : '')?>> <label for="object_published"><?=$site->sys_sona(array('sona' => 'published', 'tyyp' => 'editor'))?></label><br> <input type="radio" name="publish" id="object_unpublished" value="0"<?=($site->fdat['publish'] == 0 && $objekt->all['on_avaldatud'] == 0 ? ' checked' : '')?>> <label for="object_unpublished"><?=$site->sys_sona(array('sona' => 'unpublished', 'tyyp' => 'editor'))?></label><br> </fieldset> <fieldset> <?php ####### dont show checkbox "Headline is visible" if config variable "killheadlineisvisible" is true in file config.php if($site->CONF['killheadlineisvisible']) { ?> <input type="hidden" id="on_pealkiri" name="on_pealkiri" value="<?=($site->fdat['op'] == 'new' ? 1 : $objekt->all['on_pealkiri'])?>"> <?php } else { # by default: show it ?> <div> <input type="checkbox" id="on_pealkiri" name="on_pealkiri" value="1" <?=($site->fdat['op'] == 'new') ? 'checked' : ($objekt->all['on_pealkiri'] ? 'checked' : null)?>> <label for="on_pealkiri"><?=$site->sys_sona(array(sona => 'Pealkiri on nahtav', tyyp => 'editor'));?></label> </div> <?php } ?> <div> <input type="checkbox" name="on_foorum" id="on_foorum" value="1" <?=($objekt->all['on_foorum'] || ($site->fdat['op'] == 'new' && ($site->CONF['default_comments'] || $site->fdat['allow_comments'])) ? 'checked' : null)?>> <label for="on_foorum"><?=$site->sys_sona(array(sona => "Foorum lubatud", tyyp=>"editor"))?></label> </div> <?php if ($site->CONF['enable_mailing_list']) { ## Bug #2590 ## fuzzy logic: if editor checks here checkbox "is mailinglist", # then field "on_saadetud" is set to "0" and that means article is included in next mailinglist routine. ?> <div> <input type="checkbox" name="on_saadetud" id="on_saadetud" value="1" <?=($objekt->all['on_saadetud'] ? null : "checked");?>> <label for="on_saadetud"><?=$site->sys_sona(array(sona => 'On meilinglist', tyyp=>'editor'));?></label> </div> <?php } ?> </fieldset> <fieldset> <table cellpadding="1" cellspacing="1" border="0" style="color: #999;"> <?php if ($objekt->all['created_user_name']) { ?> <?php if ($site->CONF['allow_change_position']) { ?> <tr> <td><?=$site->sys_sona(array('sona' => 'position', 'tyyp' => 'Editor'));?>:</td> <td> <input type="text" name="kesk" value="<?=$objekt->all['kesk']?>" style="width: 40px; text-align: right;"> </td> </tr> <?php } ?> <tr> <td><?=$site->sys_sona(array('sona' => 'object_created', 'tyyp' => 'Editor'));?>:</td> <td><?=date('d.m.Y H:i', strtotime($objekt->all['created_time']));?></td> </tr> <tr> <td></td> <td><?=$objekt->all['created_user_name'];?></td> </tr> <?php } ?> <?php if ($objekt->all['changed_user_name']) { ?> <tr> <td><?=$site->sys_sona(array('sona' => 'object_changed', 'tyyp' => 'Editor'));?>:</td> <td><?=date('d.m.Y H:i', strtotime($objekt->all['changed_time']));?></td> </tr> <tr> <td></td> <td><?=$objekt->all['changed_user_name'];?></td> </tr> <?php } ?> </table> </fieldset> <?php } // end function print_profile() function print_sections() { global $site, $objekt, $class_path, $keel; $tmpkeel = $keel; if (!is_numeric($tmpkeel)){ $sql = $site->db->prepare("SELECT keel FROM objekt WHERE objekt_id=?", $site->fdat['parent_id']); $sth = new SQL($sql); $site->debug->msg($sth->debug->get_msgs()); $tmpkeel = $sth->fetchsingle(); } $sections = array($site->fdat['parent_id']); if ($objekt->objekt_id) { $sql = $site->db->prepare("SELECT parent_id FROM objekt_objekt WHERE objekt_id=?", $objekt->objekt_id); $result = new SQL ($sql); while ($data = $result->fetch('ASSOC')) { $sections[] = $data['parent_id']; } } if ($site->fdat['permanent_parent_id'] == '') { include_once($class_path.'rubloetelu.class.php'); $all_sections = new RubLoetelu(array('keel' => $keel)); $all_sections = $all_sections->get_loetelu(); asort($all_sections); } ?> <script type="text/javascript"> // the sections list var all_sections = Array(); // for Mozilla the section list doesn't stretch dynamically so add this increment value to the containing elements height var heightIncrement = 10; function createSectionNodeSet(sectionNode, section_id, section_name) { var input = document.createElement('input'); input.type = 'hidden'; input.name = 'rubriik[]'; input.value = section_id; sectionNode.appendChild(input); var buttons = document.createElement('div'); buttons.id='button_' + section_id; if(sectionNode.parentNode) { for(var i = 0; i < sectionNode.parentNode.childNodes.length; i++) if(sectionNode.parentNode.childNodes[i].tagName == 'LI') break; if(sectionNode.id != sectionNode.parentNode.childNodes[i].id) { var del_button = document.createElement('a'); del_button.href = "javascript:deleteSection('" + section_id +"');"; del_button.innerHTML = '<img src="<?=$site->CONF['wwwroot'].$site->CONF['styles_path'];?>/gfx/editor/delete.gif">'; buttons.appendChild(del_button); } } sectionNode.appendChild(buttons); var link = document.createElement('a'); link.href = "javascript:opopup('"+ section_id +"');"; link.innerHTML = section_name; sectionNode.appendChild(link); return sectionNode; } // add a new item to the section list function opopup(section_id){ var pre_selected=''; if(section_id !=''){ pre_selected = '&pre_selected=' + section_id; explorer_window = openpopup('explorer.php?objekt_id=home&editor=1&swk_setup=current_article_parent_selection' + pre_selected, 'cms_explorer', '800','600', 'auto'); }else{ explorer_window = openpopup('explorer.php?objekt_id=home&editor=1&swk_setup=article_parent_selection', 'cms_explorer', '800','600', 'auto'); } } function addNewSection(node) { explorer_window.close(); for(var j = 0; j < node.length; j++){ var error = false; for(var i = 0; i < all_sections.length; i++){ /* no duplicates */ if (all_sections[i] == node[j].objekt_id){ //return; error = true; }else{ } } if(!error){ var trail_path= new Array(); for(var z = 0; z < node[j].trail.length; z++){ trail_path[z] = node[j].trail[z].pealkiri; } var sections = document.getElementById('sections'); var item = document.createElement('li'); item.id = 'section_' + node[j].objekt_id; sections.appendChild(item); item = createSectionNodeSet(item, node[j].objekt_id, trail_path.join("->")); var container = document.getElementById('sections_container'); container.height = Number(container.height) + heightIncrement; all_sections[all_sections.length] = node[j].objekt_id; } for(var b = 0; b < all_sections.length; b++){ var c = all_sections[b]; var x = document.getElementById("button_" + c); x.style.visibility = "visible"; } } return; } // /function addNewSection function deleteSection(section_id) { var section = document.getElementById('section_' + section_id); section.parentNode.removeChild(section); var container = document.getElementById('sections_container'); //container.height = Number(container.height) - heightIncrement; // delete from duplicate checklist var new_all_sections =new Array(); for(var i = 0; i < all_sections.length; i++){ if (all_sections[i] == section_id){ all_sections[i] = null; }else{ new_all_sections.push(all_sections[i]); } } all_sections=new_all_sections; var c = 0; var d = ''; for(var b = 0; b < all_sections.length; b++){ if (all_sections[b] != null){ c++; d=all_sections[b]; } } if(c == 1){ document.getElementById('button_' + d).style.visibility = 'hidden'; } return; } // /function deleteSection function modifySection(node,section_id) { explorer_window.close(); for(var j = 0; j < node.length; j++){ var error = false; for(var i = 0; i < all_sections.length; i++){ /* no duplicates */ if (all_sections[i] == node[j].objekt_id){ //return; error = true; }else{ } } if(!error){ var trail_path= new Array(); for(var z = 0; z < node[j].trail.length; z++){ trail_path[z] = node[j].trail[z].pealkiri; } var section = document.getElementById('section_' + section_id); section.innerHTML = ''; section = createSectionNodeSet(section, node[j].objekt_id, trail_path.join("->")); section.id = 'section_' + node[j].objekt_id; /* delete from duplicate checklist */ for(var i = 0; i < all_sections.length; i++) if (all_sections[i] == section_id) all_sections[i] = null; all_sections[all_sections.length] = node[j].objekt_id; } } return; } // /function modifySection </script> <? // setup for new section selection $_SESSION['article_parent_selection']['callback'] = 'window.opener.addNewSection'; $_SESSION['article_parent_selection']['selectable'] = 2; $_SESSION['article_parent_selection']['hide_language_selection'] = '1'; $_SESSION['article_parent_selection']['mem_classes'] = array('rubriik', ); //this sucks, really $_SESSION['article_parent_selection']['db_fields'] = array('select_checkbox', 'objekt_id', 'pealkiri', ); $_SESSION['article_parent_selection']['display_fields'] = array('select_checkbox', 'pealkiri', ); // setup for current section change $_SESSION['current_article_parent_selection']['callback'] = 'window.opener.modifySection'; $_SESSION['current_article_parent_selection']['selectable'] = 1; $_SESSION['current_article_parent_selection']['hide_language_selection'] = '1'; $_SESSION['current_article_parent_selection']['mem_classes'] = array('rubriik', ); //this sucks, really $_SESSION['current_article_parent_selection']['db_fields'] = array('select_checkbox', 'objekt_id', 'pealkiri', ); $_SESSION['current_article_parent_selection']['display_fields'] = array('select_checkbox', 'pealkiri', ); ?> <div class="sections_header"> <div> <a href="#" id="new_section" onClick="opopup(''); return false;"><?=$site->sys_sona(array(sona => "New", tyyp=>"editor"))?></a> </div> <?=$site->sys_sona(array(sona => "Rubriigid", tyyp=>"editor"))?> </div> <ul id="sections" class="sections"> <?php $home_section = $site->alias(array('key'=>'rub_home_id', 'keel'=>$tmpkeel)); $i = 0; foreach ($all_sections as $section_id => $section_name) { # Bug #2264: Uuele artiklile KAKS v�i rohkem eeldefineeritud parentit (triggers) if ($section_id != $home_section && (in_array($section_id, $sections) || (is_array($site->fdat['parents_arr']) && in_array($section_id,$site->fdat['parents_arr']))) ) { ?> <script type="text/javascript"> all_sections[all_sections.length] = <?=$section_id?>; </script> <?if($i==0){$first_section=$section_id;}?> <li id="section_<?=$section_id;?>"> <input type="hidden" name="rubriik[]" value="<?=$section_id;?>"> <div id="button_<?=$section_id;?>"><a href="javascript:deleteSection('<?=$section_id;?>');"><img src="<?=$site->CONF['wwwroot'].$site->CONF['styles_path'];?>/gfx/editor/delete.gif"></a></div> <a href="javascript:opopup('<?=$section_id;?>');"><?=$section_name;?></a> </li> <?php $i++; } } ?> </ul> <?php if($i == 1){?> <script type="text/javascript"> document.getElementById('button_<?=$first_section;?>').style.visibility = 'hidden'; </script> <?}?> <!-- /rubriigid --> <?php } /* end function print_sections2() */ global $site, $class_path, $objekt, $tyyp, $keel; include_once($class_path.'adminpage.inc.php'); include_once($class_path.'SCMSEditor.php'); include_once($class_path.'extension.class.php'); $editor = new SCMSEditor('scms_article_editor') ; if($site->fdat['op'] == 'new') { $editor->Value = ''; } else { $editor->Value = ($objekt->lyhi->get_text() ? $objekt->lyhi->get_text().'<hr class="scms_lead_body_separator" />' : '').($objekt->sisu->get_text() ? $objekt->sisu->get_text() : ''); // bug #2388 Tagaside vormist eemaldada e-maili aadress, tagasiasendus if(preg_match_all('/<input(.*?)>/', $editor->Value, $matches)) { $systemfields = array(); foreach ($matches[0] as $match) { if(strpos($match,'type="hidden"') && strpos($match,'name="systemfield"')) $systemfields[] = $match; } foreach ($systemfields as $systemfield) { if(preg_match('/value="(.*?)\|\|\|(.*?)\|\|\|(.*?)\|\|\|/', $systemfield, $matches)) { $sql = $site->db->prepare('select mail from allowed_mails where id = ?;', $matches[1]); $result = new SQL($sql); $mail = $result->fetchsingle(); $editor->Value = str_replace('value="'.$matches[1].'|||', 'value="'.$mail.'|||', $editor->Value); } } } // /form allowed mails check/insert } $editor->Height = '100%'; $editor->Width = '100%'; $editor->ToolbarSet = ''; $editor->BasePath = (empty($_SERVER['HTTPS']) ? 'http://': 'https://').$site->CONF['hostname'].$site->CONF['wwwroot'].$site->CONF['js_path'].'/fckeditor/'; // create config array $Config['CustomConfigurationsPath'] = $editor->BasePath.'scms_config.js'; $Config['SkinPath'] = $editor->BasePath.'editor/skins/scms/'; $Config['ToolbarCanCollapse'] = false; $Config['SCMSFormName'] = $site->CONF['feedbackform_form_name']; $Config['SCMSFormAction'] = $site->CONF['feedbackform_action']; $Config['SCMSFormMethod'] = $site->CONF['feedbackform_method']; $Config['SCMSFormHiddenName'] = 'systemfield'; $Config['SCMSFormHiddenString'] = $site->CONF["default_mail"].'|||index.php?id='.$site->alias(array('key'=>"error_page", 'keel'=>$keel )).'|||index.php?id='.$site->alias(array('key'=>"ok_page", 'keel'=>$keel )).'|||'.$site->CONF["subject"]; $default_toolbar = 'SCMS_simple'; if($_COOKIE['scms_toolbar']) { $default_toolbar = $_COOKIE['scms_toolbar']; } // load custom values for FCKeditor config foreach (get_extensions('DB', true) as $act_ext) { if(file_exists($act_ext['fullpath'].'/extension.config.php')) // assume this is the right one { $EXTENSION =& load_extension_config($act_ext); // set the toolbar, later TODO user based toolbars if($site->user->is_superuser) { if($EXTENSION['wysiwyg_config']['SuperUserToolbarSet']) { $editor->ToolbarSet = $EXTENSION['wysiwyg_config']['SuperUserToolbarSet']; } elseif($EXTENSION['wysiwyg_config']['DefaultToolbarSet']) { $editor->ToolbarSet = $EXTENSION['wysiwyg_config']['DefaultToolbarSet']; } else { $editor->ToolbarSet = $default_toolbar; } } else { $roles = array(); $sql = 'select role_id, name from roles;'; $result = new SQL($sql); while($row = $result->fetch('ASSOC')) { $roles[$row[role_id]] = $row['name']; } foreach((array)$EXTENSION['wysiwyg_config']['ToolbarSets'] as $role => $set) { if($role) { $key = array_search($role, $roles); if($key !== null && in_array($key, $site->user->roles)) { $editor->ToolbarSet = $set; break; } } } if(!$editor->ToolbarSet) { ($EXTENSION['wysiwyg_config']['DefaultToolbarSet'] ? $editor->ToolbarSet = $EXTENSION['wysiwyg_config']['DefaultToolbarSet'] : $editor->ToolbarSet = $default_toolbar); } } // set the config if(is_array($EXTENSION['wysiwyg_config']['Config'])) $Config = array_merge($Config, $EXTENSION['wysiwyg_config']['Config']); break; // get only the first } } if(!$editor->ToolbarSet) $editor->ToolbarSet = $default_toolbar; $editor->Config = $Config; // somethings are not allowed to be overwritten $editor->Config['PluginsPath'] = $editor->BasePath.'editor/plugins/'; $editor->Config['EditorAreaCSS'] = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$site->CONF['hostname'].$site->CONF['wwwroot'].'/styles.php?with_wysiwyg=1'; $editor->Config['CustomStyles'] = ''; $editor->Config['StylesXmlPath'] = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$site->CONF['hostname'].$site->CONF['wwwroot'].'/admin/fckstyles.php'; $editor->Config['FormatOutput'] = false; $editor->Config['AutoDetectLanguage'] = false; $editor->Config['DefaultLanguage'] = substr($_SESSION['keel_admin']['locale'], 0, 2); $editor->Config['ProcessHTMLEntities'] = false; $editor->Config['Debug'] = false; //$editor->Config['FitWindow_autoFitToResize'] = true; $editor->Config['CurrentToolbar'] = $editor->ToolbarSet; //printr($editor->Config); //printr($editor->ToolbarSet); // setup for site linking $_SESSION['site_linking']['callback'] = 'window.opener.frames[0].site_linking'; $_SESSION['site_linking']['selectable'] = 1; $_SESSION['site_linking']['mem_classes'] = array('rubriik', 'artikkel', ); //this sucks, really $_SESSION['site_linking']['db_fields'] = array('select_checkbox', 'objekt_id', 'pealkiri', 'klass',); $_SESSION['site_linking']['display_fields'] = array('select_checkbox', 'pealkiri', 'klass',); // /setup for site linking $parent = new Objekt(array('objekt_id' => $site->fdat['parent_id'])); // to get the correct path to parent objects set use_alises on $site->CONF['use_aliases'] = 1; $parent_href = $parent->get_object_href(); if($site->CONF['alias_trail_format'] == 0 || $parent->all['sys_alias'] == 'home' || $parent->all['sys_alias'] == 'trash' || $parent->all['sys_alias'] == 'system' || $parent->all['sys_alias'] == 'gallup_arhiiv') $parent_href = preg_replace('#'.preg_quote('/'.($parent->all['friendly_url'] ? $parent->all['friendly_url'] : $parent->objekt_id), '#').'/$#', '/', $parent_href); $parent_href = $site->CONF['hostname'].$parent_href; // setup file insert $_SESSION['scms_filemanager_settings']['scms_wysiwyg_insert_file'] = array( 'select_mode' => 1, // 1 - select single file 'action_text' => $site->sys_sona(array('sona' => 'fm_choose_file_into_article', 'tyyp' => 'editor')), 'action_trigger' => $site->sys_sona(array('sona' => 'fm_insert_file_into_article', 'tyyp' => 'editor')), 'callback' => 'window.opener.frames[0].SCMSImageFileInsert', ); ?> <html> <head> <title><?=$site->title;?> <?=$site->cms_version;?></title> <meta http-equiv="Content-Type" content="text/html; charset=<?=($encoding ? $encoding : $site->encoding);?>"> <meta http-equiv="Cache-Control" content="no-cache"> <link rel="stylesheet" href="<?=$site->CONF['wwwroot'].$site->CONF['styles_path'].'/article_editor.css';?>" media="screen"> <script type="text/javascript" src="<?=$site->CONF['wwwroot'].$site->CONF['js_path'];?>/yld.js"></script> <script type="text/javascript" src="<?=$site->CONF['wwwroot'].$site->CONF['js_path']?>/edit_popup.js"></script> <link rel="stylesheet" href="<?=$site->CONF['wwwroot'].$site->CONF['styles_path']?>/datepicker.css"> <script type="text/javascript" src="<?=$site->CONF['wwwroot'].$site->CONF['js_path'] ?>/jquery.js"></script> <script type="text/javascript" src="<?=$site->CONF['wwwroot'].$site->CONF['js_path'] ?>/datepicker.js"></script> <script type="text/javascript" src="<?=$site->CONF['wwwroot'];?>/common.js.php"></script> <script type="text/javascript"> function FCKeditor_OnComplete( editorInstance ) { <?php if($objekt->objekt_id) { ?> var oSCMSEditor = FCKeditorAPI.GetInstance('scms_article_editor') ; oSCMSEditor.Focus(); <?php } else { ?> document.frmEdit.pealkiri.focus(); <?php } ?> window.moveTo((screen.width - 880) / 2, (screen.height - 660) / 2); window.resizeTo(880, 660); } function editAlias() { var alias_placeholder = document.getElementById('alias_placeholder'); var alias_value = document.getElementById('alias_value'); alias_placeholder.innerHTML = '<input type="text" id="alias" value="' + alias_value.value + '" onblur="saveAlias();">'; var alias = document.getElementById('alias'); alias.focus(); } function saveAlias() { var alias_placeholder = document.getElementById('alias_placeholder'); var alias_value = document.getElementById('alias_value'); var alias = document.getElementById('alias'); if(alias_value.value != alias.value) { $.ajax({ url: 'ajax_response.php?rand=' + Math.random(9999), data: {op: 'generate_alias', string: alias.value, language_id: '<?=$keel;?>'}, type: 'POST', dataType: 'json', timeout: 1000, error: function() { alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (alias_value.value.length > 30 ? alias_value.value.substring(0, 30) + '...' : alias_value.value) + '</a>'; }, success: function(response) { if(response.alias) { alias_value.value = response.alias; alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (alias_value.value.length > 30 ? alias_value.value.substring(0, 30) + '...' : alias_value.value) + '</a>'; } else { alias_value.value = ''; <?php if($objekt->objekt_id) { ?> alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + '<?=$objekt->objekt_id;?>' + '</a>'; <?php } else { ?> alias_placeholder.innerHTML = '<input type="text" id="alias" value="" onblur="saveAlias();">'; <?php } ?> } } }); } else { if(!alias.value) { alias_value.value = ''; <?php if($objekt->objekt_id) { ?> alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + '<?=$objekt->objekt_id;?>' + '</a>'; <?php } else { ?> alias_placeholder.innerHTML = '<input type="text" id="alias" value="" onblur="saveAlias();">'; <?php } ?> } else { alias_placeholder.innerHTML = '<a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (alias_value.value.length > 30 ? alias_value.value.substring(0, 30) + '...' : alias_value.value) + '</a>'; } } } function createAlias() { var alias_value = document.getElementById('alias_value'); var title = document.getElementById('pealkiri') if(0 || (!alias_value && title.value)) { $.ajax({ url: 'ajax_response.php?rand=' + Math.random(9999), data: {op: 'generate_alias', string: title.value, language_id: '<?=$keel;?>'}, type: 'POST', dataType: 'json', timeout: 1000, error: function() { }, success: function(response) { var alias_cell = document.getElementById('alias_cell'); alias_cell.className = 'alias'; if(response.alias) { alias_cell.innerHTML = '<input type="hidden" name="friendly_url" id="alias_value" value="' + response.alias + '"><?=$parent_href;?><span id="alias_placeholder"><a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (response.alias.length > 30 ? response.alias.substring(0, 30) + '...' : response.alias) + '</a></span>'; } else { alias_cell.innerHTML = '<input type="hidden" name="friendly_url" id="alias_value" value=""><?=$parent_href;?><span id="alias_placeholder"><input type="text" id="alias" value="" onblur="saveAlias();"></span>'; } } }); } } function saveForm(op2) { var form = document.getElementById('frmEdit'); var title = document.getElementById('pealkiri') var alias_value = document.getElementById('alias_value'); var alias = document.getElementById('alias'); if((title.value && !alias_value) || (alias && alias_value && alias.value != alias_value.value)) { $.ajax({ url: 'ajax_response.php?rand=' + Math.random(9999), data: {op: 'generate_alias', string: title.value, language_id: '<?=$keel;?>'}, type: 'POST', dataType: 'json', timeout: 1000, error: function() { var form = document.getElementById('frmEdit'); form.op2.value = op2; form.submit(); }, success: function(response) { var alias_value = document.getElementById('alias_value'); if(!alias_value && response.alias) { var alias_cell = document.getElementById('alias_cell'); alias_cell.className = 'alias'; alias_cell.innerHTML = '<input type="hidden" name="friendly_url" id="alias_value" value="' + response.alias + '"><?=$parent_href;?><span id="alias_placeholder"><a href="javascript:void(0);" onclick="editAlias();" id="alias_link">' + (response.alias.length > 30 ? response.alias.substring(0, 30) + '...' : response.alias) + '</a></span>'; } var form = document.getElementById('frmEdit'); form.op2.value = op2; form.submit(); } }); } else { form.op2.value = op2; form.submit(); } } </script> <?php if ($editor->browser() == 'Gecko') { ?> <style type="text/css"> table.layout td.editor div { height: 100%; } </style> <?php } ?> </head> <body id="scms_editor_popup"> <form action="edit.php" method="POST" name="frmEdit" id="frmEdit" class="article_submit_form"> <?php /* hidden form stuff */ ?> <input type=hidden name="op" value="<?=$site->fdat['op'];?>"> <input type=hidden name="op2" id="op2" value="saveclose"> <input type=hidden name="refresh" value="0"> <input type="hidden" name="tyyp_id" value="<?=$tyyp['tyyp_id'];?>"> <input type="hidden" name="tyyp" value="<?=$tyyp['klass'];?>"> <input type="hidden" name="sys_alias" value="<?=$site->fdat['sys_alias'];?>"> <input type="hidden" name="id" value="<?=$site->fdat['id'];?>"> <input type="hidden" name="kesk" value="<?=$site->fdat['kesk'];?>"> <input type="hidden" name="parent_id" value="<?=$site->fdat['parent_id'];?>"> <input type="hidden" name="previous_id" value="<?=$site->fdat['previous_id'];?>"> <input type="hidden" name="keel" value="<?=$keel;?>"> <input type="hidden" name="baseurl" value="<?=(empty($_SERVER['HTTPS']) ? 'http://': 'https://').$site->CONF['hostname'].$site->CONF['wwwroot'];?>/"> <input type="hidden" name="wwwroot" value="<?=$site->CONF['wwwroot'];?>/"> <input type="hidden" name="sorting" value="<?=$site->fdat['sorting'];?>"> <input type="hidden" name="extension_path" value="<?=$site->fdat['extension_path'];?>"> <?php /* /hidden form stuff */ ?> <table cellpadding="0" cellspacing="0" class="layout" border="0"> <tr> <td> <table cellpadding="0" cellspacing="0" class="layout" border="0"> <tr> <td class="header"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td style=" font-size: 12px;font-weight: bold;"><label for="pealkiri"><?=$site->sys_sona(array('sona' => 'Pealkiri', 'tyyp' => 'editor'))?>: </label></td> <td width="100%"><input type="text" tabindex="1" id="pealkiri" name="pealkiri" value="<?=htmlspecialchars($objekt->pealkiri);?>" onblur="createAlias();"></td> </tr> </table> </td> </tr> <?php if($objekt->objekt_id) { ?> <tr> <td class="alias"><input type="hidden" name="friendly_url" id="alias_value" value="<?=htmlspecialchars($objekt->all['friendly_url']);?>"><?=$parent_href;?><span id="alias_placeholder"><a href="javascript:void(0);" onclick="editAlias();" id="alias_link"><?=($objekt->all['friendly_url'] ? (strlen(htmlspecialchars($objekt->all['friendly_url'])) > 30 ? substr(htmlspecialchars($objekt->all['friendly_url']), 0, 30).'...' : htmlspecialchars($objekt->all['friendly_url'])) : $objekt->objekt_id);?></a></span></td> </tr> <?php } else { ?> <tr> <td id="alias_cell" class="alias"> </td> </tr> <?php } ?> <tr> <td class="editor"> <?=$editor->Create();?> </td> </tr> <tr> <td id="sections_container" class="sections"> <?=print_sections();?> </td> </tr> </table> </td> <td class="profiles"> <?=print_profiles();?> </td> </tr> </table> </form> <? if ($site->fdat['op']=='edit') {?> <iframe src="checkin.php?objekt_id=<?=$objekt->objekt_id ?>" style="width: 0; height: 0; display: none; visibility: hidden;"></iframe> <? } ?> </body> </html> <?php }
$topic_count = 0; foreach ($ps as $cur_topic) { $url_subject = url_friendly($cur_topic['subject']); // Preg match is slow! if ($panther_config['o_censoring'] == '1') { $cur_topic['subject'] = censor_words($cur_topic['subject']); } $ghost_topic = !is_null($cur_topic['moved_to']) ? true : false; $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $panther_user['disp_posts']); $topics[$cur_topic['id']] = array('count' => ++$topic_count, 'topic_count' => forum_number_format($topic_count + $start_from), 'cur_topic' => $cur_topic, 'topic_poster' => $cur_topic['up_id'] > 1 ? colourize_group($cur_topic['poster'], $cur_topic['up_group_id'], $cur_topic['up_id']) : colourize_group($cur_topic['poster'], PANTHER_GUEST), 'moved_to' => $cur_topic['moved_to'], 'subject' => $cur_topic['subject'], 'sticky' => $cur_topic['sticky'], 'closed' => $cur_topic['closed'], 'topic_link' => panther_link($panther_url['topic'], array($cur_topic['id'], $url_subject)), 'num_pages' => $num_pages_topic, 'pagination' => paginate($num_pages_topic, -1, $panther_url['topic_paginate'], array($cur_topic['id'], $url_subject)), 'new' => !$ghost_topic && $cur_topic['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$fid]) || $tracked_topics['forums'][$fid] < $cur_topic['last_post']) ? '1' : '0'); if (is_null($cur_topic['moved_to'])) { $topics[$cur_topic['id']]['last_post_avatar'] = generate_avatar_markup($cur_topic['uid'], $cur_topic['email'], $cur_topic['use_gravatar'], array(32, 32)); $topics[$cur_topic['id']]['last_post_link'] = panther_link($panther_url['post'], array($cur_topic['last_post_id'])); $topics[$cur_topic['id']]['last_post'] = format_time($cur_topic['last_post']); $topics[$cur_topic['id']]['last_poster'] = $cur_topic['uid'] > 1 ? colourize_group($cur_topic['last_poster'], $cur_topic['group_id'], $cur_topic['uid']) : colourize_group($cur_topic['last_poster'], PANTHER_GUEST); $topics[$cur_topic['id']]['num_replies'] = forum_number_format($cur_topic['num_replies']); if ($panther_config['o_topic_views'] == '1') { $topics[$cur_topic['id']]['num_views'] = forum_number_format($cur_topic['num_views']); } } else { $topics[$cur_topic['id']]['topic_link'] = panther_link($panther_url['topic'], array($cur_topic['moved_to'], $url_subject)); } if ($topics[$cur_topic['id']]['new'] == '1') { $topics[$cur_topic['id']]['new_link'] = panther_link($panther_url['topic_new_posts'], array($cur_topic['id'], $url_subject)); } } } $tpl = load_template('moderate_forum.tpl'); echo $tpl->render(array('lang_common' => $lang_common, 'lang_misc' => $lang_misc, 'lang_forum' => $lang_forum, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['moderate_forum'], array($fid, url_friendly($cur_forum['forum_name']))), 'pagination' => paginate($num_pages, $p, $panther_url['moderate_forum'], array($fid)), 'forum' => $cur_forum, 'form_action' => panther_link($panther_url['moderate_forum'], array($fid)), 'panther_config' => $panther_config, 'csrf_token' => generate_csrf_token(), 'panther_user' => $panther_user, 'topics' => $topics)); ($hook = get_extensions('moderate_forum_after_output')) ? eval($hook) : null; require PANTHER_ROOT . 'footer.php';
$output['cached'] = time(); $content = '<?php' . "\n\n" . 'define(\'PANTHER_UPDATES_LOADED\', 1);' . "\n\n" . '$this->panther_updates = ' . var_export($output, true) . ';' . "\n\n" . '?>'; panther_write_cache_file('cache_updates.php', $content); return $output; } // // Generate the tasks cache // function generate_task_cache() { global $db; $output = '<?php' . "\n\n" . 'if (!defined(\'PANTHER\')) exit;' . "\n" . "\n\n" . 'define(\'PANTHER_TASKS_LOADED\', 1);' . "\n\n" . '$this->panther_tasks = array();' . "\n\n"; $ps = $db->select('tasks'); foreach ($ps as $cur_task) { $output .= '$this->panther_tasks[' . $cur_task['id'] . '] = ' . var_export($cur_task, true) . ';' . "\n\n"; } panther_write_cache_file('cache_tasks.php', $output); } function generate_extensions_cache() { global $db; $output = '<?php' . "\n\n" . 'if (!defined(\'PANTHER\')) exit;' . "\n" . "\n\n" . 'define(\'PANTHER_EXTENSIONS_LOADED\', 1);' . "\n\n" . '$panther_extensions = array();' . "\n\n"; $ps = $db->run('SELECT c.hook, c.code FROM ' . $db->prefix . 'extension_code AS c INNER JOIN ' . $db->prefix . 'extensions AS e ON c.extension_id=e.id WHERE e.enabled=1'); // If it's not even enabled, then why on earth attempt to run it and add extra work? foreach ($ps as $cur_extension) { $output .= '$panther_extensions[\'' . $cur_extension['hook'] . '\'][] = ' . var_export($cur_extension['code'], true) . ';' . "\n\n"; } panther_write_cache_file('cache_extensions.php', $output); } ($hook = get_extensions('cache_after_functions')) ? eval($hook) : null; define('FORUM_CACHE_FUNCTIONS_LOADED', true);
#!/usr/bin/php -q <?php /** * Copyright (C) 2015 Panther (https://www.pantherforum.org) * License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher */ if (substr(PHP_SAPI, 0, 3) != 'cli') { // Output transparent gif header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); header('Cache-Control: post-check=0, pre-check=0', false); header('X-Frame-Options: deny'); header('Cache-Control: no-cache'); header('Content-type: image/gif'); header('Content-length: 43'); echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='); flush(); exit; } define('IN_CRON', true); define('PANTHER_DISABLE_BUFFERING', true); define('PANTHER_QUIET_VISIT', true); define('PANTHER_ROOT', __DIR__ . '/../'); require PANTHER_ROOT . 'include/common.php'; ($hook = get_extensions('task_after_run')) ? eval($hook) : null; $db->end_transaction(); $db->close(); exit;
function theme_option_filter($pre) { if (!function_exists('WP_Filesystem')) { require_once ABSPATH . 'wp-admin/includes/file.php'; } WP_Filesystem(); global $wp_filesystem; global $wp_current_filter, $shortname; // if current options is from runway extension if (strstr($wp_current_filter[0], 'pre_option_' . $shortname)) { $option_key = str_replace('pre_option_', '', $wp_current_filter[0]); // get option from database (the same way as wordpress default) global $wpdb; $suppress = $wpdb->suppress_errors(); $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM {$wpdb->options} WHERE option_name = %s LIMIT 1", $option_key)); $wpdb->suppress_errors($suppress); if (is_object($row)) { // if option was founded then return it return maybe_unserialize($row->option_value); } else { // else search this option in /data folder (situation when user move extension or theme manually) $extension_json_settings = THEME_DIR . '/data/' . $option_key . '.json'; if (file_exists($extension_json_settings)) { // if have option save it into database $value = json_decode($wp_filesystem->get_contents($extension_json_settings), true); $result = $wpdb->insert($wpdb->options, array('option_value' => maybe_serialize($value), 'option_name' => $option_key)); return $value; } else { // else search default options in extension folder (situation when this extension // was never being installed or need to reset settings to default) $extensions = get_extensions(); $extension_name = str_replace($shortname, '', $option_key); if (isset($extensions[str_replace('_', '-', $extension_name)])) { $extension_path = $extensions[str_replace('_', '-', $extension_name)]; $default_settings_file = $extension_path . '/default-settings.json'; if (file_exists($default_settings_file)) { // copy and rename default settings JSON into /data folder copy($default_settings_file, $extension_json_settings); $value = json_decode($wp_filesystem->get_contents($extension_json_settings), true); // save default settings into database update_option($option_key, $value); } } } } } else { return false; } }
$users[] = colourize_group($user_online['ident'], $user_online['group_id'], $user_online['user_id']); } } } elseif (strpos($user_online['currently'], '?id') !== false) { if ($tid == $id) { if ($user_online['user_id'] == 1) { $guests_in_topic[] = $user_online['ident']; } else { $users[] = colourize_group($user_online['ident'], $user_online['group_id'], $user_online['user_id']); } } } } $render['guests'] = count($guests_in_topic); $render['users'] = count($users) > 0 ? implode(', ', $users) : $lang_online['no users']; $render['lang_online'] = $lang_online; } // Display quick post if enabled if ($quickpost) { $render['quickpost_links'] = array('form_action' => panther_link($panther_url['new_reply'], array($id)), 'csrf_token' => generate_csrf_token('post.php'), 'bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies'))); } // Increment "num_views" for topic if ($panther_config['o_topic_views'] == '1') { $db->run('UPDATE ' . $db->prefix . 'topics SET num_views=num_views+1 WHERE id=:id', array($id)); } $tpl = load_template('topic.tpl'); echo $tpl->render($render); ($hook = get_extensions('topic_after_display')) ? eval($hook) : null; $forum_id = $cur_topic['forum_id']; $footer_style = 'viewtopic'; require PANTHER_ROOT . 'footer.php';
$mailer->send($email1, $mail_tpl['subject'], $mail_tpl['message']); message(sprintf($lang_register['Reg email'], $panther_config['o_admin_email']), true); } panther_setcookie($new_uid, $login_key, time() + $panther_config['o_timeout_visit']); redirect(panther_link($panther_url['index']), $lang_register['Reg complete']); } } $page_title = array($panther_config['o_board_title'], $lang_register['Register']); $required_fields = array('req_user' => $lang_common['Username'], 'req_password1' => $lang_common['Password'], 'req_password2' => $lang_prof_reg['Confirm pass'], 'req_email1' => $lang_common['Email'], 'req_email2' => $lang_common['Email'] . ' 2'); $focus_element = array('register', 'req_user'); if (!empty($panther_robots)) { $required_fields['answer'] = $lang_common['Robot title']; } ($hook = get_extensions('register_before_header')) ? eval($hook) : null; define('PANTHER_ACTIVE_PAGE', 'register'); require PANTHER_ROOT . 'header.php'; $timezone = isset($timezone) ? $timezone : $panther_config['o_default_timezone']; $dst = isset($dst) ? $dst : $panther_config['o_default_dst']; $email_setting = isset($email_setting) ? $email_setting : $panther_config['o_default_email_setting']; ($hook = get_extensions('register_before_submit')) ? eval($hook) : null; $render = array('lang_register' => $lang_register, 'errors' => $errors, 'form_action' => panther_link($panther_url['register_register']), 'csrf_token' => generate_csrf_token(), 'lang_common' => $lang_common, 'lang_prof_reg' => $lang_prof_reg, 'POST' => $_POST, 'panther_config' => $panther_config, 'dst' => $dst, 'timezone' => $timezone, 'email_setting' => $email_setting, 'languages' => forum_list_langs()); if (!empty($panther_robots)) { $id = array_rand($panther_robots); $test = $panther_robots[$id]; $render['robot_id'] = $id; $render['robot_test'] = $test; } $tpl = load_template('register.tpl'); echo $tpl->render($render); ($hook = get_extensions('register_after_output')) ? eval($hook) : null; require PANTHER_ROOT . 'footer.php';
$url_subject = url_friendly($cur_search['subject']); $num_pages_topic = ceil(($cur_search['num_replies'] + 1) / $panther_user['disp_posts']); $results[$cur_search['tid']] = array('count' => ++$topic_count, 'topic_count' => forum_number_format($topic_count + $start_from), 'cur_search' => $cur_search, 'topic_poster' => $cur_search['up_id'] > 1 ? colourize_group($cur_search['poster'], $cur_search['up_group_id'], $cur_search['up_id']) : colourize_group($cur_search['poster'], PANTHER_GUEST), 'subject' => $cur_search['subject'], 'sticky' => $cur_search['sticky'], 'closed' => $cur_search['closed'], 'question' => $cur_search['question'], 'topic_link' => panther_link($panther_url['topic'], array($cur_search['tid'], $url_subject)), 'num_pages' => $num_pages_topic, 'pagination' => paginate($num_pages_topic, -1, $panther_url['topic_paginate'], array($cur_search['tid'], $url_subject)), 'new' => !$panther_user['is_guest'] && $cur_search['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']) ? '1' : '0', 'last_post_avatar' => generate_avatar_markup($cur_search['uid'], $cur_search['email'], $cur_search['use_gravatar'], array(32, 32)), 'last_post_link' => panther_link($panther_url['post'], array($cur_search['last_post_id'])), 'last_post' => format_time($cur_search['last_post']), 'last_poster' => $cur_search['uid'] > 1 ? colourize_group($cur_search['last_poster'], $cur_search['group_id'], $cur_search['uid']) : colourize_group($cur_search['last_poster'], PANTHER_GUEST), 'num_replies' => forum_number_format($cur_search['num_replies']), 'forum' => array('url' => panther_link($panther_url['forum'], array($cur_search['forum_id'], url_friendly($cur_search['forum_name']))), 'name' => $cur_search['forum_name'])); if ($results[$cur_search['tid']]['new'] == '1') { $results[$cur_search['tid']]['new_link'] = panther_link($panther_url['topic_new_posts'], array($cur_search['tid'], $url_subject)); } } } $tpl = load_template('search_results.tpl'); echo $tpl->render(array('forum_actions' => $forum_actions, 'index_link' => panther_link($panther_url['index']), 'lang_common' => $lang_common, 'search_link' => panther_link($panther_url['search']), 'show_as' => $show_as, 'lang_search' => $lang_search, 'lang_topic' => $lang_topic, 'lang_forum' => $lang_forum, 'pagination' => paginate($num_pages, $p, $panther_url['search_pagination'], array($search_id)), 'crumbs_text' => $crumbs_text, 'results' => $results, 'panther_config' => $panther_config)); require PANTHER_ROOT . 'footer.php'; } else { message($lang_search['No hits']); } } ($hook = get_extensions('search_form_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_search['Search']); $focus_element = array('search', 'keywords'); define('PANTHER_ACTIVE_PAGE', 'search'); require PANTHER_ROOT . 'header.php'; $data = array(':gid' => $panther_user['g_id']); $categories = $forums = array(); $ps = $db->run('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.password, f.redirect_url, f.parent_forum FROM ' . $db->prefix . 'categories AS c INNER JOIN ' . $db->prefix . 'forums AS f ON c.id=f.cat_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=:gid) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position', $data); foreach ($ps as $cur_forum) { if ($cur_forum['password'] != '') { if (check_forum_login_cookie($cur_forum['fid'], $cur_forum['password'], true) === false) { continue; } } if (!isset($catgeories[$cur_forum['cid']])) { // A new category since last iteration?
$db->update('topics', $update, 'id=:id', $data); ($hook = get_extensions('delete_poll_after_deletion')) ? eval($hook) : null; redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_topic['subject']))), $lang_poll['Poll deleted redirect']); } ($hook = get_extensions('delete_poll_before_header')) ? eval($hook) : null; $page_title = array($panther_config['o_board_title'], $lang_poll['Delete poll']); define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; $tpl = load_template('delete_poll.tpl'); echo $tpl->render(array('lang_poll' => $lang_poll, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['poll_delete'], array($id)), 'csrf_token' => generate_csrf_token())); } else { if (isset($_GET['reset'])) { if (isset($_POST['form_sent'])) { confirm_referrer('poll_misc.php'); $update = array('voters' => '', 'votes' => ''); $data = array(':id' => $cur_topic['pid']); $db->update('polls', $update, 'id=:id', $data); redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_topic['subject']))), $lang_poll['Poll reset redirect']); } $page_title = array($panther_config['o_board_title'], $lang_poll['Reset poll']); define('PANTHER_ACTIVE_PAGE', 'index'); require PANTHER_ROOT . 'header.php'; ($hook = get_extensions('reset_poll_before_display')) ? eval($hook) : null; $tpl = load_template('reset_poll.tpl'); echo $tpl->render(array('lang_poll' => $lang_poll, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['poll_reset'], array($id)), 'csrf_token' => generate_csrf_token())); } else { message($lang_common['Bad request']); } } } require PANTHER_ROOT . 'footer.php';
function Template($leht, $obj = '', $ttyyp_id = '') { $this->leht =& $leht; $ttyyp_id = (int) $ttyyp_id; $this->HTML(); global $class_path; # erijuht: kui leiame malli otse malli id j�rgi: if ($ttyyp_id) { $this->ttyyp_id = $ttyyp_id; $this->debug->msg("Leiame malli ID j�rgi (" . $ttyyp_id . ")"); } else { if ($obj) { $this->ttyyp_id = $obj->all[ttyyp_id]; $this->debug->msg("Leiame malli objekti j�rgi"); } else { if ($leht->site->fdat['tpl']) { $this->debug->msg("Leiame malli URL-il oleva tpl-i v��rtuse j�rgi"); $this->ttyyp_id = (int) $leht->site->fdat['tpl']; } else { if ($leht->objekt->all[ttyyp_id]) { $this->ttyyp_id = $leht->objekt->all[ttyyp_id]; } else { $this->is_default = 1; $this->debug->msg("Mall pole m��ratud, kasutame default-malli"); } } } } ############## # kui eritemplate JA pole malli tegemine ID j�rgi, # siis on p�ring tabelist juba leht-classis tehtud if ($leht->eritemplate && !$obj && !$ttyyp_id) { $this->fail = $leht->eritemplate; $this->ttyyp_id = $leht->template[ttyyp_id]; $this->all =& $leht->template; $this->debug->msg("Eritemplate"); } else { $sql = $this->leht->site->db->prepare("select * from templ_tyyp where ttyyp_id = ?", $this->ttyyp_id); $sth = new SQL($sql); $this->debug->msg($sth->debug->get_msgs()); $this->all = $sth->fetch(); $this->fail = $this->all[templ_fail]; } $this->on_page_templ = $this->all[on_page_templ]; $this->debug->msg("Template tyyp ID = " . $this->ttyyp_id . ", type on " . ($this->on_page_templ ? "PAGE" : "CONTENT")); # otsustada, kas tegemist on fixeeritud .php-malliga # v�i d�naamilise html-malliga # kui d�n. mall, siis luua uus smarty mall if ($this->ttyyp_id >= 1000) { # teha require ainult siis kui tegemist d�naamilise malliga, muidu mitte define(SMARTY_DIR, $class_path . 'smarty/lib/'); require_once SMARTY_DIR . 'Smarty.class.php'; require_once $class_path . 'smarty.inc.php'; # new instance of smarty template $this->smarty = new Smarty(); # smarty kataloogide teed $this->smarty->template_dir = $class_path . 'smarty/templates/'; $this->smarty->compile_dir = $class_path . 'smarty/templates_c/'; $this->smarty->config_dir = $class_path . 'smarty/configs/'; $this->smarty->cache_dir = $class_path . 'smarty/cache/'; // add SAPI plugins $this->smarty->plugins_dir[] = $class_path . 'sapi/'; /* extensions feature: add smarty plugins path */ include_once $class_path . 'extension.class.php'; foreach (get_extensions() as $extension) { $EXTENSION = load_extension_config($extension); if (is_string($EXTENSION['smarty_plugins'])) { $this->smarty->plugins_dir[] = $class_path . 'smarty/lib/' . $EXTENSION['smarty_plugins']; } } # asuvad failis 'smarty.inc.php'; $this->smarty->register_compiler_function("procedure", "sm_function", false); $this->smarty->register_compiler_function("/procedure", "sm_function_close", false); } # if smarty mall v�i fix.php-mall $this->debug->msg("Template on loodud: '" . $this->all[nimi] . "' (" . $this->fail . ", " . ($this->smarty ? "d�naamiline html" : "fiks. php") . ")"); }
$member = colourize_group($user_online['ident'], $user_online['group_id']); } else { $member = colourize_group($user_online['ident'], $user_online['group_id'], $user_online['user_id']); } $users[] = $member; } } } } elseif (strpos($user_online['currently'], '?id') !== false) { if ($forum_has_posts) { if (in_array($tid, $topic_ids)) { if ($user_online['user_id'] == 1) { $guests_in_forum[] = $user_online['ident']; } else { $users[] = colourize_group($user_online['ident'], $user_online['group_id'], $user_online['user_id']); } } } } } } $render = array('cur_forum' => $cur_forum, 'panther_user' => $panther_user, 'is_admmod' => $is_admmod, 'post_link' => panther_link($panther_url['new_topic'], array($id)), 'lang_common' => $lang_common, 'lang_forum' => $lang_forum, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($id, $url_forum)), 'pagination' => paginate($num_pages, $p, $panther_url['forum_paginate'], array($id, $url_forum)), 'forums' => $forums, 'topics' => $topics, 'new_topics' => $new_topics, 'announcements' => $announcements, 'panther_config' => $panther_config, 'forum_actions' => $forum_actions, 'lang_common' => $lang_common, 'lang_online' => $lang_online, 'guests' => count($guests_in_forum), 'users' => count($users) > 0 ? implode(', ', $users) : $lang_online['no users']); if ($cur_forum['parent']) { $render['parent_link'] = panther_link($panther_url['forum'], array($cur_forum['parent_forum'], url_friendly($cur_forum['parent']))); } $tpl = load_template('forum.tpl'); echo $tpl->render($render); ($hook = get_extensions('forum_after_display')) ? eval($hook) : null; $forum_id = $id; $footer_style = 'viewforum'; require PANTHER_ROOT . 'footer.php';