HEX
Server: Apache/2.4.25
System: Linux ion14 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64
User: (10087)
PHP: 7.4.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,system, exec, shell_exec, passthru, popen, proc_open
Upload Files
File: /home/www/web115/wordpress/wp-content/plugins/digimember/system/model/data/apilog.php
<?php

class ncore_ApilogData extends ncore_BaseData
{
    const log_keep_days = 7;

    public function log( $type )
    {
        $post = $_POST;

        $get = $_GET;

        $input = file_get_contents( 'php://input' );

        $this->api->load->helper( 'url' );
        $url = ncore_currentUrl();

        $logdata = array(
            'post'  => $post,
            'get'   => $get,
            'input' => $input,
            'url'   => $url,
        );

        $data = array(
            'type' => $type,
            'data_serialized'   => serialize( $logdata ),
        );

        $this->create( $data );
    }

    public function replay( $type, $api_log_id='last' )
    {
        $ipn_id = ncore_retrieve( $_GET, 'dm_ipn' );
        $ipn_pw = ncore_retrieve( $_GET, 'dm_pw' );

        $where = array(
            'type' => $type,
        );

        if ($api_log_id!=='last')
        {
            $where['id'] = $api_log_id;
        }

        $row = $this->getWhere( $where, 'id DESC' );
        if ($row)
        {
            // ok
        }
        elseif ($api_log_id==='last')
        {
            return;
        }
        else
        {
            trigger_error( "Invalid api_log_id for type '$type'." );
            return;
        }

        $logdata = unserialize( $row->data_serialized );

        $_POST = $logdata['post'];
        $_GET =  $logdata['get'];

        $_GET['dm_ipn'] = $ipn_id;
        $_GET['dm_pw']  = $ipn_pw;

        global $digimember_debug_input;
        $digimember_debug_input = $logdata['input'];
    }

    public function cronDaily()
    {
        $days = self::log_keep_days;

        $db = $this->db();

        $table = $this->sqlTableName();

        $now = ncore_dbDate();

        $query = $db->query("DELETE FROM `$table`
                             WHERE created < '$now' - INTERVAL $days DAY");
    }

    //
    // protected section
    //
    protected function sqlBaseTableName()
    {
        return 'apilog';
    }

    protected function sqlTableMeta()
    {
       $columns = array(
            'type' => 'string[15]',
            'data_serialized' => 'text',
       );

       $indexes = array();

       $meta = array(
        'columns' => $columns,
        'indexes' => $indexes,
       );

       return $meta;
    }

    protected function isUniqueInBlog() {

        return true;
    }

    //
    // private section
    //

}