diff --git a/._.editorconfig b/._.editorconfig new file mode 100644 index 00000000000..6b0b56c91be Binary files /dev/null and b/._.editorconfig differ diff --git a/._.gitignore b/._.gitignore new file mode 100644 index 00000000000..487cb8a703e Binary files /dev/null and b/._.gitignore differ diff --git a/._.htaccess b/._.htaccess new file mode 100644 index 00000000000..378d4e8c175 Binary files /dev/null and b/._.htaccess differ diff --git a/._application b/._application new file mode 100644 index 00000000000..216bb4c8947 Binary files /dev/null and b/._application differ diff --git a/._assets b/._assets new file mode 100644 index 00000000000..2363fcbc146 Binary files /dev/null and b/._assets differ diff --git a/._composer.json b/._composer.json new file mode 100644 index 00000000000..ae5ea80a589 Binary files /dev/null and b/._composer.json differ diff --git a/._contributing.md b/._contributing.md new file mode 100644 index 00000000000..935fa7a64f6 Binary files /dev/null and b/._contributing.md differ diff --git a/._index.php b/._index.php new file mode 100644 index 00000000000..7929fb37cd2 Binary files /dev/null and b/._index.php differ diff --git a/._license.txt b/._license.txt new file mode 100644 index 00000000000..140e08a1644 Binary files /dev/null and b/._license.txt differ diff --git a/._readme.rst b/._readme.rst new file mode 100644 index 00000000000..97d20bd1f6f Binary files /dev/null and b/._readme.rst differ diff --git a/._system b/._system new file mode 100644 index 00000000000..c29a23088a4 Binary files /dev/null and b/._system differ diff --git a/._user_guide b/._user_guide new file mode 100644 index 00000000000..b53f6651334 Binary files /dev/null and b/._user_guide differ diff --git a/._viegramCI.sql b/._viegramCI.sql new file mode 100644 index 00000000000..b15e1088acd Binary files /dev/null and b/._viegramCI.sql differ diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000000..2530309a0bc --- /dev/null +++ b/.htaccess @@ -0,0 +1,6 @@ +Options -Multiviews + +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^(.*)$ index.php?url=$1 [L] \ No newline at end of file diff --git a/application._cache b/application._cache new file mode 100644 index 00000000000..593571f64bc Binary files /dev/null and b/application._cache differ diff --git a/application._core b/application._core new file mode 100644 index 00000000000..23e9dbf1a96 Binary files /dev/null and b/application._core differ diff --git a/application._hooks b/application._hooks new file mode 100644 index 00000000000..679ba246f3e Binary files /dev/null and b/application._hooks differ diff --git a/application._logs b/application._logs new file mode 100644 index 00000000000..fa5aca5fcd4 Binary files /dev/null and b/application._logs differ diff --git a/application._views b/application._views new file mode 100644 index 00000000000..df5cf1c69a5 Binary files /dev/null and b/application._views differ diff --git a/application/config/._autoload.php b/application/config/._autoload.php new file mode 100644 index 00000000000..58ab8137e8a Binary files /dev/null and b/application/config/._autoload.php differ diff --git a/application/config/._config.php b/application/config/._config.php new file mode 100644 index 00000000000..6c117cf9aab Binary files /dev/null and b/application/config/._config.php differ diff --git a/application/config/._constants.php b/application/config/._constants.php new file mode 100644 index 00000000000..be33655c5d0 Binary files /dev/null and b/application/config/._constants.php differ diff --git a/application/config/._database.php b/application/config/._database.php new file mode 100644 index 00000000000..4db17cb1eeb Binary files /dev/null and b/application/config/._database.php differ diff --git a/application/config/._doctypes.php b/application/config/._doctypes.php new file mode 100644 index 00000000000..a1b38710521 Binary files /dev/null and b/application/config/._doctypes.php differ diff --git a/application/config/._foreign_chars.php b/application/config/._foreign_chars.php new file mode 100644 index 00000000000..71679211422 Binary files /dev/null and b/application/config/._foreign_chars.php differ diff --git a/application/config/._hooks.php b/application/config/._hooks.php new file mode 100644 index 00000000000..d8ee35e110d Binary files /dev/null and b/application/config/._hooks.php differ diff --git a/application/config/._index.html b/application/config/._index.html new file mode 100644 index 00000000000..31727c4822a Binary files /dev/null and b/application/config/._index.html differ diff --git a/application/config/._memcached.php b/application/config/._memcached.php new file mode 100644 index 00000000000..2f1218395c8 Binary files /dev/null and b/application/config/._memcached.php differ diff --git a/application/config/._migration.php b/application/config/._migration.php new file mode 100644 index 00000000000..0ec8556fcc4 Binary files /dev/null and b/application/config/._migration.php differ diff --git a/application/config/._mimes.php b/application/config/._mimes.php new file mode 100644 index 00000000000..6016ef12bae Binary files /dev/null and b/application/config/._mimes.php differ diff --git a/application/config/._profiler.php b/application/config/._profiler.php new file mode 100644 index 00000000000..62fa164efc9 Binary files /dev/null and b/application/config/._profiler.php differ diff --git a/application/config/._routes.php b/application/config/._routes.php new file mode 100644 index 00000000000..2a2509c5962 Binary files /dev/null and b/application/config/._routes.php differ diff --git a/application/config/._user_agents.php b/application/config/._user_agents.php new file mode 100644 index 00000000000..9101c418c3d Binary files /dev/null and b/application/config/._user_agents.php differ diff --git a/application/config/autoload.php b/application/config/autoload.php index 7cdc9013c11..d7d71e9f85a 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -58,7 +58,7 @@ | | $autoload['libraries'] = array('user_agent' => 'ua'); */ -$autoload['libraries'] = array(); +$autoload['libraries'] = array('database','session'); /* | ------------------------------------------------------------------- @@ -89,7 +89,7 @@ | | $autoload['helper'] = array('url', 'file'); */ -$autoload['helper'] = array(); +$autoload['helper'] = array('url'); /* | ------------------------------------------------------------------- diff --git a/application/config/config.php b/application/config/config.php index 782b19c74b6..d4efaf8edb7 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -23,7 +23,7 @@ | a PHP script and you can easily do that on your own. | */ -$config['base_url'] = ''; +$config['base_url'] = 'http://localhost:8080/VietgramCI/'; /* |-------------------------------------------------------------------------- @@ -35,7 +35,7 @@ | variable so that it is blank. | */ -$config['index_page'] = 'index.php'; +$config['index_page'] = ''; /* |-------------------------------------------------------------------------- diff --git a/application/config/database.php b/application/config/database.php index 77748959f9f..7ba4d0c7e28 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -76,9 +76,9 @@ $db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', - 'username' => '', + 'username' => 'root', 'password' => '', - 'database' => '', + 'database' => 'viegramCI', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => FALSE, diff --git a/application/config/routes.php b/application/config/routes.php index 8ebf62bfa43..e7355b59e34 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -49,6 +49,6 @@ | Examples: my-controller/index -> my_controller/index | my-controller/my-method -> my_controller/my_method */ -$route['default_controller'] = 'welcome'; +$route['default_controller'] = 'login'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE; diff --git a/application/controllers/._Edit_profile.php b/application/controllers/._Edit_profile.php new file mode 100644 index 00000000000..73f86ae8b1a Binary files /dev/null and b/application/controllers/._Edit_profile.php differ diff --git a/application/controllers/._Explore.php b/application/controllers/._Explore.php new file mode 100644 index 00000000000..a4de26631b3 Binary files /dev/null and b/application/controllers/._Explore.php differ diff --git a/application/controllers/._Feed.php b/application/controllers/._Feed.php new file mode 100644 index 00000000000..9d3fdb3b9bd Binary files /dev/null and b/application/controllers/._Feed.php differ diff --git a/application/controllers/._Login.php b/application/controllers/._Login.php new file mode 100644 index 00000000000..117bc64ce86 Binary files /dev/null and b/application/controllers/._Login.php differ diff --git a/application/controllers/._Profile.php b/application/controllers/._Profile.php new file mode 100644 index 00000000000..34139d074df Binary files /dev/null and b/application/controllers/._Profile.php differ diff --git a/application/controllers/._Welcome.php b/application/controllers/._Welcome.php new file mode 100644 index 00000000000..aced76c6945 Binary files /dev/null and b/application/controllers/._Welcome.php differ diff --git a/application/controllers/._index.html b/application/controllers/._index.html new file mode 100644 index 00000000000..a3b53b1a71b Binary files /dev/null and b/application/controllers/._index.html differ diff --git a/application/controllers/Edit_profile.php b/application/controllers/Edit_profile.php new file mode 100644 index 00000000000..c9f8110752e --- /dev/null +++ b/application/controllers/Edit_profile.php @@ -0,0 +1,32 @@ +load->model('user'); + } + + public function index() { + $username = $this->session->userdata('user'); + if ($username) { + $data['profile'] = $this->user->getUser($username); + $this->load->view('view_editprofile',$data); + } else { + redirect('/login'); + } + } + + public function edit() { + $id = $this->session->userdata('id'); + $data['username'] = $this->input->post('username'); + $data['name'] = $this->input->post('name'); + $data['website'] = $this->input->post('website'); + $data['bio'] = $this->input->post('bio'); + $data['email'] = $this->input->post('email'); + $data['phone'] = $this->input->post('phonenumber'); + $data['gender'] = $this->input->post('gender'); + $this->user->editUser($id,$data); + redirect('/profile'); + } +} \ No newline at end of file diff --git a/application/controllers/Explore.php b/application/controllers/Explore.php new file mode 100644 index 00000000000..e1700fd09e8 --- /dev/null +++ b/application/controllers/Explore.php @@ -0,0 +1,38 @@ +load->model('follow'); + $this->load->model('user'); + } + + public function index() { + $id = $this->session->userdata('id'); + if ($id) { + $data['users'] = $this->user->getSomeUser($id); + $this->load->view('view_explore',$data); + } else { + redirect('/login'); + } + } + + public function search() { + $id = $this->session->userdata('id'); + $username = $this->input->get('search'); + $data['users'] = $this->user->searchUser($username, $id); + $this->load->view('view_explore',$data); + } + + public function add($id) { + $data['id_user'] = $this->session->userdata('id'); + $data['id_user_follow'] = $id; + $followed = $this->follow->checkFollowing($data); + if (!$followed) { + $this->follow->addFollowing($data); + redirect('/explore'); + } + + } +} \ No newline at end of file diff --git a/application/controllers/Feed.php b/application/controllers/Feed.php new file mode 100644 index 00000000000..2233a7aac00 --- /dev/null +++ b/application/controllers/Feed.php @@ -0,0 +1,20 @@ +load->model('user'); + $this->load->model('post'); + } + + public function index() { + $username = $this->session->userdata('user'); + if ($username) { + $data['allPost'] = $this->post->getAllPost(); + $this->load->view('view_feed',$data); + } else { + redirect('/login'); + } + } +} \ No newline at end of file diff --git a/application/controllers/Login.php b/application/controllers/Login.php new file mode 100644 index 00000000000..87738724dc4 --- /dev/null +++ b/application/controllers/Login.php @@ -0,0 +1,27 @@ +load->model('user'); + } + + public function index() { + $this->load->view('view_login'); + } + + public function login(){ + $data['username'] = $this->input->post('username'); + $data['password'] = $this->input->post('password'); + $result = $this->user->login($data); + if ($result) { + $this->session->set_userdata('id',$result->id_user); + $this->session->set_userdata('user',$data['username']); + redirect('/feed'); + } else { + $error = array('error_message' => "Username or Password ain't correct"); + $this->load->view('view_login', $error); + } + } +} diff --git a/application/controllers/Profile.php b/application/controllers/Profile.php new file mode 100644 index 00000000000..763894ed723 --- /dev/null +++ b/application/controllers/Profile.php @@ -0,0 +1,34 @@ +load->model('user'); + $this->load->model('follow'); + $this->load->model('post'); + } + + public function index() { + $id = $this->session->userdata('id'); + $username = $this->session->userdata('user'); + if ($username) { + $data = array( + 'profile' => $this->user->getUser($username), + 'post' => $this->post->getPost($id), + 'followers' => $this->follow->getFollowers($id), + 'following' => $this->follow->getFollowing($id), + 'allPost' => $this->post->getUserPost($id) + ); + $this->load->view('view_profile',$data); + } else { + redirect('/login'); + } + } + + public function logout() { + $this->session->sess_destroy(); + redirect('/login'); + } + +} \ No newline at end of file diff --git a/application/core/._index.html b/application/core/._index.html new file mode 100644 index 00000000000..048bd61f2d9 Binary files /dev/null and b/application/core/._index.html differ diff --git a/application/helpers/._index.html b/application/helpers/._index.html new file mode 100644 index 00000000000..c1a3c71449d Binary files /dev/null and b/application/helpers/._index.html differ diff --git a/application/hooks/._index.html b/application/hooks/._index.html new file mode 100644 index 00000000000..509051d3baa Binary files /dev/null and b/application/hooks/._index.html differ diff --git a/application/language/._english b/application/language/._english new file mode 100644 index 00000000000..c8e3e724557 Binary files /dev/null and b/application/language/._english differ diff --git a/application/language/._index.html b/application/language/._index.html new file mode 100644 index 00000000000..85b2f0c76ac Binary files /dev/null and b/application/language/._index.html differ diff --git a/application/language/english/._index.html b/application/language/english/._index.html new file mode 100644 index 00000000000..d473a1d5b24 Binary files /dev/null and b/application/language/english/._index.html differ diff --git a/application/libraries/._index.html b/application/libraries/._index.html new file mode 100644 index 00000000000..7343d45892f Binary files /dev/null and b/application/libraries/._index.html differ diff --git a/application/models/._Follow.php b/application/models/._Follow.php new file mode 100644 index 00000000000..5b89a183d41 Binary files /dev/null and b/application/models/._Follow.php differ diff --git a/application/models/._Post.php b/application/models/._Post.php new file mode 100644 index 00000000000..5e158520efc Binary files /dev/null and b/application/models/._Post.php differ diff --git a/application/models/._User.php b/application/models/._User.php new file mode 100644 index 00000000000..71f777725d0 Binary files /dev/null and b/application/models/._User.php differ diff --git a/application/models/._index.html b/application/models/._index.html new file mode 100644 index 00000000000..c2a879c317d Binary files /dev/null and b/application/models/._index.html differ diff --git a/application/models/Follow.php b/application/models/Follow.php new file mode 100644 index 00000000000..33e8bdf66be --- /dev/null +++ b/application/models/Follow.php @@ -0,0 +1,28 @@ +db->where('id_user',$data['id_user']); + $this->db->where('id_user_follow',$data['id_user_follow']); + $query = $this->db->get('follow'); + return ($query->num_rows() > 0) ? true : false; + } + + public function addFollowing($data){ + $this->db->insert('follow',$data); + return ($this->db->affected_rows() == 1) ? true : false; + } + + public function getFollowing($id) { + $this->db->where('id_user',$id); + $query = $this->db->get('follow'); + return $query->num_rows(); + } + + public function getFollowers($id) { + $this->db->where('id_user_follow',$id); + $query = $this->db->get('follow'); + return $query->num_rows(); + } +} diff --git a/application/models/Post.php b/application/models/Post.php new file mode 100644 index 00000000000..cefb10b33c1 --- /dev/null +++ b/application/models/Post.php @@ -0,0 +1,20 @@ +db->join('user', 'post.id_user = user.id_user'); + return $this->db->get('post')->result(); + } + + public function getPost($id) { + $this->db->where('id_user',$id); + $query = $this->db->get('post'); + return $query->num_rows(); + } + + public function getUserPost($id) { + $this->db->where('id_user',$id); + return $this->db->get('post')->result(); + } +} diff --git a/application/models/User.php b/application/models/User.php new file mode 100644 index 00000000000..b5e54bf02aa --- /dev/null +++ b/application/models/User.php @@ -0,0 +1,45 @@ +db->where('username',$data['username']); + $this->db->where('password',$data['password']); + $query = $this->db->get('user'); + return ($query->num_rows() > 0) ? $query->row() : false; + } + + public function getUser($username) { + $this->db->where('username',$username); + $query = $this->db->get('user'); + return ($query->num_rows() > 0) ? $query->row() : false; + } + + public function editUser($id, $data) { + $this->db->where('id_user',$id); + $this->db->update('user',$data); + } + + public function getSomeUser($id) { + $this->db->select('id_user_follow'); + $this->db->where('id_user',$id); + $data = $this->db->get('follow')->result_array(); + + foreach ($data as $following) { + $id_user_follow[] = $following['id_user_follow']; + } + + $this->db->where('id_user !=', $id); + if (!empty($id_user_follow)) { + $this->db->where_not_in('id_user', $id_user_follow); + } + return $this->db->get('user')->result(); + } + + public function searchUser($username, $id) { + $this->db->where('id_user !=', $id); + $this->db->like('username', $username); + return $this->db->get('user')->result(); + } + +} diff --git a/application/third_party/._index.html b/application/third_party/._index.html new file mode 100644 index 00000000000..51686ba5cb6 Binary files /dev/null and b/application/third_party/._index.html differ diff --git a/application/views/._errors b/application/views/._errors new file mode 100644 index 00000000000..1f09a504f36 Binary files /dev/null and b/application/views/._errors differ diff --git a/application/views/._index.html b/application/views/._index.html new file mode 100644 index 00000000000..43942f17abb Binary files /dev/null and b/application/views/._index.html differ diff --git a/application/views/._view_editprofile.php b/application/views/._view_editprofile.php new file mode 100644 index 00000000000..d896d679566 Binary files /dev/null and b/application/views/._view_editprofile.php differ diff --git a/application/views/._view_explore.php b/application/views/._view_explore.php new file mode 100644 index 00000000000..1e03a8f067b Binary files /dev/null and b/application/views/._view_explore.php differ diff --git a/application/views/._view_feed.php b/application/views/._view_feed.php new file mode 100644 index 00000000000..ce6b61582bf Binary files /dev/null and b/application/views/._view_feed.php differ diff --git a/application/views/._view_login.php b/application/views/._view_login.php new file mode 100644 index 00000000000..7d1ad48ea9d Binary files /dev/null and b/application/views/._view_login.php differ diff --git a/application/views/._view_profile.php b/application/views/._view_profile.php new file mode 100644 index 00000000000..f49c383531c Binary files /dev/null and b/application/views/._view_profile.php differ diff --git a/application/views/._welcome_message.php b/application/views/._welcome_message.php new file mode 100644 index 00000000000..9f6fc6f32fc Binary files /dev/null and b/application/views/._welcome_message.php differ diff --git a/application/views/errors._cli b/application/views/errors._cli new file mode 100644 index 00000000000..c91ba4a3eaf Binary files /dev/null and b/application/views/errors._cli differ diff --git a/application/views/errors._html b/application/views/errors._html new file mode 100644 index 00000000000..03a4fdedd77 Binary files /dev/null and b/application/views/errors._html differ diff --git a/application/views/errors/._index.html b/application/views/errors/._index.html new file mode 100644 index 00000000000..d4a6e324f51 Binary files /dev/null and b/application/views/errors/._index.html differ diff --git a/application/views/errors/cli/._error_404.php b/application/views/errors/cli/._error_404.php new file mode 100644 index 00000000000..bb28e9b14b8 Binary files /dev/null and b/application/views/errors/cli/._error_404.php differ diff --git a/application/views/errors/cli/._error_db.php b/application/views/errors/cli/._error_db.php new file mode 100644 index 00000000000..993cadb67d1 Binary files /dev/null and b/application/views/errors/cli/._error_db.php differ diff --git a/application/views/errors/cli/._error_exception.php b/application/views/errors/cli/._error_exception.php new file mode 100644 index 00000000000..8d4744797c7 Binary files /dev/null and b/application/views/errors/cli/._error_exception.php differ diff --git a/application/views/errors/cli/._error_general.php b/application/views/errors/cli/._error_general.php new file mode 100644 index 00000000000..36859a53782 Binary files /dev/null and b/application/views/errors/cli/._error_general.php differ diff --git a/application/views/errors/cli/._error_php.php b/application/views/errors/cli/._error_php.php new file mode 100644 index 00000000000..5243c33d400 Binary files /dev/null and b/application/views/errors/cli/._error_php.php differ diff --git a/application/views/errors/cli/._index.html b/application/views/errors/cli/._index.html new file mode 100644 index 00000000000..e7a3a355102 Binary files /dev/null and b/application/views/errors/cli/._index.html differ diff --git a/application/views/errors/html/._error_404.php b/application/views/errors/html/._error_404.php new file mode 100644 index 00000000000..2332c30ad83 Binary files /dev/null and b/application/views/errors/html/._error_404.php differ diff --git a/application/views/errors/html/._error_db.php b/application/views/errors/html/._error_db.php new file mode 100644 index 00000000000..55c12b999e9 Binary files /dev/null and b/application/views/errors/html/._error_db.php differ diff --git a/application/views/errors/html/._error_exception.php b/application/views/errors/html/._error_exception.php new file mode 100644 index 00000000000..bd3badfcb65 Binary files /dev/null and b/application/views/errors/html/._error_exception.php differ diff --git a/application/views/errors/html/._error_general.php b/application/views/errors/html/._error_general.php new file mode 100644 index 00000000000..7deb763925b Binary files /dev/null and b/application/views/errors/html/._error_general.php differ diff --git a/application/views/errors/html/._error_php.php b/application/views/errors/html/._error_php.php new file mode 100644 index 00000000000..60e185eb251 Binary files /dev/null and b/application/views/errors/html/._error_php.php differ diff --git a/application/views/errors/html/._index.html b/application/views/errors/html/._index.html new file mode 100644 index 00000000000..20449d6caaa Binary files /dev/null and b/application/views/errors/html/._index.html differ diff --git a/application/views/view_editprofile.php b/application/views/view_editprofile.php new file mode 100644 index 00000000000..b801d06b526 --- /dev/null +++ b/application/views/view_editprofile.php @@ -0,0 +1,115 @@ + + + + + + + + Edit Profile | Vietgram + + + + + +
+
+
+
+ +
+

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ +
+
+
+ + + + \ No newline at end of file diff --git a/application/views/view_explore.php b/application/views/view_explore.php new file mode 100644 index 00000000000..c1d42b0d469 --- /dev/null +++ b/application/views/view_explore.php @@ -0,0 +1,102 @@ + + + + + + + Explore | Vietgram + + + + + +
+ + + Tidak ditemukan + + + +
+ + + + \ No newline at end of file diff --git a/application/views/view_feed.php b/application/views/view_feed.php new file mode 100644 index 00000000000..91764d6511c --- /dev/null +++ b/application/views/view_feed.php @@ -0,0 +1,118 @@ + + + + + + + + Feed | Vietgram + "> + + + + + +
+ +
+
+ + +
+ +
+
+ + + + + + +
+ +
    +
  • + username?> status?> +
  • +
  • + panggihsamudra Uwu +
  • +
  • + sabrinar Wow! +
  • +
  • + mufti_ismi Cool! +
  • +
  • + kekeyi I like it! +
  • +
+ 5 hours ago +
+ + +
+
+
+ +
+ + + + \ No newline at end of file diff --git a/application/views/view_login.php b/application/views/view_login.php new file mode 100644 index 00000000000..b865981334d --- /dev/null +++ b/application/views/view_login.php @@ -0,0 +1,71 @@ + + + + Vietgram | Login + + + + + + + + +
+
+ +
+
+ + + +
+
+ + + \ No newline at end of file diff --git a/application/views/view_profile.php b/application/views/view_profile.php new file mode 100644 index 00000000000..d0f5cd38473 --- /dev/null +++ b/application/views/view_profile.php @@ -0,0 +1,124 @@ + + + + + + + Profile | Vietgram + + + + + +
+
+
+ +
+
+
+

username;?>

+ Edit profile + +
+
    +
  • + posts +
  • +
  • + followers +
  • +
  • + following +
  • +
+

+ + name;?> +
+
bio;?> + website;?> +

+
+
+ + + +
+ +
+ +
+ + + likes;?> + + + + 344 + +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/assets._css b/assets._css new file mode 100644 index 00000000000..49d714070a0 Binary files /dev/null and b/assets._css differ diff --git a/assets/._images b/assets/._images new file mode 100644 index 00000000000..c49cb609bfb Binary files /dev/null and b/assets/._images differ diff --git a/assets/css/._edit-profile.css b/assets/css/._edit-profile.css new file mode 100644 index 00000000000..a82c4520f3d Binary files /dev/null and b/assets/css/._edit-profile.css differ diff --git a/assets/css/._explore.css b/assets/css/._explore.css new file mode 100644 index 00000000000..6c82ee6728c Binary files /dev/null and b/assets/css/._explore.css differ diff --git a/assets/css/._feed.css b/assets/css/._feed.css new file mode 100644 index 00000000000..fa2ba0dfa4b Binary files /dev/null and b/assets/css/._feed.css differ diff --git a/assets/css/._footer.css b/assets/css/._footer.css new file mode 100644 index 00000000000..6bb781367fc Binary files /dev/null and b/assets/css/._footer.css differ diff --git a/assets/css/._globals.css b/assets/css/._globals.css new file mode 100644 index 00000000000..aa140e13605 Binary files /dev/null and b/assets/css/._globals.css differ diff --git a/assets/css/._login.css b/assets/css/._login.css new file mode 100644 index 00000000000..b53eede7cf9 Binary files /dev/null and b/assets/css/._login.css differ diff --git a/assets/css/._mobile.css b/assets/css/._mobile.css new file mode 100644 index 00000000000..7a884462f36 Binary files /dev/null and b/assets/css/._mobile.css differ diff --git a/assets/css/._navigation.css b/assets/css/._navigation.css new file mode 100644 index 00000000000..0edf52662f8 Binary files /dev/null and b/assets/css/._navigation.css differ diff --git a/assets/css/._profile.css b/assets/css/._profile.css new file mode 100644 index 00000000000..09052b8d9a3 Binary files /dev/null and b/assets/css/._profile.css differ diff --git a/assets/css/._reset.css b/assets/css/._reset.css new file mode 100644 index 00000000000..23a49cb9601 Binary files /dev/null and b/assets/css/._reset.css differ diff --git a/assets/css/._styles.css b/assets/css/._styles.css new file mode 100644 index 00000000000..a63f0c13216 Binary files /dev/null and b/assets/css/._styles.css differ diff --git a/assets/css/._variables.css b/assets/css/._variables.css new file mode 100644 index 00000000000..50710665663 Binary files /dev/null and b/assets/css/._variables.css differ diff --git a/assets/css/edit-profile.css b/assets/css/edit-profile.css new file mode 100644 index 00000000000..75465431998 --- /dev/null +++ b/assets/css/edit-profile.css @@ -0,0 +1,100 @@ +#edit-profile { + display: flex; + justify-content: center; +} + +#edit-profile .edit-profile__container { + background-color: white; + border: 1px solid #e6e6e6; + width: 100%; + max-width: 800px; +} + +#edit-profile .edit-profile__container { + padding: 40px 0; +} + +#edit-profile .edit-profile__header { + display: flex; + align-items: center; + margin-bottom: 50px; +} + +.edit-profile__header .edit-profile__avatar-container { + width: 200px; +} + +.edit-profile__avatar-container { + display: flex; + justify-content: flex-end; + margin-right: 35px; +} + +.edit-profile__avatar-container img { + width: 38px; + height: 38px; + border-radius: 50%; +} +.edit-profile__header h4 { + font-size: 18px; + font-weight: 600; +} + +.edit-profile__form .form__row { + display: flex; +} + +.form__row { + margin-bottom: 20px; + display: flex; + align-items: center; +} + +.form__row .form__label { + width: 200px; + display: block; + text-align: right; + margin-right: 35px; + font-weight: 600; + font-size: 16px; +} + +.form__row label { + font-size: 15px; + width: 80%; +} + +.form__row .form__input, +.form__row textarea { + padding: 8px; + width: 255px; + resize: vertical; + border: 0; + border: 1px solid #e6e6e6; + border-radius: 3px; +} + +.form__row input[type="checkbox"] { + margin-right: 15px; +} + +#edit-profile select { + background: 0 0; + border: 1px solid #efefef; + border-radius: 3px; + color: #262626; + font-size: 16px; + height: 32px; + padding: 0 30px 0 10px; +} + +#edit-profile input[type="submit"] { + margin-left: 235px; + border: 0; + color: white; + font-weight: 600; + border-radius: 3px; + background-color: var(--fd-blue); + font-size: 14px; + padding: 7px 25px; +} diff --git a/assets/css/explore.css b/assets/css/explore.css new file mode 100644 index 00000000000..d4a8f6ba2af --- /dev/null +++ b/assets/css/explore.css @@ -0,0 +1,70 @@ +#explore { + display: flex; + justify-content: center; + align-items: flex-start; + min-height: 500px; +} + +#explore .explore__users { + background-color: white; + border: 1px solid #e6e6e6; + border-radius: 3px; + width: 100%; + max-width: 600px; +} + +.explore__users .explore__user { + padding: 10px 15px; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1px solid #e6e6e6; +} + +.explore__users .explore__user:last-child { + border: 0; +} + +.explore__user .explore__avatar { + width: 55px; + border-radius: 50%; +} + +.explore__user .explore__user-column { + display: flex; + align-items: center; +} + +.explore__user .explore__info { + margin-left: 15px; +} + +.explore__info .explore__username { + display: block; + font-weight: 600; + margin-bottom: 5px; +} + +.explore__info .explore__full-name { + color: #999; +} + +.explore__user-column button { + background-color: var(--fd-blue); + color: white; + border: 0; + font-weight: 600; + padding: 5px 10px; + font-size: 14px; + border-radius: 3px; + cursor: pointer; +} + +.explore__user-column button:active, +.explore__user-column button:focus { + outline: none; +} + +.explore__user-column:active { + opacity: 0.9; +} diff --git a/assets/css/feed.css b/assets/css/feed.css new file mode 100644 index 00000000000..cc88c16ef17 --- /dev/null +++ b/assets/css/feed.css @@ -0,0 +1,101 @@ +#feed { + display: flex; + align-items: center; + flex-direction: column; +} + +#feed .photo { + background-color: white; + border: 1px solid #e6e6e6; + border-radius: 3px; + width: 100%; + max-width: 600px; + margin-bottom: 65px; +} + +.photo .photo__header { + padding: 15px; + display: flex; + align-items: center; +} + +.photo__header .photo__avatar { + width: 32px; + border-radius: 50%; + margin-right: 10px; +} + +.photo .photo__user-info .photo__author { + display: block; + font-weight: 600; + margin-bottom: 5px; +} + +.photo > img { + max-width: 100%; +} + +.photo .photo__info { + padding: 15px 20px; +} + +.photo__actions { + margin-bottom: 15px; + font-size: 115%; +} + +.photo__actions .photo__action:first-child { + margin-right: 15px; +} + +.photo__actions .photo__action { + cursor: pointer; +} + +.photo .photo__likes { + font-weight: 600; + margin-bottom: 10px; + display: block; +} + +.photo .photo__add-comment-container { + margin-top: 15px; + border-top: 1px solid #e6e6e6; + padding-top: 10px; + display: flex; + justify-content: space-between; + align-items: center; +} + +.photo__add-comment-container textarea { + width: 90%; + border: 0; + font-size: 14px; + resize: none; + height: 20px; +} + +.photo__add-comment-container textarea:focus, +.photo__add-comment-container textarea:active { + outline: none; +} + +.photo__add-comment-container i { + cursor: pointer; +} + +.photo .photo__time-ago { + font-size: 10px; + text-transform: uppercase; + color: #999; + margin-top: 10px; + display: block; +} + +.photo__comment { + margin-bottom: 10px; +} + +.photo__comments .photo__comment-author { + font-weight: 600; +} diff --git a/assets/css/footer.css b/assets/css/footer.css new file mode 100644 index 00000000000..0d5b8cbae0e --- /dev/null +++ b/assets/css/footer.css @@ -0,0 +1,30 @@ +.footer { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + max-width: 900px; + margin: 30px auto; + text-transform: uppercase; + font-size: 12px; + font-weight: 600; +} + +.footer .footer__list { + padding: 0; + list-style-type: none; + display: flex; +} + +.footer .footer__copyright { + color: hsl(0, 0%, 60%); +} + +.footer__list .footer__list-item { + margin-right: 10px; +} + +.footer .footer__link { + text-decoration: none; + color: var(--link-color); +} diff --git a/assets/css/globals.css b/assets/css/globals.css new file mode 100644 index 00000000000..cea96117b23 --- /dev/null +++ b/assets/css/globals.css @@ -0,0 +1,21 @@ +body { + background-color: white; + background-color: var(--background-color); + font-size: 14px; + font-family: "Open Sans", sans-serif; +} + +main { + animation: fadeInMain 0.5s linear; +} + +@keyframes fadeInMain { + from { + opacity: 0; + transform: translateY(10px); + } + to { + opacity: 1; + transform: translateY(0px); + } +} diff --git a/assets/css/login.css b/assets/css/login.css new file mode 100644 index 00000000000..f5657f0c13a --- /dev/null +++ b/assets/css/login.css @@ -0,0 +1,128 @@ +#login { + width: 100%; + max-width: 800px; + margin: 45px auto; + display: flex; + justify-content: space-around; +} + +#login .login__column { + width: 45%; +} + +.login__column .login__phone { + max-width: 100%; +} + +.login__column .login__box { + background-color: white; + border: 1px solid #e6e6e6; +} + +.login__column .login__box--transparent { + background: none; + border: 0; + display: flex; + flex-direction: column; + align-items: center; + margin-top: 35px; +} + +.login__column .login__appstores { + margin-top: 20px; +} + +.login__appstores .login__appstore { + height: 40px; +} + +#login .login__box { + padding: 30px 0; + text-align: center; +} + +#login .login__box:first-child { + margin-bottom: 10px; + padding-left: 40px; + padding-right: 40px; +} + +.login__column .login__logo { + height: 50px; +} + +.login__form input { + display: block; + width: 100%; + box-sizing: border-box; + padding: 7px; + font-size: 14px; + border: 0; + border: 1px solid #e6e6e6; + border-radius: 5px; + background: #fafafa; +} + +.login__form input:focus { + outline: none; + border: 1px solid #a9a9a9; +} + +.login__form input:first-child { + margin-bottom: 5px; +} + +.login__form input[type="submit"] { + background-color: #3f99ed; + border: 0; + padding: 5px; + margin-top: 15px; + margin-bottom: 20px; + color: white; + font-weight: 600; +} + +#login .login__divider { + display: block; + text-transform: uppercase; + font-weight: 600; + color: #999; + margin-bottom: 20px; + position: relative; + width: 100%; +} + +#login .login__link { + display: block; + text-decoration: none; + color: #003569; +} + +#login .login__link--small { + margin-top: 30px; +} + +.login__box a { + text-decoration: none; + color: var(--fd-blue); +} + +#login .login__divider:before { + content: ""; + height: 1px; + background-color: rgba(153, 153, 153, 0.5); + width: 40%; + position: absolute; + left: 0; + top: 10px; +} + +#login .login__divider:after { + content: ""; + height: 1px; + background-color: rgba(153, 153, 153, 0.5); + width: 40%; + position: absolute; + right: 0; + top: 10px; +} diff --git a/assets/css/mobile.css b/assets/css/mobile.css new file mode 100644 index 00000000000..fc236e0553c --- /dev/null +++ b/assets/css/mobile.css @@ -0,0 +1,110 @@ +@media screen and (min-width: 375px) and (max-width: 667px) { + .navigation { + padding: 0 20px; + margin-bottom: 0; + } + .navigation input, + .navigation .fa-search { + display: none; + } + #feed .photo { + background-color: transparent; + border: 0; + margin-bottom: 20px; + } + #feed .photo .photo__add-comment-container { + display: none; + } + .footer { + width: 80%; + } + .footer, + .footer .footer__list { + flex-wrap: wrap; + justify-content: center; + } + .footer__list .footer__list-item { + margin-bottom: 10px; + } + #login .login__column { + width: 100%; + } + #login .login__column:first-child { + display: none; + } + #login .login__box { + background-color: transparent; + border: 0; + } + #profile { + margin-top: 50px; + } + #profile .profile__header { + flex-direction: column; + align-items: center; + } + #profile .profile__title { + flex-wrap: wrap; + justify-content: center; + width: 100%; + } + .profile__title h3 { + margin: 20px 0; + } + .profile__title a { + margin-right: auto; + } + .profile__stats { + justify-content: space-between; + } + .profile__stats .profile__stat { + text-align: center; + margin-right: 0; + } + .profile__stat span { + display: block; + } + .profile__photos .profile__photo { + width: 33%; + margin-bottom: 0; + } + .profile__photos { + margin-bottom: 50px; + } + #explore .explore__users { + background-color: transparent; + border: 0; + } + .explore__users .explore__user { + border: 0; + } + #edit-profile > .edit-profile__container { + border: 0; + } + #edit-profile .form__row { + flex-direction: column; + } + .form__row .form__label { + margin: 0; + text-align: center; + margin-bottom: 10px; + } + #edit-profile input[type="submit"] { + width: 120px; + margin: 0; + margin-top: 20px; + } + #edit-profile .edit-profile__container { + display: flex; + flex-direction: column; + align-items: center; + } + #edit-profile .edit-profile__form { + display: flex; + flex-direction: column; + align-items: center; + } + .edit-profile__header .edit-profile__avatar-container { + width: 0; + } +} diff --git a/assets/css/navigation.css b/assets/css/navigation.css new file mode 100644 index 00000000000..cb729669732 --- /dev/null +++ b/assets/css/navigation.css @@ -0,0 +1,77 @@ +.navigation { + height: 75px; + background-color: white; + border-bottom: 1px solid #e6e6e6; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 100px; + margin-bottom: 60px; +} + +.navigation .navigation__column:first-child img { + height: 45px; +} + +.navigation .navigations__links { + display: flex; + padding: 0; + list-style-type: none; +} + +.navigation .navigation__list-item { + margin-left: 30px; + padding: 0 2px; + opacity: 0; + animation: slideNavLink 0.5s ease-out forwards; +} + +@keyframes slideNavLink { + from { + transform: translateY(-10px); + } + to { + opacity: 1; + transform: none; + } +} + +.navigation .navigation__list-item:nth-child(2) { + animation-delay: 0.2s; +} + +.navigation .navigation__list-item:last-child { + animation-delay: 0.3s; +} + +.navigation__link { + color: rgba(0, 0, 0, 0.8); + font-size: 18px; +} + +.navigation__column input { + padding: 5px 0; + padding-left: 60px; + border: 0; + border: 1px solid #e6e6e6; + border-radius: 3px; + background: #fafafa; + font-size: 16px; +} + +.navigation__column input:focus { + outline: none; + border: 1px solid #a9a9a9; +} + +.navigation__column { + position: relative; +} + +.navigation__column .fa-search { + position: absolute; + top: 10px; + left: 10px; + color: rgba(0, 0, 0, 0.5); + font-size: 12px; +} diff --git a/assets/css/profile.css b/assets/css/profile.css new file mode 100644 index 00000000000..8817e4932b6 --- /dev/null +++ b/assets/css/profile.css @@ -0,0 +1,153 @@ +#profile { + display: flex; + flex-direction: column; + align-items: center; +} + +#profile .profile__header { + max-width: 935px; + width: 100%; + display: flex; + margin-bottom: 50px; + font-size: 110%; +} + +.profile__header .profile__column { + width: 70%; +} + +.profile__header .profile__column:first-child { + width: 30%; + display: flex; + align-items: center; + justify-content: center; +} + +.profile__column:first-child img { + border-radius: 50%; + transform-style: preserve-3d; + transition: transform 0.5s linear; +} + + + +.profile__column .profile__title, +.profile__column .profile__stats { + display: flex; + align-items: center; +} + +.profile__column .profile__title { + margin-bottom: 30px; +} + +.profile__title .profile__username { + margin-right: 25px; + font-size: 32px; + font-weight: 300; +} + +.profile__title a { + margin-right: 10px; + text-decoration: none; + color: inherit; + font-weight: 600; + padding: 5px 25px; + border: 1px solid #e6e6e6; + border-radius: 3px; + transition: all 0.3s ease-in-out; +} + +.profile__title a:hover { + background-color: #3f99ed; + color: white; + border-color: #3f99ed; +} + +.profile__title i { + cursor: pointer; + transition: transform 1s ease-in; +} + +.profile__title i:hover { + transform: rotate(2turn); +} + +.profile__column .profile__stats { + margin-bottom: 30px; +} + +.profile__stats .profile__stat { + margin-right: 40px; +} + +.profile__stat .stat__number { + font-weight: 600; +} + +.profile__bio .profile__full-name { + font-weight: 600; +} + +.profile__bio a { + color: var(--link-color); + font-weight: 600; + text-decoration: none; + display: block; +} + +.profile__column .profile__bio { + line-height: 125%; +} + +#profile .profile__photos { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + max-width: 936px; + width: 100%; +} + +.profile__photos .profile__photo { + width: 31%; + margin-bottom: 35px; + position: relative; +} + +.profile__photo img { + max-width: 100%; +} + +.profile__photo .profile__photo-overlay { + position: absolute; + top: 0; + background-color: rgba(0, 0, 0, 0.5); + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + color: white; + font-weight: 600; + opacity: 0; + transition: opacity 0.2s linear; +} + +.profile__photo:hover .profile__photo-overlay { + opacity: 1; +} + +.profile__photo-overlay .overlay__item { + font-size: 130%; + display: flex; + align-items: center; +} +.profile__photo-overlay .overlay__item:last-child { + margin-left: 10px; + /**/ +} + +.profile__photo-overlay .overlay__item i { + font-size: 130%; + margin-right: 5px; +} diff --git a/assets/css/reset.css b/assets/css/reset.css new file mode 100644 index 00000000000..82935aeceff --- /dev/null +++ b/assets/css/reset.css @@ -0,0 +1,124 @@ +html, +body, +div, +span, +applet, +object, +iframe, +h1, +h2, +h3, +h4, +h5, +h6, +p, +blockquote, +pre, +a, +abbr, +acronym, +address, +big, +cite, +code, +del, +dfn, +em, +img, +ins, +kbd, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +b, +u, +i, +center, +dl, +dt, +dd, +ol, +ul, +li, +fieldset, +form, +label, +legend, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td, +article, +aside, +canvas, +details, +embed, +figure, +figcaption, +footer, +header, +hgroup, +menu, +nav, +output, +ruby, +section, +summary, +time, +mark, +audio, +video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +menu, +nav, +section { + display: block; +} +body { + line-height: 1; +} +ol, +ul { + list-style: none; +} +blockquote, +q { + quotes: none; +} +blockquote:before, +blockquote:after, +q:before, +q:after { + content: ""; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/assets/css/styles.css b/assets/css/styles.css new file mode 100644 index 00000000000..09dd98497fc --- /dev/null +++ b/assets/css/styles.css @@ -0,0 +1,12 @@ +@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,400,600"); +@import "reset.css"; +@import "variables.css"; +@import "globals.css"; +@import "login.css"; +@import "footer.css"; +@import "navigation.css"; +@import "explore.css"; +@import "feed.css"; +@import "profile.css"; +@import "edit-profile.css"; +@import "mobile.css"; diff --git a/assets/css/variables.css b/assets/css/variables.css new file mode 100644 index 00000000000..0620c7ea3f3 --- /dev/null +++ b/assets/css/variables.css @@ -0,0 +1,5 @@ +:root { + --background-color: #fafafa; + --fd-blue: #3897f0; + --link-color: #003569; +} diff --git a/assets/images/._android.png b/assets/images/._android.png new file mode 100644 index 00000000000..220350c9b38 Binary files /dev/null and b/assets/images/._android.png differ diff --git a/assets/images/._ios.png b/assets/images/._ios.png new file mode 100644 index 00000000000..83c9fce54e8 Binary files /dev/null and b/assets/images/._ios.png differ diff --git a/assets/images/._loginLogo.png b/assets/images/._loginLogo.png new file mode 100644 index 00000000000..1a1f04573e1 Binary files /dev/null and b/assets/images/._loginLogo.png differ diff --git a/assets/images/._logo.png b/assets/images/._logo.png new file mode 100644 index 00000000000..adf7fcecb57 Binary files /dev/null and b/assets/images/._logo.png differ diff --git a/assets/images/._phoneImage.png b/assets/images/._phoneImage.png new file mode 100644 index 00000000000..f5256a866be Binary files /dev/null and b/assets/images/._phoneImage.png differ diff --git a/assets/images/._post1.jpeg b/assets/images/._post1.jpeg new file mode 100644 index 00000000000..56560315816 Binary files /dev/null and b/assets/images/._post1.jpeg differ diff --git a/assets/images/._post2.jpeg b/assets/images/._post2.jpeg new file mode 100644 index 00000000000..a9dbed3b09f Binary files /dev/null and b/assets/images/._post2.jpeg differ diff --git a/assets/images/._post3.jpeg b/assets/images/._post3.jpeg new file mode 100644 index 00000000000..32dcc376297 Binary files /dev/null and b/assets/images/._post3.jpeg differ diff --git a/assets/images/._profile.jpeg b/assets/images/._profile.jpeg new file mode 100644 index 00000000000..04627eb0125 Binary files /dev/null and b/assets/images/._profile.jpeg differ diff --git a/assets/images/.nfs.20051025.0103 b/assets/images/.nfs.20051025.0103 new file mode 100644 index 00000000000..2f41e5b21e3 Binary files /dev/null and b/assets/images/.nfs.20051025.0103 differ diff --git a/assets/images/android.png b/assets/images/android.png new file mode 100644 index 00000000000..306aa45f29e Binary files /dev/null and b/assets/images/android.png differ diff --git a/assets/images/ios.png b/assets/images/ios.png new file mode 100644 index 00000000000..460f81ab32d Binary files /dev/null and b/assets/images/ios.png differ diff --git a/assets/images/loginLogo.png b/assets/images/loginLogo.png new file mode 100644 index 00000000000..332881b2ad3 Binary files /dev/null and b/assets/images/loginLogo.png differ diff --git a/assets/images/logo.png b/assets/images/logo.png new file mode 100644 index 00000000000..e2ab02a7522 Binary files /dev/null and b/assets/images/logo.png differ diff --git a/assets/images/phoneImage.png b/assets/images/phoneImage.png new file mode 100644 index 00000000000..949173e7366 Binary files /dev/null and b/assets/images/phoneImage.png differ diff --git a/assets/images/post1.jpeg b/assets/images/post1.jpeg new file mode 100644 index 00000000000..b9ec90a97cf Binary files /dev/null and b/assets/images/post1.jpeg differ diff --git a/assets/images/post2.jpeg b/assets/images/post2.jpeg new file mode 100644 index 00000000000..75a22320928 Binary files /dev/null and b/assets/images/post2.jpeg differ diff --git a/assets/images/post3.jpeg b/assets/images/post3.jpeg new file mode 100644 index 00000000000..8982f0b2eda Binary files /dev/null and b/assets/images/post3.jpeg differ diff --git a/assets/images/profile.jpeg b/assets/images/profile.jpeg new file mode 100644 index 00000000000..f0b79457e52 Binary files /dev/null and b/assets/images/profile.jpeg differ diff --git a/composer.json b/composer.json index 39c7e77c4d9..30630e2243a 100644 --- a/composer.json +++ b/composer.json @@ -5,19 +5,19 @@ "homepage": "https://codeigniter.com", "license": "MIT", "support": { - "forum": "https://forum.codeigniter.com/", + "forum": "http://forum.codeigniter.com/", "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki", "slack": "https://codeigniterchat.slack.com", "source": "https://github.com/bcit-ci/CodeIgniter" }, "require": { - "php": ">=5.4.8" + "php": ">=5.3.7" }, "suggest": { "paragonie/random_compat": "Provides better randomness in PHP 5.x" }, "require-dev": { - "mikey179/vfsstream": "1.1.*", + "mikey179/vfsStream": "1.1.*", "phpunit/phpunit": "4.* || 5.*" } } diff --git a/contributing.md b/contributing.md index 8f43c45a652..703fe8f44a2 100644 --- a/contributing.md +++ b/contributing.md @@ -28,14 +28,14 @@ If you change anything that requires a change to documentation then you will nee ### Compatibility -CodeIgniter recommends PHP 5.5 or newer to be used, but it should be +CodeIgniter recommends PHP 5.4 or newer to be used, but it should be compatible with PHP 5.2.4 so all code supplied must stick to this requirement. If PHP 5.3 (and above) functions or features are used then there must be a fallback for PHP 5.2.4. ### Branching -CodeIgniter uses the [Git-Flow](https://nvie.com/posts/a-successful-git-branching-model/) branching model which requires all pull requests to be sent to the "develop" branch. This is +CodeIgniter uses the [Git-Flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model which requires all pull requests to be sent to the "develop" branch. This is where the next planned version will be developed. The "master" branch will always contain the latest stable version and is kept clean so a "hotfix" (e.g: an emergency security patch) can be applied to master to create a new version, without worrying about other features holding it up. For this reason all commits need to be made to "develop" and any sent to "master" will be closed automatically. If you have multiple changes to submit, please place all changes into their own branch on your fork. One thing at a time: A pull request should only contain one change. That does not mean only one commit, but one change - however many commits it took. The reason for this is that if you change X and Y but send a pull request for both at the same time, we might really want X but disagree with Y, meaning we cannot merge the request. Using the Git-Flow branching model you can create new branches for both of these features and send two requests. @@ -54,7 +54,7 @@ This will sign your commits with the information setup in your git config, e.g. `Signed-off-by: John Q Public ` -If you are using [Tower](https://www.git-tower.com/) there is a "Sign-Off" checkbox in the commit window. You could even alias git commit to use the `-s` flag so you don’t have to think about it. +If you are using [Tower](http://www.git-tower.com/) there is a "Sign-Off" checkbox in the commit window. You could even alias git commit to use the `-s` flag so you don’t have to think about it. By signing your work in this manner, you certify to a "Developer's Certificate of Origin". The current version of this certificate is in the `DCO.txt` file in the root of this repository. diff --git a/index.php b/index.php index e7aab3b0381..e50550472ae 100755 --- a/index.php +++ b/index.php @@ -73,7 +73,14 @@ case 'testing': case 'production': ini_set('display_errors', 0); - error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); + if (version_compare(PHP_VERSION, '5.3', '>=')) + { + error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); + } + else + { + error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); + } break; default: diff --git a/readme.rst b/readme.rst index 3e1382fbd8a..b6520080e91 100644 --- a/readme.rst +++ b/readme.rst @@ -31,7 +31,7 @@ Server Requirements PHP version 5.6 or newer is recommended. -It should work on 5.4.8 as well, but we strongly advise you NOT to run +It should work on 5.3.7 as well, but we strongly advise you NOT to run such old versions of PHP, because of potential security and performance issues, as well as missing features. @@ -55,7 +55,7 @@ Resources - `User Guide `_ - `Language File Translations `_ -- `Community Forums `_ +- `Community Forums `_ - `Community Wiki `_ - `Community Slack Channel `_ diff --git a/system._core b/system._core new file mode 100644 index 00000000000..c7a18685ca3 Binary files /dev/null and b/system._core differ diff --git a/system._fonts b/system._fonts new file mode 100644 index 00000000000..d5531b9c548 Binary files /dev/null and b/system._fonts differ diff --git a/system/._.htaccess b/system/._.htaccess new file mode 100644 index 00000000000..7032a0159f8 Binary files /dev/null and b/system/._.htaccess differ diff --git a/system/._database b/system/._database new file mode 100644 index 00000000000..f40ff174700 Binary files /dev/null and b/system/._database differ diff --git a/system/._helpers b/system/._helpers new file mode 100644 index 00000000000..54e8291530f Binary files /dev/null and b/system/._helpers differ diff --git a/system/._index.html b/system/._index.html new file mode 100644 index 00000000000..4eea2b46aa8 Binary files /dev/null and b/system/._index.html differ diff --git a/system/._language b/system/._language new file mode 100644 index 00000000000..45cc1c20404 Binary files /dev/null and b/system/._language differ diff --git a/system/._libraries b/system/._libraries new file mode 100644 index 00000000000..77cedb66cc3 Binary files /dev/null and b/system/._libraries differ diff --git a/system/core/._Benchmark.php b/system/core/._Benchmark.php new file mode 100644 index 00000000000..5e663459551 Binary files /dev/null and b/system/core/._Benchmark.php differ diff --git a/system/core/._CodeIgniter.php b/system/core/._CodeIgniter.php new file mode 100644 index 00000000000..e47374ff319 Binary files /dev/null and b/system/core/._CodeIgniter.php differ diff --git a/system/core/._Common.php b/system/core/._Common.php new file mode 100644 index 00000000000..75e0437e89a Binary files /dev/null and b/system/core/._Common.php differ diff --git a/system/core/._Config.php b/system/core/._Config.php new file mode 100644 index 00000000000..f313ecf5a17 Binary files /dev/null and b/system/core/._Config.php differ diff --git a/system/core/._Controller.php b/system/core/._Controller.php new file mode 100644 index 00000000000..47789ceaf41 Binary files /dev/null and b/system/core/._Controller.php differ diff --git a/system/core/._Exceptions.php b/system/core/._Exceptions.php new file mode 100644 index 00000000000..c15ffd534df Binary files /dev/null and b/system/core/._Exceptions.php differ diff --git a/system/core/._Hooks.php b/system/core/._Hooks.php new file mode 100644 index 00000000000..79d5327a77c Binary files /dev/null and b/system/core/._Hooks.php differ diff --git a/system/core/._Input.php b/system/core/._Input.php new file mode 100644 index 00000000000..09fb7ed1119 Binary files /dev/null and b/system/core/._Input.php differ diff --git a/system/core/._Lang.php b/system/core/._Lang.php new file mode 100644 index 00000000000..0c36965a7d0 Binary files /dev/null and b/system/core/._Lang.php differ diff --git a/system/core/._Loader.php b/system/core/._Loader.php new file mode 100644 index 00000000000..98c32471059 Binary files /dev/null and b/system/core/._Loader.php differ diff --git a/system/core/._Log.php b/system/core/._Log.php new file mode 100644 index 00000000000..741a4647e96 Binary files /dev/null and b/system/core/._Log.php differ diff --git a/system/core/._Model.php b/system/core/._Model.php new file mode 100644 index 00000000000..44575e77b2e Binary files /dev/null and b/system/core/._Model.php differ diff --git a/system/core/._Output.php b/system/core/._Output.php new file mode 100644 index 00000000000..1beac37c1a7 Binary files /dev/null and b/system/core/._Output.php differ diff --git a/system/core/._Router.php b/system/core/._Router.php new file mode 100644 index 00000000000..96196a7b381 Binary files /dev/null and b/system/core/._Router.php differ diff --git a/system/core/._Security.php b/system/core/._Security.php new file mode 100644 index 00000000000..c9d5f3fa2c8 Binary files /dev/null and b/system/core/._Security.php differ diff --git a/system/core/._URI.php b/system/core/._URI.php new file mode 100644 index 00000000000..9e35db6337f Binary files /dev/null and b/system/core/._URI.php differ diff --git a/system/core/._Utf8.php b/system/core/._Utf8.php new file mode 100644 index 00000000000..14dbace7edf Binary files /dev/null and b/system/core/._Utf8.php differ diff --git a/system/core/._compat b/system/core/._compat new file mode 100644 index 00000000000..50aa89515d6 Binary files /dev/null and b/system/core/._compat differ diff --git a/system/core/._index.html b/system/core/._index.html new file mode 100644 index 00000000000..5d1c1693ba7 Binary files /dev/null and b/system/core/._index.html differ diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 9bf60a4ac6e..8aecc0a27f4 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -55,7 +55,7 @@ * @var string * */ - const CI_VERSION = '3.2.0-dev'; + const CI_VERSION = '3.1.11'; /* * ------------------------------------------------------ @@ -79,6 +79,57 @@ */ require_once(BASEPATH.'core/Common.php'); + +/* + * ------------------------------------------------------ + * Security procedures + * ------------------------------------------------------ + */ + +if ( ! is_php('5.4')) +{ + ini_set('magic_quotes_runtime', 0); + + if ((bool) ini_get('register_globals')) + { + $_protected = array( + '_SERVER', + '_GET', + '_POST', + '_FILES', + '_REQUEST', + '_SESSION', + '_ENV', + '_COOKIE', + 'GLOBALS', + 'HTTP_RAW_POST_DATA', + 'system_path', + 'application_folder', + 'view_folder', + '_protected', + '_registered' + ); + + $_registered = ini_get('variables_order'); + foreach (array('E' => '_ENV', 'G' => '_GET', 'P' => '_POST', 'C' => '_COOKIE', 'S' => '_SERVER') as $key => $superglobal) + { + if (strpos($_registered, $key) === FALSE) + { + continue; + } + + foreach (array_keys($$superglobal) as $var) + { + if (isset($GLOBALS[$var]) && ! in_array($var, $_protected, TRUE)) + { + $GLOBALS[$var] = NULL; + } + } + } + } +} + + /* * ------------------------------------------------------ * Define a custom error handler so we can log PHP errors @@ -141,6 +192,20 @@ $BM->mark('total_execution_time_start'); $BM->mark('loading_time:_base_classes_start'); +/* + * ------------------------------------------------------ + * Instantiate the hooks class + * ------------------------------------------------------ + */ + $EXT =& load_class('Hooks', 'core'); + +/* + * ------------------------------------------------------ + * Is there a "pre_system" hook? + * ------------------------------------------------------ + */ + $EXT->call_hook('pre_system'); + /* * ------------------------------------------------------ * Instantiate the config class @@ -162,20 +227,6 @@ } } -/* - * ------------------------------------------------------ - * Instantiate the hooks class - * ------------------------------------------------------ - */ - $EXT =& load_class('Hooks', 'core', $CFG); - -/* - * ------------------------------------------------------ - * Is there a "pre_system" hook? - * ------------------------------------------------------ - */ - $EXT->call_hook('pre_system'); - /* * ------------------------------------------------------ * Important charset-related stuff @@ -243,14 +294,14 @@ * Instantiate the UTF-8 class * ------------------------------------------------------ */ - $UNI =& load_class('Utf8', 'core', $charset); + $UNI =& load_class('Utf8', 'core'); /* * ------------------------------------------------------ * Instantiate the URI class * ------------------------------------------------------ */ - $URI =& load_class('URI', 'core', $CFG); + $URI =& load_class('URI', 'core'); /* * ------------------------------------------------------ @@ -281,14 +332,14 @@ * Load the security class for xss and csrf support * ----------------------------------------------------- */ - $SEC =& load_class('Security', 'core', $charset); + $SEC =& load_class('Security', 'core'); /* * ------------------------------------------------------ * Load the Input class and sanitize globals * ------------------------------------------------------ */ - $IN =& load_class('Input', 'core', $SEC); + $IN =& load_class('Input', 'core'); /* * ------------------------------------------------------ diff --git a/system/core/Common.php b/system/core/Common.php index fadc0a0b182..624b5a9f776 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -81,7 +81,8 @@ function is_php($version) * Tests for file writability * * is_writable() returns TRUE on Windows servers when you really can't write to - * the file, based on the read-only attribute. + * the file, based on the read-only attribute. is_writable() is also unreliable + * on Unix servers if safe_mode is on. * * @link https://bugs.php.net/bug.php?id=54709 * @param string @@ -89,8 +90,8 @@ function is_php($version) */ function is_really_writable($file) { - // If we're on a UNIX-like server, just is_writable() - if (DIRECTORY_SEPARATOR === '/') + // If we're on a Unix server with safe_mode off we call is_writable + if (DIRECTORY_SEPARATOR === '/' && (is_php('5.4') OR ! ini_get('safe_mode'))) { return is_writable($file); } @@ -498,7 +499,6 @@ function set_status_header($code = 200, $text = '') $stati = array( 100 => 'Continue', 101 => 'Switching Protocols', - 103 => 'Early Hints', 200 => 'OK', 201 => 'Created', @@ -507,7 +507,6 @@ function set_status_header($code = 200, $text = '') 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', - 207 => 'Multi-Status', 300 => 'Multiple Choices', 301 => 'Moved Permanently', @@ -516,7 +515,6 @@ function set_status_header($code = 200, $text = '') 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', - 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', @@ -536,13 +534,11 @@ function set_status_header($code = 200, $text = '') 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', - 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', - 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', @@ -629,7 +625,7 @@ function _error_handler($severity, $message, $filepath, $line) // If the error is fatal, the execution of the script should be stopped because // errors can't be recovered from. Halting the script conforms with PHP's - // default error handling. See https://secure.php.net/manual/en/errorfunc.constants.php + // default error handling. See http://www.php.net/manual/en/errorfunc.constants.php if ($is_error) { exit(1); // EXIT_ERROR diff --git a/system/core/Config.php b/system/core/Config.php index 13cc087d020..fc6c30f866f 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -169,7 +169,7 @@ public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE $this->is_loaded[] = $file_path; $config = NULL; $loaded = TRUE; - log_message('info', 'Config file loaded: '.$file_path); + log_message('debug', 'Config file loaded: '.$file_path); } } @@ -350,6 +350,20 @@ protected function _uri_string($uri) // -------------------------------------------------------------------- + /** + * System URL + * + * @deprecated 3.0.0 Encourages insecure practices + * @return string + */ + public function system_url() + { + $x = explode('/', preg_replace('|/*(.+?)/*$|', '\\1', BASEPATH)); + return $this->slash_item('base_url').end($x).'/'; + } + + // -------------------------------------------------------------------- + /** * Set a config file item * diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index e8e7f6c2939..90ff1abf4bb 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -161,10 +161,6 @@ public function show_error($heading, $message, $template = 'error_general', $sta { $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } - else - { - $templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR; - } if (is_cli()) { @@ -198,10 +194,6 @@ public function show_exception($exception) { $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } - else - { - $templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR; - } $message = $exception->getMessage(); if (empty($message)) @@ -248,10 +240,6 @@ public function show_php_error($severity, $message, $filepath, $line) { $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } - else - { - $templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR; - } $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 353e22e214f..6236dd498c1 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -83,16 +83,16 @@ class CI_Hooks { /** * Class constructor * - * @param CI_Config $config * @return void */ - public function __construct(CI_Config $config) + public function __construct() { + $CFG =& load_class('Config', 'core'); log_message('info', 'Hooks Class Initialized'); // If hooks are not enabled in the config file // there is nothing else to do - if ($config->item('enable_hooks') === FALSE) + if ($CFG->item('enable_hooks') === FALSE) { return; } diff --git a/system/core/Input.php b/system/core/Input.php index 053970b01a3..30b31d0d725 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -57,6 +57,45 @@ class CI_Input { */ protected $ip_address = FALSE; + /** + * Allow GET array flag + * + * If set to FALSE, then $_GET will be set to an empty array. + * + * @var bool + */ + protected $_allow_get_array = TRUE; + + /** + * Standardize new lines flag + * + * If set to TRUE, then newlines are standardized. + * + * @var bool + */ + protected $_standardize_newlines; + + /** + * Enable XSS flag + * + * Determines whether the XSS filter is always active when + * GET, POST or COOKIE data is encountered. + * Set automatically based on config setting. + * + * @var bool + */ + protected $_enable_xss = FALSE; + + /** + * Enable CSRF flag + * + * Enables a CSRF cookie token to be set. + * Set automatically based on config setting. + * + * @var bool + */ + protected $_enable_csrf = FALSE; + /** * List of all HTTP request headers * @@ -83,15 +122,8 @@ class CI_Input { */ protected $_input_stream; - /** - * CI_Security instance - * - * Used for the optional $xss_filter parameter that most - * getter methods have here. - * - * @var CI_Security - */ protected $security; + protected $uni; // -------------------------------------------------------------------- @@ -103,9 +135,30 @@ class CI_Input { * * @return void */ - public function __construct(CI_Security &$security) + public function __construct() { - $this->security = $security; + $this->_allow_get_array = (config_item('allow_get_array') !== FALSE); + $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); + $this->_enable_csrf = (config_item('csrf_protection') === TRUE); + $this->_standardize_newlines = (bool) config_item('standardize_newlines'); + + $this->security =& load_class('Security', 'core'); + + // Do we need the UTF-8 class? + if (UTF8_ENABLED === TRUE) + { + $this->uni =& load_class('Utf8', 'core'); + } + + // Sanitize global arrays + $this->_sanitize_globals(); + + // CSRF Protection check + if ($this->_enable_csrf === TRUE && ! is_cli()) + { + $this->security->csrf_verify(); + } + log_message('info', 'Input Class Initialized'); } @@ -121,8 +174,10 @@ public function __construct(CI_Security &$security) * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = FALSE) + protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = NULL) { + is_bool($xss_clean) OR $xss_clean = $this->_enable_xss; + // If $index is NULL, it means that the whole $array is requested isset($index) OR $index = array_keys($array); @@ -182,7 +237,7 @@ protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = FALSE) * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - public function get($index = NULL, $xss_clean = FALSE) + public function get($index = NULL, $xss_clean = NULL) { return $this->_fetch_from_array($_GET, $index, $xss_clean); } @@ -196,7 +251,7 @@ public function get($index = NULL, $xss_clean = FALSE) * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - public function post($index = NULL, $xss_clean = FALSE) + public function post($index = NULL, $xss_clean = NULL) { return $this->_fetch_from_array($_POST, $index, $xss_clean); } @@ -210,10 +265,11 @@ public function post($index = NULL, $xss_clean = FALSE) * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - public function post_get($index, $xss_clean = FALSE) + public function post_get($index, $xss_clean = NULL) { - $output = $this->post($index, $xss_clean); - return isset($output) ? $output : $this->get($index, $xss_clean); + return isset($_POST[$index]) + ? $this->post($index, $xss_clean) + : $this->get($index, $xss_clean); } // -------------------------------------------------------------------- @@ -225,10 +281,11 @@ public function post_get($index, $xss_clean = FALSE) * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - public function get_post($index, $xss_clean = FALSE) + public function get_post($index, $xss_clean = NULL) { - $output = $this->get($index, $xss_clean); - return isset($output) ? $output : $this->post($index, $xss_clean); + return isset($_GET[$index]) + ? $this->get($index, $xss_clean) + : $this->post($index, $xss_clean); } // -------------------------------------------------------------------- @@ -240,7 +297,7 @@ public function get_post($index, $xss_clean = FALSE) * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - public function cookie($index = NULL, $xss_clean = FALSE) + public function cookie($index = NULL, $xss_clean = NULL) { return $this->_fetch_from_array($_COOKIE, $index, $xss_clean); } @@ -254,7 +311,7 @@ public function cookie($index = NULL, $xss_clean = FALSE) * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - public function server($index, $xss_clean = FALSE) + public function server($index, $xss_clean = NULL) { return $this->_fetch_from_array($_SERVER, $index, $xss_clean); } @@ -270,7 +327,7 @@ public function server($index, $xss_clean = FALSE) * @param bool $xss_clean Whether to apply XSS filtering * @return mixed */ - public function input_stream($index = NULL, $xss_clean = FALSE) + public function input_stream($index = NULL, $xss_clean = NULL) { // Prior to PHP 5.6, the input stream can only be read once, // so we'll need to check if we have already done that first. @@ -302,7 +359,7 @@ public function input_stream($index = NULL, $xss_clean = FALSE) * @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript) * @return void */ - public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL) + public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL) { if (is_array($name)) { @@ -339,9 +396,9 @@ public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path ? (bool) config_item('cookie_httponly') : (bool) $httponly; - if ( ! is_numeric($expire) OR $expire < 0) + if ( ! is_numeric($expire)) { - $expire = 1; + $expire = time() - 86500; } else { @@ -522,13 +579,174 @@ public function valid_ip($ip, $which = '') * * @return string|null User Agent string or NULL if it doesn't exist */ - public function user_agent($xss_clean = FALSE) + public function user_agent($xss_clean = NULL) { return $this->_fetch_from_array($_SERVER, 'HTTP_USER_AGENT', $xss_clean); } // -------------------------------------------------------------------- + /** + * Sanitize Globals + * + * Internal method serving for the following purposes: + * + * - Unsets $_GET data, if query strings are not enabled + * - Cleans POST, COOKIE and SERVER data + * - Standardizes newline characters to PHP_EOL + * + * @return void + */ + protected function _sanitize_globals() + { + // Is $_GET data allowed? If not we'll set the $_GET to an empty array + if ($this->_allow_get_array === FALSE) + { + $_GET = array(); + } + elseif (is_array($_GET)) + { + foreach ($_GET as $key => $val) + { + $_GET[$this->_clean_input_keys($key)] = $this->_clean_input_data($val); + } + } + + // Clean $_POST Data + if (is_array($_POST)) + { + foreach ($_POST as $key => $val) + { + $_POST[$this->_clean_input_keys($key)] = $this->_clean_input_data($val); + } + } + + // Clean $_COOKIE Data + if (is_array($_COOKIE)) + { + // Also get rid of specially treated cookies that might be set by a server + // or silly application, that are of no use to a CI application anyway + // but that when present will trip our 'Disallowed Key Characters' alarm + // http://www.ietf.org/rfc/rfc2109.txt + // note that the key names below are single quoted strings, and are not PHP variables + unset( + $_COOKIE['$Version'], + $_COOKIE['$Path'], + $_COOKIE['$Domain'] + ); + + foreach ($_COOKIE as $key => $val) + { + if (($cookie_key = $this->_clean_input_keys($key)) !== FALSE) + { + $_COOKIE[$cookie_key] = $this->_clean_input_data($val); + } + else + { + unset($_COOKIE[$key]); + } + } + } + + // Sanitize PHP_SELF + $_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']); + + log_message('debug', 'Global POST, GET and COOKIE data sanitized'); + } + + // -------------------------------------------------------------------- + + /** + * Clean Input Data + * + * Internal method that aids in escaping data and + * standardizing newline characters to PHP_EOL. + * + * @param string|string[] $str Input string(s) + * @return string + */ + protected function _clean_input_data($str) + { + if (is_array($str)) + { + $new_array = array(); + foreach (array_keys($str) as $key) + { + $new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($str[$key]); + } + return $new_array; + } + + /* We strip slashes if magic quotes is on to keep things consistent + + NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and + it will probably not exist in future versions at all. + */ + if ( ! is_php('5.4') && get_magic_quotes_gpc()) + { + $str = stripslashes($str); + } + + // Clean UTF-8 if supported + if (UTF8_ENABLED === TRUE) + { + $str = $this->uni->clean_string($str); + } + + // Remove control characters + $str = remove_invisible_characters($str, FALSE); + + // Standardize newlines if needed + if ($this->_standardize_newlines === TRUE) + { + return preg_replace('/(?:\r\n|[\r\n])/', PHP_EOL, $str); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Clean Keys + * + * Internal method that helps to prevent malicious users + * from trying to exploit keys we make sure that keys are + * only named with alpha-numeric text and a few other items. + * + * @param string $str Input string + * @param bool $fatal Whether to terminate script exection + * or to return FALSE if an invalid + * key is encountered + * @return string|bool + */ + protected function _clean_input_keys($str, $fatal = TRUE) + { + if ( ! preg_match('/^[a-z0-9:_\/|-]+$/i', $str)) + { + if ($fatal === TRUE) + { + return FALSE; + } + else + { + set_status_header(503); + echo 'Disallowed Key Characters.'; + exit(7); // EXIT_USER_INPUT + } + } + + // Clean UTF-8 if supported + if (UTF8_ENABLED === TRUE) + { + return $this->uni->clean_string($str); + } + + return $str; + } + + // -------------------------------------------------------------------- + /** * Request Headers * @@ -620,6 +838,21 @@ public function is_ajax_request() // -------------------------------------------------------------------- + /** + * Is CLI request? + * + * Test to see if a request was made from the command line. + * + * @deprecated 3.0.0 Use is_cli() instead + * @return bool + */ + public function is_cli_request() + { + return is_cli(); + } + + // -------------------------------------------------------------------- + /** * Get Request Method * diff --git a/system/core/Loader.php b/system/core/Loader.php index 0710b1611a3..14888e49a5d 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -348,10 +348,9 @@ public function model($model, $name = '', $db_conn = FALSE) throw new RuntimeException('Unable to locate the model you have specified: '.$model); } } - - if ( ! is_subclass_of($model, 'CI_Model')) + elseif ( ! is_subclass_of($model, 'CI_Model')) { - throw new RuntimeException("Class ".$model." doesn't extend CI_Model"); + throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model"); } $this->_ci_models[] = $name; @@ -944,7 +943,7 @@ protected function _ci_load($_ci_data) empty($_ci_vars) OR $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars); extract($this->_ci_cached_vars); - /** + /* * Buffer the output * * We buffer the output for two reasons: @@ -957,7 +956,18 @@ protected function _ci_load($_ci_data) */ ob_start(); - include($_ci_path); // include() vs include_once() allows for multiple views with the same name + // If the PHP installation does not support short tags we'll + // do a little string replacement, changing the short tags + // to standard PHP echo statements. + if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) + { + echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('_log_path = ($config['log_path'] !== '') - ? rtrim($config['log_path'], '/\\').DIRECTORY_SEPARATOR : APPPATH.'logs'.DIRECTORY_SEPARATOR; - + $this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/'; $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') ? ltrim($config['log_file_extension'], '.') : 'php'; @@ -285,6 +283,9 @@ protected static function substr($str, $start, $length = NULL) { if (self::$func_overload) { + // mb_substr($str, $start, null, '8bit') returns an empty + // string on PHP 5.3 + isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); return mb_substr($str, $start, $length, '8bit'); } diff --git a/system/core/Model.php b/system/core/Model.php index 4c497d21e9e..0aadbcdc830 100644 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -48,6 +48,14 @@ */ class CI_Model { + /** + * Class constructor + * + * @link https://github.com/bcit-ci/CodeIgniter/issues/5332 + * @return void + */ + public function __construct() {} + /** * __get magic * diff --git a/system/core/Output.php b/system/core/Output.php index f386d3ad455..64e7ee1f91a 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -412,7 +412,7 @@ public function cache($time) * @param string $output Output data override * @return void */ - public function _display($output = NULL) + public function _display($output = '') { // Note: We use load_class() because we can't use $CI =& get_instance() // since this function is sometimes called by the caching mechanism, @@ -429,7 +429,7 @@ public function _display($output = NULL) // -------------------------------------------------------------------- // Set the output data - if ($output === NULL) + if ($output === '') { $output =& $this->final_output; } @@ -502,7 +502,7 @@ public function _display($output = NULL) echo $output; log_message('info', 'Final output sent to browser'); - log_message('info', 'Total execution time: '.$elapsed); + log_message('debug', 'Total execution time: '.$elapsed); return; } @@ -539,7 +539,7 @@ public function _display($output = NULL) } log_message('info', 'Final output sent to browser'); - log_message('info', 'Total execution time: '.$elapsed); + log_message('debug', 'Total execution time: '.$elapsed); } // -------------------------------------------------------------------- @@ -554,7 +554,7 @@ public function _write_cache($output) { $CI =& get_instance(); $path = $CI->config->item('cache_path'); - $cache_path = ($path === '') ? APPPATH.'cache'.DIRECTORY_SEPARATOR : rtrim($path, '/\\').DIRECTORY_SEPARATOR; + $cache_path = ($path === '') ? APPPATH.'cache/' : $path; if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) { @@ -563,7 +563,7 @@ public function _write_cache($output) } $uri = $CI->config->item('base_url') - .$CI->config->slash_item('index_page') + .$CI->config->item('index_page') .$CI->uri->uri_string(); if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING'])) @@ -658,7 +658,7 @@ public function _display_cache(&$CFG, &$URI) $cache_path = ($CFG->item('cache_path') === '') ? APPPATH.'cache/' : $CFG->item('cache_path'); // Build the file path. The file name is an MD5 hash of the full URI - $uri = $CFG->item('base_url').$CFG->slash_item('index_page').$URI->uri_string; + $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; if (($cache_query_string = $CFG->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING'])) { @@ -761,7 +761,7 @@ public function delete_cache($uri = '') } } - $cache_path .= md5($CI->config->item('base_url').$CI->config->slash_item('index_page').ltrim($uri, '/')); + $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').ltrim($uri, '/')); if ( ! @unlink($cache_path)) { @@ -829,6 +829,9 @@ protected static function substr($str, $start, $length = NULL) { if (self::$func_overload) { + // mb_substr($str, $start, null, '8bit') returns an empty + // string on PHP 5.3 + isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); return mb_substr($str, $start, $length, '8bit'); } diff --git a/system/core/Router.php b/system/core/Router.php index dcdd1ed1fea..90b69d07a68 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -438,6 +438,19 @@ public function set_class($class) // -------------------------------------------------------------------- + /** + * Fetch the current class + * + * @deprecated 3.0.0 Read the 'class' property instead + * @return string + */ + public function fetch_class() + { + return $this->class; + } + + // -------------------------------------------------------------------- + /** * Set method name * @@ -451,6 +464,19 @@ public function set_method($method) // -------------------------------------------------------------------- + /** + * Fetch the current method + * + * @deprecated 3.0.0 Read the 'method' property instead + * @return string + */ + public function fetch_method() + { + return $this->method; + } + + // -------------------------------------------------------------------- + /** * Set directory name * @@ -469,4 +495,21 @@ public function set_directory($dir, $append = FALSE) $this->directory .= str_replace('.', '', trim($dir, '/')).'/'; } } + + // -------------------------------------------------------------------- + + /** + * Fetch directory + * + * Feches the sub-directory (if any) that contains the requested + * controller class. + * + * @deprecated 3.0.0 Read the 'directory' property instead + * @return string + */ + public function fetch_directory() + { + return $this->directory; + } + } diff --git a/system/core/Security.php b/system/core/Security.php index 5edb67f4eec..6a81faff145 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -169,12 +169,10 @@ class CI_Security { * * @return void */ - public function __construct($charset) + public function __construct() { - $this->charset = $charset; - // Is CSRF protection enabled? - if (config_item('csrf_protection') && ! is_cli()) + if (config_item('csrf_protection')) { // CSRF config foreach (array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key) @@ -193,9 +191,10 @@ public function __construct($charset) // Set the CSRF hash $this->_csrf_set_hash(); - $this->csrf_verify(); } + $this->charset = strtoupper(config_item('charset')); + log_message('info', 'Security Class Initialized'); } @@ -640,7 +639,7 @@ public function get_random_bytes($length) if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE) { // Try not to waste entropy ... - stream_set_chunk_size($fp, $length); + is_php('5.4') && stream_set_chunk_size($fp, $length); $output = fread($fp, $length); fclose($fp); if ($output !== FALSE) @@ -670,7 +669,7 @@ public function get_random_bytes($length) * correctly. html_entity_decode() does not convert entities without * semicolons, so we are left with our own little solution here. Bummer. * - * @link https://secure.php.net/html-entity-decode + * @link http://php.net/html-entity-decode * * @param string $str Input * @param string $charset Character set @@ -685,8 +684,26 @@ public function entity_decode($str, $charset = NULL) static $_entities; - isset($charset) OR $charset = $this->charset; - isset($_entities) OR $_entities = array_map('strtolower', get_html_translation_table(HTML_ENTITIES, ENT_COMPAT | ENT_HTML5, $charset)); + isset($charset) OR $charset = $this->charset; + $flag = is_php('5.4') + ? ENT_COMPAT | ENT_HTML5 + : ENT_COMPAT; + + if ( ! isset($_entities)) + { + $_entities = array_map('strtolower', get_html_translation_table(HTML_ENTITIES, $flag, $charset)); + + // If we're not on PHP 5.4+, add the possibly dangerous HTML 5 + // entities to the array manually + if ($flag === ENT_COMPAT) + { + $_entities[':'] = ':'; + $_entities['('] = '('; + $_entities[')'] = ')'; + $_entities["\n"] = ' '; + $_entities["\t"] = ' '; + } + } do { @@ -711,9 +728,14 @@ public function entity_decode($str, $charset = NULL) // Decode numeric & UTF16 two byte entities $str = html_entity_decode( preg_replace('/(&#(?:x0*[0-9a-f]{2,5}(?![0-9a-f;])|(?:0*\d{2,4}(?![0-9;]))))/iS', '$1;', $str), - ENT_COMPAT | ENT_HTML5, + $flag, $charset ); + + if ($flag === ENT_COMPAT) + { + $str = str_replace(array_values($_entities), array_keys($_entities), $str); + } } while ($str_compare !== $str); return $str; @@ -1065,4 +1087,5 @@ protected function _csrf_set_hash() return $this->_csrf_hash; } + } diff --git a/system/core/URI.php b/system/core/URI.php index 3670ef29d4a..a8b98ae9323 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -96,40 +96,45 @@ class CI_URI { * * @return void */ - public function __construct(CI_Config $config) + public function __construct() { - $this->config = $config; + $this->config =& load_class('Config', 'core'); - // If it's a CLI request, ignore the configuration - if (is_cli()) - { - $this->_set_uri_string($this->_parse_argv(), TRUE); - } // If query strings are enabled, we don't need to parse any segments. - elseif ($this->config->item('enable_query_strings') !== TRUE) + // However, they don't make sense under CLI. + if (is_cli() OR $this->config->item('enable_query_strings') !== TRUE) { $this->_permitted_uri_chars = $this->config->item('permitted_uri_chars'); - $protocol = $this->config->item('uri_protocol'); - empty($protocol) && $protocol = 'REQUEST_URI'; - switch ($protocol) + // If it's a CLI request, ignore the configuration + if (is_cli()) { - case 'AUTO': // For BC purposes only - case 'REQUEST_URI': - $uri = $this->_parse_request_uri(); - break; - case 'QUERY_STRING': - $uri = $this->_parse_query_string(); - break; - case 'PATH_INFO': - default: - $uri = isset($_SERVER[$protocol]) - ? $_SERVER[$protocol] - : $this->_parse_request_uri(); - break; + $uri = $this->_parse_argv(); } + else + { + $protocol = $this->config->item('uri_protocol'); + empty($protocol) && $protocol = 'REQUEST_URI'; - $this->_set_uri_string($uri, FALSE); + switch ($protocol) + { + case 'AUTO': // For BC purposes only + case 'REQUEST_URI': + $uri = $this->_parse_request_uri(); + break; + case 'QUERY_STRING': + $uri = $this->_parse_query_string(); + break; + case 'PATH_INFO': + default: + $uri = isset($_SERVER[$protocol]) + ? $_SERVER[$protocol] + : $this->_parse_request_uri(); + break; + } + } + + $this->_set_uri_string($uri); } log_message('info', 'URI Class Initialized'); @@ -140,66 +145,43 @@ public function __construct(CI_Config $config) /** * Set URI String * - * @param string $str Input URI string - * @param bool $is_cli Whether the input comes from CLI + * @param string $str * @return void */ - protected function _set_uri_string($str, $is_cli = FALSE) + protected function _set_uri_string($str) { - // CLI requests have a bit simpler logic - if ($is_cli) + // Filter out control characters and trim slashes + $this->uri_string = trim(remove_invisible_characters($str, FALSE), '/'); + + if ($this->uri_string !== '') { - if (($this->uri_string = trim($str, '/')) === '') + // Remove the URL suffix, if present + if (($suffix = (string) $this->config->item('url_suffix')) !== '') { - return; + $slen = strlen($suffix); + + if (substr($this->uri_string, -$slen) === $suffix) + { + $this->uri_string = substr($this->uri_string, 0, -$slen); + } } $this->segments[0] = NULL; - foreach (explode('/', $this->uri_string) as $segment) + // Populate the segments array + foreach (explode('/', trim($this->uri_string, '/')) as $val) { - if (($segment = trim($segment)) !== '') + $val = trim($val); + // Filter segments for security + $this->filter_uri($val); + + if ($val !== '') { - $this->segments[] = $segment; + $this->segments[] = $val; } } unset($this->segments[0]); - return; - } - - // Filter out control characters and trim slashes - $this->uri_string = trim(remove_invisible_characters($str, FALSE), '/'); - - if ($this->uri_string === '') - { - return; } - - // Remove the URL suffix, if present - if (($suffix = (string) $this->config->item('url_suffix')) !== '') - { - $slen = strlen($suffix); - - if (substr($this->uri_string, -$slen) === $suffix) - { - $this->uri_string = substr($this->uri_string, 0, -$slen); - } - } - - $this->segments[0] = NULL; - foreach (explode('/', trim($this->uri_string, '/')) as $segment) - { - $segment = trim($segment); - // Filter segments for security - $this->filter_uri($segment); - - if ($segment !== '') - { - $this->segments[] = $segment; - } - } - - unset($this->segments[0]); } // -------------------------------------------------------------------- diff --git a/system/core/Utf8.php b/system/core/Utf8.php index 39954c42850..9ee63e92913 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -57,21 +57,21 @@ class CI_Utf8 { * * @return void */ - public function __construct($charset) + public function __construct() { if ( - defined('PREG_BAD_UTF8_ERROR') // PCRE must support UTF-8 - && (ICONV_ENABLED === TRUE OR MB_ENABLED === TRUE) // iconv or mbstring must be installed - && $charset === 'UTF-8' // Application charset must be UTF-8 - ) + defined('PREG_BAD_UTF8_ERROR') // PCRE must support UTF-8 + && (ICONV_ENABLED === TRUE OR MB_ENABLED === TRUE) // iconv or mbstring must be installed + && strtoupper(config_item('charset')) === 'UTF-8' // Application charset must be UTF-8 + ) { define('UTF8_ENABLED', TRUE); - log_message('info', 'UTF-8 Support Enabled'); + log_message('debug', 'UTF-8 Support Enabled'); } else { define('UTF8_ENABLED', FALSE); - log_message('info', 'UTF-8 Support Disabled'); + log_message('debug', 'UTF-8 Support Disabled'); } log_message('info', 'Utf8 Class Initialized'); diff --git a/system/core/compat/._hash.php b/system/core/compat/._hash.php new file mode 100644 index 00000000000..598576648ac Binary files /dev/null and b/system/core/compat/._hash.php differ diff --git a/system/core/compat/._index.html b/system/core/compat/._index.html new file mode 100644 index 00000000000..0118d28b135 Binary files /dev/null and b/system/core/compat/._index.html differ diff --git a/system/core/compat/._mbstring.php b/system/core/compat/._mbstring.php new file mode 100644 index 00000000000..cac025a3e82 Binary files /dev/null and b/system/core/compat/._mbstring.php differ diff --git a/system/core/compat/._password.php b/system/core/compat/._password.php new file mode 100644 index 00000000000..e234b5813da Binary files /dev/null and b/system/core/compat/._password.php differ diff --git a/system/core/compat/._standard.php b/system/core/compat/._standard.php new file mode 100644 index 00000000000..87e58376d7c Binary files /dev/null and b/system/core/compat/._standard.php differ diff --git a/system/core/compat/hash.php b/system/core/compat/hash.php index 8d905ad6841..8f5510c3f48 100644 --- a/system/core/compat/hash.php +++ b/system/core/compat/hash.php @@ -45,7 +45,7 @@ * @category Compatibility * @author Andrey Andreev * @link https://codeigniter.com/user_guide/ - * @link https://secure.php.net/hash + * @link http://php.net/hash */ // ------------------------------------------------------------------------ @@ -62,7 +62,7 @@ /** * hash_equals() * - * @link https://secure.php.net/hash_equals + * @link http://php.net/hash_equals * @param string $known_string * @param string $user_string * @return bool @@ -108,7 +108,7 @@ function hash_equals($known_string, $user_string) /** * hash_pbkdf2() * - * @link https://secure.php.net/hash_pbkdf2 + * @link http://php.net/hash_pbkdf2 * @param string $algo * @param string $password * @param string $salt @@ -205,6 +205,8 @@ function hash_pbkdf2($algo, $password, $salt, $iterations, $length = 0, $raw_out 'ripemd160' => 64, 'ripemd256' => 64, 'ripemd320' => 64, + 'salsa10' => 64, + 'salsa20' => 64, 'sha1' => 64, 'sha224' => 64, 'sha256' => 64, diff --git a/system/core/compat/index.html b/system/core/compat/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/core/compat/index.html +++ b/system/core/compat/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/core/compat/mbstring.php b/system/core/compat/mbstring.php index 41c86376c5c..552e727192c 100644 --- a/system/core/compat/mbstring.php +++ b/system/core/compat/mbstring.php @@ -45,7 +45,7 @@ * @category Compatibility * @author Andrey Andreev * @link https://codeigniter.com/user_guide/ - * @link https://secure.php.net/mbstring + * @link http://php.net/mbstring */ // ------------------------------------------------------------------------ @@ -65,7 +65,7 @@ * WARNING: This function WILL fall-back to strlen() * if iconv is not available! * - * @link https://secure.php.net/mb_strlen + * @link http://php.net/mb_strlen * @param string $str * @param string $encoding * @return int @@ -92,7 +92,7 @@ function mb_strlen($str, $encoding = NULL) * WARNING: This function WILL fall-back to strpos() * if iconv is not available! * - * @link https://secure.php.net/mb_strpos + * @link http://php.net/mb_strpos * @param string $haystack * @param string $needle * @param int $offset @@ -121,7 +121,7 @@ function mb_strpos($haystack, $needle, $offset = 0, $encoding = NULL) * WARNING: This function WILL fall-back to substr() * if iconv is not available. * - * @link https://secure.php.net/mb_substr + * @link http://php.net/mb_substr * @param string $str * @param int $start * @param int $length diff --git a/system/core/compat/password.php b/system/core/compat/password.php index f6517b46dee..5a3bc207624 100644 --- a/system/core/compat/password.php +++ b/system/core/compat/password.php @@ -45,7 +45,7 @@ * @category Compatibility * @author Andrey Andreev * @link https://codeigniter.com/user_guide/ - * @link https://secure.php.net/password + * @link http://php.net/password */ // ------------------------------------------------------------------------ @@ -67,7 +67,7 @@ /** * password_get_info() * - * @link https://secure.php.net/password_get_info + * @link http://php.net/password_get_info * @param string $hash * @return array */ @@ -86,7 +86,7 @@ function password_get_info($hash) /** * password_hash() * - * @link https://secure.php.net/password_hash + * @link http://php.net/password_hash * @param string $password * @param int $algo * @param array $options @@ -141,7 +141,7 @@ function password_hash($password, $algo, array $options = array()) } // Try not to waste entropy ... - stream_set_chunk_size($fp, 16); + is_php('5.4') && stream_set_chunk_size($fp, 16); $options['salt'] = ''; for ($read = 0; $read < 16; $read = ($func_overload) ? mb_strlen($options['salt'], '8bit') : strlen($options['salt'])) @@ -194,7 +194,7 @@ function password_hash($password, $algo, array $options = array()) /** * password_needs_rehash() * - * @link https://secure.php.net/password_needs_rehash + * @link http://php.net/password_needs_rehash * @param string $hash * @param int $algo * @param array $options @@ -228,7 +228,7 @@ function password_needs_rehash($hash, $algo, array $options = array()) /** * password_verify() * - * @link https://secure.php.net/password_verify + * @link http://php.net/password_verify * @param string $password * @param string $hash * @return bool diff --git a/system/core/compat/standard.php b/system/core/compat/standard.php index 31c39ca257e..2c528fd7cfb 100644 --- a/system/core/compat/standard.php +++ b/system/core/compat/standard.php @@ -61,7 +61,7 @@ /** * array_column() * - * @link https://secure.php.net/array_column + * @link http://php.net/array_column * @param array $array * @param mixed $column_key * @param mixed $index_key @@ -132,3 +132,51 @@ function array_column(array $array, $column_key, $index_key = NULL) return $result; } } + +// ------------------------------------------------------------------------ + +if (is_php('5.4')) +{ + return; +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('hex2bin')) +{ + /** + * hex2bin() + * + * @link http://php.net/hex2bin + * @param string $data + * @return string + */ + function hex2bin($data) + { + if (in_array($type = gettype($data), array('array', 'double', 'object', 'resource'), TRUE)) + { + if ($type === 'object' && method_exists($data, '__toString')) + { + $data = (string) $data; + } + else + { + trigger_error('hex2bin() expects parameter 1 to be string, '.$type.' given', E_USER_WARNING); + return NULL; + } + } + + if (strlen($data) % 2 !== 0) + { + trigger_error('Hexadecimal input string must have an even length', E_USER_WARNING); + return FALSE; + } + elseif ( ! preg_match('/^[0-9a-f]*$/i', $data)) + { + trigger_error('Input string must be hexadecimal string', E_USER_WARNING); + return FALSE; + } + + return pack('H*', $data); + } +} diff --git a/system/core/index.html b/system/core/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/core/index.html +++ b/system/core/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/._DB.php b/system/database/._DB.php new file mode 100644 index 00000000000..69122eebf27 Binary files /dev/null and b/system/database/._DB.php differ diff --git a/system/database/._DB_cache.php b/system/database/._DB_cache.php new file mode 100644 index 00000000000..4afab1c4dff Binary files /dev/null and b/system/database/._DB_cache.php differ diff --git a/system/database/._DB_driver.php b/system/database/._DB_driver.php new file mode 100644 index 00000000000..1124c6d63d8 Binary files /dev/null and b/system/database/._DB_driver.php differ diff --git a/system/database/._DB_forge.php b/system/database/._DB_forge.php new file mode 100644 index 00000000000..4cfca06e247 Binary files /dev/null and b/system/database/._DB_forge.php differ diff --git a/system/database/._DB_query_builder.php b/system/database/._DB_query_builder.php new file mode 100644 index 00000000000..0dc6923ad8a Binary files /dev/null and b/system/database/._DB_query_builder.php differ diff --git a/system/database/._DB_result.php b/system/database/._DB_result.php new file mode 100644 index 00000000000..a1401a03747 Binary files /dev/null and b/system/database/._DB_result.php differ diff --git a/system/database/._DB_utility.php b/system/database/._DB_utility.php new file mode 100644 index 00000000000..b0cd851377e Binary files /dev/null and b/system/database/._DB_utility.php differ diff --git a/system/database/._drivers b/system/database/._drivers new file mode 100644 index 00000000000..c64ba64ed06 Binary files /dev/null and b/system/database/._drivers differ diff --git a/system/database/._index.html b/system/database/._index.html new file mode 100644 index 00000000000..712839a9f74 Binary files /dev/null and b/system/database/._index.html differ diff --git a/system/database/DB.php b/system/database/DB.php index 5582127186b..02e0e1d39a8 100644 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -82,7 +82,7 @@ function &DB($params = '', $query_builder_override = NULL) } } - if (empty($db)) + if ( ! isset($db) OR count($db) === 0) { show_error('No database connection settings were found in the database config file.'); } @@ -185,20 +185,17 @@ class CI_DB extends CI_DB_query_builder { } elseif ( ! class_exists('CI_DB', FALSE)) { /** - * @ignore + * @ignore */ class CI_DB extends CI_DB_driver { } } // Load the DB driver $driver_file = BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php'; + file_exists($driver_file) OR show_error('Invalid DB driver'); require_once($driver_file); - // Load the result classes as well - require_once(BASEPATH.'database/DB_result.php'); - require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_result.php'); - // Instantiate the DB adapter $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; $DB = new $driver($params); diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index f3433f849fe..5ae0442a3fb 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -380,8 +380,7 @@ public function __construct($params) /** * Initialize Database Settings * - * @return void - * @throws RuntimeException In case of failure + * @return bool */ public function initialize() { @@ -393,7 +392,7 @@ public function initialize() */ if ($this->conn_id) { - return; + return TRUE; } // ---------------------------------------------------------------- @@ -430,9 +429,19 @@ public function initialize() // We still don't have a connection? if ( ! $this->conn_id) { - throw new RuntimeException('Unable to connect to the database.'); + log_message('error', 'Unable to connect to the database'); + + if ($this->db_debug) + { + $this->display_error('db_unable_to_connect'); + } + + return FALSE; } } + + // Now we set the character set and that's all + return $this->db_set_charset($this->char_set); } // -------------------------------------------------------------------- @@ -507,6 +516,31 @@ public function error() // -------------------------------------------------------------------- + /** + * Set client character set + * + * @param string + * @return bool + */ + public function db_set_charset($charset) + { + if (method_exists($this, '_db_set_charset') && ! $this->_db_set_charset($charset)) + { + log_message('error', 'Unable to set database connection charset: '.$charset); + + if ($this->db_debug) + { + $this->display_error('db_unable_to_set_charset', $charset); + } + + return FALSE; + } + + return TRUE; + } + + // -------------------------------------------------------------------- + /** * The name of the platform in use (mysql, mssql, etc...) * @@ -600,6 +634,7 @@ public function query($sql, $binds = FALSE, $return_object = NULL) // cached query if it exists if ($this->cache_on === TRUE && $return_object === TRUE && $this->_cache_init()) { + $this->load_rdriver(); if (FALSE !== ($cache = $this->CACHE->read($sql))) { return $cache; @@ -683,9 +718,9 @@ public function query($sql, $binds = FALSE, $return_object = NULL) return TRUE; } - // Instantiate the driver-specific result class - $driver = 'CI_DB_'.$this->dbdriver.'_result'; - $RES = new $driver($this); + // Load and instantiate the result driver + $driver = $this->load_rdriver(); + $RES = new $driver($this); // Is query caching enabled? If so, we'll serialize the // result object and save it to a cache file. @@ -714,6 +749,26 @@ public function query($sql, $binds = FALSE, $return_object = NULL) // -------------------------------------------------------------------- + /** + * Load the result drivers + * + * @return string the name of the result class + */ + public function load_rdriver() + { + $driver = 'CI_DB_'.$this->dbdriver.'_result'; + + if ( ! class_exists($driver, FALSE)) + { + require_once(BASEPATH.'database/DB_result.php'); + require_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result.php'); + } + + return $driver; + } + + // -------------------------------------------------------------------- + /** * Simple Query * This is a simplified version of the query() function. Internally @@ -725,7 +780,14 @@ public function query($sql, $binds = FALSE, $return_object = NULL) */ public function simple_query($sql) { - empty($this->conn_id) && $this->initialize(); + if ( ! $this->conn_id) + { + if ( ! $this->initialize()) + { + return FALSE; + } + } + return $this->_execute($sql); } @@ -825,18 +887,6 @@ public function trans_status() { return $this->_trans_status; } - - // -------------------------------------------------------------------- - - /** - * Returns TRUE if a transaction is currently active - * - * @return bool - */ - public function trans_active() - { - return (bool) $this->_trans_depth; - } // -------------------------------------------------------------------- @@ -1327,11 +1377,10 @@ public function field_data($table) * * This function escapes column and table names * - * @param mixed $item Identifier to escape - * @param bool $split Whether to split identifiers when a dot is encountered + * @param mixed * @return mixed */ - public function escape_identifiers($item, $split = TRUE) + public function escape_identifiers($item) { if ($this->_escape_char === '' OR empty($item) OR in_array($item, $this->_reserved_identifiers)) { @@ -1352,22 +1401,22 @@ public function escape_identifiers($item, $split = TRUE) return $item; } - static $preg_ec; + static $preg_ec = array(); if (empty($preg_ec)) { if (is_array($this->_escape_char)) { $preg_ec = array( - preg_quote($this->_escape_char[0]), - preg_quote($this->_escape_char[1]), + preg_quote($this->_escape_char[0], '/'), + preg_quote($this->_escape_char[1], '/'), $this->_escape_char[0], $this->_escape_char[1] ); } else { - $preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char); + $preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char, '/'); $preg_ec[2] = $preg_ec[3] = $this->_escape_char; } } @@ -1376,13 +1425,11 @@ public function escape_identifiers($item, $split = TRUE) { if (strpos($item, '.'.$id) !== FALSE) { - return preg_replace('#'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\.#i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item); + return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\./i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item); } } - $dot = ($split !== FALSE) ? '\.' : ''; - - return preg_replace('#'.$preg_ec[0].'?([^'.$preg_ec[1].$dot.']+)'.$preg_ec[1].'?(\.)?#i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item); + return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?(\.)?/i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item); } // -------------------------------------------------------------------- @@ -1796,14 +1843,14 @@ public function protect_identifiers($item, $prefix_single = FALSE, $protect_iden if ($offset = strripos($item, ' AS ')) { $alias = ($protect_identifiers) - ? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4), FALSE) + ? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4)) : substr($item, $offset); $item = substr($item, 0, $offset); } elseif ($offset = strrpos($item, ' ')) { $alias = ($protect_identifiers) - ? ' '.$this->escape_identifiers(substr($item, $offset + 1), FALSE) + ? ' '.$this->escape_identifiers(substr($item, $offset + 1)) : substr($item, $offset); $item = substr($item, 0, $offset); } diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index b086f7a8130..85b58fdeb83 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -895,33 +895,21 @@ protected function _attr_default(&$attributes, &$field) return; } - if ( ! array_key_exists('DEFAULT', $attributes)) + if (array_key_exists('DEFAULT', $attributes)) { - return; - } - - if ($attributes['DEFAULT'] === NULL) - { - $field['default'] = empty($this->_null) ? '' : $this->_default.$this->_null; - - // Override the NULL attribute if that's our default - $attributes['NULL'] = TRUE; - $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; - return; - } + if ($attributes['DEFAULT'] === NULL) + { + $field['default'] = empty($this->_null) ? '' : $this->_default.$this->_null; - // White-list CURRENT_TIMESTAMP & similar (e.g. Oracle has stuff like SYSTIMESTAMP) defaults for date/time fields - if ( - isset($attributes['TYPE']) - && (stripos($attributes['TYPE'], 'time') !== FALSE OR stripos($attributes['TYPE'], 'date') !== FALSE) - && (stripos($attributes['DEFAULT'], 'time') !== FALSE OR stripos($attributes['DEFAULT'], 'date') !== FALSE) - ) - { - $field['default'] = $this->_default.$attributes['DEFAULT']; - return; + // Override the NULL attribute if that's our default + $attributes['NULL'] = TRUE; + $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; + } + else + { + $field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']); + } } - - $field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']); } // -------------------------------------------------------------------- diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 357a2e35930..f35b9fd0ab6 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -525,8 +525,19 @@ public function from($from) */ public function join($table, $cond, $type = '', $escape = NULL) { - $type = trim(strtoupper($type).' JOIN'); - preg_match('#^(NATURAL\s+)?((LEFT|RIGHT|FULL)\s+)?((INNER|OUTER)\s+)?JOIN$#', $type) OR $type = 'JOIN'; + if ($type !== '') + { + $type = strtoupper(trim($type)); + + if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'), TRUE)) + { + $type = ''; + } + else + { + $type .= ' '; + } + } // Extract any aliases that might exist. We use this information // in the protect_identifiers to know whether to add a table prefix @@ -534,11 +545,7 @@ public function join($table, $cond, $type = '', $escape = NULL) is_bool($escape) OR $escape = $this->_protect_identifiers; - if (strpos($type, 'NATURAL') === 0) - { - $cond = ''; - } - elseif ( ! $this->_has_operator($cond)) + if ( ! $this->_has_operator($cond)) { $cond = ' USING ('.($escape ? $this->escape_identifiers($cond) : $cond).')'; } @@ -587,7 +594,7 @@ public function join($table, $cond, $type = '', $escape = NULL) } // Assemble the JOIN statement - $this->qb_join[] = $join = $type.' '.$table.$cond; + $this->qb_join[] = $join = $type.'JOIN '.$table.$cond; if ($this->qb_caching === TRUE) { @@ -717,9 +724,9 @@ protected function _wh($qb_key, $key, $value = NULL, $type = 'AND ', $escape = N * @param bool $escape * @return CI_DB_query_builder */ - public function where_in($key, array $values, $escape = NULL) + public function where_in($key = NULL, $values = NULL, $escape = NULL) { - return $this->_wh_in('qb_where', $key, $values, FALSE, 'AND ', $escape); + return $this->_where_in($key, $values, FALSE, 'AND ', $escape); } // -------------------------------------------------------------------- @@ -735,9 +742,9 @@ public function where_in($key, array $values, $escape = NULL) * @param bool $escape * @return CI_DB_query_builder */ - public function or_where_in($key, array $values, $escape = NULL) + public function or_where_in($key = NULL, $values = NULL, $escape = NULL) { - return $this->_wh_in('qb_where', $key, $values, FALSE, 'OR ', $escape); + return $this->_where_in($key, $values, FALSE, 'OR ', $escape); } // -------------------------------------------------------------------- @@ -753,9 +760,9 @@ public function or_where_in($key, array $values, $escape = NULL) * @param bool $escape * @return CI_DB_query_builder */ - public function where_not_in($key, array $values, $escape = NULL) + public function where_not_in($key = NULL, $values = NULL, $escape = NULL) { - return $this->_wh_in('qb_where', $key, $values, TRUE, 'AND ', $escape); + return $this->_where_in($key, $values, TRUE, 'AND ', $escape); } // -------------------------------------------------------------------- @@ -771,98 +778,21 @@ public function where_not_in($key, array $values, $escape = NULL) * @param bool $escape * @return CI_DB_query_builder */ - public function or_where_not_in($key, array $values, $escape = NULL) - { - return $this->_wh_in('qb_where', $key, $values, TRUE, 'OR ', $escape); - } - - // -------------------------------------------------------------------- - - /** - * HAVING IN - * - * Generates a HAVING field IN('item', 'item') SQL query, - * joined with 'AND' if appropriate. - * - * @param string $key The field to search - * @param array $values The values searched on - * @param bool $escape - * @return CI_DB_query_builder - */ - public function having_in($key, array $values, $escape = NULL) - { - return $this->_wh_in('qb_having', $key, $values, FALSE, 'AND ', $escape); - } - - // -------------------------------------------------------------------- - - /** - * OR HAVING IN - * - * Generates a HAVING field IN('item', 'item') SQL query, - * joined with 'OR' if appropriate. - * - * @param string $key The field to search - * @param array $values The values searched on - * @param bool $escape - * @return CI_DB_query_builder - */ - public function or_having_in($key, array $values, $escape = NULL) - { - return $this->_wh_in('qb_having', $key, $values, FALSE, 'OR ', $escape); - } - - // -------------------------------------------------------------------- - - /** - * HAVING NOT IN - * - * Generates a HAVING field NOT IN('item', 'item') SQL query, - * joined with 'AND' if appropriate. - * - * @param string $key The field to search - * @param array $values The values searched on - * @param bool $escape - * @return CI_DB_query_builder - */ - public function having_not_in($key, array $values, $escape = NULL) + public function or_where_not_in($key = NULL, $values = NULL, $escape = NULL) { - return $this->_wh_in('qb_having', $key, $values, TRUE, 'AND ', $escape); + return $this->_where_in($key, $values, TRUE, 'OR ', $escape); } // -------------------------------------------------------------------- /** - * OR HAVING NOT IN - * - * Generates a HAVING field NOT IN('item', 'item') SQL query, - * joined with 'OR' if appropriate. - * - * @param string $key The field to search - * @param array $values The values searched on - * @param bool $escape - * @return CI_DB_query_builder - */ - public function or_having_not_in($key, array $values, $escape = NULL) - { - return $this->_wh_in('qb_having', $key, $values, TRUE, 'OR ', $escape); - } - - // -------------------------------------------------------------------- - - /** - * Internal WHERE/HAVING IN + * Internal WHERE IN * * @used-by where_in() * @used-by or_where_in() * @used-by where_not_in() * @used-by or_where_not_in() - * @used-by having_in() - * @used-by or_having_in() - * @used-by having_not_in() - * @used-by or_having_not_in() * - * @param string $qb_key 'qb_where' or 'qb_having' * @param string $key The field to search * @param array $values The values searched on * @param bool $not If the statement would be IN or NOT IN @@ -870,18 +800,16 @@ public function or_having_not_in($key, array $values, $escape = NULL) * @param bool $escape * @return CI_DB_query_builder */ - protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'AND ', $escape = NULL) + protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ', $escape = NULL) { - $qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where'; - - if (empty($key) OR ! is_string($key)) + if ($key === NULL OR $values === NULL) { - throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function'])); + return $this; } - if (empty($values)) + if ( ! is_array($values)) { - throw new InvalidArgumentException(sprintf('%s() expects $values to be a non-empty array', debug_backtrace(0, 2)[1]['function'])); + $values = array($values); } is_bool($escape) OR $escape = $this->_protect_identifiers; @@ -890,32 +818,32 @@ protected function _wh_in($qb_key, $key, array $values, $not = FALSE, $type = 'A if ($escape === TRUE) { - $wh_in = array(); + $where_in = array(); foreach ($values as $value) { - $wh_in[] = $this->escape($value); + $where_in[] = $this->escape($value); } } else { - $wh_in = array_values($values); + $where_in = array_values($values); } - $prefix = (count($this->$qb_key) === 0 && count($this->$qb_cache_key) === 0) + $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0) ? $this->_group_get_type('') : $this->_group_get_type($type); - $wh_in = array( - 'condition' => $prefix.$key.$not.' IN('.implode(', ', $wh_in).')', + $where_in = array( + 'condition' => $prefix.$key.$not.' IN('.implode(', ', $where_in).')', 'value' => NULL, 'escape' => $escape ); - $this->{$qb_key}[] = $wh_in; + $this->qb_where[] = $where_in; if ($this->qb_caching === TRUE) { - $this->{$qb_cache_key}[] = $wh_in; - $this->qb_cache_exists[] = substr($qb_key, 3); + $this->qb_cache_where[] = $where_in; + $this->qb_cache_exists[] = 'where'; } return $this; @@ -1484,7 +1412,7 @@ public function count_all_results($table = '', $reset = TRUE) $qb_cache_orderby = $this->qb_cache_orderby; $this->qb_orderby = $this->qb_cache_orderby = array(); - $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR ! empty($this->qb_having) OR $this->qb_limit OR $this->qb_offset) + $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR $this->qb_limit OR $this->qb_offset) ? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results") : $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows'))); diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index c2edfc9f378..6642fda8f66 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -235,8 +235,13 @@ public function repair_table($table_name) * @param string $enclosure Enclosure (default: ") * @return string */ - public function csv_from_result(CI_DB_result $query, $delim = ',', $newline = "\n", $enclosure = '"') + public function csv_from_result($query, $delim = ',', $newline = "\n", $enclosure = '"') { + if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) + { + show_error('You must submit a valid result object'); + } + $out = ''; // First generate the headings from the table column names foreach ($query->list_fields() as $name) @@ -269,8 +274,13 @@ public function csv_from_result(CI_DB_result $query, $delim = ',', $newline = "\ * @param array $params Any preferences * @return string */ - public function xml_from_result(CI_DB_result $query, $params = array()) + public function xml_from_result($query, $params = array()) { + if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) + { + show_error('You must submit a valid result object'); + } + // Set our default values foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) { diff --git a/system/database/drivers._ibase b/system/database/drivers._ibase new file mode 100644 index 00000000000..7c8c9eb6f4e Binary files /dev/null and b/system/database/drivers._ibase differ diff --git a/system/database/drivers._mssql b/system/database/drivers._mssql new file mode 100644 index 00000000000..c18fbc7e90c Binary files /dev/null and b/system/database/drivers._mssql differ diff --git a/system/database/drivers._mysql b/system/database/drivers._mysql new file mode 100644 index 00000000000..8b4e9347106 Binary files /dev/null and b/system/database/drivers._mysql differ diff --git a/system/database/drivers._oci8 b/system/database/drivers._oci8 new file mode 100644 index 00000000000..8036cc1f802 Binary files /dev/null and b/system/database/drivers._oci8 differ diff --git a/system/database/drivers._odbc b/system/database/drivers._odbc new file mode 100644 index 00000000000..f4bf71c6a90 Binary files /dev/null and b/system/database/drivers._odbc differ diff --git a/system/database/drivers._pdo b/system/database/drivers._pdo new file mode 100644 index 00000000000..942402043d4 Binary files /dev/null and b/system/database/drivers._pdo differ diff --git a/system/database/drivers/._cubrid b/system/database/drivers/._cubrid new file mode 100644 index 00000000000..3e469572662 Binary files /dev/null and b/system/database/drivers/._cubrid differ diff --git a/system/database/drivers/._index.html b/system/database/drivers/._index.html new file mode 100644 index 00000000000..4d3f244962e Binary files /dev/null and b/system/database/drivers/._index.html differ diff --git a/system/database/drivers/._mysqli b/system/database/drivers/._mysqli new file mode 100644 index 00000000000..4b9c45c46ec Binary files /dev/null and b/system/database/drivers/._mysqli differ diff --git a/system/database/drivers/._postgre b/system/database/drivers/._postgre new file mode 100644 index 00000000000..4bca4120b24 Binary files /dev/null and b/system/database/drivers/._postgre differ diff --git a/system/database/drivers/._sqlite b/system/database/drivers/._sqlite new file mode 100644 index 00000000000..2093dd564ae Binary files /dev/null and b/system/database/drivers/._sqlite differ diff --git a/system/database/drivers/._sqlite3 b/system/database/drivers/._sqlite3 new file mode 100644 index 00000000000..936d77ad756 Binary files /dev/null and b/system/database/drivers/._sqlite3 differ diff --git a/system/database/drivers/._sqlsrv b/system/database/drivers/._sqlsrv new file mode 100644 index 00000000000..f5fa27db5e9 Binary files /dev/null and b/system/database/drivers/._sqlsrv differ diff --git a/system/database/drivers/cubrid/._cubrid_driver.php b/system/database/drivers/cubrid/._cubrid_driver.php new file mode 100644 index 00000000000..87630e8772c Binary files /dev/null and b/system/database/drivers/cubrid/._cubrid_driver.php differ diff --git a/system/database/drivers/cubrid/._cubrid_forge.php b/system/database/drivers/cubrid/._cubrid_forge.php new file mode 100644 index 00000000000..0877d5fcf7b Binary files /dev/null and b/system/database/drivers/cubrid/._cubrid_forge.php differ diff --git a/system/database/drivers/cubrid/._cubrid_result.php b/system/database/drivers/cubrid/._cubrid_result.php new file mode 100644 index 00000000000..4e8cbcac62c Binary files /dev/null and b/system/database/drivers/cubrid/._cubrid_result.php differ diff --git a/system/database/drivers/cubrid/._cubrid_utility.php b/system/database/drivers/cubrid/._cubrid_utility.php new file mode 100644 index 00000000000..5307d5cf9bc Binary files /dev/null and b/system/database/drivers/cubrid/._cubrid_utility.php differ diff --git a/system/database/drivers/cubrid/._index.html b/system/database/drivers/cubrid/._index.html new file mode 100644 index 00000000000..7d467a11258 Binary files /dev/null and b/system/database/drivers/cubrid/._index.html differ diff --git a/system/database/drivers/cubrid/index.html b/system/database/drivers/cubrid/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/cubrid/index.html +++ b/system/database/drivers/cubrid/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/ibase/._ibase_driver.php b/system/database/drivers/ibase/._ibase_driver.php new file mode 100644 index 00000000000..753e8456a26 Binary files /dev/null and b/system/database/drivers/ibase/._ibase_driver.php differ diff --git a/system/database/drivers/ibase/._ibase_forge.php b/system/database/drivers/ibase/._ibase_forge.php new file mode 100644 index 00000000000..c039e9613df Binary files /dev/null and b/system/database/drivers/ibase/._ibase_forge.php differ diff --git a/system/database/drivers/ibase/._ibase_result.php b/system/database/drivers/ibase/._ibase_result.php new file mode 100644 index 00000000000..c3a5dc25664 Binary files /dev/null and b/system/database/drivers/ibase/._ibase_result.php differ diff --git a/system/database/drivers/ibase/._ibase_utility.php b/system/database/drivers/ibase/._ibase_utility.php new file mode 100644 index 00000000000..a1feb765762 Binary files /dev/null and b/system/database/drivers/ibase/._ibase_utility.php differ diff --git a/system/database/drivers/ibase/._index.html b/system/database/drivers/ibase/._index.html new file mode 100644 index 00000000000..3adf8388a1d Binary files /dev/null and b/system/database/drivers/ibase/._index.html differ diff --git a/system/database/drivers/ibase/ibase_forge.php b/system/database/drivers/ibase/ibase_forge.php index ad3382042f4..29a3acf699a 100644 --- a/system/database/drivers/ibase/ibase_forge.php +++ b/system/database/drivers/ibase/ibase_forge.php @@ -140,7 +140,7 @@ public function drop_database($db_name) * @return string|string[] */ protected function _alter_table($alter_type, $table, $field) - { + { if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) { return parent::_alter_table($alter_type, $table, $field); @@ -183,7 +183,7 @@ protected function _alter_table($alter_type, $table, $field) } return $sqls; - } + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/ibase/index.html b/system/database/drivers/ibase/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/ibase/index.html +++ b/system/database/drivers/ibase/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/index.html b/system/database/drivers/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/index.html +++ b/system/database/drivers/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/mssql/._index.html b/system/database/drivers/mssql/._index.html new file mode 100644 index 00000000000..a4197074ce0 Binary files /dev/null and b/system/database/drivers/mssql/._index.html differ diff --git a/system/database/drivers/mssql/._mssql_driver.php b/system/database/drivers/mssql/._mssql_driver.php new file mode 100644 index 00000000000..78cfe665628 Binary files /dev/null and b/system/database/drivers/mssql/._mssql_driver.php differ diff --git a/system/database/drivers/mssql/._mssql_forge.php b/system/database/drivers/mssql/._mssql_forge.php new file mode 100644 index 00000000000..09a6e1d9b24 Binary files /dev/null and b/system/database/drivers/mssql/._mssql_forge.php differ diff --git a/system/database/drivers/mssql/._mssql_result.php b/system/database/drivers/mssql/._mssql_result.php new file mode 100644 index 00000000000..f8fa90acf4b Binary files /dev/null and b/system/database/drivers/mssql/._mssql_result.php differ diff --git a/system/database/drivers/mssql/._mssql_utility.php b/system/database/drivers/mssql/._mssql_utility.php new file mode 100644 index 00000000000..57d8cc12973 Binary files /dev/null and b/system/database/drivers/mssql/._mssql_utility.php differ diff --git a/system/database/drivers/mssql/index.html b/system/database/drivers/mssql/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/mssql/index.html +++ b/system/database/drivers/mssql/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 51352e31427..e197cfb028f 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -108,7 +108,6 @@ public function __construct($params) */ public function db_connect($persistent = FALSE) { - ini_set('mssql.charset', $this->char_set); $this->conn_id = ($persistent) ? mssql_pconnect($this->hostname, $this->username, $this->password) : mssql_connect($this->hostname, $this->username, $this->password); @@ -249,6 +248,19 @@ public function insert_id() // -------------------------------------------------------------------- + /** + * Set client character set + * + * @param string $charset + * @return bool + */ + protected function _db_set_charset($charset) + { + return (ini_set('mssql.charset', $charset) !== FALSE); + } + + // -------------------------------------------------------------------- + /** * Version number query string * diff --git a/system/database/drivers/mysql/._index.html b/system/database/drivers/mysql/._index.html new file mode 100644 index 00000000000..ce3824c4a88 Binary files /dev/null and b/system/database/drivers/mysql/._index.html differ diff --git a/system/database/drivers/mysql/._mysql_driver.php b/system/database/drivers/mysql/._mysql_driver.php new file mode 100644 index 00000000000..cbfbd5c406d Binary files /dev/null and b/system/database/drivers/mysql/._mysql_driver.php differ diff --git a/system/database/drivers/mysql/._mysql_forge.php b/system/database/drivers/mysql/._mysql_forge.php new file mode 100644 index 00000000000..0110d7e37cf Binary files /dev/null and b/system/database/drivers/mysql/._mysql_forge.php differ diff --git a/system/database/drivers/mysql/._mysql_result.php b/system/database/drivers/mysql/._mysql_result.php new file mode 100644 index 00000000000..66a8783b4c9 Binary files /dev/null and b/system/database/drivers/mysql/._mysql_result.php differ diff --git a/system/database/drivers/mysql/._mysql_utility.php b/system/database/drivers/mysql/._mysql_utility.php new file mode 100644 index 00000000000..bf1c2f55a26 Binary files /dev/null and b/system/database/drivers/mysql/._mysql_utility.php differ diff --git a/system/database/drivers/mysql/index.html b/system/database/drivers/mysql/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/mysql/index.html +++ b/system/database/drivers/mysql/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index bdd80092c1d..440715ae16b 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -147,41 +147,29 @@ public function db_connect($persistent = FALSE) : FALSE; } - if (is_resource($this->conn_id)) + if (isset($this->stricton) && is_resource($this->conn_id)) { - if ( ! mysql_set_charset($this->char_set, $this->conn_id)) + if ($this->stricton) { - log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}')."); - $this->close(); - return ($this->db->debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE; + $this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")'); } - - if (isset($this->stricton)) + else { - if ($this->stricton) - { - $this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")'); - } - else - { - $this->simple_query( - 'SET SESSION sql_mode = - REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( - @@sql_mode, - "STRICT_ALL_TABLES,", ""), - ",STRICT_ALL_TABLES", ""), - "STRICT_ALL_TABLES", ""), - "STRICT_TRANS_TABLES,", ""), - ",STRICT_TRANS_TABLES", ""), - "STRICT_TRANS_TABLES", "")' - ); - } + $this->simple_query( + 'SET SESSION sql_mode = + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( + @@sql_mode, + "STRICT_ALL_TABLES,", ""), + ",STRICT_ALL_TABLES", ""), + "STRICT_ALL_TABLES", ""), + "STRICT_TRANS_TABLES,", ""), + ",STRICT_TRANS_TABLES", ""), + "STRICT_TRANS_TABLES", "")' + ); } - - return $this->conn_id; } - return FALSE; + return $this->conn_id; } // -------------------------------------------------------------------- @@ -229,6 +217,19 @@ public function db_select($database = '') // -------------------------------------------------------------------- + /** + * Set client character set + * + * @param string $charset + * @return bool + */ + protected function _db_set_charset($charset) + { + return mysql_set_charset($charset, $this->conn_id); + } + + // -------------------------------------------------------------------- + /** * Database version number * diff --git a/system/database/drivers/mysqli/._index.html b/system/database/drivers/mysqli/._index.html new file mode 100644 index 00000000000..81e612e22f6 Binary files /dev/null and b/system/database/drivers/mysqli/._index.html differ diff --git a/system/database/drivers/mysqli/._mysqli_driver.php b/system/database/drivers/mysqli/._mysqli_driver.php new file mode 100644 index 00000000000..228d671f144 Binary files /dev/null and b/system/database/drivers/mysqli/._mysqli_driver.php differ diff --git a/system/database/drivers/mysqli/._mysqli_forge.php b/system/database/drivers/mysqli/._mysqli_forge.php new file mode 100644 index 00000000000..9234d79ba7d Binary files /dev/null and b/system/database/drivers/mysqli/._mysqli_forge.php differ diff --git a/system/database/drivers/mysqli/._mysqli_result.php b/system/database/drivers/mysqli/._mysqli_result.php new file mode 100644 index 00000000000..1772b0075e7 Binary files /dev/null and b/system/database/drivers/mysqli/._mysqli_result.php differ diff --git a/system/database/drivers/mysqli/._mysqli_utility.php b/system/database/drivers/mysqli/._mysqli_utility.php new file mode 100644 index 00000000000..48be4a9e6bd Binary files /dev/null and b/system/database/drivers/mysqli/._mysqli_utility.php differ diff --git a/system/database/drivers/mysqli/index.html b/system/database/drivers/mysqli/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/mysqli/index.html +++ b/system/database/drivers/mysqli/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 6553a271f9f..0ca0f48fc92 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -215,13 +215,6 @@ public function db_connect($persistent = FALSE) return ($this->db_debug) ? $this->display_error($message, '', TRUE) : FALSE; } - if ( ! $this->_mysqli->set_charset($this->char_set)) - { - log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}')."); - $this->_mysqli->close(); - return ($this->db->db_debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE; - } - return $this->_mysqli; } @@ -273,6 +266,19 @@ public function db_select($database = '') // -------------------------------------------------------------------- + /** + * Set client character set + * + * @param string $charset + * @return bool + */ + protected function _db_set_charset($charset) + { + return $this->conn_id->set_charset($charset); + } + + // -------------------------------------------------------------------- + /** * Database version number * diff --git a/system/database/drivers/oci8/._index.html b/system/database/drivers/oci8/._index.html new file mode 100644 index 00000000000..064f9114465 Binary files /dev/null and b/system/database/drivers/oci8/._index.html differ diff --git a/system/database/drivers/oci8/._oci8_driver.php b/system/database/drivers/oci8/._oci8_driver.php new file mode 100644 index 00000000000..4d1b4a401a5 Binary files /dev/null and b/system/database/drivers/oci8/._oci8_driver.php differ diff --git a/system/database/drivers/oci8/._oci8_forge.php b/system/database/drivers/oci8/._oci8_forge.php new file mode 100644 index 00000000000..af879b3185f Binary files /dev/null and b/system/database/drivers/oci8/._oci8_forge.php differ diff --git a/system/database/drivers/oci8/._oci8_result.php b/system/database/drivers/oci8/._oci8_result.php new file mode 100644 index 00000000000..539324136c1 Binary files /dev/null and b/system/database/drivers/oci8/._oci8_result.php differ diff --git a/system/database/drivers/oci8/._oci8_utility.php b/system/database/drivers/oci8/._oci8_utility.php new file mode 100644 index 00000000000..c595bc0eea3 Binary files /dev/null and b/system/database/drivers/oci8/._oci8_utility.php differ diff --git a/system/database/drivers/oci8/index.html b/system/database/drivers/oci8/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/oci8/index.html +++ b/system/database/drivers/oci8/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index a7389988882..58f3c39137b 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -159,29 +159,7 @@ protected function _alter_table($alter_type, $table, $field) */ protected function _attr_auto_increment(&$attributes, &$field) { - if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'number') !== FALSE && version_compare($this->db->version(), '12.1', '>=')) - { - $field['auto_increment'] = ' GENERATED ALWAYS AS IDENTITY'; - } - } - - // -------------------------------------------------------------------- - - /** - * Process column - * - * @param array $field - * @return string - */ - protected function _process_column($field) - { - return $this->db->escape_identifiers($field['name']) - .' '.$field['type'].$field['length'] - .$field['unsigned'] - .$field['default'] - .$field['auto_increment'] - .$field['null'] - .$field['unique']; + // Not supported - sequences and triggers must be used instead } // -------------------------------------------------------------------- diff --git a/system/database/drivers/odbc/._index.html b/system/database/drivers/odbc/._index.html new file mode 100644 index 00000000000..9a9ed20bf77 Binary files /dev/null and b/system/database/drivers/odbc/._index.html differ diff --git a/system/database/drivers/odbc/._odbc_driver.php b/system/database/drivers/odbc/._odbc_driver.php new file mode 100644 index 00000000000..1b73c1fc77d Binary files /dev/null and b/system/database/drivers/odbc/._odbc_driver.php differ diff --git a/system/database/drivers/odbc/._odbc_forge.php b/system/database/drivers/odbc/._odbc_forge.php new file mode 100644 index 00000000000..08882d903f4 Binary files /dev/null and b/system/database/drivers/odbc/._odbc_forge.php differ diff --git a/system/database/drivers/odbc/._odbc_result.php b/system/database/drivers/odbc/._odbc_result.php new file mode 100644 index 00000000000..d6da29993e8 Binary files /dev/null and b/system/database/drivers/odbc/._odbc_result.php differ diff --git a/system/database/drivers/odbc/._odbc_utility.php b/system/database/drivers/odbc/._odbc_utility.php new file mode 100644 index 00000000000..00b7b6180ed Binary files /dev/null and b/system/database/drivers/odbc/._odbc_utility.php differ diff --git a/system/database/drivers/odbc/index.html b/system/database/drivers/odbc/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/odbc/index.html +++ b/system/database/drivers/odbc/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/pdo/._index.html b/system/database/drivers/pdo/._index.html new file mode 100644 index 00000000000..b5ff6ed753b Binary files /dev/null and b/system/database/drivers/pdo/._index.html differ diff --git a/system/database/drivers/pdo/._pdo_driver.php b/system/database/drivers/pdo/._pdo_driver.php new file mode 100644 index 00000000000..11369065ac7 Binary files /dev/null and b/system/database/drivers/pdo/._pdo_driver.php differ diff --git a/system/database/drivers/pdo/._pdo_forge.php b/system/database/drivers/pdo/._pdo_forge.php new file mode 100644 index 00000000000..6acec2c104b Binary files /dev/null and b/system/database/drivers/pdo/._pdo_forge.php differ diff --git a/system/database/drivers/pdo/._pdo_result.php b/system/database/drivers/pdo/._pdo_result.php new file mode 100644 index 00000000000..135e56423c8 Binary files /dev/null and b/system/database/drivers/pdo/._pdo_result.php differ diff --git a/system/database/drivers/pdo/._pdo_utility.php b/system/database/drivers/pdo/._pdo_utility.php new file mode 100644 index 00000000000..5b9d3f9b7bd Binary files /dev/null and b/system/database/drivers/pdo/._pdo_utility.php differ diff --git a/system/database/drivers/pdo/._subdrivers b/system/database/drivers/pdo/._subdrivers new file mode 100644 index 00000000000..6e7b377d015 Binary files /dev/null and b/system/database/drivers/pdo/._subdrivers differ diff --git a/system/database/drivers/pdo/index.html b/system/database/drivers/pdo/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/pdo/index.html +++ b/system/database/drivers/pdo/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 614d3509691..c5d120fd300 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -302,7 +302,7 @@ public function error() $error['code'] = isset($pdo_error[1]) ? $pdo_error[0].'/'.$pdo_error[1] : $pdo_error[0]; if (isset($pdo_error[2])) { - $error['message'] = $pdo_error[2]; + $error['message'] = $pdo_error[2]; } return $error; diff --git a/system/database/drivers/pdo/subdrivers/._index.html b/system/database/drivers/pdo/subdrivers/._index.html new file mode 100644 index 00000000000..5dd7ad9ba69 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._index.html differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_4d_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_4d_driver.php new file mode 100644 index 00000000000..959cfb0e27a Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_4d_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_4d_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_4d_forge.php new file mode 100644 index 00000000000..95e33a453d3 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_4d_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_cubrid_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_cubrid_driver.php new file mode 100644 index 00000000000..41cea4c812e Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_cubrid_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_cubrid_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_cubrid_forge.php new file mode 100644 index 00000000000..a53f4eb71ff Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_cubrid_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_dblib_driver.php new file mode 100644 index 00000000000..0bc34806e04 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_dblib_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_dblib_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_dblib_forge.php new file mode 100644 index 00000000000..fada75e49c3 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_dblib_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_firebird_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_firebird_driver.php new file mode 100644 index 00000000000..69e463a6eaf Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_firebird_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_firebird_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_firebird_forge.php new file mode 100644 index 00000000000..32e321f67db Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_firebird_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_ibm_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_ibm_driver.php new file mode 100644 index 00000000000..8b3ee846fda Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_ibm_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_ibm_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_ibm_forge.php new file mode 100644 index 00000000000..85810c738af Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_ibm_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_informix_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_informix_driver.php new file mode 100644 index 00000000000..e257a246dbc Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_informix_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_informix_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_informix_forge.php new file mode 100644 index 00000000000..aae0275887d Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_informix_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_mysql_driver.php new file mode 100644 index 00000000000..70188760c4b Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_mysql_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_mysql_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_mysql_forge.php new file mode 100644 index 00000000000..d0a371f2f76 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_mysql_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_oci_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_oci_driver.php new file mode 100644 index 00000000000..dc4ced12cb6 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_oci_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_oci_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_oci_forge.php new file mode 100644 index 00000000000..07e81aed5c6 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_oci_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_odbc_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_odbc_driver.php new file mode 100644 index 00000000000..555de81857e Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_odbc_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_odbc_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_odbc_forge.php new file mode 100644 index 00000000000..c6db3227b38 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_odbc_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_pgsql_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_pgsql_driver.php new file mode 100644 index 00000000000..db0b450ed81 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_pgsql_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_pgsql_forge.php new file mode 100644 index 00000000000..96adcb04391 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_pgsql_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_sqlite_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_sqlite_driver.php new file mode 100644 index 00000000000..f0d777ebe98 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_sqlite_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_sqlite_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_sqlite_forge.php new file mode 100644 index 00000000000..45deaa9faa9 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_sqlite_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_sqlsrv_driver.php b/system/database/drivers/pdo/subdrivers/._pdo_sqlsrv_driver.php new file mode 100644 index 00000000000..2748e060ad2 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_sqlsrv_driver.php differ diff --git a/system/database/drivers/pdo/subdrivers/._pdo_sqlsrv_forge.php b/system/database/drivers/pdo/subdrivers/._pdo_sqlsrv_forge.php new file mode 100644 index 00000000000..68df7261798 Binary files /dev/null and b/system/database/drivers/pdo/subdrivers/._pdo_sqlsrv_forge.php differ diff --git a/system/database/drivers/pdo/subdrivers/index.html b/system/database/drivers/pdo/subdrivers/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/pdo/subdrivers/index.html +++ b/system/database/drivers/pdo/subdrivers/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php b/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php index db793663192..eceb597964c 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php @@ -126,7 +126,7 @@ public function drop_database($db_name) * @return string|string[] */ protected function _alter_table($alter_type, $table, $field) - { + { if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) { return parent::_alter_table($alter_type, $table, $field); @@ -169,7 +169,7 @@ protected function _alter_table($alter_type, $table, $field) } return $sqls; - } + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php index 41f7a648537..dba49585c21 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php @@ -142,9 +142,9 @@ public function version() } $version_string = parent::version(); - if (preg_match('#(Release\s)?(?\d+(?:\.\d+)+)#', $version_string, $match)) + if (preg_match('#Release\s(?\d+(?:\.\d+)+)#', $version_string, $match)) { - return $this->data_cache['version'] = $match['version']; + return $this->data_cache['version'] = $match[1]; } return FALSE; diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php index aa78461dfbc..b5d3eb143b6 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php @@ -150,33 +150,9 @@ protected function _alter_table($alter_type, $table, $field) */ protected function _attr_auto_increment(&$attributes, &$field) { - if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'number') !== FALSE && version_compare($this->db->version(), '12.1', '>=')) - { - $field['auto_increment'] = ' GENERATED ALWAYS AS IDENTITY'; - } - } - - // -------------------------------------------------------------------- - - /** - * Process column - * - * @param array $field - * @return string - */ - protected function _process_column($field) - { - return $this->db->escape_identifiers($field['name']) - .' '.$field['type'].$field['length'] - .$field['unsigned'] - .$field['default'] - .$field['auto_increment'] - .$field['null'] - .$field['unique']; + // Not supported - sequences and triggers must be used instead } - // -------------------------------------------------------------------- - /** * Field attribute TYPE * diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php index 4e19e9c577f..a4ccff407b3 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php @@ -106,7 +106,7 @@ public function __construct(&$db) * @return string|string[] */ protected function _alter_table($alter_type, $table, $field) - { + { if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) { return parent::_alter_table($alter_type, $table, $field); @@ -154,7 +154,7 @@ protected function _alter_table($alter_type, $table, $field) } return $sqls; - } + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/postgre/._index.html b/system/database/drivers/postgre/._index.html new file mode 100644 index 00000000000..2f4ec9fa590 Binary files /dev/null and b/system/database/drivers/postgre/._index.html differ diff --git a/system/database/drivers/postgre/._postgre_driver.php b/system/database/drivers/postgre/._postgre_driver.php new file mode 100644 index 00000000000..c783c42c1eb Binary files /dev/null and b/system/database/drivers/postgre/._postgre_driver.php differ diff --git a/system/database/drivers/postgre/._postgre_forge.php b/system/database/drivers/postgre/._postgre_forge.php new file mode 100644 index 00000000000..24e926cbbaa Binary files /dev/null and b/system/database/drivers/postgre/._postgre_forge.php differ diff --git a/system/database/drivers/postgre/._postgre_result.php b/system/database/drivers/postgre/._postgre_result.php new file mode 100644 index 00000000000..e087037a7dc Binary files /dev/null and b/system/database/drivers/postgre/._postgre_result.php differ diff --git a/system/database/drivers/postgre/._postgre_utility.php b/system/database/drivers/postgre/._postgre_utility.php new file mode 100644 index 00000000000..596e2ff88e6 Binary files /dev/null and b/system/database/drivers/postgre/._postgre_utility.php differ diff --git a/system/database/drivers/postgre/index.html b/system/database/drivers/postgre/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/postgre/index.html +++ b/system/database/drivers/postgre/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 19a09490c56..5ce27610581 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -163,13 +163,6 @@ public function db_connect($persistent = FALSE) return FALSE; } - if (pg_set_client_encoding($this->conn_id, $this->char_set) !== 0) - { - log_message('error', "Database: Unable to set the configured connection charset ('{$this->char_set}')."); - pg_close($this->conn_id); - return ($this->db->db_debug) ? $this->display_error('db_unable_to_set_charset', $this->char_set) : FALSE; - } - empty($this->schema) OR $this->simple_query('SET search_path TO '.$this->schema.',public'); } @@ -196,6 +189,19 @@ public function reconnect() // -------------------------------------------------------------------- + /** + * Set client character set + * + * @param string $charset + * @return bool + */ + protected function _db_set_charset($charset) + { + return (pg_set_client_encoding($this->conn_id, $charset) === 0); + } + + // -------------------------------------------------------------------- + /** * Database version number * @@ -315,7 +321,7 @@ protected function _escape_str($str) */ public function escape($str) { - if (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))) + if (is_php('5.4.4') && (is_string($str) OR (is_object($str) && method_exists($str, '__toString')))) { return pg_escape_literal($this->conn_id, $str); } diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index a378d146bf3..481e222b8cc 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -101,7 +101,7 @@ public function __construct(&$db) * @return string|string[] */ protected function _alter_table($alter_type, $table, $field) - { + { if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) { return parent::_alter_table($alter_type, $table, $field); @@ -149,7 +149,7 @@ protected function _alter_table($alter_type, $table, $field) } return $sqls; - } + } // -------------------------------------------------------------------- diff --git a/system/database/drivers/sqlite/._index.html b/system/database/drivers/sqlite/._index.html new file mode 100644 index 00000000000..a38cfd961de Binary files /dev/null and b/system/database/drivers/sqlite/._index.html differ diff --git a/system/database/drivers/sqlite/._sqlite_driver.php b/system/database/drivers/sqlite/._sqlite_driver.php new file mode 100644 index 00000000000..cad71dd1a12 Binary files /dev/null and b/system/database/drivers/sqlite/._sqlite_driver.php differ diff --git a/system/database/drivers/sqlite/._sqlite_forge.php b/system/database/drivers/sqlite/._sqlite_forge.php new file mode 100644 index 00000000000..b5e00b87172 Binary files /dev/null and b/system/database/drivers/sqlite/._sqlite_forge.php differ diff --git a/system/database/drivers/sqlite/._sqlite_result.php b/system/database/drivers/sqlite/._sqlite_result.php new file mode 100644 index 00000000000..e31ce3cbc9e Binary files /dev/null and b/system/database/drivers/sqlite/._sqlite_result.php differ diff --git a/system/database/drivers/sqlite/._sqlite_utility.php b/system/database/drivers/sqlite/._sqlite_utility.php new file mode 100644 index 00000000000..7b4c0fadd5f Binary files /dev/null and b/system/database/drivers/sqlite/._sqlite_utility.php differ diff --git a/system/database/drivers/sqlite/index.html b/system/database/drivers/sqlite/index.html new file mode 100644 index 00000000000..b702fbc3967 --- /dev/null +++ b/system/database/drivers/sqlite/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php new file mode 100644 index 00000000000..aec3d748c14 --- /dev/null +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -0,0 +1,330 @@ +database, 0666, $error) + : sqlite_open($this->database, 0666, $error); + + isset($error) && log_message('error', $error); + + return $conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + return isset($this->data_cache['version']) + ? $this->data_cache['version'] + : $this->data_cache['version'] = sqlite_libversion(); + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return resource + */ + protected function _execute($sql) + { + return $this->is_write_type($sql) + ? sqlite_exec($this->conn_id, $sql) + : sqlite_query($this->conn_id, $sql); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + return $this->simple_query('BEGIN TRANSACTION'); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + return $this->simple_query('COMMIT'); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + return $this->simple_query('ROLLBACK'); + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependant string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + return sqlite_escape_string($str); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return sqlite_changes($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return int + */ + public function insert_id() + { + return sqlite_last_insert_rowid($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = "SELECT name FROM sqlite_master WHERE type='table'"; + + if ($prefix_limit !== FALSE && $this->dbprefix != '') + { + return $sql." AND 'name' LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return bool + */ + protected function _list_columns($table = '') + { + // Not supported + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $query = $query->result_array(); + if (empty($query)) + { + return FALSE; + } + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]['name']; + $retval[$i]->type = $query[$i]['type']; + $retval[$i]->max_length = NULL; + $retval[$i]->default = $query[$i]['dflt_value']; + $retval[$i]->primary_key = isset($query[$i]['pk']) ? (int) $query[$i]['pk'] : 0; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occured. + * + * @return array + */ + public function error() + { + $error = array('code' => sqlite_last_error($this->conn_id)); + $error['message'] = sqlite_error_string($error['code']); + return $error; + } + + // -------------------------------------------------------------------- + + /** + * Replace statement + * + * Generates a platform-specific replace string from the supplied data + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string + */ + protected function _replace($table, $keys, $values) + { + return 'INSERT OR '.parent::_replace($table, $keys, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this function maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'DELETE FROM '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + sqlite_close($this->conn_id); + } + +} diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php new file mode 100644 index 00000000000..6aa9c61c473 --- /dev/null +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -0,0 +1,205 @@ +db->database) OR ! @unlink($this->db->database)) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + elseif ( ! empty($this->db->data_cache['db_names'])) + { + $key = array_search(strtolower($this->db->database), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); + if ($key !== FALSE) + { + unset($this->db->data_cache['db_names'][$key]); + } + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @todo implement drop_column(), modify_column() + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'DROP' OR $alter_type === 'CHANGE') + { + // drop_column(): + // BEGIN TRANSACTION; + // CREATE TEMPORARY TABLE t1_backup(a,b); + // INSERT INTO t1_backup SELECT a,b FROM t1; + // DROP TABLE t1; + // CREATE TABLE t1(a,b); + // INSERT INTO t1 SELECT a,b FROM t1_backup; + // DROP TABLE t1_backup; + // COMMIT; + + return FALSE; + } + + return parent::_alter_table($alter_type, $table, $field); + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + return $this->db->escape_identifiers($field['name']) + .' '.$field['type'] + .$field['auto_increment'] + .$field['null'] + .$field['unique'] + .$field['default']; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'ENUM': + case 'SET': + $attributes['TYPE'] = 'TEXT'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['type'] = 'INTEGER PRIMARY KEY'; + $field['default'] = ''; + $field['null'] = ''; + $field['unique'] = ''; + $field['auto_increment'] = ' AUTOINCREMENT'; + + $this->primary_keys = array(); + } + } + +} diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php new file mode 100644 index 00000000000..30c93a26fa0 --- /dev/null +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -0,0 +1,164 @@ +num_rows) + ? $this->num_rows + : $this->num_rows = @sqlite_num_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return @sqlite_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $field_names[$i] = sqlite_field_name($this->result_id, $i); + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = sqlite_field_name($this->result_id, $i); + $retval[$i]->type = NULL; + $retval[$i]->max_length = NULL; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * @param int $n + * @return bool + */ + public function data_seek($n = 0) + { + return sqlite_seek($this->result_id, $n); + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return sqlite_fetch_array($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return sqlite_fetch_object($this->result_id, $class_name); + } + +} diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php new file mode 100644 index 00000000000..2c7f8099ecf --- /dev/null +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -0,0 +1,61 @@ +db->display_error('db_unsupported_feature'); + } + +} diff --git a/system/database/drivers/sqlite3/._index.html b/system/database/drivers/sqlite3/._index.html new file mode 100644 index 00000000000..f8950d45f4d Binary files /dev/null and b/system/database/drivers/sqlite3/._index.html differ diff --git a/system/database/drivers/sqlite3/._sqlite3_driver.php b/system/database/drivers/sqlite3/._sqlite3_driver.php new file mode 100644 index 00000000000..6e0b5ddf188 Binary files /dev/null and b/system/database/drivers/sqlite3/._sqlite3_driver.php differ diff --git a/system/database/drivers/sqlite3/._sqlite3_forge.php b/system/database/drivers/sqlite3/._sqlite3_forge.php new file mode 100644 index 00000000000..ce9d2fe91ee Binary files /dev/null and b/system/database/drivers/sqlite3/._sqlite3_forge.php differ diff --git a/system/database/drivers/sqlite3/._sqlite3_result.php b/system/database/drivers/sqlite3/._sqlite3_result.php new file mode 100644 index 00000000000..0b318e33a22 Binary files /dev/null and b/system/database/drivers/sqlite3/._sqlite3_result.php differ diff --git a/system/database/drivers/sqlite3/._sqlite3_utility.php b/system/database/drivers/sqlite3/._sqlite3_utility.php new file mode 100644 index 00000000000..4b88bc22f2d Binary files /dev/null and b/system/database/drivers/sqlite3/._sqlite3_utility.php differ diff --git a/system/database/drivers/sqlite3/index.html b/system/database/drivers/sqlite3/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/sqlite3/index.html +++ b/system/database/drivers/sqlite3/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/drivers/sqlsrv/._index.html b/system/database/drivers/sqlsrv/._index.html new file mode 100644 index 00000000000..5c846b3b1d7 Binary files /dev/null and b/system/database/drivers/sqlsrv/._index.html differ diff --git a/system/database/drivers/sqlsrv/._sqlsrv_driver.php b/system/database/drivers/sqlsrv/._sqlsrv_driver.php new file mode 100644 index 00000000000..90e9006b169 Binary files /dev/null and b/system/database/drivers/sqlsrv/._sqlsrv_driver.php differ diff --git a/system/database/drivers/sqlsrv/._sqlsrv_forge.php b/system/database/drivers/sqlsrv/._sqlsrv_forge.php new file mode 100644 index 00000000000..eb9499ef15e Binary files /dev/null and b/system/database/drivers/sqlsrv/._sqlsrv_forge.php differ diff --git a/system/database/drivers/sqlsrv/._sqlsrv_result.php b/system/database/drivers/sqlsrv/._sqlsrv_result.php new file mode 100644 index 00000000000..a28ea7e31a8 Binary files /dev/null and b/system/database/drivers/sqlsrv/._sqlsrv_result.php differ diff --git a/system/database/drivers/sqlsrv/._sqlsrv_utility.php b/system/database/drivers/sqlsrv/._sqlsrv_utility.php new file mode 100644 index 00000000000..bc9bdaa0912 Binary files /dev/null and b/system/database/drivers/sqlsrv/._sqlsrv_utility.php differ diff --git a/system/database/drivers/sqlsrv/index.html b/system/database/drivers/sqlsrv/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/drivers/sqlsrv/index.html +++ b/system/database/drivers/sqlsrv/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/database/index.html b/system/database/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/database/index.html +++ b/system/database/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/fonts/._index.html b/system/fonts/._index.html new file mode 100644 index 00000000000..f24cdaeec44 Binary files /dev/null and b/system/fonts/._index.html differ diff --git a/system/fonts/._texb.ttf b/system/fonts/._texb.ttf new file mode 100644 index 00000000000..3d65ff82124 Binary files /dev/null and b/system/fonts/._texb.ttf differ diff --git a/system/fonts/index.html b/system/fonts/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/fonts/index.html +++ b/system/fonts/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/helpers/._array_helper.php b/system/helpers/._array_helper.php new file mode 100644 index 00000000000..81047bfe0d1 Binary files /dev/null and b/system/helpers/._array_helper.php differ diff --git a/system/helpers/._captcha_helper.php b/system/helpers/._captcha_helper.php new file mode 100644 index 00000000000..b1f9385224a Binary files /dev/null and b/system/helpers/._captcha_helper.php differ diff --git a/system/helpers/._cookie_helper.php b/system/helpers/._cookie_helper.php new file mode 100644 index 00000000000..e8e74d72842 Binary files /dev/null and b/system/helpers/._cookie_helper.php differ diff --git a/system/helpers/._date_helper.php b/system/helpers/._date_helper.php new file mode 100644 index 00000000000..b73ec6cce43 Binary files /dev/null and b/system/helpers/._date_helper.php differ diff --git a/system/helpers/._directory_helper.php b/system/helpers/._directory_helper.php new file mode 100644 index 00000000000..33350df60a4 Binary files /dev/null and b/system/helpers/._directory_helper.php differ diff --git a/system/helpers/._download_helper.php b/system/helpers/._download_helper.php new file mode 100644 index 00000000000..ec86968d9e1 Binary files /dev/null and b/system/helpers/._download_helper.php differ diff --git a/system/helpers/._email_helper.php b/system/helpers/._email_helper.php new file mode 100644 index 00000000000..a0d2ab3d7bc Binary files /dev/null and b/system/helpers/._email_helper.php differ diff --git a/system/helpers/._file_helper.php b/system/helpers/._file_helper.php new file mode 100644 index 00000000000..cf57ed1ac77 Binary files /dev/null and b/system/helpers/._file_helper.php differ diff --git a/system/helpers/._form_helper.php b/system/helpers/._form_helper.php new file mode 100644 index 00000000000..83c7d358208 Binary files /dev/null and b/system/helpers/._form_helper.php differ diff --git a/system/helpers/._html_helper.php b/system/helpers/._html_helper.php new file mode 100644 index 00000000000..19e1db7a489 Binary files /dev/null and b/system/helpers/._html_helper.php differ diff --git a/system/helpers/._index.html b/system/helpers/._index.html new file mode 100644 index 00000000000..e44ebe81f80 Binary files /dev/null and b/system/helpers/._index.html differ diff --git a/system/helpers/._inflector_helper.php b/system/helpers/._inflector_helper.php new file mode 100644 index 00000000000..f7b536c2765 Binary files /dev/null and b/system/helpers/._inflector_helper.php differ diff --git a/system/helpers/._language_helper.php b/system/helpers/._language_helper.php new file mode 100644 index 00000000000..d2e6f0f6bca Binary files /dev/null and b/system/helpers/._language_helper.php differ diff --git a/system/helpers/._number_helper.php b/system/helpers/._number_helper.php new file mode 100644 index 00000000000..bb27cacbed3 Binary files /dev/null and b/system/helpers/._number_helper.php differ diff --git a/system/helpers/._path_helper.php b/system/helpers/._path_helper.php new file mode 100644 index 00000000000..cc646a642f4 Binary files /dev/null and b/system/helpers/._path_helper.php differ diff --git a/system/helpers/._security_helper.php b/system/helpers/._security_helper.php new file mode 100644 index 00000000000..00df6e95761 Binary files /dev/null and b/system/helpers/._security_helper.php differ diff --git a/system/helpers/._smiley_helper.php b/system/helpers/._smiley_helper.php new file mode 100644 index 00000000000..f9450037ec8 Binary files /dev/null and b/system/helpers/._smiley_helper.php differ diff --git a/system/helpers/._string_helper.php b/system/helpers/._string_helper.php new file mode 100644 index 00000000000..f6c152b68e5 Binary files /dev/null and b/system/helpers/._string_helper.php differ diff --git a/system/helpers/._text_helper.php b/system/helpers/._text_helper.php new file mode 100644 index 00000000000..25b680a27fd Binary files /dev/null and b/system/helpers/._text_helper.php differ diff --git a/system/helpers/._typography_helper.php b/system/helpers/._typography_helper.php new file mode 100644 index 00000000000..cc798ea0159 Binary files /dev/null and b/system/helpers/._typography_helper.php differ diff --git a/system/helpers/._url_helper.php b/system/helpers/._url_helper.php new file mode 100644 index 00000000000..d170763c819 Binary files /dev/null and b/system/helpers/._url_helper.php differ diff --git a/system/helpers/._xml_helper.php b/system/helpers/._xml_helper.php new file mode 100644 index 00000000000..8678d0719d2 Binary files /dev/null and b/system/helpers/._xml_helper.php differ diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index dcd6882c86b..37ef04b24c4 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -68,11 +68,10 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = 'img_url' => '', 'img_width' => '150', 'img_height' => '30', - 'img_alt' => 'captcha', 'font_path' => '', - 'font_size' => 16, 'expiration' => 7200, 'word_length' => 8, + 'font_size' => 16, 'img_id' => '', 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'colors' => array( @@ -83,8 +82,6 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = ) ); - $now = microtime(TRUE); - foreach ($defaults as $key => $val) { if ( ! is_array($data) && empty($$key)) @@ -97,60 +94,31 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = } } - if ( ! extension_loaded('gd')) + if ($img_path === '' OR $img_url === '' + OR ! is_dir($img_path) OR ! is_really_writable($img_path) + OR ! extension_loaded('gd')) { - log_message('error', 'create_captcha(): GD extension is not loaded.'); return FALSE; } - if ($img_path === '' OR $img_url === '') - { - log_message('error', 'create_captcha(): $img_path and $img_url are required.'); - return FALSE; - } + // ----------------------------------- + // Remove old images + // ----------------------------------- - if ( ! is_dir($img_path) OR ! is_really_writable($img_path)) - { - log_message('error', "create_captcha(): '{$img_path}' is not a dir, nor is it writable."); - return FALSE; - } + $now = microtime(TRUE); - if ($img_url !== '' OR $img_path !== '') + $current_dir = @opendir($img_path); + while ($filename = @readdir($current_dir)) { - if ($img_path === '' OR $img_url === '') + if (in_array(substr($filename, -4), array('.jpg', '.png')) + && (str_replace(array('.jpg', '.png'), '', $filename) + $expiration) < $now) { - log_message('error', 'create_captcha(): $img_path and $img_url are required.'); - return FALSE; + @unlink($img_path.$filename); } - - if ( ! is_dir($img_path) OR ! is_really_writable($img_path)) - { - log_message('error', "create_captcha(): '{$img_path}' is not a dir, nor is it writable."); - return FALSE; - } - - /** - * Remove old images - */ - $current_dir = @opendir($img_path); - while ($filename = @readdir($current_dir)) - { - if (preg_match('#^(?\d{10})\.png$#', $filename, $match) && ($match['ts'] + $expiration) < $now) - { - @unlink($img_path.$filename); - } - } - - @closedir($current_dir); - - // This variable will later be used later to determine whether we write to disk or output a data:image URI - $img_filename = $now.'.png'; - } - else - { - $img_filename = NULL; } + @closedir($current_dir); + // ----------------------------------- // Do we have a "word" yet? // ----------------------------------- @@ -259,8 +227,8 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = // Determine angle and position // ----------------------------------- $length = strlen($word); - $angle = ($length >= 6) ? mt_rand(-($length - 6), ($length - 6)) : 0; - $x_axis = mt_rand(6, (360 / $length)-16); + $angle = ($length >= 6) ? mt_rand(-($length-6), ($length-6)) : 0; + $x_axis = mt_rand(6, (360/$length)-16); $y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height); // Create image @@ -348,31 +316,24 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = // ----------------------------------- // Generate the image // ----------------------------------- + $img_url = rtrim($img_url, '/').'/'; - if (isset($img_filename)) + if (function_exists('imagejpeg')) { - $img_src = rtrim($img_url, '/').'/'.$img_filename; + $img_filename = $now.'.jpg'; + imagejpeg($im, $img_path.$img_filename); + } + elseif (function_exists('imagepng')) + { + $img_filename = $now.'.png'; imagepng($im, $img_path.$img_filename); } else { - // I don't see an easier way to get the image contents without writing to file - $buffer = fopen('php://memory', 'wb+'); - imagepng($im, $buffer); - rewind($buffer); - $img_src = ''; - - // fread() will return an empty string (not FALSE) after the entire contents are read - while (strlen($read = fread($buffer, 4096))) - { - $img_src .= $read; - } - - fclose($buffer); - $img_src = 'data:image/png;base64,'.base64_encode($img_src); + return FALSE; } - $img = ''.$img_alt.''; + $img = ' '; ImageDestroy($im); return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index d9724932eb0..b9c2cb68a01 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -59,7 +59,7 @@ * * @param mixed * @param string the value of the cookie - * @param int the number of seconds until expiration + * @param string the number of seconds until expiration * @param string the cookie domain. Usually: .yourdomain.com * @param string the cookie path * @param string the cookie prefix @@ -67,7 +67,7 @@ * @param bool true makes the cookie accessible via http(s) only (no javascript) * @return void */ - function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL) + function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL) { // Set the config file options get_instance()->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly); @@ -85,8 +85,9 @@ function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', * @param bool * @return mixed */ - function get_cookie($index, $xss_clean = FALSE) + function get_cookie($index, $xss_clean = NULL) { + is_bool($xss_clean) OR $xss_clean = (config_item('global_xss_filtering') === TRUE); $prefix = isset($_COOKIE[$index]) ? '' : config_item('cookie_prefix'); return get_instance()->input->cookie($prefix.$index, $xss_clean); } diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 6ee3c311989..5c660e2eee3 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -122,6 +122,46 @@ function mdate($datestr = '', $time = '') // ------------------------------------------------------------------------ +if ( ! function_exists('standard_date')) +{ + /** + * Standard Date + * + * Returns a date formatted according to the submitted standard. + * + * As of PHP 5.2, the DateTime extension provides constants that + * serve for the exact same purpose and are used with date(). + * + * @todo Remove in version 3.1+. + * @deprecated 3.0.0 Use PHP's native date() instead. + * @link http://www.php.net/manual/en/class.datetime.php#datetime.constants.types + * + * @example date(DATE_RFC822, now()); // default + * @example date(DATE_W3C, $time); // a different format and time + * + * @param string $fmt = 'DATE_RFC822' the chosen format + * @param int $time = NULL Unix timestamp + * @return string + */ + function standard_date($fmt = 'DATE_RFC822', $time = NULL) + { + if (empty($time)) + { + $time = now(); + } + + // Procedural style pre-defined constants from the DateTime extension + if (strpos($fmt, 'DATE_') !== 0 OR defined($fmt) === FALSE) + { + return FALSE; + } + + return date(constant($fmt), $time); + } +} + +// ------------------------------------------------------------------------ + if ( ! function_exists('timespan')) { /** diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 4d7829640d1..d8e30ae9f63 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -56,7 +56,7 @@ * * Generates headers that force a download to happen * - * @param mixed filename (or an array of local file path => destination filename) + * @param string filename * @param mixed the data to be downloaded * @param bool whether to try and send the actual file MIME type * @return void @@ -69,34 +69,14 @@ function force_download($filename = '', $data = '', $set_mime = FALSE) } elseif ($data === NULL) { - // Is $filename an array as ['local source path' => 'destination filename']? - if (is_array($filename)) - { - if (count($filename) !== 1) - { - return; - } - - reset($filename); - $filepath = key($filename); - $filename = current($filename); - - if (is_int($filepath)) - { - return; - } - } - else - { - $filepath = $filename; - $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); - $filename = end($filename); - } - - if ( ! @is_file($filepath) OR ($filesize = @filesize($filepath)) === FALSE) + if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) { return; } + + $filepath = $filename; + $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); + $filename = end($filename); } else { @@ -141,23 +121,20 @@ function force_download($filename = '', $data = '', $set_mime = FALSE) $filename = implode('.', $x); } + if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE) + { + return; + } + // Clean output buffer if (ob_get_level() !== 0 && @ob_end_clean() === FALSE) { @ob_clean(); } - // RFC 6266 allows for multibyte filenames, but only in UTF-8, - // so we have to make it conditional ... - $charset = strtoupper(config_item('charset')); - $utf8_filename = ($charset !== 'UTF-8') - ? get_instance()->utf8->convert_to_utf8($filename, $charset) - : $filename; - isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename); - // Generate the server headers header('Content-Type: '.$mime); - header('Content-Disposition: attachment; filename="'.$filename.'";'.$utf8_filename); + header('Content-Disposition: attachment; filename="'.$filename.'"'); header('Expires: 0'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.$filesize); @@ -169,12 +146,13 @@ function force_download($filename = '', $data = '', $set_mime = FALSE) exit($data); } - // Flush the file - if (@readfile($filepath) === FALSE) + // Flush 1MB chunks of data + while ( ! feof($fp) && ($data = fread($fp, 1048576)) !== FALSE) { - return; + echo $data; } + fclose($fp); exit; } } diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php new file mode 100644 index 00000000000..b25875974d3 --- /dev/null +++ b/system/helpers/email_helper.php @@ -0,0 +1,84 @@ + 'file', 'name' => ''); is_array($data) OR $data = array('name' => $data); @@ -675,6 +676,25 @@ function form_close($extra = '') // ------------------------------------------------------------------------ +if ( ! function_exists('form_prep')) +{ + /** + * Form Prep + * + * Formats text so that it can be safely placed in a form field in the event it has HTML tags. + * + * @deprecated 3.0.0 An alias for html_escape() + * @param string|string[] $str Value to escape + * @return string|string[] Escaped values + */ + function form_prep($str) + { + return html_escape($str, TRUE); + } +} + +// ------------------------------------------------------------------------ + if ( ! function_exists('set_value')) { /** diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 8b06e4406a2..76adcb23623 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -229,7 +229,7 @@ function img($src = '', $index_page = FALSE, $attributes = '') * @param string type The doctype to be generated * @return string */ - function doctype($type = 'html5') + function doctype($type = 'xhtml1-strict') { static $doctypes; @@ -360,32 +360,51 @@ function meta($name = '', $content = '', $type = 'name', $newline = "\n") $name = array($name); } - $allowed_types = array('charset', 'http-equiv', 'name', 'property'); $str = ''; foreach ($name as $meta) { - // This is to preserve BC with pre-3.1 versions where only - // 'http-equiv' (default) and 'name' were supported. - if (isset($meta['type'])) - { - if ($meta['type'] === 'equiv') - { - $meta['type'] = 'http-equiv'; - } - elseif ( ! in_array($meta['type'], $allowed_types, TRUE)) - { - $meta['type'] = 'name'; - } - } + $type = (isset($meta['type']) && $meta['type'] !== 'name') ? 'http-equiv' : 'name'; + $name = isset($meta['name']) ? $meta['name'] : ''; + $content = isset($meta['content']) ? $meta['content'] : ''; + $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; - $type = isset($meta['type']) ? $meta['type'] : 'name'; - $name = isset($meta['name']) ? $meta['name'] : ''; - $content = isset($meta['content']) ? $meta['content'] : ''; - $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; - - $str .= ''.$newline; + $str .= ''.$newline; } return $str; } } + +// ------------------------------------------------------------------------ + +if ( ! function_exists('br')) +{ + /** + * Generates HTML BR tags based on number supplied + * + * @deprecated 3.0.0 Use str_repeat() instead + * @param int $count Number of times to repeat the tag + * @return string + */ + function br($count = 1) + { + return str_repeat('
', $count); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('nbs')) +{ + /** + * Generates non-breaking space entities based on number supplied + * + * @deprecated 3.0.0 Use str_repeat() instead + * @param int + * @return string + */ + function nbs($num = 1) + { + return str_repeat(' ', $num); + } +} diff --git a/system/helpers/index.html b/system/helpers/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/helpers/index.html +++ b/system/helpers/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index a36836b0094..1c14f4a3e4e 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -285,42 +285,3 @@ function is_countable($word) return word_is_countable($word); } } - -// ------------------------------------------------------------------------ - -if ( ! function_exists('ordinal_format')) -{ - /** - * Returns the English ordinal numeral for a given number - * - * @param int $number - * @return string - */ - function ordinal_format($number) - { - if ( ! ctype_digit((string) $number) OR $number < 1) - { - return $number; - } - - $last_digit = array( - 0 => 'th', - 1 => 'st', - 2 => 'nd', - 3 => 'rd', - 4 => 'th', - 5 => 'th', - 6 => 'th', - 7 => 'th', - 8 => 'th', - 9 => 'th' - ); - - if (($number % 100) >= 11 && ($number % 100) <= 13) - { - return $number.'th'; - } - - return $number.$last_digit[$number % 10]; - } -} diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index dcf5b8b5813..b931c339356 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -80,6 +80,30 @@ function sanitize_filename($filename) } } +// -------------------------------------------------------------------- + +if ( ! function_exists('do_hash')) +{ + /** + * Hash encode a string + * + * @todo Remove in version 3.1+. + * @deprecated 3.0.0 Use PHP's native hash() instead. + * @param string $str + * @param string $type = 'sha1' + * @return string + */ + function do_hash($str, $type = 'sha1') + { + if ( ! in_array(strtolower($type), hash_algos())) + { + $type = 'md5'; + } + + return hash($type, $str); + } +} + // ------------------------------------------------------------------------ if ( ! function_exists('strip_image_tags')) diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php new file mode 100644 index 00000000000..321e59cefc4 --- /dev/null +++ b/system/helpers/smiley_helper.php @@ -0,0 +1,255 @@ +field_id pairs + * @param string field_id if alias name was passed in + * @param bool + * @return array + */ + function smiley_js($alias = '', $field_id = '', $inline = TRUE) + { + static $do_setup = TRUE; + $r = ''; + + if ($alias !== '' && ! is_array($alias)) + { + $alias = array($alias => $field_id); + } + + if ($do_setup === TRUE) + { + $do_setup = FALSE; + $m = array(); + + if (is_array($alias)) + { + foreach ($alias as $name => $id) + { + $m[] = '"'.$name.'" : "'.$id.'"'; + } + } + + $m = '{'.implode(',', $m).'}'; + + $r .= << $id) + { + $r .= 'smiley_map["'.$name.'"] = "'.$id."\";\n"; + } + } + + return ($inline) + ? '' + : $r; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('get_clickable_smileys')) +{ + /** + * Get Clickable Smileys + * + * Returns an array of image tag links that can be clicked to be inserted + * into a form field. + * + * @param string the URL to the folder containing the smiley images + * @param array + * @return array + */ + function get_clickable_smileys($image_url, $alias = '') + { + // For backward compatibility with js_insert_smiley + if (is_array($alias)) + { + $smileys = $alias; + } + elseif (FALSE === ($smileys = _get_smiley_array())) + { + return FALSE; + } + + // Add a trailing slash to the file path if needed + $image_url = rtrim($image_url, '/').'/'; + + $used = array(); + foreach ($smileys as $key => $val) + { + // Keep duplicates from being used, which can happen if the + // mapping array contains multiple identical replacements. For example: + // :-) and :) might be replaced with the same image so both smileys + // will be in the array. + if (isset($used[$smileys[$key][0]])) + { + continue; + } + + $link[] = ''.$smileys[$key][3].''; + $used[$smileys[$key][0]] = TRUE; + } + + return $link; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('parse_smileys')) +{ + /** + * Parse Smileys + * + * Takes a string as input and swaps any contained smileys for the actual image + * + * @param string the text to be parsed + * @param string the URL to the folder containing the smiley images + * @param array + * @return string + */ + function parse_smileys($str = '', $image_url = '', $smileys = NULL) + { + if ($image_url === '' OR ( ! is_array($smileys) && FALSE === ($smileys = _get_smiley_array()))) + { + return $str; + } + + // Add a trailing slash to the file path if needed + $image_url = rtrim($image_url, '/').'/'; + + foreach ($smileys as $key => $val) + { + $str = str_replace($key, ''.$smileys[$key][3].'', $str); + } + + return $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('_get_smiley_array')) +{ + /** + * Get Smiley Array + * + * Fetches the config/smiley.php file + * + * @return mixed + */ + function _get_smiley_array() + { + static $_smileys; + + if ( ! is_array($_smileys)) + { + if (file_exists(APPPATH.'config/smileys.php')) + { + include(APPPATH.'config/smileys.php'); + } + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); + } + + if (empty($smileys) OR ! is_array($smileys)) + { + $_smileys = array(); + return FALSE; + } + + $_smileys = $smileys; + } + + return $_smileys; + } +} diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 7738bf97f9b..c7dd96977f0 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -49,6 +49,33 @@ // ------------------------------------------------------------------------ +if ( ! function_exists('trim_slashes')) +{ + /** + * Trim Slashes + * + * Removes any leading/trailing slashes from a string: + * + * /this/that/theother/ + * + * becomes: + * + * this/that/theother + * + * @todo Remove in version 3.1+. + * @deprecated 3.0.0 This is just an alias for PHP's native trim() + * + * @param string + * @return string + */ + function trim_slashes($str) + { + return trim($str, '/'); + } +} + +// ------------------------------------------------------------------------ + if ( ! function_exists('strip_slashes')) { /** @@ -255,3 +282,23 @@ function alternator() return $args[($i++ % count($args))]; } } + +// ------------------------------------------------------------------------ + +if ( ! function_exists('repeater')) +{ + /** + * Repeater function + * + * @todo Remove in version 3.1+. + * @deprecated 3.0.0 This is just an alias for PHP's native str_repeat() + * + * @param string $data String to repeat + * @param int $num Number of repeats + * @return string + */ + function repeater($data, $num = 1) + { + return ($num > 0) ? str_repeat($data, $num) : ''; + } +} diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 6a959f0e6da..bebfd258357 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -211,7 +211,7 @@ function anchor_popup($uri = '', $title = '', $attributes = FALSE) { $attributes = array($attributes); - // Ref: https://www.w3schools.com/jsref/met_win_open.asp + // Ref: http://www.w3schools.com/jsref/met_win_open.asp $window_name = '_blank'; } elseif ( ! empty($attributes['window_name'])) @@ -443,7 +443,7 @@ function auto_link($str, $type = 'both', $popup = FALSE) */ function prep_url($str = '') { - if ($str === '') + if ($str === 'http://' OR $str === '') { return ''; } @@ -546,7 +546,7 @@ function redirect($uri = '', $method = 'auto', $code = NULL) if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') { $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') - ? 303 // reference: https://en.wikipedia.org/wiki/Post/Redirect/Get + ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get : 307; } else diff --git a/system/index.html b/system/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/index.html +++ b/system/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/language/._english b/system/language/._english new file mode 100644 index 00000000000..dc43483f3a3 Binary files /dev/null and b/system/language/._english differ diff --git a/system/language/._index.html b/system/language/._index.html new file mode 100644 index 00000000000..0e355aa38ea Binary files /dev/null and b/system/language/._index.html differ diff --git a/system/language/english/._calendar_lang.php b/system/language/english/._calendar_lang.php new file mode 100644 index 00000000000..e65fb38297c Binary files /dev/null and b/system/language/english/._calendar_lang.php differ diff --git a/system/language/english/._date_lang.php b/system/language/english/._date_lang.php new file mode 100644 index 00000000000..106a5fe4259 Binary files /dev/null and b/system/language/english/._date_lang.php differ diff --git a/system/language/english/._db_lang.php b/system/language/english/._db_lang.php new file mode 100644 index 00000000000..15958b0ad40 Binary files /dev/null and b/system/language/english/._db_lang.php differ diff --git a/system/language/english/._email_lang.php b/system/language/english/._email_lang.php new file mode 100644 index 00000000000..d26658b56b6 Binary files /dev/null and b/system/language/english/._email_lang.php differ diff --git a/system/language/english/._form_validation_lang.php b/system/language/english/._form_validation_lang.php new file mode 100644 index 00000000000..0d83735a162 Binary files /dev/null and b/system/language/english/._form_validation_lang.php differ diff --git a/system/language/english/._ftp_lang.php b/system/language/english/._ftp_lang.php new file mode 100644 index 00000000000..b24c5069941 Binary files /dev/null and b/system/language/english/._ftp_lang.php differ diff --git a/system/language/english/._imglib_lang.php b/system/language/english/._imglib_lang.php new file mode 100644 index 00000000000..c817c813759 Binary files /dev/null and b/system/language/english/._imglib_lang.php differ diff --git a/system/language/english/._index.html b/system/language/english/._index.html new file mode 100644 index 00000000000..58bd1a8ebc5 Binary files /dev/null and b/system/language/english/._index.html differ diff --git a/system/language/english/._migration_lang.php b/system/language/english/._migration_lang.php new file mode 100644 index 00000000000..13e04686105 Binary files /dev/null and b/system/language/english/._migration_lang.php differ diff --git a/system/language/english/._number_lang.php b/system/language/english/._number_lang.php new file mode 100644 index 00000000000..fe33767598b Binary files /dev/null and b/system/language/english/._number_lang.php differ diff --git a/system/language/english/._pagination_lang.php b/system/language/english/._pagination_lang.php new file mode 100644 index 00000000000..6342fca85e7 Binary files /dev/null and b/system/language/english/._pagination_lang.php differ diff --git a/system/language/english/._profiler_lang.php b/system/language/english/._profiler_lang.php new file mode 100644 index 00000000000..0db145bedee Binary files /dev/null and b/system/language/english/._profiler_lang.php differ diff --git a/system/language/english/._unit_test_lang.php b/system/language/english/._unit_test_lang.php new file mode 100644 index 00000000000..a7809398c8b Binary files /dev/null and b/system/language/english/._unit_test_lang.php differ diff --git a/system/language/english/._upload_lang.php b/system/language/english/._upload_lang.php new file mode 100644 index 00000000000..6bdeabc5213 Binary files /dev/null and b/system/language/english/._upload_lang.php differ diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index 74a2512c4d9..bdb0254429d 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -43,7 +43,6 @@ $lang['form_validation_valid_emails'] = 'The {field} field must contain all valid email addresses.'; $lang['form_validation_valid_url'] = 'The {field} field must contain a valid URL.'; $lang['form_validation_valid_ip'] = 'The {field} field must contain a valid IP.'; -$lang['form_validation_valid_mac'] = 'The {field} field must contain a valid MAC.'; $lang['form_validation_valid_base64'] = 'The {field} field must contain a valid Base64 string.'; $lang['form_validation_min_length'] = 'The {field} field must be at least {param} characters in length.'; $lang['form_validation_max_length'] = 'The {field} field cannot exceed {param} characters in length.'; diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php index 9a26b8a9bdb..c34b087c7f6 100644 --- a/system/language/english/imglib_lang.php +++ b/system/language/english/imglib_lang.php @@ -44,7 +44,6 @@ $lang['imglib_gif_not_supported'] = 'GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead.'; $lang['imglib_jpg_not_supported'] = 'JPG images are not supported.'; $lang['imglib_png_not_supported'] = 'PNG images are not supported.'; -$lang['imglib_webp_not_supported'] = 'WEBP images are not supported.'; $lang['imglib_jpg_or_png_required'] = 'The image resize protocol specified in your preferences only works with JPEG or PNG image types.'; $lang['imglib_copy_error'] = 'An error was encountered while attempting to replace the file. Please make sure your file directory is writable.'; $lang['imglib_rotate_unsupported'] = 'Image rotation does not appear to be supported by your server.'; diff --git a/system/language/english/index.html b/system/language/english/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/language/english/index.html +++ b/system/language/english/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/language/index.html b/system/language/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/language/index.html +++ b/system/language/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/libraries._Cache b/system/libraries._Cache new file mode 100644 index 00000000000..d173889bc78 Binary files /dev/null and b/system/libraries._Cache differ diff --git a/system/libraries/._Calendar.php b/system/libraries/._Calendar.php new file mode 100644 index 00000000000..9a90c87dc16 Binary files /dev/null and b/system/libraries/._Calendar.php differ diff --git a/system/libraries/._Cart.php b/system/libraries/._Cart.php new file mode 100644 index 00000000000..5a110595a6f Binary files /dev/null and b/system/libraries/._Cart.php differ diff --git a/system/libraries/._Driver.php b/system/libraries/._Driver.php new file mode 100644 index 00000000000..c1d402cfa78 Binary files /dev/null and b/system/libraries/._Driver.php differ diff --git a/system/libraries/._Email.php b/system/libraries/._Email.php new file mode 100644 index 00000000000..1ff41181e8f Binary files /dev/null and b/system/libraries/._Email.php differ diff --git a/system/libraries/._Encrypt.php b/system/libraries/._Encrypt.php new file mode 100644 index 00000000000..c86118f321e Binary files /dev/null and b/system/libraries/._Encrypt.php differ diff --git a/system/libraries/._Encryption.php b/system/libraries/._Encryption.php new file mode 100644 index 00000000000..bae15e70fec Binary files /dev/null and b/system/libraries/._Encryption.php differ diff --git a/system/libraries/._Form_validation.php b/system/libraries/._Form_validation.php new file mode 100644 index 00000000000..648a5874b1e Binary files /dev/null and b/system/libraries/._Form_validation.php differ diff --git a/system/libraries/._Ftp.php b/system/libraries/._Ftp.php new file mode 100644 index 00000000000..b42f6d7c2be Binary files /dev/null and b/system/libraries/._Ftp.php differ diff --git a/system/libraries/._Image_lib.php b/system/libraries/._Image_lib.php new file mode 100644 index 00000000000..7876cf27ec4 Binary files /dev/null and b/system/libraries/._Image_lib.php differ diff --git a/system/libraries/._Javascript b/system/libraries/._Javascript new file mode 100644 index 00000000000..8b13d105a3b Binary files /dev/null and b/system/libraries/._Javascript differ diff --git a/system/libraries/._Javascript.php b/system/libraries/._Javascript.php new file mode 100644 index 00000000000..5d4af544a9c Binary files /dev/null and b/system/libraries/._Javascript.php differ diff --git a/system/libraries/._Migration.php b/system/libraries/._Migration.php new file mode 100644 index 00000000000..9b1ebec50cc Binary files /dev/null and b/system/libraries/._Migration.php differ diff --git a/system/libraries/._Pagination.php b/system/libraries/._Pagination.php new file mode 100644 index 00000000000..98a6dc59b8f Binary files /dev/null and b/system/libraries/._Pagination.php differ diff --git a/system/libraries/._Parser.php b/system/libraries/._Parser.php new file mode 100644 index 00000000000..d28f3880c6d Binary files /dev/null and b/system/libraries/._Parser.php differ diff --git a/system/libraries/._Profiler.php b/system/libraries/._Profiler.php new file mode 100644 index 00000000000..9aa589f6f62 Binary files /dev/null and b/system/libraries/._Profiler.php differ diff --git a/system/libraries/._Session b/system/libraries/._Session new file mode 100644 index 00000000000..cb772f9bcae Binary files /dev/null and b/system/libraries/._Session differ diff --git a/system/libraries/._Table.php b/system/libraries/._Table.php new file mode 100644 index 00000000000..618f7ef165f Binary files /dev/null and b/system/libraries/._Table.php differ diff --git a/system/libraries/._Trackback.php b/system/libraries/._Trackback.php new file mode 100644 index 00000000000..f8c78913451 Binary files /dev/null and b/system/libraries/._Trackback.php differ diff --git a/system/libraries/._Typography.php b/system/libraries/._Typography.php new file mode 100644 index 00000000000..526e0f43e06 Binary files /dev/null and b/system/libraries/._Typography.php differ diff --git a/system/libraries/._Unit_test.php b/system/libraries/._Unit_test.php new file mode 100644 index 00000000000..7d2561aaf15 Binary files /dev/null and b/system/libraries/._Unit_test.php differ diff --git a/system/libraries/._Upload.php b/system/libraries/._Upload.php new file mode 100644 index 00000000000..c2509b900f0 Binary files /dev/null and b/system/libraries/._Upload.php differ diff --git a/system/libraries/._User_agent.php b/system/libraries/._User_agent.php new file mode 100644 index 00000000000..72479f7dd1e Binary files /dev/null and b/system/libraries/._User_agent.php differ diff --git a/system/libraries/._Xmlrpc.php b/system/libraries/._Xmlrpc.php new file mode 100644 index 00000000000..8f8f3a8cb4c Binary files /dev/null and b/system/libraries/._Xmlrpc.php differ diff --git a/system/libraries/._Xmlrpcs.php b/system/libraries/._Xmlrpcs.php new file mode 100644 index 00000000000..09368a37ad7 Binary files /dev/null and b/system/libraries/._Xmlrpcs.php differ diff --git a/system/libraries/._Zip.php b/system/libraries/._Zip.php new file mode 100644 index 00000000000..2beb6db29af Binary files /dev/null and b/system/libraries/._Zip.php differ diff --git a/system/libraries/._index.html b/system/libraries/._index.html new file mode 100644 index 00000000000..0839fe0e037 Binary files /dev/null and b/system/libraries/._index.html differ diff --git a/system/libraries/Cache/._Cache.php b/system/libraries/Cache/._Cache.php new file mode 100644 index 00000000000..afd583a4612 Binary files /dev/null and b/system/libraries/Cache/._Cache.php differ diff --git a/system/libraries/Cache/._drivers b/system/libraries/Cache/._drivers new file mode 100644 index 00000000000..9c724a70237 Binary files /dev/null and b/system/libraries/Cache/._drivers differ diff --git a/system/libraries/Cache/._index.html b/system/libraries/Cache/._index.html new file mode 100644 index 00000000000..910b0cd85ea Binary files /dev/null and b/system/libraries/Cache/._index.html differ diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index b1241766015..450d57b8ae9 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -55,7 +55,6 @@ class CI_Cache extends CI_Driver_Library { */ protected $valid_drivers = array( 'apc', - 'apcu', 'dummy', 'file', 'memcached', @@ -253,16 +252,4 @@ public function is_supported($driver) return $support[$driver]; } - - // ------------------------------------------------------------------------ - - /** - * Get currently loaded driver - * - * @return string - */ - public function get_loaded_driver() - { - return $this->_adapter; - } } diff --git a/system/libraries/Cache/drivers/._Cache_apc.php b/system/libraries/Cache/drivers/._Cache_apc.php new file mode 100644 index 00000000000..ce38f3074c5 Binary files /dev/null and b/system/libraries/Cache/drivers/._Cache_apc.php differ diff --git a/system/libraries/Cache/drivers/._Cache_dummy.php b/system/libraries/Cache/drivers/._Cache_dummy.php new file mode 100644 index 00000000000..b1a1f06d763 Binary files /dev/null and b/system/libraries/Cache/drivers/._Cache_dummy.php differ diff --git a/system/libraries/Cache/drivers/._Cache_file.php b/system/libraries/Cache/drivers/._Cache_file.php new file mode 100644 index 00000000000..712b3b867d7 Binary files /dev/null and b/system/libraries/Cache/drivers/._Cache_file.php differ diff --git a/system/libraries/Cache/drivers/._Cache_memcached.php b/system/libraries/Cache/drivers/._Cache_memcached.php new file mode 100644 index 00000000000..dbfeee4d951 Binary files /dev/null and b/system/libraries/Cache/drivers/._Cache_memcached.php differ diff --git a/system/libraries/Cache/drivers/._Cache_redis.php b/system/libraries/Cache/drivers/._Cache_redis.php new file mode 100644 index 00000000000..4f1bab59ca7 Binary files /dev/null and b/system/libraries/Cache/drivers/._Cache_redis.php differ diff --git a/system/libraries/Cache/drivers/._Cache_wincache.php b/system/libraries/Cache/drivers/._Cache_wincache.php new file mode 100644 index 00000000000..cafa93ebb6b Binary files /dev/null and b/system/libraries/Cache/drivers/._Cache_wincache.php differ diff --git a/system/libraries/Cache/drivers/._index.html b/system/libraries/Cache/drivers/._index.html new file mode 100644 index 00000000000..49d01b71226 Binary files /dev/null and b/system/libraries/Cache/drivers/._index.html differ diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index c0527e66578..8da8854ee55 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -160,10 +160,10 @@ public function clean() * @param string user/filehits * @return mixed array on success, false on failure */ - public function cache_info($type = NULL) - { - return apc_cache_info($type); - } + public function cache_info($type = NULL) + { + return apc_cache_info($type); + } // ------------------------------------------------------------------------ diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php index 0a90d069270..fdb9042ef02 100644 --- a/system/libraries/Cache/drivers/Cache_dummy.php +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -138,10 +138,10 @@ public function clean() * @param string user/filehits * @return bool FALSE */ - public function cache_info($type = NULL) - { - return FALSE; - } + public function cache_info($type = NULL) + { + return FALSE; + } // ------------------------------------------------------------------------ diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 24969e0bf11..bdc86a5d689 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -102,22 +102,10 @@ public function __construct() return; } - foreach ($this->_config as $cache_name => $cache_server) + foreach ($this->_config as $cache_server) { - if ( ! isset($cache_server['hostname'])) - { - log_message('debug', 'Cache: Memcache(d) configuration "'.$cache_name.'" doesn\'t include a hostname; ignoring.'); - continue; - } - elseif ($cache_server['hostname'][0] === '/') - { - $cache_server['port'] = 0; - } - elseif (empty($cache_server['port'])) - { - $cache_server['port'] = $defaults['port']; - } - + isset($cache_server['hostname']) OR $cache_server['hostname'] = $defaults['host']; + isset($cache_server['port']) OR $cache_server['port'] = $defaults['port']; isset($cache_server['weight']) OR $cache_server['weight'] = $defaults['weight']; if ($this->_memcached instanceof Memcache) diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 9b082d11b36..bff96fbfba2 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -55,11 +55,11 @@ class CI_Cache_redis extends CI_Driver * @var array */ protected static $_default_config = array( + 'socket_type' => 'tcp', 'host' => '127.0.0.1', 'password' => NULL, 'port' => 6379, - 'timeout' => 0, - 'database' => 0 + 'timeout' => 0 ); /** @@ -69,20 +69,19 @@ class CI_Cache_redis extends CI_Driver */ protected $_redis; - /** - * del()/delete() method name depending on phpRedis version + * An internal cache for storing keys of serialized values. * - * @var string + * @var array */ - protected static $_delete_name; + protected $_serialized = array(); /** - * sRem()/sRemove() method name depending on phpRedis version + * del()/delete() method name depending on phpRedis version * * @var string */ - protected static $_sRemove_name; + protected static $_delete_name; // ------------------------------------------------------------------------ @@ -105,19 +104,9 @@ public function __construct() return; } - if ( ! isset(static::$_delete_name, static::$_sRemove_name)) - { - if (version_compare(phpversion('redis'), '5', '>=')) - { - static::$_delete_name = 'del'; - static::$_sRemove_name = 'sRem'; - } - else - { - static::$_delete_name = 'delete'; - static::$_sRemove_name = 'sRemove'; - } - } + isset(static::$_delete_name) OR static::$_delete_name = version_compare(phpversion('phpredis'), '5', '>=') + ? 'del' + : 'delete'; $CI =& get_instance(); @@ -134,19 +123,23 @@ public function __construct() try { - if ( ! $this->_redis->connect($config['host'], ($config['host'][0] === '/' ? 0 : $config['port']), $config['timeout'])) + if ($config['socket_type'] === 'unix') { - log_message('error', 'Cache: Redis connection failed. Check your configuration.'); + $success = $this->_redis->connect($config['socket']); + } + else // tcp socket + { + $success = $this->_redis->connect($config['host'], $config['port'], $config['timeout']); } - if (isset($config['password']) && ! $this->_redis->auth($config['password'])) + if ( ! $success) { - log_message('error', 'Cache: Redis authentication failed.'); + log_message('error', 'Cache: Redis connection failed. Check your configuration.'); } - if (isset($config['database']) && $config['database'] > 0 && ! $this->_redis->select($config['database'])) + if (isset($config['password']) && ! $this->_redis->auth($config['password'])) { - log_message('error', 'Cache: Redis select database failed.'); + log_message('error', 'Cache: Redis authentication failed.'); } } catch (RedisException $e) @@ -165,30 +158,14 @@ public function __construct() */ public function get($key) { - $data = $this->_redis->hMGet($key, array('__ci_type', '__ci_value')); + $value = $this->_redis->get($key); if ($value !== FALSE && $this->_redis->sIsMember('_ci_redis_serialized', $key)) { - return FALSE; + return unserialize($value); } - switch ($data['__ci_type']) - { - case 'array': - case 'object': - return unserialize($data['__ci_value']); - case 'boolean': - case 'integer': - case 'double': // Yes, 'double' is returned and NOT 'float' - case 'string': - case 'NULL': - return settype($data['__ci_value'], $data['__ci_type']) - ? $data['__ci_value'] - : FALSE; - case 'resource': - default: - return FALSE; - } + return $value; } // ------------------------------------------------------------------------ @@ -204,33 +181,22 @@ public function get($key) */ public function save($id, $data, $ttl = 60, $raw = FALSE) { - switch ($data_type = gettype($data)) + if (is_array($data) OR is_object($data)) { - case 'array': - case 'object': - $data = serialize($data); - break; - case 'boolean': - case 'integer': - case 'double': // Yes, 'double' is returned and NOT 'float' - case 'string': - case 'NULL': - break; - case 'resource': - default: + if ( ! $this->_redis->sIsMember('_ci_redis_serialized', $id) && ! $this->_redis->sAdd('_ci_redis_serialized', $id)) + { return FALSE; - } + } - if ( ! $this->_redis->hMSet($id, array('__ci_type' => $data_type, '__ci_value' => $data))) - { - return FALSE; + isset($this->_serialized[$id]) OR $this->_serialized[$id] = TRUE; + $data = serialize($data); } else { - $this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $id); + $this->_redis->sRemove('_ci_redis_serialized', $id); } - return TRUE; + return $this->_redis->set($id, $data, $ttl); } // ------------------------------------------------------------------------ @@ -248,7 +214,7 @@ public function delete($key) return FALSE; } - $this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $key); + $this->_redis->sRemove('_ci_redis_serialized', $key); return TRUE; } diff --git a/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php index 703fece7a51..1feaa158fd7 100644 --- a/system/libraries/Cache/drivers/Cache_wincache.php +++ b/system/libraries/Cache/drivers/Cache_wincache.php @@ -41,7 +41,7 @@ * CodeIgniter Wincache Caching Class * * Read more about Wincache functions here: - * https://secure.php.net/manual/en/ref.wincache.php + * http://www.php.net/manual/en/ref.wincache.php * * @package CodeIgniter * @subpackage Libraries @@ -169,10 +169,10 @@ public function clean() * * @return mixed array on success, false on failure */ - public function cache_info() - { - return wincache_ucache_info(TRUE); - } + public function cache_info() + { + return wincache_ucache_info(TRUE); + } // ------------------------------------------------------------------------ diff --git a/system/libraries/Cache/drivers/index.html b/system/libraries/Cache/drivers/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/libraries/Cache/drivers/index.html +++ b/system/libraries/Cache/drivers/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/libraries/Cache/index.html b/system/libraries/Cache/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/libraries/Cache/index.html +++ b/system/libraries/Cache/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php new file mode 100644 index 00000000000..6a107752caf --- /dev/null +++ b/system/libraries/Cart.php @@ -0,0 +1,567 @@ +CI =& get_instance(); + + // Are any config settings being passed manually? If so, set them + $config = is_array($params) ? $params : array(); + + // Load the Sessions class + $this->CI->load->driver('session', $config); + + // Grab the shopping cart array from the session table + $this->_cart_contents = $this->CI->session->userdata('cart_contents'); + if ($this->_cart_contents === NULL) + { + // No cart exists so we'll set some base values + $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); + } + + log_message('info', 'Cart Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Insert items into the cart and save it to the session table + * + * @param array + * @return bool + */ + public function insert($items = array()) + { + // Was any cart data passed? No? Bah... + if ( ! is_array($items) OR count($items) === 0) + { + log_message('error', 'The insert method must be passed an array containing data.'); + return FALSE; + } + + // You can either insert a single product using a one-dimensional array, + // or multiple products using a multi-dimensional one. The way we + // determine the array type is by looking for a required array key named "id" + // at the top level. If it's not found, we will assume it's a multi-dimensional array. + + $save_cart = FALSE; + if (isset($items['id'])) + { + if (($rowid = $this->_insert($items))) + { + $save_cart = TRUE; + } + } + else + { + foreach ($items as $val) + { + if (is_array($val) && isset($val['id'])) + { + if ($this->_insert($val)) + { + $save_cart = TRUE; + } + } + } + } + + // Save the cart data if the insert was successful + if ($save_cart === TRUE) + { + $this->_save_cart(); + return isset($rowid) ? $rowid : TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Insert + * + * @param array + * @return bool + */ + protected function _insert($items = array()) + { + // Was any cart data passed? No? Bah... + if ( ! is_array($items) OR count($items) === 0) + { + log_message('error', 'The insert method must be passed an array containing data.'); + return FALSE; + } + + // -------------------------------------------------------------------- + + // Does the $items array contain an id, quantity, price, and name? These are required + if ( ! isset($items['id'], $items['qty'], $items['price'], $items['name'])) + { + log_message('error', 'The cart array must contain a product ID, quantity, price, and name.'); + return FALSE; + } + + // -------------------------------------------------------------------- + + // Prep the quantity. It can only be a number. Duh... also trim any leading zeros + $items['qty'] = (float) $items['qty']; + + // If the quantity is zero or blank there's nothing for us to do + if ($items['qty'] == 0) + { + return FALSE; + } + + // -------------------------------------------------------------------- + + // Validate the product ID. It can only be alpha-numeric, dashes, underscores or periods + // Not totally sure we should impose this rule, but it seems prudent to standardize IDs. + // Note: These can be user-specified by setting the $this->product_id_rules variable. + if ( ! preg_match('/^['.$this->product_id_rules.']+$/i', $items['id'])) + { + log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores'); + return FALSE; + } + + // -------------------------------------------------------------------- + + // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods. + // Note: These can be user-specified by setting the $this->product_name_rules variable. + if ($this->product_name_safe && ! preg_match('/^['.$this->product_name_rules.']+$/i'.(UTF8_ENABLED ? 'u' : ''), $items['name'])) + { + log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); + return FALSE; + } + + // -------------------------------------------------------------------- + + // Prep the price. Remove leading zeros and anything that isn't a number or decimal point. + $items['price'] = (float) $items['price']; + + // We now need to create a unique identifier for the item being inserted into the cart. + // Every time something is added to the cart it is stored in the master cart array. + // Each row in the cart array, however, must have a unique index that identifies not only + // a particular product, but makes it possible to store identical products with different options. + // For example, what if someone buys two identical t-shirts (same product ID), but in + // different sizes? The product ID (and other attributes, like the name) will be identical for + // both sizes because it's the same shirt. The only difference will be the size. + // Internally, we need to treat identical submissions, but with different options, as a unique product. + // Our solution is to convert the options array to a string and MD5 it along with the product ID. + // This becomes the unique "row ID" + if (isset($items['options']) && count($items['options']) > 0) + { + $rowid = md5($items['id'].serialize($items['options'])); + } + else + { + // No options were submitted so we simply MD5 the product ID. + // Technically, we don't need to MD5 the ID in this case, but it makes + // sense to standardize the format of array indexes for both conditions + $rowid = md5($items['id']); + } + + // -------------------------------------------------------------------- + + // Now that we have our unique "row ID", we'll add our cart items to the master array + // grab quantity if it's already there and add it on + $old_quantity = isset($this->_cart_contents[$rowid]['qty']) ? (int) $this->_cart_contents[$rowid]['qty'] : 0; + + // Re-create the entry, just to make sure our index contains only the data from this submission + $items['rowid'] = $rowid; + $items['qty'] += $old_quantity; + $this->_cart_contents[$rowid] = $items; + + return $rowid; + } + + // -------------------------------------------------------------------- + + /** + * Update the cart + * + * This function permits the quantity of a given item to be changed. + * Typically it is called from the "view cart" page if a user makes + * changes to the quantity before checkout. That array must contain the + * product ID and quantity for each item. + * + * @param array + * @return bool + */ + public function update($items = array()) + { + // Was any cart data passed? + if ( ! is_array($items) OR count($items) === 0) + { + return FALSE; + } + + // You can either update a single product using a one-dimensional array, + // or multiple products using a multi-dimensional one. The way we + // determine the array type is by looking for a required array key named "rowid". + // If it's not found we assume it's a multi-dimensional array + $save_cart = FALSE; + if (isset($items['rowid'])) + { + if ($this->_update($items) === TRUE) + { + $save_cart = TRUE; + } + } + else + { + foreach ($items as $val) + { + if (is_array($val) && isset($val['rowid'])) + { + if ($this->_update($val) === TRUE) + { + $save_cart = TRUE; + } + } + } + } + + // Save the cart data if the insert was successful + if ($save_cart === TRUE) + { + $this->_save_cart(); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Update the cart + * + * This function permits changing item properties. + * Typically it is called from the "view cart" page if a user makes + * changes to the quantity before checkout. That array must contain the + * rowid and quantity for each item. + * + * @param array + * @return bool + */ + protected function _update($items = array()) + { + // Without these array indexes there is nothing we can do + if ( ! isset($items['rowid'], $this->_cart_contents[$items['rowid']])) + { + return FALSE; + } + + // Prep the quantity + if (isset($items['qty'])) + { + $items['qty'] = (float) $items['qty']; + // Is the quantity zero? If so we will remove the item from the cart. + // If the quantity is greater than zero we are updating + if ($items['qty'] == 0) + { + unset($this->_cart_contents[$items['rowid']]); + return TRUE; + } + } + + // find updatable keys + $keys = array_intersect(array_keys($this->_cart_contents[$items['rowid']]), array_keys($items)); + // if a price was passed, make sure it contains valid data + if (isset($items['price'])) + { + $items['price'] = (float) $items['price']; + } + + // product id & name shouldn't be changed + foreach (array_diff($keys, array('id', 'name')) as $key) + { + $this->_cart_contents[$items['rowid']][$key] = $items[$key]; + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Save the cart array to the session DB + * + * @return bool + */ + protected function _save_cart() + { + // Let's add up the individual prices and set the cart sub-total + $this->_cart_contents['total_items'] = $this->_cart_contents['cart_total'] = 0; + foreach ($this->_cart_contents as $key => $val) + { + // We make sure the array contains the proper indexes + if ( ! is_array($val) OR ! isset($val['price'], $val['qty'])) + { + continue; + } + + $this->_cart_contents['cart_total'] += ($val['price'] * $val['qty']); + $this->_cart_contents['total_items'] += $val['qty']; + $this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']); + } + + // Is our cart empty? If so we delete it from the session + if (count($this->_cart_contents) <= 2) + { + $this->CI->session->unset_userdata('cart_contents'); + + // Nothing more to do... coffee time! + return FALSE; + } + + // If we made it this far it means that our cart has data. + // Let's pass it to the Session class so it can be stored + $this->CI->session->set_userdata(array('cart_contents' => $this->_cart_contents)); + + // Woot! + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Cart Total + * + * @return int + */ + public function total() + { + return $this->_cart_contents['cart_total']; + } + + // -------------------------------------------------------------------- + + /** + * Remove Item + * + * Removes an item from the cart + * + * @param int + * @return bool + */ + public function remove($rowid) + { + // unset & save + unset($this->_cart_contents[$rowid]); + $this->_save_cart(); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Total Items + * + * Returns the total item count + * + * @return int + */ + public function total_items() + { + return $this->_cart_contents['total_items']; + } + + // -------------------------------------------------------------------- + + /** + * Cart Contents + * + * Returns the entire cart array + * + * @param bool + * @return array + */ + public function contents($newest_first = FALSE) + { + // do we want the newest first? + $cart = ($newest_first) ? array_reverse($this->_cart_contents) : $this->_cart_contents; + + // Remove these so they don't create a problem when showing the cart table + unset($cart['total_items']); + unset($cart['cart_total']); + + return $cart; + } + + // -------------------------------------------------------------------- + + /** + * Get cart item + * + * Returns the details of a specific item in the cart + * + * @param string $row_id + * @return array + */ + public function get_item($row_id) + { + return (in_array($row_id, array('total_items', 'cart_total'), TRUE) OR ! isset($this->_cart_contents[$row_id])) + ? FALSE + : $this->_cart_contents[$row_id]; + } + + // -------------------------------------------------------------------- + + /** + * Has options + * + * Returns TRUE if the rowid passed to this function correlates to an item + * that has options associated with it. + * + * @param string $row_id = '' + * @return bool + */ + public function has_options($row_id = '') + { + return (isset($this->_cart_contents[$row_id]['options']) && count($this->_cart_contents[$row_id]['options']) !== 0); + } + + // -------------------------------------------------------------------- + + /** + * Product options + * + * Returns the an array of options, for a particular product row ID + * + * @param string $row_id = '' + * @return array + */ + public function product_options($row_id = '') + { + return isset($this->_cart_contents[$row_id]['options']) ? $this->_cart_contents[$row_id]['options'] : array(); + } + + // -------------------------------------------------------------------- + + /** + * Format Number + * + * Returns the supplied number with commas and a decimal point. + * + * @param float + * @return string + */ + public function format_number($n = '') + { + return ($n === '') ? '' : number_format( (float) $n, 2, '.', ','); + } + + // -------------------------------------------------------------------- + + /** + * Destroy the cart + * + * Empties the cart and kills the session + * + * @return void + */ + public function destroy() + { + $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); + $this->CI->session->unset_userdata('cart_contents'); + } + +} diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 1912e0442d3..10b74777dec 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -147,7 +147,7 @@ class CI_Email { * * @var string */ - public $charset = 'utf-8'; + public $charset = 'UTF-8'; /** * Alternative message (for HTML messages only) @@ -161,7 +161,7 @@ class CI_Email { * * @var bool */ - public $validate = TRUE; + public $validate = FALSE; /** * X-Priority header value. @@ -174,7 +174,7 @@ class CI_Email { * Newline character sequence. * Use "\r\n" to comply with RFC 822. * - * @link https://www.ietf.org/rfc/rfc822.txt + * @link http://www.ietf.org/rfc/rfc822.txt * @var string "\r\n" or "\n" */ public $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822) @@ -188,7 +188,7 @@ class CI_Email { * switching to "\n", while improper, is the only solution * that seems to work for all environments. * - * @link https://www.ietf.org/rfc/rfc822.txt + * @link http://www.ietf.org/rfc/rfc822.txt * @var string */ public $crlf = "\n"; @@ -225,6 +225,13 @@ class CI_Email { // -------------------------------------------------------------------- + /** + * Whether PHP is running in safe mode. Initialized by the class constructor. + * + * @var bool + */ + protected $_safe_mode = FALSE; + /** * Subject header * @@ -388,6 +395,7 @@ public function __construct(array $config = array()) { $this->charset = config_item('charset'); $this->initialize($config); + $this->_safe_mode = ( ! is_php('5.4') && ini_get('safe_mode')); isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload')); @@ -667,6 +675,18 @@ public function subject($subject) public function message($body) { $this->_body = rtrim(str_replace("\r", '', $body)); + + /* strip slashes only if magic quotes is ON + if we do it with magic quotes OFF, it strips real, user-inputted chars. + + NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and + it will probably not exist in future versions at all. + */ + if ( ! is_php('5.4') && get_magic_quotes_gpc()) + { + $this->_body = stripslashes($this->_body); + } + return $this; } @@ -1012,15 +1032,16 @@ public function validate_email($email) */ public function valid_email($email) { - if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $email, $matches)) + if (function_exists('idn_to_ascii') && strpos($email, '@')) { + list($account, $domain) = explode('@', $email, 2); $domain = defined('INTL_IDNA_VARIANT_UTS46') - ? idn_to_ascii($matches[2], 0, INTL_IDNA_VARIANT_UTS46) - : idn_to_ascii($matches[2]); + ? idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46) + : idn_to_ascii($domain); if ($domain !== FALSE) { - $email = $matches[1].'@'.$domain; + $email = $account.'@'.$domain; } } @@ -1240,7 +1261,7 @@ protected function _write_headers() /** * Build Final Body and attachments * - * @return void + * @return bool */ protected function _build_message() { @@ -1407,6 +1428,8 @@ protected function _build_message() $this->_finalbody = ($this->_get_protocol() === 'mail') ? $body : $hdr.$this->newline.$this->newline.$body; + + return TRUE; } // -------------------------------------------------------------------- @@ -1467,7 +1490,7 @@ protected function _append_attachments(&$body, $boundary, $multipart = null) * Prep Quoted Printable * * Prepares string for Quoted-Printable Content-Transfer-Encoding - * Refer to RFC 2045 https://www.ietf.org/rfc/rfc2045.txt + * Refer to RFC 2045 http://www.ietf.org/rfc/rfc2045.txt * * @param string * @return string @@ -1476,7 +1499,7 @@ protected function _prep_quoted_printable($str) { // ASCII code numbers for "safe" characters that can always be // used literally, without encoding, as described in RFC 2049. - // https://www.ietf.org/rfc/rfc2049.txt + // http://www.ietf.org/rfc/rfc2049.txt static $ascii_safe_chars = array( // ' ( ) + , - . / : = ? 39, 40, 41, 43, 44, 45, 46, 47, 58, 61, 63, @@ -1668,8 +1691,8 @@ public function send($auto_clear = TRUE) $this->reply_to($this->_headers['From']); } - if (empty($this->_recipients) && ! isset($this->_headers['To']) - && empty($this->_bcc_array) && ! isset($this->_headers['Bcc']) + if ( ! isset($this->_recipients) && ! isset($this->_headers['To']) + && ! isset($this->_bcc_array) && ! isset($this->_headers['Bcc']) && ! isset($this->_headers['Cc'])) { $this->_set_error_message('lang:email_no_recipients'); @@ -1680,17 +1703,21 @@ public function send($auto_clear = TRUE) if ($this->bcc_batch_mode && count($this->_bcc_array) > $this->bcc_batch_size) { - $this->batch_bcc_send(); + $result = $this->batch_bcc_send(); - if ($auto_clear) + if ($result && $auto_clear) { $this->clear(); } - return TRUE; + return $result; + } + + if ($this->_build_message() === FALSE) + { + return FALSE; } - $this->_build_message(); $result = $this->_spool_email(); if ($result && $auto_clear) @@ -1749,7 +1776,11 @@ public function batch_bcc_send() $this->_bcc_array = $bcc; } - $this->_build_message(); + if ($this->_build_message() === FALSE) + { + return FALSE; + } + $this->_spool_email(); } } @@ -1826,7 +1857,7 @@ protected function _spool_email() */ protected function _validate_email_for_shell(&$email) { - if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@')) + if (function_exists('idn_to_ascii') && strpos($email, '@')) { list($account, $domain) = explode('@', $email, 2); $domain = defined('INTL_IDNA_VARIANT_UTS46') @@ -1860,14 +1891,16 @@ protected function _send_with_mail() // so this needs to be assigned to a variable $from = $this->clean_email($this->_headers['Return-Path']); - if ( ! $this->_validate_email_for_shell($from)) + if ($this->_safe_mode === TRUE || ! $this->_validate_email_for_shell($from)) { return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str); } - - // most documentation of sendmail using the "-f" flag lacks a space after it, however - // we've encountered servers that seem to require it to be in place. - return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, '-f '.$from); + else + { + // most documentation of sendmail using the "-f" flag lacks a space after it, however + // we've encountered servers that seem to require it to be in place. + return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, '-f '.$from); + } } // -------------------------------------------------------------------- @@ -1948,21 +1981,27 @@ protected function _send_with_smtp() } } - foreach ($this->_cc_array as $val) + if (count($this->_cc_array) > 0) { - if ($val !== '' && ! $this->_send_command('to', $val)) + foreach ($this->_cc_array as $val) { - $this->_smtp_end(); - return FALSE; + if ($val !== '' && ! $this->_send_command('to', $val)) + { + $this->_smtp_end(); + return FALSE; + } } } - foreach ($this->_bcc_array as $val) + if (count($this->_bcc_array) > 0) { - if ($val !== '' && ! $this->_send_command('to', $val)) + foreach ($this->_bcc_array as $val) { - $this->_smtp_end(); - return FALSE; + if ($val !== '' && ! $this->_send_command('to', $val)) + { + $this->_smtp_end(); + return FALSE; + } } } @@ -1976,6 +2015,7 @@ protected function _send_with_smtp() $this->_send_data($this->_header_str.preg_replace('/^\./m', '..$1', $this->_finalbody)); $this->_send_data('.'); + $reply = $this->_get_smtp_data(); $this->_set_error_message($reply); @@ -2001,7 +2041,9 @@ protected function _send_with_smtp() */ protected function _smtp_end() { - $this->_send_command($this->smtp_keepalive ? 'reset' : 'quit'); + ($this->smtp_keepalive) + ? $this->_send_command('reset') + : $this->_send_command('quit'); } // -------------------------------------------------------------------- @@ -2020,13 +2062,11 @@ protected function _smtp_connect() $ssl = ($this->smtp_crypto === 'ssl') ? 'ssl://' : ''; - $this->_smtp_connect = fsockopen( - $ssl.$this->smtp_host, - $this->smtp_port, - $errno, - $errstr, - $this->smtp_timeout - ); + $this->_smtp_connect = fsockopen($ssl.$this->smtp_host, + $this->smtp_port, + $errno, + $errstr, + $this->smtp_timeout); if ( ! is_resource($this->_smtp_connect)) { @@ -2079,49 +2119,57 @@ protected function _send_command($cmd, $data = '') { switch ($cmd) { - case 'hello': - if ($this->_smtp_auth OR $this->_get_encoding() === '8bit') - { - $this->_send_data('EHLO '.$this->_get_hostname()); - } - else - { - $this->_send_data('HELO '.$this->_get_hostname()); - } - - $resp = 250; - break; - case 'starttls': - $this->_send_data('STARTTLS'); - $resp = 220; - break; - case 'from': - $this->_send_data('MAIL FROM:<'.$data.'>'); - $resp = 250; - break; - case 'to': - if ($this->dsn) - { - $this->_send_data('RCPT TO:<'.$data.'> NOTIFY=SUCCESS,DELAY,FAILURE ORCPT=rfc822;'.$data); - } - else - { - $this->_send_data('RCPT TO:<'.$data.'>'); - } - $resp = 250; - break; - case 'data': - $this->_send_data('DATA'); - $resp = 354; - break; + case 'hello' : + + if ($this->_smtp_auth OR $this->_get_encoding() === '8bit') + { + $this->_send_data('EHLO '.$this->_get_hostname()); + } + else + { + $this->_send_data('HELO '.$this->_get_hostname()); + } + + $resp = 250; + break; + case 'starttls' : + + $this->_send_data('STARTTLS'); + $resp = 220; + break; + case 'from' : + + $this->_send_data('MAIL FROM:<'.$data.'>'); + $resp = 250; + break; + case 'to' : + + if ($this->dsn) + { + $this->_send_data('RCPT TO:<'.$data.'> NOTIFY=SUCCESS,DELAY,FAILURE ORCPT=rfc822;'.$data); + } + else + { + $this->_send_data('RCPT TO:<'.$data.'>'); + } + + $resp = 250; + break; + case 'data' : + + $this->_send_data('DATA'); + $resp = 354; + break; case 'reset': - $this->_send_data('RSET'); - $resp = 250; - break; - case 'quit': - $this->_send_data('QUIT'); - $resp = 221; - break; + + $this->_send_data('RSET'); + $resp = 250; + break; + case 'quit' : + + $this->_send_data('QUIT'); + $resp = 221; + break; } $reply = $this->_get_smtp_data(); @@ -2163,6 +2211,7 @@ protected function _smtp_authenticate() } $this->_send_data('AUTH LOGIN'); + $reply = $this->_get_smtp_data(); if (strpos($reply, '503') === 0) // Already authenticated @@ -2176,6 +2225,7 @@ protected function _smtp_authenticate() } $this->_send_data(base64_encode($this->smtp_user)); + $reply = $this->_get_smtp_data(); if (strpos($reply, '334') !== 0) @@ -2185,6 +2235,7 @@ protected function _smtp_authenticate() } $this->_send_data(base64_encode($this->smtp_pass)); + $reply = $this->_get_smtp_data(); if (strpos($reply, '235') !== 0) @@ -2218,7 +2269,7 @@ protected function _send_data($data) { break; } - // See https://bugs.php.net/bug.php?id=39598 and https://secure.php.net/manual/en/function.fwrite.php#96951 + // See https://bugs.php.net/bug.php?id=39598 and http://php.net/manual/en/function.fwrite.php#96951 elseif ($result === 0) { if ($timestamp === 0) @@ -2281,7 +2332,7 @@ protected function _get_smtp_data() * (eg: "[1.2.3.4]"). * * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 - * @link https://cbl.abuseat.org/namingproblems.html + * @link http://cbl.abuseat.org/namingproblems.html * @return string */ protected function _get_hostname() @@ -2305,15 +2356,34 @@ protected function _get_hostname() */ public function print_debugger($include = array('headers', 'subject', 'body')) { - $msg = implode('', $this->_debug_msg); + $msg = ''; + + if (count($this->_debug_msg) > 0) + { + foreach ($this->_debug_msg as $val) + { + $msg .= $val; + } + } // Determine which parts of our raw data needs to be printed $raw_data = ''; is_array($include) OR $include = array($include); - in_array('headers', $include, TRUE) && $raw_data = htmlspecialchars($this->_header_str)."\n"; - in_array('subject', $include, TRUE) && $raw_data .= htmlspecialchars($this->_subject)."\n"; - in_array('body', $include, TRUE) && $raw_data .= htmlspecialchars($this->_finalbody); + if (in_array('headers', $include, TRUE)) + { + $raw_data = htmlspecialchars($this->_header_str)."\n"; + } + + if (in_array('subject', $include, TRUE)) + { + $raw_data .= htmlspecialchars($this->_subject)."\n"; + } + + if (in_array('body', $include, TRUE)) + { + $raw_data .= htmlspecialchars($this->_finalbody); + } return $msg.($raw_data === '' ? '' : '
'.$raw_data.'
'); } @@ -2407,6 +2477,9 @@ protected static function substr($str, $start, $length = NULL) { if (self::$func_overload) { + // mb_substr($str, $start, null, '8bit') returns an empty + // string on PHP 5.3 + isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); return mb_substr($str, $start, $length, '8bit'); } diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php index fd858cb297b..4c1973fee55 100644 --- a/system/libraries/Encryption.php +++ b/system/libraries/Encryption.php @@ -482,7 +482,7 @@ protected function _openssl_encrypt($data, $params) $data, $params['handle'], $params['key'], - OPENSSL_RAW_DATA, + 1, // DO NOT TOUCH! $iv ); @@ -641,7 +641,7 @@ protected function _openssl_decrypt($data, $params) $data, $params['handle'], $params['key'], - OPENSSL_RAW_DATA, + 1, // DO NOT TOUCH! $iv ); } @@ -928,6 +928,9 @@ protected static function substr($str, $start, $length = NULL) { if (self::$func_overload) { + // mb_substr($str, $start, null, '8bit') returns an empty + // string on PHP 5.3 + isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); return mb_substr($str, $start, $length, '8bit'); } diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index de59ef9f736..fdf2020101c 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -104,6 +104,13 @@ class CI_Form_validation { */ protected $error_string = ''; + /** + * Whether the form data has been validated as safe + * + * @var bool + */ + protected $_safe_form_data = FALSE; + /** * Custom data to validate * @@ -157,7 +164,7 @@ public function __construct($rules = array()) * @param array $errors * @return CI_Form_validation */ - public function set_rules($field, $label = null, $rules = null, $errors = array()) + public function set_rules($field, $label = '', $rules = array(), $errors = array()) { // No reason to set rules if we have no POST data // or a validation array has not been specified @@ -190,22 +197,18 @@ public function set_rules($field, $label = null, $rules = null, $errors = array( return $this; } - elseif ( ! isset($rules)) - { - throw new BadMethodCallException('Form_validation: set_rules() called without a $rules parameter'); - } // No fields or no rules? Nothing to do... if ( ! is_string($field) OR $field === '' OR empty($rules)) { - throw new RuntimeException('Form_validation: set_rules() called with an empty $rules parameter'); + return $this; } elseif ( ! is_array($rules)) { // BC: Convert pipe-separated rules string to an array if ( ! is_string($rules)) { - throw new InvalidArgumentException('Form_validation: set_rules() expect $rules to be string or array; '.gettype($rules).' given'); + return $this; } $rules = preg_split('/\|(?![^\[]*\])/', $rules); @@ -407,11 +410,10 @@ public function error_string($prefix = '', $suffix = '') * * This function does all the work. * - * @param string $config - * @param array $data + * @param string $group * @return bool */ - public function run($config = NULL, &$data = NULL) + public function run($group = '') { $validation_array = empty($this->validation_data) ? $_POST @@ -422,19 +424,19 @@ public function run($config = NULL, &$data = NULL) if (count($this->_field_data) === 0) { // No validation rules? We're done... - if (empty($this->_config_rules)) + if (count($this->_config_rules) === 0) { return FALSE; } - if (empty($config)) + if (empty($group)) { // Is there a validation rule for the particular URI being accessed? - $config = trim($this->CI->uri->ruri_string(), '/'); - isset($this->_config_rules[$config]) OR $config = $this->CI->router->class.'/'.$this->CI->router->method; + $group = trim($this->CI->uri->ruri_string(), '/'); + isset($this->_config_rules[$group]) OR $group = $this->CI->router->class.'/'.$this->CI->router->method; } - $this->set_rules(isset($this->_config_rules[$config]) ? $this->_config_rules[$config] : $this->_config_rules); + $this->set_rules(isset($this->_config_rules[$group]) ? $this->_config_rules[$group] : $this->_config_rules); // Were we able to set the rules correctly? if (count($this->_field_data) === 0) @@ -476,22 +478,17 @@ public function run($config = NULL, &$data = NULL) $this->_execute($row, $row['rules'], $row['postdata']); } - if ( ! empty($this->_error_array)) + // Did we end up with any errors? + $total_errors = count($this->_error_array); + if ($total_errors > 0) { - return FALSE; + $this->_safe_form_data = TRUE; } - // Fill $data if requested, otherwise modify $_POST, as long as - // set_data() wasn't used (yea, I know it sounds confusing) - if (func_num_args() >= 2) - { - $data = empty($this->validation_data) ? $_POST : $this->validation_data; - $this->_reset_data_array($data); - return TRUE; - } + // Now we need to re-set the POST data with the new, processed data + empty($this->validation_data) && $this->_reset_post_array(); - empty($this->validation_data) && $this->_reset_data_array($_POST); - return TRUE; + return ($total_errors === 0); } // -------------------------------------------------------------------- @@ -579,7 +576,7 @@ protected function _reduce_array($array, $keys, $i = 0) * * @return void */ - protected function _reset_data_array(&$data) + protected function _reset_post_array() { foreach ($this->_field_data as $field => $row) { @@ -587,26 +584,27 @@ protected function _reset_data_array(&$data) { if ($row['is_array'] === FALSE) { - isset($data[$field]) && $data[$field] = is_array($row['postdata']) ? NULL : $row['postdata']; + isset($_POST[$field]) && $_POST[$field] = is_array($row['postdata']) ? NULL : $row['postdata']; } else { - $data_ref =& $data; + // start with a reference + $post_ref =& $_POST; // before we assign values, make a reference to the right POST key if (count($row['keys']) === 1) { - $data_ref =& $data[current($row['keys'])]; + $post_ref =& $post_ref[current($row['keys'])]; } else { foreach ($row['keys'] as $val) { - $data_ref =& $data_ref[$val]; + $post_ref =& $post_ref[$val]; } } - $data_ref = $row['postdata']; + $post_ref = $row['postdata']; } } } @@ -625,13 +623,11 @@ protected function _reset_data_array(&$data) */ protected function _execute($row, $rules, $postdata = NULL, $cycles = 0) { - $allow_arrays = in_array('is_array', $rules, TRUE); - // If the $_POST data is an array we will run a recursive call // // Note: We MUST check if the array is empty or not! // Otherwise empty arrays will always pass validation. - if ($allow_arrays === FALSE && is_array($postdata) && ! empty($postdata)) + if (is_array($postdata) && ! empty($postdata)) { foreach ($postdata as $key => $val) { @@ -660,16 +656,14 @@ protected function _execute($row, $rules, $postdata = NULL, $cycles = 0) $postdata = $this->_field_data[$row['field']]['postdata'][$cycles]; $_in_array = TRUE; } - // If we get an array field, but it's not expected - then it is most likely - // somebody messing with the form on the client side, so we'll just consider - // it an empty field - elseif ($allow_arrays === FALSE && is_array($this->_field_data[$row['field']]['postdata'])) - { - $postdata = NULL; - } else { - $postdata = $this->_field_data[$row['field']]['postdata']; + // If we get an array field, but it's not expected - then it is most likely + // somebody messing with the form on the client side, so we'll just consider + // it an empty field + $postdata = is_array($this->_field_data[$row['field']]['postdata']) + ? NULL + : $this->_field_data[$row['field']]['postdata']; } // Is the rule a callback? @@ -704,7 +698,7 @@ protected function _execute($row, $rules, $postdata = NULL, $cycles = 0) // Ignore empty, non-required inputs with a few exceptions ... if ( - ($postdata === NULL OR ($allow_arrays === FALSE && $postdata === '')) + ($postdata === NULL OR $postdata === '') && $callback === FALSE && $callable === FALSE && ! in_array($rule, array('required', 'isset', 'matches'), TRUE) @@ -1299,31 +1293,6 @@ public function valid_ip($ip, $which = '') // -------------------------------------------------------------------- - /** - * Validate MAC address - * - * @param string $mac - * @return bool - */ - public function valid_mac($mac) - { - if ( ! is_php('5.5')) - { - // Most common format, with either dash or colon delimiters - if (preg_match('#\A[0-9a-f]{2}(?[:-])([0-9a-f]{2}(?P=delimiter)){4}[0-9a-f]{2}\z#i', $mac)) - { - return TRUE; - } - - // The less common format; e.g. 0123.4567.89ab - return (bool) preg_match('#((\A|\.)[0-9a-f]{4}){3}\z#i', $mac); - } - - return (bool) filter_var($mac, FILTER_VALIDATE_MAC); - } - - // -------------------------------------------------------------------- - /** * Alpha * @@ -1528,6 +1497,38 @@ public function valid_base64($str) // -------------------------------------------------------------------- + /** + * Prep data for form + * + * This function allows HTML to be safely shown in a form. + * Special characters are converted. + * + * @deprecated 3.0.6 Not used anywhere within the framework and pretty much useless + * @param mixed $data Input data + * @return mixed + */ + public function prep_for_form($data) + { + if ($this->_safe_form_data === FALSE OR empty($data)) + { + return $data; + } + + if (is_array($data)) + { + foreach ($data as $key => $val) + { + $data[$key] = $this->prep_for_form($val); + } + + return $data; + } + + return str_replace(array("'", '"', '<', '>'), array(''', '"', '<', '>'), stripslashes($data)); + } + + // -------------------------------------------------------------------- + /** * Prep URL * @@ -1536,7 +1537,12 @@ public function valid_base64($str) */ public function prep_url($str = '') { - if ($str !== '' && stripos($str, 'http://') !== 0 && stripos($str, 'https://') !== 0) + if ($str === 'http://' OR $str === '') + { + return ''; + } + + if (strpos($str, 'http://') !== 0 && strpos($str, 'https://') !== 0) { return 'http://'.$str; } diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 0d9fa442035..b89bc5b7e37 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -946,10 +946,6 @@ public function image_process_netpbm($action = 'resize') $cmd_in = 'pngtopnm'; $cmd_out = 'ppmtopng'; break; - case 18 : - $cmd_in = 'webptopnm'; - $cmd_out = 'ppmtowebp'; - break; } if ($action === 'crop') @@ -1211,7 +1207,7 @@ public function overlay_watermark() } // Build the finalized image - if ($wm_img_type === 3) + if ($wm_img_type === 3 && function_exists('imagealphablending')) { @imagealphablending($src_img, TRUE); } @@ -1474,13 +1470,6 @@ public function image_create_gd($path = '', $image_type = '') $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported')); return FALSE; } - case 18: - if ( ! function_exists('imagecreatefromwebp')) - { - $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_webp_not_supported')); - return FALSE; - } - return imagecreatefromwebp($path); return imagecreatefrompng($path); default: @@ -1543,19 +1532,6 @@ public function image_save_gd($resource) return FALSE; } break; - case 18: - if ( ! function_exists('imagewebp')) - { - $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_webp_not_supported')); - return FALSE; - } - - if ( ! @imagewebp($resource, $this->full_dst_path)) - { - $this->set_error('imglib_save_failed'); - return FALSE; - } - break; default: $this->set_error(array('imglib_unsupported_imagecreate')); return FALSE; @@ -1575,16 +1551,7 @@ public function image_save_gd($resource) */ public function image_display_gd($resource) { - // RFC 6266 allows for multibyte filenames, but only in UTF-8, - // so we have to make it conditional ... - $filename = basename(empty($this->new_image) ? $this->source_image : $this->new_image); - $charset = strtoupper(config_item('charset')); - $utf8_filename = ($charset !== 'UTF-8') - ? get_instance()->utf8->convert_to_utf8($filename, $charset) - : $filename; - isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename); - - header('Content-Disposition: filename="'.$filename.'";'.$utf8_filename); + header('Content-Disposition: filename='.$this->source_image.';'); header('Content-Type: '.$this->mime_type); header('Content-Transfer-Encoding: binary'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); @@ -1597,8 +1564,6 @@ public function image_display_gd($resource) break; case 3 : imagepng($resource); break; - case 18 : imagewebp($resource); - break; default: echo 'Unable to display the image'; break; } diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php new file mode 100644 index 00000000000..c9103945b73 --- /dev/null +++ b/system/libraries/Javascript.php @@ -0,0 +1,856 @@ + 'jquery', 'autoload' => TRUE); + + foreach ($defaults as $key => $val) + { + if (isset($params[$key]) && $params[$key] !== '') + { + $defaults[$key] = $params[$key]; + } + } + + extract($defaults); + + $this->CI =& get_instance(); + + // load the requested js library + $this->CI->load->library('Javascript/'.$js_library_driver, array('autoload' => $autoload)); + // make js to refer to current library + $this->js =& $this->CI->$js_library_driver; + + log_message('info', 'Javascript Class Initialized and loaded. Driver used: '.$js_library_driver); + } + + // -------------------------------------------------------------------- + // Event Code + // -------------------------------------------------------------------- + + /** + * Blur + * + * Outputs a javascript library blur event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function blur($element = 'this', $js = '') + { + return $this->js->_blur($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Change + * + * Outputs a javascript library change event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function change($element = 'this', $js = '') + { + return $this->js->_change($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Click + * + * Outputs a javascript library click event + * + * @param string The element to attach the event to + * @param string The code to execute + * @param bool whether or not to return false + * @return string + */ + public function click($element = 'this', $js = '', $ret_false = TRUE) + { + return $this->js->_click($element, $js, $ret_false); + } + + // -------------------------------------------------------------------- + + /** + * Double Click + * + * Outputs a javascript library dblclick event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function dblclick($element = 'this', $js = '') + { + return $this->js->_dblclick($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Outputs a javascript library error event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function error($element = 'this', $js = '') + { + return $this->js->_error($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Focus + * + * Outputs a javascript library focus event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function focus($element = 'this', $js = '') + { + return $this->js->_focus($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Hover + * + * Outputs a javascript library hover event + * + * @param string - element + * @param string - Javascript code for mouse over + * @param string - Javascript code for mouse out + * @return string + */ + public function hover($element = 'this', $over = '', $out = '') + { + return $this->js->_hover($element, $over, $out); + } + + // -------------------------------------------------------------------- + + /** + * Keydown + * + * Outputs a javascript library keydown event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function keydown($element = 'this', $js = '') + { + return $this->js->_keydown($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Keyup + * + * Outputs a javascript library keydown event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function keyup($element = 'this', $js = '') + { + return $this->js->_keyup($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Load + * + * Outputs a javascript library load event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function load($element = 'this', $js = '') + { + return $this->js->_load($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Mousedown + * + * Outputs a javascript library mousedown event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function mousedown($element = 'this', $js = '') + { + return $this->js->_mousedown($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Mouse Out + * + * Outputs a javascript library mouseout event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function mouseout($element = 'this', $js = '') + { + return $this->js->_mouseout($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Mouse Over + * + * Outputs a javascript library mouseover event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function mouseover($element = 'this', $js = '') + { + return $this->js->_mouseover($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Mouseup + * + * Outputs a javascript library mouseup event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function mouseup($element = 'this', $js = '') + { + return $this->js->_mouseup($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Output + * + * Outputs the called javascript to the screen + * + * @param string The code to output + * @return string + */ + public function output($js) + { + return $this->js->_output($js); + } + + // -------------------------------------------------------------------- + + /** + * Ready + * + * Outputs a javascript library mouseup event + * + * @param string $js Code to execute + * @return string + */ + public function ready($js) + { + return $this->js->_document_ready($js); + } + + // -------------------------------------------------------------------- + + /** + * Resize + * + * Outputs a javascript library resize event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function resize($element = 'this', $js = '') + { + return $this->js->_resize($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Scroll + * + * Outputs a javascript library scroll event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function scroll($element = 'this', $js = '') + { + return $this->js->_scroll($element, $js); + } + + // -------------------------------------------------------------------- + + /** + * Unload + * + * Outputs a javascript library unload event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + public function unload($element = 'this', $js = '') + { + return $this->js->_unload($element, $js); + } + + // -------------------------------------------------------------------- + // Effects + // -------------------------------------------------------------------- + + /** + * Add Class + * + * Outputs a javascript library addClass event + * + * @param string - element + * @param string - Class to add + * @return string + */ + public function addClass($element = 'this', $class = '') + { + return $this->js->_addClass($element, $class); + } + + // -------------------------------------------------------------------- + + /** + * Animate + * + * Outputs a javascript library animate event + * + * @param string $element = 'this' + * @param array $params = array() + * @param mixed $speed 'slow', 'normal', 'fast', or time in milliseconds + * @param string $extra + * @return string + */ + public function animate($element = 'this', $params = array(), $speed = '', $extra = '') + { + return $this->js->_animate($element, $params, $speed, $extra); + } + + // -------------------------------------------------------------------- + + /** + * Fade In + * + * Outputs a javascript library hide event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + public function fadeIn($element = 'this', $speed = '', $callback = '') + { + return $this->js->_fadeIn($element, $speed, $callback); + } + + // -------------------------------------------------------------------- + + /** + * Fade Out + * + * Outputs a javascript library hide event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + public function fadeOut($element = 'this', $speed = '', $callback = '') + { + return $this->js->_fadeOut($element, $speed, $callback); + } + // -------------------------------------------------------------------- + + /** + * Slide Up + * + * Outputs a javascript library slideUp event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + public function slideUp($element = 'this', $speed = '', $callback = '') + { + return $this->js->_slideUp($element, $speed, $callback); + + } + + // -------------------------------------------------------------------- + + /** + * Remove Class + * + * Outputs a javascript library removeClass event + * + * @param string - element + * @param string - Class to add + * @return string + */ + public function removeClass($element = 'this', $class = '') + { + return $this->js->_removeClass($element, $class); + } + + // -------------------------------------------------------------------- + + /** + * Slide Down + * + * Outputs a javascript library slideDown event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + public function slideDown($element = 'this', $speed = '', $callback = '') + { + return $this->js->_slideDown($element, $speed, $callback); + } + + // -------------------------------------------------------------------- + + /** + * Slide Toggle + * + * Outputs a javascript library slideToggle event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + public function slideToggle($element = 'this', $speed = '', $callback = '') + { + return $this->js->_slideToggle($element, $speed, $callback); + + } + + // -------------------------------------------------------------------- + + /** + * Hide + * + * Outputs a javascript library hide action + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + public function hide($element = 'this', $speed = '', $callback = '') + { + return $this->js->_hide($element, $speed, $callback); + } + + // -------------------------------------------------------------------- + + /** + * Toggle + * + * Outputs a javascript library toggle event + * + * @param string - element + * @return string + */ + public function toggle($element = 'this') + { + return $this->js->_toggle($element); + + } + + // -------------------------------------------------------------------- + + /** + * Toggle Class + * + * Outputs a javascript library toggle class event + * + * @param string $element = 'this' + * @param string $class = '' + * @return string + */ + public function toggleClass($element = 'this', $class = '') + { + return $this->js->_toggleClass($element, $class); + } + + // -------------------------------------------------------------------- + + /** + * Show + * + * Outputs a javascript library show event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + public function show($element = 'this', $speed = '', $callback = '') + { + return $this->js->_show($element, $speed, $callback); + } + + // -------------------------------------------------------------------- + + /** + * Compile + * + * gather together all script needing to be output + * + * @param string $view_var + * @param bool $script_tags + * @return string + */ + public function compile($view_var = 'script_foot', $script_tags = TRUE) + { + $this->js->_compile($view_var, $script_tags); + } + + // -------------------------------------------------------------------- + + /** + * Clear Compile + * + * Clears any previous javascript collected for output + * + * @return void + */ + public function clear_compile() + { + $this->js->_clear_compile(); + } + + // -------------------------------------------------------------------- + + /** + * External + * + * Outputs a + * + * @param string + * @return string + */ + protected function _close_script($extra = "\n") + { + return ''.$extra; + } + + // -------------------------------------------------------------------- + // AJAX-Y STUFF - still a testbed + // -------------------------------------------------------------------- + + /** + * Update + * + * Outputs a javascript library slideDown event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + public function update($element = 'this', $speed = '', $callback = '') + { + return $this->js->_updater($element, $speed, $callback); + } + + // -------------------------------------------------------------------- + + /** + * Generate JSON + * + * Can be passed a database result or associative array and returns a JSON formatted string + * + * @param mixed result set or array + * @param bool match array types (defaults to objects) + * @return string a json formatted string + */ + public function generate_json($result = NULL, $match_array_type = FALSE) + { + // JSON data can optionally be passed to this function + // either as a database result object or an array, or a user supplied array + if ($result !== NULL) + { + if (is_object($result)) + { + $json_result = is_callable(array($result, 'result_array')) ? $result->result_array() : (array) $result; + } + elseif (is_array($result)) + { + $json_result = $result; + } + else + { + return $this->_prep_args($result); + } + } + else + { + return 'null'; + } + + $json = array(); + $_is_assoc = TRUE; + + if ( ! is_array($json_result) && empty($json_result)) + { + show_error('Generate JSON Failed - Illegal key, value pair.'); + } + elseif ($match_array_type) + { + $_is_assoc = $this->_is_associative_array($json_result); + } + + foreach ($json_result as $k => $v) + { + if ($_is_assoc) + { + $json[] = $this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); + } + else + { + $json[] = $this->generate_json($v, $match_array_type); + } + } + + $json = implode(',', $json); + + return $_is_assoc ? '{'.$json.'}' : '['.$json.']'; + + } + + // -------------------------------------------------------------------- + + /** + * Is associative array + * + * Checks for an associative array + * + * @param array + * @return bool + */ + protected function _is_associative_array($arr) + { + foreach (array_keys($arr) as $key => $val) + { + if ($key !== $val) + { + return TRUE; + } + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Prep Args + * + * Ensures a standard json value and escapes values + * + * @param mixed $result + * @param bool $is_key = FALSE + * @return string + */ + protected function _prep_args($result, $is_key = FALSE) + { + if ($result === NULL) + { + return 'null'; + } + elseif (is_bool($result)) + { + return ($result === TRUE) ? 'true' : 'false'; + } + elseif (is_string($result) OR $is_key) + { + return '"'.str_replace(array('\\', "\t", "\n", "\r", '"', '/'), array('\\\\', '\\t', '\\n', "\\r", '\"', '\/'), $result).'"'; + } + elseif (is_scalar($result)) + { + return $result; + } + } + +} diff --git a/system/libraries/Javascript/._Jquery.php b/system/libraries/Javascript/._Jquery.php new file mode 100644 index 00000000000..6dcb68cf3e0 Binary files /dev/null and b/system/libraries/Javascript/._Jquery.php differ diff --git a/system/libraries/Javascript/._index.html b/system/libraries/Javascript/._index.html new file mode 100644 index 00000000000..e9a7bde99a3 Binary files /dev/null and b/system/libraries/Javascript/._index.html differ diff --git a/system/libraries/Javascript/Jquery.php b/system/libraries/Javascript/Jquery.php new file mode 100644 index 00000000000..485d1dc1819 --- /dev/null +++ b/system/libraries/Javascript/Jquery.php @@ -0,0 +1,1076 @@ +CI =& get_instance(); + extract($params); + + if ($autoload === TRUE) + { + $this->script(); + } + + log_message('info', 'Jquery Class Initialized'); + } + + // -------------------------------------------------------------------- + // Event Code + // -------------------------------------------------------------------- + + /** + * Blur + * + * Outputs a jQuery blur event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _blur($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'blur'); + } + + // -------------------------------------------------------------------- + + /** + * Change + * + * Outputs a jQuery change event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _change($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'change'); + } + + // -------------------------------------------------------------------- + + /** + * Click + * + * Outputs a jQuery click event + * + * @param string The element to attach the event to + * @param string The code to execute + * @param bool whether or not to return false + * @return string + */ + protected function _click($element = 'this', $js = '', $ret_false = TRUE) + { + is_array($js) OR $js = array($js); + + if ($ret_false) + { + $js[] = 'return false;'; + } + + return $this->_add_event($element, $js, 'click'); + } + + // -------------------------------------------------------------------- + + /** + * Double Click + * + * Outputs a jQuery dblclick event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _dblclick($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'dblclick'); + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Outputs a jQuery error event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _error($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'error'); + } + + // -------------------------------------------------------------------- + + /** + * Focus + * + * Outputs a jQuery focus event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _focus($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'focus'); + } + + // -------------------------------------------------------------------- + + /** + * Hover + * + * Outputs a jQuery hover event + * + * @param string - element + * @param string - Javascript code for mouse over + * @param string - Javascript code for mouse out + * @return string + */ + protected function _hover($element = 'this', $over = '', $out = '') + { + $event = "\n\t$(".$this->_prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; + + $this->jquery_code_for_compile[] = $event; + + return $event; + } + + // -------------------------------------------------------------------- + + /** + * Keydown + * + * Outputs a jQuery keydown event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _keydown($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'keydown'); + } + + // -------------------------------------------------------------------- + + /** + * Keyup + * + * Outputs a jQuery keydown event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _keyup($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'keyup'); + } + + // -------------------------------------------------------------------- + + /** + * Load + * + * Outputs a jQuery load event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _load($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'load'); + } + + // -------------------------------------------------------------------- + + /** + * Mousedown + * + * Outputs a jQuery mousedown event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _mousedown($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'mousedown'); + } + + // -------------------------------------------------------------------- + + /** + * Mouse Out + * + * Outputs a jQuery mouseout event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _mouseout($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'mouseout'); + } + + // -------------------------------------------------------------------- + + /** + * Mouse Over + * + * Outputs a jQuery mouseover event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _mouseover($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'mouseover'); + } + + // -------------------------------------------------------------------- + + /** + * Mouseup + * + * Outputs a jQuery mouseup event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _mouseup($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'mouseup'); + } + + // -------------------------------------------------------------------- + + /** + * Output + * + * Outputs script directly + * + * @param array $array_js = array() + * @return void + */ + protected function _output($array_js = array()) + { + if ( ! is_array($array_js)) + { + $array_js = array($array_js); + } + + foreach ($array_js as $js) + { + $this->jquery_code_for_compile[] = "\t".$js."\n"; + } + } + + // -------------------------------------------------------------------- + + /** + * Resize + * + * Outputs a jQuery resize event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _resize($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'resize'); + } + + // -------------------------------------------------------------------- + + /** + * Scroll + * + * Outputs a jQuery scroll event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _scroll($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'scroll'); + } + + // -------------------------------------------------------------------- + + /** + * Unload + * + * Outputs a jQuery unload event + * + * @param string The element to attach the event to + * @param string The code to execute + * @return string + */ + protected function _unload($element = 'this', $js = '') + { + return $this->_add_event($element, $js, 'unload'); + } + + // -------------------------------------------------------------------- + // Effects + // -------------------------------------------------------------------- + + /** + * Add Class + * + * Outputs a jQuery addClass event + * + * @param string $element + * @param string $class + * @return string + */ + protected function _addClass($element = 'this', $class = '') + { + $element = $this->_prep_element($element); + return '$('.$element.').addClass("'.$class.'");'; + } + + // -------------------------------------------------------------------- + + /** + * Animate + * + * Outputs a jQuery animate event + * + * @param string $element + * @param array $params + * @param string $speed 'slow', 'normal', 'fast', or time in milliseconds + * @param string $extra + * @return string + */ + protected function _animate($element = 'this', $params = array(), $speed = '', $extra = '') + { + $element = $this->_prep_element($element); + $speed = $this->_validate_speed($speed); + + $animations = "\t\t\t"; + + foreach ($params as $param => $value) + { + $animations .= $param.": '".$value."', "; + } + + $animations = substr($animations, 0, -2); // remove the last ", " + + if ($speed !== '') + { + $speed = ', '.$speed; + } + + if ($extra !== '') + { + $extra = ', '.$extra; + } + + return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.');'; + } + + // -------------------------------------------------------------------- + + /** + * Fade In + * + * Outputs a jQuery hide event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + protected function _fadeIn($element = 'this', $speed = '', $callback = '') + { + $element = $this->_prep_element($element); + $speed = $this->_validate_speed($speed); + + if ($callback !== '') + { + $callback = ", function(){\n{$callback}\n}"; + } + + return "$({$element}).fadeIn({$speed}{$callback});"; + } + + // -------------------------------------------------------------------- + + /** + * Fade Out + * + * Outputs a jQuery hide event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + protected function _fadeOut($element = 'this', $speed = '', $callback = '') + { + $element = $this->_prep_element($element); + $speed = $this->_validate_speed($speed); + + if ($callback !== '') + { + $callback = ", function(){\n{$callback}\n}"; + } + + return '$('.$element.').fadeOut('.$speed.$callback.');'; + } + + // -------------------------------------------------------------------- + + /** + * Hide + * + * Outputs a jQuery hide action + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + protected function _hide($element = 'this', $speed = '', $callback = '') + { + $element = $this->_prep_element($element); + $speed = $this->_validate_speed($speed); + + if ($callback !== '') + { + $callback = ", function(){\n{$callback}\n}"; + } + + return "$({$element}).hide({$speed}{$callback});"; + } + + // -------------------------------------------------------------------- + + /** + * Remove Class + * + * Outputs a jQuery remove class event + * + * @param string $element + * @param string $class + * @return string + */ + protected function _removeClass($element = 'this', $class = '') + { + $element = $this->_prep_element($element); + return '$('.$element.').removeClass("'.$class.'");'; + } + + // -------------------------------------------------------------------- + + /** + * Slide Up + * + * Outputs a jQuery slideUp event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + protected function _slideUp($element = 'this', $speed = '', $callback = '') + { + $element = $this->_prep_element($element); + $speed = $this->_validate_speed($speed); + + if ($callback !== '') + { + $callback = ", function(){\n{$callback}\n}"; + } + + return '$('.$element.').slideUp('.$speed.$callback.');'; + } + + // -------------------------------------------------------------------- + + /** + * Slide Down + * + * Outputs a jQuery slideDown event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + protected function _slideDown($element = 'this', $speed = '', $callback = '') + { + $element = $this->_prep_element($element); + $speed = $this->_validate_speed($speed); + + if ($callback !== '') + { + $callback = ", function(){\n{$callback}\n}"; + } + + return '$('.$element.').slideDown('.$speed.$callback.');'; + } + + // -------------------------------------------------------------------- + + /** + * Slide Toggle + * + * Outputs a jQuery slideToggle event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + protected function _slideToggle($element = 'this', $speed = '', $callback = '') + { + $element = $this->_prep_element($element); + $speed = $this->_validate_speed($speed); + + if ($callback !== '') + { + $callback = ", function(){\n{$callback}\n}"; + } + + return '$('.$element.').slideToggle('.$speed.$callback.');'; + } + + // -------------------------------------------------------------------- + + /** + * Toggle + * + * Outputs a jQuery toggle event + * + * @param string - element + * @return string + */ + protected function _toggle($element = 'this') + { + $element = $this->_prep_element($element); + return '$('.$element.').toggle();'; + } + + // -------------------------------------------------------------------- + + /** + * Toggle Class + * + * Outputs a jQuery toggle class event + * + * @param string $element + * @param string $class + * @return string + */ + protected function _toggleClass($element = 'this', $class = '') + { + $element = $this->_prep_element($element); + return '$('.$element.').toggleClass("'.$class.'");'; + } + + // -------------------------------------------------------------------- + + /** + * Show + * + * Outputs a jQuery show event + * + * @param string - element + * @param string - One of 'slow', 'normal', 'fast', or time in milliseconds + * @param string - Javascript callback function + * @return string + */ + protected function _show($element = 'this', $speed = '', $callback = '') + { + $element = $this->_prep_element($element); + $speed = $this->_validate_speed($speed); + + if ($callback !== '') + { + $callback = ", function(){\n{$callback}\n}"; + } + + return '$('.$element.').show('.$speed.$callback.');'; + } + + // -------------------------------------------------------------------- + + /** + * Updater + * + * An Ajax call that populates the designated DOM node with + * returned content + * + * @param string The element to attach the event to + * @param string the controller to run the call against + * @param string optional parameters + * @return string + */ + + protected function _updater($container = 'this', $controller = '', $options = '') + { + $container = $this->_prep_element($container); + $controller = (strpos('://', $controller) === FALSE) ? $controller : $this->CI->config->site_url($controller); + + // ajaxStart and ajaxStop are better choices here... but this is a stop gap + if ($this->CI->config->item('javascript_ajax_img') === '') + { + $loading_notifier = 'Loading...'; + } + else + { + $loading_notifier = 'Loading'; + } + + $updater = '$('.$container.").empty();\n" // anything that was in... get it out + ."\t\t$(".$container.').prepend("'.$loading_notifier."\");\n"; // to replace with an image + + $request_options = ''; + if ($options !== '') + { + $request_options .= ', {' + .(is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(':', "':'", $options)."'") + .'}'; + } + + return $updater."\t\t$($container).load('$controller'$request_options);"; + } + + // -------------------------------------------------------------------- + // Pre-written handy stuff + // -------------------------------------------------------------------- + + /** + * Zebra tables + * + * @param string $class + * @param string $odd + * @param string $hover + * @return string + */ + protected function _zebraTables($class = '', $odd = 'odd', $hover = '') + { + $class = ($class !== '') ? '.'.$class : ''; + $zebra = "\t\$(\"table{$class} tbody tr:nth-child(even)\").addClass(\"{$odd}\");"; + + $this->jquery_code_for_compile[] = $zebra; + + if ($hover !== '') + { + $hover = $this->hover("table{$class} tbody tr", "$(this).addClass('hover');", "$(this).removeClass('hover');"); + } + + return $zebra; + } + + // -------------------------------------------------------------------- + // Plugins + // -------------------------------------------------------------------- + + /** + * Corner Plugin + * + * @link http://www.malsup.com/jquery/corner/ + * @param string $element + * @param string $corner_style + * @return string + */ + public function corner($element = '', $corner_style = '') + { + // may want to make this configurable down the road + $corner_location = '/plugins/jquery.corner.js'; + + if ($corner_style !== '') + { + $corner_style = '"'.$corner_style.'"'; + } + + return '$('.$this->_prep_element($element).').corner('.$corner_style.');'; + } + + // -------------------------------------------------------------------- + + /** + * Modal window + * + * Load a thickbox modal window + * + * @param string $src + * @param bool $relative + * @return void + */ + public function modal($src, $relative = FALSE) + { + $this->jquery_code_for_load[] = $this->external($src, $relative); + } + + // -------------------------------------------------------------------- + + /** + * Effect + * + * Load an Effect library + * + * @param string $src + * @param bool $relative + * @return void + */ + public function effect($src, $relative = FALSE) + { + $this->jquery_code_for_load[] = $this->external($src, $relative); + } + + // -------------------------------------------------------------------- + + /** + * Plugin + * + * Load a plugin library + * + * @param string $src + * @param bool $relative + * @return void + */ + public function plugin($src, $relative = FALSE) + { + $this->jquery_code_for_load[] = $this->external($src, $relative); + } + + // -------------------------------------------------------------------- + + /** + * UI + * + * Load a user interface library + * + * @param string $src + * @param bool $relative + * @return void + */ + public function ui($src, $relative = FALSE) + { + $this->jquery_code_for_load[] = $this->external($src, $relative); + } + + // -------------------------------------------------------------------- + + /** + * Sortable + * + * Creates a jQuery sortable + * + * @param string $element + * @param array $options + * @return string + */ + public function sortable($element, $options = array()) + { + if (count($options) > 0) + { + $sort_options = array(); + foreach ($options as $k=>$v) + { + $sort_options[] = "\n\t\t".$k.': '.$v; + } + $sort_options = implode(',', $sort_options); + } + else + { + $sort_options = ''; + } + + return '$('.$this->_prep_element($element).').sortable({'.$sort_options."\n\t});"; + } + + // -------------------------------------------------------------------- + + /** + * Table Sorter Plugin + * + * @param string table name + * @param string plugin location + * @return string + */ + public function tablesorter($table = '', $options = '') + { + $this->jquery_code_for_compile[] = "\t$(".$this->_prep_element($table).').tablesorter('.$options.");\n"; + } + + // -------------------------------------------------------------------- + // Class functions + // -------------------------------------------------------------------- + + /** + * Add Event + * + * Constructs the syntax for an event, and adds to into the array for compilation + * + * @param string The element to attach the event to + * @param string The code to execute + * @param string The event to pass + * @return string + */ + protected function _add_event($element, $js, $event) + { + if (is_array($js)) + { + $js = implode("\n\t\t", $js); + } + + $event = "\n\t$(".$this->_prep_element($element).').'.$event."(function(){\n\t\t{$js}\n\t});\n"; + $this->jquery_code_for_compile[] = $event; + return $event; + } + + // -------------------------------------------------------------------- + + /** + * Compile + * + * As events are specified, they are stored in an array + * This function compiles them all for output on a page + * + * @param string $view_var + * @param bool $script_tags + * @return void + */ + protected function _compile($view_var = 'script_foot', $script_tags = TRUE) + { + // External references + $external_scripts = implode('', $this->jquery_code_for_load); + $this->CI->load->vars(array('library_src' => $external_scripts)); + + if (count($this->jquery_code_for_compile) === 0) + { + // no inline references, let's just return + return; + } + + // Inline references + $script = '$(document).ready(function() {'."\n" + .implode('', $this->jquery_code_for_compile) + .'});'; + + $output = ($script_tags === FALSE) ? $script : $this->inline($script); + + $this->CI->load->vars(array($view_var => $output)); + } + + // -------------------------------------------------------------------- + + /** + * Clear Compile + * + * Clears the array of script events collected for output + * + * @return void + */ + protected function _clear_compile() + { + $this->jquery_code_for_compile = array(); + } + + // -------------------------------------------------------------------- + + /** + * Document Ready + * + * A wrapper for writing document.ready() + * + * @param array $js + * @return void + */ + protected function _document_ready($js) + { + is_array($js) OR $js = array($js); + + foreach ($js as $script) + { + $this->jquery_code_for_compile[] = $script; + } + } + + // -------------------------------------------------------------------- + + /** + * Script Tag + * + * Outputs the script tag that loads the jquery.js file into an HTML document + * + * @param string $library_src + * @param bool $relative + * @return string + */ + public function script($library_src = '', $relative = FALSE) + { + $library_src = $this->external($library_src, $relative); + $this->jquery_code_for_load[] = $library_src; + return $library_src; + } + + // -------------------------------------------------------------------- + + /** + * Prep Element + * + * Puts HTML element in quotes for use in jQuery code + * unless the supplied element is the Javascript 'this' + * object, in which case no quotes are added + * + * @param string + * @return string + */ + protected function _prep_element($element) + { + if ($element !== 'this') + { + $element = '"'.$element.'"'; + } + + return $element; + } + + // -------------------------------------------------------------------- + + /** + * Validate Speed + * + * Ensures the speed parameter is valid for jQuery + * + * @param string + * @return string + */ + protected function _validate_speed($speed) + { + if (in_array($speed, array('slow', 'normal', 'fast'))) + { + return '"'.$speed.'"'; + } + elseif (preg_match('/[^0-9]/', $speed)) + { + return ''; + } + + return $speed; + } + +} diff --git a/system/libraries/Javascript/index.html b/system/libraries/Javascript/index.html new file mode 100644 index 00000000000..b702fbc3967 --- /dev/null +++ b/system/libraries/Javascript/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 11d63fe50b9..5d501a966ba 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -686,7 +686,7 @@ protected function _parse_attributes($attributes) /** * Add "rel" attribute * - * @link https://www.w3.org/TR/html5/links.html#linkTypes + * @link http://www.w3.org/TR/html5/links.html#linkTypes * @param string $type * @return string */ diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index e3c4bd10a81..77af7b99b53 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -105,7 +105,7 @@ public function __construct($config = array()) { if ( ! isset($config[$section])) { - $this->{'_compile_'.$section} = TRUE; + $this->_compile_{$section} = TRUE; } } @@ -135,7 +135,7 @@ public function set_sections($config) { if (in_array($method, $this->_available_sections)) { - $this->{'_compile_'.$method} = ($enable !== FALSE); + $this->_compile_{$method} = ($enable !== FALSE); } } } @@ -486,13 +486,13 @@ protected function _compile_config() { $pre = ''; $pre_close = ''; - + if (is_array($val) OR is_object($val)) { $val = print_r($val, TRUE); - + $pre = '
' ;
-				$pre_close = '
'; + $pre_close = ''; } $output .= '' @@ -524,13 +524,13 @@ protected function _compile_session_data() { $pre = ''; $pre_close = ''; - + if (is_array($val) OR is_object($val)) { $val = print_r($val, TRUE); - + $pre = '
' ;
-				$pre_close = '
'; + $pre_close = ''; } $output .= '' @@ -554,7 +554,7 @@ public function run() foreach ($this->_available_sections as $section) { - if ($this->{'_compile_'.$section} !== FALSE) + if ($this->_compile_{$section} !== FALSE) { $func = '_compile_'.$section; $output .= $this->{$func}(); diff --git a/system/libraries/Session/._Session.php b/system/libraries/Session/._Session.php new file mode 100644 index 00000000000..990a56d4ce3 Binary files /dev/null and b/system/libraries/Session/._Session.php differ diff --git a/system/libraries/Session/._SessionHandlerInterface.php b/system/libraries/Session/._SessionHandlerInterface.php new file mode 100644 index 00000000000..ad1320734df Binary files /dev/null and b/system/libraries/Session/._SessionHandlerInterface.php differ diff --git a/system/libraries/Session/._Session_driver.php b/system/libraries/Session/._Session_driver.php new file mode 100644 index 00000000000..00035b99e0d Binary files /dev/null and b/system/libraries/Session/._Session_driver.php differ diff --git a/system/libraries/Session/._drivers b/system/libraries/Session/._drivers new file mode 100644 index 00000000000..4fec49aa74d Binary files /dev/null and b/system/libraries/Session/._drivers differ diff --git a/system/libraries/Session/._index.html b/system/libraries/Session/._index.html new file mode 100644 index 00000000000..6a67f45ecc0 Binary files /dev/null and b/system/libraries/Session/._index.html differ diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php index dfd0f432e87..9b834f86ae8 100644 --- a/system/libraries/Session/Session.php +++ b/system/libraries/Session/Session.php @@ -105,7 +105,23 @@ public function __construct(array $params = array()) $class = new $class($this->_config); if ($class instanceof SessionHandlerInterface) { - session_set_save_handler($class, TRUE); + if (is_php('5.4')) + { + session_set_save_handler($class, TRUE); + } + else + { + session_set_save_handler( + array($class, 'open'), + array($class, 'close'), + array($class, 'read'), + array($class, 'write'), + array($class, 'destroy'), + array($class, 'gc') + ); + + register_shutdown_function('session_write_close'); + } } else { @@ -174,6 +190,9 @@ public function __construct(array $params = array()) */ protected function _ci_load_classes($driver) { + // PHP 5.4 compatibility + interface_exists('SessionHandlerInterface', FALSE) OR require_once(BASEPATH.'libraries/Session/SessionHandlerInterface.php'); + $prefix = config_item('subclass_prefix'); if ( ! class_exists('CI_Session_driver', FALSE)) diff --git a/system/libraries/Session/SessionHandlerInterface.php b/system/libraries/Session/SessionHandlerInterface.php new file mode 100644 index 00000000000..240c5f54e88 --- /dev/null +++ b/system/libraries/Session/SessionHandlerInterface.php @@ -0,0 +1,59 @@ +_fingerprint = md5(''); return ''; } - - // Prevent possible data corruption - // See https://github.com/bcit-ci/CodeIgniter/issues/5857 - clearstatcache(TRUE, $this->_file_path.$session_id); } // We shouldn't need this, but apparently we do ... // See https://github.com/bcit-ci/CodeIgniter/issues/4039 diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index 1bbb13db594..df38174b4a2 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -133,40 +133,27 @@ public function __construct(&$params) { log_message('error', 'Session: No Redis save path configured.'); } - elseif (preg_match('#^unix://([^\?]+)(?\?.+)?$#', $this->_config['save_path'], $matches)) + elseif (preg_match('#(?:tcp://)?([^:?]+)(?:\:(\d+))?(\?.+)?#', $this->_config['save_path'], $matches)) { - $save_path = array('path' => $matches[1]); - } - elseif (preg_match('#(?:tcp://)?([^:?]+)(?:\:(\d+))?(?\?.+)?#', $this->_config['save_path'], $matches)) - { - $save_path = array( - 'host' => $matches[1], - 'port' => empty($matches[2]) ? NULL : $matches[2], - 'timeout' => NULL // We always pass this to Redis::connect(), so it needs to exist + isset($matches[3]) OR $matches[3] = ''; // Just to avoid undefined index notices below + $this->_config['save_path'] = array( + 'host' => $matches[1], + 'port' => empty($matches[2]) ? NULL : $matches[2], + 'password' => preg_match('#auth=([^\s&]+)#', $matches[3], $match) ? $match[1] : NULL, + 'database' => preg_match('#database=(\d+)#', $matches[3], $match) ? (int) $match[1] : NULL, + 'timeout' => preg_match('#timeout=(\d+\.\d+)#', $matches[3], $match) ? (float) $match[1] : NULL ); + + preg_match('#prefix=([^\s&]+)#', $matches[3], $match) && $this->_key_prefix = $match[1]; } else { log_message('error', 'Session: Invalid Redis save path format: '.$this->_config['save_path']); } - if (isset($save_path)) + if ($this->_config['match_ip'] === TRUE) { - if (isset($matches['options'])) - { - $save_path['password'] = preg_match('#auth=([^\s&]+)#', $matches['options'], $match) ? $match[1] : NULL; - $save_path['database'] = preg_match('#database=(\d+)#', $matches['options'], $match) ? (int) $match[1] : NULL; - $save_path['timeout'] = preg_match('#timeout=(\d+\.\d+)#', $matches['options'], $match) ? (float) $match[1] : NULL; - - preg_match('#prefix=([^\s&]+)#', $matches['options'], $match) && $this->_key_prefix = $match[1]; - } - - $this->_config['save_path'] = $save_path; - - if ($this->_config['match_ip'] === TRUE) - { - $this->_key_prefix .= $_SERVER['REMOTE_ADDR'].':'; - } + $this->_key_prefix .= $_SERVER['REMOTE_ADDR'].':'; } } @@ -189,30 +176,17 @@ public function open($save_path, $name) } $redis = new Redis(); - $connected = isset($this->_config['save_path']['path']) - ? $redis->connect($this->_config['save_path']['path']) - : $redis->connect( - $this->_config['save_path']['host'], - $this->_config['save_path']['port'], - $this->_config['save_path']['timeout'] - ); - - if ($connected) + if ( ! $redis->connect($this->_config['save_path']['host'], $this->_config['save_path']['port'], $this->_config['save_path']['timeout'])) { - if (isset($this->_config['save_path']['password']) && ! $redis->auth($this->_config['save_path']['password'])) - { - log_message('error', 'Session: Unable to authenticate to Redis instance.'); - } - elseif (isset($this->_config['save_path']['database']) && ! $redis->select($this->_config['save_path']['database'])) - { - log_message('error', 'Session: Unable to select Redis database with index '.$this->_config['save_path']['database']); - } - else - { - $this->_redis = $redis; - $this->php5_validate_id(); - return $this->_success; - } + log_message('error', 'Session: Unable to connect to Redis with the configured settings.'); + } + elseif (isset($this->_config['save_path']['password']) && ! $redis->auth($this->_config['save_path']['password'])) + { + log_message('error', 'Session: Unable to authenticate to Redis instance.'); + } + elseif (isset($this->_config['save_path']['database']) && ! $redis->select($this->_config['save_path']['database'])) + { + log_message('error', 'Session: Unable to select Redis database with index '.$this->_config['save_path']['database']); } else { diff --git a/system/libraries/Session/drivers/index.html b/system/libraries/Session/drivers/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/libraries/Session/drivers/index.html +++ b/system/libraries/Session/drivers/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/libraries/Session/index.html b/system/libraries/Session/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/libraries/Session/index.html +++ b/system/libraries/Session/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 05551269868..06e8d709889 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -427,7 +427,6 @@ public function clear() $this->rows = array(); $this->heading = array(); $this->auto_heading = TRUE; - $this->caption = NULL; return $this; } diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 95f765b782c..29f9f5ff993 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -867,7 +867,7 @@ public function is_image() $this->file_type = 'image/jpeg'; } - $img_mimes = array('image/gif', 'image/jpeg', 'image/png', 'image/webp'); + $img_mimes = array('image/gif', 'image/jpeg', 'image/png'); return in_array($this->file_type, $img_mimes, TRUE); } @@ -901,7 +901,7 @@ public function is_allowed_filetype($ignore_mime = FALSE) } // Images get some additional checks - if (in_array($ext, array('gif', 'jpg', 'jpeg', 'jpe', 'png', 'webp'), TRUE) && @getimagesize($this->file_temp) === FALSE) + if (in_array($ext, array('gif', 'jpg', 'jpeg', 'jpe', 'png'), TRUE) && @getimagesize($this->file_temp) === FALSE) { return FALSE; } @@ -1183,7 +1183,7 @@ public function display_errors($open = '

', $close = '

') * Prevents possible script execution from Apache's handling * of files' multiple extensions. * - * @link https://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext + * @link http://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext * * @param string $filename * @return string @@ -1257,7 +1257,9 @@ protected function _file_mime_type($file) */ if (DIRECTORY_SEPARATOR !== '\\') { - $cmd = 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1'; + $cmd = function_exists('escapeshellarg') + ? 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1' + : 'file --brief --mime '.$file['tmp_name'].' 2>&1'; if (function_usable('exec')) { @@ -1274,7 +1276,7 @@ protected function _file_mime_type($file) } } - if (function_usable('shell_exec')) + if ( ! ini_get('safe_mode') && function_usable('shell_exec')) { $mime = @shell_exec($cmd); if (strlen($mime) > 0) diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 4e8c303c7d2..690b245be98 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -743,7 +743,7 @@ public function sendPayload($msg) { break; } - // See https://bugs.php.net/bug.php?id=39598 and https://secure.php.net/manual/en/function.fwrite.php#96951 + // See https://bugs.php.net/bug.php?id=39598 and http://php.net/manual/en/function.fwrite.php#96951 elseif ($result === 0) { if ($timestamp === 0) @@ -836,7 +836,9 @@ public function __construct($val, $code = 0, $fstr = '') { // error $this->errno = $code; - $this->errstr = htmlspecialchars($fstr, ENT_XML1 | ENT_NOQUOTES, 'UTF-8'); + $this->errstr = htmlspecialchars($fstr, + (is_php('5.4') ? ENT_XML1 | ENT_NOQUOTES : ENT_NOQUOTES), + 'UTF-8'); } elseif ( ! is_object($val)) { diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 4579e8c2b71..c0a14023d7b 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -41,7 +41,7 @@ * Zip Compression Class * * This class is based on a library I found at Zend: - * https://www.zend.com/codex.php?id=696&single=1 + * http://www.zend.com/codex.php?id=696&single=1 * * The original library is a little rough around the edges so I * refactored it and added several additional methods -- Rick Ellis @@ -366,7 +366,7 @@ public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) while (FALSE !== ($file = readdir($fp))) { - if ($file === '.' OR $file === '..') + if ($file[0] === '.') { continue; } @@ -406,14 +406,13 @@ public function get_zip() return FALSE; } - // @see https://github.com/bcit-ci/CodeIgniter/issues/5864 - $footer = $this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" + return $this->zipdata + .$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" .pack('v', $this->entries) // total # of entries "on this disk" .pack('v', $this->entries) // total # of entries overall .pack('V', self::strlen($this->directory)) // size of central dir .pack('V', self::strlen($this->zipdata)) // offset to start of central dir ."\x00\x00"; // .zip file comment length - return $this->zipdata.$footer; } // -------------------------------------------------------------------- @@ -520,6 +519,9 @@ protected static function substr($str, $start, $length = NULL) { if (self::$func_overload) { + // mb_substr($str, $start, null, '8bit') returns an empty + // string on PHP 5.3 + isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); return mb_substr($str, $start, $length, '8bit'); } diff --git a/system/libraries/index.html b/system/libraries/index.html index bcb7cae3433..b702fbc3967 100644 --- a/system/libraries/index.html +++ b/system/libraries/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden diff --git a/user_guide/._.buildinfo b/user_guide/._.buildinfo new file mode 100644 index 00000000000..eb5d2bed050 Binary files /dev/null and b/user_guide/._.buildinfo differ diff --git a/user_guide/._DCO.html b/user_guide/._DCO.html new file mode 100644 index 00000000000..6643ca5702f Binary files /dev/null and b/user_guide/._DCO.html differ diff --git a/user_guide/.__downloads b/user_guide/.__downloads new file mode 100644 index 00000000000..a70b1b63100 Binary files /dev/null and b/user_guide/.__downloads differ diff --git a/user_guide/.__images b/user_guide/.__images new file mode 100644 index 00000000000..278b3d5ebc5 Binary files /dev/null and b/user_guide/.__images differ diff --git a/user_guide/.__static b/user_guide/.__static new file mode 100644 index 00000000000..0a40e038c61 Binary files /dev/null and b/user_guide/.__static differ diff --git a/user_guide/._changelog.html b/user_guide/._changelog.html new file mode 100644 index 00000000000..ba65781c8b3 Binary files /dev/null and b/user_guide/._changelog.html differ diff --git a/user_guide/._contributing b/user_guide/._contributing new file mode 100644 index 00000000000..09d03d128ad Binary files /dev/null and b/user_guide/._contributing differ diff --git a/user_guide/._database b/user_guide/._database new file mode 100644 index 00000000000..a6a316ee91b Binary files /dev/null and b/user_guide/._database differ diff --git a/user_guide/._documentation b/user_guide/._documentation new file mode 100644 index 00000000000..e1541b1c790 Binary files /dev/null and b/user_guide/._documentation differ diff --git a/user_guide/._general b/user_guide/._general new file mode 100644 index 00000000000..0a10758ef68 Binary files /dev/null and b/user_guide/._general differ diff --git a/user_guide/._genindex.html b/user_guide/._genindex.html new file mode 100644 index 00000000000..c86159288fe Binary files /dev/null and b/user_guide/._genindex.html differ diff --git a/user_guide/._helpers b/user_guide/._helpers new file mode 100644 index 00000000000..e4a966dec7f Binary files /dev/null and b/user_guide/._helpers differ diff --git a/user_guide/._index.html b/user_guide/._index.html new file mode 100644 index 00000000000..7c5609b9d24 Binary files /dev/null and b/user_guide/._index.html differ diff --git a/user_guide/._installation b/user_guide/._installation new file mode 100644 index 00000000000..def079f4871 Binary files /dev/null and b/user_guide/._installation differ diff --git a/user_guide/._libraries b/user_guide/._libraries new file mode 100644 index 00000000000..00a205c81b3 Binary files /dev/null and b/user_guide/._libraries differ diff --git a/user_guide/._license.html b/user_guide/._license.html new file mode 100644 index 00000000000..b69e27f00f8 Binary files /dev/null and b/user_guide/._license.html differ diff --git a/user_guide/._objects.inv b/user_guide/._objects.inv new file mode 100644 index 00000000000..830b6887af7 Binary files /dev/null and b/user_guide/._objects.inv differ diff --git a/user_guide/._overview b/user_guide/._overview new file mode 100644 index 00000000000..461777d4ca6 Binary files /dev/null and b/user_guide/._overview differ diff --git a/user_guide/._search.html b/user_guide/._search.html new file mode 100644 index 00000000000..d96470e639c Binary files /dev/null and b/user_guide/._search.html differ diff --git a/user_guide/._searchindex.js b/user_guide/._searchindex.js new file mode 100644 index 00000000000..7d1e40d3b30 Binary files /dev/null and b/user_guide/._searchindex.js differ diff --git a/user_guide/._tutorial b/user_guide/._tutorial new file mode 100644 index 00000000000..4007cab1b15 Binary files /dev/null and b/user_guide/._tutorial differ diff --git a/user_guide/.buildinfo b/user_guide/.buildinfo new file mode 100644 index 00000000000..bec16c4f662 --- /dev/null +++ b/user_guide/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 6b49d1813643817be290c380a3028e52 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/user_guide/DCO.html b/user_guide/DCO.html new file mode 100644 index 00000000000..d5c0a8703b7 --- /dev/null +++ b/user_guide/DCO.html @@ -0,0 +1,517 @@ + + + + + + + + + + Developer’s Certificate of Origin 1.1 — CodeIgniter 3.1.11 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

Developer’s Certificate of Origin 1.1

+

By making a contribution to this project, I certify that:

+
    +
  1. The contribution was created in whole or in part by me and I +have the right to submit it under the open source license +indicated in the file; or
  2. +
  3. The contribution is based upon previous work that, to the best +of my knowledge, is covered under an appropriate open source +license and I have the right under that license to submit that +work with modifications, whether created in whole or in part +by me, under the same open source license (unless I am +permitted to submit under a different license), as indicated +in the file; or
  4. +
  5. The contribution was provided directly to me by some other +person who certified (1), (2) or (3) and I have not modified +it.
  6. +
  7. I understand and agree that this project and the contribution +are public and that a record of the contribution (including all +personal information I submit with it, including my sign-off) is +maintained indefinitely and may be redistributed consistent with +this project or the open source license(s) involved.
  8. +
+
+ + +
+
+ + + + +
+ +
+

+ © Copyright 2014 - 2019, British Columbia Institute of Technology. + Last updated on Sep 19, 2019. +

+
+ + Built with Sphinx using a theme provided by Read the Docs. + +
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/_downloads/._ELDocs.tmbundle.zip b/user_guide/_downloads/._ELDocs.tmbundle.zip new file mode 100644 index 00000000000..bfdf37aa2f2 Binary files /dev/null and b/user_guide/_downloads/._ELDocs.tmbundle.zip differ diff --git a/user_guide/_downloads/ELDocs.tmbundle.zip b/user_guide/_downloads/ELDocs.tmbundle.zip new file mode 100644 index 00000000000..f7a11b364ca Binary files /dev/null and b/user_guide/_downloads/ELDocs.tmbundle.zip differ diff --git a/user_guide/_images/._appflowchart.gif b/user_guide/_images/._appflowchart.gif new file mode 100644 index 00000000000..9aac4bf2396 Binary files /dev/null and b/user_guide/_images/._appflowchart.gif differ diff --git a/user_guide/_images/._smile.gif b/user_guide/_images/._smile.gif new file mode 100644 index 00000000000..0922736032a Binary files /dev/null and b/user_guide/_images/._smile.gif differ diff --git a/user_guide/_images/appflowchart.gif b/user_guide/_images/appflowchart.gif new file mode 100644 index 00000000000..422332c9e21 Binary files /dev/null and b/user_guide/_images/appflowchart.gif differ diff --git a/user_guide/_images/smile.gif b/user_guide/_images/smile.gif new file mode 100644 index 00000000000..bf0922504ed Binary files /dev/null and b/user_guide/_images/smile.gif differ diff --git a/user_guide/_static._css b/user_guide/_static._css new file mode 100644 index 00000000000..9ff6b0fb1dc Binary files /dev/null and b/user_guide/_static._css differ diff --git a/user_guide/_static._fonts b/user_guide/_static._fonts new file mode 100644 index 00000000000..1a604b58c2e Binary files /dev/null and b/user_guide/_static._fonts differ diff --git a/user_guide/_static._js b/user_guide/_static._js new file mode 100644 index 00000000000..930fc860b0a Binary files /dev/null and b/user_guide/_static._js differ diff --git a/user_guide/_static/._ajax-loader.gif b/user_guide/_static/._ajax-loader.gif new file mode 100644 index 00000000000..b5579f68753 Binary files /dev/null and b/user_guide/_static/._ajax-loader.gif differ diff --git a/user_guide/_static/._basic.css b/user_guide/_static/._basic.css new file mode 100644 index 00000000000..dfdd37ca24d Binary files /dev/null and b/user_guide/_static/._basic.css differ diff --git a/user_guide/_static/._ci-icon.ico b/user_guide/_static/._ci-icon.ico new file mode 100644 index 00000000000..ebc10bacaed Binary files /dev/null and b/user_guide/_static/._ci-icon.ico differ diff --git a/user_guide/_static/._comment-bright.png b/user_guide/_static/._comment-bright.png new file mode 100644 index 00000000000..8646ab78d8b Binary files /dev/null and b/user_guide/_static/._comment-bright.png differ diff --git a/user_guide/_static/._comment-close.png b/user_guide/_static/._comment-close.png new file mode 100644 index 00000000000..f676c3d88cf Binary files /dev/null and b/user_guide/_static/._comment-close.png differ diff --git a/user_guide/_static/._comment.png b/user_guide/_static/._comment.png new file mode 100644 index 00000000000..59c8df33978 Binary files /dev/null and b/user_guide/_static/._comment.png differ diff --git a/user_guide/_static/._doctools.js b/user_guide/_static/._doctools.js new file mode 100644 index 00000000000..84207f55495 Binary files /dev/null and b/user_guide/_static/._doctools.js differ diff --git a/user_guide/_static/._down-pressed.png b/user_guide/_static/._down-pressed.png new file mode 100644 index 00000000000..db5224cf2e3 Binary files /dev/null and b/user_guide/_static/._down-pressed.png differ diff --git a/user_guide/_static/._down.png b/user_guide/_static/._down.png new file mode 100644 index 00000000000..5c25c077bc8 Binary files /dev/null and b/user_guide/_static/._down.png differ diff --git a/user_guide/_static/._file.png b/user_guide/_static/._file.png new file mode 100644 index 00000000000..69929ed44f2 Binary files /dev/null and b/user_guide/_static/._file.png differ diff --git a/user_guide/_static/._images b/user_guide/_static/._images new file mode 100644 index 00000000000..11df14b3a9d Binary files /dev/null and b/user_guide/_static/._images differ diff --git a/user_guide/_static/._jquery-3.1.0.js b/user_guide/_static/._jquery-3.1.0.js new file mode 100644 index 00000000000..a745824a632 Binary files /dev/null and b/user_guide/_static/._jquery-3.1.0.js differ diff --git a/user_guide/_static/._jquery.js b/user_guide/_static/._jquery.js new file mode 100644 index 00000000000..d796aa13cc8 Binary files /dev/null and b/user_guide/_static/._jquery.js differ diff --git a/user_guide/_static/._minus.png b/user_guide/_static/._minus.png new file mode 100644 index 00000000000..0c122b64999 Binary files /dev/null and b/user_guide/_static/._minus.png differ diff --git a/user_guide/_static/._plus.png b/user_guide/_static/._plus.png new file mode 100644 index 00000000000..dc6d1d2602b Binary files /dev/null and b/user_guide/_static/._plus.png differ diff --git a/user_guide/_static/._pygments.css b/user_guide/_static/._pygments.css new file mode 100644 index 00000000000..6e5c4e1a308 Binary files /dev/null and b/user_guide/_static/._pygments.css differ diff --git a/user_guide/_static/._searchtools.js b/user_guide/_static/._searchtools.js new file mode 100644 index 00000000000..f658e71b5a2 Binary files /dev/null and b/user_guide/_static/._searchtools.js differ diff --git a/user_guide/_static/._underscore-1.3.1.js b/user_guide/_static/._underscore-1.3.1.js new file mode 100644 index 00000000000..acfec249240 Binary files /dev/null and b/user_guide/_static/._underscore-1.3.1.js differ diff --git a/user_guide/_static/._underscore.js b/user_guide/_static/._underscore.js new file mode 100644 index 00000000000..559881d0d66 Binary files /dev/null and b/user_guide/_static/._underscore.js differ diff --git a/user_guide/_static/._up-pressed.png b/user_guide/_static/._up-pressed.png new file mode 100644 index 00000000000..b0aba7ad2b2 Binary files /dev/null and b/user_guide/_static/._up-pressed.png differ diff --git a/user_guide/_static/._up.png b/user_guide/_static/._up.png new file mode 100644 index 00000000000..0b782f00f1d Binary files /dev/null and b/user_guide/_static/._up.png differ diff --git a/user_guide/_static/._websupport.js b/user_guide/_static/._websupport.js new file mode 100644 index 00000000000..c9beaa8652d Binary files /dev/null and b/user_guide/_static/._websupport.js differ diff --git a/user_guide/_static/ajax-loader.gif b/user_guide/_static/ajax-loader.gif new file mode 100644 index 00000000000..61faf8cab23 Binary files /dev/null and b/user_guide/_static/ajax-loader.gif differ diff --git a/user_guide/_static/basic.css b/user_guide/_static/basic.css new file mode 100644 index 00000000000..6df76b0a6c5 --- /dev/null +++ b/user_guide/_static/basic.css @@ -0,0 +1,639 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox input[type="text"] { + width: 170px; +} + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlighted { + background-color: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +div.code-block-caption { + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +div.code-block-caption + div > div.highlight > pre { + margin-top: 0; +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + padding: 1em 1em 0; +} + +div.literal-block-wrapper div.highlight { + margin: 0; +} + +code.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +code.descclassname { + background-color: transparent; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: relative; + left: 0px; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/user_guide/_static/ci-icon.ico b/user_guide/_static/ci-icon.ico new file mode 100644 index 00000000000..7ecfce214cb Binary files /dev/null and b/user_guide/_static/ci-icon.ico differ diff --git a/user_guide/_static/comment-bright.png b/user_guide/_static/comment-bright.png new file mode 100644 index 00000000000..15e27edb12a Binary files /dev/null and b/user_guide/_static/comment-bright.png differ diff --git a/user_guide/_static/comment-close.png b/user_guide/_static/comment-close.png new file mode 100644 index 00000000000..4d91bcf57de Binary files /dev/null and b/user_guide/_static/comment-close.png differ diff --git a/user_guide/_static/comment.png b/user_guide/_static/comment.png new file mode 100644 index 00000000000..dfbc0cbd512 Binary files /dev/null and b/user_guide/_static/comment.png differ diff --git a/user_guide/_static/css/._badge_only.css b/user_guide/_static/css/._badge_only.css new file mode 100644 index 00000000000..f36b748bb87 Binary files /dev/null and b/user_guide/_static/css/._badge_only.css differ diff --git a/user_guide/_static/css/._citheme.css b/user_guide/_static/css/._citheme.css new file mode 100644 index 00000000000..d4a0fa3ed3c Binary files /dev/null and b/user_guide/_static/css/._citheme.css differ diff --git a/user_guide/_static/css/._theme.css b/user_guide/_static/css/._theme.css new file mode 100644 index 00000000000..c60efc8c339 Binary files /dev/null and b/user_guide/_static/css/._theme.css differ diff --git a/user_guide/_static/css/badge_only.css b/user_guide/_static/css/badge_only.css new file mode 100644 index 00000000000..7e17fb148c6 --- /dev/null +++ b/user_guide/_static/css/badge_only.css @@ -0,0 +1,2 @@ +.fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../font/fontawesome_webfont.eot");src:url("../font/fontawesome_webfont.eot?#iefix") format("embedded-opentype"),url("../font/fontawesome_webfont.woff") format("woff"),url("../font/fontawesome_webfont.ttf") format("truetype"),url("../font/fontawesome_webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:0.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}img{width:100%;height:auto}} +/*# sourceMappingURL=badge_only.css.map */ diff --git a/user_guide/_static/css/citheme.css b/user_guide/_static/css/citheme.css new file mode 100644 index 00000000000..a2a3b3e91fa --- /dev/null +++ b/user_guide/_static/css/citheme.css @@ -0,0 +1,88 @@ +@import 'theme.css'; + +.highlighted { + padding: 0px !important; + font-weight: inherit !important; + background-color: #f1d40f !important; +} + +#nav { + background-color: #494949; + margin: 0; + padding: 0; + display: none; +} + +#nav2 { + background: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAMgAzAwERAAIRAQMRAf/EAFkAAQADAQAAAAAAAAAAAAAAAAABBQcIAQEAAAAAAAAAAAAAAAAAAAAAEAABAgYDAAAAAAAAAAAAAAAAAVERAtMEFJRVBxgRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AMRAAAAAAAA7a87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wN/wJGAYEjAMCRgGBIwDAkYBgSMAwJGAsoIwCCMAgjAIIwCCMAgjAIIwEgAAAAAAAAAAAAAAAAAAAAAAAH//2Q==) repeat-x scroll left top transparent; + margin: 0; + padding: 0 310px 0 0; + text-align: right; + display: none; +} + +#nav_inner { + background-color: transparent; + font-family: Lucida Grande,Verdana,Geneva,sans-serif; + font-size: 11px; + margin: 0; + padding: 8px 12px 0 20px; +} + +div#pulldown-menu { + -moz-column-count: 5; + -moz-column-gap: 20px; + -webkit-column-count: 5; + -webkit-column-gap: 20px; + column-count: 5; + column-gap: 20px; + -webkit-column-rule: 1px groove #b8b8b8; + -moz-column-rule: 1px groove #b8b8b8; + column-rule: 1px groove #b8b8b8; +} + +#pulldown-menu > ul { + padding-top: 10px; + padding-bottom: 10px; + -webkit-column-break-inside: avoid; /*Chrome, Safari*/ + display: table; /*Firefox*/ + break-inside: avoid; /*IE 10+ theoretically*/ +} + +#pulldown-menu ul li.toctree-l2 { + font-size: 0.82em; + margin-left: 20px; + list-style-image: url(data:image/gif;base64,R0lGODlhCwAJALMJAO7u7uTk5PLy8unp6fb29t7e3vj4+Li4uIWFheTk5AAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAAALAAkAAAQoMJ1JqTQ4Z3SI98jHCWSJkByArCyiHkMsIzEX3DeCc0Xv+4hEa5iIAAA7); +} + +#pulldown-menu ul li.toctree-l1 a { + color: #ffffff; + text-decoration: none; + font-size: 12px; + font-family: "Roboto Slab","ff-tisa-web-pro","Georgia",Arial,sans-serif; + font-weight: 700; +} + +#pulldown-menu ul li.toctree-l2 a { + text-decoration: none; + font-size: 11px; + line-height: 1.4em; + font-weight: 300; + font-family: Lucida Grande,Verdana,Geneva,sans-serif; + color: #aaaaaa; +} + +/*hide pulldown menu on mobile devices*/ +@media (max-width: 768px) { /*tablet size defined by theme*/ + #closeMe { + display: none; + } + + #pulldown { + display: none; + } + + #openToc { + display: none; + } +} \ No newline at end of file diff --git a/user_guide/_static/css/theme.css b/user_guide/_static/css/theme.css new file mode 100644 index 00000000000..fe7e2cbccc8 --- /dev/null +++ b/user_guide/_static/css/theme.css @@ -0,0 +1,5 @@ +*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}[hidden]{display:none}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a:hover,a:active{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:0}dfn{font-style:italic}ins{background:#ff9;color:#000;text-decoration:none}mark{background:#ff0;color:#000;font-style:italic;font-weight:bold}pre,code,.rst-content tt,kbd,samp{font-family:monospace,serif;_font-family:"courier new",monospace;font-size:1em}pre{white-space:pre}q{quotes:none}q:before,q:after{content:"";content:none}small{font-size:85%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}ul,ol,dl{margin:0;padding:0;list-style:none;list-style-image:none}li{list-style:none}dd{margin:0}img{border:0;-ms-interpolation-mode:bicubic;vertical-align:middle;max-width:100%}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:0;margin:0;padding:0}label{cursor:pointer}legend{border:0;*margin-left:-7px;padding:0;white-space:normal}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button;*overflow:visible}button[disabled],input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*width:13px;*height:13px}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top;resize:vertical}table{border-collapse:collapse;border-spacing:0}td{vertical-align:top}.chromeframe{margin:0.2em 0;background:#ccc;color:#000;padding:0.2em 0}.ir{display:block;border:0;text-indent:-999em;overflow:hidden;background-color:transparent;background-repeat:no-repeat;text-align:left;direction:ltr;*line-height:0}.ir br{display:none}.hidden{display:none !important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.relative{position:relative}big,small{font-size:100%}@media print{html,body,section{background:none !important}*{box-shadow:none !important;text-shadow:none !important;filter:none !important;-ms-filter:none !important}a,a:visited{text-decoration:underline}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:1.5cm 0.5cm 2.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}.fa:before,.rst-content .admonition-title:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content dl dt .headerlink:before,.icon:before,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-alert,.rst-content .note,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .warning,.rst-content .seealso,.rst-content .admonition-todo,.btn,input[type="text"],input[type="password"],input[type="email"],input[type="url"],input[type="date"],input[type="month"],input[type="time"],input[type="datetime"],input[type="datetime-local"],input[type="week"],input[type="number"],input[type="search"],input[type="tel"],input[type="color"],select,textarea,.wy-menu-vertical li.on a,.wy-menu-vertical li.current>a,.wy-side-nav-search>a,.wy-side-nav-search .wy-dropdown>a,.wy-nav-top a{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}/*! + * Font Awesome 4.1.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url("../fonts/fontawesome-webfont.eot?v=4.1.0");src:url("../fonts/fontawesome-webfont.eot?#iefix&v=4.1.0") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff?v=4.1.0") format("woff"),url("../fonts/fontawesome-webfont.ttf?v=4.1.0") format("truetype"),url("../fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular") format("svg");font-weight:normal;font-style:normal}.fa,.rst-content .admonition-title,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content dl dt .headerlink,.icon{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333em;line-height:0.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14286em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14286em;width:2.14286em;top:0.14286em;text-align:center}.fa-li.fa-lg{left:-1.85714em}.fa-border{padding:.2em .25em .15em;border:solid 0.08em #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left,.rst-content .pull-left.admonition-title,.rst-content h1 .pull-left.headerlink,.rst-content h2 .pull-left.headerlink,.rst-content h3 .pull-left.headerlink,.rst-content h4 .pull-left.headerlink,.rst-content h5 .pull-left.headerlink,.rst-content h6 .pull-left.headerlink,.rst-content dl dt .pull-left.headerlink,.pull-left.icon{margin-right:.3em}.fa.pull-right,.rst-content .pull-right.admonition-title,.rst-content h1 .pull-right.headerlink,.rst-content h2 .pull-right.headerlink,.rst-content h3 .pull-right.headerlink,.rst-content h4 .pull-right.headerlink,.rst-content h5 .pull-right.headerlink,.rst-content h6 .pull-right.headerlink,.rst-content dl dt .pull-right.headerlink,.pull-right.icon{margin-left:.3em}.fa-spin{-webkit-animation:spin 2s infinite linear;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0);-webkit-transform:scale(-1, 1);-moz-transform:scale(-1, 1);-ms-transform:scale(-1, 1);-o-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:scale(1, -1);-moz-transform:scale(1, -1);-ms-transform:scale(1, -1);-o-transform:scale(1, -1);transform:scale(1, -1)}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:""}.fa-music:before{content:""}.fa-search:before,.icon-search:before{content:""}.fa-envelope-o:before{content:""}.fa-heart:before{content:""}.fa-star:before{content:""}.fa-star-o:before{content:""}.fa-user:before{content:""}.fa-film:before{content:""}.fa-th-large:before{content:""}.fa-th:before{content:""}.fa-th-list:before{content:""}.fa-check:before{content:""}.fa-times:before{content:""}.fa-search-plus:before{content:""}.fa-search-minus:before{content:""}.fa-power-off:before{content:""}.fa-signal:before{content:""}.fa-gear:before,.fa-cog:before{content:""}.fa-trash-o:before{content:""}.fa-home:before,.icon-home:before{content:""}.fa-file-o:before{content:""}.fa-clock-o:before{content:""}.fa-road:before{content:""}.fa-download:before{content:""}.fa-arrow-circle-o-down:before{content:""}.fa-arrow-circle-o-up:before{content:""}.fa-inbox:before{content:""}.fa-play-circle-o:before{content:""}.fa-rotate-right:before,.fa-repeat:before{content:""}.fa-refresh:before{content:""}.fa-list-alt:before{content:""}.fa-lock:before{content:""}.fa-flag:before{content:""}.fa-headphones:before{content:""}.fa-volume-off:before{content:""}.fa-volume-down:before{content:""}.fa-volume-up:before{content:""}.fa-qrcode:before{content:""}.fa-barcode:before{content:""}.fa-tag:before{content:""}.fa-tags:before{content:""}.fa-book:before,.icon-book:before{content:""}.fa-bookmark:before{content:""}.fa-print:before{content:""}.fa-camera:before{content:""}.fa-font:before{content:""}.fa-bold:before{content:""}.fa-italic:before{content:""}.fa-text-height:before{content:""}.fa-text-width:before{content:""}.fa-align-left:before{content:""}.fa-align-center:before{content:""}.fa-align-right:before{content:""}.fa-align-justify:before{content:""}.fa-list:before{content:""}.fa-dedent:before,.fa-outdent:before{content:""}.fa-indent:before{content:""}.fa-video-camera:before{content:""}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:""}.fa-pencil:before{content:""}.fa-map-marker:before{content:""}.fa-adjust:before{content:""}.fa-tint:before{content:""}.fa-edit:before,.fa-pencil-square-o:before{content:""}.fa-share-square-o:before{content:""}.fa-check-square-o:before{content:""}.fa-arrows:before{content:""}.fa-step-backward:before{content:""}.fa-fast-backward:before{content:""}.fa-backward:before{content:""}.fa-play:before{content:""}.fa-pause:before{content:""}.fa-stop:before{content:""}.fa-forward:before{content:""}.fa-fast-forward:before{content:""}.fa-step-forward:before{content:""}.fa-eject:before{content:""}.fa-chevron-left:before{content:""}.fa-chevron-right:before{content:""}.fa-plus-circle:before{content:""}.fa-minus-circle:before{content:""}.fa-times-circle:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before{content:""}.fa-check-circle:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before{content:""}.fa-question-circle:before{content:""}.fa-info-circle:before{content:""}.fa-crosshairs:before{content:""}.fa-times-circle-o:before{content:""}.fa-check-circle-o:before{content:""}.fa-ban:before{content:""}.fa-arrow-left:before{content:""}.fa-arrow-right:before{content:""}.fa-arrow-up:before{content:""}.fa-arrow-down:before{content:""}.fa-mail-forward:before,.fa-share:before{content:""}.fa-expand:before{content:""}.fa-compress:before{content:""}.fa-plus:before{content:""}.fa-minus:before{content:""}.fa-asterisk:before{content:""}.fa-exclamation-circle:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.rst-content .admonition-title:before{content:""}.fa-gift:before{content:""}.fa-leaf:before{content:""}.fa-fire:before,.icon-fire:before{content:""}.fa-eye:before{content:""}.fa-eye-slash:before{content:""}.fa-warning:before,.fa-exclamation-triangle:before{content:""}.fa-plane:before{content:""}.fa-calendar:before{content:""}.fa-random:before{content:""}.fa-comment:before{content:""}.fa-magnet:before{content:""}.fa-chevron-up:before{content:""}.fa-chevron-down:before{content:""}.fa-retweet:before{content:""}.fa-shopping-cart:before{content:""}.fa-folder:before{content:""}.fa-folder-open:before{content:""}.fa-arrows-v:before{content:""}.fa-arrows-h:before{content:""}.fa-bar-chart-o:before{content:""}.fa-twitter-square:before{content:""}.fa-facebook-square:before{content:""}.fa-camera-retro:before{content:""}.fa-key:before{content:""}.fa-gears:before,.fa-cogs:before{content:""}.fa-comments:before{content:""}.fa-thumbs-o-up:before{content:""}.fa-thumbs-o-down:before{content:""}.fa-star-half:before{content:""}.fa-heart-o:before{content:""}.fa-sign-out:before{content:""}.fa-linkedin-square:before{content:""}.fa-thumb-tack:before{content:""}.fa-external-link:before{content:""}.fa-sign-in:before{content:""}.fa-trophy:before{content:""}.fa-github-square:before{content:""}.fa-upload:before{content:""}.fa-lemon-o:before{content:""}.fa-phone:before{content:""}.fa-square-o:before{content:""}.fa-bookmark-o:before{content:""}.fa-phone-square:before{content:""}.fa-twitter:before{content:""}.fa-facebook:before{content:""}.fa-github:before,.icon-github:before{content:""}.fa-unlock:before{content:""}.fa-credit-card:before{content:""}.fa-rss:before{content:""}.fa-hdd-o:before{content:""}.fa-bullhorn:before{content:""}.fa-bell:before{content:""}.fa-certificate:before{content:""}.fa-hand-o-right:before{content:""}.fa-hand-o-left:before{content:""}.fa-hand-o-up:before{content:""}.fa-hand-o-down:before{content:""}.fa-arrow-circle-left:before,.icon-circle-arrow-left:before{content:""}.fa-arrow-circle-right:before,.icon-circle-arrow-right:before{content:""}.fa-arrow-circle-up:before{content:""}.fa-arrow-circle-down:before{content:""}.fa-globe:before{content:""}.fa-wrench:before{content:""}.fa-tasks:before{content:""}.fa-filter:before{content:""}.fa-briefcase:before{content:""}.fa-arrows-alt:before{content:""}.fa-group:before,.fa-users:before{content:""}.fa-chain:before,.fa-link:before,.icon-link:before{content:""}.fa-cloud:before{content:""}.fa-flask:before{content:""}.fa-cut:before,.fa-scissors:before{content:""}.fa-copy:before,.fa-files-o:before{content:""}.fa-paperclip:before{content:""}.fa-save:before,.fa-floppy-o:before{content:""}.fa-square:before{content:""}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:""}.fa-list-ul:before{content:""}.fa-list-ol:before{content:""}.fa-strikethrough:before{content:""}.fa-underline:before{content:""}.fa-table:before{content:""}.fa-magic:before{content:""}.fa-truck:before{content:""}.fa-pinterest:before{content:""}.fa-pinterest-square:before{content:""}.fa-google-plus-square:before{content:""}.fa-google-plus:before{content:""}.fa-money:before{content:""}.fa-caret-down:before,.wy-dropdown .caret:before,.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.fa-caret-left:before{content:""}.fa-caret-right:before{content:""}.fa-columns:before{content:""}.fa-unsorted:before,.fa-sort:before{content:""}.fa-sort-down:before,.fa-sort-desc:before{content:""}.fa-sort-up:before,.fa-sort-asc:before{content:""}.fa-envelope:before{content:""}.fa-linkedin:before{content:""}.fa-rotate-left:before,.fa-undo:before{content:""}.fa-legal:before,.fa-gavel:before{content:""}.fa-dashboard:before,.fa-tachometer:before{content:""}.fa-comment-o:before{content:""}.fa-comments-o:before{content:""}.fa-flash:before,.fa-bolt:before{content:""}.fa-sitemap:before{content:""}.fa-umbrella:before{content:""}.fa-paste:before,.fa-clipboard:before{content:""}.fa-lightbulb-o:before{content:""}.fa-exchange:before{content:""}.fa-cloud-download:before{content:""}.fa-cloud-upload:before{content:""}.fa-user-md:before{content:""}.fa-stethoscope:before{content:""}.fa-suitcase:before{content:""}.fa-bell-o:before{content:""}.fa-coffee:before{content:""}.fa-cutlery:before{content:""}.fa-file-text-o:before{content:""}.fa-building-o:before{content:""}.fa-hospital-o:before{content:""}.fa-ambulance:before{content:""}.fa-medkit:before{content:""}.fa-fighter-jet:before{content:""}.fa-beer:before{content:""}.fa-h-square:before{content:""}.fa-plus-square:before{content:""}.fa-angle-double-left:before{content:""}.fa-angle-double-right:before{content:""}.fa-angle-double-up:before{content:""}.fa-angle-double-down:before{content:""}.fa-angle-left:before{content:""}.fa-angle-right:before{content:""}.fa-angle-up:before{content:""}.fa-angle-down:before{content:""}.fa-desktop:before{content:""}.fa-laptop:before{content:""}.fa-tablet:before{content:""}.fa-mobile-phone:before,.fa-mobile:before{content:""}.fa-circle-o:before{content:""}.fa-quote-left:before{content:""}.fa-quote-right:before{content:""}.fa-spinner:before{content:""}.fa-circle:before{content:""}.fa-mail-reply:before,.fa-reply:before{content:""}.fa-github-alt:before{content:""}.fa-folder-o:before{content:""}.fa-folder-open-o:before{content:""}.fa-smile-o:before{content:""}.fa-frown-o:before{content:""}.fa-meh-o:before{content:""}.fa-gamepad:before{content:""}.fa-keyboard-o:before{content:""}.fa-flag-o:before{content:""}.fa-flag-checkered:before{content:""}.fa-terminal:before{content:""}.fa-code:before{content:""}.fa-mail-reply-all:before,.fa-reply-all:before{content:""}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:""}.fa-location-arrow:before{content:""}.fa-crop:before{content:""}.fa-code-fork:before{content:""}.fa-unlink:before,.fa-chain-broken:before{content:""}.fa-question:before{content:""}.fa-info:before{content:""}.fa-exclamation:before{content:""}.fa-superscript:before{content:""}.fa-subscript:before{content:""}.fa-eraser:before{content:""}.fa-puzzle-piece:before{content:""}.fa-microphone:before{content:""}.fa-microphone-slash:before{content:""}.fa-shield:before{content:""}.fa-calendar-o:before{content:""}.fa-fire-extinguisher:before{content:""}.fa-rocket:before{content:""}.fa-maxcdn:before{content:""}.fa-chevron-circle-left:before{content:""}.fa-chevron-circle-right:before{content:""}.fa-chevron-circle-up:before{content:""}.fa-chevron-circle-down:before{content:""}.fa-html5:before{content:""}.fa-css3:before{content:""}.fa-anchor:before{content:""}.fa-unlock-alt:before{content:""}.fa-bullseye:before{content:""}.fa-ellipsis-h:before{content:""}.fa-ellipsis-v:before{content:""}.fa-rss-square:before{content:""}.fa-play-circle:before{content:""}.fa-ticket:before{content:""}.fa-minus-square:before{content:""}.fa-minus-square-o:before{content:""}.fa-level-up:before{content:""}.fa-level-down:before{content:""}.fa-check-square:before{content:""}.fa-pencil-square:before{content:""}.fa-external-link-square:before{content:""}.fa-share-square:before{content:""}.fa-compass:before{content:""}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:""}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:""}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:""}.fa-euro:before,.fa-eur:before{content:""}.fa-gbp:before{content:""}.fa-dollar:before,.fa-usd:before{content:""}.fa-rupee:before,.fa-inr:before{content:""}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:""}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:""}.fa-won:before,.fa-krw:before{content:""}.fa-bitcoin:before,.fa-btc:before{content:""}.fa-file:before{content:""}.fa-file-text:before{content:""}.fa-sort-alpha-asc:before{content:""}.fa-sort-alpha-desc:before{content:""}.fa-sort-amount-asc:before{content:""}.fa-sort-amount-desc:before{content:""}.fa-sort-numeric-asc:before{content:""}.fa-sort-numeric-desc:before{content:""}.fa-thumbs-up:before{content:""}.fa-thumbs-down:before{content:""}.fa-youtube-square:before{content:""}.fa-youtube:before{content:""}.fa-xing:before{content:""}.fa-xing-square:before{content:""}.fa-youtube-play:before{content:""}.fa-dropbox:before{content:""}.fa-stack-overflow:before{content:""}.fa-instagram:before{content:""}.fa-flickr:before{content:""}.fa-adn:before{content:""}.fa-bitbucket:before,.icon-bitbucket:before{content:""}.fa-bitbucket-square:before{content:""}.fa-tumblr:before{content:""}.fa-tumblr-square:before{content:""}.fa-long-arrow-down:before{content:""}.fa-long-arrow-up:before{content:""}.fa-long-arrow-left:before{content:""}.fa-long-arrow-right:before{content:""}.fa-apple:before{content:""}.fa-windows:before{content:""}.fa-android:before{content:""}.fa-linux:before{content:""}.fa-dribbble:before{content:""}.fa-skype:before{content:""}.fa-foursquare:before{content:""}.fa-trello:before{content:""}.fa-female:before{content:""}.fa-male:before{content:""}.fa-gittip:before{content:""}.fa-sun-o:before{content:""}.fa-moon-o:before{content:""}.fa-archive:before{content:""}.fa-bug:before{content:""}.fa-vk:before{content:""}.fa-weibo:before{content:""}.fa-renren:before{content:""}.fa-pagelines:before{content:""}.fa-stack-exchange:before{content:""}.fa-arrow-circle-o-right:before{content:""}.fa-arrow-circle-o-left:before{content:""}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:""}.fa-dot-circle-o:before{content:""}.fa-wheelchair:before{content:""}.fa-vimeo-square:before{content:""}.fa-turkish-lira:before,.fa-try:before{content:""}.fa-plus-square-o:before{content:""}.fa-space-shuttle:before{content:""}.fa-slack:before{content:""}.fa-envelope-square:before{content:""}.fa-wordpress:before{content:""}.fa-openid:before{content:""}.fa-institution:before,.fa-bank:before,.fa-university:before{content:""}.fa-mortar-board:before,.fa-graduation-cap:before{content:""}.fa-yahoo:before{content:""}.fa-google:before{content:""}.fa-reddit:before{content:""}.fa-reddit-square:before{content:""}.fa-stumbleupon-circle:before{content:""}.fa-stumbleupon:before{content:""}.fa-delicious:before{content:""}.fa-digg:before{content:""}.fa-pied-piper-square:before,.fa-pied-piper:before{content:""}.fa-pied-piper-alt:before{content:""}.fa-drupal:before{content:""}.fa-joomla:before{content:""}.fa-language:before{content:""}.fa-fax:before{content:""}.fa-building:before{content:""}.fa-child:before{content:""}.fa-paw:before{content:""}.fa-spoon:before{content:""}.fa-cube:before{content:""}.fa-cubes:before{content:""}.fa-behance:before{content:""}.fa-behance-square:before{content:""}.fa-steam:before{content:""}.fa-steam-square:before{content:""}.fa-recycle:before{content:""}.fa-automobile:before,.fa-car:before{content:""}.fa-cab:before,.fa-taxi:before{content:""}.fa-tree:before{content:""}.fa-spotify:before{content:""}.fa-deviantart:before{content:""}.fa-soundcloud:before{content:""}.fa-database:before{content:""}.fa-file-pdf-o:before{content:""}.fa-file-word-o:before{content:""}.fa-file-excel-o:before{content:""}.fa-file-powerpoint-o:before{content:""}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:""}.fa-file-zip-o:before,.fa-file-archive-o:before{content:""}.fa-file-sound-o:before,.fa-file-audio-o:before{content:""}.fa-file-movie-o:before,.fa-file-video-o:before{content:""}.fa-file-code-o:before{content:""}.fa-vine:before{content:""}.fa-codepen:before{content:""}.fa-jsfiddle:before{content:""}.fa-life-bouy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:""}.fa-circle-o-notch:before{content:""}.fa-ra:before,.fa-rebel:before{content:""}.fa-ge:before,.fa-empire:before{content:""}.fa-git-square:before{content:""}.fa-git:before{content:""}.fa-hacker-news:before{content:""}.fa-tencent-weibo:before{content:""}.fa-qq:before{content:""}.fa-wechat:before,.fa-weixin:before{content:""}.fa-send:before,.fa-paper-plane:before{content:""}.fa-send-o:before,.fa-paper-plane-o:before{content:""}.fa-history:before{content:""}.fa-circle-thin:before{content:""}.fa-header:before{content:""}.fa-paragraph:before{content:""}.fa-sliders:before{content:""}.fa-share-alt:before{content:""}.fa-share-alt-square:before{content:""}.fa-bomb:before{content:""}.fa,.rst-content .admonition-title,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content dl dt .headerlink,.icon,.wy-dropdown .caret,.wy-inline-validate.wy-inline-validate-success .wy-input-context,.wy-inline-validate.wy-inline-validate-danger .wy-input-context,.wy-inline-validate.wy-inline-validate-warning .wy-input-context,.wy-inline-validate.wy-inline-validate-info .wy-input-context{font-family:inherit}.fa:before,.rst-content .admonition-title:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content dl dt .headerlink:before,.icon:before,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before{font-family:"FontAwesome";display:inline-block;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa,a .rst-content .admonition-title,.rst-content a .admonition-title,a .rst-content h1 .headerlink,.rst-content h1 a .headerlink,a .rst-content h2 .headerlink,.rst-content h2 a .headerlink,a .rst-content h3 .headerlink,.rst-content h3 a .headerlink,a .rst-content h4 .headerlink,.rst-content h4 a .headerlink,a .rst-content h5 .headerlink,.rst-content h5 a .headerlink,a .rst-content h6 .headerlink,.rst-content h6 a .headerlink,a .rst-content dl dt .headerlink,.rst-content dl dt a .headerlink,a .icon{display:inline-block;text-decoration:inherit}.btn .fa,.btn .rst-content .admonition-title,.rst-content .btn .admonition-title,.btn .rst-content h1 .headerlink,.rst-content h1 .btn .headerlink,.btn .rst-content h2 .headerlink,.rst-content h2 .btn .headerlink,.btn .rst-content h3 .headerlink,.rst-content h3 .btn .headerlink,.btn .rst-content h4 .headerlink,.rst-content h4 .btn .headerlink,.btn .rst-content h5 .headerlink,.rst-content h5 .btn .headerlink,.btn .rst-content h6 .headerlink,.rst-content h6 .btn .headerlink,.btn .rst-content dl dt .headerlink,.rst-content dl dt .btn .headerlink,.btn .icon,.nav .fa,.nav .rst-content .admonition-title,.rst-content .nav .admonition-title,.nav .rst-content h1 .headerlink,.rst-content h1 .nav .headerlink,.nav .rst-content h2 .headerlink,.rst-content h2 .nav .headerlink,.nav .rst-content h3 .headerlink,.rst-content h3 .nav .headerlink,.nav .rst-content h4 .headerlink,.rst-content h4 .nav .headerlink,.nav .rst-content h5 .headerlink,.rst-content h5 .nav .headerlink,.nav .rst-content h6 .headerlink,.rst-content h6 .nav .headerlink,.nav .rst-content dl dt .headerlink,.rst-content dl dt .nav .headerlink,.nav .icon{display:inline}.btn .fa.fa-large,.btn .rst-content .fa-large.admonition-title,.rst-content .btn .fa-large.admonition-title,.btn .rst-content h1 .fa-large.headerlink,.rst-content h1 .btn .fa-large.headerlink,.btn .rst-content h2 .fa-large.headerlink,.rst-content h2 .btn .fa-large.headerlink,.btn .rst-content h3 .fa-large.headerlink,.rst-content h3 .btn .fa-large.headerlink,.btn .rst-content h4 .fa-large.headerlink,.rst-content h4 .btn .fa-large.headerlink,.btn .rst-content h5 .fa-large.headerlink,.rst-content h5 .btn .fa-large.headerlink,.btn .rst-content h6 .fa-large.headerlink,.rst-content h6 .btn .fa-large.headerlink,.btn .rst-content dl dt .fa-large.headerlink,.rst-content dl dt .btn .fa-large.headerlink,.btn .fa-large.icon,.nav .fa.fa-large,.nav .rst-content .fa-large.admonition-title,.rst-content .nav .fa-large.admonition-title,.nav .rst-content h1 .fa-large.headerlink,.rst-content h1 .nav .fa-large.headerlink,.nav .rst-content h2 .fa-large.headerlink,.rst-content h2 .nav .fa-large.headerlink,.nav .rst-content h3 .fa-large.headerlink,.rst-content h3 .nav .fa-large.headerlink,.nav .rst-content h4 .fa-large.headerlink,.rst-content h4 .nav .fa-large.headerlink,.nav .rst-content h5 .fa-large.headerlink,.rst-content h5 .nav .fa-large.headerlink,.nav .rst-content h6 .fa-large.headerlink,.rst-content h6 .nav .fa-large.headerlink,.nav .rst-content dl dt .fa-large.headerlink,.rst-content dl dt .nav .fa-large.headerlink,.nav .fa-large.icon{line-height:0.9em}.btn .fa.fa-spin,.btn .rst-content .fa-spin.admonition-title,.rst-content .btn .fa-spin.admonition-title,.btn .rst-content h1 .fa-spin.headerlink,.rst-content h1 .btn .fa-spin.headerlink,.btn .rst-content h2 .fa-spin.headerlink,.rst-content h2 .btn .fa-spin.headerlink,.btn .rst-content h3 .fa-spin.headerlink,.rst-content h3 .btn .fa-spin.headerlink,.btn .rst-content h4 .fa-spin.headerlink,.rst-content h4 .btn .fa-spin.headerlink,.btn .rst-content h5 .fa-spin.headerlink,.rst-content h5 .btn .fa-spin.headerlink,.btn .rst-content h6 .fa-spin.headerlink,.rst-content h6 .btn .fa-spin.headerlink,.btn .rst-content dl dt .fa-spin.headerlink,.rst-content dl dt .btn .fa-spin.headerlink,.btn .fa-spin.icon,.nav .fa.fa-spin,.nav .rst-content .fa-spin.admonition-title,.rst-content .nav .fa-spin.admonition-title,.nav .rst-content h1 .fa-spin.headerlink,.rst-content h1 .nav .fa-spin.headerlink,.nav .rst-content h2 .fa-spin.headerlink,.rst-content h2 .nav .fa-spin.headerlink,.nav .rst-content h3 .fa-spin.headerlink,.rst-content h3 .nav .fa-spin.headerlink,.nav .rst-content h4 .fa-spin.headerlink,.rst-content h4 .nav .fa-spin.headerlink,.nav .rst-content h5 .fa-spin.headerlink,.rst-content h5 .nav .fa-spin.headerlink,.nav .rst-content h6 .fa-spin.headerlink,.rst-content h6 .nav .fa-spin.headerlink,.nav .rst-content dl dt .fa-spin.headerlink,.rst-content dl dt .nav .fa-spin.headerlink,.nav .fa-spin.icon{display:inline-block}.btn.fa:before,.rst-content .btn.admonition-title:before,.rst-content h1 .btn.headerlink:before,.rst-content h2 .btn.headerlink:before,.rst-content h3 .btn.headerlink:before,.rst-content h4 .btn.headerlink:before,.rst-content h5 .btn.headerlink:before,.rst-content h6 .btn.headerlink:before,.rst-content dl dt .btn.headerlink:before,.btn.icon:before{opacity:0.5;-webkit-transition:opacity 0.05s ease-in;-moz-transition:opacity 0.05s ease-in;transition:opacity 0.05s ease-in}.btn.fa:hover:before,.rst-content .btn.admonition-title:hover:before,.rst-content h1 .btn.headerlink:hover:before,.rst-content h2 .btn.headerlink:hover:before,.rst-content h3 .btn.headerlink:hover:before,.rst-content h4 .btn.headerlink:hover:before,.rst-content h5 .btn.headerlink:hover:before,.rst-content h6 .btn.headerlink:hover:before,.rst-content dl dt .btn.headerlink:hover:before,.btn.icon:hover:before{opacity:1}.btn-mini .fa:before,.btn-mini .rst-content .admonition-title:before,.rst-content .btn-mini .admonition-title:before,.btn-mini .rst-content h1 .headerlink:before,.rst-content h1 .btn-mini .headerlink:before,.btn-mini .rst-content h2 .headerlink:before,.rst-content h2 .btn-mini .headerlink:before,.btn-mini .rst-content h3 .headerlink:before,.rst-content h3 .btn-mini .headerlink:before,.btn-mini .rst-content h4 .headerlink:before,.rst-content h4 .btn-mini .headerlink:before,.btn-mini .rst-content h5 .headerlink:before,.rst-content h5 .btn-mini .headerlink:before,.btn-mini .rst-content h6 .headerlink:before,.rst-content h6 .btn-mini .headerlink:before,.btn-mini .rst-content dl dt .headerlink:before,.rst-content dl dt .btn-mini .headerlink:before,.btn-mini .icon:before{font-size:14px;vertical-align:-15%}.wy-alert,.rst-content .note,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .warning,.rst-content .seealso,.rst-content .admonition-todo{padding:12px;line-height:24px;margin-bottom:24px;background:#dedede}.wy-alert-title,.rst-content .admonition-title{color:#fff;font-weight:bold;display:block;color:#fff;background:#8ba8af;margin:-12px;padding:6px 12px;margin-bottom:12px}.wy-alert.wy-alert-danger,.rst-content .wy-alert-danger.note,.rst-content .wy-alert-danger.attention,.rst-content .wy-alert-danger.caution,.rst-content .danger,.rst-content .error,.rst-content .wy-alert-danger.hint,.rst-content .wy-alert-danger.important,.rst-content .wy-alert-danger.tip,.rst-content .wy-alert-danger.warning,.rst-content .wy-alert-danger.seealso,.rst-content .wy-alert-danger.admonition-todo{background:#fdf3f2}.wy-alert.wy-alert-danger .wy-alert-title,.rst-content .wy-alert-danger.note .wy-alert-title,.rst-content .wy-alert-danger.attention .wy-alert-title,.rst-content .wy-alert-danger.caution .wy-alert-title,.rst-content .danger .wy-alert-title,.rst-content .error .wy-alert-title,.rst-content .wy-alert-danger.hint .wy-alert-title,.rst-content .wy-alert-danger.important .wy-alert-title,.rst-content .wy-alert-danger.tip .wy-alert-title,.rst-content .wy-alert-danger.warning .wy-alert-title,.rst-content .wy-alert-danger.seealso .wy-alert-title,.rst-content .wy-alert-danger.admonition-todo .wy-alert-title,.wy-alert.wy-alert-danger .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-danger .admonition-title,.rst-content .wy-alert-danger.note .admonition-title,.rst-content .wy-alert-danger.attention .admonition-title,.rst-content .wy-alert-danger.caution .admonition-title,.rst-content .danger .admonition-title,.rst-content .error .admonition-title,.rst-content .wy-alert-danger.hint .admonition-title,.rst-content .wy-alert-danger.important .admonition-title,.rst-content .wy-alert-danger.tip .admonition-title,.rst-content .wy-alert-danger.warning .admonition-title,.rst-content .wy-alert-danger.seealso .admonition-title,.rst-content .wy-alert-danger.admonition-todo .admonition-title{background:#f29f97}.wy-alert.wy-alert-warning,.rst-content .wy-alert-warning.note,.rst-content .attention,.rst-content .caution,.rst-content .wy-alert-warning.danger,.rst-content .wy-alert-warning.error,.rst-content .wy-alert-warning.hint,.rst-content .wy-alert-warning.important,.rst-content .wy-alert-warning.tip,.rst-content .warning,.rst-content .wy-alert-warning.seealso,.rst-content .admonition-todo{background:#ffedcc}.wy-alert.wy-alert-warning .wy-alert-title,.rst-content .wy-alert-warning.note .wy-alert-title,.rst-content .attention .wy-alert-title,.rst-content .caution .wy-alert-title,.rst-content .wy-alert-warning.danger .wy-alert-title,.rst-content .wy-alert-warning.error .wy-alert-title,.rst-content .wy-alert-warning.hint .wy-alert-title,.rst-content .wy-alert-warning.important .wy-alert-title,.rst-content .wy-alert-warning.tip .wy-alert-title,.rst-content .warning .wy-alert-title,.rst-content .wy-alert-warning.seealso .wy-alert-title,.rst-content .admonition-todo .wy-alert-title,.wy-alert.wy-alert-warning .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-warning .admonition-title,.rst-content .wy-alert-warning.note .admonition-title,.rst-content .attention .admonition-title,.rst-content .caution .admonition-title,.rst-content .wy-alert-warning.danger .admonition-title,.rst-content .wy-alert-warning.error .admonition-title,.rst-content .wy-alert-warning.hint .admonition-title,.rst-content .wy-alert-warning.important .admonition-title,.rst-content .wy-alert-warning.tip .admonition-title,.rst-content .warning .admonition-title,.rst-content .wy-alert-warning.seealso .admonition-title,.rst-content .admonition-todo .admonition-title{background:#f0b37e}.wy-alert.wy-alert-info,.rst-content .note,.rst-content .wy-alert-info.attention,.rst-content .wy-alert-info.caution,.rst-content .wy-alert-info.danger,.rst-content .wy-alert-info.error,.rst-content .wy-alert-info.hint,.rst-content .wy-alert-info.important,.rst-content .wy-alert-info.tip,.rst-content .wy-alert-info.warning,.rst-content .seealso,.rst-content .wy-alert-info.admonition-todo{background:#dedede}.wy-alert.wy-alert-info .wy-alert-title,.rst-content .note .wy-alert-title,.rst-content .wy-alert-info.attention .wy-alert-title,.rst-content .wy-alert-info.caution .wy-alert-title,.rst-content .wy-alert-info.danger .wy-alert-title,.rst-content .wy-alert-info.error .wy-alert-title,.rst-content .wy-alert-info.hint .wy-alert-title,.rst-content .wy-alert-info.important .wy-alert-title,.rst-content .wy-alert-info.tip .wy-alert-title,.rst-content .wy-alert-info.warning .wy-alert-title,.rst-content .seealso .wy-alert-title,.rst-content .wy-alert-info.admonition-todo .wy-alert-title,.wy-alert.wy-alert-info .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-info .admonition-title,.rst-content .note .admonition-title,.rst-content .wy-alert-info.attention .admonition-title,.rst-content .wy-alert-info.caution .admonition-title,.rst-content .wy-alert-info.danger .admonition-title,.rst-content .wy-alert-info.error .admonition-title,.rst-content .wy-alert-info.hint .admonition-title,.rst-content .wy-alert-info.important .admonition-title,.rst-content .wy-alert-info.tip .admonition-title,.rst-content .wy-alert-info.warning .admonition-title,.rst-content .seealso .admonition-title,.rst-content .wy-alert-info.admonition-todo .admonition-title{background:#8ba8af}.wy-alert.wy-alert-success,.rst-content .wy-alert-success.note,.rst-content .wy-alert-success.attention,.rst-content .wy-alert-success.caution,.rst-content .wy-alert-success.danger,.rst-content .wy-alert-success.error,.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .wy-alert-success.warning,.rst-content .wy-alert-success.seealso,.rst-content .wy-alert-success.admonition-todo{background:#dedede}.wy-alert.wy-alert-success .wy-alert-title,.rst-content .wy-alert-success.note .wy-alert-title,.rst-content .wy-alert-success.attention .wy-alert-title,.rst-content .wy-alert-success.caution .wy-alert-title,.rst-content .wy-alert-success.danger .wy-alert-title,.rst-content .wy-alert-success.error .wy-alert-title,.rst-content .hint .wy-alert-title,.rst-content .important .wy-alert-title,.rst-content .tip .wy-alert-title,.rst-content .wy-alert-success.warning .wy-alert-title,.rst-content .wy-alert-success.seealso .wy-alert-title,.rst-content .wy-alert-success.admonition-todo .wy-alert-title,.wy-alert.wy-alert-success .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-success .admonition-title,.rst-content .wy-alert-success.note .admonition-title,.rst-content .wy-alert-success.attention .admonition-title,.rst-content .wy-alert-success.caution .admonition-title,.rst-content .wy-alert-success.danger .admonition-title,.rst-content .wy-alert-success.error .admonition-title,.rst-content .hint .admonition-title,.rst-content .important .admonition-title,.rst-content .tip .admonition-title,.rst-content .wy-alert-success.warning .admonition-title,.rst-content .wy-alert-success.seealso .admonition-title,.rst-content .wy-alert-success.admonition-todo .admonition-title{background:#dd4814}.wy-alert.wy-alert-neutral,.rst-content .wy-alert-neutral.note,.rst-content .wy-alert-neutral.attention,.rst-content .wy-alert-neutral.caution,.rst-content .wy-alert-neutral.danger,.rst-content .wy-alert-neutral.error,.rst-content .wy-alert-neutral.hint,.rst-content .wy-alert-neutral.important,.rst-content .wy-alert-neutral.tip,.rst-content .wy-alert-neutral.warning,.rst-content .wy-alert-neutral.seealso,.rst-content .wy-alert-neutral.admonition-todo{background:#f3f6f6}.wy-alert.wy-alert-neutral .wy-alert-title,.rst-content .wy-alert-neutral.note .wy-alert-title,.rst-content .wy-alert-neutral.attention .wy-alert-title,.rst-content .wy-alert-neutral.caution .wy-alert-title,.rst-content .wy-alert-neutral.danger .wy-alert-title,.rst-content .wy-alert-neutral.error .wy-alert-title,.rst-content .wy-alert-neutral.hint .wy-alert-title,.rst-content .wy-alert-neutral.important .wy-alert-title,.rst-content .wy-alert-neutral.tip .wy-alert-title,.rst-content .wy-alert-neutral.warning .wy-alert-title,.rst-content .wy-alert-neutral.seealso .wy-alert-title,.rst-content .wy-alert-neutral.admonition-todo .wy-alert-title,.wy-alert.wy-alert-neutral .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-neutral .admonition-title,.rst-content .wy-alert-neutral.note .admonition-title,.rst-content .wy-alert-neutral.attention .admonition-title,.rst-content .wy-alert-neutral.caution .admonition-title,.rst-content .wy-alert-neutral.danger .admonition-title,.rst-content .wy-alert-neutral.error .admonition-title,.rst-content .wy-alert-neutral.hint .admonition-title,.rst-content .wy-alert-neutral.important .admonition-title,.rst-content .wy-alert-neutral.tip .admonition-title,.rst-content .wy-alert-neutral.warning .admonition-title,.rst-content .wy-alert-neutral.seealso .admonition-title,.rst-content .wy-alert-neutral.admonition-todo .admonition-title{color:#404040;background:#e1e4e5}.wy-alert.wy-alert-neutral a,.rst-content .wy-alert-neutral.note a,.rst-content .wy-alert-neutral.attention a,.rst-content .wy-alert-neutral.caution a,.rst-content .wy-alert-neutral.danger a,.rst-content .wy-alert-neutral.error a,.rst-content .wy-alert-neutral.hint a,.rst-content .wy-alert-neutral.important a,.rst-content .wy-alert-neutral.tip a,.rst-content .wy-alert-neutral.warning a,.rst-content .wy-alert-neutral.seealso a,.rst-content .wy-alert-neutral.admonition-todo a{color:#dd4814}.wy-alert p:last-child,.rst-content .note p:last-child,.rst-content .attention p:last-child,.rst-content .caution p:last-child,.rst-content .danger p:last-child,.rst-content .error p:last-child,.rst-content .hint p:last-child,.rst-content .important p:last-child,.rst-content .tip p:last-child,.rst-content .warning p:last-child,.rst-content .seealso p:last-child,.rst-content .admonition-todo p:last-child{margin-bottom:0}.wy-tray-container{position:fixed;bottom:0px;left:0;z-index:600}.wy-tray-container li{display:block;width:300px;background:transparent;color:#fff;text-align:center;box-shadow:0 5px 5px 0 rgba(0,0,0,0.1);padding:0 24px;min-width:20%;opacity:0;height:0;line-height:56px;overflow:hidden;-webkit-transition:all 0.3s ease-in;-moz-transition:all 0.3s ease-in;transition:all 0.3s ease-in}.wy-tray-container li.wy-tray-item-success{background:#27AE60}.wy-tray-container li.wy-tray-item-info{background:#dd4814}.wy-tray-container li.wy-tray-item-warning{background:#E67E22}.wy-tray-container li.wy-tray-item-danger{background:#E74C3C}.wy-tray-container li.on{opacity:1;height:56px}@media screen and (max-width: 768px){.wy-tray-container{bottom:auto;top:0;width:100%}.wy-tray-container li{width:100%}}button{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;cursor:pointer;line-height:normal;-webkit-appearance:button;*overflow:visible}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}button[disabled]{cursor:default}.btn{display:inline-block;border-radius:2px;line-height:normal;white-space:nowrap;text-align:center;cursor:pointer;font-size:100%;padding:6px 12px 8px 12px;color:#fff;border:1px solid rgba(0,0,0,0.1);background-color:#27AE60;text-decoration:none;font-weight:normal;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;box-shadow:0px 1px 2px -1px rgba(255,255,255,0.5) inset,0px -2px 0px 0px rgba(0,0,0,0.1) inset;outline-none:false;vertical-align:middle;*display:inline;zoom:1;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:all 0.1s linear;-moz-transition:all 0.1s linear;transition:all 0.1s linear}.btn-hover{background:#2e8ece;color:#fff}.btn:hover{background:#2cc36b;color:#fff}.btn:focus{background:#2cc36b;outline:0}.btn:active{box-shadow:0px -1px 0px 0px rgba(0,0,0,0.05) inset,0px 2px 0px 0px rgba(0,0,0,0.1) inset;padding:8px 12px 6px 12px}.btn:visited{color:#fff}.btn:disabled{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:0.4;cursor:not-allowed;box-shadow:none}.btn-disabled{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:0.4;cursor:not-allowed;box-shadow:none}.btn-disabled:hover,.btn-disabled:focus,.btn-disabled:active{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:0.4;cursor:not-allowed;box-shadow:none}.btn::-moz-focus-inner{padding:0;border:0}.btn-small{font-size:80%}.btn-info{background-color:#dd4814 !important}.btn-info:hover{background-color:#2e8ece !important}.btn-neutral{background-color:#f3f6f6 !important;color:#404040 !important}.btn-neutral:hover{background-color:#e5ebeb !important;color:#404040}.btn-neutral:visited{color:#404040 !important}.btn-success{background-color:#27AE60 !important}.btn-success:hover{background-color:#295 !important}.btn-danger{background-color:#E74C3C !important}.btn-danger:hover{background-color:#ea6153 !important}.btn-warning{background-color:#E67E22 !important}.btn-warning:hover{background-color:#e98b39 !important}.btn-invert{background-color:#222}.btn-invert:hover{background-color:#2f2f2f !important}.btn-link{background-color:transparent !important;color:#dd4814;box-shadow:none;border-color:transparent !important}.btn-link:hover{background-color:transparent !important;color:#409ad5 !important;box-shadow:none}.btn-link:active{background-color:transparent !important;color:#409ad5 !important;box-shadow:none}.btn-link:visited{color:#97310e}.wy-btn-group .btn,.wy-control .btn{vertical-align:middle}.wy-btn-group{margin-bottom:24px;*zoom:1}.wy-btn-group:before,.wy-btn-group:after{display:table;content:""}.wy-btn-group:after{clear:both}.wy-dropdown{position:relative;display:inline-block}.wy-dropdown-active .wy-dropdown-menu{display:block}.wy-dropdown-menu{position:absolute;left:0;display:none;float:left;top:100%;min-width:100%;background:#fcfcfc;z-index:100;border:solid 1px #cfd7dd;box-shadow:0 2px 2px 0 rgba(0,0,0,0.1);padding:12px}.wy-dropdown-menu>dd>a{display:block;clear:both;color:#404040;white-space:nowrap;font-size:90%;padding:0 12px;cursor:pointer}.wy-dropdown-menu>dd>a:hover{background:#dd4814;color:#fff}.wy-dropdown-menu>dd.divider{border-top:solid 1px #cfd7dd;margin:6px 0}.wy-dropdown-menu>dd.search{padding-bottom:12px}.wy-dropdown-menu>dd.search input[type="search"]{width:100%}.wy-dropdown-menu>dd.call-to-action{background:#e3e3e3;text-transform:uppercase;font-weight:500;font-size:80%}.wy-dropdown-menu>dd.call-to-action:hover{background:#e3e3e3}.wy-dropdown-menu>dd.call-to-action .btn{color:#fff}.wy-dropdown.wy-dropdown-up .wy-dropdown-menu{bottom:100%;top:auto;left:auto;right:0}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu{background:#fcfcfc;margin-top:2px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a{padding:6px 12px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a:hover{background:#dd4814;color:#fff}.wy-dropdown.wy-dropdown-left .wy-dropdown-menu{right:0;text-align:right}.wy-dropdown-arrow:before{content:" ";border-bottom:5px solid #f5f5f5;border-left:5px solid transparent;border-right:5px solid transparent;position:absolute;display:block;top:-4px;left:50%;margin-left:-3px}.wy-dropdown-arrow.wy-dropdown-arrow-left:before{left:11px}.wy-form-stacked select{display:block}.wy-form-aligned input,.wy-form-aligned textarea,.wy-form-aligned select,.wy-form-aligned .wy-help-inline,.wy-form-aligned label{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-form-aligned .wy-control-group>label{display:inline-block;vertical-align:middle;width:10em;margin:6px 12px 0 0;float:left}.wy-form-aligned .wy-control{float:left}.wy-form-aligned .wy-control label{display:block}.wy-form-aligned .wy-control select{margin-top:6px}fieldset{border:0;margin:0;padding:0}legend{display:block;width:100%;border:0;padding:0;white-space:normal;margin-bottom:24px;font-size:150%;*margin-left:-7px}label{display:block;margin:0 0 0.3125em 0;color:#333;font-size:90%}input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}.wy-control-group{margin-bottom:24px;*zoom:1;max-width:68em;margin-left:auto;margin-right:auto;*zoom:1}.wy-control-group:before,.wy-control-group:after{display:table;content:""}.wy-control-group:after{clear:both}.wy-control-group:before,.wy-control-group:after{display:table;content:""}.wy-control-group:after{clear:both}.wy-control-group.wy-control-group-required>label:after{content:" *";color:#E74C3C}.wy-control-group .wy-form-full,.wy-control-group .wy-form-halves,.wy-control-group .wy-form-thirds{padding-bottom:12px}.wy-control-group .wy-form-full select,.wy-control-group .wy-form-halves select,.wy-control-group .wy-form-thirds select{width:100%}.wy-control-group .wy-form-full input[type="text"],.wy-control-group .wy-form-full input[type="password"],.wy-control-group .wy-form-full input[type="email"],.wy-control-group .wy-form-full input[type="url"],.wy-control-group .wy-form-full input[type="date"],.wy-control-group .wy-form-full input[type="month"],.wy-control-group .wy-form-full input[type="time"],.wy-control-group .wy-form-full input[type="datetime"],.wy-control-group .wy-form-full input[type="datetime-local"],.wy-control-group .wy-form-full input[type="week"],.wy-control-group .wy-form-full input[type="number"],.wy-control-group .wy-form-full input[type="search"],.wy-control-group .wy-form-full input[type="tel"],.wy-control-group .wy-form-full input[type="color"],.wy-control-group .wy-form-halves input[type="text"],.wy-control-group .wy-form-halves input[type="password"],.wy-control-group .wy-form-halves input[type="email"],.wy-control-group .wy-form-halves input[type="url"],.wy-control-group .wy-form-halves input[type="date"],.wy-control-group .wy-form-halves input[type="month"],.wy-control-group .wy-form-halves input[type="time"],.wy-control-group .wy-form-halves input[type="datetime"],.wy-control-group .wy-form-halves input[type="datetime-local"],.wy-control-group .wy-form-halves input[type="week"],.wy-control-group .wy-form-halves input[type="number"],.wy-control-group .wy-form-halves input[type="search"],.wy-control-group .wy-form-halves input[type="tel"],.wy-control-group .wy-form-halves input[type="color"],.wy-control-group .wy-form-thirds input[type="text"],.wy-control-group .wy-form-thirds input[type="password"],.wy-control-group .wy-form-thirds input[type="email"],.wy-control-group .wy-form-thirds input[type="url"],.wy-control-group .wy-form-thirds input[type="date"],.wy-control-group .wy-form-thirds input[type="month"],.wy-control-group .wy-form-thirds input[type="time"],.wy-control-group .wy-form-thirds input[type="datetime"],.wy-control-group .wy-form-thirds input[type="datetime-local"],.wy-control-group .wy-form-thirds input[type="week"],.wy-control-group .wy-form-thirds input[type="number"],.wy-control-group .wy-form-thirds input[type="search"],.wy-control-group .wy-form-thirds input[type="tel"],.wy-control-group .wy-form-thirds input[type="color"]{width:100%}.wy-control-group .wy-form-full{float:left;display:block;margin-right:2.35765%;width:100%;margin-right:0}.wy-control-group .wy-form-full:last-child{margin-right:0}.wy-control-group .wy-form-halves{float:left;display:block;margin-right:2.35765%;width:48.82117%}.wy-control-group .wy-form-halves:last-child{margin-right:0}.wy-control-group .wy-form-halves:nth-of-type(2n){margin-right:0}.wy-control-group .wy-form-halves:nth-of-type(2n+1){clear:left}.wy-control-group .wy-form-thirds{float:left;display:block;margin-right:2.35765%;width:31.76157%}.wy-control-group .wy-form-thirds:last-child{margin-right:0}.wy-control-group .wy-form-thirds:nth-of-type(3n){margin-right:0}.wy-control-group .wy-form-thirds:nth-of-type(3n+1){clear:left}.wy-control-group.wy-control-group-no-input .wy-control{margin:6px 0 0 0;font-size:90%}.wy-control-no-input{display:inline-block;margin:6px 0 0 0;font-size:90%}.wy-control-group.fluid-input input[type="text"],.wy-control-group.fluid-input input[type="password"],.wy-control-group.fluid-input input[type="email"],.wy-control-group.fluid-input input[type="url"],.wy-control-group.fluid-input input[type="date"],.wy-control-group.fluid-input input[type="month"],.wy-control-group.fluid-input input[type="time"],.wy-control-group.fluid-input input[type="datetime"],.wy-control-group.fluid-input input[type="datetime-local"],.wy-control-group.fluid-input input[type="week"],.wy-control-group.fluid-input input[type="number"],.wy-control-group.fluid-input input[type="search"],.wy-control-group.fluid-input input[type="tel"],.wy-control-group.fluid-input input[type="color"]{width:100%}.wy-form-message-inline{display:inline-block;padding-left:0.3em;color:#666;vertical-align:middle;font-size:90%}.wy-form-message{display:block;color:#999;font-size:70%;margin-top:0.3125em;font-style:italic}input{line-height:normal}input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;*overflow:visible}input[type="text"],input[type="password"],input[type="email"],input[type="url"],input[type="date"],input[type="month"],input[type="time"],input[type="datetime"],input[type="datetime-local"],input[type="week"],input[type="number"],input[type="search"],input[type="tel"],input[type="color"]{-webkit-appearance:none;padding:6px;display:inline-block;border:1px solid #ccc;font-size:80%;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;box-shadow:inset 0 1px 3px #ddd;border-radius:0;-webkit-transition:border 0.3s linear;-moz-transition:border 0.3s linear;transition:border 0.3s linear}input[type="datetime-local"]{padding:0.34375em 0.625em}input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0;margin-right:0.3125em;*height:13px;*width:13px}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}input[type="text"]:focus,input[type="password"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus{outline:0;outline:thin dotted \9;border-color:#333}input.no-focus:focus{border-color:#ccc !important}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:1px auto #129FEA}input[type="text"][disabled],input[type="password"][disabled],input[type="email"][disabled],input[type="url"][disabled],input[type="date"][disabled],input[type="month"][disabled],input[type="time"][disabled],input[type="datetime"][disabled],input[type="datetime-local"][disabled],input[type="week"][disabled],input[type="number"][disabled],input[type="search"][disabled],input[type="tel"][disabled],input[type="color"][disabled]{cursor:not-allowed;background-color:#f3f6f6;color:#cad2d3}input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#E74C3C;border:1px solid #E74C3C}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#E74C3C}input[type="file"]:focus:invalid:focus,input[type="radio"]:focus:invalid:focus,input[type="checkbox"]:focus:invalid:focus{outline-color:#E74C3C}input.wy-input-large{padding:12px;font-size:100%}textarea{overflow:auto;vertical-align:top;width:100%;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif}select,textarea{padding:0.5em 0.625em;display:inline-block;border:1px solid #ccc;font-size:80%;box-shadow:inset 0 1px 3px #ddd;-webkit-transition:border 0.3s linear;-moz-transition:border 0.3s linear;transition:border 0.3s linear}select{border:1px solid #ccc;background-color:#fff}select[multiple]{height:auto}select:focus,textarea:focus{outline:0}select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#fff;color:#cad2d3;border-color:transparent}.wy-checkbox,.wy-radio{margin:6px 0;color:#404040;display:block}.wy-checkbox input,.wy-radio input{vertical-align:baseline}.wy-form-message-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-input-prefix,.wy-input-suffix{white-space:nowrap;padding:6px}.wy-input-prefix .wy-input-context,.wy-input-suffix .wy-input-context{line-height:27px;padding:0 8px;display:inline-block;font-size:80%;background-color:#f3f6f6;border:solid 1px #ccc;color:#999}.wy-input-suffix .wy-input-context{border-left:0}.wy-input-prefix .wy-input-context{border-right:0}.wy-control-group.wy-control-group-error .wy-form-message,.wy-control-group.wy-control-group-error>label{color:#E74C3C}.wy-control-group.wy-control-group-error input[type="text"],.wy-control-group.wy-control-group-error input[type="password"],.wy-control-group.wy-control-group-error input[type="email"],.wy-control-group.wy-control-group-error input[type="url"],.wy-control-group.wy-control-group-error input[type="date"],.wy-control-group.wy-control-group-error input[type="month"],.wy-control-group.wy-control-group-error input[type="time"],.wy-control-group.wy-control-group-error input[type="datetime"],.wy-control-group.wy-control-group-error input[type="datetime-local"],.wy-control-group.wy-control-group-error input[type="week"],.wy-control-group.wy-control-group-error input[type="number"],.wy-control-group.wy-control-group-error input[type="search"],.wy-control-group.wy-control-group-error input[type="tel"],.wy-control-group.wy-control-group-error input[type="color"]{border:solid 1px #E74C3C}.wy-control-group.wy-control-group-error textarea{border:solid 1px #E74C3C}.wy-inline-validate{white-space:nowrap}.wy-inline-validate .wy-input-context{padding:0.5em 0.625em;display:inline-block;font-size:80%}.wy-inline-validate.wy-inline-validate-success .wy-input-context{color:#27AE60}.wy-inline-validate.wy-inline-validate-danger .wy-input-context{color:#E74C3C}.wy-inline-validate.wy-inline-validate-warning .wy-input-context{color:#E67E22}.wy-inline-validate.wy-inline-validate-info .wy-input-context{color:#dd4814}.rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.mirror{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);-o-transform:scaleX(-1);transform:scaleX(-1)}.mirror.rotate-90{-webkit-transform:scaleX(-1) rotate(90deg);-moz-transform:scaleX(-1) rotate(90deg);-ms-transform:scaleX(-1) rotate(90deg);-o-transform:scaleX(-1) rotate(90deg);transform:scaleX(-1) rotate(90deg)}.mirror.rotate-180{-webkit-transform:scaleX(-1) rotate(180deg);-moz-transform:scaleX(-1) rotate(180deg);-ms-transform:scaleX(-1) rotate(180deg);-o-transform:scaleX(-1) rotate(180deg);transform:scaleX(-1) rotate(180deg)}.mirror.rotate-270{-webkit-transform:scaleX(-1) rotate(270deg);-moz-transform:scaleX(-1) rotate(270deg);-ms-transform:scaleX(-1) rotate(270deg);-o-transform:scaleX(-1) rotate(270deg);transform:scaleX(-1) rotate(270deg)}@media only screen and (max-width: 480px){.wy-form button[type="submit"]{margin:0.7em 0 0}.wy-form input[type="text"],.wy-form input[type="password"],.wy-form input[type="email"],.wy-form input[type="url"],.wy-form input[type="date"],.wy-form input[type="month"],.wy-form input[type="time"],.wy-form input[type="datetime"],.wy-form input[type="datetime-local"],.wy-form input[type="week"],.wy-form input[type="number"],.wy-form input[type="search"],.wy-form input[type="tel"],.wy-form input[type="color"]{margin-bottom:0.3em;display:block}.wy-form label{margin-bottom:0.3em;display:block}.wy-form input[type="password"],.wy-form input[type="email"],.wy-form input[type="url"],.wy-form input[type="date"],.wy-form input[type="month"],.wy-form input[type="time"],.wy-form input[type="datetime"],.wy-form input[type="datetime-local"],.wy-form input[type="week"],.wy-form input[type="number"],.wy-form input[type="search"],.wy-form input[type="tel"],.wy-form input[type="color"]{margin-bottom:0}.wy-form-aligned .wy-control-group label{margin-bottom:0.3em;text-align:left;display:block;width:100%}.wy-form-aligned .wy-control{margin:1.5em 0 0 0}.wy-form .wy-help-inline,.wy-form-message-inline,.wy-form-message{display:block;font-size:80%;padding:6px 0}}@media screen and (max-width: 768px){.tablet-hide{display:none}.wy-table-responsive table td,.wy-table-responsive table th{white-space:nowrap}}@media screen and (max-width: 480px){.mobile-hide{display:none}}.float-left{float:left}.float-right{float:right}.full-width{width:100%}.wy-table,.rst-content table.docutils,.rst-content table.field-list{border-collapse:collapse;border-spacing:0;empty-cells:show;margin-bottom:24px}.wy-table caption,.rst-content table.docutils caption,.rst-content table.field-list caption{color:#000;font:italic 85%/1 arial,sans-serif;padding:1em 0;text-align:center}.wy-table td,.rst-content table.docutils td,.rst-content table.field-list td,.wy-table th,.rst-content table.docutils th,.rst-content table.field-list th{font-size:90%;margin:0;overflow:visible;padding:8px 16px}.wy-table td:first-child,.rst-content table.docutils td:first-child,.rst-content table.field-list td:first-child,.wy-table th:first-child,.rst-content table.docutils th:first-child,.rst-content table.field-list th:first-child{border-left-width:0}.wy-table thead,.rst-content table.docutils thead,.rst-content table.field-list thead{color:#000;text-align:left;vertical-align:bottom;white-space:nowrap}.wy-table thead th,.rst-content table.docutils thead th,.rst-content table.field-list thead th{font-weight:bold;border-bottom:solid 2px #e1e4e5}.wy-table td,.rst-content table.docutils td,.rst-content table.field-list td{background-color:transparent;vertical-align:middle}.wy-table td p,.rst-content table.docutils td p,.rst-content table.field-list td p{line-height:18px}.wy-table td p:last-child,.rst-content table.docutils td p:last-child,.rst-content table.field-list td p:last-child{margin-bottom:0}.wy-table .wy-table-cell-min,.rst-content table.docutils .wy-table-cell-min,.rst-content table.field-list .wy-table-cell-min{width:1%;padding-right:0}.wy-table .wy-table-cell-min input[type=checkbox],.rst-content table.docutils .wy-table-cell-min input[type=checkbox],.rst-content table.field-list .wy-table-cell-min input[type=checkbox],.wy-table .wy-table-cell-min input[type=checkbox],.rst-content table.docutils .wy-table-cell-min input[type=checkbox],.rst-content table.field-list .wy-table-cell-min input[type=checkbox]{margin:0}.wy-table-secondary{color:gray;font-size:90%}.wy-table-tertiary{color:gray;font-size:80%}.wy-table-odd td,.wy-table-striped tr:nth-child(2n-1) td,.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td{background-color:#f3f6f6}.wy-table-backed{background-color:#f3f6f6}.wy-table-bordered-all,.rst-content table.docutils{border:1px solid #e1e4e5}.wy-table-bordered-all td,.rst-content table.docutils td{border-bottom:1px solid #e1e4e5;border-left:1px solid #e1e4e5}.wy-table-bordered-all tbody>tr:last-child td,.rst-content table.docutils tbody>tr:last-child td{border-bottom-width:0}.wy-table-bordered{border:1px solid #e1e4e5}.wy-table-bordered-rows td{border-bottom:1px solid #e1e4e5}.wy-table-bordered-rows tbody>tr:last-child td{border-bottom-width:0}.wy-table-horizontal tbody>tr:last-child td{border-bottom-width:0}.wy-table-horizontal td,.wy-table-horizontal th{border-width:0 0 1px 0;border-bottom:1px solid #e1e4e5}.wy-table-horizontal tbody>tr:last-child td{border-bottom-width:0}.wy-table-responsive{margin-bottom:24px;max-width:100%;overflow:auto}.wy-table-responsive table{margin-bottom:0 !important}a{color:#dd4814;text-decoration:none;cursor:pointer}a:hover{color:#97310e}a:visited{color:#97310e}html{height:100%;overflow-x:hidden}body{font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;font-weight:normal;color:#404040;min-height:100%;overflow-x:hidden;background:#edf0f2}.wy-text-left{text-align:left}.wy-text-center{text-align:center}.wy-text-right{text-align:right}.wy-text-large{font-size:120%}.wy-text-normal{font-size:100%}.wy-text-small,small{font-size:80%}.wy-text-strike{text-decoration:line-through}.wy-text-warning{color:#E67E22 !important}a.wy-text-warning:hover{color:#eb9950 !important}.wy-text-info{color:#dd4814 !important}a.wy-text-info:hover{color:#409ad5 !important}.wy-text-success{color:#27AE60 !important}a.wy-text-success:hover{color:#36d278 !important}.wy-text-danger{color:#E74C3C !important}a.wy-text-danger:hover{color:#ed7669 !important}.wy-text-neutral{color:#404040 !important}a.wy-text-neutral:hover{color:#595959 !important}h1,h2,h3,h4,h5,h6,legend{margin-top:0;font-weight:700;font-family:"Roboto Slab","ff-tisa-web-pro","Georgia",Arial,sans-serif}p{line-height:24px;margin:0;font-size:16px;margin-bottom:24px}h1{font-size:175%}h2{font-size:150%}h3{font-size:125%}h4{font-size:115%}h5{font-size:110%}h6{font-size:100%}hr{display:block;height:1px;border:0;border-top:1px solid #e1e4e5;margin:24px 0;padding:0}code,.rst-content tt{white-space:nowrap;max-width:100%;background:#fff;border:solid 1px #e1e4e5;font-size:75%;padding:0 5px;font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;color:#E74C3C;overflow-x:auto}code.code-large,.rst-content tt.code-large{font-size:90%}.wy-plain-list-disc,.rst-content .section ul,.rst-content .toctree-wrapper ul,article ul{list-style:disc;line-height:24px;margin-bottom:24px}.wy-plain-list-disc li,.rst-content .section ul li,.rst-content .toctree-wrapper ul li,article ul li{list-style:disc;margin-left:24px}.wy-plain-list-disc li p:last-child,.rst-content .section ul li p:last-child,.rst-content .toctree-wrapper ul li p:last-child,article ul li p:last-child{margin-bottom:0}.wy-plain-list-disc li ul,.rst-content .section ul li ul,.rst-content .toctree-wrapper ul li ul,article ul li ul{margin-bottom:0}.wy-plain-list-disc li li,.rst-content .section ul li li,.rst-content .toctree-wrapper ul li li,article ul li li{list-style:circle}.wy-plain-list-disc li li li,.rst-content .section ul li li li,.rst-content .toctree-wrapper ul li li li,article ul li li li{list-style:square}.wy-plain-list-disc li ol li,.rst-content .section ul li ol li,.rst-content .toctree-wrapper ul li ol li,article ul li ol li{list-style:decimal}.wy-plain-list-decimal,.rst-content .section ol,.rst-content ol.arabic,article ol{list-style:decimal;line-height:24px;margin-bottom:24px}.wy-plain-list-decimal li,.rst-content .section ol li,.rst-content ol.arabic li,article ol li{list-style:decimal;margin-left:24px}.wy-plain-list-decimal li p:last-child,.rst-content .section ol li p:last-child,.rst-content ol.arabic li p:last-child,article ol li p:last-child{margin-bottom:0}.wy-plain-list-decimal li ul,.rst-content .section ol li ul,.rst-content ol.arabic li ul,article ol li ul{margin-bottom:0}.wy-plain-list-decimal li ul li,.rst-content .section ol li ul li,.rst-content ol.arabic li ul li,article ol li ul li{list-style:disc}.codeblock-example{border:1px solid #e1e4e5;border-bottom:none;padding:24px;padding-top:48px;font-weight:500;background:#fff;position:relative}.codeblock-example:after{content:"Example";position:absolute;top:0px;left:0px;background:#97310e;color:#fff;padding:6px 12px}.codeblock-example.prettyprint-example-only{border:1px solid #e1e4e5;margin-bottom:24px}.codeblock,pre.literal-block,.rst-content .literal-block,.rst-content pre.literal-block,div[class^='highlight']{border:1px solid #e1e4e5;padding:0px;overflow-x:auto;background:#fff;margin:1px 0 24px 0}.codeblock div[class^='highlight'],pre.literal-block div[class^='highlight'],.rst-content .literal-block div[class^='highlight'],div[class^='highlight'] div[class^='highlight']{border:none;background:none;margin:0}div[class^='highlight'] td.code{width:100%}.linenodiv pre{border-right:solid 1px #e6e9ea;margin:0;padding:12px 12px;font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;font-size:12px;line-height:1.5;color:#d9d9d9}div[class^='highlight'] pre{white-space:pre;margin:0;padding:12px 12px;font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;font-size:12px;line-height:1.5;display:block;overflow:auto;color:#404040}@media print{.codeblock,pre.literal-block,.rst-content .literal-block,.rst-content pre.literal-block,div[class^='highlight'],div[class^='highlight'] pre{white-space:pre-wrap}}.hll{background-color:#ffc;margin:0 -12px;padding:0 12px;display:block}.c{color:#998;font-style:italic}.err{color:#a61717;background-color:#e3d2d2}.k{font-weight:bold}.o{font-weight:bold}.cm{color:#998;font-style:italic}.cp{color:#999;font-weight:bold}.c1{color:#998;font-style:italic}.cs{color:#999;font-weight:bold;font-style:italic}.gd{color:#000;background-color:#fdd}.gd .x{color:#000;background-color:#faa}.ge{font-style:italic}.gr{color:#a00}.gh{color:#999}.gi{color:#000;background-color:#dfd}.gi .x{color:#000;background-color:#afa}.go{color:#888}.gp{color:#555}.gs{font-weight:bold}.gu{color:purple;font-weight:bold}.gt{color:#a00}.kc{font-weight:bold}.kd{font-weight:bold}.kn{font-weight:bold}.kp{font-weight:bold}.kr{font-weight:bold}.kt{color:#458;font-weight:bold}.m{color:#099}.s{color:#d14}.n{color:#333}.na{color:teal}.nb{color:#0086b3}.nc{color:#458;font-weight:bold}.no{color:teal}.ni{color:purple}.ne{color:#900;font-weight:bold}.nf{color:#900;font-weight:bold}.nn{color:#555}.nt{color:navy}.nv{color:teal}.ow{font-weight:bold}.w{color:#bbb}.mf{color:#099}.mh{color:#099}.mi{color:#099}.mo{color:#099}.sb{color:#d14}.sc{color:#d14}.sd{color:#d14}.s2{color:#d14}.se{color:#d14}.sh{color:#d14}.si{color:#d14}.sx{color:#d14}.sr{color:#009926}.s1{color:#d14}.ss{color:#990073}.bp{color:#999}.vc{color:teal}.vg{color:teal}.vi{color:teal}.il{color:#099}.gc{color:#999;background-color:#EAF2F5}.wy-breadcrumbs li{display:inline-block}.wy-breadcrumbs li.wy-breadcrumbs-aside{float:right}.wy-breadcrumbs li a{display:inline-block;padding:5px}.wy-breadcrumbs li a:first-child{padding-left:0}.wy-breadcrumbs-extra{margin-bottom:0;color:#b3b3b3;font-size:80%;display:inline-block}@media screen and (max-width: 480px){.wy-breadcrumbs-extra{display:none}.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}@media print{.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}.wy-affix{position:fixed;top:1.618em}.wy-menu a:hover{text-decoration:none}.wy-menu-horiz{*zoom:1}.wy-menu-horiz:before,.wy-menu-horiz:after{display:table;content:""}.wy-menu-horiz:after{clear:both}.wy-menu-horiz ul,.wy-menu-horiz li{display:inline-block}.wy-menu-horiz li:hover{background:rgba(255,255,255,0.1)}.wy-menu-horiz li.divide-left{border-left:solid 1px #404040}.wy-menu-horiz li.divide-right{border-right:solid 1px #404040}.wy-menu-horiz a{height:32px;display:inline-block;line-height:32px;padding:0 16px}.wy-menu-vertical header{height:32px;display:inline-block;line-height:32px;padding:0 1.618em;display:block;font-weight:bold;text-transform:uppercase;font-size:80%;color:#dd4814;white-space:nowrap}.wy-menu-vertical ul{margin-bottom:0}.wy-menu-vertical li.divide-top{border-top:solid 1px #404040}.wy-menu-vertical li.divide-bottom{border-bottom:solid 1px #404040}.wy-menu-vertical li.current{background:#e3e3e3}.wy-menu-vertical li.current a{color:gray;border-right:solid 1px #c9c9c9;padding:0.4045em 2.427em}.wy-menu-vertical li.current a:hover{background:#d6d6d6}.wy-menu-vertical li.on a,.wy-menu-vertical li.current>a{color:#404040;padding:0.4045em 1.618em;font-weight:bold;position:relative;background:#fcfcfc;border:none;border-bottom:solid 1px #c9c9c9;border-top:solid 1px #c9c9c9;padding-left:1.618em -4px}.wy-menu-vertical li.on a:hover,.wy-menu-vertical li.current>a:hover{background:#fcfcfc}.wy-menu-vertical li.toctree-l2.current>a{background:#c9c9c9;padding:0.4045em 2.427em}.wy-menu-vertical li.current ul{display:block}.wy-menu-vertical li ul{margin-bottom:0;display:none}.wy-menu-vertical .local-toc li ul{display:block}.wy-menu-vertical li ul li a{margin-bottom:0;color:#b3b3b3;font-weight:normal}.wy-menu-vertical a{display:inline-block;line-height:18px;padding:0.4045em 1.618em;display:block;position:relative;font-size:90%;color:#b3b3b3}.wy-menu-vertical a:hover{background-color:#4e4a4a;cursor:pointer}.wy-menu-vertical a:active{background-color:#dd4814;cursor:pointer;color:#fff}.wy-side-nav-search{z-index:200;background-color:#dd4814;text-align:center;padding:0.809em;display:block;color:#fcfcfc;margin-bottom:0.809em}.wy-side-nav-search input[type=text]{width:100%;border-radius:50px;padding:6px 12px;border-color:#97310e}.wy-side-nav-search img{display:block;margin:auto auto 0.809em auto;height:45px;width:45px;background-color:#dd4814;padding:5px;border-radius:100%}.wy-side-nav-search>a,.wy-side-nav-search .wy-dropdown>a{color:#fcfcfc;font-size:100%;font-weight:bold;display:inline-block;padding:4px 6px;margin-bottom:0.809em}.wy-side-nav-search>a:hover,.wy-side-nav-search .wy-dropdown>a:hover{background:rgba(255,255,255,0.1)}.wy-nav .wy-menu-vertical header{color:#dd4814}.wy-nav .wy-menu-vertical a{color:#b3b3b3}.wy-nav .wy-menu-vertical a:hover{background-color:#dd4814;color:#fff}[data-menu-wrap]{-webkit-transition:all 0.2s ease-in;-moz-transition:all 0.2s ease-in;transition:all 0.2s ease-in;position:absolute;opacity:1;width:100%;opacity:0}[data-menu-wrap].move-center{left:0;right:auto;opacity:1}[data-menu-wrap].move-left{right:auto;left:-100%;opacity:0}[data-menu-wrap].move-right{right:-100%;left:auto;opacity:0}.wy-body-for-nav{background:left repeat-y #fcfcfc;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxOERBMTRGRDBFMUUxMUUzODUwMkJCOThDMEVFNURFMCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxOERBMTRGRTBFMUUxMUUzODUwMkJCOThDMEVFNURFMCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjE4REExNEZCMEUxRTExRTM4NTAyQkI5OEMwRUU1REUwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjE4REExNEZDMEUxRTExRTM4NTAyQkI5OEMwRUU1REUwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+EwrlwAAAAA5JREFUeNpiMDU0BAgwAAE2AJgB9BnaAAAAAElFTkSuQmCC);background-size:300px 1px}.wy-grid-for-nav{position:absolute;width:100%;height:100%}.wy-nav-side{position:absolute;top:0;left:0;width:300px;overflow:hidden;min-height:100%;background:#343131;z-index:200}.wy-nav-top{display:none;background:#dd4814;color:#fff;padding:0.4045em 0.809em;position:relative;line-height:50px;text-align:center;font-size:100%;*zoom:1}.wy-nav-top:before,.wy-nav-top:after{display:table;content:""}.wy-nav-top:after{clear:both}.wy-nav-top a{color:#fff;font-weight:bold}.wy-nav-top img{margin-right:12px;height:45px;width:45px;background-color:#dd4814;padding:5px;border-radius:100%}.wy-nav-top i{font-size:30px;float:left;cursor:pointer}.wy-nav-content-wrap{margin-left:300px;background:#fcfcfc;min-height:100%}.wy-nav-content{padding:1.618em 3.236em;height:100x;margin:auto}.wy-body-mask{position:fixed;width:100%;height:100%;background:rgba(0,0,0,0.2);display:none;z-index:499}.wy-body-mask.on{display:block}footer{color:#999}footer p{margin-bottom:12px}.rst-footer-buttons{*zoom:1}.rst-footer-buttons:before,.rst-footer-buttons:after{display:table;content:""}.rst-footer-buttons:after{clear:both}#search-results .search li{margin-bottom:24px;border-bottom:solid 1px #e1e4e5;padding-bottom:24px}#search-results .search li:first-child{border-top:solid 1px #e1e4e5;padding-top:24px}#search-results .search li a{font-size:120%;margin-bottom:12px;display:inline-block}#search-results .context{color:gray;font-size:90%}@media screen and (max-width: 768px){.wy-body-for-nav{background:#fcfcfc}.wy-nav-top{display:block}.wy-nav-side{left:-300px}.wy-nav-side.shift{width:85%;left:0}.wy-nav-content-wrap{margin-left:0!important}.wy-nav-content-wrap .wy-nav-content{padding:1.618em}.wy-nav-content-wrap.shift{position:fixed;min-width:100%;left:85%;top:0;height:100%;overflow:hidden}}@media screen and (min-width: 1400px){.wy-nav-content-wrap{background:rgba(0,0,0,0.05)}.wy-nav-content{margin:0;background:#fcfcfc}}@media print{.rst-versions,footer,.wy-nav-side{display:none}.wy-nav-content-wrap{margin-left:0}}nav.stickynav{position:fixed;top:0}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#dd4814;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa,.rst-versions .rst-current-version .rst-content .admonition-title,.rst-content .rst-versions .rst-current-version .admonition-title,.rst-versions .rst-current-version .rst-content h1 .headerlink,.rst-content h1 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h2 .headerlink,.rst-content h2 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h3 .headerlink,.rst-content h3 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h4 .headerlink,.rst-content h4 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h5 .headerlink,.rst-content h5 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h6 .headerlink,.rst-content h6 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content dl dt .headerlink,.rst-content dl dt .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .icon{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}img{width:100%;height:auto}}.rst-content img{max-width:100%;height:auto !important}.rst-content div.figure{margin-bottom:24px}.rst-content div.figure.align-center{text-align:center}.rst-content .section>img,.rst-content .section>a>img{margin-bottom:24px}.rst-content blockquote{margin-left:24px;line-height:24px;margin-bottom:24px}.rst-content .note .last,.rst-content .attention .last,.rst-content .caution .last,.rst-content .danger .last,.rst-content .error .last,.rst-content .hint .last,.rst-content .important .last,.rst-content .tip .last,.rst-content .warning .last,.rst-content .seealso .last,.rst-content .admonition-todo .last{margin-bottom:0}.rst-content .admonition-title:before{margin-right:4px}.rst-content .admonition table{border-color:rgba(0,0,0,0.1)}.rst-content .admonition table td,.rst-content .admonition table th{background:transparent !important;border-color:rgba(0,0,0,0.1) !important}.rst-content .section ol.loweralpha,.rst-content .section ol.loweralpha li{list-style:lower-alpha}.rst-content .section ol.upperalpha,.rst-content .section ol.upperalpha li{list-style:upper-alpha}.rst-content .section ol p,.rst-content .section ul p{margin-bottom:12px}.rst-content .line-block{margin-left:24px}.rst-content .topic-title{font-weight:bold;margin-bottom:12px}.rst-content .toc-backref{color:#404040}.rst-content .align-right{float:right;margin:0px 0px 24px 24px}.rst-content .align-left{float:left;margin:0px 24px 24px 0px}.rst-content .align-center{margin:auto;display:block}.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content dl dt .headerlink{display:none;visibility:hidden;font-size:14px}.rst-content h1 .headerlink:after,.rst-content h2 .headerlink:after,.rst-content h3 .headerlink:after,.rst-content h4 .headerlink:after,.rst-content h5 .headerlink:after,.rst-content h6 .headerlink:after,.rst-content dl dt .headerlink:after{visibility:visible;content:"";font-family:FontAwesome;display:inline-block}.rst-content h1:hover .headerlink,.rst-content h2:hover .headerlink,.rst-content h3:hover .headerlink,.rst-content h4:hover .headerlink,.rst-content h5:hover .headerlink,.rst-content h6:hover .headerlink,.rst-content dl dt:hover .headerlink{display:inline-block}.rst-content .sidebar{float:right;width:40%;display:block;margin:0 0 24px 24px;padding:24px;background:#f3f6f6;border:solid 1px #e1e4e5}.rst-content .sidebar p,.rst-content .sidebar ul,.rst-content .sidebar dl{font-size:90%}.rst-content .sidebar .last{margin-bottom:0}.rst-content .sidebar .sidebar-title{display:block;font-family:"Roboto Slab","ff-tisa-web-pro","Georgia",Arial,sans-serif;font-weight:bold;background:#e1e4e5;padding:6px 12px;margin:-24px;margin-bottom:24px;font-size:100%}.rst-content .highlighted{background:#F1C40F;display:inline-block;font-weight:bold;padding:0 6px}.rst-content .footnote-reference,.rst-content .citation-reference{vertical-align:super;font-size:90%}.rst-content table.docutils.citation,.rst-content table.docutils.footnote{background:none;border:none;color:#999}.rst-content table.docutils.citation td,.rst-content table.docutils.citation tr,.rst-content table.docutils.footnote td,.rst-content table.docutils.footnote tr{border:none;background-color:transparent !important;white-space:normal}.rst-content table.docutils.citation td.label,.rst-content table.docutils.footnote td.label{padding-left:0;padding-right:0;vertical-align:top}.rst-content table.field-list{border:none}.rst-content table.field-list td{border:none;padding-top:5px}.rst-content table.field-list td>strong{display:inline-block;margin-top:3px}.rst-content table.field-list .field-name{padding-right:10px;text-align:left;white-space:nowrap}.rst-content table.field-list .field-body{text-align:left;padding-left:0}.rst-content tt{color:#000}.rst-content tt big,.rst-content tt em{font-size:100% !important;line-height:normal}.rst-content tt .xref,a .rst-content tt{font-weight:bold}.rst-content a tt{color:#dd4814}.rst-content dl{margin-bottom:24px}.rst-content dl dt{font-weight:bold}.rst-content dl p,.rst-content dl table,.rst-content dl ul,.rst-content dl ol{margin-bottom:12px !important}.rst-content dl dd{margin:0 0 12px 24px}.rst-content dl:not(.docutils){margin-bottom:24px}.rst-content dl:not(.docutils) dt{display:inline-block;margin:6px 0;font-size:90%;line-height:normal;background:#dedede;color:#dd4814;border-top:solid 3px #8ba8af;padding:6px;position:relative}.rst-content dl:not(.docutils) dt:before{color:#8ba8af}.rst-content dl:not(.docutils) dt .headerlink{color:#404040;font-size:100% !important}.rst-content dl:not(.docutils) dl dt{margin-bottom:6px;border:none;border-left:solid 3px #ccc;background:#f0f0f0;color:gray}.rst-content dl:not(.docutils) dl dt .headerlink{color:#404040;font-size:100% !important}.rst-content dl:not(.docutils) dt:first-child{margin-top:0}.rst-content dl:not(.docutils) tt{font-weight:bold}.rst-content dl:not(.docutils) tt.descname,.rst-content dl:not(.docutils) tt.descclassname{background-color:transparent;border:none;padding:0;font-size:100% !important}.rst-content dl:not(.docutils) tt.descname{font-weight:bold}.rst-content dl:not(.docutils) .optional{display:inline-block;padding:0 4px;color:#000;font-weight:bold}.rst-content dl:not(.docutils) .property{display:inline-block;padding-right:8px}.rst-content .viewcode-link,.rst-content .viewcode-back{display:inline-block;color:#27AE60;font-size:80%;padding-left:24px}.rst-content .viewcode-back{display:block;float:right}.rst-content p.rubric{margin-bottom:12px;font-weight:bold}@media screen and (max-width: 480px){.rst-content .sidebar{width:100%}}span[id*='MathJax-Span']{color:#404040}.math{text-align:center} +/*# sourceMappingURL=theme.css.map */ diff --git a/user_guide/_static/doctools.js b/user_guide/_static/doctools.js new file mode 100644 index 00000000000..56549772348 --- /dev/null +++ b/user_guide/_static/doctools.js @@ -0,0 +1,287 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for all documentation. + * + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + +/** + * make the code below compatible with browsers without + * an installed firebug like debugger +if (!window.console || !console.firebug) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +} + */ + +/** + * small helper function to urldecode strings + */ +jQuery.urldecode = function(x) { + return decodeURIComponent(x).replace(/\+/g, ' '); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s == 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node) { + if (node.nodeType == 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { + var span = document.createElement("span"); + span.className = className; + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this); + }); + } + } + return this.each(function() { + highlight(this); + }); +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated == 'undefined') + return string; + return (typeof translated == 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated == 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + if (!body.length) { + body = $('body'); + } + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('#searchbox')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) == 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this == '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); \ No newline at end of file diff --git a/user_guide/_static/down-pressed.png b/user_guide/_static/down-pressed.png new file mode 100644 index 00000000000..5756c8cad88 Binary files /dev/null and b/user_guide/_static/down-pressed.png differ diff --git a/user_guide/_static/down.png b/user_guide/_static/down.png new file mode 100644 index 00000000000..1b3bdad2cef Binary files /dev/null and b/user_guide/_static/down.png differ diff --git a/user_guide/_static/file.png b/user_guide/_static/file.png new file mode 100644 index 00000000000..a858a410e4f Binary files /dev/null and b/user_guide/_static/file.png differ diff --git a/user_guide/_static/fonts/._FontAwesome.otf b/user_guide/_static/fonts/._FontAwesome.otf new file mode 100644 index 00000000000..ff4500d8302 Binary files /dev/null and b/user_guide/_static/fonts/._FontAwesome.otf differ diff --git a/user_guide/_static/fonts/._fontawesome-webfont.eot b/user_guide/_static/fonts/._fontawesome-webfont.eot new file mode 100644 index 00000000000..fb225c929e6 Binary files /dev/null and b/user_guide/_static/fonts/._fontawesome-webfont.eot differ diff --git a/user_guide/_static/fonts/._fontawesome-webfont.svg b/user_guide/_static/fonts/._fontawesome-webfont.svg new file mode 100644 index 00000000000..3c1a1fda453 Binary files /dev/null and b/user_guide/_static/fonts/._fontawesome-webfont.svg differ diff --git a/user_guide/_static/fonts/._fontawesome-webfont.ttf b/user_guide/_static/fonts/._fontawesome-webfont.ttf new file mode 100644 index 00000000000..2713c007425 Binary files /dev/null and b/user_guide/_static/fonts/._fontawesome-webfont.ttf differ diff --git a/user_guide/_static/fonts/._fontawesome-webfont.woff b/user_guide/_static/fonts/._fontawesome-webfont.woff new file mode 100644 index 00000000000..81b0b4249f9 Binary files /dev/null and b/user_guide/_static/fonts/._fontawesome-webfont.woff differ diff --git a/user_guide/_static/fonts/FontAwesome.otf b/user_guide/_static/fonts/FontAwesome.otf new file mode 100644 index 00000000000..8b0f54e47e1 Binary files /dev/null and b/user_guide/_static/fonts/FontAwesome.otf differ diff --git a/user_guide/_static/fonts/fontawesome-webfont.eot b/user_guide/_static/fonts/fontawesome-webfont.eot new file mode 100644 index 00000000000..7c79c6a6bc9 Binary files /dev/null and b/user_guide/_static/fonts/fontawesome-webfont.eot differ diff --git a/user_guide/_static/fonts/fontawesome-webfont.svg b/user_guide/_static/fonts/fontawesome-webfont.svg new file mode 100644 index 00000000000..45fdf338301 --- /dev/null +++ b/user_guide/_static/fonts/fontawesome-webfont.svg @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/_static/fonts/fontawesome-webfont.ttf b/user_guide/_static/fonts/fontawesome-webfont.ttf new file mode 100644 index 00000000000..e89738de5ea Binary files /dev/null and b/user_guide/_static/fonts/fontawesome-webfont.ttf differ diff --git a/user_guide/_static/fonts/fontawesome-webfont.woff b/user_guide/_static/fonts/fontawesome-webfont.woff new file mode 100644 index 00000000000..8c1748aab7a Binary files /dev/null and b/user_guide/_static/fonts/fontawesome-webfont.woff differ diff --git a/user_guide/_static/images/._ci-icon.ico b/user_guide/_static/images/._ci-icon.ico new file mode 100644 index 00000000000..8ccae8aeb86 Binary files /dev/null and b/user_guide/_static/images/._ci-icon.ico differ diff --git a/user_guide/_static/images/ci-icon.ico b/user_guide/_static/images/ci-icon.ico new file mode 100644 index 00000000000..c4246f8bf58 Binary files /dev/null and b/user_guide/_static/images/ci-icon.ico differ diff --git a/user_guide/_static/jquery-3.1.0.js b/user_guide/_static/jquery-3.1.0.js new file mode 100644 index 00000000000..f2fc2747874 --- /dev/null +++ b/user_guide/_static/jquery-3.1.0.js @@ -0,0 +1,10074 @@ +/*eslint-disable no-unused-vars*/ +/*! + * jQuery JavaScript Library v3.1.0 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2016-07-07T21:44Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var document = window.document; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + + + + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } +/* global Symbol */ +// Defining this global in .eslintrc would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.1.0", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android <=4.0 only + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? + + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return all the elements in a clean array + slice.call( this ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = jQuery.isArray( copy ) ) ) ) { + + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray( src ) ? src : []; + + } else { + clone = src && jQuery.isPlainObject( src ) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, + + isArray: Array.isArray, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); + }, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + DOMEval( code ); + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE <=9 - 11, Edge 12 - 13 + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // Support: Android <=4.0 only + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), +function( i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +} ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.0 + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2016-01-04 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + disabledAncestor = addCombinator( + function( elem ) { + return elem.disabled === true; + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + + // ID selector + if ( (m = match[1]) ) { + + // Document context + if ( nodeType === 9 ) { + if ( (elem = context.getElementById( m )) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && (elem = newContext.getElementById( m )) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( (m = match[3]) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !compilerCache[ selector + " " ] && + (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + + if ( nodeType !== 1 ) { + newContext = context; + newSelector = selector; + + // qSA looks outside Element context, which is not what we want + // Thanks to Andrew Dupont for this workaround technique + // Support: IE <=8 + // Exclude object elements + } else if ( context.nodeName.toLowerCase() !== "object" ) { + + // Capture the context ID, setting it first if necessary + if ( (nid = context.getAttribute( "id" )) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", (nid = expando) ); + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[i] = "#" + nid + " " + toSelector( groups[i] ); + } + newSelector = groups.join( "," ); + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement("fieldset"); + + try { + return !!fn( el ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + // Known :disabled false positives: + // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset) + // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Check form elements and option elements for explicit disabling + return "label" in elem && elem.disabled === disabled || + "form" in elem && elem.disabled === disabled || + + // Check non-disabled form elements for fieldset[disabled] ancestors + "form" in elem && elem.disabled === false && ( + // Support: IE6-11+ + // Ancestry is covered for us + elem.isDisabled === disabled || + + // Otherwise, assume any non-