Example #1
0
 /**
  * CONSTRUCTOR
  *
  * @return      @e void
  */
 public function __construct()
 {
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_lang'), 'syncApp');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $sqlPassed = FALSE;
     $classname = "db_driver_Mysql";
     $sync_DB = new $classname();
     $sync_DB->obj['sql_database'] = $this->settings['syncapp_realm_database'];
     $sync_DB->obj['sql_user'] = $this->settings['syncapp_mysql_user'];
     $sync_DB->obj['sql_pass'] = $this->settings['syncapp_mysql_password'];
     $sync_DB->obj['sql_host'] = $this->settings['syncapp_mysql_ip'];
     $sync_DB->return_die = true;
     if (!$sync_DB->connect()) {
         $fail = 1;
         return $fail;
         /* At this point we dont have a connection so ABORT! else database driver error */
     }
     if ($this->settings['syncapp_mysql_user'] || $this->settings['syncapp_mysql_password'] || $fail != 1) {
         $this->sqlPassed = TRUE;
         $this->registry->dbFunctions()->setDB('mysql', 'auth_DB', array('sql_database' => $this->settings['syncapp_realm_database'], 'sql_user' => $this->settings['syncapp_mysql_user'], 'sql_pass' => $this->settings['syncapp_mysql_password'], 'sql_host' => $this->settings['syncapp_mysql_ip']));
     } else {
         return;
     }
 }
Example #2
0
 /**
  * Returns the type hint of a `ReflectionParameter` instance.
  *
  * @param  object $parameter A instance of `ReflectionParameter`.
  * @return string            The parameter type hint.
  */
 public static function typehint($parameter)
 {
     $typehint = '';
     if ($parameter->getClass()) {
         $typehint = '\\' . $parameter->getClass()->getName();
     } elseif (preg_match('/.*?\\[ \\<[^\\>]+\\> (\\w+)(.*?)\\$/', (string) $parameter, $match)) {
         $typehint = $match[1];
     }
     return $typehint;
 }
Example #3
0
 /**
  * This method is run when a member is flagged as a spammer
  *
  * @param	array 	$member	Array of member data
  * @return	@e void
  */
 public function onSetAsSpammer($member)
 {
     /* Load status class */
     if (!$this->registry->isClassLoaded('memberStatus')) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus');
         $this->registry->setClass('memberStatus', new $classToLoad(ipsRegistry::instance()));
     }
     /* Delete the stuff */
     $this->registry->getClass('memberStatus')->setAuthor($member);
     $this->registry->getClass('memberStatus')->deleteAllReplies();
     $this->registry->getClass('memberStatus')->deleteAllMemberStatus();
 }
Example #4
0
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
 }
 /**
  * Constructor
  *
  * @param	object		$registry		Registry object
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     //-----------------------------------------
     // Need to reset?
     //-----------------------------------------
     if ($this->memberData['msg_count_reset']) {
         $this->memberData['pconversation_filters'] = $this->resetMembersFolderCounts($this->memberData['member_id']);
         $this->resetMembersTotalTopicCount($this->memberData['member_id']);
         $this->resetMembersNewTopicCount($this->memberData['member_id']);
     }
     /* Load parser */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
     $this->Parser = new $classToLoad();
     /* Set up parser */
     $this->Parser->set(array('memberData' => $this->memberData, 'parseBBCode' => 1, 'parseArea' => 'pms', 'parseHtml' => 0, 'parseEmoticons' => 1));
     //-----------------------------------------
     // INIT Folder contents
     //-----------------------------------------
     $folderContents = array();
     //-----------------------------------------
     // Do a little set up, do a litle dance, get
     // down tonight! *boogie*
     //-----------------------------------------
     $this->_dirData = $this->explodeFolderData($this->memberData['pconversation_filters']);
     //-----------------------------------------
     // Do we have VID?
     // No, it's just the way we walk! Haha, etc.
     //-----------------------------------------
     if ($this->request['folderID'] and $this->request['folderID']) {
         $this->_currentFolderID = $this->request['folderID'];
     } else {
         /* Got any new messages? If so, show that. If not, show myconvo
            I'm sure you could have figured that out without this silly comment...*/
         $this->_currentFolderID = $this->_dirData['new']['count'] ? 'new' : 'myconvo';
     }
     //-----------------------------------------
     // Print folder links
     //-----------------------------------------
     foreach ($this->_dirData as $id => $data) {
         if ($data['protected'] and $id != 'myconvo') {
             continue;
         }
         $folderContents[] = "<option value='move_{$id}'>{$data['real']}</option>";
     }
     if (count($folderContents) > 1) {
         $this->_jumpMenu = implode("\n", $folderContents);
     } else {
         $this->_jumpMenu = '';
     }
 }
