Beispiel #1
0
 /**
  * Load the data from the database
  * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash
  **/
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     if ($this->verifyId($this->mBitBoardId) || $this->verifyId($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $lookupColumn = $this->verifyId($this->mBitBoardId) ? 'board_id' : 'content_id';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mBitBoardId) ? $this->mBitBoardId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "SELECT s.*, lc.*, " . "uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, " . "uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name " . "{$selectSql} " . "FROM `" . BIT_DB_PREFIX . "boards` s " . "INNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = s.`content_id` ) {$joinSql}" . "LEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )" . "LEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )" . "WHERE s.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mBitBoardId = $result->fields['board_id'];
             $this->mInfo['creator'] = isset($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = isset($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['parsed_data'] = $this->parseData();
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #2
0
 /**
  * If this object constructed with a valid Id then load from the DB
  * @return boolean TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 public function load()
 {
     if ($this->verifyId($this->mId) || $this->verifyId($this->mContentId)) {
         $lookupColumn = $this->verifyId($this->mId) ? $this->mChildIdName : 'content_id';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mId) ? $this->mId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "\n\t\t\t\tSELECT data.*, lc.*,\n\t\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name\n\t\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . $this->mFormTbl . "` data\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = data.`content_id`)\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\n\t\t\t\t\t{$joinSql}\n\t\t\t\tWHERE (data.`{$lookupColumn}` = ?)\n\t\t\t\t\t{$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mId = $result->fields[$this->mChildIdName];
             $this->mInfo['creator'] = !empty($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = !empty($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_name'] = BitUser::getTitle($this->mInfo);
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['edit_url'] = $this->getEditUrl();
             $this->mInfo['remove_url'] = $this->getRemoveUrl();
             $this->mInfo['parsed_data'] = $this->parseData();
             parent::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #3
0
 function load()
 {
     if ($this->verifyId($this->mActionId) || $this->verifyId($this->mContentId)) {
         global $gBitSystem, $gBitUser, $gLibertySystem;
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         $lookupColumn = $this->verifyId($this->mActionId) ? 'action_id' : 'content_id';
         $lookupId = $this->verifyId($this->mActionId) ? $this->mActionId : $this->mContentId;
         array_push($bindVars, $lookupId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "\n\t\t\t\tSELECT sa.*, lc.*, \n\t\t\t\t\tacm.`action_c_key_id` AS `action_content_key`, \n\t\t\t\t\tacm.`action_c_detail_key_id` AS `action_content_detail_key`, \n\t\t\t\t\tlcds.`data` AS `summary`, lch.`hits`, uu.`login`, uu.`real_name`,\n\t\t\t\t\tlfp.storage_path AS `image_attachment_path` \n\t\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "diasalsa_actions` sa\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = sa.`content_id`)\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "users_users` uu ON( uu.`user_id` = lc.`user_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "diasalsa_action_content_map` acm ON (acm.`content_id` = sa.`content_id`)\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_data` lcds ON (lc.`content_id` = lcds.`content_id` AND lcds.`data_type`='summary')\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_hits` lch ON (lc.`content_id` = lch.`content_id`)\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` la ON( la.`content_id` = lc.`content_id` AND la.`is_primary` = 'y' )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lfp ON( lfp.`file_id` = la.`foreign_id` )\n\t\t\t\t\t{$joinSql}\n\t\t\t\tWHERE sa.`{$lookupColumn}`=? {$whereSql} ";
         if ($this->mInfo = $this->mDb->getRow($query, $bindVars)) {
             $this->mActionId = $this->mInfo['action_id'];
             $this->mKeyId = $this->mInfo['key_id'];
             $this->mContentId = $this->mInfo['content_id'];
             LibertyMime::load();
             $this->mInfo['salsa_display_url'] = $this->getSalsaDisplayUrl();
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['thumbnail_url'] = $this->getImageThumbnails($this->mInfo);
         } else {
             $this->mActionId = NULL;
             $this->mKeyId = NULL;
             $this->mContentId = NULL;
         }
         // base array to hold shit - we want to know null stuff too, to make our html setup easier
         $this->mInfo['targets']['auto'] = array();
         foreach ($this->mTargetTypeDesc as $key => $value) {
             $this->mInfo['targets'][$key] = array();
         }
     }
     return count($this->mInfo);
 }
Beispiel #4
0
 function loadComment()
 {
     global $gBitSystem, $gBitUser;
     if (!$this->verifyId($this->mCommentId) && !$this->verifyId($this->mContentId)) {
         return NULL;
     }
     if ($this->mCommentId) {
         $mid = 'WHERE lcom.`comment_id` = ?';
         $bindVars = array($this->mCommentId);
     } else {
         $mid = 'WHERE lc.`content_id` = ?';
         $bindVars = array($this->mContentId);
     }
     $joinSql = $selectSql = $whereSql = '';
     $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, $this);
     $sql = "SELECT lcom.*, lc.*, uu.`email`, uu.`real_name`, uu.`login` {$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "liberty_comments` lcom\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lcom.`content_id` = lc.`content_id`)\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "users_users` uu ON (lc.`user_id` = uu.`user_id`) {$joinSql}\n\t\t\t\t{$mid} {$whereSql}";
     if ($row = $this->mDb->getRow($sql, $bindVars)) {
         $this->mInfo = $row;
         $this->mContentId = $row['content_id'];
         $this->mCommentId = $row['comment_id'];
         // call parent load for attachment data like other Mime derived classes, only need it if feature is active or admin
         if ($gBitSystem->isFeatureActive('comments_allow_attachments') || $gBitUser->isAdmin()) {
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #5
0
 /**
  * load Load the data from the database
  * 
  * @access public
  * @return boolean TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function load()
 {
     if ($this->verifyId($this->mSampleId) || $this->verifyId($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $lookupColumn = $this->verifyId($this->mSampleId) ? 'sample_id' : 'content_id';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mSampleId) ? $this->mSampleId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "\n\t\t\t\tSELECT sample.*, lc.*,\n\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name\n\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "sample_data` sample\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = sample.`content_id` ) {$joinSql}\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )\n\t\t\t\tWHERE sample.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mSampleId = $result->fields['sample_id'];
             $this->mInfo['creator'] = !empty($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = !empty($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_name'] = BitUser::getTitleFromHash($this->mInfo);
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['parsed_data'] = $this->parseData();
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #6
0
 function load($pContentId = NULL, $pPluginParams = TRUE)
 {
     global $gBitUser;
     if (empty($this->mProductsId) && !empty($this->mContentId)) {
         $this->mProductsId = $this->mDb->getOne("SELECT `products_id` FROM " . TABLE_PRODUCTS . " WHERE `content_id`=?", array($this->mContentId));
     }
     if (is_numeric($this->mProductsId) && ($this->mInfo = $this->getProduct($this->mProductsId))) {
         $this->mContentId = $this->getField('content_id');
         parent::load();
         if ($this->isDeleted() && !($gBitUser->hasPermission('p_bitcommerce_admin') || $this->isPurchased())) {
             $this->mInfo = array();
             unset($this->mProductsId);
         } else {
             $this->mContentId = $this->mInfo['content_id'];
         }
     }
     return count($this->mInfo);
 }
Beispiel #7
0
 function load()
 {
     if (!empty($this->mOverlayId) || !empty($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $overlayKey = $this->mOverlayType . '_id';
         $lookupColumn = !empty($this->mOverlayId) ? $overlayKey : 'content_id';
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mOverlayId) ? $this->mOverlayId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "select ot.*, lc.*,\n\t\t\t\t\t  uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\t\t  uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name {$selectSql}\n\t\t\t\t\t  FROM `" . BIT_DB_PREFIX . $this->mOverlayTable . "` ot\n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = ot.`content_id`) {$joinSql}\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\n\t\t\t\t\t  WHERE ot.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mOverlayId = $result->fields[$overlayKey];
             $this->mContentId = $result->fields['content_id'];
             $this->mInfo['creator'] = isset($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = isset($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             // $this->mInfo['parsed_data'] = $this->parseData();
             $this->mInfo['raw'] = $this->mInfo['data'];
             $parseHash['data'] = $this->mInfo['data'];
             $this->prepParseFilters($parseHash);
             // @TODO this has gone through many changes and this looks a bit chaotic - might be able to simplify this
             $this->mInfo['xml_parsed_data'] = $this->parseData($parseHash, $this->mInfo['format_guid']);
             $this->mInfo['parsed_data'] = $this->parseData($parseHash, $this->mInfo['format_guid']);
             $this->mInfo['clean_data'] = $this->mInfo['parsed_data'];
             $this->mInfo['parsed_data'] = addslashes($this->mInfo['parsed_data']);
             $this->mInfo['xml_data'] = str_replace("\n", "
", $this->mInfo['data']);
             $this->mInfo['data'] = addslashes($this->mInfo['data']);
             $this->mInfo['data'] = str_replace("\n", "\\n", $this->mInfo['data']);
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #8
0
 /**
  * Load the data from the database
  * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash
  **/
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     if ($this->verifyId($this->mStencilId) || $this->verifyId($this->mContentId)) {
         $lookupColumn = $this->verifyId($this->mStencilId) ? 'stencil_id' : 'content_id';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mStencilId) ? $this->mStencilId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "SELECT sten.*, lc.*,\n\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name\n\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "stencils` sten\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = sten.`content_id` ) {$joinSql}\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )\n\t\t\t\tWHERE sten.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mStencilId = $result->fields['stencil_id'];
             $this->mInfo['creator'] = isset($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = isset($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['parsed_data'] = $this->parseData();
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #9
0
 /**
  * load the treasury item
  *
  * @param $pPluginParams parameters passed on to the plugin during laod
  * @return bool TRUE on success, FALSE if it's not valid
  * @access public
  **/
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     if (@BitBase::verifyId($this->mContentId)) {
         global $gBitSystem;
         $ret = array();
         $selectSql = $joinSql = $orderSql = '';
         if (@BitBase::verifyId($this->mContentId)) {
             $whereSql = " WHERE trm.`item_content_id` = ? ";
             $bindVars[] = $this->mContentId;
         }
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $ret = array();
         $query = "\n\t\t\t\tSELECT\n\t\t\t\t\tlct.`content_name`,\n\t\t\t\t\tuu.`login`, uu.`real_name`,\n\t\t\t\t\tlc.`content_id`, lc.`format_guid`, lc.`last_modified`, lc.`user_id`, lc.`title`, lc.`content_type_guid`, lc.`created`, lc.`data`,\n\t\t\t\t\tlch.`hits`\n\t\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "treasury_map` trm\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON ( lc.`content_id` = trm.`item_content_id` )\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content_types` lct ON ( lc.`content_type_guid` = lct.`content_type_guid` )\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "users_users` uu ON ( uu.`user_id` = lc.`user_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_hits` lch ON ( lch.`content_id` = lc.`content_id` )\n\t\t\t\t{$joinSql} {$whereSql} {$orderSql}";
         if ($aux = $this->mDb->getRow($query, $bindVars)) {
             $this->mContentId = $aux['content_id'];
             $this->mInfo = $aux;
             $this->mInfo['title'] = $this->getTitleFromHash($aux);
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             // LibertyMime will load the attachment details
             LibertyMime::load(NULL, $pPluginParams);
             // parse the data after parent load so we have our html prefs
             $this->mInfo['parsed_data'] = $this->parseData();
             // copy mStorage to mInfo for easy access
             if (!empty($this->mStorage) && count($this->mStorage) > 0) {
                 reset($this->mStorage);
                 $this->mInfo = array_merge(current($this->mStorage), $this->mInfo);
             }
             // TODO: take comments on a gallery basis
             // work out if this gallery takes comments
             //$this->mInfo['allow_comments'] = $gBitSystem->isFeatureActive( "treasury_".$this->mInfo['attachment_plugin_guid']."_comments" );
         } else {
             // null the content id if load was unsuccessful
             $this->mContentId = NULL;
         }
     }
     return count($this->mInfo);
 }
Beispiel #10
0
 /**
  * Load the data from the database
  * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash
  **/
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     global $gBitSystem;
     if ($this->verifyId($this->mEventsId) || $this->verifyId($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $lookupColumn = $this->verifyId($this->mEventsId) ? 'events_id' : 'content_id';
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mEventsId) ? $this->mEventsId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "SELECT e.*, et.`name` as `type_name`, lc.*, " . "uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, " . "uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name " . "{$selectSql} " . "FROM `" . BIT_DB_PREFIX . "events` e " . "LEFT JOIN `" . BIT_DB_PREFIX . "events_types` et ON (e.`type_id` = et.`type_id`)" . "INNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = e.`content_id` ) {$joinSql}" . "LEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )" . "LEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )" . "WHERE e.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mEventsId = $result->fields['events_id'];
             $this->mInfo['creator'] = isset($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = isset($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['parsed_data'] = $this->parseData($this->mInfo['data'], $this->mInfo['format_guid']);
             $prefChecks = array('show_start_time', 'show_end_time');
             foreach ($prefChecks as $key => $var) {
                 if ($this->getPreference($var) == 'on') {
                     $this->mInfo[$var] = 1;
                 } else {
                     $this->mInfo[$var] = 0;
                 }
             }
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #11
0
 function load()
 {
     if (!empty($this->mOverlayId) || !empty($this->mContentId)) {
         $overlayKey = $this->mOverlayType . '_id';
         $lookupColumn = !empty($this->mOverlayId) ? $overlayKey : 'content_id';
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mOverlayId) ? $this->mOverlayId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "select ot.*, lc.*, ufm.`favorite_content_id`, ufm.`map_position`,\n\t\t\t\t\t  uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\t\t  uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name,\n\t\t\t\t\t  lf.storage_path AS `image_attachment_path` {$selectSql}\n\t\t\t\t\t  FROM `" . BIT_DB_PREFIX . $this->mOverlayTable . "` ot\n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = ot.`content_id`) {$joinSql}\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_favorites_map` ufm ON ( lc.`content_id`=ufm.`favorite_content_id` )\n\t\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` la ON( la.`content_id` = lc.`content_id` AND la.`is_primary` = 'y' )\n\t\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lf ON( lf.`file_id` = la.`foreign_id` )\n\t\t\t\t\t  WHERE ot.`{$lookupColumn}`=? {$whereSql}";
         if ($this->mInfo = $this->mDb->getRow($query, $bindVars)) {
             $this->mInfo['thumbnail_url'] = liberty_fetch_thumbnails(array("storage_path" => $this->mInfo['image_attachment_path']));
             $this->mOverlayId = $this->mInfo[$overlayKey];
             $this->mContentId = $this->mInfo['content_id'];
             $this->mInfo['raw'] = $this->mInfo['data'];
             $parseHash['data'] = $this->mInfo['data'];
             $this->prepParseFilters($parseHash);
             // @TODO this has gone through many changes and this looks a bit chaotic - might be able to simplify this
             $this->mInfo['xml_parsed_data'] = $this->parseData($parseHash, $this->mInfo['format_guid']);
             $this->mInfo['parsed_data'] = $this->parseData($parseHash, $this->mInfo['format_guid']);
             $this->mInfo['clean_data'] = $this->mInfo['parsed_data'];
             $this->mInfo['parsed_data'] = addslashes($this->mInfo['parsed_data']);
             $this->mInfo['xml_data'] = str_replace("\n", "
", $this->mInfo['data']);
             $this->mInfo['data'] = addslashes($this->mInfo['data']);
             $this->mInfo['data'] = str_replace("\n", "\\n", $this->mInfo['data']);
             // to support html in labels
             $this->mInfo['parsed_label_data'] = $this->parseData($this->mInfo['label_data'], $this->mInfo['format_guid']);
             $comment = new LibertyComment();
             $this->mInfo['num_comments'] = $comment->getNumComments($this->mInfo['content_id']);
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #12
0
 /**
  * Load the data from the database
  * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash
  **/
 function load($pFull = TRUE)
 {
     if (!empty($this->mGmapId) || !empty($this->mContentId)) {
         $lookupColumn = !empty($this->mGmapId) ? 'gmap_id' : 'content_id';
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mGmapId) ? $this->mGmapId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "select bm.*, lc.*, lcds.`data` AS `summary`,\n\t\t\t\t\t  uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\t\t  uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name {$selectSql}\n\t\t\t\t\t  FROM `" . BIT_DB_PREFIX . "gmaps` bm\n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = bm.`content_id`) {$joinSql}\n\t\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_data` lcds ON (lc.`content_id` = lcds.`content_id` AND lcds.`data_type`='summary')\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\n\t\t\t\t\t  WHERE bm.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mGmapId = $result->fields['gmap_id'];
             $this->mContentId = $result->fields['content_id'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['raw'] = $this->mInfo['data'];
             $this->mInfo['xml_parsed_data'] = $this->parseData($this->mInfo['data'], $this->mInfo['format_guid']);
             $this->mInfo['parsed_data'] = $this->parseData($this->mInfo['data'], $this->mInfo['format_guid']);
             $this->mInfo['clean_data'] = $this->mInfo['parsed_data'];
             $this->mInfo['parsed_data'] = addslashes($this->mInfo['parsed_data']);
             $this->mInfo['xml_data'] = str_replace("\n", "
", $this->mInfo['data']);
             $this->mInfo['data'] = addslashes($this->mInfo['data']);
             $this->mInfo['data'] = str_replace("\n", "\\n", $this->mInfo['data']);
             parent::load();
             if ($pFull) {
                 $this->mMapTypes = $this->getMapTypes($lookupId);
                 $this->mTilelayers = $this->getTilelayers($lookupId);
                 $this->mCopyrights = $this->getCopyrights($lookupId);
                 //@TODO should prolly find a better way to deal with large numbers of markers - like when +1000
                 $joinHash = array('gmap_id' => $this->mGmapId, 'max_records' => 9999, 'sort_mode' => 'pos_asc');
                 require_once GMAP_PKG_PATH . 'BitGmapMarker.php';
                 $marker = new BitGmapMarker();
                 $markersList = $marker->getList($joinHash);
                 $this->mMapMarkers = $markersList['data'];
                 require_once GMAP_PKG_PATH . 'BitGmapMarkerSet.php';
                 $markerSet = new BitGmapMarkerSet();
                 $markerSetsList = $markerSet->getList($joinHash);
                 $this->mMapMarkerSets = $markerSetsList['data'];
                 $this->mMapMarkerStyles = $this->getMarkerStyles($lookupId);
                 $this->mMapIconStyles = $this->getIconStyles($lookupId);
                 require_once GMAP_PKG_PATH . 'BitGmapPolyline.php';
                 $polyline = new BitGmapPolyline();
                 $polylinesList = $polyline->getList($joinHash);
                 $this->mMapPolylines = $polylinesList['data'];
                 require_once GMAP_PKG_PATH . 'BitGmapPolylineSet.php';
                 $polylineSet = new BitGmapPolylineSet();
                 $polylineSetsList = $polylineSet->getList($joinHash);
                 $this->mMapPolylineSets = $polylineSetsList['data'];
                 $lineListHash = array('gmap_id' => $lookupId);
                 $this->mMapPolylineStyles = $this->getPolylineStyles($lineListHash);
                 require_once GMAP_PKG_PATH . 'BitGmapPolygon.php';
                 $polygon = new BitGmapPolygon();
                 $polygonsList = $polygon->getList($joinHash);
                 $this->mMapPolygons = $polygonsList['data'];
                 require_once GMAP_PKG_PATH . 'BitGmapPolygonSet.php';
                 $polygonSet = new BitGmapPolygonSet();
                 $polygonSetsList = $polygonSet->getList($joinHash);
                 $this->mMapPolygonSets = $polygonSetsList['data'];
                 $polyListHash = array('gmap_id' => $lookupId);
                 $this->mMapPolygonStyles = $this->getPolygonStyles($polyListHash);
             }
         }
     }
     return count($this->mInfo);
 }
Beispiel #13
0
 /**
  * load the pigeonhole
  * @param $pExtras boolean - if set to true, pigeonhole content is added as well
  * @return bool TRUE on success, FALSE if it's not valid
  * @access public
  **/
 function load($pExtras = FALSE, $pLoadAttachable = TRUE)
 {
     if (@BitBase::verifyId($this->mContentId) || @BitBase::verifyId($this->mStructureId)) {
         global $gBitSystem;
         $lookupColumn = @BitBase::verifyId($this->mContentId) ? 'lc.`content_id`' : 'ls.`structure_id`';
         $lookupId = @BitBase::verifyId($this->mContentId) ? $this->mContentId : $this->mStructureId;
         $query = "SELECT pig.*, ls.`root_structure_id`, ls.`parent_id`, lc.`title`, lc.`data`,\n\t\t\t\tlc.`user_id`, lc.`content_type_guid`, lc.`format_guid`,\n\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "pigeonholes` pig\n\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON ( lc.`content_id` = pig.`content_id` )\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "liberty_structures` ls ON ( ls.`structure_id` = pig.`structure_id` )\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON ( uue.`user_id` = lc.`modifier_user_id` )\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON ( uuc.`user_id` = lc.`user_id` )\n\t\t\t\tWHERE {$lookupColumn}=?";
         $result = $this->mDb->query($query, array($lookupId));
         if ($result && ($row = $result->fetchRow())) {
             $this->mInfo = $row;
             $this->mContentId = $row['content_id'];
             $this->mStructureId = $row['structure_id'];
             $this->mInfo['user'] = $row['creator_user'];
             $this->mInfo['real_name'] = isset($row['creator_real_name']) ? $row['creator_real_name'] : $row['creator_user'];
             $this->mInfo['display_name'] = BitUser::getTitleFromHash($this->mInfo);
             $this->mInfo['editor'] = isset($row['modifier_real_name']) ? $row['modifier_real_name'] : $row['modifier_user'];
             $this->mInfo['display_link'] = $this->getDisplayLink();
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['parsed_data'] = $this->parseData($row);
         }
         if ($pLoadAttachable) {
             LibertyMime::load();
         }
         // if the content for the pigeonhole is requested, get it
         if ($pExtras) {
             $this->mInfo['path'] = $this->getPigeonholePath();
             $this->mInfo['display_path'] = $this->getDisplayPath($this->mInfo['path']);
             $memberHash = array('max_records' => -1);
             $this->mInfo['members'] = $this->getMemberList($memberHash);
             $this->mInfo['members_count'] = count($this->mInfo['members']);
         }
     }
     return count($this->mInfo);
 }
Beispiel #14
0
 /**
  * Load the data from the database
  * @param pParamHash be sure to pass by reference in case we need to make modifcations to the hash
  **/
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     global $gBitUser, $gBitSystem;
     if ($this->verifyId($this->mRootId) || $this->verifyId($this->mContentId)) {
         // This is a significant performance optimization
         $lookupColumn = $this->verifyId($this->mRootId) ? 'lcom.`comment_id`' : 'lc.`content_id`';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mRootId) ? $this->mRootId : $this->mContentId);
         $paramHash = array(array('include_comments' => TRUE));
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars, $this, $paramHash);
         if (!($gBitUser->hasPermission('p_boards_update') || $gBitUser->hasPermission('p_boards_posts_update'))) {
             //$whereSql .= " AND ((first.`is_approved` = 1) OR (flc.`user_id` >= 0))";
         }
         BitBoardTopic::loadTrack($selectSql, $joinSql);
         $BIT_DB_PREFIX = BIT_DB_PREFIX;
         $query = "\n\t\t\t\tSELECT\n\t\t\t\t\tlc.`user_id` AS flc_user_id,\n\t\t\t\t\tlc.`created` AS flc_created,\n\t\t\t\t\tlc.`last_modified` AS flc_last_modified,\n\t\t\t\t\tlc.`title` AS title,\n\t\t\t\t\tlc.`content_id` AS flc_content_id,\n\n\t\t\t\t\tCOALESCE(post.`is_approved`,0) AS first_approved,\n\t\t\t\t\tlcom.`anon_name`,\n\n\t\t\t\t\tth.`parent_id` AS th_first_id,\n\t\t\t\t\tCOALESCE(th.`is_locked`,0) AS th_is_locked,\n\t\t\t\t\tCOALESCE(th.`is_moved`,0) AS th_is_moved,\n\t\t\t\t\tCOALESCE(th.`is_sticky`,0) AS th_is_sticky,\n\n\t\t\t\t\tlcom.`comment_id` AS th_thread_id,\n\t\t\t\t\tlcom.`root_id` AS th_root_id,\n\t\t\t\t\tlcom.`root_id` AS content_id,\n\t\t\t\t\tlc.`content_type_guid` AS content_type_guid,\n\n\t\t\t\t\trlc.content_id AS root_content_id, rlc.title AS root_title, rlc.content_type_guid AS `root_content_type_guid`,\n\n\t\t\t\t\tmap.`board_content_id` AS board_content_id, b.`board_id`\n\n\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "liberty_comments` lcom\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = lcom.`content_id` )\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "boards_map` map ON (map.`topic_content_id`=lcom.`root_id` )\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "boards` b ON (map.`board_content_id`=b.`content_id` )\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` rlc ON (rlc.`content_id` = lcom.`root_id`)\n\t\t\t\t{$joinSql}\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "boards_topics` th ON (th.`parent_id`=lcom.`content_id`)\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "boards_posts` post ON(post.`comment_id`=lcom.`comment_id`)\n\t\t\t\tWHERE\n\t\t\t\t\tlcom.`root_id`=lcom.`parent_id` AND\t{$lookupColumn}=?\n\t\t\t\t{$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $this->getField('content_id');
             $this->mCommentContentId = $this->getField('flc_content_id');
             $llc_data = BitBoardTopic::getLastPost($this->mInfo);
             $this->mInfo = array_merge($this->mInfo, $llc_data);
             $this->mRootId = $result->fields['th_thread_id'];
             // @TODO this would make more sense if this were assigned to mRootId - but that is currently in use as top comment id
             $this->mInfo['root_id'] = $result->fields['th_root_id'];
             BitBoardTopic::track($this->mInfo);
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             if (empty($this->mInfo['anon_name'])) {
                 $this->mInfo['anon_name'] = "Anonymous";
             }
             parent::load();
             // assumes you have joined already, and will not execute any sql!
         }
     }
     return count($this->mInfo);
 }
Beispiel #15
0
 /**
  * Load a Blog Post section
  */
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     if ($this->verifyId($this->mPostId) || $this->verifyId($this->mContentId)) {
         global $gBitSystem, $gBitUser, $gLibertySystem;
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         $lookupColumn = $this->verifyId($this->mPostId) ? 'post_id' : 'content_id';
         $lookupId = $this->verifyId($this->mPostId) ? $this->mPostId : $this->mContentId;
         array_push($bindVars, $lookupId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "\n\t\t\t\tSELECT bp.*, lc.*, lcds.`data` AS `summary`, lch.`hits`, uu.`login`, uu.`real_name`,\n\t\t\t\t\tlfa.`file_name` as `avatar_file_name`, lfa.`mime_type` AS `avatar_mime_type`, laa.`attachment_id` AS `avatar_attachment_id`,\n\t\t\t\t\tlfp.`file_name` AS `image_file_name`, lfp.`mime_type` AS `image_mime_type`, lap.`attachment_id` AS `image_attachment_id`\n\t\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "blog_posts` bp\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = bp.`content_id`)\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "users_users` uu ON( uu.`user_id` = lc.`user_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_data` lcds ON (lc.`content_id` = lcds.`content_id` AND lcds.`data_type`='summary')\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_hits` lch ON( lch.`content_id` = lc.`content_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` laa ON (uu.`user_id` = laa.`user_id` AND uu.`avatar_attachment_id`=laa.`attachment_id`)\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lfa ON (lfa.`file_id` = laa.`foreign_id`)\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` lap ON( lap.`content_id` = lc.`content_id` AND lap.`is_primary` = 'y' )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lfp ON( lfp.`file_id` = lap.`foreign_id` )\n\t\t\t\t\t{$joinSql}\n\t\t\t\tWHERE bp.`{$lookupColumn}`=? {$whereSql} ";
         if ($this->mInfo = $this->mDb->getRow($query, $bindVars)) {
             $this->mPostId = $this->mInfo['post_id'];
             $this->mContentId = $this->mInfo['content_id'];
             $this->mInfo['blogs'] = $this->getBlogMemberships($this->mContentId);
             // this is bad news right here, 'url' is wrong, standard is 'display_url'
             // we should remove this now that display_url is added
             $this->mInfo['url'] = BitBlogPost::getDisplayUrlFromHash($this->mInfo);
             $this->mInfo['display_url'] = BitBlogPost::getDisplayUrlFromHash($this->mInfo);
             foreach (array('avatar', 'image') as $img) {
                 $this->mInfo[$img] = liberty_fetch_thumbnails(array('source_file' => $this->getSourceFile(array('user_id' => $this->getField('user_id'), 'package' => liberty_mime_get_storage_sub_dir_name(array('mime_type' => $this->getField($img . '_mime_type'), 'name' => $this->getField($img . '_file_name'))), 'file_name' => basename($this->mInfo[$img . '_file_name']), 'sub_dir' => $this->getField($img . '_attachment_id')))));
             }
             $this->mInfo['raw'] = $this->mInfo['data'];
             //for two text field auto split
             if ($gBitSystem->isFeatureActive('blog_posts_autosplit') && preg_match(LIBERTY_SPLIT_REGEX, $this->mInfo['raw'])) {
                 $format = $this->mInfo['format_guid'];
                 $linebreak = $gLibertySystem->mPlugins[$format]['linebreak'];
                 if (preg_match("/\\.{3}split\\.{3}(" . preg_quote($linebreak, "/") . "){2}/i", $this->mInfo['raw'])) {
                     $parts = preg_split("/\\.{3}split\\.{3}(" . preg_quote($linebreak, "/") . "){2}/i", $this->mInfo['raw']);
                 } else {
                     $parts = preg_split("/\\.{3}split\\.{3}/i", $this->mInfo['raw']);
                 }
                 $this->mInfo['raw'] = isset($parts[0]) ? $parts[0] : $this->mInfo['raw'];
                 $this->mInfo['raw_more'] = isset($parts[1]) ? $parts[1] : NULL;
             }
             $this->mInfo['data'] = preg_replace(LIBERTY_SPLIT_REGEX, "", $this->mInfo['data']);
             $this->mInfo['use_title'] = $gBitUser->getPreference('user_blog_posts_use_title', 'y', $this->mInfo['user_id']);
             if (isset($pPluginParams['load_comments']) and $pPluginParams['load_comments']) {
                 $comment = new LibertyComment();
                 $comment->mRootObj = $this;
                 $this->mInfo['num_comments'] = $comment->getNumComments($this->mInfo['content_id']);
                 // Get the comments associated with this post
                 $this->mInfo['comments'] = $comment->getComments($this->mInfo['content_id'], $gBitSystem->getConfig('comments_per_page', 10));
             }
             if (!$this->mInfo['trackbacks_from'] || $this->mInfo['trackbacks_from'] === null) {
                 $this->mInfo['trackbacks_from'] = serialize(array());
             }
             if (!$this->mInfo['trackbacks_to'] || $this->mInfo['trackbacks_to'] === null) {
                 $this->mInfo['trackbacks_to'] = serialize(array());
             }
             $this->mInfo['trackbacks_from_count'] = count(array_keys(unserialize($this->mInfo['trackbacks_from'])));
             $this->mInfo['trackbacks_from'] = unserialize($this->mInfo['trackbacks_from']);
             $this->mInfo['trackbacks_to'] = unserialize($this->mInfo['trackbacks_to']);
             $this->mInfo['trackbacks_to_count'] = count($this->mInfo['trackbacks_to']);
             LibertyMime::load();
             if ($this->mStorage) {
                 foreach (array_keys($this->mStorage) as $key) {
                     $this->mStorage[$key]['wiki_plugin_link'] = '{attachment id=' . $key . '}';
                 }
             }
         } else {
             $this->mPostId = NULL;
             $this->mContentId = NULL;
         }
     }
     return count($this->mInfo);
 }
Beispiel #16
0
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     if ($this->isValid()) {
         global $gBitSystem;
         $gateSql = NULL;
         $selectSql = $joinSql = $whereSql = '';
         $bindVars = array();
         if (@$this->verifyId($this->mImageId)) {
             $whereSql = " WHERE fi.`image_id` = ?";
             $bindVars[] = $this->mImageId;
         } elseif (@$this->verifyId($this->mContentId)) {
             $whereSql = " WHERE fi.`content_id` = ?";
             $bindVars[] = $this->mContentId;
         }
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $sql = "SELECT fi.*, lc.* {$gateSql} {$selectSql}\n\t\t\t\t\t\t, uue.`login` AS `modifier_user`, uue.`real_name` AS `modifier_real_name`\n\t\t\t\t\t\t, uuc.`login` AS `creator_user`, uuc.`real_name` AS `creator_real_name`, ufm.`favorite_content_id` AS `is_favorite`\n\t\t\t\t\t\t, lch.`hits`\n\t\t\t\t\tFROM `" . BIT_DB_PREFIX . "fisheye_image` fi\n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = fi.`content_id`)\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\n\t\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_favorites_map` ufm ON (ufm.`favorite_content_id`=lc.`content_id` AND ufm.`user_id`=uuc.`user_id`)\n\t\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_hits` lch ON ( lch.`content_id` = lc.`content_id` ) {$joinSql}\n\t\t\t\t\t{$whereSql}";
         if ($this->mInfo = $this->mDb->getRow($sql, $bindVars)) {
             $this->mImageId = $this->mInfo['image_id'];
             $this->mContentId = $this->mInfo['content_id'];
             $this->mInfo['creator'] = isset($this->mInfo['creator_real_name']) ? $this->mInfo['creator_real_name'] : $this->mInfo['creator_user'];
             $this->mInfo['editor'] = isset($this->mInfo['modifier_real_name']) ? $this->mInfo['modifier_real_name'] : $this->mInfo['modifier_user'];
             if ($gBitSystem->isPackageActive('gatekeeper') && !@$this->verifyId($this->mInfo['security_id'])) {
                 // check to see if this image is in a protected gallery
                 // this burns an extra select but avoids an big and gnarly LEFT JOIN sequence that may be hard to optimize on all DB's
                 $query = "SELECT ls.* FROM `" . BIT_DB_PREFIX . "fisheye_gallery_image_map` fgim\n\t\t\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "gatekeeper_security_map` tsm ON(fgim.`gallery_content_id`=tsm.`content_id` )\n\t\t\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "gatekeeper_security` ls ON(tsm.`security_id`=ls.`security_id` )\n\t\t\t\t\t\t\t  WHERE fgim.`item_content_id`=?";
                 $grs = $this->mDb->query($query, array($this->mContentId));
                 if ($grs && $grs->RecordCount()) {
                     // order matters here
                     $this->mInfo = array_merge($grs->fields, $this->mInfo);
                 }
             }
             // LibertyMime will load the attachment details in $this->mStorage
             LibertyMime::load(NULL, $pPluginParams);
             // parse the data after parent load so we have our html prefs
             $this->mInfo['parsed_data'] = $this->parseData();
             // Copy mStorage to mInfo['image_file'] for easy access
             if (!empty($this->mStorage) && count($this->mStorage) > 0) {
                 // it seems that this is not necessary and causes confusing copies of the same stuff all over the place
                 $this->mInfo = array_merge(current($this->mStorage), $this->mInfo);
                 // copy the image data by reference to reduce memory
                 reset($this->mStorage);
                 $this->mInfo['image_file'] = current($this->mStorage);
                 // override original display_url that mime knows where we keep the image
                 $this->mInfo['image_file']['display_url'] = $this->getDisplayUrl();
             } else {
                 $this->mInfo['image_file'] = NULL;
             }
             if (empty($this->mInfo['width']) || empty($this->mInfo['height'])) {
                 $details = $this->getImageDetails();
                 // bounds checking on the width and height - corrupt photos can be ridiculously huge or negative
                 if (!empty($details) and $details['width'] > 0 and $details['width'] < 9999 and $details['height'] > 0 and $details['height'] < 9999) {
                     $this->mInfo['width'] = $details['width'];
                     $this->mInfo['height'] = $details['height'];
                     $this->mDb->query("UPDATE `" . BIT_DB_PREFIX . "fisheye_image` SET `width`=?, `height`=? WHERE `content_id`=?", array($this->mInfo['width'], $this->mInfo['height'], $this->mContentId));
                 }
             }
         }
         $ret = count($this->mInfo);
     } else {
         // We don't have an image_id or a content_id so there is no way to know what to load
         $ret = NULL;
     }
     return $ret;
 }
Beispiel #17
0
 function getBlog($pBlogId, $pContentId = NULL)
 {
     global $gBitSystem;
     $ret = NULL;
     $lookupId = !empty($pBlogId) ? $pBlogId : $pContentId;
     $lookupColumn = !empty($pBlogId) ? 'blog_id' : 'content_id';
     $bindVars = array((int) $lookupId);
     $selectSql = '';
     $joinSql = '';
     $whereSql = '';
     $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
     if (BitBase::verifyId($lookupId)) {
         $query = "\n\t\t\t\tSELECT b.*, lc.*, lch.`hits`, uu.`login`, uu.`login`, uu.`user_id`, uu.`real_name`,\n\t\t\t\t\tlfa.`file_name` as `avatar_file_name`, lfa.`mime_type` AS `avatar_mime_type`, laa.`attachment_id` AS `avatar_attachment_id`,\n\t\t\t\t\tlfp.`file_name` AS `image_file_name`, lfp.`mime_type` AS `image_mime_type`, lap.`attachment_id` AS `image_attachment_id`\n\t\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "blogs` b\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = b.`content_id`)\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "users_users` uu ON (uu.`user_id` = lc.`user_id`)\n\t\t\t\t\t{$joinSql}\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_hits` lch ON (lc.`content_id` = lch.`content_id`)\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments`\tlaa ON (uu.`user_id` = laa.`user_id` AND laa.`attachment_id` = uu.`avatar_attachment_id`)\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files`\t    lfa ON lfa.`file_id`\t\t   = laa.`foreign_id`\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments`  lap ON lap.`content_id`        = lc.`content_id` AND lap.`is_primary` = 'y'\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files`        lfp ON lfp.`file_id`           = lap.`foreign_id`\n\t\t\t\tWHERE b.`{$lookupColumn}`= ? {$whereSql}";
         if ($this->mInfo = $this->mDb->getRow($query, $bindVars)) {
             $this->mContentId = $this->getField('content_id');
             $this->mBlogId = $this->getField('blog_id');
             foreach (array('avatar', 'image') as $img) {
                 $this->mInfo[$img] = liberty_fetch_thumbnails(array('source_file' => $this->getSourceFile(array('user_id' => $this->getField('user_id'), 'package' => liberty_mime_get_storage_sub_dir_name(array('type' => $this->getField($img . '_mime_type'), 'name' => $this->getField($img . '_file_name'))), 'file_name' => basename($this->mInfo[$img . '_file_name']), 'sub_dir' => $this->getField($img . '_attachment_id')))));
             }
             parent::load();
             $this->mInfo['postscant'] = $this->getPostsCount($this->mContentId);
         }
     }
     return count($this->mInfo) != 0;
 }
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     if ($this->verifyId($this->mEditionId) || $this->verifyId($this->mContentId)) {
         global $gBitSystem;
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         $lookupColumn = $this->verifyId($this->mEditionId) ? 'edition_id' : 'content_id';
         $lookupId = $this->verifyId($this->mEditionId) ? $this->mEditionId : $this->mContentId;
         array_push($bindVars, $lookupId);
         $this->getServicesSql('content_load_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "SELECT ne.*, lc.*\n\t\t\t\t\t  FROM `" . BIT_DB_PREFIX . "newsletters_editions` ne\n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( ne.`content_id`=lc.`content_id` )\n\t\t\t\t\t  WHERE ne.`{$lookupColumn}`=? {$whereSql}";
         if ($result = $this->mDb->query($query, $bindVars)) {
             $this->mInfo = $result->fetchRow();
             $this->mEditionId = $this->mInfo['edition_id'];
             $this->mContentId = $this->mInfo['content_id'];
             LibertyMime::load();
             $this->mNewsletter = new BitNewsletter(NULL, $this->mInfo['nl_content_id']);
             $this->mNewsletter->load();
         } else {
             unset($this->mEditionId);
         }
     }
     return count($this->mInfo);
 }
Beispiel #19
0
 /**
  * Load the data from the database
  **/
 function load()
 {
     if ($this->verifyId($this->mGroupId) || $this->verifyId($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $lookupColumn = $this->verifyId($this->mGroupId) ? 'group_id' : 'content_id';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mGroupId) ? $this->mGroupId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "SELECT s.*, lc.*, lcds.`data` AS `summary`, lcda.`data` AS `after_registration`, ug.*, " . "lfp.file_name AS `image_attachment_path`, " . "uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, " . "uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name, " . "brd.`board_id`" . "{$selectSql} " . "FROM `" . BIT_DB_PREFIX . "groups` s " . "INNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = s.`content_id` ) {$joinSql}" . "INNER JOIN `" . BIT_DB_PREFIX . "users_groups` ug ON( ug.`group_id` = s.`group_id` ) " . "LEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_data` lcds ON (lc.`content_id` = lcds.`content_id` AND lcds.`data_type`='summary')" . "LEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_data` lcda ON (lc.`content_id` = lcda.`content_id` AND lcda.`data_type`='after_registration')" . "LEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` la ON( la.`content_id` = lc.`content_id` AND la.`is_primary` = 'y' )" . "LEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lfp ON( lfp.`file_id` = la.`foreign_id` )" . "LEFT OUTER JOIN `" . BIT_DB_PREFIX . "groups_content_cnxn_map` gccm ON ( lc.`content_id` = gccm.`group_content_id` )" . "INNER JOIN `" . BIT_DB_PREFIX . "boards` brd ON (gccm.`to_content_id` = brd.`content_id`)" . "LEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )" . "LEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )" . "WHERE s.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mGroupId = $result->fields['group_id'];
             $this->mInfo['creator'] = isset($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = isset($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['display_urls'] = $this->getDisplayUrls();
             $this->mInfo['parsed_data'] = $this->parseData();
             $this->mInfo['num_members'] = $this->getMembersCount($this->mGroupId);
             $this->mInfo['thumbnail_url'] = liberty_fetch_thumbnails(array("storage_path" => $this->mInfo['image_attachment_path']));
             $this->mContentTypePrefs = $this->getContentTypePrefs();
             $this->mContentTypeData = $this->getContentTypeData();
             // sets $this->mGroupMemberPermissions
             $this->getMemberRolesAndPermsForGroup();
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #20
0
 /**
  * load Load the data from the database
  * 
  * @access public
  * @return boolean TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function load()
 {
     if ($this->verifyId($this->mTicketId) || $this->verifyId($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $lookupColumn = $this->verifyId($this->mTicketId) ? 'ticket_id' : 'content_id';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mTicketId) ? $this->mTicketId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "\n\t\t\t\tSELECT t.*, lc.*,\n\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name,\n\t\t\t\tlcm.`title` AS milestone_title\n\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "tickets` t\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = t.`content_id` ) {$joinSql}\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "liberty_content` lcm ON( lc.`content_id` = t.`milestone_id` )\n\t\t\t\tWHERE t.`{$lookupColumn}`=? {$whereSql}";
         $attrQuery = "SELECT ta.*, tf.`def_id`, tf.`field_id`, tf.`field_value`, td.`title` AS def_title\n                FROM `" . BIT_DB_PREFIX . "ticket_attributes` ta\n                    LEFT JOIN `" . BIT_DB_PREFIX . "ticket_field_values` tf ON( ta.`field_id` = tf.`field_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "ticket_field_defs` td ON( tf.`def_id` = td.`def_id` )\n                WHERE ta.`ticket_id`=?";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mTicketId = $result->fields['ticket_id'];
             $this->mMilestone['milestone_id'] = $result->fields['milestone_id'];
             $this->mMilestone['title'] = $result->fields['milestone_title'];
             $this->mInfo['creator'] = !empty($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = !empty($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_name'] = BitUser::getTitleFromHash($this->mInfo);
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['parsed_data'] = $this->parseData();
             $attrResult = $this->mDb->query($attrQuery, array($this->mTicketId));
             while ($row = $attrResult->fetchRow()) {
                 $this->mAttributes[$row["def_id"]] = $row;
             }
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #21
0
 /**
  * load - loads all settings & preferences for this user
  *
  * @param boolean $pFull Load additional user data like
  * @param string $pUserName User login name
  * @access public
  * @author Chrstian Fowler <*****@*****.**>
  * @return returnString
  */
 function load($pFull = TRUE, $pUserName = NULL)
 {
     global $gBitSystem;
     $this->mInfo = NULL;
     if (isset($this->mUserId)) {
         $whereSql = "WHERE uu.`user_id`=?";
         $bindVars = array($this->mUserId);
     } elseif (isset($this->mContentId)) {
         $whereSql = "WHERE uu.`content_id`=?";
         $bindVars = array($this->mContentId);
     } elseif (!empty($pUserName)) {
         $whereSql = "WHERE uu.`login`=?";
         $bindVars = array($pUserName);
     }
     if (isset($whereSql)) {
         $fullSelect = '';
         $fullJoin = '';
         if ($pFull) {
             $fullSelect = ' , lc.* ';
             $fullJoin = " LEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON ( uu.`content_id`=lc.`content_id` )";
             $this->getServicesSql('content_load_sql_function', $fullSelect, $fullJoin, $whereSql, $bindVars);
         }
         // uu.`user_id` AS `uu_user_id` is last and aliases to avoid possible column name collisions
         $query = "\n\t\t\t\tSELECT uu.*,\n\t\t\t\t\t\tlf_ava.`file_name` AS `avatar_file_name`,  la_ava.`attachment_id` AS `avatar_attachment_id`, lf_ava.`mime_type` AS `avatar_mime_type`,\n\t\t\t\t\t\tlf_por.`file_name` AS `portrait_file_name`, ta_por.`attachment_id` AS `portrait_attachment_id`, lf_por.`mime_type` AS `portrait_mime_type`,\n\t\t\t\t\t\tlf_logo.`file_name` AS `logo_file_name`, ta_logo.`attachment_id` AS `logo_attachment_id`, lf_logo.`mime_type` AS `logo_mime_type`\n\t\t\t\t\t  {$fullSelect}, uu.`user_id` AS `uu_user_id`\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "users_users` uu\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` la_ava ON ( uu.`avatar_attachment_id`=la_ava.`attachment_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lf_ava ON ( lf_ava.`file_id`=la_ava.`foreign_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` ta_por ON ( uu.`portrait_attachment_id`=ta_por.`attachment_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lf_por ON ( lf_por.`file_id`=ta_por.`foreign_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` ta_logo ON ( uu.`logo_attachment_id`=ta_logo.`attachment_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lf_logo ON ( lf_logo.`file_id`=ta_logo.`foreign_id` )\n\t\t\t\t\t{$fullJoin}\n\t\t\t\t{$whereSql}";
         if (($result = $this->mDb->query($query, $bindVars)) && $result->numRows()) {
             $this->mInfo = $result->fetchRow();
             $this->mInfo['user'] = $this->mInfo['login'];
             $this->mInfo['valid'] = @$this->verifyId($this->mInfo['uu_user_id']);
             $this->mInfo['user_id'] = $this->mInfo['uu_user_id'];
             $this->mInfo['is_registered'] = $this->isRegistered();
             foreach (array('portrait', 'avatar', 'logo') as $img) {
                 $this->mInfo[$img . '_path'] = $this->getSourceFile(array('user_id' => $this->getField('user_id'), 'package' => liberty_mime_get_storage_sub_dir_name(array('mime_type' => $this->getField($img . '_mime_type'), 'name' => $this->getField($img . '_file_name'))), 'file_name' => basename($this->mInfo[$img . '_file_name']), 'sub_dir' => $this->getField($img . '_attachment_id'), 'mime_type' => $this->getField($img . '_mime_type')));
                 $this->mInfo[$img . '_url'] = liberty_fetch_thumbnail_url(array('source_file' => $this->mInfo[$img . '_path'], 'size' => 'small', 'mime_image' => FALSE));
             }
             // break the real name into first and last name using the last space as the beginning of the last name
             // for people who really want to use first and last name fields
             if (preg_match('/ /', $this->mInfo['real_name'])) {
                 $this->mInfo['first_name'] = substr($this->mInfo['real_name'], 0, strrpos($this->mInfo['real_name'], ' '));
                 $this->mInfo['last_name'] = substr($this->mInfo['real_name'], strrpos($this->mInfo['real_name'], ' ') + 1);
             } else {
                 // no spaces assign the real name to the first name
                 $this->mInfo['first_name'] = $this->mInfo['real_name'];
             }
             $this->mUserId = $this->mInfo['uu_user_id'];
             $this->mContentId = $this->mInfo['content_id'];
             $this->mUsername = $this->mInfo['login'];
             // a few random security conscious unset's - SPIDER
             unset($this->mInfo['user_password']);
             unset($this->mInfo['hash']);
             $this->loadPreferences();
             // Load attachments
             LibertyMime::load();
             if ($this->getPreference('users_country')) {
                 $this->setPreference('flag', $this->getPreference('users_country'));
                 $this->setPreference('users_country', str_replace('_', ' ', $this->getPreference('users_country')));
             }
             if ($pFull) {
                 $this->mInfo['real_name'] = trim($this->mInfo['real_name']);
                 $this->mInfo['display_name'] = !empty($this->mInfo['real_name']) ? $this->mInfo['real_name'] : (!empty($this->mUsername) ? $this->mUsername : (!empty($this->mInfo['email']) ? substr($this->mInfo['email'], 0, strpos($this->mInfo['email'], '@')) : $this->mUserId));
                 //print("displayName: ".$this->mInfo['display_name']);
                 $this->defaults();
                 $this->mInfo['publicEmail'] = scramble_email($this->mInfo['email'], $this->getPreference('users_email_display') ? $this->getPreference('users_email_display') : NULL);
             }
             $this->mTicket = substr(md5(session_id() . $this->mUserId), 0, 20);
         } else {
             $this->mUserId = NULL;
         }
     }
     if (!$gBitSystem->isFeatureActive('i18n_browser_languages')) {
         global $gBitLanguage, $gBitUser;
         //change language only if if logged user is this user
         //otherwise it's just logged user (lang A) watching other user's page (lang B) and don't change
         if ($this->mUserId && $this->mUserId != ANONYMOUS_USER_ID && $gBitUser === $this) {
             $gBitLanguage->mLanguage = $this->getPreference('bitlanguage', $gBitLanguage->mLanguage);
         } elseif (isset($_SESSION['bitlanguage'])) {
             // users not logged that change the preference
             $gBitLanguage->mLanguage = $_SESSION['bitlanguage'];
         }
     }
     return $this->isValid();
 }
 /**
  * load Load the data from the database
  * 
  * @access public
  * @return boolean TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function load()
 {
     if ($this->verifyId($this->mEnergyMeasuresId) || $this->verifyId($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $lookupColumn = $this->verifyId($this->mEnergyMeasuresId) ? 'energymeasure_id' : 'content_id';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mEnergyMeasuresId) ? $this->mEnergyMeasuresId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "\n\t\t\t\tSELECT energymeasures.*, lc.*,\n\t\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name,\n\t\t\t\t\tlfp.storage_path AS `image_attachment_path` \n\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "energymeasures_data` energymeasures\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = energymeasures.`content_id` ) \n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` la ON( la.`content_id` = lc.`content_id` AND la.`is_primary` = 'y' )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lfp ON( lfp.`file_id` = la.`foreign_id` )\n\t\t\t\t\t{$joinSql}\n\t\t\t\tWHERE energymeasures.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mEnergyMeasuresId = $result->fields['energymeasure_id'];
             $this->mInfo['creator'] = !empty($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = !empty($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_name'] = BitUser::getTitleFromHash($this->mInfo);
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['parsed_data'] = $this->parseData();
             $this->mInfo['thumbnail_urls'] = $this->getThumbnailUrls($this->mInfo);
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Beispiel #23
0
 /**
  * Load the data from the database
  * @access public
  **/
 public function load($pContentId = NULL, $pPluginParams = NULL)
 {
     if (@$this->verifyId($this->mArticleId) || @$this->verifyId($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $lookupColumn = @$this->verifyId($this->mArticleId) ? 'article_id' : 'content_id';
         $bindVars[] = $lookupId = @BitBase::verifyId($this->mArticleId) ? $this->mArticleId : $this->mContentId;
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "SELECT a.*, lc.*, atype.*, atopic.*, lch.hits,\n\t\t\t\tuue.`login` AS `modifier_user`, uue.`real_name` AS `modifier_real_name`,\n\t\t\t\tuuc.`login` AS `creator_user`, uuc.`real_name` AS `creator_real_name` ,\n\t\t\t\tla.`attachment_id` AS `primary_attachment_id`, lf.`file_name` AS `image_attachment_path` {$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "articles` a\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "article_types` atype ON( atype.`article_type_id` = a.`article_type_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "article_topics` atopic ON( atopic.`topic_id` = a.`topic_id` )\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = a.`content_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_hits` lch ON( lch.`content_id` = lc.`content_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_attachments` la ON( la.`content_id` = lc.`content_id` AND la.`is_primary` = 'y' )\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_files` lf ON( lf.`file_id` = la.`foreign_id` )\n\t\t\t\t\t{$joinSql}\n\t\t\t\tWHERE a.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         global $gBitSystem;
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fetchRow();
             // if a custom image for the article exists, use that, then use an attachment, then use the topic image
             $isTopicImage = false;
             $this->mContentId = $this->mInfo['content_id'];
             $this->mArticleId = $this->mInfo['article_id'];
             $this->mTopicId = $this->mInfo['topic_id'];
             $this->mTypeId = $this->mInfo['article_type_id'];
             $this->mInfo['thumbnail_url'] = static::getImageThumbnails($this->mInfo);
             $this->mInfo['creator'] = !empty($this->mInfo['creator_real_name']) ? $this->mInfo['creator_real_name'] : $this->mInfo['creator_user'];
             $this->mInfo['editor'] = !empty($this->mInfo['modifier_real_name']) ? $this->mInfo['modifier_real_name'] : $this->mInfo['modifier_user'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             // we need the raw data to display in the textarea
             $this->mInfo['raw'] = $this->mInfo['data'];
             // here we have the displayed data without the ...split... stuff
             $this->mInfo['data'] = preg_replace(LIBERTY_SPLIT_REGEX, "", $this->mInfo['data']);
             $comment = new LibertyComment();
             $this->mInfo['num_comments'] = $comment->getNumComments($this->mInfo['content_id']);
             LibertyMime::load();
             if (!empty($this->mInfo['primary_attachment_id']) && !empty($this->mStorage[$this->mInfo['primary_attachment_id']])) {
                 $this->mInfo['primary_attachment'] =& $this->mStorage[$this->mInfo['primary_attachment_id']];
             }
             $this->mInfo['parsed'] = $this->parseData();
         } else {
             $this->mArticleId = NULL;
         }
     }
     return count($this->mInfo);
 }
Beispiel #24
0
 /**
  * load
  *
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function load($pContentId = NULL, $pPluginParams = TRUE)
 {
     if ($this->verifyId($this->mPageId) || $this->verifyId($this->mContentId)) {
         global $gBitSystem;
         $lookupColumn = @BitBase::verifyId($this->mPageId) ? 'page_id' : 'content_id';
         $parse = (!isset($pPluginParams['parse']) or $pPluginParams['parse']) ? true : false;
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mPageId) ? $this->mPageId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "\n\t\t\t\tSELECT wp.*, lc.*, lcds.`data` AS `summary`,\n\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name {$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "wiki_pages` wp\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = wp.`content_id`) {$joinSql}\n\t\t\t\t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content_data` lcds ON (lc.`content_id` = lcds.`content_id` AND lcds.`data_type`='summary')\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\n\t\t\t\tWHERE wp.`{$lookupColumn}`=? {$whereSql}";
         if ($this->mInfo = $this->mDb->getRow($query, $bindVars)) {
             $this->mContentId = $this->mInfo['content_id'];
             $this->mPageId = $this->mInfo['page_id'];
             $this->mPageName = $this->mInfo['title'];
             $this->mInfo['display_url'] = $this->getDisplayUrl($this->mPageName);
             // TODO: this is a bad habbit and should not be done BitUser::getDisplayName sorts out what name to display
             $this->mInfo['creator'] = isset($this->mInfo['creator_real_name']) ? $this->mInfo['creator_real_name'] : $this->mInfo['creator_user'];
             $this->mInfo['editor'] = isset($this->mInfo['modifier_real_name']) ? $this->mInfo['modifier_real_name'] : $this->mInfo['modifier_user'];
             // Save some work if wiki_attachments are not active
             // get prefs before we parse the data that we know how to parse the data
             if ($gBitSystem->isFeatureActive('wiki_attachments')) {
                 LibertyMime::load();
             } else {
                 LibertyContent::load();
             }
             if ($parse) {
                 $this->mInfo['parsed_data'] = $this->parseData();
             }
         } else {
             $this->mPageId = NULL;
         }
     }
     return count($this->mInfo);
 }