Jump to content

Recommended Posts

Ok for some reason it appears that you can't use classes/functions after including a file...

 

A lot of code but just look at the comments...

 

<?php
session_start();

require_once('functions.swr3');
require_once('config.swr3');
require_once('classes/class_database.swr3');
require_once('classes/class_member.swr3');

$swr3->database = new database;
$swr3->member = new member;

$swr3->database->connect();

// If I try doing a simple num rows here it would work, e.g. :
// $swr3->database->simple_num_rows('members');
// $database->output->member_count = $swr3->database->output;
// print $database->output->member_count;
// That would work fine...

$swr3->member->is_logged_in();
$member->output->is_logged_in = $swr3->member->output;

$swr3->member->is_supermoderator();
$member->output->is_supermoderator = $swr3->member->output;

$swr3->member->is_administrator();
$member->output->is_administrator = $swr3->member->output;

if(SYSTEM_OFFLINE == 1) {
    if($member->output->is_logged_in !== 1 || $member->output->is_supermoderator !== 1 || $member->output->is_administrator !== 1) {
	header('Location: offline.swr3');
}
}

if(SYSTEM_SHOW_PHP_ERRORS == 1) {
    error_reporting(E_ALL);
}

if($member->output->is_logged_in == 1) {
        // Ignore these comments and go on down to the next comment.
//$swr3->member->last_action();
//$swr3->member->current_page('viewing the '.$html->output->page_title.'');
}

switch($_GET['act']) {
    case 'main';
main();
break;

    case 'members';
members_and_groups();
break;

    case 'forums';
cats_and_forums();
break;

    case 'stats';
stats();
break;

    case 'logs';
logs();
break;

    case 'settings';
settings_and_tools();
break;

    default:
main();
break;
}

// All my functions here go here... I missed a few out, just skip on down to the next comment.

<?php
}
function cats_and_forums() {
    $pagetitle = 'ACP - Forums & Categories';
    include_once('inc/header.swr3');
    echo '<div id="breadcrumbs"><p class="breadcrumbs"><a href="index.swr3" class="forum_title_a" title="Go to the Homepage.">'.SITE_TITLE.'</a> > ACP > Forums & Categories</p></div>';
    echo '<div class="clearfix"><!--No Content--></div>';
?>
    <div class="leftcolumn">
    <?php
if($_GET['do'] == 'createcat') {
            // And the next line is my problem...
            // The error I get is call to a member function on a non object.
            $swr3->database->simple_num_rows('categories');
            $database->output->cat_count = $swr3->database->output;
            $next_cat = $database->output->cat_count + 1;
?>
        <div class="con_2_outer">

        <div class="con_2_title"><h1>Create a Category</h1></div>

            <div class="con_2_inner_nopad">

                    <form name="createcat" id="createcat" method="post" action="admin/createcat.swr3?nextcat=<?php echo $next_cat; ?>">

                        <div style="width:200px;height:34px;line-height:34px;text-align:center;background:#000000;float:left;"><h3>Category Name</h3></div>
     
                        <div style="width:456px;padding:6px;height:16px;background:#242424;float:left;border-top:4px solid #000000;border-bottom:2px solid #000000;border-right:4px solid #000000;">
                            <p class="content"><input type="text" id="catname" name="catname" class="fasttopictitle" tabindex="1" /></p>
                        </div>

                        <div style="width:200px;height:34px;line-height:34px;text-align:center;background:#000000;float:left;"><h3>Show Category</h3></div>
     
                        <div style="width:456px;padding:6px;height:16px;background:#242424;float:left;border-top:4px solid #000000;border-bottom:2px solid #000000;border-right:4px solid #000000;">
                            <p class="content"><input type="text" id="catname" name="catname" class="fasttopictitle" tabindex="1" /> (Yes or No)</p>
                        </div>

                        <div class="clearfix"></div>

                        <div style="width:672px;padding:6px 0px 6px 0px;background:#000000;text-align:center;" align="center">
                        <input type="submit" value="Create Category" class="submit" tabindex="3" />
                        </div>
    
                        <input type="hidden" id="sent" name="sent" value="sent" />

                    </form>

            </div>

        </div>

<?php
}
elseif($_GET['do'] == 'managecats') {
?>
        <div class="con_2_outer">

        <div class="con_2_title"><h1>Manage Categories</h1></div>

            <div class="con_2_inner">
                <p class="content"></p>
            </div>

        </div>
<?php
}
elseif($_GET['do'] == 'createforum') {
?>
        <div class="con_2_outer">

        <div class="con_2_title"><h1>Create a Forum</h1></div>

            <div class="con_2_inner">
                <p class="content"></p>
            </div>

        </div>
<?php
}
elseif($_GET['do'] == 'manageforums') {
?>
        <div class="con_2_outer">

        <div class="con_2_title"><h1>Manage Forums</h1></div>

            <div class="con_2_inner">
                <p class="content"></p>
            </div>

        </div>
<?php
}
else {
?>
        <div class="con_2_outer">

        <div class="con_2_title"><h1>...</h1></div>

            <div class="con_2_inner">
                <p class="content">Choose an option from the right.</p>
            </div>

        </div>
<?php
}
?>

    </div>

    <div class="rightcolumn">

        <div id="menu_outer">

            <div id="menu_inner">

                <div class="menu_title">ACP Sections</div>
                <div class="menu_item"><a href="admin.swr3" class="menu_item_a" title="">Main</a></div>
                <div class="menu_item"><a href="admin.swr3?act=members" class="menu_item_a" title="">Members & Groups</a></div>
                <div class="menu_item"><a href="admin.swr3?act=forums" class="menu_item_a" title="">Categories & Forums</a></div>
                <div class="menu_item"><a href="admin.swr3?act=stats" class="menu_item_a" title="">Statistics</a></div>
                <div class="menu_item"><a href="admin.swr3?act=logs" class="menu_item_a" title="">Logs</a></div>
                <div class="menu_item"><a href="admin.swr3?act=settings" class="menu_item_a" title="">Settings & Tools</a></div>
                <div class="menu_item"><a href="admin.swr3?act=bugs" class="menu_item_a" title=""></a></div>

			<div class="menu_title">Categories & Forums</div>
                <div class="menu_item"><a href="admin.swr3?act=forums&do=createcat" class="menu_item_a" title="">Create a Category</a></div>
                <div class="menu_item"><a href="admin.swr3?act=forums&do=managecats" class="menu_item_a" title="">Manage Categories</a></div>
                <div class="menu_item"><a href="admin.swr3?act=forums&do=createforum" class="menu_item_a" title="">Create a Forum</a></div>
                <div class="menu_item"><a href="admin.swr3?act=forums&do=manageforums" class="menu_item_a" title="">Manage Forums</a></div>

            </div>

        </div>

    </div>
<?php
}
?>

 

???

Link to comment
https://forums.phpfreaks.com/topic/73123-gah-what-the-hell/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.