示例#1
0
文件: Container.php 项目: visapi/amun
 public function __construct(Registry $registry, User $user)
 {
     $this->config = $registry->getConfig();
     $this->sql = $registry->getSql();
     $this->registry = $registry;
     $this->user = $user;
 }
示例#2
0
文件: Html.php 项目: visapi/amun
 public function __construct(Registry $registry, User $user, $discoverOembed = false)
 {
     $this->config = $registry->getConfig();
     $this->sql = $registry->getSql();
     $this->registry = $registry;
     $this->user = $user;
     switch ($this->user->getStatus()) {
         case Record::ADMINISTRATOR:
             $this->collection = new Collection\FullTrusted();
             $this->discover = $discoverOembed;
             break;
         case Record::NORMAL:
         case Record::REMOTE:
             $this->collection = new Collection\NormalTrusted();
             $this->discover = $discoverOembed;
             break;
         case Record::ANONYMOUS:
         default:
             $this->collection = new Collection\Untrusted();
             $this->discover = false;
             break;
     }
     $this->http = new Http();
     $this->oembed = new Oembed($this->http);
     // whitelist of available oembed endpoints
     $this->oembedHosts = array('youtube.com' => 'http://www.youtube.com/oembed', 'youtu.be' => 'http://www.youtube.com/oembed', 'blip.tv' => 'http://blip.tv/oembed/', 'vimeo.com' => 'http://vimeo.com/api/oembed.json', 'dailymotion.com' => 'http://www.dailymotion.com/services/oembed', 'flickr.com' => 'http://www.flickr.com/services/oembed/', 'smugmug.com' => 'http://api.smugmug.com/services/oembed/', 'hulu.com' => 'http://www.hulu.com/api/oembed.json', 'viddler.com' => 'http://lab.viddler.com/services/oembed/', 'qik.com' => 'http://qik.com/api/oembed.json', 'revision3.com' => 'http://revision3.com/api/oembed/', 'photobucket.com' => 'http://photobucket.com/oembed', 'scribd.com' => 'http://www.scribd.com/services/oembed', 'wordpress.tv' => 'http://wordpress.tv/oembed/', 'funnyordie.com' => 'http://www.funnyordie.com/oembed', 'twitter.com' => 'http://api.twitter.com/1/statuses/oembed.json');
 }
示例#3
0
文件: Path.php 项目: visapi/amun
 public function __construct(Registry $registry, Page $page)
 {
     parent::__construct($this->path);
     $this->config = $registry->getConfig();
     $this->sql = $registry->getSql();
     $this->registry = $registry;
     $this->page = $page;
 }
示例#4
0
 public function __construct(Registry $registry, User $user, Page $page)
 {
     parent::__construct($this->nav);
     $this->config = $registry->getConfig();
     $this->sql = $registry->getSql();
     $this->registry = $registry;
     $this->user = $user;
     $this->page = $page;
 }
示例#5
0
 public function __construct(Registry $registry)
 {
     $auth = $this;
     parent::__construct(function ($consumerKey, $token) use($auth) {
         return $auth->getConsumer($consumerKey, $token);
     });
     $this->registry = $registry;
     $this->sql = $registry->getSql();
 }
示例#6
0
文件: Option.php 项目: visapi/amun
 public function __construct($optionName, Registry $registry, User $user, Page $page)
 {
     $this->options = array();
     parent::__construct($this->options);
     $this->optionName = $optionName;
     $this->config = $registry->getConfig();
     $this->sql = $registry->getSql();
     $this->registry = $registry;
     $this->user = $user;
     $this->page = $page;
 }
示例#7
0
文件: Gadget.php 项目: visapi/amun
    public function __construct($gadgetId, Registry $registry, User $user)
    {
        $this->config = $registry->getConfig();
        $this->sql = $registry->getSql();
        $this->registry = $registry;
        $this->user = $user;
        $sql = <<<SQL
SELECT
\t`gadget`.`id`        AS `gadgetId`,
\t`gadget`.`serviceId` AS `gadgetServiceId`,
\t`gadget`.`rightId`   AS `gadgetRightId`,
\t`gadget`.`type`      AS `gadgetType`,
\t`gadget`.`name`      AS `gadgetName`,
\t`gadget`.`title`     AS `gadgetTitle`,
\t`gadget`.`class`     AS `gadgetClass`,
\t`gadget`.`param`     AS `gadgetParam`,
\t`gadget`.`cache`     AS `gadgetCache`,
\t`gadget`.`expire`    AS `gadgetExpire`,
\t`gadget`.`date`      AS `gadgetDate`
FROM 
\t{$this->registry['table.content_gadget']} `gadget`
INNER JOIN
\t{$this->registry['table.core_service']} `service`
\tON `gadget`.`serviceId` = `service`.`id`
WHERE 
\t`gadget`.`id` = ?
SQL;
        $row = $this->sql->getRow($sql, array($gadgetId));
        if (!empty($row)) {
            if (!empty($row['gadgetRightId']) && !$this->user->hasRightId($row['gadgetRightId'])) {
                throw new Exception('Access not allowed', 401);
            }
            $this->id = $row['gadgetId'];
            $this->serviceId = $row['gadgetServiceId'];
            $this->rightId = $row['gadgetRightId'];
            $this->type = $row['gadgetType'];
            $this->name = $row['gadgetName'];
            $this->title = $row['gadgetTitle'];
            $this->class = $row['gadgetClass'];
            $this->param = $row['gadgetParam'];
            $this->cache = $row['gadgetCache'];
            $this->expire = $row['gadgetExpire'];
            $this->date = $row['gadgetDate'];
        } else {
            throw new Exception('Invalid gadget');
        }
    }
