plugins/SpecialLog.php
changeset 981 888502d761b4
parent 980 d13fad911955
child 1081 745200a9cc2a
equal deleted inserted replaced
980:d13fad911955 981:888502d761b4
    60       $type = $_POST['type'];
    60       $type = $_POST['type'];
    61       if ( $type == 'within' )
    61       if ( $type == 'within' )
    62         $value = strval(intval($_POST['value']['within'])) . $_POST['value']['withinunits'];
    62         $value = strval(intval($_POST['value']['within'])) . $_POST['value']['withinunits'];
    63       else
    63       else
    64         $value = $_POST['value'][$type];
    64         $value = $_POST['value'][$type];
    65         
    65       
    66       $value = str_replace('/', '.2f', sanitize_page_id($value));
    66       if ( !ctype_digit($value) )
    67         
    67         $value = str_replace('/', '.2f', sanitize_page_id($value));
    68       if ( empty($value) || ( $type == 'within' && intval($value) == 0 ) )
    68       
       
    69       if ( $value !== '0' && (empty($value) || ( $type == 'within' && intval($value) == 0 )) )
    69       {
    70       {
    70         $adderror = $lang->get('log_err_addfilter_field_empty');
    71         $adderror = $lang->get('log_err_addfilter_field_empty');
    71       }
    72       }
    72       
    73       else
    73       $append = ( !empty($_POST['existing_filters']) ) ? "{$_POST['existing_filters']}/" : '';
    74       {
    74       $url = makeUrlNS('Special', "Log/{$append}{$type}={$value}");
    75         $append = ( !empty($_POST['existing_filters']) ) ? "{$_POST['existing_filters']}/" : '';
    75       
    76         $url = makeUrlNS('Special', "Log/{$append}{$type}={$value}");
    76       redirect($url, '', '', 0);
    77         
       
    78         redirect($url, '', '', 0);
       
    79       }
    77     }
    80     }
    78     $params = explode('/', $params);
    81     $params = explode('/', $params);
    79     foreach ( $params as $i => $param )
    82     foreach ( $params as $i => $param )
    80     {
    83     {
    81       $param = str_replace('.2f', '/', dirtify_page_id($param));
    84       $param = str_replace('.2f', '/', dirtify_page_id($param));
   208           <select name="type" id="log_addfilter_select">
   211           <select name="type" id="log_addfilter_select">
   209             <option value="user"><?php echo $lang->get('log_form_filtertype_user'); ?></option>
   212             <option value="user"><?php echo $lang->get('log_form_filtertype_user'); ?></option>
   210             <option value="page"><?php echo $lang->get('log_form_filtertype_page'); ?></option>
   213             <option value="page"><?php echo $lang->get('log_form_filtertype_page'); ?></option>
   211             <option value="within"><?php echo $lang->get('log_form_filtertype_within'); ?></option>
   214             <option value="within"><?php echo $lang->get('log_form_filtertype_within'); ?></option>
   212             <option value="action"><?php echo $lang->get('log_form_filtertype_action'); ?></option>
   215             <option value="action"><?php echo $lang->get('log_form_filtertype_action'); ?></option>
       
   216             <option value="minor"><?php echo $lang->get('log_form_filtertype_minor'); ?></option>
   213           </select>
   217           </select>
   214         </td>
   218         </td>
   215         <td class="row1" style="width: 50%; text-align: left;">
   219         <td class="row1" style="width: 50%; text-align: left;">
   216           <div class="log_addfilter" id="log_addform_user">
   220           <div class="log_addfilter" id="log_addform_user">
   217             <input type="text" class="autofill username" name="value[user]" size="40" />
   221             <input type="text" class="autofill username" name="value[user]" size="40" />
   237               <option value="edit"><?php echo $lang->get('log_action_edit'); ?></option>
   241               <option value="edit"><?php echo $lang->get('log_action_edit'); ?></option>
   238               <option value="edit"><?php echo $lang->get('log_formaction_reupload'); ?></option>
   242               <option value="edit"><?php echo $lang->get('log_formaction_reupload'); ?></option>
   239               <option value="edit"><?php echo $lang->get('log_formaction_votereset'); ?></option>
   243               <option value="edit"><?php echo $lang->get('log_formaction_votereset'); ?></option>
   240             </select>
   244             </select>
   241           </div>
   245           </div>
       
   246           <div class="log_addfilter" id="log_addform_minor">
       
   247             <label>
       
   248               <input type="radio" name="value[minor]" value="1" checked="checked" />
       
   249               <?php echo $lang->get('log_form_filtertype_minor_yes'); ?>
       
   250             </label>
       
   251             <label>
       
   252               <input type="radio" name="value[minor]" value="0" />
       
   253               <?php echo $lang->get('log_form_filtertype_minor_no'); ?>
       
   254             </label>
       
   255           </div>
   242         </td>
   256         </td>
   243       </tr>
   257       </tr>
   244       <tr>
   258       <tr>
   245         <th colspan="2" class="subhead">
   259         <th colspan="2" class="subhead">
   246           <input type="submit" value="<?php echo $lang->get('log_btn_add_filter'); ?>" />
   260           <input type="submit" value="<?php echo $lang->get('log_btn_add_filter'); ?>" />
   319         $crumb = $lang->get('log_breadcrumb_page', array('page' => '<a' . $exist . ' href="' . makeUrl($value, false, true) . '">' . htmlspecialchars($ns->title) . '</a>'));
   333         $crumb = $lang->get('log_breadcrumb_page', array('page' => '<a' . $exist . ' href="' . makeUrl($value, false, true) . '">' . htmlspecialchars($ns->title) . '</a>'));
   320         break;
   334         break;
   321       case 'action':
   335       case 'action':
   322         $action = ( $lang->get("log_formaction_{$value}") === "log_formaction_{$value}" ) ? $lang->get("log_action_{$value}") : $lang->get("log_formaction_{$value}");
   336         $action = ( $lang->get("log_formaction_{$value}") === "log_formaction_{$value}" ) ? $lang->get("log_action_{$value}") : $lang->get("log_formaction_{$value}");
   323         $crumb = $lang->get('log_breadcrumb_action', array('action' => htmlspecialchars($action)));
   337         $crumb = $lang->get('log_breadcrumb_action', array('action' => htmlspecialchars($action)));
       
   338         break;
       
   339       case 'minor':
       
   340         $crumb = $value == '1' ? $lang->get('log_form_filtertype_minor_yes') : $lang->get('log_form_filtertype_minor_no');
   324         break;
   341         break;
   325       case 'within':
   342       case 'within':
   326         $value = intval($value);
   343         $value = intval($value);
   327         if ( $value % 31536000 == 0 )
   344         if ( $value % 31536000 == 0 )
   328         {
   345         {