Error_Reporting(4);
//////////////////////////////////////
function stripslashes_array($data) {
if (is_array($data)){
foreach ($data as $key => $value){
$data[$key] = stripslashes_array($value);
}
return $data;
}else{
return stripslashes($data);
}
}
////////////////////////////////
set_magic_quotes_runtime(0);
if (get_magic_quotes_gpc()) {
$_SERVER = stripslashes_array($_SERVER);
$_GET = stripslashes_array($_GET);
$_POST = stripslashes_array($_POST);
$_COOKIE = stripslashes_array($_COOKIE);
$_FILES = stripslashes_array($_FILES);
$_ENV = stripslashes_array($_ENV);
$_REQUEST = stripslashes_array($_REQUEST);
$HTTP_SERVER_VARS = stripslashes_array($HTTP_SERVER_VARS);
$HTTP_GET_VARS = stripslashes_array($HTTP_GET_VARS);
$HTTP_POST_VARS = stripslashes_array($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = stripslashes_array($HTTP_COOKIE_VARS);
$HTTP_POST_FILES = stripslashes_array($HTTP_POST_FILES);
$HTTP_ENV_VARS = stripslashes_array($HTTP_ENV_VARS);
if (isset($_SESSION)) {
$_SESSION = stripslashes_array($_SESSION, '');
$HTTP_SESSION_VARS = stripslashes_array($HTTP_SESSION_VARS, '');
}
}
define("BD","mindwil8_alehypnosis");
define("HostName","localhost");
#define("HostName","remotemysqlhost");
define("UserName","mindwil8_ale");
define("Password","isis77");
$INFO["ROOT_ADMIN"] = "/home/mindwil8/public_html/hypnosis/hypnosislinks/admin";
$INFO["ROOT_DIR"] = "/home/mindwil8/public_html/hypnosis/hypnosislinks";
$INFO["ROOT"] = "/home/mindwil8/public_html/hypnosis";
$INFO["HOST"] = "hypnosis.mind-sync.com";
$INFO["URL_ADMIN"] = "http://hypnosis.mind-sync.com/hypnosislinks/admin";
$INFO["URL_DIR"] = "http://hypnosis.mind-sync.com/hypnosislinks";
$INFO["URL_ADDLINK"] = "http://hypnosis.mind-sync.com/hypnosislinks/admin/add_link.php";
@mysql_connect(HostName,UserName,Password) or
die( "Unable to connect to SQL server");
@mysql_select_db(BD) or
die("Unable to select database");
?>
function get_category_path($url){ global $INFO; $setup_main = get_main_settings(); $setup_dir = get_dir_settings(); $setup_cat = get_cat_settings(); $sql = "SELECT page, category_id FROM links_links ". "WHERE url = '".$url."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); $page = $f['page']; if($f['category_id'] == 0 ) $f['file_name'] = 'index'; else { $sql = "SELECT file_name FROM links_cat ". "WHERE id = '".$f['category_id']."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); } $file_path = str_replace(" ", ($setup_dir['filename_separator'] == 'hyphen' ? '-' : '_'), $f['file_name']).($page > 0 ? $page : '').".".$setup_main['file_extension']; if($f['file_name'] != 'index') switch ($setup_dir['filename_display']) { case 'upper': $file_path = strtoupper($file_path); break; case 'lower': $file_path = strtolower($file_path); break; } return $INFO["URL_DIR"]."/".$file_path; } function get_category_path1($cat_id, $page) { global $INFO; $setup_main = get_main_settings(); $setup_dir = get_dir_settings(); $setup_cat = get_cat_settings(); if ( 0 == $cat_id ) $f['file_name'] = 'index'; else { $sql = "SELECT file_name FROM links_cat ". "WHERE id = '".$cat_id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); } $file_path = str_replace(" ", ($setup_dir['filename_separator'] == 'hyphen' ? '-' : '_'), $f['file_name']).($page > 0 ? $page : '').".".$setup_main['file_extension']; if ( $f['file_name'] != 'index' ) switch ($setup_dir['filename_display']) { case 'upper': $file_path = strtoupper($file_path); break; case 'lower': $file_path = strtolower($file_path); break; } return $INFO["URL_DIR"]."/".$file_path; } function select_cat($id=0, $pid=0, $space="", $select=0){ $res = ''; $sql = "SELECT id, name FROM links_cat WHERE id<>'".$id."' AND p_id='".$pid."' ORDER BY position_"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); for ($i = 0; $i < mysql_num_rows($result); $i++) { $f = mysql_fetch_array($result); if($f['id'] == $select) $res .= "".select_cat($id, $f['id'], $space." ", $select); else $res .= "".select_cat($id, $f['id'], $space." ", $select);; } return $res; } function move_cat($id=0, $p_id=0, $prev="", $n_id=0){ $res = ''; $sql = "SELECT * FROM links_cat WHERE p_id='".$p_id."' AND id<>'".$n_id."' ORDER BY position_"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); for ($i=0; $i".$prev.$f['name']."".move_cat($id, $f['id'], $prev." ", $n_id); } return $res; } function get_tree($id, $id_){ $sql = "SELECT id, p_id, name FROM links_cat WHERE id = '".$id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); if(mysql_numrows($result)) { $f = mysql_fetch_array($result); return get_tree($f['p_id'], $id_)." :: ".($id == $id_ ? $f['name'] : "".$f['name'].""); } return ""; } function count_subcategories($id, $count=0){ $sql = "SELECT id FROM links_cat WHERE p_id='".$id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); for ($i=0; $i '0'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); return $f[0]; } function count_categories(){ $sql = "SELECT COUNT(id) FROM links_cat WHERE p_id = '0'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); return $f[0]; } function delete_category($id) { $sql= "SELECT id FROM links_cat WHERE p_id='".$id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); for($i = 0; $i < mysql_numrows($result); $i++) { $f = mysql_fetch_array($result); delete_category($f['id']); } $sql= "DELETE FROM links_cat where id='".$id."'"; (mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); } function update_position_del($id){ $sql = "SELECT p_id, position_ FROM links_cat ". "WHERE id = '".$id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); $sql = "UPDATE links_cat ". "SET position_ = position_-1 ". "WHERE p_id='".$f['p_id']."' AND position_ > '".$f['position_']."'"; (mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); } function get_upper_category($id){ $sql = "SELECT p_id FROM links_cat ". "WHERE id = '".$id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); return $f['p_id']; } function get_max_position($id){ $sql = "SELECT max(position_) FROM links_cat ". "WHERE p_id = '".$id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); return $f[0]; } function get_category_name($id){ $sql = "SELECT name FROM links_cat ". "WHERE id = '".$id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); return $f['name']; } function get_category($id){ $sql = "SELECT * FROM links_cat ". "WHERE id = '".$id."'"; ($result = mysql_query($sql)) or die ($sql . ' : ' . mysql_error()); $f = mysql_fetch_array($result); return $f; } ?> class Macros { var $template_name; var $items; var $content; var $tpl; function define($fname) { if (is_file($fname)) { $this->template_name = $fname; return 1; } else { $this->template_name = ""; return 0; } } function define1($html) { if(isset($html)) { $this->tpl = $html; return 1; } else { $this->tpl = ''; return 0; } } function assign($array) { if (!$array) return; reset($array); while (key($array)) { $this->items[key($array)] = $array[key($array)]; next($array); } } function parse1($mode) { $fc = $this->tpl; if ((!$this->items) and (!$mode)) { $fc = preg_replace("/%.*%/", "", $fc); $this->content = $fc; return; } reset($this->items); while (key($this->items)) { $fc = str_replace("%".key($this->items)."%", $this->items[key($this->items)], $fc); next($this->items); } if (!$mode) $fc = preg_replace("/%.*?%/", "", $fc); $this->content = $fc; return; } function parse($mode) { if (!$this->template_name) { $this->content = ""; return; } $fl = fopen($this->template_name,"r"); $fc = fread($fl, filesize($this->template_name)); fclose($fl); if ((!$this->items) and (!$mode)) { $fc = preg_replace("/%.*%/", "", $fc); $this->content = $fc; return; } reset($this->items); while (key($this->items)) { $fc = str_replace("%".key($this->items)."%", $this->items[key($this->items)], $fc); next($this->items); } if (!$mode) $fc = preg_replace("/%.*?%/", "", $fc); $this->content = $fc; return; } function fetch() { return $this->content; } function reset() { unset($this->template_name); unset($this->items); unset($this->content); unset($this->tpl); } } ?> class Template { var $template_name; var $items; var $content; function define($fname) { if (is_file($fname)) { $this->template_name = $fname; return 1; } else { $this->template_name = ""; return 0; } } function assign($array) { if (!$array) return; reset($array); while (key($array)) { $this->items[key($array)] = $array[key($array)]; next($array); } } function parse($mode) { if (!$this->template_name) { $this->content = ""; return; } $fl = fopen($this->template_name,"r"); $fc = fread($fl, filesize($this->template_name)); fclose($fl); if ((!$this->items) and (!$mode)) { $fc = preg_replace("/