本文整理汇总了PHP中stripslashes_safe函数的典型用法代码示例。如果您正苦于以下问题:PHP stripslashes_safe函数的具体用法?PHP stripslashes_safe怎么用?PHP stripslashes_safe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stripslashes_safe函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_GENERATE_XML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the file parameter
$file = required_param('file', PARAM_PATH);
$file = $CFG->dirroot . stripslashes_safe($file);
/// File must be under $CFG->wwwroot and
/// under one db directory (simple protection)
if (substr($file, 0, strlen($CFG->dirroot)) == $CFG->dirroot && substr(dirname($file), -2, 2) == 'db') {
/// Everything is ok. Load the file to memory
$this->output = file_get_contents($file);
} else {
/// Switch to HTML and error
$this->does_generate = ACTION_GENERATE_HTML;
$this->errormsg = 'File not viewable (' . $file . ')';
$result = false;
}
/// Return ok if arrived here
return $result;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:view_xml.class.php
示例2: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
}
/// ADD YOUR CODE HERE
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:36,代码来源:template.class.php
示例3: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting $result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dir
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
/// Set some defaults
$dbdir->xml_exists = false;
$dbdir->xml_writeable = false;
$dbdir->xml_loaded = false;
///Only if the directory exists
if (!$dbdir->path_exists) {
return false;
}
$xmldb_file = new XMLDBFile($dbdir->path . '/install.xml');
///Set the XML DTD and schema
$xmldb_file->setDTD($CFG->dirroot . '/lib/xmldb/xmldb.dtd');
$xmldb_file->setSchema($CFG->dirroot . '/lib/xmldb/xmldb.xsd');
/// Set dbdir as necessary
if ($xmldb_file->fileExists()) {
$dbdir->xml_exists = true;
}
if ($xmldb_file->fileWriteable()) {
$dbdir->xml_writeable = true;
}
/// Load the XML contents to structure
$loaded = $xmldb_file->loadXMLStructure();
if ($loaded && $xmldb_file->isLoaded()) {
$dbdir->xml_loaded = true;
$dbdir->filemtime = filemtime($dbdir->path . '/install.xml');
}
$dbdir->xml_file = $xmldb_file;
} else {
$this->errormsg = 'Wrong directory (' . $dirpath . ')';
$result = false;
}
} else {
$this->errormsg = 'XMLDB structure not found';
$result = false;
}
/// Launch postaction if exists
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
return $result;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:62,代码来源:load_xml_file.class.php
示例4: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_GENERATE_XML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the file parameter
$select = required_param('select', PARAM_ALPHA);
//original/edited
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
}
} else {
if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
$result = false;
}
}
if ($base) {
/// Only if the directory exists and it has been loaded
if (!$base->path_exists || !$base->xml_loaded) {
$this->errormsg = 'Directory ' . $dirpath . ' not loaded';
return false;
}
} else {
$this->errormsg = 'Problem handling ' . $select . ' files';
return false;
}
/// Get the structure
if ($result) {
if (!($structure =& $base->xml_file->getStructure())) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
if ($result) {
/// Everything is ok. Generate the XML output
$this->output = $structure->xmlOutput();
} else {
/// Switch to HTML and error
$this->does_generate = ACTION_GENERATE_HTML;
}
/// Return ok if arrived here
return $result;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:62,代码来源:view_structure_xml.class.php
示例5: print_feedback_label
function print_feedback_label($item)
{
?>
<td colspan="2">
<?php
echo stripslashes_safe($item->presentation);
?>
</td>
<?php
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:10,代码来源:lib.php
示例6: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
/// If not confirmed, show confirmation box
if (!$confirmed) {
$o = '<table width="60" class="generalbox boxaligncenter" border="0" cellpadding="5" cellspacing="0" id="notice">';
$o .= ' <tr><td class="generalboxcontent">';
$o .= ' <p class="centerpara">' . $this->str['confirmrevertchanges'] . '<br /><br />' . $dirpath . '</p>';
$o .= ' <table class="boxaligncenter" cellpadding="20"><tr><td>';
$o .= ' <div class="singlebutton">';
$o .= ' <form action="index.php?action=revert_changes&sesskey=' . sesskey() . '&confirmed=yes&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&postaction=main_view#lastused" method="post"><fieldset class="invisiblefieldset">';
$o .= ' <input type="submit" value="' . $this->str['yes'] . '" /></fieldset></form></div>';
$o .= ' </td><td>';
$o .= ' <div class="singlebutton">';
$o .= ' <form action="index.php?action=main_view#lastused" method="post"><fieldset class="invisiblefieldset">';
$o .= ' <input type="submit" value="' . $this->str['no'] . '" /></fieldset></form></div>';
$o .= ' </td></tr>';
$o .= ' </table>';
$o .= ' </td></tr>';
$o .= '</table>';
$this->output = $o;
} else {
/// Get the original dir and delete some elements
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
unset($dbdir->xml_changed);
}
}
}
/// Get the edited dir and delete it completely
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
unset($XMLDB->editeddirs[$dirpath]);
}
}
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:60,代码来源:revert_changes.class.php
示例7: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
}
/// ADD YOUR CODE HERE
$statementparam = required_param('statement', PARAM_CLEAN);
$basesentenceparam = optional_param('basesentence', NULL, PARAM_CLEAN);
$statement =& $structure->getStatement($statementparam);
$sentences =& $statement->getSentences();
$sentence = NULL;
/// If some sentence has been specified, create the new one
/// based on it
if (!empty($basesentenceparam)) {
$sentence = $sentences[$basesentenceparam];
}
/// Else, try to create the new one based in the last
if (empty($sentence) && !empty($sentences)) {
$sentence = end($sentences);
}
/// Else, create one sentence by hand
if (empty($sentence)) {
$sentence = "(list, of, fields) VALUES ('list', 'of', 'values')";
}
/// Add the sentence to the statement
$statement->addSentence($sentence);
/// We have one new sentence, so the statement and the structure has changed
$statement->setChanged(true);
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:60,代码来源:new_sentence.class.php
示例8: get_content
function get_content()
{
global $WS, $CFG;
if ($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass();
// If we are out of a dfwiki activity or in a different
// dfwiki format course and we want to create a block:
if (empty($WS->dfwiki)) {
$this->content->text = get_string('block_warning', 'wiki');
return $this->content;
}
$this->content->items = array();
$this->content->icons = array();
/* $this->content->footer = '<br />'
. helpbutton('search', $this->title, 'wiki', true, false, '', true)
. get_string('search');*/
// $this->content->footer = '<hr />'.get_string('block_helpaboutblock', 'wiki') .
// helpbutton ('search', get_string('block_search', 'wiki'), 'wiki', true, false, '', true);
// Converts reserved chars for html to prevent chars misreading
$pagetemp = stripslashes_safe($WS->page);
$formurl = $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&page=' . $WS->pageaction . '/' . urlencode($pagetemp);
$formalturl = $CFG->wwwroot . '/mod/wiki/part/search/index.php?id=' . $WS->cm->id . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&page=' . $WS->pageaction . '/' . urlencode($pagetemp);
//reurl script
?>
<script language="JavaScript" type="text/javascript">
function wiki_search_block_reulr (val) {
wiki_form = document.getElementById ('wiki_search_block_form');
if (val) {
wiki_form.action = '<?php
echo $formalturl;
?>
';
} else {
wiki_form.action = '<?php
echo $formurl;
?>
';
}
}
</script>
<?php
// mount the form
$form = '<form id="wiki_search_block_form"method="post" action="' . $formurl . '">' . '<div><input type="hidden" name="dfsetup" value="5" />' . '<input type="text" name="dfformfield" /><br />';
// if this block is in a course it must submit info to /mod/wiki/view.php
if ($this->instance->pagetype != 'mod-wiki-view') {
$form .= '<input type="hidden" name="dfformmain" value="ch" />' . '<input type="submit" name="dfformbut" value="' . get_string('search') . '" /><br /></div></form>';
} else {
$form .= '<input id="wiki_search_block_check" type="checkbox" name="dfformmain" value="ch" ' . 'onClick="wiki_search_block_reulr (this.checked);"/>' . get_string('detailed', 'wiki') . '<input type="submit" name="dfformbut" value="' . get_string('search') . '" /><br /></div></form>';
}
$form .= $this->get_results();
$this->content->text = $form;
return $this->content;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:55,代码来源:block_wiki_search.php
示例9: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
}
}
/// Copy the edited dir over the original one
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$XMLDB->dbdirs[$dirpath] = unserialize(serialize($editeddir));
$dbdir =& $XMLDB->dbdirs[$dirpath];
}
}
/// Chech for perms
if (!is_writeable($dirpath . '/install.xml')) {
$this->errormsg = $this->str['filenotwriteable'] . '(' . $dirpath . '/install.xml)';
return false;
}
/// Save the original dir
$result = $dbdir->xml_file->saveXMLFile();
if ($result) {
/// Delete the edited dir
unset($XMLDB->editeddirs[$dirpath]);
/// Unload de originaldir
unset($XMLDB->dbdirs[$dirpath]->xml_file);
unset($XMLDB->dbdirs[$dirpath]->xml_loaded);
unset($XMLDB->dbdirs[$dirpath]->xml_changed);
unset($XMLDB->dbdirs[$dirpath]->xml_exists);
unset($XMLDB->dbdirs[$dirpath]->xml_writeable);
} else {
$this->errormsg = 'Error saving XML file (' . $dirpath . ')';
return false;
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:57,代码来源:save_xml_file.class.php
示例10: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
}
/// ADD YOUR CODE HERE
$tableparam = required_param('table', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
/// If the changeme field exists, just get it and continue
$changeme_exists = false;
if ($fields =& $table->getFields()) {
if ($field =& $table->getField('changeme')) {
$changeme_exists = true;
}
}
if (!$changeme_exists) {
/// Lets create the field
$field = new XMLDBField('changeme');
$field->setComment('Default comment for the field, please edit me');
$table->addField($field);
/// We have one new field, so the structure has changed
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:veritech,项目名称:pare-project,代码行数:54,代码来源:new_field.class.php
示例11: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get parameters
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
$statementparam = strtolower(required_param('statement', PARAM_CLEAN));
$name = trim(strtolower(required_param('name', PARAM_CLEAN)));
$comment = required_param('comment', PARAM_CLEAN);
$comment = stripslashes_safe($comment);
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$statement =& $structure->getStatement($statementparam);
$errors = array();
/// To store all the errors found
/// If there is one name change, do it, changing the prev and next
/// atributes of the adjacent tables
if ($statementparam != $name) {
$statement->setName($name);
if ($statement->getPrevious()) {
$prev =& $structure->getStatement($statement->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($statement->getNext()) {
$next =& $structure->getStatement($statement->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
}
/// Set comment
$statement->setComment($comment);
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:51,代码来源:edit_statement_save.class.php
示例12: print_question_formulation_and_controls
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
{
global $CFG;
static $htmleditorused = false;
$answers =& $question->options->answers;
$readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
// Only use the rich text editor for the first essay question on a page.
$usehtmleditor = can_use_html_editor() && !$htmleditorused;
$formatoptions = new stdClass();
$formatoptions->noclean = true;
$formatoptions->para = false;
$inputname = $question->name_prefix;
$stranswer = get_string("answer", "quiz") . ': ';
/// set question text and media
$questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
$image = get_question_image($question);
// feedback handling
$feedback = '';
if ($options->feedback && !empty($answers)) {
foreach ($answers as $answer) {
$feedback = format_text($answer->feedback, '', $formatoptions, $cmoptions->course);
}
}
// get response value
if (isset($state->responses[''])) {
$value = stripslashes_safe($state->responses['']);
} else {
$value = "";
}
// answer
if (empty($options->readonly)) {
// the student needs to type in their answer so print out a text editor
$answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true);
} else {
// it is read only, so just format the students answer and output it
$safeformatoptions = new stdClass();
$safeformatoptions->para = false;
$answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course);
$answer = '<div class="answerreview">' . $answer . '</div>';
}
include "{$CFG->dirroot}/question/type/essay/display.html";
if ($usehtmleditor && empty($options->readonly)) {
use_html_editor($inputname);
$htmleditorused = true;
}
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:46,代码来源:questiontype.php
示例13: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
$file = $dirpath . '/install.xml';
/// Some variables
$xmlpath = dirname(str_replace($CFG->dirroot . '/', '', $file));
$xmlversion = userdate(time(), '%Y%m%d', 99, false);
$xmlcomment = 'XMLDB file for Moodle ' . dirname($xmlpath);
$xmltable = strtolower(basename(dirname($xmlpath)));
/// Initial contents
$c = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
$c .= ' <XMLDB PATH="' . $xmlpath . '" VERSION="' . $xmlversion . '" COMMENT="' . $xmlcomment . '">' . "\n";
$c .= ' <TABLES>' . "\n";
$c .= ' <TABLE NAME="' . $xmltable . '" COMMENT="Default comment for ' . $xmltable . ', please edit me">' . "\n";
$c .= ' <FIELDS>' . "\n";
$c .= ' <FIELD NAME="id" TYPE="int" LENGTH="10" UNSIGNED="true" NOTNULL="true" SEQUENCE="true" />' . "\n";
$c .= ' </FIELDS>' . "\n";
$c .= ' <KEYS>' . "\n";
$c .= ' <KEY NAME="primary" TYPE="primary" FIELDS="id" />' . "\n";
$c .= ' </KEYS>' . "\n";
$c .= ' </TABLE>' . "\n";
$c .= ' </TABLES>' . "\n";
$c .= ' </XMLDB>';
if (!file_put_contents($file, $c)) {
$errormsg = 'Error creando fichero ' . $file;
$result = false;
}
/// Launch postaction if exists
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:49,代码来源:create_xml_file.class.php
示例14: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the original dir and delete some elements
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
unset($dbdir->xml_file);
unset($dbdir->xml_loaded);
unset($dbdir->xml_changed);
unset($dbdir->xml_exists);
unset($dbdir->xml_writeable);
}
}
}
/// Get the edited dir and delete it completely
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
unset($XMLDB->editeddirs[$dirpath]);
}
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:44,代码来源:unload_xml_file.class.php
示例15: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting result as needed
if (!data_submitted('nomatch')) {
///Basic prevention
error('Wrong action call');
}
/// Get parameters
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
$comment = required_param('comment', PARAM_CLEAN);
$comment = stripslashes_safe($comment);
/// Set comment and recalculate hash
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$structure->setComment($comment);
$structure->calculateHash(true);
/// If the hash has changed from the original one, change the version
/// and mark the structure as changed
$origdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $origdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
}
/// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
/// Return ok if arrived here
return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:44,代码来源:edit_xml_file_save.class.php
示例16: feedback_set_tmp_values
$feedbackcompletedtmp = feedback_set_tmp_values($feedbackcompleted);
}
}
} else {
$feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $courseid);
}
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
print_heading(format_text($feedback->name));
if (isset($savereturn) && $savereturn == 'saved') {
if ($feedback->page_after_submit) {
// print_simple_box_start('center', '75%');
print_box_start('generalbox boxaligncenter boxwidthwide');
echo format_text(stripslashes_safe($feedback->page_after_submit));
// print_simple_box_end();
print_box_end();
} else {
echo '<p align="center"><b><font color="green">' . get_string('entries_saved', 'feedback') . '</font></b></p>';
if (intval($feedback->publish_stats) == 1) {
echo '<p align="center"><a href="analysis.php?id=' . $id . '&courseid=' . $courseid . '">';
echo get_string('completed_feedbacks', 'feedback') . '</a>';
echo '</p>';
}
}
if ($feedback->site_after_submit) {
print_continue(feedback_encode_target_url($feedback->site_after_submit));
} else {
if ($courseid) {
print_continue($CFG->wwwroot . '/course/view.php?id=' . $courseid);
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:complete.php
示例17: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
//$this->does_generate = ACTION_NONE;
$this->does_generate = ACTION_GENERATE_HTML;
/// These are always here
global $CFG, $XMLDB;
/// Do the job, setting $result as needed
/// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
/// Get the correct dir
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
/// Only if the directory exists and it has been loaded
if (!$dbdir->path_exists || !$dbdir->xml_loaded) {
return false;
}
/// Check if the in-memory object exists and create it
if (empty($XMLDB->editeddirs)) {
$XMLDB->editeddirs = array();
}
/// Check if the dir exists and copy it from dbdirs
if (!isset($XMLDB->editeddirs[$dirpath])) {
$XMLDB->editeddirs[$dirpath] = unserialize(serialize($dbdir));
}
/// Get it
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
/// Add the main form
$o = '<form id="form" action="index.php" method="post">';
$o .= '<div>';
$o .= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
$o .= ' <input type="hidden" name ="action" value="edit_xml_file_save" />';
$o .= ' <input type="hidden" name ="postaction" value="edit_xml_file" />';
$o .= ' <input type="hidden" name ="path" value="' . s($structure->getPath()) . '" />';
$o .= ' <input type="hidden" name ="version" value="' . s($structure->getVersion()) . '" />';
$o .= ' <table id="formelements" class="boxaligncenter">';
$o .= ' <tr valign="top"><td>Path:</td><td>' . s($structure->getPath()) . '</td></tr>';
$o .= ' <tr valign="top"><td>Version:</td><td>' . s($structure->getVersion()) . '</td></tr>';
$o .= ' <tr valign="top"><td><label for="comment" accesskey="c">Comment:</label></td><td><textarea name="comment" rows="3" cols="80" id="comment">' . $structure->getComment() . '</textarea></td></tr>';
$o .= ' <tr><td> </td><td><input type="submit" value="' . $this->str['change'] . '" /></td></tr>';
$o .= ' </table>';
$o .= '</div></form>';
/// Calculate the buttons
$b = ' <p class="centerpara buttons">';
/// The view original XML button
$b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original">[' . $this->str['vieworiginal'] . ']</a>';
/// The view edited XML button
if ($structure->hasChanged()) {
$b .= ' <a href="index.php?action=view_structure_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=edited">[' . $this->str['viewedited'] . ']</a>';
} else {
$b .= ' [' . $this->str['viewedited'] . ']';
}
/// The new table button
$b .= ' <a href="index.php?action=new_table&postaction=edit_table&table=changeme&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtable'] . ']</a>';
/// The new from MySQL button
if ($CFG->dbfamily == 'mysql') {
$b .= ' <a href="index.php?action=new_table_from_mysql&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtablefrommysql'] . ']</a>';
} else {
$b .= ' [' . $this->str['newtablefrommysql'] . ']';
}
/// The new statement button
$b .= ' <a href="index.php?action=new_statement&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newstatement'] . ']</a>';
/// The back to main menu button
$b .= ' <a href="index.php?action=main_view#lastused">[' . $this->str['backtomainview'] . ']</a>';
$b .= '</p>';
$b .= ' <p class="centerpara buttons">';
/// The view sql code button
$b .= '<a href="index.php?action=view_structure_sql&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['viewsqlcode'] . ']</a>';
/// The view php code button
$b .= ' <a href="index.php?action=view_structure_php&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['viewphpcode'] . ']</a>';
$b .= '</p>';
$o .= $b;
/// Join all the reserved words into one big array
/// Calculate list of available SQL generators
$plugins = get_list_of_plugins('lib/xmldb/classes/generators');
$reserved_words = array();
foreach ($plugins as $plugin) {
$classname = 'XMLDB' . $plugin;
$generator = new $classname();
$reserved_words = array_merge($reserved_words, $generator->getReservedWords());
}
sort($reserved_words);
$reserved_words = array_unique($reserved_words);
/// Add the tables list
$tables =& $structure->getTables();
if ($tables) {
$o .= '<h3 class="main">' . $this->str['tables'] . '</h3>';
$o .= '<table id="listtables" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
$row = 0;
foreach ($tables as $table) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:edit_xml_file.class.php
示例18: invoke
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke()
{
parent::invoke();
$result = true;
/// Set own core attributes
$this->
|
请发表评论