- 1
- 2
- 3
- 4
- 5
- 6
- 7
if($upload) { $ftpsucc=1; } else { $ftpsucc=0; }
// check upload status:
print (!$upload) ? 'Cannot upload' : 'Upload complete';
print "\n";
// close the FTP stream
ftp_close($conn_id);
?>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+155
if($upload) { $ftpsucc=1; } else { $ftpsucc=0; }
// check upload status:
print (!$upload) ? 'Cannot upload' : 'Upload complete';
print "\n";
// close the FTP stream
ftp_close($conn_id);
?>
Из комментариев php.net. Переменная $ftpsucc далее не используется.
−124
sub WidthOf()
{
my %WIDTHES =('90','195','118','165', ... over9000 ...'43','255');
my $TextWidth;
map {$TextWidth += $WIDTHES{ord $_} || 200} split //,@_[0];
return $TextWidth;
}
−106
# progress bar
width = 60 # width of bar
com = 540 # input data
pr = com * 0.01
i = 0
j = width
v = 1
puts
while pr <= com
print "\r#{v}% [#{"|"*i}#{" "*j}]"
pr += com * 0.01
i += width * 0.01
j -= width * 0.01
v += 1
sleep(0.01)
end
puts
Консольный прогресс-бар.
+164
if (VDIC_web_form_address.match(regWFAcustom))
{
URLDecode(VDIC_web_form_address,'YES');
TEMP_VDIC_web_form_address = decoded;
TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, '');
}
else
{
web_form_vars =
"&lead_id=" + document.vicidial_form.lead_id.value +
"&vendor_id=" + document.vicidial_form.vendor_lead_code.value +
"&list_id=" + document.vicidial_form.list_id.value +
"&gmt_offset_now=" + document.vicidial_form.gmt_offset_now.value +
"&phone_code=" + document.vicidial_form.phone_code.value +
"&phone_number=" + document.vicidial_form.phone_number.value +
"&title=" + document.vicidial_form.title.value +
"&first_name=" + document.vicidial_form.first_name.value +
"&middle_initial=" + document.vicidial_form.middle_initial.value +
"&last_name=" + document.vicidial_form.last_name.value +
"&address1=" + document.vicidial_form.address1.value +
"&address2=" + document.vicidial_form.address2.value +
"&address3=" + document.vicidial_form.address3.value +
"&city=" + document.vicidial_form.city.value +
"&state=" + document.vicidial_form.state.value +
"&province=" + document.vicidial_form.province.value +
"&postal_code=" + document.vicidial_form.postal_code.value +
"&country_code=" + document.vicidial_form.country_code.value +
"&gender=" + document.vicidial_form.gender.value +
"&date_of_birth=" + document.vicidial_form.date_of_birth.value +
"&alt_phone=" + document.vicidial_form.alt_phone.value +
"&email=" + document.vicidial_form.email.value +
"&security_phrase=" + document.vicidial_form.security_phrase.value +
"&comments=" + document.vicidial_form.comments.value +
"&user=" + user +
"&pass=" + pass +
"&campaign=" + campaign +
"&phone_login=" + phone_login +
"&original_phone_login=" + original_phone_login +
"&phone_pass=" + phone_pass +
"&fronter=" + fronter +
"&closer=" + user +
"&group=" + group +
"&channel_group=" + group +
"&SQLdate=" + SQLdate +
"&epoch=" + UnixTime +
"&uniqueid=" + document.vicidial_form.uniqueid.value +
"&customer_zap_channel=" + lastcustchannel +
"&customer_server_ip=" + lastcustserverip +
"&server_ip=" + server_ip +
// ...еще строчек 30...
"&user_custom_five=" + VU_custom_five + '' +
"&preset_number_a=" + CalL_XC_a_NuMber + '' +
"&preset_number_b=" + CalL_XC_b_NuMber + '' +
"&preset_number_c=" + CalL_XC_c_NuMber + '' +
"&preset_number_d=" + CalL_XC_d_NuMber + '' +
"&preset_number_e=" + CalL_XC_e_NuMber + '' +
"&preset_dtmf_a=" + CalL_XC_a_Dtmf + '' +
"&preset_dtmf_b=" + CalL_XC_b_Dtmf + '' +
webform_session;
var regWFspace = new RegExp(" ","ig");
web_form_vars = web_form_vars.replace(regWF, '');
var regWF = new RegExp("\\`|\\~|\\:|\\;|\\#|\\'|\\\"|\\{|\\}|\\(|\\)|\\*|\\^|\\%|\\$|\\!|\\%|\\r|\\t|\\n","ig");
web_form_vars = web_form_vars.replace(regWFspace, '+');
web_form_vars = web_form_vars.replace(regWF, '');
var regWFAvars = new RegExp("\\?","ig");
if (VDIC_web_form_address.match(regWFAvars))
{web_form_vars = '&' + web_form_vars}
else
{web_form_vars = '?' + web_form_vars}
TEMP_VDIC_web_form_address = VDIC_web_form_address + "" + web_form_vars;
var regWFAqavars = new RegExp("\\?&","ig");
var regWFAaavars = new RegExp("&&","ig");
TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAqavars, '?');
TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAaavars, '&');
}
+161
var BrowseWidth = 0;
var BrowseHeight = 0;
function getInsideBrowse()
{
var ns = navigator.appName == "Netscape";
if (ns)
{
BrowseWidth = window.innerWidth;
BrowseHeight = window.innerHeight;
}
else
{
BrowseWidth = document.body.clientWidth;
BrowseHeight = document.body.clientHeight;
}
}
function browser_dimensions()
{
getInsideBrowse();
document.vicidial_form.JS_browser_width.value = BrowseWidth;
document.vicidial_form.JS_browser_height.value = BrowseHeight;
}
+120
if (clr1 != Color.Black && clr2 != Color.Black)
{
int R1 = clr1.R > clr2.R ? clr1.R - 1 : clr1.R + 1;
int R2 = clr1.R < clr2.R ? clr1.R - 1 : clr1.R + 1;
int G1 = clr1.G > clr2.G ? clr1.G - 1 : clr1.G + 1;
int G2 = clr1.G < clr2.G ? clr1.G - 1 : clr1.G + 1;
int B1 = clr1.B > clr2.B ? clr1.B - 1 : clr1.B + 1;
int B2 = clr1.B < clr2.B ? clr1.B - 1 : clr1.B + 1;
if (R1 > 255) R1 = 255; if (R1 < 0) R1 = 0;
if (R2 > 255) R2 = 255; if (R2 < 0) R2 = 0;
if (G1 > 255) G1 = 255; if (G1 < 0) G1 = 0;
if (G2 > 255) G2 = 255; if (G2 < 0) G2 = 0;
if (B1 > 255) B1 = 255; if (B1 < 0) B1 = 0;
if (B2 > 255) B2 = 255; if (B2 < 0) B2 = 0;
outp.b = Color.FromArgb(R1, G1, B1); outp.a = Color.FromArgb(R2, G2, B2);
}
Нашёл у себя такого красавца годичной давности - суровое "плавное" целочисленное интерполирование двух цветов для Compact Framework.
+165
/*
* Корректировка даты.
* если дата в будущем - то показываем сегодня.
*/
$row['created'] = ( strtotime( date("Y-m-d", strtotime($row['created'])) ) > strtotime( date("Y-m-d") ) )?
date("r")
: date("r", strtotime($row['created']));
4x4 off-road racing...
+165
//ip address checking function
//for real use should have a return value but example code
function testipaddress ($nametotest) {
$ipaddress = $nametotest;
$ipaddress = gethostbyname($nametotest);
if ($ipaddress == $nametotest) {
echo "No ip address for host, so host "
. "not currently available in DNS and "
. "probably offline for some time<BR>";
}
else {
echo "good hostname, ipaddress = $ipaddress<BR>";
}
}
Пользовательские комментарии на php.net - это тот ещё кладезь.
http://www.php.net/manual/en/function.gethostbyname.php
+158
function make_category_select($name,$selected='',$not='',$additional='')
{
global $udb,$admin,$evoLANG,$cat_cache;
$this->parent_name = $this->parent_name != "" ? $this->parent_name : $evoLANG['noparent'];
if ($this->onlyoptions != 1)
{
$a .= "<select name=\"".$name."\" ".$additional.">\n";
}
$a .= '<option value=""> '.$this->parent_name." </option>\n";
$a .= $this->make_cat_options('0',$selected,1,$not);
if ($this->onlyoptions != 1)
{
$a .= '</select>';
}
return $a;
}
+76
public void run() {
try {
System.out.println("START QUOTE RECEIVER SERVER SOCKET..............");
try
{
Thread.sleep(5000);
}
catch (Exception ex) {}
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
ServerSocket serverSocket = new ServerSocket(port);
while (!isInterrupted()) {
new RemoteDataReceiver(serverSocket.accept());
}
serverSocket.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
Русская синхронизация. Бессмысленная и беспощадная...