index.php (mythreads-links_1.2.0) | : | index.php (mythreads-links_1.2.1) | ||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
{ | { | |||
global $language, $start_script_t, $start_script, $_GET, $date; | global $language, $start_script_t, $start_script, $_GET, $date; | |||
global $admin_link, $add_link, $update_link, $sug_category, $top_links; | global $admin_link, $add_link, $update_link, $sug_category, $top_links; | |||
global $new_links, $upd_links, $linkbackurl; | global $new_links, $upd_links, $linkbackurl; | |||
# dynamic template selection: | # dynamic template selection: | |||
$language = ""; | $language = ""; | |||
$start_script_t = $start_script."?"; | $start_script_t = $start_script."?"; | |||
if (isset ($_GET["tmpl"])) | if (isset ($_GET["tmpl"])) | |||
{ | { | |||
if (ereg("[a-zA-Z0-9]+", $_GET["tmpl"], $ma)) | if (preg_match("/[a-zA-Z0-9]+/", $_GET["tmpl"], $ma)) | |||
{ | { | |||
if (is_dir("./templates/$ma[0]")) | if (is_dir("./templates/$ma[0]")) | |||
{ | { | |||
$language = $ma[0]; | $language = $ma[0]; | |||
$start_script_t = $start_script."?tmpl=".$ma[0]."&"; | $start_script_t = $start_script."?tmpl=".$ma[0]."&"; | |||
} | } | |||
} | } | |||
} | } | |||
$admin_link=$start_script_t."mode=admin"; | $admin_link=$start_script_t."mode=admin"; | |||
skipping to change at line 115 | skipping to change at line 115 | |||
include("./lib/lib_main.php3"); | include("./lib/lib_main.php3"); | |||
include("./lib/lib_image.php3"); | include("./lib/lib_image.php3"); | |||
global $tpl, $allow, $_GET, $_COOKIE, $_POST, $admin_username, $admin_pas sword,$add_link,$sug_category; | global $tpl, $allow, $_GET, $_COOKIE, $_POST, $admin_username, $admin_pas sword,$add_link,$sug_category; | |||
global $config; | global $config; | |||
# Do not report uninitialized variables | # Do not report uninitialized variables | |||
error_reporting (E_ERROR | E_WARNING | E_PARSE); | error_reporting (E_ERROR | E_WARNING | E_PARSE); | |||
#error_reporting(E_ALL); | #error_reporting(E_ALL); | |||
# Disable magic_quotes_runtime | # Disable magic_quotes_runtime | |||
set_magic_quotes_runtime(0); | if(version_compare(PHP_VERSION, '5.3.0', '<')) { | |||
set_magic_quotes_runtime(0); | ||||
} | ||||
$categories = ""; | $categories = ""; | |||
if( !get_magic_quotes_gpc() ) | if( !get_magic_quotes_gpc() ) | |||
{ | { | |||
if( is_array($_GET) ) | if( is_array($_GET) ) | |||
{ | { | |||
while( list($k, $v) = each($_GET) ) | while( list($k, $v) = each($_GET) ) | |||
{ | { | |||
if( is_array($_GET[$k]) ) | if( is_array($_GET[$k]) ) | |||
{ | { | |||
skipping to change at line 195 | skipping to change at line 197 | |||
if (isset ($_GET["mode"])) | if (isset ($_GET["mode"])) | |||
{ | { | |||
if ($_GET["mode"] == 'search') | if ($_GET["mode"] == 'search') | |||
{ | { | |||
include("./lib/lib_search.php3"); | include("./lib/lib_search.php3"); | |||
} | } | |||
else if (isset($_POST["sorry_go_back"]) && $_POST["sorry_go_back" ] != '') | else if (isset($_POST["sorry_go_back"]) && $_POST["sorry_go_back" ] != '') | |||
{ | { | |||
showMainPage(); | showMainPage(); | |||
} | } | |||
else if (eregi("(add_link|update_link|add_category)",$_GET["mode" ])) | else if (preg_match("/(add_link|update_link|add_category)/i",$_GE T["mode"])) | |||
{ | { | |||
include("./lib/lib_addupdate.php3"); | include("./lib/lib_addupdate.php3"); | |||
} | } | |||
else if ($_GET["mode"] == 'admin') | else if ($_GET["mode"] == 'admin') | |||
{ | { | |||
include("./lib/lib_rdf.php3"); | include("./lib/lib_rdf.php3"); | |||
include("./lib/lib_admin.php3"); | include("./lib/lib_admin.php3"); | |||
} | } | |||
else { | else { | |||
showMainPage(); | showMainPage(); | |||
skipping to change at line 249 | skipping to change at line 251 | |||
$category_links = showMore(intval($_GET["more"]), $your_c urrent_location); | $category_links = showMore(intval($_GET["more"]), $your_c urrent_location); | |||
} | } | |||
else | else | |||
{ | { | |||
$categories = viewPage(intval($_GET["category"])); | $categories = viewPage(intval($_GET["category"])); | |||
$your_current_location = display_category(intval($_GET["c ategory"])); | $your_current_location = display_category(intval($_GET["c ategory"])); | |||
$category_links = display_category_links(intval($_GET["ca tegory"]), intval($_GET["view"])); | $category_links = display_category_links(intval($_GET["ca tegory"]), intval($_GET["view"])); | |||
} | } | |||
# remove html tags (useful for headings, title) | # remove html tags (useful for headings, title) | |||
$your_current_location2 = ereg_replace("<[^>]+>", "", $your_curre nt_location); | $your_current_location2 = preg_replace("/<[^>]+>/", "", $your_cur rent_location); | |||
# Sets a few variables before we parse the HTML template | # Sets a few variables before we parse the HTML template | |||
$tpl->set_var( array( | $tpl->set_var( array( | |||
"ADD_LINK" => $add_link."&category=".intval($_GET['catego ry']), | "ADD_LINK" => $add_link."&category=".intval($_GET['catego ry']), | |||
"SUG_CATEGORY" => $sug_category."&category=".intval($_GET ['category']), | "SUG_CATEGORY" => $sug_category."&category=".intval($_GET ['category']), | |||
"SUB_CATEGORIES" => $categories, | "SUB_CATEGORIES" => $categories, | |||
"CATEGORY_LINKS" => $category_links, | "CATEGORY_LINKS" => $category_links, | |||
"HEAD_INFO" => $your_current_location2, | "HEAD_INFO" => $your_current_location2, | |||
"INFO" => $your_current_location | "INFO" => $your_current_location | |||
)); | )); | |||
skipping to change at line 274 | skipping to change at line 276 | |||
else { | else { | |||
showMainPage(); | showMainPage(); | |||
} | } | |||
} # End Main Function | } # End Main Function | |||
function DatabaseConnect() | function DatabaseConnect() | |||
{ | { | |||
global $database, $host, $username, $password, $config, $mylink; | global $database, $host, $username, $password, $config, $mylink; | |||
if ($config["use_pconnect"] == 1) { | $mylink = mysqli_connect( $host, $username, $password); | |||
$mylink = mysql_pconnect( $host, $username, $password); | ||||
} else { | ||||
$mylink = mysql_connect( $host, $username, $password); | ||||
} | ||||
if (!$mylink) | if (!$mylink) | |||
{ | { | |||
print "<h3>could not connect to database</h3>\n"; | print "<h3>could not connect to database</h3>\n"; | |||
exit; | exit; | |||
} | } | |||
if(!mysql_select_db($database)) { | if(!$mylink->select_db($database)) { | |||
print "<h3>Not connected : " . mysql_error(). "<h3>"; | print "<h3>Not connected : " . $mylink->error(). "<h3>"; | |||
} | } | |||
mysql_query("SET NAMES 'utf8'"); | $mylink->query("SET NAMES 'utf8'"); | |||
} | } | |||
function showStartTemplate() | function showStartTemplate() | |||
{ | { | |||
global $tpl; | global $tpl; | |||
if (getuser() == "admin") { | if (getuser() == "admin") { | |||
$tpl->set_var("INFO", $tpl->get_var("INFO")." (".getuser().")"); | $tpl->set_var("INFO", $tpl->get_var("INFO")." (".getuser().")"); | |||
} | } | |||
$tpl->parse("MyOutput", "start"); | $tpl->parse("MyOutput", "start"); | |||
End of changes. 7 change blocks. | ||||
12 lines changed or deleted | 10 lines changed or added |