viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]
diff --git a/src/controllers/AdminController.php b/src/controllers/AdminController.php index b4b07decd..faa0147af 100755 --- a/src/controllers/AdminController.php +++ b/src/controllers/AdminController.php @@ -623,7 +623,6 @@ class AdminController extends Controller implements CrawlConstants ]); $_SESSION['SEARCH'][$activity_postfix]['COMPARISON_TYPES'] = $data['COMPARISON_TYPES']; - $_SESSION['SEARCH'][$activity_postfix]['EQUAL_COMPARISON_TYPES'] = $data['EQUAL_COMPARISON_TYPES']; $data['SORT_TYPES'] = [ diff --git a/src/controllers/components/CrawlComponent.php b/src/controllers/components/CrawlComponent.php index 2581d689d..d3ddc4cd0 100644 --- a/src/controllers/components/CrawlComponent.php +++ b/src/controllers/components/CrawlComponent.php @@ -2360,8 +2360,8 @@ class CrawlComponent extends Component implements CrawlConstants $parent = $this->parent; $crawl_model = $parent->model("crawl"); $source_model = $parent->model("source"); - $source_arguments = ["addsource", "deletesource","editsource", - "testsource"]; + $source_arguments = ["addsource", "deletesource", "editsource", + "sourcesearch", "testsource"]; $subsearch_arguments = ["addsubsearch", "deletesubsearch", "editsubsearch", "showsubsearch"]; $possible_arguments = array_merge($source_arguments, @@ -2704,6 +2704,22 @@ class CrawlComponent extends Component implements CrawlConstants $fields); } break; + case "sourcesearch": + $data['SOURCE_FORM_TYPE'] = "search"; + $media_search_array = + $parent->tableSearchRequestHandler($data, + "searchSources", ['ALL_FIELDS' => [ + 'name', 'source_url', 'language', 'category', + 'type']], '_media'); + if (empty($_SESSION['LAST_SEARCH']['searchSources_media'])|| + isset($_REQUEST['name'])) { + $_SESSION['LAST_SEARCH']['searchSources_media'] = + $_SESSION['SEARCH']['searchSources_media']; + unset($_SESSION['SEARCH']['searchSources_media']); + } else { + $default_search = true; + } + break; case "testsource": $data['SOURCE_FORM_TYPE'] = "testsource"; $source = false; @@ -2741,8 +2757,28 @@ class CrawlComponent extends Component implements CrawlConstants } $data['CAN_LOCALIZE'] = $parent->model("user")->isAllowedUserActivity( $_SESSION['USER_ID'], "manageLocales"); + if (empty($media_search_array)) { + if (!empty($_SESSION['LAST_SEARCH']['searchSources_media'])) { + if (!empty($_REQUEST['arg']) && + $_REQUEST['arg'] == 'sourcesearch') { + $media_search_array = + $parent->restoreLastSearchFromSession($data, + 'searchSources', '_media'); + } else if (!empty($_REQUEST['context'])) { + $media_search_array = + $_SESSION['LAST_SEARCH']['searchSources_media'][ + 'SEARCH_ARRAY']; + $data['PAGING'] = + $_SESSION['LAST_SEARCH']['searchSources_media'][ + 'PAGING']; + } + } + if (empty($media_search_array)) { + $media_search_array[] = ["name", "", "", "ASC"]; + } + } $parent->pagingLogic($data, $source_model, "MEDIA_SOURCES", - C\DEFAULT_ADMIN_PAGING_NUM/5, [["NAME", "", "", "ASC"]]); + C\DEFAULT_ADMIN_PAGING_NUM/5, $media_search_array); $parent->pagingLogic($data, $source_model, "SUBSEARCHES", C\DEFAULT_ADMIN_PAGING_NUM/5, [ ["FOLDER_NAME", "", "", "ASC"]], "SUB", diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini index d051c5ebb..0c8871d86 100644 --- a/src/locale/en_US/configure.ini +++ b/src/locale/en_US/configure.ini @@ -1159,8 +1159,8 @@ groupbar_element_groupfeed = "%s Feed" groupbar_element_no_path_info = "No Path Info" groupbar_element_userfeed = "User: %s" groupbar_element_myfeeds = "My Feeds" -groupbar_element_ungrouped_icon = "" -groupbar_element_grouped_icon = "" +groupbar_element_ungrouped_icon = "Ungrouped Icon" +groupbar_element_grouped_icon = "Grouped Icon" ; ; ManagemachinesElement.php managemachines_element_awaiting_status = "Awaiting statuses of machines..." @@ -1374,11 +1374,11 @@ groupfeed_element_no_posts_yet = "No posts yet!" groupfeed_element_thread_no_exist = "Thread does not exist! Maybe it was deleted?" groupfeed_element_edit = "Edit" groupfeed_element_delete = "Delete" -groupfeed_element_usericon = "" +groupfeed_element_usericon = "User Icon" groupfeed_element_num_posts = "%s posts" groupfeed_element_num_views = "%s views" groupfeed_element_start_thread_in_group = "Start New Thread in %s" -groupfeed_element_new_thread_icon = "" +groupfeed_element_new_thread_icon = "New Thread Icon" groupfeed_element_last_edited = "Last Edited: %s" groupfeed_element_post_vote = "Vote:" groupfeed_element_last_post_info = "Last Post:" diff --git a/src/locale/en_US/statistics.txt b/src/locale/en_US/statistics.txt index b6bef56f0..5a165df53 100755 --- a/src/locale/en_US/statistics.txt +++ b/src/locale/en_US/statistics.txt @@ -1 +1 @@ -d:99; \ No newline at end of file +d:100; \ No newline at end of file diff --git a/src/views/elements/EditlocalesElement.php b/src/views/elements/EditlocalesElement.php index c90394c7f..c2bd4e412 100644 --- a/src/views/elements/EditlocalesElement.php +++ b/src/views/elements/EditlocalesElement.php @@ -105,11 +105,6 @@ class EditlocalesElement extends Element $mobile_tr = ($_SERVER["MOBILE"]) ? "</tr><tr>" : ""; foreach ($data['STRINGS'] as $msg_id => $msg_string) { $out_id = $msg_id; - if ($_SERVER["MOBILE"] && strlen($out_id) > 33) { - $out_id = wordwrap($out_id, 30, "<br />\n", true); - } else { - $out_id = wordwrap($out_id, 45, "<br />\n", true); - } if (strlen($msg_string) > 0) { e("<tr><td><label for='$msg_id'>$out_id</label>". "</td>$mobile_tr<td><input type='text' title='". diff --git a/src/views/elements/SearchsourcesElement.php b/src/views/elements/SearchsourcesElement.php index 0cf3c94a0..6f5665f90 100644 --- a/src/views/elements/SearchsourcesElement.php +++ b/src/views/elements/SearchsourcesElement.php @@ -127,26 +127,28 @@ class SearchsourcesElement extends Element <div class='tab-menu-content'> <div id="mediasourcetab"><?php $data['FORM_TYPE'] = ""; + $data['SEARCH_ARG'] = 'sourcesearch'; $data['TABLE_TITLE'] = tl('searchsources_element_media_sources'); $data['NO_FLOAT_TABLE'] = false; $data['ACTIVITY'] = 'searchSources'; $data['VIEW'] = $this->view; - $data['NO_SEARCH'] = true; + $data['NO_SEARCH'] = false; if (in_array($data['SOURCE_FORM_TYPE'], ['editsource', 'search'])) { + $data['FORM_TYPE'] = 'search'; $data['DISABLE_ADD_TOGGLE'] = true; } $paging_items = ['SUBstart_row', 'SUBend_row', 'SUBnum_show']; $paging1 = ""; foreach ($paging_items as $item) { if (isset($data[strtoupper($item)])) { - $paging1 .= "&".$item."=".$data[strtoupper($item)]; + $paging1 .= "&" . $item . "=" . $data[strtoupper($item)]; } } $paging2 = ""; $paging_items = ['start_row', 'end_row', 'num_show']; foreach ($paging_items as $item) { if (isset($data[strtoupper($item)])) { - $paging2 .= "&".$item."=".$data[strtoupper($item)]; + $paging2 .= "&" . $item . "=" . $data[strtoupper($item)]; } } $data['PAGING'] = $paging1; @@ -160,7 +162,7 @@ class SearchsourcesElement extends Element if ($data['SOURCE_FORM_TYPE'] != "editsource") { ?> <div id='<?=$data['TOGGLE_ID']?>' class='admin-form-row'><?php if ($data['SOURCE_FORM_TYPE'] == "search") { - $this->renderSearchForm($data); + $this->renderMediaSearchForm($data); } else { $this->renderMediaSourceForm($data); }?> @@ -223,7 +225,7 @@ class SearchsourcesElement extends Element </td><?php } ?> <td <?=$td_style - ?> ><a href="<?=$base_url."&arg=testsource&ts=". + ?> ><a href="<?=$base_url . "&arg=testsource&ts=". $source['TIMESTAMP'] . $paging1 . $paging2 ?>"><?= tl('searchsources_element_testmedia') ?></a></td><?php @@ -270,8 +272,8 @@ class SearchsourcesElement extends Element "pagingtable")->render($data); if ($data['SEARCH_FORM_TYPE'] != "editsubsearch") { ?> <div id='admin-form-row' class='admin-form-row'><?php - if ($data['FORM_TYPE'] == "search") { - $this->renderSearchForm($data); + if ($data['SEARCH_FORM_TYPE'] == "search") { + $this->renderSubsearchSearchForm($data); } else { $this->renderSubsearchForm($data); }?> @@ -706,4 +708,33 @@ class SearchsourcesElement extends Element </table> </form><?php } + /** + * Draws the search for media source forms + * + * @param array $data consists of values of search source fields set + * so far as well as values of the drops downs on the form + */ + public function renderMediaSearchForm($data) + { + $controller = "admin"; + $activity = "searchSources"; + $view = $this->view; + $title = tl('manageusers_element_search_user'); + $fields = [ + tl('searchsources_element_sourcename') => "name", + tl('searchsources_element_sourcetype') => + ["type", $data['EQUAL_COMPARISON_TYPES']], + tl('searchsources_element_locale_tag') => "language", + tl('searchsources_element_category') => "category", + tl('searchsources_element_url') => "source_url", + ]; + $postfix = "media"; + $dropdowns = [ + "language" => $data['LANGUAGES'], + "type" => $data['SOURCE_TYPES'] + ]; + $view->helper("searchform")->render($data, $controller, $activity, + $view, $title, $fields, $dropdowns, + $postfix); + } } diff --git a/src/views/elements/WikiElement.php b/src/views/elements/WikiElement.php index 741674c86..96eda13d0 100644 --- a/src/views/elements/WikiElement.php +++ b/src/views/elements/WikiElement.php @@ -562,7 +562,8 @@ class WikiElement extends Element implements CrawlConstants <div id="save-container" class="top-margin center"><?php if ($show_resources && isset($data['RESOURCE_NAME'])) { ?> <button class="button-box" - onclick="window.location='<?=$current_url; ?>'" ><?= + onclick="window.location='<?=$current_url; + ?>'; return false;" ><?= tl('wiki_element_closebutton') ?></button><?php } ?> diff --git a/src/views/helpers/PagingtableHelper.php b/src/views/helpers/PagingtableHelper.php index 0f5f4bc05..90489f504 100644 --- a/src/views/helpers/PagingtableHelper.php +++ b/src/views/helpers/PagingtableHelper.php @@ -50,7 +50,7 @@ class PagingtableHelper extends Helper * @var array */ public $show_choices = [ - 10 => 10, 20 => 20, 50 => 50, 100 => 100, 200=> 200 + 10 => 10, 20 => 20, 50 => 50, 100 => 100, 200 => 200 ]; /** * Used to render the links to go @@ -83,12 +83,14 @@ class PagingtableHelper extends Helper { $activity = $data['ACTIVITY']; $admin_url = htmlentities(B\controllerUrl('admin', true)); - $base_url = $admin_url . C\CSRF_TOKEN."=".$data[C\CSRF_TOKEN]. + $base_url = $admin_url . C\CSRF_TOKEN . "=" . $data[C\CSRF_TOKEN]. "&a=$activity"; $data_fields = ['NUM_TOTAL', 'NUM_SHOW', 'START_ROW', 'END_ROW', 'NEXT_START', 'NEXT_END', 'PREV_START', 'PREV_END', 'FORM_TYPE']; $var_prefix = (isset($data['VAR_PREFIX'])) ? strtoupper($data['VAR_PREFIX']) : ""; + $search_arg = (empty($data['SEARCH_ARG'])) ? 'search' : + $data['SEARCH_ARG']; foreach ($data_fields as $field) { $d[$field] = $var_prefix . $field; } @@ -104,12 +106,12 @@ class PagingtableHelper extends Helper e('<form method="get">'); } $name = isset($data['NAME']) ? $data['NAME'] : ""; - $bound_url = $base_url."&arg=".$data[$d['FORM_TYPE']]; + $bound_url = $base_url . "&arg=" . $data[$d['FORM_TYPE']]; if (isset($data['browse'])) { - $bound_url .= "&browse=".$data['browse']; + $bound_url .= "&browse=" . $data['browse']; } if ($name != "") { - $bound_url .="&name=".$name; + $bound_url .= "&name=" . $name; } ?> <input type="hidden" name="c" value="admin" /> <input type="hidden" name="changeshow" value="true" /> @@ -119,7 +121,7 @@ class PagingtableHelper extends Helper <?php if (!empty($data['context']) || $data[$d['FORM_TYPE']] == 'search'){ ?> - <input type="hidden" name="arg" value="search" /> + <input type="hidden" name="arg" value="<?=$search_arg ?>" /> <?php } if (!empty($data['browse'])) { @@ -127,17 +129,17 @@ class PagingtableHelper extends Helper <input type="hidden" name="browse" value="true" /> <?php } - e("<b>".tl('pagingtable_helper_show')."</b>"); + e("<b>" . tl('pagingtable_helper_show') . "</b>"); $data['VIEW']->helper("options")->render( "{$var_prefix}num-show", "{$var_prefix}num_show", $this->show_choices, $data[$d['NUM_SHOW']], true); e("<br />"); if ($data[$d['START_ROW']] > 0) { ?> - <a href="<?= $bound_url."&$start_row=". - $data[$d['PREV_START']]."&$end_row=". - $data[$d['PREV_END']]."&$num_show=". - $data[$d['NUM_SHOW']].$data['PAGING'] ?>"><<</a> + <a href="<?= $bound_url . "&$start_row=". + $data[$d['PREV_START']] . "&$end_row=". + $data[$d['PREV_END']] . "&$num_show=". + $data[$d['NUM_SHOW']] . $data['PAGING'] ?>"><<</a> <?php } e("<b>".tl('pagingtable_helper_row_range', $data[$d['START_ROW']], @@ -152,7 +154,7 @@ class PagingtableHelper extends Helper } if (!isset($data['NO_SEARCH'])) { if ($data[$d['FORM_TYPE']] != "search") { ?> - <a href="<?= $base_url . '&arg=search' + <a href="<?= $base_url . '&arg='. $search_arg ?>"><img src="<?=C\BASE_URL ?>resources/search-button.png" alt="<?= tl('pagingtable_helper_search')?>" /></a><?php @@ -189,9 +191,11 @@ class PagingtableHelper extends Helper foreach ($data_fields as $field) { $d[$field] = $var_prefix . $field; } - $start_row = $var_prefix."start_row"; - $end_row = $var_prefix."end_row"; - $num_show = $var_prefix."num_show"; + $search_arg = (empty($data['SEARCH_ARG'])) ? 'search' : + $data['SEARCH_ARG']; + $start_row = $var_prefix . "start_row"; + $end_row = $var_prefix . "end_row"; + $num_show = $var_prefix . "num_show"; $class = 'class="table-margin float-opposite"'; $target_fragment = (isset($data["TARGET_FRAGMENT"])) ? $data["TARGET_FRAGMENT"] : ""; @@ -211,29 +215,29 @@ class PagingtableHelper extends Helper e('<form method="get">'); } $name = isset($data['NAME']) ? $data['NAME'] : ""; - $bound_url = $base_url."&arg=".$data[$d['FORM_TYPE']]; + $bound_url = $base_url . "&arg=" . $data[$d['FORM_TYPE']]; if ($name != "") { - $bound_url .="&name=".$name; + $bound_url .= "&name=" . $name; } if (isset($data['browse'])) { - $bound_url .= "&browse=".$data['browse']; + $bound_url .= "&browse=" . $data['browse']; } if ($data[$d['START_ROW']] > 0) { ?> - <a href="<?= $bound_url."&$start_row=". - $data[$d['PREV_START']]."&$end_row=". - $data[$d['PREV_END']]."&$num_show=". - $data[$d['NUM_SHOW']].$data['PAGING']. - '#'.$target_fragment ?>"><<</a> + <a href="<?= $bound_url . "&$start_row=". + $data[$d['PREV_START']] . "&$end_row=". + $data[$d['PREV_END']] . "&$num_show=". + $data[$d['NUM_SHOW']] . $data['PAGING']. + '#' . $target_fragment ?>"><<</a> <?php } e("<b>".tl('pagingtable_helper_row_range', $data[$d['START_ROW']], $data[$d['END_ROW']], $data[$d['NUM_TOTAL']])."</b>"); if ($data[$d['END_ROW']] < $data[$d['NUM_TOTAL']]) { ?> - <a href="<?= $bound_url."&$start_row=". - $data[$d['NEXT_START']]."&$end_row=". - $data[$d['NEXT_END']]."&$num_show=". + <a href="<?= $bound_url . "&$start_row=" . + $data[$d['NEXT_START']] . "&$end_row=" . + $data[$d['NEXT_END']] . "&$num_show=" . $data[$d['NUM_SHOW']].$data['PAGING']. '#'.$target_fragment ?>" >>></a> <?php @@ -247,7 +251,7 @@ class PagingtableHelper extends Helper <?php if (!empty($data['context']) || $data['FORM_TYPE'] == 'search'){ ?> - <input type="hidden" name="arg" value="search" /> + <input type="hidden" name="arg" value="<?=$search_arg ?>" /> <?php } if (!empty($data['browse'])) { @@ -255,18 +259,18 @@ class PagingtableHelper extends Helper <input type="hidden" name="browse" value="true" /> <?php } - e("<b>".tl('pagingtable_helper_show')."</b>"); + e("<b>".tl('pagingtable_helper_show') . "</b>"); $data['VIEW']->helper("options")->render( "{$var_prefix}num-show", "{$var_prefix}num_show", $this->show_choices, $data[$d['NUM_SHOW']], true); - if (!isset($data['NO_SEARCH'])) { + if (empty($data['NO_SEARCH'])) { $add_browse = (empty($data['browse'])) ? "": "&browse=" . $data['browse']; if($data[$d['FORM_TYPE']] != "search") { $add_browse = (empty($data['browse'])) ? "": "&browse=" . $data['browse']; - $search_url = $base_url . '&arg=search' . + $search_url = $base_url . '&arg=' . $search_arg . $add_browse; ?> <a href="<?=$search_url ?>"><img src="<?=C\BASE_URL diff --git a/src/views/helpers/SearchformHelper.php b/src/views/helpers/SearchformHelper.php index 05d8d0dc9..e5dce49fb 100644 --- a/src/views/helpers/SearchformHelper.php +++ b/src/views/helpers/SearchformHelper.php @@ -68,6 +68,8 @@ class SearchformHelper extends Helper $base_url = htmlentities(B\controllerUrl($controller, true)) . C\CSRF_TOKEN . "=" . $data[C\CSRF_TOKEN] . "&a=$activity"; $old_base_url = $base_url; + $search_arg = (empty($data['SEARCH_ARG'])) ? 'search' : + $data['SEARCH_ARG']; $browse = false; if (isset($data['browse'])) { $base_url .= "&browse=".$data['browse']; @@ -84,7 +86,7 @@ class SearchformHelper extends Helper <input type="hidden" name="<?=C\CSRF_TOKEN ?>" value="<?= $data[C\CSRF_TOKEN] ?>" /> <input type="hidden" name="a" value="<?= $activity ?>" /> - <input type="hidden" name="arg" value="search" /> + <input type="hidden" name="arg" value="<?=$search_arg?>"" /> <?php if ($browse) { ?> <input type="hidden" name="browse" value="true" /> @@ -101,7 +103,7 @@ class SearchformHelper extends Helper $comparison_types = $data['COMPARISON_TYPES']; } e("<tr><td class='table-label'><label for='{$name}-id'>". - "$label:</label>"); + "$label</label>"); e($item_sep); $view->helper("options")->render( "{$name}-comparison", "${name}_comparison",