Esempio n. 1
0
								<img class="jav-avatar" src="<?php 
                        echo $admin_avatar[0];
                        ?>
" style="<?php 
                        echo $admin_avatar[1];
                        ?>
">
								<?php 
                    }
                    ?>
								<?php 
                    echo JText::_('ADMIN_RESPONSE');
                    ?>
							</div>
							<?php 
                    echo html_entity_decode($helper->showItem($admin_response->content));
                    ?>
							<?php 
                    if ($attachFiles) {
                        ?>
								<div class="jav-response-upload"><?php 
                        if ($attachFiles) {
                            echo $attachFiles;
                        }
                        ?>
</div>
							<?php 
                    }
                    ?>
							<span class="editable">
								<a class="user" href="<?php 
Esempio n. 2
0
 function mark_best_answer()
 {
     if (!JAVoiceHelpers::checkPermissionAdmin()) {
         $k = 0;
         $object[$k] = new stdClass();
         $object[$k]->id = '#jav-msg-loading';
         $object[$k]->attr = 'html';
         $object[$k]->content = JText::_("SORRY_YOU_DONT_PERMISSION");
         $k++;
         $object[$k] = new stdClass();
         $object[$k]->id = '#jav-msg-loading';
         $object[$k]->attr = 'css';
         $object[$k]->content = 'display,block';
         $helper = new JAVoiceHelpers();
         echo $helper->parse_JSON_new($object);
         exit;
     }
     $option = JRequest::getCmd('option');
     $user = JFactory::getUser();
     JArrayHelper::toInteger($cid);
     $model = $this->getModel('items');
     $helper = new JAVoiceHelpers();
     $post = JRequest::get('request');
     //echo 22;exit;
     // allow name only to contain html
     if (JRequest::getCmd("javNameOfTextarea", "newVoiceContent") == "newVoiceContentReply") {
         $post['content'] = trim(JRequest::getVar('newVoiceContentReply', '', 'request', 'string', JREQUEST_ALLOWRAW));
     } else {
         $post['content'] = trim(JRequest::getVar('content', '', 'request', 'string', JREQUEST_ALLOWRAW));
     }
     $helper->removeEmptyBBCode($post['content']);
     //echo $post ['content'];exit;
     $post['user_id'] = $user->id;
     $post['item_id'] = JRequest::getInt('item_id');
     $post['type'] = 'best_answer';
     $response = $model->getAdmin_responses(" and item_id=" . $post['item_id'] . " and type='best_answer'");
     if ($response) {
         JRequest::setVar('cid', $response[0]->id);
     }
     $model->setState('request', $post);
     $row = $model->store_admin_response();
     //print_r($row);exit;
     if (isset($row->id)) {
         $object = array();
         $k = 0;
         //echo html_entity_decode($helper->showItem($row->content));exit;
         $object[$k] = new stdClass();
         $object[$k]->id = '#jav-box-item-' . $row->item_id . ' .jav-bestanswer-text';
         $object[$k]->attr = 'html';
         $object[$k]->content = '<label><em>' . JText::_('BEST_ANSWER') . '</em></label><span>' . html_entity_decode($helper->showItem($row->content)) . '</span>';
         $object[$k]->content .= '<span class="editable"><a onclick="return show_frm_bestanswer(\'#link-bestanswer-' . $row->item_id . '\', ' . $row->item_id . ', ' . $row->id . ')" href="javascript:void(0)" class="edit-link">' . JText::_('EDIT') . '</a></span>';
         $object[$k]->content .= '<input type="hidden" id="jav-content-bestanswer-' . $row->item_id . '" value="' . htmlentities(nl2br($row->content)) . '"/>';
         $k++;
         $object[$k] = new stdClass();
         $object[$k]->id = '#bestanswer-' . $row->item_id;
         $object[$k]->attr = 'html';
         $object[$k]->content = $row->content;
         $k++;
         $object[$k] = new stdClass();
         $object[$k]->id = '#frm-bestanswer-' . $row->item_id;
         $object[$k]->attr = 'css';
         $object[$k]->content = 'display,none';
         $k++;
         $object[$k] = new stdClass();
         $object[$k]->id = '#jav-box-item-' . $row->item_id . ' .jav-bestanswer-text';
         $object[$k]->attr = 'css';
         $object[$k]->content = 'display,block';
         $k++;
         $helper = new JAVoiceHelpers();
         echo $helper->parse_JSON_new($object);
         exit;
     } else {
         //echo JText::_('ERROR_FOUND_FAIL_TO_SAVE_IDEA' );
     }
 }
