Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /home/inri/public_html/daCode-HEAD/daCode/src/phplib/admin.php3
daCode -

Admin

Admin

Class to handle all the admin functions.

 

private class Admin

Class to handle all the admin functions.

daCode http://www.dacode.org/
src/phplib/admin.php3
$Id: admin.php3,v 1.220 2002/05/13 21:34:02 jbcombes Exp $

Depends: Config Db User Utils Html Poll News Redirect Webcam

 

Public Method Summary

void

Admin()

Class constructor
mixed

adminbox()

This print the admin box on the homepage is user as admin or
string

perform_action(string $action, array $table)

Switch function
string

news_showedit(integer $news_id)

Shows the title of a news box
string

webcam_showtitle(integer $webcam_id)

Shows the title of a webcam sidebox
string

tips_showtitle(integer $tip_id)

Shows the title of a tip sidebox
mixed

list_installed_themes()

List all installed themes

Private Method Summary

string

show_news(integer $id)

We print the news which is being moderated
void

mod_news(array $row)

We do moderate the news
string

show_users()

Function for sysadmin to show list of present users
string

show_edit_user(integer $id)

Function for sysadmin to show form to modify a user
mixed

mod_user(array $row)

Function to modify user parameters by sysadmin
string

show_topics()

Function to show topics for admin
mixed

show_edit_topic(integer $id)

Show modify topic
mixed

do_edit_topic(array $row)

Do edit topic
string

show_add_topic()

Show form to add topic
mixed

do_add_topic(array $row)

Do add topic
string

show_add_section()

Show form to add section
mixed

do_add_section(array $row)

Performs the SQL query to add a section
string

show_sections()

Creates the list of sections with links to edit them
mixed

show_edit_section(integer $id)

Creates the HTML form to edit a section
mixed

do_edit_section(array $row)

Do edit section
string

show_add_tip_section()

Creates the form to add a new tip section0
mixed

do_add_tip_section(array $row)

Performs SQL query to add a tip section
mixed

clear_cache()

Clears the cache
void

comments_scored_user()

Only used for moderation type 2
string

comments_showscore(integer $user_id_tmp, integer $comments_id_tmp, string $username_tmp, string $usermail_tmp, integer $userid_tmp, string $timestamp, [ mixed $user_xp, string $userhomesite_tmp ])

Creates the necessary HTML for comment scoring
mixed

list_uploaded_themes()

List uploaded theme tarballs
string

show_themes()

Shows the list of themes, with links to create an archive from them, or install uploaded tars
string

create_theme_tar(string $theme, [ string $version ])

Create an archive out of an installed theme
string

extract_theme_tar(string $tarfile, integer $action, [ string $file ])

Unpacks a theme tarball
mixed

delete_theme_tar(string $theme)

Deletes a tarball for a theme
string

gen_rdf()

Function that generates a RDF backend file called backend.rdf
string

gen_sidebar()

Function that generates a Mozilla/Netscape 6 Sidebar.

Private Field Summary

object Db

$db

Db abstraction layer instance
object Session

$session

Session instance
object utils

$utils

Utils instance
object HTML

$html

HTML subclass instance
object Poll

$poll

Poll instance (hmm, dirty)
object News

$news

News instance
object Redirect

$redirect

Redirect class instance
object Tips

$tips

Tips instance
array

$comments_scored

Array, the keys are the IDs of the comments the user has already scored

Public Method Details

Admin

public void Admin( )

  Class constructor

Returns void


adminbox

public mixed adminbox( )

  This print the admin box on the homepage is user as admin or
moderator rights

Returns mixed

string the adminbox or integer -1 if SQL failed.


perform_action

public string perform_action( string $action, array $table )

  Switch function
May call exit
Possible actions are:
- edit_news
- mod_news
- edit_users
- edit_topics
- add_topics
- mod_poll
- edit_section
- add_section
- add_tip_section
- list polls
- clear_cache
- edit_theme
- view_theme
- extract_theme
- delete_theme
- gen_rdf
- gen_sidebar

Parameter
string $action
the action to perform
array $table
HTTP variable table[].
Returns string

the result of the operation

Required global variables
array $HTTP_GET_VARS

news_showedit

public string news_showedit( integer $news_id )

  Shows the title of a news box
Adds links to edition page if user is admin
FIXME: only called in cache????

Parameter
integer $news_id
id of the news (used only for the edit link)
Returns string

the HTML formatted title


webcam_showtitle

public string webcam_showtitle( integer $webcam_id )

  Shows the title of a webcam sidebox
Adds links to edition page if user is admin
FIXME: only called in cache????

Parameter
integer $webcam_id
id of the webcam (used only for the edit link)
Returns string

the HTML formatted title


tips_showtitle

public string tips_showtitle( integer $tip_id )

  Shows the title of a tip sidebox
Adds links to edition page if user is admin
FIXME: only called in cache????

Parameter
integer $tip_id
id of the tip (used only for the edit link)
Returns string

the HTML formatted title


list_installed_themes

public mixed list_installed_themes( )

  List all installed themes
FIXME: only called in cache????

Returns mixed

array list of themes names or empty string if themes dir not found.


Private Method Details

show_news

private string show_news( integer $id )

  We print the news which is being moderated

Parameter
integer $id
ID of the news beeing moderated
Returns string

the formatted news.


mod_news

private void mod_news( array $row )

  We do moderate the news

Parameter
array $row
can one describe the contents?
Returns void


show_users

private string show_users( )

  Function for sysadmin to show list of present users

Returns string


show_edit_user

private string show_edit_user( integer $id )

  Function for sysadmin to show form to modify a user

