Example #1
0
    public function __construct()
    {
        parent::__construct();

        $message_id = IsSetGet(DBMessage::MESSAGE_ID);
        if ($message_id === false)
        {
            throw new UserActionException(
                    "a message must be specified");
        }
        $user_id = IsSetGet(USERS_USERID);
        if ($user_id === false)
        {
            $user_id = BoydsnestSession::GetInstance()->get(USERS_USERID);
        }


        if ($user_id != BoydsnestSession::GetInstance()->get(USERS_USERID)
                && !BoydsnestSession::GetInstance()->get(USERS_ISMASTER))
        {
            throw new SecurityException(
                    "you must be the master to view other users messages");
        }


        $this->data = DBMessage::GetMessage($message_id);
        $this->data = $this->data[0];
        $this->data[DBMessage::MESSAGE] =
                DBMessage::GetMessageContent($message_id);
        $this->data[USERS_USERID] =
                $this->data[DBMessage::ORIGIN_ID];
    }
Example #2
0
    public function __construct()
    {
        $page_state = array();

        $page_state[USERS_USERID] = IsSetGet(USERS_USERID);
        $page_state[DBForum::POST_ID] = IsSetGet(DBForum::POST_ID);

        if (!$page_state[USERS_USERID] &&
            !$page_state[DBForum::POST_ID])
        {
            $page_state = false;
        }
        else if ($page_state[USERS_USERID] &&
                !$page_state[DBForum::POST_ID])
        {
            $page_state[DBForum::POST_ID] = DBForum::GetFirstRootIdOfForum(
                    BN_DATATYPE_USERPAGES,
                    $page_state[USERS_USERID]);
            if ($page_state[DBForum::POST_ID] == null)
            {
                throw new UserActionException(
                        "no pages were found with this user", null);
            }
        }
        else if (!$page_state[USERS_USERID] ||
                 !$page_state[DBForum::POST_ID])
        {
            $page_state = false;
        }

        if (is_array($page_state))
        {
            if (!is_numeric($page_state[USERS_USERID]))
            {
                throw new UserActionException(
                        "user id must be numeric", null);
            }
            if (!is_numeric($page_state[DBForum::POST_ID]))
            {
                throw new UserActionException(
                        "page id must be numeric", null);
            }
        }

        $this->state = $page_state;
    }
Example #3
0
    public function collect()
    {
        try
        {
            $this->user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
        }
        catch(Exception $e)
        {
            throw new UserActionException($e->getMessage());
        }

        // initial try to get the required data to do the action
        $this->start = IsSetGet('start');
        $this->amount = IsSetGet('amount');

        // if any of them are false, then attempt post data
        if ($this->start === false || $this->amount === false)
        {
            $this->start = IsSetPost('start');
            $this->amount = IsSetPost('amount');
        }

        // if still any are false, do default values
        if ($this->start === false || $this->amount === false)
        {
            $this->start = 0;
            $this->amount = 40;
        }

        // now check to make sure that all of them are numeric
        if (!is_numeric($this->start))
        {
            throw new UserActionException('start must be numeric');
        }
        if (!is_numeric($this->amount))
        {
            throw new UserActionException('amount must be numeric');
        }
    }
 public function collect()
 {
     $manual_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMANUALMODEL);
     if (!$manual_factory)
     {
         throw new UserActionException("Cannot Load Usermanual DB");
     }
     $page_id = IsSetGet(USERMANUAL_PAGEID);
     if (!$page_id)
     {
         $page_id = IsSetPost(USERMANUAL_PAGEID);
     }
     if (!$page_id)
     {
         $this->data = $manual_factory->select_first(array(
                 array(
                     DBFactory::ID_ESCAPE=> false,
                     DBFactory::ID_KEY   => USERMANUAL_RANK,
                     DBFactory::ID_SIGN  => "=",
                     DBFactory::ID_VAL   => "(SELECT min(".USERMANUAL_RANK.") FROM ".USERMANUAL.")"
                 )
             ));
         if (!$this->data)
         {
             throw new UserActionException("No Usermanual Pages Found");
         }
     }
     else
     {
         $this->data = $manual_factory->select_first($page_id);
         if (!$this->data)
         {
             throw new UserActionException(
                     "Cannot Find Usermanual Page With Requested ID");
         }
     }
 }
Example #5
0
<?php

require_once '../../Boydsnest.php';
require_once FCORE_FILE_DBFACTORY;

header("Content-type: text/css");

$name = IsSetGet("name", "default");

FCore::$LOG_TO_HTML = false;

$scheme = FCore::LoadDBFactory(BN_DBFACTORY_SCHEMEMODEL);
$scheme_instance = $scheme->select_first(
        array(
            array(DBFactory::ID_KEY => SCHEME_SCHEMENAME,
                  DBFactory::ID_SIGN => "=",
                  DBFactory::ID_VAL => $name)
        ));

