- 1
if(substr($_SERVER['QUERY_STRING'],0,9)==='act=const')
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+168
if(substr($_SERVER['QUERY_STRING'],0,9)==='act=const')
Вот так мы получаем GET данные из адресной строки
+169
if(typeid(*Line1)==typeid(TLine)) ; else
if(typeid(*Line2)==typeid(TLine)) {cLine=Line1; Line1=Line2; Line2=cLine;} else
if(typeid(*Line1)==typeid(TRay)) ; else
if(typeid(*Line2)==typeid(TRay)) {cLine=Line1; Line1=Line2; Line2=cLine;} else
if(typeid(*Line1)==typeid(TLineSegment)) ; else
if(typeid(*Line2)==typeid(TLineSegment)) {cLine=Line1; Line1=Line2; Line2=cLine;}
if(typeid(*Line1)==typeid(TLine)) {
if(typeid(*Line2)==typeid(TLine)) return 1; else
if(typeid(*Line2)==typeid(TRay)) {
if(
(( ((TRay*)Line2)->X1<=((TRay*)Line2)->X2 && ((TRay*)Line2)->X1<=Point.x ) ||
( ((TRay*)Line2)->X1>=((TRay*)Line2)->X2 && ((TRay*)Line2)->X1>=Point.x )) &&
(( ((TRay*)Line2)->Y1<=((TRay*)Line2)->Y2 && ((TRay*)Line2)->Y1<=Point.y ) ||
( ((TRay*)Line2)->Y1>=((TRay*)Line2)->Y2 && ((TRay*)Line2)->Y1>=Point.y ))
)
return 1;
else
return -1;
} else
if(typeid(*Line2)==typeid(TLineSegment)) {
if(
(( ((TLineSegment*)Line2)->X1<=Point.x && Point.x<=((TLineSegment*)Line2)->X2 )||( ((TLineSegment*)Line2)->X2<=Point.x && Point.x<=((TLineSegment*)Line2)->X1 )) &&
(( ((TLineSegment*)Line2)->Y1<=Point.y && Point.y<=((TLineSegment*)Line2)->Y2 )||( ((TLineSegment*)Line2)->Y2<=Point.y && Point.y<=((TLineSegment*)Line2)->Y1 ))
)
return 1;
else
return -1;
}
} else
if(typeid(*Line1)==typeid(TRay)) {
if(typeid(*Line2)==typeid(TRay)) {
if(
((( ((TRay*)Line1)->X1<=((TRay*)Line1)->X2 && ((TRay*)Line1)->X1<=Point.x ) ||
( ((TRay*)Line1)->X1>=((TRay*)Line1)->X2 && ((TRay*)Line1)->X1>=Point.x )) &&
(( ((TRay*)Line1)->Y1<=((TRay*)Line1)->Y2 && ((TRay*)Line1)->Y1<=Point.y ) ||
( ((TRay*)Line1)->Y1>=((TRay*)Line1)->Y2 && ((TRay*)Line1)->Y1>=Point.y )))
&&
((( ((TRay*)Line2)->X1<=((TRay*)Line2)->X2 && ((TRay*)Line2)->X1<=Point.x ) ||
( ((TRay*)Line2)->X1>=((TRay*)Line2)->X2 && ((TRay*)Line2)->X1>=Point.x )) &&
(( ((TRay*)Line2)->Y1<=((TRay*)Line2)->Y2 && ((TRay*)Line2)->Y1<=Point.y ) ||
( ((TRay*)Line2)->Y1>=((TRay*)Line2)->Y2 && ((TRay*)Line2)->Y1>=Point.y )))
)
return 1;
else
return -1;
} else
if(typeid(*Line2)==typeid(TLineSegment)) {
if(
((( ((TRay*)Line1)->X1<=((TRay*)Line1)->X2 && ((TRay*)Line1)->X1<=Point.x ) ||
( ((TRay*)Line1)->X1>=((TRay*)Line1)->X2 && ((TRay*)Line1)->X1>=Point.x )) &&
(( ((TRay*)Line1)->Y1<=((TRay*)Line1)->Y2 && ((TRay*)Line1)->Y1<=Point.y ) ||
( ((TRay*)Line1)->Y1>=((TRay*)Line1)->Y2 && ((TRay*)Line1)->Y1>=Point.y )))
&&
((( ((TLineSegment*)Line2)->X1<=Point.x && Point.x<=((TLineSegment*)Line2)->X2 )||( ((TLineSegment*)Line2)->X2<=Point.x && Point.x<=((TLineSegment*)Line2)->X1 )) &&
(( ((TLineSegment*)Line2)->Y1<=Point.y && Point.y<=((TLineSegment*)Line2)->Y2 )||( ((TLineSegment*)Line2)->Y2<=Point.y && Point.y<=((TLineSegment*)Line2)->Y1 )))
)
return 1;
else
return -1;
}
return 1;
} else
if(typeid(*Line1)==typeid(TLineSegment)) {
if(
((( ((TLineSegment*)Line1)->X1<=Point.x && Point.x<=((TLineSegment*)Line1)->X2 )||( ((TLineSegment*)Line1)->X2<=Point.x && Point.x<=((TLineSegment*)Line1)->X1 )) &&
(( ((TLineSegment*)Line1)->Y1<=Point.y && Point.y<=((TLineSegment*)Line1)->Y2 )||( ((TLineSegment*)Line1)->Y2<=Point.y && Point.y<=((TLineSegment*)Line1)->Y1 )))
&&
((( ((TLineSegment*)Line2)->X1<=Point.x && Point.x<=((TLineSegment*)Line2)->X2 )||( ((TLineSegment*)Line2)->X2<=Point.x && Point.x<=((TLineSegment*)Line2)->X1 )) &&
(( ((TLineSegment*)Line2)->Y1<=Point.y && Point.y<=((TLineSegment*)Line2)->Y2 )||( ((TLineSegment*)Line2)->Y2<=Point.y && Point.y<=((TLineSegment*)Line2)->Y1 )))
)
return 1;
else
return -1;
}
Имеются классы:
class TLine; // Линия
class TRay: public TLine; // Луч
class TLineSegment: public TRay; // Отрезок
Функция записывает в Point точку пересечения прямых и возвращает 0 если прямые параллельны, -1 если пересекаются продолжения отрезков и 1 если пересекаются отрезки.
Выше представлен кусок кода где проводится проверка, принадлежит точка пересечения отрезкам или их продолжениям.
+160
<?php
if (preg_match("/\.[gjpi][ipnc][fgo]/i", $_SERVER['REQUEST_URI'])) exit;
+144
Что такое скрипт Интернет магазина?
Скрипт интернет магазина – это набор файлов, позволяющий на своем сайте
организовать онлайн магазин.
Готовый скрипт интернет магазина
Скрипт php магазина - это готовое решение для создания интернет магазина с
максимальной экономией времени и денег. Если Вам нужна быстрая и качественная
разработка интернет магазина, то готовый скрипт электронного магазина именно то,
что Вам нужно.
Источник: http://shopcms-design.ru/
Думаю, что это всё же говнокод. На языке "русский" =)
+69
/**
* Инициализация набора действий, определенных для контейнера.
* @param context
* @throws DfException
*/
protected void initializeTransitions(EditorContext context) throws DfException{
AbstractDocumentModel documentModel = getDocumentModel();
AbstractState state = documentModel.getLifeCyclePolicy(context).getState(context);
if (!documentModel.isNew())
{
addTransition(TransitionName.CREATE_DETACHED_COMMISSION, TransitionHandler.CREATE_DETACHED_COMMISSION);
addTransition(TransitionName.PRINT, TransitionHandler.PRINT);
}
AbstractTaskModel taskModel = context.getTaskModel();
if (taskModel instanceof ReviewDocumentTaskModel && !(taskModel instanceof ExpeditionaryProcessingDocumentTaskModel)){
// && !(taskModel instanceof AttachFileAndReviewDocumentTaskModel)){
if ((taskModel instanceof AttachFileToDocumentTaskModel || taskModel instanceof WaitForScanningTaskModel) && ((documentModel instanceof InternalDocumentModel) || (documentModel instanceof OutgoingDocumentModel) || (documentModel instanceof IncomingDocumentModel)))
addTransition(TransitionName.PRINT_BARCODE, TransitionHandler.PRINT_BARCODE);
if (taskModel instanceof AbstractDocumentTaskModel){
if ( state instanceof AbstractDraftState ){
if( state instanceof NewProtocolDraftState)
addTransition(ContainerAction.ACTION_NAME, TransitionName.SEND_DRAFT, TransitionName.REGISTER, TransitionHandler.SEND_DRAFT);
else if (state instanceof NewDraftState)
addTransition(TransitionName.SEND_DRAFT, TransitionHandler.SEND_DRAFT);
if (state instanceof AbstractApprovalDraftState)
addTransition(TransitionName.REWORK_DRAFT, TransitionHandler.REWORK_DRAFT);
if (state instanceof AnalyseDraftState)
addTransition(TransitionName.SEND_DRAFT, TransitionDescription.SEND_DRAFT_ANALYSE, TransitionHandler.SEND_DRAFT);
if (state instanceof ControlDraftState)
addTransition(TransitionName.SEND_DRAFT, TransitionDescription.SEND_DRAFT_CONTROL, TransitionHandler.SEND_DRAFT);
if (state instanceof ApproveDraftState)
addTransition(TransitionName.SEND_DRAFT, TransitionDescription.SEND_DRAFT_APPROVAL, TransitionHandler.SEND_DRAFT);
if (state instanceof SignDraftState)
addTransition(TransitionName.SEND_DRAFT, TransitionDescription.SEND_DRAFT_SIGN, TransitionHandler.SEND_DRAFT);
if (state instanceof ExternalApproveDraftState)
addTransition(TransitionName.SEND_DRAFT, TransitionDescription.SEND_DRAFT_APPROVAL, TransitionHandler.SEND_DRAFT);
if (state instanceof ControlApproveDraftState)
addTransition(TransitionName.SEND_DRAFT, TransitionDescription.SEND_DRAFT_CONTROLED, TransitionHandler.SEND_DRAFT);
if (state instanceof ConfirmationDraftState)
addTransition(TransitionName.SEND_DRAFT, TransitionDescription.SEND_DRAFT_CONFIRM, TransitionHandler.SEND_DRAFT);
}
}
}
.................. несколько страниц такого кода ...........................
if (state instanceof AbstractApprovalDraftState ||
state instanceof ReworkDraftState ||
state instanceof NewDocumentState ||
state instanceof RegisterDocumentState ||
state instanceof ReviewDocumentState ||
state instanceof ExecuteDocumentState){
addTransition(TransitionName.SAVE, TransitionHandler.SAVE);
}
super.initializeTransitions(context);
}
Автор решил захардкодить в одном месте логику переходов между всеми состояниями всех жизненных циклов всех документов, реализованных в системе документооборота. Получился говнокод-BPM-движок. А внешне код очень даже солидный: с константами и комментариями... и названиями классов вроде: ExpeditionaryProcessingDocumentTaskModel
+134
http://youex.ru/skins/default/pages/search/
В продолжение =)
−856
SELECT i.*, p.link as p_link, p.title as p_title, p.p_id FROM `items` i, `places` p WHERE i.public='1' and i.place=p.id and (i.place='1' or i.place='1972' or i.place='2' or i.place='3' or i.place='4' or i.place='5' or i.place='6' or i.place='7' or i.place='8' or i.place='9' or i.place='10' or i.place='11' or i.place='12' or i.place='13' or i.place='14' or i.place='15' or i.place='16' or i.place='17' or i.place='18' or i.place='19' or i.place='20' or i.place='21' or i.place='22' or i.place='23' or i.place='24' or i.place='25' or i.place='26' or i.place='27' or i.place='28' or i.place='29' or i.place='30' or i.place='31' or i.place='32' or i.place='33' or i.place='34' or i.place='35' or i.place='36' or i.place='37' or i.place='38' or i.place='39' or i.place='40' or i.place='41' or i.place='42' or i.place='43' or i.place='44' or i.place='45' or i.place='46' or i.place='47' or i.place='48' or i.place='49' or i.place='50' or i.place='51' or i.place='52' or i.place='53' or i.place='54' or i.place='55' or i.place='56' or i.place='57' or i.place='58' or i.place='59' or i.place='60' or i.place='61' or i.place='62' or i.place='63' or i.place='64' or i.place='65' or i.place='66' or i.place='67' or i.place='68' or i.place='69' or i.place='70' or i.place='71' or i.place='72' or i.place='73' or i.place='74' or i.place='75' or i.place='76' or i.place='77' or i.place='78' or i.place='79' or i.place='80' or i.place='81' or i.place='82' or i.place='83' or i.place='84' or i.place='85' or i.place='86' or i.place='87' or i.place='88' or i.place='89' or i.place='90' or i.place='91' or i.place='92' or i.place='93' or i.place='94' or i.place='95' or i.place='96' or i.place='97' or i.place='98' or i.place='99' or i.place='100' or i.place='101' or i.place='102' or i.place='103' or i.place='104' or i.place='105' or i.place='106' or i.place='107' or i.place='108' or i.place='109' or i.place='110' or i.place='111' or i.place='112' or i.place='113' or i.place='114' or i.place='115' or i.place='116' or i.place='117' or i.place='118' or i.place='119' or i.place='120' or i.place='121' or i.place='122' or i.place='123' or i.place='124' or i.place='125' or i.place='126' or i.place='127' or i.place='128' or i.place='129' or i.place='130' or i.place='131' or i.place='132' or i.place='133' or i.place='134' or i.place='135' or i.place='136' or i.place='137' or i.place='138' or i.place='139' or i.place='140' or i.place='141' or i.place='142' or i.place='143' or i.place='144' or i.place='145' or i.place='146' or i.place='147' or i.place='148' or i.place='149' or i.place='150' or i.place='151' or i.place='152' or i.place='153' or i.place='154' or i.place='155' or i.place='156' or i.place='157' or i.place='158' or i.place='159' or i.place='160' or i.place='161' or i.place='162' or i.place='163' or i.place='164' or i.place='165' or i.place='166') ORDER BY i.lastupdated DESC LIMIT 18160, 10;
есть ещё примерно такой же, но с JOINами
+144
exit; ?>
Самая последняя строчка в скрипте.
+176
$submit=($a!=0)?true:false;
if($submit==true)
{
redirect("index.php");
}
else
{
if($submit==false)
{
include_once("module.php");
}
}
железная индусская логика
+155
<?php
include "conf_db.php";
if(!empty($_REQUEST['doreg'])){
$error=array();
if(!$_REQUEST['name']) $error['name']="Имя";
if(!$_REQUEST['pass']) $error['pass']="Пароль";
if(!$_REQUEST['pass_to']) $error['pass_to']="Снова пароль";
if(!$_REQUEST['e_mail']) $error['e_mail']="E-mail";
if(!empty($error))
{
foreach ($error as $value)
{
echo "Не заполнено поле $value<br>";
}
include "form.php";
}
if(empty($error))
{
$error_to=array();
if(trim($_REQUEST['pass']) !== trim($_REQUEST['pass_to'])) $error_to['pass']="Пароли не совпадают!";
if(empty($error_to))
{
$query="select * from users where name='".$_REQUEST['name']."'";
$id=mysql_query($query)or die(mysql_error());
$arr=mysql_fetch_array($id);
if(!empty($arr)) $error_to['db']="пользователь с таким именем уже зарегистрирован!";
}
if(!empty($error_to))
{
foreach($error_to as $value)
{
echo $value;
}
include "form.php";
}
}
if(empty ($error_to) && empty($error))
{
//Здесь проверка прошла.
}
?>
Скрипт регистрации