Exemplo n.º 1
0
/**
 * Init crypt engine
 *
 * @return boolean always true
 */
function fn_init_crypt()
{
    if (!defined('CRYPT_STARTED')) {
        if (!(include DIR_LIB . 'crypt/Blowfish.php')) {
            fn_error(debug_backtrace(), "Can't connect Blowfish crypt class", false);
        }
        $crypt = new Crypt_Blowfish(Registry::get('config.crypt_key'));
        Registry::set('crypt', $crypt);
        fn_define('CRYPT_STARTED', true);
    }
    return true;
}
Exemplo n.º 2
0
/**
 * Extract files with Tar archiver
 *
 * @param $archive_name - name of the compressed file will be created
 * @param $file_list - list of files to place into archive
 * @param $dirname - directory, where the files should be extracted to
 * @return bool true
 */
function fn_decompress_files($archive_name, $dirname = '')
{
    include_once DIR_LIB . 'tar/tar.php';
    $tar = new Archive_Tar($archive_name, 'gz');
    if (!is_object($tar)) {
        fn_error(debug_backtrace(), 'Archiver initialization error', false);
    }
    if (!empty($dirname) && is_dir($dirname)) {
        chdir($dirname);
        $tar->extract('');
        chdir(DIR_ROOT);
    } else {
        $tar->extract('');
    }
    return true;
}
                $query = "\r\n\t\t\t\tINSERT INTO note (note_title,note_description,note_user,note_text,note_date,note_images,note_special, page_id,category_id,note_pangkas, user_id) \r\n\t\t\t\tVALUES ('{$note_title}','{$note_description}','{$note_user}','{$note_text}',now(),'{$nama_file}','{$status_berita}', '{$page_id}', '{$category_id}','{$note_pangkas}', '" . ${$admin_key} . "')\r\n\t\t\t\t";
            }
        } else {
            $error = true;
        }
    } else {
        $query = "\r\n\t\tINSERT INTO note (note_title,note_description,note_user,note_text,note_date,note_special, page_id,category_id,note_pangkas, user_id) \r\n\t\tVALUES ('{$note_title}','{$note_description}','{$note_user}','{$note_text}',now(),'{$status_berita}', '{$page_id}', '{$category_id}','{$note_pangkas}', '" . ${$admin_key} . "')";
    }
    if (!$error) {
        $result = fn_query($conn_id, $query);
        if ($result) {
            disconnect($conn_id);
            echo "<html><body onload=\"window.location.replace('note.php?pg={$page_id}&category={$category_id}');\"></body></html>";
            exit;
        } else {
            $error_message = fn_error($conn_id);
            @unlink("../{$note_path}/{$namafile}");
        }
    } else {
        $error_message = "ERROR : Upload failed";
    }
    $error_message = addslashes($error_message);
    $onload = "alert('{$error_message}');";
}
$temp = explode("_", $template_name);
unset($temp[count($temp) - 1]);
$template_name = @implode("_", $temp);
$note_images = "../library/pixel.gif";
$checked_pembaca_0 = "checked";
$checked_pangkas_1 = "checked";
$template_path = "./";
Exemplo n.º 4
0
                                break;
                            default:
                                fn_error();
                                break;
                        }
                    } else {
                        fn_error();
                    }
                }
            }
        }
    } catch (Exception $e) {
        fn_error();
    }
} else {
    fn_error();
}
function update_webInfo($req)
{
    // prp 0 文本修改 1 logo 修改 2 headimg 修改
    include_once 'update.php';
    $prp = isset($req['prp']) ? $req["prp"] : '';
    $update = new Design_update();
    if ($prp == 0) {
        $update->webInfo($req);
    } else {
        if ($prp == 1) {
            $update->webInfo_logo($req);
        } else {
            if ($prp == 2) {
                $update->webInfo_headimg($req);
Exemplo n.º 5
0
//setcookie('page_unload', 'N', '0', !empty($config['current_path'])? $config['current_path'] : '/');
if (isset($_GET['ct']) && (AREA == 'A' || defined('DEVELOPMENT'))) {
    fn_rm(DIR_THUMBNAILS, false);
}
// Set configuration options from config.php to registry
Registry::set('config', $config);
unset($config);
// Check if software is installed
if (Registry::get('config.db_host') == '%DB_HOST%') {
    die(PRODUCT_NAME . ' is <b>not installed</b>. Please click here to start the installation process: <a href="install/">[install]</a>');
}
// Connect to database
$db_conn = db_initiate(Registry::get('config.db_host'), Registry::get('config.db_user'), Registry::get('config.db_password'), Registry::get('config.db_name'));
//var_dump($db_conn);
if (!$db_conn) {
    fn_error(debug_backtrace(), 'Cannot connect to the database server', false);
}
// Clean up cache
if (isset($_GET['cc']) && (AREA == 'A' || defined('DEVELOPMENT'))) {
    fn_rm(DIR_COMPILED, false);
    fn_rm(DIR_CACHE, false);
    Registry::cleanup();
}
if (defined('MYSQL5')) {
    db_query("set @@sql_mode = ''");
}
register_shutdown_function(array('Registry', 'save'));
// define lifetime for the cache data
define('CACHE_LEVEL_TIME', 'time');
// First-level cache: static - the same for all requests
define('CACHE_LEVEL_STATIC', 'cache');
Exemplo n.º 6
0
if ($config['db_host'] == '%DB_HOST%') {
    $product_name = PRODUCT_EDITION == 'ULTIMATE' ? PRODUCT_NAME : 'Multi-Vendor';
    die($product_name . ' is <b>not installed</b>. Please click here to start the installation process: <a href="install/">[install]</a>');
}
// Load core functions
$fn_list = array('fn.database.php', 'fn.users.php', 'fn.catalog.php', 'fn.cms.php', 'fn.cart.php', 'fn.locations.php', 'fn.common.php', 'fn.fs.php', 'fn.images.php', 'fn.init.php', 'fn.control.php', 'fn.search.php', 'fn.promotions.php', 'fn.log.php', 'fn.companies.php', 'fn.addons.php');
$fn_list[] = 'fn.' . strtolower(PRODUCT_EDITION) . '.php';
foreach ($fn_list as $file) {
    require $config['dir']['functions'] . $file;
}
Registry::set('class_loader', $classLoader);
Registry::set('config', $config);
unset($config);
// Connect to database
if (!db_initiate(Registry::get('config.db_host'), Registry::get('config.db_user'), Registry::get('config.db_password'), Registry::get('config.db_name'))) {
    fn_error('Cannot connect to the database server');
}
register_shutdown_function(array('\\Tygh\\Registry', 'save'));
// define lifetime for the cache data
date_default_timezone_set('UTC');
// setting temporary timezone to avoid php warnings
if (defined('API')) {
    fn_init_stack(array('fn_init_api'));
}
fn_init_stack(array('fn_init_storage'), array('fn_init_ua'));
if (fn_allowed_for('ULTIMATE')) {
    fn_init_stack(array('fn_init_store_params_by_host', &$_REQUEST));
}
fn_init_stack(array(array('\\Tygh\\Session', 'init'), &$_REQUEST), array('fn_init_ajax'), array('fn_init_company_id', &$_REQUEST), array('fn_check_cache', $_REQUEST), array('fn_init_settings'), array('fn_init_addons'), array('fn_get_route', &$_REQUEST), array('fn_simple_ultimate', &$_REQUEST));
if (!fn_allowed_for('ULTIMATE:FREE')) {
    fn_init_stack(array('fn_init_localization', &$_REQUEST));
Exemplo n.º 7
0
/**
 * Display database error
 *
 * @param resource $result result, returned by database server
 * @param string $query SQL query, passed to server
 * @return mixed false if no error, dies with error message otherwise
 */
function db_error($result, $query)
{
    if (!empty($result) || driver_db_errno() == 0) {
        // it's ok
    } else {
        $error = array('message' => driver_db_error() . ' <b>(' . driver_db_errno() . ')</b>', 'query' => $query);
        if (Registry::get('runtime.database.skip_errors') == true) {
            Registry::push('runtime.database.errors', $error);
        } else {
            fn_error(debug_backtrace(), $error);
        }
    }
    return false;
}