From bca13f62104244246a11d5189802c993228d3911 Mon Sep 17 00:00:00 2001 From: pioder Date: Sun, 16 Aug 2009 11:25:34 +0000 Subject: [PATCH] Dodana funkcja Przekieruj() Dodany szkietet panelu administracyjnego Poprawki w init.php dla PA git-svn-id: https://svn.pioder.pl/sg-svn@18 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8 --- robocze/admin/gallery_item_add.php | 8 ++ robocze/admin/gallery_item_delete.php | 8 ++ robocze/admin/gallery_item_edit.php | 8 ++ robocze/admin/gallery_view.php | 8 ++ robocze/admin/index.php | 147 ++++++++++++++++++++++ robocze/admin/login.php | 8 ++ robocze/admin/user_add.php | 8 ++ robocze/admin/user_delete.php | 8 ++ robocze/admin/user_edit.php | 8 ++ robocze/admin/users_list.php | 8 ++ robocze/functions.php | 171 ++++++++++++++------------ robocze/init.php | 20 ++- 12 files changed, 330 insertions(+), 80 deletions(-) create mode 100644 robocze/admin/gallery_item_add.php create mode 100644 robocze/admin/gallery_item_delete.php create mode 100644 robocze/admin/gallery_item_edit.php create mode 100644 robocze/admin/gallery_view.php create mode 100644 robocze/admin/index.php create mode 100644 robocze/admin/login.php create mode 100644 robocze/admin/user_add.php create mode 100644 robocze/admin/user_delete.php create mode 100644 robocze/admin/user_edit.php create mode 100644 robocze/admin/users_list.php diff --git a/robocze/admin/gallery_item_add.php b/robocze/admin/gallery_item_add.php new file mode 100644 index 0000000..617a44c --- /dev/null +++ b/robocze/admin/gallery_item_add.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/admin/gallery_item_delete.php b/robocze/admin/gallery_item_delete.php new file mode 100644 index 0000000..545975d --- /dev/null +++ b/robocze/admin/gallery_item_delete.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/admin/gallery_item_edit.php b/robocze/admin/gallery_item_edit.php new file mode 100644 index 0000000..8eb8a48 --- /dev/null +++ b/robocze/admin/gallery_item_edit.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/admin/gallery_view.php b/robocze/admin/gallery_view.php new file mode 100644 index 0000000..edfdc48 --- /dev/null +++ b/robocze/admin/gallery_view.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/admin/index.php b/robocze/admin/index.php new file mode 100644 index 0000000..35474bb --- /dev/null +++ b/robocze/admin/index.php @@ -0,0 +1,147 @@ + \ No newline at end of file diff --git a/robocze/admin/login.php b/robocze/admin/login.php new file mode 100644 index 0000000..a2ef64d --- /dev/null +++ b/robocze/admin/login.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/admin/user_add.php b/robocze/admin/user_add.php new file mode 100644 index 0000000..72d31c5 --- /dev/null +++ b/robocze/admin/user_add.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/admin/user_delete.php b/robocze/admin/user_delete.php new file mode 100644 index 0000000..cc35486 --- /dev/null +++ b/robocze/admin/user_delete.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/admin/user_edit.php b/robocze/admin/user_edit.php new file mode 100644 index 0000000..fcf0641 --- /dev/null +++ b/robocze/admin/user_edit.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/admin/users_list.php b/robocze/admin/users_list.php new file mode 100644 index 0000000..4e3b9f9 --- /dev/null +++ b/robocze/admin/users_list.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/robocze/functions.php b/robocze/functions.php index 43b886c..3ace72f 100644 --- a/robocze/functions.php +++ b/robocze/functions.php @@ -1,81 +1,96 @@ - -* @link http://suczawa.ath.cx/ -**/ + +* @link http://suczawa.ath.cx/ +**/ $xhtml=true; - -#wyświetl błąd -function blad($msg) -{ - die(' -

Blad Galerii Zdjec Suczawa 2009!

- '.$msg.''); -} - -function NaglowekXHTML() + +#wyświetl błąd +function blad($msg) +{ + die(' +

Blad Galerii Zdjec Suczawa 2009!

+ '.$msg.''); +} + +function NaglowekXHTML() +{ + global $xhtml; + $xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i', + $_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 || + strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || + strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false; + + header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround + + echo ''; +} + +function GenerujListeStron() +{ + global $cnt; + global $page; + $content = ''; + + if ($page>1) + { + $content .= '«'; + $content .= '  < '; + } + + #wygeneruj strony + for ($i=1;$i<=$cnt;$i++) + { + if ($i==$page) + { + if ($i == $cnt) + { + $content .= ''.$i.''; + } + else + { + $content .= ''.$i.''.' | '; + } + } + else + { + if ($i == $cnt) + { + $content .= ''.$i.' '; + } + else + { + $content .= ''.$i.' | '; + } + } + } + #dodaj linka "+1 strona" oraz do ostatniej + if ($page<$cnt) + { + $content .= '>'; + $content .= '  »'; + } + + #dodaj linka do ostatniej strony + echo $content; +} + +function Przekieruj($url='index.php', $tresc='') { - global $xhtml; - $xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i', - $_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 || - strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || - strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false; - - header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround - - echo ''; -} - -function GenerujListeStron() -{ - global $cnt; - global $page; - $content = ''; - - if ($page>1) - { - $content .= '«'; - $content .= '  < '; - } - - #wygeneruj strony - for ($i=1;$i<=$cnt;$i++) - { - if ($i==$page) - { - if ($i == $cnt) - { - $content .= ''.$i.''; - } - else - { - $content .= ''.$i.''.' | '; - } - } - else - { - if ($i == $cnt) - { - $content .= ''.$i.' '; - } - else - { - $content .= ''.$i.' | '; - } - } - } - #dodaj linka "+1 strona" oraz do ostatniej - if ($page<$cnt) - { - $content .= '>'; - $content .= '  »'; - } - - #dodaj linka do ostatniej strony - echo $content; -} -?> + if ($tresc!='') + { + die(' + + + '.$tresc); + } + else + { + die(''); + } +} +?> diff --git a/robocze/init.php b/robocze/init.php index 8c6be3b..46c4cc0 100644 --- a/robocze/init.php +++ b/robocze/init.php @@ -6,8 +6,16 @@ **/ #dołącz plik konfiguracyjny oraz funkcje -require_once('./config.php'); -require_once('./functions.php'); +if (defined('IN_ACP')) +{ + require_once('./../config.php'); + require_once('./../functions.php'); +} +else +{ + require_once('./config.php'); + require_once('./functions.php'); +} #sprawdź, czy jest wyłączone register globals oraz magic quotes? if (ini_get('register_globals') == 1) @@ -24,6 +32,14 @@ if (get_magic_quotes_gpc()) blad('Prosze wylaczyc magic_quotes_gpc w php.ini!'); } +ini_set('session.cookie_lifetime', 259200); #expire time - 1 month + +session_start(); #starting session +if (empty($_SESSION['logged'])) +{ + $_SESSSION['logged'] = false; +} + $DB = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); #connect with the database if ($DB->connect_error)