From cvs w lms.org.pl Fri Apr 2 13:48:30 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 2 Apr 2010 13:48:30 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (domainedit.php) Message-ID: <20100402114830.1A9633027B2D@hydra.altec.pl> Date: Friday, April 2, 2010 @ 13:48:30 Author: alec Path: /cvsroot/lms/modules Modified: domainedit.php - BTS#0000825: fixed tariff limits checking in domain edition Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/domainedit.php.diff?&r1=1.30&r2=1.31 Index: lms/modules/domainedit.php diff -u lms/modules/domainedit.php:1.30 lms/modules/domainedit.php:1.31 --- lms/modules/domainedit.php:1.30 Thu Mar 11 14:07:46 2010 +++ lms/modules/domainedit.php Fri Apr 2 13:48:30 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: domainedit.php,v 1.30 2010/03/11 13:07:46 alec Exp $ + * $Id: domainedit.php,v 1.31 2010/04/02 11:48:30 alec Exp $ */ function GetDomainIdByName($name) @@ -80,6 +80,8 @@ if($domain['ownerid'] && $domain['ownerid'] != $oldowner) { + $limits = $LMS->GetHostingLimits($domain['ownerid']); + if($limits['domain_limit'] !== NULL) { if($limits['domain_limit'] > 0) From cvs w lms.org.pl Fri Apr 2 13:48:29 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 2 Apr 2010 13:48:29 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20100402114830.068D13027B29@hydra.altec.pl> Date: Friday, April 2, 2010 @ 13:48:29 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - BTS#0000825: fixed tariff limits checking in domain edition Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1486&r2=1.1487 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1486 lms/doc/ChangeLog:1.1487 --- lms/doc/ChangeLog:1.1486 Tue Mar 30 09:29:07 2010 +++ lms/doc/ChangeLog Fri Apr 2 13:48:29 2010 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1486 2010/03/30 07:29:07 alec Exp $ +$Id: ChangeLog,v 1.1487 2010/04/02 11:48:29 alec Exp $ version ? (????-??-??) @@ -53,7 +53,8 @@ - Added peak memory usage info in page footer (alec) - Added EtherWerX STM channels management (alec) - we can omit stats data in database backup (chilan) - - fix encoding of mail messages sent by perl scripts (alec) + - fixed encoding of mail messages sent by perl scripts (alec) + - BTS#0000825: fixed tariff limits checking in domain edition (alec) version 1.11.9 Moloc (2009-10-28): From cvs w lms.org.pl Fri Apr 2 17:21:38 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 2 Apr 2010 17:21:38 +0200 (CEST) Subject: [lms-commits] CVS update of lms/daemon/modules/ewx-stm-channels [new] Message-ID: <20100402152138.2AB1C3027B29@hydra.altec.pl> Date: Friday, April 2, 2010 @ 17:21:38 Author: alec Path: /cvsroot/lms/daemon/modules/ewx-stm-channels Directory /cvsroot/lms/daemon/modules/ewx-stm-channels added to the repository From cvs w lms.org.pl Fri Apr 2 17:26:09 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 2 Apr 2010 17:26:09 +0200 (CEST) Subject: [lms-commits] CVS update of lms/daemon/modules/ewx-stm-channels (3 files) Message-ID: <20100402152609.3A3A93027B29@hydra.altec.pl> Date: Friday, April 2, 2010 @ 17:26:09 Author: alec Path: /cvsroot/lms/daemon/modules/ewx-stm-channels Added: Makefile.in ewx-stm-channels.c ewx-stm-channels.h - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/ewx-stm-channels/Makefile.in?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/ewx-stm-channels/ewx-stm-channels.c?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/ewx-stm-channels/ewx-stm-channels.h?rev=1.1 Index: lms/daemon/modules/ewx-stm-channels/Makefile.in diff -u /dev/null lms/daemon/modules/ewx-stm-channels/Makefile.in:1.1 --- /dev/null Fri Apr 2 17:26:09 2010 +++ lms/daemon/modules/ewx-stm-channels/Makefile.in Fri Apr 2 17:26:09 2010 @@ -0,0 +1,22 @@ + +CFLAGS += `net-snmp-config --cflags` +LDFLAGS += `net-snmp-config --ldflags` +LIBS += `net-snmp-config --libs` + +SOURCES = ewx-stm-channels.c +OBJECTS = ${SOURCES:.c=.o} + +OUT = ewx-stm-channels.so + +all: $(OUT) + +$(OUT): ${OBJECTS} + gcc -shared $(OBJECTS) -o $(OUT) $(LDFLAGS) $(LIBS) + rm -rf $(OBJECTS) + +clean: + rm -rf $(OUT) $(OBJECTS) + +install: + install -c -m 755 $(OUT) $(MODULESDIR) + strip $(MODULESDIR)/$(OUT) Index: lms/daemon/modules/ewx-stm-channels/ewx-stm-channels.c diff -u /dev/null lms/daemon/modules/ewx-stm-channels/ewx-stm-channels.c:1.1 --- /dev/null Fri Apr 2 17:26:09 2010 +++ lms/daemon/modules/ewx-stm-channels/ewx-stm-channels.c Fri Apr 2 17:26:09 2010 @@ -0,0 +1,1759 @@ +/* + * LMS version 1.11-cvs + * + * (C) Copyright 2001-2010 LMS Developers + * + * Please, see the doc/AUTHORS for more information about authors! + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License Version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + * + * $Id: ewx-stm-channels.c,v 1.1 2010/04/02 15:26:09 alec Exp $ + */ + +#include +#include +#include +#include +#include +#include + +#include "lmsd.h" +#include "ewx-stm-channels.h" + +int del_channel(GLOBAL *, struct ewx_module*, struct snmp_session*, struct channel*); +int add_channel(GLOBAL *, struct ewx_module*, struct snmp_session*, struct channel*); +int update_channel(GLOBAL *, struct ewx_module*, struct snmp_session*, struct channel*, struct channel*); +int mod_channel(GLOBAL *, struct ewx_module*, struct snmp_session*, int, int, int); +int del_node(GLOBAL *, struct ewx_module*, struct snmp_session*, struct host*); +int add_node(GLOBAL *, struct ewx_module*, struct snmp_session*, struct host*, int); +int update_node(GLOBAL *, struct ewx_module*, struct snmp_session*, struct host*, struct host); +int save_tables(GLOBAL *, struct ewx_module*, struct snmp_session*); + +char * itoa(int i) +{ + static char string[15]; + sprintf(string, "%d", i); + return string; +} + +int find_asterisk(const char *str) +{ + int i, len; + + for(i=0, len = strlen(str); ipath) + { + syslog(LOG_ERR, "[%s/ewx-stm-channels] Option 'path' not specified", ewx->base.instance); + return; + } + + // Initialize the SNMP library (reading lmsd-ewx-stm.conf and snmp.conf) + init_snmp("lmsd-ewx-stm"); + + // Initialize a "session" that defines who we're going to talk to + snmp_sess_init(&session); // setting up defaults + session.version = SNMP_VERSION_2c; // SNMP version number + session.peername = ewx->host; // destination IP/name + session.remote_port = ewx->port; // destination port +// session.timeout = 1000000; // timeout in microsec. + session.community = (unsigned char *) ewx->community; // community name + session.community_len = strlen(ewx->community); + + // man snmpcmd (-Oq) + netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT); + + // Open the session + sh = snmp_open(&session); + + if(!sh) + { + snmp_error(&session, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] SNMP ERROR: %s", ewx->base.instance, errstr); + free(errstr); + return; + } + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_GET); + + // Getting path's uplink and downlink values is good reason to check + // communication with our device + PathUplink[STM_OID_LEN-1] = ewx->path; + PathDownlink[STM_OID_LEN-1] = ewx->path; + snmp_add_null_var(pdu, PathUplink, STM_OID_LEN); + snmp_add_null_var(pdu, PathDownlink, STM_OID_LEN); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { + struct variable_list *vars; + char buf[MAX_OID_LEN]; + + for(vars = response->variables; vars; vars = vars->next_variable) + { + snprint_objid(buf, MAX_OID_LEN, vars->name, vars->name_length); + + if(vars->name[STM_OID_LEN-2]==3) + { + snprint_value(buf, MAX_OID_LEN, vars->name, vars->name_length, vars); + pathuplink = atoi(buf); + } + else if(vars->name[STM_OID_LEN-2]==4) + { + snprint_value(buf, MAX_OID_LEN, vars->name, vars->name_length, vars); + pathdownlink = atoi(buf); + } + } + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot read path's data. %s", ewx->base.instance, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot read path's data. %s", ewx->base.instance, errstr); + free(errstr); + } + return; + } + + // Clean up + if(response) + snmp_free_pdu(response); + + snmp_close(sh); + + // If communication works, we can do the job... + customers = (struct channel *) malloc(sizeof(struct channel)); + channels = (struct channel *) malloc(sizeof(struct channel)); + nets = (struct net *) malloc(sizeof(struct net)); + all_nets = (struct net *) malloc(sizeof(struct net)); + mac_nets = (struct net *) malloc(sizeof(struct net)); + ip_nets = (struct net *) malloc(sizeof(struct net)); + emac_nets = (struct net *) malloc(sizeof(struct net)); + eip_nets = (struct net *) malloc(sizeof(struct net)); + + // get all networks params + res = g->db_pquery(g->conn, "SELECT UPPER(name) AS name, address, " + "INET_ATON(mask) AS mask, interface FROM networks"); + + for(anc=0; ancdb_nrows(res); anc++) + { + all_nets = (struct net*) realloc(all_nets, (sizeof(struct net) * (anc+1))); + all_nets[anc].name = strdup(g->db_get_data(res, anc, "name")); + all_nets[anc].address = inet_addr(g->db_get_data(res, anc, "address")); + all_nets[anc].mask = inet_addr(g->db_get_data(res, anc, "mask")); + } + g->db_free(&res); + + n = 2; + netnames = strdup(ewx->networks); + netname = strdup(netnames); + + // get networks for filter if any specified in 'networks' option + while( n>1 ) + { + n = sscanf(netnames, "%s %[._a-zA-Z0-9- ]", netname, netnames); + if(strlen(netname)) + { + for(i=0; istr_upc(netname))==0) + break; + + if(i != anc) + { + nets = (struct net *) realloc(nets, (sizeof(struct net) * (nc+1))); + nets[nc].address = all_nets[i].address; + nets[nc].mask = all_nets[i].mask; + nets[nc].name = strdup(all_nets[i].name); + nc++; + } + } + } + free(netname); free(netnames); + + n = 2; + netnames = strdup(ewx->dummy_mac_networks); + netname = strdup(netnames); + + // get networks for filter if any specified in 'dummy_mac_networks' + // option, use '*' for all networks + if(find_asterisk(ewx->dummy_mac_networks)) + { + for(i=0; i1 ) + { + n = sscanf(netnames, "%s %[._a-zA-Z0-9- ]", netname, netnames); + if(strlen(netname)) + { + for(i=0; istr_upc(netname))==0) + break; + + if(i != anc) + { + mac_nets = (struct net *) realloc(mac_nets, (sizeof(struct net) * (mnc+1))); + mac_nets[mnc].address = all_nets[i].address; + mac_nets[mnc].mask = all_nets[i].mask; + mac_nets[mnc].name = strdup(all_nets[i].name); + mnc++; + } + } + } + free(netname); free(netnames); + + n = 2; + netnames = strdup(ewx->dummy_ip_networks); + netname = strdup(netnames); + + // get networks for filter if any specified in 'dummy_ip_networks' + // option, use '*' for all networks + if(find_asterisk(ewx->dummy_ip_networks)) + { + for(i=0; i1 ) + { + n = sscanf(netnames, "%s %[._a-zA-Z0-9- ]", netname, netnames); + if(strlen(netname)) + { + for(i=0; istr_upc(netname))==0) + break; + + if(i != anc) + { + // same networks can't be included in both dummy_* options + for(j=0; jbase.instance); + continue; + } + + ip_nets = (struct net *) realloc(ip_nets, (sizeof(struct net) * (inc+1))); + ip_nets[inc].address = all_nets[i].address; + ip_nets[inc].mask = all_nets[i].mask; + ip_nets[inc].name = strdup(all_nets[i].name); + inc++; + } + } + } + free(netname); free(netnames); + + n = 2; + netnames = strdup(ewx->excluded_dummy_ip_networks); + netname = strdup(netnames); + + // get networks for filter if any specified in 'excluded_dummy_ip_networks' + while( n>1 ) + { + n = sscanf(netnames, "%s %[._a-zA-Z0-9- ]", netname, netnames); + if(strlen(netname)) + { + for(i=0; istr_upc(netname))==0) + break; + + if(i != anc) + { + eip_nets = (struct net *) realloc(eip_nets, (sizeof(struct net) * (einc+1))); + eip_nets[einc].address = all_nets[i].address; + eip_nets[einc].mask = all_nets[i].mask; + eip_nets[einc].name = strdup(all_nets[i].name); + einc++; + } + } + } + free(netname); free(netnames); + + n = 2; + netnames = strdup(ewx->excluded_dummy_mac_networks); + netname = strdup(netnames); + + // get networks for filter if any specified in 'excluded_dummy_mac_networks' + while( n>1 ) + { + n = sscanf(netnames, "%s %[._a-zA-Z0-9- ]", netname, netnames); + if(strlen(netname)) + { + for(i=0; istr_upc(netname))==0) + break; + + if(i != anc) + { + emac_nets = (struct net *) realloc(emac_nets, (sizeof(struct net) * (emnc+1))); + emac_nets[emnc].address = all_nets[i].address; + emac_nets[emnc].mask = all_nets[i].mask; + emac_nets[emnc].name = strdup(all_nets[i].name); + emnc++; + } + } + } + free(netname); free(netnames); + + // excluded networks filter + enets = strdup(" AND NOT EXISTS (SELECT 1 FROM networks net " + "WHERE (%enets) " + "AND ((n.ipaddr > net.address AND n.ipaddr < broadcast(net.address, inet_aton(net.mask))) " + "OR (n.ipaddr_pub > net.address AND n.ipaddr_pub < broadcast(net.address, inet_aton(net.mask)))) " + ")"); + + netnames = strdup(ewx->excluded_networks); + netname = strdup(netnames); + enetsql = strdup(""); + o = 2; + + while( o>1 ) + { + o = sscanf(netnames, "%s %[._a-zA-Z0-9- ]", netname, netnames); + + if( strlen(netname) ) + { + enetsql = realloc(enetsql, sizeof(char *) * (strlen(enetsql) + strlen(netname) + 30)); + if(strlen(enetsql)) + strcat(enetsql, " OR UPPER(net.name) = UPPER('"); + else + strcat(enetsql, "UPPER(net.name) = UPPER('"); + + strcat(enetsql, netname); + strcat(enetsql, "')"); + } + } + free(netname); free(netnames); + + if(strlen(enetsql)) + g->str_replace(&enets, "%enets", enetsql); + + // handle night-time tariffs + if (strlen(ewx->night_hours)) + { + int start_h, end_h; + + if (sscanf(ewx->night_hours, "%d-%d", &start_h, &end_h) == 2) + { + // get current date + time_t t = time(NULL); + struct tm *tt = localtime(&t); + int hour = tt->tm_hour; + + if (end_h < 18) end_h += 24; + if (start_h < 18) start_h += 24; + if (hour < 18) hour += 24; + + if (start_h >= end_h) + syslog(LOG_ERR, "[%s/ewx-stm-channels] Wrong 'night_hours' format: %s", ewx->base.instance, ewx->night_hours); + else if (hour >= start_h && hour < end_h) + night = 1; + } + else + syslog(LOG_ERR, "[%s/ewx-stm-channels] Wrong 'night_hours' format: %s", ewx->base.instance, ewx->night_hours); + } + + // channels + query = strdup("SELECT id, name, upceil, downceil FROM ewx_channels"); + + if (night) + { + g->str_replace(&query, "downceil", "(CASE WHEN downceil_n > 0 THEN downceil_n ELSE downceil END)"); + g->str_replace(&query, "upceil", "(CASE WHEN upceil_n > 0 THEN upceil_n ELSE upceil END)"); + } + + res = g->db_query(g->conn, query); + + for(i=0; idb_nrows(res); i++) + { + int cid = atoi(g->db_get_data(res,i,"id")); + int upceil = atoi(g->db_get_data(res,i,"upceil")); + int downceil = atoi(g->db_get_data(res,i,"downceil")); + + customers = (struct channel *) realloc(customers, (sizeof(struct channel) * (cc+1))); + customers[cc].cid = cid; + customers[cc].upceil = upceil; + customers[cc].downceil = downceil; + customers[cc].no = 0; + customers[cc].downratesum = 0; + customers[cc].upratesum = 0; + customers[cc].hosts = NULL; + customers[cc].status = UNKNOWN; + cc++; + } + g->db_free(&res); + free(query); + + // hosts + query = strdup("SELECT t.downrate, t.downceil, t.uprate, t.upceil, n.mac, n.chkmac, " + "n.id, INET_NTOA(n.ipaddr) AS ip, n.halfduplex, d.channelid " + "FROM nodeassignments na " + "JOIN assignments a ON (na.assignmentid = a.id)" + "JOIN tariffs t ON (a.tariffid = t.id) " + "JOIN nodes n ON (na.nodeid = n.id) " + "LEFT JOIN netdevices d ON (n.netdev = d.id) " + "WHERE " + "(a.datefrom <= %NOW% OR a.datefrom = 0) AND (a.dateto >= %NOW% OR a.dateto = 0)" + "%disabled" + "%enets" + ); + + g->str_replace(&query, "%disabled", ewx->skip_disabled ? " AND n.access = 1" : ""); + g->str_replace(&query, "%enets", strlen(enetsql) ? enets : ""); + + if (night) + { + g->str_replace(&query, "t.downrate", "(CASE WHEN t.downrate_n > 0 THEN t.downrate_n ELSE t.downrate END) AS downrate"); + g->str_replace(&query, "t.downceil", "(CASE WHEN t.downceil_n > 0 THEN t.downceil_n ELSE t.downceil END) AS downceil"); + g->str_replace(&query, "t.uprate", "(CASE WHEN t.uprate_n > 0 THEN t.uprate_n ELSE t.uprate END) AS uprate"); + g->str_replace(&query, "t.upceil", "(CASE WHEN t.upceil_n > 0 THEN t.upceil_n ELSE t.upceil END) AS upceil"); + } + + res = g->db_query(g->conn, query); + + // adding hosts to customers array + for(i=0; idb_nrows(res); i++) + { + int channelid = atoi(g->db_get_data(res,i,"channelid")); + int hostid = atoi(g->db_get_data(res,i,"id")); + char *ip = g->db_get_data(res,i,"ip"); + unsigned long inet = inet_addr(ip); + + // looking for a channel + for(j=0; jdefault_upceil && ewx->default_downceil) + { + customers = (struct channel *) realloc(customers, (sizeof(struct channel) * (cc+1))); + customers[cc].cid = 0; + customers[cc].upceil = ewx->default_upceil; + customers[cc].downceil = ewx->default_downceil; + customers[cc].no = 0; + customers[cc].downratesum = 0; + customers[cc].upratesum = 0; + customers[cc].hosts = NULL; + customers[cc].status = UNKNOWN; + cc++; + } + else + continue; + } + + // Networks test + if(nc) + { + for(n=0; ndb_get_data(res,i,"uprate")); + int downrate = atoi(g->db_get_data(res,i,"downrate")); + int upceil = atoi(g->db_get_data(res,i,"upceil")); + int downceil = atoi(g->db_get_data(res,i,"downceil")); + + // looking for host + for(k=0; kdb_get_data(res,i,"chkmac"))) + { + dummy_mac = 1; + } + + // Networks test for dummy_ip + if(inc && !dummy_mac) + { + for(n=0; ndb_get_data(res,i,"halfduplex")); + + if(!dummy_ip) + customers[j].hosts[k].ip = strdup(ip); + else + customers[j].hosts[k].ip = strdup(DUMMY_IP); + + if(!dummy_mac) + customers[j].hosts[k].mac = strdup(g->db_get_data(res,i,"mac")); + else + customers[j].hosts[k].mac = strdup(DUMMY_MAC); + + customers[j].downratesum += downrate; + customers[j].upratesum += uprate; + customers[j].no++; + } + else + { + customers[j].hosts[k].uprate += uprate; + customers[j].hosts[k].upceil += upceil; + customers[j].hosts[k].downrate += downrate; + customers[j].hosts[k].downceil += downceil; + customers[j].downratesum += downrate; + customers[j].upratesum += uprate; + } + } + g->db_free(&res); + free(query); + + // Przelecmy po wszystkich kanalach i komputerach, zliczajac sumy rate i ceil + // aby nie przekroczyc wartosci ustawionych dla sciezek na urzadzeniu. + // Dodatkowo zmniejszymy rate komputerow w kanalach, jesli suma rate przekracza ceil kanalu + for(i=0; i c.upceil) + c.hosts[k].uprate = c.hosts[k].uprate / (double) c.upratesum * c.upceil; + if(c.downratesum > c.downceil) + c.hosts[k].downrate = c.hosts[k].downrate / (double) c.downratesum * c.downceil; + // make sure node ceil is not greater tham channel ceil + if(c.upceil < c.hosts[k].upceil) + c.hosts[k].upceil = c.upceil; + if(c.downceil < c.hosts[k].downceil) + c.hosts[k].downceil = c.downceil; + + globaluprate += c.hosts[k].uprate; + globaldownrate += c.hosts[k].downrate; + } + + maxupceil = maxupceil < c.upceil ? c.upceil : maxupceil; + maxdownceil = maxdownceil < c.downceil ? c.downceil : maxdownceil; + } + +//printf("SUMMARY: %d/%d (%d/%d)\n", globaldownrate, globaluprate, pathdownlink, pathuplink); +//printf("SUMMARY: %d/%d (%d/%d)\n", maxdownceil, maxupceil, pathdownlink, pathuplink); + + // path limits checking + if(globaluprate>pathuplink || globaldownrate>pathdownlink) + { + syslog(LOG_ERR, "[%s/ewx-stm-channels] Path is too small. Need Uplink: %d, Downlink: %d. Exiting.", ewx->base.instance, globaluprate, globaldownrate); + return; + } + + if(maxupceil>pathuplink || maxdownceil>pathdownlink) + { + syslog(LOG_ERR, "[%s/ewx-stm-channels] Path is too small. Need Uplink: %d, Downlink: %d. Exiting.", ewx->base.instance, maxupceil, maxdownceil); + return; + } + + // Reading hosts/channels definitions from ewx_stm_* tables + // NOTE: to re-create device configuration do DELETE FROM ewx_stm_nodes; DELETE FROM ewx_stm_channels; + query = strdup("SELECT id, cid, upceil, downceil FROM ewx_stm_channels"); + + res = g->db_query(g->conn, query); + + for(i=0; idb_nrows(res); i++) + { + int id = atoi(g->db_get_data(res,i,"id")); + int cid = atoi(g->db_get_data(res,i,"cid")); + int upceil = atoi(g->db_get_data(res,i,"upceil")); + int downceil = atoi(g->db_get_data(res,i,"downceil")); + + channels = (struct channel *) realloc(channels, (sizeof(struct channel) * (sc+1))); + channels[sc].id = id; + channels[sc].cid = cid; + channels[sc].upceil = upceil; + channels[sc].downceil = downceil; + channels[sc].upratesum = 0; + channels[sc].downratesum = 0; + channels[sc].no = 0; + channels[sc].hosts = NULL; + channels[sc].status = UNKNOWN; + sc++; + } + g->db_free(&res); + free(query); + + query = strdup("SELECT nodeid, mac, INET_NTOA(ipaddr) AS ip, channelid, halfduplex, " + "n.uprate, n.upceil, n.downrate, n.downceil, c.cid, " + "c.upceil AS cupceil, c.downceil AS cdownceil " + "FROM ewx_stm_nodes n " + "LEFT JOIN ewx_stm_channels c ON (c.id = n.channelid)" + ); + + res = g->db_query(g->conn, query); + + // Creating current config array + for(i=0; idb_nrows(res); i++) + { + int channelid = atoi(g->db_get_data(res,i,"channelid")); + int hostid = atoi(g->db_get_data(res,i,"nodeid")); + char *ip = g->db_get_data(res,i,"ip"); + unsigned long inet = inet_addr(ip); + + // Networks test + if(nc && inet) + { + for(j=0; jdb_get_data(res,i,"cupceil")); + int cdownceil = atoi(g->db_get_data(res,i,"cdownceil")); + + channels = (struct channel *) realloc(channels, (sizeof(struct channel) * (sc+1))); + channels[sc].id = channelid; + channels[sc].cid = atoi(g->db_get_data(res,i,"cid")); + channels[sc].upceil = cupceil ? cupceil : ewx->default_upceil; + channels[sc].downceil = cdownceil ? cdownceil : ewx->default_downceil; + channels[sc].upratesum = 0; + channels[sc].downratesum = 0; + channels[sc].no = 0; + channels[sc].hosts = NULL; + channels[sc].status = UNKNOWN; + sc++; + } + + k = channels[j].no; + + channels[j].hosts = (struct host *) realloc(channels[j].hosts, (sizeof(struct host) * (k+1))); + channels[j].hosts[k].id = hostid; + channels[j].hosts[k].uprate = atoi(g->db_get_data(res,i,"uprate")); + channels[j].hosts[k].upceil = atoi(g->db_get_data(res,i,"upceil")); + channels[j].hosts[k].downrate = atoi(g->db_get_data(res,i,"downrate")); + channels[j].hosts[k].downceil = atoi(g->db_get_data(res,i,"downceil")); + channels[j].hosts[k].ip = strdup(ip); + channels[j].hosts[k].mac = strdup(g->db_get_data(res,i,"mac")); + channels[j].hosts[k].halfduplex = atoi(g->db_get_data(res,i,"halfduplex")); + channels[j].hosts[k].status = UNKNOWN; + channels[j].upratesum += channels[j].hosts[k].uprate; + channels[j].downratesum += channels[j].hosts[k].downrate; + channels[j].no++; + } + g->db_free(&res); + free(query); + + // Open the session again + sh = snmp_open(&session); + + if(!sh) + { + snmp_error(&session, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] SNMP ERROR: %s", ewx->base.instance, errstr); + free(errstr); + return; + } + + // Main loop **************************************************************** + for(i=0; i channels[x].upceil || new.downceil > c.downceil) + { + mod_channel(g, ewx, sh, channels[x].id, c.upceil, c.downceil); + channels[x].upceil = c.upceil; + channels[x].downceil = c.downceil; + channels[x].status = STATUS_OK; + } + + // moze wystapic (chwilowe) przekroczenie sumy rate + if (old.uprate != new.uprate || old.downrate != new.downrate) + { + channels[x].upratesum += new.uprate - old.uprate; + channels[x].downratesum += new.downrate - old.downrate; + + if (channels[x].upceil < channels[x].upratesum || channels[x].downceil < channels[x].downratesum) + { + mod_channel(g, ewx, sh, channels[x].id, channels[x].upratesum, channels[x].downratesum); + channels[x].upceil = channels[x].upratesum; + channels[x].downceil = channels[x].downratesum; + channels[x].status = STATUS_OK; + } + } + + update_node(g, ewx, sh, &c.hosts[n], channels[j].hosts[k]); + savetables = 1; + } + + // wszystko sie zgadza, zmieniamy status + channels[j].hosts[k].status = STATUS_OK; + found++; + } + } + } + } + + if(needupdate || found != c.no) + { + savetables = 1; + // channel exists + if(x!=sc) { + update_channel(g, ewx, sh, &channels[x], &c); + } + else + add_channel(g, ewx, sh, &c); + } + else if (channels[x].upceil != c.upceil || channels[x].downceil != c.downceil) { + savetables = 1; + mod_channel(g, ewx, sh, channels[x].id, c.upceil, c.downceil); + } + + } // End of main loop ********************************************************** + + // Remove the rest of old config + for(i=0; ibase.instance); +#endif + + for(i=0; icommunity); + free(ewx->host); + free(ewx->networks); + free(ewx->dummy_mac_networks); + free(ewx->dummy_ip_networks); + free(ewx->excluded_networks); + free(ewx->excluded_dummy_mac_networks); + free(ewx->excluded_dummy_ip_networks); + free(ewx->night_hours); +} + +struct ewx_module * init(GLOBAL *g, MODULE *m) +{ + struct ewx_module *ewx; + + if(g->api_version != APIVERSION) + { + return (NULL); + } + + ewx = (struct ewx_module *) realloc(m, sizeof(struct ewx_module)); + + ewx->base.reload = (void (*)(GLOBAL *, MODULE *)) &reload; + + ewx->community = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "community", "private")); + ewx->host = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "snmp_host", "")); + ewx->port = g->config_getint(ewx->base.ini, ewx->base.instance, "snmp_port", 161); + ewx->networks = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "networks", "")); + ewx->excluded_networks = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "excluded_networks", "")); + ewx->dummy_mac_networks = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "dummy_mac_networks", "")); + ewx->dummy_ip_networks = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "dummy_ip_networks", "")); + ewx->excluded_dummy_mac_networks = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "excluded_dummy_mac_networks", "")); + ewx->excluded_dummy_ip_networks = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "excluded_dummy_ip_networks", "")); + ewx->skip_disabled = g->config_getbool(ewx->base.ini, ewx->base.instance, "skip_disabled", 1); + ewx->night_hours = strdup(g->config_getstring(ewx->base.ini, ewx->base.instance, "night_hours", "")); + + // parametry domyślnego kanału + // ustawienie któregoś z nich na zero, spowoduje pominięcie komputerów bez przypisanego kanału + ewx->default_upceil = g->config_getint(ewx->base.ini, ewx->base.instance, "default_upceil", 0); + ewx->default_downceil = g->config_getint(ewx->base.ini, ewx->base.instance, "default_downceil", 0); + + // node/channel ID's offset, e.g. for testing + ewx->offset = g->config_getint(ewx->base.ini, ewx->base.instance, "offset", 0); + + // TODO: dorobic zarzadzanie sciezkami w LMSie (Configuration -> Paths albo TC Bands) + // [Parametry sciezki: nazwa, full/half duplex, min upload, max upload] + // bylyby pomocnie nie tylko dla EWX'a, sciezki przypisywaloby sie do + // seci IP, pozwoliloby to na dodanie sprawdzenia osiagniecia maksymalnej granicy + // ruchu dla sciezki podczas dodawania nowej taryfy. + // ...tymczasem mozemy obsluzyc tylko jedna sciezke + ewx->path = g->config_getint(ewx->base.ini, ewx->base.instance, "path", 0); +#ifdef DEBUG1 + syslog(LOG_INFO,"DEBUG: [%s/ewx-stm-channels] initialized", ewx->base.instance); +#endif + return(ewx); +} + +int del_channel(GLOBAL *g, struct ewx_module *ewx, struct snmp_session *sh, struct channel *ch) +{ + struct snmp_pdu *pdu, *response; + char *errstr; + int i, status, result = STATUS_ERROR; + struct channel c = *ch; + +//printf("[DELETE CHANNEL] %d\n", c.id); + + // First we must delete all nodes in channel + for(i=0; ierrstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + + g->db_pexec(g->conn, "DELETE FROM ewx_stm_channels WHERE id = ?", itoa(c.id)); +#ifdef DEBUG1 + syslog(LOG_INFO, "DEBUG: [%s/ewx-stm-channels] Deleted channel %d", ewx->base.instance, c.id); +#endif + (*ch).status = result = DELETED; + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot delete channel %d: %s", ewx->base.instance, c.id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot delete channel %d: %s", ewx->base.instance, c.id, errstr); + free(errstr); + } + } + + // Clean up + if(response) + snmp_free_pdu(response); + + return result; +} + +int add_channel(GLOBAL *g, struct ewx_module *ewx, struct snmp_session *sh, struct channel *cust) +{ + struct snmp_pdu *pdu, *response; + char *errstr; + int i, status, channelid, result = STATUS_ERROR; + QueryHandle *res; + struct channel c = *cust; + + char *upceil = strdup(itoa(c.upceil)); + char *downceil = strdup(itoa(c.downceil)); + +//printf("[ADD CHANNEL] %d\n", c.cid); + + if(!sh) return result; + + // Adding channel to database + g->db_pexec(g->conn, "INSERT INTO ewx_stm_channels (cid, upceil, downceil) " + "VALUES(?, ?, ?)", itoa(c.cid), upceil, downceil); + + res = g->db_pquery(g->conn, "SELECT id FROM ewx_stm_channels WHERE cid = ?", itoa(c.cid)); + + channelid = atoi(g->db_get_data(res, 0, "id")); + g->db_free(&res); + + // Pilnujemy aby channelid nie przekroczyl 99999 + // @TODO: na postgresie mozna uzyc generate_series() i zalatwic to jednym zapytaniem + if(channelid > MAX_ID) + { + int lastid = 0; + int newid = 0; + int row = 0; + + while(newid==0) + { + res = g->db_pquery(g->conn, "SELECT id FROM ewx_stm_channels ORDER BY id LIMIT 100 OFFSET ?", itoa(row)); + + // break loop when there're no rows + if(!g->db_nrows(res)) + { + g->db_free(&res); + break; + } + + for(i=0; idb_nrows(res); i++) + { + int cid = atoi(g->db_get_data(res,i,"id")); + if(cid > lastid + 1) + { + // found first free ID + newid = lastid + 1; + break; + } + else + { + lastid = cid; + row++; + } + } + g->db_free(&res); + } + + if(newid) + { + char *nid = strdup(itoa(newid)); + g->db_pexec(g->conn, "UPDATE ewx_stm_channels SET id = ? WHERE id = ?", itoa(channelid), nid); + free(nid); + channelid = newid; + } + else + { + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot add channel %d. ID is too big.", ewx->base.instance, channelid); + return result; + } + } + + // Create OID + ChannelStatus[STM_OID_LEN-1] = channelid + ewx->offset; + ChannelPathNo[STM_OID_LEN-1] = channelid + ewx->offset; + ChannelUplink[STM_OID_LEN-1] = channelid + ewx->offset; + ChannelDownlink[STM_OID_LEN-1] = channelid + ewx->offset; +// ChannelHalfDuplex[STM_OID_LEN-1] = channelid + ewx->offset; + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + + snmp_add_var(pdu, ChannelPathNo, STM_OID_LEN, 'u', itoa(ewx->path)); + snmp_add_var(pdu, ChannelUplink, STM_OID_LEN, 'u', upceil); + snmp_add_var(pdu, ChannelDownlink, STM_OID_LEN, 'u', downceil); +// snmp_add_var(pdu, ChannelHalfDuplex, STM_OID_LEN, 'i', "2"); + snmp_add_var(pdu, ChannelStatus, STM_OID_LEN, 'i', CREATEANDGO); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); +#ifdef DEBUG1 + syslog(LOG_INFO, "DEBUG: [%s/ewx-stm-channels] Added channel %d", ewx->base.instance, channelid); +#endif + (*cust).status = result = STATUS_OK; + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot add channel %d: %s", ewx->base.instance, channelid, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot add channel %d: %s", ewx->base.instance, channelid, errstr); + free(errstr); + } + } + + // Clean up + if(response) + snmp_free_pdu(response); + + // Adding nodes to the channel + if(result == STATUS_OK) + for(i=0; ioffset); + } + + return result; +} + +int update_channel(GLOBAL *g, struct ewx_module *ewx, struct snmp_session *sh, struct channel *ch, struct channel *cust) +{ + struct snmp_pdu *pdu, *response; + char *errstr; + int i, status, result = STATUS_ERROR; + + struct channel c = *ch; + struct channel cu = *cust; + + char *upceil = strdup(itoa(cu.upceil)); + char *downceil = strdup(itoa(cu.downceil)); + +//printf("[UPDATE CHANNEL] %d\n", c.id); + + // First we must delete all nodes in channel + for(i=0; ioffset; + ChannelDownlink[STM_OID_LEN-1] = c.id + ewx->offset; +// ChannelPathNo[STM_OID_LEN-1] = c.id + ewx->offset; +// ChannelHalfDuplex[STM_OID_LEN-1] = c.id + ewx->offset; + ChannelStatus[STM_OID_LEN-1] = c.id + ewx->offset; + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + + // NOTINSERVICE we must send in separate packet + snmp_add_var(pdu, ChannelStatus, STM_OID_LEN, 'i', NOTINSERVICE); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot update channel %d: %s", ewx->base.instance, c.id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot update channel %d: %s", ewx->base.instance, c.id, errstr); + free(errstr); + } + + free(upceil); + free(downceil); + return result; + } + + // Clean up + if(response) + snmp_free_pdu(response); + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + + snmp_add_var(pdu, ChannelUplink, STM_OID_LEN, 'u', upceil); + snmp_add_var(pdu, ChannelDownlink, STM_OID_LEN, 'u', downceil); +// snmp_add_var(pdu, ChannelPathNo, STM_OID_LEN, 'u', itoa(ewx->path)); +// snmp_add_var(pdu, ChannelHalfDuplex, STM_OID_LEN, 'i', "2"); + snmp_add_var(pdu, ChannelStatus, STM_OID_LEN, 'i', ACTIVE); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + + g->db_pexec(g->conn, "UPDATE ewx_stm_channels SET upceil = ?, downceil = ? " + "WHERE id = ?", upceil, downceil, itoa(c.id)); +#ifdef DEBUG1 + syslog(LOG_INFO, "DEBUG: [%s/ewx-stm-channels] Updated channel %d", ewx->base.instance, c.id); +#endif + (*ch).status = (*cust).status = result = STATUS_OK; + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot update channel %d: %s", ewx->base.instance, c.id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot update channel %d: %s", ewx->base.instance, c.id, errstr); + free(errstr); + } + } + + // Clean up + if(response) + snmp_free_pdu(response); + + // Adding nodes to the channel + if(result == STATUS_OK) + for(i=0; ioffset); + } + + free(upceil); + free(downceil); + + return result; +} + +int mod_channel(GLOBAL *g, struct ewx_module *ewx, struct snmp_session *sh, int id, int up, int down) +{ + struct snmp_pdu *pdu, *response; + char *errstr; + int status, result = STATUS_ERROR; + + char *upceil = strdup(itoa(up)); + char *downceil = strdup(itoa(down)); + +//printf("[MODIFY CHANNEL] %d [%d:%d]\n", id, up, down); + + // Create OIDs + ChannelUplink[STM_OID_LEN-1] = id + ewx->offset; + ChannelDownlink[STM_OID_LEN-1] = id + ewx->offset; + ChannelStatus[STM_OID_LEN-1] = id + ewx->offset; + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + + // NOTINSERVICE we must send in separate packet + snmp_add_var(pdu, ChannelStatus, STM_OID_LEN, 'i', NOTINSERVICE); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot modify channel %d: %s", ewx->base.instance, id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot modify channel %d: %s", ewx->base.instance, id, errstr); + free(errstr); + } + + free(upceil); + free(downceil); + return result; + } + + // Clean up + if(response) + snmp_free_pdu(response); + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + + snmp_add_var(pdu, ChannelUplink, STM_OID_LEN, 'u', upceil); + snmp_add_var(pdu, ChannelDownlink, STM_OID_LEN, 'u', downceil); + snmp_add_var(pdu, ChannelStatus, STM_OID_LEN, 'i', ACTIVE); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + + g->db_pexec(g->conn, "UPDATE ewx_stm_channels SET upceil = ?, downceil = ? " + "WHERE id = ?", upceil, downceil, itoa(id)); +#ifdef DEBUG1 + syslog(LOG_INFO, "DEBUG: [%s/ewx-stm-channels] Modified channel %d", ewx->base.instance, id); +#endif + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot modify channel %d: %s", ewx->base.instance, id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot modify channel %d: %s", ewx->base.instance, id, errstr); + free(errstr); + } + } + + // Clean up + if(response) + snmp_free_pdu(response); + + free(upceil); + free(downceil); + + return result; +} + +int del_node(GLOBAL *g, struct ewx_module *ewx, struct snmp_session *sh, struct host *ht) +{ + struct snmp_pdu *pdu, *response; + char *errstr; + int status, result = STATUS_ERROR; + struct host h = *ht; + +//printf("[DELETE NODE] %d\n", h.id); + + if(!sh) return result; + + // Create OID + CustomerStatus[STM_OID_LEN-1] = h.id + ewx->offset; + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + + snmp_add_var(pdu, CustomerStatus, STM_OID_LEN, 'i', DESTROY); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + + g->db_pexec(g->conn, "DELETE FROM ewx_stm_nodes WHERE nodeid = ?", itoa(h.id)); +#ifdef DEBUG1 + syslog(LOG_INFO, "DEBUG: [%s/ewx-stm-channels] Deleted node %s (%05d)", ewx->base.instance, h.ip, h.id); +#endif + (*ht).status = result = DELETED; + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot delete node %s (%05d): %s", ewx->base.instance, h.ip, h.id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot delete node %s (%05d): %s", ewx->base.instance, h.ip, h.id, errstr); + free(errstr); + } + } + + // Clean up + if(response) + snmp_free_pdu(response); + + return result; +} + +int add_node(GLOBAL *g, struct ewx_module *ewx, struct snmp_session *sh, struct host *ht, int chid) +{ + struct snmp_pdu *pdu, *response; + char *errstr; + int status, result = STATUS_ERROR; + struct host h = *ht; + +//printf("[ADD NODE] %d %s-%s: %d\n", h.id, h.mac, h.ip, chid); + + if(!sh) return result; + + // Create OIDs +// CustomerNo[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerPathNo[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerChannelNo[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerIpAddr[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerMacAddr[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerUpMinSpeed[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerUpMaxSpeed[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerDownMinSpeed[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerDownMaxSpeed[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerHalfDuplex[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerStatus[STM_OID_LEN-1] = h.id + ewx->offset; + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + +// snmp_add_var(pdu, CustomerNo, STM_OID_LEN, 'i', itoa(h.id)); + snmp_add_var(pdu, CustomerPathNo, STM_OID_LEN, 'u', itoa(ewx->path)); + snmp_add_var(pdu, CustomerChannelNo, STM_OID_LEN, 'u', itoa(chid)); + snmp_add_var(pdu, CustomerIpAddr, STM_OID_LEN, 's', h.ip); + snmp_add_var(pdu, CustomerMacAddr, STM_OID_LEN, 's', h.mac); + snmp_add_var(pdu, CustomerUpMinSpeed, STM_OID_LEN, 'u', itoa(h.uprate)); + snmp_add_var(pdu, CustomerUpMaxSpeed, STM_OID_LEN, 'u', itoa(h.upceil)); + snmp_add_var(pdu, CustomerDownMinSpeed, STM_OID_LEN, 'u', itoa(h.downrate)); + snmp_add_var(pdu, CustomerDownMaxSpeed, STM_OID_LEN, 'u', itoa(h.downceil)); + if(h.halfduplex) + snmp_add_var(pdu, CustomerHalfDuplex, STM_OID_LEN, 'i', itoa(h.halfduplex)); + snmp_add_var(pdu, CustomerStatus, STM_OID_LEN, 'i', CREATEANDGO); + + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + + char *uprate = strdup(itoa(h.uprate)); + char *upceil = strdup(itoa(h.upceil)); + char *downrate = strdup(itoa(h.downrate)); + char *downceil = strdup(itoa(h.downceil)); + char *halfduplex = strdup(itoa(h.halfduplex)); + char *channelid = strdup(itoa(chid)); + + g->db_pexec(g->conn, "INSERT INTO ewx_stm_nodes (nodeid, mac, ipaddr, channelid, uprate, upceil, downrate, downceil, halfduplex) " + "VALUES (?, '?', INET_ATON('?'), ?, ?, ?, ?, ?, ?)", + itoa(h.id), h.mac, h.ip, channelid, uprate, upceil, downrate, downceil, halfduplex); + + free(uprate); + free(upceil); + free(downrate); + free(downceil); + free(halfduplex); + free(channelid); +#ifdef DEBUG1 + syslog(LOG_INFO, "DEBUG: [%s/ewx-stm-channels] Added node %s (%05d)", ewx->base.instance, h.ip, h.id); +#endif + (*ht).status = result = STATUS_OK; + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot add node %s (%05d): %s", ewx->base.instance, h.ip, h.id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot add node %s (%05d): %s", ewx->base.instance, h.ip, h.id, errstr); + free(errstr); + } + } + + // Clean up + if(response) + snmp_free_pdu(response); + + return result; +} + +int update_node(GLOBAL *g, struct ewx_module *ewx, struct snmp_session *sh, struct host *ht, struct host old) +{ + struct snmp_pdu *pdu, *response; + char *errstr; + int status, result = STATUS_ERROR; + struct host h = *ht; + +//printf("[UPDATE NODE] %d\n", h.id); + + if(!sh) return result; + + // Create OIDs +// CustomerNo[STM_OID_LEN-1] = h.id + ewx->offset; +// CustomerPathNo[STM_OID_LEN-1] = h.id + ewx->offset; +// CustomerChannelNo[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerIpAddr[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerMacAddr[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerUpMinSpeed[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerUpMaxSpeed[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerDownMinSpeed[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerDownMaxSpeed[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerHalfDuplex[STM_OID_LEN-1] = h.id + ewx->offset; + CustomerStatus[STM_OID_LEN-1] = h.id + ewx->offset; + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + + // NOTINSERVICE we must send in separate packet + snmp_add_var(pdu, CustomerStatus, STM_OID_LEN, 'i', NOTINSERVICE); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot update node %s (%05d): %s", ewx->base.instance, h.ip, h.id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot update node %s (%05d): %s", ewx->base.instance, h.ip, h.id, errstr); + free(errstr); + } + + return result; + } + + // Clean up + if(response) + snmp_free_pdu(response); + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + +// snmp_add_var(pdu, CustomerNo, STM_OID_LEN, 'i', itoa(h.id)); +// snmp_add_var(pdu, CustomerPathNo, STM_OID_LEN, 'u', itoa(ewx->path)); +// snmp_add_var(pdu, CustomerChannelNo, STM_OID_LEN, 'u', itoa(chid)); + if (strcmp(h.ip, old.ip) != 0) + snmp_add_var(pdu, CustomerIpAddr, STM_OID_LEN, 's', h.ip); + if (strcmp(h.mac, old.mac) != 0) + snmp_add_var(pdu, CustomerMacAddr, STM_OID_LEN, 's', h.mac); + if (h.uprate != old.uprate) + snmp_add_var(pdu, CustomerUpMinSpeed, STM_OID_LEN, 'u', itoa(h.uprate)); + if (h.upceil != old.upceil) + snmp_add_var(pdu, CustomerUpMaxSpeed, STM_OID_LEN, 'u', itoa(h.upceil)); + if (h.downrate != old.downrate) + snmp_add_var(pdu, CustomerDownMinSpeed, STM_OID_LEN, 'u', itoa(h.downrate)); + if (h.downceil != old.downceil) + snmp_add_var(pdu, CustomerDownMaxSpeed, STM_OID_LEN, 'u', itoa(h.downceil)); + if (h.halfduplex != old.halfduplex) { + if(h.halfduplex) + snmp_add_var(pdu, CustomerHalfDuplex, STM_OID_LEN, 'i', itoa(h.halfduplex)); + else + snmp_add_var(pdu, CustomerHalfDuplex, STM_OID_LEN, 'i', "2"); // full duplex + } + snmp_add_var(pdu, CustomerStatus, STM_OID_LEN, 'i', ACTIVE); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); + + char *uprate = strdup(itoa(h.uprate)); + char *upceil = strdup(itoa(h.upceil)); + char *downrate = strdup(itoa(h.downrate)); + char *downceil = strdup(itoa(h.downceil)); + char *halfduplex = strdup(itoa(h.halfduplex)); + + g->db_pexec(g->conn, "UPDATE ewx_stm_nodes SET mac = '?', ipaddr = INET_ATON('?'), " + "uprate = ?, downrate = ?, upceil = ?, downceil = ?, halfduplex = ? " + "WHERE nodeid = ?", + h.mac, h.ip, uprate, downrate, upceil, downceil, halfduplex, itoa(h.id)); + + free(uprate); + free(upceil); + free(downrate); + free(downceil); + free(halfduplex); +#ifdef DEBUG1 + syslog(LOG_INFO, "DEBUG: [%s/ewx-stm-channels] Updated node %s (%05d)", ewx->base.instance, h.ip, h.id); +#endif + (*ht).status = result = STATUS_OK; + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot update node %s (%05d): %s", ewx->base.instance, h.ip, h.id, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot update node %s (%05d): %s", ewx->base.instance, h.ip, h.id, errstr); + free(errstr); + } + } + + // Clean up + if(response) + snmp_free_pdu(response); + + return result; +} + +int save_tables(GLOBAL *g, struct ewx_module *ewx, struct snmp_session *sh) +{ + struct snmp_pdu *pdu, *response; + char *errstr; + int status, result = STATUS_ERROR; + +//printf("[SAVE TABLES]\n"); + + if(!sh) return result; + + // Create the PDU + pdu = snmp_pdu_create(SNMP_MSG_SET); + + snmp_add_var(pdu, CustomersTableSave, OID_LENGTH(CustomersTableSave), 'i', TABLESAVE); + snmp_add_var(pdu, ChannelsTableSave, OID_LENGTH(ChannelsTableSave), 'i', TABLESAVE); + + // Send the Request out + status = snmp_synch_response(sh, pdu, &response); + + // Process the response + if(status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) + { +// struct variable_list *vars; +// for(vars = response->variables; vars; vars = vars->next_variable) +// print_variable(vars->name, vars->name_length, vars); +#ifdef DEBUG1 + syslog(LOG_INFO, "DEBUG: [%s/ewx-stm-channels] Device configuration tables saved", ewx->base.instance); +#endif + result = STATUS_OK; + } + else // failure + { + if(status == STAT_SUCCESS) + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot save device configuration tables: %s", ewx->base.instance, snmp_errstring(response->errstat)); + else + { + snmp_error(sh, NULL, NULL, &errstr); + syslog(LOG_ERR, "[%s/ewx-stm-channels] ERROR: Cannot save device configuration tables: %s", ewx->base.instance, errstr); + free(errstr); + } + } + + // Clean up + if(response) + snmp_free_pdu(response); + + return result; +} Index: lms/daemon/modules/ewx-stm-channels/ewx-stm-channels.h diff -u /dev/null lms/daemon/modules/ewx-stm-channels/ewx-stm-channels.h:1.1 --- /dev/null Fri Apr 2 17:26:09 2010 +++ lms/daemon/modules/ewx-stm-channels/ewx-stm-channels.h Fri Apr 2 17:26:09 2010 @@ -0,0 +1,154 @@ +#include +#include + +struct ewx_module +{ + MODULE base; + + char *networks; + char *excluded_networks; + char *dummy_mac_networks; + char *dummy_ip_networks; + char *excluded_dummy_mac_networks; + char *excluded_dummy_ip_networks; + char *customergroups; + char *community; + char *host; + char *night_hours; + + u_short port; + int path; + int offset; + int skip_disabled; + int default_upceil; + int default_downceil; +}; + +struct net +{ + unsigned long address; + unsigned long mask; + char *name; +}; + +struct host +{ + int id; + int status; + int uprate; + int upceil; + int downrate; + int downceil; + int halfduplex; + char *ip; + char *mac; +}; + +struct channel +{ + int id; + int cid; + int status; + int upceil; + int downceil; + int upratesum; + int downratesum; + int no; + struct host *hosts; +}; + +/* + EtherWerX Layer2 Traffic Manager MIB tree: + + ArcherMIB = 20656 + ArcherProducts = 1 + ArcherProductSpecificMibs = 2 + EtherWerX-L2tm 1 + + L2tmCustomersTable 4 + L2tmCustomer 1 (L2tmCustomersTableSave 2) + L2tmCustomerStatus 1 RowStatus + L2tmCustomerNo 2 Unsigned32 + L2tmCustomerPathNo 3 Unsigned32 + L2tmCustomerChannelNo 10 Unsigned32 + L2tmCustomerIpAddr 4 DisplayString + L2tmCustomerMacAddr 5 DisplayString + L2tmCustomerMinSpeed 6 Unsigned32 (kbit/s) + L2tmCustomerMaxSpeed 7 Unsigned32 (kbit/s) + L2tmCustomerUplinkMinSpeed 11 Unsigned32 (kbit/s) + L2tmCustomerUplinkMaxSpeed 12 Unsigned32 (kbit/s) + L2tmCustomerDownlinkMinSpeed 13 Unsigned32 (kbit/s) + L2tmCustomerDownlinkMaxSpeed 14 Unsigned32 (kbit/s) + L2tmCustomerShare 8 Unsigned32 + L2tmCustomerHalfDuplex 9 INTEGER + + L2tmChannelsTable 6 + L2tmChannel 1 (L2tmChannelsTableSave 2) + L2tmChannelStatus 1 RowStatus + L2tmChannelNo 2 Unsigned32 + L2tmChannelPathNo 3 Unsigned32 + L2tmChannelUplink 4 Unsigned32 + L2tmChannelDownlink 5 Unsigned32 + L2tmChannelHalfDuplex 6 INTEGER + +*/ + +// nodes OIDs (last element (zero) will be changed to node ID) +oid CustomerStatus[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,1,0}; +oid CustomerNo[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,2,0}; +oid CustomerPathNo[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,3,0}; +oid CustomerChannelNo[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,10,0}; +oid CustomerIpAddr[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,4,0}; +oid CustomerMacAddr[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,5,0}; +oid CustomerMinSpeed[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,6,0}; +oid CustomerMaxSpeed[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,7,0}; +oid CustomerUpMinSpeed[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,11,0}; +oid CustomerUpMaxSpeed[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,12,0}; +oid CustomerDownMinSpeed[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,13,0}; +oid CustomerDownMaxSpeed[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,14,0}; +oid CustomerShare[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,8,0}; +oid CustomerHalfDuplex[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,1,9,0}; + +// channels OIDs (last element (zero) will be changed to channel ID) +oid ChannelStatus[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,6,1,1,0}; +oid ChannelNo[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,6,1,2,0}; +oid ChannelPathNo[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,6,1,3,0}; +oid ChannelUplink[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,6,1,4,0}; +oid ChannelDownlink[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,6,1,5,0}; +oid ChannelHalfDuplex[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,6,1,6,0}; + +// paths OIDs (last element (zero) will be changed to path ID) +oid PathUplink[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,2,1,3,0}; +oid PathDownlink[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,2,1,4,0}; + +// number of elements in above OIDs +#define STM_OID_LEN 14 + +// Status values +#define ACTIVE "1" +#define NOTINSERVICE "2" +#define NOTREADY "3" +#define CREATEANDGO "4" +#define CREATEANDWAIT "5" +#define DESTROY "6" +#define TABLESAVE "2" + +// Customers/Channels tables status +oid CustomersTableSave[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,4,2,0}; +oid ChannelsTableSave[] = {SNMP_OID_ENTERPRISES,20656,1,2,1,6,2,0}; + +// dummy MAC for nodes with disabled hardware address checking +#define DUMMY_MAC "00:00:00:00:00:00" +#define DUMMY_IP "0.0.0.0" + +// we don't need to load MIB definitions +#define DISABLE_MIB_LOADING 1 + +// max. channel ID +#define MAX_ID 99999 + +// some helper constants +#define UNKNOWN 0 +#define STATUS_OK 1 +#define STATUS_ERROR 0 +#define DELETED 2 From cvs w lms.org.pl Fri Apr 2 17:26:09 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 2 Apr 2010 17:26:09 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog, README, README.pl) Message-ID: <20100402152609.7AD933027B2D@hydra.altec.pl> Date: Friday, April 2, 2010 @ 17:26:09 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog README README.pl - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1487&r2=1.1488 http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.diff?&r1=1.219&r2=1.220 http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.pl.diff?&r1=1.47&r2=1.48 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1487 lms/doc/ChangeLog:1.1488 --- lms/doc/ChangeLog:1.1487 Fri Apr 2 13:48:29 2010 +++ lms/doc/ChangeLog Fri Apr 2 17:26:09 2010 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1487 2010/04/02 11:48:29 alec Exp $ +$Id: ChangeLog,v 1.1488 2010/04/02 15:26:09 alec Exp $ version ? (????-??-??) @@ -55,6 +55,7 @@ - we can omit stats data in database backup (chilan) - fixed encoding of mail messages sent by perl scripts (alec) - BTS#0000825: fixed tariff limits checking in domain edition (alec) + - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support (alec) version 1.11.9 Moloc (2009-10-28): Index: lms/doc/README diff -u lms/doc/README:1.219 lms/doc/README:1.220 --- lms/doc/README:1.219 Thu Mar 11 14:07:33 2010 +++ lms/doc/README Fri Apr 2 17:26:09 2010 @@ -5736,7 +5736,31 @@ name - contact name/description __________________________________________________________________ -7.2.35. Accounts ('passwd') +7.2.35. Domains ('domains') + + id - serial number + name - domain name + description - comments + type - DNS type ('MASTER', 'SLAVE', 'NATIVE') + master - master DNS server + account - email address of DNS administrator + last_check - timestamp + notified_serial - timestamp + __________________________________________________________________ + +7.2.36. DNS Records ('records') + + id - serial number + domain_id - domain serial number + name - name + type - record type (MX, SOA, A, AAAA, etc.) + content - data + ttl - TTL + prio - priority + change_date - last change timestamp + __________________________________________________________________ + +7.2.37. Accounts ('passwd') id - serial number ownerid - customer serial number (0 - "system" account) @@ -5760,21 +5784,14 @@ description - additional information __________________________________________________________________ -7.2.36. Domains ('domains') - - id - serial number - name - domain name - description - comments - __________________________________________________________________ - -7.2.37. Aliases ('aliases') +7.2.38. Aliases ('aliases') id - serial number login - account name (without domain) domainid - account serial number __________________________________________________________________ -7.2.38. Alias-to-account assignments ('aliasassignments') +7.2.39. Alias-to-account assignments ('aliasassignments') id - serial number aliasid - alias serial number @@ -5782,7 +5799,7 @@ mail_forward - forward address __________________________________________________________________ -7.2.39. VoIP Accounts ('voipaccounts') +7.2.40. VoIP Accounts ('voipaccounts') id - serial number ownerid - customer identifier @@ -5795,7 +5812,7 @@ modid - last change (user) identifier __________________________________________________________________ -7.2.40. Bandwidth consumption statistics ('stats') +7.2.41. Bandwidth consumption statistics ('stats') nodeid - node serial number dt - timestamp @@ -5803,7 +5820,7 @@ download - number of bytes received __________________________________________________________________ -7.2.41. Helpdesk - Request Tracking ('rtqueues') +7.2.42. Helpdesk - Request Tracking ('rtqueues') id - serial number name - queue name @@ -5811,7 +5828,7 @@ description - main description for the queue __________________________________________________________________ -7.2.42. Helpdesk - Request Tracking - continued... ('rttickets') +7.2.43. Helpdesk - Request Tracking - continued... ('rttickets') id - serial number queueid - queue serial number @@ -5825,7 +5842,7 @@ createtime - timestamp of report __________________________________________________________________ -7.2.43. Helpdesk - Request Tracking - continued... ('rtmessages') +7.2.44. Helpdesk - Request Tracking - continued... ('rtmessages') id - serial number ticketid - ticket serial number @@ -5841,14 +5858,14 @@ createtime - date of creation/send/delivery __________________________________________________________________ -7.2.44. Helpdesk - Request Tracking - continued... ('rtattachments') +7.2.45. Helpdesk - Request Tracking - continued... ('rtattachments') messageid - message serial number filename - name of file attachment contenttype - type of file __________________________________________________________________ -7.2.45. Helpdesk - Request Tracking - continued... ('rtnotes') +7.2.46. Helpdesk - Request Tracking - continued... ('rtnotes') id - serial number ticketid - ticket serial number @@ -5857,7 +5874,7 @@ createtime - date of creation __________________________________________________________________ -7.2.46. Helpdesk - Request Tracking - continued... ('rtrights') +7.2.47. Helpdesk - Request Tracking - continued... ('rtrights') id - serial number queueid - queue serial number @@ -5865,7 +5882,7 @@ rights - permissions (1-read, 2-write) __________________________________________________________________ -7.2.47. LMS-UI Online Configuration ('uiconfig') +7.2.48. LMS-UI Online Configuration ('uiconfig') id - serial number section - config section name @@ -5875,7 +5892,7 @@ disabled - is option disabled? (0-active, 1-disabled/default) __________________________________________________________________ -7.2.48. Timetable - events ('events') +7.2.49. Timetable - events ('events') id - identifier title - title @@ -5890,13 +5907,13 @@ closed - is event closed? (1-yes/0-no) __________________________________________________________________ -7.2.49. Timetable - assignments ('eventassignments') +7.2.50. Timetable - assignments ('eventassignments') eventid - event identifier userid - user identifier __________________________________________________________________ -7.2.50. Sessions ('sessions') +7.2.51. Sessions ('sessions') id - session identifier ctime - create time @@ -5906,7 +5923,7 @@ content - data __________________________________________________________________ -7.2.51. Hosts ('hosts') +7.2.52. Hosts ('hosts') id - identifier name - host name @@ -5915,7 +5932,7 @@ reload - reload order __________________________________________________________________ -7.2.52. Daemon configuration - instances ('daemoninstances') +7.2.53. Daemon configuration - instances ('daemoninstances') id - identifier name - instance name @@ -5927,7 +5944,7 @@ disabled - status (enabled/disabled) __________________________________________________________________ -7.2.53. Daemon configuration - options ('daemonconfig') +7.2.54. Daemon configuration - options ('daemonconfig') id - identifier instanceid - instance identifier @@ -5937,27 +5954,27 @@ disabled - status (enabled/disabled) __________________________________________________________________ -7.2.54. States ('states') +7.2.55. States ('states') id - identifier name - state name description - additional information __________________________________________________________________ -7.2.55. Zip codes ('zipcodes') +7.2.56. Zip codes ('zipcodes') id - identifier zip - zip code stateid - state identifier __________________________________________________________________ -7.2.56. Countries ('countries') +7.2.57. Countries ('countries') id - identifier name - country name __________________________________________________________________ -7.2.57. Companies/Divisions ('divisions') +7.2.58. Companies/Divisions ('divisions') id - identifier shortname - division short name @@ -5975,9 +5992,11 @@ inv_footer - invoice footer inv_author - invoice default author inv_cplace - invoice creation place + inv_paytime - invoice deadline + inv_paytype - invoice type of payment __________________________________________________________________ -7.2.58. Messages - list ('messages') +7.2.59. Messages - list ('messages') id - serial number subject - message subject @@ -5988,7 +6007,7 @@ sender - e-mail 'From' header __________________________________________________________________ -7.2.59. Messages - items ('messageitems') +7.2.60. Messages - items ('messageitems') id - serial number messageid - message identifier @@ -5999,7 +6018,7 @@ error - error message __________________________________________________________________ -7.2.60. Database information ('dbinfo') +7.2.61. Database information ('dbinfo') keytype - type keyvalue - value Index: lms/doc/README.pl diff -u lms/doc/README.pl:1.47 lms/doc/README.pl:1.48 --- lms/doc/README.pl:1.47 Thu Mar 11 14:07:33 2010 +++ lms/doc/README.pl Fri Apr 2 17:26:09 2010 @@ -4364,26 +4364,28 @@ 6.2.1. Lista dostępnych modułów Tabela 6-1. Lista modułów demona lmsd - Nazwa Opis - system Wywoływanie poleceń powłoki - parser Parser uniwersalnych skryptów T-Script - dhcp Konfiguracja serwera dhcpd - cutoff Odłączanie klientów z zaległościami w opłatach - dns Konfiguracja serwera dns - ethers Tworzenie pliku /etc/ethers - hostfile Moduł uniwersalny (np. tworzenie reguł iptables) - notify Powiadamianie klientów o zaległościach w opłatach pocztą - elektroniczną - ggnotify Powiadamianie klientów o zaległościach w opłatach przez - gadu-gadu - payments Naliczanie opłat abonamentowych - oident Konfiguracja oident - tc Tworzenie reguł TC - tc-new Tworzenie reguł TC (powiązania komputerów z taryfami) - traffic Statystyki wykorzystania łącza - pinger Badanie aktywności klientów - ewx-pt Konfiguracja EtherWerX PPPoE Terminatora - ewx-stm Konfiguracja EtherWerX Standalone Traffic Managera + Nazwa Opis + system Wywoływanie poleceń powłoki + parser Parser uniwersalnych skryptów T-Script + dhcp Konfiguracja serwera dhcpd + cutoff Odłączanie klientów z zaległościami w opłatach + dns Konfiguracja serwera dns + ethers Tworzenie pliku /etc/ethers + hostfile Moduł uniwersalny (np. tworzenie reguł iptables) + notify Powiadamianie klientów o zaległościach w opłatach pocztą + elektroniczną + ggnotify Powiadamianie klientów o zaległościach w opłatach przez + gadu-gadu + payments Naliczanie opłat abonamentowych + oident Konfiguracja oident + tc Tworzenie reguł TC + tc-new Tworzenie reguł TC (powiązania komputerów z taryfami) + traffic Statystyki wykorzystania łącza + pinger Badanie aktywności klientów + ewx-pt Konfiguracja EtherWerX PPPoE Terminatora + ewx-stm Konfiguracja EtherWerX Standalone Traffic Managera + ewx-stm-channels Konfiguracja EtherWerX Standalone Traffic Managera (ze + rozszerzoną obsługą kanałów) __________________________________________________________________ 6.2.2. System @@ -5587,6 +5589,37 @@ Przykład: night_hours = "24-6" __________________________________________________________________ +6.2.19. Ewx-stm-channels + +6.2.19.1. Wstęp + + Moduł ewx-stm-channels to odpowiednik modułu ewx-stm (służącego do + zarządzania urządzeniem Standalone Traffic Manager marki EtherWerX) + zawierający rozbudowaną obsługę kanałów. + + Różnica w pracy tych modułów jest następująca. Moduł ewx-stm tworzy + kanały automatycznie w zależności od ustawień zobowiązań klientów i ich + przypisania do komputerów. Nie obsługuje kanałów zdefiniowanych w + LMS-UI. Z kolei moduł ewx-stm-channels pracuje wyłącznie z kanałami + zdefiniowanymi w LMS-UI. Komputery powinny być przypisane do urządzeń + sieciowych, a te z kolei do kanałów o zdefiniowanych parametrach. + Komputery nie przypisane do żadnego kanału są pomijane. Można to + zmienić definiując parametry domyślnego kanału w konfiguracji modułu, + do którego trafią wszystkie komputery bez powiązania. + __________________________________________________________________ + +6.2.19.2. Konfiguracja + + Moduł ewx-stm-channels oprócz opcji dostępnych dla modułu ewx-stm + udostępnia następujące opcje: + * default_upceil + Wartość upceil dla domyślnego kanału. Domyślnie: 0. + Przykład: default_upceil = 10000 + * default_downceil + Wartość downceil dla domyślnego kanału. Domyślnie: 0 + Przykład: default_downceil = 20000 + __________________________________________________________________ + 6.3. T-Script 6.3.1. Wstęp @@ -6608,7 +6641,30 @@ name - nazwa/opis kontaktu __________________________________________________________________ -7.2.35. Konta ('passwd') +7.2.35. Domeny ('domains') + + id - identyfikator rekordu + name - nazwa domeny + type - typ DNS ('MASTER', 'SLAVE', 'NATIVE') + master - adres głównego serwera DNS + account - adres e-mail administratora DNS + last_check - znacznik czasu + notified_serial - znacznik czasu + __________________________________________________________________ + +7.2.36. Rekordy DNS ('records') + + id - identyfikator rekordu + domain_id - identyfikator domeny + name - nazwa + type - typ rekordu (MX, SOA, A, AAAA, itd.) + content - dane + ttl - TTL + prio - priorytet + change_date - znacznik czasu ostatniej zmiany + __________________________________________________________________ + +7.2.37. Konta ('passwd') id - identyfikator rekordu ownerid - identyfikator klienta (0 - konto "systemowe") @@ -6632,21 +6688,14 @@ description - dodatkowe informacje __________________________________________________________________ -7.2.36. Domeny ('domains') - - id - identyfikator rekordu - name - nazwa domeny - description - opis - __________________________________________________________________ - -7.2.37. Aliasy ('aliases') +7.2.38. Aliasy ('aliases') id - identyfikator rekordu login - nazwa konta (bez domeny) domainid - identyfikator domeny __________________________________________________________________ -7.2.38. Powiązania aliasów z kontami ('aliasassignments') +7.2.39. Powiązania aliasów z kontami ('aliasassignments') id - identyfikator rekordu aliasid - indentyfikator aliasu @@ -6654,7 +6703,7 @@ mail_forward - adres przekierowania __________________________________________________________________ -7.2.39. Konta VoIP ('voipaccounts') +7.2.40. Konta VoIP ('voipaccounts') id - identyfikator rekordu ownerid - identyfikator właściciela (klienta) @@ -6667,7 +6716,7 @@ modid - identyfikator użytkownika __________________________________________________________________ -7.2.40. Statystyki wykorzystania łącza ('stats') +7.2.41. Statystyki wykorzystania łącza ('stats') nodeid - numer komputera dt - znacznik czasu @@ -6675,7 +6724,7 @@ download - ilość danych odebranych, w bajtach __________________________________________________________________ -7.2.41. Helpdesk - kolejki ('rtqueues') +7.2.42. Helpdesk - kolejki ('rtqueues') id - identyfikator name - nazwa @@ -6683,7 +6732,7 @@ description - opis dodatkowy __________________________________________________________________ -7.2.42. Helpdesk - zgłoszenia ('rttickets') +7.2.43. Helpdesk - zgłoszenia ('rttickets') id - identyfikator queueid - identyfikator kolejki @@ -6697,7 +6746,7 @@ createtime - data zgłoszenia __________________________________________________________________ -7.2.43. Helpdesk - wiadomości ('rtmessages') +7.2.44. Helpdesk - wiadomości ('rtmessages') id - identyfikator ticketid - identyfikator zgłoszenia @@ -6713,14 +6762,14 @@ createtime - data utworzenia/wysłania/odebrania __________________________________________________________________ -7.2.44. Helpdesk - załączniki ('rtattachments') +7.2.45. Helpdesk - załączniki ('rtattachments') messageid - identyfikator wiadomości filename - nazwa pliku contenttype - typ pliku __________________________________________________________________ -7.2.45. Helpdesk - notatki ('rtnotes') +7.2.46. Helpdesk - notatki ('rtnotes') id - identyfikator ticketid - identyfikator zgłoszenia @@ -6729,7 +6778,7 @@ createtime - data utworzenia __________________________________________________________________ -7.2.46. Helpdesk - uprawnienia ('rtrights') +7.2.47. Helpdesk - uprawnienia ('rtrights') id - identyfikator queueid - identyfikator kolejki @@ -6737,7 +6786,7 @@ rights - (1-odczyt, 2-zapis, 3-powiadomienia) __________________________________________________________________ -7.2.47. Konfiguracja LMS-UI ('uiconfig') +7.2.48. Konfiguracja LMS-UI ('uiconfig') id - identyfikator section - nazwa sekcji @@ -6747,7 +6796,7 @@ disabled - wyłączenie opcji (0-wł., 1-wył.) __________________________________________________________________ -7.2.48. Terminarz - zdarzenia ('events') +7.2.49. Terminarz - zdarzenia ('events') id - identyfikator title - tytuł @@ -6762,13 +6811,13 @@ closed - status zamknięcia __________________________________________________________________ -7.2.49. Terminarz - powiązania ('eventassignments') +7.2.50. Terminarz - powiązania ('eventassignments') eventid - identyfikator zdarzenia userid - identyfikator użytkownika __________________________________________________________________ -7.2.50. Hosty ('hosts') +7.2.51. Hosty ('hosts') id - identyfikator name - nazwa hosta @@ -6777,7 +6826,7 @@ reload - żądanie przeładowania __________________________________________________________________ -7.2.51. Konfiguracja demona - instancje ('daemoninstances') +7.2.52. Konfiguracja demona - instancje ('daemoninstances') id - identyfikator name - nazwa instancji @@ -6789,7 +6838,7 @@ disabled - status (włączona/wyłączona) __________________________________________________________________ -7.2.52. Konfiguracja demona - opcje ('daemonconfig') +7.2.53. Konfiguracja demona - opcje ('daemonconfig') id - identyfikator instanceid - identyfikator instancji @@ -6799,7 +6848,7 @@ disabled - status (włączona/wyłączona) __________________________________________________________________ -7.2.53. Sesje ('sessions') +7.2.54. Sesje ('sessions') id - identyfikator sesji ctime - czas utworzenia @@ -6809,27 +6858,27 @@ content - dane __________________________________________________________________ -7.2.54. Województwa ('states') +7.2.55. Województwa ('states') id - identyfikator name - nazwa województwa description - informacje dodatkowe __________________________________________________________________ -7.2.55. Kody pocztowe ('zipcodes') +7.2.56. Kody pocztowe ('zipcodes') id - identyfikator zip - kod pocztowy stateid - identyfikator województwa __________________________________________________________________ -7.2.56. Kraje ('countries') +7.2.57. Kraje ('countries') id - identyfikator name - nazwa kraju __________________________________________________________________ -7.2.57. Firmy/Oddziały ('divisions') +7.2.58. Firmy/Oddziały ('divisions') id - identyfikator shortname - nazwa skrócona firmy @@ -6847,9 +6896,11 @@ inv_footer - stopka faktury inv_author - wystawca faktury inv_cplace - miejsce wystawienia faktury + inv_paytime - termin płatności faktury + inv_paytype - sposób płatności faktury __________________________________________________________________ -7.2.58. Wiadomości - lista ('messages') +7.2.59. Wiadomości - lista ('messages') id - identyfikator subject - temat wiadomości @@ -6860,7 +6911,7 @@ sender - nagłówek 'From' wiadomości e-mail __________________________________________________________________ -7.2.59. Wiadomości - szczegóły ('messageitems') +7.2.60. Wiadomości - szczegóły ('messageitems') id - identyfikator messageid - identyfikator wiadomości @@ -6871,7 +6922,7 @@ error - komunikat błędu __________________________________________________________________ -7.2.60. Informacje o bazie danych ('dbinfo') +7.2.61. Informacje o bazie danych ('dbinfo') keytype - typ keyvalue - wartość From cvs w lms.org.pl Fri Apr 2 17:26:09 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 2 Apr 2010 17:26:09 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc/html/en (devel-db.html, devel.html) Message-ID: <20100402152609.985CC3027B2E@hydra.altec.pl> Date: Friday, April 2, 2010 @ 17:26:09 Author: alec Path: /cvsroot/lms/doc/html/en Modified: devel-db.html devel.html - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/en/devel-db.html.diff?&r1=1.57&r2=1.58 http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/en/devel.html.diff?&r1=1.30&r2=1.31 Index: lms/doc/html/en/devel-db.html diff -u lms/doc/html/en/devel-db.html:1.57 lms/doc/html/en/devel-db.html:1.58 --- lms/doc/html/en/devel-db.html:1.57 Fri Oct 16 13:33:26 2009 +++ lms/doc/html/en/devel-db.html Fri Apr 2 17:26:09 2010 @@ -1738,8 +1738,100 @@ >

