"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Upload/private.php" between
mybb_1819.zip and mybb_1820.zip

About: MyBB is a multilingual, standards-compliant and free forum (discussion board) software.

private.php  (mybb_1819):private.php  (mybb_1820)
skipping to change at line 45 skipping to change at line 45
if($mybb->settings['enablepms'] == 0) if($mybb->settings['enablepms'] == 0)
{ {
error($lang->pms_disabled); error($lang->pms_disabled);
} }
if($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['can usepms'] == 0) if($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['can usepms'] == 0)
{ {
error_no_permission(); error_no_permission();
} }
$update = false;
if(!$mybb->user['pmfolders']) if(!$mybb->user['pmfolders'])
{ {
$mybb->user['pmfolders'] = "1**$%%$2**$%%$3**$%%$4**"; $update = true;
$mybb->user['pmfolders'] = "0**$%%$1**$%%$2**$%%$3**$%%$4**";
}
elseif ((int)my_substr($mybb->user['pmfolders'], 0, 1) != 0)
{
// Old folder structure. Need to update
// Since MyBB 1.8.20 fid[0] represents 'Inbox' and fid[1] represents 'Unr
ead'
$update = true;
$mybb->user['pmfolders'] = '0'. ltrim(str_replace("$%%$2**", "$%%$1**$%%$
2**", $mybb->user['pmfolders']), '1');
}
// Folder structure update required?
if($update)
{
$sql_array = array( $sql_array = array(
"pmfolders" => $mybb->user['pmfolders'] "pmfolders" => $mybb->user['pmfolders']
); );
$db->update_query("users", $sql_array, "uid = ".$mybb->user['uid']); $db->update_query("users", $sql_array, "uid = ".$mybb->user['uid']);
} }
$mybb->input['fid'] = $mybb->get_input('fid', MyBB::INPUT_INT); $mybb->input['fid'] = $mybb->get_input('fid', MyBB::INPUT_INT);
$folder_id = $folder_name = ''; $folder_id = $folder_name = '';
skipping to change at line 1464 skipping to change at line 1477
$folderlist = ''; $folderlist = '';
$foldersexploded = explode("$%%$", $mybb->user['pmfolders']); $foldersexploded = explode("$%%$", $mybb->user['pmfolders']);
foreach($foldersexploded as $key => $folders) foreach($foldersexploded as $key => $folders)
{ {
$folderinfo = explode("**", $folders, 2); $folderinfo = explode("**", $folders, 2);
$foldername = $folderinfo[1]; $foldername = $folderinfo[1];
$fid = $folderinfo[0]; $fid = $folderinfo[0];
$foldername = get_pm_folder_name($fid, $foldername); $foldername = get_pm_folder_name($fid, $foldername);
if($folderinfo[0] == "1" || $folderinfo[0] == "2" || $folderinfo[ 0] == "3" || $folderinfo[0] == "4") if((int)$folderinfo[0] < 5)
{ {
$foldername2 = get_pm_folder_name($fid); $foldername2 = get_pm_folder_name($fid);
eval("\$folderlist .= \"".$templates->get("private_folder s_folder_unremovable")."\";"); eval("\$folderlist .= \"".$templates->get("private_folder s_folder_unremovable")."\";");
unset($name); unset($name);
} }
else else
{ {
eval("\$folderlist .= \"".$templates->get("private_folder s_folder")."\";"); eval("\$folderlist .= \"".$templates->get("private_folder s_folder")."\";");
} }
} }
skipping to change at line 1519 skipping to change at line 1532
} }
else // Editing an existing folder else // Editing an existing folder
{ {
if($key > $highestid) if($key > $highestid)
{ {
$highestid = $key; $highestid = $key;
} }
$fid = (int)$key; $fid = (int)$key;
// Use default language strings if empty or value is language string // Use default language strings if empty or value is language string
switch($fid) if($val == get_pm_folder_name($fid) || trim($val) == '')
{ {
case 1: $val = '';
if($val == $lang->folder_inbox ||
trim($val) == '')
{
$val = '';
}
break;
case 2:
if($val == $lang->folder_sent_ite
ms || trim($val) == '')
{
$val = '';
}
break;
case 3:
if($val == $lang->folder_drafts |
| trim($val) == '')
{
$val = '';
}
break;
case 4:
if($val == $lang->folder_trash ||
trim($val) == '')
{
$val = '';
}
break;
} }
} }
if($val != '' && trim($val) == '' && !($key >= 1 && $key <= 4)) if($val != '' && trim($val) == '' && !(is_numeric($key) & & $key <= 4))
{ {
// If the name only contains whitespace and it's not a default folder, print an error // If the name only contains whitespace and it's not a default folder, print an error
error($lang->error_emptypmfoldername); error($lang->error_emptypmfoldername);
} }
if($val != '' || ($key >= 1 && $key <= 4)) if($val != '' || (is_numeric($key) && $key <= 4))
{ {
// If there is a name or if this is a default fol der, save it // If there is a name or if this is a default fol der, save it
$foldername = $db->escape_string(htmlspecialchars _uni($val)); $foldername = $db->escape_string(htmlspecialchars _uni($val));
if(my_strpos($foldername, "$%%$") === false) if(my_strpos($foldername, "$%%$") === false)
{ {
if($folders != '') if($folders != '')
{ {
$folders .= "$%%$"; $folders .= "$%%$";
} }
skipping to change at line 2089 skipping to change at line 2079
echo $archived; echo $archived;
} }
} }
if(!$mybb->input['action']) if(!$mybb->input['action'])
{ {
$plugins->run_hooks("private_inbox"); $plugins->run_hooks("private_inbox");
if(!$mybb->input['fid'] || !array_key_exists($mybb->input['fid'], $folder names)) if(!$mybb->input['fid'] || !array_key_exists($mybb->input['fid'], $folder names))
{ {
$mybb->input['fid'] = 1; $mybb->input['fid'] = 0;
} }
$folder = $mybb->input['fid']; $fid = (int)$mybb->input['fid'];
$foldername = $foldernames[$folder]; $folder = !$fid ? 1 : $fid;
$foldername = $foldernames[$fid];
if($folder == 2 || $folder == 3) if($folder == 2 || $folder == 3)
{ // Sent Items Folder { // Sent Items Folder
$sender = $lang->sentto; $sender = $lang->sentto;
} }
else else
{ {
$sender = $lang->sender; $sender = $lang->sender;
} }
skipping to change at line 2182 skipping to change at line 2173
$lower = $start+1; $lower = $start+1;
$upper = $end; $upper = $end;
if($upper > $pmscount) if($upper > $pmscount)
{ {
$upper = $pmscount; $upper = $pmscount;
} }
if($mybb->input['order'] || ($sortby && $sortby != "dateline")) if($mybb->input['order'] || ($sortby && $sortby != "dateline"))
{ {
$page_url = "private.php?fid={$folder}&sortby={$sortby}&order={$s ortordernow}"; $page_url = "private.php?fid={$fid}&sortby={$sortby}&order={$sort ordernow}";
} }
else else
{ {
$page_url = "private.php?fid={$folder}"; $page_url = "private.php?fid={$fid}";
} }
$multipage = multipage($pmscount, $perpage, $page, $page_url); $multipage = multipage($pmscount, $perpage, $page, $page_url);
$messagelist = ''; $selective = $messagelist = '';
$icon_cache = $cache->read("posticons"); $icon_cache = $cache->read("posticons");
// Cache users in multiple recipients for sent & drafts folder // Cache users in multiple recipients for sent & drafts folder
if($folder == 2 || $folder == 3) if($folder == 2 || $folder == 3)
{ {
if($sortfield == "username") if($sortfield == "username")
{ {
$u = "u."; $u = "u.";
} }
skipping to change at line 2256 skipping to change at line 2247
{ {
$pm = "tu."; $pm = "tu.";
} }
else else
{ {
$pm = "pm."; $pm = "pm.";
} }
} }
else else
{ {
if($fid == 1)
{
$selective = ' AND pm.status="0"';
}
if($sortfield == "username") if($sortfield == "username")
{ {
$pm = "fu."; $pm = "fu.";
} }
else else
{ {
$pm = "pm."; $pm = "pm.";
} }
} }
$query = $db->query(" $query = $db->query("
SELECT pm.*, fu.username AS fromusername, tu.username as touserna me SELECT pm.*, fu.username AS fromusername, tu.username as touserna me
FROM ".TABLE_PREFIX."privatemessages pm FROM ".TABLE_PREFIX."privatemessages pm
LEFT JOIN ".TABLE_PREFIX."users fu ON (fu.uid=pm.fromid) LEFT JOIN ".TABLE_PREFIX."users fu ON (fu.uid=pm.fromid)
LEFT JOIN ".TABLE_PREFIX."users tu ON (tu.uid=pm.toid) LEFT JOIN ".TABLE_PREFIX."users tu ON (tu.uid=pm.toid)
WHERE pm.folder='$folder' AND pm.uid='".$mybb->user['uid']."' WHERE pm.folder='$folder' AND pm.uid='".$mybb->user['uid']."'{$se lective}
ORDER BY {$pm}{$sortfield} {$sortordernow} ORDER BY {$pm}{$sortfield} {$sortordernow}
LIMIT $start, $perpage LIMIT $start, $perpage
"); ");
if($db->num_rows($query) > 0) if($db->num_rows($query) > 0)
{ {
while($message = $db->fetch_array($query)) while($message = $db->fetch_array($query))
{ {
$msgalt = $msgstatus = ''; $msgalt = $msgstatus = '';
 End of changes. 15 change blocks. 
40 lines changed or deleted 34 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)