global $database, $jTips; require_once 'components/com_jtips/classes/jbadword.class.php'; $formData = array('title' => $jLang['_ADMIN_BW_HEADER'], 'editTask' => 'edit', 'module' => 'BadWords', 'icon' => 'badwords'); $currentDir = jTipsGetParam($_REQUEST, 'filter_order_Dir', 'asc'); if ($currentDir == 'asc') { $dir = 'desc'; } else { $dir = 'asc'; } //The header row $header = array('', "<a href='javascript:tableOrdering(\"badword\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_BW_BAD_WORD'] . "</a>", "<a href='javascript:tableOrdering(\"match_case\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_BW_CASE_SENSITIVE'] . "</a>", "<a href='javascript:tableOrdering(\"action\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_BW_ACTION'] . "</a>", "<a href='javascript:tableOrdering(\"replace\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_BW_REPLACEMENT'] . "</a>", "<a href='javascript:tableOrdering(\"hits\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_BW_HITS'] . "</a>", "<a href='javascript:tableOrdering(\"updated\", \"{$dir}\", \"list\");'>" . $jLang['_ADMIN_BW_UPDATED'] . "</a>"); $jBadWord = new jBadWord($database); $limitstart = jTipsGetParam($_REQUEST, 'limitstart', 0); $limit = jTipsGetParam($_REQUEST, 'limit', 25); $direction = jTipsGetParam($_REQUEST, 'filter_order_Dir', 'asc'); if (empty($direction)) { $direction = 'asc'; } $orderby = jTipsGetParam($_REQUEST, 'filter_order', 'badword'); if (empty($orderby)) { $orderby = 'badword'; } $params = array('order' => array('type' => 'order', 'direction' => $direction, 'by' => $orderby)); $jBadWords = forceArray($jBadWord->loadByParams($params, $limit, $limitstart)); $pageNav = new mosPageNav($jBadWord->getCount(), $limitstart, $limit); $data = array(); $i = 0; foreach ($jBadWords as $badword) { $data[$badword->id] = array(makeListLink($badword->badword, $i++), "<div style='text-align:center;'><img src='images/" . ($badword->match_case ? 'tick' : 'publish_x') . ".png' border='0' alt='{$badword->match_case}' /></div>", ucwords($badword->action), $badword->replace, $badword->hits, TimeDate::toDisplayDateTime($badword->updated)); } jTipsAdminDisplay::ListView($formData, $header, $data, $pageNav, 'edit');
* @author Jeremy Roberts * @copyright Copyright © 2009, jTips * @license Commercial - See website for details * * @since 2.1 - 16/10/2008 * @version 2.1 * @package jTips * * Description: */ global $database, $mosConfig_absolute_path; ob_clean(); require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jbadword.class.php'; $comment = jTipsGetParam($_REQUEST, 'comment', ''); $jBad = new jBadWord($database); $badwords = forceArray($jBad->loadByParams(array())); $count = $deleted = $replaced = 0; $results = array(); foreach ($badwords as $jBadWord) { $search = '/' . $jBadWord->badword . '/' . ($jBadWord->match_case == 1 ? 'i' : ''); $found = preg_match_all($search, $comment, $matches); if ($found > 0) { $count++; $found = $found + $jBadWord->hits; $jBadWord->hits = $found; if ($jBadWord->action == 'delete') { $deleted++; array_push($results, 0); } else { $new_comment = preg_replace($search, $jBadWord->replace, $comment); $replaced++;
* @copyright Copyright © 2009, jTips * @license Commercial - See website for details * * @since 2.1 - 02/10/2008 * @version 2.1 * @package jTips * * Description: */ jTipsSpoofCheck(); global $database; require_once 'components/com_jtips/classes/jbadword.class.php'; require_once 'components/com_jtips/classes/jcomment.class.php'; $jBadWordFocus = new jBadWord($database); $jCommentFocus = new jComment($database); $badwords = forceArray($jBadWordFocus->loadByParams()); $comments = forceArray($jCommentFocus->loadByParams()); $count = $deleted = $replaced = 0; foreach ($comments as $jComment) { foreach ($badwords as $jBadWord) { $search = '/' . $jBadWord->badword . '/' . ($jBadWord->match_case == 1 ? 'i' : ''); $found = preg_match_all($search, $jComment->comment, $matches); if ($found > 0) { $count++; $found = $found + $jBadWord->hits; $jBadWord->hits = $found; if ($jBadWord->action == 'delete') { $jComment->delete($jComment->id); $deleted++; } else { $new_comment = preg_replace($search, $jBadWord->replace, $jComment->comment);