Example #1
0
function zb_NewMacShow()
{
    global $ubillingConfig;
    $billing_config = $ubillingConfig->getBilling();
    $alter_config = $ubillingConfig->getAlter();
    $allarp = array();
    $sudo = $billing_config['SUDO'];
    $cat = $billing_config['CAT'];
    $grep = $billing_config['GREP'];
    $tail = $billing_config['TAIL'];
    $alter_conf = parse_ini_file(CONFIG_PATH . 'alter.ini');
    $leases = $alter_conf['NMLEASES'];
    $leasemark = $alter_conf['NMLEASEMARK'];
    $command = $sudo . ' ' . $cat . ' ' . $leases . ' | ' . $grep . ' "' . $leasemark . '" | ' . $tail . ' -n 200';
    $rawdata = shell_exec($command);
    $allusedMacs = zb_getAllUsedMac();
    $result = '';
    //fdb cache preprocessing
    $fdbData_raw = rcms_scandir('./exports/', '*_fdb');
    if (!empty($fdbData_raw)) {
        $fdbArr = sn_SnmpParseFdbCacheArray($fdbData_raw);
        $fdbColumn = true;
    } else {
        $fdbArr = array();
        $fdbColumn = false;
    }
    $cells = wf_TableCell(__('MAC'));
    if (!empty($fdbColumn)) {
        $cells .= wf_TableCell(__('Switch'));
    }
    if ($alter_config['MACVEN_ENABLED']) {
        $cells .= wf_TableCell(__('Manufacturer'));
    }
    $rows = wf_TableRow($cells, 'row1');
    if (!empty($rawdata)) {
        $cleardata = exploderows($rawdata);
        foreach ($cleardata as $eachline) {
            preg_match('/[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}/i', $eachline, $matches);
            if (!empty($matches)) {
                $allarp[] = $matches[0];
            }
        }
        $un_arr = array_unique($allarp);
        if (!empty($un_arr)) {
            if ($alter_config['MACVEN_ENABLED']) {
                //adding ajax loader
                $result .= wf_AjaxLoader();
            }
            foreach ($un_arr as $io => $eachmac) {
                if (zb_checkMacFree($eachmac, $allusedMacs)) {
                    $cells = wf_TableCell(@$eachmac);
                    if (!empty($fdbColumn)) {
                        $cells .= wf_TableCell(sn_SnmpParseFdbExtract(@$fdbArr[$eachmac]));
                    }
                    if ($alter_config['MACVEN_ENABLED']) {
                        $containerName = 'NMRSMCNT_' . zb_rand_string(8);
                        $lookupVendorLink = wf_AjaxLink('?module=macvendor&mac=' . @$eachmac . '&raw=true', wf_img('skins/macven.gif', __('Device vendor')), $containerName, false, '');
                        $lookupVendorLink .= wf_tag('span', false, '', 'id="' . $containerName . '"') . '' . wf_tag('span', true);
                        $cells .= wf_TableCell($lookupVendorLink, '350');
                    }
                    $rows .= wf_TableRow($cells, 'row3');
                }
            }
        }
    }
    $result .= wf_TableBody($rows, '100%', '0', 'sortable');
    return $result;
}
Example #2
0
 /**
  * Returns tariff info ajax controls
  * 
  * @param string $tariffName
  * @return string
  */
 protected function getTariffInfoControls($tariffName)
 {
     $result = '';
     if (@$this->alterCfg['TARIFFINFO_IN_PROFILE']) {
         $containerId = 'TARIFFINFO_CONTAINER';
         if (!empty($tariffName)) {
             $result .= wf_AjaxLoader();
             $result .= wf_AjaxLink('?module=tariffinfo&tariff=' . $tariffName, wf_img('skins/tariffinfo.gif', __('Tariff info')), $containerId, false, '');
         }
     }
     return $result;
 }
Example #3
0
/**
 * Returns switch edit form for some existing device ID
 * 
 * @param int $switchid
 * @return string
 */
