Exemple #1
0
 public function index()
 {
     $this->load->helper('file');
     // Log Files
     Template::set('logs', get_filenames($this->config->item('log_path')));
     Template::render();
 }
Exemple #2
0
 function index()
 {
     $get_profile_image = $this->students_model->get_student_profile_image_by_student_id($this->session->userdata('student_id'));
     if ($get_profile_image != NULL) {
         foreach ($get_profile_image as $row_i) {
             $existing_image_file_name = $row_i->file_name;
         }
         $profile_file_names = get_filenames("profiles");
         foreach ($profile_file_names as $file) {
             $same = $this->same_file($existing_image_file_name, $file);
             if ($same) {
                 $file_path = "profiles/" . $file;
                 unlink($file_path);
             }
         }
         $delete_current_profile_image = $this->students_model->delete_student_profile_image_by_student_id($this->session->userdata('student_id'));
     }
     //insert student profile image
     $get_student = $this->global_model->get_by_id("students", $this->session->userdata('student_id'));
     foreach ($get_student as $row) {
         $image_file_name = $row->first_name . "_" . $row->last_name;
     }
     $this->load->library('upload');
     $this->upload->initialize(array("upload_path" => "profiles", "allowed_types" => "gif|jpg|png", "max_width" => "5000", "max_height" => "8000"));
     if ($this->upload->do_upload('profile_pic')) {
         $data = $this->upload->data();
         $data['student_id'] = $this->session->userdata('student_id');
         $insert_profile_image = $this->global_model->add("profile_image", $data);
         $data['status'] = true;
     } else {
         $data['status'] = false;
     }
     echo json_encode($data);
 }
Exemple #3
0
 function _get_callback_data($request_data, $response_data, $return_data, $form_certi, $stream_id)
 {
     //回调
     $form_certi = $this->certi_model->findByAttributes(array('certi_name' => $form_certi));
     //请求方
     $callback_list = array();
     $request_data = mb_unserialize($request_data);
     $method_name = str_replace('.', '_', $request_data['method']);
     $node_type = $request_data['node_type'] == 'ecos.b2c' ? 'erp_to_ec' : 'ec_to_erp';
     $filenames = get_filenames('application/libraries/apiv/' . $node_type);
     foreach ($filenames as $key2 => $value2) {
         if ($method_name . '.php' == $value2) {
             $this->load->library('apiv/' . $node_type . '/' . $method_name);
             if (method_exists($this->{$method_name}, 'callback')) {
                 //发送回调
                 $callback_rs = $this->{$method_name}->callback(array('request_data' => $request_data, 'return_data' => $return_data, 'response_data' => $response_data, 'msg_id' => md5($stream_id)));
                 $now = time();
                 $callback_data = $callback_rs['callback_data'];
                 $callback_url = $callback_rs['callback_url'];
                 $callback_data['matrix_certi'] = $form_certi['certi_name'];
                 $callback_data['matrix_timestamp'] = $now;
                 $callback_data['sign'] = md5($form_certi['certi_name'] . $form_certi['certi_key'] . $now);
                 $callback_data['stream_id'] = $stream_id;
                 //$return_callback = $this->httpclient->set_timeout(15)->post($rs['callback_url'],$callback_data);//回调发送
                 $callback_list = array('url' => $callback_url, 'method' => 'POST', 'post_data' => $callback_data, 'header' => null, 'options' => array());
             }
         }
     }
     return $callback_list;
 }
 /**
  * Given a directory, return the filename of any readme file if it exists
  * @param string $dir The directory to search
  * @return mixed A filename if found, bool false if not
  */
 public static function getReadme($dir)
 {
     $CI =& get_instance();
     $dir = rtrim($dir, '/') . '/';
     $CI->load->helper('file');
     $files = get_filenames($dir);
     $readme = FALSE;
     $file = '';
     foreach ($files as $f) {
         $lfile = strtolower($f);
         if (strpos($lfile, 'readme') === 0) {
             $readme = TRUE;
             $file = $f;
             break;
         }
     }
     if (!$readme) {
         return FALSE;
     }
     # Let's not get hosed by some guy with a 10GB README
     $max_size = 1024 * 256;
     # 256 kb
     if (filesize($dir . $file) > $max_size) {
         return FALSE;
     } else {
         return $file;
     }
 }