Example #6
0
 /**
  * Attempt to validate feed
  *
  * @access	public
  * @param	string		Feed URL (uses $this->_url if one is not passed )
  * @return	bool
  * EXCEPTION CODES:
  * HTTP_STATUS_CODE				Incorrect http status code (code returned is added to $this->errors)
  * RSS_CLASS_ERROR				Error returned from RSS class (errors added to $this->errors)
  * NO_CHANNELS					RSS feed doesn't have any channels
  * NO_ITEMS						RSS feed doesn't have any items
  */
 public function validate($url = '')
 {
     $url = $url ? $url : $this->_url;
     /* Reset the class */
     $this->_reset();
     /* Parse URL */
     $this->_rssClass->parseFeedFromUrl($url);
     /* Validate Data - HTTP Status Code/Text */
     if ($this->_rssClass->classFileManagement->http_status_code != "200") {
         $this->errors[0] = $this->registry->getClass('class_localization')->words['_rssimportcode'] . $this->_rssClass->classFileManagement->http_status_code;
         //print_r( $this->errors );
         throw new Exception('HTTP_STATUS_CODE');
     }
     /* Any errors found? */
     if (is_array($this->_rssClass->errors) and count($this->_rssClass->errors)) {
         foreach ($this->_rssClass->errors as $error) {
             $this->errors[] = $error;
         }
         throw new Exception('RSS_CLASS_ERROR');
     }
     /* Got any channels? */
     if (!is_array($this->_rssClass->rss_channels) or !count($this->_rssClass->rss_channels)) {
         throw new Exception('NO_CHANNELS');
     }
     /* Any Items */
     if (!is_array($this->_rssClass->rss_items) or !count($this->_rssClass->rss_items)) {
         throw new Exception('NO_ITEMS');
     }
     /* Last validated URL */
     $this->_validatedUrl = $url;
     return TRUE;
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object	ipsRegistry
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $plugin = $this->settings['bot_antispam_type'];
     if (!file_exists(IPS_KERNEL_PATH . 'classCaptchaPlugin/' . $plugin . '.php')) {
         $plugin = 'default';
     }
     require_once IPS_KERNEL_PATH . 'classCaptchaPlugin/' . $plugin . '.php';
     $this->_plugInClass = new captchaPlugIn($registry);
 }
Example #8
0
 /**
  * Returns the board's forums.
  * WARNING: Last option is deprecated and no longer supported.  User is automatically treated like a guest.
  * 
  * @param	string  $api_key		Authentication Key
  * @param	string  $api_module		Module
  * @param	string	$forum_ids		Comma separated list of forum ids
  * @param	bool	$view_as_guest	Treat user as a guest
  * @return	string	xml
  */
 public function fetchForums($api_key, $api_module, $forum_ids, $view_as_guest)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $api_key = IPSText::md5Clean($api_key);
     $api_module = IPSText::parseCleanValue($api_module);
     $forum_ids = $forum_ids ? explode(',', IPSText::parseCleanValue($forum_ids)) : null;
     $view_as_guest = intval($view_as_guest);
     //-----------------------------------------
     // Authenticate
     //-----------------------------------------
     if ($this->__authenticate($api_key, $api_module, 'fetchForums') !== FALSE) {
         //-----------------------------------------
         // Add log
         //-----------------------------------------
         $this->addLogging($api_key);
         //-----------------------------------------
         // Get some classes
         //-----------------------------------------
         ipsRegistry::getAppClass('forums');
         //-----------------------------------------
         // Fetch forum list
         //-----------------------------------------
         $return = array();
         foreach ($forum_ids as $id) {
             $return[] = $this->registry->getClass('class_forums')->forumsFetchData($id);
         }
         //-----------------------------------------
         // Return the data
         //-----------------------------------------
         $this->classApiServer->apiSendReply($return);
         exit;
     }
 }
