function make_clean(&$var, $gpc = false)
{
    if (is_array($var)) {
        foreach ($var as $key => $val) {
            make_clean($var[$key], $gpc);
        }
    } else {
        if ($gpc) {
            $var = stripslashes($var);
        }
        if (!isset($_SERVER['SCRIPT_FILENAME']) || basename($_SERVER['SCRIPT_FILENAME']) != 'tiki-admin.php') {
            $var = RemoveXSS($var);
        }
    }
}
Exemplo n.º 2
0
 $msg = '';
 if (isset($_REQUEST['save']) && $prefs['feature_contribution'] == 'y' && $prefs['feature_contribution_mandatory'] == 'y' && (empty($_REQUEST['contributions']) || count($_REQUEST['contributions']) <= 0)) {
     $contribution_needed = true;
     $smarty->assign('contribution_needed', 'y');
 } else {
     $contribution_needed = false;
 }
 if (isset($_REQUEST['save']) && $prefs['feature_categories'] == 'y' && $prefs['feature_wiki_mandatory_category'] >= 0 && (empty($_REQUEST['cat_categories']) || count($_REQUEST['cat_categories']) <= 0)) {
     $category_needed = true;
     $smarty->assign('category_needed', 'y');
 } else {
     $category_needed = false;
 }
 if (isset($_REQUEST["save"]) && !$category_needed && !$contribution_needed) {
     if (strtolower($pagename) != 'sandbox' || $tiki_p_admin == 'y') {
         make_clean($description);
         if ($tikilib->page_exists($pagename)) {
             if ($prefs['feature_multilingual'] == 'y') {
                 $info = $tikilib->get_page_info($pagename);
                 if ($info['lang'] != $pageLang) {
                     include_once "lib/multilingual/multilinguallib.php";
                     if ($multilinguallib->updatePageLang('wiki page', $info['page_id'], $pageLang, true)) {
                         $pageLang = $info['lang'];
                         $smarty->assign('msg', tra("The language can't be changed as its set of translations has already this language"));
                         $smarty->display("error.tpl");
                         die;
                     }
                 }
             }
             $tikilib->update_page($pagename, $part["body"], tra('page imported'), $author, $authorid, $description, null, $pageLang, false, $hash);
         } else {
Exemplo n.º 3
0
 function dir_replace_site($siteId, $name, $description, $url, $country, $isValid)
 {
     global $cachepages;
     make_clean($name);
     make_clean($description);
     make_clean($url);
     make_clean($country);
     $now = date("U");
     if ($siteId) {
         $query = "update `tiki_directory_sites` set `name`=?, `description`=?, `url`=?, `country`=?, `isValid`=?, `lastModif`=?  where `siteId`=?";
         $this->query($query, array($name, $description, $url, $country, $isValid, (int) $now, (int) $siteId));
         return $siteId;
     } else {
         $query = "insert into `tiki_directory_sites`(`name`,`description`,`url`,`country`,`isValid`,`hits`,`created`,`lastModif`) values(?,?,?,?,?,?,?,?)";
         $this->query($query, array($name, $description, $url, $country, $isValid, 0, (int) $now, (int) $now));
         $siteId = $this->db->getOne("select max(siteId) from `tiki_directory_sites` where `created`=? and `name`=?", array((int) $now, $name));
         if ($cachepages == 'y') {
             $this->cache_url($url);
         }
         return $siteId;
     }
     // Now try to cache the site
 }
Exemplo n.º 4
0
 function dir_replace_site($siteId, $name, $description, $url, $country, $isValid)
 {
     global $prefs;
     make_clean($name);
     make_clean($description);
     make_clean($url);
     make_clean($country);
     if ($siteId) {
         $query = "update `tiki_directory_sites` set `name`=?, `description`=?, `url`=?, `country`=?, `isValid`=?, `lastModif`=?  where `siteId`=?";
         $this->query($query, array($name, $description, $url, $country, $isValid, (int) $this->now, (int) $siteId));
     } else {
         $query = "insert into `tiki_directory_sites`(`name`,`description`,`url`,`country`,`isValid`,`hits`,`created`,`lastModif`) values(?,?,?,?,?,?,?,?)";
         $this->query($query, array($name, $description, $url, $country, $isValid, 0, (int) $this->now, (int) $this->now));
         $siteId = $this->db->getOne("select max(siteId) from `tiki_directory_sites` where `created`=? and `name`=?", array((int) $this->now, $name));
         if ($prefs['cachepages'] == 'y') {
             $this->cache_url($url);
         }
     }
     if ($prefs['feature_search'] == 'y' && $prefs['feature_search_fulltext'] != 'y' && $prefs['search_refresh_index_mode'] == 'normal') {
         require_once 'lib/search/refresh-functions.php';
         refresh_index('directory_sites', $siteId);
     }
     return $siteId;
 }