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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
| <?php
define ("nl", "\r\n");
define ("CIversion", "0.1"); //don't change
// required files
require_once("inc/GbxRemote.inc.php");
require_once("inc/xmlparser.inc.php");
//*****
// CI
//*****
class Cicon {
function startup () {
// variables
global $setting;
global $xml_parser;
global $dbsetting;
global $serversetting;
global $server;
//$this->xml_parser = new Examsly();
//$this->client = new IXR_Client_Gbx;
} //function startup
function loadsetting () {
echo "Loading settings...";
$setting = array();
if(file_exists('config1.xml')) {
$xml = @simplexml_load_file('config1.xml');
//Settings to load from config1.xml
$setting['serverip'] = $xml->server_settings->serverip;
$setting['serverport'] = $xml->server_settings->serverport;
$setting['serverlogin'] = $xml->server_settings->serverlogin;
$setting['serverpassword'] = $xml->server_settings->serverpassword;
$setting['nation'] = $xml->server_settings->nation;
$setting['location'] = $xml->server_settings->location;
$setting['passdisplay'] = $xml->other->displayserverpass;
$setting['superpass'] = $xml->server_settings->Superadminpass;
echo nl, "done!", nl, nl;
echo "Connecting to server:", nl, "ServerIP: ", $setting['serverip'], nl;
echo "Serverport: ", $setting['serverport'], nl, nl;
//*******************
// Connect to server
//*******************
$Ip=$setting['serverip'];
$Port=5008;
$Login='SuperAdmin';
$Password='Superpass';
$connect = new IXR_Client_Gbx();
$connect->InitWithIp($Ip,$Port);
//Does the connection work?
if (!$connect->InitWithIp($Host, $Port)) {
echo "Connection failed! Check IP & Port.", nl;
exit;
}
$connect->query("Authenticate", $Login, $Password);
if (!$connect->query("Authenticate", $Login, $Password)) {
echo "Login failed! Check login settings.", nl;
exit;
}
$connect->query('SendHideManialinkPage'); //Close all leftover manialinks
$connect->query('SendDisplayManialinkPage', '<?xml version="1.0" encoding="UTF-8" ?>
<manialink id="1">
<quad posn="0 43 0" sizen="30 3" style="Bgs1" halign="center" substyle="NavButton" action="0"/>
<label text="$fff**Has succesfuly connected to the server! Loading plugins..." halign="center" posn="0 42.7 1" sizen="30 3" />
</manialink>', 0, False); // Send startup message
echo "Connected to server!", nl;
echo "Loading plugins.", nl;
$plg=0;
//*****************
// Loading Plugins
//*****************
Echo nl, "List of plugins:", nl;
if ($handle = opendir('inc\plugins')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && $entry != "localrecords") {
$plg++;
$pluginname = $entry;
if (file_exists('inc/plugins/'.$pluginname)) {
require('inc/plugins/'.$pluginname);
}
else echo"plugin failed to load, or no plugins!";
}
}
closedir($handle);
}
echo nl,"Plugins loaded! Amount: ",$plg,nl;
} // if
else {
echo 'ERROR: Can\'t read the Config file! Check location/name';
exit;
} // else
} // function loadsetting
function connect () {
echo nl, "END", nl;
} // function connect
} //class Cicon
$testcicon = new Cicon();
$testcicon->startup();
$testcicon->loadsetting();
$testcicon->connect();
?> |