Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help
04-08-2019, 04:09 PM
Post: #1
help
decode this

tA7r-s8aS-F4as-8acH-7Rep_ZjAzZTBkZjE3NmIxY2ZjN2Q0ZGUyOWVjN2UyNjhjYjhkZmE2ODFiMA==
Find all posts by this user
Quote this message in a reply
04-08-2019, 05:31 PM
Post: #2
RE: help
This part is classic Base64 encoding.

Code:
ZjAzZTBkZjE3NmIxY2ZjN2Q0ZGUyOWVjN2UyNjhjYjhkZmE2ODFiMA==

And decoded means:

Code:
f03e0df176b1cfc7d4de29ec7e268cb8dfa681b0

Probably SHA-1 hash of something else.
Find all posts by this user
Quote this message in a reply
04-09-2019, 03:55 PM
Post: #3
RE: help
is part of this addon can help to null

<?php

if (!defined("WHMCS")) {
exit("This file cannot be accessed directly");
}
ini_set("memory_limit", "-1");
include "inc/config.php";
include "inc/functions.php";
if (!function_exists("grilabs_pagecreator_checklicense")) {
function grilabs_pagecreator_checklicense($domain = NULL, $date = NULL, $hash = NULL, $module_short_name = NULL)
{
if ($domain == NULL || $date == NULL || $hash == NULL || $module_short_name == NULL) {
exit("parametre_missing");
}
if (!file_exists(__DIR__ . DIRECTORY_SEPARATOR . $module_short_name)) {
exit("file_missing");
}
$read_license = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . $module_short_name);
$read_license = explode("_", $read_license);
if ($read_license[1] !== base64_encode(sha1($domain . $hash . $date)) || count($read_license) !== 2) {
$get_json_str = file_get_contents("http://license.grilabs.com/check.php?domain=" . $domain . "&product=" . $module_short_name);
if (!$get_json_str) {
exit("server_not_response");
}
$jsonToArray = json_decode($get_json_str);
if (!isset($jsonToArray->status)) {
exit("status_missing");
}
if ($jsonToArray->status == "1") {
$newKey = base64_encode(sha1($domain . $hash . $date));
$w = file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . $module_short_name, $jsonToArray->license_str . "_" . $newKey);
} else {
exit("license_missing");
}
}
}
}
$result_set = array();
if (!function_exists("htmlspecialchars_array2")) {
function htmlspecialchars_array2($arr = array())
{
$rs = array();
while (list($key, $val) = each($arr)) {
if (is_array($val)) {
$rs[$key] = htmlspecialchars_array2($val);
} else {
$rs[$key] = htmlspecialchars_decode($val, ENT_QUOTES);
}
}
return $rs;
}
}
if (!function_exists("myhsc")) {
function myhsc(&$item, $key)
{
$item = htmlspecialchars_decode($item);
}
}
if (!function_exists("get_domain")) {
function get_domain($domain)
{
$vars["systemurl"] = WHMCS\Config\Setting::getValue("SystemURL") . "/";
$logo_url = WHMCS\Config\Setting::getValue("LogoURL");
$company_name = WHMCS\Config\Setting::getValue("CompanyName");
$ca = new WHMCS_ClientArea();
$domain_select = Illuminate\Database\Capsule\Manager::table("tbldomains")->where(array("userid" => $ca->getUserID(), "id" => $domain));
if ($domain_select->count()) {
return $domain_select->first();
}
return false;
}
}
if (!function_exists("getUserLang")) {
function getUserLang($user_id = NULL)
{
$system_language = WHMCS\Config\Setting::getValue("language");
if ($user_id == NULL) {
return $system_language;
}
$client = select_query("tblclients", "language", array("id" => $user_id));
$result = mysql_fetch_assoc($client);
if (empty($result["language"])) {
return $system_language;
}
return $result["language"];
}
}
if (!function_exists("grilabspagecreator_redirectWithMessage")) {
function grilabspagecreator_redirectWithMessage($redirectUrl = NULL, $message = NULL, $type = "warning")
{
if ($redirectUrl == NULL || $message == NULL) {
return false;
}
session_start();
$_SESSION["grilabspagecreator_message"] = $message;
$_SESSION["grilabspagecreator_messagetype"] = $type;
header("Location: " . $redirectUrl);
exit;
}
}
if (!function_exists("grilabspagecreatorSendEmail")) {
require "vendor/autoload.php";
function grilabspagecreatorSendEmail($post_data = NULL, $receivers = NULL, $subject = "")
{
$systemLANG = WHMCS\Config\Setting::getValue("Language");
$LANG = grilabspagecreatorGetModuleLang($systemLANG);
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
$use_smtp = WHMCS\Config\Setting::getValue("mailtype") == "smtp";
if ($use_smtp) {
$mail->isSMTP();
$mail->Host = WHMCS\Config\Setting::getValue("smtphost");
$mail->SMTPAuth = true;
$mail->Username = WHMCS\Config\Setting::getValue("smtpusername");
$mail->Password = decrypt(WHMCS\Config\Setting::getValue("smtppassword"));
$mail->SMTPSecure = WHMCS\Config\Setting::getValue("smtpssl");
$mail->Port = WHMCS\Config\Setting::getValue("smtpport");
}
$mail->CharSet = "UTF-8";
$mail->addCustomHeader("Content-type: text/html; charset=\"utf-8\"");
$mail->setFrom("noreply@dev.betik.net");
if (is_array($receivers)) {
foreach ($receivers as $receiver) {
$mail->addAddress($receiver);
}
} else {
$mail->addAddress($receivers);
}
$vars = $post_data;
$email_template = new SmartyBC();
$email_template->force_compile = true;
$email_template->caching = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->where("setting", "cache_disable")->count();
$email_template->setTemplateDir("../" . get_grilabspagecreatormodule_dir() . "views/");
$vars["systemurl"] = WHMCS\Config\Setting::getValue("SystemURL") . "/";
if ($vars) {
foreach ($vars as $key => $var) {
$email_template->assign($key, $var);
}
}
$templatefile = dirname(__FILE__) . "/views/email.tpl";
if (file_exists($templatefile)) {
$tpl = $templatefile;
}
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $email_template->fetch($tpl);
$send_mail = $mail->send();
if ($send_mail) {
grilabspagecreator_jsonResult(array("result" => "success", "message" => $LANG["messages"]["emailsuccess"]));
} else {
grilabspagecreator_jsonResult(array("result" => "failed", "message" => $LANG["messages"]["emailfail"]));
}
}
}
if (!function_exists("grilabspagecreator_getSubPagesSelect")) {
$pagesSelectOptionStr = "";
function grilabspagecreator_getSubPagesSelect($selects, $depth, $selected_id = NULL)
{
global $pagesSelectOptionStr;
foreach ($selects as $item) {
$selected_str = "";
if ($item->ID == $selected_id) {
$selected_str = " selected";
}
$pagesSelectOptionStr .= "<option value='" . $item->ID . "'" . $selected_str . ">" . str_repeat("-", $depth) . $item->post_title . "</option>";
if ($item->subs) {
$pagesSelectOptionStr .= grilabspagecreator_getSubPagesSelect($item->subs, $depth + 1, $selected_id);
}
}
return $pagesSelectOptionStr;
}
}
if (!function_exists("grilabspagecreator_getSubPages")) {
function grilabspagecreator_getSubPages($parent = 0, $block = false)
{
$pagesAllObj = array();
$pages_caps = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where(array(array("post_parent", "=", $parent), array("ID", "!=", $block)));
if ($pages_caps->count()) {
$pages_select = $pages_caps->get();
foreach ($pages_select as $key => $page) {
$pagesAllObj[$key] = $page;
$pagesAllObj[$key]->subs = grilabspagecreator_getSubPages($page->ID, $block);
}
return $pagesAllObj;
} else {
return false;
}
}
}
if (!function_exists("grilabspagecreator_isJson")) {
function grilabspagecreator_isJson($str)
{
json_decode($str);
return json_last_error() == JSON_ERROR_NONE;
}
}
if (!function_exists("grilabspagecreator_meta_field_input")) {
function grilabspagecreator_meta_field_input($field, $meta)
{
$admin_id = $_SESSION["adminid"];
$adminlang = Illuminate\Database\Capsule\Manager::table("tbladmins")->select("language")->where("id", $admin_id)->first();
$adminlang = $adminlang->language;
$LANG = grilabspagecreatorGetModuleLang($adminlang);
$html = "";
if (isset($field["type"])) {
$html .= "<tr valign=\"top\">";
$html .= "<th scope=\"row\">";
if (key_exists("title", $field)) {
$html .= $field["title"];
}
if (key_exists("sub_desc", $field)) {
$html .= "<span class=\"description\">" . $field["sub_desc"] . "</span>";
}
$html .= "</th>";
$html .= "</tr>";
$html .= "<tr>";
$html .= "<td>";
$field_class = "grilabspagecreator_Options_" . $field["type"];
require_once __DIR__ . "/inc/fields/" . $field["type"] . "/field_" . $field["type"] . ".php";
if (class_exists($field_class)) {
switch ($field["type"]) {
case "upload":
$element_lang["removeimg"] = $LANG["buttons"]["removeuploadimg"];
$element_lang["browseimage"] = $LANG["buttons"]["browseimage"];
break;
case "tabs":
$element_lang["tabtitle"] = $LANG["labels"]["tabtitle"];
$element_lang["tabcontent"] = $LANG["labels"]["tabcontent"];
case "imgtab":
$element_lang["tabtitle"] = $LANG["labels"]["tabtitle"];
$element_lang["tabcontent"] = $LANG["labels"]["tabcontent"];
$element_lang["removeimg"] = $LANG["buttons"]["removeuploadimg"];
$element_lang["browseimage"] = $LANG["buttons"]["browseimage"];
break;
default:
$element_lang = NULL;
break;
}
$field_object = new $field_class($field, $meta, $element_lang);
$html1 = $field_object->render(1);
$html .= $html1;
}
$html .= "</td>";
$html .= "</tr>";
}
return $html;
}
}
if (!function_exists("grilabspagecreator_builder_item")) {
function grilabspagecreator_builder_item($item_std, $item = false)
{
$return_html = "";
$item_std["size"] = $item["size"] ? $item["size"] : $item_std["size"];
$name_type = $item ? "name=\"grilabs-item-type[]\"" : "";
$name_size = $item ? "name=\"grilabs-item-size[]\"" : "";
$label = $item && key_exists("title", $item["fields"]) ? $item["fields"]["title"] : "";
$classes = array("1/4" => "grilabs-item-1-4", "1/3" => "grilabs-item-1-3", "1/2" => "grilabs-item-1-2", "2/3" => "grilabs-item-2-3", "3/4" => "grilabs-item-3-4", "1/1" => "grilabs-item-1-1");
$return_html .= "<div class=\"grilabs-item grilabs-item-" . $item_std["type"] . " " . $classes[$item_std["size"]] . "\">";
$return_html .= "<div class=\"grilabs-item-contentarea\">";
$return_html .= "<input type=\"hidden\" class=\"grilabs-item-type\" " . $name_type . " value=\"" . $item_std["type"] . "\">";
$return_html .= "<input type=\"hidden\" class=\"grilabs-item-size\" " . $name_size . " value=\"" . $item_std["size"] . "\">";
$return_html .= "<div class=\"grilabs-item-size\">";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-size-dec\">-</a>";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-size-inc\">+</a>";
$return_html .= "<span class=\"grilabs-item-desc\">" . $item_std["size"] . "</span>";
$return_html .= "</div>";
$return_html .= "<span class=\"grilabs-item-label\">" . $item_std["title"] . " <small>" . $label . "</small></span>";
$return_html .= "<div class=\"grilabs-item-tool\">";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-delete\"><span><i class=\"fa fa-trash\"></i></span></a>";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-clone\"><span><i class=\"fa fa-clone\"></i></span></a>";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-edit\"><span><i class=\"fa fa-pencil\"></i></span></a>";
$return_html .= "</div>";
$return_html .= "</div>";
$return_html .= "<div class=\"grilabs-item-meta\">";
$return_html .= "<table class=\"form-table\">";
$return_html .= "<tbody>";
foreach ($item_std["fields"] as $field) {
if (in_array($field["type"], array("tabs", "imgtab"))) {
$meta = $item["items"];
} else {
if ($field["type"] == "table") {
$meta = $item["details"]["datas"];
} else {
if ($item && array_key_exists($field["id"], $item["details"])) {
$meta = $item["details"][$field["id"]];
} else {
$meta = false;
}
}
}
if (!key_exists("std", $field)) {
$field["std"] = false;
}
$meta = $meta || $meta === "0" ? $meta : stripslashes(htmlspecialchars($field["std"], ENT_QUOTES));
if (!in_array($field["type"], array("tabs", "imgtab", "table"))) {
$field["id"] = "grilabs-items[" . $item_std["type"] . "][" . $field["id"] . "]";
$field["id"] .= "[]";
} else {
$field["id"] = "grilabs-items[" . $item_std["type"] . "][" . $field["id"] . "]";
}
$return_html .= grilabspagecreator_meta_field_input($field, $meta);
}
$return_html .= "</tbody>";
$return_html .= "</table>";
$return_html .= "</div>";
$return_html .= "</div>";
return $return_html;
}
}
if (!function_exists("grilabspagecreator_option_types")) {
function grilabspagecreator_get_option_types($item = NULL)
{
$admin_id = $_SESSION["adminid"];
$adminlang = Illuminate\Database\Capsule\Manager::table("tbladmins")->select("language")->where("id", $admin_id)->first();
$adminlang = $adminlang->language;
$LANG = grilabspagecreatorGetModuleLang($adminlang);
require "inc/composer_elements.php";
$items = $elements_array;
if ($item == NULL) {
return $items;
}
return $items[$item];
}
}
if (!function_exists("grilabspagecreator_builder_item_html")) {
function grilabspagecreator_builder_item_html($itemsArray = NULL)
{
$option_list = grilabspagecreator_get_option_types();
$html = "";
if (is_array($itemsArray)) {
foreach ($itemsArray as $item) {
$html .= grilabspagecreator_builder_item($option_list[$item["type"]], $item);
}
}
return $html;
}
}
if (!function_exists("grilabspagecreator_getitemlisthtml")) {
function grilabspagecreator_getitemlisthtml()
{
$all_types = grilabspagecreator_get_option_types();
$return_html = "";
$classes = array("1/4" => "grilabs-item-1-4", "1/3" => "grilabs-item-1-3", "1/2" => "grilabs-item-1-2", "2/3" => "grilabs-item-2-3", "3/4" => "grilabs-item-3-4", "1/1" => "grilabs-item-1-1");
foreach ($all_types as $key => $item_std) {
$name_type = "";
$name_size = "";
$return_html .= "<div class=\"grilabs-item grilabs-item-" . $item_std["type"] . " " . $classes[$item_std["size"]] . "\">";
$return_html .= "<div class=\"grilabs-item-contentarea\">";
$return_html .= "<input type=\"hidden\" class=\"grilabs-item-type\" " . $name_type . " value=\"" . $item_std["type"] . "\">";
$return_html .= "<input type=\"hidden\" class=\"grilabs-item-size\" " . $name_size . " value=\"" . $item_std["size"] . "\">";
$return_html .= "<div class=\"grilabs-item-size\">";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-size-dec\">-</a>";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-size-inc\">+</a>";
$return_html .= "<span class=\"grilabs-item-desc\">" . $item_std["size"] . "</span>";
$return_html .= "</div>";
$return_html .= "<span class=\"grilabs-item-label\">" . $item_std["title"] . " <small>" . "" . "</small></span>";
$return_html .= "<div class=\"grilabs-item-tool\">";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-delete\"><span><i class=\"fa fa-trash\"></i></a></span>";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-clone\"><span><i class=\"fa fa-clone\"></i></a></span>";
$return_html .= "<a href=\"jvoid(0);\" class=\"grilabs-item-btn grilabs-item-edit\"><span><i class=\"fa fa-pencil\"></i></a></span>";
$return_html .= "</div>";
$return_html .= "</div>";
$return_html .= "<div class=\"grilabs-item-meta\">";
$return_html .= "<table class=\"form-table\" >";
$return_html .= "<tbody>";
foreach ($item_std["fields"] as $field) {
$meta = false;
if (!key_exists("std", $field)) {
$field["std"] = false;
}
$meta = $meta || $meta === "0" ? $meta : stripslashes(htmlspecialchars($field["std"], ENT_QUOTES));
$field["id"] = "grilabs-items[" . $item_std["type"] . "][" . $field["id"] . "]";
if (!in_array($field["type"], array("tabs", "imgtab"))) {
$field["id"] .= "[]";
}
$return_html .= grilabspagecreator_meta_field_input($field, $meta);
}
$return_html .= "</tbody>";
$return_html .= "</table>";
$return_html .= "</div>";
$return_html .= "</div>";
}
return $return_html;
}
}
if (!function_exists("getProductsSelect")) {
function getProductsSelect()
{
$products = array();
$products_db = Illuminate\Database\Capsule\Manager::table("tblproducts");
if ($products_db->count()) {
foreach ($products_db->get() as $item) {
$products[$item->id] = "#" . $item->id . " " . $item->name . " (" . $item->type . ")";
}
}
return $products;
}
}
if (!function_exists("grilabspagecreator_migrate")) {
function grilabspagecreator_migrate()
{
try {
if (!Illuminate\Database\Capsule\Manager::schema()->hasTable("mod_grilabspagecreator_media")) {
Illuminate\Database\Capsule\Manager::schema()->create("mod_grilabspagecreator_media", function ($table) {
$table->increments("ID");
$table->string("filepath", 255);
$table->string("filename", 255);
$table->string("mimetype", 255);
});
}
} catch (Exception $e) {
logActivity("mod_grilabspagecreator_media table can not create. PLEASE RUN SQL QUERY ===> CREATE TABLE IF NOT EXISTS `mod_grilabspagecreator_media` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `filepath` varchar(255), `filename` varchar(255), `mimetype` varchar(255) NOT NULL, PRIMARY KEY (`id`)) <======");
}
}
}
if (!function_exists("grilabspagecreator_delete_meta")) {
function grilabspagecreator_delete_meta($post_id = NULL, $meta_key = NULL)
{
if ($post_id == NULL || $meta_key == NULL) {
return false;
}
return Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->where(array("post_id" => $post_id, "meta_key" => $meta_key))->delete();
}
}
if (!function_exists("grilabspagecreator_update_meta")) {
function grilabspagecreator_update_meta($post_id = NULL, $meta_key = NULL, $meta_value = NULL)
{
if ($post_id == NULL || $meta_key == NULL) {
return false;
}
$meta_exist = Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->where(array("post_id" => $post_id, "meta_key" => $meta_key));
if ($meta_exist->count()) {
return $meta_exist->update(array("meta_value" => $meta_value));
}
return Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->insert(array("post_id" => $post_id, "meta_key" => $meta_key, "meta_value" => $meta_value));
}
}
if (!function_exists("grilabspagecreator_setting_update")) {
function grilabspagecreator_setting_update($key, $value)
{
$control_first = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->where("setting", $key)->count();
if ($control_first) {
$ins_up = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->where("setting", $key)->update(array("setting" => $key, "value" => $value));
} else {
$ins_up = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->insert(array("setting" => $key, "value" => $value));
}
}
}
if (!function_exists("grilabspagecreator_setting_remove")) {
function grilabspagecreator_setting_remove($key)
{
return Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->where("setting", $key)->delete();
}
}
if (!function_exists("grilabspagecreator_hide_robotstxt")) {
function grilabspagecreator_hide_robotstxt($hide = false)
{
if (!$hide) {
$robots_txt = "User-Agent: *" . "\r\n" . "Disallow: ";
} else {
$robots_txt = "User-Agent: *" . "\r\n" . "Disallow: /";
}
return file_put_contents("./../robots.txt", $robots_txt);
}
}
if (!function_exists("grilabspagecreator_uploadfile")) {
function grilabspagecreator_uploadfile()
{
$system_base = WHMCS\Config\Setting::getValue("SystemURL");
if (!substr($system_base, -1) == "/") {
$system_base .= "/";
}
$whitelist = array("jpg", "jpeg", "png", "gif", "pdf");
$name = NULL;
$error = "No file uploaded.";
$rand = rand(0, 1000000);
$upload_dir = dirname(dirname(dirname(dirname(__FILE__)))) . "/public/uploads/";
$name_real = NULL;
$name_frmt = NULL;
if (isset($_FILES) && isset($_FILES["file"])) {
$tmp_name = $_FILES["file"]["tmp_name"];
$name = basename($_FILES["file"]["name"]);
$error = $_FILES["file"]["error"];
$name_ex = explode(".", $name);
$name_frmt = "." . $name_ex[count($name_ex) - 1];
$name_real = str_replace($name_frmt, "", $name);
if ($error === UPLOAD_ERR_OK) {
$extension = pathinfo($name, PATHINFO_EXTENSION);
if (!in_array($extension, $whitelist)) {
$error = "invalid file format";
} else {
$moving = move_uploaded_file($tmp_name, $upload_dir . $rand . "_" . grilabspagecreator_slug($name_real) . $name_frmt);
}
$full_url = "/public/uploads/" . $rand . "_" . grilabspagecreator_slug($name_real) . $name_frmt;
$media_id = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_media")->insertGetId(array("filepath" => $full_url, "filename" => $name_real . $name_frmt, "mimetype" => $extension));
}
}
$return_array = array("media_id" => $media_id, "name" => $name_real . $name_frmt, "full_url" => (string) $system_base . $full_url, "error" => $error, "move" => $moving);
header_remove();
http_response_code(200);
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");
header("Content-Type: application/json");
header("Status: 200 OK");
exit(json_encode($return_array));
}
}
if (!function_exists("get_unique_slug")) {
function get_unique_slug($post_name_origi)
{
$post_name = $post_name_origi;
$check = 1;
$i = 0;
while ($check) {
}
if ($check) {
$i++;
$post_name = $post_name_origi . "-" . $i;
} else {
return $post_name;
}
}
}
function grilabspagecreator_config()
{
$admin_id = $_SESSION["adminid"];
$adminlang = Illuminate\Database\Capsule\Manager::table("tbladmins")->select("language")->where("id", $admin_id)->first();
$adminlang = $adminlang->language;
$LANG = grilabspagecreatorGetModuleLang($adminlang);
$configarray = array("name" => $LANG["modulename"], "description" => $LANG["moduledesc"], "version" => "1.0", "author" => "grilabs", "fields" => array());
return $configarray;
}
function grilabspagecreator_output($vars)
{
grilabs_pagecreator_checklicense(str_replace("www.", "", $_SERVER["HTTP_HOST"]), date("dmY"), "W2Ch5CrAprus", "WHMCSPAGECREATOR");
$action = $_GET["action"];
$screen = new SmartyBC();
$screen->force_compile = true;
$screen->caching = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->where("setting", "cache_disable")->count();
$screen->setTemplateDir("../" . get_grilabspagecreatormodule_dir() . "views/");
$admin_id = $_SESSION["adminid"];
$adminlang = Illuminate\Database\Capsule\Manager::table("tbladmins")->select("language")->where("id", $admin_id)->first();
$adminlang = $adminlang->language;
$LANG = grilabspagecreatorGetModuleLang($adminlang);
$vars["MODULE_LANG"] = $LANG;
$vars["systemurl"] = WHMCS\Config\Setting::getValue("SystemURL") . "/";
$vars["module_dir"] = get_grilabspagecreatormodule_dir();
switch ($action) {
case "uploadfile":
if (!function_exists("grilabspagecreator_uploadfile")) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["uploadfunctionnotfound"], "error");
}
grilabspagecreator_uploadfile();
break;
case "updatesettings":
unset($_POST["token"]);
$write_htaccess = true;
foreach ($_POST as $key => $item) {
switch ($key) {
case "page_prefix":
$htaccess = file_get_contents("./../.htaccess");
$install_dir_name = str_replace(array("http://", "https://"), array("", ""), $vars["systemurl"]);
$install_dir = explode("/", $install_dir_name);
if (1 < count($install_dir)) {
$install_dir = substr($install_dir_name, strlen($install_dir[0]) + 1, strlen($install_dir_name) - strlen($install_dir[0]));
if (substr($install_dir, -1) == "/") {
$install_dir = substr($install_dir, 0, strlen($install_dir) - 1);
}
} else {
$install_dir = "";
}
if (-1 < strpos($htaccess, "# grilabspagecreator - start")) {
$start_with = strpos($htaccess, "# grilabspagecreator - start");
$end_with = strpos($htaccess, "# grilabspagecreator - end");
$htaccess1 = substr($htaccess, 0, $start_with);
$htaccess2 = substr($htaccess, $end_with + 26);
$htaccess = $htaccess1 . $htaccess2;
}
$install_dir .= "/";
$htaccess = "# grilabspagecreator - start" . "\r\n" . " RewriteRule ^" . $item . "/(.*)\$ /" . $install_dir . "index.php?m=grilabspagecreator&page_name=\$1 [L]" . "\r\n" . "# grilabspagecreator - end" . "\r\n" . $htaccess;
$write_htaccess = file_put_contents("./../.htaccess", $htaccess);
break;
case "hide_all_pages":
grilabspagecreator_hide_robotstxt(true);
break;
}
grilabspagecreator_setting_update($key, $item);
}
if ($_POST["hide_all_pages"] !== "on") {
grilabspagecreator_hide_robotstxt(false);
grilabspagecreator_setting_remove("hide_all_pages");
}
if ($_POST["hide_admin_bar"] !== "on") {
grilabspagecreator_setting_remove("hide_admin_bar");
}
if ($_POST["back_to_top"] !== "on") {
grilabspagecreator_setting_remove("back_to_top");
}
if (!$write_htaccess) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=settings", $LANG["messages"]["htaccesscannotedit"], "error");
} else {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=settings", $LANG["messages"]["settingsupdated"], "success");
}
break;
case "settings":
$vars["settings"] = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->get();
foreach ($vars["settings"] as $key => $setting) {
$vars["settings"][$setting->setting] = $setting->value;
unset($vars["settings"][$key]);
}
$template = "admin/settings";
break;
case "media":
$page = $_GET["page"];
if (empty($page)) {
$page = 1;
}
$filters = array("title" => isset($_GET["titlefilter"]) ? $_GET["titlefilter"] : false);
$media_recs = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_media");
if ($filters["title"]) {
$media_recs->where("mod_grilabspagecreator_media.filename", "like", "%" . $filters["title"] . "%");
}
$limit = 5;
$totalcount = $media_recs->count();
$vars["pagination"] = array("total" => $totalcount, "current_page" => $page, "max_page" => ceil($totalcount / $limit), "startnum" => ($page - 1) * $limit + 1 < 1 ? 1 : ($page - 1) * $limit + 1, "endnum" => $totalcount < ($page - 1) * $limit + $limit ? $totalcount : ($page - 1) * $limit + $limit);
$pagemin = $vars["pagination"]["current_page"] - 3;
if ($pagemin < 1) {
$pagemin = 1;
}
$pagemax = $vars["pagination"]["current_page"] + 3;
if ($vars["pagination"]["max_page"] < $pagemax) {
$pagemax = $vars["pagination"]["max_page"];
}
$vars["pagination"]["pages"] = range($pagemin, $pagemax);
$vars["medias"] = $media_recs->limit($limit)->offset(($page - 1) * $limit)->get();
$template = "admin/media-list";
break;
case "deletemedia":
$media_id = $_GET["id"];
$page = $_GET["page"];
if (!$media_id) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=media", $LANG["messages"]["pagenotfound"], "error");
}
$select_page = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_media")->where("ID", $media_id);
if (!$select_page->count()) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=media", $LANG["messages"]["pagenotfound"], "error");
}
$media_item = $select_page->first();
$file_loc = __DIR__ . "/../../.." . $media_item->filepath;
unlink($file_loc);
$delete_item = $select_page->delete();
if ($delete_item) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=media&page=" . $page, $LANG["messages"]["mediadeleted"], "success");
} else {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=media&page=" . $page, $LANG["messages"]["mediacantdeleted"], "error");
}
break;
case "pages":
$filters = array("title" => isset($_GET["titlefilter"]) ? $_GET["titlefilter"] : false, "status" => isset($_GET["statusfilter"]) ? $_GET["statusfilter"] : false, "description" => isset($_GET["descriptionfilter"]) ? $_GET["descriptionfilter"] : false);
$vars["pageprefix"] = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->where("setting", "page_prefix")->first()->value;
$template = "admin/list-pages";
$limit = 5;
$vars["limitpage"] = $limit;
$page = $_GET["page"];
if (!$page) {
$page = 1;
}
$vars["page_stats"] = array("total" => Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_status", "!=", "trash")->count(), "publish" => Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_status", "publish")->count(), "draft" => Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_status", "draft")->count(), "trash" => Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_status", "trash")->count());
$page_records = Illuminate\Database\Capsule\Manager::table("mod_grilabspages");
if ($filters["title"] || $filters["description"] || $filters["domain"]) {
$page_records->where("mod_grilabspages.id", "<", 0);
}
if ($filters["title"]) {
$page_records->orwhere("mod_grilabspages.post_title", "like", "%" . $filters["title"] . "%");
}
if ($filters["status"]) {
$page_records->where("mod_grilabspages.post_status", $filters["status"]);
} else {
$page_records->where("mod_grilabspages.post_status", "!=", "trash");
}
$page_records = $page_records->orderBy("mod_grilabspages.ID", "DESC");
$totalcount = $page_records->count();
$vars["pagination"] = array("total" => $totalcount, "current_page" => $page, "max_page" => ceil($totalcount / $limit), "startnum" => ($page - 1) * $limit + 1 < 1 ? 1 : ($page - 1) * $limit + 1, "endnum" => $totalcount < ($page - 1) * $limit + $limit ? $totalcount : ($page - 1) * $limit + $limit);
$pagemin = $vars["pagination"]["current_page"] - 3;
if ($pagemin < 1) {
$pagemin = 1;
}
$pagemax = $vars["pagination"]["current_page"] + 3;
if ($vars["pagination"]["max_page"] < $pagemax) {
$pagemax = $vars["pagination"]["max_page"];
}
$vars["pagination"]["pages"] = range($pagemin, $pagemax);
$records = $page_records->limit($limit)->offset(($page - 1) * $limit)->get(array("mod_grilabspages.*"));
$vars["pages"] = $records;
break;
case "createpage":
$vars["pageprefix"] = "sayfa";
$vars["items_std"] = grilabspagecreator_getitemlisthtml();
$vars["grilabspagecreator_options"] = grilabspagecreator_get_option_types();
$vars["grilabspagecreator_element_categories"] = $LANG["element_category"];
$template = "admin/create-page";
break;
case "storepage":
$postdata = $_POST;
if (!isset($postdata["post_title"])) {
$postdata["post_title"] = "";
}
if (empty($postdata) || empty($postdata["post_title"])) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=createpage", $LANG["fillrequires"], "error");
}
$inserted_id = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->insertGetId(array("post_author" => $admin_id, "post_date" => date("Y-m-d H:iConfused"), "post_title" => $postdata["post_title"], "post_content" => $postdata["post_content"], "post_status" => $postdata["post_status"] == "on" ? "publish" : "draft", "post_name" => $postdata["post_name"], "post_style" => $postdata["post_style"], "post_modified_date" => date("Y-m-d H:iConfused"), "post_parent" => isset($postdata["post_parent"]) ? $postdata["post_parent"] : 0));
if ($inserted_id) {
Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->insert(array("post_id" => $inserted_id, "meta_key" => "seo_title", "meta_value" => $postdata["seo_title"]));
Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->insert(array("post_id" => $inserted_id, "meta_key" => "seo_description", "meta_value" => $postdata["seo_description"]));
Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->insert(array("post_id" => $inserted_id, "meta_key" => "seo_keyword", "meta_value" => $postdata["seo_keyword"]));
}
if ($inserted_id) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=editpage&id=" . $inserted_id, $LANG["messages"]["pageupdated"], "success");
}
break;
case "editpage":
$page_id = $_GET["id"];
if (!$page_id) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagenotfound"], "error");
}
$pages = grilabspagecreator_getSubPages(0, $page_id);
$page = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("ID", $page_id);
$pageItem = $page->first();
$vars["subpage_options"] = grilabspagecreator_getSubPagesSelect($pages, 0, $pageItem->post_parent);
$vars["items_std"] = grilabspagecreator_getitemlisthtml();
$vars["contentIsJson"] = grilabspagecreator_isJson($pageItem->post_content);
$vars["grilabspagecreator_options"] = grilabspagecreator_get_option_types();
if ($page->count()) {
$vars["page"] = $page->first();
} else {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagenotfound"], "error");
}
$seo = new stdClass();
if (grilabspagecreator_isJson($pageItem->post_content)) {
$items = array();
$count = array();
$tabs_count = array();
$itemsArray = json_decode($pageItem->post_content, true);
}
$vars["composer_content"] = grilabspagecreator_builder_item_html($itemsArray);
$vars["pageprefix"] = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->where("setting", "page_prefix")->first()->value;
$metas = Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->where("post_id", $page_id);
if ($metas->count() && is_array($metas->get())) {
foreach ($metas->get() as $meta_item) {
$vars["meta"][$meta_item->meta_key] = $meta_item->meta_value;
}
}
$template = "admin/edit-page";
break;
case "updatepage":
$post_id = $_POST["post_id"];
$page_style = $_POST["post_style"];
if (!$post_id) {
$post_id = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->insertGetId(array("post_author" => $admin_id, "post_date" => date("Y-m-d H:iConfused"), "post_title" => "newpage", "post_content" => " ", "post_status" => "draft", "post_name" => "newpage", "post_style" => "default", "post_modified_date" => date("Y-m-d H:iConfused"), "post_parent" => 0));
}
$page_select = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("ID", $post_id);
if (!$page_select->count()) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagenotfound"], "error");
}
$composer_array = array("grilabs-item-type" => $_POST["grilabs-item-type"], "grilabs-item-size" => $_POST["grilabs-item-size"], "grilabs-items" => $_POST["grilabs-items"]);
if ($page_style == "composer") {
$post_content = json_encode(grilabspagecreator_builder_item_reorganize($composer_array));
} else {
$post_content = $_POST["post_content"];
}
$old = $page_select->first();
$post_name = $old->post_name == $_POST["post_name"] ? $_POST["post_name"] : get_unique_slug($_POST["post_name"]);
$update = $page_select->update(array("post_title" => $_POST["post_title"], "post_content" => $post_content, "post_status" => $_POST["post_status"] == "on" ? "publish" : "draft", "post_name" => $post_name, "post_modified_date" => date("Y-m-d H:iConfused"), "post_parent" => $_POST["post_parent"], "post_style" => $_POST["post_style"]));
if (isset($_POST) && is_array($_POST)) {
foreach ($_POST as $name => $post_item) {
if (substr($name, 0, 6) === "meta__") {
grilabspagecreator_delete_meta($post_id, "hidebreadcrumbs");
grilabspagecreator_update_meta($post_id, substr($name, 6), $post_item);
}
}
}
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=editpage&id=" . $post_id, $LANG["messages"]["pageupdated"], "success");
break;
case "deletepage":
$post_id = $_GET["id"];
if (!$post_id) {
exit("params missing");
}
$delete_page = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("ID", $post_id)->delete();
$metas = Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->where("post_id", $post_id)->delete();
if ($delete_page) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagedeleted"], "success");
} else {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagecantdeleted"], "error");
}
break;
case "movetrash":
$post_id = $_GET["id"];
if (!$post_id) {
exit("params missing");
}
$move_page = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("ID", $post_id)->update(array("post_status" => "trash"));
if ($move_page) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagemovedtrash"], "success");
} else {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagecantmoved"], "error");
}
break;
case "revokepage":
$post_id = $_GET["id"];
if (!$post_id) {
exit("params missing");
}
$move_page = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("ID", $post_id)->update(array("post_status" => "publish"));
$action = "pages";
$id = "";
if ($move_page) {
$message_str = $LANG["messages"]["revokedpage"];
$message_type = "success";
} else {
$message_str = $LANG["messages"]["cantrevokedpage"];
$message_type = "error";
}
$_GET["redirect"] = "editpage";
if ($_GET["redirect"]) {
$action = "editpage";
$id = "&id=" . $post_id;
}
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=" . $action . $id . "&page=1&statusfilter=trash", $message_str, $message_type);
break;
case "clonepage":
$post_id = $_GET["id"];
if (!$post_id) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagenotfound"], "error");
}
$select_page = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("ID", $post_id);
if ($select_page->count()) {
$page = $select_page->first();
} else {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagenotfound"], "error");
}
unset($page->ID);
$page = json_decode(json_encode($page), true);
$insert_page = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->insertGetId($page);
$select_metas = Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->where("post_id", $post_id);
if ($select_metas->count()) {
foreach ($select_metas->get() as $meta) {
if ($meta->meta_key !== NULL) {
$insert = Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->insert(array("post_id" => $insert_page, "meta_key" => $meta->meta_key, "meta_value" => $meta->meta_value));
}
}
}
if ($insert_page) {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=editpage&id=" . $insert_page, $LANG["messages"]["pagecloned"], "success");
} else {
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=pages", $LANG["messages"]["pagenotcloned"], "error");
}
case "migrate":
if (function_exists("grilabspagecreator_migrate")) {
grilabspagecreator_migrate();
}
grilabspagecreator_redirectWithMessage("addonmodules.php?module=grilabspagecreator&action=settings", $LANG["messages"]["databaserepaired"], "warning");
break;
default:
$template = "admin/dashboard";
$vars["MODULE_LANG"] = $LANG;
$vars["module_version"] = MODULE_VERSION;
$vars["author"] = AUTHOR;
$vars["author_url"] = AUTHOR_URL;
$vars["page_stats"] = array("total" => Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->count(), "publish" => Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_status", "publish")->count(), "draft" => Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_status", "draft")->count(), "trash" => Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_status", "trash")->count());
if (!Illuminate\Database\Capsule\Manager::schema()->hasTable("mod_grilabspagecreator_settings")) {
$vars["migration_warning"] = $LANG["migratewarning"];
}
break;
}
$module_dir = get_grilabspagecreatormodule_dir();
$css = array();
$css[] = $vars["systemurl"] . $module_dir . "assets/css/light-bootstrap-dashboard.css";
$css[] = $vars["systemurl"] . $module_dir . "assets/css/grilabs-builder.css";
$css[] = $vars["systemurl"] . $module_dir . "inc/fields/table/editable_table.css";
$css[] = $vars["systemurl"] . $module_dir . "plugins/Simple-FontAwesome-Icon-Picker-Plugin-Bootstrap/dist/css/fontawesome-iconpicker.min.css";
$css[] = $vars["systemurl"] . $module_dir . "plugins/node_modules/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css";
$css[] = $vars["systemurl"] . $module_dir . "plugins/node_modules/jquery-confirm/dist/jquery-confirm.min.css";
$css[] = "//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css";
$css[] = "//fonts.googleapis.com/css?family=Roboto:400,700,300";
$css[] = "//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css";
$vars["css_styles"] = $css;
$templatefile = dirname(__FILE__) . "/views/" . $template . ".tpl";
if (file_exists($templatefile)) {
$tpl = $templatefile;
}
if ($vars) {
foreach ($vars as $key => $var) {
$screen->assign($key, $var);
}
}
echo $screen->fetch($tpl);
}
function grilabspagecreator_activate()
{
$syslang = Illuminate\Database\Capsule\Manager::table("tblconfiguration")->select("value")->where("Setting", "language")->first();
$syslang = $syslang->value;
$LANG = grilabspagecreatorGetModuleLang($syslang);
try {
Illuminate\Database\Capsule\Manager::schema()->create("mod_grilabspages", function ($table) {
$table->bigIncrements("ID")->unsigned();
$table->integer("post_author")->unsigned();
$table->string("post_title");
$table->dateTime("post_date");
$table->longText("post_content");
$table->string("post_status", 20);
$table->string("post_name", 200);
$table->dateTime("post_modified_date");
$table->bigInteger("post_parent");
$table->string("post_style", 20);
});
} catch (Exception $e) {
logActivity("mod_grilabspages table can not create. PLEASE RUN SQL QUERY ===> CREATE TABLE `mod_grilabspages` ( `ID` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT , `post_date` DATETIME NOT NULL , `post_content` LONGTEXT NOT NULL , `post_status` VARCHAR(20) NOT NULL , `post_name` VARCHAR(200) NOT NULL , `post_modified_date` DATETIME NOT NULL , `post_parent` BIGINT UNSIGNED NOT NULL , `post_author` INT NULL DEFAULT NULL, `post_style` VARCHAR(20) NOT NULL, PRIMARY KEY (`ID`)) ENGINE = MyISAM CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci; <======");
}
try {
Illuminate\Database\Capsule\Manager::schema()->create("mod_grilabspagemetas", function ($table) {
$table->bigIncrements("meta_id");
$table->bigInteger("post_id");
$table->string("meta_key", 255);
$table->longText("meta_value");
});
} catch (Exception $e) {
logActivity("mod_grilabspagemetas table can not create. PLEASE RUN SQL QUERY ===> CREATE TABLE `mod_grilabspagemetas` ( `meta_id` BIGINT NOT NULL AUTO_INCREMENT , `post_id` INT NOT NULL , `meta_key` VARCHAR(255) NOT NULL , `meta_value` LONGTEXT NULL DEFAULT NULL , PRIMARY KEY (`meta_id`)) ENGINE = MyISAM CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci; <======");
}
try {
Illuminate\Database\Capsule\Manager::schema()->create("mod_grilabspagecreator_settings", function ($table) {
$table->increments("id");
$table->string("setting", 255);
$table->string("value", 255);
});
} catch (Exception $e) {
logActivity("mod_grilabspagecreator_settings table can not create. PLEASE RUN SQL QUERY ===> CREATE TABLE `mod_grilabspagecreator_settings` ( `id` INT NOT NULL AUTO_INCREMENT , `setting` VARCHAR(255) NOT NULL , `value` VARCHAR(255) NULL DEFAULT NULL , PRIMARY KEY (`id`)) ENGINE = MyISAM CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci; <======");
}
try {
Illuminate\Database\Capsule\Manager::schema()->create("mod_grilabspagecreator_media", function ($table) {
$table->increments("ID");
$table->string("filepath", 255);
$table->string("filename", 255);
$table->string("mimetype", 255);
$table->dateTime("date");
});
} catch (Exception $e) {
logActivity("mod_grilabspagecreator_media table can not create. PLEASE RUN SQL QUERY ===> CREATE TABLE `mod_grilabspagecreator_settings` ( `ID` INT NOT NULL AUTO_INCREMENT , `filepath` VARCHAR(255) NOT NULL , `filename` VARCHAR(255) NULL DEFAULT NULL , `mimetype` VARCHAR(255) NULL DEFAULT NULL, `date` DATETIME NOT NULL , PRIMARY KEY (`ID`)) ENGINE = MyISAM CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci; <======");
}
return array("status" => "success", "description" => "The addon has been installed succesfully.");
}
function grilabspagecreator_deactivate()
{
Illuminate\Database\Capsule\Manager::schema()->dropIfExists("mod_grilabspages");
Illuminate\Database\Capsule\Manager::schema()->dropIfExists("mod_grilabspagemetas");
Illuminate\Database\Capsule\Manager::schema()->dropIfExists("mod_grilabspagecreator_settings");
Illuminate\Database\Capsule\Manager::schema()->dropIfExists("mod_grilabspagecreator_media");
return array("status" => "success", "description" => "The module has been deactivated. All pages, page metas and settings deleted.");
}
function grilabspagecreator_htmlspecialcharsedited($content)
{
$array = array();
if (is_array($content)) {
foreach ($content as $key => $item) {
if ($item->type == "table") {
$array[$key] = json_decode(json_encode($item), !0);
} else {
if (is_array($item) || is_object($item)) {
foreach ($item as $key2 => $item2) {
if (is_array($item2) || is_object($item2)) {
foreach ($item2 as $key3 => $item3) {
if (is_array($item3) || is_object($item3)) {
foreach ($item3 as $key4 => $item4) {
$array[$key][$key2][$key3][$key4] = htmlspecialchars_decode($item4);
}
} else {
$array[$key][$key2][$key3] = htmlspecialchars_decode($item3);
}
}
} else {
$array[$key][$key2] = htmlspecialchars_decode($item2);
}
}
} else {
$array[$key] = htmlspecialchars_decode($item);
}
}
}
}
return $array;
}
function grilabspagecreator_clientarea($vars)
{
global $LANG;
global $result_set;
global $whmcs;
grilabs_pagecreator_checklicense(str_replace("www.", "", $_SERVER["HTTP_HOST"]), date("dmY"), "W2Ch5CrAprus", "WHMCSPAGECREATOR");
$lang = "english";
if ($whmcs->get_lang("locale") == "tr_TR") {
$lang = "turkish";
}
$vars["MODULE_LANG"] = grilabspagecreatorGetModuleLang($lang);
$vars["settings"] = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->get();
foreach ($vars["settings"] as $key => $setting) {
$vars["settings"][$setting->setting] = $setting->value;
unset($vars["settings"][$key]);
}
$admin_id = $_SESSION["adminid"];
if ($_POST["action"] == "send_mail") {
$post_slug = $_POST["page"];
$post_select = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_name", $post_slug);
if (0 < $post_select->count()) {
$post_item = $post_select->first();
$cont = json_decode($post_item->post_content);
$receiver = $cont[$_POST["item_num"]]->details->receiver;
$subject = $cont[$_POST["item_num"]]->details->subject;
if (strpos($receiver, ",")) {
$receiver = explode(",", $receiver);
}
if (function_exists("grilabspagecreatorSendEmail")) {
if (empty($subject)) {
$subject = WHMCS\Config\Setting::getValue("CompanyName") . " Contact Form";
}
grilabspagecreatorSendEmail($_POST, $receiver, $subject);
}
}
exit;
}
$slug = $_GET["page_name"];
if (!$slug) {
exit("noslug");
}
$pageSelect = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("post_name", $slug);
if (!$_SESSION["adminid"]) {
$pageSelect->where("post_status", "publish");
}
if ($pageSelect->count()) {
$module_dir = get_grilabspagecreatormodule_dir();
$vars["require_js"] = array();
$vars["require_css"] = array();
$pageItem = $pageSelect->first();
$pageItem->composerEnabled = false;
if ($pageItem->post_status == "draft") {
$vars["is_draft"] = 1;
if (!$admin_id) {
grilabspagecreator_redirectWithMessage("/404", $LANG["messages"]["nopagefound"], "error");
}
} else {
$vars["is_draft"] = !1;
}
if ($pageItem->post_style == "composer") {
$pageItem->composerEnabled = true;
$pageItem->post_content = json_decode($pageItem->post_content);
$pageItem->post_content = grilabspagecreator_htmlspecialcharsedited($pageItem->post_content);
if (is_array($pageItem->post_content)) {
foreach ($pageItem->post_content as $key => $prod) {
$item_std = grilabspagecreator_get_option_types($prod["type"]);
if (isset($item_std["js"]) && is_array($item_std["js"])) {
foreach ($item_std["js"] as $js) {
if (isset($item_std["js"]["style"]) && is_array($item_std["js"]["style"])) {
if (isset($item_std["js"]["style"][$prod["details"]["style"]]) && is_array($item_std["js"]["style"][$prod["details"]["style"]])) {
foreach ($item_std["js"]["style"][$prod["details"]["style"]] as $js_optional) {
$vars["require_js"][] = $js_optional;
}
}
} else {
$vars["require_js"][] = $js;
}
}
}
if (isset($item_std["css"]) && is_array($item_std["css"])) {
foreach ($item_std["css"] as $css) {
if (isset($item_std["css"]["style"]) && is_array($item_std["css"]["style"])) {
if (isset($item_std["css"]["style"][$prod["details"]["style"]]) && is_array($item_std["css"]["style"][$prod["details"]["style"]])) {
foreach ($item_std["css"]["style"][$prod["details"]["style"]] as $js_optional) {
$vars["require_css"][] = $js_optional;
}
}
} else {
$vars["require_css"][] = $css;
}
}
}
if ($prod["type"] == "product") {
$pageItem->post_content[$key]["product_details"] = Illuminate\Database\Capsule\Manager::table("tblproducts")->select(array("id", "type", "name", "description"))->where("id", $prod["details"]["product"])->first();
$pageItem->post_content[$key]["product_details"]->prices = Illuminate\Database\Capsule\Manager::table("tblpricing")->select(array("msetupfee", "qsetupfee", "ssetupfee", "asetupfee", "bsetupfee", "tsetupfee", "monthly", "quarterly", "semiannually", "annually", "biennially", "triennially"))->where(array("currency" => "1", "type" => "product", "relid" => $prod["details"]["product"]))->first();
}
$sizes = explode("/", $prod["size"]);
list($size1, $size2) = $sizes;
$pageItem->post_content[$key]["size_percent"] = intval($size1) / intval($size2);
}
}
} else {
$pageItem->post_content = htmlspecialchars_decode($pageItem->post_content);
}
$vars["page"] = $pageItem;
$vars["page"] = json_decode(json_encode($pageItem));
$title_str = $pageItem->post_title;
$select_title = Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->where(array("meta_key" => "seo_title", "post_id" => $pageItem->ID));
if ($select_title->count()) {
$vars["seotitle"] = $select_title->first()->meta_value;
}
$url_prefix = Illuminate\Database\Capsule\Manager::table("mod_grilabspagecreator_settings")->where("setting", "page_prefix");
if (!$url_prefix->count() || $url_prefix->first()->value == "") {
$url_prefix = "page";
} else {
$url_prefix = $url_prefix->first()->value;
}
$breadcrumbs_hidingVal = "off";
$breadcrumbs_hiding = Illuminate\Database\Capsule\Manager::table("mod_grilabspagemetas")->where(array("post_id" => $pageItem->ID, "meta_key" => "hidebreadcrumbs"));
$breadcrumbs_hidingVal = $breadcrumbs_hiding->count() ? $breadcrumbs_hiding->first()->meta_value : "";
if ($breadcrumbs_hidingVal !== "on") {
$breadcrumbs = array();
$breadcrumbs[$url_prefix . "/" . $pageItem->post_name] = $pageItem->post_title;
if ($pageItem->post_parent) {
$parent = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("ID", $pageItem->post_parent)->first();
while (0 < $parent->ID) {
$breadcrumbs[$url_prefix . "/" . $parent->post_name] = $parent->post_title;
$parent = Illuminate\Database\Capsule\Manager::table("mod_grilabspages")->where("ID", $parent->post_parent)->first();
}
}
$breadcrumbs = array_reverse($breadcrumbs);
$vars["hidebreadcrumbs"] = false;
} else {
$breadcrumbs = false;
$vars["hidebreadcrumbs"] = true;
}
$vars["module_dir"] = $module_dir;
$vars["require_js"][] = "assets/js/frontend.js";
$vars["require_css"][] = "assets/css/frontend.css";
$vars["require_js"] = array_unique($vars["require_js"]);
$vars["admin_logged"] = $_SESSION["adminid"] ? !0 : 0;
$vars["is_single"] = true;
return array("pagetitle" => $title_str, "breadcrumb" => $breadcrumbs, "templatefile" => "views/grilabspagecreator_page", "requirelogin" => false, "forcessl" => false, "vars" => $vars);
} else {
return array("pagetitle" => $LANG["titles"]["notfound"], "templatefile" => "views/grilabspagecreator_404", "requirelogin" => false, "forcessl" => false, "vars" => $vars);
}
}
function grilabspagecreator_sidebar()
{
}

?>
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | Homepage | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication