get() 정적인 공개 메소드

Gets a value from the _SERVER array
static public get ( mixed $key = false, mixed $default = null ) : mixed
$key mixed The key to look for. Pass false or null to return the entire server array.
$default mixed Optional default value, which should be returned if no element has been found
리턴 mixed
예제 #1
0
파일: panel.php 프로젝트: 04x10/04x10.com
 function __construct()
 {
     s::start();
     c::set('home.keepurl', true);
     // auto-detect the url if it is not set
     if (!c::get('url')) {
         c::set('url', c::get('scheme') . server::get('http_host'));
     }
     // setup the thumb plugin
     c::set('thumb.cache.root', c::get('root') . '/thumbs');
     c::set('thumb.cache.url', c::get('url') . '/thumbs');
     c::set('url', c::get('url') . '/' . c::get('panel.folder'));
     // remove the panel folder name from the uri
     c::set('subfolder', ltrim(c::get('subfolder') . '/' . c::get('panel.folder'), '/'));
     // attach the uri after caching
     $this->uri = new paneluri();
     if (c::get('lang.support')) {
         $path = $this->uri->path->toArray();
         $first = array_shift($path);
         if (!in_array($first, c::get('lang.available', array()))) {
             $first = c::get('lang.default');
         }
         // set the current language
         c::set('lang.current', $first);
         $this->uri->path = new uriPath($path);
     }
     // get the first set of pages
     $this->rootPages();
     // get the additional site info from content/site.txt
     $this->siteInfo();
 }
예제 #2
0
파일: url.php 프로젝트: chrishiam/LVSL
 /**
  * Returns the current url with all bells and whistles
  *
  * @return string
  */
 public static function current()
 {
     if (!is_null(static::$current)) {
         return static::$current;
     }
     return static::$current = static::scheme() . '://' . server::get('HTTP_HOST') . server::get('REQUEST_URI');
 }
예제 #3
0
파일: uri.php 프로젝트: narrenfrei/kirbycms
 function raw($uri = false)
 {
     $raw = $uri ? $uri : ltrim(server::get('request_uri'), '/');
     // strip subfolders from uri
     if (c::get('subfolder')) {
         $raw = ltrim(str_replace(c::get('subfolder') . '/', '/', $raw), '/');
     }
     return $raw;
 }
예제 #4
0
 static function config()
 {
     parent::config();
     // load the default panel config file
     self::file(c::get('root.panel') . '/defaults/config/config.php');
     $root = c::get('root.site') . '/' . c::get('panel.folder') . '/config';
     self::file($root . '/config.php');
     self::file($root . '/config.' . server::get('server_name') . '.php');
 }
예제 #5
0
 static function raw($uri = false)
 {
     $raw = $uri ? $uri : ltrim(server::get('request_uri'), '/');
     // strip subfolders from uri
     if (c::get('subfolder')) {
         $raw = ltrim(preg_replace('!^' . preg_quote(c::get('subfolder')) . '\\/!i', '/', $raw), '/');
     }
     return $raw;
 }
예제 #6
0
 public function configure()
 {
     // load all available config files
     $root = $this->roots()->config();
     $configs = array('main' => 'config.php', 'host' => 'config.' . server::get('SERVER_NAME') . '.php', 'addr' => 'config.' . server::get('SERVER_ADDR') . '.php');
     $allowed = array_filter(dir::read($root), function ($file) {
         return substr($file, 0, 7) === 'config.' and substr($file, -4) === '.php';
     });
     foreach ($configs as $config) {
         $file = $root . DS . $config;
         if (in_array($config, $allowed, true) and file_exists($file)) {
             include_once $file;
         }
     }
     // apply the options
     $this->options = array_merge($this->options, c::$data);
     // overwrite the autodetected url
     if ($this->options['url']) {
         $this->urls->index = $this->options['url'];
     }
     // connect the url class with its handlers
     url::$home = $this->urls()->index();
     url::$to = $this->option('url.to', function ($url = '') {
         if (url::isAbsolute($url)) {
             return $url;
         }
         $start = substr($url, 0, 1);
         switch ($start) {
             case '#':
                 return $url;
                 break;
             case '.':
                 return page()->url() . '/' . $url;
                 break;
             default:
                 // don't convert absolute urls
                 return url::makeAbsolute($url);
                 break;
         }
     });
     // setup the thumbnail generator
     thumb::$defaults['root'] = $this->roots->thumbs();
     thumb::$defaults['url'] = $this->urls->thumbs();
     thumb::$defaults['driver'] = $this->option('thumbs.driver');
     thumb::$defaults['filename'] = $this->option('thumbs.filename');
     // simple error handling
     if ($this->options['debug'] === true) {
         error_reporting(E_ALL);
         ini_set('display_errors', 1);
     } else {
         if ($this->options['debug'] === false) {
             error_reporting(0);
             ini_set('display_errors', 0);
         }
     }
 }
예제 #7
0
 public function index()
 {
     if (isset($this->index)) {
         return $this->index;
     }
     if (r::cli()) {
         return $this->index = '/';
     } else {
         return $this->index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
     }
 }
