Changeset 19428


Ignore:
Timestamp:
Dec 14, 2012, 3:35:07 PM (8 years ago)
Author:
mistic100
Message:

change reload icon with color choice (dark or light), separate HTML and PHP

Location:
extensions/CryptograPHP
Files:
6 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • extensions/CryptograPHP/admin.php

    r15996 r19428  
    33
    44global $pwg_loaded_plugins;
    5 $loaded = array();
    6 if (isset($pwg_loaded_plugins['ContactForm'])) $loaded['contactform'] = true;
    7 if (isset($pwg_loaded_plugins['Comments_on_Albums'])) $loaded['category'] = true;
    8 if (isset($pwg_loaded_plugins['GuestBook'])) $loaded['guestbook'] = true;
     5$loaded = array(
     6  'contactform' => isset($pwg_loaded_plugins['ContactForm']),
     7  'category' => isset($pwg_loaded_plugins['Comments_on_Albums']),
     8  'guestbook' => isset($pwg_loaded_plugins['GuestBook']),
     9  );
    910
    10 // $conf['cryptographp'] = unserialize($conf['cryptographp']);
     11
    1112load_language('plugin.lang', CRYPTO_PATH);
    1213
     14
    1315if ( isset($_POST['submit']))
    14 {
     16{ 
    1517  $conf['cryptographp'] = array(
    1618    'activate_on'     => array(
    1719          'picture'     => isset($_POST['activate_on']['picture']),
    18           'category'    => isset($_POST['activate_on']['category']) || !isset($loaded['category']),
     20          'category'    => isset($_POST['activate_on']['category']) || !$loaded['category'],
    1921          'register'    => isset($_POST['activate_on']['register']),
    20           'contactform' => isset($_POST['activate_on']['contactform']) || !isset($loaded['contactform']),
    21           'guestbook'   => isset($_POST['activate_on']['guestbook']) || !isset($loaded['guestbook']),
     22          'contactform' => isset($_POST['activate_on']['contactform']) || !$loaded['contactform'],
     23          'guestbook'   => isset($_POST['activate_on']['guestbook']) || !$loaded['guestbook'],
    2224          ),
    2325    'comments_action' => $_POST['comments_action'],
     
    3638    'noise_color'     => $_POST['noise_color'],
    3739    'ttf_file'        => $_POST['ttf_file'],
     40    'button_color'    => $_POST['button_color'],
    3841    );
    3942 
  • extensions/CryptograPHP/include/category.inc.php

    r17319 r19428  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 load_language('plugin.lang', CRYPTO_PATH);
     4include(CRYPTO_PATH.'include/common.inc.php');
    55add_event_handler('loc_begin_index', 'add_crypto');
    66add_event_handler('user_comment_check_albums', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     
    99{
    1010  global $template;
    11  
    12   if (!is_a_guest()) return;
    13  
    1411  $template->set_prefilter('comments_on_albums', 'prefilter_crypto');
    1512}
     
    1714function prefilter_crypto($content, $smarty)
    1815{
    19   global $conf;
    20  
    2116  $search = '{$comment_add.CONTENT}</textarea></p>';
    22   $replace = $search.'
    23                                 <p><label>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</label></p>
    24                                 <p>
    25                                   <img id="captcha" src="{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
    26                                   <a href="#" onclick="document.getElementById(\'captcha\').src = \'{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
    27                                     <img src="{$ROOT_URL}'.CRYPTO_PATH.'template/refresh.png"></a>
    28           <input type="text" name="captcha_code" style="width:'.$conf['cryptographp']['code_length'].'em;" maxlength="'.$conf['cryptographp']['code_length'].'" />
    29                                 </p>';
    30 
    31   return str_replace($search, $replace, $content);
     17  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
    3218}
    3319
  • extensions/CryptograPHP/include/contactform.inc.php

    r17484 r19428  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 load_language('plugin.lang', CRYPTO_PATH);
     4include(CRYPTO_PATH.'include/common.inc.php');
    55add_event_handler('loc_begin_index', 'add_crypto');
    66add_event_handler('contact_form_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     
    99{
    1010  global $template;
    11 
    12   if (!is_a_guest()) return;
    13 
    1411  $template->set_prefilter('index', 'prefilter_crypto');
    1512}
     
    1714function prefilter_crypto($content, $smarty)
    1815{
    19   global $conf;
    20  
    2116  $search = '{$contact.content}</textarea></td>';
    22   $replace = $search.'
    23       </tr>     
    24       <tr>
    25         <td class="title">
    26           {\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate}
    27         </td>
    28         <td>
    29           <input type="text" name="captcha_code" id="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />
    30           <img id="captcha" src="{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image" style="vertical-align:top;">
    31           <a href="#" id="captcha_refresh" onclick="document.getElementById(\'captcha\').src = \'{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
    32             <img src="{$ROOT_URL}'.CRYPTO_PATH.'template/refresh.png" style="vertical-align:bottom;"></a>
    33         </td>
    34        
    35 {footer_script}
    36 var captcha_code = new LiveValidation("captcha_code", {ldelim} onlyOnSubmit: true, insertAfterWhatNode: "captcha_refresh" });
    37 captcha_code.add(Validate.Presence, {ldelim} failureMessage: "{\'Invalid Captcha\'|@translate}" });
    38 {/footer_script}';
    39  
    40   return str_replace($search, $replace, $content);
     17  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
    4118}
    4219
  • extensions/CryptograPHP/include/guestbook.inc.php

    r17319 r19428  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 load_language('plugin.lang', CRYPTO_PATH);
     4include(CRYPTO_PATH.'include/common.inc.php');
    55add_event_handler('loc_begin_index', 'add_crypto');
    66add_event_handler('user_comment_check_guestbook', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     
    99{
    1010  global $template;
    11  
    12   if (!is_a_guest()) return;
    13  
    1411  $template->set_prefilter('index', 'prefilter_crypto');
    1512}
     
    1714function prefilter_crypto($content, $smarty)
    1815{
    19   global $conf;
    20  
    2116  $search = '{$comment_add.CONTENT}</textarea></p>';
    22   $replace = $search.'
    23                                 <p><label>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</label></p>
    24                                 <p>
    25                                   <img id="captcha" src="{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
    26                                   <a href="#" onclick="document.getElementById(\'captcha\').src = \'{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
    27                                     <img src="{$ROOT_URL}'.CRYPTO_PATH.'template/refresh.png"></a>
    28           <input type="text" name="captcha_code" style="width:'.$conf['cryptographp']['code_length'].'em;" maxlength="'.$conf['cryptographp']['code_length'].'" />
    29                                 </p>';
    30 
    31   return str_replace($search, $replace, $content);
     17  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
    3218}
    3319
  • extensions/CryptograPHP/include/picture.inc.php

    r17319 r19428  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 load_language('plugin.lang', CRYPTO_PATH);
     4include(CRYPTO_PATH.'include/common.inc.php');
    55add_event_handler('loc_end_picture', 'add_crypto');
    66add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     
    99{
    1010  global $template;
    11  
    12   if (!is_a_guest()) return;
    13  
    1411  $template->set_prefilter('picture', 'prefilter_crypto');
    1512}
     
    1714function prefilter_crypto($content, $smarty)
    1815{
    19   global $conf;
    20  
    2116  $search = '{$comment_add.CONTENT}</textarea></p>';
    22   $replace = $search.'
    23                                 <p><label>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</label></p>
    24                                 <p>
    25                                   <img id="captcha" src="{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image">
    26                                   <a href="#" onclick="document.getElementById(\'captcha\').src = \'{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
    27                                     <img src="{$ROOT_URL}'.CRYPTO_PATH.'template/refresh.png"></a>
    28           <input type="text" name="captcha_code" style="width:'.$conf['cryptographp']['code_length'].'em;" maxlength="'.$conf['cryptographp']['code_length'].'" />
    29                                 </p>';
    30 
    31   return str_replace($search, $replace, $content);
     17  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
    3218}
    3319
  • extensions/CryptograPHP/include/register.inc.php

    r17319 r19428  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 load_language('plugin.lang', CRYPTO_PATH);
     4include(CRYPTO_PATH.'include/common.inc.php');
    55add_event_handler('loc_end_page_header', 'add_crypto');
    66add_event_handler('register_user_check', 'check_crypto');
     
    99{
    1010  global $template;
    11 
    1211  $template->set_prefilter('register', 'prefilter_crypto');
    1312}
     
    1514function prefilter_crypto($content, $smarty)
    1615{
    17   global $conf, $user;
    18    
    1916  $search = '#\(\{\'useful when password forgotten\'\|@translate\}\)(\s*)((\{/if\})?)#i';
    20   $replace = '({\'useful when password forgotten\'|@translate})$1$2
    21       </li>
    22       <li>
    23         <span class="property">
    24           <label for="captcha_code">{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"></label>
    25           <a href="#" onclick="document.getElementById(\'captcha\').src = \'{$ROOT_URL}'.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false">
    26             <img src="{$ROOT_URL}'.CRYPTO_PATH.'template/refresh.png"></a>
    27         </span>
    28         <input type="text" id="captcha_code" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />';
    29 
     17  $replace = '({\'useful when password forgotten\'|@translate})$1$2'."\n".'{\$CRYPTOGRAPHP}';
    3018  return preg_replace($search, $replace, $content);
    3119}
  • extensions/CryptograPHP/language/en_UK/plugin.lang.php

    r15996 r19428  
    44$lang['Enter code'] = 'Enter code';
    55$lang['Solve equation'] = 'Solve equation';
     6$lang['Button color'] = 'Button color';
    67
    78$lang['Comments action'] = 'Comments action';
  • extensions/CryptograPHP/language/fr_FR/plugin.lang.php

    r15996 r19428  
    44$lang['Enter code'] = 'Recopiez le code';
    55$lang['Solve equation'] = 'Resolvez l\'équation';
     6$lang['Button color'] = 'Couleur du bouton';
    67
    78$lang['Comments action'] = 'Action pour les commentaires';
  • extensions/CryptograPHP/main.inc.php

    r17484 r19428  
    2828  global $conf, $user;
    2929 
    30   // brace yourself, smartphones spammers are comming !
     30  $conf['cryptographp'] = unserialize($conf['cryptographp']);
     31 
     32  if (!is_a_guest()) return;
    3133  if ($user['theme'] == 'smartpocket') return;
    32  
    33   $conf['cryptographp'] = unserialize($conf['cryptographp']);
    3434 
    3535  if (script_basename() == 'register' and $conf['cryptographp']['activate_on']['register'])
    3636  {
     37    $conf['cryptographp']['template'] = 'register';
    3738    include(CRYPTO_PATH.'include/register.inc.php');
    3839  }
    3940  else if (script_basename() == 'picture' and $conf['cryptographp']['activate_on']['picture'])
    4041  {
     42    $conf['cryptographp']['template'] = 'comment';
    4143    include(CRYPTO_PATH.'include/picture.inc.php');
    4244  }
     
    4850  global $conf, $pwg_loaded_plugins, $page, $user;
    4951 
     52  if (!is_a_guest()) return;
    5053  if ($user['theme'] == 'smartpocket') return;
    5154 
     
    5659    )
    5760  {
     61    $conf['cryptographp']['template'] = 'comment';
    5862    include(CRYPTO_PATH.'include/category.inc.php');
    5963  }
    6064  else if ( preg_match('#contact/?$#', $_SERVER['REQUEST_URI']) and $conf['cryptographp']['activate_on']['contactform'])
    6165  {
     66    $conf['cryptographp']['template'] = 'contactform';
    6267    include(CRYPTO_PATH.'include/contactform.inc.php');
    6368  }
    6469  else if (isset($page['section']) and $page['section'] == 'guestbook' and $conf['cryptographp']['activate_on']['guestbook'])
    6570  {
     71    $conf['cryptographp']['template'] = 'comment';
    6672    include(CRYPTO_PATH.'include/guestbook.inc.php');
    6773  }
  • extensions/CryptograPHP/maintain.inc.php

    r16311 r19428  
    2323  'noise_color'     => '8a8a8a',
    2424  'ttf_file'        => 'TopSecret',
     25  'button_color'    => 'dark',
    2526)));
    2627
     
    5960      conf_update_param('cryptographp', serialize($conf['cryptographp']));
    6061    }
     62    if (!isset($conf['cryptographp']['button_color']))
     63    {
     64      $conf['cryptographp']['button_color'] = 'dark';
     65      conf_update_param('cryptographp', serialize($conf['cryptographp']));
     66    }
    6167  }
    6268}
  • extensions/CryptograPHP/securimage/securimage_preview.php

    r14527 r19428  
    88
    99if (!is_admin()) die('Hacking attempt!');
     10
    1011
    1112$temp_conf = array(
     
    2425  );
    2526
     27 
    2628// randomize colors
    2729function randomColor()
     
    4042  if ($temp_conf[$color] == 'random') $temp_conf[$color] = randomColor();
    4143}
     44
    4245
    4346require_once dirname(__FILE__) . '/securimage.php';
  • extensions/CryptograPHP/securimage/securimage_show.php

    r12619 r19428  
    4444 */
    4545
    46 // error_reporting(E_ALL); ini_set('display_errors', 1); // uncomment this line for debugging
    47 
    4846define('PHPWG_ROOT_PATH','../../../');
    4947include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
    5048
    51 // $conf['cryptographp'] = unserialize($conf['cryptographp']);
    5249
    5350// randomize colors
     
    6764  if ($conf['cryptographp'][$color] == 'random') $conf['cryptographp'][$color] = randomColor();
    6865}
     66
    6967
    7068require_once dirname(__FILE__) . '/securimage.php';
  • extensions/CryptograPHP/template/admin.tpl

    r15996 r19428  
    2929    });
    3030 
     31  // change button
     32  $('.button').click(function() {
     33    $('.button').removeClass('selected');
     34    $(this).addClass('selected');
     35    $('input[name=button_color]').val($(this).attr('title'));
     36    $('#reload').attr('src', '{/literal}{$CRYPTO_PATH}{literal}template/refresh_'+ $(this).attr('title') +'.png');
     37  });
     38 
    3139  // apply a preset
    3240  $('.preset').click(function() {
     
    5361    changePreview();
    5462  });
    55   $('#captcha').click(function() {
     63  $('#reload').click(function() {
    5664    changePreview();
    5765  });
     
    109117{/foreach}
    110118
    111 .preset img {ldelim}
     119.preset img, .button img {ldelim}
    112120  margin:1px;
    113121  padding:3px;
    114122  border:1px solid #999;
    115123}
    116 .preset.selected img {ldelim}
     124.preset.selected img, .button.selected img {ldelim}
    117125  border-color:#f70;
    118126}
     
    163171      <span class="property">{'Height'|@translate}</span>
    164172      <label><input type="text" name="height" class="preview" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|@translate} lenght&times;12</label>
     173    </li>
     174    <li>
     175      <span class="property">{'Button color'|@translate}</span>
     176      <div style="display:relative;margin-left:51%;">
     177        <a class="button {if $crypto.button_color == 'dark'}selected{/if}" title="dark"><img src="{$CRYPTO_PATH}template/refresh_dark.png" alt="dark"></a>
     178        <a class="button {if $crypto.button_color == 'light'}selected{/if}" title="light"><img src="{$CRYPTO_PATH}template/refresh_light.png" alt="light"></a>
     179        <input type="hidden" name="button_color" value="{$crypto.button_color}">
     180      </div>
    165181    </li>
    166182    <li>
     
    219235        </div>
    220236      </li>
    221      
    222       <li>
    223         <span class="property">{'Preview'|@translate}</span>
    224         <label><img id="captcha" src="{$CRYPTO_PATH}securimage/securimage_show.php" alt="CAPTCHA Image"></label>
    225       </li>
    226237    </ul>
    227238   
     
    229240  </fieldset>
    230241 
     242  <ul style="margin-top:30px;">
     243    <li>
     244      <span class="property">{'Preview'|@translate}</span>
     245      <img id="captcha" src="{$CRYPTO_PATH}securimage/securimage_show.php" alt="CAPTCHA Image">
     246      <a href="#" onClick="return false;"><img id="reload" src="{$CRYPTO_PATH}template/refresh_{$crypto.button_color}.png"></a>
     247    </li>
     248  </ul>
     249 
    231250</fieldset>
    232251<p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit"></p>
Note: See TracChangeset for help on using the changeset viewer.