예제 #1
0
function show_help($module = '')
{
    global $system;
    $result = '';
    if (empty($module)) {
        $module = get('module', 'index');
    }
    $lang = curlang();
    $help_dir = DATA_PATH . 'help/' . $lang . '/';
    if (LOGGED_IN) {
        if ($system->checkForRight('HELP')) {
            $admin_link = '
	<a href="' . RCMS_ROOT_PATH . '?module=help&edit=' . $module . '"><img title="' . __('Edit') . '" src="' . IMAGES_PATH . 'skins/edit_small.gif"></a>
	<a href="#" onClick="if(confirm(\'' . __('Delete') . ': \\n' . str_replace('"', '&#8243;', $module) . '?\\n\')) document.location.href = \'' . RCMS_ROOT_PATH . '?module=help&delete=' . $module . '\'">
	<img title="' . __('Delete') . '" src="' . IMAGES_PATH . 'skins/trash_small.gif">
	</a><br/>
	';
            $add_link = '<a href="' . RCMS_ROOT_PATH . '?module=help&edit=' . $module . '"><img src="' . IMAGES_PATH . 'skins/add_help.png" title="' . __('Add') . ' ' . __('Help') . '" alt="' . __('Add') . ' ' . __('Help') . '" /></a> ';
        } else {
            $admin_link = '';
            $add_link = '';
        }
        $modulename = $help_dir . make_safe_filename($module);
        if (file_exists($modulename)) {
            $help_chapter = file_get_contents($modulename);
            $result = wf_modal(wf_img(IMAGES_PATH . 'skins/help.png', __('Context help')), __('Context help'), $admin_link . $help_chapter, '', '600', '300', 'accesskey="h"');
        } else {
            $result = $add_link;
        }
    }
    return $result;
}
예제 #2
0
 /**
  * Renders control panel
  * 
  * @return string
  */
 public function renderPanel()
 {
     $result = '';
     $result .= wf_Link(self::URL_ME, wf_img('skins/log_icon_small.png') . ' ' . __('Last events'), false, 'ubButton');
     $result .= wf_Link(self::URL_ME . '&arptable=true', wf_img('skins/icon_search_small.gif') . ' ' . __('Local ARP table'), false, 'ubButton');
     return $result;
 }
