Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
noblogs-wp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai
noblogs-wp
Commits
181446bc
Commit
181446bc
authored
14 years ago
by
root
Committed by
agata
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
modifiche che permettono il funzionamento di nextgen-gallery
parent
cf4fd01b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
wp-content/db.php
+6
-0
6 additions, 0 deletions
wp-content/db.php
wp-content/plugins/nextgen-gallery/admin/functions.php
+36
-9
36 additions, 9 deletions
wp-content/plugins/nextgen-gallery/admin/functions.php
with
42 additions
and
9 deletions
wp-content/db.php
+
6
−
0
View file @
181446bc
...
@@ -313,6 +313,12 @@ class hyperdb extends wpdb {
...
@@ -313,6 +313,12 @@ class hyperdb extends wpdb {
.
')\W([\w-]+)\W/is'
,
$q
,
$maybe
)
)
.
')\W([\w-]+)\W/is'
,
$q
,
$maybe
)
)
return
$maybe
[
1
];
return
$maybe
[
1
];
// SHOW TABLES LIKE (used in some plugins)
if
(
preg_match
(
'/^\s*'
.
'SHOW\s+TABLES\s+LIKE\s+'
.
'\W(\w+)\W/is'
,
$q
,
$maybe
)
)
return
$maybe
[
1
];
// Big pattern for the rest of the table-related queries in MySQL 5.0
// Big pattern for the rest of the table-related queries in MySQL 5.0
if
(
preg_match
(
'/^\s*(?:'
if
(
preg_match
(
'/^\s*(?:'
.
'(?:EXPLAIN\s+(?:EXTENDED\s+)?)?SELECT.*?\s+FROM'
.
'(?:EXPLAIN\s+(?:EXTENDED\s+)?)?SELECT.*?\s+FROM'
...
...
This diff is collapsed.
Click to expand it.
wp-content/plugins/nextgen-gallery/admin/functions.php
+
36
−
9
View file @
181446bc
<?php
<?php
if
(
preg_match
(
'#'
.
basename
(
__FILE__
)
.
'#'
,
$_SERVER
[
'PHP_SELF'
]))
{
die
(
'You are not allowed to call this page directly.'
);
}
if
(
preg_match
(
'#'
.
basename
(
__FILE__
)
.
'#'
,
$_SERVER
[
'PHP_SELF'
]))
{
die
(
'You are not allowed to call this page directly.'
);
}
// Temporary file reservoir, which should exist and be property of www-data. Needed to bypass open_basedir
define
(
'NEXTGEN_TMP_FILES'
,
'/opt/noblogs/tmp/'
);
/**
/**
* nggAdmin - Class for admin operation
* nggAdmin - Class for admin operation
*
*
...
@@ -844,7 +845,16 @@ class nggAdmin{
...
@@ -844,7 +845,16 @@ class nggAdmin{
return
false
;
return
false
;
}
else
{
}
else
{
if
(
!
is_dir
(
NEXTGEN_TMP_FILES
)
||
!
is_writable
(
NEXTGEN_TMP_FILES
))
{
nggGallery
::
show_error
(
'the temporary files directory is not set; contact your system administrator'
);
return
false
;
}
$newTmpFile
=
NEXTGEN_TMP_FILES
.
basename
(
$_FILES
[
'zipfile'
][
'tmp_name'
]);
if
(
!@
move_uploaded_file
(
$_FILES
[
'zipfile'
][
'tmp_name'
],
$newTmpFile
))
{
nggGallery
::
show_error
(
'could not move the uploaded file to the correct destination'
);
return
false
;
}
$_FILES
[
'zipfile'
][
'tmp_name'
]
=
$newTmpFile
;
$temp_zipfile
=
$_FILES
[
'zipfile'
][
'tmp_name'
];
$temp_zipfile
=
$_FILES
[
'zipfile'
][
'tmp_name'
];
$filename
=
$_FILES
[
'zipfile'
][
'name'
];
$filename
=
$_FILES
[
'zipfile'
][
'name'
];
...
@@ -871,6 +881,7 @@ class nggAdmin{
...
@@ -871,6 +881,7 @@ class nggAdmin{
if
(
empty
(
$foldername
)
)
{
if
(
empty
(
$foldername
)
)
{
nggGallery
::
show_error
(
__
(
'Could not get a valid foldername'
,
'nggallery'
)
);
nggGallery
::
show_error
(
__
(
'Could not get a valid foldername'
,
'nggallery'
)
);
@
unlink
(
$temp_zipfile
);
// del temp file
return
false
;
return
false
;
}
}
...
@@ -883,10 +894,12 @@ class nggAdmin{
...
@@ -883,10 +894,12 @@ class nggAdmin{
if
(
!
wp_mkdir_p
(
$newfolder
))
{
if
(
!
wp_mkdir_p
(
$newfolder
))
{
$message
=
sprintf
(
__
(
'Unable to create directory %s. Is its parent directory writable by the server?'
,
'nggallery'
),
$newfolder
);
$message
=
sprintf
(
__
(
'Unable to create directory %s. Is its parent directory writable by the server?'
,
'nggallery'
),
$newfolder
);
nggGallery
::
show_error
(
$message
);
nggGallery
::
show_error
(
$message
);
@
unlink
(
$temp_zipfile
);
// del temp file
return
false
;
return
false
;
}
}
if
(
!
wp_mkdir_p
(
$newfolder
.
'/thumbs'
))
{
if
(
!
wp_mkdir_p
(
$newfolder
.
'/thumbs'
))
{
nggGallery
::
show_error
(
__
(
'Unable to create directory '
,
'nggallery'
)
.
$newfolder
.
'/thumbs !'
);
nggGallery
::
show_error
(
__
(
'Unable to create directory '
,
'nggallery'
)
.
$newfolder
.
'/thumbs !'
);
@
unlink
(
$temp_zipfile
);
// del temp file
return
false
;
return
false
;
}
}
}
}
...
@@ -949,8 +962,17 @@ class nggAdmin{
...
@@ -949,8 +962,17 @@ class nggAdmin{
// look only for uploded files
// look only for uploded files
if
(
$imagefiles
[
'error'
][
$key
]
==
0
)
{
if
(
$imagefiles
[
'error'
][
$key
]
==
0
)
{
if
(
!
is_dir
(
NEXTGEN_TMP_FILES
))
{
nggGallery
::
show_error
(
'Temporary upload directory not defined, contact your system administrator'
);
return
;
}
$newFile
=
NEXTGEN_TMP_FILES
.
basename
(
$imagefiles
[
'tmp_name'
][
$key
]);
if
(
!@
move_uploaded_file
(
$imagefiles
[
'tmp_name'
][
$key
],
$newFile
))
{
nggGallery
::
show_error
(
'<strong>'
.
$imagefiles
[
'name'
][
$key
]
.
' </strong>'
.
__
(
'could not copy to temporary directory'
,
'nggallery'
));
continue
;
}
$temp_file
=
$
imagefiles
[
'tmp_name'
][
$key
]
;
$temp_file
=
$
newFile
;
//clean filename and extract extension
//clean filename and extract extension
$filepart
=
nggGallery
::
fileinfo
(
$imagefiles
[
'name'
][
$key
]
);
$filepart
=
nggGallery
::
fileinfo
(
$imagefiles
[
'name'
][
$key
]
);
...
@@ -960,6 +982,7 @@ class nggAdmin{
...
@@ -960,6 +982,7 @@ class nggAdmin{
$ext
=
array
(
'jpg'
,
'png'
,
'gif'
);
$ext
=
array
(
'jpg'
,
'png'
,
'gif'
);
if
(
!
in_array
(
$filepart
[
'extension'
],
$ext
)
||
!@
getimagesize
(
$temp_file
)
){
if
(
!
in_array
(
$filepart
[
'extension'
],
$ext
)
||
!@
getimagesize
(
$temp_file
)
){
nggGallery
::
show_error
(
'<strong>'
.
$imagefiles
[
'name'
][
$key
]
.
' </strong>'
.
__
(
'is no valid image file!'
,
'nggallery'
));
nggGallery
::
show_error
(
'<strong>'
.
$imagefiles
[
'name'
][
$key
]
.
' </strong>'
.
__
(
'is no valid image file!'
,
'nggallery'
));
@
unlink
(
$temp_file
);
continue
;
continue
;
}
}
...
@@ -975,24 +998,27 @@ class nggAdmin{
...
@@ -975,24 +998,27 @@ class nggAdmin{
if
(
!
is_writeable
(
$gallery
->
abspath
)
)
{
if
(
!
is_writeable
(
$gallery
->
abspath
)
)
{
$message
=
sprintf
(
__
(
'Unable to write to directory %s. Is this directory writable by the server?'
,
'nggallery'
),
$gallery
->
abspath
);
$message
=
sprintf
(
__
(
'Unable to write to directory %s. Is this directory writable by the server?'
,
'nggallery'
),
$gallery
->
abspath
);
nggGallery
::
show_error
(
$message
);
nggGallery
::
show_error
(
$message
);
@
unlink
(
$temp_file
);
return
;
return
;
}
}
// save temp file to gallery
// save temp file to gallery
if
(
!@
move_uploaded_fil
e
(
$temp_file
,
$dest_file
)
){
if
(
!@
renam
e
(
$temp_file
,
$dest_file
)
){
nggGallery
::
show_error
(
__
(
'Error, the file could not be moved to : '
,
'nggallery'
)
.
$dest_file
);
nggGallery
::
show_error
(
__
(
'Error, the file could not be moved to : '
,
'nggallery'
)
.
$dest_file
);
nggAdmin
::
check_safemode
(
$gallery
->
abspath
);
nggAdmin
::
check_safemode
(
$gallery
->
abspath
);
@
unlink
(
$temp_file
);
continue
;
continue
;
}
}
if
(
!
nggAdmin
::
chmod
(
$dest_file
)
)
{
if
(
!
nggAdmin
::
chmod
(
$dest_file
)
)
{
nggGallery
::
show_error
(
__
(
'Error, the file permissions could not be set'
,
'nggallery'
));
nggGallery
::
show_error
(
__
(
'Error, the file permissions could not be set'
,
'nggallery'
));
@
unlink
(
$temp_file
);
continue
;
continue
;
}
}
// add to imagelist & dirlist
// add to imagelist & dirlist
$imageslist
[]
=
$filename
;
$imageslist
[]
=
$filename
;
$dirlist
[]
=
$filename
;
$dirlist
[]
=
$filename
;
@
unlink
(
$temp_file
);
}
}
}
}
}
}
...
@@ -1042,6 +1068,7 @@ class nggAdmin{
...
@@ -1042,6 +1068,7 @@ class nggAdmin{
$filepart
=
nggGallery
::
fileinfo
(
$_FILES
[
'Filedata'
][
'name'
]
);
$filepart
=
nggGallery
::
fileinfo
(
$_FILES
[
'Filedata'
][
'name'
]
);
$filename
=
$filepart
[
'basename'
];
$filename
=
$filepart
[
'basename'
];
$gallerypath
=
$wpdb
->
get_var
(
"SELECT path FROM
$wpdb->nggallery
WHERE gid = '
$galleryID
' "
);
// check for allowed extension
// check for allowed extension
$ext
=
array
(
'jpg'
,
'png'
,
'gif'
);
$ext
=
array
(
'jpg'
,
'png'
,
'gif'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment