summaryrefslogtreecommitdiffstats
path: root/main.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--main.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/main.php b/main.php
index fe160ef..4a6f1b4 100644
--- a/main.php
+++ b/main.php
@@ -67,7 +67,7 @@ Errors:
class oldredditClient {
private $username;
private $password;
- public $version = array(0, 0, 0);
+ public $version = array(0, 0, 1);
private $programname = "oldredditclient";
private $programdomain = 'oldredditclient.sijanec.eu';
private $cookiedir; // set at runtime, ker je get_curerent_user, v login()
@@ -128,7 +128,7 @@ Errors:
$this->ch = $ch;
return true;
}
- public function setflair($sub = "Slovenia", $flair = null, $magic = "bc411828-bfa2-11e5-ba67-0e414077483d") {
+ public function setflair($sub = "Slovenia", $flair = null, $magic = null, $post = false) {
if(!curl_getinfo($this->ch)) {
if (!$this->login()) {
return -2;
@@ -139,6 +139,13 @@ Errors:
$dnevi = array("drekek", "ponedeljek", "torek", "sreda", "cetrtek", "petek", "sobota", "nedelja");
$flair = $dnevi[date("N")].", ".date("j.n.Y H:i:s");
}
+ if($magic == null) {
+ if($post) {
+ $magic = "8eff03aa-f62b-11e6-86f4-0e0e0c95c44a";
+ } else {
+ $magic = "bc411828-bfa2-11e5-ba67-0e414077483d";
+ }
+ }
curl_setopt($ch, CURLOPT_URL, $this->setflairurl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
@@ -146,7 +153,11 @@ Errors:
'X-ContactBotDeveloper: '."sijanecantonluka@gmail.com",
"X-UselessBot: true"
));
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'flair=login-main&name='.$this->username.'&r='.$sub.'&flair_template_id='.$magic.'&text='.$flair);
+ if($post) {
+ curl_setopt($ch, CURLOPT_POSTFIELDS, 'link='.$post.'&r='.$sub.'&flair_template_id='.$magic.'&text='.$flair);
+ } else {
+ curl_setopt($ch, CURLOPT_POSTFIELDS, 'name='.$this->username.'&r='.$sub.'&flair_template_id='.$magic.'&text='.$flair);
+ }
$request_output = curl_exec($ch);
if(curl_getinfo($ch, CURLINFO_RESPONSE_CODE) != 200) {
return false;