示例#1
0
 /**
  * Constructor
  *
  * @param int $id album id
  */
 function __construct($id)
 {
     if (!filter_var($id, FILTER_VALIDATE_INT) || $id < 1) {
         suxFunct::redirect(suxFunct::makeURL('/photos'));
     }
     // Invalid id
     // Declare objects
     $this->photo = new suxPhoto();
     // Photos
     $this->r = new photosRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Declare properties
     $this->photo->setPublished(null);
     $this->id = $id;
     $this->per_page = $this->tpl->getConfigVars('perPage');
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     // Security check
     if (!$this->user->isRoot()) {
         $access = $this->user->getAccess($this->module);
         if ($access < $GLOBALS['CONFIG']['ACCESS'][$this->module]['admin']) {
             if ($access < $GLOBALS['CONFIG']['ACCESS'][$this->module]['publisher']) {
                 suxFunct::redirect(suxFunct::makeURL('/photos'));
             } elseif (!$this->photo->isAlbumOwner($id, $_SESSION['users_id'])) {
                 suxFunct::redirect(suxFunct::makeURL('/photos'));
             }
         }
     }
 }
示例#2
0
 /**
  * Constructor
  *
  */
 function __construct($nickname)
 {
     // Declare objects
     $this->openid = new openid();
     $this->r = new userRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     // Security check. Is the user allowed to edit this?
     $tmp = $this->user->getByNickname($nickname, true);
     if (!$tmp) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     } elseif ($tmp['users_id'] != $_SESSION['users_id']) {
         // Check that the user is allowed to be here
         if (!$this->user->isRoot()) {
             suxFunct::redirect(suxFunct::getPreviousURL());
         }
     }
     // Declare properties
     $this->nickname = $nickname;
     $this->users_id = $tmp['users_id'];
 }
示例#3
0
 /**
  * Constructor
  *
  */
 function __construct()
 {
     // Declare objects
     $this->photo = new suxPhoto();
     // Photos
     $this->r = new photosRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Declare Properties
     $this->photo->setPublished(null);
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     // Security check
     if (!$this->user->isRoot()) {
         $access = $this->user->getAccess($this->module);
         if ($access < $GLOBALS['CONFIG']['ACCESS'][$this->module]['admin']) {
             suxFunct::redirect(suxFunct::makeUrl('/home'));
         }
     }
 }
示例#4
0
 /**
  * Constructor
  *
  * @param string $nickname
  */
 function __construct($nickname)
 {
     // Declare objects
     $this->soc = new suxSocialNetwork();
     // User
     $this->r = new societyRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     $tmp = $this->user->getByNickname($nickname);
     if (!$tmp) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     // Invalid user
     // Don't let the user establish a relationship with themselves
     if ($tmp['users_id'] == $_SESSION['users_id']) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     // Declare properties
     $this->nickname = $nickname;
     $this->users_id = $tmp['users_id'];
 }
示例#5
0
 /**
  * Constructor
  *
  */
 function __construct($nickname)
 {
     // Declare objects
     $this->r = new adminRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     // Security check
     if (!$this->user->isRoot()) {
         suxFunct::redirect(suxFunct::makeUrl('/home'));
     }
     $tmp = $this->user->getByNickname($nickname);
     if (!$tmp) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     // Invalid user
     // Declare properties
     $this->nickname = $nickname;
     $this->users_id = $tmp['users_id'];
     $this->root = $tmp['root'];
     $this->banned = $tmp['banned'];
 }
示例#6
0
 /**
  * Constructor
  *
  */
 function __construct()
 {
     // Declare objects
     $this->r = new cropperRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
 }
示例#7
0
 /**
  * Constructor
  *
  * @param int $id item id
  */
 function __construct($id = null)
 {
     // Declare objects
     ### add objects here
     $this->r = new blogRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     ### do sanity and security checks here
     // Assign id:
     $this->id = $id;
 }
示例#8
0
 /**
  * Constructor
  *
  */
 function __construct()
 {
     // Declare objects
     $this->rss = new suxRSS();
     $this->r = new suxRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
 }
示例#9
0
 /**
  * Constructor
  *
  */
 function __construct()
 {
     // Declare objects
     $this->r = new userRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // This module can fallback on user/openid module
     foreach ($GLOBALS['CONFIG']['PREV_SKIP'] as $val) {
         if (mb_strpos($val, 'user/openid') === false) {
             $this->prev_skip[] = $val;
         }
     }
 }
示例#10
0
 /**
  * Constructor
  *
  */
 function __construct()
 {
     // Declare objects
     $this->r = new adminRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     // Security check
     if (!$this->user->isRoot()) {
         suxFunct::redirect(suxFunct::makeUrl('/home'));
     }
 }
示例#11
0
 /**
  * Constructor
  *
  */
 function __construct()
 {
     // Declare objects
     $this->nb = new suxUserNaiveBayesian();
     $this->r = new bayesRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // If feature is turned off, then redirect
     if ($GLOBALS['CONFIG']['FEATURE']['bayes'] == false) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
 }
示例#12
0
 /**
  * Constructor
  *
  * @param int $id message id
  */
 function __construct($id = null)
 {
     // Declare objects
     $this->nb = new suxUserNaiveBayesian();
     $this->msg = new suxThreadedMessages();
     $this->r = new blogRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Declare properties
     $this->msg->setPublished(null);
     if ($id) {
         if (!filter_var($id, FILTER_VALIDATE_INT) || $id < 1) {
             suxFunct::redirect(suxFunct::makeURL('/blog'));
         }
         // Invalid id
     }
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     // Security check
     if (!$this->user->isRoot()) {
         $access = $this->user->getAccess($this->module);
         if ($access < $GLOBALS['CONFIG']['ACCESS'][$this->module]['admin']) {
             if ($access < $GLOBALS['CONFIG']['ACCESS'][$this->module]['publisher']) {
                 suxFunct::redirect(suxFunct::makeUrl('/blog'));
             }
             // Verfiy that we are allowed to edit this
             if (filter_var($id, FILTER_VALIDATE_INT)) {
                 $tmp = $this->msg->getByID($id);
                 if ($tmp['users_id'] != $_SESSION['users_id']) {
                     suxFunct::redirect(suxFunct::makeUrl('/blog'));
                 }
             }
         }
     }
     // Assign id:
     $this->id = $id;
 }