7.2.35. Domains ('domains')

id - serial number
name - domain name
description - comments
type - DNS type ('MASTER', 'SLAVE', 'NATIVE')
master - master DNS server
account - email address of DNS administrator
last_check - timestamp
notified_serial - timestamp

7.2.36. DNS Records ('records')

id - serial number
domain_id - domain serial number
name - name
type - record type (MX, SOA, A, AAAA, etc.)
content - data
ttl - TTL
prio - priority
change_date - last change timestamp

7.2.35. Accounts ('passwd')7.2.37. Accounts ('passwd')

7.2.36. Domains ('domains')

id - serial number
name - domain name
description - comments

7.2.37. Aliases ('aliases')7.2.38. Aliases ('aliases')

7.2.38. Alias-to-account assignments ('aliasassignments')7.2.39. Alias-to-account assignments ('aliasassignments')
7.2.39. VoIP Accounts ('voipaccounts')7.2.40. VoIP Accounts ('voipaccounts')
7.2.40. Bandwidth consumption statistics ('stats')7.2.41. Bandwidth consumption statistics ('stats')
7.2.41. Helpdesk - Request Tracking ('rtqueues')7.2.42. Helpdesk - Request Tracking ('rtqueues')
7.2.42. Helpdesk - Request Tracking - continued... ('rttickets')7.2.43. Helpdesk - Request Tracking - continued... ('rttickets')
7.2.43. Helpdesk - Request Tracking - continued... ('rtmessages')7.2.44. Helpdesk - Request Tracking - continued... ('rtmessages')
7.2.44. Helpdesk - Request Tracking - continued... ('rtattachments')7.2.45. Helpdesk - Request Tracking - continued... ('rtattachments')
7.2.45. Helpdesk - Request Tracking - continued... ('rtnotes')7.2.46. Helpdesk - Request Tracking - continued... ('rtnotes')
7.2.46. Helpdesk - Request Tracking - continued... ('rtrights')7.2.47. Helpdesk - Request Tracking - continued... ('rtrights')
7.2.47. LMS-UI Online Configuration ('uiconfig')7.2.48. LMS-UI Online Configuration ('uiconfig')
7.2.48. Timetable - events ('events')7.2.49. Timetable - events ('events')
7.2.49. Timetable - assignments ('eventassignments')7.2.50. Timetable - assignments ('eventassignments')
7.2.50. Sessions ('sessions')7.2.51. Sessions ('sessions')
7.2.51. Hosts ('hosts')7.2.52. Hosts ('hosts')
7.2.52. Daemon configuration - instances ('daemoninstances')7.2.53. Daemon configuration - instances ('daemoninstances')
7.2.53. Daemon configuration - options ('daemonconfig')7.2.54. Daemon configuration - options ('daemonconfig')
7.2.54. States ('states')7.2.55. States ('states')
7.2.55. Zip codes ('zipcodes')7.2.56. Zip codes ('zipcodes')
7.2.56. Countries ('countries')7.2.57. Countries ('countries')
7.2.57. Companies/Divisions ('divisions')7.2.58. Companies/Divisions ('divisions')
inv_cplace - invoice creation place
inv_paytime - invoice deadline
inv_paytype - invoice type of payment
7.2.58. Messages - list ('messages')7.2.59. Messages - list ('messages')7.2.59. Messages - items ('messageitems')7.2.60. Messages - items ('messageitems')
7.2.60. Database information ('dbinfo')7.2.61. Database information ('dbinfo')
7.2.35. Accounts ('passwd')Domains ('domains')
7.2.36. Domains ('domains')DNS Records ('records')
7.2.37. Accounts ('passwd')
7.2.38. Aliases ('aliases')
7.2.38. 7.2.39. Alias-to-account assignments ('aliasassignments')
7.2.39. 7.2.40. VoIP Accounts ('voipaccounts')
7.2.40. 7.2.41. Bandwidth consumption statistics ('stats')
7.2.41. 7.2.42. Helpdesk - Request Tracking ('rtqueues')
7.2.42. 7.2.43. Helpdesk - Request Tracking - continued... ('rttickets')
7.2.43. 7.2.44. Helpdesk - Request Tracking - continued... ('rtmessages')
7.2.44. 7.2.45. Helpdesk - Request Tracking - continued... ('rtattachments')
7.2.45. 7.2.46. Helpdesk - Request Tracking - continued... ('rtnotes')
7.2.46. 7.2.47. Helpdesk - Request Tracking - continued... ('rtrights')
7.2.47. 7.2.48. LMS-UI Online Configuration ('uiconfig')
7.2.48. 7.2.49. Timetable - events ('events')
7.2.49. 7.2.50. Timetable - assignments ('eventassignments')
7.2.50. 7.2.51. Sessions ('sessions')
7.2.51. 7.2.52. Hosts ('hosts')
7.2.52. 7.2.53. Daemon configuration - instances ('daemoninstances')
7.2.53. 7.2.54. Daemon configuration - options ('daemonconfig')
7.2.54. 7.2.55. States ('states')
7.2.55. 7.2.56. Zip codes ('zipcodes')
7.2.56. 7.2.57. Countries ('countries')
7.2.57. 7.2.58. Companies/Divisions ('divisions')
7.2.58. 7.2.59. Messages - list ('messages')
7.2.59. 7.2.60. Messages - items ('messageitems')
7.2.60. 7.2.61. Database information ('dbinfo')
Date: Friday, April 2, 2010 @ 17:26:09 Author: alec Path: /cvsroot/lms/doc/html/pl Modified: daemon-modules.html daemon.html devel-db.html devel.html - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/daemon-modules.html.diff?&r1=1.66&r2=1.67 http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/daemon.html.diff?&r1=1.28&r2=1.29 http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/devel-db.html.diff?&r1=1.64&r2=1.65 http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/devel.html.diff?&r1=1.39&r2=1.40 Index: lms/doc/html/pl/daemon-modules.html diff -u lms/doc/html/pl/daemon-modules.html:1.66 lms/doc/html/pl/daemon-modules.html:1.67 --- lms/doc/html/pl/daemon-modules.html:1.66 Sat Feb 6 19:52:47 2010 +++ lms/doc/html/pl/daemon-modules.html Fri Apr 2 17:26:09 2010 @@ -269,6 +269,15 @@ >
Konfiguracja EtherWerX Standalone Traffic Managera
ewx-stm-channelsKonfiguracja EtherWerX Standalone Traffic Managera (ze rozszerzoną obsługą kanałów)

