Esempio n. 1
0
function gbHandler($p)
{
    $session = SessionHandler::getInstance();
    if ($session->id == $p['to']) {
        return false;
    }
    $gb = new Guestbook();
    $gb->owner = $p['to'];
    $gb->creator = $session->id;
    $gb->time_created = sql_datetime(time());
    $gb->body = $p['body'];
    $gb->store();
    return true;
}
Esempio n. 2
0
 /**
  * Run Method.
  */
 public function run()
 {
     Guestbook::connection()->query('SET FOREIGN_KEY_CHECKS = 0');
     $faker = Faker\Factory::create('ru_RU');
     $data = [];
     for ($i = 0; $i < 100; $i++) {
         $data[] = ['user_id' => $i % rand(7, 10) ? rand(1, 5) : null, 'text' => $faker->realText(rand(50, 500)), 'ip' => $faker->ipv4, 'brow' => App::getUserAgent($faker->userAgent), 'reply' => $i % rand(7, 10) ? '' : $faker->realText(rand(20, 100)), 'created_at' => $faker->dateTimeBetween('-1 month')->format('Y-m-d H:i:s')];
     }
     Guestbook::connection()->query('TRUNCATE guestbook');
     $table = $this->table('guestbook');
     $table->insert($data)->save();
     Guestbook::connection()->query('SET FOREIGN_KEY_CHECKS = 1');
 }
Esempio n. 3
0
<?php

require_once "include/html_functions.php";
require_once "include/guestbook.php";
if (isset($_POST["name"]) && isset($_POST["comment"])) {
    if ($_POST['name'] == "" || $_POST['comment'] == "") {
        $flash['error'] = "Must include both the name and comment field!";
    } else {
        $res = Guestbook::add_guestbook($_POST["name"], $_POST["comment"], False);
        if (!$res) {
            die(mysql_error());
        }
    }
}
$guestbook = Guestbook::get_all_guestbooks();
?>

<?php 
our_header("guestbook");
?>

<div class="column prepend-1 span-24 first last">
<h2>Guestbook</h2>
<?php 
error_message();
?>
<h4>See what people are saying about us!</h4>

