Exemplo n.º 1
0
function html_end($log = true)
{
    echo "</body></html>";
    if ($log) {
        log_me();
    }
}
function webpayplus_install()
{
    global $wpdb;
    global $webpay_db_version;
    global $webpay_table_name;
    //Cambio legacy con la versión anterior para los que tienen versiones de PHP más antiguas.
    global $webpay_comun_folder;
    //ebpay_comun_folder = wp_upload_dir()['basedir'].DIRECTORY_SEPARATOR."webpay-data".DIRECTORY_SEPARATOR."comun";
    $sql = "CREATE TABLE {$webpay_table_name} (\n  id mediumint(9) NOT NULL AUTO_INCREMENT,\n  idOrder INT NOT NULL,\n  TBK_ORDEN_COMPRA INT NOT NULL,\n  TBK_TIPO_TRANSACCION text NOT NULL,\n  TBK_RESPUESTA  INT(2) NOT NULL,\n  TBK_MONTO INT NOT NULL,\n  TBK_CODIGO_AUTORIZACION INT NOT NULL,\n  TBK_FINAL_NUMERO_TARJETA INT(4) NOT NULL,\n  TBK_FECHA_CONTABLE INT(8) NOT NULL,\n  TBK_FECHA_TRANSACCION INT(8) NOT NULL,\n  TBK_HORA_TRANSACCION INT(6) NOT NULL,\n  TBK_ID_TRANSACCION INT(20) NOT NULL,\n  TBK_TIPO_PAGO VARCHAR(10) NOT NULL,\n  TBK_NUMERO_CUOTAS INT(2) NOT NULL,\n  UNIQUE KEY id (id)\n    );";
    log_me($sql);
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql);
    log_me("Revision de la carpeta común. -> " . $webpay_comun_folder);
    add_option("webpay_db_version", $webpay_db_version);
    //Crear la carpeta en donde se guardarán los logs.
    if (!file_exists($webpay_comun_folder)) {
        log_me("Carpeta comun no existe, se inicia la creación.");
        mkdir($webpay_comun_folder, 0760, true);
        chmod($webpay_comun_folder, 0760);
        touch($webpay_comun_folder . DIRECTORY_SEPARATOR . "index.php");
    } else {
        log_me("Carpeta común existe. Se revisarán los permisos.");
        chmod($webpay_comun_folder, 0760);
    }
}
Exemplo n.º 3
0
 private static function blah($i)
 {
     $t = 0;
     foreach (array(&self::$boo) as $k => &$v) {
         $v = 0;
     }
     self::$boo = $t;
     log_me('next');
 }
 static function post_to_clecs($ID, $post)
 {
     log_me('ClecsPoster::post_to_clecs()');
     $access_token = self::retrieve_access_token();
     $fields = array('PostText' => 'Diweddariad blog: ' . $post->post_title . ' ' . get_permalink($ID));
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, 'https://www.clecs.cymru/api/Posting/PostAPost');
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', "Authorization: Bearer {$access_token}"));
     curl_exec($ch);
     curl_close($ch);
 }
Exemplo n.º 5
0
/**
 * Refresh families from meteor function
 */