Example #9
0
 /**
  * Cria uma instrução SQL de deleção no banco
  * @param	Model	$model		model a ser deletado
  * @throws	DatabaseException	disparada caso o model seja uma nova instância, ou não tenha a anotação Entity
  * @return	void
  */
 public function delete(Model $model)
 {
     $conditions = array();
     if (get_class($model) != $this->clazz) {
         throw new DatabaseException("O objeto deve ser do tipo '" . $this->clazz . "'");
     }
     $class = $this->annotation->getClass();
     if (!$class->Entity) {
         throw new DatabaseException('A classe ' . get_class($model) . ' não é uma entidade');
     }
     if ($model->_isNew()) {
         throw new DatabaseException('O método delete não pode ser utilizado com uma nova instância de ' . $this->clazz);
     }
     foreach ($model as $field => $value) {
         $property = $this->annotation->getProperty($field);
         if ($this->isField($property) && $this->isKey($property)) {
             $conditions['fields'][] = '`' . $field . '` = ?';
             $conditions['values'][] = $value;
         }
     }
     $entity = $class->Entity ? $class->Entity : get_class($model);
     $sql = 'DELETE FROM `' . $entity . '` WHERE ' . implode(' AND ', $conditions['fields']) . ';';
     Debug::addSql($sql, $conditions['values']);
     $this->operations[] = array('sql' => $sql, 'values' => $conditions['values']);
 }
Example #10
0
 /**
  * Returns the type hint of a `ReflectionParameter` instance.
  *
  * @param  object $parameter A instance of `ReflectionParameter`.
  * @return string            The parameter type hint.
  */
 public static function typehint($parameter)
 {
     $typehint = '';
     if ($parameter->getClass()) {
         $typehint = '\\' . $parameter->getClass()->getName();
     } elseif (preg_match('/.*?\\[ \\<[^\\>]+\\> (?:HH\\\\)?(\\w+)(.*?)\\$/', (string) $parameter, $match)) {
         $typehint = $match[1];
         if ($typehint === 'integer') {
             $typehint = 'int';
         } elseif ($typehint === 'boolean') {
             $typehint = 'bool';
         } elseif ($typehint === 'mixed') {
             $typehint = '';
         }
     }
     return $typehint;
 }
 /**
  * [getRepositoryFromAdmin description]
  * @param  object $admin 
  * @return string        [description]
  */
 private function getRepositoryFromAdmin($admin)
 {
     $class = $admin->getClass();
     $bundle = $this->getBundleNameFromClass($class);
     $chunks = explode('\\', $class);
     $name = sprintf('%s:%s', $bundle, ucfirst(array_pop($chunks)));
     return $name;
 }
Example #12
0
 /**
  * Method constructor
  *
  * @access	public
  * @param	string		Application
  * @return	@e void
  * 
  */
 public function __construct($app = 'core')
 {
     /* Make object */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Set local data */
     $this->setApp($app);
     /* Load application file */
     $this->_loadExtension();
 }
 /**
  * Create and deploy an instance of the referred class
  * @param string $instance  Namespace
  * @param string $property  (Child's) property to be written
  * @param array  $arguments Optional arguments parsed to the object constructor
  */
 protected function setInstance($instance, $property, $arguments = array())
 {
     $property = (string) $property;
     $this->ah->validateType($property, 'string');
     if (!is_object($instance)) {
         $instance = $this->getInstance($instance, $arguments);
     }
     $property = $property ?: strtolower($this->ah->getClass(get_class($instance)));
     $this->setProperty($property, $instance);
 }