<?php 
if ($guestbook) {
    foreach ($guestbook as $guest) {
Esempio n. 4
0
<?php

include_once "./config/autoload.php";
if (isset($_POST['submit'])) {
    //echo $_POST['email'].' '.$_POST['name'].' '.$_POST['msg'];
    $name = $_POST['name'];
    $email = $_POST['email'];
    $msg = $_POST['msg'];
    $gbook = new Guestbook();
    //создаем объект класса
    $gbook->Insert($name, $email, $msg);
    //передаем в метод класса параметры для сохранения в БД
}
<?php

if (isset($_GET['id'])) {
    $id = $_GET['id'];
    Guestbook::Delete($id);
}
if (isset($_POST['news_dell'])) {
    $id = $_POST['news_dell'];
    Guestbook::Delete($id);
}
/**
 * Tries to login the user with the TM WS SDK
 */
try {
    $trackmania = new \TrackMania\WebServices\OAuth2\Base(API_USERNAME, API_PASSWORD);
    $login = $trackmania->getLogin();
    $player = $trackmania->getPlayer();
} catch (\TrackMania\WebServices\Exception $e) {
    var_dump($e->getHTTPStatusCode(), $e->getHTTPStatusMessage(), $e->getMessage());
    $login = null;
    $player = null;
}
/**
 * Instanciates the Guestbook class to we can handle data
 */
$guestbook = new Guestbook();
/**
 * Instanciates the color parser
 * @see http://fish.stabb.de/index.php5?page=3&subpage=127
 */
$tmfcolorparser = new TMFColorParser('#ffffff');
/**
 * Looks for different actions
 */
if ($login && array_key_exists('post', $_POST)) {
    $guestbook->createPost($login, $_POST['post']);
} elseif ($login && $login == ADMIN_LOGIN && array_key_exists('delete', $_GET)) {
    $guestbook->deletePost($_GET['delete']);
}
/**
 * Get the page
Esempio n. 7
0
<?php

// var_dump($_COOKIE['guestbook_key']);
// die();
include 'php/GuestbookClass.php';
$guestbook = new Guestbook('messages.xml');
$messages = $guestbook->getMessages();
?>
<html>
<head>
	<title>Гостевая книга</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="style.css" rel="stylesheet" media="all" />
	<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<h1>Гостевая книга</h1>
<div class="add_new_message"><a href="javascript:;">добавить запись</a></div>

<div class="new_message_block">
	Представьтесь, пожалуйста:<Br />
	<input type="text" name="username" /><br />
	Новый отзыв:
	<textarea name="new_msg_text_level1"></textarea><Br />
	<a href="javascript:;" class="save_new_message_1level">добавить</a>
	<a href="javascript:;" class="cancel_btn">отмена</a>
</div>

<?php 
include 'php/message_template.php';
Esempio n. 8
0
/**
 *  Количество сообщений в гостевой
 * @return integer сообщений в гостевой
 */
function guestbookCount()
{
    return Guestbook::count();
}
Esempio n. 9
0
<?php

//No sneak peek!
defined('JULI_INIT') or die('Restricted access');
include "Guestbook.php.php";
Guestbook::construct($db, $cms);
Esempio n. 10
0
function var_dump_($var)
{
    echo '<pre>';
    var_dump($var);
    die('</pre>');
}
include './GuestbookClass.php';
$actions = array('read', 'create', 'update');
if (!isset($_GET['action'])) {
    die('Не передан необходимый набор параметров!');
}
if (!in_array($_GET['action'], $actions)) {
    die('Некорректные параметры!');
}
$guestbook = new Guestbook('../messages.xml');
try {
    if ($_GET['action'] == 'read') {
        // читаем сообщения
        $messages = $guestbook->getMessages();
        die(json_encode($messages));
    } elseif ($_GET['action'] == 'update') {
        // обновление сообщения
        if (!isset($_POST['id']) || !isset($_POST['msg_text']) || !trim($_POST['id']) || !trim($_POST['msg_text'])) {
            throw new Exception("Не переданы необходимые данные!", 1);
        }
        $message = array('id' => $_POST['id'], 'msg_text' => $_POST['msg_text']);
        $result = $guestbook->updateMessage($message);
        if (!$result) {
            throw new Exception('Не удалось сохранить запись, попробуйте позже.', 1);
        }
Esempio n. 11
0
 /**
  * Удаление сообщения
  */
 public function delete()
 {
     if (!Request::ajax()) {
         App::redirect('/');
     }
     if (!User::isAdmin()) {
         App::abort(403);
     }
     $errors = '';
     $id = Request::input('id');
     if ($guest = Guestbook::find_by_id($id)) {
         $guest->token = Request::input('token', true);
         if ($guest->is_valid() && $guest->delete()) {
             exit(json_encode(['status' => 'ok']));
         } else {
             $errors = $guest->getErrorsText();
         }
     }
     exit(json_encode(['status' => 'error', 'errors' => $errors]));
 }
Esempio n. 12
0
    //删除留言
    $id = $_GET['id'];
    $guestbook = new Guestbook();
    //判断执行结果
    if ($guestbook->deleteMessage($id)) {
        //成功:加载留言管理页面
        admin_redirect('留言删除成功', 'guestbook.php');
    } else {
        //失败
        admin_redirect('留言删除失败', 'guestbook.php');
    }
} elseif ($act == 'replay') {
    //回覆留言,加載回覆留言板
    $id = $_GET['id'];
    $guestbook = new Guestbook();
    $list = $guestbook->getMessageById($id);
    include_once ADMIN_TEMP . 'guestbook-modify.html';
} elseif ($act == 'update') {
    $g_text_replay = $_GET['replyContent'];
    //留言回复
    $id = $_GET['id'];
    $guestbook = new Guestbook();
    //判斷
    if ($guestbook->updateReplay($id, $g_text_replay)) {
        //回复成功
        admin_redirect('guestbook.php', '回复留言成功');
    } else {
        //回复失败
        admin_redirect('guestbook.php', '回复留言失败');
    }
}
Esempio n. 13
0
<?php

include_once "./config/autoload.php";
include_once "delete_content.php";
$GBinfo = new Guestbook();
////создаем объект класса что-бы обратиться г его методу
$gbook_all = $GBinfo->select();
//вызываем метод класса который выводит все коментарии пользывателей ($gbook_all через цикл выводим в нужном блоке отзывов клиентов например)
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>тест</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
    <link href="css/main.css" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"--></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
    <script src="js/scripts_v1.js"></script>
</head>
<body>
<div class="row">
    <form style="width: 50%;left:50%;margin-left: 25%" class="form-horizontal" method="post" action="libs.php">
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2  control-label">Name</label>
            <div class="col-sm-10">
                <input type="text" name="name" class="form-control" id="inputPassword3" placeholder="Name">
            </div>
<?php

require_once 'inc/classes/class_guestbook.inc.php';
$page->title_bar();
$guestbook = new Guestbook();
if ($remove_entry) {
    $message = '<b class=important>Eintrag l&ouml;schen!</b>';
    if ($guestbook->remove_entry($id)) {
        $message = '<br><b class=ok>Eintrag gel&ouml;scht!</b>';
    } else {
        $message = '<br><b class=error>Eintrag nicht gel&ouml;scht!</b>';
    }
}
$message .= $guestbook->show_entries_interface(1);
echo $page->dialog_box('G&auml;stebuch administrieren', $message, 0, 0, '80%');
Esempio n. 15
0
<?php

//No sneak peek!
defined('JULI_INIT') or die('Restricted access');
include "Guestbook.php.php";
Guestbook::construct($db, $admin);
Esempio n. 16
0
    //获取所有留言
    $guestbook = new Guestbook();
    $pagecount = $config['guestbook_page'];
    //分页数据获取
    $list = $guestbook->getAllMessage($pagecount, $page);
    //获取当前总留言数量
    $counts = $guestbook->getCounts();
    //计算当前显示留言数
    $pages = ceil($counts / $config['guestbook_page']);
    //获取分页字符串
    $page_str = Page::getPageString('guestbooks.php', 'list', $counts, $page, $pagecount);
    //加载前台留言界面
    include_once YIMAI_TEMP . 'guestbook.html';
} elseif ($act == 'insert') {
    //留言入库
    $g_name = $_REQUEST['guestName'];
    $g_send_message = $_REQUEST['guestTitle'];
    $g_send_text = $_REQUEST['guestContent'];
    //var_dump($g_send_message,$g_send_text);exit;
    if (empty($g_send_message) || empty($g_send_text)) {
        my_redirect('guestbooks.php', '留言标题或内容不能为空!', '正在为您跳转到留言板');
    }
    $guestbook = new Guestbook();
    if ($guestbook->insertMessage($g_name, $g_send_message, $g_send_text)) {
        //留言成功
        my_redirect('guestbooks.php', '留言成功!', '正在为您跳转到留言板', 1000);
    } else {
        //留言失败
        my_redirect('guestbooks.php', '留言失败!', '正在为您跳转到留言板');
    }
}