1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-21 13:11:52 +02:00

FAQs derived from my original plugin for 0.6/0.7. Work in progress

This commit is contained in:
CaMer0n 2009-11-09 12:57:34 +00:00
parent 6b77edb970
commit 6df8480dc8
13 changed files with 1296 additions and 0 deletions

View File

@ -0,0 +1,176 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/admin_config.php,v $
| $Revision: 1.1 $
| $Date: 2009-11-09 12:57:34 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
require_once("../../class2.php");
if (!getperms("P"))
{
header("location:".e_BASE."index.php");
exit;
}
class faq_admin extends e_admin_dispatcher
{
protected $modes = array(
'main' => array(
'controller' => 'faq_main_ui',
'path' => null,
'ui' => 'faq_admin_form_ui',
'uipath' => null
),
'cat' => array(
'controller' => 'faq_cat_ui',
'path' => null,
// 'ui' => 'faq_cat_form_ui',
'uipath' => null
)
);
protected $adminMenu = array(
'main/list' => array('caption'=> 'FAQs', 'perm' => '0'),
'main/create' => array('caption'=> 'Create FAQ', 'perm' => '0'),
'cat/list' => array('caption'=> 'Categories', 'perm' => '0'),
'cat/create' => array('caption'=> "Create New Cat.", 'perm' => '0'),
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'),
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => '0')
);
protected $adminMenuAliases = array(
'main/edit' => 'main/list'
);
protected $menuTitle = 'FAQs';
}
class faq_cat_ui extends e_admin_ui
{
protected $pluginTitle = 'FAQs';
protected $pluginName = 'plugin';
protected $table = "faqs_info";
protected $pid = "faq_info_id";
// protected $perPage = 10;
// protected $listQry = "SELECT * FROM #faq_info"; // without any Order or Limit.
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'faq_info_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'width' => '5%', 'thclass' => 'left' ),
'faq_info_id' => array('title'=> LAN_ID, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE),
'faq_info_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
'faq_info_about' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
'faq_info_parent' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'width' => '5%'),
'faq_info_class' => array('title'=> LAN_VISIBILE, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto'),
'faq_info_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => '5%', 'thclass' => 'left' ),
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
);
}
class faq_main_ui extends e_admin_ui
{
//TODO Move to Class above.
protected $pluginTitle = 'FAQs';
protected $pluginName = 'faqs';
protected $table = "faqs";
protected $listQry = "SELECT * FROM #faqs"; // without any Order or Limit.
protected $editQry = "SELECT * FROM #faqs WHERE faq_id = {ID}";
protected $pid = "faq_id";
protected $perPage = 10;
protected $batchDelete = true;
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'faq_id' => array('title'=> LAN_ID, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE),
'faq_question' => array('title'=> "Question", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name
'faq_answer' => array('title'=> "Answer", 'type' => 'textarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
'faq_parent' => array('title'=> "Category", 'type' => 'method', 'width' => '5%', 'filter'=>TRUE, 'batch'=>TRUE),
'faq_comment' => array('title'=> "Comment", 'type' => 'userclass', 'data' => 'int', 'width' => 'auto'), // User id
'faq_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date
'faq_author' => array('title'=> LAN_USER, 'type' => 'user', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'faq_order' => array('title'=> "Order", 'type' => 'int', 'width' => '5%', 'thclass' => 'center' ), // Real name (no real vetting)
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
);
// protected $fieldpref = array('checkboxes', 'comment_id', 'comment_item_id', 'comment_author_id', 'comment_author_name', 'comment_subject', 'comment_comment', 'comment_type', 'options');
// 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')
);
}
//TODO Block and Unblock buttons, moderated comments?
class faq_admin_form_ui extends e_admin_form_ui
{
var $categories = array('hello','hello2','hello3');
//FIXME Breaks everything!!!
/*
function __construct()
{
$sql = e107::getDb();
$sql->db_Select('faq_info');
while ($row = $sql->db_Fetch())
{
$id = $row['faq_info_id'];
$this->categories[$id] = $row['faq_info_title'];
echo "hello";
}
}
*/
function faq_parent($curVal,$mode)
{
if($mode == 'read')
{
return $curVal.' (custom!)';
}
if($mode == 'filter') // Custom Filter List for release_type
{
return array(1=>'Category 1',2=>'Category 2',3=>'Category 3');
}
if($mode == 'batch')
{
}
}
}
new faq_admin();
require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;
?>

View File

@ -0,0 +1,8 @@
<?php
if (!defined('e107_INIT')) { exit; }
echo '<link rel="stylesheet" href="'.e_PLUGIN_ABS.'faqs/faqs.css" type="text/css" />';
?>

View File

@ -0,0 +1,5 @@
<?php
$search_info[]=array( 'sfile' => e_PLUGIN.'faqs/search.php', 'qtype' => 'FAQ', 'refpage' => 'faqs.php');
?>

View File

@ -0,0 +1,57 @@
.faq-start
{
}
.faq-submit-question-container
{
margin-top:20px;
margin-left:30px;
}
.faq-submit-question
{
margin-top:20px;
margin-bottom: 10px;
}
.faq-submit-question-form
{
margin-top:20px;
margin-bottom: 10px;
}
.faq-search
{
padding:20px;
}
.faq-listall-category
{
}
.faq-listall-container
{
}
li.faq-listall-loop
{
list-style: circle outside;
margin-bottom: 8px;
}
.faq-question
{
}
.faq-answer
{
margin:20px;;
border:1px solid silver;
background-color: #e3e3e3;
padding:10px;
}

525
e107_plugins/faqs/faqs.php Normal file
View File

@ -0,0 +1,525 @@
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| FAQs v3.2 with Page-Titles by Cameron (cameron@e107coders.org)
|
| <EFBFBD>Steve Dunstan 2001-2002
| http://jalist.com
| stevedunstan@jalist.com
|
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
require_once ("../../class2.php");
include_lan(e_PLUGIN."faqs/languages/faq_lan_".e_LANGUAGE.".php");
include_lan(e_PLUGIN."faqs/languages/admin/faq_lan_".e_LANGUAGE.".php");
require_once (e_HANDLER."form_handler.php");
require_once (e_HANDLER."userclass_class.php");
require_once (e_HANDLER."ren_help.php");
require_once (e_HANDLER."comment_class.php");
if (!$FAQ_VIEW_TEMPLATE)
{
if (file_exists(THEME."faqs_template.php"))
{
require_once (THEME."faqs_template.php");
}
else
{
require_once (e_PLUGIN."faqs/faqs_template.php");
}
}
// require_once(HEADERF);
// $pref['add_faq']=1;
$rs = new form;
$cobj = new comment;
if (!$_GET['elan'])
{
$qs = explode(".", e_QUERY);
$action = $qs[0];
$id = $qs[1];
$idx = $qs[2];
}
$from = ($from ? $from : 0);
$amount = 50;
if (isset($_POST['faq_submit']))
{
$message = "-";
if ($_POST['faq_question'] != "" || $_POST['data'] != "")
{
$faq_question = $aj->formtpa($_POST['faq_question'], "on");
$data = $aj->formtpa($_POST['data'], "on");
$count = ($sql->db_Count("faqs", "(*)", "WHERE faq_parent='".$_POST['faq_parent']."' ") + 1);
$sql->db_Insert("faqs", " 0, '".$_POST['faq_parent']."', '$faq_question', '$data', '".$_POST['faq_comment']."', '".time()."', '".USERID."', '".$count."' ");
$message = FAQ_ADLAN_32;
unset($faq_question, $data);
}
else
{
$message = FAQ_ADLAN_30;
}
$id = $_POST['faq_parent'];
}
if (isset($_POST['faq_edit_submit']))
{
if ($_POST['faq_question'] != "" || $_POST['data'] != "")
{
$faq_question = $aj->formtpa($_POST['faq_question'], "on");
$data = $aj->formtpa($_POST['data'], "on");
$sql->db_Update("faqs", "faq_parent='".$_POST['faq_parent']."', faq_question ='$faq_question', faq_answer='$data', faq_comment='".$_POST['faq_comment']."' WHERE faq_id='".$idx."' ");
$message = FAQ_ADLAN_29;
unset($faq_question, $data);
}
else
{
$message = FAQ_ADLAN_30;
}
}
if (isset($_POST['commentsubmit']))
{
$pid = (IsSet($_POST['pid']) ? $_POST['pid'] : 0);
$cobj->enter_comment($_POST['author_name'], $_POST['comment'], "faq", $idx, $pid, $_POST['subject']);
}
// Actions +++++++++++++++++++++++++++++
$faq = new faq;
$faqpref = e107::getPlugConfig('faqs')->getPref();
if ($action == "" || $action == "main")
{
if(vartrue($faqpref['classic_look']))
{
$tmp = $faq->show_existing_parents($action, $sub_action, $id, $from, $amount);
}
else
{
$tmp = $faq->view_all();
}
if (vartrue($faqpref['faq_title']))
{
define("e_PAGETITLE", $faqpref['faq_title']);
}
else
{
define("e_PAGETITLE", FAQLAN_23);
}
require_once (HEADERF);
$ns->tablerender(FAQLAN_41, $tmp['text']);
}
if($action == "cat" && $idx)
{
$tmp = $faq->view_faq($idx) ;
define("e_PAGETITLE",FAQLAN_FAQ." - ". $tmp['title']);
require_once(HEADERF);
$ns -> tablerender($tmp['caption'], $tmp['text']);
}
if ($action == "cat")
{
$tmp = $faq->view_cat_list($action, $id);
define("e_PAGETITLE", strip_tags($tmp['title'].$tmp['caption']));
require_once (HEADERF);
$ns->tablerender($tmp['caption'], $tmp['text']);
}
if ((check_class($faqpref['add_faq']) || ADMIN) && ($action == "new" || $action == "edit"))
{
require_once (HEADERF);
$faq->add_faq($action, $id, $idx);
}
require_once (FOOTERF);
exit;
// ====== +++++++++++++++++++++++++++++
class faq
{
var $pref = array();
function __construct()
{
$this->pref = e107::getPlugConfig('faqs')->getPref();
setScVar('faqs_shortcodes', 'pref', $this->pref);
}
function view_all() // new funtion to render all FAQs
{
echo "hello";
$sql = e107::getDb();
$tp = e107::getParser();
global $FAQ_START, $FAQ_END, $FAQ_LISTALL_START,$FAQ_LISTALL_LOOP,$FAQ_LISTALL_END;
require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
$query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id ORDER BY cat.faq_info_order,f.faq_order ";
$sql->db_Select_gen($query);
$text = $tp->parseTemplate($FAQ_START, true);
$prevcat = "";
while ($rw = $sql->db_Fetch())
{
setScVar('faqs_shortcodes', 'row', $rw);
if($rw['faq_info_order'] != $prevcat)
{
if($prevcat !='')
{
$text .= $tp->parseTemplate($FAQ_LISTALL_END, true);
}
$text .= "\n\n<!-- FAQ Start ".$rw['faq_info_order']."-->\n\n";
$text .= $tp->parseTemplate($FAQ_LISTALL_START, true);
$start = TRUE;
}
$text .= $tp->parseTemplate($FAQ_LISTALL_LOOP, true);
$prevcat = $rw['faq_info_order'];
}
$text .= $tp->parseTemplate($FAQ_LISTALL_END, true);
$text .= $tp->parseTemplate($FAQ_END, true);
$ret['title'] = FAQLAN_FAQ;
$ret['text'] = $text;
$ret['caption'] = $caption;
return $ret;
}
// ------------- Everything below here is kept for backwards-compatability 'Classic Look' ------------
function view_cat_list($action, $id)
{
global $ns,$row,$FAQ_LIST_START,$FAQ_LIST_LOOP,$FAQ_LIST_END;
$tp = e107::getParser();
$sql = e107::getDb();
require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
$query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE f.faq_parent = '$id' ";
$sql->db_Select_gen($query);
setScVar('faqs_shortcodes', 'row', $row);
$text = $tp->parseTemplate($FAQ_LIST_START, true);
while ($rw = $sql->db_Fetch())
{
setScVar('faqs_shortcodes', 'row', $rw);
$text .= $tp->parseTemplate($FAQ_LIST_LOOP, true);
$caption = "&nbsp;Category: <b>".$rw['faq_info_title']."</b>";
}
$text .= $tp->parseTemplate($FAQ_LIST_END, true);
$ret['title'] = FAQLAN_FAQ." - ".$category_title;
$ret['text'] = $text.$this->faq_footer($id);
$ret['caption'] = $caption;
return $ret;
}
// =============================================================================
function show_existing_parents($action, $sub_action, $id, $from, $amount)
{
$tp = e107::getParser();
$sql = e107::getDb();
// ##### Display scrolling list of existing FAQ items ---------------------------------------------------------------------------------------------------------
global $FAQ_CAT_START,$FAQ_CAT_PARENT,$FAQ_CAT_CHILD,$FAQ_CAT_END;
require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
$text = "<div style='text-align:center'>
<div style='text-align:center'>";
$qry = "SELECT dc.*,
COUNT(d.faq_id) AS f_count,
COUNT(d2.faq_id) AS f_subcount
FROM #faqs_info AS dc
LEFT JOIN #faqs AS d ON dc.faq_info_id = d.faq_parent
LEFT JOIN #faqs_info as dc2 ON dc2.faq_info_parent = dc.faq_info_id
LEFT JOIN #faqs AS d2 ON dc2.faq_info_id = d2.faq_parent
WHERE dc.faq_info_class IN (".USERCLASS_LIST.")
GROUP by dc.faq_info_id ORDER by dc.faq_info_order,dc.faq_info_parent "; //
$text .= $FAQ_CAT_START;
$sql->db_Select_gen($qry);
while ($row = $sql->db_Fetch())
{
setScVar('faqs_shortcodes', 'row', $row);
if ($row['faq_info_parent'] == '0') //
{
$text .= $tp->parseTemplate($FAQ_CAT_PARENT, true);
}
else
{
if (!$row['f_count'] && !$row['f_subcount'])
{
$text .= $tp->parseTemplate($FAQ_CAT_CHILD, true);
}
else
{
$text .= $tp->parseTemplate($FAQ_CAT_CHILD, true);
}
}
}
$text .= $FAQ_CAT_END;
$ret['text'] = $text.$this->faq_footer();
return $ret;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function view_faq($idx)
{
global $ns,$row,$sql,$aj,$pref,$cobj,$id,$tp,$FAQ_VIEW_TEMPLATE;
require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
$sql->db_Select("faqs", "*", "faq_id='$idx' LIMIT 1");
$row = $sql->db_Fetch();
setScVar('faqs_shortcodes', 'row', $row);
$caption = "&nbsp;FAQ #".$row['faq_id'];
$text = $tp->parseTemplate($FAQ_VIEW_TEMPLATE, true);
// $text = $tp->toHTML($text, TRUE);
$ret['text'] = $text;
$ret['caption'] = $caption;
$ret['title'] = $row['faq_question'];
$ret['comments'] = $text;
return $ret;
$subject = (!$subject ? $aj->formtpa($faq_question) : $subject);
if (check_class($row['faq_comment']))
{
$action = "comment";
$table = "faq";
$query = ($pref['nested_comments'] ? "comment_item_id='$idx' AND (comment_type='$table' OR comment_type='3') AND comment_pid='0' ORDER BY comment_datestamp" : "comment_item_id='$idx' AND (comment_type='$table' OR comment_type='3') ORDER BY comment_datestamp");
unset($text);
if (!is_object($sql2))
{
$sql2 = new db;
}
if ($comment_total = $sql2->db_Select("comments", "*", $query))
{
$width = 0;
while ($row = $sql2->db_Fetch())
{
if ($pref['nested_comments'])
{
$text = $cobj->render_comment($row, $table, $action, $idx.".".$id, $width, $subject);
$ns->tablerender(FAQLAN_38, $text);
}
else
{
$text .= $cobj->render_comment($row, $table, $action, $idx.".".$id, $width, $subject);
}
}
if (!$pref['nested_comments'])
{
$ns->tablerender("Comments", $text);
}
if (ADMIN && getperms("B"))
{
// bkwon 05-Jun-2004 fix URL to moderate comment
echo "<div style='text-align:right'><a href='".e_ADMIN."modcomment.php?faq.$faq_id'>moderate comments</a></div><br />";
}
}
$cobj->form_comment($action, $table, $idx.".".$id, $subject, $content_type);
} // end of check_class
}
function faq_footer($id='')
{
global $faqpref,$timing_start,$tp,$cust_footer, $CUSTOMPAGES, $CUSTOMHEADER, $CUSTOMHEADER;
$text_menu .= "<div style='text-align:center;' ><br />
&nbsp;&nbsp;[&nbsp;<a href=\"faq.php?main\">Back to Categories</a>&nbsp;]&nbsp;&nbsp;";
if(check_class($faqpref['add_faq'])){
$text_menu .="[&nbsp;<a href=\"faq.php?new.$id\">Submit a Question</a>&nbsp;]";
}
$text_menu .="</div>";
$text_menu .= "<div style='text-align:center'><br />".$tp->parseTemplate("{SEARCH=faq}")."</div>";
return $text_menu;
// require_once (FOOTERF);
}
function add_faq($action, $id, $idx)
{
global $rs;
$tp = e107::getParser();
$sql = e107::getDb();
$ns = e107::getRender();
$userid = USERID;
$text .= "<table class='fborder' style=\"".USER_WIDTH."\" >
<tr>
<td colspan='2' class='forumheader3' style=\"width:80%; padding:0px\">";
$sql->db_Select("faqs", "*", "faq_parent='$id' AND faq_author = '$userid' ORDER BY faq_id ASC");
$text .= "<div style='width : auto; height : 110px; overflow : auto; '>
<table class='fborder' style=\"width:100%\">
<tr>
<td class='fcaption' style=\"width:70%\">".FAQ_ADLAN_49."</td>
<td class='fcaption' style='text-align:center'>Options</td></tr>
";
while ($rw = $sql->db_Fetch())
{
// list($pfaq_id, $pfaq_parent, $pfaq_question, $pfaq_answer, $pfaq_comment);
$rw['faq_question'] = substr($rw['faq_question'], 0, 50)." ... ";
$text .= "<tr>
<td style='width:70%' class='forumheader3'>".($rw['faq_question'] ? $tp->toHTML($rw['faq_question']) : "[".NWSLAN_42."]")."</td>
<td style='width:30%; text-align:center' class='forumheader3'>
".$rs->form_button("submit", "entry_edit_{$rw['faq_id']}", FAQ_ADLAN_45, "onclick=\"document.location='".e_SELF."?edit.".$id.".".$rw['faq_id'].".'\"");
// $text .= $rs -> form_button("submit", "entry_delete", FAQ_ADLAN_50, "onclick=\"document.location='".e_SELF."?delentry.$id.$pfaq_id'\"")."
$text .= "</td>
</tr>";
}
$text .= "</table></div>";
if ($action == "edit")
{
$sql->db_Select("faqs", "*", " faq_id = '$idx' ");
$row = $sql->db_Fetch();
extract($row);
$data = $faq_answer;
}
$text .= "</td>
</tr></table><form method=\"post\" action=\"".e_SELF."?cat.$id.$idx\" id=\"dataform\">
<table class='fborder' style=\"".USER_WIDTH."\" >
<tr>
<td class='fcaption' colspan='2' style='text-align:center'>";
$text .= (is_numeric($id)) ? "Edit" : "Add";
$text .= " an FAQ</td></tr>";
$text .= "
<tr>
<td class='forumheader3' style=\"width:20%\">".FAQ_ADLAN_78."</td>
<td class='forumheader3' style=\"width:80%\">";
$text .= "<select style='width:150px' class='tbox' id='faq_parent' name='faq_parent' >";
$sql->db_Select("faqs_info", "*", "faq_info_parent !='0' ");
while ($prow = $sql->db_Fetch())
{
//extract($row);
$selected = $prow['faq_info_id'] == $id ? " selected='selected'" : "";
$text .= "<option value=\"".$prow['faq_info_id']."\" $selected>".$prow['faq_info_title']."</option>";
}
$text .= " </select>
</td>
</tr>";
$text .= "
<tr>
<td class='forumheader3' style=\"width:20%\">".FAQ_ADLAN_51."</td>
<td class='forumheader3' style=\"width:80%\">
<input class=\"tbox\" type=\"text\" name=\"faq_question\" style=\"width:100%\" value=\"$faq_question\" />
</td>
</tr>
<tr>
<td class='forumheader3' style=\"width:20%;vertical-align:top\">".FAQ_ADLAN_60."</td>
<td class='forumheader3' style=\"width:80%\">
<textarea id=\"data\" cols='15' class=\"tbox\" name=\"data\" style=\"width:100%\" rows=\"8\" onselect=\"storeCaret(this);\" onclick=\"storeCaret(this);\" onkeyup=\"storeCaret(this);\">$data</textarea>
<br />
<input class='helpbox' type=\"text\" id='helpb' name=\"helpb\" size=\"70\" style='width:100%' /><br />
";
$text .= ren_help("addtext");
$text .= "<br /></td></tr>";
if (ADMIN)
{
$text .= "<tr>
<td class='forumheader3' style=\"width:20%; vertical-align:top\">".FAQ_ADLAN_52."</td>";
require_once (e_HANDLER."userclass_class.php");
$text .= "<td class='forumheader3' >".r_userclass("faq_comment", $faq_comment, "", "public,guest,nobody,member,admin,classes")."</td>";
$text .= "
</tr>";
}
else
{
$text .= "<input type='hidden' name='faq_comment' value='0' />";
}
$text .= "
<tr>
<td class='forumheader' colspan=\"2\" style=\"text-align:center\">
";
if ($action == "edit")
{
$text .= "<input class=\"button\" type=\"submit\" name=\"faq_edit_submit\" value=\"".FAQ_ADLAN_53."$faq_id\" />
<input type=\"hidden\" name=\"faq_id\" value=\"$idx\" /> ";
}
else
{
$text .= "<input class=\"button\" type=\"submit\" name=\"faq_submit\" value=\"".FAQ_ADLAN_54."\" />";
}
$text .= "<input type=\"hidden\" name=\"faq\" value=\"$faq\" />
</td>
</tr>
</table>
</form>";
if(varset($faq))
{
$sql->db_Select("faqs_info", "*", "faq_info_id='$faq'");
$row = $sql->db_Fetch();
extract($row);
}
$ns->tablerender("Frequently asked Questions".$faq_info_title, "<div style='text-align:center'>".$text."</div>".$this->faq_footer());
}
}
?>

View File

@ -0,0 +1,68 @@
<?php
/*
* e107 website system
*
* Copyright (c) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Custom FAQ install/uninstall/update routines
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/faqs_setup.php,v $
* $Revision: 1.1 $
* $Date: 2009-11-09 12:57:34 $
* $Author: e107coders $
*
*/
class faqs_setup
{
/*
function install_pre($var)
{
// print_a($var);
// echo "custom install 'pre' function<br /><br />";
}
*/
function install_post($var)
{
$sql = e107::getDb();
$mes = e107::getMessage();
$query = "INSERT INTO #faqs (`faq_id`, `faq_parent`, `faq_question`, `faq_answer`, `faq_comment`, `faq_datestamp`, `faq_author`, `faq_order`) VALUES
(1, 1, 'What is FAQs?', 'FAQs is a plugin that you can use on your e107 0.8+ website to manage Frequently Asked Questions', 0, 1230918231, 1, 0),
(2, 1, 'How can I use e107?', 'You can use e107 if you have a running server with PHP and MySQL installed. Read more about installation requirements.\r\n\r\ne107 is a Content Management System (CMS). You can use it to make consistent web pages. The advantage is you don''t have to write HTML or create CSS files. The programs of e107 take care of all the presentation through the theme. All your entered data is saved into a MySQL database.\r\n\r\ne107 has active plugin and theme resources which grow every day. The software is completely and totally free and always will be, you don''t even need to register anywhere to download it. There are hundreds of content management systems to choose from, if you''re not sure e107 suits your needs, head over to OpenSourceCMS and try a few out.\r\n\r\nWith e107 you are totally in control with a powerful but easy to understand Admin Area and you can add functionalities to your website by adding plugins. e107 has an easy step-by-step installation procedure to install it on your server. ', 0, 0, 1, 1),
(3, 1, 'What is a plugin?', 'A plugin is an additional program that integrates with the e107 core system.\r\n\r\nActually plugins are enhancements to the existing system. Some other CMS systems call it extensions, components or modules.\r\n\r\nAlready some core plugins are included in the full install package of e107.\r\n\r\nYou can activate them using Admin > Plugin Manager, and click on Install for the ones you want. They will appear in your Admin Area for configuration.\r\n\r\nThere are all kinds of plugins: small and large, core plugins and third party plugins. There are plugins for all kinds of purposes. ', 0, 123123123, 1, 2);
";
$status = ($sql->db_Select_gen($query)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Default table data to table: faqs",$status);
$query2 = "INSERT INTO #faqs_info (`faq_info_id`, `faq_info_title`, `faq_info_about`, `faq_info_parent`, `faq_info_class`, `faq_info_order`, `faq_info_icon`) VALUES
(1, 'General', 'General FaQS', 0, 0, 0, ''),
(2, 'Misc', 'Other FAQs', 0, 0, 1, '');";
$status = ($sql->db_Select_gen($query2)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Default table data to table: faqs_info",$status);
}
/*
function uninstall_options()
{
}
function uninstall_post($var)
{
// print_a($var);
}
function upgrade_post($var)
{
// $sql = e107::getDb();
}
*/
}
?>

View File

@ -0,0 +1,122 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Copyright (c) e107 Inc. 2008-2009
| http://e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/faqs_shortcodes.php,v $
| $Revision: 1.1 $
| $Date: 2009-11-09 12:57:34 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
register_shortcode('faqs_shortcodes', true);
initShortcodeClass('faqs_shortcodes');
class faqs_shortcodes
{
var $row;
function sc_faq_question($parm='')
{
$tp = e107::getParser();
if($parm == 'expand')
{
$text = "<a class='e-expandit faq-question' href='faq.php'>".$tp->toHtml($this->row['faq_question'])."</a>
<div class='e-hideme faq-answer faq_answer'>".$tp->toHTML($this->row['faq_answer'],TRUE)."</div>";
}
else
{
$text = $tp->toHtml($this->row['faq_question']);
}
return $text;
}
function sc_faq_question_link($parm='')
{
$tp = e107::getParser();
return "<a class='faq-question' href='faq.php?cat.".$this->row['faq_info_id'].".".$this->row['faq_id']."' >".$tp -> toHtml($this->row['faq_question'])."</a>";
}
function sc_faq_answer()
{
$tp = e107::getParser();
return "<div class='faq-answer'>".$tp -> toHtml($this->row['faq_answer'])."</div>";
}
function sc_faq_edit()
{
$tp = e107::getParser();
$faqpref = e107::getPlugConfig('faqs')->getPref();
if(($faqpref['add_faq'] && $this->row['faq_author'] == USERID) || ADMIN )
{
return "[ <a href='faq.php?edit.".$this->row['faq_parent'].".".$this->row['faq_id']."'>Edit</a> ]";
}
}
function sc_faq_category()
{
$tp = e107::getParser();
return $tp->toHtml($this->row['faq_info_title']);
}
function sc_faq_catlink()
{
$tp = e107::getParser();
return "<a href='".e_SELF."?cat.".$this->row['faq_info_id']."'>".($this->row['faq_info_title'] ? $tp -> toHtml($this->row['faq_info_title']) : "[".NWSLAN_42."]")."</a>";
}
function sc_faq_count()
{
$tp = e107::getParser();
return $this->row['f_count'];
}
function sc_faq_cat_diz()
{
$tp = e107::getParser();
return $tp->toHtml($this->row['faq_info_about'])."&nbsp;";
}
function sc_faq_icon()
{
return "<img src='".e_PLUGIN."faq/images/faq.png' alt='' />";
}
function sc_faq_submit_question()
{
$faqpref = e107::getPlugConfig('faqs')->getPref();
$frm = e107::getForm();
if (check_class($faqpref['add_faq']))
{
$text = "<div class='faq-submit-question-container'><a class='e-expandit faq-submit-question' href='faq.php'>Submit a Question</a>
<div class='e-hideme faq-submit-question-form'>
<form method=\"post\" action=\"".e_SELF."?cat.$id.$idx\" id=\"dataform\">
<div>".$frm->textarea('ask_a_question','').'<br />'.$frm->submit('submit_a_question','Go')."</div>
</form>
</div>
</div>
";
return $text;
}
}
function sc_faq_search()
{
$tp = e107::getParser();
return "<div style='text-align:center'><br />".$tp->parseTemplate("{SEARCH=faq}")."</div>";
}
}
?>

View File

@ -0,0 +1,23 @@
CREATE TABLE faqs (
faq_id int(10) unsigned NOT NULL auto_increment,
faq_parent int(10) unsigned NOT NULL default '0',
faq_question mediumtext NOT NULL,
faq_answer text NOT NULL,
faq_comment tinyint(1) unsigned NOT NULL default '0',
faq_datestamp int(10) unsigned NOT NULL default '0',
faq_author int(10) unsigned default NULL,
faq_order int(6) unsigned NOT NULL default '0',
PRIMARY KEY (faq_id)
) TYPE=MyISAM;
CREATE TABLE faqs_info (
faq_info_id int(10) unsigned NOT NULL auto_increment,
faq_info_title text NOT NULL,
faq_info_about text NOT NULL,
faq_info_parent int(10) unsigned default '0',
faq_info_class int(3) unsigned default '0',
faq_info_order tinyint(3) unsigned NOT NULL default '0',
faq_info_icon varchar(255) NOT NULL,
PRIMARY KEY (faq_info_id)
) TYPE=MyISAM;

View File

@ -0,0 +1,117 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <EFBFBD>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/faqs_template.php,v $
| $Revision: 1.1 $
| $Date: 2009-11-09 12:57:34 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
if(!defined("USER_WIDTH"))
{
define("USER_WIDTH","width:97%");
}
// FAQ - NEW LOOK (all you need is here) -------------------------------------------------------------
$FAQ_START = "<div class='faq-start'>\n";
$FAQ_END = "<div class='faq-submit-question'>{FAQ_SUBMIT_QUESTION}</div>
<div class='faq-search'>{FAQ_SEARCH}</div>
</div>";
$FAQ_LISTALL_START = "<div><h2 class='faq-listall-category'>{FAQ_CATEGORY}</h2><ul class='faq-listall-container'>\n";
$FAQ_LISTALL_LOOP = "<li class='faq-listall-loop'>{FAQ_QUESTION=expand}</li>\n";
$FAQ_LISTALL_END = "</ul></div>\n";
// FAQ - CLASSIC LOOK BELOW #####################################################
// FAQ - PARENT LIST ---------------------------------------------------------
$FAQ_CAT_START = "
<table class='fborder' style='".USER_WIDTH."'>
<tr>
<td colspan='2' style='text-align:center; width:55%' class='fcaption'>".FAQLAN_41."</td>
<td class='fcaption' style='width:20%;text-align:center'>".FAQLAN_42."</td>
</tr>";
$FAQ_CAT_PARENT = "
<tr>
<td colspan='3' style='width:55%' class='forumheader'>
{FAQ_CATEGORY}
<span class='smalltext'>&nbsp;&nbsp;&nbsp;{FAQ_CAT_DIZ}</span>
</td>
</tr>";
$FAQ_CAT_CHILD = "
<tr>
<td class='forumheader3' style='width:30px'>{FAQ_ICON}</td>
<td class='forumheader2' style='width:95%'>{FAQ_CATLINK}
<br /><span class='smalltext'>{FAQ_CAT_DIZ}</span></td>
<td style='width:100px; text-align:center' class='forumheader2'>
{FAQ_COUNT}
</td>
</tr>";
$FAQ_CAT_END = "</table></div></div>";
// FAQ - LIST ---------------------------------------------------------
$FAQ_LIST_START = "
<table class='fborder' style='".USER_WIDTH."'> ";
$FAQ_LIST_LOOP .= "
<tr>
<td class='forumheader3' style='width:30px;vertical-align:top'>{FAQ_ICON}</td>
<td class='forumheader3'>&nbsp;{FAQ_QUESTION_LINK}</td>
</tr>";
$FAQ_LIST_END = "</table>";
// FAQ - VIEW ----------------------------------------------------------------
// FAQ - VIEW
$FAQ_VIEW_TEMPLATE =
"
<table class='fborder' style='margin-left:auto;margin-right:auto;padding:0px;".USER_WIDTH.";' >
<tr>
<td class='forumheader3' style='vertical-align:top;width:30px'>
<img src='".e_PLUGIN."faq/images/q.png' alt='' />
</td>
<td class='forumheader3' style='vertical-align:top'>
{FAQ_QUESTION}
</td>
</tr>
<tr>
<td class='forumheader3' style='width:30px;vertical-align:top'>
<img src='".e_PLUGIN."faq/images/a.png' alt='' />
</td>
<td class='forumheader3'>
<div class='faq_answer'>{FAQ_ANSWER}</div>
</td>
</tr>
</table>
<div style='text-align:right; width:100%'>
{FAQ_EDIT}
&nbsp;&nbsp;</div>";
?>

View File

@ -0,0 +1,76 @@
<?php
define(FAQ_ADLAN_22, "Category deleted.");
define(FAQ_ADLAN_23, "Please confirm you wish to delete this FAQ Item ");
define(FAQ_ADLAN_24, "once deleted it cannot be retrieved.");
define(FAQ_ADLAN_25, "Cancel");
define(FAQ_ADLAN_26, "Confirm Delete");
define(FAQ_ADLAN_27, "Confirm Delete Category");
define(FAQ_ADLAN_28, "Delete cancelled.");
define(FAQ_ADLAN_29, "FAQ entry updated");
define(FAQ_ADLAN_30, "You left a required field blank.");
define(FAQ_ADLAN_31, "New SubCategory created.");
define(FAQ_ADLAN_32, "New FAQ item created and entered into database.");
define(FAQ_ADLAN_33, "FAQ updated in database.");
define(FAQ_ADLAN_34, "Please select Category to edit/update: ");
define(FAQ_ADLAN_35, "No Categories - please create new Category to continue");
define(FAQ_ADLAN_36, "Edit Entries");
define(FAQ_ADLAN_37, "Edit Category Info.");
define(FAQ_ADLAN_38, "Create New FAQ");
define(FAQ_ADLAN_39, "Category Title: ");
define(FAQ_ADLAN_40, "Category Description: ");
define(FAQ_ADLAN_41, "Update FAQ");
define(FAQ_ADLAN_42, "Create New Category");
define(FAQ_ADLAN_43, "SubCategory");
define(FAQ_ADLAN_44, "SubCategory: ");
define(FAQ_ADLAN_45, "Edit");
define(FAQ_ADLAN_46, "Create New SubCategory: ");
define(FAQ_ADLAN_47, "Edit subCategory");
define(FAQ_ADLAN_48, "Create New SubCategory");
define(FAQ_ADLAN_49, "Previous FAQ entries: ");
define(FAQ_ADLAN_50, "Delete");
define(FAQ_ADLAN_51, "FAQ Question: ");
define(FAQ_ADLAN_52, "Allow Comments?: ");
define(FAQ_ADLAN_53, "Update FAQ Item ");
define(FAQ_ADLAN_54, "Submit FAQ Item");
define(FAQ_ADLAN_55, "Answers,");
define(FAQ_ADLAN_56, "SubCategory updated");
define(FAQ_ADLAN_57, "Create Category");
define(FAQ_ADLAN_58, "New Category created and placed in the database");
define(FAQ_ADLAN_59, "Fill Category");
define(FAQ_ADLAN_60, "FAQ Answer:");
define(FAQ_ADLAN_61, "Adjust subCategory:");
define(FAQ_ADLAN_62, "Checked");
define(FAQ_ADLAN_63, "by members only");
define(FAQ_ADLAN_64, "by administrators only");
define(FAQ_ADLAN_65, "by users in ");
define(FAQ_ADLAN_66, "Edit Category");
define(FAQ_ADLAN_67, "FAQ Sub-Category Deleted ");
define(FAQ_ADLAN_68, "FAQ Category Deleted ");
define(FAQ_ADLAN_69, "Confirm");
define(FAQ_ADLAN_70, "Search");
define(FAQ_ADLAN_71, "Info");
define(FAQ_ADLAN_72, "Update Category");
define(FAQ_ADLAN_73, "Visible to:");
define(FAQ_ADLAN_74, "Entry Deleted");
define(FAQ_ADLAN_75, "No FAQ Category Yet");
define(FAQ_ADLAN_76, "FAQ Categories");
define(FAQ_ADLAN_77, "No Category");
define(FAQ_ADLAN_78, "Category");
define(FAQ_ADLAN_79, "Category Parent");
define(FAQ_ADLAN_80, "Total");
define(FAQ_ADLAN_81, "Actions");
define(FAQ_ADLAN_82, "Add");
define(FAQ_ADLAN_83, "an FAQ");
define(FAQ_ADLAN_84, "Back to Categories");
define(FAQ_ADLAN_85, "New FAQ created and entered into database.");
define(FAQ_ADLAN_86, "There are no categories yet.");
define(FAQ_ADLAN_87, "Please create some first.");
define(FAQ_ADLAN_88, "FAQ");
define(FAQ_ADLAN_89, "Order");
define(FAQ_ADLAN_90, "Options");
define(FAQ_ADLAN_91, "Move up");
define(FAQ_ADLAN_92, "Move down");
?>

View File

@ -0,0 +1,66 @@
<?php
define(FAQLAN_FAQ, "FAQ");
define(FAQLAN_0, "No FAQ yet, please check back soon.");
define(FAQLAN_1, "Please click to go to the FAQ");
define(FAQLAN_2, "Please choose which FAQ you wish to see");
define(FAQLAN_3, "on");
define(FAQLAN_4, "January");
define(FAQLAN_5, "February");
define(FAQLAN_6, "March");
define(FAQLAN_7, "April");
define(FAQLAN_8, "May");
define(FAQLAN_9, "June");
define(FAQLAN_10, "July");
define(FAQLAN_11, "August");
define(FAQLAN_12, "September");
define(FAQLAN_13, "October");
define(FAQLAN_14, "November");
define(FAQLAN_15, "December");
define(FAQLAN_16, "You are currently not allowed to PM ");
define(FAQLAN_17, "Add Comment");
define(FAQLAN_18, "Back to FAQ");
define(FAQLAN_19, "View comment.");
define(FAQLAN_20, "Add comment.");
define(FAQLAN_21, "Back to Top");
define(FAQLAN_22, "Answers: ");
define(FAQLAN_23, "FAQ (Frequently Asked Questions) :: ");
define(FAQLAN_24, "Back to FAQ list ");
define(FAQLAN_25, "Not allowed");
define(FAQLAN_26, "Only registered users can use this feature");
define(FAQLAN_27, "Search for ");
define(FAQLAN_28, "Search");
define(FAQLAN_29, "Search FAQ");
define(FAQLAN_30, "[blocked by admin]");
define(FAQLAN_31, "Unblock");
define(FAQLAN_32, "Block");
define(FAQLAN_33, "Delete");
define(FAQLAN_34, "Info");
define(FAQLAN_35, "Comment ...");
define(FAQLAN_37, "Login Name: ");
define(FAQLAN_38, "Comment");
define(FAQLAN_39, "Submit comment");
define(FAQLAN_40, "Shortcut tags allowed: [b] [i] [u] [img] [center] [link]<br />use [link=link text] link url [/link] for links<br />Line breaks (&lt;br /&gt;) are auto added.");
define(FAQLAN_41, "FAQ Categories");
define(FAQLAN_42, "Total");
define(FAQLAN_43, "Edit");
define(FAQLAN_44, "Comments");
define(FAQLAN_45, "moderate comments");
define(FAQLAN_46, "Back to Categories");
define(FAQLAN_47, "Submit a Question");
define(FAQLAN_48, "Options");
define(FAQLAN_49, "Add");
define(FAQLAN_50, "an FAQ");
define(FAQLAN_51, "Category");
define(FAQLAN_52, "Match found in faq question");
define(FAQLAN_53, "Match found in faq answer");
define(FAQLAN_54, "No matches.");
define(FAQLAN_55, "Question");
define(FAQLAN_56, "Answer");
define(FAQLAN_57, "Found in");
define(FAQLAN_58, "FAQ Posted on");
define(FAQ_ADLAN_75, "No FAQ Category Yet");
?>

View File

@ -0,0 +1,32 @@
<?php
define(SLAN_0, "No matches.");//98
define(SLAN_1, "News Items");//99
define(SLAN_2, "Comments");//100
define(SLAN_3, "Articles");//101
define(SLAN_4, "Chatbox");//102
define(SLAN_5, "Links");//103
define(SLAN_6, "Forum");//104
define(SLAN_7, "Reviews");//190
define(SLAN_8, "Content");
define(SLAN_9, "Registered members");//140
define(SLAN_10, "Frequent Asked Questions");
define(SLAN_11, "All categories");
define(SLAN_12, "Search for ");
define(SLAN_13, "News");
define(SLAN_14, "Comments");
define(SLAN_15, "Articles");
define(SLAN_16, "Reviews");
define(SLAN_17, "Chatbox");
define(SLAN_18, "Links");
define(SLAN_19, "Forum");
define(SLAN_20, "Users");
define(SLAN_21, "FAQ");
define(SLAN_22, "Event Calendar");
define(SLAN_23, "Search");//180
define(SLAN_24, "Search ");
define(SLAN_25, "Searching ");
define(SLAN_26, " :: matches: ");
?>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: plugin.xml,v 1.1 2009-11-09 12:57:34 e107coders Exp $ -->
<e107Plugin name="FAQs" version="1.0" compatibility="0.8" installRequired="true">
<author name="e107 Inc" url="http://www.e107.org" email="security@e107.org" />
<description>Based on the original FAQ plugin by Cameron of e107 Inc.</description>
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
<category>content</category>
<adminLinks>
<link url='admin_config.php' description='Configure FAQs' icon='images/icon_32.png' iconSmall='images/icon_16.png' primary='true' >Facebook Connect</link>
</adminLinks>
<siteLinks>
<link url='{e_PLUGIN}faqs/faqs.php' description='FAQs' icon='images/icon_32.png' iconSmall='images/icon_16.png'>FAQs</link>
</siteLinks>
<pluginPrefs>
<pref name="add_faq">255</pref>
<pref name="submit_question">255</pref>
<pref name="classic_look">0</pref>
</pluginPrefs>
</e107Plugin>