Is this for D6 of D7?
Based on your query it looks like your putting a faq.php file in the admin directory. D6 methods instead of putting the entire thing inside a D7 module.
This is for D7. Trying to learn the D7 method for doing things and yes as I'm learning I started with what I know. Here's the full file for the admin page. It's just not being nice to me. Specifically it's just an FAQ Manager, didn't think it really needed an entire module all for itself but I'm probably wrong the way it looks that D7 is acting on this.
<?
define('BX_SECURITY_EXCEPTIONS', true);
$aBxSecurityExcepti alt= array(
'POST.body',
'REQUEST.body',
);
require_once( '../inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'prof.inc.php' );
bx_import('BxTemplFormView');
bx_import('BxDolEmailTemplates');
$logged['admin'] = member_auth( 1 );
$_page['css_name'] = 'faq.css';
check_logged();
if( !$demo_mode && 'add' == $_GET['action'] )
{
echo GetFaqForm();
}
elseif( !$demo_mode && 'addnew' == $_POST['action'])
{
if( 1 > strlen($_POST['title']) )
{
echo GetActionText( 'Please enter question' );
echo GetFaqForm( false, 0, true );
}
elseif( 1 > strlen($_POST['desc']) )
{
echo GetActionText( 'Please enter answer' );
echo GetFaqForm( false, 0, true );
}
else
{
if( db_res( "INSERT INTO `faq` SET `Title` = '" . $_POST['title'] . "', `Description` = '" . $_POST['desc'] . "';" ) )
{
echo GetActionText( 'question successfully added', 1);
echo GetFaqList();
}
else
{
echo GetActionText( 'action failed');
echo GetFaqList();
}
}
}
elseif( !$demo_mode && 'edit' == $_GET['action'])
{
echo GetFaqForm( true, $_GET['faqID'] );
}
elseif( !$demo_mode && 'update' == $_POST['action'] )
{
if( 1 > strlen($_POST['title']) )
{
echo GetActionText( 'Please enter Question' );
echo GetFaqForm( false, 0, true );
}
elseif( 1 > strlen($_POST['desc']) )
{
echo GetActionText( 'Please enter Answer' );
echo GetFaqForm( false, 0, true );
}
else
{
if( db_res( "UPDATE `faq` SET `Title` = '" . process_db_input($_POST['title']) . "', `Description` = '" . process_db_input($_POST['desc']) . "' WHERE `ID` = " . (int)$_POST['faqID'] . ";" ) )
{
echo GetActionText( 'question updated successfully', 1 );
echo GetFaqList();
}
else
{
echo GetActionText( 'action failed');
echo GetFaqList();
}
}
}
elseif( !$demo_mode && 'delete' == $_GET['action'] )
{
if( db_res( "DELETE FROM `faq` WHERE `ID` = " . (int)$_GET['faqID'] ) )
{
echo GetActionText( 'question deleted successfully', 1 );
echo GetFaqList();
}
else
{
echo GetActionText( 'action failed');
echo GetFaqList();
}
}
else
{
echo GetFaqList();
}
ContentBlockFoot();
BottomCode();
function GetFaqList()
{
global $site;
$faq_query = "SELECT `ID`, `Title`, `Description` FROM `faq` ORDER BY ID DESC";
$faq_res = db_res($faq_query);
$faq_count = db_arr("SELECT COUNT(ID) FROM `faq`");
$faq_count = $faq_count['0'];
$faqs_ alt= 10;
$ret = '';
$ret .= '<div class="faqAdd">';
$ret .= '<a href="' . $site['url_admin'] . 'faq.php?action=add">';
$ret .= 'Add New Question';
$ret .= '</a>';
$ret .= '</div>';
$j = 1;
while( $faq_arr = mysql_fetch_assoc($faq_res))
{
if( ($j%2) == 0 )
{
$add = 'style="background-color:#E6E6E6;"';
}
else
{
$add = '';
}
$ret .= '<div class="faq_block" ' . $add . '>';
$ret .= '<div class="faq_title">';
$ret .= process_line_output($faq_arr['Title']);
$ret .= '</div>';
$ret .= '<div>';
$ret .= process_html_output($faq_arr['Description']);
$ret .= '</div>';
$ret .= '<div style="text-align:right;">';
$ret .= '<a href="' . $site['url_admin'] . 'faq.php?faqID=' . $faq_arr['ID'] . '&action=edit">';
$ret .= 'Edit';
$ret .= '</a>';
$ret .= ' || ';
$ret .= '<a href="' . $site['url_admin'] . 'faq.php?faqID=' . $faq_arr['ID'] . '&action=delete">';
$ret .= 'Delete';
$ret .= '</a>';
$ret .= '</div>';
$ret .= '</div>';
$j++;
}
return $ret;
}
function GetFaqForm( $edit = false, $faqID = 0, $use_post_data = false )
{
global $site;
$ret = '';
if( $edit )
{
$faq_arr = db_arr( "SELECT `ID`, `Title`, `Description` FROM `faq` WHERE `ID` = '" . (int)$faqID . "';");
$value_title = htmlspecialchars($faq_arr['Title']);
$value_desc = htmlspecialchars($faq_arr['Description']);
}
elseif( $use_post_data )
{
$value_title = htmlspecialchars( process_pass_data($_POST['title']) );
$value_desc = htmlspecialchars( process_pass_data($_POST['desc']) );
}
else
{
$value_title = '';
$value_desc = '';
}
$ret .= '<div class="faq_block">';
$ret .= '<form action="' . $site['url_admin'] . 'faq.php" method="post">';
$ret .= '<table cellpadding="0" cellspacing="1" border="0" width="70%" align="center">';
$ret .= '<tr>';
$ret .= '<td>';
$ret .= 'Question';
$ret .= '</td>';
$ret .= '<td>';
$ret .= '<input type="text" class="faq_text_input" name="title" value="' . $value_title . '" />';
$ret .= '</td>';
$ret .= '</tr>';
$ret .= '<tr>';
$ret .= '<td>';
$ret .= 'Answer';
$ret .= '</td>';
$ret .= '<td>';
$ret .= '<textarea name="desc" class="faq_textarea">' . $value_desc . '</textarea>';
$ret .= '</td>';
$ret .= '</tr>';
$ret .= '<tr>';
$ret .= '<td colspan="2" align="center">';
if( $edit )
{
$ret .= '<input type="hidden" name="faqID" value="' . $faqID . '">';
$ret .= '<input type="hidden" name="action" value="update">';
}
else
{
$ret .= '<input type="hidden" name="action" value="addnew">';
}
$ret .= '<input type="submit" value="Save" />';
$ret .= '</td>';
$ret .= '</tr>';
$ret .= '<tr>';
$ret .= '<td>';
$ret .= '</td>';
$ret .= '<td>';
$ret .= '<div style="position:relative; text-align:left; font-weight:bold;">';
$ret .= '<a href="' . $site['url_admin'] . 'faq.php">Back to FAQ list</a>';
$ret .= '</div>';
$ret .= '</td>';
$ret .= '</tr>';
$ret .= '</table>';
$ret .= '';
$ret .= '</div>';
return $ret;
}
function GetActionText( $text, $success = '')
{
global $site;
$ret = '';
if( $success )
{
$ret .= '<div style="position:relative; border:1px solid green; margin-bottom:20px; font-weight:bold; text-align:center; color:green; padding:3px;">';
//$ret .= '<div style="font-weight:bold; text-align:center; color:green;">';
$ret .= $text;
//$ret .= '</div>';
$ret .= '</div>';
/*
$ret .= '<div style="position:relative; text-align:center;">';
$ret .= '<a href="' . $site['url_admin'] . 'faq.php">Back to FAQ list</a>';
$ret .= '</div>';
*/
}
else
{
$ret .= '<div style="position:relative; border:1px solid red; margin-bottom:20px; font-weight:bold; text-align:center; color:red; padding:3px;">';
$ret .= '<div style="font-weight:bold; text-align:center; color:red;">';
$ret .= $text;
$ret .= '</div>';
$ret .= '</div>';
/* $ret .= '<div style="position:relative; text-align:center;">';
$ret .= '<a href="' . $site['url_admin'] . 'faq.php">Back to FAQ list</a>';
$ret .= '</div>';
*/
}
return $ret;
}
?>
The system works, I'm just not figuring out the part that gets the full Admin Page to resolve like it should. But yeah, I'm using what I learned in D6 for this. Big mistake I'm guessing.