/**
  * Cemetery controls 
  * 
  * @return string
  */
 protected function getCemeteryControls()
 {
     $result = '';
     if (isset($this->alterCfg['CEMETERY_ENABLED'])) {
         if ($this->alterCfg['CEMETERY_ENABLED']) {
             $cemetery = new Cemetery();
             //integrated controller
             if (wf_CheckPost(array('cemeterysetasundead'))) {
                 $cemetery->setUndead($_POST['cemeterysetasundead']);
                 rcms_redirect('?module=userprofile&username='******'cemeterysetasdead'))) {
                 $cemetery->setDead($_POST['cemeterysetasdead']);
                 rcms_redirect('?module=userprofile&username='******'skins/dead_icon.png', '', '12', '12'), __('User lifestory'), $cemetery->renderCemeteryLog($this->login));
                 $result = ' / ' . __('Subscriber is not connected') . ' ' . $log;
             } else {
                 $log = wf_modalAuto(wf_img_sized('skins/pigeon_icon.png', '', '12', '12'), __('User lifestory'), $cemetery->renderCemeteryLog($this->login));
                 $result = ' / ' . __('Subscriber is connected') . ' ' . $log;
             }
         }
     }
     return $result;
 }
Exemple #2
0
 /**
  * Shows signups by another year-month
  * 
  * @global object $altercfg
  * @param string $cmonth
  * 
  * @return void
  */
 function web_SignupsShowAnotherYearMonth($cmonth)
 {
     global $altercfg;
     $alltariffs = zb_TariffsGetAllUsers();
     $cmonth = mysql_real_escape_string($cmonth);
     $where = "WHERE `date` LIKE '" . $cmonth . "%' ORDER by `date` DESC;";
     $signups = zb_SignupsGet($where);
     $curdate = curdate();
     //cemetery hide processing
     $ignoreUsers = array();
     if ($altercfg['CEMETERY_ENABLED']) {
         $cemetery = new Cemetery();
         $ignoreUsers = $cemetery->getAllTagged();
     }
     $tablecells = wf_TableCell(__('ID'));
     $tablecells .= wf_TableCell(__('Date'));
     $tablecells .= wf_TableCell(__('Administrator'));
     if ($altercfg['SIGREP_CONTRACT']) {
         $tablecells .= wf_TableCell(__('Contract'));
         $allcontracts = array_flip(zb_UserGetAllContracts());
     }
     $tablecells .= wf_TableCell(__('Login'));
     $tablecells .= wf_TableCell(__('Tariff'));
     $tablecells .= wf_TableCell(__('Full address'));
     $tablerows = wf_TableRow($tablecells, 'row1');
     if (!empty($signups)) {
         foreach ($signups as $io => $eachsignup) {
             $tablecells = wf_TableCell($eachsignup['id']);
             $tablecells .= wf_TableCell($eachsignup['date']);
             $tablecells .= wf_TableCell($eachsignup['admin']);
             if ($altercfg['SIGREP_CONTRACT']) {
                 $tablecells .= wf_TableCell(@$allcontracts[$eachsignup['login']]);
             }
             $tablecells .= wf_TableCell($eachsignup['login']);
             @($sigTariff = $alltariffs[$eachsignup['login']]);
             $tablecells .= wf_TableCell($sigTariff);
             $profilelink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $eachsignup['address']);
             $tablecells .= wf_TableCell($profilelink);
             if (ispos($eachsignup['date'], $curdate)) {
                 $rowClass = 'todaysig';
             } else {
                 $rowClass = 'row3';
             }
             //cemetary user
             if (isset($ignoreUsers[$eachsignup['login']])) {
                 $rowClass = 'sigcemeteryuser';
             }
             //ugly check - is user removed?
             if (empty($sigTariff)) {
                 $rowClass = 'sigdeleteduser';
             }
             $tablerows .= wf_TableRow($tablecells, $rowClass);
         }
     }
     $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
     show_window(__('User signups by month') . ' ' . $cmonth, $result);
 }
 /**
  * Renders table for corps users payments/fees stats
  * 
  * @param array $fundsFlows
  * @param array $corpsData
  * @param array $corpUsers
  * @param array $allUserTariffs
  * @param array $allUserContracts
  * 
  * @return string
  */
 public function renderCorpsFlows($num, $fundsFlows, $corpsData, $corpUsers, $allUserContracts, $allUsersCash, $allUserTariffs, $allTariffPrices)
 {
     $result = '';
     $rawData = array();
     $rawData['balance'] = 0;
     $rawData['payments'] = 0;
     $rawData['paymentscorr'] = 0;
     $rawData['fees'] = 0;
     $rawData['login'] = '';
     $rawData['contract'] = '';
     $rawData['corpid'] = '';
     $rawData['corpname'] = '';
     $rawData['balance'] = 0;
     $rawData['used'] = 0;
     //cemetery dead-hide processing
     $ignoreArr = array();
     if ($this->alterConf['CEMETERY_ENABLED']) {
         $cemetery = new Cemetery();
         $ignoreArr = $cemetery->getAllTagged();
     }
     if (!empty($fundsFlows)) {
         foreach ($fundsFlows as $io => $eachop) {
             if ($eachop['operation'] == 'Fee') {
                 $rawData['fees'] = $rawData['fees'] + abs($eachop['summ']);
             }
             if ($eachop['operation'] == 'Payment') {
                 $rawData['payments'] = $rawData['payments'] + abs($eachop['summ']);
             }
             if ($eachop['operation'] == 'Correcting') {
                 $rawData['paymentscorr'] = $rawData['paymentscorr'] + abs($eachop['summ']);
             }
         }
         $rawData['login'] = $eachop['login'];
         if (!isset($ignoreArr[$rawData['login']])) {
             @($rawData['contract'] = array_search($eachop['login'], $allUserContracts));
             @($rawData['corpid'] = $corpUsers[$eachop['login']]);
             @($rawData['corpname'] = $corpsData[$rawData['corpid']]['corpname']);
             $rawData['balance'] = $allUsersCash[$eachop['login']];
             $rawData['used'] = $rawData['fees'];
             //forming result
             $cells = wf_TableCell($num);
             $corpLink = wf_Link('?module=corps&show=corps&editid=' . $rawData['corpid'], $rawData['corpname'], false, '');
             $cells .= wf_TableCell($corpLink);
             if ($rawData['contract']) {
                 $loginLink = wf_Link('?module=userprofile&username='******'login'], $rawData['contract'], false, '');
             } else {
                 $loginLink = wf_Link('?module=userprofile&username='******'login'], $rawData['login'], false, '');
             }
             $cells .= wf_TableCell($loginLink);
             $cells .= wf_TableCell(@$allTariffPrices[$allUserTariffs[$rawData['login']]]);
             $cells .= wf_TableCell(round($rawData['payments'], 2));
             $cells .= wf_TableCell(round($rawData['paymentscorr'], 2));
             $cells .= wf_TableCell(round($rawData['balance'], 2));
             $cells .= wf_TableCell(round($rawData['used'], 2));
             $result .= wf_TableRow($cells, 'row3');
         }
     }
     return $result;
 }
