示例#1
0
AmpError::display('email');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Website');
?>
</td>
    <td>
        <input type="text" name="website" value="<?php 
echo scrub_out($_REQUEST['website']);
?>
" />
        <?php 
AmpError::display('website');
?>
    </td>
</tr>
</table>
<div class="formValidation">
    <?php 
echo Core::form_register('add_label');
?>
    <input class="button" type="submit" value="<?php 
echo T_('Add');
?>
" />
</div>
</form>
<?php 
            </ul>
            </div>
            <?php 
AmpError::display('general');
?>

            <h2><?php 
echo T_('Generate Config File');
?>
</h2>
            <h3><?php 
echo T_('Database connection');
?>
</h3>
            <?php 
AmpError::display('config');
?>
<form method="post" action="<?php 
echo $web_path . "/install.php?action=create_config";
?>
" enctype="multipart/form-data" autocomplete="off">
<div class="form-group">
    <label for="web_path" class="col-sm-4 control-label"><?php 
echo T_('Web Path');
?>
</label>
    <div class="col-sm-8">
        <input type="text" class="form-control" id="web_path" name="web_path" value="<?php 
echo scrub_out($web_path_guess);
?>
">
示例#3
0
 /**
  * run_update
  * This function actually updates the db.
  * it goes through versions and finds the ones
  * that need to be run. Checking to make sure
  * the function exists first.
  */
 public static function run_update()
 {
     /* Nuke All Active session before we start the mojo */
     $sql = "TRUNCATE session";
     Dba::write($sql);
     // Prevent the script from timing out, which could be bad
     set_time_limit(0);
     $current_version = self::get_version();
     // Run a check to make sure that they don't try to upgrade from a version that
     // won't work.
     if ($current_version < '340002') {
         echo "<p align=\"center\">Database version too old, please upgrade to <a href=\"http://ampache.org/downloads/ampache-3.3.3.5.tar.gz\">Ampache-3.3.3.5</a> first</p>";
         return false;
     }
     $methods = get_class_methods('Update');
     if (!is_array(self::$versions)) {
         self::$versions = self::populate_version();
     }
     foreach (self::$versions as $version) {
         // If it's newer than our current version let's see if a function
         // exists and run the bugger.
         if ($version['version'] > $current_version) {
             $update_function = "update_" . $version['version'];
             if (in_array($update_function, $methods)) {
                 $success = call_user_func(array('Update', $update_function));
                 // If the update fails drop out
                 if ($success) {
                     self::set_version('db_version', $version['version']);
                 } else {
                     AmpError::display('update');
                     return false;
                 }
             }
         }
     }
     // end foreach version
     // Once we've run all of the updates let's re-sync the character set as
     // the user can change this between updates and cause mis-matches on any
     // new tables.
     Dba::reset_db_charset();
     // Let's also clean up the preferences unconditionally
     User::rebuild_all_preferences();
 }
示例#4
0
 /**
  * clean catalog procedure
  *
  * Removes local songs that no longer exist.
  */
 public function clean_catalog_proc()
 {
     if (!Core::is_readable($this->path)) {
         // First sanity check; no point in proceeding with an unreadable
         // catalog root.
         debug_event('catalog', 'Catalog path:' . $this->path . ' unreadable, clean failed', 1);
         AmpError::add('general', T_('Catalog Root unreadable, stopping clean'));
         AmpError::display('general');
         return 0;
     }
     $dead_total = 0;
     $stats = self::get_stats($this->id);
     $this->count = 0;
     foreach (array('video', 'song') as $media_type) {
         $total = $stats[$media_type . 's'];
         // UGLY
         if ($total == 0) {
             continue;
         }
         $chunks = floor($total / 10000);
         $dead = array();
         foreach (range(0, $chunks) as $chunk) {
             $dead = array_merge($dead, $this->_clean_chunk($media_type, $chunk, 10000));
         }
         $dead_count = count($dead);
         // The AlmightyOatmeal sanity check
         // Never remove everything; it might be a dead mount
         if ($dead_count >= $total) {
             debug_event('catalog', 'All files would be removed. Doing nothing.', 1);
             AmpError::add('general', T_('All files would be removed. Doing nothing'));
             continue;
         }
         if ($dead_count) {
             $dead_total += $dead_count;
             $sql = "DELETE FROM `{$media_type}` WHERE `id` IN " . '(' . implode(',', $dead) . ')';
             $db_results = Dba::write($sql);
         }
     }
     \Lib\Metadata\Repository\Metadata::gc();
     \Lib\Metadata\Repository\MetadataField::gc();
     return $dead_total;
 }
?>
</li>
    </ul>
    <p><strong><?php 
echo T_('Step 3 - Set up the initial account');
?>
</strong></p>
    <dl>
        <dd><?php 
echo T_('This step creates your initial Ampache admin account. Once your admin account has been created you will be redirected to the login page.');
?>
</dd>
    </dl>
</div>
    <?php 
AmpError::display('general');
?>
    <h2><?php 
