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:
parent
f4d9a3fd1a
commit
57c212c9c8
13
comments.php
13
comments.php
@ -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;
|
$content= isset($_POST['content'])? trim(stripslashes($_POST['content'])) : null;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
@ -93,8 +90,16 @@
|
|||||||
$loggedin = false;
|
$loggedin = false;
|
||||||
|
|
||||||
if (user_loggedin()) {
|
if (user_loggedin()) {
|
||||||
|
$user = user_get();
|
||||||
$loggedin = $arr['loggedin']=true;
|
$loggedin = $arr['loggedin']=true;
|
||||||
|
$email = $user['email'];
|
||||||
|
$url = $user['www'];
|
||||||
|
$name = $user['userid'];
|
||||||
} else {
|
} 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
|
* check name
|
||||||
@ -147,7 +152,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$arr['version'] = system_ver();
|
$arr['version'] = system_ver();
|
||||||
$arr['name'] = $_POST['name'];
|
$arr['name'] = $name;
|
||||||
|
|
||||||
|
|
||||||
if (!$loggedin)
|
if (!$loggedin)
|
||||||
|
@ -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) {
|
function entry_categories_get($what=null) {
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($params['fullparse'])) {
|
if (isset($params['fullparse'])) {
|
||||||
|
|
||||||
$this->fullparse =
|
$this->fullparse =
|
||||||
@ -263,10 +263,11 @@
|
|||||||
$filteredkeys = $obj->getList();
|
$filteredkeys = $obj->getList();
|
||||||
$index_count = $obj->getCount();
|
$index_count = $obj->getCount();
|
||||||
|
|
||||||
$this->walker =& $entry_index->walker(
|
if ($filteredkeys)
|
||||||
entry_idtokey($filteredkeys[0]), true,
|
$this->walker =& $entry_index->walker(
|
||||||
entry_idtokey($filteredkeys[$index_count-1]), true
|
entry_idtokey($filteredkeys[0]), true,
|
||||||
);
|
entry_idtokey($filteredkeys[$index_count-1]), true
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -389,7 +390,10 @@
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// only title
|
// only title
|
||||||
$cont = array('subject' => $this->walker->current_value());
|
$cont = array(
|
||||||
|
'subject' => $this->walker->current_value(),
|
||||||
|
'date' => entry_idtotime($id)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
54
fp-interface/sharedtpls/comment-form.tpl
Normal file
54
fp-interface/sharedtpls/comment-form.tpl
Normal 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}
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
{/entry_block}
|
{/entry_block}
|
||||||
|
|
||||||
{include file="shared:comments.tpl"}
|
{include file="shared:comment-form.tpl"}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -161,7 +161,7 @@ ul#admin-tabmenu li a.admin-tab-current {
|
|||||||
|
|
||||||
/* ===== ADMIN ENTRY ===== */
|
/* ===== ADMIN ENTRY ===== */
|
||||||
input#subject {
|
input#subject {
|
||||||
width: 100%;
|
width: 99%;
|
||||||
font-size: 1.3em;
|
font-size: 1.3em;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
@ -510,6 +510,12 @@ li.widget-class {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.widetextinput {
|
||||||
|
width: 99%;
|
||||||
|
font-size: 1.3em;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
.option-set input.textinput ,
|
.option-set input.textinput ,
|
||||||
.option-set select.textinput {
|
.option-set select.textinput {
|
||||||
width: 20em;
|
width: 20em;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user