Updated to reflect live site

Signed-off-by: Sophia Atkinson <sophialul@protonmail.com>
This commit is contained in:
2023-01-21 05:10:16 -08:00
parent 3cf824cc5c
commit af6f76fbcb
163 changed files with 1471 additions and 12177 deletions

View File

@ -40,11 +40,6 @@ switch( $action ) {
echo json_encode(array('success'=>$query));
break;
case 'logout':
// unused for the moment
yourls_logout();
break;
default:
yourls_do_action( 'yourls_ajax_'.$action );

83
admin/install.php Normal file
View File

@ -0,0 +1,83 @@
<?php
define( 'YOURLS_ADMIN', true );
define( 'YOURLS_INSTALLING', true );
require_once( dirname( __DIR__ ).'/includes/load-yourls.php' );
$error = array();
$warning = array();
$success = array();
// Check pre-requisites
if ( !yourls_check_PDO() ) {
$error[] = yourls__( 'PHP extension for PDO not found' );
yourls_debug_log( 'PHP PDO extension not found' );
}
if ( !yourls_check_database_version() ) {
$error[] = yourls_s( '%s version is too old. Ask your server admin for an upgrade.', 'MySQL' );
yourls_debug_log( 'MySQL version: ' . yourls_get_database_version() );
}
if ( !yourls_check_php_version() ) {
$error[] = yourls_s( '%s version is too old. Ask your server admin for an upgrade.', 'PHP' );
yourls_debug_log( 'PHP version: ' . PHP_VERSION );
}
// Is YOURLS already installed ?
if ( yourls_is_installed() ) {
$error[] = yourls__( 'YOURLS already installed.' );
// check if .htaccess exists, recreate otherwise. No error checking.
if( !file_exists( YOURLS_ABSPATH.'/.htaccess' ) ) {
yourls_create_htaccess();
}
}
// Start install if possible and needed
if ( isset($_REQUEST['install']) && count( $error ) == 0 ) {
// Create/update .htaccess file
if ( yourls_create_htaccess() ) {
$success[] = yourls__( 'File <tt>.htaccess</tt> successfully created/updated.' );
} else {
$warning[] = yourls__( 'Could not write file <tt>.htaccess</tt> in YOURLS root directory. You will have to do it manually. See <a href="http://yourls.org/htaccess">how</a>.' );
}
// Create SQL tables
$install = yourls_create_sql_tables();
if ( isset( $install['error'] ) )
$error = array_merge( $error, $install['error'] );
if ( isset( $install['success'] ) )
$success = array_merge( $success, $install['success'] );
}
// Start output
yourls_html_head( 'install', yourls__( 'Install YOURLS' ) );
?>
<div id="login">
<form method="post" action="?"><?php // reset any QUERY parameters ?>
<p>
<img src="<?php yourls_site_url(); ?>/images/yourls-logo.svg" id="yourls-logo" alt="YOURLS" title="YOURLS" />
</p>
<?php
// Print errors, warnings and success messages
foreach ( array ('error', 'warning', 'success') as $info ) {
if ( count( $$info ) > 0 ) {
echo "<ul class='$info'>";
foreach( $$info as $msg ) {
echo '<li>'.$msg."</li>\n";
}
echo '</ul>';
}
}
// Display install button or link to admin area if applicable
if( !yourls_is_installed() && !isset($_REQUEST['install']) ) {
echo '<p style="text-align: center;"><input type="submit" name="install" value="' . yourls__( 'Install YOURLS') .'" class="button" /></p>';
} else {
if( count($error) == 0 )
echo '<p style="text-align: center;">&raquo; <a href="'.yourls_admin_url().'" title="' . yourls__( 'YOURLS Administration Page') . '">' . yourls__( 'YOURLS Administration Page') . '</a></p>';
}
?>
</form>
</div>
<?php yourls_html_footer(); ?>

View File

@ -13,25 +13,27 @@ if( isset( $_GET['page'] ) && !empty( $_GET['page'] ) ) {
if( isset( $_GET['action'] ) ) {
// Check nonce
yourls_verify_nonce( 'manage_plugins', $_REQUEST['nonce'] );
yourls_verify_nonce( 'manage_plugins', $_REQUEST['nonce'] ?? '');
// Check plugin file is valid
if( isset( $_GET['plugin'] ) && yourls_validate_plugin_file( YOURLS_PLUGINDIR.'/'.$_GET['plugin'].'/plugin.php') ) {
if(isset( $_GET['plugin'] ) && yourls_is_a_plugin_file(YOURLS_PLUGINDIR . '/' . $_GET['plugin'] . '/plugin.php') ) {
// Activate / Deactive
switch( $_GET['action'] ) {
case 'activate':
$result = yourls_activate_plugin( $_GET['plugin'].'/plugin.php' );
if( $result === true )
yourls_redirect( yourls_admin_url( 'plugins.php?success=activated' ), 302 );
if( $result === true ) {
yourls_redirect(yourls_admin_url('plugins.php?success=activated'), 302);
exit();
}
break;
case 'deactivate':
$result = yourls_deactivate_plugin( $_GET['plugin'].'/plugin.php' );
if( $result === true )
yourls_redirect( yourls_admin_url( 'plugins.php?success=deactivated' ), 302 );
if( $result === true ) {
yourls_redirect(yourls_admin_url('plugins.php?success=deactivated'), 302);
exit();
}
break;
default:

View File

@ -2,8 +2,6 @@
define( 'YOURLS_ADMIN', true );
define( 'YOURLS_UPGRADING', true );
require_once( dirname( __DIR__ ).'/includes/load-yourls.php' );
require_once( YOURLS_INC.'/functions-upgrade.php' );
require_once( YOURLS_INC.'/functions-install.php' );
yourls_maybe_require_auth();
yourls_html_head( 'upgrade', yourls__( 'Upgrade YOURLS' ) );
@ -29,7 +27,7 @@ if ( !yourls_upgrade_is_needed() ) {
// From what are we upgrading?
if ( isset( $_GET['oldver'] ) && isset( $_GET['oldsql'] ) ) {
$oldver = yourls_sanitize_version($_GET['oldver']);
$oldsql = (intval)($_GET['oldsql']);
$oldsql = intval($_GET['oldsql']);
} else {
list( $oldver, $oldsql ) = yourls_get_current_version_from_sql();
}