Ejemplo n.º 1
0
 function widgetlist()
 {
     $modelvoicetypes = JAVBModel::getInstance('voicetypes', 'javoiceModel');
     $modelvoicetypesstatus = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel');
     $voicetypes = $modelvoicetypes->getDyamicItems(' AND t.published=1 ', 't.title DESC', 0, 0, ' t.alias ');
     $strvoicetypes = '';
     if ($voicetypes) {
         $strvoicetypes = implode(", ", $voicetypes);
     }
     $voicetypesID = $modelvoicetypes->getDyamicItems(' AND t.published=1 ', 't.title DESC', 0, 0, ' t.id ');
     $voicetypesID = is_array($voicetypesID) ? implode(",", $voicetypesID) : '';
     $where_more = '';
     $modelforums = JAVBModel::getInstance('forums', 'javoiceModel');
     $where_more .= " and f.published=1 and ft.voice_types_id in ({$voicetypesID})";
     $join = 'INNER JOIN #__jav_forums_has_voice_types as ft ON ft.forums_id=f.id';
     $forums = $modelforums->getDyamicItems($where_more, 0, 4, ' f.title desc', 'DISTINCT f.alias', $join);
     $strforum = '';
     if ($forums) {
         $strforum = implode(", ", $forums);
     }
     $status = $modelvoicetypesstatus->getItemsDyamic('DISTINCT s.title', '', '', 0, 0, 1);
     $statusStr = "";
     if ($status) {
         $statusStr = implode(",", $status);
     }
     $script = "<div id = 'jav_widget_content'></div>" . "\n <script type=\"text/javascript\" src=\"" . JURI::root() . "components/com_javoice/asset/js/ja.widget.js\"></script>" . "\n <script type=\"text/javascript\">" . "\n \tJAV_Widget.show({" . "\n \t\turl: '" . JURI::root() . "'," . "\n \t\tvoicetypes:'{$strvoicetypes}',//null for all" . "\n \t\tforums: '{$strforum}',//null for all, it may be number, alias, or title" . "\n \t\tnumber_voices:20," . "\n \t\twidth : '800'," . "\n \t\theight : '600'," . "\n \t\tstatus : '',//null for all" . "\n \t\tcreator : '',//null for all" . "\n \t\tcreated_before : '',//null for all" . "\n \t\tcreated_after : '',//null for all" . "\n \t\tlink_target : '_blank'," . "\n \t\ttype : 'iframe'," . "\n \t\tview_all_button : 'yes'" . "\n \t})" . "\n </script>";
     $script = htmlentities($script);
     $this->assignRef('script', $script);
     $this->assignRef('strforum', $strforum);
     $this->assignRef('strvoicetypes', $strvoicetypes);
 }
Ejemplo n.º 2
0
 function show_statistic()
 {
     $model_items = JAVBModel::getInstance('items', 'JAVoiceModel');
     $types = $model_items->getVoiceTypes();
     $this->assignRef('types', $types);
     $config = new JConfig();
     $pagetitle = @JFactory::getUser(JRequest::getInt('uid'))->username . JText::_('S_VOICE_STATISTICS_AT') . ' ' . $config->sitename;
     $document = JFactory::getDocument();
     $document->setTitle($pagetitle);
 }
Ejemplo n.º 3
0
 function statistic()
 {
     $user = JFactory::getUser();
     $latvisited = strtotime($user->lastvisitDate) ? strtotime($user->lastvisitDate) : 0;
     $model_voicetype = JAVBModel::getInstance('voicetypes', 'javoiceModel');
     $voiceTypes = $model_voicetype->getItems('', ' t.title ');
     $model = JAVBModel::getInstance('actionslog', 'javoiceModel');
     $model_items = JAVBModel::getInstance('items', 'javoiceModel');
     $join = " \tINNER JOIN #__jav_voice_types as t ON t.id=i.voice_types_id";
     $lifetime = array();
     $lastest = array();
     if (count($voiceTypes) > 0) {
         foreach ($voiceTypes as $voiceType) {
             $where = " AND t.id= {$voiceType->id} ";
             //AND i.create_date > $latvisited ";
             $lifetime[] = $model_items->getTotal($where, $join);
             $join = " \tINNER JOIN #__jav_forums as f ON f.id=i.forums_id \n\t\t\n \t\t\t\tINNER JOIN #__jav_voice_types as t ON t.id=i.voice_types_id ";
             $where .= " AND i.create_date > {$latvisited} ";
             $lastest[] = $model_items->getTotal($where, $join);
         }
     }
     $where_more = " AND l.type ='Report spam' AND l.user_id = -1 ";
     $join = " INNER JOIN #__jav_items as i ON i.id = l.ref_id ";
     $lastest_spam = $model->getDistinctItems($where_more, 0, 10, ' l.time DESC', $join);
     $lastest_spam = $model->parseItems($lastest_spam);
     $where_more = " AND (l.type ='Report spam' OR l.type ='Change status')  AND l.user_id >0 ";
     $join = " INNER JOIN #__jav_items as i ON i.id = l.ref_id  ";
     $lastest_change = $model->getDistinctItems($where_more, 0, 10, ' l.time DESC', $join);
     $lastest_change = $model->parseItems($lastest_change);
     $where = " AND r.type='admin_response'";
     $join = " INNER JOIN #__jav_items as i ON i.id = r.item_id ";
     $admin_response = $model_items->getAdmin_responses($where, 0, 10, ' r.id DESC', '', $join);
     $model_items->parseAdmin_response($admin_response);
     $this->assign('lastest_spam', $lastest_spam);
     $this->assign('latvisited', $latvisited);
     $this->assign('lastest_change', $lastest_change);
     $this->assign('admin_response', $admin_response);
     $this->assign('voiceTypes', $voiceTypes);
     $this->assign('lastest', $lastest);
     $this->assign('lifetime', $lifetime);
 }
