コード例 #1
1
ファイル: mailq.php プロジェクト: bizanto/Hooked
 /**
  * Do a batch send
  */
 function send($total = 100)
 {
     $mailqModel = CFactory::getModel('mailq');
     $userModel = CFactory::getModel('user');
     $mails = $mailqModel->get($total);
     $jconfig = JFactory::getConfig();
     $mailer = JFactory::getMailer();
     $config = CFactory::getConfig();
     $senderEmail = $jconfig->getValue('mailfrom');
     $senderName = $jconfig->getValue('fromname');
     if (empty($mails)) {
         return;
     }
     CFactory::load('helpers', 'string');
     foreach ($mails as $row) {
         // @rule: only send emails that is valid.
         // @rule: make sure recipient is not blocked!
         $userid = $userModel->getUserFromEmail($row->recipient);
         $user = CFactory::getUser($userid);
         if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) {
             $mailer->setSender(array($senderEmail, $senderName));
             $mailer->addRecipient($row->recipient);
             $mailer->setSubject($row->subject);
             $tmpl = new CTemplate();
             $raw = isset($row->params) ? $row->params : '';
             $params = new JParameter($row->params);
             $base = $config->get('htmlemail') ? 'email.html' : 'email.text';
             if ($config->get('htmlemail')) {
                 $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body);
                 $mailer->IsHTML(true);
             } else {
                 //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags.
                 $row->body = CStringHelper::escape(strip_tags($row->body));
             }
             $tmpl->set('content', $row->body);
             $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template'));
             $tmpl->set('sitename', $config->get('sitename'));
             $row->body = $tmpl->fetch($base);
             // Replace any occurences of custom variables within the braces scoe { }
             if (!empty($row->body)) {
                 preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER);
                 foreach ($matches as $val) {
                     $replaceWith = $params->get($val[1], null);
                     //if the replacement start with 'index.php', we can CRoute it
                     if (strpos($replaceWith, 'index.php') === 0) {
                         $replaceWith = CRoute::getExternalURL($replaceWith);
                     }
                     if (!is_null($replaceWith)) {
                         $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body);
                     }
                 }
             }
             unset($tmpl);
             $mailer->setBody($row->body);
             $mailer->send();
         }
         $mailqModel->markSent($row->id);
         $mailer->ClearAllRecipients();
     }
 }
コード例 #2
0
ファイル: miniheader.php プロジェクト: Simarpreet05/joomla
 public function showGroupMiniHeader($groupId)
 {
     CMiniHeader::load();
     $option = JRequest::getVar('option', '', 'REQUEST');
     JFactory::getLanguage()->load('com_community');
     CFactory::load('models', 'groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $my = CFactory::getUser();
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$group->published) {
         return '';
     }
     if (!empty($group->id) && $group->id != 0) {
         $isMember = $group->isMember($my->id);
         $config = CFactory::getConfig();
         $tmpl = new CTemplate();
         $tmpl->set('my', $my);
         $tmpl->set('group', $group);
         $tmpl->set('isMember', $isMember);
         $tmpl->set('config', $config);
         $showMiniHeader = $option == 'com_community' ? $tmpl->fetch('groups.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('groups.miniheader') . '</div>';
         return $showMiniHeader;
     }
 }
コード例 #3
0
ファイル: filterbar.php プロジェクト: Simarpreet05/joomla
 public function getHTML($url, $sortItems = array(), $defaultSort = '', $filterItems = array(), $defaultFilter = '')
 {
     $cleanURL = $url;
     $uri =& JFactory::getURI();
     $queries = JRequest::get('GET');
     // If there is Itemid in the querystring, we need to unset it so that CRoute
     // will generate it's correct Itemid
     if (isset($queries['Itemid'])) {
         unset($queries['Itemid']);
     }
     // Force link to start with first page
     if (isset($queries['limitstart'])) {
         unset($queries['limitstart']);
     }
     if (isset($queries['start'])) {
         unset($queries['start']);
     }
     $selectedSort = JRequest::getVar('sort', $defaultSort, 'GET');
     $selectedFilter = JRequest::getVar('filter', $defaultFilter, 'GET');
     $tmpl = new CTemplate();
     $tmpl->set('queries', $queries);
     $tmpl->set('selectedSort', $selectedSort);
     $tmpl->set('selectedFilter', $selectedFilter);
     $tmpl->set('sortItems', $sortItems);
     $tmpl->set('uri', $uri);
     $tmpl->set('filterItems', $filterItems);
     return $tmpl->fetch('filterbar.html');
 }
コード例 #4
0
ファイル: filterbar.php プロジェクト: Jougito/DynWeb
 public static function getHTML($url, $sortItems = array(), $defaultSort = '', $filterItems = array(), $defaultFilter = '')
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $cleanURL = $url;
     $uri = JFactory::getURI();
     $queries = $_REQUEST;
     $allow = array('option', 'view', 'browse', 'task');
     foreach ($queries as $key => $value) {
         if (!in_array($key, $allow)) {
             unset($queries[$key]);
         }
     }
     $selectedSort = $jinput->get->get('sort', $defaultSort, 'STRING');
     $selectedFilter = $jinput->get->get('filter', $defaultFilter, 'STRING');
     $tmpl = new CTemplate();
     $tmpl->set('queries', $queries);
     $tmpl->set('selectedSort', $selectedSort);
     $tmpl->set('selectedFilter', $selectedFilter);
     $tmpl->set('sortItems', $sortItems);
     $tmpl->set('uri', $uri);
     $tmpl->set('filterItems', $filterItems);
     $tmpl->set('jinput', $jinput);
     return $tmpl->fetch('filterbar.html');
 }
