本文整理汇总了PHP中cache::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP cache::delete方法的具体用法?PHP cache::delete怎么用?PHP cache::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cache
的用法示例。
在下文中一共展示了cache::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vote
/**
* Vote on this
*
* @param \user User voting
* @return bool
*/
public function vote(\user $user)
{
$a = \Kofradia\DB::get()->exec("\n\t\t\tINSERT IGNORE INTO polls_votes\n\t\t\tSET pv_p_id = {$this->poll->id}, pv_po_id = {$this->id}, pv_up_id = {$user->player->id}, pv_time = " . time());
if ($a > 0) {
\Kofradia\DB::get()->exec("UPDATE polls_options SET po_votes = po_votes + 1 WHERE po_id = {$this->id}");
\Kofradia\DB::get()->exec("UPDATE polls SET p_votes = p_votes + 1 WHERE p_id = {$this->poll->id}");
// delete vote cache
\cache::delete("polls_options_list");
}
return $ok;
}
示例2: doAction
public function doAction()
{
$answers = system::POST('answers');
$error = 2;
$msg = '';
if (count($answers) > 0) {
if ($vote = ormPages::get(system::POST('vote_id'), 'vote')) {
if (!$vote->close) {
$sel = new ormSelect('answer');
$sel->fields('name, count');
$sel->where('parents', '=', $vote->id);
while ($answ = $sel->getObject()) {
if (in_array($answ->id, $answers)) {
$answ->count = $answ->count + 1;
$answ->save();
if (!$vote->multiselect) {
break;
}
}
}
cache::delete('vote' . $vote->id . '1');
cache::delete('vote' . $vote->id . '0');
$_SESSION['voting_' . $vote->id] = 1;
$error = 0;
} else {
// Голосование закрыто
$msg = lang::get('VOTING_MSG_CLOSE');
$error = 1;
}
} else {
$msg = lang::get('VOTING_MSG_NOT_FOUND');
}
} else {
$msg = lang::get('VOTING_MSG_CHOSE_VAR');
}
if (system::isAjax()) {
if ($error < 2 && $vote instanceof ormPage) {
$data = page::macros('voting')->objView($vote->id);
}
system::json(array('error' => 0, 'html' => $data, 'msg' => $msg));
} else {
if (!empty($_POST['back_url'])) {
system::redirect($_POST['back_url'], true);
} else {
system::redirect('/');
}
}
}
示例3: proc
public function proc()
{
$obj = user::getObject();
// Если произошли ошибки, перенаправляем на главную страницу админки
if (!$obj instanceof ormObject) {
system::redirect('/');
}
// Присваиваем пришедшие значения полям в объекте
$obj->tabuList('active', 'groups', 'login');
$obj->loadFromPost();
// Сохраняем изменения
$obj_id = $obj->save();
// Если объект не сохранился, выводим пользователю текст ошибки.
if ($obj_id === false) {
system::savePostToSession();
ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), $obj->getErrorListText());
ui::selectErrorFields($obj->getErrorFields());
}
cache::delete('user' . $obj_id);
system::redirect('/core/profile');
}
示例4: cache
$sql = "update v_dialplan_details set ";
$sql .= "dialplan_detail_data = '" . check_str($dialplan_detail_data) . "' ";
$sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
$sql .= "and dialplan_detail_tag = 'action' ";
$sql .= "and dialplan_detail_type = 'set' ";
$sql .= "and dialplan_uuid = '{$dialplan_uuid}' ";
$sql .= "and dialplan_detail_data like 'api_hangup_hook=%' ";
$db->query(check_sql($sql));
}
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $_SESSION["context"]);
//redirect the browser
if ($action == "update" && permission_exists('fax_extension_edit')) {
$_SESSION["message"] = $text['confirm-update'];
}
if ($action == "add" && permission_exists('fax_extension_add')) {
$_SESSION["message"] = $text['confirm-add'];
}
header("Location: fax.php");
return;
}
//if ($_POST["persistformvar"] != "true")
}
//(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (strlen($_GET['id']) > 0 && $_POST["persistformvar"] != "true") {
示例5: dialplan
/**
* Add a dialplan for call center
* @var string $domain_uuid the multi-tenant id
* @var string $value string to be cached
*/
public function dialplan()
{
//normalize the fax forward number
if (strlen($this->fax_forward_number) > 3) {
//$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
$this->fax_forward_number = str_replace(" ", "", $this->fax_forward_number);
$this->fax_forward_number = str_replace("-", "", $this->fax_forward_number);
}
//set the forward prefix
if (strripos($this->fax_forward_number, '$1') === false) {
$this->forward_prefix = '';
//not found
} else {
$this->forward_prefix = $this->forward_prefix . $this->fax_forward_number . '#';
//found
}
//delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
//delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "24108154-4ac3-1db6-1551-4731703a4440";
$dialplan["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_name"] = $this->fax_name != '' ? $this->fax_name : format_phone($this->destination_number);
$dialplan["dialplan_number"] = $this->fax_extension;
$dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_order"] = "310";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $this->fax_description;
$dialplan_detail_order = 10;
//add the public condition
$y = 1;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^" . $this->destination_number . "\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "fax_uuid=" . $this->fax_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "api_hangup_hook=lua app/fax/resources/scripts/hangup_rx.lua";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
foreach ($_SESSION['fax']['variable'] as $data) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (substr($data, 0, 8) == "inbound:") {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($data, 8, strlen($data));
} elseif (substr($data, 0, 9) == "outbound:") {
} else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $data;
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (strlen($_SESSION['fax']['last_fax']['text']) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=" . $_SESSION['fax']['last_fax']['text'];
} else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=\${caller_id_number}-\${strftime(%Y-%m-%d-%H-%M-%S)}";
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
//.........这里部分代码省略.........
示例6: ClearCache
public function ClearCache($path = "", $private = true, $recurse = false)
{
global $AR;
$norealnode = false;
if (!$path) {
$path = $this->path;
} else {
$realpath = current($this->get($path, "system.get.path.phtml"));
if ($realpath != false) {
$path = $realpath;
} else {
$norealnode = true;
}
}
if ($norealnode !== true) {
/*
we don't want to recurse to the currentsite, because the path
doesn't exists in the database, so it doesn't have a currentsite
the privatecache should be emptied by delete, or by the cleanup
cronjob. The current path doesn't exists in the database, so a
object id which is needed to find the node in the cache, isn't
available
*/
if ($private) {
// now remove any private cache entries.
// FIXME: this doesn't scale very well.
// only scalable solution is storage in a database
// but it will need the original path info to
// remove recursively fast enough.
// this means a change in the filestore api. -> 2.5
// Use chunks of max 5000 objects at a time to be more memory-efficient;
$pcache = $this->store->get_filestore("privatecache");
if ($recurse) {
$offset = 0;
$limit = 5000;
$ids = $this->store->info($this->store->find($path, "", $limit, $offset));
while (is_array($ids) && count($ids)) {
foreach ($ids as $value) {
$eventData = new object();
$eventData = ar_events::fire('onbeforeclearprivatecache', $eventData, $value['type'], $value['path']);
if (!$eventData) {
continue;
}
$pcache->purge($value["id"]);
ar_events::fire('onclearprivatecache', $eventData, $value['type'], $value['path']);
}
$offset += $limit;
$ids = $this->store->info($this->store->find($path, "", $limit, $offset));
}
} else {
$eventData = new object();
$eventData = ar_events::fire('onbeforeclearprivatecache', $eventData, $this->type, $this->path);
if ($eventData) {
$pcache->purge($this->id);
ar_events::fire('onclearprivatecache', $eventData, $this->type, $this->path);
}
}
}
// now clear all parents untill the current site
$site = $this->currentsite($path);
$project = $this->currentproject($path);
if ($path != $site && $path != $project && $path != '/') {
$parent = $this->make_path($path . '../');
$this->ClearCache($parent, $private, false);
}
}
$recursed = array();
// filesystem cache image filenames are always lower case, so
// use special path for that. Remember 'real' path name for
// recursion and stuff
$fs_path = strtolower($path);
$nlslist = $AR->nls->list;
$nlslist["."] = "default";
$cache_types[] = "normal";
$cache_types[] = "compressed";
$cache_types[] = "session";
global $cache_config, $store_config;
$cachestore = new cache($cache_config);
$filestore = $this->store->get_config("files");
foreach ($cache_types as $type) {
foreach ($nlslist as $nls => $language) {
// break away if nls doesn't exists
// is dir is cached, so it should not cost more that it add's in speed
if (!is_dir($filestore . "cache/{$type}/{$nls}")) {
continue;
}
$fpath = $filestore . "cache/{$type}/{$nls}" . $fs_path;
$hpath = $filestore . "cacheheaders/{$type}/{$nls}" . $fs_path;
if ($dir = @dir($fpath)) {
while (false !== ($entry = $dir->read())) {
if ($entry != "." && $entry != "..") {
if (is_file($fpath . $entry)) {
@unlink($fpath . $entry);
@unlink($hpath . $entry);
$cachestore->delete("/" . $type . "/" . $nls . $fs_path . $entry);
} else {
if ($recurse && !$recursed[$entry]) {
$this->ClearCache($path . $entry . "/", false, true);
$recursed[$entry] = true;
//.........这里部分代码省略.........
示例7: buildThread
function buildThread($id, $return = false, $mod = false)
{
global $board, $config, $build_pages;
$id = round($id);
if (event('build-thread', $id)) {
return;
}
if ($config['cache']['enabled'] && !$mod) {
// Clear cache
cache::delete("thread_index_{$board['uri']}_{$id}");
cache::delete("thread_{$board['uri']}_{$id}");
}
if ($config['try_smarter'] && !$mod) {
$build_pages[] = thread_find_page($id);
}
if (!$config['smart_build'] || $return || $mod) {
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri']));
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
if (!isset($thread)) {
$thread = new Thread($post, $mod ? '?/' : $config['root'], $mod);
} else {
$thread->add(new Post($post, $mod ? '?/' : $config['root'], $mod));
}
}
// Check if any posts were found
if (!isset($thread)) {
error($config['error']['nonexistant']);
}
$hasnoko50 = $thread->postCount() >= $config['noko50_min'];
$antibot = $mod || $return ? false : create_antibot($board['uri'], $id);
$body = Element('thread.html', array('board' => $board, 'thread' => $thread, 'body' => $thread->build(), 'config' => $config, 'id' => $id, 'mod' => $mod, 'hasnoko50' => $hasnoko50, 'isnoko50' => false, 'antibot' => $antibot, 'boardlist' => createBoardlist($mod), 'return' => $mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index']));
// json api
if ($config['api']['enabled']) {
$api = new Api();
$json = json_encode($api->translateThread($thread));
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . '.json';
file_write($jsonFilename, $json);
}
} else {
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . '.json';
file_unlink($jsonFilename);
}
if ($config['smart_build'] && !$return && !$mod) {
$noko50fn = $board['dir'] . $config['dir']['res'] . sprintf($config['file_page50'], $id);
file_unlink($noko50fn);
file_unlink($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $id));
} else {
if ($return) {
return $body;
} else {
$noko50fn = $board['dir'] . $config['dir']['res'] . sprintf($config['file_page50'], $id);
if ($hasnoko50 || file_exists($noko50fn)) {
buildThread50($id, $return, $mod, $thread, $antibot);
}
file_write($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $id), $body);
}
}
}
示例8: cache
$orm->name('dialplans');
if (isset($dialplan["dialplan_uuid"])) {
$orm->uuid($dialplan["dialplan_uuid"]);
}
$orm->save($dialplan);
$dialplan_response = $orm->message;
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $destination_context);
} else {
//remove empty dialplan details from POST array so doesn't attempt to insert below
unset($_POST["dialplan_details"]);
}
//get the destination_uuid
if (strlen($dialplan_response['uuid']) > 0) {
$_POST["dialplan_uuid"] = $dialplan_response['uuid'];
}
//add the dialplan permission
$permission = "dialplan_edit";
$p = new permissions();
$p->add($permission, 'temp');
//save the destination
$orm = new orm();
$orm->name('destinations');
示例9: round
$time = $_base->date->get();
$time->setDate($date[3], $date[2], $date[1]);
$time->setTime($date[4], $date[5], $date[6]);
}
// kontroller beløp
$amount = round(str_replace(",", ".", $_POST['amount']), 2);
// ugyldig dato
if (!$date) {
$_base->page->add_message("Ugyldig dato.", "error");
} elseif ($amount <= 0) {
$_base->page->add_message("Ugyldig beløp.", "error");
} elseif (isset($_POST['approve'])) {
// legg til
\Kofradia\DB::get()->exec("INSERT INTO donations SET d_up_id = " . ($up_id ? $up_id : 'NULL') . ", d_amount = {$amount}, d_time = " . $time->format("U"));
// tøm cache
cache::delete("donation_list");
$_base->page->add_message("Donasjonsoppføringen ble lagt til.");
redirect::handle();
} else {
echo box_start("Registrer donasjon", "xsmall") . '
<form action="" method="post">
<input type="hidden" name="up_id" value="' . $up_id . '" />
<input type="hidden" name="time" value="' . htmlspecialchars($_POST['time']) . '" />
<input type="hidden" name="amount" value="' . $amount . '" />
<dl class="dd_right">
<dt>Bruker</dt>
<dd>' . ($player ? game::profile_link($player['up_id'], $player['up_name'], $player['up_access_level']) : 'Anonym') . '</dd>
<dt>Tidspunkt</dt>
<dd>' . $time->format(date::FORMAT_SEC) . '</dd>
<dt>Beløp</dt>
<dd>' . game::format_nok($amount) . '</dd>
示例10: count
//if ($action == "add")
if ($action == "update") {
$sql = " select c.call_block_number, d.domain_name from v_call_block as c ";
$sql .= "JOIN v_domains as d ON c.domain_uuid=d.domain_uuid ";
$sql .= "where c.domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
$sql .= "and c.call_block_uuid = '{$call_block_uuid}'";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
$result_count = count($result);
if ($result_count > 0) {
//set the domain_name
$domain_name = $result[0]["domain_name"];
//clear the cache
$cache = new cache();
$cache->delete("app:call_block:" . $domain_name . ":" . $call_block_number);
}
unset($prep_statement, $sql);
$sql = "update v_call_block set ";
$sql .= "call_block_name = '{$call_block_name}', ";
$sql .= "call_block_number = '{$call_block_number}', ";
$sql .= "call_block_action = '{$call_block_action}', ";
$sql .= "call_block_enabled = '{$call_block_enabled}' ";
$sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
$sql .= "and call_block_uuid = '{$call_block_uuid}'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['label-update-complete'];
header("Location: call_block.php");
return;
}
示例11: mod_new_pm
function mod_new_pm($username)
{
global $config, $mod;
if (!hasPermission($config['mod']['create_pm'])) {
error($config['error']['noaccess']);
}
$query = prepare("SELECT `id` FROM ``mods`` WHERE `username` = :username");
$query->bindValue(':username', $username);
$query->execute() or error(db_error($query));
if (!($id = $query->fetchColumn())) {
// Old style ?/PM: by user ID
$query = prepare("SELECT `username` FROM ``mods`` WHERE `id` = :username");
$query->bindValue(':username', $username);
$query->execute() or error(db_error($query));
if ($username = $query->fetchColumn()) {
header('Location: ?/new_PM/' . $username, true, $config['redirect_http']);
} else {
error($config['error']['404']);
}
}
if (isset($_POST['message'])) {
$_POST['message'] = escape_markup_modifiers($_POST['message']);
markup($_POST['message']);
$query = prepare("INSERT INTO ``pms`` VALUES (NULL, :me, :id, :message, :time, 1)");
$query->bindValue(':me', $mod['id']);
$query->bindValue(':id', $id);
$query->bindValue(':message', $_POST['message']);
$query->bindValue(':time', time());
$query->execute() or error(db_error($query));
if ($config['cache']['enabled']) {
cache::delete('pm_unread_' . $id);
cache::delete('pm_unreadcount_' . $id);
}
modLog('Sent a PM to ' . utf8tohtml($username));
header('Location: ?/', true, $config['redirect_http']);
}
mod_page(sprintf('%s %s', _('New PM for'), $username), 'mod/new_pm.html', array('username' => $username, 'id' => $id, 'token' => make_secure_link_token('new_PM/' . $username)));
}
示例12: extension
if (permission_exists('extension_add') || permission_exists('extension_edit')) {
//synchronize configuration
if (is_writable($_SESSION['switch']['extensions']['dir'])) {
require_once "app/extensions/resources/classes/extension.php";
$ext = new extension();
$ext->xml();
unset($ext);
}
//write the provision files
if (is_dir($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/app/provision')) {
require_once "app/provision/provision_write.php";
$ext = new extension();
}
//clear the cache
$cache = new cache();
$cache->delete("directory:" . $extension . "@" . $user_context);
if (strlen($number_alias) > 0) {
$cache->delete("directory:" . $number_alias . "@" . $user_context);
}
}
//show the action and redirect the user
if ($action == "add") {
//prepare for alternating the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the action and redirect the user
if (count($generated_users) == 0) {
//action add
$_SESSION["message"] = $text['message-add'];
header("Location: extension_edit.php?id=" . $extension_uuid);
示例13: del
public function del()
{
if (system::issetUrl(2) && is_numeric(system::url(2))) {
// Одиночное удаление
$obj = ormObjects::get(system::url(2));
if ($obj->isInheritor('user') && $obj->id != user::get('id')) {
$this->sendMailDel($obj);
cache::delete('user' . $obj->id);
$obj->toTrash();
echo 'delete';
}
} else {
if (isset($_POST['objects'])) {
// Множественное удаление
while (list($id, $val) = each($_POST['objects'])) {
if (is_numeric($id)) {
$obj = ormObjects::get($id);
if ($obj->isInheritor('user') && $obj->id != user::get('id')) {
$this->sendMailDel($obj);
cache::delete('user' . $obj->id);
$obj->toTrash();
}
}
}
echo 'delete';
}
}
system::stop();
}
示例14: mod_8_settings
function mod_8_settings($b)
{
global $config, $mod;
//if ($b === 'infinity' && $mod['type'] !== ADMIN)
// error('Settings temporarily disabled for this board.');
if (!in_array($b, $mod['boards']) and $mod['boards'][0] != '*') {
error($config['error']['noaccess']);
}
if (!hasPermission($config['mod']['edit_settings'], $b)) {
error($config['error']['noaccess']);
}
if (!openBoard($b)) {
error("Could not open board!");
}
$possible_languages = array_diff(scandir('inc/locale/'), array('..', '.', '.tx', 'README.md'));
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$board_type = $_POST['board_type'];
$imgboard = $board_type == 'imgboard';
$txtboard = $board_type == 'txtboard';
$fileboard = $board_type == 'fileboard';
$title = $_POST['title'];
$subtitle = $_POST['subtitle'];
$country_flags = isset($_POST['country_flags']) ? 'true' : 'false';
$field_disable_name = isset($_POST['field_disable_name']) ? 'true' : 'false';
$enable_embedding = isset($_POST['enable_embedding']) ? 'true' : 'false';
$force_image_op = $imgboard && isset($_POST['force_image_op']) ? 'true' : 'false';
$disable_images = $txtboard ? 'true' : 'false';
$poster_ids = isset($_POST['poster_ids']) ? 'true' : 'false';
$show_sages = isset($_POST['show_sages']) ? 'true' : 'false';
$auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false';
$strip_combining_chars = isset($_POST['strip_combining_chars']) ? 'true' : 'false';
$allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false';
$image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false';
$image_reject_repost_in_thread = isset($_POST['image_reject_repost_in_thread']) ? 'true' : 'false';
$early_404 = isset($_POST['early_404']) ? 'true' : 'false';
$allow_delete = isset($_POST['allow_delete']) ? 'true' : 'false';
$allow_flash = $imgboard && isset($_POST['allow_flash']) ? '$config[\'allowed_ext_files\'][] = \'swf\';' : '';
$allow_pdf = $imgboard && isset($_POST['allow_pdf']) ? '$config[\'allowed_ext_files\'][] = \'pdf\';' : '';
$code_tags = isset($_POST['code_tags']) ? '$config[\'additional_javascript\'][] = \'js/code_tags/run_prettify.js\';$config[\'markup\'][] = array("/\\[code\\](.+?)\\[\\/code\\]/ms", "<code><pre class=\'prettyprint\' style=\'display:inline-block\'>\\$1</pre></code>");' : '';
$katex = isset($_POST['katex']) ? '$config[\'katex\'] = true;$config[\'additional_javascript\'][] = \'js/katex/katex.min.js\'; $config[\'markup\'][] = array("/\\[tex\\](.+?)\\[\\/tex\\]/ms", "<span class=\'tex\'>\\$1</span>"); $config[\'additional_javascript\'][] = \'js/katex-enable.js\';' : '';
$user_flags = isset($_POST['user_flags']) ? "if (file_exists('{$b}/flags.php')) { include 'flags.php'; }\n" : '';
$captcha = isset($_POST['captcha']) ? 'true' : 'false';
$force_subject_op = isset($_POST['force_subject_op']) ? 'true' : 'false';
$force_flag = isset($_POST['force_flag']) ? 'true' : 'false';
$tor_posting = isset($_POST['tor_posting']) ? 'true' : 'false';
$tor_image_posting = isset($_POST['tor_image_posting']) ? 'true' : 'false';
$robot_enable = isset($_POST['robot_enable']) ? 'true' : 'false';
$new_thread_capt = isset($_POST['new_thread_capt']) ? 'true' : 'false';
$oekaki = ($imgboard || $fileboard) && isset($_POST['oekaki']) ? 'true' : 'false';
$view_bumplock = isset($_POST['view_bumplock']) ? '-1' : 'MOD';
if ($tor_image_posting === 'true' && isset($_POST['meta_noindex'])) {
error('Please index your board to enable this.');
}
if ($_POST['locale'] !== 'en' && in_array($_POST['locale'], $possible_languages)) {
$locale = "\$config['locale'] = '{$_POST['locale']}.UTF-8';";
} else {
$locale = '';
}
if (isset($_POST['max_images']) && (int) $_POST['max_images'] && (int) $_POST['max_images'] <= 5) {
$_POST['max_images'] = (int) $_POST['max_images'];
$multiimage = "\$config['max_images'] = {$_POST['max_images']};\n\t\t\t\t\t \$config['additional_javascript'][] = 'js/multi-image.js';";
} else {
$multiimage = '';
}
if (isset($_POST['custom_assets'])) {
$assets = "\$config['custom_assets'] = true;\n\t\t\t\t \$config['spoiler_image'] = 'static/assets/{$b}/spoiler.png';\n\t\t\t\t \$config['image_deleted'] = 'static/assets/{$b}/deleted.png';\n\t\t\t\t \$config['no_file_image'] = 'static/assets/{$b}/no-file.png';\n\t\t\t\t";
} else {
$assets = '';
}
$file_board = '';
if ($fileboard) {
$force_image_op = true;
$file_board = "\$config['threads_per_page'] = 30;\n\t\t\t\t\t \$config['file_board'] = true;\n\t\t\t\t\t \$config['threads_preview'] = 0;\n\t\t\t\t \$config['threads_preview_sticky'] = 0;\n\t\t\t\t\t \$config['allowed_ext_files'] = array();\n";
if (isset($_POST['allowed_type'])) {
foreach ($_POST['allowed_type'] as $val) {
if (in_array($val, $config['fileboard_allowed_types'])) {
$file_board .= "\$config['allowed_ext_files'][] = '{$val}';\n";
}
}
}
if (isset($_POST['allowed_ext_op'])) {
$file_board .= "\$config['allowed_ext_op'] = \$config['allowed_ext_files'];\n";
if (isset($_POST['allowed_ext_op_video'])) {
$file_board .= "\$config['allowed_ext_op'][] = 'webm';\n\t\t\t\t\t\t\t\t\$config['allowed_ext_op'][] = 'mp4';\n";
}
}
if (isset($_POST['tag_id'])) {
$file_board .= "\$config['allowed_tags'] = array();\n";
foreach ($_POST['tag_id'] as $id => $v) {
$file_board .= "\$config['allowed_tags'][";
$file_board .= 'base64_decode("';
$file_board .= base64_encode($_POST['tag_id'][$id]);
$file_board .= '")';
$file_board .= "] = ";
$file_board .= 'base64_decode("';
$file_board .= base64_encode($_POST['tag_desc'][$id]);
$file_board .= '")';
$file_board .= ";\n";
}
}
//.........这里部分代码省略.........
示例15: unset
$dialplan->dialplan_detail_type = 'lua';
//$dialplan->dialplan_detail_data = $call_flow_extension . ' LUA call_flow.lua';
$dialplan->dialplan_detail_data = 'call_flow.lua';
//$dialplan->dialplan_detail_break = '';
//$dialplan->dialplan_detail_inline = '';
$dialplan->dialplan_detail_group = '2';
$dialplan->dialplan_detail_order = '030';
$dialplan->dialplan_detail_add();
unset($dialplan);
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $call_flow_context);
//set the message
if ($action == "add") {
$_SESSION["message"] = $text['message-add'];
}
if ($action == "update") {
$_SESSION["message"] = $text['message-update'];
}
//redirect the browser
header("Location: call_flows.php");
return;
}
}
//if ($_POST["persistformvar"] != "true")
}
//(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)