Ejemplo n.º 1
0
 /**
  * TODO: This code is old and is not used by any package in the bitweaver CVS anymore.
  * We will clean up this code as soon as we migrated all legacy code
  */
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     //deprecated( "This method has been replaced by a method in LibertyMime. Please try to migrate your code." );
     // assume a derived class has joined on the liberty_content table, and loaded it's columns already.
     global $gLibertySystem;
     $conId = @$this->verifyId($pContentId) ? $pContentId : $this->mContentId;
     if (@$this->verifyId($conId)) {
         LibertyContent::load($conId);
         $query = "\n\t\t\t\tSELECT *\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "liberty_attachments` la\n\t\t\t\tWHERE la.`content_id`=? ORDER BY la.`pos` ASC, la.`attachment_id` ASC";
         if ($result = $this->mDb->query($query, array((int) $conId))) {
             $this->mStorage = array();
             while ($row = $result->fetchRow()) {
                 if ($func = $gLibertySystem->getPluginFunction($row['attachment_plugin_guid'], 'load_function', 'mime')) {
                     // this dummy is needed for forward compatability with LibertyMime plugins
                     $dummy = array();
                     $this->mStorage[$row['attachment_id']] = $func($row, $dummy);
                     //$this->mStorage[$row['attachment_id']]['is_primary'] = !empty( $row['primary_attachment_id'] );
                 } else {
                     print "No load_function for " . $row['attachment_plugin_guid'] . " " . $gLibertySystem->mPlugins[$row['attachment_plugin_guid']];
                 }
             }
         }
     }
     return TRUE;
 }
Ejemplo n.º 2
0
 /**
  * Load a Citizen content Item
  *
  * (Describe Citizen object here )
  */
 function load($pContentId = NULL)
 {
     if ($pContentId) {
         $this->mContentId = (int) $pContentId;
     }
     if ($this->verifyId($this->mContentId)) {
         $query = "select ci.*, a.*, n.*, p.*, 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\tFROM `" . BIT_DB_PREFIX . "citizen` ci\n\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON ( lc.`content_id` = ci.`content_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\tLEFT JOIN `" . BIT_DB_PREFIX . "citizen_address` a ON a.usn = ci.usn\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "nlpg_blpu` n ON n.`uprn` = ci.`nlpg`\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "nlpg_lpi` p ON p.`uprn` = ci.`nlpg` AND p.`language` = 'ENG' AND p.`logical_status` = 1\n\t\t\t\tWHERE ci.`content_id`=?";
         $result = $this->mDb->query($query, array($this->mContentId));
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = (int) $result->fields['content_id'];
             $this->mCitizenId = (int) $result->fields['usn'];
             $this->mParentId = (int) $result->fields['usn'];
             $this->mCitizenName = $result->fields['title'];
             $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();
             $os1 = new OSRef($this->mInfo['x_coordinate'], $this->mInfo['y_coordinate']);
             $ll1 = $os1->toLatLng();
             $this->mInfo['prop_lat'] = $ll1->lat;
             $this->mInfo['prop_lng'] = $ll1->lng;
         }
     }
     LibertyContent::load();
     return;
 }
Ejemplo n.º 3
0
 /**
  * Load an IRList content Item
  *
  * (Describe IRList object here )
  */
 function load($pContentId = NULL)
 {
     if ($pContentId) {
         $this->mContentId = (int) $pContentId;
     }
     if (@$this->verifyId($this->mIRId) || @$this->verifyId($this->mContentId)) {
         $lookupColumn = @$this->verifyId($this->mIRId) ? 'ir_id' : 'content_id';
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mIRId) ? $this->mIRId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "select ir.*, lc.*,\r\n\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\r\n\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name,\r\n\t\t\t\tuux.`login` AS closed_user, uuc.`real_name` AS closed_real_name\r\n\t\t\t\t{$selectSql}\r\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "irlist_secondary` ir\r\n\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON ( lc.`content_id` = ir.`content_id` ) {$joinSql}\r\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\r\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\r\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uux ON (uux.`user_id` = ir.`closed_user_id`)\r\n\t\t\t\tWHERE ir.`{$lookupColumn}`=? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = (int) $result->fields['content_id'];
             $this->mIRId = (int) $result->fields['ir_id'];
             $this->mIRName = $result->fields['title'];
             $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();
         }
     }
     LibertyContent::load();
     return;
 }