6.2.19. Ewx-stm-channels

6.2.19.1. Wstęp

Moduł ewx-stm-channels to odpowiednik modułu ewx-stm (służącego do zarządzania urządzeniem Standalone Traffic + Manager marki EtherWerX) zawierający rozbudowaną obsługę kanałów. +

Różnica w pracy tych modułów jest następująca. Moduł ewx-stm tworzy kanały + automatycznie w zależności od ustawień zobowiązań klientów i ich przypisania + do komputerów. Nie obsługuje kanałów zdefiniowanych w LMS-UI. Z kolei moduł ewx-stm-channels pracuje wyłącznie z kanałami zdefiniowanymi w LMS-UI. Komputery + powinny być przypisane do urządzeń sieciowych, a te z kolei do kanałów o zdefiniowanych + parametrach. Komputery nie przypisane do żadnego kanału są pomijane. Można to zmienić + definiując parametry domyślnego kanału w konfiguracji modułu, do którego trafią + wszystkie komputery bez powiązania. +

6.2.19.2. Konfiguracja

Moduł ewx-stm-channels oprócz opcji dostępnych dla modułu ewx-stm udostępnia następujące opcje:

  • default_upceil

    Wartość upceil dla domyślnego kanału. Domyślnie: 0.

    Przykład: default_upceil = 10000

  • default_downceil

    Wartość downceil dla domyślnego kanału. Domyślnie: 0

    Przykład: default_downceil = 20000