예제 #8
0
 public function index($text = null, $exception = null)
 {
     $this->auth();
     if (is_null($text)) {
         $text = l('pages.error.missing');
     }
     if (server::get('HTTP_MODAL')) {
         return $this->modal('error', array('text' => $text, 'back' => url::last()));
     } else {
         return $this->screen('error/index', 'error', array('text' => $text, 'exception' => $exception));
     }
 }
예제 #9
0
 public function index()
 {
     if (isset($this->index)) {
         return $this->index;
     }
     // this value is used by the Panel
     $this->indexDetected = true;
     if (r::cli()) {
         return $this->index = '/';
     } else {
         return $this->index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
     }
 }
예제 #10
0
 public function testSanitization()
 {
     $_SERVER['HTTP_HOST'] = '<script>alert("xss")</script>';
     $_SERVER['SERVER_NAME'] = '<script>alert("xss")</script>';
     $this->assertEquals('alertxss', server::get('HTTP_HOST'));
     $this->assertEquals('alertxss', server::get('SERVER_NAME'));
     $_SERVER['HTTP_HOST'] = '127.0.0.1';
     $_SERVER['SERVER_NAME'] = '127.0.0.1';
     $this->assertEquals('127.0.0.1', server::get('HTTP_HOST'));
     $this->assertEquals('127.0.0.1', server::get('SERVER_NAME'));
     $_SERVER['SERVER_PORT'] = '<script>alert("xss")</script>999';
     $this->assertEquals('999', server::get('SERVER_PORT'));
 }
예제 #11
0
 function __construct($uri = false)
 {
     // set the defaults
     $this->path = new uriPath();
     $this->params = new uriParams();
     $this->query = new uriQuery(str::parse(server::get('query_string'), 'query'));
     $this->extension = false;
     $this->original = $_SERVER['REQUEST_URI'];
     $this->raw = $this->raw($uri);
     $this->url = url(ltrim($this->raw, '/'));
     // crawl the uri and get all elements
     $this->crawl();
 }
예제 #12
0
파일: app.php 프로젝트: kompuser/panel
 public static function configure()
 {
     if (is_null(static::$site)) {
         static::$site = kirby::panelsetup();
     }
     // load all available routes
     static::$routes = array_merge(static::$routes, require root('panel.app.routes') . DS . 'api.php');
     static::$routes = array_merge(static::$routes, require root('panel.app.routes') . DS . 'views.php');
     // setup the blueprint root
     blueprint::$root = c::get('root.site') . DS . 'blueprints';
     // start the router
     static::$router = new Router();
     static::$router->register(static::$routes);
     // content language switcher variable
     if (static::$site->multilang()) {
         if ($language = server::get('http_language') or $language = s::get('lang')) {
             static::$site->visit('/', $language);
         }
         app::$language = static::$site->language()->code();
         s::set('lang', app::$language);
     }
     // load the interface language file
     if (static::$site->user()) {
         $languageCode = static::$site->user()->language();
     } else {
         $languageCode = c::get('panel.language', 'en');
     }
     // validate the language code
     if (!in_array($languageCode, static::languages()->keys())) {
         $languageCode = 'en';
     }
     // store the interface language
     app::$interfaceLanguage = $languageCode;
     $language = (require root('panel.app.languages') . DS . $languageCode . '.php');
     // set all language variables
     l::$data = $language['data'];
     // register router filters
     static::$router->filter('auth', function () {
         if (!app::$site->user()) {
             go('panel/login');
         }
     });
     // check for a completed installation
     static::$router->filter('isInstalled', function () {
         if (app::$site->users()->count() == 0) {
             go('panel/install');
         }
     });
     // only use the fragments of the path without params
     static::$path = implode('/', (array) url::fragments(detect::path()));
 }
예제 #13
0
파일: urls.php 프로젝트: nsteiner/kdoc
 public function index()
 {
     if (isset($this->index)) {
         return $this->index;
     }
     if (r::cli()) {
         $index = '/';
     } else {
         $index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
     }
     // fix index URL for the Panel
     if (function_exists('panel')) {
         $index = dirname($index);
     }
     return $this->index = $index;
 }
예제 #14
0
 public function configure()
 {
     // load all available config files
     $root = $this->roots()->config();
     $configs = array('main' => $root . DS . 'config.php', 'host' => $root . DS . 'config.' . server::get('HTTP_HOST') . '.php', 'addr' => $root . DS . 'config.' . server::get('SERVER_ADDR') . '.php');
     foreach ($configs as $config) {
         if (file_exists($config)) {
             include_once $config;
         }
     }
     // apply the options
     $this->options = array_merge($this->options, c::$data);
     // connect the url class with its handlers
     url::$home = $this->urls()->index();
     url::$to = $this->option('url.to', function ($url = '') {
         if (url::isAbsolute($url)) {
             return $url;
         }
         $start = substr($url, 0, 1);
         switch ($start) {
             case '#':
                 return $url;
                 break;
             case '.':
                 return page()->url() . '/' . $url;
                 break;
             default:
                 // don't convert absolute urls
                 return url::makeAbsolute($url);
                 break;
         }
     });
     // setup the thumbnail generator
     thumb::$defaults['root'] = $this->roots->thumbs();
     thumb::$defaults['url'] = $this->urls->thumbs();
     thumb::$defaults['driver'] = $this->option('thumbs.driver');
     thumb::$defaults['filename'] = $this->option('thumbs.filename');
     // simple error handling
     if ($this->option('debug')) {
         error_reporting(E_ALL);
         ini_set('display_errors', 1);
     } else {
         error_reporting(0);
         ini_set('display_errors', 0);
     }
 }
