Added the possibility to either convert favicons to PNG or leave them in ICO format. New favicon.php and install.php
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -5,3 +5,7 @@
|
||||
- Added the possibility to mark bookmarks and folders public/private
|
||||
when importing them.
|
||||
|
||||
20.04.2008, Version 0.8.9 beat
|
||||
- Added the possibility to either convert favicon using ImageMagick or
|
||||
leave them in the ICO format. Updating favicon.php and install.php
|
||||
accordingly.
|
||||
|
||||
34
favicon.php
34
favicon.php
@@ -4,19 +4,24 @@ if (basename ($_SERVER['SCRIPT_NAME']) == basename (__FILE__)) {
|
||||
}
|
||||
|
||||
class favicon {
|
||||
function favicon ($url) {
|
||||
global $settings;
|
||||
if ($settings['show_bookmark_icon']) {
|
||||
if ($this->parsed_url = $this->return_parse_url ($url)) {
|
||||
if ($this->favicon_url = $this->get_favicon_url ()) {
|
||||
$this->icon_name = rand () . basename ($this->favicon_url);
|
||||
if ($this->get_favicon_image ()) {
|
||||
$this->convert_favicon ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function favicon ($url) {
|
||||
global $settings, $convert_favicons;
|
||||
if ($settings['show_bookmark_icon']) {
|
||||
if ($this->parsed_url = $this->return_parse_url ($url)) {
|
||||
if ($this->favicon_url = $this->get_favicon_url ()) {
|
||||
$this->icon_name = rand () . basename ($this->favicon_url);
|
||||
if ($this->get_favicon_image ()) {
|
||||
if ($convert_favicons) {
|
||||
$this->favicon = $this->convert_favicon ();
|
||||
}
|
||||
else {
|
||||
$this->favicon = "./favicons/" . $this->icon_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
###
|
||||
### check the image type and convert & resize it if required
|
||||
### returns the absolute path of the (converted) .png file
|
||||
@@ -38,9 +43,8 @@ class favicon {
|
||||
|
||||
# convert image in any case to 16x16 and .png
|
||||
system ("$convert $file_to_convert -resize 16x16 $tmp_file.png");
|
||||
$this->favicon = $tmp_file . ".png";
|
||||
@unlink ($tmp_file);
|
||||
return true;
|
||||
return $tmp_file . ".png";
|
||||
}
|
||||
else {
|
||||
@unlink ($tmp_file);
|
||||
|
||||
19
install.php
19
install.php
@@ -33,7 +33,7 @@ $submit = set_post_bool_var ('submit', false);
|
||||
$admin_message = '';
|
||||
|
||||
if (intval(str_replace('.', '', phpversion())) < 430) {
|
||||
print_msg ('You are running PHP version '.PHP_VERSION.'. Online-Bookmarks requires at least PHP 4.3.0 to run properly. You must upgrade your PHP installation before you can continue.', "error");
|
||||
print_msg ('You are running PHP version '.PHP_VERSION.'. Online-Bookmarks requires at least PHP 4.1.0 to run properly. You must upgrade your PHP installation before you can continue.', "error");
|
||||
}
|
||||
|
||||
############## database control ##############
|
||||
@@ -97,7 +97,7 @@ function create_table_user () {
|
||||
show_bookmark_description enum('0','1') NOT NULL default '1',
|
||||
show_bookmark_icon enum('0','1') NOT NULL default '1',
|
||||
show_column_date enum('0','1') NOT NULL default '1',
|
||||
date_format CHAR(10) NOT NULL DEFAULT 'd.m.Y',
|
||||
date_format SMALLINT(6) NOT NULL DEFAULT '0',
|
||||
show_column_edit enum('0','1') NOT NULL default '1',
|
||||
show_column_move enum('0','1') NOT NULL default '1',
|
||||
show_column_delete enum('0','1') NOT NULL default '1',
|
||||
@@ -404,7 +404,7 @@ if ($submit) {
|
||||
print_msg ("Table user exists, checking for version:", "notice");
|
||||
|
||||
# check for date_format field in table
|
||||
upgrade_table ("user", "date_format", "ALTER TABLE user ADD COLUMN date_format CHAR(10) NOT NULL DEFAULT 'd.m.Y' AFTER show_column_date");
|
||||
upgrade_table ("user", "date_format", "ALTER TABLE user ADD COLUMN date_format SMALLINT(6) NOT NULL DEFAULT '0' AFTER show_column_date");
|
||||
|
||||
# check for show_public field in table
|
||||
upgrade_table ("user", "show_public", "ALTER TABLE user ADD COLUMN show_public ENUM('0','1') DEFAULT 1 NOT NULL");
|
||||
@@ -416,19 +416,23 @@ if ($submit) {
|
||||
############## favicon support ##############
|
||||
|
||||
if ($convert = @exec ('which convert')) {
|
||||
$convert_favicons = "true";
|
||||
print_msg ("ImageMagick convert found: $convert", "success");
|
||||
}
|
||||
else {
|
||||
$convert = "";
|
||||
print_msg ("ImageMagick convert not found. Make sure ImageMagick is installed and specify location of convert manually in ./config/config.php", "error");
|
||||
$convert_favicons = "false";
|
||||
print_msg ("ImageMagick convert not found. Make sure ImageMagick is installed and specify location of convert manually or set \$convert_favicons to false.", "error");
|
||||
}
|
||||
|
||||
if ($identify = @exec ('which identify')) {
|
||||
$convert_favicons = "true";
|
||||
print_msg ("ImageMagick identify found: $identify", "success");
|
||||
}
|
||||
else {
|
||||
$identify = "";
|
||||
print_msg ("ImageMagick identify not found. Make sure ImageMagick is installed and specify location of identify manually in ./config/config.php", "error");
|
||||
$convert_favicons = "false";
|
||||
print_msg ("ImageMagick identify not found. Make sure ImageMagick is installed and specify location of identify manually or set \$convert_favicons to false.", "error");
|
||||
}
|
||||
|
||||
if (is_writable ("./favicons/")) {
|
||||
@@ -482,6 +486,7 @@ $date_formats = array (
|
||||
\'m.d.y\',
|
||||
);
|
||||
|
||||
$convert_favicons = ' . $convert_favicons . ';
|
||||
$convert = \'' . $convert . '\';
|
||||
$identify = \'' . $identify . '\';
|
||||
$timeout = 5;
|
||||
@@ -507,7 +512,9 @@ $delimiter = "/";
|
||||
echo '<pre style="background-color: #E0E0E0; border: 1px black solid; padding: 20px">';
|
||||
echo $config;
|
||||
echo "</pre>\n";
|
||||
echo '<a href="./index.php">Now go Bookmark...</a>';
|
||||
echo "After completing the configuration, create useraccounts with the following MySQL command:\n";
|
||||
echo "<pre>mysql> INSERT INTO user (username, password) VALUES ('johndoe', MD5('johndoes_password'));</pre>\n";
|
||||
echo '<a href="./index.php">Go Bookmark...</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user