Описание:
Отличный подарок Вашим пользователям, каждый может получить шанс написать новогоднее обещание.
Каждое написанное обещание отображается на странице пользователя
Единственное. Замена png на свё
Запрещено продавать!!!
Файл nw19 / index.php
Код:
<?
/**
* @ PACKAGE = DCMS-SOCIAL
* @ AUTHOR = DARIK
*/
include_once '../sys/inc/start.php';include_once '../sys/inc/compress.php';include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';include_once '../sys/inc/settings.php';include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';include_once '../sys/inc/fnc.php';include_once '../sys/inc/user.php';
// Только для пользователей
if (!isset($user))header("location: /index.php?");
// class Darik
class class_drk {
public static function ending($num, $a, $b, $c)
{
$q = ($num % 10 == 1 && $num % 100 != 11? 0: ($num % 10 >= 2 && $num % 10 <= 4 && ($num % 100 < 10 or $num % 100 >= 20)? 1: 2));
return ($q == 0? $a: ($q == 1? $b: ($q == 2? $c: null)));
}
public static function avatar($ID, $dir = '50')
{
$avatar = mysql_fetch_array(mysql_query("SELECT id,id_gallery,ras FROM `gallery_foto` WHERE `id_user` = '$ID' AND `avatar` = '1' LIMIT 1"));
if (is_file(H."sys/gallery/$dir/$avatar[id].$avatar[ras]"))
{
return '<a class="landing__promise_ava_wrap fl_l" href="/id'.$ID.'">
<img src="/foto/foto' . $dir . '/' . $avatar['id'] . '.' . $avatar['ras'] . '" class="landing__promise_ava"></a>';
}
else
{
return '<a class="landing__promise_ava_wrap fl_l" href="/id'.$ID.'">
<img src="/style/user/avatar.gif" class="landing__promise_ava"></a>';
}
}
}
// Отправка обращения
if (isset($_POST['message']) && isset($user))
{
$message = htmlspecialchars( $_POST['message'] );
$mat = antimat($message);
if ($mat)$err[] = 'В тексте сообщения обнаружен мат: ' . $mat;
if (strlen2($message) > 501){ $err[] = 'Обещание слишком длинное'; }
if (strlen2($message) < 3){ $err[] = 'Короткое Обещание'; }
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `nw19` WHERE `user` = '$user[id]' LIMIT 1"),0) != 0)
{
$err = 'Вы уже написали обещание';
}
if(!isset($err))
{
mysql_query("INSERT INTO `nw19` (user, time, message) values('$user[id]', '$time', '" .$message . "')");
$_SESSION['message'] = 'Обещание успешно добавлено';
header ("Location: index.php" . SID);
exit;
}
}
// заголовок страницы
$set['title'] = 'Новогоднее обещание';
// head
include_once '../sys/inc/thead.php';
title();
aut();
err();
// menu
echo'
<link rel="stylesheet" href="/nw19/style.css" type="text/css" />
<div class="landing__top_wrap">
<div class="landing__top_image"></div>
</div>
<div class="landing__title landing__title_general">Новогоднее обещание</div>
<div class="landing__caption">
<p class="landing__caption_block">Новый год — отличный шанс начать новую жизнь. В канун праздника мы обещаем себе стать лучше, заняться спортом, преуспеть в учёбе или работе, прочесть больше книг, чаще путешествовать.</p>
<p class="landing__caption_block">Стремление реализовать свои планы станет сильнее, если Вы сделаете свои обещания публичными. Расскажите о них друзьям — и приобретёте не только дополнительную мотивацию, но и единомышленников.</p>
</div>
<div class="landing__separator"></div>
<div class="landing__title">Обещания</div>
';
// DB
$k_post = mysql_result(mysql_query("SELECT COUNT(id) FROM `nw19`"), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
if ($k_post == 0)
{
echo'
<div class="landing__caption" style="width: 61%;">
<p class="landing___caption_block">Новогоднее обещание еще не кто не написал.</p>
</div>';
}
$q = mysql_query("SELECT * FROM `nw19` ORDER BY time DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[user] LIMIT 1"));
$message = htmlspecialchars( $post['message'] );
echo'
<div class="landing__promise clear_fix">
'.class_drk::avatar($ank['id']).'
<div class="landing__promise_cont fl_l">
<div class="landing__promise_name">
'. user::avatar($ank['id'], 2).''. user::nick($ank['id'], 1, 1, 1).'
<span class="landing__promise_date" >' . vremja($post['time']) . '</span> </div>
<div class="landing__promise_text">'.$message.'</div>
</div>
</div>';
}
if ($k_page > 1)str('index.php?', $k_page, $page); // Вывод страниц
echo'
<form method="post" action="">
<div class="landing__separator"></div>
<div class="landing__title">Написать обещание</div>
<div class="landing__caption landing__caption_promise">Поразмышляйте над тем, что давно хотели изменить, попробовать или узнать, и дайте публичное обещание сделать это в следующем году.</div>
<textarea name = "message" maxlength="500" placeholder="Прочитать 100 книг за год, заняться спортом..." style="overflow: hidden; resize: none;"></textarea>
<div class="clear_fix landing__form_bottom">
<div class="landing__form_info fl_l">
Обещание будет опубликовано на Вашей cтранице <br>с хештегом <span style="color: #3b5998;">#ВНовомГодуЯОбещаю</span>
</div>
<button class="flat_button landing__publish_button fl_r">Пообещать</button></form>
</div></br></br></br>
<div class="landing__separator"></div>
<div class="landing__title">'.$k_post.'</div>
<div class="landing__caption landing__caption_total" style="width: 25%;">
'.class_drk::ending($k_post, 'обещания', 'обещание', 'обещаний').' сделано</div>
<div class="landing__bottom_image_wrap">
<div class="landing__bottom_image"></div>
</div>
';
// foot
include_once '../sys/inc/tfoot.php';
?>
Файл nw19/nw19.php
Код:
<? /** * @ PACKAGE = DCMS-SOCIAL * @ AUTHOR = DARIK */ echo ' <link rel="stylesheet" href="/nw19/style.css" type="text/css" /> <div class="block_y"> <div class="st_y"> <img src="/nw19/img/new_year_promises_40.png" class="img_y" alt=""> <div class = "text_y"> Самое время строить планы. Дайте себе обещание на 2019 год и расскажите о нём друзьям!</div> <div class = "text2_y"><a class="flat_button secondary" href="/nw19/">Создать обещание</a></div> </div></div> '; ?>
Файл nw19 / style.css
Код:
.st_y {
color: #000;
background-color: #e2ecf7;
-o-border-radius: 3px;
border-radius: 3px;
-moz-border-radius: 3px;
margin: 0 3px 3px;
padding: 9px;
border: 1px solid #c5dfea;
}
.block_y{
background: #fff;
border-bottom: 1px dotted #abbefb;
border-left: 1px solid #e0e0e0;
border-right: 1px solid #e0e0e0;
padding: 6px;
}
.img_y {
width: 40px;
height: 40px;
border-radius: 50%;
-moz-force-broken-image-icon: 0;
background-color: #fafbfc;
display: inline-block;
}
.text_y {
margin: -42px 0 0 52px;
min-height: 40px;
font-size: 12.5px;
}
.text2_y {
margin: 0px 0 0 52px;
}
.flat_button.secondary {
color: #fff;
}
.flat_button {
padding: 7px 16px 8px;
font-size: 12.5px;
display: inline-block;
text-decoration: none;
background-color: #5181b8;
border-radius: 4px;
color: #fff;
}
.landing {
text-align: center;
}
.wk_text, .wk_text blockquote {
overflow-wrap: break-word;
}
.wk_wiki_content {
line-height: 14px;
padding: 20px 25px 0px;
}
.landing__top_image {
height: 120px;
width: 516px;
margin: 0px auto;
background: url(/nw19/img/top_ny_img.png) no-repeat;
}
.landing__title_general {
margin-top: 32px;
}
.landing__title {
color: rgb(34, 34, 34);
font-size: 32px;
line-height: 39px;
font-weight: 600;
font-family: "TT Commons", sans-serif !important;
text-align: center;
}
.landing__caption {
width: 456px;
line-height: 26px;
color: rgb(101, 101, 101);
font-size: 14px;
margin: 24px auto 0px;
}
.landing__separator {
height: 38px;
width: 100%;
background: url(/nw19/img/sep.png) 50% center no-repeat;
}
.landing__caption_promise {
margin-top: 12px;
}
textarea {
width: 100%;
margin: 0px;
}
textarea {
max-width: 90%;
width: 99%;
min-height: 100px;
border-radius: 8px;
border: 1px solid #d3d9de;
margin: 15px;
padding: 7px;
line-height: 20px;
font-size: 13px;
margin-top: 32px;
resize: vertical;
}
.landing__form_bottom {
white-space: nowrap;
}
.landing__form_bottom {
margin-top: 20px;
}
.clear_fix {
display: block;
}
.landing__form_info {
line-height: 20px;
color: rgb(117, 124, 133);
padding-top: 4px;
text-align: left;
padding: 0 0 0 19px;
font-size: 14px;
}
.fl_l {
float: left;
}
.fl_r {
float: right;
}
.landing__publish_button {
font-size: 18px;
line-height: 25px;
margin-left: 10px;
padding: 10px 25px 11px;
border-radius: 8px;
}
.flat_button {
padding: 7px 16px 8px;
margin: 0px 16px 0 0;
font-size: 12.5px;
display: inline-block;
zoom: 1;
cursor: pointer;
white-space: nowrap;
outline: none;
vertical-align: top;
line-height: 15px;
text-align: center;
text-decoration: none;
background: none;
background-color: #5181b8;
color: #fff;
border: 0;
border-radius: 4px;
box-sizing: border-box;
}
.landing__caption_total {
margin-top: 4px;
}
.landing__bottom_image {
width: 516px;
height: 139px;
margin: 32px auto 0px;
background: url(/nw19/img/bottom_ny_img.png) 0px 1px no-repeat;
}
.landing__promise {
text-align: left;
margin-top: 32px;
margin: 15px;
}
.clear_fix {
display: block;
}
.landing__promise_ava {
width: 56px;
height: 56px;
border-radius: 28px;
}
.landing__promise_cont {
margin-left: 10px;
}
.clear_fix:after {
content: '.';
display: block;
height: 0;
font-size: 0;
line-height: 0;
clear: both;
visibility: hidden;
}
.landing__promise_date {
color: #939393!important;
font-weight: 400;
font-weight: 400;
font-size: 14px;
margin-left: 4px;
}
._snippet {
background-color: #fff;
/* border: 1px solid rgba(0,20,51,.12); */
border-radius: 2px;
text-align: center;
margin: 7px auto 0;
padding-bottom: 25px;
position: relative;
overflow: hidden;
cursor: pointer;
}
._snippet_top {
width: 100%;
max-width: 510px;
margin: 0 auto;
padding: 0 39px;
position: relative;
box-sizing: border-box;
}
._snippet_top:after {
content: '';
display: block;
padding-top: 23.14814815%;
width: 100%;
background: url(/nw19/img/top_ny_img.png) center 0 no-repeat;
background-size: cover;
}
._snippet_hashtag {
font-size: 18px;
line-height: 21px;
margin-top: 19px;
font-weight: 500;
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
display: inline-block;
}
._snippet_text {
font-size: 16px;
line-height: 23px;
padding: 0 25px;
margin-top: 16px;
word-wrap: break-word;
}
._snippet_separator {
background: url(/nw19/img/sep.png) center 32px no-repeat;
height: 5px;
width: 100%;
padding: 32px 0 14px;
}
._snippet_show_layer_button {
font-size: 15px;
line-height: 23px;
font-weight: 500;
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
padding: 5px 15px 0;
display: inline-block;
}
._snippet_show_layer_button:after {
content: '';
display: inline-block;
width: 6px;
margin-left: 6px;
height: 13px;
vertical-align: middle;
background: url(/nw19/img/_arrow.svg) no-repeat;
-o-transition: transform 100ms linear, -o-transform 100ms linear;
transition: transform 100ms linear;
transition: transform 100ms linear, -o-transform 100ms linear;
}
._snippet_bottom_image {
position: absolute;
bottom: 0;
width: 23%;
max-width: 120px;
}
._snippet_bottom_image_left {
left: 0;
}
._snippet_bottom_image:after {
content: '';
display: block;
padding-top: 63.33333333%;
width: 100%;
background-size: cover;
}
._snippet_bottom_image_left:after {
background: url(/nw19/img/bottom_left_img.png) 0 100% no-repeat;
}
._snippet_bottom_image_right {
right: 0;
}
._snippet_bottom_image_right:after {
background: url(/nw19/img/bottom_right_img.png) 100% 100% no-repeat;
}
Файл readme.txt
Код:
/**
* @ PACKAGE = DCMS-SOCIAL
* @ AUTHOR = DARIK
* @ SITE = LAFI.MOBI
*/
Поздравляю с покупкой !!
1. для установки залейте папку nw19 в корень вашего сайта
2. в файле /index.php вашем нужно прописать до строчки
// новости
include_once 'sys/inc/news_main.php';
пропишите этот код
// нг
include_once 'nw19/nw19.php';
если не понятно смотрите рис1.
3. в файле /user/info/wap.php вашем нужно прописать в самом в конце
// нг
/**
* @ PACKAGE = DCMS-SOCIAL
* @ AUTHOR = DARIK
*/
$count = mysql_result(mysql_query("SELECT COUNT(id) FROM `nw19` WHERE `user` = '".$ank['id']."'"),0);
if ($count > 0){
$act = mysql_fetch_assoc(mysql_query("SELECT `message` FROM `nw19` WHERE `user` = '".$ank['id']."' LIMIT 1"));
$message = htmlspecialchars( $act['message'] );
echo '
<link rel="stylesheet" href="/nw19/style.css" type="text/css" />
<div id="wpt255551312_336" class="wall_post_cont _wall_post_cont"><div class="_snippet">
<div class="_snippet_top"></div>
<a class="_snippet_hashtag" href="/nw19/">#ВНовомГодуЯОбещаю</a>
<div class="_snippet_text">'.$message.'</div>
<div class="_snippet_separator"></div>
<a href="/nw19/" class="_snippet_show_layer_button" ">Создать своё обещание</a>
<div class="_snippet_bottom_image _snippet_bottom_image_left"></div>
<div class="_snippet_bottom_image _snippet_bottom_image_right"></div>
</div></div>
';
}
если не понятно смотрите рис2.
4. Залить бд
5. Радоваться на этом все!
[marq] Благодарность автору Drk
Я думаю многие будут рады данной плюшке
Не забываем ставить ,👍 лайк
[/marq] Android 8.1.0, Chrome,70.0.3538.110





