Ejemplo n.º 1
0
 function collect($module)
 {
     $pager = new RE_Pager($_GET, $_SERVER['REQUEST_URI'], 'created', 'DESC', 'log');
     $pager->per_page = 100;
     $this->name = $module->name;
     $this->items = RE_Log::get_by_module($pager, $module->id);
 }
Ejemplo n.º 2
0
 function collect($module)
 {
     $pager = new RE_Pager($_GET, admin_url('redirection.php'), 'created', 'DESC', 'log');
     $pager->per_page = 100;
     $this->name = $module->name;
     $this->items = RE_Log::get_by_module($pager, $module->id);
 }
Ejemplo n.º 3
0
 function process_bulk_action()
 {
     if ('delete' === $this->current_action()) {
         foreach ($_POST['item'] as $id) {
             RE_Log::delete(intval($id));
         }
     }
 }
Ejemplo n.º 4
0
 public function ajax_log_delete()
 {
     if (check_ajax_referer('redirection-items')) {
         if (preg_match_all('/=(\\d*)/', $_POST['checked'], $items) > 0) {
             foreach ($items[1] as $item) {
                 RE_Log::delete(intval($item));
             }
         }
     }
 }
Ejemplo n.º 5
0
 function reset()
 {
     Red_Module::clear_cache($this->id);
     $groups = Red_Group::get_for_module($this->id);
     if (count($groups) > 0) {
         foreach ($groups as $group) {
             $group->reset();
         }
     }
     RE_Log::delete_for_module($this->id);
 }
Ejemplo n.º 6
0
 function reset()
 {
     global $wpdb;
     $this->last_count = 0;
     $this->last_access = '0000-00-00 00:00:00';
     $wpdb->update($wpdb->prefix . 'redirection_items', array('last_count' => 0, 'last_access' => $this->last_access), array('group_id' => $this->id));
     RE_Log::delete_for_group($this->id);
 }
