- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
switch (is_array ($_waz_table_ok['table_list']) && in_array($this->__table, $_waz_table_ok['table_list']))
{
case false:
$s = "CREATE TABLE ".$this->__table." (\n";
foreach ($filds as $f_name=>$fild) {
if (is_array ($fild)) {
$o = $fild;
} else {
$o = $types[$fild];
}
$s .= $f_name.' '.$o['Type'].' '.($o['Null'] == 'NO' ? 'NOT' : '').' NULL'.(!is_null($o['Default']) ? ' default \''.$o['Default'].'\'' : '').' '.$o['Extra'].",\n";
$s .= strlen($o['Key']) > 0 ? ($o['Key'] == 'PRI' ? 'PRIMARY KEY ('.$f_name.')' : ($o['Key'] == 'UNI' ? 'UNIQUE ' : '').' KEY '.$f_name.'('.$f_name.')' ).",\n" : '';
}
$s .= $this->prefix."timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP\n";
$result = mysql_query('SELECT VERSION()') or die(mysql_error());
$v = mysql_fetch_row($result);
if ($v[0][0] == '5') {
$s .= ") ENGINE=MyISAM DEFAULT CHARSET=cp1251;\n";
} else {
$s .= ") TYPE=MyISAM;\n";
}
$sql[] = $s;
$setting = get_class($this).'Setting';
if (class_exists($setting)) {
$cl = &new $setting;
if (strlen ($_s = $cl->getDefaultRows($this->__table)) > 0) {
$sql[] = $_s;
}
}
break;
case true:
$result = mysql_query ('SHOW COLUMNS FROM '.$this->__table) or die(mysql_error());
$rows_del = array ();
$rows_edit = array ();
$rows_add = array ();
while ($row = mysql_fetch_assoc($result)) {
if (!isset ($filds[$row['Field']])) {
if ($row['Field'] != $this->prefix.'timestamp') {
$rows_del[] = $row;
}
} else {
if (is_array ($filds[$row['Field']])) {
$o = $filds[$row['Field']];
} else {
$o = $types[$filds[$row['Field']]];
}
$filds[$row['Field']] = $o;
if ($row['Type'] != $o['Type'] || $row['Null'] != $o['Null'] || $row['Key'] != $o['Key'] || $row['Default'] != $o['Default'] || $row['Extra'] != $o['Extra']) {
$filds[$row['Field']]['db_options_old'] = $row;
$rows_edit[$row['Field']] = $filds[$row['Field']];
unset($filds[$row['Field']]);
} else {
unset($filds[$row['Field']]);
}
}
}
$rows_add = $filds;
foreach ($rows_del as $row) {
$sql[] = 'ALTER TABLE '.$this->__table.' DROP '.$row['Field'].";\n";
}
foreach ($rows_add as $f_name=>$row) {
if (is_array ($row)) {
$o = $row;
} else
{
$o = $types[$row];
}
$sql[] = 'ALTER TABLE '.$this->__table.' ADD '.$f_name.' '.$o['Type'].' '.($o['Null'] == 'NO' ? 'NOT' : '').' NULL'.(!is_null($o['Default']) ? ' default \''.$o['Default'].'\'' : '').' '.$o['Extra'].";\n";
if (strlen($o['Key']) > 0)
{
$sql[] = 'ALTER TABLE '.$this->__table.' ADD '.($o['Key'] == 'PRI' ? 'PRIMARY KEY ('.$f_name.')' : ($o['Key'] == 'UNI' ? 'UNIQUE ' : 'INDEX ').'('.$f_name.')' ).";\n";
}
}
foreach ($rows_edit as $f_name=>$row)
{
if (is_array ($row)) {
$o = $row;
} else {
$o = $types[$row];
}
$l = $row['db_options_old'];
if ($o['Type'] != $l['Type'] || $o['Null'] != $l['Null'] || $o['Default'] != $l['Default'] || $o['Extra'] != $l['Extra']) {
$sql[] = 'ALTER TABLE '.$this->__table.' CHANGE '.$f_name.' '.$f_name.' '.$o['Type'].' '.($o['Null'] == 'NO' ? 'NOT' : '').' NULL'.(!is_null($o['Default']) ? ' default \''.$o['Default'].'\'' : '').' '.$o['Extra'].";\n";
}
if ($o['Key'] != $l['Key']) {
if ($l['Key'] != '') {
$sql[] = 'ALTER TABLE '.$this->__table.' DROP '.($l['Key'] == 'PRI' ? 'PRIMARY KEY' : 'INDEX '.$f_name).";\n";
}
if ($o['Key'] != '') {
$sql[] = 'ALTER TABLE '.$this->__table.' ADD '.(strlen($o['Key']) > 0 ? ($o['Key'] == 'PRI' ? 'PRIMARY KEY ('.$f_name.')' : ($o['Key'] == 'UNI' ? ($l['Key'] != '' ? 'INDEX ' : 'UNIQUE ') : 'INDEX ').$f_name.'('.$f_name.')').";\n" : '');
}
}
}
break;
}
столкнулся с такой "хорошо" читаемой херовиной, вот для чего здесь SWITCH true false ? почему не IF?
cykablyad 10.04.2017 14:19 # +41
cykablyad придумала, как фильтровать спамеров
берем и баним всех юзеров без граватара
профит
roman-kashitsyn 10.04.2017 14:21 # −5
cykablyad 10.04.2017 14:22 # −6
dxd 10.04.2017 14:29 # −6
cykablyad 10.04.2017 14:30 # −6
guestinh0 10.04.2017 14:31 # −6
cykablyad 10.04.2017 14:31 # −27
guestinh0 10.04.2017 14:32 # −7
cykablyad 10.04.2017 14:32 # −6
guestinh0 10.04.2017 14:32 # −5
guestinh0 10.04.2017 14:46 # −5
3_25dar 10.04.2017 14:47 # −28
3_24dar 10.04.2017 14:51 # −27
dxd 10.04.2017 14:35 # −5
guestinh0 10.04.2017 14:35 # −5
3_28dar 10.04.2017 14:47 # −27
3_23dar 10.04.2017 14:51 # −27
3_27dar 10.04.2017 14:51 # −28
3_32dar 10.04.2017 14:48 # −27
3_27dar 10.04.2017 14:47 # −27
3_29dar 10.04.2017 14:52 # −27
CrashTesterAnusov 10.04.2017 14:46 # −27
3_16dar 10.04.2017 14:49 # −27
3_21dar 10.04.2017 14:47 # −27
3_42dar 10.04.2017 14:53 # −27
3_16dar 10.04.2017 14:46 # −27
barop 10.04.2017 14:50 # −5
3_31dar 10.04.2017 14:52 # −27
3_22dar 10.04.2017 14:47 # −27
guestinh0 10.04.2017 14:49 # −5
3_18dar 10.04.2017 14:46 # −27
3_28dar 10.04.2017 14:52 # −27
3_16dar 10.04.2017 14:49 # −27
guestinh0 10.04.2017 14:31 # −6
3_20dar 10.04.2017 14:50 # −27
guestinh0 10.04.2017 14:31 # −6
3_30dar 10.04.2017 14:48 # −27
3_21dar 10.04.2017 14:50 # −27
guestinh0 10.04.2017 14:31 # −6
guestinh0 10.04.2017 14:44 # −5
3_19dar 10.04.2017 14:46 # −27
CrashTesterAnusov 10.04.2017 14:48 # −27
3_31dar 10.04.2017 14:48 # −27
3_29dar 10.04.2017 14:48 # −27
3_18dar 10.04.2017 14:50 # −27
3_23dar 10.04.2017 14:47 # −27
3_19dar 10.04.2017 14:50 # −27
guestinh0 10.04.2017 14:30 # −6
dm_fomenok 10.04.2017 15:35 # −6
cykablyad 10.04.2017 15:58 # −5
CTEKIIJIHHIbN_XYI 10.04.2017 16:29 # −6
CTEKIIJIHHIbN_XYI 10.04.2017 16:31 # −6
cykablyad 10.04.2017 17:11 # −6
Лучше поспамить
bormand 10.04.2017 17:22 # −6
cykablyad 10.04.2017 17:35 # −6
bormand 10.04.2017 17:38 # −6
cykablyad 10.04.2017 17:39 # −6
P.S. у меня одного гугломузыка с пекарни не работает?
AntiSpam 10.04.2017 17:41 # −74
cykablyad 10.04.2017 17:42 # −6
AntiSpam 10.04.2017 17:43 # −74
cykablyad 10.04.2017 17:44 # −6
AntiSpam 10.04.2017 17:44 # −28
cykablyad 10.04.2017 17:45 # −6
AntiSpam 10.04.2017 17:45 # −28
cykablyad 10.04.2017 17:45 # −6
AntiSpam 10.04.2017 17:46 # −28
1024-- 10.04.2017 18:51 # 0
И даже как неглавное мыло?
Помню, мне граватар не давали, но я зарегистрировался с нормальной (с их точки зрения) почтой, а потом добавил неугодный адрес в свою учётку.
guestinh0 10.04.2017 14:35 # −5
3_24dar 10.04.2017 14:47 # −26
3_25dar 10.04.2017 14:51 # −27
CrashTesterAnusov 10.04.2017 14:49 # −27
guestinh0 10.04.2017 14:38 # −5
3_20dar 10.04.2017 14:47 # −27
3_30dar 10.04.2017 14:52 # −27
guestinh0 10.04.2017 14:38 # −5
barop 10.04.2017 14:46 # −5
3_22dar 10.04.2017 14:51 # −27
guestinh0 10.04.2017 14:48 # −5
3_32dar 10.04.2017 14:53 # −27
guestinh0 10.04.2017 14:56 # −6
pedar 10.04.2017 14:58 # −6
nudop 10.04.2017 15:02 # −6