コード例 #1
0
ファイル: listing.php プロジェクト: ranrolls/ras-full-portal
 public function updateComment()
 {
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     $user = JFactory::getUser();
     $model = $this->getModel();
     $app = JFactory::getApplication();
     $data = $app->input->getArray($_POST);
     $listingId = $data['listing_id'];
     $commentId = $data['comment_id'];
     $canEditComment = JUDirectoryFrontHelperPermission::canEditComment($commentId);
     $redirectUrl = JRoute::_(JUDirectoryHelperRoute::getListingRoute($listingId) . '#comment-item-' . $commentId);
     if (!$canEditComment) {
         $this->setMessage(JText::_('COM_JUDIRECTORY_UPDATE_COMMENT_ERROR'));
         $this->setRedirect($redirectUrl);
         return false;
     }
     $params = JUDirectoryHelper::getParams(null, $listingId);
     $ratingValue = $this->validateCriteria($data);
     if ($ratingValue) {
         $data = array_merge($data, $ratingValue);
     } else {
         $this->setMessage(JText::_('COM_JUDIRECTORY_UPDATE_COMMENT_ERROR'));
         $this->setRedirect($redirectUrl);
         return false;
     }
     JUDirectoryHelper::obCleanData();
     if ($model->updateComment($data, $params)) {
         $logData = array('user_id' => $user->id, 'event' => 'comment.edit', 'item_id' => $commentId, 'listing_id' => $listingId, 'value' => 0, 'reference' => '');
         JUDirectoryFrontHelperLog::addLog($logData);
         $this->setMessage(JText::_('COM_JUDIRECTORY_UPDATE_COMMENT_SUCCESSFULLY'));
         $this->setRedirect($redirectUrl);
         return true;
     } else {
         $this->setMessage(JText::_('COM_JUDIRECTORY_UPDATE_COMMENT_ERROR'));
         $this->setRedirect($redirectUrl);
         return false;
     }
 }
コード例 #2
0
 public function getOutput($options = array())
 {
     if (!$this->isPublished()) {
         return "";
     }
     if (!$this->value) {
         return "";
     }
     $options = (array) $options;
     if ($this->isDetailsView($options)) {
         if ($this->params->get("show_introtext_in_details_view", 1)) {
             $description = $this->value;
         } else {
             $description = $this->listing->fulltext;
         }
         if ($this->params->get("strip_tags_details_view", 0)) {
             $allowable_tags = $this->params->get("allowable_tags", "u,b,i,a,ul,li,pre,blockquote,strong,em");
             $allowable_tags = str_replace(' ', '', $allowable_tags);
             $allowable_tags = "<" . str_replace(',', '><', $allowable_tags) . ">";
             $description = strip_tags($description, $allowable_tags);
         }
         if ($this->params->get("parse_plugin", 0)) {
             $description = JHtml::_('content.prepare', $description);
         }
         if ($this->params->get("auto_link", 1)) {
             $trim_long_url = $this->params->get('trim_long_url', 0);
             $front_portion_url = $this->params->get('front_portion_url', 0);
             $back_portion_url = $this->params->get('back_portion_url', 0);
             $regex = "#http(?:s)?:\\/\\/(?:www\\.)?[\\.0-9a-z]{1,255}(\\.[a-z]{2,4}){1,2}([\\/\\?][^\\s]{1,}){0,}[\\/]?#i";
             preg_match_all($regex, $description, $matches);
             $matches = array_unique($matches[0]);
             if (count($matches) > 0) {
                 foreach ($matches as $url) {
                     $shortenUrl = urldecode($url);
                     if ($trim_long_url > 0 && strlen($shortenUrl) > $trim_long_url) {
                         if ($front_portion_url > 0 || $back_portion_url > 0) {
                             $frontStr = $front_portion_url > 0 ? substr($shortenUrl, 0, $front_portion_url) : "";
                             $backStr = $back_portion_url > 0 ? substr($shortenUrl, (int) (0 - $back_portion_url)) : "";
                             $shortenUrl = $frontStr . '...' . $backStr;
                         }
                         $shortenUrl = '<a href="' . $url . '">' . $shortenUrl . '</a> ';
                         $description = str_replace(trim($url), $shortenUrl, $description);
                         $description = JUDirectoryFrontHelperString::replaceIgnore(trim($url), $shortenUrl, $description);
                     } else {
                         $description = JUDirectoryFrontHelperString::replaceIgnore($url, '<a href="' . $url . '">' . trim($shortenUrl) . '</a> ', $description);
                     }
                 }
             }
         }
         if ($this->params->get("nl2br_details_view", 0)) {
             $description = nl2br($description);
         }
     } else {
         $description = $this->listing->introtext;
         if ($this->params->get("strip_tags_list_view", 1)) {
             $allowable_tags = $this->params->get("allowable_tags", "u,b,i,a,ul,li,pre,blockquote,strong,em");
             $allowable_tags = str_replace(' ', '', $allowable_tags);
             $allowable_tags = "<" . str_replace(',', '><', $allowable_tags) . ">";
             $description = strip_tags($description, $allowable_tags);
         }
         if ($this->params->get("use_html_entities", 0)) {
             $description = htmlentities($description);
         }
         $isTruncated = false;
         if ($this->params->get("truncate", 1)) {
             if ($this->params->get("limit_char_in_list_view", 200) < strlen($description)) {
                 $isTruncated = true;
             }
             $description = JUDirectoryFrontHelperString::truncateHtml($description, $this->params->get("limit_char_in_list_view", 200));
         }
         if ($this->params->get("parse_plugin", 0)) {
             $description = JHtml::_('content.prepare', $description);
         }
         if ($this->params->get("show_readmore", 0)) {
             if ($this->params->get("show_readmore_when", 1) == 2 || $this->params->get("show_readmore_when", 1) == 1 && $isTruncated) {
                 $description .= ' <a class="readmore" href="' . JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->listing_id)) . '">' . $this->params->get("readmore_text", 'Read more...') . '</a>';
             }
         }
     }
     $this->setVariable('value', $description);
     return $this->fetch('output.php', __CLASS__);
 }
