Plugin Directory

Changeset 3038770


Ignore:
Timestamp:
02/20/2024 08:42:03 PM (2 years ago)
Author:
hippooo
Message:

1.0.1 Fix CSRF token

Location:
hippoo-ticket/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • hippoo-ticket/trunk/app/web_api_auth.php

    r3007682 r3038770  
    11<?php
    2 class HippooTicketControllerWithAuth extends WC_REST_Customers_Controller
    3 {
     2
     3class HippooTicketControllerWithAuth extends WC_REST_Customers_Controller {
    44
    55    public function register_routes()
     
    258258        return new WP_REST_Response($cnt, 200);
    259259    }
    260 }
     260    }
  • hippoo-ticket/trunk/hippoo-ticket.php

    r3007682 r3038770  
    22/**
    33 * Plugin Name: Hippoo Ticket
    4  * Version: 1.0.0
     4 * Version: 1.0.1
    55 * Plugin URI: https://Hippoo.app/
    66 * Description: A Free WooCommerce Plugin for Seamless Customer Support and support ticket.
     
    1515 * any later version.
    1616 *
    17  * Hippoo! is distributed in the hope that it will be useful,
    18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20  * GNU General Public License for more details.
    21  *
    22  * You should have received a copy of the GNU General Public License
    23  * along with Hippoo!.
    24  **/
     17* Hippoo! is distributed in the hope that it will be useful,
     18* but WITHOUT ANY WARRANTY; without even the implied warranty of
     19* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     20* GNU General Public License for more details.
     21*
     22* You should have received a copy of the GNU General Public License
     23* along with Hippoo!.
     24**/
     25
     26
    2527if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly     
     28
     29define('hippoo_ticket_path',dirname(__file__).DIRECTORY_SEPARATOR);
     30define('hippoo_ticket_url',plugins_url('hippoo-ticket').'/assets/');
     31global $hippoo_ticket_api_page;
     32$hippoo_ticket_api_page = 10;
     33
     34require_once(ABSPATH."wp-admin/includes/image.php");
     35
     36include_once(hippoo_ticket_path.'app'.DIRECTORY_SEPARATOR.'utils.php');
     37include_once(hippoo_ticket_path.'app'.DIRECTORY_SEPARATOR.'hooks.php');
     38include_once(hippoo_ticket_path.'app'.DIRECTORY_SEPARATOR.'web_api.php');
     39include_once(hippoo_ticket_path.'shortcode'.DIRECTORY_SEPARATOR.'ticket.php');
     40include_once(hippoo_ticket_path.'metabox'.DIRECTORY_SEPARATOR.'ticket_box.php');
     41
     42register_activation_hook(__file__,'hippoo_ticket_register_hook');
     43
     44function hippoo_ticket_register_hook(){
    2645   
    27     define('hippoo_ticket_path',dirname(__file__).DIRECTORY_SEPARATOR);
    28     define('hippoo_ticket_url',plugins_url('hippoo-ticket').'/assets/');
    29     global $hippoo_ticket_api_page;
    30     $hippoo_ticket_api_page = 10;
     46    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     47   
     48    global $wpdb;
     49    $hippoo_ticket_table_name = $wpdb->prefix . 'hippoo_ticket';
     50    $sql = "CREATE TABLE IF NOT EXISTS {$hippoo_ticket_table_name} (
     51        id int(11) NOT NULL AUTO_INCREMENT,
     52        pid int(11) NOT NULL,
     53        uid int(11) NOT NULL,
     54        type varchar(7) NOT NULL,
     55        date datetime DEFAULT NULL,
     56        content text NOT NULL,
     57        media_ids text NOT NULL,
     58        see int(1) DEFAULT NULL,
     59        PRIMARY KEY (id)
     60        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
     61    $wpdb->query($sql);
    3162
    32     require_once(ABSPATH."wp-admin/includes/image.php");
    33    
    34     include_once(hippoo_ticket_path.'app'.DIRECTORY_SEPARATOR.'utils.php');
    35     include_once(hippoo_ticket_path.'app'.DIRECTORY_SEPARATOR.'hooks.php');
    36     include_once(hippoo_ticket_path.'app'.DIRECTORY_SEPARATOR.'web_api.php');
    37     include_once(hippoo_ticket_path.'shortcode'.DIRECTORY_SEPARATOR.'ticket.php');
    38     include_once(hippoo_ticket_path.'metabox'.DIRECTORY_SEPARATOR.'ticket_box.php');
     63    $pg_ticket = $wpdb->get_var(
     64        $wpdb->prepare(
     65            "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_content LIKE %s",
     66            'page',
     67            '%[hippoo_ticket]%'
     68        )
     69    );
     70    if(empty($pg_ticket)){
     71        $args = [
     72        'post_title'  => 'Hippoo Ticket',
     73        'post_type'   => 'page',
     74        'post_content'=> '[hippoo_ticket]',
     75        'post_status' =>'publish',
     76        'post_author' => get_current_user_id(),];
     77        $pg_ticket = wp_insert_post($args);
     78    }
     79    $args = [
     80    'sms'      => 'A message is sent to you.',
     81    'email'    => '<p>Dear User %user%</p>
     82    <p>A message is sent to you.</p>
     83    <p><a url="%url%">%ticket%</a></p>',
     84    'pg_ticket'=> $pg_ticket,
     85    ];
     86    update_option('hippoo_ticket',$args);
     87}
    3988
    40     register_activation_hook(__file__,'hippoo_ticket_register_hook');
     89function hippoo_ticket_admin_menu(){
    4190
    42     function hippoo_ticket_register_hook(){
    43        
    44         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    45        
    46         global $wpdb;
    47         $hippoo_ticket_table_name = $wpdb->prefix . 'hippoo_ticket';
    48         $sql = "CREATE TABLE IF NOT EXISTS {$hippoo_ticket_table_name} (
    49             id int(11) NOT NULL AUTO_INCREMENT,
    50             pid int(11) NOT NULL,
    51             uid int(11) NOT NULL,
    52             type varchar(7) NOT NULL,
    53             date datetime DEFAULT NULL,
    54             content text NOT NULL,
    55             media_ids text NOT NULL,
    56             see int(1) DEFAULT NULL,
    57             PRIMARY KEY (id)
    58             ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
    59         $wpdb->query($sql);
     91    // add_submenu_page('edit.php?post_type=hippoo_ticket','Settings','Settings','administrator','hippoo_ticket_con_ticket','hippoo_ticket_con_ticket');
     92    add_menu_page(
     93        __( 'Hippoo Ticket', 'hippoo-ticket' ),
     94        __( 'Hippoo Ticket', 'hippoo-ticket' ),
     95        'manage_options',
     96        'hippoo_ticket_con_ticket',
     97        'hippoo_ticket_con_ticket',
     98        ( HIPPOO_POPUP_URL . '/images/icon.svg' )
     99    );
    60100
    61         $pg_ticket = $wpdb->get_var(
    62             $wpdb->prepare(
    63                 "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_content LIKE %s",
    64                 'page',
    65                 '%[hippoo_ticket]%'
    66             )
    67         );
    68         if(empty($pg_ticket)){
    69             $args = [
    70             'post_title'  => 'Hippoo Ticket',
    71             'post_type'   => 'page',
    72             'post_content'=> '[hippoo_ticket]',
    73             'post_status' =>'publish',
    74             'post_author' => get_current_user_id(),];
    75             $pg_ticket = wp_insert_post($args);
    76         }
    77         $args = [
    78         'sms'      => 'A message is sent to you.',
    79         'email'    => '<p>Dear User %user%</p>
    80         <p>A message is sent to you.</p>
    81         <p><a url="%url%">%ticket%</a></p>',
    82         'pg_ticket'=> $pg_ticket,
    83         ];
    84         update_option('hippoo_ticket',$args);
    85     }
    86 
    87     function hippoo_ticket_admin_menu(){
    88 
    89         global $menu,$wpdb;
    90         add_submenu_page('edit.php?post_type=hippoo_ticket','Settings','Settings','administrator','hippoo_ticket_con_ticket','hippoo_ticket_con_ticket');
    91 
    92         $count = $wpdb->get_var(
    93             $wpdb->prepare(
    94                 "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_type = %s AND post_status = %s",
    95                 'hippoo_ticket',
    96                 'hippoo_waiting'
    97             )
    98         );
    99         if(!empty($count)){
    100             foreach($menu as $i=>$men){
    101                 if($men[2] == 'edit.php?post_type=hippoo_ticket'){
    102                     $menu[$i][0] .= " <span class='update-plugins count-$count'><span class='plugin-count'>$count</span></span>";
    103                 }
     101    global $menu,$wpdb;
     102    $count = $wpdb->get_var(
     103        $wpdb->prepare(
     104            "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_type = %s AND post_status = %s",
     105            'hippoo_ticket',
     106            'hippoo_waiting'
     107        )
     108    );
     109    if(!empty($count)){
     110        foreach($menu as $i=>$men){
     111            if($men[2] == 'edit.php?post_type=hippoo_ticket'){
     112                $menu[$i][0] .= " <span class='update-plugins count-$count'><span class='plugin-count'>$count</span></span>";
    104113            }
    105114        }
    106115    }
    107     add_action('admin_menu','hippoo_ticket_admin_menu');
    108    
    109    
     116}
     117add_action('admin_menu','hippoo_ticket_admin_menu');
    110118
    111     function hippoo_ticket_con_ticket(){
    112         include_once(hippoo_ticket_path.'app'.DIRECTORY_SEPARATOR.'config.php');
    113     }
     119function hippoo_ticket_con_ticket(){
     120    include_once(hippoo_ticket_path.'app'.DIRECTORY_SEPARATOR.'config.php');
     121}
    114122
    115123
    116     function hippoo_ticket_textdomain() {
    117         load_theme_textdomain( 'hippoo', get_template_directory() . '/languages' );
     124function hippoo_ticket_textdomain() {
     125    load_theme_textdomain( 'hippoo', get_template_directory() . '/languages' );
     126}
     127add_action( 'after_setup_theme', 'hippoo_ticket_textdomain' );
     128
     129function hippoo_ticket_page_style( $hook ) {
     130    if ( in_array( $hook, array( 'hippoo_ticket_page_hippoo_ticket_con_ticket' ) ) ) {
     131        wp_enqueue_style( 'hippoo_ticket_page_style',
     132            hippoo_ticket_url . "css/style.css", null, 1.0);
    118133    }
    119     add_action( 'after_setup_theme', 'hippoo_ticket_textdomain' );
     134}
    120135
    121     function hippoo_ticket_page_style( $hook ) {
    122         if ( in_array( $hook, array( 'hippoo_ticket_page_hippoo_ticket_con_ticket' ) ) ) {
    123             wp_enqueue_style( 'hippoo_ticket_page_style',
    124                 hippoo_ticket_url . "css/style.css", null, 1.0);
    125         }
    126     }
    127 
    128     add_action( 'admin_enqueue_scripts', 'hippoo_ticket_page_style' );
     136add_action( 'admin_enqueue_scripts', 'hippoo_ticket_page_style' );
    129137
    130138/**
  • hippoo-ticket/trunk/metabox/ticket_box_html_template.php

    r3007682 r3038770  
    2929            <tr>
    3030                <td colspan="1">
    31                     <p>No results found.</p>
     31                    <p>No History Found.</p>
    3232                </td>
    3333            </tr>
  • hippoo-ticket/trunk/readme.txt

    r3007682 r3038770  
    55Requires at least: 5.3
    66Tested up to: 6.4
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • hippoo-ticket/trunk/shortcode/ticket.php

    r3007682 r3038770  
    1818        exit();
    1919    }
     20
    2021   
    2122    ob_start();
     
    4243   
    4344
    44     if (isset($_POST['save']) && isset($_POST['csfr_token'])) {
    45         if (wp_verify_nonce($_POST['csfr_token'], 'csfr_token_save')) {
     45    if (isset($_POST['save']) && isset($_POST['csrf_token'])) {
     46        if (wp_verify_nonce($_POST['csrf_token'], 'csrf_token_save')) {
    4647
    4748            // Check if file upload was successful
  • hippoo-ticket/trunk/shortcode/ticket_html_template.php

    r3007682 r3038770  
    4343            <tr>
    4444                <td>
    45                     <p>No results found.</p>
     45                    <p>No History Found.</p>
    4646                </td>
    4747            </tr>
Note: See TracChangeset for help on using the changeset viewer.