7.2.36. Rekordy DNS ('records')

id - identyfikator rekordu
domain_id - identyfikator domeny
name - nazwa
type - typ rekordu (MX, SOA, A, AAAA, itd.)
content - dane
ttl - TTL
prio - priorytet
change_date - znacznik czasu ostatniej zmiany

7.2.35. Konta ('passwd')7.2.37. Konta ('passwd')

7.2.36. Domeny ('domains')

id - identyfikator rekordu
name - nazwa domeny
description - opis

7.2.37. Aliasy ('aliases')7.2.38. Aliasy ('aliases')

7.2.38. Powiązania aliasów z kontami ('aliasassignments')7.2.39. Powiązania aliasów z kontami ('aliasassignments')
7.2.39. Konta VoIP ('voipaccounts')7.2.40. Konta VoIP ('voipaccounts')
7.2.40. Statystyki wykorzystania łącza ('stats')7.2.41. Statystyki wykorzystania łącza ('stats')
7.2.41. Helpdesk - kolejki ('rtqueues')7.2.42. Helpdesk - kolejki ('rtqueues')
7.2.42. Helpdesk - zgłoszenia ('rttickets')7.2.43. Helpdesk - zgłoszenia ('rttickets')
7.2.43. Helpdesk - wiadomości ('rtmessages')7.2.44. Helpdesk - wiadomości ('rtmessages')
7.2.44. Helpdesk - załączniki ('rtattachments')7.2.45. Helpdesk - załączniki ('rtattachments')
7.2.45. Helpdesk - notatki ('rtnotes')7.2.46. Helpdesk - notatki ('rtnotes')
7.2.46. Helpdesk - uprawnienia ('rtrights')7.2.47. Helpdesk - uprawnienia ('rtrights')
7.2.47. Konfiguracja LMS-UI ('uiconfig')7.2.48. Konfiguracja LMS-UI ('uiconfig')
7.2.48. Terminarz - zdarzenia ('events')7.2.49. Terminarz - zdarzenia ('events')
7.2.49. Terminarz - powiązania ('eventassignments')7.2.50. Terminarz - powiązania ('eventassignments')
7.2.50. Hosty ('hosts')7.2.51. Hosty ('hosts')
7.2.51. Konfiguracja demona - instancje ('daemoninstances')7.2.52. Konfiguracja demona - instancje ('daemoninstances')
7.2.52. Konfiguracja demona - opcje ('daemonconfig')7.2.53. Konfiguracja demona - opcje ('daemonconfig')
7.2.53. Sesje ('sessions')7.2.54. Sesje ('sessions')
7.2.54. Województwa ('states')7.2.55. Województwa ('states')
7.2.55. Kody pocztowe ('zipcodes')7.2.56. Kody pocztowe ('zipcodes')
7.2.56. Kraje ('countries')7.2.57. Kraje ('countries')
7.2.57. Firmy/Oddziały ('divisions')7.2.58. Firmy/Oddziały ('divisions')
inv_cplace - miejsce wystawienia faktury
inv_paytime - termin płatności faktury
inv_paytype - sposób płatności faktury
7.2.58. Wiadomości - lista ('messages')7.2.59. Wiadomości - lista ('messages')7.2.59. Wiadomości - szczegóły ('messageitems')7.2.60. Wiadomości - szczegóły ('messageitems')
7.2.60. Informacje o bazie danych ('dbinfo')7.2.61. Informacje o bazie danych ('dbinfo')
7.2.35. Konta ('passwd')Domeny ('domains')
7.2.36. Domeny ('domains')Rekordy DNS ('records')
7.2.37. Konta ('passwd')
7.2.38. Aliasy ('aliases')
7.2.38. 7.2.39. Powiązania aliasów z kontami ('aliasassignments')
7.2.39. 7.2.40. Konta VoIP ('voipaccounts')
7.2.40. 7.2.41. Statystyki wykorzystania łącza ('stats')
7.2.41. 7.2.42. Helpdesk - kolejki ('rtqueues')
7.2.42. 7.2.43. Helpdesk - zgłoszenia ('rttickets')
7.2.43. 7.2.44. Helpdesk - wiadomości ('rtmessages')
7.2.44. 7.2.45. Helpdesk - załączniki ('rtattachments')
7.2.45. 7.2.46. Helpdesk - notatki ('rtnotes')
7.2.46. 7.2.47. Helpdesk - uprawnienia ('rtrights')
7.2.47. 7.2.48. Konfiguracja LMS-UI ('uiconfig')
7.2.48. 7.2.49. Terminarz - zdarzenia ('events')
7.2.49. 7.2.50. Terminarz - powiązania ('eventassignments')
7.2.50. 7.2.51. Hosty ('hosts')
7.2.51. 7.2.52. Konfiguracja demona - instancje ('daemoninstances')
7.2.52. 7.2.53. Konfiguracja demona - opcje ('daemonconfig')
7.2.53. 7.2.54. Sesje ('sessions')
7.2.54. 7.2.55. Województwa ('states')
7.2.55. 7.2.56. Kody pocztowe ('zipcodes')
7.2.56. 7.2.57. Kraje ('countries')
7.2.57. 7.2.58. Firmy/Oddziały ('divisions')
7.2.58. 7.2.59. Wiadomości - lista ('messages')
7.2.59. 7.2.60. Wiadomości - szczegóły ('messageitems')
7.2.60. 7.2.61. Informacje o bazie danych ('dbinfo')
Date: Friday, April 2, 2010 @ 17:26:09 Author: alec Path: /cvsroot/lms/doc/sgml Modified: advanced.sgml - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/advanced.sgml.diff?&r1=1.111&r2=1.112 Index: lms/doc/sgml/advanced.sgml diff -u lms/doc/sgml/advanced.sgml:1.111 lms/doc/sgml/advanced.sgml:1.112 --- lms/doc/sgml/advanced.sgml:1.111 Fri Oct 16 13:33:27 2009 +++ lms/doc/sgml/advanced.sgml Fri Apr 2 17:26:09 2010 @@ -1,4 +1,4 @@ - + For curious @@ -534,6 +534,32 @@ name - contact name/description + + Domains ('domains') + + id - serial number + name - domain name + description - comments + type - DNS type ('MASTER', 'SLAVE', 'NATIVE') + master - master DNS server + account - email address of DNS administrator + last_check - timestamp + notified_serial - timestamp + + + + DNS Records ('records') + + id - serial number + domain_id - domain serial number + name - name + type - record type (MX, SOA, A, AAAA, etc.) + content - data + ttl - TTL + prio - priority + change_date - last change timestamp + + Accounts ('passwd') @@ -559,14 +585,6 @@ description - additional information - - Domains ('domains') - - id - serial number - name - domain name - description - comments - - Aliases ('aliases') @@ -796,6 +814,8 @@ inv_footer - invoice footer inv_author - invoice default author inv_cplace - invoice creation place + inv_paytime - invoice deadline + inv_paytype - invoice type of payment From cvs w lms.org.pl Fri Apr 2 17:26:10 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 2 Apr 2010 17:26:10 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc/sgml/pl (advanced.sgml, daemon.sgml) Message-ID: <20100402152610.0FE553027B2E@hydra.altec.pl> Date: Friday, April 2, 2010 @ 17:26:10 Author: alec Path: /cvsroot/lms/doc/sgml/pl Modified: advanced.sgml daemon.sgml - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/advanced.sgml.diff?&r1=1.73&r2=1.74 http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/daemon.sgml.diff?&r1=1.79&r2=1.80 Index: lms/doc/sgml/pl/advanced.sgml diff -u lms/doc/sgml/pl/advanced.sgml:1.73 lms/doc/sgml/pl/advanced.sgml:1.74 --- lms/doc/sgml/pl/advanced.sgml:1.73 Fri Oct 16 13:33:27 2009 +++ lms/doc/sgml/pl/advanced.sgml Fri Apr 2 17:26:09 2010 @@ -1,4 +1,4 @@ - + Dla dociekliwych @@ -537,6 +537,31 @@ name - nazwa/opis kontaktu + + Domeny ('domains') + + id - identyfikator rekordu + name - nazwa domeny + type - typ DNS ('MASTER', 'SLAVE', 'NATIVE') + master - adres głównego serwera DNS + account - adres e-mail administratora DNS + last_check - znacznik czasu + notified_serial - znacznik czasu + + + + Rekordy DNS ('records') + + id - identyfikator rekordu + domain_id - identyfikator domeny + name - nazwa + type - typ rekordu (MX, SOA, A, AAAA, itd.) + content - dane + ttl - TTL + prio - priorytet + change_date - znacznik czasu ostatniej zmiany + + Konta ('passwd') @@ -562,14 +587,6 @@ description - dodatkowe informacje - - Domeny ('domains') - - id - identyfikator rekordu - name - nazwa domeny - description - opis - - Aliasy ('aliases') @@ -799,6 +816,8 @@ inv_footer - stopka faktury inv_author - wystawca faktury inv_cplace - miejsce wystawienia faktury + inv_paytime - termin płatności faktury + inv_paytype - sposób płatności faktury Index: lms/doc/sgml/pl/daemon.sgml diff -u lms/doc/sgml/pl/daemon.sgml:1.79 lms/doc/sgml/pl/daemon.sgml:1.80 --- lms/doc/sgml/pl/daemon.sgml:1.79 Mon Dec 14 12:09:14 2009 +++ lms/doc/sgml/pl/daemon.sgml Fri Apr 2 17:26:09 2010 @@ -1,4 +1,4 @@ - + LMS Daemon @@ -251,6 +251,10 @@ Konfiguracja EtherWerX Standalone Traffic Managera + + + Konfiguracja EtherWerX Standalone Traffic Managera (ze rozszerzoną obsługą kanałów) +
@@ -1774,6 +1778,39 @@ + + Ewx-stm-channels + + Wstęp + Moduł ewx-stm-channels to odpowiednik modułu ewx-stm (służącego do zarządzania urządzeniem Standalone Traffic + Manager marki EtherWerX) zawierający rozbudowaną obsługę kanałów. + + Różnica w pracy tych modułów jest następująca. Moduł ewx-stm tworzy kanały + automatycznie w zależności od ustawień zobowiązań klientów i ich przypisania + do komputerów. Nie obsługuje kanałów zdefiniowanych w LMS-UI. Z kolei moduł ewx-stm-channels pracuje wyłącznie z kanałami zdefiniowanymi w LMS-UI. Komputery + powinny być przypisane do urządzeń sieciowych, a te z kolei do kanałów o zdefiniowanych + parametrach. Komputery nie przypisane do żadnego kanału są pomijane. Można to zmienić + definiując parametry domyślnego kanału w konfiguracji modułu, do którego trafią + wszystkie komputery bez powiązania. + + + + Konfiguracja + Moduł ewx-stm-channels oprócz opcji dostępnych dla modułu ewx-stm udostępnia następujące opcje: + + + default_upceil + Wartość upceil dla domyślnego kanału. Domyślnie: 0. + Przykład: default_upceil = 10000 + + + default_downceil + Wartość downceil dla domyślnego kanału. Domyślnie: 0 + Przykład: default_downceil = 20000 + + + + &tscript; From cvs w lms.org.pl Wed Apr 7 15:14:52 2010 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 7 Apr 2010 15:14:52 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (trafficgraph.php) Message-ID: <20100407131452.294AE3027B29@hydra.altec.pl> Date: Wednesday, April 7, 2010 @ 15:14:52 Author: alec Path: /cvsroot/lms/modules Modified: trafficgraph.php - fix graph title if node not exists Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/trafficgraph.php.diff?&r1=1.4&r2=1.5 Index: lms/modules/trafficgraph.php diff -u lms/modules/trafficgraph.php:1.4 lms/modules/trafficgraph.php:1.5 --- lms/modules/trafficgraph.php:1.4 Thu Mar 11 14:07:49 2010 +++ lms/modules/trafficgraph.php Wed Apr 7 15:14:51 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: trafficgraph.php,v 1.4 2010/03/11 13:07:49 alec Exp $ + * $Id: trafficgraph.php,v 1.5 2010/04/07 13:14:51 alec Exp $ */ if(!function_exists('imagecreate')) @@ -287,9 +287,12 @@ } // title - if($nodeid) - $title = $node['name'].' - '.$node['ip']; - else + if ($nodeid) { + if ($node) + $title = $node['name'].' - '.$node['ip']; + else + $title = iconv('UTF-8','ISO-8859-2//TRANSLIT', trans('unknown')).' (ID: '.$nodeid.')'; + } else $title = iconv('UTF-8','ISO-8859-2//TRANSLIT', trans('Network Statistics')); $center = ceil((imagesx($img) - (imagefontwidth(3) * strlen($title)))/2); From cvs w lms.org.pl Thu Apr 8 12:46:39 2010 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 8 Apr 2010 12:46:39 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20100408104639.AEC393027B2C@hydra.altec.pl> Date: Thursday, April 8, 2010 @ 12:46:39 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - code cleanup, updated translations Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.353&r2=1.354 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.353 lms/lib/locale/pl/strings.php:1.354 --- lms/lib/locale/pl/strings.php:1.353 Wed Mar 17 19:32:40 2010 +++ lms/lib/locale/pl/strings.php Thu Apr 8 12:46:39 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.353 2010/03/17 18:32:40 chilek Exp $ + * $Id: strings.php,v 1.354 2010/04/08 10:46:39 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -2334,5 +2334,12 @@ $_LANG['Select channel (optional)'] = 'Wybierz kanał (opcjonalnie)'; $_LANG['select device'] = 'wybierz urządzenie'; $_LANG['Select device to associate with the channel'] = 'Wybierz urządzenie aby przypisać je do kanału'; +$_LANG['A hostname can not start or end with a dash!'] = 'Nazwa hosta nie może zaczynać lub kończyć się znakiem myślnika!'; +$_LANG['Given hostname has too many slashes!'] = 'Nazwa hosta nie może zawierać ukośników!'; +$_LANG['Given hostname or one of the labels is too short or too long!'] = 'Nazwa hosta lub jej element jest zbyt krótki!'; +$_LANG['Invalid hostname!'] = 'Błędna nazwa hosta!'; +$_LANG['The hostname is too long!'] = 'Nazwa hosta jest za długa!'; +$_LANG['You are using an invalid top level domain!'] = 'Użycie błędnej domeny najwyższego poziomu!'; +$_LANG['You have invalid characters in your hostname!'] = 'Nazwa hosta zawiera niedozwolone znaki!'; ?> From cvs w lms.org.pl Thu Apr 8 12:46:39 2010 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 8 Apr 2010 12:46:39 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (5 files) Message-ID: <20100408104639.CFB1B3027B2D@hydra.altec.pl> Date: Thursday, April 8, 2010 @ 12:46:39 Author: alec Path: /cvsroot/lms/modules Modified: domainadd.php recordadd.php recorddel.php recordedit.php Removed: domainf.php - code cleanup, updated translations Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/domainadd.php.diff?&r1=1.24&r2=1.25 http://cvs.lms.org.pl/viewvc/Development/lms/modules/domainf.php?rev=1.2 http://cvs.lms.org.pl/viewvc/Development/lms/modules/recordadd.php.diff?&r1=1.12&r2=1.13 http://cvs.lms.org.pl/viewvc/Development/lms/modules/recorddel.php.diff?&r1=1.5&r2=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/modules/recordedit.php.diff?&r1=1.9&r2=1.10 Index: lms/modules/domainadd.php diff -u lms/modules/domainadd.php:1.24 lms/modules/domainadd.php:1.25 --- lms/modules/domainadd.php:1.24 Thu Mar 11 14:07:45 2010 +++ lms/modules/domainadd.php Thu Apr 8 12:46:39 2010 @@ -21,9 +21,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: domainadd.php,v 1.24 2010/03/11 13:07:45 alec Exp $ + * $Id: domainadd.php,v 1.25 2010/04/08 10:46:39 alec Exp $ */ +include(LIB_DIR.'/dns.php'); + function GetDomainIdByName($name) { global $DB; @@ -52,13 +54,11 @@ $error['ipmailserwer'] = trans('IP address of mailserver is required!'); } - include('domainf.php'); - - $errorname = trans(is_not_valid_hostname_fqdn($domainadd['name'],0,1)); - if ($errorname) + if ($domainadd['name'] == '') + $error['name'] = trans('Domain name is required!'); + else if ($errorname = check_hostname_fqdn($domainadd['name'], false, true)) $error['name'] = $errorname; - - if (GetDomainIdByName($domainadd['name'])) + else if (GetDomainIdByName($domainadd['name'])) $error['name'] = trans('Domain with specified name exists!'); if($domainadd['ownerid']) Index: lms/modules/domainf.php diff -u lms/modules/domainf.php:1.2 lms/modules/domainf.php:removed --- lms/modules/domainf.php:1.2 Sun Feb 21 19:12:37 2010 +++ lms/modules/domainf.php Thu Apr 8 12:46:39 2010 @@ -1,147 +0,0 @@ - for more details. - * - * Copyright 2007-2009 Rejo Zenger - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License Version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - * - */ - -$valid_tlds = array( - "ac", "ad", "ae", "aero", "af", "ag", "ai", "al", "am", "an", "ao", "aq", "ar", - "arpa", "as", "asia", "at", "au", "aw", "ax", "az", "ba", "bb", "bd", "be", - "bf", "bg", "bh", "bi", "biz", "bj", "bm", "bn", "bo", "br", "bs", "bt", "bv", - "bw", "by", "bz", "ca", "cat", "cc", "cd", "cf", "cg", "ch", "ci", "ck", "cl", - "cm", "cn", "co", "com", "coop", "cr", "cu", "cv", "cx", "cy", "cz", "de", "dj", - "dk", "dm", "do", "dz", "ec", "edu", "ee", "eg", "er", "es", "et", "eu", "fi", - "fj", "fk", "fm", "fo", "fr", "ga", "gb", "gd", "ge", "gf", "gg", "gh", "gi", - "gl", "gm", "gn", "gov", "gp", "gq", "gr", "gs", "gt", "gu", "gw", "gy", "hk", - "hm", "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "info", "int", "io", - "iq", "ir", "is", "it", "je", "jm", "jo", "jobs", "jp", "ke", "kg", "kh", "ki", - "km", "kn", "kp", "kr", "kw", "ky", "kz", "la", "lb", "lc", "li", "lk", "lr", - "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me", "mg", "mh", "mil", "mk", - "ml", "mm", "mn", "mo", "mobi", "mp", "mq", "mr", "ms", "mt", "mu", "museum", - "mv", "mw", "mx", "my", "mz", "na", "name", "nc", "ne", "net", "nf", "ng", "ni", - "nl", "no", "np", "nr", "nu", "nz", "om", "org", "pa", "pe", "pf", "pg", "ph", - "pk", "pl", "pm", "pn", "pr", "pro", "ps", "pt", "pw", "py", "qa", "re", "ro", - "rs", "ru", "rw", "sa", "sb", "sc", "sd", "se", "sg", "sh", "si", "sj", "sk", - "sl", "sm", "sn", "so", "sr", "st", "su", "sv", "sy", "sz", "tc", "td", "tel", - "tf", "tg", "th", "tj", "tk", "tl", "tm", "tn", "to", "tp", "tr", "travel", - "tt", "tv", "tw", "tz", "ua", "ug", "uk", "um", "us", "uy", "uz", "va", "vc", - "ve", "vg", "vi", "vn", "vu", "wf", "ws", "xn--0zwm56d", "xn--11b5bs3a9aj6g", - "xn--80akhbyknj4f", "xn--9t4b11yi5a", "xn--deba0ad", "xn--g6w251d", - "xn--hgbk6aj7f53bba", "xn--hlcj6aya9esc7a", "xn--jxalpdlp", "xn--kgbechtv", - "xn--zckzah", "ye", "yt", "yu", "za", "zm", "zw"); - - -function is_not_valid_hostname_fqdn($hostname, $wildcard, $dns_strict_tld_check) { - - global $valid_tlds; - $hostname = ereg_replace("\.$","",$hostname); - - if (strlen($hostname) > 255) { - return "The hostname is too long"; - } - - $hostname_labels = explode ('.', $hostname); - $label_count = count($hostname_labels); - - foreach ($hostname_labels as $hostname_label) { - if ($wildcard == 1 && !isset($first)) { - if (!preg_match('/^(\*|[a-zA-Z0-9-\/]+)$/',$hostname_label)) { return "You have invalid characters in your hostname"; } - $first = 1; - } else { - if (!preg_match('/^[a-zA-Z0-9-\/]+$/',$hostname_label)) { return "You have invalid characters in your hostname"; } - } - if (substr($hostname_label, 0, 1) == "-") { return "A hostname can not start or end with a dash"; } - if (substr($hostname_label, -1, 1) == "-") { return "A hostname can not start or end with a dash"; } - if (strlen($hostname_label) < 1 || strlen($hostname_label) > 63) { return "Given hostname or one of the labels is too short or too long"; } - } - - if ($hostname_labels[$label_count-1] == "arpa" && (substr_count($hostname_labels[0], "/") == 1 XOR substr_count($hostname_labels[1], "/") == 1)) { - if (substr_count($hostname_labels[0], "/") == 1) { - $array = explode ("/", $hostname_labels[0]); - } else { - $array = explode ("/", $hostname_labels[1]); - } - if (count($array) != 2) { return "Invalid hostname" ;} - if (!is_numeric($array[0]) || $array[0] < 0 || $array[0] > 255) { return "Invalid hostname"; } - if (!is_numeric($array[1]) || $array[1] < 25 || $array[1] > 31) { return "Invalid hostname"; } - } else { - if (substr_count($hostname, "/") > 0) { return "Given hostname has too many slashes"; } - } - - if ($dns_strict_tld_check == "1" && !in_array($hostname_labels[$label_count-1], $valid_tlds)) { - return "You are using an invalid top level domain"; - } - - return false; -} - - -function update_soa_serial($did) -{ - global $DB; - - $soarecordq = $DB->GetRow("SELECT * from records where domain_id = ? and type='SOA'", array($did)); - - $soa = explode(" ", $soarecordq['content']); - - - if ($soa[2] == "0") { - return true; - } elseif ($soa[2] == date('Ymd') . "99") { - return true; - } else { - $today = date('Ymd'); - - // Determine revision. - if (strncmp($today, $soa[2], 8) === 0) { - // Current serial starts with date of today, so we need to update - // the revision only. To do so, determine current revision first, - // then update counter. - $revision = (int) substr($soa[2], -2); - ++$revision; - } else { - // Current serial did not start of today, so it's either an older - // serial or a serial that does not adhere the recommended syntax - // of RFC-1912. In either way, set a fresh serial - $revision = "00"; - } - - $serial = $today . str_pad($revision, 2, "0", STR_PAD_LEFT);; - - // Change serial in SOA array. - $soa[2] = $serial; - - // Build new SOA record content and update the database. - $content = ""; - for ($i = 0; $i < count($soa); $i++) { - $content .= $soa[$i] . " "; - } - } - - $DB->Execute('UPDATE records SET content = ? WHERE id = ?', - array($content, $soarecordq['id'])); -} - -?> Index: lms/modules/recordadd.php diff -u lms/modules/recordadd.php:1.12 lms/modules/recordadd.php:1.13 --- lms/modules/recordadd.php:1.12 Fri Mar 12 08:56:31 2010 +++ lms/modules/recordadd.php Thu Apr 8 12:46:39 2010 @@ -22,9 +22,10 @@ * */ +include(LIB_DIR.'/dns.php'); + if (isset($_POST['record'])) { - include('domainf.php'); $record = $_POST['record']; $arpa_record_type_allowed = array('PTR','SOA','NS','TXT','CNAME','MX','SPF','NAPTR','URL','MBOXFW','CURL','SSHFP'); @@ -43,8 +44,7 @@ if (in_array($record['type'],array('PTR','NS'))) { - $errorcontent = trans(is_not_valid_hostname_fqdn($record['content'],0,1)); - if ($errorcontent) + if ($errorcontent = check_hostname_fqdn($record['content'], false, true)) $error['content'] = $errorcontent; } @@ -59,13 +59,12 @@ $error['content'] = trans('Wrong Content'); if (!empty($record['name'])) - if ($errorname = trans(is_not_valid_hostname_fqdn($record['name'], 1, 0))) + if ($errorname = check_hostname_fqdn($record['name'], true, false)) $error['name'] = $errorname; if ($record['type'] == 'SOA') { - $soa=$DB->GetRow('SELECT type FROM records WHERE type=\'SOA\' AND domain_id=?', array($record['domain_id'])); - if ($soa['type'] == 'SOA') + if ($DB->GetOne('SELECT 1 FROM records WHERE type=\'SOA\' AND domain_id=?', array($record['domain_id']))) $error['type'] = trans('SOA record already exists'); } Index: lms/modules/recorddel.php diff -u lms/modules/recorddel.php:1.5 lms/modules/recorddel.php:1.6 --- lms/modules/recorddel.php:1.5 Wed Mar 10 14:08:32 2010 +++ lms/modules/recorddel.php Thu Apr 8 12:46:39 2010 @@ -29,7 +29,8 @@ $domainid = $DB->GetRow('SELECT domain_id FROM records WHERE records.id = ?', array($id)); $DB->Execute('DELETE FROM records WHERE id = ?', array($id)); - include('domainf.php'); + include(LIB_DIR.'/dns.php'); + update_soa_serial($domainid['domain_id']); } Index: lms/modules/recordedit.php diff -u lms/modules/recordedit.php:1.9 lms/modules/recordedit.php:1.10 --- lms/modules/recordedit.php:1.9 Wed Mar 10 14:08:32 2010 +++ lms/modules/recordedit.php Thu Apr 8 12:46:39 2010 @@ -22,6 +22,8 @@ * */ +include(LIB_DIR.'/dns.php'); + $id = $_GET['id']*1; $domain = $DB->GetRow('SELECT domains.name, domains.id @@ -30,7 +32,6 @@ if (isset($_POST['record'])) { - include('domainf.php'); $record = $_POST['record']; $record['id'] = $id; $arpa_record_type_allowed = array('PTR','SOA','NS','TXT','CNAME','MX','SPF','NAPTR','URL','MBOXFW','CURL','SSHFP'); @@ -48,8 +49,7 @@ if (in_array($record['type'], array('PTR','NS'))) { - $errorcontent = trans(is_not_valid_hostname_fqdn($record['content'],0,1)); - if ($errorcontent) + if ($errorcontent = check_hostname_fqdn($record['content'], false, true)) $error['content'] = $errorcontent; } } @@ -63,7 +63,7 @@ $error['content'] = trans('Wrong Content'); if (!empty($record['name'])) - if ($errorname = trans(is_not_valid_hostname_fqdn($record['name'],1,0))) + if ($errorname = check_hostname_fqdn($record['name'], true, false)) $error['name'] = $errorname; if (!$error) From cvs w lms.org.pl Thu Apr 8 12:46:39 2010 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 8 Apr 2010 12:46:39 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (dns.php, language.php) Message-ID: <20100408104639.8C3973027B29@hydra.altec.pl> Date: Thursday, April 8, 2010 @ 12:46:39 Author: alec Path: /cvsroot/lms/lib Added: dns.php Modified: language.php - code cleanup, updated translations Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/dns.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/lib/language.php.diff?&r1=1.49&r2=1.50 Index: lms/lib/dns.php diff -u /dev/null lms/lib/dns.php:1.1 --- /dev/null Thu Apr 8 12:46:39 2010 +++ lms/lib/dns.php Thu Apr 8 12:46:39 2010 @@ -0,0 +1,165 @@ + 255) { + return trans('The hostname is too long!'); + } + + $hostname_labels = explode ('.', $hostname); + $label_count = count($hostname_labels); + + foreach ($hostname_labels as $hostname_label) { + if ($wildcard && !isset($first)) { + if (!preg_match('/^(\*|[a-zA-Z0-9-\/]+)$/',$hostname_label)) { + return trans('You have invalid characters in your hostname!'); + } + $first = 1; + } else { + if (!preg_match('/^[a-zA-Z0-9-\/]+$/',$hostname_label)) { + return trans('You have invalid characters in your hostname!'); + } + } + if (substr($hostname_label, 0, 1) == '-') { + return trans('A hostname can not start or end with a dash!'); + } + if (substr($hostname_label, -1, 1) == '-') { + return trans('A hostname can not start or end with a dash!'); + } + if (strlen($hostname_label) < 1 || strlen($hostname_label) > 63) { + return trans('Given hostname or one of the labels is too short or too long!'); + } + } + + if ($hostname_labels[$label_count-1] == 'arpa' + && (substr_count($hostname_labels[0], '/') == 1 XOR substr_count($hostname_labels[1], '/') == 1)) { + if (substr_count($hostname_labels[0], '/') == 1) { + $array = explode ('/', $hostname_labels[0]); + } else { + $array = explode ('/', $hostname_labels[1]); + } + if (count($array) != 2) { + return trans('Invalid hostname!'); + } + if (!is_numeric($array[0]) || $array[0] < 0 || $array[0] > 255) { + return trans('Invalid hostname!'); + } + if (!is_numeric($array[1]) || $array[1] < 25 || $array[1] > 31) { + return trans('Invalid hostname!'); + } + } else { + if (substr_count($hostname, '/') > 0) { + return trans('Given hostname has too many slashes!'); + } + } + + if ($dns_strict_tld_check && !in_array($hostname_labels[$label_count-1], $valid_tlds)) { + return trans('You are using an invalid top level domain!'); + } + + return false; +} + + +function update_soa_serial($did) +{ + global $DB; + + $record = $DB->GetRow("SELECT * from records where domain_id = ? and type='SOA'", array($did)); + + $soa = explode(' ', $record['content']); + + + if ($soa[2] == '0') { + return true; + } elseif ($soa[2] == date('Ymd') . '99') { + return true; + } else { + $today = date('Ymd'); + + // Determine revision. + if (strncmp($today, $soa[2], 8) === 0) { + // Current serial starts with date of today, so we need to update + // the revision only. To do so, determine current revision first, + // then update counter. + $revision = (int) substr($soa[2], -2); + ++$revision; + } else { + // Current serial did not start of today, so it's either an older + // serial or a serial that does not adhere the recommended syntax + // of RFC-1912. In either way, set a fresh serial + $revision = '00'; + } + + $serial = $today . str_pad($revision, 2, '0', STR_PAD_LEFT);; + + // Change serial in SOA array. + $soa[2] = $serial; + + // Build new SOA record content and update the database. + $content = ''; + for ($i = 0; $i < count($soa); $i++) { + $content .= $soa[$i] . ' '; + } + } + + $DB->Execute('UPDATE records SET content = ? WHERE id = ?', + array(trim($content), $record['id'])); +} + +?> Index: lms/lib/language.php diff -u lms/lib/language.php:1.49 lms/lib/language.php:1.50 --- lms/lib/language.php:1.49 Thu Mar 11 14:07:34 2010 +++ lms/lib/language.php Thu Apr 8 12:46:39 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: language.php,v 1.49 2010/03/11 13:07:34 alec Exp $ + * $Id: language.php,v 1.50 2010/04/08 10:46:39 alec Exp $ */ function trans() @@ -125,8 +125,10 @@ $_LANG = array(); - w include(LIB_DIR.'/locale/'.$_language.'/strings.php'); - w include(LIB_DIR.'/locale/'.$_language.'/functions.php'); +if (@is_readable(LIB_DIR.'/locale/'.$_language.'/strings.php')) + include(LIB_DIR.'/locale/'.$_language.'/strings.php'); +if (@is_readable(LIB_DIR.'/locale/'.$_language.'/functions.php')) + include(LIB_DIR.'/locale/'.$_language.'/functions.php'); setlocale(LC_COLLATE, $LANGDEFS[$_language]['locale']); setlocale(LC_CTYPE, $LANGDEFS[$_language]['locale']); From cvs w lms.org.pl Thu Apr 8 12:46:39 2010 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 8 Apr 2010 12:46:39 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (3 files) Message-ID: <20100408104639.EEC8C3027B2E@hydra.altec.pl> Date: Thursday, April 8, 2010 @ 12:46:39 Author: alec Path: /cvsroot/lms/templates Modified: recordadd.html recordedit.html recordlist.html - code cleanup, updated translations Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/recordadd.html.diff?&r1=1.5&r2=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/templates/recordedit.html.diff?&r1=1.5&r2=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/templates/recordlist.html.diff?&r1=1.1&r2=1.2 Index: lms/templates/recordadd.html diff -u lms/templates/recordadd.html:1.5 lms/templates/recordadd.html:1.6 --- lms/templates/recordadd.html:1.5 Wed Mar 10 14:08:32 2010 +++ lms/templates/recordadd.html Thu Apr 8 12:46:39 2010 @@ -4,7 +4,7 @@ - + Index: lms/templates/recordedit.html diff -u lms/templates/recordedit.html:1.5 lms/templates/recordedit.html:1.6 --- lms/templates/recordedit.html:1.5 Wed Mar 10 14:08:32 2010 +++ lms/templates/recordedit.html Thu Apr 8 12:46:39 2010 @@ -4,7 +4,7 @@
{t}Name:{/t}{t}Host:{/t} {t}TTL{/t}: {t}Type{/t}: {t}Priority:{/t}
- + Index: lms/templates/recordlist.html diff -u lms/templates/recordlist.html:1.1 lms/templates/recordlist.html:1.2 --- lms/templates/recordlist.html:1.1 Wed Mar 10 14:08:32 2010 +++ lms/templates/recordlist.html Thu Apr 8 12:46:39 2010 @@ -2,7 +2,7 @@

