mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Parser fix and FAQ 'ask a question' permissions fix.
This commit is contained in:
@@ -832,8 +832,6 @@ class e_parse extends e_parser
|
|||||||
$text = $this->simpleParse($text, $extraCodes, false);
|
$text = $this->simpleParse($text, $extraCodes, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
|
return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -852,14 +850,22 @@ class e_parse extends e_parser
|
|||||||
|
|
||||||
foreach ($extraCodes as $sc => $code)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,8 +33,11 @@
|
|||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$tp = e107::getParser();
|
$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))
|
if(empty($existing))
|
||||||
{
|
{
|
||||||
@@ -45,9 +48,15 @@
|
|||||||
|
|
||||||
foreach($existing as $row)
|
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";
|
$name = SITENAME . " Automation";
|
||||||
|
|
||||||
$email = e107::pref('core','siteadminemail');
|
$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');
|
$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(
|
$eml = array(
|
||||||
'subject' => count($existing)." Unuanswered Question as of ".date('d-M-Y')." ",
|
'subject' => count($existing)." Unuanswered Question as of ".date('d-M-Y')." ",
|
||||||
// 'sender_email' => $email,
|
// 'sender_email' => $email,
|
||||||
@@ -62,9 +79,7 @@
|
|||||||
// 'replyto' => $email,
|
// 'replyto' => $email,
|
||||||
'html' => true,
|
'html' => true,
|
||||||
'template' => 'default',
|
'template' => 'default',
|
||||||
'body' => "
|
'body' => $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>"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
e107::getEmail()->sendEmail($email, $name, $eml);
|
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';
|
$hide = 'e-hideme';
|
||||||
$button = "<a class='btn btn-primary e-expandit faq-submit-question' href='#form-ask-a-question'>Ask a Question</a>";
|
$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 = "";
|
$button = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_class($faqpref['submit_question']))
|
if ($faqpref['submit_question'] != e_UC_NOBODY)
|
||||||
{
|
{
|
||||||
$frm = e107::getForm();
|
$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 .= "<div id='form-ask-a-question' class='alert alert-info alert-block ".$hide." form-group faq-submit-question-form'>";
|
||||||
|
|
||||||
|
if(check_class($faqpref['submit_question']))
|
||||||
|
{
|
||||||
$text .= $frm->open('faq-ask-question','post');
|
$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>";
|
$text .= "</div>";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user