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($user_id = false)
    {
        parent::__construct();

        // getting the user id
        if (!$user_id)
        {
            $user_id = IsSetGetPost(USERS_USERID);
            if (!$user_id)
            {
                throw new UserActionException("no user selected");
            }
            if (!is_numeric($user_id))
            {
                throw new UserActionException("user id must be numeric");
            }
        }

        // getting the user data
        try
        {
            $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
            $this->data = $user_factory->select_first($user_id);
        }
        catch(Exception $e)
        {
            throw new UserActionException($e->getMessage());
        }
    }
Example #3
0
    public function __construct()
    {
        parent::__construct();

        $user_id = IsSetGetPost(USERS_USERID);
        if (!$user_id)
        {
            $user_id = BoydsnestSession::GetInstance()->get(USERS_USERID);
        }

        try
        {
            $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
            $this->data = $user_factory->select_first($user_id, array(
                        DBFactory::SELECT_GET_ONLY => array(
                            USERS_USERID, USERS_USERNAME, USERS_SCHEMEUSING,
                            USERS_EMAIL, USERS_SECRETANSWER, USERS_SECRETQUESTION,
                            USERS_EXPIRESWHEN, USERS_CREATEDWHEN
                        )
                    ));
        }
        catch(DBFactoryException $e)
        {
            throw new UserActionException(
                    "An Error Occurred While Trying To Get The Profile",
                    $e);
        }
    }
Example #4
0
 /**
  * Set a cookie
  *
  * {@inheritdoc}
  *
  * A value may either be a string or a ResponseCookie instance
  * String values will be converted into a ResponseCookie with
  * the "name" of the cookie being set from the "key"
  *
  * Obviously, the developer is free to organize this collection
  * however they like, and can be more explicit by passing a more
  * suggested "$key" as the cookie's "domain" and passing in an
  * instance of a ResponseCookie as the "$value"
  *
  * @see DataCollection::set()
  * @param  string                       $key   The name of the cookie to set
  * @param  ResponseCookie|string        $value The value of the cookie to set
  * @access public
  * @return ResponseCookieDataCollection
  */
 public function set($key, $value)
 {
     if ($value instanceof \Norma\Router\FormatRoute) {
         return parent::set($key, $value);
     }
     return false;
 }
 public function __construct()
 {
     parent::__construct();
     $this->collect();
     $this->validate();
     $this->do_action();
 }
Example #6
0
 public function __construct($origin = 'to')
 {
     parent::__construct();
     $this->origin = $origin;
     $this->do_security_check();
     $this->collect();
     $this->do_action();
 }
 function __call($name, $arguments)
 {
     if ($name == 'get' . $this->model_name) {
         $collection = $this->get_collection();
         return array_pop($collection);
     }
     return parent::__call($name, $arguments);
 }