{$layout.pagetitle}

{t}Name:{/t}{t}Host:{/t} {t}TTL{/t}: {t}Type{/t}: {t}Priority:{/t}
- + From cvs w lms.org.pl Fri Apr 9 19:01:32 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 9 Apr 2010 19:01:32 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20100409170132.44E5C3027B2D@hydra.altec.pl> Date: Friday, April 9, 2010 @ 19:01:32 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - Extended DNS records add/edit form Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.354&r2=1.355 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.354 lms/lib/locale/pl/strings.php:1.355 --- lms/lib/locale/pl/strings.php:1.354 Thu Apr 8 12:46:39 2010 +++ lms/lib/locale/pl/strings.php Fri Apr 9 19:01:32 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.354 2010/04/08 10:46:39 alec Exp $ + * $Id: strings.php,v 1.355 2010/04/09 17:01:32 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -2269,21 +2269,16 @@ $_LANG['Records number:'] = 'Liczba rekordów:'; $_LANG['Domain admin e-mail address.'] = 'Adres e-mail administratora domeny.'; $_LANG['Are you sure you want to delete this record?'] = 'Jesteś pewien, że chcesz usunąć ten rekord?'; -$_LANG['You can\'t add PTR record to this domain'] = 'Nie możesz dodać rekordu PTR do tej domeny'; -$_LANG['Enter content'] = 'Wprowadź dane'; +$_LANG['You can\'t add PTR record to this domain!'] = 'Nie możesz dodać rekordu PTR do tej domeny!'; $_LANG['Enter IP address of mailserver'] = 'Wprowadź adres IP serwera pocztowego'; $_LANG['Enter IP address of master NS'] = 'Wprowadź adres IP głównego serwera nazw'; $_LANG['Enter IP address of webserver'] = 'wprowadź adres IP serwera www'; -$_LANG['Enter record content'] = 'Wprowadź dane rekordu'; -$_LANG['Enter record name'] = 'Wprowadź nazwę rekordu'; $_LANG['Enter record TTL'] = 'Wprowadź TTL rekordu'; -$_LANG['Enter TTL'] = 'Wprowadź TTL'; $_LANG['IP address of mailserver'] = 'Adres IP serwera pocztowego'; $_LANG['IP address of master NS:'] = 'Adres IP głównego serwera nazw:'; $_LANG['IP address of webserver'] = 'Adres IP serwera www'; $_LANG['Wrong Content'] = 'Nieprawidłowa zawartość'; -$_LANG['Wrong record name'] = 'Nieprawidłowa nazwa rekordu'; -$_LANG['Wrong record type'] = 'Nieprawidłowa typ rekordu'; +$_LANG['Wrong record type!'] = 'Nieprawidłowy typ rekordu!'; $_LANG['Wrong TTL'] = 'Nieprawidłowy TTL'; $_LANG['SOA record already exists'] = 'Rekord SOA już istnieje'; $_LANG['Select record type'] = 'Wybierz typ rekordu'; @@ -2341,5 +2336,38 @@ $_LANG['The hostname is too long!'] = 'Nazwa hosta jest za długa!'; $_LANG['You are using an invalid top level domain!'] = 'Użycie błędnej domeny najwyższego poziomu!'; $_LANG['You have invalid characters in your hostname!'] = 'Nazwa hosta zawiera niedozwolone znaki!'; +$_LANG['Algorithm:'] = 'Algorytm:'; +$_LANG['Alias:'] = 'Alias:'; +$_LANG['CPU Type:'] = 'Typ CPU:'; +$_LANG['DNS Server:'] = 'Serwer DNS'; +$_LANG['E-mail address:'] = 'Adres e-mail:'; +$_LANG['Enter CPU type'] = 'Wprowadź typ CPU'; +$_LANG['Enter DNS server name'] = 'Wprowadź nazwę serwera DNS'; +$_LANG['Enter mail server name'] = 'Wprowadź nazwę serwera pocztowego'; +$_LANG['Enter default TTL value'] = 'Wprowadź domyślną wartość TTL'; +$_LANG['Enter operating system type'] = 'Wprowadź typ systemu operacyjnego'; +$_LANG['Enter port number'] = 'Wprowadź numer portu'; +$_LANG['Enter public key fingerprint'] = 'Wprowadź odcisk klucza publicznego'; +$_LANG['Enter record contents'] = 'Wprowadź dane rekordu'; +$_LANG['Enter record priority'] = 'Wprowadź priorytet rekordu'; +$_LANG['Enter record relative weight'] = 'Wprowadź względną ważność rekordu'; +$_LANG['Enter zone retry interval'] = 'Wprowadź czas odmowy (retry) strefy'; +$_LANG['Enter zone expiration time'] = 'Wprowadź czas wygasania (expiration) strefy'; +$_LANG['Enter zone refresh interval'] = 'Wprowadź czas odświeżania (refresh) strefy'; +$_LANG['Enter zone serial number'] = 'Wprowadź numer seryjny strefy'; +$_LANG['Expire time:'] = 'Czas wygasania'; +$_LANG['Field cannot be empty!'] = 'Pole nie może być puste!'; +$_LANG['Fingerprint:'] = 'Odcisk klucza:'; +$_LANG['Invalid format!'] = 'Błędny format!'; +$_LANG['Invalid IP address!'] = 'Błędny adres IP!'; +$_LANG['Mail Server:'] = 'Server pocztowy:'; +$_LANG['Default TTL:'] = 'Domyślny TTL:'; +$_LANG['Operating System Type:'] = 'Typ systemu:'; +$_LANG['Port:'] = 'Port:'; +$_LANG['Refresh interval:'] = 'Czas odświeżania:'; +$_LANG['Retry interval:'] = 'Czas odmowy:'; +$_LANG['Select algorithm used to generate the fingerprint'] = 'Wybierz algorytm użyty do wygenerowania odcisku klucza'; +$_LANG['Select algorithm of the public key'] = 'Wybierz algorytm klucza publicznego'; +$_LANG['Weight:'] = 'Ważność:'; ?> From cvs w lms.org.pl Fri Apr 9 19:01:32 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 9 Apr 2010 19:01:32 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (common.php, dns.php) Message-ID: <20100409170132.22B3B3027B2C@hydra.altec.pl> Date: Friday, April 9, 2010 @ 19:01:32 Author: alec Path: /cvsroot/lms/lib Modified: common.php dns.php - Extended DNS records add/edit form Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/common.php.diff?&r1=1.118&r2=1.119 http://cvs.lms.org.pl/viewvc/Development/lms/lib/dns.php.diff?&r1=1.1&r2=1.2 Index: lms/lib/common.php diff -u lms/lib/common.php:1.118 lms/lib/common.php:1.119 --- lms/lib/common.php:1.118 Thu Mar 11 14:07:34 2010 +++ lms/lib/common.php Fri Apr 9 19:01:31 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: common.php,v 1.118 2010/03/11 13:07:34 alec Exp $ + * $Id: common.php,v 1.119 2010/04/09 17:01:31 alec Exp $ */ // Common functions, that making it in class would be nonsense :) @@ -124,16 +124,36 @@ function check_ip($ip) { - $count = 0; - $x = explode('.', $ip); - $max = count($x); - for ($i = 0; $i < $max; $i++) - if ($x[$i] >= 0 && $x[$i] <= 255 && preg_match('/^\d{1,3}$/', $x[$i])) - $count++; - if ($count == 4 && $max == 4) - return true; - else - return false; + return (bool) preg_match('/^((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$/', $ip); +} + +function check_ipv6($ip) +{ + // fast exit for localhost + if (strlen($ip) < 3) + return $IP == '::'; + + // Check if part is in IPv4 format + if (strpos($ip, '.')) { + $lastcolon = strrpos($ip, ':'); + if (!($lastcolon && check_ip(substr($ip, $lastcolon + 1)))) + return false; + + // replace IPv4 part with dummy + $ip = substr($ip, 0, $lastcolon) . ':0:0'; + } + + // check uncompressed + if (strpos($ip, '::') === false) { + return preg_match('/^(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}$/i', $ip); + } + + // check colon-count for compressed format + if (substr_count($ip, ':') < 8) { + return preg_match('/^(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?$/i', $ip); + } + + return false; } function check_mask($mask) Index: lms/lib/dns.php diff -u lms/lib/dns.php:1.1 lms/lib/dns.php:1.2 --- lms/lib/dns.php:1.1 Thu Apr 8 12:46:39 2010 +++ lms/lib/dns.php Fri Apr 9 19:01:31 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: dns.php,v 1.1 2010/04/08 10:46:39 alec Exp $ + * $Id: dns.php,v 1.2 2010/04/09 17:01:31 alec Exp $ */ $valid_tlds = array( @@ -54,8 +54,8 @@ function check_hostname_fqdn($hostname, $wildcard=false, $dns_strict_tld_check=false) { - global $valid_tlds; - $hostname = preg_replace('/\\.$/', '', $hostname); + global $valid_tlds; + $hostname = trim($hostname, '.'); if (strlen($hostname) > 255) { return trans('The hostname is too long!'); @@ -75,19 +75,18 @@ return trans('You have invalid characters in your hostname!'); } } - if (substr($hostname_label, 0, 1) == '-') { - return trans('A hostname can not start or end with a dash!'); - } - if (substr($hostname_label, -1, 1) == '-') { + if ($hostname_label[0] == '-' || substr($hostname_label, -1, 1) == '-') { return trans('A hostname can not start or end with a dash!'); } if (strlen($hostname_label) < 1 || strlen($hostname_label) > 63) { return trans('Given hostname or one of the labels is too short or too long!'); } } - +/* +tego fragmentu nie rozumiem, slashe w nazwie??? if ($hostname_labels[$label_count-1] == 'arpa' - && (substr_count($hostname_labels[0], '/') == 1 XOR substr_count($hostname_labels[1], '/') == 1)) { + && (substr_count($hostname_labels[0], '/') == 1 XOR substr_count($hostname_labels[1], '/') == 1) + ) { if (substr_count($hostname_labels[0], '/') == 1) { $array = explode ('/', $hostname_labels[0]); } else { @@ -107,7 +106,7 @@ return trans('Given hostname has too many slashes!'); } } - +*/ if ($dns_strict_tld_check && !in_array($hostname_labels[$label_count-1], $valid_tlds)) { return trans('You are using an invalid top level domain!'); } @@ -124,7 +123,6 @@ $soa = explode(' ', $record['content']); - if ($soa[2] == '0') { return true; } elseif ($soa[2] == date('Ymd') . '99') { @@ -151,15 +149,232 @@ // Change serial in SOA array. $soa[2] = $serial; - // Build new SOA record content and update the database. - $content = ''; - for ($i = 0; $i < count($soa); $i++) { - $content .= $soa[$i] . ' '; - } + // Build new SOA record content and update the database + $DB->Execute('UPDATE records SET content = ? WHERE id = ?', + array(implode(' ', $soa), $record['id'])); } +} + +/* + * Parses record content (from DB) into separate form fields + */ +function parse_dns_record(&$record) +{ + $record['name'] = substr($record['name'], 0, -(strlen($record['domainname']) + 1)); + + switch ($record['type']) + { + case 'A': + case 'AAAA': + $record['ipdst'] = $record['content']; + break; + case 'NS': + $record['ns'] = $record['content']; + break; + case 'MX': + $record['mailserver'] = $record['content']; + break; + case 'CNAME': + $record['alias'] = $record['name']; + $record['domain'] = $record['content']; + break; + case 'TXT': + case 'SPF': + $record['desc'] = $record['content']; + break; + case 'PTR': + $record['domain'] = $record['content']; + break; + case 'SOA': + $cnt = preg_split('/[\s\t]+/', $record['content']); + $record['ns'] = $cnt[0]; + $record['email'] = $cnt[1]; + $record['serial'] = $cnt[2]; + $record['refresh'] = $cnt[3]; + $record['retry'] = $cnt[4]; + $record['expire'] = $cnt[5]; + $record['minttl'] = $cnt[6]; + break; + case 'SSHFP': + $cnt = preg_split('/[\s\t]+/', $record['content']); + $record['algo'] = $cnt[0]; + $record['ftype'] = $cnt[1]; + $record['fingerprint'] = $cnt[2]; + break; + case 'SRV': + $cnt = preg_split('/[\s\t]+/', $record['content']); + $record['weight'] = $cnt[0]; + $record['port'] = $cnt[1]; + $record['domain'] = $cnt[2]; + break; + case 'HINFO': + $cnt = preg_split('/[\s\t]+/', $record['content']); + $record['cpu'] = $cnt[0]; + $record['os'] = $cnt[1]; + break; + } +} + +/* + * Validates record data (from html form) + * Errors are returned by reference in 4th argument + */ +function validate_dns_record(&$record, &$error) +{ + $arpa_records = array('PTR','SOA','NS','TXT','CNAME','MX','SPF','NAPTR','URL','MBOXFW','CURL','SSHFP'); + + // domena in-addr.arpa + if (preg_match('/in-addr\.arpa$/', $record['domainname'])) + { + if (!in_array($record['type'], $arpa_records)) + $error['type'] = trans('Wrong record type!'); + } + else if ($record['type'] == 'PTR') + $error['type'] = trans('You can\'t add PTR record to this domain!'); + + if ($error) + return; + + if (!in_array($record['type'], array('SOA', 'CNAME')) && !empty($record['name'])) + if ($errorname = check_hostname_fqdn($record['name'], true, false)) + $error['name'] = $errorname; + + switch ($record['type']) + { + case 'A': + if (empty($record['ipdst'])) + $error['ipdst'] = trans('Field cannot be empty!'); + else if (!check_ip($record['ipdst'])) + $error['ipdst'] = trans('Invalid IP address!'); + break; + case 'AAAA': + if (empty($record['ipdst'])) + $error['ipdst'] = trans('Field cannot be empty!'); + else if (!check_ipv6($record['ipdst'])) + $error['ipdst'] = trans('Invalid IP address!'); + break; + case 'NS': + if ($errorcontent = check_hostname_fqdn($record['ns'], false, true)) + $error['ns'] = $errorcontent; + if (preg_match('/in-addr\.arpa$/', $record['domainname'])) + { + if ($errorcontent = check_hostname_fqdn($record['ns'], false, true)) + $error['ns'] = $errorcontent; + } + break; + case 'MX': + if (empty($record['mailserver'])) + $error['mailserver'] = trans('Field cannot be empty!'); + else if ($errorcontent = check_hostname_fqdn($record['mailserver'], false, true)) + $error['mailserver'] = $errorcontent; + + if (empty($record['prio'])) + $error['prio'] = trans('Field cannot be empty!'); + else if (!preg_match('/^[0-9]+$/', $record['prio'])) + $error['prio'] = trans('Invalid format!'); + break; + case 'CNAME': + if ($errorname = check_hostname_fqdn($record['alias'], true, false)) + $error['alias'] = $errorname; + break; + case 'TXT': + case 'SPF': + if (empty($record['desc'])) + $error['desc'] = trans('Field cannot be empty!'); + break; + case 'PTR': + if (preg_match('/in-addr\.arpa$/', $record['domainname'])) + { + if ($errorcontent = check_hostname_fqdn($record['domain'], false, true)) + $error['domain'] = $errorcontent; + } + break; + case 'SOA': + foreach (array('serial', 'refresh', 'retry', 'expire', 'minttl') as $idx) + { + if (empty($record[$idx])) + $error[$idx] = trans('Field cannot be empty!'); + else if (!preg_match('/^[0-9]+$/', $record[$idx])) + $error[$idx] = trans('Invalid format!'); + } + break; + case 'SSHFP': + foreach (array('algo', 'ftype', 'fingerprint') as $idx) + { + if (empty($record[$idx])) + $error[$idx] = trans('Field cannot be empty!'); + else if ($idx != 'fingerprint' && !preg_match('/^[0-9]+$/', $record[$idx])) + $error[$idx] = trans('Invalid format!'); + } + break; + case 'HINFO': + foreach (array('cpu', 'os') as $idx) + { + if (empty($record[$idx])) + $error[$idx] = trans('Field cannot be empty!'); + // @TODO: RFC1010 data format checking + } + break; + case 'SRV': + foreach (array('port', 'weight') as $idx) + { + if (empty($record[$idx])) + $error[$idx] = trans('Field cannot be empty!'); + else if (!preg_match('/^[0-9]+$/', $record[$idx])) + $error[$idx] = trans('Invalid format!'); + } + break; + default: // NAPTR + if (empty($record['content'])) + $error['content'] = trans('Field cannot be empty!'); + } + + if ($error) + return; + + // set 'name' and 'content', 'prio' fields to write into DB + switch ($record['type']) + { + case 'A': + case 'AAAA': + $record['content'] = $record['ipdst']; + break; + case 'NS': + $record['content'] = $record['ns']; + break; + case 'MX': + $record['content'] = $record['mailserver']; + break; + case 'CNAME': + $record['name'] = $record['alias']; + $record['content'] = $record['domain']; + break; + case 'TXT': + case 'SPF': + $record['content'] = $record['desc']; + break; + case 'PTR': + $record['content'] = $record['domain']; + break; + case 'SOA': + $record['name'] = ''; + $record['content'] = $record['ns'].' '.str_replace('@', '.', $record['email']) + .' '.$record['serial'].' '.$record['refresh'].' '.$record['retry'] + .' '.$record['expire'].' '.$record['minttl']; + break; + case 'SSHFP': + $record['content'] = $record['algo'].' '.$record['ftype'].' '.$record['fingerprint']; + break; + case 'HINFO': + $record['content'] = $record['cpu'].' '.$record['os']; + break; + case 'SRV': + $record['content'] = $record['weight'].' '.$record['port'].' '.$record['domain']; + break; + } - $DB->Execute('UPDATE records SET content = ? WHERE id = ?', - array(trim($content), $record['id'])); + if ($record['type'] != 'MX') + $record['prio'] = 0; } ?> From cvs w lms.org.pl Fri Apr 9 19:01:31 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 9 Apr 2010 19:01:31 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20100409170132.0085C3027B29@hydra.altec.pl> Date: Friday, April 9, 2010 @ 19:01:31 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Extended DNS records add/edit form Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1488&r2=1.1489 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1488 lms/doc/ChangeLog:1.1489 --- lms/doc/ChangeLog:1.1488 Fri Apr 2 17:26:09 2010 +++ lms/doc/ChangeLog Fri Apr 9 19:01:31 2010 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1488 2010/04/02 15:26:09 alec Exp $ +$Id: ChangeLog,v 1.1489 2010/04/09 17:01:31 alec Exp $ version ? (????-??-??) @@ -56,6 +56,7 @@ - fixed encoding of mail messages sent by perl scripts (alec) - BTS#0000825: fixed tariff limits checking in domain edition (alec) - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support (alec) + - Extended DNS records add/edit form (alec) version 1.11.9 Moloc (2009-10-28): From cvs w lms.org.pl Fri Apr 9 19:01:32 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 9 Apr 2010 19:01:32 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (3 files) Message-ID: <20100409170132.803083027B2F@hydra.altec.pl> Date: Friday, April 9, 2010 @ 19:01:32 Author: alec Path: /cvsroot/lms/templates Modified: recordedit.html recordlist.html Removed: recordadd.html - Extended DNS records add/edit form Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/recordadd.html?rev=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/templates/recordedit.html.diff?&r1=1.6&r2=1.7 http://cvs.lms.org.pl/viewvc/Development/lms/templates/recordlist.html.diff?&r1=1.2&r2=1.3 Index: lms/templates/recordadd.html diff -u lms/templates/recordadd.html:1.6 lms/templates/recordadd.html:removed --- lms/templates/recordadd.html:1.6 Thu Apr 8 12:46:39 2010 +++ lms/templates/recordadd.html Fri Apr 9 19:01:32 2010 @@ -1,60 +0,0 @@ -{include file="header.html"} -

