Пример #1
0
 /**
  * Ends the output.
  * @return string
  */
 public function end()
 {
     if (!$this->header_sent) {
         $this->start();
     }
     echo "</tbody></table>";
     echo REST::html_end();
 }
Пример #2
0
 /**
  * Injects your own HTML generation functions instead of the default ones.
  * 
  * Both parameters must be of PHP's pseudo type "callback". See PHP's
  * documentation for details.
  * 
  * @param $html_start callback Must point to a method with the same signature
  *        as self::html_start().
  * @param $html_end callback Must point to a method with the same signature
  *        os self::html_end().
  */
 public static function setHTML($html_start, $html_end)
 {
     self::$html_start = $html_start;
     self::$html_end = $html_end;
 }
Пример #3
0
}
echo REST::html_start('Lock info');
?>
<h2>Lock info</h2>
<table class="lockinfo"><tbody>
<tr><th>TokenId:</th><td id="tokenId"><?php 
echo htmlentities($row[0]);
?>
</td></tr>
<tr><th>TokenName:</th><td id="tokenName"><?php 
echo htmlentities($row[1]);
?>
</td></tr>
<tr><th>TokenURL:</th><td id="tokenURL"><a href="<?php 
echo htmlspecialchars($tokenURL, ENT_QUOTES, 'UTF-8');
?>
"><?php 
echo htmlspecialchars($tokenURL, ENT_QUOTES, 'UTF-8');
?>
</a></td></tr>
<tr><th>Timeout:</th><td id="timeout"><?php 
echo htmlentities($row[2], ENT_QUOTES, 'UTF-8');
?>
</td></tr>
<tr><th>Description:</th><td id="description"><?php 
echo htmlentities($row[3], ENT_QUOTES, 'UTF-8');
?>
</td></tr>
</tbody></table><?php 
echo REST::html_end();
Пример #4
0
EOS;
        foreach ($handle->type as $idx => $type) {
            if (strpos($type, 'HS_') === 0) {
                continue;
            }
            echo '<tr><td class="idx">' . $idx . '</td><td class="type">' . htmlspecialchars($type, ENT_COMPAT, 'UTF-8') . '</td><td class="data">';
            if ($type == 'URL' && REST::isValidURI($handle->data[$idx])) {
                echo '<a href="' . $handle->data[$idx] . '">' . htmlspecialchars($handle->data[$idx]) . '</a>';
            } elseif ($type == 'EMAIL') {
                echo '<a href="mailto:' . $handle->data[$idx] . '">' . htmlspecialchars($handle->data[$idx]) . '</a>';
            } else {
                echo $handle->data[$idx] === mb_convert_encoding(mb_convert_encoding($handle->data[$idx], 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32') ? htmlspecialchars($handle->data[$idx], ENT_COMPAT, 'ISO-8859-1') : '<pre>' . htmlspecialchars(addcslashes($handle->data[$idx], "\\..\t\v....ÿ"), ENT_COMPAT, 'ISO-8859-1') . '</pre>';
            }
            echo '</td><td class="refs">' . htmlspecialchars($handle->refs[$idx]) . '</td><td class="modified">' . REST::http_date($handle->timestamp[$idx]) . "</td></tr>\n";
        }
        echo '</tbody></table>' . REST::html_end();
    } elseif ($content_type == 'application/json') {
        $json = array();
        foreach ($handle->type as $idx => $type) {
            if (strpos($type, 'HS_') !== 0) {
                // Was: $type != 'HS_ADMIN'
                $json[$idx] = array('type' => (string) $type, 'data' => (string) $handle->data[$idx], 'timestamp' => (int) $handle->timestamp[$idx], 'refs' => (string) $handle->refs[$idx]);
            }
        }
        echo json_encode($json);
        exit;
    } elseif ($content_type == 'application/x-www-form-urlencoded') {
        $pairs = array();
        foreach ($handle->type as $idx => $type) {
            if (strpos($type, 'HS_') !== 0) {
                $pairs[] = urlencode("type[{$idx}]") . '=' . urlencode($type);
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * $Id: database_types.php 2459 2009-08-10 21:20:41Z pieterb $
 **************************************************************************/
/**
 * File documentation.
 * @todo Implement retrieval of info about individual database types.
 * @package Portal
 */
require_once 'include/global.php';
REST::require_method('GET', 'HEAD');
$path_info = Portal::path_info();
if (!empty($path_info[0])) {
    $id = Portal_DB::databaseTypeIDByName($path_info[0]);
    if (empty($id)) {
        REST::fatal(REST::HTTP_NOT_FOUND);
    }
    REST::header(REST::best_xhtml_type() . '; charset="UTF-8"');
    echo REST::html_start("Database type \"{$path_info[0]}\"") . Portal_DB::databaseTypeDescription($id) . REST::html_end();
    exit;
}
$directory = RESTDir::factory();
foreach (Portal_DB::databaseTypeIDs() as $id) {
    $directory->line(Portal_DB::databaseTypeName($id), array('Content-Type' => Portal_DB::databaseTypeContentType($id), 'Extension' => Portal_DB::databaseTypeExtension($id)));
}
$directory->end();
Пример #6
0
    /**
     * Shows a message screen to the user.
     * @param string $message HTML message
     * @param string $status HTTP status
     * @param string $redirect URL for automatic redirection
     * @param string $location Location of the created URL
     */
    public static function show_message($message, $status, $location)
    {
        REST::header(array('status' => $status, 'Content-Type' => REST::best_xhtml_type() . '; charset=UTF-8', 'Location' => REST::rel2url($location)));
        echo REST::html_start('Redirect') . <<<EOS
<p>{$message}</p>
<script type="text/javascript"><![CDATA[
  setTimeout(
    'window.location.href = "{$location}";',
    1000
  );
]]></script>
EOS;
        echo REST::html_end();
        exit;
    }
        REST::fatal(REST::HTTP_INTERNAL_SERVER_ERROR, <<<EOS
Your registration was successful, but the email containing your password could not be sent.
The site administrator has been informed and will contact you as soon as possible.
EOS
);
    }
    $message = <<<EOS
<p>Registration successful.</p>
<p>An e-mail with password has been sent to
<a href="mailto:{$_GET['email']}">{$_GET['email']}</a>.</p>
EOS;
    if ($referrer) {
        $message .= <<<EOS
<p>Click here to continue:<br/>
<a href="{$referrer}">{$referrer}</a></p>
EOS;
    }
    REST::fatal(REST::HTTP_ACCEPTED, $message);
}
REST::header(REST::best_xhtml_type() . '; charset="UTF-8"');
echo REST::html_start('Register') . <<<EOS
<p>Fill in your e-mail address and display name below, and you'll recieve a password.</p>
<form action="register.php" method="get">
<input type="hidden" name="referrer" value="{$referrer}"/>
<input type="text" name="email" value=""/> E-mail address (invisible to other users)<br/>
<input type="text" name="name" value=""/> Display name (visible to other users if you share your databases)<br/>
<input type="submit" value="Request password"/>
</form>
EOS
 . REST::html_end();