Пример #1
0
 public function __construct($params = null)
 {
     if (isset($params['credential'])) {
         $this->credential = $params['credential'];
     } else {
         $this->credential = getCredential();
     }
     if (isset($params['session'])) {
         $this->session = $params['session'];
     } else {
         $this->session = getSession();
     }
     if (isset($params['user'])) {
         $this->user = $params['user'];
     } else {
         $this->user = new User();
     }
 }
Пример #2
0
 public function hasCredential($module)
 {
     $isAuth = false;
     $user_credential = getCredential();
     $dom = new DomDocument();
     $dom->load("config/credentials.xml");
     $userModule = $dom->getElementsByTagName($user_credential)->item(0);
     $isAuth = $userModule->getElementsByTagName("rdlaCoreDefault")->item(0)->firstChild->nodeValue;
     $getModule = $userModule->getElementsByTagName($module);
     foreach ($getModule as $mod) {
         $isAuth = $mod->firstChild->nodeValue;
     }
     if ($isAuth == 'false') {
         $isAuth = false;
     } else {
         if ($isAuth == 'true') {
             $isAuth = true;
         }
     }
     return $isAuth;
 }
Пример #3
0
 public function tokenAccess()
 {
     $oauthParameters = getCredential()->getOAuthParameters();
     $token = $oauthParameters['oauth_token'];
     $verifier = $oauthParameters['oauth_verifier'];
     $consumer = getDb()->getCredentialByUserToken($token);
     if (!$consumer) {
         echo 'oauth_error=oauth_invalid_consumer_key';
     } elseif ($consumer['verifier'] != $verifier) {
         echo 'oauth_error=oauth_invalid_verifier';
     } elseif ($consumer['type'] != Credential::typeRequest) {
         echo 'oauth_error=already_exchanged';
     } else {
         getCredential()->convertToken($consumer['id'], Credential::typeAccess);
         $consumer = getDb()->getCredentialByUserToken($token);
         printf('oauth_token=%s&oauth_token_secret=%s', $consumer['userToken'], $consumer['userSecret']);
     }
 }
Пример #4
0
 public static function show($module = "index")
 {
     global $config;
     return "<div style='position:fixed;bottom:0;left:0;width:100%;background:#900;color:#FFF;'><img src='skin/{$config->skin}/img/favicon.png' style='float:left;margin-right:1.5em;' alt='Cymcaël' /><span style='display:block;margin-top:6px;'> [DevToolBar] Debug - Module: {$module} - Credential: " . getCredential() . "</span></div>";
 }