2009-11-09 12:57:34 +00:00
< ? php
/*
2009-11-17 10:46:35 +00:00
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright ( C ) 2008 - 2009 e107 Inc ( e107 . org )
2009-11-17 10:46:35 +00:00
* 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 . php , v $
2010-02-10 18:18:01 +00:00
* $Revision $
* $Date $
* $Author $
2009-11-09 12:57:34 +00:00
*/
2009-11-17 10:46:35 +00:00
2013-03-07 14:56:37 +02:00
// SUBJECT OF REMOVAL
2009-11-09 12:57:34 +00:00
require_once ( " ../../class2.php " );
2013-03-07 14:56:37 +02:00
$url = e107 :: getUrl () -> create ( 'faqs/list/all' , false , 'full=1&noencode=1' );
header ( 'Location: ' . $url );
exit ;
2013-02-22 21:31:16 -08:00
include_lan ( e_PLUGIN . " faqs/languages/ " . e_LANGUAGE . " / " . e_LANGUAGE . " _front.php " );
2009-11-09 12:57:34 +00:00
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 " );
2012-12-08 20:22:05 +01:00
if ( ! vartrue ( $FAQ_VIEW_TEMPLATE ))
2009-11-09 12:57:34 +00:00
{
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 ;
2012-12-08 15:52:40 +01:00
if ( ! vartrue ( $_GET [ 'elan' ]))
2009-11-09 12:57:34 +00:00
{
$qs = explode ( " . " , e_QUERY );
$action = $qs [ 0 ];
$id = $qs [ 1 ];
$idx = $qs [ 2 ];
}
2012-12-08 15:52:40 +01:00
$from = ( vartrue ( $from ) ? $from : 0 );
2009-11-09 12:57:34 +00:00
$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 " );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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' ]))
{
2011-07-24 20:57:48 +00:00
$ftmp = $faq -> show_existing_parents ( $action , $sub_action , $id , $from , $amount );
2009-12-12 10:30:33 +00:00
$caption = FAQLAN_41 ;
2009-11-09 12:57:34 +00:00
}
else
{
2011-07-24 20:57:48 +00:00
$ftmp = $faq -> view_all ();
$caption = FAQLAN_FAQ ;
2009-11-09 12:57:34 +00:00
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
if ( vartrue ( $faqpref [ 'faq_title' ]))
{
define ( " e_PAGETITLE " , $faqpref [ 'faq_title' ]);
}
else
{
define ( " e_PAGETITLE " , FAQLAN_23 );
}
2011-07-24 20:57:48 +00:00
2009-11-09 12:57:34 +00:00
require_once ( HEADERF );
2011-07-24 20:57:48 +00:00
$ns -> tablerender ( $caption , $ftmp [ 'text' ]);
2009-11-09 12:57:34 +00:00
}
if ( $action == " cat " && $idx )
{
2011-07-24 20:57:48 +00:00
$ftmp = $faq -> view_faq ( $idx ) ;
define ( " e_PAGETITLE " , FAQLAN_FAQ . " - " . $ftmp [ 'title' ]);
2009-11-09 12:57:34 +00:00
require_once ( HEADERF );
2011-07-24 20:57:48 +00:00
$ns -> tablerender ( $ftmp [ 'caption' ], $ftmp [ 'text' ]);
2009-11-09 12:57:34 +00:00
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
if ( $action == " cat " )
{
2011-07-24 20:57:48 +00:00
$ftmp = $faq -> view_cat_list ( $action , $id );
2009-12-02 22:34:58 +00:00
2011-07-24 20:57:48 +00:00
define ( " e_PAGETITLE " , strip_tags ( $ftmp [ 'title' ] . $ftmp [ 'caption' ]));
2009-11-09 12:57:34 +00:00
require_once ( HEADERF );
2011-07-24 20:57:48 +00:00
$ns -> tablerender ( $ftmp [ 'caption' ], $ftmp [ 'text' ]);
2009-11-09 12:57:34 +00:00
}
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 ();
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
function __construct ()
{
2012-11-02 01:50:28 +00:00
$sc = e107 :: getScBatch ( 'faqs' , TRUE );
2009-11-09 12:57:34 +00:00
$this -> pref = e107 :: getPlugConfig ( 'faqs' ) -> getPref ();
2012-11-02 01:50:28 +00:00
$sc -> pref = $this -> pref ;
// setScVar('faqs_shortcodes', 'pref', $this->pref);
2009-12-02 22:34:58 +00:00
}
2009-11-09 12:57:34 +00:00
function view_all () // new funtion to render all FAQs
{
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
2011-07-24 20:57:48 +00:00
$ret = array ();
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
global $FAQ_START , $FAQ_END , $FAQ_LISTALL_START , $FAQ_LISTALL_LOOP , $FAQ_LISTALL_END ;
2009-12-02 22:34:58 +00:00
2012-11-02 00:23:59 +00:00
//require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
2009-12-02 22:34:58 +00:00
2010-02-09 01:33:41 +00:00
$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 " ;
2009-11-09 12:57:34 +00:00
$sql -> db_Select_gen ( $query );
2009-12-02 22:34:58 +00:00
$text = $tp -> parseTemplate ( $FAQ_START , true );
2009-11-09 12:57:34 +00:00
$prevcat = " " ;
2012-11-02 00:23:59 +00:00
$sc = e107 :: getScBatch ( 'faqs' , TRUE );
2013-02-22 21:31:16 -08:00
// var_dump($sc);
2012-11-02 00:23:59 +00:00
2009-11-09 12:57:34 +00:00
while ( $rw = $sql -> db_Fetch ())
{
2012-11-02 00:23:59 +00:00
$sc -> setVars ( $rw );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
if ( $rw [ 'faq_info_order' ] != $prevcat )
{
if ( $prevcat != '' )
{
2013-05-31 18:40:56 -07:00
$text .= $tp -> parseTemplate ( $FAQ_LISTALL_END , true , $sc );
2009-11-09 12:57:34 +00:00
}
$text .= " \n \n <!-- FAQ Start " . $rw [ 'faq_info_order' ] . " --> \n \n " ;
2013-05-31 18:40:56 -07:00
$text .= $tp -> parseTemplate ( $FAQ_LISTALL_START , true , $sc );
2009-12-02 22:34:58 +00:00
$start = TRUE ;
2009-11-09 12:57:34 +00:00
}
2009-12-02 22:34:58 +00:00
2013-05-31 18:40:56 -07:00
$text .= $tp -> parseTemplate ( $FAQ_LISTALL_LOOP , true , $sc );
2009-11-09 12:57:34 +00:00
$prevcat = $rw [ 'faq_info_order' ];
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
}
2013-05-31 18:40:56 -07:00
$text .= $tp -> parseTemplate ( $FAQ_LISTALL_END , true , $sc );
$text .= $tp -> parseTemplate ( $FAQ_END , true , $sc );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$ret [ 'title' ] = FAQLAN_FAQ ;
$ret [ 'text' ] = $text ;
2012-12-08 15:52:40 +01:00
$ret [ 'caption' ] = vartrue ( $caption );
2011-07-24 20:57:48 +00:00
2009-12-02 22:34:58 +00:00
return $ret ;
2009-11-09 12:57:34 +00:00
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
// ------------- Everything below here is kept for backwards-compatability 'Classic Look' ------------
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
function view_cat_list ( $action , $id )
{
global $ns , $row , $FAQ_LIST_START , $FAQ_LIST_LOOP , $FAQ_LIST_END ;
2009-12-02 22:34:58 +00:00
2012-11-02 00:23:59 +00:00
$tp = e107 :: getParser ();
$sql = e107 :: getDb ();
$sc = e107 :: getScBatch ( 'faqs' , TRUE );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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 );
2012-11-02 00:23:59 +00:00
$sc -> setVars ( $row );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text = $tp -> parseTemplate ( $FAQ_LIST_START , true );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
while ( $rw = $sql -> db_Fetch ())
{
2012-11-02 00:23:59 +00:00
$sc -> setVars ( $rw );
2009-11-09 12:57:34 +00:00
$text .= $tp -> parseTemplate ( $FAQ_LIST_LOOP , true );
$caption = " Category: <b> " . $rw [ 'faq_info_title' ] . " </b> " ;
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text .= $tp -> parseTemplate ( $FAQ_LIST_END , true );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$ret [ 'title' ] = FAQLAN_FAQ . " - " . $category_title ;
$ret [ 'text' ] = $text . $this -> faq_footer ( $id );
$ret [ 'caption' ] = $caption ;
return $ret ;
}
// =============================================================================
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
function show_existing_parents ( $action , $sub_action , $id , $from , $amount )
{
$tp = e107 :: getParser ();
$sql = e107 :: getDb ();
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
// ##### Display scrolling list of existing FAQ items ---------------------------------------------------------------------------------------------------------
global $FAQ_CAT_START , $FAQ_CAT_PARENT , $FAQ_CAT_CHILD , $FAQ_CAT_END ;
2009-12-02 22:34:58 +00:00
2012-11-02 00:23:59 +00:00
// require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
$sc = e107 :: getScBatch ( 'faqs' , TRUE );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text = " <div style='text-align:center'>
< div style = 'text-align:center' > " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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 " ; //
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text .= $FAQ_CAT_START ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$sql -> db_Select_gen ( $qry );
while ( $row = $sql -> db_Fetch ())
{
2012-11-02 00:23:59 +00:00
$sc -> setVars ( $row );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
if ( $row [ 'faq_info_parent' ] == '0' ) //
{
$text .= $tp -> parseTemplate ( $FAQ_CAT_PARENT , true );
}
else
{
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
if ( ! $row [ 'f_count' ] && ! $row [ 'f_subcount' ])
{
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text .= $tp -> parseTemplate ( $FAQ_CAT_CHILD , true );
}
else
{
$text .= $tp -> parseTemplate ( $FAQ_CAT_CHILD , true );
}
}
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text .= $FAQ_CAT_END ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$ret [ 'text' ] = $text . $this -> faq_footer ();
return $ret ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
function view_faq ( $idx )
{
global $ns , $row , $sql , $aj , $pref , $cobj , $id , $tp , $FAQ_VIEW_TEMPLATE ;
2009-12-02 22:34:58 +00:00
2012-11-02 00:23:59 +00:00
//require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
$sc = e107 :: getScBatch ( 'faqs' , TRUE );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$sql -> db_Select ( " faqs " , " * " , " faq_id=' $idx ' LIMIT 1 " );
$row = $sql -> db_Fetch ();
2012-11-02 00:23:59 +00:00
$sc -> setVars ( $row );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$caption = " FAQ # " . $row [ 'faq_id' ];
$text = $tp -> parseTemplate ( $FAQ_VIEW_TEMPLATE , true );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
// $text = $tp->toHTML($text, TRUE);
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$ret [ 'text' ] = $text ;
$ret [ 'caption' ] = $caption ;
$ret [ 'title' ] = $row [ 'faq_question' ];
$ret [ 'comments' ] = $text ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
return $ret ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$subject = ( ! $subject ? $aj -> formtpa ( $faq_question ) : $subject );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
if ( check_class ( $row [ 'faq_comment' ]))
{
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
function faq_footer ( $id = '' )
{
global $faqpref , $timing_start , $tp , $cust_footer , $CUSTOMPAGES , $CUSTOMHEADER , $CUSTOMHEADER ;
$text_menu .= " <div style='text-align:center;' ><br />
2009-11-20 05:01:51 +00:00
& nbsp ; & nbsp ;[ & nbsp ; < a href = \ " faqs.php?main \" >Back to Categories</a> ] " ;
2009-11-09 12:57:34 +00:00
if ( check_class ( $faqpref [ 'add_faq' ])){
2009-11-20 05:01:51 +00:00
$text_menu .= " [ <a href= \" faqs.php?new. $id\ " > Submit a Question </ a >& nbsp ;] " ;
2009-11-09 12:57:34 +00:00
}
$text_menu .= " </div> " ;
2009-12-23 11:32:09 +00:00
$text_menu .= " <div style='text-align:center'><br /> " . $tp -> parseTemplate ( " { SEARCH=faqs} " ) . " </div> " ;
2009-11-09 12:57:34 +00:00
return $text_menu ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
// require_once (FOOTERF);
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
function add_faq ( $action , $id , $idx )
{
global $rs ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$tp = e107 :: getParser ();
$sql = e107 :: getDb ();
$ns = e107 :: getRender ();
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$userid = USERID ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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 ) . " ... " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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> " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
if ( $action == " edit " )
{
$sql -> db_Select ( " faqs " , " * " , " faq_id = ' $idx ' " );
$row = $sql -> db_Fetch ();
extract ( $row );
$data = $faq_answer ;
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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' > " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text .= ( is_numeric ( $id )) ? " Edit " : " Add " ;
$text .= " an FAQ</td></tr> " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text .= "
< tr >
< td class = 'forumheader3' style = \ " width:20% \" > " . FAQ_ADLAN_78 . " </td>
< td class = 'forumheader3' style = \ " width:80% \" > " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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 > " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$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 " );
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text .= " <br /></td></tr> " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
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 \" >
" ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
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 . " \" /> " ;
}
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
$text .= " <input type= \" hidden \" name= \" faq \" value= \" $faq\ " />
</ td >
</ tr >
</ table >
</ form > " ;
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
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 ());
2009-12-02 22:34:58 +00:00
2009-11-09 12:57:34 +00:00
}
}
?>