1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 15:16:16 +02:00

- user avatar, user signature, user attachments

git-svn-id: file:///svn/phpbb/trunk@5365 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2005-12-21 18:18:12 +00:00
parent 1ba4064f20
commit f4f2ab3a35
10 changed files with 920 additions and 7 deletions

View File

@ -57,6 +57,7 @@ $user->theme['primary']['pagination_sep'] = '';
// Set custom template for admin area
$template->set_custom_template($phpbb_admin_path . 'style', 'admin');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
// Instantiate new module
$module = new p_master();

View File

@ -15,7 +15,6 @@
<div class="clearfix"></div>
<!-- IF PAGINATION -->
<div class="pagination">
<!-- IF PAGINATION -->
<a href="javascript:jumpto();" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> &bull; <span>{PAGINATION}</span>
@ -23,7 +22,6 @@
{S_ON_PAGE}
<!-- ENDIF -->
</div>
<!-- ENDIF -->
<!-- IF .log -->
<table cellspacing="1">

View File

@ -437,6 +437,224 @@
</form>
<!-- ELSEIF S_AVATAR -->
<form id="avatar_settings" method="post" action="{U_ACTION}"<!-- IF S_CAN_UPLOAD --> enctype="multipart/form-data"<!-- ENDIF -->>
<fieldset>
<legend>{L_ACP_USER_AVATAR}</legend>
<dl>
<dt><label>{L_CURRENT_IMAGE}:</label><br /><span>{L_AVATAR_EXPLAIN}</span></dt>
<dd>{AVATAR_IMAGE}</dd>
<dd><input type="checkbox" name="delete" />&nbsp;<span>{L_DELETE_AVATAR}</span></dd>
</dl>
<!-- IF not S_IN_AVATAR_GALLERY -->
<!-- IF S_CAN_UPLOAD -->
<dl>
<dt><label for="uploadfile">{L_UPLOAD_AVATAR_FILE}:</label></dt>
<dd><input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_MAX_FILESIZE}" /><input type="file" id="uploadfile" name="uploadfile" /></dd>
</dl>
<dl>
<dt><label for="uploadurl">{L_UPLOAD_AVATAR_URL}:</label><br /><span>{L_UPLOAD_AVATAR_URL_EXPLAIN}</span></dt>
<dd><input name="uploadurl" type="text" id="uploadurl" value="" /></dd>
</dl>
<!-- ENDIF -->
<dl>
<dt><label for="remotelink">{L_LINK_REMOTE_AVATAR}:</label><br /><span>{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></dt>
<dd><input name="remotelink" type="text" id="remotelink" value="" /></dd>
</dl>
<dl>
<dt><label for="width">{L_LINK_REMOTE_SIZE}:</label><br /><span>{L_LINK_REMOTE_SIZE_EXPLAIN}</span></dt>
<dd><input name="width" type="text" id="width" size="3" value="{USER_AVATAR_WIDTH}" /> <span>px X </span> <input type="text" name="height" size="3" value="{USER_AVATAR_HEIGHT}" /> <span>px</span></dd>
</dl>
<!-- IF S_DISPLAY_GALLERY -->
<dl>
<dt><label>{L_AVATAR_GALLERY}:</label></dt>
<dd><input class="button2" type="submit" name="display_gallery" value="{L_DISPLAY_GALLERY}" /></dd>
</dl>
<!-- ENDIF -->
<!-- ELSE -->
</fieldset>
<fieldset>
<legend>{L_AVATAR_GALLERY}</legend>
<dl>
<dt><label for="category">{L_AVATAR_CATEGORY}:</label></dt>
<dd><select name="category" id="category">{S_CAT_OPTIONS}</select>&nbsp;<input class="button2" type="submit" value="{L_GO}" name="display_gallery" /></dd>
</dl>
<dl>
<table cellspacing="1">
<!-- BEGIN avatar_row -->
<tr>
<!-- BEGIN avatar_column -->
<td class="row1" style="text-align: center;"><img src="{avatar_row.avatar_column.AVATAR_IMAGE}" alt="{avatar_row.avatar_column.AVATAR_NAME}" title="{avatar_row.avatar_column.AVATAR_NAME}" /></td>
<!-- END avatar_column -->
</tr>
<tr>
<!-- BEGIN avatar_option_column -->
<td class="row2" style="text-align: center;"><input type="radio" name="avatar_select" value="{avatar_row.avatar_option_column.S_OPTIONS_AVATAR}" /></td>
<!-- END avatar_option_column -->
</tr>
<!-- END avatar_row -->
</table>
</dl>
</fieldset>
<fieldset class="quick" style="margin-top: -15px;">
<input class="button2" type="submit" name="cancel" value="{L_CANCEL}" />
</fieldset>
<!-- ENDIF -->
</fieldset>
<fieldset class="quick">
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
</fieldset>
</form>
<!-- ELSEIF S_SIGNATURE -->
<script type="text/javascript">
<!--
var form_name = 'user_signature';
var text_name = 'signature';
// Define the bbCode tags
bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
imageTag = false;
// Helpline messages
b_help = "{L_BBCODE_B_HELP}";
i_help = "{L_BBCODE_I_HELP}";
u_help = "{L_BBCODE_U_HELP}";
q_help = "{L_BBCODE_Q_HELP}";
c_help = "{L_BBCODE_C_HELP}";
l_help = "{L_BBCODE_L_HELP}";
o_help = "{L_BBCODE_O_HELP}";
p_help = "{L_BBCODE_P_HELP}";
w_help = "{L_BBCODE_W_HELP}";
a_help = "{L_BBCODE_A_HELP}";
s_help = "{L_BBCODE_S_HELP}";
f_help = "{L_BBCODE_F_HELP}";
e_help = "{L_BBCODE_E_HELP}";
//-->
</script>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/editor.js"></script>
<form id="user_signature" method="post" action="{U_ACTION}">
<!-- IF SIGNATURE_PREVIEW -->
<fieldset>
<legend>{L_ADMIN_SIG_PREVIEW}</legend>
<p>{SIGNATURE_PREVIEW}</p>
</fieldset>
<!-- ENDIF -->
<fieldset>
<legend>{L_SIGNATURE}</legend>
<p>{L_SIGNATURE_EXPLAIN}</p>
<div id="format-buttons">
<input class="button2" type="button" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" onmouseover="helpline('b')" />
<input class="button2" type="button" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" onmouseover="helpline('i')" />
<input class="button2" type="button" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onclick="bbstyle(4)" onmouseover="helpline('u')" />
<input class="button2" type="button" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" onmouseover="helpline('q')" />
<input class="button2" type="button" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" />
<input class="button2" type="button" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" />
<input class="button2" type="button" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" />
<input class="button2" type="button" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" />
<input class="button2" type="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(16)" onmouseover="helpline('w')" />
{L_FONT_SIZE}: <select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" onmouseover="helpline('f')">
<option value="7">{L_FONT_TINY}</option>
<option value="9">{L_FONT_SMALL}</option>
<option value="12" selected="selected">{L_FONT_NORMAL}</option>
<option value="18">{L_FONT_LARGE}</option>
<option value="24">{L_FONT_HUGE}</option>
</select>
<a href="javascript:bbstyle(-1)" onmouseover="helpline('a')">{L_CLOSE_TAGS}</a>
</div>
<p><input type="text" name="helpbox" value="{L_STYLES_TIP}" class="full" style="border: 0; background: none;" /></p>
<dl>
<dt style="width: 110px;"><script type="text/javascript"><!--
colorPalette('v', 17, 5);
//--></script>
</dt>
<dd style="text-align: left; margin-left: 110px;"><textarea name="signature" rows="10" cols="60" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{SIGNATURE}</textarea></dd>
<dd style="text-align: left; margin-left: 110px;">
<!-- IF S_HTML_ALLOWED --><input type="checkbox" name="disable_html"{S_HTML_CHECKED} />&nbsp; {L_DISABLE_HTML} &nbsp;<!-- ENDIF -->
<!-- IF S_BBCODE_ALLOWED --><input type="checkbox" name="disable_bbcode"{S_BBCODE_CHECKED} />&nbsp; {L_DISABLE_BBCODE} &nbsp;<!-- ENDIF -->
<!-- IF S_SMILIES_ALLOWED --><input type="checkbox" name="disable_smilies"{S_SMILIES_CHECKED} />&nbsp; {L_DISABLE_SMILIES} &nbsp;<!-- ENDIF -->
<input type="checkbox" name="disable_magic_url"{S_MAGIC_URL_CHECKED} />&nbsp; {L_DISABLE_MAGIC_URL} &nbsp;
<br /><br /><strong>{L_OPTIONS}: </strong>{HTML_STATUS} :: {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {SMILIES_STATUS}
</dd>
</dl>
</fieldset>
<fieldset class="quick">
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="submit" name="preview" value="{L_PREVIEW}" />
</fieldset>
</form>
<!-- ELSEIF S_ATTACHMENTS -->
<form id="user_attachments" method="post" action="{U_ACTION}">
<fieldset class="quick" style="float: left;">
{L_SORT_BY}: <select name="sk">{S_SORT_KEY}</select> <select name="sd">{S_SORT_DIR}</select>
<input class="button2" type="submit" value="{L_GO}" name="sort" />
</fieldset>
<div class="pagination" style="float: right;">
<!-- IF PAGINATION -->
<a href="javascript:jumpto();" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> &bull; <span>{PAGINATION}</span>
<!-- ELSE -->
{S_ON_PAGE}
<!-- ENDIF -->
</div>
<div class="clearfix"></div>
<!-- IF .attach -->
<table cellspacing="1">
<thead>
<tr>
<th>{L_FILENAME}</th>
<th>{L_POST_TIME}</th>
<th>{L_FILESIZE}</th>
<th>{L_DOWNLOADS}</th>
<th>{L_DELETE}</th>
</tr>
</thead>
<tbody>
<!-- BEGIN attach -->
<!-- IF attach.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
<td><a href="{attach.U_DOWNLOAD}">{attach.REAL_FILENAME}</a><br /><span class="small"><!-- IF attach.S_IN_MESSAGE --><b>{L_PM}: </b><!-- ELSE --><b>{L_TOPIC}: </b><!-- ENDIF --><a href="{attach.U_VIEW_TOPIC}">{attach.TOPIC_TITLE}</a></span></td>
<td>{attach.POST_TIME}</td>
<td>{attach.SIZE}</td>
<td>{attach.DOWNLOAD_COUNT}</td>
<td><input type="checkbox" name="mark[]" value="{attach.ATTACH_ID}" /></td>
</tr>
<!-- END attach -->
</tbody>
</table>
<!-- ELSE -->
<div class="errorbox">
<p>{L_NO_ENTRIES}</p>
</div>
<!-- ENDIF -->
<fieldset class="quick">
<b class="small"><a href="#" onclick="marklist('user_attachments', true);">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('user_attachments', false);">{L_UNMARK_ALL}</a></b><br />
<input class="button2" type="submit" name="delmarked" value="{L_DELETE_MARKED}" />
</fieldset>
</form>
<!-- ENDIF -->
<!-- INCLUDE overall_footer.html -->

View File

@ -352,6 +352,25 @@ td {
line-height: 1px;
}
table.type2 {
border: none;
background: none;
padding: 0;
width: 0;
}
table.type2 th {
background: none;
border-top: none;
text-align: center;
color: #FFA34F;
padding: 2px 0;
}
table.type2 td {
padding: 0;
}
/* General form styles
----------------------------------------*/
fieldset {
@ -778,6 +797,17 @@ a.button2, a.button2:link, a.button2:visited, a.button2:active {
text-decoration: none;
}
/*
Format Buttons for signature editor
*/
#format-buttons {
margin: 15px 0 2px 0;
}
#format-buttons input, #format-buttons select {
vertical-align: middle;
}
/* Nice method for clearing floated blocks without having to insert any extra markup
From http://www.positioniseverything.net/easyclearing.html */
.clearfix:after, #tabs:after, .row:after, #content:after, fieldset dl:after, #page-body:after {

306
phpBB/adm/style/editor.js Normal file
View File

@ -0,0 +1,306 @@
// bbCode control by subBlue design [ www.subBlue.com ]
// Includes unixsafe colour palette selector by SHS`
// Startup variables
var imageTag = false;
var theSelection = false;
// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
&& (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
&& (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);
// Shows the help messages in the helpline window
function helpline(help) {
document.forms[form_name].helpbox.value = eval(help + "_help");
}
// Replacement for arrayname.length property
function getarraysize(thearray) {
for (i = 0; i < thearray.length; i++) {
if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
return i;
}
return thearray.length;
}
// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
thearray[ getarraysize(thearray) ] = value;
}
// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
thearraysize = getarraysize(thearray);
retval = thearray[thearraysize - 1];
delete thearray[thearraysize - 1];
return retval;
}
function smiley(text) {
text = ' ' + text + ' ';
if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) {
var caretPos = document.forms[form_name].elements[text_name].caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
document.forms[form_name].elements[text_name].focus();
} else {
var selStart = document.forms[form_name].elements[text_name].selectionStart;
var selEnd = document.forms[form_name].elements[text_name].selectionEnd;
mozWrap(document.forms[form_name].elements[text_name], text, '')
document.forms[form_name].elements[text_name].focus();
document.forms[form_name].elements[text_name].selectionStart = selStart + text.length;
document.forms[form_name].elements[text_name].selectionEnd = selEnd + text.length;
}
}
function bbfontstyle(bbopen, bbclose) {
if ((clientVer >= 4) && is_ie && is_win) {
theSelection = document.selection.createRange().text;
if (!theSelection) {
insert_text(bbopen + bbclose);
document.forms[form_name].elements[text_name].focus();
return;
}
document.selection.createRange().text = bbopen + theSelection + bbclose;
document.forms[form_name].elements[text_name].focus();
return;
} else {
insert_text(bbopen + bbclose);
document.forms[form_name].elements[text_name].focus();
return;
}
storeCaret(document.forms[form_name].elements[text_name]);
}
function insert_text(text) {
if (document.forms[form_name].elements[text_name].createTextRange && document.forms[form_name].elements[text_name].caretPos) {
var caretPos = document.forms[form_name].elements[text_name].caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else {
var selStart = document.forms[form_name].elements[text_name].selectionStart;
var selEnd = document.forms[form_name].elements[text_name].selectionEnd;
mozWrap(document.forms[form_name].elements[text_name], text, '')
document.forms[form_name].elements[text_name].selectionStart = selStart + text.length;
document.forms[form_name].elements[text_name].selectionEnd = selEnd + text.length;
}
}
function attach_inline() {
insert_text('[attachment=' + document.forms[form_name].elements['attachments'].value + ']' + document.forms[form_name].elements['attachments'].options[document.forms[form_name].elements['attachments'].selectedIndex].text + '[/attachment]');
}
function bbstyle(bbnumber) {
donotinsert = false;
theSelection = false;
bblast = 0;
document.forms[form_name].elements[text_name].focus();
if (bbnumber == -1) { // Close all open tags & default button names
while (bbcode[0]) {
butnumber = arraypop(bbcode) - 1;
document.forms[form_name].elements[text_name].value += bbtags[butnumber + 1];
buttext = eval('document.forms[form_name].addbbcode' + butnumber + '.value');
if (buttext != "[*]")
{
eval('document.forms[form_name].addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
}
}
document.forms[form_name].addbbcode10.value = "List";
bbtags[10] = "[list]";
document.forms[form_name].addbbcode12.value = "List=";
bbtags[12] = "[list=]";
imageTag = false; // All tags are closed including image tags :D
document.forms[form_name].elements[text_name].focus();
return;
}
if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text; // Get text selection
if (theSelection) {
// Add tags around selection
document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
document.forms[form_name].elements[text_name].focus();
theSelection = '';
return;
}
}
else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
{
mozWrap(document.forms[form_name].elements[text_name], bbtags[bbnumber], bbtags[bbnumber+1]);
document.forms[form_name].elements[text_name].focus();
theSelection = '';
return;
}
// Find last occurance of an open tag the same as the one just clicked
for (i = 0; i < bbcode.length; i++) {
if (bbcode[i] == bbnumber+1) {
bblast = i;
donotinsert = true;
}
}
if ((bbnumber == 10) && (bbtags[10] != "[*]"))
{
if (donotinsert)
{
document.forms[form_name].addbbcode12.value = "List=";
tmp_help = o_help;
o_help = e_help;
e_help = tmp_help;
bbtags[12] = "[list=]";
}
else
{
document.forms[form_name].addbbcode12.value = "[*]";
tmp_help = o_help;
o_help = e_help;
e_help = tmp_help;
bbtags[12] = "[*]";
}
}
if ((bbnumber == 12) && (bbtags[12] != "[*]"))
{
if (donotinsert)
{
document.forms[form_name].addbbcode10.value = "List";
tmp_help = l_help;
l_help = e_help;
e_help = tmp_help;
bbtags[10] = "[list]";
}
else
{
document.forms[form_name].addbbcode10.value = "[*]";
tmp_help = l_help;
l_help = e_help;
e_help = tmp_help;
bbtags[10] = "[*]";
}
}
if (donotinsert) { // Close all open tags up to the one just clicked & default button names
while (bbcode[bblast]) {
butnumber = arraypop(bbcode) - 1;
if (bbtags[butnumber] != "[*]")
{
insert_text(bbtags[butnumber + 1]);
}
else
{
insert_text(bbtags[butnumber]);
}
buttext = eval('document.forms[form_name].addbbcode' + butnumber + '.value');
if (bbtags[butnumber] != "[*]")
{
eval('document.forms[form_name].addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
}
imageTag = false;
}
document.forms[form_name].elements[text_name].focus();
return;
} else { // Open tags
if (imageTag && (bbnumber != 14)) { // Close image tag before adding another
insert_text(bbtags[15]);
lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list
document.forms[form_name].addbbcode14.value = "Img"; // Return button back to normal state
imageTag = false;
}
// Open tag
insert_text(bbtags[bbnumber]);
if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
if (bbtags[bbnumber] != "[*]")
{
arraypush(bbcode,bbnumber+1);
eval('document.forms[form_name].addbbcode'+bbnumber+'.value += "*"');
}
document.forms[form_name].elements[text_name].focus();
return;
}
storeCaret(document.forms[form_name].elements[text_name]);
}
// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2)
selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}
// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
if (textEl.createTextRange) { textEl.caretPos = document.selection.createRange().duplicate(); }
}
function colorPalette(dir, width, height)
{
var r = 0, g = 0, b = 0;
var numberList = new Array(6);
numberList[0] = "00";
numberList[1] = "40";
numberList[2] = "80";
numberList[3] = "BF";
numberList[4] = "FF";
document.writeln('<table class="type2">');
for(r = 0; r < 5; r++)
{
if (dir == 'h')
{
document.writeln('<tr>');
}
for(g = 0; g < 5; g++)
{
if (dir == 'v')
{
document.writeln('<tr>');
}
for(b = 0; b < 5; b++)
{
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
document.write('<td bgcolor="#' + color + '">');
document.write('<a href="javascript:bbfontstyle(\'[color=#' + color + ']\', \'[/color]\');" onmouseover="helpline(\'s\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>');
}
if (dir == 'v')
{
document.writeln('</tr>');
}
}
if (dir == 'h')
{
document.writeln('</tr>');
}
}
document.writeln('</table>');
}

