function getOptionsSupported()
 {
     return array(gettext('Text') => array('key' => 'text_watermark_text', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext('Text for the watermark.')), gettext('Color') => array('key' => 'text_watermark_color', 'type' => OPTION_TYPE_COLOR_PICKER, 'order' => 0, 'desc' => gettext("Text color.")), gettext('Font') => array('key' => 'text_watermark_font', 'type' => OPTION_TYPE_SELECTOR, 'order' => 1, 'selections' => zp_getFonts(), 'desc' => gettext('Watermark font.')), '' => array('key' => 'text_watermark_save', 'type' => OPTION_TYPE_CUSTOM, 'order' => 3, 'desc' => gettext("Enter the text you wish for the watermark and choose the text color.")));
 }
Exemple #2
0
 /**
  * Returns array of supported options for the admin-options handler
  *
  * @return unknown
  */
 function getOptionsSupported()
 {
     $fontlist = zp_getFonts();
     $options = array(gettext('Hash key') => array('key' => 'zenphoto_captcha_key', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext('The key used in hashing the CAPTCHA string. Note: this key will change with each successful CAPTCHA verification.')), gettext('Allowed characters') => array('key' => 'zenphoto_captcha_string', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 1, 'desc' => gettext('The characters which may appear in the CAPTCHA string.')), gettext('CAPTCHA length') => array('key' => 'zenphoto_captcha_length', 'type' => OPTION_TYPE_RADIO, 'order' => 0, 'buttons' => array(gettext('3') => 3, gettext('4') => 4, gettext('5') => 5, gettext('6') => 6), 'desc' => gettext('The number of characters in the CAPTCHA.')), gettext('CAPTCHA font') => array('key' => 'zenphoto_captcha_font', 'type' => OPTION_TYPE_SELECTOR, 'order' => 3, 'selections' => array_merge(array('*' . gettext('random') . '*' => '*'), $fontlist), 'desc' => gettext('The font to use for CAPTCHA characters.')), gettext('CAPTCHA font size') => array('key' => 'zenphoto_captcha_font_size', 'type' => OPTION_TYPE_NUMBER, 'order' => 3.5, 'desc' => gettext('The size to use if the font is scalable (<em>TTF</em> and <em>Imagick</em> fonts.)')), '' => array('key' => 'zenphoto_captcha_image', 'type' => OPTION_TYPE_CUSTOM, 'order' => 4, 'desc' => gettext('Sample CAPTCHA image')));
     return $options;
 }
Exemple #3
0
define('OFFSET_PATH', 3);
require_once '../../functions.php';
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header("Content-type: image/png");
$cypher = preg_replace('/[^0-9a-f]/', '', sanitize(isset($_GET['i']) ? $_GET['i'] : NULL));
$key = getOption('zenphoto_captcha_key');
$string = rc4($key, pack("H*", $cypher));
$len = getOption('zenphoto_captcha_length');
$string = str_pad($string, $len - strlen($string), '*');
if (isset($_GET['f'])) {
    $fontname = sanitize($_GET['f'], 3);
} else {
    $fontname = getOption('zenphoto_captcha_font');
    if ($fontname == '*') {
        //	Random selection
        $fonts = zp_getFonts();
        shuffle($fonts);
        $fontname = array_shift($fonts);
    }
}
$font = zp_imageLoadFont($fontname, getOption('zenphoto_captcha_font_size'));
$pallet = array(array('R' => 16, 'G' => 110, 'B' => 3), array('R' => 132, 'G' => 4, 'B' => 16), array('R' => 103, 'G' => 3, 'B' => 143), array('R' => 143, 'G' => 32, 'B' => 3), array('R' => 143, 'G' => 38, 'B' => 48), array('R' => 0, 'G' => 155, 'B' => 18));
$fw = zp_imageFontWidth($font);
$w = $fw * $len + 2;
$h = $fh = zp_imagefontheight($font);
$kerning = min(4, floor($fw / 2) - 1);
$leading = $fh - 4;
$ink = $lead = $kern = array();
for ($i = 0; $i < $len; $i++) {
    $lead[$i] = rand(2, $leading);
    $h = max($h, $fh + $lead[$i] + 2);