Ejemplo n.º 4
0
 /**
  * Load a sticky object identified by mStickyId, $this->mNotatedContentId or mContentId in that order
  *
  * Populates the mInfo array with the following fields
  *
  * sticky_id
  * notated_content_id
  * parsed
  * @return integer count of number of fields in MInfo
  */
 function load()
 {
     if (@BitBase::verifyId($this->mStickyId) || @BitBase::verifyId($this->mContentId) || @BitBase::verifyId($this->mNotatedContentId)) {
         if (@BitBase::verifyId($this->mStickyId)) {
             $whereSql = 'tn.`sticky_id`=?';
             $bindVars = array($this->mStickyId);
         } elseif (@BitBase::verifyId($this->mNotatedContentId)) {
             global $gBitUser;
             $whereSql = 'tn.`notated_content_id`=? AND lc.`user_id`=?';
             $bindVars = array($this->mNotatedContentId, $gBitUser->mUserId);
         } elseif (@BitBase::verifyId($this->mContentId)) {
             $whereSql = 'tn.`content_id`=?';
             $bindVars = array($this->mContentId);
         }
         $query = "SELECT tn.*, lc.*\n\t\t\t\t\t\tFROM `" . BIT_DB_PREFIX . "stickies` tn \n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = tn.`content_id`) \n\t\t\t\t\t\tWHERE {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mInfo['parsed'] = $this->parseData();
             $this->mContentId = $result->fields['content_id'];
             $this->mNotatedContentId = $result->fields['notated_content_id'];
             $this->mStickyId = $result->fields['sticky_id'];
             LibertyContent::load();
         }
     }
     return count($this->mInfo);
 }
Ejemplo n.º 5
0
 /**
  * load the treasury gallery
  *
  * @param $pExtras boolean - if set to true, treasury content is added as well
  * @return bool TRUE on success, FALSE if it's not valid
  * @access public
  **/
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     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;
         $bindVars[] = $lookupId;
         $selectSql = $joinSql = $whereSql = '';
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "SELECT trg.*, ls.`root_structure_id`, ls.`parent_id`,\n\t\t\t\tlc.`title`, lc.`format_guid`, lc.`data`, lc.`user_id`, lc.`content_type_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 {$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "treasury_gallery` trg\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON ( lc.`content_id` = trg.`content_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "liberty_structures` ls ON ( ls.`structure_id` = trg.`structure_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` ) {$joinSql}\n\t\t\t\tWHERE {$lookupColumn} = ? {$whereSql}";
         $result = $this->mDb->query($query, $bindVars);
         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::getDisplayNameFromHash(FALSE, $this->mInfo);
             $this->mInfo['editor'] = isset($row['modifier_real_name']) ? $row['modifier_real_name'] : $row['modifier_user'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['thumbnail_url'] = liberty_fetch_thumbnails(array('storage_path' => $this->getGalleryThumbBaseUrl(), 'mime_image' => FALSE));
             // get extra information if required
             if ($pPluginParams['extras']) {
                 $this->mInfo['gallery_path'] = $this->getGalleryPath();
                 $this->mInfo['gallery_display_path'] = $this->getDisplayPath($this->mInfo['gallery_path']);
             }
             LibertyContent::load();
             // parse the data after parent load so we have our html prefs
             $this->mInfo['parsed_data'] = $this->parseData();
         }
     }
     return count($this->mInfo);
 }
