public function validate($validator) { $siteConfig = SiteConfig::get()->First(); // don't bother querying the SimplestSpam-service if fields were empty if (!isset($_REQUEST['SimplestSpam_challenge_field']) || empty($_REQUEST['SimplestSpam_challenge_field'])) { $validator->validationError($this->name, $siteConfig->SimplestSpamWrongAnswerFieldMessage, "validation", false); Session::set("FormField.{$this->form->FormName()}.{$this->getName()}", $siteConfig->SimplestSpamWrongAnswerFieldMessage); $this->form->sessionMessage($siteConfig->SimplestSpamWrongAnswerFormMessage, "bad"); return false; } $response = $_REQUEST['SimplestSpam_challenge_field']; $obj = $this->getQuestionAnswerObject(); if (!$obj || !isset($obj->Answer)) { user_error("SimplestSpamField::validate(): could not find answer - sorry, please try again'", E_USER_ERROR); return false; } $answer = $obj->Answer; if ($this->cleanupAnswer($answer) != $this->cleanupAnswer($response)) { $validator->validationError($this->name, $siteConfig->SimplestSpamWrongAnswerFormMessage, "validation", false); Session::set("FormField.{$this->form->FormName()}.{$this->getName()}", $siteConfig->SimplestSpamWrongAnswerFieldMessage); $this->form->sessionMessage($siteConfig->SimplestSpamWrongAnswerFormMessage, "bad"); return false; } return true; }
public function updateCMSFields(FieldList $fields) { $subsites = class_exists('Subsite'); $onMainSite = TRUE; $currentSubsiteID = 0; $currentSiteConfig = SiteConfig::current_site_config(); if ($subsites) { $currentSubsiteID = Subsite::currentSubsiteID(); if ($currentSubsiteID) { $onMainSite = FALSE; } $mainSiteConfig = SiteConfig::get()->filter('SubsiteID', 0)->first(); } else { $mainSiteConfig = $currentSiteConfig; } // Add mailblock CMS fields. if (Permission::check('MANAGE_MAILBLOCK') && ($mainSiteConfig->getField('MailblockApplyPerSubsite') || $onMainSite)) { $enabled = $currentSiteConfig->getField('MailblockEnabled'); $tabSet = new TabSet('Mailblock', $settingsTab = $this->basicSettingsFields(), $advancedSettingsTab = $this->advancedSettingsFields($onMainSite, $currentSubsiteID), $testTab = $this->testEmailCMSFields($enabled)); $fields->addFieldToTab('Root', $tabSet); $hiddenFields = array('MailblockEnabledOnLive', 'MailblockOverrideConfiguration', 'MailblockRecipients', 'MailblockWhitelist'); if ($subsites && $currentSubsiteID == 0) { $hiddenFields[] = 'MailblockApplyPerSubsite'; } foreach ($hiddenFields as $field) { $field = $fields->dataFieldByName($field); $field->displayIf('MailblockEnabled')->isChecked(); } } }
public static function getForm() { $form = parent::getForm(); $paypalHost = 'https://' . SiteConfig::get('Cart::PaypalHostName') . '/cgi-bin/webscr'; $form->updateAttributes(array('action' => $paypalHost)); $form->updateAttributes(array('onSubmit' => "return checkBeforeSendToPaypal()")); $form->setConstants(array('cmd' => '_cart')); $form->addElement('hidden', 'cmd'); $form->setConstants(array('upload' => 1)); $form->addElement('hidden', 'upload'); //Set the ID of the customer making this order $form->setConstants(array('custom' => session_id())); $form->addElement('hidden', 'custom'); $form->setConstants(array('currency_code' => "CAD")); $form->addElement('hidden', 'currency_code'); $form->setConstants(array('business' => SiteConfig::get('Cart::PaypalBusinessEmailAddress'))); $form->addElement('hidden', 'business'); $form->setConstants(array('return' => "http://" . $_SERVER['HTTP_HOST'] . "/store/orderComplete")); $form->addElement('hidden', 'return'); // <input type="hidden" name="return" value="ordercomplete.php?req=success"> $items = CartBasket::getUserCartBaskets($_SESSION['authenticated_user']->getId()); $count = 0; foreach ($items as $item) { $form->setConstants(array('item_name_' . ++$count => $item->getProduct()->getName())); $form->addElement('hidden', 'item_name_' . $count); $form->setConstants(array('item_number_' . $count => $item->getProduct()->getModel())); $form->addElement('hidden', 'item_number_' . $count); $form->setConstants(array('amount_' . $count => round($item->getPrice(), 2))); $form->addElement('hidden', 'amount_' . $count); $form->setConstants(array('quantity_' . $count => $item->getQuantity())); $form->addElement('hidden', 'quantity_' . $count); //The tax will be passed as one value //$taxRate = CartTaxRate::getTaxRate($item->getProduct()->getTaxClass(), $_SESSION['cart_checkout']['address']['shipping_address'])->getRate(); //$taxValue = $taxRate * $item->getPrice();//Do not multiply by the quantity because paypal does it automatically //$taxValue = ceil($taxValue); //$taxValue = $taxValue / 100; //$form->setConstants( array ( 'tax_' . $count => $taxValue ) ); //$form->addElement( 'hidden', 'tax_' . $count ); //Charge the shipping cost only for the first item because the shipping cost will apply on all the items $shippingCost = 0; if ($count == 1) { $shipping = @$_SESSION['cart_checkout']['shipping']; if ($shipping) { $shippingCost = number_format($_SESSION['cart_checkout']['shipping']->getCost(), 2); } $shippingCost = ceil($shippingCost * 100) / 100; } $form->setConstants(array('shipping_' . $count => $shippingCost)); $form->addElement('hidden', 'shipping_' . $count); } $temp = new Module_Cart(); $form->setConstants(array('tax_cart' => $temp->getTax())); $form->addElement('hidden', 'tax_cart'); //$form->setConstants( array ( 'shipping' => number_format($_SESSION['cart_checkout']['shipping']->getCost(), 2) ) ); //$form->addElement( 'hidden', 'shipping' ); $form->addElement('image', 'cart_submit', 'https://www.paypal.com/en_US/i/btn/x-click-but23.gif'); return $form; }
public function run() { $this->log("Upgrading settings"); // List of rules that have been created in all stages $configs = SiteConfig::get()->filter(array("GoogleAnalyticsUpgradedV2" => false, "GoogleAnalyticsType" => "")); foreach ($configs as $config) { $this->upgradeConfig($config); } }
/** * @return DataObject */ public function ContactInformations() { // checks for the active environment type, to load minified css and js files if in live mode if (Director::get_environment_type() == "dev" || Director::get_environment_type() == "test") { Requirements::css("widget_Contact/css/contactwidget.css"); } else { Requirements::css("widget_Contact/css/contactwidget.min.css"); } return SiteConfig::get()->First(); }
public function setUp() { parent::setUp(); // Clear automatically created siteconfigs (in case one was created outside of the specified fixtures). $ids = $this->allFixtureIDs('SiteConfig'); if ($ids) { foreach (SiteConfig::get()->exclude('ID', $ids) as $config) { $config->delete(); } } }
public function getAllPagesInDir($sPath, $sUrl, $sGlobalConfigFile) { $oConfig = new SiteConfig($sGlobalConfigFile); $sSortKey = $oConfig->get('site', 'menu', 'sort_by'); $bAsc = (bool) $oConfig->get('site', 'menu', 'sort_asc'); $aPages = array(); $aDirs = $this->getDirectories($sPath, false); foreach ($aDirs as $sDir) { $aPage = $this->getPageFromDir($sDir, $sUrl, $sGlobalConfigFile); if (isset($aPage['config'][$sSortKey]) && !empty($aPage['config'][$sSortKey])) { $aPages[$aPage['config'][$sSortKey]] = $aPage; } else { $aPages[] = $aPage; } } if ($bAsc === false) { krsort($aPages); } else { ksort($aPages); } return $aPages; }
public function mailblockTestEmail($data, $form) { if (class_exists('Subsite')) { $siteConfig = SiteConfig::get()->filter('SubsiteID', 0)->first(); } else { $siteConfig = SiteConfig::current_site_config(); } $to = $siteConfig->getField('MailblockTestTo'); $from = $siteConfig->getField('MailblockTestFrom'); $subject = $siteConfig->getField('MailblockTestSubject'); $body = $siteConfig->getField('MailblockTestBody'); $cc = $siteConfig->getField('MailblockTestCc'); $bcc = $siteConfig->getField('MailblockTestBcc'); $email = new Email($from, $to, $subject, $body, NULL, $cc, $bcc); $email->send(); $this->owner->response->addHeader('X-Status', rawurlencode('Test email sent!')); return $this->owner->getResponseNegotiator()->respond($this->owner->request); }
public function calculateCost($session, $cartItems) { /* * The shipping cost is calculated as the following: * The pallet count is how many items can fit onto one pallet. * We ship items by pallets and determine our delivery costs by how many pallets are shipped. * If we're shipping 20 bags of product X and 40 bags of products Y where: * pallet count of X is 10 * pallet count of Y is 5 * That means that we are shipping: 2 pallets for X and 8 pallets for Y. Thus 10 pallets in total * * The Shipping rates will be determined by the number of pallets each order makes up AND also by the total cost (before GST) for the order. * Freight charges: * $70/pallet on orders up to $499 * $60/pallet on orders $550 - $999 * $50/pallet on orders +$1000 */ if (!is_array($cartItems)) { return 0.0; } $totalAmount = 0.0; $palletCount = 0.0; foreach ($cartItems as $item) { $product = $item->getCartItemProduct(); $productProperty = ProductPropertiesTbl::getPropertiesBasedOnProductId($product->getId()); $totalAmount += $product->getPrice() * $item->getQuantity(); if ($productProperty->getPalletCount() != 0) { $palletCount += $item->getQuantity() / $productProperty->getPalletCount(); } else { $palletCount += 0; } } $palletCount = ceil($palletCount); //Round up the number of pallets to an integer number if ($totalAmount >= 1000) { return SiteConfig::get("Cart::ShippingCostMoreThan1000") * $palletCount; } elseif ($totalAmount >= 500) { return SiteConfig::get("Cart::ShippingCostLessThan999") * $palletCount; } else { return SiteConfig::get("Cart::ShippingCostLessThan499") * $palletCount; } }
public function run($request) { set_time_limit(0); increase_memory_limit_to(); Subsite::$disable_subsite_filter = true; $mainConfig = SiteConfig::current_site_config(); $mainConfig->compileStyles(); DB::alteration_message("Compile styles for main site"); $subsites = Subsite::get(); foreach ($subsites as $subsite) { $subsiteConfig = SiteConfig::get()->filter('SubsiteID', $subsite->ID)->first(); if (!$subsiteConfig) { DB::alteration_message("No config for subsite " . $subsite->ID, "error"); continue; } $subsiteConfig->compileStyles(); DB::alteration_message("Compile styles for subsite " . $subsite->ID); } DB::alteration_message("All done"); }
/** * Send a request to the gateway to process the payment * @param {array} $data Data to be passed to the gateway * @return {PaymentGateway_Result} Payment result object */ public function process($data) { $api_key = ''; if (PaymentGateway::get_environment() == 'dev') { $api_key = Config::inst()->get('StripeGateway', 'test_api_secret'); } else { $api_key = Config::inst()->get('StripeGateway', 'api_secret'); } if (empty($api_key)) { return new PaymentGateway_Failure(403, _t('StripeGateway.NO_API_KEY', '_No api key configured, you must configure StripeGateway.api_secret for live and StripeGateway.test_api_secret for dev')); } //Set the api key in the Stripe library Stripe::setApiKey($api_key); //Create the Stripe charge try { $response = Stripe_Charge::create(array('amount' => intval($data['Amount']) * 100, 'currency' => $data['Currency'], 'card' => array('number' => implode('', $data['CardNumber']), 'exp_month' => $data['MonthExpiry'], 'exp_year' => $data['YearExpiry'], 'cvc' => $data['Cvc2'], 'name' => $data['FirstName'] . ' ' . $data['LastName'], 'address_line1' => $data['BillingAddress'], 'address_line2' => $data['BillingAddress2'], 'address_city' => $data['BillingCity'], 'address_zip' => $data['BillingZIPCode'], 'address_state' => $data['BillingState'], 'address_country' => $data['BillingCountry']), 'description' => _t('StripeGateway.PAYMENT_DESCRIPTION', '_{sitetitle} Store Sale', array('sitetitle' => class_exists('SiteConfig') ? SiteConfig::get()->first()->Title : 'SilverStripe')))); if ($response->paid) { return new PaymentGateway_Success($status); } else { if ($response->cvc_check == 'fail' || $response->address_line1_check == 'fail' || $response->address_zip_check == 'fail') { $errors = array(); if ($response->cvc_check == 'fail') { $errors[] = _t('StripeGateway.FAIL_CVC', '_The credit card\'s security code (cvc) is invalid'); } if ($response->address_line1_check == 'fail') { $errors[] = _t('StripeGateway.FAIL_ADDRESS', '_Your bank declined the charge based on your address information, please verify the information and try again'); } if ($response->address_zip_check == 'fail') { $errors[] = _t('StripeGateway.FAIL_ZIP_CODE', '_Your bank declined the charge based on your postal code/zip code, please verify it and try again'); } return new PaymentGateway_Failure(null, $errors); } else { return new PaymentGateway_Incomplete(); } } } catch (Stripe_Error $e) { return new PaymentGateway_Failure(new SS_HTTPResponse('', $e->getHttpStatus()), array($e->getCode() => $e->getMessage())); } return new PaymentGateway_Failure(); }
public function getPaymentForm() { $form = new Form('payment_form', 'payment_form', '/Store/Payment'); $paypalHost = 'https://' . $this->hostName . '/cgi-bin/webscr'; $form->updateAttributes(array('action' => $paypalHost)); $form->updateAttributes(array('onSubmit' => "return checkBeforePayment()")); $tid = @$_SESSION['ECommTID']; if ($tid) { $transaction = Transaction::getTransactionBasedOnTID($tid); $sessionId = $transaction->getSession(); $session = Session::getActiveSession($sessionId); $cartItems = CartItem::getAll($sessionId); //$form->setConstants( array ( 'cmd' => '_cart' ) ); $form->setConstants(array('cmd' => '_xclick')); $form->addElement('hidden', 'cmd'); $form->setConstants(array('upload' => 1)); $form->addElement('hidden', 'upload'); //Set the ID of the transaction for this order $form->setConstants(array('custom' => $tid)); $form->addElement('hidden', 'custom'); $form->setConstants(array('currency_code' => SiteConfig::get("EComm::Currency"))); $form->addElement('hidden', 'currency_code'); $form->setConstants(array('business' => $this->accountEmail)); $form->addElement('hidden', 'business'); $form->setConstants(array('return' => "http://" . $_SERVER['HTTP_HOST'] . "/Store/IPN/&action=OrderComplete&tid={$tid}")); $form->addElement('hidden', 'return'); $cartDetails = Module_EComm::getCartDetails($sessionId, $cartItems); $form->setConstants(array('amount' => $cartDetails["subTotal"])); $form->addElement('hidden', 'amount'); $form->setConstants(array('shipping' => $cartDetails["shipping"])); $form->addElement('hidden', 'shipping'); $form->setConstants(array('tax' => $cartDetails["tax"])); $form->addElement('hidden', 'tax'); } $form->addElement('image', 'cart_submit', 'https://www.paypal.com/en_US/i/btn/x-click-but23.gif'); return $form->display(); }
public function __construct() { $this->hostName = SiteConfig::get('Cart::PaypalHostName'); $this->accountEmail = SiteConfig::get('Cart::PaypalBusinessEmailAddress'); }
/** * Create SiteConfig with defaults from language file. * if Translatable is enabled on SiteConfig, see if one already exist * and use those values for the translated defaults. * * @param string $locale * @return SiteConfig */ static function make_site_config($locale = null) { if (class_exists('Translatable') && !$locale) { $locale = Translatable::get_current_locale(); } $siteConfig = new SiteConfig(); $siteConfig->Title = _t('SiteConfig.SITENAMEDEFAULT', "Your Site Name"); $siteConfig->Tagline = _t('SiteConfig.TAGLINEDEFAULT', "your tagline here"); if (class_exists('Translatable') && $siteConfig->hasExtension('Translatable')) { Translatable::disable_locale_filter(); $defaultConfig = SiteConfig::get()->first(); Translatable::enable_locale_filter(); if ($defaultConfig) { return $defaultConfig->createTranslation($locale); } // TODO Copy view/edit group settings // set the correct Locale $siteConfig->Locale = $locale; } $siteConfig->write(); return $siteConfig; }
/** * Replace the recipients with the recipients entered in Mailblock. * * @param string $recipients Original email recipients. * @param string $subject Original email subject. * @return array Rewritten subject and recipients. */ protected function mailblockRewrite($recipients, $subject, $customHeaders) { // Get the correct mailblock config. if (class_exists('Subsite')) { $mainSiteConfig = SiteConfig::get()->filter('SubsiteID', 0)->first(); } else { $mainSiteConfig = SiteConfig::current_site_config(); } if ($mainSiteConfig->getField('MailblockApplyPerSubsite')) { $siteConfig = SiteConfig::current_site_config(); } else { $siteConfig = $mainSiteConfig; } $enabled = $siteConfig->getField('MailblockEnabled'); $enabledOnLive = $siteConfig->getField('MailblockEnabledOnLive'); $overrideConfiguration = $siteConfig->getField('MailblockOverrideConfiguration'); $configuration = Config::inst()->get('Email', 'send_all_emails_to'); if ($enabled && ($enabledOnLive || SS_ENVIRONMENT_TYPE != 'live') && (!$configuration || $overrideConfiguration)) { // Get the CC/BCC recipients from the headers. $ccHeaders = ''; $bccHeaders = ''; if (isset($customHeaders['Cc'])) { $ccHeaders = $customHeaders['Cc']; } if (isset($customHeaders['Bcc'])) { $bccHeaders = $customHeaders['Bcc']; } $mailblockRecipients = $siteConfig->getField('MailblockRecipients'); // Rewrite subject if 'send_all_emails_to' is not set. // If it is set, the subject has already been rewritten. if (!$configuration) { $subject .= " [addressed to {$recipients}"; if ($ccHeaders) { $subject .= ", cc to {$ccHeaders}"; } if ($bccHeaders) { $subject .= ", bcc to {$bccHeaders}"; } $subject .= ']'; } $newRecipients = implode(', ', preg_split("/\r\n|\n|\r/", $mailblockRecipients)); // If one of the orignial recipients is in the whitelist, add them // to the new recipients list. $mailblockWhitelist = $siteConfig->getField('MailblockWhitelist'); $whitelist = preg_split("/\r\n|\n|\r/", $mailblockWhitelist); $cc = ''; $bcc = ''; foreach ($whitelist as $whiteListed) { if (strpos($recipients, $whiteListed) !== false) { $newRecipients .= ', ' . $whiteListed; } if (strpos($ccHeaders, $whiteListed) !== false) { $cc = $whiteListed . ', '; } if (strpos($bccHeaders, $whiteListed) !== false) { $bcc = $whiteListed . ', '; } } $recipients = $newRecipients; $customHeaders['Cc'] = $cc; $customHeaders['Bcc'] = $bcc; } $rewrites = array('to' => $recipients, 'subject' => $subject, 'headers' => $customHeaders); return $rewrites; }
/** * When the SiteConfig object is automatically instantiated, we should ensure that * 1. All SiteConfig objects belong to the same group * 2. Defaults are correctly initiated from the base object * 3. The creation mechanism uses the createTranslation function in order to be consistent * This function ensures that any already created "vanilla" SiteConfig object is populated * correctly with translated values. * This function DOES populate the ID field with the newly created object ID * @see SiteConfig */ protected function populateSiteConfigDefaults() { // Work-around for population of defaults during database initialisation. // When the database is being setup singleton('SiteConfig') is called. if (!DB::getConn()->hasTable($this->owner->class)) { return; } if (!DB::getConn()->hasField($this->owner->class, 'Locale')) { return; } if (DB::getConn()->isSchemaUpdating()) { return; } // Find the best base translation for SiteConfig $enabled = Translatable::locale_filter_enabled(); Translatable::disable_locale_filter(); $existingConfig = SiteConfig::get()->filter(array('Locale' => Translatable::default_locale()))->first(); if (!$existingConfig) { $existingConfig = SiteConfig::get()->first(); } if ($enabled) { Translatable::enable_locale_filter(); } // Stage this SiteConfig and copy into the current object if ($existingConfig && !$existingConfig->getTranslation(Translatable::get_current_locale()) && $existingConfig->canTranslate(null, Translatable::get_current_locale())) { // Create an unsaved "staging" translated object using the correct createTranslation mechanism $stagingConfig = $existingConfig->createTranslation(Translatable::get_current_locale(), false); $this->owner->update($stagingConfig->toMap()); } // Maintain single translation group for SiteConfig if ($existingConfig) { $this->owner->_TranslationGroupID = $existingConfig->getTranslationGroup(); } $this->owner->Locale = Translatable::get_current_locale(); }
public function sendEmail($result) { $recipients = SiteConfig::get("Cart::AdminEmail"); $headers = "From: {$recipients}"; $smartyVar = new Smarty(); $prefix = $_SERVER["DOCUMENT_ROOT"] . "/modules/Cart/templates/"; if ($result == true) { //The transaction is complete $subject = "A New Order #" . $_SESSION['cart_checkout']['order']->getId(); $smartyVar->assign('order', $_SESSION['cart_checkout']['order']); $smartyVar->assign('address', $_SESSION['cart_checkout']['address']['shipping_address']); $body = $smartyVar->fetch($prefix . "order_success.tpl"); } else { //Something went wrong with the payment $subject = "An Order Failed"; $smartyVar->assign('reason', $_SESSION['cart_checkout']['orderFailureReason']); $body = $smartyVar->fetch($prefix . "order_failed.tpl"); } $mailResult = mail($recipients, $subject, $body, $headers); }
$g = explode(",", $_GET["tag"] . "," . $_POST["tags"]); foreach (tags2array($_POST["tags"]) as $a) { if (trim($a) == "") { continue; } $w3 = array(); $w3["question"] = $frageid; $w3["tag"] = $a; $db->CreateUpdate(0, "question_tags", $w3); } $_SESSION["myuser"]["lastwritten"]["question"][$frageid] = true; Karma::RuleAction("CREATE_QUESTION", array("user" => MyUser::id(), "question" => $frageid)); Badges::add(3, MyUser::id(), array("question" => $frageid)); //Erste Frage geschrieben @file_get_contents("www.google.com/webmasters/tools/ping?sitemap=" . urlencode(SiteConfig::val("baseurl") . "sitemap.xml")); $m = SiteConfig::get(0); if ($m["twitter"]["consumer"]["secret"] . "" != "" && $m["twitter"]["access"]["secret"] . "" != "") { try { $twitter = new Twitter($m["twitter"]["consumer"]["key"], $m["twitter"]["consumer"]["secret"]); $twitter->setOAuthToken($m["twitter"]["access"]["key"]); $twitter->setOAuthTokenSecret($m["twitter"]["access"]["secret"]); $url = API_urlshortener::add(Question::PermalinkByData($w3["question"], $w["title"])); if (strlen($w["title"]) > 100) { $tweet = substr($w["title"], 0, 100) . "... " . $url . " #wikihelp"; } else { $tweet = substr($w["title"], 0, 100) . " " . $url . " #wikihelp"; } $twitter->statusesUpdate($tweet); } catch (Exception $ex) { } }
public function save() { $result = false; $e_sql = "SELECT aut_id FROM auth WHERE aut_id = '" . Database::singleton()->escape($this->usr_id) . "'"; $e_result = Database::singleton()->query_fetch($e_sql); if ($e_result) { $sql = "UPDATE auth SET \n\t\t\t\t\t\taut_username = '******',\n\t\t\t\t\t\taut_password = '******',\n\t\t\t\t\t\taut_salt = '" . Database::singleton()->escape($this->salt) . "',\n\t\t\t\t\t\taut_agp_id = '" . Database::singleton()->escape($this->auth_group) . "',\n\t\t\t\t\t\taut_name = '" . Database::singleton()->escape($this->name) . "',\t\t\t\t\t\t\n\t\t\t\t\t\taut_email = '" . Database::singleton()->escape($this->email) . "',\n\t\t\t\t\t\taut_phone = '" . Database::singleton()->escape($this->phone) . "',\n\t\t\t\t\t\taut_status = '" . Database::singleton()->escape($this->status) . "',\t\t\t\t\t\n\t\t\t\t\t\tauth_join_newsletter = '" . Database::singleton()->escape($this->join_newsletter) . "',\t\t\t\t\t\n\t\t\t\t\t\taut_last_touched = NOW()\n\t\t\t\t\t\twhere aut_id = '" . Database::singleton()->escape($this->usr_id) . "'"; $result = Database::singleton()->query($sql); } else { $uniqueUserNameSQL = "SELECT aut_id FROM auth WHERE aut_username like '" . Database::singleton()->escape($this->username) . "'"; $uniqueUserNameResult = Database::singleton()->query_fetch($uniqueUserNameSQL); if ($uniqueUserNameResult) { //Username already exists return false; } $sql = "INSERT INTO auth SET \n\t\t\t\t\t\taut_username = '******',\n\t\t\t\t\t\taut_password = '******',\n\t\t\t\t\t\taut_salt = '" . Database::singleton()->escape($this->salt) . "',\n\t\t\t\t\t\taut_name = '" . Database::singleton()->escape($this->name) . "',\t\t\t\t\t\t\n\t\t\t\t\t\taut_email = '" . Database::singleton()->escape($this->email) . "',\n\t\t\t\t\t\taut_phone = '" . Database::singleton()->escape($this->phone) . "',\n\t\t\t\t\t\taut_status = '" . Database::singleton()->escape($this->status) . "',\t\t\t\t\n\t\t\t\t\t\tauth_join_newsletter = '" . Database::singleton()->escape($this->join_newsletter) . "',\t\t\t\t\t\n\t\t\t\t\t\taut_last_touched = NOW(),\n\t\t\t\t\t\taut_agp_id = '" . Database::singleton()->escape($this->auth_group) . "'"; $result = Database::singleton()->query($sql); //$e_result = Database::singleton()->query_fetch($e_sql); $this->setId(Database::singleton()->lastInsertedID()); $headers = 'From: ' . SiteConfig::get("EComm::AdminEmail") . '\\r\\n'; $smarty = new Smarty(); $user = new User($this->getId()); $smarty->assign('user', $user); $message = $smarty->fetch("create_new_account_email.tpl"); mail($this->email, "Your account has been created", $message, $headers); } include_once SITE_ROOT . '/modules/Mail/include/MailUser.php'; $nUser = new MailUser($this->email); if ($this->join_newsletter) { $name = explode(" ", trim($this->name)); $nUser->setEmail($this->email); @$nUser->setFirstName($name[0]); @$nUser->setLastName($name[1]); $nUser->save(); } else { $nUser->delete(); } return $result; }
public function theCmsSettingsHasData(TableNode $fieldsTable) { $fields = $fieldsTable->getRowsHash(); $siteConfig = \SiteConfig::get()->first(); foreach ($fields as $field => $value) { $siteConfig->{$field} = $value; } $siteConfig->write(); $siteConfig->flushCache(); }
public function sendEmailAccountCreated() { $this->smarty->assign('userName', @$_REQUEST["a_username"]); $this->smarty->assign('password', @$_REQUEST["a_password"]); $this->smarty->assign('customerName', @$_REQUEST["a_name"]); $body = $this->smarty->fetch("EmailCreateAccount.tpl"); $subject = "Account created"; $adminEmail = SiteConfig::get("EComm::AdminEmail"); $userEmail = @$_REQUEST["a_email"]; $headers = "From: {$adminEmail}"; return mail($userEmail, $subject, $body, $headers); }
$prio[] = $_ENV["basepath"] . "/app/code/classes/class." . $class_name . ".php"; foreach ($prio as $file) { if (file_exists($file)) { require $file; return true; } } if (isset($_GET["debug"])) { throw new Exception("Klasse " . $class_name . " kann nicht gefunden werden!"); } return false; }); srand(); SiteConfig::load(0); Session::init(); $config = SiteConfig::get(0); if (!isset($_ENV["baseurl"])) { $_ENV["baseurl"] = $config["baseurl"]; } if (!isset($_ENV["baseurlpath"])) { $_ENV["baseurlpath"] = $config["baseurlpath"]; } //Bugvermeidung $_REQUEST = array_merge($_GET, $_POST); i18n::init(isset($_GET["_lang"]) ? $_GET["_lang"] : (isset($config["language"]) ? $config["language"] : "de_DE")); function get_path($file) { return str_replace("//", "/", $_ENV["baseurlpath"] . $file); } function html($txt) {
/** * Return a siteconfig for this subsite * * @return \SiteConfig */ public function getSiteConfig() { if (!$this->owner->ID) { return; } if (isset(self::$_current_siteconfig_cache[$this->owner->ID])) { return self::$_current_siteconfig_cache[$this->owner->ID]; } Subsite::$disable_subsite_filter = true; $sc = SiteConfig::get()->filter('SubsiteID', $this->owner->ID)->first(); Subsite::$disable_subsite_filter = false; if (!$sc) { $sc = new SiteConfig(); $sc->SubsiteID = $this->owner->ID; $sc->Title = _t('Subsite.SiteConfigTitle', 'Your Site Name'); $sc->Tagline = _t('Subsite.SiteConfigSubtitle', 'Your tagline here'); $sc->write(); } self::$_current_siteconfig_cache[$this->owner->ID] = $sc; return $sc; }
function createTable() { $cols = array('id?', DBColumn::make('!text', 'name', 'Title'), DBColumn::make('!select', 'supplier', 'Supplier', Module_EComm::getIndexes("ecomm_supplier", "id", "name", 0)), DBColumn::make('!select', 'category', 'Category', Module_EComm::getIndexes("ecomm_category", "id", "name", 0)), DBColumn::make('!select', 'producttype', 'Product Type', Module_EComm::getIndexes("ecomm_product_type", "id", "name", 0)), DBColumn::make('!select', 'tax_class', 'Tax Class', Module_EComm::getIndexes("ecomm_tax_class", "id", "name", 0)), DBColumn::make('!integer', 'stock_quantity', 'Stock Quantity'), DBColumn::make('//integer', 'image', 'Image'), DBColumn::make('!float', 'price', 'Price (' . SiteConfig::get("EComm::CurrencySign") . ")"), DBColumn::make('timestamp', 'date_added', 'Date Added'), DBColumn::make('//text', 'last_modified', 'Last Modified'), DBColumn::make('select', 'status', 'Status', array('1' => 'Active', '0' => 'Inactive')), DBColumn::make('tinymce', 'details', 'Details')); return new DBTable("ecomm_product", __CLASS__, $cols); }
<?php PageEngine::html("html_head", array("title" => "Systemeinstellungen")); PageEngine::html("header"); $config = SiteConfig::get(); ?> <div id="Content" class="content-wrapper PageSettings"> <article class="ContentLeft"> <h1 class="summary"><?php echo _e("system settings"); ?> </h1> <?php PageEngine::html("admin/box_navi"); PageEngine::html("messagebox", array("name" => "save")); ?> <form method="POST"><INPUT type="hidden" name="action" value="save"/> <fieldset> <legend>Stammdaten</legend> <table class="std01"> <tr><th>Forumtitel:</th><td><INPUT type="text" name="page_title" value="<?php echo html(isset($config["page"]["title"]) ? $config["page"]["title"] : ""); ?> " placeholder="Q/A Forum"/></td></tr> <tr><th>Design:</th><td><INPUT type="text" name="style" value="<?php echo html(isset($config["style"]) ? $config["style"] : "default"); ?> " placeholder="Designname"/></td></tr> <tr><th>Standardsprache:</th><td><SELECT name="language">