-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php.in
executable file
·56 lines (46 loc) · 2.75 KB
/
config.php.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
// =============================================================================================================
// = For your learning convenience, this file has been left mostly filled out. =================================
// =============================================================================================================
// GitHub information
$gh_username = 'EnigmaBot'; // This is the username the script uses to view and post.
$gh_organization = 'enigma-dev'; // This is the user or organization who owns the repository we're interested in.
$gh_repository = 'enigma-dev'; // This is the simple name of the repository.
$gh_oauth = '123456789abcdef123456789abcdef1234567890'; // This is the OAuth token with which the script authenticates to GitHub.
// Site / Simple Machines Forum information
$forum_name = 'the ENIGMA forums'; // Just a friendly name for your forums. YOU CANNOT CHANGE THIS AFTER THE FIRST COMMENT/ISSUE POSTED!
$forum_url = 'http://enigma-dev.org/forums/index.php'; // The URL to index.php of your forums.
$tracker_url = 'http://enigma-dev.org/tracker/index.php'; // The URL to index.php of this tracker.
$siteroot = '/var/www/html/enigma-dev.org/'; // The path to the root of your website.
// =============================================================================================================
// = The rest of this is pretty standard; you probably don't have to modify anything below this line. ==========
// =============================================================================================================
$api = 'https://api.github.com/'; // This is the API URL. We need this to actually probe GitHub for data.
$orgrepo = $gh_organization . '/' . $gh_repository; // This is just YOURORGANIZATION/YOURREPOSITORY, for convenience.
$repo = $api . 'repos/' . $orgrepo; // This is the full URL that fetches us repository information.
function getPage($url, $postData = null) {
global $gh_username, $gh_oauth;
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_USERPWD, $gh_username . ':' . $gh_oauth);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_USERAGENT, $gh_username);
if ($postData !== null) {
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $postData);
}
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
function markdown($array) {
global $api, $orgrepo;
$delim = time() . rand();
$delim2 = "\nCS" . $delim . "\n";
$json['text'] = implode($delim2, $array);
$json['mode'] = 'gfm';
$json['context'] = $orgrepo;
$output = getPage($api . 'markdown',json_encode($json));
$output = substr($output,3,-4); //get rid of <p>...</p>
return explode("CS$delim",$output);
}
?>