Вход Регистрация
Файл: adultscript-2.0.3-pro/files/install/upgrade-1.0.12-to-1.2.0.php
Строк: 669
<?php
define
('_VALID'true);
define('_INSTALL'true);
require 
'../libraries/bootstrap.php';
require 
'functions.php';

set_time_limit(0);

error_reporting(E_ALL);
ini_set('display_errors'1);

if (
ini_get('date.timezone') == '') {
    
date_default_timezone_set('Europe/Helsinki');
}

$uri get_uri();
define('INSTALL_URL'BASE_URL.'/install');

$errors            = array();
$finished        false;

$test              VF::factory('test');
$required         $test->get_required_results();
$optional        $test->get_optional_results();
$recommended    $test->get_recommended_results();

if (isset(
$_POST['submit-upgrade'])) {
    
$db    VF::factory('database');
    
$db->query("CREATE TABLE `#__channel` (
  `channel_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `network_id` int(11) unsigned NOT NULL DEFAULT '0',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0',
  `name` varchar(100) NOT NULL DEFAULT '',
  `slug` varchar(100) NOT NULL DEFAULT '',
  `description` text NOT NULL,
  `url` varchar(255) NOT NULL DEFAULT '',
  `thumb` varchar(4) NOT NULL DEFAULT '',
  `total_videos` int(11) unsigned NOT NULL DEFAULT '0',
  `total_views` int(11) unsigned NOT NULL DEFAULT '0',
  `total_duration` int(11) unsigned NOT NULL DEFAULT '0',
  `total_likes` int(11) unsigned NOT NULL DEFAULT '0',
  `total_votes` int(11) unsigned NOT NULL DEFAULT '0',
  `total_subscribers` int(11) unsigned NOT NULL DEFAULT '0',
  `total_size` int(11) unsigned NOT NULL DEFAULT '0',
  `last_add_time` int(11) unsigned NOT NULL DEFAULT '0',
  `adv_top_id` int(11) unsigned NOT NULL DEFAULT '0',
  `adv_left_id` int(11) unsigned NOT NULL DEFAULT '0',
  `adv_player_id` int(11) unsigned NOT NULL DEFAULT '0',
  `add_time` int(11) unsigned NOT NULL DEFAULT '0',
  `update_time` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`channel_id`),
  KEY `user_id` (`user_id`),
  KEY `slug` (`slug`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"
);
    
$db->query("CREATE TABLE `#__channel_models` (
  `channel_id` int(11) unsigned NOT NULL DEFAULT '0',
  `model_id` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`channel_id`,`model_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
);
    
$db->query("CREATE TABLE `#__channel_networks` (
  `network_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) unsigned NOT NULL DEFAULT '0',
  `name` varchar(100) NOT NULL DEFAULT '',
  `slug` varchar(100) NOT NULL DEFAULT '',
  `description` text NOT NULL,
  `total_channels` smallint(5) unsigned NOT NULL DEFAULT '0',
  `total_videos` int(11) unsigned NOT NULL DEFAULT '0',
  `add_time` int(11) unsigned NOT NULL DEFAULT '0',
  `update_time` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`network_id`),
  KEY `slug` (`slug`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"
);
    
$db->query("CREATE TABLE `#__channel_rating` (
  `rating_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `channel_id` int(11) unsigned NOT NULL DEFAULT '0',
  `voter_id` int(11) unsigned NOT NULL DEFAULT '0',
  `voter_ip` int(11) unsigned NOT NULL DEFAULT '0',
  `rating` float NOT NULL DEFAULT '0',
  `add_time` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`rating_id`),
  KEY `rating_entry` (`channel_id`,`voter_id`,`voter_ip`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"
);
    
$db->query("CREATE TABLE `#__channel_subscribers` (
  `channel_id` int(11) unsigned NOT NULL DEFAULT '0',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0',
  `add_time` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`channel_id`,`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
);
    
$db->query("CREATE TABLE `#__channel_videos` (
  `channel_id` int(11) unsigned NOT NULL DEFAULT '0',
  `video_id` int(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`channel_id`,`video_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
);

    
$db->query("DROP TABLE `#__cron`");
    
$db->query("CREATE TABLE `#__cron` (
  `cron_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `module` varchar(100) NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `period` int(11) unsigned NOT NULL DEFAULT '0',
  `exec_time` int(11) unsigned NOT NULL DEFAULT '0',
  `exec_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`cron_id`),
  UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"
);
    
$db->query("INSERT INTO `#__cron`
                VALUES (1,'video','Video Queue','video_queue',10,0,0,1),
                       (2,'video','Video Shedule','video_shedule',10,0,0,1),
                       (3,'video','Video Shuffle','video_shuffle',10,0,0,0),
                       (4,'video','Video Views','video_views',1440,0,0,1),
                       (5,'video','Video Feed','video_feed',60,0,0,1),
                       (6,'link','Backlink Check','link_check',1440,0,0,1),
                       (7,'photo','Photo Views','photo_views',1440,0,0,1),
                       (9,'user','User Guest', 'user_guest',1440,0,0,1),
                       ('10','core','Core Session','core_session',1440,0,0,1);"
);

    
$db->query("ALTER TABLE #__module ADD `slugs` varchar(255) NOT NULL DEFAULT '' AFTER `description`");
    
$modules $db->get_rows("SELECT module_id, name FROM #__module ORDER BY name ASC");
    foreach (
$modules AS $module) {
        
$db->query("UPDATE #__module
                    SET slugs = '"
.$db->escape($module['name'])."'
                    WHERE module_id = "
.(int) $module['module_id']."
                    LIMIT 1"
);
    }
    
    
$db->query("INSERT INTO #__module
                SET name = 'channel',
                    description = 'Channel Module',
                    slugs = 'channel,channels',
                    type = 'extension',
                    provider = 'cloneforge',
                    add_date = '"
.date('Y-m-d H:i:s')."',
                    status = '1'"
);
    
    
$db->query("ALTER TABLE #__photo_albums ADD `password` varchar(64) NOT NULL DEFAULT ''");
    
$db->query("ALTER TABLE #__photo ADD `description` text not null after `caption`");
    
$db->query("DROP TABLE #__photo_album_views");
    
$db->query("CREATE TABLE `#__photo_album_views` (
  `album_id` int(11) NOT NULL DEFAULT '0',
  `user_id` int(11) NOT NULL DEFAULT '0',
  `ip` int(10) unsigned NOT NULL DEFAULT '0',
  `view_time` int(11) unsigned NOT NULL DEFAULT '0',
  KEY `album_id` (`album_id`),
  KEY `user_id` (`user_id`),
  KEY `view_date` (`view_time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8"
);
    
$db->query("DROP TABLE `#__photo_views`");
    
$db->query("CREATE TABLE `#__photo_views` (
  `photo_id` int(11) NOT NULL DEFAULT '0',
  `user_id` int(11) NOT NULL DEFAULT '0',
  `ip` int(10) unsigned NOT NULL DEFAULT '0',
  `view_time` int(11) unsigned NOT NULL DEFAULT '0',
  KEY `photo_id` (`photo_id`),
  KEY `user_id` (`user_id`),
  KEY `view_date` (`view_time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8"
);

    
$db->query("ALTER TABLE #__video ADD `channel_id` int(11) unsigned NOT NULL DEFAULT '0' AFTER `user_id`");
    
$db->query("ALTER TABLE #__video ADD `hd` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `ext`");
    
    
$db->query("ALTER TABLE #__video_feeds ADD `channel_id` int(11) unsigned NOT NULL DEFAULT '0' AFTER `user_id`");
    
$db->query("ALTER TABLE #__video_feeds ADD `queue` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `update_limit`");
    
    
$db->query("DROP TABLE #__video_queue");
    
$db->query("CREATE TABLE `#__video_queue` (
  `video_id` int(11) unsigned NOT NULL DEFAULT '0',
  `add_time` int(11) unsigned NOT NULL DEFAULT '0',
  `conv_time` int(11) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`video_id`),
  KEY `video_time` (`add_time`,`conv_time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8"
);

    
$db->query("DROP TABLE #__video_upload");

    
$db->query("ALTER TABLE #__guest ADD KEY `last_visit` (`last_visit`)");
    
    
$db->query("SELECT code FROM #__language");
    
$rows $db->fetch_rows();
    foreach (
$rows as $row) {
        
$code $row['code'];
        
        
language_add($code'frontend''global', array(
            
'rated'         => 'Rated',
            
'discussed'      => 'Discussed',
            
'watched'        => 'Watched',
            
'page'          => 'Page',
            
'channel'        => 'Channel',
            
'channels'        => 'Channels',
            
'like'            => 'Like',
            
'liked'            => 'Liked'
        
), NULL);
        
        
VF::cache_del($code.'.frontend.global');

        
language_add($code'frontend''mobile', array(
            
'likes' => 'Likes',
            
'most-videos' => 'Most Videos',
            
'no-comments' => 'No comments yet!',
            
'no-related' => 'No related videos found!',
            
'photo-add-guidelines-text' => '<ul><li>Allowed image extensions: jpg, png, gif and tif</li><li>Allowed filesize: 2MB</li><li>No content involving underage persons, animals, rape, incest, violence, blood, shitting or other disgusting things!</li><li>Upload your own porn. If the file you upload is copyrighted we will remove it instantly!</li></ul>',
            
'photo-add-meta-title' => 'Add Photos to Album - %s',
            
'add-photos' => 'Add Photos',
            
'edit-album' => 'Edit Album',
            
'photo-edit-meta-title' => 'Edit Photo Album - %s',
            
'photo-upload-meta-title' => 'Create Photo Album - %s',
            
'photo-upload-guidelines-text' => '<ul><li>Allowed image extensions: jpg, png, gif and tif</li><li>Allowed filesize: 2MB</li><li>Max categories: 3</li><li>No content involving underage persons, animals, rape, incest, violence, blood, shitting or other disgusting things!</li><li>Upload your own porn. If the file you upload is copyrighted we will remove it instantly!</li></ul>',
            
'upload-album' => 'Create Photo Album',
            
'slideshow' => 'Slideshow',
            
'slideshow-meta-title' => 'View %s Mobile Photo Album Slideshow - %s',
            
'photo-tag-meta-desc' => 'Mobile Photo Albums Tagged %s - %s',
            
'photo-tag-meta-title' => 'Mobile Photo Albums Tagged %s - %s',
            
'photo-tag-title' => 'Mobile Photo Albums Tagged `%s`%s',
            
'long-min' => 'Long (20min+)',
            
'medium-min' => 'Medium (5-20min)',
            
'short-min' => 'Short (0-5min)',
            
'duration' => 'Duration',
            
'this-year' => 'This Year',
            
'this-month' => 'This Month',
            
'this-week' => 'This Week',
            
'anytime' => 'Anytime',
            
'yesterday' => 'Yesterday',
            
'today' => 'Today',
            
'search-meta-desc' => 'Mobile Videos Search Results For %s - %s',
            
'search-meta-title' => 'Mobile Videos Search Results For %s - %s',
            
'search-title' => 'Search Results: `%s`%s',
            
'tag-meta-desc' => 'Mobile Videos Tagged %s - %s',
            
'tag-meta-title' => 'Mobile Videos Tagged %s - %s',
            
'tag-title' => 'Mobile Videos Tagged `%s`%s',
            
'guidelines' => 'Upload Guidelines',
            
'upload-guidelines-text' => '<ul><li>Max filesize: 300MB!</li><li>Max categories: 3</li><li>Max file uploads per day (per account): 5</li><li>Suppported file types: flv, mp4, m4v, avi, mp4,mpeg, wmv, 3gp, mov and asf!</li><li>No content involving underage persons, animals, rape, incest, violence, blood, shitting or other disgusting things!</li><li>Upload your own porn. If thefile you upload is copyrighted we will remove it instantly!</li></ul>',
            
'thumbs' => 'Thumbs',
            
'related-videos' => 'Related Videos',
            
'relevance' => 'Relevance',
            
'profile-link' => 'View your public profile:',
            
'videos-title' => 'My Videos',
            
'avatar' => 'Avatar',
            
'account' => 'Account',
            
'thumb' => 'Thumb',
            
'allow-download' => 'Allow Download',
            
'allow-comment' => 'Allow Comment',
            
'allow-rating' => 'Allow Rating',
            
'allow-embed' => 'Allow Embed',
            
'edit-video-meta-title' => 'Edit Video',
            
'edit-video-title' => 'Edit Video',
            
'play-video' => 'Play Video'
        
), null);

        
VF::cache_del($code.'.frontend.mobile');

        
language_add($code'frontend''news', array(
            
'news'         => 'News',
            
'archive'      => 'Archive'
        
), null);
        
        
VF::cache_del($code.'.frontend.news');
                
        
language_add($code'frontend''photo', array(
              
'photo-password-help'    => 'You can password protect your album and only users that know the correct password will be able to view the photos from this album!',
              
'album-password'        => 'This album is password protected. Please enter the password below:',
              
'photo-password'        => 'This photo is password protected. Please enter the password below:',
              
'password-accept'        => 'Password accepted!',
              
'view-photo'            => 'View Photo',
              
'view-album'            => 'View Album',
              
'password-invalid'        => 'View Album'
        
), null);
        
        
VF::cache_del($code.'.frontend.photo');
        
        
language_add($code'profile''profile', array(
              
'leftmenu-pendingfriend'    => 'FRIENDSHIP PENDING',
              
'leftmenu-deniedfriend'        => 'FRIENDSHIP DENIED',
              
'leftmenu-reported'            => 'ALREADY REPORTED',
              
'connections'                => 'Connections',
              
'info'                        => 'Info'
        
), null);
        
        
VF::cache_del($code.'.profile.profile');

        
language_add($code'frontend''channel', array(
              
'rating-login'            => 'Please login to like channels!',
              
'channel-invalid'        => 'Invalid channel!',
              
'rating-already'        => 'You already like this channel!',
              
'channel-meta-title'    => '%s Channel - %s',
              
'channel-meta-desc'        => '%s Channel. %s',
              
'channel-meta-keys'        => '%s',
              
'visit-site'            => 'Visit Site',
              
'subscribe-login'        => 'Please login to subscribe!',
              
'subscribe'                => 'Subscribe',
              
'subscribed'            => 'Subscribed',
              
'subscribe-already'        => 'Already subscribed to this channel!',
              
'sort-by'                => 'Sort By',
              
'filter-by'                => 'Filter By',
              
'no-channels'            => 'No channels!'
        
), null);

        
VF::cache_del($code.'.frontend.channel');
    }

    
$sponsors    $db->get_rows("SELECT * FROM #__video_sponsors ORDER BY sponsor_id ASC");
    foreach (
$sponsors as $sponsor) {
        
$sponsor_id = (int) $sponsor['sponsor_id'];
        
$db->query("INSERT INTO #__channel
                    SET name = '"
.$db->escape($sponsor['sponsor_name'])."',
                        total_videos = "
.(int) $sponsor['total_videos'].",
                        adv_player_id = "
.(int) $sponsor['adv_id']);
        if (
$db->affected_rows()) {
            
$channel_id    $db->get_last_insert_id('#__channel');
            
$db->query("UPDATE #__video SET channel_id = ".$channel_id." WHERE sponsor = ".$sponsor_id);
        }
    }

    
VF::cache_del('modules''config');

    
$finished TRUE;    
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
    <title>Adult Script Pro Installation</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="<?php echo INSTALL_URL ?>/css/style.css?v1" type="text/css" media="all" />
    <script type="text/javascript">
    var base_url = "<?php echo BASE_URL?>";
    </script>
</head>
<script type="text/javascript" src="<?php echo INSTALL_URL?>/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("img[id^='help_']").click(function() {
        var id = $(this).attr('id').match(/help_(.*)/)[1];
        if ($("p[id='test_" + id + "']").is(':visible')) {
            $("p[id='test_" + id + "']").slideUp();
        } else {
            $("p[id='test_" + id + "']").slideDown();
        }
    });
});
</script>
<body>
<div id="container">
    <?php if (!$finished): ?>
    <?php if ($errors): ?>
    <div class="errors">
    <?php foreach ($errors as $error): ?>
    <span><?php echo htmlspecialchars($error),'<br />'?></span>
    <?php endforeach; ?>
    </div>
    <?php endif; ?>
    <div class="left width-475">
        <h2>Testing Requirements</h2>
        <div class="box-content">
            <h3>Required Items</h3>
            <?php foreach ($required as $id => $values): if (!isset($values['system'])): ?>
            <span class="key"><?php if ($values['status'] !== true): echo '<strong>'; endif; ?><?php echo htmlspecialchars($values['message']); ?><?php if ($values['status'] !== true): echo '</strong>'; endif; ?></span>
            <span class="value">
                  <?php if ($values['status'] === true): ?>
                <img src="<?php echo INSTALL_URL?>/images/accept.png" alt="accept.png" />
                <?php else: ?>
                <img src="<?php echo INSTALL_URL?>/images/help.png" id="help_<?php echo $id?>" class="help" alt="help.png" />
                <?php if (isset($values['warning']) && $values['warning'] == '1'): ?>
                <img src="<?php echo INSTALL_URL?>/images/error.png" alt="error.png" />
                <?php else: ?>
                <img src="<?php echo INSTALL_URL?>/images/delete.png" alt="delete.png" />
                <?php endif; endif; ?>
            </span>
            <div class="clear"></div>
            <p id="test_<?php echo $id?>" style="display: none;"><?php echo htmlspecialchars($values['error']); ?></p>
            <?php endif; endforeach; ?>
            <h3>Required PHP Settings</h3>
            <?php foreach ($recommended as $id => $values): if (!isset($values['system'])): ?>
            <span class="key"><?php if ($values['status'] !== true): echo '<strong>'; endif; ?><?php echo htmlspecialchars($values['message']); ?><?php if ($values['status'] !== true): echo '</strong>'; endif; ?></span>
            <span class="value">
                  <?php if ($values['status'] === true): ?>
                <img src="<?php echo INSTALL_URL?>/images/accept.png" alt="accept.png" />
                <?php else: ?>
                <img src="<?php echo INSTALL_URL?>/images/help.png" id="help_<?php echo $id?>" class="help" alt="help.png" />
                <?php if ($values['warning'] == '1'): ?>
                <img src="<?php echo INSTALL_URL?>/images/error.png" alt="error.png" />                
                <?php else: ?>
                <img src="<?php echo INSTALL_URL?>/images/delete.png" alt="delete.png" />
                <?php endif; endif; ?>
            </span>
            <div class="clear"></div>
            <p id="test_<?php echo $id?>" style="display: none;"><?php echo htmlspecialchars($values['error']); ?></p>            
            <?php endif; endforeach; ?>
            <h3>Optional Items</h3>
            <?php foreach ($optional as $id => $values): if (!isset($values['system'])): ?>
            <span class="key"><?php if ($values['status'] !== true): echo '<strong>'; endif; ?><?php echo htmlspecialchars($values['message']); ?><?php if ($values['status'] !== true): echo '</strong>'; endif; ?></span>
            <span class="value">
                  <?php if ($values['status'] === true): ?>
                <img src="<?php echo INSTALL_URL?>/images/accept.png" alt="accept.png" />
                <?php else: ?>
                <img src="<?php echo INSTALL_URL?>/images/help.png" id="help_<?php echo $id?>" class="help" alt="help.png" />
                <img src="<?php echo INSTALL_URL?>/images/error.png" alt="error.png" />
                <?php endif; ?>
            </span>
            <div class="clear"></div>
            <p id="test_<?php echo $id?>" style="display: none;"><?php echo htmlspecialchars($values['error']); ?></p>
            <?php endif; endforeach; ?>
            <form name="test-form" method="post" action="<?php echo BASE_URL?>/install/upgrade-1.0.12-to-1.2.0.php?a=test">
            <div class="submit">
                  <input name="submit-test" type="submit" id="submit-test" class="submit" value="Run Tests Again" />
            </div>
            </form>
        </div>
    </div>
    <div class="right width-475">
        <h2>Upgrade Options</h2>
        <div class="box-content">
            <form id="upgrade-form" method="post" action="<?php echo BASE_URL?>/install/upgrade-1.0.12-to-1.2.0.php?a=upgrade">
            <div class="submit">
                  <input name="submit-upgrade" type="submit" id="submit-upgrade" class="submit" value="Upgrade >"<?php if ($test->is_error() === true): echo ' disabled="1"'; endif; ?> />
            </div>            
            </form>
        </div>
    </div>
    <div class="clear"></div>
    <?php else: ?>
    <div class="box">
        <h1>Congratulations! Adult Script Pro has been upgraded!</h1>
        <br />In order for the upgrade to work correctly, please complete the following actions:</br />
        <br />* Configure the core settings from Admin -> Config<br />
        <br />* Configure the video settings from Admin -> Video -> Config</br>
        <br />* Configure the mobile settings from Admin -> Extend -> Module Manager -> mobile -> config</br />
        <?php if ($sponsors): ?>
        <br />* Sponsors have been converted to Channels. Please review your channels from Admin -> Channel and add descriptions, urls and thumbs!<br />
        <?php endif; ?>
        <br />* Add a 5 minutes crontab on your server with command from Admin -> Tools -> Crontab<br />
        <br />Click on the 'Site' button to view your site or 'Administrator' button to configure installed upgrades!
        <div class="links">
            <a href="<?php echo BASE_URL?>">Site</a>
            <a href="<?php echo ADMIN_URL?>/index.php">Administrator Panel</a>
        </div>
        <div class="install">
            Please completly remove the installation directory (/install). This is a security feature!
        </div>
    </div>
    <?php endif; ?>
</div>
</body>
</html>
Онлайн: 1
Реклама