'false'); echo json_encode( $userArray ); exit; } } function createSchool( $longName, $shortName, $subdomain ){ $school = new ElggGroup(); $school->name=$shortName.' Home'; $school->parentcategory = 0; $school->subtype=0; $school->membership = elgg_echo("PUBLIC"); $school->access_id = 2; $school->save(); $home_cat=$school->guid; $schoolID=insert_data("INSERT into ct_schools(name,long_name,subdomain,home_cat) values ('$shortName','$longName','$subdomain',$home_cat)"); $categories=array("Academics","Campus Life","Clubs and Organizations","Dining","Greek Life","Housing","Sports","Social Life"); foreach ($categories as $category){ createCategory( $schoolID, $school->guid, $category ); } return $schoolID; } function createCategory( $schoolID, $parentCategory, $newCategoryName){ $category = new ElggGroup(); $category->name=$newCategoryName; $category->parentcategory = $parentCategory; $category->membership = elgg_echo("PUBLIC"); $category->access_id = 2; $category->messageboard_enable="yes"; $category->pages_enable="yes"; $category->forum_enable="yes"; $category->photos_enable="yes"; $category->event_calendar_enable="yes"; $category->event_manager_enable="yes"; $category->home_school=$schoolID; $category->save(); return $category->guid; } function getSchoolIDBySubDomain( $schoolSub ){ $row=get_data_row("SELECT id FROM ct_schools WHERE subdomain ='$schoolSub'"); return $row->id; } function getgroupId( $schoolID,$groupName ){ $categories=elgg_get_entities_from_metadata(array('metadata_name_value_pair' => array('name' => 'home_school', 'value' => $schoolID, 'operand' => '=' ),'limit' => 10000)); foreach($categories as $category ){ if($category->name==$groupName) return $category; } return null; } ?> $limit, 'offset' => $offset, 'items' => $riveritems, 'pagination' => $pagination )); } return ''; } function getUserSchoolName($iduser){ $user=get_entity( $iduser ); if( $user->school > 0 ){ $row=get_data_row('SELECT name FROM ct_schools WHERE id ='.$user->school); $school=array("id"=>$user->school,"name"=>$row->name); return $school; }else{ return 0; } } function ct_view_river_items_by_school($entities,$cat=0,$limit = 20){ global $CONFIG; $where = array(); $guids = array(); foreach($entities as $entity) $guids[] = (int) $entity->guid; $where[] = " subject_guid in (" . implode(',',$guids) . ") OR `object_guid` = ".$cat; $whereclause = implode(' and ', $where); $sql = "select id,type,subtype,action_type,access_id,view,subject_guid,object_guid,posted from {$CONFIG->dbprefix}river where {$whereclause} order by posted desc limit $limit"; $result=get_data($sql); if($result){ return elgg_view('river/item/list',array( 'limit' => $limit, 'offset' => $offset, 'items' => $result, 'pagination' => $pagination )); } return ''; } ?> wwwroot; return $baseURL . "mod/profile/icondirect.php?lastcache=" . time() . "&guid=" . $userID . "&size=" . $size; } function getApiUser($username,$password){ $decrypt=AesCtr::decrypt($password,"#4949383*Eirmcdc93333@01222", 256); if($user=authenticate($username,$decrypt)){ return $user; }else{ $userArray[]=array('authentication'=>'false'); echo json_encode( $userArray ); exit; } } function apiCategoryName( $fullName ){ return $fullName; //GET ALL SCHOOL ACRONYMS AND TURN THEM INTO AN ARRAY $sql = "SELECT name FROM ct_schools"; $results = mysql_query( $sql ); if( mysql_num_rows( $results ) == 0 ){ return $fullName; }else{ $preparedName = $fullName; for( $i=0; $i < count( $results ); $i++ ){ $thisSchool = mysql_fetch_array( $results ); //STRIP THIS NAME FROM THE BEGINNING OF ANY CATEGORY NAMES $preparedName = ltrim($fullName, $thisSchool[0] . " " ); } return $preparedName; } } //REPLACE ALL DASHES (-) WITH UNDERSCORES IN THE JSON (_) function jamesifyJSON( $origialJSONstring ){ return str_replace( "-", "_", $origialJSONstring ); } ?>wwwroot; return $baseURL . "mod/profile/icondirect.php?lastcache=" . time() . "&guid=" . $userID . "&size=" . $size; } function getAuthApiUser_apiv2($username, $password) { $decrypt=AesCtr_apiv2::decrypt($password, "#4949383*Eirmcdc93333@01222", 256); if($user=authenticate($username, $decrypt)){ return $user; } else { return null; } } function getApiUser_apiv2($username, $password) { $user = getAuthApiUser_apiv2($username, $password); if($user) { return $user; } else { $userArray[]=array('authentication'=>'false'); echo json_encode($userArray); exit(0); } } function apiCategoryName_apiv2( $fullName ){ return $fullName; //GET ALL SCHOOL ACRONYMS AND TURN THEM INTO AN ARRAY $sql = "SELECT name FROM ct_schools"; $results = mysql_query( $sql ); if( mysql_num_rows( $results ) == 0 ){ return $fullName; }else{ $preparedName = $fullName; for( $i=0; $i < count( $results ); $i++ ){ $thisSchool = mysql_fetch_array( $results ); //STRIP THIS NAME FROM THE BEGINNING OF ANY CATEGORY NAMES $preparedName = ltrim($fullName, $thisSchool[0] . " " ); } return $preparedName; } } //REPLACE ALL DASHES (-) WITH UNDERSCORES IN THE JSON (_) function jamesifyJSON_apiv2( $origialJSONstring ){ return str_replace( "-", "_", $origialJSONstring ); } ?> wwwroot; return $baseURL . "mod/profile/icondirect.php?lastcache=" . time() . "&guid=" . $userID . "&size=" . $size; } function getAuthApiUser_apiv3($username, $password) { $decrypt=AesCtr_apiv3::decrypt($password, "#4949383*Eirmcdc93333@01222", 256); if($user=authenticate($username, $decrypt)){ return $user; } else { return null; } } function getApiUser_apiv3($username, $password) { $user = getAuthApiUser_apiv3($username, $password); if($user) { return $user; } else { $userArray[]=array('authentication'=>'false'); echo json_encode($userArray); exit(0); } } function apiCategoryName_apiv3( $fullName ){ return $fullName; //GET ALL SCHOOL ACRONYMS AND TURN THEM INTO AN ARRAY $sql = "SELECT name FROM ct_schools"; $results = mysql_query( $sql ); if( mysql_num_rows( $results ) == 0 ){ return $fullName; }else{ $preparedName = $fullName; for( $i=0; $i < count( $results ); $i++ ){ $thisSchool = mysql_fetch_array( $results ); //STRIP THIS NAME FROM THE BEGINNING OF ANY CATEGORY NAMES $preparedName = ltrim($fullName, $thisSchool[0] . " " ); } return $preparedName; } } //REPLACE ALL DASHES (-) WITH UNDERSCORES IN THE JSON (_) function jamesifyJSON_apiv3( $origialJSONstring ){ return str_replace( "-", "_", $origialJSONstring ); } ?>