当前位置: 首页>>代码示例>>PHP>>正文


PHP delete_cache函数代码示例

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


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

示例1: main

function main()
{
    if (empty($_REQUEST['domain']) || empty($_REQUEST['page'])) {
        errback('Domain and page required.');
    }
    if ($_REQUEST['delete'] == true) {
        $count = delete($_REQUEST['domain'], $_REQUEST['page']);
        delete_cache($_REQUEST['domain'], $_REQUEST['page']);
        if (@$_REQUEST['return'] == 'text' || @$_REQUEST['callback']) {
            callback($count . ' deleted');
        } else {
            return_image($count > 0);
        }
    } else {
        errback('Really?');
    }
}
开发者ID:jdunck,项目名称:genetify,代码行数:17,代码来源:delete.php

示例2: versionUpdate

 /** Updates settings.json files from both plugins and themes
  *  ORI stands for origin, DAT for data
  *  @param {array} &$datFile - data file in /data/other/custom_settings
  *  @param {array} &$oriFile - data file that accompanies plugins/themes
  */
 public static function versionUpdate(array &$datFile, array &$oriFile)
 {
     $vDat =& $datFile['tab']['version'];
     $vOri =& $oriFile['tab']['version'];
     // convert both versions to float numbers for easy comparison
     $v1 = (double) (substr($vDat, 0, 2) . str_replace('.', '', substr($vDat, 2)));
     $v2 = (double) (substr($vOri, 0, 2) . str_replace('.', '', substr($vOri, 2)));
     // only update settings if no version in the data folder file is present or
     // if the version is older than the one included with the theme or plugin
     if (isset($vOri) && (!isset($vDat) || $v2 > $v1)) {
         $vDat = $vOri;
         if (function_exists('delete_cache')) {
             delete_cache();
         }
         // map both plugin/ theme and data file to lookup-based key arrays
         $oriS = self::mapToKeys($oriFile['settings']);
         $datS = self::mapToKeys($datFile['settings']);
         $merged = array();
         foreach ($oriS as $ori) {
             // if the setting already existed and is not a section title (those are always overwritten)
             if (array_key_exists($ori['lookup'], $datS) && $datS[$ori['lookup']]['type'] !== 'section-title') {
                 // if the type of setting has changed, overwrite the old setting completely
                 if ($ori['type'] !== $datS[$ori['lookup']]['type']) {
                     array_push($merged, $ori);
                 } else {
                     $oldVal = @$datS[$ori['lookup']]['value'];
                     $mixS = $ori;
                     $mixS['value'] = $oldVal;
                     array_push($merged, $mixS);
                 }
                 // if the setting didn't exist, just create a new one
             } else {
                 array_push($merged, $ori);
             }
         }
         $datFile['settings'] = $merged;
     }
 }
开发者ID:hatasu,项目名称:appdroid,代码行数:43,代码来源:customsettings.class.php

示例3: array

$query = array('SELECT' => 'ex_header,ex_footer', 'FROM' => "{$dbprefix}stats");
$result = $SQL->build($query);
//is there any change !
$affected = false;
while ($row = $SQL->fetch($result)) {
    $ex_header = isset($_POST['ex_header']) ? $_POST['ex_header'] : $row['ex_header'];
    $ex_footer = isset($_POST['ex_footer']) ? $_POST['ex_footer'] : $row['ex_footer'];
    //when submit !!
    if (isset($_POST['submit'])) {
        $ex_header = htmlspecialchars_decode($ex_header);
        $ex_footer = htmlspecialchars_decode($ex_footer);
        //update
        $update_query = array('UPDATE' => "{$dbprefix}stats", 'SET' => "ex_header = '" . $SQL->escape($ex_header) . "', ex_footer = '" . $SQL->escape($ex_footer) . "'");
        $SQL->build($update_query);
        if ($SQL->affected()) {
            $affected = true;
            //delete cache ..
            delete_cache('data_extra');
        }
    } else {
        $ex_header = htmlspecialchars($ex_header);
        $ex_footer = htmlspecialchars($ex_footer);
    }
}
$SQL->free($result);
//after submit
if (isset($_POST['submit'])) {
    kleeja_admin_info($affected ? $lang['EXTRA_UPDATED'] : $lang['NO_UP_CHANGE_S'], true, '', true, $action);
}
//secondary menu
$go_menu = array('he' => array('name' => $lang['ADD_HEADER_EXTRA'], 'link' => ADMIN_PATH . '?cp=extra&smt=he', 'goto' => 'he', 'current' => $current_smt == 'he'), 'fe' => array('name' => $lang['ADD_FOOTER_EXTRA'], 'link' => ADMIN_PATH . '?cp=extra&smt=fe', 'goto' => 'fe', 'current' => $current_smt == 'fe'));
开发者ID:omtim,项目名称:kleeja,代码行数:31,代码来源:extra.php

