This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( defined('XOOPS_MAINFILE_INCLUDED') === false ) { | |
define('XOOPS_MAINFILE_INCLUDED', 1); | |
// Paths | |
define('XOOPS_ROOT_PATH', ''); | |
define('XOOPS_TRUST_PATH', ''); | |
// URLs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dbname = 'test'; | |
$host = 'localhost'; | |
$user = 'root'; | |
$pass = 'root'; | |
$dsn = sprintf('mysql:dbname=%s;host=%s', $dbname, $host); | |
$options = array( | |
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function decToBits($dec) | |
{ | |
$bin = decbin($dec); | |
$bits = str_split($bin); | |
$bits = array_reverse($bits); | |
$bits = array_filter($bits); | |
foreach ( $bits as $pos => $bit ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php > var_dump(PHP_INT_MAX); | |
int(9223372036854775807) | |
php > var_dump(decbin(PHP_INT_MAX)); | |
string(63) "111111111111111111111111111111111111111111111111111111111111111" | |
php > var_dump(-1 * PHP_INT_MAX); | |
int(-9223372036854775807) | |
php > var_dump(decbin(-1 * PHP_INT_MAX)); | |
string(64) "1000000000000000000000000000000000000000000000000000000000000001" | |
php > var_dump(decbin(-1)); | |
string(64) "1111111111111111111111111111111111111111111111111111111111111111" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo | |
{ | |
public function getClosure() | |
{ | |
$that = $this; | |
$closure = function() use ($that) { | |
$that->bar(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait Foo | |
{ | |
final public static function staticMethod() | |
{ | |
echo __METHOD__, PHP_EOL; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PDOTest extends \PHPUnit_Framework_TestCase | |
{ | |
public function test__construct() | |
{ | |
$pdo = $this | |
->getMockBuilder('\Suin\PDO') | |
->setMethods(array('_getDefaultAttributes')) | |
->disableOriginalConstructor() | |
->getMock(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_prompt -d "Write out the prompt" | |
if [ $status -eq 0 ] | |
set emoticon "^_^" | |
set color green | |
else | |
set emoticon ">_<" | |
set color red | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git diff templates/profile_inc_data_edit.html | |
diff --git a/html/modules/profile/templates/profile_inc_data_edit.html b/html/modules/profile/templates/profile_inc_data_edit.html | |
index a354763..657a917 100644 | |
--- a/html/modules/profile/templates/profile_inc_data_edit.html | |
+++ b/html/modules/profile/templates/profile_inc_data_edit.html | |
@@ -21,7 +21,7 @@ | |
<{elseif $def->get('type')=="selectbox"}> | |
<select name="<{$def->getShow('field_name')}>" id="legacy_xoopsform_<{$def->getShow('field_name')}>"> | |
<{foreach item=option from=$def->mFieldType->getOption($def)}> | |
- <option value="<{$option}>"<{if $profile->get($def->getShow('field_name'))==$option}> selected="selected"<{/if}>><{$option}></option> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CVE_2012_1823 extends XCube_ActionFilter | |
{ | |
public function preFilter() | |
{ | |
if ( $_SERVER['QUERY_STRING'] === '-s' ) | |
{ | |
header('Content-type: text/html; charset=utf-8'); | |
$sourceCode = $this->_getSourceCode(); |