예제 #1
0
 public function onAfterProfileUpdate($userid, $save)
 {
     if ($save) {
         // Update user's IP location
         $usermodel = CFactory::getModel('user');
         $user = CFactory::getUser($userid);
         $juser =& JFactory::getUser($userid);
         CFactory::load('libraries', 'mapping');
         // Build the address string
         $address = $user->getAddress();
         // Store the location
         $data = CMapping::getAddressData($address);
         // reset it to null;
         $latitude = COMMUNITY_LOCATION_NULL;
         $longitude = COMMUNITY_LOCATION_NULL;
         if ($data) {
             if ($data->status == 'OK') {
                 $latitude = $data->results[0]->geometry->location->lat;
                 $longitude = $data->results[0]->geometry->location->lng;
             }
         }
         $usermodel->storeLocation($user->id, $latitude, $longitude);
         // Update user's firstname and lastname. Only update if both is not
         // empty and is actually specifies
         $givenName = $user->getInfo('FIELD_GIVENNAME');
         $familyName = $user->getInfo('FIELD_FAMILYNAME');
         if (!empty($givenName) && !empty($familyName)) {
             $juser->name = $givenName . ' ' . $familyName;
             // We need to update the cuser object too since it is static,
             // it might still be used
             $user->name = $juser->name;
             if (!$juser->save()) {
                 // save failed ?
             }
         }
         // Update all user counts
         $friendModel = CFactory::getModel('friends');
         $friendModel->updateFriendCount($userid);
         //$user->_friendcount = $numFriend;
         //echo $user->save();
         //echo $user->_friendcount;
     }
 }
예제 #2
0
 /**
  * Onload, we try to load existing data, if any. If not, query from Google
  */
 public function load($address)
 {
     // lowercase the incoming address
     $address = JString::strtolower($address);
     $db =& JFactory::getDBO();
     $query = 'SELECT * FROM ' . $db->nameQuote('#__community_location_cache');
     $query .= ' WHERE ';
     $query .= $db->nameQuote('address') . '= ' . $db->quote($address);
     $query .= ' LIMIT 1';
     $db->setQuery($query);
     $obj = $db->loadObject();
     if ($obj) {
         $this->bind($obj);
     } else {
         CFactory::load('libraries', 'mapping');
         $data = CMapping::getAddressData($address);
         $this->address = $address;
         $this->latitude = COMMUNITY_LOCATION_NULL;
         $this->longitude = COMMUNITY_LOCATION_NULL;
         $this->data = '';
         $this->status = 'ZERO_RESULTS';
         if ($data != null) {
             require_once AZRUL_SYSTEM_PATH . DS . 'pc_includes' . DS . 'JSON.php';
             $json = new Services_JSON();
             $content = $json->encode($data);
             if ($data->status == 'OK') {
                 $this->latitude = $data->results[0]->geometry->location->lat;
                 $this->longitude = $data->results[0]->geometry->location->lng;
                 $this->data = $content;
                 $this->status = $data->status;
             }
         }
         $date = new JDate();
         $this->created = $date->toMySQL(true);
         $this->store();
     }
     return true;
 }
예제 #3
0
 /**
  * caller should verify that the address is valid
  */
 public function searchWithin($address, $distance)
 {
     $db = JFactory::getDBO();
     $longitude = null;
     $latitude = null;
     $data = CMapping::getAddressData($address);
     if ($data) {
         if ($data->status == 'OK') {
             $latitude = (double) $data->results[0]->geometry->location->lat;
             $longitude = (double) $data->results[0]->geometry->location->lng;
         }
     }
     if (is_null($latitude) || is_null($longitude)) {
         return null;
     }
     /*
      * code from
      * http://blog.fedecarg.com/2009/02/08/geo-proximity-search-the-haversine-equation/
      */
     $radius = 20;
     // in miles
     $lng_min = $longitude - $radius / abs(cos(deg2rad($latitude)) * 69);
     $lng_max = $longitude + $radius / abs(cos(deg2rad($latitude)) * 69);
     $lat_min = $latitude - $radius / 69;
     $lat_max = $latitude + $radius / 69;
     $now = new JDate();
     $sql = "SELECT * FROM " . $db->quoteName("#__community_events") . " WHERE " . $db->quoteName("longitude") . " > " . $db->quote($lng_min) . " AND " . $db->quoteName("longitude") . " < " . $db->quote($lng_max) . " AND " . $db->quoteName("latitude") . " > " . $db->quote($lat_min) . " AND " . $db->quoteName("latitude") . " < " . $db->quote($lat_max) . " AND " . $db->quoteName("enddate") . " > " . $db->quote($now->toSql());
     $db->setQuery($sql);
     $results = $db->loadObjectList();
     return $results;
 }