Example #14
0
 /**
  * Instantiate the resource object
  *
  * @return object $this
  */
 protected function getResource()
 {
     $a = $this->Registry->Mongo->getCollection($this->resType)->findOne(array('_id' => $this->resID));
     if (empty($a) || empty($a['_id'])) {
         throw new \Lampcms\Exception('Invalid question or answer id ' . $this->resID);
     }
     $class = 'QUESTIONS' === $this->resType ? '\\Lampcms\\Question' : '\\Lampcms\\Answer';
     $this->Resource = new $class($this->Registry, $a);
     d('$this->Resource: ' . $this->Resource->getClass());
     return $this;
 }
 /**
  * Create one element
  *
  * @param object $node
  * @access private
  * @return null
  */
 private function _generateElement($node)
 {
     $cssClasses = [];
     $classLink = [];
     $dropDownShow = '';
     if ($node->isActive()) {
         // set active parent wrapper
         $cssClasses[] = $this->_activeClass;
         // set active link
         $classLink[] = $this->_activeClass;
         // set active dropdown list
         $dropDownShow = $this->_dropChildShowClass;
     }
     if ($node->getClassLink()) {
         $classLink[] = $node->getClassLink();
     }
     if ($node->getClass()) {
         $cssClasses[] = $node->getClass();
     }
     $class = count($cssClasses) > 0 ? " class='" . implode(' ', $cssClasses) . "'" : '';
     $classLink = $node->getClassLink() ? " class='" . implode(' ', $classLink) . "'" : '';
     $id = !is_null($node->getId()) ? " id='" . $node->getId() . "'" : '';
     $target = !is_null($node->getTarget()) ? " target='" . $node->getTarget() . "'" : '';
     $click = !is_null($node->getClick()) ? " onclick='" . $node->getClick() . "'" : '';
     // generate link and wrapper <li>
     $this->_string .= "\t\t<li{$class} {$id}>" . PHP_EOL;
     $this->_string .= "\t\t\t<a " . $classLink . " title='" . $node->getName() . "' " . $click . " href='" . $node->getUrl() . "' {$target}>";
     $this->_string .= $node->getIcon() ? '<i class="' . $node->getIcon() . '"></i>' : '';
     $this->_string .= '<span class="hidden-xs"> ' . $node->getName() . '</span>';
     $this->_string .= "</a>" . PHP_EOL;
     //generate childs
     if ($node->hasChilds()) {
         $ulClass = !empty($this->_dropChildClass) ? 'class="' . $this->_dropChildClass . ' ' . $dropDownShow . '"' : '';
         $this->_string .= "\t\t<ul {$ulClass}>" . PHP_EOL;
         $this->_generateChilds($node->getChilds());
         $this->_string .= "\t\t</ul>" . PHP_EOL;
     }
     $this->_string .= "\t\t</li>" . PHP_EOL;
 }
Example #16
0
 /**
  * Returns the editor for viewing ...
  * @param unknown_type $member
  */
 public function getEditorHtml(array $member)
 {
     /* Fetch member data */
     $member = IPSMember::buildDisplayData(IPSMember::load($member['member_id'], 'all'));
     $p_w = "";
     $p_h = "";
     $cur_photo = "";
     $rand = urlencode(microtime());
     $data = array('currentPhoto' => array('tag' => ''), 'custom' => array('tag' => ''), 'gravatar' => array('tag' => ''), 'twitter' => array('tag' => ''));
     /* Photo type */
     $data['type'] = $member['pp_photo_type'] = $this->getPhotoType($member);
     /* Got gravatar? */
     $member['pp_gravatar'] = $member['pp_gravatar'] ? $member['pp_gravatar'] : $member['email'];
     /* Quick permission check */
     if (!IPSMember::canUploadPhoto($member, TRUE)) {
         return false;
     }
     /* Set the current photo */
     $data['currentPhoto']['tag'] = IPSMember::buildProfilePhoto($member, 'full', IPS_MEMBER_PHOTO_NO_CACHE);
     /* Set up custom */
     $data['custom']['tag'] = $member['pp_photo_type'] != 'custom' ? IPSMember::buildNoPhoto($member, 'thumb', false, true) : "<img src='" . $member['pp_thumb_photo'] . '?__rand=' . $rand . "' width='" . $member['pp_thumb_width'] . "' height='" . $member['pp_thumb_height'] . "' />";
     /* Set up Gravatar */
     $data['gravatar']['tag'] = "<img src='http://www.gravatar.com/avatar/" . md5($member['pp_gravatar']) . "?s=100' alt='' />";
     /* Twitter linked? */
     if (IPSLib::twitter_enabled() && $member['twitter_token'] && $member['twitter_secret']) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect');
         $twitter = new $classToLoad($this->registry, $member['twitter_token'], $member['twitter_secret']);
         $userData = $twitter->fetchUserData();
         if ($userData['profile_image_url']) {
             $data['twitter']['tag'] = "<img src='" . str_replace('_normal.', '.', $userData['profile_image_url']) . "' />";
         }
     }
     /* Facebook linked? */
     if (IPSLib::fbc_enabled() && $member['fb_uid']) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect');
         $facebook = new $classToLoad($this->registry);
         /* Now get the linked user */
         $linkedMemberData = IPSMember::load(intval($member['fb_uid']), 'all', 'fb_uid');
         $userData = $facebook->fetchUserData();
         if ($userData['pic_big']) {
             $data['facebook']['tag'] = "<img src='" . $userData['pic_big'] . "' />";
         } else {
             if ($userData['pic']) {
                 $data['facebook']['tag'] = "<img src='" . $userData['pic'] . "' />";
             }
         }
     }
     $this->uploadFormMax = 5000 * 1024;
     return $this->registry->getClass('output')->getTemplate('profile')->photoEditor($data, $member);
 }
 /**
  * Constructor
  *
  * @param	object		Registry Object
  */
 public function __construct(ipsRegistry $registry)
 {
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     /* Settings */
     $this->gd_version = $this->settings['gd_version'];
     $this->path_background = DOC_IPS_ROOT_PATH . 'public/style_captcha/captcha_backgrounds';
     $this->path_fonts = DOC_IPS_ROOT_PATH . 'public/style_captcha/captcha_fonts';
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry Object
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     /* Settings */
     $this->public_key = trim($this->settings['recaptcha_public_key']);
     $this->private_key = trim($this->settings['recaptcha_private_key']);
     $this->useSSL = $this->settings['logins_over_https'];
 }
