Subversion Repositories ALCASAR

Rev

Rev 2972 | Rev 3028 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2972 Rev 2979
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: network.php 2972 2021-07-14 22:39:09Z rexy $
2
# $Id: network.php 2979 2021-07-22 20:14:04Z rexy $
3
 
3
 
4
// written by steweb57, Rexy, Tom HOUDAYER & Pierre RIVAULT
4
// written by steweb57, Rexy, Tom HOUDAYER & Pierre RIVAULT
5
 
5
 
6
/********************
6
/********************
7
*  READ CONF FILES  *
7
*  READ CONF FILES  *
Line 436... Line 436...
436
                $ext_conf_error_list[] = $l_error.': Proxy: '.$l_error_bad_ip_port;
436
                $ext_conf_error_list[] = $l_error.': Proxy: '.$l_error_bad_ip_port;
437
            }
437
            }
438
            file_put_contents(TEMP_FILE, str_replace('PROXY_IP='.$conf['PROXY_IP'], 'PROXY_IP='.trim($_POST['proxy']), file_get_contents(TEMP_FILE)));
438
            file_put_contents(TEMP_FILE, str_replace('PROXY_IP='.$conf['PROXY_IP'], 'PROXY_IP='.trim($_POST['proxy']), file_get_contents(TEMP_FILE)));
439
            $modification_proxy = true;
439
            $modification_proxy = true;
440
        }
440
        }
441
        if ($conf['MULTIWAN'] !== 'Off')
441
        if ($conf['MULTIWAN'] !== 'off')
442
        {
442
        {
443
            file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=Off', file_get_contents(TEMP_FILE)));
443
            file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=off', file_get_contents(TEMP_FILE)));
444
            $modification_network = true;
444
            $modification_network = true;
445
        }
445
        }
446
    }
446
    }
447
    else
447
    else
448
    {
448
    {
449
        //set multiwan value to off and delete every "WANx=" line
449
        //set multiwan value to off and delete every "WANx=" line
450
        if ($_POST['gw_count'] === "1" && $conf['MULTIWAN'] !== 'Off')
450
        if ($_POST['gw_count'] === "1" && $conf['MULTIWAN'] !== 'off')
451
        {
451
        {
452
            file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=Off', file_get_contents(TEMP_FILE)));
452
            file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=off', file_get_contents(TEMP_FILE)));
453
            $temp = 1;
453
            $temp = 1;
454
            while (isset($conf['WAN'.$temp]))
454
            while (isset($conf['WAN'.$temp]))
455
            {
455
            {
456
                file_put_contents(TEMP_FILE, str_replace('WAN'.$temp.'='.$conf['WAN'.$temp]."\n", '', file_get_contents(TEMP_FILE)));
456
                file_put_contents(TEMP_FILE, str_replace('WAN'.$temp.'='.$conf['WAN'.$temp]."\n", '', file_get_contents(TEMP_FILE)));
457
                $temp++;
457
                $temp++;
Line 498... Line 498...
498
                    $ext_conf_error = true;
498
                    $ext_conf_error = true;
499
                    $ext_conf_error_list[] = $l_error.': '.$l_gw_weight.' 1: '.$l_error_weight;
499
                    $ext_conf_error_list[] = $l_error.': '.$l_gw_weight.' 1: '.$l_error_weight;
500
                }
500
                }
501
                file_put_contents(TEMP_FILE, str_replace('PUBLIC_WEIGHT='.$conf['PUBLIC_WEIGHT'], 'PUBLIC_WEIGHT='.(($_POST['weight'] !== '')?$_POST['weight']:1), file_get_contents(TEMP_FILE)));
501
                file_put_contents(TEMP_FILE, str_replace('PUBLIC_WEIGHT='.$conf['PUBLIC_WEIGHT'], 'PUBLIC_WEIGHT='.(($_POST['weight'] !== '')?$_POST['weight']:1), file_get_contents(TEMP_FILE)));
502
                //Set Multiwan status
502
                //Set Multiwan status
503
                file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], "MULTIWAN=On\nWAN1=", file_get_contents(TEMP_FILE)));
503
                file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], "MULTIWAN=on\nWAN1=", file_get_contents(TEMP_FILE)));
504
                //Adding the correct number of "WANx=" lines, numbered
504
                //Adding the correct number of "WANx=" lines, numbered
505
                for($i=2;$i<$_POST['gw_count'];$i++)
505
                for($i=2;$i<$_POST['gw_count'];$i++)
506
                {
506
                {
507
                    file_put_contents(TEMP_FILE, str_replace('WAN'.($i-1).'=', 'WAN'.($i-1)."=\nWAN".$i.'=', file_get_contents(TEMP_FILE)));
507
                    file_put_contents(TEMP_FILE, str_replace('WAN'.($i-1).'=', 'WAN'.($i-1)."=\nWAN".$i.'=', file_get_contents(TEMP_FILE)));
508
                }
508
                }
Line 524... Line 524...
524
        }
524
        }
525
        //set proxy value to off
525
        //set proxy value to off
526
        if ($conf['PROXY'] !== 'Off')
526
        if ($conf['PROXY'] !== 'Off')
527
        {
527
        {
528
            file_put_contents(TEMP_FILE, str_replace('PROXY='.$conf['PROXY'], 'PROXY=Off', file_get_contents(TEMP_FILE)));
528
            file_put_contents(TEMP_FILE, str_replace('PROXY='.$conf['PROXY'], 'PROXY=Off', file_get_contents(TEMP_FILE)));
529
            if($_POST['gw_count'] !== "1" && $conf['MULTIWAN'] !== 'On') {
529
            if($_POST['gw_count'] !== "1" && $conf['MULTIWAN'] !== 'on') {
530
                file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=On', file_get_contents(TEMP_FILE)));
530
                file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=on', file_get_contents(TEMP_FILE)));
531
                $modification_network = true;
531
                $modification_network = true;
532
            }
532
            }
533
            $modification_proxy = true;
533
            $modification_proxy = true;
534
        }
534
        }
535
    }
535
    }