Exemple #5
0
function get_last_filename()
{
    $filenames = get_filenames();
    $last_filename = end($filenames);
    reset($filenames);
    return $last_filename;
}
Exemple #6
0
 private function ListFiles()
 {
     $sess = $this->session->userdata('user_data');
     $basepath = BASEPATH . '../uploads/slider';
     $files = get_filenames($basepath);
     echo json_encode($files);
 }
Exemple #7
0
 public function index()
 {
     $this->load->helper('file');
     Assets::add_js($this->load->view('developer/logs_js', null, true), 'inline');
     // Log Files
     Template::set('logs', get_filenames($this->config->item('log_path')));
     Template::render();
 }
Exemple #8
0
 private function ListFiles()
 {
     $sess = $this->session->userdata('user_data');
     $nomor_efornas = $this->session->userdata('nomor_efornas');
     $basepath = BASEPATH . '../uploads/' . $sess['id_provinsi'] . $sess['id_kabkota'] . $sess['id_faskes'] . '/' . $nomor_efornas['no'];
     $files = get_filenames($basepath);
     echo json_encode($files);
 }
 public function get_language()
 {
     $this->load->helper('file');
     $result = get_filenames('assets/nocms/languages');
     for ($i = 0; $i < count($result); $i++) {
         $result[$i] = str_ireplace('.php', '', $result[$i]);
     }
     return $result;
 }
Exemple #10
0
 public function get_images()
 {
     $files = get_filenames('uploads/wysiwyg/thumbnails');
     $return = [];
     foreach ($files as $file) {
         $return[] = array('thumb' => base_url('uploads/wysiwyg/thumbnails/' . $file), 'image' => base_url('uploads/wysiwyg/images/' . $file));
     }
     echo stripslashes(json_encode($return));
 }
Exemple #11
0
 public function view($page = 'overview')
 {
     if (!file_exists(APPPATH . '/views/pages/' . $page . '.php')) {
         show_404();
     }
     $data['title'] = ucfirst($page);
     $data['api_key'] = $this->session->api_key;
     $data['api_url'] = Bitcodin::getBaseUrl();
     if (!isset($this->session->page_limit) or !is_numeric($this->session->page_limit)) {
         $this->session->page_limit = 10;
     }
     $data['page_limit'] = $this->session->page_limit;
     $page_files = get_filenames(APPPATH . '/views/pages');
     $menu_items = array();
     foreach ($page_files as $file) {
         $name = basename($file, '.php');
         $menu_items[] = ucfirst($name);
     }
     $index = array_search('Home', $menu_items);
     $home = $menu_items[$index];
     unset($menu_items[$index]);
     array_unshift($menu_items, $home);
     if ($page == 'overview') {
         Bitcodin::setApiToken($this->session->api_key);
         try {
             $encodingProfiles = EncodingProfile::getListAll();
             if (count($encodingProfiles) <= 0) {
                 $encProf = new \stdClass();
                 $encProf->encodingProfileId = 0;
                 $encProf->name = "No encoding profile available";
                 $encodingProfiles = array("No encoding profiles found");
             }
             $outputs = Output::getListAll();
             if (count($outputs) <= 0) {
                 $output = new \stdClass();
                 $output->outputId = 0;
                 $output->name = "No output available";
                 $outputs = array($output);
             }
         } catch (BitcodinException $ex) {
             $output = new \stdClass();
             $output->outputId = 0;
             $output->name = "No output available";
             $outputs = array($output);
             $encProf = new \stdClass();
             $encProf->encodingProfileId = 0;
             $encProf->name = "No encoding profile available";
             $encodingProfiles = array($encProf);
         }
         $data['encodingProfiles'] = $encodingProfiles;
         $data['outputs'] = $outputs;
     }
     $data['menu_items'] = $menu_items;
     $this->load->view('templates/header', $data);
     $this->load->view('pages/' . $page, $data);
     $this->load->view('templates/footer', $data);
 }
Exemple #12
0
 private function get_file_list($root_directory, $target_directory)
 {
     $file_list = array();
     $directory = $root_directory . '/' . $target_directory;
     $file_list_bak = get_filenames($directory);
     foreach ($file_list_bak as $file) {
         array_push($file_list, '/' . $directory . '/' . $file);
     }
     return $file_list;
 }
 /**
  * Index file that is home page for documentation
  * @return view index view
  */
 public function index()
 {
     $this->load->helper('file');
     $files = get_filenames('./application/views/documentation');
     $articles = $this->format_list($files);
     $this->load->view('dashboard/header.php', array('title' => 'ISU Lacrosse Dashboard'));
     $this->load->view('dashboard/sidebar.php', array('active' => 'documentation', 'records' => $this->get_records()));
     $this->load->view('documentation/index.php', array('articles' => $articles));
     $this->load->view('dashboard/footer.php', array('custom_script' => 'cms_index'));
 }