コード例 #5
0
ファイル: view.raw.php プロジェクト: bizanto/Hooked
 function export($event)
 {
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     if (!$handler->showExport()) {
         echo JText::_('CC ACCESS FORBIDDEN');
         return;
     }
     header('Content-type: text/Calendar');
     header('Content-Disposition: attachment; filename="calendar.ics"');
     $creator = CFactory::getUser($event->creator);
     $offset = $creator->getUtcOffset();
     $date = new JDate($event->startdate);
     $dtstart = $date->toFormat('%Y%m%dT%H%M%S');
     $date = new JDate($event->enddate);
     $dtend = $date->toFormat('%Y%m%dT%H%M%S');
     $url = $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false, true);
     $tmpl = new CTemplate();
     $tmpl->set('dtstart', $dtstart);
     $tmpl->set('dtend', $dtend);
     $tmpl->set('url', $url);
     $tmpl->set('event', $event);
     $raw = $tmpl->fetch('events.ical');
     unset($tmpl);
     echo $raw;
     exit;
 }
コード例 #6
0
ファイル: view.html.php プロジェクト: Simarpreet05/joomla
 public function _addSubmenu()
 {
     $mySQLVer = 0;
     if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) {
         require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php';
         $mySQLVer = CAdvanceSearch::getMySQLVersion();
     }
     // Only display related links for guests
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     if ($my->id == 0) {
         $tmpl = new CTemplate();
         $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
         $html = $tmpl->fetch('search.submenu');
         $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
         if ($mySQLVer >= 4.1 && $config->get('guestsearch')) {
             $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH'));
         }
     } else {
         $this->addSubmenuItem('index.php?option=com_community&view=friends', JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL'));
         $tmpl = new CTemplate();
         $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search'));
         $html = $tmpl->fetch('search.submenu');
         $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
         if ($mySQLVer >= 4.1) {
             $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH'));
         }
         $this->addSubmenuItem('index.php?option=com_community&view=friends&task=invite', JText::_('COM_COMMUNITY_INVITE_FRIENDS'));
         $this->addSubmenuItem('index.php?option=com_community&view=friends&task=sent', JText::_('COM_COMMUNITY_FRIENDS_REQUEST_SENT'));
         $this->addSubmenuItem('index.php?option=com_community&view=friends&task=pending', JText::_('COM_COMMUNITY_FRIENDS_PENDING_APPROVAL'));
     }
 }
コード例 #7
0
ファイル: walls.php プロジェクト: Simarpreet05/joomla
 function onActivityContentDisplay($args)
 {
     $model =& CFactory::getModel('Wall');
     $wall =& JTable::getInstance('Wall', 'CTable');
     $my = CFactory::getUser();
     if (empty($args->content)) {
         return '';
     }
     $wall->load($args->cid);
     CFactory::load('libraries', 'privacy');
     CFactory::load('libraries', 'comment');
     $comment = CComment::stripCommentData($wall->comment);
     $config = CFactory::getConfig();
     $commentcut = false;
     if (strlen($comment) > $config->getInt('streamcontentlength')) {
         $origcomment = $comment;
         $comment = JString::substr($comment, 0, $config->getInt('streamcontentlength')) . ' ...';
         $commentcut = true;
     }
     if (CPrivacy::isAccessAllowed($my->id, $args->target, 'user', 'privacyProfileView')) {
         CFactory::load('helpers', 'videos');
         CFactory::load('libraries', 'videos');
         CFactory::load('libraries', 'wall');
         $videoContent = '';
         $params = new CParameter($args->params);
         $videoLink = $params->get('videolink');
         $image = $params->get('url');
         // For older activities that does not have videoLink , we need to process it the old way.
         if (!$videoLink) {
             $html = CWallLibrary::_processWallContent($comment);
             $tmpl = new CTemplate();
             $html = CStringHelper::escape($html);
             if ($commentcut) {
                 //add read more/less link for content
                 $html .= '<br /><br /><a href="javascript:void(0)" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').hide(); jQuery(\'#origcomment_' . $args->cid . '\').show();" >' . JText::_('COM_COMMUNITY_READ_MORE') . '</a>';
                 $html = '<div id="shortcomment_' . $args->cid . '">' . $html . '</div>';
                 $html .= '<div id="origcomment_' . $args->cid . '" style="display:none;">' . $origcomment . '<br /><br /><a href="javascript:void(0);" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').show(); jQuery(\'#origcomment_' . $args->cid . '\').hide();" >' . JText::_('COM_COMMUNITY_READ_LESS') . '</a></div>';
             }
             $tmpl->set('comment', $html);
             $html = $tmpl->fetch('activity.wall.post');
         } else {
             $html = '<ul class ="cDetailList clrfix">';
             $html .= '<li>';
             $image = !$image ? rtrim(JURI::root(), '/') . '/components/com_community/assets/playvideo.gif' : $image;
             $videoLib = new CVideoLibrary();
             $provider = $videoLib->getProvider($videoLink);
             $html .= '<!-- avatar --><div class="avatarWrap"><a href="javascript:void(0);" onclick="joms.activities.showVideo(\'' . $args->id . '\');"><img width="64" src="' . $image . '" class="cAvatar"/></a></div><!-- avatar -->';
             $videoPlayer = $provider->getViewHTML($provider->getId(), '300', '300');
             $comment = CString::str_ireplace($videoLink, '', $comment);
             $html .= '<!-- details --><div class="detailWrap alpha">' . $comment . '</div><!-- details -->';
             if (!empty($videoPlayer)) {
                 $html .= '<div style="display: none;clear: both;padding-top: 5px;" class="video-object">' . $videoPlayer . '</div>';
             }
             $html .= '</li>';
             $html .= '</ul>';
         }
         return $html;
     }
 }
コード例 #8
0
ファイル: formelement.php プロジェクト: joshjim27/jobsglobal
 /**
  * Renders the provided elements into their respective HTML formats.
  *
  * @param	Array	formElements	An array of CFormElement objects.
  * @param	string	position		The position of the field 'before' will be loaded before the rest of the form and 'after' will be loaded after the rest of the form loaded.
  *
  * returns	string	html			Contents of generated CFormElements.
  **/
 public static function renderElements($formElements, $position)
 {
     $tmpl = new CTemplate();
     $tmpl->set('formElements', $formElements);
     $tmpl->set('position', $position);
     $html = $tmpl->fetch('form.elements');
     return trim($html);
 }
