Ejemplo n.º 1
0
/**
 * Generates ghaph images links:
 * 
 * @param   str    $ip      User's IP address, for whitch links are generated
 * @return  array           Graph links
 */
function zb_BandwidthdGenLinks($ip)
{
    $bandwidthd_url = zb_BandwidthdGetUrl($ip);
    $netid = zb_NetworkGetByIp($ip);
    $nasid = zb_NasGetByNet($netid);
    $nasdata = zb_NasGetData($nasid);
    $nastype = $nasdata['nastype'];
    // RouterOS graph model:
    if ($nastype == 'mikrotik') {
        // Get user's IP array:
        $alluserips = zb_UserGetAllIPs();
        $alluserips = array_flip($alluserips);
        // Generate graphs paths:
        $urls['dayr'] = $bandwidthd_url . '/' . $alluserips[$ip] . '/daily.gif';
        $urls['days'] = null;
        $urls['weekr'] = $bandwidthd_url . '/' . $alluserips[$ip] . '/weekly.gif';
        $urls['weeks'] = null;
        $urls['monthr'] = $bandwidthd_url . '/' . $alluserips[$ip] . '/monthly.gif';
        $urls['months'] = null;
        $urls['yearr'] = $bandwidthd_url . '/' . $alluserips[$ip] . '/yearly.gif';
        $urls['years'] = null;
    } else {
        // Banwidthd graphs model:
        $urls['dayr'] = $bandwidthd_url . '/' . $ip . '-1-R.png';
        $urls['days'] = $bandwidthd_url . '/' . $ip . '-1-S.png';
        $urls['weekr'] = $bandwidthd_url . '/' . $ip . '-2-R.png';
        $urls['weeks'] = $bandwidthd_url . '/' . $ip . '-2-S.png';
        $urls['monthr'] = $bandwidthd_url . '/' . $ip . '-3-R.png';
        $urls['months'] = $bandwidthd_url . '/' . $ip . '-3-S.png';
        $urls['yearr'] = $bandwidthd_url . '/' . $ip . '-4-R.png';
        $urls['years'] = $bandwidthd_url . '/' . $ip . '-4-S.png';
    }
    return $urls;
}
Ejemplo n.º 2
0
function ra_UserRebuild($login, $verbose = false)
{
    $login = mysql_real_escape_string($login);
    $userip = zb_UserGetIP($login);
    $netid = zb_NetworkGetByIp($userip);
    $nasid = zb_NasGetByNet($netid);
    $nastemplate = ra_NasGetTemplate($nasid);
    $alluserdata = zb_TemplateGetAllUserData();
    $parsed_template = zb_TemplateReplace($login, $nastemplate, $alluserdata);
    ra_UserRebuildAttributes($login, $parsed_template, $verbose);
    log_register("RADIUST REBUILD (" . $login . ")");
}