- 1
- 2
- 3
- 4
select value, value_type from b_iblock_element_property WHERE id = **;
b_iblock_element_property.value: a:2:{s:4:"TYPE";s:4:"text";s:4:"TEXT";s:17:"Хорошее состояние";}
b_iblock_element_property.value_type: textНашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
select value, value_type from b_iblock_element_property WHERE id = **;
b_iblock_element_property.value: a:2:{s:4:"TYPE";s:4:"text";s:4:"TEXT";s:17:"Хорошее состояние";}
b_iblock_element_property.value_type: textbitrix <3
+2
$model->attributes = $_POST[$class];
// костыль на ajax валидацию и отправку файлов
$save = isset($_GET['notsave']) ? false : true;
if ($save) {видимо автор кода соглашается с "хорошим" решением...
0
$collections = Yii::app()->db->createCommand()
    ->selectDistinct('prod.product_id,cc.category_id AS id, cc.code AS code,cc.img AS '
        . 'pic,cc.category_name AS name, pl.category_name AS ln_name, '
        . 'fvs.value AS country,c2.category_name AS parent_category,'
        . 'c2.category_id AS p_id, c2.code AS p_code')
// ->select()
    ->from('Products prod')
    ->join('Products_Categoryes pc', 'prod.product_id = pc.product_id')
    ->join('Categories c', 'c.category_id = pc.category_id')
    ->join('Products_Categoryes ppp', 'ppp.category_id = c.category_id')
    ->join('Products p', 'p.product_id = ppp.product_id')
    ->join('Products_Categoryes pppccc', 'pppccc.product_id = ppp.product_id ')
    ->join('Categories cc', 'cc.category_id = pppccc.category_id
AND cc.category_left > :cat_left
AND cc.category_right < :cat_right
AND cc.category_level = 3', array(':cat_left' => $brends['category_left'], ':cat_right' => $brends['category_right']))
    ->join('Categories c2', 'cc.category_left > c2.category_left
AND cc.category_right < c2.category_right
AND c2.category_level = cc.category_level - 1')
    ->leftJoin('kk_categories_ln pl', ' pl.ln_id = :ln '
        . 'AND pl.category_id = cc.category_id', array(':ln' => $ln_id))
    ->leftJoin('Feature_Product_Values fpv', 'p.product_id = fpv.product_id '
        . 'AND feature_id = :country_id ', array(':country_id' => $counrty_id))
    ->leftJoin('Feature_Values_string fvs', 'fvs.feature_id = fpv.feature_id')
    ->group('cc.category_id')
    ->where($where, $params)
    ->queryAll();
+7
//скрытно убираем левых гидов по их ид. Id с релиза.
        $select->where('self.id NOT IN (
                    1054063,
                    1054065,
                    1054232,
                    1054233,
                    1054220,
                    1054213,
                    1054212,
                    1054201,
                    1054199,
                    1054198,
                    1054197,
                    1054053,
                    1054058,
                    1054395,
                    1054445,
                    1054069,
                    1055221,
                    1055241,
                    1055386,
                    1055405,
                    1055406,
                    1055407,
                    1055408,
                    1055409,
                    1055410,
                    1055411,
                    1055412,
                    1054279,
                    1055259,
                    1054066,
                    1054067,
                    1054068,
                    1054070,
                    1054072,
                    1054075,
                    1054064,
                    1054073,
                    1054059,
                    1054060,
                    1054061,
                    1054062,
                    1054071,
                    1054077,
                    1054078,
                    1054079,
                    1054080,
                    1054081,
                    1054187,
                    1054128,
                    1054144,
                    1054129,
                    1054082,
                    1054076,
                    1054119,
                    1054118,
                    1054117,
                    1054116,
                    1054108,
                    1054106,
                    1054103,
                    1054111,
                    1054113,
                    1054102,
                    1054100,
                    1054098,
                    1054096,
                    1054095,
                    1054094,
                    1054093,
                    1054092,
                    1054120,
                    1054152,
                    1054150,
                    1054149,
                    1054148,
                    1054142,
                    1054141,
                    1054140,
                    1054139,
                    1054143,
                    1054138,
                    1054137,
                    1054136,
                    1054130,
                    1054126,
                    1054125,
                    1054186,
                    1054185,
                    1054184,
                    1054158,
                    1054182,
                    1054181,
                    1054180,
                    1054179,Это код из контроллера. И это примерно 1/20 всей простыни.
0
public function callCost($fromCity, $fromStreet, $fromHouse, $fromHousing, $fromBuilding, $fromPorch, $fromLat, $fromLon, $toCity, $toStreet, $toHouse, $toHousing, $toBuilding, $toPorch, $toLat, $toLon, $clientName, $phone, $priorTime, $customCarId, $customCar, $carType, $carGroupId, $tariffGroupId, $comment, $additional = '')
    {
        if ($json = $this->reqCache->getValue($fromLat . $fromLon . $toLat . $toLon . $phone . $priorTime . $tariffGroupId . $comment . $additional)) {
            $data = json_decode($json);
            return $data;
        } else {
			$tariffGroupId = $this->findTariffOnCarType($carType);
			$additional = explode(';', $additional);
			$route = new TaxiRouteAnalyzer($this->dbHost, $this->database, $this->dbLogin, $this->dbPass);
			$this->writeLog($tariffGroupId);
			$data = $route->analyzeRoute(1, $fromCity, $fromStreet, $fromHouse, $fromHousing, $fromLat, $fromLon, $toCity, $toStreet, $toHouse, $toHousing, $toLat, $toLon, $additional, $tariffGroupId, $this->isDay(), 1);
            $res = json_encode($data);
            $this->reqCache->setValue($fromLat . $fromLon . $toLat . $toLon . $phone . $priorTime . $tariffGroupId . $comment . $additional, $res, $this->cacheTime);
			return $data; 
        }
    }человеку доверили сделать кэширование данных...
+1
var cloths = {
  <?php foreach ($clothList as $cloth): ?>
    "<?=$cloth->id()?>": {
      "id": <?=$cloth->id()?>,
      "name": "<?=$cloth->name()?>",
      "public_name": "<?=str_replace('"', '\"', $cloth->public_name())?>"
    },
  <?php endforeach; ?>
  "dummy": {}
};
+2
if (!$subscription) {
    return $this->redirect(['action' => 'cancel_success']);
    throw new BadRequestException();
}
+2
https://toster.ru/q/274179Ученики Mr.Shit (беднягу зачмырили и он сменил домен на php. webtm.ru) продолжают радовать
+5
$scales = db_select('_scale', 'q')
        ->condition('q.gender', $gender)
        ->fields('q', array('id'))
        ->execute();
    $i = 1;
    while ($scale = $scales->fetchObject()) {
        $raw_score = 0;
        $query = db_select('_scale_question', 'q')
            ->condition('q.scale_id', $scale->id)
            ->fields('q')
            ->execute();
        while ($item = $query->fetchObject()) {
            $user_answer = db_select('_user_answer', 'q')
                ->condition('q.question_id', $item->question_id)
                ->condition('q.result_id', $result_id)
                ->fields('q', array('answer'))
                ->execute()
                ->fetchField();
            if ($user_answer == $item->expected_answer) {
                $raw_score++;
            }
        }
        $raw_scores_item['scale_id'] = $scale->id;
        $raw_scores_item['score'] = $raw_score;
        $raw_scores[$i] = $raw_scores_item;
        $i++;
    }
            Drupal 7, SQL-запросы с DB API Drupal в двойном цикле(!).
...А заменить можно 1 нормальным SQL-запросом.
        
+1
If (!isset($_GET['mode']) || !ereg("^[a-z0-9_-]{1,15}$",$_GET['mode'])) $mode='read'; else $mode=$_GET['mode'];
switch ($mode){Как же я люблю в говнодвигах ковырятся Гг