function trash_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 = 'deleted' WHERE page_id = '" . $page['page_id'] . "' LIMIT 1");
             // Run this function again for all sub-pages
             trash_subs($page['page_id']);
         }
     }
 }
Exemple #2
0
 function trash_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 (false !== ($page = $query_menu->fetchRow(MYSQL_ASSOC))) {
             // Update the page visibility to 'deleted'
             $database->query("UPDATE " . TABLE_PREFIX . "pages SET visibility = 'deleted' WHERE page_id = '" . $page['page_id'] . "' LIMIT 1");
             if ($database->is_error()) {
                 trigger_error(sprintf('[%s - %s] %s', __FILE__, __LINE__, $database->get_error()), E_USER_ERROR);
             }
             // Run this function again for all sub-pages
             trash_subs($page['page_id']);
         }
     }
 }
 function trash_subs($parent = 0)
 {
     global $database;
     // Query pages
     $sql = 'SELECT `page_id` FROM `' . TABLE_PREFIX . 'pages` ' . 'WHERE `parent` = ' . $parent . ' ' . 'ORDER BY `position` ASC';
     if ($oRes = $database->query($sql)) {
         // Check if there are any pages to show
         if ($oRes->numRows() > 0) {
             // Loop through pages
             while ($page = $oRes->fetchRow(MYSQLI_ASSOC)) {
                 // Update the page visibility to 'deleted'
                 $sql = 'UPDATE `' . TABLE_PREFIX . 'pages` SET ' . '`visibility` = \'deleted\' ' . 'WHERE `page_id` = ' . $page['page_id'] . ' ' . '';
                 $database->query($sql);
                 if ($database->is_error()) {
                     $admin->print_error($database->get_error());
                 }
                 // Run this function again for all sub-pages
                 trash_subs($page['page_id']);
             }
         }
     }
 }