function autoupdater_refresh_theme()
{
    // refresh WordPress information of new theme versions
    get_transient('update_themes');
    global $wp_version, $theme_version, $theme_to_update, $api_url;
    log_me('checking the update and stuff...');
    if (function_exists('wp_get_theme')) {
        $theme_data = wp_get_theme($theme_to_update);
        $theme_version = $theme_data->Version;
    } else {
        $theme_data = get_theme_data(ABSPATH . '/wp-content/themes/' . $theme_to_update . '/style.css');
        $theme_version = $theme_data['Version'];
    }
    $request = array('slug' => $theme_to_update, 'version' => $theme_version);
    // Start checking for an update
    $send_for_check = array('body' => array('action' => 'theme_update', 'request' => serialize($request), 'api-key' => md5(get_bloginfo('url'))), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
    $raw_response = wp_remote_post($api_url, $send_for_check);
    if (!is_wp_error($raw_response) && $raw_response['response']['code'] == 200) {
        $response = unserialize($raw_response['body']);
    }
    // check if the new version is higher
    // if (version_compare($theme_version, $response['new_version']))
    if (version_compare($theme_version, $response['new_version'], '<')) {
        require ABSPATH . 'wp-admin/includes/screen.php';
        require ABSPATH . 'wp-admin/includes/plugin.php';
        require ABSPATH . 'wp-admin/includes/template.php';
        require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
        require ABSPATH . 'wp-admin/includes/file.php';
        require ABSPATH . 'wp-admin/includes/misc.php';
        $theme = $theme_to_update;
        $title = __('Update Theme');
        $parent_file = 'themes.php';
        $submenu_file = 'themes.php';
        // require_once(ABSPATH . 'wp-admin/admin-header.php');
        $nonce = 'upgrade-theme_' . $theme_to_update;
        $url = 'update.php?action=upgrade-theme&theme=' . urlencode($theme_to_update);
        $upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
        $upgrader->upgrade($theme_to_update);
    }
}
Exemplo n.º 6
0
<?php

require_once "utils.php";
//---------------------------------------------------------------------------
//
// Log
//
//---------------------------------------------------------------------------
//log before delete login
log_me();
//---------------------------------------------------------------------------
//
// TimeStamp
//
//---------------------------------------------------------------------------
// Write timestamp into user file to force update for signin
if (isset($_SESSION["ok"])) {
    $cookie = $_SESSION["ok"];
} elseif (isset($_COOKIE["ok"])) {
    $cookie = $_COOKIE["ok"];
}
if (isset($cookie)) {
    createFile("../", $cookie);
}
//---------------------------------------------------------------------------
//
// Delete session and cookies
//
//---------------------------------------------------------------------------
// Delete session variables
foreach ($_SESSION as $k => $v) {
Exemplo n.º 7
0
                    $_request[str_replace(':', '', $_controller['route_url'][$i])] = $_controller['current_url'][$i];
                    log_me("The following wildcard was found -- " . $_controller['route_url'][$i]);
                }
            } else {
                # If the current url iteration doesn't match the route url iteration
                //echo($_controller['current_url'][$i] .'--'. $_controller['route_url'][$i].'<br/>');
                if ($_controller['current_url'][$i] != $_controller['route_url'][$i]) {
                    # Set the flag
                    $_url_match = 0;
                } else {
                    $_url_match = 1;
                }
            }
        }
    }
    log_me('$_url_match is -- ' . $_url_match);
    if ($_url_match) {
        break;
    }
}
# If we have a route match, let's continue to render that route
if ($_url_match) {
    # Load up any installed plugin functions.
    $_list = get_autoload_list();
    foreach ($_list as $_autoloaded_plugin_info) {
        if ($_autoloaded_plugin_info['config']) {
            require $_autoloaded_plugin_info['config'];
        }
        if ($_autoloaded_plugin_info['functions']) {
            require $_autoloaded_plugin_info['functions'];
        }
 public static function webpay_get_option($option_name)
 {
     $options = get_option("woocommerce_webpayplus_settings");
     log_me($options);
     return $options["{$option_name}"];
 }
Exemplo n.º 9
0
require_once 'include/init.php';
session_start();
\Payplug\Payplug::setSecretKey($secretkey);
$input = file_get_contents('php://input');
function log_me($message, $mode)
{
    $fp = fopen('phpayplug/logs/notifications_' . $mode . '.txt', 'a+');
    fwrite($fp, $message . "\r\n");
    fclose($fp);
}
log_me("-------------------------------------------------------", $mode);
if ($debug_mode == true) {
    ob_start();
    var_dump($input);
    $output = ob_get_clean();
    log_me("[Debug] - [" . date('d/m/Y à H:i:s', time()) . "] Json: " . $output, $mode);
} else {
}
try {
    $resource = \Payplug\Notification::treat($input);
    if ($resource->object == "payment") {
        log_me("[" . $resource->object . "] - [" . date('d/m/Y à H:i:s', time()) . "] " . $mode . " | Payment ID: " . $resource->id . " | Amount: " . $resource->amount / 100 . "€ | Is paid: " . var_export($resource->is_paid, true) . " | " . $resource->customer->first_name . " | " . $resource->customer->last_name . " | " . $resource->customer->email . " | Paid at: " . date('d/m/Y H:i:s', $resource->hosted_payment->paid_at) . " | Error code: " . $resource->failure->code . " | Error message: " . $resource->failure->message . " | Order ID: " . $resource->metadata[order_id] . " | ", $mode);
    } else {
        if ($resource->object == "refund") {
            log_me("[" . $resource->object . "] - [" . date('d/m/Y à H:i:s', time()) . "] " . $mode . " | Payment ID: " . $resource->id . " | Refund ID: " . $resource->payment_id . " | Amount: " . $resource->amount / 100 . "€ | Order ID: " . $resource->metadata[order_id] . " | Reason: " . $resource->metadata[reason] . " | ", $mode);
        }
    }
} catch (\Payplug\Exception\PayplugException $exception) {
    log_me("[Error] - [" . date('d/m/Y à H:i:s', time()) . "] " . $exception, $mode);
}
Exemplo n.º 10
0
<?php

require_once "../utils.php";
header("Content-type:text/plain");
//Log connection
if (log_me()) {
    echo "True";
} else {
    echo "False";
}