예제 #15
0
파일: panel.php 프로젝트: v1m0/kirby-f6
 public function license()
 {
     $key = c::get('license');
     $type = 'trial';
     /**
      * Hey stranger, 
      * 
      * So this is the mysterious place where the panel checks for 
      * valid licenses. As you can see, this is not reporting
      * back to any server and the license keys are rather simple to 
      * hack. If you really feel like removing the warning in the panel
      * or tricking Kirby into believing you bought a valid license even 
      * if you didn't, go for it! But remember that literally thousands of 
      * hours of work have gone into Kirby in order to make your 
      * life as a developer, designer, publisher, etc. easier. If this 
      * doesn't mean anything to you, you are probably a lost case anyway. 
      * 
      * Have a great day! 
      * 
      * Bastian
      */
     if (str::startsWith($key, 'K2-PRO') and str::length($key) == 39) {
         $type = 'Kirby 2 Professional';
     } else {
         if (str::startsWith($key, 'K2-PERSONAL') and str::length($key) == 44) {
             $type = 'Kirby 2 Personal';
         } else {
             if (str::startsWith($key, 'MD-') and str::length($key) == 35) {
                 $type = 'Kirby 1';
             } else {
                 if (str::startsWith($key, 'BETA') and str::length($key) == 9) {
                     $type = 'Kirby 1';
                 } else {
                     if (str::length($key) == 32) {
                         $type = 'Kirby 1';
                     } else {
                         $key = null;
                     }
                 }
             }
         }
     }
     $localhosts = array('::1', '127.0.01', '0.0.0.0');
     return new Obj(array('key' => $key, 'local' => in_array(server::get('SERVER_ADDR'), $localhosts) or server::get('SERVER_NAME') == 'localhost', 'type' => $type));
 }
예제 #16
0
파일: url.php 프로젝트: LucasFyl/korakia
 /**
  * Returns the URL for document root no 
  * matter what the path is. 
  * 
  * @return string
  */
 public static function index()
 {
     if (r::cli()) {
         return '/';
     } else {
         return static::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
     }
 }
예제 #17
0
파일: de.php 프로젝트: samnabi/shopkit
<?php