function web_SwitchEditForm($switchid)
{
    global $ubillingConfig;
    $switchid = vf($switchid, 3);
    $altCfg = $ubillingConfig->getAlter();
    $result = '';
    $allswitchmodels = zb_SwitchModelsGetAllTag();
    $switchdata = zb_SwitchGetData($switchid);
    $editinputs = wf_Selector('editmodel', $allswitchmodels, 'Model', $switchdata['modelid'], true);
    $editinputs .= wf_TextInput('editip', 'IP', $switchdata['ip'], true, 20);
    $editinputs .= wf_TextInput('editlocation', 'Location', $switchdata['location'], true, 30);
    $editinputs .= wf_TextInput('editdesc', 'Description', $switchdata['desc'], true, 30);
    $editinputs .= wf_TextInput('editsnmp', 'SNMP community', $switchdata['snmp'], true, 20);
    $editinputs .= wf_TextInput('editgeo', 'Geo location', $switchdata['geo'], true, 20);
    $editinputs .= web_SwitchUplinkSelector('editparentid', __('Uplink switch'), $switchdata['parentid']);
    $editinputs .= wf_tag('br');
    $editinputs .= wf_Submit('Save');
    $result .= wf_Form('', 'POST', $editinputs, 'glamour');
    $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true);
    $result .= wf_delimiter();
    $result .= wf_Link('?module=switches', __('Back'), false, 'ubButton');
    if (cfr('SWITCHPOLL')) {
        $fdbCacheName = 'exports/' . $switchdata['ip'] . '_fdb';
        if (file_exists($fdbCacheName)) {
            $result .= wf_Link('?module=switchpoller&fdbfor=' . $switchdata['ip'], wf_img('skins/menuicons/switchpoller.png') . ' ' . __('Current FDB cache'), false, 'ubButton');
        }
        if (!empty($switchdata['snmp'])) {
            $result .= wf_Link('?module=switchpoller&switchid=' . $switchid, wf_img('skins/snmp.png') . ' ' . __('SNMP query'), false, 'ubButton');
        }
    }
    if (!empty($switchdata['ip'])) {
        $result .= wf_AjaxLink('?module=switches&backgroundicmpping=' . $switchdata['ip'], wf_img('skins/ping_icon.png') . ' ' . __('ICMP ping'), 'icmppingcontainer', false, 'ubButton');
    }
    if (isset($altCfg['SW_WEBNAV'])) {
        if ($altCfg['SW_WEBNAV']) {
            $result .= ' ' . wf_tag('a', false, 'ubButton', 'href="http://' . $switchdata['ip'] . '" target="_BLANK"') . wf_img('skins/ymaps/globe.png') . ' ' . __('Go to the web interface') . wf_tag('a', true) . ' ';
        }
    }
    if (cfr('SWITCHEDIT')) {
        if (!ispos($switchdata['desc'], 'NP')) {
            $result .= wf_JSAlertStyled('?module=switchreplace&switchid=' . $switchid, wf_img('skins/duplicate_icon.gif') . ' ' . __('Replacement'), __('Are you serious'), 'ubButton') . ' ';
        }
    }
    if (cfr('SWITCHESEDIT')) {
        $result .= wf_JSAlertStyled('?module=switches&switchdelete=' . $switchid, web_delete_icon() . ' ' . __('Delete'), 'Removing this may lead to irreparable results', 'ubButton');
    }
    if (!empty($switchdata['ip'])) {
        $result .= wf_AjaxLoader();
        $result .= wf_AjaxContainer('icmppingcontainer');
    }
    return $result;
}
Example #4
0
     if ($_GET['ajax'] == 'snmp_edit') {
         $swLogin->SwLoginEditSnmpForm($_GET['edit']);
     }
     if ($_GET['ajax'] == 'connect_edit') {
         $swLogin->SwLoginEditConnForm($_GET['edit']);
     }
 }
 if (!isset($_GET['edit'])) {
     $megaForm = wf_AjaxLoader();
     $megaForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&ajax=snmp', 'SNMP', 'megaContainer1', false, 'ubButton');
     $megaForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&ajax=connect', 'Connect', 'megaContainer1', false, 'ubButton');
     $megaForm .= wf_tag('div', false, '', 'id="megaContainer1"') . wf_tag('div', true);
     show_window(__("Switches login data"), $megaForm);
     $swLogin->ShowSwAllLogin();
 } else {
     $megaEditForm = wf_AjaxLoader();
     $megaEditForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&edit=' . $_GET['edit'] . '&ajax=snmp_edit', 'SNMP', 'megaContainer1', false, 'ubButton');
     $megaEditForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&edit=' . $_GET['edit'] . '&ajax=connect_edit', 'Connect', 'megaContainer1', false, 'ubButton');
     $megaEditForm .= wf_tag('div', false, '', 'id="megaContainer1"') . wf_tag('div', true);
     show_warning(__("Are you sure that you want to change switch login data") . "?");
     show_window(__("Switches login data"), $megaEditForm);
     $back = wf_Link(SwitchLogin::MODULE_URL, __('Back'), false, 'ubButton');
     show_window('', $back);
 }
 if (isset($_POST['add'])) {
     $params = array('swmodel', 'SwMethod');
     if (wf_CheckPost($params)) {
         $model = $_POST['swmodel'];
         $snmpTemplate = $_POST['snmptemplate'];
         $login = $_POST['SwLogin'];
         $pass = $_POST['SwPass'];
Example #5
0
/**
 * Draw update container and refresh into in some code
 * 
 * @return void
 */
function im_RefreshContainer($timeout)
{
    //  setInterval(function(){ goajax(\'?module=ubim&timecheckunread=true\',\'refreshcontainer\'); },'.$timeout.');
    $timeout = $timeout * 1000;
    $jstimer = wf_AjaxLoader() . "\n        <script type=\"text/javascript\">\n          \n    \$(function() {\n    var alertedMessagesCount = 0;\n\n \$(window).everyTime(" . $timeout . ", function() {\n  \$.ajax({\n   url: '?module=ubim&timecheckunread=true',\n   dataType: 'json',success: function(data) {\n    if(data.messagesCount > 0) {\n     if(alertedMessagesCount != data.messagesCount) {\n      // You have new message\n     // if(!alert.visible) {\n     // alert(data.messagesCount+' '+'" . __('new message received') . "');\n     // }\n     \$(document).ready(function() {\n        var position = 'top-right'; \n        var settings = {\n                'speed' : 'fast',\n                'duplicates' : true,\n                'autoclose' : 5000 \n        };\n\t \$.sticky(data.messagesCount+' '+'" . __('new message received') . "');\n     });\n      alertedMessagesCount = data.messagesCount;\n     }\n    }\n   }\n  });\n });\n});\n\n        </script>\n        ";
    $container = wf_tag('span', false, '', 'id="refreshcontainer"');
    $container .= wf_tag('span', true);
    $container .= $jstimer;
    show_window('', $container);
}
Example #6
0
 function docsis_ModemProfileShow($modemid)
 {
     $modemid = vf($modemid, 3);
     $data = docsis_ModemGetData($modemid);
     $netdata = array();
     $netdata_q = "SELECT * from `nethosts` where `ip`='" . $data['ip'] . "'";
     $netdata = simple_queryall($netdata_q);
     $netdata = print_r($netdata, true);
     $netdata = nl2br($netdata);
     $alluserips = zb_UserGetAllIPs();
     $alluserips = array_flip($alluserips);
     $result = wf_Link("?module=docsis", __('Back'), false, 'ubButton');
     $ajaxcontainer = wf_AjaxLoader() . wf_AjaxLink("?module=docsis&ajaxsnmp=" . $modemid, __('Renew modem data'), 'ajaxdata', true, 'ubButton') . wf_tag('div', false, '', 'id="ajaxdata"') . wf_tag('div', true);
     $result .= wf_modal(__('Modem diagnostics'), __('Modem diagnostics'), $ajaxcontainer, 'ubButton', '500', '400');
     $result .= wf_modal(__('Networking data'), __('Networking data'), $netdata, 'ubButton', '500', '400');
     $result .= wf_delimiter();
     if (!empty($data)) {
         $cells = wf_TableCell(__('ID'));
         $cells .= wf_TableCell($data['id'] . ' ' . wf_JSAlert("?module=docsis&deletemodem=" . $modemid, web_delete_icon(), __('Removing this may lead to irreparable results')));
         $rows = wf_TableRow($cells, 'row3');
         $cells = wf_TableCell(__('IP'));
         $cells .= wf_TableCell($data['ip']);
         $rows .= wf_TableRow($cells, 'row3');
         $cells = wf_TableCell(__('MAC Lan'));
         $cells .= wf_TableCell($data['maclan']);
         $rows .= wf_TableRow($cells, 'row3');
         $cells = wf_TableCell(__('Date'));
         $cells .= wf_TableCell($data['date']);
         $rows .= wf_TableRow($cells, 'row3');
         if (isset($alluserips[$data['userbind']])) {
             $bindedLogin = $alluserips[$data['userbind']];
             $profileLink = ' ' . wf_Link('?module=userprofile&username='******' ' . $bindedLogin, false, '');
         } else {
             $profileLink = '';
         }
         $cells = wf_TableCell(__('Linked user'));
         $cells .= wf_TableCell($data['userbind'] . $profileLink);
         $rows .= wf_TableRow($cells, 'row3');
         $cells = wf_TableCell(__('Notes'));
         $cells .= wf_TableCell($data['note']);
         $rows .= wf_TableRow($cells, 'row3');
         $result .= wf_TableBody($rows, '100%', '0', '');
         $inputs = wf_TextInput('edituserbind', __('Linked user'), $data['userbind'], true, '40');
         $inputs .= wf_TextInput('editnote', __('Notes'), $data['note'], true, '40');
         $inputs .= wf_Submit(__('Save'));
         $form = wf_Form("", 'POST', $inputs, 'glamour');
         $result .= $form;
         show_window(__('Modem profile'), $result);
     } else {
         show_window(__('Error'), __('Strange exeption'));
     }
 }
Example #7
0
 /**
  * Renders task creation form
  * 
  * @return string
  */
 public function renderCreateForm($login)
 {
     $result = '';
     $result .= wf_AjaxLoader();
     $inputs = wf_HiddenInput('newschedlogin', $login);
     $inputs .= wf_DatePickerPreset('newscheddate', curdate()) . ' ' . __('Target date') . wf_tag('br');
     $inputs .= wf_AjaxSelectorAC('ajparamcontainer', $this->actions, __('Task'), '', true);
     $inputs .= wf_AjaxContainer('ajparamcontainer');
     $result .= wf_Form('', 'POST', $inputs, 'glamour');
     return $result;
 }
Example #8
0
 /**
  * Renders available and enabled alerts into  DarkVoid notification area
  * 
  * @return void
  */
 protected function updateAlerts()
 {
     //new tickets alert
     if ($this->altCfg['TB_NEWTICKETNOTIFY']) {
         $newticketcount = zb_TicketsGetAllNewCount();
         if ($newticketcount != 0) {
             $this->alerts .= wf_Link('?module=ticketing', wf_img('skins/ticketnotify.gif', $newticketcount . ' ' . __('support tickets expected processing')), false);
         }
     }
     //new signups notification
     if ($this->altCfg['SIGREQ_ENABLED']) {
         $signups = new SignupRequests();
         $newreqcount = $signups->getAllNewCount();
         if ($newreqcount != 0) {
             $this->alerts .= wf_Link('?module=sigreq', wf_img('skins/sigreqnotify.gif', $newreqcount . ' ' . __('signup requests expected processing')), false);
         }
     }
     //check for unread messages in instant messanger
     if ($this->altCfg['TB_UBIM']) {
         if (cfr('UBIM')) {
             $unreadMessageCount = im_CheckForUnreadMessages();
             if ($unreadMessageCount) {
                 //we have new messages
                 $unreadIMNotify = __('You received') . ' ' . $unreadMessageCount . ' ' . __('new messages');
                 $urlIM = $unreadIMNotify . wf_delimiter() . wf_Link("?module=ubim&checknew=true", __('Click here to go to the instant messaging service.'), false, 'ubButton');
                 $this->alerts .= wf_Link("?module=ubim&checknew=true", wf_img("skins/ubim_blink.gif", $unreadMessageCount . ' ' . __('new message received')), false, '');
                 //$this->alerts.=wf_modalOpened(__('New messages received'), $urlIM, '450', '200');
             }
         }
     }
     //check sms sending queue
     if ($this->altCfg['WATCHDOG_ENABLED']) {
         $smsQueueCount = rcms_scandir(DATA_PATH . 'tsms/');
         $smsQueueCount = sizeof($smsQueueCount);
         if ($smsQueueCount > 0) {
             $this->alerts .= wf_Link("?module=tsmsqueue", wf_img("skins/sms.png", $smsQueueCount . ' ' . __('SMS in queue')), false, '');
         }
     }
     if ($this->altCfg['TB_TASKMANNOTIFY']) {
         //only "for me" tasks notification
         if ($this->altCfg['TB_TASKMANNOTIFY'] == 1) {
             $undoneTasksCount = ts_GetUndoneCountersMy();
             if ($undoneTasksCount > 0) {
                 $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ' ' . __('for me');
                 $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, '');
             }
         }
         //total undone tasks count notification
         if ($this->altCfg['TB_TASKMANNOTIFY'] == 2) {
             $undoneTasksCount = ts_GetUndoneCountersAll();
             if ($undoneTasksCount > 0) {
                 $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ' ' . __('for all');
                 $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, '');
             }
         }
         //total+my undone tasks count notification
         if ($this->altCfg['TB_TASKMANNOTIFY'] == 3) {
             $undoneTasksCount = ts_GetUndoneCountersAll();
             if ($undoneTasksCount > 0) {
                 $undoneTasksCountMy = ts_GetUndoneCountersMy();
                 $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ': ' . __('for all') . ' ' . ($undoneTasksCount - $undoneTasksCountMy) . ' / ' . __('for me') . ' ' . $undoneTasksCountMy;
                 $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, '');
             }
         }
     }
     //switchmon at notify area
     if ($this->altCfg['TB_SWITCHMON']) {
         $dead_raw = zb_StorageGet('SWDEAD');
         $last_pingtime = zb_StorageGet('SWPINGTIME');
         $deathTime = zb_SwitchesGetAllDeathTime();
         $deadarr = array();
         $content = '';
         if ($this->altCfg['SWYMAP_ENABLED']) {
             $content = wf_Link('?module=switchmap', wf_img('skins/swmapsmall.png', __('Switches map')), false);
         }
         $content .= wf_AjaxLoader() . wf_AjaxLink("?module=switches&forcereping=true&ajaxping=true", wf_img('skins/refresh.gif', __('Force ping')), 'switchping', true, '');
         if ($dead_raw) {
             $deadarr = unserialize($dead_raw);
             if (!empty($deadarr)) {
                 //there is some dead switches
                 $deadcount = sizeof($deadarr);
                 if ($this->altCfg['SWYMAP_ENABLED']) {
                     //getting geodata
                     $switchesGeo = zb_SwitchesGetAllGeo();
                 }
                 //ajax container
                 $content .= wf_tag('div', false, '', 'id="switchping"');
                 foreach ($deadarr as $ip => $switch) {
                     if ($this->altCfg['SWYMAP_ENABLED']) {
                         if (isset($switchesGeo[$ip])) {
                             if (!empty($switchesGeo[$ip])) {
                                 $devicefind = wf_Link('?module=switchmap&finddevice=' . $switchesGeo[$ip], wf_img('skins/icon_search_small.gif', __('Find on map'))) . ' ';
                             } else {
                                 $devicefind = '';
                             }
                         } else {
                             $devicefind = '';
                         }
                     } else {
                         $devicefind = '';
                     }
                     //check morgue records for death time
                     if (isset($deathTime[$ip])) {
                         $deathClock = wf_img('skins/clock.png', __('Switch dead since') . ' ' . $deathTime[$ip]) . ' ';
                     } else {
                         $deathClock = '';
                     }
                     //switch location link
                     $switchLocator = wf_Link('?module=switches&gotoswitchbyip=' . $ip, web_edit_icon(__('Go to switch')));
                     //add switch as dead
                     $content .= $devicefind . ' ' . $switchLocator . ' ' . $deathClock . $ip . ' - ' . $switch . '<br>';
                 }
                 //ajax container end
                 $content .= wf_delimiter() . __('Cache state at time') . ': ' . date("H:i:s", $last_pingtime) . wf_tag('div', true);
                 $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('Dead switches') . ': ' . $deadcount, __('Dead switches'), $content, '', '500', '400') . wf_tag('div', true);
             } else {
                 $content .= wf_tag('div', false, '', 'id="switchping"') . __('Switches are okay, everything is fine - I guarantee') . wf_delimiter() . __('Cache state at time') . ': ' . date("H:i:s", $last_pingtime) . wf_tag('div', true);
                 $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('All switches alive'), __('All switches alive'), $content, '', '500', '400') . wf_tag('div', true);
             }
         } else {
             $content .= wf_tag('div', false, '', 'id="switchping"') . __('Switches are okay, everything is fine - I guarantee') . wf_delimiter() . __('Cache state at time') . ': ' . @date("H:i:s", $last_pingtime) . wf_tag('div', true);
             $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('All switches alive'), __('All switches alive'), $content, '', '500', '400') . wf_tag('div', true);
         }
     }
     file_put_contents(self::CACHE_PATH . self::CACHE_PREFIX . $this->myLogin, $this->alerts);
 }
