Exemplo n.º 1
0
function showError()
{
    $Register = Register::getInstance();
    $errors = $Register['PluginController']->getErrors();
    $_SESSION['message'] = $errors;
    redirect('/admin/get_plugins.php');
}
Exemplo n.º 2
0
 public function common($params)
 {
     $Register = Register::getInstance();
     $output = '';
     if (!strpos($params, '{{ users_rating }}')) {
         return $params;
     }
     $Cache = new Cache();
     $Cache->lifeTime = 600;
     if ($Cache->check('pl_users_rating')) {
         $users = $Cache->read('pl_users_rating');
         $users = json_decode($users, true);
     } else {
         $users = $this->DB->select('users', DB_ALL, array('order' => '`rating` DESC', 'limit' => $this->limit));
         //$users = $this->DB->query($sql);
         $Cache->write(json_encode($users), 'pl_users_rating', array());
     }
     if (!empty($users)) {
         foreach ($users as $key => $user) {
             $link = get_link($user['name'], getProfileUrl($user['id']));
             $ava = file_exists(ROOT . '/sys/avatars/' . $user['id'] . '.jpg') ? get_url('/sys/avatars/' . $user['id'] . '.jpg') : get_url('/sys/img/noavatar.png');
             $output .= sprintf($this->wrap, $ava, $link, $user['rating'], $user['posts']);
         }
     }
     $output .= '<div class="etopu">' . get_link('Весь рейтинг', '/users/index?order=rating') . '</div>';
     return str_replace('{{ users_rating }}', $output, $params);
 }
Exemplo n.º 3
0
 public function __construct($params = array())
 {
     $Register = Register::getInstance();
     $this->host = $_SERVER['HTTP_HOST'];
     $this->uniqUrl[] = 'http://' . $this->host;
     $this->DB = $Register['DB'];
 }
Exemplo n.º 4
0
 /**
  *
  */
 public function __construct()
 {
     $this->Register = Register::getInstance();
     $this->setPhpSettings();
     $this->touchStartTime();
     $this->Register['Cache'] = new Cache();
     $viewerLoader = new Fps_Viewer_Loader(array('template_root' => ROOT . '/template/' . getTemplateName() . '/html/'));
     $this->Register['Viewer'] = new Fps_Viewer_Manager($viewerLoader);
     if (isInstall()) {
         $this->registerCustomTemplateFunctions();
         $this->Register['DB'] = class_exists('PDO') && Config::read('use_pdo') ? FpsPDO::get() : FpsDataBase::get();
         $this->Register['UserAuth'] = new UserAuth();
         $this->Register['Log'] = new Logination();
     }
     $this->Register['DocParser'] = new Document_Parser();
     $this->Register['ACL'] = new ACL(ROOT . '/sys/settings/');
     $this->Register['PrintText'] = new PrintText();
     $this->Register['Validate'] = new Validate(function ($errors) {
         $Register = Register::getInstance();
         return $Register['DocParser']->wrapErrors($errors);
     });
     $this->Register['ModManager'] = new ModulesManager(ROOT . '/sys/settings/modules_access.php');
     $this->Register['PluginController'] = new Plugins();
     $this->Register['URL'] = new AtmUrl();
     $this->Register['Protector'] = new Protect();
     if (isInstall()) {
         $this->inputCheck();
         $this->initProtect();
         $this->initUser();
         $this->loadLanguages();
     }
 }
Exemplo n.º 5
0
function saveRules($rules)
{
    $Register = Register::getInstance();
    $Register['ACL']->save_rules(prepareConfToSave($rules));
    $_SESSION['message'] = __('Saved');
    redirect('/admin/users_rules.php');
}
Exemplo n.º 6
0
 public function delete()
 {
     $path = ROOT . '/sys/files/news/' . $this->filename;
     if (file_exists($path)) {
         unlink($path);
     }
     $Register = Register::getInstance();
     $Register['DB']->delete('news_attaches', array('id' => $this->id));
 }