Example #19
0
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @param	object		Parent bbcode class
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry, $_parent = null)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->_parentBBcode = $_parent;
     /* Retrieve bbcode data */
     $bbcodeCache = $this->cache->getCache('bbcode');
     $this->_bbcode = $bbcodeCache[$this->currentBbcode];
 }
 /**
  * Constructor
  *
  * @param	object		Registry object
  * @param	string		Parsing method to use
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry, $method = 'normal')
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->pre_edit_parse_method = $method;
     /* Initialize our bbcode class */
     $this->_loadClasses();
     /* And some default properties */
     $this->bypass_badwords = $this->memberData ? intval($this->memberData['g_bypass_badwords']) : 0;
     $this->strip_quotes = $this->settings['strip_quotes'];
 }
 /**
  * Builds comments
  *
  * @access	public
  * @param	array 		Member information
  * @param	boolean		Use a new id
  * @param	string		Message to display
  * @return	string		Comment HTML
  * @since	IPB 2.2.0.2006-08-02
  */
 public function buildComments($member, $new_id = 0, $return_msg = '')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $comments = array();
     $member_id = intval($member['member_id']);
     $comment_perpage = 15;
     //intval( $member['pp_setting_count_comments'] );
     $comment_html = 0;
     $comment_start = intval($this->request['st']);
     $comment_approved = ($this->memberData['member_id'] == $member['member_id'] or $this->memberData['g_is_supmod']) ? '' : ' AND ( pc.comment_approved=1 OR ( pc.comment_approved=0 AND pc.comment_by_member_id=' . $member_id . ') )';
     //-----------------------------------------
     // Not showing comments?
     //-----------------------------------------
     if ($comment_perpage < 1) {
         return '';
     }
     //-----------------------------------------
     // Regenerate comments...
     //-----------------------------------------
     $this->DB->build(array('select' => 'pc.*', 'from' => array('profile_comments' => 'pc'), 'where' => 'pc.comment_for_member_id=' . $member_id . $comment_approved, 'order' => 'pc.comment_date DESC', 'limit' => array($comment_start, $comment_perpage), 'calcRows' => TRUE, 'add_join' => array(array('select' => 'm.members_display_name, m.members_seo_name, m.posts, m.last_activity, m.member_group_id, m.member_id, m.last_visit, m.warn_level', 'from' => array('members' => 'm'), 'where' => 'm.member_id=pc.comment_by_member_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
     $o = $this->DB->execute();
     $max = $this->DB->fetchCalculatedRows();
     while ($row = $this->DB->fetch($o)) {
         $row['_comment_date'] = ipsRegistry::getClass('class_localization')->getDate($row['comment_date'], 'TINY');
         $row = IPSMember::buildDisplayData($row);
         if (!$row['members_display_name_short']) {
             $row = array_merge($row, IPSMember::setUpGuest());
         }
         $comments[] = $row;
     }
     //-----------------------------------------
     // Pagination
     //-----------------------------------------
     $links = $this->registry->output->generatePagination(array('totalItems' => $max, 'itemsPerPage' => $comment_perpage, 'currentStartValue' => $comment_start, 'baseUrl' => "showuser={$member_id}", 'seoTitle' => $member['members_seo_name']));
     $comment_html = $this->registry->getClass('output')->getTemplate('profile')->showComments($member, $comments, $new_id, $return_msg, $links);
     //-----------------------------------------
     // Return it...
     //-----------------------------------------
     return $comment_html;
 }
 /**
  * Converge_Server::__authenticate()
  *
  * Checks to see if the request is allowed
  * 
  * @access	protected
  * @param	string	$key			Authenticate Key
  * @param	string	$product_id		Product ID
  * @return	string         			Error message, if any
  */
 protected function __authenticate($key, $product_id)
 {
     $this->registry->getClass('class_localization')->loadLanguageFile(array('api_langbits'), 'core');
     //-----------------------------------------
     // Check converge users API DB
     //-----------------------------------------
     $info = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'converge_local', 'where' => "converge_product_id=" . intval($product_id) . " AND converge_active=1 AND converge_api_code='{$key}'"));
     //-----------------------------------------
     // Got a user?
     //-----------------------------------------
     if (!$info['converge_api_code']) {
         $this->classApiServer->apiSendError(100, $this->registry->getClass('class_localization')->words['unauthorized_user']);
         return FALSE;
     } else {
         if (CVG_IP_MATCH and my_getenv('REMOTE_ADDR') != $info['converge_ip_address']) {
             $this->classApiServer->apiSendError(101, $this->registry->getClass('class_localization')->words['bad_ip_address']);
             return FALSE;
         } else {
             return TRUE;
         }
     }
 }
 /**
  * User maintenance callback
  *
  * @return	mixed		Possible redirection based on login method config, else false
  */
 public function checkMaintenanceRedirect()
 {
     $redirect = '';
     foreach ($this->modules as $k => $obj_reference) {
         if (method_exists($obj_reference, 'checkMaintenanceRedirect')) {
             $obj_reference->checkMaintenanceRedirect();
         }
         //-----------------------------------------
         // Grab first logout callback url found
         //-----------------------------------------
         if (!$redirect and $this->login_methods[$k]['login_maintain_url']) {
             $redirect = $this->login_methods[$k]['login_maintain_url'];
         }
     }
     //-----------------------------------------
     // If we found a logout url, go to it now
     //-----------------------------------------
     if ($redirect) {
         $this->registry->getClass('output')->silentRedirect($redirect);
     }
     return false;
 }
 /**
  * Returns the board's forums.
  * WARNING: Last option is deprecated and no longer supported.  User is automatically treated like a guest.
  * 
  * @access	public
  * @param	string  $api_key		Authentication Key
  * @param	string  $api_module		Module
  * @param	string	$forum_ids		Comma separated list of forum ids
  * @param	bool	$view_as_guest	Treat user as a guest
  * @return	string	xml
  */
 public function fetchForums($api_key, $api_module, $forum_ids, $view_as_guest)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $api_key = IPSText::md5Clean($api_key);
     $api_module = IPSText::parseCleanValue($api_module);
     $forum_ids = $forum_ids ? explode(',', IPSText::parseCleanValue($forum_ids)) : null;
     $view_as_guest = intval($view_as_guest);
     //-----------------------------------------
     // Authenticate
     //-----------------------------------------
     if ($this->__authenticate($api_key, $api_module, 'fetchForums') !== FALSE) {
         //-----------------------------------------
         // Add log
         //-----------------------------------------
         if (ipsRegistry::$settings['xmlrpc_log_type'] != 'failed') {
             $this->registry->DB()->insert('api_log', array('api_log_key' => $api_key, 'api_log_ip' => $_SERVER['REMOTE_ADDR'], 'api_log_date' => time(), 'api_log_query' => $this->classApiServer->raw_request, 'api_log_allowed' => 1));
         }
         //-----------------------------------------
         // Get some classes
         //-----------------------------------------
         require_once IPSLib::getAppDir('forums') . '/app_class_forums.php';
         $appClass = new app_class_forums($this->registry);
         //-----------------------------------------
         // Fetch forum list
         //-----------------------------------------
         $return = array();
         foreach ($forum_ids as $id) {
             $return[] = $this->registry->getClass('class_forums')->forumsFetchData($id);
         }
         //-----------------------------------------
         // Return the data
         //-----------------------------------------
         $this->classApiServer->apiSendReply($return);
         exit;
     }
 }
