diff --git a/_include/include_log.php b/_include/include_log.php index df441af..c8a8ae8 100644 --- a/_include/include_log.php +++ b/_include/include_log.php @@ -1,15 +1,45 @@ num_of_rows("SELECT * FROM log ORDER BY log_date DESC;"); - +//init $previous_link = true; $next_link = true; +$logc_list_query = "SELECT * FROM log_category ORDER BY logc_title ASC"; +$logc_assoc_array = $sql->assoc_array($logc_list_query); +$log_categories = array(); + +$update = false; + +//POST DATA HANDLER +//ha létezik postolt logcategory és (nem létezik a cookie VAGY létezik de nem egyenlő az eddigivel) +if (isset($_REQUEST['log_category']) && (!isset($_COOKIE['log_category']) || (isset($_COOKIE['log_category']) && $_COOKIE['log_category'] != $_REQUEST['log_category']))) { + if ($_REQUEST['log_category'] != 'null') $condition = "WHERE log_log_category_logc_id = " . $_REQUEST['log_category']; + //beállítjuk a cookie-t, rövid élettartammal + setcookie("log_category", $_REQUEST['log_category'], time()+60*60, '/'); + $selected = $_REQUEST['log_category']; + $update = true; +} + +//COOKIE HANDLER - igazából ide kell a condition leírása +if (isset($_COOKIE['log_category']) && $_COOKIE['log_category'] != 'null' && !$update) { + $condition = "WHERE log_log_category_logc_id = " . $_COOKIE['log_category']; + $selected = $_COOKIE['log_category']; +} + + +foreach ($logc_assoc_array as $logc_array) { + $new_logc = new log_category(); + $new_logc->set_logc_data_by_id($logc_array['logc_id']); + $log_categories[] = $new_logc; +} + + if ($this->is_id()) { # LOG LIST FILTERED //50esével megyünk $from = ($this->get_id() - 1) * 50; - $log_query = "SELECT * FROM log ORDER BY log_date DESC LIMIT ".$from.",50;"; + $log_query = "SELECT * FROM log " . (isset($condition)?$condition:"") . " ORDER BY log_date DESC LIMIT ".$from.",50;"; + $log_count = $sql->num_of_rows("SELECT * FROM log ".(isset($condition)?$condition:"")." ORDER BY log_date DESC;"); //echo $log_count; if ($log_count <= $this->get_id()*50) { $next_link = false; @@ -38,6 +68,8 @@ foreach ($log_assoc_array as $log_list_array) { +$smarty->assign('selected', $selected); +$smarty->assign('logc_array', $log_categories); $smarty->assign('log_array', $log_array); $smarty->display('log.tpl'); diff --git a/_include/include_settings.php b/_include/include_settings.php index e401e21..1627141 100644 --- a/_include/include_settings.php +++ b/_include/include_settings.php @@ -33,6 +33,11 @@ if ($this->is_id()) { $smarty->assign('backups', $backups); } + elseif ($new_setting->get_setv_setting()->get_set_setting_type_st_id() == 3) { + //url -> hozzáfűzi az admin után a varcharban lévő url-t + header('Location: /admin/' . $new_setting->get_setv_varchar()); + } + $smarty->assign("setting", $new_setting); diff --git a/template/templates/log.tpl b/template/templates/log.tpl index d1f2534..9933474 100644 --- a/template/templates/log.tpl +++ b/template/templates/log.tpl @@ -1,3 +1,16 @@ +