aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin.php1
-rw-r--r--admin/include/functions.php46
-rw-r--r--admin/include/themes.class.php68
3 files changed, 23 insertions, 92 deletions
diff --git a/admin.php b/admin.php
index 53b449918..7b7634f0c 100644
--- a/admin.php
+++ b/admin.php
@@ -253,7 +253,6 @@ if (
'cat_list', // delete cat
'cat_move', // ?only POST
'cat_options', // ?only POST; public/private; lock/unlock
- 'picture_modify', // ?only POST; associate/dissociate
'user_perm',
'group_perm',
'group_list', // delete group
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 7c89c002b..01d1a4bab 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -33,12 +33,7 @@ SELECT id
FROM '.CATEGORIES_TABLE.'
WHERE site_id = '.$id.'
;';
- $result = pwg_query($query);
- $category_ids = array();
- while ($row = pwg_db_fetch_assoc($result))
- {
- array_push($category_ids, $row['id']);
- }
+ $category_ids = array_from_query($query, 'id');
delete_categories($category_ids);
// destruction of the site
@@ -79,12 +74,7 @@ SELECT id
WHERE storage_category_id IN (
'.wordwrap(implode(', ', $ids), 80, "\n").')
;';
- $result = pwg_query($query);
- $element_ids = array();
- while ($row = pwg_db_fetch_assoc($result))
- {
- array_push($element_ids, $row['id']);
- }
+ $element_ids = array_from_query($query, 'id');
delete_elements($element_ids);
// now, should we delete photos that are virtually linked to the category?
@@ -395,7 +385,7 @@ function delete_orphan_tags()
$orphan_tag_ids = array();
foreach ($orphan_tags as $tag)
{
- array_push($orphan_tag_ids, $tag['id']);
+ $orphan_tag_ids[] = $tag['id'];
}
$query = '
@@ -412,8 +402,6 @@ DELETE
*/
function get_orphan_tags()
{
- $orphan_tags = array();
-
$query = '
SELECT
id,
@@ -422,13 +410,7 @@ SELECT
LEFT JOIN '.IMAGE_TAG_TABLE.' ON id = tag_id
WHERE tag_id IS NULL
;';
- $result = pwg_query($query);
- while ($row = pwg_db_fetch_assoc($result))
- {
- array_push($orphan_tags, $row);
- }
-
- return $orphan_tags;
+ return array_from_query($query);
}
/**
@@ -785,8 +767,6 @@ SELECT id, galleries_url
$galleries_url = simple_hash_from_query($query, 'id', 'galleries_url');
// categories : id, site_id, uppercats
- $categories = array();
-
$query = '
SELECT id, uppercats, site_id
FROM '.CATEGORIES_TABLE.'
@@ -794,11 +774,7 @@ SELECT id, uppercats, site_id
AND id IN (
'.wordwrap(implode(', ', $cat_ids), 80, "\n").')
;';
- $result = pwg_query($query);
- while ($row = pwg_db_fetch_assoc($result))
- {
- array_push($categories, $row);
- }
+ $categories = array_from_query($query);
// filling $cat_fulldirs
$cat_fulldirs = array();
@@ -1603,7 +1579,7 @@ DELETE '.IMAGE_CATEGORY_TABLE.'.*
JOIN '.IMAGES_TABLE.' ON image_id=id
WHERE id IN ('.implode(',', $images).')
';
-
+
if (is_array($categories) and count($categories) > 0)
{
$query.= '
@@ -2083,7 +2059,6 @@ function get_active_menu($menu_page)
case 'photos_add':
case 'rating':
case 'tags':
- case 'picture_modify':
case 'batch_manager':
return 0;
@@ -2146,15 +2121,6 @@ function get_taglist($query, $only_user_language=true)
{
$alt_names = trigger_event('get_tag_alt_names', array(), $raw_name);
- // TEMP 2.4
- if (count($alt_names)==0 and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches))
- {
- foreach ($matches[2] as $alt)
- {
- $alt_names[] = $alt;
- }
- }
-
foreach( array_diff( array_unique($alt_names), array($name) ) as $alt)
{
$altlist[] = array(
diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php
index cb754a099..e234e8e23 100644
--- a/admin/include/themes.class.php
+++ b/admin/include/themes.class.php
@@ -78,13 +78,13 @@ class themes
if (isset($missing_parent))
{
array_push(
- $errors,
+ $errors,
sprintf(
l10n('Impossible to activate this theme, the parent theme is missing: %s'),
$missing_parent
)
);
-
+
break;
}
@@ -211,7 +211,7 @@ DELETE
);
break;
}
-
+
if (!$this->deltree(PHPWG_THEMES_PATH.$theme_id))
{
$this->send_to_trash(PHPWG_THEMES_PATH.$theme_id);
@@ -220,7 +220,7 @@ DELETE
case 'set_default':
// first we need to know which users are using the current default theme
- $this->set_default_theme($theme_id);
+ $this->set_default_theme($theme_id);
break;
}
return $errors;
@@ -232,14 +232,14 @@ DELETE
{
return null;
}
-
+
$parent = $this->fs_themes[$theme_id]['parent'];
-
+
if ('default' == $parent)
{
return null;
}
-
+
if (!isset($this->fs_themes[$parent]))
{
return $parent;
@@ -251,7 +251,7 @@ DELETE
function get_children_themes($theme_id)
{
$children = array();
-
+
foreach ($this->fs_themes as $test_child)
{
if (isset($test_child['parent']) and $test_child['parent'] == $theme_id)
@@ -261,15 +261,15 @@ DELETE
}
return $children;
- }
+ }
function set_default_theme($theme_id)
{
global $conf;
-
+
// first we need to know which users are using the current default theme
$default_theme = get_default_theme();
-
+
$query = '
SELECT
user_id
@@ -300,7 +300,7 @@ UPDATE '.USER_INFOS_TABLE.'
SELECT
*
FROM '.THEMES_TABLE;
-
+
$clauses = array();
if (!empty($id))
{
@@ -321,14 +321,14 @@ SELECT
return $themes;
}
-
+
/**
* Get themes defined in the theme directory
- */
+ */
function get_fs_themes()
{
$dir = opendir(PHPWG_THEMES_PATH);
-
+
while ($file = readdir($dir))
{
if ($file!='.' and $file!='..')
@@ -531,7 +531,7 @@ SELECT
}
return false;
}
-
+
/**
* Sort $server_themes
*/
@@ -653,7 +653,7 @@ SELECT
@unlink($archive);
return $status;
}
-
+
/**
* delete $path directory
* @param string - path
@@ -774,39 +774,5 @@ SELECT
$this->fs_themes = $active_themes + $inactive_themes + $not_installed;
}
- // themes specific methods
- function get_fs_themes_with_ini()
- {
- $themes_dir = PHPWG_ROOT_PATH.'themes';
-
- $fs_themes = array();
-
- foreach (get_dirs($themes_dir) as $theme)
- {
- $conf_file = $themes_dir.'/'.$theme.'/themeconf.inc.php';
- if (file_exists($conf_file))
- {
- $theme_data = array(
- 'name' => $theme,
- );
-
- $ini_file = $themes_dir.'/'.$theme.'/theme.ini';
- if (file_exists($ini_file))
- {
- $theme_ini = parse_ini_file($ini_file);
- if (isset($theme_ini['extension_id']))
- {
- $theme_data['extension_id'] = $theme_ini['extension_id'];
- }
- }
-
- array_push($fs_themes, $theme_data);
- }
- }
-
- echo '<pre>'; print_r($fs_themes); echo '</pre>';
- }
-
-
}
?> \ No newline at end of file