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 112 | Zeile 124 |
---|
// Set the appropriate image language directory for this theme. // Are we linking to a remote theme server?
|
// Set the appropriate image language directory for this theme. // Are we linking to a remote theme server?
|
if(my_substr($theme['imgdir'], 0, 7) == 'http://' || my_substr($theme['imgdir'], 0, 8) == 'https://')
| if(my_validate_url($theme['imgdir']))
|
{ // 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']))
|
Zeile 123 | Zeile 135 |
---|
{ // Check if a custom language directory exists for this theme if(!empty($mybb->settings['bblanguage']))
|
{ // Check if a custom language directory exists for this theme if(!empty($mybb->settings['bblanguage']))
|
{ $theme['imglangdir'] = $theme['imgdir'].'/'.$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 {
| // Otherwise, the image language directory is the same as the language directory for the theme else {
|
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 151 | Zeile 163 |
---|
if(!empty($mybb->user['language']) && is_dir($img_directory.'/'.$mybb->user['language'])) { $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
|
if(!empty($mybb->user['language']) && is_dir($img_directory.'/'.$mybb->user['language'])) { $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
|
} else
| } else
|
{ // Check if a custom language directory exists for this theme if(is_dir($img_directory.'/'.$mybb->settings['bblanguage']))
|
{ // Check if a custom language directory exists for this theme if(is_dir($img_directory.'/'.$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 179 | Zeile 191 |
---|
} // If not, revert to UTF-8 else
|
} // If not, revert to UTF-8 else
|
{
| {
|
$charset = "UTF-8";
|
$charset = "UTF-8";
|
}
| }
|
$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")
|
// 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'));
|
$mybb->input['query'] = ltrim($mybb->get_input('query'));
|
// If the string is less than 3 characters, quit. if(my_strlen($mybb->input['query']) < 3)
| $search_type = $mybb->get_input('search_type', MyBB::INPUT_INT); // 0: starts with, 1: ends with, 2: contains
// If the string is less than 2 characters, quit. if(my_strlen($mybb->input['query']) < 2)
|
{ exit; }
| { exit; }
|
Zeile 208 | Zeile 237 |
---|
else { $limit = 15;
|
else { $limit = 15;
|
}
| }
|
// Send our headers. header("Content-type: application/json; charset={$charset}");
| // Send our headers. header("Content-type: application/json; charset={$charset}");
|
Zeile 223 | Zeile 252 |
---|
$plugins->run_hooks("xmlhttp_get_users_start");
|
$plugins->run_hooks("xmlhttp_get_users_start");
|
$query = $db->simple_select("users", "uid, username", "username LIKE '".$db->escape_string_like($mybb->input['query'])."%'", $query_options); if($limit == 1)
| $likestring = $db->escape_string_like($mybb->input['query']); if($search_type == 1) { $likestring = '%'.$likestring; } elseif($search_type == 2) { $likestring = '%'.$likestring.'%'; } else { $likestring .= '%'; }
$query = $db->simple_select("users", "uid, username", "username LIKE '{$likestring}'", $query_options); if($limit == 1)
|
{ $user = $db->fetch_array($query);
|
{ $user = $db->fetch_array($query);
|
$user['username'] = htmlspecialchars_uni($user['username']); $data = array('id' => $user['username'], 'text' => $user['username']);
| $data = array('uid' => $user['uid'], 'id' => $user['username'], 'text' => $user['username']);
|
} else { $data = array(); while($user = $db->fetch_array($query))
|
} else { $data = array(); while($user = $db->fetch_array($query))
|
{ $user['username'] = htmlspecialchars_uni($user['username']); $data[] = array('id' => $user['username'], 'text' => $user['username']); } }
| { $data[] = array('uid' => $user['uid'], '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 252 | Zeile 293 |
---|
if(!verify_post_check($mybb->get_input('my_post_key'), true)) { xmlhttp_error($lang->invalid_post_code);
|
if(!verify_post_check($mybb->get_input('my_post_key'), true)) { xmlhttp_error($lang->invalid_post_code);
|
}
| }
|
// We're editing a thread subject. if($mybb->get_input('tid', MyBB::INPUT_INT))
| // We're editing a thread subject. if($mybb->get_input('tid', MyBB::INPUT_INT))
|
Zeile 266 | Zeile 307 |
---|
// Fetch some of the information from the first post of this thread. $query_options = array(
|
// Fetch some of the information from the first post of this thread. $query_options = array(
|
"order_by" => "dateline", "order_dir" => "asc",
| "order_by" => "dateline, pid",
|
); $query = $db->simple_select("posts", "pid,uid,dateline", "tid='".$thread['tid']."'", $query_options); $post = $db->fetch_array($query);
| ); $query = $db->simple_select("posts", "pid,uid,dateline", "tid='".$thread['tid']."'", $query_options); $post = $db->fetch_array($query);
|
Zeile 303 | Zeile 343 |
---|
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))) {
|
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']); xmlhttp_error($lang->edit_time_limit); } $ismod = false; } else
|
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']); xmlhttp_error($lang->edit_time_limit); } $ismod = false; } else
|
{
| {
|
$ismod = true; } $subject = $mybb->get_input('value'); if(my_strtolower($charset) != "utf-8") { if(function_exists("iconv"))
|
$ismod = true; } $subject = $mybb->get_input('value'); if(my_strtolower($charset) != "utf-8") { if(function_exists("iconv"))
|
{
| {
|
$subject = iconv($charset, "UTF-8//IGNORE", $subject);
|
$subject = iconv($charset, "UTF-8//IGNORE", $subject);
|
}
| }
|
else if(function_exists("mb_convert_encoding"))
|
else if(function_exists("mb_convert_encoding"))
|
{
| {
|
$subject = @mb_convert_encoding($subject, $charset, "UTF-8");
|
$subject = @mb_convert_encoding($subject, $charset, "UTF-8");
|
}
| }
|
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)
| // 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'], "fid" => $forum['fid'], "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
|
{
|
{
|
$modlogdata = array( "tid" => $thread['tid'], "fid" => $forum['fid'] ); log_moderator_action($modlogdata, $lang->edited_post);
| $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;
|
} }
require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
|
|
|
// Send our headers. header("Content-type: application/json; charset={$charset}");
| // Send our headers. header("Content-type: application/json; charset={$charset}");
|
Zeile 390 | Zeile 436 |
---|
$post = get_post($mybb->get_input('pid', MyBB::INPUT_INT));
// No result, die.
|
$post = get_post($mybb->get_input('pid', MyBB::INPUT_INT));
// No result, die.
|
if(!$post)
| if(!$post || $post['visible'] == -1)
|
{ xmlhttp_error($lang->post_doesnt_exist); }
// Fetch the thread associated with this post. $thread = get_thread($post['tid']);
|
{ xmlhttp_error($lang->post_doesnt_exist); }
// Fetch the thread associated with this post. $thread = get_thread($post['tid']);
|
|
|
// Fetch the specific forum this thread/post is in. $forum = get_forum($thread['fid']);
|
// Fetch the specific forum this thread/post is in. $forum = get_forum($thread['fid']);
|
|
|
// 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 431 | Zeile 483 |
---|
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']); xmlhttp_error($lang->edit_time_limit); }
|
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']); xmlhttp_error($lang->edit_time_limit); }
|
// User can't edit unapproved post if($post['visible'] == 0)
| // User can't edit unapproved post unless permitted for own if($post['visible'] == 0 && !($mybb->settings['showownunapproved'] && $post['uid'] == $mybb->user['uid']))
|
{ xmlhttp_error($lang->post_moderation);
|
{ 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 495 |
---|
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")
| exit; } else if($mybb->get_input('do') == "update_post")
|
Zeile 464 | Zeile 507 |
---|
if(!verify_post_check($mybb->get_input('my_post_key'), true)) { xmlhttp_error($lang->invalid_post_code);
|
if(!verify_post_check($mybb->get_input('my_post_key'), true)) { xmlhttp_error($lang->invalid_post_code);
|
}
| }
|
$message = $mybb->get_input('value'); $editreason = $mybb->get_input('editreason'); if(my_strtolower($charset) != "utf-8")
| $message = $mybb->get_input('value'); $editreason = $mybb->get_input('editreason'); if(my_strtolower($charset) != "utf-8")
|
Zeile 499 | Zeile 542 |
---|
"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 540 | Zeile 590 |
---|
"me_username" => $post['username'], "filter_badwords" => 1 );
|
"me_username" => $post['username'], "filter_badwords" => 1 );
|
| $post['username'] = htmlspecialchars_uni($post['username']);
|
if($post['smilieoff'] == 1)
|
if($post['smilieoff'] == 1)
|
{
| {
|
$parser_options['allow_smilies'] = 0;
|
$parser_options['allow_smilies'] = 0;
|
}
if($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)
| }
if($mybb->user['uid'] != 0 && $mybb->user['showimages'] != 1 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)
|
{ $parser_options['allow_imgcode'] = 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['uid'] != 0 && $mybb->user['showvideos'] != 1 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
|
{ $parser_options['allow_videocode'] = 0; }
|
{ $parser_options['allow_videocode'] = 0; }
|
|
|
$post['message'] = $parser->parse_message($message, $parser_options);
// Now lets fetch all of the attachments for these posts.
| $post['message'] = $parser->parse_message($message, $parser_options);
// Now lets fetch all of the attachments for these posts.
|
Zeile 565 | Zeile 617 |
---|
while($attachment = $db->fetch_array($query)) { $attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
|
while($attachment = $db->fetch_array($query)) { $attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
|
}
| }
|
require_once MYBB_ROOT."inc/functions_post.php";
| require_once MYBB_ROOT."inc/functions_post.php";
|
Zeile 578 | Zeile 630 |
---|
{ $post['editdate'] = my_date('relative', TIME_NOW); $post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate']);
|
{ $post['editdate'] = my_date('relative', TIME_NOW); $post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate']);
|
| $mybb->user['username'] = htmlspecialchars_uni($mybb->user['username']);
|
$post['editedprofilelink'] = build_profile_link($mybb->user['username'], $mybb->user['uid']); $post['editreason'] = trim($editreason); $editreason = "";
| $post['editedprofilelink'] = build_profile_link($mybb->user['username'], $mybb->user['uid']); $post['editreason'] = trim($editreason); $editreason = "";
|
Zeile 644 | Zeile 697 |
---|
{ $inactiveforums = "AND t.fid NOT IN ({$inactiveforums})"; }
|
{ $inactiveforums = "AND t.fid NOT IN ({$inactiveforums})"; }
|
| // Check group permissions if we can't view threads not started by us $group_permissions = forum_permissions(); $onlyusfids = array(); foreach($group_permissions as $gpfid => $forum_permissions) { if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $gpfid; } }
|
$message = '';
// Are we loading all quoted posts or only those not in the current thread?
| $message = '';
// Are we loading all quoted posts or only those not in the current thread?
|
Zeile 654 | Zeile 719 |
---|
else { $from_tid = '';
|
else { $from_tid = '';
|
}
require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
| }
require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
|
require_once MYBB_ROOT."inc/functions_posting.php";
| require_once MYBB_ROOT."inc/functions_posting.php";
|
Zeile 665 | Zeile 730 |
---|
// Query for any posts in the list which are not within the specified thread $query = $db->query("
|
// Query for any posts in the list which are not within the specified thread $query = $db->query("
|
SELECT p.subject, p.message, p.pid, p.tid, p.username, p.dateline, t.fid, p.visible, u.username AS userusername
| SELECT p.subject, p.message, p.pid, p.tid, p.username, p.dateline, t.fid, t.uid AS thread_uid, p.visible, u.username AS userusername
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid) LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE {$from_tid}p.pid IN ({$quoted_posts}) {$unviewable_forums} {$inactiveforums}
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid) LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE {$from_tid}p.pid IN ({$quoted_posts}) {$unviewable_forums} {$inactiveforums}
|
ORDER BY p.dateline
| ORDER BY p.dateline, p.pid
|
"); while($quoted_post = $db->fetch_array($query))
|
"); while($quoted_post = $db->fetch_array($query))
|
{ if(!is_moderator($quoted_post['fid'], "canviewunapprove") && $quoted_post['visible'] == 0)
| { if( (!is_moderator($quoted_post['fid'], "canviewunapprove") && $quoted_post['visible'] == 0) || (!is_moderator($quoted_post['fid'], "canviewdeleted") && $quoted_post['visible'] == -1) || (in_array($quoted_post['fid'], $onlyusfids) && (!$mybb->user['uid'] || $quoted_post['thread_uid'] != $mybb->user['uid'])) )
|
{
|
{
|
continue;
| // Allow quoting from own unapproved post if($quoted_post['visible'] == 0 && !($mybb->settings['showownunapproved'] && $quoted_post['uid'] == $mybb->user['uid'])) { continue; }
|
}
$message .= parse_quoted_message($quoted_post, false);
|
}
$message .= parse_quoted_message($quoted_post, false);
|
}
| }
|
if($mybb->settings['maxquotedepth'] != '0') { $message = remove_message_quotes($message); }
// Send our headers.
|
if($mybb->settings['maxquotedepth'] != '0') { $message = remove_message_quotes($message); }
// Send our headers.
|
header("Content-type: application/json; charset={$charset}");
| header("Content-type: application/json; charset={$charset}");
|
$plugins->run_hooks("xmlhttp_get_multiquoted_end");
echo json_encode(array("message" => $message));
| $plugins->run_hooks("xmlhttp_get_multiquoted_end");
echo json_encode(array("message" => $message));
|
Zeile 701 | Zeile 774 |
---|
if($db->num_rows($query) == 0) { xmlhttp_error($lang->captcha_not_exists);
|
if($db->num_rows($query) == 0) { xmlhttp_error($lang->captcha_not_exists);
|
}
| }
|
$db->delete_query("captcha", "imagehash='$imagehash'"); $randomstr = random_str(5); $imagehash = md5(random_str(12));
| $db->delete_query("captcha", "imagehash='$imagehash'"); $randomstr = random_str(5); $imagehash = md5(random_str(12));
|
Zeile 710 | Zeile 783 |
---|
"imagestring" => $randomstr, "dateline" => TIME_NOW );
|
"imagestring" => $randomstr, "dateline" => TIME_NOW );
|
|
|
$plugins->run_hooks("xmlhttp_refresh_captcha");
$db->insert_query("captcha", $regimagearray);
|
$plugins->run_hooks("xmlhttp_refresh_captcha");
$db->insert_query("captcha", $regimagearray);
|
header("Content-type: application/json; charset={$charset}");
| header("Content-type: application/json; charset={$charset}");
|
echo json_encode(array("imagehash" => $imagehash)); exit; }
| echo json_encode(array("imagehash" => $imagehash)); exit; }
|
Zeile 726 | Zeile 799 |
---|
if($db->num_rows($query) == 0) { echo json_encode($lang->captcha_valid_not_exists);
|
if($db->num_rows($query) == 0) { echo json_encode($lang->captcha_valid_not_exists);
|
exit; }
| exit; }
|
$imagestring = $db->fetch_field($query, 'imagestring');
$plugins->run_hooks("xmlhttp_validate_captcha");
| $imagestring = $db->fetch_field($query, 'imagestring');
$plugins->run_hooks("xmlhttp_validate_captcha");
|
Zeile 747 | Zeile 820 |
---|
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
|
Zeile 755 | Zeile 828 |
---|
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid) WHERE q.active='1' AND s.sid='{$sid}' ");
|
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); }
|
if($db->num_rows($query) == 0) { 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 848 |
---|
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");
|
| require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser; $parser_options = array( "allow_html" => 0, "allow_mycode" => 1, "allow_smilies" => 1, "allow_imgcode" => 1, "allow_videocode" => 1, "filter_badwords" => 1, "me_username" => 0, "shorten_urls" => 0, "highlight" => 0, );
|
if($db->num_rows($query) > 0)
|
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'])));
| { $question = $db->fetch_array($query);
echo json_encode(array("question" => $parser->parse_message($question['question'], $parser_options), 'sid' => htmlspecialchars_uni($question['sid'])));
|
exit;
|
exit;
|
} else
| } else
|
{ xmlhttp_error($lang->answer_valid_not_exists); }
| { xmlhttp_error($lang->answer_valid_not_exists); }
|
Zeile 795 | Zeile 883 |
---|
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)
|
if($db->num_rows($query) == 0)
|
{
| {
|
echo json_encode($lang->answer_valid_not_exists); exit;
|
echo json_encode($lang->answer_valid_not_exists); exit;
|
} else {
| } else {
|
$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 909 |
---|
$validated = 1; } }
|
$validated = 1; } }
|
$plugins->run_hooks("xmlhttp_validate_question");
| $plugins->run_hooks("xmlhttp_validate_question");
|
if($validated != 1)
|
if($validated != 1)
|
{
| {
|
echo json_encode($lang->answer_does_not_match);
|
echo json_encode($lang->answer_does_not_match);
|
exit; }
| exit; }
|
else { echo json_encode("true"); exit; }
|
else { echo json_encode("true"); exit; }
|
}
exit; }
| }
exit; }
|
else if($mybb->input['action'] == "complex_password") { $password = trim($mybb->get_input('password')); $password = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $password);
|
else if($mybb->input['action'] == "complex_password") { $password = trim($mybb->get_input('password')); $password = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $password);
|
header("Content-type: application/json; charset={$charset}");
| header("Content-type: application/json; charset={$charset}");
|
$plugins->run_hooks("xmlhttp_complex_password");
if(!preg_match("/^.*(?=.{".$mybb->settings['minpasswordlength'].",})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) { echo json_encode($lang->complex_password_fails);
|
$plugins->run_hooks("xmlhttp_complex_password");
if(!preg_match("/^.*(?=.{".$mybb->settings['minpasswordlength'].",})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) { echo json_encode($lang->complex_password_fails);
|
}
| }
|
else { // Return nothing but an OK password if passes regex
| else { // Return nothing but an OK password if passes regex
|
Zeile 870 | Zeile 958 |
---|
$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 = preg_replace("#\s{2,}#", " ", $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 = preg_replace("#\s{2,}#", " ", $username);
|
header("Content-type: application/json; charset={$charset}");
| header("Content-type: application/json; charset={$charset}");
|
if(empty($username))
|
if(empty($username))
|
{
| {
|
echo json_encode($lang->banned_characters_username); exit; }
| echo json_encode($lang->banned_characters_username); exit; }
|
Zeile 889 | Zeile 977 |
---|
if($banned_username) { echo json_encode($lang->banned_username);
|
if($banned_username) { echo json_encode($lang->banned_username);
|
exit; }
| exit; }
|
// 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 904 | Zeile 992 |
---|
$plugins->run_hooks("xmlhttp_username_availability");
|
$plugins->run_hooks("xmlhttp_username_availability");
|
if($user['uid'])
| if(!empty($user['uid']))
|
{ $lang->username_taken = $lang->sprintf($lang->username_taken, htmlspecialchars_uni($username)); echo json_encode($lang->username_taken);
| { $lang->username_taken = $lang->sprintf($lang->username_taken, htmlspecialchars_uni($username)); echo json_encode($lang->username_taken);
|
Zeile 917 | Zeile 1005 |
---|
exit; } }
|
exit; } }
|
else if($mybb->input['action'] == "username_exists")
| else if($mybb->input['action'] == "email_availability")
|
{ if(!verify_post_check($mybb->get_input('my_post_key'), true))
|
{ if(!verify_post_check($mybb->get_input('my_post_key'), true))
|
{
| {
|
xmlhttp_error($lang->invalid_post_code); }
|
xmlhttp_error($lang->invalid_post_code); }
|
require_once MYBB_ROOT."inc/functions_user.php"; $username = $mybb->get_input('value');
header("Content-type: application/json; charset={$charset}");
if(!trim($username)) { echo json_encode(array("success" => 1)); exit; }
// Check if the username actually exists $user = get_user_by_username($username);
| require_once MYBB_ROOT."inc/datahandlers/user.php"; $userhandler = new UserDataHandler("insert");
$email = $mybb->get_input('email');
|
|
|
$plugins->run_hooks("xmlhttp_username_exists");
| header("Content-type: application/json; charset={$charset}");
|
|
|
if($user['uid']) { $lang->valid_username = $lang->sprintf($lang->valid_username, htmlspecialchars_uni($username)); echo json_encode(array("success" => $lang->valid_username)); exit; }
| $user = array( 'email' => $email );
$userhandler->set_data($user);
$errors = array();
if(!$userhandler->verify_email()) { $errors = $userhandler->get_friendly_errors(); }
$plugins->run_hooks("xmlhttp_email_availability");
if(!empty($errors)) { echo json_encode($errors[0]); exit; }
|
else {
|
else {
|
$lang->invalid_username = $lang->sprintf($lang->invalid_username, htmlspecialchars_uni($username)); echo json_encode($lang->invalid_username);
| echo json_encode("true");
|
exit; } } else if($mybb->input['action'] == "get_buddyselect") { // Send our headers.
|
exit; } } else if($mybb->input['action'] == "get_buddyselect") { // Send our headers.
|
header("Content-type: text/plain; charset={$charset}");
| header("Content-type: text/plain; charset={$charset}");
|
if($mybb->user['buddylist'] != "") {
| if($mybb->user['buddylist'] != "") {
|
Zeile 973 | Zeile 1065 |
---|
$offline = array(); while($buddy = $db->fetch_array($query)) {
|
$offline = array(); while($buddy = $db->fetch_array($query)) {
|
| $buddy['username'] = htmlspecialchars_uni($buddy['username']);
|
$buddy_name = format_name($buddy['username'], $buddy['usergroup'], $buddy['displaygroup']); $profile_link = build_profile_link($buddy_name, $buddy['uid'], '_blank'); if($buddy['lastactive'] > $timecut && ($buddy['invisible'] == 0 || $mybb->user['usergroup'] == 4) && $buddy['lastvisit'] != $buddy['lastactive'])
| $buddy_name = format_name($buddy['username'], $buddy['usergroup'], $buddy['displaygroup']); $profile_link = build_profile_link($buddy_name, $buddy['uid'], '_blank'); if($buddy['lastactive'] > $timecut && ($buddy['invisible'] == 0 || $mybb->user['usergroup'] == 4) && $buddy['lastvisit'] != $buddy['lastactive'])
|
Zeile 996 | Zeile 1089 |
---|
{ xmlhttp_error($lang->buddylist_error); }
|
{ xmlhttp_error($lang->buddylist_error); }
|
| } else if($mybb->input['action'] == 'get_referrals') { $lang->load('member'); $uid = $mybb->get_input('uid', MYBB::INPUT_INT);
if (!$uid) { xmlhttp_error($lang->referrals_no_user_specified); }
$referrals = get_user_referrals($uid);
if (empty($referrals)) { eval("\$referral_rows = \"".$templates->get('member_no_referrals')."\";"); } else { foreach($referrals as $referral) { $bg_color = alt_trow(); // Format user name link $username = htmlspecialchars_uni($referral['username']); $username = format_name($username, $referral['usergroup'], $referral['displaygroup']); $username = build_profile_link($username, $referral['uid']);
$regdate = my_date('normal', $referral['regdate']);
eval("\$referral_rows .= \"".$templates->get('member_referral_row')."\";"); } }
$plugins->run_hooks('xmlhttp_referrals_end');
eval("\$referrals = \"".$templates->get('member_referrals_popup', 1, 0)."\";");
// Send our headers and output. header("Content-type: text/plain; charset={$charset}"); echo $referrals;
|
}
/** * 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) {
|