コード例 #3
0
ファイル: default.php プロジェクト: ranrolls/ras-full-portal
?>
			</tr>
			</thead>

			<tbody>
			<?php 
if (count($this->items) > 0) {
    foreach ($this->items as $key => $value) {
        $type = $value->type;
        if ($type == 'listing') {
            $title = $value->listing_title;
            $linkListing = JRoute::_(JUDirectoryHelperRoute::getListingRoute($value->item_id));
        }
        if ($type == 'comment') {
            $title = $value->comment_title;
            $linkListing = JRoute::_(JUDirectoryHelperRoute::getListingRoute($value->listing_id));
        }
        if ($this->isOwnDashboard) {
            $unsubscribeLink = JRoute::_('index.php?option=com_judirectory&task=usersubscriptions.unsubscribe&sub_id=' . $value->id . '&' . $this->token . '=1');
        }
        ?>
					<?php 
        if ($title) {
            ?>
						<tr>
							<?php 
            if ($this->isOwnDashboard) {
                ?>
								<td>
									<?php 
                echo JHtml::_('grid.id', $key, $value->id);
コード例 #4
0
ファイル: output.php プロジェクト: ranrolls/ras-full-portal
<?php

/**
 * ------------------------------------------------------------------------
 * JUDirectory for Joomla 2.5, 3.x
 * ------------------------------------------------------------------------
 *
 * @copyright      Copyright (C) 2010-2015 JoomUltra Co., Ltd. All Rights Reserved.
 * @license        GNU General Public License version 2 or later; see LICENSE.txt
 * @author         JoomUltra Co., Ltd
 * @website        http://www.joomultra.com
 * @----------------------------------------------------------------------@
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
if (!$isDetailsView) {
    $this->setAttribute("href", JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->listing_id)), "output");
    echo '<a ' . $this->getAttribute(null, null, "output") . '>' . $value . '</a>';
} else {
    echo '<span ' . $this->getAttribute(null, null, "output") . '>' . $value . '</span>';
}
コード例 #5
0
ファイル: default.php プロジェクト: ranrolls/ras-full-portal
        } elseif ($item->level > 1) {
            $parentCommentObject = JUDirectoryFrontHelperComment::getCommentObject($item->parent_id, 'cm.id, cm.title');
            $limitStart = $listingModel->getLimitStartForComment($parentCommentObject->id);
            ?>
								<a href="<?php 
            echo JRoute::_(JUDirectoryHelperRoute::getListingRoute($item->listing_id));
            ?>
">
									<?php 
            echo $item->listing_title;
            ?>
								</a>
								<span> / </span>
								<a target="_blank"
								   href="<?php 
            echo JRoute::_(JUDirectoryHelperRoute::getListingRoute($item->listing_id) . '&limitstart=' . $limitStart . '&resetfilter=1' . '#comment-item-' . $parentCommentObject->id);
            ?>
">
									<?php 
            echo $parentCommentObject->title;
            ?>
								</a>
							<?php 
        }
        ?>
						</td>

						<td class="center">
							<?php 
        if ($item->user_id > 0) {
            $userComment = JFactory::getUser($item->user_id);
コード例 #6
0
ファイル: default.php プロジェクト: ranrolls/ras-full-portal
						<td>
							<a href="<?php 
        echo JRoute::_(JUDirectoryHelperRoute::getListingRoute($item->listing_id));
        ?>
">
								<?php 
        echo $item->listing_title;
        ?>
</a>
							<?php 
        if ($item->level > 1) {
            ?>
								<span class="divider"> > </span>
								<a target="_blank"
								   href="<?php 
            echo JRoute::_(JUDirectoryHelperRoute::getListingRoute($item->listing_id)) . "#comment-item-" . $item->parent_id;
            ?>
">
									<?php 
            echo $item->parent_title;
            ?>
</a>
							<?php 
        }
        ?>
						</td>
						<td>
							<?php 
        if ($item->user_id > 0) {
            $userComment = JFactory::getUser($item->user_id);
            echo $userComment->get('name');
コード例 #7
0
 protected function _setBreadcrumb()
 {
     $categoryId = JUDirectoryFrontHelperCategory::getMainCategoryId($this->item->id);
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     $pathwayArray = array();
     if ($categoryId) {
         $pathwayArray = JUDirectoryFrontHelperBreadcrumb::getBreadcrumbCategory($categoryId);
     } else {
         $pathwayArray[] = JUDirectoryFrontHelperBreadcrumb::getRootPathway();
     }
     $linkListing = JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->item->id));
     $pathwayArray[] = JUDirectoryFrontHelperBreadcrumb::createPathwayItem($this->item->title, $linkListing);
     if ($this->_layout == 'print') {
         $pathwayArray[] = JUDirectoryFrontHelperBreadcrumb::createPathwayItem('PRINT');
         $document = JFactory::getDocument();
         $document->setMetaData('robots', 'noindex, nofollow');
     }
     $pathway->setPathway($pathwayArray);
 }
コード例 #8
0
ファイル: output.php プロジェクト: ranrolls/ras-full-portal
/**
 * ------------------------------------------------------------------------
 * JUDirectory for Joomla 2.5, 3.x
 * ------------------------------------------------------------------------
 *
 * @copyright      Copyright (C) 2010-2015 JoomUltra Co., Ltd. All Rights Reserved.
 * @license        GNU General Public License version 2 or later; see LICENSE.txt
 * @author         JoomUltra Co., Ltd
 * @website        http://www.joomultra.com
 * @----------------------------------------------------------------------@
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$this->setAttribute("src", $image_src, "output");
$this->setAttribute("alt", $this->listing->title, "output");
$this->setAttribute("title", $this->listing->title, "output");
if ($isDetailsView) {
    if ($this->params->get("details_view_set_icon_dimension", 1)) {
        $this->setAttribute("style", 'display: block; max-width:' . $this->params->get("details_view_image_width", 100) . 'px; max-height:' . $this->params->get("details_view_icon_height", 100) . 'px;', "output");
    }
    $html = '<img ' . $this->getAttribute(null, null, "output") . ' />';
    echo $html;
} else {
    $html = '<a href="' . JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->listing->id)) . '">';
    if ($this->params->get("list_view_set_icon_dimension", 1)) {
        $this->setAttribute("style", 'display: block; max-width:' . $this->params->get("details_view_image_width", 100) . 'px; max-height:' . $this->params->get("details_view_icon_height", 100) . 'px;', "output");
    }
    $html .= '<img ' . $this->getAttribute(null, null, "output") . ' />';
    $html .= '</a>';
    echo $html;
}
コード例 #9
0
ファイル: default.php プロジェクト: ranrolls/ras-full-portal
        ?>
		<tr>
		<td class="center">
			<input type="checkbox" class="judir-cb" name="cid[]" value="<?php 
        echo $item->id;
        ?>
"
			       id="judir-cb-<?php 
        echo $i;
        ?>
"/>
		</td>
		<td class="title">
			<div class="title-wrapper">
				<a href="<?php 
        echo JRoute::_(JUDirectoryHelperRoute::getListingRoute($item->id));
        ?>
"
				   title="<?php 
        echo $item->title;
        ?>
">
					<?php 
        echo $item->title;
        ?>
				</a>
				<?php 
        if ($item->label_unpublished) {
            ?>
					<span class="label label-unpublished"><?php 
            echo JText::_('COM_JUDIRECTORY_UNPUBLISHED');
コード例 #10
0
ファイル: helper.php プロジェクト: ranrolls/ras-full-portal
 public static function getLocations($listings)
 {
     $locations = array();
     $listingIds = array();
     if ($listings) {
         foreach ($listings as $listing) {
             $listingIds[] = $listing->id;
         }
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('location.*, listing.image AS listing_image, listing.title')->from('#__judirectory_locations AS location')->join('', '#__judirectory_listings AS listing ON listing.id = location.listing_id')->where('listing.id IN (' . implode(',', $listingIds) . ')');
         $db->setQuery($query);
         $locations = $db->loadObjectList();
         $locationIconUrl = JUri::root(true) . '/media/com_judirectory/images/location/';
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables');
         $addressTable = JTable::getInstance('Address', 'JUDirectoryTable');
         foreach ($locations as $location) {
             if ($location->image) {
                 $location->image = $locationIconUrl . $location->listing_id . '/' . $location->image;
             } else {
                 $location->image = JUDirectoryHelper::getListingImage($location->listing_image);
             }
             $addresses = self::getAddresses($addressTable, $location->address_id);
             $addresses[] = $location->address;
             $location->address = implode(', ', array_reverse($addresses));
             $location->link = JRoute::_(JUDirectoryHelperRoute::getListingRoute($location->listing_id));
             $location->description = nl2br($location->description);
         }
     }
     return $locations;
 }
コード例 #11
0
">
									<?php 
    echo $commentObj->listing_title;
    ?>
								</a>
							</div>

							<?php 
    if ($commentObj->level > 1) {
        ?>
								<div class="comment-reply">
									<i class="fa fa-mail-forward"></i> <?php 
        echo JText::_("COM_JUDIRECTORY_REPLY_COMMENT");
        ?>
									<a href="<?php 
        echo JRoute::_(JUDirectoryHelperRoute::getListingRoute($commentObj->listing_id) . '#comment-item-' . $commentObj->id);
        ?>
">
										<?php 
        echo $commentObj->parent_title;
        ?>
									</a>
								</div>
							<?php 
    }
    ?>
						</div>
						<?php 
    $commentObj->comment = JUDirectoryFrontHelper::BBCode2Html($commentObj->comment);
    $commentObj->comment = JUDirectoryFrontHelperComment::parseCommentText($commentObj->comment, $commentObj->listing_id);
    ?>
コード例 #12
0
ファイル: listing.php プロジェクト: ranrolls/ras-full-portal
 public function getDisqus($listing_id, $short_name = '')
 {
     if ($short_name == '') {
         $params = JUDirectoryHelper::getParams(null, $listing_id);
         $short_name = $params->get('disqus_username', '');
     }
     $listingObj = JUDirectoryHelper::getListingById($listing_id);
     $listingUrl = JUDirectoryHelperRoute::getListingRoute($listing_id);
     $script = "\n\t\t\tvar disqus_shortname = '{$short_name}';\n\t\t\tvar disqus_identifier = 'id={$listing_id}';\n\t\t\tvar disqus_title = '{$listingObj->title}';\n\t\t\tvar disqus_url = '{$listingUrl}';\n\t\t\t(function() {\n\t\t\t\tvar dsq\t\t= document.createElement('script');\n\t\t\t\tdsq.type\t= 'text/javascript';\n\t\t\t\tdsq.async\t= true;\n\t\t\t\tdsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';\n\t\t\t\t(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n\t\t\t})();";
     $document = JFactory::getDocument();
     $document->addScriptDeclaration($script);
 }