function log_cds added
[brisk.git] / web / spush / brisk-spush.php
1 #!/usr/bin/php
2 <?php
3 /*
4  *  brisk - spush/brisk-spush.php
5  *
6  *  Copyright (C) 2012 Matteo Nastasi
7  *                          mailto: nastasi@alternativeoutput.it 
8  *                                  matteo.nastasi@milug.org
9  *                          web: http://www.alternativeoutput.it
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * General Public License for more details. You should have received a
20  * copy of the GNU General Public License along with this program; if
21  * not, write to the Free Software Foundation, Inc, 59 Temple Place -
22  * Suite 330, Boston, MA 02111-1307, USA.
23  *
24  */
25
26 $G_base = "../";
27
28 require_once($G_base."Obj/sac-a-push.phh");
29 require_once("./brisk-spush.phh");
30 require_once($G_base."Obj/user.phh");
31 require_once($G_base."Obj/brisk.phh");
32 require_once($G_base."Obj/auth.phh");
33 require_once($G_base."Obj/zlibstream.phh");
34 require_once($G_base."Obj/mail.phh");
35 require_once($G_base."Obj/curl-de-brisk.phh");
36 // require_once("../Obj/proxyscan.phh");
37 require_once($G_base."index.php");
38 require_once($G_base."index_wr.php");
39 require_once($G_base."briskin5/Obj/briskin5.phh");
40 require_once($G_base."briskin5/index.php");
41 require_once($G_base."briskin5/index_wr.php");
42
43
44 function main($argv)
45 {
46     GLOBAL $G_ban_list, $G_black_list;
47
48     // create cds
49     $cds = new Curl_de_sac();
50
51     // create tor_chk_cls
52     $tor_chk_cls = new tor_chk_cmd_cls();
53
54     // registrer tor_chk_cls
55     printf("MAIN: Register 'tor_chk_cls'\n");
56     if (($cds->cmd_cls_register($tor_chk_cls)) == FALSE) {
57         fprintf(STDERR, "MAIN: 'tor_chk_cls' registration failed\n");
58         exit(1);
59     }
60
61     pid_save();
62     do {
63         if (($brisk = Brisk::create(LEGAL_PATH."/brisk-crystal.data", $G_ban_list, $G_black_list)) == FALSE) {
64             log_crit("Brisk::create failed");
65             $ret = 1;
66             break;
67         }
68
69         if (($s_a_p = Sac_a_push::create($brisk, USOCK_PATH, 0, 0, $argv)) === FALSE) {
70             $ret = 2;
71             break;
72         }
73
74         $ret = $s_a_p->run();
75     } while (0);
76
77     pid_remove();
78     exit($ret);
79 }
80
81 main($argv);
82 ?>