echo T_('Create Admin Account');
?>
</h2>
    <form method="post" action="<?php 
echo $web_path . "/install.php?action=create_account&amp;htmllang={$htmllang}&amp;charset={$charset}";
?>
" enctype="multipart/form-data">

<div class="form-group">
    <label for="local_username" class="col-sm-3 control-label"><?php 
echo T_('Username');
?>
</label>
示例#6
0
                    <input type="text" name="start" value="<?php 
if ($action == 'show_add_current') {
    echo scrub_out($_SERVER['REMOTE_ADDR']);
} else {
    echo scrub_out($_REQUEST['start']);
}
?>
" />
            </td>
            <td>
                <?php 
echo T_('End');
?>
:
                    <?php 
AmpError::display('end');
?>
                    <input type="text" name="end" value="<?php 
if ($action == 'show_add_current') {
    echo scrub_out($_SERVER['REMOTE_ADDR']);
} else {
    echo scrub_out($_REQUEST['end']);
}
?>
" />
            </td>
        </tr>
    </table>
    <div class="formValidation">
        <?php 
echo Core::form_register('add_acl');
示例#7
0
 public static function process_action($action, $catalogs, $options = null)
 {
     if (!$options || !is_array($options)) {
         $options = array();
     }
     switch ($action) {
         case 'add_to_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'add_to_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->add_to_catalog($options);
                     }
                 }
                 if (!defined('SSE_OUTPUT')) {
                     AmpError::display('catalog_add');
                 }
             }
             break;
         case 'update_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'update_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->verify_catalog();
                     }
                 }
             }
             break;
         case 'full_service':
             if (!$catalogs) {
                 $catalogs = Catalog::get_catalogs();
             }
             /* This runs the clean/verify/add in that order */
             foreach ($catalogs as $catalog_id) {
                 $catalog = Catalog::create_from_id($catalog_id);
                 if ($catalog !== null) {
                     $catalog->clean_catalog();
                     $catalog->verify_catalog();
                     $catalog->add_to_catalog();
                 }
             }
             Dba::optimize_tables();
             break;
         case 'clean_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'clean_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->clean_catalog();
                     }
                 }
                 // end foreach catalogs
                 Dba::optimize_tables();
             }
             break;
         case 'update_from':
             $catalog_id = 0;
             // First see if we need to do an add
             if ($options['add_path'] != '/' && strlen($options['add_path'])) {
                 if ($catalog_id = Catalog_local::get_from_path($options['add_path'])) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->add_to_catalog(array('subdirectory' => $options['add_path']));
                     }
                 }
             }
             // end if add
             // Now check for an update
             if ($options['update_path'] != '/' && strlen($options['update_path'])) {
                 if ($catalog_id = Catalog_local::get_from_path($options['update_path'])) {
                     $songs = Song::get_from_path($options['update_path']);
                     foreach ($songs as $song_id) {
                         Catalog::update_single_item('song', $song_id);
                     }
                 }
             }
             // end if update
             if ($catalog_id <= 0) {
                 AmpError::add('general', T_("This subdirectory is not part of an existing catalog. Update cannot be processed."));
             }
             break;
         case 'gather_media_art':
             if (!$catalogs) {
                 $catalogs = Catalog::get_catalogs();
             }
             // Iterate throught the catalogs and gather as needed
             foreach ($catalogs as $catalog_id) {
                 $catalog = Catalog::create_from_id($catalog_id);
                 if ($catalog !== null) {
                     require AmpConfig::get('prefix') . UI::find_template('show_gather_art.inc.php');
                     flush();
                     $catalog->gather_art();
                 }
             }
             break;
     }
 }
示例#8
0
 /**
  * Add the song to the DB
  * @param array $song
  * @return integer
  */
 protected function insertSong($song)
 {
     $inserted = Song::insert($song);
     if ($inserted) {
         debug_event('beets_catalog', 'Adding song ' . $song['file'], 5, 'ampache-catalog');
     } else {
         debug_event('beets_catalog', 'Insert failed for ' . $song['file'], 1);
         AmpError::add('general', T_('Unable to Insert Song - %s'), $song['file']);
         AmpError::display('general');
     }
     flush();
     return $inserted;
 }
echo T_('Confirm Password');
?>
:</label>
                        <input type='password' name='password_2' id='password_2' />
                    </div>

                    <br />
                    <div class="registerInformation">
                        <span><?php 
echo T_('* Required fields');
?>
</span>
                    </div>

                    <?php 
if (AmpConfig::get('captcha_public_reg')) {
    echo captcha::form("&rarr;&nbsp;");
    AmpError::display('captcha');
}
?>

                    <div class="registerButtons">
                        <input type="hidden" name="action" value="add_user" />
                        <input type='submit' name='submit_registration' id='submit_registration' value='<?php 
echo T_('Register User');
?>
' />
                    </div>
                </form>
