XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
install_updateSmilies_go.inc.php
1<?php
10
11unset( $xoopsOption['nocommon'] );
12
13include( '../mainfile.php' );
14
15echo '<h2>wizard/install_UpdateSmilies_go.inc</h2>';
16
17$result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix( 'smiles' ) );
18$content = '';
19$title = _INSTALL_L155;
20
21if ( ! defined( 'XOOPS_UPLOAD_PATH' ) ) {
22 define( 'XOOPS_UPLOAD_PATH', '../uploads' );
23}
24
25while ( $smiley = $xoopsDB->fetchArray( $result ) ) {
26 if ( file_exists( '../images/smilies/' . $smiley['smile_url'] ) && ( false !== $fp = fopen( '../images/smilies/' . $smiley['smile_url'], 'rb' ) ) ) {
27 $binary = fread( $fp, filesize( '../images/smilies/' . $smiley['smile_url'] ) );
28 fclose( $fp );
29 if ( ! preg_match( "/\.([a-zA-Z0-9]+)$/", $smiley['smile_url'], $matched ) ) {
30 continue;
31 }
32 $newsmiley = uniqid( 'smil', true ) . '.' . strtolower( $matched[1] );
33 if ( false !== $fp = fopen( XOOPS_UPLOAD_PATH . '/' . $newsmiley, 'wb' ) ) {
34 if ( - 1 !== fwrite( $fp, $binary ) ) {
35 $xoopsDB->query( 'UPDATE ' . $xoopsDB->prefix( 'smiles' ) . " SET smile_url='" . $newsmiley . "' WHERE id=" . $smiley['id'] );
36 $content .= _OKIMG . sprintf( _INSTALL_L154, $smiley['smile_url'] ) . '<br>';
37 } else {
38 $content .= _NGIMG . sprintf( _INSTALL_L153, $smiley['smile_url'] ) . '<br>';
39 }
40 fclose( $fp );
41 }
42 } else {
43 $content .= _OKIMG . sprintf( _INSTALL_L152, $smiley['smile_url'] ) . '<br>';
44 }
45}
46
47$result = $xoopsDB->query( 'SELECT * FROM ' . $xoopsDB->prefix( 'ranks' ) );
48
49while ( $rank = $xoopsDB->fetchArray( $result ) ) {
50 if ( file_exists( '../images/ranks/' . $rank['rank_image'] ) && false !== $fp = fopen( '../images/ranks/' . $rank['rank_image'], 'rb' ) ) {
51 $binary = fread( $fp, filesize( '../images/ranks/' . $rank['rank_image'] ) );
52 fclose( $fp );
53 if ( ! preg_match( "/\.([a-zA-Z0-9]+)$/", $rank['rank_image'], $matched ) ) {
54 continue;
55 }
56 $newrank = uniqid( 'rank', true ) . '.' . strtolower( $matched[1] );
57 if ( false !== $fp = fopen( XOOPS_UPLOAD_PATH . '/' . $newrank, 'wb' ) ) {
58 if ( - 1 !== fwrite( $fp, $binary ) ) {
59 $content .= _OKIMG . sprintf( _INSTALL_L154, $rank['rank_image'] ) . '<br>';
60 $xoopsDB->query( 'UPDATE ' . $xoopsDB->prefix( 'ranks' ) . " SET rank_image='" . $newrank . "' WHERE rank_id=" . $rank['rank_id'] );
61 } else {
62 $content .= _NGIMG . sprintf( _INSTALL_L153, $rank['rank_image'] ) . '<br>';
63 }
64 fclose( $fp );
65 }
66 } else {
67 $content .= _OKIMG . sprintf( _INSTALL_L152, $rank['rank_image'] ) . '<br>';
68 }
69}
70
71$b_next = [ 'updateAvatars', _INSTALL_L14 ];
72
73include './install_tpl.php';