/** * init variables for this view * */ private function initVars() { $post_search = $this->httpRequest->getParameter('search', 'post', 'raw'); $get_search = $this->httpRequest->getParameter('search', 'get', 'raw'); if (!empty($post_search)) { $this->searchString = JapaCommonUtil::stripSlashes((string) $post_search); $this->pagerUrlSearchString = urlencode(JapaCommonUtil::stripSlashes((string) $post_search)); } elseif (!empty($get_search)) { $this->searchString = urldecode(JapaCommonUtil::stripSlashes((string) $get_search)); $this->pagerUrlSearchString = JapaCommonUtil::stripSlashes((string) $get_search); } else { $this->searchString = ''; $this->pagerUrlSearchString = ''; } // assign template variable with search string $this->viewVar['search'] =& $this->searchString; // template array variables $this->viewVar['articles'] = array(); $this->viewVar['pager'] = ''; // set articles limit per page $this->articlesPerPage = 15; $search_page = $this->httpRequest->getParameter('search_page', 'get', 'int'); // get current article pager page if (!empty($search_page)) { $this->pageNumber = (int) $search_page; $this->viewVar['search_page'] = (int) $search_page; $this->model->session->set('article_page', (int) $search_page); } elseif (NULL !== ($search_page = $this->model->session->get('search_page'))) { $this->pageNumber = $search_page; $this->viewVar['search_page'] = $search_page; } else { $this->pageNumber = 1; $this->viewVar['search_page'] = 1; $this->model->session->set('search_page', 1); } // The url passed to the pager action $this->pagerUrl = $this->controllerVar['url_base'] . '/' . $this->viewVar['adminWebController'] . '/nodecoration/1/mod/article/cntr/search/search/' . $this->pagerUrlSearchString; $order = $this->httpRequest->getParameter('order', 'post', 'raw'); $ordertype = $this->httpRequest->getParameter('ordertype', 'post', 'alpha'); // set article order if (!empty($order)) { $this->order = array((string) $order, (string) $ordertype); $this->viewVar['order'] = (string) $order; $this->viewVar['ordertype'] = (string) $ordertype; $this->model->session->set('article_order', (string) $order); $this->model->session->set('ordertype', (string) $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->viewVar['order'] = $order; $this->viewVar['ordertype'] = (string) $ordertype; } else { $this->order = array($this->config->getModuleVar('article', 'default_order'), $this->config->getModuleVar('article', 'default_ordertype')); $this->viewVar['order'] = $this->config->getModuleVar('article', 'default_order'); $this->viewVar['ordertype'] = $this->config->getModuleVar('article', 'default_ordertype'); $this->model->session->set('article_order', $this->config->getModuleVar('article', 'default_order')); $this->model->session->set('ordertype', $this->config->getModuleVar('article', 'default_ordertype')); } }
/** * add text * @return int id of new text */ private function addText() { $title = trim($this->httpRequest->getParameter('title', 'post', 'raw')); if (empty($title)) { $this->viewVar['error'][] = 'Title is empty'; return FALSE; } return $this->model->action('misc', 'addText', array('error' => &$this->viewVar['error'], 'fields' => array('title' => JapaCommonUtil::stripSlashes(strip_tags((string) $title)), 'status' => 1))); }
/** * add new node * * @param int $id_parent parent node of the new node */ private function addKeyword($id_parent) { $title = trim($this->httpRequest->getParameter('title', 'post', 'raw')); if (empty($title)) { $this->viewVar['error'] = 'Title is empty'; return FALSE; } return $this->model->action('keyword', 'add', array('fields' => array('title' => JapaCommonUtil::stripSlashes((string) $title), 'id_parent' => (int) $id_parent, 'status' => 1))); }
/** * add new node * * @param int $id_parent parent node of the new node */ private function addNode($id_parent) { $title = trim($this->httpRequest->getParameter('title', 'post', 'raw')); if (empty($title)) { $this->viewVar['error'] = 'Title is empty'; return FALSE; } // init id_controller $id_controller = 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_controller'))); $id_controller = $tmp['id_controller']; } $new_id_node = $this->model->action('navigation', 'addNode', array('id_parent' => (int) $id_parent, 'fields' => array('title' => JapaCommonUtil::stripSlashes((string) $title), 'id_controller' => (int) $id_controller, 'status' => 1))); // update node related content view $this->model->broadcast('newNodeContentController', array('id_parent' => (int) $id_parent, 'id_node' => (int) $new_id_node)); return $new_id_node; }
/** * reset form data * */ private function resetFormData($login_name) { $this->viewVar['login'] = $this->model->action('common', 'safeHtml', strip_tags(JapaCommonUtil::stripSlashes($login_name))); }
/** * Update node data * * @param int $rank New rank */ private function updateLink() { $fields = array('id_node' => (int) $this->current_id_node, 'status' => (int) $this->link_status, 'title' => JapaCommonUtil::stripSlashes((string) $this->link_title), 'description' => JapaCommonUtil::stripSlashes((string) $this->link_description), 'url' => JapaCommonUtil::stripSlashes((string) $this->link_url)); $this->model->action('link', 'updateLink', array('id_link' => (int) $this->id_link, 'fields' => $fields)); }
/** * Update node data * * @param int $rank New rank */ private function updateKeyword() { $this->key_status = $this->httpRequest->getParameter('status', 'post', 'int'); $this->key_description = trim($this->httpRequest->getParameter('description', 'post', 'raw')); $this->old_status = $this->httpRequest->getParameter('old_status', 'post', 'digits'); $fields = array('id_parent' => (int) $this->key_key_id_parent, 'status' => (int) $this->key_status, 'title' => JapaCommonUtil::stripSlashes((string) $this->key_title), 'description' => JapaCommonUtil::stripSlashes((string) $this->key_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) $this->key_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) $this->current_id_key, 'fields' => array('status' => (int) $fields['status']))); } elseif ($this->old_status != $this->key_status) { // updates status of subnodes $this->model->action('keyword', 'updateSubKeywords', array('id_key' => (int) $this->current_id_key, 'fields' => array('status' => (int) $fields['status']))); } $this->model->action('keyword', 'update', array('id_key' => (int) $this->current_id_key, '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("/\"/","'",JapaCommonUtil::stripSlashes( $f )); $tmp_array[] = JapaCommonUtil::stripSlashes($f); } return $tmp_array; }
/** * Update text data * * @param int $rank New rank */ private function updatetext($format) { $fields = array('status' => (int) $this->status, 'title' => JapaCommonUtil::stripSlashes(strip_tags((string) $this->title)), 'description' => JapaCommonUtil::stripSlashes((string) $this->description), 'body' => JapaCommonUtil::stripSlashes((string) $this->body)); if ($format != FALSE) { $fields['format'] = $format; } $this->model->action('misc', 'updateText', array('id_text' => (int) $this->current_id_text, 'fields' => $fields)); }
/** * reset the form fields with old link data * * @access privat */ private function resetFormData() { $this->viewVar['title'] = htmlspecialchars(JapaCommonUtil::stripSlashes((string) $this->title), ENT_COMPAT, $this->config->getModuleVar('common', 'charset')); }
/** * Rollback setup of each module * */ private function rollback() { $data = array('superuser_passwd' => JapaCommonUtil::stripSlashes($this->syspassword), 'dbtablesprefix' => JapaCommonUtil::stripSlashes($this->dbtablesprefix), 'dbhost' => JapaCommonUtil::stripSlashes($this->dbhost), 'dbport' => JapaCommonUtil::stripSlashes($this->dbport), 'dbuser' => JapaCommonUtil::stripSlashes($this->dbuser), 'dbpasswd' => JapaCommonUtil::stripSlashes($this->dbpasswd), 'dbname' => JapaCommonUtil::stripSlashes($this->dbname), 'charset' => JapaCommonUtil::stripSlashes($this->charset), 'config' => &$this->controllerVar['setup_config'], 'rollback' => TRUE); $this->model->broadcast('setup', $data); }
/** * reset the form fields with old user data * * @access privat */ private function resetFormData() { $this->viewVar['user']['role'] = $this->httpRequest->getParameter('role', 'post', 'int'); $this->viewVar['user']['status'] = $this->httpRequest->getParameter('status', 'post', 'int'); $canceledit = $this->httpRequest->getParameter('canceledit', 'post', 'digits'); $deleteuser = $this->httpRequest->getParameter('deleteuser', 'post', 'digits'); $uploadlogo = $this->httpRequest->getParameter('uploadlogo', 'post', 'alnum'); $deletelogo = $this->httpRequest->getParameter('deletelogo', 'post', 'alnum'); $uploadpicture = $this->httpRequest->getParameter('uploadpicture', 'post', 'alnum'); $imageID2del = $this->httpRequest->getParameter('imageID2del', 'post', 'raw'); $imageIDmoveUp = $this->httpRequest->getParameter('imageIDmoveUp', 'post', 'digits'); $imageIDmoveDown = $this->httpRequest->getParameter('imageIDmoveDown', 'post', 'digits'); $fileIDmoveUp = $this->httpRequest->getParameter('fileIDmoveUp', 'post', 'digits'); $fileIDmoveDown = $this->httpRequest->getParameter('fileIDmoveDown', 'post', 'digits'); $uploadfile = $this->httpRequest->getParameter('uploadfile', 'post', 'alnum'); $fileID2del = $this->httpRequest->getParameter('fileID2del', 'post', 'digits'); $pid = $this->httpRequest->getParameter('pid', 'post', 'raw'); $fid = $this->httpRequest->getParameter('fid', 'post', 'raw'); $this->viewVar['user']['email'] = $this->httpRequest->getParameter('email', 'post', 'raw'); $this->viewVar['user']['login'] = $this->httpRequest->getParameter('login', 'post', 'alnum'); $this->viewVar['user']['name'] = $this->httpRequest->getParameter('name', 'post', 'alnum'); $this->viewVar['user']['passwd'] = $this->httpRequest->getParameter('passwd', 'post', 'alnum'); $this->viewVar['user']['lastname'] = $this->httpRequest->getParameter('lastname', 'post', 'alnum'); $this->viewVar['user']['description'] = JapaCommonUtil::stripSlashes($this->httpRequest->getParameter('description', 'post', 'raw')); $this->viewVar['user']['user_gmt'] = $this->httpRequest->getParameter('user_gmt', 'post', 'int'); }
/** * reset the form fields with old link data * * @access privat */ private function resetFormData() { $this->viewVar['status'] = JapaCommonUtil::stripSlashes($this->link_status); $this->viewVar['title'] = htmlspecialchars(JapaCommonUtil::stripSlashes($this->link_title), ENT_COMPAT, $this->config->getModuleVar('common', 'charset')); $this->viewVar['url'] = htmlspecialchars(JapaCommonUtil::stripSlashes($this->link_url), ENT_COMPAT, $this->config->getModuleVar('common', 'charset')); $this->viewVar['description'] = JapaCommonUtil::stripSlashes($this->link_description); }
/** * set article field values depended on the configuration settings * */ private function addSetArticleFields(&$articleFields) { if ($this->config->getModuleVar('article', 'use_overtitle') == 1) { $overtitle = trim($this->httpRequest->getParameter('overtitle', 'post', 'raw')); $articleFields['overtitle'] = JapaCommonUtil::stripSlashes((string) $overtitle); } if ($this->config->getModuleVar('article', 'use_subtitle') == 1) { $subtitle = trim($this->httpRequest->getParameter('subtitle', 'post', 'raw')); $articleFields['subtitle'] = JapaCommonUtil::stripSlashes((string) $subtitle); } if ($this->config->getModuleVar('article', 'use_description') == 1) { $description = trim($this->httpRequest->getParameter('description', 'post', 'raw')); $articleFields['description'] = JapaCommonUtil::stripSlashes((string) $description); } if ($this->config->getModuleVar('article', 'use_header') == 1) { $header = trim($this->httpRequest->getParameter('header', 'post', 'raw')); $articleFields['header'] = JapaCommonUtil::stripSlashes((string) $header); } if ($this->config->getModuleVar('article', 'use_ps') == 1) { $ps = trim($this->httpRequest->getParameter('ps', 'post', 'raw')); $articleFields['ps'] = JapaCommonUtil::stripSlashes((string) $ps); } }
/** * init some variables * */ private function initVars() { $this->searchString = JapaCommonUtil::stripSlashes((string) $this->searchString); $this->pagerUrlSearchString = urlencode(JapaCommonUtil::stripSlashes((string) $this->searchString)); // strip bad code $this->searchString = $this->model->action('common', 'safeHtml', strip_tags($this->searchString)); // assign template variable with search string $this->viewVar['search'] = $this->searchString; $this->viewVar['formsearch'] = $this->searchString; // template array variables $this->viewVar['articles'] = array(); $this->viewVar['pager'] = ''; // set articles limit per page $this->articlesPerPage = 10; $search_page = (int) $this->httpRequest->getParameter('search_page', 'get', 'digits'); // get current article pager page if ($search_page === false) { $this->pageNumber = 1; } else { $this->pageNumber = (int) $search_page; } // view vars $this->viewVar['charset'] = $this->config->getModuleVar('common', 'charset'); $this->viewVar['loggedUserRole'] = $this->viewVar['loggedUserRole']; $this->viewVar['adminWebController'] = $this->config->getVar('default_module_application_controller'); $this->viewVar['cssFolder'] = JAPA_PUBLIC_DIR . 'styles/' . $this->config->getModuleVar('common', 'styles_folder'); $this->viewVar['urlBase'] = $this->router->getBase(); }
private function _reset_form_data($login_name) { $this->viewVar['login_name'] = htmlentities($this->strip(JapaCommonUtil::stripSlashes($login_name))); }