コード例 #9
0
ファイル: tags.php プロジェクト: Simarpreet05/joomla
 /**
  *
  * @param string $tag the tag to seach for
  * @return string HTML code of item listing
  */
 public function getItemsHTML($tag)
 {
     $items = $this->getItems($tag);
     $tmpl = new CTemplate();
     $tmpl->set('items', $items);
     $html = $tmpl->fetch('tag.list');
     return $html;
 }
コード例 #10
0
ファイル: photos.php プロジェクト: bizanto/Hooked
 static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new JParameter($act->params);
     $action = $param->get('action', false);
     $photoid = $param->get('photoid', 0);
     CFactory::load('models', 'photos');
     $url = $param->get('url', false);
     CFactory::load('helpers', 'albums');
     if ($action == 'wall') {
         // unfortunately, wall post can also have 'photo' as its $act->apps. If the photo id is availble
         // for (newer activity stream, inside the param), we will show the photo snippet as well. Otherwise
         // just print out the wall content
         // Version 1.6 onwards, $params will contain photoid information
         // older version would have #photoid in the $title, since we link it to the photo
         $photoid = $param->get('photoid', false);
         if ($photoid) {
             $photo = JTable::getInstance('Photo', 'CTable');
             $photo->load($act->cid);
             $helper = new CAlbumsHelper($photo->albumid);
             if ($helper->showActivity()) {
                 $tmpl = new CTemplate();
                 $tmpl->set('url', $url);
                 $tmpl->set('photo', $photo);
                 $tmpl->set('param', $param);
                 $tmpl->set('act', $act);
                 return $tmpl->fetch('activity.photos.wall');
             }
         }
         return '';
     } elseif ($action == 'upload' && $photoid > 0) {
         $albumsHelper = new CAlbumsHelper($act->cid);
         if ($albumsHelper->isPublic()) {
             // If content has link to image, we could assume it is "upload photo" action
             // since old content add this automatically.
             // The $act->cid will be the album id, Retrive the recent photos uploaded
             // If $act->activities has data, that means this is an aggregated content
             // display some of them
             $photoModel = CFactory::getModel('photos');
             $album = JTable::getInstance('Album', 'CTable');
             $album->load($act->cid);
             if (empty($act->activities)) {
                 $acts[] = $act;
             } else {
                 $acts = $act->activities;
             }
             $tmpl = new CTemplate();
             $tmpl->set('album', $album);
             $tmpl->set('acts', $acts);
             return $tmpl->fetch('activity.photos.upload');
         }
     }
     return $html;
 }
コード例 #11
0
ファイル: events.php プロジェクト: bizanto/Hooked
 static function getEventSummary($eventid, $param)
 {
     $model = CFactory::getModel('events');
     $event =& JTable::getInstance('Event', 'CTable');
     $event->load($eventid);
     $tmpl = new CTemplate();
     $tmpl->set('event', $event);
     $tmpl->set('param', $param);
     return $tmpl->fetch('activity.events.update');
 }
コード例 #12
0
ファイル: view.html.php プロジェクト: bizanto/Hooked
 function invite()
 {
     CFactory::load('libraries', 'facebook');
     $facebook = new CFacebook();
     $config = CFactory::getConfig();
     $tmpl = new CTemplate();
     $tmpl->set('facebook', $facebook);
     $tmpl->set('config', $config);
     echo $tmpl->fetch('facebook.invite');
 }
コード例 #13
0
ファイル: bookmarks.php プロジェクト: bizanto/Hooked
 function getHTML()
 {
     $config = CFactory::getConfig();
     if ($config->get('enablesharethis')) {
         $tmpl = new CTemplate();
         $tmpl->set('uri', $this->currentURI);
         return $tmpl->fetch('bookmarks');
     } else {
         return '';
     }
 }
コード例 #14
0
ファイル: mobile.php プロジェクト: joshjim27/jobsglobal
 public function showSwitcher()
 {
     $uri = JFactory::getURI();
     // Will see if there's a nicer solution to this
     $query = $uri->getQuery(true);
     unset($query['screen']);
     $query = $uri->buildQuery($query);
     $uri->setQuery($query);
     $uri = $uri->toString();
     // Build links
     $link = array('mobile' => $uri . '&screen=mobile', 'desktop' => $uri . '&screen=desktop');
     $tmpl = new CTemplate();
     $tmpl->set('link', $link);
     $tmpl->set('viewtype', JRequest::setVar('screen'));
     echo $tmpl->fetch('mobile.switcher');
 }
コード例 #15
0
ファイル: friends.php プロジェクト: Simarpreet05/joomla
 public function ajaxIphoneFriends()
 {
     $objResponse = new JAXResponse();
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $view =& $this->getView('friends', '', $viewType);
     $html = '';
     ob_start();
     $this->display();
     $content = ob_get_contents();
     ob_end_clean();
     $tmpl = new CTemplate();
     $tmpl->set('toolbar_active', 'friends');
     $simpleToolbar = $tmpl->fetch('toolbar.simple');
     $objResponse->addAssign('social-content', 'innerHTML', $simpleToolbar . $content);
     return $objResponse->sendResponse();
 }
コード例 #16
0
ファイル: files.php プロジェクト: joshjim27/jobsglobal
 public function getFileHTML($type = NULL, $id = NULL)
 {
     //CFactory::load( 'models' , 'files' );
     $model = CFactory::getModel('files');
     $data = $model->getFileList($type, $id);
     $my = CFactory::getUser();
     if (!empty($data)) {
         foreach ($data as $key => $_data) {
             $data[$key] = $this->convertToMb($_data);
             $data[$key]->deleteable = $this->checkDeleteable($type, $_data, $my);
             $data[$key]->user = CFactory::getUser($_data->creator);
         }
     }
     $permission = $my->authorise('community.add', 'files.' . $type, $id);
     $tmpl = new CTemplate();
     $tmpl->set('type', $type)->set('id', $id)->set('data', $data)->set('permission', $permission);
     return $tmpl->fetch('files.list');
 }