View File

@ -560,7 +560,7 @@ class acp_users
unset($data['user']);
/**
* $config['max_warnings'] does not exist yet
* @todo $config['max_warnings'] does not exist yet
*/
// Validation data
$var_ary = array(
@ -1200,6 +1200,362 @@ class acp_users
)
);
break;
case 'avatar':
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
$data = array();
if ($submit)
{
$delete = request_var('delete', '');
$var_ary = array(
'uploadurl' => (string) '',
'remotelink' => (string) '',
'width' => (string) '',
'height' => (string) '',
);
foreach ($var_ary as $var => $default)
{
$data[$var] = request_var($var, $default);
}
$var_ary = array(
'uploadurl' => array('string', true, 5, 255),
'remotelink' => array('string', true, 5, 255),
'width' => array('string', true, 1, 3),
'height' => array('string', true, 1, 3),
);
$error = validate_data($data, $var_ary);
if (!sizeof($error))
{
$data['user_id'] = $user_id;
if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload)
{
list($type, $filename, $width, $height) = avatar_upload($data, $error);
}
else if ($data['remotelink'] && $config['allow_avatar_remote'])
{
list($type, $filename, $width, $height) = avatar_remote($data, $error);
}
else if ($avatar_select && $config['allow_avatar_local'])
{
$type = AVATAR_GALLERY;
$filename = $avatar_select;
// check avatar gallery
if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category))
{
$type = $width = $height = 0;
$filename = '';
}
else
{
list($width, $height) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $filename);
$filename = $category . '/' . $filename;
}
}
else if ($delete)
{
$filename = '';
$type = $width = $height = 0;
}
}
if (!sizeof($error))
{
// Do we actually have any data to update?
if (sizeof($data))
{
$sql_ary = array(
'user_avatar' => $filename,
'user_avatar_type' => $type,
'user_avatar_width' => $width,
'user_avatar_height' => $height,
);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_id;
$db->sql_query($sql);
// Delete old avatar if present
if ($user_row['user_avatar'] && $filename != $user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY)
{
avatar_delete($user_row['user_avatar']);
}
}
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($u_action));
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
// Generate users avatar
if ($user_row['user_avatar'])
{
switch ($user_row['user_avatar_type'])
{
case AVATAR_UPLOAD:
$avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
break;
case AVATAR_GALLERY:
$avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
break;
}
$avatar_img .= $user_row['user_avatar'];
$avatar_img = '<img src="' . $avatar_img . '" width="' . $user_row['user_avatar_width'] . '" height="' . $user_row['user_avatar_height'] . '" alt="" />';
}
else
{
$avatar_img = '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
}
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
if ($config['allow_avatar_local'] && $display_gallery)
{
avatar_gallery($category, $avatar_select, 4);
}
$template->assign_vars(array(
'S_AVATAR' => true,
'S_CAN_UPLOAD' => $can_upload,
'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
'AVATAR_IMAGE' => $avatar_img,
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
'USER_AVATAR_WIDTH' => $user_row['user_avatar_width'],
'USER_AVATAR_HEIGHT' => $user_row['user_avatar_height'],
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)))
);
break;
case 'sig':
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
$enable_html = ($config['allow_sig_html']) ? request_var('enable_html', false) : false;
$enable_bbcode = ($config['allow_sig_bbcode']) ? request_var('enable_bbcode', $this->optionget($user_row, 'bbcode')) : false;
$enable_smilies = ($config['allow_sig_smilies']) ? request_var('enable_smilies', $this->optionget($user_row, 'smilies')) : false;
$enable_urls = request_var('enable_urls', true);
$signature = request_var('signature', $user_row['user_sig']);
$preview = (isset($_POST['preview'])) ? true : false;
if ($submit || $preview)
{
include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$message_parser = new parse_message($signature);
// Allowing Quote BBCode
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig');
if (sizeof($message_parser->warn_msg))
{
$error[] = implode('<br />', $message_parser->warn_msg);
}
if (!sizeof($error) && $submit)
{
$sql_ary = array(
'user_sig' => (string) $message_parser->message,
'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid,
'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield
);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_id;
$db->sql_query($sql);
trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($u_action));
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
$signature_preview = '';
if ($preview)
{
// Now parse it for displaying
$signature_preview = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
unset($message_parser);
}
decode_message($signature, $user_row['user_sig_bbcode_uid']);
$template->assign_vars(array(
'S_SIGNATURE' => true,
'SIGNATURE' => $signature,
'SIGNATURE_PREVIEW' => $signature_preview,
'S_HTML_CHECKED' => (!$enable_html) ? 'checked="checked"' : '',
'S_BBCODE_CHECKED' => (!$enable_bbcode) ? 'checked="checked"' : '',
'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '',
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '',
'HTML_STATUS' => ($config['allow_sig_html']) ? $user->lang['HTML_IS_ON'] : $user->lang['HTML_IS_OFF'],
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . $phpbb_root_path . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . "{$phpbb_root_path}faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
'S_HTML_ALLOWED' => $config['allow_sig_html'],
'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'],
'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'],)
);
break;
case 'attach':
$start = request_var('start', 0);
$deletemark = (isset($_POST['delmarked'])) ? true : false;
$marked = request_var('mark', array(0));
// Sort keys
$sort_key = request_var('sk', 'a');
$sort_dir = request_var('sd', 'd');
if ($deletemark && sizeof($marked))
{
if (confirm_box(true))
{
$sql = 'SELECT real_filename
FROM ' . ATTACHMENTS_TABLE . '
WHERE attach_id IN (' . implode(', ', $marked) . ')';
$result = $db->sql_query($sql);
$log_attachments = array();
while ($row = $db->sql_fetchrow($result))
{
$log_attachments[] = $row['real_filename'];
}
$db->sql_freeresult($result);
delete_attachments('attach', $marked);
$log = (sizeof($log_attachments) == 1) ? 'ATTACHMENT_DELETED' : 'ATTACHMENTS_DELETED';
$message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED'];
add_log('admin', $log, implode(', ', $log_attachments));
trigger_error($message . adm_back_link($u_action));
}
else
{
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
'u' => $user_id,
'i' => $id,
'mode' => $mode,
'action' => $action,
'deletemark' => true,
'mark' => $marked))
);
}
}
$sk_text = array('a' => $user->lang['SORT_FILENAME'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']);
$sk_sql = array('a' => 'a.real_filename', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title');
$sd_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
$s_sort_key = '';
foreach ($sk_text as $key => $value)
{
$selected = ($sort_key == $key) ? ' selected="selected"' : '';
$s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$s_sort_dir = '';
foreach ($sd_text as $key => $value)
{
$selected = ($sort_dir == $key) ? ' selected="selected"' : '';
$s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
}
$order_by = $sk_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
$sql = 'SELECT COUNT(*) as num_attachments
FROM ' . ATTACHMENTS_TABLE . "
WHERE poster_id = $user_id";
$result = $db->sql_query_limit($sql, 1);
$num_attachments = (int) $db->sql_fetchfield('num_attachments', false, $result);
$db->sql_freeresult($result);
$sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title
FROM ' . ATTACHMENTS_TABLE . ' a
LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id
AND a.in_message = 0)
LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id
AND a.in_message = 1)
WHERE a.poster_id = ' . $user_id . "
ORDER BY $order_by";
$result = $db->sql_query_limit($sql, $config['posts_per_page'], $start);
while ($row = $db->sql_fetchrow($result))
{
if ($row['in_message'])
{
$view_topic = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm&amp;p={$row['post_msg_id']}";
}
else
{
$view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;t={$row['topic_id']}&amp;p={$row['post_msg_id']}#{$row['post_msg_id']}";
}
$template->assign_block_vars('attach', array(
'REAL_FILENAME' => $row['real_filename'],
'COMMENT' => nl2br($row['comment']),
'EXTENSION' => $row['extension'],
'SIZE' => ($row['filesize'] >= 1048576) ? ($row['filesize'] >> 20) . ' ' . $user->lang['MB'] : (($row['filesize'] >= 1024) ? ($row['filesize'] >> 10) . ' ' . $user->lang['KB'] : $row['filesize'] . ' ' . $user->lang['BYTES']),
'DOWNLOAD_COUNT' => $row['download_count'],
'POST_TIME' => $user->format_date($row['filetime']),
'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'],
'ATTACH_ID' => $row['attach_id'],
'POST_ID' => $row['post_msg_id'],
'TOPIC_ID' => $row['topic_id'],
'S_IN_MESSAGE' => $row['in_message'],
'U_DOWNLOAD' => $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $row['attach_id'],
'U_VIEW_TOPIC' => $view_topic)
);
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'S_ATTACHMENTS' => true,
'S_ON_PAGE' => on_page($num_attachments, $config['topics_per_page'], $start),
'S_SORT_KEY' => $s_sort_key,
'S_SORT_DIR' => $s_sort_dir,
'PAGINATION' => generate_pagination($u_action . "&amp;sk=$sort_key&amp;sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start, true))
);
break;
}

View File

@ -101,8 +101,8 @@ class bbcode_firstpass extends bbcode
'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#ise' => "\$this->bbcode_code('\$1', '\$2')")),
'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:=&quot;(.*?)&quot;)?\](.+)\[/quote\]#ise' => "\$this->bbcode_quote('\$0')")),
'attachment'=> array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#ise' => "\$this->bbcode_attachment('\$1', '\$2')")),
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.+)\[/b\]#ise' => "\$this->bbcode_strong('\$1')")),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.+)\[/i\]#ise' => "\$this->bbcode_italic('\$1')")),
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#ise' => "\$this->bbcode_strong('\$1')")),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#ise' => "\$this->bbcode_italic('\$1')")),
'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")),
'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](https?://)([a-z0-9\-\.,\?!%\*_:;~\\&$@/=\+]+)\[/img\]#ie' => "\$this->bbcode_img('\$1\$2')")),
'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?[1-2]?[0-9])\](.*?)\[/size\]#ise' => "\$this->bbcode_size('\$1', '\$2')")),

