Archived
1
0

comments.inc, entries.inc, images.inc, upgrader.inc GET enhancements

This commit is contained in:
Ian
2012-03-03 12:52:39 +01:00
parent 5f6b48a9b5
commit eb578a304f
8 changed files with 77 additions and 86 deletions

View File

@@ -8,7 +8,7 @@ if (!serendipity_checkPermission('adminComments')) {
return;
}
$codata = array();
$data = array();
$commentsPerPage = (int)(!empty($serendipity['GET']['filter']['perpage']) ? $serendipity['GET']['filter']['perpage'] : 10);
$summaryLength = 200;
@@ -134,37 +134,37 @@ if (isset($serendipity['GET']['adminAction']) && ($serendipity['GET']['adminActi
}
$target_url = '?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=doReply&serendipity[id]=' . (int)$serendipity['GET']['id'] . '&serendipity[entry_id]=' . (int)$serendipity['GET']['entry_id'] . '&serendipity[noBanner]=true&serendipity[noSidebar]=true&' . serendipity_setFormToken('url');
$data = $serendipity['POST'];
$data['replyTo'] = (int)$serendipity['GET']['id'];
$codata = $serendipity['POST'];
$codata['replyTo'] = (int)$serendipity['GET']['id'];
$out = serendipity_printComments($c);
$serendipity['smarty']->display(serendipity_getTemplateFile('comments.tpl', 'serendipityPath'));
if (!isset($data['name'])) {
$data['name'] = $serendipity['serendipityRealname'];
if (!isset($codata['name'])) {
$codata['name'] = $serendipity['serendipityRealname'];
}
if (!isset($data['email'])) {
$data['email'] = $serendipity['serendipityEmail'];
if (!isset($codata['email'])) {
$codata['email'] = $serendipity['serendipityEmail'];
}
} else {
$target_url = '?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=doEdit&serendipity[id]=' . (int)$serendipity['GET']['id'] . '&serendipity[entry_id]=' . (int)$serendipity['GET']['entry_id'] . '&' . serendipity_setFormToken('url');
/* If we are not in preview, we need data from our database */
/* If we are not in preview, we need comment data from our database */
if (!isset($serendipity['POST']['preview'])) {
$comment = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}comments WHERE id = ". (int)$serendipity['GET']['id']);
$data['name'] = $comment[0]['author'];
$data['email'] = $comment[0]['email'];
$data['url'] = $comment[0]['url'];
$data['replyTo'] = $comment[0]['parent_id'];
$data['comment'] = $comment[0]['body'];
$codata['name'] = $comment[0]['author'];
$codata['email'] = $comment[0]['email'];
$codata['url'] = $comment[0]['url'];
$codata['replyTo'] = $comment[0]['parent_id'];
$codata['comment'] = $comment[0]['body'];
/* If we are in preview, we get data from our form */
/* If we are in preview, we get comment data from our form */
} elseif (isset($serendipity['POST']['preview'])) {
$data['name'] = $serendipity['POST']['name'];
$data['email'] = $serendipity['POST']['email'];
$data['url'] = $serendipity['POST']['url'];
$data['replyTo'] = $serendipity['POST']['replyTo'];
$data['comment'] = $serendipity['POST']['comment'];
$codata['name'] = $serendipity['POST']['name'];
$codata['email'] = $serendipity['POST']['email'];
$codata['url'] = $serendipity['POST']['url'];
$codata['replyTo'] = $serendipity['POST']['replyTo'];
$codata['comment'] = $serendipity['POST']['comment'];
$pc_data = array(
array(
'email' => $serendipity['POST']['email'],
@@ -180,16 +180,16 @@ if (isset($serendipity['GET']['adminAction']) && ($serendipity['GET']['adminActi
}
}
if (!empty($data['url']) && substr($data['url'], 0, 7) != 'http://' &&
substr($data['url'], 0, 8) != 'https://') {
$data['url'] = 'http://' . $data['url'];
if (!empty($codata['url']) && substr($codata['url'], 0, 7) != 'http://' &&
substr($codata['url'], 0, 8) != 'https://') {
$codata['url'] = 'http://' . $codata['url'];
}
serendipity_displayCommentForm(
$serendipity['GET']['entry_id'],
$target_url,
NULL,
$data,
$codata,
false,
false
);
@@ -279,16 +279,16 @@ $sql = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']}
. (!serendipity_checkPermission('adminEntriesMaintainOthers') ? 'AND e.authorid = ' . (int)$serendipity['authorid'] : '') . "
ORDER BY c.id DESC $limit");
$codata['commentsPerPage'] = $commentsPerPage;
$codata['totalComments'] = $totalComments;
$codata['pages'] = $pages;
$codata['page'] = $page;
$codata['linkPrevious'] = $linkPrevious;
$codata['linkNext'] = $linkNext;
$codata['searchString'] = $searchString;
$codata['filter_vals'] = $filter_vals;
$codata['sql'] = $sql;
$codata['c_type'] = $c_type;
$data['commentsPerPage'] = $commentsPerPage;
$data['totalComments'] = $totalComments;
$data['pages'] = $pages;
$data['page'] = $page;
$data['linkPrevious'] = $linkPrevious;
$data['linkNext'] = $linkNext;
$data['searchString'] = $searchString;
$data['filter_vals'] = $filter_vals;
$data['sql'] = $sql;
$data['c_type'] = $c_type;
$i = 0;
$comments = array();
@@ -404,17 +404,17 @@ if(is_array($sql)) {
}
**/
$codata['comments'] = $comments;
$codata['errormsg'] = $errormsg;
$codata['urltoken'] = serendipity_setFormToken('url');
$codata['formtoken'] = serendipity_setFormToken();
$codata['getfilter'] = $serendipity['GET']['filter']; // don't trust {$smarty.get.vars} as we often change GET vars via serendipty['GET']
$data['comments'] = $comments;
$data['errormsg'] = $errormsg;
$data['urltoken'] = serendipity_setFormToken('url');
$data['formtoken'] = serendipity_setFormToken();
$data['get']['filter'] = $serendipity['GET']['filter']; // don't trust {$smarty.get.vars} if not proofed, as we often change GET vars via serendipty['GET'] by runtime
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}
$serendipity['smarty']->assign($codata); // do not use $data here, as already used above - use i.e. $codata['foo'] = $foo;
$serendipity['smarty']->assign($data);
$tfile = dirname(__FILE__) . "/tpl/comments.inc.tpl";

View File

@@ -17,6 +17,7 @@ $sort_order = array('timestamp' => DATE,
'id' => 'ID');
$per_page = array('12', '16', '50', '100');
$data = array();
/**
* Shows the entry panel overview
@@ -26,7 +27,7 @@ $per_page = array('12', '16', '50', '100');
* @access public
* @return null
*/
function serendipity_drawList() {
function serendipity_drawList($data=array()) {
global $serendipity, $sort_order, $per_page;
$filter_import = array('author', 'category', 'isdraft');
@@ -100,7 +101,6 @@ function serendipity_drawList() {
$categories = serendipity_fetchCategories();
$categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
// ToDo: set smarty flag $config_booleanize = true; in backend only? how? or does it not matter?
$serendipity['smarty']->assign( array(
'drawList' => true,
'entries' => $entries,
@@ -233,7 +233,6 @@ switch($serendipity['GET']['adminAction']) {
if ($entry['timestamp'] == -1) {
$data['switched_output'] = true;
$data['dateval'] = false;
#echo DATE_INVALID . '<br />';
// The date given by the user is not convertable. Reset the timestamp.
$entry['timestamp'] = $serendipity['POST']['timestamp'];
}
@@ -255,12 +254,10 @@ switch($serendipity['GET']['adminAction']) {
/* We don't need an iframe to save a draft */
if ( $serendipity['POST']['isdraft'] == 'true' ) {
$data['is_draft'] = true;
#echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE_DRAFT . '</div><br />';
serendipity_updertEntry($entry);
} else {
if ($serendipity['use_iframe']) {
$data['is_iframe'] = true;
#echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE . '</div><br />';
serendipity_iframe_create('save', $entry);
} else {
serendipity_iframe($entry, 'save');
@@ -318,7 +315,6 @@ switch($serendipity['GET']['adminAction']) {
if ($serendipity['use_iframe']) {
$data['is_iframepreview'] = true;
#echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_PREVIEW . '</div><br />';
serendipity_iframe_create('preview', $entry);
} else {
serendipity_iframe($entry, 'preview');
@@ -358,9 +354,7 @@ switch($serendipity['GET']['adminAction']) {
serendipity_deleteEntry((int)$serendipity['GET']['id']);
$data['switched_output'] = true;
$data['is_doDelete'] = true;
// for smartification printf had to turn into sprintf!!
$data['del_entry'] = sprintf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
#echo '<br />';
$cont_draw = true;
case 'doMultiDelete':
@@ -378,15 +372,13 @@ switch($serendipity['GET']['adminAction']) {
$entry = serendipity_fetchEntry('id', $id, 1, 1);
serendipity_deleteEntry((int)$id);
$data['is_doMultiDelete'] = true;
// for smartification printf had to turn into sprintf!!
$data['del_entry'][] = sprintf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
#echo '<br />';
}
}
}
case 'editSelect':
serendipity_drawList();
serendipity_drawList($data);
break;
case 'delete':
@@ -414,9 +406,7 @@ switch($serendipity['GET']['adminAction']) {
$ids .= (int)$id . ',';
$entry = serendipity_fetchEntry('id', $id, 1, 1);
$data['is_multidelete'] = true;
// for smartification printf had to turn into sprintf!!
$data['rip_entry'][] = sprintf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
#echo '<br />';
}
$newLoc = '?' . serendipity_setFormToken('url') . '&amp;serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=doMultiDelete&amp;serendipity[id]=' . $ids;
$data['switched_output'] = true;
@@ -440,18 +430,15 @@ switch($serendipity['GET']['adminAction']) {
);
}
$data['get'] = $serendipity['GET']; // don't trust {$smarty.get.vars} if not proofed, as we often change GET vars via serendipty['GET'] by runtime
// make sure we've got these
$data['urltoken'] = serendipity_setFormToken('url');
$data['formtoken'] = serendipity_setFormToken();
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}
$serendipity['smarty']->assign(
array( 'comments' => $comments,
'urltoken' => serendipity_setFormToken('url'),
'formtoken' => serendipity_setFormToken()
));
$serendipity['smarty']->assign($data);
$tfile = dirname(__FILE__) . "/tpl/entries.inc.tpl";

View File

@@ -680,6 +680,8 @@ function showMediaLibrary($messages=false, $addvar_check = false) {
);
}
$data['get'] = $serendipity['GET']['fid']; // don't trust {$smarty.get.vars} if not proofed, as we often change GET vars via serendipty['GET'] by runtime
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}

View File

@@ -67,19 +67,19 @@ function highlightComment(id, checkvalue) {
</tr>
<tr>
<td>{$CONST.AUTHOR}:</td>
<td><input class="input_textbox" type="text" name="serendipity[filter][author]" size="15" value="{$getfilter.author|escape}" /></td>
<td><input class="input_textbox" type="text" name="serendipity[filter][author]" size="15" value="{$get.filter.author|escape}" /></td>
<td>{$CONST.EMAIL}:</td>
<td><input class="input_textbox" type="text" name="serendipity[filter][email]" size="15" value="{$getfilter.email|escape}" /></td>
<td><input class="input_textbox" type="text" name="serendipity[filter][email]" size="15" value="{$get.filter.email|escape}" /></td>
<td>{$CONST.URL}:</td>
<td><input class="input_textbox" type="text" name="serendipity[filter][url]" size="15" value="{$getfilter.url|escape}" /></td>
<td><input class="input_textbox" type="text" name="serendipity[filter][url]" size="15" value="{$get.filter.url|escape}" /></td>
</tr>
<tr>
<td>IP:</td>
<td><input class="input_textbox" type="text" name="serendipity[filter][ip]" size="15" value="{$getfilter.ip|escape}" /></td>
<td><input class="input_textbox" type="text" name="serendipity[filter][ip]" size="15" value="{$get.filter.ip|escape}" /></td>
<td>{$CONST.CONTENT}:</td>
<td><input class="input_textbox" type="text" name="serendipity[filter][body]" size="15" value="{$getfilter.body|escape}" /></td>
<td><input class="input_textbox" type="text" name="serendipity[filter][body]" size="15" value="{$get.filter.body|escape}" /></td>
<td>{$CONST.REFERER}:</td>
<td><input class="input_textbox" type="text" name="serendipity[filter][referer]" size="15" value="{$getfilter.referer|escape}" /></td>
<td><input class="input_textbox" type="text" name="serendipity[filter][referer]" size="15" value="{$get.filter.referer|escape}" /></td>
</tr>
<tr>
<td>{$CONST.COMMENTS}:</td>
@@ -94,10 +94,10 @@ function highlightComment(id, checkvalue) {
<td>{$CONST.COMMENTS_FILTER_SHOW}:</td>
<td>
<select name="serendipity[filter][show]">
<option value="all"{if $getfilter.show == 'all'} selected="selected"{/if}>{$CONST.COMMENTS_FILTER_ALL}</option>
<option value="approved"{if $getfilter.show == 'approved'} selected="selected"{/if}>{$CONST.COMMENTS_FILTER_APPROVED_ONLY}</option>
<option value="pending"{if $getfilter.show == 'pending'} selected="selected"{/if}>{$CONST.COMMENTS_FILTER_NEED_APPROVAL}</option>
<option value="confirm"{if $getfilter.show == 'confirm'} selected="selected"{/if}>{$CONST.COMMENTS_FILTER_NEED_CONFIRM}</option>
<option value="all"{if $get.filter.show == 'all'} selected="selected"{/if}>{$CONST.COMMENTS_FILTER_ALL}</option>
<option value="approved"{if $get.filter.show == 'approved'} selected="selected"{/if}>{$CONST.COMMENTS_FILTER_APPROVED_ONLY}</option>
<option value="pending"{if $get.filter.show == 'pending'} selected="selected"{/if}>{$CONST.COMMENTS_FILTER_NEED_APPROVAL}</option>
<option value="confirm"{if $get.filter.show == 'confirm'} selected="selected"{/if}>{$CONST.COMMENTS_FILTER_NEED_CONFIRM}</option>
</select>
</td>
<td>{$CONST.TYPE}</td>
@@ -120,7 +120,7 @@ function highlightComment(id, checkvalue) {
{if !is_array($sql)}
<div align="center">- {$CONST.NO_COMMENTS} -</div>
<div align="center">- Click button "{$CONST.GO}" again, please. -</div>
<div align="center">- Return to default comment list <a href="serendipity_admin.php?serendipity[adminModule]=comments">"here"</a>. -</div>
{else}
<form action="" method="POST" name="formMultiDelete" id="formMultiDelete">

View File

@@ -19,15 +19,15 @@
{foreach $users AS $user}
{if isset($user.artcount) && $user.artcount < 1}
{continue}
<option value="{$user.authorid}" {(isset($smarty.get.filter.author) && ($smarty.get.filter.author == $user.authorid)) ? 'selected="selected"' : ''}>{$user.realname|escape}</option>
<option value="{$user.authorid}" {(isset($get.filter.author) && ($get.filter.author == $user.authorid)) ? 'selected="selected"' : ''}>{$user.realname|escape}</option>
{/if}
{/foreach}
{/if}
</select>
<select name="serendipity[filter][isdraft]">
<option value="all">{$CONST.COMMENTS_FILTER_ALL}</option>
<option value="draft" {(isset($smarty.get.filter.isdraft) && ($smarty.get.filter.isdraft == 'draft') ? 'selected="selected"' : '')}>{$CONST.DRAFT}</option>
<option value="publish" {(isset($smarty.get.filter.isdraft) && ($smarty.get.filter.isdraft == 'publish') ? 'selected="selected"' : '')}>{$CONST.PUBLISH}</option>
<option value="draft" {(isset($get.filter.isdraft) && ($get.filter.isdraft == 'draft') ? 'selected="selected"' : '')}>{$CONST.DRAFT}</option>
<option value="publish" {(isset($get.filter.isdraft) && ($get.filter.isdraft == 'publish') ? 'selected="selected"' : '')}>{$CONST.PUBLISH}</option>
</select>
</td>
<td valign="top" width="80">{$CONST.CATEGORY}</td>
@@ -35,12 +35,12 @@
<select name="serendipity[filter][category]">
<option value="">--</option>
{foreach $categories as $cat}
<option value="{$cat.categoryid}"{($smarty.get.filter.category == $cat.categoryid) ? ' selected="selected"' : ''}>{'&nbsp;'|str_repeat:$cat.depth} {$cat.category_name|escape}</option>
<option value="{$cat.categoryid}"{($get.filter.category == $cat.categoryid) ? ' selected="selected"' : ''}>{'&nbsp;'|str_repeat:$cat.depth} {$cat.category_name|escape}</option>
{/foreach}
</select>
</td>
<td valign="top" width="80">{$CONST.CONTENT}</td>
<td valign="top"><input class="input_textbox" size="10" type="text" name="serendipity[filter][body]" value="{(isset($smarty.get.filter.body)) ? "$smarty.get.filter.body|escape" : ''}" /></td>
<td valign="top"><input class="input_textbox" size="10" type="text" name="serendipity[filter][body]" value="{(isset($get.filter.body)) ? "$get.filter.body|escape" : ''}" /></td>
</tr>
<tr>
<td class="serendipity_admin_filters_headline" colspan="6"><strong>{$CONST.SORT_ORDER}</strong></td>
@@ -52,22 +52,22 @@
<td>
<select name="serendipity[sort][order]">
{foreach $sort_order as $so_key => $so_val}
<option value="{$so_key}" {(isset($smarty.get.sort.order) && ($smarty.get.sort.order == $so_key) ? 'selected="selected"': '')}>{$so_val}</option>
<option value="{$so_key}" {(isset($get.sort.order) && ($get.sort.order == $so_key) ? 'selected="selected"': '')}>{$so_val}</option>
{/foreach}
</select>
</td>
<td>{$CONST.SORT_ORDER}</td>
<td>
<select name="serendipity[sort][ordermode]">
<option value="DESC" {(isset($smarty.get.sort.ordermode) && ($smarty.get.sort.ordermode == 'DESC') ? 'selected="selected"' : '')}>{$CONST.SORT_ORDER_DESC}</option>
<option value="ASC" {(isset($smarty.get.sort.ordermode) && ($smarty.get.sort.ordermode == 'ASC') ? 'selected="selected"' : '')}>{$CONST.SORT_ORDER_ASC}</option>
<option value="DESC" {(isset($get.sort.ordermode) && ($get.sort.ordermode == 'DESC') ? 'selected="selected"' : '')}>{$CONST.SORT_ORDER_DESC}</option>
<option value="ASC" {(isset($get.sort.ordermode) && ($get.sort.ordermode == 'ASC') ? 'selected="selected"' : '')}>{$CONST.SORT_ORDER_ASC}</option>
</select>
</td>
<td>{$CONST.ENTRIES_PER_PAGE}</td>
<td>
<select name="serendipity[sort][perPage]">
{foreach $per_page AS $per_page_nr}
<option value="{$per_page_nr}" {(isset($smarty.get.sort.perPage) && ($smarty.get.sort.perPage == $per_page_nr) ? 'selected="selected"' : '')}>{$per_page_nr}</option>
<option value="{$per_page_nr}" {(isset($get.sort.perPage) && ($get.sort.perPage == $per_page_nr) ? 'selected="selected"' : '')}>{$per_page_nr}</option>
{/foreach}
</select>
</td>

View File

@@ -209,7 +209,7 @@
<select name="serendipity[parent]">
<option value="">{$CONST.BASE_DIRECTORY}</option>
{foreach $folders as $folder}
<option {if $folder.relpath == $smarty.get.only_path}selected="selected"{/if} value="{$folder.relpath}">{'&nbsp;'|str_repeat:"($folder.depth*2)"} {$folder.name}</option>
<option {if $folder.relpath == $get.only_path}selected="selected"{/if} value="{$folder.relpath}">{'&nbsp;'|str_repeat:"($folder.depth*2)"} {$folder.name}</option>
{/foreach}
</select>
</td>
@@ -315,7 +315,7 @@
{$formtoken}
<input type="hidden" name="serendipity[adminModule]" value="images" />
<input type="hidden" name="serendipity[adminAction]" value="scale" />
<input type="hidden" name="serendipity[fid]" value="{$smarty.get.fid}" />
<input type="hidden" name="serendipity[fid]" value="{$get.fid}" />
<input class="input_textbox" type="text" size="4" name="serendipity[width]" onchange="rescale('width' , value);" value="{$img_width}" />
<input class="input_textbox" type="text" size="4" name="serendipity[height]" onchange="rescale('height', value);" value="{$img_height}" />

View File

@@ -19,10 +19,10 @@
<div class="serendipityAdminMsgError">- <img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file='admin/img/admin_msg_error.png'}" alt="" />{foreach $errors AS $implode_err}{$implode_err}{if (count($errors) > 1) && !$implode_err@last}<br /> {/if}{/foreach}</div><br /><br />
{/if}
{if ($smarty.get.action == 'ignore')}
{if ($get.action == 'ignore')}
{* Todo: Don't know what to put here? *}
{elseif ($smarty.get.action == 'upgrade')}
{elseif ($get.action == 'upgrade')}
{foreach $call_tasks AS $ctask}
{if $is_callable_task}
@@ -37,11 +37,11 @@
{/if}
{if (($showAbort && $smarty.get.action == 'ignore') || $smarty.get.action == 'upgrade')}
{if (($showAbort && $get.action == 'ignore') || $get.action == 'upgrade')}
{if $smarty.get.action == 'ignore'}
{if $get.action == 'ignore'}
{$CONST.SERENDIPITY_UPGRADER_YOU_HAVE_IGNORED}
{elseif $smarty.get.action == 'upgrade'}
{elseif $get.action == 'upgrade'}
<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file='admin/img/admin_msg_success.png'}" alt="" />{$CONST.SERENDIPITY_UPGRADER_NOW_UPGRADED|sprintf:$s9y_version}</div>
{/if}
<br />

View File

@@ -354,6 +354,8 @@ if (($showAbort && $serendipity['GET']['action'] == 'ignore') || $serendipity['G
}
}
$data['get']['action'] = $serendipity['GET']['action']; // don't trust {$smarty.get.vars} if not proofed, as we often change GET vars via serendipty['GET'] by runtime
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}