示例#13
0
 /**
  * Constructor
  *
  * @param int $parent_id
  */
 function __construct($parent_id)
 {
     // Declare objects
     $this->msg = new suxThreadedMessages();
     $this->r = new blogRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     $parent = $this->msg->getByID($parent_id);
     if (!$parent) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     // Invalid message, redirect
     $this->parent = $parent;
 }
示例#14
0
 /**
  * Constructor
  *
  * @param int $id message id
  */
 function __construct($id = null)
 {
     // Declare objects
     $this->bm = new suxBookmarks();
     $this->r = new bookmarksRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Declare properties
     $this->bm->setPublished(null);
     if ($id) {
         if (!filter_var($id, FILTER_VALIDATE_INT) || $id < 1) {
             suxFunct::redirect(suxFunct::makeURL('/bookmarks'));
         }
         // Invalid id
     }
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     // Check that the user is allowed to be here
     if (!$this->user->isRoot()) {
         $access = $this->user->getAccess($this->module);
         if ($access < $GLOBALS['CONFIG']['ACCESS'][$this->module]['admin']) {
             suxFunct::redirect(suxFunct::makeUrl('/bookmarks'));
         }
     }
     // This module can fallback on approve module
     foreach ($GLOBALS['CONFIG']['PREV_SKIP'] as $val) {
         if (mb_strpos($val, 'bookmarks/approve') === false) {
             $this->prev_skip[] = $val;
         }
     }
     // Assign id:
     $this->id = $id;
 }
示例#15
0
 /**
  * Constructor
  *
  */
 function __construct($mode = 'register', $user = null)
 {
     // Declare objects
     $this->r = new userRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Give a unique form name
     $form_name = 'userEdit';
     $this->tpl->assign('form_name', $form_name);
     suxValidate::set_form($form_name);
     // -------------------------------------------------------------------
     // Edit mode
     // -------------------------------------------------------------------
     if ($mode == 'edit') {
         // Redirect if invalid
         if ($this->user->loginCheck(suxfunct::makeUrl('/user/register'))) {
             $this->mode = 'edit';
         }
         if ($user != $_SESSION['nickname']) {
             // Security check
             // Only a root user can modify other users
             if (!$this->user->isRoot()) {
                 suxFunct::redirect(suxFunct::makeUrl('/home'));
             }
         }
         // Get user
         $u = $this->user->getByNickname($user);
         if (!$u) {
             suxFunct::redirect(suxFunct::getPreviousURL());
         }
         // Invalid user
         $this->users_id = $u['users_id'];
     }
 }
示例#16
0
 /**
  * Constructor
  *
  * @param string $key PDO dsn key
  */
 function __construct($id)
 {
     // Declare objects
     $this->msg = new suxThreadedMessages();
     $this->bookmarks = new suxBookmarks();
     $this->r = new blogRenderer($this->module);
     // Renderer
     suxValidate::register_object('this', $this);
     // Register self to validator
     parent::__construct();
     // Let the parent do the rest
     // Declare properties
     $this->id = $id;
     $this->msg->setPublished(null);
     $this->bookmarks->setPublished(null);
     // If feature is turned off, then redirect
     if ($GLOBALS['CONFIG']['FEATURE']['auto_bookmark'] == false) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     // Redirect if not logged in
     if (empty($_SESSION['users_id'])) {
         suxFunct::redirect(suxFunct::makeUrl('/user/register'));
     }
     // --------------------------------------------------------------------
     // Scan post for href links
     // --------------------------------------------------------------------
     $msg = $this->msg->getByID($id);
     if (!$msg) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     // No message, skip
     if ($msg['users_id'] != $_SESSION['users_id']) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     // Not the user's message, skip
     $matches = array();
     $pattern = '#<a[\\s]+[^>]*?href[\\s]?=[\\s"\']+(.*?)["\']+.*?>([^<]+|.*?)?</a>#si';
     // href pattern
     preg_match_all($pattern, $msg['body_html'], $matches);
     $count = count($matches[1]);
     if (!$count) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     //  No links, skip
     // Limit the amount of time we wait for a connection to a remote server to 5 seconds
     ini_set('default_socket_timeout', 5);
     for ($i = 0; $i < $count; ++$i) {
         if (mb_substr($matches[1][$i], 0, 7) == 'http://' || mb_substr($matches[1][$i], 0, 8) == 'https://') {
             // Basic info
             $url = suxFunct::canonicalizeUrl($matches[1][$i]);
             if (!filter_var($url, FILTER_VALIDATE_URL) || $this->bookmarks->getByID($url)) {
                 continue;
             }
             // skip it
             $title = strip_tags($matches[2][$i]);
             $body = null;
             if (!$this->r->detectPOST()) {
                 $tmp = $this->bookmarks->fetchUrlInfo($url);
                 if ($tmp) {
                     $title = $tmp['title'];
                     $body = $tmp['description'];
                 }
             }
             // Add to array for use in template
             $this->arr['found_links'][$url] = array('title' => $title, 'body' => $body);
         }
     }
     $count = count(@$this->arr['found_links']);
     if (!$count) {
         suxFunct::redirect(suxFunct::getPreviousURL());
     }
     //  No links, skip
 }