bensnyde / phpipam-pythonlib

Python Library for PHPIPAM API
GNU General Public License v2.0
2 stars 4 forks source link

Modification to allow create_subnet to work #1

Open shelson opened 10 years ago

shelson commented 10 years ago

Hi there - thanks for this code - it's very useful!

I was wondering if you had a diff of what you changed in the php code to allow create_subnet to work without any errors? I've been digging but my php is pathetic at best so thought I would ask before burning any more time on it!

Cheers

Simon

geo75 commented 9 years ago

Hi, thx a lot for the wonderfull code. i'm wondering the same thing, im not php coder ether. i did some changes in that code but still getting errors.

Warning: Missing argument 1 for Subnets::createSubnets() called in /var/www/phpipap/api/index.php on line 113 and defined in /var/www/phpipam/api/controllers/Subnets.php on line 33

Warning: mysqli::query(): Empty query in /var/www/phpipam/functions/dbfunctions.php on line 50 {"success":true,"data":"Subnet created"}

The lins i changed in subnet.php FROM:

            if($this->allowRequests != 0 || $this->allowRequests !=1)                              { throw new Exception('Invalid allow requests value'); }*
            if($this->showName != 0 || $this->showName !=1)                                                 { throw new Exception('Invalid show Name value'); }
            if($this->pingSubnet != 0 || $this->pingSubnet !=1)                                             { throw new Exception('Invalid ping subnet value'); }

            $res = UpdateSection2 ($newSection, true);

TO:

            if($this->allowRequests != 0 && $this->allowRequests !=1)                              { throw new Exception('Invalid allow requests value'); }
            if($this->showName != 0 && $this->showName !=1)                                                 { throw new Exception('Invalid show Name value'); }
            if($this->pingSubnet != 0 && $this->pingSubnet !=1)                                             { throw new Exception('Invalid ping subnet value'); }
               $res=UpdateSection($newSection,true);