From 8e6c8a6f6d00923fdbfa64cfad799ce642dcda40 Mon Sep 17 00:00:00 2001 From: Mark Hester Date: Sun, 12 Jan 2020 17:24:47 +0000 Subject: [PATCH 01/63] Fix Paypal IPN Link https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSimulator/ --- config/application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.php b/config/application.php index 5daed0b8f..44d2582dd 100644 --- a/config/application.php +++ b/config/application.php @@ -95,7 +95,7 @@ 'MoneyThousandsSymbol' => ',', // (Visual) Thousandths place separator (a period in European currencies). 'MoneyDecimalSymbol' => '.', // (Visual) Decimal separator (a comma in European currencies). 'AcceptDonations' => true, // Whether or not to accept donations. - 'PayPalIpnUrl' => 'www.sandbox.paypal.com',// The URL for PayPal's IPN responses (www.paypal.com for live and www.sandbox.paypal.com for testing) + 'PayPalIpnUrl' => 'ipnpb.sandbox.paypal.com',// The URL for PayPal's IPN responses (ipbn.paypal.com for live and ipnpb.sandbox.paypal.com for testing) 'PayPalBusinessEmail' => 'admin@localhost', // Enter the e-mail under which you have registered your business account. 'PayPalReceiverEmails' => array( // These are the receiver e-mail addresses who are allowed to receive payment. //'admin2@localhost', // -- This array may be empty if you only use one e-mail From 9ececf0869eb5111049c3e6ae46fef9248702538 Mon Sep 17 00:00:00 2001 From: Mark Hester Date: Sun, 12 Jan 2020 18:30:19 +0000 Subject: [PATCH 02/63] Paypal connection for IPN is based on your website SSL --- config/application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.php b/config/application.php index 44d2582dd..c9eb1dafa 100644 --- a/config/application.php +++ b/config/application.php @@ -95,7 +95,7 @@ 'MoneyThousandsSymbol' => ',', // (Visual) Thousandths place separator (a period in European currencies). 'MoneyDecimalSymbol' => '.', // (Visual) Decimal separator (a comma in European currencies). 'AcceptDonations' => true, // Whether or not to accept donations. - 'PayPalIpnUrl' => 'ipnpb.sandbox.paypal.com',// The URL for PayPal's IPN responses (ipbn.paypal.com for live and ipnpb.sandbox.paypal.com for testing) + 'PayPalIpnUrl' => 'www.paypal.com', // The ipnpb.paypal.com and ipnpb.sandbox.paypal.com endpoints only accept HTTPS connections. If you currently use www.paypal.com, you should move to ipnpb.paypal.com when you update your code to use HTTPS. 'PayPalBusinessEmail' => 'admin@localhost', // Enter the e-mail under which you have registered your business account. 'PayPalReceiverEmails' => array( // These are the receiver e-mail addresses who are allowed to receive payment. //'admin2@localhost', // -- This array may be empty if you only use one e-mail From 1937417dd38eafce75ea41f7e7bba559af00a58a Mon Sep 17 00:00:00 2001 From: Mark Hester Date: Sun, 12 Jan 2020 18:33:11 +0000 Subject: [PATCH 03/63] fix indentation --- config/application.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/application.php b/config/application.php index c9eb1dafa..df99fa4a5 100644 --- a/config/application.php +++ b/config/application.php @@ -55,7 +55,7 @@ 'RequireEmailConfirm' => false, // Require e-mail confirmation during registration. 'RequireChangeConfirm' => false, // Require confirmation when changing e-mail addresses. 'EmailConfirmExpire' => 48, // E-mail confirmations expire hours. Unconfirmed accounts will expire after this period of time. - 'PincodeEnabled' => true, // Whether or not the pincode system is enabled in your server. (Check your char_athena.conf file. Enabled by default.) + 'PincodeEnabled' => true, // Whether or not the pincode system is enabled in your server. (Check your char_athena.conf file. Enabled by default.) 'MailerFromAddress' => 'noreply@localhost', // The e-mail address displayed in the From field. 'MailerFromName' => 'MailerName', // The name displayed with the From e-mail address. 'MailerUseSMTP' => false, // Whether or not to use a separate SMTP server for sending mail. @@ -95,7 +95,7 @@ 'MoneyThousandsSymbol' => ',', // (Visual) Thousandths place separator (a period in European currencies). 'MoneyDecimalSymbol' => '.', // (Visual) Decimal separator (a comma in European currencies). 'AcceptDonations' => true, // Whether or not to accept donations. - 'PayPalIpnUrl' => 'www.paypal.com', // The ipnpb.paypal.com and ipnpb.sandbox.paypal.com endpoints only accept HTTPS connections. If you currently use www.paypal.com, you should move to ipnpb.paypal.com when you update your code to use HTTPS. + 'PayPalIpnUrl' => 'www.paypal.com', // The ipnpb.paypal.com and ipnpb.sandbox.paypal.com endpoints only accept HTTPS connections. If you currently use www.paypal.com, you should move to ipnpb.paypal.com when you update your code to use HTTPS. 'PayPalBusinessEmail' => 'admin@localhost', // Enter the e-mail under which you have registered your business account. 'PayPalReceiverEmails' => array( // These are the receiver e-mail addresses who are allowed to receive payment. //'admin2@localhost', // -- This array may be empty if you only use one e-mail From 6eb7f70957b504a426af017d443f9881942e8e71 Mon Sep 17 00:00:00 2001 From: sanasol Date: Wed, 15 Jan 2020 12:22:11 +0300 Subject: [PATCH 04/63] Fix registration error message --- lib/Flux/LoginServer.php | 2 +- lib/Flux/RegisterError.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Flux/LoginServer.php b/lib/Flux/LoginServer.php index 2998710ea..c8e637534 100644 --- a/lib/Flux/LoginServer.php +++ b/lib/Flux/LoginServer.php @@ -110,7 +110,7 @@ public function register($username, $password, $confirmPassword, $email,$email2, throw new Flux_RegisterError('Username is too long', Flux_RegisterError::USERNAME_TOO_LONG); } elseif (!Flux::config('AllowUserInPassword') && stripos($password, $username) !== false) { - throw new Flux_RegisterError('Password contains username', Flux_RegisterError::USERNAME_IN_PASSWORD); + throw new Flux_RegisterError('Password contains username', Flux_RegisterError::PASSWORD_HAS_USERNAME); } elseif (!ctype_graph($password)) { throw new Flux_RegisterError('Invalid character(s) used in password', Flux_RegisterError::INVALID_PASSWORD); diff --git a/lib/Flux/RegisterError.php b/lib/Flux/RegisterError.php index dcf05974a..b521ec499 100644 --- a/lib/Flux/RegisterError.php +++ b/lib/Flux/RegisterError.php @@ -5,7 +5,6 @@ class Flux_RegisterError extends Flux_Error { const USERNAME_ALREADY_TAKEN = 0; const USERNAME_TOO_SHORT = 1; const USERNAME_TOO_LONG = 2; - const USERNAME_IN_PASSWORD = 3; const PASSWORD_TOO_SHORT = 4; const PASSWORD_TOO_LONG = 5; const PASSWORD_MISMATCH = 6; From 5007e776bd4f345efff93f627dbe595c0ee945b6 Mon Sep 17 00:00:00 2001 From: sanasol Date: Thu, 7 May 2020 11:14:26 +0300 Subject: [PATCH 05/63] fix MVP ranking --- modules/ranking/mvp.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/modules/ranking/mvp.php b/modules/ranking/mvp.php index 85f2caaf4..c04dccab1 100644 --- a/modules/ranking/mvp.php +++ b/modules/ranking/mvp.php @@ -28,15 +28,18 @@ $sth->execute($sql_params); $killer_char_ids = $sth->fetchAll(PDO::FETCH_COLUMN, 0); -// Get group id of the killer and filter -_- -$groups = AccountLevel::getGroupID((int)Flux::config('RankingHideGroupLevel'), '<'); -$sql = "SELECT `char`.`char_id` FROM {$server->charMapDatabase}.`char`"; -$sql .= " LEFT JOIN {$server->loginDatabase}.`login` ON `char`.`account_id` = `login`.`account_id`"; -$sql .= " WHERE `char`.`char_id`IN(".implode(',',array_fill(0, count($killer_char_ids), '?')).") AND `login`.`group_id` NOT IN (".implode(',',array_fill(0, count($groups), '?')).")"; -$sql_params = array_merge($killer_char_ids, $groups); -$sth = $server->connection->getStatement($sql); -$sth->execute($sql_params); -$char_ids_filter = $sth->fetchAll(PDO::FETCH_COLUMN, 0); +$char_ids_filter = []; +if(count($killer_char_ids)) { + // Get group id of the killer and filter -_- + $groups = AccountLevel::getGroupID((int)Flux::config('RankingHideGroupLevel'), '<'); + $sql = "SELECT `char`.`char_id` FROM {$server->charMapDatabase}.`char`"; + $sql .= " LEFT JOIN {$server->loginDatabase}.`login` ON `char`.`account_id` = `login`.`account_id`"; + $sql .= " WHERE `char`.`char_id`IN(".implode(',',array_fill(0, count($killer_char_ids), '?')).") AND `login`.`group_id` NOT IN (".implode(',',array_fill(0, count($groups), '?')).")"; + $sql_params = array_merge($killer_char_ids, $groups); + $sth = $server->connection->getStatement($sql); + $sth->execute($sql_params); + $char_ids_filter = $sth->fetchAll(PDO::FETCH_COLUMN, 0); +} $bind = array(); $col = "id, iName, Sprite"; @@ -54,7 +57,7 @@ $col = "mlog.kill_char_id, mlog.monster_id, count(*) AS count "; $sql = "SELECT $col FROM {$server->logsDatabase}.`mvplog` AS mlog "; $sql.= "WHERE mlog.monster_id = ? "; - if ($char_ids_filter) { + if (count($char_ids_filter)) { $sql .= " AND `kill_char_id` NOT IN(".implode(',',array_fill(0, count($char_ids_filter), '?')).")"; } $sql.= "GROUP BY mlog.kill_char_id ORDER BY count DESC LIMIT $limit"; @@ -71,7 +74,7 @@ // Latest x Kills $col = "mlog.mvp_id, mlog.mvp_date, mlog.kill_char_id, mlog.monster_id, mlog.mvpexp, mlog.map "; $sql = "SELECT $col FROM {$server->logsDatabase}.`mvplog` AS mlog "; - if ($char_ids_filter) { + if (count($char_ids_filter)) { $sql .= " WHERE `kill_char_id` NOT IN(".implode(',',array_fill(0, count($char_ids_filter), '?')).")"; } $sql.= "ORDER BY mlog.mvp_date DESC LIMIT $limit"; From 1381f0f4471c3ca2047a9365e37d386a1795905d Mon Sep 17 00:00:00 2001 From: Akkarinage Date: Thu, 10 Dec 2020 18:27:32 +0000 Subject: [PATCH 06/63] Updated .gitignore to ignore changed states for custom themes in /themes/ which fixes #272 (#273) --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index c8ecfd748..14fd2d2b6 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,10 @@ # Caches /data/tmp/*.php /data/tmp/*.cache +/data/tmp/emblems + +# Non-Default Themes +/themes/* +!/themes/default +!/themes/bootstrap +!/themes/installer From 98895759b64533dc122c73ec845ff612aaf60d2f Mon Sep 17 00:00:00 2001 From: Akkarinage Date: Fri, 2 Apr 2021 12:54:41 +0100 Subject: [PATCH 07/63] Discord webhook requires Content-Type to be set in cURL options (#280) Fixes #254 --- lib/functions/discordwebhook.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/functions/discordwebhook.php b/lib/functions/discordwebhook.php index 91e2acd03..622bb1761 100644 --- a/lib/functions/discordwebhook.php +++ b/lib/functions/discordwebhook.php @@ -7,6 +7,7 @@ function sendtodiscord($url, $message) { $data = array("content" => $message); $curl = curl_init($url); + curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json')); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); From 3a96b24c455954924139774a76e17156be1233d2 Mon Sep 17 00:00:00 2001 From: Akkarinage Date: Fri, 2 Apr 2021 13:19:51 +0100 Subject: [PATCH 08/63] Updated TinyMCE to version 5 and fixes #274 --- config/application.php | 2 ++ modules/news/add.php | 2 ++ modules/news/edit.php | 2 ++ modules/pages/add.php | 2 ++ modules/pages/edit.php | 2 ++ themes/default/news/add.php | 4 ++-- themes/default/news/edit.php | 4 ++-- themes/default/pages/add.php | 4 ++-- themes/default/pages/edit.php | 4 ++-- 9 files changed, 18 insertions(+), 8 deletions(-) diff --git a/config/application.php b/config/application.php index df99fa4a5..291879db3 100644 --- a/config/application.php +++ b/config/application.php @@ -224,6 +224,8 @@ 'DiscordSendOnWebCommand' => true, 'DiscordSendOnMarketing' => true, + 'TinyMCEKey' => 'no-key', // Register for a key at https://www.tiny.cloud/my-account/dashboard/ + // These are the main menu items that should be displayed by themes. // They route to modules and actions. Whether they are displayed or // not at any given time depends on the user's account group level and/or diff --git a/modules/news/add.php b/modules/news/add.php index 755e9605f..b04f30c6f 100644 --- a/modules/news/add.php +++ b/modules/news/add.php @@ -9,6 +9,8 @@ $link = trim($params->get('news_link')); $author = trim($params->get('news_author')); +$tinymce_key = Flux::config('TinyMCEKey'); + if(count($_POST)){ if($title === '') { $errorMessage = Flux::Message('CMSNewsTitleError'); diff --git a/modules/news/edit.php b/modules/news/edit.php index 090967773..c1a3f35fe 100644 --- a/modules/news/edit.php +++ b/modules/news/edit.php @@ -8,6 +8,8 @@ $sth->execute(array($id)); $new = $sth->fetch(); +$tinymce_key = Flux::config('TinyMCEKey'); + if($new) { $title = $new->title; $body = $new->body; diff --git a/modules/pages/add.php b/modules/pages/add.php index 374d944a7..2b82efe17 100644 --- a/modules/pages/add.php +++ b/modules/pages/add.php @@ -8,6 +8,8 @@ $path = trim($params->get('page_path')); $body = trim($params->get('page_body')); +$tinymce_key = Flux::config('TinyMCEKey'); + if(count($_POST)) { if($page_title === '') { diff --git a/modules/pages/edit.php b/modules/pages/edit.php index 60e80f40e..0760d3100 100644 --- a/modules/pages/edit.php +++ b/modules/pages/edit.php @@ -9,6 +9,8 @@ $sth->execute(array($id)); $page = $sth->fetch(); +$tinymce_key = Flux::config('TinyMCEKey'); + if($page) { $title = $page->title; $path = $page->path; diff --git a/themes/default/news/add.php b/themes/default/news/add.php index 02da30058..d8e5131d4 100644 --- a/themes/default/news/add.php +++ b/themes/default/news/add.php @@ -2,14 +2,14 @@ if (!defined('FLUX_ROOT')) exit; $this->loginRequired(); ?> - + + + + - + diff --git a/themes/installer/header.php b/themes/installer/header.php index 018f14408..aca44a7bd 100644 --- a/themes/installer/header.php +++ b/themes/installer/header.php @@ -6,7 +6,7 @@ FluxCP: Install & Update - + - + - + - + - - diff --git a/themes/bootstrap/header.php b/themes/bootstrap/header.php index a27d50da0..cedc4b460 100644 --- a/themes/bootstrap/header.php +++ b/themes/bootstrap/header.php @@ -21,7 +21,7 @@ + @@ -32,34 +32,27 @@ - + themePath('main/navbar.php', true) ?> - -
+ + + +