예제 #4
0
                <div class="app-box-menus">
                    <div class="app-box-menu toggle">
                        <a class="app-box-menu-icon" href="javascript: void(0)" onclick="joms.apps.toggle('#community-event-map');">
                            <span class="app-box-menu-title"><?php 
    echo JText::_('CC EXPAND');
    ?>
</span>
                        </a>
                    </div>
                </div>
            </div>
            </div>
            <div class="app-box-content event-description">
            	<!-- begin: dynamic map -->
          		<?php 
    echo CMapping::drawMap('event-map', $event->location);
    ?>
          		<div id="event-map" style="height:300px;width:100%">
          		<?php 
    echo JText::_('CC MAPS LOADING');
    ?>
          		</div>
          		<!-- end: dynamic map -->
            </div>
        </div>
        <?php 
}
?>

		<!-- end: map -->
예제 #5
0
 /**
  * Get the Formated address from google
  */
 public static function getFormatedAdd($address)
 {
     $data = CMapping::getAddressData($address);
     return $data->results[0]->formatted_address;
 }
예제 #6
0
            echo JText::_('COM_COMMUNITY_PHOTOS_ALBUM_TAKEN_AT_DESC');
            ?>
</a>
                        </div>
                        <div class="joms-tab__content">
                            <div class="joms-js--album-map-wrapper">
                                <div class="app-box-content event-description">
                                    <!-- begin: dynamic map -->
                                    <div class="joms-js--album-map" style="height:210px;width:100%;">
                                        <?php 
            echo JText::_('COM_COMMUNITY_MAPS_LOADING');
            ?>
                                    </div>
                                    <!-- end: dynamic map -->
                                    <div class="joms-text--small"><?php 
            echo CMapping::getFormatedAdd($album->location);
            ?>
</div>
                                </div>
                                <div class="joms-module__footer">
                                    <a href="http://maps.google.com/?q=<?php 
            echo urlencode($album->location);
            ?>
" target="_blank" class="joms-button--link"><?php 
            echo JText::_('COM_COMMUNITY_EVENTS_FULL_MAP');
            ?>
