Example #1
0
/**
 * Renders JS payment form
 * 
 * @param int $amount
 * 
 * @return string
 */
function renderForm($amount)
{
    global $conf_fondy, $customer_id;
    $amount = vf($amount, 3);
    $result = $conf_fondy['LOCALE_SUM'] . ': ' . $amount . ' ' . $conf_fondy['MERCHANT_CURRENCY'] . ' ';
    $result .= '
<script src="https://api.fondy.eu/static_common/v1/checkout/oplata.js"></script>
<script>
	var button = $ipsp.get(\'button\');
	button.setMerchantId(' . $conf_fondy['MERCHANT_ID'] . ');
	button.setAmount(' . $amount . ', \'' . $conf_fondy['FONDY_CURRENCY'] . '\', true);
	button.setResponseUrl(\'' . $conf_fondy['RESPONSE_URL'] . '\');
        button.addParam(\'server_callback_url\',\'' . $conf_fondy['FRONTEND_URL'] . '\');
	button.setHost(\'api.fondy.eu\');
	button.addField({
		label: \'Payment ID\',
		name: \'paymentid\',
                value: \'' . $customer_id . '\',
                readonly :true,
		required: true
	});
</script>
<button onclick="location.href=button.getUrl()">' . $conf_fondy['LOCALE_SUBMIT'] . '</button>
';
    return $result;
}
Example #2
0
 /**
  * Returns all events with some count limit
  * 
  * @param int $limit
  * @return array
  */
 function zb_GetAllEvents($limit = 0)
 {
     $limit = vf($limit, 3);
     $query = "SELECT * from `weblogs` ORDER BY `id` DESC LIMIT " . $limit;
     $allevents = simple_queryall($query);
     return $allevents;
 }
Example #3
0
function zbs_ContrAhentGetData($id)
{
    $id = vf($id);
    $query = "SELECT * from `contrahens` WHERE `id`='" . $id . "'";
    $result = simple_query($query);
    return $result;
}
Example #4
0
function ra_NasDeteleTemplate($id)
{
    $id = vf($id, 3);
    $query = "DELETE from `nastemplates` WHERE `id`='" . $id . "'";
    nr_query($query);
    log_register('RADIUSTEMPLATE DELETE ' . $id);
}
Example #5
0
 /**
  * Renders year-month search interface
  * 
  * @return void
  */
 function web_CardShowDateForm()
 {
     $curmonth = wf_CheckPost(array('monthsel')) ? vf($_POST['monthsel'], 3) : date("m");
     $curyear = wf_CheckPost(array('yearsel')) ? vf($_POST['yearsel'], 3) : date("Y");
     $inputs = wf_YearSelectorPreset('yearsel', __('Year'), false, $curyear) . ' ';
     $inputs .= wf_MonthSelector('monthsel', 'Month', $curmonth, false);
     $inputs .= wf_Submit('Show');
     $form = wf_Form("", 'POST', $inputs, 'glamour');
     show_window(__('Date'), $form);
 }
Example #6
0
 function zbs_CatvGetUserPayments($catv_userid)
 {
     $catv_userid = vf($catv_userid, 3);
     $query = "SELECT * from `catv_payments` WHERE `userid`='" . $catv_userid . "'";
     $allpayments = simple_queryall($query);
     if (!empty($allpayments)) {
         return $allpayments;
     } else {
         return false;
     }
 }
Example #7
0
function ep_GetTransactionTime($id)
{
    $id = vf($id, 3);
    $query = "SELECT `date` from `op_transactions` WHERE `id`='" . $id . "'";
    $data = simple_query($query);
    if (!empty($data)) {
        return $data['date'];
    } else {
        return false;
    }
}
Example #8
0
 function web_plchecker($login)
 {
     $login = vf($login);
     $result = '<table width="100%" border="0">';
     $emails = zb_plcheckfield('emails', $login);
     $contracts = zb_plcheckfield('contracts', $login);
     $phones = zb_plcheckfield('phones', $login);
     $realname = zb_plcheckfield('realname', $login);
     $userspeeds = zb_plcheckfield('userspeeds', $login);
     $nethosts = zb_plchecknethost($login);
     $result .= '
         <tr class="row1">
             <td>' . __('Current value') . '</td>
             <td>' . __('Parameter') . '</td>
             <td>' . __('Actions') . '</td>
         <tr>
          ';
     $result .= '
         <tr class="row3">
             <td>' . web_bool_led($emails) . '</td>
             <td>' . __('Email') . '</td>
             <td>' . web_plfixerform($login, 'emails', $emails) . '</td>
         </tr>
          <tr class="row3">
             <td>' . web_bool_led($contracts) . '</td>
             <td>' . __('Contract') . '</td>
             <td>' . web_plfixerform($login, 'contracts', $contracts) . '</td>
          </tr>
             <tr class="row3">
             <td>' . web_bool_led($phones) . '</td>
             <td>' . __('Phone') . '/' . __('Mobile') . '</td>
             <td>' . web_plfixerform($login, 'phones', $phones) . '</td>
         </tr>
         <tr class="row3">
             <td>' . web_bool_led($realname) . '</td>
             <td>' . __('Real Name') . '</td>
             <td>' . web_plfixerform($login, 'realname', $realname) . '</td>
         </tr>
         <tr class="row3">
             <td>' . web_bool_led($userspeeds) . '</td>
             <td>' . __('Speed override') . '</td>
             <td>' . web_plfixerform($login, 'userspeeds', $userspeeds) . '</td>
         </tr>
         <tr class="row3">
             <td>' . web_bool_led($nethosts) . '</td>
             <td>' . __('Network') . '</td>
             <td>' . web_plfixerform($login, 'nethosts', $nethosts) . '</td>
         </tr>
         ';
     $result .= '</table>';
     $result .= web_UserControls($login);
     return $result;
 }
Example #9
0
 /**
  * Sets required year/month filter properties
  * 
  * @return void
  */
 protected function setDateFilters()
 {
     if (wf_CheckPost(array('yearsel'))) {
         $this->year = vf($_POST['yearsel']);
     } else {
         $this->year = date("Y");
     }
     if (wf_CheckPost(array('monthsel'))) {
         $this->month = vf($_POST['monthsel']);
     } else {
         $this->month = date("m");
     }
 }
Example #10
0
/**
 * Marks payment card ad used in database and pushes its price to user account
 * 
 * @global string $user_ip
 * @global string $user_login
 * @param string $cardnumber
 */
function zbs_PaycardUse($cardnumber)
{
    global $user_ip;
    global $user_login;
    $cardnumber = vf($cardnumber);
    $us_config = zbs_LoadConfig();
    $carddata = zbs_PaycardGetParams($cardnumber);
    $cardcash = $carddata['cash'];
    $ctime = curdatetime();
    $carduse_q = "UPDATE `cardbank` SET\n        `usedlogin` = '" . $user_login . "',\n        `usedip` = '" . $user_ip . "',\n        `usedate`= '" . $ctime . "',\n        `used`='1'\n         WHERE `serial` ='" . $cardnumber . "';\n        ";
    nr_query($carduse_q);
    zbs_PaymentLog($user_login, $cardcash, $us_config['PC_CASHTYPEID'], "CARD:" . $cardnumber);
    billing_addcash($user_login, $cardcash);
    rcms_redirect("index.php");
}
Example #11
0
function sn_LoadLang($language)
{
    $language = vf($language);
    $language = preg_replace('/\\0/s', '', $language);
    if (file_exists('languages/' . $language . '/lang.php')) {
        include 'languages/' . $language . '/lang.php';
        //additional locale
        if (file_exists('languages/' . $language . '/addons.php')) {
            include 'languages/' . $language . '/addons.php';
        }
    } else {
        include 'languages/english/lang.php';
    }
    return $lang;
}
Example #12
0
/**
 *  Shows help icon if context chapter available for current language
 *  
 *  @return  string
 */
function web_HelpIconShow()
{
    $lang = curlang();
    $result = '';
    if (cfr('HELP')) {
        if (isset($_GET['module'])) {
            $modulename = vf($_GET['module']);
            if (file_exists(DATA_PATH . "help/" . $lang . "/" . $modulename)) {
                $help_chapter = web_HelpChapterGet($modulename);
                $result = wf_modal(wf_img_sized("skins/help.gif", __('Context help'), 20), __('Context help'), $help_chapter, '', '600', '300');
            }
        }
    }
    return $result;
}
Example #13
0
/**
 * Check is message created by me?
 * 
 * @param int $msgid   message id from `ub_im`
 * 
 * @return bool
 */
function im_IsMineMessage($msgid)
{
    $msgid = vf($msgid, 3);
    $me = whoami();
    $query = "SELECT `from` FROM `ub_im` WHERE `id`='" . $msgid . "'";
    $data = simple_query($query);
    if (!empty($data)) {
        if ($data['from'] == $me) {
            //message created by me
            return true;
        } else {
            //or not
            return false;
        }
    } else {
        //message not exists
        return false;
    }
}
Example #14
0
 /**
  * Shows user signups by year with funny bars
  * 
  * @global object $ubillingConfig
  * @param int $year
  * 
  * @return void
  */
 function web_SignupsGraphYear($year)
 {
     global $ubillingConfig;
     $altCfg = $ubillingConfig->getAlter();
     $cemeteryEnabled = @$altCfg['CEMETERY_ENABLED'] ? true : false;
     if ($cemeteryEnabled) {
         $cemetery = new Cemetery();
     }
     $year = vf($year);
     $yearcount = zb_SignupsGetCountYear($year);
     $maxsignups = max($yearcount);
     $allmonths = months_array();
     $totalcount = 0;
     $tablecells = wf_TableCell('');
     $tablecells .= wf_TableCell(__('Month'));
     $tablecells .= wf_TableCell(__('Signups'));
     if ($cemeteryEnabled) {
         $tablecells .= wf_TableCell(__('Dead souls'));
         $tablecells .= wf_TableCell('', '10%');
     }
     $tablecells .= wf_TableCell(__('Visual'), '50%');
     $tablerows = wf_TableRow($tablecells, 'row1');
     foreach ($yearcount as $eachmonth => $count) {
         $totalcount = $totalcount + $count;
         $tablecells = wf_TableCell($eachmonth);
         $tablecells .= wf_TableCell(wf_Link('?module=report_signup&month=' . $year . '-' . $eachmonth, rcms_date_localise($allmonths[$eachmonth])));
         $tablecells .= wf_TableCell($count);
         if ($cemeteryEnabled) {
             $deadDateMask = $year . '-' . $eachmonth . '-';
             $deadCount = $cemetery->getDeadDateCount($deadDateMask);
             $deadBar = web_barTariffs($count, $deadCount);
             $tablecells .= wf_TableCell($deadCount);
             $tablecells .= wf_TableCell($deadBar);
         }
         $tablecells .= wf_TableCell(web_bar($count, $maxsignups), '', '', 'sorttable_customkey="' . $count . '"');
         $tablerows .= wf_TableRow($tablecells, 'row3');
     }
     $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
     $result .= wf_tag('b', false) . __('Total') . ': ' . $totalcount . wf_tag('b', true);
     show_window(__('User signups by year') . ' ' . $year, $result);
 }
Example #15
0
 function build_task($right, $link, $icon, $text)
 {
     global $system;
     global $billing_config;
     global $altconf;
     $icon_path = CUR_SKIN_PATH . 'taskbar/';
     if (cfr($right)) {
         $task_link = $link;
         $task_icon = $icon_path . $icon;
         if (!file_exists($task_icon)) {
             $task_icon = 'skins/taskbar/' . $icon;
         }
         $task_text = $text;
         if (isset($_COOKIE['tb_iconsize'])) {
             //is icon customize enabled?
             if ($altconf['TB_ICONCUSTOMSIZE']) {
                 $tbiconsize = vf($_COOKIE['tb_iconsize'], 3);
             } else {
                 $tbiconsize = $billing_config['TASKBAR_ICON_SIZE'];
             }
         } else {
             $tbiconsize = $billing_config['TASKBAR_ICON_SIZE'];
         }
         if ($altconf['TB_LABELED']) {
             if ($tbiconsize > 63) {
                 $template = '<div class="dashtask" style="height:' . ($tbiconsize + 30) . 'px; width:' . ($tbiconsize + 30) . 'px;"> <a href="' . $task_link . '"><img  src="' . $task_icon . '" border="0" width="' . $tbiconsize . '"  height="' . $tbiconsize . '" alt="' . $task_text . '" title="' . $task_text . '"></a> <br><br>' . $task_text . ' </div>';
             } else {
                 $template = '<a href="' . $task_link . '"><img  src="' . $task_icon . '" border="0" width="' . $tbiconsize . '"  height="' . $tbiconsize . '" alt="' . $task_text . '" title="' . $task_text . '"></a><img src="' . $icon_path . 'spacer.gif">  ';
             }
         } else {
             $template = '<a href="' . $task_link . '"><img  src="' . $task_icon . '" border="0" width="' . $tbiconsize . '"  height="' . $tbiconsize . '" alt="' . $task_text . '" title="' . $task_text . '"></a><img src="' . $icon_path . 'spacer.gif">  ';
         }
     } else {
         $template = '';
     }
     return $template;
 }
Example #16
0
 function wf_PlPingerOptionsForm()
 {
     //previous setting
     if (wf_CheckPost(array('packet'))) {
         $currentpack = vf($_POST['packet'], 3);
     } else {
         $currentpack = '';
     }
     if (wf_CheckPost(array('count'))) {
         $getCount = vf($_POST['count'], 3);
         if ($getCount <= 10000) {
             $currentcount = $getCount;
         } else {
             $currentcount = '';
         }
     } else {
         $currentcount = '';
     }
     $inputs = wf_TextInput('packet', __('Packet size'), $currentpack, false, 5);
     $inputs .= wf_TextInput('count', __('Count'), $currentcount, false, 5);
     $inputs .= wf_Submit(__('Save'));
     $result = wf_Form('', 'POST', $inputs, 'glamour');
     return $result;
 }
Example #17
0
 function migrate_UploadFile()
 {
     //путь сохранения
     $uploaddir = 'exports/';
     //белый лист расширений
     $allowedExtensions = array("txt", "csv");
     //по умолчанию надеемся на худшее
     $result = false;
     //проверяем точно ли текстовку нам подсовывают
     foreach ($_FILES as $file) {
         if ($file['tmp_name'] > '') {
             if (@(!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions))) {
                 $errormessage = 'Wrong file type';
                 die($errormessage);
             }
         }
     }
     $filename = vf($_FILES['uluserbase']['name']);
     $uploadfile = $uploaddir . $filename;
     if (move_uploaded_file($_FILES['uluserbase']['tmp_name'], $uploadfile)) {
         $result = $filename;
     }
     return $result;
 }
Example #18
0
             $url = $customRules[1];
         }
     }
     if (!empty($url)) {
         $show_pdf = la_tag('iframe src="' . $url . '" width="600px" height="800px"');
         $show_pdf .= la_tag('iframe', true);
         $inputs = la_CheckInput('custom_agreement', __('I have read text above and agree with terms of use'), FALSE, FALSE);
         $inputs .= la_delimiter();
         $inputs .= la_Submit(__('Order'));
         $show_pdf .= la_Form("", "POST", $inputs);
         show_window(__("You must accept license agreement"), $show_pdf);
     }
     if (isset($_POST['custom_agreement'])) {
         $date = GetFullApplyDate();
         $action = 'tagadd';
         $param = vf($_GET['service'], 3);
         $param = preg_replace('/\\0/s', '', $param);
         $param = strip_tags($param);
         $param = mysql_real_escape_string($param);
         $note = 'Order from userstats';
         if (checkTask($user_login, $action, $param)) {
             createTask($date, $user_login, $action, $param, $note);
         }
         rcms_redirect('?module=adservice&action=add&wait=true');
     }
 }
 if (!isset($_GET['accept'])) {
     show_window(__('Aditional services'), __('You can order aditional services. Available services - listed below.'));
     show_window(__('Aditional services cost'), AdServicesList($serviceCost, $us_config['currency']));
     show_window(__('Order aditional service'), AdServicesSelector($availableServices, $user_login));
     show_window(__('Activated services'), ShowAllOrderedServices($availableServices, $user_login));
Example #19
0
     break;
 case 'document':
     switch ($action) {
         case 'download':
             if (wf_CheckGet(array('id'))) {
                 $id = vf($_GET['id'], 3);
                 if (method_exists($obj, $runtime['METHOD']['DCMNTSDWNLD'])) {
                     $obj->{$runtime}['METHOD']['DCMNTSDWNLD']($id);
                 }
             } else {
                 rcms_redirect($obj::URL_HOME);
             }
             break;
         case 'delete':
             if (wf_CheckGet(array('id'))) {
                 $id = vf($_GET['id'], 3);
                 if (method_exists($obj, $runtime['METHOD']['DCMNTSDLT'])) {
                     $obj->{$runtime}['METHOD']['DCMNTSDLT']($id);
                 }
             } else {
                 rcms_redirect($obj::URL_HOME);
             }
             break;
         default:
             // Переадресация на главную стр. модуля при попытке доступа
             // к несуществующему обработчику $_GET['action']:
             rcms_redirect($obj::URL_HOME);
             break;
     }
     break;
 default:
Example #20
0
/**
 * Returns user notes database field for some user
 * 
 * @param string $login existing user login
 * @return string
 */
function zb_UserGetNotes($login)
{
    $login = vf($login);
    $query = "SELECT `note` from `notes` WHERE `login`='" . $login . "'";
    $result = simple_query($query);
    $result = $result['note'];
    return $result;
}
Example #21
0
<?php

if (cfr('USERPROFILE')) {
    if (isset($_GET['username'])) {
        $login = vf($_GET['username']);
        $login = trim($login);
        try {
            $profile = new UserProfile($login);
            show_window(__('User profile'), $profile->render());
        } catch (Exception $exception) {
            show_window(__('Error'), __('Strange exeption') . ': ' . wf_tag('pre') . $exception->getMessage() . wf_tag('pre', true));
        }
    } else {
        throw new Exception('GET_NO_USERNAME');
    }
}
Example #22
0
/**
 * Adds some money to user account
 * 
 * @param string $login
 * @param float $cash
 * @param string $note
 * 
 * @return void
 */
function zbs_CashAdd($login, $cash, $note)
{
    $login = vf($login);
    $cash = mysql_real_escape_string($cash);
    $cashtype = 0;
    $note = mysql_real_escape_string($note);
    $date = curdatetime();
    $balance = zb_CashGetUserBalance($login);
    billing_addcash($login, $cash);
    $query = "INSERT INTO `payments` ( `id` , `login` , `date` , `balance` , `summ` , `cashtypeid` , `note` )\n                VALUES (NULL , '" . $login . "', '" . $date . "', '" . $balance . "', '" . $cash . "', '" . $cashtype . "', '" . $note . ");";
    nr_query($query);
    log_register("BALANCECHANGE (" . $login . ') ON ' . $cash);
}
Example #23
0
 /**
  * downloads previous users document and check it validity
  * 
  * @param $documentid id of existing document
  * 
  * @return void
  */
 public function downloadUserDocument($documentid)
 {
     $documentid = vf($documentid, 3);
     if (!empty($documentid)) {
         if (isset($this->userDocuments[$documentid])) {
             $documentFileName = $this->userDocuments[$documentid]['path'];
             $fullPath = $this->dOCUMENTS_PATH . $documentFileName;
             zbs_DownloadFile($fullPath, 'docx');
         } else {
             show_window(__('Sorry'), __('No such document'));
         }
     }
 }
Example #24
0
 /**
  * Returns existing users full info
  * 
  * @return array
  */
 protected function getUsersList()
 {
     $result = array();
     $allRealNames = zb_UserGetAllRealnames();
     $allContracts = zb_UserGetAllContracts();
     $allUserTags = $this->getAllUsersTags();
     $allUserNotes = zb_UserGetAllNotes();
     $allPaymentIds = $this->getAllUserPaymentIds();
     $allAddresBindings = $this->getAllAddressList();
     $allAptData = $this->getAllAptList();
     $allPhones = zb_UserGetAllPhoneData();
     $allEmails = zb_UserGetAllEmails();
     $allNethosts = $this->getNethostsData();
     $allNetworks = $this->getNetworksData();
     $allRegData = $this->getUserRegData();
     if (!empty($allContracts)) {
         $allContracts = array_flip($allContracts);
     }
     $allContractDates = zb_UserContractDatesGetAll();
     if (!empty($this->allUserData)) {
         foreach ($this->allUserData as $userLogin => $userData) {
             $result[$userLogin]['id'] = $userLogin;
             $result[$userLogin]['login'] = $userLogin;
             $result[$userLogin]['full_name'] = @$allRealNames[$userLogin];
             $result[$userLogin]['flag_corporate'] = 0;
             if ($userData['TariffChange']) {
                 $curMonth = date('n');
                 $curYear = date('Y');
                 $firstDayNextMonth = $curMonth == 12 ? mktime(0, 0, 0, 0, 0, $curYear + 1) : mktime(0, 0, 0, $curMonth + 1, 1);
                 $firstDayNextMonth = date("Y-m-d", $firstDayNextMonth);
             } else {
                 $firstDayNextMonth = '';
             }
             $result[$userLogin]['tariff']['current'][0]['id'] = $userData['Tariff'];
             if ($firstDayNextMonth) {
                 $result[$userLogin]['tariff']['current'][0]['date_finish'] = $firstDayNextMonth;
             }
             if ($userData['TariffChange']) {
                 $result[$userLogin]['tariff']['new'][0]['id'] = $userData['TariffChange'];
                 $result[$userLogin]['tariff']['new'][0]['date_start'] = $firstDayNextMonth;
             }
             $userContract = @$allContracts[$userLogin];
             if ($userContract) {
                 $result[$userLogin]['agreement'][0]['number'] = $userContract;
                 $contractDate = @$allContractDates[$userContract];
                 if ($contractDate) {
                     $result[$userLogin]['agreement'][0]['date'] = $contractDate;
                 }
             }
             $result[$userLogin]['account_number'] = @$allPaymentIds[$userLogin];
             // yep, this is something like Payment ID
             if (isset($allUserTags[$userLogin])) {
                 foreach ($allUserTags[$userLogin] as $tagIo => $eachTagid) {
                     $result[$userLogin]['group'][$tagIo] = $eachTagid;
                 }
             }
             $userNotes = @$allUserNotes[$userLogin];
             if ($userNotes) {
                 $result[$userLogin]['comment'] = $userNotes;
             }
             $result[$userLogin]['balance'] = $userData['Cash'];
             $result[$userLogin]['credit'] = $userData['Credit'];
             $userState = 5;
             // work
             if ($userData['Cash'] < '-' . $userData['Credit']) {
                 $userState = 1;
                 //nomoney
             }
             if ($userData['Passive'] == 1) {
                 $userState = 2;
                 // pause
             }
             if ($userData['Down'] == 1) {
                 $userState = 3;
                 // disable
             }
             if ($userData['Tariff'] == '*_NO_TARIFF_*') {
                 $userState = 4;
                 // new
             }
             $result[$userLogin]['state_id'] = $userState;
             if (isset($allRegData[$userLogin])) {
                 $result[$userLogin]['date_create'] = $allRegData[$userLogin];
                 $result[$userLogin]['date_connect'] = $allRegData[$userLogin];
             } else {
                 $result[$userLogin]['date_create'] = '';
                 $result[$userLogin]['date_connect'] = '';
             }
             $result[$userLogin]['date_activity'] = date("Y-m-d H:i:s", $userData['LastActivityTime']);
             $result[$userLogin]['traffic']['month']['up'] = $userData['U0'];
             $result[$userLogin]['traffic']['month']['down'] = $userData['D0'];
             $result[$userLogin]['discount'] = 0;
             // TODO: to many discount models at this time
             $userApartmentId = @$allAddresBindings[$userLogin];
             if ($userApartmentId) {
                 $aptData = $allAptData[$userApartmentId];
                 $result[$userLogin]['address'][0]['type'] = 'connect';
                 $result[$userLogin]['address'][0]['house_id'] = $aptData['buildid'];
                 $result[$userLogin]['address'][0]['apartment']['id'] = $userApartmentId;
                 $result[$userLogin]['address'][0]['apartment']['full_name'] = $aptData['apt'];
                 $result[$userLogin]['address'][0]['apartment']['number'] = vf($aptData['apt'], 3);
                 if ($aptData['entrance']) {
                     $result[$userLogin]['address'][0]['entrance'] = $aptData['entrance'];
                 }
                 if ($aptData['floor']) {
                     $result[$userLogin]['address'][0]['floor'] = $aptData['floor'];
                 }
             }
             $userPhoneData = @$allPhones[$userLogin];
             if (!empty($userPhoneData)) {
                 if (isset($userPhoneData['phone'])) {
                     $result[$userLogin]['phone'][0]['number'] = $userPhoneData['phone'];
                     $result[$userLogin]['phone'][0]['flag_main'] = 0;
                 }
                 if (isset($userPhoneData['mobile'])) {
                     $result[$userLogin]['phone'][1]['number'] = $userPhoneData['mobile'];
                     $result[$userLogin]['phone'][1]['flag_main'] = 1;
                 }
             }
             $userEmail = @$allEmails[$userLogin];
             if ($userEmail) {
                 $result[$userLogin]['email'][0]['address'] = $userEmail;
                 $result[$userLogin]['email'][0]['flag_main'] = 1;
             }
             $userIp = $userData['IP'];
             $userIp = ip2int($userIp);
             $result[$userLogin]['ip_mac'][0]['ip'] = $userIp;
             $nethostsData = @$allNethosts[$userData['IP']];
             if (!empty($nethostsData)) {
                 $subnetId = $nethostsData['netid'];
                 $userMac = $nethostsData['mac'];
                 $userMac = str_replace(':', '', $userMac);
                 $userMac = strtolower($userMac);
                 // mac lowercased withot delimiters
                 $result[$userLogin]['ip_mac'][0]['mac'] = $userMac;
                 $result[$userLogin]['ip_mac'][0]['ip_net'] = @$allNetworks[$subnetId]['desc'];
             }
             if (isset($this->allCfData[$userLogin])) {
                 $result[$userLogin]['additional_data'] = $this->allCfData[$userLogin];
             }
             //   die(print_r($result, true));
         }
     }
     return $result;
 }
Example #25
0
 /**
  * renders users signup report
  * 
  * @return void
  */
 public function reportSignup()
 {
     $regdates = array();
     $months = months_array();
     $monthCount = array();
     $showYear = wf_CheckPost(array('showyear')) ? vf($_POST['showyear'], 3) : curyear();
     $showMonth = wf_CheckGet(array('month')) ? mysql_real_escape_string($_GET['month']) : curmonth();
     $yearCount = 0;
     if (!empty($this->users)) {
         foreach ($this->users as $io => $each) {
             if (!empty($each['regdate'])) {
                 $dateTime = explode(' ', $each['regdate']);
                 $regdates[$dateTime[0]][] = $each['id'];
             }
         }
     }
     // show year selector
     $yearInputs = wf_YearSelector('showyear', ' ', false);
     $yearInputs .= wf_Submit(__('Show'));
     $yearForm = wf_Form('', 'POST', $yearInputs, 'glamour');
     show_window(__('Year'), $yearForm);
     //extract year signup count data
     foreach ($months as $eachMonth => $monthName) {
         $sigcount = 0;
         if (!empty($regdates)) {
             foreach ($regdates as $eachRegDate => $userIds) {
                 $dateMark = $showYear . '-' . $eachMonth;
                 if (ispos($eachRegDate, $dateMark)) {
                     $sigcount = $sigcount + count($regdates[$eachRegDate]);
                 }
                 $monthCount[$eachMonth] = $sigcount;
             }
             $yearCount = $yearCount + $sigcount;
         }
     }
     //render per year grid
     $cells = wf_TableCell('');
     $cells .= wf_TableCell(__('Month'));
     $cells .= wf_TableCell(__('Signups'));
     $cells .= wf_TableCell(__('Visual'));
     $rows = wf_TableRow($cells, 'row1');
     foreach ($months as $eachMonth => $monthName) {
         $cells = wf_TableCell($eachMonth);
         $monthLink = wf_Link(self::URL_REPORTS_MGMT . 'reportSignup&month=' . $showYear . '-' . $eachMonth, rcms_date_localise($monthName), false);
         $cells .= wf_TableCell($monthLink);
         $cells .= wf_TableCell($monthCount[$eachMonth]);
         $cells .= wf_TableCell(web_bar($monthCount[$eachMonth], $yearCount));
         $rows .= wf_TableRow($cells, 'row3');
     }
     $result = wf_TableBody($rows, '100%', 0, 'sortable');
     $result .= __('Total') . ': ' . $yearCount;
     show_window(__('User signups by year') . ' ' . $showYear, $result);
     //render per month registrations
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Date'));
     $cells .= wf_TableCell(__('Full address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('Tariff'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($regdates)) {
         foreach ($regdates as $eachRegDate => $eachRegUsers) {
             if (ispos($eachRegDate, $showMonth)) {
                 foreach ($eachRegUsers as $ix => $eachUserId) {
                     $cells = wf_TableCell($eachUserId);
                     $cells .= wf_TableCell($this->users[$eachUserId]['regdate']);
                     $userLink = wf_Link(self::URL_USERS_PROFILE . $eachUserId, web_profile_icon() . ' ', false);
                     $cells .= wf_TableCell($userLink . $this->userGetFullAddress($eachUserId));
                     $cells .= wf_TableCell($this->users[$eachUserId]['realname']);
                     $cells .= wf_TableCell(@$this->tariffs[$this->users[$eachUserId]['tariffid']]['tariffname']);
                     $rows .= wf_TableRow($cells, 'row3');
                 }
             }
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     if ($showMonth == curmonth()) {
         $monthTitle = __('Current month user signups');
     } else {
         $monthTitle = __('User signups by month') . ' ' . $showMonth;
     }
     show_window($monthTitle, $result);
 }
Example #26
0
    function zb_SpeedControlGetOverrideUsers()
    {
        $query = "SELECT `login` from `userspeeds` WHERE `speed` NOT LIKE '0'";
        $alloverrides = simple_queryall($query);
        $result = array();
        if (!empty($alloverrides)) {
            foreach ($alloverrides as $io => $eachoverride) {
                $result[] = $eachoverride;
            }
        }
        return $result;
    }
    function zb_SpeedControlFix($login)
    {
    }
    //fixing speed override
    if (isset($_GET['fix'])) {
        $login = vf($_GET['fix']);
        $speed = 0;
        zb_UserDeleteSpeedOverride($login);
        zb_UserCreateSpeedOverride($login, $speed);
        log_register("SPEEDFIX (" . $login . ")");
        $billing->resetuser($login);
        log_register("RESET User (" . $login . ")");
        rcms_redirect("?module=speedcontrol");
    }
    $alloverrides = zb_SpeedControlGetOverrideUsers();
    show_window(__('Users with speed overrides'), web_UsersLister($alloverrides));
} else {
    show_error(__('You cant control this module'));
}
Example #27
0
                 $terminator->EditForm($term_id);
             }
         }
     }
     //vlangen patch end
 } else {
     //show editing form
     $nasid = vf($_GET['edit']);
     //if someone editing nas
     if (wf_CheckPost(array('editnastype'))) {
         $targetnas = "WHERE `id` = '" . $nasid . "'";
         $nastype = vf($_POST['editnastype']);
         $nasip = mysql_real_escape_string($_POST['editnasip']);
         $nasname = mysql_real_escape_string($_POST['editnasname']);
         $nasbwdurl = mysql_real_escape_string($_POST['editnasbwdurl']);
         $netid = vf($_POST['networkselect']);
         simple_update_field('nas', 'nastype', $nastype, $targetnas);
         simple_update_field('nas', 'nasip', $nasip, $targetnas);
         simple_update_field('nas', 'nasname', $nasname, $targetnas);
         simple_update_field('nas', 'bandw', $nasbwdurl, $targetnas);
         simple_update_field('nas', 'netid', $netid, $targetnas);
         zb_NasConfigSave();
         log_register("NAS EDIT " . $nasip);
         rcms_redirect("?module=nas&edit=" . $nasid);
     }
     $nasdata = zb_NasGetData($nasid);
     $currentnetid = $nasdata['netid'];
     $currentnasip = $nasdata['nasip'];
     $currentnasname = $nasdata['nasname'];
     $currentnastype = $nasdata['nastype'];
     $currentbwdurl = $nasdata['bandw'];
Example #28
0
/**
 * Parsing of FDB port table SNMP raw data for some exotic Dlink switches
 * 
 * @param   $portTable raw SNMP data
 * 
 * @return  array
 */
function sp_SnmpParseFdbDl($portTable)
{
    $portData = array();
    $arr_PortTable = explodeRows($portTable);
    if (!empty($arr_PortTable)) {
        foreach ($arr_PortTable as $eachEntry) {
            if (!empty($eachEntry)) {
                $eachEntry = str_replace('.1.3.6.1.2.1.17.7.1.2.2.1.2', '', $eachEntry);
                $cleanMac = '';
                $rawMac = explode('=', $eachEntry);
                $parts = array('format' => '%02X:%02X:%02X:%02X:%02X:%02X') + explode('.', trim($rawMac[0], '.'));
                unset($parts[0]);
                if (count($parts) == 7) {
                    $cleanMac = call_user_func_array('sprintf', $parts);
                    $portData[strtolower($cleanMac)] = vf($rawMac[1], 3);
                }
            }
        }
    }
    return $portData;
}
Example #29
0
 /**
  * saves new passport data for some build
  * 
  * @return void
  */
 protected function savePassport()
 {
     if (wf_CheckPost(array('savebuildpassport'))) {
         $buildid = vf($_POST['savebuildpassport'], 3);
         // Yep, im know - thats shitty solution. Need to refactor this later.
         $clean_query = "DELETE FROM `buildpassport` WHERE `buildid`='" . $buildid . "';";
         nr_query($clean_query);
         $owner = mysql_real_escape_string($_POST['powner']);
         $ownername = mysql_real_escape_string($_POST['pownername']);
         $ownerphone = mysql_real_escape_string($_POST['pownerphone']);
         $ownercontact = mysql_real_escape_string($_POST['pownercontact']);
         $keys = isset($_POST['pkeys']) ? 1 : 0;
         $accessnotices = mysql_real_escape_string($_POST['paccessnotices']);
         $floors = mysql_real_escape_string($_POST['pfloors']);
         $entrances = mysql_real_escape_string($_POST['pentrances']);
         $apts = mysql_real_escape_string($_POST['papts']);
         $notes = mysql_real_escape_string($_POST['pnotes']);
         $query = "INSERT INTO `buildpassport` (\n                                `id` ,\n                                `buildid` ,\n                                `owner` ,\n                                `ownername` ,\n                                `ownerphone` ,\n                                `ownercontact` ,\n                                `keys` ,\n                                `accessnotices` ,\n                                `floors` ,\n                                `apts` ,\n                                `entrances` ,\n                                `notes`\n                                )\n                                VALUES (\n                                NULL ,\n                                '" . $buildid . "',\n                                '" . $owner . "',\n                                '" . $ownername . "',\n                                '" . $ownerphone . "',\n                                '" . $ownercontact . "',\n                                '" . $keys . "',\n                                '" . $accessnotices . "',\n                                '" . $floors . "',\n                                '" . $apts . "',\n                                '" . $entrances . "',\n                                '" . $notes . "'\n                                );\n                        ";
         nr_query($query);
         log_register('BUILD PASSPORT SAVE [' . $buildid . ']');
     }
 }
Example #30
-1
 /**
  * Fills cemetary log with some data
  * 
  * @param string $login
  * @param int $state
  * 
  * @return void
  */
 protected function logFuneral($login, $state)
 {
     $state = vf($state, 3);
     $date = curdatetime();
     $loginF = mysql_real_escape_string($login);
     $query = "INSERT INTO `cemetery` (`id`,`login`,`state`,`date`) VALUES (NULL,'" . $loginF . "','" . $state . "','" . $date . "'); ";
     nr_query($query);
     log_register('CEMETERY (' . $login . ') SET `' . $state . '`');
 }