diff --git a/application/config/autoload.php b/application/config/autoload.php index 5c7947faf..8ad1ddce9 100755 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -99,7 +99,7 @@ $autoload['helper'] = array('url'); | config files. Otherwise, leave it blank. | */ -$autoload['config'] = array(); +$autoload['config'] = array('fhcomplete'); /* | ------------------------------------------------------------------- diff --git a/application/config/config.php b/application/config/config.php index d1badd04e..cfc8f0c6f 100755 --- a/application/config/config.php +++ b/application/config/config.php @@ -29,7 +29,7 @@ $config['base_url'] = 'http://localhost/fhcomplete/'; | variable so that it is blank. | */ -$config['index_page'] = 'index.php'; +$config['index_page'] = 'index.ci.php'; /* |-------------------------------------------------------------------------- diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php new file mode 100644 index 000000000..44984a952 --- /dev/null +++ b/application/config/fhcomplete.php @@ -0,0 +1,8 @@ +input->is_cli_request()) + { + $cli=true; + } + else + { + //$this->output->set_status_header(403, 'Migrations must be run from the CLI'); + //exit; + } + + // can only be run in the development environment + if (ENVIRONMENT !== 'development') { + exit('Wowsers! You don\'t want to do that!'); + } + $this->load->database('system'); //Use the system-Connection for DB-Manipulation + $this->load->library('migration'); + + // If not set, set it + //$this->_seed_path !== '' OR $this->_seed_path = APPPATH.'seeds/'; + // Add trailing slash if not set + //$this->_seed_path = rtrim($this->_seed_path, '/').'/'; + + // Load seed language + $this->lang->load('seed'); + + // initiate faker + $this->faker = Faker\Factory::create(); + + // load any required models + //$this->load->model('person/Person_model'); + + log_message('info', 'DB-Tools Controller Initialized'); + } + + public function index() + { + $result = "The following are the available command line interface commands\n\n"; + $result .= "php index.ci.php DBTools migrate [\"version_number\"] Run all migrations. The version number is optional.\n"; + $result .= "php index.ci.php DBTools seed \"file_name\" Run the specified seed file.\n"; + + echo $result . PHP_EOL; + } + + /** + * Migrate to latest or current version + * + * @param string $version One of either "latest" or "current" + */ + public function migrate($version = 'latest') + { + + if ($this->cli && $this->migration->current() === FALSE) + { + show_error($this->migration->error_string()); + } + elseif ($version != 'latest' && $version != 'current') + { + $this->_failed('Migration version must be either latest or current'); + } + + if (!$this->migration->$version()) + { + $this->_failed(); + } + + $this->_succeeded(); + } + + + /** + * Migrate to a specific version + */ + public function version() + { + if ($version == 'latest' || $version == 'current') + { + $this->index($version); + exit; + } + + if (!$this->migrate->version($version)) + { + $this->_failed(); + } + + $this->_succeeded(); + } + + /** + * Roll-back to the last version before current + * + * @param int $version The migration to rollback to, defaults to previous + */ + public function rollback($version = null) + { + if (is_null($version)) + { + $version = $this->_get_version() ?: 1; + $version--; + } + + // Check it's definitely false, we could be rolling back to v0 + if (false === $this->migration->version($version)) + { + $this->_failed(); + } + + $this->_succeeded('rolled back'); + } + + /** + * ROLLBACK ALL THE THINGS! + */ + public function uninstall() + { + $this->rollback(0); + } + + /** + * Seeds DB with Testdata + * + * @param string $name + * @return bool + */ + function seed($name = null) + { + $seeds = $this->find_seeds(); + + if (empty($seeds)) + { + $this->_error_string = $this->lang->line('seed_none_found'); + return FALSE; + } + + $method = 'seed'; + $pending = array(); + foreach ($seeds as $number => $file) + { + include_once($file); + $class = 'Seed_'.ucfirst(strtolower($this->_get_seed_name(basename($file, '.php')))); + + // Validate the seed file structure + if ( ! class_exists($class, FALSE)) + { + $this->_error_string = sprintf($this->lang->line('seed_class_doesnt_exist'), $class); + return FALSE; + } + // method_exists() returns true for non-public methods, + // while is_callable() can't be used without instantiating. + // Only get_class_methods() satisfies both conditions. + elseif ( ! in_array($method, array_map('strtolower', get_class_methods($class)))) + { + $this->_error_string = sprintf($this->lang->line('seed_missing_'.$method.'_method'), $class); + return FALSE; + } + + $pending[$number] = array($class, $method); + } + // Now just run the necessary seeds + foreach ($pending as $number => $seed) + { + log_message('debug', 'Seeding '.$method); + + $seed[0] = new $seed[0]; + call_user_func($seed); + } + } + + /** + * Retrieves list of available seed files + * + * @return array list of seed file paths sorted by version + */ + public function find_seeds() + { + $seeds = array(); + + // Load all *_*.php files in the seeds path + foreach (glob($this->_seed_path.'*_*.php') as $file) + { + $name = basename($file, '.php'); + + // Filter out non-seed files + if (preg_match($this->_seed_regex, $name)) + { + $number = $this->_get_seed_number($name); + + // There cannot be duplicate seed numbers + if (isset($seeds[$number])) + { + $this->_error_string = sprintf($this->lang->line('seed_multiple_version'), $number); + show_error($this->_error_string); + } + + $seeds[$number] = $file; + } + } + + ksort($seeds); + return $seeds; + } + + /** + * Extracts the seed number from a filename + * + * @param string $seed + * @return string Numeric portion of a seed filename + */ + protected function _get_seed_number($seed) + { + return sscanf($seed, '%[0-9]+', $number) + ? $number : '0'; + } + /** + * Extracts the seed class name from a filename + * + * @param string $seed + * @return string text portion of a migration filename + */ + protected function _get_seed_name($seed) + { + $parts = explode('_', $seed); + array_shift($parts); + return implode('_', $parts); + } + + /** + * Yay, it worked! Tell the user. + * + * @param string $task What did we just do? We... + */ + private function _succeeded($task = 'migrated') + { + $version = $this->_get_version(); + exit('Successfully '.$task.' to version '.$version); + } + + /** + * Output an error message when it all goes tits up + * + * @param string $message Error to output (default to CI's migration error) + */ + private function _failed($message = null) + { + $message = $message ?: $this->migration->error_string(); + show_error($message); + } + + /** + * Carbon copy of parent::_get_version, but that's protected. + * + * @return int Currently installed migration number + */ + private function _get_version() + { + $row = $this->db->get('ci_migrations')->row(); + return $row ? $row->version : 0; + } +} diff --git a/application/controllers/Examples.php b/application/controllers/Examples.php index da0d6353c..d0da020dd 100644 --- a/application/controllers/Examples.php +++ b/application/controllers/Examples.php @@ -73,12 +73,12 @@ class Examples extends CI_Controller { $crud = new grocery_CRUD(); $crud->set_table('customers'); - $crud->columns('customerName','contactLastName','phone','city','country','salesRepEmployeeNumber','creditLimit'); - $crud->display_as('salesRepEmployeeNumber','from Employeer') - ->display_as('customerName','Name') - ->display_as('contactLastName','Last Name'); + $crud->columns('customername','contactlastname','phone','city','country','salesrepemployeenumber','creditlimit'); + $crud->display_as('salesrepemployeenumber','from Employeer') + ->display_as('customername','Name') + ->display_as('contactlastname','Last Name'); $crud->set_subject('Customer'); - $crud->set_relation('salesRepEmployeeNumber','employees','lastName'); + $crud->set_relation('salesrepemployeenumber','employees','lastname'); $output = $crud->render(); @@ -245,4 +245,4 @@ class Examples extends CI_Controller { } } -} \ No newline at end of file +} diff --git a/application/controllers/Migrate.php b/application/controllers/Migrate.php index 6fae01260..fb7021fec 100644 --- a/application/controllers/Migrate.php +++ b/application/controllers/Migrate.php @@ -1,6 +1,6 @@ load->database('system'); //Use the system-Connection for DB-Manipulation $this->load->library('migration'); + $this->load->library('FHC_Seed'); } + + public function help() { + $result = "The following are the available command line interface commands\n\n"; + $result .= "php index.ci.php db migrate [\"version_number\"] Run all migrations. The version number is optional.\n"; + $result .= "php index.ci.php db seed \"file_name\" Run the specified seed file. Filename is optional.\n"; + + echo $result . PHP_EOL; + } + /** * Migrate to latest or current version * * @param string $version One of either "latest" or "current" */ - public function index($version = 'latest') + public function migrate($version = 'latest') { if ($this->cli && $this->migration->current() === FALSE) @@ -39,7 +49,7 @@ class Migrate extends CI_Controller $this->_failed('Migration version must be either latest or current'); } - if (!$this->migration->$version()) + if (!$this->migration->version()) { $this->_failed(); } @@ -97,6 +107,17 @@ class Migrate extends CI_Controller $this->rollback(0); } + /** + * Seed DB with TestData + * + * @param string $name Name of the SeedFile + */ + + public function seed($name = null) + { + $this->fhc_seed->seed($name); + } + /** * Yay, it worked! Tell the user. * diff --git a/application/controllers/Vilesci.php b/application/controllers/Vilesci.php index e6253c3ba..532b7d629 100755 --- a/application/controllers/Vilesci.php +++ b/application/controllers/Vilesci.php @@ -20,7 +20,7 @@ class Vilesci extends CI_Controller { */ public function index() { - if ($this->dbupdate()) + if (false)//$this->dbupdate()) echo 'System-DB needs update!'; else { diff --git a/application/controllers/api/v1/Person.php b/application/controllers/api/v1/Person.php index 46167d97a..df561f923 100644 --- a/application/controllers/api/v1/Person.php +++ b/application/controllers/api/v1/Person.php @@ -22,7 +22,7 @@ class Person extends REST_Controller /** * Person API constructor. */ - private function __construct() + public function __construct() { parent::__construct(); diff --git a/application/controllers/message/Message.php b/application/controllers/message/Message.php new file mode 100755 index 000000000..3f0f00721 --- /dev/null +++ b/application/controllers/message/Message.php @@ -0,0 +1,22 @@ +load->library('Messaging'); + $this->load->model('message/Message_model'); + $this->load->model('person/Person_model'); + } + + public function index() + { + $person=$this->Person_model->getPersonFromBenutzerUID('pam'); + $msg_id=1; + $msg = $this->Message_model->getMessage($msg_id, $person[0]->person_id); + //$this->load->view('welcome_message'); + //$msg = $this->Message_model->send_new_message(1, $msg_id, 'test', 'This is a test!', 1); + } +} diff --git a/application/controllers/organisation/Studiengang.php b/application/controllers/organisation/Studiengang.php deleted file mode 100644 index e4a4765c0..000000000 --- a/application/controllers/organisation/Studiengang.php +++ /dev/null @@ -1,167 +0,0 @@ -load->model('studiengang_model'); - $this->load->library('form_validation'); - } - - public function index() - { - $keyword = ''; - $this->load->library('pagination'); - - $config['base_url'] = base_url() . 'studiengang/index/'; - $config['total_rows'] = $this->studiengang_model->total_rows(); - $config['per_page'] = 10; - $config['uri_segment'] = 3; - $config['suffix'] = '.html'; - $config['first_url'] = base_url() . 'studiengang.html'; - $this->pagination->initialize($config); - - $start = $this->uri->segment(3, 0); - $studiengang = $this->studiengang_model->index_limit($config['per_page'], $start); - - $data = array( - 'studiengang_data' => $studiengang, - 'keyword' => $keyword, - 'pagination' => $this->pagination->create_links(), - 'total_rows' => $config['total_rows'], - 'start' => $start, - ); - - $this->load->view('tbl_studiengang_list', $data); - } - - public function search() - { - $keyword = $this->uri->segment(3, $this->input->post('keyword', TRUE)); - $this->load->library('pagination'); - - if ($this->uri->segment(2)=='search') { - $config['base_url'] = base_url() . 'studiengang/search/' . $keyword; - } else { - $config['base_url'] = base_url() . 'studiengang/index/'; - } - - $config['total_rows'] = $this->studiengang_model->search_total_rows($keyword); - $config['per_page'] = 10; - $config['uri_segment'] = 4; - $config['suffix'] = '.html'; - $config['first_url'] = base_url() . 'studiengang/search/'.$keyword.'.html'; - $this->pagination->initialize($config); - - $start = $this->uri->segment(4, 0); - $studiengang = $this->studiengang_model->search_index_limit($config['per_page'], $start, $keyword); - - $data = array( - 'studiengang_data' => $studiengang, - 'keyword' => $keyword, - 'pagination' => $this->pagination->create_links(), - 'total_rows' => $config['total_rows'], - 'start' => $start, - ); - $this->load->view('tbl_studiengang_list', $data); - } - - public function read($id) - { - $row = $this->studiengang_model->get_by_id($id); - if ($row) { - $data = array( - ); - $this->load->view('tbl_studiengang_read', $data); - } else { - $this->session->set_flashdata('message', 'Record Not Found'); - redirect(site_url('studiengang')); - } - } - - public function create() - { - $data = array( - 'button' => 'Create', - 'action' => site_url('studiengang/create_action'), - ); - $this->load->view('tbl_studiengang_form', $data); - } - - public function create_action() - { - $this->_rules(); - - if ($this->form_validation->run() == FALSE) { - $this->create(); - } else { - $data = array( - ); - - $this->studiengang_model->insert($data); - $this->session->set_flashdata('message', 'Create Record Success'); - redirect(site_url('studiengang')); - } - } - - public function update($id) - { - $row = $this->studiengang_model->get_by_id($id); - - if ($row) { - $data = array( - 'button' => 'Update', - 'action' => site_url('studiengang/update_action'), - ); - $this->load->view('tbl_studiengang_form', $data); - } else { - $this->session->set_flashdata('message', 'Record Not Found'); - redirect(site_url('studiengang')); - } - } - - public function update_action() - { - $this->_rules(); - - if ($this->form_validation->run() == FALSE) { - $this->update($this->input->post('', TRUE)); - } else { - $data = array( - ); - - $this->studiengang_model->update($this->input->post('', TRUE), $data); - $this->session->set_flashdata('message', 'Update Record Success'); - redirect(site_url('studiengang')); - } - } - - public function delete($id) - { - $row = $this->studiengang_model->get_by_id($id); - - if ($row) { - $this->studiengang_model->delete($id); - $this->session->set_flashdata('message', 'Delete Record Success'); - redirect(site_url('studiengang')); - } else { - $this->session->set_flashdata('message', 'Record Not Found'); - redirect(site_url('studiengang')); - } - } - - public function _rules() - { - - $this->form_validation->set_rules('', '', 'trim'); - $this->form_validation->set_error_delimiters('', ''); - } - -}; - -/* End of file Studiengang.php */ -/* Location: ./application/controllers/Studiengang.php */ \ No newline at end of file diff --git a/application/core/FHC_Controller.php b/application/core/FHC_Controller.php index e3cd69152..5810f6168 100644 --- a/application/core/FHC_Controller.php +++ b/application/core/FHC_Controller.php @@ -6,6 +6,19 @@ class FHC_Controller extends CI_Controller function __construct() { parent::__construct(); + //$this->load->helper('language'); } } +require_once APPPATH . '/libraries/REST_Controller.php'; + +class API_Controller extends REST_Controller +{ + function __construct() + { + parent::__construct(); + //$this->load->library('session'); -> autoload + //$this->load->library('database'); -> autoload + } + +} diff --git a/application/core/FHC_Model.php b/application/core/FHC_Model.php index f64abf466..80cfb2a0b 100644 --- a/application/core/FHC_Model.php +++ b/application/core/FHC_Model.php @@ -6,15 +6,52 @@ class FHC_Model extends CI_Model function __construct() { parent::__construct(); + $this->load->helper('language'); + $this->lang->load('fhcomplete'); + } + + /** --------------------------------------------------------------- + * Success + * + * @param mixed $retval + * @return array + */ + protected function _success($retval = '', $message = FHC_SUCCESS) + { + return array( + 'err' => 0, + 'code' => FHC_SUCCESS, + 'msg' => lang('fhc_' . $message), + 'retval' => $retval + ); + } + + /** --------------------------------------------------------------- + * General Error + * + * @return array + */ + protected function _general_error() + { + return array( + 'err' => 1, + 'code' => FHC_ERR_GENERAL, + 'msg' => lang('fhc_'.FHC_ERR_GENERAL) + ); } } class DB_Model extends FHC_Model { + + protected $dbTable=null; // Name of the DB-Table for CI-Insert, -Update, ... + function __construct($uid=null) { parent::__construct(); $this->load->database(); + $this->load->helper('language'); + $this->lang->load('fhc_db'); // UID must be set in Production Mode if (ENVIRONMENT=='production' && is_null($uid)) @@ -25,4 +62,30 @@ class DB_Model extends FHC_Model // Loading Tools for Access Control (Benutzerberechtigungen) $this->load->library('FHC_DB_ACL',array('uid' => $uid)); } + + public function insert($data) + { + if (! is_null($this->dbTable)) + { + $this->db->insert($this->dbTable, $data); + return true; + } + else + return false; + } + + /** --------------------------------------------------------------- + * Invalid ID + * + * @param integer config.php error code numbers + * @return array + */ + protected function _invalid_id($error = '') + { + return array( + 'err' => 1, + 'code' => $error, + 'msg' => lang('fhc_'.$error) + ); + } } diff --git a/application/language/de-AT/fhc_db_lang.php b/application/language/de-AT/fhc_db_lang.php new file mode 100644 index 000000000..463582f53 --- /dev/null +++ b/application/language/de-AT/fhc_db_lang.php @@ -0,0 +1,2 @@ + $val) + { + $this->{'_'.$key} = $val; + } + + log_message('info', 'Seed Class Initialized'); + + // If not set, set it + $this->_seed_path !== '' OR $this->_seed_path = APPPATH.'seeds/'; + + // Add trailing slash if not set + $this->_seed_path = rtrim($this->_seed_path, '/').'/'; + + // Load seed language + $this->lang->load('seed'); + } + + + /** + * Seeds DB with Testdata + * + * @param string $name + * @return bool + */ + function seed($name = null) + { + $seeds = $this->find_seeds(); + + if (empty($seeds)) + { + $this->_error_string = $this->lang->line('seed_none_found'); + return FALSE; + } + + $method = 'seed'; + $pending = array(); + foreach ($seeds as $number => $file) + { + include_once($file); + $class = 'Seed_'.ucfirst(strtolower($this->_get_seed_name(basename($file, '.php')))); + + // Validate the seed file structure + if ( ! class_exists($class, FALSE)) + { + $this->_error_string = sprintf($this->lang->line('seed_class_doesnt_exist'), $class); + return FALSE; + } + // method_exists() returns true for non-public methods, + // while is_callable() can't be used without instantiating. + // Only get_class_methods() satisfies both conditions. + elseif ( ! in_array($method, array_map('strtolower', get_class_methods($class)))) + { + $this->_error_string = sprintf($this->lang->line('seed_missing_'.$method.'_method'), $class); + return FALSE; + } + + $pending[$number] = array($class, $method); + } + // Now just run the necessary seeds + foreach ($pending as $number => $seed) + { + log_message('debug', 'Seeding '.$method); + + $seed[0] = new $seed[0]; + call_user_func($seed); + } + } + + /** + * Retrieves list of available seed files + * + * @return array list of seed file paths sorted by version + */ + public function find_seeds() + { + $seeds = array(); + + // Load all *_*.php files in the seeds path + foreach (glob($this->_seed_path.'*_*.php') as $file) + { + $name = basename($file, '.php'); + + // Filter out non-seed files + if (preg_match($this->_seed_regex, $name)) + { + $number = $this->_get_seed_number($name); + + // There cannot be duplicate seed numbers + if (isset($seeds[$number])) + { + $this->_error_string = sprintf($this->lang->line('seed_multiple_version'), $number); + show_error($this->_error_string); + } + + $seeds[$number] = $file; + } + } + + ksort($seeds); + return $seeds; + } + + /** + * Extracts the seed number from a filename + * + * @param string $seed + * @return string Numeric portion of a seed filename + */ + protected function _get_seed_number($seed) + { + return sscanf($seed, '%[0-9]+', $number) + ? $number : '0'; + } +} diff --git a/application/libraries/Grocery_CRUD.php b/application/libraries/Grocery_CRUD.php index 53df38ed8..9e26a2420 100755 --- a/application/libraries/Grocery_CRUD.php +++ b/application/libraries/Grocery_CRUD.php @@ -16,7 +16,7 @@ * @package grocery CRUD * @copyright Copyright (c) 2010 through 2014, John Skoumbourdis * @license https://github.com/scoumbourdis/grocery-crud/blob/master/license-grocery-crud.txt - * @version 1.5.2 + * @version 1.5.4 * @author John Skoumbourdis */ @@ -468,22 +468,22 @@ class grocery_CRUD_Field_Types * * @package grocery CRUD * @author John Skoumbourdis - * @version 1.5.2 + * @version 1.5.4 * @link http://www.grocerycrud.com/documentation */ class grocery_CRUD_Model_Driver extends grocery_CRUD_Field_Types { /** - * @var grocery_CRUD_Model + * @var Grocery_crud_model */ public $basic_model = null; protected function set_default_Model() { $ci = &get_instance(); - $ci->load->model('grocery_CRUD_Model'); + $ci->load->model('Grocery_crud_model'); - $this->basic_model = new grocery_CRUD_Model(); + $this->basic_model = new Grocery_crud_model(); } protected function get_total_results() @@ -536,7 +536,7 @@ class grocery_CRUD_Model_Driver extends grocery_CRUD_Field_Types public function set_model($model_name) { $ci = &get_instance(); - $ci->load->model('grocery_CRUD_Model'); + $ci->load->model('Grocery_crud_model'); $ci->load->model($model_name); @@ -1383,7 +1383,7 @@ class grocery_CRUD_Model_Driver extends grocery_CRUD_Field_Types header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size'); $allowed_files = $this->config->file_upload_allow_file_types; - + $reg_exp = ''; if(!empty($upload_info->allowed_file_types)){ $reg_exp = '/(\\.|\\/)('.$upload_info->allowed_file_types.')$/i'; @@ -1517,7 +1517,7 @@ class grocery_CRUD_Model_Driver extends grocery_CRUD_Field_Types * * @package grocery CRUD * @author John Skoumbourdis - * @version 1.5.2 + * @version 1.5.4 */ class grocery_CRUD_Layout extends grocery_CRUD_Model_Driver { @@ -1534,6 +1534,8 @@ class grocery_CRUD_Layout extends grocery_CRUD_Model_Driver protected function set_basic_Layout() { + //var_dump($this->theme_path); + //var_dump($this->theme); if(!file_exists($this->theme_path.$this->theme.'/views/list_template.php')) { throw new Exception('The template does not exist. Please check your files and try again.', 12); @@ -2217,8 +2219,18 @@ class grocery_CRUD_Layout extends grocery_CRUD_Model_Driver $value = !is_string($value) ? '' : str_replace('"',""",$value); $extra_attributes = ''; - if(!empty($field_info->db_max_length)) - $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; + if (!empty($field_info->db_max_length)) { + + if (in_array($field_info->type, array("decimal", "float"))) { + $decimal_lentgh = explode(",", $field_info->db_max_length); + $decimal_lentgh = ((int)$decimal_lentgh[0]) + 1; + + $extra_attributes .= "maxlength='" . $decimal_lentgh . "'"; + } else { + $extra_attributes .= "maxlength='{$field_info->db_max_length}'"; + } + + } $input = ""; return $input; } @@ -2967,7 +2979,7 @@ class grocery_CRUD_Layout extends grocery_CRUD_Model_Driver * * @package grocery CRUD * @author John Skoumbourdis - * @version 1.5.2 + * @version 1.5.4 */ class grocery_CRUD_States extends grocery_CRUD_Layout { @@ -3396,7 +3408,7 @@ class grocery_CRUD_States extends grocery_CRUD_Layout * @package grocery CRUD * @copyright Copyright (c) 2010 through 2014, John Skoumbourdis * @license https://github.com/scoumbourdis/grocery-crud/blob/master/license-grocery-crud.txt - * @version 1.5.2 + * @version 1.5.4 * @author John Skoumbourdis */ @@ -3419,7 +3431,7 @@ class Grocery_CRUD extends grocery_CRUD_States * * @var string */ - const VERSION = "1.5.2"; + const VERSION = "1.5.4"; const JQUERY = "jquery-1.11.1.min.js"; const JQUERY_UI_JS = "jquery-ui-1.10.3.custom.min.js"; @@ -3732,10 +3744,10 @@ class Grocery_CRUD extends grocery_CRUD_States return $this; } - + /** * Just an alias to unset_read - * + * * @return void * */ public function unset_view() diff --git a/application/libraries/Messaging.php b/application/libraries/Messaging.php new file mode 100644 index 000000000..677ef2ff0 --- /dev/null +++ b/application/libraries/Messaging.php @@ -0,0 +1,448 @@ +ci =& get_instance(); + $this->ci->load->model('message/message_model'); + $this->ci->load->helper('language'); + $this->ci->lang->load('message'); + } + + // ------------------------------------------------------------------------ + + /** + * get_message() - will return a single message, including the status for specified user. + * + * @param integer $msg_id EQUIRED + * @param integer $user_id REQUIRED + * @return array + */ + function get_message($msg_id, $user_id) + { + if (empty($msg_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID); + } + + if (empty($user_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); + } + + if ($message = $this->ci->message_model->get_message($msg_id, $user_id)) + { + return $this->_success($message); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * get_full_thread() - will return a entire thread, including the status for specified user. + * + * @param integer $thread_id REQUIRED + * @param integer $user_id REQUIRED + * @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant + * @param string $order_by OPTIONAL + * @return array + */ + function get_full_thread($thread_id, $user_id, $full_thread = FALSE, $order_by = 'ASC') + { + if (empty($thread_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID); + } + + if (empty($user_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); + } + + if ($message = $this->ci->message_model->get_full_thread($thread_id, $user_id, $full_thread, $order_by)) + { + return $this->_success($message); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * get_all_threads() - will return all threads for user, including the status for specified user. + * + * @param integer $user_id REQUIRED + * @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant + * @param string $order_by OPTIONAL + * @return array + */ + function get_all_threads($user_id, $full_thread = FALSE, $order_by = 'ASC') + { + if (empty($user_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); + } + + $message = $this->ci->message_model->get_all_threads($user_id, $full_thread, $order_by); + if (is_array($message)) + { + return $this->_success($message); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * get_all_threads_grouped() - will return all threads for user, including the status for specified user. + * - messages are grouped in threads. + * + * @param integer $user_id REQUIRED + * @param boolean $full_thread OPTIONAL - If true, user will also see messages from thread posted BEFORE user became participant + * @param string $order_by OPTIONAL + * @return array + */ + function get_all_threads_grouped($user_id, $full_thread = FALSE, $order_by = 'ASC') + { + if (empty($user_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); + } + + $message = $this->ci->message_model->get_all_threads($user_id, $full_thread, $order_by); + if (is_array($message)) + { + $threads = array(); + + foreach ($message as $msg) + { + if ( ! isset($threads[$msg['thread_id']])) + { + $threads[$msg['thread_id']]['thread_id'] = $msg['thread_id']; + $threads[$msg['thread_id']]['messages'] = array($msg); + } + else + { + $threads[$msg['thread_id']]['messages'][] = $msg; + } + } + + return $this->_success($threads); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * update_message_status() - will change status on message for particular user + * + * @param integer $msg_id REQUIRED + * @param integer $user_id REQUIRED + * @param integer $status_id REQUIRED - should come from config/message.php list of constants + * @return array + */ + function update_message_status($msg_id, $user_id, $status_id ) + { + if (empty($msg_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID); + } + + if (empty($user_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); + } + + if (empty($status_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_STATUS_ID); + } + + if ($this->ci->message_model->update_message_status($msg_id, $user_id, $status_id)) + { + return $this->_success(NULL, MSG_STATUS_UPDATE); + } + + // General Error Occurred + return $this->_general_error(); + + } + + // ------------------------------------------------------------------------ + + /** + * add_participant() - adds user to existing thread + * + * @param integer $thread_id REQUIRED + * @param integer $user_id REQUIRED + * @return array + */ + function add_participant($thread_id, $user_id) + { + if (empty($thread_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID); + } + + if (empty($user_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); + } + + if ( ! $this->ci->message_model->valid_new_participant($thread_id, $user_id)) + { + $this->_participant_error(MSG_ERR_PARTICIPANT_EXISTS); + } + + if ( ! $this->ci->message_model->application_user($user_id)) + { + $this->_participant_error(MSG_ERR_PARTICIPANT_NONSYSTEM); + } + + if ($this->ci->message_model->add_participant($thread_id, $user_id )) + { + return $this->_success(NULL, MSG_PARTICIPANT_ADDED); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * remove_participant() - removes user from existing thread + * + * @param integer $thread_id REQUIRED + * @param integer $user_id REQUIRED + * @return array + */ + function remove_participant($thread_id, $user_id) + { + if (empty($thread_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID); + } + + if (empty($user_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); + } + + if ($this->ci->message_model->remove_participant($thread_id, $user_id)) + { + return $this->_success(NULL, MSG_PARTICIPANT_REMOVED); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * send_new_message() - sends new internal message. This function will create a new thread + * + * @param integer $sender_id REQUIRED + * @param mixed $recipients REQUIRED - a single integer or an array of integers, representing user_ids + * @param string $subject + * @param string $body + * @param integer $priority + * @return array + */ + function send_new_message($sender_id, $recipients, $subject = '', $body = '', $priority = PRIORITY_NORMAL) + { + if (empty($sender_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_SENDER_ID); + } + + if (empty($recipients)) + { + return array( + 'err' => 1, + 'code' => MSG_ERR_INVALID_RECIPIENTS, + 'msg' => lang('mahana_'.MSG_ERR_INVALID_RECIPIENTS) + ); + } + + if ($thread_id = $this->ci->message_model->send_new_message($sender_id, $recipients, $subject, $body, $priority)) + { + return $this->_success($thread_id, MSG_MESSAGE_SENT); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * reply_to_message() - replies to internal message. This function will NOT create a new thread or participant list + * + * @param integer $msg_id REQUIRED + * @param integer $sender_id REQUIRED + * @param string $subject + * @param string $body + * @param integer $priority + * @return array + */ + function reply_to_message($msg_id, $sender_id, $subject = '', $body = '', $priority = PRIORITY_NORMAL) + { + if (empty($sender_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_SENDER_ID); + } + + if (empty($msg_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID); + } + + if ($new_msg_id = $this->ci->message_model->reply_to_message($msg_id, $sender_id, $body, $priority)) + { + return $this->_success($new_msg_id, MSG_MESSAGE_SENT); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * get_participant_list() - returns list of participants on given thread. If sender_id set, sender_id will be left off list + * + * @param integer $thread_id REQUIRED + * @param integer $sender_id REQUIRED + * @return array + */ + function get_participant_list($thread_id, $sender_id = 0) + { + if (empty($thread_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_THREAD_ID); + } + + if ($participants = $this->ci->message_model-> get_participant_list($thread_id, $sender_id)) + { + return $this->_success($participants); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + + /** + * get_msg_count() - returns integer with count of message for user, by status. defaults to new messages + * + * @param integer $user_id REQUIRED + * @param integer $status_id OPTIONAL - defaults to "Unread" + * @return array + */ + function get_msg_count($user_id, $status_id = MSG_STATUS_UNREAD) + { + if (empty($user_id)) + { + return $this->_invalid_id(MSG_ERR_INVALID_USER_ID); + } + + if (is_numeric($message = $this->ci->message_model->get_msg_count($user_id, $status_id))) + { + return $this->_success($message); + } + + // General Error Occurred + return $this->_general_error(); + } + + // ------------------------------------------------------------------------ + // Private Functions from here out! + // ------------------------------------------------------------------------ + + /** + * Success + * + * @param mixed $retval + * @return array + */ + private function _success($retval = '', $message = MSG_SUCCESS) + { + return array( + 'err' => 0, + 'code' => MSG_SUCCESS, + 'msg' => lang('mahana_' . $message), + 'retval' => $retval + ); + } + + // ------------------------------------------------------------------------ + + /** + * Invalid ID + * + * @param integer config.php error code numbers + * @return array + */ + private function _invalid_id($error = '') + { + return array( + 'err' => 1, + 'code' => $error, + 'msg' => lang('mahana_'.$error) + ); + } + + // ------------------------------------------------------------------------ + + /** + * Error Particpant Exists + * + * @return array + */ + private function _participant_error($error = '') + { + return array( + 'err' => 1, + 'code' => 1, + 'msg' => lang('mahana_' . $error) + ); + } + + + // ------------------------------------------------------------------------ + + /** + * General Error + * + * @return array + */ + private function _general_error() + { + return array( + 'err' => 1, + 'code' => MSG_ERR_GENERAL, + 'msg' => lang('mahana_'.MSG_ERR_GENERAL) + ); + } +} diff --git a/application/core/REST_Controller.php b/application/libraries/REST_Controller.php similarity index 100% rename from application/core/REST_Controller.php rename to application/libraries/REST_Controller.php diff --git a/application/libraries/index.html b/application/libraries/index.html index b702fbc39..26a628088 100755 --- a/application/libraries/index.html +++ b/application/libraries/index.html @@ -8,4 +8,4 @@

Directory access is forbidden.

- + \ No newline at end of file diff --git a/application/migrations/20160101010100_init.php b/application/migrations/001_init.php similarity index 100% rename from application/migrations/20160101010100_init.php rename to application/migrations/001_init.php diff --git a/application/migrations/20160101010101_pk_migrations.php b/application/migrations/002_pk_migrations.php similarity index 100% rename from application/migrations/20160101010101_pk_migrations.php rename to application/migrations/002_pk_migrations.php diff --git a/application/migrations/20160101010102_add_apikey.php b/application/migrations/003_add_apikey.php similarity index 85% rename from application/migrations/20160101010102_add_apikey.php rename to application/migrations/003_add_apikey.php index 6edac0c68..6435cb1e3 100644 --- a/application/migrations/20160101010102_add_apikey.php +++ b/application/migrations/003_add_apikey.php @@ -38,9 +38,14 @@ class Migration_Add_apikey extends CI_Migration { $this->dbforge->create_table('ci_apikey'); } - if (!$this->db->simple_query("INSERT INTO ci_apikey (key) VALUES ('aufnahme@fhcomplete.org');")) + if (!$this->db->simple_query('GRANT SELECT ON public.ci_apikey TO vilesci;')) { - echo "Error DB-Insert!"; + echo 'Error GRANT to vilesci!'; + } + + if (!$this->db->simple_query("INSERT INTO ci_apikey (key) VALUES ('testapikey@fhcomplete.org'); INSERT INTO ci_apikey (key) VALUES ('aufnahme@fhcomplete.org');")) + { + echo 'Error DB-Insert!'; } } diff --git a/application/migrations/20160101010103_create_basedb.php b/application/migrations/004_create_basedb.php similarity index 100% rename from application/migrations/20160101010103_create_basedb.php rename to application/migrations/004_create_basedb.php diff --git a/application/migrations/005_fhc30.php b/application/migrations/005_fhc30.php new file mode 100644 index 000000000..7ca2adc2d --- /dev/null +++ b/application/migrations/005_fhc30.php @@ -0,0 +1,30 @@ +load->helper('file'); + require_once(FCPATH.'include/basis_db.class.php'); + $db = new basis_db(); + //$db = $this->db; + //$db->db_query = $this->db->simple_query; + require_once('./system/dbupdate_3.0.php'); + } + + public function down() + { + /*$this->db->simple_query('DROP SCHEMA bis;'); + $this->db->simple_query('DROP SCHEMA campus;'); + $this->db->simple_query('DROP SCHEMA fue;'); + $this->db->simple_query('DROP SCHEMA kommune;'); + $this->db->simple_query('DROP SCHEMA lehre;'); + $this->db->simple_query('DROP SCHEMA sync;'); + $this->db->simple_query('DROP SCHEMA system;'); + $this->db->simple_query('DROP SCHEMA testtool;'); + $this->db->simple_query('DROP SCHEMA wawi;');*/ + } +} + diff --git a/application/migrations/006_fhc31.php b/application/migrations/006_fhc31.php new file mode 100644 index 000000000..881f5a803 --- /dev/null +++ b/application/migrations/006_fhc31.php @@ -0,0 +1,35 @@ +load->database('system'); + if (!$this->db->table_exists('tbl_person')) + { + $this->load->helper('file'); + $sqlfile = read_file('./system/fhcomplete3.0.sql'); + + if (!$this->db->simple_query($sqlfile)) + { + echo "Error creating Basis DB-Schema!"; + } + } + } + + public function down() + { + /*$this->db->simple_query('DROP SCHEMA bis;'); + $this->db->simple_query('DROP SCHEMA campus;'); + $this->db->simple_query('DROP SCHEMA fue;'); + $this->db->simple_query('DROP SCHEMA kommune;'); + $this->db->simple_query('DROP SCHEMA lehre;'); + $this->db->simple_query('DROP SCHEMA sync;'); + $this->db->simple_query('DROP SCHEMA system;'); + $this->db->simple_query('DROP SCHEMA testtool;'); + $this->db->simple_query('DROP SCHEMA wawi;');*/ + } +} + diff --git a/application/migrations/007_fhc32.php b/application/migrations/007_fhc32.php new file mode 100644 index 000000000..a3bb24cee --- /dev/null +++ b/application/migrations/007_fhc32.php @@ -0,0 +1,35 @@ +load->database('system'); + if (!$this->db->table_exists('tbl_person')) + { + $this->load->helper('file'); + $sqlfile = read_file('./system/fhcomplete3.0.sql'); + + if (!$this->db->simple_query($sqlfile)) + { + echo "Error creating Basis DB-Schema!"; + } + } + } + + public function down() + { + /*$this->db->simple_query('DROP SCHEMA bis;'); + $this->db->simple_query('DROP SCHEMA campus;'); + $this->db->simple_query('DROP SCHEMA fue;'); + $this->db->simple_query('DROP SCHEMA kommune;'); + $this->db->simple_query('DROP SCHEMA lehre;'); + $this->db->simple_query('DROP SCHEMA sync;'); + $this->db->simple_query('DROP SCHEMA system;'); + $this->db->simple_query('DROP SCHEMA testtool;'); + $this->db->simple_query('DROP SCHEMA wawi;');*/ + } +} + diff --git a/application/migrations/008_message.php b/application/migrations/008_message.php new file mode 100644 index 000000000..64e94b718 --- /dev/null +++ b/application/migrations/008_message.php @@ -0,0 +1,75 @@ +db->table_exists('msg_messages')) + { + $query= ' + CREATE TABLE msg_messages ( + id serial, + thread_id bigint NOT NULL, + body text NOT NULL, + priority smallint NOT NULL DEFAULT 0, + sender_id bigint NOT NULL, + cdate timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (id) + ); + GRANT SELECT ON TABLE msg_messages TO web; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE msg_messages TO admin; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE msg_messages TO vilesci; + GRANT SELECT, UPDATE ON SEQUENCE msg_messages_id_seq TO web; + GRANT SELECT, UPDATE ON SEQUENCE msg_messages_id_seq TO admin; + GRANT SELECT, UPDATE ON SEQUENCE msg_messages_id_seq TO vilesci; + + CREATE TABLE msg_participants ( + user_id bigint NOT NULL, + thread_id bigint NOT NULL, + cdate timestamp NOT NULL DEFAULT now(), + PRIMARY KEY (user_id,thread_id) + ); + GRANT SELECT ON TABLE msg_participants TO web; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE msg_participants TO admin; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE msg_participants TO vilesci; + + CREATE TABLE msg_status ( + message_id bigint NOT NULL, + user_id bigint NOT NULL, + status smallint NOT NULL, + PRIMARY KEY (message_id,user_id) + ); + GRANT SELECT ON TABLE msg_status TO web; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE msg_status TO admin; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE msg_status TO vilesci; + + CREATE TABLE msg_threads ( + id serial, + subject text, + PRIMARY KEY (id) + ); + GRANT SELECT ON TABLE msg_threads TO web; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE msg_threads TO admin; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE msg_threads TO vilesci; + GRANT SELECT, UPDATE ON SEQUENCE msg_threads_id_seq TO web; + GRANT SELECT, UPDATE ON SEQUENCE msg_threads_id_seq TO admin; + GRANT SELECT, UPDATE ON SEQUENCE msg_threads_id_seq TO vilesci; +'; + if (!$this->db->simple_query($query)) + { + echo "Error creating Basis DB-Schema!"; + } + } + } + + public function down() + { + $this->dbforge->drop_table('msg_messages'); + $this->dbforge->drop_table('msg_participants'); + $this->dbforge->drop_table('msg_status'); + $this->dbforge->drop_table('msg_threads'); + } +} + diff --git a/application/models/grocery_CRUD_model.php b/application/models/grocery_CRUD_model.php deleted file mode 100755 index af811f619..000000000 --- a/application/models/grocery_CRUD_model.php +++ /dev/null @@ -1,582 +0,0 @@ - - */ - -// ------------------------------------------------------------------------ - -/** - * Grocery CRUD Model - * - * - * @package grocery CRUD - * @author John Skoumbourdis - * @version 1.5.2 - * @link http://www.grocerycrud.com/documentation - */ -class grocery_CRUD_Model extends CI_Model { - - protected $primary_key = null; - protected $table_name = null; - protected $relation = array(); - protected $relation_n_n = array(); - protected $primary_keys = array(); - - function __construct() - { - parent::__construct(); - } - - function db_table_exists($table_name = null) - { - return $this->db->table_exists($table_name); - } - - function get_list() - { - if($this->table_name === null) - return false; - - $select = "`{$this->table_name}`.*"; - - //set_relation special queries - if(!empty($this->relation)) - { - foreach($this->relation as $relation) - { - list($field_name , $related_table , $related_field_title) = $relation; - $unique_join_name = $this->_unique_join_name($field_name); - $unique_field_name = $this->_unique_field_name($field_name); - - if(strstr($related_field_title,'{')) - { - $related_field_title = str_replace(" "," ",$related_field_title); - $select .= ", CONCAT('".str_replace(array('{','}'),array("',COALESCE({$unique_join_name}.",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $unique_field_name"; - } - else - { - $select .= ", $unique_join_name.$related_field_title AS $unique_field_name"; - } - - if($this->field_exists($related_field_title)) - $select .= ", `{$this->table_name}`.$related_field_title AS '{$this->table_name}.$related_field_title'"; - } - } - - //set_relation_n_n special queries. We prefer sub queries from a simple join for the relation_n_n as it is faster and more stable on big tables. - if(!empty($this->relation_n_n)) - { - $select = $this->relation_n_n_queries($select); - } - - $this->db->select($select, false); - - $results = $this->db->get($this->table_name)->result(); - - return $results; - } - - public function get_row($table_name = null) - { - $table_name = $table_name === null ? $this->table_name : $table_name; - - return $this->db->get($table_name)->row(); - } - - public function set_primary_key($field_name, $table_name = null) - { - $table_name = $table_name === null ? $this->table_name : $table_name; - - $this->primary_keys[$table_name] = $field_name; - } - - protected function relation_n_n_queries($select) - { - $this_table_primary_key = $this->get_primary_key(); - foreach($this->relation_n_n as $relation_n_n) - { - list($field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table, - $primary_key_alias_to_selection_table, $title_field_selection_table, $priority_field_relation_table) = array_values((array)$relation_n_n); - - $primary_key_selection_table = $this->get_primary_key($selection_table); - - $field = ""; - $use_template = strpos($title_field_selection_table,'{') !== false; - $field_name_hash = $this->_unique_field_name($title_field_selection_table); - if($use_template) - { - $title_field_selection_table = str_replace(" ", " ", $title_field_selection_table); - $field .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$title_field_selection_table))."')"; - } - else - { - $field .= "$selection_table.$title_field_selection_table"; - } - - //Sorry Codeigniter but you cannot help me with the subquery! - $select .= ", (SELECT GROUP_CONCAT(DISTINCT $field) FROM $selection_table " - ."LEFT JOIN $relation_table ON $relation_table.$primary_key_alias_to_selection_table = $selection_table.$primary_key_selection_table " - ."WHERE $relation_table.$primary_key_alias_to_this_table = `{$this->table_name}`.$this_table_primary_key GROUP BY $relation_table.$primary_key_alias_to_this_table) AS $field_name"; - } - - return $select; - } - - function order_by($order_by , $direction) - { - $this->db->order_by( $order_by , $direction ); - } - - function where($key, $value = NULL, $escape = TRUE) - { - $this->db->where( $key, $value, $escape); - } - - function or_where($key, $value = NULL, $escape = TRUE) - { - $this->db->or_where( $key, $value, $escape); - } - - function having($key, $value = NULL, $escape = TRUE) - { - $this->db->having( $key, $value, $escape); - } - - function or_having($key, $value = NULL, $escape = TRUE) - { - $this->db->or_having( $key, $value, $escape); - } - - function like($field, $match = '', $side = 'both') - { - $this->db->like($field, $match, $side); - } - - function or_like($field, $match = '', $side = 'both') - { - $this->db->or_like($field, $match, $side); - } - - function limit($value, $offset = '') - { - $this->db->limit( $value , $offset ); - } - - function get_total_results() - { - //set_relation_n_n special queries. We prefer sub queries from a simple join for the relation_n_n as it is faster and more stable on big tables. - if(!empty($this->relation_n_n)) - { - $select = "{$this->table_name}.*"; - $select = $this->relation_n_n_queries($select); - - $this->db->select($select,false); - } - - return $this->db->get($this->table_name)->num_rows(); - } - - function set_basic_table($table_name = null) - { - if( !($this->db->table_exists($table_name)) ) - return false; - - $this->table_name = $table_name; - - return true; - } - - function get_edit_values($primary_key_value) - { - $primary_key_field = $this->get_primary_key(); - $this->db->where($primary_key_field,$primary_key_value); - $result = $this->db->get($this->table_name)->row(); - return $result; - } - - function join_relation($field_name , $related_table , $related_field_title) - { - $related_primary_key = $this->get_primary_key($related_table); - - if($related_primary_key !== false) - { - $unique_name = $this->_unique_join_name($field_name); - $this->db->join( $related_table.' as '.$unique_name , "$unique_name.$related_primary_key = {$this->table_name}.$field_name",'left'); - - $this->relation[$field_name] = array($field_name , $related_table , $related_field_title); - - return true; - } - - return false; - } - - function set_relation_n_n_field($field_info) - { - $this->relation_n_n[$field_info->field_name] = $field_info; - } - - protected function _unique_join_name($field_name) - { - return 'j'.substr(md5($field_name),0,8); //This j is because is better for a string to begin with a letter and not with a number - } - - protected function _unique_field_name($field_name) - { - return 's'.substr(md5($field_name),0,8); //This s is because is better for a string to begin with a letter and not with a number - } - - function get_relation_array($field_name , $related_table , $related_field_title, $where_clause, $order_by, $limit = null, $search_like = null) - { - $relation_array = array(); - $field_name_hash = $this->_unique_field_name($field_name); - - $related_primary_key = $this->get_primary_key($related_table); - - $select = "$related_table.$related_primary_key, "; - - if(strstr($related_field_title,'{')) - { - $related_field_title = str_replace(" ", " ", $related_field_title); - $select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash"; - } - else - { - $select .= "$related_table.$related_field_title as $field_name_hash"; - } - - $this->db->select($select,false); - if($where_clause !== null) - $this->db->where($where_clause); - - if($where_clause !== null) - $this->db->where($where_clause); - - if($limit !== null) - $this->db->limit($limit); - - if($search_like !== null) - $this->db->having("$field_name_hash LIKE '%".$this->db->escape_like_str($search_like)."%'"); - - $order_by !== null - ? $this->db->order_by($order_by) - : $this->db->order_by($field_name_hash); - - $results = $this->db->get($related_table)->result(); - - foreach($results as $row) - { - $relation_array[$row->$related_primary_key] = $row->$field_name_hash; - } - - return $relation_array; - } - - function get_ajax_relation_array($search, $field_name , $related_table , $related_field_title, $where_clause, $order_by) - { - return $this->get_relation_array($field_name , $related_table , $related_field_title, $where_clause, $order_by, 10 , $search); - } - - function get_relation_total_rows($field_name , $related_table , $related_field_title, $where_clause) - { - if($where_clause !== null) - $this->db->where($where_clause); - - return $this->db->count_all_results($related_table); - } - - function get_relation_n_n_selection_array($primary_key_value, $field_info) - { - $select = ""; - $related_field_title = $field_info->title_field_selection_table; - $use_template = strpos($related_field_title,'{') !== false;; - $field_name_hash = $this->_unique_field_name($related_field_title); - if($use_template) - { - $related_field_title = str_replace(" ", " ", $related_field_title); - $select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash"; - } - else - { - $select .= "$related_field_title as $field_name_hash"; - } - $this->db->select('*, '.$select,false); - - $selection_primary_key = $this->get_primary_key($field_info->selection_table); - - if(empty($field_info->priority_field_relation_table)) - { - if(!$use_template){ - $this->db->order_by("{$field_info->selection_table}.{$field_info->title_field_selection_table}"); - } - } - else - { - $this->db->order_by("{$field_info->relation_table}.{$field_info->priority_field_relation_table}"); - } - $this->db->where($field_info->primary_key_alias_to_this_table, $primary_key_value); - $this->db->join( - $field_info->selection_table, - "{$field_info->relation_table}.{$field_info->primary_key_alias_to_selection_table} = {$field_info->selection_table}.{$selection_primary_key}" - ); - $results = $this->db->get($field_info->relation_table)->result(); - - $results_array = array(); - foreach($results as $row) - { - $results_array[$row->{$field_info->primary_key_alias_to_selection_table}] = $row->{$field_name_hash}; - } - - return $results_array; - } - - function get_relation_n_n_unselected_array($field_info, $selected_values) - { - $use_where_clause = !empty($field_info->where_clause); - - $select = ""; - $related_field_title = $field_info->title_field_selection_table; - $use_template = strpos($related_field_title,'{') !== false; - $field_name_hash = $this->_unique_field_name($related_field_title); - - if($use_template) - { - $related_field_title = str_replace(" ", " ", $related_field_title); - $select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash"; - } - else - { - $select .= "$related_field_title as $field_name_hash"; - } - $this->db->select('*, '.$select,false); - - if($use_where_clause){ - $this->db->where($field_info->where_clause); - } - - $selection_primary_key = $this->get_primary_key($field_info->selection_table); - if(!$use_template) - $this->db->order_by("{$field_info->selection_table}.{$field_info->title_field_selection_table}"); - $results = $this->db->get($field_info->selection_table)->result(); - - $results_array = array(); - foreach($results as $row) - { - if(!isset($selected_values[$row->$selection_primary_key])) - $results_array[$row->$selection_primary_key] = $row->{$field_name_hash}; - } - - return $results_array; - } - - function db_relation_n_n_update($field_info, $post_data ,$main_primary_key) - { - $this->db->where($field_info->primary_key_alias_to_this_table, $main_primary_key); - if(!empty($post_data)) - $this->db->where_not_in($field_info->primary_key_alias_to_selection_table , $post_data); - $this->db->delete($field_info->relation_table); - - $counter = 0; - if(!empty($post_data)) - { - foreach($post_data as $primary_key_value) - { - $where_array = array( - $field_info->primary_key_alias_to_this_table => $main_primary_key, - $field_info->primary_key_alias_to_selection_table => $primary_key_value, - ); - - $this->db->where($where_array); - $count = $this->db->from($field_info->relation_table)->count_all_results(); - - if($count == 0) - { - if(!empty($field_info->priority_field_relation_table)) - $where_array[$field_info->priority_field_relation_table] = $counter; - - $this->db->insert($field_info->relation_table, $where_array); - - }elseif($count >= 1 && !empty($field_info->priority_field_relation_table)) - { - $this->db->update( $field_info->relation_table, array($field_info->priority_field_relation_table => $counter) , $where_array); - } - - $counter++; - } - } - } - - function db_relation_n_n_delete($field_info, $main_primary_key) - { - $this->db->where($field_info->primary_key_alias_to_this_table, $main_primary_key); - $this->db->delete($field_info->relation_table); - } - - function get_field_types_basic_table() - { - $db_field_types = array(); - foreach($this->db->query("SHOW COLUMNS FROM `{$this->table_name}`")->result() as $db_field_type) - { - $type = explode("(",$db_field_type->Type); - $db_type = $type[0]; - - if(isset($type[1])) - { - if(substr($type[1],-1) == ')') - { - $length = substr($type[1],0,-1); - } - else - { - list($length) = explode(" ",$type[1]); - $length = substr($length,0,-1); - } - } - else - { - $length = ''; - } - $db_field_types[$db_field_type->Field]['db_max_length'] = $length; - $db_field_types[$db_field_type->Field]['db_type'] = $db_type; - $db_field_types[$db_field_type->Field]['db_null'] = $db_field_type->Null == 'YES' ? true : false; - $db_field_types[$db_field_type->Field]['db_extra'] = $db_field_type->Extra; - } - - $results = $this->db->field_data($this->table_name); - foreach($results as $num => $row) - { - $row = (array)$row; - $results[$num] = (object)( array_merge($row, $db_field_types[$row['name']]) ); - } - - return $results; - } - - function get_field_types($table_name) - { - $results = $this->db->field_data($table_name); - - return $results; - } - - function db_update($post_array, $primary_key_value) - { - $primary_key_field = $this->get_primary_key(); - return $this->db->update($this->table_name,$post_array, array( $primary_key_field => $primary_key_value)); - } - - function db_insert($post_array) - { - $insert = $this->db->insert($this->table_name,$post_array); - if($insert) - { - return $this->db->insert_id(); - } - return false; - } - - function db_delete($primary_key_value) - { - $primary_key_field = $this->get_primary_key(); - - if($primary_key_field === false) - return false; - - $this->db->limit(1); - $this->db->delete($this->table_name,array( $primary_key_field => $primary_key_value)); - if( $this->db->affected_rows() != 1) - return false; - else - return true; - } - - function db_file_delete($field_name, $filename) - { - if( $this->db->update($this->table_name,array($field_name => ''),array($field_name => $filename)) ) - { - return true; - } - else - { - return false; - } - } - - function field_exists($field,$table_name = null) - { - if(empty($table_name)) - { - $table_name = $this->table_name; - } - return $this->db->field_exists($field,$table_name); - } - - function get_primary_key($table_name = null) - { - if($table_name == null) - { - if(isset($this->primary_keys[$this->table_name])) - { - return $this->primary_keys[$this->table_name]; - } - - if(empty($this->primary_key)) - { - $fields = $this->get_field_types_basic_table(); - - foreach($fields as $field) - { - if($field->primary_key == 1) - { - return $field->name; - } - } - - return false; - } - else - { - return $this->primary_key; - } - } - else - { - if(isset($this->primary_keys[$table_name])) - { - return $this->primary_keys[$table_name]; - } - - $fields = $this->get_field_types($table_name); - - foreach($fields as $field) - { - if($field->primary_key == 1) - { - return $field->name; - } - } - - return false; - } - - } - - function escape_str($value) - { - return $this->db->escape_str($value); - } - -} diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index d280a89dd..43e4068dc 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -3,11 +3,11 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); -class Studiengang_model extends CI_Model +class Studiengang_model extends DB_Model { - public $table = 'tbl_studiengang'; - public $id = ''; + public $table = 'public.tbl_studiengang'; + public $id = 'studiengang_kz'; public $order = 'DESC'; function __construct() @@ -80,4 +80,4 @@ class Studiengang_model extends CI_Model } /* End of file Studiengang_model.php */ -/* Location: ./application/models/Studiengang_model.php */ \ No newline at end of file +/* Location: ./application/models/Studiengang_model.php */ diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 5a01c29e2..2ef43b376 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -4,6 +4,7 @@ class Person_model extends DB_Model public function __construct($uid=null) { parent::__construct($uid); + $this->dbTable='public.tbl_person'; } public function getPerson($person_id = null) @@ -26,4 +27,21 @@ class Person_model extends DB_Model return $query->result_object(); } } + + /** + * Laedt Personendaten eine BenutzerUID + * @param string $uid DB-Attr: tbl_benutzer.uid . + * @return bool + */ + public function getPersonFromBenutzerUID($uid) + { + + if (!$this->fhc_db_acl->bb->isBerechtigt('person','s')) + { + $this->db->select('tbl_person.*'); + $this->db->from('public.tbl_person JOIN public.tbl_benutzer USING (person_id)'); + $query = $this->db->get_where(null, array('uid' => $uid)); + return $query->result_object(); + } + } } diff --git a/ci_hack.php b/ci_hack.php index 410df75c9..c68fe662e 100755 --- a/ci_hack.php +++ b/ci_hack.php @@ -53,7 +53,7 @@ * * NOTE: If you change these, also change the error_reporting() code below */ - define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production'); + define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); /* *--------------------------------------------------------------- * ERROR REPORTING diff --git a/composer.json b/composer.json index 27090b218..66232799a 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,8 @@ }, "require-dev": { - "squizlabs/php_codesniffer": "2.*" + "squizlabs/php_codesniffer": "2.*", + "fzaninotto/faker": "1.*" }, "config": { diff --git a/composer.lock b/composer.lock index fd44a5b7d..32e201574 100755 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b493cb136eac0b78682504c3ecca2e0e", - "content-hash": "49873c248081b898a86919ea22b51e9e", + "hash": "ae2fcd7fb5a2fb8d3e4f0b012e773ba5", + "content-hash": "5754fbc9a9e0e5036cc7bb0460bc8cdd", "packages": [ { "name": "codeigniter-restserver", @@ -20,16 +20,16 @@ }, { "name": "codeigniter/framework", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/bcit-ci/CodeIgniter.git", - "reference": "4aeab69d8519873c0b20b8a51c910a0674a6c84e" + "reference": "8082544c5b4b33175790f505587e202e3ca9e488" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/4aeab69d8519873c0b20b8a51c910a0674a6c84e", - "reference": "4aeab69d8519873c0b20b8a51c910a0674a6c84e", + "url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/8082544c5b4b33175790f505587e202e3ca9e488", + "reference": "8082544c5b4b33175790f505587e202e3ca9e488", "shasum": "" }, "require": { @@ -48,7 +48,7 @@ ], "description": "The CodeIgniter framework", "homepage": "https://codeigniter.com", - "time": "2016-03-11 16:29:31" + "time": "2016-03-21 16:26:30" }, { "name": "components/angular.js", @@ -1080,16 +1080,16 @@ }, { "name": "symfony/console", - "version": "v2.8.3", + "version": "v2.8.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "56cc5caf051189720b8de974e4746090aaa10d44" + "reference": "9a5aef5fc0d4eff86853d44202b02be8d5a20154" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/56cc5caf051189720b8de974e4746090aaa10d44", - "reference": "56cc5caf051189720b8de974e4746090aaa10d44", + "url": "https://api.github.com/repos/symfony/console/zipball/9a5aef5fc0d4eff86853d44202b02be8d5a20154", + "reference": "9a5aef5fc0d4eff86853d44202b02be8d5a20154", "shasum": "" }, "require": { @@ -1136,7 +1136,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-02-28 16:20:50" + "time": "2016-03-17 09:19:04" }, { "name": "symfony/polyfill-mbstring", @@ -1199,16 +1199,16 @@ }, { "name": "symfony/yaml", - "version": "v2.8.3", + "version": "v2.8.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "2a4ee40acb880c56f29fb1b8886e7ffe94f3b995" + "reference": "584e52cb8f788a887553ba82db6caacb1d6260bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/2a4ee40acb880c56f29fb1b8886e7ffe94f3b995", - "reference": "2a4ee40acb880c56f29fb1b8886e7ffe94f3b995", + "url": "https://api.github.com/repos/symfony/yaml/zipball/584e52cb8f788a887553ba82db6caacb1d6260bb", + "reference": "584e52cb8f788a887553ba82db6caacb1d6260bb", "shasum": "" }, "require": { @@ -1244,7 +1244,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-02-23 07:41:20" + "time": "2016-03-04 07:54:35" }, { "name": "twig/twig", @@ -1692,67 +1692,1508 @@ ], "packages-dev": [ { - "name": "ciricihq/cirici-codesniffer", - "version": "3.1.0", + "name": "codeception/codeception", + "version": "2.1.7", "source": { "type": "git", - "url": "https://github.com/ciricihq/cirici-codesniffer.git", - "reference": "051af93dbdbc317d573dd23d2fdadc05f28a6994" + "url": "https://github.com/Codeception/Codeception.git", + "reference": "65971b0dee4972710365b6102154cd412a9bf7b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ciricihq/cirici-codesniffer/zipball/051af93dbdbc317d573dd23d2fdadc05f28a6994", - "reference": "051af93dbdbc317d573dd23d2fdadc05f28a6994", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/65971b0dee4972710365b6102154cd412a9bf7b1", + "reference": "65971b0dee4972710365b6102154cd412a9bf7b1", "shasum": "" }, "require": { - "squizlabs/php_codesniffer": "2.*" + "ext-json": "*", + "ext-mbstring": "*", + "facebook/webdriver": ">=1.0.1 <2.0", + "guzzlehttp/guzzle": ">=4.1.4 <7.0", + "guzzlehttp/psr7": "~1.0", + "php": ">=5.4.0 <8.0", + "phpunit/php-code-coverage": ">=2.1.3", + "phpunit/phpunit": ">4.8.20 <6.0", + "symfony/browser-kit": ">=2.5 <3.1", + "symfony/console": ">=2.5 <3.1", + "symfony/css-selector": ">=2.5 <3.1", + "symfony/dom-crawler": ">=2.5 <3.1", + "symfony/event-dispatcher": ">=2.5 <3.1", + "symfony/finder": ">=2.5 <3.1", + "symfony/yaml": ">=2.5 <3.1" }, "require-dev": { - "phpunit/phpunit": "4.1.*" + "codeception/specify": "~0.3", + "facebook/php-sdk-v4": "~5.0", + "flow/jsonpath": "~0.2", + "monolog/monolog": "~1.8", + "pda/pheanstalk": "~2.0", + "php-amqplib/php-amqplib": "~2.4" }, + "suggest": { + "codeception/phpbuiltinserver": "Extension to start and stop PHP built-in web server for your tests", + "codeception/specify": "BDD-style code blocks", + "codeception/verify": "BDD-style assertions", + "monolog/monolog": "Log test steps", + "phpseclib/phpseclib": "Extension required to use the SFTP option in the FTP Module." + }, + "bin": [ + "codecept" + ], "type": "library", + "extra": { + "branch-alias": [] + }, + "autoload": { + "psr-4": { + "Codeception\\": "src\\Codeception", + "Codeception\\Extension\\": "ext" + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "CakePHP Community", - "homepage": "https://github.com/cakephp/cakephp-codesniffer/graphs/contributors" - }, - { - "name": "Òscar Casajuana", - "homepage": "http://racotecnic.com" - }, - { - "name": "Cirici Thinking Digital", - "homepage": "http://cirici.com" + "name": "Michael Bodnarchuk", + "email": "davert@mail.ua", + "homepage": "http://codegyre.com" } ], - "description": "Cirici CodeSniffer Standards", - "homepage": "http://cirici.com", + "description": "BDD-style testing framework", + "homepage": "http://codeception.com/", "keywords": [ - "codesniffer", - "framework" + "BDD", + "TDD", + "acceptance testing", + "functional testing", + "unit testing" ], - "time": "2015-04-06 20:18:32" + "time": "2016-03-12 01:15:25" }, { - "name": "squizlabs/php_codesniffer", - "version": "2.5.1", + "name": "doctrine/instantiator", + "version": "1.0.5", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "6731851d6aaf1d0d6c58feff1065227b7fda3ba8" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6731851d6aaf1d0d6c58feff1065227b7fda3ba8", - "reference": "6731851d6aaf1d0d6c58feff1065227b7fda3ba8", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "facebook/webdriver", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/facebook/php-webdriver.git", + "reference": "1c98108ba3eb435b681655764de11502a0653705" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/1c98108ba3eb435b681655764de11502a0653705", + "reference": "1c98108ba3eb435b681655764de11502a0653705", + "shasum": "" + }, + "require": { + "php": ">=5.3.19" + }, + "require-dev": { + "phpunit/phpunit": "4.6.*" + }, + "suggest": { + "phpdocumentor/phpdocumentor": "2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "A PHP client for WebDriver", + "homepage": "https://github.com/facebook/php-webdriver", + "keywords": [ + "facebook", + "php", + "selenium", + "webdriver" + ], + "time": "2015-12-31 15:58:49" + }, + { + "name": "fzaninotto/faker", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "d0190b156bcca848d401fb80f31f504f37141c8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d0190b156bcca848d401fb80f31f504f37141c8d", + "reference": "d0190b156bcca848d401fb80f31f504f37141c8d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "suggest": { + "ext-intl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2015-05-29 06:29:14" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "d094e337976dff9d8e2424e8485872194e768662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662", + "reference": "d094e337976dff9d8e2424e8485872194e768662", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "~1.0", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.5.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0", + "psr/log": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-03-21 20:02:09" + }, + { + "name": "guzzlehttp/promises", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bb9024c526b22f3fe6ae55a561fd70653d470aa8", + "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-03-08 01:15:46" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b", + "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-02-18 21:54:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "e3abefcd7f106677fd352cd7c187d6c969aa9ddc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e3abefcd7f106677fd352cd7c187d6c969aa9ddc", + "reference": "e3abefcd7f106677fd352cd7c187d6c969aa9ddc", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2015-11-07 22:20:37" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, + { + "name": "phpspec/prophecy", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972", + "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpspec/phpspec": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2016-02-15 07:46:21" + }, + { + "name": "phpunit/php-code-coverage", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "fe33716763b604ade4cb442c0794f5bd5ad73004" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fe33716763b604ade4cb442c0794f5bd5ad73004", + "reference": "fe33716763b604ade4cb442c0794f5bd5ad73004", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "^1.4.2", + "sebastian/code-unit-reverse-lookup": "~1.0", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0|~2.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~5" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2016-03-03 08:49:08" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2015-06-21 08:01:12" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "5.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "dd3001822b2df8f5add266020e3d2fd3c5db3ae9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/dd3001822b2df8f5add266020e3d2fd3c5db3ae9", + "reference": "dd3001822b2df8f5add266020e3d2fd3c5db3ae9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "^3.3.0", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": ">=1.0.6", + "phpunit/phpunit-mock-objects": "^3.1", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/object-enumerator": "~1.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0|~2.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2016-03-31 21:35:50" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "7c34c9bdde4131b824086457a3145e27dba10ca1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/7c34c9bdde4131b824086457a3145e27dba10ca1", + "reference": "7c34c9bdde4131b824086457a3145e27dba10ca1", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.6", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2016-03-24 05:58:25" + }, + { + "name": "psr/http-message", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2015-05-04 20:22:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2016-02-13 06:45:14" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf", + "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-02-26 18:40:46" + }, + { + "name": "sebastian/exporter", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-06-21 07:55:53" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/object-enumerator", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2016-01-28 13:25:10" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28 20:34:47" + }, + { + "name": "sebastian/version", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-02-04 12:56:52" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "1bcdf03b068a530ac1962ce671dead356eeba43b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1bcdf03b068a530ac1962ce671dead356eeba43b", + "reference": "1bcdf03b068a530ac1962ce671dead356eeba43b", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", "php": ">=5.1.2" @@ -1813,46 +3254,282 @@ "phpcs", "standards" ], - "time": "2016-01-19 23:39:10" + "time": "2016-04-03 22:58:34" }, { - "name": "toin0u/cakephp-codesniffer", - "version": "2.0.3", + "name": "symfony/browser-kit", + "version": "v3.0.4", "source": { "type": "git", - "url": "https://github.com/toin0u/cakephp-codesniffer.git", - "reference": "149af3ec5525151543892221eb2945bb54fa4069" + "url": "https://github.com/symfony/browser-kit.git", + "reference": "e07127ac31230b30887c2dddf3708d883d239b14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/toin0u/cakephp-codesniffer/zipball/149af3ec5525151543892221eb2945bb54fa4069", - "reference": "149af3ec5525151543892221eb2945bb54fa4069", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/e07127ac31230b30887c2dddf3708d883d239b14", + "reference": "e07127ac31230b30887c2dddf3708d883d239b14", "shasum": "" }, "require": { - "squizlabs/php_codesniffer": "2.*" + "php": ">=5.5.9", + "symfony/dom-crawler": "~2.8|~3.0" }, "require-dev": { - "phpunit/phpunit": "4.1.*" + "symfony/css-selector": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "symfony/process": "" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\BrowserKit\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "CakePHP Community", - "homepage": "https://github.com/cakephp/cakephp-codesniffer/graphs/contributors" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "CakePHP CodeSniffer Standards", - "homepage": "http://cakephp.org", - "keywords": [ - "codesniffer", - "framework" + "description": "Symfony BrowserKit Component", + "homepage": "https://symfony.com", + "time": "2016-03-04 07:55:57" + }, + { + "name": "symfony/css-selector", + "version": "v3.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/65e764f404685f2dc20c057e889b3ad04b2e2db0", + "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "time": "2015-03-17 01:11:58" + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2016-03-04 07:55:57" + }, + { + "name": "symfony/dom-crawler", + "version": "v3.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "18a06d7a9af41718c20764a674a0ebba3bc40d1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/18a06d7a9af41718c20764a674a0ebba3bc40d1f", + "reference": "18a06d7a9af41718c20764a674a0ebba3bc40d1f", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "symfony/css-selector": "~2.8|~3.0" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "https://symfony.com", + "time": "2016-03-23 13:23:25" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "9002dcf018d884d294b1ef20a6f968efc1128f39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9002dcf018d884d294b1ef20a6f968efc1128f39", + "reference": "9002dcf018d884d294b1ef20a6f968efc1128f39", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2016-03-10 10:34:12" + }, + { + "name": "symfony/finder", + "version": "v3.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "c54e407b35bc098916704e9fd090da21da4c4f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/c54e407b35bc098916704e9fd090da21da4c4f52", + "reference": "c54e407b35bc098916704e9fd090da21da4c4f52", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2016-03-10 11:13:05" } ], "aliases": [], diff --git a/include/person.class.php b/include/person.class.php index 9943d1866..392942512 100644 --- a/include/person.class.php +++ b/include/person.class.php @@ -107,7 +107,7 @@ class person extends Person_model } if ($row = $this->db_fetch_object())*/ - if ($row = $this->get_personen($personId)) + if ($row = $this->getPerson($personId)) { $this->person_id = $row->person_id; $this->sprache = $row->sprache; diff --git a/index.ci.php b/index.ci.php index c2fc182a9..578dc97d2 100644 --- a/index.ci.php +++ b/index.ci.php @@ -299,10 +299,13 @@ switch (ENVIRONMENT) * */ -// First load the FHC-Config-Files +// First load the FHC-Config-Files ... require_once 'config/global.config.inc.php'; require_once 'config/vilesci.config.inc.php'; +// ... and the vendor autoload +include_once 'vendor/autoload.php'; + // Now the bootstrap file require_once BASEPATH.'core/CodeIgniter.php'; diff --git a/tests/codeception.yml b/tests/codeception.dist.yml similarity index 100% rename from tests/codeception.yml rename to tests/codeception.dist.yml diff --git a/tests/codeception/acceptance.suite.yml b/tests/codeception/acceptance.suite.dist.yml similarity index 88% rename from tests/codeception/acceptance.suite.yml rename to tests/codeception/acceptance.suite.dist.yml index 8a84881eb..d8d8ab229 100644 --- a/tests/codeception/acceptance.suite.yml +++ b/tests/codeception/acceptance.suite.dist.yml @@ -11,4 +11,4 @@ modules: - AcceptanceHelper config: PhpBrowser: - url: 'http://localhost/myapp/' + url: 'http://localhost/build/' diff --git a/tests/codeception/api.suite.dist.yml b/tests/codeception/api.suite.dist.yml new file mode 100644 index 000000000..6d862f3c2 --- /dev/null +++ b/tests/codeception/api.suite.dist.yml @@ -0,0 +1,11 @@ +class_name: ApiTester +modules: + enabled: + - \Helper\Api + - REST: + # API URL + url: http://localhost/build/index.ci.php/api/v1/ + # Can also be a framework module name + depends: PhpBrowser + # Limits PhpBrowser to JSON or XML + part: Json diff --git a/tests/codeception/api/LoginCept.php b/tests/codeception/api/LoginCept.php new file mode 100644 index 000000000..432e6095b --- /dev/null +++ b/tests/codeception/api/LoginCept.php @@ -0,0 +1,11 @@ +wantTo('test the Login API'); +$I->haveHttpHeader('FHC-API-KEY', 'testapikey@fhcomplete.org'); +$I->sendGET('/userauth/login/username/codeception%40whisperocity.com/password/secret/device_id/abcdef123'); +$I->seeResponseCodeIs(200); +$I->seeResponseIsJson(); +$I->seeResponseContainsJson([ + 'success' => true, + 'message' => 'User successfully logged in']); diff --git a/tests/codeception/api/_bootstrap.php b/tests/codeception/api/_bootstrap.php new file mode 100644 index 000000000..8a8855580 --- /dev/null +++ b/tests/codeception/api/_bootstrap.php @@ -0,0 +1,2 @@ +