Exemple #14
0
 public function info()
 {
     $files = get_filenames($this->folder, FALSE);
     if ($files) {
         $data = array('titulo' => 'Mis Consultas', 'datos' => $this->consulta_model->get_datos(), 'files' => $files);
     } else {
         $data = array('titulo' => 'Mis Consultas', 'datos' => $this->consulta_model->get_datos(), 'files' => $NULL);
     }
     $this->load->view('consulta_view', $data);
 }
 function __construct()
 {
     parent::__construct();
     $this->load->helper('file');
     foreach (array('controllers', 'services', 'filters', 'directives') as $path) {
         foreach (get_filenames('app/scripts/' . $path) as $script) {
             $this->all[$path][] = $script;
         }
     }
 }
Exemple #16
0
 function _remap($module, $segs = NULL)
 {
     $remote_ips = $this->fuel->config('webhook_remote_ip');
     $is_web_hook = $this->fuel->auth->check_valid_ip($remote_ips);
     // check if it is CLI or a web hook otherwise we need to validate
     $validate = (php_sapi_name() == 'cli' or defined('STDIN') or $is_web_hook) ? FALSE : TRUE;
     // Only super admins can execute builds for now
     if ($validate and !$this->fuel->auth->is_super_admin()) {
         show_error(lang('error_no_access'));
     }
     // call before build hook
     $params = array('module' => $module);
     $GLOBALS['EXT']->_call_hook('before_build', $params);
     // get the type of build which can either be CSS or JS
     $type = array_shift($segs);
     $valid_types = array('css', 'js');
     if (!empty($type) and in_array($type, $valid_types)) {
         $this->load->helper('file');
         // get the folder name if it exists
         $segs_str = implode('/', $segs);
         // explode on colon to separate the folder name from the file name
         $seg_parts = explode(':', $segs_str);
         // set the folder name to lookin
         $folder = $seg_parts[0];
         // set the file name if one exists
         $filename = !empty($seg_parts[1]) ? $seg_parts[1] : 'main.min';
         // get list of files
         $files_path = assets_server_path($folder, $type);
         $_files = get_filenames($files_path, TRUE);
         $files = array();
         foreach ($_files as $file) {
             // trim to normalize path
             $replace = trim(assets_server_path('', $type), '/');
             $files[] = str_replace($replace, '', trim($file, '/'));
         }
         $output_params['type'] = $type;
         $output_params['whitespace'] = TRUE;
         $output_params['destination'] = assets_server_path($filename . '.' . $type, $type, $module);
         $output = $this->asset->optimize($files, $output_params);
         echo lang('module_build_asset', strtoupper($type), $output_params['destination']);
     } else {
         if ($module != 'index' and $this->fuel->modules->exists($module) and $this->fuel->modules->is_advanced($this->fuel->{$module})) {
             $results = $this->fuel->{$module}->build();
             if ($results === FALSE) {
                 echo lang('error_no_build');
             }
         } else {
             // run default FUEL optimizations if no module is passed
             $this->optimize_js();
             $this->optimize_css();
         }
     }
     // call after build hook
     $GLOBALS['EXT']->_call_hook('after_build', $params);
 }
Exemple #17
0
 /**
  * media::delete_dir()
  * 
  * @param mixed $valor
  * @return
  */
 function delete_dir($valor)
 {
     if ($this->session->userdata('logged_in')) {
         if (count(get_filenames('./upload/' . $valor)) >= 1) {
             redirect('Media');
         } else {
             rmdir("./upload/" . $valor) or die("erro ao apagar diretório");
             redirect('Media');
         }
     }
 }
Exemple #18
0
 public function editPage()
 {
     Admincontrol_helper::is_logged_in($this->session->userdata('userName'));
     //Load the form helper
     $this->load->helper('form');
     //Get page details from database
     $this->data['pages'] = $this->Hoosk_model->getPage($this->uri->segment(4));
     //Load the view
     $this->data['templates'] = get_filenames('theme/' . THEME . '/templates');
     $this->data['header'] = $this->load->view('admin/header', $this->data, true);
     $this->data['footer'] = $this->load->view('admin/footer', '', true);
     $this->load->view('admin/editpage', $this->data);
 }
