Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Commit

Permalink
Blocked panel installer on public servers
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed May 17, 2016
1 parent 68ce732 commit 12a14dd
Show file tree
Hide file tree
Showing 30 changed files with 57 additions and 43 deletions.
14 changes: 10 additions & 4 deletions app/forms/installation/check.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
)
));

$info = new Brick('ol');

foreach($problems as $problem) {
$info->append('<li>' . $problem . '</li>');
if(count($problems) > 1) {
$info = new Brick('ol');
foreach($problems as $problem) {
$info->append('<li>' . $problem . '</li>');
}
} else {
$info = new Brick('p');
foreach($problems as $problem) {
$info->append($problem);
}
}

// add the list of problems to the info field
Expand Down
9 changes: 6 additions & 3 deletions app/src/panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,16 +474,19 @@ public function license() {
$key = null;
}

$localhosts = array('::1', '127.0.0.1', '0.0.0.0');

return new Obj(array(
'key' => $key,
'local' => (in_array(server::get('SERVER_ADDR'), $localhosts) or server::get('SERVER_NAME') == 'localhost'),
'local' => $this->isLocal(),
'type' => $type,
));

}

public function isLocal() {
$localhosts = array('::1', '127.0.0.1', '0.0.0.0');
return (in_array(server::get('SERVER_ADDR'), $localhosts) || server::get('SERVER_NAME') == 'localhost');
}

