Posted on: 06/19/04 10:23am
By: profetas
Posted on: 06/19/04 10:28am
By: profetas
Posted on: 06/19/04 11:33am
By: exdeath
Posted on: 06/19/04 12:12pm
By: Anonymous (Profetas)
Posted on: 06/19/04 12:48pm
By: Anonymous (profetas)
Posted on: 06/19/04 02:09pm
By: exdeath
Posted on: 06/19/04 02:25pm
By: Anonymous (Profetas)
Posted on: 06/19/04 03:29pm
By: Anonymous (Profetas)
Posted on: 06/19/04 06:34pm
By: exdeath
Posted on: 06/19/04 07:59pm
By: Anonymous (Profetas)
//--------------------------FIXED---------------------------/// function PLG_getAdminOptions() { global $_TABLES; $result = DB_query("SELECT pi_name FROM {$_TABLES['plugins']} WHERE pi_enabled = 1"); $nrows = DB_numRows($result); $plugin = new Plugin(); $counter = 0; for ($i = 1; $i <= $nrows; $i++) { $A = DB_fetchArray($result); $function = 'plugin_getadminoption_' . $A['pi_name']; if (function_exists($function)) { list($plugin->adminlabel, $plugin->adminurl, $plugin->numsubmissions) = $function(); $options_plg [$i][1]= $plugin->adminlabel; $options_plg [$i][2]= $plugin->adminurl; $options_plg [$i][3]= $plugin->numsubmissions; if (!empty ($plugin->adminlabel) && !empty ($plugin->adminurl)) { $counter++; $plgresults[$counter] = $plugin; } } } return $options_plg; } //--------------------------FIXED---------------------------///
//--------------------------FIXED---------------------------/// function PLG_getUserOptions() { global $_TABLES; $plgresults = array (); $result = DB_query("SELECT pi_name FROM {$_TABLES['plugins']} WHERE pi_enabled = 1"); $nrows = DB_numRows($result); $plugin = new Plugin(); $y=1; for ($i = 1; $i <= $nrows; $i++) { $A = DB_fetchArray($result); $function = 'plugin_getuseroption_' . $A['pi_name']; if (function_exists($function)) { list($plugin->adminlabel, $plugin->adminurl, $plugin->numsubmissions) = $function(); } if (!empty($plugin->adminlabel) && !empty($plugin->adminurl)) { $options_plg[$y][1]= $plugin->adminlabel; $options_plg[$y][2]= $plugin->adminurl; $options_plg[$y][3]= $plugin->numsubmissions; $y++; } } return $options_plg; } //--------------------------FIXED---------------------------///
function COM_userMenu( $help='', $title='' ) { global $_TABLES, $_USER, $_CONF, $LANG01, $HTTP_SERVER_VARS; $retval = ''; if( $_USER['uid'] > 1 ) { $usermenu = new Template( $_CONF['path_layout'] ); $usermenu->set_file( array( 'option' => 'useroption.thtml', 'current' => 'useroption_off.thtml' )); $usermenu->set_var( 'site_url', $_CONF['site_url'] ); $usermenu->set_var( 'layout_url', $_CONF['layout_url'] ); $usermenu->set_var( 'block_name', str_replace( '_', '-', 'user_block' )); if( empty( $title )) { $title = DB_getItem( $_TABLES['blocks'], 'title', "name='user_block'" ); } // what's our current URL? $thisUrl = $HTTP_SERVER_VARS['SCRIPT_URI']; if( empty( $thisUrl )) { $thisUrl = $HTTP_SERVER_VARS['DOCUMENT_URI']; } if( !empty( $thisUrl ) && !empty( $HTTP_SERVER_VARS['QUERY_STRING'] )) { $thisUrl .= '?' . $HTTP_SERVER_VARS['QUERY_STRING']; } if( empty( $thisUrl )) { $requestUri = $HTTP_SERVER_VARS['REQUEST_URI']; if( empty( $HTTP_SERVER_VARS['REQUEST_URI'] )) { $requestUri = $HTTP_SERVER_VARS['SCRIPT_NAME']; if( !empty( $HTTP_SERVER_VARS['QUERY_STRING'] )) { $requestUri .= '?' . $HTTP_SERVER_VARS['QUERY_STRING']; } } $firstslash = strpos( $_CONF['site_url'], '/' ); if( $firstslash === false ) { // special case - assume it's okay $thisUrl = $_CONF['site_url'] . $requestUri; } else if( $firstslash + 1 == strrpos( $_CONF['site_url'], '/' )) { // site is in the document root $thisUrl = $_CONF['site_url'] . $requestUri; } else { // extract server name first $pos = strpos( $_CONF['site_url'], '/', $firstslash + 2 ); $thisUrl = substr( $_CONF['site_url'], 0, $pos ) . $requestUri; } } $retval .= COM_startBlock( $title, $help, COM_getBlockTemplate( 'user_block', 'header' )); if( $_CONF['personalcalendars'] == 1 ) { $url = $_CONF['site_url'] . '/calendar.php?mode=personal'; $usermenu->set_var( 'option_label', $LANG01[66] ); $usermenu->set_var( 'option_count', '' ); $usermenu->set_var( 'option_url', $url ); if( $thisUrl == $url ) { $retval .= $usermenu->parse( 'item', 'current' ); } else { $retval .= $usermenu->parse( 'item', 'option' ); } } // This function will show the user options for all installed plugins // (if any) //--------------------------FIXED---------------------------/// $plugin_options = PLG_getUserOptions(); $nrows = count( $plugin_options ); for( $i = 1; $i <= $nrows; $i++ ) { $plg_lbl = $plugin_options[$i][1] ; $plg_url = $plugin_options[$i][2] ; $plg_sub = $plugin_options[$i][3] ; if( !empty( $plg_sub )) { $usermenu->set_var( 'option_count', '(' . $plg_sub . ')' ); } else { $usermenu->set_var( 'option_count', '' ); } $usermenu->set_var( 'option_url', $plg_url ); $usermenu->set_var( 'option_label', $plg_lbl ); if( $thisUrl == $plg_url ) { $retval .= $usermenu->parse( 'item', 'current' ); } else { $retval .= $usermenu->parse( 'item', 'option' ); } next( $plugin_options ); } //--------------------------FIXED---------------------------///
function COM_adminMenu( $help = '', $title = '' ) { global $_TABLES, $_USER, $_CONF, $LANG01, $HTTP_SERVER_VARS; $retval = ''; if( empty( $_USER['username'] )) { return $retval; } if( SEC_isModerator() OR SEC_hasrights( 'story.edit,block.edit,topic.edit,link.edit,event.edit,poll.edit,user.edit,plugin.edit,user.mail', 'OR' ) OR ( $nrows > 0 )) { // what's our current URL? $thisUrl = $HTTP_SERVER_VARS['SCRIPT_URI']; if( empty( $thisUrl )) { $thisUrl = $HTTP_SERVER_VARS['DOCUMENT_URI']; } if( !empty( $thisUrl ) && !empty( $HTTP_SERVER_VARS['QUERY_STRING'] )) { $thisUrl .= '?' . $HTTP_SERVER_VARS['QUERY_STRING']; } if( empty( $thisUrl )) { $requestUri = $HTTP_SERVER_VARS['REQUEST_URI']; if( empty( $HTTP_SERVER_VARS['REQUEST_URI'] )) { $requestUri = $HTTP_SERVER_VARS['SCRIPT_NAME']; if( !empty( $HTTP_SERVER_VARS['QUERY_STRING'] )) { $requestUri .= '?' . $HTTP_SERVER_VARS['QUERY_STRING']; } } $firstslash = strpos( $_CONF['site_url'], '/' ); if( $firstslash === false ) { // special case - assume it's okay $thisUrl = $_CONF['site_url'] . $requestUri; } else if( $firstslash + 1 == strrpos( $_CONF['site_url'], '/' )) { // site is in the document root $thisUrl = $_CONF['site_url'] . $requestUri; } else { // extract server name first $pos = strpos( $_CONF['site_url'], '/', $firstslash + 2 ); $thisUrl = substr( $_CONF['site_url'], 0, $pos ) . $requestUri; } } $adminmenu = new Template( $_CONF['path_layout'] ); $adminmenu->set_file( array( 'option' => 'adminoption.thtml', 'current' => 'adminoption_off.thtml' )); $adminmenu->set_var( 'site_url', $_CONF['site_url'] ); $adminmenu->set_var( 'layout_url', $_CONF['layout_url'] ); $adminmenu->set_var( 'block_name', str_replace( '_', '-', 'admin_block' )); if( empty( $title )) { $title = DB_getItem( $_TABLES['blocks'], 'title',"name = 'admin_block'" ); } $retval .= COM_startBlock( $title, $help, COM_getBlockTemplate( 'admin_block', 'header' )); $topicsql = ''; if( SEC_isModerator() || SEC_hasrights( 'story.edit' )) { $tresult = DB_query( "SELECT tid FROM {$_TABLES['topics']}". COM_getPermSQL() ); $trows = DB_numRows( $tresult ); if( $trows > 0 ) { $tids = array(); for( $i = 0; $i < $trows; $i++ ) { $T = DB_fetchArray( $tresult ); $tids[] = $T['tid']; } if( sizeof( $tids ) > 0 ) { $topicsql = " (tid IN ('" . implode( "','", $tids ) . "'))"; } } } if( SEC_isModerator() || (( $_CONF['usersubmission'] == 1 ) && SEC_hasRights( 'user.edit,user.delete' ))) { $num = 0; if( SEC_hasrights( 'story.edit' )) { if( empty( $topicsql )) { $num += DB_count( $_TABLES['storysubmission'] ); } else { $sresult = DB_query( "SELECT COUNT(*) AS count FROM {$_TABLES['storysubmission']} WHERE" . $topicsql ); $S = DB_fetchArray( $sresult ); $num += $S['count']; } if( $_CONF['listdraftstories'] == 1 ) { $sql = "SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (draft_flag = 1)"; if( !empty( $topicsql )) { $sql .= ' AND' . $topicsql; } $result = DB_query( $sql . COM_getPermSQL( 'AND', 0, 3 )); $A = DB_fetchArray( $result ); $num += $A['count']; } } if( SEC_hasrights( 'event.edit' )) { $num += DB_count ($_TABLES['eventsubmission'] ); } if( SEC_hasrights( 'link.edit' )) { $num += DB_count( $_TABLES['linksubmission'] ); } if( $_CONF['usersubmission'] == 1 ) { if( SEC_hasrights( 'user.edit' ) && SEC_hasrights( 'user.delete' )) { $emptypwd = md5( '' ); $num += DB_count( $_TABLES['users'], 'passwd', $emptypwd ); } } // now handle submissions for plugins $num = $num + PLG_getSubmissionCount(); $url = $_CONF['site_admin_url'] . '/moderation.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[10] ); $adminmenu->set_var( 'option_count', $num ); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'story.edit' )) { $url = $_CONF['site_admin_url'] . '/story.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[11] ); if( empty( $topicsql )) { $numstories = DB_count( $_TABLES['stories'] ); } else { $nresult = DB_query( "SELECT COUNT(*) AS count from {$_TABLES['stories']} WHERE" . $topicsql ); $N = DB_fetchArray( $nresult ); $numstories = $N['count']; } $adminmenu->set_var( 'option_count', $numstories ); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'block.edit' )) { $url = $_CONF['site_admin_url'] . '/block.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[12] ); $adminmenu->set_var( 'option_count', DB_count( $_TABLES['blocks'] )); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'topic.edit' )) { $url = $_CONF['site_admin_url'] . '/topic.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[13] ); $adminmenu->set_var( 'option_count', DB_count( $_TABLES['topics'] )); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'link.edit' )) { $url = $_CONF['site_admin_url'] . '/link.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[14] ); $adminmenu->set_var( 'option_count', DB_count( $_TABLES['links'] )); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'event.edit' )) { $url = $_CONF['site_admin_url'] . '/event.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[15] ); $adminmenu->set_var( 'option_count', DB_count( $_TABLES['events'] )); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'poll.edit' )) { $url = $_CONF['site_admin_url'] . '/poll.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[16] ); $adminmenu->set_var( 'option_count', DB_count( $_TABLES['pollquestions'] )); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'user.edit' )) { $url = $_CONF['site_admin_url'] . '/user.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[17] ); $adminmenu->set_var( 'option_count', ( DB_count( $_TABLES['users'] ) -1 )); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'group.edit' )) { $url = $_CONF['site_admin_url'] . '/group.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[96] ); $adminmenu->set_var( 'option_count', DB_count( $_TABLES['groups'] )); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'user.mail' )) { $url = $_CONF['site_admin_url'] . '/mail.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[105] ); $adminmenu->set_var( 'option_count', 'N/A' ); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if(( $_CONF['backend'] == 1 ) && SEC_inGroup( 'Root' )) { $url = $_CONF['site_admin_url'] . '/syndication.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[38] ); $count = DB_count( $_TABLES['syndication'] ); $adminmenu->set_var( 'option_count', $count ); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_hasrights( 'plugin.edit' )) { $url = $_CONF['site_admin_url'] . '/plugins.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[77] ); $adminmenu->set_var( 'option_count', DB_count( $_TABLES['plugins'] )); $retval .= $adminmenu->parse( 'item', ( $thisUrl == $url ) ? 'current' : 'option' ); } ///--------------------------FIXED---------------------------/// $plugin_options = PLG_getAdminOptions(); $nrows = count( $plugin_options ); // This will show the admin options for all installed plugins (if any) //--------------------------------------------------------------------// for( $i = 1; $i <= $nrows; $i++ ) { $plg_lbl = $plugin_options[$i][1] ; $plg_url = $plugin_options[$i][2] ; $plg_sub = $plugin_options[$i][3] ; if (SEC_inGroup( 'Root' )) { $url = $_CONF['site_admin_url'] .'item' .$plugin->adminurl; $adminmenu->set_var( 'option_url', $plg_url ); $adminmenu->set_var( 'option_label', $plg_lbl ); $adminmenu->set_var( 'option_count', $plg_sub ); $retval .= $adminmenu->parse( 'item',( $thisUrl == $url ) ? 'current' : 'option' ); next( $plugin_options ); } } //--------------------------FIXED---------------------------/// if( $_CONF['allow_mysqldump'] == 1 AND SEC_inGroup( 'Root' )) { $url = $_CONF['site_admin_url'] . '/database.php'; $adminmenu->set_var( 'option_url', $url ); $adminmenu->set_var( 'option_label', $LANG01[103] ); $adminmenu->set_var( 'option_count', 'N/A' ); $retval .= $adminmenu->parse( 'item',( $thisUrl == $url ) ? 'current' : 'option' ); } if( SEC_inGroup( 'Root' )) { $adminmenu->set_var( 'option_url', 'http://www.geeklog.net/versionchecker.php?version=' . VERSION ); $adminmenu->set_var( 'option_label', $LANG01[107] ); $adminmenu->set_var( 'option_count', VERSION ); $retval .= $adminmenu->parse( 'item', 'option' ); } $retval .= COM_endBlock( COM_getBlockTemplate( 'admin_block', 'footer' )); } return $retval; }
Posted on: 06/19/04 08:08pm
By: exdeath
Posted on: 06/19/04 08:18pm
By: Anonymous (Profetas)
Posted on: 06/23/04 01:21pm
By: exdeath
Posted on: 06/23/04 02:00pm
By: Anonymous (profetas)