Example #25
0
 /**
  * Fetch all replies to a status
  * Default filters are sorted on reply_date ASC
  *
  * @param	mixed	[Array of member data OR member ID INT for member updating their status - will use ->getAuthor() if null]	
  * @param	array	Array of sort/filter data ( member_id [int], latest_only [0,1], offset [int], limit [int], unix_cutoff [int], sort_dir [asc,desc], sort_field [string] )
  */
 public function fetchAllReplies($status = null, $filters = array())
 {
     $status = $status === null ? $this->_internalData['StatusData'] : (is_array($status) ? $status : $this->_loadStatus($status));
     $where = array();
     $replies = array();
     $sort_dir = $filters['sort_dir'] == 'desc' ? 'desc' : 'asc';
     $sort_field = isset($filters['sort_field']) ? $filters['sort_field'] : 'reply_date';
     $offset = isset($filters['offset']) ? intval($filters['offset']) : 0;
     $limit = isset($filters['limit']) ? intval($filters['limit']) : 100;
     /* Grab them */
     $this->DB->build(array('select' => 's.*', 'from' => array('member_status_replies' => 's'), 'where' => 's.reply_status_id=' . intval($status['status_id']), 'order' => 's.' . $sort_field . ' ' . $sort_dir, 'limit' => array($offset, $limit), 'add_join' => array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=s.reply_member_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
     $o = $this->DB->execute();
     while ($row = $this->DB->fetch($o)) {
         /* Format some data */
         $row['reply_date_formatted'] = $this->registry->getClass('class_localization')->getDate($row['reply_date'], 'SHORT');
         $row['_canDelete'] = $this->canDeleteReply($this->getAuthor(), $row, $status);
         /* Format member */
         $row = IPSMember::buildDisplayData($row, array('reputation' => 0, 'warn' => 0));
         $replies[$row['reply_id']] = $row;
     }
     /* Phew */
     return $replies;
 }
Example #26
0
 /**
  * Handle the incoming request using the command resolver
  *
  * @access	protected
  * @return	@e void
  */
 protected function handleRequest()
 {
     $cmd_r = new ipsController_CommandResolver();
     try {
         self::$cmd = $cmd_r->getCommand($this->registry);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         /* An error occured, so throw a 404 */
         try {
             /* The following patch prevents links such as /admin/index.php?adsess=123&app=anyrandomnamehere&module=login&do=login-complete from loading 
             			an ACP error screen complete with wrapper, which may expose the applications that are installed to an end user.
             			This issue was reported by Christopher Truncer via the IPS ticket system. */
             if (IN_ACP and !$this->registry->member()->getProperty('member_id')) {
                 $this->registry->getClass('output')->silentRedirect(ipsRegistry::$settings['base_url']);
             }
             $this->registry->getClass('output')->showError('incorrect_furl', 404, null, null, 404);
         } catch (Exception $e) {
             print $msg;
             exit;
         }
     }
     IPSDebug::setMemoryDebugFlag("Everything up until execute call", 0);
     self::$cmd->execute($this->registry);
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     //require_once( IPS_ROOT_PATH . 'sources/interfaces/interface_bbcode.php' );
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $this->initOurBbcodes();
     IPSDebug::setMemoryDebugFlag("BBCodes initialized", $_NOW);
     /* Check for emoticons */
     if (!is_array($this->caches['emoticons']) or !count($this->caches['emoticons'])) {
         $this->cache->rebuildCache('emoticons', 'global');
     }
 }
 /**
  * handshake_server::handshake_end()
  *
  * Returns all data...
  * 
  * @access	public
  * @param	integer		$reg_id					Converge reg ID
  * @param	string		$reg_code				Converge API Code (MUST BE PRESENT IN ALL RETURNED API REQUESTS).
  * @param	integer		$reg_date				Unix stamp of converge request start time
  * @param	integer		$reg_product_id			Converge product ID (MUST BE PRESENT IN ALL RETURNED API REQUESTS)
  * @param	string		$converge_url			Converge application base url (no slashes or paths)
  * @param	integer		$handshake_completed	All done flag
  * @return	mixed		xml / boolean false
  **/
 public function handshakeEnd($reg_id = '', $reg_code = '', $reg_date = '', $reg_product_id = '', $converge_url = '', $handshake_completed = '')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $reg_id = intval($reg_id);
     $reg_code = IPSText::md5Clean($reg_code);
     $reg_date = intval($reg_date);
     $reg_product_id = intval($reg_product_id);
     $converge_url = IPSText::parseCleanValue($converge_url);
     $handshake_completed = intval($handshake_completed);
     $this->registry->getClass('class_localization')->loadLanguageFile(array('api_langbits'), 'core');
     //-----------------------------------------
     // Grab data from the DB
     //-----------------------------------------
     $converge = $this->registry->DB()->buildAndFetch(array('select' => '*', 'from' => 'converge_local', 'where' => "converge_api_code='" . $reg_code . "' AND converge_product_id=" . $reg_product_id));
     //-----------------------------------------
     // Got it?
     //-----------------------------------------
     if ($converge['converge_api_code']) {
         $this->registry->DB()->update('converge_local', array('converge_active' => 0));
         $this->registry->DB()->update('converge_local', array('converge_active' => 1), "converge_api_code = '" . $reg_code . "'");
         //-----------------------------------------
         // Update log in methods
         //-----------------------------------------
         $this->registry->DB()->update("login_methods", array("login_enabled" => 1, "login_login_url" => '', "login_maintain_url" => '', 'login_user_id' => 'email', "login_logout_url" => '', "login_register_url" => ''), "login_folder_name='ipconverge'");
         $cache = array();
         $this->registry->DB()->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
         $this->registry->DB()->execute();
         while ($r = $this->registry->DB()->fetch()) {
             $cache[$r['login_id']] = $r;
         }
         ipsRegistry::cache()->setCache('login_methods', $cache, array('array' => 1, 'deletefirst' => 1));
         $this->classApiServer->apiSendReply(array('handshake_updated' => 1));
     } else {
         $this->classApiServer->apiSendError(500, $this->lang->words['no_handshake']);
         return false;
     }
 }
Example #29
0
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $this->initOurBbcodes();
     IPSDebug::setMemoryDebugFlag("BBCodes initialized", $_NOW);
     /* Check for emoticons */
     if (!$this->cache->exists('emoticons')) {
         $emoticons = $this->cache->getCache('emoticons');
         /* Fallback on recache */
         if (!is_array($emoticons) or !count($emoticons)) {
             $this->cache->rebuildCache('emoticons', 'global');
         }
     }
 }
