Shift 10 years ago
parent
commit
4a90cf4f46
  1. 37
      cms/admin.php
  2. 2
      cms/edit.php
  3. 10
      cms/index.php
  4. 47
      cms/language.php
  5. 2
      cms/rssreader.php

37
cms/admin.php

@ -1,5 +1,14 @@
<?php <?php
session_start(); session_start();
require('language.php');
require('settings.php');
if ($_SESSION['login'] ==='true') {
//header('Location: http://'.$domain.'/cms/admin.php');
}else {
header('Location: http://'.$domain.'/cms/index.php');
die ();
}
echo '<!DOCTYPE html> echo '<!DOCTYPE html>
<html lang="ru"> <html lang="ru">
<head> <head>
@ -30,28 +39,28 @@ echo '<!DOCTYPE html>
echo '<hr><div class=""> echo '<hr><div class="">
<h1>Ваши RSS подписки</h1> <h1>'.$Lang_rsssubscribes.'</h1>
'; ';
require('settings.php');
$sql="SELECT * $sql="SELECT *
FROM `rss`"; FROM `rss`";
echo '<table class="table">'; echo '<table class="table">';
echo '<tr><td>Название RSS</td><td>URL</td><td>Включено</td><td>Последнее обновление</td><td>Частота обновления</td><td>Публиковать от имени</td><td></td><td></td><td></td></tr>'; echo '<tr><td>'.$Lang_table_title_Rss_Name.'</td><td>URL</td><td>'.$Lang_table_title_On.'</td><td>'.$Lang_table_title_Last_Feed_Update.'</td><td>'.$Lang_table_title_refres_rate.'</td><td>'.$Lang_table_title_Publish_from.'</td><td></td><td></td><td></td></tr>';
$result=mysql_query($sql) or die(mysql_error()); $result=mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($result)) { while ($row = mysql_fetch_array($result)) {
if ($row['active'] == '1') { if ($row['active'] == '1') {
$trclass="success"; $trclass="success";
$activeTXT='Да'; $activeTXT=$Lang_table_yes;
$activeTXT2='Отключить'; $activeTXT2=$Lang_table_off;
$activeTXT3=0; $activeTXT3=0;
$activeTXTClass='btn btn-warning'; $activeTXTClass='btn btn-warning';
} else { } else {
$trclass="warning"; $trclass="warning";
$activeTXT='Нет'; $activeTXT=$Lang_table_no;
$activeTXT2='Включить'; $activeTXT2=$Lang_table_on;
$activeTXT3=1; $activeTXT3=1;
$activeTXTClass='btn btn-success'; $activeTXTClass='btn btn-success';
} }
@ -63,8 +72,8 @@ echo '<td>'.$row['lastupdate'].'</td>';
echo '<td>'.$row['updatetime'].'</td>'; echo '<td>'.$row['updatetime'].'</td>';
echo '<td>'.$row['account'].'</td>'; echo '<td>'.$row['account'].'</td>';
echo '<td><a class="'.$activeTXTClass.'" href="edit.php?action=active&id='.$row['id'].'&active='.$activeTXT3.'">'.$activeTXT2.'</a></td>'; echo '<td><a class="'.$activeTXTClass.'" href="edit.php?action=active&id='.$row['id'].'&active='.$activeTXT3.'">'.$activeTXT2.'</a></td>';
//echo '<td><a class="btn btn-primary" href="edit.php?action=edit&id='.$row['id'].'">Изменить</a></td>'; //echo '<td><a class="btn btn-primary" href="edit.php?action=edit&id='.$row['id'].'">'.$Lang_table_change.'</a></td>';
echo '<td><a class="btn btn-danger" href="edit.php?action=del&id='.$row['id'].'">Удалить</a></td>'; echo '<td><a class="btn btn-danger" href="edit.php?action=del&id='.$row['id'].'">'.$Lang_table_del.'</a></td>';
echo '</tr>'; echo '</tr>';
unset($trclass); unset($trclass);
} }
@ -77,14 +86,14 @@ document.getElementById("hide").style.display="block"
</script>'; </script>';
echo '<hr> echo '<hr>
<div class="well"> <div class="well">
<div align="center" id="hide2"><a class="btn btn-lg btn-primary" onclick="hideshow();">Добавить RSS поток</a></div> <div align="center" id="hide2"><a class="btn btn-lg btn-primary" onclick="hideshow();">'.$Lang_table_add_rss_feed.'</a></div>
<div id="hide" style="display:none"><form class="navbar-form" action="edit.php" method="post"><div class="form-group">'; <div id="hide" style="display:none"><form class="navbar-form" action="edit.php" method="post"><div class="form-group">';
echo 'Название RSS: <input class="form-control" name="name" type="text" size="20"> echo $Lang_table_add_rss_name.': <input class="form-control" name="name" type="text" size="20">
URL: <input class="form-control" name="url" type="text" size="20"> URL: <input class="form-control" name="url" type="text" size="20">
Публиковать от имени: <input class="form-control" name="account" type="text" size="20"> '.$Lang_table_title_Publish_from.': <input class="form-control" name="account" type="text" size="20">
<!--(Не реализовано) Частота обновления: <input name="updatetime" type="text" size="20">--> <!--(Не реализовано) Частота обновления: <input name="updatetime" type="text" size="20">-->
Включен ? <input class="form-control" name="active" type="checkbox" size="20"> '; '.$Lang_table_add_rss_on.' ? <input class="form-control" name="active" type="checkbox" size="20"> ';
echo '<input style="margin-left:20px" class="btn btn-default" type="submit" value="Добавить"></div></div></form></div>'; echo '<input style="margin-left:20px" class="btn btn-default" type="submit" value="'.$Lang_table_add_rss_add.'"></div></div></form></div>';

