JSlip  1.0
index.php
Go to the documentation of this file.
1 <?php
8 require_once('config.php');
9 require_once('local.php');
10 
11 class Init
12 {
13  public $sts = 'NG';
14  public $func = FUNC;
15  public $param = [];
16 
17  public function getFunc() {
18 
19  if (empty($this->param['func'])) {
20  $func = DEF_FUNC;
21  } else {
22  if (in_array($this->param['func'], $this->func)) {
23  $func = $this->param['func'];
24  } else {
25  $func = DEF_FUNC;
26  }
27  }
28 
29  return $func;
30  }
31 
32  function __construct($root, $get, $post) {
33 
34  switch (TARGET) {
35  case 'dev':
36  case 'staging':
37  case 'product':
38  $this->sts = 'OK';
39  break;
40  default:
41  $this->sts = 'NG_TARGET';
42  break;
43  }
44 
45  if (!empty($get)) {
46  $this->param = $get;
47  }
48 
49  if (!empty($post)) {
50  if (empty($this->param)) {
51  $this->param = $post;
52  } else {
53  foreach ($post as $k => $d) {
54  $this->param[$k] = $d;
55  }
56  }
57  }
58 
59  $this->param['root'] = $root;
60  $this->param['url_base'] = URL_BASE;
61  $this->param['tmp_dir'] = $root . '/tmp/' . TMP_DIR;
62  }
63 }
DEF_FUNC
const DEF_FUNC
Definition: local.php:17
FUNC
const FUNC
Definition: config.php:8
Init\$param
$param
Definition: index.php:15
Init\$sts
$sts
Definition: index.php:13
Init
Definition: index.php:11
URL_BASE
const URL_BASE
Definition: local.php:18
Init\$func
$func
Definition: index.php:14
TARGET
const TARGET
Definition: local.php:8
Init\__construct
__construct($root, $get, $post)
Definition: index.php:32
$root
$root
Definition: index.php:10
TMP_DIR
const TMP_DIR
Definition: local.php:9
Init\getFunc
getFunc()
Definition: index.php:17