gaim/www
Clone
Summary
Browse
Changes
Graph
people are dense
WITH_GTK12_ANSWERS
2004-01-19, Luke Schierer
522b8ea7e1b3
people are dense
<?php
require
"base.inc.php"
;
require
"smilies.inc.php"
;
require
"Table.inc.php"
;
function
build_theme_list_nav
()
{
global
$session
,
$users
,
$PHP_SELF
;
global
$action
,
$keywords
;
if
(
$action
==
"listall"
||
$action
==
""
)
{
$buffer
=
"<b>All Themes</b>"
;
}
else
{
$buffer
=
"<a href=
\"
"
.
$session
->
localUrl
(
$PHP_SELF
)
.
"?action=listall
\"
>All Themes</a>"
;
}
$buffer
.=
" "
;
if
(
$action
==
"listpopular"
)
$buffer
.=
"<b>Popular Themes</b>"
;
else
$buffer
.=
"<a href=
\"
"
.
$session
->
localUrl
(
$PHP_SELF
)
.
"?action=listpopular
\"
>Popular Themes</a>"
;
$buffer
.=
" "
;
$buffer
.=
"<b>·</b> "
;
if
(
$action
==
"search"
&&
!
isset
(
$keywords
))
$buffer
.=
"<b>Search</b>"
;
else
$buffer
.=
"<a href=
\"
themes.php?action=search
\"
>Search</a>"
;
$buffer
.=
" "
;
$buffer
.=
"<b>·</b> "
;
if
(
$users
->
logged_in
())
{
if
(
$action
==
"addtheme"
)
$buffer
.=
"<b>Add Theme</b>"
;
else
$buffer
.=
"<a href=
\"
"
.
$session
->
localUrl
(
$PHP_SELF
)
.
"?action=addtheme
\"
>Add Theme</a>"
;
$buffer
.=
" "
;
$buffer
.=
"<b>·</b> "
;
$buffer
.=
"<a href=
\"
"
.
$session
->
localUrl
(
"logout.php"
)
.
"
\"
>Log Out</a>"
;
}
else
{
$buffer
.=
"<a href=
\"
"
.
$session
->
localUrl
(
"login.php"
)
.
"
\"
>Log In</a> "
;
$buffer
.=
"<a href=
\"
"
.
$session
->
localUrl
(
"register.php"
)
.
"
\"
>Register Account</a>"
;
}
return
$buffer
;
}
function
display_unknown_theme
()
{
setup_site
(
"Unknown Theme"
);
start_section
(
"Unknown Theme"
,
build_theme_list_nav
(),
false
);
?>
<p>
The
theme
specified
does
not
exist
in
the
database.
</p>
<?php
end_section
();
site_shutdown
();
}
function
display_permission_denied
(
$type
)
{
setup_site
(
"Permission Denied"
);
start_section
(
"Permission Denied"
,
build_theme_list_nav
(),
false
);
?>
<p>
You
do
not
have
permission
to
<?php
print
$type
?>
this
theme.
This
incident
has
been
reported
to
the
FBI.
</p>
<?php
end_section
();
site_shutdown
();
}
function
display_add_theme
()
{
global
$_FILES
,
$HTTP_POST_FILES
,
$HTTP_POST_VARS
;
global
$users
,
$themes
;
global
$name
,
$version
,
$url
,
$homepage
,
$filesize
,
$brief
;
global
$icon
,
$screenshot
;
global
$icon_size
,
$screenshot_size
;
global
$theme_icon_dir
,
$theme_screenshot_dir
;
global
$description
;
global
$themetype
;
global
$step
;
$missinginfo
=
false
;
if
(
$step
==
2
)
{
$requiredinfo
=
array
(
"name"
,
"version"
,
"url"
,
"filesize"
,
"brief"
,
"description"
);
for
(
$i
=
0
;
$i
<
count
(
$requiredinfo
);
$i
++
)
{
if
(
empty
(
$GLOBALS
[
$requiredinfo
[
$i
]]))
{
$GLOBALS
[
$requiredinfo
[
$i
]]
=
-
1
;
$missinginfo
=
true
;
}
}
if
(
!
is_numeric
(
$filesize
))
{
$missinginfo
=
true
;
}
if
(
$missinginfo
==
false
)
{
$theme_id
=
$themes
->
add_theme
(
$users
->
get_active_user_id
(),
$name
,
$version
,
$url
,
$homepage
,
$filesize
,
$brief
,
$description
);
if
(
trim
(
$icon
)
!=
""
)
{
upload_image
(
$_FILES
[
'icon'
][
'name'
],
$_FILES
[
'icon'
][
'tmp_name'
],
$theme_icon_dir
,
$theme_id
);
}
if
(
trim
(
$screenshot
)
!=
""
)
{
upload_image
(
$_FILES
[
'screenshot'
][
'name'
],
$_FILES
[
'screenshot'
][
'tmp_name'
],
$theme_screenshot_dir
,
$theme_id
);
}
header
(
"Location: themes.php"
);
exit
;
}
}
setup_site
(
"Add Theme"
);
start_section
(
"Add Theme"
,
build_theme_list_nav
(),
false
);
if
(
$missinginfo
)
:
if
(
!
is_numeric
(
$filesize
))
:
?>
<b>
Error:
</b>
The
file
size
field
must
be
an
integer!
<?php
endif
;
?>
<p>
You
must
enter
in
all
the
required
information.
Please
fill
in
the
information
in
<font
color=
"#FF0000"
>
red
</font>
,
as
well
as
your
password
again,
to
register.
</p>
<?php
endif
;
?>
<p>
To
add
a
theme
to
the
database,
please
fill
out
the
form
below.
</p>
<p>
All
posted
material
is
subject
to
the
discretion
of
the
Gaim
team.
As
Gaim
is
a
family
oriented
web
site,
please
refrain
from
posting
questionable
material.
We
reserve
the
right
to
remove
any
content
which
we
deem
inappropriate.
</p>
<p>
Please
note
that
all
fields
marked
with
a
red
asterisk
(
<font
color=
"#FF0000"
>
*
</font>
)
must
be
filled
in!
</p>
<br
/>
<form
method=
"post"
action=
"themes.php"
enctype=
"multipart/form-data"
>
<input
type=
"hidden"
name=
"action"
value=
"addtheme"
/>
<input
type=
"hidden"
name=
"step"
value=
"2"
/>
<input
type=
"hidden"
name=
"themetype"
value=
"
<?php
print
$themetype
;
?>
"
/>
<?php
start_table
(
array
(
"width"
=>
"100%"
,
"cellspacing"
=>
0
,
"cellpadding"
=>
0
,
"border"
=>
0
));
start_tr
();
start_td
(
array
(
"align"
=>
"right"
,
"nowrap"
=>
"nowrap"
));
print
"<b>Theme Type:</b> "
;
end_td
();
start_td
();
print
$themes
->
get_description
();
end_tr
();
start_tr
();
empty_cell
(
array
(
"colspan"
=>
2
));
end_tr
();
form_item
(
"Name"
,
"name"
,
$name
,
true
,
16
,
128
);
form_item
(
"Version"
,
"version"
,
$version
,
true
,
16
,
16
);
form_item
(
"Brief Description"
,
"brief"
,
$brief
,
true
,
30
,
255
);
file_form
(
"Icon"
,
"icon"
,
$icon
,
false
,
30
);
file_form
(
"Screenshot"
,
"screenshot"
,
$screenshot
,
false
,
30
);
form_item
(
"Download URL"
,
"url"
,
$url
,
true
,
30
,
255
);
form_item
(
"Home Page"
,
"homepage"
,
$homepage
,
false
,
30
,
255
);
form_item
(
"File Size"
,
"filesize"
,
$filesize
,
true
,
15
,
255
);
start_tr
();
start_td
(
array
(
"align"
=>
"right"
));
start_tag
(
"small"
);
print
"(Specify in bytes)"
;
end_tag
(
"small"
);
end_td
();
empty_cell
();
if
(
$description
==
-
1
)
$description
=
""
;
start_tr
();
start_td
(
array
(
"colspan"
=>
2
));
br
();
start_table
(
array
(
"align"
=>
"center"
,
"border"
=>
0
,
"cellspacing"
=>
0
,
"cellpadding"
=>
0
));
start_tr
();
start_td
();
print
"<font color=
\"
#FF0000
\"
>*</font> "
;
print
"<b>Description:</b>"
;
br
();
start_tag
(
"textarea"
,
array
(
"rows"
=>
10
,
"cols"
=>
50
,
"name"
=>
"description"
));
print
$description
;
end_tag
(
"textarea"
);
end_td
();
end_tr
();
end_table
();
end_td
();
end_tr
();
start_tr
();
start_td
(
array
(
"colspan"
=>
2
,
"align"
=>
"center"
));
br
();
?>
<input
type=
"submit"
value=
"Submit"
/>
<input
type=
"reset"
/>
<?php
end_td
();
end_tr
();
end_table
();
end_tag
(
"form"
);
end_section
();
}
function
show_theme_var
(
$theme
,
$name
,
$var
,
$width
=
""
)
{
print
" <tr>
\n
"
;
print
" <td"
;
if
(
$width
!=
""
)
{
print
" width=
\"
$width
\"
"
;
}
print
" align=
\"
right
\"
valign=
\"
top
\"
>"
;
start_font
();
print
"<b>
$name
:</b> "
;
end_font
();
print
"</td>
\n
"
;
print
" <td"
;
if
(
$width
!=
""
)
{
print
" width=
\"
$width
\"
"
;
}
print
">"
;
start_font
();
print
$theme
[
$var
];
end_font
();
print
"</td>
\n
"
;
}
function
show_theme
()
{
global
$themes
,
$users
,
$session
;
global
$id
;
$themes
->
update_view_count
(
$id
);
$theme
=
$themes
->
get_theme
(
$id
);
setup_site
(
$theme
[
"NAME"
]
.
" v"
.
$theme
[
"VERSION"
]);
start_section
(
$theme
[
"NAME"
]
.
" v"
.
$theme
[
"VERSION"
],
build_theme_list_nav
(),
false
);
/* Outer table. */
start_table
(
array
(
"border"
=>
0
,
"width"
=>
"100%"
));
start_tr
();
start_td
(
array
(
"width"
=>
"100%"
,
"align"
=>
"center"
,
"valign"
=>
"top"
));
/* Inner info table. */
start_table
(
array
(
"border"
=>
0
,
"width"
=>
"100%"
));
show_theme_var
(
$theme
,
"Name"
,
"NAME"
,
"50%"
);
show_theme_var
(
$theme
,
"Version"
,
"VERSION"
);
show_theme_var
(
$theme
,
"Brief Description"
,
"BRIEF"
);
show_theme_var
(
$theme
,
"Author"
,
"AUTHOR"
);
show_theme_var
(
$theme
,
"Created"
,
"CREATED"
);
show_theme_var
(
$theme
,
"Last Updated"
,
"UPDATED"
);
end_table
();
br
();
/* Description table. */
start_table
(
array
(
"width"
=>
400
,
"border"
=>
0
,
"align"
=>
"center"
));
start_tr
();
start_td
();
print
"<b>Description:</b>"
;
end_td
();
end_tr
();
start_tr
();
start_td
();
print
$theme
[
"DESCRIPTION"
];
end_td
();
end_tr
();
end_table
();
end_td
();
start_td
(
array
(
"nowrap"
=>
"nowrap"
,
"valign"
=>
"top"
));
if
(
$theme
[
"USER_ID"
]
==
$users
->
get_active_user_id
())
{
start_table
(
array
(
"width"
=>
"100%"
,
"border"
=>
0
));
start_tr
();
start_td
();
ahref
(
"Edit Theme"
,
"themes.php?action=edittheme&id=
$id
"
);
end_td
();
end_tr
();
start_tr
();
start_td
();
ahref
(
"Delete Theme"
,
"themes.php?action=deletetheme&id=
$id
"
);
end_td
();
end_tr
();
end_table
();
br
();
}
/* Home Page / Download table. */
start_table
(
array
(
"width"
=>
"100%"
,
"border"
=>
0
));
if
(
$theme
[
"HOMEPAGE"
]
!=
""
)
{
start_tr
();
start_td
(
array
(
"nowrap"
=>
"nowrap"
));
ahref
(
"Home Page"
,
$theme
[
"HOMEPAGE"
]);
end_td
();
end_tr
();
}
start_tr
();
start_td
(
array
(
"nowrap"
=>
"nowrap"
));
ahref
(
"Download"
,
"
$PHP_SELF
?action=download&id=
$id
"
);
end_td
();
end_tr
();
end_table
();
br
();
/* Theme stats table */
start_table
(
array
(
"width"
=>
"100%"
,
"border"
=>
0
));
start_tr
();
start_td
(
array
(
"nowrap"
=>
"nowrap"
));
print
"<b>File Size:</b> "
.
$theme
[
"FILESIZE"
];
end_td
();
end_tr
();
start_tr
();
start_td
(
array
(
"nowrap"
=>
"nowrap"
));
print
"<b>Page Views:</b> "
.
$theme
[
"VIEW_COUNT"
];
end_td
();
end_tr
();
start_tr
();
start_td
(
array
(
"nowrap"
=>
"nowrap"
));
print
"<b>Download Count:</b> "
.
$theme
[
"DOWNLOAD_COUNT"
];
end_td
();
end_tr
();
end_table
();
end_td
();
end_tr
();
end_table
();
end_section
();
}
function
download_theme
()
{
global
$themes
,
$users
;
global
$id
;
$theme
=
$themes
->
get_theme
(
$id
);
if
(
$theme
==
NULL
)
display_unknown_theme
();
else
{
$themes
->
update_download_count
(
$id
);
header
(
"Location: "
.
$theme
[
"URL"
]);
exit
;
}
}
function
display_themes
()
{
global
$themes
,
$action
,
$start
,
$limit
;
global
$theme_icon_dir
;
if
(
!
isset
(
$start
))
$start
=
0
;
if
(
!
isset
(
$limit
))
$limit
=
25
;
if
(
$action
==
"listpopular"
)
{
$theme_list
=
$themes
->
get_popular_themes
();
$title
=
"Popular Themes"
;
}
else
{
$theme_list
=
$themes
->
get_all_themes
(
$start
,
$limit
);
$title
=
"Themes"
;
}
$theme_count
=
$themes
->
get_theme_count
();
setup_site
(
$title
);
start_section
(
$title
,
build_theme_list_nav
(),
false
);
if
(
$theme_list
==
NULL
)
{
?>
<p><i>
There
are
no
themes!
</i></p>
<?php
}
else
{
$table
=
new
Table
(
array
(
""
,
"Name"
,
"Brief Description"
,
"Version"
,
"Author"
,
"Downloads"
),
true
,
true
);
$table
->
set_alignment
(
0
,
"center"
);
$table
->
set_valignment
(
0
,
"center"
);
$table
->
set_widths
(
array
(
"20"
,
"20%"
,
"50%"
,
"10%"
,
"10%"
,
"10%"
));
$table
->
set_header_align
(
5
,
"right"
);
while
(
list
(
$id
,
$theme
)
=
each
(
$theme_list
))
{
$icon
=
$themes
->
get_icon
(
$theme
[
"THEME_ID"
]);
if
(
$icon
!=
""
)
$icon
=
"<img src=
\"
/themes/icons/
$icon
\"
border=
\"
0
\"
/>"
;
$table
->
add_row
(
array
(
$icon
,
"<a href=
\"
themes.php?action=showtheme&id=
$id
\"
>"
.
$theme
[
"NAME"
]
.
"</a>"
,
$theme
[
"BRIEF"
],
$theme
[
"VERSION"
],
$theme
[
"USERNAME"
],
$theme
[
"DOWNLOAD_COUNT"
]
),
array
(
0
,
array
(
"valign"
=>
"top"
),
array
(
"valign"
=>
"top"
),
array
(
"valign"
=>
"top"
),
array
(
"valign"
=>
"top"
),
array
(
"valign"
=>
"top"
,
"align"
=>
"right"
)
));
}
$table
->
output_html
();
if
(
$action
!=
"listpopular"
&&
$limit
<
$theme_count
)
{
br
();
start_tag
(
"div"
,
array
(
"align"
=>
"center"
));
if
(
$start
>
0
)
{
ahref
(
"Previous"
,
"themes.php?action=
$action
&start="
.
(
$start
-
$limit
)
.
"&limit="
.
$limit
);
}
else
print
"Previous"
;
print
" "
;
for
(
$i
=
0
;
$i
<
(
$theme_count
/
$limit
);
$i
++
)
{
if
((
$i
*
$limit
)
==
$start
)
print
"<b>"
.
(
$i
+
1
)
.
"</b>"
;
else
{
ahref
(
$i
+
1
,
"themes.php?action=
$action
&start="
.
(
$i
*
$limit
)
.
"&limit="
.
$limit
);
}
print
" "
;
}
print
" "
;
if
(
$start
+
$limit
<
$theme_count
)
{
ahref
(
"Next"
,
"themes.php?action=
$action
&start="
.
(
$start
+
$limit
)
.
"&limit="
.
$limit
);
}
else
print
"Next"
;
end_tag
(
"div"
);
}
}
end_section
();
}
function
display_edit_theme
()
{
global
$users
,
$session
,
$themes
;
global
$id
,
$step
;
global
$name
,
$version
,
$url
,
$homepage
,
$filesize
,
$brief
;
global
$themetype
;
global
$description
;
$theme
=
$themes
->
get_theme
(
$id
);
if
(
$theme
==
NULL
)
display_unknown_theme
();
elseif
(
$theme
[
"USER_ID"
]
!=
$users
->
get_active_user_id
())
display_permission_denied
(
"edit"
);
$missinginfo
=
false
;
if
(
$step
==
2
)
{
$requiredname
=
array
(
"name"
,
"version"
,
"url"
,
"filesize"
,
"brief"
,
"description"
);
for
(
$i
=
0
;
$i
<
count
(
$requiredinfo
);
$i
++
)
{
if
(
empty
(
$GLOBALS
[
$requiredinfo
[
$i
]]))
{
$GLOBALS
[
$requiredinfo
[
$i
]]
=
-
1
;
$missinginfo
=
true
;
}
}
if
(
!
is_numeric
(
$filesize
))
{
$missinginfo
=
true
;
}
if
(
$missinginfo
==
false
)
{
$themes
->
update_theme
(
$id
,
$name
,
$version
,
$url
,
$homepage
,
$filesize
,
$brief
,
$description
);
header
(
"Location: themes.php"
);
exit
;
}
}
else
{
$name
=
$theme
[
"NAME"
];
$version
=
$theme
[
"VERSION"
];
$url
=
$theme
[
"URL"
];
$homepage
=
$theme
[
"HOMEPAGE"
];
$filesize
=
$theme
[
"FILESIZE"
];
$brief
=
$theme
[
"BRIEF"
];
$description
=
$theme
[
"DESCRIPTION"
];
}
setup_site
(
"Edit Theme"
);
start_section
(
"Edit Theme"
,
build_theme_list_nav
(),
false
);
if
(
$missinginfo
)
:
if
(
!
is_numeric
(
$filesize
))
:
?>
<b>
Error:
</b>
The
file
size
field
must
be
an
integer!
<?php
endif
;
?>
<p>
You
must
enter
in
all
the
required
information.
Please
fill
in
the
information
in
<font
color=
"#FF0000"
>
red
</font>
,
as
well
as
your
password
again,
to
register.
</p>
<?php
endif
;
?>
<p>
To
add
a
theme
to
the
database,
please
fill
out
the
form
below.
</p>
<p>
<b>
Note:
</b>
If
you
don't
want
to
host
your
own
theme,
you
can
add
it
to
the
<a
href=
"http://sourceforge.net/tracker/?atid=390395&group_id=235&func=browse"
>
tracker
</a>
on
SourceForge,
and
use
the
resulting
URL
in
the
Download
URL
field
below.
</p>
<p>
Please
note
that
all
fields
marked
with
a
red
asterisk
(
<font
color=
"#FF0000"
>
*
</font>
)
must
be
filled
in!
</p>
<br
/>
<form
method=
"post"
action=
"themes.php"
enctype=
"multipart/form-data"
>
<input
type=
"hidden"
name=
"action"
value=
"edittheme"
/>
<input
type=
"hidden"
name=
"step"
value=
"2"
/>
<input
type=
"hidden"
name=
"id"
value=
"
<?php
print
$id
;
?>
"
/>
<input
type=
"hidden"
name=
"themetype"
value=
"
<?php
print
$themetype
;
?>
"
/>
<?php
start_table
(
array
(
"width"
=>
"100%"
,
"cellspacing"
=>
0
,
"cellpadding"
=>
0
,
"border"
=>
0
));
start_tr
();
start_td
(
array
(
"align"
=>
"right"
,
"nowrap"
=>
"nowrap"
));
print
"<b>Theme Type:</b> "
;
end_td
();
start_td
();
print
$themes
->
get_description
();
end_tr
();
start_tr
();
empty_cell
(
array
(
"colspan"
=>
2
));
end_tr
();
form_item
(
"Name"
,
"name"
,
$name
,
true
,
16
,
128
);
form_item
(
"Version"
,
"version"
,
$version
,
true
,
16
,
16
);
form_item
(
"Brief Description"
,
"brief"
,
$brief
,
true
,
30
,
255
);
file_form
(
"Icon"
,
"icon"
,
$icon
,
false
,
30
);
file_form
(
"Screenshot"
,
"screenshot"
,
$screenshot
,
false
,
30
);
form_item
(
"Download URL"
,
"url"
,
$url
,
true
,
30
,
255
);
form_item
(
"Home Page"
,
"homepage"
,
$homepage
,
false
,
30
,
255
);
form_item
(
"File Size"
,
"filesize"
,
$filesize
,
true
,
15
,
255
);
print
"<tr><td align=
\"
right
\"
><small>(Specify in bytes)</small></td>"
;
print
"<td> </td></tr>
\n
"
;
if
(
$description
==
-
1
)
$description
=
""
;
start_tr
();
start_td
(
array
(
"colspan"
=>
2
));
br
();
start_table
(
array
(
"align"
=>
"center"
,
"border"
=>
0
,
"cellspacing"
=>
0
,
"cellpadding"
=>
0
));
start_tr
();
start_td
();
print
"<font color=
\"
#FF0000
\"
>*</font> "
;
print
"<b>Description:</b>"
;
br
();
start_tag
(
"textarea"
,
array
(
"rows"
=>
10
,
"cols"
=>
50
,
"name"
=>
"description"
));
print
$description
;
end_tag
(
"textarea"
);
end_td
();
end_tr
();
end_table
();
end_td
();
end_tr
();
start_tr
();
start_td
(
array
(
"colspan"
=>
2
,
"align"
=>
"center"
));
br
();
?>
<input
type=
"submit"
value=
"Submit"
/>
<input
type=
"reset"
/>
<?php
end_td
();
end_tr
();
end_table
();
end_tag
(
"form"
);
end_section
();
}
function
display_delete_theme
()
{
global
$users
,
$session
,
$themes
;
global
$id
,
$confirm
;
$theme
=
$themes
->
get_theme
(
$id
);
if
(
$theme
==
NULL
)
display_unknown_theme
();
elseif
(
$theme
[
"USER_ID"
]
!=
$users
->
get_active_user_id
())
display_permission_denied
(
"edit"
);
if
(
isset
(
$confirm
))
{
if
(
$confirm
==
"yes"
)
$themes
->
delete_theme
(
$id
);
header
(
"Location: themes.php"
);
exit
;
}
setup_site
(
"Delete Theme"
);
start_section
(
"Delete Theme"
,
build_theme_list_nav
(),
false
);
?>
<p
align=
"center"
>
Are
you
sure
you
want
to
delete
this
theme?
</p>
<div
align=
"center"
>
<form
method=
"post"
action=
"themes.php"
>
<input
type=
"hidden"
name=
"action"
value=
"deletetheme"
/>
<input
type=
"hidden"
name=
"id"
value=
"
<?php
print
$id
;
?>
"
/>
<input
type=
"submit"
name=
"confirm"
value=
"yes"
/>
<input
type=
"submit"
name=
"confirm"
value=
"no"
/>
</form>
</div>
<?php
end_section
();
}
function
display_search
()
{
global
$users
,
$session
,
$themes
;
global
$type
,
$keywords
,
$start
,
$limit
;
if
(
$keywords
==
""
||
!
isset
(
$keywords
))
{
setup_site
(
"Search Themes"
);
start_section
(
"Search Themes"
,
build_theme_list_nav
(),
false
);
?>
<p>
Enter
as
many
keywords
as
you
like.
They
must
be
separated
by
spaces,
and
we
don't
support
fancy
schmancy
logical
searches!
</p>
<br
/>
<div
align=
"center"
>
<form
method=
"get"
action=
"themes.php"
>
<input
type=
"hidden"
name=
"action"
value=
"search"
/>
<input
type=
"hidden"
name=
"start"
value=
"0"
/>
<input
type=
"hidden"
name=
"limit"
value=
"25"
/>
<b>
Keywords:
</b>
<input
type=
"text"
name=
"keywords"
value=
""
size=
"40"
/>
<br
/>
<br
/>
<input
type=
"radio"
name=
"type"
value=
"name"
/>
Search
names
<input
type=
"radio"
name=
"type"
value=
"description"
checked=
"checked"
/>
Search
descriptions
<br
/>
<br
/>
<input
type=
"submit"
value=
"Search"
/>
<input
type=
"reset"
/>
</form>
</div>
<?php
}
else
{
setup_site
(
"Search Results"
);
start_section
(
"Search Results"
,
build_theme_list_nav
(),
false
);
$theme_count
=
$themes
->
get_search_count
(
$keywords
,
$type
);
$results
=
$themes
->
search_themes
(
$keywords
,
$type
,
$start
,
$limit
);
if
(
$results
==
NULL
)
{
?>
<p><i>
No
themes
matched
those
keywords!
</i></p>
<?php
}
else
{
$table
=
new
Table
(
array
(
"Name"
,
"Brief Description"
,
"Version"
,
"Author"
,
"Downloads"
),
true
,
true
);
$table
->
set_widths
(
array
(
"20%"
,
"50%"
,
"10%"
,
"10%"
,
"10%"
));
$table
->
set_header_align
(
4
,
"right"
);
while
(
list
(
$id
,
$theme
)
=
each
(
$results
))
{
$table
->
add_row
(
array
(
"<a href=
\"
themes.php?action=showtheme&id=
$id
\"
>"
.
$theme
[
"NAME"
]
.
"</a>"
,
$theme
[
"BRIEF"
],
$theme
[
"VERSION"
],
$theme
[
"USERNAME"
],
$theme
[
"DOWNLOAD_COUNT"
]
),
array
(
array
(
"valign"
=>
"top"
),
array
(
"valign"
=>
"top"
),
array
(
"valign"
=>
"top"
),
array
(
"valign"
=>
"top"
),
array
(
"valign"
=>
"top"
,
"align"
=>
"right"
)
));
}
$table
->
output_html
();
if
(
$limit
<
$theme_count
)
{
br
();
start_tag
(
"div"
,
array
(
"align"
=>
"center"
));
if
(
$start
>
0
)
{
ahref
(
"Previous"
,
"themes.php?action=search&start="
.
(
$start
-
$limit
)
.
"&limit="
.
$limit
);
}
else
print
"Previous"
;
print
" "
;
for
(
$i
=
0
;
$i
<
(
$theme_count
/
$limit
);
$i
++
)
{
if
((
$i
*
$limit
)
==
$start
)
print
"<b>"
.
(
$i
+
1
)
.
"</b>"
;
else
{
ahref
(
$i
+
1
,
"themes.php?action=search&start="
.
(
$i
*
$limit
)
.
"&limit="
.
$limit
);
}
print
" "
;
}
print
" "
;
if
(
$start
+
$limit
<
$theme_count
)
{
ahref
(
"Next"
,
"themes.php?action=search&start="
.
(
$start
+
$limit
)
.
"&limit="
.
$limit
);
}
else
print
"Next"
;
end_tag
(
"div"
);
}
}
}
end_section
();
}
/* Beginning of the main code. */
setup_site
(
-
1
);
/* Make sure the user isn't trying to trick us. */
if
(
!
$users
->
logged_in
()
&&
(
$action
==
"addtheme"
||
$action
==
"edittheme"
||
$action
==
"deletetheme"
))
{
header
(
"Location: login.php"
);
exit
;
}
if
(
!
isset
(
$themetype
))
$themetype
=
0
;
if
(
$themetype
==
0
)
$themes
=
new
Smilies
();
else
{
print
"Invalid theme type specified."
;
site_shutdown
();
exit
;
}
/* Figure out what to do. */
if
(
$action
==
"addtheme"
)
{
display_add_theme
();
}
elseif
(
$action
==
"showtheme"
)
{
show_theme
();
}
elseif
(
$action
==
"download"
)
{
download_theme
();
}
elseif
(
$action
==
"edittheme"
)
{
display_edit_theme
();
}
elseif
(
$action
==
"deletetheme"
)
{
display_delete_theme
();
}
elseif
(
$action
==
"search"
)
{
display_search
();
}
else
{
display_themes
();
}
site_shutdown
();
?>