{$layout.pagetitle}

- - -
{t}Name:{/t}{t}Host:{/t} {t}TTL{/t}: {t}Type{/t}: {t}Priority:{/t}
- - - - - - - - - - - - - - - - - -
{t}Host:{/t}{t}TTL{/t}:{t}Type{/t}:{t}Priority:{/t}{t}Content{/t}:
- - - .{$domain.name} - - - - - - - - - -
- {t}Submit{/t} - {t}Cancel{/t} -
- - -{include file="footer.html"} Index: lms/templates/recordedit.html diff -u lms/templates/recordedit.html:1.6 lms/templates/recordedit.html:1.7 --- lms/templates/recordedit.html:1.6 Thu Apr 8 12:46:39 2010 +++ lms/templates/recordedit.html Fri Apr 9 19:01:32 2010 @@ -1,57 +1,223 @@ {include file="header.html"}

{$layout.pagetitle}

-
+ - - - - - - - - - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{t}Host:{/t}{t}TTL{/t}:{t}Type{/t}:{t}Priority:{/t}{t}Content{/t}:
- .{$domain.name} - - - -
+ + + {t}Type{/t}: + + - - - -
- {t}Submit{/t} +
+ + + {t}TTL{/t}: + + +
+ {t}Submit{/t} {t}Cancel{/t}
+{literal} +{/literal} {include file="footer.html"} Index: lms/templates/recordlist.html diff -u lms/templates/recordlist.html:1.2 lms/templates/recordlist.html:1.3 --- lms/templates/recordlist.html:1.2 Thu Apr 8 12:46:39 2010 +++ lms/templates/recordlist.html Fri Apr 9 19:01:32 2010 @@ -41,11 +41,11 @@ {cycle values="light,lucid" print=false} {section name=recordslist loop=$recordslist start=$start max=$pagelimit} - {$recordslist[recordslist].name} + {$recordslist[recordslist].name} {$recordslist[recordslist].ttl} {$recordslist[recordslist].type} {$recordslist[recordslist].prio} - {$recordslist[recordslist].content} + {$recordslist[recordslist].content} {if $showaddedit} From cvs w lms.org.pl Fri Apr 9 19:01:32 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 9 Apr 2010 19:01:32 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (3 files) Message-ID: <20100409170132.639E63027B2E@hydra.altec.pl> Date: Friday, April 9, 2010 @ 19:01:32 Author: alec Path: /cvsroot/lms/modules Modified: recordadd.php recordedit.php recordlist.php - Extended DNS records add/edit form Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/recordadd.php.diff?&r1=1.13&r2=1.14 http://cvs.lms.org.pl/viewvc/Development/lms/modules/recordedit.php.diff?&r1=1.10&r2=1.11 http://cvs.lms.org.pl/viewvc/Development/lms/modules/recordlist.php.diff?&r1=1.1&r2=1.2 Index: lms/modules/recordadd.php diff -u lms/modules/recordadd.php:1.13 lms/modules/recordadd.php:1.14 --- lms/modules/recordadd.php:1.13 Thu Apr 8 12:46:39 2010 +++ lms/modules/recordadd.php Fri Apr 9 19:01:32 2010 @@ -24,55 +24,37 @@ include(LIB_DIR.'/dns.php'); -if (isset($_POST['record'])) -{ - $record = $_POST['record']; - $arpa_record_type_allowed = array('PTR','SOA','NS','TXT','CNAME','MX','SPF','NAPTR','URL','MBOXFW','CURL','SSHFP'); - - $domain = $DB->GetRow('SELECT name FROM domains WHERE id = ?', array($record['domain_id'])); - - $tlds = explode(".", $domain['name']); - - //domena in-add.arpa - if ($tlds[count($tlds)-2].$tlds[count($tlds)-1] == 'in-addrarpa') - { - if (!is_numeric($record['name']) && $record['name'] != '') - $error['name'] = trans('Wrong record name'); - - if (!in_array($record['type'], $arpa_record_type_allowed)) - $error['type'] = trans('Wrong record type'); - - if (in_array($record['type'],array('PTR','NS'))) - { - if ($errorcontent = check_hostname_fqdn($record['content'], false, true)) - $error['content'] = $errorcontent; - } - - } - else if ($record['type'] == 'PTR') - $error['type'] = trans('You can\'t add PTR record to this domain'); +$d = $_GET['d']*1; - if ($record['ttl']*1 <= 0 || !is_numeric($record['ttl'])) - $error['ttl'] = trans('Wrong TTL'); +$record = $DB->GetRow('SELECT name AS domainname, id AS domain_id FROM domains WHERE id = ?', array($d)); - if (empty($record['content'])) - $error['content'] = trans('Wrong Content'); +if (isset($_POST['record'])) +{ + $rec = $_POST['record']; - if (!empty($record['name'])) - if ($errorname = check_hostname_fqdn($record['name'], true, false)) - $error['name'] = $errorname; + foreach ($rec as $idx => $val) + $rec[$idx] = trim(strip_tags($val)); + + $record = array_merge($record, $rec); if ($record['type'] == 'SOA') { if ($DB->GetOne('SELECT 1 FROM records WHERE type=\'SOA\' AND domain_id=?', array($record['domain_id']))) $error['type'] = trans('SOA record already exists'); } + + if ($record['ttl']*1 <= 0 || !is_numeric($record['ttl'])) + $error['ttl'] = trans('Wrong TTL'); + + // call validate... after all checks + if (!$error) + validate_dns_record($record, $error); if (!$error) { - if (trim($record['name']) != '') - $record['name'] = trim($record['name'],'.').'.'; - $record['name'] .= $domain['name']; + if (!empty($record['name'])) + $record['name'] = trim($record['name'], '.').'.'; + $record['name'] .= $record['domainname']; $DB->Execute('INSERT INTO records (name, type, content, ttl, prio, domain_id) VALUES (?, ?, ?, ?, ?, ?)', @@ -87,13 +69,13 @@ update_soa_serial($record['domain_id']); - $SESSION->redirect('?m=recordlist'); + $SESSION->redirect('?m=recordlist&d='.$record['domain_id']); } } else +{ $record['prio'] = 0; - -$d = $_GET['d']*1; +} $layout['pagetitle'] = trans('New DNS Record'); @@ -105,10 +87,8 @@ $SESSION->save('backto', $_SERVER['QUERY_STRING']); -$SMARTY->assign('domain_id', $d); $SMARTY->assign('record', $record); $SMARTY->assign('error', $error); -$SMARTY->assign('domain', $domain ? $domain : $DB->GetRow('SELECT name FROM domains WHERE id = ?', array($d))); -$SMARTY->display('recordadd.html'); +$SMARTY->display('recordedit.html'); ?> Index: lms/modules/recordedit.php diff -u lms/modules/recordedit.php:1.10 lms/modules/recordedit.php:1.11 --- lms/modules/recordedit.php:1.10 Thu Apr 8 12:46:39 2010 +++ lms/modules/recordedit.php Fri Apr 9 19:01:32 2010 @@ -26,51 +26,31 @@ $id = $_GET['id']*1; -$domain = $DB->GetRow('SELECT domains.name, domains.id - FROM domains, records - WHERE records.domain_id = domains.id and records.id = ?', array($id)); +$record = $DB->GetRow('SELECT d.name AS domainname, r.* + FROM domains d, records r + WHERE r.domain_id = d.id AND r.id = ?', array($id)); if (isset($_POST['record'])) { - $record = $_POST['record']; - $record['id'] = $id; - $arpa_record_type_allowed = array('PTR','SOA','NS','TXT','CNAME','MX','SPF','NAPTR','URL','MBOXFW','CURL','SSHFP'); - - $tlds = explode(".",$domain['name']); - - //domena in-add.arpa - if ($tlds[count($tlds)-2].$tlds[count($tlds)-1] == 'in-addrarpa') - { - if (!is_numeric($record['name']) && $record['name'] != '') - $error['name'] = trans('Wrong record name'); - - if (!in_array($record['type'], $arpa_record_type_allowed)) - $error['type'] = trans('Wrong record type'); - - if (in_array($record['type'], array('PTR','NS'))) - { - if ($errorcontent = check_hostname_fqdn($record['content'], false, true)) - $error['content'] = $errorcontent; - } - } - else if ($record['type'] == 'PTR') - $error['type'] = trans('You can\'t add PTR record to this domain'); + $rec = $_POST['record']; + + foreach ($rec as $idx => $val) + $rec[$idx] = trim(strip_tags($val)); + + $record = array_merge($record, $rec); if ($record['ttl']*1 <= 0 || !is_numeric($record['ttl'])) $error['ttl'] = trans('Wrong TTL'); - if (empty($record['content'])) - $error['content'] = trans('Wrong Content'); - - if (!empty($record['name'])) - if ($errorname = check_hostname_fqdn($record['name'], true, false)) - $error['name'] = $errorname; + // call validate... after all checks + if (!$error) + validate_dns_record($record, $error); if (!$error) { - if (trim($record['name']) !='') + if (!empty($record['name'])) $record['name'] = trim($record['name'],'.').'.'; - $record['name'] .= $domain['name']; + $record['name'] .= $record['domainname']; $DB->Execute('UPDATE records SET name = ?, type = ?, content = ?, ttl = ?, prio = ? WHERE id = ?', @@ -84,13 +64,14 @@ update_soa_serial($domain['id']); - $SESSION->redirect('?m=recordlist'); + $SESSION->redirect('?m=recordlist&d='.$record['domain_id']); } + + $SMARTY->assign('error', $error); } else { - $record = $DB->GetRow('SELECT * FROM records WHERE id = ?', array($id)); - $record['name'] = substr($record['name'],0,-(strlen($domain['name']) + 1)); + parse_dns_record($record); } $layout['pagetitle'] = trans('DNS Record Edit'); @@ -99,10 +80,7 @@ $record['content'] = htmlentities($record['content']); -$SMARTY->assign('error', $error); $SMARTY->assign('record', $record); -$SMARTY->assign('domain', $domain); - $SMARTY->display('recordedit.html'); ?> Index: lms/modules/recordlist.php diff -u lms/modules/recordlist.php:1.1 lms/modules/recordlist.php:1.2 --- lms/modules/recordlist.php:1.1 Wed Mar 10 14:08:32 2010 +++ lms/modules/recordlist.php Fri Apr 9 19:01:32 2010 @@ -29,14 +29,18 @@ $d = $_GET['d']; $SESSION->save('ald', $d); +// this may happen after logout +if (!$d) + $d = $DB->GetOne('SELECT id FROM domains ORDER BY name LIMIT 1'); + $recordslist = $DB->GetAll('SELECT *, (CASE WHEN type=\'TXT\' THEN 1 WHEN type=\'MX\' THEN 2 WHEN type=\'NS\' THEN 3 WHEN type=\'SOA\' THEN 4 ELSE 0 END) AS ord - FROM records WHERE domain_id = ? ORDER BY ord desc', - array($d)); + FROM records WHERE domain_id = ? ORDER BY ord desc, prio, name', + array($d)); $listdata['total'] = count($recordslist); $listdata['domain'] = $d; From cvs w lms.org.pl Mon Apr 12 09:13:23 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 12 Apr 2010 09:13:23 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (recordedit.html) Message-ID: <20100412071323.A57903027B2C@hydra.altec.pl> Date: Monday, April 12, 2010 @ 09:13:23 Author: alec Path: /cvsroot/lms/templates Modified: recordedit.html - BTS#826: Fixed DNS data escaping Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/recordedit.html.diff?&r1=1.7&r2=1.8 Index: lms/templates/recordedit.html diff -u lms/templates/recordedit.html:1.7 lms/templates/recordedit.html:1.8 --- lms/templates/recordedit.html:1.7 Fri Apr 9 19:01:32 2010 +++ lms/templates/recordedit.html Mon Apr 12 09:13:23 2010 @@ -42,87 +42,87 @@ {t}Domain:{/t} - .{$record.domainname}. + .{$record.domainname}. {t}Alias:{/t} - .{$record.domainname}. + .{$record.domainname}. {t}IP Address:{/t} - + {t}DNS Server:{/t} - . + . {t}Mail Server:{/t} - . + . {t}Weight:{/t} - + {t}Port:{/t} - + {t}Domain:{/t} - . + . {t}Domain:{/t} - .{$record.domainname}. + .{$record.domainname}. {t}Description:{/t} - + {t}Priority:{/t} - + {t}E-mail address:{/t} - + {t}Serial number:{/t} - + {t}Refresh interval:{/t} - + {t}Retry interval:{/t} - + {t}Expire time:{/t} - + {t}Default TTL:{/t} - + @@ -146,22 +146,22 @@ {t}Fingerprint:{/t} - + {t}Content:{/t} - + {t}CPU Type:{/t} - + {t}Operating System Type:{/t} - + From cvs w lms.org.pl Mon Apr 12 09:13:23 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 12 Apr 2010 09:13:23 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (recordedit.php) Message-ID: <20100412071323.8AE2E3027B29@hydra.altec.pl> Date: Monday, April 12, 2010 @ 09:13:23 Author: alec Path: /cvsroot/lms/modules Modified: recordedit.php - BTS#826: Fixed DNS data escaping Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/recordedit.php.diff?&r1=1.11&r2=1.12 Index: lms/modules/recordedit.php diff -u lms/modules/recordedit.php:1.11 lms/modules/recordedit.php:1.12 --- lms/modules/recordedit.php:1.11 Fri Apr 9 19:01:32 2010 +++ lms/modules/recordedit.php Mon Apr 12 09:13:23 2010 @@ -78,8 +78,6 @@ $SESSION->save('backto', $_SERVER['QUERY_STRING']); -$record['content'] = htmlentities($record['content']); - $SMARTY->assign('record', $record); $SMARTY->display('recordedit.html'); From cvs w lms.org.pl Mon Apr 12 09:17:01 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 12 Apr 2010 09:17:01 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (recordedit.html) Message-ID: <20100412071701.8B0A83027B29@hydra.altec.pl> Date: Monday, April 12, 2010 @ 09:17:01 Author: alec Path: /cvsroot/lms/templates Modified: recordedit.html - BTS#827: Set PTR as default type of record in in-addr.arpa zones Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/recordedit.html.diff?&r1=1.8&r2=1.9 Index: lms/templates/recordedit.html diff -u lms/templates/recordedit.html:1.8 lms/templates/recordedit.html:1.9 --- lms/templates/recordedit.html:1.8 Mon Apr 12 09:13:23 2010 +++ lms/templates/recordedit.html Mon Apr 12 09:17:01 2010 @@ -19,7 +19,7 @@ - + From cvs w lms.org.pl Mon Apr 12 09:18:37 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 12 Apr 2010 09:18:37 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (dns.php) Message-ID: <20100412071837.948FA3027B29@hydra.altec.pl> Date: Monday, April 12, 2010 @ 09:18:37 Author: alec Path: /cvsroot/lms/lib Modified: dns.php - Uncomment code for arpa records checking Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/dns.php.diff?&r1=1.2&r2=1.3 Index: lms/lib/dns.php diff -u lms/lib/dns.php:1.2 lms/lib/dns.php:1.3 --- lms/lib/dns.php:1.2 Fri Apr 9 19:01:31 2010 +++ lms/lib/dns.php Mon Apr 12 09:18:37 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: dns.php,v 1.2 2010/04/09 17:01:31 alec Exp $ + * $Id: dns.php,v 1.3 2010/04/12 07:18:37 alec Exp $ */ $valid_tlds = array( @@ -82,8 +82,7 @@ return trans('Given hostname or one of the labels is too short or too long!'); } } -/* -tego fragmentu nie rozumiem, slashe w nazwie??? + if ($hostname_labels[$label_count-1] == 'arpa' && (substr_count($hostname_labels[0], '/') == 1 XOR substr_count($hostname_labels[1], '/') == 1) ) { @@ -106,7 +105,7 @@ return trans('Given hostname has too many slashes!'); } } -*/ + if ($dns_strict_tld_check && !in_array($hostname_labels[$label_count-1], $valid_tlds)) { return trans('You are using an invalid top level domain!'); } From cvs w lms.org.pl Tue Apr 13 14:40:11 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 14:40:11 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (recordedit.php) Message-ID: <20100413124011.60C733027B29@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 14:40:11 Author: alec Path: /cvsroot/lms/modules Modified: recordedit.php - fix SOA serial update after record update Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/recordedit.php.diff?&r1=1.12&r2=1.13 Index: lms/modules/recordedit.php diff -u lms/modules/recordedit.php:1.12 lms/modules/recordedit.php:1.13 --- lms/modules/recordedit.php:1.12 Mon Apr 12 09:13:23 2010 +++ lms/modules/recordedit.php Tue Apr 13 14:40:10 2010 @@ -62,7 +62,7 @@ $record['id'] )); - update_soa_serial($domain['id']); + update_soa_serial($record['domain_id']); $SESSION->redirect('?m=recordlist&d='.$record['domain_id']); } From cvs w lms.org.pl Tue Apr 13 15:01:47 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 15:01:47 +0200 (CEST) Subject: [lms-commits] CVS update of lms (index.php) Message-ID: <20100413130147.4EACD3027B29@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 15:01:47 Author: alec Path: /cvsroot/lms Modified: index.php - views.php functionality moved to LMS class Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/index.php.diff?&r1=1.214&r2=1.215 Index: lms/index.php diff -u lms/index.php:1.214 lms/index.php:1.215 --- lms/index.php:1.214 Thu Mar 11 14:07:27 2010 +++ lms/index.php Tue Apr 13 15:01:47 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: index.php,v 1.214 2010/03/11 13:07:27 alec Exp $ + * $Id: index.php,v 1.215 2010/04/13 13:01:47 alec Exp $ */ // REPLACE THIS WITH PATH TO YOUR CONFIG FILE @@ -208,7 +208,7 @@ if($allow && ! $deny) { $layout['module'] = $module; - include(LIB_DIR.'/views.php'); + $LMS->InitUI(); include(MODULES_DIR.'/'.$module.'.php'); } else From cvs w lms.org.pl Tue Apr 13 15:01:47 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 15:01:47 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (LMS.class.php, views.php) Message-ID: <20100413130147.7AAB53027B2B@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 15:01:47 Author: alec Path: /cvsroot/lms/lib Modified: LMS.class.php Removed: views.php - views.php functionality moved to LMS class Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1025&r2=1.1026 http://cvs.lms.org.pl/viewvc/Development/lms/lib/views.php?rev=1.6 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1025 lms/lib/LMS.class.php:1.1026 --- lms/lib/LMS.class.php:1.1025 Wed Mar 31 15:01:47 2010 +++ lms/lib/LMS.class.php Tue Apr 13 15:01:47 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1025 2010/03/31 13:01:47 alec Exp $ + * $Id: LMS.class.php,v 1.1026 2010/04/13 13:01:47 alec Exp $ */ // LMS Class - contains internal LMS database functions used @@ -34,7 +34,7 @@ var $CONFIG; // table including lms.ini options var $cache = array(); // internal cache var $_version = '1.11-cvs'; // class version - var $_revision = '$Revision: 1.1025 $'; + var $_revision = '$Revision: 1.1026 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -51,6 +51,22 @@ return TRUE; } + function InitUI() + { + // set current user + switch ($this->CONFIG['database']['type']) + { + case 'postgres': + $this->DB->Execute('SELECT set_config(\'lms.current_user\', ?, false)', + array($this->AUTH->id)); + break; + case 'mysql': + case 'mysqli': + $this->DB->Execute('SET @lms_current_user=?', array($this->AUTH->id)); + break; + } + } + /* * Logging * 0 - disabled Index: lms/lib/views.php diff -u lms/lib/views.php:1.6 lms/lib/views.php:removed --- lms/lib/views.php:1.6 Thu Mar 11 14:07:34 2010 +++ lms/lib/views.php Tue Apr 13 15:01:47 2010 @@ -1,39 +0,0 @@ -Execute('SELECT set_config(\'lms.current_user\', ?, false)', array($AUTH->id)); - break; - - case 'mysql': - case 'mysqli': - $DB->Execute('SET @lms_current_user=?', array($AUTH->id)); - break; -} - -?> From cvs w lms.org.pl Tue Apr 13 19:01:44 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:44 +0200 (CEST) Subject: [lms-commits] CVS update of lms/contrib (initLMS.php) Message-ID: <20100413170144.1FF533027B2B@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:44 Author: alec Path: /cvsroot/lms/contrib Modified: initLMS.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/contrib/initLMS.php.diff?&r1=1.23&r2=1.24 Index: lms/contrib/initLMS.php diff -u lms/contrib/initLMS.php:1.23 lms/contrib/initLMS.php:1.24 --- lms/contrib/initLMS.php:1.23 Thu Mar 11 14:07:28 2010 +++ lms/contrib/initLMS.php Tue Apr 13 19:01:44 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: initLMS.php,v 1.23 2010/03/11 13:07:28 alec Exp $ + * $Id: initLMS.php,v 1.24 2010/04/13 17:01:44 alec Exp $ */ // REPLACE THIS WITH PATH TO YOU CONFIG FILE @@ -49,10 +49,6 @@ if (!$DB) die; -// Enable data encoding conversion if needed - -require_once($CONFIG['directories']['lib_dir'].'/dbencoding.php'); - // Read configuration of LMS-UI from database if($cfg = $DB->GetAll('SELECT section, var, value FROM uiconfig WHERE disabled=0')) From cvs w lms.org.pl Tue Apr 13 19:01:43 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:43 +0200 (CEST) Subject: [lms-commits] CVS update of lms (index.php) Message-ID: <20100413170144.023103027B29@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:43 Author: alec Path: /cvsroot/lms Modified: index.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/index.php.diff?&r1=1.215&r2=1.216 Index: lms/index.php diff -u lms/index.php:1.215 lms/index.php:1.216 --- lms/index.php:1.215 Tue Apr 13 15:01:47 2010 +++ lms/index.php Tue Apr 13 19:01:43 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: index.php,v 1.215 2010/04/13 13:01:47 alec Exp $ + * $Id: index.php,v 1.216 2010/04/13 17:01:43 alec Exp $ */ // REPLACE THIS WITH PATH TO YOUR CONFIG FILE @@ -87,10 +87,8 @@ die(); } -// Enable/disable data encoding conversion // Call any of upgrade process before anything else -require_once(LIB_DIR.'/dbencoding.php'); require_once(LIB_DIR.'/upgradedb.php'); // Initialize templates engine (must be before locale settings) From cvs w lms.org.pl Tue Apr 13 19:01:44 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:44 +0200 (CEST) Subject: [lms-commits] CVS update of lms/contrib/customer (index.php) Message-ID: <20100413170144.3AA233027B2C@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:44 Author: alec Path: /cvsroot/lms/contrib/customer Modified: index.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/contrib/customer/index.php.diff?&r1=1.38&r2=1.39 Index: lms/contrib/customer/index.php diff -u lms/contrib/customer/index.php:1.38 lms/contrib/customer/index.php:1.39 --- lms/contrib/customer/index.php:1.38 Thu Mar 11 14:07:29 2010 +++ lms/contrib/customer/index.php Tue Apr 13 19:01:44 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: index.php,v 1.38 2010/03/11 13:07:29 alec Exp $ + * $Id: index.php,v 1.39 2010/04/13 17:01:44 alec Exp $ */ // REPLACE THIS WITH PATH TO YOU CONFIG FILE @@ -66,10 +66,6 @@ $DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME); -// Enable data encoding conversion if needed - -require_once(LIB_DIR.'/dbencoding.php'); - // Read configuration of LMS-UI from database if($cfg = $DB->GetAll('SELECT section, var, value FROM uiconfig WHERE disabled=0')) From cvs w lms.org.pl Tue Apr 13 19:01:44 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:44 +0200 (CEST) Subject: [lms-commits] CVS update of lms/contrib/customer_otherip (class.php) Message-ID: <20100413170144.53AC53027B2D@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:44 Author: alec Path: /cvsroot/lms/contrib/customer_otherip Modified: class.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/contrib/customer_otherip/class.php.diff?&r1=1.31&r2=1.32 Index: lms/contrib/customer_otherip/class.php diff -u lms/contrib/customer_otherip/class.php:1.31 lms/contrib/customer_otherip/class.php:1.32 --- lms/contrib/customer_otherip/class.php:1.31 Thu Mar 11 14:07:29 2010 +++ lms/contrib/customer_otherip/class.php Tue Apr 13 19:01:44 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: class.php,v 1.31 2010/03/11 13:07:29 alec Exp $ + * $Id: class.php,v 1.32 2010/04/13 17:01:44 alec Exp $ */ // REPLACE THIS WITH PATH TO YOU CONFIG FILE @@ -68,10 +68,6 @@ $DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME); -// Enable data encoding conversion if needed - -require_once(LIB_DIR.'/dbencoding.php'); - // Read configuration of LMS-UI from database if($cfg = $DB->GetAll('SELECT section, var, value FROM uiconfig WHERE disabled=0')) From cvs w lms.org.pl Tue Apr 13 19:01:44 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:44 +0200 (CEST) Subject: [lms-commits] CVS update of lms/contrib/formularz_przelewu_wplaty (druk.php) Message-ID: <20100413170144.6E2C13027B2E@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:44 Author: alec Path: /cvsroot/lms/contrib/formularz_przelewu_wplaty Modified: druk.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/contrib/formularz_przelewu_wplaty/druk.php.diff?&r1=1.29&r2=1.30 Index: lms/contrib/formularz_przelewu_wplaty/druk.php diff -u lms/contrib/formularz_przelewu_wplaty/druk.php:1.29 lms/contrib/formularz_przelewu_wplaty/druk.php:1.30 --- lms/contrib/formularz_przelewu_wplaty/druk.php:1.29 Thu Mar 11 14:07:30 2010 +++ lms/contrib/formularz_przelewu_wplaty/druk.php Tue Apr 13 19:01:44 2010 @@ -7,7 +7,7 @@ * * Please, see the doc/AUTHORS for more information about authors! * - * $Id: druk.php,v 1.29 2010/03/11 13:07:30 alec Exp $ + * $Id: druk.php,v 1.30 2010/04/13 17:01:44 alec Exp $ */ // REPLACE THIS WITH PATH TO YOU CONFIG FILE @@ -44,10 +44,6 @@ $DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME); -// Enable data encoding conversion if needed - -require_once(LIB_DIR.'/dbencoding.php'); - // Read configuration of LMS-UI from database if($cfg = $DB->GetAll('SELECT section, var, value FROM uiconfig WHERE disabled=0')) From cvs w lms.org.pl Tue Apr 13 19:01:44 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:44 +0200 (CEST) Subject: [lms-commits] CVS update of lms/contrib/squid_redirector (index.php) Message-ID: <20100413170144.9A4CF3027B29@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:44 Author: alec Path: /cvsroot/lms/contrib/squid_redirector Modified: index.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/contrib/squid_redirector/index.php.diff?&r1=1.21&r2=1.22 Index: lms/contrib/squid_redirector/index.php diff -u lms/contrib/squid_redirector/index.php:1.21 lms/contrib/squid_redirector/index.php:1.22 --- lms/contrib/squid_redirector/index.php:1.21 Thu Mar 11 14:07:30 2010 +++ lms/contrib/squid_redirector/index.php Tue Apr 13 19:01:44 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: index.php,v 1.21 2010/03/11 13:07:30 alec Exp $ + * $Id: index.php,v 1.22 2010/04/13 17:01:44 alec Exp $ */ // REPLACE THIS WITH PATH TO YOU CONFIG FILE @@ -65,10 +65,6 @@ $DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME); -// Enable data encoding conversion if needed - -require_once(LIB_DIR.'/dbencoding.php'); - // Initialize templates engine require_once(LIB_DIR.'/Smarty/Smarty.class.php'); From cvs w lms.org.pl Tue Apr 13 19:01:44 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:44 +0200 (CEST) Subject: [lms-commits] CVS update of lms/devel (index-with-execstack.php) Message-ID: <20100413170144.AF01A3027B2B@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:44 Author: alec Path: /cvsroot/lms/devel Modified: index-with-execstack.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/devel/index-with-execstack.php.diff?&r1=1.12&r2=1.13 Index: lms/devel/index-with-execstack.php diff -u lms/devel/index-with-execstack.php:1.12 lms/devel/index-with-execstack.php:1.13 --- lms/devel/index-with-execstack.php:1.12 Fri May 15 14:24:43 2009 +++ lms/devel/index-with-execstack.php Tue Apr 13 19:01:44 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: index-with-execstack.php,v 1.12 2009/05/15 12:24:43 alec Exp $ + * $Id: index-with-execstack.php,v 1.13 2010/04/13 17:01:44 alec Exp $ */ // REPLACE THIS WITH PATH TO YOUR CONFIG FILE @@ -118,10 +118,8 @@ $DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME); -// Enable/disable data encoding conversion // Call any of upgrade process before anything else -require_once(LIB_DIR.'/dbencoding.php'); require_once(LIB_DIR.'/upgradedb.php'); // Initialize templates engine From cvs w lms.org.pl Tue Apr 13 19:01:44 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:44 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (3 files) Message-ID: <20100413170144.D3F383027B2C@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:44 Author: alec Path: /cvsroot/lms/lib Modified: LMSDB.php LMSDB_common.class.php Removed: dbencoding.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMSDB.php.diff?&r1=1.19&r2=1.20 http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMSDB_common.class.php.diff?&r1=1.51&r2=1.52 http://cvs.lms.org.pl/viewvc/Development/lms/lib/dbencoding.php?rev=1.15 Index: lms/lib/LMSDB.php diff -u lms/lib/LMSDB.php:1.19 lms/lib/LMSDB.php:1.20 --- lms/lib/LMSDB.php:1.19 Thu Mar 11 14:07:34 2010 +++ lms/lib/LMSDB.php Tue Apr 13 19:01:44 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMSDB.php,v 1.19 2010/03/11 13:07:34 alec Exp $ + * $Id: LMSDB.php,v 1.20 2010/04/13 17:01:44 alec Exp $ */ /* @@ -37,22 +37,27 @@ function DBInit($dbtype,$dbhost,$dbuser,$dbpasswd,$dbname) { - if(!file_exists(LMSDB_DIR.'/LMSDB_driver_'.strtolower($dbtype).'.class.php') ) + $dbtype = strtolower($dbtype); + + if (!file_exists(LMSDB_DIR.'/LMSDB_driver_'.$dbtype.'.class.php') ) trigger_error('Unable to load driver for "'.$dbtype.'" database!', E_USER_WARNING); else { require_once(LMSDB_DIR.'/LMSDB_driver_'.strtolower($dbtype).'.class.php'); $drvname = 'LMSDB_driver_'.strtolower($dbtype); - $DB =& new $drvname($dbhost,$dbuser,$dbpasswd,$dbname); + $DB = new $drvname($dbhost,$dbuser,$dbpasswd,$dbname); - if(!$DB->_loaded) - trigger_error('Failed to load driver for "' - .$dbtype.'" database: driver doesn\'t seems to be loaded.', E_USER_WARNING); - elseif(!$DB->_dblink) + if (!$DB->_loaded) + trigger_error('PHP Driver for "'.$dbtype.'" database doesn\'t seems to be loaded.', E_USER_WARNING); + else if (!$DB->_dblink) trigger_error('Unable to connect to database!', E_USER_WARNING); - else + else { + // set client encoding + $DB->SetEncoding('UTF8'); + return $DB; - } + } + } return FALSE; } Index: lms/lib/LMSDB_common.class.php diff -u lms/lib/LMSDB_common.class.php:1.51 lms/lib/LMSDB_common.class.php:1.52 --- lms/lib/LMSDB_common.class.php:1.51 Thu Mar 11 14:07:34 2010 +++ lms/lib/LMSDB_common.class.php Tue Apr 13 19:01:44 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMSDB_common.class.php,v 1.51 2010/03/11 13:07:34 alec Exp $ + * $Id: LMSDB_common.class.php,v 1.52 2010/04/13 17:01:44 alec Exp $ */ /* @@ -31,7 +31,7 @@ Class LMSDB_common { var $_version = '1.11-cvs'; - var $_revision = '$Revision: 1.51 $'; + var $_revision = '$Revision: 1.52 $'; // Driver powinien nadpisać tą zmienną wartością TRUE, żeby // funkcja inicjująca baze danych wiedziała że driver się poprawnie @@ -229,6 +229,11 @@ return $this->_driver_dbversion(); } + function SetEncoding($name) + { + return $this->_driver_setencoding($name); + } + function GetLastInsertID($table = NULL) { return $this->_driver_lastinsertid($table); @@ -288,6 +293,11 @@ return 'LIKE'; } + function _driver_setencoding($name) + { + $this->Execute('SET NAMES ?', array($name)); + } + } ?> Index: lms/lib/dbencoding.php diff -u lms/lib/dbencoding.php:1.15 lms/lib/dbencoding.php:removed --- lms/lib/dbencoding.php:1.15 Thu Mar 11 14:07:34 2010 +++ lms/lib/dbencoding.php Tue Apr 13 19:01:44 2010 @@ -1,39 +0,0 @@ -Execute("SET CLIENT_ENCODING TO 'UNICODE'"); - break; - - case 'mysql': - case 'mysqli': - $DB->Execute("SET NAMES utf8"); - break; -} - -?> From cvs w lms.org.pl Tue Apr 13 19:01:44 2010 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 13 Apr 2010 19:01:44 +0200 (CEST) Subject: [lms-commits] CVS update of lms/userpanel (index.php) Message-ID: <20100413170144.EFE753027B2D@hydra.altec.pl> Date: Tuesday, April 13, 2010 @ 19:01:44 Author: alec Path: /cvsroot/lms/userpanel Modified: index.php - removed dbencoding.php file, extended DB class with SetEncoding() Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/index.php.diff?&r1=1.10&r2=1.11 Index: lms/userpanel/index.php diff -u lms/userpanel/index.php:1.10 lms/userpanel/index.php:1.11 --- lms/userpanel/index.php:1.10 Thu Mar 11 14:07:52 2010 +++ lms/userpanel/index.php Tue Apr 13 19:01:44 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: index.php,v 1.10 2010/03/11 13:07:52 alec Exp $ + * $Id: index.php,v 1.11 2010/04/13 17:01:44 alec Exp $ */ // REPLACE THIS WITH PATH TO YOUR CONFIG FILE @@ -75,8 +75,6 @@ if (!$DB) die; -require_once(LIB_DIR.'/dbencoding.php'); - // Initialize templates engine (must be before locale settings) require_once(LIB_DIR.'/Smarty/Smarty.class.php'); From cvs w lms.org.pl Thu Apr 15 11:24:42 2010 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 15 Apr 2010 11:24:42 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc/sgml/pl (mgc.sgml) Message-ID: <20100415092442.65B383027B29@hydra.altec.pl> Date: Thursday, April 15, 2010 @ 11:24:42 Author: alec Path: /cvsroot/lms/doc/sgml/pl Modified: mgc.sgml - typo Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/mgc.sgml.diff?&r1=1.14&r2=1.15 Index: lms/doc/sgml/pl/mgc.sgml diff -u lms/doc/sgml/pl/mgc.sgml:1.14 lms/doc/sgml/pl/mgc.sgml:1.15 --- lms/doc/sgml/pl/mgc.sgml:1.14 Wed Dec 2 15:49:19 2009 +++ lms/doc/sgml/pl/mgc.sgml Thu Apr 15 11:24:42 2010 @@ -1,4 +1,4 @@ - + Generator plików konfiguracyjnych (lms-mgc) LMS-MGC to "magiczny" generator plików konfiguracyjnych. Przy odrobinie wysiłku można stworzyć przy jego pomocy dowolnego rodzaju plik konfiguracyjny (np. generujący odpowiednie strefy dla DNS) @@ -364,7 +364,7 @@ %PLIMIT - limit pakietów - %PLIMIT - limit pakietów (dla godzin nocnych) + %NPLIMIT - limit pakietów (dla godzin nocnych) %1 %2 %3 %4 - kolejne oktety (od lewej) adresu IP From cvs w lms.org.pl Thu Apr 15 11:25:05 2010 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 15 Apr 2010 11:25:05 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (README.pl) Message-ID: <20100415092505.CF54E3027B29@hydra.altec.pl> Date: Thursday, April 15, 2010 @ 11:25:05 Author: alec Path: /cvsroot/lms/doc Modified: README.pl - typo Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.pl.diff?&r1=1.48&r2=1.49 Index: lms/doc/README.pl diff -u lms/doc/README.pl:1.48 lms/doc/README.pl:1.49 --- lms/doc/README.pl:1.48 Fri Apr 2 17:26:09 2010 +++ lms/doc/README.pl Thu Apr 15 11:25:05 2010 @@ -4141,7 +4141,7 @@ * %CLIMIT - limit równoczesnych połączeń * %NCLIMIT - limit równoczesnych połączeń (dla godzin nocnych) * %PLIMIT - limit pakietów - * %PLIMIT - limit pakietów (dla godzin nocnych) + * %NPLIMIT - limit pakietów (dla godzin nocnych) * %1 %2 %3 %4 - kolejne oktety (od lewej) adresu IP * %NID - ID sieci, do której należy komputer * %NNAME - nazwa sieci dużymi znakami From cvs w lms.org.pl Fri Apr 16 11:09:19 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 16 Apr 2010 11:09:19 +0200 (CEST) Subject: [lms-commits] CVS update of lms/daemon/modules/payments (payments.c) Message-ID: <20100416090919.2251D3027B29@hydra.altec.pl> Date: Friday, April 16, 2010 @ 11:09:19 Author: alec Path: /cvsroot/lms/daemon/modules/payments Modified: payments.c - lmsd/payments: added %next_mon variable for next month in YYYY/MM format Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/payments/payments.c.diff?&r1=1.84&r2=1.85 Index: lms/daemon/modules/payments/payments.c diff -u lms/daemon/modules/payments/payments.c:1.84 lms/daemon/modules/payments/payments.c:1.85 --- lms/daemon/modules/payments/payments.c:1.84 Thu Mar 11 14:07:32 2010 +++ lms/daemon/modules/payments/payments.c Fri Apr 16 11:09:18 2010 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: payments.c,v 1.84 2010/03/11 13:07:32 alec Exp $ + * $Id: payments.c,v 1.85 2010/04/16 09:09:18 alec Exp $ */ #include #include @@ -257,7 +257,7 @@ time_t t; struct tm *tt; char monthday[3], month[3], year[5], quarterday[4], weekday[2], yearday[4], halfday[4]; - char monthname[20]; + char monthname[20], nextmon[8]; char *nets = strdup(" AND EXISTS (SELECT 1 FROM nodes, networks n \ WHERE ownerid = ats.customerid \ @@ -428,6 +428,13 @@ break; } + // next month in YYYY/MM format + if (imonth == 12) + snprintf(nextmon, sizeof(nextmon), "%04d/%02d", tt->tm_year+1901, 1); + else + snprintf(nextmon, sizeof(nextmon), "%04d/%02d", tt->tm_year+1900, imonth+1); + + // time periods y_period = get_period(tt, YEARLY, p->up_payments); h_period = get_period(tt, HALFYEARLY, p->up_payments); q_period = get_period(tt, QUARTERLY, p->up_payments); @@ -598,6 +605,7 @@ case YEARLY: g->str_replace(&description, "%period", y_period); break; } g->str_replace(&description, "%tariff", g->db_get_data(res,i,"name")); + g->str_replace(&description, "%next_mon", nextmon); g->str_replace(&description, "%month", monthname); g->str_replace(&description, "%year", year); From cvs w lms.org.pl Fri Apr 16 11:09:19 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 16 Apr 2010 11:09:19 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog, README, README.pl) Message-ID: <20100416090919.5D13F3027B2B@hydra.altec.pl> Date: Friday, April 16, 2010 @ 11:09:19 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog README README.pl - lmsd/payments: added %next_mon variable for next month in YYYY/MM format Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1489&r2=1.1490 http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.diff?&r1=1.220&r2=1.221 http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.pl.diff?&r1=1.49&r2=1.50 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1489 lms/doc/ChangeLog:1.1490 --- lms/doc/ChangeLog:1.1489 Fri Apr 9 19:01:31 2010 +++ lms/doc/ChangeLog Fri Apr 16 11:09:19 2010 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1489 2010/04/09 17:01:31 alec Exp $ +$Id: ChangeLog,v 1.1490 2010/04/16 09:09:19 alec Exp $ version ? (????-??-??) @@ -57,7 +57,8 @@ - BTS#0000825: fixed tariff limits checking in domain edition (alec) - lmsd/ewx-stm-channels: EtherWerX STM manager with extended channels support (alec) - Extended DNS records add/edit form (alec) - + - lmsd/payments: added %next_mon variable for next month in YYYY/MM format (alec) + version 1.11.9 Moloc (2009-10-28): - BTS#0000794: fixed postfix configuration for MySQL (alec) Index: lms/doc/README diff -u lms/doc/README:1.220 lms/doc/README:1.221 --- lms/doc/README:1.220 Fri Apr 2 17:26:09 2010 +++ lms/doc/README Fri Apr 16 11:09:19 2010 @@ -3907,8 +3907,8 @@ Description of operation. '%period' will be replaced by start and end date of subscription, e.g. '2003/10/10 - 2003/11/09', '%tariff' by name of liability, %month by full name of current month and - %year by current year. Default: 'Subscription: '%tariff' for - period: %period'. + %year by current year, %next_mon by next month in YYYY/MM format. + Default: 'Subscription: '%tariff' for period: %period'. Example: comment = 'Subscription %tariff' * settlement_comment Description of settlement operation. '%period' will be replaced by Index: lms/doc/README.pl diff -u lms/doc/README.pl:1.49 lms/doc/README.pl:1.50 --- lms/doc/README.pl:1.49 Thu Apr 15 11:25:05 2010 +++ lms/doc/README.pl Fri Apr 16 11:09:19 2010 @@ -4431,8 +4431,9 @@ Komentarz do operacji. '%period' zostanie zamienione na daty od-do należnego abonamentu, np. '2003/10/10 - 2003/11/09', '%tariff' na nazwę odpowiedniej taryfy/zobowiązania, %month na pełną nazwę - bieżącego miesiąca, a %year na bieżący rok. Domyślnie: - 'Subscription: '%tariff' for period: %period'. + bieżącego miesiąca, %year na bieżący rok, a %next_mon na następny + miesiąc w formacie RRRR/MM. Domyślnie: 'Subscription: '%tariff' for + period: %period'. Przykład: comment = 'Abonament miesięczny za okres %period' * settlement_comment Komentarz do operacji wyrównania. '%period' zostanie zamienione na From cvs w lms.org.pl Fri Apr 16 11:09:19 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 16 Apr 2010 11:09:19 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc/html/en (daemon-modules.html) Message-ID: <20100416090919.74A573027B2C@hydra.altec.pl> Date: Friday, April 16, 2010 @ 11:09:19 Author: alec Path: /cvsroot/lms/doc/html/en Modified: daemon-modules.html - lmsd/payments: added %next_mon variable for next month in YYYY/MM format Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/en/daemon-modules.html.diff?&r1=1.46&r2=1.47 Index: lms/doc/html/en/daemon-modules.html diff -u lms/doc/html/en/daemon-modules.html:1.46 lms/doc/html/en/daemon-modules.html:1.47 --- lms/doc/html/en/daemon-modules.html:1.46 Wed Nov 25 15:14:38 2009 +++ lms/doc/html/en/daemon-modules.html Fri Apr 16 11:09:19 2010 @@ -349,7 +349,8 @@ >