コード例 #17
0
ファイル: bookmarks.php プロジェクト: Jougito/DynWeb
 public function ajaxShowBookmarks($uri)
 {
     $filter = JFilterInput::getInstance();
     $uri = $filter->clean($uri, 'string');
     $config = CFactory::getConfig();
     $shareviaemail = $config->get('shareviaemail');
     //CFactory::load( 'libraries' , 'bookmarks' );
     $bookmarks = new CBookmarks($uri);
     //CFactory::load( 'libraries' , 'apps' );
     $appsLib = CAppPlugins::getInstance();
     $appsLib->loadApplications();
     // @onLoadBookmarks deprecated.
     // since 1.5
     $appsLib->triggerEvent('onLoadBookmarks', array($bookmarks));
     $tmpl = new CTemplate();
     $tmpl->set('config', $config)->set('bookmarks', $bookmarks->getBookmarks());
     $json = array('title' => JText::_('COM_COMMUNITY_SHARE_THIS'), 'html' => $tmpl->fetch('bookmarks.list'), 'btnShare' => JText::_('COM_COMMUNITY_SHARE_BUTTON'), 'btnCancel' => JText::_('COM_COMMUNITY_CANCEL_BUTTON'), 'viaEmail' => $shareviaemail ? true : false);
     die(json_encode($json));
 }
コード例 #18
0
ファイル: groups.php プロジェクト: Simarpreet05/joomla
 /**
  * Responsible to return necessary contents to the Invitation library
  * so that it can add the mails into the queue
  **/
 public function inviteUsers($cid, $users, $emails, $message)
 {
     CFactory::load('libraries', 'invitation');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($cid);
     $content = '';
     $text = '';
     $title = JText::sprintf('COM_COMMUNITY_GROUPS_JOIN_INVITATION_MESSAGE', $group->name);
     $params = '';
     $my = CFactory::getUser();
     if (!$my->authorise('community.view', 'groups.invite.' . $cid, $group)) {
         return false;
     }
     $params = new CParameter('');
     $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
     $params->set('groupname', $group->name);
     CFactory::load('helpers', 'owner');
     if ($users) {
         foreach ($users as $id) {
             $groupInvite =& JTable::getInstance('GroupInvite', 'CTable');
             $groupInvite->groupid = $group->id;
             $groupInvite->userid = $id;
             $groupInvite->creator = $my->id;
             $groupInvite->store();
         }
     }
     $htmlTemplate = new CTemplate();
     $htmlTemplate->set('groupname', $group->name);
     $htmlTemplate->set('url', CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id));
     $htmlTemplate->set('message', $message);
     $html = $htmlTemplate->fetch('email.groups.invite.html');
     $textTemplate = new CTemplate();
     $textTemplate->set('groupname', $group->name);
     $textTemplate->set('url', CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id));
     $textTemplate->set('message', $message);
     $text = $textTemplate->fetch('email.groups.invite.text');
     return new CInvitationMail($html, $text, $title, $params);
 }
コード例 #19
0
ファイル: groups.php プロジェクト: bizanto/Hooked
 /**
  * Responsible to return necessary contents to the Invitation library
  * so that it can add the mails into the queue
  **/
 public function inviteUsers($cid, $users, $emails, $message)
 {
     CFactory::load('libraries', 'invitation');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($cid);
     $content = '';
     $text = '';
     $title = JText::sprintf('CC INVITED TO JOIN GROUP', $group->name);
     $params = '';
     $my = CFactory::getUser();
     if (!$group->isMember($my->id) && !COwnerHelper::isCommunityAdmin()) {
         return false;
     }
     $params = new JParameter('');
     $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
     $params->set('groupname', $group->name);
     CFactory::load('helpers', 'owner');
     if ($users) {
         foreach ($users as $id) {
             $groupInvite =& JTable::getInstance('GroupInvite', 'CTable');
             $groupInvite->groupid = $group->id;
             $groupInvite->userid = $id;
             $groupInvite->creator = $my->id;
             $groupInvite->store();
         }
     }
     $htmlTemplate = new CTemplate();
     $htmlTemplate->set('groupname', $group->name);
     $htmlTemplate->set('message', $message);
     $html = $htmlTemplate->fetch('email.groups.invite.html');
     $textTemplate = new CTemplate();
     $textTemplate->set('groupname', $group->name);
     $textTemplate->set('message', $message);
     $text = $textTemplate->fetch('email.groups.invite.text');
     return new CInvitationMail($html, $text, $title, $params);
 }
コード例 #20
0
ファイル: bookmarks.php プロジェクト: Simarpreet05/joomla
 public function ajaxShowBookmarks($uri)
 {
     $filter = JFilterInput::getInstance();
     $uri = $filter->clean($uri, 'string');
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks($uri);
     CFactory::load('libraries', 'apps');
     $appsLib =& CAppPlugins::getInstance();
     $appsLib->loadApplications();
     // @onLoadBookmarks deprecated.
     // since 1.5
     $appsLib->triggerEvent('onLoadBookmarks', array($bookmarks));
     $response = new JAXResponse();
     $tmpl = new CTemplate();
     $tmpl->set('bookmarks', $bookmarks->getBookmarks());
     $html = $tmpl->fetch('bookmarks.list');
     $total = $bookmarks->getTotalBookmarks();
     $height = $total * 10;
     $actions = '<input type="button" class="button" onclick="joms.bookmarks.email(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_SHARE_BUTTON') . '"/>';
     $actions .= '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_CANCEL_BUTTON') . '"/>';
     $response->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_SHARE_THIS'));
     $response->addScriptCall('cWindowAddContent', $html, $actions);
     return $response->sendResponse();
 }
