예제 #1
0
 /**
  * init some variables
  *
  */
 private function initVars()
 {
     if (isset($_REQUEST['search'])) {
         $this->searchString = SmartCommonUtil::stripSlashes((string) $_REQUEST['search']);
         $this->pagerUrlSearchString = urlencode(SmartCommonUtil::stripSlashes((string) $_REQUEST['search']));
     } else {
         $this->searchString = '';
         $this->pagerUrlSearchString = '';
     }
     // strip bad code
     $this->searchString = $this->model->action('common', 'safeHtml', strip_tags($this->searchString));
     // assign template variable with search string
     $this->tplVar['search'] = $this->searchString;
     $this->tplVar['formsearch'] = $this->searchString;
     // template array variables
     $this->tplVar['articles'] = array();
     $this->tplVar['pager'] = '';
     // set articles limit per page
     $this->articlesPerPage = 10;
     // get current article pager page
     if (!isset($_GET['search_page'])) {
         $this->pageNumber = 1;
     } else {
         $this->pageNumber = (int) $_GET['search_page'];
     }
     // template var with charset used for the html pages
     $this->tplVar['charset'] =& $this->config['charset'];
     // relative path to the smart directory
     $this->tplVar['relativePath'] = SMART_RELATIVE_PATH;
     // we need this template vars to show admin links if the user is logged
     $this->tplVar['loggedUserRole'] = $this->viewVar['loggedUserRole'];
     $this->tplVar['adminWebController'] = $this->config['admin_web_controller'];
 }
 /**
  * add new node
  *
  * @param int $id_parent parent node of the new node
  */
 private function addKeyword($id_parent)
 {
     if (!isset($_POST['title']) || empty($_POST['title'])) {
         $this->tplVar['error'] = 'Title is empty';
         return FALSE;
     }
     return $this->model->action('keyword', 'add', array('fields' => array('title' => SmartCommonUtil::stripSlashes((string) $_POST['title']), 'id_parent' => (int) $id_parent, 'status' => 1)));
 }
 /**
  * add new node
  *
  * @param int $id_parent parent node of the new node
  */
 private function addText()
 {
     if (!isset($_POST['title']) || empty($_POST['title'])) {
         $this->tplVar['error'][] = 'Title is empty';
         return FALSE;
     }
     return $this->model->action('misc', 'addText', array('error' => &$this->tplVar['error'], 'fields' => array('title' => SmartCommonUtil::stripSlashes(strip_tags((string) $_POST['title'])), 'status' => 1)));
 }
 /**
  * init variables for this view
  *
  */
 private function initVars()
 {
     if (isset($_POST['search'])) {
         $this->searchString = SmartCommonUtil::stripSlashes((string) $_POST['search']);
         $this->pagerUrlSearchString = urlencode(SmartCommonUtil::stripSlashes((string) $_POST['search']));
     } elseif (isset($_GET['search'])) {
         $this->searchString = urldecode(SmartCommonUtil::stripSlashes((string) $_GET['search']));
         $this->pagerUrlSearchString = SmartCommonUtil::stripSlashes((string) $_GET['search']);
     } else {
         $this->searchString = '';
         $this->pagerUrlSearchString = '';
     }
     // assign template variable with search string
     $this->tplVar['search'] =& $this->searchString;
     // template array variables
     $this->tplVar['articles'] = array();
     $this->tplVar['pager'] = '';
     // set articles limit per page
     $this->articlesPerPage = 15;
     // get current article pager page
     if (isset($_GET['search_page'])) {
         $this->pageNumber = (int) $_GET['search_page'];
         $this->tplVar['search_page'] = (int) $_GET['search_page'];
         $this->model->session->set('article_page', (int) $_GET['search_page']);
     } elseif (NULL !== ($search_page = $this->model->session->get('search_page'))) {
         $this->pageNumber = $search_page;
         $this->tplVar['search_page'] = $search_page;
     } else {
         $this->pageNumber = 1;
         $this->tplVar['search_page'] = 1;
         $this->model->session->set('search_page', 1);
     }
     // The url passed to the pager action
     $this->pagerUrl = SMART_CONTROLLER . '?nodecoration=1&mod=article&view=search&search=' . $this->pagerUrlSearchString;
     // set article order
     if (isset($_POST['order'])) {
         $this->order = array((string) $_POST['order'], (string) $_POST['ordertype']);
         $this->tplVar['order'] = (string) $_POST['order'];
         $this->tplVar['ordertype'] = (string) $_POST['ordertype'];
         $this->model->session->set('article_order', (string) $_POST['order']);
         $this->model->session->set('ordertype', (string) $_POST['ordertype']);
         $this->model->session->del('article_page');
     } elseif (NULL !== ($order = $this->model->session->get('article_order'))) {
         $ordertype = $this->model->session->get('ordertype');
         $this->order = array($order, $ordertype);
         $this->tplVar['order'] = $order;
         $this->tplVar['ordertype'] = (string) $ordertype;
     } else {
         $this->order = array($this->model->config['article']['default_order'], $this->model->config['article']['default_ordertype']);
         $this->tplVar['order'] = $this->model->config['article']['default_order'];
         $this->tplVar['ordertype'] = $this->model->config['article']['default_ordertype'];
         $this->model->session->set('article_order', $this->model->config['article']['default_order']);
         $this->model->session->set('ordertype', $this->model->config['article']['default_ordertype']);
     }
 }