Ejemplo n.º 4
0
 function saveIFrame()
 {
     $post = JRequest::get('request', JREQUEST_ALLOWHTML);
     $number = $post['number'];
     $errors = array();
     $id = $this->save($errors);
     $helper = new JAVoiceHelpers();
     $objects = array();
     if ($id) {
         $model = $this->getModel('forums');
         $item = $model->getItem();
         if ($post['id'] == '0') {
             $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, 1);
         } else {
             $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, JText::_("SAVE_DATA_SUCCESSFULLY")));
         }
         $objects[] = $helper->parseProperty("html", "#title" . $item->id, $item->title);
         $objects[] = $helper->parsePropertyPublish("html", "#publish" . $item->id, $item->published, $number);
         $modelvoicetypes = JAVBModel::getInstance('voicetypes', 'javoiceModel');
         $where = " AND ft.forums_id = {$item->id}";
         $joins = " INNER JOIN #__jav_forums_has_voice_types as ft ON t.id = ft.voice_types_id";
         $voicetypes = $modelvoicetypes->getDyamicItems($where, 't.title', 0, 0, 't.title', $joins);
         $strVoice = '';
         if ($voicetypes) {
             $strVoice = implode(", ", $voicetypes);
         }
         $item->strvoice = $strVoice;
         $objects[] = $helper->parseProperty("html", "#voice-types-" . $item->id, $item->strvoice);
         $objects[] = $helper->parseProperty("value", "#order" . $item->id, $item->ordering);
         //$objects [] = $helper->parsePropertyPublisha ( $item->id, $item->published );
     } else {
         $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors));
     }
     $helper = new JAVoiceHelpers();
     echo $helper->parse_JSON_new($objects);
     exit;
 }
Ejemplo n.º 5
0
 /**
  * Enter description here...
  *
  * @param unknown_type $item
  */
 function edit()
 {
     $user = JFactory::getUser();
     $model = $this->getModel();
     $model_forums = JAVBModel::getInstance('forums', 'javoiceModel');
     $model_voice_types = JAVBModel::getInstance('voicetypes', 'javoiceModel');
     //$frontpage = $model->getFrontpageInfo($cid);
     $feed = JRequest::getVar('feed', NULL);
     if (!$feed) {
         $feed = $model->getItem();
     }
     $lists['rssTypeList'] = $model->getRssType($feed->feed_type);
     $model->getLists($lists, $feed);
     //		Filter feeds - begin -
     $gid = '';
     if (isset($user->gid)) {
         $gid = $user->gid;
     }
     $where = " AND f.gids_view LIKE '%{$gid}%' AND f.published =1";
     $forums = $model_forums->getItems($where);
     $lists['forumStr'] = "";
     $lists['filter_forums_id'] = "";
     if ($forums) {
         $str = array();
         foreach ($forums as $forum) {
             $str[] = $forum->title;
         }
         $lists['forumStr'] = implode(",", $str);
         $selected = "";
         if ($feed->filter_forums_id) {
             $selected = explode(",", $feed->filter_forums_id);
         }
         $forumsHTML = array_merge(array(JHTML::_('select.option', '-1', JText::_('ALL'), 'id', 'title')), $forums);
         $lists['filter_forums_id'] = JHTML::_('select.genericlist', $forumsHTML, 'filter_forums_id[]', 'class="inputbox" size="10" multiple="multiple"', 'id', 'title', $selected);
     }
     $joins = "\tINNER JOIN #__jav_forums_has_voice_types as fv ON fv.voice_types_id = t.id\n\t\t\t\t \tINNER JOIN #__jav_forums as f ON f.id = fv.forums_id";
     $where = " AND t.published=1 AND f.gids_view LIKE '%{$gid}%' AND f.published =1";
     $voice_types = $model_voice_types->getDyamicItems($where, '', 0, 0, 'DISTINCT t.*', $joins, 'object');
     $lists['filter_voice_types_id'] = "";
     $lists['voice_typesStr'] = "";
     if ($voice_types) {
         $str = array();
         foreach ($voice_types as $voice_type) {
             $str[] = $voice_type->title;
         }
         $lists['voice_typesStr'] = implode(",", $str);
         $selected = "";
         if ($feed->filter_voicetypes_id) {
             $selected = explode(",", $feed->filter_voicetypes_id);
         }
         $voice_typesHTML = array_merge(array(JHTML::_('select.option', '-1', JText::_('ALL'), 'id', 'title')), $voice_types);
         $lists['filter_voice_types_id'] = JHTML::_('select.genericlist', $voice_typesHTML, 'filter_voicetypes_id[]', 'class="inputbox" size="10" multiple="multiple"', 'id', 'title', $selected);
     }
     $this->assignRef('lists', $lists);
     $this->assign('feed', $feed);
 }
