# PowerOfDark CMS

- [PowerOfDark CMS](#powerofdark-cms)
  - [Contact](#contact)
  - [Author](#author)
  - [Thanks to](#thanks-to)
- [Installation](#installation)
  - [Paypal Sandobox data](#paypal-sandobox-data)
    - [Payer](#payer)
    - [Receivers (config.php)](#receivers-configphp)
- [Web Settings](#web-settings)
  - [Vote Reward](#vote-reward)
  - [Store](#store)
  - [Ranking (for file database sources like STREAM)](#ranking-for-file-database-sources-like-stream)
- [Cli instructions](#cli-instructions)
- [Development](#development)
  - [Fix git hooks](#fix-git-hooks)
  - [ShowCases](#showcases)
  - [Test obfuscator](#test-obfuscator)
    - [Pure PHP (normal installation)](#pure-php-normal-installation)
  - [Docker](#docker)
  - [Run tests](#run-tests)

## Contact

If you need more features/changes in source, please contact us at:

- [https://www.facebook.com/ProtocolNebula/](Facebook)
- [https://wa.me/34695616265](Whatsapp)
- [https://cms.powerofdark.com/contact/](PowerOfDark CMS Contact)

## Author

**Official website:** https://cms.powerofdark.com

This CMS has been written by `Ruben Arroyo` and it takes websites that are **purchased** or free to use.
We never **will ask money for the templates itself**, we just sell the adaptation to this CMS.

The original source code was made by Mr Hashish.

Do you need support for this script or found it for free? Please contact me at https://cms.powerofdark.com or `info@powerofdark.com`.


## Thanks to

- Mr. Hashish. for some designs
- And other anons that we don't know that they contributed (with Open Source libs or templates)


# Installation

For the whole page functionallity (including Paypal) you need to check the `Installation.md` file.

If it is NOT INCLUDED in this zip, you downloaded a `pirate` copy of this script.

## Paypal Sandobox data

### Payer

**user:** sb-mtcqv22189637@personal.example.com
**password:** /rI.j9Hz


**user:** powergm@hotmail.es
**password:** /rI.j9Hz

### Receivers (config.php)

**Delayed payment:** info@cotowers.net
**Instant payment:** powergm@hotmail.es



---

# Web Settings

## Vote Reward

1. Open `settings/config.php`.
2. Edit the `VOTE_REWARDS` array with all the rewards you want to give.


## Store

1. Connect to `MySQL` (PHPMyAdmin or Navicat).
2. Open `store` table.
3. Add or modify the items, these are the important values:
    - `price`: The item price in the specified currency.
    - `type`: The type of the item.
      - `1`: Gold
      - `2`: CPs
      - `3`: BCPs
      - `100`: Item
      - `200`: Pack (items must exist)
    - `value`: The `quantity` for **Money** or the **Item info**
        - For **Items**:
    - `value`: 
        - **Quantity for money/CPS** (EX: 1000)
        - **ITEMS: the following rule**:
          - `FIELDS ORDER`: id seconds plus blessed enchant onesoc twosoc times bound
          - `EXAMPLE`: 136008 0 5 0 0 0 0 1 0
        - **PACKS:** `id` of the `items` separated by `,` (comma):
          - `RULES`:
            - Separate items by ","
            - Items must EXIST in  the `shop` table, you must use the `ID` field, NOT THE ID from `itemtype`
            - You can mix money, cps, items... BUT NOT OTHER PACKS
            - To define multiple quantities, use `:`. EX: `55:2`
          - `EXAMPLE`: 50,55:2,10:4,20
          - `DESCRIPTION:` Is optional, it will ADD the products name and quantity automatically
        


## Ranking (for file database sources like STREAM)

> These steps are required only for STREAM SOURCES, if you have emulator, skip this section.

1. First test that the script will work fine, open a `cmd` in the `www` folder.
2. Run: `php cli.php ranking generateAll`.
3. If it works, open `Task Scheduler` from windows.
4. Create a `new tasks` (**not basic**) with the following parameters:
  - General:
    - `Name`: ConquerRankingUpdate (or what you want)
  - Triggers (`add` a new one):
    - `Settings`:
      - `Daily`
      - Ocurs every: `1` days
    - `Advanced Settings`:
      - Repeat task every `1 hour` (or the time you wish)
  - Actions (`add` a new one):
    - Action: `Start a program`
    - Program/Script: `C:\AppServ\php7\php.exe`
    - Add Arguments: `cli.php ranking generateAll`
    - Start In: `C:\AppServ\www`
5. Test the task to check if works, to do so:
  - In `Navicat/PHPMyAdmin`: Truncate/Empty the cms_rank_* tables
  - In the `Task Scheduler`: Right click in the task -> `Run`
  - Check if the tables are now filled


# Cli instructions

> Please read the [src/core/cli/Readme.md](src/core/cli/Readme.md) file for more information.


# Development

## Fix git hooks

```bash
# Add all as safe directory in git php74 container
docker exec -it -w $(pwd) php82 git config --global --add safe.directory "*"

# Update the hooks
composer update-hooks

# Update hooks without composer tool
#php vendor/bin/cghooks update
```

## ShowCases

1. Create the folder

```bash
mkdir ../showcases
```

2. Install pre-push hook for showcase 

```bash
ln showcase-updater.sh .git/hooks/pre-push
```

3. Create demo branches for each showcase

```bash
git checkout -b demo/template
# go back to master
git checkout master
```

4. Create the worktree
  
```bash
git worktree add ../showcases/demo/template demo/template
```

5. Copy and configure the settings based on the current file

```bash
cp settings/config.php ../showcases/demo/template/settings
```

## Test obfuscator

> Test the obfuscator will help you to find syntactical errors.

### Pure PHP (normal installation)

```bash
./tools/obfuscator/bin/obfuscate obfuscate . ../obfuscated --config=./tools/obfuscator-config.yml
```

## Docker

> This assumes that you have a docker called "php74"

```bash
docker exec -it php74 /bin/bash
cd /var/www/html/conquer-online
./tools/obfuscator/bin/obfuscate obfuscate . ../obfuscated --config=./tools/obfuscator-config.yml
```

## Run tests

```bash
# All tests
php composer tests
# make tests

# Emulator
php ./vendor/bin/phpunit --testdox --bootstrap ./tests/auto/models/config/emulator.php tests/auto/models --debug

# Stream
php ./vendor/bin/phpunit --testdox --bootstrap ./tests/auto/models/config/stream.php tests/auto/models --debug
```