Example #8
0
    public function __construct($data)
    {
        parent::__construct();

        if (!isset($data["user_id"]) || !is_numeric($data["user_id"]))
        {
            throw new UserActionException("user_id must be numeric", null);
        }
        if (!isset($data["page_id"]) || !is_numeric($data["page_id"]))
        {
            throw new UserActionException("page_id must be numeric", null);
        }

        $forum = DBForum::GetForum(BN_DATATYPE_USERPAGES, $data["user_id"]);
        
        $this->data   = $forum->post_get($data["page_id"]);
        if ($this->data[DBForum::METADATA] != null)
        {
            $extra = unserialize($this->data[DBForum::METADATA]);

            $this->data[PAGETITLE] =
                    array_key_exists(PAGETITLE, $extra)
                    ? $extra[PAGETITLE] : "";
            $this->data[PAGETYPE] =
                    array_key_exists(PAGETYPE, $extra)
                    ? $extra[PAGETYPE] : BN_PAGETHREADTYPE_NONE;
            $this->data[PAGEPRIVATE] =
                    array_key_exists(PAGEPRIVATE, $extra)
                    ? $extra[PAGEPRIVATE] : false;
            if ($this->data[DBDataType::CONTENT] == null)
            {
                $this->data[DBDataType::CONTENT] = "";
            }
        }

        $this->data[PAGEFOLLOWERS] = array();
        $this->data[PAGERIGHTS] = array();
        $forum_meta = unserialize($forum->get_metadata());
        if (is_array($forum_meta) &&
            array_key_exists($data["page_id"], $forum_meta))
        {
            $this_meta = $forum_meta[$data["page_id"]];
            if (array_key_exists(PAGEFOLLOWERS, $this_meta))
            {
                $this->data[PAGEFOLLOWERS] = $this_meta[PAGEFOLLOWERS];
            }
            if (array_key_exists(PAGERIGHTS, $this_meta))
            {
                $this->data[PAGERIGHTS] = $this_meta[PAGERIGHTS];
            }
        }
    }
 function __call($name, $arguments)
 {
     if ($name == 'get' . $this->model_name . 's') {
         return $this->get_collection();
     }
     if ($name == 'get' . $this->model_name . 'es') {
         return $this->get_collection();
     }
     if ($name == 'get' . substr($this->model_name, 0, -1) . 'ies') {
         return $this->get_collection();
     }
     return parent::__call($name, $arguments);
 }
    public function __construct($page_id)
    {
        parent::__construct();

        if (!is_numeric($page_id))
        {
            throw new UserActionException('page id must be numeric', null);
        }

        $forum = DBForum::GetForum(BN_DATATYPE_PAGERESPONSES, $page_id);
        if ($forum == null)
        {
            return;
        }

        $this->data = $forum->build_hierarchy();
    }
 public function __construct()
 {
     parent::__construct();
     try
     {
         $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
         $this->data = $user_factory->select(
                 array(
                     array(
                         DBFactory::ID_KEY => USERS_USERNAME,
                         DBFactory::ID_SIGN => "!=",
                         DBFactory::ID_VAL => "guest",
                     ),
                     "AND",
                     array(
                         DBFactory::ID_KEY => USERS_USERNAME,
                         DBFactory::ID_SIGN => "!=",
                         DBFactory::ID_VAL => "system",
                     ),
                     "AND",
                     array(
                         DBFactory::ID_KEY => USERS_USERID,
                         DBFactory::ID_SIGN => "!=",
                         DBFactory::ID_VAL => BoydsnestSession::GetInstance()->get(USERS_USERID),
                     ),
                     "AND",
                     array(
                         DBFactory::ID_KEY => USERS_ISACTIVE,
                         DBFactory::ID_SIGN => "=",
                         DBFactory::ID_VAL => 1,
                     ),
                 ),
                 array(
                     DBFactory::SELECT_GET_ONLY => array(
                         USERS_USERID, USERS_USERNAME, USERS_DEFAULTRIGHT
                     ),
                     DBFactory::SELECT_ORDER_BY => USERS_USERNAME
                 ));
     }
     catch(Exception $e)
     {
         throw new DataCollection($e->getMessage());
     }
 }
    public function __construct($data)
    {
        parent::__construct();

        if (!is_array($data))
        {
            throw new UserActionException("invalid data type", null);
        }
        if (!array_key_exists("page_id", $data))
        {
            throw new UserActionException("no page id specified", null);
        }
        if (!array_key_exists("post_id", $data))
        {
            throw new UserActionException("no post id specified", null);
        }

        $forum = DBForum::GetForum(BN_DATATYPE_PAGERESPONSES, $data["page_id"]);

        $this->data = $forum->post_get($data["post_id"]);
    }
Example #13
0
    public function __construct()
    {
        parent::__construct();

        $user_factory = false;
        try
        {
            $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
            $this->data = $user_factory->select(
                    array(
                        array(
                            DBFactory::ID_KEY   => USERS_USERNAME,
                            DBFactory::ID_SIGN  => "!=",
                            DBFactory::ID_VAL   => "system"
                        ),
                        "AND",
                        array(
                            DBFactory::ID_KEY   => USERS_USERNAME,
                            DBFactory::ID_SIGN  => "!=",
                            DBFactory::ID_VAL   => "Guest"
                        ),
                        "AND",
                        array(
                            DBFactory::ID_KEY   => USERS_USERID,
                            DBFactory::ID_SIGN  => "!=",
                            DBFactory::ID_VAL   => BoydsnestSession::GetInstance()->get(USERS_USERID)
                        ),
                    ),
                    array(
                        DBFactory::SELECT_GET_ONLY => array(
                            USERS_USERID, USERS_USERNAME, USERS_CREATEDWHEN,
                            USERS_ISACTIVE, USERS_LASTUPDATE, USERS_ISLOGGED
                        )
                    ));
        }
        catch(Exception $e)
        {
            throw new UserActionException($e->getMessage());
        }
    }