</a>
                                </div>
                            </div>
                            <script>
                                (function( w ) {
예제 #7
0
파일: event.php 프로젝트: bizanto/Hooked
 /** Interface fucntions **/
 public function resolveLocation($address)
 {
     CFactory::load('libraries', 'mapping');
     $data = CMapping::getAddressData($address);
     // reset it to null;
     $this->latitude = COMMUNITY_LOCATION_NULL;
     $this->longitude = COMMUNITY_LOCATION_NULL;
     if ($data) {
         if ($data->status == 'OK') {
             $this->latitude = $data->results[0]->geometry->location->lat;
             $this->longitude = $data->results[0]->geometry->location->lng;
         }
     }
 }
예제 #8
0
파일: single.php 프로젝트: Jougito/DynWeb
                </div>
                <div class="joms-tab__content">
                <div id="community-event-map" >
                    <div class="app-box-content event-description">
                        <!-- begin: dynamic map -->
                        <?php 
        // echo CMapping::drawMap('event-map', $event->location);
        ?>
                        <div id="event-map" style="height:210px;width:100%;">
                            <?php 
        echo JText::_('COM_COMMUNITY_MAPS_LOADING');
        ?>
                        </div>
                        <!-- end: dynamic map -->
                        <div class="joms-text--small"><?php 
        echo CMapping::getFormatedAdd($event->location);
        ?>
</div>
                    </div>
                    <div class="joms-module__footer">
                        <a href="http://maps.google.com/?q=<?php 
        echo urlencode($event->location);
        ?>
" target="_blank" class="joms-button--link"><?php 
        echo JText::_('COM_COMMUNITY_EVENTS_FULL_MAP');
        ?>
</a>
                    </div>
                </div>
                <script>
                    (function( w ) {
예제 #9
0
파일: events.php 프로젝트: bizanto/Hooked
 /**
  * caller should verify that the address is valid
  */
 public function searchWithin($address, $distance)
 {
     $db =& JFactory::getDBO();
     $longitude = null;
     $latitude = null;
     CFactory::load('libraries', 'mapping');
     $data = CMapping::getAddressData($address);
     if ($data) {
         if ($data->status == 'OK') {
             $latitude = (double) $data->results[0]->geometry->location->lat;
             $longitude = (double) $data->results[0]->geometry->location->lng;
         }
     }
     if (is_null($latitude) || is_null($longitude)) {
         return $null;
     }
     /*
     code from 
     http://blog.fedecarg.com/2009/02/08/geo-proximity-search-the-haversine-equation/
     */
     //$longitude = (float) 101.678;
     //$latitude = (float) 3.11966 ;
     // $radius = $radius_in_km * 0.621371192;
     $radius = 20;
     // in miles
     $lng_min = $longitude - $radius / abs(cos(deg2rad($latitude)) * 69);
     $lng_max = $longitude + $radius / abs(cos(deg2rad($latitude)) * 69);
     $lat_min = $latitude - $radius / 69;
     $lat_max = $latitude + $radius / 69;
     //echo 'lng (min/max): ' . $lng_min . '/' . $lng_max . PHP_EOL;
     //echo 'lat (min/max): ' . $lat_min . '/' . $lat_max;
     $now = new JDate();
     $sql = "SELECT *\n\n\t\t\t\tFROM\n\t\t\t\t\t\t" . $db->nameQuote("#__community_events") . "\n\t\t\t\tWHERE\n\t\t\t\t\t\t" . $db->nameQuote("longitude") . " > " . $db->quote($lng_min) . " AND\n\t\t\t\t\t\t" . $db->nameQuote("longitude") . " < " . $db->quote($lng_max) . " AND\n\t\t\t\t\t\t" . $db->nameQuote("latitude") . " > " . $db->quote($lat_min) . " AND\n\t\t\t\t\t\t" . $db->nameQuote("latitude") . " < " . $db->quote($lat_max) . " AND\n\t\t\t\t\t\t" . $db->nameQuote("enddate") . " > " . $db->quote($now->toMySQL());
     $db->setQuery($sql);
     echo $db->getQuery();
     $results = $db->loadObjectList();
     return $results;
 }
예제 #10
0
 /**
  * Update user location with user's address information
  * @param type $userid
  */
 public function updateLocationData($userid)
 {
     $usermodel = CFactory::getModel('user');
     $user = CFactory::getUser($userid);
     // Build the address string
     $address = str_replace('COM_COMMUNITY_LANG_NAME_', '', $user->getAddress());
     // Store the location
     $data = CMapping::getAddressData($address);
     // reset it to null;
     $latitude = COMMUNITY_LOCATION_NULL;
     $longitude = COMMUNITY_LOCATION_NULL;
     if ($data) {
         if ($data->status == 'OK') {
             $latitude = $data->results[0]->geometry->location->lat;
             $longitude = $data->results[0]->geometry->location->lng;
         }
     }
     $usermodel->storeLocation($user->id, $latitude, $longitude);
     return $this;
 }
예제 #11
0
 /** Interface fucntions **/
 public function resolveLocation($address)
 {
     CFactory::load('libraries', 'mapping');
     $data = CMapping::getAddressData($address);
     //print_r($data);
     if ($data) {
         if ($data->status == 'OK') {
             $this->latitude = $data->results[0]->geometry->location->lat;
             $this->longitude = $data->results[0]->geometry->location->lng;
         }
     }
 }
예제 #12
0
 /**
  * Method to display video
  * @return void
  */
 public function video()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $requestUser = CFactory::getRequestUser();
     $videoId = $jinput->get('videoid', '', 'INT');
     $task = $jinput->getCmd('task');
     // Get show video location map by default
     $videoMapsDefault = $config->get('videosmapdefault');
     // Load window library
     CWindow::load();
     $video = JTable::getInstance('Video', 'CTable');
     if (empty($videoId)) {
         if ($jinput->get('videoid', '', 'INT')) {
             $videoId = $jinput->get('videoid', '', 'INT');
         } else {
             $url = CRoute::_('index.php?option=com_community&view=videos', false);
             $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning');
         }
     }
     if (!$video->load($videoId)) {
         $url = CRoute::_('index.php?option=com_community&view=videos', false);
         $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning');
     }
     if ($video->groupid) {
         JRequest::setVar('groupid', $video->groupid);
     } elseif ($video->eventid) {
         JRequest::setVar('eventid', $video->eventid);
     }
     // Setting up the sub menu
     if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) {
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), "joms.api.videoFetchThumbnail('" . $video->id . "');", true);
         // Only add the set as profile video for video owner
         if ($my->id == $video->creator && $config->get('enableprofilevideo')) {
             $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), "joms.api.videoLinkToProfile('" . $video->id . "');", true);
         }
         $redirectUrl = CRoute::getURI(false);
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_EDIT'), "joms.api.videoEdit('" . $video->id . "');", true);
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.api.videoRemove('" . $video->id . "');", true);
     }
     $this->_addSubmenu();
     // Show the mini header when viewing other's photos
     if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) {
         // $this->attachMiniHeaderUser($video->creator);
     }
     // Check permission
     $user = CFactory::getUser($video->creator);
     $blocked = $user->isBlocked();
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         $tmpl = new CTemplate();
         echo $tmpl->fetch('profile.blocked');
         return;
     }
     $sorted = $jinput->get('sort', 'latest', 'STRING');
     $limit = $jinput->get('limitstart', 6, 'INT');
     $permissions = $my->id == 0 ? 0 : 20;
     $cat_id = $jinput->get('cat_id', '', 'INT');
     $model = CFactory::getModel('videos');
     /* We get groupid from video table instead user input */
     $groupId = $video->groupid;
     if ($video->creator_type == VIDEO_GROUP_TYPE) {
         if (!CGroupHelper::allowViewMedia($groupId)) {
             /**
              * Opengraph
              */
             CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS'));
             $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice'));
             echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION');
             return;
         }
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway
         $pathway = $mainframe->getPathway();
         $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
         $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&task=display&groupid=' . $groupId));
         $pathway->addItem($video->getTitle(), '');
         $otherVideos = $model->getGroupVideos($groupId, $cat_id, $limit);
     } else {
         if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) {
             /**
              * Opengraph
              */
             CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS'));
             $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice'));
             switch ($video->permissions) {
                 case '40':
                     $this->noAccess(JText::_('COM_COMMUNITY_VIDEOS_OWNER_ONLY', 'notice'));
                     break;
                 case '30':
                     $owner = CFactory::getUser($video->creator);
                     $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName()));
                     break;
                 default:
                     $this->noAccess();
                     break;
             }
             return;
         }
         // Set pathway
         $pathway = $mainframe->getPathway();
         $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos'));
         $pathway->addItem($video->getTitle(), '');
         $filters = array('status' => 'ready', 'category_id' => $cat_id, 'creator' => $user->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted, 'limit' => $limit);
         $otherVideos = $model->getVideos($filters);
     }
     // Set the current user's active profile
     CFactory::setActiveProfile($video->creator);
     // Hit counter + 1
     $video->hit();
     // Get reporting html
     $reportHTML = '';
     $report = new CReportingLibrary();
     if ($user->id != $my->id) {
         $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id));
     }
     // Get bookmark html
     $bookmarks = new CBookmarks($video->getPermalink());
     $bookmarksHTML = $bookmarks->getHTML();
     // Get the walls
     $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'videos,video');
     $wallCount = CWallLibrary::getWallCount('videos', $video->id);
     $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls');
     $wallViewAll = '';
     if ($wallCount > $config->get('stream_default_comments')) {
         $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     }
     $wallForm = '';
     if ($this->isPermitted($my->id, $video->creator, PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) {
         $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink);
     }
     $redirectUrl = CRoute::getURI(false);
     // Get like information.
     $like = new CLike();
     $likeCount = $like->getLikeCount('videos', $video->id);
     $likeLiked = $like->userLiked('videos', $video->id, $my->id) === COMMUNITY_LIKE;
     $tmpl = new CTemplate();
     if ($video->creator_type == VIDEO_GROUP_TYPE) {
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         $document = JFactory::getDocument();
         $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel');
     }
     if ($video->location !== '' && $videoMapsDefault) {
         $zoomableMap = CMapping::drawZoomableMap($video->location, 220, 150, $video->longitude, $video->latitude);
     } else {
         $zoomableMap = "";
     }
     //friend list for video tag
     $tagging = new CVideoTagging();
     $taggedList = $tagging->getTaggedList($video->id);
     for ($t = 0; $t < count($taggedList); $t++) {
         $tagItem = $taggedList[$t];
         $tagUser = CFactory::getUser($tagItem->userid);
         $canRemoveTag = 0;
         // 1st we check the tagged user is the video owner.
         //	If yes, canRemoveTag == true.
         //	If no, then check on user is the tag creator or not.
         //	If yes, canRemoveTag == true
         //	If no, then check on user whether user is being tagged
         if (COwnerHelper::isMine($my->id, $video->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) {
             $canRemoveTag = 1;
         }
         $tagItem->user = $tagUser;
         $tagItem->canRemoveTag = $canRemoveTag;
     }
     if ($video->type == "file") {
         $storage = CStorage::getStorage($video->storage);
         $video->path = $storage->getURI($video->path);
     }
     $config = CFactory::getConfig();
     $canSearch = 1;
     if ($my->id == 0 && !$config->get('enableguestsearchvideos')) {
         $canSearch = 0;
     }
     CHeadHelper::addOpengraph('og:image', JUri::root() . $video->thumb, true);
     CHeadHelper::setType('website', $video->title);
     $video->tagged = $taggedList;
     echo $tmpl->setMetaTags('video', $video)->set('user', $user)->set('zoomableMap', $zoomableMap)->set('likeCount', $likeCount)->set('canSearch', $canSearch)->set('likeLiked', $likeLiked)->set('redirectUrl', $redirectUrl)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('video', $video)->set('otherVideos', $otherVideos)->set('videoMapsDefault', $videoMapsDefault)->set('wallCount', $wallCount)->set('isGroup', $groupId ? true : false)->set('groupId', $groupId ? $groupId : null)->set('submenu', $this->showSubmenu(false))->fetch('videos/single');
 }
