Example #1
0
    *										The result *must* be assigned/stored to {RESULT}.
    *							'typecast'	=> typecast value
    *
    *							The returned variables will be made always available to the next function to continue to work with.
    *
    *							example (variable inputted is an integer of 1):
    *
    *							array(
    *								'function1'		=> 'increment_by_one',		// returned variable is 2
    *								'typecast'		=> 'string',				// typecast variable to be a string
    *								'execute'		=> '{RESULT} = {VALUE} . ' is good';', // returned variable is '2 is good'
    *								'function2'		=> 'replace_good_with_bad',				// returned variable is '2 is bad'
    *							),
    *
    */
    $convertor = array('test_file' => 'viewtopic.php', 'avatar_path' => get_config_value('avatar_path') . '/', 'avatar_gallery_path' => get_config_value('avatar_gallery_path') . '/', 'smilies_path' => get_config_value('smilies_path') . '/', 'upload_path' => defined('MOD_ATTACHMENT') ? src_get_files_dir() . '/' : '', 'thumbnails' => defined('MOD_ATTACHMENT') ? array('thumbs/', 't_') : '', 'ranks_path' => false, 'query_first' => array(array('target', $convert->truncate_statement . SEARCH_RESULTS_TABLE), array('target', $convert->truncate_statement . SEARCH_WORDLIST_TABLE), array('target', $convert->truncate_statement . SEARCH_WORDMATCH_TABLE), array('target', $convert->truncate_statement . LOG_TABLE)), 'execute_first' => '
			src_create_userconv_table();
			import_avatar_gallery();
			if (defined("MOD_ATTACHMENT")) src_import_attach_config();
			src_insert_forums();
		', 'execute_last' => array('
			add_bots();
		', '
			update_folder_pm_count();
		', '
			update_unread_count();
		', defined('MOD_ATTACHMENT') ? '
			src_attachment_extension_group_name();
		' : '
		', '
			src_convert_authentication(\'start\');
Example #2
0
/**
* Copy thumbnails of uploaded images from the 2.0.x forum
* This is only used if the Attachment MOD was installed
*/
function src_copy_thumbnails()
{
    global $db, $convert, $user, $config, $cache, $src_root_path;
    $src_path = $convert->options['forum_path'] . '/' . src_get_files_dir() . '/thumbs/';
    if ($handle = @opendir($src_path)) {
        while ($entry = readdir($handle)) {
            if ($entry[0] == '.') {
                continue;
            }
            if (is_dir($src_path . $entry)) {
                continue;
            } else {
                copy_file($src_path . $entry, $config['upload_path'] . '/' . preg_replace('/^t_/', 'thumb_', $entry));
                @unlink($src_root_path . $config['upload_path'] . '/thumbs/' . $entry);
            }
        }
        closedir($handle);
    }
}