Exemple #19
0
 /**
  * Mostra la vista para subir las fotos
  * 
  * @return view 
  */
 public function index()
 {
     // Aquí tienes que obtener la cantidad y datos de las
     // fotos desde tu base de datos
     $this->load->helper('file');
     $fotos = get_filenames('./img/mini/');
     $cantidad_fotos = count($fotos);
     $data['fotos_restantes'] = 6 - $cantidad_fotos;
     $data['fotos'] = $fotos;
     $this->load->view('frontend/menu_vista', $data);
     $this->load->view('backend/cargar_fotos_vista');
     $this->load->view('frontend/footer_vista');
 }
function get_filenames($source_dir, $include_path = FALSE)
{
    static $_filedata = array();
    if ($fp = @opendir($source_dir)) {
        while (FALSE !== ($file = readdir($fp))) {
            if (@is_dir($source_dir . $file) && substr($file, 0, 1) != '.') {
                get_filenames($source_dir . $file . "/", $include_path);
            } elseif (substr($file, 0, 1) != ".") {
                $_filedata[] = $include_path == TRUE ? $source_dir . $file : $file;
            }
        }
        return $_filedata;
    }
}
 /**
  * This method loads all of the *.test.php files it can find.
  *
  * @uses get_filenames()
  * @param string The path to where to start looking for tests
  * @param bool Explore sub-directories for .test.php files
  */
 function loadAllTests($startDir, $recursive = true)
 {
     $files = get_filenames($startDir);
     if (!is_array($files)) {
         echo "<p class=\"error\">No test classes found in {$startDir}..</p>\n";
         return false;
     }
     foreach ($files as $lFile) {
         if (!is_dir($lFile)) {
             if (substr($lFile, -15) == '.simpletest.php') {
                 $this->addFile($lFile);
             }
         }
     }
 }
 public function categories()
 {
     $query = $this->db->get('product_group');
     $result = $query->result_array();
     echo '<pre>';
     $i = 0;
     foreach ($result as $res) {
         $files = get_filenames('images/catalog/' . $res['id']);
         $result[$i++]['images'] = 'images/catalog/' . $res['id'] . '/' . $files[0];
     }
     print_r($result);
     echo '</pre>';
     $data = array('result' => $result);
     //$this->load->view('page_view',$data);
 }
Exemple #23
0
 public function index_show()
 {
     $this->load->helper('file');
     $output = array();
     $filearray = get_filenames('application/views/knowledgebase', TRUE);
     foreach ($filearray as $name) {
         $pathsegments = explode("/", $name);
         $text = read_file($name);
         preg_match("/<title>(.*)<\\/title>/i", $text, $matches);
         //array_push($output, $matches[1]);
         $link = '<li><a href="/kb/page/' . $pathsegments[sizeof($pathsegments) - 1] . '">' . $matches[1] . '</a></li>';
         array_push($output, $link);
     }
     return "<ol>" . implode($output, "\n") . "</ol>";
 }
Exemple #24
0
 /**
  * Addon File Handler
  *
  * @access	private
  * @param	string
  * @return	void
  */
 function get_files($type = 'modules')
 {
     $type_ident = array('modules' => 'mcp', 'extensions' => 'ext', 'plugins' => 'pi', 'fieldtypes' => 'ft', 'rte_tools' => 'rte');
     if (!is_array($this->_map)) {
         ee()->load->helper('directory');
         // Initialize the _map array so if no addons of a certain type
         // are found, we can still return _map[$type] without errors
         $this->_map = array('modules' => array(), 'extensions' => array(), 'plugins' => array(), 'fieldtypes' => array(), 'rte_tools' => array());
         foreach (array(PATH_THIRD, PATH_ADDONS, PATH_RTE) as $path) {
             if (($map = directory_map($path, 2)) !== FALSE) {
                 $this->package_list($map);
             }
         }
         if ($type != '') {
             ksort($this->_map[$type]);
         }
         ksort($this->_packages);
     }
     // And now first party addons - will override any third party packages of the same name.
     // We can be a little more efficient here and only check the directory they asked for
     static $_fp_read = array('extensions', 'modules', 'fieldtypes', 'rte_tools');
     // is_package calls this function with a blank key to skip
     // first party - we'll do that right here instead of checking
     // if the folder exists
     if (!array_key_exists($type, $type_ident)) {
         return array();
     }
     if (!in_array($type, $_fp_read)) {
         ee()->load->helper('file');
         $ext_len = strlen('.php');
         $abbr = $type_ident[$type];
         $root_path = $abbr == 'mcp' ? PATH_ADDONS : constant('PATH_' . strtoupper($abbr));
         $list = get_filenames($root_path);
         if (is_array($list)) {
             foreach ($list as $file) {
                 if (strncasecmp($file, $abbr . '.', strlen($abbr . '.')) == 0 && substr($file, -$ext_len) == '.php' && strlen($file) > strlen($abbr . '.' . '.php')) {
                     $name = substr($file, strlen($abbr . '.'), -$ext_len);
                     $class = $abbr == 'pi' ? ucfirst($name) : ucfirst($name) . '_' . $abbr;
                     $path = ($abbr == 'ext' or $abbr == 'acc' or $abbr == 'ft' or $abbr == 'rte') ? constant('PATH_' . strtoupper($abbr)) : $root_path . $name . '/';
                     $this->_map[$type][$name] = array('path' => $path, 'file' => $file, 'name' => ucwords(str_replace('_', ' ', $name)), 'class' => $class);
                 }
             }
         }
         $_fp_read[] = $type;
         ksort($this->_map[$type]);
     }
     return $this->_map[$type];
 }
