/**
  * delete article and navigation node relation
  *
  * @param array $data
  */
 public function perform($data = FALSE)
 {
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}article_lock\n                  WHERE\n                   `id_article`={$data['id_article']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}article_media_pic\n                  WHERE\n                   `id_article`={$data['id_article']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}article_media_file\n                  WHERE\n                   `id_article`={$data['id_article']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}article_index\n                  WHERE\n                   `id_article`={$data['id_article']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}article_keyword\n                  WHERE\n                   `id_article`={$data['id_article']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}article_comment\n                  WHERE\n                   `id_article`={$data['id_article']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}article_view_rel\n                  WHERE\n                   `id_article`={$data['id_article']}";
     $this->model->dba->query($sql);
     $sql = "SELECT \n                  `media_folder`,\n                  `id_node`\n                FROM \n                  {$this->config['dbTablePrefix']}article_article\n                WHERE\n                   `id_article`={$data['id_article']}";
     $rs = $this->model->dba->query($sql);
     $row = $rs->fetchAssoc();
     if (isset($row['media_folder']) && !empty($row['media_folder'])) {
         // delete article data media folder
         SmartCommonUtil::deleteDirTree(SMART_BASE_DIR . 'data/article/' . $row['media_folder']);
     }
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}article_article\n                  WHERE\n                   `id_article`={$data['id_article']}";
     $this->model->dba->query($sql);
     // reorder node related article ranks
     $this->model->action('article', 'reorderRank', array('id_node' => (int) $row['id_node']));
 }