Example #14
0
    public function __construct()
    {
        parent::__construct();

        try
        {
            $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
            $rules = $user_factory->get_db_data_rules();

            foreach($rules->get_rule_keys() as $key)
            {
                $rule = $rules->get_rule($key);
                if (isset($rule[DataRules::DEFAULT_]))
                {
                    $this->data[$key] = $rule[DataRules::DEFAULT_];
                }
            }
        }
        catch(Exception $e)
        {
            throw new UserActionException($e->getMessage());
        }
    }
Example #15
0
 /**
  * ParameterCollection constructor.
  * @param array $parameters
  */
 public function __construct(array $parameters)
 {
     parent::__construct($parameters);
 }
Example #16
0
    public function __construct($user_id = false)
    {
        parent::__construct();

        $user_factory = false;
        try
        {
            $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
            if (!$user)
            {
                $this->data = $user_factory->select(
                        array(
                            array(
                                DBFactory::ID_KEY => USERS_USERNAME,
                                DBFactory::ID_SIGN => "!=",
                                DBFactory::ID_VAL => "guest"
                            ),
                            "AND",
                            array(
                                DBFactory::ID_KEY => USERS_USERNAME,
                                DBFactory::ID_SIGN => "!=",
                                DBFactory::ID_VAL => "system"
                            ),
                            "AND",
                            array(
                                DBFactory::ID_KEY => USERS_ISACTIVE,
                                DBFactory::ID_SIGN => "=",
                                DBFactory::ID_VAL => 1
                            ),
                            "AND",
                            array(
                                DBFactory::ID_KEY => USERS_USERID,
                                DBFactory::ID_SIGN => "!=",
                                DBFactory::ID_VAL =>
                                    BoydsnestSession::GetInstance()->get(USERS_USERID)
                            ),
                        ),
                        array(
                            DBFactory::SELECT_GET_ONLY => array(
                                USERS_USERID, USERS_USERNAME
                            ),
                            DBFactory::SELECT_ORDER_BY => USERS_USERNAME
                        ));
            }
            else
            {
                $this->data = $user_factory->select(
                        $user_id,
                        array(
                            DBFactory::SELECT_GET_ONLY => array(
                                USERS_USERID, USERS_USERNAME
                            ),
                            DBFactory::SELECT_ORDER_BY => USERS_USERNAME
                        ));
            }
        }
        catch(Exception $e)
        {
            throw new UserActionException($e->getMessage());
        }
    }
Example #17
0
 /**
  * [data description]
  * @param  [type] $store [description]
  * @return [type]        [description]
  */
 public static function data($store)
 {
     static $cache_datastore;
     if (isset($cache_datastore[$store])) {
         return $cache_datastore[$store];
     }
     if (strpos($store, ':') === false && !self::$app->isAbsolutePath($store)) {
         $path = "data:{$store}.yaml";
     } else {
         $path = $store;
     }
     if ($file = self::$app->path($path)) {
         if (is_null($cache_datastore)) {
             $cache_datastore = [];
         }
         $cache_datastore[$store] = self::$app->helper('yaml')->fromFile($file);
         return DataCollection::create($cache_datastore[$store]);
     }
     return [];
 }
    public function __construct($data = null)
    {
        parent::__construct();

        $user_id    = BoydsnestSession::GetInstance()->get(USERS_USERID);
        $page_root  = 0;
        $extended   = false;

        if (is_array($data))
        {
            if (array_key_exists(USERS_USERID, $data))
            {
                $user_id = $data[USERS_USERID];
            }
            if (array_key_exists("page_id", $data))
            {
                $page_root = $data["page_id"];
            }
            if (array_key_exists("extended", $data))
            {
                $extended = $data["extended"];
            }
        }
        else if (is_numeric($data))
        {
            $user_id = $data;
        }

        $forum = DBForum::GetForum(BN_DATATYPE_USERPAGES, $user_id);
        if ($forum == null)
        {
            $this->data = null;
            return;
        }

        $data;
        if ($extended)
        {
            $data = $forum->build_hierarchy($page_root);
        }
        else
        {
            $data = $forum->post_get_children($page_root);
        }

        if ($data == null)
        {
            $this->data = null;
            return;
        }

        foreach($data as $page)
        {
            $meta = unserialize($page[DBForum::METADATA]);
            if (is_array($meta))
            {
                if (array_key_exists(PAGETITLE, $meta))
                {
                    $page[PAGETITLE] = $meta[PAGETITLE];
                }
                if (array_key_exists(PAGEPRIVATE, $meta))
                {
                    $page[PAGEPRIVATE] = $meta[PAGEPRIVATE];
                }
                if (array_key_exists(PAGETYPE, $meta))
                {
                    $page[PAGETYPE] = $meta[PAGETYPE];
                }
            }
            $this->data[] = $page;
        }
    }
