예제 #1
0
 public function actionIndex()
 {
     $this->render('', false);
     $uid = get_param($this->authdata, 'id');
     // Если не авторизованы то идет лесом
     if (!$uid) {
         $this->redirect('/login/');
     }
     // иначе получим список доступных ему сайтов, и нарисуем ссылки на них
     $sites = $this->model->getGrantedSites($uid);
     $this->render('', false);
     if (count($sites) === 0) {
         $this->render('no-sites');
         return;
     }
     $this->data['siteList'] = '';
     $secure = [$uid, date('Y-m-d H:i:s'), get_param($this->authdata, 'fullname')];
     foreach ($sites as $item) {
         $link = get_param($item, 'link');
         $name = get_param($item, 'sitename');
         $key = get_param($item, 'passkey');
         $cipherText = Cipher::encode($secure, $key, true);
         $cipherText = strtr($cipherText, '+/=', '-,_');
         $link .= "auth/openid/";
         if (strpos($link, 'oper') !== false) {
             $link .= 'token/';
         }
         $link .= $cipherText;
         $this->data['siteList'] .= CHtml::createLink($name, null, ['href' => $link, 'class' => 'list-group-item strong italic']);
     }
     $this->render('panel', false);
     $this->render('');
 }
예제 #2
0
파일: run.php 프로젝트: nickmartin90/cs_465
<?php

/**
 * Created by PhpStorm.
 * User: nickmartin
 * Date: 9/8/15
 * Time: 5:12 PM
 */
include_once 'cipher.php';
include_once 'aes.php';
$cipher = new Cipher();
$cipher->encode();
$cipher->decode();
//print_r($cipher->decode());