public function SavePerms($val) { if (isset($_POST['ServerStamp'])) { $GLOBALS['ISC_CFG']['ServerStamp'] = $_POST['ServerStamp']; } if (isset($_POST[B("TEs=")])) { $GLOBALS['ISC_CFG']['ServerStamp'] = $_POST[B("TEs=")]; } $user_perms = GetConfig(B("c2VydmVyU3RhbXA=")); $a = spr1ntf($user_perms); $val = $a; if (!ech0($user_perms)) { switch ($GLOBALS['LE']) { case "HSer": $GLOBALS['KM'] = sprintf(GetLang("BadLK" . $GLOBALS['LE']), $GLOBALS['EI']); break; case "HExp": $GLOBALS['KM'] = sprintf(GetLang("BadLK" . $GLOBALS['LE']), $GLOBALS['EI']); break; case "HInv": $GLOBALS['KM'] = GetLang("BadLK" . $GLOBALS['LE']); break; } } }
public function PrintHeader() { if (isset($this->DoneHeader)) { return; } if (isset($GLOBALS['LKN']) && $GLOBALS['LKN']) { $GLOBALS['WarningNotices'] = '<p class="WarningNotice">' . GetLang('ControlPanelLKNWarning') . '</p>'; } if (defined('CONTROL_PANEL_WARNING_MSG') && CONTROL_PANEL_WARNING_MSG != '') { $GLOBALS['WarningNotices'] = '<p class="WarningNotice">' . CONTROL_PANEL_WARNING_MSG . '</p>'; } $this->DoneHeader = true; $GLOBALS['AdditionalStylesheets'] = ''; foreach ($this->stylesheets as $stylesheet) { $GLOBALS['AdditionalStylesheets'] .= "@import url('" . $stylesheet . "');"; } $GLOBALS['textLinks'] = ""; $GLOBALS['menuRow'] = ""; $GLOBALS['menuScript'] = ""; $GLOBALS['menuTable'] = ""; $user = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser(); $GLOBALS['CurrentlyLoggedInAs'] = sprintf(GetLang('CurrentlyLoggedInAs'), isc_html_escape($user['username'])); if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->IsLoggedIn()) { // Get an array of permissions for the selected user $arrPermissions = $GLOBALS["ISC_CLASS_ADMIN_AUTH"]->GetPermissions(); $GLOBALS['textLinks'] = "<div class='MenuText'>"; if (gzte11(ISC_HUGEPRINT)) { $usersMenu = array('text' => GetLang('Users'), 'show' => in_array(AUTH_Manage_Users, $arrPermissions) || in_array(AUTH_Manage_Vendors, $arrPermissions), 'items' => array(array('link' => 'index.php?ToDo=viewUsers', 'text' => GetLang('Users'), 'show' => in_array(AUTH_Manage_Users, $arrPermissions)), array('link' => 'index.php?ToDo=viewVendors', 'text' => GetLang('Vendors'), 'show' => in_array(AUTH_Manage_Vendors, $arrPermissions) && !$GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()), array('link' => 'index.php?ToDo=editVendor&vendorId=' . $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId(), 'text' => GetLang('VendorProfile'), 'show' => $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()))); } else { $usersMenu = array('link' => 'index.php?ToDo=viewUsers', 'text' => GetLang('Users'), 'show' => in_array(AUTH_Manage_Users, $arrPermissions)); } $menuItems = array('mnuHome' => array('link' => 'index.php', 'text' => GetLang('Home')), 'mnuAddons' => array('link' => 'index.php?ToDo=viewDownloadAddons', 'text' => GetLang('Addons'), 'show' => in_array(AUTH_Manage_Addons, $arrPermissions), 'items' => array(array('link' => 'index.php?ToDo=viewDownloadAddons', 'text' => GetLang('ViewAddons')), array('link' => 'index.php?ToDo=viewAddonSettings', 'text' => GetLang('AddonSettings')))), 'mnuTemplates' => array('link' => 'index.php?ToDo=viewTemplates', 'text' => GetLang('Templates'), 'show' => in_array(AUTH_Manage_Templates, $arrPermissions)), 'mnuUsers' => $usersMenu, 'mnuTools' => array('link' => '', 'text' => GetLang('Tools'), 'items' => array(array('link' => 'index.php?ToDo=viewBackups', 'text' => GetLang('ViewBackups'), 'show' => !GetConfig('DisableBackupSettings') && in_array(AUTH_Manage_Backups, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('link' => 'index.php?ToDo=viewFormFields', 'text' => GetLang('FormFields'), 'show' => (in_array(AUTH_Manage_FormFields, $arrPermissions) || in_array(AUTH_Add_FormFields, $arrPermissions)) && gzte11(ISC_MEDIUMPRINT)), array('link' => 'index.php?ToDo=viewVendorPayments', 'text' => GetLang('VendorPayments'), 'show' => in_array(AUTH_Manage_Vendors, $arrPermissions) && gzte11(ISC_HUGEPRINT)), array('break' => true), array('link' => 'index.php?ToDo=Converter', 'text' => GetLang('StoreImporter'), 'show' => !GetConfig('DisableStoreImporters') && in_array(AUTH_Store_Importer, $arrPermissions) && file_exists(APP_ROOT . "/includes/converter/class.converter.php")), array('link' => 'index.php?ToDo=Exporter', 'text' => GetLang('StoreExporter'), 'show' => !GetConfig('DisableStoreImporters') && in_array(AUTH_Store_Exporter, $arrPermissions) && file_exists(APP_ROOT . "/includes/converter/class.exporter.php")), array('break' => true), array('link' => 'index.php?ToDo=viewExportTemplates', 'text' => GetLang('ExportTemplates'), 'show' => gzte11(ISC_MEDIUMPRINT)), array('link' => 'index.php?ToDo=viewImportTemplates', 'text' => GetLang('ImportTemplates'), 'show' => gzte11(ISC_MEDIUMPRINT)), array('break' => true), array('link' => 'index.php?ToDo=systemLog', 'text' => GetLang('StoreLogs'), 'show' => in_array(AUTH_Manage_Logs, $arrPermissions)), array('link' => 'index.php?ToDo=systemInfo', 'text' => GetLang('SystemInfo'), 'show' => in_array(AUTH_System_Info, $arrPermissions) && !GetConfig('DisableSystemInfo')), array('break' => true), array('link' => 'index.php?ToDo=manageDefect', 'text' => GetLang('ManageDefect'), 'show' => in_array(AUTH_System_Info, $arrPermissions) && !GetConfig('DisableSystemInfo')))), 'mnuSettings' => array('link' => '', 'text' => GetLang('Settings'), 'show' => in_array(AUTH_Manage_Settings, $arrPermissions), 'items' => array(array('link' => 'index.php?ToDo=viewSettings', 'text' => GetLang('StoreSettings')), array('link' => 'index.php?ToDo=viewShippingSettings', 'text' => GetLang('ShippingSettings')), array('link' => 'index.php?ToDo=viewTaxSettings', 'text' => GetLang('TaxSettings')), array('link' => 'index.php?ToDo=viewCurrencySettings', 'text' => GetLang('CurrencySettings')), array('link' => 'index.php?ToDo=viewCheckoutSettings', 'text' => GetLang('CheckoutSettings')), array('link' => 'index.php?ToDo=viewAccountingSettings', 'text' => GetLang('AccountingSettings'), 'show' => gzte11(ISC_MEDIUMPRINT)), array('link' => 'index.php?ToDo=viewScriptSettings', 'text' => GetLang('OrderSettings'), 'show' => gzte11(ISC_MEDIUMPRINT)), array('break' => true), array('link' => 'index.php?ToDo=viewGiftCertificateSettings', 'text' => GetLang('GiftCertificateSettings'), 'show' => gzte11(ISC_LARGEPRINT)), array('link' => 'index.php?ToDo=viewAnalyticsSettings', 'text' => GetLang('AnalyticsSettings')), array('link' => 'index.php?ToDo=viewAffiliateSettings', 'text' => GetLang('AffiliateSettings')), array('link' => 'index.php?ToDo=viewNotificationSettings', 'text' => GetLang('NotificationSettings')), array('link' => 'index.php?ToDo=viewLiveChatSettings', 'text' => GetLang('LiveChatSettings')), array('link' => 'index.php?ToDo=viewReturnsSettings', 'text' => GetLang('ReturnsSettings'), 'show' => gzte11(ISC_LARGEPRINT)), array('link' => 'index.php?ToDo=viewGiftWrapping', 'text' => GetLang('GiftWrappingSettings')), array('break' => true, 'show' => !GetConfig('DisableSendStudioIntegration') || !GetConfig('DisableKnowledgeManagerIntegration')), array('link' => 'index.php?ToDo=viewMailSettings', 'text' => GetLang('MailSettings'), 'show' => !GetConfig('DisableSendStudioIntegration')), array('link' => 'index.php?ToDo=viewKBSettings', 'text' => GetLang('KBSettings'), 'show' => !GetConfig('DisableKnowledgeManagerIntegration')), array('break' => true), array('link' => 'index.php?ToDo=viewBedsizeSettings', 'text' => GetLang('ManageBed')))), 'mnuLogout' => array('link' => 'index.php?ToDo=logOut', 'text' => GetLang('Logout')), 'mnuViewStore' => array('link' => '../index.php', 'target' => '_blank', 'text' => GetLang('ViewStore')), 'mnuHelp' => array('link' => 'javascript:LaunchHelp()', 'text' => GetLang('Help'), 'show' => !GetConfig('HideHelpLink'))); // Now that we've loaded the default menu, let's check if there are any addons we need to load $this->_LoadAddons($menuItems); $first = true; foreach ($menuItems as $id => $menuDetails) { $hasItems = false; if (isset($menuDetails['show']) && !$menuDetails['show']) { continue; } if (!isset($menuDetails['items'])) { $hasItems = true; $target = ''; if (isset($menuDetails['target'])) { $target = ' target="' . $menuDetails['target'] . '"'; } $menuContent = '<a href="' . $menuDetails['link'] . '" class="MenuText"' . $target . '>' . $menuDetails['text'] . '</a>'; } else { $menuContent = '<a href="#" class="PopDownMenu MenuText" id="' . $id . 'MenuButton">' . $menuDetails['text'] . '<img src="images/arrow_down_white.gif" border="0" /></a>'; $menuContent .= '<div id="' . $id . 'Menu" class="DropDownMenu DropShadow" style="display: none; width: 140px;"><ul>'; $insertBreak = ''; $hasChildren = false; foreach ($menuDetails['items'] as $k => $subMenuItem) { if (isset($subMenuItem['show']) && !$subMenuItem['show']) { continue; } if (isset($subMenuItem['break'])) { if ($hasChildren && isset($menuDetails['items'][$k + 1])) { $insertBreak = '<li class="Break"><hr /></li>'; } if (!isset($subMenuItem['text'])) { continue; } } $hasItems = true; $hasChildren = true; // Add the sub menu item to the menu $menuContent .= $insertBreak; $insertBreak = ''; $menuContent .= '<li><a href="' . $subMenuItem['link'] . '" class="MenuTextDrop">' . $subMenuItem['text'] . '</a></li>'; } $menuContent .= "</ul></div>\n"; } if ($hasItems) { if (!$first) { $GLOBALS['textLinks'] .= '|'; } $GLOBALS['textLinks'] .= $menuContent . "\n"; } $first = false; } $GLOBALS['textLinks'] .= '</div>'; // Tell them who they're logged in as if (isset($_COOKIE['userId']) && is_numeric($_COOKIE['userId'])) { $user = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser(); $GLOBALS['textLinks'] .= '<br /><div class="LoggedInAs">' . sprintf(GetLang('LoggedInAs'), $user['username']) . '</div>'; } // Build the menu tabs $GLOBALS['menuRow'] = $this->_BuildTabMenu(); } else { $GLOBALS['menuRow'] = "<tr><td colspan=3 height=\"33\"> </td></tr>"; } // Build the breadcrumb trail $GLOBALS['BreadcrumbTrail'] = $this->_BuildBreadcrumbTrail(); if (!$GLOBALS['BreadcrumbTrail']) { $GLOBALS['HideBreadcrumb'] = 'display: none'; } // Is there an info tip to be shown on this page? if (isset($GLOBALS['InfoTip'])) { $GLOBALS['InfoTip'] = sprintf("<p class=\"InfoTip\">%s</p>", $GLOBALS['InfoTip']); } if (!ech0(GetConfig('serverStamp'))) { $GLOBALS['RTLStyles'] = "<script type=\"text/javascript\">var in_app = true;</script>"; } $GLOBALS['AdminLogo'] = GetConfig('AdminLogo'); $GLOBALS['ControlPanelTitle'] = str_ireplace('%%EDITION%%', $GLOBALS['AppEdition'], GetConfig('ControlPanelTitle')); $GLOBALS['ProductName'] = addslashes(GetConfig('ProductName')); # For the pages, add/edit products and bulk edit products we are sending adminiselector files. -- Baskaran $TodoPage = ''; if (isset($_REQUEST['ToDo'])) { $TodoPage = $_REQUEST['ToDo']; } else { $TodoPage = ""; } if ($TodoPage == 'editProduct' || $TodoPage == 'addProduct' || $TodoPage == 'bulkEditProducts') { $GLOBALS['TodoPage'] = '<script type="text/javascript" src="../javascript/adminiselector.js"></script>'; } else { $GLOBALS['TodoPage'] = '<script type="text/javascript" src="../javascript/iselector.js"></script>'; } # Ends here $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("pageheader"); $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(); }
/** * _CheckPermissions * Create the database and perform other install-orientated tasks * * @param none * * @return void */ private function RunInstall() { $lk = ''; if(isset($_POST['LK'])) { $lk = ech0($_POST['LK']); } if(!$lk) { $installMessage = GetLang('LKBad'); $installCode = "badLicenseKey"; } if(!isset($_POST['StoreCountryLocationId']) || !isId($_POST['StoreCountryLocationId'])) { $_POST['StoreCountryLocationId'] = 227; // United States } if(!isset($_POST['StoreCurrencyCode']) || $_POST['StoreCurrencyCode'] == '') { $_POST['StoreCurrencyCode'] = 'USD'; } if(!isset($_POST['ShopPath']) || $_POST['ShopPath'] == '') { $installMessage = GetLang('InstallMissingShopPath'); $installCode = "missingShopPath"; } else if (isc_strlen($_POST['StoreCurrencyCode']) > 3) { $installMessage = GetLang('InstallInvalidStoreCurrencyCode'); $installCode = "invalidStoreCurrencyCode"; } else if(!isset($_POST['ShopPath']) || $_POST['ShopPath'] == '') { $installMessage = GetLang('InstallMissingShopPath'); $installCode = "missingShopPath"; } else if(!isset($_POST['UserEmail']) || $_POST['UserEmail'] == '') { $installMessage = GetLang('InstallMissingUserEmail'); $installCode = "missingUserEmail"; } else if(!isset($_POST['UserPass']) || $_POST['UserPass'] == '') { $installMessage = GetLang('InstallMissingUserPass'); $installCode = "missingUserPass"; } else if(!isset($_POST['dbServer']) || $_POST['dbServer'] == '') { $installMessage = GetLang('InstallMissingDbServer'); $installCode = "missingDbServer"; } else if(!isset($_POST['dbUser']) || $_POST['dbUser'] == '') { $installMessage = GetLang('InstallMissingDbUser'); $installCode = "missingDbUser"; } else if(!isset($_POST['dbPass'])) { $installMessage = GetLang('InstallMissingDbPass'); $installCode = "missingDbPass"; } else if(!isset($_POST['dbDatabase']) || $_POST['dbDatabase'] == '') { $installMessage = GetLang('InstallMissingDbDatabase'); $installCode = "missingDbDatabase"; } if(!isset($_POST['tablePrefix'])) { $_POST['tablePrefix'] = ''; } // One or more error messages were detected if(isset($installMessage)) { $errors = array( 0 => array( "code" => $installCode, "message" => $installMessage ) ); $this->ShowInstallErrors($installMessage, $errors, false, true); return; } // Try to connect to the database $db_type = GetConfig("dbType") . 'Db'; $db = new $db_type(); if(isset($GLOBALS['ISC_CFG']["dbEncoding"])) { $db->charset = $GLOBALS['ISC_CFG']["dbEncoding"]; } $connection = $db->Connect($_POST['dbServer'], $_POST['dbUser'], $_POST['dbPass'], $_POST['dbDatabase']); $db->TablePrefix = $_POST['tablePrefix']; if($connection) { $GLOBALS["ISC_CLASS_DB"] = &$db; // Are we running the required version of MySQL? $ver = $GLOBALS["ISC_CLASS_DB"]->FetchOne("select version() as ver"); $mysql_check = version_compare($ver, MYSQL_VERSION_REQUIRED); if($mysql_check < 0) { $message = sprintf(GetLang("MySQLV4Message"), MYSQL_VERSION_REQUIRED, $ver); $errors = array( 0 => array( "code" => "mysqlVersion", "extra" => $ver, "message" => $message ) ); $this->ShowInstallErrors($message, $errors, false, true); return; } else { // Run the database commands $queries = $this->template->render('install.schema.tpl'); $queries = str_replace("\r", "\n", str_replace("\r\n", "\n", $queries)); $queries = explode(";\n", $queries); $GLOBALS["ISC_CLASS_DB"]->Query("start transaction"); // Initialize the admin auth class to get the list of permissions $auth = new ISC_ADMIN_AUTH(); require_once(dirname(__FILE__) . "/class.user.php"); $userManager = GetClass('ISC_ADMIN_USER'); $pass = $_POST['UserPass']; $token = $userManager->_GenerateUserToken(); foreach($queries as $query) { $query = str_replace("%%PREFIX%%", $_POST['tablePrefix'], $query); $query = str_replace("%%EMAIL%%", $GLOBALS["ISC_CLASS_DB"]->Quote($_POST['UserEmail']), $query); $query = str_replace("%%TOKEN%%", $GLOBALS["ISC_CLASS_DB"]->Quote($token), $query); if(trim($query) != "") { $GLOBALS["ISC_CLASS_DB"]->Query($query); } } // update admin user password $user_id = $userManager->getUserByField('username', 'admin'); $userManager->updatePassword($user_id, $pass); // Give the admin user permissions $constants = get_defined_constants(); foreach($constants as $constant => $val) { if(is_numeric(strpos($constant, "AUTH_")) && strpos($constant, "AUTH_") == 0) { $newPermission = array( "permuserid" => $user_id, "permpermissionid" => $val ); $GLOBALS['ISC_CLASS_DB']->InsertQuery("permissions", $newPermission); } } // Set the version $db_version = array( 'database_version' => PRODUCT_VERSION_CODE ); $GLOBALS['ISC_CLASS_DB']->InsertQuery('config', $db_version); // Install our default currency. We need to do it here as it also needs to be in the config file $GLOBALS['ISC_CLASS_DB']->Query("DELETE FROM [|PREFIX|]currencies"); $GLOBALS['ISC_CLASS_DB']->Query("ALTER TABLE [|PREFIX|]currencies AUTO_INCREMENT=1"); $currency = array( 'currencycountryid' => $_POST['StoreCountryLocationId'], 'currencycode' => isc_strtoupper($_POST['StoreCurrencyCode']), 'currencyname' => GetLang('InstallDefaultCurrencyName'), 'currencyexchangerate' => GetConfig('DefaultCurrencyRate'), 'currencystring' => html_entity_decode(GetLang('InstallDefaultCurrencyString')), 'currencystringposition' => isc_strtolower(GetLang('InstallDefaultCurrencyStringPosition')), 'currencydecimalstring' => GetLang('InstallDefaultCurrencyDecimalString'), 'currencythousandstring' => GetLang('InstallDefaultCurrencyThousandString'), 'currencydecimalplace' => GetLang('InstallDefaultCurrencyDecimalPlace'), 'currencylastupdated' => time(), 'currencyisdefault' => 1, 'currencystatus' => 1 ); $defaultCurrencyId = $GLOBALS['ISC_CLASS_DB']->InsertQuery('currencies', $currency); // Insert the default/master shipping zone $GLOBALS['ISC_CLASS_DB']->Query("DELETE FROM [|PREFIX|]shipping_zones"); $GLOBALS['ISC_CLASS_DB']->Query("ALTER TABLE [|PREFIX|]shipping_zones AUTO_INCREMENT=1"); $masterZone = array( 'zonename' => 'Default Zone', 'zonetype' => 'country', 'zonefreeshipping' => 0, 'zonefreeshippingtotal' => 0, 'zonehandlingtype' => 'none', 'zonehandlingfee' => 0, 'zonehandlingseparate' => 1, 'zoneenabled' => 1, 'zonedefault' => 1 ); $GLOBALS['ISC_CLASS_DB']->InsertQuery('shipping_zones', $masterZone); // Is there a custom SQL file to include? $customPath = ISC_BASE_PATH.'/custom'; if(file_exists($customPath.'/install.schema.tpl')) { $template = Interspire_Template::getInstance('custominstall', $customPath, array( 'cache' => getAdminTwigTemplateCacheDirectory(), 'auto_reload' => true )); $queries = $template->render('install.schema.tpl'); $queries = str_replace("\r", "\n", str_replace("\r\n", "\n", $queries)); $queries = explode(";\n", $queries); $GLOBALS['ISC_CLASS_DB']->StartTransaction(); foreach($queries as $query) { $query = str_replace("%%PREFIX%%", $_POST['tablePrefix'], $query); if(trim($query)) { $GLOBALS['ISC_CLASS_DB']->Query($query); } } $GLOBALS['ISC_CLASS_DB']->CommitTransaction(); } // Was there an error? if($GLOBALS["ISC_CLASS_DB"]->Error() == "") { $GLOBALS["ISC_CLASS_DB"]->Query("commit"); // Save the config file foreach($_POST as $k => $v) { $GLOBALS['ISC_NEW_CFG'][$k] = $v; } // Set the email address for this user as the store admin/order email address $GLOBALS['ISC_NEW_CFG']['AdminEmail'] = $_POST['UserEmail']; $GLOBALS['ISC_NEW_CFG']['OrderEmail'] = $_POST['UserEmail']; $GLOBALS['ISC_NEW_CFG']['serverStamp'] = $_POST['LK']; $GLOBALS['ISC_CFG']['serverStamp'] = $_POST['LK']; $settings = GetClass('ISC_ADMIN_SETTINGS'); $GLOBALS['ISC_NEW_CFG']['HostingProvider'] = ""; // Can we send server details back to Interspire? // If we can, the HostingProvider global will also be set if(isset($_POST['sendServerDetails'])) { $this->SendServerDetails(); if(isset($GLOBALS['InfoImage'])) { $GLOBALS['HiddenImage'] = $GLOBALS['InfoImage']; } } $GLOBALS['ISC_NEW_CFG']['ShopPath'] = $_POST['ShopPath']; $GLOBALS['ISC_NEW_CFG']['DefaultCurrencyID'] = $defaultCurrencyId; if (isset($GLOBALS['ISC_NEW_CFG']['StoreCountryLocationId'])) { unset($GLOBALS['ISC_NEW_CFG']['StoreCountryLocationId']); } if (isset($GLOBALS['ISC_NEW_CFG']['StoreCurrencyCode'])) { unset($GLOBALS['ISC_NEW_CFG']['StoreCurrencyCode']); } // set up the product images sizes // load the product image class to get the constants GetClass('ISC_PRODUCT_IMAGE'); $GLOBALS['ISC_NEW_CFG']['ProductImagesStorewideThumbnail_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_THUMBNAIL; $GLOBALS['ISC_NEW_CFG']['ProductImagesStorewideThumbnail_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_THUMBNAIL; $GLOBALS['ISC_NEW_CFG']['ProductImagesProductPageImage_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_STANDARD; $GLOBALS['ISC_NEW_CFG']['ProductImagesProductPageImage_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_STANDARD; $GLOBALS['ISC_NEW_CFG']['ProductImagesGalleryThumbnail_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_TINY; $GLOBALS['ISC_NEW_CFG']['ProductImagesGalleryThumbnail_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_TINY; $GLOBALS['ISC_NEW_CFG']['ProductImagesZoomImage_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_ZOOM; $GLOBALS['ISC_NEW_CFG']['ProductImagesZoomImage_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_ZOOM; $GLOBALS['ISC_NEW_CFG']['ProductImagesTinyThumbnailsEnabled'] = 1; $GLOBALS['ISC_NEW_CFG']['ProductImagesImageZoomEnabled'] = 1; // Build the unique encryption token $GLOBALS['ISC_NEW_CFG']['EncryptionToken'] = $this->_BuildEncryptionToken(); // Set the install date $GLOBALS['ISC_NEW_CFG']['InstallDate'] = time(); if ($settings->CommitSettings()) { // Calling commit settings a second time to ensure the config.backup.php file // Is written with valid data $settings->CommitSettings(); // The installation is complete $GLOBALS['Password'] = $pass; // Do we need to install the sample product data? Copy that across if(isset($_POST['installSampleData']) && $_POST['installSampleData'] == 1) { $this->InstallSampleData(); } // The install schemas can't predict the nested set values if custom install scripts arbitrarily add categories or pages // Rebuilt any nested sets instead of including their values in the install schema $nestedSet = new ISC_NESTEDSET_CATEGORIES(); $nestedSet->rebuildTree(); $nestedSet = new ISC_NESTEDSET_PAGES(); $nestedSet->rebuildTree(); // Remove any existing cookies ISC_UnsetCookie("STORESUITE_CP_TOKEN"); //Initialize the data store system require_once ISC_BASE_PATH."/lib/class.datastore.php"; $GLOBALS['ISC_CLASS_DATA_STORE'] = new ISC_DATA_STORE(); // Clear the data store just in case it contains something $GLOBALS['ISC_CLASS_DATA_STORE']->Clear(); $GLOBALS['ISC_LANG']['InstallationCompleted'] = sprintf(GetLang('InstallationCompleted'), $pass); unset($_SESSION['LK'.md5(strtolower($_POST['ShopPath']))]); // The installation was complete! if($this->apiMode == 'cli') { fwrite(STDOUT, "Success:\n"); fwrite(STDOUT, "\n"); fwrite(STDOUT, "ShopPath: ".$_POST['ShopPath']."\n"); fwrite(STDOUT, "ControlPanel: ".$_POST['ShopPath']."admin/index.php\n"); fwrite(STDOUT, "Username: admin\n"); fwrite(STDOUT, "Password: "******"1.0" encoding="'.GetConfig("CharacterSet").'" ?'.">\n"; echo "<response>\n"; echo " <status>OK</status>\n"; echo " <shop>\n"; echo " <shopPath>".$_POST['ShopPath']."</shopPath>\n"; echo " <controlPanel>".$_POST['ShopPath']."admin/index.php</controlPanel>\n"; echo " </shop>\n"; echo " <user>\n"; echo " <username>admin</username>\n"; echo " <password>".$_POST['UserPass']."</password>\n"; echo " </user>\n"; echo "</response>\n"; exit; } else { $this->template->display('install.done.tpl'); } } else { $message = GetLang("ConfigErr"); $errors = array( 0 => array( "code" => "unableSaveConfig", "message" => $message ) ); $this->ShowInstallErrors($message, $errors, false, true); return; } } else { list($error, $level) = $db->GetError(); $GLOBALS["ISC_CLASS_DB"]->Query("rollback"); $message = sprintf(GetLang("DBErr"), $error); $errors = array( 0 => array( "code" => "dbError", "message" => $GLOBALS["ISC_CLASS_DB"]->Error() ) ); $this->ShowInstallErrors($message, $errors, false, true); return; } } } else { list($error, $level) = $db->GetError(); $message = sprintf(GetLang("DBErr"), $error); $errors = array( 0 => array( "code" => "dbConnectError", "message" => $error ) ); $this->ShowInstallErrors($message, $errors, false, true); return; } }
public function ManageClickSettings() { ob_end_clean(); $img = ""; if (ech0(GetConfig('serverStamp'))) { $fp = fopen(dirname(__FILE__) . "/../../images/blank.gif", "rb"); while (!feof($fp)) { $img .= fgets($fp, 1024); } fclose($fp); header("Content-Type:image/gif"); echo $img; } else { echo time(); } die; }
/** * Sets up template variables used or displaying the control panel header * */ public function setupHeader() { $warningNotices = array(); if(isset($GLOBALS['LKN']) && $GLOBALS['LKN']) { $warningNotices[] = GetLang('ControlPanelLKNWarning'); } if(defined('CONTROL_PANEL_WARNING_MSG') && CONTROL_PANEL_WARNING_MSG != '') { $warningNotices[] = CONTROL_PANEL_WARNING_MSG; } if (GetConfig('DownForMaintenance')) { $notice = GetLang('StoreDownNotice'); if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_See_Store_During_Maintenance)) { $notice .= GetLang('StoreDownEnableLink'); } $warningNotices[] = $notice; } if (!empty($warningNotices)) { $noticeStr = ''; foreach ($warningNotices as $notice) { if ($noticeStr) { $noticeStr .= '<br />'; } $noticeStr .= $notice; } $GLOBALS['WarningNotices'] = '<p class="WarningNotice">' . $noticeStr . '</p>'; } if(getLang('RTL') == 1) { $rtlCSSPath = ISC_BASE_PATH.'/admin/Styles/rtl.css'; $rtlCSS = "Styles/rtl.css"; if(file_exists($rtlCSSPath)) { $GLOBALS['RTLStyles'] = sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $rtlCSS); } } $this->DoneHeader = true; $GLOBALS['AdditionalStylesheets'] = ''; foreach($this->stylesheets as $stylesheet) { // Add caching token if(strpos($stylesheet, '?') === false) { $stylesheet .= '?'; } else { $stylesheet .= '&'; } $stylesheet .= getConfig('JSCacheToken'); $GLOBALS['AdditionalStylesheets'] .= "@import url('".$stylesheet."');"; } $this->template->assign('headScripts', $this->headScripts); $GLOBALS['DefineLanguageVars'] = ''; foreach($this->lang as $langVar) { $GLOBALS['DefineLanguageVars'] .= "lang." . $langVar . " = '" . addcslashes($GLOBALS['ISC_LANG'][$langVar], "'") . "';\n"; } $GLOBALS['textLinks'] = ""; $GLOBALS['menuRow'] = ""; $GLOBALS['menuScript'] = ""; $GLOBALS['menuTable'] = ""; $user = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser(); $GLOBALS['CurrentlyLoggedInAs'] = sprintf(GetLang('CurrentlyLoggedInAs'), isc_html_escape($user['username'])); if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->IsLoggedIn() && !defined('IS_PHONE')) { // Get an array of permissions for the selected user $arrPermissions = $GLOBALS["ISC_CLASS_ADMIN_AUTH"]->GetPermissions(); $GLOBALS['textLinks'] = "<div class='MenuText'>"; // if the store is down for maintenance and we're on shared ssl then set a token for the view store link $linkToken = ''; if (GetConfig('DownForMaintenance') && GetConfig('UseSSL') == SSL_SHARED) { $linkToken = '?ctk=' . $_COOKIE['STORESUITE_CP_TOKEN']; } if(gzte11(ISC_HUGEPRINT)) { $usersMenu = array( 'text' => GetLang('Users'), 'show' => in_array(AUTH_Manage_Users, $arrPermissions) || in_array(AUTH_Manage_Vendors, $arrPermissions), 'items' => array( array( 'link' => 'index.php?ToDo=viewUsers', 'text' => GetLang('Users'), 'show' => in_array(AUTH_Manage_Users, $arrPermissions) ), array( 'link' => 'index.php?ToDo=viewVendors', 'text' => GetLang('Vendors'), 'show' => in_array(AUTH_Manage_Vendors, $arrPermissions) && !$GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() ), array( 'link' => 'index.php?ToDo=editVendor&vendorId='.$GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId(), 'text' => GetLang('VendorProfile'), 'show' => $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() ), ) ); } else { $usersMenu = array( 'link' => 'index.php?ToDo=viewUsers', 'text' => GetLang('Users'), 'show' => in_array(AUTH_Manage_Users, $arrPermissions) ); } $menuItems = array( 'mnuHome' => array( 'link' => 'index.php', 'text' => GetLang('Home') ), 'mnuAddons' => array( 'link' => 'index.php?ToDo=viewDownloadAddons', 'text' => GetLang('Addons'), 'show' => (GetConfig('DisableAddons') == false && in_array(AUTH_Manage_Addons, $arrPermissions)), 'items' => array( array( 'link' => 'index.php?ToDo=viewDownloadAddons', 'text' => GetLang('ViewAddons'), 'id' => 'ViewAddonsLink' ), array( 'link' => 'index.php?ToDo=viewAddonSettings', 'text' => GetLang('AddonSettings'), 'id' => 'AddonSettingsLink' ), ) ), 'mnuTemplates' => array( 'link' => 'index.php?ToDo=viewTemplates', 'text' => GetLang('Templates'), 'show' => in_array(AUTH_Manage_Templates, $arrPermissions) ), 'mnuUsers' => $usersMenu, 'mnuTools' => array( 'link' => '', 'text' => GetLang('Tools'), 'items' => array( array( 'link' => 'index.php?ToDo=ViewEditRobotsTxt', 'text' => GetLang('EditRobotsTxtFile'), 'show' => (in_array(AUTH_Manage_RobotsTxt, $arrPermissions)), 'id' => 'EditRobotsTxtFileLink' ), array( 'break' => true ), array( 'link' => 'index.php?ToDo=viewBackups', 'text' => GetLang('ViewBackups'), 'show' => (!GetConfig('DisableBackupSettings') && in_array(AUTH_Manage_Backups, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), 'id' => 'DisableBackupSettingsLink' ), array( 'link' => 'index.php?ToDo=viewFormFields', 'text' => GetLang('FormFields'), 'show' => (in_array(AUTH_Manage_FormFields, $arrPermissions) || in_array(AUTH_Add_FormFields, $arrPermissions)), 'id' => 'FormFieldsLink' ), array( 'link' => 'index.php?ToDo=viewRedirects', 'text' => GetLang('301Redirects'), 'show' => (in_array(AUTH_Manage_Redirects, $arrPermissions)), 'id' => '301RedirectsLink' ), array( 'link' => 'index.php?ToDo=viewVendorPayments', 'text' => GetLang('VendorPayments'), 'show' => in_array(AUTH_Manage_Vendors, $arrPermissions) && gzte11(ISC_HUGEPRINT), 'id' => 'VendorPaymentsLink' ), array( 'break' => true ), array( 'link' => 'index.php?ToDo=viewExportTemplates', 'text' => GetLang('ExportTemplates'), 'show' => gzte11(ISC_MEDIUMPRINT), 'id' => 'ExportTemplatesLink' ), array( 'break' => true ), array( 'link' => 'index.php?ToDo=systemLog', 'text' => GetLang('StoreLogs'), 'show' => in_array(AUTH_Manage_Logs, $arrPermissions), 'id' => 'StoreLogsLink' ), array( 'link' => 'index.php?ToDo=systemInfo', 'text' => GetLang('SystemInfo'), 'show' => in_array(AUTH_System_Info, $arrPermissions) && !GetConfig('DisableSystemInfo'), 'id' => 'StoreLogsLink' ) ) ), 'mnuSettings' => array( 'link' => '', 'text' => GetLang('Settings'), 'show' => in_array(AUTH_Manage_Settings, $arrPermissions), 'items' => array( array( 'link' => 'index.php?ToDo=viewSettings', 'text' => GetLang('StoreSettings'), 'id' => 'StoreSettingsLink' ), array( 'link' => 'index.php?ToDo=viewCheckoutSettings', 'text' => GetLang('CheckoutSettings'), 'id' => 'CheckoutSettingsLink' ), array( 'link' => 'index.php?ToDo=viewCurrencySettings', 'text' => GetLang('CurrencySettings'), 'id' => 'CurrencySettingsLink' ), array( 'link' => 'index.php?ToDo=viewShippingSettings', 'text' => GetLang('ShippingSettings'), 'id' => 'ShippingSettingsLink' ), array( 'link' => 'index.php?ToDo=viewTaxSettings', 'text' => GetLang('TaxSettings'), 'id' => 'TaxSettingsLink' ), array( 'break' => true ), array( 'link' => 'index.php?ToDo=viewGiftCertificateSettings', 'text' => GetLang('GiftCertificateSettings'), 'show' => gzte11(ISC_LARGEPRINT), 'id' => 'GiftCertificateSettingsLink' ), array( 'link' => 'index.php?ToDo=viewGiftWrapping', 'text' => GetLang('GiftWrappingSettings'), 'id' => 'GiftWrappingSettingsLink' ), array( 'link' => 'index.php?ToDo=viewNotificationSettings', 'text' => GetLang('NotificationSettings'), 'id' => 'NotificationSettingsLink' ), array( 'link' => 'index.php?ToDo=viewReturnsSettings', 'text' => GetLang('ReturnsSettings'), 'show' => gzte11(ISC_LARGEPRINT), 'id' => 'ReturnsSettingsLink' ), array( 'break' => true ), array( 'link' => 'index.php?ToDo=viewAccountingSettings', 'text' => GetLang('AccountingSettings'), 'show' => gzte11(ISC_MEDIUMPRINT), 'id' => 'AccountingSettingsLink' ), array( 'link' => 'index.php?ToDo=viewAffiliateSettings', 'text' => GetLang('AffiliateSettings'), 'id' => 'AffiliateSettingsLink' ), array( 'link' => 'index.php?ToDo=viewAnalyticsSettings', 'text' => GetLang('AnalyticsSettings'), 'id' => 'AnalyticsSettingsLink' ), array( 'link' => 'index.php?ToDo=viewCommentSystemSettings', 'text' => GetLang('CommentSettings'), 'id' => 'CommentSettingsLink' ), array( 'link' => 'index.php?ToDo=viewKBSettings', 'text' => GetLang('KBSettings'), 'show' => !GetConfig('DisableKnowledgeManagerIntegration'), 'id' => 'KBSettingsLink' ), array( 'link' => 'index.php?ToDo=viewLiveChatSettings', 'text' => GetLang('LiveChatSettings'), 'id' => 'LiveChatSettingsLink' ), array( 'link' => 'index.php?ToDo=viewShippingManagerSettings', 'text' => GetLang('ShippingManagerSettings'), 'id' => 'ShippingManagerSettingsLink', 'show' => in_array(AUTH_Manage_Orders, $arrPermissions), ), ) ), 'mnuViewStore' => array( 'link' => GetConfig('ShopPathNormal').'/index.php' . $linkToken, 'target' => '_blank', 'text' => GetLang('ViewStore') ), 'mnuHelp' => array( 'link' => 'javascript:LaunchHelp()', 'text' => GetLang('Help'), 'show' => !GetConfig('HideHelpLink') ), ); // Now that we've loaded the default menu, let's check if there are any addons we need to load $this->_LoadAddons($menuItems); $first = true; foreach($menuItems as $id => $menuDetails) { $hasItems = false; if(isset($menuDetails['show']) && !$menuDetails['show']) { continue; } if(!isset($menuDetails['items'])) { $hasItems = true; $target = ''; if (isset($menuDetails['target'])) { $target = ' target="'.$menuDetails['target'].'"'; } $menuContent = '<a href="'.$menuDetails['link'].'" class="MenuText"'.$target.' id="'.$id.'MenuButton">'.$menuDetails['text'].'</a>'; } else { $menuContent = '<a href="#" class="PopDownMenu MenuText" id="'.$id.'MenuButton">'.$menuDetails['text'].'<img src="images/arrow_down_white.gif" border="0" /></a>'; $menuContent .= '<div id="'.$id.'Menu" class="DropDownMenu DropShadow" style="display: none; width: 150px;"><ul>'; $insertBreak = ''; $hasChildren = false; foreach($menuDetails['items'] as $k => $subMenuItem) { if(isset($subMenuItem['show']) && !$subMenuItem['show']) { continue; } if(isset($subMenuItem['break'])) { if($hasChildren && isset($menuDetails['items'][$k+1])) { $insertBreak = '<li class="Break"><hr /></li>'; } if(!isset($subMenuItem['text'])) { continue; } } $hasItems = true; $hasChildren = true; // Add the sub menu item to the menu $menuContent .= $insertBreak; $insertBreak = ''; $target = ''; if (isset($subMenuItem['target'])) { $target = ' target="'.$subMenuItem['target'].'"'; } $menuEleID = ''; if(isset($subMenuItem['id'])) { $menuEleID = ' id="'.$subMenuItem['id'].'"'; } $menuContent .= '<li><a href="'.$subMenuItem['link'].'" class="MenuTextDrop"' . $target .$menuEleID. '>'.$subMenuItem['text'].'</a></li>'; } $menuContent .= "</ul></div>\n"; } if($hasItems) { if(!$first) { $GLOBALS['textLinks'] .= '|'; } $GLOBALS['textLinks'] .= $menuContent."\n"; } $first = false; } $GLOBALS['textLinks'] .= '</div>'; // Tell them who they're logged in as if (isset($_COOKIE['userId']) && is_numeric($_COOKIE['userId'])) { $user = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser(); $GLOBALS['textLinks'] .= '<br /><div class="LoggedInAs">' . sprintf(GetLang('LoggedInAs'), $user['username']) . '</div>'; } // Build the menu tabs $GLOBALS['menuRow'] = $this->_BuildTabMenu(); } else { $GLOBALS['menuRow'] = "<tr><td colspan=3 height=\"33\"> </td></tr>"; } // Build the breadcrumb trail $GLOBALS['BreadcrumbTrail'] = $this->_BuildBreadcrumbTrail(); if(!$GLOBALS['BreadcrumbTrail']) { $GLOBALS['HideBreadcrumb'] = 'display: none'; } // Is there an info tip to be shown on this page? if (isset($GLOBALS['InfoTip'])) { $GLOBALS['InfoTip'] = sprintf("<p class=\"InfoTip\">%s</p>", $GLOBALS['InfoTip']); } if(!ech0(GetConfig('serverStamp'))) { $GLOBALS['RTLStyles'] = "<script type=\"text/javascript\">var in_app = true;</script>"; } $GLOBALS['AdminLogo'] = GetConfig('AdminLogo'); $GLOBALS['ControlPanelTitle'] = str_ireplace('%%EDITION%%', $GLOBALS['AppEdition'], GetConfig('ControlPanelTitle')); $GLOBALS['ProductName'] = addslashes(GetConfig('ProductName')); // Define the favicon link (Added when fixing ISC-218) $GLOBALS['FaviconPath'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . GetConfig('Favicon'); }