Exemple #1
0
<?php
include_once(dirname(__FILE__)."/ressources/class.templates.inc");
include_once(dirname(__FILE__)."/ressources/class.users.menus.inc");
include_once(dirname(__FILE__)."/ressources/class.mini.admin.inc");
include_once(dirname(__FILE__)."/ressources/class.user.inc");

if(isset($_GET["accordion"])){accordion();exit;}
if(isset($_GET["tab-acc"])){tab_accordion();exit;}
if($_GET["accordion-content"]=="members"){accordion_content_members();exit;}
if($_GET["accordion-content"]=="myaccount"){accordion_content_myaccount();exit;}
if($_GET["accordion-content"]=="messaging"){accordion_content_messaging();exit;}
if($_GET["accordion-content"]=="mymessaging"){accordion_content_Mymessaging();exit;}
if(isset($_GET["BodyToolbox"])){BodyToolbox();exit;}
if(isset($_GET["choose-language"])){choose_language();exit;}
if(isset($_POST["miniconfig-POST-lang"])){choose_language_save();exit();}
if(isset($_GET["center-panel"])){center_panel();exit;}


build();

function accordion_content_messaging($return=false){
	$page=CurrentPageName();
	$tpl=new templates();
	$users=new usersMenus();
	$ouencoded=urlencode(base64_encode($_SESSION["ou"]));
	
		$transport=Paragraphe_miniadm("folder-transport-48.png",
		"{localdomains}","{localdomains_text}",
		"Loadjs('domains.edit.domains.php?js=yes&ou=$ouencoded&encoded=yes&in-front-ajax=yes')");
		
		$quarantine_admin=Paragraphe_miniadm("folder-quarantine-extrainfos-48.png",
Session::loadLanguage();
/**
 * @since version 0.84.2
**/
function checkConfigFile()
{
    if (file_exists(GLPI_CONFIG_DIR . "/config_db.php")) {
        Html::redirect($CFG_GLPI['root_doc'] . "/index.php");
        die;
    }
}
if (!isset($_POST["install"])) {
    $_SESSION = array();
    checkConfigFile();
    header_html("Select your language");
    choose_language();
} else {
    // Check valid Referer :
    Toolbox::checkValidReferer();
    // Check CSRF: ensure nobody strap first page that checks if config file exists ...
    Session::checkCSRF($_POST);
    // DB clean
    if (isset($_POST["db_pass"])) {
        $_POST["db_pass"] = stripslashes($_POST["db_pass"]);
        $_POST["db_pass"] = rawurldecode($_POST["db_pass"]);
        $_POST["db_pass"] = stripslashes($_POST["db_pass"]);
    }
    switch ($_POST["install"]) {
        case "lang_select":
            // lang ok, go accept licence
            checkConfigFile();
Exemple #3
0
 /**
  * The actualiser to translate content.
  *
  * @return tempcode		The UI
  */
 function set_lang_content()
 {
     $title = get_page_title('TRANSLATE_CONTENT');
     $lang = choose_language($title);
     if (is_object($lang)) {
         return $lang;
     }
     foreach ($_POST as $key => $val) {
         if (!is_string($val)) {
             continue;
         }
         if (substr($key, 0, 6) != 'trans_') {
             continue;
         }
         $lang_id = intval(substr($key, 6));
         if (get_magic_quotes_gpc()) {
             $val = stripslashes($val);
         }
         if ($val != '') {
             $GLOBALS['SITE_DB']->query_delete('translate', array('language' => $lang, 'id' => $lang_id), '', 1);
             $importance_level = $GLOBALS['SITE_DB']->query_value_null_ok('translate', 'importance_level', array('id' => $lang_id));
             if (!is_null($importance_level)) {
                 $GLOBALS['SITE_DB']->query_insert('translate', array('id' => $lang_id, 'source_user' => get_member(), 'language' => $lang, 'importance_level' => $importance_level, 'text_original' => $val, 'text_parsed' => '', 'broken' => 0));
             }
         }
     }
     log_it('TRANSLATE_CONTENT');
     require_code('view_modes');
     erase_tempcode_cache();
     persistant_cache_empty();
     if (get_param_integer('contextual', 0) == 1) {
         return inform_screen($title, do_lang_tempcode('SUCCESS'));
     }
     // Show it worked / Refresh
     $url = post_param('redirect', NULL);
     if (is_null($url)) {
         $_url = build_url(array('page' => '_SELF', 'type' => 'content'), '_SELF');
         $url = $_url->evaluate();
     }
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
 /**
  * The UI to select to view a past newsletter.
  *
  * @return tempcode		The UI
  */
 function archive()
 {
     $title = get_page_title('NEWSLETTER_ARCHIVE');
     $lang = choose_language($title);
     if (is_object($lang)) {
         return $lang;
     }
     $newsletters = new ocp_tempcode();
     $where = multi_lang() ? array('language' => $lang) : NULL;
     $rows = $GLOBALS['SITE_DB']->query_select('newsletter_archive', array('id', 'subject', 'date_and_time'), $where, 'ORDER BY date_and_time DESC');
     foreach ($rows as $newsletter) {
         $newsletters->attach(form_input_list_entry(strval($newsletter['id']), false, $newsletter['subject']));
     }
     if ($newsletters->is_empty()) {
         inform_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     require_code('form_templates');
     $fields = form_input_list(do_lang_tempcode('NEWSLETTER'), '', 'id', $newsletters, NULL, true);
     $hidden = form_input_hidden('lang', $lang);
     $submit_name = do_lang_tempcode('VIEW');
     $post_url = build_url(array('page' => '_SELF', 'type' => 'view'), '_SELF', NULL, false, true);
     return do_template('FORM_SCREEN', array('_GUID' => 'ee295e41dc86c4583c123e6e0e445380', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => '', 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url));
 }
Exemple #5
0
 /**
  * The actualiser to edit a zone (via zone editor).
  *
  * @return tempcode		The UI
  */
 function __editor()
 {
     $title = get_page_title('ZONE_EDITOR');
     $lang = choose_language($title, true);
     if (is_object($lang)) {
         return $lang;
     }
     $id = get_param('id', '');
     // Edit settings
     $_title = post_param('title');
     $default_page = post_param('default_page');
     $header_text = post_param('header_text');
     $theme = post_param('theme');
     $wide = post_param_integer('wide');
     if ($wide == -1) {
         $wide = NULL;
     }
     $require_session = post_param_integer('require_session', 0);
     $displayed_in_menu = post_param_integer('displayed_in_menu', 0);
     actual_edit_zone($id, $_title, $default_page, $header_text, $theme, $wide, $require_session, $displayed_in_menu, $id);
     if ($id != '') {
         $this->set_permissions($id);
     }
     // Edit pages
     foreach (array('panel_left', 'start', 'panel_right') as $for) {
         $redirect = post_param('redirect_' . $for, NULL);
         if (!is_null($redirect)) {
             if (addon_installed('redirects_editor')) {
                 $GLOBALS['SITE_DB']->query_delete('redirects', array('r_from_page' => $for, 'r_from_zone' => $id), '', 1);
                 if ($redirect != $id) {
                     $GLOBALS['SITE_DB']->query_insert('redirects', array('r_from_page' => $for, 'r_from_zone' => $id, 'r_to_page' => $for, 'r_to_zone' => $redirect, 'r_is_transparent' => 1), false, true);
                     // Avoid problem when same key entered twice
                 } else {
                     $redirect = NULL;
                 }
             } else {
                 $redirect = NULL;
             }
         }
         $comcode = post_param($for, NULL);
         if (!is_null($comcode)) {
             // Where to save to
             $fullpath = zone_black_magic_filterer(get_custom_file_base() . ((is_null($redirect) ? $id : $redirect) == '' ? '' : '/') . (is_null($redirect) ? $id : $redirect) . '/pages/comcode_custom/' . $lang . '/' . $for . '.txt');
             // Make dir if needed
             if (!file_exists(dirname($fullpath))) {
                 if (@mkdir(dirname($fullpath), 0777) === false) {
                     warn_exit(do_lang_tempcode('WRITE_ERROR_DIRECTORY_REPAIR', escape_html(basename(dirname($fullpath))), escape_html(dirname(dirname($fullpath)))));
                 }
                 fix_permissions(dirname($fullpath), 0777);
                 sync_file(dirname($fullpath));
             }
             // Store revision
             if (file_exists($fullpath) && get_option('store_revisions') == '1') {
                 $time = time();
                 @copy($fullpath, $fullpath . '.' . strval($time)) or intelligent_write_error($fullpath . '.' . strval($time));
                 fix_permissions($fullpath . '.' . strval($time));
                 sync_file($fullpath . '.' . strval($time));
             }
             // Save
             $myfile = @fopen($fullpath, 'wt') or intelligent_write_error($fullpath);
             if (fwrite($myfile, $comcode) < strlen($comcode)) {
                 warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
             }
             fclose($myfile);
             fix_permissions($fullpath);
             sync_file($fullpath);
             // De-cache
             $caches = $GLOBALS['SITE_DB']->query_select('cached_comcode_pages', array('string_index'), array('the_zone' => is_null($redirect) ? $id : $redirect, 'the_page' => $for));
             foreach ($caches as $cache) {
                 delete_lang($cache['string_index']);
             }
             $GLOBALS['SITE_DB']->query_delete('cached_comcode_pages', array('the_zone' => is_null($redirect) ? $id : $redirect, 'the_page' => $for));
         }
     }
     persistant_cache_empty();
     // Redirect
     $url = get_param('redirect');
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
Exemple #6
0
 /**
  * The actualiser to edit a theme image.
  *
  * @return tempcode		The UI
  */
 function _edit_image()
 {
     require_code('uploads');
     $title = get_page_title('EDIT_THEME_IMAGE');
     $lang = choose_language($title, true, true);
     if (is_object($lang)) {
         return $lang;
     }
     $theme = post_param('theme');
     //if ((get_file_base()!=get_custom_file_base()) && ($theme=='default')) warn_exit(do_lang_tempcode('SHARED_INSTALL_PROHIBIT'));
     $id = post_param('id');
     $old_id = post_param('old_id');
     if (post_param_integer('delete', 0) == 1) {
         require_code('themes3');
         actual_delete_theme_image($old_id, $theme, $lang);
     } else {
         $path = get_url('path', 'file', 'themes/' . $theme . '/images_custom');
         if (url_is_local($path[0]) && !file_exists((substr($path[0], 0, 15) == 'themes/default/' ? get_file_base() : get_custom_file_base()) . '/' . rawurldecode($path[0]))) {
             warn_screen($title, do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
         }
         if ($path[0] == '') {
             return warn_screen($title, do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
         }
         actual_edit_theme_image($old_id, $theme, $lang, $id, $path[0]);
     }
     persistant_cache_delete('THEME_IMAGES');
     erase_cached_templates();
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MANAGE_THEMES')), array('_SELF:_SELF:manage_images:theme=' . $theme, do_lang_tempcode('CHOOSE')), array('_SELF:_SELF:edit_theme_image:id=' . $id, do_lang_tempcode('EDIT_THEME_IMAGE'))));
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     return $this->do_next_manager($title, do_lang_tempcode('SUCCESS'), $theme, $lang, 'image', $id);
 }
 /**
  * The actualiser to export a comcode page.
  *
  * @return tempcode		The UI
  */
 function export()
 {
     $title = get_page_title('EXPORT_COMCODE_PAGE');
     $lang = choose_language($title);
     if (is_object($lang)) {
         return $lang;
     }
     $path = filter_naughty(get_param('export', ''));
     $page_link = filter_naughty(get_param('page_link'));
     if ($path == '') {
         $page_link_parts = explode(':', $page_link);
         if (count($page_link_parts) != 2) {
             warn_exit(do_lang_tempcode('ZONE_COLON_FILE'));
         }
         $path = $this->find_comcode_page($lang, $page_link_parts[1], $page_link_parts[0]);
     }
     $file_base = strpos($path, 'comcode_custom/') ? get_custom_file_base() : get_file_base();
     if (!file_exists($file_base . '/' . $path)) {
         $path = str_replace('comcode/', 'comcode_custom/', $path);
         $file_base = get_custom_file_base();
     }
     if (!file_exists($file_base . '/' . $path)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $export = file_get_contents($file_base . '/' . $path, FILE_TEXT);
     $matches = array();
     preg_match_all('#\\[attachment(.*)\\](\\d+)\\[/attachment\\]#', $export, $matches);
     for ($i = 0; $i < count($matches[0]); $i++) {
         $attachment = $GLOBALS['SITE_DB']->query_select('attachments', array('a_url', 'a_original_filename'), array('id' => $matches[2][$i]), '', 1);
         $file = file_get_contents(get_custom_file_base() . '/' . filter_naughty(rawurldecode($attachment[0]['a_url'])), FILE_TEXT);
         $replace = '[attachment filename="' . $attachment[0]['a_original_filename'] . '"' . $matches[1][$i] . ']' . chunk_split(base64_encode($file)) . '[/attachment]';
         $export = str_replace($matches[0][$i], $replace, $export);
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CHOOSE')), array('_SELF:_SELF:_ed:pagelink=' . $page_link, do_lang_tempcode('COMCODE_PAGE_EDIT'))));
     return do_template('COMCODE_PAGE_EXPORT_SCREEN', array('_GUID' => '2bbae0dad2dd559b68b628cecdf610fc', 'TITLE' => $title, 'EXPORT' => $export));
 }