예제 #5
0
 /**
  * init some variables
  *
  */
 private function initVars()
 {
     if (isset($_REQUEST['search'])) {
         $this->searchString = SmartCommonUtil::stripSlashes((string) $_REQUEST['search']);
     } else {
         $this->searchString = '';
     }
     // assign template variable with search string
     $this->tplVar['search'] =& $this->searchString;
     // template array variables
     $this->tplVar['articles'] = array();
     // template var with charset used for the html pages
     $this->tplVar['charset'] =& $this->config['charset'];
 }
 /**
  * Update node data
  *
  * @param int $rank New rank
  */
 private function updateLink()
 {
     $fields = array('id_node' => (int) $_POST['link_id_node'], 'status' => (int) $_POST['status'], 'title' => SmartCommonUtil::stripSlashes((string) $_POST['title']), 'description' => SmartCommonUtil::stripSlashes((string) $_POST['description']), 'url' => SmartCommonUtil::stripSlashes((string) $_POST['url']));
     $this->model->action('link', 'updateLink', array('id_link' => (int) $_REQUEST['id_link'], 'fields' => $fields));
 }
 /**
  * strip slashes from form fields
  *
  * @param array $var_array Associative array
  */
 private function stripSlashesArray(&$var_array)
 {
     $tmp_array = array();
     foreach ($var_array as $f) {
         $tmp_array[] = preg_replace("/\"/", "'", SmartCommonUtil::stripSlashes($f));
     }
     return $tmp_array;
 }
 /**
  * set article field values depended on the configuration settings
  *
  */
 private function addSetArticleFields(&$articleFields)
 {
     if ($this->config['article']['use_overtitle'] == 1) {
         $articleFields['overtitle'] = SmartCommonUtil::stripSlashes((string) $_POST['overtitle']);
     }
     if ($this->config['article']['use_subtitle'] == 1) {
         $articleFields['subtitle'] = SmartCommonUtil::stripSlashes((string) $_POST['subtitle']);
     }
     if ($this->config['article']['use_description'] == 1) {
         $articleFields['description'] = SmartCommonUtil::stripSlashes((string) $_POST['description']);
     }
     if ($this->config['article']['use_header'] == 1) {
         $articleFields['header'] = SmartCommonUtil::stripSlashes((string) $_POST['header']);
     }
     if ($this->config['article']['use_ps'] == 1) {
         $articleFields['ps'] = SmartCommonUtil::stripSlashes((string) $_POST['ps']);
     }
 }
