Skip to content

Commit

Permalink
admin menu change
Browse files Browse the repository at this point in the history
  • Loading branch information
vzuburlis committed Jun 13, 2020
1 parent 478ca46 commit a8aa0bc
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 116 deletions.
13 changes: 12 additions & 1 deletion source/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ In the administration menu you the Administration option gives a sub menu of the
- [**Packages**](#packages)
- [**Themes**](#themes)
- [**Settings**](#settings)
- [**Logs**](#logs)
- [**DB Backups**](#db-backups)
<br>


Expand Down Expand Up @@ -82,6 +84,7 @@ On Administration->Settings page and we can make the following configurations
- **Website URL** the url path for exmple 'https://mysite.com'
- **Admin Email** sets the email of the administration.
- **New users can register** adds the registration form for the visitors so they can register as users.
- **New users activation** How the new users are activated.
- **Theme** changes the look and style of your website. You can also change the theme from *Administration->Themes*
- **Timezone** The dates and times saved in posts, logs and the rest of the content will be based on the selected timezone.
- **Language** The language of the website and the administration menu.
Expand All @@ -106,7 +109,15 @@ The following settings can be set directly in *config.php* but you be careful, b
- **cors** (Cross-Origin Resource Sharing) An array of domains that your website will respond in requests.
<br>

## PHPinfo
## Logs

In this page you can navigate inside the log files of the installation.

## DB Backups

You can create a new database backup and then download it or restore(Load) it later.

## /admin/phpinfo

This option will display the settings of the php moduls on the server. This is for informational purposes only. DO NOT share screenshots in the public of this page as it includes data about the server configuration.

Expand Down
2 changes: 1 addition & 1 deletion source/api-db.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Class db
## Class Db
Class db prepare statements for mysql queries to the connected database.
We use the global ``$db`` instance to access its methods.

Expand Down
13 changes: 13 additions & 0 deletions source/api-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,16 @@ Returns the result of the handler.
- $event:string The event name.
- $default:mixed The value to return if there was no handler called.
- $params:array (optional) Parameters to send to handler.


### Basic events
load
head
foot
sendmail
validateUserPassword
recaptcha
login.btn
login.callback
admin::media
admin::media-view
81 changes: 0 additions & 81 deletions source/api-gila.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,6 @@
## Class Gila
Common methods for Gila CMS

### controller ()
(static) Register a new controller.

**Parameters**
- $c:string Controllers name
- $file:string Controller's filepath without the php extension
- $name:string Optional. Controller's class name, $c is used by default

Example:
```
Gila::controller('my-ctrl', 'my_package/controllers/ctrl','myctrl');
```


### route ()
(static) Registers a function call on a specific path.

**Parameters**
- $r:string The path
- $fn:function Callback for the route

Example:
```
Gila::route('some.txt', function(){ echo 'Some text.'; });
```


### onController ()
(static) Registers a function to run right after the controller class construction.

**Parameters**
- $c:string The controller's class name
- $fn:function Callback

Example:
```
Gila::route('blog', function(){ blog::ppp = 24; });
```


### action ()
(static) Registers a new action or replaces an existing for a controller.

**Parameters**
- $c:string The controller's class name
- $action:string The action
- $fn:function Callback

Example:
```
Gila::action('blog', 'topics', function(){ blog::tagsAction(); });
```


### onAction ()
(static) Runs after an action and before the display of view file.

**Parameters**
- $c:string The controller's class name
- $action:string The action
- $fn:function Callback

Example:
```
Gila::onAction('blog', 'topics', function(){ View::set('new_variable', 'value'); });
```


### before ()
(static) Registers a function to run before the function of a specific action.

**Parameters**
- $c:string The controller's class name
- $action:string The action
- $fn:function Callback

Example:
```
Gila::action('blog', 'topics', function(){ blog::tagsAction(); });
```


### addLang ()
(static) Adds language translations from a json file.
Expand Down
55 changes: 45 additions & 10 deletions source/api-gpost.md → source/api-moreclasses.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# More classes

## Class gpost
## Class HttpPost

Make easy post requests from the server with the constructor of the class.
Use:
```
$postData = ['id'=> 100];
$args = ['type'=> 'x-www-form-urlencoded'];
$response = new gpost('https://api.example.com/get', $postData, $args);
$response = new HttpPost('https://api.example.com/get', $postData, $args);
$list = $response->json();
```
**Parameters**
Expand Down Expand Up @@ -41,7 +41,7 @@ Returns a header value. If header is not specified, it returns the array of head


### set ()
(static) Sets the prefix arguments of a base gpost
(static) Sets the prefix arguments of a base HttpPost

**Parameters**
- $name:string the base name
Expand All @@ -53,19 +53,19 @@ $postData = ['id'=> 100];
$args = ['type'=> 'x-www-form-urlencoded'];
// directly to endpoint
$response = new gpost('https://api.example.com/get', $postData, $args);
$response = new HttpPost('https://api.example.com/get', $postData, $args);
// using a base, you can skip sending empty arguments as third parameter,
// and send the base api name
$args['url] = 'https://api.example.com/';
$args['header'] = ['Authorization'=> 'Bearer <token>'];
gpost::set('api_ex', $args);
$response = new gpost('get', $postData, 'api_ex');
HttpPost::set('api_ex', $args);
$response = new HttpPost('get', $postData, 'api_ex');
```


## Class gForm
## Class Form

Displays forms

Expand Down Expand Up @@ -107,7 +107,7 @@ Compares a value to the stored token in session. Returns boolean

Example
```
gForm::html([
Form::html([
'group'=>[
'type'=>'select',
'options'=>[0=>'Group A', 0=>'Group B']
Expand All @@ -130,7 +130,7 @@ gForm::html([


### addInputType ()
(static) Create a new input type for gForm class.
(static) Create a new input type for Form class.

**Parameters**
- $name:string the input type name
Expand All @@ -143,10 +143,45 @@ gForm::html([

Example
```
gForm::addInputType('group-select', function($name, $field, $value) {
Form::addInputType('group-select', function($name, $field, $value) {
// a web coomponent that will be rendered with vuejs
$valueProp = 'value="' . $value . '"';
$dataProp = 'data-group="' . json_encode($field['options']) . '"';
return "<group-select $valueProp $dataProp></group-select>";
});
```


## Class Cache
Caches data or a page for faster loads.

### remember ()
Loads or updates a string.

**Parameters**
- $name:string The item name to save the data
- $time:int Time in seconds to keep the value
- $fn:function The function that calculates and return the string if it is not cached
- $uniques:array A list of values that expire the cache if they change

**Example**
```
Cache::remember('post-'.$id, 3600, function($list) use($id){
return 'Post#'.$id.'. Updated at '.data($list[0]);
}, [Gila::mt('post')]);
```

### page ()
Saves or loads the rest of the output from cache. The remember() method should be prefered but when you have a lot of requests and the output is not probably going to change soon, this method can give a faster response.

**Parameters**
- $name:string The item name to save the data
- $time:int Time in seconds to keep the value
- $uniques:array A list of values that expire the cache if they change

**Example**
```
if(Session::userId()===0) {
Cache::page('page.post-'.$id, 3600, [Gila::mt('post')]);
}
```
87 changes: 87 additions & 0 deletions source/api-router.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
## Class Router
The class that manages the routes and request parameters

### controller ()
(static) Register a new controller.

**Parameters**
- $c:string Controllers name
- $file:string Controller's filepath without the php extension
- $name:string Optional. Controller's class name, $c is used by default

Example:
```
Router::controller('my-ctrl', 'my_package/controllers/ctrl','myctrl');
```


### add ()
(static) Registers a new route.

**Parameters**
- $r:string The path
- $fn:function Callback for the route
- $method:string (optional)

Examples:
```
Router::route('some.txt', function(){ echo 'Some text.'; });
# route with regex
Router::route('hello/(.*)', function($x){ echo 'Hello '.$x; });
```


### onController ()
(static) Registers a function to run right after the controller class construction.

**Parameters**
- $c:string The controller's class name
- $fn:function Callback

Example:
```
Router::onController('blog', function(){ blog::ppp = 24; });
```


### action ()
(static) Registers a new action or replaces an existing for a controller.

**Parameters**
- $c:string The controller's class name
- $action:string The action
- $fn:function Callback

Example:
```
Router::action('blog', 'topics', function(){ blog::tagsAction(); });
```


### onAction ()
(static) Runs after an action and before the display of view file.

**Parameters**
- $c:string The controller's class name
- $action:string The action
- $fn:function Callback

Example:
```
Router::onAction('blog', 'topics', function(){ View::set('new_variable', 'value'); });
```


### before ()
(static) Registers a function to run before the function of a specific action.

**Parameters**
- $c:string The controller's class name
- $action:string The action
- $fn:function Callback

Example:
```
Router::action('blog', 'topics', function(){ blog::tagsAction(); });
```

12 changes: 6 additions & 6 deletions source/api-table.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Class gTable
## Class Table

Class gTable is a tool to make queries to the database, that escapes sql injections and checks the user permissions for you.
Class Table is a tool to make queries to the database, that escapes sql injections and checks the user permissions for you.

How to create an instance:
```
$userTable = new gTable('user');
$userTable = new gTable('src/core/tables/user.php');
$userTable = new Table('user');
$userTable = new Table('src/core/tables/user.php');
```

**Parameters**
Expand All @@ -21,7 +21,7 @@ The permissions that will be send will override this array:
'delete'=> ['admin']
]
```
So, by default the created gTable instance uses the admin permission, and it will compare them with the permissions that the table [schema](schemas.html#table-schema) accepts. The The keys of the array can have a string array of permissions or boolean (true|false) for value.
So, by default the created Table instance uses the admin permission, and it will compare them with the permissions that the table [schema](schemas.html#table-schema) accepts. The The keys of the array can have a string array of permissions or boolean (true|false) for value.


### name ()
Expand All @@ -42,7 +42,7 @@ Returns true if an action is permited based on permissions. When a field name is
The permissions that will be send will override this array:
```
$permissions = user::permissions(Session::user_id());
$userTable = new gTable('user', $permissions);
$userTable = new Table('user', $permissions);
$userTable->can('read', 'password');
$userTable->can('delete'); // create & delete are not specified for fields
```
Expand Down

0 comments on commit a8aa0bc

Please sign in to comment.