Jump to content
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Конвертирование тегов из мода от LastDragon в системные теги 3.3.х

Скрип, написанный "на коленке", конвертирует все теги из мода LastDragon для IP.Board 3.1.x в обыкновенные системные теги линейки 3.3.х.

 

Когда IPBSkins будет обновляться - пригодится :)

 

Запускать строго один раз, лучше всего через консоль - очень много SQL-запросов.

<?php

class db {
   private $conn, $res;
   function __construct($info) {
     if (! $this->conn = mysql_connect($info['sql_host'], $info['sql_user'], $info['sql_pass'])) die('Нет коннекта к БД');
     if (! mysql_select_db($info['sql_database'], $this->conn)) die('Нет базы данных');          
   }
   function query($sql) {
     $this->res = mysql_query($sql);
     if(!$this->res) echo("<pre>Ошибка БД: ".mysql_error()."\n\n{$sql}");   
     return $this->res;
   }
   function fetch($res = '') {
     if(!empty($res)) $this->res = $res;
     return mysql_fetch_array($this->res, MYSQL_ASSOC);
   }    
   function safe($string) {
       return mysql_real_escape_string($string, $this->conn);
   }    
   function insert_id() {
       return mysql_insert_id($this->conn);
   }    
   function query_count($sql, $cname = 'CNT') {
       $row = $this->fetch($this->query($sql));
       return !empty($row[$cname]) ? $row[$cname] : 0;
   }
}

function getRawTagsByMeta( $meta )
{
global $db, $p;
$tags  = array();	
$res = $db->query("SELECT * FROM {$p}core_tags WHERE tag_aai_lookup = '{$meta}' ORDER BY tag_id");	
while( $row = $db->fetch($res) )
{
	$tags[ $row['tag_id'] ] = $row;
}	
return $tags;
}

include("conf_global.php");

$db = new db($INFO);
$p = !empty($INFO['sql_tbl_prefix']) ? $INFO['sql_tbl_prefix'] : '';

$res = $db->query("SELECT tt.*, t.* FROM {$p}tagscloud_topic_tags tt LEFT JOIN {$p}tagscloud_tags t ON t.id = tt.tag_id");

echo "Converting tags...\n";

while($row = $db->fetch($res)) {


$data = array( 	'tag_aai_lookup'     => md5( 'forums;topics;'.$row['topic_id'] ),
				'tag_aap_lookup'     => md5( 'forums:topics:'.$row['forum_id'] ),
				'tag_meta_app'       => 'forums',
				'tag_meta_area'      => 'topics',
				'tag_meta_id'        => $row['topic_id'],
				'tag_meta_parent_id' => $row['forum_id'],
				'tag_member_id'      => 1,
				'tag_added'			 => time(),
				'tag_prefix'		 => 0,
				'tag_text'			 => $row['text']
			  );

$db->query("INSERT INTO {$p}core_tags (".implode(",",array_keys($data)).") VALUES ('".implode("','",$data)."')");

$db->query("INSERT INTO {$p}core_tags_perms (tag_perm_aai_lookup, tag_perm_aap_lookup, tag_perm_text, tag_perm_visible) VALUES
		   ('{$data['tag_aai_lookup']}', '{$data['tag_aap_lookup']}', '*', '1')");

$tags = getRawTagsByMeta( $data['tag_aai_lookup'] );
$text = array( 'tags' => array(), 'prefix' => '' );	
foreach( $tags as $id => $tag ) {
	$text['tags'][] = $tag['tag_text'];			
	if ( $tag['tag_prefix'] ) {
		$text['prefix'] = $tag['tag_text'];
	}
}		
$update = array( 'tag_cache_key'  =>  $data['tag_aai_lookup'],
				 'tag_cache_text' => serialize( $text ),
				 'tag_cache_date' => time()
				);
$db->query( "REPLACE INTO {$p}core_tags_cache (".implode(",",array_keys($update)).") VALUES ('".implode("','",$update)."')");
}

echo "done!\n";

Featured Replies

No posts to show

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.