-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b59df00
Showing
37 changed files
with
16,371 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
|
||
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · | ||
· · | ||
· · | ||
· Q V I T T E R · | ||
· · | ||
· http://github.com/hannesmannerheim/qvitter · | ||
· · | ||
· · | ||
· <o) · | ||
· /_//// · | ||
· (____/ · | ||
· (o< · | ||
· o> \\\\_\ · | ||
· \\) \____) · | ||
· · | ||
· · | ||
· · | ||
· Qvitter is free software: you can redistribute it and / or modify it · | ||
· under the terms of the GNU Affero General Public License as published by · | ||
· the Free Software Foundation, either version three of the License or (at · | ||
· your option) any later version. · | ||
· · | ||
· Qvitter is distributed in hope that it will be useful but WITHOUT ANY · | ||
· WARRANTY; without even the implied warranty of MERCHANTABILTY or FITNESS · | ||
· FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for · | ||
· more details. · | ||
· · | ||
· You should have received a copy of the GNU Affero General Public License · | ||
· along with Qvitter. If not, see <http://www.gnu.org/licenses/>. · | ||
· · | ||
· Contact h@nnesmannerhe.im if you have any questions. · | ||
· · | ||
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */ | ||
|
||
include 'settings.php'; | ||
|
||
header("Content-type: application/json; charset=utf-8"); | ||
if(substr($apiroot,-1) != '/') { $apiroot .= '/'; } // add slash if missing | ||
|
||
// post requests | ||
if(isset($_POST['postRequest'])) { | ||
$query = http_build_query($_POST, '', '&'); | ||
$ch=curl_init(); | ||
curl_setopt($ch, CURLOPT_URL, $apiroot.urldecode($_POST['postRequest'])); | ||
curl_setopt($ch, CURLOPT_USERPWD, $_POST['username'].":".$_POST['password']); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
curl_setopt($ch, CURLOPT_POST, 1); | ||
curl_setopt($ch, CURLOPT_POSTFIELDS, $query); | ||
session_write_close(); // fix problem with curling to local | ||
$reply=curl_exec($ch); | ||
curl_close($ch); | ||
session_start(); | ||
|
||
// force ssl on our domain | ||
if($forcessl) { | ||
$reply = str_replace('http://'.$siterootdomain,'https://'.$siterootdomain,$reply); | ||
} | ||
|
||
print $reply; | ||
} | ||
|
||
// get requests | ||
elseif(isset($_POST['getRequest'])) { | ||
$ch=curl_init(); | ||
curl_setopt($ch, CURLOPT_URL, $apiroot.$_POST['getRequest']); | ||
|
||
if(isset($_POST['username'])) { | ||
curl_setopt($ch, CURLOPT_USERPWD, $_POST['username'].":".$_POST['password']); | ||
} | ||
|
||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
session_write_close(); | ||
$reply=curl_exec($ch); | ||
curl_close($ch); | ||
session_start(); | ||
|
||
// force ssl on our domain | ||
if($forcessl) { | ||
$reply = str_replace('http:\/\/'.$siterootdomain,'https:\/\/'.$siterootdomain,$reply); | ||
} | ||
|
||
print $reply; | ||
} | ||
|
||
|
||
|
||
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · | ||
· · | ||
· (o> >o) · | ||
· \\\\_\ /_//// . | ||
· \____) (____/ · | ||
· · | ||
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · */?> |
Oops, something went wrong.