- 1
https://github.com/imarketua/dump
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
https://github.com/imarketua/dump
Поработал на одном проекте, не оплатили. Предыстория там же, в ридми. Код знатный, подходит по тематике данного сайта, смотрим по ссылке)
+2
class Order_OrderProcessorBuilder
{
/**
* @param $processorName
* @return Order_Abstract_OrderAbstract
*/
private static function createOrderProcessor($processorName)
{
$processorClassName = 'Order_Types_'.ucfirst($processorName);
return new $processorClassName;
}
/**
* @param $builderName
* @param Order_Abstract_OrderAbstract $orderProcessor
* @return Order_Abstract_BuilderAbstract
*/
private static function createOrderBuilder($builderName, Order_Abstract_OrderAbstract $orderProcessor)
{
$builderClassName = 'Order_Builders_'.ucfirst($builderName);
return new $builderClassName($orderProcessor);
}
/**
* @param Order_Abstract_BuilderAbstract $orderBuilder
* @return Order_Director
*/
private static function createDirectorClass(Order_Abstract_BuilderAbstract $orderBuilder)
{
return new Order_Director($orderBuilder);
}
/**
* @param $orderTypeName
* @return Order_Abstract_OrderAbstract
*/
public static function build($orderTypeName)
{
/** @var Order_Abstract_OrderAbstract $orderProcessor */
$orderProcessor = self::createOrderProcessor($orderTypeName);
/** @var Order_Abstract_BuilderAbstract $orderBuilder */
$orderBuilder = self::createOrderBuilder($orderTypeName, $orderProcessor);
$director = self::createDirectorClass($orderBuilder);
$director->construct();
return $orderBuilder->getResult();
}
}
Вот такая у нас есть прослойка, которая работает с паттероном "строитель", честно говоря недавно понял зачем она нужна, не знаю.. Как вам решение? Код не мой
+2
<?php
$connect=mysql_connect('localhost', 'gvm.12', '963741258') or die(mysql_error());
mysql_select_db('gvm.12');
if(isset($_POST['enter']))
{
$login_=$_POST['login_'];
$password_=md5($_POST['password_']);
$query=mysql_query("SELECT * FROM users WHERE login='$login_'");
$user_data=mysql_fetch_array($query);
if($user_data['password']==$password_)
{
echo "You have succesfully enter";
$check=true;
}
else
{
echo "wrong login or password";
}
}
?>
Просто пиздец!
+2
public function defaultAction() {
set_time_limit(1200);
ini_set('memory_limit','4096M'); // 5 Gb
Сунь-цзы -- искусство военного обмана
+2
case 'create': {
promisesCount.create++;
try {
var data = item.data;
data.status = 'new';
data.syncItemType = item.data.itemType;
} catch (e) {
console.log('create');
console.log(e);
console.log(e.stack);
}
return new vow.Promise(function(resolve, reject){
//resolve();
app.crud.create('items', data, req.user).then(function () {
resolve();
}, function (error) {
reject(error)
});
});
}
case 'update': {
promisesCount.update++;
try{
var data = item.actual;
data.citiesPrices = item.data.citiesPrices;
if (item.actual.type == 'brick') {
for(var key in data.citiesPrices) {
data.citiesPrices[key] = item.data.citiesPrices.brickAllRegion;
}
}
data.syncItemType = item.data.itemType;
if (item.actual.type && item.actual.status == 'site') {
if (item.actual.type == 'brick') {
if (!item.data.convertion || !item.data.convertion.piecesInPalette || !item.data.convertion.piecesPerMeter) {
/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
wrongItems.push(item);
wrongItemsCount.brick++;
} else {
rightItemsCount.brick++;
data.countInPallet = item.data.convertion.piecesInPalette;
data.piecesPerMeter = item.data.convertion.piecesPerMeter;
}
} else {
if (item.data.measure && ['кв.м.', 'шт.'].indexOf(item.data.measure) != -1) {
switch(item.data.measure) {
case 'кв.м.': {
if (!item.data.convertion || !item.data.convertion.metersInPalette || !item.data.convertion.metersInBox || !item.data.convertion.metersInPiece) {
/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
wrongItems.push(item);
wrongItemsCount.clinkerItems++;
} else {
rightItemsCount.clinkerItems++;
data.countInPallet = parseInt(item.data.convertion.metersInPalette / item.data.convertion.metersInBox);
data.countInPack = parseInt(item.data.convertion.metersInBox / item.data.convertion.metersInPiece);
}
break;
}
case 'шт.': {
if (!item.data.convertion || !item.data.convertion.piecesInBox) {
/*console.log(item.actual.type, item.actual.subType, item.actual.axaptaItemId);
console.log(indexProducers[item.actual.producer].name, indexCollections[item.actual.collection].name);*/
wrongItems.push(item);
wrongItemsCount.clinkerMeters++;
} else {
rightItemsCount.clinkerMeters++;
data.countInPack = item.data.convertion.piecesInBox;
}
break;
}
}
}
}
}
} catch(e) {
console.log('update');
console.log(e);
console.log(e.stack);
}
Хороший, читабельный код от предыдущих разрабов
+2
foreach ($relations as $relation) {
$structured_relations[$relation['status_name']][] = [
'id' => $relation['sl_id'],
'status' => $relation['status'],
'status_name' => $relation['status_name'],
'parent' => $relation['parent'],
'parent_name' => $relation['parent_name'],
'customer' => $relation['customer'],
'provider' => $relation['provider'],
'admin' => $relation['admin'],
];
}
return $structured_relations;
Просто пускай полежит здесь ;)
+2
function shop_name(id){
console.log(id);
if(id==95){$(".point").text("Jeanne D'Ark");}else if(id==18){$(".point").text("ADL-Adilisik");return "ADL-Adilisik"}else if(id==92){$(".point").text("Befree");return "Befree"}else if(id==3){$(".point").text("Belladonna");return "Belladonna"}else if(id==16){$(".point").text("Bershka");return "Bershka"}else if(id==31){$(".point").text("Calliope");return "Calliope"}else if(id==37){$(".point").text("Calvin Klein");return "Calvin Klein"}else if(id==111){$(".point").text("Caterina Leman");return "Caterina Leman"}else if(id==32){$(".point").text("Colin's");return "Colin's"}else if(id==71){$(".point").text("Concept Club");return "Concept Club"}else if(id==14){$(".point").text("CONVERSE");return "CONVERSE"}else if(id==9){$(".point").text("Cop.copine");return "Cop.copine"}else if(id==34){$(".point").text("GAP ");return "GAP "}else if(id==125){$(".point").text("Glenfield");return "Glenfield"}else if(id==120){$(".point").text("SuperStep");return "SuperStep"}else if(id==75){$(".point").text("Incity");return "Incity"}else if(id==20){$(".point").text("TOPSHOP (СКОРО ОТКРЫТИЕ)");return "TOPSHOP (СКОРО ОТКРЫТИЕ)"}else if(id==96){$(".point").text("NELVA (СКОРО ОТКРЫТИЕ)");return "NELVA (СКОРО ОТКРЫТИЕ)"}else if(id==123){$(".point").text("Karen Millen");return "Karen Millen"}else if(id==77){$(".point").text("Pull and Bear ");return "Pull and Bear "}else if(id==121){$(".point").text("Lacoste");return "Lacoste"}else if(id==35){$(".point").text("Lady&gentleman CITY");return "Lady&gentleman CITY"}else if(id==110){$(".point").text("Lauren Vidal");return "Lauren Vidal"}else if(id==45){$(".point").text("Studio 77");return "Studio 77"}else if(id==19){$(".point").text("LOVE REPUBLIC");return "LOVE REPUBLIC"}else if(id==70){$(".point").text("Best Watch");return "Best Watch"}else if(id==113){$(".point").text("Mango");return "Mango"}else if(id==21){$(".point").text("MEXX");return "MEXX"}else if(id==15){$(".point").text("QUIKSILVER / ROXY ");return "QUIKSILVER / ROXY "}else if(id==7374){$(".point").text("UNIQLO ");return "UNIQLO "}else if(id==130){$(".point").text("Oasis");return "Oasis"}else if(id==69){$(".point").text("Oodji");return "Oodji"}else if(id==115){$(".point").text("Promod");return "Promod"}else if(id==76){$(".point").text("Pull and Bear");return "Pull and Bear"}else if(id==30){$(".point").text("BEBE");return "BEBE"}else if(id==108){$(".point").text("Ярмарка российских дизайнеров FASHION PROFESSION");return "Ярмарка российских дизайнеров FASHION PROFESSION"}else if(id==72){$(".point").text("Stradivarius");return "Stradivarius"}else if(id==17){$(".point").text("Terranova");return "Terranova"}else if(id==13){$(".point").text("TOM TAILOR");return "TOM TAILOR"}else if(id==116){$(".point").text("LUSIO");return "LUSIO"}else if(id==36){$(".point").text("VANS");return "VANS"}else if(id==8){$(".point").text("Victoria's Secret Beauty & Accessories");return "Victoria's Secret Beauty & Accessories"}else if(id==29){$(".point").text("Zara");return "Zara"}else if(id==91){$(".point").text("Твое");return "Твое"}else if(id==7){$(".point").text("Calipso");return "Calipso"}else if(id==126){$(".point").text("Carlo Pazolini");return "Carlo Pazolini"}else if(id==89){$(".point").text("Lady Collection");return "Lady Collection"}else if(id==88){$(".point").text("Marmalato");return "Marmalato"}else if(id==139){$(".point").text("Stroili Oro");return "Stroili Oro"}else if(id==87){$(".point").text("Parfois");return "Parfois"}else if(id==53){$(".point").text("Вуаля");return "Вуаля"}else if(id==57){$(".point").text("Mywalit");return "Mywalit"}else if(id==145){$(".point").text("МТС");return "МТС"}else if(id==127){$(".point").text("Calzedonia");return "Calzedonia"}else if(id==114){$(".point").text("Etam");return "Etam"}else if(id==148){$(".point").text("Intimissimi");return "Intimissimi"}else if(id==972){$(".point").text("Hearts of Russia");return "Hearts of Russia"}else if(id==128){$(".point").text("Дефиле");return "Дефиле"}else if(id==11){$(".point").text("Rockport");return "Rockport"}else if(id==38){$(".point").text("Эстель Адони");return "Эстель Адони"}else if(id==106){$(".point").text("Blanche et Brillante");return "Blanche et Brillante"}else if(id==137){$(".point").text("SEA OF SPA");return "SEA OF SPA"}else if(id==23){$(".point").text("M.A.C.");return "M.A.C."}else if(id==109){$(".point").text("Organic Shop");return "Organic Shop"}else if(id==22){$(".point").text("The body shop");return "The body shop"}else if(id==12){$(".point").text("Yves Rocher ");return "Yves Rocher "}else if(id==118){$(".point").text("РИВ ГОШ");return "РИВ ГОШ"}else if(id==56){$(".point").text("PANDORA");return "PANDORA"}else if(id==140){$(".point").text("Созвездие красоты");return "Созвездие красоты"}else if(id==129){$(".point").text("L'OCCITANE ");return "L'OCCITANE "}else if(id==10){$(".point").text("Swarovski");return "Swarovski"}else if(id==144){$(".point").text("Swatch");return "Swatch"}else if(id==47){$(".point").text("TONY PEROTTI");return "TONY PEROTTI"}else if(id==143){$(".point").text("НОУ-ХАУ / ИОН");return "НОУ-ХАУ / ИОН"}else if(id==85){$(".point").text("Красный куб");return "Красный куб"}else if(id==175){$(".point").text("SUNLIGHT Brilliant");return "SUNLIGHT Brilliant"}else if(id==60){$(".point").text("KFC");return "KFC"}else{
$('.point').text('');
}
}
Даже проверок на существование id нет...
+2
public static string Get(this HttpWebRequest req)
{
string res;
string ErrorCode="";
try
{
ErrorCode = "100";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "101";
Stream dataStream = response.GetResponseStream();
ErrorCode = "102";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "103";
res = sr.ReadToEnd();
ErrorCode = "104";
}
catch
{
try
{
ErrorCode = "105";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse) req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "106";
Stream dataStream = response.GetResponseStream();
ErrorCode = "107";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "108";
res = sr.ReadToEnd();
ErrorCode = "109";
}
catch
{
try
{
ErrorCode = "110";
Thread.Sleep(1000);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Thread.Sleep(1000);
ErrorCode = "111";
Stream dataStream = response.GetResponseStream();
ErrorCode = "112";
StreamReader sr = new StreamReader(dataStream, Encoding.UTF8);
ErrorCode = "113";
res = sr.ReadToEnd();
ErrorCode = "114";
}
catch
{
res = "Error doing get to " + req.RequestUri.AbsoluteUri + " ErrorCode: " + ErrorCode;
}
}
}
return res;
}
Нашел в проекте код до 2010 год, автор неизвестен :(
+2
function checkIfLogged(){
var user = localStorage.getItem('user');
if(!user) {
logout();
window.location.hash = '#/login';
return false;
} else {
return true;
}
}
+2
...
<tr>
<td class=ArtelAdminTableTdCaption>Заголовок
<td><input type=text name=f[caption] value="<?=$row['sct_caption']?>" size=50 style=width:340>
</tr>
</table>
</tr>
<tr>
<td><input type=submit name=save_Goods_supcatalog3s value="Сохранить">
</tr>
</form>
</table>
...
WOW! WOW! WOW!