Example #9
0
 /**
  * Returns outcoming operation creation form
  * 
  * @param int $storageid
  * @param int $itemtypeid
  * 
  * @return string
  */
 public function outcomingCreateForm($storageid, $itemtypeid)
 {
     $result = '';
     $storageid = vf($storageid, 3);
     $itemtypeid = vf($itemtypeid, 3);
     $tmpDests = array();
     if (isset($this->allStorages[$storageid]) and isset($this->allItemTypes[$itemtypeid])) {
         $itemData = $this->allItemTypes[$itemtypeid];
         $itemUnit = $this->unitTypes[$itemData['unit']];
         $storageRemains = $this->remainsOnStorage($storageid);
         $allRemains = $this->remainsAll();
         if (isset($storageRemains[$itemtypeid])) {
             $itemRemainsStorage = $storageRemains[$itemtypeid];
         } else {
             $itemRemainsStorage = 0;
         }
         if (isset($allRemains[$itemtypeid])) {
             $itemRemainsTotal = $allRemains[$itemtypeid];
         } else {
             $itemRemainsTotal = 0;
         }
         $isReserved = $this->reserveGet($storageid, $itemtypeid);
         foreach ($this->outDests as $destMark => $destName) {
             $tmpDests[self::URL_ME . '&' . self::URL_OUT . '&' . self::URL_AJODSELECTOR . $destMark] = $destName;
         }
         //form construct
         $inputs = wf_AjaxLoader();
         $inputs .= wf_HiddenInput('newoutdate', curdate());
         $inputs .= wf_AjaxSelectorAC('ajoutdestselcontainer', $tmpDests, __('Destination'), '', false);
         $inputs .= wf_AjaxContainer('ajoutdestselcontainer', '', $this->outcomindAjaxDestSelector('task'));
         $inputs .= wf_HiddenInput('newoutitemtypeid', $itemtypeid);
         $inputs .= wf_HiddenInput('newoutstorageid', $storageid);
         $inputs .= wf_TextInput('newoutcount', $itemUnit . ' (' . ($itemRemainsStorage - $isReserved) . ' ' . __('maximum') . ')', '', true, '4');
         $inputs .= wf_TextInput('newoutprice', __('Price') . ' (' . __('middle price') . ': ' . $this->getIncomeMiddlePrice($itemtypeid) . ')', '', true, '4');
         $inputs .= wf_TextInput('newoutnotes', __('Notes'), '', true, 25);
         $inputs .= wf_tag('br');
         $inputs .= wf_Submit(__('Create'));
         $form = wf_Form('', 'POST', $inputs, 'glamour');
         //notifications
         if ($itemRemainsTotal < $itemData['reserve']) {
             $remainsAlert = __('The balance of goods and materials in stock is less than the amount') . ' ' . $itemData['reserve'] . ' ' . $itemUnit;
         } else {
             $remainsAlert = '';
         }
         $remainsNotification = __('At storage') . ' ' . @$this->allStorages[$storageid] . ' ' . __('remains') . ' ' . $itemRemainsStorage . ' ' . $itemUnit . ' ' . $itemData['name'];
         $notifications = $this->messages->getStyledMessage($remainsNotification, 'success');
         if ($isReserved) {
             $notifications .= $this->messages->getStyledMessage(__('Reserved') . ' ' . $isReserved . ' ' . $itemUnit, 'info');
         }
         if ($remainsAlert) {
             $notifications .= $this->messages->getStyledMessage($remainsAlert, 'warning');
         }
         $notifications .= wf_CleanDiv();
         if (cfr('WAREHOUSERESERVE')) {
             $reserveLink = self::URL_ME . '&' . self::URL_RESERVE . '&itemtypeid=' . $itemtypeid . '&storageid=' . $storageid;
             $notifications .= wf_tag('div', false, '', 'style="margin: 20px 3% 0 3%;"') . wf_Link($reserveLink, wf_img('skins/whreservation.png') . ' ' . __('Reservation'), false, 'ubButton') . wf_tag('div', true);
             $notifications .= wf_CleanDiv();
         }
         $cells = wf_TableCell($form, '40%');
         $cells .= wf_TableCell($notifications, '', '', 'valign="top"');
         $rows = wf_TableRow($cells);
         $result = wf_TableBody($rows, '100%', 0, '');
         //photostorage integration
         if ($this->altCfg['PHOTOSTORAGE_ENABLED']) {
             $photostorage = new PhotoStorage(self::PHOTOSTORAGE_SCOPE, $itemtypeid);
             $result .= $photostorage->renderImagesRaw();
         }
     } else {
         $result = $this->messages->getStyledMessage(__('Strange exeption'), 'error');
     }
     return $result;
 }