コード例 #21
0
ファイル: helper.php プロジェクト: Jougito/DynWeb
 public static function searchEventsAjax()
 {
     // Location.
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $location = $jinput->request->get('location', '', 'STRING');
     $module = JModuleHelper::getModule('mod_community_search_nearbyevents');
     $params = new JRegistry($module->params);
     $advance = array();
     $advance['radius'] = $params->get('event_nearby_radius');
     if ($params->get('eventradiusmeasure') == COMMUNITY_EVENT_UNIT_KM) {
         //find out if radius is in km or miles
         $advance['radius'] = $advance['radius'] * 0.621371192;
     }
     $advance['fromlocation'] = $location;
     $model = CFactory::getModel('events');
     $objs = $model->getEvents(null, null, null, null, null, null, null, $advance);
     $events = array();
     $tmpl = new CTemplate();
     if ($objs) {
         foreach ($objs as $row) {
             $event = JTable::getInstance('Event', 'CTable');
             $event->bind($row);
             $events[] = $event;
         }
         unset($objs);
     }
     // Get list of nearby events
     $tmpl->set('events', $events);
     $tmpl->set('radius', $params->get('event_nearby_radius'));
     $tmpl->set('measurement', $params->get('eventradiusmeasure'));
     $tmpl->set('location', $location);
     $html = $tmpl->fetch('events.nearbylist');
     $json = array('success' => true, 'html' => $html);
     die(json_encode($json));
 }
コード例 #22
0
ファイル: view.html.php プロジェクト: Jougito/DynWeb
 public function myphotos()
 {
     $my = CFactory::getUser();
     $document = JFactory::getDocument();
     $userid = JRequest::getInt('userid', $my->id);
     $sortBy = JRequest::getString('sort', 'date');
     if ($userid) {
         $user = CFactory::getUser($userid);
     } else {
         $user = CFactory::getUser();
     }
     // set bread crumbs
     if ($userid == $my->id) {
         $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
         $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS_MY_PHOTOS_TITLE'));
     } else {
         $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
         $this->addPathway(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $userid));
     }
     $blocked = $user->isBlocked();
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         $tmpl = new CTemplate();
         echo $tmpl->fetch('profile.blocked');
         return;
     }
     if ($my->id == $user->id) {
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::_('COM_COMMUNITY_PHOTOS_MY_PHOTOS_TITLE'));
     } else {
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()));
     }
     // Show the mini header when viewing other's photos
     if ($my->id != $user->id) {
         $this->attachMiniHeaderUser($user->id);
     }
     $feedLink = CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $user->id . '&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_MY_PHOTOS_FEED') . '" href="' . $feedLink . '"/>';
     $document->addCustomTag($feed);
     $model = CFactory::getModel('photos');
     $albums = $model->getAlbums($user->id, true, true, $sortBy);
     $tmpl = new CTemplate();
     echo $tmpl->set('albumsHTML', $this->_getAllAlbumsHTML($albums, PHOTOS_USER_TYPE, $model->getPagination(), true))->fetch('photos.myphotos');
 }
コード例 #23
0
ファイル: like.php プロジェクト: bizanto/Hooked
 /**
  * Display like/dislike for public
  * @return string
  */
 public function getHtmlPublic($element, $itemId)
 {
     $config = CFactory::getConfig();
     $likesModel =& CFactory::getModel('Like');
     $info = $likesModel->getInfo($element, $itemId);
     $likes = 0;
     $dislikes = 0;
     if ($info) {
         $like =& JTable::getInstance('Like', 'CTable');
         $like->load($info->id);
         $likesInArray = array();
         $dislikesInArray = array();
         if ($like) {
             $likesInArray = explode(',', $like->like);
             $dislikesInArray = explode(',', $like->dislike);
         }
         $likes = count($likesInArray) - 1;
         $dislikes = count($dislikesInArray) - 1;
     }
     $tmpl = new CTemplate();
     $tmpl->set('likes', $likes);
     $tmpl->set('dislikes', $dislikes);
     if ($config->get('show_like_public')) {
         return $tmpl->fetch('like.public');
     }
 }
