<?php error_reporting(E_ALL); echo "<html><head></head><body>"; $time_start = microtime(true); include 'admin.php'; include 'functions.php'; echo "<br>Create News<br>"; CreateNews($sitefinityHost, $newsServiceUrl, $cookie); echo "Print News From Server<br>"; PrintNews($sitefinityHost, $newsServiceUrl, $cookie); $time_end = microtime(true); $time = $time_end - $time_start; echo "<br>Ran this Script in {$time} seconds"; echo "</body></html>";
* (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ ?> <div style="text-align:left;"><h2>- Manage News</h2></div> -Add/Edit(-)/Delete news -Add/Edit/Delete categories <?php if (!defined("ADMIN_FILE")) { die("Access denied."); } include $basedir . 'news/functions.php'; echo "<table class=\"panel\" width=\"100%\">\n\t\t<tr><td class=\"panel\">"; if (isset($_GET['edit'])) { $news_id = $_GET['edit']; EditNews($news_id); } else { ListNews(); echo "</td><td class=\"panel-shadow\">"; CreateNews(); } ?> </td></tr></table>
<?php require_once __DIR__ . "/../function/function.php"; //$all_news = [ // ['title' => 'Новость 1', 'content' => 'Новость дня!!!', 'date' => '22-11-15'], // ['title' => 'Новость 2', 'content' => 'Самолет угнали...', 'date' => '23-11-15'], // ['title' => 'Новость 3', 'content' => 'Выборы...', 'date' => '24-11-15'], //]; $sql = "SELECT * FROM news ORDER BY mydate DESC"; $sql = "SELECT * FROM news"; $all_news = GetAllNews($sql); if ($_POST) { $sql = "INSERT INTO news(title, path, mydate) VALUES ('{$gl_title}', '{$gl_file}', '{$gl_ate}')"; CreateNews($sql); header('Location: index.php'); die; }
} //GetPressListWithFlags($year,$first,$count,$flags) //(y is how many items on page) //you want to ask let's say for N-th page, so you need to set first = N*Y and of course page is zero based so the first page is 0, the second 1 etc. $pressList1 = GetPressListWithFlags(date('Y'), 0, 3, 1); //first page has Y = 3, but the N = 0 $pressList2 = GetPressListWithFlags(date('Y'), 3, 3, 1); //N = 1, first = N*3 = 3 $newslist1 = ''; foreach ($pressList1 as $key => $val) { $artdate = date('j, M Y', $val['date']); $img = 'getfile.php?id=' . $val['id']; if ($val['source'] == NEWS) { $lnk = 'index.php?page=pressdtls&prid=' . $val['id']; } if ($val['source'] == BLOG) { $lnk = 'index.php?page=blogdtls&prid=' . $val['id']; } $newslist1 .= CreateNews($lnk, $img, $val['imgalt'], $val['title'], $artdate); } $newslist2 = ''; foreach ($pressList2 as $key => $val) { $artdate = date('j, M Y', $val['date']); $img = 'getfile.php?id=' . $val['id']; $lnk = 'index.php?page=pressdtls&prid=' . $val['id']; $newslist2 .= CreateNews($lnk, $img, $val['imgalt'], $val['title'], $artdate); } $title = 'FusionPipe Software Solutions'; $content = file_get_contents('pages/default.tpl'); $content = str_replace('@NEWSP1@', $newslist1, $content); $content = str_replace('@NEWSP2@', $newslist2, $content);
<?php /** * Created by PhpStorm. * User: Admin * Date: 18.02.2015 * Time: 18:37 */ $header = isset($_POST['header']) ? $_POST['header'] : null; $preview = isset($_POST['preview']) ? $_POST['preview'] : null; $text = isset($_POST['newstext']) ? $_POST['newstext'] : null; $tags = isset($_POST['tags']) ? $_POST['tags'] : null; if (CreateNews($header, $preview, $text, $tags) > 0) { $msg = "Новость добавлена"; }