Exemplo n.º 1
0
 function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('easyblog.manage.tag', 'com_easyblog')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     //initialise variables
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     // Render modal
     JHTML::_('behavior.modal');
     $tagId = JRequest::getVar('tagid', '');
     $tag = EasyBlogHelper::getTable('Tag', 'Table');
     $tag->load($tagId);
     $tag->title = JString::trim($tag->title);
     $tag->alias = JString::trim($tag->alias);
     $this->tag = $tag;
     // Set default values for new entries.
     if (empty($tag->created)) {
         $date = EasyBlogDateHelper::getDate();
         $now = EasyBlogDateHelper::toFormat($date);
         $tag->created = $now;
         $tag->published = true;
     }
     $this->assignRef('my', $user);
     $this->assignRef('tag', $tag);
     parent::display($tpl);
 }
Exemplo n.º 2
0
 function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('easyblog.manage.comment', 'com_easyblog')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     //initialise variables
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     //Load pane behavior
     jimport('joomla.html.pane');
     $commentId = JRequest::getVar('commentid', '');
     $comment = EasyBlogHelper::getTable('Comment', 'Table');
     $comment->load($commentId);
     $this->comment = $comment;
     // Set default values for new entries.
     if (empty($comment->created)) {
         $date = EasyBlogDateHelper::getDate();
         $now = EasyBlogDateHelper::toFormat($date);
         $comment->created = $now;
         $comment->published = true;
     }
     $this->assignRef('comment', $comment);
     parent::display($tpl);
 }
Exemplo n.º 3
0
 function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('easyblog.manage.category', 'com_easyblog')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     //initialise variables
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     //Load pane behavior
     jimport('joomla.html.pane');
     $catId = JRequest::getVar('catid', '');
     $cat = EasyBlogHelper::getTable('Category', 'Table');
     $cat->load($catId);
     $this->cat = $cat;
     // Set default values for new entries.
     if (empty($cat->created)) {
         $date = EasyBlogDateHelper::getDate();
         $now = EasyBlogDateHelper::toFormat($date);
         $cat->created = $now;
         $cat->published = true;
     }
     $catRuleItems = EasyBlogHelper::getTable('CategoryAclItem', 'Table');
     $categoryRules = $catRuleItems->getAllRuleItems();
     $assignedACL = $cat->getAssignedACL();
     $parentList = EasyBlogHelper::populateCategories('', '', 'select', 'parent_id', $cat->parent_id, false, false, false, array($cat->id));
     $editor = JFactory::getEditor($config->get('layout_editor'));
     $this->assignRef('editor', $editor);
     $this->assignRef('cat', $cat);
     $this->assignRef('config', $config);
     $this->assignRef('acl', $acl);
     $this->assignRef('parentList', $parentList);
     $this->assignRef('categoryRules', $categoryRules);
     $this->assignRef('assignedACL', $assignedACL);
     parent::display($tpl);
 }
