本文整理汇总了PHP中JControllerLegacy::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP JControllerLegacy::redirect方法的具体用法?PHP JControllerLegacy::redirect怎么用?PHP JControllerLegacy::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JControllerLegacy
的用法示例。
在下文中一共展示了JControllerLegacy::redirect方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: _save_templateinvite
function _save_templateinvite($apply = 0)
{
$app = JFactory::getApplication();
// initialize variables
$db = JFactory::getDBO();
//$post = $_POST;
$post = JFactory::getApplication()->input->getArray(array());
$row = JTable::getInstance('template_invite');
$id = JFactory::getApplication()->input->get('id', 0, 'int');
if (!$row->bind($post)) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$msg = JText::_('AUP_TEMPLATESAVED');
if (!$apply) {
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=templateinvite', $msg);
} else {
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=edittemplateinvite&cid[]=' . $id, $msg);
}
JControllerLegacy::redirect();
}
示例3: _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();
}
示例4: redirect
function redirect() {
if (JDEBUG && $this->redirect) {
$app = JFactory::getApplication();
if($this->message) {
$app->enqueueMessage( $this->message, $this->messageType);
}
echo '<div style="color: #f00;">Debug mode ON. Click the link for redirect: </div>'.JHTML::link($this->redirect,$this->redirect);
} else {
return parent::redirect();
}
}
示例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_levelrank
function _save_levelrank($apply = 0)
{
$app = JFactory::getApplication();
// initialize variables
$db = JFactory::getDBO();
$post = JRequest::get('post');
$row = JTable::getInstance('levelrank');
if (!$row->bind($post)) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$msg = JText::_('AUP_DETAILSSAVED');
// launch recalculation for all users
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=recalculate', $msg);
JControllerLegacy::redirect();
}
示例7: _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;
}
}
示例8: install
//.........这里部分代码省略.........
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);
$db->query();
示例9: 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();
}
}
示例10: _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();
}
示例11: _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();
}
示例12: _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();
}
示例13: _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();
}
示例14: _copy_rule
function _copy_rule()
{
$app = JFactory::getApplication();
// Initialize variables
$db = JFactory::getDBO();
$cid = JFactory::getApplication()->input->get('cid', array(), 'array');
JArrayHelper::toInteger($cid);
$item = null;
$total = count($cid);
$j = 0;
for ($i = 0; $i < $total; $i++) {
$row = JTable::getInstance('rules');
// main query
$query = 'SELECT * FROM #__alpha_userpoints_rules' . ' WHERE id = ' . (int) $cid[$i];
$db->setQuery($query, 0, 1);
$item = $db->loadObject();
$unique = uniqid('', false);
if ($item->blockcopy == '0') {
// values loaded into array set for store
$row->id = NULL;
$row->rule_name = JText::_('AUP_COPYOF') . " " . JText::_($item->rule_name);
$row->rule_description = "";
$row->rule_plugin = $item->rule_plugin;
$row->plugin_function = $item->plugin_function . '_' . $unique;
$row->access = $item->access;
$row->component = $item->component;
$row->calltask = $item->calltask;
$row->taskid = $item->taskid;
$row->points = $item->points;
$row->points2 = $item->points2;
$row->percentage = $item->percentage;
$row->rule_expire = $item->rule_expire;
$row->sections = $item->sections;
$row->categories = $item->categories;
$row->content_items = $item->content_items;
$row->exclude_items = $item->exclude_items;
$row->published = 0;
$row->system = 0;
$row->duplicate = 1;
$row->blockcopy = 0;
$row->autoapproved = $item->autoapproved;
$row->fixedpoints = 1;
$row->category = $item->category;
$row->displaymsg = $item->displaymsg;
$row->msg = $item->msg;
$row->method = $item->method;
$row->notification = $item->notification;
$row->emailsubject = $item->emailsubject;
$row->emailbody = $item->emailbody;
$row->emailformat = $item->emailformat;
$row->bcc2admin = $item->bcc2admin;
$row->type_expire_date = $item->type_expire_date;
$row->chain = 0;
$row->linkup = intval($item->linkup);
if (!$row->store()) {
JError::raiseError(500, $row->getError());
return false;
}
$j++;
}
}
$msg = JText::sprintf('AUP_XCOPYOFRULE', $j);
JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=rules', $msg);
JControllerLegacy::redirect();
}