| <?php | |
| /******************************************************************************* | |
| * Copyright (c) 2006 Eclipse Foundation and others. | |
| * All rights reserved. This program and the accompanying materials | |
| * are made available under the terms of the Eclipse Public License v1.0 | |
| * which accompanies this distribution, and is available at | |
| * http://www.eclipse.org/legal/epl-v10.html | |
| * | |
| * Contributors: | |
| * Wayne Beaton (Eclipse Foundation)- initial API and implementation | |
| *******************************************************************************/ | |
| #***************************************************************************** | |
| # | |
| # common.php | |
| # | |
| # Author: Wayne Beaton | |
| # Date: February 16, 2006 | |
| # | |
| # Description: | |
| # This file contains functions that are used in managing resources. | |
| #**************************************************************************** | |
| function debugEcho ($_echo) | |
| { | |
| echo "<!-- " . $_echo . " -->"; | |
| } | |
| function tagType ($_membershipTag, $_alphaTag, $_industryTag, $_projectTag) | |
| { | |
| if ($_membershipTag == 1) | |
| $retVal = "Membership Level"; | |
| if ($_alphaTag == 1) | |
| $retVal = "Alphabetical"; | |
| if ($_industryTag == 1) | |
| $retVal = "Industry"; | |
| if ($_projectTag == 1) | |
| $retVal = "Project"; | |
| return $retVal; | |
| } | |
| function verified($_verifiedTag) | |
| { | |
| if ($_verifiedTag == 1) | |
| $retVal = "style=\"color:green;\""; | |
| else | |
| $retVal = "style=\"color:red;\""; | |
| return $retVal; | |
| } | |
| function memberType ($_member_type) | |
| { | |
| if ($_member_type == "SD") | |
| $retVal = "Strategic Developer"; | |
| elseif($_member_type == "SC") | |
| $retVal = "Strategic Consumer"; | |
| elseif($_member_type == "AP") | |
| $retVal = "Add-in Provider"; | |
| elseif($_member_type == "AS") | |
| $retVal = "Associate Member"; | |
| return $retVal; | |
| } | |
| function existingMemberPopulate($_tag_id) | |
| { | |
| $existingOrgArray = array(); | |
| $existingOrgQuery = "SELECT OrganizationID FROM OrganizationTags WHERE TagID = $_tag_id"; | |
| $existingOrgResult = mysql_query($existingOrgQuery); | |
| while ($existingOrgIterator = mysql_fetch_array($existingOrgResult)) | |
| { | |
| $tagID = $existingOrgIterator['OrganizationID']; | |
| $existingOrgArray[$tagID] = 1; | |
| } | |
| return $existingOrgArray; | |
| } | |
| function existingTagPopulate($_org_id) | |
| { | |
| $existingTagArray = array(); | |
| $existingTagQuery = "SELECT TagID FROM OrganizationTags WHERE OrganizationID = $_org_id"; | |
| $existingTagResult = mysql_query($existingTagQuery); | |
| while ($existingTagIterator = mysql_fetch_array($existingTagResult)) | |
| { | |
| $tagID = $existingTagIterator['TagID']; | |
| $existingTagArray[$tagID] = 1; | |
| } | |
| return $existingTagArray; | |
| } | |
| function checkExistingMembers($_org_id, $_existingOrgArray) | |
| { | |
| $retVal = ""; | |
| $testVal = $_existingOrgArray[$_org_id]; | |
| if ($testVal) | |
| { | |
| $retVal = "checked"; | |
| } | |
| return $retVal; | |
| } | |
| function checkExistingTags($_tag_id, $_existingTagArray) | |
| { | |
| $retVal = ""; | |
| $testVal = $_existingTagArray[$_tag_id]; | |
| if ($testVal) | |
| { | |
| $retVal = "checked"; | |
| } | |
| return $retVal; | |
| } | |
| function is_authorized_to_edit_resources($userid) { | |
| return in_array($userid, array('ngervais','mward','cguindon')); | |
| } | |
| if ($_SERVER['SERVER_NAME'] != 'dev.localhost') { | |
| require_once("/home/data/httpd/eclipse-php-classes/system/app.class.php"); | |
| require_once("/home/data/httpd/eclipse-php-classes/people/ldapperson.class.php"); | |
| $App = new App(); | |
| $App->runStdWebAppCacheable(); | |
| $LDAPPerson = new LDAPPerson(); | |
| $LDAPPerson = $LDAPPerson->redirectIfNotLoggedIn(); | |
| if (!is_authorized_to_edit_resources($LDAPPerson->getuid())) { | |
| header ("Location: /committers/resources/restricted.php"); | |
| exit; | |
| } | |
| } | |
| if (file_exists("/home/data/httpd/eclipse-php-classes/system/dbconnection_rw.class.php")) { | |
| require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection_rw.class.php"; | |
| $dbc = new DBConnectionRW(); | |
| $dbc->connect(); | |
| } else { | |
| $dbc = mysql_connect(null, "phoenix", "fireB!rd"); | |
| if (!$dbc) { | |
| echo( "<P>Unable to connect to the database server at this time.</P>" ); | |
| return; | |
| } | |
| mysql_select_db("local_eclipse", $dbc); | |
| } | |
| ?> |