public function notify($text) {
s::set('message', array(
'type' => 'notification',
Expand Down
6 changes: 5 additions & 1 deletion app/src/panel/installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function isCompleted() {

public function problems() {

$checks = array('accounts', 'thumbs', 'blueprints', 'content', 'avatars');
$checks = array('allowed', 'accounts', 'thumbs', 'blueprints', 'content', 'avatars');
$problems = array();

foreach($checks as $c) {
Expand All @@ -29,6 +29,10 @@ public function problems() {

}

protected function checkAllowed() {
return (panel()->isLocal() || kirby()->option('panel.install') === true);
}

protected function checkAccounts() {

$root = kirby()->roots()->accounts();
Expand Down
2 changes: 1 addition & 1 deletion app/translations/ar/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "المشاكل التالية واجهت كيربي أثناء التنصيب…",
"installation.check.retry": "إعادة المحاولة",
"installation.check.error": "هناك بعض المشاكل!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "المجلد /site/accounts غير قابل للكتابة",
"installation.check.error.avatars": "المجلد /assets/avatars غير قابل للكتابة",
"installation.check.error.blueprints": "فضلا قم بإضافة المجلد /site/blueprints",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "توجد صفحة أخرى لها نفس الوصلة",
"pages.url.error.move": "لم يكن بالإمكان تغيير الوصلة",
"pages.url.error.rights": "You cannot change the URL of this page",
"pages.url.home.error.error": "The URL for the home and error pages cannot be changed",
"pages.template.select.label": "القالب",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/bg/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby откри следните проблеми по време на инсталацията...",
"installation.check.retry": "Опитай пак",
"installation.check.error": "Има няколко проблема!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "папката /site/accounts не е записваема",
"installation.check.error.avatars": "Папката assets/avatars не е записваема",
"installation.check.error.blueprints": "моля добавете папка /site/blueprints",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Страница със същата URL-добавка вече съществува",
"pages.url.error.move": "Добавката не може да се променя",
"pages.url.error.rights": "Не можете да смените URL за тази страница",
"pages.url.home.error.error": "URL на HOME страницата и ERROR страницата не могат да се променят",
"pages.template.select.label": "Модел",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/ca/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby ha trobat els següents problemes durant l'instal·lació…",
"installation.check.retry": "Reintentar",
"installation.check.error": "Hi ha alguns problemes!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts no té permís d'escriptura",
"installation.check.error.avatars": "/assets/avatars no té permís d'escriptura",
"installation.check.error.blueprints": "Afegeix el directori /site/blueprints",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Ja existeix una altra pàgina amb el mateix apèndix",
"pages.url.error.move": "L'apèndix no es pot modificar",
"pages.url.error.rights": "No pots canviar la URL d'aquest pàgina",
"pages.url.home.error.error": "La URL de la pàgina d'inici i de la pàgina d'error no es pot modificar",
"pages.template.select.label": "Plantilla",
"pages.template.warning.text": "Els següents camps canviaran quan canviïs de plantilla",
"pages.template.warning.removed": "Eliminar camps",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/cs/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby během instalace narazilo na následující problémy…",
"installation.check.retry": "Zkusit znovu",
"installation.check.error": "Nastaly nějaké problémy!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts není zapisovatelné",
"installation.check.error.avatars": "/assets/avatars není zapisovatelné",
"installation.check.error.blueprints": "Prosím přidejte složku /site/blueprints",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Stránka se stejnou příponou již existuje",
"pages.url.error.move": "Nepodařilo se změnit příponu",
"pages.url.error.rights": "Nemůžete změnit URL této stránky",
"pages.url.home.error.error": "URL úvodní a chybových stránek nemohou být změněny",
"pages.template.select.label": "Šablona",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/da/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby stødte på følgende problemer under installationen…",
"installation.check.retry": "Prøv igen",
"installation.check.error": "Der er nogle problemer!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts er ikke skrivbar",
"installation.check.error.avatars": "/assets/avatars er ikke skrivbar",
"installation.check.error.blueprints": "Tilføj venligst en /site/blueprints mappe",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "En side med samme appendiks eksisterer allerede",
"pages.url.error.move": "URL-appendikset kunne ikke ændres",
"pages.url.error.rights": "Du kan ikke ændre denne sides URL",
"pages.url.home.error.error": "URLen for forside og fejl side kan ikke ændres",
"pages.template.select.label": "Skabelon",
"pages.template.warning.text": "Følgende felter ændres, hvis du skifter skabelon",
"pages.template.warning.removed": "Fjernede felter",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/de/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby hat die folgenden Probleme festgestellt…",
"installation.check.retry": "Wiederholen",
"installation.check.error": "Es gibt einige Probleme!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts ist nicht beschreibbar",
"installation.check.error.avatars": "/assets/avatars ist nicht beschreibbar",
"installation.check.error.blueprints": "Bitte lege den Ordner /site/blueprints an",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Eine Seite mit dem selben Anhang besteht bereits.",
"pages.url.error.move": "Die URL konnte nicht geändert werden",
"pages.url.error.rights": "Du kannst die URL dieser Seite nicht ändern",
"pages.url.home.error.error": "Die URL für die Start- and Fehlerseite kann nicht geändert werden",
"pages.template.select.label": "Vorlage",
"pages.template.warning.text": "Folgende Felder werden sich ändern, wenn du die Vorlage wechselst. ",
"pages.template.warning.removed": "Gelöschte Felder",
Expand Down
1 change: 1 addition & 0 deletions app/translations/en/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby encountered the following issues during installation…",
"installation.check.retry": "Retry",
"installation.check.error": "There are some issues!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts is not writable",
"installation.check.error.avatars": "/assets/avatars is not writable",
"installation.check.error.blueprints": "Please add a /site/blueprints folder",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/es_419/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby encontró los siguientes errores durante la instalación…",
"installation.check.retry": "Reintentar",
"installation.check.error": "¡Tenemos problemas!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts no tine permisos de escritura",
"installation.check.error.avatars": "/assets/avatars no tine permisos de escritura",
"installation.check.error.blueprints": "Por favor agrega una carpeta /site/blueprints",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Una página con el mismo apéndice-url ya existe",
"pages.url.error.move": "El apéndice-url no pudo ser cambiado",
"pages.url.error.rights": "Usted no puede cambiar la URL de esta página",
"pages.url.home.error.error": "La URL de las paginas home y error no pueden ser cambiadas",
"pages.template.select.label": "Plantilla",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/es_ES/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby encontró los siguientes errores durante la instalación…",
"installation.check.retry": "Reintentar",
"installation.check.error": "¡Hay un problema!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts no tiene permisos de escritura",
"installation.check.error.avatars": "/assets/avatars no tiene permisos de escritura",
"installation.check.error.blueprints": "Por favor, crea la carpeta /site/blueprints",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Ya existe una página con la misma URL",
"pages.url.error.move": "No se ha podido cambiar la URL",
"pages.url.error.rights": "No se puede cambiar la URL de esta página",
"pages.url.home.error.error": "No se puede cambiar la URL de las páginas de inicio y error",
"pages.template.select.label": "Plantilla",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/fa/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "کربی در هنگام نصب با موارد زیر روبرو شده است…",
"installation.check.retry": "تلاش مجدد",
"installation.check.error": "مشکلی رخ داده است!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts قابل نوشتن نیست",
"installation.check.error.avatars": "/assets/avatars قابل نوشتن نیست",
"installation.check.error.blueprints": "لطفا پوشه /site/blueprints را ایجاد کنید",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "یک صفحه با پیوست مشابه در حال حاضر وجود دارد",
"pages.url.error.move": "پیوست تغییر نکرد",
"pages.url.error.rights": "شما امکان تغییر آدرس این صفحه را ندارید",
"pages.url.home.error.error": "آدرس صفحه اصلی و صفحه خطا غیر قابل تغییر است",
"pages.template.select.label": "قالب صفحه",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/fi/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby havaitsi seuraavat virheet asennuksen yhteydessä…",
"installation.check.retry": "Yritä uudelleen",
"installation.check.error": "Muutama ongelma löytyi!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts edellyttää kirjoitusoikeudet",
"installation.check.error.avatars": "/assets/avatars edellyttää kirjoitusoikeudet",
"installation.check.error.blueprints": "Ole hyvä ja lisää /site/blueprints kansio",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Olemassaolevalla sivulla on jo sama URL-pääte",
"pages.url.error.move": "Päätettä ei voitu muuttaa",
"pages.url.error.rights": "You cannot change the URL of this page",
"pages.url.home.error.error": "The URL for the home and error pages cannot be changed",
"pages.template.select.label": "Sivupohja",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/fr/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Durant l’installation, Kirby a rencontré les problèmes suivants…",
"installation.check.retry": "Essayer de nouveau",
"installation.check.error": "Des problèmes on été rencontrés !",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "Le répertoire “/site/accounts” n’est pas accessible en écriture",
"installation.check.error.avatars": "Le répertoire “/assets/avatars” n’est pas accessible en écriture",
"installation.check.error.blueprints": "Veuillez ajouter un répertoire “/site/blueprints”",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Une page du même nom existe déjà",
"pages.url.error.move": "L’identifiant de l’URL n’a pu être changé",
"pages.url.error.rights": "Vous ne pouvez pas modifier l’URL de cette page",
"pages.url.home.error.error": "L’URL de la page d’accueil et de la page d’erreur ne peut être modifiée",
"pages.template.select.label": "Modèle de page",
"pages.template.warning.text": "Les champs suivants seront modifiés si vous changez de modèle de page",
"pages.template.warning.removed": "Champs supprimés",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/hu/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby az alábbi problémával találkozott…",
"installation.check.retry": "Újból",
"installation.check.error": "Van néhány probléma!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts nem írható",
"installation.check.error.avatars": "/assets/avatars nem írható",
"installation.check.error.blueprints": "Kérlek hozd létre a site/blueprints mappát",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Van már egy másik oldal ezzel az URL-lel",
"pages.url.error.move": "Az URL-t nem sikerült megváltoztatni",
"pages.url.error.rights": "Ennek az oldalnak nem tudod megváltoztatni az URL-jét",
"pages.url.home.error.error": "A főoldal és a hibaoldal URL-je nem változtatható meg",
"pages.template.select.label": "Sablon",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/id/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby menemukan beberapa masalah selagi menginstalasi…",
"installation.check.retry": "Coba lagi",
"installation.check.error": "Ada beberapa masalah!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts tidak bisa diakses",
"installation.check.error.avatars": "/assets/avatars tidak bisa diakses",
"installation.check.error.blueprints": "Tolong tambahkan folder /site/blueprints",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Halaman dengan lampiran yang sama sudah ada",
"pages.url.error.move": "Lampiran tidak bisa diubah",
"pages.url.error.rights": "You cannot change the URL of this page",
"pages.url.home.error.error": "The URL for the home and error pages cannot be changed",
"pages.template.select.label": "Template",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down
2 changes: 1 addition & 1 deletion app/translations/it/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"installation.check.text": "Kirby ha riscontrato i seguenti problemi durante l'installazione…",
"installation.check.retry": "Riprova",
"installation.check.error": "Sono stati riscontrati dei problemi!",
"installation.check.error.allowed": "You are only allowed to run the panel installer on a local machine or by setting the option panel.install to true in your /site/config/config.php",
"installation.check.error.accounts": "/site/accounts non dispone dei permessi di scrittura",
"installation.check.error.avatars": "/assets/avatars non dispone dei permessi di scrittura",
"installation.check.error.blueprints": "Aggiungi la cartella /site/blueprints",
Expand Down Expand Up @@ -103,7 +104,6 @@
"pages.url.error.exists": "Esiste già una pagina con lo stesso URL",
"pages.url.error.move": "L'URL non può essere modificato",
"pages.url.error.rights": "Non puoi cambiare l'URL di questa pagina",
"pages.url.home.error.error": "Gli URL per la home e le pagine di errore non possono essere cambiati",
"pages.template.select.label": "Template",
"pages.template.warning.text": "The following fields will change, when you switch the template",
"pages.template.warning.removed": "Removed fields",
Expand Down

0 comments on commit 12a14dd

Please sign in to comment.