Example #19
0
 public function __construct()
 {
     parent::__construct();
 }
Example #20
0
 /**
  *
  * @param <type> $data
  */
 public function collide(DataCollection $data)
 {
     foreach($data->get_data() as $key => $value)
     {
         $this->data[$key] = $value;
     }
 }
Example #21
0
 /**
  * Checks if Key exists in collection
  *
  * @param $key
  * @return bool
  */
 public function has($key)
 {
     $key = str_replace('_', '-', strtolower($key));
     return parent::has($key);
 }
Example #22
0
<?php

/**
 * Created by PhpStorm.
 * User: martinmatak
 * Date: 06/03/16
 * Time: 17:50
 */
namespace graph_library;

require_once '../Autoloader.php';
header('Content-Type:image/png');
$platno = new Canvas();
$podaci = new DataCollection();
$line_chart = new BarChart('Cijena dionica', 300, 300);
$legend = new Legend();
$legend->addItem(new LegendItem('Relativni odnos dionica zadnjih 5 godina'));
$podaci->addItems(array(new DataCollectionItem([10, '2011']), new DataCollectionItem([15, '2012']), new DataCollectionItem([8, '2013']), new DataCollectionItem([19, '2014']), new DataCollectionItem([22, '2015'])));
$line_chart->setLegend($legend, 10, 25);
$id_podataka = $line_chart->addData($podaci);
$line_chart->colorData(16, 80, 57, $id_podataka);
$platno->addChart($line_chart, 0, 0);
$slika = $platno->render();
imagepng($slika);
$platno->save('bar.png');
Example #23
0
<?php

/**
 * Created by PhpStorm.
 * User: martinmatak
 * Date: 04/03/16
 * Time: 15:20
 */
namespace graph_library;

require_once '../Autoloader.php';
header('Content-Type:image/png');
$platno = new Canvas();
$podaci = new DataCollection();
$line_chart = new LineChart('Cijena dionica', 300, 300);
$legend = new Legend();
$legend->addItem(new LegendItem('Relativni odnos dionica zadnjih 5 godina'));
$podaci->addItems(array(new DataCollectionItem([2011, 10]), new DataCollectionItem([2012, 15]), new DataCollectionItem([2013, 8]), new DataCollectionItem([2014, 19]), new DataCollectionItem([2015, 22])));
$line_chart->setLegend($legend, 10, 30);
$id_podataka = $line_chart->addData($podaci);
$line_chart->colorData(16, 80, 57, $id_podataka);
$platno->addChart($line_chart, 0, 0);
$slika = $platno->render();
imagepng($slika);
$platno->save('line.png');
Example #24
0
 */
namespace graph_library;

