Index: trunk/tools/rotatebot/rotbot.php |
— | — | @@ -15,8 +15,7 @@ |
16 | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | */ |
18 | 18 | |
19 | | -$homedir = "/home/luxo/rotbot/"; |
20 | | -$exiftool = "/home/luxor/rotbot/exiftool/exiftool"; |
| 19 | +include("settings.php"); |
21 | 20 | $myLockfile = $homedir."rotatebotlock"; |
22 | 21 | |
23 | 22 | ini_set('memory_limit', '100M'); //Speicher auf 100 MBytes hochsetzen |
— | — | @@ -54,7 +53,7 @@ |
55 | 54 | |
56 | 55 | |
57 | 56 | logfile("Verbinde zur Datenbank!"); |
58 | | -include("settings.php"); |
| 57 | + |
59 | 58 | $myslink = mysql_connect($databanknames, $userloginname, $databasepw) or suicide ("Can't connect to MySQL"); |
60 | 59 | $database = "commonswiki_p"; |
61 | 60 | mysql_select_db($database, $myslink) |
Index: trunk/tools/rotatebot/settings.php |
— | — | @@ -1,7 +1,12 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -$databanknames = ""; |
| 4 | +$homedir = "/home/luxo/rotbot/"; |
| 5 | +$cookies = "/home/lux/cks"; |
| 6 | +$exiftool = "/home/luxor/rotbot/exiftool/exiftool"; |
| 7 | +$useragent = "Luxo (Toolserver; php) luxo@ts.wikimedia.org"; |
5 | 8 | |
6 | | -$userloginname = ""; |
7 | | -$databasepw = ""; |
| 9 | +$databanknames = ""; // server |
8 | 10 | |
| 11 | +$userloginname = ""; // database username |
| 12 | +$databasepw = ""; // database password |
| 13 | + |
Index: trunk/tools/rotatebot/upload.php |
— | — | @@ -18,14 +18,12 @@ |
19 | 19 | |
20 | 20 | wikiupload("commons.wikimedia.org","test2.jpg","Test for Rotatebot.jpg","",$descri);*/ |
21 | 21 | |
22 | | -$homedir = "/home/luxo/rotbot/"; |
| 22 | +include("settings.php"); |
23 | 23 | |
24 | 24 | // ############### EDIT WIKIPEDIA - FUNCTION ############### |
25 | 25 | function wikiupload($project,$filename_local,$filename_wiki,$license,$desc) |
26 | 26 | { |
27 | | - global $cookies; |
28 | | - $username = "Rotatebot"; |
29 | | - $password = "**removed**"; |
| 27 | + global $cookies, $useragent; |
30 | 28 | |
31 | 29 | logfile("Lade Bild '$filename_wiki' hoch am ".date("r",time())."."); |
32 | 30 | |
— | — | @@ -34,7 +32,7 @@ |
35 | 33 | { |
36 | 34 | $username = "Rotatebot"; |
37 | 35 | $password = "**removed**"; |
38 | | - $useragent = "Luxo (toolserver; php) luxo@ts.wikimedia.org"; |
| 36 | + |
39 | 37 | logfile("Login to $project!\n"); |
40 | 38 | wikilogin($username,$password,$project,$useragent); |
41 | 39 | logfile("logged in to $project!\n"); |
— | — | @@ -90,8 +88,8 @@ |
91 | 89 | |
92 | 90 | function wiki_PostToHostFD ($host, $path, $data_l, $wiki, $cookies) //this function was developed by [[:de:User:APPER]] (Christian Thiele) |
93 | 91 | { |
| 92 | + global $useragent; |
94 | 93 | logfile("verbinde zu $host ..."); |
95 | | - $useragent = "Luxobot/1.1 (toolserver; php) luxo@ts.wikimedia.org"; |
96 | 94 | $dc = 0; |
97 | 95 | $bo="-----------------------------305242850528394"; |
98 | 96 | $filename=$data_l['wpDestFile']; |
Index: trunk/tools/rotatebot/login.php |
— | — | @@ -18,17 +18,15 @@ |
19 | 19 | |
20 | 20 | */ |
21 | 21 | |
22 | | -$cookies = "/home/lux/cks"; |
| 22 | +include("settings.php"); |
23 | 23 | |
24 | 24 | // ############### EDIT WIKIPEDIA - FUNCTION ############### |
25 | 25 | function wikiedit($project,$page,$newtext,$description,$minor) |
26 | 26 | { |
27 | | - global $cookies; |
| 27 | + global $cookies, $useragent; |
28 | 28 | logfile("Funktion gestartet..."); |
29 | 29 | logfile("Schreibe Text am ".date("r",time())." in die Seite '$page'."); |
30 | 30 | |
31 | | - $useragent = "Luxo (toolserver; php) luxo@ts.wikimedia.org"; |
32 | | - |
33 | 31 | //$cookies |
34 | 32 | if(!$cookies["commonswikiUserName"] || !$cookies["commonswikiUserID"]) |
35 | 33 | { |
— | — | @@ -251,8 +249,8 @@ |
252 | 250 | |
253 | 251 | $postlogin = "lgname=".urlencode($username)."&lgpassword=".urlencode($password)."&format=php"; |
254 | 252 | |
255 | | - global $cookies; |
256 | | - if(!$useragent) { $useragent = "Luxo (Toolserver; php) luxo@ts.wikimedia.org"; } |
| 253 | + global $cookies, $useragent; |
| 254 | + |
257 | 255 | $ch = curl_init($project.$getrequest); |
258 | 256 | curl_setopt($ch, CURLOPT_POST, TRUE); |
259 | 257 | curl_setopt($ch, CURLOPT_POSTFIELDS, $postlogin); |