예제 #13
0
파일: single.php 프로젝트: Jougito/DynWeb
        </div>
        <div class="joms-tab__content">
            <div class="joms-js--video-map-wrapper">
                <div class="app-box-content event-description">
                    <!-- begin: dynamic map -->
                    <?php 
    // echo CMapping::drawMap('event-map', $event->location);
    ?>
                    <div class="joms-js--video-map" style="height:210px;width:100%;">
                        <?php 
    echo JText::_('COM_COMMUNITY_MAPS_LOADING');
    ?>
                    </div>
                    <!-- end: dynamic map -->
                    <div class="joms-text--small"><?php 
    echo CMapping::getFormatedAdd($video->location);
    ?>
</div>
                </div>
                <div class="joms-module__footer">
                    <a href="http://maps.google.com/?q=<?php 
    echo urlencode($video->location);
    ?>
" target="_blank" class="joms-button--link"><?php 
    echo JText::_('COM_COMMUNITY_EVENTS_FULL_MAP');
    ?>
</a>
                </div>
            </div>
            <script>
                (function( w ) {
예제 #14
0
파일: mapping.php 프로젝트: bizanto/Hooked
 /**
  * Add marker point to the given address
  */
 public function addMarker($targetId, $address, $title = '', $info = '')
 {
     $html = '';
     $data = CMapping::getAddressData($address);
     if ($data) {
         if ($data->status == 'OK') {
             $lat = $data->results[0]->geometry->location->lat;
             $lng = $data->results[0]->geometry->location->lng;
             $html = '<script type="text/javascript">' . 'joms.jQuery(document).ready( function() {' . 'joms.maps.addMarker(\'' . $targetId . '\', ' . $lat . ', ' . $lng . ', \'' . $title . '\', \'' . $info . '\');' . '});' . '</script>';
         }
     }
     return $html;
 }
예제 #15
0
?>
</td>
		</tr>
		
		<tr>
			<td colspan="2"><hr/></td>
		</tr>
		
		<?php 
CFactory::load('libraries', 'mapping');
if (CMapping::validateAddress($event->location)) {
    ?>
		<tr>
			<td colspan="2">
			<!-- begin: static map -->
          		<?php 
    echo CMapping::drawStaticMap($event->location, 578, 500);
    ?>
          	<!-- end: static map -->
			</td>			
		</tr>
		<?php 
}
?>
	</table>
	<script type="text/javascript">
		setTimeout('window.print();', 2000);
	</script>
  </body>
</html>
예제 #16
0
 /**
  * Display the photo thumbnails from an album
  **/
 public function album()
 {
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $config = CFactory::getConfig();
     $handler = $this->_getHandler();
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     // Get show photo location map by default
     $photoMapsDefault = $config->get('photosmapdefault');
     $albumId = JRequest::getVar('albumid', '', 'GET');
     $defaultId = JRequest::getVar('photo', '', 'GET');
     $userId = JRequest::getVar('userid', '', 'GET');
     $user = CFactory::getUser($userId);
     // Set pathway for group photos
     // Community > Groups > Group Name > Photos > Album Name
     $pathway =& $mainframe->getPathway();
     $groupId = JRequest::getVar('groupid', '', 'GET');
     if (!empty($groupId)) {
         $group =& JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
         $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&groupid=' . $groupId));
     } else {
         $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
         $pathway->addItem(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $userId));
     }
     $handler->setMiniHeader();
     if (empty($albumId)) {
         echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR');
         return;
     }
     if (!$handler->isAlbumBrowsable($albumId)) {
         return;
     }
     $album =& JTable::getInstance('Album', 'CTable');
     $album->load($albumId);
     //$photos		= $handler->getAlbumPhotos( $album->id );
     $photoPaginationLimit = intval($config->get('photopaginationlimit'));
     $photoThumbLimit = $photoPaginationLimit;
     $model = CFactory::getModel('photos');
     $photos = $model->getPhotos($album->id, $photoThumbLimit, JRequest::getVar('limitstart', '0', 'GET'));
     $pagination = $model->getPagination();
     $photo =& JTable::getInstance('Photo', 'CTable');
     $photo->load($album->photoid);
     if ($album->photoid == '0') {
         $album->thumbnail = $photo->getThumbURI();
     } else {
         $album->thumbnail = $photo->getImageURI();
     }
     // Increment album's hit each time this page is loaded.
     $album->hit();
     $otherAlbums = $model->_getOnlyAlbums($user->id, PHOTOS_USER_TYPE, 0, 20);
     $totalAlbums = count($otherAlbums);
     $showOtherAlbum = 6;
     $randomAlbum = array();
     if (count($otherAlbums) > 0) {
         $randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum);
         $count = 0;
         for ($i = 0; $i < $totalAlbums; $i++) {
             $num = is_array($randomId) ? $randomId[$i] : $randomId;
             if ($otherAlbums[$num]->id != $album->id) {
                 $count++;
                 $randomAlbum[] = $otherAlbums[$num];
             }
             if (count($randomAlbum) == $showOtherAlbum - 1) {
                 break;
             }
         }
     }
     $js = 'assets/gallery';
     $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
     CAssets::attach($js, 'js');
     CFactory::load('helpers', 'string');
     $document->setTitle(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name);
     $this->setTitle($album->name);
     $handler->setAlbumPathway(CStringHelper::escape($album->name));
     $handler->setRSSHeader($albumId);
     // Set album thumbnail and description for social bookmarking sites linking
     $document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel');
     $document->setDescription(CStringHelper::escape($album->getDescription()));
     CFactory::load('libraries', 'phototagging');
     $tagging = new CPhotoTagging();
     $people = array();
     $maxTime = $album->created;
     // Need to append the absolute path for the captions
     for ($i = 0; $i < count($photos); $i++) {
         $item =& JTable::getInstance('Photo', 'CTable');
         $item->bind($photos[$i]);
         $photos[$i] = $item;
         $photo =& $photos[$i];
         $photo->link = $handler->getPhotoURI($photo->id, $photo->albumid);
         $tags = $tagging->getTaggedList($photo->id);
         //Get last update
         $maxTime = $photo->created > $maxTime ? $photo->created : $maxTime;
         // Get the people in the tags
         foreach ($tags as $tag) {
             $people[] = $tag->userid;
         }
     }
     //Update lastUpdated
     $maxTime = new JDate($maxTime);
     $album->lastUpdated = CActivityStream::_createdLapse($maxTime, false);
     $people = array_unique($people);
     foreach ($people as &$person) {
         $person = CFactory::getUser($person);
     }
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id));
     // Get the walls
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, 10, 0);
     $wallCount = CWallLibrary::getWallCount('albums', $album->id);
     $viewAllLink = false;
     if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
     }
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     $wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink);
     $redirectUrl = CRoute::getURI(false);
     // Add tagging code
     //		$tagsHTML = '';
     //		if($config->get('tags_photos')){
     //			CFactory::load('libraries', 'tags');
     //			$tags = new CTags();
     //			$tagsHTML = $tags->getHTML('albums', $album->id, $handler->isAlbumOwner( $album->id ) );
     //		}
     $this->showSubmenu();
     $tmpl = new CTemplate();
     if ($album->location != "") {
         CFactory::load('libraries', 'mapping');
         $zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150);
     } else {
         $zoomableMap = "";
     }
     // Get the likes / dislikes item
     CFactory::load('libraries', 'like');
     $like = new CLike();
     $likesHTML = $like->getHTML('album', $album->id, $my->id);
     $owner = CFactory::getUser($album->creator);
     echo $tmpl->set('likesHTML', $likesHTML)->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('otherAlbums', $randomAlbum)->set('likesHTML', $likesHTML)->set('wallForm', $wallForm)->set('wallContent', $wallContent)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->fetch('photos.album');
 }