require_once '../Autoloader.php';
header('Content-Type:image/png');
$platno = new Canvas();
$pieChart = new PieChart('naslov pie charta', 300, 300);
$legend = new Legend();
$legend->addItem(new LegendItem('1. item legende'));
$legend->addItem(new LegendItem('2. item legende'));
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([5]));
$id_podataka = $pieChart->addData($podatak);
$pieChart->colorData(56, 80, 57, $id_podataka);
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([17]));
$id_podataka = $pieChart->addData($podatak);
$pieChart->colorData(16, 20, 17, $id_podataka);
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([35]));
$id_podataka = $pieChart->addData($podatak);
$pieChart->colorData(36, 40, 57, $id_podataka);
$podatak = new DataCollection();
$podatak->addItem(new DataCollectionItem([35]));
$id_podataka = $pieChart->addData($podatak);
$pieChart->colorData(170, 0, 0, $id_podataka);
$pieChart->setLegend($legend, 10, 100);
$platno->addChart($pieChart, 0, 0);
$slika = $platno->render();
imagepng($slika);
$platno->save('pie.png');
 /**
  * @return array|Parameter[]
  */
 public function getParams()
 {
     return $this->dataCollection->getAll();
 }
    public function __construct($selected = null)
    {
        parent::__construct();

        $user_factory =& FCore::LoadDBFactory(BN_DBFACTORY_USERMODEL);
        if (!$user_factory)
        {
            throw new UserActionException(
                    "could not connect to the user database", null);
        }

        try
        {
            $this->data = $user_factory->select(
                    array(
                        array(
                            DBFactory::ID_KEY   => USERS_USERNAME,
                            DBFactory::ID_SIGN  => "!=",
                            DBFactory::ID_VAL   => "system",
                        ),
                        "AND",
                        array(
                            DBFactory::ID_KEY   => USERS_USERNAME,
                            DBFactory::ID_SIGN  => "!=",
                            DBFactory::ID_VAL   => "guest",
                        ),
                        "AND",
                        array(
                            DBFactory::ID_KEY   => USERS_ISACTIVE,
                            DBFactory::ID_SIGN  => "=",
                            DBFactory::ID_VAL   => "1",
                        ),
                        "AND",
                        array(
                            DBFactory::ID_KEY   => USERS_ISFAMILY,
                            DBFactory::ID_SIGN  => "=",
                            DBFactory::ID_VAL   => "1",
                        ),
                    ),
                    array(
                        DBFactory::SELECT_GET_ONLY => array(
                            USERS_USERID, USERS_USERNAME, 
                        ),
                        DBFactory::SELECT_ORDER_BY => USERS_USERNAME
                    ));
        }
        catch(DBFactoryException $e)
        {
            throw new UserActionException(
                    "an error occurred while getting user data", $e);
        }

        if ($selected)
        {
            foreach($this->data as $key => $user)
            {
                if ($user[USERS_USERID] == $selected[USERS_USERID])
                {
                    $this->data[$key][DBForum::POSTCHILDREN] = FCore::LoadObject(
                        "pages/GetUserPageHierarchy",
                        array(
                            USERS_USERID    => $selected[USERS_USERID],
                            "extended"      => true,
                        ));
                    if (is_a($this->data[$key][DBForum::POSTCHILDREN], "DataCollection"))
                    {
                        $this->data[$key][DBForum::POSTCHILDREN] =
                                $this->data[$key][DBForum::POSTCHILDREN]->get_data();
                    }
                    break;
                }
            }
        }
    }
Example #27
0
<?php

/**
 * Created by PhpStorm.
 * User: martinmatak
 * Date: 06/03/16
 * Time: 18:12
 */
namespace graph_library;

require_once '../Autoloader.php';
header('Content-Type:image/png');
$platno = new Canvas();
$podaci = new DataCollection();
$barchart = new BarChart('Cijena dionica', 300, 300);
$legend = new Legend();
$legend->addItem(new LegendItem('Relativni odnos dionica zadnjih 5 godina'));
$podaci->addItems(array(new DataCollectionItem([2011, 10]), new DataCollectionItem([2012, 15]), new DataCollectionItem([2013, 8]), new DataCollectionItem([2014, 19]), new DataCollectionItem([2015, 22])));
$barchart->setLegend($legend, 10, 25);
$barchart->colorData(16, 80, 57, $barchart->addData($podaci));
$platno->addChart($barchart, 0, 0);
$lineChart = new LineChart('Cijena dionica', 300, 300);
$lineChart->setLegend($legend, 10, 30);
$lineChart->colorData(16, 80, 57, $lineChart->addData($podaci));
$platno->addChart($lineChart, 310, 0);
$slika = $platno->render();
imagepng($slika);
$platno->save('LineAndBar.png');
 /**
  *
  */
 public function sorted()
 {
     return parent::sort('$item->meta("sort")');
 }
 /**
  * Remove a header
  *
  * {@inheritdoc}
  *
  * @see DataCollection::remove()
  * @param string $key   The name of the header
  * @access public
  * @return void
  */
 public function remove($key)
 {
     $key = static::normalizeName($key);
     parent::remove($key);
 }
 public function __construct()
 {
     parent::__construct();
     $this->collect();
 }