public function profile() { $this->load->helper('file'); $this->data['avatars'] = get_dir_file_info('../public/admin/avatars', FALSE); $this->data['admin'] = $this->data['user_info']; $this->load->view('index/profile', $this->data); }
/** * Create Database * * Creates database tables and fields. * * @access public * @return bool */ function create() { /** * This is a dirty hack. * * SQLite doesn't support database listing as each * database is a different file. * * The code below gets file information from the root * directory and looks at the filesize of "database.db". * * If "database.db" has a filesize of 0 (i.e. it * has not been written to) private functions setup * the database. */ $this->load->helper('file'); $this->load->helper('error'); $info = get_dir_file_info('./', $top_level_only = true); if ($info['db.sqlite3']['size'] > 0) { // Database is already setup return error('Database was already setup'); } else { $this->_create_posts(); $this->_create_sitemap(); return true; } }
function get_languages() { $theme_folders = get_dir_file_info(dirname(dirname(__FILE__)).'/language'); //unset($la_folders[$this->get('admin_theme')]); unset($theme_folders['index.html']); return $theme_folders; }
public function getNewImages() { $this->CI->load->helper(array('file', 'gallery')); $this->CI->load->model('photo_model'); $exif_availabale = is_exif_available(); $files = get_dir_file_info($this->CI->config->item('image_dir', 'gallery'), true); $i = 0; $images = array(); $photos = $this->CI->photo_model->getFilenames(); foreach($files as $file) { $fn = $file['name']; if(!in_array($fn, $photos) && preg_match('/\.jpg/i', $fn)) { if($exif_availabale) { $images[$i]['exif'] = exif_read_data($this->CI->config->item('image_folder', 'gallery').$fn); } $images[$i]['filename'] = $fn; $i++; } } return $images; }
public function restore($sqlfile = '') { $data['title'] = '数据库还原'; $data['act'] = $this->uri->segment(3); $data['sqlfiles'] = get_dir_file_info(FCPATH . 'data/db', $top_level_only = TRUE); //echo var_dump($data['sqlfiles']); if ($_POST) { $sqlfiles = array_slice($this->input->post(), 0, -1); //echo var_export($sqlfiles); foreach ($sqlfiles as $k => $v) { unlink(FCPATH . 'data/db/' . $v); } $this->session->set_flashdata('error', '删除sql文件成功!'); redirect('admin/db_admin/restore'); } if ($sqlfile) { $sql = file_get_contents(FCPATH . 'data/db/' . $sqlfile); if ($this->run_sql($sql)) { $this->session->set_flashdata('error', '还原sql文件成功!'); redirect('admin/db_admin/restore'); } } $data['csrf_name'] = $this->security->get_csrf_token_name(); $data['csrf_token'] = $this->security->get_csrf_hash(); $this->load->view('db_admin', $data); }
public function backups() { // Get a list of existing backup files $this->load->helper('file'); Template::set('backups', get_dir_file_info($this->backup_folder)); Template::set('toolbar_title', lang('db_database_backups')); Template::render(); }
function banner() { $banners = get_dir_file_info('./images/banners', TRUE); $banners = array_values($banners); $count = count($banners); $i = rand(0, $count - 1); return $banners[$i]['name']; }
function check_is_install_folder_exist() { if (get_dir_file_info('./application/modules/install')) { return true; } else { return false; } }
function index() { $this->load->helper('file'); $this->load->helper('inflector'); $data->page_name = 'Options'; $theme_folder = get_dir_file_info(BASEPATH . 'application/views/themes', FALSE, TRUE); foreach ($theme_folder as $key => $value) { if (is_dir(BASEPATH . 'application/views/themes/' . $key)) { $themes[$key]->folder = $key; $themes[$key]->name = humanize($key); } } $data->themes = $themes; if ($_POST) { $this->load->library('validation'); $fields['lifestream_title'] = 'Lifestream Title'; $fields['admin_email'] = 'Admin Email'; $fields['new_password'] = '******'; $fields['new_password_confirm'] = 'New Password Confirm'; $fields['per_page'] = 'Items Per Page'; $this->validation->set_fields($fields); $rules['lifestream_title'] = "trim|required"; $rules['admin_email'] = "trim|required|valid_email"; $rules['new_password'] = "******"; $rules['new_password_confirm'] = "trim"; $rules['per_page'] = "numeric"; $this->validation->set_rules($rules); if ($this->validation->run() == FALSE) { $data->errors = $this->validation->error_string; $this->load->view('admin/_header', $data); $this->load->view('admin/options', $data); $this->load->view('admin/_footer'); } else { //set new password if required if ($this->validation->new_password && $this->validation->new_password != '') { $password = md5($this->validation->new_password); $this->db->update('users', array('user_pass' => $password), array('ID' => $this->data->user->ID)); } //set admin email $this->db->update('users', array('user_email' => $this->validation->admin_email), array('ID' => $this->data->user->ID)); unset($_POST['new_password']); unset($_POST['new_password_confirm']); //save options foreach ($_POST as $key => $value) { $option_array[$key]->option_name = $key; $option_array[$key]->option_value = $value; } foreach ($option_array as $option) { $this->option_model->add_option($option); } header('Location: ' . $this->config->item('base_url') . 'admin/options'); } } else { $this->load->view('admin/_header', $data); $this->load->view('admin/options', $data); $this->load->view('admin/_footer'); } }
public function __construct() { $this->class =& get_instance(); $this->class->load->helper("file"); $m = get_dir_file_info(APPPATH . "models/", false); $c = get_dir_file_info(APPPATH . "controllers/", false); $this->model_ = $this->SetWrite($m, "models\\"); $this->controller_ = $this->SetWrite($c, "controllers\\"); }
protected function importar_data() { $ruta = "//199.69.69.93\\interfaces_cedentes\\Cargas Procesos\\APLICACIONES\\UVM_CARSIT\\ENTRADA"; $listado = get_dir_file_info($ruta); foreach ($listado as $key => $value) { $r = $listado[$key]; $this->data[$r["name"]] = load_file($r["server_path"], null, "dia"); } }
function up() { // fix the fuckup from version 0.7 caching comic entries $all_files = get_dir_file_info('content/comics', FALSE); if (is_array($all_files)) { foreach ($all_files as $key => $file) { if (strtolower(substr($file["name"], -4) == ".zip")) { // remove every zip unlink($file["relative_path"] . $file["name"]); } } } // remove also all the database entries $this->db->query("TRUNCATE TABLE `" . $this->db->dbprefix('archives') . "`"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('archives') . "` ADD INDEX ( `size` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('archives') . "` ADD INDEX ( `chapter_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('archives') . "` CHANGE `edited` `updated` DATETIME NOT NULL"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `comic_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `team_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `joint_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `chapter` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `subchapter` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `volume` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `language` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `stub` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `uniqid` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('chapters') . "` ADD INDEX ( `updated` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('comics') . "` ADD INDEX ( `stub` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('comics') . "` ADD INDEX ( `uniqid` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('comics') . "` ADD INDEX ( `hidden` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('comics') . "` ADD INDEX ( `created` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('joints') . "` ADD INDEX ( `joint_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('joints') . "` ADD INDEX ( `team_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('licenses') . "` ADD INDEX ( `comic_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('licenses') . "` ADD INDEX ( `nation` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` ADD INDEX ( `team_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` ADD INDEX ( `user_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` ADD INDEX ( `is_leader` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` ADD INDEX ( `accepted` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` ADD INDEX ( `requested` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` ADD INDEX ( `applied` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` ADD INDEX ( `created` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` CHANGE `edited` `updated` DATETIME NOT NULL"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('memberships') . "` ADD INDEX ( `updated` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('profiles') . "` ADD INDEX ( `user_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('profiles') . "` ADD INDEX ( `group_id` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('teams') . "` ADD INDEX ( `name` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('teams') . "` ADD INDEX ( `stub` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('teams') . "` ADD INDEX ( `created` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('teams') . "` ADD INDEX ( `updated` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('users') . "` ADD INDEX ( `username` )"); $this->db->query("ALTER TABLE `" . $this->db->dbprefix('users') . "` ADD INDEX ( `created` )"); //create a new field in chapters for the custom chapter titles $this->db->query("ALTER TABLE `" . $this->db->dbprefix('comics') . "` ADD `customchapter` VARCHAR( 32 ) NOT NULL AFTER `thumbnail`"); }
function list_items($limit = null, $offset = 0, $col = 'name', $order = 'asc') { $CI =& get_instance(); $CI->load->helper('array'); $CI->load->helper('convert'); if (!isset($this->filters['group_id'])) { return array(); } $group_id = $this->filters['group_id']; // not encoded yet... then decode if (!$this->_encoded) { $this->filters['group_id'] = uri_safe_encode($group_id); // to pass the current folder $this->_encoded = TRUE; } else { $group_id = uri_safe_decode($group_id); } $asset_dir = $this->get_dir($group_id); $assets_path = $CI->asset->assets_server_path . $asset_dir . DIRECTORY_SEPARATOR; $tmpfiles = directory_to_array($assets_path, TRUE, $CI->config->item('assets_excluded_dirs', 'fuel'), FALSE); $files = get_dir_file_info($assets_path, TRUE); $cnt = count($tmpfiles); $return = array(); $asset_type_path = WEB_PATH . $CI->config->item('assets_path') . $asset_dir . '/'; //for ($i = $offset; $i < $cnt - 1; $i++) for ($i = 0; $i < $cnt; $i++) { if (!empty($tmpfiles[$i]) && !empty($files[$tmpfiles[$i]])) { $key = $tmpfiles[$i]; if (empty($this->filters['name']) || !empty($this->filters['name']) && (strpos($files[$key]['name'], $this->filters['name']) !== FALSE || strpos($key, $this->filters['name']) !== FALSE)) { $file['id'] = uri_safe_encode(assets_server_to_web_path($files[$tmpfiles[$i]]['server_path'], TRUE)); //$file['filename'] = $files[$key]['name']; $file['name'] = $key; $file['preview/kb'] = $files[$key]['size']; $file['link'] = NULL; $file['last_updated'] = english_date($files[$key]['date'], true); $return[] = $file; } } } $return = array_sorter($return, $col, $order, TRUE); // do a check for empty limit values to prevent issues found where an empty $limit value would return nothing in 5.16 $return = empty($limit) ? array_slice($return, $offset) : array_slice($return, $offset, $limit); // after sorting add the images foreach ($return as $key => $val) { if (is_image_file($return[$key]['name'])) { $return[$key]['preview/kb'] = $return[$key]['preview/kb'] . ' kb <div class="img_crop"><a href="' . $asset_type_path . $return[$key]['name'] . '" target="_blank"><img src="' . $asset_type_path . $return[$key]['name'] . '" border="0"></a></div>'; $return[$key]['link'] = '<a href="' . $asset_type_path . $return[$key]['name'] . '" target="_blank">' . $asset_dir . '/' . $return[$key]['name'] . '</a>'; } else { $return[$key]['preview/kb'] = $return[$key]['preview/kb']; $return[$key]['link'] = '<a href="' . $asset_type_path . $return[$key]['name'] . '" target="_blank">' . $asset_dir . '/' . $return[$key]['name'] . '</a>'; } } return $return; }
public function index() { $this->load->library('inc'); $this->load->helper('my'); $this->load->helper('file'); $this->load->model('sys_db_m'); $data['js'] = array('system/sys_db_restore.js'); $data['Menus'] = $this->inc->getMenuAdmin($this); $data['file'] = get_dir_file_info($this->config->config['backup'], false); $this->inc->adminView($this, 'system/db/restore/index', $data); }
public function database_backup() { $this->data['ignore_tabls'] = $this->ignore_tabls; $this->data['items'] = $this->db->list_tables(); $this->load->helper('file'); $files = get_dir_file_info('./db_backup', TRUE); //只遍历一层 unset($files['index.html']); $this->data['files'] = $files; $this->load->view('tools/database_backup', $this->data); }
public function index() { $this->Purview_model->checkPurview($this->tablefunc); $func = ''; $isdel = $this->Purview_model->checkPurviewFunc($this->tablefunc, 'del'); $isgenerate = $this->Purview_model->checkPurviewFunc($this->tablefunc, 'generate'); $func .= $isgenerate ? $this->Purview_model->getOtherFunc('submitTo(\'' . site_aurl($this->tablefunc . '/generate') . '\',\'generate\')', 'generate') : ''; $func .= $isdel ? $this->Purview_model->getOtherFunc('submitTo(\'' . site_aurl($this->tablefunc . '/del') . '\',\'del\')', 'del') : ''; $btngenerate = $this->Purview_model->getOtherFunc('submitTo(\'' . site_aurl($this->tablefunc . '/generate') . '\',\'generate\')', 'generate'); $list = get_dir_file_info($this->backuppath); $res = array('tablefunc' => $this->tablefunc, 'list' => get_dir_file_info($this->backuppath), 'func' => $func, 'isdel' => $isdel, 'langarr' => $this->Cache_model->loadLang(), 'isdownload' => $this->Purview_model->checkPurviewFunc($this->tablefunc, 'download'), 'btngenerate' => $btngenerate); $this->load->view($this->tablefunc, $res); }
/** * List pages in a folder */ public function pages() { $this->CI = get_instance(); $this->CI->load->helper('file'); // Get the folder if (!($url = $this->get_param('url', FALSE))) { return; } $url = ltrim($url, '/'); // Check this out. if (!is_dir('site/' . $url)) { return; } $map = get_dir_file_info('site/' . $url, true); // Do we want to remove the index file? if ($this->get_param('include_index', 'no') == 'no') { if (isset($map['index.html'])) { unset($map['index.html']); } } $vars = array(); $count = 0; $this->CI->simpletags->set_trigger('var'); // Run through each page and get some info foreach ($map as $file_name => $file_info) { // Create guessed name $name = str_replace('.html', '', $file_name); $name = str_replace(array('-', '.', '_'), ' ', $name); // Guess the name $vars['pages'][$count]['guessed_name'] = ucwords($name); $vars['pages'][$count]['uri'] = $url . '/' . str_replace('.html', '', $file_name); $vars['pages'][$count]['url'] = site_url($url . '/' . str_replace('.html', '', $file_name)); // Get the date $vars['pages'][$count]['date'] = date($this->CI->config->item('fizl_date_format'), $file_info['date']); // Get any vars from the item if ($file_content = read_file($file_info['server_path'])) { if (strpos($file_content, '{var ') !== FALSE) { // Grab them vars $this->CI->simpletags->parse($file_content, array(), array($this, 'var_callback')); $vars['pages'][$count] = array_merge($vars['pages'][$count], $this->vars); // Clear it $this->vars = array(); } } $count++; } // Total $vars['total'] = count($map); return $this->CI->parser->parse_string($this->tag_content, $vars, TRUE); }
public function index() { $list = get_dir_file_info($this->path); $temp = array(); foreach ($list as $k => $v) { $temp[] = $v['date']; } array_multisort($temp, SORT_DESC, $list); // echo '<pre>';print_r($list);die; // $dbs = $this->dbutil->list_databases(); // $tables = $this->db->list_tables(); $this->assign('list', $list); $this->display(); }
function delete_old_files($dir, $older_than, $exclude = []) { $files = get_dir_file_info($dir); if (!is_numeric($older_than)) { $older_than = strtotime($older_than); } if (!empty($files)) { foreach ($files as $file) { if ($file['date'] < $older_than and is_null($exclude) || is_array($exclude) && !in_array($file['name'], $exclude) || is_string($exclude) && !preg_match($exclude, $file['name'])) { @unlink($file['server_path']); } } } }
function read($keys = false) { $dir = get_dir_file_info(FCPATH . 'storage' . DIRECTORY_SEPARATOR . 'themes'); $base_host = '//' . $_SERVER['HTTP_HOST'] . preg_replace('/api\\.php(.*)?$/', '', $_SERVER['SCRIPT_NAME']); $base = $base_host . 'storage/themes/'; $final = array(); foreach ($dir as $key => $val) { $p = $val['server_path']; $path = basename($p); if (strpos($path, ' ') !== false) { continue; } $info = $p . DIRECTORY_SEPARATOR . 'info.json'; $guid = $p . DIRECTORY_SEPARATOR . 'koken.guid'; $guid_old = $p . DIRECTORY_SEPARATOR . '.guid'; if (is_dir($p) && file_exists($info)) { $info_array = json_decode(file_get_contents($info)); if ($info_array) { $preview = $p . DIRECTORY_SEPARATOR . 'preview.jpg'; if (file_exists($preview)) { $preview = $base . $key . '/preview.jpg'; } else { $preview = str_replace('storage/themes', 'app/site/themes', $base) . '/preview.jpg'; } list($w, $h) = getimagesize(FCPATH . str_replace($base_host, '', $preview)); $a = array('name' => $info_array->name, 'version' => $info_array->version, 'description' => $info_array->description, 'demo' => isset($info_array->demo) ? $info_array->demo : false, 'documentation' => isset($info_array->documentation) ? $info_array->documentation : false, 'path' => $key, 'preview' => $preview, 'preview_aspect' => $w / $h, 'author' => $info_array->author); if (file_exists($guid)) { $a['koken_store_guid'] = file_get_contents($guid); } else { if (file_exists($guid_old)) { $a['koken_store_guid'] = file_get_contents($guid_old); } } if ($keys) { $final[$key] = $a; } else { $final[] = $a; } } } } if (!$keys) { function sortByName($a, $b) { return $a['name'] > $b['name']; } usort($final, 'sortByName'); } return $final; }
public function video() { $this->load->helper('file'); $files = get_dir_file_info('../public/uploads/video', FALSE); foreach ($files as $key => $row) { $check = $this->db->like('content', '/' . $row['name'])->get('news_data')->row_array(); if ($check) { $files[$key]['news'] = $this->db->where('id', $check['news_id'])->get('news')->row_array(); } } usort($files, array('Admin_Controller', 'sortByDate')); $this->data['files'] = array_reverse($files); //print_r($files); $this->load->view('media/video', $this->data); }
/** * Loading all modules names and their paths */ private function loadModules() { \CI::$APP->load->helper('file'); foreach (\Modules::$locations as $path => $relPath) { $modulesInLocation = get_dir_file_info($path); foreach ($modulesInLocation as $name => $info) { $fullModulePath = $path . $name . '/'; // var_dump($fullModulePath); if (is_dir($fullModulePath)) { $this->modules[$name] = $fullModulePath; $this->modulesAppRelPath[$name] = trim(str_replace(APPPATH, '', $path), '/'); } } } }
public function index() { $page = intval($this->input->get('page')); if ($page == 0) { $page = 1; } $arrs = get_dir_file_info("./plugins/"); $data['pagesize'] = 10; $data['page'] = $page; $data['pagejs'] = ceil((count($arrs) - 1) / $data['pagesize']); //总页数 $data['url'] = site_url('admin/plugins') . "?"; $data['dirs'] = array_slice($arrs, $data['pagesize'] * (($page > $data['pagejs'] ? $data['pagejs'] : $page) - 1), $data['pagesize']); $this->load->view('plugins.html', $data); }
function index() { $data['root'] = trim(implode('/', array_slice($this->uri->segment_array(), 3)), '/'); if (!is_dir($this->path . '/' . $data['root'])) { redirect(config_item('admin_folder') . '/media/index/'); } $data['files'] = array(); $files = get_dir_file_info($this->path . '/' . $data['root']); if (!empty($files)) { foreach ($files as $f) { $data['files'][] = $f['name']; } } natcasesort($data['files']); $this->load->view(config_item('admin_folder') . '/iframe/media', $data); }
public function download() { $this->Purview_model->checkPurview($this->tablefunc, 'download'); $id = $this->uri->segment(4); if ($id) { $filename = base64_decode($id); $data = file_get_contents($this->backuppath . $filename); $this->load->helper('download'); force_download($filename, $data); } else { $this->load->helper('file'); $list = get_dir_file_info($this->backuppath); $res = array('tpl' => 'download', 'tablefunc' => $this->tablefunc, 'list' => $list, 'funcstr' => $this->Purview_model->getFunc($this->tablefunc, array('del')), 'isdel' => $this->Purview_model->checkPurviewFunc($this->tablefunc, 'del')); $this->load->view($this->tablefunc, $res); } }
public function index() { if ($this->functions->get_loged()) { $data['user_data'] = $this->functions->get_user_data(); $data['nb_comments'] = $this->functions->get_comments(); $data['page'] = 'gallery'; $data['title'] = 'Galerie'; $data['query'] = get_dir_file_info('./assets/img/thumb'); if (isset($_GET['delete'])) { unlink('./assets/img/thumb/' . $_GET['delete']); unlink('./assets/img/' . str_replace('_thumb', '', $_GET['delete'])); $this->session->set_flashdata('success', 'Image ' . $_GET['delete'] . ' supprimée.'); redirect(base_url('admin/medias')); } $this->load->view(URL_LAYOUT, $data); } }
public function index() { $this->load->helper('my'); $this->load->library('inc'); $this->load->helper('file'); /* Admin Themes */ $data['admin_themes'] = get_dir_file_info('../themes/admin'); /* WebMIS Themes */ $data['webmis_themes'] = get_dir_file_info('../webmis/themes'); $data['js'] = array('system/sys_config.js'); $data['Menus'] = $this->inc->getMenuAdmin($this); if ($this->IsMobile) { $this->inc->adminView($this, 'system/config/index_mo', $data); } else { $this->inc->adminView($this, 'system/config/index', $data); } }
public function list_files() { $list = get_dir_file_info(APPPATH . 'logs'); $filtered_list = array(); foreach ($list as $file) { $file['attrs'] = ''; $file['suffix'] = ''; if ($file['name'] == $this->log_file) { $file['attrs'] = 'selected="selected"'; } if ($file['name'] == $this->today) { $file['suffix'] = ' - (' . $this->CI->lang->line('fire_log_today') . ')'; } array_push($filtered_list, $file); } return $filtered_list; }
public function verify($w = 100, $h = 28) { // 删除10分钟前的图片 $this->load->helper('file'); $files = get_dir_file_info('./uploads/captcha/'); foreach ($files as $fname => $v) { if ($v['date'] + 600 < time()) { unlink($v['server_path']); } } // 生成新验证码 $this->load->helper('captcha'); $vals = array('img_path' => './uploads/captcha/', 'img_url' => 'http://www.ci.com/uploads/captcha/', 'img_width' => $w, 'img_height' => $h, 'expiration' => 600, 'word_length' => 5, 'font_path' => './public/font/georgia.ttf', 'font_size' => 16, 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'colors' => array('background' => array(205, 200, 205), 'border' => array(255, 255, 255), 'text' => array(0, 0, 0), 'grid' => array(255, 255, 255))); $cap = create_captcha($vals); $this->session->verifytext = $cap['word']; $this->session->verifytime = $cap['time']; echo $cap['image']; }
/** * Crawl * * Crawls /posted/ renaming directories and html files for pretty urls. * * @param int * @return array */ public function crawl($from = 0) { $this->benchmark->mark('crawl_start'); $root = './posted/'; $absolute_root = realpath($root); log_message('debug', 'Absolute Root: ' . $absolute_root); $this->load->helper('naming'); $this->load->helper('file'); $posts = get_dir_file_info($root, $top_level_only = true); log_message('debug', 'Posts:: ' . json_encode($posts)); $this->benchmark->mark('post_loop_start'); /** * Loop through directories in the $root directory formatting directory * names for pretty URLs as well as renaming .html files to * 'index.html'. */ foreach ($posts as $post) { $post_files = get_filenames($root . $post['name'], $prepend_paths = true); log_message('debug', 'Post Files:: ' . json_encode($post_files)); /** * Rename html files to index.html */ foreach ($post_files as $filename) { $filename = str_replace($absolute_root, '', $filename); log_message('debug', 'Filename: ' . $filename); $file_info = PATHINFO($root . $filename); log_message('debug', 'Fileinfo: ' . json_encode($file_info)); if ($file_info['extension'] == 'html' && $file_info['filename'] == 'index') { break; } elseif ($file_info['extension'] == 'html') { rename($root . $filename, $file_info['dirname'] . '/' . 'index.html'); break; } } rename($root . $post['name'], $root . format_url($post['name'])); $post_dirs[] = format_url($post['name']); } $this->benchmark->mark('post_loop_end'); // $posts = get_dir_file_info( $root, $top_level_only = true ); $posts = $this->_fetch_posts($root); log_message('debug', 'Fetched Posts:: ' . json_encode($posts)); $this->benchmark->mark('crawl_end'); return $posts; }