示例4: Byjs

	if(!$users->AsSquidAdministrator){die("NO PRIVS");}
	if(isset($_GET["smp-js"])){smp_js();exit;}
	if(isset($_POST["DEFAULT_CACHE_SAVE_TRUE"])){squid_cache_save_default();exit;} //toujours en premier !
	if(isset($_GET["squid-caches-status"])){squid_cache_status();exit;}
	if(isset($_POST["cachesDirectory"])){squid_cache_save();exit;}
	if(isset($_POST["rebuild-caches"])){rebuild_caches();exit;}
	if(isset($_POST["reindex-caches"])){reindex_caches();exit;}
	if(isset($_POST["cache_directory"])){add_new_disk_save();exit;}
	
	if(isset($_POST["verify-caches"])){verify_caches();exit;}
	if(isset($_GET["add-new-disk-popup"])){add_new_disk_popup();exit;}
	if(isset($_GET["button-mode"])){button_mode();exit;}
	if(isset($_GET["add-new-disk-js"])){add_new_disk_js();exit;}
	if(isset($_GET["verify-caches-logs"])){verfiy_caches_logs();exit;}
	if(isset($_GET["verify-cache-events"])){verfiy_caches_events();exit;}
	if(isset($_POST["delete-cache"])){delete_cache();exit;}
	if(isset($_POST["DisableAnyCache"])){DisableAnyCache();exit;}
	if(isset($_GET["license-explain"])){license_explain();exit;}
	
	if(isset($_POST["BackTo1CPU"])){BackTo1CPU();exit;}
	if(isset($_GET["slider-t"])){slider_t();exit;}
	if(isset($_GET["slider-results"])){slider_results();exit;}
	if(isset($_GET["Byjs"])){Byjs();exit();}
	
	page();

