コード例 #1
0
//ini_set( 'include_path', '/home/mbertier/dev/PEAR_OVERLAY/Blogmarks' . ':'. ini_get('include_path') . ':/home/mbertier/dev/PEAR_OVERLAY' );
ini_set('error_reporting', E_ALL);
require_once 'PEAR.php';
/*
$config = parse_ini_file('/home/mbertier/dev/PEAR_OVERLAY/Blogmarks/Blogmarks/config.ini', true);
foreach($config as $class=>$values) {
    $options = &PEAR::getStaticProperty($class,'options');
    $options = $values;
}
*/
# -- CONFIGURATION
$nonce = microtime() / rand();
$time = date("YMDHMS");
$user = '******';
$pwd = 'moustache';
$digest = makeDigest($pwd, $nonce, $time);
include_once 'Blogmarks/Marker.php';
$marker =& Blogmarks_Marker::singleton();
$auth = $marker->authenticate($user, $digest, $nonce, $time, false);
// AUTH OK :)
if (!Blogmarks::isError($auth)) {
    $params = array('user_login' => 'znarf', 'order_by' => array('created', 'DESC'), 'select_priv' => true);
    $e = $marker->createMark(array('title' => 'StandBlog', 'tags' => array('standards', 'blog', 'fr'), 'href' => 'http://www.standblog.com', 'via' => 'http://dev.upian.com/hotlinks', 'source' => 'http://upian.net/znarf/carnet'));
    if (Blogmarks::isError($e)) {
        echo $e->getMessage() . "\n\n";
    } else {
        echo "Mark [{$e->id}] ajouté avec succès :)\n";
    }
    $list =& $marker->getMarksList($params);
    if (Blogmarks::isError($list)) {
        echo $list->getMessage() . "\n\n";
コード例 #2
0
ファイル: auth.php プロジェクト: BackupTheBerlios/blogmarks
<?php

session_start();
require_once 'PEAR.php';
include_once 'Blogmarks/Marker.php';
include "../includes/functions.inc.php";
$marker =& Blogmarks_Marker::singleton();
if (isset($_POST['login']) and strlen($_POST['login'])) {
    $nonce = microtime() / rand();
    $time = date("YMDHMS");
    $digest = makeDigest($_POST['pwd'], $nonce, $time);
    $auth = $marker->authenticate($_POST['login'], $digest, $nonce, $time, TRUE);
}
if (isset($_GET['disconnect']) and $_GET['disconnect'] == 1) {
    $marker->disconnectUser();
}
if ($marker->userIsAuthenticated()) {
    echo '<p>Vous êtes authentifiés</p>';
    echo '<p><a href="?disconnect=1">Se déconnecter</a></p>';
} else {
    echo "<p>Vous n'êtes pas du tout authentifiés</p>";
    echo '<FORM METHOD="POST" ACTION="">';
    echo '<INPUT TYPE="text" NAME="login">';
    echo '<INPUT TYPE="password" NAME="pwd">';
    echo '<INPUT TYPE="submit">';
    echo '</FORM>';
}
print_r($marker->getUserInfo());
コード例 #3
0
    list($usec, $sec) = explode(" ", microtime());
    return (double) $usec + (double) $sec;
}
$time_start = getmicrotime();
/* ------------------------------- */
session_start();
//error_reporting( E_ALL ^ E_NOTICE );
error_reporting(E_ALL);
require_once 'PEAR.php';
include_once 'Blogmarks/Marker.php';
$marker =& Blogmarks_Marker::singleton();
//echo "<p>Exec. time : " . round( ( getmicrotime() - $time_start ) , 3 ) . " s</p>";
if (isset($_GET['connect']) and $_GET['connect'] == 1) {
    $nonce = microtime() / rand();
    $time = date("YMDHMS");
    $digest = makeDigest(trim($_POST['pwd']), $nonce, $time);
    $auth = $marker->authenticate(trim($_POST['login']), $digest, $nonce, $time, TRUE);
    if (Blogmarks::isError($auth)) {
        $auth_error = $auth->getMessage();
    } elseif (DB::isError($auth)) {
        $auth_error = $auth->getMessage();
    }
    //header("Location: index.php");
    header("Location: " . str_replace("connect=1", "", $_SERVER["REQUEST_URI"]));
}
if (isset($_GET['disconnect']) and $_GET['disconnect'] == 1) {
    $marker->disconnectUser();
    header("Location: index.php");
    //header("Location: " . $_SERVER["REQUEST_URI"] );
}
if (!isset($_GET['section'])) {