Skip to content
This repository has been archived by the owner on Apr 29, 2018. It is now read-only.

Commit

Permalink
Aktualizacja PPM do wersji 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Gigik committed Mar 15, 2016
1 parent b37cc10 commit f3faa89
Show file tree
Hide file tree
Showing 114 changed files with 2,547 additions and 2,474 deletions.
11 changes: 10 additions & 1 deletion Upload/admin/inc/class_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,16 @@ function generate_text_box($name, $value="", $options=array())
*/
function generate_numeric_field($name, $value=0, $options=array())
{
$input = "<input type=\"number\" name=\"".$name."\" value=\"".(int)$value."\"";
if(is_numeric($value))
{
$value = (float)$value;
}
else
{
$value = '';
}

$input = "<input type=\"number\" name=\"{$name}\" value=\"{$value}\"";
if(isset($options['min']))
{
$input .= " min=\"".$options['min']."\"";
Expand Down
26 changes: 3 additions & 23 deletions Upload/admin/inc/class_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function output_header($title="")

echo " <script type=\"text/javascript\" src=\"../jscripts/jquery.js\"></script>\n";
echo " <script type=\"text/javascript\" src=\"../jscripts/jquery.plugins.min.js\"></script>\n";
echo " <script type=\"text/javascript\" src=\"../jscripts/general.js?ver=1806\"></script>\n";
echo " <script type=\"text/javascript\" src=\"../jscripts/general.js?ver=1807\"></script>\n";
echo " <script type=\"text/javascript\" src=\"./jscripts/admincp.js\"></script>\n";
echo " <script type=\"text/javascript\" src=\"./jscripts/tabs.js\"></script>\n";

Expand Down Expand Up @@ -390,7 +390,7 @@ function show_login($message="", $class="success")
<meta name="copyright" content="Copyright {$copy_year} MyBB Group." />
<link rel="stylesheet" href="./styles/{$cp_style}/login.css" type="text/css" />
<script type="text/javascript" src="../jscripts/jquery.js"></script>
<script type="text/javascript" src="../jscripts/general.js?ver=1806"></script>
<script type="text/javascript" src="../jscripts/general.js?ver=1807"></script>
<script type="text/javascript" src="./jscripts/admincp.js"></script>
<script type="text/javascript">
//<![CDATA[
Expand Down Expand Up @@ -522,7 +522,7 @@ function show_2fa()
<meta name="copyright" content="Copyright {$copy_year} MyBB Group." />
<link rel="stylesheet" href="./styles/{$cp_style}/login.css" type="text/css" />
<script type="text/javascript" src="../jscripts/jquery.js"></script>
<script type="text/javascript" src="../jscripts/general.js?ver=1806"></script>
<script type="text/javascript" src="../jscripts/general.js?ver=1807"></script>
<script type="text/javascript" src="./jscripts/admincp.js"></script>
<script type="text/javascript">
//<![CDATA[
Expand Down Expand Up @@ -767,26 +767,6 @@ function _build_submenu($title, $items)
}
}

/**
* Switch between two different alternating background colours.
*
* @return string
*/
function get_alt_bg()
{
static $alt_bg;
if($alt_bg == "alt1")
{
$alt_bg = "alt2";
return "alt1";
}
else
{
$alt_bg = "alt1";
return $alt_bg;
}
}