Пример #2
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)));
 }
 /**
  * remove empty user directory
  *
  */
 private function removeEmptyDirectory(&$media_folder, &$data)
 {
     $dir = SMART_BASE_DIR . 'data/article/' . $media_folder;
     if (TRUE == $this->isDirEmpty($dir)) {
         // delete whole tree
         SmartCommonUtil::deleteDirTree($dir);
         // remove media_folder reference
         $this->model->action('article', 'updateArticle', array('id_article' => (int) $data['id_article'], 'error' => &$data['error'], 'fields' => array('media_folder' => '')));
     }
 }
 /**
  * remove empty navigation data directory
  *
  * @return bool
  */
 private function removeEmptyDirectory($id_node, &$media_folder)
 {
     $dir = SMART_BASE_DIR . 'data/navigation/' . $media_folder;
     if (TRUE == $this->isDirEmpty($dir)) {
         // delete whole tree
         SmartCommonUtil::deleteDirTree($dir);
         // remove media_folder reference
         $this->model->action('navigation', 'updateNode', array('id_node' => (int) $id_node, 'fields' => array('media_folder' => '')));
     }
 }
 /**
  * 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']);
     }
 }
Пример #8
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'];
 }
 /**
  * Run init process of this module
  *
  */
 public function perform($data = FALSE)
 {
     $mysqlExtension = $this->getMySqlExtensionType();
     // session class
     require_once SMART_BASE_DIR . 'modules/common/includes/Smart' . $mysqlExtension . '.php';
     // Check if a setup was successfull done else launch setup > 'setup' module
     if (file_exists($this->config['config_path'] . 'dbConnect.php')) {
         include_once $this->config['config_path'] . 'dbConnect.php';
     } else {
         throw new SmartForwardAdminViewException($this->config['setup_module']);
     }
     // set db config vars
     $this->config['dbtype'] = 'mysql';
     $this->config['dbhost'] = $db['dbhost'];
     $this->config['dbuser'] = $db['dbuser'];
     $this->config['dbpasswd'] = $db['dbpasswd'];
     $this->config['dbname'] = $db['dbname'];
     $this->config['dbTablePrefix'] = $db['dbTablePrefix'];
     $this->config['dbcharset'] = $db['dbcharset'];
     try {
         $this->model->dba = new DbMysql($db['dbhost'], $db['dbuser'], $db['dbpasswd'], $db['dbname']);
         //$dbaOptions = array(MYSQLI_OPT_CONNECT_TIMEOUT => 5);
         $this->model->dba->connect();
         $this->model->dba->query("SET CHARACTER SET '{$db['dbcharset']}'");
     } catch (SmartDbException $e) {
         // if no database connection stop here
         throw new SmartModelException();
     }
     // set base url
     $this->model->baseUrlLocation = SmartCommonUtil::base_location();
     // set session handler
     $this->model->sessionHandler = new SmartSessionHandler($this->model->dba, $this->config['dbTablePrefix']);
     // start session
     $this->model->session = new SmartCommonSession();
     // load global config variables of the common module
     $this->loadConfig();
     // enable zlib output compression
     if ($this->config['output_compression'] == TRUE) {
         ini_set('zlib.output_compression', '1');
         ini_set('zlib.output_compression_level', $this->config['output_compression_level']);
         ini_set('zlib.output_handler', '');
     }
     // set charset
     ini_set("default_charset", $this->config['charset']);
     @header("Content-type: text/html; charset={$this->config['charset']}");
     // load module descriptions into config array
     $this->loadModulesInfo();
     $this->checkModuleVersion();
 }
 private function createMiscMediaFolder($id_text)
 {
     // create unique folder that dosent exists
     do {
         $folder = SmartCommonUtil::unique_crc32();
     } while (@is_dir(SMART_BASE_DIR . 'data/misc/' . $folder));
     if (!mkdir(SMART_BASE_DIR . 'data/misc/' . $folder, $this->config['media_folder_rights'])) {
         throw new SmartModelException('Cant create media folder: ' . $folder);
     }
     if (!mkdir(SMART_BASE_DIR . 'data/misc/' . $folder . '/thumb', $this->config['media_folder_rights'])) {
         throw new SmartModelException('Cant create media folder: ' . $folder . '/thumb');
     }
     $this->model->action('misc', 'updateText', array('error' => &$data['error'], 'id_text' => $id_text, 'fields' => array('media_folder' => $folder)));
     return $folder;
 }
 /**
  * createUserMediaFolder
  *
  * @param int $id_user 
  * @return string name of the media folder
  */
 private function createUserMediaFolder($id_user)
 {
     // create unique folder that dosent exists
     do {
         $folder = SmartCommonUtil::unique_crc32();
     } while (@is_dir(SMART_BASE_DIR . 'data/user/' . $folder));
     if (!mkdir(SMART_BASE_DIR . 'data/user/' . $folder, $this->config['media_folder_rights'])) {
         throw new SmartModelException('Cant create media folder: ' . $folder);
     }
     if (!mkdir(SMART_BASE_DIR . 'data/user/' . $folder . '/thumb', $this->config['media_folder_rights'])) {
         throw new SmartModelException('Cant create media folder: ' . $folder . '/thumb');
     }
     $error = array();
     $this->model->action('user', 'update', array('error' => &$error, 'id_user' => $id_user, 'user' => array('media_folder' => (string) $folder)));
     return $folder;
 }
 private function deleteNode($id_node)
 {
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}navigation_node_lock\n                  WHERE\n                   `id_node`={$id_node}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}navigation_media_pic\n                  WHERE\n                   `id_node`={$id_node}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}navigation_media_file\n                  WHERE\n                   `id_node`={$id_node}";
     $this->model->dba->query($sql);
     $sql = "SELECT `media_folder` FROM {$this->config['dbTablePrefix']}navigation_node\n                  WHERE\n                   `id_node`={$id_node}";
     $rs = $this->model->dba->query($sql);
     $row = $rs->fetchAssoc();
     if (isset($row['media_folder']) && !empty($row['media_folder'])) {
         // delete user data media folder
         SmartCommonUtil::deleteDirTree(SMART_BASE_DIR . 'data/navigation/' . $row['media_folder']);
     }
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}navigation_node\n                  WHERE\n                   `id_node`={$id_node}";
     $this->model->dba->query($sql);
 }
 /**
  * delete user
  *
  * @param array $data
  */
 function perform($data = FALSE)
 {
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}user_access\n                  WHERE\n                   `id_user`={$data['id_user']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}user_lock\n                  WHERE\n                   `id_user`={$data['id_user']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}user_media_pic\n                  WHERE\n                   `id_user`={$data['id_user']}";
     $this->model->dba->query($sql);
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}user_media_file\n                  WHERE\n                   `id_user`={$data['id_user']}";
     $this->model->dba->query($sql);
     $sql = "SELECT `media_folder` FROM {$this->config['dbTablePrefix']}user_user\n                  WHERE\n                   `id_user`={$data['id_user']}";
     $rs = $this->model->dba->query($sql);
     $row = $rs->fetchAssoc();
     if (isset($row['media_folder']) && !empty($row['media_folder'])) {
         // delete user data media folder
         SmartCommonUtil::deleteDirTree(SMART_BASE_DIR . 'data/user/' . $row['media_folder']);
     }
     $sql = "DELETE FROM {$this->config['dbTablePrefix']}user_user\n                  WHERE\n                   `id_user`={$data['id_user']}";
     $this->model->dba->query($sql);
     return TRUE;
 }
