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
    
  
  
    
  | $model = cmsCore::getModel('places'); | |
| $model_ext_file = 'system/controllers/places/model_ext.php'; | |
| cmsCore::includeFile($model_ext_file); | |
| $model_ext = new modelPlacesExt(); | |
| //model_ext.php | |
| class modelPlacesExt extends modelPlaces { | |
| /* ============================================================== */ | 
  
    
      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
    
  
  
    
  | 1. manifest.php: | |
| 'user_tab_info', | |
| 'user_tab_show' | |
| 2. sql query | |
| INSERT INTO `cms_users_tabs` (`title`, `controller`, `name`, `is_active`, `ordering`) VALUES | |
| ('Объекты', 'places', 'objects', 1, 8); | 
  
    
      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
    
  
  
    
  | <form id="addform" name="addform"> | |
| <input name="code" type="text" id="code" style="width:200px" value="" /> | |
| <a href="javascript:" onclick="generateCode()">Сгенерировать</a> | |
| </form> | |
| <script type="text/javascript"> | |
| function generateCode(){ | |
| //config | |
| var upper = 1;//Заглавные буквы | |
| var lower = 1;//Маленькие буквы | |
| var digit = 1;//Цифры | 
  
    
      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 | |
| // ============================================================================ // | |
| // ============================================================================ // | |
| /** | |
| * Проверяет досуп пользователь с USER_ID к правилу $access_type | |
| * $access_type like "comments/delete" or "photo/edit" | |
| * @param string $access_type | |
| * @return bool | 
  
    
      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 -f C:/Cloudmailru/OpenServer/domains/instantshop.loc/cron.php > /dev/null | |
| php -f /var/www/aworlds/data/www/aworlds.com/cron.php >/dev/null 2>&1 | |
| <?php | |
| mail("joecool@example.com", "My Subject", "Line 1\nLine 2\nLine 3"); | |
| ?> | 
  
    
      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 | |
| //определяем статус для нового объекта при редактировании модератором (админ может задать это поле вручную) | |
| if($is_manager && $old['status'] == 0){ | |
| //получаем обновленную запись | |
| $item = $model->getItem($id); | |
| //определяем в какой статус можно перевести объект | |
| $sql = "SELECT c.id, c.title, c.seolink, | |
| IFNULL(cc.climit, 0) as climit | 
  
    
      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
    
  
  
    
  | $cena=str_replace(",",'.',$cena); | |
| $cena=preg_replace("/[^x\d|*\.]/","",$cena); | 
  
    
      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 | |
| header("Content-type: text/csv"); | |
| header("Content-Disposition: attachment; filename=file.csv"); | |
| header("Pragma: no-cache"); | |
| header("Expires: 0"); | |
| $array = array( // данные которые мы будем выводить в csv файл | |
| 0 => array('Nikolay','nikolay@email.ru'), | |
| 1 => array('Maria', 'maria@email.ru') | |
| ); | 
  
    
      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 | |
| $cats_full = $model->getCategories(); | |
| if(!$cats_full) { return false; } | |
| foreach ($cats_full as $cat) { | |
| $cats[] = $cat; | |
| $nsl[] = $cat['NSLeft']; | |
| $ord[] = $cat['ordering']; | |
| } | 
  
    
      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
    
  
  
    
  | --копирование значений из одной таблицы в другую - связывание таблиц | |
| UPDATE cms_blog_posts p, cms_hits h | |
| SET h.owner_id = p.blog_id | |
| WHERE h.target_id = p.id AND h.target = 'blogpost' | |
| --расстояние до геоточек | |
| --еще нужна функция MYSQL - позже добавлю | |
| SET @src := Point('56.85479147340446','60.59969435180665'); | |
| SELECT i.*, DATE_FORMAT(i.pubdate, '%H:%i') as ftime, c.title as category, c.marker as marker, c.zoom as zoom , geodist(X(@src), Y(@src), i.lat, i.lng) AS distantion FROM cms_map_cats c, cms_map_items i WHERE i.published = 1 AND ((i.category_id = c.id) AND (c.NSLeft>=3 AND c.NSRight<=4)) AND (i.city_id = '5106') | |
| GROUP BY i.id |