예제 #9
0
 private function _reset_form_data()
 {
     $this->tplVar['login_name'] = htmlentities($this->strip(SmartCommonUtil::stripSlashes($_POST['login_name'])));
 }
 /**
  * Update node data
  *
  * @param int $rank New rank
  */
 private function updateKeyword()
 {
     $fields = array('id_parent' => (int) $_POST['key_id_parent'], 'status' => (int) $_POST['status'], 'title' => SmartCommonUtil::stripSlashes((string) $_POST['title']), 'description' => SmartCommonUtil::stripSlashes((string) $_POST['description']));
     if ($this->key_was_moved == TRUE) {
         // get id_sector and status of the new parent node
         $new_parent_node_data = array();
         $this->model->action('keyword', 'getKeyword', array('id_key' => (int) $_POST['key_id_parent'], 'result' => &$new_parent_node_data, 'fields' => array('status')));
         // only if the new parent node status = 1 (inactive)
         if ($new_parent_key_data['status'] == 1) {
             $fields['status'] = $new_parent_key_data['status'];
         }
         // updates id_sector and status of subnodes
         $this->model->action('keyword', 'updateSubKeywords', array('id_key' => (int) $_REQUEST['id_key'], 'fields' => array('status' => (int) $fields['status'])));
     } elseif ($_POST['old_status'] != $_POST['status']) {
         // updates status of subnodes
         $this->model->action('keyword', 'updateSubKeywords', array('id_key' => (int) $_REQUEST['id_key'], 'fields' => array('status' => (int) $fields['status'])));
     }
     $this->model->action('keyword', 'update', array('id_key' => (int) $_REQUEST['id_key'], 'fields' => $fields));
 }
예제 #11
0
 /**
  * reset the form fields with old user data
  *
  * @access privat
  */
 private function resetFormData()
 {
     $this->tplVar['role'] = SmartCommonUtil::stripSlashes($_POST['role']);
     $this->tplVar['form_status'] = $_POST['status'];
     $this->tplVar['form_email'] = SmartCommonUtil::stripSlashes($_POST['email']);
     $this->tplVar['form_name'] = SmartCommonUtil::stripSlashes($_POST['name']);
     $this->tplVar['form_lastname'] = SmartCommonUtil::stripSlashes($_POST['lastname']);
     $this->tplVar['form_login'] = SmartCommonUtil::stripSlashes($_POST['login']);
     $this->tplVar['form_passwd'] = SmartCommonUtil::stripSlashes($_POST['passwd']);
 }