예제 #17
0
 /**
  * Display the photo thumbnails from an album
  * */
 public function album()
 {
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $config = CFactory::getConfig();
     $handler = $this->_getHandler();
     $my = CFactory::getUser();
     //CFactory::load( 'libraries' , 'activities' );
     // Get show photo location map by default
     $photoMapsDefault = $config->get('photosmapdefault');
     $albumId = $jinput->get('albumid', 0, 'INT');
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($albumId);
     $defaultId = $jinput->get('photoid', 0, 'INT');
     $userId = $jinput->get('userid', 0, 'INT');
     $limitstart = $jinput->get->get('limitstart', '0', 'INT');
     if (empty($limitstart)) {
         $limitstart = $jinput->get->get('start', '0', 'INT');
     }
     $user = CFactory::getUser($album->creator);
     // Set pathway for group photos
     // Community > Groups > Group Name > Photos > Album Name
     $pathway = $mainframe->getPathway();
     if ($album->type == 'group') {
         if (!$my->authorise('community.view', 'photos.group.album.' . $album->groupid, $album)) {
             echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION');
             return;
         }
     } else {
         if (!$my->authorise('community.view', 'photos.user.album.' . $album->id)) {
             echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION');
             return;
         }
     }
     $groupId = $album->groupid;
     if ($groupId > 0) {
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
         $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&groupid=' . $groupId));
     } else {
         $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
         $pathway->addItem(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $userId));
     }
     $handler->setMiniHeader();
     if (empty($albumId)) {
         echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR');
         return;
     }
     if (is_null($album->id)) {
         echo JText::_('COM_COMMUNITY_ALBUM_DELETED');
         return;
     }
     if (!$handler->isAlbumBrowsable($albumId)) {
         return;
     }
     //$photos		= $handler->getAlbumPhotos( $album->id );
     $photoPaginationLimit = intval($config->get('pagination'));
     $photoThumbLimit = $photoPaginationLimit;
     $model = CFactory::getModel('photos');
     $photos = $model->getPhotos($album->id, $photoThumbLimit, $limitstart);
     $pagination = $model->getPagination();
     $photo = JTable::getInstance('Photo', 'CTable');
     $photo->load($album->photoid);
     if ($album->photoid == '0') {
         $album->thumbnail = $photo->getThumbURI();
     } else {
         $album->thumbnail = $photo->getImageURI();
     }
     // Increment album's hit each time this page is loaded.
     $album->hit();
     if ($groupId > 0) {
         $otherAlbums = $model->getGroupAlbums($groupId);
     } else {
         $otherAlbums = $model->getAlbums($user->id);
     }
     $totalAlbums = count($otherAlbums);
     $showOtherAlbum = 6;
     $randomAlbum = array();
     if (count($otherAlbums) > 0) {
         $randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum);
         $count = 0;
         for ($i = 0; $i < $totalAlbums; $i++) {
             $num = is_array($randomId) ? $randomId[$i] : $randomId;
             if ($otherAlbums[$num]->id != $album->id) {
                 $count++;
                 $randomAlbum[] = $otherAlbums[$num];
             }
             if (count($randomAlbum) == $showOtherAlbum - 1) {
                 break;
             }
         }
     }
     /* set head meta */
     if (strtolower(trim(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()))) == strtolower(trim($album->name))) {
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()), CStringHelper::escape($album->getDescription()));
     } else {
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name, CStringHelper::escape($album->getDescription()));
     }
     $this->setTitle($album->name);
     $handler->setAlbumPathway(CStringHelper::escape($album->name));
     $handler->setRSSHeader($albumId);
     // Set album thumbnail and description for social bookmarking sites linking
     $document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel');
     //$document->setDescription( CStringHelper::escape($album->getDescription()) );
     //CFactory::load( 'libraries' , 'phototagging' );
     $getTaggingUsers = new CPhotoTagging();
     $people = array();
     // @TODO temporary fix for undefined link
     $list = array();
     foreach ($photos as $photo) {
         $photo->link = $handler->getPhotoURI($photo->id, $photo->albumid);
         CHeadHelper::addOpengraph('og:image', JUri::root(true) . '/' . $photo->image, true);
         $list[] = $photo;
     }
     $photos = $list;
     $albumParam = new Cparameter($album->params);
     $tagged = $albumParam->get('tagged');
     if (!empty($tagged)) {
         $people = explode(',', $albumParam->get('tagged'));
     }
     //Update lastUpdated
     $lastUpdated = new JDate($album->lastupdated);
     $album->lastUpdated = CActivityStream::_createdLapse($lastUpdated, false);
     $people = array_unique($people);
     CFactory::loadUsers($people);
     foreach ($people as &$person) {
         $person = CFactory::getUser($person);
     }
     //CFactory::load( 'libraries' , 'bookmarks' );
     $bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id));
     // Get wall data.
     $wallCount = CWallLibrary::getWallCount('albums', $album->id);
     $viewAllLink = false;
     if ($jinput->request->get('task', '') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
     }
     $wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'photos,album');
     $wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink);
     $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
     $wallViewAll = '';
     if ($wallCount > $config->get('stream_default_comments')) {
         $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     }
     $redirectUrl = CRoute::getURI(false);
     $tmpl = new CTemplate();
     if ($album->location != "") {
         $zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150);
     } else {
         $zoomableMap = "";
     }
     // Get the likes / dislikes item
     //CFactory::load( 'libraries' , 'like' );
     $like = new CLike();
     $likeCount = $like->getLikeCount('album', $album->id);
     $likeLiked = $like->userLiked('album', $album->id, $my->id) === COMMUNITY_LIKE;
     $owner = CFactory::getUser($album->creator);
     echo $tmpl->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('groupId', $groupId)->set('otherAlbums', $randomAlbum)->set('likeCount', $likeCount)->set('likeLiked', $likeLiked)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->set('photoId', $defaultId)->set('submenu', $this->showSubmenu(false))->fetch('photos/list');
 }
