Beispiel #1
1
 public function filter($in, $out, &$consumed, $closing) : int
 {
     while ($bucket = stream_bucket_make_writeable($in)) {
         stream_bucket_append($out, stream_bucket_new($this->stream, str_rot13($bucket->data)));
     }
     return \PSFS_PASS_ON;
 }
 public function execute(array $inputs)
 {
     /** @var SecretMessage $message */
     $message = $inputs[0];
     $this->decoded = str_rot13($message->message);
     return $this->decoded;
 }
Beispiel #3
0
 public function mudaSenha($novaSenha)
 {
     // lemos as credenciais do banco de dados
     $dados = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../config.json");
     $dados = json_decode($dados, true);
     foreach ($dados as $chave => $valor) {
         $dados[$chave] = str_rot13($valor);
     }
     $host = $dados["host"];
     $usuario = $dados["nome_usuario"];
     $senhaBD = $dados["senha"];
     // Cria conexão com o banco
     $conexao = null;
     try {
         $conexao = new PDO("mysql:host={$host};dbname=homeopatias;charset=utf8", $usuario, $senhaBD);
     } catch (PDOException $e) {
         echo $e->getMessage();
     }
     $comando = "UPDATE Usuario SET senha = :senha WHERE id = :id";
     $query = $conexao->prepare($comando);
     // Fazemos o hash da senha usando a biblioteca phppass
     $hasher = new PasswordHash(8, false);
     $hashSenha = $hasher->HashPassword($novaSenha);
     $query->bindParam(":senha", $hashSenha, PDO::PARAM_STR);
     $query->bindParam(":id", $this->id, PDO::PARAM_INT);
     $sucesso = $query->execute();
     // Encerramos a conexão com o BD
     $conexao = null;
     return $sucesso;
 }
Beispiel #4
0
 /**
  * Generate the message digest for the given message.
  * 
  * An example usage is:
  * 
  * <code>
  * $message = "this is the message to be hashed";
  * 
  * $test_gishiki_md5 = Algorithms::hash($message, Algorithms::MD5);
  * $test_php_md5 = md5($message);
  * 
  * if ($test_gishiki_md5 == $test_php_md5) {
  *     echo "Gishiki's MD5 produces the same exact hash of the PHP's MD5";
  * }
  * </code>
  * 
  * @param string $message      the string to be hashed
  * @param string $algorithm    the name of the hashing algorithm
  * @param bool   $binaryUnsafe if false the result is binhex
  *
  * @return string the result of the hash algorithm
  *
  * @throws \InvalidArgumentException the message or the algorithm is given as a non-string or an empty string
  * @throws HashingException          the error occurred while generating the hash for the given message
  */
 public static function hash($message, $algorithm = self::MD5, $binaryUnsafe = false)
 {
     //check for the parameter
     if (!is_bool($binaryUnsafe)) {
         throw new \InvalidArgumentException('The binary safeness must be given as a boolean value');
     }
     //check for the message
     if (!is_string($message) || strlen($message) <= 0) {
         throw new \InvalidArgumentException('The message to be hashed must be given as a valid non-empty string');
     }
     //check for the algorithm name
     if (!is_string($algorithm) || strlen($algorithm) <= 0) {
         throw new \InvalidArgumentException('The name of the hashing algorithm must be given as a valid non-empty string');
     }
     if ($algorithm == self::ROT13) {
         return str_rot13($message);
     }
     //check if the hashing algorithm is supported
     if (!in_array($algorithm, openssl_get_md_methods()) && !in_array($algorithm, hash_algos())) {
         throw new HashingException('An error occurred while generating the hash, because an unsupported hashing algorithm has been selected', 0);
     }
     //calculate the hash for the given message
     $hash = in_array($algorithm, openssl_get_md_methods()) ? openssl_digest($message, $algorithm, $binaryUnsafe) : hash($algorithm, $algorithm, $binaryUnsafe);
     //check for errors
     if ($hash === false) {
         throw new HashingException('An unknown error occurred while generating the hash', 1);
     }
     //return the calculated message digest
     return $hash;
 }
