This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php function gen_guid() | |
| { | |
| if (function_exists('com_create_guid')) { | |
| return com_create_guid(); | |
| } else { | |
| $charid = strtoupper(md5(uniqid(rand(), true))); | |
| $hyphen = chr(45); | |
| $uuid = chr(123) | |
| .substr($charid, 0, 8).$hyphen | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php function gen_uuid() { | |
| return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', | |
| // 32 bits for "time_low" | |
| mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), | |
| // 16 bits for "time_mid" | |
| mt_rand( 0, 0xffff ), | |
| // 16 bits for "time_hi_and_version", | |
| // four most significant bits holds version number 4 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php function gen_pass($length = 8) | |
| { | |
| $chars = "qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP"; | |
| $size = strlen($chars)-1; | |
| $password = null; | |
| for ($i = 0; $i < $length; $i++) { | |
| $key = rand(0, $size); | |
| $password .= $chars[$key]; | |
| } | |
| return $password; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | CREATE TABLE IF NOT EXISTS Sample ( | |
| id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'Identifier', | |
| createdAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Date of create', | |
| updatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Date of update' | |
| ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1001; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Журнал доступа | |
| CustomLog /var/log/httpd-access.log common //журнал доступа | |
| LogFormat "%h %l %u %t \"%r\" %>s %b" common //формат записи | |
| # Журнал ошибок | |
| ErrorLog /var/log/httpd-error.log notice //журнал ошибок | |
| LogLevel notice //степень отчетности | |
| # Страницы ошибок | |
| ErrorDocument 404 /server/error/pages/401.html | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| public function getAllChildren() | |
| { | |
| $allChildren = []; | |
| $parentIds = [$this->id]; | |
| do { | |
| $children = self::find()->where(['in', 'parentId', $parentIds])->all(); | |
| $parentIds = []; | |
| foreach ($children as $child) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | CREATE TABLE Category (id, name, path, level, left, right, created_at, midifired_at, version, hidden, priority); | |
| CREATE VIEW Categories SELECT id FROM Category; | |
| CREATE TABLE User (id, email, password, name, created_at, confirmed_at, midifired_at, activated_at, version, is_blocked); | |
| CREATE VIEW Users SELECT id FROM Category; | |
| // id, name, path, level, version, created, midifired, sortable, hidden | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function buildFlat(elements) { | |
| var html = ''; | |
| for (var i in elements) { | |
| html += '<li>'; | |
| if (elements[i].url != null) { | |
| html += '<a href="' + elements[i].url + '">' + elements[i].name + '</a>'; | |
| } | |
| else { | |
| html += '<span>' + elements[i].name + '</span>'; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function buildTree (elements, parentId = null) { | |
| var html = ''; | |
| elements.forEach(function (element) { | |
| if (element.parentId == parentId) { | |
| html += '<li>'; | |
| if (element.url != null) { | |
| html += '<a href="' + element.url + '">' + element.name + '</a>'; | |
| } | |
| else { | |
| html += '<span>' + element.name + '</span>'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | define(function(){ | |
| var instance = null; | |
| function MySingleton(){ | |
| if(instance !== null){ | |
| throw new Error("Cannot instantiate more than one MySingleton, use MySingleton.getInstance()"); | |
| } | |
| this.initialize(); | |
| } | 
OlderNewer