예제 #18
0
 /**
  * Method to display video
  *
  **/
 public function video()
 {
     $mainframe =& JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $videoId = JRequest::getVar('videoid', '', 'GET');
     $groupId = JRequest::getVar('groupid', '', 'GET');
     // Get show video location map by default
     $videoMapsDefault = $config->get('videosmapdefault');
     // Load window library
     CFactory::load('libraries', 'window');
     // Load necessary window css / javascript headers.
     CWindow::load();
     // Load the video table
     // Load string helper
     CFactory::load('helpers', 'string');
     $video =& JTable::getInstance('Video', 'CTable');
     if (empty($videoId)) {
         $url = CRoute::_('index.php?option=com_community&view=videos', false);
         $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning');
     }
     if (!$video->load($videoId)) {
         $url = CRoute::_('index.php?option=com_community&view=videos', false);
         $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning');
     }
     // Setting up the sub menu
     CFactory::load('helpers', 'owner');
     if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) {
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), 'joms.videos.fetchThumbnail(\'' . $video->id . '\')', true);
         // Only add the set as profile video for video owner
         if ($my->id == $video->creator) {
             $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), 'joms.videos.linkConfirmProfileVideo(\'' . $video->id . '\')', true);
         }
         $redirectUrl = CRoute::getURI(false);
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_EDIT'), 'joms.videos.showEditWindow(\'' . $video->id . '\',\'' . $redirectUrl . '\');', true);
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), 'joms.videos.deleteVideo(\'' . $video->id . '\')', true);
     }
     $this->_addSubmenu();
     $this->showSubmenu();
     // Show the mini header when viewing other's photos
     if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) {
         $this->attachMiniHeaderUser($video->creator);
     }
     // Check permission
     $user = CFactory::getUser($video->creator);
     $blocked = $user->isBlocked();
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         $tmpl = new CTemplate();
         echo $tmpl->fetch('profile.blocked');
         return;
     }
     $sorted = JRequest::getVar('sort', 'latest');
     $limit = JRequest::getVar('limitstart', 6);
     $permissions = $my->id == 0 ? 0 : 20;
     $cat_id = JRequest::getVar('cat_id', '');
     $model = CFactory::getModel('videos');
     if ($video->creator_type == VIDEO_GROUP_TYPE) {
         CFactory::load('helpers', 'group');
         if (!CGroupHelper::allowViewMedia($groupId)) {
             $document->setTitle(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS'));
             $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice'));
             echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION');
             return;
         }
         $group =& JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway
         $pathway =& $mainframe->getPathway();
         $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
         $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&groupid=' . $groupId));
         $pathway->addItem($video->getTitle(), '');
         $otherVideos = $model->getGroupVideos($groupId, $cat_id, $limit);
     } else {
         if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) {
             $document->setTitle(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS'));
             $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice'));
             switch ($video->permissions) {
                 case '40':
                     $this->noAccess(JText::_('COM_COMMUNITY_VIDEOS_OWNER_ONLY', 'notice'));
                     break;
                 case '30':
                     $owner = CFactory::getUser($video->creator);
                     $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName()));
                     break;
                 default:
                     $this->noAccess();
                     break;
             }
             return;
         }
         // Set pathway
         $pathway =& $mainframe->getPathway();
         $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos'));
         $pathway->addItem($video->getTitle(), '');
         $filters = array('status' => 'ready', 'category_id' => $cat_id, 'creator' => $user->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted, 'limit' => $limit);
         $otherVideos = $model->getVideos($filters);
     }
     //var_dump($otherVideos);
     // Set the current user's active profile
     CFactory::setActiveProfile($video->creator);
     // Hit counter + 1
     $video->hit();
     // Get reporting html
     $reportHTML = '';
     CFactory::load('libraries', 'reporting');
     $report = new CReportingLibrary();
     $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id));
     // Get bookmark html
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks($video->getPermalink());
     $bookmarksHTML = $bookmarks->getHTML();
     // Get the walls
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, 10, 0);
     $wallCount = CWallLibrary::getWallCount('videos', $video->id);
     $viewAllLink = false;
     if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls');
     }
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     $wallForm = '';
     if ($this->isPermitted($my->id, $video->creator, PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) {
         $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink);
     }
     $redirectUrl = CRoute::getURI(false);
     // Get like
     CFactory::load('libraries', 'like');
     $likes = new CLike();
     $likesHTML = $likes->getHTML('videos', $video->id, $my->id);
     $tmpl = new CTemplate();
     if ($video->creator_type == VIDEO_GROUP_TYPE) {
         $group =& JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         $document = JFactory::getDocument();
         $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel');
     }
     if ($video->location !== '' && $videoMapsDefault == 1) {
         CFactory::load('libraries', 'mapping');
         $zoomableMap = CMapping::drawZoomableMap($video->location, 220, 150);
     } else {
         $zoomableMap = "";
     }
     echo $tmpl->setMetaTags('video', $video)->set('user', $user)->set('zoomableMap', $zoomableMap)->set('likesHTML', $likesHTML)->set('redirectUrl', $redirectUrl)->set('wallForm', $wallForm)->set('wallContent', $wallContent)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('video', $video)->set('otherVideos', $otherVideos)->fetch('videos.video');
 }