static function usersList(&$row, &$users, &$columns, &$allFields, &$lists, $listid, $search, $searchmode, $option_itemid, $limitstart, $limit, $total, &$myUser, &$searchableFields, &$searchVals, &$tabs, $list_compare_types, $showPaging, $hotlink_protection, $errorMsg, $random) { global $_CB_framework, $ueConfig, $_PLUGINS, $_POST, $_GET, $_REQUEST; $results = $_PLUGINS->trigger('onBeforeDisplayUsersList', array(&$row, &$users, &$columns, &$allFields, &$lists, $listid, &$search, &$option_itemid, 1)); // $uid = 1 $cbTemplate = HTML_comprofiler::_cbTemplateLoad(); // regroup parts of the different plugins: $pluginAdditions = array('search', 'header', 'footer'); $pluginAdditions['search'] = array(); $pluginAdditions['header'] = array(); $pluginAdditions['footer'] = array(); if (is_array($results) && count($results) > 0) { foreach ($results as $res) { if (is_array($res)) { foreach ($res as $k => $v) { $pluginAdditions[$k][] = $v; } } } } $listTitleHtml = cbReplaceVars(getLangDefinition($row->title), $myUser); $listTitleNoHtml = strip_tags(cbReplaceVars(getLangDefinition($row->title), $myUser, false, false)); $listDescription = cbReplaceVars(getLangDefinition($row->description), $myUser); $_CB_framework->setPageTitle($listTitleNoHtml); $_CB_framework->appendPathWay($listTitleHtml); $cbSpoofField = cbSpoofField(); $cbSpoofString = cbSpoofString(null, 'usersList'); if ($hotlink_protection == 1) { $spoofAmp = "&" . $cbSpoofField . '=' . urlencode($cbSpoofString); } else { $spoofAmp = null; } // Base URL string: $ue_base_url = 'index.php?option=com_comprofiler&task=usersList&listid=' . (int) $listid . '&Itemid=' . (int) $option_itemid; $ue_base_url_non_sef = $_CB_framework->getCfg('live_site') . '/' . $ue_base_url; // $adminimagesdir = "components/com_comprofiler/images/"; $searchTabContent = $tabs->getSearchablesContents($searchableFields, $myUser, $searchVals, $list_compare_types); // table content: $tableContent =& HTML_comprofiler::_getListTableContent($users, $columns, $allFields); outputCbTemplate(1); //no need for now: initToolTip(1); // paginator addition: $pagingSearch = ''; foreach (get_object_vars($searchVals) as $k => $v) { if (is_array($v)) { $pArr = '&' . urlencode($k); foreach ($v as $kk => $vv) { $pagingSearch .= $pArr . '[' . urlencode($kk) . ']=' . urlencode($vv); } } else { $pagingSearch .= '&' . urlencode($k) . '=' . urlencode($v); } } if ($random) { $pagingSearch .= '&rand=' . (int) $random; } // Add Javascript to click tr: $jsClickTr = " {" . "\n\t\tvar cbUserURLs = new Array("; if (is_array($users) && $ueConfig['allow_profilelink'] == 1) { foreach ($users as $user) { $jsClickTr .= "'" . cbSef('index.php?option=com_comprofiler&task=userProfile&user='******',"; } } $jsClickTr .= "'');" . "\n\t\t\$('#cbUserTable > tbody > tr').click( function(e) {" . "\n\t\t\tif ( ! ( \$(e.target).is('a') || ( \$(e.target).is('img') && \$(e.target).parent().is('a') ) || \$(e.target).hasClass('cbClicksInside') || ( \$(e.target).parents('.cbClicksInside').length > 0 ) || ( \$(this).attr('id') == '' ) ) ) {" . ($ueConfig['allow_profilelink'] == 1 ? "\n\t\t\t\twindow.location = cbUserURLs[this.id.substr(3)];" : '') . "\n\t\t\t\treturn false;" . "\n\t\t\t}" . "\n\t\t} );" . "\n\t}"; $_CB_framework->outputCbJQuery($jsClickTr); /* // Add Javascript to pagination of list $jsPagination = " $('#cbUserList a.pagenav').click( function() {" // Get the href of the pagination link: . "\n var href = $(this).attr('href');" // Get the page limitstart value: . "\n var matches = /limitstart=(\\d*)/.exec(href);" . "\n if ( matches && matches.length == 2 ) {" // Set limitstart input: . "\n $('input#cbListlimitstart').val( matches[1] );" // Submit the form, so the values are taken: . "\n $('form#adminForm').submit();" // And avoid the <a> link being followed: . "\n return false;" . "\n }" // Link doesn't match, simply follow link: . "\n return true;" . "\n } );" ; $_CB_framework->outputCbJQuery( $jsPagination ); */ if (count($searchableFields) > 0) { cbUsersList::outputAdvancedSearchJs($search); } // list title: ?> <div class="cbUsersList"><div id="cbUsersListInner"> <?php if ($errorMsg) { echo '<div class="error">' . $errorMsg . '</div>'; } ?> <form class="cb_form" name="adminForm" id="adminForm" method="get" action="<?php echo $ue_base_url_non_sef . "&action=search"; // on purpose without SEF, as joomla 1.0/mambo 4.5.5 core sef doesn't work with this. ?> " > <input type="hidden" name="option" value="com_comprofiler" /> <input type="hidden" name="task" value="usersList" /> <input type="hidden" name="Itemid" value="<?php echo $option_itemid; ?> " /> <input type="hidden" name="limitstart" id="cbListlimitstart" value="0" /> <input type="hidden" name="search" value="" /> <?php /* old method, replaced by hidden search field above: <div class="cbUserListSearchBox"> <div> <input type="text" name="search" class="inputbox" size="15" maxlength="100" value="<?php echo htmlspecialchars( $search ); ?>" /> <input type="image" src="<?php echo $adminimagesdir; ?>search.gif" alt="<?php echo _UE_SEARCH; ?>" align="top" style="border: 0px;" /> </div> </div> <div class="cbClr"></div> */ echo cbGetSpoofInputTag(null, $cbSpoofString); // Render search-area header: if (count($pluginAdditions['search'])) { $searchTabContent .= '<div class="cbClr"></div><div id="cbUserListSearchPlugins"><div>' . implode('</div><div>', $pluginAdditions['search']) . '</div></div>'; } $totalIsAllUsers = !($search !== null || $row->filterfields != ''); $searchResultDisplaying = $search !== null; $searchCriteriaTitleHtml = cbReplaceVars(_UE_SEARCH_CRITERIA, $myUser); if ($searchmode == 0) { $searchResultsTitleHtml = cbReplaceVars(_UE_SEARCH_RESULTS, $myUser); } else { $searchResultsTitleHtml = null; } echo HTML_comprofiler::_cbTemplateRender($cbTemplate, $myUser, 'List', 'drawListHead', array(&$lists, $listid, $total, $totalIsAllUsers, $searchTabContent, $searchResultDisplaying, $ue_base_url_non_sef, $listTitleHtml, $listDescription, $searchCriteriaTitleHtml, $searchResultsTitleHtml)); ?> </form> <?php if ($searchmode == 0) { if (count($pluginAdditions['header'])) { echo '<div id="cbUserListHeader"><div>' . implode('</div><div>', $pluginAdditions['header']) . '</div></div>'; } if ($showPaging && ($limitstart != 0 || $limit <= $total)) { // top page links: ?> <div class="cbUserListPagination cbUserListPaginationTop" style="width:100%;text-align:center;"><?php echo writePagesLinks($limitstart, $limit, $total, $ue_base_url . $pagingSearch . $spoofAmp, $search); ?> </div> <?php } // Render the list itself: echo HTML_comprofiler::_cbTemplateRender($cbTemplate, $myUser, 'List', 'drawListBody', array(&$users, &$columns, &$tableContent, $listid, $ueConfig['allow_profilelink'])); if ($showPaging && ($limitstart != 0 || $limit <= $total)) { // bottom page links: ?> <div class="cbUserListPagination cbUserListPaginationBottom" style="width:100%;text-align:center;"><?php echo writePagesLinks($limitstart, $limit, $total, $ue_base_url . $pagingSearch . $spoofAmp, $search); ?> </div> <?php } if (count($pluginAdditions['footer'])) { echo '<div id="cbUserListFooter"><div>' . implode('</div><div>', $pluginAdditions['footer']) . '</div></div>'; } } // end of if ( $searchmode == 0 ) ?> </div><div class="cbClr"> </div></div><div class="cbClr"> </div> <?php }
/** * Writes the html links for pages inside tabs, eg, previous 1 2 3 ... x next * @param array: paging parameters. ['limitstart'] is the record number to start dislpaying from will be ignored * @param string postfix for identifying multiple pagings/search/sorts (optional) * @param int Number of rows to display per page * @param int Total number of rows * @param string cb task to link to (default: userProfile) * @return string html text displaying paging */ function _writePaging($pagingParams, $postfix, $limit, $total, $task = 'userProfile') { $base_url = $this->_getAbsURLwithParam($pagingParams, $task, false, array($postfix . 'limitstart')); $prefix = $this->_getPrefix($postfix); return writePagesLinks($pagingParams[$postfix . 'limitstart'], $limit, $total, $base_url, null, $prefix); }
function viewReports($option, $uid, $act) { global $_CB_framework, $_CB_database, $_PLUGINS, $_REQUEST; $_PLUGINS->loadPluginGroup('user'); $results = $_PLUGINS->trigger('onBeforeViewReportsFormDisplay', array($uid, $act)); if ($_PLUGINS->is_errors()) { echo "<script type=\"text/javascript\">alert(\"" . $_PLUGINS->getErrorMSG() . "\"); window.history.go(-1); </script>\n"; exit; } $isModerator = Application::MyUser()->isGlobalModerator(); if (!$isModerator) { cbNotAuth(); return; } $query = 'SELECT COUNT(*)' . "\n FROM " . $_CB_database->NameQuote('#__comprofiler_userreports') . "\n WHERE " . $_CB_database->NameQuote('reporteduser') . " = " . (int) $uid . ($act == 1 ? "\n AND " . $_CB_database->NameQuote('reportedstatus') . " = 0" : null); $_CB_database->setQuery($query); $total = $_CB_database->loadResult(); $limitstart = (int) getPagesLimitStart($_REQUEST); $limit = 20; if ($limit > $total) { $limitstart = 0; } $query = 'SELECT *' . "\n FROM " . $_CB_database->NameQuote('#__comprofiler_userreports') . "\n WHERE " . $_CB_database->NameQuote('reporteduser') . " = " . (int) $uid . ($act == 1 ? "\n AND " . $_CB_database->NameQuote('reportedstatus') . " = 0" : null) . "\n ORDER BY " . $_CB_database->NameQuote('reporteduser') . ", " . $_CB_database->NameQuote('reportedondate'); $_CB_database->setQuery($query, $limitstart, $limit); $rows = $_CB_database->loadObjectList(); outputCbTemplate(1); $return = '<div class="cbViewReports cb_template cb_template_' . selectTemplate('dir') . '">'; if (is_array($results)) { $return .= implode('', $results); } $return .= '<div class="page-header"><h3>' . CBTxt::Th('UE_USERREPORT', 'User Report') . '</h3></div>'; if ($total < 1) { $return .= CBTxt::Th('UE_NOREPORTSTOPROCESS', 'No User Reports to Process'); } else { $return .= '<form action="' . $_CB_framework->viewUrl('moderatereports') . '" method="post" id="adminForm" name="adminForm" class="cb_form form-auto">' . '<table class="table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 20%;" class="text-left">' . CBTxt::Th('UE_REPORTEDUSER', 'Reported User') . '</th>' . '<th style="width: 20%;" class="text-left">' . CBTxt::Th('UE_REPORT', 'Report') . '</th>' . '<th style="width: 20%;" class="text-left xs-hidden">' . CBTxt::Th('UE_REPORTEDONDATE', 'Report Date') . '</th>' . '<th style="width: 20%;" class="text-left xs-hidden">' . CBTxt::Th('UE_REPORTEDBY', 'Reported By') . '</th>' . '<th style="width: 20%;" class="text-left">' . CBTxt::Th('UE_REPORTSTATUS', 'Report status') . '</th>' . '</tr>' . '</thead>' . '<tbody>'; for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; $return .= '<tr>' . '<td style="width: 20%;" class="text-left">' . CBuser::getInstance((int) $row->reporteduser, false)->getField('formatname', null, 'html', 'none', 'list', 0, true) . '</td>' . '<td style="width: 20%;" class="text-left">' . $row->reportexplaination . '</td>' . '<td style="width: 20%;" class="text-left xs-hidden">' . cbFormatDate($row->reportedondate) . '</td>' . '<td style="width: 20%;" class="text-left xs-hidden">' . CBuser::getInstance((int) $row->reportedbyuser, false)->getField('formatname', null, 'html', 'none', 'list', 0, true) . '</td>' . '<td style="width: 20%;" class="text-left ' . ($row->reportedstatus ? 'text-success' : 'text-danger') . '">' . ($row->reportedstatus ? CBTxt::Th('UE_REPORTSTATUS_PROCESSED', 'Processed') : CBTxt::Th('UE_REPORTSTATUS_OPEN', 'Open')) . '</td>' . '</tr>'; } $return .= '</tbody>' . '</table>' . '<div class="form-group cb_form_line clearfix">' . '<input type="submit" class="btn btn-primary cbViewReportsMod" value="' . htmlspecialchars(CBTxt::Th('UE_USERREPORT_MODERATE', 'Moderate User Reports')) . '" />' . '</div>' . '</form>'; if ($total > $limit) { $return .= '<div class="form-group cb_form_line text-center clearfix">' . writePagesLinks($limitstart, $limit, $total, $_CB_framework->viewUrl('viewreports')) . '</div>'; } } $return .= '</div>'; echo $return; }