예제 #12
0
 /**
  * Rollback setup of each module
  *
  */
 private function rollback()
 {
     $data = array('superuser_passwd' => SmartCommonUtil::stripSlashes($_REQUEST['syspassword']), 'dbtablesprefix' => SmartCommonUtil::stripSlashes($_REQUEST['dbtablesprefix']), 'dbhost' => SmartCommonUtil::stripSlashes($_REQUEST['dbhost']), 'dbhostport' => SmartCommonUtil::stripSlashes($_REQUEST['dbhostport']), 'dbuser' => SmartCommonUtil::stripSlashes($_REQUEST['dbuser']), 'dbpasswd' => SmartCommonUtil::stripSlashes($_REQUEST['dbpasswd']), 'dbname' => SmartCommonUtil::stripSlashes($_REQUEST['dbname']), 'charset' => SmartCommonUtil::stripSlashes($_REQUEST['charset']), 'config' => &$this->viewVar['setup_config'], 'rollback' => TRUE);
     $this->model->broadcast('setup', $data);
 }
 /**
  * Update text data
  *
  * @param int $rank New rank
  */
 private function updatetext($format)
 {
     $fields = array('status' => (int) $_POST['status'], 'title' => SmartCommonUtil::stripSlashes(strip_tags((string) $_POST['title'])), 'description' => SmartCommonUtil::stripSlashes((string) $_POST['description']), 'body' => SmartCommonUtil::stripSlashes((string) $_POST['body']));
     if ($format != FALSE) {
         $fields['format'] = $format;
     }
     $this->model->action('misc', 'updateText', array('id_text' => (int) $_REQUEST['id_text'], 'fields' => $fields));
 }
 /**
  * Update node data
  *
  * @param int $rank New rank
  */
 private function updateNode($rank, $format)
 {
     $fields = array('id_parent' => (int) $_POST['node_id_parent'], 'status' => (int) $_POST['status'], 'title' => SmartCommonUtil::stripSlashes((string) $_POST['title']), 'short_text' => SmartCommonUtil::stripSlashes((string) $_POST['short_text']), 'body' => SmartCommonUtil::stripSlashes((string) $_POST['body']));
     if ($rank != FALSE) {
         $fields['rank'] = $rank;
     }
     // only administrators can assign a node related view
     if ($this->viewVar['loggedUserRole'] <= 20) {
         $fields['id_view'] = $_POST['id_view'];
     }
     if ($format != FALSE) {
         $fields['format'] = $format;
     }
     $this->model->action('navigation', 'updateNode', array('id_node' => (int) $_REQUEST['id_node'], 'fields' => $fields));
 }
 /**
  * reset the form fields with old link data
  *
  * @access privat
  */
 private function resetFormData()
 {
     $this->tplVar['title'] = htmlspecialchars(SmartCommonUtil::stripSlashes((string) $_POST['title']), ENT_COMPAT, $this->config['charset']);
 }
 /**
  * reset form data
  *
  */
 private function resetFields()
 {
     $this->tplVar['option'] = array();
     if (isset($_POST['thumb_width'])) {
         $this->tplVar['option']['thumb_width'] = (int) SmartCommonUtil::stripSlashes($_POST['thumb_width']);
     }
     if (isset($_POST['img_size_max'])) {
         $this->tplVar['option']['img_size_max'] = (int) SmartCommonUtil::stripSlashes($_POST['img_size_max']);
     }
     if (isset($_POST['file_size_max'])) {
         $this->tplVar['option']['file_size_max'] = (int) SmartCommonUtil::stripSlashes($_POST['file_size_max']);
     }
     if (isset($_POST['use_overtitle'])) {
         $this->tplVar['option']['use_overtitle'] = (int) SmartCommonUtil::stripSlashes($_POST['use_overtitle']);
     }
     if (isset($_POST['use_subtitle'])) {
         $this->tplVar['option']['use_subtitle'] = (int) SmartCommonUtil::stripSlashes($_POST['use_subtitle']);
     }
     if (isset($_POST['use_description'])) {
         $this->tplVar['option']['use_description'] = (int) SmartCommonUtil::stripSlashes($_POST['use_description']);
     }
     if (isset($_POST['use_header'])) {
         $this->tplVar['option']['use_header'] = (int) SmartCommonUtil::stripSlashes($_POST['use_header']);
     }
     if (isset($_POST['use_ps'])) {
         $this->tplVar['option']['use_ps'] = (int) SmartCommonUtil::stripSlashes($_POST['use_ps']);
     }
     if (isset($_POST['use_changedate'])) {
         $this->tplVar['option']['use_changedate'] = (int) SmartCommonUtil::stripSlashes($_POST['use_changedate']);
     }
     if (isset($_POST['use_articledate'])) {
         $this->tplVar['option']['use_articledate'] = (int) SmartCommonUtil::stripSlashes($_POST['use_articledate']);
     }
     if (isset($_POST['use_logo'])) {
         $this->tplVar['option']['use_logo'] = (int) SmartCommonUtil::stripSlashes($_POST['use_logo']);
     }
     if (isset($_POST['use_images'])) {
         $this->tplVar['option']['use_images'] = (int) SmartCommonUtil::stripSlashes($_POST['use_images']);
     }
     $this->tplVar['option']['default_order'] = (string) SmartCommonUtil::stripSlashes($_POST['default_order']);
     $this->tplVar['option']['default_ordertype'] = (string) SmartCommonUtil::stripSlashes($_POST['default_ordertype']);
 }