Description of operation. '%period' will be replaced by start and end date of subscription, e.g. '2003/10/10 - 2003/11/09', '%tariff' by name of - liability, %month by full name of current month and %year by current year. + liability, %month by full name of current month and %year by current year, + %next_mon by next month in YYYY/MM format. Default: 'Subscription: '%tariff' for period: %period'.

Example: Date: Friday, April 16, 2010 @ 11:09:19 Author: alec Path: /cvsroot/lms/doc/html/pl Modified: daemon-modules.html mgc-config.html - lmsd/payments: added %next_mon variable for next month in YYYY/MM format Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/daemon-modules.html.diff?&r1=1.67&r2=1.68 http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/mgc-config.html.diff?&r1=1.22&r2=1.23 Index: lms/doc/html/pl/daemon-modules.html diff -u lms/doc/html/pl/daemon-modules.html:1.67 lms/doc/html/pl/daemon-modules.html:1.68 --- lms/doc/html/pl/daemon-modules.html:1.67 Fri Apr 2 17:26:09 2010 +++ lms/doc/html/pl/daemon-modules.html Fri Apr 16 11:09:19 2010 @@ -388,7 +388,8 @@ >Komentarz do operacji. '%period' zostanie zamienione na daty od-do należnego abonamentu, np. '2003/10/10 - 2003/11/09', '%tariff' na nazwę odpowiedniej taryfy/zobowiązania, %month na pełną nazwę bieżącego - miesiąca, a %year na bieżący rok. Domyślnie: 'Subscription: '%tariff' for period: %period'.