Exemple #25
0
 public function _init($sync = '')
 {
     $from_certi = get_post('from_node_id', true);
     //证书名,32位
     $this->load->model('stream_model');
     if (get_post('method', true)) {
         $method_name = get_post('method', true);
         $method_name = str_replace('.', '_', $method_name);
         $node_type = get_post('node_type', true) == 'ecos.b2c' ? 'erp_to_ec' : 'ec_to_erp';
         $filenames = get_filenames('application/libraries/apiv/' . $node_type);
         foreach ($filenames as $key => $value) {
             if ($method_name . '.php' == $value) {
                 $this->load->library('apiv/' . $node_type . '/' . $method_name);
                 $data = $this->{$method_name}->_init();
                 $now = time();
                 $data['response_data']['matrix_certi'] = $check_data['certi_name'];
                 $data['response_data']['matrix_timestamp'] = $now;
                 $data['response_data']['sign'] = md5($check_data['certi_name'] . $check_data['certi_key'] . $now);
                 //发送前增加msg_id
                 if (isset($data['response_data']['msg_id'])) {
                     $data['response_data']['msg_id'] = md5($stream_id);
                 }
                 $send_status = 0;
                 if (method_exists($this->{$method_name}, 'callback')) {
                     $send_status = 1;
                 }
                 //记录数据1
                 $stream_id = $this->stream_model->log_first($data, $from_certi, $check_data['certi_name'], $send_status);
                 //url判断同步
                 if ($sync) {
                     $this->{$method_name}->right_away = TRUE;
                 }
                 //立即发送
                 $return_data = '';
                 if ($this->{$method_name}->right_away == TRUE) {
                     $this->load->library('common/httpclient');
                     $return_data = $this->httpclient->set_timeout(20)->post($check_data['api_url'], $data['response_data']);
                     //发送
                     //	$this->stream_model->log_send_all(array('return_data'=>$return_data,'callback_url'=>$callback_url,'callback_data'=>$callback_data,'return_callback'=>$return_callback),$stream_id);
                 }
                 $result = $this->{$method_name}->result(array('return_data' => $return_data, 'response_data' => $data['response_data'], 'msg_id' => md5($stream_id)));
                 echo $result;
             }
         }
     } else {
         die('{"res": "fail", "msg_id": "", "rsp": "e00093", "err_msg": "no method", "data": "no method"}');
     }
 }
 public function upload()
 {
     //TODO: refactor, add support for JPEG
     if ($this->config->item('migration_enabled') == TRUE) {
         die('Enable migrations to import images.');
     }
     $this->load->spark('unzip/1.0.0');
     $this->load->library('unzip');
     $this->load->helper(array('file', 'form'));
     $this->load->library('upload', array('upload_path' => $this->uploads_dir, 'max_size' => $this->upload_max_filesize, 'allowed_types' => 'zip'));
     $data = array();
     $data['properties'] = $this->properties_model->get_entries();
     if (!$this->upload->do_upload()) {
         log_message('error', 'Import: Error handling upload');
         $data['status'] = $this->upload->display_errors();
     } else {
         log_message('debug', 'Import: Upload ok');
         $date = new DateTime();
         $now = $date->getTimestamp();
         $upload_data = $this->upload->data();
         mkdir($upload_data['file_path'] . $now, 0777);
         // unzip
         $this->unzip->extract($upload_data['full_path'], $upload_data['file_path'] . $now);
         log_message('debug', 'Import: Unzip');
         if ($this->input->post('replace_old_files') == true) {
             $this->_cleanup($this->input->post('object_id'));
         }
         // copy, rename and insert in db
         $files = get_filenames($upload_data['file_path'] . $now, TRUE);
         $i = 1;
         foreach ($files as $file) {
             $new_file = $now . '_' . $i . '.jpg';
             copy($file, $this->db_files_dir . $new_file);
             // insert in db
             $this->property_images_model->save($this->input->post('object_id'), $new_file);
             $i++;
         }
         log_message('debug', 'Import: Copy, rename and insert in DB happened');
         // clean up
         delete_files($upload_data['file_path'] . $now);
         @rmdir($upload_data['file_path'] . $now);
         unlink($upload_data['full_path']);
         log_message('debug', 'Import: Cleaned up');
         $data['status'] = 'Done.';
     }
     $this->load->view('property_images/import', $data);
 }
