Beispiel #1
0
 /**
  * Returns object instance
  *
  * @return oxPictureHandler
  */
 public static function getInstance()
 {
     // disable caching for test modules
     if (defined('OXID_PHP_UNIT')) {
         self::$_instance = modInstances::getMod(__CLASS__);
     }
     if (!self::$_instance instanceof oxFb) {
         self::$_instance = oxNew('oxFb');
         if (defined('OXID_PHP_UNIT')) {
             modInstances::addMod(__CLASS__, self::$_instance);
         }
     }
     return self::$_instance;
 }
/**
 * Smarty plugin
 * -------------------------------------------------------------
 * File: insert.oxid_newbasketitem.php
 * Type: string, html
 * Name: newbasketitem
 * Purpose: Used for tracking in econda, etracker etc.
 * -------------------------------------------------------------
 *
 * @param array  $params  params
 * @param Smarty &$smarty clever simulation of a method
 *
 * @return string
 */
function smarty_insert_oxid_fblogin($params, &$smarty)
{
    $myConfig = oxConfig::getInstance();
    $oView = $myConfig->getActiveView();
    if (!$myConfig->getConfigParam("bl_showFbConnect")) {
        return;
    }
    // user logged in using facebook account so showing additional
    // popup about connecting facebook user id to existing shop account
    $oFb = oxFb::getInstance();
    if ($oFb->isConnected() && $oFb->getUser()) {
        //name of template
        $sTemplate = 'inc/popup_fblogin.tpl';
        // checking, if Facebeook User Id was successfully added
        if (oxSession::getVar('_blFbUserIdUpdated')) {
            $sTemplate = 'inc/popup_fblogin_msg.tpl';
            oxSession::deleteVar('_blFbUserIdUpdated');
        }
        return $smarty->fetch($sTemplate);
    }
}
Beispiel #3
0
 protected function _constructSessionVariableName($key)
 {
     return parent::constructSessionVariableName($key);
 }
 /**
  * Gets get Facebook user id
  *
  * @return int
  */
 public function getFbUserId()
 {
     if ($this->getConfig()->getConfigParam("bl_showFbConnect")) {
         $oFb = oxFb::getInstance();
         return $oFb->getUser();
     }
 }
 /**
  * Updates user Facebook ID
  *
  * @return null
  */
 public function updateFbId()
 {
     $oFb = oxFb::getInstance();
     $blRet = false;
     if ($oFb->isConnected() && $oFb->getUser()) {
         $this->oxuser__oxfbid = new oxField($oFb->getUser());
         $blRet = $this->save();
     }
     return $blRet;
 }
Beispiel #6
0
 /**
  * Forms Facebook user ID query.
  *
  * @param oxFb $facebookConnector
  *
  * @return string
  */
 protected function formFacebookUserIdQuery($facebookConnector)
 {
     $userSelectQuery = "oxuser.oxfbid = " . oxDb::getDb()->quote($facebookConnector->getUser());
     $query = "select oxid from oxuser where oxuser.oxactive = 1 and {$userSelectQuery}";
     return $query;
 }
Beispiel #7
0
 /**
  * Fills user form with date taken from Facebook
  *
  * @return null
  */
 protected function _fillFormWithFacebookData()
 {
     // Create our Application instance.
     $oFacebook = oxFb::getInstance();
     if ($oFacebook->isConnected()) {
         $aMe = $oFacebook->api('/me');
         $aInvAdr = $this->getInvoiceAddress();
         $sCharset = oxLang::getInstance()->translateString("charset");
         // do not stop converting on error - just try to translit unknown symbols
         $sCharset .= '//TRANSLIT';
         if (!$aInvAdr["oxuser__oxfname"]) {
             $aInvAdr["oxuser__oxfname"] = iconv('UTF-8', $sCharset, $aMe["first_name"]);
         }
         if (!$aInvAdr["oxuser__oxlname"]) {
             $aInvAdr["oxuser__oxlname"] = iconv('UTF-8', $sCharset, $aMe["last_name"]);
         }
         $this->setInvoiceAddress($aInvAdr);
     }
 }