/** * Mambot that loads module positions within content */ function botMosLoadPosition($published, &$row, &$cparams, $page = 0, $params) { global $database; // expression to search for $regex = '/{mosloadposition\\s*.*?}/i'; if (is_callable(array($row, 'getText'))) { $localtext = $row->getText(); } else { $localtext = $row->text; } // find all instances of mambot and put in $matches preg_match_all($regex, $localtext, $matches); // Number of mambots $count = count($matches[0]); // mambot only processes if there are any instances of the mambot in the text if ($count) { // load mambot params info /*$query = "SELECT id FROM #__mambots WHERE element = 'mosloadposition' AND folder = 'content'"; $database->setQuery( $query ); $id = $database->loadResult(); $mambot = new mosMambot( $database ); $mambot->load( $id );*/ $mambots =& mosMambotHandler::getInstance(); $mambot = $mambots->getBot('mosloadposition', 'content'); $params =& new mosParameters(isset($mambot->params) ? $mambot->params : ''); $style = $params->def('style', -2); processPositions($localtext, $matches, $count, $regex, $style); } // Save the results of processing if (is_callable(array($row, 'saveText'))) { $row->saveText($localtext); } else { $row->text = $localtext; } }
/** * Mambot that Cloaks all emails in content from spambots via javascript */ function botMosEmailCloak($published, &$row, &$cparams, $page = 0, $params) { global $database; // load mambot params info /*$query = "SELECT id FROM #__mambots WHERE element = 'mosemailcloak' AND folder = 'content'"; $database->setQuery( $query ); $id = $database->loadResult(); $mambot = new mosMambot( $database ); $mambot->load( $id );*/ $mambots =& mosMambotHandler::getInstance(); $mambot = $mambots->getBot('mosemailcloack', 'content'); $params =& new mosParameters(isset($mambot->params) ? $mambot->params : ''); $mode = $params->def('mode', 1); //$search = "([[:alnum:]_\.\-]+)(\@[[:alnum:]\.\-]+\.+)([[:alnum:]\.\-]+)"; $search = "([[:alnum:]_\\.\\-]+)(\\@[[:alnum:]\\.\\-]+\\.+)([[:alnum:]\\.\\-\\?\\=\\%]+)"; $search_text = "([[:alnum:][:space:][:punct:]][^<>]+)"; // search for derivativs of link code <a href="mailto:email@amail.com">email@amail.com</a> // extra handling for inclusion of title and target attributes either side of href attribute $searchlink = "(<a [[:alnum:] _\"\\'=\\@\\.\\-]*href=[\"\\']mailto:" . $search . "[\"\\'][[:alnum:] _\"\\'=\\@\\.\\-]*>)" . $search . "</a>"; if (is_callable(array($row, 'getText'))) { $localtext = $row->getText(); } else { $localtext = $row->text; } while (eregi($searchlink, $localtext, $regs)) { $mail = $regs[2] . $regs[3] . $regs[4]; $mail_text = $regs[5] . $regs[6] . $regs[7]; // check to see if mail text is different from mail addy if ($mail_text) { $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text); } else { $replacement = mosHTML::emailCloaking($mail, $mode); } // replace the found address with the js cloacked email $localtext = str_replace($regs[0], $replacement, $localtext); } // search for derivativs of link code <a href="mailto:email@amail.com">anytext</a> // extra handling for inclusion of title and target attributes either side of href attribute $searchlink = "(<a [[:alnum:] _\"\\'=\\@\\.\\-]*href=[\"\\']mailto:" . $search . "[\"\\'][[:alnum:] _\"\\'=\\@\\.\\-]*)>" . $search_text . "</a>"; while (eregi($searchlink, $localtext, $regs)) { $mail = $regs[2] . $regs[3] . $regs[4]; $mail_text = $regs[5]; $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text, 0); // replace the found address with the js cloacked email $localtext = str_replace($regs[0], $replacement, $localtext); } // search for plain text email@amail.com while (eregi($search, $localtext, $regs)) { $mail = $regs[0]; $replacement = mosHTML::emailCloaking($mail, $mode); // replace the found address with the js cloacked email $localtext = str_replace($regs[0], $replacement, $localtext); } if (is_callable(array($row, 'saveText'))) { $row->saveText($localtext); } else { $row->text = $localtext; } }
/** */ function botMosImage($published, &$row, &$cparams, $page = 0, $params) { global $database; // expression to search for $regex = '/{mosimage\\s*.*?}/i'; // find all instances of mambot and put in $matches if (is_callable(array($row, 'getText'))) { $localtext = $row->getText(); } else { $localtext = $row->text; } preg_match_all($regex, $localtext, $matches); // Number of mambots $count = count($matches[0]); // mambot only processes if there are any instances of the mambot in the text if ($count) { // load mambot params info /*$query = "SELECT id FROM #__mambots WHERE element = 'mosimage' AND folder = 'mosimage'"; $database->setQuery( $query ); $id = $database->loadResult(); $mambot = new mosMambot( $database ); $mambot->load( $id );*/ $mambots =& mosMambotHandler::getInstance(); $mambot = $mambots->getBot('mosimage', 'content'); $params =& new mosParameters(isset($mambot->params) ? $mambot->params : ''); $params->def('padding'); $params->def('margin'); $params->def('link', 0); $images = processImages($row, $params, $cparams); // store some vars in globals to access from the replacer $GLOBALS['botMosImageCount'] = 0; $GLOBALS['botMosImageParams'] =& $params; $GLOBALS['botMosImageArray'] =& $images; //$GLOBALS['botMosImageArray'] =& $combine; // perform the replacement $localtext = preg_replace_callback($regex, 'botMosImage_replacer', $localtext); if (is_callable(array($row, 'saveText'))) { $row->saveText($localtext); } else { $row->text = $localtext; } // clean up globals unset($GLOBALS['botMosImageCount']); unset($GLOBALS['botMosImageMask']); unset($GLOBALS['botMosImageArray']); return true; } }
/** cache modules output**/ $m_handler =& mosModuleHandler::getInstance(); $m_handler->initBuffers(); /** load html helpers **/ $html =& mosHtmlHelper::getInstance(); $configuration->initGzip(); $configuration->standardHeaders(); if (mosGetParam($_GET, 'syndstyle', '') == 'yes') { mosMainBody(); } elseif ($indextype == 1) { // loads template file if (!file_exists('templates/' . $cur_template . '/index.php')) { echo '<span style="color:red; font-weight:bold;">' . T_('Template File Not Found! Looking for template') . '</span> ' . $cur_template; } else { require_once 'templates/' . $cur_template . '/index.php'; $mambothandler =& mosMambotHandler::getInstance(); $mambothandler->loadBotGroup('system'); $mambothandler->trigger('afterTemplate', array($configuration)); echo "<!-- " . time() . " -->"; } } elseif ($indextype == 2) { if ($no_html == 0) { $html->render('xmlprologue'); $html->render('doctype'); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php $html->render('css'); $html->render('charset'); $html->renderMeta('robots', 'noindex, nofollow');
function deleteTask() { // In case the Javascript cannot do the check, ensure at least one item selected $this->admin->check_selection(_DOWN_SEL_FILE_DEL); // For each selected container, create an object then delete (will delete from DB) $dlist = array(); $handler = mosContainerHandler::getInstance(); foreach ($this->admin->cfid as $id) { $dlist[] = $handler->getDescendantIDList($id); } $deletelist = implode(',', $dlist); $mambothandler = mosMambotHandler::getInstance(); $mambothandler->loadBotGroup('container'); $messages = $mambothandler->trigger('preDelete', $deletelist); foreach ($messages as $message) { if ($message) { // Create and activate a View object $view = $this->admin->newHTMLClassCheck('messageContainersHTML', $this, 0, ''); $view->view($container); } else { $mambothandler->trigger('doDelete', $deletelist); // Now show the list of containers again $this->listTask(); } } }
/** * Blocks or Unblocks one or more user records * @param array An array of unique category id numbers * @param integer 0 if unblock, 1 if blocking * @param string The current url option */ function changeUserBlock($cid = null, $block = 1, $option) { global $database, $my, $acl; if (count($cid) < 1) { $action = $block ? T_('block') : T_('unblock'); echo "<script> alert('" . sprintf(T_('Select an item to %s'), $action) . "'); window.history.go(-1);</script>\n"; exit; } // super administrator can not block self $super_gid = $acl->get_group_id('super administrator'); if (in_array($my->id, $cid) && $my->gid == $super_gid) { $msg = T_("You cannot block yourself!"); mosRedirect('index2.php?option=' . $option, $msg); } $cids = implode(',', $cid); $query = "UPDATE #__users SET block='{$block}' WHERE id IN ({$cids})"; $database->setQuery($query); if (!$database->query()) { echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } $mambothandler =& mosMambotHandler::getInstance(); $mambothandler->loadBotGroup('authenticator'); $query = "SELECT username FROM #__users WHERE id IN ({$cids})"; $database->setQuery($query); $results = $database->loadResultArray(); if ($results) { foreach ($results as $result) { $loginfo = new mosLoginDetails($result->username); if ($block) { $mambothandler->trigger('userBlock', array($loginfo)); } else { $mambothandler->trigger('userUnblock', array($loginfo)); } } } mosRedirect('index2.php?option=' . $option); }
function activate($option) { global $database; global $mosConfig_useractivation, $mosConfig_allowUserRegistration; if ($mosConfig_allowUserRegistration == '0' || $mosConfig_useractivation == '0') { mosNotAuth(); return; } $activation = mosGetParam($_REQUEST, 'activation', ''); $activation = $database->getEscaped($activation); if (empty($activation)) { echo '<div class="componentheading">' . T_('Invalid Activation Link!') . '</div><br />'; echo T_('There is no such account in our database or the account has already been activated.'); return; } $database->setQuery("SELECT username FROM #__users" . "\n WHERE activation='{$activation}' AND block='1'"); $username = $database->loadResult(); if ($username) { $database->setQuery("UPDATE #__users SET block='0', activation='' WHERE activation='{$activation}' AND block='1'"); if (!$database->query()) { echo "SQL error" . $database->stderr(true); } echo '<div class="componentheading">' . T_('Activation Complete!') . '</div><br />'; echo T_('Your account has been activated successfully. You can now login using the username and password you chose during registration.'); $loginfo = new mosLoginDetails($username); $mambothandler =& mosMambotHandler::getInstance(); $mambothandler->loadBotGroup('authenticator'); $mambothandler->trigger('userActivate', array($loginfo)); } else { echo '<div class="componentheading">' . T_('Invalid Activation Link!') . '</div><br />'; echo T_('There is no such account in our database or the account has already been activated.'); } }
/** * Enter description here... * */ function standardHeaders() { header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); $mambothandler =& mosMambotHandler::getInstance(); $mambothandler->loadBotGroup('system'); $mambothandler->trigger('onHeaders', array($this)); }
/** * User logout * * Reverts the current session record back to 'anonymous' parameters */ function logoutUser() { $session =& mosSession::getCurrent(); if ($session) { $mambothandler =& mosMambotHandler::getInstance(); $mambothandler->loadBotGroup('authenticator'); $loginfo = new mosLoginDetails($session->username); $mambothandler->trigger('beforeLogout', array($loginfo)); $this->clearSession($session); } }
function userSave($option, $uid) { global $database; $user_id = intval(mosGetParam($_POST, 'id', 0)); // do some security checks if ($uid == 0 || $user_id == 0 || $user_id != $uid) { mosNotAuth(); return; } $row = new mosUser($database); $row->load($user_id); $row->orig_password = $row->password; if (!$row->bind($_POST, "gid usertype")) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } mosMakeHtmlSafe($row); if (isset($_POST["password"]) && $_POST["password"] != "") { if (isset($_POST["verifyPass"]) && $_POST["verifyPass"] == $_POST["password"]) { $row->password = md5($_POST["password"]); } else { echo "<script> alert(\"" . T_('Passwords do not match') . "\"); window.history.go(-1); </script>\n"; exit; } } else { // Restore 'original password' $row->password = $row->orig_password; } if (!$row->check()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } unset($row->orig_password); // prevent DB error!! if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $loginfo = new mosLoginDetails($row->username, $_POST['password']); $mambothandler =& mosMambotHandler::getInstance(); $mambothandler->loadBotGroup('authenticator'); $mambothandler->trigger('userChange', array($loginfo)); mosRedirect("index.php?option={$option}", T_('Your settings have been saved.')); }