Example #30
0
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function __construct()
 {
     /* Make object */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Load and init BBCodes */
     foreach ($this->cache->getCache('bbcode') as $bbcode) {
         /* Allowed this BBCode? */
         if ($bbcode['bbcode_sections'] != 'all' && parent::$Perms['parseArea'] != 'global') {
             $pass = false;
             $sections = explode(',', $bbcode['bbcode_sections']);
             foreach ($sections as $section) {
                 if ($section == parent::$Perms['parseArea']) {
                     $pass = true;
                     break;
                 }
             }
             if (!$pass) {
                 continue;
             }
         }
         /* Cheat a bit */
         if (in_array($bbcode['bbcode_tag'], array('code', 'acronym', 'img'))) {
             $bbcode['bbcode_no_auto_url_parse'] = 1;
         }
         /* Store */
         $this->_bbcodes[$bbcode['bbcode_tag']] = $bbcode;
     }
     /* Can we parse URLs */
     if (isset($this->_bbcodes['url'])) {
         /* Allowed to use this? */
         if ($this->_bbcodes['url']['bbcode_groups'] != 'all' and parent::$Perms['memberData']['member_group_id']) {
             $pass = false;
             $groups = array_diff(explode(',', $this->_bbcodes['url']['bbcode_groups']), array(''));
             $mygroups = array(parent::$Perms['memberData']['member_group_id']);
             if (parent::$Perms['memberData']['mgroup_others']) {
                 $mygroups = array_diff(array_merge($mygroups, explode(',', IPSText::cleanPermString(parent::$Perms['memberData']['mgroup_others']))), array(''));
             }
             foreach ($groups as $g_id) {
                 if (in_array($g_id, $mygroups)) {
                     $pass = true;
                     break;
                 }
             }
             if (!$pass) {
                 $this->_urlsEnabled = false;
             }
         }
     }
     /* Check for emoticons */
     if (!$this->cache->exists('emoticons')) {
         $emoticons = $this->cache->getCache('emoticons');
         /* Fallback on recache */
         if (!is_array($emoticons) or !count($emoticons)) {
             $this->cache->rebuildCache('emoticons', 'global');
         }
     }
 }