| <?php |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); |
| |
| class am_gallery_plugin extends Plugin |
| { |
| var $name = 'Am Gallery'; |
| var $code = 'am_gallery'; |
| var $priority = 50; |
| var $version = '0.1'; |
| var $author = 'AstonishMe'; |
| var $group = 'AstonishMe'; |
| var $help_url = ''; |
| var $apply_rendering = 'stealth'; |
| var $number_of_installs = 1; |
| |
| |
| |
| |
| |
| var $adminPage = ''; |
| var $subtab = ''; |
| var $url = ''; |
| |
| |
| |
| |
| |
| |
| function PluginInit() |
| { |
| global $AdminUI, $blog; |
| $this->short_desc = T_('AstonishMe - Add galleries to your blogs'); |
| |
| |
| $this->adminPage = param( 'amgAction', 'string' ); |
| $this->adminPage = ( in_array( $this->adminPage, array( 'blog', 'users' ) ) ? $this->adminPage : '' ); |
| |
| $subtab = param( 'subtab', 'string' ); |
| $this->subtab = ( in_array( $subtab, array( 'manage', 'settings' ) ) ? $subtab : 'manage' ); |
| |
| if( is_admin_page() && $this->adminPage ) |
| { |
| $AdminUI->set_path( ( $this->adminPage == 'blog' ? 'items' : 'users' ), 'gallery', $this->subtab ); |
| $AdminUI->title = ( $this->adminPage == 'blog' ? $this->T_( 'Browse blog' ) : $this->T_( 'Profile' ) ); |
| $AdminUI->title .= $AdminUI->pathSeparator.$this->T_( 'AM Gallery' ); |
| $AdminUI->title .= $AdminUI->pathSeparator.( $this->subtab == 'manage' ? $this->T_( 'Manage Galleries' ) : $this->T_( 'Settings' ) ); |
| if( $this->adminPage == 'blog' && $blog == 0 ) |
| { |
| $blog = autoselect_blog( 'blog_ismember', 'any' ); |
| } |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| function GetDefaultSettings( & $params ) |
| { |
| return array(); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| } |
| |
| |
| |
| |
| |
| |
| function AdminAfterMenuInit() |
| { |
| global $AdminUI, $dispatcher,$blog, $current_User; |
| |
| |
| $this->url = $dispatcher.'?ctrl=tools&tab=plug_ID_'.$this->ID.'&blog='.$blog.'&amgAction='; |
| |
| |
| $checkblog = autoselect_blog( 'blog_ismember', 'any' ); |
| |
| if( $current_User->check_perm( 'blog_properties', 'edit', false, $checkblog ) ) |
| { |
| $AdminUI->add_menu_entries( |
| 'items', |
| array( |
| 'gallery' => array( |
| 'text' => $this->T_('AM Gallery'), |
| 'href' => $this->url.'blog', |
| 'entries' => array( |
| 'manage' => array( |
| 'text' => $this->T_('Manage Galleries'), |
| 'href' => $this->url.'blog&subtab=manage', |
| ), |
| 'settings' => array( |
| 'text' => $this->T_('Settings'), |
| 'href' => $this->url.'blog&subtab=settings', |
| ), |
| ), |
| ), |
| ) ); |
| } |
| elseif( $current_User->check_perm( 'blog_post_statuses', 'edit', false, $checkblog ) ) |
| { |
| $AdminUI->add_menu_entries( |
| 'items', |
| array( |
| 'gallery' => array( |
| 'text' => $this->T_('AM Gallery'), |
| 'href' => $this->url.'blog', |
| ), |
| ) ); |
| } |
| |
| |
| $foo = param( 'user_ID', 'integer' ); |
| if( |
| ( $current_User->check_perm( 'users', 'edit' ) && $foo ) |
| || ( !$current_User->check_perm( 'users', 'edit' ) && $foo == $current_User->ID ) |
| || ( !$current_User->check_perm( 'users', 'edit' ) && !$foo ) |
| ) |
| { |
| $AdminUI->add_menu_entries( |
| 'users', |
| array( |
| 'profile' => array( |
| 'text' => $this->T_('Profile'), |
| 'href' => $dispatcher.'?ctrl=users&user_ID='.$foo, |
| ), |
| 'gallery' => array( |
| 'text' => $this->T_('AM Gallery'), |
| 'href' => $this->url.'users&user_ID='.$foo, |
| 'entries' => array( |
| 'manage' => array( |
| 'text' => $this->T_('Manage Galleries'), |
| 'href' => $this->url.'users&subtab=manage&user_ID='.$foo, |
| ), |
| 'settings' => array( |
| 'text' => $this->T_('Settings'), |
| 'href' => $this->url.'users&subtab=settings&user_ID='.$foo, |
| ), |
| ), |
| ), |
| ) ); |
| } |
| $foo = param( 'ctrl', 'string' ); |
| switch( $foo ) |
| { |
| case 'users' : |
| $AdminUI->set_path( 'users', 'profile' ); |
| break; |
| |
| case 'items' : |
| $AdminUI->set_path( 'items', 'full' ); |
| } |
| } |
| |
| |
| |
| |
| |
| |
| function AdminEndHtmlHead() |
| { |
| global $AdminUI, $blog, $Blog; |
| switch( $this->adminPage ) |
| { |
| case 'blog' : |
| |
| $AdminUI->set_coll_list_params( 'blog_ismember', 'view', array( 'ctrl' => 'tools', 'tab' => 'plug_ID_'.$this->ID.'&amgAction=blog', 'filter' => 'restore' ) ); |
| |
| |
| $BlogCache = get_cache( 'BlogCache' ); |
| $Blog = $BlogCache->get_by_ID( $blog = autoselect_blog( 'blog_ismember', 'any' ) ); |
| |
| |
| attach_browse_tabs(); |
| |
| $AdminUI->set_path( 'items', 'gallery', $this->subtab ); |
| break; |
| |
| case 'users' : |
| |
| $AdminUI->set_path( 'users', 'gallery', $this->subtab ); |
| break; |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| function AdminTabAction() |
| { |
| switch( $this->adminPage ) |
| { |
| case 'blog' : |
| $this->AdminTabActionBlog(); |
| break; |
| |
| case 'users' : |
| $this->AdminTabActionUser(); |
| break; |
| } |
| } |
| |
| |
| |
| |
| |
| |
| function AdminTabPayload() |
| { |
| global $AdminUI; |
| |
| $long_path = array( $AdminUI->get_path(0), $AdminUI->get_path(1), $AdminUI->get_path(2) ); |
| |
| $short_path = array_slice( $long_path, 0, -1 ); |
| |
| |
| $foo = ( sizeof( $AdminUI->get_properties_for_path( $long_path, array( 'text' ) ) ) == 3 ? true : false ); |
| if( $foo ) |
| { |
| echo $AdminUI->replace_vars( $AdminUI->get_html_menu( $short_path, 'sub' ) ); |
| } |
| |
| switch( $this->adminPage ) |
| { |
| case 'blog' : |
| $this->AdminTabPayloadBlog(); |
| break; |
| |
| case 'users' : |
| $this->AdminTabPayloadUser(); |
| break; |
| } |
| |
| if( $foo ) |
| { |
| $AdminUI->disp_payload_end( 'sub' ); |
| } |
| } |
| |
| |
| |
| |
| |
| |
| function AdminTabActionBlog() |
| { |
| global $blog, $current_User, $dispatcher; |
| |
| if( !$current_User->check_perm( 'blog_post_statuses', 'edit', false, $blog ) ) |
| { |
| header_redirect( $dispatcher.'?ctrl=items&tab=full&filter=restore&blog='.$blog ); |
| exit; |
| } |
| } |
| |
| |
| |
| |
| function AdminTabPayloadBlog() |
| { |
| global $blog; |
| echo 'Blog payload ( '.$blog.' ) : '.( $this->subtab == 'settings' ? 'Gallery Settings' : 'Manage Galleries' ); |
| } |
| |
| |
| |
| |
| |
| function AdminTabActionUser() |
| { |
| |
| } |
| |
| |
| |
| |
| function AdminTabPayloadUser() |
| { |
| global $user_ID; |
| echo 'User payload ( '.$user_ID.' ) : '.( $this->subtab == 'settings' ? 'Gallery Settings' : 'Manage Galleries' ); |
| & |