diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 28d8e97..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.idea
-.idea/*
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index e7d178f..0000000
--- a/README.md
+++ /dev/null
@@ -1,83 +0,0 @@
-cPanel UAPI and API2 PHP class
-===
-[](https://github.com/N1ghteyes/cpanel-UAPI-php-class/releases)
-
-PHP class to provide an easy-to-use interface with cPanel's UAPI and API2.
-Uses PHP magic functions to provide a simple and powerful interface.
-
-v2.0 is not backwards compatible with v1.x, and will likley undergo a few more changes. See the [changelog](changelog.txt) for details.
-The class has been renamed to `cpanelAPI`.
-Some more testing is required.
-
-- Note while this class is not depricated, there is a new Agnostic API class available which will do everything this class does (except 2FA) and works with any RESTful / HTTP API - basically anything thats not SOAP. https://github.com/N1ghteyes/apicore
-
-## Usage
-
-If you choose to use this class, please Star it in Github. This gives me a better idea of the number of users and those effected when changes are made.
-
-See the example files, but typical usage takes the form of:
-
-### Instantiate the class
-```php
-$cPanel = new cpanelAPI('user', 'password', 'cpanel.example.com');
-```
-The API we want to use and the Module (also called Scope) are now protected and are set by `__get()`.
-
-The request layout looks like this: `$cPanel->api->method->Module->request(args[])`
-
-The `->method` part should be replaced with `->get` for GET requests and `->post` for POST requests, or omitted to default to GET requests.
-
-As an example, suppose we want to use the UAPI to call the [Mysql::get_server_information](https://documentation.cpanel.net/display/SDK/UAPI+Functions+-+Mysql%3A%3Aget_server_information) function:
-
-```php
-$response = $cPanel->uapi->Mysql->get_server_information();
-var_dump($response);
-```
-
-Now that we have set both the API *and* the Module, we can call other functions within this API and Module without specifying them again:
-
-```php
-$response = $cPanel->create_database(['name' => $cPanel->user.'_MyDatabase']);
-var_dump($response);
-```
-
-We can also change the Module scope without respecifying the API. Note that the Module call is case-sensitive.
-
-```php
-$response = $cPanel->SSL->list_certs();
-```
-
-#### File upload example
-
-```php
-$cPanel = new cpanelAPI($username, $password, $hostname);
-$cPanel->uapi->post->Fileman
- ->upload_files(['dir' => REMOTE_PATH_RELATIVE_TO_HOME,
- 'file-1' => new CURLFile(LOCAL_PATH_TO_FILE)
- ]);
-```
-
-### API2
-
-API2 is used in exactly the same way as the UAPI
-
-```php
-$cPanel = new cpanelAPI('user', 'password', 'cpanel.example.com');
-```
-
-For example, suppose we want to use the API2 to add a subdomain:
-
-```php
-$response = $cPanel->api2->SubDomain->addsubdomain(['rootdomain' => 'domain.com', 'domain' => 'sub']);
-var_dump($response);
-```
-
-### Two-Factor Authentication
-
-To use this class on a cPanel instance with two-factor authentication (2FA), you need to pass the secret into the class constructor:
-
-```php
-$cPanel = new cpanelAPI('user', 'password', 'cpanel.example.com', 'secret');
-```
-
-The secret can be found on the 2FA setup page. See [Two-Factor Authentication for cPanel – Configure two-factor authentication](https://documentation.cpanel.net/display/ALD/Two-Factor+Authentication+for+cPanel#Two-FactorAuthenticationforcPanel-Configure2FA) for details.
diff --git a/changelog.txt b/changelog.txt
deleted file mode 100644
index 657420a..0000000
--- a/changelog.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-Changelog
-=========
-
-Changelog for the Cpanel UAPI PHP Class
-
-version 2.0
-=============
-
-New:
- - Chaining support added
- - __get() added to support setting api and scope with an unbroken chain
- - made cURL request errors available
-
-Changes / Improvements:
- - Removed backwards compatability for older systems using php base path and safe mode
- - Removed now redundant additional classes for UAPI and API 2. These are now called by chaining ->api2 or ->uapi.
- - Added a setScope() function to set the scoupe outside of the chain.
- - cleaned up the code a little
-
-Warning:
- - This is not backwards compatable with past versions in a consistant way. Developers using v1.1 will need to change the class calls for the api version for example.
-
-version 1.1
-=============
-
-New:
-- Generalised the class to now support API2 as well as UAPI.
- $uapi = new cpanelUAPI();
- $api = new cpanelAPI2();
-
- The usage is the same, the main difference is in the internal processing, hence the separation.
-- Added the ability to get the last request URL for debugging / logging.
-
-Changes / Improvements:
-- Added error checking
-- Added more and better commenting
-- Renamed a few veriables.
-
-Bugs:
-- Added maxredirect, set default to 0 for issue #2
-
-version 1.0.2
-=============
-
-# Renamed cpaneluapi.class to cpaneluapi.class.php to avoid issues with IDEs
-# Added new examples file for the mysql module
-# Added php file comments and a gitignore file to ignore phpstorm project files.
-
-version 1.0.1
-=============
-
-# Fixed local reference to user and pass vars
-# some commenting
-# other fixes.
-
-Version 1.0
-===========
-
-# Initial commit
diff --git a/cpaneluapi.class.php b/cpaneluapi.class.php
deleted file mode 100644
index 505cfe7..0000000
--- a/cpaneluapi.class.php
+++ /dev/null
@@ -1,263 +0,0 @@
-user = $user;
- $this->pass = $pass;
- $this->server = $server;
- if ($secret) {
- $this->secret = $secret;
- $this->set2Fa();
- }
- }
-
- /**
- * Include the ot class so we can generate a valid token for 2FA
- */
- protected function set2Fa()
- {
- require 'otphp/lib/otphp.php';
- $totp = new \OTPHP\TOTP($this->secret);
- $this->token = $totp->now();
- }
-
- public function __get($name)
- {
- switch (strtolower($name)) {
- case 'get':
- $this->httpMethod = 'GET';
- break;
- case 'post':
- $this->httpMethod = 'POST';
- break;
- case 'api2':
- $this->setApi('api2');
- break;
- case 'uapi':
- $this->setApi('uapi');
- break;
- default:
- $this->scope = $name;
- }
- return $this;
- }
-
- /**
- * Set the api to use for connections.
- * @param $api
- * @return $this
- * @throws Exception
- */
- protected function setApi($api)
- {
- $this->api = $api;
- $this->setMethod();
- return $this;
- }
-
- /**
- * Function to set the method used to communicate with the chosen api.
- * @return $this
- * @throws Exception
- */
- protected function setMethod()
- {
- switch ($this->api) {
- case 'uapi':
- $this->method = '/execute/';
- break;
- case 'api2':
- $this->method = '/json-api/cpanel/';
- break;
- default:
- throw new Exception('$this->api is not set or is incorrectly set. The only available options are \'uapi\' or \'api2\'');
- }
- return $this;
- }
-
- /**
- * Magic __toSting() method, allows us to return the result as raw json
- * @return mixed
- */
- public function __toString()
- {
- return $this->json;
- }
-
- /**
- * Magic __call method, will translate all function calls to object to API requests
- * @param $name - name of the function
- * @param $arguments - an array of arguments
- * @return mixed
- * @throws Exception
- */
- public function __call($name, $arguments)
- {
- if (count($arguments) < 1 || !is_array($arguments[0]))
- $arguments[0] = [];
- $this->json = $this->APIcall($name, $arguments[0]);
- return json_decode($this->json);
- }
-
- /**
- * @param $name
- * @param $arguments
- * @return bool|mixed
- * @throws Exception
- */
- protected function APIcall($name, $arguments)
- {
- $this->auth = base64_encode($this->user . ":" . $this->pass);
- $this->type = $this->ssl == 1 ? "https://" : "http://";
- $this->requestUrl = $this->type . $this->server . ':' . $this->port . $this->method;
- switch ($this->api) {
- case 'uapi':
- $this->requestUrl .= ($this->scope != '' ? $this->scope . "/" : '') . $name . '?';
- break;
- case 'api2':
- if ($this->scope == '') {
- throw new Exception('Scope must be set.');
- }
- $this->requestUrl .= '?cpanel_jsonapi_user=' . $this->user . '&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=' . $this->scope . '&cpanel_jsonapi_func=' . $name . '&';
- break;
- default:
- throw new Exception('$this->api is not set or is incorrectly set. The only available options are \'uapi\' or \'api2\'');
- }
- if($this->httpMethod == 'GET') {
- $this->requestUrl .= http_build_query($arguments);
- }
- if($this->httpMethod == 'POST'){
- $this->postData = $arguments;
- }
-
- return $this->curl_request($this->requestUrl);
- }
-
- /**
- * @param $url
- * @return bool|mixed
- */
- protected function curl_request($url)
- {
- $httpHeaders = array("Authorization: Basic " . $this->auth);
- //If we have a token then send that with the request for 2FA.
- if ($this->token) {
- $httpHeaders[] = "X-CPANEL-OTP: " . $this->token;
- }
- $ch = curl_init();
- if($this->httpMethod == 'POST'){
- $httpHeaders[] = "Content-type: multipart/form-data";
- curl_setopt($ch,CURLOPT_POSTFIELDS, $this->postData);
- }
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders);
- curl_setopt($ch, CURLOPT_TIMEOUT, 100020);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
-
- $content = $this->curl_exec_follow($ch, $this->maxredirect);
- $this->eno = curl_errno($ch);
- $this->emes = curl_error($ch);
-
- curl_close($ch);
-
- return $content;
- }
-
- /**
- * @param $ch
- * @param null $maxredirect
- * @return bool|mixed
- */
- protected function curl_exec_follow($ch, &$maxredirect = null)
- {
- // we emulate a browser here since some websites detect
- // us as a bot and don't let us do our job
- $user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5)" .
- " Gecko/20041107 Firefox/1.0";
- curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
-
- $mr = $maxredirect === null ? 5 : intval($maxredirect);
-
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $mr > 0);
- curl_setopt($ch, CURLOPT_MAXREDIRS, $mr);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- return curl_exec($ch);
- }
-
- /**
- * Function to get the last request made
- * @return mixed
- */
- public function getLastRequest()
- {
- return $this->requestUrl;
- }
-
- /**
- * Function to return the error if there was one, or FALSE if not.
- * @return array|bool
- */
- public function getError()
- {
- if (!empty($this->eno)) {
- return ['no' => $this->eno, 'message' => $this->emes];
- }
- return FALSE;
- }
-}
diff --git a/examples/mysql.php b/examples/mysql.php
deleted file mode 100644
index 39a680c..0000000
--- a/examples/mysql.php
+++ /dev/null
@@ -1,40 +0,0 @@
- 'database').
-
-$uapi->uapi->Mysql->create_database(array('name' => $database)); //Create the database
-$uapi->uapi->Mysql->create_user(array('name' => $databaseuser, 'password' => $databasepass)); //create a user for the new database
-
-
-//After you create the user, you must use the set_privileges_on_database function call to grant access to the
-//user for a database.
-//add the user, set all privileges - add specific privileges by comma separation. e.g. 'DELETE,UPDATE,CREATE,ALTER'
-$uapi->uapi->Mysql->set_privileges_on_database(array('user' => $databaseuser, 'database' => $database, 'privileges' => 'ALL'));
diff --git a/images/bg_hr.png b/images/bg_hr.png
new file mode 100644
index 0000000..514aee5
Binary files /dev/null and b/images/bg_hr.png differ
diff --git a/images/blacktocat.png b/images/blacktocat.png
new file mode 100644
index 0000000..e160053
Binary files /dev/null and b/images/blacktocat.png differ
diff --git a/images/icon_download.png b/images/icon_download.png
new file mode 100644
index 0000000..5a793f1
Binary files /dev/null and b/images/icon_download.png differ
diff --git a/images/sprite_download.png b/images/sprite_download.png
new file mode 100644
index 0000000..f9f8de2
Binary files /dev/null and b/images/sprite_download.png differ
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..dc6affd
--- /dev/null
+++ b/index.html
@@ -0,0 +1,84 @@
+
+
+
+
PHP class to provide an easy to use interface with cpanels UAPI.
+
+
+Usage
+
+
See the example files, but typical useage takes the form of:
+
+
//load class
+$cpuapi = new cpanelUAPI('user', 'password', 'cpanel.example.com');
+
+//Set the scope to the module we want to use. in this case, Mysql
+$cpuapi->scope = 'Mysql';
+
+//call the function we want like this. Any arguments are passed into the function as an array, in the form of param => value.
+$response = $cpuapi->get_restrictions();
+print_r($response);
+
+
+
+Known Bugs
+
+
+
When running on systems with PHP safe mode turned on AND open_basedir is set to an empty string.
+
+
+
When the requested end point doesnt redirect, curl_exec_follow requests it twice. Once for the headers to check the HTTP Status and then once to fire the request. This is fine for getting data, however when the endpoint is used to generate something remotely, a specific use case would be an SSH key, 2 keys are generated and the SECOND one is returned.
+
+
+
Work Around
+
+
+
If not on a shared server, ether set open_basedir or turn safe mode off.
+If on a shared server, comment out the curl_exec on line 157, this will break any requests that get redirected, but should not effect most people.
+
+
+
+
+
+
+
+
+
+
diff --git a/javascripts/main.js b/javascripts/main.js
new file mode 100644
index 0000000..d8135d3
--- /dev/null
+++ b/javascripts/main.js
@@ -0,0 +1 @@
+console.log('This would be the main JS file.');
diff --git a/license.txt b/license.txt
deleted file mode 100644
index 9d9e58f..0000000
--- a/license.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Toby New
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/otphp/LICENCE b/otphp/LICENCE
deleted file mode 100644
index d14cbc2..0000000
--- a/otphp/LICENCE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2011 Le Lag
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
diff --git a/otphp/README.markdown b/otphp/README.markdown
deleted file mode 100644
index aef1306..0000000
--- a/otphp/README.markdown
+++ /dev/null
@@ -1,73 +0,0 @@
-# OTPHP - A PHP One Time Password Library
-
-A php library for generating one time passwords according to [ RFC 4226 ](http://tools.ietf.org/html/rfc4226) and the [ HOTP RFC ](http://tools.ietf.org/html/draft-mraihi-totp-timebased-00)
-
-This is compatible with Google Authenticator apps available for Android and iPhone, and now in use on GMail
-
-This is a port of the rotp ruby library available at https://github.com/mdp/rotp
-
-Note : This project has not been updated since it was created. If you need a PHP OTP library, you should check out the great fork by Spomky-Labs at https://github.com/Spomky-Labs/otphp which has been improved and is currently maintained.
-
-
-## Quick overview of using One Time Passwords on your phone
-
-* OTP's involve a shared secret, stored both on the phone and the server
-* OTP's can be generated on a phone without internet connectivity(AT&T mode)
-* OTP's should always be used as a second factor of authentication(if your phone is lost, you account is still secured with a password)
-* Google Authenticator allows you to store multiple OTP secrets and provision those using a QR Code(no more typing in the secret)
-
-## Installation
-
- clone this repository and include lib/otphp.php in your project.
-
-## Use
-
-### Time based OTP's
-
- $totp = new \OTPHP\TOTP("base32secret3232");
- $totp->now(); // => 492039
-
- // OTP verified for current time
- $totp->verify(492039); // => true
- //30s later
- $totp->verify(492039); // => false
-
-### Counter based OTP's
-
- $hotp = new \OTPHP\HOTP("base32secretkey3232");
- $hotp->at(0); // => 260182
- $hotp->at(1); // => 55283
- $hotp->at(1401); // => 316439
-
- // OTP verified with a counter
- $totp->verify(316439, 1401); // => true
- $totp->verify(316439, 1402); // => false
-
-### Google Authenticator Compatible
-
-The library works with the Google Authenticator iPhone and Android app, and also
-includes the ability to generate provisioning URI's for use with the QR Code scanner
-built into the app.
-
- $totp->provisioning_uri(); // => 'otpauth://totp/alice@google.com?secret=JBSWY3DPEHPK3PXP'
- $hotp->provisioning_uri(); // => 'otpauth://hotp/alice@google.com?secret=JBSWY3DPEHPK3PXP&counter=0'
-
-This can then be rendered as a QR Code which can then be scanned and added to the users
-list of OTP credentials.
-
-#### Working example
-
-Scan the following barcode with your phone, using Google Authenticator
-
-
-
-Now run the following and compare the output
-
- now();
-
-## Licence
-
-This software is release under MIT licence.
diff --git a/otphp/lib/hotp.php b/otphp/lib/hotp.php
deleted file mode 100644
index 7092fd9..0000000
--- a/otphp/lib/hotp.php
+++ /dev/null
@@ -1,74 +0,0 @@
-generateOTP($count);
- }
-
-
- /**
- * Verify if a password is valid for a specific counter value
- *
- * @param integer $otp the one-time password
- * @param integer $counter the counter value
- * @return bool true if the counter is valid, false otherwise
- */
- public function verify($otp, $counter) {
- return ($otp == $this->at($counter));
- }
-
- /**
- * Returns the uri for a specific secret for hotp method.
- * Can be encoded as a image for simple configuration in
- * Google Authenticator.
- *
- * @param string $name the name of the account / profile
- * @param integer $initial_count the initial counter
- * @return string the uri for the hmac secret
- */
- public function provisioning_uri($name, $initial_count) {
- return "otpauth://hotp/".urlencode($name)."?secret={$this->secret}&counter=$initial_count";
- }
- }
-
-}
diff --git a/otphp/lib/otp.php b/otphp/lib/otp.php
deleted file mode 100644
index 77bcfe9..0000000
--- a/otphp/lib/otp.php
+++ /dev/null
@@ -1,120 +0,0 @@
-digits = isset($opt['digits']) ? $opt['digits'] : 6;
- $this->digest = isset($opt['digest']) ? $opt['digest'] : 'sha1';
- $this->secret = $secret;
- }
-
- /**
- * Generate a one-time password
- *
- * @param integer $input : number used to seed the hmac hash function.
- * This number is usually a counter (HOTP) or calculated based on the current
- * timestamp (see TOTP class).
- * @return integer the one-time password
- */
- public function generateOTP($input) {
- $hash = hash_hmac($this->digest, $this->intToBytestring($input), $this->byteSecret());
- foreach(str_split($hash, 2) as $hex) { // stupid PHP has bin2hex but no hex2bin WTF
- $hmac[] = hexdec($hex);
- }
- $offset = $hmac[19] & 0xf;
- $code = ($hmac[$offset+0] & 0x7F) << 24 |
- ($hmac[$offset + 1] & 0xFF) << 16 |
- ($hmac[$offset + 2] & 0xFF) << 8 |
- ($hmac[$offset + 3] & 0xFF);
- return $code % pow(10, $this->digits);
- }
-
- /**
- * Returns the binary value of the base32 encoded secret
- * @access private
- * This method should be private but was left public for
- * phpunit tests to work.
- * @return binary secret key
- */
- public function byteSecret() {
- return \Base32::decode($this->secret);
- }
-
- /**
- * Turns an integer in a OATH bytestring
- * @param integer $int
- * @access private
- * @return string bytestring
- */
- public function intToBytestring($int) {
- $result = Array();
- while($int != 0) {
- $result[] = chr($int & 0xFF);
- $int >>= 8;
- }
- return str_pad(join(array_reverse($result)), 8, "\000", STR_PAD_LEFT);
- }
- }
-}
diff --git a/otphp/lib/otphp.php b/otphp/lib/otphp.php
deleted file mode 100644
index a6c6f8d..0000000
--- a/otphp/lib/otphp.php
+++ /dev/null
@@ -1,27 +0,0 @@
-interval = isset($opt['interval']) ? $opt['interval'] : 30;
- parent::__construct($s, $opt);
- }
-
- /**
- * Get the password for a specific timestamp value
- *
- * @param integer $timestamp the timestamp which is timecoded and
- * used to seed the hmac hash function.
- * @return integer the One Time Password
- */
- public function at($timestamp) {
- return $this->generateOTP($this->timecode($timestamp));
- }
-
- /**
- * Get the password for the current timestamp value
- *
- * @return integer the current One Time Password
- */
- public function now() {
- return $this->generateOTP($this->timecode(time()));
- }
-
- /**
- * Verify if a password is valid for a specific counter value
- *
- * @param integer $otp the one-time password
- * @param integer $timestamp the timestamp for the a given time, defaults to current time.
- * @return bool true if the counter is valid, false otherwise
- */
- public function verify($otp, $timestamp = null) {
- if($timestamp === null)
- $timestamp = time();
- return ($otp == $this->at($timestamp));
- }
-
- /**
- * Returns the uri for a specific secret for totp method.
- * Can be encoded as a image for simple configuration in
- * Google Authenticator.
- *
- * @param string $name the name of the account / profile
- * @return string the uri for the hmac secret
- */
- public function provisioning_uri($name) {
- return "otpauth://totp/".urlencode($name)."?secret={$this->secret}";
- }
-
- /**
- * Transform a timestamp in a counter based on specified internal
- *
- * @param integer $timestamp
- * @return integer the timecode
- */
- protected function timecode($timestamp) {
- return (int)( (((int)$timestamp * 1000) / ($this->interval * 1000)));
- }
- }
-
-}
diff --git a/otphp/tests/HOTPTest.php b/otphp/tests/HOTPTest.php
deleted file mode 100644
index 4e0635e..0000000
--- a/otphp/tests/HOTPTest.php
+++ /dev/null
@@ -1,45 +0,0 @@
-assertEquals(855783,$o->at(0));
- $this->assertEquals(549607,$o->at(500));
- $this->assertEquals(654666,$o->at(1500));
- }
-
- public function test_it_verify_the_code() {
- $o = new \OTPHP\HOTP('JDDK4U6G3BJLEZ7Y');
- $this->assertTrue($o->verify(855783, 0));
- $this->assertTrue($o->verify(549607, 500));
- $this->assertTrue($o->verify(654666, 1500));
- }
-
- public function test_it_returns_the_provisioning_uri() {
- $o = new \OTPHP\HOTP('JDDK4U6G3BJLEZ7Y');
- $this->assertEquals("otpauth://hotp/name?secret=JDDK4U6G3BJLEZ7Y&counter=0",
- $o->provisioning_uri('name', 0));
- }
-}
diff --git a/otphp/tests/OTPTest.php b/otphp/tests/OTPTest.php
deleted file mode 100644
index bf5337e..0000000
--- a/otphp/tests/OTPTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
-assertEquals("H\306\256S\306\330R\262g\370", $o->byteSecret());
- }
-
- public function test_it_turns_an_int_into_bytestring() {
- $o = new \OTPHP\OTP('JDDK4U6G3BJLEZ7Y');
- $this->assertEquals("\000\000\000\000\000\000\000\000", $o->intToBytestring(0));
- $this->assertEquals("\000\000\000\000\000\000\000\001", $o->intToBytestring(1));
- $this->assertEquals("\000\000\000\000\000\000\001\364", $o->intToBytestring(500));
- $this->assertEquals("\000\000\000\000\000\000\005\334", $o->intToBytestring(1500));
- }
-
- public function test_it_generate_otp() {
- $o = new \OTPHP\OTP('JDDK4U6G3BJLEZ7Y');
- $this->assertEquals(855783, $o->generateOTP(0));
- $this->assertEquals(549607, $o->generateOTP(500));
- $this->assertEquals(654666, $o->generateOTP(1500));
- }
-}
diff --git a/otphp/tests/TOTPTest.php b/otphp/tests/TOTPTest.php
deleted file mode 100644
index 34ad6d7..0000000
--- a/otphp/tests/TOTPTest.php
+++ /dev/null
@@ -1,53 +0,0 @@
-assertEquals(30,$o->interval);
- $b = new \OTPHP\TOTP('JDDK4U6G3BJLEZ7Y', Array('interval'=>60));
- $this->assertEquals(60,$b->interval);
- }
-
- public function test_it_gets_the_good_code_at_given_times() {
- $o = new \OTPHP\TOTP('JDDK4U6G3BJLEZ7Y');
- $this->assertEquals(855783,$o->at(0));
- $this->assertEquals(762124,$o->at(319690800));
- $this->assertEquals(139664,$o->at(1301012137));
- }
-
- public function test_it_verify_the_code() {
- $o = new \OTPHP\TOTP('JDDK4U6G3BJLEZ7Y');
- $this->assertTrue($o->verify(855783, 0));
- $this->assertTrue($o->verify(762124, 319690800));
- $this->assertTrue($o->verify(139664, 1301012137));
- }
-
- public function test_it_returns_the_provisioning_uri() {
- $o = new \OTPHP\TOTP('JDDK4U6G3BJLEZ7Y');
- $this->assertEquals("otpauth://totp/name?secret=JDDK4U6G3BJLEZ7Y",
- $o->provisioning_uri('name'));
- }
-}
diff --git a/otphp/tests/TestTest.php b/otphp/tests/TestTest.php
deleted file mode 100644
index 5f776f8..0000000
--- a/otphp/tests/TestTest.php
+++ /dev/null
@@ -1,29 +0,0 @@
-assertEquals(1,1);
- }
-}
diff --git a/otphp/vendor/base32.php b/otphp/vendor/base32.php
deleted file mode 100644
index 99c3f1b..0000000
--- a/otphp/vendor/base32.php
+++ /dev/null
@@ -1,83 +0,0 @@
-'0', 'B'=>'1', 'C'=>'2', 'D'=>'3', 'E'=>'4', 'F'=>'5', 'G'=>'6', 'H'=>'7',
- 'I'=>'8', 'J'=>'9', 'K'=>'10', 'L'=>'11', 'M'=>'12', 'N'=>'13', 'O'=>'14', 'P'=>'15',
- 'Q'=>'16', 'R'=>'17', 'S'=>'18', 'T'=>'19', 'U'=>'20', 'V'=>'21', 'W'=>'22', 'X'=>'23',
- 'Y'=>'24', 'Z'=>'25', '2'=>'26', '3'=>'27', '4'=>'28', '5'=>'29', '6'=>'30', '7'=>'31'
- );
-
- /**
- * Use padding false when encoding for urls
- *
- * @return base32 encoded string
- * @author Bryan Ruiz
- **/
- public static function encode($input, $padding = true) {
- if(empty($input)) return "";
- $input = str_split($input);
- $binaryString = "";
- for($i = 0; $i < count($input); $i++) {
- $binaryString .= str_pad(base_convert(ord($input[$i]), 10, 2), 8, '0', STR_PAD_LEFT);
- }
- $fiveBitBinaryArray = str_split($binaryString, 5);
- $base32 = "";
- $i=0;
- while($i < count($fiveBitBinaryArray)) {
- $base32 .= self::$map[base_convert(str_pad($fiveBitBinaryArray[$i], 5,'0'), 2, 10)];
- $i++;
- }
- if($padding && ($x = strlen($binaryString) % 40) != 0) {
- if($x == 8) $base32 .= str_repeat(self::$map[32], 6);
- else if($x == 16) $base32 .= str_repeat(self::$map[32], 4);
- else if($x == 24) $base32 .= str_repeat(self::$map[32], 3);
- else if($x == 32) $base32 .= self::$map[32];
- }
- return $base32;
- }
-
- public static function decode($input) {
- if(empty($input)) return;
- $paddingCharCount = substr_count($input, self::$map[32]);
- $allowedValues = array(6,4,3,1,0);
- if(!in_array($paddingCharCount, $allowedValues)) return false;
- for($i=0; $i<4; $i++){
- if($paddingCharCount == $allowedValues[$i] &&
- substr($input, -($allowedValues[$i])) != str_repeat(self::$map[32], $allowedValues[$i])) return false;
- }
- $input = str_replace('=','', $input);
- $input = str_split($input);
- $binaryString = "";
- for($i=0; $i < count($input); $i = $i+8) {
- $x = "";
- if(!in_array($input[$i], self::$map)) return false;
- for($j=0; $j < 8; $j++) {
- $x .= str_pad(base_convert(@self::$flippedMap[@$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
- }
- $eightBits = str_split($x, 8);
- for($z = 0; $z < count($eightBits); $z++) {
- $binaryString .= ( ($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48 ) ? $y:"";
- }
- }
- return $binaryString;
- }
-}
-
diff --git a/otphp/vendor/libs.php b/otphp/vendor/libs.php
deleted file mode 100644
index 742c7b9..0000000
--- a/otphp/vendor/libs.php
+++ /dev/null
@@ -1,26 +0,0 @@
-scope = 'Mysql';\r\n\r\n//call the function we want like this. Any arguments are passed into the function as an array, in the form of param => value.\r\n$response = $cpuapi->get_restrictions(); \r\nprint_r($response);\r\n```\r\n\r\n##Known Bugs\r\n\r\n- When running on systems with PHP safe mode turned on AND open_basedir is set to an empty string.\r\n\r\nWhen the requested end point doesnt redirect, curl_exec_follow requests it twice. Once for the headers to check the HTTP Status and then once to fire the request. This is fine for getting data, however when the endpoint is used to generate something remotely, a specific use case would be an SSH key, 2 keys are generated and the SECOND one is returned.\r\n\r\n- Work Around\r\n\r\nIf not on a shared server, ether set open_basedir or turn safe mode off.\r\nIf on a shared server, comment out the curl_exec on line 157, this will break any requests that get redirected, but should not effect most people.","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
\ No newline at end of file
diff --git a/stylesheets/pygment_trac.css b/stylesheets/pygment_trac.css
new file mode 100644
index 0000000..e65cedf
--- /dev/null
+++ b/stylesheets/pygment_trac.css
@@ -0,0 +1,70 @@
+.highlight .hll { background-color: #ffffcc }
+.highlight { background: #f0f3f3; }
+.highlight .c { color: #0099FF; font-style: italic } /* Comment */
+.highlight .err { color: #AA0000; background-color: #FFAAAA } /* Error */
+.highlight .k { color: #006699; font-weight: bold } /* Keyword */
+.highlight .o { color: #555555 } /* Operator */
+.highlight .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #009999 } /* Comment.Preproc */
+.highlight .c1 { color: #0099FF; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */
+.highlight .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #FF0000 } /* Generic.Error */
+.highlight .gh { color: #003300; font-weight: bold } /* Generic.Heading */
+.highlight .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
+.highlight .go { color: #AAAAAA } /* Generic.Output */
+.highlight .gp { color: #000099; font-weight: bold } /* Generic.Prompt */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #003300; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #99CC66 } /* Generic.Traceback */
+.highlight .kc { color: #006699; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #006699; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #006699; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #006699 } /* Keyword.Pseudo */
+.highlight .kr { color: #006699; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #007788; font-weight: bold } /* Keyword.Type */
+.highlight .m { color: #FF6600 } /* Literal.Number */
+.highlight .s { color: #CC3300 } /* Literal.String */
+.highlight .na { color: #330099 } /* Name.Attribute */
+.highlight .nb { color: #336666 } /* Name.Builtin */
+.highlight .nc { color: #00AA88; font-weight: bold } /* Name.Class */
+.highlight .no { color: #336600 } /* Name.Constant */
+.highlight .nd { color: #9999FF } /* Name.Decorator */
+.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
+.highlight .ne { color: #CC0000; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #CC00FF } /* Name.Function */
+.highlight .nl { color: #9999FF } /* Name.Label */
+.highlight .nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */
+.highlight .nt { color: #330099; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #003333 } /* Name.Variable */
+.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.highlight .mf { color: #FF6600 } /* Literal.Number.Float */
+.highlight .mh { color: #FF6600 } /* Literal.Number.Hex */
+.highlight .mi { color: #FF6600 } /* Literal.Number.Integer */
+.highlight .mo { color: #FF6600 } /* Literal.Number.Oct */
+.highlight .sb { color: #CC3300 } /* Literal.String.Backtick */
+.highlight .sc { color: #CC3300 } /* Literal.String.Char */
+.highlight .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #CC3300 } /* Literal.String.Double */
+.highlight .se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */
+.highlight .sh { color: #CC3300 } /* Literal.String.Heredoc */
+.highlight .si { color: #AA0000 } /* Literal.String.Interpol */
+.highlight .sx { color: #CC3300 } /* Literal.String.Other */
+.highlight .sr { color: #33AAAA } /* Literal.String.Regex */
+.highlight .s1 { color: #CC3300 } /* Literal.String.Single */
+.highlight .ss { color: #FFCC33 } /* Literal.String.Symbol */
+.highlight .bp { color: #336666 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #003333 } /* Name.Variable.Class */
+.highlight .vg { color: #003333 } /* Name.Variable.Global */
+.highlight .vi { color: #003333 } /* Name.Variable.Instance */
+.highlight .il { color: #FF6600 } /* Literal.Number.Integer.Long */
+
+.type-csharp .highlight .k { color: #0000FF }
+.type-csharp .highlight .kt { color: #0000FF }
+.type-csharp .highlight .nf { color: #000000; font-weight: normal }
+.type-csharp .highlight .nc { color: #2B91AF }
+.type-csharp .highlight .nn { color: #000000 }
+.type-csharp .highlight .s { color: #A31515 }
+.type-csharp .highlight .sc { color: #A31515 }
diff --git a/stylesheets/stylesheet.css b/stylesheets/stylesheet.css
new file mode 100644
index 0000000..619d19d
--- /dev/null
+++ b/stylesheets/stylesheet.css
@@ -0,0 +1,425 @@
+/*******************************************************************************
+Slate Theme for GitHub Pages
+by Jason Costello, @jsncostello
+*******************************************************************************/
+
+@import url(pygment_trac.css);
+
+/*******************************************************************************
+MeyerWeb Reset
+*******************************************************************************/
+
+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: inherit;
+ vertical-align: baseline;
+}
+
+/* HTML5 display-role reset for older browsers */
+article, aside, details, figcaption, figure,
+footer, header, hgroup, menu, nav, section {
+ display: block;
+}
+
+ol, ul {
+ list-style: none;
+}
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+/*******************************************************************************
+Theme Styles
+*******************************************************************************/
+
+body {
+ box-sizing: border-box;
+ color:#373737;
+ background: #212121;
+ font-size: 16px;
+ font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
+ line-height: 1.5;
+ -webkit-font-smoothing: antialiased;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ margin: 10px 0;
+ font-weight: 700;
+ color:#222222;
+ font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif;
+ letter-spacing: -1px;
+}
+
+h1 {
+ font-size: 36px;
+ font-weight: 700;
+}
+
+h2 {
+ padding-bottom: 10px;
+ font-size: 32px;
+ background: url('../images/bg_hr.png') repeat-x bottom;
+}
+
+h3 {
+ font-size: 24px;
+}
+
+h4 {
+ font-size: 21px;
+}
+
+h5 {
+ font-size: 18px;
+}
+
+h6 {
+ font-size: 16px;
+}
+
+p {
+ margin: 10px 0 15px 0;
+}
+
+footer p {
+ color: #f2f2f2;
+}
+
+a {
+ text-decoration: none;
+ color: #007edf;
+ text-shadow: none;
+
+ transition: color 0.5s ease;
+ transition: text-shadow 0.5s ease;
+ -webkit-transition: color 0.5s ease;
+ -webkit-transition: text-shadow 0.5s ease;
+ -moz-transition: color 0.5s ease;
+ -moz-transition: text-shadow 0.5s ease;
+ -o-transition: color 0.5s ease;
+ -o-transition: text-shadow 0.5s ease;
+ -ms-transition: color 0.5s ease;
+ -ms-transition: text-shadow 0.5s ease;
+}
+
+a:hover, a:focus {text-decoration: underline;}
+
+footer a {
+ color: #F2F2F2;
+ text-decoration: underline;
+}
+
+em {
+ font-style: italic;
+}
+
+strong {
+ font-weight: bold;
+}
+
+img {
+ position: relative;
+ margin: 0 auto;
+ max-width: 739px;
+ padding: 5px;
+ margin: 10px 0 10px 0;
+ border: 1px solid #ebebeb;
+
+ box-shadow: 0 0 5px #ebebeb;
+ -webkit-box-shadow: 0 0 5px #ebebeb;
+ -moz-box-shadow: 0 0 5px #ebebeb;
+ -o-box-shadow: 0 0 5px #ebebeb;
+ -ms-box-shadow: 0 0 5px #ebebeb;
+}
+
+p img {
+ display: inline;
+ margin: 0;
+ padding: 0;
+ vertical-align: middle;
+ text-align: center;
+ border: none;
+}
+
+pre, code {
+ width: 100%;
+ color: #222;
+ background-color: #fff;
+
+ font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
+ font-size: 14px;
+
+ border-radius: 2px;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+}
+
+pre {
+ width: 100%;
+ padding: 10px;
+ box-shadow: 0 0 10px rgba(0,0,0,.1);
+ overflow: auto;
+}
+
+code {
+ padding: 3px;
+ margin: 0 3px;
+ box-shadow: 0 0 10px rgba(0,0,0,.1);
+}
+
+pre code {
+ display: block;
+ box-shadow: none;
+}
+
+blockquote {
+ color: #666;
+ margin-bottom: 20px;
+ padding: 0 0 0 20px;
+ border-left: 3px solid #bbb;
+}
+
+
+ul, ol, dl {
+ margin-bottom: 15px
+}
+
+ul {
+ list-style-position: inside;
+ list-style: disc;
+ padding-left: 20px;
+}
+
+ol {
+ list-style-position: inside;
+ list-style: decimal;
+ padding-left: 20px;
+}
+
+dl dt {
+ font-weight: bold;
+}
+
+dl dd {
+ padding-left: 20px;
+ font-style: italic;
+}
+
+dl p {
+ padding-left: 20px;
+ font-style: italic;
+}
+
+hr {
+ height: 1px;
+ margin-bottom: 5px;
+ border: none;
+ background: url('../images/bg_hr.png') repeat-x center;
+}
+
+table {
+ border: 1px solid #373737;
+ margin-bottom: 20px;
+ text-align: left;
+ }
+
+th {
+ font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ padding: 10px;
+ background: #373737;
+ color: #fff;
+ }
+
+td {
+ padding: 10px;
+ border: 1px solid #373737;
+ }
+
+form {
+ background: #f2f2f2;
+ padding: 20px;
+}
+
+/*******************************************************************************
+Full-Width Styles
+*******************************************************************************/
+
+.outer {
+ width: 100%;
+}
+
+.inner {
+ position: relative;
+ max-width: 640px;
+ padding: 20px 10px;
+ margin: 0 auto;
+}
+
+#forkme_banner {
+ display: block;
+ position: absolute;
+ top:0;
+ right: 10px;
+ z-index: 10;
+ padding: 10px 50px 10px 10px;
+ color: #fff;
+ background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%;
+ font-weight: 700;
+ box-shadow: 0 0 10px rgba(0,0,0,.5);
+ border-bottom-left-radius: 2px;
+ border-bottom-right-radius: 2px;
+}
+
+#header_wrap {
+ background: #212121;
+ background: -moz-linear-gradient(top, #373737, #212121);
+ background: -webkit-linear-gradient(top, #373737, #212121);
+ background: -ms-linear-gradient(top, #373737, #212121);
+ background: -o-linear-gradient(top, #373737, #212121);
+ background: linear-gradient(top, #373737, #212121);
+}
+
+#header_wrap .inner {
+ padding: 50px 10px 30px 10px;
+}
+
+#project_title {
+ margin: 0;
+ color: #fff;
+ font-size: 42px;
+ font-weight: 700;
+ text-shadow: #111 0px 0px 10px;
+}
+
+#project_tagline {
+ color: #fff;
+ font-size: 24px;
+ font-weight: 300;
+ background: none;
+ text-shadow: #111 0px 0px 10px;
+}
+
+#downloads {
+ position: absolute;
+ width: 210px;
+ z-index: 10;
+ bottom: -40px;
+ right: 0;
+ height: 70px;
+ background: url('../images/icon_download.png') no-repeat 0% 90%;
+}
+
+.zip_download_link {
+ display: block;
+ float: right;
+ width: 90px;
+ height:70px;
+ text-indent: -5000px;
+ overflow: hidden;
+ background: url(../images/sprite_download.png) no-repeat bottom left;
+}
+
+.tar_download_link {
+ display: block;
+ float: right;
+ width: 90px;
+ height:70px;
+ text-indent: -5000px;
+ overflow: hidden;
+ background: url(../images/sprite_download.png) no-repeat bottom right;
+ margin-left: 10px;
+}
+
+.zip_download_link:hover {
+ background: url(../images/sprite_download.png) no-repeat top left;
+}
+
+.tar_download_link:hover {
+ background: url(../images/sprite_download.png) no-repeat top right;
+}
+
+#main_content_wrap {
+ background: #f2f2f2;
+ border-top: 1px solid #111;
+ border-bottom: 1px solid #111;
+}
+
+#main_content {
+ padding-top: 40px;
+}
+
+#footer_wrap {
+ background: #212121;
+}
+
+
+
+/*******************************************************************************
+Small Device Styles
+*******************************************************************************/
+
+@media screen and (max-width: 480px) {
+ body {
+ font-size:14px;
+ }
+
+ #downloads {
+ display: none;
+ }
+
+ .inner {
+ min-width: 320px;
+ max-width: 480px;
+ }
+
+ #project_title {
+ font-size: 32px;
+ }
+
+ h1 {
+ font-size: 28px;
+ }
+
+ h2 {
+ font-size: 24px;
+ }
+
+ h3 {
+ font-size: 21px;
+ }
+
+ h4 {
+ font-size: 18px;
+ }
+
+ h5 {
+ font-size: 14px;
+ }
+
+ h6 {
+ font-size: 12px;
+ }
+
+ code, pre {
+ min-width: 320px;
+ max-width: 480px;
+ font-size: 11px;
+ }
+
+}