Please change your ServerAddress directive in your application config to your server's real address (e.g., myserver.com).

+ + + getMessage()): ?> +

+ + + themePath('main/submenu.php', true) ?> - + + themePath('main/pagemenu.php', true) ?> - - - -

Please change your ServerAddress directive in your application config to your server's real address (e.g., myserver.com).

- - - - getMessage()): ?> -

- - - - themePath('main/submenu.php', true) ?> - - - themePath('main/pagemenu.php', true) ?> - - - get('module'), array('donate', 'purchase'))) include 'main/balance.php' ?> + + get('module'), array('donate', 'purchase'))) include 'main/balance.php' ?> diff --git a/themes/bootstrap/js/flux.datefields.js b/themes/bootstrap/js/flux.datefields.js deleted file mode 100644 index 5af11baff..000000000 --- a/themes/bootstrap/js/flux.datefields.js +++ /dev/null @@ -1,48 +0,0 @@ -function processDateFields(){ - var dateFields = new Array(); - var dateName; - var dateCheckBox; - var dateSelects; - var dateSelects2; - - $(':checkbox').filter(function(){ - return /^use_/.test($(this).attr('id')); - }).each(function(){ - dateFields[dateFields.length] = this.id.substr('use_'.length); - }); - - for (var i = 0; i < dateFields.length; ++i) { - dateName = dateFields[i]; - dateCheckBox = $('#use_'+dateName); - dateSelects = $('select[name='+dateName+'_year],select[name='+dateName+'_month],select[name='+dateName+'_day]'); - dateSelects2 = $('select[name='+dateName+'_hour],select[name='+dateName+'_minute],select[name='+dateName+'_second]'); - - processDateInit(dateCheckBox, dateSelects, dateSelects2); - processDateBoxes(dateCheckBox, dateSelects, dateSelects2); - } -} - -function processDateInit(dateCheckBox, dateSelects, dateSelects2){ - if ($(dateCheckBox).attr('checked')) { - dateEnable(dateSelects); - dateEnable(dateSelects2); - } - else { - dateDisable(dateSelects); - dateDisable(dateSelects2); - } -} - -function processDateBoxes(dateCheckBox, dateSelects, dateSelects2){ - $(dateCheckBox).click(function(){ - processDateInit(dateCheckBox, dateSelects, dateSelects2); - }); -} - -function dateEnable(sel){ - sel.attr('disabled', false); -} - -function dateDisable(sel){ - sel.attr('disabled', 'disabled'); -} diff --git a/themes/bootstrap/js/flux.unitip.js b/themes/bootstrap/js/flux.unitip.js deleted file mode 100644 index 6e02ef0e0..000000000 --- a/themes/bootstrap/js/flux.unitip.js +++ /dev/null @@ -1,223 +0,0 @@ -// uniTip - written by Nathan Ford for Unit Interactive -// -// uniTip is based on qTip: -// qTip - CSS Tool Tips - by Craig Erskine -// http://qrayg.com - -var uniTipTag = "*"; //Which tag do you want to uniTip-ize? Keep it lowercase. No spaces around commas.// -var uniTipClass = ""; //Which classes do you want to uniTip-ize? If you leave this blank, then all the tags designated above will get uniTip-ized. Match case. No spaces around commas. - -var uniTipX = 0; // X offset from cursor// -var uniTipY = 15; // Y offset from cursor// - -//______________________________________________There's no need to edit anything below this line// - -var offsetX = uniTipX, offsetY = uniTipY, elewidth = null, eleheight = null, tipid = null, tiptop = null, tipbot = null, tipcapin=null, tippointin=null, altText=false; - -var x=0, y=0, WinWidth=0, WinHeight=0, TipWidth=0, TipHeight=0, CapHeight=0, PointHeight=0; - -// first, find all the correct elements -init = function () { - var elementList = uniTipTag.split(","); - for(var j = 0; j < elementList.length; j++) { - var elements = document.getElementsByTagName(elementList[j]); - - if(elements) { - for (var i = 0; i < elements.length; i ++) { - if (uniTipClass != '') { - - var elClass = elements[i].className; - var elClassList = uniTipClass.split(","); - - for (var h=0; h < elClassList.length; h++) { if (elClass.match(elClassList[h])) unitipize(elements[i]); } - - } else unitipize(elements[i]); - } - } - } -} - -// next, add the tooltip function to those elements -unitipize = function (element) { - var a = element; - var id = a.getAttribute('id'); - - if (id != null && id.indexOf('recaptcha_') == 0) { - return; - } - - //altText = (a.alt && a.getAttribute("alt") != '' ) ? true : false; - //var sTitle = (altText == true) ? a.getAttribute("alt") : a.getAttribute("title"); - var sTitle = a.getAttribute('title'); - if(sTitle) { - a.onmouseover = function() {build(a, sTitle);}; - a.onmouseout = function() {hide(a, sTitle);}; - } -} - -// now, we build the tooltip -build = function (a, sTitle) { - - if (a.title) a.title = ""; - if (altText==true) a.alt = ""; - - var tipContainer = document.createElement("div"); - tipContainer.setAttribute("id", "unitip"); - document.body.appendChild(tipContainer); - - var tipContainerTop = document.createElement("div"); - tipContainerTop.setAttribute("id", "unitippoint"); - tipContainer.appendChild(tipContainerTop); - - var tipContainerMid = document.createElement("div"); - tipContainerMid.setAttribute("id", "unitipmid"); - tipContainer.appendChild(tipContainerMid); - - var tipContainerBot = document.createElement("div"); - tipContainerBot.setAttribute("id", "unitipcap"); - tipContainer.appendChild(tipContainerBot); - - tipid = document.getElementById("unitip"); - tippoint = document.getElementById("unitippoint"); - tipmid = document.getElementById("unitipmid"); - tipcap = document.getElementById("unitipcap"); - - document.getElementById("unitipmid").innerHTML = sTitle; - tipid.style.display = "block"; - - elewidth = document.getElementById("unitipmid").offsetWidth; - eleheight = document.getElementById("unitip").offsetHeight; - - WinWidth = document.body.offsetWidth; - WinHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight; - - CapHeight = document.getElementById('unitipcap').offsetHeight; - PointHeight = document.getElementById('unitippoint').offsetHeight; - - if (typeof pngfix=="function") { // if IE, rebuilds wraps unitippoint and unitipcap in outer div - if (tippoint.currentStyle.backgroundImage.match(/\.png/gi)) { - var tipP = tippoint.innerHTML; - - tippoint.id = 'unitipP'; // switch unitippoint to outer div - - tippoint.style.overflow = "hidden"; - tippoint.style.height = PointHeight + "px"; - tippoint.style.width = elewidth + "px"; - tippoint.style.position = "relative"; - tippoint.style.display = "block"; - - tippoint.innerHTML = '
' + tipP + '
'; // inject unitippoint - - tippointin = document.getElementById("unitippoint"); // redefine styles for unitippoint to fit filter image - tippointin.style.width = (elewidth * 2) + "px"; - tippointin.style.height = (PointHeight * 2) + "px"; - tippointin.style.backgroundImage = tippoint.style.backgroundImage; - tippointin.style.position = "absolute"; - - tippoint.style.backgroundImage = "none"; - } - if (tipcap.currentStyle.backgroundImage.match(/\.png/gi)) { - var tipC = tipcap.innerHTML; - - tipcap.id = 'unitipC'; - - tipcap.style.overflow = "hidden"; - tipcap.style.height = CapHeight + "px"; - tipcap.style.width = elewidth + "px"; - tipcap.style.position = "relative"; - tipcap.style.display = "block"; - - tipcap.innerHTML = '
' + tipP + '
'; - - tipcapin = document.getElementById("unitipcap"); - tipcapin.style.height = (CapHeight * 2) + "px"; - tipcapin.style.backgroundImage = tipcap.style.backgroundImage; - tipcapin.style.position = "absolute"; - - tipcap.style.backgroundImage = "none"; - } - - pngfix(); // png fix - - } - - document.onmousemove = function (evt) {move (evt)}; -} - -// now, we track the mouse and make the tooltip follow -move = function (evt) { - - if (window.event) { - x = window.event.clientX; - y = window.event.clientY; - - if (document.documentElement.scrollLeft) tipid.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + document.documentElement.scrollLeft) + "px" : (x + offsetX + document.documentElement.scrollLeft) + "px"; - else tipid.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + document.body.scrollLeft) + "px" : (x + offsetX + document.body.scrollLeft) + "px"; - - if (document.documentElement.scrollTop) tipid.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + document.documentElement.scrollTop) + "px" : (y + offsetY + document.documentElement.scrollTop) + "px"; - else tipid.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + document.body.scrollTop) + "px" : (y + offsetY + document.body.scrollTop) + "px"; - - } else { - x = evt.clientX; - y = evt.clientY; - - tipid.style.left = (TipWidth >= WinWidth ) ? ((x - offsetX - elewidth) + window.scrollX) + "px" : (x + offsetX + window.scrollX) + "px"; - tipid.style.top = (TipHeight >= WinHeight) ? ((y - offsetY - eleheight) + window.scrollY) + "px" : (y + offsetY + window.scrollY) + "px"; - } - - TipWidth = x + elewidth + 20; - TipHeight = y + eleheight + 20; - - if (TipHeight >= WinHeight ) { // rearrange the inner divs [123 to 321] - tipid.removeChild(tippoint); - tipid.removeChild(tipmid); - tipid.removeChild(tipcap); - tipid.appendChild(tipcap); - tipid.appendChild(tipmid); - tipid.appendChild(tippoint); - } else { // rearrange the inner divs [321 to 123] - tipid.removeChild(tippoint); - tipid.removeChild(tipmid); - tipid.removeChild(tipcap); - tipid.appendChild(tippoint); - tipid.appendChild(tipmid); - tipid.appendChild(tipcap); - } - - if (TipHeight >= WinHeight) { - - if (document.getElementById('uniTipP')) { - tippointin.style.left = (TipWidth >= WinWidth ) ? "-" + elewidth + "px" : "0px"; - tippointin.style.top = "-" + PointHeight + "px"; - } else tippoint.style.backgroundPosition = (TipWidth >= WinWidth ) ? "right bottom" : "left bottom"; - - if (document.getElementById('uniTipC')) tipcapin.style.top = "-" + CapHeight + "px"; - else tipcap.style.backgroundPosition = "0 -" + CapHeight + "px"; - - } else { - - if (document.getElementById('uniTipP')) { - tippointin.style.left = (TipWidth >= WinWidth ) ? "-" + elewidth + "px" : "0px"; - tippointin.style.top = "0px"; - } else tippoint.style.backgroundPosition = (TipWidth >= WinWidth ) ? "right top" : "left top"; - - if (document.getElementById('uniTipC')) tipcapin.style.top = "0px"; - else tipcap.style.backgroundPosition = "0 0"; - - } -} - -// lastly, hide the tooltip -hide = function (a, sTitle) { - document.getElementById("unitipmid").innerHTML = ""; - document.onmousemove = ''; - document.body.removeChild(tipid); - tipid.style.display = "none"; - if (altText==false) a.setAttribute("title", sTitle); - else a.setAttribute("alt", sTitle); - altText=false; -} - -// add the event to the page -if (window.addEventListener) window.addEventListener("load", init, false); -if (window.attachEvent) window.attachEvent("onload", init); diff --git a/themes/bootstrap/js/flux.unitpngfix.js b/themes/bootstrap/js/flux.unitpngfix.js deleted file mode 100644 index 227e71a70..000000000 --- a/themes/bootstrap/js/flux.unitpngfix.js +++ /dev/null @@ -1,4 +0,0 @@ -var clear="img/clear.gif" //path to clear.gif - -pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}} -window.attachEvent('onload',pngfix); From 2461c8512cb69e6ca32741ffdd04fc899694a09d Mon Sep 17 00:00:00 2001 From: GodKnows Jhomz <31880196+GodKnowsJhomz@users.noreply.github.com> Date: Fri, 9 Jun 2023 01:18:51 +0800 Subject: [PATCH 50/63] Fixing Deprecated preg_split for PHP 8.1 Fixing Deprecated preg_split for PHP 8.1 --- lib/Flux/Template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Flux/Template.php b/lib/Flux/Template.php index 93bd6afbe..aa1837dec 100644 --- a/lib/Flux/Template.php +++ b/lib/Flux/Template.php @@ -1184,7 +1184,7 @@ public function linkToItem($itemID, $text, $server = null) */ public function displayScript($scriptText) { - $lines = preg_split('/(\r?\n)/', $scriptText, -1); + $lines = !empty($scriptText) ? preg_split('/\s+|<|>|\[|\]/', $scriptText, -1, PREG_SPLIT_NO_EMPTY) : []; $text = ''; $script = array(); From f05f2d19d9eff394ec431d726078d0a46b38d345 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Fri, 9 Jun 2023 00:36:54 +0700 Subject: [PATCH 51/63] Separate Security Code check from SessionData::login (#196) * Separate Security Code check from SessionData::login * Moved into self function as usage `$session->checkSecurityCode($code, flag)` so can be used in little workaround for other form usage * A little clean up in checkSecurityCode --- lib/Flux/SessionData.php | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/lib/Flux/SessionData.php b/lib/Flux/SessionData.php index 34a67bb70..62701a6db 100644 --- a/lib/Flux/SessionData.php +++ b/lib/Flux/SessionData.php @@ -243,6 +243,31 @@ public function isLoggedIn() return $this->account->group_level >= AccountLevel::NORMAL; } + /** + * Check securityCode from user with $this->securityCode or reCaptcha + * @param $securityCode Code from user + * @param $recaptcha True if check using recaptcha + * @return true on success and false on failure + */ + public function checkSecurityCode($securityCode, $recaptcha = false) { + if ($recaptcha) { + if (Flux::config('ReCaptchaPrivateKey') && Flux::config('ReCaptchaPublicKey')) { + $responseKeys = array(); + if (isset($_POST['g-recaptcha-response']) && $_POST['g-recaptcha-response'] != "") { + $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".Flux::config('ReCaptchaPrivateKey')."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']); + $responseKeys = json_decode($response,true); + } + if (count($responseKeys) && intval($responseKeys["success"]) == 1) { + return true; + } + } + } + else if ($securityCode && !empty($securityCode) && strtolower($securityCode) == strtolower($this->securityCode)) { + return true; + } + return false; + } + /** * User login. * @@ -263,19 +288,8 @@ public function login($server, $username, $password, $securityCode = null) throw new Flux_LoginError('IP address is banned', Flux_LoginError::IPBANNED); } - if ($securityCode !== false && Flux::config('UseLoginCaptcha')) { - if (strtolower($securityCode) != strtolower($this->securityCode)) { - throw new Flux_LoginError('Invalid security code', Flux_LoginError::INVALID_SECURITY_CODE); - } - elseif (Flux::config('EnableReCaptcha')) { - if(isset($_POST['g-recaptcha-response']) && $_POST['g-recaptcha-response'] != ""){ - $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".Flux::config('ReCaptchaPrivateKey')."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']); - } - $responseKeys = json_decode($response,true); - if(intval($responseKeys["success"]) !== 1) { - throw new Flux_LoginError('Invalid security code', Flux_LoginError::INVALID_SECURITY_CODE); - } - } + if (Flux::config('UseLoginCaptcha') && !self::checkSecurityCode($securityCode, Flux::config('EnableReCaptcha'))) { + throw new Flux_LoginError('Invalid security code', Flux_LoginError::INVALID_SECURITY_CODE); } if (!$loginAthenaGroup->isAuth($username, $password)) { From f8f8bbc0cbb5f520d6ee07685fd69c3dd8eb3ccd Mon Sep 17 00:00:00 2001 From: Akkarinage Date: Fri, 9 Jun 2023 08:22:42 +0100 Subject: [PATCH 52/63] Given GMs the ability to change Credit value in SD Ticket (#360) --- modules/servicedesk/staffview.php | 79 ++++++++++++------------ themes/default/servicedesk/staffview.php | 19 +++--- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/modules/servicedesk/staffview.php b/modules/servicedesk/staffview.php index ace879da2..8e1819843 100644 --- a/modules/servicedesk/staffview.php +++ b/modules/servicedesk/staffview.php @@ -2,9 +2,9 @@ if (!defined('FLUX_ROOT')) exit; $this->loginRequired(); $ticket_id = trim($params->get('ticketid')); -$tbl = Flux::config('FluxTables.ServiceDeskTable'); -$tbla = Flux::config('FluxTables.ServiceDeskATable'); -$tblsettings = Flux::config('FluxTables.ServiceDeskSettingsTable'); +$tbl = Flux::config('FluxTables.ServiceDeskTable'); +$tbla = Flux::config('FluxTables.ServiceDeskATable'); +$tblsettings = Flux::config('FluxTables.ServiceDeskSettingsTable'); $sth = $server->connection->getStatement("SELECT * FROM {$server->loginDatabase}.$tblsettings WHERE account_id = ?"); $sth->execute(array($session->account->account_id)); @@ -32,9 +32,9 @@ $sql = "INSERT INTO {$server->loginDatabase}.$tbla (ticket_id, author, text, action, ip, isstaff)"; $sql .= "VALUES (?, ?, ?, 0, ?, 1)"; $sth = $server->connection->getStatement($sql); - $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $_SERVER['REMOTE_ADDR'])); + $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $_SERVER['REMOTE_ADDR'])); $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET lastreply = 'Staff' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); + $sth->execute(array($ticket_id)); require_once 'Flux/Mailer.php'; $name = $session->loginAthenaGroup->serverName; $mail = new Flux_Mailer(); @@ -43,12 +43,12 @@ 'Staff' => $staffsess->prefered_name )); if ($sent) { - $this->redirect($this->url('servicedesk','staffview', array('ticketid' => $ticket_id))); + $this->redirect($this->url('servicedesk','staffview', array('ticketid' => $ticket_id))); } else { $fail = true; } - + }elseif($_POST['secact']=='2'){ if($_POST['response']=='Leave as-is to skip text response.' || $_POST['response'] == '' || $_POST['response'] == NULL || !isset($_POST['response'])){ $text = '0'; @@ -58,7 +58,7 @@ $sql = "INSERT INTO {$server->loginDatabase}.$tbla (ticket_id, author, text, action, ip, isstaff)"; $sql .= "VALUES (?, ?, ?, 0, ?, 1)"; $sth = $server->connection->getStatement($sql); - $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $_SERVER['REMOTE_ADDR'])); + $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $_SERVER['REMOTE_ADDR'])); require_once 'Flux/Mailer.php'; $name = $session->loginAthenaGroup->serverName; $mail = new Flux_Mailer(); @@ -67,24 +67,24 @@ 'Staff' => $staffsess->prefered_name )); $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET lastreply = 'Staff' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); + $sth->execute(array($ticket_id)); $this->redirect($this->url('servicedesk','staffindex')); - + }elseif($_POST['secact']=='3'){ $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET status = 'Resolved' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); - + $sth->execute(array($ticket_id)); + if($_POST['response']=='Leave as-is to skip text response.' || $_POST['response'] == '' || $_POST['response'] == NULL || !isset($_POST['response'])){ $text = '0'; } else { $text = htmlentities($_POST['response']); } $action='Ticket Resolved'; - + $sql = "INSERT INTO {$server->loginDatabase}.$tbla (ticket_id, author, text, action, ip, isstaff)"; $sql .= "VALUES (?, ?, ?, ?, ?, 1)"; $sth = $server->connection->getStatement($sql); - $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); + $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); require_once 'Flux/Mailer.php'; $name = $session->loginAthenaGroup->serverName; $mail = new Flux_Mailer(); @@ -93,9 +93,9 @@ 'Staff' => $staffsess->prefered_name )); $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET lastreply = 'Staff' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); + $sth->execute(array($ticket_id)); $this->redirect($this->url('servicedesk','staffindex')); - + }elseif($_POST['secact']=='4'){ if($staffsess->team=='1'){ $escalateto=2; @@ -104,7 +104,7 @@ $escalateto=3; } $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET team = ? WHERE ticket_id = ?"); - $sth->execute(array($escalateto, $ticket_id)); + $sth->execute(array($escalateto, $ticket_id)); if($_POST['response']=='Leave as-is to skip text response.' || $_POST['response'] == '' || $_POST['response'] == NULL || !isset($_POST['response'])){ $text = '0'; @@ -115,14 +115,14 @@ $sql = "INSERT INTO {$server->loginDatabase}.$tbla (ticket_id, author, text, action, ip, isstaff)"; $sql .= "VALUES (?, ?, ?, ?, ?, 1)"; $sth = $server->connection->getStatement($sql); - $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); + $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET lastreply = 'Staff' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); + $sth->execute(array($ticket_id)); $this->redirect($this->url('servicedesk','staffindex')); }elseif($_POST['secact']=='5'){ $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET status = 'Closed' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); + $sth->execute(array($ticket_id)); if($_POST['response']=='Leave as-is to skip text response.' || $_POST['response'] == '' || $_POST['response'] == NULL || !isset($_POST['response'])){ $text = '0'; } else { @@ -132,22 +132,22 @@ $sql = "INSERT INTO {$server->loginDatabase}.$tbla (ticket_id, author, text, action, ip, isstaff)"; $sql .= "VALUES (?, ?, ?, ?, ?, 1)"; $sth = $server->connection->getStatement($sql); - $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); + $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET lastreply = 'Staff' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); + $sth->execute(array($ticket_id)); $this->redirect($this->url('servicedesk','staffindex')); - + }elseif($_POST['secact']=='6'){ $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET status = 'Pending' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); - + $sth->execute(array($ticket_id)); + if($_POST['response']=='Leave as-is to skip text response.' || $_POST['response'] == '' || $_POST['response'] == NULL || !isset($_POST['response'])){ $text = '0'; } else { $text = htmlentities($_POST['response']); } $action='Ticket Re-Opened by a member of the '. Flux::message('SDGroup'. $staffsess->team) .' group.'; - + $sql = "INSERT INTO {$server->loginDatabase}.$tbla (ticket_id, author, text, action, ip, isstaff)"; $sql .= "VALUES (?, ?, ?, ?, ?, 1)"; $sth = $server->connection->getStatement($sql); @@ -160,25 +160,26 @@ 'Staff' => $staffsess->prefered_name )); $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET lastreply = 'Staff' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); + $sth->execute(array($ticket_id)); $this->redirect($this->url('servicedesk','staffindex')); - + }elseif($_POST['secact']=='7'){ $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET status = 'Resolved' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); - + $sth->execute(array($ticket_id)); + $give_credits = intval($_POST['award_credits']); + if($_POST['response']=='Leave as-is to skip text response.' || $_POST['response'] == '' || $_POST['response'] == NULL || !isset($_POST['response'])){ $text = '0'; } else { $text = htmlentities($_POST['response']); } - $action = sprintf('Ticket Resolved, %d Credits Awarded.', Flux::config('SDCreditReward')); - + $action = sprintf('Ticket Resolved, %d Credits Awarded.', $give_credits); + $sql = "INSERT INTO {$server->loginDatabase}.$tbla (ticket_id, author, text, action, ip, isstaff)"; $sql .= "VALUES (?, ?, ?, ?, ?, 1)"; $sth = $server->connection->getStatement($sql); - $res = $server->loginServer->depositCredits($_POST['account_id'], Flux::config('SDCreditReward')); - $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); + $res = $server->loginServer->depositCredits($_POST['account_id'], $give_credits); + $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); require_once 'Flux/Mailer.php'; $name = $session->loginAthenaGroup->serverName; $mail = new Flux_Mailer(); @@ -187,15 +188,13 @@ 'Staff' => $staffsess->prefered_name )); $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.$tbl SET lastreply = 'Staff' WHERE ticket_id = ?"); - $sth->execute(array($ticket_id)); + $sth->execute(array($ticket_id)); $this->redirect($this->url('servicedesk','staffindex')); } } - - -$tbl = Flux::config('FluxTables.ServiceDeskTable'); -$tbla = Flux::config('FluxTables.ServiceDeskATable'); +$tbl = Flux::config('FluxTables.ServiceDeskTable'); +$tbla = Flux::config('FluxTables.ServiceDeskATable'); $sql = "SELECT * FROM {$server->loginDatabase}.$tbl WHERE ticket_id = $ticket_id"; $rep = $server->connection->getStatement($sql); $rep->execute(); @@ -226,7 +225,7 @@ $repr->execute(); $replylist = $repr->fetchAll(); -$tblc = Flux::config('FluxTables.ServiceDeskCatTable'); +$tblc = Flux::config('FluxTables.ServiceDeskCatTable'); $sth = $server->connection->getStatement("SELECT name FROM {$server->loginDatabase}.$tblc WHERE cat_id = ?"); $sth->execute(array($trow->category)); $ticketlist = $sth->fetchAll(); diff --git a/themes/default/servicedesk/staffview.php b/themes/default/servicedesk/staffview.php index d479d960f..ee598c6e0 100644 --- a/themes/default/servicedesk/staffview.php +++ b/themes/default/servicedesk/staffview.php @@ -1,10 +1,10 @@ loginRequired(); +$this->loginRequired(); ?>

ticket_id) ?> - subject) ?> - Staff Area

- +
@@ -62,10 +62,10 @@
Account

- + - +
@@ -80,7 +80,7 @@ - + action!='0'): ?> @@ -96,7 +96,7 @@
Reply ByResponse text)) ?>

- +
@@ -108,7 +108,7 @@ status!='Resolved' || $trow->status!='Closed'): ?> -
There are no replies to this ticket.
+
@@ -122,7 +122,7 @@ - + team<3): ?> @@ -152,8 +152,7 @@
Response
:
:
:
:
:
- - +

From 9a63c58f21908830d09b9044dcc6b56535dad1e5 Mon Sep 17 00:00:00 2001 From: Akkarinage Date: Fri, 9 Jun 2023 08:23:19 +0100 Subject: [PATCH 53/63] Display query error in debug mode if no items found (#361) --- themes/default/item/index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/themes/default/item/index.php b/themes/default/item/index.php index c72891fae..c0cde9762 100644 --- a/themes/default/item/index.php +++ b/themes/default/item/index.php @@ -231,5 +231,9 @@ getHTML() ?> -

No items found. Go back.

+

No items found. Go back.

+ + errorInfo(), true)); ?> + + From 99b0c437c24ea05980b7a9a6bc6c5ed736bf7a82 Mon Sep 17 00:00:00 2001 From: Akkarinage Date: Sun, 9 Jul 2023 11:40:08 +0100 Subject: [PATCH 54/63] Updated Web Commands NPC so it doesn't only run once (#363) --- data/npc/web_commands.txt | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/data/npc/web_commands.txt b/data/npc/web_commands.txt index 990b0d3fc..9493394ce 100644 --- a/data/npc/web_commands.txt +++ b/data/npc/web_commands.txt @@ -8,24 +8,26 @@ //= commands every 2 seconds. //===== Additional Comments: ================================= //= 1.0 First Version. +//= 1.1 Fixed code to prevent single-run senarios. //============================================================ - script Commands -1,{ OnInit: start: -initnpctimer; -end; + initnpctimer; + end; + OnTimer2000: -set $@nb2,query_sql("SELECT COUNT(*) FROM cp_commands WHERE done=0",$@count); -if($@count != 0) { - set $@nb,query_sql("SELECT command,id,account_id FROM cp_commands WHERE done=0",$@command$,$@id,$@account_id); - if(compare($@command$,"@")) { - attachrid($@account_id[0]); - atcommand $@command$[0]; - } else charcommand $@command$[0]; - query_sql("UPDATE cp_commands SET done='1' WHERE command='"+$@command$[0]+"' AND id='"+$@id[0]+"'"); -} else -finish: -stopnpctimer; -goto start; -} \ No newline at end of file + .@nb2 = query_sql("SELECT COUNT(*) FROM cp_commands WHERE done=0",.@count); + if(.@count != 0) { + .@nb = query_sql("SELECT command,id,account_id FROM cp_commands WHERE done=0 ORDER BY id LIMIT 1",.@command$,.@id,.@account_id); + if(compare(.@command$,"@")) { + attachrid(.@account_id[0]); + atcommand .@command$[0]; + } else charcommand .@command$[0]; + query_sql("UPDATE cp_commands SET done='1' WHERE command='"+.@command$[0]+"' AND id='"+.@id[0]+"'"); + .@nb = 0; .@nb2 = 0; .@count = 0; .@command$ = 0; .@id = 0; .@account_id = 0; + } + stopnpctimer; + goto start; +} From a2a068a28fa2e95caad853276650b62f36f66f6a Mon Sep 17 00:00:00 2001 From: Balfear Date: Fri, 10 Nov 2023 01:51:13 +0300 Subject: [PATCH 55/63] Update for Web Server (#328) * Update for Web Server Added configs for webserver. "EmblemUseWebservice" was removed from modules. * Added support for animated gif --- config/servers.php | 8 ++++ lib/Flux.php | 6 ++- lib/Flux/Athena.php | 9 ++++ lib/Flux/Connection.php | 63 ++++++++++++++++++++++++++- lib/Flux/LoginAthenaGroup.php | 9 ++++ lib/Flux/LoginServer.php | 9 ++++ modules/account/view.php | 6 --- modules/castle/index.php | 8 +--- modules/character/index.php | 8 +--- modules/character/online.php | 8 +--- modules/character/view.php | 22 ++-------- modules/guild/emblem.php | 22 +++++----- modules/guild/index.php | 8 +--- modules/guild/view.php | 8 +--- modules/ranking/alchemist.php | 8 +--- modules/ranking/blacksmith.php | 8 +--- modules/ranking/character.php | 8 +--- modules/ranking/death.php | 8 +--- modules/ranking/guild.php | 8 +--- modules/ranking/zeny.php | 8 +--- themes/default/account/view.php | 4 +- themes/default/castle/index.php | 2 +- themes/default/character/index.php | 4 +- themes/default/character/online.php | 4 +- themes/default/character/view.php | 10 ++--- themes/default/guild/index.php | 2 +- themes/default/ranking/alchemist.php | 4 +- themes/default/ranking/blacksmith.php | 4 +- themes/default/ranking/character.php | 4 +- themes/default/ranking/death.php | 4 +- themes/default/ranking/guild.php | 4 +- themes/default/ranking/zeny.php | 4 +- 32 files changed, 151 insertions(+), 141 deletions(-) diff --git a/config/servers.php b/config/servers.php index d0c58bd91..8ea3e7518 100644 --- a/config/servers.php +++ b/config/servers.php @@ -41,6 +41,14 @@ 'Persistent' => true, 'Timezone' => null // Possible values is as described in the comment in DbConfig. ), + // Web server configuration. + 'WebDbConfig' => array( + 'Hostname' => '127.0.0.1', + 'Username' => 'ragnarok', + 'Password' => 'ragnarok', + 'Database' => 'ragnarok', + 'Persistent' => true + ), // Login server configuration. 'LoginServer' => array( 'Address' => '127.0.0.1', diff --git a/lib/Flux.php b/lib/Flux.php index 7776272b3..911f94d9e 100644 --- a/lib/Flux.php +++ b/lib/Flux.php @@ -152,7 +152,7 @@ public static function initialize($options = array()) public static function initializeServerObjects() { foreach (self::$serversConfig->getChildrenConfigs() as $key => $config) { - $connection = new Flux_Connection($config->getDbConfig(), $config->getLogsDbConfig()); + $connection = new Flux_Connection($config->getDbConfig(), $config->getLogsDbConfig(), $config->getWebDbConfig()); $loginServer = new Flux_LoginServer($config->getLoginServer()); // LoginAthenaGroup maintains the grouping of a central login @@ -378,14 +378,16 @@ public static function parseServersConfigFile($filename, $import = false) $topConfig->setDbConfig(array(), $options); $topConfig->setLogsDbConfig(array(), $options); + $topConfig->setWebDbConfig(array(), $options); $topConfig->setLoginServer(array(), $options); $topConfig->setCharMapServers(array(), $options); $dbConfig = $topConfig->getDbConfig(); $logsDbConfig = $topConfig->getLogsDbConfig(); + $webDbConfig = $topConfig->getWebDbConfig(); $loginServer = $topConfig->getLoginServer(); - foreach (array($dbConfig, $logsDbConfig) as $_dbConfig) { + foreach (array($dbConfig, $logsDbConfig, $webDbConfig) as $_dbConfig) { $_dbConfig->setHostname('localhost', $options); $_dbConfig->setUsername('ragnarok', $options); $_dbConfig->setPassword('ragnarok', $options); diff --git a/lib/Flux/Athena.php b/lib/Flux/Athena.php index 250d18ec3..e45670368 100644 --- a/lib/Flux/Athena.php +++ b/lib/Flux/Athena.php @@ -58,6 +58,14 @@ class Flux_Athena { */ public $logsDatabase; + /** + * Web server database. (is not set until setConnection() is called.) + * + * @access public + * @var string + */ + public $webDatabase; + /** * Database used for the char/map (aka everything else) SQL operations. * This does not include log-related tasks. @@ -249,6 +257,7 @@ public function setConnection(Flux_Connection $connection) { $this->connection = $connection; $this->logsDatabase = $connection->logsDbConfig->getDatabase(); + $this->webDatabase = $connection->webDbConfig->getDatabase(); return $connection; } diff --git a/lib/Flux/Connection.php b/lib/Flux/Connection.php index 3e63d928b..6ba181c08 100644 --- a/lib/Flux/Connection.php +++ b/lib/Flux/Connection.php @@ -26,6 +26,14 @@ class Flux_Connection { */ public $logsDbConfig; + /** + * Logs database configuration object. + * + * @access public + * @var Flux_Config + */ + public $webDbConfig; + /** * @access private * @var PDO @@ -38,15 +46,23 @@ class Flux_Connection { */ private $pdoLogs; + /** + * @access private + * @var PDO + */ + private $pdoWeb; + /** * @param Flux_Config $dbConfig * @param Flux_Config $logsDbConfig + * @param Flux_Config $webDbConfig * @access public */ - public function __construct(Flux_Config $dbConfig, Flux_Config $logsDbConfig) + public function __construct(Flux_Config $dbConfig, Flux_Config $logsDbConfig, Flux_Config $webDbConfig) { $this->dbConfig = $dbConfig; $this->logsDbConfig = $logsDbConfig; + $this->webDbConfig = $webDbConfig; } /** @@ -131,6 +147,31 @@ private function getLogsConnection() return $this->pdoLogs; } + /** + * Get the PDO instance for the web server database server connection. + * + * @return PDO + * @access private + */ + private function getWebConnection() + { + if (!$this->pdoWeb) { + // Establish separate connection just for the web server database. + $pdoWeb = $this->connect($this->webDbConfig); + $this->pdoWeb = $pdoWeb; + + if ($encoding=$this->webDbConfig->getEncoding()) { + $sth = $this->getStatementForWeb("SET NAMES ?"); + $sth->execute(array($encoding)); + } + if ($timezone=$this->webDbConfig->getTimezone()) { + $sth = $this->getStatementForWeb("SET time_zone = ?"); + $sth->execute(array($timezone)); + } + } + return $this->pdoWeb; + } + /** * Select database to use. * @@ -188,6 +229,26 @@ public function getStatementForLogs($statement, $options = array()) } } + /** + * Instanciate a PDOStatement without obtaining a PDO handler before-hand. + * + * @return PDOStatement + * @access public + */ + public function getStatementForWeb($statement, $options = array()) + { + $dbh = $this->getWebConnection(); + $sth = $dbh->prepare($statement, $options); + @$sth->setFetchMode(PDO::FETCH_CLASS, 'Flux_DataObject', array(null, array('dbconfig' => $this->webDbConfig))); + + if ($sth) { + return new Flux_Connection_Statement($sth); + } + else { + return false; + } + } + /** * */ diff --git a/lib/Flux/LoginAthenaGroup.php b/lib/Flux/LoginAthenaGroup.php index 19de6dd52..f7f7fccb1 100644 --- a/lib/Flux/LoginAthenaGroup.php +++ b/lib/Flux/LoginAthenaGroup.php @@ -44,6 +44,14 @@ class Flux_LoginAthenaGroup { */ public $logsDatabase; + /** + * Web server database. + * + * @access public + * @var string + */ + public $webDatabase; + /** * Array of Flux_Athena instances. * @@ -64,6 +72,7 @@ public function __construct($serverName, Flux_Connection $connection, Flux_Login $this->loginServer = $loginServer; $this->loginDatabase = $loginServer->config->getDatabase(); $this->logsDatabase = $connection->logsDbConfig->getDatabase(); + $this->webDatabase = $connection->webDbConfig->getDatabase(); // Assign connection to LoginServer, used mainly to enable // authentication feature. diff --git a/lib/Flux/LoginServer.php b/lib/Flux/LoginServer.php index c8e637534..843f6df74 100644 --- a/lib/Flux/LoginServer.php +++ b/lib/Flux/LoginServer.php @@ -30,6 +30,14 @@ class Flux_LoginServer extends Flux_BaseServer { */ public $logsDatabase; + /** + * Web server database. (is not set until setConnection() is called.) + * + * @access public + * @var string + */ + public $webDatabase; + /** * Overridden to add custom properties. * @@ -52,6 +60,7 @@ public function setConnection(Flux_Connection $connection) { $this->connection = $connection; $this->logsDatabase = $connection->logsDbConfig->getDatabase(); + $this->webDatabase = $connection->webDbConfig->getDatabase(); return $connection; } diff --git a/modules/account/view.php b/modules/account/view.php index 01d905f49..b52764661 100644 --- a/modules/account/view.php +++ b/modules/account/view.php @@ -151,14 +151,8 @@ $athena = $session->getAthenaServer($serverName); $sql = "SELECT ch.*, guild.name AS guild_name, "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "guild_emblems.file_data as guild_emblem_len "; - else - $sql .= "guild.emblem_len AS guild_emblem_len "; $sql .= "FROM {$athena->charMapDatabase}.`char` AS ch "; $sql .= "LEFT OUTER JOIN {$athena->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = guild.guild_id "; $sql .= "WHERE ch.account_id = ? ORDER BY ch.char_num ASC"; $sth = $server->connection->getStatement($sql); $sth->execute(array($accountID)); diff --git a/modules/castle/index.php b/modules/castle/index.php index d57d5a13d..67eb6dbed 100644 --- a/modules/castle/index.php +++ b/modules/castle/index.php @@ -6,15 +6,9 @@ $castleNames = Flux::config('CastleNames')->toArray(); $ids = implode(',', array_fill(0, count($castleNames), '?')); -$sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "guild_emblems.file_data as emblem_len "; -else - $sql .= "guild.emblem_len "; +$sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql .= "FROM {$server->charMapDatabase}.guild_castle AS castles "; $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = castles.guild_id "; $sql .= "WHERE castles.castle_id IN ($ids)"; $sql .= "ORDER BY castles.castle_id ASC"; $sth = $server->connection->getStatement($sql); diff --git a/modules/character/index.php b/modules/character/index.php index dea1049dc..83645045a 100644 --- a/modules/character/index.php +++ b/modules/character/index.php @@ -13,8 +13,6 @@ $sqlpartial .= "LEFT OUTER JOIN {$server->charMapDatabase}.`char` AS mother ON mother.char_id = ch.mother "; $sqlpartial .= "LEFT OUTER JOIN {$server->charMapDatabase}.`char` AS father ON father.char_id = ch.father "; $sqlpartial .= "LEFT OUTER JOIN {$server->charMapDatabase}.`char` AS child ON child.char_id = ch.child "; -if(Flux::config('EmblemUseWebservice')) - $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sqlwhere = "WHERE 1=1 "; $sqlcount = ''; @@ -169,11 +167,7 @@ $col = "ch.account_id, ch.char_id, ch.name AS char_name, ch.char_num, "; $col .= "ch.online, ch.base_level, ch.job_level, ch.class, ch.zeny, "; -$col .= "guild.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len, "; -else - $col .= "guild.emblem_len as guild_emblem_len, "; +$col .= "guild.guild_id, guild.name AS guild_name, guild.emblem_id as emblem, "; $col .= "login.userid, partner.name AS partner_name, partner.char_id AS partner_id, "; $col .= "mother.name AS mother_name, mother.char_id AS mother_id, "; $col .= "father.name AS father_name, father.char_id AS father_id, "; diff --git a/modules/character/online.php b/modules/character/online.php index f20a591fb..bfc27e3cb 100644 --- a/modules/character/online.php +++ b/modules/character/online.php @@ -8,8 +8,6 @@ $sqlpartial = "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; if (!$auth->allowedToIgnoreHiddenPref) { $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.$charPrefsTable AS pref1 ON "; @@ -100,11 +98,7 @@ $hiddenCount = (int)$sth->fetch()->total; $col = "ch.char_id, ch.name AS char_name, ch.class AS char_class, ch.base_level, ch.job_level, "; -$col .= "guild.name AS guild_name, guild.guild_id, ch.last_map, pref2.value AS hidemap, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len as guild_emblem_len "; +$col .= "guild.name AS guild_name, guild.guild_id, ch.last_map, pref2.value AS hidemap, guild.emblem_id as emblem "; $sql = $paginator->getSQL("SELECT $col FROM {$server->charMapDatabase}.`char` AS ch $sqlpartial"); $sth = $server->connection->getStatement($sql); diff --git a/modules/character/view.php b/modules/character/view.php index 006a69901..070e72d5e 100644 --- a/modules/character/view.php +++ b/modules/character/view.php @@ -31,11 +31,7 @@ $col .= "mother.name AS mother_name, mother.char_id AS mother_id, "; $col .= "father.name AS father_name, father.char_id AS father_id, "; $col .= "child.name AS child_name, child.char_id AS child_id, "; -$col .= "guild.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len, "; -else - $col .= "guild.emblem_len as guild_emblem_len, "; +$col .= "guild.guild_id, guild.name AS guild_name, guild.emblem_id AS emblem, "; $col .= "guild_position.name AS guild_position, IFNULL(guild_position.exp_mode, 0) AS guild_tax, "; $col .= "party.name AS party_name, party.leader_char AS party_leader_id, party_leader.name AS party_leader_name, "; @@ -67,8 +63,6 @@ $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`".$mobdb[0]."` AS pet_mob ON pet_mob.ID = pet.class "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`".$mobdb[1]."` AS pet_mob2 ON pet_mob2.ID = pet.class "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`char_reg_num` AS reg ON reg.char_id = ch.char_id AND reg.key = 'PC_DIE_COUNTER' "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "WHERE ch.char_id = ?"; $sth = $server->connection->getStatement($sql); @@ -96,14 +90,9 @@ $sql = "SELECT fr.char_id, fr.name, fr.class, fr.base_level, fr.job_level, "; $sql .= "guild.guild_id, guild.name AS guild_name, fr.online, "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "guild_emblems.file_data as guild_emblem_len "; - else - $sql .= "guild.emblem_len as guild_emblem_len "; + $sql .= "guild.emblem_id AS emblem "; $sql .= "FROM {$server->charMapDatabase}.`char` AS fr "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.guild ON guild.guild_id = fr.guild_id "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = fr.guild_id "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.friends ON friends.friend_id = fr.char_id "; $sql .= "WHERE friends.char_id = ? ORDER BY fr.name ASC"; $sth = $server->connection->getStatement($sql); @@ -114,14 +103,9 @@ if ($char->party_leader_id) { $sql = "SELECT p.char_id, p.name, p.class, p.base_level, p.job_level, "; $sql .= "guild.guild_id, guild.name AS guild_name, p.online, "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "guild_emblems.file_data as guild_emblem_len "; - else - $sql .= "guild.emblem_len as guild_emblem_len "; + $sql .= "guild.emblem_id AS emblem "; $sql .= "FROM {$server->charMapDatabase}.`char` AS p "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.guild ON guild.guild_id = p.guild_id "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = p.guild_id "; $sql .= "WHERE p.party_id = ? AND p.char_id != ? ORDER BY p.name ASC"; $sth = $server->connection->getStatement($sql); diff --git a/modules/guild/emblem.php b/modules/guild/emblem.php index dd00e6246..9e47e0e82 100644 --- a/modules/guild/emblem.php +++ b/modules/guild/emblem.php @@ -29,10 +29,11 @@ function flux_display_empty_emblem() if (!$athenaServer || $guildID < 0) flux_display_empty_emblem(); else { + $dirname = FLUX_DATA_DIR."/tmp/emblems/$serverName/$athenaServerName"; + $filename = "$dirname/$guildID.png"; + if ($interval=Flux::config('EmblemCacheInterval')) { $interval *= 60; - $dirname = FLUX_DATA_DIR."/tmp/emblems/$serverName/$athenaServerName"; - $filename = "$dirname/$guildID.png"; if (!is_dir($dirname)) if (Flux::config('RequireOwnership')) @@ -48,24 +49,23 @@ function flux_display_empty_emblem() } if(Flux::config('EmblemUseWebservice')) { - $db = $athenaServer->charMapDatabase; + $db = $athenaServer->webDatabase; $sql = "SELECT file_type, file_data FROM $db.guild_emblems WHERE guild_id = ? LIMIT 1"; - $sth = $athenaServer->connection->getStatement($sql); + $sth = $athenaServer->connection->getStatementForWeb($sql); $sth->execute(array($guildID)); $res = $sth->fetch(); if (!$res->file_data) flux_display_empty_emblem(); else { + $data = 'data:image/gif;base64,'.base64_encode($res->file_data); + + if ($interval) + file_put_contents($filename, $res->file_data); + + /* TODO; add gif animation at first image load */ $image = imagecreatefromstring($res->file_data); - $rgb = imagecolorexact ($image, 255,0,255); - imagecolortransparent($image, $rgb); - header("Content-Type: image/png"); - - if ($interval) - imagepng($image, $filename); - imagepng($image); exit; } diff --git a/modules/guild/index.php b/modules/guild/index.php index a64ae729a..9c8dc1dbd 100644 --- a/modules/guild/index.php +++ b/modules/guild/index.php @@ -7,8 +7,6 @@ $bind = array(); $sqlpartial = "LEFT JOIN {$server->charMapDatabase}.`char` ON `char`.char_id = guild.char_id "; -if(Flux::config('EmblemUseWebservice')) - $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = guild.guild_id "; $sqlpartial .= "WHERE 1=1 "; $guildID = $params->get('id'); @@ -85,11 +83,7 @@ $col = "guild.guild_id, guild.name AS guildName, guild.char_id AS charID, `char`.name AS charName, "; $col .= "guild.guild_lv AS guildLevel, guild.connect_member AS connectMem, guild.max_member AS maxMem, "; -$col .= "guild.average_lv AS avgLevel, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as emblem_len "; -else - $col .= "guild.emblem_len "; +$col .= "guild.average_lv AS avgLevel, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`guild` $sqlpartial"; $sql = $paginator->getSQL($sql); diff --git a/modules/guild/view.php b/modules/guild/view.php index 81d3903f4..4dedf434b 100644 --- a/modules/guild/view.php +++ b/modules/guild/view.php @@ -19,16 +19,10 @@ $col = "guild.guild_id, guild.name, guild.char_id, guild.master, guild.guild_lv, guild.connect_member, guild.max_member, "; $col .= "guild.average_lv, guild.exp, guild.next_exp, guild.skill_point, REPLACE(guild.mes1, '|00', '') AS mes1, REPLACE(guild.mes2, '|00', '') AS mes2, "; -$col .= "guild.emblem_id, guild.emblem_data, `char`.name AS guild_master, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as emblem_len "; -else - $col .= "guild.emblem_len "; +$col .= "guild.emblem_id as emblem, `char`.name AS guild_master "; $sql = "SELECT $col FROM {$server->charMapDatabase}.guild "; $sql .= "LEFT JOIN {$server->charMapDatabase}.`char` ON `char`.char_id = guild.char_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = `char`.guild_id "; $sql .= "WHERE guild.guild_id = ?"; $sth = $server->connection->getStatement($sql); diff --git a/modules/ranking/alchemist.php b/modules/ranking/alchemist.php index d5764b949..ae917ef1f 100644 --- a/modules/ranking/alchemist.php +++ b/modules/ranking/alchemist.php @@ -15,16 +15,10 @@ } $col = "ch.char_id, ch.name AS char_name, ch.fame, ch.class AS char_class, ch.base_level, ch.job_level, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len AS guild_emblem_len "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $ids = implode(',', array_fill(0, count($alchemistJobs), '?')); diff --git a/modules/ranking/blacksmith.php b/modules/ranking/blacksmith.php index 0bac1e9ed..20f98ccd9 100644 --- a/modules/ranking/blacksmith.php +++ b/modules/ranking/blacksmith.php @@ -15,16 +15,10 @@ } $col = "ch.char_id, ch.name AS char_name, ch.fame, ch.class AS char_class, ch.base_level, ch.job_level, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len AS guild_emblem_len "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $ids = implode(',', array_fill(0, count($blacksmithJobs), '?')); diff --git a/modules/ranking/character.php b/modules/ranking/character.php index 098e44a71..834735743 100644 --- a/modules/ranking/character.php +++ b/modules/ranking/character.php @@ -15,16 +15,10 @@ } $col = "ch.char_id, ch.name AS char_name, ch.class AS char_class, ch.base_level, ch.base_exp, ch.job_level, ch.job_exp, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len AS guild_emblem_len "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sql .= "WHERE 1=1 "; diff --git a/modules/ranking/death.php b/modules/ranking/death.php index c0cd25c1e..2c751da30 100644 --- a/modules/ranking/death.php +++ b/modules/ranking/death.php @@ -15,18 +15,12 @@ } $col = "ch.char_id, ch.name AS char_name, ch.class AS char_class, ch.base_level, ch.job_level, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len, "; -else - $col .= "guild.emblem_len AS guild_emblem_len, "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem, "; $col .= "CAST(IFNULL(reg.value, '0') AS UNSIGNED) AS death_count"; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sql .= "LEFT JOIN {$server->charMapDatabase}.`char_reg_num` AS reg ON reg.char_id = ch.char_id AND reg.key = 'PC_DIE_COUNTER' "; $sql .= "WHERE 1=1 "; diff --git a/modules/ranking/guild.php b/modules/ranking/guild.php index 8c5d59c36..aab81a886 100644 --- a/modules/ranking/guild.php +++ b/modules/ranking/guild.php @@ -7,11 +7,7 @@ $ids = implode(',', array_fill(0, count($castleNames), '?')); $bind = array_keys($castleNames); -$col = "g.guild_id, g.name, g.guild_lv, g.average_lv, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as emblem_len, "; -else - $col .= "g.emblem_len, "; +$col = "g.guild_id, g.name, g.guild_lv, g.average_lv, g.emblem_id as emblem, "; $col .= "GREATEST(g.exp, (SELECT SUM(exp) FROM {$server->charMapDatabase}.guild_member WHERE guild_member.guild_id = g.guild_id)) AS exp, "; $col .= "(SELECT COUNT(char_id) FROM {$server->charMapDatabase}.`char` WHERE `char`.guild_id = g.guild_id) AS members, "; $col .= "(SELECT COUNT(castle_id) FROM {$server->charMapDatabase}.guild_castle WHERE guild_castle.guild_id = g.guild_id AND castle_id IN ($ids)) AS castles"; @@ -19,8 +15,6 @@ $sql = "SELECT $col FROM {$server->charMapDatabase}.guild AS g "; $sql .= "LEFT JOIN {$server->charMapDatabase}.`char` AS ch ON ch.char_id = g.char_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = g.guild_id "; $groups = AccountLevel::getGroupID((int)Flux::config('RankingHideGroupLevel'), '<'); if(!empty($groups)) { diff --git a/modules/ranking/zeny.php b/modules/ranking/zeny.php index 4d8f53a1f..9705d4ee4 100644 --- a/modules/ranking/zeny.php +++ b/modules/ranking/zeny.php @@ -17,18 +17,12 @@ $charPrefsTable = Flux::config('FluxTables.CharacterPrefsTable'); $col = "ch.char_id, ch.name AS char_name, ch.zeny, ch.class AS char_class, ch.base_level, ch.base_exp, ch.job_level, ch.job_exp, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len AS guild_emblem_len "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.$charPrefsTable AS hide_from_zr ON "; $sql .= "(hide_from_zr.name = 'HideFromZenyRanking' AND hide_from_zr.char_id = ch.char_id) "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sql .= "WHERE 1=1 "; diff --git a/themes/default/account/view.php b/themes/default/account/view.php index 5cce1da7b..d9e11442e 100644 --- a/themes/default/account/view.php +++ b/themes/default/account/view.php @@ -218,10 +218,10 @@ job_level ?> zeny) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view')): ?> linkToGuild($char->guild_id, $char->guild_name) ?> diff --git a/themes/default/castle/index.php b/themes/default/castle/index.php index 1fe335f2e..55a0bdbcc 100644 --- a/themes/default/castle/index.php +++ b/themes/default/castle/index.php @@ -13,7 +13,7 @@ castle_id) ?> castle_id]) ?> guild_name): ?> - emblem_len): ?> + emblem): ?> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> diff --git a/themes/default/character/index.php b/themes/default/character/index.php index a1c2f7c96..b46298b64 100644 --- a/themes/default/character/index.php +++ b/themes/default/character/index.php @@ -124,10 +124,10 @@ job_level) ?> zeny) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($char->guild_id, $char->guild_name) ?> diff --git a/themes/default/character/online.php b/themes/default/character/online.php index b290f9ea7..eef62557d 100644 --- a/themes/default/character/online.php +++ b/themes/default/character/online.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($char->guild_id, $char->guild_name) ?> diff --git a/themes/default/character/view.php b/themes/default/character/view.php index 975661732..3ca358691 100644 --- a/themes/default/character/view.php +++ b/themes/default/character/view.php @@ -125,10 +125,10 @@ Guild Name guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view')): ?> linkToGuild($char->guild_id, $char->guild_name) ?> @@ -257,7 +257,7 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> actionAllowed('guild', 'view') && $partyMember->guild_id == $char->guild_id) || $auth->allowedToViewGuild): ?> @@ -323,10 +323,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $friend->guild_id == $char->guild_id) || $auth->allowedToViewGuild): ?> linkToGuild($friend->guild_id, $friend->guild_name) ?> diff --git a/themes/default/guild/index.php b/themes/default/guild/index.php index 508e90f38..784abbf44 100644 --- a/themes/default/guild/index.php +++ b/themes/default/guild/index.php @@ -76,7 +76,7 @@ guild_id) ?> - emblem_len): ?> + emblem): ?> guildName) ?> diff --git a/themes/default/ranking/alchemist.php b/themes/default/ranking/alchemist.php index c35135b3f..6645a9e46 100644 --- a/themes/default/ranking/alchemist.php +++ b/themes/default/ranking/alchemist.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> diff --git a/themes/default/ranking/blacksmith.php b/themes/default/ranking/blacksmith.php index c98ef522d..4512ebf2c 100644 --- a/themes/default/ranking/blacksmith.php +++ b/themes/default/ranking/blacksmith.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> diff --git a/themes/default/ranking/character.php b/themes/default/ranking/character.php index 8e7e0a71e..25b4407d0 100644 --- a/themes/default/ranking/character.php +++ b/themes/default/ranking/character.php @@ -51,10 +51,10 @@ jobClassText($chars[$i]->char_class) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> diff --git a/themes/default/ranking/death.php b/themes/default/ranking/death.php index 6dc430cbc..c8ed3fed1 100644 --- a/themes/default/ranking/death.php +++ b/themes/default/ranking/death.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> diff --git a/themes/default/ranking/guild.php b/themes/default/ranking/guild.php index 29038c6f2..fb7b25210 100644 --- a/themes/default/ranking/guild.php +++ b/themes/default/ranking/guild.php @@ -19,10 +19,10 @@ > - emblem_len): ?> + emblem): ?> - emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($guilds[$i]->guild_id, $guilds[$i]->name) ?> diff --git a/themes/default/ranking/zeny.php b/themes/default/ranking/zeny.php index 545822518..dc17780ff 100644 --- a/themes/default/ranking/zeny.php +++ b/themes/default/ranking/zeny.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> From e6ca3bd4267d3734d55454827b62b4cbb4c8868f Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 13 Nov 2023 13:18:52 +0300 Subject: [PATCH 56/63] Error in recent commit. #374 (#375) --- modules/account/view.php | 34 +++++++++++++++++----------------- themes/default/guild/view.php | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/account/view.php b/modules/account/view.php index b52764661..22d0f6fdf 100644 --- a/modules/account/view.php +++ b/modules/account/view.php @@ -34,17 +34,17 @@ if (!$auth->allowedToViewAccount) { $this->deny(); } - + $sql = "SELECT login.*, {$creditColumns}, {$createColumns} FROM {$server->loginDatabase}.login "; $sql .= "LEFT OUTER JOIN {$server->loginDatabase}.{$creditsTable} AS credits ON login.account_id = credits.account_id "; $sql .= "LEFT OUTER JOIN {$server->loginDatabase}.{$createTable} AS created ON login.account_id = created.account_id "; $sql .= "WHERE login.sex != 'S' AND login.group_id >= 0 AND login.account_id = ? LIMIT 1"; $sth = $server->connection->getStatement($sql); $sth->execute(array($accountID)); - + // Account object. $account = $sth->fetch(); - + if ($account) { $title = sprintf(Flux::message('AccountViewTitle2'), $account->userid); } @@ -70,11 +70,11 @@ $vipexpires = 'Expires '.$dt->format('Y-m-d'); } elseif ($account->vip_time == '0'){ $vipexpires = 'Standard Account'; -} else {$vipexpires = 'Unknown';} +} else {$vipexpires = 'Unknown';} if (count($_POST) && $account) { $reason = (string)$params->get('reason'); - + if ($params->get('tempban') && ($tempBanDate=$params->get('tempban_date'))) { if ($canTempBan) { if ($server->loginServer->temporarilyBan($session->account->account_id, $reason, $account->account_id, $tempBanDate)) { @@ -108,30 +108,30 @@ $tbl = Flux::config('FluxTables.AccountCreateTable'); $sql = "SELECT account_id FROM {$server->loginDatabase}.$tbl WHERE confirmed = 0 AND account_id = ?"; $sth = $server->connection->getStatement($sql); - + $sth->execute(array($account->account_id)); $confirm = $sth->fetch(); - + $sql = "UPDATE {$server->loginDatabase}.$tbl SET confirmed = 1, confirm_expire = NULL WHERE account_id = ?"; $sth = $server->connection->getStatement($sql); - + if ($tempBanned && $auth->allowedToTempUnbanAccount && $server->loginServer->unban($session->account->account_id, $reason, $account->account_id)) { - + if ($confirm) { $sth->execute(array($account->account_id)); } - + $session->setMessageData(Flux::message('AccountLiftTempBan')); $this->redirect($this->url('account', 'view', array('id' => $account->account_id))); } elseif ($permBanned && $auth->allowedToPermUnbanAccount && $server->loginServer->unban($session->account->account_id, $reason, $account->account_id)) { - + if ($confirm) { $sth->execute(array($account->account_id)); } - + $session->setMessageData(Flux::message('AccountLiftPermBan')); $this->redirect($this->url('account', 'view', array('id' => $account->account_id))); } @@ -149,8 +149,8 @@ $characters = array(); foreach ($session->getAthenaServerNames() as $serverName) { $athena = $session->getAthenaServer($serverName); - - $sql = "SELECT ch.*, guild.name AS guild_name, "; + + $sql = "SELECT ch.*, guild.name AS guild_name "; $sql .= "FROM {$athena->charMapDatabase}.`char` AS ch "; $sql .= "LEFT OUTER JOIN {$athena->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; $sql .= "WHERE ch.account_id = ? ORDER BY ch.char_num ASC"; @@ -190,7 +190,7 @@ foreach ($items as $item) { $item->cardsOver = -$item->slots; - + if ($item->card0) { $cardIDs[] = $item->card0; $item->cardsOver++; @@ -207,7 +207,7 @@ $cardIDs[] = $item->card3; $item->cardsOver++; } - + if ($item->card0 == 254 || $item->card0 == 255 || $item->card0 == -256 || $item->cardsOver < 0) { $item->cardsOver = 0; } @@ -237,7 +237,7 @@ } } } - + $itemAttributes = Flux::config('Attributes')->toArray(); $type_list = Flux::config('ItemTypes')->toArray(); } diff --git a/themes/default/guild/view.php b/themes/default/guild/view.php index 1c234bea9..50bae9f5d 100644 --- a/themes/default/guild/view.php +++ b/themes/default/guild/view.php @@ -9,7 +9,7 @@ Guild Name name) ?> Emblem ID - emblem_id) ?> + emblem) ?> From 87c7b7c75a3f67ce052b2c92f66f2f8c2c477f15 Mon Sep 17 00:00:00 2001 From: jowie <53240858+gamingmagic@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:35:38 +0800 Subject: [PATCH 57/63] adding economy on castle adding economy on castle --- modules/castle/index.php | 4 ++-- themes/default/castle/index.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/castle/index.php b/modules/castle/index.php index 67eb6dbed..2f1e34210 100644 --- a/modules/castle/index.php +++ b/modules/castle/index.php @@ -6,7 +6,7 @@ $castleNames = Flux::config('CastleNames')->toArray(); $ids = implode(',', array_fill(0, count($castleNames), '?')); -$sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; +$sql = "SELECT castles.castle_id, castles.guild_id, castles.economy, guild.name AS guild_name, guild.emblem_id as emblem "; $sql .= "FROM {$server->charMapDatabase}.guild_castle AS castles "; $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id "; $sql .= "WHERE castles.castle_id IN ($ids)"; @@ -16,4 +16,4 @@ $castles = $sth->fetchAll(); -?> +?> \ No newline at end of file diff --git a/themes/default/castle/index.php b/themes/default/castle/index.php index 55a0bdbcc..6c45058e3 100644 --- a/themes/default/castle/index.php +++ b/themes/default/castle/index.php @@ -7,6 +7,7 @@ Castle ID Castle Guild + Economy @@ -18,8 +19,10 @@ actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($castle->guild_id, $castle->guild_name) ?> + economy); ?> guild_name) ?> + @@ -29,6 +32,7 @@ + From 0385d83399839bc3275bed52e0a2539df55a1407 Mon Sep 17 00:00:00 2001 From: heckercat <53240858+holic-cat@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:50:24 +0800 Subject: [PATCH 58/63] Update index.php --- themes/default/castle/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/default/castle/index.php b/themes/default/castle/index.php index 6c45058e3..a454079d0 100644 --- a/themes/default/castle/index.php +++ b/themes/default/castle/index.php @@ -19,7 +19,7 @@ actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($castle->guild_id, $castle->guild_name) ?> - economy); ?> + economy; ?> guild_name) ?> From b8944153f9691c8fc506e50c56ae4e73f5b3f1f7 Mon Sep 17 00:00:00 2001 From: Balfear Date: Sun, 19 Nov 2023 15:52:44 +0300 Subject: [PATCH 59/63] Allow to read files from addon themes ThemePath function now read files from addon themes if file not exist in main theme. --- lib/Flux/Template.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/Flux/Template.php b/lib/Flux/Template.php index aa1837dec..685659b2b 100644 --- a/lib/Flux/Template.php +++ b/lib/Flux/Template.php @@ -588,6 +588,15 @@ public function themePath($path, $included = false) if (file_exists($chk)) { $uri = $path; } + } elseif (!file_exists($chk)) { + foreach (Flux::$addons as $_tmpAddon_key => $_tmpAddon) { + $chk = FLUX_ROOT .'/'. FLUX_ADDON_DIR .'/'. $_tmpAddon_key .'/'. preg_replace('/^('.$base.')/', '', $uri ); + if (file_exists($chk)) { + $path = sprintf('%s/%s/%s', FLUX_ADDON_DIR, $_tmpAddon_key, preg_replace('/^('.$base.')/', '', $uri )); + $uri = $path; + break; + } + } } return $uri . $frag; From ec85ae9086b542a5a85bb2d7f52e05c7a45b0013 Mon Sep 17 00:00:00 2001 From: Balfear Date: Thu, 15 Feb 2024 21:02:46 +0300 Subject: [PATCH 60/63] Update create.php --- modules/account/create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/account/create.php b/modules/account/create.php index c262eebe0..c0df7aa36 100644 --- a/modules/account/create.php +++ b/modules/account/create.php @@ -73,7 +73,7 @@ $session->setMessageData($message); } else { - $session->login($server->serverName, $username, $password, false); + $session->login($server->serverName, $username, $password, $code); $session->setMessageData(Flux::message('AccountCreated')); $discordMessage = 'Account Created.'; } From 016bb0ab30d63e57618caee8217c15962e7e9224 Mon Sep 17 00:00:00 2001 From: Balfear Date: Fri, 16 Feb 2024 15:26:15 +0300 Subject: [PATCH 61/63] Fix hardcoded url --- config/application.php | 4 ++-- lib/Flux/Template.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/application.php b/config/application.php index 64a614ae9..b3f730854 100644 --- a/config/application.php +++ b/config/application.php @@ -254,8 +254,8 @@ //'ForumLabel' => array('module' => 'forums'), // Built-in forum link 'NewsLabel' => array('module' => 'news'), // Sample items for pages function. - 'DownloadsLabel' => array('module' => 'pages','action'=>'content&path=downloads'), - 'RulesLabel' => array('module' => 'pages','action'=>'content&path=rules'), + 'DownloadsLabel' => array('module' => 'pages','action'=>'content','param'=>array('path'=>'downloads')), + 'RulesLabel' => array('module' => 'pages','action'=>'content','param'=>array('path'=>'rules')), // End sample items for pages function. ), 'AccountLabel' => array( diff --git a/lib/Flux/Template.php b/lib/Flux/Template.php index 685659b2b..577c6f0f5 100644 --- a/lib/Flux/Template.php +++ b/lib/Flux/Template.php @@ -434,6 +434,7 @@ public function getMenuItems($adminMenus = false) foreach ($menu as $menuName => $menuItem) { $module = array_key_exists('module', $menuItem) ? $menuItem['module'] : false; $action = array_key_exists('action', $menuItem) ? $menuItem['action'] : $defaultAction; + $param = array_key_exists('param', $menuItem) ? $menuItem['param'] : array(); $exturl = array_key_exists('exturl', $menuItem) ? $menuItem['exturl'] : null; if ($adminMenus) { @@ -443,7 +444,7 @@ public function getMenuItems($adminMenus = false) 'exturl' => null, 'module' => $module, 'action' => $action, - 'url' => $this->url($module, $action) + 'url' => $this->url($module, $action, $param) ); } } @@ -467,7 +468,7 @@ public function getMenuItems($adminMenus = false) 'exturl' => null, 'module' => $module, 'action' => $action, - 'url' => $this->url($module, $action) + 'url' => $this->url($module, $action, $param) ); } } From 0e927ef13fbc5d59b15759fe4b16261b9edb74c5 Mon Sep 17 00:00:00 2001 From: Araan Branco Date: Sat, 16 Mar 2024 08:25:56 -0300 Subject: [PATCH 62/63] fix pass mode in log file (#387) --- lib/Flux/LogFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Flux/LogFile.php b/lib/Flux/LogFile.php index 87cf7b030..e5edc5ec4 100644 --- a/lib/Flux/LogFile.php +++ b/lib/Flux/LogFile.php @@ -44,7 +44,7 @@ public function __construct($filename, $mode = 'a') chmod($this->filename, 0600); } - $this->fp = fopen($this->filename, 'a'); + $this->fp = fopen($this->filename, $mode); if ($isNewFile) { fputs($this->fp, "\n"); } From d8657dcd2939d33f25443976703d2fb7eb7f4099 Mon Sep 17 00:00:00 2001 From: Araan Branco Date: Sat, 16 Mar 2024 08:26:25 -0300 Subject: [PATCH 63/63] Remove keys duplicated in translates (#385) --- lang/en_us.php | 32 +++++++++++------------ lang/id_id.php | 3 +-- lang/pt_br.php | 71 -------------------------------------------------- 3 files changed, 16 insertions(+), 90 deletions(-) diff --git a/lang/en_us.php b/lang/en_us.php index 0ee5a6400..44737a395 100755 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -84,24 +84,23 @@ 'DownloadsLabel' => 'Downloads', 'RulesLabel' => 'Rules', 'ContactUsLabel' => 'Contact Us', - 'MyAccountLabel' => 'My Account', + 'MyAccountLabel' => 'My Account', 'HistoryLabel' => 'History', - 'ServiceDeskLabel' => 'Service Desk', - 'PurchaseLabel' => 'Purchase', - 'DonateLabel' => 'Donate', - 'ServerInfoLabel' => 'Server Info', - 'ServerStatusLabel' => 'Server Status', - 'WoeHoursLabel' => 'WOE Hours', + 'PurchaseLabel' => 'Purchase', + 'DonateLabel' => 'Donate', + 'ServerInfoLabel' => 'Server Info', + 'ServerStatusLabel' => 'Server Status', + 'WoeHoursLabel' => 'WOE Hours', 'CastlesLabel' => 'Castles', - 'WhosOnlineLabel' => "Who's Online", - 'MapStaticsLabel' => 'Map Statics', - 'RankingInfoLabel' => 'Ranking Info', - 'VendingInfoLabel' => 'Vending Info', - 'BuyingstoreInfoLabel' => 'Buyingstore Info', - 'ItemDatabaseLabel' => 'Item Database', - 'MobDatabaseLabel' => 'Mob Database', - 'JoinUsInFacebookLabel' => 'Join us on Facebook!', - 'RateUsOnRMSLabel' => 'Rate us on RMS!', + 'WhosOnlineLabel' => "Who's Online", + 'MapStaticsLabel' => 'Map Statics', + 'RankingInfoLabel' => 'Ranking Info', + 'VendingInfoLabel' => 'Vending Info', + 'BuyingstoreInfoLabel' => 'Buyingstore Info', + 'ItemDatabaseLabel' => 'Item Database', + 'MobDatabaseLabel' => 'Mob Database', + 'JoinUsInFacebookLabel' => 'Join us on Facebook!', + 'RateUsOnRMSLabel' => 'Rate us on RMS!', // Module: account // - account/changemail @@ -271,7 +270,6 @@ 'ResetPassDisallowed' => 'Password recovery cannot be used for this account.', 'ResetPassFailed' => 'Failed to send reset password e-mail.', 'ResetPassEmailSent' => 'An e-mail has been sent with details on how to reset your password.', - 'ResetPassTitle' => 'Reset Password', 'ResetPassInfo' => 'If you lost your password, you can re-set it by entering the e-mail address you used to register your account.', 'ResetPassInfo2' => 'An e-mail will then be sent to the specified address with a link allowing you to reset your password, therefore a valid e-mail address is required.', 'ResetPassServerLabel' => 'Registered Server', diff --git a/lang/id_id.php b/lang/id_id.php index 512525fee..e0d2a57d4 100644 --- a/lang/id_id.php +++ b/lang/id_id.php @@ -275,7 +275,6 @@ 'ResetPassDisallowed' => 'Pemulihan kata sandi tidak dapat digunakan untuk akun ini.', 'ResetPassFailed' => 'Gagal untuk mengirim e-mail pemulihan akun.', 'ResetPassEmailSent' => 'E-mail berisi detail untuk menyetel ulang kata sandi sudah dikiriman.', - 'ResetPassTitle' => 'Reset Kata Sandi', 'ResetPassInfo' => 'Jika Anda lupa kata sandi, Anda dapat menyetel ulang dengan cara memasukkan alamat e-mail yang digunakan ketika mendaftarkan akun.', 'ResetPassInfo2' => 'Alamat e-mail harus benar untuk melakukan pengiriman sebuah e-mail ke alamat yang dicantumkan yang berisi tautan untuk menyetel ulang kata sandi akun Anda.', 'ResetPassServerLabel' => 'Server Terdaftar', @@ -739,7 +738,7 @@ // Module: contactform 'CFTitleSubmit' => 'Hubungi Kami', - + // Module: News and Pages 'CMSNewsHeader' => 'Pengumuman', 'CMSPageHeader' => 'Content Management System', diff --git a/lang/pt_br.php b/lang/pt_br.php index 46009b8f9..903cfcb72 100644 --- a/lang/pt_br.php +++ b/lang/pt_br.php @@ -225,7 +225,6 @@ 'ResetPassDisallowed' => 'Recuperação de senha não pode ser usada para esta conta.', 'ResetPassFailed' => 'Falha ao enviar o email de redefinição de senha.', 'ResetPassEmailSent' => 'Um e-mail foi enviado para você com os detalhes de como proceder para redefinir sua senha.', - 'ResetPassTitle' => 'Redefinir Senha', 'ResetPassInfo' => 'Se você perder a sua senha, você pode redefiní-la digitando apenas o email que você cadastrou na sua conta.', 'ResetPassInfo2' => 'Uma mensagem será enviada ao email digitado contendo um link para você poder redefinir a sua senha, por isso é necessário que você possua um e-mail válido.', 'ResetPassServerLabel' => 'Servidor Registrado', @@ -429,57 +428,6 @@ 'HistoryPassResetResetIp' => 'Redefinir o IP', 'HistoryNoPassResets' => 'Nenhuma senha Redefinida encontradas.', - // Module: ipban - // - ipban/add - 'IpbanAddTitle' => 'Add IP Ban', - 'IpbanEnterIpPattern' => 'Please input an IP address or pattern.', - 'IpbanInvalidPattern' => 'Invalid IP address or pattern.', - 'IpbanWhitelistedPattern' => 'This pattern is whitelisted and cannot be blocked.', - 'IpbanEnterReason' => 'Please enter a reason for the IP ban.', - 'IpbanSelectUnbanDate' => 'Unban date is required.', - 'IpbanFutureDate' => 'Unban date must be specified to a future date.', - 'IpbanAlreadyBanned' => 'A matching IP (%s) has already been banned.', - 'IpbanPatternBanned' => "The IP address/pattern '%s' has been banned.", - 'IpbanAddFailed' => 'Failed to add IP ban.', - 'IpbanAddHeading' => 'Add IP Ban', - 'IpbanIpAddressLabel' => 'IP Address', - 'IpbanReasonLabel' => 'Ban Reason', - 'IpbanUnbanDateLabel' => 'Unban Date', - 'IpbanIpAddressInfo' => 'You may specify a pattern such as 218.139.*.*', - 'IpbanAddButton' => 'Add IP Ban', - // - ipban/edit - 'IpbanEditTitle' => 'Modify IP Ban', - 'IpbanEnterEditReason' => 'Please enter a reason for the IP ban modification.', - 'IpbanEditFailed' => 'Failed to modify IP ban.', - 'IpbanEditHeading' => 'Modify IP Ban', - 'IpbanEditReasonLabel' => 'Edit Reason', - 'IpbanEditButton' => 'Modify IP Ban', - // - ipban/index - 'IpbanListTitle' => 'IP Ban List', - 'IpbanListHeading' => 'IP Ban List', - 'IpbanBannedIpLabel' => 'Banned IP', - 'IpbanBanDateLabel' => 'Ban Date', - 'IpbanBanReasonLabel' => 'Ban Reason', - 'IpbanBanExpireLabel' => 'Ban Expiration Date', - 'IpbanModifyLink' => 'Modify', - 'IpbanRemoveLink' => 'Remove', - 'IpbanUnbanButton' => 'Unban Selected', - 'IpbanListNoBans' => 'There are currently no IP bans.', - // - ipban/remove - 'IpbanRemoveTitle' => 'Remove IP Ban', - 'IpbanEnterRemoveReason' => 'Please enter a reason for the IP ban removal.', - 'IpbanNotBanned' => 'No matching IP (%s) is currently banned.', - 'IpbanPatternUnbanned' => "The IP address/pattern '%s' has been unbanned.", - 'IpbanRemoveFailed' => 'Failed to remove IP ban.', - 'IpbanRemoveHeading' => 'Remove IP Ban', - 'IpbanRemoveReasonLabel' => 'Unban Reason', - 'IpbanRemoveButton' => 'Remove IP Ban', - // - ipban/unban - 'IpbanNothingToUnban' => 'Nothing to unban.', - 'IpbanEnterUnbanReason' => 'Please enter a reason for lifting the IP ban(s).', - 'IpbanUnbanned' => 'Lifted selected IP ban(s)!', - 'IpbanUnbanFailed' => 'Failed to lift %d of the specified IP unban(s)!', - // Module: ipban // - ipban/add 'IpbanAddTitle' => 'Banir IP', @@ -717,13 +665,6 @@ 'HARAccountID' => 'ID da conta', 'HARNoData' => 'Nenhum dado foi encontrado.', 'HARGoback' => 'Voltar', - 'HARTitle' => 'Harmony Logs', - 'HARTitle' => 'Harmony Logs', - 'HARTitle' => 'Harmony Logs', - 'HARTitle' => 'Harmony Logs', - 'HARTitle' => 'Harmony Logs', - 'HARTitle' => 'Harmony Logs', - 'HARTitle' => 'Harmony Logs', // Module: News and Pages 'XCMSNewsHeader' => 'Announcements', @@ -769,18 +710,6 @@ 'XCMSOptionalLabel' => '(Optional)', 'XCMSRequiredLabel' => '(Required)', - - // Module: vending - 'TLHeaderTasks' => 'Tasks', - 'TLHeaderOwner' => 'Owner', - 'TLHeaderPriority' => 'Priority', - 'TLHeaderStatus' => 'Status', - 'TLHeaderCreated' => 'Created', - 'TLHeaderModified' => 'Modified', - 'TLHeaderResources' => 'Additional Resources', - 'TLHeaderBody' => 'Body', - - // Module: servicedesk 'SDHeader' => 'Serviço de tickets', 'SDCreateNew' => 'Criar um novo ticket',