function Byjs(){
	$page=CurrentPageName();
	header("content-type: application/x-javascript");
	echo "YahooWin4('900','$page?DisableChecks=yes&uuid={$_GET["uuid"]}','Caches - CPU 1 -')";
	
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:30,代码来源:squid.caches32.php

示例5: array

        $arr[] = array('lang_id' => $row['lang_id'], 'word' => $row['word'], 'trans' => $transs[$row['word']]);
        //when submit
        if (isset($_POST['submit'])) {
            //del
            if ($del[$row['word']]) {
                $query_del = array('DELETE' => "{$dbprefix}lang", 'WHERE' => "word='" . $SQL->escape($row['word']) . "' AND lang_id='" . $lang_id . "'");
                $SQL->build($query_del);
            }
            //update
            $update_query = array('UPDATE' => "{$dbprefix}lang", 'SET' => "trans = '" . $SQL->escape($transs[$row['word']]) . "'", 'WHERE' => "word='" . $SQL->escape($row['word']) . "' AND lang_id='" . $lang_id . "'");
            $SQL->build($update_query);
        }
    }
    $SQL->freeresult($result);
} else {
    //no result ...
    $no_results = true;
}
//pages
$total_pages = $Pager->getTotalPages();
$page_nums = $Pager->print_nums(basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php'), 'onclick="javascript:get_kleeja_link($(this).attr(\'href\'), \'#content\'); return false;"');
//after submit
if (isset($_POST['submit'])) {
    $text = $lang['NO_UP_CHANGE_S'];
    if ($SQL->affected()) {
        delete_cache('data_lang');
        $text = $lang['WORDS_UPDATED'];
    }
    $text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . $action . '\');", 2000);</script>' . "\n";
    $stylee = "admin_info";
}
开发者ID:Saleh7,项目名称:Kleeja,代码行数:31,代码来源:o_langs.php

示例6: klj_clean_old_files

function klj_clean_old_files($from = 0)
{
    global $config, $SQL, $stat_last_f_del, $dbprefix;
    $return = false;
    ($hook = kleeja_run_hook('klj_clean_old_files_func')) ? eval($hook) : null;
    //run hook
    if ((int) $config['del_f_day'] <= 0 || $return) {
        return;
    }
    if (!$stat_last_f_del || empty($stat_last_f_del)) {
        $stat_last_f_del = time();
    }
    if (time() - $stat_last_f_del >= 86400) {
        $totaldays = time() - $config['del_f_day'] * 86400;
        $not_today = time() - 86400;
        #This feature will work only if id_form is not empty or direct !
        $query = array('SELECT' => 'f.id, f.last_down, f.name, f.type, f.folder, f.time, f.size, f.id_form', 'FROM' => "{$dbprefix}files f", 'WHERE' => "f.last_down < {$totaldays} AND f.time < {$not_today} AND f.id > {$from} AND f.id_form <> '' AND f.id_form <> 'direct'", 'ORDER BY' => 'f.id ASC', 'LIMIT' => '20');
        ($hook = kleeja_run_hook('qr_select_klj_clean_old_files_func')) ? eval($hook) : null;
        //run hook
        $result = $SQL->build($query);
        $num_of_files_to_delete = $SQL->num_rows($result);
        if ($num_of_files_to_delete == 0) {
            //update $stat_last_f_del !!
            $update_query = array('UPDATE' => "{$dbprefix}stats", 'SET' => "last_f_del ='" . time() . "'");
            ($hook = kleeja_run_hook('qr_update_lstf_del_date_kcof')) ? eval($hook) : null;
            //run hook
            $SQL->build($update_query);
            //delete stats cache
            delete_cache("data_stats");
            update_config('klj_clean_files_from', '0');
            $SQL->freeresult($result);
            return;
        }
        $last_id_from = $files_num = $imgs_num = $real_num = $sizes = 0;
        $ids = array();
        $ex_ids = array();
        //$ex_types = explode(',', $config['livexts']);
        ($hook = kleeja_run_hook('beforewhile_klj_clean_old_files_func')) ? eval($hook) : null;
        //run hook
        //phpfalcon plugin
        $exlive_types = explode(',', $config['imagefolderexts']);
        //delete files
        while ($row = $SQL->fetch_array($result)) {
            $continue = true;
            $real_num++;
            $last_id_from = $row['id'];
            $is_image = in_array(strtolower(trim($row['type'])), array('gif', 'jpg', 'jpeg', 'bmp', 'png')) ? true : false;
            /*
            //excpetions
            if(in_array($row['type'], $ex_types) || $config['id_form'] == 'direct')
            {
            	$ex_ids[] = $row['id'];
            	continue;
            }
            */
            //excpetions
            //if($config['id_form'] == 'direct')
            //{
            //$ex_ids[] = $row['id'];
            //move on
            //continue;
            //}
            //your exepctions
            ($hook = kleeja_run_hook('while_klj_clean_old_files_func')) ? eval($hook) : null;
            //run hook
            //phpfalcon plugin
            if (in_array($row['type'], $exlive_types)) {
                $ex_ids[] = $row['id'];
                if ($real_num != $num_of_files_to_delete) {
                    $continue = false;
                }
            }
            if ($continue) {
                //delete from folder ..
                if (file_exists($row['folder'] . "/" . $row['name'])) {
                    @kleeja_unlink($row['folder'] . "/" . $row['name']);
                }
                //delete thumb
                if (file_exists($row['folder'] . "/thumbs/" . $row['name'])) {
                    @kleeja_unlink($row['folder'] . "/thumbs/" . $row['name']);
                }
                $ids[] = $row['id'];
                if ($is_image) {
                    $imgs_num++;
                } else {
                    $files_num++;
                }
                $sizes += $row['size'];
            }
        }
        #END WHILE
        $SQL->freeresult($result);
        if (sizeof($ex_ids)) {
            $update_query = array('UPDATE' => "{$dbprefix}files", 'SET' => "last_down = '" . (time() + 2 * 86400) . "'", 'WHERE' => "id IN (" . implode(',', $ex_ids) . ")");
            ($hook = kleeja_run_hook('qr_update_lstdown_old_files')) ? eval($hook) : null;
            //run hook
            $SQL->build($update_query);
        }
        if (sizeof($ids)) {
            $query_del = array('DELETE' => "{$dbprefix}files", 'WHERE' => "id IN (" . implode(',', $ids) . ")");
//.........这里部分代码省略.........
开发者ID:Saleh7,项目名称:Kleeja,代码行数:101,代码来源:functions.php

示例7: update_config

function update_config($name, $value = '', $escape = true, $group = false)
{
    global $SQL, $dbprefix, $d_groups, $user, $plugin;
    $value = $escape ? $SQL->escape($value) : $value;
    $table = "{$dbprefix}config";
    #what if this config is a group-configs related ?
    $group_id_sql = '';
    if (array_key_exists($name, $d_groups[$user->data['group_id']]['configs'])) {
        $table = "{$dbprefix}groups_data";
        if ($group == -1) {
            $group_id_sql = ' AND group_id=' . $userinfo['group_id'];
        } else {
            if ($group) {
                $group_id_sql = ' AND group_id=' . intval($group);
            }
        }
    }
    $update_query = array('UPDATE' => $table, 'SET' => "value='" . ($escape ? $SQL->escape($value) : $value) . "'", 'WHERE' => 'name = "' . $SQL->escape($name) . '"' . $group_id_sql);
    ($hook = $plugin->run_hook('update_sql_update_config_func')) ? eval($hook) : null;
    //run hook
    $SQL->build($update_query);
    if ($SQL->affected()) {
        if ($table == "{$dbprefix}groups_data") {
            $d_groups[$userinfo['group_id']]['configs'][$name] = $value;
            delete_cache('data_groups');
            return true;
        }
        $config[$name] = $value;
        delete_cache('data_config');
        return true;
    }
    return false;
}
开发者ID:omtim,项目名称:kleeja,代码行数:33,代码来源:functions.php

示例8: kleeja_add_form_key

$affected = false;
$H_FORM_KEYS = kleeja_add_form_key('adm_ban');
//
// Check form key
//
if (isset($_POST['submit'])) {
    if (!kleeja_check_form_key('adm_ban')) {
        kleeja_admin_err($lang['INVALID_FORM_KEY'], true, $lang['ERROR'], true, $action, 1);
    }
}
$query = array('SELECT' => 'ban', 'FROM' => "{$dbprefix}stats");
$result = $SQL->build($query);
while ($row = $SQL->fetch_array($result)) {
    $ban = isset($_POST["ban_text"]) ? htmlspecialchars($_POST['ban_text']) : $row['ban'];
    //when submit
    if (isset($_POST['submit'])) {
        //update
        $update_query = array('UPDATE' => "{$dbprefix}stats", 'SET' => "ban='" . $SQL->escape($ban) . "'");
        $SQL->build($update_query);
        if ($SQL->affected()) {
            $affected = true;
            delete_cache('data_ban');
        }
    }
}
$SQL->freeresult($result);
//after submit
if (isset($_POST['submit'])) {
    $text = ($affected ? $lang['BAN_UPDATED'] : $lang['NO_UP_CHANGE_S']) . '<meta HTTP-EQUIV="REFRESH" content="0; url=' . basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php') . '">' . "\n";
    $stylee = "admin_info";
}
开发者ID:Amine12boutouil,项目名称:Kleeja-2.0.0-alpha,代码行数:31,代码来源:k_ban.php

示例9: sprintf

                if (version_compare(strtolower(KLEEJA_VERSION), strtolower($version_data), '>')) {
                    $text = sprintf($lang['UPDATE_NOW_S'], KLEEJA_VERSION, strtolower($version_data)) . '<br /><br />' . $lang['UPDATE_KLJ_NOW'];
                }
            }
        }
        #lets decode it
        $v = @unserialize($config['new_version']);
        #To prevent expected error [ infinit loop ]
        if (isset($_GET['show_msg'])) {
            $query_get = array('SELECT' => '*', 'FROM' => "{$dbprefix}config", 'WHERE' => "name = 'new_version'");
            $result_get = $SQL->build($query_get);
            if (!$SQL->num($result_get)) {
                //add new config value
                add_config('new_version', '');
            }
        }
        $data = array('version_number' => $version_data, 'last_check' => time(), 'msg_appeared' => isset($_GET['show_msg']) ? true : false, 'copyrights' => !empty($b_data[1]) && strpos($b_data[1], 'yes') !== false ? true : false);
        $data = serialize($data);
        update_config('new_version', $SQL->escape($data), false);
        delete_cache('data_config');
    }
    //then go back  to start
    if (isset($_GET['show_msg'])) {
        redirect(ADMIN_PATH . '?update_done=1');
        $SQL->close();
        exit;
    }
    #end current_smt == general
}
//secondary menu
$go_menu = array('general' => array('name' => $lang['R_CHECK_UPDATE'], 'link' => ADMIN_PATH . '?cp=check_update&amp;smt=general', 'goto' => 'general', 'current' => $current_smt == 'general'), 'howto' => array('name' => $lang['HOW_UPDATE_KLEEJA'], 'link' => ADMIN_PATH . '?cp=check_update&amp;smt=howto', 'goto' => 'howto', 'current' => $current_smt == 'howto'), 'site' => array('name' => 'Kleeja.com', 'link' => ADMIN_PATH . '?cp=check_update&amp;smt=site', 'goto' => 'site', 'current' => $current_smt == 'site'));
开发者ID:omtim,项目名称:kleeja,代码行数:31,代码来源:check_update.php

