Skip to content

Commit 73b36b5

Browse files
author
Samuel Akopyan
committed
Updates demos, docs, test, utils
1 parent 34908e2 commit 73b36b5

File tree

154 files changed

+7154
-6190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+7154
-6190
lines changed

demos/hello-world/index.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
* @link http://www.apphpframework.com/
88
* @copyright Copyright (c) 2012 - 2019 ApPHP Framework
99
* @license http://www.apphpframework.com/license/
10-
*/
10+
*/
1111

1212
// change the following paths if necessary
1313
defined('APPHP_PATH') || define('APPHP_PATH', dirname(__FILE__));
1414
// directory separator
1515
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
1616
// production | debug | demo | test
17-
defined('APPHP_MODE') or define('APPHP_MODE', 'production');
17+
defined('APPHP_MODE') or define('APPHP_MODE', 'production');
1818

1919

20-
$apphp = dirname(__FILE__).'/../../framework/Apphp.php';
21-
$config = APPHP_PATH.'/protected/config/';
20+
$apphp = dirname(__FILE__) . '/../../framework/Apphp.php';
21+
$config = APPHP_PATH . '/protected/config/';
2222

2323
require_once($apphp);
2424
A::init($config)->run();

demos/hello-world/protected/config/main.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// application data
55
'name'=>'Hello World',
66
'version'=>'1.0.2',
7-
7+
88
'defaultTemplate' => '',
99

1010
'defaultErrorController' => 'Error',

demos/hello-world/protected/controllers/IndexController.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
class IndexController extends CController
44
{
5-
5+
66
public function __construct()
77
{
8-
parent::__construct();
9-
}
8+
parent::__construct();
9+
}
1010

1111
public function indexAction()
1212
{
13-
$this->_view->text = 'Hello World!';
14-
$this->_view->render('index/index');
13+
$this->_view->text = 'Hello World!';
14+
$this->_view->render('index/index');
1515
}
1616

1717
}

demos/hello-world/protected/tmp/logs/error.log

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<h1><?php echo $text; ?></h1>
1+
<h1><?= $text; ?></h1>

demos/login-system/index.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @link http://www.apphpframework.com/
88
* @copyright Copyright (c) 2012 - 2019 ApPHP Framework
99
* @license http://www.apphpframework.com/license/
10-
*/
10+
*/
1111

1212
// change the following paths if necessary
1313
defined('APPHP_PATH') || define('APPHP_PATH', dirname(__FILE__));
@@ -17,8 +17,8 @@
1717
defined('APPHP_MODE') or define('APPHP_MODE', 'debug');
1818

1919

20-
$apphp = dirname(__FILE__).'/../../framework/Apphp.php';
21-
$config = APPHP_PATH.'/protected/config/';
20+
$apphp = dirname(__FILE__) . '/../../framework/Apphp.php';
21+
$config = APPHP_PATH . '/protected/config/';
2222

2323
require_once($apphp);
2424
A::init($config)->run();

demos/login-system/protected/components/Bootstrap.php

+27-27
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Bootstrap - bootstrap component class for application
44
*
5-
* PUBLIC: PRIVATE:
5+
* PUBLIC: PRIVATE:
66
* ----------- ------------------
77
* __construct
88
* init (static)
@@ -16,53 +16,53 @@
1616

