1. <?php
  2. /*
  3. * @ https://EasyToYou.eu - IonCube v11 Decoder Online
  4. * @ PHP 7.2
  5. * @ Decoder version: 1.0.4
  6. * @ Release: 01/09/2021
  7. */
  8. session_cache_limiter("none");
  9. session_start();
  10. require "config.php";
  11. require "PHPMailer/Exception.php";
  12. require "PHPMailer/PHPMailer.php";
  13. require "PHPMailer/SMTP.php";
  14. require "pusher.php";
  15. $notValidDomainMessage = "This is not a valid domain, if you want to make this site to work again please go to premium dating script license manager and release another domains or get a domain upgrade.";
  16. $notValidDomainTitle = "Invalid domain";
  17. $licenseErrorHtml = "\n<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><title>Site suspended - Premium Dating Script.</title></head><body><!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><title>Site suspended - Premium Dating Script.</title><meta name=\"viewport\" content=\"width=device-width\"><meta https-equiv=\"content-type\" content=\"text/html;charset=utf-8\"><meta name=\"format-detection\" content=\"date=no,address=no,email=no\"><style type=\"text/css\">body{width:100%!important;background-color:#111;padding:0;margin:0}a,a:link{color:#0070c9;text-decoration:none}a:hover{color:#0070c9;text-decoration:underline!important}sup{line-height:normal;font-size:.65em!important;vertical-align:super}b{font-weight:400!important}body{font-family:system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-weight:400;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased}td{color:#999;font-size:16px;font-weight:400;line-height:25px}p,ul{margin:0;padding:0}li{list-style-type:none}.cta{margin-top:13px}.f-complete{color:#666;font-size:11px;line-height:15px;padding:19px 0 20px 0}.f-complete p{margin-bottom:9px}a{color:#dfb257 !important;font-size:16px}.f-links-shop{color:#444;font-size:14px;line-height:18px;padding:18px 0 16px 0;text-align:center}.f-links-shop a,.f-links-shop a:visited,.f-legal a,.f-legal a:visited,.f-complete a,.f-complete a:visited{color:#999}.f-links-legal{color:#d6d6d6}.f-links-shop a:hover,.f-legal a:hover{text-decoration:underline}.hero-container{padding:70px 0 0 0}</style><style type=\"text/css\">.desktop .hero{margin:0 auto;overflow:hidden}.video{width:204px;height:102px;z-index:1;text-align:center}</style></head><body><div style=\"position:absolute; max-height:0; font-size:0;\"><img src=\"https://premiumdatingscript.com/support/images/logo-goteo.png\" alt=\"\" width=\"1\" height=\"1\"></div><table class=\"desktop\" width=\"100%\" height=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" class=\"body\" bgcolor=\"#111111\" style=\"margin: 0 auto;\"><tr><td align=\"center\" valign=\"top\" style=\"padding-top:50px;\"><table width=\"712\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" bgcolor=\"#111111\" style=\"margin:0 auto;\"><tr><td class=\"pds-logo\" align=\"center\" style=\"padding: 70px 0px 0px;\"><picture><img src=\"https://premiumdatingscript.com/support/images/logo-goteo.png\" border=\"0\" alt=\"\"></picture></td></tr><tr><td style=\"padding: 21px 0 39px 0;\" align=\"center\"><h1>[INVALID-TITLE]</h1><p>[INVALID-MESSAGE]</p></td></tr><tr><td align=\"center\" style=\"padding: 0 0 106px 0;\"></td></tr><!-- DESKTOP FOOTER --><tr><td align=\"center\" bgcolor=\"#111111\" style=\"margin: 0 auto;background-color: #111111;padding:0 20px 0 20px;\"><table role=\"presentation\" width=\"660\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" class=\"footer\"><tr><td class=\"f-links-shop\"><p><a href=\"/index.php?verifyLicense=Yes\" style=\"border: 0; outline: 0;\">Check my license</a> | <a href=\"https://www.premiumdatingscript.com\" target=\"_blank\" style=\"border: 0; outline: 0;\">Go to Premium Dating Script</a></p></td></tr></table></td></tr><tr><td height=\"60\">&nbsp;</td></tr></table></td></tr></table></body></html></body></html>\n";
  18. $mysqli = new mysqli($db_host, $db_username, $db_password, $db_name);
  19. if (mysqli_connect_errno($mysqli)) {
  20. exit(mysqli_connect_error());
  21. }
  22. $mysqli->set_charset("utf8mb4");
  23. $sm = [];
  24. $sm["plugins"] = siteplugins();
  25. $sm["plugin"] = siteplugin();
  26. $sm["settings"] = sitesettings();
  27. $sm["creditsPackages"] = getArray("config_credits", "", "id asc");
  28. $sm["premiumPackages"] = getArray("config_premium", "", "id asc");
  29. date_default_timezone_set($sm["plugins"]["settings"]["timezone"]);
  30. $cronData = getArray("cron", "", "cron DESC");
  31. foreach ($cronData as $cron) {
  32. $diff = time() - $cron["cron_last_run"];
  33. if ($cron["cron"] == "cron") {
  34. $cron["cron_run"] = 86400;
  35. }
  36. if ($cron["cron_run"] < $diff) {
  37. if ($cron["cron"] == "onlineDay") {
  38. $today = date("w");
  39. $today = "day" . $today;
  40. cronUpdateOnlineDay($today);
  41. $filter = "WHERE cron = \"onlineDay\"";
  42. updateData("cron", "cron_last_run", time(), $filter);
  43. }
  44. if ($cron["cron"] == "cron") {
  45. $url = "https://www.premiumdatingscript.com/clients/client.php?url=" . urlencode($_SERVER["HTTP_HOST"]) . "&license=" . urlencode($sm["settings"]["license"]) . "&type=" . urlencode("envato");
  46. if (function_exists("curl_get_contents") && function_exists("curl_init")) {
  47. $callApi = curl_get_contents($url);
  48. if (!empty($callApi)) {
  49. $client = json_decode($callApi);
  50. if (isset($client->active)) {
  51. if ($client->active == 0) {
  52. updateData("settings", "setting_val", $client->reason, "WHERE setting = \"licenseError\"");
  53. $licenseErrorHtml = str_replace("[INVALID-MESSAGE]", $client->reason, $licenseErrorHtml);
  54. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "INVALID DOMAIN", $licenseErrorHtml);
  55. echo $licenseErrorHtml;
  56. exit;
  57. }
  58. updateData("client", "client", json_encode($callApi, JSON_UNESCAPED_UNICODE));
  59. updateData("settings", "setting_val", $client->fakeUsers, "WHERE setting = \"fakeUserLimit\"");
  60. updateData("settings", "setting_val", $client->fakeUsersUsage, "WHERE setting = \"fakeUserUsage\"");
  61. updateData("settings", "setting_val", $client->premium, "WHERE setting = \"premium\"");
  62. updateData("settings", "setting_val", $client->domainsLimit, "WHERE setting = \"domainsLimit\"");
  63. updateData("settings", "setting_val", $client->domainsUsage, "WHERE setting = \"domainsUsage\"");
  64. $filter = "WHERE cron = \"cron\"";
  65. updateData("cron", "cron_last_run", time(), $filter);
  66. if (file_exists(__DIR__ . "/domain.php")) {
  67. $domainkey = $client->domainKey;
  68. file_put_contents(__DIR__ . "/domain.php", $domainkey);
  69. } else {
  70. $licenseErrorHtml = str_replace("[INVALID-MESSAGE]", "The file domain.php that should be located in assets/includes/ folder was not found on this server, the software requires this file to work.<br>Please re-upload the file or contact support if you need assistance", $licenseErrorHtml);
  71. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "DOMAIN.PHP FILE NOT FOUND", $licenseErrorHtml);
  72. echo $licenseErrorHtml;
  73. exit;
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. }
  81. if (isset($_GET["verifyLicense"]) && $_GET["verifyLicense"] == "Yes") {
  82. $client = [];
  83. $url = "https://www.premiumdatingscript.com/clients/client.php?url=" . urlencode($_SERVER["HTTP_HOST"]) . "&license=" . urlencode($sm["settings"]["license"]) . "&type=" . urlencode("envato");
  84. if (function_exists("curl_get_contents") && function_exists("curl_init")) {
  85. $callApi = curl_get_contents($url);
  86. if (!empty($callApi)) {
  87. $client = json_decode($callApi);
  88. if (isset($client->active)) {
  89. if ($client->active == 0) {
  90. updateData("settings", "setting_val", $client->reason, "WHERE setting = \"licenseError\"");
  91. $licenseErrorHtml = str_replace("[INVALID-MESSAGE]", $client->reason, $licenseErrorHtml);
  92. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "INVALID DOMAIN", $licenseErrorHtml);
  93. echo $licenseErrorHtml;
  94. updateData("client", "client", json_encode($callApi, JSON_UNESCAPED_UNICODE));
  95. exit;
  96. }
  97. if (file_exists(__DIR__ . "/domain.php")) {
  98. $domainkey = $client->domainKey;
  99. file_put_contents(__DIR__ . "/domain.php", $domainkey);
  100. updateData("client", "client", json_encode($callApi, JSON_UNESCAPED_UNICODE));
  101. updateData("settings", "setting_val", $client->fakeUsers, "WHERE setting = \"fakeUserLimit\"");
  102. updateData("settings", "setting_val", $client->fakeUsersUsage, "WHERE setting = \"fakeUserUsage\"");
  103. updateData("settings", "setting_val", $client->premium, "WHERE setting = \"premium\"");
  104. updateData("settings", "setting_val", $client->domainsLimit, "WHERE setting = \"domainsLimit\"");
  105. updateData("settings", "setting_val", $client->domainsUsage, "WHERE setting = \"domainsUsage\"");
  106. $filter = "WHERE cron = \"cron\"";
  107. updateData("cron", "cron_last_run", time(), $filter);
  108. } else {
  109. $licenseErrorHtml = str_replace("[INVALID-MESSAGE]", "The file domain.php that should be located in assets/includes/ folder was not found on this server, the software requires this file to work.<br>Please re-upload the file or contact support if you need assistance", $licenseErrorHtml);
  110. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "DOMAIN.PHP FILE NOT FOUND", $licenseErrorHtml);
  111. echo $licenseErrorHtml;
  112. exit;
  113. }
  114. }
  115. }
  116. }
  117. }
  118. $options = ["encrypted" => false, "cluster" => $sm["plugins"]["pusher"]["cluster"]];
  119. $sm["push"] = new Pusher($sm["plugins"]["pusher"]["key"], $sm["plugins"]["pusher"]["secret"], $sm["plugins"]["pusher"]["id"], $options);
  120. $sm["price"] = sitePrices();
  121. $sm["basic"] = siteAccountsBasic();
  122. $sm["premium"] = siteAccountsPremium();
  123. $sm["config_email"] = configEmail();
  124. $mobile = false;
  125. $sm["mobile"] = 0;
  126. $sm["config"]["name"] = $sm["plugins"]["settings"]["siteName"];
  127. $https = issecure();
  128. if ($sm["plugins"]["settings"]["forceSSL"] == "Yes") {
  129. $site_url = str_replace("http://", "https://", $site_url);
  130. }
  131. if ($https == 0 && $sm["plugins"]["settings"]["forceSSL"] == "Yes") {
  132. header("Location: " . $site_url);
  133. exit;
  134. }
  135. if (isset($_SERVER["HTTP_HOST"])) {
  136. if (strpos($_SERVER["HTTP_HOST"], "www") !== false && strpos($site_url, "www") === false) {
  137. header("Location: " . $site_url);
  138. exit;
  139. }
  140. if (strpos($_SERVER["HTTP_HOST"], "www") === false && strpos($site_url, "www") !== false) {
  141. header("Location: " . $site_url);
  142. exit;
  143. }
  144. }
  145. $check_bar = substr($site_url, -1);
  146. if ($check_bar == "/") {
  147. $sm["config"]["site_url"] = $site_url;
  148. } else {
  149. $sm["config"]["site_url"] = $site_url . "/";
  150. }
  151. $sm["client"] = json_decode(getData("client", "client", ""), true);
  152. if ($sm["client"]["active"] == 0) {
  153. $licenseErrorHtml = str_replace("[INVALID-MESSAGE]", $sm["settings"]["licenseError"], $licenseErrorHtml);
  154. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "INVALID DOMAIN / LICENSE", $licenseErrorHtml);
  155. echo $licenseErrorHtml;
  156. exit;
  157. }
  158. $wl = ["127.0.0.1", "localhost", "www.localhost", "localhost"];
  159. checkDomainFile();
  160. $sm["admin_ajax"] = false;
  161. $sm["version"] = $sm["settings"]["currentVersion"];
  162. $sm["config"]["like_back"] = siteconfig("like_back");
  163. $sm["config"]["visit_back"] = siteconfig("visit_back");
  164. $sm["config"]["domain"] = preg_replace("/www\\./i", "", $_SERVER["SERVER_NAME"]);
  165. $sm["config"]["theme"] = $sm["settings"]["desktopTheme"];
  166. $sm["config"]["currency"] = $sm["plugins"]["settings"]["currency"];
  167. if (isset($_GET["preset"])) {
  168. $checkPreset = checkIfExist("theme_preset", "preset", $_GET["preset"]);
  169. if ($checkPreset == 0) {
  170. header("Location: " . $site_url);
  171. exit;
  172. }
  173. $_SESSION["preset"] = $_GET["preset"];
  174. }
  175. if (!isset($_SESSION["preset"])) {
  176. $_SESSION["preset"] = $sm["settings"]["desktopThemePreset"];
  177. }
  178. if (isset($_GET["landingPreset"])) {
  179. $checkPreset = checkIfExist("theme_preset", "preset", $_GET["landingPreset"]);
  180. if ($checkPreset == 0) {
  181. header("Location: " . $site_url);
  182. exit;
  183. }
  184. $_SESSION["landingPreset"] = $_GET["landingPreset"];
  185. }
  186. if (!isset($_SESSION["landingPreset"])) {
  187. $_SESSION["landingPreset"] = $sm["settings"]["landingThemePreset"];
  188. }
  189. if (isset($_GET["landing"])) {
  190. $checkLanding = checkIfExist("config_themes", "folder", $_GET["landing"]);
  191. if ($checkLanding == 0) {
  192. header("Location: " . $site_url);
  193. exit;
  194. }
  195. $landingTheme = $_GET["landing"];
  196. } else {
  197. $_SESSION["landingPreset"] = $sm["settings"]["landingThemePreset"];
  198. }
  199. if (!isset($_GET["landing"])) {
  200. $landingTheme = $sm["settings"]["landingTheme"];
  201. }
  202. $sm["config"]["landing"] = $landingTheme;
  203. $themeFilter = "WHERE theme =\"" . $sm["settings"]["desktopTheme"] . "\" AND preset = \"" . $_SESSION["preset"] . "\"";
  204. $sm["theme"] = json_decode(getData("theme_preset", "theme_settings", $themeFilter), true);
  205. $landingThemeFilter = "WHERE theme =\"" . $landingTheme . "\" AND preset = \"" . $_SESSION["landingPreset"] . "\"";
  206. $sm["landing"] = json_decode(getData("theme_preset", "theme_settings", $landingThemeFilter), true);
  207. $sm["liveTheme"] = true;
  208. $themeLivePreset = $sm["settings"]["desktopThemePreset"];
  209. if ($_SESSION["preset"] != $themeLivePreset) {
  210. $sm["liveTheme"] = false;
  211. }
  212. $sm["config"]["fb_app_ok"] = 1;
  213. $sm["config"]["theme_mobile"] = $sm["settings"]["mobileTheme"];
  214. $sm["config"]["theme_email"] = $sm["settings"]["emailTheme"];
  215. $sm["config"]["theme_landing"] = $sm["config"]["landing"];
  216. $sm["config"]["logo"] = $sm["theme"]["logo"]["val"];
  217. $sm["config"]["title"] = siteconfig("title");
  218. $sm["config"]["description"] = siteconfig("description");
  219. $sm["config"]["keywords"] = siteconfig("keywords");
  220. $sm["config"]["lang"] = $sm["plugins"]["settings"]["defaultLang"];
  221. $sm["config"]["email"] = $sm["plugins"]["settings"]["siteEmail"];
  222. $sm["config"]["admin_url"] = $site_url . "administrator";
  223. $sm["config"]["theme_url"] = $site_url . "themes/" . $sm["config"]["theme"];
  224. $sm["config"]["theme_url_landing"] = $site_url . "themes/" . $sm["config"]["theme_landing"];
  225. $sm["config"]["theme_url_mobile"] = $site_url . "themes/" . $sm["config"]["theme_mobile"];
  226. $sm["config"]["theme_url_email"] = $site_url . "themes/" . $sm["config"]["theme_email"];
  227. $sm["config"]["ajax_path"] = $site_url . "requests";
  228. $sm["config"]["max_upload"] = getMaximumFileUploadSize();
  229. $sm["genders"] = siteGenders(1);
  230. $sm["interests"] = getSiteInterests();
  231. $sm["lang"] = siteLang($sm["config"]["lang"]);
  232. $sm["alang"] = applang($sm["config"]["lang"]);
  233. $sm["elang"] = emaillang($sm["config"]["lang"]);
  234. $sm["seoLang"] = seolang($sm["config"]["lang"]);
  235. $sm["landingLang"] = landinglang($sm["config"]["lang"], $landingTheme, $_SESSION["landingPreset"]);
  236. if (!isset($_SESSION["lang"])) {
  237. $_SESSION["lang"] = $sm["config"]["lang"];
  238. }
  239. $logged = false;
  240. $user = [];
  241. $available_languages = availableLanguages();
  242. $langs = prefered_language($available_languages, $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
  243. $lang = key($langs);
  244. if ($lang != "" && $sm["plugins"]["settings"]["browserLanguage"] == "Yes") {
  245. $_SESSION["lang"] = checkUserLang($lang);
  246. $sm["lang"] = siteLang(checkUserLang($lang));
  247. $sm["alang"] = applang(checkUserLang($lang));
  248. $sm["elang"] = emaillang(checkUserLang($lang));
  249. $sm["seoLang"] = seolang(checkUserLang($lang));
  250. $sm["landingLang"] = landinglang(checkUserLang($lang), $landingTheme, $_SESSION["landingPreset"]);
  251. } else {
  252. $_SESSION["lang"] = $sm["config"]["lang"];
  253. $sm["lang"] = siteLang($sm["config"]["lang"]);
  254. $sm["alang"] = applang($sm["config"]["lang"]);
  255. $sm["elang"] = emaillang($sm["config"]["lang"]);
  256. $sm["seoLang"] = seolang($sm["config"]["lang"]);
  257. $sm["landingLang"] = landinglang($sm["config"]["lang"], $landingTheme, $_SESSION["landingPreset"]);
  258. }
  259. if (isset($_SESSION["user"]) && is_numeric($_SESSION["user"]) && 0 < $_SESSION["user"]) {
  260. setcookie("user", $_SESSION["user"], 2147483647);
  261. getUserInfo($_SESSION["user"], 0);
  262. checkUserPremium($_SESSION["user"]);
  263. $sm["user_notifications"] = userNotifications($_SESSION["user"]);
  264. $_SESSION["lang"] = $sm["user"]["lang"];
  265. $sm["lang"] = siteLang($sm["user"]["lang"]);
  266. $sm["alang"] = applang($sm["user"]["lang"]);
  267. $sm["elang"] = emaillang($sm["user"]["lang"]);
  268. $sm["seoLang"] = seolang($sm["user"]["lang"]);
  269. $sm["landingLang"] = landinglang($sm["user"]["lang"], $landingTheme, $_SESSION["landingPreset"]);
  270. $sm["genders"] = siteGenders($sm["user"]["lang"]);
  271. $modPermission = [];
  272. if (1 <= $sm["user"]["admin"]) {
  273. $moderationList = getArray("moderation_list", "", "moderation ASC");
  274. foreach ($moderationList as $mod) {
  275. if ($sm["user"]["admin"] == 1) {
  276. $modPermission[$mod["moderation"]] = "Yes";
  277. } else {
  278. $modVal = getData("moderators_permission", "setting_val", "WHERE setting = \"" . $mod["moderation"] . "\" AND id = \"" . $sm["user"]["moderator"] . "\"");
  279. $modPermission[$mod["moderation"]] = $modVal;
  280. }
  281. }
  282. }
  283. $sm["moderator"] = $modPermission;
  284. $time = time();
  285. $logged = true;
  286. $ip = getUserIpAddr();
  287. if ($sm["user"]["ip"] != $ip) {
  288. $mysqli->query("UPDATE users set ip = '" . $ip . "' where id = '" . $_SESSION["user"] . "'");
  289. }
  290. if ($sm["user"]["last_access"] < $time || $sm["user"]["last_access"] == 0) {
  291. $mysqli->query("UPDATE users set last_access = '" . $time . "' where id = '" . $_SESSION["user"] . "'");
  292. }
  293. }
  294. $sm["logged"] = $logged;
  295. require_once "custom/app_core.php";
  296. if (!empty($_GET["lang"])) {
  297. $slang = secureEncode($_GET["lang"]);
  298. $_SESSION["lang"] = $slang;
  299. $sm["lang"] = siteLang($_SESSION["lang"]);
  300. $sm["alang"] = applang($_SESSION["lang"]);
  301. $sm["elang"] = emaillang($_SESSION["lang"]);
  302. $sm["genders"] = siteGenders($_SESSION["lang"]);
  303. $sm["seoLang"] = seolang($_SESSION["lang"]);
  304. $sm["landingLang"] = landinglang($_SESSION["lang"], $landingTheme, $_SESSION["landingPreset"]);
  305. if ($logged) {
  306. $mysqli->query("UPDATE users SET lang = '" . $slang . "' WHERE id = '" . $user_id . "'");
  307. }
  308. }
  309. if (!$logged) {
  310. unset($_SESSION["user"]);
  311. unset($user);
  312. }
  313. function appLang($lang)
  314. {
  315. global $mysqli;
  316. global $sm;
  317. $result = [];
  318. $lang = secureEncode($lang);
  319. $query = $mysqli->query("SELECT * FROM app_lang where lang_id = '" . $lang . "' ORDER BY id ASC");
  320. while ($row = $query->fetch_assoc()) {
  321. $result[$row["id"]] = ["id" => $row["id"], "text" => $row["text"]];
  322. }
  323. return $result;
  324. }
  325. function themeSetting($theme)
  326. {
  327. global $mysqli;
  328. global $sm;
  329. $result = [];
  330. $query = $mysqli->query("SELECT * FROM theme_settings where theme = '" . $theme . "'");
  331. while ($row = $query->fetch_assoc()) {
  332. $result[$row["setting"]] = ["val" => $row["setting_val"]];
  333. }
  334. return $result;
  335. }
  336. function sitePlugins()
  337. {
  338. global $mysqli;
  339. global $sm;
  340. $result = [];
  341. $query = $mysqli->query("SELECT * FROM plugins_settings");
  342. while ($row = $query->fetch_assoc()) {
  343. $filter = "where setting = \"" . $row["setting"] . "\" and plugin = \"" . $row["plugin"] . "\"";
  344. $clientSetting = getData("plugins_settings_values", "setting_val", $filter);
  345. if ($clientSetting == "noData") {
  346. $row["setting_val"] = $row["setting_val"];
  347. } else {
  348. $row["setting_val"] = $clientSetting;
  349. }
  350. if (isset($result[$row["plugin"]])) {
  351. $result[$row["plugin"]][$row["setting"]] = $row["setting_val"];
  352. } else {
  353. $result[$row["plugin"]] = [$row["setting"] => $row["setting_val"]];
  354. }
  355. }
  356. return $result;
  357. }
  358. function sitePlugin()
  359. {
  360. global $mysqli;
  361. global $sm;
  362. $result = [];
  363. $query = $mysqli->query("SELECT * FROM plugins");
  364. while ($row = $query->fetch_assoc()) {
  365. $result[] = $row;
  366. }
  367. return $result;
  368. }
  369. function isSecure()
  370. {
  371. if (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] !== "off" || $_SERVER["SERVER_PORT"] == 443) {
  372. return 1;
  373. }
  374. return 0;
  375. }
  376. function siteSettings()
  377. {
  378. global $mysqli;
  379. global $sm;
  380. $result = [];
  381. $query = $mysqli->query("SELECT * FROM settings");
  382. while ($row = $query->fetch_assoc()) {
  383. $result[$row["setting"]] = $row["setting_val"];
  384. }
  385. return $result;
  386. }
  387. function emailLang($lang)
  388. {
  389. global $mysqli;
  390. global $sm;
  391. $result = [];
  392. $lang = secureEncode($lang);
  393. $query = $mysqli->query("SELECT * FROM email_lang where lang_id = '" . $lang . "' ORDER BY id ASC");
  394. while ($row = $query->fetch_assoc()) {
  395. $result[$row["id"]] = ["id" => $row["id"], "text" => $row["text"]];
  396. }
  397. return $result;
  398. }
  399. function seoLang($lang)
  400. {
  401. global $mysqli;
  402. global $sm;
  403. $result = [];
  404. $lang = secureEncode($lang);
  405. $query = $mysqli->query("SELECT * FROM seo_lang where lang_id = '" . $lang . "' ORDER BY page ASC");
  406. while ($row = $query->fetch_assoc()) {
  407. $result[$row["page"]][$row["id"]] = ["text" => $row["text"]];
  408. }
  409. return $result;
  410. }
  411. function landingLang($lang, $theme, $preset)
  412. {
  413. global $mysqli;
  414. global $sm;
  415. $result = [];
  416. $lang = secureEncode($lang);
  417. $query = $mysqli->query("SELECT * FROM landing_lang where lang_id = '" . $lang . "' and theme = '" . $theme . "' and preset = '" . $preset . "' ORDER BY id ASC");
  418. while ($row = $query->fetch_assoc()) {
  419. $result[$row["id"]] = ["id" => $row["id"], "text" => $row["text"]];
  420. }
  421. return $result;
  422. }
  423. function siteConfig($val)
  424. {
  425. global $mysqli;
  426. global $sm;
  427. $config = $mysqli->query("SELECT * FROM config");
  428. $result = $config->fetch_object();
  429. return $result->{$val};
  430. }
  431. function checkDomainFile()
  432. {
  433. global $sm;
  434. global $wl;
  435. global $licenseErrorHtml;
  436. if (empty($_SERVER["HTTP_X_REQUESTED_WITH"]) || strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) != "xmlhttprequest") {
  437. if (!file_exists(__DIR__ . "/domain.php")) {
  438. $licenseErrorHtml = str_replace("[INVALID-MESSAGE]", "The file domain.php that should be located in assets/includes/ folder was not found on this server, the software requires this file to work.<br>Please re-upload the file or contact support if you need assistance", $licenseErrorHtml);
  439. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "DOMAIN.PHP FILE NOT FOUND", $licenseErrorHtml);
  440. echo $licenseErrorHtml;
  441. exit;
  442. }
  443. if (!in_array($_SERVER["HTTP_HOST"], $wl)) {
  444. $filekey = file_get_contents(__DIR__ . "/domain.php");
  445. if ($sm["client"]["domainKey"] != $filekey) {
  446. $licenseErrorHtml = str_replace("[INVALID-MESSAGE]", "The domain key of the file domain.php is not the correct one for this domain, make sure to do a fresh software installation to avoid this issue, feel free to contact support if you need assistance", $licenseErrorHtml);
  447. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "WRONG DOMAIN KEY", $licenseErrorHtml);
  448. echo $licenseErrorHtml;
  449. exit;
  450. }
  451. }
  452. }
  453. }
  454. ?>