当前位置: 首页>>代码示例>>PHP>>正文


PHP fn_log_event函数代码示例

本文整理汇总了PHP中fn_log_event函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_log_event函数的具体用法?PHP fn_log_event怎么用?PHP fn_log_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fn_log_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fn_restore_dump

function fn_restore_dump($files)
{
    if (empty($files)) {
        return false;
    }
    fn_set_progress('parts', sizeof($files));
    foreach ($files as $file) {
        $is_archive = false;
        $list = array($file);
        if (in_array(fn_get_file_ext($file), array('zip', 'tgz'))) {
            $is_archive = true;
            fn_decompress_files(Registry::get('config.dir.database') . $file, Registry::get('config.dir.database') . '_tmp');
            $list = fn_get_dir_contents(Registry::get('config.dir.database') . '_tmp', false, true, 'sql', '_tmp/');
        }
        foreach ($list as $_file) {
            db_import_sql_file(Registry::get('config.dir.database') . $_file);
        }
        if ($is_archive) {
            fn_rm(Registry::get('config.dir.database') . '_tmp');
        }
    }
    // Log database restore
    fn_log_event('database', 'restore');
    fn_set_hook('database_restore', $files);
    fn_clear_cache();
    return true;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:27,代码来源:database.php

示例2: array

    if (defined('AJAX_REQUEST') && empty($auth)) {
        exit;
    }
    if (empty($auth['user_id'])) {
        return array(CONTROLLER_STATUS_REDIRECT, $index_script);
    }
    fn_add_breadcrumb(fn_get_lang_var('my_account'));
    $profile_id = 0;
    $user_data = fn_get_user_info($auth['user_id'], true, $profile_id);
    $view->assign('user_data', $user_data);
    $view->assign('view_mode', 'simple');
} elseif ($mode == 'change_login') {
    $auth = $_SESSION['auth'];
    if (!empty($auth['user_id'])) {
        // Log user logout
        fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false));
    }
    unset($_SESSION['auth'], $_SESSION['cart']['user_data']);
    fn_delete_cookies(AREA_NAME . '_user_id', AREA_NAME . '_password');
    return array(CONTROLLER_STATUS_OK, fn_url('checkout.checkout'));
}
function fn_auth_routines($request)
{
    $status = true;
    $user_login = $_REQUEST['user_login'];
    $password = $_POST['password'];
    $field = Registry::get('settings.General.use_email_as_login') == 'Y' ? 'email' : 'user_login';
    $user_data = db_get_row("SELECT * FROM ?:users WHERE {$field} = ?s", $user_login);
    if (!empty($user_data)) {
        $user_data['usergroups'] = fn_get_user_usergroups($user_data['user_id']);
    }
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:auth.php

示例3: db_export_to_file

/**
 * Exports database to file
 *
 * @param string $file_name path to file will be created
 * @param array $dbdump_tables List of tables to be exported
 * @param bool $dbdump_schema Export database schema
 * @param bool $dbdump_data Export tatabase data
 * @param bool $log Log database export action
 * @param bool $show_progress Show or do not show process by printing ' .'
 * @param bool $move_progress_bar Move COMET progress bar or not on show progress
 * @param array $change_table_prefix Array with 2 keys (from, to) to change table prefix
 * @return bool false, if file is not accessible
 */
function db_export_to_file($file_name, $dbdump_tables, $dbdump_schema, $dbdump_data, $log = true, $show_progress = true, $move_progress_bar = true, $change_table_prefix = array())
{
    $fd = @fopen($file_name, 'w');
    if (!$fd) {
        fn_set_notification('E', __('error'), __('dump_cant_create_file'));
        return false;
    }
    if ($log) {
        // Log database backup
        fn_log_event('database', 'backup');
    }
    // set export format
    Database::query("SET @SQL_MODE = 'MYSQL323'");
    $create_statements = array();
    $insert_statements = array();
    if ($show_progress && $move_progress_bar) {
        fn_set_progress('step_scale', sizeof($dbdump_tables) * ((int) $dbdump_schema + (int) $dbdump_data));
    }
    // get status data
    $t_status = Database::getHash("SHOW TABLE STATUS", 'Name');
    foreach ($dbdump_tables as $k => $table) {
        $_table = !empty($change_table_prefix) ? str_replace($change_table_prefix['from'], $change_table_prefix['to'], $table) : $table;
        if ($dbdump_schema) {
            if ($show_progress) {
                fn_set_progress('echo', '<br />' . __('backupping_schema') . ': <b>' . $table . '</b>', $move_progress_bar);
            }
            fwrite($fd, "\nDROP TABLE IF EXISTS " . $_table . ";\n");
            $scheme = Database::getRow("SHOW CREATE TABLE {$table}");
            $_scheme = array_pop($scheme);
            if ($change_table_prefix) {
                $_scheme = str_replace($change_table_prefix['from'], $change_table_prefix['to'], $_scheme);
            }
            fwrite($fd, $_scheme . ";\n\n");
        }
        if ($dbdump_data) {
            if ($show_progress) {
                fn_set_progress('echo', '<br />' . __('backupping_data') . ': <b>' . $table . '</b>&nbsp;&nbsp;', $move_progress_bar);
            }
            $total_rows = Database::getField("SELECT COUNT(*) FROM {$table}");
            // Define iterator
            if (!empty($t_status[$table]) && $t_status[$table]['Avg_row_length'] < DB_MAX_ROW_SIZE) {
                $it = DB_ROWS_PER_PASS;
            } else {
                $it = 1;
            }
            for ($i = 0; $i < $total_rows; $i = $i + $it) {
                $table_data = Database::getArray("SELECT * FROM {$table} LIMIT {$i}, {$it}");
                foreach ($table_data as $_tdata) {
                    $_tdata = fn_add_slashes($_tdata, true);
                    $values = array();
                    foreach ($_tdata as $v) {
                        $values[] = $v !== null ? "'{$v}'" : 'NULL';
                    }
                    fwrite($fd, "INSERT INTO {$_table} (`" . implode('`, `', array_keys($_tdata)) . "`) VALUES (" . implode(', ', $values) . ");\n");
                }
                if ($show_progress) {
                    fn_echo(' .');
                }
            }
        }
    }
    fclose($fd);
    @chmod($file_name, DEFAULT_FILE_PERMISSIONS);
    return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:78,代码来源:fn.database.php

示例4: fn_twg_api_customer_logout

function fn_twg_api_customer_logout()
{
    // copied from common/auth.php - logout mode
    $auth = $_SESSION['auth'];
    fn_save_cart_content($_SESSION['cart'], $auth['user_id']);
    if (!empty($auth['user_id'])) {
        // Log user logout
        fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false));
    }
    unset($_SESSION['auth']);
    fn_clear_cart($_SESSION['cart'], false, true);
    fn_delete_session_data(fn_get_area_name() . '_user_id', fn_get_area_name() . '_password');
    return true;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:14,代码来源:func.php

示例5: restore

 /**
  * Restores backup file
  *
  * @param  string $filename  File to be restored
  * @param  string $base_path Base folder path (default: dir.backups)
  * @return bool   true if restored, error code if errors
  */
 public static function restore($filename, $base_path = '')
 {
     $file_ext = fn_get_file_ext($filename);
     if (!in_array($file_ext, array('sql', 'tgz', 'zip'))) {
         return __(self::ERROR_UNSUPPORTED_FILE_TYPE);
     }
     if (empty($base_path)) {
         $base_path = Registry::get('config.dir.backups');
     }
     $backup_path = $base_path . basename($filename);
     if (in_array($file_ext, array('zip', 'tgz'))) {
         $type = self::getArchiveType($backup_path);
         $extract_path = fn_get_cache_path(false) . 'tmp/backup/';
         fn_rm($extract_path);
         fn_mkdir($extract_path);
         if ($type == 'database') {
             fn_decompress_files($backup_path, $extract_path);
             $list = fn_get_dir_contents($extract_path, false, true, 'sql');
             foreach ($list as $sql_file) {
                 db_import_sql_file($extract_path . $sql_file);
             }
         } else {
             $root_dir = Registry::get('config.dir.root') . '/';
             $files_list = self::getCompressedFilesList($backup_path);
             // Check permissions on all files
             foreach ($files_list as $file) {
                 if (!self::checkWritable($root_dir . $file)) {
                     return __(self::ERROR_UNWRITABLE_FILE, array('[file]' => $root_dir . $file, '[url]' => fn_url('settings.manage?section_id=Upgrade_center')));
                 }
                 fn_set_progress('echo', __('check_permissions') . ': ' . $file . '<br>', true);
             }
             // All files can be overrided. Restore backupped files
             fn_decompress_files($backup_path, $extract_path);
             $root_dir = Registry::get('config.dir.root') . '/';
             foreach ($files_list as $file) {
                 $ext = fn_get_file_ext($file);
                 if ($ext == 'sql' && strpos($file, 'var/restore/') !== false) {
                     // This is a DB dump. Restore it
                     db_import_sql_file($extract_path . $file);
                     continue;
                 }
                 fn_set_progress('echo', __('restore') . ': ' . $file . '<br>', true);
                 self::restoreFile($extract_path . $file, $root_dir . $file);
             }
             fn_rm($extract_path);
             return true;
         }
     } else {
         db_import_sql_file($backup_path);
     }
     fn_log_event('database', 'restore');
     fn_clear_cache();
     return true;
 }
开发者ID:askzap,项目名称:ultimate,代码行数:61,代码来源:DataKeeper.php

示例6: fn_error

function fn_error($debug_data, $error = '', $is_db = true)
{
    $auth =& $_SESSION['auth'];
    $debug_data = array_reverse($debug_data, true);
    if (file_exists(DIR_ROOT . '/bug_report.php')) {
        $bug_report = true;
    }
    if (!empty($bug_report)) {
        ob_start();
    }
    if (!empty($error) && $is_db == true) {
        // Log database errors
        fn_log_event('database', 'error', array('error' => $error, 'backtrace' => $debug_data));
        echo <<<EOT
<p><b><span style='font-weight: bold; color: #000000; font-size: 13px; font-family: Courier;'>Database error:</span></b>&nbsp;{$error['message']}<br>
<b><span style='font-weight: bold; color: #000000; font-size: 13px; font-family: Courier;'>Invalid query:</span></b>&nbsp;{$error['query']}</p>
EOT;
    } elseif (!empty($error)) {
        echo <<<EOT
<p><b><span style='font-weight: bold; color: #000000; font-size: 13px; font-family: Courier;'>Error:</span></b>&nbsp;{$error}<br>
EOT;
    }
    echo <<<EOU
<hr noshade width='100%'>
<p><span style='font-weight: bold; color: #000000; font-size: 13px; font-family: Courier;'>Backtrace:</span>
<table cellspacing='1'>
EOU;
    $i = 0;
    if (!empty($debug_data)) {
        $func = '';
        foreach (array_reverse($debug_data) as $v) {
            if (empty($v['file'])) {
                $func = $v['function'];
                continue;
            } elseif (!empty($func)) {
                $v['function'] = $func;
                $func = '';
            }
            $i = $i == 0 ? 1 : 0;
            $color = $i == 0 ? "#DDDDDD" : "#EEEEEE";
            echo "<tr bgcolor='{$color}'><td style='text-decoration: underline;'>File:</td><td>{$v['file']}</td></tr>";
            echo "<tr bgcolor='{$color}'><td style='text-decoration: underline;'>Line:</td><td>{$v['line']}</td></tr>";
            echo "<tr bgcolor='{$color}'><td style='text-decoration: underline;'>Function:</td><td>{$v['function']}</td></tr>";
        }
    }
    echo '</table>';
    if (!empty($bug_report)) {
        $debug = ob_get_clean();
        include DIR_ROOT . '/bug_report.php';
    }
    exit;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:52,代码来源:fn.common.php

示例7: fn_log_user_logout

/**
 * Add a record to the log if the user session is expired
 *
 * @param array $entry - session record
 * @return bool Always true
 */
function fn_log_user_logout($entry, $data)
{
    if (!empty($data['auth']) && $data['auth']['user_id']) {
        $this_login = empty($data['auth']['this_login']) ? 0 : $data['auth']['this_login'];
        // Log user logout
        fn_log_event('users', 'session', array('user_id' => $data['auth']['user_id'], 'ip' => empty($data['auth']['ip']) ? '' : $data['auth']['ip'], 'time' => $entry['expiry'] - $this_login, 'timeout' => true, 'expiry' => $entry['expiry']));
    }
    return true;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:15,代码来源:fn.log.php

示例8: fn_user_logout

/**
 * @param array $auth
 */
function fn_user_logout($auth)
{
    // Regenerate session_id for security reasons
    fn_save_cart_content($_SESSION['cart'], $auth['user_id']);
    Session::regenerateId();
    fn_init_user();
    $auth = $_SESSION['auth'];
    if (!empty($auth['user_id'])) {
        // Log user logout
        fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false));
    }
    unset($_SESSION['auth']);
    fn_clear_cart($_SESSION['cart'], false, true);
    fn_delete_session_data(AREA . '_user_id', AREA . '_password');
    unset($_SESSION['product_notifications']);
    fn_login_user();
    // need to fill $_SESSION['auth'] array for anonymous user
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:21,代码来源:fn.users.php

示例9: fn_log_user_logout

/**
 * Add a record to the log if the user session is expired
 *
 * @param array $auth - user auth data
 * @param integer $expiry - expiration time
 * @return bool Always true
 */
function fn_log_user_logout($auth, $expiry = TIME)
{
    if (!empty($auth) && $auth['user_id']) {
        $this_login = empty($auth['this_login']) ? 0 : $auth['this_login'];
        // Log user logout
        fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'ip' => empty($auth['ip']) ? '' : $auth['ip'], 'time' => $expiry - $this_login, 'timeout' => true, 'expiry' => $expiry));
    }
    return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:16,代码来源:fn.users.php

示例10: fn_delete_order

/**
 * Function delete order
 *
 * @param int $order_id
 */
function fn_delete_order($order_id)
{
    // Log order deletion
    fn_log_event('orders', 'delete', array('order_id' => $order_id));
    fn_change_order_status($order_id, STATUS_INCOMPLETED_ORDER, '', fn_get_notification_rules(array(), false));
    // incomplete to increase inventory
    fn_set_hook('delete_order', $order_id);
    db_query("DELETE FROM ?:new_orders WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:order_data WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:order_details WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:orders WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:product_file_ekeys WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:profile_fields_data WHERE object_id = ?i AND object_type='O'", $order_id);
    db_query("DELETE FROM ?:order_docs WHERE order_id = ?i", $order_id);
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:20,代码来源:fn.cart.php

示例11: generate

 public function generate($filepath = '')
 {
     @ignore_user_abort(1);
     @set_time_limit(0);
     register_shutdown_function(array($this, 'shutdownHandler'));
     if (!empty($filepath)) {
         $this->filepath_temp = $filepath;
     }
     fn_mkdir(dirname($this->filepath_temp));
     $continue = false;
     if (file_exists($this->filepath_temp) && $this->offset > 0) {
         $continue = true;
     }
     if ($continue) {
         $this->log->write(Logs::INFO, '', 'Continue ' . date('d.m.Y H:i:s', time()) . '. Offset ' . $this->offset);
     } else {
         $status_generate = fn_get_storage_data('yml2_status_generate_' . $this->price_id);
         if ($status_generate == 'active' && file_exists($this->filepath_temp)) {
             fn_echo(__("yml_export.generation_was_started"));
             exit;
         }
         fn_rm($this->filepath_temp);
         $this->offset = 0;
         $this->log->write(Logs::INFO, '', 'Start ' . date('d.m.Y H:i:s', time()));
         fn_set_storage_data('yml2_export_start_time_' . $this->price_id, time());
     }
     fn_set_storage_data('yml2_status_generate_' . $this->price_id, 'active');
     $file = fopen($this->filepath_temp, 'ab');
     if (!$continue) {
         $this->head($file);
     }
     $this->body($file);
     $this->bottom($file);
     fclose($file);
     $this->log->write(Logs::INFO, '', 'Finish ' . date('d.m.Y H:i:s', time()));
     $this->log->write(Logs::INFO, '', 'Product export ' . $this->yml2_product_export . '. Product skip ' . $this->yml2_product_skip);
     $data = array('[export]' => $this->yml2_product_export, '[skip]' => $this->yml2_product_skip, '[cron]' => defined('CONSOLE') ? 'Cron. ' : '');
     fn_log_event('yml_export', 'export', array('message' => __('text_log_action_export', $data)));
     if ($this->options['detailed_generation'] == 'Y') {
         $path = $this->log->getTempLogFile();
         if ($path) {
             $log = fopen($path, 'r');
             $line = fgets($log);
             $info_line = true;
             while (!feof($log)) {
                 $line = fgets($log);
                 if (empty($line)) {
                     continue;
                 }
                 $data = explode(';', $line);
                 if ($data[0] == '[INFO]' && !$info_line) {
                     fn_echo(NEW_LINE);
                 } elseif ($data[0] != '[INFO]' && $info_line) {
                     fn_echo(NEW_LINE);
                 }
                 $data[1] = isset($data[1]) ? $data[1] : '';
                 $data[2] = isset($data[2]) ? $data[2] : '';
                 fn_echo($data[0] . $data[1] . $data[2] . NEW_LINE);
                 $info_line = $data[0] == '[INFO]';
             }
             fclose($log);
         }
     }
     $this->log->rotate();
     if (empty($filepath)) {
         $this->backupYml();
         if (file_exists($this->filepath_temp)) {
             fn_rm($this->filepath);
             fn_rename($this->filepath_temp, $this->filepath);
         }
     }
     fn_set_storage_data('yml2_product_export_' . $this->price_id);
     fn_set_storage_data('yml2_product_skip_' . $this->price_id);
     fn_set_storage_data('yml2_export_start_time_' . $this->price_id);
     fn_set_storage_data('yml2_export_count_' . $this->price_id);
     fn_set_storage_data('yml2_export_offset_' . $this->price_id);
     fn_set_storage_data('yml2_export_time_' . $this->price_id, time());
     fn_set_storage_data('yml2_status_generate_' . $this->price_id, 'finish');
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:79,代码来源:Yml2.php

示例12: logEvent

 /**
  * Set event to log
  * @param string $type
  * @param string $action
  * @param array  $data
  */
 protected static function logEvent($type, $action, array $data = array())
 {
     fn_log_event($type, $action, $data);
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:10,代码来源:DataKeeper.php

示例13: fn_update_news

function fn_update_news($news_id, $news_data, $lang_code = CART_LANGUAGE)
{
    // news title required
    if (empty($news_data['news'])) {
        return false;
    }
    $_data = $news_data;
    $_data['date'] = fn_parse_date($news_data['date']);
    if (isset($_data['localization'])) {
        $_data['localization'] = empty($_data['localization']) ? '' : fn_implode_localizations($_data['localization']);
    }
    if (empty($news_id)) {
        $create = true;
        $news_id = $_data['news_id'] = db_query("REPLACE INTO ?:news ?e", $_data);
        if (empty($news_id)) {
            return false;
        }
        // Adding descriptions
        foreach ((array) Registry::get('languages') as $_data['lang_code'] => $v) {
            db_query("INSERT INTO ?:news_descriptions ?e", $_data);
        }
    } else {
        if (!empty($news_data['block_id'])) {
            fn_add_items_to_block($news_data['block_id'], $news_data['add_items'], $news_id, 'news');
        }
        db_query("UPDATE ?:news SET ?u WHERE news_id = ?i", $_data, $news_id);
        // update news descriptions
        $_data = $news_data;
        db_query("UPDATE ?:news_descriptions SET ?u WHERE news_id = ?i AND lang_code = ?s", $_data, $news_id, $lang_code);
    }
    // Log news update/add
    fn_log_event('news', !empty($create) ? 'create' : 'update', array('news_id' => $news_id));
    fn_set_hook('update_news', $news_data, $news_id, $lang_code);
    return $news_id;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:35,代码来源:func.php

示例14: empty

        if (!empty($cart['failed_order_id'])) {
            $_msg = !empty($_payment_info['reason_text']) ? $_payment_info['reason_text'] : '';
            $_msg .= empty($_msg) ? __('text_order_placed_error') : '';
            fn_set_notification('O', '', $_msg);
            $cart['processed_order_id'] = $cart['failed_order_id'];
            unset($cart['failed_order_id']);
        }
        unset($_payment_info['card_number'], $_payment_info['cvv2']);
        $cart['payment_info'] = $_payment_info;
        if (!empty($cart['extra_payment_info'])) {
            $cart['payment_info'] = array_merge($cart['payment_info'], $cart['extra_payment_info']);
        }
    }
}
if ($mode == 'change_login') {
    $auth = $_SESSION['auth'];
    if (!empty($auth['user_id'])) {
        fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false, 'company_id' => fn_get_company_id('users', 'user_id', $auth['user_id'])));
    }
    unset($_SESSION['auth'], $_SESSION['cart']['user_data']);
    fn_delete_session_data(AREA . '_user_id', AREA . '_password');
    return array(CONTROLLER_STATUS_OK, 'onestepcheckout.checkout');
}
if (!empty($profile_fields)) {
    Registry::get('view')->assign('profile_fields', $profile_fields);
}
Registry::get('view')->assign('cart', $cart);
Registry::get('view')->assign('continue_url', empty($_SESSION['continue_url']) ? '' : $_SESSION['continue_url']);
Registry::get('view')->assign('mode', $mode);
Registry::get('view')->assign('payment_methods', $payment_methods);
$_SESSION['checkout_mode'] = $mode;
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:onestepcheckout.php

示例15: _generateError

 /**
  * Generates error notification
  *
  * @param  string $action Action thae was happen
  * @param  string $reason Reason, why the error notification must be showed
  * @param  string $table  Table name (optional)
  * @return bool   Always true
  */
 private function _generateError($action, $reason, $table = '')
 {
     $message = str_replace("[reason]", $reason, $action);
     if (!empty($table)) {
         $message = str_replace("[table]", $table, $message);
     }
     fn_log_event('settings', 'error', $message);
     if (Debugger::isActive() || fn_is_development()) {
         fn_set_notification('E', __('error'), $message);
     }
     return true;
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:20,代码来源:Settings.php


注:本文中的fn_log_event函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。