Ejemplo n.º 6
0
?>
					<!--END  Upload form-->		
				</ul>				
				<div id="err_exitchekspelling" class="error" style="display: none;"><?php 
echo JText::_("PLEASE_EXIT_SPELL_CHECK_BEFORE_SUBMITTING_VOICE");
?>
</div>
				<div id="err_enter_description" class="error" style="display: none;"><?php 
echo JText::_("PLEASE_ENTER_DESCRIPTION");
?>
</div>
			</div>											
		</li>		
		<?php 
if ($javconfig["systems"]->get("is_enable_tagging", 0)) {
    $modelTags = JAVBModel::getInstance('tags', 'javoiceModel');
    $listTags = $modelTags->getTagByVoice($this->Itemid);
    ?>
        <?php 
    $textAddTag = JText::_("TAG");
    $txtTagDisable = '';
    $numTag = $javconfig["systems"]->get("tag_maximum_per_thread", 4);
    if ($numTag > 1) {
        $textAddTag = JText::_("TAGS");
    }
    if (isset($this->listTags) && $this->listTags) {
        if ($numTag <= count($this->listTags)) {
            $txtTagDisable = 'disabled="disabled"';
        }
    }
    ?>
Ejemplo n.º 7
0
 function __construct()
 {
     parent::__construct();
 }
Ejemplo n.º 8
0
 function __construct()
 {
     parent::__construct();
     $this->_db = JFactory::getDBO();
 }
Ejemplo n.º 9
0
 function remove()
 {
     $db = JFactory::getDBO();
     $cids = JRequest::getVar('cid', null, 'request', 'array');
     $count = count($cids);
     $errors = array();
     $id_used = array();
     $is_fail = array();
     if ($count > 0) {
         $model_items = JAVBModel::getInstance('items', 'javoiceModel');
         foreach ($cids as $cid) {
             $total_item = $model_items->getTotal(" AND i.forums_id = " . (int) $cid);
             if ($total_item > 0) {
                 $id_used[] = $cid;
             } else {
                 $query = "DELETE FROM #__jav_forums WHERE id={$cid}";
                 $db->setQuery($query);
                 if (!$db->query()) {
                     $is_fail[] = $cid;
                 }
             }
         }
         if (count($id_used) > 0) {
             $errors[] = "[ID: " . implode(',', $id_used) . "]" . JText::_('FORUM_IS_BEING_USED_BY_ITEMS');
         }
         if (count($is_fail) > 0) {
             $errors[] = "[ID: " . implode(',', $is_fail) . "]" . JText::_('FAILURE_TO_DELETE_FORUM');
         }
     }
     return $errors;
 }
Ejemplo n.º 10
0
 function parse(&$params, $voicetypes)
 {
     $count = count($voicetypes);
     if ($count > 0) {
         for ($i = 0; $i < $count; $i++) {
             $title = '';
             $voicetype = $voicetypes[$i];
             $status_id = $params->get("status_spam_{$voicetype->id}", 0);
             if ($status_id) {
                 $modelvoicetypesstatus = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel');
                 $status = $modelvoicetypesstatus->getItem($status_id);
                 if ($status) {
                     $title .= $status->title;
                     if ($status->parent_id) {
                         $parents = $modelvoicetypesstatus->getItem($status->parent_id);
                         if ($parents) {
                             $title = "<span style='font-weight:bold;' id='jav_parent_title_{$voicetype->id}'>" . $parents->title . "</span>: " . "<span id='jav_title_{$voicetype->id}'>" . $title . "</span>";
                         }
                     }
                 }
             }
             if ($title == '') {
                 $title = "<span style='font-weight:bold;' id='jav_parent_title_{$voicetype->id}'>----</span>: " . "<span id='jav_title_{$voicetype->id}'>---</span>";
             }
             $params->set("status_spam_title_{$voicetype->id}", $title);
         }
     }
 }
Ejemplo n.º 11
0
function changeLog($voicetype_id, $item_id, $model_items)
{
    $model_voicetype = JAVBModel::getInstance('voicetypes', 'javoiceModel');
    $voicetype = $model_voicetype->getItem($voicetype_id);
    $logs = $model_items->getLogs(" and item_id={$item_id}");
    if ($logs) {
        if ($voicetype->total_votes > -1) {
            foreach ($logs as $log) {
                $user = JFactory::getUser($log->user_id);
                $votes_left = (int) $user->getParam('votes_left-' . $voicetype->id);
                $user->setParam('votes_left-' . $voicetype->id, $votes_left + abs($log->votes));
                $user->save();
            }
        }
        $model_items->clearLogs(" and item_id={$item_id}");
    }
}
Ejemplo n.º 12
0
 function getVoiceTypesIds($gid)
 {
     $filter_voicetypes_title = JRequest::getVar('filter_voicetypes_title', NULL);
     $model_voice_types = JAVBModel::getInstance('voicetypes', 'javoiceModel');
     $joins = "\tINNER JOIN #__jav_forums_has_voice_types as fv ON fv.voice_types_id = t.id\n\t\t\t\t \tINNER JOIN #__jav_forums as f ON f.id = fv.forums_id";
     $where = " AND t.published=1 AND f.gids_view LIKE '%{$gid}%' AND f.published =1";
     if ($filter_voicetypes_title) {
         $temp = str_replace(",", "','", $filter_voicetypes_title);
         $where .= " AND t.title IN ('" . $temp . "')";
     }
     $voice_types = $model_voice_types->getDyamicItems($where, '', 0, 0, 'DISTINCT t.id', $joins);
     if ($voice_types) {
         return implode(",", $voice_types);
     } else {
         return 0;
     }
 }
Ejemplo n.º 13
0
 function changevoicetypebystatusid()
 {
     $model = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel');
     $status_id = JRequest::getInt('status_id', 0);
     $where = '';
     if ($status_id != 0) {
         $where = " AND s.id={$status_id}  ";
     }
     $fiel = " DISTINCT t.id,t.title ";
     $orderby = " t.title DESC ";
     $voicetypes = $model->getItemsDyamic($fiel, $where, $orderby);
     if ($voicetypes) {
         $displayVoicetypes = JHTML::_('select.genericlist', $voicetypes, 'voice_types_id', 'class="inputbox" ', 'id', 'title', 0);
         echo $displayVoicetypes;
     }
 }
Ejemplo n.º 14
0
 public function getItems()
 {
     global $javconfig;
     $mainframe = JFactory::getApplication();
     // Get the page/component configuration
     $params = $mainframe->getParams();
     // parameters
     $gl_cid = $params->def('item_id', '');
     $gl_uid = $params->def('user_id', '');
     $model = $this->getModel('items');
     $user = JFactory::getUser();
     $lists = $model->_getVars();
     //print_r($lists);exit;
     $type = $model->getVoiceType(JRequest::getInt('type', 1));
     if (JRequest::getVar('layout', 'default') == 'item') {
         $lists['limit'] = 1;
     }
     $where_more = '';
     $order = '';
     if (isset($lists['order']) && $lists['order'] != '') {
         if ($lists['order'] == 'create_date desc') {
             if ($javconfig["systems"]->get('is_set_time_new_voice', 1)) {
                 $lagNewVoice = $javconfig["systems"]->get('time_for_new_voice', 7200);
                 $where_more .= ' and (i.create_date +' . $lagNewVoice . ') >=' . time();
             } else {
                 $where_more .= ' and i.create_date>=' . $_SESSION['JAV_LAST_VISITED'];
             }
         }
         $order = $lists['order'] . ' ' . @$lists['order_Dir'];
     }
     if (JRequest::getInt('type')) {
         $where_more .= " and i.voice_types_id='" . JRequest::getInt('type') . "'";
     }
     if (JRequest::getInt('forums')) {
         $where_more .= " and i.forums_id='" . JRequest::getInt('forums') . "'";
     }
     if (JRequest::getVar('forums_id')) {
         if (JRequest::getVar('forums_id') == "no_forum") {
             return false;
         } else {
             $where_more .= " and i.forums_id in (" . JRequest::getVar('forums_id') . ")";
         }
     }
     if (JRequest::getInt('uid') && JRequest::getVar('view') == 'users') {
         $where_more .= ' and i.user_id=' . JRequest::getInt('uid');
     } elseif (intval($gl_uid)) {
         $where_more .= ' and i.user_id=' . (int) $gl_uid;
     }
     /* BEGIN: Show items are activing Only */
     $model_status = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel');
     $list_status = $model_status->getListTreeStatus(0, false, 0);
     $model->getWhereWidget($where_more);
     $status = JRequest::getVar('status', NULL);
     if ($status) {
         if (is_numeric($status)) {
             $where_more .= " AND  i.voice_type_status_id='" . (int) $status . "' ";
         } else {
             $temps = explode(",", $status);
             $statusStr = array();
             foreach ($temps as $temp) {
                 $statusStr[] = "s.title LIKE '%{$temp}%'";
             }
             $where_more .= count($statusStr) ? ' AND ( ' . implode(' OR ', $statusStr) . ")" : '' . ")";
         }
     } else {
         if (JRequest::getString('key', '') == '') {
             $status_ids = array();
             foreach ($list_status as $k => $status) {
                 if ($status->parent_id != 0 && !$model_status->is_spam('', $status) || JRequest::getWord('layout') == 'item') {
                     $status_ids[] = $status->id;
                 }
             }
         } else {
             $status_ids = array();
             foreach ($list_status as $k => $status) {
                 if ($status->parent_id > 0 && (!$model_status->is_spam('', $status) || $model_status->is_closed('', $status)) || JRequest::getWord('layout') == 'item') {
                     $status_ids[] = $status->id;
                 }
             }
         }
         if (!$status_ids) {
             $status_ids = array(0);
         }
         $where_more .= " and ( i.voice_type_status_id in (" . implode(',', $status_ids) . ") or i.voice_type_status_id=0)";
     }
     /* END: Show items are activing Only */
     if ($cid = JRequest::getVar('cid', array(), '', 'array')) {
         JArrayHelper::toInteger($cid);
         if ($cid) {
             $cid = implode(',', $cid);
             $where_more .= " and i.id in ({$cid})";
         }
     } elseif (intval($gl_cid)) {
         $where_more .= " and i.id=" . (int) $gl_cid;
     }
     $where_more .= ' and i.published=1';
     if ($javconfig["systems"]->get("is_enable_tagging", 0) && JRequest::getVar("tagid", 0)) {
         $where_more .= " and tv.tagID='" . JRequest::getVar("tagid", 0) . "'";
     }
     $join = " LEFT JOIN #__jav_voice_type_status as s ON s.id=i.voice_type_status_id";
     $fields_join = ' s.title as status_title, s.class_css as status_class_css, s.allow_voting as status_allow_voting, s.parent_id as status_parent_id, s.published as status_publishded';
     if ($javconfig["systems"]->get("is_enable_tagging", 0) && JRequest::getVar("tagid", 0)) {
         $join .= " INNER JOIN #__jav_tags_voice as tv ON i.id=tv.voiceID";
         $fields_join .= ", tv.tagID";
     }
     if ($user->id) {
         $fields_join .= ', lg.votes';
         $join .= " LEFT JOIN #__jav_logs as lg ON (lg.item_id=i.id and lg.user_id='{$user->id}')";
     }
     if (JRequest::getVar("pagingtype") == "autoscroll") {
         //page
         $next_page = (int) JRequest::getVar("javpage");
         $lists['limitstart'] = $next_page * $lists['limit'];
     }
     $items = $model->getItems($where_more, trim($order), $lists['limitstart'], $lists['limit'], $fields_join, $join);
     $this->_totalc = $model->getCurrentTotal();
     if ($items) {
         $items = $model->parseItems_params($items, $type);
         //print_r($items);exit;
         foreach ($items as $k => $item) {
             //if($javconfig['plugin']->get('is_attach_image',1)){
             $path = JPATH_ROOT . DS . "images" . DS . "stories" . DS . "ja_voice" . DS . $item->id;
             $item->attachs[] = $model->formatFilesInDir($path, 'download', $item->user_id, $item->id);
             //}
             $helper = new JAVoiceHelpers();
             $item->avatar = $helper->getAvatar($item->user_id);
             if ($item->user_id) {
                 $userinfo = JFactory::getUser($item->user_id);
                 $item->username = $userinfo->username;
                 $item->userparams = $userinfo->getParameters();
                 $items[$k] = $item;
             }
         }
     }
     return $items;
 }
Ejemplo n.º 15
0
 function getTagName($tagID)
 {
     $modelTags = JAVBModel::getInstance('tags', 'javoiceModel');
     return $modelTags->getTagName($tagID);
 }
Ejemplo n.º 16
0
 /**
  * Enter description here...
  *
  * @param unknown_type $item
  */
 function edit($item = null)
 {
     $model = $this->getModel();
     $number = JRequest::getVar('numbet', 0);
     $postBack = JAVoiceHelpers::isPostBack();
     if (!$item) {
         $item = $this->get('Item');
         if ($postBack) {
             $post = JRequest::get('request', JREQUEST_ALLOWHTML);
             $item->bind($post);
             $item->gids_view_selected = $post['gids_view'];
             $item->gids_post_selected = $post['gids_post'];
             $item->gids_vote_selected = $post['gids_vote'];
         } else {
             $item->gids_post_selected = array();
             if ($item->gids_post != '') {
                 $item->gids_post_selected = explode("\n", $item->gids_post);
             }
             $item->gids_view_selected = array();
             if ($item->gids_view != '') {
                 $item->gids_view_selected = explode("\n", $item->gids_view);
             }
             $item->gids_vote_selected = array();
         }
     }
     $modelvoicetypes = JAVBModel::getInstance('voicetypes', 'javoiceModel');
     $modelvoicetypesstatus = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel');
     $voicetypes = $modelvoicetypes->getItems('', ' t.ordering');
     if ($postBack) {
         $model->parseVoiceTypePostBack($post, $voicetypes);
     } else {
         $model->parseVoiceTypes($item->id, $voicetypes);
     }
     $lists = $modelvoicetypesstatus->displaySelectList($voicetypes, JText::_("DO_NOT_USE_STATUS"));
     $ordering = $model->getOrdering($item);
     $gtree = JAVoiceHelpers::getGroupUser();
     //$gtree = $acl->get_group_children_tree ( null, 'USERS', false );
     $model->parseGroupUser($gtree, 1);
     $this->assignRef('item', $item);
     $this->assignRef('gtree', $gtree);
     $this->assignRef('voicetypes', $voicetypes);
     $this->assignRef('lists', $lists);
     $this->assignRef('ordering', $ordering);
     $this->assignRef('number', $number);
 }
Ejemplo n.º 17
0
 function edit($item = null)
 {
     $isgroup = 0;
     $isedit = 0;
     if ($this->getLayout() == 'group') {
         $isgroup = 1;
     }
     $model = $this->getModel('voicetypesstatus');
     if (!$item) {
         $item = $this->get('Item');
         if ($item->id > 0) {
             $isedit = 1;
         }
         if (JAVoiceHelpers::isPostBack()) {
             $post = JRequest::get('request', JREQUEST_ALLOWHTML);
             $item->bind($post);
         }
     }
     $items_voice_type = 0;
     if ($isedit) {
         $modelitems = JAVBModel::getInstance('items', 'javoiceModel');
         $items_voice_type = $modelitems->getTotal(" AND  i.voice_type_status_id = {$item->id} ");
     }
     if (!$isedit) {
         $voice_types_id = JRequest::getInt('voice_types_id', 0);
         if ($voice_types_id) {
             $item->voice_types_id = $voice_types_id;
         }
     }
     JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, '');
     $tree = $model->displaySelect($item->voice_types_id, $item->parent_id, " id='parent_id' name='parent_id' class=\"inputbox\" ");
     $modelvoicetypes = JAVBModel::getInstance('voicetypes', 'javoiceModel');
     $voicetypes = $modelvoicetypes->getItems('');
     if (!is_array($voicetypes)) {
         $voicetypes = array();
     }
     $urlrequeststatus = "index.php?tmpl=component&option=com_javoice&view=voicetypesstatus&task=changestatusbyvoicetypeid&isparent=1";
     $onchange = "onchange=\"changeStatus('{$urlrequeststatus}',this.value)\";";
     if ($isgroup) {
         $onchange = '';
     }
     $disable = '';
     if ($isedit) {
         if ($items_voice_type > 0 || $isgroup) {
             $disable = ' disabled="disabled" ';
         }
     }
     $displayVoicetypes = JHTML::_('select.genericlist', $voicetypes, 'voice_types_id', "class=\"inputbox\" style=\"height:22px\" {$disable} {$onchange} ", 'id', 'title', $item->voice_types_id);
     $this->assign('displayVoicetypes', $displayVoicetypes);
     $number = JRequest::getVar('number', 0);
     $this->assignRef('isgroup', $isgroup);
     $this->assignRef('item', $item);
     $this->assignRef('tree', $tree);
     $this->assignRef('number', $number);
 }
