diff --git a/web/application/models/Histories.php b/web/application/models/Histories.php deleted file mode 100644 index db54d4f..0000000 --- a/web/application/models/Histories.php +++ /dev/null @@ -1,24 +0,0 @@ -result == null) { - return ""; - } elseif ($this->result == 0) { - return "success"; - } else { - return "danger"; - } - } -} \ No newline at end of file diff --git a/web/application/models/Jobs.php b/web/application/models/Jobs.php deleted file mode 100644 index 84ef567..0000000 --- a/web/application/models/Jobs.php +++ /dev/null @@ -1,52 +0,0 @@ -runType) { - case "1": - return "Ran by Kritbit"; - break; - case "2": - return "External Source"; - break; - } - return ""; - } - - public function getLastRun() { - if ($this->last_run == "") { - return "Never"; - } else { - return $this->last_run; - } - - } - - public function getTRClass() { - if ($this->last_run == "" || $this->last_result == null) { - return ""; - } elseif ($this->last_result == 0) { - return "success"; - } else { - return "danger"; - } - } -} \ No newline at end of file diff --git a/web/application/models/Sessions.php b/web/application/models/Sessions.php deleted file mode 100644 index cfdc3f9..0000000 --- a/web/application/models/Sessions.php +++ /dev/null @@ -1,10 +0,0 @@ -result == null) { + return ""; + } elseif ($this->result == 0) { + return "success"; + } else { + return "danger"; + } + } +} \ No newline at end of file diff --git a/web/application/models/jobs.php b/web/application/models/jobs.php new file mode 100644 index 0000000..84ef567 --- /dev/null +++ b/web/application/models/jobs.php @@ -0,0 +1,52 @@ +runType) { + case "1": + return "Ran by Kritbit"; + break; + case "2": + return "External Source"; + break; + } + return ""; + } + + public function getLastRun() { + if ($this->last_run == "") { + return "Never"; + } else { + return $this->last_run; + } + + } + + public function getTRClass() { + if ($this->last_run == "" || $this->last_result == null) { + return ""; + } elseif ($this->last_result == 0) { + return "success"; + } else { + return "danger"; + } + } +} \ No newline at end of file diff --git a/web/application/models/sessions.php b/web/application/models/sessions.php new file mode 100644 index 0000000..cfdc3f9 --- /dev/null +++ b/web/application/models/sessions.php @@ -0,0 +1,10 @@ +from = $from; + $this->to = $to; + $this->subject = $subject; + $this->msg = $msg; + $this->user = $user; + $this->password = $password; + $this->port = $port; + $this->server = $server; + } + + public function send($html=false) + { + $err = null; + $errstr = ""; + $this->smtpserverconn = fsockopen($this->server, $this->port, $err, $errstr, 100); + $response = fgets($this->smtpserverconn, 515); + if ($response === false) + { + throw new Exception("Could not connect to SMTP server!"); + } + + if ($this->user != null && $this->password != null) + { + $this->sendCommand("AUTH LOGIN"); + $this->sendCommand(base64_encode($this->user)); + $this->sendCommand(base64_encode($this->password)); + } + + $this->sendCommand("HELO " . $_SERVER["SERVER_NAME"]); + $this->sendCommand("MAIL FROM: " . $this->from); + $this->sendCommand("RCPT TO: " . $this->to); + $this->sendCommand("DATA"); + + if ($html) + { + $this->sendCommand("MIME-Version: 1.0", false); + $this->sendCommand("Content-type: text/html; charset=iso-8859-1", false); + } + + $this->sendCommand("From: " . $this->from, false); + $this->sendCommand("To: " . $this->to, false); + $this->sendCommand("Subject: " . $this->subject, false); + + + $this->sendCommand($this->msg, false); + + $this->sendCommand("", false); + $this->sendCommand(".", false); + $this->sendCommand("QUIT"); + + } + + private function sendCommand($command, $return = true) + { + fputs($this->smtpserverconn, $command . "\r\n"); + if ($return) + return fgets($this->smtpserverconn, 515); + else + return null; + } +} \ No newline at end of file diff --git a/web/system/engine/smtp.php b/web/system/engine/smtp.php deleted file mode 100644 index 2f554f1..0000000 --- a/web/system/engine/smtp.php +++ /dev/null @@ -1,82 +0,0 @@ -from = $from; - $this->to = $to; - $this->subject = $subject; - $this->msg = $msg; - $this->user = $user; - $this->password = $password; - $this->port = $port; - $this->server = $server; - } - - public function send($html=false) - { - $err = null; - $errstr = ""; - $this->smtpserverconn = fsockopen($this->server, $this->port, $err, $errstr, 100); - $response = fgets($this->smtpserverconn, 515); - if ($response === false) - { - throw new Exception("Could not connect to SMTP server!"); - } - - if ($this->user != null && $this->password != null) - { - $this->sendCommand("AUTH LOGIN"); - $this->sendCommand(base64_encode($this->user)); - $this->sendCommand(base64_encode($this->password)); - } - - $this->sendCommand("HELO " . $_SERVER["SERVER_NAME"]); - $this->sendCommand("MAIL FROM: " . $this->from); - $this->sendCommand("RCPT TO: " . $this->to); - $this->sendCommand("DATA"); - - if ($html) - { - $this->sendCommand("MIME-Version: 1.0", false); - $this->sendCommand("Content-type: text/html; charset=iso-8859-1", false); - } - - $this->sendCommand("From: " . $this->from, false); - $this->sendCommand("To: " . $this->to, false); - $this->sendCommand("Subject: " . $this->subject, false); - - - $this->sendCommand($this->msg, false); - - $this->sendCommand("", false); - $this->sendCommand(".", false); - $this->sendCommand("QUIT"); - - } - - private function sendCommand($command, $return = true) - { - fputs($this->smtpserverconn, $command . "\r\n"); - if ($return) - return fgets($this->smtpserverconn, 515); - else - return null; - } -} \ No newline at end of file diff --git a/web/system/vendor/phpoauthlib2/OAuth.php b/web/system/vendor/phpoauthlib2/OAuth.php deleted file mode 100644 index 8ffe1db..0000000 --- a/web/system/vendor/phpoauthlib2/OAuth.php +++ /dev/null @@ -1,26 +0,0 @@ -oauthProvider = $provider; - $this->request = $request; - } - - public function check() { - if (isset($this->request["code"]) && !empty($this->request["code"])) { - $this->oauthProvider->getProfile(); - return true; - } else { - return $this->oauthProvider->getLoginUrl(); - } - } - - public function getProfile() { - return $this->oauthProvider->getProfile(); - } -} \ No newline at end of file diff --git a/web/system/vendor/phpoauthlib2/OAuthDataProvider.php b/web/system/vendor/phpoauthlib2/OAuthDataProvider.php deleted file mode 100644 index 1de88ce..0000000 --- a/web/system/vendor/phpoauthlib2/OAuthDataProvider.php +++ /dev/null @@ -1,113 +0,0 @@ -profile = $profile; - $this->dialog = $dialog; - $this->accessToken = $accessToken; - $this->header = $header; - $this->request = $request; - } - - public function getLoginUrl() { - $urlBuilder = []; - $urlBuilder[] = "client_id=" . $this->clientId; - $urlBuilder[] = "response_type=" . $this->responseType; - $urlBuilder[] = "scope=" . $this->scope; - $urlBuilder[] = "state=" . $this->state; - $urlBuilder[] = "redirect_uri=" . urlencode($this->redirectURL); - return $this->dialog . "?" . implode("&", $urlBuilder); - } - - protected function getToken() { - $tokenBuilder = []; - $tokenBuilder["client_id"] = $this->clientId; - $tokenBuilder["client_secret"] = $this->client_secret; - $tokenBuilder["grant_type"] = "authorization_code"; - $tokenBuilder["redirect_uri"] = htmlspecialchars($this->redirectURL); - $tokenBuilder["code"] = $this->request["code"]; - $curl = new ccurl($this->accessToken); - $curl->setPost($tokenBuilder); - $curl->createCurl(); - return (string)$curl; - } - - protected function parseToken() { - $token = $this->getToken(); - $convertedToken = json_decode($token, true); - if (!$convertedToken) { - $realToken = $token; - } else { - $realToken = $convertedToken["access_token"]; - } - - return $realToken; - } - - public function getProfile() { - $token = $this->parseToken(); - - $profileUrl = $this->profile . "=" . $token; - $curl = new ccurl($profileUrl); - $curl->addHeader($this->header . " " . $token); - $curl->createCurl(); - $this->profileData = json_decode((string)$curl, true); - return (string)$curl; - } - - public function getEmail() { - return null; - } - - public function getFirstName() { - return null; - } - - public function getLastName() { - return null; - } - - public function getGender() { - return null; - } - - public function getId() { - return null; - } - - public function getRawProfile() { - return $this->profileData; - } - - public function getSource() { - return null; - } -} \ No newline at end of file diff --git a/web/system/vendor/phpoauthlib2/oauth.php b/web/system/vendor/phpoauthlib2/oauth.php new file mode 100644 index 0000000..8ffe1db --- /dev/null +++ b/web/system/vendor/phpoauthlib2/oauth.php @@ -0,0 +1,26 @@ +oauthProvider = $provider; + $this->request = $request; + } + + public function check() { + if (isset($this->request["code"]) && !empty($this->request["code"])) { + $this->oauthProvider->getProfile(); + return true; + } else { + return $this->oauthProvider->getLoginUrl(); + } + } + + public function getProfile() { + return $this->oauthProvider->getProfile(); + } +} \ No newline at end of file diff --git a/web/system/vendor/phpoauthlib2/oauthdataprovider.php b/web/system/vendor/phpoauthlib2/oauthdataprovider.php new file mode 100644 index 0000000..1de88ce --- /dev/null +++ b/web/system/vendor/phpoauthlib2/oauthdataprovider.php @@ -0,0 +1,113 @@ +profile = $profile; + $this->dialog = $dialog; + $this->accessToken = $accessToken; + $this->header = $header; + $this->request = $request; + } + + public function getLoginUrl() { + $urlBuilder = []; + $urlBuilder[] = "client_id=" . $this->clientId; + $urlBuilder[] = "response_type=" . $this->responseType; + $urlBuilder[] = "scope=" . $this->scope; + $urlBuilder[] = "state=" . $this->state; + $urlBuilder[] = "redirect_uri=" . urlencode($this->redirectURL); + return $this->dialog . "?" . implode("&", $urlBuilder); + } + + protected function getToken() { + $tokenBuilder = []; + $tokenBuilder["client_id"] = $this->clientId; + $tokenBuilder["client_secret"] = $this->client_secret; + $tokenBuilder["grant_type"] = "authorization_code"; + $tokenBuilder["redirect_uri"] = htmlspecialchars($this->redirectURL); + $tokenBuilder["code"] = $this->request["code"]; + $curl = new ccurl($this->accessToken); + $curl->setPost($tokenBuilder); + $curl->createCurl(); + return (string)$curl; + } + + protected function parseToken() { + $token = $this->getToken(); + $convertedToken = json_decode($token, true); + if (!$convertedToken) { + $realToken = $token; + } else { + $realToken = $convertedToken["access_token"]; + } + + return $realToken; + } + + public function getProfile() { + $token = $this->parseToken(); + + $profileUrl = $this->profile . "=" . $token; + $curl = new ccurl($profileUrl); + $curl->addHeader($this->header . " " . $token); + $curl->createCurl(); + $this->profileData = json_decode((string)$curl, true); + return (string)$curl; + } + + public function getEmail() { + return null; + } + + public function getFirstName() { + return null; + } + + public function getLastName() { + return null; + } + + public function getGender() { + return null; + } + + public function getId() { + return null; + } + + public function getRawProfile() { + return $this->profileData; + } + + public function getSource() { + return null; + } +} \ No newline at end of file diff --git a/web/system/vendor/phpoauthlib2/providers/FacebookAuthProvider.php b/web/system/vendor/phpoauthlib2/providers/FacebookAuthProvider.php deleted file mode 100644 index 3dba4de..0000000 --- a/web/system/vendor/phpoauthlib2/providers/FacebookAuthProvider.php +++ /dev/null @@ -1,70 +0,0 @@ -client_secret = $conf["client_secret"]; - $this->redirectURL = $conf["redirect_uri"]; - $this->clientId = $conf["client_id"]; - $tempScopes = []; - foreach($scopes as $scope) { - switch ($scope) { - case OAUTH_SCOPES::EMAIL: - $tempScopes[] = "email"; - } - } - $tempScopes[] = "public_profile"; - $this->scope = implode(" ", $tempScopes); - } - - public function getEmail() { - return $this->profileData["email"]; - } - - public function getFirstName() { - return $this->profileData["first_name"]; - } - - public function getLastName() { - return $this->profileData["last_name"]; - } - - public function getId() { - return $this->profileData["id"]; - } - - public function getSource() { - return "FACEBOOK"; - } - - public function parseToken() { - $token = $this->getToken(); - return explode("=", $token)[1]; - } - - public function getProfile() { - $token = $this->parseToken(); - $profileUrl = $this->profile . "?fields=first_name,last_name,name,email,age_range&access_token=" . $token; - $curl = new ccurl($profileUrl); - $curl->createCurl(); - $ret = (string)$curl; - $this->profileData = json_decode($ret, true); - return $ret; - } - -} \ No newline at end of file diff --git a/web/system/vendor/phpoauthlib2/providers/GoogleAuthProvider.php b/web/system/vendor/phpoauthlib2/providers/GoogleAuthProvider.php deleted file mode 100644 index f3302e6..0000000 --- a/web/system/vendor/phpoauthlib2/providers/GoogleAuthProvider.php +++ /dev/null @@ -1,56 +0,0 @@ -client_secret = $conf["client_secret"]; - $this->redirectURL = $conf["redirect_uri"]; - $this->clientId = $conf["client_id"]; - - $tmpScopes = []; - foreach($scopes as $scope) { - switch ($scope) { - case OAUTH_SCOPES::EMAIL: - $tmpScopes[] = "https://www.googleapis.com/auth/userinfo.email"; - } - } - - $this->scope = implode(" ", $tmpScopes); - } - - public function getEmail() { - return $this->profileData["email"]; - } - - public function getFirstName() { - return $this->profileData["given_name"]; - } - - public function getLastName() { - return $this->profileData["family_name"]; - } - - public function getGender() { - return $this->profileData["gender"]; - } - - public function getId() { - return $this->profileData["id"]; - } - - public function getSource() { - return "GOOGLE"; - } -} \ No newline at end of file diff --git a/web/system/vendor/phpoauthlib2/providers/facebookauthprovider.php b/web/system/vendor/phpoauthlib2/providers/facebookauthprovider.php new file mode 100644 index 0000000..3dba4de --- /dev/null +++ b/web/system/vendor/phpoauthlib2/providers/facebookauthprovider.php @@ -0,0 +1,70 @@ +client_secret = $conf["client_secret"]; + $this->redirectURL = $conf["redirect_uri"]; + $this->clientId = $conf["client_id"]; + $tempScopes = []; + foreach($scopes as $scope) { + switch ($scope) { + case OAUTH_SCOPES::EMAIL: + $tempScopes[] = "email"; + } + } + $tempScopes[] = "public_profile"; + $this->scope = implode(" ", $tempScopes); + } + + public function getEmail() { + return $this->profileData["email"]; + } + + public function getFirstName() { + return $this->profileData["first_name"]; + } + + public function getLastName() { + return $this->profileData["last_name"]; + } + + public function getId() { + return $this->profileData["id"]; + } + + public function getSource() { + return "FACEBOOK"; + } + + public function parseToken() { + $token = $this->getToken(); + return explode("=", $token)[1]; + } + + public function getProfile() { + $token = $this->parseToken(); + $profileUrl = $this->profile . "?fields=first_name,last_name,name,email,age_range&access_token=" . $token; + $curl = new ccurl($profileUrl); + $curl->createCurl(); + $ret = (string)$curl; + $this->profileData = json_decode($ret, true); + return $ret; + } + +} \ No newline at end of file diff --git a/web/system/vendor/phpoauthlib2/providers/googleauthprovider.php b/web/system/vendor/phpoauthlib2/providers/googleauthprovider.php new file mode 100644 index 0000000..f3302e6 --- /dev/null +++ b/web/system/vendor/phpoauthlib2/providers/googleauthprovider.php @@ -0,0 +1,56 @@ +client_secret = $conf["client_secret"]; + $this->redirectURL = $conf["redirect_uri"]; + $this->clientId = $conf["client_id"]; + + $tmpScopes = []; + foreach($scopes as $scope) { + switch ($scope) { + case OAUTH_SCOPES::EMAIL: + $tmpScopes[] = "https://www.googleapis.com/auth/userinfo.email"; + } + } + + $this->scope = implode(" ", $tmpScopes); + } + + public function getEmail() { + return $this->profileData["email"]; + } + + public function getFirstName() { + return $this->profileData["given_name"]; + } + + public function getLastName() { + return $this->profileData["family_name"]; + } + + public function getGender() { + return $this->profileData["gender"]; + } + + public function getId() { + return $this->profileData["id"]; + } + + public function getSource() { + return "GOOGLE"; + } +} \ No newline at end of file