- 1
- 2
- 3
- 4
- 5
- 6
function _taxonomy_image_exists($tid) {
if (db_fetch_object(db_query('SELECT path FROM {term_image} WHERE tid=%d', $tid))) {
return TRUE;
}
return FALSE;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 35
−15
function _taxonomy_image_exists($tid) {
if (db_fetch_object(db_query('SELECT path FROM {term_image} WHERE tid=%d', $tid))) {
return TRUE;
}
return FALSE;
}
+28
function _spb_similar_similar_video_html(&$item, $key) {
$item = htmlspecialchars($item, ENT_NOQUOTES);
}
+26
$sql_s = db_query("SELECT tns.nid FROM {term_node} AS tns INNER JOIN {term_data} AS tds WHERE tns.tid = tds.tid AND tds.tid = %d GROUP BY tns.nid", $tid_s);
while ($res_s = db_fetch_object($sql_s)){
$sql = db_query("SELECT td.tid, td.name, td.vid FROM {term_node} AS tn INNER JOIN {term_data} AS td WHERE tn.tid = td.tid AND tn.nid = %d", $res_s->nid);
while ($res = db_fetch_object($sql)){
$opt[$res->vid][$res->tid] = $res->name;
}
}
что только не сделаешь чтобы не научиться писать запросы вместо копипаста чужих.
кто не понял - нод в первом запросе может быть мнооооого :)
+29
function multiselect_widget_init() {
if(variable_get('multiselect_widget_activeselall', false) === true && (variable_get('multiselect_widget_url', 'all') == 'all' || strstr($_GET['q'], variable_get('multiselect_widget_url', 'all')) !== FALSE)){
drupal_add_css(drupal_get_path('module', 'multiselect_widget') .'/multiselect/jquery.multiSelect.css');
drupal_add_js(drupal_get_path('module', 'multiselect_widget') .'/multiselect/jquery.multiSelect.js');
drupal_add_js(drupal_get_path('module', 'multiselect_widget') .'/multiselect/customSelect.jquery.js');
drupal_add_js(drupal_get_path('module', 'multiselect_widget') .'/multiselect/jquery.bgiframe.min.js');
$selectall = variable_get('multiselect_widget_selall', 'false') ? 'true' : 'false';
drupal_add_js("$(document).ready(function(){
$('#edit-tid').customStyle();
});", 'inline');
drupal_add_js("$(document).ready( function() {
$('".variable_get('multiselect_widget_selector', '.views-exposed-form select[multiple="multiple"]')."').multiSelect({
selectAll: ".$selectall.",
selectAllText: '".variable_get('multiselect_widget_selalltext', 'Выбрать все')."',
noneSelected: '".variable_get('multiselect_widget_notselectedtext', 'Ничего не выбрано')."',
oneOrMoreSelected: '".variable_get('multiselect_widget_countselected', 'Выбрано: %')."'
});
});", 'inline');
}
}
не мог не удержаться...
+24
function on_record(status)
{
// Ext.MessageBox.prompt('Name', 'Please enter your name:', 1);
var label = form2label();
if(label['answers'][10]==1&&label['start']=='1970-01-01 03:00:00'&&label['order_num']!='1'){
label['start'] = get_starttime_mysql();
}
else if(label['answers'][10]==2&&label['start']=='1970-01-01 03:00:00'){
label['start'] = get_finishtime_mysql();
}
label['status'] = status;
save_label(label);
}
превед.
+38
$t='array(';
foreach ($info as $k=>$v){
$t.='"'.$k.'"=>"'.mysql_escape_string(htmlspecialchars($v)).'"';
if ($i<($cnt-1)) $t.=',';
$i++;
}
$t.=')';
if ($labelingid) sql ("UPDATE labeling SET info='$t' WHERE id='$labelingid'");
Хрясь!
+30
$files = file_scan_directory(dirname(__FILE__) .'/modes/', '^([^\.].*)\.inc$', array('.', '..', 'CVS'), 0, FALSE);
foreach ($files as $file) {
require_once($file->filename);
$mode = $file->name;
if (function_exists('advpoll_info_'. $mode)) {
$advpoll_modes[$mode] = call_user_func('advpoll_info_'. $mode);
}
}
+36
$kd = strrpos("$fotofilenames[$i]", ".");
$kf = substr("$fotofilenames[$i]", $kd+1, strlen("$fotofilenames[$i]")-$kd);
$kf = strtolower($kf);
вот так и живем.
Специальная олимпиада по программированию для программистов PHP, VB и 1c (c)
+36
function utf8win ($strin) {
$strin = ereg_replace("а","а",$strin);
$strin = ereg_replace("б","б",$strin);
$strin = ereg_replace("в","в",$strin);
$strin = ereg_replace("г","г",$strin);
$strin = ereg_replace("д","д",$strin);
$strin = ereg_replace("е","е",$strin);
$strin = ereg_replace("ё","ё",$strin);
$strin = ereg_replace("ж","ж",$strin);
$strin = ereg_replace("з","з",$strin);
$strin = ereg_replace("и","и",$strin);
$strin = ereg_replace("й","й",$strin);
$strin = ereg_replace("к","к",$strin);
$strin = ereg_replace("л","л",$strin);
$strin = ereg_replace("м","м",$strin);
$strin = ereg_replace("н","н",$strin);
$strin = ereg_replace("о","о",$strin);
$strin = ereg_replace("п","п",$strin);
$strin = ereg_replace("р","р",$strin);
$strin = ereg_replace("с","с",$strin);
$strin = ereg_replace("т","т",$strin);
$strin = ereg_replace("у","у",$strin);
$strin = ereg_replace("ф","ф",$strin);
$strin = ereg_replace("х","х",$strin);
$strin = ereg_replace("ц","ц",$strin);
$strin = ereg_replace("ш","ш",$strin);
$strin = ereg_replace("щ","щ",$strin);
$strin = ereg_replace("ъ","ъ",$strin);
$strin = ereg_replace("ь","ь",$strin);
$strin = ereg_replace("э","э",$strin);
$strin = ereg_replace("ю","ю",$strin);
$strin = ereg_replace("я","я",$strin);
$strin = ereg_replace("ч","ч",$strin);
$strin = ereg_replace("ы","ы",$strin);
$strin = ereg_replace("А","А",$strin);
$strin = ereg_replace("Б","Б",$strin);
$strin = ereg_replace("В","В",$strin);
$strin = ereg_replace("Г","Г",$strin);
$strin = ereg_replace("Д","Д",$strin);
$strin = ereg_replace("Е","Е",$strin);
$strin = ereg_replace("Ж","Ж",$strin);
$strin = ereg_replace("З","З",$strin);
$strin = ereg_replace("И","И",$strin);
$strin = ereg_replace("Й","Й",$strin);
$strin = ereg_replace("К","К",$strin);
$strin = ereg_replace("Л","Л",$strin);
$strin = ereg_replace("М","М",$strin);
$strin = ereg_replace("Н","Н",$strin);
$strin = ereg_replace("О","О",$strin);
$strin = ereg_replace("П","П",$strin);
$strin = ereg_replace("Р","Р",$strin);
$strin = ereg_replace("С","С",$strin);
$strin = ereg_replace("Т","Т",$strin);
$strin = ereg_replace("У","У",$strin);
$strin = ereg_replace("Ф","Ф",$strin);
$strin = ereg_replace("Х","Х",$strin);
$strin = ereg_replace("Ц","Ц",$strin);
$strin = ereg_replace("Ш","Ш",$strin);
$strin = ereg_replace("Щ","Щ",$strin);
$strin = ereg_replace("Ъ","Ъ",$strin);
$strin = ereg_replace("Ь","Ь",$strin);
$strin = ereg_replace("Э","Э",$strin);
$strin = ereg_replace("Ю","Ю",$strin);
$strin = ereg_replace("Я","Я",$strin);
$strin = ereg_replace("Ч","Ч",$strin);
$strin = ereg_replace("Ы","Ы",$strin);
$strin = ereg_replace("A","Ё",$strin);
return $strin;
}
+40
function del_reiting_type($typeid){
global $typeid;
.....
}
как-то так...