Пример #14
0
 /**
  * delete_dir_tree
  *
  * Delete directory and content recursive
  *
  * @param string $dir Directory
  */
 public static function deleteDirTree($dir)
 {
     if (($handle = @opendir($dir)) != FALSE) {
         while (($file = readdir($handle)) != false) {
             if ($file == "." || $file == "..") {
                 continue;
             }
             if (@is_dir($dir . '/' . $file)) {
                 SmartCommonUtil::deleteDirTree($dir . '/' . $file);
             } else {
                 if (@unlink($dir . '/' . $file) == FALSE) {
                     trigger_error("Can not delete content in dir tree: {$dir}/{$file}", E_USER_ERROR);
                 }
             }
         }
         @closedir($handle);
         if (@rmdir($dir) == FALSE) {
             trigger_error("Can not remvoe dir: {$dir}", E_USER_ERROR);
         }
     } else {
         trigger_error("Can not delete content dir: {$dir}", E_USER_ERROR);
     }
 }
 /**
  * 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;
 }
 /**
  * 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']);
 }
Пример #18
0
 /**
  * reset form data
  *
  */
 private function resetFormData()
 {
     $this->tplVar['login'] = $this->model->action('common', 'safeHtml', strip_tags(SmartCommonUtil::stripSlashes($_POST['login'])));
 }
 /**
  * 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'];
 }
 /**
  * remove empty user directory
  *
  * @return bool
  */
 private function removeEmptyDirectory()
 {
     $dir = SMART_BASE_DIR . 'data/misc/' . $this->mediaFolder;
     if (TRUE == $this->isDirEmpty($dir)) {
         // delete whole tree
         SmartCommonUtil::deleteDirTree($dir);
         // remove media_folder reference
         $this->model->action('misc', 'updateText', array('id_text' => (int) $this->idText, 'fields' => array('media_folder' => '')));
     }
 }
Пример #21
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']);
 }
 /**
  * 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));
 }
Пример #24
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);
 }
 /**
  * remove empty user directory
  *
  * @return bool
  */
 private function removeEmptyDirectory()
 {
     $dir = SMART_BASE_DIR . 'data/user/' . $this->mediaFolder;
     if (TRUE == $this->isDirEmpty($dir)) {
         // delete whole tree
         SmartCommonUtil::deleteDirTree($dir);
         $error = array();
         // remove media_folder reference
         $this->model->action('user', 'update', array('id_user' => (int) $this->idUser, 'error' => &$error, 'user' => array('media_folder' => '')));
     }
 }
Пример #26
0
 private function _reset_form_data()
 {
     $this->tplVar['login_name'] = htmlentities($this->strip(SmartCommonUtil::stripSlashes($_POST['login_name'])));
 }
Пример #27
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']);
 }
 /**
  * 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']);
     }
 }
 /**
  * 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)));
 }
 /**
  * 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']);
 }