コード例 #24
0
ファイル: wall.php プロジェクト: joshjim27/jobsglobal
 /**
  * Return formatted comment given the wall item
  */
 public static function formatComment($wall)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $actModel = CFactory::getModel('activities');
     $like = new CLike();
     $likeCount = $like->getLikeCount('comment', $wall->id);
     $isLiked = $like->userLiked('comment', $wall->id, $my->id);
     $user = CFactory::getUser($wall->post_by);
     // Censor if the user is banned
     if ($user->block) {
         $wall->comment = $origComment = JText::_('COM_COMMUNITY_CENSORED');
     } else {
         // strip out the comment data
         $CComment = new CComment();
         $wall->comment = $CComment->stripCommentData($wall->comment);
         // Need to perform basic formatting here
         // 1. support nl to br,
         // 2. auto-link text
         $CTemplate = new CTemplate();
         $wall->comment = $origComment = $CTemplate->escape($wall->comment);
         $wall->comment = CStringHelper::autoLink($wall->comment);
     }
     $commentsHTML = '';
     $commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>';
     $date = new JDate($wall->date);
     $commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> ';
     $commentsHTML .= $wall->comment;
     $commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date);
     $cid = isset($wall->contentid) ? $wall->contentid : null;
     $activity = $actModel->getActivity($cid);
     $ownPost = $my->id == $wall->post_by;
     $allowRemove = $my->authorise('community.delete', 'walls', $wall);
     $canEdit = $config->get('wallediting') && $my->id == $wall->post_by || COwnerHelper::isCommunityAdmin();
     // only poster can edit
     if ($allowRemove) {
         $commentsHTML .= ' <span class="wall-coc-remove-link">&#x2022; <a href="#removeComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>';
     }
     $commentsHTML .= '</span>';
     $commentsHTML .= '</div>';
     $editHTML = '';
     if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) {
         $editHTML .= '<a href="javascript:" class="joms-button--edit">';
         $editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>';
         $editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>';
         $editHTML .= '</a>';
     }
     $removeHTML = '';
     if ($allowRemove) {
         $removeHTML .= '<a href="javascript:" class="joms-button--remove">';
         $removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>';
         $removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>';
         $removeHTML .= '</a>';
     }
     $removeTagHTML = '';
     if (CActivitiesHelper::hasTag($my->id, $wall->comment)) {
         $removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>';
     }
     /* user deleted */
     if ($user->guest == 1) {
         $userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> ';
     } else {
         $userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> ';
     }
     $params = $wall->params;
     $paramsHTML = '';
     $image = (array) $params->get('image');
     $photoThumbnail = false;
     if ($params->get('attached_photo_id') > 0) {
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($params->get('attached_photo_id'));
         $photoThumbnail = $photo->getThumbURI();
         $paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>';
     } else {
         if ($params->get('title')) {
             $video = self::detectVideo($params->get('url'));
             if (is_object($video)) {
                 $paramsHTML .= '<div class="joms-media--video joms-js--video"';
                 $paramsHTML .= ' data-type="' . $video->type . '"';
                 $paramsHTML .= ' data-id="' . $video->id . '"';
                 $paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"';
                 $paramsHTML .= ' style="margin-top:10px;">';
                 $paramsHTML .= '<div class="joms-media__thumbnail">';
                 $paramsHTML .= '<img src="' . $video->getThumbnail() . '">';
                 $paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">';
                 $paramsHTML .= '<div class="mejs-overlay-button"></div>';
                 $paramsHTML .= '</a>';
                 $paramsHTML .= '</div>';
                 $paramsHTML .= '<div class="joms-media__body">';
                 $paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>';
                 $paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>';
                 $paramsHTML .= '</div>';
                 $paramsHTML .= '</div>';
             } else {
                 $paramsHTML .= '<div class="joms-gap"></div>';
                 $paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">';
                 if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) {
                     $paramsHTML .= '<span class="joms-media__remove" data-action="remove-preview" onClick="joms.api.commentRemovePreview(\'' . $wall->id . '\');"><svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg></span>';
                 }
                 if ($params->get('image')) {
                     $paramsHTML .= $params->get('link');
                     $paramsHTML .= '<div class="joms-media__thumbnail">';
                     $paramsHTML .= '<a href="' . $params->get('link') ? $params->get('link') : '#' . '">';
                     $paramsHTML .= '<img src="' . array_shift($image) . '" />';
                     $paramsHTML .= '</a>';
                     $paramsHTML .= '</div>';
                 }
                 $url = $params->get('url') ? $params->get('url') : '#';
                 $paramsHTML .= '<div class="joms-media__body">';
                 $paramsHTML .= '<a href="' . $url . '">';
                 $paramsHTML .= '<h4 class="joms-media__title">' . $params->get('title') . '</h4>';
                 $paramsHTML .= '<p class="joms-media__desc reset-gap">' . CStringHelper::trim_words($params->get('description')) . '</p>';
                 if ($params->get('link')) {
                     $paramsHTML .= '<span class="joms-text--light"><small>' . preg_replace('#^https?://#', '', $params->get('link')) . '</small></span>';
                 }
                 $paramsHTML .= '</a></div></div>';
             }
         }
     }
     if (!$params->get('title') && $params->get('url')) {
         $paramsHTML .= '<div class="joms-gap"></div>';
         $paramsHTML .= '<div class="joms-media--album">';
         $paramsHTML .= '<a href="' . $params->get('url') . '">';
         $paramsHTML .= '<img class="joms-stream-thumb" src="' . $params->get('url') . '" />';
         $paramsHTML .= '</a>';
         $paramsHTML .= '</div>';
     }
     $wall->comment = nl2br($wall->comment);
     $wall->comment = CUserHelper::replaceAliasURL($wall->comment);
     $wall->comment = CStringHelper::getEmoticon($wall->comment);
     $wall->comment = CStringHelper::converttagtolink($wall->comment);
     // convert to hashtag
     $template = new CTemplate();
     $template->set('wall', $wall)->set('originalComment', $origComment)->set('date', $date)->set('isLiked', $isLiked)->set('likeCount', $likeCount)->set('canRemove', $allowRemove)->set('canEdit', $canEdit)->set('canRemove', $allowRemove)->set('user', $user)->set('photoThumbnail', $photoThumbnail)->set('paramsHTML', $paramsHTML);
     $commentsHTML = $template->fetch('stream/single-comment');
     return $commentsHTML;
 }