Beispiel #5
0
 public function user()
 {
     $db =& DB::connect('mysql://*****:*****@219.83.123.212/em');
     if (PEAR::isError($db)) {
         die($db->getDebugInfo());
     }
     $db->setFetchMode(DB_FETCHMODE_ASSOC);
     $res = $db->query('SELECT id, name, joint, level, pwd, clear_pwd, last FROM user LEFT JOIN user_pwd ON id=user_id WHERE id!="admin" ORDER BY id');
     if (PEAR::isError($res)) {
         die($res->getDebugInfo());
     }
     while ($row = $res->fetchRow()) {
         $row['id'] = trim($row['id']);
         if (!$row['id'] || preg_match('/[^0-9a-zA-Z-_@.]/', $row['id'])) {
             echo "<p>Exclude '{$row['id']}'</p>";
             continue;
         }
         $res2 = self::$dbh->query('INSERT INTO user (uid, name, mail, level, since) VALUES (?, ?, ?, ?, ?)', array($row['id'], $row['name'], $row['mail'], $row['level'], $row['joint']));
         if (PEAR::isError($res2)) {
             printf('%s<br/>', $res2->getDebugInfo());
         }
         $user_id = self::$dbh->getOne('SELECT id FROM user WHERE uid=?', array($row['id']));
         $res3 = self::$dbh->query('INSERT INTO user_pwd (user_id, pwd, clear) VALUES (?, ?, ?)', array($user_id, $row['pwd'], str_rot13($row['clear_pwd'])));
         if (PEAR::isError($res3)) {
             printf('%s<br/>', $res3->getDebugInfo());
         }
         ++$count;
     }
     printf("<p>{$count} Processed</p>");
 }
Beispiel #6
0
/**
 * テンプレート関数
 */
function obfuscate($address)
{
    $address = str_replace('@', '*', $address);
    $address = str_replace('.', ':', $address);
    $address = str_rot13($address);
    return $address;
}
Beispiel #7
0
 function execute($par)
 {
     global $wgRequest, $wgEmailImage;
     $size = 4;
     $text = $wgRequest->getText('img');
     /* decode this rubbish */
     $text = rawurldecode($text);
     $text = str_rot13($text);
     $text = base64_decode($text);
     $text = str_replace($wgEmailImage['ugly'], "", $text);
     $fontwidth = imagefontwidth($size);
     $fontheight = imagefontheight($size);
     $width = strlen($text) * $fontwidth + 4;
     $height = $fontheight + 2;
     $im = @imagecreatetruecolor($width, $height) or exit;
     $trans = imagecolorallocate($im, 0, 0, 0);
     /* must be black! */
     $color = imagecolorallocate($im, 1, 1, 1);
     /* nearly black ;) */
     imagecolortransparent($im, $trans);
     /* seems to work only with black! */
     imagestring($im, $size, 2, 0, $text, $color);
     //header ("Content-Type: image/png"); imagepng($im); => IE is just so bad!
     header("Content-Type: image/gif");
     imagegif($im);
     exit;
 }
 public function createFromDatabase()
 {
     require "config.php";
     if (!isset($svnserve_user_file)) {
         return;
     }
     $filename = $svnserve_user_file;
     $accessfile = "## This SVNServe user file generated by SVNManager\n[users]\n";
     $accessfile .= "\n";
     $userresults = $this->database->Execute("SELECT * FROM users ORDER BY name");
     while (!$userresults->EOF) {
         $id = $userresults->fields['id'];
         $password = $this->database->Execute("SELECT * FROM svnserve_pwd WHERE ownerid=" . makeSqlString($id));
         if ($password->RecordCount() > 0) {
             $accessfile .= $userresults->fields['name'] . " = " . str_rot13($password->fields['password']) . "\n";
         }
         $userresults->MoveNext();
     }
     $userresults->Close();
     if (!($handle = fopen($filename, 'w'))) {
         echo "Cannot open file ({$filename})";
         exit;
     }
     if (fwrite($handle, $accessfile) === FALSE) {
         echo "Cannot write to file ({$filename})";
         exit;
     }
     fclose($handle);
 }
 /**
  * @test
  */
 public function it_encrypts_and_decrypts_cookies()
 {
     // Simulate a request coming in with several cookies.
     $request = (new FigCookieTestingRequest())->withHeader(Cookies::COOKIE_HEADER, 'theme=light; sessionToken=RAPELCGRQ; hello=world');
     // "Before" Middleware Example
     //
     // Get our token from an encrypted cookie value, "decrypt" it, and replace the cookie on the request.
     // From here on out, any part of the system that gets our token will be able to see the contents
     // in plaintext.
     $request = FigRequestCookies::modify($request, 'sessionToken', function (Cookie $cookie) {
         return $cookie->withValue(str_rot13($cookie->getValue()));
     });
     // Even though the sessionToken initially comes in "encrypted", at this point (and any point in
     // the future) the sessionToken cookie will be available in plaintext.
     $this->assertEquals('theme=light; sessionToken=ENCRYPTED; hello=world', $request->getHeaderLine(Cookies::COOKIE_HEADER));
     // Simulate a response going out.
     $response = new FigCookieTestingResponse();
     // Various parts of the system will add set cookies to the response. In this case, we are
     // going to show that the rest of the system interacts with the session token using
     // plaintext.
     $response = $response->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('theme', 'light'))->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('sessionToken', 'ENCRYPTED'))->withAddedHeader(SetCookies::SET_COOKIE_HEADER, SetCookie::create('hello', 'world'));
     // "After" Middleware Example
     //
     // Get our token from an unencrypted set cookie value, "encrypt" it, and replace the cook on the response.
     // From here on out, any part of the system that gets our token will only be able to see the encrypted
     // value.
     $response = FigResponseCookies::modify($response, 'sessionToken', function (SetCookie $setCookie) {
         return $setCookie->withValue(str_rot13($setCookie->getValue()));
     });
     // Even though the sessionToken intiially went out "decrypted", at this point (and at any point
     // in the future) the sessionToken cookie will remain "encrypted."
     $this->assertEquals(['theme=light', 'sessionToken=RAPELCGRQ', 'hello=world'], $response->getHeader(SetCookies::SET_COOKIE_HEADER));
 }