示例10: saveit

 function saveit($filname, $folderee, $sizeee, $typeee, $real_filename = '')
 {
     global $SQL, $dbprefix, $config, $lang;
     // sometime cant see file after uploading.. but ..
     @chmod($folderee . '/' . $filname, 0644);
     //0644
     $name = (string) $SQL->escape($filname);
     $size = (int) $sizeee;
     $type = (string) strtolower($SQL->escape($typeee));
     $folder = (string) $SQL->escape($folderee);
     $timeww = (int) time();
     $user = (int) $this->id_user;
     $code_del = (string) md5(time());
     $ip = get_ip();
     $realf = (string) $SQL->escape($real_filename);
     $insert_query = array('INSERT' => '`name` ,`size` ,`time` ,`folder` ,`type`,`user`,`code_del`,`user_ip`, `real_filename`', 'INTO' => "`{$dbprefix}files`", 'VALUES' => "'{$name}', '{$size}', '{$timeww}', '{$folder}','{$type}', '{$user}', '{$code_del}', '{$ip}', '{$realf}'");
     ($hook = kleeja_run_hook('qr_insert_new_file_kljuploader')) ? eval($hook) : null;
     //run hook
     $SQL->build($insert_query);
     $this->name_for_url = $name;
     $this->id_for_url = $SQL->insert_id();
     //calculate stats ..s
     $update_query = array('UPDATE' => "{$dbprefix}stats", 'SET' => "`files`=files+1,`sizes`=sizes+" . $size . ",`last_file`='" . $folder . "/" . $name . "'");
     ($hook = kleeja_run_hook('qr_update_no_files_kljuploader')) ? eval($hook) : null;
     //run hook
     $SQL->build($update_query);
     //delete cache of stats !
     delete_cache('data_stats');
     //inforantion of file
     $file_info = array('::ID::' => $this->id_for_url, '::NAME::' => $this->name_for_url, '::DIR::' => $folderee, '::FNAME::' => $realf);
     //show del code link
     $extra_del = '';
     if ($config['del_url_file']) {
         $extra_del = get_up_tpl_box('del_file_code', array('b_title' => $lang['URL_F_DEL'], 'b_code_link' => kleeja_get_link('del', array('::CODE::' => $code_del))));
     }
     //show imgs
     if (in_array(strtolower($this->typet), array('png', 'gif', 'jpg', 'jpeg', 'tif', 'tiff'))) {
         //make thumbs
         $img_html_result = '';
         if ($config['thumbs_imgs'] != 0 && in_array(strtolower($this->typet), array('png', 'jpg', 'jpeg', 'gif'))) {
             list($thmb_dim_w, $thmb_dim_h) = @explode('*', $config['thmb_dims']);
             $this->createthumb($folderee . '/' . $filname, strtolower($this->typet), $folderee . '/thumbs/' . $filname, $thmb_dim_w, $thmb_dim_h);
             $img_html_result .= get_up_tpl_box('image_thumb', array('b_title' => $lang['URL_F_THMB'], 'b_url_link' => kleeja_get_link('image', $file_info), 'b_img_link' => kleeja_get_link('thumb', $file_info)));
         }
         //write on image
         if ($config['write_imgs'] != 0 && in_array(strtolower($this->typet), array('gif', 'png', 'jpg', 'jpeg'))) {
             $this->watermark($folderee . "/" . $filname, strtolower($this->typet));
         }
         //then show
         $img_html_result .= get_up_tpl_box('image', array('b_title' => $lang['URL_F_IMG'], 'b_bbc_title' => $lang['URL_F_BBC'], 'b_url_link' => kleeja_get_link('image', $file_info)));
         $img_html_result .= $extra_del;
         ($hook = kleeja_run_hook('saveit_func_img_res_kljuploader')) ? eval($hook) : null;
         //run hook
         $this->total++;
         $this->errs[] = array($lang['IMG_DOWNLAODED'] . '<br />' . $img_html_result, 'index_info');
     } else {
         //then show other files
         $else_html_result = get_up_tpl_box('file', array('b_title' => $lang['URL_F_FILE'], 'b_bbc_title' => $lang['URL_F_BBC'], 'b_url_link' => kleeja_get_link('file', $file_info)));
         $else_html_result .= $extra_del;
         ($hook = kleeja_run_hook('saveit_func_else_res_kljuploader')) ? eval($hook) : null;
         //run hook
         $this->total++;
         $this->errs[] = array($lang['FILE_DOWNLAODED'] . '<br />' . $else_html_result, 'index_info');
     }
     ($hook = kleeja_run_hook('saveit_func_kljuploader')) ? eval($hook) : null;
     //run hook
     if (isset($_POST['submitr'])) {
         if (isset($_SESSION['FIILES_NOT_DUPLI'])) {
             unset($_SESSION['FIILES_NOT_DUPLI']);
         }
         $_SESSION['FIILES_NOT_DUPLI'] = $_FILES;
     } elseif (isset($_POST['submittxt'])) {
         if (isset($_SESSION['FIILES_NOT_DUPLI_LINKS'])) {
             unset($_SESSION['FIILES_NOT_DUPLI_LINKS']);
         }
         $_SESSION['FIILES_NOT_DUPLI_LINKS'] = $_POST;
     }
     unset($filename, $folderee, $sizeee, $typeee);
     //unset ($_SESSION['NO_UPLOADING_YET']);
 }