コード例 #25
0
ファイル: inbox.php プロジェクト: Jougito/DynWeb
 /**
  * @todo: check permission and message ownership
  */
 public function ajaxCompose($id)
 {
     $filter = JFilterInput::getInstance();
     $id = $filter->clean($id, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $objResponse = new JAXResponse();
     $config = CFactory::getConfig();
     $user = CFactory::getUser($id);
     $my = CFactory::getUser();
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     //CFactory::load( 'helpers' , 'owner' );
     //CFactory::load( 'libraries' , 'block' );
     $getBlockStatus = new blockUser();
     // Block banned users
     if ($getBlockStatus->isUserBlocked($id, 'inbox') && !COwnerHelper::isCommunityAdmin()) {
         $this->ajaxblock();
     }
     $inboxModel = $this->getModel('inbox');
     $lastSent = $inboxModel->getLastSentTime($my->id);
     $dateNow = new JDate();
     // We need to make sure that this guy are not spamming other people inbox
     // by checking against his last message time. Make sure it doesn't exceed
     // pmFloodLimit config (in seconds).
     if ($dateNow->toUnix() - $lastSent->toUnix() < $config->get('floodLimit') && !COwnerHelper::isCommunityAdmin()) {
         $json = array();
         $json['title'] = JText::_('COM_COMMUNITY_NOTICE');
         $json['error'] = JText::sprintf('COM_COMMUNITY_PLEASE_WAIT_BEFORE_SENDING_MESSAGE', $config->get('floodLimit'));
         die(json_encode($json));
     }
     // Check if user exceeded daily limit.
     $maxSent = $config->get('pmperday');
     $totalSent = $inboxModel->getTotalMessageSent($my->id);
     if ($totalSent >= $maxSent && $maxSent != 0) {
         $json = array();
         $json['title'] = JText::_('COM_COMMUNITY_NOTICE');
         $json['error'] = JText::_('COM_COMMUNITY_PM_LIMIT_REACHED');
         die(json_encode($json));
     }
     //====================================
     $tmpl = new CTemplate();
     $tmpl->set('user', $user);
     $json = array('title' => JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE'), 'html' => $tmpl->fetch('inbox.ajaxcompose'), 'btnSend' => JText::_('COM_COMMUNITY_SEND_BUTTON'), 'btnCancel' => JText::_('COM_COMMUNITY_CANCEL_BUTTON'));
     die(json_encode($json));
 }
コード例 #26
0
ファイル: event.php プロジェクト: joshjim27/jobsglobal
 public function addSubmenus($view)
 {
     $config = CFactory::getConfig();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $task = $jinput->get->get('task', '');
     //JRequest::getVar( 'task' , '' , 'GET' );
     $backLink = array('invitefriends', 'viewguest', 'uploadavatar', 'edit', 'sendmail', 'app');
     $categoryId = JRequest::getInt('categoryid', 0);
     if (in_array($task, $backLink)) {
         $eventid = $jinput->get->get('eventid', '', 'INT');
         //JRequest::getVar( 'eventid' , '' , 'GET' );
         $view->addSubmenuItem('index.php?option=com_community&view=events&task=viewevent&eventid=' . $eventid, JText::_('COM_COMMUNITY_EVENTS_BACK_BUTTON'));
     } else {
         $view->addSubmenuItem('index.php?option=com_community&view=events&task=display', JText::_('COM_COMMUNITY_EVENTS_ALL'));
         if (COwnerHelper::isRegisteredUser()) {
             $view->addSubmenuItem('index.php?option=com_community&view=events&task=myevents&userid=' . $this->my->id, JText::_('COM_COMMUNITY_EVENTS_MINE'));
             $view->addSubmenuItem('index.php?option=com_community&view=events&task=myinvites&userid=' . $this->my->id, JText::_('COM_COMMUNITY_EVENTS_PENDING_INVITATIONS'));
         }
         // Even guest should be able to view old events
         $view->addSubmenuItem('index.php?option=com_community&view=events&task=pastevents', JText::_('COM_COMMUNITY_EVENTS_PAST_TITLE'));
         $my = CFactory::getUser();
         if (COwnerHelper::isRegisteredUser() && $config->get('createevents') && $my->canCreateEvents() || COwnerHelper::isCommunityAdmin()) {
             //$view->addSubmenuItem('index.php?option=com_community&view=events&task=create', JText::_('COM_COMMUNITY_EVENTS_CREATE') , '' , SUBMENU_RIGHT );
             if ($config->get('event_import_ical')) {
                 $view->addSubmenuItem('index.php?option=com_community&view=events&task=import', JText::_('COM_COMMUNITY_EVENTS_IMPORT'), '', SUBMENU_RIGHT);
             }
         }
         if (!$config->get('enableguestsearchevents') && COwnerHelper::isRegisteredUser() || $config->get('enableguestsearchevents')) {
             $tmpl = new CTemplate();
             $tmpl->set('url', CRoute::_('index.php?option=com_community&view=events&task=search'));
             $html = $tmpl->fetch('events.search.submenu');
             //$view->addSubmenuItem('index.php?option=com_community&view=events&task=search', JText::_('COM_COMMUNITY_EVENTS_SEARCH'), 'joms.events.toggleSearchSubmenu(this)', false, $html);
         }
     }
 }
コード例 #27
0
ファイル: view.html.php プロジェクト: Simarpreet05/joomla
 public function receiver()
 {
     $tmpl = new CTemplate();
     echo $tmpl->fetch('connect.receiver');
 }
コード例 #28
0
ファイル: photos.php プロジェクト: Jougito/DynWeb
 /**
  * Preview a photo upload
  * @return type
  *
  */
 public function ajaxPreview()
 {
     $jinput = JFactory::getApplication()->input;
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $groupId = $jinput->get('groupid', '0', 'INT');
     $type = $groupId == 0 ? PHOTOS_USER_TYPE : PHOTOS_GROUP_TYPE;
     $albumId = $groupId == 0 ? $my->id : $groupId;
     if (CLimitsLibrary::exceedDaily('photos')) {
         $this->_showUploadError(true, JText::_('COM_COMMUNITY_PHOTOS_LIMIT_REACHED'));
         return;
     }
     // We can't use blockUnregister here because practically, the CFactory::getUser() will return 0
     if ($my->id == 0) {
         $this->_showUploadError(true, JText::_('COM_COMMUNITY_PROFILE_NEVER_LOGGED_IN'));
         return;
     }
     // Get default album or create one
     $model = CFactory::getModel('photos');
     $album = $model->getDefaultAlbum($albumId, $type);
     $newAlbum = false;
     if (empty($album)) {
         $album = JTable::getInstance('Album', 'CTable');
         $album->load();
         $handler = $this->_getHandler($album);
         $newAlbum = true;
         $now = new JDate();
         $album->creator = $my->id;
         $album->created = $now->toSql();
         $album->type = $handler->getType();
         $album->default = '1';
         $album->groupid = $groupId;
         switch ($type) {
             case PHOTOS_USER_TYPE:
                 $album->name = JText::sprintf('COM_COMMUNITY_DEFAULT_ALBUM_CAPTION', $my->getDisplayName());
                 break;
             case PHOTOS_GROUP_TYPE:
                 $group = JTable::getInstance('Group', 'CTable');
                 $group->load($groupId);
                 $album->name = JText::sprintf('COM_COMMUNITY_GROUP_DEFAULT_ALBUM_NAME', $group->name);
                 break;
         }
         $albumPath = $handler->getAlbumPath($album->id);
         $albumPath = CString::str_ireplace(JPATH_ROOT . '/', '', $albumPath);
         $albumPath = CString::str_ireplace('\\', '/', $albumPath);
         $album->path = $albumPath;
         $album->store();
         if ($type == PHOTOS_GROUP_TYPE) {
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($groupId);
             $modelGroup = $this->getModel('groups');
             $groupMembers = array();
             $groupMembers = $modelGroup->getMembersId($album->groupid, true);
             $params = new CParameter('');
             $params->set('albumName', $album->name);
             $params->set('group', $group->name);
             $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             $params->set('album', $album->name);
             $params->set('album_url', 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&groupid=' . $group->id);
             $params->set('url', 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&groupid=' . $group->id);
             CNotificationLibrary::add('groups_create_album', $my->id, $groupMembers, JText::sprintf('COM_COMMUNITY_GROUP_NEW_ALBUM_NOTIFICATION'), '', 'groups.album', $params);
         }
     } else {
         $albumId = $album->id;
         $album = JTable::getInstance('Album', 'CTable');
         $album->load($albumId);
         $handler = $this->_getHandler($album);
     }
     $photos = JRequest::get('Files');
     //$jinput->files->get('filedata');
     foreach ($photos as $image) {
         // @todo: foreach here is redundant since we exit on the first loop
         $result = $this->_checkUploadedFile($image, $album, $handler);
         if (!$result['photoTable']) {
             continue;
         }
         //assign the result of the array and assigned to the right variable
         $photoTable = $result['photoTable'];
         $storage = $result['storage'];
         $albumPath = $result['albumPath'];
         $hashFilename = $result['hashFilename'];
         $thumbPath = $result['thumbPath'];
         $originalPath = $result['originalPath'];
         $imgType = $result['imgType'];
         $isDefaultPhoto = $result['isDefaultPhoto'];
         // 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;
         $photoTable->status = 'temp';
         // Set the relative path.
         // @todo: configurable path?
         $storedPath = $handler->getStoredPath($storage, $album->id);
         $storedPath = $storedPath . '/' . $albumPath . $hashFilename . CImageHelper::getExtension($image['type']);
         $photoTable->image = CString::str_ireplace(JPATH_ROOT . '/', '', $storedPath);
         $photoTable->thumbnail = CString::str_ireplace(JPATH_ROOT . '/', '', $thumbPath);
         // In joomla 1.6, CString::str_ireplace is not replacing the path properly. Need to do a check here
         if ($photoTable->image == $storedPath) {
             $photoTable->image = str_ireplace(JPATH_ROOT . '/', '', $storedPath);
         }
         if ($photoTable->thumbnail == $thumbPath) {
             $photoTable->thumbnail = str_ireplace(JPATH_ROOT . '/', '', $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();
         if ($newAlbum) {
             $album->photoid = $photoTable->id;
             $album->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') {
             $this->_rotatePhoto($image, $photoTable, $storedPath, $thumbPath);
         }
         $tmpl = new CTemplate();
         $tmpl->set('photo', $photoTable);
         $tmpl->set('filename', $image['name']);
         $html = $tmpl->fetch('status.photo.item');
         $photo = new stdClass();
         $photo->id = $photoTable->id;
         $photo->thumbnail = $photoTable->thumbnail;
         $photo->html = rawurlencode($html);
         echo json_encode($photo);
     }
     exit;
 }
コード例 #29
0
ファイル: jslib.php プロジェクト: kosmosby/medicine-prof
	public function getAboutUs($userId)
	{
		$jspath = JPATH_ROOT .DS . 'components' . DS . 'com_community';
		require_once($jspath . DS . 'libraries' . DS . 'core.php');
		require_once($jspath . DS . 'helpers' . DS . 'friends.php');
		require_once($jspath . DS . 'libraries' . DS .'template.php');
		require_once($jspath . DS . 'models' . DS .'profile.php');
		
		$tmpl	= new CTemplate();
		$data	= new stdClass();
		$model 	= new CommunityModelProfile();
		$data->profile	= $model->getViewableProfile($userId);
		$profileField	= $data->profile['fields'];
		CFactory::load( 'helpers' , 'linkgenerator' );
		CFactory::load( 'helpers' , 'phone' );
		$my				= CFactory::getUser();
		$config			=& CFactory::getConfig();
		
		$userid	=  JRequest::getVar('userid', $my->id);
		$user	= CFactory::getUser($userid);
		// Allow search only on profile with type text and not empty
		foreach($profileField as $key => $val)
		{

			foreach($profileField[$key] as $pKey => $pVal)
			{
				$field	=& $profileField[$key][$pKey];								

				// Remove this info if we don't want empty field displayed
				if( !$config->get('showemptyfield') && ( empty($field['value']) && $field['value']!="0") )
				{
					unset( $profileField[$key][$pKey] );
					
				}
				else
				{
					if(!empty($field['value']) || $field['value']=="0" )
					{
						switch($field['type'])
						{
							case 'text':
								if(cValidateEmails($field['value']))
								{
									$profileField[$key][$pKey]['value'] = cGenerateEmailLink($field['value']);
								}
								else if (cValidateURL($field['value']))
								{
									$profileField[$key][$pKey]['value'] = cGenerateHyperLink($field['value']);
								}
								else if(!cValidatePhone($field['value']) && !empty($field['fieldcode']))
								{
									$profileField[$key][$pKey]['searchLink'] = CRoute::_('index.php?option=com_community&view=search&task=field&'.$field['fieldcode'].'='. urlencode( $field['value'] ) );					
								}
								break;
							case 'select':
							case 'singleselect':
							case 'radio':
							case 'country':
								$profileField[$key][$pKey]['searchLink'] = CRoute::_('index.php?option=com_community&view=search&task=field&'.$field['fieldcode'].'='. urlencode( $field['value'] ) );
								break;
							default:
								break;
						}
					}
				}
			}
		}
		
		CFactory::load( 'libraries' , 'profile' );		
		$tmpl->set( 'profile' , $data->profile );
	//	$tmpl->set( 'isMine' , isMine($my->id, $user->id));
		$tmpl->set( 'isMine' , false);
		return $tmpl->fetch( 'profile.about' );
	}
コード例 #30
0
ファイル: activities.php プロジェクト: joshjim27/jobsglobal
 public function ajaxshowLikedUser($wallId)
 {
     $like = new CLike();
     $users = $like->getWhoLikes('comment', $wallId);
     $tmpl = new CTemplate();
     $tmpl->set('users', $users);
     $html = $tmpl->fetch('ajax.stream.showothers');
     $json = array('html' => $html);
     die(json_encode($json));
 }