Exemple #27
0
 public function index($enviado = NULL)
 {
     $this->load->library('dom');
     $this->load->helper('file');
     $aboutGal = get_filenames('./public/fotos');
     $elementos = $this->setCaracteristicas()['carElems'];
     shuffle($elementos);
     $contactD = ['slider' => $aboutGal, 'ImagenP' => '/public/IMG_4489.jpg', 'headertitulo' => 'Huayacan 58', 'headersubtitulo' => 'una oportunidad <span class="text-primary">de hacer negocios</span>', 'abouttitle' => 'Requisitos para Arrendar', 'aboutp' => $this->setAboutp(), 'aboutp2' => 'Al llenar la forma, un agente se comunicará con usted para agendar una cita dentro de las siguientes 8 horas hábiles.', 'aboutGal' => $aboutGal, 'titulo' => '¿Tienes preguntas?', 'parrafo' => self::parrafo(), 'nombre' => 'Huayacan58', 'carTitle' => $this->setCaracteristicas()['carTitle'], 'carP' => $this->setCaracteristicas()['carP'], 'carFiltros' => $this->setCaracteristicas()['carFiltros'], 'carElems' => $elementos, 'enviado' => !is_null($enviado) ? TRUE : FALSE];
     $this->dom->title = base_url();
     $this->dom->navbar = ['v' => ['huayacan/navbar']];
     $this->dom->content = ['v' => ['huayacan/header', $contactD]];
     $this->dom->content = ['v' => ['huayacan/description']];
     $this->dom->content = ['v' => ['huayacan/mapa']];
     $this->dom->content = ['v' => ['huayacan/contacto']];
     $this->dom->content = ['v' => ['huayacan/caracteristicas']];
     $this->dom->render();
 }
Exemple #28
0
 public function save_backup()
 {
     // Load the file helper
     $this->load->helper('file');
     // Load the DB utility class
     $this->load->dbutil();
     // Backup the entire database and assign it to a variable
     $prefs = array('format' => 'txt', 'add_drop' => FALSE, 'add_insert' => TRUE, 'newline' => "\n");
     $backup =& $this->dbutil->backup($prefs);
     // Get number of existing backups in order to properly name the new backup
     $number_of_backups = count(get_filenames('/var/backups/kuklos/'));
     // write the file to your server
     write_file('/var/backups/kuklos/backup_' . $number_of_backups . '.sql', $backup);
     // // Load the download helper and send the file to your desktop
     // $this->load->helper('download');
     // force_download('mybackup.gz', $backup);
     redirect(base_url('admin/backup_success'));
 }
Exemple #29
0
/**
 * Get affected paths
 * @param mixed path
 * @return string
 */
function get_affected_paths($path)
{
    global $basepath;
    $affected_paths = T_('Affected paths:') . ' ';
    if (is_array($path)) {
        $paths = array();
        foreach ($path as $p) {
            $paths[] = no_trailing_slash($p);
        }
        $affected_paths .= implode(', ', $paths);
    } elseif ($path == '*') {
        $filename_params = array('inc_files' => false, 'recurse' => false, 'basename' => true);
        $affected_paths .= implode(', ', get_filenames($basepath, $filename_params));
    } else {
        $affected_paths .= no_trailing_slash($path);
    }
    return $affected_paths;
}
Exemple #30
0
 /**
  * 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;
 }