function plugin_backup_delete($page) { global $vars, $layout_pages; $is_layout = FALSE; if (isset($layout_pages) && isset($layout_pages[$page])) { $is_layout = TRUE; } $qm = get_qm(); if (!_backup_file_exists($page)) { return array('msg' => $qm->m['plg_backup']['title_pagebackuplist'], 'body' => plugin_backup_get_list($page)); } // Say "is not found" $body = ''; if (isset($vars['pass'])) { if (pkwk_login($vars['pass'])) { _backup_delete($page); $pagelink = $is_layout ? h($layout_pages[$page]) : make_pagelink($page); $addlink = $is_layout ? "\n" . '<p><a href="' . h($script) . '?cmd=edit&page=' . rawurlencode($page) . '">戻る</a></p>' : ''; return array('msg' => $is_layout ? h($layout_pages[$page]) . ' のバックアップを削除' : $qm->m['plg_backup']['title_backup_delete'], 'body' => str_replace('$1', $pagelink, $qm->m['plg_backup']['backup_deleted']) . $addlink); } else { $body = '<p><strong>' . $qm->m['fmt_err_invalidpass'] . '</strong></p>' . "\n"; } } $script = get_script_uri(); $s_page = htmlspecialchars($page); $body .= <<<EOD <p>{$qm->m['plg_backup']['backup_adminpass']}</p> <form action="{$script}" method="post"> <div> <input type="hidden" name="cmd" value="backup" /> <input type="hidden" name="page" value="{$s_page}" /> <input type="hidden" name="action" value="delete" /> <input type="password" name="pass" size="12" /> <input type="submit" name="ok" value="{$qm->m['fmt_btn_delete']}" /> </div> </form> EOD; $title = $is_layout ? h($layout_pages[$page]) . ' のバックアップを削除' : $qm->m['plg_backup']['title_backup_delete']; return array('msg' => $title, 'body' => $body); }
/** * function plugin_backup_delete * Delete backup * @param string $page Page name. * @param array $ages Ages to delete. */ function plugin_backup_delete($page, $ages = array()) { global $vars; global $_backup_messages; $backup = Factory::Backup($page); if (!$backup->has()) { return array('msg' => $_backup_messages['title_pagebackuplist'], 'body' => plugin_backup_get_list($page)); } // Say "is not found" if (!Auth::check_role('role_contents_admin')) { $backup->remove(); return array('msg' => $_backup_messages['title_backup_delete'], 'body' => str_replace('$1', make_pagelink($page), $_backup_messages['msg_backup_deleted'])); } $body = array(); if (isset($vars['pass'])) { if (Auth::login($vars['pass'])) { //_backup_delete($page, $ages); return array('msg' => $_backup_messages['title_backup_delete'], 'body' => str_replace('$1', make_pagelink($page), $_backup_messages['msg_backup_deleted'])); } else { $body[] = '<p style="alert alert-danger">' . $_backup_messages['msg_invalidpass'] . '</p>'; } } $body[] = '<fieldset>'; $body[] = '<legend>' . $_backup_messages['msg_backup_adminpass'] . '</legend>'; $body[] = '<form action="' . Router::get_script_uri() . '" method="post" class="form-inline plugin-backup-delete-form">'; $body[] = '<input type="hidden" name="cmd" value="backup" />'; $body[] = '<input type="hidden" name="page" value="' . Utility::htmlsc($page) . '" />'; $body[] = '<input type="hidden" name="action" value="delete" />'; foreach ($ages as $age) { $body[] = '<input type="hidden" name="selectages[]" value="' . $age . '" />'; } $body[] = '<div class="form-group">'; $body[] = '<input type="password" name="pass" size="12" required="true" />'; $body[] = '</div>'; $body[] = '<input class="btn btn-danger" type="submit" name="ok" value="' . $_backup_messages['btn_delete'] . '" />'; $body[] = '</form>'; $body[] = '</fieldset>'; return array('msg' => $_backup_messages['title_backup_delete'], 'body' => join("\n", $body)); }
function plugin_backup_delete($page) { global $vars, $script; // global $_title_backup_delete, $_title_pagebackuplist, $_msg_backup_deleted; // global $_msg_backup_adminpass, $_btn_delete, $_msg_invalidpass; $_title_backup_delete = _('Deleting backup of $1'); $_title_pagebackuplist = _('Backup list of $1'); $_title_backuplist = _('Backup list'); $_msg_backup_deleted = _('Backup of $1 has been deleted.'); $_msg_backup_adminpass = _('Please input the password for deleting.'); $_btn_delete = _('Delete'); $_msg_invalidpass = _('Invalid password.'); if (!_backup_file_exists($page)) { return array('msg' => $_title_pagebackuplist, 'body' => plugin_backup_get_list($page)); } // Say "is not found" $body = ''; if (!auth::check_role('role_adm_contents')) { _backup_delete($page); return array('msg' => $_title_backup_delete, 'body' => str_replace('$1', make_pagelink($page), $_msg_backup_deleted)); } if (isset($vars['pass'])) { if (pkwk_login($vars['pass'])) { _backup_delete($page); return array('msg' => $_title_backup_delete, 'body' => str_replace('$1', make_pagelink($page), $_msg_backup_deleted)); } else { $body = '<p><strong>' . $_msg_invalidpass . '</strong></p>' . "\n"; } } $s_page = htmlspecialchars($page); $body .= <<<EOD <p>{$_msg_backup_adminpass}</p> <form action="{$script}" method="post"> <div> <input type="hidden" name="cmd" value="backup" /> <input type="hidden" name="page" value="{$s_page}" /> <input type="hidden" name="action" value="delete" /> <input type="password" name="pass" size="12" /> <input type="submit" name="ok" value="{$_btn_delete}" /> </div> </form> EOD; return array('msg' => $_title_backup_delete, 'body' => $body); }
function plugin_backup_delete($page) { global $vars, $_title_backup_delete, $_title_pagebackuplist, $_msg_backup_deleted; global $_msg_backup_adminpass, $_btn_delete, $_msg_invalidpass; if (!_backup_file_exists($page)) { return array('msg' => $_title_pagebackuplist, 'body' => plugin_backup_get_list($page)); } // Say "is not found" $body = ''; if (isset($vars['pass'])) { if (pkwk_login($vars['pass'])) { _backup_delete($page); return array('msg' => $_title_backup_delete, 'body' => str_replace('$1', make_pagelink($page), $_msg_backup_deleted)); } else { $body = '<p><strong>' . $_msg_invalidpass . '</strong></p>' . "\n"; } } $script = get_script_uri(); $s_page = htmlsc($page); $body .= <<<EOD <p>{$_msg_backup_adminpass}</p> <form action="{$script}" method="post"> <div> <input type="hidden" name="cmd" value="backup" /> <input type="hidden" name="page" value="{$s_page}" /> <input type="hidden" name="action" value="delete" /> <input type="password" name="pass" size="12" /> <input type="submit" name="ok" value="{$_btn_delete}" /> </div> </form> EOD; return array('msg' => $_title_backup_delete, 'body' => $body); }