本文整理汇总了PHP中JControllerLegacy::setRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP JControllerLegacy::setRedirect方法的具体用法?PHP JControllerLegacy::setRedirect怎么用?PHP JControllerLegacy::setRedirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JControllerLegacy
的用法示例。
在下文中一共展示了JControllerLegacy::setRedirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetRedirectWithUrlNoMessageAndMessageTypeWithPreviouslySetMessage
/**
* @testdox Tests that message and message type set in setMessage() are overriden by setRedirect()
*
* @covers JControllerLegacy::setRedirect
*/
public function testSetRedirectWithUrlNoMessageAndMessageTypeWithPreviouslySetMessage()
{
$this->class->setMessage('Folks?', 'notice');
$this->class->setRedirect('index.php?option=com_foobar', null, 'question');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class);
$this->assertAttributeEquals('Folks?', 'message', $this->class);
$this->assertAttributeEquals('question', 'messageType', $this->class);
}
示例2: display
public function display($tpl = null)
{
if (!function_exists('curl_version')) {
$contr = new JControllerLegacy();
$contr->setRedirect('index.php?option=com_mobilize&task=position.selectPosition');
$contr->redirect();
}
$this->setFilterable(false);
$document = JFactory::getDocument();
$document->addScript(JURI::root(true) . '/media/jui/js/jquery.js');
if (isset($this->filterEnabled) and $this->filterEnabled) {
JSNHtmlAsset::addScript(JSN_MOBILIZE_ASSETS_URL . '/js/jsn.jquery.noconflict.js');
}
/**
* When position clicked
* object returned after this event fired is
* clicked position
* Use $(this)
*/
$onPostionClick = "\n\t\t\tif ( !\$(this).hasClass('active-position') ){\n\t\t\t\twindow.parent.jQuery.jSelectPosition(\$(this).find('p').text());\t\t\t\t\n\t\t\t}\n\t\t";
$this->addPositionClickCallBack($onPostionClick);
parent::display($tpl);
}
示例3: setRedirect
/**
* Set the redirect url
*
* @param string $url default url
* @param string $msg optional message to apply on redirect
* @param string $type optional message type
*
* @return null
*/
public function setRedirect($url, $msg = null, $type = 'message')
{
$session = JFactory::getSession();
$app = JFactory::getApplication();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$formdata = $session->get('com_' . $package . '.form.data');
$context = 'com_' . $package . '.form.' . $formdata['fabrik'] . '.redirect.';
// If the redirect plug-in has set a url use that in preference to the default url
$surl = $session->get($context . 'url', array($url));
if (!is_array($surl)) {
$surl = array($surl);
}
if (empty($surl)) {
$surl[] = $url;
}
$smsg = $session->get($context . 'msg', array($msg));
if (!is_array($smsg)) {
$smsg = array($smsg);
}
if (empty($smsg)) {
$smsg[] = $msg;
}
$url = array_shift($surl);
$msg = array_shift($smsg);
$app = JFactory::getApplication();
$q = $app->getMessageQueue();
$found = false;
foreach ($q as $m) {
// Custom message already queued - unset default msg
if ($m['type'] == 'message' && trim($m['message']) !== '') {
$found = true;
break;
}
}
if ($found) {
$msg = null;
}
$session->set($context . 'url', $surl);
$session->set($context . 'msg', $smsg);
$showmsg = array_shift($session->get($context . 'showsystemmsg', array(true)));
$msg = $showmsg ? $msg : null;
parent::setRedirect($url, $msg, $type);
}
示例4: _checkUser
function _checkUser()
{
$app = JFactory::getApplication();
// active user
$user = JFactory::getUser();
// check referre ID
$referrerid = @$_SESSION['referrerid'];
if (!$user->id || !$referrerid) {
$msg = JText::_('ALERTNOTAUTH');
JControllerLegacy::setRedirect('index.php', $msg);
JControllerLegacy::redirect();
} else {
return $referrerid;
}
}
示例5: _loadPluginElements
function _loadPluginElements($xmlFile)
{
if (substr(strtolower($xmlFile), -4) != ".xml") {
return;
}
$app = JFactory::getApplication();
$error = "";
// XML library
//jimport('joomla.utilities.simplexml');
// Import file dependencies
require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'assets' . DS . 'includes' . DS . 'simplexml.php';
//$xmlDoc = JFactory::getXMLParser('Simple');
$xmlDoc = new JSimpleXML();
$_xmlFile = JPATH_COMPONENT_ADMINISTRATOR . DS . 'assets' . DS . 'plugins' . DS . $xmlFile;
$pos = strrpos($_xmlFile, DS);
if ($pos) {
$_installPath = substr($_xmlFile, 0, $pos);
}
if ($xmlDoc->loadFile($_xmlFile)) {
$root =& $xmlDoc->document;
if ($root->name() == 'alphauserpoints') {
$element = $root->rule;
$nameRule = $element ? $element[0]->data() : '';
$element = $root->description;
$descriptionRule = $element ? $element[0]->data() : '';
$element = $root->component;
$componentRule = $element ? $element[0]->data() : '';
$element = $root->plugin_function;
$pluginRule = $element ? $element[0]->data() : '';
$element = $root->fixed_points;
$fixedpointsRule = $element ? $element[0]->data() : '';
$fixedpointsRule = trim(strtolower($fixedpointsRule));
$fixedpointsRule = $fixedpointsRule == 'true' ? 1 : 0;
$element = @$root->category;
$categoryRule = @$element ? @$element[0]->data() : '';
$element = @$root->display_message;
$displayMessage = @$element ? @$element[0]->data() : '';
$displayMessage = trim(strtolower($displayMessage));
$displayMessage = $displayMessage == 'true' ? 1 : 0;
$element = @$root->email_notification;
$emailNotification = @$element ? @$element[0]->data() : '';
$emailNotification = trim(strtolower($emailNotification));
$emailNotification = $emailNotification == 'true' ? 1 : 0;
// insert in table
if ($nameRule != '' && $descriptionRule != '' && $componentRule != '' && $pluginRule != '') {
$db = JFactory::getDBO();
// check if already exist...
$query = "SELECT COUNT(*) FROM #__alpha_userpoints_rules WHERE `plugin_function`='{$pluginRule}'";
$db->setQuery($query);
$resultCount = $db->loadResult();
if (!$resultCount) {
$query = "INSERT INTO #__alpha_userpoints_rules VALUES ('', '" . $nameRule . "', '" . $descriptionRule . "', '" . $componentRule . "', '" . $pluginRule . "', '1', '" . $componentRule . "', '', '', '0', '0', 0, '0000-00-00 00:00:00', '', '', '', '', '0', '0', '0', '0', '1', '" . $fixedpointsRule . "', '" . $categoryRule . "', '" . $displayMessage . "', '', '0', '" . $emailNotification . "', '', '', '0', '0', '0', '0', '0', '1')";
$db->setQuery($query);
if ($db->query()) {
$msg = JText::_('AUP_NEW_RULE_INSTALLED_SUCCESSFULLY') . ' : <b>' . $nameRule . '</b>';
$app->enqueueMessage($msg);
} else {
$error = JText::_('This rule is not installed properly');
JError::raiseNotice(0, $error);
}
} else {
$error = JText::_('AUP_THISRULEALREADYEXIST');
JError::raiseNotice(0, $error);
}
} else {
$error = JText::_('AUP_XML_FILE_INVALID');
JError::raiseWarning(0, $error);
}
} elseif ($root->name() == 'extension') {
// Install standard plugins for Joomla!
jimport('joomla.installer.installer');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$plugin_installer = new JInstaller();
$installStandard = $plugin_installer->install($_installPath);
JFolder::delete($_installPath);
$redirecturl = "index.php?option=com_plugins";
JControllerLegacy::setRedirect($redirecturl);
JControllerLegacy::redirect();
} else {
unset($xmlDoc);
$error = JText::_('AUP_XML_FILE_INVALID');
JError::raiseWarning(0, $error);
}
} else {
unset($xmlDoc);
$error = JText::_('AUP_XML_FILE_INVALID');
JError::raiseWarning(0, $error);
}
}
示例6: _save_coupongenerator
function _save_coupongenerator()
{
$app = JFactory::getApplication();
// initialize variables
$db = JFactory::getDBO();
$post = JRequest::get('post');
$numbercouponcode = JFactory::getApplication()->input->get('numbercouponcode', 20, 'int');
$numrandomchars = JFactory::getApplication()->input->get('numrandomchars', 0, 'int');
$enabledincrement = intval(JFactory::getApplication()->input->get('enabledincrement', 0, 'int'));
if ($post['points']) {
for ($i = 0, $n = $numbercouponcode; $i < $n; $i++) {
$row = JTable::getInstance('coupons');
$row->id = NULL;
$couponcode = "";
$couponcode .= $post['prefixcouponcode'];
if ($numrandomchars) {
$couponcode .= $this->createRandomCode($numrandomchars);
}
if ($enabledincrement) {
$couponcode .= $i + 1;
}
$row->couponcode = $couponcode;
$row->description = $post['description'];
$row->points = $post['points'];
$row->expires = $post['expires'];
$row->public = $post['public'];
$row->printable = $post['printable'];
if ($couponcode != '') {
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if ($post['printable'] == 1) {
// save QRCode png
$pathQR = JPATH_COMPONENT . DS . 'assets' . DS . 'coupons' . DS . 'QRcode';
$urlQR = JURI::root() . 'index.php?option=com_alphauserpoints&view=registerqrcode&QRcode=' . $couponcode;
createURLQRcodePNG($urlQR, 50, $pathQR . DS . '50' . DS . $couponcode . '.png');
createURLQRcodePNG($urlQR, 250, $pathQR . DS . '250' . DS . $couponcode . '.png');
}
}
}
}
$msg = JText::_('AUP_DETAILSSAVED');
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=couponcodes', $msg);
JControllerLegacy::redirect();
}
示例7: testSetRedirect
/**
* Test JControllerLegacy::setRedirect
*
* @since 11.3
*
* @return void
*/
public function testSetRedirect()
{
// Set the URL only
$this->class->setRedirect('index.php?option=com_foobar');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect.');
$this->assertAttributeEquals(null, 'message', $this->class, 'Checks the message.');
$this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type.');
// Set the URL and message
$this->class->setRedirect('index.php?option=com_foobar', 'Hello World');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (2).');
$this->assertAttributeEquals('Hello World', 'message', $this->class, 'Checks the message (2).');
$this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (2).');
// URL, message and message type
$this->class->setRedirect('index.php?option=com_foobar', 'Morning Universe', 'notice');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (3).');
$this->assertAttributeEquals('Morning Universe', 'message', $this->class, 'Checks the message (3).');
$this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (3).');
// With previously set message
// URL
$this->class->setMessage('Hi all');
$this->class->setRedirect('index.php?option=com_foobar');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (4).');
$this->assertAttributeEquals('Hi all', 'message', $this->class, 'Checks the message (4).');
$this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (4).');
// URL and message
$this->class->setMessage('Hi all');
$this->class->setRedirect('index.php?option=com_foobar', 'Bye all');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (5).');
$this->assertAttributeEquals('Bye all', 'message', $this->class, 'Checks the message (5).');
$this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (5).');
// URL, message and message type
$this->class->setMessage('Hi all');
$this->class->setRedirect('index.php?option=com_foobar', 'Bye all', 'notice');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (6).');
$this->assertAttributeEquals('Bye all', 'message', $this->class, 'Checks the message (6).');
$this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (6).');
// URL and message type
$this->class->setMessage('Hi all');
$this->class->setRedirect('index.php?option=com_foobar', null, 'notice');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (7).');
$this->assertAttributeEquals('Hi all', 'message', $this->class, 'Checks the message (7).');
$this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (7).');
// With previously set message and message type
// URL
$this->class->setMessage('Hello folks', 'notice');
$this->class->setRedirect('index.php?option=com_foobar');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (8).');
$this->assertAttributeEquals('Hello folks', 'message', $this->class, 'Checks the message (8).');
$this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (8).');
// URL and message
$this->class->setMessage('Hello folks', 'notice');
$this->class->setRedirect('index.php?option=com_foobar', 'Bye, Folks');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (9).');
$this->assertAttributeEquals('Bye, Folks', 'message', $this->class, 'Checks the message (9).');
$this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (9).');
// URL, message and message type
$this->class->setMessage('Hello folks', 'notice');
$this->class->setRedirect('index.php?option=com_foobar', 'Bye, folks', 'notice');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (10).');
$this->assertAttributeEquals('Bye, folks', 'message', $this->class, 'Checks the message (10).');
$this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (10).');
// URL and message type
$this->class->setMessage('Folks?', 'notice');
$this->class->setRedirect('index.php?option=com_foobar', null, 'question');
$this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (10).');
$this->assertAttributeEquals('Folks?', 'message', $this->class, 'Checks the message (10).');
$this->assertAttributeEquals('question', 'messageType', $this->class, 'Checks the message type (10).');
}
示例8: attribPoints
function attribPoints()
{
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$login = JFactory::getApplication()->input->get('login', '', 'username');
$coupon = JFactory::getApplication()->input->get('couponCode', '', 'string');
$trackID = JFactory::getApplication()->input->get('trackID', '', 'string');
$query = "SELECT id FROM #__alpha_userpoints_qrcodetrack WHERE `trackid`='" . $trackID . "'";
$db->setQuery($query);
$idTrack = $db->loadResult();
$query = "SELECT id FROM #__users WHERE `username`='" . $login . "' AND `block`='0'";
$db->setQuery($query);
$userID = $db->loadResult();
if ($userID) {
// insert API AlphaUserPoint
$api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
require_once $api_AUP;
$referrerid = AlphaUserPointsHelper::getAnyUserReferreID($userID);
$nullDate = $db->getNullDate();
$date =& JFactory::getDate();
$now = $date->toSql();
$query = "SELECT * FROM #__alpha_userpoints_coupons WHERE `couponcode`='{$coupon}' AND (`expires`>='{$now}' OR `expires`='0000-00-00 00:00:00')";
$db->setQuery($query);
$result = $db->loadObjectList();
if ($result) {
$resultCouponExist = 0;
// check if public or private coupon
if (!$result[0]->public) {
// private -> usable once per one user
$query = "SELECT count(*) FROM #__alpha_userpoints_details WHERE `keyreference`='{$coupon}'";
$db->setQuery($query);
$resultCouponExist = $db->loadResult();
if (!$resultCouponExist) {
// insert points
AlphaUserPointsHelper::newpoints('sysplgaup_couponpointscodes', $referrerid, $result[0]->couponcode, $result[0]->description, $result[0]->points);
//if ( AlphaUserPointsHelper::newpoints( 'sysplgaup_couponpointscodes', $referrerid, $result[0]->couponcode, $result[0]->description, $result[0]->points, true )===true ){
// insert confirmed in track table
$this->updateTableQRTrack($idTrack);
return $result[0]->points;
//}
} else {
$msg = JText::_('AUP_THIS_COUPON_WAS_ALREADY_USED');
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&view=registerqrcode&QRcode=' . $coupon . '&trackID=' . $trackID, $msg);
JControllerLegacy::redirect();
}
} elseif ($result[0]->public) {
// public -> usable once per all users
$keyreference = $coupon . "##" . $userID;
$query = "SELECT count(*) FROM #__alpha_userpoints_details WHERE `keyreference`='{$keyreference}'";
$db->setQuery($query);
$resultCouponExist = $db->loadResult();
if (!$resultCouponExist) {
// insert points
AlphaUserPointsHelper::newpoints('sysplgaup_couponpointscodes', $referrerid, $keyreference, $result[0]->description, $result[0]->points);
//if ( AlphaUserPointsHelper::newpoints( 'sysplgaup_couponpointscodes', $referrerid, $keyreference, $result[0]->description, $result[0]->points, true )===true ){
// insert confirmed in track table
$this->updateTableQRTrack($idTrack);
return $result[0]->points;
//}
} else {
$msg = JText::_('AUP_THIS_COUPON_WAS_ALREADY_USED');
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&view=registerqrcode&QRcode=' . $coupon . '&trackID=' . $trackID, $msg);
JControllerLegacy::redirect();
}
}
} else {
$msg = JText::_('AUP_COUPON_NOT_AVAILABLE');
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&view=registerqrcode&QRcode=' . $coupon . '&trackID=' . $trackID, $msg);
JControllerLegacy::redirect();
}
} else {
// no username
$msg = JText::_('ALERTNOTAUTH');
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&view=registerqrcode&QRcode=' . $coupon . '&trackID=' . $trackID, $msg);
JControllerLegacy::redirect();
}
}
示例9: checkout
public function checkout()
{
// set template and params
if (!($this->template = $this->application->getTemplate())) {
return $this->app->error->raiseError(500, JText::_('No template selected'));
}
$this->app->document->addScript('assets:js/formhandler.js');
$step = $this->app->request->get('step', 'string', 'customer');
$layout = 'checkout';
$this->params = $this->application->getParams('site');
// Initialize the Cash Register
$CR = $this->app->cashregister->start();
// Import Transfer Data
if ($step != 'receipt') {
$CR->import();
}
//Setup Page Variables
$page = $CR->page;
// $customer = $this->app->request->get('customer','array');
// $CR->order->billing = $this->app->data->create($customer['billing']);
// $CR->order->shipping = $this->app->data->create($customer['shipping']);
switch ($step) {
case 'customer':
$page->title = 'Customer Information';
$page->subtitle = 'Please enter your information below.';
$page->id = $step;
$page->inProgress = array($step);
$page->addButton('print', '', 'Print', false)->addButton('back', '', 'Back', false)->addButton('proceed', 'payment', 'Proceed');
break;
case 'payment':
$page->title = 'Payment Information';
$page->subtitle = 'Please enter your payment information below.';
$page->id = $step;
$page->complete = array('customer');
$page->inProgress = array($step);
$page->addButton('print', '', '', false)->addButton('back', 'customer', 'Back')->addButton('proceed', 'confirm', 'Proceed');
break;
case 'confirm':
$page->title = 'Order Confirmation';
$page->subtitle = '<span class="uk-text-danger">Please make sure that your order is correct.</span>';
$page->id = $step;
$page->complete = array('customer', 'payment');
$page->inProgress = array($step);
$page->addButton('print', '', '', false)->addButton('back', 'payment', 'Back')->addButton('proceed', 'processPayment', 'Pay Now');
break;
case 'receipt':
$page->title = 'Order Receipt';
$page->subtitle = 'Thank you for your purchase.';
$page->id = $step;
$page->complete = array('customer', 'payment', 'confirm');
$page->inProgress = array($step);
$page->addButton('print', 'Print Receipt')->addButton('back', '', 'Back', false)->addButton('proceed', 'home', 'Return to Home Page');
$this->app->document->addStyleSheet('assets:css/receipt.css');
break;
case 'home':
JControllerLegacy::setRedirect('/');
JControllerLegacy::Redirect();
break;
default:
$page->title = 'Customer Information';
$page->subtitle = 'Please enter your information below.';
$page->id = 'customer';
$page->inProgress = array('customer');
$page->addButton('print', '', 'Print', false)->addButton('back', '', 'Back', false)->addButton('proceed', 'payment', 'Proceed');
}
$this->CashRegister = $CR;
// display view
$this->getView()->addTemplatePath($this->template->getPath())->setLayout($layout)->display();
}
示例10: install
//.........这里部分代码省略.........
$file_origin = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'install' . DS . 'plugins' . DS . 'sysplgaup_content';
if ($plugin_installer->install($file_origin)) {
// publish plugin
$query = "UPDATE #__extensions SET enabled='1' WHERE element='sysplgaup_content' AND `type`='plugin' AND folder='content'";
$db->setQuery($query);
$db->query();
$install .= '<img src="components/com_alphauserpoints/assets/images/icon-16-allow.png" alt="" align="absmiddle" /> Installing AlphaUserPoints system <b>Content</b> Plugin <br/>';
} else {
$error++;
}
$plugin_installer = new JInstaller();
$file_origin = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'install' . DS . 'plugins' . DS . 'plg_editors-xtd_raffle';
if ($plugin_installer->install($file_origin)) {
// publish plugin
$query = "UPDATE #__extensions SET enabled='1' WHERE element='raffle' AND `type`='plugin' AND folder='editors-xtd'";
$db->setQuery($query);
$db->query();
$install .= '<img src="components/com_alphauserpoints/assets/images/icon-16-allow.png" alt="" align="absmiddle"/> Installing AlphaUserPoints Raffle Editor Button <b>Editor</b> Plugin <br/>';
} else {
$error++;
}
$plugin_installer = new JInstaller();
$file_origin = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'install' . DS . 'plugins' . DS . 'notification_rank_medal';
if ($plugin_installer->install($file_origin)) {
// publish plugin
$query = "UPDATE #__extensions SET enabled='1' WHERE `element`='notification_rank_medal' AND `type`='plugin' AND folder='alphauserpoints'";
$db->setQuery($query);
$db->query();
$install .= '<img src="components/com_alphauserpoints/assets/images/icon-16-allow.png" alt="" align="absmiddle" /> Installing AlphaUserPoints <b>Notification on update rank and medal</b> Plugin <br/>';
} else {
$error++;
}
if ($error) {
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints', 'NOTICE: AlphaUserPoints plugins are not successfully installed. Make sure that the plugins directory is writeable');
JControllerLegacy::redirect();
} else {
// Insert rules and Guest user on fresh install
$query = "SELECT id FROM #__alpha_userpoints WHERE `userid`='0' AND `referreid`='GUEST'";
$db->setQuery($query);
$result = $db->loadResult();
if (!$result) {
// This GUEST user is used by AUP system, don't remove!
$query = "INSERT INTO #__alpha_userpoints (`id`, `userid`, `referreid`, `points`, `max_points`, `last_update`, `referraluser`, `referrees`, `blocked`, `levelrank`) VALUES ('', '0', 'GUEST', '0', '0', '0000-00-00 00:00:00', '', '0', '0', '0');";
$db->setQuery($query);
$db->query();
}
$query = "SELECT count(*) FROM #__alpha_userpoints_rules";
$db->setQuery($query);
$result = $db->loadResult();
if (!$result) {
// Insert default rules on fresh install
$query = "INSERT INTO #__alpha_userpoints_rules (`id`, `rule_name`, `rule_description`, `rule_plugin`, `plugin_function`, `access`, `component`, `calltask`, `taskid`, `points`, `points2`, `percentage`, `rule_expire`, `sections`, `categories`, `content_items`, `exclude_items`, `published`, `system`, `duplicate`, `blockcopy`, `autoapproved`, `fixedpoints`, `category`, `displaymsg`, `msg`, `method`, `notification`, `emailsubject`, `emailbody`, `emailformat`, `bcc2admin`, `type_expire_date`, `chain`,`linkup`, `displayactivity`) VALUES\r\n\t\t\t\t\t\t\t('', 'AUP_NEWUSER', 'AUP_NEWUSERDESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_newregistered', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 1, 1, 0, 1, 1, 1, 'us', '0', '', '1', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_INVITE', 'AUP_INVITE_A_USER', 'AUP_SYSTEM', 'sysplgaup_invite', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 're', '1', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_INVITESUCCES', 'AUP_INVITE_A_USERSUCCESS', 'AUP_SYSTEM', 'sysplgaup_invitewithsuccess', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 're', '0', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_READTOAUTHOR', 'AUP_READTOAUTHORDESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_reader2author', '0', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 'ar', '1', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_REFERRALPOINTS', 'AUP_REFERRALPOINTSDESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_referralpoints', '1', '', '', '', 0, 0, 1, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 'co', '0', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_BONUSPOINTS', 'AUP_BONUSPOINTSDESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_bonuspoints', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 1, 0, 1, 1, 'ot', '0', '', '4', '0', '', '', '0', '0', '0', '1', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_WINNERNOTIFICATION', 'AUP_WINNERNOTIFICATIONDESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_winnernotification', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 0, 'sy', '0', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_COUPON_POINTS_CODES', 'AUP_COUPON_POINTS_CODES_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_couponpointscodes', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 0, 'cd', '1', '', '1', '0', '', '', '0', '0', '0', '0', '0', '1'),\t\t\t\r\n\t\t\t\t\t\t\t('', 'AUP_RAFFLE', 'AUP_RAFFLE_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_raffle', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 0, 'ot', '1', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_CUSTOM', 'AUP_CUSTOM_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_custom', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 0, 1, 0, 'ot', '1', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_UPLOADAVATAR', 'AUP_UPLOADAVATAR_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_uploadavatar', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 'us', '1', '', '1', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_PROFILECOMPLETE', 'AUP_PROFILECOMPLETE_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_profilecomplete', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 'us', '1', '', '1', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_PROFILE_VIEW', 'AUP_PROFILE_VIEW_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_profile_view', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 'co', '1', '', '1', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_CHANGE_LEVEL_1', 'AUP_CHANGE_LEVEL_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_changelevel1', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 'us', '0', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_CHANGE_LEVEL_2', 'AUP_CHANGE_LEVEL_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_changelevel2', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 'us', '0', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_CHANGE_LEVEL_3', 'AUP_CHANGE_LEVEL_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_changelevel3', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 1, 0, 1, 1, 1, 'us', '0', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\t\t\t\r\n\t\t\t\t\t\t\t('', 'AUP_COMBINED_ACTIVITIES', 'AUP_COMBINE_ACTIVITIES_DESCRIPTION', 'AUP_SYSTEM', 'sysplgaup_archive', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 1, 1, 0, 1, 1, 0, 'sy', '0', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_KU_NEW_TOPIC', 'AUP_KU_NEW_TOPIC_DESCRIPTION', 'AUP_KUNENA_FORUM', 'plgaup_kunena_topic_create', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 0, 0, 0, 1, 1, 'fo', '1', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_KU_REPLY_TOPIC', 'AUP_KU_REPLY_DESCRIPTION', 'AUP_KUNENA_FORUM', 'plgaup_kunena_topic_reply', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 0, 0, 0, 1, 1, 'fo', '1', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_KU_THANKYOU', 'AUP_KU_THANKYOU_DESCRIPTION', 'AUP_KUNENA_FORUM', 'plgaup_kunena_message_thankyou', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 0, 0, 0, 1, 1, 'fo', '1', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1'),\r\n\t\t\t\t\t\t\t('', 'AUP_KU_DELETE_POST', 'AUP_KU_DELETE_POST_DESCRIPTION', 'AUP_KUNENA_FORUM', 'plgaup_kunena_message_delete', '1', '', '', '', 0, 0, 0, '0000-00-00 00:00:00', '', '', '', '', 0, 0, 0, 0, 1, 1, 'fo', '1', '', '4', '0', '', '', '0', '0', '0', '0', '0', '1');";
$db->setQuery($query);
if ($db->query()) {
// default
$install .= '<img src="components/com_alphauserpoints/assets/images/icon-16-allow.png" alt="" align="absmiddle" /> 17 default rules installed<br/>';
// Kunena
$install .= '<img src="components/com_alphauserpoints/assets/images/icon-16-allow.png" alt="" align="absmiddle" /> 4 default rules for Kunena installed<br/>';
}
// Insert version on fresh install
$query = "SELECT version FROM #__alpha_userpoints_version WHERE 1";
$db->setQuery($query);
$result = $db->loadResult();
if (!$result) {
$query = "INSERT INTO #__alpha_userpoints_version (`version`) VALUES ('AUP190');";
$db->setQuery($query);
示例11: setRedirect
/**
* Set a URL for browser redirection.
* Use type 'error' if the message is an error message
* @param string $url URL to redirect to.
* @param string $msg Message to display on redirect. Optional, defaults to value set internally by controller, if any.
* @param string $type Message type. Optional, defaults to 'message' or the type set by a previous call to setMessage.
*
* @return JController This object to support chaining.
*
* @since 11.1
*/
public function setRedirect($url = null, $msg = null, $type = null)
{
if ($url === null) {
$url = $this->redirectPath;
}
$format = JRequest::getWord('format');
if ($format !== 'json') {
// add menu item id in front
if (JFactory::getApplication()->isSite()) {
$url = jRoute::_($url, false);
}
return parent::setRedirect($url, $msg, $type);
}
if ($msg !== null) {
// Controller may have set this directly
$this->json->message = $msg;
}
// Ensure the type is not overwritten by a previous call to setMessage.
if (empty($type)) {
if (empty($this->messageType)) {
$this->messageType = 'message';
}
} else {
$this->messageType = $type;
}
if ($this->messageType == 'message') {
$this->json->type = 'alert-info';
} else {
if ($this->messageType == 'error') {
$this->json->type = 'alert-error';
} else {
$this->json->type = 'alert-' . $this->messageType;
}
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: application/json;; charset=utf-8");
echo json_encode($this->json);
jexit();
}
示例12: _make_raffle_now
//.........这里部分代码省略.........
$winner3 = @$listParticipants3[$choice3]->uid;
}
// Save winner(s)
$row = JTable::getInstance('raffle');
$row->load($rowRaffle->id);
$row->winner1 = $winner1;
$row->winner2 = $winner2;
$row->winner3 = $winner3;
if (!$row->store()) {
JError::raiseError(500, $row->getError());
}
// attribs points or coupon code
if ($winner1) {
$winner1_Referreid = AlphaUserPointsHelper::getAnyUserReferreID(intval($winner1));
}
if ($winner2) {
$winner2_Referreid = AlphaUserPointsHelper::getAnyUserReferreID(intval($winner2));
}
if ($winner3) {
$winner3_Referreid = AlphaUserPointsHelper::getAnyUserReferreID(intval($winner3));
}
switch ($rowRaffle->rafflesystem) {
case '1':
// is coupon code ...
// send notification by email
if ($rowRaffle->sendcouponbyemail) {
if ($winner1 && $rowRaffle->couponcodeid1) {
$this->sendnotification4couponcode($winner1_Referreid, $this->_get_Coupon($rowRaffle->couponcodeid1));
}
if ($winner2 && $rowRaffle->couponcodeid2) {
$this->sendnotification4couponcode($winner2_Referreid, $this->_get_Coupon($rowRaffle->couponcodeid2));
}
if ($winner3 && $rowRaffle->couponcodeid3) {
$this->sendnotification4couponcode($winner3_Referreid, $this->_get_Coupon($rowRaffle->couponcodeid3));
}
}
// uddeim notification
if ($params->get('sendMsgUddeim', 0) && $params->get('fromIdUddeim')) {
// Uddeim notification integration
require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helpers' . DS . 'uddeim.api.php';
$SiteName = $app->getCfg('sitename');
if ($winner1 && $rowRaffle->couponcodeid1) {
$message = sprintf(JText::_('AUP_EMAILNOTIFICATION_MSG_COUPONCODE'), $SiteName, $this->_get_Coupon($rowRaffle->couponcodeid1));
uddeIMAPI::sendNewMessage(intval($params->get('fromIdUddeim')), intval($winner1), $message);
$message = "";
}
if ($winner2 && $rowRaffle->couponcodeid2) {
$message = sprintf(JText::_('AUP_EMAILNOTIFICATION_MSG_COUPONCODE'), $SiteName, $this->_get_Coupon($rowRaffle->couponcodeid2));
uddeIMAPI::sendNewMessage(intval($params->get('fromIdUddeim')), intval($winner2), $message);
$message = "";
}
if ($winner3 && $rowRaffle->couponcodeid3) {
$message = sprintf(JText::_('AUP_EMAILNOTIFICATION_MSG_COUPONCODE'), $SiteName, $this->_get_Coupon($rowRaffle->couponcodeid3));
uddeIMAPI::sendNewMessage(intval($params->get('fromIdUddeim')), intval($winner3), $message);
$message = "";
}
}
break;
case '2':
// e-mail with a download link as a price
if ($winner1 && $rowRaffle->link2download1) {
$this->sendnotificationDownload($winner1_Referreid, $rowRaffle->link2download1);
}
if ($winner2 && $rowRaffle->link2download2) {
$this->sendnotificationDownload($winner2_Referreid, $rowRaffle->link2download2);
}
if ($winner3 && $rowRaffle->link2download3) {
$this->sendnotificationDownload($winner3_Referreid, $rowRaffle->link2download3);
}
break;
case '3':
// just simple e-mail
if ($winner1) {
$this->sendSimpleEmail($winner1_Referreid, '1');
}
if ($winner2) {
$this->sendSimpleEmail($winner2_Referreid, '2');
}
if ($winner3) {
$this->sendSimpleEmail($winner3_Referreid, '3');
}
break;
default:
// is points ...
if ($winner1) {
AlphaUserPointsHelper::newpoints('sysplgaup_raffle', $winner1_Referreid, '', $rowRaffle->description, $rowRaffle->pointstoearn1);
}
if ($winner2) {
AlphaUserPointsHelper::newpoints('sysplgaup_raffle', $winner2_Referreid, '', $rowRaffle->description, $rowRaffle->pointstoearn2);
}
if ($winner3) {
AlphaUserPointsHelper::newpoints('sysplgaup_raffle', $winner3_Referreid, '', $rowRaffle->description, $rowRaffle->pointstoearn3);
}
}
// end switch
$results = $dispatcher->trigger('onAfterMakeRaffleAlphaUserPoints', array(&$rowRaffle, $now));
$redirecturl = "index.php?option=com_alphauserpoints&task=raffle";
JControllerLegacy::setRedirect($redirecturl);
JControllerLegacy::redirect();
}
示例13: _customrulepoints
function _customrulepoints($cids, $reason, $points)
{
$app = JFactory::getApplication();
// initialize variables
$db = JFactory::getDBO();
$query = "SELECT `id` FROM #__alpha_userpoints_rules WHERE `plugin_function`='sysplgaup_custom'";
$db->setQuery($query);
$rule_id = $db->loadResult();
JArrayHelper::toInteger($cids);
if (count($cids)) {
require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
foreach ($cids as $cid) {
$query = "SELECT referreid FROM #__alpha_userpoints WHERE id='" . $cid . "'";
$db->setQuery($query);
$referrerid = $db->loadResult();
if ($referrerid) {
AlphaUserPointsHelper::userpoints('sysplgaup_custom', $referrerid, 0, '', $reason, $points);
$this->checkTotalAfterRecalculate($referrerid, $rule_id);
}
}
$app->enqueueMessage(JText::_('AUP_RECALCULATION_MADE'));
}
$redirecturl = "index.php?option=com_alphauserpoints&task=statistics";
JControllerLegacy::setRedirect($redirecturl);
JControllerLegacy::redirect();
}
示例14: _delete_user_all_activities
function _delete_user_all_activities()
{
$app = JFactory::getApplication();
// initialize variables
$db = JFactory::getDBO();
$c2id = JFactory::getApplication()->input->get('c2id', '', 'string');
$post = JRequest::get('post');
//$msgType = '';
//JArrayHelper::toInteger($cid);
// load external plugins
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('alphauserpoints');
$results = $dispatcher->trigger('onBeforeDeleteAllUserActivitiesAlphaUserPoints', array($c2id));
// c2id = referreid
if ($c2id) {
$msg = JText::_('AUP_SUCCESSFULLYDELETED');
$query = "DELETE FROM #__alpha_userpoints_details" . "\n WHERE `referreid` = '" . $c2id . "'";
$db->setQuery($query);
if (!$db->query()) {
JError::raiseError(500, $db->getErrorMsg());
return false;
}
$results = $dispatcher->trigger('onAfterDeleteAllUserActivitiesAlphaUserPoints', array($c2id));
// c2id = referreid
}
// recalculate for this user
$this->checkNewTotal($c2id);
$app->enqueueMessage($msg);
$redirect = 'index.php?option=com_alphauserpoints&task=' . $post['redirect'];
JControllerLegacy::setRedirect($redirect);
JControllerLegacy::redirect();
}
示例15: _delete_medaluser
function _delete_medaluser()
{
$app = JFactory::getApplication();
// initialize variables
$db = JFactory::getDBO();
$cid = JFactory::getApplication()->input->get('cid', 0, 'int');
$rid = JFactory::getApplication()->input->get('rid', 0, 'int');
$msgType = '';
if ($cid) {
// remove user medals
$query = "DELETE FROM #__alpha_userpoints_medals" . "\n WHERE `id`={$cid} AND rid={$rid}";
$db->setQuery($query);
$db->query();
if (!$db->query()) {
$msg = $db->getErrorMsg();
$msgType = 'error';
} else {
$msg = JText::_('AUP_SUCCESSFULLYDELETED');
}
}
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=edituser&cid[]=' . $rid, $msg);
JControllerLegacy::redirect();
}