added new comment form, fixed a few issues with fpdb, cosmetich changes for the comment form, minor changes in comment handling

This commit is contained in:
real_nowhereman 2009-07-03 15:39:23 +00:00
parent f4d9a3fd1a
commit 57c212c9c8
6 changed files with 143 additions and 12 deletions

View File

@ -83,9 +83,6 @@
);*/
$name = trim(stripslashes(@$_POST['name']));
$email = isset($_POST['email'])? trim($_POST['email']) : null;
$url = isset($_POST['url'])? trim(stripslashes($_POST['url'])) : null;
$content= isset($_POST['content'])? trim(stripslashes($_POST['content'])) : null;
$errors = array();
@ -93,9 +90,17 @@
$loggedin = false;
if (user_loggedin()) {
$user = user_get();
$loggedin = $arr['loggedin']=true;
$email = $user['email'];
$url = $user['www'];
$name = $user['userid'];
} else {
$name = trim(stripslashes(@$_POST['name']));
$email = isset($_POST['email'])? trim($_POST['email']) : null;
$url = isset($_POST['url'])? trim(stripslashes($_POST['url'])) : null;
/*
* check name
*
@ -147,7 +152,7 @@
}
$arr['version'] = system_ver();
$arr['name'] = $_POST['name'];
$arr['name'] = $name;
if (!$loggedin)

View File

@ -583,6 +583,68 @@
}
*/
function entry_categories_list() {
if (!$string = io_load_file(CONTENT_DIR . 'categories.txt'))
return false;
$lines = explode("\n", trim($string));
$idstack = array(0);
$indentstack=array();
// $categories = array(0=>null);
$lastindent = 0;
$lastid = 0;
$parent = 0;
$NEST = 0;
foreach ($lines as $v) {
$vt = trim($v);
if (!$vt) continue;
$text='';
$indent = utils_countdashes($vt, $text);
$val = explode(':', $text);
$id = trim($val[1]);
$label = trim($val[0]);
// echo "PARSE: $id:$label\n";
if ($indent > $lastindent) {
// echo "INDENT ($indent, $id, $lastid)\n";
$parent = $lastid;
array_push($indentstack, $lastindent);
array_push($idstack, $lastid);
$lastindent = $indent;
$NEST++;
} elseif ($indent < $lastindent) {
// echo "DEDENT ($indent)\n";
do {
$dedent = array_pop($indentstack);
array_pop($idstack);
$NEST--;
} while ($dedent > $indent);
if ($dedent < $indent) return false; //trigger_error("failed parsing ($dedent<$indent)", E_USER_ERROR);
$parent = end($idstack);
$lastindent = $indent;
$lastid = $id;
}
$lastid = $id;
// echo "NEST: $NEST\n";
$categories[ $id ] = $parent;
}
return $categories;
}
function entry_categories_get($what=null) {

View File

@ -263,6 +263,7 @@
$filteredkeys = $obj->getList();
$index_count = $obj->getCount();
if ($filteredkeys)
$this->walker =& $entry_index->walker(
entry_idtokey($filteredkeys[0]), true,
entry_idtokey($filteredkeys[$index_count-1]), true
@ -389,7 +390,10 @@
} else {
// only title
$cont = array('subject' => $this->walker->current_value());
$cont = array(
'subject' => $this->walker->current_value(),
'date' => entry_idtotime($id)
);
}

View File

@ -0,0 +1,54 @@
{if !$entry_commslock}
<h4>{$lang.comments.head}</h4>
<p>{$lang.comments.descr}</p>
<form id="commentform" method="post"
action="{$flatpress.params.entry|link:comments_link}#commentform"
enctype="multipart/form-data">
{include file='shared:errorlist.tpl'}
{if not $flatpress.loggedin}
{*<fieldset id="comment-userdata">*}
<div id="comment-userdata">
<p>
<input type="text" {$error.name|notempty:'class="field-error"'} name="name" id="name" value="{$values.name|default:$cookie.name}" />
<label class="textlabel" for="name">{$lang.comments.name}</label>
</p>
<p>
<input type="text" {$error.email|notempty:'class="field-error"'} name="email" id="email" value="{$values.email|default:$cookie.email}" />
<label class="textlabel" for="email">{$lang.comments.email}</label>
</p>
<p>
<input type="text" {$error.url|notempty:'class="field-error"'} name="url" id="url" value="{$values.url|default:$cookie.url}" />
<label class="textlabel" for="url">{$lang.comments.www}</label>
</p>
{comment_form}
</div>
{/if}
<div class="comment-content">
<p><textarea name="content" {$error.content|notempty:'class="field-error"'}
id="content" rows="10" cols="74">{$values.content}</textarea></p>
{*here will go a plugin hook*}
</div>
<div class="buttonbar">
<input type="submit" name="submit" id="submit" value="{$lang.comments.submit}" />
</div>
</form>
{/if}

View File

@ -46,7 +46,7 @@
{/entry_block}
{include file="shared:comments.tpl"}
{include file="shared:comment-form.tpl"}
</div>

View File

@ -161,7 +161,7 @@ ul#admin-tabmenu li a.admin-tab-current {
/* ===== ADMIN ENTRY ===== */
input#subject {
width: 100%;
width: 99%;
font-size: 1.3em;
color: #333333;
font-weight: bold
@ -510,6 +510,12 @@ li.widget-class {
font-weight: bold;
}
.widetextinput {
width: 99%;
font-size: 1.3em;
color: #333333;
}
.option-set input.textinput ,
.option-set select.textinput {
width: 20em;