diff --git a/RELEASE b/RELEASE index 24cc35028..63eaed4dd 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.7.2 rev 4845 +0.7.2 rev 4856 diff --git a/api/libs/api.userprofile.php b/api/libs/api.userprofile.php index aa8e1330c..3938f3d6d 100644 --- a/api/libs/api.userprofile.php +++ b/api/libs/api.userprofile.php @@ -746,8 +746,12 @@ protected function getSwitchAssignControls() { return ($result); } + /** + * Returns user Vlan assign controls + * + * @return string + */ protected function getVlanAssignControls() { - //switchport section if ($this->alterCfg['VLAN_IN_PROFILE']) { $result = web_ProfileVlanControlForm($this->login); } else { @@ -756,6 +760,28 @@ protected function getVlanAssignControls() { return ($result); } + /** + * Returns Vlan online detection form + * + * @return string + */ + protected function getVlanOnline() { + $result = ''; + if ($this->alterCfg['VLAN_ONLINE_IN_PROFILE']) { + $vlanGen = new VlanGen(); + $vlan = $vlanGen->GetVlan($this->login); + if (!empty($vlan)) { + $history = new VlanMacHistory; + $cells = wf_TableCell(__('Detect online'), '30%', 'row2'); + $cells.= wf_TableCell($history->GetUserVlanOnline($this->login, $vlanGen->GetVlan($vlan))); + $rows = wf_TableRow($cells, 'row3'); + $result = wf_TableBody($rows, '100%', '0'); + return($result); + } + } + return ($result); + } + /** * returns DN online detect aka "star" * @@ -1043,6 +1069,8 @@ public function render() { $profile.=$this->getSwitchAssignControls(); //profile vlan controls $profile.=$this->getVlanAssignControls(); + //profile vlan online + $profile.=$this->getVlanOnline(); //Custom filelds display $profile.=cf_FieldShower($this->login); diff --git a/api/libs/api.vlan.php b/api/libs/api.vlan.php index b3307e148..f56835aaf 100644 --- a/api/libs/api.vlan.php +++ b/api/libs/api.vlan.php @@ -1,5 +1,262 @@ value + * + * @var array + */ + protected $altCfg = array(); + + /** + * Contains all vlan and mac history + * + * @var array + */ + public $allHistory = array(); + + public function __construct() { + $this->LoadTerminators(); + $this->LoadAlter(); + $this->LoadVlanHosts(); + $this->LoadAllSwitches(); + $this->LoadAllSwitchModels(); + $this->LoadVlanMacHistory(); + } + + protected function LoadTerminators() { + $query = "SELECT * FROM " . VlanTerminator::DB_TABLE; + $data = simple_queryall($query); + if (!empty($data)) { + foreach ($data as $each) { + $this->allTerminators[$each['vlanpoolid']] = $each; + } + } + } + + /** + * load alter.ini config + * + * @return void + */ + protected function LoadAlter() { + global $ubillingConfig; + $this->altCfg = $ubillingConfig->getAlter(); + } + + /** + * load all data from vlanhosts to $allVlanHosts + * + * @return void + */ + protected function LoadVlanHosts() { + $query = "SELECT * FROM " . VlanGen::DB_TABLE; + $data = simple_queryall($query); + if (!empty($data)) { + foreach ($data as $each) { + $this->allVlanHosts[$each['login']] = $each; + } + } + } + + /** + * Function for getting all switches and place them to $AllSwitches + * + * @return void + */ + protected function LoadAllSwitches() { + $data = zb_SwitchesGetAll(); + if (!empty($data)) { + foreach ($data as $each) { + $this->AllSwitches[$each['ip']] = $each; + } + } + } + + /** + * Function for getting all switch models and place them to $AllSwitchModels + * + * @return void + */ + protected function LoadAllSwitchModels() { + $query = "SELECT * FROM `switchmodels`"; + $data = simple_queryall($query); + if (!empty($data)) { + foreach ($data as $each) { + $this->AllSwitchModels[$each['id']] = $each['snmptemplate']; + } + } + } + + protected function LoadVlanMacHistory() { + $query = "SELECT * FROM " . self::DB_NAME; + $data = simple_queryall($query); + if (!empty($data)) { + foreach ($data as $each) { + $this->allHistory[$each['login']] = $each; + } + } + } + + /** + * Find vlan terminators snmp template + * + * @param string $login + * @return string + */ + protected function GetTerminatorSnmpTemplate($login) { + $data = $this->AllSwitchModels[$this->AllSwitches[$this->allTerminators[$this->allVlanHosts[$login]['vlanpoolid']]['ip']]['modelid']]; + return $data; + } + + /** + * Read online detect oid from snmp template + * + * @param string $login + * @param int $vlan + * @return string + */ + protected function GetOnlineDetectOid($login, $vlan = false) { + $template = $this->GetTerminatorSnmpTemplate($login); + $snmpData = rcms_parse_ini_file(CONFIG_PATH . "/snmptemplates/" . $template, true); + if ($vlan) { + $oid = $snmpData['define']['ONLINEVLAN'] . "." . $vlan; + } else { + $oid = $snmpData['define']['ONLINEVLAN']; + } + return ($oid); + } + + /** + * Check weather user online + * + * @param string $login + * @param int $vlan + * @return string + */ + public function GetUserVlanOnline($login, $vlan) { + snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC); + @$data = snmp2_real_walk($this->allTerminators[$this->allVlanHosts[$login]['vlanpoolid']]['ip'], $this->AllSwitches[$this->allTerminators[$this->allVlanHosts[$login]['vlanpoolid']]['ip']]['snmp'], $this->GetOnlineDetectOid($login, $vlan)); + if (empty($data)) { + return "Offline" . " " . wf_img_sized('skins/icon_inactive.gif', '', '', '12'); + } else { + return "Online" . " " . wf_img_sized('skins/icon_active.gif', '', '', '12'); + } + } + + /** + * + * @return type + */ + public function WriteVlanMacData() { + $count = 0; + if (!empty($this->allTerminators) AND ! empty($this->allVlanHosts)) { + foreach ($this->allTerminators as $eachTerminator) { + $ip = $eachTerminator["ip"]; + $vlanPoolId = $eachTerminator['vlanpoolid']; + $data = snmp2_real_walk($ip, 'Magistral', '.1.3.6.1.4.1.9.9.380.1.4.1.1.3'); + foreach ($data as $each => $value) { + $decmac = str_replace('.1.3.6.1.4.1.9.9.380.1.4.1.1.3.', '', $each); + $vlanPlusMac = explode(".", $decmac, 2); + $vlan = $vlanPlusMac[0]; + $mac = $this->dec2mac($vlanPlusMac[1]); + foreach ($this->allVlanHosts as $eachHost) { + if ($eachHost['vlanpoolid'] == $vlanPoolId AND $eachHost['vlan'] == $vlan) { + $login = $eachHost['login']; + } + } + if (!empty($this->allHistory)) { + if ($this->allHistory[$login]['mac'] != $mac) { + $this->WriteHistory($login, $vlan, $mac); + } + } else { + $this->WriteHistory($login, $vlan, $mac); + } + $count++; + } + } + } + file_put_contents(self::FLAGPREFIX, $count); + } + + protected function WriteHistory($login, $vlan, $mac) { + $query = "INSERT INTO " . self::DB_NAME . " (`id`, `login`, `vlan`, `mac`, `date`) VALUES (NULL,'" . $login . "','" . $vlan . "','" . $mac . "', NULL);"; + nr_query($query); + } + + /** + * Converts decimal (delimiter is dot) MAC to heximal (delimiter is semicolon) + * + * @param string $mac + * @return string + */ + protected function dec2mac($mac) { + $res = array(); + $args = explode(".", $mac); + foreach ($args as $each) { + $each = dechex($each); + strlen($each) < 2 ? $res[] = "0$each" : $res[] = $each; + } + $string = implode(":", $res); + return ($string); + } + + public function RenderHistory($login) { + $history = $this->allHistory; + $tablecells = wf_TableCell(__('ID')); + $tablecells.= wf_TableCell(__('Login')); + $tablecells.= wf_TableCell(__('VLAN')); + $tablecells.= wf_TableCell(__('MAC')); + $tablecells.= wf_TableCell(__('Date')); + $tablerows = wf_TableRow($tablecells, 'row1'); + if (!empty($history)) { + $tablecells = wf_TableCell($history[$login]['id']); + $tablecells .= wf_TableCell($history[$login]['login']); + $tablecells .= wf_TableCell($history[$login]['vlan']); + $tablecells .= wf_TableCell($history[$login]['mac']); + $tablecells .= wf_TableCell($history[$login]['date']); + $tablerows .= wf_TableRow($tablecells, 'row3'); + } + $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); + show_window(__('History'), $result); + } + +} + class VlanGen { /** @@ -53,8 +310,13 @@ public function __construct() { $this->loadAlter(); } + /** + * select all data from vlan_terminators and load to $AllTerminators + * + * @return void + */ protected function LoadTerminators() { - $query = "SELECT * FROM `vlan_terminators`"; + $query = "SELECT * FROM " . VlanTerminator::DB_TABLE; $data = simple_queryall($query); if (!empty($data)) { foreach ($data as $each) { @@ -63,6 +325,11 @@ protected function LoadTerminators() { } } + /** + * select all data from vlanhosts and load it to $allVlanHosts + * + * @return void + */ protected function LoadVlanHosts() { $query = "SELECT * FROM " . self::DB_TABLE; $data = simple_queryall($query); @@ -73,6 +340,11 @@ protected function LoadVlanHosts() { } } + /** + * select data from vlan_pools and load data to $AllVlanPools and loading data for vlan pool selector + * + * @return void + */ protected function LoadVlanPoolsSelector() { $query = "SELECT * FROM " . self::POOL_DB_TABLE; $data = simple_queryall($query); @@ -583,7 +855,7 @@ public function __construct() { } protected function LoadTerminators() { - $query = "SELECT * FROM `vlan_terminators`"; + $query = "SELECT * FROM " . self::DB_TABLE; $data = simple_queryall($query); if (!empty($data)) { foreach ($data as $each) { @@ -1144,7 +1416,7 @@ protected function LoadAllSwitchPort() { * Function for getting all switch login data and place it to $AllSwitchLogin */ protected function LoadAllSwitchLogin() { - $query = "SELECT * FROM `switch_login`"; + $query = "SELECT * FROM " . SwitchLogin::TABLE_NAME; $data = simple_queryall($query); if (!empty($data)) { foreach ($data as $each) { @@ -1157,7 +1429,7 @@ protected function LoadAllSwitchLogin() { * Get all available vlan terminators data and place it to $AllTerminators */ protected function LoadTerminators() { - $query = "SELECT * FROM `vlan_terminators"; + $query = "SELECT * FROM " . VlanTerminator::DB_TABLE; $data = simple_queryall($query); if (!empty($data)) { foreach ($data as $each) { diff --git a/config/alter.ini b/config/alter.ini index 30b34a204..fc7480e1f 100644 --- a/config/alter.ini +++ b/config/alter.ini @@ -457,6 +457,8 @@ FREEZEMONTH_CASHTYPE=1 ;Enter tagid for distinguish users in per city actions witch it's colors, comma separated ;ALLOWED_COLORS="1,2,3" ;Is userside API requests enabled? -USERSIDE_API=1 +USERSIDE_API=0 ;Template currency, used for bills printing ;TEMPLATE_CURRENCY=UAH +VLANMACHISTORY=0 +VLAN_ONLINE_IN_PROFILE=0 diff --git a/config/optsaltcfg b/config/optsaltcfg index c9ad66c3e..88564b06a 100755 --- a/config/optsaltcfg +++ b/config/optsaltcfg @@ -262,6 +262,8 @@ FRIENDSHIP_ENABLED=TRIGGER|Is friendship subsystem enabled FRIENDSHIP_PERCENT=VARCHAR|Percent accured on the balance by friendly user payments FRIENDSHIP_CASHTYPEID=VARCHAR|Payment type ID for friendship payments USERSIDE_API=TRIGGER|UserSide API requests enabled +VLANMACHISTORY=TRIGGER|VLAN and MAC history enabled +VLAN_ONLINE_IN_PROFILE=TRIGGER|Detect online in profile enabled CHAPTEREND_BEH=true diff --git a/config/permgroups.ini b/config/permgroups.ini index 1a029840b..0d51e321c 100755 --- a/config/permgroups.ini +++ b/config/permgroups.ini @@ -1,6 +1,6 @@ USERREG=TASKBAR,USERSEARCH,TAGS,USERPROFILE,USEREDIT,USERREG,CASH,ANNIHILATION,ALWAYSONLINE,BINDER,CONTRACT,CORPORATE,CREDIT,CREDITEXPIRE,DOWN,LIFESTORY,MAC,EMAIL,MOBILE,NOTES,ONLINE,PASSIVE,PASSWORD,PHONE,PLARPING,PLCHECKER,PLDHCP,PLDOCS,PLFEES,PLIPCHANGE,PLPINGER,RADIUS,PLSENDMESSAGE,PLDETAILS,PLVCASH,PRINTCHECK,REALNAME,RESET,USERSPEED,TARIFFEDIT,TRAFFSTATS,PDATA,OPTION82,CORPS,CONDET,CUDISCOUNTS GEO=BUILDS,CITY,STREETS,VOLS,CUSTMAPEDIT,CUSTMAP,USERSMAP,SWITCHMAP -SYSTEM=TARIFFSPEED,VSERVICES,SWITCHES,SWITCHESEDIT,SWITCHM,TARIFFS,STGNEWADMIN,ARPDIAG,BACKUP,CASHTYPES,CFTYPES,DHCP,STGDOCSIS,DSHAPER,DSTAT,EVENTVIEW,LOUSYTARIFFS,MASSSEND,MULTINET,NAS,PERMISSIONS,REPORTMASTERADM,RULES,SQLCONSOLE,SYSCONF,MTSIGMON,MASSRESET,UHW,EXPRESSCARD,EXPRESSCARDREG,DOCSIS,ZBSMAN,SWITCHPOLL,MTEXTCONF,FREERADIUS,WATCHDOG,ZBSANN,SCINFO,PLVLANGEN,ADDVLAN,SWITCHLOGIN +SYSTEM=TARIFFSPEED,VSERVICES,SWITCHES,SWITCHESEDIT,SWITCHM,TARIFFS,STGNEWADMIN,ARPDIAG,BACKUP,CASHTYPES,CFTYPES,DHCP,STGDOCSIS,DSHAPER,DSTAT,EVENTVIEW,LOUSYTARIFFS,MASSSEND,MULTINET,NAS,PERMISSIONS,REPORTMASTERADM,RULES,SQLCONSOLE,SYSCONF,MTSIGMON,MASSRESET,UHW,EXPRESSCARD,EXPRESSCARDREG,DOCSIS,ZBSMAN,SWITCHPOLL,MTEXTCONF,FREERADIUS,WATCHDOG,ZBSANN,SCINFO,PLVLANGEN,ADDVLAN,VLANMACHISTORY,SWITCHLOGIN FINANCE=BANKSTA,CARDS,AGENTS,EMPLOYEE,OPENPAYZ,PAYEXPORT,PAYFIND,TASKMAN,TASKMANDATE,TASKMANDONE,TASKMANSEARCH,TASKMANTRACK,TICKETING,SIGREQ,CAPAB,SALARY,SALARYTASKS,SALARYTASKSVIEW,SALARYTSHEETS,WAREHOUSE,WAREHOUSEIN,WAREHOUSEOUT,WAREHOUSEDIR,FRIENDSHIP REPORTS=GENOCIDE,NDS,CARDREPORT,NEWMAC,REPORTCREXP,REPORTDSTAT,REPORTFINANCE,REPORTSIGNUP,STREETEPORT,SYSLOAD,REPORTTARIFFS,REPORTTRAFFIC,REPORTMASTER,SPEEDCONTROL,PLFUNDS,ASKOZIA,ASTERISK,REPORTAUTOFREEZE,REPORTNOSWPORT,SCREPORT,REPORTCOMPLEX CATV=CATV,CATVCASH,CATVDECODEREDIT,CATVPROFILE,CATVSTATS,CATVTARIFFEDIT,CATVACT,CATVUSEREDIT,CATVBS,UKV,UKVREG,UKVTAR,UKVBST,UKVREP,UKVCASH,UKVDEL,UKVSEAL \ No newline at end of file diff --git a/config/snmptemplates/Cisco-C3550-12T b/config/snmptemplates/Cisco-C3550-12T new file mode 100644 index 000000000..feb283d2f --- /dev/null +++ b/config/snmptemplates/Cisco-C3550-12T @@ -0,0 +1,41 @@ +[define] +DEVICE="Cisco Catalyst 3550" +FDB=true +ONLINEVLAN=".1.3.6.1.4.1.9.9.380.1.4.1.1.3" + +[PORTSTATE] +NAME="Port states" +OIDS=".1.3.6.1.2.1.2.2.1.8.1,.1.3.6.1.2.1.2.2.1.8.2,.1.3.6.1.2.1.2.2.1.8.3,.1.3.6.1.2.1.2.2.1.8.4,.1.3.6.1.2.1.2.2.1.8.5,.1.3.6.1.2.1.2.2.1.8.6,.1.3.6.1.2.1.2.2.1.8.7,.1.3.6.1.2.1.2.2.1.8.8,.1.3.6.1.2.1.2.2.1.8.9,.1.3.6.1.2.1.2.2.1.8.10,.1.3.6.1.2.1.2.2.1.8.11,.1.3.6.1.2.1.2.2.1.8.12" +PARSER=sp_parse_zyportstates + +[PORTTX] +NAME="Bytes transmitted" +OIDS=".1.3.6.1.2.1.2.2.1.16.1,.1.3.6.1.2.1.2.2.1.16.2,.1.3.6.1.2.1.2.2.1.16.3,.1.3.6.1.2.1.2.2.1.16.4,.1.3.6.1.2.1.2.2.1.16.5,.1.3.6.1.2.1.2.2.1.16.6,.1.3.6.1.2.1.2.2.1.16.7,.1.3.6.1.2.1.2.2.1.16.8,.1.3.6.1.2.1.2.2.1.16.9,.1.3.6.1.2.1.2.2.1.16.10,.1.3.6.1.2.1.2.2.1.16.11,.1.3.6.1.2.1.2.2.1.16.12" +PARSER=sp_parse_zyportbytes + + +[PORTRX] +NAME="Bytes received" +OIDS=".1.3.6.1.2.1.2.2.1.10.1,.1.3.6.1.2.1.2.2.1.10.2,.1.3.6.1.2.1.2.2.1.10.3,.1.3.6.1.2.1.2.2.1.10.4,.1.3.6.1.2.1.2.2.1.10.5,.1.3.6.1.2.1.2.2.1.10.6,.1.3.6.1.2.1.2.2.1.10.7,.1.3.6.1.2.1.2.2.1.10.8,.1.3.6.1.2.1.2.2.1.10.9,.1.3.6.1.2.1.2.2.1.10.10,.1.3.6.1.2.1.2.2.1.10.11,.1.3.6.1.2.1.2.2.1.10.12" +PARSER=sp_parse_zyportbytes + +[PORTERRTX] +NAME="Transmit errors" +OIDS=".1.3.6.1.2.1.2.2.1.20.1,.1.3.6.1.2.1.2.2.1.20.2,.1.3.6.1.2.1.2.2.1.20.3,.1.3.6.1.2.1.2.2.1.20.4,.1.3.6.1.2.1.2.2.1.20.5,.1.3.6.1.2.1.2.2.1.20.6,.1.3.6.1.2.1.2.2.1.20.7,.1.3.6.1.2.1.2.2.1.20.8,.1.3.6.1.2.1.2.2.1.20.9,.1.3.6.1.2.1.2.2.1.20.10,.1.3.6.1.2.1.2.2.1.20.11,.1.3.6.1.2.1.2.2.1.20.12" +PARSER=sp_parse_zyportbytes + + +[UPTIME] +NAME="Uptime" +OIDS=".1.3.6.1.2.1.1.3.0" +PARSER=sp_parse_raw + +[CPU] +NAME="CPU usage" +OIDS="1.3.6.1.4.1.9.9.109.1.1.1.1.5.1" +PARSER=sp_parse_ciscocpu + +[USEDMEM] +NAME="Memory usage" +OIDS=".1.3.6.1.4.1.9.9.48.1.1.1.5.1" +PARSER=sp_parse_ciscomemory diff --git a/docs/test_dump.sql b/docs/test_dump.sql index 3bcb26aa4..029783733 100644 --- a/docs/test_dump.sql +++ b/docs/test_dump.sql @@ -1601,4 +1601,13 @@ CREATE TABLE IF NOT EXISTS `taskmantrack` ( `admin` varchar(255) NOT NULL, PRIMARY KEY (`id`), KEY `taskid` (`taskid`,`admin`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +CREATE TABLE IF NOT EXISTS `vlan_mac_history` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `login` varchar(45) DEFAULT NULL, + `vlan` int(4) DEFAULT NULL, + `mac` varchar(45) DEFAULT NULL, + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; \ No newline at end of file diff --git a/languages/russian/vlan.php b/languages/russian/vlan.php index 18fc5dced..07250c609 100644 --- a/languages/russian/vlan.php +++ b/languages/russian/vlan.php @@ -31,8 +31,13 @@ $lang['def']['Connection method'] = 'Метод соединения'; $lang['def']['enable propmpt for cisco,bdcom,etc (should be same as password)'] = 'Строка enable для свичей типо Cisco, BDCOM (должна быть такой же как пароль)'; $lang['def']['Vlan pool'] = 'Пул vlan-ов'; -$lang['def'][''] = ''; -$lang['def'][''] = ''; +$lang['def']['View users MAC and VLAN history'] = 'Смотреть историю смены MAC-ов и VLAN-ов пользователя'; +$lang['def']['Right to view users MAC and VLAN history'] = 'Право просматривать историю смены MAC-ов и VLAN-ов пользователя'; +$lang['def']['Users MAC and VLAN history'] = 'История смены пользователем MAC-ов и VLAN-ов'; +$lang['def']['VLAN and MAC history enabled'] = ' История VLAN-ов и MAC-ов включена'; +$lang['def']['History'] = 'История'; +$lang['def']['Detect online'] = 'Определить онлайн'; +$lang['def']['Detect online in profile enabled'] = 'Определение онлайна пользователя в профиле включена'; $lang['def'][''] = ''; $lang['def'][''] = ''; diff --git a/languages/ukrainian/vlan.php b/languages/ukrainian/vlan.php index 06f73ad9a..03408ed32 100644 --- a/languages/ukrainian/vlan.php +++ b/languages/ukrainian/vlan.php @@ -31,4 +31,11 @@ $lang['def']['Connection method'] = 'Спосіб з\'єднання'; $lang['def']['enable propmpt for cisco,bdcom,etc (should be same as password)'] = 'Рядок enable для свічів Cisco, BDCOM, etc (повинен бути таким самим як пароль)'; $lang['def']['Vlan pool'] = 'Пул vlan-ів'; +$lang['def']['View users MAC and VLAN history'] = 'Дивитися історію зміни MAC-ів та VLAN-ів користувача'; +$lang['def']['Right to view users MAC and VLAN history'] = 'Право дивитися історію зміни MAC-ів та VLAN-ів користувача'; +$lang['def']['Users MAC and VLAN history'] = 'Історія зміни користувачем MAC-ів та VLAN-ів'; +$lang['def']['VLAN and MAC history enabled'] = 'Історія зміни користувачем MAC-ів та VLAN-ів ввімкнена'; +$lang['def']['History'] = 'Історія'; +$lang['def']['Detect online'] = 'Визначити онлайн'; +$lang['def']['Detect online in profile enabled'] = 'Визначення користувацького онлайну у профілі ввімкнено'; ?> diff --git a/modules/general/pl_vlangen/index.php b/modules/general/pl_vlangen/index.php index 2c7a6b5ed..b26b39bb7 100644 --- a/modules/general/pl_vlangen/index.php +++ b/modules/general/pl_vlangen/index.php @@ -1,11 +1,14 @@ GetVlan($login); + $form = wf_Link("?module=vlan_mac_history&username=" . $login . "&vlan=" . $cur_vlan, __('Users MAC and VLAN history'), false, 'ubButton'); + show_window(__('Actions'), $form); if (isset($_POST['DeleteVlanHost'])) { $VlanGen->DeleteVlanHost($login); diff --git a/modules/general/pl_vlangen/module.php b/modules/general/pl_vlangen/module.php index d8ef81b6b..af62ee87c 100644 --- a/modules/general/pl_vlangen/module.php +++ b/modules/general/pl_vlangen/module.php @@ -1,3 +1,3 @@ registerModule($module, 'main', __('Change VLAN profile plugin'), 'L1ght13aby', array('PLVLANGEN' => __('right to change user vlan'))); -?> + diff --git a/modules/general/remoteapi/index.php b/modules/general/remoteapi/index.php index 603a3891f..097dfbabc 100755 --- a/modules/general/remoteapi/index.php +++ b/modules/general/remoteapi/index.php @@ -585,6 +585,16 @@ } } + if($_GET['action'] == 'writevlanmachistory') { + if($alterconf['VLANMACHISTORY']) { + $history = new VlanMacHistory; + $history->WriteVlanMacData(); + die('OK:WRITING NEW MACS'); + } else { + die('ERROR:NO_VLAN_MAC_HISTORY ENABLED'); + } + } + //// //// End of actions //// diff --git a/modules/general/sqlconsole/index.php b/modules/general/sqlconsole/index.php index 5595aeb33..4aa9201f9 100755 --- a/modules/general/sqlconsole/index.php +++ b/modules/general/sqlconsole/index.php @@ -95,7 +95,10 @@ function web_PhpConsoleShowTemplates() { $sqlinputs.=wf_Link("?module=sqlconsole&devconsole=true", 'PHP Console', false, 'ubButton'); if (cfr('ROOT')) { $sqlinputs.=wf_Link("?module=migration", __('Migration'), false, 'ubButton'); -$sqlinputs.=wf_Link("?module=migration2", __('Migration').' 2', true, 'ubButton'); +$sqlinputs.=wf_Link("?module=migration2", __('Migration').' 2', false, 'ubButton'); +if (cfr('MIKMIGR')) { + $sqlinputs.=wf_Link("?module=mikbill_migration", __('Migration') .' mikbill', true, 'ubButton'); +} } if (wf_CheckPost(array('sqlq'))) { if ($alterconf['DEVCON_SQL_KEEP']) { @@ -116,7 +119,10 @@ function web_PhpConsoleShowTemplates() { $phpinputs.=wf_Link("?module=sqlconsole&devconsole=true", 'PHP Console', false, 'ubButton'); if (cfr('ROOT')) { $phpinputs.=wf_Link("?module=migration", 'Migration', false, 'ubButton'); -$phpinputs.=wf_Link("?module=migration2", __('Migration').' 2', true, 'ubButton'); +$phpinputs.=wf_Link("?module=migration2", __('Migration').' 2', false, 'ubButton'); +} +if (cfr('MIKMIGR')) { + $sqlinputs.=wf_Link("?module=mikbill_migration", __('Migration') .' mikbill', true, 'ubButton'); } //is template run or clear area? if (wf_CheckGet(array('runtpl'))) { diff --git a/modules/general/vlan_mac_history/index.php b/modules/general/vlan_mac_history/index.php new file mode 100644 index 000000000..3714732ba --- /dev/null +++ b/modules/general/vlan_mac_history/index.php @@ -0,0 +1,16 @@ +getAlter(); +if ($altCfg['VLANMACHISTORY']) { + if (cfr('VLANMACHISTORY')) { + $login = $_GET['username']; + $history = new VlanMacHistory; + $history->RenderHistory($login); + show_window('', web_UserControls($login)); + } else { + show_error(__('You cant control this module')); + } +} else { + show_error(__('This module is disabled')); +} \ No newline at end of file diff --git a/modules/general/vlan_mac_history/module.php b/modules/general/vlan_mac_history/module.php new file mode 100644 index 000000000..9a16f87bd --- /dev/null +++ b/modules/general/vlan_mac_history/module.php @@ -0,0 +1,2 @@ +registerModule($module, 'main', __('View users MAC and VLAN history'), 'L1ght13aby', array('VLANMACHISTORY' => __('Right to view users MAC and VLAN history'))); diff --git a/openpayz/backend/oplata/config/oplata.ini b/openpayz/backend/oplata/config/oplata.ini index 065e5f2d6..db2a55fa1 100755 --- a/openpayz/backend/oplata/config/oplata.ini +++ b/openpayz/backend/oplata/config/oplata.ini @@ -1,21 +1,28 @@ -; URL для отправки формы платежа -OPLATA_URL="https://api.oplata.com/api/checkout/redirect/" - ; URL фронтенда OpenPayz обрабатывающего транзакции -FRONTEND_URL="jesus.kvant.if.ua/dev/ubilling/openpayz/frontend/oplata/" -RESPONSE_URL="jesus.kvant.if.ua/dev/ubilling/openpayz/frontend/oplata/?raw=true" +FRONTEND_URL="http://ourisp.ua/openpayz/frontend/oplata/" +; URL для перенаправления пользователя после совершения платежа +RESPONSE_URL="http://ubilling.net.ua" ; ID мерчанта Oplata.com MERCHANT_ID = 1000 - - ;Валюта платежа, может принимать значения EUR, USD, GBP, RUB, UAH OPLATA_CURRENCY=UAH - +;Рекомендуемые суммы платежей - разделитель запятая +AVAIL_PRICES=5,50,70,100 +;Человеко-читабельное название валюты +MERCHANT_CURRENCY="грн" +;Наименование организации мерчанка MERCHANT_NAME = "ISP Рога&Копыта" +;URL сайта мерчанта MERCHANT_URL = "http://ubilling.net.ua" +;Сервис продаваемый мерчантом MERCHANT_SERVICE = "Интернет" +;URL к логотипу мерчанта MERCHANT_LOGO = "http://ubilling.net.ua/logo.png" +;Имя шаблона бекенда TEMPLATE = "template.html" -LOCALE_SUBMIT="Перейти к оплате" \ No newline at end of file +;Немного локализации +LOCALE_SUBMIT="Перейти к оплате" +LOCALE_AMOUNT="Выберите сумму платежа" +LOCALE_SUM="Сумма будушего платежа" \ No newline at end of file diff --git a/openpayz/backend/oplata/index.php b/openpayz/backend/oplata/index.php index d7f0078f6..13d995ecb 100755 --- a/openpayz/backend/oplata/index.php +++ b/openpayz/backend/oplata/index.php @@ -19,34 +19,57 @@ $merchant_url = $conf_oplata['MERCHANT_URL']; $merchant_service = $conf_oplata['MERCHANT_SERVICE']; $merchant_logo = $conf_oplata['MERCHANT_LOGO']; -$merchant_currency = $conf_oplata['CURRENCY_NAME']; -$oplata_currency = $conf_oplata['OPLATA_CURRENCY']; $template_file = $conf_oplata['TEMPLATE']; -$merchant_id = $conf_oplata['MERCHANT_ID']; -$avail_prices = explode(',', $conf_oplata['AVAIL_PRICES']); -$oplata_url = $conf_oplata['OPLATA_URL']; -$frontend_url = $conf_oplata['FRONTEND_URL']; -$response_url = $conf_oplata['RESPONSE_URL']; -$localeSubmit = $conf_oplata['LOCALE_SUBMIT']; + +/** + * Renders amount select form + * + * @global array $conf_oplata + * + * @return string + */ +function renderAmountForm() { + global $conf_oplata; + $avail_prices = explode(',', $conf_oplata['AVAIL_PRICES']); + + $result = '

' . $conf_oplata['LOCALE_AMOUNT'] . '


'; + $result.= '
'; + if (!empty($avail_prices)) { + $i = 0; + foreach ($avail_prices as $io => $eachprice) { + $selected = ($i == 0) ? 'CHECKED' : ''; + $result.=''; + $result.='
'; + $i++; + } + } + + $result.='
'; + $result.=''; + $result.='
'; + + return ($result); +} /** * Renders JS payment form * - * @global string $frontend_url - * @global string $localeSubmit - * @global int $customer_id + * @param int $amount + * * @return string */ -function renderForm() { - global $frontend_url,$response_url, $localeSubmit, $customer_id,$merchant_id,$oplata_currency; - $result = ' +function renderForm($amount) { + global $conf_oplata, $customer_id; + $amount = vf($amount, 3); + $result = $conf_oplata['LOCALE_SUM'] . ': ' . $amount . ' ' . $conf_oplata['MERCHANT_CURRENCY'] . ' '; + $result.= ' - + '; return ($result); } -// строим форму -$payment_form = renderForm(); +if (isset($_POST['amount'])) { +// собираем форму для отправки ПС + $payment_form = renderForm($_POST['amount']); +} else { + //формочка выбора суммы платежа + $payment_form = renderAmountForm(); +} //показываем все что нужно в темплейт diff --git a/openpayz/frontend/oplata/.htaccess b/openpayz/frontend/oplata/.htaccess index 55987c3e8..5026236d7 100644 --- a/openpayz/frontend/oplata/.htaccess +++ b/openpayz/frontend/oplata/.htaccess @@ -1,3 +1,3 @@ -#deny from all +deny from all allow from 54.76.178.89 allow from 54.154.216.60 diff --git a/openpayz/frontend/oplata/index.php b/openpayz/frontend/oplata/index.php index 2e8eff4f7..d6f53e129 100644 --- a/openpayz/frontend/oplata/index.php +++ b/openpayz/frontend/oplata/index.php @@ -1,28 +1,29 @@ amount)) { + + if (isset($requestData->merchant_data)) { + $merchantDataRaw = $requestData->merchant_data; $merchantData = json_decode($merchantDataRaw); if (isset($merchantData[0])) { - if ($merchantData[0]->name == 'paymentid') { - $customerId = $merchantData[0]->value; + $merchantData = $merchantData[0]; + if ($merchantData->name == 'paymentid') { + $customerId = $merchantData->value; $allcustomers = op_CustomersGetAll(); if (isset($allcustomers[$customerId])) { $paysys = 'OPLATA'; - $hash = 'OPLT_' . $requestData['payment_id']; - $summ = $requestData['amount'] / 100; // деньги то в копейках + $hash = 'OPLT_' . $requestData->payment_id; + $summ = $requestData->amount / 100; // деньги то в копейках //регистрируем новую транзакцию op_TransactionAdd($hash, $summ, $customerId, $paysys, 'NOPE'); //вызываем обработчики необработанных транзакций diff --git a/userstats/config/opayz.ini b/userstats/config/opayz.ini index 38826435e..d8ad8aa8b 100644 --- a/userstats/config/opayz.ini +++ b/userstats/config/opayz.ini @@ -3,4 +3,5 @@ uniteller="VISA, MasterCard, JCB, Diners Club, ChinaUnionPay, QIWI Кошеле 24money="WebMoney, VISA, MasterCard, Приватбанк" copayco="VISA,MasterCard,Укрэксимбанк,Кредитпромбанк,НСМЭП,WebMoney" liqpay="VISA, MasterCard" -easypay="VISA, MasterCard" \ No newline at end of file +easypay="VISA, MasterCard" +oplata="VISA, MasterCard,Qiwi,Яндекс.Деньги, Webmoney, Приват24" \ No newline at end of file diff --git a/userstats/config/userstats.ini b/userstats/config/userstats.ini index 3d7edc570..86506e701 100755 --- a/userstats/config/userstats.ini +++ b/userstats/config/userstats.ini @@ -107,7 +107,7 @@ OPENPAYZ_ENABLED=0 ;OpenPayz backend URL OPENPAYZ_URL=../openpayz/backend/ ;OpenPayz systems (delimiter ",") -OPENPAYZ_PAYSYS=ipay,uniteller,24money,copayco,liqpay,easypay,portmone +OPENPAYZ_PAYSYS=oplata,ipay,uniteller,24money,copayco,liqpay,easypay,portmone ;fetch payment ID from op_customers OPENPAYZ_REALID=0