get_current_parameters(array('del','search','page_num','add','edit')); //- Add Update Code ------------------------------------ if($request->post('add')!='' || $request->post('edit','int')>0) { $redirect_from= $request->make_relative_url($request->post('redirect_from')) ; $redirect_to=$request->make_relative_url($request->post('redirect_to')); $redirect_type=$request->post('redirect_type'); $redirect_from_type=$request->post('redirect_from_type'); $enabled=$request->post('enabled'); if(($request->post('edit','int')>0 && $wpdb->get_var("select ID from " . SR_database::WP_SEO_Redirection() . " where redirect_from='$redirect_from' and cat='404rule' and blog='" . get_current_blog_id() . "'")==$request->post('edit','int') ) || ($redirect_from=='' && $wpdb->get_var("select redirect_from_type from " . SR_database::WP_SEO_Redirection() . " where redirect_from_type='$redirect_from_type' and cat='404rule'")!=$redirect_from_type ) || ( $redirect_from!='' && $wpdb->get_var("select redirect_from from " . SR_database::WP_SEO_Redirection() . " where redirect_from='$redirect_from' and cat='404rule'")!=$redirect_from) ) { if($redirect_from_type == 'CMS'){ $redirect_from = "/"; } else if($redirect_from_type == 'CSE') { $redirect_from = 'SearchBot'; } $regex=""; if($redirect_from_type =='CSS' || $redirect_from_type =='CMS' || $redirect_from_type =='CSF' ) { $regex= '^' . $misc->regex_prepare($redirect_from) . '.*$'; } elseif($redirect_from_type =='Folder') { $regex= '^' . $misc->regex_prepare($redirect_from) . '.*$'; } elseif($redirect_from_type =='Regex') { $regex= $redirect_from; } else if($redirect_from_type =='Contain') { $regex= '^.*' . $misc->regex_prepare($redirect_from) . '.*$'; } else if($redirect_from_type =='StartWith') { $regex= '^' . $misc->regex_prepare($redirect_from) . '.*$'; } else if($redirect_from_type =='EndWith') { $regex= '^.*' . $misc->regex_prepare($redirect_from) . '$'; } else if($redirect_from_type =='Filetype') { $regex= '^.*' . $misc->regex_prepare( '.' . $redirect_from) . '$'; } if($request->post('edit')!='') { $ID = $request->post('edit','int'); $wpdb->query($wpdb->prepare(" update " . SR_database::WP_SEO_Redirection() . " set redirect_from=%s,redirect_to=%s,redirect_type=%s,redirect_from_type=%s , regex=%s,enabled=%s where blog=%s and ID=%d", $redirect_from, $redirect_to, $redirect_type, $redirect_from_type, $regex, $enabled, get_current_blog_id(), $ID)); SR_redirect_manager::clear_fixed_404($redirect_from, $regex); $app->echo_message("The 404 rule is updated successfully!",'success') ; $SR_redirect_cache->free_cache(); }else { $cat='404rule'; $wpdb->query($wpdb->prepare(" insert into " . SR_database::WP_SEO_Redirection() . "(redirect_from,redirect_to,redirect_type,cat,redirect_to_type,redirect_from_type,regex,enabled,blog) values(%s,%s,%s,'404rule','Page',%s,%s,%s,%d) ", $redirect_from, $redirect_to, $redirect_type, $redirect_from_type, $regex, $enabled, get_current_blog_id())); SR_redirect_manager::clear_fixed_404($redirect_from, $regex); $app->echo_message("New redirect is added successfully!",'success') ; $SR_redirect_cache->free_cache(); } }else { $app->echo_message("This 404 rule is already exists!",'danger') ; } } //- Delete Code ------------------------------------ if($request->post('sel_items')!='') { $IDs=$request->post('sel_items'); $wpdb->query($wpdb->prepare("delete from " . SR_database::WP_SEO_Redirection() . " where blog=%s and ID in (%s)", get_current_blog_id(), $IDs)); $count = count(explode(',',$IDs)); if($count>1) { $app->echo_message("$count Rules are deleted successfully!",'success') ; }else { $app->echo_message("$count Rule is deleted successfully!",'success') ; } } //- Add Delete Forms ------------------------------------ if($request->get('add')!='' || $request->get('edit')!='' ) { require "option_404_rules_add_edit.php"; }else { ?>
get('search') != '') { $search = urldecode($request->get('search')); $where = $where . " and (redirect_from like '%%$search%%' or redirect_to like '%%$search%%' or redirect_type like '%%$search%%' )"; } $where = $where . " order by ID desc"; $pagination = new clogica_pagination(SR_database::WP_SEO_Redirection(), $where); $pagination->set_rows(10); $limit = $pagination->get_sql_limit(); $redirects = $wpdb->get_results("select * from " . SR_database::WP_SEO_Redirection() . " $where $limit "); $i = 0; foreach ($redirects as $redirect) { $i++; ?>
set_group("sel_items"); $check->set_primary_style(); $check->create_check_all_option(); ?> Edit Rule Redirect to Type
create_grouped_option($redirect->ID)?> redirect_from_type == 'Page' || $redirect->redirect_from_type == 'Folder') { ?> redirect_from; ?> redirect_to_type == 'Page' || $redirect->redirect_to_type == 'Folder') { ?> redirect_to; ?> redirect_type; ?>
No data available!
run();?>
set_small_select_pickers(); $SR_jforms->hide_alerts(); $SR_jforms->run();