Powrót do listy

'; $msg .= $msg_text; $msg .= '
'; echo $msg; foother(); exit; } function foother() { echo '

camel © 2006-2008 | Powered by txtStaticPages v 0.5a'; echo ''; } function form($fTitle = false, $fName = false, $fContent = false, $fButton = 'Utwórz stronę', $fAction = 'read.php?s=add') { echo '
Tytuł strony:


Nazwa linku (read.php?s="nazwa"). Tylko małe litery, cyfry i "_", bez spacji i polskich znaków:


Treść strony (można używać html):


'; } $new_title = $_POST['title']; $new_link_name = $_POST['link_name']; $new_content = $_POST['content']; echo 'txtStaticPages'; echo '

txtStaticPages - by camel

'; if ($_GET['del']) { $delFile = $path.$_GET['del'].$ex; if ( file_exists($delFile) ) { unlink($delFile); msg('Strona zostala skasowana'); } else { msg('Plik '.$_GET['del'].$ex.' nie istnieje'); } exit; } if(!$_GET['s']) { echo '» Dodaj nowa strone
'; @$dir = opendir($path); if (!$dir) { msg('Nie moge otworzyc katalogu', 1); } while ( $files = readdir($dir) ) { $fileEx = strtolower(strrchr($files, ".")); if($fileEx == $ex) { $fileslist[] = $files; } } echo ''; } elseif ($_GET['s'] == 'add') { echo '« Powrót do listy

'; if (isset($new_title) OR isset($new_link_name) OR isset($new_content)) { if ($new_title == '' OR $new_link_name == '' OR $new_content == '') { echo '« Dodaj nowa strone

'; msg ('Nie wypelniles wszystkich pól', 1); } elseif ( file_exists($path.$new_link_name.$ex) ) { echo '« Dodaj nowa strone

'; msg ('Strona o takiej nazwie juz instnieje', 1); } else { //$tmpfname = tempnam($_ENV["DOCUMENT_ROOT"]."/$path", "FOO"); DEL 3.06.06 $tmpfname = tempnam("$path", "FOO"); $handle = fopen($tmpfname, "w+"); $writing = $new_title."||".$new_content; fwrite($handle, $writing); fclose($handle); ///echo($_ENV["DOCUMENT_ROOT"]); copy($tmpfname, $path.$new_link_name.$ex); chmod($path.$new_link_name.$ex, 0755); if (file_exists($path.$new_link_name.$ex)) { @unlink($tmpfname); msg ('Strona zostala zapisana', 1); } else { msg ('Wystapil blad podczas dodawania', 1); } } } else { echo 'Dodaj strone:

'; form(); } } else { if (file_exists($path.$_GET['s'].$ex)) { $open = fopen($path.$_GET['s'].$ex, "r+"); $dane = fread($open, filesize($path.$_GET['s'].$ex)); } else { msg('Taka strona nie istnieje'); } echo '« Powrót do listy

'; $title = explode( "||", $dane ); $filename = $_GET['s']; //$text = nl2br($title[1]); $text = $title[1]; fclose($open); if(isset($_GET['mode']) AND $_GET['mode'] == 'edit') { if ( !isset($_POST['save']) ) { form(stripslashes($title[0]), $filename, $text, 'Zapisz', ''); } else { //$modOpen = fopen($path.$_GET['s'].$ex, "r+"); $open = fopen($path.$filename.$ex, "w+"); $writing = $new_title."||".$new_content; if (fwrite($open, $writing) === FALSE) { msg ('Nie mozna bylo zmodyfikowac strony [1]', 1); exit; } else fclose($open); //fwrite($modOpen, $writing); DEL 3.06.06 //fclose($modOpen); if ($new_link_name != $filename) { if (file_exists($path.$filename.$ex)) { copy($path.$filename.$ex, $path.$new_link_name.$ex); unlink($path.$filename.$ex); } else msg ('Nie mozna bylo zmodyfikowac strony [2]', 1); } msg ('Strona zostala zmodyfikowana', 1); } } else { echo 'Tytuł: '.stripslashes($title[0]).'
'; echo 'Nazwa pliku: '.$filename.$ex.'

'; echo '
Tresc strony'.nl2br($text).'
'; } } foother(); ?>