l::set(['username' => 'Benutzername', 'password' => 'Passwort', 'login' => 'Einloggen', 'register' => 'Registrieren', 'honeypot-label' => 'Sie dieses Feld nicht ausfüllen. (Spamschutz)', 'email-address' => 'E-Mail Adresse', 'first-name' => 'Vorname', 'last-name' => 'Nachname', 'full-name' => 'Voller Name', 'country' => 'Land', 'country-help' => 'Um die Versandkosten zu kalkulieren', 'shop-by-category' => 'Einkaufen nach Kategorie', 'buy' => 'Kaufen', 'out-of-stock' => 'Ausverkauft', 'price' => 'Preis', 'subtotal' => 'Zwischensumme', 'shipping' => 'Versand', 'tax' => 'Umsatzsteuer', 'total' => 'Insgesamt', 'from' => 'Von', 'activate-account' => 'Aktiviere deinen Konto', 'activate-message-first' => 'Ihre E-Mail-Adresse wurde verwendet, um ein Konto bei ' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . ' zu erstellen. Folgen Sie bitte den unten stehenden Link Ihr Konto zu aktivieren.', 'activate-message-last' => 'Wenn Sie dieses Konto nicht erstellt haben, wird keine Aktion Ihrerseits erforderlich. Das Konto wird inaktiv bleiben.', 'reset-password' => 'Setze dein Passwort zurück', 'reset-message-first' => 'Jemand bat um ein Zurücksetzen des Kennworts für Ihr Konto bei ' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . '. Folgen Sie bitte den unten stehenden Link zum Zurücksetzen des Passworts.', 'reset-message-last' => 'Wenn Sie dieses Passwort-Reset angefordert hat, wird keine Aktion Ihrerseits erforderlich.', 'qty' => 'Anz.: ', 'redirecting' => 'Weiterleiten...', 'continue-to-paypal' => 'Weiter zu PayPal', 'notification-account' => 'Sie haben noch keine Benutzer angelegt. <a href="' . url('panel') . '/install" title="Installationsseite">Benutzer anlegen</a>.', 'notification-login' => 'Lassen Sie uns beenden Sie Ihren Shop einrichten! <a href="#user">Melden Sie</a> sich an, um fortzufahren.', 'notification-options' => 'Sie haben noch keine Shop-Optionen angelegt. <a href="' . url('panel') . '/pages/shop/edit" title="Shop-Optionen">Währung, Versand, und Umsatzsteuer definieren</a>.', 'notification-category' => 'Sie haben noch keine Produkt-Kategorien angelegt. <a href="' . url('panel') . '/pages/shop/edit" title="Kategorie anlegen">Erste Kategorie anlegen</a>.', 'notification-product-first' => 'Sie haben noch keine Produkt angelegt. <a href="' . url('panel') . '/pages/', 'notification-product-last' => '/add" title="Produkt anlegen">Erstellen Sie Ihr erstes Produkt mit dem Armaturenbrett</a>.', 'notification-product' => 'Sie haben keine Produkte. <a href="' . url('panel') . '/pages/shop/edit" title="Neues Produkt erstellen">Erstes Produkt im Dashboard anlegen</a>.', 'notification-license' => 'Dieser Shop hat keine Shopkit-Lizenz. Geben Sie den Lizenzschlüssen in der <strong>config.php</strong> Datei ein, bevor Sie die Website live schalten.', 'notification-discount' => 'Ihr Rabatt-Code <strong><code>' . s::get('discountCode') . '</code></strong> wird an der Kasse aktiviert werden.', 'notification-giftcertificate' => 'Ihr Geschenkgutschein <strong><code>' . s::get('giftCertificateCode') . '</code></strong> wird an der Kasse aktiviert werden.', 'discount-code-help' => 'Verwenden Sie diesen Rabatt Code jedes Mal, wenn Sie sich anmelden.', 'notification-login-failed' => 'Leider können wir konnte Sie nicht anmelden in. Entweder ist das Kennwort oder E-Mail-Adresse nicht richtig ist.', 'view-cart' => 'Warenkorb anzeigen', 'edit-page' => 'Seite bearbeiten', 'edit-shop' => 'Shop Einstellungen', 'edit-design' => 'Design', 'dashboard' => 'Dashboard', 'view-orders' => 'Bestellungen anzeigen', 'my-account' => 'Mein Benutzerkonto', 'logout' => 'Ausloggen', 'bill-to' => 'Rechnung an', 'invoice' => 'Rechnung', 'transaction-id' => 'Transaktions-ID', 'order-notification-subject' => '[' . $site->title() . '] New order placed', 'order-notification-message' => 'Someone placed an order from your shop at ' . server::get('server_name') . '. Manage transaction details here:', 'order-error-subject' => '[' . $site->title() . '] Problem with a new order', 'order-error-message-update' => "The payment has been received, but something went wrong with the final step of the transaction.\n\nEither the customer's details haven't been saved; the inventory wasn't updated correctly; or the staff order notification didn't get sent.\n\nInvestigate the transaction details here:", 'order-error-message-tamper' => "A payment was received, but it doesn't match the order that was placed.\n\nInvestigate the transaction details here:", 'new-customer' => 'Neuer Kunde?', 'forgot-password' => 'Passwort vergessen', 'subpages' => 'Seiten', 'search-shop' => 'Shop durchsuchen', 'search' => 'Suchen', 'phone' => 'Telefon', 'email' => 'E-Mail', 'address' => 'Adresse', 'prev' => 'Zurück', 'next' => 'Weiter', 'view-grid' => 'Gitteransicht', 'account-success' => 'Ihre Informationen wurden aktualisiert.', 'account-failure' => 'Entschuldigung, das hat nicht funktioniert. Bitte stellen Sie sicher, dass alle Informationen korrekt eingegeben wurden, insbesondere die E-Mail Adresse.', 'account-delete-error' => 'Entschuldigung, das Benutzerkonto konnte nicht gelöscht werden.', 'account-reset' => 'Bitte wählen Sie ein neues Passwort und stellen Sie sicher, dass Ihre Informationen sind up-to-date.', 'password-help' => 'Leerlassen um das Passwort beizubehalten', 'update' => 'Aktualisieren', 'delete-account' => 'Benutzerkonto löschen', 'delete-account-text' => 'Wenn Sie auf diesen Button klicken, gibt es kein Zurück mehr. Ihr Benutzerkonto wird unumkehrbar gelöscht.', 'delete-account-verify' => 'Benutzerkonto löschen. Ich bin mir sicher.', 'username-no-account' => 'Der Benutzername konnte nicht geändert werden.', 'discount-code' => 'Rabattcode', 'no-cart-items' => 'Keine Artikel im Warenkorb!', 'product' => 'Produkt', 'quantity' => 'Anzahl', 'delete' => 'Löschen', 'update-country' => 'Land ändern', 'update-shipping' => 'Aktualisierung Versand', 'free-shipping' => 'Kostenloser Versand', 'sandbox-message' => 'Sie befinden sich im Sandbox-Modus. Dieser Einkauf wird nicht berechnet.', 'pay-now' => 'Jetzt bezahlen', 'pay-later' => 'Später bezahlen', 'empty-cart' => 'Leerer Warenkorb', 'discount' => 'Rabatt', 'gift-certificate' => 'Geschenkgutschein', 'code-apply' => 'Bewerben Code', 'remaining' => 'verbleibend', 'no-tax' => 'Keine Steuer', 'no-shipping' => 'Kostenloser Versand', 'terms-conditions' => 'Durch die Zusammenarbeit mit dieser Transaktion fortfahren, stimmen Sie den', 'order-details' => 'Bestelldetails', 'personal-details' => 'Persönliche Details', 'confirm-order' => 'Bestellung bestätigen', 'mailing-address' => 'Mailing address', 'no-orders' => 'Sie haben noch keine Einkäufe getätigt.', 'no-auth-orders' => 'Um die Einkäufe über Ihre E-Mail Adresse einzusehen, müssen Sie sich <a href="#user">registrieren oder einloggen</a>.', 'no-filtered-orders' => 'Es gibt keine Einkäufe mit diesem Status. <a href="orders">Zurück zur vollständigen Liste</a>.', 'products' => 'Produkte', 'status' => 'Status', 'download-invoice' => 'Rechnung herunterladen (PDF)', 'download-files' => 'Dateien herunterladen', 'download-file' => 'Datei herunterladen', 'download-expired' => 'Download abgelaufen', 'view-on-paypal' => 'Auf PayPal anzeigen', 'pending' => 'Ausstehend', 'paid' => 'Bezahlt', 'shipped' => 'Verschickt', 'filter' => 'Filter', 'related-products' => 'Ähnliche Produkte', 'register-success' => 'Vielen Dank, Ihr Benutzerkonto wurde registriert! Sie können sich nun <a href="#user">einloggen</a>.', 'register-failure' => 'Entschuldigung, das hat nicht funktioniert. Bitte versuche es erneut.', 'register-failure-email' => 'Please provide an email address.', 'register-failure-fullname' => 'Please provide your full name.', 'register-failure-country' => 'Please select your country.', 'register-failure-verification' => 'Wir konnten Ihre Bestätigungs-E-Mail nicht senden. Bitte kontaktieren Sie den Verkäufer direkt, um Ihr Konto zu aktivieren.', 'register-duplicate' => 'Entschuldigung, es gibt bereits ein Benutzerkonto mit dieser E-Mail Adresse.', 'reset-submit' => 'Passwort zurücksetzen', 'reset-success' => 'Sie erhalten eine E-Mail mit Anweisungen erhalten Sie Ihr Passwort zurücksetzen.', 'reset-error' => 'Leider konnten wir nicht das Konto finden.', 'no-search-results' => 'Entschuldigung, es gibt keine Suchergebnisse zu diesem Begriff.']);
예제 #18
0
echo url('feed');
?>
" title="<?php 
echo html($site->title());
?>
 Blog Feed" />