开发者ID:Amine12boutouil,项目名称:Kleeja-2.0.0-alpha,代码行数:80,代码来源:KljUploader.php

示例11: export_database

 /**
  * 数据库导出方法
  */
 private function export_database($sizelimit, $action, $fileid, $random, $tableid, $startfrom)
 {
     set_time_limit(0);
     $fileid = $fileid != '' ? $fileid : 1;
     $c_data = get_cache('bakup_tables');
     $tables = $c_data['tables'];
     $time = $c_data['time'];
     if (empty($tables)) {
         $this->show_message('数据缓存不存在,请重新选择备份');
     }
     if ($fileid == 1) {
         $random = mt_rand(1000, 9999);
     }
     $tabledump = '';
     $tableid = $tableid != '' ? $tableid : 0;
     $startfrom = $startfrom != '' ? intval($startfrom) : 0;
     for ($i = $tableid; $i < count($tables) && strlen($tabledump) < $sizelimit * 1000; $i++) {
         $offset = 100;
         if (!$startfrom) {
             $tabledump .= "DROP TABLE IF EXISTS `{$tables[$i]}`;\n";
             $createtable = $this->db->query("SHOW CREATE TABLE `{$tables[$i]}` ")->fetchAll();
             $tabledump .= $createtable[0]['Create Table'] . ";\n\n";
             $tabledump = preg_replace("/(DEFAULT)*\\s*CHARSET=[a-zA-Z0-9]+/", "DEFAULT CHARSET=utf8", $tabledump);
         }
         $numrows = $offset;
         while (strlen($tabledump) < $sizelimit * 1000 && $numrows == $offset) {
             $sql = "SELECT * FROM `{$tables[$i]}` LIMIT {$startfrom}, {$offset}";
             $fields_data = $this->db->query("SHOW COLUMNS FROM `{$tables[$i]}`")->fetchAll();
             $rows = $this->db->query($sql)->fetchAll();
             $numfields = count($fields_data);
             $numrows = count($rows);
             $fields_name = array();
             foreach ($fields_data as $r) {
                 $fields_name[$r['Field']] = $r['Type'];
             }
             $name = array_keys($fields_name);
             if ($rows) {
                 foreach ($rows as $row) {
                     $comma = "";
                     $tabledump .= "INSERT INTO `{$tables[$i]}` VALUES(";
                     for ($j = 0; $j < $numfields; $j++) {
                         $tabledump .= $comma . "'" . mysql_escape_string($row[$name[$j]]) . "'";
                         $comma = ",";
                     }
                     $tabledump .= ");\n";
                 }
             }
             $startfrom += $offset;
         }
         $tabledump .= "\n";
         $startfrom = $numrows == $offset ? $startfrom : 0;
     }
     $i = $startfrom ? $i - 1 : $i;
     $dir = DATA_DIR . 'bakup' . DIRECTORY_SEPARATOR;
     if (!is_dir($dir)) {
         mkdir($dir, 0777);
         file_put_contents($dir . 'index.html', '');
     }
     $bakfile_path = $dir . DIRECTORY_SEPARATOR . $time . DIRECTORY_SEPARATOR;
     if (trim($tabledump)) {
         $tabledump = "# xiaocms bakfile\n# version:xiaocms x1 \n# time:" . date('Y-m-d H:i:s') . "\n# http://www.xiaocms.com\n# ----------------------------------------\n\n\n" . $tabledump;
         $tableid = $i;
         $filename = 'xiaocmstables_' . date('Ymd') . '_' . $random . '_' . $fileid . '.sql';
         $altid = $fileid;
         $fileid++;
         if (!is_dir($bakfile_path)) {
             mkdir($bakfile_path, 0777);
         }
         $bakfile = $bakfile_path . $filename;
         file_put_contents($bakfile, $tabledump);
         @chmod($bakfile, 0777);
         $url = url('database/index', array('size' => $sizelimit, 'action' => $action, 'fileid' => $fileid, 'random' => $random, 'tableid' => $tableid, 'startfrom' => $startfrom));
         $this->show_message("备份{$filename}", 1, $url, 100);
     } else {
         file_put_contents($bakfile_path . 'index.html', '');
         delete_cache('bakup_tables');
         $this->show_message("备份完成", 1, url('database/index'));
     }
 }