示例#8
0
文件: Install.php 项目: visapi/amun
 public function __construct(Registry $registry)
 {
     $this->registry = $registry;
     $this->config = $registry->getConfig();
     $this->sql = $registry->getSql();
     $this->id = 1;
     $this->groupId = 1;
     $this->name = 'System';
 }
示例#9
0
文件: Service.php 项目: visapi/amun
    public function __construct($id, Registry $registry)
    {
        $this->config = $registry->getConfig();
        $this->sql = $registry->getSql();
        $this->registry = $registry;
        $status = Record::NORMAL;
        $sql = <<<SQL
SELECT
\t`service`.`id`           AS `serviceId`,
\t`service`.`status`       AS `serviceStatus`,
\t`service`.`source`       AS `serviceSource`,
\t`service`.`autoloadPath` AS `serviceAutoloadPath`,
\t`service`.`config`       AS `serviceConfig`,
\t`service`.`name`         AS `serviceName`,
\t`service`.`path`         AS `servicePath`,
\t`service`.`namespace`    AS `serviceNamespace`,
\t`service`.`type`         AS `serviceType`,
\t`service`.`version`      AS `serviceVersion`,
\t`service`.`date`         AS `serviceDate`
FROM 
\t{$this->registry['table.core_service']} `service`
WHERE 
\t`service`.`id` = ?
SQL;
        $row = $this->sql->getRow($sql, array($id));
        if (!empty($row)) {
            $this->id = $row['serviceId'];
            $this->status = $row['serviceStatus'];
            $this->source = $row['serviceSource'];
            $this->autoloadPath = $row['serviceAutoloadPath'];
            $this->configFile = $row['serviceConfig'];
            $this->name = $row['serviceName'];
            $this->path = $row['servicePath'];
            $this->namespace = $row['serviceNamespace'];
            $this->type = $row['serviceType'];
            $this->version = $row['serviceVersion'];
            $this->date = $row['serviceDate'];
        } else {
            throw new Exception('Invalid service');
        }
    }
示例#10
0
文件: Page.php 项目: visapi/amun
    public function __construct($pageId, Registry $registry, User $user)
    {
        $this->config = $registry->getConfig();
        $this->sql = $registry->getSql();
        $this->registry = $registry;
        $this->user = $user;
        $status = Record::NORMAL;
        $sql = <<<SQL
SELECT
\t`page`.`id`          AS `pageId`,
\t`page`.`parentId`    AS `pageParentId`,
\t`page`.`serviceId`   AS `pageServiceId`,
\t`page`.`rightId`     AS `pageRightId`,
\t`page`.`status`      AS `pageStatus`,
\t`page`.`load`        AS `pageLoad`,
\t`page`.`path`        AS `pagePath`,
\t`page`.`urlTitle`    AS `pageUrlTitle`,
\t`page`.`title`       AS `pageTitle`,
\t`page`.`template`    AS `pageTemplate`,
\t`page`.`description` AS `pageDescription`,
\t`page`.`keywords`    AS `pageKeywords`,
\t`page`.`cache`       AS `pageCache`,
\t`page`.`expire`      AS `pageExpire`,
\t`page`.`publishDate` AS `pagePublishDate`,
\t`page`.`date`        AS `pageDate`,
\t`service`.`source`   AS `serviceSource`
FROM 
\t{$this->registry['table.content_page']} `page`
INNER JOIN 
\t{$this->registry['table.core_service']} `service`
\tON `page`.`serviceId` = `service`.`id`
WHERE 
\t`page`.`id` = ?
SQL;
        $row = $this->sql->getRow($sql, array($pageId));
        if (!empty($row)) {
            if (!empty($row['pageRightId']) && !$this->user->hasRightId($row['pageRightId'])) {
                throw new Exception('Access not allowed', 401);
            }
            $this->id = $row['pageId'];
            $this->parentId = $row['pageParentId'];
            $this->serviceId = $row['pageServiceId'];
            $this->rightId = $row['pageRightId'];
            $this->status = $row['pageStatus'];
            $this->load = $row['pageLoad'];
            $this->path = $row['pagePath'];
            $this->urlTitle = $row['pageUrlTitle'];
            $this->title = $row['pageTitle'];
            $this->template = $row['pageTemplate'];
            $this->description = $row['pageDescription'];
            $this->keywords = $row['pageKeywords'];
            $this->cache = $row['pageCache'];
            $this->expire = $row['pageExpire'];
            $this->publishDate = $row['pagePublishDate'];
            $this->date = $row['pageDate'];
            $this->application = $row['serviceSource'];
            $this->url = $this->config['psx_url'] . '/' . $this->config['psx_dispatch'] . $row['pagePath'];
        } else {
            throw new Exception('Invalid page');
        }
    }
