- 1
- 2
$arParams["SET_TITLE"] = $arParams["SET_TITLE"]!="N";
$arParams["SET_LAST_MODIFIED"] = $arParams["SET_LAST_MODIFIED"]==="Y";
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+3
$arParams["SET_TITLE"] = $arParams["SET_TITLE"]!="N";
$arParams["SET_LAST_MODIFIED"] = $arParams["SET_LAST_MODIFIED"]==="Y";
news.detail - cтандартный компонент Битрикса
+1
static function saveoprosform_ajax()
{
global $DB, $USER;
$task_id = $_REQUEST["task_id"];
$qlist = $_REQUEST["qlist"];
$sql = "DELETE FROM `tickets_qc_results` WHERE `task_id`=" . $DB->F($task_id) . ";";
$DB->query($sql);
$DB->free();
if ($task_id && $qlist) {
// другой говнокод
$sql = "INSERT INTO `tickets_qc_results`...';
$DB->query($sql);
} else {
$ret["error"] = "Недостаточно данных для выполнения операции!";
}
echo json_encode($ret);
return false;
}
Сначала удаляем, потом проверяем by ©senior shaurma developer
0
/**
* Sets the user in the token.
*
* The user can be a UserInterface instance, or an object implementing
* a __toString method or the username as a regular string.
*
* @param string|object $user The user
*
* @throws \InvalidArgumentException
*/
public function setUser($user)
{
if (!($user instanceof UserInterface || (is_object($user) && method_exists($user, '__toString')) || is_string($user))) {
throw new \InvalidArgumentException('$user must be an instanceof UserInterface, an object implementing a __toString method, or a primitive string.');
}
if (null === $this->user) {
$changed = false;
} elseif ($this->user instanceof UserInterface) {
if (!$user instanceof UserInterface) {
$changed = true;
} else {
$changed = $this->hasUserChanged($user);
}
} elseif ($user instanceof UserInterface) {
$changed = true;
} else {
$changed = (string) $this->user !== (string) $user;
}
if ($changed) {
$this->setAuthenticated(false);
}
$this->user = $user;
}
https://github.com/symfony/security-core/blob/master/Authentication/Token/AbstractToken.php#L93
+5
function is_assoc( $array ) {
return is_array($array) && substr( json_encode($array), 0, 1 ) == '{';
}
−4
Можно, я похерю Вам настроение?
Можно, я похерю Вам настроение?
+7
function redirect($url)
{
header('Location:'.$url);
echo '<script>document.location.href = \''.$url.'\';</script>';
exit;
}
+7
github.com/natribu/natribu.org
Исходники официального сайта нахуй, жесть
0
function CheckPropertyForSend(&$fields) {
if ($fields["IBLOCK_ID"] == CATALOG_ID) {
$arFilter = array("IBLOCK_ID" =>CATALOG_ID, "ID"=>$fields["ID"], "PROPERTY_NOT_ALLOWED" =>92);
$res = CIBlockElement::GetList(Array(), $arFilter);
if($res->SelectedRowsCount() == 1){
$GLOBALS['NEED_CHECK'] = true;
}else{
$GLOBALS['NEED_CHECK'] = false;
}
$prod = LenalHelp::getProductInfo($fields["ID"]);
$count = 0;
$cheked = ( $fields["PROPERTY_VALUES"][580][0]["VALUE"] == 92 ) ? true : false;
foreach ( $prod["STORES"] as $item ) {
if ( $item["PRODUCT_AMOUNT"] ) {
$count += $item["PRODUCT_AMOUNT"];
}
}
// -- убираем фдаг "нет в наличии" ---
if ( $count > 0 && $cheked ) {
$fields["PROPERTY_VALUES"][580] = "";
}
// -- устанавливаем фдаг "нет в наличии" ---
if ( $count == 0 && !$cheked ) {
$fields["PROPERTY_VALUES"][580][0]["VALUE"] = 92;
}
}
}
Платформа Битрикс, Lenal гребанные ублюдки
+2
<?if( $arResult['PROPERTIES']['NOT_ALLOWED']['VALUE'] == 'да' || $arItem["PROPERTIES"]["NOT_ALLOWED"]["VALUE_XML_ID"] == "Y" ) { ?>
<div class="alert-empty alert--licence">
<?$APPLICATION->IncludeComponent(
"bitrix:main.include",
"",
Array(
"AREA_FILE_SHOW" => "file",
"PATH" => SITE_DIR."/inc/card_not_allowed.php",
"EDIT_TEMPLATE" => ""
)
);?>
Платформа Битрикс, очередное творение Lenal в шаблоне компонента.
Сравнение значения с КИРИЛИЦЕЙ в template.php.
−3
<?php
if(!class_exists('avia_breadcrumb'))
{
class avia_breadcrumb
{
var $options;
function __construct($options = ""){
$this->options = array( //change this array if you want another output scheme
'before' => '<span class="arrow"> ',
'after' => ' </span>',
'delimiter' => '»'
);
if(is_array($options))
{
$this->options = array_merge($this->options, $options);
}
$markup = $this->options['before'].$this->options['delimiter'].$this->options['after'];
global $post;
echo '<p class="breadcrumb"><span class="breadcrumb_info">'.__('You are here:','avia_framework').'</span> <a href="'.get_bloginfo('url').'">';
bloginfo('name');
echo "</a>";
if(!is_front_page()){echo $markup;}
$output = $this->simple_breadcrumb_case($post);
echo "<span class='current_crumb'>";
if ( is_page() || is_single()) {
the_title();
}else{
echo $output;
}
echo " </span></p>";
}
function simple_breadcrumb_case($der_post)
{
global $post;
$markup = $this->options['before'].$this->options['delimiter'].$this->options['after'];
if (is_page()){
if($der_post->post_parent) {
$my_query = get_post($der_post->post_parent);
$this->simple_breadcrumb_case($my_query);
$link = '<a href="';
$link .= get_permalink($my_query->ID);
$link .= '">';
$link .= ''. get_the_title($my_query->ID) . '</a>'. $markup;
echo $link;
}
return;
}
if(is_single())
{
$category = get_the_category();
if (is_attachment()){
$my_query = get_post($der_post->post_parent);
$category = get_the_category($my_query->ID);
if(isset($category[0]))
{
$ID = $category[0]->cat_ID;
$parents = get_category_parents($ID, TRUE, $markup, FALSE );
if(!is_object($parents)) echo $parents;
previous_post_link("%link $markup");
}
}else{
$postType = get_post_type();
if($postType == 'post')
{
$ID = $category[0]->cat_ID;
echo get_category_parents($ID, TRUE, $markup, FALSE );
}
else if($postType == 'portfolio')
{
$terms = get_the_term_list( $post->ID, 'portfolio_entries', '', '$$$', '' );
$terms = explode('$$$',$terms);
echo $terms[0].$markup;
}
}
return;
}
Собственно вся суть, 2а раза генерируются, смотрел в функшин где написан код, все чисто, но все равно 2а раза генерируется
Получается грубо говоря:
You here: Home / <b>Hello world</b> / %category% / <b>Hello world</b>
Не могли бы помочь. Или куда смотреть, был бы благодарен.