mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2025-05-28 20:12:26 -04:00
Instalator fixes and lots and lots of other bugfixes
This commit is contained in:
parent
e19fd0d3c2
commit
c25e8bcae8
@ -37,7 +37,7 @@ Template::render_header(_("Dashboard"), true);
|
||||
<div class="timeline">
|
||||
<div class="line text-muted"></div>
|
||||
<h3><?php echo _("New incident");?></h3>
|
||||
<form id="new-incident" action="/admin/?new=incident" method="POST" class="clearfix">
|
||||
<form id="new-incident" action="<?php echo WEB_URL;?>/admin/?new=incident" method="POST" class="clearfix">
|
||||
<article class="panel">
|
||||
<?php if (isset($message))
|
||||
{?>
|
||||
@ -52,11 +52,12 @@ Template::render_header(_("Dashboard"), true);
|
||||
}else{
|
||||
$post_services = array();
|
||||
}
|
||||
|
||||
foreach($services as $service){
|
||||
?>
|
||||
<div class="item clearfix">
|
||||
<div class="service"><?php if ($service->get_status()!=-1){?><input type="checkbox" name="services[]" value="<?php echo $service->get_id(); ?>" <?php echo (in_array($service->get_id(), $post_services))?"checked":'';?> id="service-<?php echo $service->get_id(); ?>"><?php } ?><label for="service-<?php echo $service->get_id(); ?>"><?php echo $service->get_name(); ?></label></div>
|
||||
<div class="status <?php echo $classes[$service->get_status()];?>"><?php echo $statuses[$service->get_status()];?></div>
|
||||
<div class="status <?php if ($service->get_status()!=-1){echo $classes[$service->get_status()];}?>"><?php if ($service->get_status()!=-1){echo $statuses[$service->get_status()];}?></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ Template::render_header(_("Login"));
|
||||
<?php }else{?>
|
||||
<p class="alert alert-info"><?php echo _("Please login to continue.");?></p>
|
||||
<?php }?>
|
||||
<form action="/admin/" method="post">
|
||||
<form action="<?php echo WEB_URL;?>/admin/" method="post">
|
||||
<div class="form-group">
|
||||
<label for="email"><?php echo _("Email");?></label>
|
||||
<input placeholder="<?php echo _("Email");?>" class="form-control" name="email" id="email" type="email" tabindex="1" value="<?php echo htmlspecialchars((isset($_POST['email'])?$_POST['email']:''),ENT_QUOTES);?>" required>
|
||||
@ -19,7 +19,7 @@ Template::render_header(_("Login"));
|
||||
<label for="pass"><?php echo _("Password");?></label>
|
||||
<input placeholder="<?php echo _("Password");?>" class="form-control" name="pass" id="pass" type="password" tabindex="2" required>
|
||||
<div style="padding-top: 8px; position: relative;">
|
||||
<a href="?do=lost-password" class="pull-right noselect" tabindex="5"><?php echo _("Forgotten password?");?></a>
|
||||
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password" class="pull-right noselect" tabindex="5"><?php echo _("Forgotten password?");?></a>
|
||||
<input name="remember" id="remember" type="checkbox" tabindex="3"> <label class="lbl-login noselect" style="color: black;" for="remember"><?php echo _("Remember me");?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -13,12 +13,12 @@ Template::render_header(_("Lost password"));
|
||||
$user->change_password($_POST['token']);
|
||||
if (isset($message)){?>
|
||||
<p class="alert alert-danger"><?php echo $message?></p>
|
||||
<a href="/admin/?do=lost-password<?php echo "&id=".$_POST['id']."&token=".$_POST['token'];?>"><?php echo _("Go back");?> </a>
|
||||
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password<?php echo "&id=".$_POST['id']."&token=".$_POST['token'];?>"><?php echo _("Go back");?> </a>
|
||||
<?php
|
||||
}
|
||||
else{?>
|
||||
<p class="alert alert-success"><?php echo _("Password changed successfully!");?></p>
|
||||
<a href="/admin/"><?php echo _("Go back to login page");?></a>
|
||||
<a href="<?php echo WEB_URL;?>/admin/"><?php echo _("Go back to login page");?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -27,12 +27,12 @@ Template::render_header(_("Lost password"));
|
||||
User::password_link();
|
||||
if (isset($message)){?>
|
||||
<p class="alert alert-danger"><?php echo $message?></p>
|
||||
<a href="/admin/?do=lost-password"><?php echo _("Go back to start");?></a>
|
||||
<a href="<?php echo WEB_URL;?>/admin/?do=lost-password"><?php echo _("Go back to start");?></a>
|
||||
<?php
|
||||
}
|
||||
else{?>
|
||||
<p class="alert alert-success"><?php echo _("Email with password reset link has been sent!");?></p>
|
||||
<a href="/admin/"><?php echo _("Go back to login page");?></a>
|
||||
<a href="<?php echo WEB_URL;?>/admin/"><?php echo _("Go back to login page");?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,7 @@ Template::render_header(_("Lost password"));
|
||||
if (isset($message)){?>
|
||||
<p class="alert alert-danger"><?php echo $message?></p>
|
||||
<?php }?>
|
||||
<form action="/admin/?do=lost-password" method="post">
|
||||
<form action="<?php echo WEB_URL;?>/admin/?do=lost-password" method="post">
|
||||
<?php if (!isset($_GET['id'])||!isset($_GET['token'])){?>
|
||||
<label for="email"><?php echo _("Email");?>:</label>
|
||||
<div class="input-group pull-right">
|
||||
|
@ -9,7 +9,7 @@ Template::render_header(_("New user"), true); ?>
|
||||
<h2>Add new user</h2>
|
||||
</div>
|
||||
|
||||
<form action="/admin/?do=new-user&new=user" method="POST" class="form-horizontal">
|
||||
<form action="<?php echo WEB_URL;?>/admin/?do=new-user&new=user" method="POST" class="form-horizontal">
|
||||
<?php if (isset($message))
|
||||
{?>
|
||||
<p class="alert alert-danger"><?php echo $message?></p>
|
||||
|
@ -52,7 +52,7 @@ while($result = $query->fetch_assoc())
|
||||
echo "<td>".$result['name']."</td>";
|
||||
if ($user->get_rank()<=1)
|
||||
{
|
||||
echo '<td><a href="?do=settings&delete='.$result['id'].'" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
|
||||
echo '<td><a href="'.WEB_URL.'/admin/?do=settings&delete='.$result['id'].'" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
|
||||
}
|
||||
echo "</tr>";
|
||||
}?>
|
||||
@ -63,7 +63,7 @@ while($result = $query->fetch_assoc())
|
||||
|
||||
<section>
|
||||
<h3 class="pull-left"><?php echo _("Users");?></h3>
|
||||
<?php if ($user->get_rank() == 0){?> <a href="?do=new-user" class="btn btn-success pull-right"><?php echo _("Add new user");?></a><?php }?>
|
||||
<?php if ($user->get_rank() == 0){?> <a href="<?php echo WEB_URL;?>/admin/?do=new-user" class="btn btn-success pull-right"><?php echo _("Add new user");?></a><?php }?>
|
||||
<table class="table">
|
||||
|
||||
<thead><tr><th scope="col"><?php echo _("ID");?></th><th scope="col"><?php echo _("Username");?></th><th scope="col"><?php echo _("Name");?></th><th scope="col"><?php echo _("Surname");?></th><th scope="col"><?php echo _("Email");?></th><th scope="col"><?php echo _("Role");?></th><th scope="col">Active</th></tr></thead>
|
||||
@ -74,7 +74,7 @@ while($result = $query->fetch_assoc())
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$result['id']."</td>";
|
||||
echo "<td><a href='/admin/?do=user&id=".$result['id']."'>".$result['username']."</a></td>";
|
||||
echo "<td><a href='".WEB_URL."/admin/?do=user&id=".$result['id']."'>".$result['username']."</a></td>";
|
||||
echo "<td>".$result['name']."</td>";
|
||||
echo "<td>".$result['surname']."</td>";
|
||||
echo "<td><a href=\"mailto:".$result['email']."\">".$result['email']."</a></td>";
|
||||
|
@ -7,7 +7,7 @@ if (isset($_GET['id']))
|
||||
try {
|
||||
$displayed_user = new User($id);
|
||||
} catch (Exception $e) {
|
||||
header("Location: /admin/?do=user");
|
||||
header("Location: ".WEB_URL."/admin/?do=user");
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ class Constellation
|
||||
{
|
||||
if ($offset)
|
||||
{
|
||||
echo '<noscript><div class="centered"><a href="?offset='.($offset-$limit+1).'×tamp='.$timestamp.'" class="btn btn-default">'._("Back").'</a></div></noscript>';
|
||||
echo '<noscript><div class="centered"><a href="'.WEB_URL.'/?offset='.($offset-$limit+1).'×tamp='.$timestamp.'" class="btn btn-default">'._("Back").'</a></div></noscript>';
|
||||
}
|
||||
echo "<h3>"._("Past incidents")."</h3>";
|
||||
}
|
||||
@ -59,7 +59,7 @@ class Constellation
|
||||
}
|
||||
if ($show)
|
||||
{
|
||||
echo '<div class="centered"><a href="?offset='.($offset).'×tamp='.$timestamp.'" id="loadmore" class="btn btn-default">'._("Load more").'</a></div>';
|
||||
echo '<div class="centered"><a href="'.WEB_URL.'/?offset='.($offset).'×tamp='.$timestamp.'" id="loadmore" class="btn btn-default">'._("Load more").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class Incident
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$query = $stmt->get_result();
|
||||
header("Location: /admin");
|
||||
header("Location: ".WEB_URL."/admin");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +132,7 @@ class Incident
|
||||
$stmt->execute();
|
||||
$query = $stmt->get_result();
|
||||
}
|
||||
header("Location: /admin");
|
||||
header("Location: ".WEB_URL."/admin");
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ class Incident
|
||||
<div class="panel-heading clearfix">
|
||||
<h2 class="panel-title"><?php echo $this->title; ?></h2>
|
||||
<?php if ($admin){
|
||||
echo '<a href="?delete='.$this->id.'" class="pull-right delete"><i class="fa fa-trash"></i></a>';
|
||||
echo '<a href="'.WEB_URL.'/?delete='.$this->id.'" class="pull-right delete"><i class="fa fa-trash"></i></a>';
|
||||
}?>
|
||||
<time class="pull-right timeago" datetime="<?php echo $this->date; ?>"><?php echo $this->date; ?></time>
|
||||
</div>
|
||||
@ -165,7 +165,7 @@ class Incident
|
||||
<small><?php echo _("Posted by");?>: <?php echo $this->username;
|
||||
if (isset($this->end_date)){?>
|
||||
<span class="pull-right"><?php echo strtotime($this->end_date)>time()?_("Ending"):_("Ended");?>: <time class="pull-right timeago" datetime="<?php echo $this->end_date; ?>"><?php echo $this->end_date; ?></time></span>
|
||||
<?}?>
|
||||
<?php } ?>
|
||||
</small>
|
||||
</div>
|
||||
</article>
|
||||
|
@ -7,6 +7,218 @@ class LocaleNegotiator
|
||||
{
|
||||
private $accepted_langs = [];
|
||||
private $default_language;
|
||||
private $all_locales = array(
|
||||
'af_ZA' => 'Afrikaans',
|
||||
'am_ET' => 'አማርኛ',
|
||||
'ar_AE' => 'العربية',
|
||||
'ar_BH' => 'العربية',
|
||||
'ar_DZ' => 'العربية',
|
||||
'ar_EG' => 'العربية',
|
||||
'ar_IQ' => 'العربية',
|
||||
'ar_JO' => 'العربية',
|
||||
'ar_KW' => 'العربية',
|
||||
'ar_LB' => 'العربية',
|
||||
'ar_LY' => 'العربية',
|
||||
'ar_MA' => 'العربية',
|
||||
'arn_CL' => 'Mapuche',
|
||||
'ar_OM' => 'العربية',
|
||||
'ar_QA' => 'العربية',
|
||||
'ar_SA' => 'العربية',
|
||||
'ar_SY' => 'العربية',
|
||||
'ar_TN' => 'العربية',
|
||||
'ar_YE' => 'العربية',
|
||||
'as_IN' => 'অসমীয়া',
|
||||
'az_Cyrl_AZ' => 'Азәрбајҹан',
|
||||
'az_Latn_AZ' => 'Azərbaycan',
|
||||
'ba_RU' => 'Bashkir',
|
||||
'be_BY' => 'Беларуская',
|
||||
'bg_BG' => 'Български',
|
||||
'bn_BD' => 'বাংলা',
|
||||
'bn_IN' => 'বাংলা',
|
||||
'bo_CN' => 'བོད་སྐད་',
|
||||
'br_FR' => 'Brezhoneg',
|
||||
'bs_Cyrl_BA' => 'Босански',
|
||||
'bs_Latn_BA' => 'Bosanski',
|
||||
'ca_ES' => 'Català',
|
||||
'co_FR' => 'Corsican',
|
||||
'cs_CZ' => 'Čeština',
|
||||
'cy_GB' => 'Cymraeg',
|
||||
'da_DK' => 'Dansk',
|
||||
'de_AT' => 'Deutsch',
|
||||
'de_CH' => 'Deutsch',
|
||||
'de_DE' => 'Deutsch',
|
||||
'de_LI' => 'Deutsch',
|
||||
'de_LU' => 'Deutsch',
|
||||
'dsb_DE' => 'Dolnoserbšćina',
|
||||
'dv_MV' => 'Divehi',
|
||||
'el_GR' => 'Ελληνικά',
|
||||
'en_029' => 'English',
|
||||
'en_AU' => 'English',
|
||||
'en_BZ' => 'English',
|
||||
'en_CA' => 'English',
|
||||
'en_GB' => 'English',
|
||||
'en_IE' => 'English',
|
||||
'en_IN' => 'English',
|
||||
'en_JM' => 'English',
|
||||
'en_MY' => 'English',
|
||||
'en_NZ' => 'English',
|
||||
'en_PH' => 'English',
|
||||
'en_SG' => 'English',
|
||||
'en_TT' => 'English',
|
||||
'en_US' => 'English',
|
||||
'en_ZA' => 'English',
|
||||
'en_ZW' => 'English',
|
||||
'es_AR' => 'Español',
|
||||
'es_BO' => 'Español',
|
||||
'es_CL' => 'Español',
|
||||
'es_CO' => 'Español',
|
||||
'es_CR' => 'Español',
|
||||
'es_DO' => 'Español',
|
||||
'es_EC' => 'Español',
|
||||
'es_ES' => 'Español',
|
||||
'es_GT' => 'Español',
|
||||
'es_HN' => 'Español',
|
||||
'es_MX' => 'Español',
|
||||
'es_NI' => 'Español',
|
||||
'es_PA' => 'Español',
|
||||
'es_PE' => 'Español',
|
||||
'es_PR' => 'Español',
|
||||
'es_PY' => 'Español',
|
||||
'es_SV' => 'Español',
|
||||
'es_US' => 'Español',
|
||||
'es_UY' => 'Español',
|
||||
'es_VE' => 'Español',
|
||||
'et_EE' => 'Eesti',
|
||||
'eu_ES' => 'Euskara',
|
||||
'fa_IR' => 'فارسی',
|
||||
'fi_FI' => 'Suomi',
|
||||
'fil_PH' => 'Filipino',
|
||||
'fo_FO' => 'Føroyskt',
|
||||
'fr_BE' => 'Français',
|
||||
'fr_CA' => 'Français',
|
||||
'fr_CH' => 'Français',
|
||||
'fr_FR' => 'Français',
|
||||
'fr_LU' => 'Français',
|
||||
'fr_MC' => 'Français',
|
||||
'fy_NL' => 'West_frysk',
|
||||
'ga_IE' => 'Gaeilge',
|
||||
'gd_GB' => 'Gàidhlig',
|
||||
'gl_ES' => 'Galego',
|
||||
'gsw_FR' => 'Schwiizertüütsch',
|
||||
'gu_IN' => 'ગુજરાતી',
|
||||
'ha_Latn_NG' => 'Hausa',
|
||||
'he_IL' => 'עברית',
|
||||
'hi_IN' => 'हिन्दी',
|
||||
'hr_BA' => 'Hrvatski',
|
||||
'hr_HR' => 'Hrvatski',
|
||||
'hsb_DE' => 'Hornjoserbšćina',
|
||||
'hu_HU' => 'Magyar',
|
||||
'hy_AM' => 'Հայերեն',
|
||||
'id_ID' => 'Bahasa indonesia',
|
||||
'ig_NG' => 'Igbo',
|
||||
'ii_CN' => 'ꆈꌠꉙ',
|
||||
'is_IS' => 'Íslenska',
|
||||
'it_CH' => 'Italiano',
|
||||
'it_IT' => 'Italiano',
|
||||
'iu_Cans_CA' => 'Inuktitut',
|
||||
'iu_Latn_CA' => 'Inuktitut',
|
||||
'ja_JP' => '日本語',
|
||||
'ka_GE' => 'ქართული',
|
||||
'kk_KZ' => 'Қазақ тілі',
|
||||
'kl_GL' => 'Kalaallisut',
|
||||
'km_KH' => 'ខ្មែរ',
|
||||
'kn_IN' => 'ಕನ್ನಡ',
|
||||
'kok_IN' => 'कोंकणी',
|
||||
'ko_KR' => '한국어',
|
||||
'ky_KG' => 'Кыргызча',
|
||||
'lb_LU' => 'Lëtzebuergesch',
|
||||
'lo_LA' => 'ລາວ',
|
||||
'lt_LT' => 'Lietuvių',
|
||||
'lv_LV' => 'Latviešu',
|
||||
'mi_NZ' => 'Maori',
|
||||
'mk_MK' => 'Македонски',
|
||||
'ml_IN' => 'മലയാളം',
|
||||
'mn_MN' => 'Монгол',
|
||||
'mn_Mong_CN' => 'Монгол',
|
||||
'moh_CA' => 'Mohawk',
|
||||
'mr_IN' => 'मराठी',
|
||||
'ms_BN' => 'Bahasa melayu',
|
||||
'ms_MY' => 'Bahasa melayu',
|
||||
'mt_MT' => 'Malti',
|
||||
'nb_NO' => 'Norsk bokmål',
|
||||
'ne_NP' => 'नेपाली',
|
||||
'nl_BE' => 'Nederlands',
|
||||
'nl_NL' => 'Nederlands',
|
||||
'nn_NO' => 'Nynorsk',
|
||||
'nso_ZA' => 'Northern sotho',
|
||||
'oc_FR' => 'Occitan',
|
||||
'or_IN' => 'ଓଡ଼ିଆ',
|
||||
'pa_IN' => 'ਪੰਜਾਬੀ',
|
||||
'pl_PL' => 'Polski',
|
||||
'prs_AF' => 'Prs',
|
||||
'ps_AF' => 'پښتو',
|
||||
'pt_BR' => 'Português',
|
||||
'pt_PT' => 'Português',
|
||||
'qut_GT' => 'Qut',
|
||||
'quz_BO' => 'Quz',
|
||||
'quz_EC' => 'Quz',
|
||||
'quz_PE' => 'Quz',
|
||||
'rm_CH' => 'Rumantsch',
|
||||
'ro_RO' => 'Română',
|
||||
'ru_RU' => 'Русский',
|
||||
'rw_RW' => 'Kinyarwanda',
|
||||
'sah_RU' => 'Саха тыла',
|
||||
'sa_IN' => 'Sanskrit',
|
||||
'se_FI' => 'Davvisámegiella',
|
||||
'se_NO' => 'Davvisámegiella',
|
||||
'se_SE' => 'Davvisámegiella',
|
||||
'si_LK' => 'සිංහල',
|
||||
'sk_SK' => 'Slovenčina',
|
||||
'sl_SI' => 'Slovenščina',
|
||||
'sma_NO' => 'Southern sami',
|
||||
'sma_SE' => 'Southern sami',
|
||||
'smj_NO' => 'Lule sami',
|
||||
'smj_SE' => 'Lule sami',
|
||||
'smn_FI' => 'Anarâškielâ',
|
||||
'sms_FI' => 'Skolt sami',
|
||||
'sq_AL' => 'Shqip',
|
||||
'sr_Cyrl_BA' => 'Српски',
|
||||
'sr_Cyrl_CS' => 'Српски',
|
||||
'sr_Cyrl_ME' => 'Српски',
|
||||
'sr_Cyrl_RS' => 'Српски',
|
||||
'sr_Latn_BA' => 'Srpski',
|
||||
'sr_Latn_CS' => 'Srpski',
|
||||
'sr_Latn_ME' => 'Srpski',
|
||||
'sr_Latn_RS' => 'Srpski',
|
||||
'sv_FI' => 'Svenska',
|
||||
'sv_SE' => 'Svenska',
|
||||
'sw_KE' => 'Kiswahili',
|
||||
'syr_SY' => 'Syriac',
|
||||
'ta_IN' => 'தமிழ்',
|
||||
'te_IN' => 'తెలుగు',
|
||||
'tg_Cyrl_TJ' => 'Tajik',
|
||||
'th_TH' => 'ไทย',
|
||||
'tk_TM' => 'Turkmen',
|
||||
'tn_ZA' => 'Tswana',
|
||||
'tr_TR' => 'Türkçe',
|
||||
'tt_RU' => 'Tatar',
|
||||
'tzm_Latn_DZ' => 'Tamaziɣt',
|
||||
'ug_CN' => 'ئۇيغۇرچە',
|
||||
'uk_UA' => 'Українська',
|
||||
'ur_PK' => 'اردو',
|
||||
'uz_Cyrl_UZ' => 'Ўзбек',
|
||||
'uz_Latn_UZ' => 'Oʻzbekcha',
|
||||
'vi_VN' => 'Tiếng việt',
|
||||
'wo_SN' => 'Wolof',
|
||||
'xh_ZA' => 'Xhosa',
|
||||
'yo_NG' => 'Èdè yorùbá',
|
||||
'zh_CN' => '中文',
|
||||
'zh_HK' => '中文',
|
||||
'zh_MO' => '中文',
|
||||
'zh_SG' => '中文',
|
||||
'zh_TW' => '中文',
|
||||
'zu_ZA' => 'Isizulu',
|
||||
);
|
||||
|
||||
/**
|
||||
* This method scans for languages and creates a list of language and its name (localized ofc.)
|
||||
@ -20,7 +232,7 @@ class LocaleNegotiator
|
||||
//This basically means $accepted_langs[<lang_code>] = "<lang name>";
|
||||
foreach ($tmp as $key => $value) {
|
||||
$lang = basename($value);
|
||||
$this->accepted_langs[$lang] = self::mb_ucfirst(locale_get_display_language($lang, $lang));
|
||||
$this->accepted_langs[$lang] = $this->all_locales[$lang];
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,16 +243,6 @@ class LocaleNegotiator
|
||||
return $this->accepted_langs;
|
||||
}
|
||||
|
||||
/**
|
||||
* This methid does ucfirst() on multibyte encodings like UTF-8 - good for edge cases when locale starts with Č or similar.
|
||||
* @param String $string string
|
||||
* @return String string with first char uppercase
|
||||
*/
|
||||
private static function mb_ucfirst($string)
|
||||
{
|
||||
return mb_strtoupper(mb_substr($string, 0, 1)).mb_strtolower(mb_substr($string, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does the actual negotiation. It has override parameter in case user wants to switch
|
||||
* languages.
|
||||
|
@ -75,7 +75,7 @@ class Service
|
||||
$stmt->bind_param("s", $name);
|
||||
$stmt->execute();
|
||||
$query = $stmt->get_result();
|
||||
header("Location: /admin/?do=settings");
|
||||
header("Location: ".WEB_URL."/admin/?do=settings");
|
||||
}else
|
||||
{
|
||||
$message = _("You don't have the permission to do that!");
|
||||
@ -116,7 +116,7 @@ class Service
|
||||
$stmt->execute();
|
||||
$query = $stmt->get_result();
|
||||
|
||||
header("Location: /admin/?do=settings");
|
||||
header("Location: ".WEB_URL."/admin/?do=settings");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -133,6 +133,7 @@ class Service
|
||||
global $all, $some, $classes;
|
||||
$statuses = array(0,0,0,0);
|
||||
$worst = 5;
|
||||
|
||||
foreach ($array as $service) {
|
||||
if ($service->status<$worst)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ class Token
|
||||
{
|
||||
/**
|
||||
* Generates a new token from user id and randomly generated salt.
|
||||
* @param int $user ID
|
||||
* @param int $id user ID
|
||||
* @param String $data associated with token that are important
|
||||
* @param timestamp $expire expiration time
|
||||
* @return String token
|
||||
|
@ -97,7 +97,7 @@ class User
|
||||
$stmt->bind_param("i", $this->id);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
header("Location: /admin/?do=user&id=".$id);
|
||||
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
|
||||
}else{
|
||||
$message = _("You don't have the permission to do that!");
|
||||
}
|
||||
@ -115,10 +115,24 @@ class User
|
||||
global $user, $message, $mysqli;
|
||||
if (INSTALL_OVERRIDE || $user->get_rank()==0)
|
||||
{
|
||||
if (strlen(trim($_POST['name']))==0 || strlen(trim($_POST['surname']))==0 || strlen(trim($_POST['email']))==0 || strlen(trim($_POST['password']))==0 || !isset($_POST['permission']))
|
||||
if (strlen(trim($_POST['name']))==0) {
|
||||
$messages[] = _("name");
|
||||
}
|
||||
if(strlen(trim($_POST['surname']))==0) {
|
||||
$messages[] = _("surname");
|
||||
}
|
||||
if(strlen(trim($_POST['email']))==0) {
|
||||
$messages[] = _("email");
|
||||
}
|
||||
if(strlen(trim($_POST['password']))==0) {
|
||||
$messages[] = _("password");
|
||||
}
|
||||
if(!isset($_POST['permission']))
|
||||
{
|
||||
$message = _("Please enter all data!");
|
||||
}else{
|
||||
$messages[] = _("rank");
|
||||
}
|
||||
|
||||
if (!isset($messages)){
|
||||
$name = $_POST['name'];
|
||||
$surname = $_POST['surname'];
|
||||
$username = $_POST['username'];
|
||||
@ -159,19 +173,25 @@ class User
|
||||
{
|
||||
$to = $email;
|
||||
$subject = _('User account created').' - '.NAME;
|
||||
$message = sprintf(_("Hi %s!<br>"."Your account has been created. You can login with your email address at <a href=\"%s\">%s</a> with password %s - please change it as soon as possible."), $name." ".$surname,WEB_URL."/admin", WEB_URL."/admin", $pass);
|
||||
$msg = sprintf(_("Hi %s!<br>"."Your account has been created. You can login with your email address at <a href=\"%s\">%s</a> with password %s - please change it as soon as possible."), $name." ".$surname,WEB_URL."/admin", WEB_URL."/admin", $pass);
|
||||
$headers = "Content-Type: text/html; charset=utf-8 ".PHP_EOL;
|
||||
$headers .= "MIME-Version: 1.0 ".PHP_EOL;
|
||||
$headers .= "From: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
|
||||
$headers .= "Reply-To: ".MAILER_NAME.' <'.MAILER_ADDRESS.'>'.PHP_EOL;
|
||||
|
||||
mail($to, $subject, $message, $headers);
|
||||
header("Location: /admin/?do=settings");
|
||||
mail($to, $subject, $msg, $headers);
|
||||
if (!INSTALL_OVERRIDE)
|
||||
{
|
||||
header("Location: ".WEB_URL."/admin/?do=settings");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$message = _("Username or email already used");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$message = "Please enter ".implode(", ", $messages);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$message = _("You don't have the permission to do that!");
|
||||
@ -229,7 +249,7 @@ class User
|
||||
setcookie('user', $id, $year, "/");
|
||||
}
|
||||
$_SESSION['user'] = $id;
|
||||
header("Location: /admin");
|
||||
header("Location: ".WEB_URL."/admin");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -290,14 +310,14 @@ class User
|
||||
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Username");?></strong></div>
|
||||
<div class="col-md-6"><?php echo $this->username." "; if ($this->id!=$_SESSION['user'] && $user->get_rank()<=1 && ($user->get_rank()<$this->rank))
|
||||
{
|
||||
echo "<a href='/admin/?do=user&id=".$this->id."&what=toggle'>";
|
||||
echo "<a href='".WEB_URL."/admin/?do=user&id=".$this->id."&what=toggle'>";
|
||||
echo "<i class='fa fa-".($this->active?"check success":"times danger")."'></i></a>";
|
||||
}else{
|
||||
echo "<i class='fa fa-".($this->active?"check success":"times danger")."'></i>";
|
||||
}?></div>
|
||||
</div>
|
||||
|
||||
<form action="/admin/?do=user&id=<?php echo $this->id; ?>" method="POST">
|
||||
<form action="<?php echo WEB_URL;?>/admin/?do=user&id=<?php echo $this->id; ?>" method="POST">
|
||||
<div class="row">
|
||||
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Role");?></strong></div>
|
||||
<div class="col-md-6"><?php if ($user->get_rank() == 0 && $this->id != $_SESSION['user']){?> <div class="input-group"><select class="form-control" name="permission"><?php foreach ($permissions as $key => $value) {
|
||||
@ -306,13 +326,13 @@ class User
|
||||
</select><span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change role");?></button>
|
||||
</span>
|
||||
</div><?}else{ echo $permissions[$this->rank];}?></div>
|
||||
</div><?php }else{ echo $permissions[$this->rank];}?></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if($this->id==$_SESSION['user'])
|
||||
{?>
|
||||
<form action="/admin/?do=user" method="POST">
|
||||
<form action="<?php echo WEB_URL;?>/admin/?do=user" method="POST">
|
||||
<div class="row">
|
||||
<div class="col-md-2 col-md-offset-2"><strong>Email</strong></div>
|
||||
<div class="col-md-6">
|
||||
@ -325,7 +345,7 @@ class User
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form action="/admin/?do=user" method="POST">
|
||||
<form action="<?php echo WEB_URL;?>/admin/?do=user" method="POST">
|
||||
<div class="row">
|
||||
<div class="col-md-2 col-md-offset-2"><strong><?php echo _("Password");?></strong></div>
|
||||
<div class="col-md-6">
|
||||
@ -517,7 +537,7 @@ class User
|
||||
$stmt->execute();
|
||||
$query = $stmt->get_result();
|
||||
Token::delete($token);
|
||||
header("Location: /admin/");
|
||||
header("Location: ".WEB_URL."/admin/");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -535,6 +555,8 @@ class User
|
||||
public static function logout(){
|
||||
global $mysqli;
|
||||
session_unset();
|
||||
if (isset($_COOKIE['token']))
|
||||
{
|
||||
$token = $_COOKIE['token'];
|
||||
$time = time();
|
||||
Token::delete($token);
|
||||
@ -542,7 +564,8 @@ class User
|
||||
unset($_COOKIE['token']);
|
||||
setcookie('user', null, -1, '/');
|
||||
setcookie('token', null, -1, '/');
|
||||
header("Location: /admin");
|
||||
}
|
||||
header("Location: ".WEB_URL."/admin");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -558,7 +581,7 @@ class User
|
||||
$stmt = $mysqli->prepare("UPDATE users SET permission=? WHERE id=?");
|
||||
$stmt->bind_param("si", $permission, $id);
|
||||
$stmt->execute();
|
||||
header("Location: /admin/?do=user&id=".$id);
|
||||
header("Location: ".WEB_URL."/admin/?do=user&id=".$id);
|
||||
}
|
||||
else{
|
||||
$message = _("You don't have permission to do that!");
|
||||
|
@ -18,13 +18,13 @@ if (!isset($_SESSION['locale'])||isset($_GET['lang']))
|
||||
$override = ((isset($_GET['lang']))?$_GET['lang']:null);
|
||||
$best_match = $negotiator->negotiate($override);
|
||||
$_SESSION['locale'] = $best_match;
|
||||
setlocale(LC_ALL, $_SESSION['locale'].".UTF-8");
|
||||
|
||||
bindtextdomain("server-status", __DIR__ . "/locale/");
|
||||
bind_textdomain_codeset($_SESSION['locale'], "utf-8");
|
||||
textdomain("server-status");
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, $_SESSION['locale'].".UTF-8");
|
||||
setlocale(LC_MESSAGES, $_SESSION['locale'].".UTF-8");
|
||||
bindtextdomain("server-status", __DIR__ . "/locale/");
|
||||
bind_textdomain_codeset("server-status", "utf-8");
|
||||
textdomain("server-status");
|
||||
|
||||
//Database connection
|
||||
$mysqli = new mysqli("##server##","##user##","##password##","##database##");
|
||||
|
128
install.php
128
install.php
@ -1,35 +1,80 @@
|
||||
<?php
|
||||
require_once("header.php");
|
||||
require_once("footer.php");
|
||||
require_once("template.php");
|
||||
define("WEB_URL", "."); //Website name
|
||||
define("NAME", _('Status page')); //Website name
|
||||
render_header(_("Install"));?>
|
||||
<h1 class="text-center"><?php echo _("Installation");?></h1>
|
||||
<?php
|
||||
require("classes/locale-negotiator.php");
|
||||
|
||||
$negotiator = new LocaleNegotiator("en_GB");
|
||||
$message = "";
|
||||
if (!isset($_SESSION['locale'])||isset($_GET['lang']))
|
||||
{
|
||||
$override = ((isset($_GET['lang']))?$_GET['lang']:null);
|
||||
$best_match = $negotiator->negotiate($override);
|
||||
$_SESSION['locale'] = $best_match;
|
||||
setlocale(LC_ALL, $_SESSION['locale'].".UTF-8");
|
||||
|
||||
bindtextdomain("server-status", __DIR__ . "/locale/");
|
||||
bind_textdomain_codeset($_SESSION['locale'], "utf-8");
|
||||
textdomain("server-status");
|
||||
}
|
||||
|
||||
if (isset($_POST['server']))
|
||||
{
|
||||
$mysqli = new mysqli($_POST['server'],$_POST['dbuser'],$_POST['dbpassword'],$_POST['database']);
|
||||
|
||||
if ($mysqli->connect_errno) {
|
||||
$message = printf(_("Connection failed: %s\n"), $mysqli->connect_error);
|
||||
}
|
||||
$message .= sprintf(_("Connection failed: %s\n"), $mysqli->connect_error);
|
||||
}
|
||||
|
||||
if (filter_var($_POST['url'], FILTER_VALIDATE_URL) === false)
|
||||
if (isset($_POST['url']) && filter_var($_POST['url'], FILTER_VALIDATE_URL) === false)
|
||||
{
|
||||
$message = _("Please set valid url!");
|
||||
$message .= _("Please set valid url!");
|
||||
}
|
||||
|
||||
//Ostatní má checky existence ve funkci pro pridani
|
||||
if (0 == strlen(trim($_POST['servername'])) || 0 == strlen(trim($_POST['url'])) || 0 == strlen(trim($_POST['mailer']))
|
||||
|| 0 == strlen(trim($_POST['mailer_email'])) || 0 == strlen(trim($_POST['server'])) || 0 == strlen(trim($_POST['database']))
|
||||
|| 0 == strlen(trim($_POST['dbuser'])) || 0 == strlen(trim($_POST['dbpassword'])))
|
||||
{
|
||||
$message = _("Please enter all data!");
|
||||
if (0 == strlen(trim($_POST['servername']))){
|
||||
$messages[] = _("server name");
|
||||
}
|
||||
|
||||
if(isset($_POST['server']) && !isset($message))
|
||||
if (0 == strlen(trim($_POST['url']))){
|
||||
$messages[] = _("url");
|
||||
}
|
||||
|
||||
if (0 == strlen(trim($_POST['mailer']))){
|
||||
$messages[] = _("mailer name");
|
||||
}
|
||||
|
||||
if (0 == strlen(trim($_POST['mailer_email']))){
|
||||
$messages[] = _("mailer email");
|
||||
}
|
||||
|
||||
if (0 == strlen(trim($_POST['server']))){
|
||||
$messages[] = _("DB server");
|
||||
}
|
||||
|
||||
if (0 == strlen(trim($_POST['database']))){
|
||||
$messages[] = _("DB name");
|
||||
}
|
||||
|
||||
if (0 == strlen(trim($_POST['dbuser']))){
|
||||
$messages[] = _("DB user");
|
||||
}
|
||||
|
||||
if (0 == strlen(trim($_POST['dbpassword'])))
|
||||
{
|
||||
$messages[] = _("DB password");
|
||||
}
|
||||
if (isset($messages))
|
||||
{
|
||||
$message .= _("Please set");
|
||||
$message .= implode(", ", $messages);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['server']) && empty($message))
|
||||
{
|
||||
define("MAILER_NAME", $_POST['mailer']);
|
||||
define("MAILER_ADDRESS", $_POST['mailer_email']);
|
||||
define("INSTALL_OVERRIDE", true);
|
||||
|
||||
//No need to include config, as we have connection from testing it... :)
|
||||
@ -38,22 +83,26 @@ if(isset($_POST['server']) && !isset($message))
|
||||
$array = explode(";", $sql);
|
||||
|
||||
foreach ($array as $value) {
|
||||
if (empty(trim($value)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$q_res = $mysqli->query($value);
|
||||
if ($q_res === false)
|
||||
{
|
||||
$message = printf(_("Error while creating database. Please check permission for your account or MYSQL version.<br>Error: %s"), $mysqli->error);
|
||||
$message = sprintf(_("Error while creating database. Please check permission for your account or MYSQL version.<br>Error: %s"), $mysqli->error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($message))
|
||||
if (empty($message))
|
||||
{
|
||||
require("classes/constellation.php");
|
||||
|
||||
User::add();
|
||||
}
|
||||
|
||||
if (!isset($message))
|
||||
if (empty($message))
|
||||
{
|
||||
//Create config
|
||||
$config = file_get_contents("config.php.template");
|
||||
@ -68,34 +117,37 @@ if(isset($_POST['server']) && !isset($message))
|
||||
$config = str_replace("##name##", $_POST['servername'], $config);
|
||||
file_put_contents("config.php", $config);
|
||||
|
||||
unlink("config.php.temlpate");
|
||||
unlink("config.php.template");
|
||||
unlink("install.sql");
|
||||
unlink(__FILE__);
|
||||
|
||||
header("Location: /");
|
||||
header("Location: ".WEB_URL);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($message))
|
||||
Template::render_header(_("Install"));
|
||||
?>
|
||||
<h1 class="text-center"><?php echo _("Installation");?></h1>
|
||||
<?php
|
||||
if (!empty($message))
|
||||
{
|
||||
?>
|
||||
<p class="alert alert-danger"><?php echo $message; ?></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<form method="post" action="install.php" class="clearfix install">
|
||||
<form method="post" action="." class="clearfix install">
|
||||
<section class="install-section clearfix">
|
||||
<h2><?php echo _("Website details");?></h2>
|
||||
<summary><?php echo _("We need a name for your status page and a url, so we can mail users link for forgotten password etc.");?></summary>
|
||||
|
||||
<div class="form-group clearfix">
|
||||
<div class="col-sm-6"><label for="servername"><?php echo _("Name");?>: </label><input type="text" name="servername" value="<?php echo htmlspecialchars($_POST['servername'], ENT_QUOTES);?>" id="servername" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="url"><?php echo _("Url");?>: </label><input type="url" name="url" value="<?php echo htmlspecialchars($_POST['url'], ENT_QUOTES);?>" id="url" placeholder="<?php echo _("Url");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="servername"><?php echo _("Name");?>: </label><input type="text" name="servername" value="<?php echo ((isset($_POST['servername']))?htmlspecialchars($_POST['servername'], ENT_QUOTES):'');?>" id="servername" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="url"><?php echo _("Url");?>: </label><input type="url" name="url" value="<?php echo ((isset($_POST['url']))?htmlspecialchars($_POST['url'], ENT_QUOTES):'');?>" id="url" placeholder="<?php echo _("Url");?>" class="form-control" required></div>
|
||||
</div>
|
||||
<summary><?php echo _("Also an email address for mailer would be nice :)");?></summary>
|
||||
<div class="form-group clearfix">
|
||||
<div class="col-sm-6"><label for="mailer"><?php echo _("Name");?>: </label><input type="text" name="mailer" value="<?php echo htmlspecialchars($_POST['mailer'], ENT_QUOTES);?>" id="mailer" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="mailer_email"><?php echo _("Email");?>: </label><input type="email" name="mailer_email" value="<?php echo htmlspecialchars($_POST['mailer_email'], ENT_QUOTES);?>" id="mailer_email" placeholder="<?php echo _("Email");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="mailer"><?php echo _("Name");?>: </label><input type="text" name="mailer" value="<?php echo ((isset($_POST['mailer']))?htmlspecialchars($_POST['mailer'], ENT_QUOTES):'');?>" id="mailer" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="mailer_email"><?php echo _("Email");?>: </label><input type="email" name="mailer_email" value="<?php echo ((isset($_POST['mailer_email']))?htmlspecialchars($_POST['mailer_email'], ENT_QUOTES):'');?>" id="mailer_email" placeholder="<?php echo _("Email");?>" class="form-control" required></div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="install-section clearfix">
|
||||
@ -103,33 +155,33 @@ if (isset($message))
|
||||
<summary><?php echo _("We need database connection to be able to create tables. Please check that your account has the permission needed to do that.");?></summary>
|
||||
|
||||
<div class="form-group clearfix">
|
||||
<div class="col-sm-6"><label for="server"><?php echo _("Server");?>: </label><input type="text" name="server" value="<?php echo htmlspecialchars($_POST['server'], ENT_QUOTES);?>" id="server" placeholder="<?php echo _("Server");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="database"><?php echo _("Database");?>: </label><input type="text" name="database" value="<?php echo htmlspecialchars($_POST['database'], ENT_QUOTES);?>" id="database" placeholder="<?php echo _("Database");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="server"><?php echo _("Server");?>: </label><input type="text" name="server" value="<?php echo ((isset($_POST['server']))?htmlspecialchars($_POST['server'], ENT_QUOTES):'');?>" id="server" placeholder="<?php echo _("Server");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="database"><?php echo _("Database");?>: </label><input type="text" name="database" value="<?php echo ((isset($_POST['database']))?htmlspecialchars($_POST['database'], ENT_QUOTES):'');?>" id="database" placeholder="<?php echo _("Database");?>" class="form-control" required></div>
|
||||
</div>
|
||||
<div class="form-group clearfix">
|
||||
<div class="col-sm-6"><label for="dbuser"><?php echo _("User");?>: </label><input type="text" name="dbuser" value="<?php echo htmlspecialchars($_POST['dbuser'], ENT_QUOTES);?>" id="dbuser" placeholder="<?php echo _("User");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="dbpassword"><?php echo _("Password");?>: </label><input type="password" name="dbpassword" value="<?php echo htmlspecialchars($_POST['dbpassword'], ENT_QUOTES);?>" id="dbpassword" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="dbuser"><?php echo _("User");?>: </label><input type="text" name="dbuser" value="<?php echo ((isset($_POST['dbuser']))?htmlspecialchars($_POST['dbuser'], ENT_QUOTES):'');?>" id="dbuser" placeholder="<?php echo _("User");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="dbpassword"><?php echo _("Password");?>: </label><input type="password" name="dbpassword" value="<?php echo ((isset($_POST['dbpassword']))?htmlspecialchars($_POST['dbpassword'], ENT_QUOTES):'');?>" id="dbpassword" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="install-section clearfix">
|
||||
<h2><?php echo _("User");?></h2>
|
||||
<summary><?php echo _("And finally, we need info to create a new user. You don't have to provide it, but then... No status page admin...");?></summary>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-6"><label for="name"><?php echo _("Name");?>: </label><input type="text" maxlength="50" name="name" value="<?php echo htmlspecialchars($_POST['name'],ENT_QUOTES);?>" id="name" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="surname"><?php echo _("Surname");?>: </label><input type="text" maxlength="50" name="surname" value="<?php echo htmlspecialchars($_POST['surname'],ENT_QUOTES);?>" id="surname" placeholder="<?php echo _("Surname");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="name"><?php echo _("Name");?>: </label><input type="text" maxlength="50" name="name" value="<?php echo ((isset($_POST['name']))?htmlspecialchars($_POST['name'], ENT_QUOTES):'');?>" id="name" placeholder="<?php echo _("Name");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="surname"><?php echo _("Surname");?>: </label><input type="text" maxlength="50" name="surname" value="<?php echo ((isset($_POST['surname']))?htmlspecialchars($_POST['surname'], ENT_QUOTES):'');?>" id="surname" placeholder="<?php echo _("Surname");?>" class="form-control" required></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-6"><label for="username"><?php echo _("Username");?>:</label><input type="text" maxlength="50" name="username" value="<?php echo htmlspecialchars($_POST['username'],ENT_QUOTES);?>" id="username" placeholder="<?php echo _("Username");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="email"><?php echo _("Email");?>:</label><input type="email" maxlength="60" name="email" value="<?php echo htmlspecialchars($_POST['email'],ENT_QUOTES);?>" id="email" placeholder="<?php echo _("Email");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="username"><?php echo _("Username");?>:</label><input type="text" maxlength="50" name="username" value="<?php echo ((isset($_POST['username']))?htmlspecialchars($_POST['username'], ENT_QUOTES):'');?>" id="username" placeholder="<?php echo _("Username");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="email"><?php echo _("Email");?>:</label><input type="email" maxlength="60" name="email" value="<?php echo ((isset($_POST['email']))?htmlspecialchars($_POST['email'], ENT_QUOTES):'');?>" id="email" placeholder="<?php echo _("Email");?>" class="form-control" required><input type="hidden" name="permission" value="0"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-6"><label for="password"><?php echo _("Password");?>:</label><input type="password" name="password" value="<?php echo htmlspecialchars($_POST['password'],ENT_QUOTES);?>" id="password" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="password"><?php echo _("Password");?>:</label><input type="password" name="password" value="<?php echo ((isset($_POST['password']))?htmlspecialchars($_POST['password'], ENT_QUOTES):'');?>" id="password" placeholder="<?php echo _("Password");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6">
|
||||
<input type="hidden" value="0" class="permission">
|
||||
<input type="hidden" value="0" name="permission">
|
||||
<button type="submit" class="btn btn-success pull-right"><?php echo _("Run install!");?></button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
<?php
|
||||
render_footer();
|
||||
Template::render_footer();
|
15
install.sql
15
install.sql
@ -2,13 +2,11 @@ CREATE TABLE `services` (
|
||||
`id` int(11) NOT NULL,
|
||||
`name` varchar(50) COLLATE utf8_czech_ci NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
|
||||
|
||||
CREATE TABLE `services_status` (
|
||||
`id` int(11) NOT NULL,
|
||||
`service_id` int(11) NOT NULL,
|
||||
`status_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
|
||||
|
||||
CREATE TABLE `status` (
|
||||
`id` int(11) NOT NULL,
|
||||
`type` int(11) NOT NULL,
|
||||
@ -18,14 +16,12 @@ CREATE TABLE `status` (
|
||||
`end_time` int(11) NOT NULL,
|
||||
`user_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
|
||||
|
||||
CREATE TABLE `tokens` (
|
||||
`token` varchar(64) COLLATE utf8_czech_ci NOT NULL,
|
||||
`user` int(11) NOT NULL,
|
||||
`expire` int(11) NOT NULL,
|
||||
`data` varchar(80) COLLATE utf8_czech_ci NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
|
||||
|
||||
CREATE TABLE `users` (
|
||||
`id` int(11) NOT NULL,
|
||||
`email` varchar(60) COLLATE utf8_czech_ci NOT NULL,
|
||||
@ -37,30 +33,22 @@ CREATE TABLE `users` (
|
||||
`permission` int(11) NOT NULL DEFAULT '0',
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
|
||||
|
||||
|
||||
ALTER TABLE `services`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
ALTER TABLE `services_status`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `service_id` (`service_id`),
|
||||
ADD KEY `status_id` (`status_id`);
|
||||
|
||||
ALTER TABLE `status`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `user_id` (`user_id`);
|
||||
|
||||
ALTER TABLE `tokens`
|
||||
ADD PRIMARY KEY (`token`),
|
||||
ADD KEY `user` (`user`);
|
||||
|
||||
ALTER TABLE `users`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `email` (`email`),
|
||||
ADD UNIQUE KEY `username` (`username`);
|
||||
|
||||
|
||||
ALTER TABLE `services`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `services_status`
|
||||
@ -69,13 +57,10 @@ ALTER TABLE `status`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `users`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE `services_status`
|
||||
ADD CONSTRAINT `service_id` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`),
|
||||
ADD CONSTRAINT `status_id` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`);
|
||||
|
||||
ALTER TABLE `status`
|
||||
ADD CONSTRAINT `user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
|
||||
|
||||
ALTER TABLE `tokens`
|
||||
ADD CONSTRAINT `user` FOREIGN KEY (`user`) REFERENCES `users` (`id`);
|
98
template.php
98
template.php
@ -19,34 +19,34 @@ class Template{
|
||||
<title><?php echo $page_name." - ".NAME ?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Current service status for <?php echo NAME;?> can be found here as well as incident history.">
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/png">
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/main.css" media="screen">
|
||||
<link rel="stylesheet" href="/css/print.css" media="print">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/favicon/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/favicon/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="/favicon/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="/favicon/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/favicon/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/favicon/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/favicon/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="/favicon/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/favicon/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/favicon/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="/favicon/manifest.json">
|
||||
<link rel="shortcut icon" href="<?php echo WEB_URL;?>/favicon.ico" type="image/png">
|
||||
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/main.css" media="screen">
|
||||
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/print.css" media="print">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_URL;?>/favicon/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_URL;?>/favicon/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_URL;?>/favicon/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="<?php echo WEB_URL;?>/favicon/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo WEB_URL;?>/favicon/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="<?php echo WEB_URL;?>/favicon/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="<?php echo WEB_URL;?>/favicon/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="<?php echo WEB_URL;?>/favicon/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo WEB_URL;?>/favicon/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="<?php echo WEB_URL;?>/favicon/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo WEB_URL;?>/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="<?php echo WEB_URL;?>/favicon/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo WEB_URL;?>/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="<?php echo WEB_URL;?>/favicon/manifest.json">
|
||||
<meta name="msapplication-TileColor" content="#ffffff">
|
||||
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<link href="/css/font-awesome.min.css" rel="stylesheet">
|
||||
<link href="<?php echo WEB_URL;?>/css/font-awesome.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-default" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="<?php echo WEB_URL;?>"><img src="/img/logo_white.png" alt="logo" class="menu-logo" width="50" height="50"></a>
|
||||
<a class="navbar-brand" href="<?php echo WEB_URL;?>"><img src="<?php echo WEB_URL;?>/img/logo_white.png" alt="logo" class="menu-logo" width="50" height="50"></a>
|
||||
</div>
|
||||
<div class="navbar-left hidden-xs">
|
||||
<ul class="nav navbar-nav">
|
||||
@ -67,25 +67,25 @@ class Template{
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo $page_name." - ".NAME ?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/png">
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/main.css">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/favicon/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/favicon/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="/favicon/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="/favicon/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/favicon/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/favicon/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/favicon/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="/favicon/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/favicon/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/favicon/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="/favicon/manifest.json">
|
||||
<link href="/css/font-awesome.min.css" rel="stylesheet">
|
||||
<link href="/css/jquery.growl.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="<?php echo WEB_URL;?>/favicon.ico" type="image/png">
|
||||
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="<?php echo WEB_URL;?>/css/main.css">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_URL;?>/favicon/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_URL;?>/favicon/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_URL;?>/favicon/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="<?php echo WEB_URL;?>/favicon/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo WEB_URL;?>/favicon/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="<?php echo WEB_URL;?>/favicon/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="<?php echo WEB_URL;?>/favicon/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="<?php echo WEB_URL;?>/favicon/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo WEB_URL;?>/favicon/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="<?php echo WEB_URL;?>/favicon/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo WEB_URL;?>/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="<?php echo WEB_URL;?>/favicon/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo WEB_URL;?>/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="<?php echo WEB_URL;?>/favicon/manifest.json">
|
||||
<link href="<?php echo WEB_URL;?>/css/font-awesome.min.css" rel="stylesheet">
|
||||
<link href="<?php echo WEB_URL;?>/css/jquery.growl.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
|
||||
</head>
|
||||
<body class="admin">
|
||||
@ -99,7 +99,7 @@ class Template{
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="<?php echo WEB_URL;?>/admin"><img src="/img/logo_white.png" alt="logo" class="menu-logo" width="50" height="50"></a>
|
||||
<a class="navbar-brand" href="<?php echo WEB_URL;?>/admin"><img src="<?php echo WEB_URL;?>/img/logo_white.png" alt="logo" class="menu-logo" width="50" height="50"></a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse navbar-right navbar-admin">
|
||||
<ul class="nav navbar-nav">
|
||||
@ -152,18 +152,18 @@ class Template{
|
||||
</div><!--/row -->
|
||||
</div><!--/container -->
|
||||
</div>
|
||||
<script src="/js/vendor/jquery-1.11.2.min.js"></script>
|
||||
<script src="/js/vendor/jquery.timeago.js"></script>
|
||||
<script src="/locale/<?php echo $_SESSION['locale'];?>/jquery.timeago.js"></script>
|
||||
<script src="<?php echo WEB_URL;?>/js/vendor/jquery-1.11.2.min.js"></script>
|
||||
<script src="<?php echo WEB_URL;?>/js/vendor/jquery.timeago.js"></script>
|
||||
<script src="<?php echo WEB_URL;?>/locale/<?php echo $_SESSION['locale'];?>/jquery.timeago.js"></script>
|
||||
<?php if ($admin){?>
|
||||
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
|
||||
<script src="/js/admin.js"></script>
|
||||
<script src="/js/vendor/jquery.growl.js"></script>
|
||||
<? }?>
|
||||
<script src="/js/vendor/bootstrap.min.js"></script>
|
||||
<script src="/js/main.js"></script>
|
||||
<script src="<?php echo WEB_URL;?>/js/admin.js"></script>
|
||||
<script src="<?php echo WEB_URL;?>/js/vendor/jquery.growl.js"></script>
|
||||
<?php }?>
|
||||
<script src="<?php echo WEB_URL;?>/js/vendor/bootstrap.min.js"></script>
|
||||
<script src="<?php echo WEB_URL;?>/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<?
|
||||
<?php
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user