private function setAttribute($objID, $attribute, $value) { $connector = new steam_connector(STEAM_SERVER, STEAM_PORT, STEAM_ROOT_LOGIN, STEAM_ROOT_PW); $user = new steam_object($connector->get_id(), $objID); $result = $user->set_attribute($attribute, $value); //$connector->disconnect(); $connector->buffer_flush(); return $result; }
//** Precondition //****************************************************** $action = isset($_POST["action"]) ? $_POST["action"] : ""; //****************************************************** //** sTeam Stuff //****************************************************** $steam = new steam_connector($config_server_ip, $config_server_port, $login_name, $login_pwd); if (!$steam || !$steam->get_login_status()) { header("Location: {$config_webserver_ip}/index.html"); exit; } /** log-in user */ $steamUser = $steam->get_login_user(); /** get buddies */ $buddies = $steamUser->get_buddies(1); $result = $steam->buffer_flush(); $buddies = $result[$buddies]; $buddies_user = array(); $buddies_group = array(); $buddies_user_name = array(); $buddies_group_name = array(); foreach ($buddies as $buddy) { $id = $buddy->get_id(); switch ($buddy->get_type()) { case CLASS_USER: $buddies_user[$id] = $buddy; $buddies_user_name[$id] = $buddy->get_name(1); break; case CLASS_GROUP: $buddies_group[$id] = $buddy; $buddies_group_name[$id] = $buddy->get_groupname(1);
private function createUnitElearningPreferences() { //create steam container for unit elearning preferences if ($GLOBALS["STEAM"]->get_login_user_name() != "root") { // MUST BE DONE AS ROOT USER $root_steam = new steam_connector(STEAM_SERVER, STEAM_PORT, STEAM_ROOT_LOGIN, STEAM_ROOT_PW); $this->unit_elearning_preferences = steam_factory::create_container($root_steam->get_id(), $this->unit_elearning_preferences_name, $this->workroom); $koala_course = new koala_group_course($this->course_group); //$this->unit_elearning_preferences->set_sanction_all($this->steam_user); $this->unit_elearning_preferences->set_sanction_all($koala_course->get_group_staff()); //$this->unit_elearning_preferences->set_sanction_all($koala_course->get_group_admins()); $root_steam->buffer_flush(); $root_steam->disconnect(); } else { $this->unit_elearning_preferences = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->unit_elearning_preferences_name, $this->workroom); $koala_course = new koala_group_course($this->course_group); //$this->unit_elearning_preferences->set_sanction_all($this->steam_user); $this->unit_elearning_preferences->set_sanction_all($koala_course->get_group_staff()); //$this->unit_elearning_preferences->set_sanction_all($koala_course->get_group_admins()); $GLOBALS["STEAM"]->buffer_flush(); } // //create attributes.xml $this->unit_elearning_preferences = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $this->path_to_unit_elearning_preferences); if ($this->unit_elearning_preferences === 0) { $this->unit_elearning_preferences = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $this->path_to_unit_elearning_preferences); } if ($this->unit_elearning_preferences === 0) { throw new Exception("broke datastructure"); } $attributes_xml = new SimpleXMLElement("<attributes></attributes>"); $attributes_xml->addChild("OBJ_DESC", "storage for unit_elearning user data"); $attributes_xml->addChild("OBJ_HIDDEN", "TRUE"); $attributes_xml->addChild("OBJ_TYPE", "unit_elearning_data"); steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "attributes.xml", (string) $attributes_xml->asXML(), "text/xml", $this->unit_elearning_preferences); $GLOBALS["STEAM"]->buffer_flush(); }
function get_document_data($login, $password, $identifier, $identifier_type, $width = false, $height = false) { $STEAM = new steam_connector(STEAM_SERVER, STEAM_PORT, $login, $password); if ($identifier_type === "name") { $document = $STEAM->predefined_command($STEAM->get_module("icons"), "get_icon_by_name", array((string) $identifier), 0); } else { if ($identifier_type === "id") { $document = steam_factory::get_object($STEAM->get_id(), (int) $identifier); } } // If user is not logged in, open login dialog. If user is logged in // and not guest, then display "Access denied" message. if (!$document->check_access_read($STEAM->get_current_steam_user())) { if ($login == 'guest') { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } else { throw new Exception("Access denied.", E_USER_RIGHTS); } } if (!is_object($document)) { return array("content" => array()); } // array is considered to be an error $document->get_attributes(array("OBJ_NAME", "DOC_MIME_TYPE", "DOC_LAST_MODIFIED"), TRUE); if (!$width && !$height) { //$tnr_content = $document->get_content(TRUE); // workaround: get data from sTeam webinterface $tnr_contentsize = $document->get_content_size(TRUE); } else { $tnr_imagecontent = $document->get_thumbnail_data($width, $height, 0, TRUE); } $result = $STEAM->buffer_flush(); if (isset($tnr_imagecontent)) { // handle thumbnail data $data["mimetype"] = $result[$tnr_imagecontent]["mimetype"]; $data["lastmodified"] = $result[$tnr_imagecontent]["timestamp"]; $data["name"] = $result[$tnr_imagecontent]["name"]; $data["content"] = $result[$tnr_imagecontent]["content"]; $data["contentsize"] = $result[$tnr_imagecontent]["contentsize"]; } else { if ($identifier_type === "id") { $data["mimetype"] = $document->get_attribute("DOC_MIME_TYPE"); $data["lastmodified"] = $document->get_attribute("DOC_LAST_MODIFIED"); $data["name"] = $document->get_name(); $data["contentsize"] = $result[$tnr_contentsize]; //$data["content"] = $result[$tnr_content]; // workaround: get data from sTeam webinterface // workaround: get content from sTeam webinterface, because //$data["content"] = $document->get_content(); // results in *huge* memory overheads (a 15 MB download fails with 60 MB scrip memory limit! if (defined("LOG_DEBUGLOG")) { $time1 = microtime(TRUE); logging::write_log(LOG_DEBUGLOG, "get_document::get_document_data(" . $login . ", *****" . ", " . $identifier . ", " . $identifier_type . ", false, false)\t " . $login . " \t" . $identifier . " \t" . $document->get_name() . " \t" . $data["contentsize"] . " Bytes \t... "); } $https_port = (int) $STEAM->get_config_value("https_port"); if ($https_port == 443 || $https_port == 0) { $https_port = ""; } else { $https_port = ":" . (string) $https_port; } $ch = curl_init("https://" . STEAM_SERVER . $https_port . "/scripts/get.pike?object=" . $identifier); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_USERPWD, $login . ":" . $password); $data["content"] = curl_exec($ch); curl_close($ch); if (defined("LOG_DEBUGLOG")) { logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms"); } } else { $data = array("content" => array()); // array is considered an error } } return $data; }