diff --git a/admin/event-translate.php b/admin/event-translate.php index 4057936..490690f 100644 --- a/admin/event-translate.php +++ b/admin/event-translate.php @@ -1,136 +1,136 @@ . // load the framework require 'load.php'; // only allow translators // read the Event ID $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : null; // require the Event ID if( !$id ) { die_with_404(); } // query the Event $event = ( new QueryEvent() ) ->whereEventID( $id ) ->joinConference() ->joinChapter() ->queryRow(); // no Event no party if( !$event ) { die_with_404(); } // no permissions no party if( !$event->isEventEditable() && !has_permission( 'translate' ) ) { error_die( 'not enough permissions' ); } $DEFAULT_LANGUAGE = RegisterLanguage::instance()->getDefault(); // register form action if( is_action( 'translate-event' ) ) { $tosave = []; // for each language save the fields foreach( all_languages() as $lang ) { // do not allow to edit the default language if you are not the Event owner if( $lang === $DEFAULT_LANGUAGE && !$event->isEventEditable() ) { continue; } // for each translatable fields foreach( Event::fields_i18n() as $i18n_column => $label ) { // generic column name in this language $field = $i18n_column . '_' . $lang->getISO(); // sent column value $value = isset( $_POST[ $field ] ) ? $_POST[ $field ] : null; // set empty strings as null if( !$value ) { $value = null; } // sanitize the value before update (allow string and null) $tosave[] = new DBCol( $field, $value, 'snull' ); } } // update the fields ( new QueryEvent() ) ->whereEvent( $event ) ->update( $tosave ); // POST -> redirect -> GET http_redirect( $_SERVER[ 'REQUEST_URI' ], 303 ); } // print the site header Header::spawn( null, [ 'title' => $event->getEventTitle(), ] ); ?>

getConferenceURL(), esc_html( $event->getConferenceTitle() ) . icon( 'home', 'left' ) ) ?>

getEventURL(), // text __( "Vedi" ) . icon( 'account_box', 'left' ) ) ?>

$label ): ?> - $event, 'field' => $field, 'label' => $label, ] ) ?>
. /** * A recursive function to generate a menu tree. * * @param string $uid The menu identifier * @param int $level Level of the menu, used internally. Default 0. * @param array $args Arguments */ function print_menu($uid = null, $level = 0, $args = [] ) { $args = array_replace( [ 'max-level' => 99, 'main-ul-intag' => 'class="collection"' ], $args ); if( $level > $args['max-level'] ) { return; } $menuEntries = get_children_menu_entries($uid); if( ! $menuEntries ) { return; } ?> >
  • url ), $menuEntry->name, $menuEntry->get('title') ) ?> uid, $level + 1, $args ) ?>
  • $icon"; } function die_with_404() { new Header('404', [ 'title' => __("È un 404! Pagina non trovata :("), 'not-found' => true ] ); printf( '

    %s

    ', __("Nott foond! A.k.a. erroro quattrociantoquatto (N.B. eseguire coi permessi di root non risolve la situazione!)") ); new Footer(); exit; } /** * Require a certain page from the template directory * * @param $name string page name (to be sanitized) * @param $args mixed arguments to be passed to the page scope */ -function template( $template, $template_args = [] ) { +function template_admin( $template, $template_args = [] ) { extract( $template_args, EXTR_SKIP ); - require CURRENT_CONFERENCE_ABSPATH . __ . 'template' . __ . $template . '.php'; + require __DIR__ . '/../template/$template.php'; }