开发者ID:43431655,项目名称:qizhongbao,代码行数:82,代码来源:database.php

示例12: delete_ch_tpl

 /**
  * delete any content from any template , this will used in plugins
  * used in unistall tag at plugin xml file
  *
  * todo : use file handler, require ftp info at uninstalling
  */
 function delete_ch_tpl($template_name, $delete_txt = array())
 {
     global $dbprefix, $lang, $config, $STYLE_PATH_ADMIN, $STYLE_PATH, $THIS_STYLE_PATH;
     if (is_array($template_name)) {
         foreach ($template_name as $tn) {
             $this->delete_ch_tpl($tn, $delete_txt);
         }
         return;
     }
     $style_path = substr($template_name, 0, 6) == 'admin_' ? $STYLE_PATH_ADMIN : $THIS_STYLE_PATH;
     $is_admin_template = substr($template_name, 0, 6) == 'admin_' ? true : false;
     //if template not found and default style is there and not admin tpl
     $template_path = $style_path . $template_name . '.html';
     if (!file_exists($template_path)) {
         if ($config['style'] != 'default' && !$is_admin_template) {
             $template_path_alternative = str_replace('/' . $config['style'] . '/', '/default/', $template_path);
             if (file_exists($template_path_alternative)) {
                 $template_path = $template_path_alternative;
             }
         }
     }
     if (file_exists($template_path)) {
         $d_contents = file_get_contents($template_path);
     } else {
         $d_contents = '';
     }
     include_once "s_strings.php";
     $finder = new sa_srch();
     $finder->find_word = $delete_txt;
     $finder->another_word = '<!-- deleted ' . md5(implode(null, $delete_txt)) . ' -->';
     $finder->text = trim($d_contents);
     $finder->do_search(2);
     $cached_instructions = array();
     if ($d_contents != '' && md5($finder->text) != md5($d_contents) && is_writable($style_path)) {
         //update
         $this->f->_write($style_path . $template_name . '.html', $finder->text);
         //delete cache ..
         delete_cache('tpl_' . $template_name);
     } else {
         $cached_instructions[$template_name] = array('action' => 'replace_with', 'find' => $finder->find_word[0] . '(.*?)' . $finder->find_word[1], 'action_text' => $finder->another_word);
     }
     //add cached instuctions to cache if there
     if (sizeof($cached_instructions) > 0) {
         //fix
         if (file_exists(PATH . 'cache/styles_cached.php')) {
             $cached_content = file_get_contents(PATH . 'cache/styles_cached.php');
             $cached_content = kleeja_base64_decode($cached_content);
             $cached_content = unserialize($cached_content);
             $cached_instructions += $cached_content;
         }
         $filename = @fopen(PATH . 'cache/styles_cached.php', 'w');
         fwrite($filename, kleeja_base64_encode(serialize($cached_instructions)));
         fclose($filename);
     }
     if ($this->f_method === 'zfile') {
         if ($this->f->check()) {
             $this->zipped_files = $this->f->push($plugin_name);
         }
     }
     return true;
 }
