예제 #1
0
 /**
  * Initialize required store and consumer and make a few sanity checks.  This method
  * does a lot of the heavy lifting to get everything initialized, so we don't call it
  * until we actually need it.
  */
 function late_bind($reload = false)
 {
     global $wpdb, $openid;
     openid_init();
     $openid->log->debug('beginning late binding');
     $openid->enabled = true;
     // Be Optimistic
     if ($openid->bind_done && !$reload) {
         $openid->log->debug('we\'ve already done the late bind... moving on');
         return WordPressOpenID_Logic::uptodate();
     }
     $openid->bind_done = true;
     $f = @fopen('/dev/urandom', 'r');
     if ($f === false) {
         define('Auth_OpenID_RAND_SOURCE', null);
     }
     // include required JanRain OpenID library files
     set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
     $openid->log->debug('temporary include path for importing = ' . get_include_path());
     require_once 'Auth/OpenID/Discover.php';
     require_once 'Auth/OpenID/DatabaseConnection.php';
     require_once 'Auth/OpenID/MySQLStore.php';
     require_once 'Auth/OpenID/Consumer.php';
     require_once 'Auth/OpenID/SReg.php';
     restore_include_path();
     $openid->log->debug("Bootstrap -- checking tables");
     if ($openid->enabled) {
         $store =& WordPressOpenID_Logic::getStore();
         if (!$store) {
             return;
         }
         // something broke
         $openid->enabled = $store->check_tables();
         if (!WordPressOpenID_Logic::uptodate()) {
             update_option('oid_plugin_enabled', true);
             update_option('oid_plugin_revision', WPOPENID_PLUGIN_REVISION);
             update_option('oid_db_revision', WPOPENID_DB_REVISION);
             WordPressOpenID_Logic::uptodate();
         }
     } else {
         $openid->error = 'WPOpenID Core is Disabled!';
         update_option('oid_plugin_enabled', false);
     }
     return $openid->enabled;
 }