2
cms/edit.php

@ -2,7 +2,7 @@
session_start(); session_start();
require('settings.php'); require('settings.php');
if ($_SESSION['login'] ==='true') { if ($_SESSION['login'] ==='true') {
header('Location: http://'.$domain.'/cms/admin.php'); //header('Location: http://'.$domain.'/cms/admin.php');
}else { }else {
header('Location: http://'.$domain.'/cms/index.php'); header('Location: http://'.$domain.'/cms/index.php');
die (); die ();

10
cms/index.php

@ -1,5 +1,6 @@
<?php <?php
$rpcusername = $_POST['rpcusername']; $rpcusername = $_POST['rpcusername'];
$language = $_POST['language'];
$rpcpassword1 = $_POST['rpcpassword1']; $rpcpassword1 = $_POST['rpcpassword1'];
session_start(); session_start();
require('settings.php'); require('settings.php');
@ -43,13 +44,18 @@ echo '<hr><div align="center" class="jumbotron">
<h1>Login</h1> <h1>Login</h1>
<form class="navbar-form" action="index.php" method="post"><div class="form-group">'; <form class="navbar-form" action="index.php" method="post"><div class="form-group">';
echo 'RPC username: <input class="form-control" name="rpcusername" type="text" size="20"><br> echo 'RPC username: <input class="form-control" name="rpcusername" type="text" size="20"><br>
RPC password: <input class="form-control" name="rpcpassword1" type="password" size="20"><br><br>'; RPC password: <input class="form-control" name="rpcpassword1" type="password" size="20"><br>';
echo '<input style="margin-left:20px" class="btn btn-primary" type="submit" value="Войти"></div></div></form> echo '<div>Language <select class="form-control" name="language">
<option value="en" >English</option>
<option value="ru" >Русский</option>
</select></div>';
echo '<br><br><input style="margin-left:20px" class="btn btn-primary" type="submit" value="Войти"></div></div></form>
'; ';
}else{ }else{
if ($rpcusername == $rpcuser && $rpcpassword1 == $rpcpassword) { if ($rpcusername == $rpcuser && $rpcpassword1 == $rpcpassword) {
$_SESSION['login']='true'; $_SESSION['login']='true';
$_SESSION['language']=$language;
header('Location: http://'.$domain.'/cms/admin.php'); header('Location: http://'.$domain.'/cms/admin.php');
}else { }else {
//echo $rpcpassword .' / '.$rpcpassword1 . ' / '.$rpcuser.' / '.$rpcusername; //echo $rpcpassword .' / '.$rpcpassword1 . ' / '.$rpcuser.' / '.$rpcusername;

47
cms/language.php

@ -0,0 +1,47 @@
<?php
if ($_SESSION['language'] != 'ru'){
$Lang_rsssubscribes="Your RSS subscribes";
$Lang_table_title_Rss_Name="Name of RSS";
$Lang_table_title_On="On";
$Lang_table_title_Last_Feed_Update="Last Update";
$Lang_table_title_refres_rate="Refresh Rate";
$Lang_table_title_Publish_from="Publish from twister account";
$Lang_table_yes="Yes";
$Lang_table_no="No";
$Lang_table_on="Turn on";
$Lang_table_off="Turn off";
$Lang_table_del="Delete";
$Lang_table_change="Change";
$Lang_table_add_rss_feed="Add RSS feed";
$Lang_table_add_rss_name="Name of RSS";
$Lang_table_add_rss_on="On";
$Lang_table_add_rss_add="Add";
}else {
$Lang_rsssubscribes="Ваши RSS подписки";
$Lang_table_title_Rss_Name="Название RSS";
$Lang_table_title_On="Включено";
$Lang_table_title_Last_Feed_Update="Последнее обновление";
$Lang_table_title_refres_rate="Частота обновления";
$Lang_table_title_Publish_from="Публиковать от имени";
$Lang_table_yes="Да";
$Lang_table_no="Нет";
$Lang_table_on="Включить";
$Lang_table_off="Отключить";
$Lang_table_del="Удалить";
$Lang_table_change="Изменить";
$Lang_table_add_rss_feed="Добавить RSS поток";
$Lang_table_add_rss_name="Название RSS";
$Lang_table_add_rss_on="Включен";
$Lang_table_add_rss_add="Добавить";
}
?>

2
cms/rssreader.php

@ -34,7 +34,7 @@ function getRssFeed($feed_uri, $reload = false)
$value = trim($h[1]); $value = trim($h[1]);
if (!isset($headers_arr[$key])) if (!isset($headers_arr[$key]))
$headers_arr[$key] = $value; $headers_arr[$key] = $value;
elseif (is_array($headers[$key])) elseif (is_array($headers_arr[$key]))
$headers_arr[$key][] = $value; $headers_arr[$key][] = $value;
else else
$headers_arr[$key] = array($headers_arr[$key], $value); $headers_arr[$key] = array($headers_arr[$key], $value);

Loading…
Cancel
Save