Exemplo n.º 7
0
function showInfoMessage($message, $queryString = null)
{
    $Register = Register::getInstance();
    header('Refresh: ' . $Register['Config']->read('redirect_delay') . '; url=http://' . $_SERVER['SERVER_NAME'] . get_url($queryString));
    $html = file_get_contents(ROOT . '/template/' . getTemplateName() . '/html/default/infomessagegrand.html');
    $html = str_replace('{INFO_MESSAGE}', $message, $html);
    echo $html;
    die;
}
Exemplo n.º 8
0
 public function save()
 {
     $params = array('user_id' => intval($this->user_id), 'admin_id' => intval($this->admin_id), 'cause' => $this->cause, 'date' => $this->date, 'points' => intval($this->points));
     if ($this->id) {
         $params['id'] = $this->id;
     }
     $Register = Register::getInstance();
     return $Register['DB']->save('users_warnings', $params);
 }
Exemplo n.º 9
0
 /**
  * @param string $title
  */
 public function setTitle($title)
 {
     $Register = Register::getInstance();
     if (!empty($this->title) && $this->title !== $title) {
         $Register['URL']->saveOldEntryUrl($this, 'foto', $title);
     }
     $this->title = $title;
     $this->clean_url_title = $Register['URL']->getUrlByTitle($title, false);
 }
Exemplo n.º 10
0
 public function includeFile($path, array $subcontext)
 {
     $context = array_merge($this->context, $subcontext);
     $Register = Register::getInstance();
     $Viewer = clone $Register['Viewer'];
     $Viewer->setDefaultLayout('');
     $Viewer->setLayout('');
     echo $Viewer->view($path, $context);
 }
Exemplo n.º 11
0
 public function deleteUserWarnings($id)
 {
     $Register = Register::getInstance();
     $votes = $this->getCollection(array('user_id' => $id));
     if (!empty($votes)) {
         foreach ($votes as $vote) {
             $vote->delete();
         }
     }
 }
Exemplo n.º 12
0
 public function getByName($name)
 {
     $Register = Register::getInstance();
     $entity = $this->getDbDriver()->select($this->Table, DB_FIRST, array('cond' => array('name' => $name)));
     if (!empty($entity[0])) {
         $entityClassName = $Register['ModManager']->getEntityNameFromModel(get_class($this));
         $entity = new $entityClassName($entity[0]);
         return !empty($entity) ? $entity : false;
     }
     return false;
 }