开发者ID:Amine12boutouil,项目名称:Kleeja-2.0.0-alpha,代码行数:67,代码来源:plugins.php

示例13: delete_data_id

 public function delete_data_id($data_id)
 {
     list($hash, $storage_id) = explode("-", $data_id);
     $this->db->where('id', $storage_id)->delete('file_storage');
     if (file_exists($this->file($data_id))) {
         unlink($this->file($data_id));
     }
     $dir = $this->folder($data_id);
     if (file_exists($dir)) {
         if (count(scandir($dir)) == 2) {
             rmdir($dir);
         }
     }
     delete_cache("{$data_id}_thumb_150");
 }
开发者ID:Anon215,项目名称:filebin,代码行数:15,代码来源:mfile.php

示例14: array

         $insert_query = array('INSERT' => 'ext ,group_id, size', 'INTO' => "{$dbprefix}groups_exts", 'VALUES' => "'{$new_ext}', {$req_group}, {$default_size}");
         $SQL->build($insert_query);
         #done
         $ADDED_EXT = $GE_INFO = 2;
         delete_cache('data_groups');
     }
     #if submit/update
     if (isset($_POST['editexts'])) {
         $ext_ids = $_POST['size'];
         if (is_array($ext_ids)) {
             foreach ($ext_ids as $e_id => $e_val) {
                 $update_query = array('UPDATE' => "{$dbprefix}groups_exts", 'SET' => "size=" . intval($e_val) * 1024, 'WHERE' => "ext_id=" . intval($e_id) . " AND group_id=" . $req_group);
                 $SQL->build($update_query);
             }
             #delete cache ..
             delete_cache('data_groups');
             kleeja_admin_info($lang['UPDATED_EXTS'], true, '', true, $action);
         }
     }
     #show exts
     $query = array('SELECT' => 'ext_id, ext, size', 'FROM' => "{$dbprefix}groups_exts", 'WHERE' => 'group_id=' . $req_group, 'ORDER BY' => 'ext_id ASC');
     $result = $SQL->build($query);
     $exts = array();
     while ($row = $SQL->fetch($result)) {
         $exts[] = array('ext_id' => $row['ext_id'], 'ext_name' => $row['ext'], 'ext_size' => round((int) $row['size'] / 1024), 'ext_icon' => file_exists(PATH . "images/filetypes/" . $row['ext'] . ".png") ? PATH . "images/filetypes/" . $row['ext'] . ".png" : PATH . 'images/filetypes/file.png');
     }
     $SQL->free($result);
     break;
     #show users (from search keyword)
 #show users (from search keyword)
 case 'show_su':
