diff --git a/e107_plugins/faqs/admin_config.php b/e107_plugins/faqs/admin_config.php index 0345ddd13..0520f1b80 100644 --- a/e107_plugins/faqs/admin_config.php +++ b/e107_plugins/faqs/admin_config.php @@ -1,25 +1,24 @@ array('caption'=> LAN_MANAGE, 'perm' => '0'), - 'main/create' => array('caption'=> 'Create FAQ', 'perm' => '0'), - 'cat/list' => array('caption'=> 'Categories', 'perm' => '0'), - 'cat/create' => array('caption'=> "Create Category", 'perm' => '0'), + 'main/create' => array('caption'=> LANA_FAQ_CREATE_ITEM, 'perm' => '0'), + 'cat/list' => array('caption'=> LANA_FAQ_CATEGORIES, 'perm' => '0'), + 'cat/create' => array('caption'=> LANA_FAQ_CREATE_CATEGORY, 'perm' => '0'), 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'), // 'main/custom' => array('caption'=> 'Custom Page', 'perm' => '0') ); @@ -57,7 +56,7 @@ class faq_admin extends e_admin_dispatcher class faq_cat_ui extends e_admin_ui { - protected $pluginTitle = 'FAQs'; + protected $pluginTitle = LAN_PLUGIN_FAQS_NAME; protected $pluginName = 'plugin'; protected $table = "faqs_info"; protected $pid = "faq_info_id"; @@ -183,14 +182,14 @@ class faq_main_ui extends e_admin_ui protected $fields = array( 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'faq_id' => array('title'=> LAN_ID, 'tab' => 0, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE), - 'faq_question' => array('title'=> "Question", 'tab' => 0, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first', 'required'=>TRUE, 'readParms'=>'editable=1'), - 'faq_answer' => array('title'=> "Answer", 'tab' => 0, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=1&truncate=50&bb=1'), + 'faq_question' => array('title'=> LANA_FAQ_QUESTION, 'tab' => 0, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first', 'required'=>TRUE, 'readParms'=>'editable=1'), + 'faq_answer' => array('title'=> LANA_FAQ_ANSWER, 'tab' => 0, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=1&truncate=50&bb=1'), 'faq_parent' => array('title'=> LAN_CATEGORY, 'tab' => 0, 'type' => 'dropdown', 'data'=> 'int', 'inline'=>true,'width' => '10%', 'filter'=>TRUE, 'batch'=>TRUE), - 'faq_comment' => array('title'=> "Comment", 'tab' => 1, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'inline'=> true), // User id + 'faq_comment' => array('title'=> LANA_FAQ_COMMENT, 'tab' => 1, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'inline'=> true), // User id 'faq_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=> 'int','width' => 'auto', 'noedit' => false,'writeParms'=>'auto=1'), 'faq_author' => array('title'=> LAN_USER, 'tab' => 1, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo - 'u.user_name' => array('title'=> "User name", 'tab' => 1, 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User name - 'u.user_loginname' => array('title'=> "User login", 'tab' => 1, 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User login name + 'u.user_name' => array('title'=> LANA_FAQ_UNAME, 'tab' => 1, 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User name + 'u.user_loginname' => array('title'=> LANA_FAQ_ULOGINNAME, 'tab' => 1, 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User login name 'faq_order' => array('title'=> LAN_ORDER, 'tab' => 1, 'type' => 'number', 'data'=> 'int','width' => '5%', 'thclass' => 'center','nolist' => false, 'noedit'=>false, 'readParms'=>'editable=1'), 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'sort=1') ); @@ -200,9 +199,9 @@ class faq_main_ui extends e_admin_ui // optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName); protected $prefs = array( - 'add_faq' => array('title'=> 'Allow submitting of FAQs by:', 'type'=>'userclass'), - 'submit_question' => array('title'=> 'Allow submitting of Questions by:', 'type'=>'userclass'), - 'classic_look' => array('title'=> 'Use Classic Layout', 'type'=>'boolean') + 'add_faq' => array('title'=> LANA_FAQ_PREF_1, 'type'=>'userclass', 'help' => 'Under construction'), + 'submit_question' => array('title'=> LANA_FAQ_PREF_2, 'type'=>'userclass', 'help' => 'Under construction'), + 'classic_look' => array('title'=> LANA_FAQ_PREF_3, 'type'=>'boolean', 'help' => 'Under construction') ); protected $categories = array(); @@ -308,4 +307,3 @@ e107::getAdminUI()->runPage(); require_once(e_ADMIN."footer.php"); exit; -?> \ No newline at end of file diff --git a/e107_plugins/faqs/controllers/list.php b/e107_plugins/faqs/controllers/list.php index 4fb64f927..e08c25fa2 100644 --- a/e107_plugins/faqs/controllers/list.php +++ b/e107_plugins/faqs/controllers/list.php @@ -18,8 +18,26 @@ * FAQ plugin list controller */ -class plugin_faqs_list_controller extends eController +class plugin_faqs_list_controller extends eControllerFront { + /** + * Plugin name - used to check if plugin is installed + * Set this only if plugin requires installation + * @var string + */ + protected $plugin = 'faqs'; + + /** + * User input filter (_GET) + * Format 'action' => array(var => validationArray) + * @var array + */ + protected $filter = array( + 'all' => array( + 'category' => array('int', '0:'), + ), + ); + public function init() { e107::lan('faqs', 'front'); @@ -41,7 +59,17 @@ class plugin_faqs_list_controller extends eController $FAQ_END = e107::getTemplate('faqs', true, 'end'); $FAQ_LISTALL = e107::getTemplate('faqs', true, 'all'); - $query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE cat.faq_info_class IN (".USERCLASS_LIST.") ORDER BY cat.faq_info_order,f.faq_order "; + // request parameter based on filter (int match in this case, see $this->filter[all][category]) - SAFE to be used in a query + $category = $this->getRequest()->getRequestParam('category'); + $where = ''; + if($category) + { + $where = " AND f.faq_parent={$category}"; + } + $query = " + SELECT f.*,cat.* FROM #faqs AS f + LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id + WHERE cat.faq_info_class IN (".USERCLASS_LIST."){$where} ORDER BY cat.faq_info_order,f.faq_order "; $sql->gen($query); $prevcat = ""; @@ -70,7 +98,7 @@ class plugin_faqs_list_controller extends eController $text .= $tp->parseTemplate($FAQ_LISTALL['end'], true); $text .= $tp->parseTemplate($FAQ_END, true); - $this->addTitle(FAQLAN_FAQ); + $this->addTitle(LAN_PLUGIN_FAQS_FRONT_NAME); $this->addBody($text); } diff --git a/e107_plugins/faqs/e_meta.php b/e107_plugins/faqs/e_meta.php index 7d786a082..ba11eca5f 100644 --- a/e107_plugins/faqs/e_meta.php +++ b/e107_plugins/faqs/e_meta.php @@ -3,6 +3,3 @@ if (!defined('e107_INIT')) { exit; } e107::css('faqs','faqs.css'); -// echo ''; - -?> \ No newline at end of file diff --git a/e107_plugins/faqs/e_search.php b/e107_plugins/faqs/e_search.php deleted file mode 100644 index 75216ef16..000000000 --- a/e107_plugins/faqs/e_search.php +++ /dev/null @@ -1,5 +0,0 @@ - e_PLUGIN.'faqs/search.php', 'qtype' => 'FAQ', 'refpage' => 'faqs.php'); - -?> \ No newline at end of file diff --git a/e107_plugins/faqs/e_sitelink.php b/e107_plugins/faqs/e_sitelink.php index c0abcf6bc..354fc31ab 100644 --- a/e107_plugins/faqs/e_sitelink.php +++ b/e107_plugins/faqs/e_sitelink.php @@ -53,7 +53,7 @@ class faqs_sitelink // include plugin-folder in the name. { $sublinks[] = array( 'link_name' => $tp->toHtml($row['faq_info_title'],'','TITLE'), - 'link_url' => '{e_PLUGIN}faqs/faqs.php?cat.'.$row['faq_info_id'], + 'link_url' => e107::getUrl()->sc('faqs/list/all', array('category' => $row['faq_info_id'])), 'link_description' => $row['faq_info_about'], 'link_button' => '', 'link_category' => '', @@ -69,7 +69,3 @@ class faqs_sitelink // include plugin-folder in the name. } } - - - -?> \ No newline at end of file diff --git a/e107_plugins/faqs/faqs.php b/e107_plugins/faqs/faqs.php index 38dc73174..ea1102a2a 100644 --- a/e107_plugins/faqs/faqs.php +++ b/e107_plugins/faqs/faqs.php @@ -14,8 +14,14 @@ * $Author$ */ + // SUBJECT OF REMOVAL + require_once ("../../class2.php"); +$url = e107::getUrl()->create('faqs/list/all', false, 'full=1&noencode=1'); +header('Location: '.$url); +exit; + include_lan(e_PLUGIN."faqs/languages/".e_LANGUAGE."/".e_LANGUAGE."_front.php"); diff --git a/e107_plugins/faqs/faqs_setup.php b/e107_plugins/faqs/faqs_setup.php index 4b4fddc09..5f4c90c3c 100644 --- a/e107_plugins/faqs/faqs_setup.php +++ b/e107_plugins/faqs/faqs_setup.php @@ -60,4 +60,3 @@ class faqs_setup } */ } -?> \ No newline at end of file diff --git a/e107_plugins/faqs/faqs_shortcodes.php b/e107_plugins/faqs/faqs_shortcodes.php index 9538c182c..e84e83f23 100644 --- a/e107_plugins/faqs/faqs_shortcodes.php +++ b/e107_plugins/faqs/faqs_shortcodes.php @@ -1,22 +1,26 @@ var['faq_info_id'].".".$this->var['faq_id']."' >".$tp -> toHtml($this->var['faq_question']).""; + return " $this->var['faq_id']))."' >".$tp -> toHtml($this->var['faq_question']).""; } function sc_faq_answer() @@ -56,20 +60,20 @@ class faqs_shortcodes extends e_shortcode $faqpref = e107::getPlugConfig('faqs')->getPref(); if(($faqpref['add_faq'] && $this->var['faq_author'] == USERID) || ADMIN ) { - return "[ var['faq_id']."'>Edit ]"; + // UNDER CONSTRUCTION + //return "[ var['faq_id']."'>Edit ]"; } } function sc_faq_category() { $tp = e107::getParser(); - return "".$tp->toHtml($this->var['faq_info_title']).""; + return " $this->var['faq_info_id']))."'>".$tp->toHtml($this->var['faq_info_title']).""; } - function sc_faq_catlink() + function sc_faq_caturl() { - $tp = e107::getParser(); - return "".($this->var['faq_info_title'] ? $tp -> toHtml($this->var['faq_info_title']) : "[".NWSLAN_42."]").""; + return e107::getUrl()->create('faqs/list/all', array('category' => $this->var['faq_info_id'])); } function sc_faq_count() @@ -81,16 +85,17 @@ class faqs_shortcodes extends e_shortcode function sc_faq_cat_diz() { $tp = e107::getParser(); - return $tp->toHtml($this->var['faq_info_about'])." "; + return $tp->toHtml($this->var['faq_info_about']); } function sc_faq_icon() { - return ""; + return ""; } function sc_faq_submit_question() { + return ''; // UNDER CONSTRUCTION $faqpref = e107::getPlugConfig('faqs')->getPref(); $frm = e107::getForm(); @@ -110,6 +115,7 @@ class faqs_shortcodes extends e_shortcode function sc_faq_search() { + return ''; // UNDER CONSTRUCTION $tp = e107::getParser(); return "

".$tp->parseTemplate("{SEARCH=faqs}")."
"; } diff --git a/e107_plugins/faqs/faqs_template.php b/e107_plugins/faqs/faqs_template.php deleted file mode 100644 index 9fca7f897..000000000 --- a/e107_plugins/faqs/faqs_template.php +++ /dev/null @@ -1,114 +0,0 @@ -\n"; - $FAQ_END = "
{FAQ_SUBMIT_QUESTION}
- - "; - - $FAQ_LISTALL_START = "

{FAQ_CATEGORY}

\n"; - - -// FAQ - CLASSIC LOOK BELOW ##################################################### - -// FAQ - PARENT LIST --------------------------------------------------------- - - $FAQ_CAT_START = " - - - - - "; - - $FAQ_CAT_PARENT = " - - - "; - - $FAQ_CAT_CHILD = " - - - - - "; - - $FAQ_CAT_END = "
".FAQLAN_41."".FAQLAN_42."
- {FAQ_CATEGORY} -    {FAQ_CAT_DIZ} -
{FAQ_ICON}{FAQ_CATLINK} -
{FAQ_CAT_DIZ}
- {FAQ_COUNT} -
"; - - -// FAQ - LIST --------------------------------------------------------- - - $FAQ_LIST_START = " - "; - - $FAQ_LIST_LOOP .= " - - - - "; - - $FAQ_LIST_END = "
{FAQ_ICON} {FAQ_QUESTION_LINK}
"; - - -// FAQ - VIEW ---------------------------------------------------------------- -// FAQ - VIEW - - $FAQ_VIEW_TEMPLATE = - " - - - - - - - - - - -
- - - {FAQ_QUESTION} -
- - -
{FAQ_ANSWER}
-
-
- {FAQ_EDIT} -   
"; - - - - - - - -?> \ No newline at end of file diff --git a/e107_plugins/faqs/languages/English/English_admin.php b/e107_plugins/faqs/languages/English/English_admin.php index 635eaded6..a4f9119e3 100644 --- a/e107_plugins/faqs/languages/English/English_admin.php +++ b/e107_plugins/faqs/languages/English/English_admin.php @@ -15,3 +15,6 @@ define('LANA_FAQ_ANSWER', 'Answer'); define('LANA_FAQ_COMMENT', 'Comment'); define('LANA_FAQ_UNAME', 'User name'); define('LANA_FAQ_ULOGINNAME', 'User login'); +define('LANA_FAQ_PREF_1', 'Allow submitting of FAQs by:'); +define('LANA_FAQ_PREF_2', 'Allow submitting of Questions by:'); +define('LANA_FAQ_PREF_3', 'Use Classic Layout'); diff --git a/e107_plugins/faqs/languages/English/English_global.php b/e107_plugins/faqs/languages/English/English_global.php index 2b70883dd..033fcb92d 100644 --- a/e107_plugins/faqs/languages/English/English_global.php +++ b/e107_plugins/faqs/languages/English/English_global.php @@ -9,4 +9,6 @@ define("LAN_PLUGIN_FAQS_NAME", "FAQs"); define("LAN_PLUGIN_FAQS_DESCRIPTION", "A simple plugin to add Frequently Asked Questions to your website."); define("LAN_PLUGIN_FAQS_FUNCTIONNAME", "FAQ Categories"); -?> \ No newline at end of file +define("LAN_PLUGIN_FAQS_FRONT_NAME", "FAQ (Frequently Asked Questions)"); + + diff --git a/e107_plugins/faqs/languages/English/front.php b/e107_plugins/faqs/languages/English/front.php deleted file mode 100644 index 6b4fd1d61..000000000 --- a/e107_plugins/faqs/languages/English/front.php +++ /dev/null @@ -1,27 +0,0 @@ - \ No newline at end of file diff --git a/e107_plugins/faqs/languages/search_lan_English.php b/e107_plugins/faqs/languages/search_lan_English.php deleted file mode 100644 index 63523f322..000000000 --- a/e107_plugins/faqs/languages/search_lan_English.php +++ /dev/null @@ -1,32 +0,0 @@ - \ No newline at end of file diff --git a/e107_plugins/faqs/search.php b/e107_plugins/faqs/search.php deleted file mode 100644 index d21489e15..000000000 --- a/e107_plugins/faqs/search.php +++ /dev/null @@ -1,22 +0,0 @@ - db_Select("faqs", "*", "faq_question REGEXP('".$query."') OR faq_answer REGEXP('".$query."') ORDER BY faq_id DESC ")){ - while($row = $sql -> db_Fetch()){ - extract($row); - if(preg_match('/'.str_replace('/', '\\/', $query).'/i', $faq_question)){ - $que = parsesearch($faq_question, $query); - $ans = substr($faq_answer, 0,70); - $text .= "\"bullet\" ".$que."
Match found in faq question
".$ans."

"; - } - if(preg_match('/'.str_replace('/', '\\/', $query).'/i', $faq_answer)){ - $resmain = parsesearch($faq_answer, $query); - $text .= "\"bullet\" ".$faq_question."
Match found in faq answer
".$resmain."

"; - } - } -}else{ - $text .= "No matches."; -} -?> \ No newline at end of file diff --git a/e107_plugins/faqs/templates/faqs_template.php b/e107_plugins/faqs/templates/faqs_template.php index 1898c102a..acf9ef5a6 100644 --- a/e107_plugins/faqs/templates/faqs_template.php +++ b/e107_plugins/faqs/templates/faqs_template.php @@ -6,16 +6,8 @@ * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * - * - * - * $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/faqs_template.php,v $ - * $Revision$ - * $Date$ - * $Author$ */ -// FAQ - NEW LOOK (all you need is here) ------------------------------------------------------------- - $FAQS_TEMPLATE['start'] = "
"; @@ -39,77 +31,3 @@ $FAQS_TEMPLATE['all']['end'] = "
"; - -// FAQ - CLASSIC LOOK BELOW ##################################################### - -// FAQ - PARENT LIST --------------------------------------------------------- - - $FAQS_TEMPLATE['cat']['start'] = " - - - - - "; - - $FAQS_TEMPLATE['cat']['parent'] = " - - - "; - - $FAQS_TEMPLATE['cat']['child'] = " - - - - - "; - - $FAQS_TEMPLATE['cat']['end'] = "
".FAQLAN_41."".FAQLAN_42."
- {FAQ_CATEGORY} -    {FAQ_CAT_DIZ} -
{FAQ_ICON}{FAQ_CATLINK} -
{FAQ_CAT_DIZ}
- {FAQ_COUNT} -
"; - - -// FAQ - LIST --------------------------------------------------------- - - $FAQS_TEMPLATE['list']['start'] = " - "; - - $FAQS_TEMPLATE['list']['item'] .= " - - - - "; - - $FAQS_TEMPLATE['list']['end'] = "
{FAQ_ICON} {FAQ_QUESTION_LINK}
"; - - -// FAQ - VIEW ---------------------------------------------------------------- -// FAQ - VIEW - - $FAQS_TEMPLATE['view']['start'] = " - - - - - - - - - - -
- - - {FAQ_QUESTION} -
- - -
{FAQ_ANSWER}
-
-
- {FAQ_EDIT} -
-";