1717
class Bootstrap extends CComponent
1818
{
19-
20-
private $_settings;
21-
19+
20+
private $_settings;
21+
2222
/**
2323
* Class default constructor
2424
*/
2525
function __construct()
2626
{
27-
A::app()->attachEventHandler('_onBeginRequest', array($this, 'setTimeZone'));
28-
A::app()->attachEventHandler('_onBeginRequest', array($this, 'setSslMode'));
27+
A::app()->attachEventHandler('_onBeginRequest', array($this, 'setTimeZone'));
28+
A::app()->attachEventHandler('_onBeginRequest', array($this, 'setSslMode'));
2929
A::app()->attachEventHandler('_onBeginRequest', array($this, 'setCron'));
3030

3131
A::app()->attachEventHandler('_onEndRequest', array($this, 'setLastVisitedPage'));
3232
}
33-
33+
3434
/**
35-
* Returns the instance of object
36-
* @return current class
37-
*/
35+
* Returns the instance of object
36+
* @return current class
37+
*/
3838
public static function init()
3939
{
4040
return parent::init(__CLASS__);
4141
}
42-
42+
4343
/**
4444
* Sets timezone according to database settings
45-
*/
45+
*/
4646
public function setTimeZone()
4747
{
4848
}
49-
49+
5050
/**
5151
* Sets (forces) ssl mode (if requred)
52-
*/
52+
*/
5353
public function setSslMode()
5454
{
55-
$sslEnabled = false;
56-
57-
if($sslEnabled && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off')){
58-
header('location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
59-
exit;
60-
}
61-
}
55+
$sslEnabled = false;
56+
57+
if ($sslEnabled && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off')) {
58+
header('location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
59+
exit;
60+
}
61+
}
6262

6363
/**
6464
* Sets cron job
65-
*/
65+
*/
6666
public function setCron()
6767
{
6868
// Un-comment if 'non-batch' cron job type is used
@@ -72,17 +72,17 @@ public function setCron()
7272

7373
/**
7474
* Sets last visited page
75-
*/
75+
*/
7676
public function setLastVisitedPage()
7777
{
7878
}
7979

80-
/**
80+
/**
8181
* Returns site settings
8282
* Helps to prevent multiple call of Settings::model()->findByPk(1);
83-
*/
83+
*/
8484
public function getSettings($param = '')
8585
{
86-
}
87-
86+
}
87+
8888
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
return array(
3+
// database settings
4+
'db' => array(
5+
'driver' => 'mysql',
6+
'host' => 'localhost',
7+
'database' => 'test',
8+
'username' => 'root',
9+
'password' => '',
10+
'prefix' => 'blg_',
11+
)
12+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<?php
2+
3+
return array(
4+
// application data
5+
'name' => 'Login System',
6+
'version' => '1.0.2',
7+
8+
// installation settings
9+
'installationKey' => 'ceqwrvu9jn',
10+
11+
// Password keys settings (for database passwords only)
12+
// Remember: changing these settings after installation may lead to unstable work of application
13+
// encryptAlgorithm - md5, sha1 (not recommended), sha256, whirlpool, etc
14+
'password' => array(
15+
'encryption' => true,
16+
'encryptAlgorithm' => 'sha256',
17+
'encryptSalt' => true,
18+
'hashKey' => 'apphp_directy_login_system',
19+
),
20+
21+
// Text encryption settings (for database text fields only)
22+
// Remember: changing these settings after installation may lead to unstable work of application
23+
// Encryption level - PHP or DB
24+
// encryptAlgorithm - PHP: aes-256-cbc DB: AES
25+
'text' => array(
26+
'encryption' => true,
27+
'encryptAlgorithm' => 'aes-256-cbc',
28+
'encryptKey' => 'apphp_directy_cmf',
29+
),
30+
31+
// Default email settings
32+
'email' => array(
33+
'mailer' => 'smtpMailer', /* phpMail | phpMailer | smtpMailer */
34+
'from' => '[email protected]',
35+
'fromName' => '', /* John Smith */
36+
'isHtml' => true,
37+
'smtp' => array(
38+
'auth' => true, /* true or false */
39+
'secure' => 'ssl', /* 'ssl', 'tls' or '' */
40+
'host' => 'smtp.gmail.com',
41+
'port' => '465',
42+
'username' => '',
43+
'password' => '',
44+
),
45+
),
46+
47+
// Validations
48+
// Define array of 'excluded' controllers, ex.: array('PaymentProviders', 'Checkout')
49+
// Token type: 'session', 'cookie' or 'multipages'
50+
'validation' => array(
51+
'csrf' => array('enable' => false, 'exclude' => array('PaymentProviders'), 'tokenType' => 'session'),
52+
'bruteforce' => array('enable' => true, 'badLogins' => 5, 'badRestores' => 5, 'redirectDelay' => 3)
53+
),
54+
55+
// Exception handling
56+
// Define exceptions exceptions in application
57+
'exceptionHandling' => array(
58+
'enable' => true,
59+
'level' => 'global'
60+
),
61+
62+
// Output compression
63+
'compression' => array(
64+
'gzip' => array('enable' => false),
65+
'html' => array('enable' => false),
66+
'css' => array('enable' => false, 'path' => 'assets/minified/css/', 'minify' => true),
67+
'js' => array('enable' => false, 'path' => 'assets/minified/js/', 'minify' => true),
68+
),
69+
70+
// Session settings
71+
'session' => array(
72+
'customStorage' => false, /* true value means use a custom storage (database), false - standard storage */
73+
'cacheLimiter' => '', /* to prevent 'Web Page expired' message for POST request use "private,must-revalidate" */
74+
'lifetime' => 24, /* session timeout in minutes, default: 24 min = 1440 sec */
75+
),
76+
77+
// Cookies settings
78+
'cookies' => array(
79+
'domain' => '',
80+
'path' => '/'
81+
),
82+
83+
// Cache settings
84+
'cache' => array(
85+
'enable' => false,
86+
'type' => 'auto', /* 'auto' or 'manual' */
87+
'lifetime' => 20, /* in minutes */
88+
'path' => 'protected/tmp/cache/'
89+
),
90+
91+
// Logger settings
92+
'log' => array(
93+
'enable' => false,
94+
'path' => 'protected/tmp/logs/',
95+
'fileExtension' => 'php',
96+
'dateFormat' => 'Y-m-d H:i:s',
97+
'threshold' => 1,
98+
'filePermissions' => 0644,
99+
'lifetime' => 30 /* in days */
100+
),
101+
102+
// RSS Feed settings
103+
'rss' => array(
104+
'path' => 'feeds/'
105+
),
106+
107+
// Datetime settings
108+
'defaultTimeZone' => 'UTC',
109+
110+
// Template default settings
111+
'template' => array(
112+
'default' => 'default'
113+
),
114+
115+
// Layout default settings
116+
'layouts' => array(
117+
'enable' => false,
118+
'default' => 'default'
119+
),
120+
121+
// Layout default settings
122+
'layouts' => array(
123+
'enable' => array('frontend' => false, 'backend' => false),
124+
'default' => 'default'
125+
),
126+
127+
// Application default settings
128+
'defaultBackendDirectory' => 'backoffice', /* default backoffice directory */
129+
'defaultErrorController' => 'Error', /* may be overridden by module settings */
130+
'defaultController' => 'Index', /* may be overridden by module settings */
131+
'defaultAction' => 'index', /* may be overridden by module settings */
132+
133+
// Application Backend settings
134+
'restoreAdminPassword' => array(
135+
'enable' => true,
136+
'recoveryType' => 'direct' /* 'direct' - send new password directly, 'recovery' - send link to recovery page */
137+
),
138+
139+
// Application components
140+
'components' => array(
141+
'Bootstrap' => array('enable' => true, 'class' => 'Bootstrap'),
142+
),
143+
144+
// Widget settings
145+
'widgets' => array(
146+
'paramKeysSensitive' => true
147+
),
148+
149+
// Application helpers
150+
'helpers' => array(
151+
//'helper' => array('enable' => true, 'class' => 'Helper'),
152+
),
153+
154+
// Application modules
155+
'modules' => array(
156+
'setup' => array('enable' => true, 'removable' => false, 'backendDefaultUrl' => ''),
157+
),
158+
159+
// Url manager
160+
'urlManager' => array(
161+
'urlFormat' => 'shortPath', /* get | path | shortPath */
162+
'rules' => array(
163+
// Required by payments module. If you remove these rules - make sure you define full path URL for pyment providers
164+
//'paymentProviders/handlePayment/provider/([a-zA-Z0-9\_]+)/handler/([a-zA-Z0-9\_]+)/module/([a-zA-Z0-9\_]+)[\/]?$' => 'paymentProviders/handlePayment/provider/{$0}/handler/{$1}/module/{$2}',
165+
'paymentProviders/handlePayment/([a-zA-Z0-9\_]+)/([a-zA-Z0-9\_]+)/([a-zA-Z0-9\_]+)[\/]?$' => 'paymentProviders/handlePayment/provider/{$0}/handler/{$1}/module/{$2}',
166+
//'paymentProviders/handlePayment/provider/([a-zA-Z0-9\_]+)/handler/([a-zA-Z0-9\_]+)[\/]?$' => 'paymentProviders/handlePayment/provider/{$0}/handler/{$1}',
167+
'paymentProviders/handlePayment/([a-zA-Z0-9\_]+)/([a-zA-Z0-9\_]+)[\/]?$' => 'paymentProviders/handlePayment/provider/{$0}/handler/{$1}',
168+
//'paymentProviders/handlePayment/provider/([a-zA-Z0-9\_]+)[\/]?$' => 'paymentProviders/handlePayment/provider/{$0}',
169+
'paymentProviders/handlePayment/([a-zA-Z0-9\_]+)[\/]?$' => 'paymentProviders/handlePayment/provider/{$0}',
170+
// Required by dynamic pages, if you want to use user-friendly URLs
171+
//'controller/action/value1/value2' => 'controllerName/action/param1/value1/param2/value2',
172+
//'sitepages/show/example-page-1' => 'sitePages/show/name/about-us',
173+
//'value1' => 'controllerName/action/param1/value1',
174+
//'about-us' => 'sitePages/show/name/about-us',
175+
),
176+
),
177+
178+
);

0 commit comments

Comments
 (0)