function restore_subs($parent = 0) { global $backend; // Query pages $query_menu = $backend->db()->query(sprintf("SELECT page_id FROM `%spages` WHERE parent = '%d' ORDER BY position ASC", CAT_TABLE_PREFIX, $parent)); // Check if there are any pages to show if ($query_menu->numRows() > 0) { // Loop through pages while ($page = $query_menu->fetchRow(MYSQL_ASSOC)) { // Update the page visibility to 'deleted' $backend->db()->query(sprintf("UPDATE `%spages` SET visibility = 'public' WHERE page_id = '%d' LIMIT 1", CAT_TABLE_PREFIX, $page['page_id'])); // Run this function again for all sub-pages restore_subs($page['page_id']); } } }
function restore_subs($parent = 0) { global $database; // Query pages $query_menu = $database->query("SELECT page_id FROM " . TABLE_PREFIX . "pages WHERE parent = '{$parent}' ORDER BY position ASC"); // Check if there are any pages to show if ($query_menu->numRows() > 0) { // Loop through pages while ($page = $query_menu->fetchRow()) { // Update the page visibility to 'deleted' $database->query("UPDATE " . TABLE_PREFIX . "pages SET visibility = 'public' WHERE page_id = '" . $page['page_id'] . "' LIMIT 1"); // Run this function again for all sub-pages restore_subs($page['page_id']); } } }