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. exit;
  95. }
  96. if (file_exists(__DIR__ . "/domain.php")) {
  97. $domainkey = $client->domainKey;
  98. file_put_contents(__DIR__ . "/domain.php", $domainkey);
  99. updateData("client", "client", json_encode($callApi, JSON_UNESCAPED_UNICODE));
  100. updateData("settings", "setting_val", $client->fakeUsers, "WHERE setting = \"fakeUserLimit\"");
  101. updateData("settings", "setting_val", $client->fakeUsersUsage, "WHERE setting = \"fakeUserUsage\"");
  102. updateData("settings", "setting_val", $client->premium, "WHERE setting = \"premium\"");
  103. updateData("settings", "setting_val", $client->domainsLimit, "WHERE setting = \"domainsLimit\"");
  104. updateData("settings", "setting_val", $client->domainsUsage, "WHERE setting = \"domainsUsage\"");
  105. $filter = "WHERE cron = \"cron\"";
  106. updateData("cron", "cron_last_run", time(), $filter);
  107. } else {
  108. $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);
  109. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "DOMAIN.PHP FILE NOT FOUND", $licenseErrorHtml);
  110. echo $licenseErrorHtml;
  111. exit;
  112. }
  113. }
  114. }
  115. }
  116. }
  117. $options = ["encrypted" => false, "cluster" => $sm["plugins"]["pusher"]["cluster"]];
  118. $sm["push"] = new Pusher($sm["plugins"]["pusher"]["key"], $sm["plugins"]["pusher"]["secret"], $sm["plugins"]["pusher"]["id"], $options);
  119. $sm["price"] = sitePrices();
  120. $sm["basic"] = siteAccountsBasic();
  121. $sm["premium"] = siteAccountsPremium();
  122. $sm["config_email"] = configEmail();
  123. $mobile = false;
  124. $sm["mobile"] = 0;
  125. $sm["config"]["name"] = $sm["plugins"]["settings"]["siteName"];
  126. $https = issecure();
  127. if ($sm["plugins"]["settings"]["forceSSL"] == "Yes") {
  128. $site_url = str_replace("http://", "https://", $site_url);
  129. }
  130. if ($https == 0 && $sm["plugins"]["settings"]["forceSSL"] == "Yes") {
  131. header("Location: " . $site_url);
  132. exit;
  133. }
  134. if (isset($_SERVER["HTTP_HOST"])) {
  135. if (strpos($_SERVER["HTTP_HOST"], "www") !== false && strpos($site_url, "www") === false) {
  136. header("Location: " . $site_url);
  137. exit;
  138. }
  139. if (strpos($_SERVER["HTTP_HOST"], "www") === false && strpos($site_url, "www") !== false) {
  140. header("Location: " . $site_url);
  141. exit;
  142. }
  143. }
  144. $check_bar = substr($site_url, -1);
  145. if ($check_bar == "/") {
  146. $sm["config"]["site_url"] = $site_url;
  147. } else {
  148. $sm["config"]["site_url"] = $site_url . "/";
  149. }
  150. $sm["client"] = json_decode(getData("client", "client", ""), true);
  151. if ($sm["client"]["active"] == 0) {
  152. $licenseErrorHtml = str_replace("[INVALID-MESSAGE]", $sm["settings"]["licenseError"], $licenseErrorHtml);
  153. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "INVALID DOMAIN / LICENSE", $licenseErrorHtml);
  154. echo $licenseErrorHtml;
  155. exit;
  156. }
  157. $wl = ["127.0.0.1", "localhost", "www.localhost", "localhost"];
  158. checkDomainFile();
  159. $sm["admin_ajax"] = false;
  160. $sm["version"] = $sm["settings"]["currentVersion"];
  161. $sm["config"]["like_back"] = siteconfig("like_back");
  162. $sm["config"]["visit_back"] = siteconfig("visit_back");
  163. $sm["config"]["domain"] = preg_replace("/www\\./i", "", $_SERVER["SERVER_NAME"]);
  164. $sm["config"]["theme"] = $sm["settings"]["desktopTheme"];
  165. $sm["config"]["currency"] = $sm["plugins"]["settings"]["currency"];
  166. if (isset($_GET["preset"])) {
  167. $checkPreset = checkIfExist("theme_preset", "preset", $_GET["preset"]);
  168. if ($checkPreset == 0) {
  169. header("Location: " . $site_url);
  170. exit;
  171. }
  172. $_SESSION["preset"] = $_GET["preset"];
  173. }
  174. if (!isset($_SESSION["preset"])) {
  175. $_SESSION["preset"] = $sm["settings"]["desktopThemePreset"];
  176. }
  177. if (isset($_GET["landingPreset"])) {
  178. $checkPreset = checkIfExist("theme_preset", "preset", $_GET["landingPreset"]);
  179. if ($checkPreset == 0) {
  180. header("Location: " . $site_url);
  181. exit;
  182. }
  183. $_SESSION["landingPreset"] = $_GET["landingPreset"];
  184. }
  185. if (!isset($_SESSION["landingPreset"])) {
  186. $_SESSION["landingPreset"] = $sm["settings"]["landingThemePreset"];
  187. }
  188. if (isset($_GET["landing"])) {
  189. $checkLanding = checkIfExist("config_themes", "folder", $_GET["landing"]);
  190. if ($checkLanding == 0) {
  191. header("Location: " . $site_url);
  192. exit;
  193. }
  194. $landingTheme = $_GET["landing"];
  195. } else {
  196. $_SESSION["landingPreset"] = $sm["settings"]["landingThemePreset"];
  197. }
  198. if (!isset($_GET["landing"])) {
  199. $landingTheme = $sm["settings"]["landingTheme"];
  200. }
  201. $sm["config"]["landing"] = $landingTheme;
  202. $themeFilter = "WHERE theme =\"" . $sm["settings"]["desktopTheme"] . "\" AND preset = \"" . $_SESSION["preset"] . "\"";
  203. $sm["theme"] = json_decode(getData("theme_preset", "theme_settings", $themeFilter), true);
  204. $landingThemeFilter = "WHERE theme =\"" . $landingTheme . "\" AND preset = \"" . $_SESSION["landingPreset"] . "\"";
  205. $sm["landing"] = json_decode(getData("theme_preset", "theme_settings", $landingThemeFilter), true);
  206. $sm["liveTheme"] = true;
  207. $themeLivePreset = $sm["settings"]["desktopThemePreset"];
  208. if ($_SESSION["preset"] != $themeLivePreset) {
  209. $sm["liveTheme"] = false;
  210. }
  211. $sm["config"]["fb_app_ok"] = 1;
  212. $sm["config"]["theme_mobile"] = $sm["settings"]["mobileTheme"];
  213. $sm["config"]["theme_email"] = $sm["settings"]["emailTheme"];
  214. $sm["config"]["theme_landing"] = $sm["config"]["landing"];
  215. $sm["config"]["logo"] = $sm["theme"]["logo"]["val"];
  216. $sm["config"]["title"] = siteconfig("title");
  217. $sm["config"]["description"] = siteconfig("description");
  218. $sm["config"]["keywords"] = siteconfig("keywords");
  219. $sm["config"]["lang"] = $sm["plugins"]["settings"]["defaultLang"];
  220. $sm["config"]["email"] = $sm["plugins"]["settings"]["siteEmail"];
  221. $sm["config"]["admin_url"] = $site_url . "administrator";
  222. $sm["config"]["theme_url"] = $site_url . "themes/" . $sm["config"]["theme"];
  223. $sm["config"]["theme_url_landing"] = $site_url . "themes/" . $sm["config"]["theme_landing"];
  224. $sm["config"]["theme_url_mobile"] = $site_url . "themes/" . $sm["config"]["theme_mobile"];
  225. $sm["config"]["theme_url_email"] = $site_url . "themes/" . $sm["config"]["theme_email"];
  226. $sm["config"]["ajax_path"] = $site_url . "requests";
  227. $sm["config"]["max_upload"] = getMaximumFileUploadSize();
  228. $sm["genders"] = siteGenders(1);
  229. $sm["interests"] = getSiteInterests();
  230. $sm["lang"] = siteLang($sm["config"]["lang"]);
  231. $sm["alang"] = applang($sm["config"]["lang"]);
  232. $sm["elang"] = emaillang($sm["config"]["lang"]);
  233. $sm["seoLang"] = seolang($sm["config"]["lang"]);
  234. $sm["landingLang"] = landinglang($sm["config"]["lang"], $landingTheme, $_SESSION["landingPreset"]);
  235. if (!isset($_SESSION["lang"])) {
  236. $_SESSION["lang"] = $sm["config"]["lang"];
  237. }
  238. $logged = false;
  239. $user = [];
  240. $available_languages = availableLanguages();
  241. $langs = prefered_language($available_languages, $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
  242. $lang = key($langs);
  243. if ($lang != "" && $sm["plugins"]["settings"]["browserLanguage"] == "Yes") {
  244. $_SESSION["lang"] = checkUserLang($lang);
  245. $sm["lang"] = siteLang(checkUserLang($lang));
  246. $sm["alang"] = applang(checkUserLang($lang));
  247. $sm["elang"] = emaillang(checkUserLang($lang));
  248. $sm["seoLang"] = seolang(checkUserLang($lang));
  249. $sm["landingLang"] = landinglang(checkUserLang($lang), $landingTheme, $_SESSION["landingPreset"]);
  250. } else {
  251. $_SESSION["lang"] = $sm["config"]["lang"];
  252. $sm["lang"] = siteLang($sm["config"]["lang"]);
  253. $sm["alang"] = applang($sm["config"]["lang"]);
  254. $sm["elang"] = emaillang($sm["config"]["lang"]);
  255. $sm["seoLang"] = seolang($sm["config"]["lang"]);
  256. $sm["landingLang"] = landinglang($sm["config"]["lang"], $landingTheme, $_SESSION["landingPreset"]);
  257. }
  258. if (isset($_SESSION["user"]) && is_numeric($_SESSION["user"]) && 0 < $_SESSION["user"]) {
  259. setcookie("user", $_SESSION["user"], 2147483647);
  260. getUserInfo($_SESSION["user"], 0);
  261. checkUserPremium($_SESSION["user"]);
  262. $sm["user_notifications"] = userNotifications($_SESSION["user"]);
  263. $_SESSION["lang"] = $sm["user"]["lang"];
  264. $sm["lang"] = siteLang($sm["user"]["lang"]);
  265. $sm["alang"] = applang($sm["user"]["lang"]);
  266. $sm["elang"] = emaillang($sm["user"]["lang"]);
  267. $sm["seoLang"] = seolang($sm["user"]["lang"]);
  268. $sm["landingLang"] = landinglang($sm["user"]["lang"], $landingTheme, $_SESSION["landingPreset"]);
  269. $sm["genders"] = siteGenders($sm["user"]["lang"]);
  270. $modPermission = [];
  271. if (1 <= $sm["user"]["admin"]) {
  272. $moderationList = getArray("moderation_list", "", "moderation ASC");
  273. foreach ($moderationList as $mod) {
  274. if ($sm["user"]["admin"] == 1) {
  275. $modPermission[$mod["moderation"]] = "Yes";
  276. } else {
  277. $modVal = getData("moderators_permission", "setting_val", "WHERE setting = \"" . $mod["moderation"] . "\" AND id = \"" . $sm["user"]["moderator"] . "\"");
  278. $modPermission[$mod["moderation"]] = $modVal;
  279. }
  280. }
  281. }
  282. $sm["moderator"] = $modPermission;
  283. $time = time();
  284. $logged = true;
  285. $ip = getUserIpAddr();
  286. if ($sm["user"]["ip"] != $ip) {
  287. $mysqli->query("UPDATE users set ip = '" . $ip . "' where id = '" . $_SESSION["user"] . "'");
  288. }
  289. if ($sm["user"]["last_access"] < $time || $sm["user"]["last_access"] == 0) {
  290. $mysqli->query("UPDATE users set last_access = '" . $time . "' where id = '" . $_SESSION["user"] . "'");
  291. }
  292. }
  293. $sm["logged"] = $logged;
  294. require_once "custom/app_core.php";
  295. if (!empty($_GET["lang"])) {
  296. $slang = secureEncode($_GET["lang"]);
  297. $_SESSION["lang"] = $slang;
  298. $sm["lang"] = siteLang($_SESSION["lang"]);
  299. $sm["alang"] = applang($_SESSION["lang"]);
  300. $sm["elang"] = emaillang($_SESSION["lang"]);
  301. $sm["genders"] = siteGenders($_SESSION["lang"]);
  302. $sm["seoLang"] = seolang($_SESSION["lang"]);
  303. $sm["landingLang"] = landinglang($_SESSION["lang"], $landingTheme, $_SESSION["landingPreset"]);
  304. if ($logged) {
  305. $mysqli->query("UPDATE users SET lang = '" . $slang . "' WHERE id = '" . $user_id . "'");
  306. }
  307. }
  308. if (!$logged) {
  309. unset($_SESSION["user"]);
  310. unset($user);
  311. }
  312. function appLang($lang)
  313. {
  314. global $mysqli;
  315. global $sm;
  316. $result = [];
  317. $lang = secureEncode($lang);
  318. $query = $mysqli->query("SELECT * FROM app_lang where lang_id = '" . $lang . "' ORDER BY id ASC");
  319. while ($row = $query->fetch_assoc()) {
  320. $result[$row["id"]] = ["id" => $row["id"], "text" => $row["text"]];
  321. }
  322. return $result;
  323. }
  324. function themeSetting($theme)
  325. {
  326. global $mysqli;
  327. global $sm;
  328. $result = [];
  329. $query = $mysqli->query("SELECT * FROM theme_settings where theme = '" . $theme . "'");
  330. while ($row = $query->fetch_assoc()) {
  331. $result[$row["setting"]] = ["val" => $row["setting_val"]];
  332. }
  333. return $result;
  334. }
  335. function sitePlugins()
  336. {
  337. global $mysqli;
  338. global $sm;
  339. $result = [];
  340. $query = $mysqli->query("SELECT * FROM plugins_settings");
  341. while ($row = $query->fetch_assoc()) {
  342. $filter = "where setting = \"" . $row["setting"] . "\" and plugin = \"" . $row["plugin"] . "\"";
  343. $clientSetting = getData("plugins_settings_values", "setting_val", $filter);
  344. if ($clientSetting == "noData") {
  345. $row["setting_val"] = $row["setting_val"];
  346. } else {
  347. $row["setting_val"] = $clientSetting;
  348. }
  349. if (isset($result[$row["plugin"]])) {
  350. $result[$row["plugin"]][$row["setting"]] = $row["setting_val"];
  351. } else {
  352. $result[$row["plugin"]] = [$row["setting"] => $row["setting_val"]];
  353. }
  354. }
  355. return $result;
  356. }
  357. function sitePlugin()
  358. {
  359. global $mysqli;
  360. global $sm;
  361. $result = [];
  362. $query = $mysqli->query("SELECT * FROM plugins");
  363. while ($row = $query->fetch_assoc()) {
  364. $result[] = $row;
  365. }
  366. return $result;
  367. }
  368. function isSecure()
  369. {
  370. if (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] !== "off" || $_SERVER["SERVER_PORT"] == 443) {
  371. return 1;
  372. }
  373. return 0;
  374. }
  375. function siteSettings()
  376. {
  377. global $mysqli;
  378. global $sm;
  379. $result = [];
  380. $query = $mysqli->query("SELECT * FROM settings");
  381. while ($row = $query->fetch_assoc()) {
  382. $result[$row["setting"]] = $row["setting_val"];
  383. }
  384. return $result;
  385. }
  386. function emailLang($lang)
  387. {
  388. global $mysqli;
  389. global $sm;
  390. $result = [];
  391. $lang = secureEncode($lang);
  392. $query = $mysqli->query("SELECT * FROM email_lang where lang_id = '" . $lang . "' ORDER BY id ASC");
  393. while ($row = $query->fetch_assoc()) {
  394. $result[$row["id"]] = ["id" => $row["id"], "text" => $row["text"]];
  395. }
  396. return $result;
  397. }
  398. function seoLang($lang)
  399. {
  400. global $mysqli;
  401. global $sm;
  402. $result = [];
  403. $lang = secureEncode($lang);
  404. $query = $mysqli->query("SELECT * FROM seo_lang where lang_id = '" . $lang . "' ORDER BY page ASC");
  405. while ($row = $query->fetch_assoc()) {
  406. $result[$row["page"]][$row["id"]] = ["text" => $row["text"]];
  407. }
  408. return $result;
  409. }
  410. function landingLang($lang, $theme, $preset)
  411. {
  412. global $mysqli;
  413. global $sm;
  414. $result = [];
  415. $lang = secureEncode($lang);
  416. $query = $mysqli->query("SELECT * FROM landing_lang where lang_id = '" . $lang . "' and theme = '" . $theme . "' and preset = '" . $preset . "' ORDER BY id ASC");
  417. if (isset($query->num_rows) && !empty($query->num_rows)) {
  418. while ($row = $query->fetch_assoc()) {
  419. $result[$row["id"]] = ["id" => $row["id"], "text" => $row["text"]];
  420. }
  421. } else {
  422. $query = $mysqli->query("SELECT * FROM landing_lang where lang_id = 1 and theme = '" . $theme . "' and preset = '" . $preset . "' ORDER BY id ASC");
  423. while ($row = $query->fetch_assoc()) {
  424. $result[$row["id"]] = ["id" => $row["id"], "text" => $row["text"]];
  425. }
  426. }
  427. return $result;
  428. }
  429. function siteConfig($val)
  430. {
  431. global $mysqli;
  432. global $sm;
  433. $config = $mysqli->query("SELECT * FROM config");
  434. $result = $config->fetch_object();
  435. return $result->{$val};
  436. }
  437. function checkDomainFile()
  438. {
  439. global $sm;
  440. global $wl;
  441. global $licenseErrorHtml;
  442. if (empty($_SERVER["HTTP_X_REQUESTED_WITH"]) || strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) != "xmlhttprequest") {
  443. if (!file_exists(__DIR__ . "/domain.php")) {
  444. $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);
  445. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "DOMAIN.PHP FILE NOT FOUND", $licenseErrorHtml);
  446. echo $licenseErrorHtml;
  447. exit;
  448. }
  449. if (!in_array($_SERVER["HTTP_HOST"], $wl)) {
  450. $filekey = file_get_contents(__DIR__ . "/domain.php");
  451. if ($sm["client"]["domainKey"] != $filekey) {
  452. $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);
  453. $licenseErrorHtml = str_replace("[INVALID-TITLE]", "WRONG DOMAIN KEY", $licenseErrorHtml);
  454. echo $licenseErrorHtml;
  455. exit;
  456. }
  457. }
  458. }
  459. }
  460. ?>