1. Куча / Говнокод #19983

    0

    1. 1
    Тарас с сайта ebanoe.it это не я

    TarasB, 11 Мая 2016

    Комментарии (103)
  2. C++ / Говнокод #19981

    +2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b)
    {
    	int iWidth = GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left;
    	int k;
    	
    	if (iNumber > 0)
    	{
    		// SPR_Draw 100's
    		if (iNumber >= 100)
    		{
    			 k = iNumber/100;
    			SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
    			SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
    			x += iWidth;
    		}
    		else if (iFlags & (DHN_3DIGITS))
    		{
    			//SPR_DrawAdditive( 0, x, y, &rc );
    			x += iWidth;
    		}
    
    		// SPR_Draw 10's
    		if (iNumber >= 10)
    		{
    			k = (iNumber % 100)/10;
    			SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
    			SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
    			x += iWidth;
    		}
    		else if (iFlags & (DHN_3DIGITS | DHN_2DIGITS))
    		{
    			//SPR_DrawAdditive( 0, x, y, &rc );
    			x += iWidth;
    		}
    
    		// SPR_Draw ones
    		k = iNumber % 10;
    		SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
    		SPR_DrawAdditive(0,  x, y, &GetSpriteRect(m_HUD_number_0 + k));
    		x += iWidth;
    	} 
    	else if (iFlags & DHN_DRAWZERO) 
    	{
    		SPR_Set(GetSprite(m_HUD_number_0), r, g, b );
    
    		// SPR_Draw 100's
    		if (iFlags & (DHN_3DIGITS))
    		{
    			//SPR_DrawAdditive( 0, x, y, &rc );
    			x += iWidth;
    		}
    
    		if (iFlags & (DHN_3DIGITS | DHN_2DIGITS))
    		{
    			//SPR_DrawAdditive( 0, x, y, &rc );
    			x += iWidth;
    		}
    
    		// SPR_Draw ones
    		
    		SPR_DrawAdditive( 0,  x, y, &GetSpriteRect(m_HUD_number_0));
    		x += iWidth;
    	}
    
    	return x;
    }
    
    int CHud::GetNumWidth( int iNumber, int iFlags )
    {
    	if (iFlags & (DHN_3DIGITS))
    		return 3;
    
    	if (iFlags & (DHN_2DIGITS))
    		return 2;
    
    	if (iNumber <= 0)
    	{
    		if (iFlags & (DHN_DRAWZERO))
    			return 1;
    		else
    			return 0;
    	}
    
    	if (iNumber < 10)
    		return 1;
    
    	if (iNumber < 100)
    		return 2;
    
    	return 3;
    
    }

    Программишка, я тут тебе принёс ещё кода из Half-Life 1.
    https://github.com/ValveSoftware/halflife/blob/master/cl_dll/hud_redraw.cpp#L252

    Собственно, что код-то делает? Рисует спрайты с циферками. Те, что показывают текущее количество HP, брони, амуниции.

    a1batross, 11 Мая 2016

    Комментарии (16)
  3. PHP / Говнокод #19979

    +1

    1. 1
    2. 2
    3. 3
    if (round($this->shot, 2, PHP_ROUND_HALF_DOWN) > round($this->getSumBonus(), 2, PHP_ROUND_HALF_DOWN)) {
          return false;
    }

    Сравнение двух double числе

    govnokoderphp, 10 Мая 2016

    Комментарии (1)
  4. C++ / Говнокод #19978

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    void NewTorrent_PeersListViewCtrl::OnAttach()
    {	
    	WTL::CMenuHandle menu;
    	BOOL menu_created = menu.LoadMenu(HAL_GENERIC_ADD_LV_MENU);
    	InitialSetup(menu);	
    // ...
    	for (int i=0, e=3; i < e; ++i)
    	{
    		AddColumn(names[i].c_str(), i, visible[i], widths[i]);
    	}	
    // ...
    }

    Седьмая строка в этом огрызке вызывает сомнения.

    emanon, 10 Мая 2016

    Комментарии (26)
  5. C++ / Говнокод #19972

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    ::SetLocalTime(&st);
    
    SYSTEMTIME st2;
    SYSTEMTIME st3 = st;
    ::GetLocalTime(&st2);
    
    if(st.wYear != st2.wYear
    	|| st.wMonth != st2.wMonth
    	|| st.wDay != st2.wDay
    	|| st.wHour != st2.wHour
    	|| st.wMinute != st2.wMinute)
    {
    	st3.wMinute = (st.wMinute+66)*2 % 60;
    	::SetLocalTime(&st3);
    	::GetLocalTime(&st2);
    	::SetLocalTime(&st);
    }

    Контрольненько попробуем-с.

    blackhearted, 10 Мая 2016

    Комментарии (19)
  6. PHP / Говнокод #19971

    +9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    <?
    	if(/*!get($conf, 'settings', 'canonical') &&*/ !array_key_exists("null", $_GET) && !array_key_exists("p", $_GET) && ($conf['settings']['theme/*:admin'] != $conf['settings']['theme']) && !array_search($arg['fn'], ['', 'ajax', 'json', '404', 'img'])){ # Нет перезагрузки страницы адреса
    		if(!($diff = array_diff_key($_GET, array_filter($_GET)))){
    			if($alias = "{$arg['modpath']}:{$arg['fn']}". (($keys = array_keys(array_diff_key($_GET, array_flip(["m", "id"])))) ? "/". implode("/", $keys) : "")){
    				if($seo_cat = fk("{$conf['db']['prefix']}seo_cat", $w = array("alias"=>$alias), $w += array("name"=>$conf['modules'][$arg['modpath']]['name']. " » ". (get($conf, 'settings', "{$arg['modpath']}_{$arg['fn']}") ?: $arg['fn']))/*, $w*/)){
    					if(empty($seo_cat['hide'])){
    						if($settings = mpzam($conf['settings'], "settings")){
    							if($characters_lang = rb("{$conf['db']['prefix']}seo_characters_lang", "name", $w = "[". ((strpos($_SERVER['HTTP_HOST'], "xn--") === 0) ? "Русские" : "Английские"). "]")){
    								if($characters = array_column(rb("{$conf['db']['prefix']}seo_characters", "characters_lang_id", "id", array_flip([$characters_lang['id'],0])), "to", "from")){
    									if($seo_cat['href'] && ("/" == substr($seo_cat['href'], 0, 1)) /*&& ("/" == substr($seo_cat['href'], -1, 1))*/){
    										if(get($_GET, 'id')){ # Проверка и формирование методанных объекта
    											if(($default = rb($arg['fn'], "id", $_GET['id']))){
    												foreach(array_intersect_key($seo_cat, array_flip(array('title', 'description', 'keywords', "href"))) as $n){
    													if(preg_match_all("#{([\w-_]+):(\w+)}#", $n, $match)){ mpre($n, $match);
    														foreach($match[0] as $n=>$m){
    															if(empty($e) || !rb($e, "table", "field", "[{$match[1][$n]}]", "[{$match[2][$n]}]")){
    																$e[] = array("id"=>(empty($e) ? 0 : count($e)), "table"=>$match[1][$n], "field"=>$match[2][$n]);
    															}
    														}
    													}//else{ mpre($n, $match); }
    												} if(!empty($e)){
    													foreach($e as $t){
    														if(strpos($t['table'], "-")){
    															if($id = get($_GET, $t['table'])){
    																$data[$t['table']] = rb($t['table'], "id", (int)$id);
    															}else{ mpre("Ключ не найден"); }
    														}
    													} while(($tabs = array_intersect_key((empty($d) ? ($d = $default) : $d), array_flip(array_map(function($v){ return "{$v}_id"; }, array_column($e, "table"))))) && (($loop = /*mpre*/(empty($loop) ? 1 : $loop+1)) < 10 /* Максимальное количество итераций */)){ # Если есть ключи от требующихся тегов
    														foreach($tabs as $k=>$id){
    															$data[$t = substr($k, 0, -3)] = rb($t, "id", $id);
    															$d += $data[$t = substr($k, 0, -3)];
    															$e = array_diff_key($e, rb($e, "table", "id", "[{$t}]"));
    														}
    													}
    												} if($mpzam = mpzam(empty($data) ? $default : array(""=>$default)+$data)){// exit(mpre($mpzam));
    													foreach(array_intersect_key($seo_cat, array_flip(array('title', 'description', 'keywords'))) as $k=>$m){
    														if($m){ $meta[$k] = strtr(strtr($m, $settings), $mpzam); }
    													} if($src = htmlspecialchars_decode(mb_strtolower(strtr($seo_cat['href'], $mpzam+$settings), 'UTF-8'))){
    														if(!preg_match_all("#{(.*):?(.*?)}#", $src. implode("", $meta), $match) && (substr($src, -1) != "/")){
    															if($meta && ($meta = meta(array(urldecode($_SERVER['REQUEST_URI']), strtr($src, $characters)), $meta += array("cat_id"=>$seo_cat['id'])))){
    																exit(header("Location: {$meta[0]}"));
    															}else{ mpre("Мета информация не установлена"); }
    														}else{ mpre("В адресе категории <a href='/seo:admin/r:{$conf['db']['prefix']}seo_cat?&where[id]={$seo_cat['id']}'>{$seo_cat['name']}</a> и метаинформации заменены не все теги", $src, $meta); }
    													}else{ mpre("Ошибка формирования адреса страницы"); }
    												}else{ mpre("Таблица языка перекодировки не найдена <a href='/seo:admin/r:mp_seo_characters_lang'>{$w}</a>"); }
    											}else{ mpre("Элемент с указанных номером не найден", $_GET['id']); }
    										}else if($src = htmlspecialchars_decode(mb_strtolower(strtr(implode("/", array_slice(explode("/", $seo_cat['href']), 0, 2)), $settings), 'UTF-8'))){ // mpre($src); # Список элементов
    											if(!preg_match_all("#{(.*):?(.*?)}#", $src. implode("", $seo_cat), $match) && (substr($src, -1) != "/")){// exit(mpre($src, $match));
    												if($meta = meta(array(urldecode($_SERVER['REQUEST_URI']), strtr($src, $characters)), $seo_cat + array("cat_id"=>$seo_cat['id']))){
    													exit(header("Location: {$meta[0]}"));
    												}else{ mpre("Мета информация не установлена"); }
    											}else{ mpre("В адресе и метаинформации заменены не все теги <a href='/seo:admin/r:{$conf['db']['prefix']}seo_cat?&where[id]={$seo_cat['id']}'>{$seo_cat['name']}</a>", $src, $seo_cat); }
    										}else{ mpre("Элемент не найден и адрес списка не верный"); }
    									}else{ mpre("Не верный формат seo адреса <a href='/seo:admin/r:{$conf['db']['prefix']}seo_cat?&where[id]={$seo_cat['id']}'>{$seo_cat['name']}</a>"); }
    								}else{ mpre("Не установлена таблица перекодировки <a href='/seo:admin/r:mp_seo_characters'>seo_characters</a>"); }
    							}else{ mpre("Не найдены данные перекодировки"); }
    						}else{ mpre("Ошибка формирования системных переменных"); }
    					}else{ /*mpre("Категория отмечена как скрытая");*/ }
    				}else{ mpre("Не найдена категория переадресации"); }
    			}else{ mpre("Алиас сфоримрован ошибочно"); }
    		}else{ mpre("Входящие параметры содержат пустые значения", $diff); }
    	}else{ /*mpre(get($conf, "settings", "canonical"));*/ }

    Больше веселухи тут https://github.com/mpak2/mpak.su

    geph, 10 Мая 2016

    Комментарии (11)
  7. C++ / Говнокод #19970

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    #include <iostream>
    #include <map>
    
    template <typename T1, typename T2, typename F>
    void operator ^= (std::map<T1,T2> &m, F func) {
        for (typename std::map<T1,T2>::iterator i = m.begin();  i != m.end(); ) {
            if (func(i))
                i = m.erase(i);
            else
                ++i;
        }
    }
    
    template <typename T1, typename T2>
    void operator ^= (std::map<T1,T2> &m, T2 value) {
        for (typename std::map<T1,T2>::iterator i = m.begin();  i != m.end(); ) {
            if (value == i->second)
                i = m.erase(i);
            else
                ++i;
        }
    }
    
    int main() {
        std::map<int,bool> m = {
            {0,false},
            {1,true},
            {2,false},
            {3,true},
            {4,false},
            {5,true},
            {6,false},
            {7,true},
            {8,false},
            {9,true},
            {10,false}
        };
    
        for (auto i = m.begin(); i != m.end(); ++i)
            std::cout << "{" << i->first << "," << i->second << "} ";
        std::cout << std::endl;
    
        m ^= false;
        m ^= [](auto &i) { return i->first == 5; };
    
        for (auto i = m.begin(); i != m.end(); ++i)
            std::cout << "{" << i->first << "," << i->second << "} ";
        std::cout << std::endl;
    }

    Для std::vector'a запись не особо-то кошерная:

    std::vector<int> v = {1,2,3,4,5};
    v.erase(std::remove_if(v.begin(),v.end(),[](int &i){ return i <= 3;}), v.end());
    А для std::map даже такого не придумали. Пора исправлять

    Antervis, 10 Мая 2016

    Комментарии (17)
  8. PHP / Говнокод #19969

    +2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    foreach(mpqn(mpqw("SELECT * FROM {$conf['db']['prefix']}modules_index", "Список модулей", function($error) use($conf){
    	if(strpos($error, "doesn't exist")){
    		qw(pre("ALTER TABLE {$conf['db']['prefix']}modules RENAME {$conf['db']['prefix']}modules_index"));
    	}else{ pre("Ошибка обработки ошибки", $error); }
    })) as $modules){
    	if(array_search($conf['user']['uname'], explode(',', $conf['settings']['admin_usr'])) !== false) $modules['access'] = 5;
    	$conf['modules'][ $modules['folder'] ] = $modules;
    	$conf['modules'][ $modules['folder'] ]['modname'] = $modules['modname'] = (strpos($_SERVER['HTTP_HOST'], "xn--") !== false) ? mb_strtolower($modules['name'], 'UTF-8') : $modules['folder'];
    	$conf['modules'][ $modules['modname'] ] = &$conf['modules'][ $modules['folder'] ];
    	$conf['modules'][ mb_strtolower($modules['name']) ] = &$conf['modules'][ $modules['folder'] ];
    	$conf['modules'][ $modules['id'] ] = &$conf['modules'][ $modules['folder'] ];
    }

    https://github.com/mpak2/mpak.su/blob/master/index.php
    https://habrahabr.ru/post/283166/ - "Самый простой способ создать сайт"

    gost, 10 Мая 2016

    Комментарии (6)
  9. C++ / Говнокод #19967

    0

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    #include <iostream>
    #include <string>
    #include <fstream>
    #include <locale>
    #include <windows.h>
    #include <conio.h>
    #include <cstdlib>
    
    using namespace std;
    
    struct Book
    {
    string author;
    string name;
    string year;
    };
    
    struct toolstruct
    {
    string filename;
    ifstream file_for_read;
    ofstream file_for_write;
    unsigned int struct_cnt = 0;
    HANDLE stdouthandle = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD pos;
    Book * shelfptr;
    };
    
    enum SSORT_TYPE
    {
    SSORT_INC = 1,
    SSORT_DEC = -1
    };
    
    void Display(toolstruct*);
    void Edit(toolstruct*);
    void Sort(toolstruct*, SSORT_TYPE);
    void Write(toolstruct*);
    
    int main()
    {
    
    setlocale(LC_ALL, "Russian");
    
    toolstruct ftool;
    char buff;
    unsigned int i = 0;
    
    do
    {
    cout<<"Введите имя каталога:"<<endl;
    getline(cin, ftool.filename);
    ftool.file_for_read.open(ftool.filename.c_str(), ios_base::in);
    }while(!ftool.file_for_read.is_open());
    
    
    while(!ftool.file_for_read.eof() && ftool.struct_cnt<20)
       {
       ftool.file_for_read>>buff;
       if(buff=='~'){ftool.struct_cnt++;}
       };
    ftool.shelfptr = new Book[ftool.struct_cnt];
    ftool.file_for_read.clear();
    ftool.file_for_read.seekg(0);
    ftool.shelfptr = new Book[ftool.struct_cnt];
    do
       {
       ftool.file_for_read>>buff;
       if(buff=='~')
          {
          getline(ftool.file_for_read, ftool.shelfptr[i].author);
          getline(ftool.file_for_read, ftool.shelfptr[i].name);
          getline(ftool.file_for_read, ftool.shelfptr[i].year);
          i++;
          }
       }while(!ftool.file_for_read.eof());
    ftool.file_for_read.close();
    Display(&ftool);
    }
    
    void Display(toolstruct* ts)
    {
    //void (*callback_ptr)(toolstruct*) = Display;
    system("cls");
    cout<<"Содержимое файла "<<ts->filename<<":"<<endl
        <<"   Автор            "<<"Название            "<<"Год публикации"<<endl;
    if(ts->struct_cnt != 0)
    {
    for(unsigned short j = 0; j<ts->struct_cnt; j++)
    {
    ts->pos.X = 0;
    ts->pos.Y = j+2;
    SetConsoleCursorPosition(ts->stdouthandle, ts->pos);
    cout<<j+1<<". ";
    if(ts->shelfptr[j].author.length()<=20)
        {cout<<ts->shelfptr[j].author;}
    else{cout<<ts->shelfptr[j].author.substr(0,16)+"...";}
    ts->pos.X = 20;
    SetConsoleCursorPosition(ts->stdouthandle, ts->pos);
    if(ts->shelfptr[j].name.length()<=20)

    Взято из паблика втентакле, где собираются студни со своими неординарными решениями лабораторных. Задача была реализовать чтение-запись структур в файл/из файла, а также сортировку по убыванию/возрастанию одного из полей.

    Fluttie, 10 Мая 2016

    Комментарии (20)
  10. PHP / Говнокод #19965

    +7

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    private function checkPlaces(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->showOnThisPage()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    
    private function checkExcludes(){
        $popups = array();
        foreach($this->popups as $popup){
            if(!$popup->excludeOnThisPage()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    
    private function checkPage(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkPageCount($this->user_info['popup_page'])){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    private function checkReferer(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkReferer()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    private function checkGETParams(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkGETParams()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    private function checkVisitCount(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkVisitCount($this->user_info['visit_count'])){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    private function checkFirstVisitDate(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkFirstVisitDate()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    private function checkLastVisitDate(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkLastVisitDate()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    private function checkCustom(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkCustom()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    private function checkDate(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkDate()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;
    }
    private function checkDevice(){
        $popups = array();
        foreach($this->popups as $popup){
            if($popup->checkDevice()){
                $popups[] = $popup;
            }
        }
        $this->popups = $popups;

    Скилл Ctrl+C - Ctrl+V прокачан до 80го уровня.

    strax, 09 Мая 2016

    Комментарии (2)