| 1 | <?php
|
| 2 |
|
| 3 | /*
|
| 4 |
|
| 5 | Copyright (C) 2009, All Rights Reserved.
|
| 6 |
|
| 7 | This file is part of RPInventory.
|
| 8 |
|
| 9 | RPInventory is free software: you can redistribute it and/or modify
|
| 10 | it under the terms of the GNU General Public License as published by
|
| 11 | the Free Software Foundation, either version 3 of the License, or
|
| 12 | (at your option) any later version.
|
| 13 |
|
| 14 | RPInventory is distributed in the hope that it will be useful,
|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 | GNU General Public License for more details.
|
| 18 |
|
| 19 | You should have received a copy of the GNU General Public License
|
| 20 | along with RPInventory. If not, see <http://www.gnu.org/licenses/>.
|
| 21 |
|
| 22 | */
|
| 23 |
|
| 24 | require_once('lib/auth.lib.php');
|
| 25 |
|
| 26 | switch ($_GET['operation'])
|
| 27 | {
|
| 28 | case 'locations':
|
| 29 | require_once( 'lib/locations.lib.php' );
|
| 30 |
|
| 31 | print getLocationsOptions();
|
| 32 | break;
|
| 33 |
|
| 34 | case 'businesses':
|
| 35 | require_once( 'lib/businesses.lib.php' );
|
| 36 |
|
| 37 | print getBusinessesOptions();
|
| 38 | break;
|
| 39 |
|
| 40 | case 'loanlocations':
|
| 41 | require_once( 'lib/locations.lib.php' );
|
| 42 |
|
| 43 | print getLoanLocationsOptions();
|
| 44 | break;
|
| 45 |
|
| 46 | case 'savelocation':
|
| 47 | require_once( 'lib/locations.lib.php' );
|
| 48 |
|
| 49 | print insertLocation($_GET['location'], $_GET['description']);
|
| 50 | break;
|
| 51 |
|
| 52 | case 'saveBusiness':
|
| 53 | require_once( 'lib/businesses.lib.php' );
|
| 54 |
|
| 55 | print insertBusiness($_POST['company_name'], $_POST['address'], $_POST['address2'],
|
| 56 | $_POST['city'], $_POST['state'], $_POST['zipcode'], $_POST['phone'],
|
| 57 | $_POST['fax_number'], $_POST['email'], $_POST['website']);
|
| 58 | break;
|
| 59 |
|
| 60 | case 'saveBorrower':
|
| 61 | require_once( 'lib/borrowers.lib.php' );
|
| 62 |
|
| 63 | insertBorrower($_GET['borrower_name'], $_GET['rin'], $_GET['email'],
|
| 64 | $_GET['address'], $_GET['address2'], $_GET['city'],
|
| 65 | $_GET['state'], $_GET['zipcode'], $_GET['phone']);
|
| 66 | break;
|
| 67 |
|
| 68 | case 'username':
|
| 69 | require_once( 'lib/users.lib.php' );
|
| 70 |
|
| 71 | print getUsernames( $_GET['name'] );
|
| 72 | break;
|
| 73 |
|
| 74 | case 'borrowerNames':
|
| 75 | require_once( 'lib/borrowers.lib.php' );
|
| 76 |
|
| 77 | print getBorrowerNames( $_GET['name'] );
|
| 78 | break;
|
| 79 |
|
| 80 | case 'insertCategory':
|
| 81 | require_once( 'lib/categories.lib.php' );
|
| 82 |
|
| 83 | print insertCategory($_GET['category_name']);
|
| 84 | break;
|
| 85 |
|
| 86 | case 'options':
|
| 87 | require_once( 'lib/display.lib.php' );
|
| 88 |
|
| 89 | print get_options($_GET['table_name'], $_GET['value_column'], $_GET['display_column']);
|
| 90 | break;
|
| 91 |
|
| 92 | case 'itemCategoryIDs':
|
| 93 | require_once( 'lib/categories.lib.php' );
|
| 94 |
|
| 95 | if(isset($_POST['store']))
|
| 96 | print get_item_category_ids($_POST['inventory_id'], $_POST['store']);
|
| 97 | else
|
| 98 | print get_item_category_ids($_POST['inventory_id']);
|
| 99 | break;
|
| 100 |
|
| 101 | case 'borrowerIdFromName':
|
| 102 | require_once( 'lib/borrowers.lib.php' );
|
| 103 |
|
| 104 | print getBorrowerId($_GET['name'], $_GET['club_id']);
|
| 105 | break;
|
| 106 |
|
| 107 | case 'addUserToClub':
|
| 108 | require_once('lib/users.lib.php');
|
| 109 |
|
| 110 | $userId = $_GET['userId'];
|
| 111 | $access = $_GET['access'];
|
| 112 | $club_id = $_GET['club_id'];
|
| 113 |
|
| 114 | addUserToClub($userId, $club_id, $access);
|
| 115 |
|
| 116 | break;
|
| 117 |
|
| 118 | case 'alterUserClubAccess':
|
| 119 | require_once('class/database.class.php');
|
| 120 | require_once('lib/clubs.lib.php');
|
| 121 |
|
| 122 | $db = new database();
|
| 123 |
|
| 124 | $user_id = (int)$_GET['user_id'];
|
| 125 | $club_id = (int)$_GET['club_id'];
|
| 126 | $access_level = (int)$_GET['access_level'];
|
| 127 |
|
| 128 | echo alterUserClubAccess($user_id, $club_id, $access_level, $db);
|
| 129 |
|
| 130 | $db->close();
|
| 131 | break;
|
| 132 | }
|
| 133 |
|
| 134 |
|
| 135 | ?>
|
| 136 | |