Размер файла: 18.12Kb
<?php
include("minicms/lang.inc.php");
include("minicms/config_bd.php");
include("minicms/config.php");
Error_Reporting(E_ALL & ~E_NOTICE); /////////////// èãíîðèðóåì îøèáêè
header("Content-type:text/vnd.wap.wml;charset=utf-8"); //////// òèï è êîäèðîâêà äîêóìåíòà
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">
<wml><card id=\"mas\" title=\"AdminPL\"><p>";
///////////// âûâîäèì âìë çàãîëîâîê
$par=trim($par);
$adpar=trim($adpar);
if($par!=$adpar) {print"Вы не ввели пароль, либо вы ввели неверный пароль.
<br/>";}
////////////////////adminManagrR/////////////////////////////////////////////////////////// ////////
else{
if($st=="managr"){
echo "<img src=\"stl/wml_cms.gif\" alt=\"Admin\"/><br/>";
$max_files = 5;
if(isset($_GET['from']))
$from = $_GET['from'];
else
$from = 0;
$to = $from + $max_files;
$n = 0;
$files = '';
if ($handle = opendir("inc/"))
{
while (false !== ($file = readdir($handle)))
{
if($file != '.' && $file != '..' && $file != 'files')
{
$filesize = filesize("inc/$file");
if($n >= $from && $n < $to)
$files .= '<a href="manager.php?st=manview&par=' . $par . '&page=' . $file . '">' . $file . '(' . $filesize . ' byte)</a><br/>';
$n++;
}
}
closedir($handle);
}
if($n > $to )
$files .= <<<FILEDATA
<a href="manager.php?st=managr&par=$par&from=$to">Далее</a>
<br/>
FILEDATA;
$back_from = $from - $max_files;
if($from > 0)
$files .= <<<FILEDATA
<a href="manager.php?st=managr&par=$par&from=$back_from">Назад</a>
<br/>
FILEDATA;
?>
Всего файлов:<?php echo $n; ?>
<br/>
<?php echo $files; ?>
</p>
<p align="center">
*********<br/>
<a href="manager.php?st=edittitle&par=<?php echo $par; ?>&page=index.wml&cp=go">Добавить страницу</a><br/>
<?php
}
///////////////////////////////MngerVIEW///////////////////////////////////////////////////////////
if($st=="manview") {print"СТРАНИЦА<br/>";
if(preg_match('/[^\w\.]/', $_GET['page']) || (isset($_POST['pagename']) && preg_match('/[^\w\.]/', $_POST['pagename'])))
{
?>
Неправильное имя страницы
<?php
exit;
}
if(isset($_GET['action']) && $_GET['action'] == 'rename')
{
rename("inc/$_GET[page]", "inc/$_POST[pagename]");
$_GET['page'] = $_POST['pagename'];
}
if(isset($_GET['action']) && $_GET['action'] == 'delete')
{
unlink("inc/$_GET[page]");
?>
Страница удалена<br/>
<a href="admin.php?par=$par&st=amPL">Админ панель</a>
<?php
exit;
}
?>
name:<?php echo $_GET['page']?>, size:<?php echo filesize("inc/" . addslashes($_GET['page'])); ?> byte
<br/>*********<br/>
<a href="edit.php?par=<?php echo $par; ?>&page=<?php echo $_GET['page']; ?>">Редактировать</a><br/>
*********<br/>
<b>Переименовать</b><br/>
Имя страницы(без wml):<br/>
<input name="pagename" type="text" maxlength="20" value="<?php echo preg_replace('/\..*?$/',"", $_GET['page']); ?>" title="page"/><br/>
<anchor title="go">Ok<go href="manager.php?st=manview&par=<?php echo $par; ?>&page=<?php echo $_GET['page']; ?>&action=rename" method="post">
<postfield name="pagename" value="$(pagename).wml"/>
</go></anchor><br/>
*********<br/>
<a href="manager.php?st=manview&par=<?php echo $par; ?>&page=<?php echo $_GET['page']; ?>&action=delete">Удалить</a><br/>
*********<br/>
<a href="manager.php?st=managr&par=<?php echo $par; ?>">К списку</a><br/>
<?php
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////adminManagrR//////////////////////////////////////////////////////////////
if($st=="edittext") {print"Редактор!<br/>";
$contents = file("inc/" . addslashes($_GET['page']));
echo htmlspecialchars($contents[(int)$_GET['i']]);//echo htmlentities($contents[(int)$_GET['i']]); ?><br/>
<a href="manager.php?par=<?php echo $par; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>&i=<?php echo $_GET['i']; ?>&st=menudelt">Удaлить</a><br/>
*********<br/>
Добавить<br/>
Teкcт:<br/>
<input name="text" emptyok="true" value="" title="text"/><br/>
URL:<br/>
<input name="link" emptyok="true" maxlength="150" value="http://" title="link"/><br/>
Кapтинкa:<br/>
<input name="picture" emptyok="true" maxlength="150" value="http://" title="picture"/><br/>
Coздaть кaк:<br/>
<select name="action">
<option value="link">Линк</option>
<option value="linkb">Жирный линк</option>
<option value="linki">Курсивный линк</option>
<option value="linku">Подчеркнутый линк</option>
<option value="links">Малый линк</option>
<option value="text">Teкcт</option>
<option value="textb">Жирный текст</option>
<option value="texti">Курсивный текст</option>
<option value="textu">Подчеркнутый</option>
<option value="texts">Малый текст</option>
<option value="picture">Кapтинкa</option>
<option value="urlpict">Линк в кapтинкe</option>
<option value="br"><br/></option>
<option value="left">align=left</option>
<option value="center">align=center</option>
<option value="right">align=right</option>
</select><br/>
Aвтo<br/>:<br/>
<select name="abr">
<option value="yes">Дa</option>
<option value="no">Нeт</option>
</select><br/>
Pacпoлoжeниe:<br/>
<select name="location">
<option value="below">Hиже</option>
<option value="rewrite">Пepeзaпиcь</option>
<option value="above">Вышe</option>
</select><br/>
Резать теги:<br/>
<select name="strip">
<option value="yes">Да</option>
<option value="no">Нет</option>
</select><br/>
<anchor title="go">OK<go href="manager.php?st=menuandd&par=<?php echo $par; ?>&page=<?php echo $_GET['page']; ?>&i=<?php echo $_GET['i']; ?>" method="post">
<postfield name="action" value="$(action)"/>
<postfield name="location" value="$(location)"/>
<postfield name="abr" value="$(abr)"/>
<postfield name="text" value="$(text)"/>
<postfield name="link" value="$(link)"/>
<postfield name="picture" value="$(picture)"/>
<postfield name="strip" value="$(strip)"/>
</go></anchor><br/>
<br/>
<?php
}
////////////////////////////////adminManagrR DEL//////////////////////////////////////////////////////
if($st=="menudelt") {print"Удaлино!! Удачно!<br/>";
if($_GET['i'] != 5) // ñòðîêà ñ ïåðâûì <p align ...
{
$contents = file("inc/" . addslashes($_GET['page']));
$contents2 = array();
for($i = 0; $i < count($contents); $i++)
{
if($i != $_GET['i'])
$contents2[] = $contents[$i];
}
$fp = fopen("inc/" . addslashes($_GET['page']), 'w');
fputs($fp, join('', $contents2));
fclose($fp);
$message = 'ТекÑÑ‚ удален';
}
else
{
$message = 'Данную Ñтроку Ð½ÐµÐ»ÑŒÐ·Ñ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ';
}
}
////////////////////////////////adminManagrR ANDD//////////////////////////////////////////////////////
if($st=="menuandd") {print" меню добавлен!<br/>";
if(preg_match('/[^\w\.]/', $_GET['page']))
{
?>
<wml>
<card id="error" title="error" ontimer="main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>"><timer value="15"/>
<p align="center">
Ðеправильное Ð¸Ð¼Ñ Ñтраницы
</p>
</card>
</wml>
<?php
exit;
}
$contents = file("inc/" . addslashes($_GET['page']));
for($i = 0; $i < count($contents); $i++)
{
if($banner == 'top' && $i == 6)
{
}
else
{
$contents2[] = $contents[$i];
}
if(trim($contents[$i]) == '<p align="center">' || trim($contents[$i]) == '<p align="left">' || trim($contents[$i]) == '<p align="right">')
{
if($banner == 'top')
$contents2[] = get_random_link();
}
if((isset($contents[$i+1]) && trim($contents[$i+1]) == '</p>') || (isset($contents[$i+2]) && trim($contents[$i+2]) == '</card>'))
{
if($banner == 'bottom')
{
array_pop($contents2);
$contents2[] = get_random_link();
}
}
if($i == $_GET['i'])
{
if($i == 5 && $_POST['location'] == 'rewrite' && $_POST['action'] != 'left' && $_POST['action'] != 'center' && $_POST['action'] != 'right')
{
?>
<wml>
<card id="added" title="added" ontimer="edit.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>"><timer value="15"/>
<p>
Ð’ Ñтой Ñтроке Ð’Ñ‹ можете иÑпользовать только выравнивание текÑта<br/>
</p>
</card>
</wml>
<?php
exit;
}
$_POST['text'] = str_replace('&', '&', $_POST['text']);
$_POST['text'] = str_replace('$', '$$', $_POST['text']);
if($_POST['strip'] == 'yes')
$_POST['text'] = strip_tags($_POST['text']);
if($_POST['text'] == '' && ($_POST['action'] != 'left' && $_POST['action'] != 'center' && $_POST['action'] != 'right'))
{
?>
<wml>
<card id="added" title="added" ontimer="edit.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>"><timer value="15"/>
<p>
Ð’Ñ‹ не ввели текÑÑ‚<br/>
</p>
</card>
</wml>
<?php
exit;
}
switch($_POST['action'])
{
case 'link':
$new_line = '<a href="' . $_POST['link'] . '">' . $_POST['text'] . "</a>\n";
break;
case 'linkb':
$new_line = '<b><a href="' . $_POST['link'] . '">' . $_POST['text'] . "</a></b>\n";
break;
case 'linki':
$new_line = '<i><a href="' . $_POST['link'] . '">' . $_POST['text'] . "</a></i>\n";
break;
case 'links':
$new_line = '<small><a href="' . $_POST['link'] . '">' . $_POST['text'] . "</a></small>\n";
break;
case 'linku':
$new_line = '<u><a href="' . $_POST['link'] . '">' . $_POST['text'] . "</a></u>\n";
break;
case 'text':
$new_line = $_POST['text'] . "\n";
break;
case 'textb':
$new_line = '<b>' . $_POST['text'] . "</b>\n";
break;
case 'texti':
$new_line = '<i>' . $_POST['text'] . "</i>\n";
break;
case 'texts':
$new_line = '<small>' . $_POST['text'] . "</small>\n";
break;
case 'textu':
$new_line = '<u>' . $_POST['text'] . "</u>\n";
break;
case 'picture':
$new_line = '<img src="' . $_POST['picture'] . '" alt="' . $_POST['text'] . '"/>' . "\n";
break;
case 'urlpict':
$new_line = '<a href="' . $_POST['link'] . '"><img src="' . $_POST['picture'] . '" alt="' . $_POST['text'] . '"/></a>' . "\n";
break;
case 'br':
$new_line = '<br/>' . "\n";
break;
case 'left':
if($_GET['i'] == 5)
$new_line = '<p align="left">' . "\n";
else
$new_line = '</p><p align="left">' . "\n";
break;
case 'center':
if($_GET['i'] == 5)
$new_line = '<p align="center">' . "\n";
else
$new_line = '</p><p align="center">' . "\n";
break;
case 'right':
if($_GET['i'] == 5)
$new_line = '<p align="right">' . "\n";
else
$new_line = '</p><p align="right">' . "\n";
break;
default:
$new_line = '';
}
if($_POST['abr'] == 'yes')
$new_line .= "\n<br/>\n";
if($_POST['location'] == 'below')
{
// adding new line
$contents2[] = $new_line;
}
if($_POST['location'] == 'rewrite')
{
// adding new line
if($_GET['i'] == 5)
{
$adv_link = array_pop($contents2);
array_pop($contents2);
$contents2[] = $new_line;
//$contents2[] = $adv_link;
}
else
{
array_pop($contents2);
$contents2[] = $new_line;
}
}
if($_POST['location'] == 'above')
{
// adding new line
$curr_row = array_pop($contents2);
$contents2[] = $new_line;
array_push($contents2, $curr_row);
}
}
}
$fp = fopen("inc/" . addslashes($_GET['page']), 'wb');
fputs($fp, join('', $contents2));
fclose($fp);
}
if(!isset($_GET['page']))
$_GET['page'] = 'index.wml';
if(preg_match('/[^\w\.]/', $_GET['page']))
{
?>
<wml>
<card id="error" title="error" ontimer="main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>"><timer value="15"/>
<p align="center">
Ðеправильное Ð¸Ð¼Ñ Ñтраницы
</p>
</card>
</wml>
<?php
exit;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////GL edittitle///////////////////////////////////////////////////
if($st=="edittitle") {print"Добавить WML<br/>";
?>
Имя cтpaницы(без wml)<br/>
<input name="page" emptyok="true" maxlength="20" value="<?php echo preg_replace('/\..*?$/',"",$_GET['page']); ?>" title="page"/><br/>
Зaгoлoвoк:<br/>
<input name="title" emptyok="true" maxlength="20" title="title"/><br/>
<select name="action">
<option value="create">Coздaть</option>
</select><br/>
<anchor title="go">Ok<go href="manager.php?st=edittitle2&par=<?php echo $par; ?>&page=<?php echo $_GET['page']; ?>" method="post">
<postfield name="action" value="$(action)"/>
<postfield name="page" value="$(page).wml"/>
<postfield name="title" value="$(title)"/>
</go></anchor><br/>
*********<br/>
<?php
}
////////////////////////////////GL edittitle2///////////////////////////////////////////////////
if($st=="edittitle2") {print"Страница WML Добавлена!<br/>";
$fp = fopen("inc/" . $_POST['page'], 'w');
$clear_page = '<?xml version="1.0" encoding="UTF-8"?>';
$clear_page .= <<<CLEARPAGE
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="index" title="$_POST[title]">
<do type="prev" label="Назад"><prev/></do>
<p align="center">
<br/>
</p>
</card>
</wml>
CLEARPAGE;
fputs($fp, $clear_page);
fclose($fp);
$message = 'Cтpaницa "' . $_POST['page'] . '" coздaнa';
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
}
print"<br/>__________<br/>
<a href=\"admin.php?par=$par&st=amPL\">Админ панель</a>
<br/>
</p></card></wml>";
?>