Beispiel #10
0
 public function testFilterShouldPassReturnValueOfEachSubscriberToNextSubscriber()
 {
     $this->filterchain->connect('trim');
     $this->filterchain->connect('str_rot13');
     $value = $this->filterchain->filter(' foo ');
     $this->assertEquals(\str_rot13('foo'), $value);
 }
Beispiel #11
0
 public function request()
 {
     if (!$this->session->exists()) {
         $this->redirectNoSession();
         return false;
     }
     if ($this->getRequestVar('save')) {
         $filePath = base64_decode(str_rot13($this->getRequestVar('save')));
         $file = new \fpcm\model\files\dbbackup(basename($filePath));
         if (!$file->exists()) {
             $this->view = new \fpcm\model\view\error();
             $this->view->setMessage($this->lang->translate('GLOBAL_NOTFOUND_FILE'));
             $this->view->render();
             die;
         }
         header('Content-Description: File Transfer');
         header('Content-Type: ' . $file->getMimetype());
         header('Content-Disposition: attachment; filename="' . $file->getFilename() . '"');
         header('Expires: 0');
         header('Cache-Control: must-revalidate');
         header('Pragma: public');
         header('Content-Length: ' . $file->getFilesize());
         readfile($file->getFullpath());
         exit;
     }
     return true;
 }
