/** * @param object $subject * @param array $config */ public function __construct(&$subject, $config) { // Do not load if Kunena version is not supported or Kunena is offline if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('4.0') && KunenaForum::installed())) { return; } KunenaFactory::loadLanguage('plg_kunena_uddeim.sys', 'admin'); $path = JPATH_SITE . "/components/com_uddeim/uddeim.api.php"; if (!is_file($path)) { return; } include_once($path); $uddeim = new uddeIMAPI(); if ($uddeim->version() < 1) { return; } parent::__construct($subject, $config); $this->loadLanguage('plg_kunena_uddeim.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_kunena_uddeim.sys', KPATH_ADMIN); }
function generateSystemReport() { jimport('joomla.filesystem.file'); $kunena_config = KunenaFactory::getConfig(); $kunena_app = JFactory::getApplication(); $kunena_db = JFactory::getDBO(); $JVersion = new JVersion(); $jversion = $JVersion->PRODUCT . ' ' . $JVersion->RELEASE . '.' . $JVersion->DEV_LEVEL . ' ' . $JVersion->DEV_STATUS . ' [ ' . $JVersion->CODENAME . ' ] ' . $JVersion->RELDATE; if ($kunena_app->getCfg('legacy')) { $jconfig_legacy = '[color=#FF0000]Enabled[/color]'; } else { $jconfig_legacy = 'Disabled'; } if (!$kunena_app->getCfg('smtpuser')) { $jconfig_smtpuser = '******'; } else { $jconfig_smtpuser = $kunena_app->getCfg('smtpuser'); } if ($kunena_app->getCfg('ftp_enable')) { $jconfig_ftp = 'Enabled'; } else { $jconfig_ftp = 'Disabled'; } if ($kunena_app->getCfg('sef')) { $jconfig_sef = 'Enabled'; } else { $jconfig_sef = 'Disabled'; } if ($kunena_app->getCfg('sef_rewrite')) { $jconfig_sef_rewrite = 'Enabled'; } else { $jconfig_sef_rewrite = 'Disabled'; } if (file_exists(JPATH_ROOT . '/.htaccess')) { $htaccess = 'Exists'; } else { $htaccess = 'Missing'; } if (ini_get('register_globals')) { $register_globals = '[u]register_globals:[/u] [color=#FF0000]On[/color]'; } else { $register_globals = '[u]register_globals:[/u] Off'; } if (ini_get('safe_mode')) { $safe_mode = '[u]safe_mode:[/u] [color=#FF0000]On[/color]'; } else { $safe_mode = '[u]safe_mode:[/u] Off'; } if (extension_loaded('mbstring')) { $mbstring = '[u]mbstring:[/u] Enabled'; } else { $mbstring = '[u]mbstring:[/u] [color=#FF0000]Not installed[/color]'; } if (extension_loaded('gd')) { $gd_info = gd_info(); $gd_support = '[u]GD:[/u] ' . $gd_info['GD Version']; } else { $gd_support = '[u]GD:[/u] [color=#FF0000]Not installed[/color]'; } $maxExecTime = ini_get('max_execution_time'); $maxExecMem = ini_get('memory_limit'); $fileuploads = ini_get('upload_max_filesize'); $kunenaVersionInfo = CKunenaVersion::versionArray(); //get all the config settings for Kunena $kunena_db->setQuery("SHOW TABLES LIKE '" . $kunena_db->getPrefix() . "kunena_config'"); $table_config = $kunena_db->loadResult(); if (KunenaError::checkDatabaseError()) { return; } if ($table_config) { $kunena_db->setQuery("SELECT * FROM #__kunena_config"); $kconfig = (object) $kunena_db->loadObject(); if (KunenaError::checkDatabaseError()) { return; } $kconfigsettings = '[table]'; $kconfigsettings .= '[th]Kunena config settings:[/th]'; foreach ($kconfig as $key => $value) { if ($key != 'id' && $key != 'board_title' && $key != 'email' && $key != 'offline_message' && $key != 'recaptcha_publickey' && $key != 'recaptcha_privatekey' && $key != 'email_visible_addres' && $key != 'recaptcha_theme') { $kconfigsettings .= '[tr][td]' . $key . '[/td][td]' . $value . '[/td][/tr]'; } } $kconfigsettings .= '[/table]'; } else { $kconfigsettings = 'Your configuration settings aren\'t yet recorded in the database'; } // Get Kunena default template $ktemplate = KunenaFactory::getTemplate(); $ktempaltedetails = $ktemplate->getTemplateDetails(); // Get database collation $collation = getTablesCollation(); // Get Joomla! template details $templatedetails = getJoomlaTemplate(); // Get Joomla! menu details $joomlamenudetails = getJoomlaMenuDetails(); // Check if Mootools plugins and others kunena plugins are enabled, and get the version of this modules jimport('joomla.plugin.helper'); jimport('joomla.application.module.helper'); jimport('joomla.application.component.helper'); $plg = array(); if (JPluginHelper::isEnabled('system', 'mtupgrade')) { $plg['mtupgrade'] = '[u]System - Mootools Upgrade:[/u] Enabled'; } else { $plg['mtupgrade'] = '[u]System - Mootools Upgrade:[/u] Disabled'; } if (JPluginHelper::isEnabled('system', 'mootools12')) { $plg['mt12'] = '[u]System - Mootools12:[/u] Enabled'; } else { $plg['mt12'] = '[u]System - Mootools12:[/u] Disabled'; } $plg['jfirephp'] = checkThirdPartyVersion('jfirephp', 'jfirephp', 'JFirePHP', 'plugins/system', 'system', 0, 0, 1); $plg['ksearch'] = checkThirdPartyVersion('kunenasearch', 'kunenasearch', 'Kunena Search', 'plugins/search', 'search', 0, 0, 1); $plg['kdiscuss'] = checkThirdPartyVersion('kunenadiscuss', 'kunenadiscuss', 'Kunena Discuss', 'plugins/content', 'content', 0, 0, 1); $plg['jxfinderkunena'] = checkThirdPartyVersion('plg_jxfinder_kunena', 'plg_jxfinder_kunena', 'Finder Kunena Posts', 'plugins/finder', 'finder', 0, 0, 1); $plg['kjomsocialmenu'] = checkThirdPartyVersion('kunenamenu', 'kunenamenu', 'My Kunena Forum Menu', 'plugins/community', 'community', 0, 0, 1); $plg['kjomsocialmykunena'] = checkThirdPartyVersion('mykunena', 'mykunena', 'My Kunena Forum Posts', 'plugins/community', 'community', 0, 0, 1); $plg['kjomsocialgroups'] = checkThirdPartyVersion('kunenagroups', 'kunenagroups', 'Kunena Groups', 'plugins/community', 'community', 0, 0, 1); foreach ($plg as $id => $item) { if (empty($item)) { unset($plg[$id]); } } if (!empty($plg)) { $plgtext = '[quote][b]Plugins:[/b] ' . implode(' | ', $plg) . ' [/quote]'; } else { $plgtext = '[quote][b]Plugins:[/b] None [/quote]'; } $mod = array(); $mod['kunenalatest'] = checkThirdPartyVersion('mod_kunenalatest', 'mod_kunenalatest', 'Kunena Latest', 'modules/mod_kunenalatest', null, 0, 1, 0); $mod['kunenastats'] = checkThirdPartyVersion('mod_kunenastats', 'mod_kunenastats', 'Kunena Stats', 'modules/mod_kunenastats', null, 0, 1, 0); $mod['kunenalogin'] = checkThirdPartyVersion('mod_kunenalogin', 'mod_kunenalogin', 'Kunena Login', 'modules/mod_kunenalogin', null, 0, 1, 0); $mod['kunenasearch'] = checkThirdPartyVersion('mod_kunenasearch', 'mod_kunenasearch', 'Kunena Search', 'modules/mod_kunenasearch', null, 0, 1, 0); foreach ($mod as $id => $item) { if (empty($item)) { unset($mod[$id]); } } if (!empty($mod)) { $modtext = '[quote][b]Modules:[/b] ' . implode(' | ', $mod) . ' [/quote]'; } else { $modtext = '[quote][b]Modules:[/b] None [/quote]'; } $thirdparty = array(); if (JFile::exists(JPATH_SITE . '/components/com_alphauserpoints/helper.php')) { require_once JPATH_SITE . '/components/com_alphauserpoints/helper.php'; $aup = new AlphaUserPointsHelper(); $thirdparty['aup'] = '[u]AlphaUserPoints[/u] ' . $aup->getAupVersion(); } else { $thirdparty['aup'] = checkThirdPartyVersion('alphauserpoints', array('manifest', 'alphauserpoints'), 'AlphaUserPoints', 'components/com_alphauserpoints', null, 1, 0, 0); } $thirdparty['cb'] = checkThirdPartyVersion('comprofiler', array('comprofilej', 'comprofileg'), 'CommunityBuilder', 'components/com_comprofiler', null, 1, 0, 0); $thirdparty['jomsocial'] = checkThirdPartyVersion('community', array('community'), 'Jomsocial', 'components/com_community', null, 1, 0, 0); if (JFile::exists(JPATH_SITE . '/components/com_uddeim/uddeim.api.php')) { require_once JPATH_SITE . '/components/com_uddeim/uddeim.api.php'; $uddeim = new uddeIMAPI(); $api_version = $uddeim->version(); if ($api_version >= '3') { $uddeim_version = $uddeim->mainVersion(); $thirdparty['uddeim'] = '[u]UddeIm[/u] ' . $uddeim_version['version']; } else { $thirdparty['uddeim'] = checkThirdPartyVersion('uddeim', array('uddeim.j15', 'uddeim'), 'UddeIm', 'components/com_uddeim', null, 1, 0, 0); } } else { $thirdparty['uddeim'] = checkThirdPartyVersion('uddeim', array('uddeim.j15', 'uddeim'), 'UddeIm', 'components/com_uddeim', null, 1, 0, 0); } foreach ($thirdparty as $id => $item) { if (empty($item)) { unset($thirdparty[$id]); } } if (!empty($thirdparty)) { $thirdpartytext = '[quote][b]Third-party components:[/b] ' . implode(' | ', $thirdparty) . ' [/quote]'; } else { $thirdpartytext = '[quote][b]Third-party components:[/b] None [/quote]'; } $sef = array(); $sef['sh404sef'] = checkThirdPartyVersion('sh404sef', 'sh404sef', 'sh404sef', 'components/com_sh404sef', null, 1, 0, 0); $sef['joomsef'] = checkThirdPartyVersion('joomsef', 'sef', 'ARTIO JoomSEF', 'components/com_sef', null, 1, 0, 0); $sef['acesef'] = checkThirdPartyVersion('acesef', 'acesef', 'AceSEF', 'components/com_acesef', null, 1, 0, 0); foreach ($sef as $id => $item) { if (empty($item)) { unset($sef[$id]); } } if (!empty($sef)) { $seftext = '[quote][b]Third-party SEF components:[/b] ' . implode(' | ', $sef) . ' [/quote]'; } else { $seftext = '[quote][b]Third-party SEF components:[/b] None [/quote]'; } $report = '[confidential][b]Joomla! version:[/b] ' . $jversion . ' [b]Platform:[/b] ' . $_SERVER['SERVER_SOFTWARE'] . ' (' . $_SERVER['SERVER_NAME'] . ') [b]PHP version:[/b] ' . phpversion() . ' | ' . $safe_mode . ' | ' . $register_globals . ' | ' . $mbstring . ' | ' . $gd_support . ' | [b]MySQL version:[/b] ' . $kunena_db->getVersion() . '[/confidential][quote][b]Database collation check:[/b] ' . $collation . ' [/quote][quote][b]Legacy mode:[/b] ' . $jconfig_legacy . ' | [b]Joomla! SEF:[/b] ' . $jconfig_sef . ' | [b]Joomla! SEF rewrite:[/b] ' . $jconfig_sef_rewrite . ' | [b]FTP layer:[/b] ' . $jconfig_ftp . ' |[confidential][b]Mailer:[/b] ' . $kunena_app->getCfg('mailer') . ' | [b]From name:[/b] ' . $kunena_app->getCfg('fromname') . ' | [b]SMTP Secure:[/b] ' . $kunena_app->getCfg('smtpsecure') . ' | [b]SMTP Port:[/b] ' . $kunena_app->getCfg('smtpport') . ' | [b]SMTP User:[/b] ' . $jconfig_smtpuser . ' | [b]SMTP Host:[/b] ' . $kunena_app->getCfg('smtphost') . ' [/confidential] [b]htaccess:[/b] ' . $htaccess . ' | [b]PHP environment:[/b] [u]Max execution time:[/u] ' . $maxExecTime . ' seconds | [u]Max execution memory:[/u] ' . $maxExecMem . ' | [u]Max file upload:[/u] ' . $fileuploads . ' [/quote][confidential][b]Kunena menu details[/b]:[spoiler] ' . $joomlamenudetails . '[/spoiler][/confidential][quote][b]Joomla default template details :[/b] ' . $templatedetails->name . ' | [u]author:[/u] ' . $templatedetails->author . ' | [u]version:[/u] ' . $templatedetails->version . ' | [u]creationdate:[/u] ' . $templatedetails->creationdate . ' [/quote][quote][b]Kunena default template details :[/b] ' . $ktempaltedetails->name . ' | [u]author:[/u] ' . $ktempaltedetails->author . ' | [u]version:[/u] ' . $ktempaltedetails->version . ' | [u]creationdate:[/u] ' . $ktempaltedetails->creationDate . ' [/quote][quote] [b]Kunena version detailled:[/b] [u]Installed version:[/u] ' . $kunenaVersionInfo->version . ' | [u]Build:[/u] ' . $kunenaVersionInfo->build . ' | [u]Version name:[/u] ' . $kunenaVersionInfo->name . ' | [u]Kunena detailled configuration:[/u] [spoiler] ' . $kconfigsettings . '[/spoiler][/quote]' . $thirdpartytext . ' ' . $seftext . ' ' . $plgtext . ' ' . $modtext; return $report; }
public static function sendUddeimWinnerNotification($referrerid, $assignpoints, $newtotal) { $app = JFactory::getApplication(); $lang = JFactory::getLanguage(); $lang->load('com_alphauserpoints', JPATH_SITE); // get params definitions $params = JComponentHelper::getParams('com_alphauserpoints'); if (!$referrerid || $referrerid == 'GUEST') { return; } // check if component installed $uddeim_exist = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_uddeim' . DS . 'admin.uddeimlib15.php'; if (!file_exists($uddeim_exist)) { return; } $FromName = $app->getCfg('fromname'); $userinfo = AlphaUserPointsHelper::getUserInfo($referrerid); $name = $userinfo->name; $fromIdUddeim = intval($params->get('fromIdUddeim')); if (!$userinfo->block && $fromIdUddeim > 0) { require_once JPATH_SITE . DS . "components" . DS . "com_uddeim" . DS . "uddeim.api.php"; // send notification to winner $message = sprintf(JText::_('AUP_EMAILWINNERNOTIFICATION_MSG_USER'), $name, AlphaUserPointsHelper::getFPoints($newtotal)); $uddeimapi = new uddeIMAPI(); $uddeimapi->sendNewMessage($fromIdUddeim, $userinfo->userid, $message); } }
function _make_raffle_now() { $app = JFactory::getApplication(); require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php'; $db = JFactory::getDBO(); // Proceed raffle now $cid = JFactory::getApplication()->input->get('cid', array(0), 'array'); $rowRaffle = $this->_edit_raffle(); $rowRaffle = $rowRaffle[0]; $jnow = JFactory::getDate(); $now = $jnow->toSql(); // add offset $config = JFactory::getConfig(); $tzoffset = $config->get('config.offset'); $datetimestamp = strtotime($now); $now = date('Y-m-d H:i:s', $datetimestamp + $tzoffset * 60 * 60); // get params definitions $params = JComponentHelper::getParams('com_alphauserpoints'); // Raffle date is not today ? if ($rowRaffle->raffledate != '0000-00-00 00:00:00' && $now < $rowRaffle->raffledate) { echo "<script> alert('" . JText::_('AUP_DATE_OF_RAFFLE_IS_NOT_TODAY') . "'); window.history.go(-1); </script>\n"; exit; } // load external plugins $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('alphauserpoints'); $results = $dispatcher->trigger('onBeforeMakeRaffleAlphaUserPoints', array(&$rowRaffle, $now)); $winner1 = 0; $winner2 = 0; $winner3 = 0; $winner1_Referreid = 0; $winner2_Referreid = 0; $winner3_Referreid = 0; // exclude users if rule enabled $queryExclude = " AND `published`='1'"; // first raffle // select all users registered or only users with registration for this raffle if ($rowRaffle->inscription) { $query = "SELECT id, userid as uid FROM #__alpha_userpoints_raffle_inscriptions WHERE raffleid=" . $rowRaffle->id; } else { $query = "SELECT userid as uid FROM #__alpha_userpoints WHERE blocked='0'" . $queryExclude; } $db->setQuery($query); $listParticipants = $db->loadObjectList(); if (!$listParticipants) { echo "<script> alert('" . JText::_('AUP_NO_PARTICIPANT') . "'); window.history.go(-1); </script>\n"; exit; } $max = count($listParticipants) - 1; $choice = rand(0, $max); $winner1 = $listParticipants[$choice]->uid; if ($rowRaffle->numwinner > 1) { // 2th raffle without first winner if ($rowRaffle->inscription) { $query = "SELECT userid as uid FROM #__alpha_userpoints_raffle_inscriptions WHERE raffleid=" . $rowRaffle->id . " AND userid!='{$winner1}'"; } else { $query = "SELECT userid as uid FROM #__alpha_userpoints WHERE blocked='0' AND userid!='{$winner1}'" . $queryExclude; } $db->setQuery($query); $listParticipants2 = $db->loadObjectList(); $max2 = count($listParticipants2) - 1; $choice2 = rand(0, $max2); $winner2 = @$listParticipants2[$choice2]->uid; } if ($rowRaffle->numwinner == 3) { // 3th raffle without first and second winner if ($rowRaffle->inscription) { $query = "SELECT userid as uid FROM #__alpha_userpoints_raffle_inscriptions WHERE raffleid=" . $rowRaffle->id . " AND userid!='{$winner1}' AND userid!='{$winner2}'"; } else { $query = "SELECT userid as uid FROM #__alpha_userpoints WHERE blocked='0' AND userid!='{$winner1}' AND userid!='{$winner2}'" . $queryExclude; } $db->setQuery($query); $listParticipants3 = $db->loadObjectList(); $max3 = count($listParticipants3) - 1; $choice3 = rand(0, $max3); $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(); }