- 1
- 2
- 3
- 4
- 5
if (auth_exit_callback != undefined)
{
auth_exit_callback = undefined;
auth_exit_callback();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+47.9
if (auth_exit_callback != undefined)
{
auth_exit_callback = undefined;
auth_exit_callback();
}
Вызов колбэка и обнуление ссылки на него
+47.7
if (is_null($title) == TRUE) $title = ' / '. $title;
+47
int sync1; sync1 = 50;
int sync[sync1];
for (i=0; i<50; i++) {
sync[i] = 0;
}
+47
function executeNewsRightRelated(sfWebRequest $request)
{
$siteId = $request->getParameter('site')->id;
$tNewsList = $this->object->News;
$newsList = array();
foreach ($tNewsList as $news) {
$ids = array();
foreach ($news->Sites as $idModel) {
$ids[] = $idModel->id;
}
if (in_array($siteId, $ids)) {
$newsList[] = $news;
}
}
$this->newsList = $newsList;
}
+47
# GET /dialog([0-9]+)
Public Static Function Dialog($senderId){
$user = Session::Restore();
IF($user){
$users = Collection::Get('users', 'UserModel');
$sender = $users->Find( Query::Equal('id', $senderId) );
IF(sizeof($sender) > 0){
$sender = $sender[0];
$profile_view = self::Profile($sender->id);
$mails = Collection::Get('mail', 'MailModel');
$in = $mails->Find( Query::All( Query::Equal( 'tid', $user->id ), Query::Equal('fid', $sender->id) ) );
$out = $mails->Find( Query::All( Query::Equal( 'fid', $user->id ), Query::Equal('tid', $sender->id) ) );
$dialog = array();
ForEach($in as $inMsg){
IF(!$inMsg->read)
{
$inMsg->read = 1;
$inMsg->save();
}
}
ForEach( $in as $message ){
IF(!isset($dialog[$message->time]))
$dialog[$message->time] = array();
$dialog[$message->time][] = array('type'=>'in', 'message'=>$message);
}
ForEach( $out as $message ){
IF(!isset($dialog[$message->time]))
$dialog[$message->time] = array();
$dialog[$message->time][] = array('type'=>'out', 'message'=>$message);
}
ksort($dialog);
$profile_view->Set('ProfileContent', 'dialog.php')->Set('dialog', $dialog);
return $profile_view;
}
throw new ForbiddenException( l('Sender is not found') );
}
throw new ForbiddenException( l('User is not authenticated') );
}
+47
if($choice_product == 39.90)
{
include('monthly_recurring/subscription_create.php');
}
if($choose_shipping == '0.00')
{
$choose_shipping_recur = 9.99;
}
if($choose_shipping == 'Canada')
{
$choose_shipping_recur = 0;
}
if($choose_shipping == '25.00')
{
$choose_shipping_recur = 25;
}
if($choose_shipping == '55.00')
{
$choose_shipping_recur = 55;
}
+47
private function getLastDate($year, $month)
{
$next_year = $year;
$next_month = $month + 1;
if ($next_month == 13) {
$next_month = 1;
$next_year++;
}
$next_time = mktime(0, 0, 0, $next_month, 1, intval($next_year));
$lastdate = strtotime('-1 day', $next_time);
$last_day = date('d', $lastdate);
return $last_day;
}
date('t', strtotime("$year-$month-01"));
+47
if ($num_rows2>0) {
$raw2=mysql_fetch_array($sth2, MYSQL_ASSOC);
$desc=$raw2['desc'];
$sector = "$desc";//O-o-o!
}
//далее $desc нигде не используется, равно как и $raw2
//и ещё:
$sid=$raw['id'];
$sector=$raw['sector'];
$selind='';
if ($sector==$sid) { $selind='selected'; }
echo "<option value='$sid' $selind >$sector</option>";
//и так по всему коду
//А ЭТО вместо темплэйта от 30 до 150 include за один раз с огрызками HTML и PHP
<?php
require_once('includes/core.php'); // connection, config
$is_index_page = true; // add this variable to check that we are on default index page (#2907)
require_once('header.php');
require_once('menu.php');
include('homepage.php');
. . .
. . .
require_once('footer.php');
?>
Реальный кусок Хадж-кода. В комплекте более 3500 файлов перекрёстно инклюдящих друг друга. Действительно "Индусский код" оплачивается построчно..., дёшево, долго, сердито.
+47
$cc = str_replace('`','',str_replace("'","",str_replace('"','',strip_tags($_REQUEST['c_code']))));
Регулярные выражения? Не, не слышал
+47
mysql_query ("INSERT INTO mr_costadvtxt VALUES ('LAST_INSERT_ID(id+1)','$itemid','$kindofstr','$size', '$size_count','$pricered','$fordisc','$disc','$scheme_name','$pnum')") or die(mysql_error());