diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 7c892c339..5aace55e9 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -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; - } + }*/ } } diff --git a/e107_plugins/faqs/e_cron.php b/e107_plugins/faqs/e_cron.php index 446f31891..b70e52670 100644 --- a/e107_plugins/faqs/e_cron.php +++ b/e107_plugins/faqs/e_cron.php @@ -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[] = "".$row['faq_question']."
".$tp->toDate($row['faq_datestamp'],'short').""; + $questions[] = "".$row['faq_question']."
".$tp->toDate($row['faq_datestamp'],'short')."\n"; + // $questions[] = $row['faq_question']; } + + // + // $questions = array( "Test Question
".$tp->toDate(time(),'short').""); + + $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 = "

".count($count)." Unuanswered Questions at ".SITENAME."

To answer these questions, please login to ".SITENAME." and then click here.
+ The ".$limit." most recent questions are displayed below. + "; + + $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' => " -

".count($existing)." Unuanswered Questions at ".SITENAME."

To answer these questions, please login to ".SITENAME." and then click here.
- " + 'body' => $body ); e107::getEmail()->sendEmail($email, $name, $eml); diff --git a/e107_plugins/faqs/faqs_shortcodes.php b/e107_plugins/faqs/faqs_shortcodes.php index 3004f7e7c..f4785ff8c 100644 --- a/e107_plugins/faqs/faqs_shortcodes.php +++ b/e107_plugins/faqs/faqs_shortcodes.php @@ -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 = "Ask a Question"; @@ -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 .= "
"; - $text .= $frm->open('faq-ask-question','post'); + if(check_class($faqpref['submit_question'])) + { + $text .= $frm->open('faq-ask-question','post'); - $text .= "
".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>255, 'size'=>'xxlarge','placeholder'=>'Type your question here..', 'wrap'=>'soft')).'
'.$frm->submit('submit_a_question','Submit')."
"; + $text .= "
".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>255, 'size'=>'xxlarge','placeholder'=>'Type your question here..', 'wrap'=>'soft')).'
'.$frm->submit('submit_a_question','Submit')."
"; - $text .= $frm->close(); + $text .= $frm->close(); + } + elseif($faqpref['submit_question'] == e_UC_MEMBER) + { + $srp = array( + '[' => "", + ']' => "" + ); + //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 .= "
";