/** */ function add() { return form($a)->validate(['name' => 'trim|required'])->db_insert_if_ok(self::table, ['name', 'web_path', 'real_path'], [])->on_after_update(function () { cache_del([self::table]); common()->admin_wall_add(['site added: ' . $_POST['name'] . '', db()->insert_id()]); })->text('name')->text('web_path')->text('real_path')->active_box()->save_and_back(); }
/** */ function _purge_category_caches($cat_info = []) { cache_del(['category_sets', 'category_items', 'category_items_all']); if (isset($cat_info['name'])) { cache_del(['cats__get_items_names__' . $cat_info['name'], 'cats__get_items_names__' . $cat_info['name'] . '_0', 'cats__get_items_names__' . $cat_info['name'] . '_1', 'cats__get_items_names__' . $cat_info['name'] . '_0_0', 'cats__get_items_names__' . $cat_info['name'] . '_0_1', 'cats__get_items_names__' . $cat_info['name'] . '_1_0', 'cats__get_items_names__' . $cat_info['name'] . '_1_1', 'cats__prepare_for_box__' . $cat_info['name'] . '_0', 'cats__prepare_for_box__' . $cat_info['name'] . '_1', 'cats__prepare_for_box__' . $cat_info['name'] . '_0_0', 'cats__prepare_for_box__' . $cat_info['name'] . '_1_0']); } }
/** */ function add() { $a = $_POST; return form($a)->validate(['name' => 'trim|required'])->db_insert_if_ok('regions', ['name', 'active'], [])->on_after_update(function () { cache_del(['regions']); common()->admin_wall_add(['region added: ' . $_POST['name'] . '', db()->insert_id()]); })->text('name')->text('country')->info('code')->info('code3')->info('num')->info('cont')->active_box()->save_and_back(); }
/** */ function add() { $a = $_POST; return form($a)->validate(['name' => 'trim|required|alpha-dash'])->db_insert_if_ok(self::table, ['name', 'code', 'native', 'active'], [])->on_after_update(function () { cache_del([self::table]); common()->admin_wall_add(['language added: ' . $_POST['name'] . '', db()->insert_id()]); })->text('code')->text('name')->text('native')->active_box()->save_and_back(); }
/** */ function add() { $a = $_POST; return form($a)->validate(['ip' => 'trim|required|valid_ip|is_unique[core_servers.ip]'])->db_insert_if_ok(self::table, ['ip', 'role', 'name', 'hostname', 'comment'], [])->on_after_update(function () { cache_del(['servers', 'server_roles']); common()->admin_wall_add(['server added: ' . $_POST['ip'] . '', db()->insert_id()]); })->text('ip')->text('role')->text('name')->text('hostname')->textarea('comment')->active_box()->save_and_back(); }
/** */ function add() { $a = $_POST; return form($a)->validate(['name' => 'trim|required|alpha-dash'])->db_insert_if_ok('currencies', ['name', 'id', 'sign', 'active'], [])->on_after_update(function () { cache_del(['currencies']); common()->admin_wall_add(['icon added: ' . $_POST['name'] . '', db()->insert_id()]); })->text('id')->text('name')->text('sign')->active_box()->save_and_back(); }
/** * Automatic translator via Google translate */ function autotranslate() { if ($_POST['translate'] && $_POST['locale']) { set_time_limit(1800); $LOCALE_RES = $_POST['locale']; $base_url = 'http://ajax.googleapis.com/ajax/services/language/translate' . '?v=1.0'; $vars = db()->query_fetch_all("SELECT id,value FROM " . db('locale_vars') . " WHERE id NOT IN( \n\t\t\t\t\tSELECT var_id FROM " . db('locale_translate') . " \n\t\t\t\t\tWHERE locale = '" . $LOCALE_RES . "' AND value != '' \n\t\t\t\t)"); $_info = []; $max_threads = 4; $buffer = []; $translated = []; _debug_log("LOCALE_NUM_VARS: " . count($vars)); foreach ((array) $vars as $A) { $translated = []; $url = $base_url . "&q=" . urlencode(str_replace("_", " ", $A["value"])) . "&langpair=en%7C" . $LOCALE_RES; $_temp[$url] = $A["id"]; if (count($buffer) < $max_threads) { $buffer[$url] = $url; continue; } foreach ((array) common()->multi_request($buffer) as $url => $response) { $response_array = json_decode($response); $response_text = trim($response_array->responseData->translatedText); $ID = $_temp[$url]; $source = str_replace("_", " ", $vars[$ID]["value"]); _debug_log("LOCALE: " . ++$j . " ## " . $ID . " ## " . $source . " ## " . $response_text . " ## " . $url); if (_strlen($response_text) && $response_text != $source) { $translated[$ID] = $response_text; } } if ($translated) { $Q = db()->query("DELETE FROM " . db('locale_translate') . " \n\t\t\t\t\t\tWHERE locale = '" . _es($LOCALE_RES) . "' \n\t\t\t\t\t\t\tAND var_id IN(" . implode(",", array_keys($translated)) . ")"); } foreach ((array) $translated as $_id => $_value) { db()->REPLACE('locale_translate', ['var_id' => intval($_id), 'value' => _es($_value), 'locale' => _es($LOCALE_RES)]); } $buffer = []; $_temp = []; } cache_del('locale_translate_' . $LOCALE_RES); return js_redirect('./?object=' . $_GET['object']); } $Q = db()->query('SELECT * FROM ' . db('locale_langs') . ' ORDER BY name'); while ($A = db()->fetch_assoc($Q)) { $locales[$A['locale']] = $A['name']; } $replace = ['locale_box' => common()->select_box('locale', $locales), 'locale_editor_url' => './?object=locale_editor', 'form_action' => './?object=' . $_GET['object'] . '&action=' . $_GET['action']]; return tpl()->parse($_GET['object'] . '/autotranslate', $replace); }
/** */ function active() { if (!empty($_GET['id'])) { $user_info = user($_GET['id']); } if (!empty($user_info)) { db()->update(self::table, ['active' => (int) (!$user_info['active'])], $user_info['id']); } cache_del(self::table); if (is_ajax()) { no_graphics(true); echo $user_info['active'] ? 0 : 1; } else { return js_redirect(url('/@object')); } }
/** */ function active() { $_GET['id'] = intval($_GET['id']); if (!empty($_GET['id'])) { $group_info = db()->query_fetch('SELECT * FROM ' . db('user_groups') . ' WHERE id=' . intval($_GET['id'])); } if (!empty($group_info)) { db()->UPDATE('user_groups', ['active' => intval(!$group_info['active'])], 'id=' . intval($_GET['id'])); common()->admin_wall_add(['user group: ' . $group_info['name'] . ' ' . ($group_info['active'] ? 'inactivated' : 'activated'), $group_info['id']]); } cache_del(['user_groups', 'user_groups_details']); if (is_ajax()) { no_graphics(true); echo $group_info['active'] ? 0 : 1; } else { return js_redirect(url('/@object')); } }
/** */ function _cache_purge() { cache_del(['blocks_all', 'blocks_rules', 'blocks_names', 'blocks_names_user', 'blocks_names_admin']); }
/** */ function edit_var() { $_GET['id'] = trim($_GET['id']); // Try to find numeric id for the given string var if (!empty($_GET['id']) && !is_numeric($_GET['id'])) { $_GET['id'] = urldecode($_GET['id']); $var_info = db()->query_fetch('SELECT * FROM ' . db('locale_vars') . ' WHERE LOWER(REPLACE(CONVERT(value USING utf8), " ", "_")) = "' . _es($_GET['id']) . '"'); if ($var_info) { $_GET['id'] = $var_info['id']; } else { db()->insert_safe('locale_vars', ['value' => $_GET['id']]); $_GET['id'] = db()->INSERT_ID(); } } $_GET['id'] = intval($_GET['id']); $var_info = db()->query_fetch('SELECT * FROM ' . db('locale_vars') . ' WHERE id=' . intval($_GET['id'])); if (empty($var_info['id'])) { _re('No such var!', 'id'); return _e(); } $Q = db()->query('SELECT * FROM ' . db('locale_translate') . ' WHERE var_id=' . intval($var_info['id'])); while ($A = db()->fetch_assoc($Q)) { $var_tr[$A['locale']] = $A['value']; } if (is_post()) { if (!_ee()) { foreach ((array) $this->_cur_langs_array as $lang_id => $lang_info) { if (!isset($_POST[$lang_info['locale']])) { continue; } $sql_data = ['var_id' => intval($var_info['id']), 'value' => _es($_POST[$lang_info['locale']]), 'locale' => _es($lang_info['locale'])]; if (isset($var_tr[$lang_info['locale']])) { db()->UPDATE('locale_translate', $sql_data, 'var_id=' . intval($var_info['id']) . " AND locale='" . _es($lang_info["locale"]) . "'"); } else { db()->INSERT('locale_translate', $sql_data); } cache_del('locale_translate_' . $lang_info['locale']); } common()->admin_wall_add(['locale var updated: ' . $var_info['value'], $_GET['id']]); return js_redirect('/@object/show_vars'); } } foreach ((array) $this->_cur_langs_array as $lang_id => $lang_info) { // Paste default value for the english locale (if translation is absent) $tr_value = !isset($var_tr[$lang_info['locale']]) && $lang_info['locale'] == 'en' ? $var_info['value'] : $var_tr[$lang_info['locale']]; $langs[$lang_info['locale']] = ['locale' => $lang_info['locale'], 'name' => _prepare_html($lang_info['name']), 'tr_value' => _prepare_html(trim($tr_value))]; } $replace = ['form_action' => url('/@object/@action/@id'), 'back_link' => url('/@object/show_vars'), 'error_message' => _e(), 'langs' => $langs, 'var_value' => _prepare_html($var_info['value']), 'location' => $this->DISPLAY_VARS_LOCATIONS ? $this->_prepare_locations($var_info['location']) : '']; return tpl()->parse('@object/edit_var', $replace); }
/** */ function refresh_modules_list($silent = false) { // Cleanup duplicate records $q = db()->query('SELECT name, COUNT(*) AS num FROM ' . db('admin_modules') . ' GROUP BY name HAVING num > 1'); while ($a = db()->fetch_assoc($q)) { db()->query('DELETE FROM ' . db('admin_modules') . ' WHERE name="' . _es($a['name']) . '" LIMIT ' . intval($a['num'] - 1)); } $q = db()->query('SELECT * FROM ' . db('admin_modules') . ''); while ($a = db()->fetch_assoc($q)) { $all_admin_modules_array[$a['name']] = $a['name']; } $refreshed_modules = $this->_get_modules_from_files($include_framework = true, $with_sub_modules = false); $insert_data = []; foreach ((array) $refreshed_modules as $cur_module_name) { if (isset($all_admin_modules_array[$cur_module_name])) { continue; } $insert_data[$cur_module_name] = ['name' => $cur_module_name, 'active' => 0]; } if ($insert_data) { db()->insert_safe('admin_modules', $insert_data); } // Check for missing modules $delete_names = []; foreach ((array) $all_admin_modules_array as $cur_module_name) { if (!isset($refreshed_modules[$cur_module_name])) { $delete_names[$cur_module_name] = $cur_module_name; } } if ($delete_names) { db()->query('DELETE FROM ' . db('admin_modules') . ' WHERE name IN("' . implode('","', _es($delete_names)) . '")'); } cache_del(['admin_modules', 'admin_modules_for_select']); if (!$silent) { return js_redirect(url('/@object')); } }
/** * AJAX-based method edit selected tooltip */ function edit_tip() { no_graphics(true); if (!DEBUG_MODE || !tpl()->ALLOW_INLINE_DEBUG) { return print 'Access denied'; } $CUR_LOCALE = conf('language'); if (isset($_POST['text']) && isset($_POST['name'])) { $A = db()->query_fetch('SELECT * FROM ' . db('tips') . " WHERE name='" . $_POST["name"] . "' AND locale='" . $CUR_LOCALE . "'"); if (!$A) { db()->INSERT('tips', ['name' => _es($_POST['name']), 'locale' => _es($CUR_LOCALE), 'text' => _es($_POST['text']), 'type' => 1, 'active' => 1]); } else { db()->UPDATE('tips', ['text' => _es($_POST['text'])], "name='" . $_POST["name"] . "' AND locale='" . $CUR_LOCALE . "'"); } } cache_del('tips'); echo 'Saved successfully'; }
/** */ function import_vars() { if (main()->is_post()) { if (empty($_FILES['import_file']['name'])) { _re('Please select file to process', 'name'); } if (empty($_POST['file_format']) || !isset($this->_file_formats[$_POST['file_format']])) { _re('Please select file format', 'file_format'); } $cur_locale = $_POST['lang_code']; if (empty($cur_locale)) { _re('Please select language', 'lang'); } $raw_langs = $this->_get_iso639_list(); if (!isset($raw_langs[$cur_locale])) { common()->_error_exists('Wrong language code'); } if (!common()->_error_exists() && !isset($this->_cur_langs[$cur_locale])) { if (!common()->_error_exists()) { db()->INSERT('locale_langs', ['locale' => _es($cur_locale), 'name' => _es($raw_langs[$cur_locale][0]), 'charset' => _es('utf-8'), 'active' => 1, 'is_default' => 0]); $this->_create_empty_vars_for_locale($cur_locale); cache_del('locale_langs'); } } $file_format = $_POST['file_format']; $IMPORT_MODE = !empty($_POST['mode']) ? intval($_POST['mode']) : 1; if (!common()->_error_exists()) { $new_file_name = $_FILES['import_file']['name']; $new_file_path = INCLUDE_PATH . $new_file_name; move_uploaded_file($_FILES['import_file']['tmp_name'], $new_file_path); if ($file_format == 'csv') { $handle = fopen($new_file_path, 'r'); while (($data = fgetcsv($handle, 2048, ";", "\"")) !== false) { if ($i++ == 0) { continue; } // Skip header $found_vars[trim($data[0])] = trim($data[1]); } fclose($handle); } elseif ($file_format == 'xml') { $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, file_get_contents($new_file_path), $xml_values); foreach ((array) $xml_values as $k => $v) { if ($v['type'] != 'complete') { continue; } if ($v['tag'] == 'SOURCE') { $source = $v['value']; } if ($v['tag'] == 'TRANSLATION') { $translation = $v['value']; } if (!empty($source) && !empty($translation)) { $found_vars[trim($source)] = trim($translation); $source = ''; $translation = ''; } } xml_parser_free($xml_parser); } $Q = db()->query("SELECT id, " . ($this->VARS_IGNORE_CASE ? "LOWER(REPLACE(CONVERT(value USING utf8), ' ', '_'))" : "value") . " AS val FROM " . db('locale_vars') . " ORDER BY val ASC"); while ($A = db()->fetch_assoc($Q)) { $cur_vars_array[$A["id"]] = $A["val"]; } $Q = db()->query("SELECT * FROM " . db('locale_translate') . " WHERE locale = '" . _es($cur_locale) . "'"); while ($A = db()->fetch_assoc($Q)) { $cur_tr_vars[$A["var_id"]] = $A["value"]; } foreach ((array) $found_vars as $source => $translation) { $var_id = 0; if ($this->VARS_IGNORE_CASE) { $source = str_replace(' ', '_', strtolower($source)); } foreach ((array) $cur_vars_array as $cur_var_id => $cur_var_value) { if ($cur_var_value == $source) { $var_id = intval($cur_var_id); break; } } if (empty($var_id)) { db()->INSERT('locale_vars', ['value' => _es($source)]); $var_id = db()->INSERT_ID(); } $sql_array = ['var_id' => intval($var_id), 'locale' => _es($cur_locale), 'value' => _es($translation)]; if (isset($cur_tr_vars[$var_id])) { if ($IMPORT_MODE == 2 || $translation == $cur_tr_vars[$var_id]) { continue; } db()->UPDATE('locale_translate', $sql_array, 'var_id=' . intval($var_id) . ' AND locale="' . _es($cur_locale) . '"'); } else { db()->INSERT('locale_translate', $sql_array); } } unlink($new_file_path); cache_del('locale_translate_' . $cur_locale); return js_redirect('./?object=' . $_GET['object'] . '&action=show_vars'); } } if (!$_POST || common()->_error_exists()) { $replace = ['form_action' => './?object=' . $_GET['object'] . '&action=' . $_GET['action'], 'back_link' => './?object=' . $_GET['object'], 'error_message' => _e(), 'langs_box' => $this->_box('lang_code', -1), 'file_formats_box' => $this->_box('file_format', 'csv'), 'modes_box' => $this->_box('mode', 1)]; return tpl()->parse($_GET['object'] . '/import_vars', $replace); } }
/** * @internal SysAdmin cache manager: delete many event. * @attribute[RequestParam('keys','array',array())] */ function CacheDelMany($keys) { foreach ($keys as $k) { cache_del($k); } redirect('sysadmin', 'cache'); }
<?php return function () { return form((array) $_POST + ['form_action' => url('/@object/@action')])->on_post(function () { common()->message_info('on post'); })->on_before_render(function () { common()->message_info('on before render'); })->on_after_render(function () { common()->message_info('on after render'); })->on_validate_error(function () { common()->message_info('on validate error'); })->on_before_validate(function () { common()->message_info('on before validate'); })->on_after_validate(function () { common()->message_info('on after validate'); })->on_before_update(function () { common()->message_info('on before update'); })->on_after_update(function () { common()->message_info('on after update'); cache_del('forum_categories'); })->validate(['name' => 'trim|required'])->db_insert_if_ok('forum_categories', ['name', 'desc', 'order', 'status'])->text('name')->textarea('desc', 'Description')->number('order')->active_box('status')->save(); };
function member_public($run = 0) { if (intval($_GET['clear'])) { cache_del('member_public'); } $cache_data = load_cache('member_public'); $save_data = $cache_data ? $cache_data : ''; $temp_cache_data = ''; global $head_url, $header_config, $_G; if (!$_GET['submit'] || $run == 0) { $info['header'] = pick_header_output($header_config, $head_url); $info['save_data'] = $save_data; return $info; } else { if (intval($_GET['submit']) == 2) { unset($save_data); } if (!$save_data) { show_pick_info(milu_lang('start_config')); } $info = pick_common_get(); $info['reg_jump_num'] = $info['reg_jump_num'] ? $info['reg_jump_num'] : 100; $now_get = $save_data['now_get'] ? $save_data['now_get'] : 0; $start_dateline = $save_data['start_dateline'] ? $save_data['start_dateline'] : TIMESTAMP; $member_count = member_count('WHERE data_uid=0'); if (!$save_data && !$member_count) { show_pick_info(milu_lang('no_member_import_reg', array('url' => '?' . PICK_GO . 'member&myac=member_import_online&tpl=no')), 'finsh'); return FALSE; } $all_uid_count = $member_count; $get_count = $temp_cache_data['get_count'] = $save_data['get_count'] ? $save_data['get_count'] : ($info['reg_num'] && $info['reg_num'] < $all_uid_count ? $info['reg_num'] : $all_uid_count); $success_count = $save_data['success_count'] ? $save_data['success_count'] : 0; $limit_num = $info['reg_jump_num'] > $get_count ? $get_count : $info['reg_jump_num']; $query = DB::query("SELECT * FROM " . DB::table('strayer_member') . " WHERE data_uid=0 ORDER BY get_dateline DESC LIMIT 0,{$limit_num} "); while ($v = DB::fetch($query)) { show_pick_info(array(milu_lang('reg_member'), '<a>' . $v['username'] . '</a>'), 'left', array('li_no_end' => 1, 'no_border' => 1, 'now' => $now_get + 1)); $info['get_url'] = $v['url']; $v['password'] = $info['reg_pwd']; $v = get_member_setarr($v); $re = pick_reg($v); $now_get++; $pro = ceil(100 * ($success_count / $get_count)); $all_get_time = TIMESTAMP - $start_dateline; $avg_get_time = $all_get_time / $success_count; $wait_count = $get_count - $success_count; $wait_time = $avg_get_time * $wait_count; if (function_exists('php_set')) { $memory = 100 * (get_memory() / php_set('memory_limit')); $memory = $memory || $memory != 0 ? sprintf('%.0f%%', $memory) : milu_lang('un_know'); } $show_arr = array('pro' => $pro, 'wait_time' => $wait_time, 'memory' => $memory, 'wait_count' => $wait_count, 'now' => $now_get + 1); $temp_cache_data['now_get'] = $now_get; if (is_array($re)) { DB::update('strayer_member', array('public_dateline' => $_G['timestamp'], 'data_uid' => $re['uid']), array('uid' => $v['uid'])); $success_count++; $temp_cache_data['success_count'] = $success_count; $show_arr['wait_count'] = $wait_count - 1; $show_arr['pro'] = ceil(100 * ($success_count / $get_count)); show_pick_info(milu_lang('reg_finsh'), 'success', $show_arr); } else { DB::update('strayer_member', array('data_uid' => -1), array('uid' => $v['uid'])); //标记 show_pick_info($re, 'err', $show_arr); } if ($success_count == $get_count || $success_count > $get_count) { break; } $temp_cache_data['start_dateline'] = $start_dateline; if (is_int($now_get / $info['reg_jump_num']) && $now_get != 0 && $success_count < $get_count) { cache_data('member_public', $temp_cache_data, 3600); data_go('member&myac=member_public&submit=1'); exit; } } $all_get_time = TIMESTAMP - $start_dateline; $avg_get_time = $all_get_time / $success_count; if ($success_count < $get_count && $info['reg_num']) { if ($info['reg_jump_num'] > $get_count) { if (member_count('WHERE data_uid=0') > 0) { cache_data('member_public', $temp_cache_data, 3600); data_go('member&myac=member_public&submit=1'); exit; } } show_pick_info(milu_lang('no_member_reg'), 'finsh'); } $all_get_time_str = diff_time($all_get_time, 1); $all_get_time_str = $all_get_time_str ? $all_get_time_str : ceil($all_get_time) . milu_lang('sec'); $finsh_output = milu_lang('reg_over', array('n' => $now_get, 's' => $success_count, 'n_s' => $now_get - $success_count, 'all' => $all_get_time_str, 'avg' => sprintf('%.3f', $avg_get_time))); cache_del('member_public'); $show_arr['wait_count'] = $show_arr['wait_time'] = 0; $show_arr['pro'] = 100; $show_arr['memory'] = $memory; show_pick_info($finsh_output, 'finsh', $show_arr); } }
/** * 修改联动数据 */ function editLinkageData() { $db = M('linkage'); $result = $db->update() >= 0; //删除缓存分类缓存 $cache_name = 'linkage_' . $_POST['lcgid'] . '_' . $_POST['pid']; //配置缓存名称 cache_del($cache_name, $this->cache_dir . 'linkage'); //删除所有缓存 $cache_name_all = 'linkage_all_' . $_POST['lcgid']; cache_del($cache_name_all, $this->cache_dir . 'linkage'); //更新JS文件 $this->updateLinkageJs(); $success = array('修改成功!'); $error = array('修改失败!'); $this->success_error($result, $success, $error); }
DB::query('DELETE FROM ' . DB::table('strayer_category') . " WHERE cid= '{$cid}'"); cpmsg(milu_lang('op_success'), PICK_GO . "picker_manage", 'succeed'); } $info['header'] = pick_header_output($header_config, $head_url); include template('milu_pick:picker_category_del'); break; case 'pick_stop': $pid = intval($pid); $url = PICK_GO . 'picker_manage'; cpmsg(milu_lang('op_success'), $url, 'succeed'); break; case 'get_article': $info = get_pick_info(); $pid = $info['pid']; if ($_GET['clear'] || $_GET['submit'] == 2) { cache_del('pick' . $pid); } $info['save_data'] = load_cache('pick' . $pid); $info['no_check_url'] = intval($_GET['no_check_url']); $info['header'] = pick_header_output($header_config, $head_url); include template('milu_pick:get_article'); break; case 'pick_empty': if ($pid && $submit) { save_syscache('pick_run', TIMESTAMP); article_batch_del($pid); DB::query('DELETE FROM ' . DB::table('strayer_url') . " WHERE pid='{$pid}'"); $setarr = array('run_times' => 0, 'lastrun' => 0, 'nextrun' => 0); DB::update('strayer_picker', $setarr, array('pid' => $pid)); del_pick_log($pid); cpmsg(milu_lang('empty_finsh'), PICK_GO . "picker_manage", 'succeed');
/** * 添加菜单 * @param type $menu_data 菜单数据 * @return type 插入菜单的ID */ function addMenu($menu_data) { $insert_id = $this->backend_menu->insert($menu_data); cache_del('menu'); return $insert_id; }
/** * @internal Create new string handler * @attribute[RequestParam('term','string')] * @attribute[RequestParam('text','string','')] */ function CreateString($term, $text) { global $CONFIG; $data = array(array('term' => $term)); $data = json_encode($data); $res = $this->request(array('action' => 'add_terms', 'data' => $data)); if (!$res) { return AjaxResponse::Error("Could not create term: " . $this->Lasterror, true); } if ($text) { $text = urldecode($text); $data = array(array('term' => array('term' => $term), 'definition' => array('forms' => array($text), 'fuzzy' => 0))); $data = json_encode($data); $res = $this->request(array('action' => 'update_language', 'language' => $CONFIG['localization']['default_language'], 'data' => $data)); if (!$res) { return AjaxResponse::Error("Could not set initial term content: " . $this->Lasterror, true); } cache_del('lang_' . $term); } return $this->DeleteString($term); }
/** */ function _purge_caches() { cache_del(['menus', 'menu_items']); }
/** */ function active() { $a = $this->_get_info(); if (!empty($a['id'])) { $n = $a; $n['active'] = (int) (!$a['active']); module_safe('manage_revisions')->add(['object_name' => self::table, 'object_id' => $a['id'], 'old' => $a, 'new' => $n, 'action' => 'active']); db()->update(self::table, ['active' => (int) (!$a['active'])], (int) $a['id']); common()->admin_wall_add(['static page: ' . $a['name'] . ' ' . ($a['active'] ? 'inactivated' : 'activated'), $a['id']]); cache_del('static_pages_names'); } if (is_ajax()) { no_graphics(true); echo intval(!$a['active']); } else { return js_redirect(url('/@object')); } }
function _product_cache_purge($product_id = 0) { if (!$product_id) { $product_id = $_GET['id']; } cache_del('_shop_products|_product_image|' . $product_id); cache_del('_shop_product_params|_product_image|' . $product_id); cache_del('_shop_product_params|_get_params_by_product|' . $product_id); cache_del('rewrite_pattern_yf|_get_shop_product_details|' . $product_id); _class('_shop_categories', 'modules/shop/')->_refresh_cache(); }
/** * @internal Save string handler * @attribute[RequestParam('lang','string')] * @attribute[RequestParam('term','string')] * @attribute[RequestParam('text','string','')] */ function SaveString($lang, $term, $text) { $text = urldecode($text); if ($text) { $this->ds->ExecuteSql("REPLACE INTO wdf_translations(lang,id,content)VALUES(?,?,?)", array($lang, $term, $text)); } else { $this->ds->ExecuteSql("DELETE FROM wdf_translations WHERE lang=? AND id=?", array($lang, $term)); } cache_del('lang_' . $term); return AjaxResponse::None(); }
function finsh() { cache_del('pick' . $this->pid); $this->all_get_time = $this->pick_cache_data['all_get_time']; $all_get_time_str = diff_time($this->all_get_time, 1); $get_url_count = $this->i - 1; $avg_get_time = $this->all_get_time / $get_url_count; $all_get_time_str = $all_get_time_str ? $all_get_time_str : sprintf('%.2f', $this->all_get_time) . milu_lang('sec'); $finsh_output = milu_lang('pick_finsh', array('guc' => $get_url_count, 'g_v' => $get_url_count - $this->v_i, 'v_i' => $this->v_i, 'a' => $this->a, 'a_va' => $this->a - $this->v_a, 'v_a' => $this->v_a, 'all' => $all_get_time_str, 'avg' => sprintf('%.2f', $avg_get_time))); $this->get_pick_status(1); $this->status_arr['pro'] = 100; $this->status_arr['wait_time'] = $this->status_arr['wait_count'] = 0; show_pick_info($finsh_output, 'finsh', $this->status_arr); $this->words = null; $this->snoopy = null; $this->p_arr = null; exit; }