Пример #1
0
<?php

define('ABS_PATH', dirname(dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))))) . '/');
define('OC_ADMIN', true);
require_once ABS_PATH . 'oc-load.php';
if (osc_is_admin_user_logged_in() == FALSE) {
    die;
}
$model = new GzNewsModel();
$dao = GzNewsDao::newInstance();
$redirect_url = $_SERVER['HTTP_REFERER'];
$gn_id = (int) Params::getParam('gn_id');
$from_form = (bool) Params::getParam('from_form');
if ($from_form) {
    $redirect_url = GzNewsUtils::getAdminIndexUrl();
}
$success = $dao->deleteByPrimaryKey($gn_id);
if ($success) {
    $model->removeFiles($gn_id);
    osc_add_flash_ok_message(__('The item was deleted successfully', 'gz_news'), 'admin');
} else {
    osc_add_flash_error_message('There were a problem while deleting the item', 'admin');
}
$model->redirectTo($redirect_url);
Пример #2
0
<?php

define('ABS_PATH', dirname(dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))))) . '/');
require_once ABS_PATH . 'oc-load.php';
$dao = GzNewsDao::newInstance();
$item_id = (int) Params::getParam('i');
$item = $dao->findByPrimaryKey($item_id);
$images = GzNewsUtils::getImagesUrl($item_id);
$model = new GzNewsModel();
if ($item) {
    Params::setParam('themeCustomtitle', $item['gn_title']);
} else {
    $model->redirectTo(GzNewsUtils::getIndexUrl());
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="<?php 
echo str_replace('_', '-', osc_current_user_locale());
?>
">
    <head>
		<?php 
osc_current_web_theme_path('head.php');
?>
        <meta name="robots" content="index, follow" />
        <meta name="googlebot" content="index, follow" />
    </head>
    <body>

		<?php 
/** Header that includes menu, logo, etc * */