예제 #3
0
 public function render()
 {
     $cells = wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('IP'));
     $cells .= wf_TableCell(__('Tariff'));
     $cells .= wf_TableCell(__('Traffic'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->data)) {
         $allrealnames = zb_UserGetAllRealnames();
         $alladdress = zb_AddressGetFulladdresslist();
         foreach ($this->data as $io => $each) {
             $loginLink = wf_Link("?module=userprofile&username="******"' . $each['traffic'] . '"');
             $actionLinks = wf_Link('?module=pl_traffdetails&username='******'login'], wf_img('skins/icon_stats.gif', __('Detailed stats')), false, '');
             $actionLinks .= wf_link('?module=dstatedit&username='******'login'], web_edit_icon(), false, '');
             $cells .= wf_TableCell($actionLinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     return $result;
 }
예제 #4
0
 function web_AvailableDBBackupsList()
 {
     $backupsPath = DATA_PATH . 'backups/sql/';
     $availbacks = rcms_scandir($backupsPath);
     $result = __('No existing DB backups here');
     if (!empty($availbacks)) {
         $cells = wf_TableCell(__('Date'));
         $cells .= wf_TableCell(__('Size'));
         $cells .= wf_TableCell(__('Filename'));
         $cells .= wf_TableCell(__('Actions'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($availbacks as $eachDump) {
             $fileDate = filectime($backupsPath . $eachDump);
             $fileDate = date("Y-m-d H:i:s", $fileDate);
             $fileSize = filesize($backupsPath . $eachDump);
             $fileSize = stg_convert_size($fileSize);
             $encodedDumpPath = base64_encode($backupsPath . $eachDump);
             $downloadLink = wf_Link('?module=backups&download=' . $encodedDumpPath, $eachDump, false, '');
             $actLinks = wf_JSAlert('?module=backups&deletedump=' . $encodedDumpPath, web_delete_icon(), __('Removing this may lead to irreparable results')) . ' ';
             $actLinks .= wf_Link('?module=backups&download=' . $encodedDumpPath, wf_img('skins/icon_download.png', __('Download')), false, '');
             $actLinks .= wf_JSAlert('?module=backups&restore=true&restoredump=' . $encodedDumpPath, wf_img('skins/icon_restoredb.png', __('Restore DB')), __('Are you serious'));
             $cells = wf_TableCell($fileDate);
             $cells .= wf_TableCell($fileSize);
             $cells .= wf_TableCell($downloadLink);
             $cells .= wf_TableCell($actLinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
         $result = wf_TableBody($rows, '100%', '0', 'sortable');
     }
     return $result;
 }
예제 #5
0
 /**
  * Renders list of available SMS in queue with some controls
  * 
  * @return string
  */
 public function render()
 {
     $result = '';
     if (!empty($this->queue)) {
         $cells = wf_TableCell(__('Date'));
         $cells .= wf_TableCell(__('Mobile'));
         $cells .= wf_TableCell(__('Actions'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($this->queue as $io => $each) {
             $cells = wf_TableCell($each['date']);
             $cells .= wf_TableCell($each['number']);
             $actLinks = wf_modalAuto(wf_img('skins/icon_search_small.gif', __('Preview')), __('Preview'), $this->smsPreview($each), '');
             $actLinks .= wf_JSAlert('?module=tsmsqueue&deletesms=' . $each['filename'], web_delete_icon(), __('Are you serious'));
             $cells .= wf_TableCell($actLinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
         $result = wf_TableBody($rows, '100%', 0, 'sortable');
     } else {
         $result .= wf_tag('span', false, 'alert_info');
         $result .= wf_tag('center', false);
         $result .= __('Nothing found');
         $result .= wf_tag('center', true);
         $result .= wf_tag('span', true);
     }
     return $result;
 }
예제 #6
0
/**
 * Shows avatar for some framework user - use only this in production!
 * 
 * @param string $username rcms user login
 * @param int    $size - size of returning avatar
 * @return string
 */
function gravatar_ShowAdminAvatar($username, $size = '')
{
    $adminEmail = gravatar_GetUserEmail($username);
    if ($adminEmail) {
        $result = gravatar_GetAvatar($adminEmail, $size);
    } else {
        $result = wf_img('skins/admava.png');
    }
    return $result;
}
예제 #7
0
 /**
  * Renders search results for used cards
  * 
  * @param int $year
  * @param string $month
  * 
  * @return void
  */
 function web_CardShowUsageByMonth($year, $month)
 {
     $month = mysql_real_escape_string($month);
     $year = mysql_real_escape_string($year);
     $query = "SELECT * from `cardbank` WHERE `usedate` LIKE '%" . $year . "-" . $month . "-%'";
     $allusedcards = simple_queryall($query);
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $totalsumm = 0;
     $totalcount = 0;
     $csvdata = '';
     $tablecells = wf_TableCell(__('ID'));
     $tablecells .= wf_TableCell(__('Serial number'));
     $tablecells .= wf_TableCell(__('Cash'));
     $tablecells .= wf_TableCell(__('Usage date'));
     $tablecells .= wf_TableCell(__('Used login'));
     $tablecells .= wf_TableCell(__('Full address'));
     $tablecells .= wf_TableCell(__('Real name'));
     $tablerows = wf_TableRow($tablecells, 'row1');
     if (!empty($allusedcards)) {
         $csvdata = __('ID') . ';' . __('Serial number') . ';' . __('Cash') . ';' . __('Usage date') . ';' . __('Used login') . ';' . __('Full address') . ';' . __('Real name') . "\n";
         foreach ($allusedcards as $io => $eachcard) {
             $tablecells = wf_TableCell($eachcard['id']);
             $tablecells .= wf_TableCell($eachcard['serial']);
             $tablecells .= wf_TableCell($eachcard['cash']);
             $tablecells .= wf_TableCell($eachcard['usedate']);
             $profilelink = wf_Link("?module=userprofile&username="******"\n";
         }
     }
     if (!empty($csvdata)) {
         $exportFilename = 'exports/cardreport_' . $year . '-' . $month . '.csv';
         $csvdata = iconv('utf-8', 'windows-1251', $csvdata);
         file_put_contents($exportFilename, $csvdata);
         $exportLink = wf_Link('?module=cardreport&dloadcsv=' . base64_encode($exportFilename), wf_img('skins/excel.gif', __('Export')), false, '');
     } else {
         $exportLink = '';
     }
     $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
     $result .= __('Total') . ': ' . $totalcount . ' ' . __('payments') . ', ' . __('with total amount') . ': ' . $totalsumm;
     show_window(__('Payment cards usage report') . ' ' . $exportLink, $result);
 }
예제 #8
0
 /**
  * Renders custom report
  * 
  * @param string $reportfile
  * @param string $report_name
  * @param array $titles
  * @param array $keys
  * @param array $alldata
  * @param bool $address
  * @param bool $realnames
  * @param bool $rowcount
  * 
  * @return void
  */
 function web_ReportMasterShow($reportfile, $report_name, $titles, $keys, $alldata, $address = 0, $realnames = 0, $rowcount = 0)
 {
     $report_name = __($report_name) . ' ' . wf_tag('a', false, '', 'href="?module=reportmaster&view=' . $reportfile . '&printable=true" target="_BLANK"');
     $report_name .= wf_img('skins/printer_small.gif', __('Print'));
     $report_name .= wf_tag('a', true);
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $i = 0;
     $result = wf_tag('table', false, '', 'width="100%" class="sortable" border="0"');
     $result .= wf_tag('tr', false, 'row1');
     foreach ($titles as $eachtitle) {
         $result .= wf_tag('td') . __($eachtitle) . wf_tag('td', true);
     }
     if ($address) {
         $result .= wf_tag('td') . __('Full address') . wf_tag('td', true);
     }
     if ($realnames) {
         $result .= wf_tag('td') . __('Real Name') . wf_tag('td', true);
     }
     $result .= wf_tag('tr', true);
     if (!empty($alldata)) {
         foreach ($alldata as $io => $eachdata) {
             $i++;
             $result .= wf_tag('tr', false, 'row3');
             foreach ($keys as $eachkey) {
                 if (array_key_exists($eachkey, $eachdata)) {
                     $result .= wf_tag('td') . $eachdata[$eachkey] . wf_tag('td', true);
                 }
             }
             if ($address) {
                 $result .= wf_tag('td') . @$alladdress[$eachdata['login']] . wf_tag('td', true);
             }
             if ($realnames) {
                 $result .= wf_tag('td') . wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . @$allrealnames[$eachdata['login']]) . wf_tag('td', true);
             }
             $result .= wf_tag('tr', true);
         }
     }
     $result .= wf_tag('table', true);
     if ($rowcount) {
         $result .= wf_tag('strong') . __('Total') . ': ' . $i . wf_tag('strong', true);
     }
     show_window($report_name, $result);
 }
예제 #9
0
 function web_PhpConsoleShowTemplates()
 {
     $alltemplatekeys = zb_StorageFindKeys('PHPCONSOLETEMPLATE:');
     $tablecells = wf_TableCell(__('Template'), '80%');
     $tablecells .= wf_TableCell(__('Actions'));
     $tablerows = wf_TableRow($tablecells, 'row1');
     if (!empty($alltemplatekeys)) {
         foreach ($alltemplatekeys as $eachtemplatekey) {
             $templatearray = zb_PhpConsoleGetTemplate($eachtemplatekey['key']);
             $templatename = $templatearray['name'];
             $templatebody = $templatearray['body'];
             //show code template
             $runlink = wf_JSAlert('?module=sqlconsole&devconsole=true&runtpl=' . $eachtemplatekey['key'], $templatename, 'Insert this template into PHP console');
             $tablecells = wf_TableCell($runlink);
             $actionlinks = wf_JSAlert('?module=sqlconsole&devconsole=true&deltemplate=' . $eachtemplatekey['key'], web_delete_icon(), 'Are you serious');
             $actionlinks .= wf_Link('?module=sqlconsole&devconsole=true&edittemplate=' . $eachtemplatekey['key'], web_edit_icon());
             $tablecells .= wf_TableCell($actionlinks);
             $tablerows .= wf_TableRow($tablecells, 'row3');
         }
     }
     $createlink = __('Available code templates') . ' ' . wf_Link("?module=sqlconsole&devconsole=true&templateadd=true", wf_img("skins/icon_add.gif", __('Create')), false);
     $result = $createlink . ' ' . wf_TableBody($tablerows, '100%', '0', 'sortable');
     return $result;
 }
예제 #10
0
/**
 * Returns FreeRADIUS icon:
 * 
 * @param string $title
 * @return string
 */
function web_icon_freeradius($title = NULL)
{
    $icon = wf_img('skins/icon_freeradius_small.png', __($title));
    return $icon;
}
예제 #11
0
 /**
  * returns available templates list
  * 
  * @return string
  */
 public function renderTemplatesList()
 {
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Date'));
     $cells .= wf_TableCell(__('Admin'));
     $cells .= wf_TableCell(__('Public'));
     $cells .= wf_TableCell(__('Name'));
     $cells .= wf_TableCell(__('Path'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->templates)) {
         foreach ($this->templates as $io => $each) {
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['date']);
             $cells .= wf_TableCell($each['admin']);
             $cells .= wf_TableCell(web_bool_led($each['public']));
             $cells .= wf_TableCell($each['name']);
             $cells .= wf_TableCell($each['path']);
             $actlinks = wf_JSAlert('?module=pl_documents&deletetemplate=' . $each['id'] . '&username='******'Removing this may lead to irreparable results') . ' ';
             $actlinks .= wf_Link('?module=pl_documents&download=' . $each['path'] . '&username='******'skins/icon_download.png', __('Download'))) . ' ';
             $actlinks .= wf_Link('?module=pl_documents&print=' . $each['id'] . '&custom=true&username='******'skins/icon_print.png') . ' ' . __('Print'), false, 'ubButton');
             //$actlinks.= wf_Link('?module=pl_documents&print=' . $each['id'] . '&custom=true&username='******'skins/icon_print_options.png', __('Custom options')));
             //$actlinks.= wf_Link('?module=pl_documents&print=' . $each['id'] . '&username='******'skins/icon_print.png', __('Print')));
             $cells .= wf_TableCell($actlinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     return $result;
 }
예제 #12
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;
}
예제 #13
0
                        $jobdata[$eachjob['workerid']][$eachjob['jobid']] = 1;
                    }
                }
            }
            //build graphs for each employee
            if (!empty($jobdata)) {
                foreach ($jobdata as $employee => $each) {
                    $employeeName = isset($employees[$employee]) ? $employees[$employee] : __('Deleted');
                    $result .= wf_tag('h3', false) . $employeeName . wf_tag('h3', true);
                    $rows = '';
                    if (!empty($each)) {
                        foreach ($each as $jobid => $count) {
                            $cells = wf_TableCell(@$jobtypes[$jobid], '40%');
                            $cells .= wf_TableCell($count, '20%');
                            $cells .= wf_TableCell(web_bar($count, sizeof($alljobs)), '40%');
                            $rows .= wf_TableRow($cells, 'row3');
                        }
                    }
                    $result .= wf_TableBody($rows, '100%', 0);
                    $result .= wf_delimiter();
                }
            }
        }
        return $result;
    }
    $jobgraphs = wf_modal(wf_img('skins/icon_stats.gif', __('Graphs')), __('Graphs'), ts_EmployeeMonthGraphs(), '', '800', '600');
    $donejobs = ts_JGetJobsReport();
    show_window(__('Job report') . ' ' . $jobgraphs, wf_FullCalendar($donejobs));
} else {
    show_error(__('Access denied'));
}
예제 #14
0
    if ($altcfg['DOCX_SUPPORT']) {
        $documents = new ProfileDocuments();
        $date = wf_CheckPost(array('showdate')) ? $_POST['showdate'] : '';
        $documents->loadAllUsersDocuments($date);
        //existing document downloading
        if (wf_CheckGet(array('documentdownload'))) {
            zb_DownloadFile($documents::DOCUMENTS_PATH . $_GET['documentdownload'], 'docx');
        }
        //document deletion from database
        if (wf_CheckGet(array('deletedocument'))) {
            $documents->unregisterDocument($_GET['deletedocument']);
            rcms_redirect('?module=report_documents');
        }
        //controls
        $actionLinks = wf_Link('?module=report_documents', __('Grid view') . ' ' . wf_img('skins/icon_table.png'), false, 'ubButton');
        $actionLinks .= wf_Link('?module=report_documents&calendarview=true', __('As calendar') . ' ' . wf_img('skins/icon_calendar.gif'), false, 'ubButton');
        show_window('', $actionLinks);
        if (!wf_CheckGet(array('calendarview'))) {
            //show calendar control
            show_window(__('By date'), $documents->dateControl());
            //list available documents
            show_window(__('Previously generated documents'), $documents->renderAllUserDocuments());
        } else {
            //or calendar view
            show_window(__('Previously generated documents'), $documents->renderAllUserDocumentsCalendar());
        }
    } else {
        show_error(__('This module is disabled'));
    }
} else {
    show_error(__('You cant control this module'));
예제 #15
0
 /**
  * renders streets report
  * 
  * @return void
  */
 public function reportStreets()
 {
     $ukvCities = array();
     $ukvStreets = array();
     //loads cities and streets occupied by UKV users
     $ukvCities_q = "SELECT DISTINCT `city` from `ukv_users` ORDER BY `city` ASC";
     $ukvCitiesRaw = simple_queryall($ukvCities_q);
     if (!empty($ukvCitiesRaw)) {
         foreach ($ukvCitiesRaw as $ieuc => $euc) {
             $ukvCities[$euc['city']] = $euc['city'];
         }
     }
     $ukvStreets_q = "SELECT DISTINCT `street` from `ukv_users` ORDER BY `street` ASC";
     $ukvStreetsRaw = simple_queryall($ukvStreets_q);
     if (!empty($ukvStreetsRaw)) {
         foreach ($ukvStreetsRaw as $ieus => $eus) {
             $ukvStreets[$eus['street']] = $eus['street'];
         }
     }
     //main codepart
     $citySelected = wf_CheckPost(array('streetreportcity')) ? $_POST['streetreportcity'] : '';
     $streetSelected = wf_CheckPost(array('streetreportstreet')) ? $_POST['streetreportstreet'] : '';
     $inputs = wf_Selector('streetreportcity', $ukvCities, __('City'), $citySelected, false);
     $inputs .= wf_Selector('streetreportstreet', $ukvStreets, __('Street'), $streetSelected, false);
     $inputs .= wf_Submit(__('Show'));
     $form = wf_Form('', 'POST', $inputs, 'glamour');
     show_window(__('Streets report'), $form);
     if (wf_CheckPost(array('streetreportcity', 'streetreportstreet')) or wf_CheckGet(array('rc', 'rs'))) {
         //set form data
         if (wf_CheckPost(array('streetreportcity', 'streetreportstreet'))) {
             $citySearch = $_POST['streetreportcity'];
             $streetSearch = $_POST['streetreportstreet'];
         }
         //or printable report
         if (wf_CheckGet(array('rc', 'rs'))) {
             $citySearch = $_GET['rc'];
             $streetSearch = $_GET['rs'];
         }
         if (!empty($this->users)) {
             $counter = 0;
             $cells = wf_TableCell(__('Contract'), '10%');
             $cells .= wf_TableCell(__('Full address'), '31%');
             $cells .= wf_TableCell(__('Real Name'), '30%');
             $cells .= wf_TableCell(__('Tariff'), '15%');
             $cells .= wf_TableCell(__('Cash'), '7%');
             $cells .= wf_TableCell(__('Status'), '7%');
             $rows = wf_TableRow($cells, 'row1');
             foreach ($this->users as $io => $eachUser) {
                 if ($eachUser['city'] == $citySearch and $eachUser['street'] == $streetSearch) {
                     $cells = wf_TableCell($eachUser['contract']);
                     $fullAddress = $this->userGetFullAddress($eachUser['id']);
                     $profileLink = wf_Link(self::URL_USERS_PROFILE . $eachUser['id'], web_profile_icon() . ' ', false, '');
                     $cells .= wf_TableCell($profileLink . $fullAddress);
                     $cells .= wf_TableCell($eachUser['realname']);
                     $cells .= wf_TableCell($this->tariffs[$eachUser['tariffid']]['tariffname']);
                     $cells .= wf_TableCell($eachUser['cash']);
                     $cells .= wf_TableCell(web_bool_led($eachUser['active'], true));
                     $rows .= wf_TableRow($cells, 'row3');
                     $counter++;
                 }
             }
             $result = wf_TableBody($rows, '100%', '0', 'sortable');
             $result .= __('Total') . ': ' . $counter;
             if (wf_CheckGet(array('printable'))) {
                 $this->reportPrintable($citySearch . ' / ' . $streetSearch, $result);
             } else {
                 $printlink = wf_Link(self::URL_REPORTS_MGMT . 'reportStreets&rc=' . $citySearch . '&rs=' . $streetSearch . '&printable=true', wf_img('skins/icon_print.png', __('Print')), false, '');
                 show_window($citySearch . ' / ' . $streetSearch . ' ' . $printlink, $result);
             }
         } else {
             show_window(__('Result'), __('Any users found'));
         }
     }
 }
예제 #16
0
/**
 * Returns build lister with controls for some streetID
 * 
 * @global array $ubillingConfig
 * @param int $streetid
 * @return string
 */
function web_BuildLister($streetid)
{
    global $ubillingConfig;
    $altcfg = $ubillingConfig->getAlter();
    $allbuilds = zb_AddressGetBuildAllDataByStreet($streetid);
    $cells = wf_TableCell(__('ID'));
    $cells .= wf_TableCell(__('Building number'));
    $cells .= wf_TableCell(__('Geo location'));
    $cells .= wf_TableCell(__('Actions'));
    $rows = wf_TableRow($cells, 'row1');
    if (!empty($allbuilds)) {
        //build passport data processing
        if ($altcfg['BUILD_EXTENDED']) {
            $buildPassport = new BuildPassport();
        }
        foreach ($allbuilds as $io => $eachbuild) {
            $cells = wf_TableCell($eachbuild['id']);
            $cells .= wf_TableCell($eachbuild['buildnum']);
            $cells .= wf_TableCell($eachbuild['geo']);
            $acts = wf_JSAlert('?module=builds&action=delete&streetid=' . $streetid . '&buildid=' . $eachbuild['id'], web_delete_icon(), 'Removing this may lead to irreparable results');
            $acts .= '' . wf_JSAlert('?module=builds&action=editbuild&streetid=' . $streetid . '&buildid=' . $eachbuild['id'], web_edit_icon(), 'Are you serious');
            if (!empty($eachbuild['geo'])) {
                $acts .= ' ' . wf_Link("?module=usersmap&findbuild=" . $eachbuild['geo'], wf_img('skins/icon_search_small.gif', __('Find on map')), false);
            }
            if ($altcfg['BUILD_EXTENDED']) {
                $acts .= ' ' . wf_modal(wf_img('skins/icon_passport.gif', __('Build passport')), __('Build passport'), $buildPassport->renderEditForm($eachbuild['id']), '', '600', '450');
            }
            $cells .= wf_TableCell($acts);
            $rows .= wf_TableRow($cells, 'row3');
        }
    }
    $result = wf_TableBody($rows, '100%', 0, 'sortable');
    return $result;
}
예제 #17
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;
 }
예제 #18
0
/**
 * Shows task editing/management form
 * 
 * @global object $ubillingConfig
 * @param int $taskid
 * 
 * @return void
 */
function ts_TaskChangeForm($taskid)
{
    global $ubillingConfig;
    $altercfg = $ubillingConfig->getAlter();
    $taskid = vf($taskid, 3);
    $taskdata = ts_GetTaskData($taskid);
    $result = '';
    $allemployee = ts_GetAllEmployee();
    $activeemployee = ts_GetActiveEmployee();
    $alljobtypes = ts_GetAllJobtypes();
    $messages = new UbillingMessageHelper();
    $smsData = '';
    if (!empty($taskdata)) {
        //not done task
        if (empty($taskdata['login'])) {
            $login_detected = ts_DetectUserByAddress($taskdata['address']);
            if ($login_detected) {
                $addresslink = wf_Link("?module=userprofile&username="******"?module=userprofile&username="******"H:i", strtotime($taskdata['starttime'])) : '';
                $smsJobNote = mysql_real_escape_string($taskdata['jobnote']);
                $smsEmployee = vf($taskdata['employee']);
                $newSmsText = $smsAddress . ' ' . $smsPhone . ' ' . $smsJobNote . $smsJobTime;
                $smsDataCells = wf_TableCell(__('Employee'), '', 'row2');
                $smsDataCells .= wf_TableCell(@$allemployee[$taskdata['employee']]);
                $smsDataRows = wf_TableRow($smsDataCells, 'row3');
                $smsDataCells = wf_TableCell(__('Message'), '', 'row2');
                $smsDataCells .= wf_TableCell(zb_TranslitString($newSmsText));
                $smsDataRows .= wf_TableRow($smsDataCells, 'row3');
                $smsDataTable = wf_TableBody($smsDataRows, '100%', '0', 'glamour');
                $smsInputs = $smsDataTable;
                $smsInputs .= wf_HiddenInput('postsendemployee', $smsEmployee);
                $smsInputs .= wf_HiddenInput('postsendsmstext', $newSmsText);
                $smsInputs .= wf_Submit(__('Send SMS'));
                $smsForm = wf_Form('', 'POST', $smsInputs, '');
                $smsData = wf_modal(wf_img_sized('skins/icon_mobile.gif', __('Send SMS'), '10'), __('Send SMS'), $smsForm, '', '400', '200');
            }
        }
        $tablecells = wf_TableCell(__('ID'), '30%');
        $tablecells .= wf_TableCell($taskdata['id']);
        $tablerows = wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Task creation date') . ' / ' . __('Administrator'));
        $tablecells .= wf_TableCell($taskdata['date'] . ' / ' . $taskdata['admin']);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Target date'));
        $tablecells .= wf_TableCell(wf_tag('strong') . $taskdata['startdate'] . ' ' . $taskdata['starttime'] . wf_tag('strong', true));
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Task address'));
        $tablecells .= wf_TableCell($addresslink);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Login'));
        $tablecells .= wf_TableCell($taskLogin . $loginType);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Phone'));
        $tablecells .= wf_TableCell($taskdata['phone']);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Job type'));
        $tablecells .= wf_TableCell(@$alljobtypes[$taskdata['jobtype']]);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Who should do'));
        $tablecells .= wf_TableCell(@$allemployee[$taskdata['employee']] . ' ' . $smsData);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Job note'));
        $tablecells .= wf_TableCell(nl2br($taskdata['jobnote']));
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $result .= wf_TableBody($tablerows, '100%', '0', 'glamour');
        $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true);
        // show task preview
        show_window(__('View task') . ' ' . $modform, $result);
        //Salary accounting
        if ($altercfg['SALARY_ENABLED']) {
            if (cfr('SALARYTASKSVIEW')) {
                $salary = new Salary();
                show_window(__('Additional jobs done'), $salary->taskJobCreateForm($_GET['edittask']));
            }
        }
        //warehouse integration
        if ($altercfg['WAREHOUSE_ENABLED']) {
            if (cfr('WAREHOUSE')) {
                $warehouse = new Warehouse();
                show_window(__('Additionally spent materials'), $warehouse->taskMaterialsReport($_GET['edittask']));
            }
        }
        //if task undone
        if ($taskdata['status'] == 0) {
            $sup = wf_tag('sup') . '*' . wf_tag('sup', false);
            $inputs = wf_HiddenInput('changetask', $taskid);
            $inputs .= wf_DatePicker('editenddate') . wf_tag('label', false) . __('Finish date') . $sup . wf_tag('label', true) . wf_tag('br');
            $inputs .= wf_tag('br');
            $inputs .= wf_Selector('editemployeedone', $activeemployee, __('Worker done'), $taskdata['employee'], true);
            $inputs .= wf_tag('br');
            $inputs .= wf_tag('label', false) . __('Finish note') . wf_tag('label', true) . wf_tag('br');
            $inputs .= wf_TextArea('editdonenote', '', '', true, '35x3');
            $inputs .= wf_tag('br');
            $inputs .= $jobgencheckbox;
            $inputs .= wf_Submit(__('This task is done'));
            $form = wf_Form("", 'POST', $inputs, 'glamour');
            if (cfr('TASKMANDELETE')) {
                show_window('', wf_JSAlertStyled('?module=taskman&deletetask=' . $taskid, web_delete_icon() . ' ' . __('Remove this task - it is an mistake'), $messages->getDeleteAlert(), 'ubButton'));
            }
            //show editing form
            if (cfr('TASKMANDONE')) {
                show_window(__('If task is done'), $form);
            }
        } else {
            $donecells = wf_TableCell(__('Finish date'), '30%');
            $donecells .= wf_TableCell($taskdata['enddate']);
            $donerows = wf_TableRow($donecells, 'row3');
            $donecells = wf_TableCell(__('Worker done'));
            $donecells .= wf_TableCell($allemployee[$taskdata['employeedone']]);
            $donerows .= wf_TableRow($donecells, 'row3');
            $donecells = wf_TableCell(__('Finish note'));
            $donecells .= wf_TableCell($taskdata['donenote']);
            $donerows .= wf_TableRow($donecells, 'row3');
            $doneresult = wf_TableBody($donerows, '100%', '0', 'glamour');
            if (cfr('TASKMANDELETE')) {
                $doneresult .= wf_JSAlertStyled('?module=taskman&deletetask=' . $taskid, web_delete_icon() . ' ' . __('Remove this task - it is an mistake'), $messages->getDeleteAlert(), 'ubButton');
            }
            if (cfr('TASKMANDONE')) {
                $doneresult .= '&nbsp;';
                $doneresult .= wf_JSAlertStyled('?module=taskman&setundone=' . $taskid, wf_img('skins/icon_key.gif') . ' ' . __('No work was done'), $messages->getEditAlert(), 'ubButton');
            }
            show_window(__('Task is done'), $doneresult);
        }
    }
}
예제 #19
0
 $allrealnames = zb_UserGetAllRealnames();
 $alluserips = zb_UserGetAllIPs();
 $result = '';
 $hlightmac = '';
 //hlight user mac sub
 if (isset($_GET['username'])) {
     $login = mysql_real_escape_string($_GET['username']);
     $userip = zb_UserGetIP($login);
     $usermac = zb_MultinetGetMAC($userip);
     $hlightmac = $usermac;
 }
 if (!empty($allMonitoredDevices)) {
     foreach ($allMonitoredDevices as $io => $eachdevice) {
         $userCounter = 0;
         $hostdata = $sigmon->deviceQuery($eachdevice['ip'], $eachdevice['community']);
         $result .= wf_tag('h2', false) . wf_img('skins/wifi.png') . ' ' . $eachdevice['location'] . ' - ' . $eachdevice['ip'] . wf_tag('h2', true);
         $tablecells = wf_TableCell(__('Full address'));
         $tablecells .= wf_TableCell(__('Real Name'));
         $tablecells .= wf_TableCell(__('Tariff'));
         $tablecells .= wf_TableCell(__('IP'));
         $tablecells .= wf_TableCell(__('MAC'));
         $tablecells .= wf_TableCell(__('Signal') . ' dBm');
         $tablerows = wf_TableRow($tablecells, 'row1');
         if (!empty($hostdata)) {
             foreach ($hostdata as $eachmac => $eachsig) {
                 //signal coloring
                 if ($eachsig < -79) {
                     $displaysig = wf_tag('font', false, '', 'color="#900000"') . $eachsig . wf_tag('font', true);
                 } else {
                     $displaysig = wf_tag('font', false, '', 'color="#006600"') . $eachsig . wf_tag('font', true);
                 }
예제 #20
0
 function web_PaymentSearch($markers)
 {
     if (wf_CheckPost(array('searchtable'))) {
         if ($_POST['searchtable'] == 'payments') {
             $table = 'payments';
         }
         if ($_POST['searchtable'] == 'corrections') {
             $table = 'paymentscorr';
         }
     } else {
         $table = 'payments';
     }
     $query = "SELECT * from `" . $table . "`";
     $query .= $markers;
     $altercfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
     $csvdata = '';
     $allpayments = simple_queryall($query);
     if ($altercfg['FINREP_CONTRACT']) {
         $allcontracts = zb_UserGetAllContracts();
         $allcontracts = array_flip($allcontracts);
     }
     if ($altercfg['FINREP_TARIFF']) {
         $alltariffs = zb_TariffsGetAllUsers();
     }
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $alltypes = zb_CashGetAllCashTypes();
     $allservicenames = zb_VservicesGetAllNamesLabeled();
     $allpaysyspercents = zb_PaySysPercentGetAll();
     $totalsumm = 0;
     $paysyssumm = 0;
     $profitsumm = 0;
     $totalcount = 0;
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Date'));
     $cells .= wf_TableCell(__('Cash'));
     $cells .= wf_TableCell(__('PS%'));
     $cells .= wf_TableCell(__('Profit'));
     $cells .= wf_TableCell(__('Login'));
     if ($altercfg['FINREP_CONTRACT']) {
         $cells .= wf_TableCell(__('Contract'));
     }
     $cells .= wf_TableCell(__('Full address'));
     $cells .= wf_TableCell(__('Real Name'));
     if ($altercfg['FINREP_TARIFF']) {
         $cells .= wf_TableCell(__('Tariff'));
     }
     $cells .= wf_TableCell(__('Payment type'));
     $cells .= wf_TableCell(__('Notes'));
     $cells .= wf_TableCell(__('Admin'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($allpayments)) {
         if ($altercfg['FINREP_TARIFF']) {
             $csvTariffColumn = ';' . __('Tariff');
         } else {
             $csvTariffColumn = '';
         }
         $csvdata .= __('ID') . ';' . __('Date') . ';' . __('Cash') . ';' . __('PS%') . ';' . __('Profit') . ';' . __('Login') . ';' . __('Full address') . ';' . __('Real Name') . $csvTariffColumn . ';' . __('Payment type') . ';' . __('Notes') . ';' . __('Admin') . "\n";
         foreach ($allpayments as $io => $each) {
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['date']);
             $cells .= wf_TableCell($each['summ']);
             //detecting paymentsystem and calc percent
             if (isset($allpaysyspercents[$each['note']])) {
                 $currPc = $allpaysyspercents[$each['note']]['percent'];
                 $rawSumm = $each['summ'];
                 $paySysPc = $rawSumm / 100 * $currPc;
                 $ourProfit = $rawSumm - $paySysPc;
             } else {
                 $paySysPc = 0;
                 $ourProfit = $each['summ'];
             }
             $cells .= wf_TableCell($paySysPc);
             $cells .= wf_TableCell($ourProfit);
             $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $each['login'], false, ''));
             if ($altercfg['FINREP_CONTRACT']) {
                 $cells .= wf_TableCell(@$allcontracts[$each['login']]);
             }
             @($paymentRealname = $allrealnames[$each['login']]);
             @($paymentCashType = __($alltypes[$each['cashtypeid']]));
             @($paymentAddress = $alladdress[$each['login']]);
             $cells .= wf_TableCell($paymentAddress);
             $cells .= wf_TableCell($paymentRealname);
             if ($altercfg['FINREP_TARIFF']) {
                 @($userTariff = $alltariffs[$each['login']]);
                 $cells .= wf_TableCell($userTariff);
                 $csvTariff = ';' . $userTariff;
             } else {
                 $csvTariff = '';
             }
             $cells .= wf_TableCell($paymentCashType);
             //payment notes translation
             if ($altercfg['TRANSLATE_PAYMENTS_NOTES']) {
                 $paynote = zb_TranslatePaymentNote($each['note'], $allservicenames);
             } else {
                 $paynote = $each['note'];
             }
             $cells .= wf_TableCell($paynote);
             $cells .= wf_TableCell($each['admin']);
             $rows .= wf_TableRow($cells, 'row3');
             //calculating totals
             if ($each['summ'] > 0) {
                 $totalsumm = $totalsumm + $each['summ'];
                 $totalcount++;
             }
             if ($paySysPc > 0) {
                 $paysyssumm = $paysyssumm + $paySysPc;
             }
             if ($ourProfit > 0) {
                 $profitsumm = $profitsumm + $ourProfit;
             }
             $csvSumm = str_replace('.', ',', $each['summ']);
             $csvdata .= $each['id'] . ';' . $each['date'] . ';' . $csvSumm . ';' . $paySysPc . ';' . $ourProfit . ';' . $each['login'] . ';' . $paymentAddress . ';' . $paymentRealname . $csvTariff . ';' . $paymentCashType . ';' . $paynote . ';' . $each['admin'] . "\n";
         }
     }
     //saving report for future download
     if (!empty($csvdata)) {
         $csvSaveName = 'exports/payfind_' . zb_rand_string(8) . '.csv';
         $csvSaveNameEnc = base64_encode($csvSaveName);
         $csvdata = iconv('utf-8', 'windows-1251', $csvdata);
         file_put_contents($csvSaveName, $csvdata);
         $csvDownloadLink = wf_Link('?module=payfind&downloadcsv=' . $csvSaveNameEnc, wf_img('skins/excel.gif', __('Export')), false);
     } else {
         $csvDownloadLink = '';
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     //additional total counters
     $result .= wf_tag('div', false, 'glamour') . __('Count') . ': ' . $totalcount . wf_tag('div', true);
     $result .= wf_tag('div', false, 'glamour') . __('Total payments') . ': ' . $totalsumm . wf_tag('div', true);
     $result .= wf_tag('div', false, 'glamour') . __('Payment systems %') . ': ' . $paysyssumm . wf_tag('div', true);
     $result .= wf_tag('div', false, 'glamour') . __('Our final profit') . ': ' . $profitsumm . wf_tag('div', true);
     $result .= wf_CleanDiv();
     show_window(__('Payments found') . ' ' . $csvDownloadLink, $result);
 }
예제 #21
0
                        </td>
                    </tr>
                </table>
                <input type="submit" value="' . __('Change') . '">
            </form><br><br>';
            show_window(__('Edit signup price for user') . ' "' . $login . '"', $form);
            show_window('', wf_Link("?module=useredit&username="******"SELECT `name` FROM `tariffs`";
            $tariffs = simple_queryall($query);
            $prices = zb_TariffGetAllSignupPrices();
            $form = '<table width="100%" class="sortable" border="0">';
            $form .= '<tr class="row1"><td>' . __('Tariff') . '</td><td>' . __('Signup price') . '</td><td>' . __('Actions') . '</td></tr>';
            if (!empty($tariffs)) {
                foreach ($tariffs as $tariff) {
                    $form .= '
                        <tr class="row3">
                            <td>' . $tariff['name'] . '</td>
                            <td>' . (isset($prices[$tariff['name']]) ? $prices[$tariff['name']] : '0') . '</td>
                            <td>
                                <a href="?module=signupprices&tariff=' . $tariff['name'] . '">' . wf_img('skins/icons/register.png', __('Edit signup price')) . '</a>
                            </td>
                        </tr>
                    ';
                }
            }
            $form .= '</table>';
            show_window(__('Signup price'), $form);
        }
    }
}
예제 #22
0
/**
 * Returns calendar widget with preset time
 * 
 * @param string $field field name to insert time select widget
 * @param string $time default value time for widget
 * @param string $label label of widget
 * @param bool $br add break after the widget body?
 * @return string
 */
function wf_TimePickerPresetSeconds($field, $time = '', $label = '', $br = false)
{
    $inputId = wf_InputId();
    $result = wf_tag('input', false, '', 'type="text" value="' . $time . '" name="' . $field . '" size="8" id="' . $inputId . '"');
    $result .= wf_tag('script');
    $result .= '$(\'#' . $inputId . '\').timepicker({\'scrollDefault\': \'' . $time . '\', \'timeFormat\': \'H:i:s\' });';
    $result .= wf_tag('script', true);
    //clickable icon and label
    if (!empty($label)) {
        $label = ' ' . __($label);
    }
    $result .= wf_tag('label', false, '', 'for="' . $inputId . '"') . wf_img('skins/icon_time_small.png', __('Time')) . $label . wf_tag('label', true);
    //break at end
    if ($br) {
        $result .= wf_tag('br');
    }
    return $result;
}
예제 #23
0
 /**
  * Renders transaction list container
  * 
  * @return void
  */
 public function renderTransactionList()
 {
     $columns = array('ID', 'Date', 'Cash', 'Payment ID', 'Real Name', 'Full address', 'Payment system', 'Processed');
     $graphsUrl = wf_Link(self::URL_CHARTS, wf_img('skins/icon_stats.gif', __('Graphs')), false, '');
     show_window(__('OpenPayz transactions') . ' ' . $graphsUrl, wf_JqDtLoader($columns, self::URL_AJAX_SOURCE, true, 'payments', 100));
 }
예제 #24
0
/**
 * Returns list of all available switches devices with its controls. Also catches ajaxping and forcereping events.
 * 
 * @return string
 */
function web_SwitchesShow()
{
    global $ubillingConfig;
    $alterconf = $ubillingConfig->getAlter();
    $allswitches = zb_SwitchesGetAll();
    $modelnames = zb_SwitchModelsGetAllTag();
    $currenttime = time();
    $reping_timeout = $alterconf['SW_PINGTIMEOUT'];
    $deathTime = zb_SwitchesGetAllDeathTime();
    //counters
    $countTotal = 0;
    $countAlive = 0;
    $countDead = 0;
    $countNp = 0;
    $countOnMap = 0;
    $countSwpoll = 0;
    $countMtsigmon = 0;
    $countOlt = 0;
    $countLinked = 0;
    //non realtime switches pinging
    $last_pingtime = zb_StorageGet('SWPINGTIME');
    if (!$last_pingtime) {
        zb_SwitchesRepingAll();
        zb_StorageSet('SWPINGTIME', $currenttime);
        $last_pingtime = $currenttime;
    } else {
        if ($currenttime > $last_pingtime + $reping_timeout * 60) {
            // normal timeout reping sub here
            zb_SwitchesRepingAll();
            zb_StorageSet('SWPINGTIME', $currenttime);
        }
    }
    //force total reping and update cache
    if (wf_CheckGet(array('forcereping'))) {
        zb_SwitchesRepingAll();
        zb_StorageSet('SWPINGTIME', $currenttime);
        if (wf_CheckGet(array('ajaxping'))) {
            $dead_raw = zb_StorageGet('SWDEAD');
            $deathTime = zb_SwitchesGetAllDeathTime();
            $deadarr = array();
            $ajaxResult = '';
            if ($dead_raw) {
                $deadarr = unserialize($dead_raw);
                if (!empty($deadarr)) {
                    //there is some dead switches
                    $deadcount = sizeof($deadarr);
                    if ($alterconf['SWYMAP_ENABLED']) {
                        //getting geodata
                        $switchesGeo = zb_SwitchesGetAllGeo();
                    }
                    //ajax container
                    $ajaxResult .= wf_tag('div', false, '', 'id="switchping"');
                    foreach ($deadarr as $ip => $switch) {
                        if ($alterconf['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
                        $ajaxResult .= $devicefind . ' ' . $switchLocator . ' ' . $deathClock . $ip . ' - ' . $switch . '<br>';
                    }
                } else {
                    $ajaxResult = __('Switches are okay, everything is fine - I guarantee');
                }
            }
            $ajaxResult .= wf_delimiter() . __('Cache state at time') . ': ' . date("H:i:s");
            print $ajaxResult;
            //darkvoid update
            $notifyArea = new DarkVoid();
            $notifyArea->flushCache();
            die;
        }
    }
    //load dead switches cache
    $dead_switches_raw = zb_StorageGet('SWDEAD');
    if (!$dead_switches_raw) {
        $dead_switches = array();
    } else {
        $dead_switches = unserialize($dead_switches_raw);
    }
    //create new ADcomments object if enabled
    if ($alterconf['ADCOMMENTS_ENABLED']) {
        $adcomments = new ADcomments('SWITCHES');
    }
    $tablecells = wf_TableCell(__('ID'));
    $tablecells .= wf_TableCell(__('IP'));
    $tablecells .= wf_TableCell(__('Location'));
    $tablecells .= wf_TableCell(__('Active'));
    $tablecells .= wf_TableCell(__('Model'));
    $tablecells .= wf_TableCell(__('SNMP community'));
    $tablecells .= wf_TableCell(__('Geo location'));
    $tablecells .= wf_TableCell(__('Description'));
    $tablecells .= wf_TableCell(__('Actions'));
    $tablerows = wf_TableRow($tablecells, 'row1');
    $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" ';
    if (!empty($allswitches)) {
        foreach ($allswitches as $io => $eachswitch) {
            if (isset($dead_switches[$eachswitch['ip']])) {
                if (isset($deathTime[$eachswitch['ip']])) {
                    $obituary = __('Switch dead since') . ' ' . $deathTime[$eachswitch['ip']];
                } else {
                    $obituary = '';
                }
                $aliveled = web_red_led($obituary);
                $aliveflag = '0';
                $countDead++;
            } else {
                if (strpos($eachswitch['desc'], 'NP') === false) {
                    $aliveled = web_green_led();
                    $aliveflag = '1';
                    $countAlive++;
                } else {
                    $aliveled = web_yellow_led();
                    $aliveflag = '2';
                    $countNp++;
                }
            }
            $tablecells = wf_TableCell($eachswitch['id']);
            $tablecells .= wf_TableCell($eachswitch['ip'], '', '', 'sorttable_customkey="' . ip2int($eachswitch['ip']) . '"');
            $tablecells .= wf_TableCell($eachswitch['location']);
            $tablecells .= wf_TableCell($aliveled, '', '', 'sorttable_customkey="' . $aliveflag . '"');
            $tablecells .= wf_TableCell(@$modelnames[$eachswitch['modelid']]);
            $tablecells .= wf_TableCell($eachswitch['snmp']);
            $tablecells .= wf_TableCell($eachswitch['geo']);
            $tablecells .= wf_TableCell($eachswitch['desc']);
            $switchcontrols = '';
            if (cfr('SWITCHESEDIT')) {
                $switchcontrols .= wf_Link('?module=switches&edit=' . $eachswitch['id'], web_edit_icon());
            }
            if (cfr('SWITCHPOLL')) {
                if (!empty($eachswitch['snmp']) and ispos($eachswitch['desc'], 'SWPOLL')) {
                    $switchcontrols .= '&nbsp;' . wf_Link('?module=switchpoller&switchid=' . $eachswitch['id'], wf_img('skins/snmp.png', __('SNMP query')));
                    $countSwpoll++;
                }
            }
            if ($alterconf['SWYMAP_ENABLED']) {
                if (!empty($eachswitch['geo'])) {
                    $switchcontrols .= wf_Link('?module=switchmap&finddevice=' . $eachswitch['geo'], wf_img('skins/icon_search_small.gif', __('Find on map')));
                    $countOnMap++;
                }
                if (!empty($eachswitch['parentid'])) {
                    $switchcontrols .= wf_Link('?module=switchmap&finddevice=' . $eachswitch['geo'] . '&showuplinks=true&traceid=' . $eachswitch['id'], wf_img('skins/ymaps/uplinks.png', __('Uplink switch')));
                    $countLinked++;
                }
            }
            if (ispos($eachswitch['desc'], 'MTSIGMON')) {
                $countMtsigmon++;
            }
            if (ispos($eachswitch['desc'], 'OLT')) {
                $countOlt++;
            }
            if ($alterconf['ADCOMMENTS_ENABLED']) {
                $switchcontrols .= $adcomments->getCommentsIndicator($eachswitch['id']);
            }
            if (isset($alterconf['SW_WEBNAV'])) {
                if ($alterconf['SW_WEBNAV']) {
                    $switchcontrols .= ' ' . wf_tag('a', false, '', 'href="http://' . $eachswitch['ip'] . '" target="_BLANK"') . wf_img('skins/ymaps/globe.png', __('Go to the web interface')) . wf_tag('a', true);
                }
            }
            $tablecells .= wf_TableCell($switchcontrols);
            $tablerows .= wf_tag('tr', false, 'row3', $lighter);
            $tablerows .= $tablecells;
            $tablerows .= wf_tag('tr', true);
            $countTotal++;
        }
    }
    $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
    $result .= wf_img('skins/icon_active.gif') . ' ' . __('Alive switches') . ' - ' . ($countAlive + $countNp) . ' (' . $countAlive . '+' . $countNp . ')' . wf_tag('br');
    $result .= wf_img('skins/icon_inactive.gif') . ' ' . __('Dead switches') . ' - ' . $countDead . wf_tag('br');
    $result .= wf_img('skins/yellow_led.png') . ' ' . __('NP switches') . ' - ' . $countNp . wf_tag('br');
    $result .= wf_img('skins/snmp.png') . ' ' . __('SWPOLL query') . ' - ' . $countSwpoll . wf_tag('br');
    $result .= wf_img('skins/wifi.png') . ' ' . __('MTSIGMON devices') . ' - ' . $countMtsigmon . wf_tag('br');
    $result .= wf_img('skins/pon_icon.gif') . ' ' . __('OLT devices') . ' - ' . $countOlt . wf_tag('br');
    $result .= wf_img('skins/icon_search_small.gif') . ' ' . __('Placed on map') . ' - ' . $countOnMap . wf_tag('br');
    $result .= wf_img('skins/ymaps/uplinks.png') . ' ' . __('Have uplinks') . ' - ' . $countLinked . wf_tag('br');
    $result .= wf_tag('br') . wf_tag('b') . __('Total') . ': ' . $countTotal . wf_tag('b', true) . wf_tag('br');
    return $result;
}
예제 #25
0
             if (wf_CheckGet(array('printremainsstorage'))) {
                 $warehouse->reportStorageRemainsPrintable($_GET['printremainsstorage']);
             }
         }
         //reports
         if (wf_CheckGet(array('reports'))) {
             if (wf_CheckGet(array('ajaxtremains'))) {
                 $warehouse->{$avidity}['A']['SEENOEVIL']();
             }
             if (wf_CheckGet(array('calendarops'))) {
                 show_window(__('Operations in the context of time'), $warehouse->reportCalendarOps());
                 $warehouse->{$avidity}['M']['FALL']($warehouse::URL_ME . '&' . $warehouse::URL_REPORTS . '&' . 'totalremains=true');
             }
             if (wf_CheckGet(array('totalremains'))) {
                 $calendarLink = wf_Link($warehouse::URL_ME . '&' . $warehouse::URL_REPORTS . '&calendarops=true', wf_img('skins/icon_calendar.gif', __('Operations in the context of time')), false, '');
                 $dateRemainsLink = wf_Link($warehouse::URL_ME . '&' . $warehouse::URL_REPORTS . '&dateremains=true', wf_img('skins/ukv/report.png', __('Date remains')));
                 show_window(__('The remains in all storages') . ' ' . $calendarLink . ' ' . $dateRemainsLink, $warehouse->reportAllStoragesRemains());
                 $warehouse->{$avidity}['M']['FALL']();
             }
             if (wf_CheckGet(array('dateremains'))) {
                 show_window(__('Date remains'), $warehouse->reportDateRemains());
                 $warehouse->{$avidity}['M']['FALL']();
             }
         }
         $warehouse->{$avidity}['M']['FRONT']();
     } else {
         show_error(__('No license key available'));
     }
 } else {
     show_error(__('This module is disabled'));
 }
예제 #26
0
 function web_AskoziaDateForm()
 {
     $inputs = wf_Link("?module=askozia&config=true", wf_img('skins/settings.png', __('Settings'))) . ' ';
     $inputs .= wf_DatePickerPreset('datefrom', curdate()) . ' ' . __('From');
     $inputs .= wf_DatePickerPreset('dateto', curdate()) . ' ' . __('To');
     $inputs .= wf_Submit(__('Show'));
     $result = wf_Form("", "POST", $inputs, 'glamour');
     return $result;
 }
예제 #27
0
/**
 * Show data for some device
 * 
 * @param   $ip device ip
 * @param   $community snmp community
 * @param   $alltemplates all of snmp templates
 * @param   $quiet  no output
 * 
 * @return  void
 */
function sp_SnmpPollDevice($ip, $community, $alltemplates, $deviceTemplate, $allusermacs, $alladdress, $quiet = false)
{
    global $ubillingConfig;
    if (isset($alltemplates[$deviceTemplate])) {
        $currentTemplate = $alltemplates[$deviceTemplate];
        if (!empty($currentTemplate)) {
            $deviceDescription = $currentTemplate['define']['DEVICE'];
            $deviceFdb = $currentTemplate['define']['FDB'];
            $sectionResult = '';
            $sectionName = '';
            $finalResult = '';
            $tempArray = array();
            $alterCfg = $ubillingConfig->getAlter();
            $snmp = new SNMPHelper();
            //selecting FDB processing mode
            if (isset($currentTemplate['define']['FDB_MODE'])) {
                $deviceFdbMode = $currentTemplate['define']['FDB_MODE'];
            } else {
                $deviceFdbMode = 'default';
            }
            //selecting FDB ignored port for skipping MAC-s on it
            if (isset($currentTemplate['define']['FDB_IGNORE_PORTS'])) {
                $deviceFdbIgnore = $currentTemplate['define']['FDB_IGNORE_PORTS'];
                $deviceFdbIgnore = explode(',', $deviceFdbIgnore);
                $deviceFdbIgnore = array_flip($deviceFdbIgnore);
            } else {
                $deviceFdbIgnore = array();
            }
            //parse each section of template
            foreach ($alltemplates[$deviceTemplate] as $section => $eachpoll) {
                if ($section != 'define') {
                    if (!$quiet) {
                        $finalResult .= wf_tag('div', false, 'dashboard', '');
                    }
                    $sectionName = $eachpoll['NAME'];
                    $sectionOids = explode(',', $eachpoll['OIDS']);
                    $sectionParser = $eachpoll['PARSER'];
                    $sectionResult = '';
                    //now parse each oid
                    foreach ($sectionOids as $eachOid) {
                        $eachOid = trim($eachOid);
                        $rawData = $snmp->walk($ip, $community, $eachOid, true);
                        $rawData = str_replace('"', '`', $rawData);
                        $parseCode = '$sectionResult.=' . $sectionParser . '("' . $rawData . '");';
                        eval($parseCode);
                    }
                    if (!$quiet) {
                        $finalResult .= wf_tag('div', false, 'dashtask', '') . wf_tag('strong') . __($sectionName) . wf_tag('strong', true) . '<br>';
                        $finalResult .= $sectionResult . wf_tag('div', true);
                    }
                }
            }
            $finalResult .= wf_tag('div', true);
            $finalResult .= wf_tag('div', false, '', 'style="clear:both;"');
            $finalResult .= wf_tag('div', true);
            if (!$quiet) {
                show_window('', $finalResult);
            }
            //
            //parsing data from FDB table
            //
            if ($deviceFdb == 'true') {
                $portData = array();
                $snmp->setBackground(false);
                // need to process data with system + background
                if ($deviceFdbMode == 'default') {
                    //default zyxel & cisco port table
                    $portTable = $snmp->walk($ip, $community, '.1.3.6.1.2.1.17.4.3.1.2', true);
                } else {
                    if ($deviceFdbMode == 'dlp') {
                        //custom dlink port table with VLANS
                        $portTable = $snmp->walk($ip, $community, '.1.3.6.1.2.1.17.7.1.2.2.1.2', true);
                    }
                }
                if (!empty($portTable)) {
                    if ($deviceFdbMode == 'default') {
                        //default FDB parser
                        $portData = sp_SnmpParseFDB($portTable);
                    } else {
                        if ($deviceFdbMode == 'dlp') {
                            //exotic dlink parser
                            $portData = sp_SnmpParseFdbDl($portTable);
                        }
                    }
                    //skipping some port data if FDB_IGNORE_PORTS option is set
                    if (!empty($deviceFdbIgnore)) {
                        if (!empty($portData)) {
                            foreach ($portData as $some_mac => $some_port) {
                                if (!isset($deviceFdbIgnore[$some_port])) {
                                    $tempArray[$some_mac] = $some_port;
                                }
                            }
                            $portData = $tempArray;
                        }
                    }
                    $fdbCache = serialize($portData);
                    file_put_contents('exports/' . $ip . '_fdb', $fdbCache);
                }
                //show port data User friendly :)
                if (!empty($portData)) {
                    //extracting all needed data for switchport control
                    if ($alterCfg['SWITCHPORT_IN_PROFILE']) {
                        $allswitchesArray = zb_SwitchesGetAll();
                        $allportassigndata = array();
                        $allportassigndata_q = "SELECT * from `switchportassign`;";
                        $allportassigndata_raw = simple_queryall($allportassigndata_q);
                        if (!empty($allportassigndata_raw)) {
                            foreach ($allportassigndata_raw as $iopd => $eachpad) {
                                $allportassigndata[$eachpad['login']] = $eachpad;
                            }
                        }
                    }
                    $allusermacs = array_flip($allusermacs);
                    $cells = wf_TableCell(__('User'), '30%');
                    $cells .= wf_TableCell(__('MAC'));
                    $cells .= wf_TableCell(__('Ports'));
                    $rows = wf_TableRow($cells, 'row1');
                    foreach ($portData as $eachMac => $eachPort) {
                        //user detection
                        if (isset($allusermacs[$eachMac])) {
                            $userLogin = $allusermacs[$eachMac];
                            @($useraddress = $alladdress[$userLogin]);
                            $userlink = wf_Link('?module=userprofile&username='******' ' . $useraddress, false);
                            //switch port assing form
                            if ($alterCfg['SWITCHPORT_IN_PROFILE']) {
                                $assignForm = wf_modal(web_edit_icon(__('Switch port assign')), __('Switch port assign'), web_SnmpSwitchControlForm($userLogin, $allswitchesArray, $allportassigndata, @$_GET['switchid'], $eachPort), '', '500', '250');
                                if (isset($allportassigndata[$userLogin])) {
                                    $assignForm .= wf_img('skins/arrow_right_green.png') . @$allportassigndata[$userLogin]['port'];
                                }
                            } else {
                                $assignForm = '';
                            }
                        } else {
                            $userlink = '';
                            $assignForm = '';
                        }
                        $cells = wf_TableCell($userlink . $assignForm, '', '', 'sorttable_customkey="' . $eachPort . '"');
                        $cells .= wf_TableCell($eachMac);
                        $cells .= wf_TableCell($eachPort);
                        $rows .= wf_TableRow($cells, 'row3');
                    }
                    if (!$quiet) {
                        show_window(__('FDB'), wf_TableBody($rows, '100%', '0', 'sortable'));
                    }
                }
            }
        }
    }
}
예제 #28
0
         //show dead switch time machine
         if (!isset($_GET['snapshot'])) {
             //cleanup subroutine
             if (wf_CheckGet(array('flushalldead'))) {
                 ub_SwitchesTimeMachineCleanup();
                 rcms_redirect("?module=switches&timemachine=true");
             }
             //calendar view time machine
             if (!wf_CheckPost(array('switchdeadlogsearch'))) {
                 $deadTimeMachine = ub_JGetSwitchDeadLog();
                 $timeMachine = wf_FullCalendar($deadTimeMachine);
             } else {
                 //search processing
                 $timeMachine = ub_SwitchesTimeMachineSearch($_POST['switchdeadlogsearch']);
             }
             $timeMachineCleanupControl = wf_JSAlert('?module=switches&timemachine=true&flushalldead=true', wf_img('skins/icon_cleanup.png', __('Cleanup')), __('Are you serious'));
             //here some searchform
             $timeMachineSearchForm = web_SwitchTimeMachineSearchForm() . wf_tag('br');
             show_window(__('Dead switches time machine') . ' ' . $timeMachineCleanupControl, $timeMachineSearchForm . $timeMachine);
         } else {
             //showing dead switches snapshot
             ub_SwitchesTimeMachineShowSnapshot($_GET['snapshot']);
         }
     }
 } else {
     //editing switch form
     $switchid = vf($_GET['edit'], 3);
     $switchdata = zb_SwitchGetData($switchid);
     //if someone edit switch
     if (wf_CheckPost(array('editmodel'))) {
         if (cfr('SWITCHESEDIT')) {
예제 #29
0
 public function documents_list_show($item, $item_id)
 {
     // Get documents list using the elements' id:
     $query = "SELECT * FROM `" . self::TABLE_DOCS . "` WHERE `" . $item . "_id` = '" . $item_id . "'";
     $result = simple_queryall($query);
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Title'));
     $cells .= wf_TableCell(__('Date'));
     $cells .= wf_TableCell(__('Filename'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row2');
     if (!empty($result)) {
         foreach ($result as $document) {
             $filename = basename($document['path']);
             $cells = wf_TableCell($document['id']);
             $cells .= wf_TableCell($document['title']);
             $cells .= wf_TableCell($document['date']);
             $cells .= wf_TableCell($filename);
             $actions = wf_Link(self::URL_DOC_DOWNLOAD . $document['id'], wf_img('skins/icon_download.png', __('Download')));
             $actions .= wf_Link(self::URL_DOC_DELETE . $document['id'], web_delete_icon());
             $cells .= wf_TableCell($actions);
             $rows .= wf_TableRow($cells, 'row3');
         }
     } else {
         $cells = wf_TableCell(__('There is no documents to show'), null, null, 'colspan="5" align="center"');
         $rows .= wf_TableRow($cells, 'row3');
     }
     return wf_TableBody($rows, '100%', '0');
 }
예제 #30
0
 /**
  * Returns JSON reply for jquery datatables with full list of available connection details
  * 
  * @return void
  */
 public function ajaxGetDataUkv()
 {
     $ukv = new UkvSystem();
     $query = "SELECT * from `ukv_users` WHERE `cableseal` != '' ;";
     $all = simple_queryall($query);
     $result = '{ 
               "aaData": [ ';
     if (!empty($all)) {
         foreach ($all as $io => $each) {
             $profileLink = wf_Link('?module=ukv&users=true&showuser='******'id'], web_profile_icon() . ' ', false);
             $profileLink = str_replace('"', '', $profileLink);
             $profileLink = str_replace("'", '', $profileLink);
             $profileLink = trim($profileLink);
             $userAddress = @$ukv->userGetFullAddress($each['id']);
             $userAddress = str_replace("'", '`', $userAddress);
             $userAddress = str_replace('"', '``', $userAddress);
             $userAddress = trim($userAddress);
             $userRealname = $each['realname'];
             $userRealname = str_replace("'", '`', $userRealname);
             $userRealname = str_replace('"', '``', $userRealname);
             $userRealname = trim($userRealname);
             $act = wf_img('skins/icon_active.gif') . __('Yes');
             //finance check
             if (!$each['active']) {
                 $act = wf_img('skins/icon_inactive.gif') . __('No');
             }
             $act = str_replace('"', '', $act);
             $act = trim($act);
             $result .= '
                 [
                 "' . $profileLink . $userAddress . '",
                 "' . $userRealname . '",
                 "' . $ukv->tariffGetName($each['tariffid']) . '",
                 "' . $act . '",
                 "' . $each['cash'] . '",
                 "' . $each['cableseal'] . '"
                 ],';
         }
     }
     $result = substr($result, 0, -1);
     $result .= '] 
     }';
     die($result);
 }