예제 #17
0
 /**
  * reset the form fields with old link data
  *
  * @access privat
  */
 private function resetFormData()
 {
     $this->tplVar['status'] = SmartCommonUtil::stripSlashes($_POST['status']);
     $this->tplVar['title'] = htmlspecialchars(SmartCommonUtil::stripSlashes($_POST['title']), ENT_COMPAT, $this->config['charset']);
     $this->tplVar['url'] = htmlspecialchars(SmartCommonUtil::stripSlashes($_POST['url']), ENT_COMPAT, $this->config['charset']);
     $this->tplVar['description'] = SmartCommonUtil::stripSlashes($_POST['description']);
 }
 /**
  * reset the form fields with old user data
  *
  * @access privat
  */
 private function resetFormData()
 {
     // if empty assign form field with old values
     $this->tplVar['user']['role'] = (int) $_POST['role'];
     $this->tplVar['user']['email'] = SmartCommonUtil::stripSlashes((string) $_POST['email']);
     $this->tplVar['user']['name'] = SmartCommonUtil::stripSlashes((string) $_POST['name']);
     $this->tplVar['user']['lastname'] = SmartCommonUtil::stripSlashes((string) $_POST['lastname']);
     $this->tplVar['user']['description'] = SmartCommonUtil::stripSlashes((string) $_POST['description']);
     $this->tplVar['user']['login'] = SmartCommonUtil::stripSlashes((string) $_POST['login']);
     $this->tplVar['user']['passwd'] = SmartCommonUtil::stripSlashes((string) $_POST['passwd']);
     $this->tplVar['user']['status'] = (int) $_POST['status'];
     $this->tplVar['user']['user_gmt'] = (int) $_POST['user_gmt'];
     $this->tplVar['format'] = (int) $_POST['format'];
 }
 /**
  * add new node
  *
  * @param int $id_parent parent node of the new node
  */
 private function addNode($id_parent)
 {
     if (!isset($_POST['title']) || empty($_POST['title'])) {
         $this->tplVar['error'] = 'Title is empty';
         return FALSE;
     }
     // init id_view
     $id_view = 0;
     // get associated view of the parent node
     if ($id_parent != 0) {
         $tmp = array();
         // get current node data
         $this->model->action('navigation', 'getNode', array('result' => &$tmp, 'id_node' => (int) $id_parent, 'fields' => array('id_view')));
         $id_view = $tmp['id_view'];
     }
     return $this->model->action('navigation', 'addNode', array('id_parent' => (int) $id_parent, 'fields' => array('title' => SmartCommonUtil::stripSlashes((string) $_POST['title']), 'id_view' => (int) $id_view, 'status' => 1)));
 }
예제 #20
0
 /**
  * reset form data
  *
  */
 private function resetFormData()
 {
     $this->tplVar['login'] = $this->model->action('common', 'safeHtml', strip_tags(SmartCommonUtil::stripSlashes($_POST['login'])));
 }
예제 #21
0
 /**
  * init some variables
  *
  */
 private function initVars()
 {
     if (isset($_POST['search'])) {
         $this->searchString = SmartCommonUtil::stripSlashes((string) $_POST['search']);
         $this->pagerUrlSearchString = urlencode(SmartCommonUtil::stripSlashes((string) $_POST['search']));
     } elseif (isset($_GET['search'])) {
         $this->searchString = urldecode(SmartCommonUtil::stripSlashes((string) $_GET['search']));
         $this->pagerUrlSearchString = SmartCommonUtil::stripSlashes((string) $_GET['search']);
     } else {
         $this->searchString = '';
         $this->pagerUrlSearchString = '';
     }
     // assign template variable with search string
     $this->tplVar['search'] =& $this->searchString;
     // template array variables
     $this->tplVar['articles'] = array();
     $this->tplVar['pager'] = '';
     // set articles limit per page
     $this->articlesPerPage = 10;
     // get current article pager page
     if (!isset($_GET['search_page'])) {
         $this->pageNumber = 1;
     } else {
         $this->pageNumber = (int) $_GET['search_page'];
     }
     // template var with charset used for the html pages
     $this->tplVar['charset'] =& $this->config['charset'];
 }