Page MenuHomeGitPull.it

No OneTemporary

Authored By
Unknown
Size
57 KB
Referenced Files
None
Subscribers
None
diff --git a/README.md b/README.md
index a24e4dd..e686d9a 100644
--- a/README.md
+++ b/README.md
@@ -1,54 +1,59 @@
# Boz's Libre Hosting Panel
This projects was started to create another _keep it simple and stupid_ libre web hosting control panel suitable for providers of everyday shared hosting services.
## Disclaimer
Do not try to become a system administrator if you do not like responsibilities, if you do not want to understand your infrastructure, if you do not want to have information security paranoia, etc.
## Preamble
An hosting panel is just the iceberg summit of a lot of technologies and protocols involved. Do not try to implement such project in production if you do not know what you are doing. You must gain confidence with the technologies involved.
Papers:
* RFC 5321 - Simple Mail Transfer Protocol
* RFC 7208 - Sender Policy Framework (SPF)
* RFC 6376 - DomainKeys Identified Mail (DKIM) Signatures
* RFC 7489 - Domain-based Message Authentication, Reporting, and Conformance (DMARC)
Software involved:
* Debian GNU/Linux stable
* MariaDB / MySQL
* Postfix
* Dovecot
* PureFTPd
* OpenDKIM
* Apache HTTP server / nginx
* PHP
## Features
Let me say that I love listening to the whishlist of my costumers. Here are the most important features/TODOs:
-- administration of own mailboxes
+- administration of own mailboxes (thanks to Postfix and Dovecot over MariaDB)
+ - [X] list
- [X] password reset
- - [ ] add
+ - [X] add
- [ ] remove
- [ ] view quota
- administration of own mail aliases (thanks to Postfix and Dovecot over MariaDB)
+ - [X] list
- [X] change forward destination(s)
- [X] add
- [X] remove
-- [ ] administration of own FTP accounts (thanks to Pure-FTPd over MariaDB)
+- administration of own FTP accounts (thanks to Pure-FTPd over MariaDB)
+ - [X] list
+ - [ ] add
+ - [ ] remove
- [ ] administration of own MariaDB databases
## License
Copyright (C) 2018 [Valerio Bozzolan](https://boz.reyboz.it/) - _Boz Libre Hosting Panel_
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/include/class-Breadcrumb.php b/include/class-Breadcrumb.php
index 80a326d..5105877 100644
--- a/include/class-Breadcrumb.php
+++ b/include/class-Breadcrumb.php
@@ -1,71 +1,79 @@
<?php
-# Copyright (C) 2018 Valerio Bozzolan
+# Copyright (C) 2018, 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Handle a breadcrumb with the related microdata
*
* @url https://schema.org/BreadcrumbList
* @url https://developers.google.com/search/docs/data-types/breadcrumb
*/
class Breadcrumb {
/**
* Spawn the breadcrumb
*
* @param $uid string|null Starting menu uid
* @param $title string|null Starting title
* @param $parent_uid string|null Parent menu uid
*/
public static function spawn( $breadcrumbs ) {
?>
<ol itemscope itemtype="http://schema.org/BreadcrumbList" id="breadcrumb">
<?php $i = 0 ?>
<?php foreach( $breadcrumbs as $crumb ): ?>
- <?php self::menuEntryLink( ++$i, $crumb ) ?>
+ <?= self::menuEntryLink( ++$i, $crumb ) ?>
<?php endforeach ?>
</ol>
<?php
}
/**
* Spawn a link from a menu entry
*
* @param $i int
* @param $entry MenuEntry
+ * @return string
*/
public static function menuEntryLink( $i, $entry ) {
$url = $entry->url ? $entry->getSitePage() : null;
return self::link( $i, $url, $entry->name );
}
/**
- * Spawn a link with microdata
+ * Get a link with microdata
+ *
+ * @param int $i
+ * @param string $url
+ * @param string $title
+ * @return string
*/
public static function link( $i, $url, $title ) {
- echo '<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">';
+ $s = '<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">';
if( $url ) {
- echo '<a itemprop="item" href="' . esc_attr( $url ) . '">';
- echo '<span itemprop="name">' . esc_html( $title ) . '</span>';
- echo '</a>';
+ $s .= '<a itemprop="item" href="' . esc_attr( $url ) . '">';
+ $s .= '<span itemprop="name">' . esc_html( $title ) . '</span>';
+ $s .= '</a>';
} else {
- echo '<span itemprop="name">' . _esc_html( $title ) . '</span>';
+ $s .= '<span itemprop="name">' . esc_html( $title ) . '</span>';
}
- echo '<meta itemprop="position" content="' . $i . '" />';
- echo "</li>\n";
+ $s .= '<meta itemprop="position" content="' . $i . '" />';
+ $s .= "</li>\n";
+
+ return $s;
}
}
diff --git a/include/class-Header.php b/include/class-Header.php
index e4e81aa..9f6bce7 100644
--- a/include/class-Header.php
+++ b/include/class-Header.php
@@ -1,91 +1,91 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* The header of the web page
*/
class Header {
/**
* Header arguments
*
* It's public because the Footer reads it.
*
* @var array
*/
public static $args;
/**
* Spawn the header to standard output
*
* @param $args mixed Can be the page UID, or arguments where:
* uid: menu UID like 'home'
* title: document title
*/
public static function spawn( $args = [] ) {
// store arguments for future reads
self::$args = & $args;
// shortcut
if( is_string( $args ) ) {
$args = [ 'uid' => $args ];
}
// eventually retrieve actual page UID
if( ! isset( $args[ 'uid' ] ) ) {
$args[ 'uid' ] = self::actualPageUID();
}
// retrieve page informations
$page = isset( $args[ 'uid' ] )
- ? get_menu_entry( $args[ 'uid' ] )
+ ? menu_entry( $args[ 'uid' ] )
: null;
// populate the page informations
if( $page ) {
$args = array_replace( [
'title' => $page->name,
], $args );
} else {
$args[ 'uid' ] = null;
}
// populate default arguments
$args = array_replace( [
'container' => true,
'sidebar' => true,
'breadcrumb' => [],
], $args );
// charset is usually UTF-8
header( 'Content-Type: text/html; charset=' . CHARSET );
// spawn header template
template( 'header', [ 'args' => $args ] );
}
/**
* Get the default page UID
*
* @return string
*/
public static function actualPageUID() {
$page = basename( $_SERVER[ 'SCRIPT_NAME' ] );
return str_replace( '.php', '', $page );
}
}
diff --git a/include/functions.php b/include/functions.php
index c7c81a0..ffb00a4 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1,205 +1,195 @@
<?php
# Copyright (C) 2018, 2019 Valerio Bozzolan
# Reyboz another self-hosting panel project
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Require a certain page from the template directory
*
* @param $name string page name (to be sanitized)
* @param $args mixed arguments to be passed to the page scope
*/
function template( $template_name, $template_args = [] ) {
extract( $template_args, EXTR_SKIP );
return require TEMPLATE_PATH . __ . "$template_name.php";
}
/**
* Get the returned text from a template
*
* @param $name string page name (to be sanitized)
* @param $args mixed arguments to be passed to the page scope
* @see template()
* @return string
*/
function template_content( $name, $args = [] ) {
ob_start();
template( $name, $args );
$text = ob_get_contents();
ob_end_clean();
return $text;
}
/**
* Print an e-mail (safe for bots)
*
* @param $email string
*/
function email_blur( $email ) {
$dot = strip_tags( __( " dot <!-- . -->" ) );
$at = strip_tags( __( " at <!-- @ -->" ) );
$email = esc_html( $email );
echo str_replace( [ '.', '@' ], [ $dot, $at ], $email );
}
/**
* Send an e-mail to someone
*
* @param $subject string E-mail subject
* @param $message string E-mail message
* @param $to string E-mail recipient (from current logged-in user as default)
*/
function send_email( $subject, $message, $to = false ) {
if( ! $to ) {
if( ! is_logged() ) {
die( "can't retrieve e-mail address from anon user" );
}
$to = get_user( 'user_email' );
}
return SMTPMail::instance()
->to( $to )
->message( $subject, $message )
->disconnect();
}
/**
* Require a certain permission
*
* @param $permission string An internal permission like 'edit-all-user'
* @param $redirect boolean Enable or disable the redirect
*/
function require_permission( $permission, $redirect = true ) {
if( ! has_permission( $permission ) ) {
if( is_logged() ) {
Header::spawn( [
'title' => __( "Permission denied" ),
] );
Footer::spawn();
exit;
} else {
- $login = get_menu_entry( 'login' );
+ $login = menu_entry( 'login' );
$url = $login->getSitePage( URL );
if( $redirect && isset( $_SERVER[ 'REQUEST_URI' ] ) ) {
$url = http_build_get_query( $url, [
'redirect' => $_SERVER[ 'REQUEST_URI' ],
] );
}
http_redirect( $url, 307 );
}
}
}
-/**
- * Check the POST action
- *
- * @param $action string e.g. 'save-domain'
- * @return bool
- */
-function is_action( $action ) {
- return isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === $action;
-}
-
/**
* Get URL parts from the PATH_INFO
*
* It spawn a "bad request" page if something goes wrong.
*
* @param $max int If $min is specified, this is the maximum number of parameters. When unspecified, this is the exact number of parameters.
* @param $min int Mininum number of parameters.
* @return array
* @see https://httpd.apache.org/docs/2.4/mod/core.html#acceptpathinfo
*/
function url_parts( $max, $min = false ) {
if( $min === false ) {
$min = $max;
}
// split the PATH_INFO parts
$parts = explode( _, $_SERVER[ 'PATH_INFO' ] );
array_shift( $parts );
// eventually spawn the "bad request"
$n = count( $parts );
if( $n > $max || $n < $min ) {
BadRequest::spawn( __( "unexpected URL" ) );
}
// eventually fill expected fields
for( $i = $n; $i < $max; $i++ ) {
$parts[] = null;
}
return $parts;
}
/**
* Link to an existing page from the menu
*
* @param $uid string E.g. 'index'
* @param $args mixed Arguments
*/
function the_menu_link( $uid, $args = [] ) {
- $page = get_menu_entry( $uid );
+ $page = menu_entry( $uid );
the_link( $page->getSitePage(), $page->name, $args );
}
/**
* Link to a whatever page
*
* P.S. link() is a reserved function
*
* @param $url string
* @param $title string
* @param $args mixed Arguments
*/
function the_link( $url, $title, $args = [] ) {
template( 'link', [
'title' => $title,
'url' => $url,
'args' => $args,
] );
}
/**
* Generate a password
*
* @param $bytes int
*/
function generate_password( $bytes = 8 ) {
return rtrim( base64_encode( bin2hex( openssl_random_pseudo_bytes( $bytes ) ) ), '=' );
}
/**
* Validate a mailbox username
*
* @param $mailbox string
* @return bool
*/
function validate_mailbox_username( $mailbox ) {
return 1 === preg_match( '/^[a-z][a-z0-9-_.]+$/', $mailbox );
}
/**
* A certain value must be an e-mail
*
* @param $email string
* @return string filtered e-mail
*/
function require_email( $email ) {
$email = luser_input( $email, 128 );
if( filter_var( $email, FILTER_VALIDATE_EMAIL ) === false ) {
BadRequest::spawn( __( "fail e-mail validation" ) );
}
return $email;
}
diff --git a/load-example.php b/load-example.php
index 4ca5128..c828a0d 100644
--- a/load-example.php
+++ b/load-example.php
@@ -1,52 +1,52 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is an example configuration file
*
* Please fill this file and save as 'load.php'!
*/
// database credentials
$username = 'insert here database username';
$password = 'insert here database password';
$database = 'insert here database name';
$location = 'localhost';
// database prefix (if any)
$prefix = '';
// your contact e-mail
define( 'CONTACT_EMAIL', 'services@example.org' );
// your SMTP credentials
define( 'MAIL_FROM', 'noreply@example.org' );
define( 'SMTP_USERNAME', 'noreply@example.org' );
define( 'SMTP_PASSWORD', 'insert here smtp password' );
define( 'SMTP_AUTH', 'PLAIN' );
define( 'SMTP_TLS', true );
define( 'SMTP_SERVER', 'mail.example.org' );
define( 'SMTP_PORT', 465 );
// absolute path to the project directory without trailing slash
define( 'ABSPATH', __DIR__ );
// absolute web directory without trailing slash
define( 'ROOT', '' );
// path to the boz-php framework
-require '/usr/share/php/boz-php/load.php';
+require '/usr/share/php/suckless-php/load.php';
diff --git a/template/404.php b/template/404.php
index abcba2a..4162bf3 100644
--- a/template/404.php
+++ b/template/404.php
@@ -1,30 +1,30 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a bad request
*
* Called from:
* include/class-PageNotFound.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
- <p class="alert alert-warning"><?php _e( "Oh no! A page not found error!" ) ?></p>
- <p><?php _e( "The page you was looking for is wrong or was deleted or you have not enough permissions to see it, etc. you know." ) ?></p>
+ <p class="alert alert-warning"><?= __( "Oh no! A page not found error!" ) ?></p>
+ <p><?= __( "The page you was looking for is wrong or was deleted or you have not enough permissions to see it, etc. you know." ) ?></p>
diff --git a/template/bad-request.php b/template/bad-request.php
index f96a376..2189716 100644
--- a/template/bad-request.php
+++ b/template/bad-request.php
@@ -1,39 +1,39 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a bad request
*
* Called from:
* include/class-BadRequest.php
*
* Available variables:
* $message string
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
<p class="alert alert-danger">
- <?php _e( "Your request cannot be processed." ) ?>
+ <?= __( "Your request cannot be processed." ) ?>
<?php if( $message ): ?>
<br />
<?php printf( __( "Error: %s. "), $message ) ?>
<?php endif ?>
</p>
- <p><?php _e( "If you think that it's not your fault, contact us. Thanks!" ) ?></p>
+ <p><?= __( "If you think that it's not your fault, contact us. Thanks!" ) ?></p>
diff --git a/template/breadcrumb.php b/template/breadcrumb.php
index 1213c18..177e79d 100644
--- a/template/breadcrumb.php
+++ b/template/breadcrumb.php
@@ -1,36 +1,36 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the website breadcrumb navigation menu
*
* Called from:
* template/header.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
// add home to the breadcrumb
-array_unshift( $args[ 'breadcrumb' ], get_menu_entry( 'index' ) );
+array_unshift( $args[ 'breadcrumb' ], menu_entry( 'index' ) );
// add "this page" to the breadcrumb
if( $args[ 'uid' ] !== 'index' ) {
$args[ 'breadcrumb' ][] = new MenuEntry( null, null, $args[ 'title' ] );
}
Breadcrumb::spawn( $args[ 'breadcrumb' ] );
diff --git a/template/domain-create.php b/template/domain-create.php
index 9d1a80f..2626d8a 100644
--- a/template/domain-create.php
+++ b/template/domain-create.php
@@ -1,33 +1,33 @@
<?php
# Copyright (C) 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the create domain form
*
* Called from:
* domain.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
<form method="post">
<input type="text" name="domain_name" />
- <button type="submit" class="btn" name="action" value="add-domain"><?php _e( "Add" ) ?></button>
+ <button type="submit" class="btn" name="action" value="add-domain"><?= __( "Add" ) ?></button>
</form>
diff --git a/template/footer.php b/template/footer.php
index d0a3fac..6e06c17 100644
--- a/template/footer.php
+++ b/template/footer.php
@@ -1,80 +1,80 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the website footer
*
* Called from:
* include/class-Footer.php
*
* Available variables:
* $args array
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
load_module( 'footer' );
?>
</div>
<!-- /sidebar content -->
<!-- sidebar -->
<?php if( $args[ 'sidebar' ] ): ?>
<div class="col-sm-4">
<?php template( 'sidebar' ) ?>
</div>
<?php endif ?>
<!-- /sidebar -->
<!-- page row -->
</div>
<?php if( $args[ 'container' ] ): ?>
</div>
<!-- /page container -->
<?php endif ?>
<hr />
<!-- footer -->
<div class="container">
<div class="row">
<!-- help -->
<?php if( CONTACT_EMAIL ): ?>
<div class="col-sm-2">
- <?php _e( "Help:" ) ?><br />
+ <?= __( "Help:" ) ?><br />
<?php email_blur( CONTACT_EMAIL ) ?>
</div>
<?php endif ?>
<!-- end help -->
<!-- fork -->
<?php if( REPO_URL ): ?>
<div class="col-sm-2">
- <?php _e( "Contribute:" ) ?><br />
- <a href="<?php echo REPO_URL ?>" target="_blank"><?php _e( "project repository" ) ?></a>
+ <?= __( "Contribute:" ) ?><br />
+ <a href="<?= REPO_URL ?>" target="_blank"><?php echo __( "project repository" ) ?></a>
</div>
<?php endif ?>
<!-- end for -->
</div>
</div>
<!-- /footer -->
</body>
</html>
diff --git a/template/ftp-access.php b/template/ftp-access.php
index 42af6fc..be16693 100644
--- a/template/ftp-access.php
+++ b/template/ftp-access.php
@@ -1,41 +1,41 @@
<?php
# Copyright (C) 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for FTP instructions
*
* Called from:
* ftp.php
*
* Available variables:
* $domain Domain object
* $ftp FTP object
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
- <p><?php _e( "To enter in your website with this FTP user you can copy this address into your file manager (then it should ask for the related password):" ) ?></p>
+ <p><?= __( "To enter in your website with this FTP user you can copy this address into your file manager (then it should ask for the related password):" ) ?></p>
<blockquote>
<code>ftp://<?php
_esc_html( $ftp->getFTPLogin() );
echo '@';
_esc_html( $domain->getDomainName() );
?></code>
</blockquote>
diff --git a/template/ftp-description.php b/template/ftp-description.php
index 82ce878..a65b7e6 100644
--- a/template/ftp-description.php
+++ b/template/ftp-description.php
@@ -1,29 +1,29 @@
<?php
# Copyright (C) 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the description of an FTP account
*
* Called from:
* template/ftp-list.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
- <p><?php _e( "With an FTP user you can read and write files of your website. You can create various users limited to specific directories of your website." ) ?></p>
+ <p><?= __( "With an FTP user you can read and write files of your website. You can create various users limited to specific directories of your website." ) ?></p>
diff --git a/template/ftp-users.php b/template/ftp-users.php
index d3d88be..c0fdf77 100644
--- a/template/ftp-users.php
+++ b/template/ftp-users.php
@@ -1,70 +1,70 @@
<?php
# Copyright (C) 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the FTP user list
*
* Called from:
* domain.php
*
* Available variables:
* $domain Domain object
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
// domain FTP users
$ftps = $domain->factoryFTP()
->select( [
'ftp_login',
] )
->queryGenerator();
?>
<!-- FTP users -->
<h3><?php printf(
__( "Your %s" ),
__( "FTP users" )
) ?></h3>
<?php template( 'ftp-description' ) ?>
<?php if( $ftps->valid() ): ?>
<ul>
<?php foreach( $ftps as $ftp ): ?>
<li>
- <code><?php echo HTML::a(
+ <code><?= HTML::a(
FTP::permalink(
$domain->getDomainName(),
$ftp->getFTPLogin()
),
$ftp->getFTPLogin()
) ?></code>
</li>
<?php endforeach ?>
</ul>
<?php else: ?>
- <p><?php _e( "None yet.") ?></p>
+ <p><?= __( "None yet.") ?></p>
<?php endif ?>
<?php if( has_permission( 'edit-ftp-all' ) ): ?>
<p><?php the_link(
FTP::permalink( $domain->getDomainName() ),
__( "Create" )
) ?></p>
<?php endif ?>
<!-- end FTP users -->
diff --git a/template/ftp.php b/template/ftp.php
index 0f4feed..242e258 100644
--- a/template/ftp.php
+++ b/template/ftp.php
@@ -1,57 +1,63 @@
<?php
# Copyright (C) 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a single FTP account
*
* Called from:
* ftp.php
*
* Available variables:
* $domain Domain object
* $ftp FTP object
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
<?php template( 'ftp-description' ) ?>
- <?php if( $ftp ) {
- template( 'ftp-access', [
+ <?php if( $ftp ): ?>
+
+ <?php template( 'ftp-access', [
'domain' => $domain,
'ftp' => $ftp,
- ] );
- } ?>
-
- <form method="post">
- <p>
- <?php if( $ftp ): ?>
- <input type="hidden" readonly<?php _value( $ftp->getFTPLogin() ) ?> />
- <?php else: ?>
- <label for="ftp-login"><?php _e( "FTP login:") ?></label><br />
+ ] ) ?>
+
+ <!-- delete form -->
+ <form method="post">
+ <?php form_action( 'ftp-delete' ) ?>
+ <?= HTML::input( 'hidden', 'ftp_login', $ftp->getFTPLogin() ) ?>
+ <button type="submit" class="btn btn-danger"><?= __( "Delete" ) ?></button>
+ </form>
+ <!-- /delete form -->
+
+ <?php else: ?>
+
+ <!-- create form -->
+ <form method="post">
+ <?php form_action( 'ftp-save' ) ?>
+ <p>
+ <label for="ftp-login"><?= __( "FTP login:") ?></label><br />
<input type="text" id="ftp-login" name="ftp_login" />
- <?php endif ?>
-
- <?php if( $ftp ): ?>
- <button type="submit" class="btn btn-danger" name="action" value="ftp-delete"><?php _e( "Delete" ) ?></button>
- <?php else: ?>
- <button type="submit" class="btn btn-default" name="action" value="ftp-save"><?php _e( "Create" ) ?></button>
- <?php endif ?>
- </p>
- </form>
+ <button type="submit" class="btn btn-default"><?= __( "Create" ) ?></button>
+ </p>
+ </form>
+ <!-- /create form -->
+
+ <?php endif ?>
diff --git a/template/header.php b/template/header.php
index c219769..28b88a8 100644
--- a/template/header.php
+++ b/template/header.php
@@ -1,73 +1,73 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the website header
*
* Called from:
* include/class-Header.php
*
* Available variables:
* $args array
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
// load Bootstrap stuff
enqueue_js( 'jquery' );
enqueue_js( 'bootstrap' );
enqueue_css( 'bootstrap' );
enqueue_css( 'custom-css' );
?>
<!DOCTYPE html>
<html>
<head>
- <title><?php echo strip_tags( $args[ 'title' ] ) ?> - <?php echo strip_tags( SITE_NAME ) ?></title>
+ <title><?= strip_tags( $args[ 'title' ] ) ?> - <?php echo strip_tags( SITE_NAME ) ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
- <link rel="icon" href="<?php echo ROOT ?>/content/logo/logo-64.png" type="image/png" /><?php load_module( 'header' ) ?>
+ <link rel="icon" href="<?= ROOT ?>/content/logo/logo-64.png" type="image/png" /><?php load_module( 'header' ) ?>
</head>
<body>
<div class="container">
- <h1><?php echo SITE_NAME ?></h1>
+ <h1><?= SITE_NAME ?></h1>
<?php if( isset( $args[ 'title-prefix' ] ) ): ?>
- <h2><?php _esc_html( $args[ 'title-prefix' ] ) ?>: <em><?php _esc_html( $args[ 'title' ] ) ?></em></h2>
+ <h2><?= esc_html( $args[ 'title-prefix' ] ) ?>: <em><?php _esc_html( $args[ 'title' ] ) ?></em></h2>
<?php else: ?>
- <h2><?php _esc_html( $args[ 'title' ] ) ?></h2>
+ <h2><?= esc_html( $args[ 'title' ] ) ?></h2>
<?php endif ?>
<?php if( isset( $args[ 'breadcrumb' ] ) && $args[ 'breadcrumb' ] !== false ): ?>
<?php template( 'breadcrumb', [ 'args' => $args ] ) ?>
<?php endif ?>
</div>
<?php if( $args[ 'container' ] ): ?>
<!-- page container -->
<div class="container">
<?php endif ?>
<!-- page row -->
<div class="row">
<!-- sidebar content -->
<?php if( $args[ 'sidebar' ] ): ?>
<div class="col-sm-8">
<?php else: ?>
<div class="col-sm-12">
<?php endif ?>
diff --git a/template/link.php b/template/link.php
index 2f7fed5..412ba68 100644
--- a/template/link.php
+++ b/template/link.php
@@ -1,33 +1,33 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a link
*
* Called from
* include/functions.php - the_link() function
*
* Available variables:
* $title string e.g. "Home"
* $url string e.g. "/"
* $args mixed
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
-?><a class="btn btn-default" href="<?php _esc_attr( $url ) ?>"><?php _esc_html( $title ) ?></a>
+?><a class="btn btn-default" href="<?= esc_attr( $url ) ?>"><?php echo esc_html( $title ) ?></a>
diff --git a/template/logout.php b/template/logout.php
index a6ae166..668ca7d 100644
--- a/template/logout.php
+++ b/template/logout.php
@@ -1,37 +1,38 @@
<?php
# Copyright (C) 2018, 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the logout page
*
* Called from
* logout.php
*
* Parameters:
* $please (boolean) If true, will show the "Please confirm logout" warning.
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
<?php if( $please ): ?>
- <p class="alert alert-warning"><?php _e( "Please manually confirm your action." ) ?></p>
+ <p class="alert alert-warning"><?= __( "Please manually confirm your action." ) ?></p>
<?php endif ?>
- <form method="post" action="<?php echo ROOT ?>/logout.php">
- <button type="submit" name="action" value="logout" class="btn btn-default"><?php _e( "Logout" ) ?></button>
+ <form method="post" action="<?= ROOT ?>/logout.php">
+ <?php form_action( 'logout' ) ?>
+ <button type="submit" class="btn btn-default"><?= __( "Logout" ) ?></button>
</form>
diff --git a/template/mail-user-password.php b/template/mail-user-password.php
index bc3fea5..5e18ba7 100644
--- a/template/mail-user-password.php
+++ b/template/mail-user-password.php
@@ -1,54 +1,54 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the e-mail that contains the user password
*
* Called from
* template/sidebar.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
<?php printf(
__( "Hello %s %s!" ),
$name,
$surname
) ?>
<?php printf(
__( "Here you are your credentials for your account into the %s:" ),
SITE_NAME
) ?>
-<?php echo $uid ?>
+<?= $uid ?>
-<?php echo $password ?>
+<?= $password ?>
-<?php _e( "I remember you that the login page is there:" ) ?>
+<?= __( "I remember you that the login page is there:" ) ?>
-<?php echo http_build_get_query(
- get_menu_entry( 'login' )->getSitePage( true ), [
+<?= http_build_get_query(
+ menu_entry( 'login' )->getSitePage( true ), [
'user_uid' => $uid
]
) ?>
diff --git a/template/mailbox-description.php b/template/mailbox-description.php
index e3da163..caec441 100644
--- a/template/mailbox-description.php
+++ b/template/mailbox-description.php
@@ -1,29 +1,29 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a single e-mail forwarding
*
* Called from:
* template/mailbox.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
- <p><?php _e( "A mailbox is a fully operative e-mail address that you can use to send and receive e-mails. As interface you can use a webmail, an e-mail client like Thunderbird, Evolution, or a mobile app like K-9 Mail, etc." ) ?></p>
+ <p><?= __( "A mailbox is a fully operative e-mail address that you can use to send and receive e-mails. As interface you can use a webmail, an e-mail client like Thunderbird, Evolution, or a mobile app like K-9 Mail, etc." ) ?></p>
diff --git a/template/mailbox.php b/template/mailbox.php
index 20798eb..6e85f6f 100644
--- a/template/mailbox.php
+++ b/template/mailbox.php
@@ -1,67 +1,68 @@
<?php
# Copyright (C) 2018, 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a mailbox
*
* Called from:
* mailbox.php
*
* Available variables:
* $mailbox object
* $domain object
* $mailbox_password string|null
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
<?php template( 'mailbox-description' ) ?>
<!-- resources -->
<?php if( $mailbox ): ?>
- <h3><?php _e( "Resources" ) ?></h3>
+ <h3><?= __( "Resources" ) ?></h3>
<ul>
<li>
- <a href="https://mail.reyboz.it?email=<?php echo urlencode( $mailbox->getMailboxAddress() ) ?>" target="_blank" />
- <?php _e( "How to setup your IMAP/SMTP client" ) ?>
+ <a href="https://mail.reyboz.it?email=<?= urlencode( $mailbox->getMailboxAddress() ) ?>" target="_blank" />
+ <?= __( "How to setup your IMAP/SMTP client" ) ?>
</a>
</li>
</ul>
<?php endif ?>
<!-- /resources -->
<?php if( $mailbox ): ?>
- <h3><?php _e( "Actions" ) ?></h3>
+ <h3><?= __( "Actions" ) ?></h3>
<form method="post">
<?php if( $mailbox_password ): ?>
- <label for="password"><?php _e( "Please copy your new password:" ) ?><br />
- <input type="text" id="password" readonly<?php _value( $mailbox_password ) ?> />
+ <label for="password"><?= __( "Please copy your new password:" ) ?><br />
+ <input type="text" id="password" readonly<?= value( $mailbox_password ) ?> />
<?php else: ?>
- <p><button type="submit" class="btn btn-default" name="action" value="mailbox-password-reset"><?php _e( "Generate new password" ) ?></button></p>
+ <p><button type="submit" class="btn btn-default" name="action" value="mailbox-password-reset"><?= __( "Generate new password" ) ?></button></p>
<?php endif ?>
</form>
<?php else: ?>
<form method="post">
- <p><label for="mailbox-username"><?php _e( "Mailbox name:" ) ?></label><br />
- <input type="text" name="mailbox_username" id="mailbox-username" length="64" /> @ <?php _esc_html( $domain->getDomainName() ) ?>
+ <?php form_action( 'mailbox-create' ) ?>
+ <p><label for="mailbox-username"><?= __( "Mailbox name:" ) ?></label><br />
+ <input type="text" name="mailbox_username" id="mailbox-username" length="64" /> @ <?= esc_html( $domain->getDomainName() ) ?>
</p>
- <p><button type="submit" class="btn btn-default" name="action" value="mailbox-create"><?php _e( "Create" ) ?></button></p>
+ <p><button type="submit" class="btn btn-default"><?= __( "Create" ) ?></button></p>
</form>
<?php endif ?>
<!-- /actions -->
diff --git a/template/mailboxes.php b/template/mailboxes.php
index 6030226..f9392e8 100644
--- a/template/mailboxes.php
+++ b/template/mailboxes.php
@@ -1,63 +1,63 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the mailboxes list
*
* Called from:
* template/domain.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
// domain mailboxes
$mailboxes = $domain->factoryMailbox()
->select( [
'domain_name',
'mailbox_username',
'mailbox_receive',
] )
->queryGenerator();
?>
<!-- mail boxes -->
<h3><?php printf(
__( "Your %s" ),
__( "mailboxes" )
) ?></h3>
<?php template( 'mailbox-description' ) ?>
<?php if( $mailboxes->valid() ): ?>
<ul>
<?php foreach( $mailboxes as $mailbox ): ?>
<li>
- <code><?php echo HTML::a(
+ <code><?= HTML::a(
$mailbox->getMailboxPermalink(),
$mailbox->getMailboxAddress()
) ?></code>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
<?php /* TODO: check counter on domain */ ?>
<?php if( has_permission( 'edit-email-all' ) ): ?>
<p><?php the_link( Mailbox::permalink( $domain->getDomainName() ), __( "Create" ) ) ?></p>
<?php endif ?>
<!-- end mail boxes -->
diff --git a/template/mailforward-description.php b/template/mailforward-description.php
index d9eafee..f8b9d52 100644
--- a/template/mailforward-description.php
+++ b/template/mailforward-description.php
@@ -1,29 +1,29 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a single e-mail forwarding
*
* Called from:
* template/mailforward.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
- <p><?php _e( "A forwarding address is a simple e-mail address you can use to receive e-mails, forwarding them to another e-mail address of your choice." ) ?></p>
+ <p><?= __( "A forwarding address is a simple e-mail address you can use to receive e-mails, forwarding them to another e-mail address of your choice." ) ?></p>
diff --git a/template/mailforward.php b/template/mailforward.php
index 1c139d3..45d9f67 100644
--- a/template/mailforward.php
+++ b/template/mailforward.php
@@ -1,62 +1,73 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a single e-mail forwarding
*
* Called from:
* mailforward.php
*
* Available variables:
* $domain Domain object
* $mailforwardfrom Mailforward object
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
<?php template( 'mailforward-description' ) ?>
+ <!-- save form -->
<form method="post">
+ <?php form_action( 'mailforward-save' ) ?>
<p>
- <label for="mailforward-source"><?php _e( "E-mail address:") ?></label><br />
+ <label for="mailforward-source"><?= __( "E-mail address:") ?></label><br />
<?php if( $mailforwardfrom ): ?>
- <input type="text" id="mailforward-address" readonly<?php _value( $mailforwardfrom->getMailforwardfromAddress() ) ?> />
+ <input type="text" id="mailforward-address" readonly<?= value( $mailforwardfrom->getMailforwardfromAddress() ) ?> />
<?php else: ?>
<input type="string" name="mailforwardfrom_username" id="mailforwardfrom-username"<?php
if( $mailforwardfrom ) {
_value( $mailforwardfrom->getMailforwardfromUsername() );
}
- ?> /> <code>@<?php _esc_html( $domain->getDomainName() ) ?></code>
+ ?> /> <code>@<?= esc_html( $domain->getDomainName() ) ?></code>
<?php endif ?>
- <?php if( $mailforwardfrom ): ?>
- <button type="submit" class="btn btn-danger" name="action" value="mailforward-delete"><?php _e( "Delete" ) ?></button>
- <?php else: ?>
- <button type="submit" class="btn btn-default" name="action" value="mailforward-save"><?php _e( "Create" ) ?></button>
+ <?php if( !$mailforwardfrom ): ?>
+ <button type="submit" class="btn btn-default"><?= __( "Create" ) ?></button>
<?php endif ?>
</p>
</form>
+ <!-- / save form -->
+
+ <!-- delete form -->
+ <?php if( $mailforwardfrom ): ?>
+ <form method="post">
+ <?php form_action( 'mailforward-delete' ) ?>
+ <?= HTML::input( 'hidden', 'mailforwardfrom_username', $mailforwardfrom->getMailforwardfromAddress() ) ?>
+ <button type="submit" class="btn btn-danger"><?= __( "Delete" ) ?></button>
+ </form>
+ <?php endif ?>
+ <!-- /delete form -->
<?php if( $mailforwardfrom ): ?>
- <p><?php _e( "Forward the incoming e-mails to these destinations:" ) ?></label></p>
+ <p><?= __( "Forward the incoming e-mails to these destinations:" ) ?></label></p>
<?php template( 'mailforwardto', [
'domain' => $domain,
'mailforwardfrom' => $mailforwardfrom,
] ) ?>
<?php endif ?>
diff --git a/template/mailforwards.php b/template/mailforwards.php
index 50596c5..8b65dd1 100644
--- a/template/mailforwards.php
+++ b/template/mailforwards.php
@@ -1,66 +1,66 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the mailboxes list
*
* Called from:
* template/domain.php
*
* Available variables:
* $domain object
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
// domain mail forwardings
$mailforwardfroms = $domain->factoryMailforwardfrom()
->select( [
'mailforwardfrom.mailforwardfrom_ID',
'mailforwardfrom_username',
'domain_name',
] )
->queryGenerator();
?>
<!-- mail forwardings -->
<h3><?php printf(
__( "Your %s" ),
__( "mail forwardings" )
) ?></h3>
<?php template( 'mailforward-description' ) ?>
<?php if( $mailforwardfroms->valid() ): ?>
<ul>
<?php foreach( $mailforwardfroms as $mailforwardfrom ): ?>
<li>
- <code><?php echo HTML::a(
+ <code><?= HTML::a(
$mailforwardfrom->getMailforwardfromPermalink(),
$mailforwardfrom->getMailforwardfromAddress()
) ?></code>
</li>
<?php endforeach ?>
</ul>
<?php else: ?>
- <p><?php _e( "None yet.") ?></p>
+ <p><?= __( "None yet.") ?></p>
<?php endif ?>
<p><?php the_link(
Mailforwardfrom::permalink( $domain->getDomainName() ),
__( "Create" )
) ?></p>
<!-- end mail forwardings -->
diff --git a/template/mailforwardto.php b/template/mailforwardto.php
index 53632c0..0c66ae1 100644
--- a/template/mailforwardto.php
+++ b/template/mailforwardto.php
@@ -1,56 +1,62 @@
<?php
# Copyright (C) 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for a single e-mail forwarding
*
* Called from:
* template/mailforward.php
*
* Available variables:
* $domain Domain object
* $mailforwardfrom Mailforward object
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
$mailforwardto =
( new MailforwardtoAPI() )
->whereMailforwardfrom( $mailforwardfrom )
->orderBy( 'mailforwardto_address' )
->queryGenerator();
?>
<ul>
<?php if( $mailforwardto->valid() ): ?>
<?php foreach( $mailforwardto as $address ): ?>
<li>
+ <!-- remove -->
<form method="post">
- <input type="email" name="address"<?php _value( $address->getMailforwardtoAddress() ) ?> readonly />
- <button type="submit" class="btn btn-warning" name="action" value="mailforwardto-remove"><?php _e( "Remove" ) ?></button>
+ <?php form_action( 'mailforwardto-remove' ) ?>
+ <input type="email" name="address"<?= value( $address->getMailforwardtoAddress() ) ?> readonly />
+ <button type="submit" class="btn btn-warning"><?= __( "Remove" ) ?></button>
</form>
+ <!-- /remove -->
</li>
<?php endforeach ?>
<?php endif ?>
<li>
+ <!-- add -->
<form method="post">
+ <?php form_action( 'mailforwardto-add' ) ?>
<input type="email" id="mailforwardto-address" name="address" />
- <button type="submit" class="btn btn-default" name="action" value="mailforwardto-add"><?php _e( "Add" ) ?></button>
+ <button type="submit" class="btn btn-default"><?= __( "Add" ) ?></button>
</form>
+ <!-- /add -->
</li>
</ul>
diff --git a/template/menu.php b/template/menu.php
index bd2eb6f..d924052 100644
--- a/template/menu.php
+++ b/template/menu.php
@@ -1,48 +1,48 @@
<?php
# Copyright (C) 2018 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for the navigation menu
*
* Called from
* template/sidebar.php
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
<ul>
<?php foreach( $entries as $entry ): ?>
<li class="collection-item">
<?php if( $entry->uid === Header::$args[ 'uid' ] ): ?>
- <?php _esc_html( $entry->name ) ?>
+ <?= esc_html( $entry->name ) ?>
<?php else: ?>
- <?php echo HTML::a(
+ <?= HTML::a(
$entry->getSitePage(),
$entry->name
) ?>
<?php endif ?>
<?php MenuTree::spawn( array_replace( $args, [
'uid' => $entry->uid,
'level' => $level + 1,
] ) ) ?>
</li>
<?php endforeach ?>
</ul>
diff --git a/template/profile.php b/template/profile.php
index 73b71f8..2def297 100644
--- a/template/profile.php
+++ b/template/profile.php
@@ -1,43 +1,44 @@
<?php
-# Copyright (C) 2018 Valerio Bozzolan
+# Copyright (C) 2018, 2019 Valerio Bozzolan
# Boz Libre Hosting Panel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
* This is the template for an user profile
*
* Called from:
* profile.php
*
* Available variables:
* $email string
*/
// unuseful when load directly
defined( 'BOZ_PHP' ) or die;
?>
- <h3><?php _e( "Change password" ) ?></h3>
+ <h3><?= __( "Change password" ) ?></h3>
<form method="post">
+ <?php form_action( 'send-user-password' ) ?>
<p><?php printf(
__( "You can generate a new strong password that will be sent to your e-mail address (%s). Note that this action will also logout you immediately." ),
esc_html( $email )
) ?></p>
- <p><button type="submit" class="btn btn-default" name="action" value="send-user-password"><?php _e( "Generate new password" ) ?></button></p>
+ <p><button type="submit" class="btn btn-default"><?= __( "Generate new password" ) ?></button></p>
</form>
- <h3><?php _e( "Logout" ) ?></h3>
- <p><?php _e( "Have you done what you had to do? Then you can (and should) logout now." ) ?></p>
+ <h3><?= __( "Logout" ) ?></h3>
+ <p><?= __( "Have you done what you had to do? Then you can (and should) logout now." ) ?></p>
<p><?php the_menu_link( 'logout' ) ?></p>

File Metadata

Mime Type
text/x-diff
Expires
Thu, Nov 19, 04:44 (10 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264804
Default Alt Text
(57 KB)

Event Timeline