Esempio n. 1
0
 if ($len == 2) {
     $groupset = getConversationSetData($parts);
     $groupset->cipher = $cipher;
     if (isset($unobfuscationid) && $unobfuscationid != "") {
         $groupset->unobfuscationid = $unobfuscationid;
     }
     $response = $groupset;
 } else {
     if ($len > 2) {
         $id = check_param($parts[2], PARAM_TEXT);
         global $HUB_SQL, $DB;
         $group = getGroup($id);
         if ($group instanceof Error) {
             global $ERROR;
             $ERROR = new error();
             $ERROR->createGroupNotFoundError($id);
             include $HUB_FLM->getCodeDirPath("core/formaterror.php");
             die;
         }
         $group = getConversationData($id);
         $group->cipher = $cipher;
         if (isset($unobfuscationid) && $unobfuscationid != "") {
             $group->unobfuscationid = $unobfuscationid;
         }
         if ($len == 4) {
             $subtype = check_param($parts[3], PARAM_ALPHA);
             $group->filter = $subtype;
         }
         $response = $group;
     } else {
         global $ERROR;
Esempio n. 2
0
 /**
  * Loads the data for the group from the database
  *
  * @return Group object (this)
  */
 function load()
 {
     global $DB, $CFG, $HUB_FLM, $HUB_SQL, $LNG;
     $params = array();
     $params[0] = $this->groupid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_GROUP_SELECT, $params);
     if ($resArray !== false) {
         $count = count($resArray);
         if ($count == 0) {
             global $ERROR;
             $ERROR = new error();
             return $ERROR->createGroupNotFoundError($this->groupid);
         }
         for ($i = 0; $i < $count; $i++) {
             $array = $resArray[$i];
             $this->name = stripslashes($array['Name']);
             $this->description = stripslashes($array['Description']);
             $this->website = stripslashes($array['Website']);
             $this->isopenjoining = $array['IsOpenJoining'];
             if ($array['Photo']) {
                 //set user photo and thumb the thumb creation is done during registration
                 $originalphotopath = $HUB_FLM->createUploadsDirPath($this->groupid . "/" . stripslashes($array['Photo']));
                 if (file_exists($originalphotopath)) {
                     $this->photo = $HUB_FLM->getUploadsWebPath($this->groupid . "/" . stripslashes($array['Photo']));
                     $this->thumb = $HUB_FLM->getUploadsWebPath($this->groupid . "/" . str_replace('.', '_thumb.', stripslashes($array['Photo'])));
                     if (!file_exists($this->thumb)) {
                         create_image_thumb($array['Photo'], $CFG->IMAGE_THUMB_WIDTH, $this->groupid);
                     }
                 } else {
                     //if the file does not exists how to get it from a upper level? change it to
                     //if file doesnot exists directly using default photo
                     $this->photo = $HUB_FLM->getUploadsWebPath($CFG->DEFAULT_GROUP_PHOTO);
                     $this->thumb = $HUB_FLM->getUploadsWebPath(str_replace('.', '_thumb.', stripslashes($CFG->DEFAULT_GROUP_PHOTO)));
                 }
             } else {
                 $this->photo = $HUB_FLM->getUploadsWebPath($CFG->DEFAULT_GROUP_PHOTO);
                 $this->thumb = $HUB_FLM->getUploadsWebPath(str_replace('.', '_thumb.', stripslashes($CFG->DEFAULT_GROUP_PHOTO)));
             }
             if (isset($array['LocationText'])) {
                 $this->location = $array['LocationText'];
             } else {
                 $this->location = "";
             }
             if (isset($array['LocationCountry'])) {
                 $cs = getCountryList();
                 $this->countrycode = $array['LocationCountry'];
                 if (isset($cs[$array['LocationCountry']])) {
                     $this->country = $cs[$array['LocationCountry']];
                 }
             } else {
                 $this->countrycode = "";
                 $this->country = "";
             }
             if (isset($array['LocationLat'])) {
                 $this->locationlat = $array['LocationLat'];
             }
             if (isset($array['LocationLng'])) {
                 $this->locationlng = $array['LocationLng'];
             }
         }
     } else {
         return database_error();
     }
     $this->loadmembers();
     $this->loadpendingmembers();
     $this->getDebateCount();
     $this->getVoteCount();
     return $this;
 }