View File

@ -145,7 +145,6 @@ class ucp_prefs
}
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',

View File

@ -512,7 +512,8 @@ class ucp_profile
// check avatar gallery
if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category))
{
$type = $filename = $width = $height = '';
$filename = '';
$type = $width = $height = 0;
}
else
{

View File

@ -29,6 +29,8 @@ if (empty($lang) || !is_array($lang))
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
'ADMIN_SIG_PREVIEW' => 'Signature preview',
'BAN_SUCCESSFULL' => 'Ban entered successfully',
'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing the users email address.',
@ -77,6 +79,7 @@ $lang = array_merge($lang, array(
'USER_ADMIN_MOVE_POSTS' => 'Move all posts',
'USER_ADMIN_SIG_REMOVED' => 'Successfully removed signature from user account',
'USER_ATTACHMENTS_REMOVED' => 'Successfully removed all attachments made by this user',
'USER_AVATAR_UPDATED' => 'Successfully updated user avatars details',
'USER_CUSTOM_PROFILE_FIELDS' => 'Custom profile fields',
'USER_DELETED' => 'User deleted successfully',
'USER_OVERVIEW_UPDATED' => 'User details updated',
@ -85,6 +88,7 @@ $lang = array_merge($lang, array(
'USER_PREFS_UPDATED' => 'User preferences updated',
'USER_PROFILE' => 'User Profile',
'USER_PROFILE_UPDATED' => 'User profile updated',
'USER_SIG_UPDATED' => 'User signature successfully updated',
'USER_TOOLS' => 'Basic tools',
'WARNINGS' => 'Warnings',