This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class KaCache | |
{ | |
private $memObject,$name,$lifetime; | |
private $tags = array(); | |
private $app; | |
public function __construct(Ka $app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return $cache->set($cacheKey,'20s',array('manufacture','bike_model'))->call(function() use($mysqli,$resizer) { | |
$result = $mysqli->queryFile('/bank.sql/moto-front'); | |
$bikes = array(); | |
while ($row = $result->fetch_assoc()) | |
{ | |
$row['pic'] = $resizer->resize($row['pic'],'{"h":120}'); | |
$bikes[] = $row; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function incrementViews($newsId){ | |
self::checkDataMap(); | |
/** @var $post \popcorn\model\posts\NewsPost */ | |
$post = self::$dataMap->findById($newsId); | |
$post->setViews($post->getViews()+1); | |
self::$dataMap->save($post); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function findByHash($userId,$securityHash){ | |
$this->findByHashMemoryStatement->bindValue(':id',$userId); | |
$this->findByHashMemoryStatement->bindValue(':securityHash',$securityHash); | |
$this->findByHashMemoryStatement->execute(); | |
$userIdMemory = $this->findByHashMemoryStatement->fetch(\PDO::FETCH_COLUMN); | |
if ($userIdMemory){ | |
//Сначала проверяем существует ли hash пользователя в кэше (mysql memory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getUsersByCity($cityId, $from = 0, $count = -1){ | |
$sql = <<<SQL | |
select | |
user.* | |
from | |
pn_users user | |
join pn_users_info info on (info.id = user.userInfo) | |
where | |
info.cityId = :cityId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
#print $GLOBALS['trafapril']; | |
/* | |
print "=".$HTTP_POST_VARS["pageid1"]."=($rand)"; | |
print "=".$HTTP_POST_VARS["pageid"]."=($rand)"; | |
print "=".$HTTP_POST_VARS["pageid2"]."=($rand)"; | |
print "=$pageid/$subpageid/$page_id/$fold_id/$good_id=<br>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Данное api обеспечивает взаимодействие между мобильными приложениями (iphone,ipad,android) и backend'ом кино | |
* | |
* @date 23.07.2013 | |
* @author Колядин Алексей | |
*/ | |
ini_set('display_errors',1); | |
ini_set('html_errors',1); | |
error_reporting(E_ALL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param int $announceLength | |
* @return null|string | |
*/ | |
public function getAnnounceFriendly($announceLength = 100){ | |
$announce = trim($this->getAnnounce()); | |
$content = trim($this->getContent()); | |
$output = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function newMessageSave() { | |
$recipient = UserFactory::getUser(self::getSlim()->request()->post('recipient')); | |
$message = new Message(); | |
$message->setSentTime(new \DateTime()); | |
$message->setAuthor(UserFactory::getCurrentUser()); | |
$message->setRecipient($recipient); | |
$message->setContent(self::getSlim()->request()->post('message')); | |
$message->setRead(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$timestamp = func_get_args()[0]; | |
$month = explode(' ', 'января февраля марта апреля мая июня июля августа сентября октября ноября декабря'); | |
if ((time() - $timestamp) < 60 * 60 * 24) { | |
$out = 'сегодня, '; | |
} elseif ((time() - $timestamp) > 60 * 60 * 24 && (time() - $timestamp) < 60 * 60 * 24 * 2) { | |
$out = 'вчера, '; | |
} else { | |
$out = sprintf('%u %s %04u, ', |
OlderNewer