</head>
<body class="<?php 
e(c::get('stage'), 'stage ');
echo str_replace('.', '-', $page->template());
?>
" id="top">

  <?php 
if (server::get('SERVER_NAME') == 'getkirby.com') {
    ?>
  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-431401-11', 'auto');
    ga('send', 'pageview');

  </script>
  <?php 
}
?>
예제 #19
0
<?php

// detect handler from 1) query parameter ("?handler="), or fallback to 2) http referer
$handler_name = get('handler') ?: a::last(array_filter(explode('/', server::get('http_referer'))));
$handler_path = c::get('root.content') . '/smart-submit/' . $handler_name . '.php';
// check honeypot
if (get('smart-submit-honeypot') && intval(get('smart-submit-honeypot')) < 2) {
    die('{"error":"' . (l::get('smart-submit-alarm') ?: 'Anti-spam alarm. Please try again.') . '"}');
}
if (file_exists($handler_path)) {
    require $handler_path;
} else {
    die('{"error":"' . (l::get('smart-submit-missing-handler') ?: 'Error - handler not found. Please contact web site administrator for details.') . '"}');
}
예제 #20
0
<?php

// Set detected language
site()->visit('shop', (string) site()->detectedLanguage());
site()->kirby->localize();
// Build body text
$body = l::get('transaction-id') . ' ' . $txn->txn_id() . "\n\n";
$body .= 'status :' . $payment_status . "\n";
$body .= 'payer-name : ' . $payer_name . "\n";
$body .= 'payer-email : ' . $payer_email . "\n";
$body .= 'payer-address : ' . $payer_address . "\n\n";
$body .= l::get('order-error-message-update') . ' ';
$body .= page('shop/orders')->url() . '?txn_id=' . $txn->txn_id();
// Build email
$email = new Email(array('to' => page('shop')->error_email()->value, 'from' => 'noreply@' . server::get('server_name'), 'subject' => l::get('order-error-subject'), 'body' => $body));
// Send it
$email->send();
예제 #21
0
 public function configure()
 {
     // load all available config files
     $root = $this->roots()->config();
     $configs = array('main' => 'config.php', 'host' => 'config.' . server::get('SERVER_NAME') . '.php', 'addr' => 'config.' . server::get('SERVER_ADDR') . '.php');
     $allowed = array_filter(dir::read($root), function ($file) {
         return substr($file, 0, 7) === 'config.' and substr($file, -4) === '.php';
     });
     foreach ($configs as $config) {
         $file = $root . DS . $config;
         if (in_array($config, $allowed, true) and file_exists($file)) {
             include_once $file;
         }
     }
     // apply the options
     $this->options = array_merge($this->options, c::$data);
     // overwrite the autodetected url
     if ($this->options['url']) {
         $this->urls->index = $this->options['url'];
     }
     // connect the url class with its handlers
     url::$home = $this->urls()->index();
     url::$to = $this->option('url.to', function ($url = '', $lang = null) {
         if (url::isAbsolute($url)) {
             return $url;
         }
         $start = substr($url, 0, 1);
         switch ($start) {
             case '#':
                 return $url;
                 break;
             case '.':
                 return page()->url() . '/' . $url;
                 break;
             default:
                 if ($page = page($url)) {
                     // use the "official" page url
                     return $page->url($lang);
                 } else {
                     // don't convert absolute urls
                     return url::makeAbsolute($url);
                 }
                 break;
         }
     });
     // setup the pagination redirect to the error page
     pagination::$defaults['redirect'] = $this->option('error');
     // setting up the email class
     email::$defaults['service'] = $this->option('email.service');
     email::$defaults['from'] = $this->option('email.from');
     email::$defaults['to'] = $this->option('email.to');
     email::$defaults['replyTo'] = $this->option('email.replyTo');
     email::$defaults['subject'] = $this->option('email.subject');
     email::$defaults['body'] = $this->option('email.body');
     email::$defaults['options'] = $this->option('email.options');
     // simple error handling
     if ($this->options['debug'] === true) {
         error_reporting(E_ALL);
         ini_set('display_errors', 1);
     } else {
         if ($this->options['debug'] === false) {
             error_reporting(0);
             ini_set('display_errors', 0);
         }
     }
 }
