Beispiel #1
0
 function generateImage($token)
 {
     $fig = new phpFiglet();
     if (!$fig->loadFont('saf/lib/Ext/phpfiglet/fonts/' . $this->font)) {
         $this->error = 'Failed to load font file.';
         return false;
     }
     return $fig->fetch($token);
 }
Beispiel #2
0
 /**
  * Returns the HTML to display the CAPTCHA with the chosen method
  */
 public function getHTML()
 {
     global $ID;
     $rand = (double) rand(0, 10000) / 10000;
     if ($this->getConf('mode') == 'math') {
         $code = $this->_generateMATH($this->_fixedIdent(), $rand);
         $code = $code[0];
         $text = $this->getLang('fillmath');
     } elseif ($this->getConf('mode') == 'question') {
         $text = $this->getConf('question');
     } else {
         $code = $this->_generateCAPTCHA($this->_fixedIdent(), $rand);
         $text = $this->getLang('fillcaptcha');
     }
     $secret = $this->encrypt($rand);
     $txtlen = $this->getConf('lettercount');
     $out = '';
     $out .= '<div id="plugin__captcha_wrapper">';
     $out .= '<input type="hidden" name="' . $this->field_sec . '" value="' . hsc($secret) . '" />';
     $out .= '<label for="plugin__captcha">' . $text . '</label> ';
     switch ($this->getConf('mode')) {
         case 'math':
         case 'text':
             $out .= $this->_obfuscateText($code);
             break;
         case 'js':
             $out .= '<span id="plugin__captcha_code">' . $this->_obfuscateText($code) . '</span>';
             break;
         case 'image':
             $out .= '<img src="' . DOKU_BASE . 'lib/plugins/captcha/img.php?secret=' . rawurlencode($secret) . '&amp;id=' . $ID . '" ' . ' width="' . $this->getConf('width') . '" height="' . $this->getConf('height') . '" alt="" /> ';
             break;
         case 'audio':
             $out .= '<img src="' . DOKU_BASE . 'lib/plugins/captcha/img.php?secret=' . rawurlencode($secret) . '&amp;id=' . $ID . '" ' . ' width="' . $this->getConf('width') . '" height="' . $this->getConf('height') . '" alt="" /> ';
             $out .= '<a href="' . DOKU_BASE . 'lib/plugins/captcha/wav.php?secret=' . rawurlencode($secret) . '&amp;id=' . $ID . '"' . ' class="JSnocheck" title="' . $this->getLang('soundlink') . '">';
             $out .= '<img src="' . DOKU_BASE . 'lib/plugins/captcha/sound.png" width="16" height="16"' . ' alt="' . $this->getLang('soundlink') . '" /></a>';
             break;
         case 'figlet':
             require_once dirname(__FILE__) . '/figlet.php';
             $figlet = new phpFiglet();
             if ($figlet->loadfont(dirname(__FILE__) . '/figlet.flf')) {
                 $out .= '<pre>';
                 $out .= rtrim($figlet->fetch($code));
                 $out .= '</pre>';
             } else {
                 msg('Failed to load figlet.flf font file. CAPTCHA broken', -1);
             }
             break;
     }
     $out .= ' <input type="text" size="' . $txtlen . '" name="' . $this->field_in . '" class="edit" /> ';
     // add honeypot field
     $out .= '<label class="no">' . $this->getLang('honeypot') . '<input type="text" name="' . $this->field_hp . '" /></label>';
     $out .= '</div>';
     return $out;
 }
 function get_ascii($type, $bigtext, $smalltext, $font)
 {
     $line = '';
     $options = $this->get_options();
     // check cache
     if ($options[$type]['bigtext'] == $bigtext && $options[$type]['font'] == $font) {
         $line = $options[$type]['line'];
     } else {
         if ($bigtext) {
             require "phpfiglet_class.php";
             $phpFiglet = new phpFiglet();
             if ($phpFiglet->loadFont(dirname(__FILE__) . '/fonts/' . $font)) {
                 $line = $phpFiglet->fetch($bigtext);
             } else {
                 $line = "Could not load font file";
             }
             $options[$type]['bigtext'] = $bigtext;
             $options[$type]['font'] = $font;
             $options[$type]['line'] = $line;
             update_option($this->DB_option, $options);
         }
     }
     return $line;
 }
Beispiel #4
0
ini_set('max_execution_time', 0);
ini_set('log_errors', 0);
require_once "./config.php";
require_once "./geshi/geshi.php";
require_once "./class/utilities_class.php";
require_once "./class/phpfiglet_class.php";
require_once "./class/mybb_class.php";
require_once "./class/html_class.php";
require_once "./class/cookie_class.php";
require_once "./class/admin_class.php";
require_once "./class/post_class.php";
/*
 * Create instance of all available Class object
 */
$post_inst = new post();
$phpFiglet = new phpFiglet();
$inst_post = new mybb_style();
$htmlinst = new html();
$admin = new adminclass();
$util = new utilities();
$cook = new cookie();
/*
 * Check if sqlite database file is not existed
 * If yes, then redirect to create.php
 */
if (sqlite_file == '' || !file_exists(sqlite_file)) {
    $htmlinst->change_location("./create.php");
}
$_SERVER['REMOTE_ADDR'] = $util->get_client_ip($_SERVER);
$phpFiglet->loadFont("./figlet/spliff.flf");
$db = new SQLite3(sqlite_file, SQLITE3_OPEN_READWRITE);
Beispiel #5
0
<html>
<body>
<pre>
<?php 
/*        _         _____  _       _       _
 *   ___ | |_  ___ |   __||_| ___ | | ___ | |_
 *  | . ||   || . ||   __|| || . || || -_||  _|
 *  |  _||_|_||  _||__|   |_||_  ||_||___||_|
 *  |_|       |_|            |___|
 *
 *  Usage example script
 *
 */
require "phpfiglet_class.php";
$phpFiglet = new phpFiglet();
if ($phpFiglet->loadFont("fonts/standard.flf")) {
    $phpFiglet->display("phpFiglet Rulez!");
} else {
    trigger_error("Could not load font file");
}
?>
<pre>
</body>
</html>
Beispiel #6
0
<?php

/*        _         _____  _       _       _
 *   ___ | |_  ___ |   __||_| ___ | | ___ | |_
 *  | . ||   || . ||   __|| || . || || -_||  _|
 *  |  _||_|_||  _||__|   |_||_  ||_||___||_|
 *  |_|       |_|            |___|
 *
 *  This script opens the supplied font directory and
 *  shows a line of text in every available font
 *
 */
require "phpfiglet_class.php";
$out = "";
$phpFiglet = new phpFiglet();
if ($handle = opendir('fonts')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            if ($phpFiglet->loadFont("fonts/" . $file)) {
                $out .= $file . "\n";
                $out .= $phpFiglet->fetch("Hello World");
                $out .= "\n\n";
            }
        }
    }
    closedir($handle);
}
?>
<html>
<body>
<pre>