Ejemplo n.º 6
0
 /**
  * load the attachments for a given content id and then stuff them in mStorage
  *
  * @param array $pContentId
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 public function load($pContentId = NULL, $pPluginParams = NULL)
 {
     global $gLibertySystem;
     // assume a derived class has joined on the liberty_content table, and loaded it's columns already.
     $contentId = @BitBase::verifyId($pContentId) ? $pContentId : $this->mContentId;
     if (@BitBase::verifyId($contentId)) {
         // load up the content
         LibertyContent::load($contentId);
         // don't loadAttachmentPreferences() when we are forcing the installer since it breaks the login process before 2.1.0-beta
         if (!defined('INSTALLER_FORCE') && !defined('LOGIN_VALIDATE')) {
             $this->loadAttachmentPreferences();
         }
         $query = "SELECT * FROM `" . BIT_DB_PREFIX . "liberty_attachments` la WHERE la.`content_id`=? ORDER BY la.`pos` ASC, la.`attachment_id` ASC";
         if ($result = $this->mDb->query($query, array((int) $contentId))) {
             $this->mStorage = array();
             while ($row = $result->fetchRow()) {
                 if (!empty($row['is_primary'])) {
                     // used by edit tpl's among other things
                     $this->mInfo['primary_attachment_id'] = $row['attachment_id'];
                 } elseif (!$this->getField('primary_attachment_id') && !empty($row['attachment_id'])) {
                     // primary was not set by the above, default to first row. might be reset by later iterations via if is_primary above
                     $this->mInfo['primary_attachment_id'] = $row['attachment_id'];
                 }
                 if ($func = $gLibertySystem->getPluginFunction($row['attachment_plugin_guid'], 'load_function', 'mime')) {
                     // we will pass the preferences by reference that the plugin can easily update them
                     if (empty($this->mStoragePrefs[$row['attachment_id']])) {
                         $this->mStoragePrefs[$row['attachment_id']] = array();
                     }
                     $this->mStorage[$row['attachment_id']] = $func($row, $this->mStoragePrefs[$row['attachment_id']], $pPluginParams);
                 } else {
                     print "No load_function for " . $row['attachment_plugin_guid'];
                 }
             }
         }
     }
     return TRUE;
 }
Ejemplo n.º 7
0
 /**
  * Load a Task Ticket
  *
  * (Describe Task object here )
  */
 function load($pContentId = NULL)
 {
     if ($pContentId) {
         $this->mContentId = (int) $pContentId;
     }
     if ($this->verifyId($this->mContentId)) {
         $query = "select ti.*, lc.*, rs.`title` AS dept_title, rs.`ter_type` AS dept_mode,\n \t\t\t\ttag.`title` AS reason, tag.`reason_source` AS subtag, tag.`tag` AS tag_abv,\n \t\t\t\tMOD( ti.`clearance`, 256 ) AS clearance_code,\n\t\t\t\tCAST( ti.`clearance` / 256 AS INTEGER ) AS survey,\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 . "task_ticket` ti\n\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON ( lc.`content_id` = ti.`ticket_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\tLEFT JOIN `" . BIT_DB_PREFIX . "task_roomstat` rs ON (ti.`department` + 80 = rs.`terminal`)\n\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "task_reason` tag ON (ti.`tags` = tag.`reason`)\n\t\t\t\tWHERE ti.`ticket_id`=?";
         $result = $this->mDb->query($query, array($this->mContentId));
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = (int) $result->fields['content_id'];
             $this->mCitizenId = (int) $result->fields['caller_id'];
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['title'] = 'Ticket Number - ' . $this->mInfo['ticket_no'];
             $this->mInfo['reason'] = $this->mInfo['tag_abv'] . ' - ' . $this->mInfo['reason'];
             if ($this->mInfo['department'] == 0) {
                 $this->mInfo['dept_title'] = 'Please select a department';
             }
         }
     }
     LibertyContent::load();
     $this->loadTransactionList();
     return;
 }
Ejemplo n.º 8
0
 /**
  * Load a GEDCOM archives
  */
 function load()
 {
     if ($this->verifyId($this->mGEDCOMId) || $this->verifyId($this->mContentId)) {
         $lookupColumn = @BitBase::verifyId($this->mGEDCOMId) ? 'id' : 'content_id';
         $bindVars = array();
         $selectSql = '';
         $joinSql = '';
         $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mGEDCOMId) ? $this->mGEDCOMId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $sql = "SELECT ged.*, lc.*\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 {$selectSql}\n\t\t\t\t\tFROM `" . PHPGEDVIEW_DB_PREFIX . "gedcom` ged\n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = ged.`g_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\tWHERE ged.`g_{$lookupColumn}`=? {$whereSql}";
         if ($rs = $this->mDb->query($sql, $bindVars)) {
             $this->mInfo = $rs->fields;
             $this->mGEDCOMId = $this->mInfo['g_id'];
             $this->mContentId = $this->mInfo['content_id'];
             $this->mGedcomName = $this->mInfo['g_name'];
             $this->mInfo['creator'] = isset($rs->fields['creator_real_name']) ? $rs->fields['creator_real_name'] : $rs->fields['creator_user'];
             $this->mInfo['editor'] = isset($rs->fields['modifier_real_name']) ? $rs->fields['modifier_real_name'] : $rs->fields['modifier_user'];
             LibertyContent::load();
             if (!empty($this->mStorage) && count($this->mStorage) > 0) {
                 reset($this->mStorage);
                 $this->mInfo['gedcom_file'] = current($this->mStorage);
             } else {
                 $this->mInfo['gedcom_file'] = NULL;
             }
         }
     } else {
         // We don't have an gedcom_id or a content_id so there is no way to know what to load
         $this->mGEDCOMId = NULL;
         return NULL;
     }
     return count($this->mInfo);
 }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 10