/**
* Output a Javascript based tab control on to the page.
*
Expand Down
2 changes: 1 addition & 1 deletion Upload/admin/inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ function is_mobile($useragent)
function check_template($template)
{
// Check to see if our database password is in the template
if(preg_match("#database'?\\s*\]\\s*\[\\s*'?password#", $template))
if(preg_match('#\$config\[(([\'|"]database[\'|"])|([^\'"].*?))\]\[(([\'|"](database|hostname|password|table_prefix|username)[\'|"])|([^\'"].*?))\]#i', $template))
{
return true;
}
Expand Down
10 changes: 7 additions & 3 deletions Upload/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

send_page_headers();

header('X-Frame-Options: SAMEORIGIN');

if(!isset($config['admin_dir']) || !file_exists(MYBB_ROOT.$config['admin_dir']."/inc/class_page.php"))
{
$config['admin_dir'] = basename(dirname(__FILE__));
Expand Down Expand Up @@ -50,6 +52,7 @@

// Load global language phrases
$lang->load("global");
$lang->load("messages", true);

if(function_exists('mb_internal_encoding') && !empty($lang->settings['charset']))
{
Expand Down Expand Up @@ -237,12 +240,12 @@

$db->delete_query("adminsessions", "uid='{$mybb->user['uid']}'");

$sid = md5(uniqid(microtime(true), true));
$sid = md5(random_str(50));

$useragent = $_SERVER['HTTP_USER_AGENT'];
if(my_strlen($useragent) > 100)
if(my_strlen($useragent) > 200)
{
$useragent = my_substr($useragent, 0, 100);
$useragent = my_substr($useragent, 0, 200);
}

// Create a new admin session for this user
Expand Down Expand Up @@ -472,6 +475,7 @@
$cp_language = $admin_options['cplanguage'];
$lang->set_language($cp_language, "admin");
$lang->load("global"); // Reload global language vars
$lang->load("messages", true);
}

if(!empty($admin_options['cpstyle']) && file_exists(MYBB_ADMIN_DIR."/styles/{$admin_options['cpstyle']}/main.css"))
Expand Down
83 changes: 66 additions & 17 deletions Upload/admin/modules/config/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
echo '<script type="text/javascript" src="./jscripts/peeker.js?ver=1804"></script>
<script type="text/javascript">
$(document).ready(function() {
var peeker = new Peeker($("#type"), $("#row_extra"), /select|radio|checkbox|php/, false);
new Peeker($("#type"), $("#row_extra"), /^(select|radio|checkbox|php)$/, false);
});
// Add a star to the extra row since the "extra" is required if the box is shown
add_star("row_extra");
Expand Down Expand Up @@ -659,7 +659,7 @@
echo '<script type="text/javascript" src="./jscripts/peeker.js?ver=1804"></script>
<script type="text/javascript">
$(document).ready(function() {
var peeker = new Peeker($("#type"), $("#row_extra"), /select|radio|checkbox|php/, false);
new Peeker($("#type"), $("#row_extra"), /^(select|radio|checkbox|php)$/, false);
});
// Add a star to the extra row since the "extra" is required if the box is shown
add_star("row_extra");
Expand Down Expand Up @@ -893,6 +893,9 @@
'email',
'email2',
'imagestring',
'imagehash',
'answer',
'question_id',
'allownotices',
'hideemail',
'receivepms',
Expand All @@ -905,6 +908,10 @@
'language',
'step',
'action',
'agree',
'regtime',
'regcheck1',
'regcheck2',
'regsubmit'
);

Expand All @@ -918,20 +925,41 @@
}
}

// Get settings which optionscode is a forum/group select
// Get settings which optionscode is a forum/group select, checkbox or numeric
// We cannot rely on user input to decide this
$forum_group_select = array();
$query = $db->simple_select('settings', 'name', 'optionscode IN (\'forumselect\', \'groupselect\')');
while($name = $db->fetch_field($query, 'name'))
$checkbox_settings = $forum_group_select = array();
$query = $db->simple_select('settings', 'name, optionscode', "optionscode IN('forumselect', 'groupselect', 'numeric') OR optionscode LIKE 'checkbox%'");

while($multisetting = $db->fetch_array($query))
{
$forum_group_select[] = $name;
if(substr($multisetting['optionscode'], 0, 8) == 'checkbox')
{
$checkbox_settings[] = $multisetting['name'];

// All checkboxes deselected = no $mybb->input['upsetting'] for them, we need to initialize it manually then, but only on pages where the setting is shown
if(empty($mybb->input['upsetting'][$multisetting['name']]) && isset($mybb->input["isvisible_{$multisetting['name']}"]))
{
$mybb->input['upsetting'][$multisetting['name']] = array();
}
}
elseif($multisetting['optionscode'] == 'numeric')
{
if(isset($mybb->input['upsetting'][$multisetting['name']]))
{
$mybb->input['upsetting'][$multisetting['name']] = (int)$mybb->input['upsetting'][$multisetting['name']];
}
}
else
{
$forum_group_select[] = $multisetting['name'];
}
}

if(is_array($mybb->input['upsetting']))
{
foreach($mybb->input['upsetting'] as $name => $value)
{
if(!empty($forum_group_select) && in_array($name, $forum_group_select))
if($forum_group_select && in_array($name, $forum_group_select))
{
if($value == 'all')
{
Expand All @@ -947,7 +975,7 @@
}
unset($val);

$value = implode(',', (array)$mybb->input['select'][$name]);
$value = implode(',', $mybb->input['select'][$name]);
}
else
{
Expand All @@ -959,9 +987,17 @@
$value = '';
}
}

$value = $db->escape_string($value);
$db->update_query("settings", array('value' => $value), "name='".$db->escape_string($name)."'");
elseif($checkbox_settings && in_array($name, $checkbox_settings))
{
$value = '';

if(is_array($mybb->input['upsetting'][$name]))
{
$value = implode(',', $mybb->input['upsetting'][$name]);
}
}

$db->update_query("settings", array('value' => $db->escape_string($value)), "name='".$db->escape_string($name)."'");
}
}

Expand Down Expand Up @@ -1343,7 +1379,14 @@
}
else
{
for($i=0; $i < count($type); $i++)
$typecount = count($type);

if($type[0] == 'checkbox')
{
$multivalue = explode(',', $setting['value']);
}

for($i = 0; $i < $typecount; $i++)
{
$optionsexp = explode("=", $type[$i]);
if(!isset($optionsexp[1]))
Expand Down Expand Up @@ -1373,26 +1416,33 @@
}
else if($type[0] == "checkbox")
{
if($setting['value'] == $optionsexp[0])
if(in_array($optionsexp[0], $multivalue))
{
$option_list[$i] = $form->generate_check_box($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, "checked" => 1, 'class' => $element_id));
$option_list[$i] = $form->generate_check_box("{$element_name}[]", $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, "checked" => 1, 'class' => $element_id));
}
else
{
$option_list[$i] = $form->generate_check_box($element_name, $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'class' => $element_id));
$option_list[$i] = $form->generate_check_box("{$element_name}[]", $optionsexp[0], htmlspecialchars_uni($optionsexp[1]), array('id' => $element_id.'_'.$i, 'class' => $element_id));
}
}
}

if($type[0] == "select")
{
$setting_code = $form->generate_select_box($element_name, $option_list, $setting['value'], array('id' => $element_id));
}
else
{
$setting_code = implode("<br />", $option_list);

if($type[0] == 'checkbox')
{
$setting_code .= $form->generate_hidden_field("isvisible_{$setting['name']}", 1);
}
}
$option_list = array();
}

// Do we have a custom language variable for this title or description?
$title_lang = "setting_".$setting['name'];
$desc_lang = $title_lang."_desc";
Expand Down Expand Up @@ -1628,7 +1678,6 @@ function print_setting_peekers()
'new Peeker($("#setting_mail_handler"), $("#row_setting_smtp_host, #row_setting_smtp_port, #row_setting_smtp_user, #row_setting_smtp_pass, #row_setting_secure_smtp"), "smtp", false)',
'new Peeker($("#setting_mail_handler"), $("#row_setting_mail_parameters"), "mail", false)',
'new Peeker($("#setting_captchaimage"), $("#row_setting_captchapublickey, #row_setting_captchaprivatekey"), /(2|4)/, false)',
'new Peeker($("#setting_captchaimage"), $("#row_setting_ayahpublisherkey, #row_setting_ayahscoringkey"), 3, false)',
'new Peeker($(".setting_contact"), $("#row_setting_contact_guests, #row_setting_contact_badwords, #row_setting_contact_maxsubjectlength, #row_setting_contact_minmessagelength, #row_setting_contact_maxmessagelength"), 1, true)',
'new Peeker($(".setting_enablepruning"), $("#row_setting_enableprunebyposts, #row_setting_pruneunactived, #row_setting_prunethreads"), 1, true)',
'new Peeker($(".setting_enableprunebyposts"), $("#row_setting_prunepostcount, #row_setting_dayspruneregistered, #row_setting_prunepostcountall"), 1, true)',
Expand Down
3 changes: 1 addition & 2 deletions Upload/admin/modules/forum/management.php
Original file line number Diff line number Diff line change
Expand Up @@ -2593,8 +2593,7 @@
<!--
$("#username").select2({
placeholder: "'.$lang->search_for_a_user.'",
minimumInputLength: 3,
maximumSelectionSize: 3,
minimumInputLength: 2,
multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",
Expand Down
23 changes: 18 additions & 5 deletions Upload/admin/modules/style/themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ function checkAction(id)
{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{
$style['sid'] = (integer)str_replace('css.php?stylesheet=', '', $filename);
$style['sid'] = (int)str_replace('css.php?stylesheet=', '', $filename);
$filename = $theme_stylesheets[$style['sid']];
}
else
Expand Down Expand Up @@ -756,7 +756,7 @@ function checkAction(id)
{
$query = $db->simple_select("themes", "COUNT(tid) as numthemes", "name = '".$db->escape_string($mybb->get_input('name'))."'");
$numthemes = $db->fetch_field($query, 'numthemes');

if($numthemes)
{
$errors[] = $lang->error_theme_already_exists;
Expand Down Expand Up @@ -1010,6 +1010,9 @@ function checkAction(id)
while($cachefile = $db->fetch_array($query))
{
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$cachefile['cachefile']}");

$filename_min = str_replace('.css', '.min.css', $cachefile['cachefile']);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$filename_min}");
}
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/index.html");

Expand Down Expand Up @@ -1092,10 +1095,14 @@ function checkAction(id)
}

$theme_properties = my_unserialize($theme['properties']);
if($theme_properties['disporder'])
if(is_array($theme_properties['disporder']))
{
$properties['disporder'] = $theme_properties['disporder'];
}
else
{
$errors[] = $lang->error_no_display_order;
}

$allowedgroups = array();
if(is_array($mybb->input['allowedgroups']))
Expand Down Expand Up @@ -1339,7 +1346,7 @@ function checkAction(id)
{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{
$style['sid'] = (integer)str_replace('css.php?stylesheet=', '', $filename);
$style['sid'] = (int)str_replace('css.php?stylesheet=', '', $filename);
$filename = $theme_stylesheets[$style['sid']];
}

Expand All @@ -1356,7 +1363,7 @@ function checkAction(id)
{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{
$style['sid'] = (integer)str_replace('css.php?stylesheet=', '', $filename);
$style['sid'] = (int)str_replace('css.php?stylesheet=', '', $filename);
$filename = $theme_stylesheets[$style['sid']];
}
else
Expand Down Expand Up @@ -1744,6 +1751,9 @@ function checkAction(id)
$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$stylesheet['sid']}"), "sid='{$stylesheet['sid']}'", 1);
}
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");

$filename_min = str_replace('.css', '.min.css', $stylesheet['cachefile']);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$filename_min}");
}

// Update the CSS file list for this theme
Expand Down Expand Up @@ -2460,6 +2470,9 @@ function checkAction(id)
$db->delete_query("themestylesheets", "sid='{$stylesheet['sid']}'", 1);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");

$filename_min = str_replace('.css', '.min.css', $stylesheet['cachefile']);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$filename_min}");

// Update the CSS file list for this theme
update_theme_stylesheet_list($theme['tid'], $theme, true);

Expand Down
Loading

0 comments on commit f3faa89

Please sign in to comment.