# Installation PowerOfDark CMS website

- [Installation PowerOfDark CMS website](#installation-powerofdark-cms-website)
  - [Requirements](#requirements)
  - [PHP Configuration](#php-configuration)
    - [PHP Requisites](#php-requisites)
  - [Installation process](#installation-process)
  - [Important configurations](#important-configurations)
    - [PayPal](#paypal)
- [Cute News set-up](#cute-news-set-up)
  - [Change the password](#change-the-password)
  - [Update the config](#update-the-config)
  - [Update the template](#update-the-template)
  - [Clear the test data](#clear-the-test-data)
- [Apache Vhost](#apache-vhost)
    - [(Optional) Disable the access by IP with a 403 (so you can still use www folder)](#optional-disable-the-access-by-ip-with-a-403-so-you-can-still-use-www-folder)
    - [Remove the following lines if exists](#remove-the-following-lines-if-exists)
    - [Add the following lines to Generic multi server with C:\\AppServ\\www as main folder](#add-the-following-lines-to-generic-multi-server-with-cappservwww-as-main-folder)
      - [Alternative - Generic multi server with C:\\Servers{server}\\www as main folder](#alternative---generic-multi-server-with-cserversserverwww-as-main-folder)

## Requirements

- Apache 2 + PHP 7.1+ (AppServ 8.6.0 is ok)
- MySQL

## PHP Configuration

  
Please, check one of the following tutorials depending on your installation, if you are using another server, check AppServ or Xampp, both are Apache.

- [AppServ 8.6](Installation_appServ_8.6.md)
- [IIS](Installation_IIS.md)

### PHP Requisites

- OpenSSL (for paypal)
- PHP_PDO_MYSQL


## Installation process

1. Unzip/unrar the file in the `www` folder of AppServ.
2. Copy the `config.php.example` file and rename it to `config.php`.
3. Execute `installation/game-update.sql` file into the `GAME DATABASE` (navicat, phpmyadmin...)
4. Ececute `installation/game-update.sql` file into `GAME DATABASE` OR `a new one` (if you want to maintain website and the game information in different databases)
5. Set the variables in the `config.php` file to your desired one.
   1. If the `cms.sql` file has been imported in the same `game database`, just maintain `CMS_DB` commented, otherwise remove the `/*` and `*/` lines.
6. Import the `game-update.sql` file to your database.

## Important configurations

- `SERVER_NAME`: Must match the same as the source
- `SOURCE_TYPE`: Must match the `model` to use from the `models` folder.
- `GAME_DB`
- `CMS_DB`: Only if you want a DIFFERENT DATABASE for the CMS instead of using `GAME_DM` too.

### PayPal

1. At config.php configure all "paypal_" variables (it has a comment for each one).
2. Ensure your WEB_URL works correctly, otherwise `PayPal` will be unable to process the payment correctly.


# Cute News set-up

Log in to `CuteNews` admin with the data:

```
url: http://your-domain.com/CuteNews
user: admin
password: admin
```

## Change the password

1. Go to `CuteNews` admin.
2. Go to `Site Options` (dashboard) -> `Personal Options`.
3. Change the password.
4. Optionally, update the other fields.
5. Click on `Save` button.

## Update the config

1. Go to `CuteNews` admin.
2. Go to `Site Options` (dashboard) -> `System Configurations`.
3. In the tab `General` update:
    - `Full URL to CuteNews directory` to `https://your-domain.com/CuteNews`
    - `URL to your site` to `http://your-domain.com`
    - `Server upload dir` to `C:/AppServ/www/CuteNews/uploads`
    - `Frontend upload dir` to `https://your-domain.com/CuteNews/uploads`
4. Optional update the other fields, maybe you like to:
    - `Social` tab -> `Use facebook comments for post` (you will need the facebook API)
    - `Comments` -> `Show standart comments`

## Update the template

1. Go to `CuteNews` admin.
2. Go to `Site Options` (dashboard) -> `Templates`.
3. In the selector choose `News` and click on `Select Template` button.
4. Apply the desired changes and click on `Save` button.


## Clear the test data

> The test data is provided to view the funcitonallity before add content and test the designs.

1. Go to `CuteNews` admin.
2. Go to `Edit News` header option.
3. Select all articles that you don't want (for example: `test` articles)
4. Press on `With Selected` -> `Delete news (selector)` -> `Go` button.


# Apache Vhost
1. Open `C:\AppServ\Apache2\conf\httpd.conf`
2. Uncomment or add the following lines:
```ini
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Include conf/extra/httpd-vhosts.conf
```

1. Go to `C:\AppServ\Apache2\conf\extra\httpd-vhosts.conf`
2. Add the lines described as the next sections
3. Restart the computer or AppServ

### (Optional) Disable the access by IP with a 403 (so you can still use www folder)

```ini
<VirtualHost *:80>
    ServerName xxx.xxx.xxx.xxx
    Redirect 403 /
    DocumentRoot /var/www/html
</VirtualHost>
```

### Remove the following lines if exists

```ini
<VirtualHost _default_:80>
DocumentRoot "${SRVROOT}/htdocs"
#ServerName www.example.com:80
</VirtualHost>
```

### Add the following lines to Generic multi server with C:\AppServ\www as main folder

```ini
# MANDATORY (default website)
<VirtualHost *:80>
    ServerAdmin info@cotowers.net
    DocumentRoot "C:/AppServ/www"
    ServerName cotowers.net
    ServerAlias www.cotowers.net
</VirtualHost>

# New Websites
<VirtualHost *:80>
    ServerName otherserver.es
    ServerAlias www.otherserver.es
    DocumentRoot "C:/otherserver.es/www"
    <Directory "C:/otherserver.es/www">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

# ALTERNATIVE (to the 2nd)
; <VirtualHost *:80>
;     ServerAdmin webmaster@localhost
;     DocumentRoot "C:/otherserver/www"
;     ServerName otherserver.es
;     ServerAlias www.otherserver.es
; </VirtualHost>
; <Directory "C:/otherserver.es/www">
;     # Options -Indexes FollowSymLinks
;     AllowOverride None

;     Order allow,deny
;     Allow from all
;     Require all granted
; </Directory>


```

#### Alternative - Generic multi server with C:\Servers\{server}\www as main folder

```ini
# CoTowers
<VirtualHost *:80>
    ServerAdmin info@cotowers.net
    DocumentRoot "C:/servers/cotowers/www"
    ServerName cotowers.net
    ServerAlias www.cotowers.net
	<Directory "C:/servers/cotowers/www">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

# CoPower
<VirtualHost *:80>
    ServerName copower.es
    ServerAlias www.copower.es
    DocumentRoot "C:/servers/copower/www"
    <Directory "C:/servers/copower/www">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
```