0
 function load($pContentId = NULL, $pPluginParams = NULL)
 {
     global $gBitSystem;
     $bindVars = array();
     $selectSql = $joinSql = $whereSql = '';
     if (@$this->verifyId($this->mGalleryId)) {
         $whereSql = " WHERE fg.`gallery_id` = ?";
         $bindVars = array($this->mGalleryId);
     } elseif (@$this->verifyId($this->mContentId)) {
         $whereSql = " WHERE fg.`content_id` = ?";
         $bindVars = array($this->mContentId);
     } else {
         $whereSql = NULL;
     }
     if ($whereSql) {
         // If we have some way to know what fisheye_gallery row to load...
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "SELECT fg.*, lc.* {$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`\n\t\t\t\t\tFROM `" . BIT_DB_PREFIX . "fisheye_gallery` fg\n\t\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (fg.`content_id` = lc.`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{$whereSql}";
         if ($rs = $this->mDb->query($query, $bindVars)) {
             $this->mInfo = $rs->fields;
             $this->mContentId = $rs->fields['content_id'];
             LibertyContent::load();
             if (@$this->verifyId($this->mInfo['gallery_id'])) {
                 $this->mGalleryId = $this->mInfo['gallery_id'];
                 $this->mContentId = $this->mInfo['content_id'];
                 $this->mInfo['creator'] = isset($rs->fields['creator_real_name']) ? $rs->fields['creator_real_name'] : $rs->fields['creator_user'];
                 $this->mInfo['editor'] = isset($rs->fields['modifier_real_name']) ? $rs->fields['modifier_real_name'] : $rs->fields['modifier_user'];
                 // Set some basic defaults for how to display a gallery if they're not already set
                 if (empty($this->mInfo['thumbnail_size'])) {
                     $this->mInfo['thumbnail_size'] = $this->getPreference('fisheye_gallery_default_thumbnail_size', NULL);
                 }
                 if (empty($this->mInfo['rows_per_page'])) {
                     $this->mInfo['rows_per_page'] = $this->getPreference('fisheye_gallery_default_rows_per_page', FISHEYE_DEFAULT_ROWS_PER_PAGE);
                 }
                 if (empty($this->mInfo['cols_per_page'])) {
                     $this->mInfo['cols_per_page'] = $this->getPreference('fisheye_gallery_default_cols_per_page', FISHEYE_DEFAULT_COLS_PER_PAGE);
                 }
                 if (empty($this->mInfo['access_answer'])) {
                     $this->mInfo['access_answer'] = '';
                 }
                 if ($this->getPreference('gallery_pagination') == FISHEYE_PAGINATION_GALLERIFFIC and empty($this->mInfo['galleriffic_style'])) {
                     $this->mInfo['galleriffic_style'] = $this->getPreference('galleriffic_style', 1);
                 }
                 $this->mInfo['num_images'] = $this->getImageCount();
                 if ($this->getPreference('gallery_pagination') == FISHEYE_PAGINATION_POSITION_NUMBER) {
                     $this->mInfo['num_pages'] = $this->mDb->getOne("SELECT COUNT( distinct( floor(`item_position`) ) ) FROM `" . BIT_DB_PREFIX . "fisheye_gallery_image_map` WHERE gallery_content_id=?", array($this->mContentId));
                 } else {
                     $this->mInfo['images_per_page'] = $this->mInfo['cols_per_page'] * $this->mInfo['rows_per_page'];
                     $this->mInfo['num_pages'] = (int) ($this->mInfo['num_images'] / $this->mInfo['images_per_page'] + ($this->mInfo['num_images'] % $this->mInfo['images_per_page'] == 0 ? 0 : 1));
                 }
             } else {
                 unset($this->mContentId);
                 unset($this->mGalleryId);
             }
         }
     }
     return count($this->mInfo);
 }