0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
public function getDialogs($offset = 0) {
$offset = (int) $offset;
$to_id = $_SESSION['user_id'];
if(!$to_id) {
return false;
}
$get_dialogs = $this->database->prepare("SELECT * FROM `messages` WHERE `to_id` = :to_id GROUP BY `from_id` LIMIT :offset, :max_posts");
$get_dialogs->bindParam(':to_id', $to_id, PDO::PARAM_INT);
$get_dialogs->bindParam(':offset', $offset, PDO::PARAM_INT);
$get_dialogs->bindParam(':max_posts', $this->max_dialogs, PDO::PARAM_INT);
$get_dialogs->execute();
$post_owners = array();
while ($row = $get_dialogs->fetch(PDO::FETCH_ASSOC)) {
$owner_id = $row['from_id'];
if($post_owners[$owner_id]) {
$row['owner_name'] = $post_owners[$owner_id];
} else {
$owner_name = $this->user->getInitials($owner_id);
$post_owners[$owner_id] = $owner_name;
$row['owner_name'] = $owner_name;
}
$row['date'] = $this->common->parseTimestamp($row['date_created']);
$arr[] = $row;
}
return $arr;
}
получение сообщений
Dev_18,
04 Апреля 2016
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
<?php
class Controller_Messages extends Controller {
function __construct() {
$this->log = new Log;
if(!defined('SECURITY_CONST')) {
$this->log->log('[controller_messages.php:'.__LINE__.'] SECURITY_CONST is undefined');
exit;
}
$this->user = new User;
$this->lang = new Lang;
$this->view = new View;
$this->model = new Model_Messages;
if(!$this->user->isAuth()) {
header('Location: /not_auth');
}
$this->user_lang = $this->user->getLang();
$this->lang->setLang($this->user_lang);
}
Открыл исходник и тут такое....
Dev_18,
04 Апреля 2016
+143
- 1
http://govnokod.ru/comments/18245/rss ru [email protected] (govnokod.ru support) Mzz.Framework v.100500-release Wed, 27 May 2015 21:20:29 +0400 Fatal error: Call to a member function getCreated() on a non-object in /home/striker/applications/govnokod/tmp/templates_c/1563503196.file.export_quote_rss.tpl.php-ru.php on line 21
http://govnokod.ru/, в чём дело:
Dev_18,
27 Мая 2015
+142
- 1
Код не мой, но очень неоптимизированный. И так ещё десяток таких блоков. С сайта: http://ninjahonor.com/.
$(document).ready(function(){
$(".coffin-box1 a.name1").click(function(){
$(".vid1").addClass('active')
$(".vid2 , .vid3 , .vid4 , .vid5 , .vid6 , .vid7 , .vid8 , .vid9 , .vid10 , .vid11 , .vid12 , .vid13 , .vid14 , .vid15 , .vid16 , .vid17 , .vid18 , .vid19 , .vid20 , .vid21 , .vid22 , .vid23 , .vid24 , .vid25 , .vid0 ").removeClass('active')
});
});
$(document).ready(function(){
$(".coffin-box1 a.name2").click(function(){
$(".vid2").addClass('active')
$(".vid1 , .vid3 , .vid4 , .vid5 , .vid6 , .vid7 , .vid8 , .vid9 , .vid10 , .vid11 , .vid12 , .vid13 , .vid14 , .vid15 , .vid16 , .vid17 , .vid18 , .vid19 , .vid20 , .vid21 , .vid22 , .vid23 , .vid24 , .vid25 , .vid0 ").removeClass('active')
});
});
$(document).ready(function(){
$(".coffin-box2 a.name1").click(function(){
$(".vid6").addClass('active')
$(".vid2 , .vid3 , .vid4 , .vid5 , .vid1 , .vid7 , .vid8 , .vid9 , .vid10 , .vid11 , .vid12 , .vid13 , .vid14 , .vid15 , .vid16 , .vid17 , .vid18 , .vid19 , .vid20 , .vid21 , .vid22 , .vid23 , .vid24 , .vid25 , .vid0 ").removeClass('active')
});
});
Dev_18,
27 Мая 2015
+143
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
$find_email = $this->db_users->prepare("SELECT * FROM `users` WHERE `email` = :email");
$find_email->execute(array(':email' => $user['email']));
$row = $find_email->fetch(PDO::FETCH_ASSOC);
if($row['id']) {
$hash_passw = crypt($user['password'], $row['sault']);
$auth = $this->db_users->prepare("SELECT * FROM `users` WHERE `email` = :email AND `password` = :hash_passw");
$auth->execute(array(':email' => $user['email'],
':hash_passw' => $hash_passw));
$_row = $auth->fetch(PDO::FETCH_ASSOC);
if($_row) {
$auth_token = '$3a$'.sha1(date(dmY).time().$user['email']).'$';
$auth = $this->db_users->prepare("UPDATE `users` SET `auth_token`=:auth_token, WHERE `email` = :email");
$auth->execute(array(':auth_token' => $auth_token,
':email' => $user['email']));
$domain = $_SERVER['HTTP_HOST'];
setcookie('authToken', $value, time()+3600, '', $domain, 1);
setcookie('hash', $value, time()+3600, '', $domain, 1);
return true;
Авторизация
Dev_18,
20 Мая 2015
+143
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
if(!$user['email']) {
$err = $this->system_message->getLang('empty_email');
} elseif(strlen($user['email']) < self::MIN_USER_NAME) {
$err = $this->system_message->getLang('small_email');
} elseif(strlen($user['email']) > self::MAX_USER_NAME) {
$err = $this->system_message->getLang('long_email');
} elseif(!filter_var($user['email'], FILTER_VALIDATE_EMAIL)) {
$err = $this->system_message->getLang('incorrect_name');
}
if(!$user['passw']) {
$err = $this->system_message->getLang('empty_passw');
} elseif(strlen($user['passw']) < self::MIN_PASSWORD_NAME) {
$err = $this->system_message->getLang('small_passw');
} elseif(strlen($user['passw']) > self::MAX_PASSWORD_NAME) {
$err = $this->system_message->getLang('long_passw');
}
if($err) {
//!TODO add a exeption
} else {
$find_email = $this->db_users->prepare("SELECT * FROM `users` WHERE `email` = :email");
$find_email->execute(array(':email' => $user['email']));
Мдэээ...
Dev_18,
12 Мая 2015
+140
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
<?php
/**
* @desc Локализация сайта
*
**/
class System_Message{
private function openLangFail($lang){
$path = '/../message/'.$lang.'.php';
if (file_exists($path)) {
return 'File with languages not found';
} else {
return include $path;
}
}
public function getLang($value, $lang='ru'){
$lang = self::openLangFail($lang);
if($lang[$value] != '') {
return $lang[$value];
} else {
return false;
}
}
}
Ну как?
Dev_18,
12 Мая 2015