- 1
- 2
${"?????"} = "Fuck my brain";
print ${"?????"};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+54.5
${"?????"} = "Fuck my brain";
print ${"?????"};
OMG it works!
Да, PHP поддерживает японский язык.
+23
<?php
class Admin_ClientsController extends Page_Controller_Admin
{
protected $_idMenu = 20;
public function init()
{
parent::init();
}
public function indexAction()
{
$this->view->scripts[] = 'jquery';
$this->view->scripts[] = 'jquery.center';
$tClients = new Db_Table_Clients();
$this->view->clients = $tClients->fetchAll('confirm = 0', 'name ASC');
$this->view->countConfirmedClients = $tClients->fetchAll('confirm = 1')->count();
$this->renderScript('body.phtml');
}
public function actionAction()
{
if ($this->_request->isPost()) {
$clientId = $this->_request->getPost();
$action = $clientId['action'];
$tClients = new Db_Table_Clients();
unset($clientId['action']);
foreach($clientId as $key => $value) {
echo $value;
if ($action == 'confirm') {
$tClients->update(array('confirm' => 1), 'id = ' . $value);
$client = $tClients->fetchRow('id = ' . $value);
$this->view->dealer = new Zend_Mail('windows-1251');
$mail = new Zend_Mail('windows-1251');
$mail->addTo($this->view->dealer->email);
$mail->setFrom('[email protected]', '');
$mail->setSubject('Регистрация нового дилера на сайте компании Оконные технологии');
$mail->setBodyHtml($this->view->render('clients/email.phtml'), 'windows-1251', Zend_Mime::ENCODING_8BIT);
//$tr = new Zend_Mail_Transport_Smtp('mail.hostland.ru');
//Zend_Mail::setDefaultTransport($tr);
try {
$mail->send();
} catch (Exception $e)
{
}
} elseif ($action == 'delete') {
$tClients->delete('id = ' . $value);
} elseif ($action == 'allow') {
$tClients->update(array('access' => 1), 'id = ' . $value);
} elseif ($action == 'denied') {
$tClients->update(array('access' => 0), 'id = ' . $value);
}
}
$this->_redirect($_SERVER['HTTP_REFERER']);
}
$this->_redirect('/admin/clients/');
}
public function confirmAction()
{
if ($this->_request->isPost()) {
$clientId = $this->_request->getPost();
var_dump($clientId);
$tClients = new Db_Table_Clients();
foreach($tClients as $key => $value) {
$tClients->update(array('confirm' => 1), 'id = ' . $value);
}
}
//$this->_redirect('/admin/clients/');
}
public function editAction()
{
$id = $this->_request->getParam('id');
if ($id == null) {
return $this->_redirect('/admin/clients/');
}
$tClients = new Db_Table_Clients();
if ($this->_request->isXmlHttpRequest()) {
$this->view->client = $tClients->fetchRow('id = ' . $id);
} elseif ($this->_request->isPost()) {
$name = $this->_request->getPost('name', '');
$login = $this->_request->getPost('login', '');
$password = $this->_request->getPost('password', '');
$description = $this->_request->getPost('description');
$email = $this->_request->getPost('email');
$access = $this->_request->getPost('access', 0);
if ($name == null or $password == null) {
$messager = new Zend_Session_Namespace('messager');
$messager->error = 'Поле «Имя» и «Пароль» должны быть заполнены';
} else {
+27
volumes = new List<VolumeInformation>(ServerTypedProxy.GetUnfilteredVolumeInformationList())
.ConvertAll<BindableVolumeInfo>(delegate(VolumeInformation vi) { return new BindableVolumeInfo(vi); });
Из разряда попробуй отдебажь
[Ф]
+21
TabToShow currentTabToShowInShortForm = tab;
string currentTemplateNameToShowInShortForm = templateName;
currentShortFormToShow = new ShortForm(currentTabToShowInShortForm, currentTemplateNameToShowInShortForm);
Чем длиннее названия переменных, тем солиднее выглядит код
[Ф]
+26
if (Program.showLoginDialog &&
clientVersion != serverVersion &&
DialogResult.No == MessageBox.Show
(
String.Format
(
"The version {0} of the Server does not match the version of the Client {1}. Would you like to proceed?",
serverVersion, clientVersion
),
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning
)
)
MessageBox показывается в if
[Ф]
+16.8
return typeof(Nullable<>).MakeGenericType(new Type[] { valueType }).GetConstructor(new Type[] { valueType }).Invoke(new object[] { value });
У афтора было желание сэкономить строчки кода
[Ф]
+28.7
function table_exists($table) {
self :: query("show tables from ".DB_NAME);
for ($i = 0; $i < self :: num(); $i++) {
$res = mysqli_fetch_array($this -> result);
if ($res[0] == DB_PREFIX . $table) {
return true;
}
}
return false;
}
+25
DateTime startTime = DateTime.Now;
DateTime endTime = DateTime.Now;
foreach (BillablePhas bi in CreateBillablePhaseForFixedPrice.Phases)
{
if (BillablePhase.Equals(bi))
{
errorLbl.Visible = true;
savedLbl.Visible = false;
TimeSpan spread = endTime - startTime; //пик быдлокода
bi.RatioSpredDateTime = Math.Ceiling(Convert.ToDouble(spread.Days*bi.Ratio/100));
}
}
endTime - startTime АААА!!!
+15
if (ValidatorBillablePhase())
{
// строк 40-50 кода
}
private static bool ValidatorBillablePhase()
{
return true;
}
я в шоке от такой валидации ;-)
+3
public void SetDirty()
{
ViewState.SetDirty(false);
}
Отличное название для функции ;-)