Changeset 26554 for extensions/CryptograPHP/admin.php
- Timestamp:
- Jan 9, 2014, 1:36:32 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/CryptograPHP/admin.php
r26072 r26554 34 34 'height' => (int)$_POST['height'], 35 35 'perturbation' => (float)$_POST['perturbation'], 36 'image_bg_color' => $_POST['image_bg_color'], 36 'background' => $_POST['background'], 37 'bg_color' => $_POST['bg_color'], 38 'bg_image' => $_POST['bg_image'], 37 39 'code_length' => (int)$_POST['code_length'], 38 40 'text_color' => $_POST['text_color'], … … 50 52 51 53 $presets = array( 52 'bluenoise' => array('perturbation'=>0.25, 'image_bg_color'=>'ffffff', 'text_color'=>'0000ff', 'num_lines'=>2, 'line_color'=>'0000ff', 'noise_level'=>2, 'noise_color'=>'0000ff', 'ttf_file'=>'AlteHassGroteskB'), 53 'gray' => array('perturbation'=>1, 'image_bg_color'=>'ffffff', 'text_color'=>'8a8a8a', 'num_lines'=>2, 'line_color'=>'8a8a8a', 'noise_level'=>0.1, 'noise_color'=>'8a8a8a', 'ttf_file'=>'TopSecret'), 54 'xcolor' => array('perturbation'=>0.5, 'image_bg_color'=>'ffffff', 'text_color'=>'random', 'num_lines'=>1, 'line_color'=>'ffffff', 'noise_level'=>2, 'noise_color'=>'ffffff', 'ttf_file'=>'Dread'), 55 'pencil' => array('perturbation'=>0.8, 'image_bg_color'=>'9e9e9e', 'text_color'=>'363636', 'num_lines'=>0, 'line_color'=>'ffffff', 'noise_level'=>0, 'noise_color'=>'ffffff', 'ttf_file'=>'AllStar'), 54 'bluenoise' => array('perturbation'=>0.25, 'background'=>'color', 'bg_image'=>'', 'bg_color'=>'ffffff', 'text_color'=>'0000ff', 'num_lines'=>2, 'line_color'=>'0000ff', 'noise_level'=>2, 'noise_color'=>'0000ff', 'ttf_file'=>'AlteHassGroteskB'), 55 'gray' => array('perturbation'=>1, 'background'=>'color', 'bg_image'=>'', 'bg_color'=>'ffffff', 'text_color'=>'8a8a8a', 'num_lines'=>2, 'line_color'=>'8a8a8a', 'noise_level'=>0.1, 'noise_color'=>'8a8a8a', 'ttf_file'=>'TopSecret'), 56 'xcolor' => array('perturbation'=>0.5, 'background'=>'color', 'bg_image'=>'', 'bg_color'=>'ffffff', 'text_color'=>'random', 'num_lines'=>1, 'line_color'=>'ffffff', 'noise_level'=>2, 'noise_color'=>'ffffff', 'ttf_file'=>'Dread'), 57 'pencil' => array('perturbation'=>0.8, 'background'=>'color', 'bg_image'=>'', 'bg_color'=>'9e9e9e', 'text_color'=>'363636', 'num_lines'=>0, 'line_color'=>'ffffff', 'noise_level'=>0, 'noise_color'=>'ffffff', 'ttf_file'=>'AllStar'), 58 'ransom' => array('perturbation'=>0, 'background'=>'image', 'bg_image'=>'bg1.jpg', 'bg_color'=>'ffffff', 'text_color'=>'4a003a', 'num_lines'=>0, 'line_color'=>'ffffff', 'noise_level'=>0, 'noise_color'=>'ffffff', 'ttf_file'=>'ransom'), 56 59 ); 57 60 61 62 $template->assign(array( 63 'crypto' => $conf['cryptographp'], 64 'loaded' => $loaded, 65 'fonts' => list_fonts(CRYPTO_PATH.'securimage/fonts'), 66 'backgrounds' => list_backgrounds(CRYPTO_PATH.'securimage/backgrounds'), 67 'PRESETS' => $presets, 68 'CRYPTO_PATH' => CRYPTO_PATH, 69 )); 70 71 $template->set_filename('plugin_admin_content', realpath(CRYPTO_PATH . 'template/admin.tpl')); 72 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 73 74 75 58 76 function list_fonts($dir) 59 77 { … … 65 83 { 66 84 if ($file !== '.' && $file !== '..' && get_extension($file)=='ttf') 67 $fonts[] = get_filename_wo_extension($file); 85 { 86 $fonts[get_filename_wo_extension($file)] = $dir . '/' . $file; 87 } 68 88 } 69 89 … … 72 92 } 73 93 74 $template->assign(array( 75 'crypto' => $conf['cryptographp'], 76 'loaded' => $loaded, 77 'fonts' => list_fonts(CRYPTO_PATH.'securimage/fonts'), 78 'PRESETS' => $presets, 79 'CRYPTO_PATH' => CRYPTO_PATH, 80 )); 81 82 $template->set_filename('plugin_admin_content', dirname(__FILE__).'/template/admin.tpl'); 83 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 94 function list_backgrounds($dir) 95 { 96 $dir = rtrim($dir, '/'); 97 $dh = opendir($dir); 98 $backgrounds = array(); 99 100 while (($file = readdir($dh)) !== false ) 101 { 102 if ($file !== '.' && $file !== '..') 103 { 104 $ext = get_extension($file); 105 if ($ext=='jpg' || $ext=='png' || $ext=='jpeg' || $ext=='gif') 106 { 107 $backgrounds[$file] = $dir . '/' . $file; 108 } 109 } 110 } 111 112 closedir($dh); 113 return $backgrounds; 114 }
Note: See TracChangeset
for help on using the changeset viewer.