예제 #22
0
파일: kirby.php 프로젝트: andywenk/kirby
 function referer($default = null)
 {
     if (empty($default)) {
         $default = '/';
     }
     return server::get('http_referer', $default);
 }
예제 #23
0
파일: kirby.php 프로젝트: sdvig/kirbycms
 /** 
  * Returns the current URL
  * 
  * @return string
  */
 static function current()
 {
     return 'http://' . server::get('http_host') . server::get('request_uri');
 }
예제 #24
0
 static function config()
 {
     $root = c::get('root.config');
     self::file($root . '/config.php');
     self::file($root . '/config.' . server::get('server_name') . '.php');
 }
예제 #25
0
파일: es.php 프로젝트: samnabi/shopkit
<?php

l::set(['username' => 'Nombre de usuario', 'password' => 'Contraseña', 'login' => 'Ingresar', 'register' => 'Registrar', 'honeypot-label' => 'No llenar este campo. (Protection Anti-Spam)', 'email-address' => 'Correo electrónico', 'first-name' => 'Nombre', 'last-name' => 'Apellido(s)', 'full-name' => 'Nombre completo', 'country' => 'País', 'country-help' => 'Para calcular costos de envío', 'shop-by-category' => 'Comprar por categoría', 'buy' => 'Comprar', 'out-of-stock' => 'Sin existencias', 'price' => 'Precio', 'subtotal' => 'Subtotal', 'shipping' => 'Envío', 'tax' => 'Impuestos', 'total' => 'Total', 'from' => 'Desde', 'activate-account' => 'Activa tu cuenta', 'activate-message-first' => 'Tu correo electrónico fue usado para crear una cuenta en ' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . '. Por favor continúa en el siguiente enlace para activar tu cuenta.', 'activate-message-last' => 'Si tú no creaste esta cuenta, no es necesaria ninguna acción de tu parte. La cuenta permanecerá inactiva.', 'reset-password' => 'Cambia tu contraseña', 'reset-message-first' => 'Alguien solicitó restablecer la contraseña para tu cuenta en ' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . '. Por favor continúa en el siguiente enlace para restablecer tu contraseña.', 'reset-message-last' => 'Si tú no solicitaste restablecer la contraseña, no es necesaria ninguna acción de tu parte.', 'qty' => 'Cant: ', 'redirecting' => 'Redirigiendo...', 'continue-to-paypal' => 'Continuar con PayPal', 'notification-account' => 'No se ha establecido ningún usuario. <a href="' . url('panel') . '/install" title="Página de instalación de panel">Crea una cuenta ahora.</a>.', 'notification-login' => '¡Finaliza la configuración de tu tienda! <a href="#user">Inicia sesión</a> para continuar.', 'notification-options' => 'No se han configurado las opciones de tu tienda. <a href="' . url('panel') . '/pages/shop/edit" title="Opciones de tienda">Define ajustes de tipo de moneda, envío e impuestos aquí.</a>.', 'notification-category' => 'No cuentas con ningúna categoría de productos. <a href="' . url('panel') . '/pages/shop/add" title="Crea una nueva categoría">Crea tu primera categoría aquí:</a>.', 'notification-product-first' => 'No cuentas con ningún producto. <a href="' . url('panel') . '/pages/', 'notification-product-last' => '/add" title="Crea un nuevo producto">Crea tu primer producto con el Tablero</a>.', 'notification-license' => 'Esta tienda no cuenta con una clave de licencia Shopkit. Asegúrate de agregar una en el archivo <strong>config.php</strong> antes de que la página web esté en línea.', 'notification-discount' => 'Tu código de descuento <strong><code>' . s::get('discountCode') . '</code></strong> se aplicará al momento de pagar.', 'notification-giftcertificate' => 'Tu certficado de regalo <strong><code>' . s::get('giftCertificateCode') . '</code></strong> se aplicará al momento de pagar.', 'discount-code-help' => 'Usa este código de descuento cada vez que inicies sesión.', 'notification-login-failed' => 'Lo sentimos, no hemos podido iniciar tu sesión. La contraseña o el correo electrónico son incorrectos.', 'view-cart' => 'Ver carrito', 'edit-page' => 'Editar página', 'edit-shop' => 'Configuración de la tienda', 'edit-design' => 'Diseño', 'dashboard' => 'Tablero', 'view-orders' => 'Ver órdenes', 'my-account' => 'Mi cuenta', 'logout' => 'Cerrar sesión', 'bill-to' => 'Cobrar a', 'invoice' => 'Nota de Compra', 'transaction-id' => 'ID de transacción', 'order-notification-subject' => '[' . $site->title() . '] Nuevo pedido realizado', 'order-notification-message' => 'Alguien realizó un pedido desde tu tienda en ' . server::get('server_name') . '. Administra los detalles de transacción aquí:', 'order-error-subject' => '[' . $site->title() . '] Problema con una nueva orden', 'order-error-message-update' => "El pago ha sido recibido, pero algo salió mal en el último paso de la transacción.\n\nLos detalles del cliente no se han guardado, el inventario no se actualizó correctamente, o no se envió la notificación de tu orden.\n\nConoce los detalles de la transacción aquí:", 'order-error-message-tamper' => "El pago ha sido recibido, pero no concuerda con la orden que fue realizada.\n\nConoce los detalles de la transacción aquí:", 'new-customer' => '¿Cliente nuevo?', 'forgot-password' => 'Olvidé mi contraseña', 'subpages' => 'Páginas', 'search-shop' => 'Buscar tienda', 'search' => 'Buscar', 'phone' => 'Teléfono', 'email' => 'Correo Electrónico', 'address' => 'Dirección', 'prev' => 'Anterior', 'next' => 'Siguiente', 'view-grid' => 'Ver cuadrícula', 'account-success' => 'Tu información ha sido actualizada.', 'account-failure' => 'Lo sentimos, algo salió mal. Por favor asegúrate de que toda la información sea correcta, incluyendo tu correo electrónico.', 'account-delete-error' => 'Lo sentimos, tu cuenta no pudo ser eliminada.', 'account-reset' => 'Por favor elige una nueva contraseña y asegúrate de que tu información esté actualizada.', 'password-help' => 'Dejar en blanco para mantenerlo igual', 'update' => 'Actualizar', 'delete-account' => 'Eliminar cuenta', 'delete-account-text' => 'Comprendo que eliminar mi cuenta es una acción permanente. No hay forma de deshacer esta acción, y mi cuenta será eliminada para siempre. Los registros de transacciones que contengan mi dirección de correo electrónico y otros detalles serán guardadas.', 'delete-account-verify' => 'Eliminar mi cuenta. Sí, estoy seguro.', 'username-no-account' => 'El nombre de usuario no puede ser cambiado.', 'discount-code' => 'Código de descuento', 'no-cart-items' => '¡No tienes nada en tu carrito!', 'product' => 'Producto', 'quantity' => 'Cantidad', 'delete' => 'Eliminar', 'update-country' => 'Actualizar país', 'update-shipping' => 'Actualizar Envío', 'free-shipping' => 'Envío gratuito', 'sandbox-message' => 'Actualmente estás en modo de prueba. Esta transacción no será una compra real.', 'pay-now' => 'Pagar ahora', 'pay-later' => 'Pagar después', 'empty-cart' => 'Vaciar carrito', 'discount' => 'Descuento', 'discount-apply' => 'Aplicar Descuento', 'gift-certificate' => 'Certificado de Regalo', 'code-apply' => 'Aplicar Código', 'remaining' => 'Restante', 'no-tax' => 'Sin impuestos', 'no-shipping' => 'Sin Envío', 'terms-conditions' => 'Al continuar con esta transacción, estás de acuerdo con los', 'order-details' => 'Detalles de la orden', 'personal-details' => 'Detalles personales', 'confirm-order' => 'Confirmar orden', 'mailing-address' => 'Dirección de envío', 'no-orders' => 'Aún no has realizado ninguna orden.', 'no-auth-orders' => 'Para ver órdenes asociadas a tu correo electrónico, por favor <a href="#user">regístrate o inicia sesión.</a>.', 'no-filtered-orders' => 'No hay órdenes con este estatus. <a href="orders">Volver a la lista completa</a>.', 'products' => 'Productos', 'status' => 'Estatus', 'download-invoice' => 'Descargar Nota de Compra (PDF)', 'download-files' => 'Descargar Archivos', 'download-file' => 'Descargar Archivo', 'download-expired' => 'Descarga ha expirado', 'view-on-paypal' => 'Ver en PayPal', 'pending' => 'Pendiente', 'paid' => 'Pagado', 'shipped' => 'Enviado', 'filter' => 'Filtro', 'related-products' => 'Productos relacionados', 'register-success' => 'Gracias, tu cuenta ha sido registrada. Recibirás un correo electrónico con instrucciones para activar tu cuenta.', 'register-failure' => 'Lo sentimos, algo salió mal. Vuelve a intentarlo.', 'register-failure-email' => 'Introduzca una dirección de correo electrónico.', 'register-failure-fullname' => 'Proporcione su nombre completo.', 'register-failure-country' => 'Por favor seleccione su país.', 'register-failure-verification' => 'Lo sentimos, no pudimos enviar su correo electrónico de verificación de cuenta. Póngase en contacto con el propietario de la tienda directamente para activar su cuenta.', 'register-duplicate' => 'Lo sentimos, actualmente ya hay una cuenta con ese dirección de correo electrónico.', 'reset-submit' => 'Restablecer contraseña', 'reset-success' => 'Recibirás un correo electrónico con las instrucciones para restablecer tu contraseña.', 'reset-error' => 'Lo sentimos, no pudimos encontrar esa cuenta.', 'no-search-results' => 'Lo sentimos, no hay resultados para tu búsqueda.']);
예제 #26
0
<?php

