Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Joakim Saario
aurweb
Commits
676595f9
Commit
676595f9
authored
Apr 05, 2014
by
Lukas Fleischer
Browse files
Prefix package functions with pkg_/pkgbase_
Signed-off-by:
Lukas Fleischer
<
archlinux@cryptocrack.de
>
parent
d16f7cf7
Changes
12
Hide whitespace changes
Inline
Side-by-side
scripts/cleanup
View file @
676595f9
...
...
@@ -34,7 +34,7 @@ foreach ($buckets as $bucket) {
continue
;
}
$fullpath
=
INCOMING_DIR
.
$bucket
.
"/"
.
$pkgname
;
if
(
!
pkg
id
_from_name
(
$pkgname
)
&&
is_dir
(
$fullpath
))
{
if
(
!
pkg_from_name
(
$pkgname
)
&&
is_dir
(
$fullpath
))
{
echo
'Removing '
.
$fullpath
.
"
\n
"
;
rm_tree
(
$fullpath
);
$count
++
;
...
...
web/html/index.php
View file @
676595f9
...
...
@@ -13,7 +13,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
* the routing framework to the individual pages instead of
* initializing arbitrary variables here. */
$pkgname
=
$tokens
[
2
];
$pkgid
=
pkg
id
_from_name
(
$pkgname
);
$pkgid
=
pkg_from_name
(
$pkgname
);
if
(
!
$pkgid
)
{
header
(
"HTTP/1.0 404 Not Found"
);
...
...
web/html/packages.php
View file @
676595f9
...
...
@@ -11,9 +11,9 @@ check_sid(); # see if they're still logged in
if
(
!
isset
(
$pkgid
)
||
!
isset
(
$pkgname
))
{
if
(
isset
(
$_GET
[
'ID'
]))
{
$pkgid
=
intval
(
$_GET
[
'ID'
]);
$pkgname
=
pkgname_from_id
(
$_GET
[
'ID'
]);
$pkgname
=
pkg
_
name_from_id
(
$_GET
[
'ID'
]);
}
else
if
(
isset
(
$_GET
[
'N'
]))
{
$pkgid
=
pkg
id
_from_name
(
$_GET
[
'N'
]);
$pkgid
=
pkg_from_name
(
$_GET
[
'N'
]);
$pkgname
=
$_GET
[
'N'
];
}
else
{
unset
(
$pkgid
,
$pkgname
);
...
...
@@ -44,7 +44,7 @@ if (isset($_COOKIE["AURSID"])) {
$details
=
array
();
if
(
isset
(
$pkgname
))
{
$details
=
get_packa
ge_details
(
$pkgid
);
$details
=
pkg_
ge
t
_details
(
$pkgid
);
}
html_header
(
$title
,
$details
);
...
...
@@ -55,10 +55,10 @@ if (isset($pkgid)) {
include
(
'pkg_search_form.php'
);
if
(
$pkgid
)
{
if
(
isset
(
$_COOKIE
[
"AURSID"
]))
{
display_
package_
details
(
$pkgid
,
$details
,
$_COOKIE
[
"AURSID"
]);
pkg_
display_details
(
$pkgid
,
$details
,
$_COOKIE
[
"AURSID"
]);
}
else
{
display_
package_
details
(
$pkgid
,
$details
,
null
);
pkg_
display_details
(
$pkgid
,
$details
,
null
);
}
}
else
{
print
__
(
"Error trying to retrieve package details."
)
.
"<br />
\n
"
;
...
...
web/html/pkgbase.php
View file @
676595f9
...
...
@@ -55,27 +55,27 @@ $ret = false;
$output
=
""
;
if
(
check_token
())
{
if
(
current_action
(
"do_Flag"
))
{
list
(
$ret
,
$output
)
=
pkg_flag
(
$atype
,
$ids
);
list
(
$ret
,
$output
)
=
pkg
base
_flag
(
$atype
,
$ids
);
}
elseif
(
current_action
(
"do_UnFlag"
))
{
list
(
$ret
,
$output
)
=
pkg_unflag
(
$atype
,
$ids
);
list
(
$ret
,
$output
)
=
pkg
base
_unflag
(
$atype
,
$ids
);
}
elseif
(
current_action
(
"do_Adopt"
))
{
list
(
$ret
,
$output
)
=
pkg_adopt
(
$atype
,
$ids
,
true
);
list
(
$ret
,
$output
)
=
pkg
base
_adopt
(
$atype
,
$ids
,
true
);
}
elseif
(
current_action
(
"do_Disown"
))
{
list
(
$ret
,
$output
)
=
pkg_adopt
(
$atype
,
$ids
,
false
);
list
(
$ret
,
$output
)
=
pkg
base
_adopt
(
$atype
,
$ids
,
false
);
}
elseif
(
current_action
(
"do_Vote"
))
{
list
(
$ret
,
$output
)
=
pkg_vote
(
$atype
,
$ids
,
true
);
list
(
$ret
,
$output
)
=
pkg
base
_vote
(
$atype
,
$ids
,
true
);
}
elseif
(
current_action
(
"do_UnVote"
))
{
list
(
$ret
,
$output
)
=
pkg_vote
(
$atype
,
$ids
,
false
);
list
(
$ret
,
$output
)
=
pkg
base
_vote
(
$atype
,
$ids
,
false
);
}
elseif
(
current_action
(
"do_Delete"
))
{
if
(
isset
(
$_POST
[
'confirm_Delete'
]))
{
if
(
!
isset
(
$_POST
[
'merge_Into'
])
||
empty
(
$_POST
[
'merge_Into'
]))
{
list
(
$ret
,
$output
)
=
pkg_delete
(
$atype
,
$ids
,
NULL
);
list
(
$ret
,
$output
)
=
pkg
base
_delete
(
$atype
,
$ids
,
NULL
);
unset
(
$_GET
[
'ID'
]);
}
else
{
$merge_base_id
=
pkgbase_from_name
(
$_POST
[
'merge_Into'
]);
if
(
$merge_base_id
)
{
list
(
$ret
,
$output
)
=
pkg_delete
(
$atype
,
$ids
,
$merge_base_id
);
list
(
$ret
,
$output
)
=
pkg
base
_delete
(
$atype
,
$ids
,
$merge_base_id
);
unset
(
$_GET
[
'ID'
]);
}
else
{
...
...
@@ -87,18 +87,18 @@ if (check_token()) {
$output
=
__
(
"The selected packages have not been deleted, check the confirmation checkbox."
);
}
}
elseif
(
current_action
(
"do_Notify"
))
{
list
(
$ret
,
$output
)
=
pkg_notify
(
$atype
,
$ids
);
list
(
$ret
,
$output
)
=
pkg
base
_notify
(
$atype
,
$ids
);
}
elseif
(
current_action
(
"do_UnNotify"
))
{
list
(
$ret
,
$output
)
=
pkg_notify
(
$atype
,
$ids
,
false
);
list
(
$ret
,
$output
)
=
pkg
base
_notify
(
$atype
,
$ids
,
false
);
}
elseif
(
current_action
(
"do_DeleteComment"
))
{
list
(
$ret
,
$output
)
=
pkg_delete_comment
(
$atype
);
list
(
$ret
,
$output
)
=
pkg
base
_delete_comment
(
$atype
);
}
elseif
(
current_action
(
"do_ChangeCategory"
))
{
list
(
$ret
,
$output
)
=
pkg_change_category
(
$base_id
,
$atype
);
list
(
$ret
,
$output
)
=
pkg
base
_change_category
(
$base_id
,
$atype
);
}
if
(
isset
(
$_REQUEST
[
'comment'
]))
{
$uid
=
uid_from_sid
(
$_COOKIE
[
"AURSID"
]);
add_package
_comment
(
$base_id
,
$uid
,
$_REQUEST
[
'comment'
]);
pkgbase_add
_comment
(
$base_id
,
$uid
,
$_REQUEST
[
'comment'
]);
$ret
=
true
;
}
...
...
@@ -115,7 +115,7 @@ if (check_token()) {
}
}
$details
=
get_
pkgbase_details
(
$base_id
);
$details
=
pkgbase_
get_
details
(
$base_id
);
html_header
(
$title
,
$details
);
?>
...
...
@@ -126,9 +126,9 @@ html_header($title, $details);
<?php
include
(
'pkg_search_form.php'
);
if
(
isset
(
$_COOKIE
[
"AURSID"
]))
{
display_pkgbase
_details
(
$base_id
,
$details
,
$_COOKIE
[
"AURSID"
]);
pkgbase_display
_details
(
$base_id
,
$details
,
$_COOKIE
[
"AURSID"
]);
}
else
{
display_pkgbase
_details
(
$base_id
,
$details
,
null
);
pkgbase_display
_details
(
$base_id
,
$details
,
null
);
}
html_footer
(
AUR_VERSION
);
...
...
web/html/pkgsubmit.php
View file @
676595f9
...
...
@@ -259,7 +259,7 @@ if ($uid):
}
/* Check if package name is blacklisted. */
if
(
!
$base_id
&&
pkgname_is_blacklisted
(
$pi
[
'pkgname'
])
&&
!
can_submit_blacklisted
(
account_from_sid
(
$_COOKIE
[
"AURSID"
])))
{
if
(
!
$base_id
&&
pkg
_
name_is_blacklisted
(
$pi
[
'pkgname'
])
&&
!
can_submit_blacklisted
(
account_from_sid
(
$_COOKIE
[
"AURSID"
])))
{
$error
=
__
(
"%s is on the package blacklist, please check if it's available in the official repos."
,
$pi
[
'pkgname'
]);
break
;
}
...
...
@@ -329,30 +329,30 @@ if ($uid):
*/
$was_orphan
=
(
pkgbase_maintainer_uid
(
$base_id
)
===
NULL
);
update_pkgbas
e
(
$base_id
,
$pkgbase_info
[
'pkgbase'
],
$uid
);
pkgbase_updat
e
(
$base_id
,
$pkgbase_info
[
'pkgbase'
],
$uid
);
if
(
$category_id
>
1
)
{
update_pkgbas
e_category
(
$base_id
,
$category_id
);
pkgbase_updat
e_category
(
$base_id
,
$category_id
);
}
pkgbase_delete_packages
(
$base_id
);
}
else
{
/* This is a brand new package. */
$was_orphan
=
true
;
$base_id
=
create_pkgbas
e
(
$pkgbase_name
,
$category_id
,
$uid
);
$base_id
=
pkgbase_creat
e
(
$pkgbase_name
,
$category_id
,
$uid
);
}
foreach
(
$pkginfo
as
$pi
)
{
$pkgid
=
create
_pkg
(
$base_id
,
$pi
[
'pkgname'
],
$pi
[
'license'
],
$pi
[
'full-version'
],
$pi
[
'pkgdesc'
],
$pi
[
'url'
]);
$pkgid
=
pkg_
create
(
$base_id
,
$pi
[
'pkgname'
],
$pi
[
'license'
],
$pi
[
'full-version'
],
$pi
[
'pkgdesc'
],
$pi
[
'url'
]);
foreach
(
$pi
[
'depends'
]
as
$dep
)
{
$deppkgname
=
preg_replace
(
"/(<|=|>).*/"
,
""
,
$dep
);
$depcondition
=
str_replace
(
$deppkgname
,
""
,
$dep
);
add_pkg
_dep
(
$pkgid
,
$deppkgname
,
$depcondition
);
pkg_add
_dep
(
$pkgid
,
$deppkgname
,
$depcondition
);
}
foreach
(
$pi
[
'source'
]
as
$src
)
{
add_pkg
_src
(
$pkgid
,
$src
);
pkg_add
_src
(
$pkgid
,
$src
);
}
}
...
...
@@ -362,7 +362,7 @@ if ($uid):
* notification list.
*/
if
(
$was_orphan
)
{
pkg_notify
(
account_from_sid
(
$_COOKIE
[
"AURSID"
]),
array
(
$base_id
),
true
);
pkg
base
_notify
(
account_from_sid
(
$_COOKIE
[
"AURSID"
]),
array
(
$base_id
),
true
);
}
end_atomic_commit
();
...
...
@@ -387,7 +387,7 @@ html_header("Submit");
# give the visitor the default upload form
if
(
ini_get
(
"file_uploads"
))
:
$pkg_categories
=
pkg_categories
();
$pkg
base
_categories
=
pkg
base
_categories
();
?>
<?php
if
(
$error
)
:
?>
...
...
@@ -406,7 +406,7 @@ html_header("Submit");
<select
id=
"id_category"
name=
"category"
>
<option
value=
"1"
>
<?=
__
(
"Select Category"
);
?>
</option>
<?php
foreach
(
$pkg_categories
as
$num
=>
$cat
)
:
foreach
(
$pkg
base
_categories
as
$num
=>
$cat
)
:
print
'<option value="'
.
$num
.
'"'
;
if
(
isset
(
$_POST
[
'category'
])
&&
$_POST
[
'category'
]
==
$cat
)
:
print
' selected="selected"'
;
...
...
web/html/voters.php
View file @
676595f9
...
...
@@ -5,7 +5,7 @@ include_once('pkgfuncs.inc.php');
$SID
=
$_COOKIE
[
'AURSID'
];
$pkgname
=
htmlspecialchars
(
$_GET
[
'N'
]);
$votes
=
votes_f
or_pkg
name
(
$pkgname
);
$votes
=
pkgbase_
votes_f
rom_
name
(
$pkgname
);
$atype
=
account_from_sid
(
$SID
);
html_header
(
__
(
"Voters"
));
...
...
web/lib/pkgfuncs.inc.php
View file @
676595f9
...
...
@@ -90,7 +90,7 @@ function can_submit_blacklisted($atype = "") {
*
* @return array All package categories
*/
function
pkg_categories
()
{
function
pkg
base
_categories
()
{
$cats
=
array
();
$dbh
=
DB
::
connect
();
$q
=
"SELECT * FROM PackageCategories WHERE ID != 1 "
;
...
...
@@ -111,7 +111,7 @@ function pkg_categories() {
*
* @return string|void Package name if it already exists
*/
function
pkg
id
_from_name
(
$name
=
""
)
{
function
pkg_from_name
(
$name
=
""
)
{
if
(
!
$name
)
{
return
NULL
;}
$dbh
=
DB
::
connect
();
$q
=
"SELECT ID FROM Packages "
;
...
...
@@ -131,7 +131,7 @@ function pkgid_from_name($name="") {
*
* @return array All package dependencies for the package
*/
function
p
ackage
_dependencies
(
$pkgid
)
{
function
p
kg
_dependencies
(
$pkgid
)
{
$deps
=
array
();
$pkgid
=
intval
(
$pkgid
);
if
(
$pkgid
>
0
)
{
...
...
@@ -158,7 +158,7 @@ function package_dependencies($pkgid) {
*
* @return array All packages that depend on the specified package name
*/
function
p
ackage
_required
(
$name
=
""
)
{
function
p
kg
_required
(
$name
=
""
)
{
$deps
=
array
();
if
(
$name
!=
""
)
{
$dbh
=
DB
::
connect
();
...
...
@@ -182,7 +182,7 @@ function package_required($name="") {
*
* @return string The number of comments left for a specific package
*/
function
p
ackag
e_comments_count
(
$base_id
)
{
function
p
kgbas
e_comments_count
(
$base_id
)
{
$dbh
=
DB
::
connect
();
$base_id
=
intval
(
$base_id
);
...
...
@@ -209,7 +209,7 @@ function package_comments_count($base_id) {
*
* @return array All package comment information for a specific package base
*/
function
p
ackag
e_comments
(
$base_id
)
{
function
p
kgbas
e_comments
(
$base_id
)
{
$base_id
=
intval
(
$base_id
);
$comments
=
array
();
if
(
$base_id
>
0
)
{
...
...
@@ -248,7 +248,7 @@ function package_comments($base_id) {
*
* @return void
*/
function
add_package
_comment
(
$base_id
,
$uid
,
$comment
)
{
function
pkgbase_add
_comment
(
$base_id
,
$uid
,
$comment
)
{
global
$AUR_LOCATION
;
$dbh
=
DB
::
connect
();
...
...
@@ -311,7 +311,7 @@ function add_package_comment($base_id, $uid, $comment) {
*
* @return array All sources associated with a specific package
*/
function
p
ackage
_sources
(
$pkgid
)
{
function
p
kg
_sources
(
$pkgid
)
{
$sources
=
array
();
$pkgid
=
intval
(
$pkgid
);
if
(
$pkgid
>
0
)
{
...
...
@@ -337,7 +337,7 @@ function package_sources($pkgid) {
*
* @return array All packages the visitor has voted for
*/
function
pkgvotes_from_sid
(
$sid
=
""
)
{
function
pkg
base_
votes_from_sid
(
$sid
=
""
)
{
$pkgs
=
array
();
if
(
!
$sid
)
{
return
$pkgs
;}
$dbh
=
DB
::
connect
();
...
...
@@ -362,7 +362,7 @@ function pkgvotes_from_sid($sid="") {
*
* @return array|string All names if multiple package IDs, otherwise package name
*/
function
pkgname_from_id
(
$pkgids
)
{
function
pkg
_
name_from_id
(
$pkgids
)
{
if
(
is_array
(
$pkgids
))
{
$pkgids
=
sanitize_ids
(
$pkgids
);
$names
=
array
();
...
...
@@ -398,7 +398,7 @@ function pkgname_from_id($pkgids) {
*
* @return bool True if the name is blacklisted, otherwise false
*/
function
pkgname_is_blacklisted
(
$name
)
{
function
pkg
_
name_is_blacklisted
(
$name
)
{
$dbh
=
DB
::
connect
();
$q
=
"SELECT COUNT(*) FROM PackageBlacklist "
;
$q
.
=
"WHERE Name = "
.
$dbh
->
quote
(
$name
);
...
...
@@ -415,7 +415,7 @@ function pkgname_is_blacklisted($name) {
*
* @return array The package's details OR error message
**/
function
get_packa
ge_details
(
$id
=
0
)
{
function
pkg_
ge
t
_details
(
$id
=
0
)
{
$dbh
=
DB
::
connect
();
$q
=
"SELECT Packages.*, PackageBases.Name AS BaseName, "
;
...
...
@@ -451,7 +451,7 @@ function get_package_details($id=0) {
*
* @return array The package base's details OR error message
**/
function
get_
pkgbase_details
(
$base_id
)
{
function
pkgbase_
get_
details
(
$base_id
)
{
$dbh
=
DB
::
connect
();
$q
=
"SELECT PackageBases.ID, PackageBases.Name, "
;
...
...
@@ -485,12 +485,12 @@ function get_pkgbase_details($base_id) {
* @global string $AUR_LOCATION The AUR's URL used for notification e-mails
* @global bool $USE_VIRTUAL_URLS True if using URL rewriting, otherwise false
* @param string $id The package ID to get details page for
* @param array $row Package details retrieved by
get_packa
ge_details
* @param array $row Package details retrieved by
pkg_
ge
t
_details
()
* @param string $SID The session ID of the visitor
*
* @return void
*/
function
display_
package_
details
(
$id
=
0
,
$row
,
$SID
=
""
)
{
function
pkg_
display_details
(
$id
=
0
,
$row
,
$SID
=
""
)
{
global
$AUR_LOCATION
;
global
$USE_VIRTUAL_URLS
;
...
...
@@ -510,7 +510,7 @@ function display_package_details($id=0, $row, $SID="") {
include
(
'pkg_comment_form.php'
);
}
$comments
=
p
ackag
e_comments
(
$base_id
);
$comments
=
p
kgbas
e_comments
(
$base_id
);
if
(
!
empty
(
$comments
))
{
include
(
'pkg_comments.php'
);
}
...
...
@@ -523,12 +523,12 @@ function display_package_details($id=0, $row, $SID="") {
* @global string $AUR_LOCATION The AUR's URL used for notification e-mails
* @global bool $USE_VIRTUAL_URLS True if using URL rewriting, otherwise false
* @param string $id The package base ID to get details page for
* @param array $row Package base details retrieved by
get_
pkgbase_details
* @param array $row Package base details retrieved by pkgbase_
get_
details
()
* @param string $SID The session ID of the visitor
*
* @return void
*/
function
display_pkgbase
_details
(
$base_id
,
$row
,
$SID
=
""
)
{
function
pkgbase_display
_details
(
$base_id
,
$row
,
$SID
=
""
)
{
global
$AUR_LOCATION
;
global
$USE_VIRTUAL_URLS
;
...
...
@@ -547,7 +547,7 @@ function display_pkgbase_details($base_id, $row, $SID="") {
include
(
'pkg_comment_form.php'
);
}
$comments
=
p
ackag
e_comments
(
$base_id
);
$comments
=
p
kgbas
e_comments
(
$base_id
);
if
(
!
empty
(
$comments
))
{
include
(
'pkg_comments.php'
);
}
...
...
@@ -608,7 +608,7 @@ function pkg_search_page($SID="") {
*/
if
(
$SID
)
$myuid
=
uid_from_sid
(
$SID
);
$cats
=
pkg_categories
(
$dbh
);
$cats
=
pkg
base
_categories
(
$dbh
);
/* Sanitize paging variables. */
if
(
isset
(
$_GET
[
'O'
]))
{
...
...
@@ -950,7 +950,7 @@ function pkgbase_maintainer_uid($base_id) {
*
* @return array Tuple of success/failure indicator and error message
*/
function
pkg_flag
(
$atype
,
$base_ids
)
{
function
pkg
base
_flag
(
$atype
,
$base_ids
)
{
global
$AUR_LOCATION
;
if
(
!
$atype
)
{
...
...
@@ -1008,7 +1008,7 @@ function pkg_flag($atype, $base_ids) {
*
* @return array Tuple of success/failure indicator and error message
*/
function
pkg_unflag
(
$atype
,
$base_ids
)
{
function
pkg
base
_unflag
(
$atype
,
$base_ids
)
{
if
(
!
$atype
)
{
return
array
(
false
,
__
(
"You must be logged in before you can unflag packages."
));
}
...
...
@@ -1044,7 +1044,7 @@ function pkg_unflag($atype, $base_ids) {
*
* @return array Tuple of success/failure indicator and error message
*/
function
pkg_delete
(
$atype
,
$base_ids
,
$merge_base_id
)
{
function
pkg
base
_delete
(
$atype
,
$base_ids
,
$merge_base_id
)
{
if
(
!
$atype
)
{
return
array
(
false
,
__
(
"You must be logged in before you can delete packages."
));
}
...
...
@@ -1152,7 +1152,7 @@ function pkg_delete ($atype, $base_ids, $merge_base_id) {
*
* @return array Tuple of success/failure indicator and error message
*/
function
pkg_adopt
(
$atype
,
$base_ids
,
$action
=
true
)
{
function
pkg
base
_adopt
(
$atype
,
$base_ids
,
$action
=
true
)
{
if
(
!
$atype
)
{
if
(
$action
)
{
return
array
(
false
,
__
(
"You must be logged in before you can adopt packages."
));
...
...
@@ -1194,7 +1194,7 @@ function pkg_adopt ($atype, $base_ids, $action=true) {
$dbh
->
exec
(
$q
);
if
(
$action
)
{
pkg_notify
(
account_from_sid
(
$_COOKIE
[
"AURSID"
]),
$pkg_ids
);
pkg
base
_notify
(
account_from_sid
(
$_COOKIE
[
"AURSID"
]),
$pkg_ids
);
return
array
(
true
,
__
(
"The selected packages have been adopted."
));
}
else
{
return
array
(
true
,
__
(
"The selected packages have been disowned."
));
...
...
@@ -1210,7 +1210,7 @@ function pkg_adopt ($atype, $base_ids, $action=true) {
*
* @return array Tuple of success/failure indicator and error message
*/
function
pkg_vote
(
$atype
,
$base_ids
,
$action
=
true
)
{
function
pkg
base
_vote
(
$atype
,
$base_ids
,
$action
=
true
)
{
if
(
!
$atype
)
{
if
(
$action
)
{
return
array
(
false
,
__
(
"You must be logged in before you can vote for packages."
));
...
...
@@ -1229,7 +1229,7 @@ function pkg_vote ($atype, $base_ids, $action=true) {
}
$dbh
=
DB
::
connect
();
$my_votes
=
pkgvotes_from_sid
(
$_COOKIE
[
"AURSID"
]);
$my_votes
=
pkg
base_
votes_from_sid
(
$_COOKIE
[
"AURSID"
]);
$uid
=
uid_from_sid
(
$_COOKIE
[
"AURSID"
]);
$first
=
1
;
...
...
@@ -1287,7 +1287,7 @@ function pkg_vote ($atype, $base_ids, $action=true) {
*
* @return array User IDs and usernames that voted for a specific package
*/
function
votes_f
or_pkg
name
(
$pkgname
)
{
function
pkgbase_
votes_f
rom_
name
(
$pkgname
)
{
$dbh
=
DB
::
connect
();
$q
=
"SELECT UsersID,Username,Name FROM PackageVotes "
;
...
...
@@ -1317,7 +1317,7 @@ function votes_for_pkgname($pkgname) {
*
* @return bool True if the user has already voted, otherwise false
*/
function
user_voted
(
$uid
,
$pkgid
)
{
function
pkgbase_
user_voted
(
$uid
,
$pkgid
)
{
$dbh
=
DB
::
connect
();
$q
=
"SELECT * FROM PackageVotes, Packages WHERE "
;
...
...
@@ -1342,7 +1342,7 @@ function user_voted($uid, $pkgid) {
*
* @return bool True if the user wants notifications, otherwise false
*/
function
user_notify
(
$uid
,
$base_id
)
{
function
pkgbase_
user_notify
(
$uid
,
$base_id
)
{
$dbh
=
DB
::
connect
();
$q
=
"SELECT * FROM CommentNotify WHERE UserID = "
.
$dbh
->
quote
(
$uid
);
...
...
@@ -1365,7 +1365,7 @@ function user_notify($uid, $base_id) {
*
* @return array Tuple of success/failure indicator and error message
*/
function
pkg_notify
(
$atype
,
$base_ids
,
$action
=
true
)
{
function
pkg
base
_notify
(
$atype
,
$base_ids
,
$action
=
true
)
{
if
(
!
$atype
)
{
return
;
}
...
...
@@ -1442,7 +1442,7 @@ function pkg_notify ($atype, $base_ids, $action=true) {
*
* @return array Tuple of success/failure indicator and error message
*/
function
pkg_delete_comment
(
$atype
)
{
function
pkg
base
_delete_comment
(
$atype
)
{
if
(
!
$atype
)
{
return
array
(
false
,
__
(
"You must be logged in before you can edit package information."
));
}
...
...
@@ -1473,7 +1473,7 @@ function pkg_delete_comment($atype) {
*
* @return array Tuple of success/failure indicator and error message
*/
function
pkg_change_category
(
$pid
,
$atype
)
{
function
pkg
base
_change_category
(
$pid
,
$atype
)
{
if
(
!
$atype
)
{
return
array
(
false
,
__
(
"You must be logged in before you can edit package information."
));
}
...
...
@@ -1485,7 +1485,7 @@ function pkg_change_category($pid, $atype) {
}
$dbh
=
DB
::
connect
();
$catArray
=
pkg_categories
(
$dbh
);
$catArray
=
pkg
base
_categories
(
$dbh
);
if
(
!
array_key_exists
(
$category_id
,
$catArray
))
{
return
array
(
false
,
__
(
"Invalid category ID."
));
}
...
...
@@ -1522,7 +1522,7 @@ function pkg_change_category($pid, $atype) {
*
* @return array All package details for a specific package
*/
function
pkgdetails_by_
pkg
name
(
$pkgname
)
{
function
pkg
_
details_by_name
(
$pkgname
)
{
$dbh
=
DB
::
connect
();
$q
=
"SELECT Packages.*, PackageBases.Name AS BaseName, "
;
$q
.
=
"PackageBases.CategoryID, PackageBases.NumVotes, "
;
...
...
@@ -1548,7 +1548,7 @@ function pkgdetails_by_pkgname($pkgname) {
*
* @return int ID of the new package base
*/
function
create_pkgbas
e
(
$name
,
$category_id
,
$uid
)
{
function
pkgbase_creat
e
(
$name
,
$category_id
,
$uid
)
{
$dbh
=
DB
::
connect
();
$q
=
sprintf
(
"INSERT INTO PackageBases (Name, CategoryID, "
.
"SubmittedTS, ModifiedTS, SubmitterUID, MaintainerUID) "
.
...
...
@@ -1570,7 +1570,7 @@ function create_pkgbase($name, $category_id, $uid) {
*
* @return int ID of the new package
*/
function
create
_pkg
(
$base_id
,
$pkgname
,
$license
,
$pkgver
,
$pkgdesc
,
$pkgurl
)
{
function
pkg_
create
(
$base_id
,
$pkgname
,
$license
,
$pkgver
,
$pkgdesc
,
$pkgurl
)
{
$dbh
=
DB
::
connect
();
$q
=
sprintf
(
"INSERT INTO Packages (PackageBaseID, Name, License, "
.
"Version, Description, URL) VALUES (%d, %s, %s, %s, %s, %s)"
,
...
...
@@ -1590,7 +1590,7 @@ function create_pkg($base_id, $pkgname, $license, $pkgver, $pkgdesc, $pkgurl) {
*
* @return void
*/
function
update_pkgbas
e
(
$base_id
,
$name
,
$uid
)
{
function
pkgbase_updat
e
(
$base_id
,
$name
,
$uid
)
{
$dbh
=
DB
::
connect
();
$q
=
sprintf
(
"UPDATE PackageBases SET "
.
"Name = %s, ModifiedTS = UNIX_TIMESTAMP(), "
.
...
...
@@ -1612,7 +1612,7 @@ function update_pkgbase($base_id, $name, $uid) {
*
* @return void
*/
function
update
_pkg
(
$pkgname
,
$license
,
$pkgver
,
$pkgdesc
,
$pkgurl
,
$pkgid
)
{
function
pkg_
update
(
$pkgname
,
$license
,
$pkgver
,
$pkgdesc
,
$pkgurl
,
$pkgid
)
{
$dbh
=
DB
::
connect
();
$q
=
sprintf
(
"UPDATE Packages SET Name = %s, Version = %s, "
.
"License = %s, Description = %s, URL = %s WHERE ID = %d"
,
...
...
@@ -1634,7 +1634,7 @@ function update_pkg($pkgname, $license, $pkgver, $pkgdesc, $pkgurl, $pkgid) {
*
* @return void
*/
function
add_pkg
_dep
(
$pkgid
,
$depname
,
$depcondition
)
{
function
pkg_add
_dep
(
$pkgid
,
$depname
,
$depcondition
)
{
$dbh
=
DB
::
connect
();
$q
=
sprintf
(
"INSERT INTO PackageDepends (PackageID, DepName, DepCondition) VALUES (%d, %s, %s)"
,
$pkgid
,
...
...
@@ -1652,7 +1652,7 @@ function add_pkg_dep($pkgid, $depname, $depcondition) {
*
* @return void
*/
function
add_pkg
_src
(
$pkgid
,
$pkgsrc
)
{
function
pkg_add
_src
(
$pkgid
,
$pkgsrc
)
{
$dbh
=
DB
::
connect
();
$q
=
"INSERT INTO PackageSources (PackageID, Source) VALUES ("
;
$q
.
=
$pkgid
.
", "
.
$dbh
->
quote
(
$pkgsrc
)
.
")"
;
...
...
@@ -1668,7 +1668,7 @@ function add_pkg_src($pkgid, $pkgsrc) {
*
* @return void
*/
function
update_pkgbas
e_category
(
$base_id
,
$category_id
)
{
function
pkgbase_updat
e_category
(
$base_id
,
$category_id
)
{
$dbh
=
DB
::
connect
();
$q
=
sprintf
(
"UPDATE PackageBases SET CategoryID = %d WHERE ID = %d"
,
$category_id
,
$base_id
);
...
...
@@ -1682,7 +1682,7 @@ function update_pkgbase_category($base_id, $category_id) {
*
* @return void
*/
function
remove_
pkg_
deps
(
$pkgid
)
{
function
pkg_
remove_deps
(
$pkgid
)
{
$dbh
=
DB
::
connect
();
$q
=
"DELETE FROM PackageDepends WHERE PackageID = "
.
$pkgid
;
...
...
@@ -1696,7 +1696,7 @@ function remove_pkg_deps($pkgid) {
*
* @return void
*/
function
remove_
pkg_
sources
(
$pkgid
)
{
function
pkg_
remove_sources
(
$pkgid
)
{
$dbh
=
DB
::
connect
();
$q
=
"DELETE FROM PackageSources WHERE PackageID = "
.
$pkgid
;
...
...
web/template/actions_form.php
View file @
676595f9
...
...
@@ -6,13 +6,13 @@
<input
type=
"hidden"
name=
"ID"
value=
"
<?=
$row
[
'ID'
]
?>
"
/>
<input
type=
"hidden"
name=
"token"
value=
"
<?=
htmlspecialchars
(
$_COOKIE
[
'AURSID'
])
?>
"
/>
<?php
if
(
user_voted
(
$uid
,
$row
[
'ID'
]))
:
?>
<?php
if
(
pkgbase_
user_voted
(
$uid
,
$row
[
'ID'
]))
:
?>
<input
type=
"submit"
class=
"button"
name=
"do_UnVote"
value=
"
<?=
__
(
"UnVote"
)
?>
"
/>
<?php
else
:
?>
<input
type=
"submit"
class=
"button"
name=
"do_Vote"
value=
"
<?=
__
(
"Vote"
)
?>
"
/>
<?php
endif
;
?>
<?php
if
(
user_notify
(
$uid
,
$row
[
'ID'
]))
:
?>
<?php
if
(
pkgbase_
user_notify
(
$uid
,
$row
[
'ID'
]))
:
?>
<input
type=
"submit"
class=
"button"
name=
"do_UnNotify"
value=
"
<?=
__
(
"UnNotify"
)
?>
"
title=
"
<?=
__
(
"No New Comment Notification"
)
?>
"
/>
<?php
else
:
?>
<input
type=
"submit"
class=
"button"
name=
"do_Notify"
value=
"
<?=
__
(
"Notify"
)
?>
"
title=
"
<?=
__
(
"New Comment Notification"
)
?>
"
/>
...
...
web/template/pkg_comments.php
View file @
676595f9
<?php
$uid
=
uid_from_sid
(
$SID
);
$base_id
=
pkgbase_from_pkgid
(
$row
[
'ID'
]);
$count
=
p
ackag
e_comments_count
(
$base_id
);
$count
=
p
kgbas
e_comments_count
(
$base_id
);
?>
<div
id=
"news"
>
<h3>
...
...
web/template/pkg_details.php
View file @
676595f9
...
...
@@ -4,7 +4,7 @@ $uid = uid_from_sid($SID);
$pkgid
=
intval
(
$row
[
'ID'
]);
$catarr
=
pkg_categories
();
$catarr
=
pkg
base
_categories
();
$submitter
=
username_from_id
(
$row
[
"SubmitterUID"
]);