Exemplo n.º 4
0
 public function submitForm($type, $post)
 {
     $ejax = new Ejax();
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     $id = isset($post['id']) ? $post['id'] : '';
     if (empty($acl->rules->allow_subscription) && (empty($my->id) && !$config->get('main_allowguestsubscribe'))) {
         $theme = new CodeThemes();
         $theme->set('message', JText::_('COM_EASYBLOG_NO_PERMISSION_TO_SUBSCRIBE_BLOG'));
         $theme->set('type', $type);
         $theme->set('id', $id);
         $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject();
         $ejax->dialog($options);
         return $ejax->send();
     }
     $isModerate = false;
     $userId = isset($post['userid']) ? $post['userid'] : '';
     $email = JString::trim($post['email']);
     //registration
     $register = isset($post['esregister']) ? true : false;
     $fullname = isset($post['esfullname']) ? $post['esfullname'] : '';
     $username = isset($post['esusername']) ? $post['esusername'] : '';
     $newId = '';
     $msg = '';
     if (JString::trim($email) == '') {
         $theme = new CodeThemes();
         $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_EMAIL_EMPTY_ERROR'));
         $theme->set('type', $type);
         $theme->set('id', $id);
         $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject();
         $ejax->dialog($options);
         return $ejax->send();
     } else {
         if (!EasyBlogHelper::getHelper('Email')->isValidInetAddress($email)) {
             $theme = new CodeThemes();
             $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_EMAIL_INVALID_ERROR'));
             $theme->set('type', $type);
             $theme->set('id', $id);
             $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject();
             $ejax->dialog($options);
             return $ejax->send();
         }
     }
     if (JString::trim($fullname) == '') {
         $theme = new CodeThemes();
         $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_NAME_EMPTY_ERROR'));
         $theme->set('type', $type);
         $theme->set('id', $id);
         $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject();
         $ejax->dialog($options);
         return $ejax->send();
     }
     if ($register && $my->id == 0) {
         if (JString::trim($username) == '') {
             $theme = new CodeThemes();
             $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_USERNAME_EMPTY_ERROR'));
             $theme->set('type', $type);
             $theme->set('id', $id);
             $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject();
             $ejax->dialog($options);
             return $ejax->send();
         }
         $registor = EasyBlogHelper::getRegistor();
         $options = array('username' => $username, 'email' => $email);
         $validate = $registor->validate($options);
         if ($validate !== true) {
             $theme = new CodeThemes();
             $theme->set('message', $validate);
             $theme->set('type', $type);
             $theme->set('id', $id);
             $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject();
             $ejax->dialog($options);
             return $ejax->send();
         } else {
             $options['fullname'] = $fullname;
             $newId = $registor->addUser($options);
             if (!is_numeric($newId)) {
                 // registration failed.
                 $msg = $newId;
             } else {
                 $userId = $newId;
             }
         }
     }
     // Real logic operation goes here.
     $method = 'subscribe' . ucfirst($type);
     // @rule: Process mailchimp subscriptions here.
     EasyBlogHelper::getHelper('Mailchimp')->subscribe($email, $fullname);
     if (!$this->{$method}($id, $userId, $email, $fullname)) {
         $theme = new CodeThemes();
         $theme->set('message', JText::_('COM_EASYBLOG_SUBSCRIPTION_ALREADY_SUBSCRIBED_ERROR'));
         $theme->set('type', $type);
         $theme->set('id', $id);
         $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_ERROR_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.error.php'))->toObject();
         $ejax->dialog($options);
         return $ejax->send();
     }
     // message
     if ($register && is_numeric($newId)) {
         $message = JText::sprintf('COM_EASYBLOG_YOU_SUCCESSFULLY_SUBSCRIBED_AND_REGISTERED_AS_MEMBER');
     } else {
         $message = JText::sprintf('COM_EASYBLOG_SUBSCRIPTION_SUBSCRIBED_SUCCESS', $email);
     }
     $theme = new CodeThemes();
     $theme->set('message', $message);
     $options = EasyBlogHelper::getHelper('DialogOptions')->set('title', JText::_('COM_EASYBLOG_SUBSCRIPTION_SUCCESS_DIALOG_TITLE'))->set('content', $theme->fetch('ajax.dialog.subscribe.success.php'))->toObject();
     $ejax->dialog($options);
     // Send email to notify admin upon successful subscriptions
     $user = EasyBlogHelper::getTable('Profile');
     $user->load($userId);
     $date = EasyBlogDateHelper::getDate();
     $subscriberName = $my->id == 0 ? $post['esfullname'] : $user->getName();
     $data = array('title' => JText::_('COM_EASYBLOG_SUBSCRIPTION_SUCCESS_DIALOG_TITLE'), 'subscriber' => $subscriberName, 'subscriberLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id, false, true), 'subscriberAvatar' => $user->getAvatar(), 'subscriberDate' => EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'), 'type' => $type);
     if ($type == 'entry') {
         $data['reviewLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $id, false, true);
     }
     if ($type == 'category') {
         $data['reviewLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $id, false, true);
     }
     $emailTitle = JText::_('COM_EASYBLOG_NEW') . ' ' . JText::_('COM_EASYBLOG_SUBSCRIPTION_TYPE_' . strtoupper($type)) . ' ' . strtolower(JText::_('COM_EASYBLOG_SUBSCRIPTION'));
     $emails = array();
     $notification = EasyBlogHelper::getHelper('Notification');
     $config = EasyBlogHelper::getConfig();
     // @rule: if custom_email_as_admin is enabled, use custom email as admin email
     if ($config->get('custom_email_as_admin')) {
         // @rule: Send to custom email addresses
         $notification->getCustomEmails($emails);
     } else {
         // @rule: Send to administrator's on the site.
         $notification->getAdminEmails($emails);
     }
     $notification->send($emails, $emailTitle, 'email.subscriptions', $data);
     return $ejax->send();
 }
Exemplo n.º 5
0
<li>
	<label><?php 
echo JText::_('COM_EASYBLOG_DASHBOARD_WRITE_UNPUBLISH_DATE');
?>
 :</label>
	<div>
		<?php 
$notEmpty = true;
if ($blog->publish_down == "0000-00-00 00:00:00" || empty($blog->publish_down)) {
    $newDate = EasyBlogDateHelper::getDate();
    $now = '';
    $displaynow = '';
    $nowReset = EasyBlogDateHelper::toFormat($newDate);
    $notEmpty = false;
} else {
    $newDate = EasyBlogDateHelper::getDate($blog->publish_down);
    $now = EasyBlogDateHelper::toFormat($newDate);
    $displaynow = EasyBlogDateHelper::toFormat($newDate, $system->config->get('layout_dateformat'));
    $nowReset = EasyBlogDateHelper::toFormat($newDate);
    $notEmpty = true;
}
echo EasyBlogHelper::dateTimePicker('publish_down', $notEmpty ? $displaynow : JText::_('COM_EASYBLOG_NEVER'), $now, true);
?>

		<input type="hidden" name="publish_down_reset" id="publish_down_reset" value="<?php 
echo $nowReset;
?>
"/>
		<input type="hidden" name="publish_down_ori" id="publish_down_ori" value="<?php 
echo $blog->publish_down;
?>
Exemplo n.º 6
0
	</tr>
</thead>
<tbody>
<?php 
if ($this->blogs) {
    $k = 0;
    $x = 0;
    $config = JFactory::getConfig();
    for ($i = 0, $n = count($this->blogs); $i < $n; $i++) {
        $row = $this->blogs[$i];
        $user = JFactory::getUser($row->created_by);
        $previewLink = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $row->id, true, true);
        $preview = '<a href="' . $previewLink . '" target="_blank"><img src="' . JURI::base() . '/images/preview_f2.png"/ style="width:20px; height:20px; "></a>';
        $editLink = JRoute::_('index.php?option=com_easyblog&c=blogs&task=edit&blogid=' . $row->id);
        $published = JHTML::_('grid.published', $row, $i);
        $date = EasyBlogDateHelper::getDate($row->created);
        $extGroupName = '';
        if (!empty($row->external_group_id)) {
            $blog_contribute_source = EasyBlogHelper::getHelper('Groups')->getGroupSourceType();
            $extGroupName = EasyBlogHelper::getHelper('Groups')->getGroupContribution($row->id, $blog_contribute_source, 'name');
            $extGroupName = $extGroupName . ' (' . ucfirst($blog_contribute_source) . ')';
        }
        if (!empty($row->external_event_id)) {
            $blog_contribute_source = EasyBlogHelper::getHelper('Event')->getSourceType();
            $extEventName = EasyBlogHelper::getHelper('Event')->getContribution($row->id, $blog_contribute_source, 'name');
            $extEventName = $extEventName . ' (' . ucfirst($blog_contribute_source) . ')';
        }
        $contributionDisplay = '';
        if ($row->issitewide) {
            $contributionDisplay = JText::_('COM_EASYBLOG_BLOGS_WIDE');
        } else {
Exemplo n.º 7
0
			<?php 
echo JHTML::_('select.booleanlist', 'published', 'class="input text"', $tag->published);
?>
		</td>
	</tr>
	<tr>
		<td class="key">
			<label for="created">
				<?php 
echo JText::_('COM_EASYBLOG_CREATED');
?>
			</label>
		</td>
		<td>
			<?php 
$createdDate = EasyBlogDateHelper::getDate($tag->created);
?>
			<input type="text" name="created" id="created" value="<?php 
echo $createdDate->toFormat($system->config->get('layout_systemdateformat'));
?>
" class="calendar"/>
		</td>
	</tr>
</table>
<input type="hidden" name="id" id="id" value="<?php 
echo $tag->id;
?>
"/>

<div class="dialog-actions">
	<input type="button" value="<?php 
Exemplo n.º 8
0
echo JText::_('COM_EASYBLOG_UNPUBLISHED');
?>
</option>
    		</select>
		</td>
	</tr>
	<tr>
		<td class="key">
			<label for="created"><?php 
echo JText::_('COM_EASYBLOG_CREATED');
?>
</label>
		</td>
		<td>
			<?php 
$createdDate = EasyBlogDateHelper::getDate($category->created);
?>
			<input type="text" name="created" id="created" value="<?php 
echo $createdDate->toFormat($system->config->get('layout_systemdateformat'));
?>
" class="calendar"/>
		</td>
	</tr>
</table>

<div class="ui-modbox">
    <div class="ui-modhead">
    	<div class="ui-modtitle"><?php 
echo JText::_('COM_EASYBLOG_CATEGORIES_ACCESS');
?>
</div>
Exemplo n.º 9
0
 private function _htmlContent($userId, $contextString, $itemCount, $itemObj)
 {
     $db = EasyBlogHelper::db();
     $verb = $itemObj->verb;
     $streamHTML = 'Failed retrieve content.';
     $contextArr = explode('-', $contextString);
     $context = $contextArr[0];
     switch ($context) {
         case 'comment':
             $item = $itemObj->target[0][1];
             $actor = $itemObj->actor;
             $extra = '';
             $obj = unserialize($item->uuid);
             if ($item->target_id == $userId) {
                 $actor = $obj->commentauthor;
                 $extra = '_TARGET';
             } else {
                 $actor = JText::_('COM_EASYBLOG_STREAM_YOU_AS_ACTOR');
             }
             $commentId = $item->context_id;
             $blogId = $item->source_id;
             $comment = EasyBlogCommentHelper::parseBBCode($obj->comment);
             $blogLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId) . '#comment-' . $commentId;
             $title = JText::sprintf('COM_EASYBLOG_STREAM_COMMENT_ADD' . $extra, $actor, $blogLink, $obj->blogtitle, $obj->blogtitle);
             $commentDate = EasyBlogDateHelper::getDate($item->created);
             $filename = 'stream.comment.' . $verb . '.php';
             $streamTheme = new CodeThemes();
             $streamTheme->set('title', $title);
             $streamTheme->set('time', $itemObj->friendlyTS);
             $streamTheme->set('commentDate', $commentDate->toFormat());
             $streamTheme->set('comment', $comment);
             $streamHTML = $streamTheme->fetch($filename);
             break;
         case 'profile':
             $filename = 'stream.profile.' . $verb . '.php';
             $streamTheme = new CodeThemes();
             // $actor      = $itemObj->actor;
             $actor = JText::_('COM_EASYBLOG_STREAM_YOU_AS_ACTOR');
             $streamTheme->set('actor', $actor);
             $streamTheme->set('time', $itemObj->friendlyTS);
             $streamHTML = $streamTheme->fetch($filename);
             break;
         case 'blogger':
             $streamTheme = new CodeThemes();
             $extra = '';
             $actor = $itemObj->actor;
             $targets = $itemObj->target;
             $actorArr = array();
             $targetArr = array();
             if (count($targets) > 1) {
                 $stringTitle = array();
                 $cnt = 0;
                 $swap = false;
                 foreach ($targets as $target) {
                     $item = $target[1];
                     $obj = unserialize($item->uuid);
                     if ($item->target_id == $userId) {
                         $actorArr[] = $obj->subscribername . '(' . $obj->subscriberemail . ')';
                         $targetArr[] = $obj->bloggername;
                         // we knwo this userId is now target. Get the correct theme file.
                         $extra = '.target';
                     } else {
                         $bloggerLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $item->context_id);
                         $tmpString = '<a href="' . $bloggerLink . '">' . $obj->bloggername . '</a>';
                         //$actorArr[]     = $obj->subscribername;
                         $actorArr[] = JText::_('COM_EASYBLOG_STREAM_YOU_AS_ACTOR');
                         $targetArr[] = $tmpString;
                     }
                 }
             } else {
                 $item = $targets[0][1];
                 $obj = unserialize($item->uuid);
                 if ($item->target_id == $userId) {
                     $actorArr[] = $obj->subscribername . '(' . $obj->subscriberemail . ')';
                     $targetArr[] = $obj->bloggername;
                     // we knwo this userId is now target. Get the correct theme file.
                     $extra = '.target';
                 } else {
                     $bloggerLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $item->context_id);
                     $title = '<a href="' . $bloggerLink . '">' . $obj->bloggername . '</a>';
                     // $actorArr[]     = $obj->subscribername;
                     $actorArr[] = JText::_('COM_EASYBLOG_STREAM_YOU_AS_ACTOR');
                     $targetArr[] = $title;
                 }
             }
             $targetArr = array_unique($targetArr);
             $actorArr = array_unique($actorArr);
             $stringActor = '';
             $stringTarget = '';
             // actors
             $cnt = 0;
             foreach ($actorArr as $item) {
                 if (empty($stringActor)) {
                     $stringActor = $item;
                 } else {
                     $stringActor .= $cnt + 1 == count($actorArr) ? ' and ' . $item : ', ' . $item;
                 }
                 $cnt++;
             }
             //targets
             $cnt = 0;
             foreach ($targetArr as $item) {
                 if (empty($stringTarget)) {
                     $stringTarget = $item;
                 } else {
                     $stringTarget .= $cnt + 1 == count($targetArr) ? ' and ' . $item : ', ' . $item;
                 }
                 $cnt++;
             }
             $streamTheme->set('actor', $stringActor);
             $streamTheme->set('target', $stringTarget);
             $streamTheme->set('actorCnt', count($actorArr));
             $streamTheme->set('time', $itemObj->friendlyTS);
             $filename = 'stream.blogger.' . $verb . $extra . '.php';
             $streamHTML = $streamTheme->fetch($filename);
             break;
         case 'post':
             $streamTheme = new CodeThemes();
             $extra = '';
             $actor = $itemObj->actor;
             $targets = $itemObj->target;
             /* old codes */
             // 				if( count( $targets ) > 1 )
             // 				{
             // 					$stringTitle    = '';
             // 					$cnt            = 0;
             // 					foreach( $targets as $target )
             // 					{
             // 						$item  		= $target[1];
             // 						$blogLink   = EasyBlogRouter::_( 'index.php?option=com_easyblog&view=entry&id=' . $item->context_id  );
             // 						$tmpString  = '<a href="' . $blogLink. '">' . $item->uuid . '</a>';
             //
             // 						if( empty( $stringTitle ) )
             // 						{
             // 							$stringTitle  = $tmpString;
             // 						}
             // 						else
             // 						{
             // 							$stringTitle  .=  ( ($cnt + 1) == count($targets) ) ? ' and ' . $tmpString : ', ' . $tmpString;
             // 						}
             //
             // 						$cnt++;
             // 					}
             //
             // 					$title  = $stringTitle;
             //
             // 				}
             // 				else
             // 				{
             // 					$item  		= $targets[0][1];
             // 					$blogLink   = EasyBlogRouter::_( 'index.php?option=com_easyblog&view=entry&id=' . $item->context_id  );
             // 					$title  = '<a href="' . $blogLink. '">' . $item->uuid . '</a>';
             // 				}
             /* old codes ended */
             $actorArr = array();
             $targetArr = array();
             if (count($targets) > 1) {
                 $stringTitle = array();
                 $cnt = 0;
                 $swap = false;
                 foreach ($targets as $target) {
                     $item = $target[1];
                     $obj = @unserialize($item->uuid);
                     if ($obj === false) {
                         $obj = new stdClass();
                         $obj->blogtitle = $item->uuid;
                     }
                     if ($item->target_id == $userId) {
                         $actorArr[] = $obj->subscribername;
                         // we knwo this userId is now target. Get the correct theme file.
                         $extra = '.target';
                     } else {
                         // $actorArr[]     = $itemObj->actor;
                         $actorArr[] = JText::_('COM_EASYBLOG_STREAM_YOU_AS_ACTOR');
                     }
                     $blogLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $item->context_id);
                     $title = '<a href="' . $blogLink . '">' . $obj->blogtitle . '</a>';
                     $targetArr[] = $title;
                 }
             } else {
                 $item = $targets[0][1];
                 $obj = @unserialize($item->uuid);
                 if ($obj === false) {
                     $obj = new stdClass();
                     $obj->blogtitle = $item->uuid;
                 }
                 if ($item->target_id == $userId) {
                     $actorArr[] = $obj->subscribername;
                     // we knwo this userId is now target. Get the correct theme file.
                     $extra = '.target';
                 } else {
                     //$actorArr[]     = $itemObj->actor;
                     $actorArr[] = JText::_('COM_EASYBLOG_STREAM_YOU_AS_ACTOR');
                 }
                 $blogLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $item->context_id);
                 $title = '<a href="' . $blogLink . '">' . $obj->blogtitle . '</a>';
                 $targetArr[] = $title;
             }
             $targetArr = array_unique($targetArr);
             $actorArr = array_unique($actorArr);
             $stringActor = '';
             $stringTarget = '';
             // actors
             $cnt = 0;
             foreach ($actorArr as $item) {
                 if (empty($stringActor)) {
                     $stringActor = $item;
                 } else {
                     $stringActor .= $cnt + 1 == count($actorArr) ? JText::_('COM_EASYBLOG_STREAM_AND') . $item : ', ' . $item;
                 }
                 $cnt++;
             }
             //targets
             $cnt = 0;
             foreach ($targetArr as $item) {
                 if (empty($stringTarget)) {
                     $stringTarget = $item;
                 } else {
                     $stringTarget .= $cnt + 1 == count($targetArr) ? JText::_('COM_EASYBLOG_STREAM_AND') . $item : ', ' . $item;
                 }
                 $cnt++;
             }
             $filename = 'stream.post.' . $verb . $extra . '.php';
             $streamTheme->set('actor', $stringActor);
             $streamTheme->set('target', $stringTarget);
             $streamTheme->set('actorCnt', count($actorArr));
             $streamTheme->set('time', $itemObj->friendlyTS);
             $streamHTML = $streamTheme->fetch($filename);
             break;
         case 'tag':
         case 'category':
             $jtext = $context == 'category' ? 'CATEGORY' : 'TAG';
             $view = $context == 'category' ? 'categories' : 'tags';
             $layout = $context == 'category' ? 'listings' : 'tag';
             //$actor      = $itemObj->actor;
             $actor = JText::_('COM_EASYBLOG_STREAM_YOU_AS_ACTOR');
             $items = $itemObj->target;
             $categories = '';
             if ($verb == 'delete') {
                 $total = count($items);
                 $i = 0;
                 foreach ($items as $itemArr) {
                     $item = $itemArr[1];
                     if (empty($categories)) {
                         $categories = $item->uuid;
                     } else {
                         if ($i + 1 == $total) {
                             $categories .= JText::_('COM_EASYBLOG_STREAM_AND') . $item->uuid;
                         } else {
                             $categories .= ', ' . $item->uuid;
                         }
                     }
                 }
             } else {
                 $total = count($items);
                 $i = 0;
                 foreach ($items as $itemArr) {
                     $item = $itemArr[1];
                     $catLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $view . '&layout=' . $layout . '&id=' . $item->context_id);
                     if (empty($categories)) {
                         $categories = '<a href="' . $catLink . ' " title="' . EasyBlogHelper::getHelper('String')->escape($item->uuid) . '">' . $item->uuid . '</a>';
                     } else {
                         if ($i + 1 == $total) {
                             $categories .= JText::_('COM_EASYBLOG_STREAM_AND') . '<a href="' . $catLink . ' " title="' . EasyBlogHelper::getHelper('String')->escape($item->uuid) . '">' . $item->uuid . '</a>';
                         } else {
                             $categories .= ', <a href="' . $catLink . ' " title="' . EasyBlogHelper::getHelper('String')->escape($item->uuid) . '">' . $item->uuid . '</a>';
                         }
                     }
                     $i++;
                 }
                 //end foreach
             }
             $title = JText::sprintf('COM_EASYBLOG_STREAM_' . $jtext . '_' . strtoupper($verb), $actor, $categories);
             $filename = 'stream.' . strtolower($jtext) . '.' . $verb . '.php';
             $streamTheme = new CodeThemes();
             $streamTheme->set('title', $title);
             $streamTheme->set('time', $itemObj->friendlyTS);
             $streamHTML = $streamTheme->fetch($filename);
             break;
         default:
             $streamHTML = $itemObj->story;
             break;
     }
     return $streamHTML;
 }
Exemplo n.º 10
0
 /**
  * Responsible to handle file uploads
  *
  */
 public function upload($storagePath, $storageURI, $file, $relativePath, $place)
 {
     // Cleanup any trailing slashes here.
     $storageURI = rtrim($storageURI, '/');
     // Import necessary library.
     jimport('joomla.filesystem.file');
     // Replace any . that occurs more than once
     $file['name'] = preg_replace("/\\.{2,}/ui", ".", $file['name']);
     // Ensure that the file name is safe.
     $file['name'] = JFile::makeSafe($file['name']);
     // Ensure that the file name does not contain UTF-8 data.
     $file['name'] = trim($file['name']);
     $fileName = $file['name'];
     $date = EasyBlogDateHelper::getDate();
     if (strpos($fileName, '.') === false) {
         $fileName = $date->toFormat("%Y%m%d-%H%M%S") . '.' . $fileName;
     } else {
         if (strpos($fileName, '.') == 0) {
             $fileName = $date->toFormat("%Y%m%d-%H%M%S") . $fileName;
         }
     }
     // We do not want to allow spaces in the name.
     $fileName = str_ireplace(' ', '-', $fileName);
     // Try to see if there's a need to generate a unique file name.
     $fileName = self::getUniqueName($storagePath, $fileName);
     // Get the full path to this temporary item that would be uploaded.
     $itemPath = JPath::clean($storagePath . DIRECTORY_SEPARATOR . $fileName);
     // @TODO: For now this is hardcoded to determine the type of the item. It is either an image or a file. That's it.
     $lib = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'types' . DIRECTORY_SEPARATOR . 'item.php';
     $classType = 'Item';
     if (self::isImage($file['tmp_name'])) {
         $lib = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'types' . DIRECTORY_SEPARATOR . 'image.php';
         $classType = 'Image';
     }
     require_once $lib;
     $className = 'EasyBlogMediaManager' . ucfirst($classType);
     // Let's pass this to the respective media items to process.
     // PHP 5.2 doesn't allow calling dynamic class variables for some reason.
     $obj = new $className('', '', $relativePath);
     $result = $obj->upload($storagePath, $fileName, $file);
     if ($result !== true) {
         return $result;
     }
     // Set the relative path.
     $this->relative = $relativePath;
     $obj = $this->getItem($itemPath, $storageURI, $relativePath, true, $place, true);
     return $obj;
 }
Exemplo n.º 11
0
                } else {
                    ?>
								<?php 
                    echo $this->escape($this->getLanguageTitle($row->language));
                    ?>
							<?php 
                }
                ?>
						</td>
					<?php 
            }
            ?>

					<td class="center">
						<?php 
            echo EasyBlogDateHelper::getDate($row->created)->toMySQL();
            ?>
					</td>

					<td class="center"><?php 
            echo $row->id;
            ?>
</td>
					<?php 
        }
        ?>
				</tr>
					<?php 
        $i++;
        ?>
				<?php