Mistři v programování na #hovnokod

Perlicka z Nette, metoda v modeli, preco nie ked mozes...

public function saveUserRegistrationRequest($values, &$presenter) {

Anonymous,

Dalsia perlicka z Nette. Fc mkdir padne napr. pre nedostatocne prava, ale vdaka hovnokodu sa to nedozviem. Naviac, adresar sa nepodari vytvorit, napriek tomu pokracuje a kopiruje do neho subor... Cista fuserina :(

/**
 * Move uploaded file to new location.
 * @param  string
 * @return static
 */
public function move($dest)
{
    @mkdir(dirname($dest), 0777, TRUE); // @ - dir may already exist
    @unlink($dest); // @ - file may not exists
    if (!call_user_func(is_uploaded_file($this->tmpName) ? 'move_uploaded_file' : 'rename', $this->tmpName, $dest)) {
        throw new Nette\InvalidStateException("Unable to move uploaded file '$this->tmpName' to '$dest'.");
    }
    @chmod($dest, 0666); // @ - possible low permission to chmod
    $this->tmpName = $dest;
    return $this;
}

Anonymous,

Jak rozpoznt, zda kod bezi pod linuxem nebo po widlemi :D

if (DIRECTORY_SEPARATOR == '/') {
    // linux
}

if (DIRECTORY_SEPARATOR == '\\') {
    // windows
}

Anonymous,

$instance = $instanceAbbreviation !== null ? $instanceAbbreviation : ($instanceLabel !== null ? $instanceLabel : null);

Anonymous,

Kazdy si nieco prihpodil...

if ($not_send_si != $check_status["not_send_si"] || $send_si != $check_status["send_si"] || $sOldDeliveryMalaysia != $sNewDeliveryMalaysia || count($update_info_payment_bankslip) > 0 || $statusChanged || $comments !== '' || $notices != $check_status['notices'] || ($check_status['reminder_hold_date'] ? $check_status['reminder_hold_date'] : 'null') != $reminder_hold_date || ($check_status['send_not_earlier'] ? $check_status['send_not_earlier'] : 'null') != $send_not_earlier || ($check_status['report_lock_date'] ? true : false) != $report_lock || ($check_status['send_partially'] ? true : false) != $send_partially || $add_to_db != $check_status['add_to_db'] || $order_by_phone != $check_status['order_by_phone'] || $invoice_by_tradedoubler != $check_status['invoice_by_partner'] || $port_payer != $check_status['port_payer'] || array_sum($update_info_payment_code) != $check_status['paid_amount']) {...}

Anonymous,