/** * Effectively logs the user in * @param string $login * @param string $passwd */ function user_login($login, $passwd) { global $input; global $template_folder; global $error; global $ezmanager_url; // 0) Sanity checks if (empty($login) || empty($passwd)) { $error = template_get_message('empty_username_password', get_lang()); view_login_form(); die; } $login_parts = explode("/", $login); // checks if runas if (count($login_parts) == 2) { if (!file_exists('admin.inc')) { $error = "Not admin. runas login failed"; view_login_form(); die; } include 'admin.inc'; //file containing an assoc array of admin users if (!isset($admin[$login_parts[0]])) { $error = "Not admin. runas login failed"; view_login_form(); die; } } $res = checkauth(strtolower($login), $passwd); if (!$res) { $error = checkauth_last_error(); view_login_form(); die; } // 1) Initializing session vars $_SESSION['podman_logged'] = "LEtimin"; // "boolean" stating that we're logged $_SESSION['user_login'] = $res['login']; $_SESSION['user_real_login'] = $res['real_login']; $_SESSION['user_full_name'] = $res['full_name']; $_SESSION['user_email'] = $res['email']; //check flash plugin or GET parameter no_flash if (!isset($_SESSION['has_flash'])) { //no noflash param when login //check flash plugin if ($input['has_flash'] == 'N') { $_SESSION['has_flash'] = false; } else { $_SESSION['has_flash'] = true; } } // 2) Initializing the ACLs acl_init($login); // 3) Setting correct language set_lang($input['lang']); if (count(acl_authorized_albums_list()) == 0) { error_print_message(template_get_message('not_registered', get_lang()), false); log_append('warning', $res['login'] . ' tried to access ezmanager but doesn\'t have permission to manage any album.'); session_destroy(); view_login_form(); die; } // 4) Resetting the template path to the one of the language chosen template_repository_path($template_folder . get_lang()); // 5) Logging the login operation log_append("login"); // 6) Displaying the page header("Location: " . $ezmanager_url); view_main(); }
/** * Searches a specific pattern in the bookmarks lists. * @global type $input * @global type $bookmarks * @global type $repository_path * @global type $user_files_path * @global type $words */ function bookmarks_search() { global $input; global $bookmarks; global $search_result_threads; global $bookmarks_toc; global $repository_path; global $user_files_path; global $words; // used to highlight the searched words in 'div_search_result.php' $search = $input['search']; // the pattern to be searched $target = $input['target']; // where to search (all albums / selected albums / current album) $albums = $input['albums']; // the selection of albums $fields = $input['fields']; // where to search in the bookmark fields (title / descr. / keywords) $fields_thread = $input['fields_thread']; $level = $input['level']; $tab = $input['tab']; if (!isset($level) || is_nan($level) || $level < 0 || $level > 3) { $level = 0; } log_append('search_bookmarks : ' . PHP_EOL . 'search - ' . $search . PHP_EOL . 'target - ' . $target . PHP_EOL . 'fields - ' . implode(", ", $fields) . PHP_EOL . 'fields thread - ' . implode(", ", $fields_thread) . PHP_EOL . 'tab - ' . implode(", ", $tab)); // defines target if (!isset($target) || $target == '') { $target = 'global'; } $album = $_SESSION['album']; $asset = $_SESSION['asset']; if ($target == 'current' && (!isset($album) || $album == '')) { $target = 'global'; } // transforms the search string in well formed string /* $words = str_getcsv($search, ' ', '"'); $wordsCSV = ''; foreach ($words as $index => $word) { if (trim($word) == '' || $word == '+') { unset($words[$index]); } else { $wordsCSV = $wordsCSV . "," . $word; } } */ // split the string, saves the value to search in a array $words = str_getcsv($search, ' ', '"'); $search = array(); foreach ($words as $index => $word) { if ($word == '' || $word == '+') { unset($words[$index]); } else { $search[] = $word; } } // init paths ezmam_repository_path($repository_path); user_prefs_repository_path($user_files_path); $bookmarks_toc = array(); switch ($target) { case 'current': // searches in current location (either global or album or asset) $albums = array($album); break; case 'album': // searches in albums selection if (!acl_has_album_permissions($album)) { $bookmarks_toc = toc_bookmarks_search($search, $fields, $level, array($album), $asset); } $asset = ""; // asset must be empty for searching in albums selection break; default: // searches in all albums if (!acl_has_album_permissions($album)) { $bookmarks_toc = toc_bookmarks_search($search, $fields, $level, array($album), $asset); } $asset = ""; // asset must be empty for searching in all albums $albums = acl_authorized_albums_list(); break; } if (in_array('official', $tab)) { // searches in official bookmarks $bookmarks_toc = array_merge($bookmarks_toc, toc_bookmarks_search($search, $fields, $level, $albums, $asset)); } if (in_array('custom', $tab)) { // searches in personal bookmarks $bookmarks = user_prefs_bookmarks_search($_SESSION['user_login'], $search, $fields, $level, $albums, $asset); } if (acl_user_is_logged() && acl_display_threads && in_array('threads', $tab)) { // searches in threads $search_result_threads = thread_search($search, $fields_thread, $albums, $asset); } $lvl = $_SESSION['album'] != '' && $_SESSION['asset'] != '' ? 3 : ($_SESSION['album'] != '' ? 2 : 1); trace_append(array($lvl, $input['origin'] == 'keyword' ? 'keyword_search' : 'bookmarks_search', $_SESSION['album'] == '' ? '-' : $_SESSION['album'], $_SESSION['asset'] == '' ? '-' : $_SESSION['asset'], $search, $target, implode(", ", $fields), implode(", ", $fields_thread), implode(", ", $tab), count($bookmarks_toc), count($bookmarks), count($search_result_threads))); include_once template_getpath('div_search_result.php'); }
*/ ?> <form id="search_form" method="post" action="index.php?action=search_bookmark" onsubmit="return false"> <input type="text" name="search" tabindex='0' id="main_search"/> <a id="main_search_button" class="search_button" onclick="check_search_form();"></a> <a id="more_search_button" onclick="$('#advanced_search').slideToggle(200);"></a> <div id="advanced_search"> <div class="search-label">®Search_in® : </div> <div id="target"> <label ><input tabindex='1' onclick="show_search_albums();" type="radio" name="target" checked="checked" value="global"><span>®All®</span></label> <label><input tabindex='2' id="album_radio" onclick="show_search_albums();" type="radio" name="target" value="album"><span>®Albums®</span></label> <label><input tabindex='3' id="current_radio" onclick="show_search_albums();" type="radio" name="target" value="current"><span>®Current®</span></label> </div> <?php $search_albums = acl_authorized_albums_list(); if (!isset($search_albums) || count($search_albums) < 1) { ?> <ul class="search_albums"><li style="border:none;">®No_album®</li></ul> <?php } else { ?> <ul class="search_albums"> <?php foreach ($search_albums as $selected_album) { ?> <li><label><input tabindex='4' type="checkbox" name="albums[]" <?php if ($_SESSION['album'] == '' || $_SESSION['album'] == $selected_album) { echo 'checked'; } ?>