Ejemplo n.º 7
0
 function template_redirect()
 {
     global $redirection;
     if (is_404() && !$redirection->hasMatched()) {
         $url = $_SERVER['REQUEST_URI'];
         $redirects = Red_Item::get_for_url($url, '404');
         if (!empty($redirects)) {
             foreach ($redirects as $key => $item) {
                 if ($item->matches($url)) {
                     $redirection->setMatched(true);
                     $this->matched = $item;
                     break;
                 }
             }
         }
         if (empty($this->matched)) {
             $modules = Red_Module::get_by_type('404');
             if (count($modules) > 0) {
                 foreach ($modules as $module) {
                     // Log 404 errors
                     if ($module->log_404) {
                         if (isset($_SERVER['REMOTE_ADDR'])) {
                             $myip = $_SERVER['REMOTE_ADDR'];
                         } else {
                             if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                                 $myip = $_SERVER['HTTP_X_FORWARDED_FOR'];
                             }
                         }
                         $options = $redirection->get_options();
                         if ($options['log_404s']) {
                             $log = RE_Log::create($_SERVER['REQUEST_URI'], '', $_SERVER['HTTP_USER_AGENT'], $myip, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', 'NULL', $module->id);
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 8
0
}
?>
">
	<input type="checkbox" class="check" name="checkall[]" value="<?php 
echo $redirect->id;
?>
"/>
	
	<a href="<?php 
echo $this->url($redirect->url);
?>
" class="redirection-edit"><?php 
if ($redirect->title) {
    echo htmlspecialchars($redirect->title);
} else {
    echo RE_Log::show_url($redirect->url);
}
?>
</a>
	
	<?php 
if ($redirect->match_type != 'url') {
    echo '(' . $redirect->match_name() . ')';
}
?>
	
	<?php 
if ($redirect->status == 'disabled') {
    ?>
		&mdash; <?php 
    _e('disabled', 'redirection');
Ejemplo n.º 9
0
 function collect($module)
 {
     $this->name = $module->name;
     $this->items = RE_Log::get_by_module($module->id);
 }
Ejemplo n.º 10
0
 function admin_screen_log()
 {
     include dirname(__FILE__) . '/models/pager.php';
     if (isset($_POST['deleteall']) && check_admin_referer('redirection-process_logs')) {
         if (isset($_GET['module'])) {
             RE_Log::delete_all(array('module_id' => intval($_GET['module'])), new RE_Pager($_GET, $_SERVER['REQUEST_URI'], 'created', 'DESC', 'log'));
         } else {
             if (isset($_GET['group'])) {
                 RE_Log::delete_all(array('group_id' => intval($_GET['group'])), new RE_Pager($_GET, $_SERVER['REQUEST_URI'], 'created', 'DESC', 'log'));
             } else {
                 RE_Log::delete_all(array(), new RE_Pager($_GET, $_SERVER['REQUEST_URI'], 'created', 'DESC', 'log'));
             }
         }
         $this->render_message(__('Your logs have been deleted', 'redirection'));
     }
     $pager = new RE_Pager($_GET, $_SERVER['REQUEST_URI'], 'created', 'DESC', 'log');
     if (isset($_GET['module'])) {
         $logs = RE_Log::get_by_module($pager, intval($_GET['module']));
     } else {
         if (isset($_GET['group'])) {
             $logs = RE_Log::get_by_group($pager, intval($_GET['group']));
         } else {
             if (isset($_GET['redirect'])) {
                 $logs = RE_Log::get_by_redirect($pager, intval($_GET['redirect']));
             } else {
                 $logs = RE_Log::get($pager);
             }
         }
     }
     $options = $this->get_options();
     $this->render_admin('log', array('logs' => $logs, 'pager' => $pager, 'lookup' => $options['lookup']));
 }
Ejemplo n.º 11
0
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>

<div class="date" id="info_<?php echo $redirect->id ?>" style="width:8em">
	<?php if ($redirect->last_access == 0) : ?>
	&mdash;
	<?php else : ?>
		<?php echo date (str_replace ('F', 'M', get_option ('date_format')), $redirect->last_access) ?>
	<?php endif; ?>
</div>

<div class="count">
	<a href="<?php echo $this->base (); ?>?page=redirection.php&amp;sub=log&amp;redirect=<?php echo $redirect->id ?>"><?php echo $redirect->last_count ?></a>
</div>

<div class="type">
	<?php echo $redirect->type () ?>
</div>

<div class="item<?php if ($redirect->regex)  echo ' item-regex' ?>">
	<input type="checkbox" class="check" name="checkall[]" value="<?php echo $redirect->id ?>"/>
	
	<a href="<?php echo $this->url ($redirect->url) ?>" class="redirection-edit"><?php if ($redirect->title) echo esc_html( $redirect->title ); else echo RE_Log::show_url ($redirect->url); ?></a>
	
	<?php if ($redirect->match_type != 'url') echo '('.esc_html( $redirect->match_name() ).')' ?>
	
	<?php if ($redirect->status == 'disabled') : ?>
		&mdash; <?php _e ('disabled', 'redirection'); ?>
	<?php endif; ?>
</div>
Ejemplo n.º 12
0
 function reset()
 {
     global $wpdb;
     $this->last_count = 0;
     $this->last_access = '0000-00-00 00:00:00';
     $wpdb->query("UPDATE {$wpdb->prefix}redirection_items SET last_count=0, last_access='{$this->last_access}' WHERE group_id='{$this->id}'");
     RE_Log::delete_for_group($this->id);
 }
Ejemplo n.º 13
0
 function admin_screen_log()
 {
     include dirname(__FILE__) . '/models/pager.php';
     if (isset($_POST['deleteall']) && check_admin_referer('redirection-process_logs')) {
         if (isset($_GET['module'])) {
             RE_Log::delete_all('module', intval($_GET['module']));
         } else {
             if (isset($_GET['group'])) {
                 RE_Log::delete_all('group', intval($_GET['group_id']));
             } else {
                 RE_Log::delete_all();
             }
         }
         $this->render_message(__('Your logs have been deleted', 'redirection'));
     }
     $options = $this->get_options();
     $table = new Redirection_Log_Table($options);
     if (isset($_GET['module'])) {
         $table->prepare_items('module', intval($_GET['module']));
     } else {
         if (isset($_GET['group'])) {
             $table->prepare_items('group', intval($_GET['group']));
         } else {
             if (isset($_GET['redirect'])) {
                 $table->prepare_items('redirect', intval($_GET['redirect']));
             } else {
                 $table->prepare_items();
             }
         }
     }
     $this->render_admin('log', array('options' => $options, 'table' => $table, 'lookup' => $options['lookup']));
 }
Ejemplo n.º 14
0
?>
">
	<input type="checkbox" class="check" name="checkall[]" value="<?php 
echo esc_attr($redirect->id);
?>
"/>

	<a href="<?php 
echo esc_attr($this->url($redirect->url));
?>
" class="redirection-edit">
		<?php 
if ($redirect->title) {
    echo esc_html($redirect->title);
} else {
    echo esc_html(RE_Log::show_url($redirect->url));
}
?>
	</a>

	<?php 
if ($redirect->match_type != 'url') {
    echo '(' . esc_html($redirect->match_name()) . ')';
}
?>

	<?php 
if ($redirect->status == 'disabled') {
    ?>
		&mdash; <?php 
    _e('disabled', 'redirection');