Exemplo n.º 1
0
 *                                                                                         *
 *  This library is free software; you can redistribute it and/or modify it under the      *
 *  terms of the GNU Lesser General Public License as published by the Free Software       *
 *  Foundation; either version 2.1 of the License, or (at your option) any later version.  *
 *                                                                                         *
 *  This library is distributed in the hope that it will be useful, but WITHOUT ANY        *
 *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A        *
 *  PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.        *
 *                                                                                         *
 *  You should have received a copy of the GNU Lesser General Public License along with    *
 *  this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, *
 *  Fifth Floor, Boston, MA 02110-1301, USA                                                *
 *                                                                                         *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
if (!class_exists('SMTP5')) {
    require_once library_path() . 'xpertmailer' . DIRECTORY_SEPARATOR . 'SMTP5.php';
}
class MAIL5
{
    public $From = null;
    public $To = array();
    public $Cc = array();
    public $Bcc = array();
    public $Subject = null;
    public $Text = null;
    public $Html = null;
    public $Header = array();
    public $Attach = array();
    public $Host = null;
    public $Port = null;
    public $User = null;
Exemplo n.º 2
0
function facebook_login(&$vars)
{
    extract($vars);
    $app_id = environment('facebookAppId');
    $consumer_key = environment('facebookKey');
    $consumer_secret = environment('facebookSecret');
    $agent = environment('facebookAppName') . " (curl)";
    add_include_path(library_path());
    add_include_path(library_path() . 'facebook-platform/php');
    add_include_path(library_path() . 'facebook_stream');
    require_once "facebook.php";
    require_once "FacebookStream.php";
    require_once "Services/Facebook.php";
    $fb = new Facebook($consumer_key, $consumer_secret, true);
    $_SESSION['fb_session'] = (string) $fb->api_client->session_key;
    $_SESSION['fb_userid'] = (string) $fb->user;
    $fs = new FacebookStream($consumer_key, $consumer_secret, $agent);
    $fieldlist = array('last_name', 'first_name', 'pic_small', 'profile_blurb', 'profile_url', 'locale', 'name', 'proxied_email');
    $fields = implode(',', $fieldlist);
    $user = $fs->GetInfo($app_id, $_SESSION['fb_session'], $_SESSION['fb_userid'], $fields);
    $values = array();
    $values[] = str_replace(' ', '', strtolower((string) $user->user->name));
    $values[] = (string) $user->user->pic_small;
    $values[] = (string) $user->user->name;
    $values[] = (string) $user->user->profile_blurb;
    $values[] = (string) $user->user->profile_url;
    $values[] = (string) $user->user->locale;
    $Identity =& $db->model('Identity');
    $Person =& $db->model('Person');
    $FacebookUser =& $db->model('FacebookUser');
    if (empty($prefix) && in_array('invites', $db->tables)) {
        $Invite =& $db->model('Invite');
        $result = $Invite->find_by('nickname', (string) $user->user->name);
        if (!$result) {
            trigger_error('Sorry, you have not been invited yet ' . environment('email_from'), E_USER_ERROR);
        }
    }
    $faceuser = $FacebookUser->find_by('facebook_id', $_SESSION['fb_userid']);
    // a) facebook user exists, does not have a profile_id
    // b) facebook user exists, HAS a profile_id
    // c) facebook user does not exist
    if ($faceuser) {
        if (!$faceuser->profile_id) {
            $i = make_identity($values);
            if (!$i) {
                trigger_error('sorry I was unable to create an identity', E_USER_ERROR);
            }
            $faceuser->set_value('profile_id', $i->id);
            $faceuser->save_changes();
            if (!$faceuser) {
                trigger_error('sorry I was unable to create a facebook user', E_USER_ERROR);
            }
        } else {
            // b
            $i = $Identity->find($faceuser->profile_id);
            if (!$i) {
                trigger_error('sorry I was unable to find the identity', E_USER_ERROR);
            }
        }
    } else {
        // c
        $i = make_identity($values);
        if (!$i) {
            trigger_error('sorry I was unable to create an identity', E_USER_ERROR);
        }
        $faceuser = make_fb_user($user, $i->id);
        if (!$faceuser) {
            trigger_error('sorry I was unable to create a facebook user', E_USER_ERROR);
        }
    }
    $_SESSION['fb_person_id'] = $i->person_id;
    redirect_to($request->base);
    //$fs->setStatus("nerding out with the latest Facebook API tools",$_SESSION['fb_userid']);
    //$fs->StreamRequest( $app_id, $_SESSION['fb_session'], $_SESSION['fb_userid'] );
}
Exemplo n.º 3
0
/**
 * lib_include
 * 
 * include a library file
 * 
 * @access public
 */
function lib_include($file)
{
    if ($file == 'json' && class_exists('Services_JSON')) {
        return;
    }
    if (is_array($file)) {
        foreach ($file as $f) {
            if (file_exists(library_path() . $f . ".php")) {
                require_once library_path() . $f . ".php";
            }
        }
    } else {
        if (file_exists(library_path() . $file . ".php")) {
            require_once library_path() . $file . ".php";
        }
    }
}
Exemplo n.º 4
0
OPENID as is now, is not trust system. It is a great single-sign on method. If you want to 
store information about OpenID in your database for later use, make sure you handle url identities
properly.
  For example:
	https://steve.myopenid.com/
	https://steve.myopenid.com
	http://steve.myopenid.com/
	http://steve.myopenid.com
	... are representing one single user. Some OpenIDs can be in format openidserver.com/users/user/ - keep this in mind when storing identities
	To help you store an OpenID in your DB, you can use function:
		$openid_db_safe = $openid->OpenID_Standarize($upenid);
	This may not be comatible with current specs, but it works in current enviroment. Use this function to get openid
	in one format like steve.myopenid.com (without trailing slashes and http/https).
	Use output to insert Identity to database. Don't use this for validation - it may fail.
*/
add_include_path(library_path() . DIRECTORY_SEPARATOR . 'Yadis', true);
require_once 'Services/Yadis/Yadis.php';
class SimpleOpenID
{
    var $openid_url_identity;
    var $URLs = array();
    var $error = array();
    var $fields = array('required' => array(), 'optional' => array());
    var $arr_ax_types = array('nickname' => 'http://axschema.org/namePerson/friendly', 'email' => 'http://axschema.org/contact/email', 'fullname' => 'http://axschema.org/namePerson', 'dob' => 'http://axschema.org/birthDate', 'gender' => 'http://axschema.org/person/gender', 'postcode' => 'http://axschema.org/contact/postalCode/home', 'country' => 'http://axschema.org/contact/country/home', 'language' => 'http://axschema.org/pref/language', 'timezone' => 'http://axschema.org/pref/timezone', 'prefix' => 'http://axschema.org/namePerson/prefix', 'firstname' => 'http://axschema.org/namePerson/first', 'lastname' => 'http://axschema.org/namePerson/last', 'suffix' => 'http://axschema.org/namePerson/suffix');
    function SimpleOpenID()
    {
        if (!function_exists('curl_exec')) {
            die('Error: Class SimpleOpenID requires curl extension to work');
        }
    }
    function SetOpenIDServer($a)
Exemplo n.º 5
0
function do_shorten_redirect(&$model, &$model)
{
    global $request;
    if (!($model->table == 'settings')) {
        return;
    }
    $perma = parse_url($_SERVER['REQUEST_URI']);
    $_PERMA = explode("/", $perma['path']);
    @array_shift($_PERMA);
    if (isset($_PERMA[0])) {
        $id = mysql_escape_string($_PERMA[0]);
    } else {
        $id = '';
    }
    if ($id != '' && $id != basename($_SERVER['PHP_SELF'])) {
        add_include_path(library_path() . 'urlshort/upload');
        require_once 'includes/config.php';
        // settings
        require_once 'includes/gen.php';
        // url generation and location
        $url = new shorturl();
        $location = $url->get_url($id);
        if ($location != -1) {
            include 'db/library/pca/pca.class.php';
            $cache = PCA::get_best_backend();
            $timeout = 86400;
            $cache->add($_SERVER['REQUEST_URI'], $location, $timeout);
            header('Location: ' . $location, TRUE, 301);
            exit;
        }
    }
}
Exemplo n.º 6
0
            if ($u[1]) {
                update_option($optname, $options);
                $follow[$u[1]] = array($optname, $options);
            }
        }
    }
}
global $db, $prefix;
if (environment('facebookSession')) {
    $app_id = environment('facebookAppId');
    $consumer_key = environment('facebookKey');
    $consumer_secret = environment('facebookSecret');
    $agent = environment('facebookAppName') . " (curl)";
    add_include_path(library_path());
    add_include_path(library_path() . 'facebook-platform/php');
    add_include_path(library_path() . 'facebook_stream');
    require_once "FacebookStream.php";
    require_once "Services/Facebook.php";
    require_once "facebook.php";
    $sesskey = environment('facebookSession');
    $fb = new Facebook($consumer_key, $consumer_secret, true);
    $fs = new FacebookStream($consumer_key, $consumer_secret, $agent);
    //	  $fs = new FacebookStream($consumer_key,$consumer_secret,$agent);
    $fb->api_client->session_key = $sesskey;
}
$FacebookUser =& $db->model('FacebookUser');
$Post =& $db->model('Post');
$Identity =& $db->model('Identity');
foreach ($follow as $uid => $options) {
    if (!$options[1]['person_id']) {
        continue;