get_block('mbSpecials')) != null) { load_language('plugin.lang', SPBA_PATH); $position = (isset($conf['SPBA_position']) and is_numeric($conf['SPBA_position'])) ? $conf['SPBA_position'] : count($block->data)+1; array_splice ($block->data, $position-1, 0, array ('user-' => array ( 'URL' => make_index_url(array('section' => 'user-')), 'TITLE' => l10n('See photos by user'), 'NAME' => l10n('See photos by user') ) ) ); } } add_event_handler('loc_end_section_init', 'section_init_SPBA'); function section_init_SPBA() { global $tokens; $testa = explode('user-', $_SERVER['REQUEST_URI']); if (!empty ($testa[1])) { $testd= explode('/', $testa[1]); $me = 'user-'.$testd[0]; } else {$me = 'user-';} if (in_array($me, $tokens)) include(SPBA_PATH . 'pagespba.php'); } if ($showSPBU == 2 OR $showSPBU == 3 OR $showSPBU == 4) { add_event_handler('blockmanager_register_blocks', 'register_users_menubar_blocks'); add_event_handler('blockmanager_apply', 'users_apply'); } function register_users_menubar_blocks( $menu_ref_arr ) { $menu = & $menu_ref_arr[0]; if ($menu->get_id() != 'menubar') return; $menu->register_block( new RegisteredBlock( 'mbUsers','Users',('See photos by user'))); } function users_apply($menu_ref_arr) { global $template, $conf, $user; $menu = & $menu_ref_arr[0]; load_language('plugin.lang', SPBA_PATH); load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true)); $userslistemenu1 = pwg_query(' SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU, IT.id FROM ' . USERS_TABLE . ' as UT INNER JOIN '.IMAGES_TABLE.' AS IT ON IT.added_by = UT.id INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON IT.id = ic.image_id '.get_sql_condition_FandF ( array ( 'forbidden_categories' => 'category_id', 'visible_categories' => 'category_id', 'visible_images' => 'id' ), 'WHERE' ).' GROUP BY IT.added_by HAVING PBU >'.$conf['see_photos_by_user_nbphotos'].' ORDER BY '.$conf['see_photos_by_user_order'].' LIMIT '.$conf['see_photos_by_user_limit'].';'); if (pwg_db_num_rows($userslistemenu1)) { while ($userslistemenu = pwg_db_fetch_assoc($userslistemenu1)) { $items = array( 'USERSSPBYL' => $userslistemenu['username'], 'USERSSPBYLC' => $userslistemenu['PBU'], ); $template->append('userslistemenu1', $items); } } $linkusersliste = get_root_url().'index.php?/user-'; $template->assign('USERSSPBY', $linkusersliste); if (($block = $menu->get_block( 'mbUsers' )) != null) { $template->set_template_dir(SPBA_PATH); $block->template = 'menubar_users.tpl';} } add_event_handler('get_admin_plugin_menu_links', 'SPBA_admin_menu'); function SPBA_admin_menu($menu) { array_push( $menu, array( 'NAME' => l10n('See photos by user'), 'URL' => get_admin_plugin_menu_link(SPBA_PATH . 'admin.php') //'URL' => get_root_url().'admin.php?page=plugin-See_photos_by_user' ) ); return $menu; } ?>