开发者ID:omtim,项目名称:kleeja,代码行数:31,代码来源:users.php

示例15: ch_g

$gr_exts_arr = ch_g('new_ext_group', 9);
//after submit
if (isset($_POST['submit'])) {
    if (!is_array($_POST['gsz'])) {
        $_POST['gsz'] = array();
    }
    $affected = false;
    foreach ($_POST['gsz'] as $n => $v) {
        $update_query = array('UPDATE' => "{$dbprefix}exts", 'SET' => "gust_size = '" . round(intval($_POST['gsz'][$n]) * 1024) . "', " . "gust_allow = '" . (isset($_POST['gal'][$n]) ? 1 : 0) . "', " . "user_size = '" . round(intval($_POST['usz'][$n]) * 1024) . "', " . "user_allow = '" . (isset($_POST['ual'][$n]) ? 1 : 0) . "'", 'WHERE' => "id=" . intval($n));
        $SQL->build($update_query);
        if ($SQL->affected()) {
            $affected = true;
        }
    }
    //delete cache ..
    delete_cache('data_exts');
    $text = ($affected ? $lang['UPDATED_EXTS'] : $lang['NO_UP_CHANGE_S']) . '<meta HTTP-EQUIV="REFRESH" content="2; url=' . basename(ADMIN_PATH) . '?cp=' . basename(__FILE__, '.php') . '&amp;page=' . (isset($_GET['page']) ? intval($_GET['page']) : '1') . '">' . "\n";
    $stylee = "admin_info";
} else {
    if (isset($_GET['add_new_ext'])) {
        $new_ext_i = $SQL->escape($_POST['new_ext']);
        $ext_gr_i = intval($_POST['new_ext_group']);
        $ext_gr_i = $ext_gr_i == 0 ? 9 : $ext_gr_i;
        //default
        $gust_size = '1024000';
        //1 mega
        $user_size = '1024000';
        //1 mega
        if (empty($new_ext_i)) {
            $text = $lang['EMPTY_EXT_FIELD'];
            $stylee = 'admin_info';
开发者ID:Amine12boutouil,项目名称:Kleeja-2.0.0-alpha,代码行数:31,代码来源:i_exts.php


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