/**
  * processing of old user linking with redirects to parent user
  * 
  * @return string
  */
 protected function getUserLinking()
 {
     $result = '';
     if ($this->alterCfg['USER_LINKING_ENABLED']) {
         $alllinkedusers = cu_GetAllLinkedUsers();
         if (isset($alllinkedusers[$this->login])) {
             $parent_login = cu_GetParentUserLogin($alllinkedusers[$this->login]);
             $result = wf_Link('?module=corporate&userlink=' . $alllinkedusers[$this->login], wf_img('skins/corporate_small.gif') . __('User linked with') . ': ' . @$this->alladdress[$parent_login], false, '');
         }
     }
     //check is user corporate parent?
     if ($this->alterCfg['USER_LINKING_ENABLED']) {
         $allparentusers = cu_GetAllParentUsers();
         if (isset($allparentusers[$this->login])) {
             if ($_GET['module'] != 'corporate' and $_GET['module'] != 'addcash') {
                 rcms_redirect("?module=corporate&userlink=" . $allparentusers[$this->login]);
             }
         }
     }
     return $result;
 }
Exemple #2
0
            rcms_redirect("?module=creditedit&username="******"alter.ini");
        if ($alter_conf['USER_LINKING_ENABLED']) {
            if ($alter_conf['USER_LINKING_CREDIT']) {
                if (cu_IsChild($login)) {
                    $allchildusers = cu_GetAllLinkedUsers();
                    $parent_link = $allchildusers[$login];
                    rcms_redirect("?module=corporate&userlink=" . $parent_link . "&control=credit");
                }
                if (cu_IsParent($login)) {
                    $allparentusers = cu_GetAllParentUsers();
                    $parent_link = $allparentusers[$login];
                    rcms_redirect("?module=corporate&userlink=" . $parent_link . "&control=credit");
                }
            }
        }
        // Edit form construct
        $fieldnames = array('fieldname1' => __('Current credit'), 'fieldname2' => __('New credit'));
        $fieldkey = 'newcredit';
        $form = web_EditorStringDataForm($fieldnames, $fieldkey, $useraddress, $current_credit);
        $form .= web_UserControls($login);
        show_window(__('Edit credit'), $form);
    }
} else {
    show_error(__('You cant control this module'));
}
Exemple #3
0
function bs_ProcessHash($hash)
{
    global $billing;
    $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    //corporate users handling
    if ($alterconf['USER_LINKING_ENABLED']) {
        $allparentusers = cu_GetAllParentUsers();
    }
    $query = "SELECT `id`,`summ`,`login` from `bankstaparsed` WHERE `hash`='" . $hash . "' AND `state`='0' AND `login` !=''";
    $allinprocessed = simple_queryall($query);
    if (!empty($allinprocessed)) {
        log_register("BANKSTA PROCESSING " . $hash . " START");
        foreach ($allinprocessed as $io => $eachrow) {
            //setting payment variables
            $operation = 'add';
            $cashtype = $alterconf['BS_CASHTYPE'];
            $cash = $eachrow['summ'];
            $note = mysql_real_escape_string("BANKSTA:" . $eachrow['id']);
            // CU filter subroutine
            if ($alterconf['USER_LINKING_ENABLED']) {
                if (!bs_cu_IsParent($eachrow['login'], $allparentusers)) {
                    //normal user cash
                    zb_CashAdd($eachrow['login'], $cash, $operation, $cashtype, $note);
                    simple_update_field('bankstaparsed', 'state', '1', "WHERE `id`='" . $eachrow['id'] . "'");
                } else {
                    //corporate user
                    $userlink = $allparentusers[$eachrow['login']];
                    $allchildusers = cu_GetAllChildUsers($userlink);
                    // adding natural payment to parent user
                    zb_CashAdd($eachrow['login'], $cash, $operation, $cashtype, $note);
                    simple_update_field('bankstaparsed', 'state', '1', "WHERE `id`='" . $eachrow['id'] . "'");
                    if (!empty($allchildusers)) {
                        foreach ($allchildusers as $eachchild) {
                            //adding quiet payments for child users
                            $billing->addcash($eachchild, $cash);
                            log_register("BANKSTA GROUPBALANCE " . $eachchild . " " . $operation . " ON " . $cash);
                        }
                    }
                    // end of processing with linking
                }
            } else {
                // standalone user cash push
                zb_CashAdd($eachrow['login'], $cash, $operation, $cashtype, $note);
                simple_update_field('bankstaparsed', 'state', '1', "WHERE `id`='" . $eachrow['id'] . "'");
                // end of processing without linking
            }
        }
        log_register("BANKSTA PROCESSING " . $hash . " END");
    } else {
        log_register("BANKSTA PROCESSING " . $hash . " EMPTY");
    }
}
Exemple #4
0
    function stg_show_fulluserlistOld()
    {
        global $alter_conf;
        $allusers = zb_UserGetAllStargazerData();
        $allrealnames = zb_UserGetAllRealnames();
        $alladdress = zb_AddressGetFulladdresslist();
        if ($alter_conf['USER_LINKING_ENABLED']) {
            $alllinkedusers = cu_GetAllLinkedUsers();
            $allparentusers = cu_GetAllParentUsers();
        }
        $totaltraff_i = 0;
        $totaltraff_m = 0;
        $totaltraff = 0;
        $ucount = 0;
        $trueonline = 0;
        $inacacount = 0;
        $tcredit = 0;
        $tcash = 0;
        // LAT column
        if ($alter_conf['ONLINE_LAT']) {
            $lat_col_head = wf_TableCell(__('LAT'));
            $act_offset = 1;
        } else {
            $lat_col_head = '';
            $act_offset = 0;
        }
        //online stars
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_header = wf_TableCell(__('Users online'));
            $true_online_selector = ' col_' . (5 + $act_offset) . ': "select",';
        } else {
            $true_online_header = '';
            $true_online_selector = '';
        }
        //extended filters
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $extfilters = wf_Link('javascript:showfilter();', __('Extended filters'), false);
        } else {
            $extfilters = '';
        }
        //additional finance links
        if ($alter_conf['FAST_CASH_LINK']) {
            $fastcash = true;
        } else {
            $fastcash = false;
        }
        $result = $extfilters;
        $result .= wf_tag('table', false, 'sortable', 'width="100%" id="onlineusers"');
        $headerCells = wf_TableCell(__('Full address'));
        $headerCells .= wf_TableCell(__('Real Name'));
        $headerCells .= wf_TableCell(__('IP'));
        $headerCells .= wf_TableCell(__('Tariff'));
        $headerCells .= $lat_col_head;
        $headerCells .= wf_TableCell(__('Active'));
        $headerCells .= $true_online_header;
        $headerCells .= wf_TableCell(__('Traffic'));
        $headerCells .= wf_TableCell(__('Balance'));
        $headerCells .= wf_TableCell(__('Credit'));
        $headerRow = wf_TableRow($headerCells, 'row1');
        $result .= $headerRow;
        if (!empty($allusers)) {
            foreach ($allusers as $io => $eachuser) {
                $tinet = 0;
                $ucount++;
                $cash = $eachuser['Cash'];
                $credit = $eachuser['Credit'];
                for ($classcounter = 0; $classcounter <= 9; $classcounter++) {
                    $dc = 'D' . $classcounter . '';
                    $uc = 'U' . $classcounter . '';
                    $tinet = $tinet + ($eachuser[$dc] + $eachuser[$uc]);
                }
                $totaltraff = $totaltraff + $tinet;
                $tcredit = $tcredit + $credit;
                $tcash = $tcash + $cash;
                $act = web_green_led() . ' ' . __('Yes');
                //finance check
                if ($cash < '-' . $credit) {
                    $act = web_red_led() . ' ' . __('No');
                    $inacacount++;
                }
                if ($alter_conf['ONLINE_LAT']) {
                    $user_lat = wf_TableCell(date("Y-m-d H:i:s", $eachuser['LastActivityTime']));
                } else {
                    $user_lat = '';
                }
                //online check
                if ($alter_conf['DN_ONLINE_DETECT']) {
                    if (file_exists(DATA_PATH . 'dn/' . $eachuser['login'])) {
                        $online_flag = 1;
                        $trueonline++;
                    } else {
                        $online_flag = 0;
                    }
                    $online_cell = wf_TableCell(web_bool_star($online_flag, true), '', '', 'sorttable_customkey="' . $online_flag . '"');
                } else {
                    $online_cell = '';
                    $online_flag = 0;
                }
                if ($alter_conf['ONLINE_LIGHTER']) {
                    $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" ';
                } else {
                    $lighter = '';
                }
                //user linking indicator
                if ($alter_conf['USER_LINKING_ENABLED']) {
                    //is user child?
                    if (isset($alllinkedusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $alllinkedusers[$eachuser['login']], web_corporate_icon(), false);
                    } else {
                        $corporate = '';
                    }
                    //is  user parent?
                    if (isset($allparentusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $allparentusers[$eachuser['login']], web_corporate_icon('Corporate parent'), false);
                    }
                } else {
                    $corporate = '';
                }
                //fast cash link
                if ($fastcash) {
                    $financelink = wf_Link('?module=addcash&username='******'login'] . '#profileending', wf_img('skins/icon_dollar.gif', __('Finance operations')), false);
                } else {
                    $financelink = '';
                }
                $result .= wf_tag('tr', false, 'row3', $lighter);
                $result .= wf_tag('td', false);
                $result .= wf_Link('?module=traffstats&username='******'login'], web_stats_icon(), false);
                $result .= $financelink;
                $result .= wf_Link('?module=userprofile&username='******'login'], web_profile_icon(), false);
                $result .= $corporate;
                $result .= @$alladdress[$eachuser['login']];
                $result .= wf_tag('td', true);
                $result .= wf_TableCell(@$allrealnames[$eachuser['login']]);
                $result .= wf_TableCell($eachuser['IP'], '', '', 'sorttable_customkey="' . ip2int($eachuser['IP']) . '"');
                $result .= wf_TableCell($eachuser['Tariff']);
                $result .= $user_lat;
                $result .= wf_TableCell($act);
                $result .= $online_cell;
                $result .= wf_TableCell(stg_convert_size($tinet), '', '', 'sorttable_customkey="' . $tinet . '"');
                $result .= wf_TableCell(round($eachuser['Cash'], 2));
                $result .= wf_TableCell(round($eachuser['Credit'], 2));
                $result .= wf_tag('tr', true);
            }
        }
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_counter = wf_TableCell(__('Users online') . ' ' . $trueonline);
        } else {
            $true_online_counter = null;
        }
        $result .= wf_tag('table', true);
        $footerCells = wf_TableCell(__('Total') . ': ' . $ucount);
        $footerCells .= wf_TableCell(__('Active users') . ' ' . ($ucount - $inacacount) . ' / ' . __('Inactive users') . ' ' . $inacacount);
        $footerCells .= $true_online_counter;
        $footerCells .= wf_TableCell(__('Traffic') . ': ' . stg_convert_size($totaltraff));
        $footerCells .= wf_TableCell(__('Total') . ': ' . round($tcash, 2));
        $footerCells .= wf_TableCell(__('Credit total') . ': ' . $tcredit);
        $footerRows = wf_TableRow($footerCells, 'row1');
        $result .= wf_TableBody($footerRows, '100%', '0');
        //extended filters again
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $filtercode = wf_tag('script', false, '', 'language="javascript" type="text/javascript"');
            $filtercode .= '
            //<![CDATA[
            function showfilter() {
            var onlinefilters = {
		btn: false,
          	col_' . (4 + $act_offset) . ': "select",
               ' . $true_online_selector . '
		btn_text: ">"
               }
                setFilterGrid("onlineusers",0,onlinefilters);
             }
            //]]>';
            $filtercode .= wf_tag('script', true);
        } else {
            $filtercode = '';
        }
        $result .= $filtercode;
        return $result;
    }
/**
 * Checks is some user parent for another one?
 * 
 * @param string $login
 * @return bool
 */
function cu_IsParent($login)
{
    $login = mysql_real_escape_string($login);
    $allparents = cu_GetAllParentUsers();
    if (isset($allparents[$login])) {
        return true;
    } else {
        return false;
    }
}