Exemple #4
0
 function web_TsmsMassendConfirm($userarray)
 {
     global $td_users, $td_mobiles, $td_realnames, $td_realnamestrans, $td_tariffprices, $td_alladdress;
     global $ubillingConfig;
     $altCfg = $ubillingConfig->getAlter();
     $template = tsms_GetTemplate();
     $excludeUsers = tsms_GetExcludeUsers();
     $excludeArr = array();
     //ignoring DEAD_TAGID users
     if ($altCfg['CEMETERY_ENABLED']) {
         $cemetery = new Cemetery();
         $excludeCemetery = $cemetery->getAllTagged();
         if (!empty($excludeCemetery)) {
             foreach ($excludeCemetery as $eecl => $eecld) {
                 $excludeUsers[$eecl] = 'NOP';
             }
         }
     }
     $cells = wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('SMS'));
     $cells .= wf_TableCell(__('Mobile'));
     $cells .= wf_TableCell(__('Tariff'));
     $cells .= wf_TableCell(__('Balance'));
     $cells .= wf_TableCell(__('Credit'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($userarray)) {
         //excluded users handling
         if (!empty($excludeUsers)) {
             $excludeResult = wf_tag('h3') . __('Next users will be ignored while SMS sending') . wf_tag('h3', true);
             foreach ($excludeUsers as $excludeLogin => $nop) {
                 unset($userarray[$excludeLogin]);
                 $excludeArr[$excludeLogin] = $excludeLogin;
             }
         } else {
             $excludeResult = '';
         }
         foreach ($userarray as $login => $phone) {
             $message = tsms_ParseTemplate($login, $template);
             $smsContainer = wf_modal(__('Show'), __('SMS'), $message, '', '300', '200');
             $cells = wf_TableCell(wf_Link("?module=userprofile&username="******"", 'POST', $inputs, 'glamour');
     $result = $confirmForm;
     $result .= wf_TableBody($rows, '100%', '0', 'sortable');
     //showing which users will be excluded
     if (!empty($excludeUsers)) {
         $result .= $excludeResult;
         $result .= web_UserArrayShower($excludeArr);
     }
     return $result;
 }
Exemple #5
0
/**
 * Performs an user registration
 * 
 * @global object $billing
 * @param array $user_data
 * @param bool $goprofile
 */
function zb_UserRegister($user_data, $goprofile = true)
{
    global $billing;
    // Init all of needed user data
    $login = vf($user_data['login']);
    $login = zb_RegLoginFilter($login);
    $password = vf($user_data['password']);
    $ip = $user_data['IP'];
    $cityid = $user_data['city'];
    $streetid = $user_data['street'];
    $buildid = $user_data['build'];
    @($entrance = $user_data['entrance']);
    @($floor = $user_data['floor']);
    $apt = $user_data['apt'];
    $serviceid = $user_data['service'];
    $netid = multinet_get_service_networkid($serviceid);
    $busylogins = zb_AllBusyLogins();
    //check login lenght
    $maxStLen = 42;
    $loginLen = strlen($login);
    if ($loginLen > $maxStLen) {
        log_register("HUGELOGIN REGISTER TRY (" . $login . ")");
        $alert = __('Attention generated login longer than') . ' ' . $maxStLen . ' ' . __('bytes') . '. (' . $login . ' > ' . $loginLen . ') ' . __('And is not compatible with Stargazer') . '.';
        die($alert);
    }
    // empty login validation
    if (empty($login)) {
        $alert = wf_tag('script', false, '', 'type="text/javascript"');
        $alert .= 'alert("' . __('Error') . ': ' . __('Empty login') . '");';
        $alert .= wf_tag('script', true);
        print $alert;
        rcms_redirect("?module=userreg");
        die;
    }
    //duplicate login validation
    if (isset($busylogins[$login])) {
        $alert = wf_tag('script', false, '', 'type="text/javascript"');
        $alert .= 'alert("' . __('Error') . ': ' . __('Duplicate login') . '");';
        $alert .= wf_tag('script', true);
        print $alert;
        rcms_redirect("?module=userreg");
        die;
    }
    //last check
    if (!zb_ip_unique($ip)) {
        $alert = wf_tag('script', false, '', 'type="text/javascript"');
        $alert .= 'alert("' . __('Error') . ': ' . __('This IP is already used by another user') . '");';
        $alert .= wf_tag('script', true);
        print $alert;
        rcms_redirect("?module=userreg");
        die;
    }
    // registration subroutine
    $billing->createuser($login);
    log_register("StgUser REGISTER (" . $login . ")");
    $billing->setpassword($login, $password);
    log_register("StgUser (" . $login . ") PASSWORD `" . $password . "`");
    $billing->setip($login, $ip);
    log_register("StgUser (" . $login . ") IP `" . $ip . "`");
    zb_AddressCreateApartment($buildid, $entrance, $floor, $apt);
    zb_AddressCreateAddress($login, zb_AddressGetLastid());
    multinet_add_host($netid, $ip);
    zb_UserCreateRealName($login, '');
    zb_UserCreatePhone($login, '', '');
    zb_UserCreateContract($login, '');
    zb_UserCreateEmail($login, '');
    zb_UserCreateSpeedOverride($login, 0);
    zb_UserRegisterLog($login);
    // if random mac needed
    $billingconf = rcms_parse_ini_file(CONFIG_PATH . '/billing.ini');
    $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    if ($billingconf['REGRANDOM_MAC']) {
        // funny random mac, yeah? :)
        $mac = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99);
        multinet_change_mac($ip, $mac);
        multinet_rebuild_all_handlers();
    }
    // if AlwaysOnline to new user needed
    if ($billingconf['REGALWONLINE']) {
        $alwaysonline = 1;
        $billing->setao($login, $alwaysonline);
        log_register('CHANGE AlwaysOnline (' . $login . ') ON ' . $alwaysonline);
    }
    // if we want to disable detailed stats to new user by default
    if ($billingconf['REGDISABLEDSTAT']) {
        $dstat = 1;
        $billing->setdstat($login, $dstat);
        log_register('CHANGE dstat (' . $login . ') ON ' . $dstat);
    }
    //set contract same as login for this user
    if (isset($alterconf['CONTRACT_SAME_AS_LOGIN'])) {
        if ($alterconf['CONTRACT_SAME_AS_LOGIN']) {
            $newUserContract = $login;
            zb_UserChangeContract($login, $newUserContract);
        }
    }
    //cemetery processing
    if (isset($alterconf['CEMETERY_ENABLED'])) {
        if ($alterconf['CEMETERY_ENABLED']) {
            if ($alterconf['CEMETERY_ENABLED'] == 2) {
                $cemetery = new Cemetery(false);
                $cemetery->setDead($login);
            }
        }
    }
    //contract autogeneration
    if (isset($alterconf['CONTRACT_AUTOGEN'])) {
        if ($alterconf['CONTRACT_AUTOGEN']) {
            $contract_proposal = '';
            $allcontracts = zb_UserGetAllContracts();
            $top_offset = 100000;
            //contract generation mode default
            if ($alterconf['CONTRACT_GENERATION_DEFAULT']) {
                for ($i = 1; $i < $top_offset; $i++) {
                    if (!isset($allcontracts[$i])) {
                        $contract_proposal = $i;
                        break;
                    }
                }
            } else {
                //alternate generation method
                $max_contract = max(array_keys($allcontracts));
                $contract_proposal = $max_contract + 1;
            }
            //setting generated contract to new user
            if (!isset($allcontracts[$contract_proposal])) {
                $contractDate = date("Y-m-d");
                zb_UserChangeContract($login, $contract_proposal);
                zb_UserContractDateCreate($contract_proposal, $contractDate);
            }
        }
    }
    ///////////////////////////////////
    if ($goprofile) {
        rcms_redirect("?module=userprofile&username=" . $login);
    }
}