Ejemplo n.º 18
0
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
//Require the submenu for component
jimport('joomla.application.component.table');
jimport('joomla.application.component.model');
jimport('joomla.utilities.date');
jimport('joomla.application.component.controller');
JLoader::register('JAVBModel', JPATH_COMPONENT_ADMINISTRATOR . '/models/model.php');
JLoader::register('JAVFController', JPATH_COMPONENT . '/controllers/controller.php');
JLoader::register('JAVBView', JPATH_COMPONENT_ADMINISTRATOR . '/views/view.php');
JTable::addIncludePath(JPATH_SITE . '/administrator/components/com_javoice/tables');
JAVBModel::addIncludePath(JPATH_SITE . '/components/com_javoice/models');
/* Require Helper */
require_once JPATH_SITE . '/components/com_javoice/helpers/jahelper.php';
$GLOBALS['javconfig'] = array();
JAVoiceHelpers::get_config_system();
global $javconfig;
require_once JPATH_COMPONENT_SITE . '/asset/cron/cron.php';
if (isset($javconfig['systems']) && $javconfig['systems']->get('is_turn_off_javoice', 0)) {
    if (!JAVoiceHelpers::check_access()) {
        return;
    }
}
if (!isset($_SESSION['JAV_LAST_VISITED'])) {
    if (isset($_COOKIE['JAV_LAST_VISITED'])) {
        $_SESSION['JAV_LAST_VISITED'] = $_COOKIE['JAV_LAST_VISITED'];
    } else {
Ejemplo n.º 19
0
 function remove()
 {
     $db = JFactory::getDBO();
     $cids = JRequest::getVar('cid', null, 'request', 'array');
     $count = count($cids);
     $errors = array();
     $id_used = array();
     $is_fail = array();
     if ($count > 0) {
         $model_items = JAVBModel::getInstance('items', 'javoiceModel');
         $model_forums = JAVBModel::getInstance('forums', 'javoiceModel');
         foreach ($cids as $cid) {
             $total_item = $model_items->getTotal(" AND i.voice_types_id=" . (int) $cid);
             $join = " INNER JOIN #__jav_forums_has_voice_types as t ON f.id = t.forums_id";
             $total_forum = $model_forums->getTotal(" AND t.voice_types_id =" . (int) $cid, $join);
             if ($total_forum > 0 || $total_item > 0) {
                 if ($total_forum > 0) {
                     $id_used_forum[] = $this->getItem($cid)->title;
                 }
                 if ($total_item > 0) {
                     $id_used_items[] = $this->getItem($cid)->title;
                 }
             } else {
                 $query = "DELETE FROM #__jav_voice_types WHERE id={$cid}";
                 $db->setQuery($query);
                 if (!$db->query()) {
                     $is_fail[] = $cid;
                 }
             }
         }
         if (count($id_used_forum) > 0 || count($id_used_items) > 0) {
             $errors[] = '';
             if (count($id_used_forum) > 0) {
                 $errors[] .= "[Voice type: " . implode(',', $id_used_forum) . "]" . JText::_('VOICE_TYPE_IS_BEING_USED_BY_FORUMS');
             }
             if (count($id_used_items) > 0) {
                 $errors[] .= "[Voice type: " . implode(',', $id_used_items) . "]" . JText::_('VOICE_TYPE_IS_BEING_USED_BY_ITEMS');
             }
         }
         if (count($is_fail) > 0) {
             $errors[] = "[ID: " . implode(',', $is_fail) . "]" . JText::_('FAILURE_TO_DELETE_VOICE_TYPE');
         }
     }
     return $errors;
 }
Ejemplo n.º 20
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;
 }
Ejemplo n.º 21
0
 function changeStatus($old_status_id, $item)
 {
     //echo $old_status_id;echo $item->voice_type_status_id;
     $model_actionslog = JAVBModel::getInstance('actionslog', 'javoiceModel');
     $user = JFactory::getUser();
     $type = JText::_("CHANGE_STATUS");
     $old_status = $this->getItem($old_status_id);
     $old_status->title = $old_status->title ? $old_status->title : JText::_("NONE_STATUS");
     $details = JText::_("CHANGE_STATUS_ITEMS_FROM") . $old_status->title;
     $this->getTable('', 'Table');
     $new_status = $this->getItem($item->voice_type_status_id);
     $new_status->title = $new_status->title ? $new_status->title : JText::_("NONE_STATUS");
     $details .= " " . JText::_("TO") . " " . $new_status->title;
     $ref_id = $item->id;
     $time = time();
     $model_actionslog->makeLog($user->id, $type, $details, $ref_id, $time);
     $this->writeLogChange($old_status_id, $item);
 }
Ejemplo n.º 22
0
 function response()
 {
     global $javconfig;
     $model = JAVBModel::getInstance('items', 'javoiceModel');
     $type = JRequest::getVar('type', 'admin_response');
     if (!isset($item)) {
         $item = $model->getAdmin_response();
     }
     $cid[0] = $item->item_id;
     $row = $model->getItem($cid);
     $item->item_title = $row ? $row->title : '';
     $response = JFactory::getUser($item->user_id);
     $item->responsename = $response ? $response->username : '';
     $this->assign('item', $item);
     $this->assign('type', $type);
     $this->assign("is_show_embed_video", $javconfig['plugin']->get('is_show_embed_video', 1));
     $this->assign("enable_smileys", $javconfig['plugin']->get('enable_smileys', 1));
     $this->assign("enable_bbcode", $javconfig['plugin']->get('enable_bbcode', 1));
     $this->assign("enable_after_the_deadline", $javconfig['plugin']->get('enable_after_the_deadline', 1));
     $this->assign("is_attach_image", $javconfig['plugin']->get('is_attach_image', 1));
     $this->assign("total_attach_file", $javconfig['plugin']->get('total_attach_file', 1));
     $this->assign("max_size_attach_file", $javconfig['plugin']->get('max_size_attach_file', 1));
     $this->assign("is_enable_captcha", $javconfig['plugin']->get('is_enable_captcha', 1));
     $this->assign("is_enable_captcha_user", $javconfig['plugin']->get('is_enable_captcha_user', 1));
     $this->assign("textAreaID", "newVoiceContentReply");
 }
Ejemplo n.º 23
0
 function displayForm()
 {
     $user = JFactory::getUser();
     $model = $this->getModel('feeds');
     $model_forums = JAVBModel::getInstance('forums', 'javoiceModel');
     $model_voice_types = JAVBModel::getInstance('voicetypes', 'javoiceModel');
     $feed = JRequest::getVar('feed', NULL);
     if (!$feed) {
         $feed = $this->get('Item');
     }
     $lists['rssTypeList'] = $model->getRssType($feed->feed_type);
     $model->getLists($lists, $feed);
     //		Filter feeds - begin
     $where = " AND f.published =1";
     foreach ($user->getAuthorisedViewLevels() as $gkey => $gVal) {
         // $gid[] = $gVal;
         if ($where == " AND f.published =1") {
             $where .= " AND (f.gids_view LIKE '%{$gkey}%'";
         } else {
             $where .= " OR f.gids_view LIKE '%{$gkey}%'";
         }
     }
     if ($where != " AND f.published =1") {
         $where .= ")";
     }
     $forums = $model_forums->getItems($where);
     $lists['forumStr'] = "";
     $lists['filter_forums_id'] = "";
     if ($forums) {
         $str = array();
         foreach ($forums as $forum) {
             $str[] = $forum->title;
         }
         $lists['forumStr'] = implode(",", $str);
         $selected = "";
         if ($feed->filter_forums_id) {
             $selected = explode(",", $feed->filter_forums_id);
         }
         $forumsHTML = array_merge(array(JHTML::_('select.option', '-1', JText::_('ALL'), 'id', 'title')), $forums);
         $lists['filter_forums_id'] = JHTML::_('select.genericlist', $forumsHTML, 'filter_forums_id[]', 'class="inputbox" size="10" multiple="multiple"', 'id', 'title', $selected);
     }
     $joins = "\tINNER JOIN #__jav_forums_has_voice_types as fv ON fv.voice_types_id = t.id\n\t\t\t\t \tINNER JOIN #__jav_forums as f ON f.id = fv.forums_id";
     $where = " AND t.published=1 AND f.published=1";
     foreach ($user->getAuthorisedViewLevels() as $gkey => $gVal) {
         // $gid[] = $gVal;
         if ($where == " AND t.published=1 AND f.published=1") {
             $where .= " AND (f.gids_view LIKE '%{$gkey}%'";
         } else {
             $where .= " OR f.gids_view LIKE '%{$gkey}%'";
         }
     }
     if ($where != " AND t.published=1 AND f.published=1") {
         $where .= ")";
     }
     $voice_types = $model_voice_types->getDyamicItems($where, '', 0, 0, 'DISTINCT t.*', $joins, 'object');
     $lists['filter_voice_types_id'] = "";
     $lists['voice_typesStr'] = "";
     if ($voice_types) {
         $str = array();
         foreach ($voice_types as $voice_type) {
             $str[] = $voice_type->title;
         }
         $lists['voice_typesStr'] = implode(",", $str);
         $selected = "";
         if ($feed->filter_voicetypes_id) {
             $selected = explode(",", $feed->filter_voicetypes_id);
         }
         $voice_typesHTML = array_merge(array(JHTML::_('select.option', '-1', JText::_('ALL'), 'id', 'title')), $voice_types);
         $lists['filter_voice_types_id'] = JHTML::_('select.genericlist', $voice_typesHTML, 'filter_voicetypes_id[]', 'class="inputbox" size="10" multiple="multiple"', 'id', 'title', $selected);
     }
     $selected = isset($feed->filter_status) ? $feed->filter_status : 2;
     $lists['statuss'] = $model->getItemsStatus($selected);
     $this->assignRef('lists', $lists);
     $this->assignRef('feed', $feed);
 }
Ejemplo n.º 24
0
/**
 * ------------------------------------------------------------------------
 * JA Voice Package for Joomla 2.5 & 3.x
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * ------------------------------------------------------------------------
 */
defined('_JEXEC') or die('Restricted access');
global $javconfig;
$link_target = JRequest::getVar('link_target', '_blank');
$view_all_button = JRequest::getVar('view_all_button', 'yes');
$model_status = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel');
$Itemid = JAVoiceHelpers::get_Itemid(array('option' => 'com_javoice', 'view' => 'items'));
$list_status = $model_status->getListTreeStatus();
$sytem_comment = isset($javconfig['integrate']) ? $javconfig['integrate']->get('run_system', 'intensedebate') : 'intensedebate';
$helper = new JAVoiceHelpers();
$items = $this->items;
if ($items) {
    ?>
<ol>	    		
	<?php 
    foreach ($items as $item) {
        ?>
		<?php 
        $listFiles = "";
        if (!$user->id && isset($_COOKIE[md5('jav-view-item') . $item->id])) {
            $item->votes = $_COOKIE[md5('jav-view-item') . $item->id];
Ejemplo n.º 25
0
 function editpermissions($params)
 {
     $mainframe = JFactory::getApplication();
     $items = array();
     $option = 'permissions';
     $helper = new JAVoiceHelpers();
     //$postback = $helper->isPostBack ();
     $model = JAVBModel::getInstance('permissions', 'javoiceModel');
     $lists = $model->_getVars();
     $where = "";
     $lists['groupname'] = JRequest::getInt("groupname", 0);
     if ($lists['groupname']) {
         $where = ' AND map2.group_id = ' . $lists['groupname'];
     }
     $searchName = JRequest::getVar("search", "");
     if ($searchName) {
         $where .= " AND a.username LIKE '%{$searchName}%'";
     }
     $listUser = $params->get('permissions');
     if ($listUser) {
         $where .= " AND a.id NOT IN(" . $listUser . ")";
     }
     //if ($postback) {
     $items = $model->getItems($where);
     //}
     $this->assign('items', $items);
     $groupUser = $helper->getGroupUser('', 'groupname', 'class="inputbox" size="1"', $lists['groupname'], 1);
     $groupUser = JHTML::_('select.genericlist', $groupUser, 'groupname', 'class="inputbox" size="1"', 'value', 'text', $lists['groupname']);
     $this->assign('groupUser', $groupUser);
     //$this->assign ( 'postback', $postback );
     $this->assign('lists', $lists);
     $this->assign('params', $params);
     $this->assign('items', $items);
 }
Ejemplo n.º 26
0
 function remove()
 {
     $group = JRequest::getVar('group', NULL);
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     if (!isset($group) || count($cid) == 0) {
         $message = JText::_("ERROR_OCCURRED_DATA_NOT_SAVED");
         $this->setRedirect("index.php?option=com_javoice&view=configs&group=permissions", $message);
     } else {
         $model = $this->getModel('configs');
         $data = $model->getItems();
         $config = JTable::getInstance('configs', 'Table');
         $config->bind($data);
         $params = class_exists('JRegistry') ? new JRegistry($config->data) : new JParameter($config->data);
         $user = $params->get('permissions', NULL);
         $user_new = array();
         $error = $this->checkDeletePermission($cid);
         if ($user) {
             $user = explode(",", $user);
             $user_new = array_diff($user, $cid);
         } else {
             $model_permissions = JAVBModel::getInstance('permissions', 'javoiceModel');
             /*				if ($type== 'admin') {
             						$where_more .= " AND u.usertype in ('Manager','Administrator','Super Administrator')";
             				}	*/
             $items = $model_permissions->getItems('', 1000000, 0, '');
             if (count($items) > 0) {
                 foreach ($items as $item) {
                     if (!in_array($item->id, $cid)) {
                         $user_new[] = $item->id;
                     }
                 }
             }
         }
         if ($user_new) {
             $user_new = implode(',', $user_new);
         } else {
             $user_new = '';
         }
         $user_new = 'permissions=' . $user_new;
         $config->data = $params->set('permissions', $user_new);
         $config->group = $group;
         if ($config->store()) {
             if ($error) {
                 foreach ($error as $err) {
                     JError::raiseWarning(1001, $err);
                     $this->setRedirect("index.php?option=com_javoice&view=configs&group=permissions");
                 }
             } else {
                 $message = JText::_("DELETE_DATA_SUCCESSFULLY");
                 $this->setRedirect("index.php?option=com_javoice&view=configs&group=permissions", $message);
             }
         } else {
             $message = JText::_("ERROR_OCCURRED_DATA_NOT_SAVED");
             $this->setRedirect("index.php?option=com_javoice&view=configs&group=permissions", $message);
         }
     }
     return TRUE;
 }