public function __construct() { parent::__construct(); plug_config('labels'); plug_helper('view'); plug_library('db'); plug_model('meta'); }
public function __construct() { $instance =& get_instance(); plug_config('db'); $this->link = new mysqli($instance->config['db']['hostname'], $instance->config['db']['username'], $instance->config['db']['password'], $instance->config['db']['database']); $this->database = $instance->config['db']['database']; $this->executed_queries = []; }
<?php session_start(); plug_config('auth_actors'); plug_helper('view'); if (in_array($this->segments['actor'], $this->config['auth_actors']) && $this->segments['target'] !== 'auth' && !isset($_SESSION['auth'][$this->segments['actor']])) { redirect('auth'); }
<?php if (preg_match('#^' . dirname($_SERVER['SCRIPT_NAME']) . '/index#', $_SERVER['REQUEST_URI']) !== 0) { echo 'URI must not begin with index.'; exit(1); } require_once BASEPATH . plug([$packages, ['common.php']]); require_once BASEPATH . plug([$packages, ['plug.php']]); plug_config('wild_targets'); plug_config('segments'); $instance =& get_instance(); foreach ($instance->config['wild_targets'] as $array) { foreach ($array as $value) { $instance->config['segments']['target'][] = $value; } } $instance->segments = path_to_segments($_SERVER['PATH_INFO']); $plugged = plug_controller($instance->segments['target']); $class = preg_replace('/.php$/', '', basename($plugged)); $instance = new $class(); call_user_func_array([$instance, $instance->segments['action']], $instance->segments['args']);
/** * フィールドの取得 */ protected function get_fields($suite) { $target = is_array($suite) ? $suite['target'] : $suite; $segments = $this->segments; if (isset($suite['bt_field']) && $suite['bt_field'] !== NULL) { $segments['action'] = 'index'; } if (in_array($segments['action'], ['json_index', 'rendered_index'])) { $segments['action'] = 'index'; } plug_config('fields', $segments); $fields = []; if ($this->config['fields']['allow'] !== []) { foreach ($this->config['fields']['allow'] as $as) { list($target, $field) = explode('-', $as); $fields = array_merge($fields, $this->meta_model->get_bt_fields($target, $field)); $fields[$as] = ['target' => $target, 'field' => $field]; } return $fields; } foreach (array_keys($this->meta_model->fields[$target]) as $field) { if (in_array("{$target}-{$field}", $this->config['fields']['deny'])) { continue; } if (isset($suite['bt_field']) && $field === $suite['bt_field']) { continue; } $fields = array_merge($fields, $this->meta_model->get_bt_fields($target, $field)); $fields["{$target}-{$field}"] = ['target' => $target, 'field' => $field]; } return $fields; }