• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP purify函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中purify函数的典型用法代码示例。如果您正苦于以下问题:PHP purify函数的具体用法?PHP purify怎么用?PHP purify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了purify函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: process_actions

/**
 * @brief  Process resource actions
 * @global type $tool_content
 * @global type $id
 * @global type $langResourceCourseUnitDeleted
 * @global type $langResourceUnitModified
 * @global type $course_id
 * @global type $course_code
 * @return string
 */
function process_actions()
{
    global $tool_content, $id, $langResourceCourseUnitDeleted, $langResourceUnitModified, $course_id, $course_code, $webDir;
    // update index and refresh course metadata
    require_once 'modules/search/indexer.class.php';
    require_once 'modules/course_metadata/CourseXML.php';
    if (isset($_REQUEST['edit'])) {
        $res_id = intval($_GET['edit']);
        if ($id = check_admin_unit_resource($res_id)) {
            return edit_res($res_id);
        }
    } elseif (isset($_REQUEST['edit_res_submit'])) {
        // edit resource
        $res_id = intval($_REQUEST['resource_id']);
        if ($id = check_admin_unit_resource($res_id)) {
            @($restitle = $_REQUEST['restitle']);
            $rescomments = purify($_REQUEST['rescomments']);
            $result = Database::get()->query("UPDATE course_weekly_view_activities SET\n                                        title = ?s,\n                                        comments = ?s\n                                        WHERE course_weekly_view_id = ?d AND id = ?d", $restitle, $rescomments, $id, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
        }
        $tool_content .= "<div class='alert alert-success'>{$langResourceUnitModified}</div>";
    } elseif (isset($_REQUEST['del'])) {
        // delete resource from course unit
        $res_id = intval($_GET['del']);
        if ($id = check_admin_unit_resource($res_id)) {
            Database::get()->query("DELETE FROM course_weekly_view_activities WHERE id = ?d", $res_id);
            Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
            $tool_content .= "<div class='alert alert-success'>{$langResourceCourseUnitDeleted}</div>";
        }
    } elseif (isset($_REQUEST['vis'])) {
        // modify visibility in text resources only
        $res_id = intval($_REQUEST['vis']);
        if ($id = check_admin_unit_resource($res_id)) {
            $vis = Database::get()->querySingle("SELECT `visible` FROM course_weekly_view_activities WHERE id = ?d", $res_id)->visible;
            $newvis = $vis == 1 ? 0 : 1;
            Database::get()->query("UPDATE course_weekly_view_activities SET visible = '{$newvis}' WHERE id = ?d", $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNITRESOURCE, $res_id);
            Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
            CourseXMLElement::refreshCourse($course_id, $course_code);
        }
    } elseif (isset($_REQUEST['down'])) {
        // change order down
        $res_id = intval($_REQUEST['down']);
        if ($id = check_admin_unit_resource($res_id)) {
            move_order('course_weekly_view_activities', 'id', $res_id, 'order', 'down', "course_weekly_view_id={$id}");
        }
    } elseif (isset($_REQUEST['up'])) {
        // change order up
        $res_id = intval($_REQUEST['up']);
        if ($id = check_admin_unit_resource($res_id)) {
            move_order('course_weekly_view_activities', 'id', $res_id, 'order', 'up', "course_weekly_view_id={$id}");
        }
    }
    return '';
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:69,代码来源:functions.php


示例2: renderViewRows

 public static function renderViewRows($rows, Apartment $model)
 {
     if (!$rows) {
         return '';
     }
     foreach ($rows as $row) {
         if (!$model->canShowInView($row['field'])) {
             continue;
         }
         if ($row['standard_type'] != FormDesigner::STANDARD_TYPE_NEW && file_exists(ROOT_PATH . '/protected/views/common/apartments/fields/' . $row['field'] . '.php')) {
             //
             Yii::app()->controller->renderPartial('//../views/common/apartments/fields/' . $row['field'], array('data' => $model));
             continue;
         }
         if ($row->type == FormDesigner::TYPE_REFERENCE) {
             $sql = "SELECT title_" . Yii::app()->language . " FROM {{apartment_reference_values}} WHERE id=" . $model->{$row}['field'];
             $value = CHtml::encode(Yii::app()->db->createCommand($sql)->queryScalar());
         } else {
             $value = is_string($model->{$row}['field']) ? CHtml::encode($model->{$row}['field']) : '???';
             if ($row->type == FormDesigner::TYPE_TEXT_AREA_WS) {
                 $value = purify($model->{$row}['field']);
             }
         }
         if ($row->type == FormDesigner::TYPE_INT && $row->measure_unit) {
             $value .= '&nbsp;' . CHtml::encode($row->measure_unit);
         }
         if ($value) {
             if ($row['standard_type'] > 0) {
                 echo '<dt>' . CHtml::encode($model->getAttributeLabel($row['field'])) . ':</dt>';
             } else {
                 echo '<dt>' . CHtml::encode($row['label_' . Yii::app()->language]) . ':</dt>';
             }
             if ($row->field == 'phone') {
                 if (issetModule('tariffPlans') && issetModule('paidservices') && $model->owner_id != Yii::app()->user->id) {
                     if (Yii::app()->user->isGuest) {
                         $defaultTariffInfo = TariffPlans::getFullTariffInfoById(TariffPlans::DEFAULT_TARIFF_PLAN_ID);
                         if (!$defaultTariffInfo['showPhones']) {
                             echo '<dd>' . Yii::t('module_tariffPlans', 'Please <a href="{n}">login</a> to view', Yii::app()->controller->createUrl('/site/login')) . '</dd>';
                         } else {
                             echo '<dd><span id="owner-phone">' . CHtml::link(tc('Show phone'), 'javascript: void(0);', array('onclick' => 'generatePhone();')) . '</span>' . '</dd>';
                         }
                     } else {
                         if (TariffPlans::checkAllowShowPhone()) {
                             echo '<dd>' . $value . '</dd>';
                         } else {
                             echo '<dd>' . Yii::t('module_tariffPlans', 'Please <a href="{n}">change the tariff plan</a> to view', Yii::app()->controller->createUrl('/tariffPlans/main/index')) . '</dd>';
                         }
                     }
                 } else {
                     echo '<dd><span id="owner-phone">' . CHtml::link(tc('Show phone'), 'javascript: void(0);', array('onclick' => 'generatePhone();')) . '</span>' . '</dd>';
                 }
             } else {
                 echo '<dd>' . $value . '</dd>';
             }
         }
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:57,代码来源:HFormEditor.php


示例3: _process_post

/**
 * All comments are run through here before they're saved
 *
 * @param string
 */
function _process_post($content)
{
    // We cant use the dom because any dom parser is going to throw away
    // the code inside the code tags, this will currently break for nested
    // code tags and code with [[> in it
    $content = str_replace('<code>', '<pre class="prettyprint linenums"><![CDATA[', $content);
    $content = str_replace('</code>', ']]></pre>', $content);
    _format_lists($content);
    _format_pinkies($content);
    $content = purify($content);
    return $content;
}
开发者ID:neosin,项目名称:seaforium,代码行数:17,代码来源:content_render_helper.php


示例4: printPoster

 public function printPoster($file)
 {
     $file = purify($file);
     if (file_exists('pics/' . $file . '.jpg')) {
         return 'pics/' . $file . '.jpg';
     } else {
         if (file_exists('/pics/' . $file . '.gif')) {
             return 'pics/' . $file . '.gif';
         } else {
             if (file_exists('/pics/' . $file . '.png')) {
                 return 'pics/' . $file . '.png';
             } else {
                 if (file_exists('/pics/' . $file . '.bmp')) {
                     return 'pics/' . $file . '.bmp';
                 } else {
                     return 'includes/img/unavailable.jpg';
                 }
             }
         }
     }
 }
开发者ID:jzawacki,项目名称:netflix-look-a-like,代码行数:21,代码来源:template.class.php


示例5: purify

/**
 * Purify HTML code using HTMLPurifier
 *
 * @param string|array $html : The html to purify
 * @return string|array
 */
function purify($html)
{
    if (empty($html) || trim((string) $html) === '') {
        log_message('error', 'htmlpurifier_pi::purify : The html you sent to the HTML Purifier is empty...I wonder how is that possible...');
        return FALSE;
    }
    if (is_array($html)) {
        foreach ($html as $key => $value) {
            $html[$key] = purify($value);
        }
        return $html;
    } else {
        require_once APPPATH . 'plugins/htmlpurifier/HTMLPurifier.standalone.php';
        $allowed_tags = 'p,em,i,strong,b,a[href],ul,ol,li,code,pre,blockquote';
        $config = HTMLPurifier_Config::createDefault();
        $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
        $config->set('HTML.Allowed', $allowed_tags);
        $config->set('HTML.TidyLevel', 'heavy');
        $config->set('AutoFormat.Linkify', 'true');
        $htmlpurifier = new HTMLPurifier($config);
        return $htmlpurifier->purify($html);
    }
}
开发者ID:RobertAudi,项目名称:CIMBlE,代码行数:29,代码来源:htmlpurifier_pi.php


示例6: purify

function purify($dirty_html)
{
    if (is_array($dirty_html)) {
        foreach ($dirty_html as $key => $val) {
            $dirty_html[$key] = purify($val);
        }
        return $dirty_html;
    }
    if (trim($dirty_html) === '') {
        return $dirty_html;
    }
    $config = HTMLPurifier_Config::createDefault();
    $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
    $config->set('AutoFormat.Linkify', true);
    $config->set('CSS.Trusted', true);
    $config->set('CSS.AllowTricky', true);
    $config->set('Filter.YouTube', true);
    $config->set('HTML.SafeObject', true);
    $config->set('Output.FlashCompat', true);
    $config->set('Output.Newline', '<br />');
    $def = $config->getHTMLDefinition(true);
    $def->addElement('spoiler', 'Block', 'Flow', 'Common', array());
    return HTMLPurifier($dirty_html, $config);
}
开发者ID:neosin,项目名称:seaforium,代码行数:24,代码来源:htmlpurifier_helper.php


示例7: isset

    $new_position = isset($_GET['moveUp']) ? $position - 1 : $position + 1;
    $trade_position_pqid = Database::get()->querySingle("SELECT pqid FROM `poll_question`\r\n\t\t\t\t  WHERE pid = ?d AND q_position = ?d", $pid, $new_position)->pqid;
    Database::get()->query("UPDATE poll_question SET q_position = ?d WHERE pid = ?d AND pqid= ?d", $new_position, $pid, $pqid);
    Database::get()->query("UPDATE poll_question SET q_position = ?d WHERE pid = ?d AND pqid = ?d", $position, $pid, $trade_position_pqid);
    redirect_to_home_page("modules/questionnaire/admin.php?course={$course_code}&pid={$pid}");
}
if (isset($_POST['submitPoll'])) {
    $v = new Valitron\Validator($_POST);
    $v->rule('required', array('PollName'));
    $v->labels(array('PollName' => "{$langTheField} {$langTitle}"));
    if ($v->validate()) {
        $PollName = $_POST['PollName'];
        $PollStart = date('Y-m-d H:i', strtotime($_POST['PollStart']));
        $PollEnd = date('Y-m-d H:i', strtotime($_POST['PollEnd']));
        $PollDescription = purify($_POST['PollDescription']);
        $PollEndMessage = purify($_POST['PollEndMessage']);
        $PollAnonymized = isset($_POST['PollAnonymized']) ? $_POST['PollAnonymized'] : 0;
        if (isset($_GET['pid'])) {
            $pid = intval($_GET['pid']);
            Database::get()->query("UPDATE poll SET name = ?s,\r\n                    start_date = ?t, end_date = ?t, description = ?s, end_message = ?s, anonymized = ?d WHERE course_id = ?d AND pid = ?d", $PollName, $PollStart, $PollEnd, $PollDescription, $PollEndMessage, $PollAnonymized, $course_id, $pid);
            Session::Messages($langPollEdited, 'alert-success');
        } else {
            $PollActive = 1;
            $pid = Database::get()->query("INSERT INTO poll\r\n                        (course_id, creator_id, name, creation_date, start_date, end_date, active, description, end_message, anonymized)\r\n                        VALUES (?d, ?d, ?s, NOW(), ?t, ?t, ?d, ?s, ?s, ?d)", $course_id, $uid, $PollName, $PollStart, $PollEnd, $PollActive, $PollDescription, $PollEndMessage, $PollAnonymized)->lastInsertID;
            Session::Messages($langPollCreated, 'alert-success');
        }
        redirect_to_home_page("modules/questionnaire/admin.php?course={$course_code}&pid={$pid}");
    } else {
        // Errors
        Session::flashPost()->Messages($langFormErrors)->Errors($v->errors());
        if (isset($_GET['pid'])) {
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:admin.php


示例8: NOW

                                format='txt',
                                date = NOW(),
                                date_modified = NOW()", $course_id, $subsystem, $chat_filename, $saveIn);
            $fchat = fopen($fileChatName, 'a');
            fwrite($fchat, $timeNow." ---- ".$langSaveMessage . " ---- !@#$ systemMsgSave\n");
            fclose($fchat);
        } else {
        }
        @unlink($exportFileChat);
        redirect_to_home_page("modules/conference/messageList.php?course=$course_code");
    }
  
// add new line
    if (isset($_POST['chatLine']) and trim($_POST['chatLine']) != '') {
        if (!isset($_POST['token']) || !validate_csrf_token($_POST['token'])) csrf_token_error();
        $chatLine = purify($_POST['chatLine']);
        $fchat = fopen($fileChatName, 'a');
        if ($is_editor) {
            $nick = "<b>".q($nick)."</b>";
        }
        fwrite($fchat, $timeNow . ' - ' . $nick . ' : ' . stripslashes($chatLine) . " !@#$ $uid       \n");
        fclose($fchat);
        redirect_to_home_page("modules/conference/messageList.php?course=$course_code");
    }
?>
<!DOCTYPE html>
<html>
<head>
    <base target="_parent">
    <meta http-equiv="refresh" content="30; url=<?php echo $_SERVER['SCRIPT_NAME']; ?>" />
    <title>Chat messages</title>
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:messageList.php


示例9: array

 $dates = array();
 if (isset($_POST['startdate_active']) and isset($_POST['startdate'])) {
     $start_sql = 'begin = ?s';
     $date_started = DateTime::createFromFormat("d-m-Y H:i", $_POST['startdate']);
     $dates[] = $date_started->format("Y-m-d H:i:s");
 } else {
     $start_sql = 'begin = NULL';
 }
 if (isset($_POST['enddate_active']) and isset($_POST['enddate'])) {
     $end_sql = 'end = ?s';
     $date_ended = DateTime::createFromFormat("d-m-Y H:i", $_POST['enddate']);
     $dates[] = $date_ended->format("Y-m-d H:i:s");
 } else {
     $end_sql = 'end = NULL';
 }
 $newContent = purify($newContent);
 if (isset($_POST['id'])) {
     // modify announcement
     $id = $_POST['id'];
     Database::get()->query("UPDATE admin_announcement
                     SET title = ?s, body = ?s, lang = ?s,
                         `date` = " . DBHelper::timeAfter() . ", $start_sql, $end_sql
                     WHERE id = ?d", $title, $newContent, $lang_admin_ann, $dates, $id);
     $message = $langAdminAnnModify;
 } else {
     // add new announcement
     // order
     $orderMax = Database::get()->querySingle("SELECT MAX(`order`) as max FROM admin_announcement")->max;
     $order = $orderMax + 1;
     Database::get()->query("INSERT INTO admin_announcement
                     SET title = ?s, 
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:adminannouncements.php


示例10: NOW

                                                      url = ?s,
                                                      notes = ?s,
                                                      category_id = ?d,
                                                      datestamp = NOW(),
                                                      course_id = ?d,
                                                      `order` = ?d"
                        , $_POST['term'], $_POST['definition'], $url, purify($_POST['notes']), $category_id, $course_id, findorder($course_id));
                $log_action = LOG_INSERT;
                $success_message = $langGlossaryAdded;
            }
            $id = $q->lastInsertID;
            Log::record($course_id, MODULE_ID_GLOSSARY, $log_action, array('id' => $id,
                'term' => $_POST['term'],
                'definition' => $_POST['definition'],
                'url' => $url,
                'notes' => purify($_POST['notes'])));

            if ($q and $q->affectedRows) {
                invalidate_glossary_cache();
                Session::Messages($success_message, 'alert-success');
            }
            redirect_to_home_page("modules/glossary/index.php?course=$course_code");
        } else {
            $new_or_modify = isset($_POST['id']) ? "&edit=$_POST[id]" : "&add=1";
            Session::flashPost()->Messages($langFormErrors)->Errors($v->errors());
            redirect_to_home_page("modules/glossary/index.php?course=$course_code$new_or_modify");
        }
    }

    if (isset($_GET['delete'])) {
        $id = getDirectReference($_GET['delete']);
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:index.php


示例11: purifyArray

/** Walks recursively through an array and trims whitespace.
 *  Compresses multiple spaces into 1
 * @param array $data
 */
function purifyArray(array &$data)
{
    foreach ($data as $key => &$value) {
        trim($key);
        if (is_array($value)) {
            purify($value);
        } else {
            $value = trim(preg_replace('/\\s+/', ' ', $value));
        }
    }
}
开发者ID:nithin8702,项目名称:onlinescoring,代码行数:15,代码来源:savefinalform.php


示例12: getLink

 function getLink()
 {
     return "<a href=\"" . $this->getUrl() . "\">" . purify($this->getName()) . "</a>";
 }
开发者ID:pierotofy,项目名称:pierotofy.it,代码行数:4,代码来源:Topic.php


示例13: AutoValidator

$av = new AutoValidator("frm-register", $_POST);
if ($av->validate()) {
    if (isset($_POST['question']) && $_POST['question'] == "10") {
        $email = db_escape(purify(trim(Charset::Utf8ToDB($_POST['email']))));
        $creds = LoginUtils::HashToCredentials(db_escape($_POST['hash']));
        $username = db_escape(purify(trim(Charset::Utf8ToDB($creds['username']))));
        $password = db_escape(purify(trim(Charset::Utf8ToDB($creds['password']))));
        // Username libero?
        if (!DB::FindOne("SELECT 1 FROM users WHERE user = \"{$username}\"")) {
            // Legacy: Un timestamp sarebbe stato meglio, ma non dobbiamo fare nulla con questo dato, quindi va bene cosi'
            $data = date("d/m/Y G:i");
            $description = "Normal User";
            $md5 = LoginUtils::Md5FromCredentials($username, $password);
            // Tutto a posto
            exequery(sprintf('INSERT INTO users (user, mail, ip, os_browser, date, description, permission, verified, md5, last_login_timestamp, last_login_ip, newsletter)
                  VALUES ("%s", "%s", "%s", "%s", "%s", "%s", %s, %s, "%s", %s, "%s", %s)', $username, $email, get_ip(), db_escape(purify($_SERVER["HTTP_USER_AGENT"])), $data, $description, User::PERMISSION_USER, 1, $md5, time(), get_ip(), 1));
            // Logga l'utente
            $currentUser = UserFactory::CreateFromCredentials($username, $password);
            if ($currentUser->isLogged()) {
                $response->setSuccess(true);
                // Logga
                Log::Info(sprintf("%s si e' registrato", $currentUser['username']));
                $_SESSION['login_hash'] = $currentUser['md5'];
                setcookie('login_hash', $currentUser['md5'], time() + 60 * 60 * 24 * 7, '/');
            } else {
                // Questo non dovrebbe succedere
                $response->setError("E' successo un imprevisto durante la registrazione. Per favore segnala questo incidente ad un amministratore.");
            }
        } else {
            $response->setError("L'username e' stato gia' preso. Scegline un'altro.");
        }
开发者ID:pierotofy,项目名称:pierotofy.it,代码行数:31,代码来源:register.php


示例14: BlogPost

    if (isset($_POST['submitBlogPost']) && $_POST['submitBlogPost'] == $langAdd) {
        if ($blog->permCreate($is_editor, $stud_allow_create, $uid)) {
            $post = new BlogPost();
            if ($post->create($_POST['blogPostTitle'], purify($_POST['newContent']), $uid, $course_id)) {
                Session::Messages($langBlogPostSaveSucc, 'alert-success');
            } else {
                Session::Messages($langBlogPostSaveFail);
            }
        } else {
            Session::Messages($langBlogPostNotAllowedCreate);
        }
    } elseif (isset($_POST['submitBlogPost']) && $_POST['submitBlogPost'] == $langModifBlogPost) {
        $post = new BlogPost();
        if ($post->loadFromDB($_POST['pId'])) {
            if ($post->permEdit($is_editor, $stud_allow_create, $uid)) {
                if ($post->edit($_POST['blogPostTitle'], purify($_POST['newContent']))) {
                    Session::Messages($langBlogPostSaveSucc, 'alert-success');
                } else {
                    Session::Messages($langBlogPostSaveFail);
                }
            } else {
                Session::Messages($langBlogPostNotAllowedEdit);
            }
        } else {
            Session::Messages($langBlogPostNotFound);
        }
    }
    redirect_to_home_page("modules/blog/index.php?course={$course_code}");
}
if (isset($message) && $message) {
    $tool_content .= $message . "<br/>";
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:index.php


示例15: updateFillInBlanksAnswerTypeValue

    function updateFillInBlanksAnswerTypeValue(){
        $('input[name=answerType]#fill_in_blanks_selector').val($(this).val());
    }
 });
</script>
 ";
// the question form has been submitted
if (isset($_POST['submitQuestion'])) {
    $v = new Valitron\Validator($_POST);
    $v->rule('required', array('questionName'));
    $v->labels(array(
        'questionName' => "$langTheField $langQuestion"
    ));
    if($v->validate()) {
        $questionName = trim($questionName);
        $questionDescription = purify($questionDescription);
        // no name given
        if (empty($questionName)) {
            $msgErr = $langGiveQuestion;
        }
        if (isset($_GET['modifyQuestion'])) {
            $objQuestion->read($_GET['modifyQuestion']);
        }
        $objQuestion->updateTitle($questionName);
        $objQuestion->updateDescription($questionDescription);
        $objQuestion->updateType($answerType);
        $objQuestion->updateDifficulty($difficulty);
        $objQuestion->updateCategory($category);

        //If grade field set (only in Free text questions)
        if (isset($questionGrade)) {
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:statement_admin.inc.php


示例16: array

 */
$require_current_course = TRUE;
$require_login = true;
$require_editor = true;
require_once '../../include/baseTheme.php';
require_once 'modules/units/functions.php';
require_once 'include/lib/fileUploadLib.inc.php';
$pageName = $langEditCourseProgram;
$navigation[] = array('url' => 'index.php?course=' . $course_code, 'name' => $langCourseProgram);
$course = Database::get()->querySingle('SELECT description, home_layout, course_image FROM course WHERE id = ?d', $course_id);
if (isset($_GET['delete_image'])) {
    Database::get()->query("UPDATE course SET course_image = NULL WHERE id = ?d", $course_id);
    unlink("{$webDir}/courses/{$course_code}/image/{$course->course_image}");
    redirect_to_home_page('modules/course_home/editdesc.php');
} elseif (isset($_POST['submit'])) {
    $db_vars = array(purify($_POST['description']), $_POST['layout']);
    $extra_sql = '';
    if (isset($_FILES['course_image']) && is_uploaded_file($_FILES['course_image']['tmp_name'])) {
        $file_name = $_FILES['course_image']['name'];
        validateUploadedFile($file_name, 2);
        $i = 0;
        while (is_file("{$webDir}/courses/{$course_code}/image/{$file_name}")) {
            $i++;
            $name = pathinfo($file_name, PATHINFO_FILENAME);
            $ext = get_file_extension($file_name);
            $file_name = "{$name}-{$i}.{$ext}";
        }
        move_uploaded_file($_FILES['course_image']['tmp_name'], "{$webDir}/courses/{$course_code}/image/{$file_name}");
        $extra_sql = ", course_image = ?s";
        array_push($db_vars, $file_name);
    }
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:editdesc.php


示例17: q

             $startDate_obj = DateTime::createFromFormat('Y-m-d', $announce->start_display);
             $startdate = $startDate_obj->format('d-m-Y');
             $showFrom = q($startdate);
         }
         if ($announce->stop_display != '0000-00-00') {
             $endDate_obj = DateTime::createFromFormat('Y-m-d', $announce->stop_display);
             $enddate = $endDate_obj->format('d-m-Y');
             $showUntil = q($enddate);
         }
     }
 }
 /* submit */
 if (isset($_POST['submitAnnouncement'])) {
     // modify announcement
     $antitle = $_POST['antitle'];
     $newContent = purify($_POST['newContent']);
     $send_mail = isset($_POST['recipients']) && count($_POST['recipients']) > 0;
     if (isset($_POST['startdate']) && !empty($_POST['startdate'])) {
         $startDate_obj = DateTime::createFromFormat('d-m-Y', $_POST['startdate']);
         $start_display = $startDate_obj->format('Y-m-d');
     } else {
         $start_display = "0000-00-00";
     }
     if (isset($_POST['enddate']) && !empty($_POST['enddate'])) {
         $endDate_obj = DateTime::createFromFormat('d-m-Y', $_POST['enddate']);
         $stop_display = $endDate_obj->format('Y-m-d');
     } else {
         $stop_display = "0000-00-00";
     }
     if (!empty($_POST['id'])) {
         $id = intval($_POST['id']);
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:index.php


示例18: edit_assignment

function edit_assignment($id)
{
    global $tool_content, $langBackAssignment, $langEditSuccess, $m, $langTheField, $langEditError, $course_code, $works_url, $course_id, $uid, $workPath, $langFormErrors;
    $v = new Valitron\Validator($_POST);
    $v->rule('required', array('title', 'max_grade'));
    $v->rule('numeric', array('max_grade'));
    $v->labels(array('title' => "{$langTheField} {$m['title']}", 'max_grade' => "{$langTheField} {$m['max_grade']}"));
    if ($v->validate()) {
        $row = Database::get()->querySingle("SELECT * FROM assignment WHERE id = ?d", $id);
        $title = $_POST['title'];
        $desc = purify($_POST['desc']);
        $deadline = trim($_POST['WorkEnd']) == FALSE ? '0000-00-00 00:00' : date('Y-m-d H:i', strtotime($_POST['WorkEnd']));
        $late_submission = isset($_POST['late_submission']) && trim($_POST['WorkEnd']) != FALSE ? 1 : 0;
        $group_submissions = $_POST['group_submissions'];
        $max_grade = filter_input(INPUT_POST, 'max_grade', FILTER_VALIDATE_FLOAT);
        $assign_to_specific = filter_input(INPUT_POST, 'assign_to_specific', FILTER_VALIDATE_INT);
        $assigned_to = filter_input(INPUT_POST, 'ingroup', FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY);
        $auto_judge = filter_input(INPUT_POST, 'auto_judge', FILTER_VALIDATE_INT);
        $auto_judge_scenarios = serialize($_POST['auto_judge_scenarios']);
        $lang = filter_input(INPUT_POST, 'lang');
        if ($assign_to_specific == 1 && empty($assigned_to)) {
            $assign_to_specific = 0;
        }
        if (!isset($_POST['comments'])) {
            $comments = '';
        } else {
            $comments = purify($_POST['comments']);
        }
        if (!isset($_FILES) || !$_FILES['userfile']['size']) {
            $_FILES['userfile']['name'] = '';
            $_FILES['userfile']['tmp_name'] = '';
            $filename = $row->file_path;
            $file_name = $row->file_name;
        } else {
            validateUploadedFile($_FILES['userfile']['name'], 2);
            if (preg_match('/\\.(ade|adp|bas|bat|chm|cmd|com|cpl|crt|exe|hlp|hta|' . 'inf|ins|isp|jse|lnk|mdb|mde|msc|msi|msp|mst|pcd|pif|reg|scr|sct|shs|' . 'shb|url|vbe|vbs|wsc|wsf|wsh)$/', $_FILES['userfile']['name'])) {
                $tool_content .= "<p class=\"caution\">{$langUnwantedFiletype}: {$_FILES['userfile']['name']}<br />";
                $tool_content .= "<a href=\"{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;id={$id}\">{$langBack}</a></p><br />";
                return;
            }
            $local_name = uid_to_name($uid);
            $am = Database::get()->querySingle("SELECT am FROM user WHERE id = ?d", $uid)->am;
            if (!empty($am)) {
                $local_name .= $am;
            }
            $local_name = greek_to_latin($local_name);
            $local_name = replace_dangerous_char($local_name);
            $secret = $row->secret_directory;
            $ext = get_file_extension($_FILES['userfile']['name']);
            $filename = "{$secret}/{$local_name}" . (empty($ext) ? '' : '.' . $ext);
            if (move_uploaded_file($_FILES['userfile']['tmp_name'], "{$workPath}/admin_files/{$filename}")) {
                @chmod("{$workPath}/admin_files/{$filename}", 0644);
                $file_name = $_FILES['userfile']['name'];
            }
        }
        Database::get()->query("UPDATE assignment SET title = ?s, description = ?s, deadline = ?t, late_submission = ?d, comments = ?s,\n                                group_submissions = ?d, max_grade = ?d, assign_to_specific = ?d, file_path = ?s, file_name = ?s,\n                                auto_judge = ?d, auto_judge_scenarios = ?s, lang = ?s WHERE course_id = ?d AND id = ?d", $title, $desc, $deadline, $late_submission, $comments, $group_submissions, $max_grade, $assign_to_specific, $filename, $file_name, $auto_judge, $auto_judge_scenarios, $lang, $course_id, $id);
        Database::get()->query("DELETE FROM assignment_to_specific WHERE assignment_id = ?d", $id);
        if ($assign_to_specific && !empty($assigned_to)) {
            if ($group_submissions == 1) {
                $column = 'group_id';
                $other_column = 'user_id';
            } else {
                $column = 'user_id';
                $other_column = 'group_id';
            }
            foreach ($assigned_to as $assignee_id) {
                Database::get()->query("INSERT INTO assignment_to_specific ({$column}, {$other_column}, assignment_id) VALUES (?d, ?d, ?d)", $assignee_id, 0, $id);
            }
        }
        Log::record($course_id, MODULE_ID_ASSIGN, LOG_MODIFY, array('id' => $id, 'title' => $title, 'description' => $desc, 'deadline' => $deadline, 'group' => $group_submissions));
        \Session::Messages($langEditSuccess, 'alert-success');
        redirect_to_home_page("modules/work/index.php?course={$course_code}");
    } else {
        //        $new_or_modify = isset($_GET['NewExercise']) ? "&NewExercise=Yes" : "&exerciseId=$_GET[exerciseId]&modifyExercise=yes";
        Session::flashPost()->Messages($langFormErrors)->Errors($v->errors());
        redirect_to_home_page("modules/work/index.php?course={$course_code}&id={$id}&choice=edit");
    }
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:78,代码来源:index.php


示例19: AgendaIndexer

    
if ($is_editor) {
    $agdx = new AgendaIndexer();
    // modify visibility
    if (isset($_GET['mkInvisibl']) and $_GET['mkInvisibl'] == true) {
        Database::get()->query("UPDATE agenda SET visible = 0 WHERE course_id = ?d AND id = ?d", $course_id, $id);
        $agdx->store($id);
        redirect_to_home_page("modules/agenda/index.php?course=$course_code&v=1");
    } elseif (isset($_GET['mkVisibl']) and ( $_GET['mkVisibl'] == true)) {
        Database::get()->query("UPDATE agenda SET visible = 1 WHERE course_id = ?d AND id = ?d", $course_id, $id);
        $agdx->store($id);
        redirect_to_home_page("modules/agenda/index.php?course=$course_code&v=1");
    }
    if (isset($_POST['event_title'])) {
        register_posted_variables(array('startdate' => true, 'event_title' => true, 'content' => true, 'duration' => true));
        $content = purify($content);
        if (isset($_POST['id']) and !empty($_POST['id'])) {  // update event
            $id = $_POST['id'];
            $recursion = null;
            if (!empty($_POST['frequencyperiod']) && intval($_POST['frequencynumber']) > 0 && !empty($_POST['enddate'])) {
                $recursion = array('unit' => $_POST['frequencyperiod'], 'repeat' => $_POST['frequencynumber'], 'end' => $_POST['enddate']);
            }            
            if(isset($_POST['rep']) && $_POST['rep'] == 'yes'){
                $resp = update_recursive_event($id, $event_title, $startdate, $duration, $content, $recursion);
            } else {
                $resp = update_event($id, $event_title, $startdate, $duration, $content, $recursion);
            }
            $agdx->store($id);
        } else { // add new event
            $recursion = null;            
            if (!empty($_POST['frequencyperiod']) && intval($_POST['frequencynumber']) > 0 && !empty($_POST['enddate'])) {
开发者ID:nikosv,项目名称:openeclass,代码行数:30,代码来源:index.php


示例20: purify

                $course_license = 0;
                break;
        }
    }

    if (ctype_alnum($_POST['view_type'])) {
        $view_type = $_POST['view_type'];        
    }
    if (empty($_POST['start_date'])) {
        $_POST['start_date'] = '0000-00-00';
    }
    if (empty($_POST['finish_date'])) {
        $_POST['finish_date'] = '0000-00-00';
    }

    $description = purify($_POST['description']);
    $result = Database::get()->query("INSERT INTO course SET
                        code = ?s,
                        lang = ?s,
                        title = ?s,
                        visible = ?d,
                        course_license = ?d,
                        prof_names = ?s,
                        public_code = ?s,
                        doc_quota = ?f,
                        video_quota = ?f,
                        group_quota = ?f,
                        dropbox_quota = ?f,
                        password = ?s,
                        view_type = ?s,
                        start_date = ?t,
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:create_course.php



注:本文中的purify函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP purify_html函数代码示例发布时间:2022-05-15
下一篇:
PHP purge_all_caches函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap