Example #1
0
function xos_children_in_page_count($categories_or_pages_id)
{
    $pages_count = 0;
    $pages_query = xos_db_query("select categories_or_pages_id from " . TABLE_CATEGORIES_OR_PAGES . " where is_page != 'false' and parent_id = '" . (int) $categories_or_pages_id . "'");
    while ($pages = xos_db_fetch_array($pages_query)) {
        $pages_count++;
        $pages_count += xos_children_in_page_count($pages['categories_or_pages_id']);
    }
    return $pages_count;
}
Example #2
0
         }
         $pages_data_array[] = array('languages_image' => xos_image(DIR_WS_CATALOG_IMAGES . 'catalog/templates/' . DEFAULT_TPL . '/' . $languages[$i]['directory'] . '/' . $languages[$i]['image'], $languages[$i]['name']), 'input_name' => xos_draw_input_field('categories_or_pages_name[' . $languages[$i]['id'] . ']', isset($cInfo->categories_or_pages_name[$languages[$i]['id']]) ? stripslashes(htmlspecialchars($cInfo->categories_or_pages_name[$languages[$i]['id']])) : htmlspecialchars($page_data['categories_or_pages_name']), 'maxlength="64" size="30"', true), 'input_heading_title' => xos_draw_input_field('categories_or_pages_heading_title[' . $languages[$i]['id'] . ']', isset($cInfo->categories_or_pages_heading_title[$languages[$i]['id']]) ? stripslashes($cInfo->categories_or_pages_heading_title[$languages[$i]['id']]) : $page_data['categories_or_pages_heading_title'], 'maxlength="255" size="80"'), 'page_description' => 'categories_or_pages_content[' . $languages[$i]['id'] . ']', 'page_template_file' => (ENABLE_SSL == 'true' ? $_SESSION['disable_ssl'] ? HTTP_SERVER : HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN . 'includes/ckconfig/templates/' . $languages[$i]['directory'] . '/page_template.js', 'page_template_lang' => $languages[$i]['directory'] . '_default', 'page_textarea' => xos_draw_textarea_field('categories_or_pages_content[' . $languages[$i]['id'] . ']', '130', '25', isset($cInfo->categories_or_pages_content[$languages[$i]['id']]) ? stripslashes($cInfo->categories_or_pages_content[$languages[$i]['id']]) : $page_data['categories_or_pages_content']), 'page_textarea_php_source' => xos_draw_textarea_field('categories_or_pages_php_source[' . $languages[$i]['id'] . ']', '130', '25', isset($cInfo->categories_or_pages_php_source[$languages[$i]['id']]) ? stripslashes($cInfo->categories_or_pages_php_source[$languages[$i]['id']]) : $page_data['categories_or_pages_php_source'], 'class="textarea-php-code" readonly="readonly"'));
     }
     $smarty->assign(array('update' => isset($_GET['cpID']) ? true : false, 'php_code_included' => $php_code_included, 'form_begin' => isset($_GET['cpID']) ? xos_draw_form('update_page', FILENAME_PAGES, 'action=update_page&cPath=' . $cPath . '&cpID=' . $_GET['cpID'], 'post', 'onsubmit="return confirm(\'' . JS_CONFIRM_UPDATE . '\')" enctype="multipart/form-data"') . xos_draw_hidden_field('categories_or_pages_id', $cInfo->categories_or_pages_id) : xos_draw_form('insert_page', FILENAME_PAGES, 'action=insert_page&cPath=' . $cPath, 'post', 'onsubmit="return confirm(\'' . JS_CONFIRM_INSERT . '\')" enctype="multipart/form-data"'), 'hidden_fields' => xos_draw_hidden_field('page_name', $cInfo->page_name) . xos_draw_hidden_field('current_categories_or_pages_status', $cInfo->categories_or_pages_status), 'pages_data' => $pages_data_array, 'radio_page_not_in_menu_0' => xos_draw_radio_field('page_not_in_menu', '0', $cInfo->page_not_in_menu == 1 ? false : true), 'radio_page_not_in_menu_1' => xos_draw_radio_field('page_not_in_menu', '1', $cInfo->page_not_in_menu == 1 ? true : false), 'radio_status_0' => xos_draw_radio_field('categories_or_pages_status', '0', $cInfo->categories_or_pages_status == 1 ? false : true), 'radio_status_1' => xos_draw_radio_field('categories_or_pages_status', '1', $cInfo->categories_or_pages_status == 1 ? true : false), 'input_sort_order' => xos_draw_input_field('sort_order', $cInfo->sort_order, 'maxlength="5" size="3"'), 'pull_down_link_request_type' => xos_draw_pull_down_menu('link_request_type', array(array('id' => 'NONSSL', 'text' => 'NONSSL'), array('id' => 'SSL', 'text' => 'SSL')), $cInfo->link_request_type), 'text_new_page' => sprintf(TEXT_NEW_PAGE_3, !isset($_GET['cpID']) ? TEXT_NEW_PAGE_1 : TEXT_NEW_PAGE_2, xos_output_generated_page_path($current_page_id)), 'link_filename_pages' => xos_href_link(FILENAME_PAGES, 'cPath=' . $cPath . (isset($_GET['cpID']) ? '&cpID=' . (int) $_GET['cpID'] : '')), 'form_end' => '</form>'));
     $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'pages');
     $output_new_page = $smarty->fetch(ADMIN_TPL . '/includes/modules/new_page.tpl');
     $smarty->assign('central_contents', $output_new_page);
 } else {
     $pages_count = 0;
     $rows = 0;
     $pages_query = xos_db_query("select c.categories_or_pages_id, cpd.categories_or_pages_name, c.parent_id, c.page_not_in_menu, c.sort_order, c.date_added, c.last_modified, c.categories_or_pages_status  from " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_CATEGORIES_OR_PAGES_DATA . " cpd where c.parent_id = '" . (int) $current_page_id . "' and c.categories_or_pages_id = cpd.categories_or_pages_id and c.is_page != 'false' and cpd.language_id = '" . (int) $_SESSION['used_lng_id'] . "' order by c.sort_order, cpd.categories_or_pages_name");
     $pages_array = array();
     while ($pages = xos_db_fetch_array($pages_query)) {
         $pages_count++;
         $rows++;
         $children_in_page = xos_children_in_page_count($pages['categories_or_pages_id']);
         if ((!isset($_GET['cpID']) && !isset($_GET['pID']) || isset($_GET['cpID']) && $_GET['cpID'] == $pages['categories_or_pages_id']) && !isset($cInfo) && substr($action, 0, 3) != 'new') {
             $page_children = array('children_count' => $children_in_page);
             $cInfo_array = array_merge((array) $pages, (array) $page_children);
             $cInfo = new objectInfo($cInfo_array);
         }
         $pages_array[] = array('selected' => isset($cInfo) && is_object($cInfo) && $pages['categories_or_pages_id'] == $cInfo->categories_or_pages_id ? true : false, 'children' => $children_in_page > 0 ? $children_in_page : false, 'status' => $pages['categories_or_pages_status'] == '1' ? true : false, 'page_not_in_menu' => $pages['page_not_in_menu'] == '1' ? true : false, 'name' => htmlspecialchars($pages['categories_or_pages_name']), 'sort_order' => $pages['sort_order'], 'icon_status_green' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_green.gif', ICON_TITLE_STATUS_GREEN), 'icon_status_red' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_red.gif', ICON_TITLE_STATUS_RED), 'icon_status_green_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_green_light.gif', ICON_TITLE_STATUS_GREEN_LIGHT), 'icon_status_red_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_red_light.gif', ICON_TITLE_STATUS_RED_LIGHT), 'icon_not_in_menu_green' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_not_in_menu_green.gif', ICON_TITLE_STATUS_GREEN), 'icon_not_in_menu_red' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_not_in_menu_red.gif', ICON_TITLE_STATUS_RED), 'icon_not_in_menu_green_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_not_in_menu_green_light.gif', ICON_TITLE_STATUS_GREEN_LIGHT), 'icon_not_in_menu_red_light' => xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_not_in_menu_red_light.gif', ICON_TITLE_STATUS_RED_LIGHT), 'link_filename_pages_flag_status_0' => xos_href_link(FILENAME_PAGES, 'action=setflag_status&flag_status=0&cpID=' . $pages['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_pages_flag_status_1' => xos_href_link(FILENAME_PAGES, 'action=setflag_status&flag_status=1&cpID=' . $pages['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_pages_flag_not_in_menu_0' => xos_href_link(FILENAME_PAGES, 'action=setflag_menu&flag_menu=0&cpID=' . $pages['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_pages_flag_not_in_menu_1' => xos_href_link(FILENAME_PAGES, 'action=setflag_menu&flag_menu=1&cpID=' . $pages['categories_or_pages_id'] . '&cPath=' . $cPath), 'link_filename_pages_get_path' => xos_href_link(FILENAME_PAGES, xos_get_path($pages['categories_or_pages_id'])), 'link_filename_pages_edit' => xos_href_link(FILENAME_PAGES, 'cPath=' . $cPath . '&cpID=' . $pages['categories_or_pages_id'] . '&action=new_page'), 'link_filename_pages_cpath_cpath_cid' => xos_href_link(FILENAME_PAGES, 'cPath=' . $cPath . '&cpID=' . $pages['categories_or_pages_id']));
     }
     $cPath_back = '';
     $page_path = xos_generate_page_path($current_page_id);
     for ($i = sizeof($page_path[0]) - 1; $i > 0; $i--) {
         $current_page_id != $page_path[0][$i]['id'] ? $cPath_back .= $page_path[0][$i]['id'] . '_' : '';
     }
     $cPath_back = substr($cPath_back, 0, -1);
     $cPath_back = xos_not_null($cPath_back) ? 'cPath=' . $cPath_back . '&' : '';
     if ($current_page_id > 0) {