示例#1
0
 public function testShouldReturnFilteredValueEvenWhenRecursive()
 {
     $keys = array('foo' => new Keys(array('bar' => new Keys(array('baz' => $this->getFilterMockWithReturn('baz filtered value'))))));
     $input = array('foo' => array('bar' => array('baz' => 'baz value')), 'quox' => 'quox value');
     $expectedResult = array('foo' => array('bar' => array('baz' => 'baz filtered value')));
     $filter = new Keys($keys);
     $this->assertEquals($expectedResult, $filter->filter($input));
 }
示例#2
0
 public function getValidList()
 {
     $keys = Keys::find(["valid = '1'", "order" => "time DESC"]);
     $vKeys = [];
     foreach ($keys as $key) {
         $vKey = [];
         $vKey['key'] = $key->key;
         $vKey['lifetime'] = $key->time - time();
         $vKeys[] = $vKey;
     }
     return $vKeys;
 }
示例#3
0
文件: Query.php 项目: rob-st/Runalyze
 /**
  * @param array $keys
  * @return array
  */
 protected function collectColumnsForKeys(array $keys)
 {
     $columns = $this->defaultColumns();
     foreach ($keys as $key) {
         $KeyObject = Keys::get($key);
         if ($KeyObject->isInDatabase()) {
             if ($KeyObject->requiresJoin()) {
                 $joinDefinition = $KeyObject->joinDefinition();
                 if (!array_key_exists($joinDefinition['column'], $this->JoinTables)) {
                     $this->JoinTables[$joinDefinition['column']] = $joinDefinition;
                 }
             } else {
                 $appendix = $KeyObject->column();
                 if (is_array($appendix)) {
                     $columns = array_merge($columns, $appendix);
                 } else {
                     $columns[] = $appendix;
                 }
             }
         }
     }
     return array_unique($columns);
 }
示例#4
0
$topTitle = '';
$where = '';
//功能部分
include WEB_MOD . 'articles.class.php';
include WEB_MOD . 'articles_class.class.php';
$articles = new Articles();
$articles_class = new Articles_class();
//产品类功能
include WEB_MODULE . 'products/model/products_class.class.php';
$products_class = new Products_class();
include WEB_MOD . 'ads.class.php';
include WEB_MOD . 'adflash.class.php';
$ads = new Ads();
$adflash = new Adflash();
include WEB_MOD . 'keys.class.php';
$keys = new Keys();
include WEB_INC . 'validator.class.php';
$v = new Validator();
include WEB_MOD . 'links.class.php';
$links = new Links();
$templatefile = '';
$classinfo = '';
//
//classid
if (isset($classid)) {
    $classid = intval($classid);
}
if (isset($id)) {
    $id = intval($id);
}
if (isset($filename)) {
示例#5
0
 /**
  * Generate data array from base class
  * @param array $keysArray array(keyid => active(true|false))
  */
 protected function generateDataFor(array $keysArray)
 {
     foreach ($keysArray as $keyid => $isActive) {
         $this->Data[$keyid] = array('active' => $isActive, 'style' => Keys::get($keyid)->defaultCssStyle());
     }
 }
示例#6
0
文件: keys.php 项目: zrwlc2008/abhx
/**
* ZCNCMS
* 关键词
* php>=5.0
* @author LEI
* @version 1.1.2
* @time 20111004
*/
//初始化
$pagetitle = '关键词管理';
$pagepower = 'sys';
//基本部分
require 'checkpower.inc.php';
//功能部分
include WEB_MOD . 'keys.class.php';
$keys = new Keys();
switch ($a) {
    case 'list':
    default:
        //list
        $pageListNum = 12;
        //每页显示
        $totalPage = 0;
        //总页数
        $page = isset($page) ? (int) $page : 1;
        $start = ($page - 1) * $pageListNum;
        $List = $keys->GetList(array('id', 'title', 'linkurl', 'orders', 'replacenum'), $start, $pageListNum, '');
        include WEB_INC . "page.class.php";
        $sqlNum = "select id from `{tablepre}keys`";
        $db->Execute($sqlNum);
        $pageNum = $db->GetRsNum();
示例#7
0
 /**
  * Test Load Nonexistent Theme
  *
  * Test what happens when a theme does not exist
  *
  * @expectedException               Kohana_Exception
  * @expectedExceptionMessage did not contain your replace character
  * @group keys
  *
  */
 public function testGenerateFormatWithoutReplaceChar()
 {
     $key = Keys::Generate("hdjas-skajdkasj-dj938-8848");
 }
示例#8
0
 /**
  * Password sent by user must be:
  * sha1(saved_hash + Y-m-d)
  * 
  * @param type $login
  * @param type $password
  * @return int
  */
 public function getUserId($login, $password)
 {
     $user = $this->findFirst("login = '******'");
     if ($user != false) {
         $keys = new Keys();
         $vKeys = [];
         foreach ($keys->getValidList() as $key) {
             $vKeys[] = sha1($user->password . $key['key']);
         }
         if (in_array($password, $vKeys)) {
             return $user->id;
         }
     }
     return null;
 }
 private function getKeys()
 {
     $keys = new Keys();
     return $keys->getValidList();
 }
示例#10
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: jordan.knott
 * Date: 4/20/2016
 * Time: 9:15 AM
 */
/**
 * Login Controller
 * Only accepted method is POST, which contains the API KEY. Returns the session token in JSON.
 */
require '../data/api_keys.php';
require '../lib/utils.php';
if (isset($_POST['APIKEY'])) {
    $api_key = $_POST['APIKEY'];
    $key = new Keys();
    $keys = $key->getKeys();
    foreach ($keys as $key) {
        if ($api_key == $key) {
            generateToken();
            break;
        }
    }
} else {
    returnError(1);
}
function generateToken()
{
    echo "logintoken2000";
}