<?php 
UI::show_footer();
示例#10
0
 /**
  * update_remote_catalog
  *
  * Pulls the data from a remote catalog and adds any missing songs to the
  * database.
  */
 public function update_remote_catalog($type = 0)
 {
     set_time_limit(0);
     $remote_handle = $this->connect();
     if (!$remote_handle) {
         return false;
     }
     // Get the song count, etc.
     $remote_catalog_info = $remote_handle->info();
     // Tell 'em what we've found, Johnny!
     UI::update_text('', sprintf(T_('%u remote catalog(s) found (%u songs)'), $remote_catalog_info['catalogs'], $remote_catalog_info['songs']));
     // Hardcoded for now
     $step = 500;
     $current = 0;
     $total = $remote_catalog_info['songs'];
     while ($total > $current) {
         $start = $current;
         $current += $step;
         try {
             $songs = $remote_handle->send_command('songs', array('offset' => $start, 'limit' => $step));
         } catch (Exception $e) {
             AmpError::add('general', $e->getMessage());
             AmpError::display('general');
             flush();
         }
         // Iterate over the songs we retrieved and insert them
         foreach ($songs as $data) {
             if ($this->check_remote_song($data['song'])) {
                 debug_event('remote_catalog', 'Skipping existing song ' . $data['song']['url'], 5);
             } else {
                 $data['song']['catalog'] = $this->id;
                 $data['song']['file'] = preg_replace('/ssid=.*?&/', '', $data['song']['url']);
                 if (!Song::insert($data['song'])) {
                     debug_event('remote_catalog', 'Insert failed for ' . $data['song']['self']['id'], 1);
                     AmpError::add('general', T_('Unable to Insert Song - %s'), $data['song']['title']);
                     AmpError::display('general');
                     flush();
                 }
             }
         }
     }
     // end while
     UI::update_text('', T_('Completed updating remote catalog(s).'));
     // Update the last update value
     $this->update_last_update();
     return true;
 }
示例#11
0
    echo scrub_out($client->city);
    ?>
" />
                </td>
            </tr>
        <?php 
}
?>
        <tr>
            <td><?php 
echo T_('New Password');
?>
:</td>
            <td>
                <?php 
AmpError::display('password');
?>
                <input type="password" name="password1" id="password1" />
            </td>
        </tr>
        <tr>
            <td><?php 
echo T_('Confirm Password');
?>
:</td>
            <td>
                <input type="password" name="password2" id="password2" />
            </td>
        </tr>
        <tr>
            <td>
AmpError::display('site_url');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Stream URL');
?>
</td>
    <td>
        <input type="text" name="url" value="<?php 
echo scrub_out($_REQUEST['url']);
?>
" />
        <?php 
AmpError::display('url');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Codec');
?>
</td>
    <td>
        <input type="text" name="codec" value="<?php 
echo scrub_out($_REQUEST['codec']);
?>
" />
    </td>
</tr>
示例#13
0
AmpError::display('stream_type');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Bitrate');
?>
</td>
    <td>
        <input type="text" name="bitrate" value="<?php 
echo scrub_out($_REQUEST['bitrate'] ?: '128');
?>
" />
        <?php 
AmpError::display('bitrate');
?>
    </td>
</tr>
</table>
<div class="formValidation">
    <?php 
echo Core::form_register('add_channel');
?>
    <input class="button" type="submit" value="<?php 
echo T_('Create');
?>
" />
</div>
</form>
<?php 
示例#14
0
AmpError::display('secret');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Max Counter');
?>
</td>
    <td>
        <input type="text" name="max_counter" value="<?php 
echo scrub_out($_REQUEST['max_counter'] ?: '0');
?>
" />
        <?php 
AmpError::display('max_counter');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Expiry Days');
?>
</td>
    <td>
        <input type="text" name="expire" value="<?php 
echo scrub_out($_REQUEST['expire'] ?: AmpConfig::get('share_expire'));
?>
" />
    </td>
</tr>
示例#15
0
        <?php 
AmpError::display('feed');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Catalog');
?>
</td>
    <td>
        <?php 
show_catalog_select('catalog', scrub_out($_REQUEST['catalog']), '', false, 'podcast');
?>
        <?php 
AmpError::display('catalog');
?>
    </td>
</tr>
</table>
<div class="formValidation">
    <?php 
echo Core::form_register('add_podcast');
?>
    <input class="button" type="submit" value="<?php 
echo T_('Subscribe');
?>
" />
</div>
</form>
<?php 
示例#16
0
AmpError::display('subject');
?>
    </td>
</tr>
<tr>
    <td><?php 
echo T_('Message');
?>
</td>
    <td>
        <textarea name="message" cols="64" rows="10"><?php 
echo scrub_out($_REQUEST['message']);
?>
</textarea>
        <?php 
AmpError::display('message');
?>
    </td>
</tr>
</table>
<div class="formValidation">
    <?php 
echo Core::form_register('add_pvmsg');
?>
    <input class="button" type="submit" value="<?php 
echo T_('Send');
?>
" />
</div>
</form>
<script type="text/javascript">