diff --git a/Upload/admin/inc/class_form.php b/Upload/admin/inc/class_form.php
index 4d33aca..37e7e83 100644
--- a/Upload/admin/inc/class_form.php
+++ b/Upload/admin/inc/class_form.php
@@ -130,7 +130,16 @@ function generate_text_box($name, $value="", $options=array())
*/
function generate_numeric_field($name, $value=0, $options=array())
{
- $input = "\n";
echo " \n";
- echo " \n";
+ echo " \n";
echo " \n";
echo " \n";
@@ -390,7 +390,7 @@ function show_login($message="", $class="success")
-
+
-
+
";
- }
- else
- {
- // Build and log a detailed message.
- $url = "https://".$this->ayah_web_service_host.$webservice_url;
- $message = "Unable to connect to the AYAH webservice server. url='$url'";
- $this->__log("ERROR", __FUNCTION__, $message);
-
- // Build and display a helpful message to the site user.
- $style = "padding: 10px; border: 1px solid #EED3D7; background: #F2DEDE; color: #B94A48;";
- $message = "Unable to load the Are You a Human PlayThru™. Please contact the site owner to report the problem.";
- echo "
$message
\n";
- }
- }
-
- /**
- * Check whether the user is a human
- * Wrapper for the scoreGame API call
- *
- * @return boolean
- */
- public function scoreResult() {
- $result = false;
- if ($this->session_secret) {
- $fields = array(
- 'session_secret' => urlencode($this->session_secret),
- 'scoring_key' => $this->ayah_scoring_key
- );
- $resp = $this->doHttpsPostReturnJSONArray($this->ayah_web_service_host, "/ws/scoreGame", $fields);
- if ($resp) {
- $result = ($resp->status_code == 1);
- }
- }
- else
- {
- $this->__log("DEBUG", __FUNCTION__, "Unable to score the result. Please check that your ayah_config.php file contains your correct publisher key and scoring key.");
- }
-
- return $result;
- }
-
- /**
- * Records a conversion
- * Called on the goal page that A and B redirect to
- * A/B Testing Specific Function
- *
- * @return boolean
- */
- public function recordConversion() {
- // Build the url to the AYAH webservice..
- $url = 'https://'; // The AYAH webservice API requires https.
- $url.= $this->ayah_web_service_host; // Add the host.
- $url.= "/ws/recordConversion/"; // Add the path to the API script.
- $url.= urlencode($this->ayah_publisher_key); // Add the encoded publisher key.
-
- if( isset( $this->session_secret ) ){
- return '';
- } else {
- $this->__log("ERROR", __FUNCTION__, 'AYAH Conversion Error: No Session Secret');
- return FALSE;
- }
- }
-
- /**
- * Do a HTTPS POST, return some JSON decoded as array (Internal function)
- * @param $host hostname
- * @param $path path
- * @param $fields associative array of fields
- * return JSON decoded data structure or empty data structure
- */
- protected function doHttpsPostReturnJSONArray($hostname, $path, $fields) {
- $result = $this->doHttpsPost($hostname, $path, $fields);
-
- if ($result) {
- $result = $this->doJSONArrayDecode($result);
- } else {
- $this->__log("ERROR", __FUNCTION__, "Post to https://$hostname$path returned no result.");
- $result = array();
- }
-
- return $result;
- }
-
- // Internal function; does an HTTPS post
- protected function doHttpsPost($hostname, $path, $fields) {
- $result = "";
- // URLencode the post string
- $fields_string = "";
- foreach($fields as $key=>$value) {
- if (is_array($value)) {
- if ( ! empty($value)) {
- foreach ($value as $k => $v) {
- $fields_string .= $key . '['. $k .']=' . $v . '&';
- }
- } else {
- $fields_string .= $key . '=&';
- }
- } else {
- $fields_string .= $key.'='.$value.'&';
- }
- }
- rtrim($fields_string,'&');
-
- // Use cURL?
- if ($this->__use_curl())
- {
- // Build the cURL url.
- $curl_url = "https://" . $hostname . $path;
-
- // Log it.
- $this->__log("DEBUG", __FUNCTION__, "Using cURl: url='$curl_url', fields='$fields_string'");
-
- // Initialize cURL session.
- if ($ch = curl_init($curl_url))
- {
- // Set the cURL options.
- curl_setopt($ch, CURLOPT_POST, count($fields));
- curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-
- // Execute the cURL request.
- $result = curl_exec($ch);
-
- // Close the curl session.
- curl_close($ch);
- }
- else
- {
- // Log it.
- $this->__log("DEBUG", __FUNCTION__, "Unable to initialize cURL: url='$curl_url'");
- }
- }
- else
- {
- // Log it.
- $this->__log("DEBUG", __FUNCTION__, "Using fsockopen(): fields='$fields_string'");
-
- // Build a header
- $http_request = "POST $path HTTP/1.1\r\n";
- $http_request .= "Host: $hostname\r\n";
- $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
- $http_request .= "Content-Length: " . strlen($fields_string) . "\r\n";
- $http_request .= "User-Agent: AreYouAHuman/PHP " . $this->get_version_number() . "\r\n";
- $http_request .= "Connection: Close\r\n";
- $http_request .= "\r\n";
- $http_request .= $fields_string ."\r\n";
-
- $result = '';
- $errno = $errstr = "";
- $fs = fsockopen("ssl://" . $hostname, 443, $errno, $errstr, 10);
- if( false == $fs ) {
- $this->__log("ERROR", __FUNCTION__, "Could not open socket");
- } else {
- fwrite($fs, $http_request);
- while (!feof($fs)) {
- $result .= fgets($fs, 4096);
- }
-
- $result = explode("\r\n\r\n", $result, 2);
- $result = $result[1];
- }
- }
-
- // Log the result.
- $this->__log("DEBUG", __FUNCTION__, "result='$result'");
-
- // Return the result.
- return $result;
- }
-
- // Internal function: does a JSON decode of the string
- protected function doJSONArrayDecode($string) {
- $result = array();
-
- if (function_exists("json_decode")) {
- try {
- $result = json_decode( $string);
- } catch (Exception $e) {
- $this->__log("ERROR", __FUNCTION__, "Exception when calling json_decode: " . $e->getMessage());
- $result = null;
- }
- } elseif (file_Exists("json.php")) {
- require_once('json.php');
- $json = new Services_JSON();
- $result = $json->decode($string);
-
- if (!is_array($result)) {
- $this->__log("ERROR", __FUNCTION__, "Expected array; got something else: $result");
- $result = array();
- }
- } else {
- $this->__log("ERROR", __FUNCTION__, "No JSON decode function available.");
- }
-
- return $result;
- }
-
- /**
- * Get the current debug mode (TRUE or FALSE)
- *
- * @return boolean
- */
- public function debug_mode($mode=null)
- {
- // Set it if the mode is passed.
- if (null !== $mode)
- {
- // Save it.
- $this->ayah_debug_mode = $mode;
-
- // Display a message if debug_mode is TRUE.
- if ($mode)
- {
- $version_number = $this->get_version_number();
- $this->__log("DEBUG", "", "Debug mode is now on. (ayah.php version=$version_number)");
-
- // Flush the buffer.
- $this->__flush_message_buffer();
- }
- }
-
- // If necessary, set the default.
- if ( ! isset($this->ayah_debug_mode) or (null == $this->ayah_debug_mode)) $this->ayah_debug_mode = FALSE;
-
- // Return TRUE or FALSE.
- return ($this->ayah_debug_mode)? TRUE : FALSE;
- }
-
- /**
- * Get the current version number
- *
- * @return string
- */
- public function get_version_number()
- {
- return (isset($this->__version_number))? $this->__version_number : FALSE;
- }
-
- /**
- * Determine whether or not cURL is available to use.
- *
- * @return boolean
- */
- private function __use_curl()
- {
- if (FALSE === $this->ayah_use_curl)
- {
- return FALSE;
- }
- elseif (function_exists('curl_init') and function_exists('curl_exec'))
- {
- return TRUE;
- }
- return FALSE;
- }
-
- /**
- * Load the config file.
- *
- * @return boolean
- */
- private function __load_config_file()
- {
- // Initialize.
- $name = 'ayah_config.php';
- $locations = array(
- './',
- dirname(__FILE__)."/",
- );
-
- // Look for the config file in each location.
- foreach ($locations as $location)
- {
- if (file_exists($location.$name))
- {
- require_once($location.$name);
- return TRUE;
- }
- }
-
- // Could not find the config file.
- return FALSE;
- }
-
- /**
- * Log a message
- *
- * @return null
- */
- protected function __log($type, $function, $message)
- {
- // Add a prefix to the message.
- $message = __CLASS__ . "::$function: " . $message;
-
- // Is it an error message?
- if (FALSE !== stripos($type, "error"))
- {
- error_log($message);
- }
-
- // Build the full message.
- $message_style = "padding: 10px; border: 1px solid #EED3D7; background: #F2DEDE; color: #B94A48;";
- $full_message = "
$type: $message
\n";
-
- // Output to the screen too?
- if ($this->debug_mode())
- {
- echo "$full_message";
- }
- else
- {
- // Add the message to the buffer in case we need it later.
- $this->__message_buffer[] = $full_message;
- }
- }
-
- private function __flush_message_buffer()
- {
- // Flush the buffer.
- if ( ! empty($this->__message_buffer))
- {
- foreach ($this->__message_buffer as $buffered_message)
- {
- // Print the buffered message.
- echo "$buffered_message";
- }
- }
- }
-}
-
-endif; // if ( ! class_exists('AYAH')):
diff --git a/Upload/inc/3rdparty/ayah/index.html b/Upload/inc/3rdparty/ayah/index.html
deleted file mode 100644
index efd2f36..0000000
--- a/Upload/inc/3rdparty/ayah/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Upload/inc/3rdparty/diff/Diff/Op/index.html b/Upload/inc/3rdparty/diff/Diff/Op/index.html
index efd2f36..d3a291c 100644
--- a/Upload/inc/3rdparty/diff/Diff/Op/index.html
+++ b/Upload/inc/3rdparty/diff/Diff/Op/index.html
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Upload/inc/3rdparty/diff/Diff/ThreeWay/Op/index.html b/Upload/inc/3rdparty/diff/Diff/ThreeWay/Op/index.html
index efd2f36..d3a291c 100644
--- a/Upload/inc/3rdparty/diff/Diff/ThreeWay/Op/index.html
+++ b/Upload/inc/3rdparty/diff/Diff/ThreeWay/Op/index.html
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Upload/inc/3rdparty/diff/Diff/ThreeWay/index.html b/Upload/inc/3rdparty/diff/Diff/ThreeWay/index.html
index efd2f36..d3a291c 100644
--- a/Upload/inc/3rdparty/diff/Diff/ThreeWay/index.html
+++ b/Upload/inc/3rdparty/diff/Diff/ThreeWay/index.html
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Upload/inc/cachehandlers/apc.php b/Upload/inc/cachehandlers/apc.php
index c8643d4..d9869ee 100644
--- a/Upload/inc/cachehandlers/apc.php
+++ b/Upload/inc/cachehandlers/apc.php
@@ -11,7 +11,7 @@
/**
* APC Cache Handler
*/
-class apcCacheHandler
+class apcCacheHandler implements CacheHandlerInterface
{
/**
* Unique identifier representing this copy of MyBB
@@ -20,10 +20,7 @@ class apcCacheHandler
*/
public $unique_id;
- /**
- * @param bool $silent ignored
- */
- function __construct($silent=false)
+ function __construct()
{
global $mybb;
@@ -56,10 +53,9 @@ function connect()
* Connect and initialize this handler.
*
* @param string $name
- * @param bool $hard_refresh ignored
* @return boolean True if successful, false on failure
*/
- function fetch($name, $hard_refresh=false)
+ function fetch($name)
{
if(apc_exists($this->unique_id."_".$name))
{
diff --git a/Upload/inc/cachehandlers/disk.php b/Upload/inc/cachehandlers/disk.php
index 934d887..030ac47 100644
--- a/Upload/inc/cachehandlers/disk.php
+++ b/Upload/inc/cachehandlers/disk.php
@@ -11,15 +11,14 @@
/**
* Disk Cache Handler
*/
-class diskCacheHandler
+class diskCacheHandler implements CacheHandlerInterface
{
/**
* Connect and initialize this handler.
*
- * @param bool $silent ignored
* @return boolean True if successful, false on failure
*/
- function connect($silent=false)
+ function connect()
{
if(!@is_writable(MYBB_ROOT."cache"))
{
@@ -33,24 +32,16 @@ function connect($silent=false)
* Retrieve an item from the cache.
*
* @param string $name The name of the cache
- * @param boolean $hard_refresh True if we should do a hard refresh
* @return mixed Cache data if successful, false if failure
*/
- function fetch($name, $hard_refresh=false)
+ function fetch($name)
{
if(!@file_exists(MYBB_ROOT."/cache/{$name}.php"))
{
return false;
}
- if(!isset($this->cache[$name]) || $hard_refresh == true)
- {
- @include(MYBB_ROOT."/cache/{$name}.php");
- }
- else
- {
- @include_once(MYBB_ROOT."/cache/{$name}.php");
- }
+ @include(MYBB_ROOT."/cache/{$name}.php");
// Return data
return $$name;
diff --git a/Upload/inc/cachehandlers/eaccelerator.php b/Upload/inc/cachehandlers/eaccelerator.php
index 86a3d7e..7f4e404 100644
--- a/Upload/inc/cachehandlers/eaccelerator.php
+++ b/Upload/inc/cachehandlers/eaccelerator.php
@@ -11,7 +11,7 @@
/**
* eAccelerator Cache Handler
*/
-class eacceleratorCacheHandler
+class eacceleratorCacheHandler implements CacheHandlerInterface
{
/**
* Unique identifier representing this copy of MyBB
@@ -20,10 +20,7 @@ class eacceleratorCacheHandler
*/
public $unique_id;
- /**
- * @param bool $silent ignored
- */
- function eacceleratorCacheHandler($silent=false)
+ function __construct()
{
global $mybb;
@@ -56,10 +53,9 @@ function connect()
* Retrieve an item from the cache.
*
* @param string $name The name of the cache
- * @param boolean $hard_refresh True if we should do a hard refresh
* @return mixed Cache data if successful, false if failure
*/
- function fetch($name, $hard_refresh=false)
+ function fetch($name)
{
$data = eaccelerator_get($this->unique_id."_".$name);
if($data === false)
diff --git a/Upload/inc/cachehandlers/interface.php b/Upload/inc/cachehandlers/interface.php
new file mode 100644
index 0000000..f751f50
--- /dev/null
+++ b/Upload/inc/cachehandlers/interface.php
@@ -0,0 +1,61 @@
+memcache->get($this->unique_id."_".$name);
diff --git a/Upload/inc/cachehandlers/memcached.php b/Upload/inc/cachehandlers/memcached.php
index 65920bb..2f8d71d 100644
--- a/Upload/inc/cachehandlers/memcached.php
+++ b/Upload/inc/cachehandlers/memcached.php
@@ -11,7 +11,7 @@
/**
* Memcached Cache Handler
*/
-class memcachedCacheHandler
+class memcachedCacheHandler implements CacheHandlerInterface
{
/**
* The memcached server resource
@@ -27,10 +27,7 @@ class memcachedCacheHandler
*/
public $unique_id;
- /**
- * @param bool $silent ignored
- */
- function memcachedCacheHandler($silent=false)
+ function __construct()
{
global $mybb;
@@ -98,10 +95,9 @@ function connect()
* Retrieve an item from the cache.
*
* @param string $name The name of the cache
- * @param boolean $hard_refresh True if we should do a hard refresh
* @return mixed Cache data if successful, false if failure
*/
- function fetch($name, $hard_refresh=false)
+ function fetch($name)
{
$data = $this->memcached->get($this->unique_id."_".$name);
@@ -143,7 +139,7 @@ function delete($name)
*/
function disconnect()
{
- @$this->memcached->close();
+ @$this->memcached->quit();
}
/**
diff --git a/Upload/inc/cachehandlers/xcache.php b/Upload/inc/cachehandlers/xcache.php
index e703d06..5d778fd 100644
--- a/Upload/inc/cachehandlers/xcache.php
+++ b/Upload/inc/cachehandlers/xcache.php
@@ -11,7 +11,7 @@
/**
* Xcache Cache Handler
*/
-class xcacheCacheHandler
+class xcacheCacheHandler implements CacheHandlerInterface
{
/**
* Unique identifier representing this copy of MyBB
@@ -20,10 +20,7 @@ class xcacheCacheHandler
*/
public $unique_id;
- /**
- * @param bool $silent ignored
- */
- function xcacheCacheHandler($silent=false)
+ function __construct()
{
global $mybb;
@@ -56,10 +53,9 @@ function connect()
* Retrieve an item from the cache.
*
* @param string $name The name of the cache
- * @param boolean $hard_refresh True if we should do a hard refresh
* @return mixed Cache data if successful, false if failure
*/
- function fetch($name, $hard_refresh=false)
+ function fetch($name)
{
if(!xcache_isset($this->unique_id."_".$name))
{
diff --git a/Upload/inc/class_captcha.php b/Upload/inc/class_captcha.php
index 92c20c1..82d727a 100644
--- a/Upload/inc/class_captcha.php
+++ b/Upload/inc/class_captcha.php
@@ -40,7 +40,6 @@ class captcha
*
* 1 = Default CAPTCHA
* 2 = reCAPTCHA
- * 3 = Are You a Human
* 4 = NoCATPCHA reCAPTCHA
*
* @var int
@@ -52,7 +51,7 @@ class captcha
*
* @var string
*/
- public $captch_template = '';
+ public $captcha_template = '';
/**
* CAPTCHA Server URL
@@ -68,17 +67,6 @@ class captcha
*/
public $verify_server = '';
- /**
- * Are You a Human configuration
- *
- * @var string
- */
- public $ayah_web_service_host = '';
- public $ayah_publisher_key = '';
- public $ayah_scoring_key = '';
- public $ayah_debug_mode = '';
- public $ayah_use_curl = '';
-
/**
* HTML of the built CAPTCHA
*
@@ -120,31 +108,13 @@ function __construct($build = false, $template = "")
{
$this->captcha_template .= "_recaptcha";
}
- else if($this->type == 3)
- {
- $this->captcha_template .= "_ayah";
- }
else if($this->type == 4){
$this->captcha_template .= "_nocaptcha";
}
}
// Work on which CAPTCHA we've got installed
- if($this->type == 3 && $mybb->settings['ayahpublisherkey'] && $mybb->settings['ayahscoringkey'])
- {
- // We want to use Are You a Human, set configuration options
- $this->ayah_web_service_host = "ws.areyouahuman.com";
- $this->ayah_publisher_key = $mybb->settings['ayahpublisherkey'];
- $this->ayah_scoring_key = $mybb->settings['ayahscoringkey'];
- $this->ayah_debug_mode = false;
- $this->ayah_use_curl = true;
-
- if($build == true)
- {
- $this->build_ayah();
- }
- }
- else if($this->type == 2 && $mybb->settings['captchapublickey'] && $mybb->settings['captchaprivatekey'])
+ if($this->type == 2 && $mybb->settings['captchapublickey'] && $mybb->settings['captchaprivatekey'])
{
// We want to use reCAPTCHA, set the server options
$this->server = "//www.google.com/recaptcha/api";
@@ -216,27 +186,6 @@ function build_recaptcha()
//eval("\$this->html = \"".$templates->get("member_register_regimage_recaptcha")."\";");
}
- function build_ayah()
- {
- global $lang, $mybb, $templates;
-
- define('AYAH_PUBLISHER_KEY', $this->ayah_publisher_key);
- define('AYAH_SCORING_KEY', $this->ayah_scoring_key);
- define('AYAH_USE_CURL', $this->ayah_use_curl);
- define('AYAH_DEBUG_MODE', $this->ayah_debug_mode);
- define('AYAH_WEB_SERVICE_HOST', $this->ayah_web_service_host);
-
- require_once MYBB_ROOT."inc/3rdparty/ayah/ayah.php";
- $ayah = new AYAH();
- $output = $ayah->getPublisherHTML();
-
- if(!empty($output))
- {
- eval("\$this->html = \"".$templates->get($this->captcha_template, 1, 0)."\";");
- //eval("\$this->html = \"".$templates->get("member_register_regimage_ayah")."\";");
- }
- }
-
/**
* @return string
*/
@@ -401,24 +350,6 @@ function validate_captcha()
}
}
}
- elseif($this->type == 3)
- {
- define('AYAH_PUBLISHER_KEY', $this->ayah_publisher_key);
- define('AYAH_SCORING_KEY', $this->ayah_scoring_key);
- define('AYAH_USE_CURL', $this->ayah_use_curl);
- define('AYAH_DEBUG_MODE', $this->ayah_debug_mode);
- define('AYAH_WEB_SERVICE_HOST', $this->ayah_web_service_host);
-
- require_once MYBB_ROOT."inc/3rdparty/ayah/ayah.php";
- $ayah = new AYAH();
-
- $result = $ayah->scoreResult();
-
- if($result == false)
- {
- $this->set_error($lang->invalid_ayah_result);
- }
- }
$plugins->run_hooks('captcha_validate_end', $this);
diff --git a/Upload/inc/class_core.php b/Upload/inc/class_core.php
index 751a6dc..4aa32bb 100644
--- a/Upload/inc/class_core.php
+++ b/Upload/inc/class_core.php
@@ -14,14 +14,14 @@ class MyBB {
*
* @var string
*/
- public $version = "1.8.6";
+ public $version = "1.8.7";
/**
* The version code of MyBB we're running.
*
* @var integer
*/
- public $version_code = 1806;
+ public $version_code = 1807;
/**
* The current working directory.
diff --git a/Upload/inc/class_custommoderation.php b/Upload/inc/class_custommoderation.php
index 1a51889..8fe1d1c 100644
--- a/Upload/inc/class_custommoderation.php
+++ b/Upload/inc/class_custommoderation.php
@@ -241,7 +241,7 @@ function execute_post_moderation($post_options, $pids, $tid)
"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],
"message" => $post_options['splitpostsaddreply'],
- "ipaddress" => $db->escape_binary(my_inet_pton(get_ip())),
+ "ipaddress" => my_inet_pton(get_ip()),
);
// Set up the post options from the input.
$post['options'] = array(
@@ -413,7 +413,7 @@ function execute_thread_moderation($thread_options, $tids)
"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],
"message" => $thread_options['addreply'],
- "ipaddress" => $db->escape_binary(my_inet_pton(get_ip())),
+ "ipaddress" => my_inet_pton(get_ip()),
);
// Set up the post options from the input.
diff --git a/Upload/inc/class_datacache.php b/Upload/inc/class_datacache.php
index 679f0cf..4f95f8a 100644
--- a/Upload/inc/class_datacache.php
+++ b/Upload/inc/class_datacache.php
@@ -20,17 +20,10 @@ class datacache
/**
* The current cache handler we're using
*
- * @var apcCacheHandler|diskCacheHandler|eacceleratorCacheHandler|memcacheCacheHandler|memcachedCacheHandler|xcacheCacheHandler
+ * @var CacheHandlerInterface
*/
public $handler = null;
- /**
- * Whether or not to exit the script if we cannot load the specified extension
- *
- * @var boolean
- */
- var $silent = false;
-
/**
* A count of the number of calls.
*
@@ -67,48 +60,47 @@ function cache()
{
global $db, $mybb;
+ require_once MYBB_ROOT."/inc/cachehandlers/interface.php";
+
switch($mybb->config['cache_store'])
{
// Disk cache
case "files":
require_once MYBB_ROOT."/inc/cachehandlers/disk.php";
- $this->handler = new diskCacheHandler($this->silent);
+ $this->handler = new diskCacheHandler();
break;
// Memcache cache
case "memcache":
require_once MYBB_ROOT."/inc/cachehandlers/memcache.php";
- $this->handler = new memcacheCacheHandler($this->silent);
+ $this->handler = new memcacheCacheHandler();
break;
// Memcached cache
case "memcached":
require_once MYBB_ROOT."/inc/cachehandlers/memcached.php";
- $this->handler = new memcachedCacheHandler($this->silent);
+ $this->handler = new memcachedCacheHandler();
break;
// eAccelerator cache
case "eaccelerator":
require_once MYBB_ROOT."/inc/cachehandlers/eaccelerator.php";
- $this->handler = new eacceleratorCacheHandler($this->silent);
+ $this->handler = new eacceleratorCacheHandler();
break;
// Xcache cache
case "xcache":
require_once MYBB_ROOT."/inc/cachehandlers/xcache.php";
- $this->handler = new xcacheCacheHandler($this->silent);
+ $this->handler = new xcacheCacheHandler();
break;
// APC cache
case "apc":
require_once MYBB_ROOT."/inc/cachehandlers/apc.php";
- $this->handler = new apcCacheHandler($this->silent);
+ $this->handler = new apcCacheHandler();
break;
}
- if(is_object($this->handler))
+ if($this->handler instanceof CacheHandlerInterface)
{
- if(method_exists($this->handler, "connect"))
+ if(!$this->handler->connect())
{
- if(!$this->handler->connect())
- {
- $this->handler = null;
- }
+ $this->handler = null;
}
}
else
@@ -140,12 +132,12 @@ function read($name, $hard=false)
}
// If we're not hard refreshing, and this cache doesn't exist, return false
// It would have been loaded pre-global if it did exist anyway...
- else if($hard == false && !is_object($this->handler))
+ else if($hard == false && !($this->handler instanceof CacheHandlerInterface))
{
return false;
}
- if(is_object($this->handler))
+ if($this->handler instanceof CacheHandlerInterface)
{
get_execution_time();
@@ -239,7 +231,7 @@ function update($name, $contents)
$db->replace_query("datacache", $replace_array, "", false);
// Do we have a cache handler we're using?
- if(is_object($this->handler))
+ if($this->handler instanceof CacheHandlerInterface)
{
get_execution_time();
@@ -273,7 +265,7 @@ function delete($name, $greedy = false)
$where = "title = '{$dbname}'";
// Delete on-demand or handler cache
- if($this->handler)
+ if($this->handler instanceof CacheHandlerInterface)
{
get_execution_time();
@@ -314,7 +306,7 @@ function delete($name, $greedy = false)
$where .= " OR title LIKE '{$ldbname}=_%' ESCAPE '='";
- if($this->handler)
+ if($this->handler instanceof CacheHandlerInterface)
{
$query = $db->simple_select("datacache", "title", $where);
@@ -413,7 +405,7 @@ function size_of($name='')
{
global $db;
- if(is_object($this->handler))
+ if($this->handler instanceof CacheHandlerInterface)
{
$size = $this->handler->size_of($name);
if(!$size)
@@ -648,8 +640,6 @@ private function build_forum_permissions($permissions=array(), $pid=0)
*/
function update_stats()
{
- global $db;
-
require_once MYBB_ROOT."inc/functions_rebuild.php";
rebuild_stats();
}
@@ -897,7 +887,6 @@ function update_reportedcontent()
{
global $db, $mybb;
- $reports = array();
$query = $db->simple_select("reportedcontent", "COUNT(rid) AS unreadcount", "reportstatus='0'");
$num = $db->fetch_array($query);
diff --git a/Upload/inc/class_error.php b/Upload/inc/class_error.php
index 4b1f8cd..b656426 100644
--- a/Upload/inc/class_error.php
+++ b/Upload/inc/class_error.php
@@ -516,7 +516,7 @@ function output_error($type, $message, $file, $line)
@header('Status: 503 Service Temporarily Unavailable');
@header('Retry-After: 1800');
@header("Content-type: text/html; charset={$charset}");
- $file_name = basename(__FILE__);
+ $file_name = htmlspecialchars_uni(basename($_SERVER['SCRIPT_FILENAME']));
echo <<
diff --git a/Upload/inc/class_language.php b/Upload/inc/class_language.php
index 9a98ca0..a864a96 100644
--- a/Upload/inc/class_language.php
+++ b/Upload/inc/class_language.php
@@ -237,6 +237,6 @@ function parse($contents)
*/
function parse_replace($matches)
{
- return $this->$matches[1];
+ return $this->{$matches[1]};
}
}
diff --git a/Upload/inc/class_mailhandler.php b/Upload/inc/class_mailhandler.php
index 009be77..f4026d3 100644
--- a/Upload/inc/class_mailhandler.php
+++ b/Upload/inc/class_mailhandler.php
@@ -91,6 +91,20 @@ class MailHandler
*/
public $parse_format = 'text';
+ /**
+ * The last received response from the SMTP server.
+ *
+ * @var string
+ */
+ public $data = '';
+
+ /**
+ * The last received response code from the SMTP server.
+ *
+ * @var string
+ */
+ public $code = 0;
+
/**
* Selects between AdminEmail and ReturnEmail, dependant on if ReturnEmail is filled.
*
diff --git a/Upload/inc/class_moderation.php b/Upload/inc/class_moderation.php
index ed954d0..35e60f5 100644
--- a/Upload/inc/class_moderation.php
+++ b/Upload/inc/class_moderation.php
@@ -1223,12 +1223,12 @@ function move_thread($tid, $new_fid, $method="redirect", $redirect_expire=0)
'pid' => $pid,
'uid' => $attachment['uid'],
'filename' => $db->escape_string($attachment['filename']),
- 'filetype' => $attachment['filetype'],
+ 'filetype' => $db->escape_string($attachment['filetype']),
'filesize' => $attachment['filesize'],
- 'attachname' => $attachment['attachname'],
+ 'attachname' => $db->escape_string($attachment['attachname']),
'downloads' => $attachment['downloads'],
'visible' => $attachment['visible'],
- 'thumbnail' => $attachment['thumbnail']
+ 'thumbnail' => $db->escape_string($attachment['thumbnail'])
);
$new_aid = $db->insert_query("attachments", $attachment_array);
diff --git a/Upload/inc/class_parser.php b/Upload/inc/class_parser.php
index 58d5a76..0d834d0 100644
--- a/Upload/inc/class_parser.php
+++ b/Upload/inc/class_parser.php
@@ -115,7 +115,7 @@ function parse_message($message, $options=array())
$message = $plugins->run_hooks("parse_message_start", $message);
- // Get rid of cartridge returns for they are the workings of the devil
+ // Get rid of carriage returns for they are the workings of the devil
$message = str_replace("\r", "", $message);
// Filter bad words if requested.
@@ -130,32 +130,32 @@ function parse_message($message, $options=array())
$message = $this->parse_cdata($message);
}
+ // If MyCode needs to be replaced, first filter out [code] and [php] tags.
+ if(!empty($this->options['allow_mycode']) && $mybb->settings['allowcodemycode'] == 1)
+ {
+ // This code is reserved and could break codes
+ $message = str_replace("\n", "\n", $message);
+
+ preg_match_all("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", $message, $code_matches, PREG_SET_ORDER);
+ $message = preg_replace("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "\n", $message);
+ }
+
if(empty($this->options['allow_html']))
{
$message = $this->parse_html($message);
+ $message = str_replace("<mybb-code>\n", "\n", $message);
}
else
{
- while(preg_match("#(.*)#is", $message))
- {
- $message = preg_replace("#(.*)#is", "<s$1$2>$3</s$4$5>", $message);
- }
+ // Replace base, meta,script and style tags in our post - these are > dangerous <
+ $message = preg_replace('#<(/?)(base|meta|script|style)([^>]*)>#i', '<$1$2$3>', $message);
+ $message = $this->fix_javascript($message);
- $find = array('', '?>', " \n", " \n");
- $replace = array('<?php', '<!--', '-->', '?>', "\n", "\n");
+ $find = array(" \n", " \n");
+ $replace = array("\n", "\n");
$message = str_replace($find, $replace, $message);
}
- // If MyCode needs to be replaced, first filter out [code] and [php] tags.
- if(!empty($this->options['allow_mycode']) && $mybb->settings['allowcodemycode'] == 1)
- {
- preg_match_all("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", $message, $code_matches, PREG_SET_ORDER);
- $message = preg_replace("#\[(code|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "\n", $message);
- }
-
- // Always fix bad Javascript in the message.
- $message = $this->fix_javascript($message);
-
// Replace "me" code and slaps if we have a username
if(!empty($this->options['me_username']) && $mybb->settings['allowmemycode'] == 1)
{
@@ -193,14 +193,11 @@ function parse_message($message, $options=array())
{
foreach($code_matches as $text)
{
- // Fix up HTML inside the code tags so it is clean
- if(!empty($this->options['allow_html']))
+ if(my_strtolower($text[1]) == "code")
{
+ // Fix up HTML inside the code tags so it is clean
$text[2] = $this->parse_html($text[2]);
- }
- if(my_strtolower($text[1]) == "code")
- {
$code = $this->mycode_parse_code($text[2]);
}
elseif(my_strtolower($text[1]) == "php")
@@ -212,15 +209,6 @@ function parse_message($message, $options=array())
}
}
- // Replace meta and base tags in our post - these are > dangerous <
- if(!empty($this->options['allow_html']))
- {
- $message = preg_replace_callback("#<((m[^a])|(b[^diloru>])|(s[^aemptu>]))(\s*[^>]*)>#si", create_function(
- '$matches',
- 'return htmlspecialchars_uni($matches[0]);'
- ), $message);
- }
-
if(!isset($this->options['nl2br']) || $this->options['nl2br'] != 0)
{
$message = nl2br($message);
@@ -306,7 +294,7 @@ function cache_mycode()
$callback_mycode['url_complex']['regex'] = "#\[url=([a-z]+?://)([^\r\n\"<]+?)\](.+?)\[/url\]#si";
$callback_mycode['url_complex']['replacement'] = array($this, 'mycode_parse_url_callback1');
- $callback_mycode['url_complex2']['regex'] = "#\[url=([^\r\n\"<&\(\)]+?)\](.+?)\[/url\]#si";
+ $callback_mycode['url_complex2']['regex'] = "#\[url=([^\r\n\"<]+?)\](.+?)\[/url\]#si";
$callback_mycode['url_complex2']['replacement'] = array($this, 'mycode_parse_url_callback2');
++$callback_count;
@@ -663,34 +651,18 @@ function parse_cdata($message)
/**
* Attempts to move any javascript references in the specified message.
*
- * @param string $message The message to be parsed.
+ * @param string The message to be parsed.
* @return string The parsed message.
*/
function fix_javascript($message)
{
$js_array = array(
"#(&\#(0*)106;?|&\#(0*)74;?|&\#x(0*)4a;?|&\#x(0*)6a;?|j)((&\#(0*)97;?|&\#(0*)65;?|a)(&\#(0*)118;?|&\#(0*)86;?|v)(&\#(0*)97;?|&\#(0*)65;?|a)(\s)?(&\#(0*)115;?|&\#(0*)83;?|s)(&\#(0*)99;?|&\#(0*)67;?|c)(&\#(0*)114;?|&\#(0*)82;?|r)(&\#(0*)105;?|&\#(0*)73;?|i)(&\#112;?|&\#(0*)80;?|p)(&\#(0*)116;?|&\#(0*)84;?|t)(&\#(0*)58;?|\:))#i",
- "#(o)(nmouseover\s?=)#i",
- "#(o)(nmouseout\s?=)#i",
- "#(o)(nmousedown\s?=)#i",
- "#(o)(nmousemove\s?=)#i",
- "#(o)(nmouseup\s?=)#i",
- "#(o)(nclick\s?=)#i",
- "#(o)(ndblclick\s?=)#i",
- "#(o)(nload\s?=)#i",
- "#(o)(nsubmit\s?=)#i",
- "#(o)(nblur\s?=)#i",
- "#(o)(nchange\s?=)#i",
- "#(o)(nfocus\s?=)#i",
- "#(o)(nselect\s?=)#i",
- "#(o)(nunload\s?=)#i",
- "#(o)(nkeypress\s?=)#i",
- "#(o)(nerror\s?=)#i",
- "#(o)(nreset\s?=)#i",
- "#(o)(nabort\s?=)#i"
+ "#(on)([a-z]+\s?=)#i",
);
- $message = preg_replace($js_array, "$1$2$6", $message);
+ // Add invisible white space
+ $message = preg_replace($js_array, "$1\xE2\x80\x8C$2$6", $message);
return $message;
}
@@ -960,10 +932,6 @@ function mycode_parse_php($str, $bare_return = false, $text_only = false)
return;
}
- $str = str_replace('&', '&', $str);
- $str = str_replace('<', '<', $str);
- $str = str_replace('>', '>', $str);
-
// See if open and close tags are provided.
$added_open_tag = false;
if(!preg_match("#^\s*<\?#si", $str))
@@ -1355,7 +1323,18 @@ function mycode_parse_video($video, $url)
$id = $path[4]; // http://www.myspace.com/video/fds/fds/123
break;
case "facebook":
- $id = $input['v']; // http://www.facebook.com/video/video.php?v=123
+ if(isset($input['v']))
+ {
+ $id = $input['v']; // http://www.facebook.com/video/video.php?v=123
+ }
+ elseif(substr($path[3], 0, 3) == 'vb.')
+ {
+ $id = $path[4]; // https://www.facebook.com/fds/videos/vb.123/123/
+ }
+ else
+ {
+ $id = $path[3]; // https://www.facebook.com/fds/videos/123/
+ }
break;
case "veoh":
$id = $path[2]; // http://www.veoh.com/watch/123
@@ -1364,7 +1343,14 @@ function mycode_parse_video($video, $url)
$id = $input['i']; // http://www.liveleak.com/view?i=123
break;
case "yahoo":
- $id = $path[1]; // http://xy.screen.yahoo.com/fds-123.html
+ if(isset($path[2]))
+ {
+ $id = $path[2]; // http://xy.screen.yahoo.com/fds/fds-123.html
+ }
+ else
+ {
+ $id = $path[1]; // http://xy.screen.yahoo.com/fds-123.html
+ }
// Support for localized portals
$domain = explode('.', $parsed_url['host']);
if($domain[0] != 'screen' && preg_match('#^([a-z-]+)$#', $domain[0]))
@@ -1377,7 +1363,14 @@ function mycode_parse_video($video, $url)
}
break;
case "vimeo":
- $id = $path[1]; // http://vimeo.com/fds123
+ if(isset($path[3]))
+ {
+ $id = $path[3]; // http://vimeo.com/fds/fds/fds123
+ }
+ else
+ {
+ $id = $path[1]; // http://vimeo.com/fds123
+ }
break;
case "youtube":
if($fragments[0])
diff --git a/Upload/inc/class_session.php b/Upload/inc/class_session.php
index 7839fe6..aa71e25 100644
--- a/Upload/inc/class_session.php
+++ b/Upload/inc/class_session.php
@@ -467,7 +467,7 @@ function update_session($sid, $uid=0)
$onlinedata['time'] = TIME_NOW;
$onlinedata['location'] = $db->escape_string(substr(get_current_location(), 0, 150));
- $onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 100));
+ $onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 200));
$onlinedata['location1'] = (int)$speciallocs['1'];
$onlinedata['location2'] = (int)$speciallocs['2'];
@@ -512,13 +512,13 @@ function create_session($uid=0)
}
else
{
- $onlinedata['sid'] = md5(uniqid(microtime(true), true));
+ $onlinedata['sid'] = md5(random_str(50));
}
$onlinedata['time'] = TIME_NOW;
$onlinedata['ip'] = $db->escape_binary($this->packedip);
$onlinedata['location'] = $db->escape_string(substr(get_current_location(), 0, 150));
- $onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 100));
+ $onlinedata['useragent'] = $db->escape_string(my_substr($this->useragent, 0, 200));
$onlinedata['location1'] = (int)$speciallocs['1'];
$onlinedata['location2'] = (int)$speciallocs['2'];
diff --git a/Upload/inc/datahandlers/post.php b/Upload/inc/datahandlers/post.php
index 152d3a0..bdcda63 100644
--- a/Upload/inc/datahandlers/post.php
+++ b/Upload/inc/datahandlers/post.php
@@ -626,6 +626,12 @@ function verify_prefix()
}
else
{
+ if(!empty($this->data['tid']))
+ {
+ // Fetch the thread
+ $thread = get_thread($this->data['tid']);
+ }
+
$prefix_cache = build_prefixes($prefix);
if(empty($prefix_cache))
@@ -645,7 +651,7 @@ function verify_prefix()
$user = get_user($this->data['uid']);
}
- if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))
+ if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])) && (empty($this->data['tid']) || $prefix != $thread['prefix']))
{
$this->set_error('invalid_prefix');
return false;
@@ -656,7 +662,7 @@ function verify_prefix()
// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix_cache['forums']);
- if(!in_array($this->data['fid'], $forums))
+ if(!in_array($this->data['fid'], $forums) && (empty($this->data['tid']) || $prefix != $thread['prefix']))
{
$this->set_error('invalid_prefix');
return false;
@@ -699,14 +705,7 @@ function verify_prefix()
}
}
- if($required['groups'] != "-1")
- {
- if(!is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))
- {
- $num_prefixes = true;
- }
- }
- else
+ if(is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))
{
$num_prefixes = true;
}
@@ -1123,7 +1122,7 @@ function insert_post()
// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices
$query = $db->query("
- SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.subscriptionkey, s.notification
+ SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.notification
FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
WHERE (s.notification='1' OR s.notification='2') AND s.tid='{$post['tid']}'
@@ -1205,7 +1204,7 @@ function insert_post()
$emailsubject = $lang->sprintf($emailsubject, $subject);
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
- $emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code);
+ $emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $post_code);
$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',
@@ -1222,7 +1221,7 @@ function insert_post()
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$pm = array(
'subject' => array('pmsubject_subscription', $subject),
- 'message' => array('pm_subscription', $subscribedmember['username'], $post['username'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code),
+ 'message' => array('pm_subscription', $subscribedmember['username'], $post['username'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $post_code),
'touid' => $subscribedmember['uid'],
'language' => $subscribedmember['language'],
'language_file' => 'messages'
@@ -1472,6 +1471,7 @@ function insert_thread()
"dateline" => (int)$thread['dateline'],
"lastpost" => (int)$thread['dateline'],
"lastposter" => $db->escape_string($thread['username']),
+ "lastposteruid" => $thread['uid'],
"views" => 0,
"replies" => 0,
"visible" => $visible,
diff --git a/Upload/inc/datahandlers/user.php b/Upload/inc/datahandlers/user.php
index 200bfe4..8140f2c 100644
--- a/Upload/inc/datahandlers/user.php
+++ b/Upload/inc/datahandlers/user.php
@@ -1517,7 +1517,17 @@ function delete_user($delete_uids, $prunecontent=0)
$plugins->run_hooks('datahandler_user_delete_start', $this);
$this->delete_uids = implode(',', $this->delete_uids);
-
+
+ if(empty($this->delete_uids))
+ {
+ $this->deleted_users = 0;
+ $this->return_values = array(
+ "deleted_users" => $this->deleted_users
+ );
+
+ return $this->return_values;
+ }
+
$this->delete_content();
// Delete the user
@@ -1611,6 +1621,11 @@ function delete_content($delete_uids=false)
$plugins->run_hooks('datahandler_user_delete_content', $this);
+ if(empty($this->delete_uids))
+ {
+ return;
+ }
+
$db->delete_query('userfields', "ufid IN({$this->delete_uids})");
$db->delete_query('privatemessages', "uid IN({$this->delete_uids})");
$db->delete_query('events', "uid IN({$this->delete_uids})");
@@ -1641,11 +1656,10 @@ function delete_content($delete_uids=false)
$db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");
// Remove any of the user(s) uploaded avatars
- $query = $db->simple_select('users', 'avatar', "uid IN({$this->delete_uids}) AND avatartype='upload'");
- while($avatar = $db->fetch_field($query, 'avatar'))
+ require_once MYBB_ROOT.'inc/functions_upload.php';
+ foreach(explode(',', $this->delete_uids) as $uid)
{
- $avatar = substr($avatar, 2, -20);
- @unlink(MYBB_ROOT.$avatar);
+ remove_avatars($uid);
}
}
@@ -1679,6 +1693,11 @@ function delete_posts($delete_uids=false)
$plugins->run_hooks('datahandler_user_delete_posts', $this);
+ if(empty($this->delete_uids))
+ {
+ return;
+ }
+
// Threads
$query = $db->simple_select('threads', 'tid', "uid IN({$this->delete_uids})");
while($tid = $db->fetch_field($query, 'tid'))
@@ -1749,7 +1768,19 @@ function clear_profile($delete_uids=false, $gid=0)
$plugins->run_hooks('datahandler_user_clear_profile', $this);
+ if(empty($this->delete_uids))
+ {
+ return;
+ }
+
$db->update_query("users", $update, "uid IN({$this->delete_uids})");
$db->delete_query('userfields', "ufid IN({$this->delete_uids})");
+
+ // Remove any of the user(s) uploaded avatars
+ require_once MYBB_ROOT.'inc/functions_upload.php';
+ foreach(explode(',', $this->delete_uids) as $uid)
+ {
+ remove_avatars($uid);
+ }
}
}
diff --git a/Upload/inc/datahandlers/warnings.php b/Upload/inc/datahandlers/warnings.php
index 37a9c5e..97d9a85 100644
--- a/Upload/inc/datahandlers/warnings.php
+++ b/Upload/inc/datahandlers/warnings.php
@@ -362,13 +362,18 @@ function expire_warnings()
*/
function update_user($method='insert')
{
- global $db, $mybb, $lang;
+ global $db, $mybb, $lang, $cache, $groupscache;
if($mybb->settings['maxwarningpoints'] < 1)
{
$mybb->settings['maxwarningpoints'] = 10;
}
+ if(!is_array($groupscache))
+ {
+ $groupscache = $cache->read("usergroups");
+ }
+
$warning = &$this->data;
$user = get_user($warning['uid']);
diff --git a/Upload/inc/db_mysql.php b/Upload/inc/db_mysql.php
index 9de1b19..ebcb301 100644
--- a/Upload/inc/db_mysql.php
+++ b/Upload/inc/db_mysql.php
@@ -73,6 +73,13 @@ class DB_MySQL implements DB_Base
*/
public $current_link;
+ /**
+ * The database name.
+ *
+ * @var string
+ */
+ public $database;
+
/**
* Explanation of a query.
*
@@ -259,6 +266,8 @@ function connect($config)
*/
function select_db($database)
{
+ $this->database = $database;
+
$this->current_link = &$this->read_link;
$read_success = @mysql_select_db($database, $this->read_link) or $this->error("[READ] Unable to select database", $this->read_link);
if($this->write_link)
@@ -636,18 +645,25 @@ function list_tables($database, $prefix='')
{
if($prefix)
{
- $query = $this->query("
- SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
- WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE'
- AND `TABLE_NAME` LIKE '".$this->escape_string($prefix)."%'
- ");
+ if(version_compare($this->get_version(), '5.0.2', '>='))
+ {
+ $query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE' AND `Tables_in_$database` LIKE '".$this->escape_string($prefix)."%'");
+ }
+ else
+ {
+ $query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");
+ }
}
else
{
- $query = $this->query("
- SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
- WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE'
- ");
+ if(version_compare($this->get_version(), '5.0.2', '>='))
+ {
+ $query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE'");
+ }
+ else
+ {
+ $query = $this->query("SHOW TABLES FROM `$database`");
+ }
}
$tables = array();
@@ -668,11 +684,15 @@ function list_tables($database, $prefix='')
function table_exists($table)
{
// Execute on master server to ensure if we've just created a table that we get the correct result
- $query = $this->write_query("
- SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
- WHERE `TABLE_TYPE` = 'BASE TABLE'
- AND `TABLE_NAME` LIKE '{$this->table_prefix}$table'
- ");
+ if(version_compare($this->get_version(), '5.0.2', '>='))
+ {
+ $query = $this->query("SHOW FULL TABLES FROM `".$this->database."` WHERE table_type = 'BASE TABLE' AND `Tables_in_".$this->database."` = '{$this->table_prefix}$table'");
+ }
+ else
+ {
+ $query = $this->query("SHOW TABLES LIKE '{$this->table_prefix}$table'");
+ }
+
$exists = $this->num_rows($query);
if($exists > 0)
{
diff --git a/Upload/inc/db_mysqli.php b/Upload/inc/db_mysqli.php
index 61fd1a5..dd2e804 100644
--- a/Upload/inc/db_mysqli.php
+++ b/Upload/inc/db_mysqli.php
@@ -73,6 +73,13 @@ class DB_MySQLi implements DB_Base
*/
public $current_link;
+ /**
+ * The database name.
+ *
+ * @var string
+ */
+ public $database;
+
/**
* Explanation of a query.
*
@@ -273,6 +280,8 @@ function connect($config)
*/
function select_db($database)
{
+ $this->database = $database;
+
$master_success = @mysqli_select_db($this->read_link, $database) or $this->error("[READ] Unable to select database", $this->read_link);
if($this->write_link)
{
@@ -632,18 +641,25 @@ function list_tables($database, $prefix='')
{
if($prefix)
{
- $query = $this->query("
- SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
- WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE'
- AND `TABLE_NAME` LIKE '".$this->escape_string($prefix)."%'
- ");
+ if(version_compare($this->get_version(), '5.0.2', '>='))
+ {
+ $query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE' AND `Tables_in_$database` LIKE '".$this->escape_string($prefix)."%'");
+ }
+ else
+ {
+ $query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");
+ }
}
else
{
- $query = $this->query("
- SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
- WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE'
- ");
+ if(version_compare($this->get_version(), '5.0.2', '>='))
+ {
+ $query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE'");
+ }
+ else
+ {
+ $query = $this->query("SHOW TABLES FROM `$database`");
+ }
}
$tables = array();
@@ -651,6 +667,7 @@ function list_tables($database, $prefix='')
{
$tables[] = $table;
}
+
return $tables;
}
@@ -663,13 +680,16 @@ function list_tables($database, $prefix='')
function table_exists($table)
{
// Execute on master server to ensure if we've just created a table that we get the correct result
- $query = $this->write_query("
- SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
- WHERE `TABLE_TYPE` = 'BASE TABLE'
- AND `TABLE_NAME` LIKE '{$this->table_prefix}$table'
- ");
- $exists = $this->num_rows($query);
+ if(version_compare($this->get_version(), '5.0.2', '>='))
+ {
+ $query = $this->query("SHOW FULL TABLES FROM `".$this->database."` WHERE table_type = 'BASE TABLE' AND `Tables_in_".$this->database."` = '{$this->table_prefix}$table'");
+ }
+ else
+ {
+ $query = $this->query("SHOW TABLES LIKE '{$this->table_prefix}$table'");
+ }
+ $exists = $this->num_rows($query);
if($exists > 0)
{
return true;
diff --git a/Upload/inc/functions.php b/Upload/inc/functions.php
index 5c68ea0..f588cd7 100644
--- a/Upload/inc/functions.php
+++ b/Upload/inc/functions.php
@@ -2432,9 +2432,9 @@ function update_stats($changes=array(), $force=false)
// Update stats row for today in the database
$todays_stats = array(
"dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
- "numusers" => $stats['numusers'],
- "numthreads" => $stats['numthreads'],
- "numposts" => $stats['numposts']
+ "numusers" => (int)$stats['numusers'],
+ "numthreads" => (int)$stats['numthreads'],
+ "numposts" => (int)$stats['numposts']
);
$db->replace_query("stats", $todays_stats, "dateline");
@@ -3367,11 +3367,8 @@ function build_clickable_smilies()
}
foreach($smilie_cache as $smilie)
{
- if($smilie['showclickable'] != 0)
- {
- $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
- $smiliecache[$smilie['sid']] = $smilie;
- }
+ $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
+ $smiliecache[$smilie['sid']] = $smilie;
}
}
@@ -3399,7 +3396,7 @@ function build_clickable_smilies()
$extra_class = '';
foreach($smiliecache as $smilie)
{
- if($i < $mybb->settings['smilieinsertertot'])
+ if($i < $mybb->settings['smilieinsertertot'] && $smilie['showclickable'] != 0)
{
if($counter == 0)
{
@@ -3505,14 +3502,15 @@ function build_prefixes($pid=0)
}
/**
- * Build the thread prefix selection menu
+ * Build the thread prefix selection menu for the current user
*
* @param int|string $fid The forum ID (integer ID or string all)
* @param int|string $selected_pid The selected prefix ID (integer ID or string any)
* @param int $multiple Allow multiple prefix selection
+ * @param int $previous_pid The previously selected prefix ID
* @return string The thread prefix selection menu
*/
-function build_prefix_select($fid, $selected_pid=0, $multiple=0)
+function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)
{
global $cache, $db, $lang, $mybb, $templates;
@@ -3524,18 +3522,8 @@ function build_prefix_select($fid, $selected_pid=0, $multiple=0)
$prefix_cache = build_prefixes(0);
if(empty($prefix_cache))
{
- return false; // We've got no prefixes to show
- }
-
- $groups = array($mybb->user['usergroup']);
- if($mybb->user['additionalgroups'])
- {
- $exp = explode(",", $mybb->user['additionalgroups']);
-
- foreach($exp as $group)
- {
- $groups[] = $group;
- }
+ // We've got no prefixes to show
+ return '';
}
// Go through each of our prefixes and decide which ones we can use
@@ -3547,36 +3535,23 @@ function build_prefix_select($fid, $selected_pid=0, $multiple=0)
// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix['forums']);
- if(!in_array($fid, $forums))
+ if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid)
{
// This prefix is not in our forum list
continue;
}
}
- if($prefix['groups'] != "-1")
+ if(is_member($prefix['groups']) || $prefix['pid'] == $previous_pid)
{
- $prefix_groups = explode(",", $prefix['groups']);
-
- foreach($groups as $group)
- {
- if(in_array($group, $prefix_groups) && !isset($prefixes[$prefix['pid']]))
- {
- // Our group can use this prefix!
- $prefixes[$prefix['pid']] = $prefix;
- }
- }
- }
- else
- {
- // This prefix is for anybody to use...
+ // The current user can use this prefix
$prefixes[$prefix['pid']] = $prefix;
}
}
if(empty($prefixes))
{
- return false;
+ return '';
}
$prefixselect = $prefixselect_prefix = '';
@@ -3621,10 +3596,11 @@ function build_prefix_select($fid, $selected_pid=0, $multiple=0)
}
/**
- * Build the thread prefix selection menu for a forum
+ * Build the thread prefix selection menu for a forum without group permission checks
*
* @param int $fid The forum ID (integer ID)
* @param int $selected_pid The selected prefix ID (integer ID)
+ * @return string The thread prefix selection menu
*/
function build_forum_prefix_select($fid, $selected_pid=0)
{
@@ -3635,7 +3611,8 @@ function build_forum_prefix_select($fid, $selected_pid=0)
$prefix_cache = build_prefixes(0);
if(empty($prefix_cache))
{
- return false; // We've got no prefixes to show
+ // We've got no prefixes to show
+ return '';
}
// Go through each of our prefixes and decide which ones we can use
@@ -3662,7 +3639,7 @@ function build_forum_prefix_select($fid, $selected_pid=0)
if(empty($prefixes))
{
- return false;
+ return '';
}
$default_selected = array();
@@ -4837,14 +4814,7 @@ function leave_usergroup($uid, $leavegroup)
{
global $db, $mybb, $cache;
- if($uid == $mybb->user['uid'])
- {
- $user = $mybb->user;
- }
- else
- {
- $user = get_user($uid);
- }
+ $user = get_user($uid);
$groupslist = $comma = '';
$usergroups = $user['additionalgroups'].",";
@@ -6779,10 +6749,13 @@ function build_timezone_select($name, $selected=0, $short=false)
*
* @param string $url The URL of the remote file
* @param array $post_data The array of post data
+ * @param int $max_redirects Number of maximum redirects
* @return string|bool The remote file contents. False on failure
*/
-function fetch_remote_file($url, $post_data=array())
+function fetch_remote_file($url, $post_data=array(), $max_redirects=20)
{
+ global $mybb;
+
$post_body = '';
if(!empty($post_data))
{
@@ -6795,18 +6768,56 @@ function fetch_remote_file($url, $post_data=array())
if(function_exists("curl_init"))
{
+ $can_followlocation = @ini_get('open_basedir') === '' && !$mybb->safemode;
+
+ $request_header = $max_redirects != 0 && !$can_followlocation;
+
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, 0);
+ curl_setopt($ch, CURLOPT_HEADER, $request_header);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
+
+ if($max_redirects != 0 && $can_followlocation)
+ {
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+ curl_setopt($ch, CURLOPT_MAXREDIRS, $max_redirects);
+ }
+
if(!empty($post_body))
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body);
}
- $data = curl_exec($ch);
+
+ $response = curl_exec($ch);
+
+ if($request_header)
+ {
+ $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
+ $header = substr($response, 0, $header_size);
+ $body = substr($response, $header_size);
+
+ if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302)))
+ {
+ preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
+
+ if($matches)
+ {
+ $data = fetch_remote_file(trim(array_pop($matches)), $post_data, --$max_redirects);
+ }
+ }
+ else
+ {
+ $data = $body;
+ }
+ }
+ else
+ {
+ $data = $response;
+ }
+
curl_close($ch);
return $data;
}
@@ -6817,15 +6828,15 @@ function fetch_remote_file($url, $post_data=array())
{
return false;
}
- if(!$url['port'])
+ if(!isset($url['port']))
{
$url['port'] = 80;
}
- if(!$url['path'])
+ if(!isset($url['path']))
{
$url['path'] = "/";
}
- if($url['query'])
+ if(isset($url['query']))
{
$url['path'] .= "?{$url['query']}";
}
@@ -6878,13 +6889,36 @@ function fetch_remote_file($url, $post_data=array())
{
return false;
}
+
+ $data = null;
+
while(!feof($fp))
{
$data .= fgets($fp, 12800);
}
fclose($fp);
+
$data = explode("\r\n\r\n", $data, 2);
- return $data[1];
+
+ $header = $data[0];
+ $status_line = current(explode("\n\n", $header, 1));
+ $body = $data[1];
+
+ if($max_redirects != 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
+ {
+ preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
+
+ if($matches)
+ {
+ $data = fetch_remote_file(trim(array_pop($matches)), $post_data, --$max_redirects);
+ }
+ }
+ else
+ {
+ $data = $body;
+ }
+
+ return $data;
}
else if(empty($post_data))
{
@@ -7651,129 +7685,186 @@ function signed($int)
}
/**
- * Returns a securely generated seed for PHP's RNG (Random Number Generator)
+ * Returns a securely generated seed
*
- * @param int $count Length of the seed bytes (8 is default. Provides good cryptographic variance)
- * @return int An integer equivalent of a secure hexadecimal seed
+ * @return string A secure binary seed
*/
-function secure_seed_rng($count=8)
+function secure_binary_seed_rng($bytes)
{
- $output = '';
- // DIRECTORY_SEPARATOR checks if running windows
- if(DIRECTORY_SEPARATOR != '\\')
+ $output = null;
+
+ if(version_compare(PHP_VERSION, '7.0', '>='))
{
- // Unix/Linux
- // Use OpenSSL when available
- if(function_exists('openssl_random_pseudo_bytes'))
- {
- $output = openssl_random_pseudo_bytes($count);
- }
- // Try mcrypt
- elseif(function_exists('mcrypt_create_iv'))
+ try
{
- $output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
+ $output = random_bytes($bytes);
+ } catch (Exception $e) {
}
- // Try /dev/urandom
- elseif(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb')))
+ }
+
+ if(strlen($output) < $bytes)
+ {
+ if(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb')))
{
- $output = @fread($handle, $count);
+ $output = @fread($handle, $bytes);
@fclose($handle);
}
}
else
{
- // Windows
- // Use OpenSSL when available
- // PHP <5.3.4 had a bug which makes that function unusable on Windows
- if(function_exists('openssl_random_pseudo_bytes') && version_compare(PHP_VERSION, '5.3.4', '>='))
+ return $output;
+ }
+
+ if(strlen($output) < $bytes)
+ {
+ if(function_exists('mcrypt_create_iv'))
{
- $output = openssl_random_pseudo_bytes($count);
+ if (DIRECTORY_SEPARATOR == '/')
+ {
+ $source = MCRYPT_DEV_URANDOM;
+ }
+ else
+ {
+ $source = MCRYPT_RAND;
+ }
+
+ $output = @mcrypt_create_iv($bytes, $source);
}
- // Try mcrypt
- elseif(function_exists('mcrypt_create_iv'))
+ }
+ else
+ {
+ return $output;
+ }
+
+ if(strlen($output) < $bytes)
+ {
+ if(function_exists('openssl_random_pseudo_bytes'))
{
- $output = mcrypt_create_iv($count, MCRYPT_RAND);
+ // PHP <5.3.4 had a bug which makes that function unusable on Windows
+ if ((DIRECTORY_SEPARATOR == '/') || version_compare(PHP_VERSION, '5.3.4', '>='))
+ {
+ $output = openssl_random_pseudo_bytes($bytes, $crypto_strong);
+ if ($crypto_strong == false)
+ {
+ $output = null;
+ }
+ }
}
- // Try Windows CAPICOM before using our own generator
- elseif(class_exists('COM'))
+ }
+ else
+ {
+ return $output;
+ }
+
+ if(strlen($output) < $bytes)
+ {
+ if(class_exists('COM'))
{
try
{
$CAPI_Util = new COM('CAPICOM.Utilities.1');
if(is_callable(array($CAPI_Util, 'GetRandom')))
{
- $output = $CAPI_Util->GetRandom($count, 0);
+ $output = $CAPI_Util->GetRandom($bytes, 0);
}
} catch (Exception $e) {
}
}
}
-
- // Didn't work? Do we still not have enough bytes? Use our own (less secure) rng generator
- if(strlen($output) < $count)
+ else
{
- $output = '';
+ return $output;
+ }
+ if(strlen($output) < $bytes)
+ {
// Close to what PHP basically uses internally to seed, but not quite.
$unique_state = microtime().@getmypid();
- for($i = 0; $i < $count; $i += 16)
+ $rounds = ceil($bytes / 16);
+
+ for($i = 0; $i < $rounds; $i++)
{
$unique_state = md5(microtime().$unique_state);
- $output .= pack('H*', md5($unique_state));
+ $output .= md5($unique_state);
}
- }
- // /dev/urandom and openssl will always be twice as long as $count. base64_encode will roughly take up 33% more space but crc32 will put it to 32 characters
- $output = hexdec(substr(dechex(crc32(base64_encode($output))), 0, $count));
+ $output = substr($output, 0, ($bytes * 2));
- return $output;
+ $output = pack('H*', $output);
+
+ return $output;
+ }
+ else
+ {
+ return $output;
+ }
}
/**
- * Wrapper function for mt_rand. Automatically seeds using a secure seed once.
+ * Returns a securely generated seed integer
*
- * @param int $min Optional lowest value to be returned (default: 0)
- * @param int $max Optional highest value to be returned (default: mt_getrandmax())
- * @param boolean $force_seed True forces it to reseed the RNG first
* @return int An integer equivalent of a secure hexadecimal seed
*/
-function my_rand($min=null, $max=null, $force_seed=false)
+function secure_seed_rng()
{
- static $seeded = false;
- static $obfuscator = 0;
+ $bytes = PHP_INT_SIZE;
- if($seeded == false || $force_seed == true)
+ do
{
- mt_srand(secure_seed_rng());
- $seeded = true;
- $obfuscator = abs((int) secure_seed_rng());
+ $output = secure_binary_seed_rng($bytes);
- // Ensure that $obfuscator is <= mt_getrandmax() for 64 bit systems.
- if($obfuscator > mt_getrandmax())
+ // convert binary data to a decimal number
+ if ($bytes == 4)
{
- $obfuscator -= mt_getrandmax();
+ $elements = unpack('i', $output);
+ $output = abs($elements[1]);
}
+ else
+ {
+ $elements = unpack('N2', $output);
+ $output = abs($elements[1] << 32 | $elements[2]);
+ }
+
+ } while($output > PHP_INT_MAX);
+
+ return $output;
+}
+
+/**
+ * Generates a cryptographically secure random number.
+ *
+ * @param int $min Optional lowest value to be returned (default: 0)
+ * @param int $max Optional highest value to be returned (default: PHP_INT_MAX)
+ */
+function my_rand($min=0, $max=PHP_INT_MAX)
+{
+ // backward compatibility
+ if($min === null || $max === null || $max < $min)
+ {
+ $min = 0;
+ $max = PHP_INT_MAX;
}
- if($min !== null && $max !== null)
+ if(version_compare(PHP_VERSION, '7.0', '>='))
{
- $distance = $max - $min;
- if($distance > 0)
+ try
{
- return $min + (int)((float)($distance + 1) * (float)(mt_rand() ^ $obfuscator) / (mt_getrandmax() + 1));
+ $result = random_int($min, $max);
+ } catch (Exception $e) {
}
- else
+
+ if(isset($result))
{
- return mt_rand($min, $max);
+ return $result;
}
}
- else
- {
- $val = mt_rand() ^ $obfuscator;
- return $val;
- }
+
+ $seed = secure_seed_rng();
+
+ $distance = $max - $min;
+ return $min + floor($distance * ($seed / PHP_INT_MAX) );
}
/**
@@ -8112,20 +8203,22 @@ function send_pm($pm, $fromid = 0, $admin_override=false)
foreach(array('subject', 'message') as $key)
{
- $lang_string = $pm[$key];
if(is_array($pm[$key]))
{
+ $lang_string = $lang->{$pm[$key][0]};
$num_args = count($pm[$key]);
for($i = 1; $i < $num_args; $i++)
{
- $lang->{$pm[$key][0]} = str_replace('{'.$i.'}', $pm[$key][$i], $lang->{$pm[$key][0]});
+ $lang_string = str_replace('{'.$i.'}', $pm[$key][$i], $lang_string);
}
-
- $lang_string = $pm[$key][0];
+ }
+ else
+ {
+ $lang_string = $lang->{$pm[$key]};
}
- $pm[$key] = $lang->{$lang_string};
+ $pm[$key] = $lang_string;
}
if(isset($revert))
@@ -8141,8 +8234,6 @@ function send_pm($pm, $fromid = 0, $admin_override=false)
return false;
}
- $lang->load('messages');
-
require_once MYBB_ROOT."inc/datahandlers/pm.php";
$pmhandler = new PMDataHandler();
diff --git a/Upload/inc/functions_forumlist.php b/Upload/inc/functions_forumlist.php
index c74c422..40c4df7 100644
--- a/Upload/inc/functions_forumlist.php
+++ b/Upload/inc/functions_forumlist.php
@@ -184,8 +184,8 @@ function build_forumbits($pid=0, $depth=1)
);
}
- // If the current forums lastpost is greater than other child forums of the current parent, overwrite it
- if(!isset($parent_lastpost) || $lastpost_data['lastpost'] > $parent_lastpost['lastpost'])
+ // If the current forums lastpost is greater than other child forums of the current parent and forum info isn't hidden, overwrite it
+ if((!isset($parent_lastpost) || $lastpost_data['lastpost'] > $parent_lastpost['lastpost']) && $hideinfo != true)
{
$parent_lastpost = $lastpost_data;
}
diff --git a/Upload/inc/functions_post.php b/Upload/inc/functions_post.php
index 4561150..2082c99 100644
--- a/Upload/inc/functions_post.php
+++ b/Upload/inc/functions_post.php
@@ -265,7 +265,7 @@ function build_postbit($post, $post_type=0)
}
}
}
-
+
$post['usertitle'] = htmlspecialchars_uni($post['usertitle']);
if($usergroup['stars'])
@@ -321,7 +321,11 @@ function build_postbit($post, $post_type=0)
eval("\$post['useravatar'] = \"".$templates->get("postbit_avatar")."\";");
}
- eval("\$post['button_find'] = \"".$templates->get("postbit_find")."\";");
+ $post['button_find'] = '';
+ if($mybb->usergroup['cansearch'] == 1)
+ {
+ eval("\$post['button_find'] = \"".$templates->get("postbit_find")."\";");
+ }
if($mybb->settings['enablepms'] == 1 && $post['receivepms'] != 0 && $mybb->usergroup['cansendpms'] == 1 && my_strpos(",".$post['ignorelist'].",", ",".$mybb->user['uid'].",") === false)
{
@@ -329,7 +333,7 @@ function build_postbit($post, $post_type=0)
}
$post['button_rep'] = '';
- if($post_type != 3 && $mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']) && $post['uid'] != $mybb->user['uid'])
+ if($post_type != 3 && $mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']) && $post['uid'] != $mybb->user['uid'] && (!isset($post['visible']) || $post['visible'] == 1) && (!isset($thread['visible']) || $thread['visible'] == 1))
{
if(!$post['pid'])
{
@@ -478,7 +482,7 @@ function build_postbit($post, $post_type=0)
{
$post['usertitle'] = $lang->guest;
}
-
+
$post['usertitle'] = htmlspecialchars_uni($post['usertitle']);
$usergroup['title'] = $lang->na;
@@ -525,6 +529,11 @@ function build_postbit($post, $post_type=0)
$post['editedmsg'] = '';
if(!$post_type)
{
+ if(!isset($forumpermissions))
+ {
+ $forumpermissions = forum_permissions($fid);
+ }
+
// Figure out if we need to show an "edited by" message
if($post['edituid'] != 0 && $post['edittime'] != 0 && $post['editusername'] != "" && (($mybb->settings['showeditedby'] != 0 && $usergroup['cancp'] == 0) || ($mybb->settings['showeditedbyadmin'] != 0 && $usergroup['cancp'] == 1)))
{
@@ -610,6 +619,11 @@ function build_postbit($post, $post_type=0)
}
}
+ if(!isset($ismod))
+ {
+ $ismod = is_moderator($fid);
+ }
+
// Inline moderation stuff
if($ismod)
{
@@ -784,6 +798,19 @@ function build_postbit($post, $post_type=0)
default: // Regular post
$post = $plugins->run_hooks("postbit", $post);
+ if(!isset($ignored_users))
+ {
+ $ignored_users = array();
+ if($mybb->user['uid'] > 0 && $mybb->user['ignorelist'] != "")
+ {
+ $ignore_list = explode(',', $mybb->user['ignorelist']);
+ foreach($ignore_list as $uid)
+ {
+ $ignored_users[$uid] = 1;
+ }
+ }
+ }
+
// Is this author on the ignore list of the current user? Hide this post
if(is_array($ignored_users) && $post['uid'] != 0 && isset($ignored_users[$post['uid']]) && $ignored_users[$post['uid']] == 1)
{
@@ -821,6 +848,11 @@ function get_post_attachments($id, &$post)
$validationcount = 0;
$tcount = 0;
$post['attachmentlist'] = $post['thumblist'] = $post['imagelist'] = '';
+ if(!isset($forumpermissions))
+ {
+ $forumpermissions = forum_permissions($post['fid']);
+ }
+
if(isset($attachcache[$id]) && is_array($attachcache[$id]))
{ // This post has 1 or more attachments
foreach($attachcache[$id] as $aid => $attachment)
diff --git a/Upload/inc/functions_search.php b/Upload/inc/functions_search.php
index 3bda94f..7e4e7b9 100644
--- a/Upload/inc/functions_search.php
+++ b/Upload/inc/functions_search.php
@@ -229,12 +229,14 @@ function get_password_protected_forums($fids=array())
*/
function clean_keywords($keywords)
{
+ global $db;
+
$keywords = my_strtolower($keywords);
- $keywords = str_replace("%", "\\%", $keywords);
+ $keywords = $db->escape_string_like($keywords);
$keywords = preg_replace("#\*{2,}#s", "*", $keywords);
$keywords = str_replace("*", "%", $keywords);
- $keywords = preg_replace("#([\[\]\|\.\,:'])#s", " ", $keywords);
$keywords = preg_replace("#\s+#s", " ", $keywords);
+ $keywords = str_replace('\\"', '"', $keywords);
// Search for "and" or "or" and remove if it's at the beginning
$keywords = trim($keywords);
@@ -1092,7 +1094,10 @@ function perform_search_mysql($search)
if($search['matchusername'])
{
$user = get_user_by_username($search['author']);
- $userids[] = $user['uid'];
+ if($user)
+ {
+ $userids[] = $user['uid'];
+ }
}
else
{
@@ -1506,7 +1511,10 @@ function perform_search_mysql_ft($search)
if($search['matchusername'])
{
$user = get_user_by_username($search['author']);
- $userids[] = $user['uid'];
+ if($user)
+ {
+ $userids[] = $user['uid'];
+ }
}
else
{
diff --git a/Upload/inc/functions_task.php b/Upload/inc/functions_task.php
index 61908f7..17b0486 100644
--- a/Upload/inc/functions_task.php
+++ b/Upload/inc/functions_task.php
@@ -58,6 +58,19 @@ function run_task($tid=0)
{
add_task_log($task, $lang->missing_task);
}
+
+ // If task file does not exist, disable task and inform the administrator
+ $updated_task = array(
+ "enabled" => 0,
+ "locked" => 0
+ );
+ $db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
+
+ $subject = $lang->sprintf($lang->email_broken_task_subject, $mybb->settings['bbname']);
+ $message = $lang->sprintf($lang->email_broken_task, $mybb->settings['bbname'], $mybb->settings['bburl'], $task['title']);
+
+ my_mail($mybb->settings['adminemail'], $subject, $message, $mybb->settings['adminemail']);
+
$cache->update_tasks();
return false;
}
diff --git a/Upload/inc/functions_upload.php b/Upload/inc/functions_upload.php
index 7f702e1..63dfc9a 100644
--- a/Upload/inc/functions_upload.php
+++ b/Upload/inc/functions_upload.php
@@ -473,6 +473,12 @@ function upload_attachment($attachment, $update_attachment=false)
{
$month_dir = '';
}
+ else
+ {
+ $index = @fopen($mybb->settings['uploadspath']."/".$month_dir."/index.html", 'w');
+ @fwrite($index, "\n\n\n\n\n \n\n");
+ @fclose($index);
+ }
}
}
diff --git a/Upload/inc/functions_user.php b/Upload/inc/functions_user.php
index c274e81..d7d0746 100644
--- a/Upload/inc/functions_user.php
+++ b/Upload/inc/functions_user.php
@@ -268,9 +268,7 @@ function add_subscribed_thread($tid, $notification=1, $uid=0)
'uid' => (int)$uid,
'tid' => (int)$tid,
'notification' => (int)$notification,
- 'dateline' => TIME_NOW,
- 'subscriptionkey' => md5(TIME_NOW.$uid.$tid)
-
+ 'dateline' => TIME_NOW
);
$db->insert_query("threadsubscriptions", $insert_array);
}
diff --git a/Upload/inc/functions_warnings.php b/Upload/inc/functions_warnings.php
index 686bd19..0fdd5f9 100644
--- a/Upload/inc/functions_warnings.php
+++ b/Upload/inc/functions_warnings.php
@@ -9,11 +9,11 @@
*/
/**
- * @param resource|PDOStatement|mysqli_result $query
- * @param array $max_expiration_times Will be overwritten
- * @param array $check_levels Will be overwritten
+ * @param resource|PDOStatement|mysqli_result $query The query to be run. Needs to select the "action" column of the "warninglevels" table
+ * @param array $max_expiration_times Return variable. The maximum expiration time
+ * @param array $check_levels Return variable. Whether those "levels" were checked
*/
-function find_warnlevels_to_check(&$query, &$max_expiration_times, &$check_levels)
+function find_warnlevels_to_check($query, &$max_expiration_times, &$check_levels)
{
global $db;
diff --git a/Upload/inc/languages/polish.php b/Upload/inc/languages/polish.php
index 63a8296..06b2b91 100644
--- a/Upload/inc/languages/polish.php
+++ b/Upload/inc/languages/polish.php
@@ -16,7 +16,7 @@
$langinfo['website'] = "http://www.mybboard.pl/";
// Compatible version of MyBB
-$langinfo['version'] = "1806";
+$langinfo['version'] = "1807";
// Sets if the translation includes the Admin CP (1 = yes, 0 = no)
$langinfo['admin'] = 1;
diff --git a/Upload/inc/languages/polish/admin/config_settings.lang.php b/Upload/inc/languages/polish/admin/config_settings.lang.php
index ec9e322..4dc7097 100644
--- a/Upload/inc/languages/polish/admin/config_settings.lang.php
+++ b/Upload/inc/languages/polish/admin/config_settings.lang.php
@@ -461,6 +461,8 @@
$l['setting_group_mailsettings_desc'] = "W tej sekcji masz możliwość zarządzania systemem mailingu w MyBB, zarówno obsługiwanym przez funkcję mail PHP, jak i przez zewnętrzny serwer SMTP.";
$l['setting_returnemail'] = "Adres zwrotny";
$l['setting_returnemail_desc'] = "Adres zwrotny dla e-maili wysyłanych za pośrednictwem systemu forum. Pozostaw to pole puste, by użyć adresu e-mail administratora.";
+$l['setting_contactemail'] = "Kontaktowy adres e-mail";
+$l['setting_contactemail_desc'] = "Adres kontaktowy dla e-maili wysyłanych za pośrednictwem formularza kontaktowego (contact.php). Pozostaw to pole puste, by użyć adresu e-mail administratora.";
$l['setting_cookieprefix'] = "Prefiks cookies";
$l['setting_cookieprefix_desc'] = "Prefiks dla wszystkich cookies związanych z MyBB. Przydatny, jeżeli chcesz zainstalować więcej niż jedną kopię systemu MyBB w tej samej domenie, albo posiadasz inne oprogramowanie, które używa takich samych nazw cookies. Jeżeli pozostawisz to pole puste, prefiks nie będzie używany.";
$l['setting_reportmethod_db'] = "Przechowuj w bazie danych";
diff --git a/Upload/inc/languages/polish/admin/global.lang.php b/Upload/inc/languages/polish/admin/global.lang.php
index 2192d5b..f77623e 100644
--- a/Upload/inc/languages/polish/admin/global.lang.php
+++ b/Upload/inc/languages/polish/admin/global.lang.php
@@ -357,6 +357,8 @@
$l['search_for_a_user'] = "Szukaj użytkownika";
+$l['mybb_engine'] = "Silnik MyBB";
+
// If the language string for "Username" is too cramped in the ACP Login box
// then use this to define how much larger you want the gap to be (in px)
// $l['login_field_width'] = "0";
diff --git a/Upload/inc/languages/polish/admin/user_banning.lang.php b/Upload/inc/languages/polish/admin/user_banning.lang.php
index 53dcb27..d103ad5 100644
--- a/Upload/inc/languages/polish/admin/user_banning.lang.php
+++ b/Upload/inc/languages/polish/admin/user_banning.lang.php
@@ -61,4 +61,3 @@
// Buttons
$l['ban_user'] = "Zbanuj użytkownika";
$l['update_ban'] = "Aktualizuj bana";
-$l['search_user'] = 'Szukaj użytkownika';
diff --git a/Upload/inc/languages/polish/archive.lang.php b/Upload/inc/languages/polish/archive.lang.php
index 47376e6..b99f2dd 100644
--- a/Upload/inc/languages/polish/archive.lang.php
+++ b/Upload/inc/languages/polish/archive.lang.php
@@ -13,6 +13,7 @@
$l['archive_note'] = "Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.";
$l['archive_nopermission'] = "Nie masz uprawnień do przeglądania tego zasobu.";
$l['error_nothreads'] = "Aktualnie nie ma wątków w tym dziale.";
+$l['error_nopermission'] = "Nie masz uprawnień do przeglądania wątków w tym dziale.";
$l['error_unapproved_thread'] = "Ten wątek nie został zatwierdzony. Odwiedź wersję z pełnym formatowaniem aby zobaczyć jego treść.";
$l['archive_not_found'] = "
BÅ‚Ä…d 404
Określony dokument (plik) nie został znaleziony na serwerze.";
-$l['error_mustlogin'] = "To forum wymaga zalogowania od wszystkich swoich użytkowników.";
\ No newline at end of file
+$l['error_mustlogin'] = "To forum wymaga zalogowania od wszystkich swoich użytkowników.";
diff --git a/Upload/inc/languages/polish/forumdisplay.lang.php b/Upload/inc/languages/polish/forumdisplay.lang.php
index 1201afe..21020a6 100644
--- a/Upload/inc/languages/polish/forumdisplay.lang.php
+++ b/Upload/inc/languages/polish/forumdisplay.lang.php
@@ -9,6 +9,7 @@
$l['post_thread'] = "Napisz wÄ…tek";
$l['moderated_by'] = "Moderowane przez:";
$l['nothreads'] = "Aktualnie nie ma wątków spełniających podane warunki.";
+$l['nopermission'] = "Nie masz uprawnień do przeglądania wątków w tym dziale.";
$l['search_forum'] = "Szukaj w tym dziale:";
$l['thread'] = "Temat";
$l['author'] = "Autor";
diff --git a/Upload/inc/languages/polish/global.lang.php b/Upload/inc/languages/polish/global.lang.php
index 1260587..e7b1fbe 100644
--- a/Upload/inc/languages/polish/global.lang.php
+++ b/Upload/inc/languages/polish/global.lang.php
@@ -310,6 +310,8 @@
$l['pending_joinrequest'] = "Notatka dla lidera grupy: jest jedno zgłoszenie do grupy, której jesteś liderem.";
$l['pending_joinrequests'] = "Notatka dla lidera grupy: jest {1} zgłoszeń do grupy, której jesteś liderem.";
+$l['search_user'] = "Szukaj użytkownika";
+
$l['year'] = "Rok";
$l['year_short'] = "r";
$l['years'] = "Lat";
@@ -428,7 +430,6 @@
$l['invalid_nocaptcha_transmit'] = "Wystąpił błąd podczas próby weryfikacji bycia człowiekiem. Spróbuj ponownie.";
$l['captcha_fetch_failure'] = 'Wystąpił błąd podczas wczytywania nowego kodu.';
$l['question_fetch_failure'] = 'Wystąpił błąd podczas wczytywania nowego pytania';
-$l['invalid_ayah_result'] = "Test \"Are you Human\" nie został ukończony. Spróbuj ponownie.";
$l['timezone_gmt_minus_1200'] = "(GMT -12:00) Wyspy Marshalla";
$l['timezone_gmt_minus_1100'] = "(GMT -11:00) Wyspa Midway, Nome";
diff --git a/Upload/inc/languages/polish/managegroup.lang.php b/Upload/inc/languages/polish/managegroup.lang.php
index 9bd22e8..666274d 100644
--- a/Upload/inc/languages/polish/managegroup.lang.php
+++ b/Upload/inc/languages/polish/managegroup.lang.php
@@ -45,7 +45,6 @@
$l['group_private'] = "To jest prywatna grupa. By do niej dołączyć, użytkownik musi zostać dodany przez lidera.";
$l['group_default'] = "To jest grupa główna.";
$l['group_leaders'] = "Liderzy grup";
-$l['search_user'] = "Szukaj użytkownika";
$l['no_users_selected'] = "Nie zaznaczono użytkowników do usunięcia. Wróć i usuń użytkowników do usunięcia z grupy.";
$l['error_alreadyingroup'] = "Wybrany użytkownik już należy do tej grupy.";
@@ -62,4 +61,4 @@
Aby do niej dołączyć, przejdź do sekcji [url={2}/usercp.php?action=usergroups]Grupy użytkowników[/url] w panelu użytkownika i kliknij \"Akceptuj\".
-To zaproszenie wygaśnie za {3} dni.";
\ No newline at end of file
+To zaproszenie wygaśnie za {3} dni.";
diff --git a/Upload/inc/languages/polish/member.lang.php b/Upload/inc/languages/polish/member.lang.php
index 35d1196..857e6e9 100644
--- a/Upload/inc/languages/polish/member.lang.php
+++ b/Upload/inc/languages/polish/member.lang.php
@@ -149,7 +149,6 @@
$l['confirm_password'] = "Potwierdź hasło:";
$l['referrer'] = "PolecajÄ…cy:";
$l['referrer_desc'] = "Jeśli ktoś polecił Ci forum, wpisz tutaj jego login. Jeśli nie - pozostaw to pole puste.";
-$l['search_user'] = "Szukaj użytkownika";
$l['resend_activation'] = "Prześlij kod aktywacyjny";
$l['request_activation'] = "PoproÅ› o kod aktywacyjny";
$l['ppp'] = "Postów na stronę:";
diff --git a/Upload/inc/languages/polish/memberlist.lang.php b/Upload/inc/languages/polish/memberlist.lang.php
index 6731468..66407e4 100644
--- a/Upload/inc/languages/polish/memberlist.lang.php
+++ b/Upload/inc/languages/polish/memberlist.lang.php
@@ -48,7 +48,6 @@
$l['search_options'] = "Opcje wyszukiwania";
$l['per_page'] = "Wyników na stronę";
$l['search'] = "Szukaj";
-$l['search_user'] = "Szukaj użytkownika";
$l['error_no_members'] = "
Nie znaleziono żadnych użytkowników spełniających kryteria wyszukiwania.
Podaj inne kryteria i spróbuj jeszcze raz.
";
diff --git a/Upload/inc/languages/polish/messages.lang.php b/Upload/inc/languages/polish/messages.lang.php
index 2603519..2faa4bd 100644
--- a/Upload/inc/languages/polish/messages.lang.php
+++ b/Upload/inc/languages/polish/messages.lang.php
@@ -348,7 +348,7 @@
Rezygnacja ze subskrypcji:
Jeśli nie chcesz otrzymywać informacji o nowych odpowiedziach w tym wątku, przejdź pod adres:
-{6}/usercp2.php?action=removesubscription&tid={8}&key={9}&my_post_key={10}
+{6}/usercp2.php?action=removesubscription&tid={8}&my_post_key={9}
------------------------------------------";
$l['email_reachedpmquota'] = "{1},
@@ -494,6 +494,13 @@
Rezygnacja ze subskrypcji:
Jeśli nie chcesz otrzymywać informacji o nowych odpowiedziach w tym wątku, przejdź pod adres:
-[url]{5}/usercp2.php?action=removesubscription&tid={7}&key={8}&my_post_key={9}[/url]
+[url]{5}/usercp2.php?action=removesubscription&tid={7}&my_post_key={8}[/url]
------------------------------------------";
+
+$l['email_broken_task_subject'] = "Na forum {1} wystąpił błąd zaplanowanego zadania";
+$l['email_broken_task'] = "Twoja kopia MyBB uruchomiona na stronie {1} ({2}) odnotowała błąd związany z systemem zaplanowanych zadań.
+
+Plik zaplanowanego zadania dla {3} nie został odnaleziony.
+
+To zadanie zostało wyłączone do czasu rozwiązania problemu.";
diff --git a/Upload/inc/languages/polish/misc.lang.php b/Upload/inc/languages/polish/misc.lang.php
index 4761198..16987b1 100644
--- a/Upload/inc/languages/polish/misc.lang.php
+++ b/Upload/inc/languages/polish/misc.lang.php
@@ -14,7 +14,6 @@
$l['skype'] = "Skype";
$l['yahoo_im'] = "Yahoo IM";
$l['skype_center'] = "Centrum Skype";
-$l['skype_status'] = "Status Skype";
$l['chat_on_skype'] = "Napisz wiadomość do {1} na Skype";
$l['call_on_skype'] = "Zadzwoń do {1} na Skype";
$l['yahoo_center'] = "Centrum Yahoo!";
@@ -90,7 +89,13 @@
$l['redirect_forumpasscleared'] = "Przechowywane hasła zostały wyczyszczone.";
$l['redirect_cookiescleared'] = "Wszystkie ciasteczka zostały wyczyszczone.";
-$l['error_invalidimtype'] = "Ten użytkownik nie określił w profilu swoich danych dla tego komunikatora.";
+$l['error_invalidforum'] = "Nieprawidłowy dział";
$l['error_invalidhelpdoc'] = "Wybrany dokument pomocy nie istnieje.";
+$l['error_invalidimtype'] = "Ten użytkownik nie określił w profilu swoich danych dla tego komunikatora.";
+$l['error_invalidsearch'] = "Wpisano nieprawidłową frazę do wyszukania. Wróć i spróbuj ponownie.";
+$l['error_no_search_support'] = "Ten silnik bazy danych nie wspiera wyszukiwania.";
+$l['error_searchflooding'] = "Możesz wykonać tylko jedno wyszukiwanie w ciągu {1} sekund. Poczekaj {2} sekund przed następną próbą.";
+$l['error_searchflooding_1'] = "Możesz wykonać tylko jedno wyszukiwanie w ciągu {1} sekund. Poczekaj jeszcze 1 sekundę przed następną próbą.";
+
$l['dst_settings_updated'] = "Ustawienia dotyczące czasu zimowego zostały automatycznie zaktualizowane.
Teraz nastąpi przeniesienie na stronę główną forum.";
diff --git a/Upload/inc/languages/polish/modcp.lang.php b/Upload/inc/languages/polish/modcp.lang.php
index b1dc0e8..49cdaab 100644
--- a/Upload/inc/languages/polish/modcp.lang.php
+++ b/Upload/inc/languages/polish/modcp.lang.php
@@ -327,4 +327,3 @@
$l['you_cannot_use_mod_queue'] = "Nie masz uprawnień do korzystania z kolejki moderacji.";
$l['post'] = 'Post';
-$l['search_user'] = "Szukaj użytkownika";
diff --git a/Upload/inc/languages/polish/newthread.lang.php b/Upload/inc/languages/polish/newthread.lang.php
index a0ace30..49dc487 100644
--- a/Upload/inc/languages/polish/newthread.lang.php
+++ b/Upload/inc/languages/polish/newthread.lang.php
@@ -40,6 +40,7 @@
$l['redirect_newthread'] = "Wątek został umieszczony na forum.";
$l['redirect_newthread_poll'] = " Teraz nastąpi przeniesienie do ustawień ankiety.";
$l['redirect_newthread_moderation'] = " Twój wątek przed opublikowaniem zostanie zweryfikowany przez moderatora. Teraz nastąpi przeniesienie do wątku.";
+$l['redirect_newthread_unviewable'] = " Nie masz uprawnień do przeglądania wątków w tym dziale. Teraz nastąpi przeniesienie do działu.";
$l['redirect_newthread_thread'] = " Teraz nastÄ…pi przeniesienie do nowego wÄ…tku.";
$l['invalidthread'] = "Nie masz uprawnień do edytowania wybranego szkicu.";
diff --git a/Upload/inc/languages/polish/private.lang.php b/Upload/inc/languages/polish/private.lang.php
index 2fdcd10..b79fa99 100644
--- a/Upload/inc/languages/polish/private.lang.php
+++ b/Upload/inc/languages/polish/private.lang.php
@@ -142,7 +142,6 @@
$l['search_pms'] = "Szukaj";
$l['advanced_private_message_search'] = "Zaawansowane wyszukiwanie prywatnych wiadomości";
$l['search_criteria'] = "Kryteria wyszukiwania";
-$l['find_users'] = "Szukaj użytkownika";
$l['keywords'] = "SÅ‚owa kluczowe";
$l['search_in_subject'] = "Wyszukaj w temacie";
$l['search_in_message'] = "Wyszukaj w treści wiadomości";
@@ -161,7 +160,6 @@
$l['descending_order'] = "w kolejności malejącej";
$l['search_private_messages'] = "Szukaj w prywatnych wiadomościach";
$l['check_all'] = "Zaznacz wszystkie";
-$l['search_user'] = "Szukaj użytkownika";
$l['error_nopmsarchive'] = "Nie znaleziono prywatnych wiadomości spełniających podane kryteria.";
$l['error_invalidpmfoldername'] = "Wprowadzona nazwa folderu zawiera niedozwolone znaki.";
diff --git a/Upload/inc/languages/polish/search.lang.php b/Upload/inc/languages/polish/search.lang.php
index c669060..ef7365d 100644
--- a/Upload/inc/languages/polish/search.lang.php
+++ b/Upload/inc/languages/polish/search.lang.php
@@ -94,7 +94,6 @@
$l['all_selected'] = "Wszystkie {1} wyników wyszukiwania zostało zaznaczonych.";
$l['select_all'] = "Zaznacz wszystkie {1} wyniki wyszukiwania.";
$l['clear_selection'] = "Usuń zaznaczenie";
-$l['search_user'] = "Szukaj użytkownika";
$l['results'] = "wyniki";
$l['mod_options'] = "Opcje moderatora";
diff --git a/Upload/inc/languages/polish/usercp.lang.php b/Upload/inc/languages/polish/usercp.lang.php
index 63968a7..a2e610e 100644
--- a/Upload/inc/languages/polish/usercp.lang.php
+++ b/Upload/inc/languages/polish/usercp.lang.php
@@ -393,7 +393,6 @@
$l['icon_new'] = "Zawiera nowe posty.";
$l['icon_hot'] = " GorÄ…cy wÄ…tek.";
$l['icon_lock'] = " Zamknięty wątek.";
-$l['search_user'] = "Szukaj użytkownika";
$l['buddylist_error'] = 'Podczas pobierania listy znajomych wystąpił błąd.';
diff --git a/Upload/inc/mailhandlers/php.php b/Upload/inc/mailhandlers/php.php
index b2e935e..56a7524 100644
--- a/Upload/inc/mailhandlers/php.php
+++ b/Upload/inc/mailhandlers/php.php
@@ -51,6 +51,14 @@ function send()
@ini_set("sendmail_from", $mybb->settings['adminemail']);
}
+ $dir = "/{$config['admin_dir']}/";
+ $pos = strrpos($_SERVER['PHP_SELF'], $dir);
+ if(defined('IN_ADMINCP') && $pos !== false)
+ {
+ $temp_script_path = $_SERVER['PHP_SELF'];
+ $_SERVER['PHP_SELF'] = substr($_SERVER['PHP_SELF'], $pos + strlen($dir) - 1);
+ }
+
// If safe mode is on, don't send the additional parameters as we're not allowed to
if($mybb->safemode)
{
@@ -62,6 +70,11 @@ function send()
}
$function_used = 'mail()';
+ if(defined('IN_ADMINCP') && $pos !== false)
+ {
+ $_SERVER['PHP_SELF'] = $temp_script_path;
+ }
+
if(!$sent)
{
$this->fatal_error("MyBB was unable to send the email using the PHP {$function_used} function.");
diff --git a/Upload/inc/mailhandlers/smtp.php b/Upload/inc/mailhandlers/smtp.php
index b797e23..9afe44c 100644
--- a/Upload/inc/mailhandlers/smtp.php
+++ b/Upload/inc/mailhandlers/smtp.php
@@ -100,20 +100,6 @@ class SmtpMail extends MailHandler
*/
public $host = '';
- /**
- * The last received response from the SMTP server.
- *
- * @var string
- */
- public $data = '';
-
- /**
- * The last received response code from the SMTP server.
- *
- * @var string
- */
- public $code = 0;
-
/**
* The last received error message from the SMTP server.
*
diff --git a/Upload/inc/tasks/dailycleanup.php b/Upload/inc/tasks/dailycleanup.php
index b6198fe..5a7a89b 100644
--- a/Upload/inc/tasks/dailycleanup.php
+++ b/Upload/inc/tasks/dailycleanup.php
@@ -77,7 +77,7 @@ function task_dailycleanup($task)
if(!empty($user_update))
{
- foreach($user_update as $uid)
+ foreach($user_update as $uid => $data)
{
update_pm_count($uid);
}
diff --git a/Upload/install/index.php b/Upload/install/index.php
index d38dc14..41df529 100644
--- a/Upload/install/index.php
+++ b/Upload/install/index.php
@@ -1796,9 +1796,9 @@ function configure()
global $output, $mybb, $errors, $lang;
$output->print_header($lang->board_config, 'config');
-
+
echo <<
+
-
+
EOF;
// If board configuration errors
@@ -1859,12 +1859,12 @@ function revertSetting(defval, inpid)
}
// Attempt auto-detection
- if($_SERVER['HTTP_HOST'])
+ if(!empty($_SERVER['HTTP_HOST']))
{
$hostname = $protocol.$_SERVER['HTTP_HOST'];
$cookiedomain = $_SERVER['HTTP_HOST'];
}
- elseif($_SERVER['SERVER_NAME'])
+ elseif(!empty($_SERVER['SERVER_NAME']))
{
$hostname = $protocol.$_SERVER['SERVER_NAME'];
$cookiedomain = $_SERVER['SERVER_NAME'];
@@ -1885,18 +1885,33 @@ function revertSetting(defval, inpid)
$cookiedomain = ".{$cookiedomain}";
}
- if($_SERVER['SERVER_PORT'] && $_SERVER['SERVER_PORT'] != 80 && !preg_match("#:[0-9]#i", $hostname))
+ if(!empty($_SERVER['SERVER_PORT']))
{
- $hostname .= ':'.$_SERVER['SERVER_PORT'];
+ $port = ":{$_SERVER['SERVER_PORT']}";
+ $pos = strrpos($cookiedomain, $port);
+
+ if($pos !== false)
+ {
+ $cookiedomain = substr($cookiedomain, 0, $pos);
+ }
+
+ if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443 && !preg_match("#:[0-9]#i", $hostname))
+ {
+ $hostname .= $port;
+ }
}
-
+
$currentlocation = get_current_location('', '', true);
$noinstall = substr($currentlocation, 0, strrpos($currentlocation, '/install/'));
-
+
$cookiepath = $noinstall.'/';
$bburl = $hostname.$noinstall;
$websiteurl = $hostname.'/';
- $contactemail = $_SERVER['SERVER_ADMIN'];
+
+ if(isset($_SERVER['SERVER_ADMIN']) && filter_var($_SERVER['SERVER_ADMIN'], FILTER_VALIDATE_EMAIL))
+ {
+ $contactemail = $_SERVER['SERVER_ADMIN'];
+ }
}
echo $lang->sprintf($lang->config_step_table, $bbname, $bburl, $websitename, $websiteurl, $cookiedomain, $cookiepath, $contactemail);
@@ -1928,9 +1943,9 @@ function create_admin_user()
}
}
$output->print_header($lang->create_admin, 'admin');
-
+
echo <<
+
-
+
EOF;
if(is_array($errors))
@@ -2274,7 +2289,7 @@ function install_done()
);
$db->insert_query('users', $newuser);
- $welcome_post_title = "Witamy w MyBB!";
+$welcome_post_title = "Witamy w MyBB!";
$welcome_post_message = "Dziękujemy za wybranie MyBB. Instalacja przebiegła poprawnie i Twoje forum jest gotowe do użytku. Jeżeli podczas pracy z MyBB napotkasz jakiś problem, nie bój się zapytać na forum [url=http://forum.mybboard.pl]oficjalnego Polskiego Supportu MyBB[/url]. Zachęcamy Cię także do zapoznania się z naszym [url=http://mybboard.pl]portalem[/url], gdzie możesz znaleźć najnowsze wiadomości ze świata MyBB, oraz do odwiedzenia [url=http://wiki.mybboard.pl]polskiej Wiki[/url]. Powodzenia w przygodzie z MyBB!";
$welcome_post = array(
diff --git a/Upload/install/resources/mybb_theme.xml b/Upload/install/resources/mybb_theme.xml
index ff20eb9..8b47fbf 100644
--- a/Upload/install/resources/mybb_theme.xml
+++ b/Upload/install/resources/mybb_theme.xml
@@ -1,5 +1,5 @@
-
+
@@ -2172,7 +2172,7 @@ ul.thread_tools li.poll {
.thread_status.newlockfolder {
background-position: 0 -320px;
}]]>
- td {
border-bottom: 0;
}
-.tborder tbody tr:last-child td:first-child {
+.tborder tbody tr:last-child > td:first-child {
-moz-border-radius-bottomleft: 6px;
-webkit-border-bottom-left-radius: 6px;
border-bottom-left-radius: 6px;
}
-.tborder tbody tr:last-child td:last-child {
+.tborder tbody tr:last-child > td:last-child {
-moz-border-radius-bottomright: 6px;
-webkit-border-bottom-right-radius: 6px;
border-bottom-right-radius: 6px;
@@ -3678,7 +3678,7 @@ var announcement_quickdelete_confirm = "{$lang->announcement_quickdelete_confirm
{$moderator['username']}]]>
{$lang->subforums} {$sub_forums}]]>
-
+
{$mybb->settings['bbname']} - {$foruminfo['name']}
{$headerinclude}
@@ -3692,7 +3692,7 @@ var announcement_quickdelete_confirm = "{$lang->announcement_quickdelete_confirm
// -->
-
+
@@ -3724,7 +3724,7 @@ var announcement_quickdelete_confirm = "{$lang->announcement_quickdelete_confirm
{$modann}
]]>
-]]>
- asset_url}/jscripts/inline_moderation.js?ver=1804">
+ asset_url}/jscripts/inline_moderation.js?ver=1807">
{$lang->moderated_by} {$moderators} ]]>
{$lang->post_thread}]]>
+
+