Parameter
integer $id
ID of the user to edit
Returns string

the HTML form


mod_user

private mixed mod_user( array $row )

  Function to modify user parameters by sysadmin

Parameter
array $row
user record.
Returns mixed

string error message if access denied, -1 if db error, void upon success.


show_topics

private string show_topics( )

  Function to show topics for admin

Returns string


show_edit_topic

private mixed show_edit_topic( integer $id )

  Show modify topic

Parameter
integer $id
ID
Returns mixed

string the HTML form, error msg if no access, int -1 if SQL error.


do_edit_topic

private mixed do_edit_topic( array $row )

  Do edit topic

Parameter
array $row
row of topic table
Returns mixed

string error message if no access integer -1 if SQL failed, 1 if success


show_add_topic

private string show_add_topic( )

  Show form to add topic

Returns string

the form to add topic


do_add_topic

private mixed do_add_topic( array $row )

  Do add topic

Parameter
array $row
row of the topics table
Returns mixed

string error message if no access, integer -1 if SQL failed, 1 if success.


show_add_section

private string show_add_section( )

  Show form to add section

Returns string

the form to add section


do_add_section

private mixed do_add_section( array $row )

  Performs the SQL query to add a section

Parameter
array $row
: ?????
Returns mixed

string error message if no access, integer -1 if SQL failed, 1 if success.


show_sections

private string show_sections( )

  Creates the list of sections with links to edit them

Returns string

the HTML


show_edit_section

private mixed show_edit_section( integer $id )

  Creates the HTML form to edit a section

Parameter
integer $id
id of the section to edit
Returns mixed

string error message if access denied, integer -1 on failure, 1 on success


do_edit_section

private mixed do_edit_section( array $row )

  Do edit section

Parameter
array $row
'section' => string, 'state' => integer, 'id' =>integer
Returns mixed

string error message if access denied, integer -1 on failure, 1 on success


show_add_tip_section

private string show_add_tip_section( )

  Creates the form to add a new tip section0

Returns string

the HTML form


do_add_tip_section

private mixed do_add_tip_section( array $row )

  Performs SQL query to add a tip section

Parameter
array $row
('tip_section_id' => integer, 'tip_section' => string)
Returns mixed

string error message if access denied, integer -1 on failure, 1 on success


clear_cache

private mixed clear_cache( )

  Clears the cache

Returns mixed

void on success, error message if access denied


comments_scored_user

private void comments_scored_user( )

  Only used for moderation type 2
Calls acho and exit on Db failure
For each comment the user has scored, sets the Admin::comments_score[comment_id] to 1.
Does not return any value

Returns void


comments_showscore

private string comments_showscore( integer $user_id_tmp, integer $comments_id_tmp, string $username_tmp, string $usermail_tmp, integer $userid_tmp, string $timestamp, [ mixed $user_xp, string $userhomesite_tmp ] )

  Creates the necessary HTML for comment scoring

Parameter
integer $user_id_tmp
user ID unused ????
integer $comments_id_tmp
ID of the comment to score
string $username_tmp
username
string $usermail_tmp
mail of the user
integer $userid_tmp
ID of the user
string $timestamp
??? unknow
mixed $user_xp = >>""<<
XP of the user (integer or default empty string)
string $userhomesite_tmp = >>""<<
homepage of the user
Returns string

the HTML to score comments

Required global variables
integer $news_id the news we are working on -- it's bad!

list_uploaded_themes

private mixed list_uploaded_themes( )

  List uploaded theme tarballs
Returns void if disabled (upload_tar_dir parameter empty).

Returns mixed

void if disabled, array list of tarball otherwise.


show_themes

private string show_themes( )

  Shows the list of themes, with links to create an archive from them, or install uploaded tars

Returns string

the HTML formated list of themes.


create_theme_tar

private string create_theme_tar( string $theme, [ string $version ] )

  Create an archive out of an installed theme
Calls exit if user not admin

Parameter
string $theme
of the theme
string $version = >>'0.1'<<
version number of the theme
Returns string

status message


extract_theme_tar

private string extract_theme_tar( string $tarfile, integer $action, [ string $file ] )

  Unpacks a theme tarball
Calls exit if user is not admin

Parameter
string $tarfile
name of the tar file
integer $action
action to do: 1 extract, 2 show content of $file, else list content (sure??)
string $file = >>""<<
name of the file to display (only useful if action == 2 ?)
Returns string

result or error message


delete_theme_tar

private mixed delete_theme_tar( string $theme )

  Deletes a tarball for a theme
Calls exit in case the user is not admin.

Parameter
string $theme
of the theme
Returns mixed

void if upload_tar_dir not configured, string ?? on success, error msg on failure.


gen_rdf

private string gen_rdf( )

  Function that generates a RDF backend file called backend.rdf
Writes the RDF file.

Returns string

a message about operations


gen_sidebar

private string gen_sidebar( )

  Function that generates a Mozilla/Netscape 6 Sidebar.

Returns string

message about progress


Private Field Details

$db

private object Db $db

>><<

Db abstraction layer instance


$session

private object Session $session

>><<

Session instance


$utils

private object utils $utils

>><<

Utils instance


$html

private object HTML $html

>><<

HTML subclass instance


$poll

private object Poll $poll

>><<

Poll instance (hmm, dirty)


$news

private object News $news

>><<

News instance


$redirect

private object Redirect $redirect

>><<

Redirect class instance


$tips

private object Tips $tips

>><<

Tips instance


$comments_scored

private array $comments_scored

>><<

Array, the keys are the IDs of the comments the user has already scored



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta