/** * Process Uploaded Photo Cover * @return [JSON OBJECT] [description] */ public function ajaxCoverUpload() { $jinput = JFactory::getApplication()->input; $parentId = $jinput->get->get('parentId', null, 'Int'); $type = strtolower($jinput->get->get('type', null, 'String')); $file = $jinput->files->get('uploadCover'); $config = CFactory::getConfig(); $my = CFactory::getUser(); $now = new JDate(); $addStream = true; if (!CImageHelper::checkImageSize(filesize($file['tmp_name']))) { $msg['error'] = JText::sprintf('COM_COMMUNITY_VIDEOS_IMAGE_FILE_SIZE_EXCEEDED_MB', CFactory::getConfig()->get('maxuploadsize')); echo json_encode($msg); exit; } //check if file is allwoed if (!CImageHelper::isValidType($file['type'])) { $msg['error'] = JText::_('COM_COMMUNITY_IMAGE_FILE_NOT_SUPPORTED'); echo json_encode($msg); exit; } CImageHelper::autoRotate($file['tmp_name']); $album = JTable::getInstance('Album', 'CTable'); if (!($albumId = $album->isCoverExist($type, $parentId))) { $albumId = $album->addCoverAlbum($type, $parentId); } $imgMaxWidht = 1140; // Get a hash for the file name. $fileName = JApplication::getHash($file['tmp_name'] . time()); $hashFileName = JString::substr($fileName, 0, 24); if (!JFolder::exists(JPATH_ROOT . '/' . $config->getString('imagefolder') . '/cover/' . $type . '/' . $parentId . '/')) { JFolder::create(JPATH_ROOT . '/' . $config->getString('imagefolder') . '/cover/' . $type . '/' . $parentId . '/'); } $dest = JPATH_ROOT . '/' . $config->getString('imagefolder') . '/cover/' . $type . '/' . $parentId . '/' . md5($type . '_cover' . time()) . CImageHelper::getExtension($file['type']); $thumbPath = JPATH_ROOT . '/' . $config->getString('imagefolder') . '/cover/' . $type . '/' . $parentId . '/thumb_' . md5($type . '_cover' . time()) . CImageHelper::getExtension($file['type']); // Generate full image if (!CImageHelper::resizeProportional($file['tmp_name'], $dest, $file['type'], $imgMaxWidht)) { $msg['error'] = JText::sprintf('COM_COMMUNITY_ERROR_MOVING_UPLOADED_FILE', $storageImage); echo json_encode($msg); exit; } CPhotos::generateThumbnail($file['tmp_name'], $thumbPath, $file['type']); $cTable = JTable::getInstance(ucfirst($type), 'CTable'); $cTable->load($parentId); if ($cTable->setCover(str_replace(JPATH_ROOT . '/', '', $dest))) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->albumid = $albumId; $photo->image = str_replace(JPATH_ROOT . '/', '', $dest); $photo->caption = $file['name']; $photo->filesize = $file['size']; $photo->creator = $my->id; $photo->created = $now->toSql(); $photo->published = 1; $photo->thumbnail = str_replace(JPATH_ROOT . '/', '', $thumbPath); if ($photo->store()) { $album->load($albumId); $album->photoid = $photo->id; $album->store(); } $msg['success'] = true; $msg['path'] = JURI::root() . str_replace(JPATH_ROOT . '/', '', $dest); $msg['cancelbutton'] = JText::_('COM_COMMUNITY_CANCEL_BUTTON'); $msg['savebutton'] = JText::_("COM_COMMUNITY_SAVE_BUTTON"); // Generate activity stream. $act = new stdClass(); $act->cmd = 'cover.upload'; $act->actor = $my->id; $act->target = 0; $act->title = ''; $act->content = ''; $act->access = $type == 'profile' ? $my->_cparams->get("privacyPhotoView") : 0; $act->app = 'cover.upload'; $act->cid = $photo->id; $act->comment_id = CActivities::COMMENT_SELF; $act->comment_type = 'cover.upload'; $act->groupid = $type == 'group' ? $parentId : 0; $act->eventid = $type == 'event' ? $parentId : 0; $act->group_access = $type == 'group' ? $cTable->approvals : 0; $act->event_access = $type == 'event' ? $cTable->permission : 0; $act->like_id = CActivities::LIKE_SELF; $act->like_type = 'cover.upload'; $params = new JRegistry(); $params->set('attachment', str_replace(JPATH_ROOT . '/', '', $dest)); $params->set('type', $type); $params->set('album_id', $albumId); $params->set('photo_id', $photo->id); //assign points based on types. switch ($type) { case 'group': $addStream = CUserPoints::assignPoint('group.cover.upload'); break; case 'event': $addStream = CUserPoints::assignPoint('event.cover.upload'); break; default: $addStream = CUserPoints::assignPoint('profile.cover.upload'); } if ($type == 'event') { $event = JTable::getInstance('Event', 'CTable'); $event->load($parentId); $group = JTable::getInstance('Group', 'CTable'); $group->load($event->contentid); if ($group->approvals == 1) { $addStream = false; } } if ($addStream) { // Add activity logging if ($type != 'profile' || $type == 'profile' && $parentId == $my->id) { CActivityStream::add($act, $params->toString()); } } echo json_encode($msg); exit; } }
<div class="joms-stream__body"> <?php //remove for now if ($act->groupid && false) { $group = JTable::getInstance('Group', 'CTable'); $group->load($act->groupid); $this->set('group', $group); ?> <a class="joms-stream-reference" href="<?php echo CUrlHelper::groupLink($group->id); ?> "><i class="joms-icon-users"></i><?php echo $group->name; ?> </a> <?php } $html = CPhotos::getActivityContentHTML($act); echo $html; ?> </div> <?php // No action for wall comment if ($action != 'wall') { $this->load('activities.actions'); }
public function upload() { $my = $this->plugin->get('user'); $config = CFactory::getConfig(); $returns = array(); // Load up required models and properties CFactory::load('controllers', 'photos'); CFactory::load('libraries', 'photos'); CFactory::load('models', 'photos'); CFactory::load('helpers', 'image'); $photos = JRequest::get('Files'); $albumId = JRequest::getVar('albumid', '', 'REQUEST'); $album =& JTable::getInstance('Album', 'CTable'); $album->load($albumId); $handler = $this->_getHandler($album); foreach ($photos as $imageFile) { if (!$this->_validImage($imageFile)) { $this->_showUploadError(true, $this->getError()); return; } if ($this->_imageLimitExceeded(filesize($imageFile['tmp_name']))) { $this->_showUploadError(true, JText::_('CC IMAGE FILE SIZE EXCEEDED')); return; } // We need to read the filetype as uploaded always return application/octet-stream // regardless od the actual file type $info = getimagesize($imageFile['tmp_name']); $isDefaultPhoto = JRequest::getVar('defaultphoto', false, 'REQUEST'); if ($album->id == 0 || $my->id != $album->creator && $album->type != PHOTOS_GROUP_TYPE) { $this->_showUploadError(true, JText::_('CC INVALID ALBUM')); return; } if (!$album->hasAccess($my->id, 'upload')) { $this->_showUploadError(true, JText::_('CC INVALID ALBUM')); return; } // Hash the image file name so that it gets as unique possible $fileName = JUtility::getHash($imageFile['tmp_name'] . time()); $hashFilename = JString::substr($fileName, 0, 24); $imgType = image_type_to_mime_type($info[2]); // Load the tables $photoTable =& JTable::getInstance('Photo', 'CTable'); // @todo: configurable paths? $storage = JPATH_ROOT . DS . $config->getString('photofolder'); $albumPath = empty($album->path) ? '' : $album->id . DS; // Test if the photos path really exists. jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); CFactory::load('helpers', 'limits'); $originalPath = $handler->getOriginalPath($storage, $albumPath, $album->id); CFactory::load('helpers', 'owner'); // @rule: Just in case user tries to exploit the system, we should prevent this from even happening. if ($handler->isExceedUploadLimit() && !COwnerHelper::isCommunityAdmin()) { $config = CFactory::getConfig(); $photoLimit = $config->get('groupphotouploadlimit'); echo JText::sprintf('CC GROUP PHOTO UPLOAD LIMIT REACHED', $photoLimit); return; } if (!JFolder::exists($originalPath)) { if (!JFolder::create($originalPath, (int) octdec($config->get('folderpermissionsphoto')))) { $this->_showUploadError(true, JText::_('CC ERROR CREATING USERS PHOTO FOLDER')); return; } } $locationPath = $handler->getLocationPath($storage, $albumPath, $album->id); if (!JFolder::exists($locationPath)) { if (!JFolder::create($locationPath, (int) octdec($config->get('folderpermissionsphoto')))) { $this->_showUploadError(true, JText::_('CC ERROR CREATING USERS PHOTO FOLDER')); return; } } $thumbPath = $handler->getThumbPath($storage, $album->id); $thumbPath = $thumbPath . DS . $albumPath . 'thumb_' . $hashFilename . CImageHelper::getExtension($imageFile['type']); CPhotos::generateThumbnail($imageFile['tmp_name'], $thumbPath, $imgType); // Original photo need to be kept to make sure that, the gallery works $useAlbumId = empty($album->path) ? 0 : $album->id; $originalFile = $originalPath . $hashFilename . CImageHelper::getExtension($imgType); $this->_storeOriginal($imageFile['tmp_name'], $originalFile, $useAlbumId); $photoTable->original = JString::str_ireplace(JPATH_ROOT . DS, '', $originalFile); // Set photos properties $photoTable->albumid = $albumId; $photoTable->caption = $imageFile['name']; $photoTable->creator = $my->id; $photoTable->created = gmdate('Y-m-d H:i:s'); // Remove the filename extension from the caption if (JString::strlen($photoTable->caption) > 4) { $photoTable->caption = JString::substr($photoTable->caption, 0, JString::strlen($photoTable->caption) - 4); } // @todo: configurable options? // Permission should follow album permission $photoTable->published = '1'; $photoTable->permissions = $album->permissions; // Set the relative path. // @todo: configurable path? $storedPath = $handler->getStoredPath($storage, $albumId); $storedPath = $storedPath . DS . $albumPath . $hashFilename . CImageHelper::getExtension($imageFile['type']); $photoTable->image = JString::str_ireplace(JPATH_ROOT . DS, '', $storedPath); $photoTable->thumbnail = JString::str_ireplace(JPATH_ROOT . DS, '', $thumbPath); //photo filesize, use sprintf to prevent return of unexpected results for large file. $photoTable->filesize = sprintf("%u", filesize($originalPath)); // @rule: Set the proper ordering for the next photo upload. $photoTable->setOrdering(); // Store the object $photoTable->store(); // We need to see if we need to rotate this image, from EXIF orientation data // Only for jpeg image. if ($config->get('photos_auto_rotate') && $imgType == 'image/jpeg') { // Read orientation data from original file $orientation = CImageHelper::getOrientation($imageFile['tmp_name']); //echo $orientation; exit; // A newly uplaoded image might not be resized yet, do it now $displayWidth = $config->getInt('photodisplaysize'); JRequest::setVar('imgid', $photoTable->id, 'GET'); JRequest::setVar('maxW', $displayWidth, 'GET'); JRequest::setVar('maxH', $displayWidth, 'GET'); $this->showimage(false); // Rotata resized files ince it is smaller switch ($orientation) { case 1: // nothing break; case 2: // horizontal flip // $image->flipImage($public,1); break; case 3: // 180 rotate left // $image->rotateImage($public,180); CImageHelper::rotate($storedPath, $storedPath, 180); CImageHelper::rotate($thumbPath, $thumbPath, 180); break; case 4: // vertical flip // $image->flipImage($public,2); break; case 5: // vertical flip + 90 rotate right //$image->flipImage($public, 2); //$image->rotateImage($public, -90); break; case 6: // 90 rotate right // $image->rotateImage($public, -90); CImageHelper::rotate($storedPath, $storedPath, -90); CImageHelper::rotate($thumbPath, $thumbPath, -90); break; case 7: // horizontal flip + 90 rotate right // $image->flipImage($public,1); // $image->rotateImage($public, -90); break; case 8: // 90 rotate left // $image->rotateImage($public, 90); CImageHelper::rotate($storedPath, $storedPath, 90); CImageHelper::rotate($thumbPath, $thumbPath, 90); break; } } // Trigger for onPhotoCreate CFactory::load('libraries', 'apps'); $apps =& CAppPlugins::getInstance(); $apps->loadApplications(); $params = array(); $params[] =& $photoTable; $apps->triggerEvent('onPhotoCreate', $params); // Set image as default if necessary // Load photo album table if ($isDefaultPhoto) { // Set the photo id $album->photoid = $photoTable->id; $album->store(); } // @rule: Set first photo as default album cover if enabled if (!$isDefaultPhoto && $config->get('autoalbumcover')) { $photosModel = CFactory::getModel('Photos'); $totalPhotos = $photosModel->getTotalPhotos($album->id); if ($totalPhotos <= 1) { $album->photoid = $photoTable->id; $album->store(); } } $act = new stdClass(); $act->cmd = 'photo.upload'; $act->actor = $my->id; $act->access = $my->getParam('privacyPhotoView'); $act->target = 0; $act->title = JText::sprintf($handler->getUploadActivityTitle(), '{photo_url}', $album->name); $act->content = '<img src="' . rtrim(JURI::root(), '/') . '/' . $photoTable->thumbnail . '" style=\\"border: 1px solid #eee;margin-right: 3px;" />'; $act->app = 'photos'; $act->cid = $albumId; $params = new JParameter(''); $params->set('multiUrl', $handler->getAlbumURI($albumId, false)); $params->set('photoid', $photoTable->id); $params->set('action', 'upload'); $params->set('photo_url', $handler->getPhotoURI($albumId, $photoTable->id, false)); // Add activity logging CFactory::load('libraries', 'activities'); CActivityStream::add($act, $params->toString()); //add user points CFactory::load('libraries', 'userpoints'); CUserPoints::assignPoint('photo.upload'); // Photo upload was successfull, display a proper message //$this->_showUploadError( false , JText::sprintf('CC PHOTO UPLOADED SUCCESSFULLY', $photoTable->caption ) , $photoTable->getThumbURI(), $albumId ); $returns[] = array('album_id' => $albumId, 'image_id' => $photoTable->id, 'caption' => $photoTable->caption, 'created' => $photoTable->created, 'storage' => $photoTable->storage, 'thumbnail' => $photoTable->getThumbURI(), 'image' => $photoTable->getImageURI()); } return $returns; exit; }
/** * Return the HTML formatted activity content */ static function getActivityContent($act) { $cache = CFactory::getFastCache(); $cacheid = __FILE__ . __LINE__ . serialize(func_get_args()); if ($data = $cache->get($cacheid)) { return $data; } // Return empty content or content with old, invalid data // In some old version, some content might have 'This is the body' if ($act->content == 'This is the body') { return ''; } $html = $act->content; // For known core, apps, we can simply call the content command switch ($act->app) { case 'videos': CFactory::load('libraries', 'videos'); $html = CVideos::getActivityContentHTML($act); break; case 'photos': CFactory::load('libraries', 'photos'); $html = CPhotos::getActivityContentHTML($act); break; case 'events': CFactory::load('libraries', 'events'); $html = CEvents::getActivityContentHTML($act); break; case 'groups.wall': case 'groups': CFactory::load('libraries', 'groups'); $html = CGroups::getActivityContentHTML($act); break; case 'groups.discussion.reply': case 'groups.discussion': CFactory::load('libraries', 'groups'); $html = CGroups::getActivityContentHTML($act); break; case 'groups.bulletin': CFactory::load('libraries', 'groups'); $html = CGroups::getActivityContentHTML($act); case 'system': CFactory::load('libraries', 'adminstreams'); $html = CAdminstreams::getActivityContentHTML($act); break; case 'walls': // If a wall does not have any content, do not // display the summary if ($act->app == 'walls' && $act->cid == 0) { $html = ''; return $html; } if ($act->cid != 0) { CFactory::load('libraries', 'wall'); $html = CWall::getActivityContentHTML($act); } break; default: // for other unknown apps, we include the plugin see if it is is callable // we call the onActivityContentDisplay(); CFactory::load('libraries', 'apps'); $apps =& CAppPlugins::getInstance(); $plugin =& $apps->get($act->app); $method = 'onActivityContentDisplay'; if (is_callable(array($plugin, $method))) { $args = array(); $args[] = $act; $html = call_user_func_array(array($plugin, $method), $args); } else { $html = $act->content; } } $cache->store($html, $cacheid, array('activities')); return $html; }
/** * Generate photo thumbnail */ public function generateThumbnail($srcPath, $destPath, $destType) { $aspect = CPhotos::getPhotoAspectRatio($srcPath); list($currentWidth, $currentHeight) = getimagesize($srcPath); $origWidth = $currentWidth; $origHeight = $currentHeight; $destWidth = COMMUNITY_PHOTO_THUMBNAIL_SIZE; $destHeight = COMMUNITY_PHOTO_THUMBNAIL_SIZE; $sourceX = 0; $sourceY = 0; switch ($aspect) { /* case CPhotos::ASPECT_PORTRAIT: $currentHeight = $currentWidth / CPhotos::ASPECT_PORTRAIT_RATIO; $sourceY = intval( ( $origHeight - $currentHeight ) / 2 ); $sourceX = 0; $destHeight = 84; break; case CPhotos::ASPECT_LANDSCAPE: $currentWidth = $currentHeight * CPhotos::ASPECT_LANDSCAPE_RATIO; $sourceX = intval( ( $origWidth - $currentWidth ) / 2 ); $sourceY = 0; $destWidth = 84; break; */ default: } //CImageHelper::resize( $srcPath , $destPath , $destType , $destWidth , $destHeight , $sourceX , $sourceY , $currentWidth , $currentHeight); CImageHelper::createThumb($srcPath, $destPath, $destType, $destWidth, $destHeight); }
private function _checkUploadedFile($imageFile, $album, $handler) { $my = CFactory::getUser(); $config = CFactory::getConfig(); if (!$this->_validImage($imageFile)) { $this->_showUploadError(true, $this->getError()); return false; } if ($this->_imageLimitExceeded(filesize($imageFile['tmp_name']))) { $this->_showUploadError(true, JText::_('COM_COMMUNITY_VIDEOS_IMAGE_FILE_SIZE_EXCEEDED')); return false; } // We need to read the filetype as uploaded always return application/octet-stream // regardless of the actual file type $info = getimagesize($imageFile['tmp_name']); $isDefaultPhoto = JRequest::getVar('defaultphoto', false, 'REQUEST'); if ($album->id == 0 || $my->id != $album->creator && $album->type != PHOTOS_GROUP_TYPE) { $this->_showUploadError(true, JText::_('COM_COMMUNITY_PHOTOS_INVALID_ALBUM')); return false; } if (!$album->hasAccess($my->id, 'upload')) { $this->_showUploadError(true, JText::_('COM_COMMUNITY_PHOTOS_INVALID_ALBUM')); return false; } // Hash the image file name so that it gets as unique possible $fileName = JUtility::getHash($imageFile['tmp_name'] . time()); $hashFilename = JString::substr($fileName, 0, 24); $imgType = image_type_to_mime_type($info[2]); // Load the tables $photoTable =& JTable::getInstance('Photo', 'CTable'); // @todo: configurable paths? $storage = JPATH_ROOT . DS . $config->getString('photofolder'); $albumPath = empty($album->path) ? '' : $album->id . DS; // Test if the photos path really exists. jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); CFactory::load('helpers', 'limits'); $originalPath = $handler->getOriginalPath($storage, $albumPath, $album->id); CFactory::load('helpers', 'owner'); // @rule: Just in case user tries to exploit the system, we should prevent this from even happening. if ($handler->isExceedUploadLimit(false) && !COwnerHelper::isCommunityAdmin()) { $groupId = JRequest::getInt('groupid', $album->groupid, 'REQUEST'); $config = CFactory::getConfig(); if (intval($groupId) > 0) { // group photo $photoLimit = $config->get('groupphotouploadlimit'); $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_GROUPS_PHOTO_LIMIT', $photoLimit)); } else { // user photo $photoLimit = $config->get('photouploadlimit'); $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_PHOTOS_UPLOAD_LIMIT_REACHED', $photoLimit)); } //echo JText::sprintf('COM_COMMUNITY_GROUPS_PHOTO_LIMIT' , $photoLimit ); return false; } if (!JFolder::exists($originalPath)) { if (!JFolder::create($originalPath, (int) octdec($config->get('folderpermissionsphoto')))) { $this->_showUploadError(true, JText::_('COM_COMMUNITY_VIDEOS_CREATING_USERS_PHOTO_FOLDER_ERROR')); return false; } JFile::copy(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'index.html', $originalPath . DS . 'index.html'); } $locationPath = $handler->getLocationPath($storage, $albumPath, $album->id); if (!JFolder::exists($locationPath)) { if (!JFolder::create($locationPath, (int) octdec($config->get('folderpermissionsphoto')))) { $this->_showUploadError(true, JText::_('COM_COMMUNITY_VIDEOS_CREATING_USERS_PHOTO_FOLDER_ERROR')); return false; } JFile::copy(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'index.html', $locationPath . DS . 'index.html'); } $thumbPath = $handler->getThumbPath($storage, $album->id); $thumbPath = $thumbPath . DS . $albumPath . 'thumb_' . $hashFilename . CImageHelper::getExtension($imageFile['type']); CPhotos::generateThumbnail($imageFile['tmp_name'], $thumbPath, $imgType); // Original photo need to be kept to make sure that, the gallery works $useAlbumId = empty($album->path) ? 0 : $album->id; $originalFile = $originalPath . $hashFilename . CImageHelper::getExtension($imgType); $this->_storeOriginal($imageFile['tmp_name'], $originalFile, $useAlbumId); $photoTable->original = CString::str_ireplace(JPATH_ROOT . DS, '', $originalFile); // In joomla 1.6, CString::str_ireplace is not replacing the path properly. Need to do a check here if ($photoTable->original == $originalFile) { $photoTable->original = str_ireplace(JPATH_ROOT . DS, '', $originalFile); } // Set photos properties $photoTable->albumid = $album->id; $photoTable->caption = $imageFile['name']; $photoTable->creator = $my->id; $photoTable->created = gmdate('Y-m-d H:i:s'); $result = array('photoTable' => $photoTable, 'storage' => $storage, 'albumPath' => $albumPath, 'hashFilename' => $hashFilename, 'thumbPath' => $thumbPath, 'originalPath' => $originalPath, 'imgType' => $imgType, 'isDefaultPhoto' => $isDefaultPhoto); return $result; }
public static function formatSharePopup($act) { switch ($act->app) { case 'photos': $album = JTable::getInstance('Album', 'CTable'); $album->load($act->cid); $act->album = $album; $act->params = new CParameter($act->params); $act->content = CPhotos::getActivityContentHTML($act); break; case 'videos': $video = JTable::getInstance('Video', 'CTable'); $video->load($act->cid); $act->title = $video->title; $act->content = new stdClass(); $act->content->title = $video->title; $act->content->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())); $act->content->thumb = $video->getThumbnail(); $act->content->description = $video->description; break; case 'events.wall': case 'groups.wall': case 'profile': $param = new CParameter($act->params); $metas = $param->get('headMetas', NULL); $headers = new CParameter($metas); if (!is_null($headers->get('title'))) { $act->content = new stdClass(); $act->content->title = $headers->get('title'); $act->content->description = $headers->get('description'); $act->content->thumb = $headers->get('image'); } break; case 'groups': $group = JTable::getInstance('Group', 'CTable'); $group->load($act->cid); $act->title = $group->name; $act->content = new stdClass(); $act->content->title = $group->name; $act->content->description = $group->description; $act->content->thumb = $group->getThumbAvatar(); break; case 'events': $event = JTable::getInstance('Event', 'CTable'); $event->load($act->cid); $act->title = $event->title; $act->content = new stdClass(); $act->content->title = $event->title; $act->content->description = $event->description; $act->content->thumb = $event->getThumbAvatar(); break; } return self::generateShareHtml($act); }
/** * Return the HTML formatted activity contet */ static function getActivityContent($act) { // Return empty content or content with old, invalid data // In some old version, some content might have 'This is the body' if ($act->content == 'This is the body') { return ''; } $html = $act->content; // For know core, apps, we can simply call the content command switch ($act->app) { case 'videos': CFactory::load('libraries', 'videos'); $html = CVideos::getActivityContentHTML($act); break; case 'photos': CFactory::load('libraries', 'photos'); $html = CPhotos::getActivityContentHTML($act); break; case 'events': CFactory::load('libraries', 'events'); $html = CEvents::getActivityContentHTML($act); break; case 'groups': CFactory::load('libraries', 'groups'); $html = CGroups::getActivityContentHTML($act); break; case 'walls': // If a wall does not have any content, do not // display the summary if ($act->app == 'walls' && $act->cid == 0) { $html = ''; return $html; } default: // for other unknown apps, we include the plugin see if it is is callable // we call the onActivityContentDisplay(); CFactory::load('libraries', 'apps'); $apps =& CAppPlugins::getInstance(); $plugin =& $apps->get($act->app); $method = 'onActivityContentDisplay'; if (is_callable(array($plugin, $method))) { $args = array(); $args[] = $act; $html = call_user_func_array(array($plugin, $method), $args); } else { $html = $act->content; } } return $html; }