Example #1
0
//require_once ("../noparent.php");
$_TEMP_PERMIT = "_LEGAL_";
//a temp permission for the "are you logged in" gate (in prepend)
require_once "prepend.php";
require_once "common.php";
require_once "db_" . $_SESSION['_SITE_CONF']['DBMANAGER'] . ".php";
$_DB = new db_connect($_SESSION['_SITE_CONF']['DBEDITOR']);
require_once "state.php";
if (isset($_GET["init"])) {
    $_STATE = new STATE($_GET["init"]);
    //create a new state object with status=STATE::INIT
    if (isset($_GET["head"])) {
        $_STATE->heading = $_GET["head"];
    }
} else {
    $_STATE = STATE_pull();
    //'pull' the working state
}
$_STATE->fields["txtName"] = "";
$reload = FALSE;
$_STATE->msgGreet = "Please login:"******"";
switch ($_STATE->status) {
    case STATE::INIT:
        $reload = TRUE;
        //make sure other frames load after me
        $_STATE->status = STATE::ENTRY;
        break;
    case STATE::ENTRY:
        require_once "logging.php";
        if (entry_audit()) {
Example #2
0
                 button_send($SCION, $HTML);
                 echo $HTML;
                 $SCION->status = STATE::CHANGE;
                 break 2;
             case STATE::CHANGE:
                 if (isset($_GET["reset"])) {
                     $_STATE->goback(1);
                     //go back to log_list
                     break 3;
                 }
                 if (isset($_POST["actupd"])) {
                     update_activity($SCION);
                 } else {
                     new_hours($SCION);
                     //msgStatus='-' says to "reset", ie. goback(1), so set that state's totals:
                     $temp = STATE_pull($_STATE->thread, 1);
                     total_hours($temp);
                     //re-calculate for all projects
                     $temp->replace();
                 }
                 echo $SCION->msgStatus;
                 break 2;
             default:
                 throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): error");
         }
     }
     //while & switch
     $SCION->push();
     break 2;
 default:
     throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): Invalid state=" . $_STATE->status);
Example #3
0
function EX_pageEnd()
{
    //The standardized stuff at the end of the page:
    //A neg $goback = # of levels to pop; pos is the actual status to return to.
    global $_STATE;
    ?>
<div id="msgStatus_ID" class="status"><?php 
    echo $_STATE->msgStatus;
    ?>
</div>
<p>
<button type="button" onclick="top.reload_main();">&lt&lt Return to menu</button>
<?php 
    $state = STATE_pull();
    //the state before changes
    if ($state->status > $state->init) {
        ?>
<button type="button" onclick="window.location.assign('<?php 
        echo $_SESSION["IAm"];
        ?>
&goback')">
	&lt Goback</button>
<?php 
    }
    if ($_SESSION["_SITE_CONF"]["RUNLEVEL"] == 1) {
        ?>
<br><textarea id='msgDebug' cols='100' rows='1' ondblclick='this.rows=this.rows+10;'></textarea>
</p>
<table cellpadding=2>
<?php 
        echo "<tr><td align='right' valign='top'>Session: </td><td align='left'>";
        foreach ($_SESSION as $key => $value) {
            echo $key . ";";
        }
        echo "</td></tr>";
        echo "<tr><td align='right' valign='top'>Permits: </td>";
        echo "<td align='left'>";
        echo serialize($_SESSION["UserPermits"]);
        echo "</td></tr>";
        echo "<tr><td colspan='2' align='left'>_STATE:</td></tr>";
        $value = serialize(clone $_STATE);
        echo "<tr valign='top'><td></td><td align='left'>" . $value . "</td></tr>\n";
        foreach ($_SESSION["STATE"] as $name => $thread) {
            echo "<tr><td colspan='2' align='left'>_SESSION[STATE][" . $name . "]:</td></tr>";
            foreach ($thread as $key => $value) {
                echo "<tr valign='top'><td align='right'>" . $key . "</td><td align='left'>" . $value . "</td></tr>\n";
            }
        }
        ?>
</table>
<?php 
    }
    ?>
</body>
</html>
<?php 
}
 function state_gate(&$state)
 {
     if ($state->PREFSETgoback == "y") {
         return false;
     }
     //all done here
     //State Gate: (the while (1==1) allows a loop back through the switch using a 'break 1')
     while (1 == 1) {
         switch ($this->status) {
             case PREF_SET::PREF_INIT:
                 //All client interaction is via server_call which bypasses state maintenance in executive.php,
                 //hence, we must handle the state (fortunately, it's very simple):
                 $state->PREFSETgoback = "y";
                 $state->replace();
                 //put a new SSO on the state stack; we assume that we got here thru normal executive.php
                 //channels (ie. not via server_call) which will put yet another SSO on the stack; to get back
                 //to the SSO with PREFSETgoback="y", must now backup 2 entries:
                 $state->PREFSETgoback = "n";
                 $state->backup = -2;
                 //minus => goback 2 entries (positive => goback to status)
                 $state->push();
                 $state = STATE_pull();
                 $this->get_recs();
                 $this->status = PREF_SET::PREF_DISP;
                 break 2;
             case PREF_SET::PREF_DISP:
                 $this->pref_name = $_GET["who"];
                 $this->status = PREF_SET::PREF_CHANGE;
                 echo $this->display_back();
                 break 2;
             case PREF_SET::PREF_CHANGE:
                 if (isset($_GET["who"])) {
                     $this->status = PREF_SET::PREF_DISP;
                     break 1;
                 }
                 echo $this->new_pref();
                 break 2;
             default:
                 throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): PREF_SET error");
         }
     }
     //while & switch
     //End Main State Gate
     return true;
 }
Example #5
0
    $inifile = $_SESSION["_SITE_CONF"]["_EXTENSIONS"] . $_STATE->extension . "_conf.php";
    $_SESSION["_EXTENSION"] = array_merge($_SESSION["_EXTENSION"], parse_ini_file($inifile));
    $_STATE->heading = $_SESSION["_EXTENSION"]["title"];
    $_SESSION["IAm"] = $_SESSION["BUTLER"] . "?IAm=" . $_GET["IAm"];
    //for form action
} else {
    if (isset($_GET["quit"])) {
        unset($_SESSION["_EXTENSION"]);
        $_STATE = STATE_pull("_EXTENSION");
        $_STATE->cut();
        //remove the thread
        ob_clean();
        echo "@remove_ext('" . $_SESSION["BUTLER"] . "IAm=EN',true);\n";
        exit;
    } else {
        $_STATE = STATE_pull("_EXTENSION");
        //'pull' the working state
        if (isset($_GET["goback"])) {
            $_STATE = $_STATE->goback(2);
        } else {
            if (isset($_GET["servercall"]) || isset($_POST["servercall"])) {
                $EX_servercall = true;
                ob_clean();
                //server_call wants a clean buffer
            }
        }
    }
}
$EX_status = $_STATE->status;
//save for later
require_once $_SESSION["_SITE_CONF"]["_EXTENSIONS"] . $_SESSION["_EXTENSION"]["page"];
Example #6
0
 public function goback($levels)
 {
     //	$child = "";
     while ($levels > 0) {
         if (count($_SESSION["STATE"][$this->thread]) < 2) {
             break;
         }
         $junk = unserialize(array_pop($_SESSION["STATE"][$this->thread]));
         $pull = STATE_pull($this->thread);
         if ($junk->child != $pull->child) {
             $this->cleanup($junk->child);
         }
         --$levels;
     }
     return $pull;
 }
Example #7
0
 function __wakeup()
 {
     $this->state = STATE_pull("PROP_SET");
     $this->get_recs();
 }