$i = $i + 1; } ?> </div> </div> <!-- End join tab --> <!-- Create tab --> <br/> <div id="bh-gss-panel-create" class="tab-pane fade"> <form id="bh-gss-create-form" class="form-horizontal" action="<?php echo BeeHub::SPONSORS_PATH; ?> " method="post"> <input type="hidden" name="POST_auth_code" value="<?php echo DAV::xmlescape(BeeHub::getAuth()->getPostAuthCode()); ?> " /> <div class="control-group"> <label class="control-label" for="bh-gss-name">Sponsor name</label> <div class="controls"> <input type="text" id="bh-gss-name" name="sponsor_name" required> </div> </div> <div class="control-group"> <label class="control-label" for="bh-gss-display-name">Display name</label> <div class="controls"> <input type="text" id="bh-gss-display-name" name="displayname" required> </div> </div> <div class="control-group">
echo DAV::xmlescape($this->user_prop_displayname()); ?> " required data-org-name="<?php echo DAV::xmlescape($this->user_prop_displayname()); ?> "/> </div> </div> <div class="control-group"> <label class="control-label bh-gs-display-gs" for="bh-gs-sponsor-description">Group description</label> <div class="controls"> <textarea class="input-xlarge" id="bh-gs-sponsor-description" rows="5" name="description" data-org-name="<?php echo DAV::xmlescape($this->user_prop(BeeHub::PROP_DESCRIPTION)); ?> "><?php echo DAV::xmlescape($this->user_prop(BeeHub::PROP_DESCRIPTION)); ?> </textarea> </div> </div> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary">Save</button> </div> </div> </form> </div> <!-- End edit tab --> <!-- Usage tab --> <br/>
/** * Handles a DAV:principal-search-property-set REPORT request * * @param DAVACL_Principal_Collection $principal_collection The resource to perform the request on * @return void */ private function handle_principal_search_property_set($principal_collection) { $properties = $principal_collection->report_principal_search_property_set(); echo DAV::xml_header(); echo '<D:principal-search-property-set xmlns:D="DAV:">'; foreach ($properties as $prop => $desc) { echo "\n<D:principal-search-property><D:prop>"; list($namespaceURI, $localName) = explode(' ', $prop); echo "\n<"; switch ($namespaceURI) { case 'DAV:': echo "D:{$localName}"; break; case '': echo "{$localName}"; break; default: echo "ns:{$localName} xmlns:ns=\"{$namespaceURI}\""; } echo '/>'; if ($desc) { echo '<D:description xml:lang="en">' . DAV::xmlescape($desc) . '</D:description>'; } echo '</D:principal-search-property>'; } echo "\n</D:principal-search-property-set>"; }
/** * Serializes this lock to an XML string * @param array $tokens an array of tokens that may be displayed. * @return string an XML element */ public function toXML() { $t_lockroot = "\n<D:lockroot><D:href>" . DAV::xmlescape(DAV::encodeURIFullPath($this->lockroot)) . "</D:href></D:lockroot>"; if ($this->timeout === 0) { $t_timeout = 'Infinite'; } else { $t_timeout = $this->timeout - time(); $t_timeout = $t_timeout < 0 ? 'Second-0' : 'Second-' . $t_timeout; } $t_locktoken = isset(DAV::$SUBMITTEDTOKENS[$this->locktoken]) ? "\n<D:locktoken>\n<D:href>" . DAV::xmlescape($this->locktoken) . "</D:href>\n</D:locktoken>" : ''; $t_owner = empty($this->owner) ? '' : "\n<D:owner>{$this->owner}</D:owner>"; return <<<EOS <D:activelock> <D:lockscope><D:exclusive/></D:lockscope> <D:locktype><D:write/></D:locktype> <D:depth>{$this->depth}</D:depth>{$t_owner} <D:timeout>{$t_timeout}</D:timeout>{$t_locktoken}{$t_lockroot} </D:activelock> EOS; }
</ul> </li> <?php } if ($meResource = BeeHub_Auth::inst()->current_user()) { ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <?php echo $meResource->prop_displayname(); ?> <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="<?php echo DAV::xmlescape($meResource->path); ?> ">Profile</a></li> <?php if (@BeeHub_Auth::inst()->surfconext()) { ?> <li><a href="<?php echo DAV::getPath() . '?logout=yes'; ?> ">Log out</a></li> <?php } ?> <li><a href="<?php echo BeeHub::urlbase(false) . BeeHub::SYSTEM_PATH; ?>
/** * @return string An XML encoded string */ public function testXmlescape() { $returnValue = DAV::xmlescape('&"\'<>'); $this->assertRegExp('/&"&(apos|#039);<>/', $returnValue, 'DAV::xmlescape() should return escaped characters'); return $returnValue; }
/** * Serializes this object to XML. * Must only be called by DAV_Multistatus. * @return string XML */ public function toXML() { // Set the default status to 200: foreach (array_keys($this->properties) as $p) { if (!isset($this->status[$p])) { $this->status[$p] = DAV_Status::$OK; } } // Rearrange by status: $hashed_statusses = array(); $hashed_properties = array(); foreach ($this->status as $p => $s) { $hash = md5($s->getCode() . "\t" . $s->getMessage() . "\t" . implode("\t", $s->conditions) . $s->location); $hashed_statusses[$hash] = $s; $hashed_properties[$hash][] = $p; } // Start generating some XML: $xml = "\n<D:response><D:href>" . DAV::xmlescape(DAV::encodeURIFullPath($this->path)) . "</D:href>"; // Each defined status gets its own <D:propstat> element: foreach ($hashed_statusses as $hash => $status) { $xml .= "\n<D:propstat><D:prop>"; foreach ($hashed_properties[$hash] as $prop) { list($namespaceURI, $localName) = explode(' ', $prop); $xml .= "\n<"; switch ($namespaceURI) { case 'DAV:': $xml .= "D:{$localName}"; break; case '': $xml .= "{$localName}"; break; default: $xml .= "ns:{$localName} xmlns:ns=\"{$namespaceURI}\""; } if (isset($this->properties[$prop])) { $xml .= '>' . $this->properties[$prop] . '</'; switch ($namespaceURI) { case 'DAV:': $xml .= "D:"; break; case '': break; default: $xml .= "ns:"; } $xml .= "{$localName}>"; } else { $xml .= '/>'; } } // And give the status itself! $xml .= "\n</D:prop>\n<D:status>HTTP/1.1 " . DAV::status_code($status->getCode()) . '</D:status>'; if (!empty($status->conditions)) { $xml .= "\n<D:error>"; foreach ($status->conditions as $condition) { $xml .= @DAV::$CONDITIONS[$condition]; } $xml .= "</D:error>"; } $message = $status->getMessage(); if (!empty($message)) { $xml .= "\n<D:responsedescription>" . DAV::xmlescape($message) . '</D:responsedescription>'; } $xml .= "\n</D:propstat>"; } $xml .= "\n</D:response>"; return $xml; }
/** * Gets the getlastmodified property in an XML ready format for webDAV * * @return string XML */ public final function prop_getlastmodified() { if (is_null($tmp = $this->user_prop_getlastmodified())) { return null; } return DAV::xmlescape(DAV::httpDate($tmp)); }
/** * Returns the ACL restrictions in XML format * * @return string XML */ public final function prop_acl_restrictions() { $retval = ''; foreach ($this->user_prop_acl_restrictions() as $restriction) { if (is_array($restriction)) { // An array of required principals $retval .= "\n<D:required-principal>"; foreach ($restriction as $principal) { if ($p = @DAVACL::$PRINCIPALS[$principal]) { $retval .= "\n{$p}"; } elseif ('/' === $principal[0]) { $retval .= "\n<D:href>" . DAV::xmlescape(DAV::encodeURIFullPath($principal)) . '</D:href>'; } else { $retval .= "\n<D:property><" . DAV::expand($principal) . '/></D:property>'; } } $retval .= "\n</D:required-principal>"; } else { // Normal predefined restrictions: $retval .= '<' . DAV::expand($restriction) . '/>'; } } return $retval; }
"> <form id="verify_email" class="form-horizontal" method="post"> <input type="hidden" name="POST_auth_code" value="<?php echo DAV::xmlescape(BeeHub::getAuth()->getPostAuthCode()); ?> " /> <h4>Verify email address: <?php echo $this->unverified_address; ?> </h4> <p>Please verify your e-mail address by entering the verification code you've recieved through an e-mail and for security reasons, enter your password.</p> <div class="control-group"> <label class="control-label" for="verification_code">Verification code: </label> <div class="controls"> <input type="text" class="verification_code" id="verification_code" name="verification_code" value="<?php echo DAV::xmlescape(@$_GET['verification_code']); ?> " required /> </div> </div> <div class="control-group passwd"> <label class="control-label" for="verify_password">Password:</label> <div class="controls"> <input class="verification_code" type="password" id="verify_password" name="password" required /> </div> </div> <div class="control-group"> <div class="controls"> <button type="submit" class="btn">Verify e-mail address</button> </div> </div>
/** * Create propper XML to send to the client * @param DAV_Namespaces $namespaces A DAV_Namespaces object with namespace aliases if they are already created * @return string */ public function toXML($namespaces = false) { if (!$namespaces) { $namespaces = new DAV_Namespaces(); $this->namespaces($namespaces); $t_namespaces = $namespaces->toXML(); } else { $t_namespaces = ''; } $t_privilege = explode(' ', $this->privilege); $t_privilege = '<' . $namespaces->prefix($t_privilege[0]) . $t_privilege[1] . '/>'; $t_abstract = $this->abstract ? "\n<D:abstract/>" : ''; $t_description = DAV::xmlescape($this->description); $t_supported_privileges = ''; foreach ($this->supported_privileges as $sp) { $t_supported_privileges .= "\n" . $sp->toXML($namespaces); } return <<<EOS <D:supported-privilege{$t_namespaces}> <D:privilege>{$t_privilege}</D:privilege>{$t_abstract} <D:description>{$t_description}</D:description>{$t_supported_privileges} </D:supported-privilege> EOS; }
/** * Serializes a DOMNode to an XML string * @internal * @param DOMNode $node * @param DAV_Namespaces $p_namespaces * @return string */ public static function recursiveSerialize($node, $p_namespaces = null) { switch ($node->nodeType) { case XML_ELEMENT_NODE: break; case XML_COMMENT_NODE: return '<!--' . str_replace('-->', '--<', $node->nodeValue) . '-->'; case XML_PI_NODE: return "<?{$node->target} " . str_replace('?>', '?<', $node->data) . '?>'; case XML_CDATA_SECTION_NODE: return self::xmlescape($node->data); //return '<![CDATA[' . $node->data .']]>'; //return '<![CDATA[' . $node->data .']]>'; default: return DAV::xmlescape($node->nodeValue); } $namespaces = is_null($p_namespaces) ? new DAV_Namespaces() : $p_namespaces; $elementprefix = $namespaces->prefix($node->namespaceURI); $elementlocalName = $node->localName; $retval = "<{$elementprefix}{$elementlocalName}"; // Attributes handling: $elementattributes = $node->attributes; $attributes = array(); for ($i = 0; $elementattribute = $elementattributes->item($i); $i++) { // The next if-statement is probably not necessary, because the DOMXML parser // doesn't return these attributes as the DOM tree anyway. if ($elementattribute->prefix === 'xmlns' or $elementattribute->namespaceURI === '' && $elementattribute->localName === 'xmlns') { continue; } $p = $namespaces->prefix($elementattribute->namespaceURI); $attributes[$p . $elementattribute->localName] = $elementattribute->value; } foreach ($attributes as $key => $value) { $retval .= " {$key}=\"" . DAV::xmlescape($value, true) . '"'; } // The contents of the element: $childXML = ''; for ($i = 0; $childNode = $node->childNodes->item($i); $i++) { $childXML .= self::recursiveSerialize($childNode, $namespaces); } if (is_null($p_namespaces)) { $retval .= $namespaces->toXML(); } if ($childXML !== '') { $retval .= ">{$childXML}</{$elementprefix}{$elementlocalName}>"; } else { $retval .= '/>'; } return $retval; }
function printTree($path, $treeState, $selectedPath) { $registry = BeeHub_Registry::inst(); $resource = $registry->resource($path); $members = array(); foreach ($resource as $member) { // Skip the /system/ directory, as there is no need to see this if ($path === '/' && $member === 'system/' || substr($member, -1) !== '/') { continue; } $members[] = $member; } usort($members, 'strnatcasecmp'); $last = count($members) - 1; for ($counter = 0; $counter <= $last; $counter++) { $member = $members[$counter]; $memberResource = $registry->resource($path . $member); // Previous versions actually checked whether the resource has children // or not. But with the new set-up that means a query for each resource // and this is simply to expensive. Setting this to true for all cases // means the end-user will find out there are no child resources on the // first attempt to unfold the directory in the tree $hasChildren = true; $expanded = isset($treeState[$memberResource->path]) && $hasChildren ? $treeState[$memberResource->path] : false; ?> <li <?php echo $counter === $last ? 'class="dynatree-lastsib"' : ''; ?> ><span class="dynatree-node dynatree-folder <?php echo $hasChildren ? 'dynatree-has-children' : ''; ?> <?php echo $expanded ? 'dynatree-expanded' : ($hasChildren ? 'dynatree-lazy' : ''); ?> dynatree-exp-<?php echo $expanded ? 'e' : 'cd'; echo $counter === $last ? 'l dynatree-lastsib' : ''; ?> dynatree-ico-<?php echo $expanded ? 'e' : 'c'; ?> f <?php echo $memberResource->path === $selectedPath ? 'dynatree-focused' : ''; ?> " ><span class="dynatree-<?php echo $hasChildren ? 'expander' : 'connector'; ?> "></span ><span class="dynatree-icon"></span ><a class="dynatree-title" href="<?php echo DAV::xmlescape(DAV::encodeURIFullPath($memberResource->path)); ?> "><?php echo DAV::xmlescape($memberResource->user_prop_displayname()); ?> </a ></span <?php if ($expanded && $hasChildren) { ?> ><ul><?php echo printTree($memberResource->path, $treeState, $selectedPath); ?> </ul <?php } ?> ></li> <?php $registry->forget($path . $member); } }
<?php require 'views/header.php'; ?> <p>You need to confirm your e-mail address. There was an e-mail sent to <?php echo DAV::xmlescape($email_address); ?> with instructions on how to do this.</p> <?php require 'views/footer.php';