Exemplo n.º 13
0
 {
     //return (null === $var) ? false : true;
     if (is_object($var)) {
         return true;
     }
     return !isset($this->{$var}) || $this->{$var} === null ? false : true;
 }
 public function asArray()
 {
     $args = get_object_vars($this);
     $args = array_map(function ($n) {
         if (is_object($n) && is_callable(array($n, 'asArray'))) {
Exemplo n.º 14
0
 public final function __construct()
 {
     $registry = Register::getInstance();
     if ($registry->db == NULL) {
         $db_settings = $registry->settings()->db;
         // $db = new PDO('pgsql:dbname=mydb;host=localhost;user=myuser;password=mypass');
         $dsn = 'pgsql:dbname=' . $db_settings->dbname . ';host=' . $db_settings->hostname;
         $crd = ';user='******';password=' . $db_settings->password;
         $registry->db = new PDO($dsn . $crd);
     }
     $this->db = $registry->db;
 }
Exemplo n.º 15
0
function showErrorMessage($message = '', $error = '', $redirect = false, $queryString = '')
{
    if ($redirect === true) {
        header('Refresh: ' . Config::read('redirect_delay') . '; url=http://' . $_SERVER['SERVER_NAME'] . get_url($queryString));
    }
    $Register = Register::getInstance();
    $View = $Register['Viewer'];
    $data['info_message'] = $message;
    $data['error_message'] = Config::read('debug_mode') ? $error : null;
    $html = $View->view('infomessagegrand.html', array('data' => $data));
    echo $html;
}
Exemplo n.º 16
0
 /**
  * @return object
  */
 public function getAuthor()
 {
     if (!$this->checkProperty('author')) {
         if (!$this->getId_author()) {
             $Register = Register::getInstance();
             $this->author = $Register['ModManager']->getEntityInstance('users');
         } else {
             $Model = new PostsModel('posts');
             $this->author = $Model->getById($this->getId_author());
             // TODO (function is not exists)
         }
     }
     return $this->author;
 }
Exemplo n.º 17
0
 public function getNextPrev($id)
 {
     $Register = Register::getInstance();
     $records = array('prev' => array(), 'next' => array());
     $prev = $this->getDbDriver()->select($this->Table, DB_FIRST, array('cond' => array('`id` < ' . $id), 'limit' => 1, 'order' => '`id` DESC'));
     if (!empty($prev[0])) {
         $records['prev'] = new FotoEntity($prev[0]);
     }
     $next = $this->getDbDriver()->select($this->Table, DB_FIRST, array('cond' => array('`id` > ' . $id), 'limit' => 1, 'order' => '`id`'));
     if (!empty($next[0])) {
         $records['next'] = new FotoEntity($next[0]);
     }
     return $records;
 }
Exemplo n.º 18
0
 /**
  * @param null $tplSource
  * @return mixed|null|string
  */
 public function replace($tplSource = null)
 {
     $source = $tplSource !== null ? $tplSource : $this->source;
     if (count($this->snippets) < 1) {
         return $source;
     }
     $Register = Register::getInstance();
     $Model = $Register['ModManager']->getModelInstance('snippets');
     foreach ($this->snippets as $snippet) {
         $regex = '#\\{\\[([!]*)(' . $snippet['hash'] . $snippet['name'] . ')(\\??.*)\\]\\}#U';
         preg_match_all($regex, $source, $mas);
         for ($ix_ = 0; $ix_ < count($mas[2]); $ix_++) {
             // snippet params
             $params = array();
             if (!empty($mas[3][$ix_])) {
                 preg_match_all('#([\\w]+)=([^&]+)#', $mas[3][$ix_], $matches);
                 if (!empty($matches)) {
                     foreach ($matches[1] as $k => $v) {
                         $params[$v] = $matches[2][$k];
                     }
                 }
             }
             if ($snippet['cached']) {
                 $cache_key = 'snippet_' . strtolower($snippet['name']);
                 $cache_key .= !empty($_SESSION['user']['status']) ? '_' . $_SESSION['user']['status'] : '_guest';
                 if ($this->Cache->check($cache_key)) {
                     $res = $this->Cache->read($cache_key);
                     $source = preg_replace('#' . preg_quote($mas[0][$ix_]) . '#', $res, $source);
                     continue;
                 }
             }
             // get snippet from data base
             $db_snippet = $Model->getByName($snippet['name']);
             // execute snippet and replace marker in template
             if ($db_snippet) {
                 ob_start();
                 eval($db_snippet->getBody());
                 $res = ob_get_contents();
                 ob_end_clean();
                 $source = preg_replace('#' . preg_quote($mas[0][$ix_]) . '#', $res, $source);
                 if ($snippet['cached']) {
                     $this->Cache->write($res, $cache_key, array());
                 }
             }
         }
     }
     return $source;
 }
Exemplo n.º 19
0
 public function common($params)
 {
     $Register = Register::getInstance();
     $output = '';
     if (!strpos($params, '{{ pop_news }}')) {
         return $params;
     }
     $Cache = new Cache();
     $Cache->lifeTime = 600;
     if ($Cache->check('pl_pop_news')) {
         $news = $Cache->read('pl_pop_news');
         $news = json_decode($news, true);
     } else {
         $news = $this->DB->select('news', DB_ALL, array('order' => '`views` DESC', 'limit' => $this->limit));
         $Cache->write(json_encode($news), 'pl_pop_news', array());
     }
     if (!empty($news)) {
         foreach ($news as $key => $new) {
             $link = get_url('/news/view/' . $new['id']);
             $output .= sprintf($this->wrap, $link, h($new['title']));
         }
     }
     return str_replace('{{ pop_news }}', $output, $params);
 }
Exemplo n.º 20
0
 /**
  * for write into log
  *
  * @param (str)     action.  be write into log
  * @return          none
  */
 public function write($param, $comment = '')
 {
     $Register = Register::getInstance();
     clearstatcache();
     /* prepear data */
     $param_log = array();
     $param_log['date'] = date("Y-m-d H:i");
     $param_log['action'] = $param;
     $param_log['comment'] = $comment;
     if (!empty($_SESSION['user'])) {
         $param_log['user_id'] = $_SESSION['user']['id'];
         $param_log['user_name'] = $_SESSION['user']['name'];
         //$statuses = $Register['ACL']->get_group_info();
         //$param_log['user_status'] = $statuses[$_SESSION['user']['status']];
         $param_log['user_status'] = (int) $_SESSION['user']['status'];
     }
     if (!empty($_SERVER['REMOTE_ADDR'])) {
         $param_log['ip'] = $_SERVER['REMOTE_ADDR'];
     }
     /* get file name for writing */
     $file_name = $this->getFileName();
     /* get records if exists */
     if (file_exists(ROOT . '/sys/logs/' . $this->logDir . '/' . $file_name)) {
         $log_data = json_decode(file_get_contents(ROOT . '/sys/logs/' . $this->logDir . '/' . $file_name), true);
         $log_data = array_merge($log_data, array(0 => $param_log));
     } else {
         $log_data = array();
         $log_data[] = $param_log;
     }
     $log_data = json_encode($log_data);
     /* write... */
     $file = fopen(ROOT . '/sys/logs/' . $this->logDir . '/' . $file_name, 'w+');
     fwrite($file, $log_data);
     fclose($file);
     return;
 }
Exemplo n.º 21
0
/**
 * Work for language pack.
 * Open language file and return needed
 * string.
 *
 * @param string $key
 * @param string $context
 * @return string
 */
function __($key, $context = false)
{
    $Register = Register::getInstance();
    $language = getLang();
    if (empty($language) || !is_string($language)) {
        $language = 'rus';
    }
    if (!empty($Register['translation_cache'])) {
        $lang = $Register['translation_cache'];
    } else {
        $lang_file = ROOT . '/sys/settings/languages/' . $language . '.php';
        $tpl_lang_file = ROOT . '/template/' . getTemplateName() . '/languages/' . $language . '.php';
        if (!file_exists($lang_file)) {
            throw new Exception('Main language file not found');
        }
        $lang = (include $lang_file);
        if (file_exists($tpl_lang_file)) {
            $tpl_lang = (include $tpl_lang_file);
            $lang = array_merge($lang, $tpl_lang);
        }
        $mod_langs = array_search_recursive($language, $Register['modules_translations']);
        if ($mod_langs) {
            foreach ($mod_langs as $path) {
                $mod_lang = (include $path);
                $lang = array_merge($lang, $mod_lang);
            }
        }
        $Register['translation_cache'] = $lang;
    }
    if ($context && is_string($context) && is_array($lang[$context])) {
        if (array_key_exists($context, $lang) && array_key_exists($key, $lang[$context])) {
            return $lang[$context][$key];
        }
    }
    if (array_key_exists($key, $lang)) {
        return $lang[$key];
    }
    return $key;
}
Exemplo n.º 22
0
 public function delete()
 {
     $Register = Register::getInstance();
     $Register['DB']->delete('forums', array('id' => $this->id));
 }
Exemplo n.º 23
0
 public function getNewThemes()
 {
     $Register = Register::getInstance();
     $FpsDB = $Register['DB'];
     $query = "SELECT id, UNIX_TIMESTAMP(last_post) AS unix_last_post\n\t\t\tFROM `" . $FpsDB->getFullTableName('themes') . "` \n\t\t\tGROUP BY id\n\t\t\tHAVING unix_last_post > " . $_SESSION['user']['unix_last_visit'];
     $res = $FpsDB->query($query);
     if ($res) {
         foreach ($res as $key => $row) {
             $_SESSION['newThemes'][$row['id']] = $row['unix_last_post'];
         }
     }
 }
Exemplo n.º 24
0
 /**
  * @param string $str
  * @return string 
  *
  * smiles process 
  */
 public function smile($str)
 {
     $str = Plugins::intercept('before_smiles_parse', $str);
     $Register = Register::getInstance();
     $path = $Register['Config']->read('smiles_set');
     $path = ROOT . '/sys/img/smiles/' . (!empty($path) ? $path : 'fapos') . '/info.php';
     include $path;
     $from = array();
     $to = array();
     if (isset($smilesList) && is_array($smilesList)) {
         foreach ($smilesList as $smile) {
             $from[] = $smile['from'];
             $to[] = '<img alt="' . $smile['from'] . '" title="' . $smile['from'] . '" src="' . WWW_ROOT . '/sys/img/smiles/fapos/' . $smile['to'] . '" />';
         }
     }
     $str = str_replace($from, $to, $str);
     return $str;
 }
Exemplo n.º 25
0
    public function edit($module)
    {
        $this->pageTitle .= ' - ' . __('Edit');
        $output = '';
        $Register = Register::getInstance();
        $model = $Register['ModManager']->getModelInstance($_GET['m']);
        $id = intval($_GET['id']);
        $entity = $model->getById($id);
        if (!empty($_POST)) {
            $entity->setTitle($_POST['title']);
            $entity->setMain($_POST['main']);
            $entity->setSourse_email($_POST['email']);
            $entity->save();
            $_SESSION['message'] = __('Saved');
            redirect('/admin/materials_list.php?m=' . $module);
        }
        $output .= '
		<div class="setting-item"><div class="left">
			' . __('Title') . '
		</div><div class="right">
			<input type="text" name="title" value="' . h($entity->getTitle()) . '" />
		</div><div class="clear"></div></div>
		<div class="setting-item"><div class="left">
			' . __('Text of material') . '
		</div><div class="right">
			<textarea style="height:200px;" name="main">' . h($entity->getMain()) . '</textarea>
		</div><div class="clear"></div></div>
		<div class="setting-item"><div class="left">
			' . __('Email') . '
		</div><div class="right">
			<input type="text" name="email" value="' . h($entity->getSourse_email()) . '" />
		</div><div class="clear"></div></div>
		<div class="setting-item">
			<div class="left">
			</div>
			<div class="right">
				<input class="save-button" type="submit" name="send" value="' . __('Save') . '" />
			</div>
			<div class="clear"></div>
		</div>';
        return array($output, '');
    }
Exemplo n.º 26
0
 function getComments($user_id = null, $offset = null, $per_page = null)
 {
     $user_id = intval($user_id);
     if ($user_id < 1) {
         return false;
     }
     $Register = Register::getInstance();
     $per_page = intval($per_page);
     $per_page = !empty($per_page) ? $per_page : 50;
     $offset = intval($offset);
     $page = !empty($offset) ? ceil($offset / $per_page) : 1;
     $commentsModel = $Register['ModManager']->getModelInstance('comments');
     $commentsModel->bindModel('author');
     $comments = $commentsModel->getCollection(array('user_id' => $user_id), array('page' => $page, 'limit' => $per_page));
     return $comments ? $comments : false;
 }
Exemplo n.º 27
0
## @last mod.     2013/06/15                    ##
##################################################
##################################################
##												##
## any partial or not partial extension         ##
## CMS AtomX,without the consent of the         ##
## author, is illegal                           ##
##################################################
## Любое распространение                        ##
## CMS AtomX или ее частей,                     ##
## без согласия автора, является не законным    ##
##################################################
include_once '../sys/boot.php';
include_once ROOT . '/admin/inc/adm_boot.php';
$pageTitle = 'Системные настройки';
$Register = Register::getInstance();
$config = $Register['Config']->read('all');
// Prepare templates selct list
$sourse = glob(ROOT . '/template/*', GLOB_ONLYDIR);
if (!empty($sourse) && is_array($sourse)) {
    $templates = array();
    foreach ($sourse as $dir) {
        if (preg_match('#.*/(\\w+)$#', $dir, $match)) {
            $templates[] = $match[1];
        }
    }
}
$templateSelect = array();
if (!empty($templates)) {
    foreach ($templates as $value) {
        $templateSelect[$value] = ucfirst($value);
Exemplo n.º 28
0
 protected function _getValidateRules()
 {
     $Register = Register::getInstance();
     $max_attach = Config::read('max_attaches', $this->module);
     if (empty($max_attach) || !is_numeric($max_attach)) {
         $max_attach = 5;
     }
     $rules = array('edit_product' => array('title' => array('required' => true, 'max_lenght' => 250, 'title' => __('Title')), 'description' => array('required' => false, 'max_lenght' => Config::read('max_lenght', $this->module), 'title' => __('Description')), 'article' => array('required' => false, 'max_lenght' => 20, 'title' => __('Article', 'shop')), 'price' => array('required' => true, 'max_lenght' => 11, 'pattern' => $Register['Validate']::V_FLOAT, 'title' => __('Price')), 'discount' => array('required' => false, 'max_lenght' => 2, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Discount')), 'category_id' => array('required' => true, 'max_lenght' => 11, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Category')), 'vendor_id' => array('required' => true, 'max_lenght' => 11, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Vendor')), 'attributes_group_id' => array('required' => true, 'max_lenght' => 11, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Attributes group')), 'commented' => array('title' => __('Allow comments')), 'available' => array('title' => __('Available for viewing')), 'view_on_home' => array('title' => __('View on home')), 'hide_not_exists' => array('title' => __('Hide not exists'))), 'attributes_groups' => array('title' => array('required' => true, 'max_lenght' => 250, 'title' => __('Title'))), 'attributes_group_edit' => array('title' => array('required' => true, 'max_lenght' => 250, 'title' => __('Title')), 'label' => array('required' => true, 'max_lenght' => 250, 'title' => __('Label')), 'type' => array('required' => true, 'max_lenght' => 10, 'title' => __('Type')), 'params' => array('required' => false, 'max_lenght' => 1000, 'title' => __('Params')), 'is_filterable' => array('required' => false, 'title' => __('Is filterable'))), 'delivery' => array('title' => array('required' => true, 'max_lenght' => 250, 'title' => __('Title')), 'price' => array('required' => false, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Price')), 'total_for_free' => array('required' => false, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Total for free delivery'))), 'vendors' => array('title' => array('required' => true, 'max_lenght' => 250, 'title' => __('Title')), 'description' => array('required' => false, 'title' => __('Description')), 'discount' => array('required' => false, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Discount')), 'view_on_home' => array(), 'hide_not_exists' => array(), 'files__logo_image' => array('type' => 'image', 'max_size' => Config::read('max_attaches_size', $this->module))), 'order_edit' => array('date' => array('required' => true, 'pattern' => $Register['Validate']::V_DATETIME), 'status' => array('required' => false, 'title' => __('Status')), 'total' => array('required' => false, 'pattern' => $Register['Validate']::V_FLOAT, 'title' => __('Total')), 'delivery_type_id' => array('required' => true, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Delivery type')), 'delivery_address' => array('required' => false, 'title' => __('Delivery address')), 'telephone' => array('required' => true, 'pattern' => $Register['Validate']::V_INT, 'title' => __('Telephone')), 'first_name' => array('required' => true, 'pattern' => $Register['Validate']::V_TITLE, 'title' => __('First name')), 'last_name' => array('required' => true, 'pattern' => $Register['Validate']::V_TITLE, 'title' => __('Last name'))), 'category_save' => array('title' => array('required' => true, 'pattern' => $Register['Validate']::V_TITLE), 'discount' => array('required' => false, 'title' => __('Discount'))));
     return $rules;
 }
Exemplo n.º 29
0
 protected function getGlobalMarkers($html = '')
 {
     $Register = Register::getInstance();
     $markers1 = $this->Parser->getGlobalMarkers($html);
     $markers2 = array('module' => $this->module, 'action' => $Register['action'], 'params' => $Register['params'], 'title' => $this->getCompleteMetaTag($this->page_title), 'meta_title' => $this->getCompleteMetaTag($this->page_title), 'meta_description' => $this->getCompleteMetaTag($this->page_meta_description), 'meta_keywords' => $this->getCompleteMetaTag($this->page_meta_keywords), 'module_title' => $this->module_title, 'categories' => $this->categories, 'comments' => $this->comments, 'comments_form' => $this->comments_form, 'fps_curr_page' => !empty($Register['page']) ? intval($Register['page']) : 1, 'fps_pagescnt' => !empty($Register['pagescnt']) ? intval($Register['pagescnt']) : 1, 'fps_user' => !empty($_SESSION['user']) ? $_SESSION['user'] : array(), 'is_home_page' => $Register['is_home_page'] ? true : false);
     $markers = array_merge($markers1, $markers2);
     //pr($markers);
     return $markers;
 }
Exemplo n.º 30
0
 public function delete()
 {
     $Register = Register::getInstance();
     $Register['DB']->delete('news_categories', array('id' => $this->id));
 }