if ($scheme_instance == null){
    $scheme_instance = $scheme->select_first(
        array(
            array(DBFactory::ID_KEY => SCHEME_SCHEMENAME,
                  DBFactory::ID_SIGN => "=",
                  DBFactory::ID_VAL => "default"
            )
        ));

    if ($scheme_instance == null){
        echo "Error: no data found in database";
        return;
Example #6
0
                        $e->getFile(), $e->getLine());
            }
            $pagelist = $e->getMessage();
        }

        $page = $this->ready_master($request);
        $page->consume_string(
                "content",
                $this->load_local_php_view(
                        "views/infolist",
                        array(
                            'pagelist'  => $pagelist,
                            'message'   => $message,
                        )));
        return $page->get_page();
    }
    // </editor-fold>
}

try
{
    $this_page = new usermanual();
    echo $this_page->init_request(IsSetGet(ACTION, ACTION_DEFAULT));
}
catch(Exception $e)
{
    FCore::ShowError(500, $e->getMessage());
}

?>
Example #7
0
                        ))
                );
        $page->commit_applies();
        return $page->get_page();
    }

    public function ready_master()
    {
        $page = FCore::LoadMaster();

        $page->apply_string("title", "Boyds Nest");
        $page->apply_string("meta", "");
        $page->apply_string("javascript", "");
        $page->apply_string("style", Html::CssInclude(BN_URL_CSS . "/login.css"));

        return $page;
    }

}

try
{
    $page = new login();
    echo $page->init_request(IsSetGet(ACTION, 'default'));
}
catch(Exception $e)
{
    FCore::ShowError(500, $e);
}

?>
Example #8
0
 /**
  *
  * @param <type> $return_result
  * @return <type> 
  */
 public function get_global_data_and_validate()
 {
     $result = array();
     $keys = array_keys($this->rules);
     foreach($keys as $key)
     {
         $rule = $this->get_rule($key);
         $attempt = false;
         if (!isset($rule[DataRules::METHOD]))
         {
             continue;
         }
         switch($rule[DataRules::METHOD])
         {
             case DataRules::METHOD_GET:
                 $attempt = IsSetGet($key, false);
                 break;
             case DataRules::METHOD_POST:
                 $attempt = IsSetPost($key, false);
                 break;
             case DataRules::METHOD_SESSION:
                 $attempt = IsSetSession($key, false);
                 break;
             case DataRules::METHOD_GETPOST:
                 $attempt = IsSetGetPost($key, false);
                 break;
         }
         if ($attempt !== false)
         {
             $result[$key] = $attempt;
         }
     }
     return $this->validate_data($result, true);
 }
Example #9
0
/**
 * 
 * @param array $rules
 * @return <type>
 */
function GrabDataFromGlobal(DataRules &$rules)
{
    $result = array();
    foreach($rules->get_rule_keys() as $key)
    {
        $rule = $rules->get_rule($key);
        $attempt;
        if (!isset($rule[DataRules::METHOD]))
        {
            continue;
        }
        switch($rule[DataRules::METHOD])
        {
            case DataRules::METHOD_GET:
                $attempt = IsSetGet($key, false);
                break;
            case DataRules::METHOD_POST:
                $attempt = IsSetPost($key, false);
                break;
            case DataRules::METHOD_SESSION:
                $attempt = IsSetSession($key, false);
                break;
        }
        if ($attempt !== false)
        {
            $result[$key] = $attempt;
        }
    }
    return $result;
}
Example #10
0
<?php 

require_once '../setup.php';
$example = IsSetGet("example", 'ch1_4');

?><!DOCTYPE html>
<html>
    <head>
        <title>book example: <?php echo $example; ?></title>
        <script src="javascript/jquery-1.7.1.js"></script>
        <script src="javascript/modernizr.js"></script>
        <script src="javascript/fled.js"></script>
        <script src="examples/<?php echo $example; ?>.js"></script>
        <meta charset="UTF-8" />
    </head>
    <body>
        <?php include 'common/header.php'; ?>
        
        <div class="canvas_div">
            <canvas id="canvas" width="500" height="500">
                Your browser does not support HTML5 canvas.
            </canvas>
        </div>
        
        <?php include 'common/footer.php'; ?>
    </body>
</html>
Example #11
0
    public function write_message($request)
    {
        $message = "";
        if ($request == ACTION.ACTION_WRITE."message")
        {
            try
            {
                $this->load_local_object('personal/objects/WriteMessage');
                $message = "successfully sent message";
                return $this->list_messages($request, $message);
            }
            catch(UserActionException $e)
            {
                $message = $e->getMessage();
            }
        }

        $user_to            = IsSetPost(USERS_USERID, null);
        $message_content    = IsSetPost(DBMessage::MESSAGE, "");
        $message_title      = IsSetPost(DBMessage::TITLE, "");
        if ($user_to == null)
        {
            $user_to = IsSetGet(USERS_USERID, null);
        }

        $user_list = false;
        try
        {
            $user_list = $this->load_local_object(
                    "personal/objects/GetUserList", $user_to);
            $user_list = $user_list->get_data();
        }
        catch(UserActionException $e)
        {
            $message .= $e->getMessage();
        }


        $master = $this->ready_master();
        $master->consume_string(
                "content",
                $this->load_local_php_view(
                        "personal/views/writemessage", array(
                            'message_content'   => $message_content,
                            'message_title'     => $message_title,
                            'message'           => $message,
                            'user_list'         => $user_list,
                            'user_id'           => $user_to
                        ))
                );
        return $master->get_page();
    }