Przykład:

  • %PLIMIT - limit pakietów (dla godzin nocnych)

    %NPLIMIT - limit pakietów (dla godzin nocnych)

  • Date: Friday, April 16, 2010 @ 11:09:19 Author: alec Path: /cvsroot/lms/doc/sgml/pl Modified: daemon.sgml - lmsd/payments: added %next_mon variable for next month in YYYY/MM format Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/daemon.sgml.diff?&r1=1.80&r2=1.81 Index: lms/doc/sgml/pl/daemon.sgml diff -u lms/doc/sgml/pl/daemon.sgml:1.80 lms/doc/sgml/pl/daemon.sgml:1.81 --- lms/doc/sgml/pl/daemon.sgml:1.80 Fri Apr 2 17:26:09 2010 +++ lms/doc/sgml/pl/daemon.sgml Fri Apr 16 11:09:19 2010 @@ -1,4 +1,4 @@ - + LMS Daemon @@ -308,7 +308,8 @@ Komentarz do operacji. '%period' zostanie zamienione na daty od-do należnego abonamentu, np. '2003/10/10 - 2003/11/09', '%tariff' na nazwę odpowiedniej taryfy/zobowiązania, %month na pełną nazwę bieżącego - miesiąca, a %year na bieżący rok. Domyślnie: 'Subscription: '%tariff' for period: %period'. + miesiąca, %year na bieżący rok, a %next_mon na następny miesiąc w formacie RRRR/MM. + Domyślnie: 'Subscription: '%tariff' for period: %period'. Przykład: comment = 'Abonament miesięczny za okres %period' From cvs w lms.org.pl Fri Apr 16 11:09:19 2010 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 16 Apr 2010 11:09:19 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc/sgml (daemon.sgml) Message-ID: <20100416090919.AE3663027B29@hydra.altec.pl> Date: Friday, April 16, 2010 @ 11:09:19 Author: alec Path: /cvsroot/lms/doc/sgml Modified: daemon.sgml - lmsd/payments: added %next_mon variable for next month in YYYY/MM format Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/daemon.sgml.diff?&r1=1.107&r2=1.108 Index: lms/doc/sgml/daemon.sgml diff -u lms/doc/sgml/daemon.sgml:1.107 lms/doc/sgml/daemon.sgml:1.108 --- lms/doc/sgml/daemon.sgml:1.107 Wed Nov 25 09:33:50 2009 +++ lms/doc/sgml/daemon.sgml Fri Apr 16 11:09:19 2010 @@ -1,4 +1,4 @@ - + LMS Daemon @@ -277,7 +277,8 @@ comment Description of operation. '%period' will be replaced by start and end date of subscription, e.g. '2003/10/10 - 2003/11/09', '%tariff' by name of - liability, %month by full name of current month and %year by current year. + liability, %month by full name of current month and %year by current year, + %next_mon by next month in YYYY/MM format. Default: 'Subscription: '%tariff' for period: %period'. Example: comment = 'Subscription %tariff' From cvs w lms.org.pl Mon Apr 19 12:56:15 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 19 Apr 2010 12:56:15 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (common.php) Message-ID: <20100419105615.7A6A03027B2B@hydra.altec.pl> Date: Monday, April 19, 2010 @ 12:56:15 Author: alec Path: /cvsroot/lms/lib Modified: common.php - PHP 5.3. compat. fixes Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/common.php.diff?&r1=1.119&r2=1.120 Index: lms/lib/common.php diff -u lms/lib/common.php:1.119 lms/lib/common.php:1.120 --- lms/lib/common.php:1.119 Fri Apr 9 19:01:31 2010 +++ lms/lib/common.php Mon Apr 19 12:56:15 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: common.php,v 1.119 2010/04/09 17:01:31 alec Exp $ + * $Id: common.php,v 1.120 2010/04/19 10:56:15 alec Exp $ */ // Common functions, that making it in class would be nonsense :) @@ -61,7 +61,7 @@ if ($args) { - $args_list = split(' ', $args); + $args_list = preg_split('/ /', $args); for ($i = 0; $i < count($args_list); $i++) { if ($args_list[$i] == '|') @@ -345,20 +345,12 @@ { case 'OpenBSD': case 'Linux': - define_syslog_variables(); - // Taken from PHP manual. On my WinXP box with Easy PHP it's fuck's up - // system - + $access = date('Y/m/d H:i:s'); // open syslog, include the process ID and also send // the log to standard error, and use a user defined // logging mechanism - openlog('lms-php', LOG_PID | LOG_NDELAY, LOG_AUTH); - - $access = date('Y/m/d H:i:s'); - syslog($type,$message.' (at '.$access.' from '.$_SERVER['REMOTE_ADDR'].' ('.$_SERVER['HTTP_USER_AGENT'].'))'); - closelog(); break; default: From cvs w lms.org.pl Mon Apr 19 12:56:15 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 19 Apr 2010 12:56:15 +0200 (CEST) Subject: [lms-commits] CVS update of lms/contrib/customer_otherip (authentication.inc) Message-ID: <20100419105615.610073027B29@hydra.altec.pl> Date: Monday, April 19, 2010 @ 12:56:15 Author: alec Path: /cvsroot/lms/contrib/customer_otherip Modified: authentication.inc - PHP 5.3. compat. fixes Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/contrib/customer_otherip/authentication.inc.diff?&r1=1.16&r2=1.17 Index: lms/contrib/customer_otherip/authentication.inc diff -u lms/contrib/customer_otherip/authentication.inc:1.16 lms/contrib/customer_otherip/authentication.inc:1.17 --- lms/contrib/customer_otherip/authentication.inc:1.16 Thu Mar 11 14:07:29 2010 +++ lms/contrib/customer_otherip/authentication.inc Mon Apr 19 12:56:15 2010 @@ -21,13 +21,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: authentication.inc,v 1.16 2010/03/11 13:07:29 alec Exp $ + * $Id: authentication.inc,v 1.17 2010/04/19 10:56:15 alec Exp $ */ function GetCustomerIDByPhoneAndPIN($phone, $pin) { global $DB; - if(!ereg('^[0-9]+$', $pin)) + if(!preg_match('/^[0-9]+$/', $pin)) return NULL; return $DB->GetOne('SELECT id FROM customers, customercontacts WHERE customerid = customers.id AND pin=? AND phone=? LIMIT 1', @@ -37,7 +37,7 @@ function GetCustomerIDByIDAndPIN($id, $pin) { global $DB; - if(!ereg('^[0-9]+$', $pin) || !ereg('^[0-9]+$', $id)) + if(!preg_match('/^[0-9]+$/', $pin) || !preg_match('/^[0-9]+$/', $id)) return NULL; return $DB->GetOne('SELECT id from customers WHERE pin=? AND id=?', array($pin, $id)); } @@ -46,7 +46,7 @@ function GetCustomerIDByContractAndPIN($contract, $pin) { global $DB; - if(!ereg('^[0-9]+$', $pin)) + if(!preg_match('/^[0-9]+$/', $pin)) return NULL; return $DB->GetOne('SELECT id FROM customers WHERE pin=? AND contract=?', array($pin, $contract)); } From cvs w lms.org.pl Mon Apr 19 12:56:15 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 19 Apr 2010 12:56:15 +0200 (CEST) Subject: [lms-commits] CVS update of lms/userpanel (index.php) Message-ID: <20100419105615.EFD2B3027B2D@hydra.altec.pl> Date: Monday, April 19, 2010 @ 12:56:15 Author: alec Path: /cvsroot/lms/userpanel Modified: index.php - PHP 5.3. compat. fixes Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/index.php.diff?&r1=1.11&r2=1.12 Index: lms/userpanel/index.php diff -u lms/userpanel/index.php:1.11 lms/userpanel/index.php:1.12 --- lms/userpanel/index.php:1.11 Tue Apr 13 19:01:44 2010 +++ lms/userpanel/index.php Mon Apr 19 12:56:15 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: index.php,v 1.11 2010/04/13 17:01:44 alec Exp $ + * $Id: index.php,v 1.12 2010/04/19 10:56:15 alec Exp $ */ // REPLACE THIS WITH PATH TO YOUR CONFIG FILE @@ -131,7 +131,7 @@ $dh = opendir(USERPANEL_MODULES_DIR); while (false !== ($filename = readdir($dh))) { - if ((ereg("^[a-zA-Z0-9]",$filename)) && (is_dir(USERPANEL_MODULES_DIR.$filename)) && file_exists(USERPANEL_MODULES_DIR.$filename.'/configuration.php')) + if ((preg_match('/^[a-zA-Z0-9]/',$filename)) && (is_dir(USERPANEL_MODULES_DIR.$filename)) && file_exists(USERPANEL_MODULES_DIR.$filename.'/configuration.php')) { @include(USERPANEL_MODULES_DIR.$filename.'/locale/'.$_language.'/strings.php'); include(USERPANEL_MODULES_DIR.$filename.'/configuration.php'); From cvs w lms.org.pl Mon Apr 19 12:56:16 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 19 Apr 2010 12:56:16 +0200 (CEST) Subject: [lms-commits] CVS update of lms/userpanel/lib (5 files) Message-ID: <20100419105616.2C4E13027B29@hydra.altec.pl> Date: Monday, April 19, 2010 @ 12:56:16 Author: alec Path: /cvsroot/lms/userpanel/lib Modified: LMS.menu.php LMS.setup.php Session.class.php Userpanel.class.php authentication.inc - PHP 5.3. compat. fixes Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/lib/LMS.menu.php.diff?&r1=1.4&r2=1.5 http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/lib/LMS.setup.php.diff?&r1=1.5&r2=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/lib/Session.class.php.diff?&r1=1.4&r2=1.5 http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/lib/Userpanel.class.php.diff?&r1=1.4&r2=1.5 http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/lib/authentication.inc.diff?&r1=1.5&r2=1.6 Index: lms/userpanel/lib/LMS.menu.php diff -u lms/userpanel/lib/LMS.menu.php:1.4 lms/userpanel/lib/LMS.menu.php:1.5 --- lms/userpanel/lib/LMS.menu.php:1.4 Thu Mar 11 14:07:53 2010 +++ lms/userpanel/lib/LMS.menu.php Mon Apr 19 12:56:15 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.menu.php,v 1.4 2010/03/11 13:07:53 alec Exp $ + * $Id: LMS.menu.php,v 1.5 2010/04/19 10:56:15 alec Exp $ */ // variables @@ -60,7 +60,7 @@ // Initialize modules $dh = opendir(USERPANEL_MODULES_DIR); while (false !== ($filename = readdir($dh))) - if ((ereg('^[a-zA-Z0-9]',$filename)) && (is_dir(USERPANEL_MODULES_DIR.$filename)) && file_exists(USERPANEL_MODULES_DIR.$filename."/configuration.php")) + if ((preg_match('/^[a-zA-Z0-9]/',$filename)) && (is_dir(USERPANEL_MODULES_DIR.$filename)) && file_exists(USERPANEL_MODULES_DIR.$filename."/configuration.php")) { @include(USERPANEL_MODULES_DIR.$filename.'/locale/'.$_language.'/strings.php'); include(USERPANEL_MODULES_DIR.$filename.'/configuration.php'); Index: lms/userpanel/lib/LMS.setup.php diff -u lms/userpanel/lib/LMS.setup.php:1.5 lms/userpanel/lib/LMS.setup.php:1.6 --- lms/userpanel/lib/LMS.setup.php:1.5 Thu Mar 11 14:07:53 2010 +++ lms/userpanel/lib/LMS.setup.php Mon Apr 19 12:56:15 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.setup.php,v 1.5 2010/03/11 13:07:53 alec Exp $ + * $Id: LMS.setup.php,v 1.6 2010/04/19 10:56:15 alec Exp $ */ define('USERPANEL_SETUPMODE', 1); @@ -84,7 +84,7 @@ $dh = opendir(USERPANEL_MODULES_DIR); while (false !== ($filename = readdir($dh))) { - if ((ereg('^[a-zA-Z0-9]',$filename)) && (is_dir(USERPANEL_MODULES_DIR.$filename)) && file_exists(USERPANEL_MODULES_DIR.$filename.'/configuration.php')) + if ((preg_match('/^[a-zA-Z0-9]/',$filename)) && (is_dir(USERPANEL_MODULES_DIR.$filename)) && file_exists(USERPANEL_MODULES_DIR.$filename.'/configuration.php')) { @include(USERPANEL_MODULES_DIR.$filename.'/locale/'.$_language.'/strings.php'); include(USERPANEL_MODULES_DIR.$filename.'/configuration.php'); Index: lms/userpanel/lib/Session.class.php diff -u lms/userpanel/lib/Session.class.php:1.4 lms/userpanel/lib/Session.class.php:1.5 --- lms/userpanel/lib/Session.class.php:1.4 Thu Mar 11 14:07:53 2010 +++ lms/userpanel/lib/Session.class.php Mon Apr 19 12:56:16 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: Session.class.php,v 1.4 2010/03/11 13:07:53 alec Exp $ + * $Id: Session.class.php,v 1.5 2010/04/19 10:56:16 alec Exp $ */ require_once('authentication.inc'); @@ -35,13 +35,13 @@ var $islogged = FALSE; var $error; var $_version = '1.11-cvs'; - var $_revision = '$Revision: 1.4 $'; + var $_revision = '$Revision: 1.5 $'; function Session(&$DB,$timeout = 600) { session_start(); $this->DB = &$DB; - $this->_revision = eregi_replace('^.Revision: ([0-9.]+).*','\1', $this->_revision); + $this->_revision = preg_replace('/^.Revision: ([0-9.]+).*/i', '\1', $this->_revision); $this->ip = str_replace('::ffff:', '', $_SERVER['REMOTE_ADDR']); if(isset($_GET['override'])) Index: lms/userpanel/lib/Userpanel.class.php diff -u lms/userpanel/lib/Userpanel.class.php:1.4 lms/userpanel/lib/Userpanel.class.php:1.5 --- lms/userpanel/lib/Userpanel.class.php:1.4 Thu Mar 11 14:07:53 2010 +++ lms/userpanel/lib/Userpanel.class.php Mon Apr 19 12:56:16 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: Userpanel.class.php,v 1.4 2010/03/11 13:07:53 alec Exp $ + * $Id: Userpanel.class.php,v 1.5 2010/04/19 10:56:16 alec Exp $ */ class USERPANEL @@ -31,11 +31,11 @@ var $CONFIG; var $MODULES = array(); var $_version = '1.11-cvs'; - var $_revision = '$Revision: 1.4 $'; + var $_revision = '$Revision: 1.5 $'; function USERPANEL(&$DB, &$SESSION, &$CONFIG) // ustawia zmienne klasy { - $this->_revision = eregi_replace('^.Revision: ([0-9.]+).*','\1',$this->_revision); + $this->_revision = preg_replace('/^.Revision: ([0-9.]+).*/i', '\1', $this->_revision); $this->DB = &$DB; $this->SESSION = &$SESSION; $this->CONFIG = &$CONFIG; Index: lms/userpanel/lib/authentication.inc diff -u lms/userpanel/lib/authentication.inc:1.5 lms/userpanel/lib/authentication.inc:1.6 --- lms/userpanel/lib/authentication.inc:1.5 Thu Mar 11 14:07:53 2010 +++ lms/userpanel/lib/authentication.inc Mon Apr 19 12:56:16 2010 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: authentication.inc,v 1.5 2010/03/11 13:07:53 alec Exp $ + * $Id: authentication.inc,v 1.6 2010/04/19 10:56:16 alec Exp $ */ global $LMS; @@ -29,7 +29,7 @@ function GetCustomerIDByPhoneAndPIN($phone, $pin) { global $DB; - if(!ereg('^[0-9]+$', $pin)) + if(!preg_match('/^[0-9]+$/', $pin)) return NULL; $authinfo['id'] = $DB->GetOne('SELECT id FROM customers, customercontacts @@ -50,7 +50,7 @@ function GetCustomerIDByIDAndPIN($id, $pin) { global $DB; - if(!ereg('^[0-9]+$', $pin) || !ereg('^[0-9]+$', $id)) + if(!preg_match('/^[0-9]+$/', $pin) || !preg_match('/^[0-9]+$/', $id)) return NULL; $authinfo['id'] = $DB->GetOne('SELECT id from customers @@ -68,7 +68,7 @@ function GetCustomerIDByContractAndPIN($contract, $pin) { global $DB; - if(!ereg('^[0-9]+$', $pin)) + if(!preg_match('/^[0-9]+$/', $pin)) return NULL; $authinfo['id'] = $DB->GetOne('SELECT id FROM customers From cvs w lms.org.pl Mon Apr 19 12:56:15 2010 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 19 Apr 2010 12:56:15 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (12 files) Message-ID: <20100419105615.D475F3027B2C@hydra.altec.pl> Date: Monday, April 19, 2010 @ 12:56:15 Author: alec Path: /cvsroot/lms/templates Modified: balancelist.html clearheader.html customerbalancebox.html invoiceedit.html invoiceheader.html invoicelist.html invoicenew.html invoicenote.html noteheader.html notelist.html printindex.html receiptheader.html - PHP 5.3. compat. fixes Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/balancelist.html.diff?&r1=1.92&r2=1.93 http://cvs.lms.org.pl/viewvc/Development/lms/templates/clearheader.html.diff?&r1=1.17&r2=1.18 http://cvs.lms.org.pl/viewvc/Development/lms/templates/customerbalancebox.html.diff?&r1=1.48&r2=1.49 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoiceedit.html.diff?&r1=1.38&r2=1.39 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoiceheader.html.diff?&r1=1.2&r2=1.3 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicelist.html.diff?&r1=1.80&r2=1.81 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicenew.html.diff?&r1=1.65&r2=1.66 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicenote.html.diff?&r1=1.22&r2=1.23 http://cvs.lms.org.pl/viewvc/Development/lms/templates/noteheader.html.diff?&r1=1.1&r2=1.2 http://cvs.lms.org.pl/viewvc/Development/lms/templates/notelist.html.diff?&r1=1.3&r2=1.4 http://cvs.lms.org.pl/viewvc/Development/lms/templates/printindex.html.diff?&r1=1.96&r2=1.97 http://cvs.lms.org.pl/viewvc/Development/lms/templates/receiptheader.html.diff?&r1=1.1&r2=1.2 Index: lms/templates/balancelist.html diff -u lms/templates/balancelist.html:1.92 lms/templates/balancelist.html:1.93 --- lms/templates/balancelist.html:1.92 Wed Sep 9 10:13:21 2009 +++ lms/templates/balancelist.html Mon Apr 19 12:56:15 2010 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"} {literal} @@ -226,9 +226,9 @@ {t}Delete{/t} {t}Delete{/t}  {t}Print invoices{/t}   {t}Print cash receipts{/t}   - {t}original{/t}  - {t}copy{/t} - {t}duplicate{/t} + {t}original{/t}  + {t}copy{/t} + {t}duplicate{/t} {t}Check All{/t} Index: lms/templates/clearheader.html diff -u lms/templates/clearheader.html:1.17 lms/templates/clearheader.html:1.18 --- lms/templates/clearheader.html:1.17 Fri Jan 25 13:53:43 2008 +++ lms/templates/clearheader.html Mon Apr 19 12:56:15 2010 @@ -1,5 +1,5 @@ - + @@ -8,4 +8,4 @@ ::: LMS :{if $layout.pagetitle neq ""} {$layout.pagetitle} :{/if}:: - + Index: lms/templates/customerbalancebox.html diff -u lms/templates/customerbalancebox.html:1.48 lms/templates/customerbalancebox.html:1.49 --- lms/templates/customerbalancebox.html:1.48 Wed Aug 26 15:37:50 2009 +++ lms/templates/customerbalancebox.html Mon Apr 19 12:56:15 2010 @@ -1,4 +1,4 @@ - + {literal}