/** * get_menus - Rekurzív menükérés smarty linklist javascripthez * * @param int $parent * @param string $path * @access public * @return void */ function get_menus($parent = 0, $path = '') { global $mdb2; $ret = ''; $result =& $mdb2->query("\n\t\t\tSELECT menu_id, parent, menu_name \n\t\t\tFROM iShark_Menus \n\t\t\tWHERE type='index' AND parent='{$parent}'\n\t\t\tORDER BY position_id,sortorder\n\t\t"); while ($row = $result->fetchRow()) { $ret .= ',["' . (empty($path) ? '' : $path . '/') . $row['menu_name'] . '", "index.php?mid=' . $row['menu_id'] . '"]'; $ret .= get_menus($row['menu_id'], (empty($path) ? '' : $path . '/') . htmlspecialchars($row['menu_name'])); } return $ret; }
/** * get_menus - men�pontok lek�rdez�se * * @param int $parent_id * @access public * @return void */ function get_menus($parent = 0, $path = '') { global $mdb2; $ret = array(); $query = "\n\t\tSELECT menu_id, menu_name, parent FROM iShark_Menus \n\t\tWHERE parent = {$parent} AND type = 'index' \n\t\tORDER BY position_id, sortorder\n\t"; $result =& $mdb2->query($query); while ($row = $result->fetchRow()) { $ret[$row['menu_id']] = $path . (empty($path) ? '' : '/') . $row['menu_name']; $gyerekek = get_menus($row['menu_id'], $path . (empty($path) ? '' : '/') . $row['menu_name']); foreach ($gyerekek as $key => $value) { $ret[$key] = $value; } } return $ret; }
}); </script> <div> <module id="ed_menu_holder" data-type="menu/edit_item" item-id="0" menu-id="<?php print $id; ?> " /> </div> <?php if (isset($params['menu-name'])) { ?> <?php $menu = get_menus('one=1&limit=1&title=' . $params['menu-name']); if (isset($menu['id'])) { ?> <a class="mw-ui-btn mw-ui-btn-small mw-ui-btn-important pull-right" href="javascript:mw.menu_delete('<?php print $menu['id']; ?> ');"> <?php _e("Delete"); ?> <strong><?php print $menu['title']; ?> </strong></a> <?php }
<?php $menus = get_menus(); $rand = uniqid(); ?> <div class="mw-ui-field-holder"> <label class="mw-ui-label"> <?php _e("Add to Navigation"); ?> </label> <div class="relative" id="menu-selector-item"> <?php $content_id = false; $try_under_parent = false; $select_default_menu = false; $add_to_menu = false; if (isset($params['content_id'])) { $content_id = $params['content_id']; } if ($content_id == false) { if (isset($params['parent']) and $params['parent'] == 0) { $select_default_menu = true; } } if (isset($params['parent'])) { $try_under_parent = true; }
} else { } } $active_menu = $menu_name; $menu_id = false; if ($menu_id == false and $menu_name != false) { $menu_id = get_menus('one=1&title=' . $menu_name); if ($menu_id == false and isset($params['title'])) { mw()->menu_manager->menu_create('id=0&title=' . $params['title']); $menu_id = get_menus('one=1&title=' . $menu_name); } } if (isset($menu_id['title'])) { $active_menu = $menu_id['title']; } $menu_id = get_menus('one=1&title=' . $menu_name); if ($menu_id == false) { $active_menu = $menu_name = 'header_menu'; } ?> <?php print $active_menu; if (is_array($menus) == true) { if (is_array($menus)) { ?> <div class="control-group form-group"> <label class="mw-ui-label"> <?php _e("Select the Menu you want to edit");
function dt_menu($type = 'top', $print = true) { /* Global $menus */ global $menus; if (get_menus('order')) { $content = ''; foreach ($menus as $menu) { if ($menu['type'] == $type) { $url = preg_match('/http/i', $menu['slug']) ? $menu['slug'] : WWW . $menu['slug']; $target = preg_match('/http/i', $menu['slug']) ? ' target="_blank" ' : ''; $content .= '<a href="' . $url . '"' . $target . ' title="' . $menu['name'] . '"><div class="menu-list menu-list-' . $type . '" id="menu_list_' . $menu['aid'] . '">' . $menu['name'] . '</div></a>'; } } if ($type == 'top') { $content = plugin_run('nav', $content); } else { $content = plugin_run('menu', $content); } if ($print) { print $content; } else { return $content; } } else { return false; } }
case 'deleteLink': if (array_key_exists('link', $_POST)) { $deleteIds = get_descendants(intval($_POST['link'])); if (!empty($deleteIds)) { $result = $db->query('DELETE FROM ' . DB_PREFIX . 'links WHERE id IN (' . implode(',', $deleteIds) . ')'); } } break; case 'saveLink': if (array_key_exists('url', $_POST) && array_key_exists('name', $_POST) && array_key_exists('title', $_POST) && array_key_exists('link', $_POST)) { $result = $db->query('UPDATE ' . DB_PREFIX . 'links SET url = "' . $_POST['url'] . '", name = "' . $_POST['name'] . '", title = "' . $_POST['title'] . '" WHERE id = ' . intval($_POST['link'])); } break; case 'deleteMenu': if (array_key_exists('menuname', $_POST)) { $menu = get_menus($_POST['menuname']); if (!empty($menu)) { $deleteIds = get_descendants($menu[$_POST['menuname']]['id']); if (!empty($deleteIds)) { $result = $db->query('DELETE FROM ' . DB_PREFIX . 'links WHERE id IN (' . implode(',', $deleteIds) . ')'); } } } break; } exit; } // If a valid menu is given, load it's settings if ($menu) { $links = get_navigation($menu['varname']); $js[] = 'links';
<?php if (!defined('IN_INDEX')) { exit; } // menus: $template->assign('menus', get_menus()); // global content blocks: if ($settings['global_content_blocks']) { $template->assign('gcb', get_global_content_blocks()); } // content: if (empty($data)) { if ($data = get_content(PAGE)) { // count views: if ($settings['count_views'] == 1) { $dbr = Database::$content->prepare("UPDATE " . Database::$db_settings['pages_table'] . " SET views=views+1 WHERE id=:id"); $dbr->bindParam(':id', $data['id'], PDO::PARAM_INT); $dbr->execute(); } } else { $no_cache = true; if ($data = get_content($settings['error_page'])) { header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found"); header("Status: 404 Not Found"); } else { raise_error('404'); } } } if ($data['language'] == '') {
header("HTTP/1.1 404 Not Found"); $html_title = 'Page unavailable / ' . SITE_NAME; $template = 'error.tpl'; break; } // list of available languages $smarty->assign('languages', $translator->getLanguages()); // translations $smarty->assign('translations', $translations); // create a JSON string from the translations array, but only for the "js" section $smarty->assign('translationsJson', iniSectionsToJSON(array('js' => $translations['js']))); // get job categories and cities $smarty->assign('categories', get_categories()); $smarty->assign('settings_categories', $jobber_settings->GetSettingsCategories()); // get menus $smarty->assign('menus', get_menus()); //Add the dynamic URL defitions to SMARTY $smarty->assign('URL_JOB', URL_JOB); $smarty->assign('URL_JOBS', URL_JOBS); $smarty->assign('URL_CITIES', URL_CITIES); $smarty->assign('URL_COMPANIES', URL_COMPANIES); $smarty->assign('URL_JOBS_IN_CITY', URL_JOBS_IN_CITY); $smarty->assign('URL_JOBS_AT_COMPANY', URL_JOBS_AT_COMPANY); $smarty->assign('THEME', $settings['theme']); $smarty->assign('CURRENT_PAGE', $page); $smarty->assign('CURRENT_ID', $id); $smarty->assign('CURRENT_DIRECTORY', CURRENT_DIRECTORY); $smarty->assign('BASE_URL', BASE_URL_ORIG); $smarty->assign('BASE_URL_ADMIN', BASE_URL); $smarty->assign('HTTP_REFERER', $_SERVER['HTTP_REFERER']); if (isset($_SESSION['AdminId'])) {
function load_template($file) { global $title, $theme, $a_user; if (!is_file($file)) { $file = "../" . $file; } if (!is_file($file)) { $file = "../" . $file; } if (!is_file($file)) { safe_die("Can't find template file!", "Theme Error"); } $handle = fopen($file, "r"); if (!$handle) { safe_die("Can't open template!", "Theme Error"); } while (!feof($handle)) { $buffer = str_replace("%TITLE%", $title, fgets($handle, 4096)); $buffer = str_replace("%MY_URL%", MY_URL, $buffer); $buffer = str_replace("%THEMEPATH%", MY_URL . "/themes/" . $theme, $buffer); $buffer = str_replace("%USER%", $a_user, $buffer); #For future use: #if($a_lang==1) $buffer = str_replace("%DIR%"," dir=\"rtl\"",$buffer); #else $buffer = str_replace("%DIR%","",$buffer); if (strstr($buffer, "%MENUS%")) { $buffer = str_replace("%MENUS%", get_menus(), $buffer); } /* TODO: Add more variables, and optimize the code... */ echo $buffer; } fclose($handle); }
$form->addElement('hidden', 'bid', $bid); $form->addElement('hidden', 'oid', $oid); //Bannerhelyek: $query = "\n\t\tSELECT place_id, place_name \n\t\tFROM iShark_Banners_Places \n\t\tORDER BY place_name\n\t"; $result =& $mdb2->query($query); $select =& $form->addElement('select', 'place_id', $locale->get('field_banner_place'), $result->fetchAll('', $rekey = true)); //ha nincs meg egyetlen bannerhely sem, akkor hibauzenet if ($result->numRows() == 0) { $form->setElementError('place_id', $locale->get('error_no_bannerplace')); } //megjelenesek max. szama $form->addElement('text', 'impmax', $locale->get('field_banner_impmax')); // Menüpontok: $menus = array(); $menus[0] = $locale->get('field_allmenu'); $menus_from_db = get_menus(); foreach ($menus_from_db as $key => $value) { $menus[$key] = $value; } $menusel =& $form->addElement('select', '_menu_id', $locale->get('field_menu'), $menus); if (empty($menus)) { $form->setElementError('_menu_id', $locale->get('error_no_menu')); } //idozito $form->addGroup(array(HTML_QuickForm::createElement('text', 'timer_start', null, array('readonly' => 'readonly', 'id' => 'timer_start')), HTML_QuickForm::createElement('jscalendar', 'start_calendar', null, $calendar_start), HTML_QuickForm::createElement('link', 'deltimer', null, 'javascript:void(null);', $locale->get('deltimer'), 'onclick="deltimer(\'timer_start\')"')), 'date_start', $locale->get('field_timer_start'), null, false); $form->addGroup(array(HTML_QuickForm::createElement('text', 'timer_end', null, array('readonly' => 'readonly', 'id' => 'timer_end')), HTML_QuickForm::createElement('jscalendar', 'end_calendar', null, $calendar_end), HTML_QuickForm::createElement('link', 'deltimer', null, 'javascript:void(null);', $locale->get('deltimer'), 'onclick="deltimer(\'timer_end\')"')), 'date_end', $locale->get('field_timer_end'), null, false); $form->addRule('impmax', $locale->get('error_impmax'), 'numeric'); $form->addRule('place_id', $locale->get('error_no_bannerplace_active'), 'required'); $form->addRule('_menu_id', $locale->get('error_no_menu_active'), 'required'); if ($form->isSubmitted() && ($form->getSubmitValue('timer_start') != "" || $form->getSubmitValue('timer_end') != "")) { include_once 'includes/function.check.php';
<?php if (isset($params['name'])) { $params['menu-name'] = $params['name']; } elseif (isset($params['menu-name'])) { $params['menu-name'] = $params['menu-name']; } else { $params['menu-name'] = 'header_menu'; } $menu_name = get_option('menu_name', $params['id']); if ($menu_name != false) { $params['menu-name'] = $menu_name; } if (isset($params['menu-name'])) { $menu = get_menus('make_on_not_found=1&one=1&limit=1&title=' . $params['menu-name']); if (is_array($menu)) { $menu_filter = $params; if (!isset($params['ul_class'])) { $menu_filter['ul_class'] = 'nav'; } $menu_filter['menu_id'] = intval($menu['id']); $module_template = get_option('data-template', $params['id']); if ($module_template == false and isset($params['template'])) { $module_template = $params['template']; } if ($module_template != false and trim($module_template) != '' and trim(strtolower($module_template) != 'none')) { $template_file = module_templates($config['module'], $module_template); } else { $template_file = module_templates($config['module'], 'default'); } if (isset($template_file) and $template_file != '' and is_file($template_file) != false) {