Zeile 84 | Zeile 84 |
---|
}
// Load basic theme information that we could be needing.
|
}
// Load basic theme information that we could be needing.
|
| if($loadstyle != "def='1'") { $query = $db->simple_select('themes', 'name, tid, properties, allowedgroups', $loadstyle, array('limit' => 1)); $theme = $db->fetch_array($query);
if(isset($theme['tid']) && !is_member($theme['allowedgroups']) && $theme['allowedgroups'] != 'all') { if(isset($mybb->cookies['mybbtheme'])) { my_unsetcookie('mybbtheme'); }
$loadstyle = "def='1'"; } }
|
if($loadstyle == "def='1'") { if(!$cache->read('default_theme')) { $cache->update_default_theme(); }
|
if($loadstyle == "def='1'") { if(!$cache->read('default_theme')) { $cache->update_default_theme(); }
|
|
|
$theme = $cache->read('default_theme');
|
$theme = $cache->read('default_theme');
|
} else { $query = $db->simple_select("themes", "name, tid, properties", $loadstyle); $theme = $db->fetch_array($query);
| |
}
// No theme was found - we attempt to load the master or any other theme
| }
// No theme was found - we attempt to load the master or any other theme
|
Zeile 116 | Zeile 128 |
---|
{ // If a language directory for the current language exists within the theme - we use it if(!empty($mybb->user['language']))
|
{ // If a language directory for the current language exists within the theme - we use it if(!empty($mybb->user['language']))
|
{ $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
| { $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
|
} else { // Check if a custom language directory exists for this theme if(!empty($mybb->settings['bblanguage']))
|
} else { // Check if a custom language directory exists for this theme if(!empty($mybb->settings['bblanguage']))
|
{ $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage']; } // Otherwise, the image language directory is the same as the language directory for the theme else {
| { $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage']; } // Otherwise, the image language directory is the same as the language directory for the theme else {
|
$theme['imglangdir'] = $theme['imgdir']; } }
| $theme['imglangdir'] = $theme['imgdir']; } }
|
Zeile 138 | Zeile 150 |
---|
$img_directory = $theme['imgdir'];
if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
|
$img_directory = $theme['imgdir'];
if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
|
{ $img_directory = rtrim($mybb->settings['cdnpath'], '/') . '/' . ltrim($theme['imgdir'], '/'); }
| { $img_directory = rtrim($mybb->settings['cdnpath'], '/') . '/' . ltrim($theme['imgdir'], '/'); }
|
if(!@is_dir($img_directory)) { $theme['imgdir'] = 'images';
| if(!@is_dir($img_directory)) { $theme['imgdir'] = 'images';
|
Zeile 149 | Zeile 161 |
---|
// If a language directory for the current language exists within the theme - we use it if(!empty($mybb->user['language']) && is_dir($img_directory.'/'.$mybb->user['language']))
|
// If a language directory for the current language exists within the theme - we use it if(!empty($mybb->user['language']) && is_dir($img_directory.'/'.$mybb->user['language']))
|
{ $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
| { $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
|
} else {
| } else {
|
Zeile 162 | Zeile 174 |
---|
// Otherwise, the image language directory is the same as the language directory for the theme else {
|
// Otherwise, the image language directory is the same as the language directory for the theme else {
|
$theme['imglangdir'] = $theme['imgdir'];
| $theme['imglangdir'] = $theme['imgdir'];
|
} }
|
} }
|
|
|
$theme['imgdir'] = $mybb->get_asset_url($theme['imgdir']); $theme['imglangdir'] = $mybb->get_asset_url($theme['imglangdir']); }
$templatelist = "postbit_editedby,xmlhttp_buddyselect_online,xmlhttp_buddyselect_offline,xmlhttp_buddyselect"; $templates->cache($db->escape_string($templatelist));
|
$theme['imgdir'] = $mybb->get_asset_url($theme['imgdir']); $theme['imglangdir'] = $mybb->get_asset_url($theme['imglangdir']); }
$templatelist = "postbit_editedby,xmlhttp_buddyselect_online,xmlhttp_buddyselect_offline,xmlhttp_buddyselect"; $templates->cache($db->escape_string($templatelist));
|
|
|
if($lang->settings['charset']) { $charset = $lang->settings['charset'];
| if($lang->settings['charset']) { $charset = $lang->settings['charset'];
|
Zeile 185 | Zeile 197 |
---|
$lang->load("global"); $lang->load("xmlhttp");
|
$lang->load("global"); $lang->load("xmlhttp");
|
| $closed_bypass = array("refresh_captcha", "validate_captcha");
$mybb->input['action'] = $mybb->get_input('action');
|
$plugins->run_hooks("xmlhttp");
|
$plugins->run_hooks("xmlhttp");
|
$mybb->input['action'] = $mybb->get_input('action');
| // If the board is closed, the user is not an administrator and they're not trying to login, show the board closed message if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['canviewboardclosed'] != 1 && !in_array($mybb->input['action'], $closed_bypass)) { // Show error if(!$mybb->settings['boardclosed_reason']) { $mybb->settings['boardclosed_reason'] = $lang->boardclosed_reason; }
$lang->error_boardclosed .= "<br /><em>{$mybb->settings['boardclosed_reason']}</em>";
xmlhttp_error($lang->error_boardclosed); }
|
// Fetch a list of usernames beginning with a certain string (used for auto completion) if($mybb->input['action'] == "get_users") { $mybb->input['query'] = ltrim($mybb->get_input('query'));
|
// Fetch a list of usernames beginning with a certain string (used for auto completion) if($mybb->input['action'] == "get_users") { $mybb->input['query'] = ltrim($mybb->get_input('query'));
|
// If the string is less than 3 characters, quit. if(my_strlen($mybb->input['query']) < 3)
| // If the string is less than 2 characters, quit. if(my_strlen($mybb->input['query']) < 2)
|
{ exit; }
| { exit; }
|
Zeile 238 | Zeile 266 |
---|
$user['username'] = htmlspecialchars_uni($user['username']); $data[] = array('id' => $user['username'], 'text' => $user['username']); }
|
$user['username'] = htmlspecialchars_uni($user['username']); $data[] = array('id' => $user['username'], 'text' => $user['username']); }
|
}
| }
|
$plugins->run_hooks("xmlhttp_get_users_end");
echo json_encode($data);
| $plugins->run_hooks("xmlhttp_get_users_end");
echo json_encode($data);
|
Zeile 250 | Zeile 278 |
---|
{ // Verify POST request if(!verify_post_check($mybb->get_input('my_post_key'), true))
|
{ // Verify POST request if(!verify_post_check($mybb->get_input('my_post_key'), true))
|
{
| {
|
xmlhttp_error($lang->invalid_post_code); }
| xmlhttp_error($lang->invalid_post_code); }
|
Zeile 260 | Zeile 288 |
---|
// Fetch the thread. $thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT)); if(!$thread)
|
// Fetch the thread. $thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT)); if(!$thread)
|
{
| {
|
xmlhttp_error($lang->thread_doesnt_exist); }
| xmlhttp_error($lang->thread_doesnt_exist); }
|
Zeile 303 | Zeile 331 |
---|
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0) { xmlhttp_error($lang->no_permission_edit_subject);
|
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0) { xmlhttp_error($lang->no_permission_edit_subject);
|
}
| }
|
// If we're past the edit time limit - don't allow editing. else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60))) {
| // If we're past the edit time limit - don't allow editing. else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60))) {
|
Zeile 311 | Zeile 339 |
---|
xmlhttp_error($lang->edit_time_limit); } $ismod = false;
|
xmlhttp_error($lang->edit_time_limit); } $ismod = false;
|
} else
| } else
|
{ $ismod = true; }
| { $ismod = true; }
|
Zeile 330 | Zeile 358 |
---|
else if(my_strtolower($charset) == "iso-8859-1") { $subject = utf8_decode($subject);
|
else if(my_strtolower($charset) == "iso-8859-1") { $subject = utf8_decode($subject);
|
} }
// Set up posthandler. require_once MYBB_ROOT."inc/datahandlers/post.php"; $posthandler = new PostDataHandler("update"); $posthandler->action = "post";
// Set the post data that came from the input to the $post array. $updatepost = array( "pid" => $post['pid'], "tid" => $thread['tid'], "subject" => $subject, "edit_uid" => $mybb->user['uid'] ); $posthandler->set_data($updatepost);
// Now let the post handler do all the hard work. if(!$posthandler->validate_post()) { $post_errors = $posthandler->get_friendly_errors(); xmlhttp_error($post_errors); } // No errors were found, we can call the update method. else { $posthandler->update_post(); if($ismod == true) { $modlogdata = array( "tid" => $thread['tid'], "fid" => $forum['fid'] ); log_moderator_action($modlogdata, $lang->edited_post); } }
require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
// Send our headers.
| } }
// Only edit subject if subject has actually been changed if($thread['subject'] != $subject) { // Set up posthandler. require_once MYBB_ROOT."inc/datahandlers/post.php"; $posthandler = new PostDataHandler("update"); $posthandler->action = "post";
// Set the post data that came from the input to the $post array. $updatepost = array( "pid" => $post['pid'], "tid" => $thread['tid'], "prefix" => $thread['prefix'], "subject" => $subject, "edit_uid" => $mybb->user['uid'] ); $posthandler->set_data($updatepost);
// Now let the post handler do all the hard work. if(!$posthandler->validate_post()) { $post_errors = $posthandler->get_friendly_errors(); xmlhttp_error($post_errors); } // No errors were found, we can call the update method. else { $posthandler->update_post(); if($ismod == true) { $modlogdata = array( "tid" => $thread['tid'], "fid" => $forum['fid'] ); log_moderator_action($modlogdata, $lang->edited_post); } } }
require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
// Send our headers.
|
header("Content-type: application/json; charset={$charset}");
$plugins->run_hooks("xmlhttp_edit_subject_end");
| header("Content-type: application/json; charset={$charset}");
$plugins->run_hooks("xmlhttp_edit_subject_end");
|
Zeile 403 | Zeile 436 |
---|
// Missing thread, invalid forum? Error. if(!$thread || !$forum || $forum['type'] != "f")
|
// Missing thread, invalid forum? Error. if(!$thread || !$forum || $forum['type'] != "f")
|
{
| {
|
xmlhttp_error($lang->thread_doesnt_exist);
|
xmlhttp_error($lang->thread_doesnt_exist);
|
| }
// Check if this forum is password protected and we have a valid password if(check_forum_password($forum['fid'], 0, true)) { xmlhttp_error($lang->wrong_forum_password);
|
}
// Fetch forum permissions.
| }
// Fetch forum permissions.
|
Zeile 424 | Zeile 463 |
---|
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0 || $mybb->user['suspendposting'] == 1) { xmlhttp_error($lang->no_permission_edit_post);
|
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0 || $mybb->user['suspendposting'] == 1) { xmlhttp_error($lang->no_permission_edit_post);
|
}
| }
|
// If we're past the edit time limit - don't allow editing. else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60))) {
| // If we're past the edit time limit - don't allow editing. else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60))) {
|
Zeile 435 | Zeile 474 |
---|
if($post['visible'] == 0) { xmlhttp_error($lang->post_moderation);
|
if($post['visible'] == 0) { xmlhttp_error($lang->post_moderation);
|
}
// Forum is closed - no editing allowed if($forum['open'] == 0) { xmlhttp_error($lang->no_permission_edit_post);
| |
} }
| } }
|
Zeile 449 | Zeile 482 |
---|
if($mybb->get_input('do') == "get_post") { // Send our headers.
|
if($mybb->get_input('do') == "get_post") { // Send our headers.
|
//header("Content-type: text/xml; charset={$charset}"); header("Content-type: text/html; charset={$charset}");
//$post['message'] = htmlspecialchars_uni($post['message']);
| header("Content-type: application/json; charset={$charset}");
|
// Send the contents of the post.
|
// Send the contents of the post.
|
echo $post['message'];
| echo json_encode($post['message']);
|
exit; } else if($mybb->get_input('do') == "update_post") { // Verify POST request if(!verify_post_check($mybb->get_input('my_post_key'), true))
|
exit; } else if($mybb->get_input('do') == "update_post") { // Verify POST request if(!verify_post_check($mybb->get_input('my_post_key'), true))
|
{
| {
|
xmlhttp_error($lang->invalid_post_code); }
| xmlhttp_error($lang->invalid_post_code); }
|
Zeile 484 | Zeile 514 |
---|
{ $message = utf8_decode($message); $editreason = utf8_decode($editreason);
|
{ $message = utf8_decode($message); $editreason = utf8_decode($editreason);
|
}
| }
|
}
// Set up posthandler.
| }
// Set up posthandler.
|
Zeile 499 | Zeile 529 |
---|
"editreason" => $editreason, "edit_uid" => $mybb->user['uid'] );
|
"editreason" => $editreason, "edit_uid" => $mybb->user['uid'] );
|
| // If this is the first post set the prefix. If a forum requires a prefix the quick edit would throw an error otherwise if($post['pid'] == $thread['firstpost']) { $updatepost['prefix'] = $thread['prefix']; }
|
$posthandler->set_data($updatepost);
// Now let the post handler do all the hard work.
| $posthandler->set_data($updatepost);
// Now let the post handler do all the hard work.
|
Zeile 506 | Zeile 543 |
---|
{ $post_errors = $posthandler->get_friendly_errors(); xmlhttp_error($post_errors);
|
{ $post_errors = $posthandler->get_friendly_errors(); xmlhttp_error($post_errors);
|
}
| }
|
// No errors were found, we can call the update method. else {
| // No errors were found, we can call the update method. else {
|
Zeile 549 | Zeile 586 |
---|
if($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0) { $parser_options['allow_imgcode'] = 0;
|
if($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0) { $parser_options['allow_imgcode'] = 0;
|
}
| }
|
if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0) {
| if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0) {
|
Zeile 747 | Zeile 784 |
---|
else if($mybb->input['action'] == "refresh_question" && $mybb->settings['securityquestion']) { header("Content-type: application/json; charset={$charset}");
|
else if($mybb->input['action'] == "refresh_question" && $mybb->settings['securityquestion']) { header("Content-type: application/json; charset={$charset}");
|
|
|
$sid = $db->escape_string($mybb->get_input('question_id')); $query = $db->query(" SELECT q.qid, s.sid
|
$sid = $db->escape_string($mybb->get_input('question_id')); $query = $db->query(" SELECT q.qid, s.sid
|
FROM ".TABLE_PREFIX."questionsessions s LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid) WHERE q.active='1' AND s.sid='{$sid}' "); if($db->num_rows($query) == 0)
| FROM ".TABLE_PREFIX."questionsessions s LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid) WHERE q.active='1' AND s.sid='{$sid}' ");
if($db->num_rows($query) == 0)
|
{ xmlhttp_error($lang->answer_valid_not_exists); }
|
{ xmlhttp_error($lang->answer_valid_not_exists); }
|
|
|
$qsession = $db->fetch_array($query);
|
$qsession = $db->fetch_array($query);
|
|
|
// Delete previous question session $db->delete_query("questionsessions", "sid='$sid'");
|
// Delete previous question session $db->delete_query("questionsessions", "sid='$sid'");
|
|
|
require_once MYBB_ROOT."inc/functions_user.php";
|
require_once MYBB_ROOT."inc/functions_user.php";
|
|
|
$sid = generate_question($qsession['qid']); $query = $db->query(" SELECT q.question, s.sid
| $sid = generate_question($qsession['qid']); $query = $db->query(" SELECT q.question, s.sid
|
Zeile 775 | Zeile 812 |
---|
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid) WHERE q.active='1' AND s.sid='{$sid}' AND q.qid!='{$qsession['qid']}' ");
|
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid) WHERE q.active='1' AND s.sid='{$sid}' AND q.qid!='{$qsession['qid']}' ");
|
|
|
$plugins->run_hooks("xmlhttp_refresh_question");
|
$plugins->run_hooks("xmlhttp_refresh_question");
|
|
|
if($db->num_rows($query) > 0) { $question = $db->fetch_array($query);
|
if($db->num_rows($query) > 0) { $question = $db->fetch_array($query);
|
|
|
echo json_encode(array("question" => htmlspecialchars_uni($question['question']), 'sid' => htmlspecialchars_uni($question['sid'])));
|
echo json_encode(array("question" => htmlspecialchars_uni($question['question']), 'sid' => htmlspecialchars_uni($question['sid'])));
|
exit; } else { xmlhttp_error($lang->answer_valid_not_exists);
| exit; } else { xmlhttp_error($lang->answer_valid_not_exists);
|
} } elseif($mybb->input['action'] == "validate_question" && $mybb->settings['securityquestion'])
| } } elseif($mybb->input['action'] == "validate_question" && $mybb->settings['securityquestion'])
|
Zeile 795 | Zeile 832 |
---|
header("Content-type: application/json; charset={$charset}"); $sid = $db->escape_string($mybb->get_input('question')); $answer = $db->escape_string($mybb->get_input('answer'));
|
header("Content-type: application/json; charset={$charset}"); $sid = $db->escape_string($mybb->get_input('question')); $answer = $db->escape_string($mybb->get_input('answer'));
|
|
|
$query = $db->query(" SELECT q.*, s.sid FROM ".TABLE_PREFIX."questionsessions s LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid) WHERE q.active='1' AND s.sid='{$sid}' ");
|
$query = $db->query(" SELECT q.*, s.sid FROM ".TABLE_PREFIX."questionsessions s LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid) WHERE q.active='1' AND s.sid='{$sid}' ");
|
|
|
if($db->num_rows($query) == 0) { echo json_encode($lang->answer_valid_not_exists);
| if($db->num_rows($query) == 0) { echo json_encode($lang->answer_valid_not_exists);
|
Zeile 813 | Zeile 850 |
---|
$question = $db->fetch_array($query); $valid_answers = preg_split("/\r\n|\n|\r/", $question['answer']); $validated = 0;
|
$question = $db->fetch_array($query); $valid_answers = preg_split("/\r\n|\n|\r/", $question['answer']); $validated = 0;
|
|
|
foreach($valid_answers as $answers) { if(my_strtolower($answers) == my_strtolower($answer))
| foreach($valid_answers as $answers) { if(my_strtolower($answers) == my_strtolower($answer))
|
Zeile 821 | Zeile 858 |
---|
$validated = 1; } }
|
$validated = 1; } }
|
|
|
$plugins->run_hooks("xmlhttp_validate_question");
if($validated != 1)
| $plugins->run_hooks("xmlhttp_validate_question");
if($validated != 1)
|
Zeile 870 | Zeile 907 |
---|
$username = $mybb->get_input('username');
// Fix bad characters
|
$username = $mybb->get_input('username');
// Fix bad characters
|
$username = trim($username);
| $username = trim_blank_chrs($username);
|
$username = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);
// Remove multiple spaces from the username
| $username = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);
// Remove multiple spaces from the username
|
Zeile 893 | Zeile 930 |
---|
}
// Check for certain characters in username (<, >, &, and slashes)
|
}
// Check for certain characters in username (<, >, &, and slashes)
|
if(strpos($username, "<") !== false || strpos($username, ">") !== false || strpos($username, "&") !== false || my_strpos($username, "\\") !== false || strpos($username, ";") !== false || !validate_utf8_string($username, false, false))
| if(strpos($username, "<") !== false || strpos($username, ">") !== false || strpos($username, "&") !== false || my_strpos($username, "\\") !== false || strpos($username, ";") !== false || strpos($username, ",") !== false || !validate_utf8_string($username, false, false))
|
{ echo json_encode($lang->banned_characters_username); exit;
| { echo json_encode($lang->banned_characters_username); exit;
|
Zeile 1001 | Zeile 1038 |
---|
/** * Spits an XML Http based error message back to the browser *
|
/** * Spits an XML Http based error message back to the browser *
|
* @param string The message to send back.
| * @param string $message The message to send back.
|
*/ function xmlhttp_error($message) {
| */ function xmlhttp_error($message) {
|