Example #10
0
 $config = rcms_parse_ini_file(CONFIG_PATH . 'billing.ini');
 $alterconfig = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini');
 $parseMe = '';
 $cloneFlag = false;
 $arping_path = $alterconfig['ARPING'];
 $arping_iface = $alterconfig['ARPING_IFACE'];
 $arping_options = $alterconfig['ARPING_EXTRA_OPTIONS'];
 $sudo_path = $config['SUDO'];
 $userdata = zb_UserGetStargazerData($login);
 $user_ip = $userdata['IP'];
 $command = $sudo_path . ' ' . $arping_path . ' ' . $arping_iface . ' ' . $arping_options . ' ' . $user_ip;
 $raw_result = shell_exec($command);
 if (wf_CheckGet(array('ajax'))) {
     die($raw_result);
 }
 $ping_result = wf_AjaxLoader();
 $ping_result .= wf_AjaxLink('?module=pl_arping&username='******'&ajax=true', __('Renew'), 'ajaxarping', true, 'ubButton');
 $ping_result .= wf_tag('pre', false, '', 'id="ajaxarping"') . $raw_result . wf_tag('pre', true);
 //detecting duplicate MAC
 $rawArray = explodeRows($raw_result);
 if (!empty($rawArray)) {
     foreach ($rawArray as $io => $eachline) {
         if (ispos($eachline, 'packets transmitted')) {
             $parseMe = $eachline;
         }
     }
 }
 if (!empty($parseMe)) {
     $parseMe = explode(',', $parseMe);
     if (sizeof($parseMe) == 3) {
         $txCount = vf($parseMe[0], 3);
Example #11
0
/**
 * Returns task creation form for userprofile usage
 * DEPRECATED: use ts_TaskCreateFormUnified instead this
 * 
 * @param string $address
 * @param string $mobile
 * @param string $phone
 * @param string $login
 * @return  string
 */
function ts_TaskCreateFormProfile($address, $mobile, $phone, $login)
{
    $altercfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    $alljobtypes = ts_GetAllJobtypes();
    $allemployee = ts_GetActiveEmployee();
    //construct sms sending inputs
    if ($altercfg['SENDDOG_ENABLED']) {
        $smsInputs = wf_CheckInput('newtasksendsms', __('Send SMS'), false, false);
    } else {
        $smsInputs = '';
    }
    $sup = wf_tag('sup', false) . '*' . wf_tag('sup', true);
    $inputs = '<!--ugly hack to prevent datepicker autoopen --> <input type="text" name="shittyhack" style="width: 0; height: 0; top: -100px; position: absolute;"/>';
    $inputs .= wf_HiddenInput('createtask', 'true');
    $inputs .= wf_DatePicker('newstartdate');
    $inputs .= wf_TimePickerPreset('newstarttime', '', '', false);
    $inputs .= wf_tag('label') . __('Target date') . $sup . wf_tag('label', true);
    $inputs .= wf_delimiter();
    $inputs .= wf_TextInput('newtaskaddress', __('Address') . $sup, $address, true, '30');
    //hidden for new task login input
    $inputs .= wf_HiddenInput('newtasklogin', $login);
    $inputs .= wf_tag('br');
    $inputs .= wf_TextInput('newtaskphone', __('Phone') . $sup, $mobile . ' ' . $phone, true, '30');
    $inputs .= wf_tag('br');
    $inputs .= wf_Selector('newtaskjobtype', $alljobtypes, __('Job type'), '', true);
    $inputs .= wf_tag('br');
    $inputs .= wf_Selector('newtaskemployee', $allemployee, __('Who should do'), '', true);
    $inputs .= wf_tag('br');
    $inputs .= wf_tag('label') . __('Job note') . wf_tag('label', true) . wf_tag('br');
    $inputs .= ts_TaskTypicalNotesSelector();
    $inputs .= wf_TextArea('newjobnote', '', '', true, '35x5');
    $inputs .= $smsInputs;
    $inputs .= wf_Submit(__('Create new task'));
    if (!empty($login)) {
        $inputs .= wf_AjaxLoader();
        $inputs .= ' ' . wf_AjaxLink('?module=prevtasks&username='******'skins/icon_search_small.gif', __('Previous user tasks')), 'taskshistorycontainer', false, '');
        $inputs .= wf_tag('br');
        $inputs .= wf_tag('div', false, '', 'id="taskshistorycontainer"') . wf_tag('div', true);
    }
    $result = wf_Form("?module=taskman&gotolastid=true", 'POST', $inputs, 'glamour');
    $result .= __('All fields marked with an asterisk are mandatory');
    return $result;
}
Example #12
0
/**
 * Returns custom report sysload scripts output
 * 
 * @param string $scriptoption option from alter.ini -> SYSLOAD_CUSTOM_SCRIPTS
 * 
 * @return string
 */
function web_ReportSysloadCustomScripts($scriptoption)
{
    $result = '';
    //internal script ajax handling
    if (wf_CheckGet(array('ajxcscrun'))) {
        $runpath = base64_decode($_GET['ajxcscrun']);
        if (!empty($runpath)) {
            $script_result = wf_tag('pre') . shell_exec($runpath) . wf_tag('pre', true);
            die($script_result);
        }
    }
    $scriptdata = explode(',', $scriptoption);
    if (!empty($scriptdata)) {
        $result .= wf_AjaxLoader();
        foreach ($scriptdata as $io => $eachscript) {
            $curScript = explode(':', $eachscript);
            if (!empty($curScript)) {
                $name = $curScript[0];
                $path = $curScript[1];
                $result .= wf_AjaxLink('?module=report_sysload&ajxcscrun=' . base64_encode($path), $name, 'custommoncontainder', false, 'ubButton');
            }
        }
        $result .= wf_delimiter();
        $result .= wf_tag('span', false, '', 'id="custommoncontainder"') . wf_tag('span', true);
    }
    return $result;
}
Example #13
0
 /**
  * Returns current scope/item images list
  * 
  * @return string
  */
 public function renderImagesList()
 {
     if (empty($this->allimages)) {
         $this->loadAllImages();
     }
     $result = wf_AjaxLoader();
     if (!empty($this->allimages)) {
         foreach ($this->allimages as $io => $eachimage) {
             if ($eachimage['scope'] == $this->scope and $eachimage['item'] == $this->itemId) {
                 $imgPreview = wf_img_sized(self::STORAGE_PATH . $eachimage['filename'], __('Show'), $this->photoCfg['IMGLIST_PREV_W'], $this->photoCfg['IMGLIST_PREV_H']);
                 $imgFull = wf_img(self::STORAGE_PATH . $eachimage['filename']);
                 $imgFull .= wf_tag('br');
                 $imgFull .= __('Date') . ': ' . $eachimage['date'] . ' / ';
                 $imgFull .= __('Admin') . ': ' . $eachimage['admin'];
                 $dimensions = 'width:' . ($this->photoCfg['IMGLIST_PREV_W'] + 10) . 'px;';
                 $dimensions .= 'height:' . ($this->photoCfg['IMGLIST_PREV_H'] + 10) . 'px;';
                 $result .= wf_tag('div', false, '', 'style="float:left;  ' . $dimensions . ' padding:15px;" id="ajRefCont_' . $eachimage['id'] . '"');
                 $result .= wf_modalAuto($imgPreview, __('Image') . ' ' . $eachimage['id'], $imgFull, '');
                 $result .= $this->imageControls($eachimage['id']);
                 $result .= wf_tag('div', true);
             }
         }
     }
     $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true);
     $result .= wf_delimiter();
     $result .= $this->backUrlHelper();
     return $result;
 }