// direct access protection
if (!defined('KIRBY')) {
    die('Direct access is not allowed');
}
// Kirby Troubleshoot File
$modules = apache_get_modules();
$rewrite = in_array('mod_rewrite', $modules);
$subfolder = ltrim(dirname(server::get('script_name')), '/');
$url = c::get('url', 'http://' . server::get('http_host'));
$root = c::get('root');
$templates = c::get('root.templates');
$cache = c::get('root.cache');
if (!empty($subfolder)) {
    $url = $url . '/' . $subfolder;
}
$compatible = true;
if (floatval(phpversion()) < 5.2) {
    $compatible = false;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  
<title>Kirby Troubleshooting</title>
<meta charset="utf-8" />
<meta name="robots" content="noindex, nofollow" />

<style>
예제 #27
0
function relativePath($path)
{
    return str_replace(server::get('DOCUMENT_ROOT'), '', $path);
}
예제 #28
0
 function urlSetup()
 {
     // auto-detect the url if it is not set
     $url = c::get('url') === false ? c::get('scheme') . server::get('http_host') : rtrim(c::get('url'), '/');
     // try to detect the subfolder
     $subfolder = c::get('subfolder') ? trim(c::get('subfolder'), '/') : trim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
     if ($subfolder) {
         c::set('subfolder', $subfolder);
         // check if the url already contains the subfolder
         // so it's not included twice
         if (!preg_match('!' . preg_quote($subfolder) . '$!i', $url)) {
             $url .= '/' . $subfolder;
         }
     }
     // set the final url
     c::set('url', $url);
 }
예제 #29
0
파일: site.php 프로젝트: robeam/kirbycms
 function load()
 {
     // initiate the site and make pages and page
     // globally available
     $pages = $this->pages;
     $page = $this->pages->active();
     // check for ssl
     if (c::get('ssl')) {
         // if there's no https in the url
         if (!server::get('https')) {
             go(str_replace('http://', 'https://', $page->url()));
         }
     }
     // check for a misconfigured subfolder install
     if ($page->isErrorPage()) {
         // get the subfolder in which the site is running
         $subfolder = ltrim(dirname(server::get('script_name')), '/');
         // if it is running in a subfolder and it does not match the config
         // send an error with some explanations how to fix that
         if (!empty($subfolder) && c::get('subfolder') != $subfolder) {
             // this main url
             $url = 'http://' . server::get('http_host') . '/' . $subfolder;
             require_once c::get('root.kirby') . '/modals/subfolder.php';
             exit;
         }
     }
     // redirect file urls (file:image.jpg)
     if ($this->uri->param('file')) {
         // get the local file
         $file = $page->files()->find($this->uri->param('file'));
         if ($file) {
             go($file->url());
         }
     }
     // redirect /home to /
     if ($this->uri->path() == c::get('home')) {
         go(url());
     }
     // redirect tinyurls
     if ($this->uri->path(1) == c::get('tinyurl.folder') && c::get('tinyurl.enabled')) {
         $hash = $this->uri->path(2);
         if (!empty($hash)) {
             $resolved = $this->pages->findByHash($hash)->first();
             // redirect to the original page
             if ($resolved) {
                 go(url($resolved->uri));
             }
         }
     }
     // set the global template vars
     tpl::set('site', $this);
     tpl::set('pages', $pages);
     tpl::set('page', $page);
     $cacheID = $this->uri->toCacheID() . '.php';
     $cacheModified = time();
     $cacheData = null;
     if ($this->htmlCacheEnabled) {
         // check if the cache is disabled for some reason
         $this->htmlCacheEnabled = $page->isErrorPage() || in_array($page->uri(), c::get('cache.ignore', array())) ? false : true;
         // check for the last modified date of the cache file
         $cacheModified = cache::modified($cacheID);
         // check if the files have been modified
         // since the last html cache file has been written
         if ($this->htmlCacheEnabled && $cacheModified >= $this->modified) {
             $cacheData = cache::get($cacheID, true);
         }
     }
     if (empty($cacheData)) {
         // load the main template
         $html = tpl::load($page->template(), false, true);
         if ($this->htmlCacheEnabled) {
             cache::set($cacheID, (string) $html, true);
         }
     } else {
         $html = $cacheData;
     }
     die($html);
 }
예제 #30
0
 /**
  * Redirect to a specific page.
  *
  * @param   string  $target   Page to redirect to.
  * @param   array   $data     Optional data to save in a users session.
  */
 protected function redirect($target, $data = null)
 {
     // Write optional session data
     if ($data instanceof Messages) {
         Session::flash('errors', $data->toArray());
     } else {
         if (is_array($data)) {
             Session::flash($data);
         } else {
             if (!is_null($data)) {
                 Session::flash('data', $data);
             }
         }
     }
     // Allow to specify the redirect uri as parameter
     $url = r::get('redirect_to');
     if (!empty($url)) {
         redirect::to($url);
     }
     // Perform redirect
     switch ($target) {
         case 'home':
             redirect::home();
             break;
         case 'back':
             redirect::back();
             break;
         case '404':
             $page = site()->errorPage();
             redirect::to($page->uri());
             break;
         case 'referer':
             $referer = server::get('HTTP_REFERER');
             redirect::to($referer);
             break;
         default:
             redirect::to($target);
             break;
     }
 }