mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
Parser fix and FAQ 'ask a question' permissions fix.
This commit is contained in:
parent
7e4c26e458
commit
9964def818
@ -829,11 +829,9 @@ class e_parse extends e_parser
|
||||
{
|
||||
if(!empty($extraCodes) && $this->isSimpleParse($extraCodes)) // support for a combined simple and standard template parse. - (eg. used by signup email template.)
|
||||
{
|
||||
$text = $this->simpleParse($text, $extraCodes, false);
|
||||
$text = $this->simpleParse($text, $extraCodes, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
|
||||
}
|
||||
|
||||
@ -851,15 +849,23 @@ class e_parse extends e_parser
|
||||
}
|
||||
|
||||
foreach ($extraCodes as $sc => $code)
|
||||
{
|
||||
if(!strpos($code, 'return '))
|
||||
{
|
||||
if(preg_match('/return(.*);/',$code)) // still problematic. 'return;' Might be used in common speech.
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/* if(!strpos($code, 'return '))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,11 @@
|
||||
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
$limit = 25;
|
||||
|
||||
$existing = $sql->retrieve('faqs','faq_question,faq_datestamp',"faq_answer='' ORDER BY faq_datestamp ", true);
|
||||
$count = $sql->retrieve('faqs','faq_id',"faq_answer='' ", true);
|
||||
|
||||
$existing = $sql->retrieve('faqs','faq_id,faq_question,faq_datestamp',"faq_answer='' ORDER BY faq_datestamp DESC LIMIT ".$limit, true);
|
||||
|
||||
if(empty($existing))
|
||||
{
|
||||
@ -45,9 +48,15 @@
|
||||
|
||||
foreach($existing as $row)
|
||||
{
|
||||
$questions[] = "<i>".$row['faq_question']."</i><br /><small>".$tp->toDate($row['faq_datestamp'],'short')."</small>";
|
||||
$questions[] = "<i>".$row['faq_question']."</i><br /><small>".$tp->toDate($row['faq_datestamp'],'short')."</small>\n";
|
||||
// $questions[] = $row['faq_question'];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// $questions = array( "<i>Test Question</i><br /><small>".$tp->toDate(time(),'short')."</small>");
|
||||
|
||||
|
||||
$name = SITENAME . " Automation";
|
||||
|
||||
$email = e107::pref('core','siteadminemail');
|
||||
@ -55,6 +64,14 @@
|
||||
|
||||
$link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full');
|
||||
|
||||
$body = "<h2>".count($count)." Unuanswered Questions at ".SITENAME."</h2>To answer these questions, please login to ".SITENAME." and then <a href='{$link}'>click here</a>.<br />
|
||||
The ".$limit." most recent questions are displayed below.
|
||||
<ul><li>".implode("</li><li>",$questions)."</li></ul>";
|
||||
|
||||
$body = "I find the timing of their return very interesting";
|
||||
// file_put_contents(e_LOG."faq.log", $body);
|
||||
// return;
|
||||
|
||||
$eml = array(
|
||||
'subject' => count($existing)." Unuanswered Question as of ".date('d-M-Y')." ",
|
||||
// 'sender_email' => $email,
|
||||
@ -62,9 +79,7 @@
|
||||
// 'replyto' => $email,
|
||||
'html' => true,
|
||||
'template' => 'default',
|
||||
'body' => "
|
||||
<h2>".count($existing)." Unuanswered Questions at ".SITENAME."</h2>To answer these questions, please login to ".SITENAME." and then <a href='{$link}'>click here</a>.<br />
|
||||
<ul><li>".implode("</li><li>",$questions)."</li></ul>"
|
||||
'body' => $body
|
||||
);
|
||||
|
||||
e107::getEmail()->sendEmail($email, $name, $eml);
|
||||
|
@ -264,7 +264,7 @@ class faqs_shortcodes extends e_shortcode
|
||||
}
|
||||
|
||||
|
||||
if(!empty($parms['expand']))
|
||||
if(!empty($parms['expand']) && $faqpref['submit_question'] != e_UC_NOBODY)
|
||||
{
|
||||
$hide = 'e-hideme';
|
||||
$button = "<a class='btn btn-primary e-expandit faq-submit-question' href='#form-ask-a-question'>Ask a Question</a>";
|
||||
@ -275,7 +275,7 @@ class faqs_shortcodes extends e_shortcode
|
||||
$button = "";
|
||||
}
|
||||
|
||||
if (check_class($faqpref['submit_question']))
|
||||
if ($faqpref['submit_question'] != e_UC_NOBODY)
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
|
||||
@ -283,11 +283,28 @@ class faqs_shortcodes extends e_shortcode
|
||||
|
||||
$text .= "<div id='form-ask-a-question' class='alert alert-info alert-block ".$hide." form-group faq-submit-question-form'>";
|
||||
|
||||
$text .= $frm->open('faq-ask-question','post');
|
||||
if(check_class($faqpref['submit_question']))
|
||||
{
|
||||
$text .= $frm->open('faq-ask-question','post');
|
||||
|
||||
$text .= "<div>".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>255, 'size'=>'xxlarge','placeholder'=>'Type your question here..', 'wrap'=>'soft')).'<br />'.$frm->submit('submit_a_question','Submit')."</div>";
|
||||
$text .= "<div>".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>255, 'size'=>'xxlarge','placeholder'=>'Type your question here..', 'wrap'=>'soft')).'<br />'.$frm->submit('submit_a_question','Submit')."</div>";
|
||||
|
||||
$text .= $frm->close();
|
||||
$text .= $frm->close();
|
||||
}
|
||||
elseif($faqpref['submit_question'] == e_UC_MEMBER)
|
||||
{
|
||||
$srp = array(
|
||||
'[' => "<a href='".e_SIGNUP."'>",
|
||||
']' => "</a>"
|
||||
);
|
||||
//TODO LAN
|
||||
$text .= str_replace(array_keys($srp), array_values($srp), "Please [register] and/or login to post a question.");
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO LAN
|
||||
$text .= "Not permitted at this time.";
|
||||
}
|
||||
|
||||
$text .= "</div>";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user