Example #14
0
 /**
  * Renders debtors notifications by address selection
  * 
  * 
  * @return void
  */
 public function reportDebtStreets()
 {
     if (wf_CheckGet(array('aj_rdabuildsel'))) {
         if (!empty($_GET['aj_rdabuildsel'])) {
             $streetId = base64_decode($_GET['aj_rdabuildsel']);
             $buildInputs = wf_HiddenInput('streetsel', $streetId);
             $buildInputs .= wf_TextInput('debtcash', __('The threshold at which the money considered user debtor'), '0', true, 4);
             $buildInputs .= wf_Submit(__('Print'));
             die($buildInputs);
         } else {
             die('');
         }
     }
     if (!wf_CheckPost(array('streetsel'))) {
         $streetData = array();
         if (!empty($this->streets)) {
             foreach ($this->streets as $streetId => $eachStreetName) {
                 $streetId = base64_encode($eachStreetName);
                 $streetData[self::URL_REPORTS_MGMT . 'reportDebtStreets' . '&aj_rdabuildsel=' . $streetId] = $eachStreetName;
             }
         }
         $inputs = wf_AjaxLoader();
         $inputs .= wf_AjaxSelectorAC('aj_buildcontainer', $streetData, __('Street'), '', false);
         $inputs .= wf_AjaxContainer('aj_buildcontainer');
         $form = wf_Form('', 'POST', $inputs, 'glamour');
         show_window(__('Current debtors for delivery by streets'), $form);
     } else {
         $searchStreet = mysql_real_escape_string($_POST['streetsel']);
         $debtCash = wf_CheckPost(array('debtcash')) ? '-' . vf($_POST['debtcash'], 3) : 0;
         $query = "SELECT * from `ukv_users` WHERE `cash`<'" . $debtCash . "' AND `street`='" . $searchStreet . "'  AND `active`='1' ORDER BY `build`";
         $allDebtors = simple_queryall($query);
         $rawTemplate = file_get_contents(CONFIG_PATH . "catv_debtors.tpl");
         $printableTemplate = '';
         if (!empty($allDebtors)) {
             foreach ($allDebtors as $io => $each) {
                 $rowtemplate = $rawTemplate;
                 $rowtemplate = str_ireplace('{REALNAME}', $each['realname'], $rowtemplate);
                 $rowtemplate = str_ireplace('{STREET}', $each['street'], $rowtemplate);
                 $rowtemplate = str_ireplace('{BUILD}', $each['build'], $rowtemplate);
                 $rowtemplate = str_ireplace('{APT}', $each['apt'], $rowtemplate);
                 $rowtemplate = str_ireplace('{DEBT}', $each['cash'], $rowtemplate);
                 $rowtemplate = str_ireplace('{CURDATE}', curdate(), $rowtemplate);
                 $rowtemplate = str_ireplace('{PAYDAY}', date("Y-m-") . '01', $rowtemplate);
                 $printableTemplate .= $rowtemplate;
             }
             $printableTemplate = wf_TableBody($printableTemplate, '100%', 0, 'sortable');
             $printableTemplate = $this->reportPrintable(__('Current debtors for delivery by streets'), $printableTemplate);
         } else {
             show_window('', $this->messages->getStyledMessage(__('Nothing found'), 'info'));
         }
     }
 }
Example #15
0
 /**
  * Renders service and IP selection dialog 
  * 
  * @return string
  */
 public function renderMainForm()
 {
     $result = '';
     $servSelector = array();
     if (!empty($this->allServices)) {
         foreach ($this->allServices as $serviceId => $serviceName) {
             $servSelector[self::URL_ME . '&ajserviceid=' . $serviceId] = $serviceName;
         }
         //getting firs service ID
         reset($this->allServices);
         $defaultService = key($this->allServices);
         $result = wf_AjaxLoader();
         $inputs = wf_AjaxSelectorAC('ajcontainer', $servSelector, __('Select User new service'), '', false);
         $inputs .= wf_tag('br') . wf_tag('br');
         $inputs .= wf_AjaxContainer('ajcontainer', '', $this->ajIpSelector($defaultService));
         $inputs .= wf_delimiter();
         $inputs .= wf_Submit(__('Save'));
         $result .= wf_Form("", 'POST', $inputs, 'floatpanels');
     } else {
         $result = $this->messages->getStyledMessage(__('No available services'), 'error');
     }
     return $result;
 }