示例#11
0
文件: Attempt.php 项目: visapi/amun
 public function __construct(Registry $registry)
 {
     $this->config = $registry->getConfig();
     $this->sql = $registry->getSql();
     $this->registry = $registry;
 }
示例#12
0
 public function __construct(Registry $registry, $parentId = 0)
 {
     $this->sql = $registry->getSql();
     $this->registry = $registry;
     $this->parentId = $parentId;
 }
示例#13
0
文件: User.php 项目: visapi/amun
    public function __construct($id, Registry $registry, $accessId = null)
    {
        $this->config = $registry->getConfig();
        $this->sql = $registry->getSql();
        $this->registry = $registry;
        $this->accessId = (int) $accessId;
        $status = self::BANNED;
        $sql = <<<SQL
SELECT
\t`account`.`id`           AS `accountId`,
\t`account`.`groupId`      AS `accountGroupId`,
\t`account`.`hostId`       AS `accountHostId`,
\t`account`.`countryId`    AS `accountCountryId`,
\t`account`.`status`       AS `accountStatus`,
\t`account`.`name`         AS `accountName`,
\t`account`.`email`        AS `accountEmail`,
\t`account`.`gender`       AS `accountGender`,
\t`account`.`profileUrl`   AS `accountProfileUrl`,
\t`account`.`thumbnailUrl` AS `accountThumbnailUrl`,
\t`account`.`timezone`     AS `accountTimezone`,
\t`account`.`updated`      AS `accountUpdated`,
\t`account`.`date`         AS `accountDate`,
\t`group`.`title`          AS `groupTitle`
FROM 
\t{$this->registry['table.user_account']} `account`
INNER JOIN 
\t{$this->registry['table.user_group']} `group`
\tON `account`.`groupId` = `group`.`id`
WHERE 
\t`account`.`id` = ?
AND 
\t`account`.`status` NOT IN ({$status})
SQL;
        $row = $this->sql->getRow($sql, array($id));
        if (!empty($row)) {
            $this->id = $row['accountId'];
            $this->groupId = $row['accountGroupId'];
            $this->hostId = $row['accountHostId'];
            $this->group = $row['groupTitle'];
            $this->countryId = $row['accountCountryId'];
            $this->status = $row['accountStatus'];
            $this->name = $row['accountName'];
            $this->email = $row['accountEmail'];
            $this->gender = $row['accountGender'];
            $this->profileUrl = $row['accountProfileUrl'];
            $this->thumbnailUrl = $row['accountThumbnailUrl'];
            $this->updated = $row['accountUpdated'];
            $this->date = $row['accountDate'];
            // set timezone
            $this->setTimezone($row['accountTimezone']);
            // update the last seen field
            $now = new DateTime('NOW', $this->registry['core.default_timezone']);
            $con = new Condition(array('id', '=', $this->id));
            $this->sql->update($this->registry['table.user_account'], array('lastSeen' => $now->format(DateTime::SQL)), $con);
            // set user rights
            if (empty($this->accessId)) {
                $this->setRights($this->groupId);
            } else {
                $this->setApplicationRights($this->accessId);
            }
        } else {
            throw new Exception('Unknown user id');
        }
    }
示例#14
0
文件: Record.php 项目: visapi/amun
 public function getRecord()
 {
     if ($this->_record === null && !empty($this->record)) {
         $fields = unserialize($this->record);
         $class = Registry::getClassName($this->table);
         $record = new $class($this->_table);
         foreach ($fields as $k => $v) {
             $record->{$k} = $v;
         }
         $this->_record = $record;
     }
     return $this->_record;
 }