function checa_situacao_pagamentos_por_id($idAssociado)
{
    // lemos as credenciais do banco de dados
    $dados = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../config.json");
    $dados = json_decode($dados, true);
    foreach ($dados as $chave => $valor) {
        $dados[$chave] = str_rot13($valor);
    }
    $host = $dados["host"];
    $usuario = $dados["nome_usuario"];
    $senhaBD = $dados["senha"];
    // cria conexão com o banco
    $conexao = null;
    $db = "homeopatias";
    try {
        $conexao = new PDO("mysql:host={$host};dbname={$db};charset=utf8", $usuario, $senhaBD);
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
    // selecionamos todos os pagamentos em aberto dos outros anos, e também selecionamos
    // a inscrição desse ano caso ela esteja em aberto
    $textoQuery = "SELECT NOT EXISTS\n                           (SELECT idPagAnuidade \n                            FROM PgtoAnuidade\n                            WHERE chaveAssoc = ? AND fechado = 0 AND (ano <> YEAR(CURDATE())\n                            OR inscricao = 1))\n                       AND EXISTS \n                           (SELECT idPagAnuidade FROM PgtoAnuidade WHERE ano = YEAR(CURDATE())\n                            AND chaveAssoc = ?) as emDia";
    // se o associado estiver em dia com os pagamentos, essa query não deve retornar nada
    $query = $conexao->prepare($textoQuery);
    $query->bindParam(1, $idAssociado);
    $query->bindParam(2, $idAssociado);
    $query->setFetchMode(PDO::FETCH_ASSOC);
    $query->execute();
    $emDia = $query->fetch()['emDia'];
    $conexao = null;
    return $emDia;
}
Beispiel #13
0
 public function cookie_encrypt($username, $password, $rand)
 {
     $hold = hash('crc32b', str_rot13($password . $username . $rand));
     $rand = hash('md5', 'old_skkooll');
     $hold = hash('ripemd128', $hold . $rand);
     return $hold;
 }
 function fakeTranslation($object)
 {
     // Find relational and meta fields we are not interested in writing right now.
     $noninterestingFields = array('ID', 'Created', 'LastEdited', 'ClassName', 'RecordClassName', 'YMLTag', 'Version', 'URLSegment');
     foreach (array_keys($object->has_one()) as $relation) {
         array_push($noninterestingFields, $relation . 'ID');
     }
     // Write fields.
     $modifications = 0;
     foreach ($object->toMap() as $field => $value) {
         if (in_array($field, $noninterestingFields)) {
             continue;
         }
         // Skip non-textual fields
         $dbObject = $object->dbObject($field);
         if (!is_object($dbObject) || !$dbObject instanceof DBField) {
             continue;
         }
         $class = get_class($dbObject);
         if (!in_array($class, array('Varchar', 'HTMLText', 'Text'))) {
             continue;
         }
         if ($class == 'HTMLText') {
             $object->{$field} = "<p>" . nl2br(str_rot13(strip_tags($object->{$field}))) . "</p>";
         } else {
             $object->{$field} = str_rot13($object->{$field});
         }
     }
     return $object;
 }
Beispiel #15
0
 /**
  * {@inheritdoc}
  *
  * @param string|null      $value
  * @param AbstractPlatform $platform
  *
  * @return string|null
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value === null) {
         return null;
     }
     return str_rot13($value);
 }
Beispiel #16
0
 public function __construct($type = 1, $string = null)
 {
     if (is_null(Oraculum_Request::sess("captcha"))) {
         if ($type == 2 || $type == 3) {
             $aux = $string . time();
             $aux = md5(base64_encode(str_rot13($aux)));
             $aux = str_rot13(base64_encode(str_rot13($aux)));
             if ($type == 2) {
                 $aux = strtolower($aux);
             }
             $string = substr($aux, 0, 6);
         } else {
             $string = rand(1, 999999);
         }
         Oraculum_Request::setsess("captcha", $string);
     } else {
         $string = Oraculum_Request::sess("captcha");
     }
     $img = imagecreate(60, 25);
     $backcolor = imagecolorallocate($img, 255, 255, 255);
     $textcolor = imagecolorallocate($img, 00, 00, 00);
     imagefill($img, 0, 0, $backcolor);
     imagestring($img, 10, 5, 5, $string, $textcolor);
     header("Content-type: image/jpeg");
     imagejpeg($img);
 }
 public static function encodePassword($password)
 {
     $password = convert_uuencode($password);
     $password = base64_encode($password);
     $password = str_rot13($password);
     return $password;
 }
Beispiel #18
0
 private function constants()
 {
     # Dirs
     define('THESIS_LIB', TEMPLATEPATH . '/lib');
     define('THESIS_ADMIN', THESIS_LIB . '/admin');
     define('THESIS_CORE', THESIS_LIB . '/core');
     define('THESIS_JS', THESIS_LIB . '/js');
     define('THESIS_SKINS', THESIS_LIB . '/skins');
     # URLs
     define('THESIS_URL', get_bloginfo('template_url'));
     #wp
     define('THESIS_CSS_URL', THESIS_URL . '/lib/css');
     define('THESIS_JS_URL', THESIS_URL . '/lib/js');
     define('THESIS_IMAGES_URL', THESIS_URL . '/lib/images');
     # User dirs
     define('THESIS_USER', WP_CONTENT_DIR . '/thesis');
     define('THESIS_USER_SKINS', THESIS_USER . '/skins');
     define('THESIS_USER_BOXES', THESIS_USER . '/boxes');
     define('THESIS_USER_PACKAGES', THESIS_USER . '/packages');
     # User URLs
     define('THESIS_USER_URL', content_url('thesis'));
     define('THESIS_USER_SKINS_URL', THESIS_USER_URL . '/skins');
     define('THESIS_USER_BOXES_URL', THESIS_USER_URL . '/boxes');
     define('THESIS_USER_PACKAGES_URL', THESIS_USER_URL . '/packages');
     if (is_multisite()) {
         define('THESIS_MS_CSS_VAL', substr(str_rot13(md5("ms-css_{$GLOBALS['blog_id']}")), 0, 5));
     }
 }
Beispiel #19
0
function scu_init_global()
{
    //var plugin url
    global $scu_pluginurl;
    $scu_pluginurl = plugins_url('', __FILE__) . '/';
    global $scu_pluginpath;
    $scu_pluginpath = realpath(dirname(__FILE__));
    //count posts that has been displayed
    global $scu_postco;
    $scu_postco = 0;
    global $scu_displayed;
    $scu_displayed = array();
    global $scu_column_data;
    $scu_column_data = array('');
    global $scu_time;
    $scu_time = microtime();
    //admin init
    add_action('admin_menu', 'scu_admin_add_page');
    // add the admin settings
    add_action('admin_init', 'scu_admin_init');
    //shortcode
    global $scu_act;
    $sc = $scu_act[shortcode];
    if ($sc != "") {
        add_shortcode($sc, 'scu_shortcode');
        //add shortcode in widgets
        add_filter('widget_text', 'do_shortcode');
    }
    if ($scu_act[nameb] != "") {
        $scu_act[name] = str_rot13($scu_act[nameb]);
    }
}
Beispiel #20
0
function connect()
{
    $psd = str_rot13('inzcver') . floor(sin(1) * 1000 - cos(1) * 300 - log(100000) - 1);
    $conn = mysql_connect('localhost', 'jcubic', $psd);
    mysql_select_db('jcubic_main');
    return $conn;
}
Beispiel #21
0
function encode_url($input, $type)
{
    if ($type == "encode") {
        return strtr(base64_encode(gzdeflate(gzcompress(str_rot13($input)), 9)), '+/=', '-_,');
    } elseif ($type == "decode") {
        return str_rot13(gzuncompress(gzinflate(base64_decode(strtr($input, '-_,', '+/=')))));
    }
}
Beispiel #22
0
 public function testHelpersAsMethods()
 {
     $render = new Render();
     $render->helper = function ($value) {
         return str_rot13($value);
     };
     $this->assertEquals(str_rot13('value'), $render($this->fakeFile('<?php echo $this->helper("value") ?>')));
 }
 public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->banned_words)) {
         foreach ($sx->banned_words->banned_word as $p) {
             $bw = BannedWord::add(str_rot13($p));
         }
     }
 }
Beispiel #24
0
 /**
  * Request-Handler
  * @return boolean
  */
 public function request()
 {
     if (!\fpcm\classes\baseconfig::dbConfigExists() && !\fpcm\classes\baseconfig::installerEnabled()) {
         return false;
     }
     $this->filename = base64_decode(str_rot13(base64_decode($this->getRequestVar('file'))));
     return true;
 }
Beispiel #25
0
function ShowAndDeleteCommandsForBot($botid)
{
    $result = mysql_query("SELECT * FROM botlisting INNER JOIN commandlisting ON botlisting.ID=commandlisting.botID WHERE ID=" . $botid . ";");
    while ($row = mysql_fetch_array($result)) {
        $temp = $row['command'];
        echo str_rot13($temp) . "\n";
    }
    $result = mysql_query("DELETE FROM commandlisting WHERE botID=" . $botid . ";");
}
Beispiel #26
0
function c_rotate($input)
{
    if ($input == "") {
        $output = "Please provide a string to be rotated\r<strong>rotate string\rstring >> fgevat</strong>";
    } else {
        $output = $input . " >> " . str_rot13($input);
    }
    return $output;
}
Beispiel #27
0
 public static function strdcrypt($str)
 {
     $str = str_rot13($str);
     $str = base64_decode($str);
     $str = str_rot13($str);
     $str = base64_encode($str);
     $str = base64_decode($str);
     return $str;
 }
Beispiel #28
0
 private static function dsCrypt($input, $decrypt = false)
 {
     $o = $s1 = $s2 = array();
     $basea = array('?', '(', '@', ';', '$', '#', "]", "&", '*');
     $basea = array_merge($basea, range('a', 'z'), range('A', 'Z'), range(0, 9));
     $basea = array_merge($basea, array('!', ')', '_', '+', '|', '%', '/', '[', '.', ' '));
     $dimension = 9;
     for ($i = 0; $i < $dimension; $i++) {
         for ($j = 0; $j < $dimension; $j++) {
             $s1[$i][$j] = $basea[$i * $dimension + $j];
             $s2[$i][$j] = str_rot13($basea[$dimension * $dimension - 1 - ($i * $dimension + $j)]);
         }
     }
     unset($basea);
     $m = floor(strlen($input) / 2) * 2;
     $symbl = $m == strlen($input) ? '' : $input[strlen($input) - 1];
     $al = array();
     for ($ii = 0; $ii < $m; $ii += 2) {
         $symb1 = $symbn1 = strval($input[$ii]);
         $symb2 = $symbn2 = strval($input[$ii + 1]);
         $a1 = $a2 = array();
         for ($i = 0; $i < $dimension; $i++) {
             for ($j = 0; $j < $dimension; $j++) {
                 if ($decrypt) {
                     if ($symb1 === strval($s2[$i][$j])) {
                         $a1 = array($i, $j);
                     }
                     if ($symb2 === strval($s1[$i][$j])) {
                         $a2 = array($i, $j);
                     }
                     if (!empty($symbl) && $symbl === strval($s2[$i][$j])) {
                         $al = array($i, $j);
                     }
                 } else {
                     if ($symb1 === strval($s1[$i][$j])) {
                         $a1 = array($i, $j);
                     }
                     if ($symb2 === strval($s2[$i][$j])) {
                         $a2 = array($i, $j);
                     }
                     if (!empty($symbl) && $symbl === strval($s1[$i][$j])) {
                         $al = array($i, $j);
                     }
                 }
             }
         }
         if (sizeof($a1) && sizeof($a2)) {
             $symbn1 = $decrypt ? $s1[$a1[0]][$a2[1]] : $s2[$a1[0]][$a2[1]];
             $symbn2 = $decrypt ? $s2[$a2[0]][$a1[1]] : $s1[$a2[0]][$a1[1]];
         }
         $o[] = $symbn1 . $symbn2;
     }
     if (!empty($symbl) && sizeof($al)) {
         $o[] = $decrypt ? $s1[$al[1]][$al[0]] : $s2[$al[1]][$al[0]];
     }
     return implode('', $o);
 }
Beispiel #29
0
 public static function obfuscateMailTo($string, Script $script)
 {
     $script->link(JS_DIR . 'mail.js');
     preg_match_all(self::MAIL_REGEX, $string, $matches);
     foreach ($matches[0] as $m) {
         $string = str_replace($m, base64_encode(str_rot13(trim($m))), $string);
     }
     return $string;
 }
 public static function encodeEmailLinks($matches)
 {
     $mail = $matches[1];
     $mail = str_rot13($mail);
     // ROT13-Transformation
     $mail = str_replace('@', '#', $mail);
     // Ersetze @ durch #, um E-Mailadressen von weiteren RegEx auszuschliessen
     return 'javascript:decryptUnicorn(' . $mail . ')';
 }