Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move media & index.php to www #363

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ github actions page:

### Manual Installation

1. Extract to web root folder (eg: /var/www/html => Ubuntu)
1. Extract to a folder (eg: `/usr/local/share/kalkun` for Ubuntu, Debian...)
1. Run `composer install` from there
1. If you haven't created the gammu database yet, create it. It is shared by gammu & kalkun. Here we name it `kalkun`, but by default, gammu may name it `smsd`.

Expand All @@ -60,13 +60,13 @@ github actions page:
CREATE USER username WITH password 'password' NOCREATEDB NOCREATEROLE;
CREATE DATABASE kalkun WITH OWNER = username;
```
1. Edit database config (application/config/database.php)
Change database value to 'kalkun'.
username and password depends on your database configuration.
1. Edit database config (`application/config/database.php`)
Change database value to `kalkun`.
username and password depend on your database configuration.
If you use a specific port with PostgreSQL, you may also need to set
`$db['default']['port'] = "5432";`

1. Import gammu database schema (it's included on gammu source, eg. `gammu/docs/sql/mysql.sql`).
1. Import gammu database schema (it's included in gammu source, eg. `gammu/docs/sql/mysql.sql`).

For MySQL :
```
Expand All @@ -84,36 +84,53 @@ github actions page:
- Set path on gammu-smsd configuration at runonreceive directive, e.g:
```
[smsd]
runonreceive = /var/www/html/kalkun/scripts/daemon.sh
runonreceive = /usr/local/share/kalkun/scripts/daemon.sh
```
or, if you use Windows:
```
[smsd]
runonreceive = C:\xampp\htdocs\kalkun\scripts\daemon.bat
```
- set correct path (php-cli path and daemon.php path) on daemon.sh or daemon.bat
- set correct path (php-cli path and outbox_queue.php path) on outbox_queue.sh or outbox_queue.bat
- set correct path (`php-cli` path and `daemon.php` path) in `daemon.sh` or `daemon.bat`
- set correct path (`php-cli` path and `outbox_queue.php` path) in `outbox_queue.sh` or `outbox_queue.bat`
- make sure that the daemon & outbox_queue scripts are executable
- Change URI path in daemon.php & outbox_queue.php. Default is (http://localhost/kalkun)
- Change URI path in `daemon.php` & `outbox_queue.php`. Default is (http://localhost/kalkun)
1. Configure your webserver to point to `/usr/local/share/kalkun/www`
- With Apache, on Ubuntu, debian, you may add such a file `/etc/apache2/conf-enabled/kalkun.conf`
```
Alias /kalkun /usr/local/share/kalkun/www

<Directory /usr/local/share/kalkun/www>
Options -Indexes
</Directory>
```
- Then restart the webserver
```
systemctl restart apache2.service
```
1. Set the log directory as writable by the HTTP Server. On Ubuntu, debian:
```
chown www-data:www-data /usr/local/share/kalkun/application/logs
```
1. Configure Kalkun
- _There are 2 ways to configure_
- Graphic Install (this will also check that all the dependencies are installed)
- Graphic Install (this will also check that all the dependencies are installed and update the database schema if this is an upgrade)
1. Launch http://localhost/kalkun/index.php/install, and follow instruction there
1. Finally delete file /var/www/html/kalkun/*install* in case the installer didn't do so.
- Manual Install
1. Finally delete file `/usr/local/share/kalkun/www/install` in case the installer couldn't do so.
- Manual Install (only for fresh install)
1. Import sql file located in kalkun/media/db/ to kalkun database.

For MySQL
```
mysql -u username -p kalkun < /var/www/html/kalkun/media/db/mysql_kalkun.sql
mysql -u username -p kalkun < /usr/local/share/kalkun/media/db/mysql_kalkun.sql
```
For PostgreSQL
```
psql -U username -h localhost kalkun < /var/www/html/kalkun/media/db/pgsql_kalkun.sql
psql -U username -h localhost kalkun < /usr/local/share/kalkun/media/db/pgsql_kalkun.sql
```
2. Delete the file /var/www/html/kalkun/*install*
2. Delete the file `/usr/local/share/kalkun/www/install`

`rm /var/www/html/kalkun/install`
`rm /usr/local/share/kalkun/www/install`

## IMPORTANT
* After install is finished, you may need to remove install file.
Expand All @@ -122,7 +139,7 @@ github actions page:
```
php -r 'echo bin2hex(random_bytes(16)), "\n";'
```
Write the value in application/config/config.php and enclose it in a hex2bin() function.
Write the value in `application/config/config.php` and enclose it in a `hex2bin()` function.

### Migration Note (to kalkun 0.8)
* During migration to codeigniter 3 (done with version 0.8 of Kalkun), it was strongly advised to switch to the Encryption Library for security reasons. This required to change the default encryption key. The Encryption library was used in "sms to wordpress" and "sms to xmpp" plugins. You need to recreate the configuration of these plugins so that they continue to work.
Expand Down
2 changes: 1 addition & 1 deletion application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = 'vendor/autoload.php';
$config['composer_autoload'] = '../vendor/autoload.php';

/*
|--------------------------------------------------------------------------
Expand Down
21 changes: 14 additions & 7 deletions application/controllers/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ class Install extends CI_Controller {
function __construct()
{
parent::__construct();
if ( ! file_exists('./install'))
{
show_error('Installation has been disabled by the administrator.<p>
To enable access to it, create a file named <strong>install</strong>
in this directory of the server: <strong>'.realpath('.').'</strong>.
<p>Otherwise you may <a href="..">log in</a>.', 403, '403 Forbidden');
}

// language
$this->load->helper('i18n');
Expand All @@ -51,6 +44,20 @@ function __construct()
}
$this->lang->load('kalkun', $this->idiom);

if ( ! file_exists(FCPATH.'install'))
{
show_error(
tr(
'Installation has been disabled by the administrator.<p>To enable access to it, create a file named <strong>install</strong> in this directory of the server: <strong>{0}</strong>.<p>Otherwise you may <a href="{1}">log in</a>.',
NULL,
realpath(FCPATH),
$this->config->item('base_url')
),
403,
tr('403 Forbidden')
);
}

require_once(APPPATH.'config/database.php');
$this->db_config = $db[$active_group];
}
Expand Down
2 changes: 1 addition & 1 deletion application/core/MY_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function __construct($login = TRUE)
parent::__construct();

// installation mode
if (file_exists('install'))
if (file_exists(FCPATH.'install'))
{
redirect('install');
}
Expand Down
2 changes: 1 addition & 1 deletion application/tests/controllers/Install_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Install_test extends TestCase
{
public function test_index()
{
$output = $this->request('GET', 'install');
$output = $this->request('GET', 'www/install');
$this->assertContains('<title>Kalkun &rsaquo; Installation</title>', $output);
}

Expand Down
6 changes: 3 additions & 3 deletions application/views/main/install/install_result.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

<h3>Remaining manual steps</h3>
<?php
if (file_exists('./install') && is_writable(dirname('./install'))):
$rm = unlink('./install');
if (file_exists(FCPATH.'install') && is_writable(dirname(FCPATH.'install'))):
$rm = unlink(FCPATH.'install');
$needs_manual_install_file_deletion = FALSE;

else:
$realpath = realpath('./install');
$realpath = realpath(FCPATH.'install');
$needs_manual_install_file_deletion = TRUE;
?>
<h4>Remove Installation file</h4>
Expand Down
6 changes: 3 additions & 3 deletions fix_code_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if command -v html-beautify >/dev/null ; then
--indent-scripts=normal \
"$file"
done < <(find application/views/js_init application/views/main -name "*.php" -print0 && \
find media/css -name "b*.css" -print0 -or -name "i*.css" -print0 )
find www/media/css -name "b*.css" -print0 -or -name "i*.css" -print0 )

PLUGIN_VIEWS=$(find application/plugins -type d -name views)
while IFS= read -r -d '' file; do
Expand Down Expand Up @@ -153,10 +153,10 @@ fi
# to hide some of this data, but have it in mind that this is not enough to prevent a serious attacker.
#find application/ -type d -exec cp -a vendor/codeigniter/framework/application/index.html '{}' \;
find application/ -type d '!' -exec test -e "{}/index.html" ';' -exec cp -a vendor/codeigniter/framework/application/index.html '{}' \; &&
find media/ -type d '!' -exec test -e "{}/index.html" ';' -exec cp -a vendor/codeigniter/framework/application/index.html '{}' \; &&
find www/media/ -type d '!' -exec test -e "{}/index.html" ';' -exec cp -a vendor/codeigniter/framework/application/index.html '{}' \; &&
if [ $DO_GIT_COMMIT -eq 1 ]; then
git add "application/**index.html" &&
git add "media/**index.html" &&
git add "www/media/**index.html" &&
git commit -m "[AUTO] Add missing protective index.html"
fi

Expand Down
4 changes: 2 additions & 2 deletions index.php → www/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
* This variable must contain the name of your "system" directory.
* Set the path if it is not in the same directory as this file.
*/
$system_path = 'vendor/codeigniter/framework/system';
$system_path = '../vendor/codeigniter/framework/system';

/*
*---------------------------------------------------------------
Expand All @@ -114,7 +114,7 @@
*
* NO TRAILING SLASH!
*/
$application_folder = 'application';
$application_folder = '../application';

/*
*---------------------------------------------------------------
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.