Esempio n. 3
0
 function parseItems_params($items, $type = null)
 {
     global $javconfig;
     //print_r($items);exit;
     $db = JFactory::getDBO();
     $helper = new JAVoiceHelpers();
     $Itemid = JRequest::getInt('Itemid');
     if ($type) {
         $types[0] = $type;
     } else {
         $types = $this->getVoiceTypes();
     }
     $array_votes = array();
     if ($types) {
         foreach ($types as $type) {
             $params_type = class_exists('JRegistry') ? new JRegistry($type->vote_option) : new JParameter($type->vote_option);
             $array_votes[$type->id]['value'] = $params_type->get('votes_value') ? str_replace("###", ',', $params_type->get('votes_value')) : '';
             $array_votes[$type->id]['text'] = $params_type->get('votes_text') ? $db->Quote(str_replace("###", ',', $params_type->get('votes_text'))) : '';
             $array_votes[$type->id]['description'] = $params_type->get('votes_description') ? $db->Quote(str_replace("###", ',', htmlspecialchars($params_type->get('votes_description')))) : '';
         }
     }
     $currentUser = JFactory::getUser();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_javoice' . DS . 'models' . DS . 'forums.php';
     $model_forums = new JAVoiceModelforums();
     $searchword = JRequest::getString('key');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_search' . DS . 'helpers' . DS . 'search.php';
     if ($items) {
         $model_status = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel');
         foreach ($items as $k => $item) {
             if (!$item->status_publishded) {
                 $items[$k]->voice_type_status_id = 0;
             }
             $items[$k]->content = $helper->showItem($items[$k]->content, 0);
             //if user use anonymous in this item
             if (!($javconfig['systems']->get('use_anonymous', 0) && $item->use_anonymous)) {
                 if (isset($item->user_id) && $item->user_id > 0) {
                     $user = JFactory::getUser($item->user_id);
                     if ($javconfig['plugin']->get('displayname', 'username') == "name") {
                         $creat_by = $user->name;
                     } else {
                         if ($javconfig['plugin']->get('displayname', 'username') == "username") {
                             $creat_by = $user->username;
                         } else {
                             $creat_by = JText::_("ANONYMOUS");
                         }
                     }
                 } elseif (isset($item->guest_name) && $item->guest_name != '') {
                     if ($javconfig['plugin']->get('displayname', 'username') == "anonymous") {
                         $creat_by = JText::_("ANONYMOUS");
                     } else {
                         $creat_by = $item->guest_name;
                     }
                 } else {
                     $creat_by = JText::_('ANONYMOUS');
                 }
             } else {
                 $creat_by = JText::_('ANONYMOUS');
             }
             $link = JRoute::_('index.php?option=com_javoice&view=items&layout=item&cid=' . $item->id . '&type=' . $item->voice_types_id . '&amp;forums=' . $item->forums_id . '&amp;Itemid=' . $Itemid);
             $items[$k]->create_date_store = $item->create_date;
             $items[$k]->create_date = $helper->generatTimeStamp($item->create_date);
             $items[$k]->update_date = $helper->generatTimeStamp($item->update_date);
             $items[$k]->create_by = $creat_by;
             $items[$k]->link = $link;
             $items[$k]->list_vote_value = '';
             $items[$k]->list_vote_text = '\'\'';
             $items[$k]->list_vote_description = '\'\'';
             $items[$k]->has_down = 0;
             $check = true;
             /* Check status has closed */
             if ($item->voice_type_status_id && $item->status_allow_voting == 0) {
                 $items[$k]->list_vote_msg = $db->Quote(JText::_('VOTING_IS_CLOSED'));
                 $check = false;
             } elseif ($item->voice_type_status_id && $item->status_allow_voting == -1) {
                 $parent_status = $model_status->getItem($item->status_parent_id);
                 if ($parent_status->allow_voting == 0) {
                     $items[$k]->list_vote_msg = $db->Quote(JText::_('VOTING_IS_CLOSED'));
                     $check = false;
                 } else {
                     $item->status_allow_voting = $parent_status->allow_voting;
                 }
             }
             if ($check) {
                 $user_can_post = $user_can_view = 0;
                 $forum = $model_forums->getItem(array($item->forums_id));
                 $forum->gids_post = str_replace("\n\n", "\n", $forum->gids_post);
                 $forum->gids_vote = str_replace("\n\n", "\n", $forum->gids_post);
                 $lits_user_can_posts = explode("\n", $forum->gids_post);
                 $lits_user_can_views = explode("\n", $forum->gids_view);
                 $levels = $currentUser->getAuthorisedViewLevels();
                 $levels[] = 0;
                 foreach ($levels as $gkey => $gVal) {
                     if (in_array($gVal, $lits_user_can_posts)) {
                         $user_can_post = 1;
                     }
                     if (in_array($gVal, $lits_user_can_views)) {
                         $user_can_view = 1;
                     }
                 }
                 if (!$user_can_view) {
                     unset($items[$k]);
                 } else {
                     if ($user_can_post && isset($array_votes[$item->voice_types_id]['value'])) {
                         $items[$k]->list_vote_value = $array_votes[$item->voice_types_id]['value'];
                         $items[$k]->list_vote_text = $array_votes[$item->voice_types_id]['text'];
                         $items[$k]->list_vote_description = $array_votes[$item->voice_types_id]['description'];
                         $items[$k]->list_vote_msg = '\'\'';
                         $values = explode(',', $array_votes[$item->voice_types_id]['value']);
                         foreach ($values as $value) {
                             if (intval($value) < 0) {
                                 $items[$k]->has_down = 1;
                                 break;
                             }
                         }
                     } else {
                         if ($currentUser->id) {
                             $items[$k]->list_vote_msg = '<span class=error>' . JText::_('YOU_DO_NOT_HAVE_PERMISSION_TO_VOTE') . '<span>';
                         } else {
                             $items[$k]->list_vote_msg = JText::_('LOGINREGISTER_TO_VOTE');
                         }
                         $items[$k]->list_vote_msg = $db->Quote($items[$k]->list_vote_msg);
                     }
                 }
             }
             if ($searchword && isset($items[$k])) {
                 $searchwords = preg_split("/\\s+/u", $searchword);
                 $needle = $searchwords[0];
                 $maxchars = $javconfig['systems']->get('maxchars', 100);
                 if ($maxchars == -1) {
                     $maxchars = strlen($item->content);
                 }
                 SearchHelper::prepareSearchContent($item->content, $maxchars, $needle);
                 $searchwords = array_unique($searchwords);
                 $searchRegex = '#(';
                 $x = 0;
                 foreach ($searchwords as $hlword) {
                     $searchRegex .= $x == 0 ? '' : '|';
                     $searchRegex .= preg_quote($hlword, '#');
                     $x++;
                 }
                 $searchRegex .= ')#iu';
                 $items[$k]->content = preg_replace($searchRegex, '<span class="highlight">\\0</span>', $item->content);
                 $items[$k]->title = preg_replace($searchRegex, '<span class="highlight">\\0</span>', $item->title);
             }
         }
     }
     return $items;
 }
