1. Список говнокодов пользователя ololo

    Всего: 2

  2. PHP / Говнокод #4555

    +145

    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
    /**
         * Получаем права на объект.
         *
         * @param  string $fullHref
         * @param  string $method
         * @param  string $params
         * @param  string $type
         * @return object $this
         * @access public
         */
    
        public function getPermsHref( $object, $method = '*', $params = false, $type = 'module', $url = false )
        {
           $registr = URegistry::getInstance();
           $sql     = $registr->SQuery->getAcl();
    
           if ( $type == 'url' && $url )
             {
               $sql['where'] = "`o`.`type` = 'url' and `o`.`href` = '".$url."'";
               $ac_type      = 'url';
             }
           elseif ( $type == 'module' )
             {
                $sql['where'] = "(`o`.`type` = 'module') and `o`.`name` = '".$object."'";
                if ( $method != '*' )
                    $sql['where'] .= ' or `o`.`href` = "'.$object.'/'.$method.'"';
    
                $ac_type = 'module';
             }
           else
             {
                //TODO:wtf?
             }
    
            $registr->db->build_query($sql)->safe_sql($ac_type, $this->gid)->exec();
            $perms = $registr->db->fetch_object();
    
            if ( !$perms || !$perms->permission || !$perms->groupid )
                throw new NotFoundObject();
    
            $this->perms       = $perms->permission;
            $this->groupObject = explode(',', $perms->groupid);
            $this->priv_lengh  = strlen($perms->permission);
    
            return $this;
        }
    
        /**
         * Проверка прав на объект
         *
         * @param  mixed $priv
         * @return array
         * @access public
         */
    
        public function checkPremsObject( $priv = false )
        {
            $pruf = array();
            $priv = empty($priv) ? $this->perms : $priv;
    
            if ( $this->priv_lengh <= 0 or !in_array($this->gid, $this->groupObject) )
                return false;
    
            for ( $gi = 0; $gi < $this->priv_lengh; $gi++ )
            {
                if ( in_array($priv[$gi], $this->privileges['read']) )   $pruf['read'] = true;
                if ( in_array($priv[$gi], $this->privileges['write']) )  $pruf['write'] = true;
                if ( in_array($priv[$gi], $this->privileges['delete']) ) $pruf['delete'] = true;
            }
    
            return $pruf;
        }

    Проверка прав.
    Что скажите?

    ololo, 07 Ноября 2010

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

    +154.1

    1. 1
    $style = ( U_AREA != 'admin' and !defined('U_AREA_MOD') ) ?  'public/templates/' . URegistry::$settings['default_template']['value'] :  'sources/skin_acp/' . SKIN_ACP;

    ололо

    ololo, 09 Марта 2010

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