| 1 | /* |
|---|
| 2 | FILE |
|---|
| 3 | unxsVZ/mysqlrad.h |
|---|
| 4 | AUTHOR |
|---|
| 5 | (C) 2001-2009 Gary Wallis for Unixservice. |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #include <stdio.h> |
|---|
| 9 | #include <stdlib.h> |
|---|
| 10 | #include <pwd.h> |
|---|
| 11 | #include <signal.h> |
|---|
| 12 | #include <time.h> |
|---|
| 13 | #include <sys/types.h> |
|---|
| 14 | #include <sys/stat.h> |
|---|
| 15 | #include <sys/socket.h> |
|---|
| 16 | #include <crypt.h> |
|---|
| 17 | #include <netinet/in.h> |
|---|
| 18 | #include <arpa/inet.h> |
|---|
| 19 | #include <netdb.h> |
|---|
| 20 | #include <string.h> |
|---|
| 21 | #include <sys/file.h> |
|---|
| 22 | |
|---|
| 23 | #include "cgi.h" |
|---|
| 24 | |
|---|
| 25 | #include <mysql/mysql.h> |
|---|
| 26 | |
|---|
| 27 | #include <unistd.h> |
|---|
| 28 | #include <locale.h> |
|---|
| 29 | #include <monetary.h> |
|---|
| 30 | |
|---|
| 31 | #include "language.h" |
|---|
| 32 | #include "local.h" |
|---|
| 33 | |
|---|
| 34 | //tStatus constants |
|---|
| 35 | #define uACTIVE 1 |
|---|
| 36 | #define uONHOLD 2 |
|---|
| 37 | #define uOFFLINE 3 |
|---|
| 38 | #define uAWAITMOD 4 |
|---|
| 39 | #define uAWAITDEL 5 |
|---|
| 40 | #define uAWAITACT 6 |
|---|
| 41 | #define uCANCELED 7 |
|---|
| 42 | #define uMODIFIED 8 |
|---|
| 43 | #define uMODPROB 9 |
|---|
| 44 | #define uINITSETUP 11 |
|---|
| 45 | #define uAWAITMIG 21 |
|---|
| 46 | #define uSTOPPED 31 |
|---|
| 47 | #define uAWAITSTOP 41 |
|---|
| 48 | #define uAWAITTML 51 |
|---|
| 49 | #define uAWAITHOST 61 |
|---|
| 50 | #define uAWAITIP 71 |
|---|
| 51 | #define uAWAITCLONE 81 |
|---|
| 52 | #define uAWAITFAIL 91 |
|---|
| 53 | #define uREMOTEAPPLIANCE 101 |
|---|
| 54 | |
|---|
| 55 | //tProperty fixed types aka constants |
|---|
| 56 | //Actually tType constants |
|---|
| 57 | #define PROP_DATACENTER "1" |
|---|
| 58 | #define PROP_NODE "2" |
|---|
| 59 | #define PROP_CONTAINER "3" |
|---|
| 60 | #define PROP_GROUP "4" |
|---|
| 61 | #define PROP_GROUPTYPE "5" |
|---|
| 62 | #define PROP_CONFIG "6" |
|---|
| 63 | #define PROP_NAMESERVER "7" |
|---|
| 64 | #define PROP_OSTEMPLATE "8" |
|---|
| 65 | #define PROP_SEARCHDOMAIN "9" |
|---|
| 66 | #define uPROP_DATACENTER 1 |
|---|
| 67 | #define uPROP_NODE 2 |
|---|
| 68 | #define uPROP_CONTAINER 3 |
|---|
| 69 | #define uPROP_GROUP 4 |
|---|
| 70 | #define uPROP_GROUPTYPE 5 |
|---|
| 71 | #define uPROP_CONFIG 6 |
|---|
| 72 | #define uPROP_NAMESERVER 7 |
|---|
| 73 | #define uPROP_OSTEMPLATE 8 |
|---|
| 74 | #define uPROP_SEARCHDOMAIN 9 |
|---|
| 75 | #define uPROP_RECJOB 10 |
|---|
| 76 | |
|---|
| 77 | //tJobStatus constants |
|---|
| 78 | #define uWAITING 1 |
|---|
| 79 | #define uRUNNING 2 |
|---|
| 80 | #define uDONEOK 3 |
|---|
| 81 | #define uDONEERROR 4 |
|---|
| 82 | #define uSUSPENDED 5 |
|---|
| 83 | #define uREDUNDANT 6 |
|---|
| 84 | #define uCANCELED 7 |
|---|
| 85 | #define uREMOTEWAITING 10 |
|---|
| 86 | #define uERROR 14 |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | #define cLOGFILE "/var/log/unxsvzlog" |
|---|
| 90 | |
|---|
| 91 | extern char gcHost[]; |
|---|
| 92 | extern char gcHostname[]; |
|---|
| 93 | extern char gcUser[]; |
|---|
| 94 | extern int guPermLevel; |
|---|
| 95 | extern unsigned guLoginClient; |
|---|
| 96 | extern unsigned guReseller; |
|---|
| 97 | extern unsigned guCompany; |
|---|
| 98 | |
|---|
| 99 | extern char gcFunction[]; |
|---|
| 100 | extern unsigned guListMode; |
|---|
| 101 | extern char gcQuery[]; |
|---|
| 102 | extern char *gcQstr; |
|---|
| 103 | extern char *gcBuildInfo; |
|---|
| 104 | extern char *gcRADStatus; |
|---|
| 105 | extern MYSQL gMysql; |
|---|
| 106 | extern unsigned long gluRowid; |
|---|
| 107 | extern unsigned guStart; |
|---|
| 108 | extern unsigned guEnd; |
|---|
| 109 | extern unsigned guI; |
|---|
| 110 | extern unsigned guN; |
|---|
| 111 | extern char gcCommand[]; |
|---|
| 112 | extern char gcFilter[]; |
|---|
| 113 | extern char gcFind[]; |
|---|
| 114 | extern char gcTable[]; |
|---|
| 115 | extern unsigned guMode; |
|---|
| 116 | extern int guError; |
|---|
| 117 | extern char gcErrormsg[]; |
|---|
| 118 | |
|---|
| 119 | extern pentry entries[]; |
|---|
| 120 | extern entry gentries[]; |
|---|
| 121 | extern int x; |
|---|
| 122 | |
|---|
| 123 | void unxsVZ(const char *cResult); |
|---|
| 124 | void ConnectDb(void); |
|---|
| 125 | void Footer_ism3(void); |
|---|
| 126 | void Header_ism3(const char *cMsg, int iJs); |
|---|
| 127 | void ProcessControlVars(pentry entries[], int x); |
|---|
| 128 | void OpenRow(const char *cFieldLabel, const char *cColor); |
|---|
| 129 | void OpenFieldSet(char *cLabel, unsigned uWidth); |
|---|
| 130 | void CloseFieldSet(void); |
|---|
| 131 | void LoadConf(void); |
|---|
| 132 | void NoSuchFunction(void); |
|---|
| 133 | void tContainerGroupPullDown(unsigned uGroup, unsigned uMode); |
|---|
| 134 | void tTablePullDown(const char *cTableName, const char *cFieldName, |
|---|
| 135 | const char *cOrderby, unsigned uSelector, unsigned uMode); |
|---|
| 136 | void tTablePullDownOwner(const char *cTableName, const char *cFieldName, |
|---|
| 137 | const char *cOrderby, unsigned uSelector, unsigned uMode); |
|---|
| 138 | void tTablePullDownReadOnly(const char *cTableName, const char *cFieldName, |
|---|
| 139 | const char *cOrderby, unsigned uSelector); |
|---|
| 140 | int ReadPullDown(const char *cTableName,const char *cFieldName,const char *cLabel); |
|---|
| 141 | char *TextAreaSave(char *cField); |
|---|
| 142 | char *TransformAngleBrackets(char *cField); |
|---|
| 143 | char *EncodeDoubleQuotes(char *cField); |
|---|
| 144 | void YesNoPullDown(char *cFieldName,unsigned uSelect,unsigned uMode); |
|---|
| 145 | void YesNo(unsigned uSelect); |
|---|
| 146 | int ReadYesNoPullDown(const char *cLabel); |
|---|
| 147 | const char *ForeignKey(const char *cTableName, const char *cFieldName, unsigned uKey); |
|---|
| 148 | void GetClientOwner(unsigned uClient, unsigned *uOwner); |
|---|
| 149 | void ExtMainShell(int argc, char *argv[]); |
|---|
| 150 | void jsCalendarInput(char *cInputName,char *cValue,unsigned uMode); |
|---|
| 151 | long unsigned luGetModDate(char *cTableName, unsigned uTablePK); |
|---|
| 152 | long unsigned luGetCreatedDate(char *cTableName, unsigned uTablePK); |
|---|
| 153 | void DashBoard(const char *cOptionalMsg); |
|---|
| 154 | void htmlPlainTextError(const char *cError); |
|---|
| 155 | unsigned uAllowMod(const unsigned uOwner, const unsigned uCreatedBy); |
|---|
| 156 | unsigned uAllowDel(const unsigned uOwner, const unsigned uCreatedBy); |
|---|
| 157 | void ExtListSelect(const char *cTable,const char *cVarList); |
|---|
| 158 | void ExtSelect(const char *cTable,const char *cVarList); |
|---|
| 159 | void ExtSelectSearch(const char *cTable,const char *cVarList,const char *cSearchField,const char *cSearch); |
|---|
| 160 | void ExtSelectRow(const char *cTable,const char *cVarList,unsigned uRow); |
|---|
| 161 | void ExtListSelectPublic(const char *cTable,const char *cVarList); |
|---|
| 162 | void ExtSelectPublic(const char *cTable,const char *cVarList); |
|---|
| 163 | void ExtSelectPublicOrder(const char *cTable,const char *cVarList,const char *cOrderBy); |
|---|
| 164 | void ExtSelectSearchPublic(const char *cTable,const char *cVarList,const char *cSearchField,const char *cSearch); |
|---|
| 165 | void ExtSelectRowPublic(const char *cTable,const char *cVarList,unsigned uRow); |
|---|
| 166 | void CloneReport(const char *cOptionalMsg); |
|---|
| 167 | void tTablePullDownResellers(unsigned uSelector,unsigned uBanner); |
|---|
| 168 | void GetConfiguration(const char *cName,char *cValue, |
|---|
| 169 | unsigned uDatacenter, |
|---|
| 170 | unsigned uNode, |
|---|
| 171 | unsigned uContainer, |
|---|
| 172 | unsigned uHtml); |
|---|
| 173 | void tTablePullDownAvail(const char *cTableName, const char *cFieldName, |
|---|
| 174 | const char *cOrderby, unsigned uSelector, unsigned uMode); |
|---|
| 175 | void tTablePullDownOwnerAvail(const char *cTableName, const char *cFieldName, |
|---|
| 176 | const char *cOrderby, unsigned uSelector, unsigned uMode); |
|---|
| 177 | void tTablePullDownDatacenter(const char *cTableName, const char *cFieldName, |
|---|
| 178 | const char *cOrderby, unsigned uSelector, unsigned uMode, const char *cDatacenter, |
|---|
| 179 | unsigned uType, unsigned uDatacenter); |
|---|
| 180 | void tTablePullDownOwnerAvailDatacenter(const char *cTableName, const char *cFieldName, |
|---|
| 181 | const char *cOrderby, unsigned uSelector, unsigned uMode,unsigned uDatacenter,unsigned uClient); |
|---|
| 182 | |
|---|
| 183 | char *cURLEncode(char *cURL); |
|---|
| 184 | void unxsVZLog(unsigned uTablePK, char *cTableName, char *cLogEntry); |
|---|
| 185 | |
|---|
| 186 | //Standard tInputFunc functions |
|---|
| 187 | char *WordToLower(char *cInput); |
|---|
| 188 | char *IPNumber(char *cInput); |
|---|
| 189 | char *IPv4All(char *cInput); |
|---|
| 190 | char *IPv4Range(char *cInput); |
|---|
| 191 | char *IPv4CIDR(char *cInput); |
|---|
| 192 | char *FQDomainName(char *cInput); |
|---|
| 193 | char *EmailInput(char *cInput); |
|---|
| 194 | char *cMoneyInput(char *cInput); |
|---|
| 195 | char *cMoneyDisplay(char *cInput); |
|---|
| 196 | |
|---|
| 197 | //Standard tValidFunc functions |
|---|
| 198 | const char *EmptyString(const char *cInput); |
|---|
| 199 | const char *BadIPNum(const char *cInput); |
|---|
| 200 | const char *IsZero(const unsigned uInput); |
|---|
| 201 | |
|---|
| 202 | //External pagination form processing vars |
|---|
| 203 | void PageMachine(char *cFuncName, int iLmode, char *cMsg); |
|---|
| 204 | |
|---|
| 205 | //Place ModuleCommands() and Module() prototypes here |
|---|
| 206 | #define ISPNAME "OpenISP" |
|---|
| 207 | #define ISPURL "www.openisp.net" |
|---|
| 208 | #define ADMIN 9 |
|---|
| 209 | |
|---|
| 210 | //tDatacenter |
|---|
| 211 | int tDatacenterCommands(pentry entries[], int x); |
|---|
| 212 | void tDatacenter(const char *results); |
|---|
| 213 | void ProcesstDatacenterVars(pentry entries[], int x); |
|---|
| 214 | void tDatacenterContent(void); |
|---|
| 215 | void tDatacenterInputContent(void); |
|---|
| 216 | void tDatacenterInput(unsigned uMode); |
|---|
| 217 | void tDatacenterList(void); |
|---|
| 218 | void NewtDatacenter(unsigned uMode); |
|---|
| 219 | void ModtDatacenter(void); |
|---|
| 220 | void CreatetDatacenter(void); |
|---|
| 221 | void DeletetDatacenter(void); |
|---|
| 222 | void ExttDatacenterGetHook(entry gentries[], int x); |
|---|
| 223 | void ExttDatacenterNavBar(void); |
|---|
| 224 | |
|---|
| 225 | //tNode |
|---|
| 226 | int tNodeCommands(pentry entries[], int x); |
|---|
| 227 | void tNode(const char *results); |
|---|
| 228 | void ProcesstNodeVars(pentry entries[], int x); |
|---|
| 229 | void tNodeContent(void); |
|---|
| 230 | void tNodeInputContent(void); |
|---|
| 231 | void tNodeInput(unsigned uMode); |
|---|
| 232 | void tNodeList(void); |
|---|
| 233 | void NewtNode(unsigned uMode); |
|---|
| 234 | void ModtNode(void); |
|---|
| 235 | void CreatetNode(void); |
|---|
| 236 | void DeletetNode(void); |
|---|
| 237 | void ExttNodeGetHook(entry gentries[], int x); |
|---|
| 238 | void ExttNodeNavBar(void); |
|---|
| 239 | |
|---|
| 240 | //tContainer |
|---|
| 241 | int tContainerCommands(pentry entries[], int x); |
|---|
| 242 | void tContainer(const char *results); |
|---|
| 243 | void ProcesstContainerVars(pentry entries[], int x); |
|---|
| 244 | void tContainerContent(void); |
|---|
| 245 | void tContainerInputContent(void); |
|---|
| 246 | void tContainerInput(unsigned uMode); |
|---|
| 247 | void tContainerList(void); |
|---|
| 248 | void NewtContainer(unsigned uMode); |
|---|
| 249 | void ModtContainer(void); |
|---|
| 250 | void CreatetContainer(void); |
|---|
| 251 | void DeletetContainer(void); |
|---|
| 252 | void ExttContainerGetHook(entry gentries[], int x); |
|---|
| 253 | void ExttContainerNavBar(void); |
|---|
| 254 | unsigned CommonCloneContainer( |
|---|
| 255 | unsigned uContainer, |
|---|
| 256 | unsigned uOSTemplate, |
|---|
| 257 | unsigned uConfig, |
|---|
| 258 | unsigned uNameserver, |
|---|
| 259 | unsigned uSearchdomain, |
|---|
| 260 | unsigned uDatacenter, |
|---|
| 261 | unsigned uTargetDatacenter, |
|---|
| 262 | unsigned uOwner, |
|---|
| 263 | const char *cLabel, |
|---|
| 264 | unsigned uNode, |
|---|
| 265 | unsigned uStatus, |
|---|
| 266 | const char *cHostname, |
|---|
| 267 | const char *cClassC, |
|---|
| 268 | unsigned uWizIPv4, |
|---|
| 269 | char *cWizLabel, |
|---|
| 270 | char *cWizHostname, |
|---|
| 271 | unsigned uTargetNode, |
|---|
| 272 | unsigned uSyncPeriod, |
|---|
| 273 | unsigned uLoginClient, |
|---|
| 274 | unsigned uCloneStop, |
|---|
| 275 | unsigned uMode); |
|---|
| 276 | void CopyContainerProps(unsigned uSource, unsigned uTarget); |
|---|
| 277 | unsigned CloneContainerJob(unsigned uDatacenter, unsigned uNode, unsigned uContainer, |
|---|
| 278 | unsigned uTargetNode, unsigned uNewVeid, unsigned uPrevStatus, |
|---|
| 279 | unsigned uOwner,unsigned uCreatedBy,unsigned uCloneStop); |
|---|
| 280 | |
|---|
| 281 | //tProperty |
|---|
| 282 | int tPropertyCommands(pentry entries[], int x); |
|---|
| 283 | void tProperty(const char *results); |
|---|
| 284 | void ProcesstPropertyVars(pentry entries[], int x); |
|---|
| 285 | void tPropertyContent(void); |
|---|
| 286 | void tPropertyInputContent(void); |
|---|
| 287 | void tPropertyInput(unsigned uMode); |
|---|
| 288 | void tPropertyList(void); |
|---|
| 289 | void NewtProperty(unsigned uMode); |
|---|
| 290 | void ModtProperty(void); |
|---|
| 291 | void CreatetProperty(void); |
|---|
| 292 | void DeletetProperty(void); |
|---|
| 293 | void ExttPropertyGetHook(entry gentries[], int x); |
|---|
| 294 | void ExttPropertyNavBar(void); |
|---|
| 295 | |
|---|
| 296 | //tType |
|---|
| 297 | int tTypeCommands(pentry entries[], int x); |
|---|
| 298 | void tType(const char *results); |
|---|
| 299 | void ProcesstTypeVars(pentry entries[], int x); |
|---|
| 300 | void tTypeContent(void); |
|---|
| 301 | void tTypeInputContent(void); |
|---|
| 302 | void tTypeInput(unsigned uMode); |
|---|
| 303 | void tTypeList(void); |
|---|
| 304 | void NewtType(unsigned uMode); |
|---|
| 305 | void ModtType(void); |
|---|
| 306 | void CreatetType(void); |
|---|
| 307 | void DeletetType(void); |
|---|
| 308 | void ExttTypeGetHook(entry gentries[], int x); |
|---|
| 309 | void ExttTypeNavBar(void); |
|---|
| 310 | |
|---|
| 311 | //tOSTemplate |
|---|
| 312 | int tOSTemplateCommands(pentry entries[], int x); |
|---|
| 313 | void tOSTemplate(const char *results); |
|---|
| 314 | void ProcesstOSTemplateVars(pentry entries[], int x); |
|---|
| 315 | void tOSTemplateContent(void); |
|---|
| 316 | void tOSTemplateInputContent(void); |
|---|
| 317 | void tOSTemplateInput(unsigned uMode); |
|---|
| 318 | void tOSTemplateList(void); |
|---|
| 319 | void NewtOSTemplate(unsigned uMode); |
|---|
| 320 | void ModtOSTemplate(void); |
|---|
| 321 | void CreatetOSTemplate(void); |
|---|
| 322 | void DeletetOSTemplate(void); |
|---|
| 323 | void ExttOSTemplateGetHook(entry gentries[], int x); |
|---|
| 324 | void ExttOSTemplateNavBar(void); |
|---|
| 325 | |
|---|
| 326 | //tNameserver |
|---|
| 327 | int tNameserverCommands(pentry entries[], int x); |
|---|
| 328 | void tNameserver(const char *results); |
|---|
| 329 | void ProcesstNameserverVars(pentry entries[], int x); |
|---|
| 330 | void tNameserverContent(void); |
|---|
| 331 | void tNameserverInputContent(void); |
|---|
| 332 | void tNameserverInput(unsigned uMode); |
|---|
| 333 | void tNameserverList(void); |
|---|
| 334 | void NewtNameserver(unsigned uMode); |
|---|
| 335 | void ModtNameserver(void); |
|---|
| 336 | void CreatetNameserver(void); |
|---|
| 337 | void DeletetNameserver(void); |
|---|
| 338 | void ExttNameserverGetHook(entry gentries[], int x); |
|---|
| 339 | void ExttNameserverNavBar(void); |
|---|
| 340 | |
|---|
| 341 | //tSearchdomain |
|---|
| 342 | int tSearchdomainCommands(pentry entries[], int x); |
|---|
| 343 | void tSearchdomain(const char *results); |
|---|
| 344 | void ProcesstSearchdomainVars(pentry entries[], int x); |
|---|
| 345 | void tSearchdomainContent(void); |
|---|
| 346 | void tSearchdomainInputContent(void); |
|---|
| 347 | void tSearchdomainInput(unsigned uMode); |
|---|
| 348 | void tSearchdomainList(void); |
|---|
| 349 | void NewtSearchdomain(unsigned uMode); |
|---|
| 350 | void ModtSearchdomain(void); |
|---|
| 351 | void CreatetSearchdomain(void); |
|---|
| 352 | void DeletetSearchdomain(void); |
|---|
| 353 | void ExttSearchdomainGetHook(entry gentries[], int x); |
|---|
| 354 | void ExttSearchdomainNavBar(void); |
|---|
| 355 | |
|---|
| 356 | //tConfig |
|---|
| 357 | int tConfigCommands(pentry entries[], int x); |
|---|
| 358 | void tConfig(const char *results); |
|---|
| 359 | void ProcesstConfigVars(pentry entries[], int x); |
|---|
| 360 | void tConfigContent(void); |
|---|
| 361 | void tConfigInputContent(void); |
|---|
| 362 | void tConfigInput(unsigned uMode); |
|---|
| 363 | void tConfigList(void); |
|---|
| 364 | void NewtConfig(unsigned uMode); |
|---|
| 365 | void ModtConfig(void); |
|---|
| 366 | void CreatetConfig(void); |
|---|
| 367 | void DeletetConfig(void); |
|---|
| 368 | void ExttConfigGetHook(entry gentries[], int x); |
|---|
| 369 | void ExttConfigNavBar(void); |
|---|
| 370 | |
|---|
| 371 | //tIP |
|---|
| 372 | int tIPCommands(pentry entries[], int x); |
|---|
| 373 | void tIP(const char *results); |
|---|
| 374 | void ProcesstIPVars(pentry entries[], int x); |
|---|
| 375 | void tIPContent(void); |
|---|
| 376 | void tIPInputContent(void); |
|---|
| 377 | void tIPInput(unsigned uMode); |
|---|
| 378 | void tIPList(void); |
|---|
| 379 | void NewtIP(unsigned uMode); |
|---|
| 380 | void ModtIP(void); |
|---|
| 381 | void CreatetIP(void); |
|---|
| 382 | void DeletetIP(void); |
|---|
| 383 | void ExttIPGetHook(entry gentries[], int x); |
|---|
| 384 | void ExttIPNavBar(void); |
|---|
| 385 | |
|---|
| 386 | //tGroupType |
|---|
| 387 | int tGroupTypeCommands(pentry entries[], int x); |
|---|
| 388 | void tGroupType(const char *results); |
|---|
| 389 | void ProcesstGroupTypeVars(pentry entries[], int x); |
|---|
| 390 | void tGroupTypeContent(void); |
|---|
| 391 | void tGroupTypeInputContent(void); |
|---|
| 392 | void tGroupTypeInput(unsigned uMode); |
|---|
| 393 | void tGroupTypeList(void); |
|---|
| 394 | void NewtGroupType(unsigned uMode); |
|---|
| 395 | void ModtGroupType(void); |
|---|
| 396 | void CreatetGroupType(void); |
|---|
| 397 | void DeletetGroupType(void); |
|---|
| 398 | void ExttGroupTypeGetHook(entry gentries[], int x); |
|---|
| 399 | void ExttGroupTypeNavBar(void); |
|---|
| 400 | |
|---|
| 401 | //tGroup |
|---|
| 402 | int tGroupCommands(pentry entries[], int x); |
|---|
| 403 | void tGroup(const char *results); |
|---|
| 404 | void ProcesstGroupVars(pentry entries[], int x); |
|---|
| 405 | void tGroupContent(void); |
|---|
| 406 | void tGroupInputContent(void); |
|---|
| 407 | void tGroupInput(unsigned uMode); |
|---|
| 408 | void tGroupList(void); |
|---|
| 409 | void NewtGroup(unsigned uMode); |
|---|
| 410 | void ModtGroup(void); |
|---|
| 411 | void CreatetGroup(void); |
|---|
| 412 | void DeletetGroup(void); |
|---|
| 413 | void ExttGroupGetHook(entry gentries[], int x); |
|---|
| 414 | void ExttGroupNavBar(void); |
|---|
| 415 | |
|---|
| 416 | //tGroupGlue |
|---|
| 417 | int tGroupGlueCommands(pentry entries[], int x); |
|---|
| 418 | void tGroupGlue(const char *results); |
|---|
| 419 | void ProcesstGroupGlueVars(pentry entries[], int x); |
|---|
| 420 | void tGroupGlueContent(void); |
|---|
| 421 | void tGroupGlueInputContent(void); |
|---|
| 422 | void tGroupGlueInput(unsigned uMode); |
|---|
| 423 | void tGroupGlueList(void); |
|---|
| 424 | void NewtGroupGlue(unsigned uMode); |
|---|
| 425 | void ModtGroupGlue(void); |
|---|
| 426 | void CreatetGroupGlue(void); |
|---|
| 427 | void DeletetGroupGlue(void); |
|---|
| 428 | void ExttGroupGlueGetHook(entry gentries[], int x); |
|---|
| 429 | void ExttGroupGlueNavBar(void); |
|---|
| 430 | |
|---|
| 431 | //tClient |
|---|
| 432 | int tClientCommands(pentry entries[], int x); |
|---|
| 433 | void tClient(const char *results); |
|---|
| 434 | void ProcesstClientVars(pentry entries[], int x); |
|---|
| 435 | void tClientContent(void); |
|---|
| 436 | void tClientInputContent(void); |
|---|
| 437 | void tClientInput(unsigned uMode); |
|---|
| 438 | void tClientList(void); |
|---|
| 439 | void NewtClient(unsigned uMode); |
|---|
| 440 | void ModtClient(void); |
|---|
| 441 | void CreatetClient(void); |
|---|
| 442 | void DeletetClient(void); |
|---|
| 443 | void ExttClientGetHook(entry gentries[], int x); |
|---|
| 444 | void ExttClientNavBar(void); |
|---|
| 445 | |
|---|
| 446 | //tAuthorize |
|---|
| 447 | int tAuthorizeCommands(pentry entries[], int x); |
|---|
| 448 | void tAuthorize(const char *results); |
|---|
| 449 | void ProcesstAuthorizeVars(pentry entries[], int x); |
|---|
| 450 | void tAuthorizeContent(void); |
|---|
| 451 | void tAuthorizeInputContent(void); |
|---|
| 452 | void tAuthorizeInput(unsigned uMode); |
|---|
| 453 | void tAuthorizeList(void); |
|---|
| 454 | void NewtAuthorize(unsigned uMode); |
|---|
| 455 | void ModtAuthorize(void); |
|---|
| 456 | void CreatetAuthorize(void); |
|---|
| 457 | void DeletetAuthorize(void); |
|---|
| 458 | void ExttAuthorizeGetHook(entry gentries[], int x); |
|---|
| 459 | void ExttAuthorizeNavBar(void); |
|---|
| 460 | |
|---|
| 461 | //tTemplate |
|---|
| 462 | int tTemplateCommands(pentry entries[], int x); |
|---|
| 463 | void tTemplate(const char *results); |
|---|
| 464 | void ProcesstTemplateVars(pentry entries[], int x); |
|---|
| 465 | void tTemplateContent(void); |
|---|
| 466 | void tTemplateInputContent(void); |
|---|
| 467 | void tTemplateInput(unsigned uMode); |
|---|
| 468 | void tTemplateList(void); |
|---|
| 469 | void NewtTemplate(unsigned uMode); |
|---|
| 470 | void ModtTemplate(void); |
|---|
| 471 | void CreatetTemplate(void); |
|---|
| 472 | void DeletetTemplate(void); |
|---|
| 473 | void ExttTemplateGetHook(entry gentries[], int x); |
|---|
| 474 | void ExttTemplateNavBar(void); |
|---|
| 475 | |
|---|
| 476 | //tTemplateSet |
|---|
| 477 | int tTemplateSetCommands(pentry entries[], int x); |
|---|
| 478 | void tTemplateSet(const char *results); |
|---|
| 479 | void ProcesstTemplateSetVars(pentry entries[], int x); |
|---|
| 480 | void tTemplateSetContent(void); |
|---|
| 481 | void tTemplateSetInputContent(void); |
|---|
| 482 | void tTemplateSetInput(unsigned uMode); |
|---|
| 483 | void tTemplateSetList(void); |
|---|
| 484 | void NewtTemplateSet(unsigned uMode); |
|---|
| 485 | void ModtTemplateSet(void); |
|---|
| 486 | void CreatetTemplateSet(void); |
|---|
| 487 | void DeletetTemplateSet(void); |
|---|
| 488 | void ExttTemplateSetGetHook(entry gentries[], int x); |
|---|
| 489 | void ExttTemplateSetNavBar(void); |
|---|
| 490 | |
|---|
| 491 | //tTemplateType |
|---|
| 492 | int tTemplateTypeCommands(pentry entries[], int x); |
|---|
| 493 | void tTemplateType(const char *results); |
|---|
| 494 | void ProcesstTemplateTypeVars(pentry entries[], int x); |
|---|
| 495 | void tTemplateTypeContent(void); |
|---|
| 496 | void tTemplateTypeInputContent(void); |
|---|
| 497 | void tTemplateTypeInput(unsigned uMode); |
|---|
| 498 | void tTemplateTypeList(void); |
|---|
| 499 | void NewtTemplateType(unsigned uMode); |
|---|
| 500 | void ModtTemplateType(void); |
|---|
| 501 | void CreatetTemplateType(void); |
|---|
| 502 | void DeletetTemplateType(void); |
|---|
| 503 | void ExttTemplateTypeGetHook(entry gentries[], int x); |
|---|
| 504 | void ExttTemplateTypeNavBar(void); |
|---|
| 505 | |
|---|
| 506 | //tLog |
|---|
| 507 | int tLogCommands(pentry entries[], int x); |
|---|
| 508 | void tLog(const char *results); |
|---|
| 509 | void ProcesstLogVars(pentry entries[], int x); |
|---|
| 510 | void tLogContent(void); |
|---|
| 511 | void tLogInputContent(void); |
|---|
| 512 | void tLogInput(unsigned uMode); |
|---|
| 513 | void tLogList(void); |
|---|
| 514 | void NewtLog(unsigned uMode); |
|---|
| 515 | void ModtLog(void); |
|---|
| 516 | void CreatetLog(void); |
|---|
| 517 | void DeletetLog(void); |
|---|
| 518 | void ExttLogGetHook(entry gentries[], int x); |
|---|
| 519 | void ExttLogNavBar(void); |
|---|
| 520 | |
|---|
| 521 | //tLogType |
|---|
| 522 | int tLogTypeCommands(pentry entries[], int x); |
|---|
| 523 | void tLogType(const char *results); |
|---|
| 524 | void ProcesstLogTypeVars(pentry entries[], int x); |
|---|
| 525 | void tLogTypeContent(void); |
|---|
| 526 | void tLogTypeInputContent(void); |
|---|
| 527 | void tLogTypeInput(unsigned uMode); |
|---|
| 528 | void tLogTypeList(void); |
|---|
| 529 | void NewtLogType(unsigned uMode); |
|---|
| 530 | void ModtLogType(void); |
|---|
| 531 | void CreatetLogType(void); |
|---|
| 532 | void DeletetLogType(void); |
|---|
| 533 | void ExttLogTypeGetHook(entry gentries[], int x); |
|---|
| 534 | void ExttLogTypeNavBar(void); |
|---|
| 535 | |
|---|
| 536 | //tLogMonth |
|---|
| 537 | int tLogMonthCommands(pentry entries[], int x); |
|---|
| 538 | void tLogMonth(const char *results); |
|---|
| 539 | void ProcesstLogMonthVars(pentry entries[], int x); |
|---|
| 540 | void tLogMonthContent(void); |
|---|
| 541 | void tLogMonthInputContent(void); |
|---|
| 542 | void tLogMonthInput(unsigned uMode); |
|---|
| 543 | void tLogMonthList(void); |
|---|
| 544 | void NewtLogMonth(unsigned uMode); |
|---|
| 545 | void ModtLogMonth(void); |
|---|
| 546 | void CreatetLogMonth(void); |
|---|
| 547 | void DeletetLogMonth(void); |
|---|
| 548 | void ExttLogMonthGetHook(entry gentries[], int x); |
|---|
| 549 | void ExttLogMonthNavBar(void); |
|---|
| 550 | |
|---|
| 551 | //tMonth |
|---|
| 552 | int tMonthCommands(pentry entries[], int x); |
|---|
| 553 | void tMonth(const char *results); |
|---|
| 554 | void ProcesstMonthVars(pentry entries[], int x); |
|---|
| 555 | void tMonthContent(void); |
|---|
| 556 | void tMonthInputContent(void); |
|---|
| 557 | void tMonthInput(unsigned uMode); |
|---|
| 558 | void tMonthList(void); |
|---|
| 559 | void NewtMonth(unsigned uMode); |
|---|
| 560 | void ModtMonth(void); |
|---|
| 561 | void CreatetMonth(void); |
|---|
| 562 | void DeletetMonth(void); |
|---|
| 563 | void ExttMonthGetHook(entry gentries[], int x); |
|---|
| 564 | void ExttMonthNavBar(void); |
|---|
| 565 | |
|---|
| 566 | //tGlossary |
|---|
| 567 | int tGlossaryCommands(pentry entries[], int x); |
|---|
| 568 | void tGlossary(const char *results); |
|---|
| 569 | void ProcesstGlossaryVars(pentry entries[], int x); |
|---|
| 570 | void tGlossaryContent(void); |
|---|
| 571 | void tGlossaryInputContent(void); |
|---|
| 572 | void tGlossaryInput(unsigned uMode); |
|---|
| 573 | void tGlossaryList(void); |
|---|
| 574 | void NewtGlossary(unsigned uMode); |
|---|
| 575 | void ModtGlossary(void); |
|---|
| 576 | void CreatetGlossary(void); |
|---|
| 577 | void DeletetGlossary(void); |
|---|
| 578 | void ExttGlossaryGetHook(entry gentries[], int x); |
|---|
| 579 | void ExttGlossaryNavBar(void); |
|---|
| 580 | |
|---|
| 581 | //tJob |
|---|
| 582 | int tJobCommands(pentry entries[], int x); |
|---|
| 583 | void tJob(const char *results); |
|---|
| 584 | void ProcesstJobVars(pentry entries[], int x); |
|---|
| 585 | void tJobContent(void); |
|---|
| 586 | void tJobInputContent(void); |
|---|
| 587 | void tJobInput(unsigned uMode); |
|---|
| 588 | void tJobList(void); |
|---|
| 589 | void NewtJob(unsigned uMode); |
|---|
| 590 | void ModtJob(void); |
|---|
| 591 | void CreatetJob(void); |
|---|
| 592 | void DeletetJob(void); |
|---|
| 593 | void ExttJobGetHook(entry gentries[], int x); |
|---|
| 594 | void ExttJobNavBar(void); |
|---|
| 595 | |
|---|
| 596 | //tJobStatus |
|---|
| 597 | int tJobStatusCommands(pentry entries[], int x); |
|---|
| 598 | void tJobStatus(const char *results); |
|---|
| 599 | void ProcesstJobStatusVars(pentry entries[], int x); |
|---|
| 600 | void tJobStatusContent(void); |
|---|
| 601 | void tJobStatusInputContent(void); |
|---|
| 602 | void tJobStatusInput(unsigned uMode); |
|---|
| 603 | void tJobStatusList(void); |
|---|
| 604 | void NewtJobStatus(unsigned uMode); |
|---|
| 605 | void ModtJobStatus(void); |
|---|
| 606 | void CreatetJobStatus(void); |
|---|
| 607 | void DeletetJobStatus(void); |
|---|
| 608 | void ExttJobStatusGetHook(entry gentries[], int x); |
|---|
| 609 | void ExttJobStatusNavBar(void); |
|---|
| 610 | |
|---|
| 611 | //tStatus |
|---|
| 612 | int tStatusCommands(pentry entries[], int x); |
|---|
| 613 | void tStatus(const char *results); |
|---|
| 614 | void ProcesstStatusVars(pentry entries[], int x); |
|---|
| 615 | void tStatusContent(void); |
|---|
| 616 | void tStatusInputContent(void); |
|---|
| 617 | void tStatusInput(unsigned uMode); |
|---|
| 618 | void tStatusList(void); |
|---|
| 619 | void NewtStatus(unsigned uMode); |
|---|
| 620 | void ModtStatus(void); |
|---|
| 621 | void CreatetStatus(void); |
|---|
| 622 | void DeletetStatus(void); |
|---|
| 623 | void ExttStatusGetHook(entry gentries[], int x); |
|---|
| 624 | void ExttStatusNavBar(void); |
|---|
| 625 | |
|---|
| 626 | //tConfiguration |
|---|
| 627 | int tConfigurationCommands(pentry entries[], int x); |
|---|
| 628 | void tConfiguration(const char *results); |
|---|
| 629 | void ProcesstConfigurationVars(pentry entries[], int x); |
|---|
| 630 | void tConfigurationContent(void); |
|---|
| 631 | void tConfigurationInputContent(void); |
|---|
| 632 | void tConfigurationInput(unsigned uMode); |
|---|
| 633 | void tConfigurationList(void); |
|---|
| 634 | void NewtConfiguration(unsigned uMode); |
|---|
| 635 | void ModtConfiguration(void); |
|---|
| 636 | void CreatetConfiguration(void); |
|---|
| 637 | void DeletetConfiguration(void); |
|---|
| 638 | void ExttConfigurationGetHook(entry gentries[], int x); |
|---|
| 639 | void ExttConfigurationNavBar(void); |
|---|
| 640 | |
|---|
| 641 | //glossary.c |
|---|
| 642 | void GlossaryGetHook(entry gentries[],int x); |
|---|
| 643 | |
|---|
| 644 | |
|---|
| 645 | //In-line code macros |
|---|
| 646 | |
|---|
| 647 | //Common |
|---|
| 648 | #define _RUN_QUERY mysql_query(&gMysql,gcQuery);if(mysql_errno(&gMysql)) |
|---|
| 649 | |
|---|
| 650 | //MySQL run query only w/error checking |
|---|
| 651 | //HTML |
|---|
| 652 | #define MYSQL_RUN _RUN_QUERY htmlPlainTextError(mysql_error(&gMysql)) |
|---|
| 653 | //Text |
|---|
| 654 | #define MYSQL_RUN_TEXT _RUN_QUERY{fprintf(stderr,"%s\n",mysql_error(&gMysql));exit(1);} |
|---|
| 655 | |
|---|
| 656 | //Text with return() instead of exit() |
|---|
| 657 | //return(1); if MySQL error |
|---|
| 658 | #define MYSQL_RUN_TEXT_RETURN _RUN_QUERY{fprintf(stderr,"%s\n",mysql_error(&gMysql));return(1);} |
|---|
| 659 | //return; if MySQL error |
|---|
| 660 | #define MYSQL_RUN_TEXT_RET_VOID _RUN_QUERY{fprintf(stderr,"%s\n",mysql_error(&gMysql));return;} |
|---|
| 661 | |
|---|
| 662 | //MySQL run query and store result w/error checking |
|---|
| 663 | //HTML |
|---|
| 664 | #define MYSQL_RUN_STORE(res) MYSQL_RUN;res=mysql_store_result(&gMysql) |
|---|
| 665 | //Text |
|---|
| 666 | #define MYSQL_RUN_STORE_TEXT(res) MYSQL_RUN_TEXT;res=mysql_store_result(&gMysql) |
|---|
| 667 | |
|---|
| 668 | //MySQL run query and store result w/error checking (Text); uses return() call instead of exit() |
|---|
| 669 | //return(1); if MySQL error |
|---|
| 670 | #define MYSQL_RUN_STORE_TEXT_RETURN(res) MYSQL_RUN_TEXT_RETURN res=mysql_store_result(&gMysql) |
|---|
| 671 | //return; if MySQL error |
|---|
| 672 | #define MYSQL_RUN_STORE_TEXT_RET_VOID(res) MYSQL_RUN_TEXT_RET_VOID res=mysql_store_result(&gMysql) |
|---|
| 673 | |
|---|
| 674 | //In-line code macros rev 2 |
|---|
| 675 | |
|---|
| 676 | //Common - This macro shouldn't be used directly, as is part of the others only |
|---|
| 677 | #define macro_mySQLQueryBasic mysql_query(&gMysql,gcQuery);\ |
|---|
| 678 | if(mysql_errno(&gMysql)) |
|---|
| 679 | |
|---|
| 680 | //MySQL run query only w/error checking |
|---|
| 681 | //HTML |
|---|
| 682 | #define macro_mySQLQueryHTMLError macro_mySQLQueryBasic \ |
|---|
| 683 | htmlPlainTextError(mysql_error(&gMysql)) |
|---|
| 684 | //Text |
|---|
| 685 | #define macro_mySQLQueryTextError macro_mySQLQueryBasic\ |
|---|
| 686 | {\ |
|---|
| 687 | fprintf(stderr,"%s\n",mysql_error(&gMysql));\ |
|---|
| 688 | exit(1);\ |
|---|
| 689 | } |
|---|
| 690 | |
|---|
| 691 | //Text with return() instead of exit() |
|---|
| 692 | //return(1); if MySQL error |
|---|
| 693 | #define macro_mySQLRunReturnInt macro_mySQLQueryBasic\ |
|---|
| 694 | {\ |
|---|
| 695 | fprintf(stderr,"%s\n",mysql_error(&gMysql));\ |
|---|
| 696 | return(1);\ |
|---|
| 697 | } |
|---|
| 698 | //return void; if MySQL error |
|---|
| 699 | #define macro_mySQLRunReturnVoid macro_mySQLQueryBasic\ |
|---|
| 700 | {\ |
|---|
| 701 | fprintf(stderr,"%s\n",mysql_error(&gMysql));\ |
|---|
| 702 | return;\ |
|---|
| 703 | } |
|---|
| 704 | |
|---|
| 705 | //MySQL run query and store result w/error checking |
|---|
| 706 | //HTML |
|---|
| 707 | #define macro_mySQLRunAndStore(res) macro_mySQLQueryHTMLError;\ |
|---|
| 708 | res=mysql_store_result(&gMysql) |
|---|
| 709 | //Text |
|---|
| 710 | #define macro_mySQLRunAndStoreText(res) macro_mySQLQueryTextError;\ |
|---|
| 711 | res=mysql_store_result(&gMysql) |
|---|
| 712 | |
|---|
| 713 | //MySQL run query and store result w/error checking (Text); uses return() call instead of exit() |
|---|
| 714 | //return(1); if MySQL error |
|---|
| 715 | #define macro_mySQLRunAndStoreTextIntRet(res) macro_mySQLRunReturnInt;\ |
|---|
| 716 | res=mysql_store_result(&gMysql) |
|---|
| 717 | //return; if MySQL error |
|---|
| 718 | #define macro_mySQLRunAndStoreTextVoidRet(res) macro_mySQLRunReturnVoid;\ |
|---|
| 719 | res=mysql_store_result(&gMysql) |
|---|
| 720 | |
|---|
| 721 | //Backup container constants |
|---|
| 722 | #define HOT_CLONE 0 |
|---|
| 723 | #define WARM_CLONE 1 |
|---|
| 724 | #define COLD_CLONE 2 |
|---|
| 725 | |
|---|
| 726 | //Table Variables |
|---|
| 727 | |
|---|
| 728 | |
|---|
| 729 | void GetContainerProp(const unsigned uContainer,const char *cName,char *cValue); |
|---|
| 730 | void ChangeGroup(unsigned uContainer, unsigned uGroup); |
|---|
| 731 | unsigned uGetGroup(unsigned uNode, unsigned uContainer); |
|---|