Esempio n. 4
0
$image->descriptionHtmlSyndicated = true;
if (isset($content->imgUrl) && $content->imgUrl != "") {
    $rss->image = $image;
}
$rows = $content->rsscontents;
if (is_array($rows)) {
    foreach ($rows as $row) {
        $item = new FeedItem();
        $item->title = $row->title;
        $item->link = $row->link;
        $item->guid = $row->guid;
        $AddReadMoreLink = false;
        $words = $row->content;
        //add BBCODE
        if ($javconfig['plugin']->get('enable_bbcode', 1)) {
            $words = $helper->showItem($words);
        }
        if (str_word_count(trim($words)) > $content->feed_numWords) {
            $AddReadMoreLink = true;
            $words = word_limiter($words, $content->feed_numWords);
        }
        $words = addAbsoluteURL($words);
        $item->description = $words;
        $item->descriptionHtmlSyndicated = true;
        $item->date = $row->date;
        $item->source = $row->source;
        $author = trim($row->user_id);
        //		if (empty($author)) $author = $row->author;
        $temp_user = JFactory::getUser($row->user_id);
        $item->author = $content->feed_renderAuthorFormat == 'NAME' ? $temp_user->user_name : ($content->feed_renderAuthorFormat == 'EMAIL' ? $temp_user->email : $author . ' <' . $temp_user->email . '>');
        $rss->addItem($item);