function getCrossWalks()
{
    // Prevent multiple class generations
    global $ENV;
    if (count($ENV['crosswalks']) > 0) {
        return $ENV['crosswalks'];
    }
    // Include the interface
    require_once REGISTRY_APP_PATH . "core/crosswalks/_crosswalk.php";
    // List our crosswalks
    $CI =& get_instance();
    $CI->load->helper('directory');
    $crosswalks = directory_map(REGISTRY_APP_PATH . "core/crosswalks");
    $cw_objects = array();
    foreach ($crosswalks as $cw_class) {
        // Ignore directories and classes with _filename.php
        if (is_array($cw_class) || substr($cw_class, 0, 1) == "_") {
            continue;
        }
        // Construct the crosswalk object
        $class_name = str_replace(".php", "", $cw_class);
        try {
            require_once REGISTRY_APP_PATH . "core/crosswalks/" . $cw_class;
            // Add it to our objects array
            $cw_objects[$class_name] = new $class_name();
        } catch (Exception $e) {
            // No need to fatal error here...just print an error
            echo 'ERROR: Unable to load crosswalk: ' . $cw_class . '<br/>';
        }
    }
    return $cw_objects;
}
Exemplo n.º 2
0
 function index()
 {
     if (!($faqRequest = $this->uri->segment(2))) {
         $this->load->helper('directory');
         // only map the top level directory
         $faqDir = directory_map($this->_directory, TRUE);
         $faqArticles;
         foreach ($faqDir as $index => $file) {
             // preg_match's third param takes the matches: first, the whole matched string,
             // then each additional matched string
             if (!preg_match('#^(.+).html$#', $file, $matches)) {
                 break;
             }
             $faqTitle = $this->titleFormat($matches[1]);
             $faqArticles[$faqTitle] = $this->_faqFolder . $matches[1];
         }
         $viewData['faqArticles'] = $faqArticles;
         $viewData['title'] = $this->_faqTitle;
         $this->load->view('html_head.php', array('site_base' => $this->config->item('base_url')));
         $this->load->view('page_head.php', array('userAuth' => @$this->session->userdata('email'), 'markerAuth' => @$this->session->userdata('markerEmail')));
         $this->load->view('common/faq_list', $viewData);
         $this->load->view('footer.php', array('site_base' => $this->config->item('base_url')));
         return;
     }
     $this->load->helper('file');
     $fileName = $this->_faqFolder . $faqRequest . ".html";
     $faqTitle = $this->titleFormat($faqRequest);
     $this->load->view('html_head.php', array('site_base' => $this->config->item('base_url')));
     $this->load->view('page_head.php', array('userAuth' => @$this->session->userdata('email'), 'markerAuth' => @$this->session->userdata('markerEmail')));
     $this->load->view('common/faq_header', array('title' => $this->_faqTitle, 'article' => $faqTitle));
     $this->load->view($fileName);
     $this->load->view('footer.php', array('site_base' => $this->config->item('base_url')));
 }
Exemplo n.º 3
0
function load_config()
{
    $CI =& get_instance();
    foreach ($CI->Appconfig->get_all()->result() as $app_config) {
        $CI->config->set_item($app_config->key, $app_config->value);
    }
    //Set language from config database
    //Loads all the language files from the language directory
    if ($CI->config->item('language')) {
        $CI->config->set_item('language', $CI->config->item('language'));
        // fallback to english if language folder does not exist
        $language = $CI->config->item('language');
        if (!file_exists('./application/language/' . $language)) {
            $language = 'en';
        }
        $map = directory_map('./application/language/' . $language);
        foreach ($map as $file) {
            if (substr(strrchr($file, '.'), 1) == "php") {
                $CI->lang->load(str_replace('_lang.php', '', $file), $language);
            }
        }
    }
    //Set timezone from config database
    if ($CI->config->item('timezone')) {
        date_default_timezone_set($CI->config->item('timezone'));
    } else {
        date_default_timezone_set('America/New_York');
    }
}
Exemplo n.º 4
0
 public function get_quote_templates()
 {
     $this->load->helper('directory');
     $templates = directory_map(APPPATH . '/views/quote_templates', TRUE);
     $templates = $this->remove_extension($templates);
     return $templates;
 }
Exemplo n.º 5
0
function load_config()
{
    $CI =& get_instance();
    foreach ($CI->Appconfig->get_all()->result() as $app_config) {
        $CI->config->set_item($CI->security->xss_clean($app_config->key), $CI->security->xss_clean($app_config->value));
    }
    //Set language from config database
    $language = $CI->config->item('language');
    //Loads all the language files from the language directory
    if (!empty($language)) {
        // fallback to English if language folder does not exist
        if (!file_exists('./application/language/' . $language)) {
            $language = 'en';
        }
        $CI->config->set_item('language', $language);
        $map = directory_map('./application/language/' . $language);
        foreach ($map as $file) {
            if (!is_array($file) && substr(strrchr($file, '.'), 1) == "php") {
                $CI->lang->load(strtr($file, '', '_lang.php'), $language);
            }
        }
    }
    //Set timezone from config database
    if ($CI->config->item('timezone')) {
        date_default_timezone_set($CI->config->item('timezone'));
    } else {
        date_default_timezone_set('America/New_York');
    }
    bcscale($CI->config->item('currency_decimals') + $CI->config->item('tax_decimals'));
}
Exemplo n.º 6
0
 function get_template_modules_meta_data()
 {
     //get ci instance
     $ci = get_instance();
     //load the module parent class
     load_front_library('module.php');
     //load language resources
     $ci->lang->db_load('modules-boxes');
     //modules paths
     $path_array = array(store_front_path() . 'local/modules/', store_front_path() . 'system/tomatocart/modules/');
     $modules = array();
     $loaded = array();
     //check all path and find modules
     foreach ($path_array as $path) {
         $directories = directory_map($path, 1, TRUE);
         foreach ($directories as $directory) {
             $file = $path . $directory . '/' . $directory . '.php';
             if (file_exists($file) && !in_array($directory, $loaded)) {
                 require_once $file;
                 //class name
                 $class_name = 'Mod_' . $directory;
                 //create new instance
                 $class = new $class_name(array());
                 //append loaded module
                 $loaded[] = $directory;
                 //append data
                 $modules[] = array('code' => $class->get_code(), 'text' => $class->get_title(), 'params' => $class->get_params());
             }
         }
     }
     return $modules;
 }
Exemplo n.º 7
0
 /**
  * 移动端模板管理
  */
 public function mobile()
 {
     $this->_init();
     $this->load->helper('directory');
     $dir = trim(str_replace('.', '', $this->input->get('dir')), '/');
     $path = $dir ? $this->path . $dir . '/' : $this->path;
     $data = directory_map($path, 1);
     $list = array();
     if ($data) {
         foreach ($data as $t) {
             $ext = strrchr($t, '.');
             if ($ext && in_array(strtolower($ext), array('.php'))) {
                 continue;
             }
             if (!$dir && in_array(basename($t), $this->_dir)) {
                 continue;
             }
             $icon = $eurl = '';
             if ($ext) {
                 $ext = strtolower(trim($ext, '.'));
                 $icon = is_file(FCPATH . 'dayrui/statics/images/ext/' . $ext . '.gif') ? 'ext/' . $ext . '.gif' : 'file.gif';
                 if (in_array($ext, array('html', 'html', 'js', 'css'))) {
                     $eurl = dr_url($this->template->get_value('furi') . 'edit', array('file' => $dir . '/' . $t, 'ismb' => 1));
                 } elseif (in_array($ext, array('jpg', 'gif', 'png'))) {
                     $eurl = '' . str_replace(FCPATH, SITE_URL, $this->path) . trim($dir . '/' . $t, '/') . '" target="_blank"';
                 } else {
                     $eurl = 'javascript:;';
                 }
             }
             $list[] = array('ext' => $ext, 'file' => $t, 'icon' => $icon, 'eurl' => $eurl);
         }
     }
     $this->template->assign(array('dir' => $dir, 'path' => $path, 'list' => $list, 'parent' => dirname($dir), 'upload' => 'dr_upload_files2(\'' . dr_url('api/upload', array('path' => $path)) . '\')'));
     $this->template->display('file_index.html');
 }
Exemplo n.º 8
0
 function home()
 {
     $data['title'] = 'Home';
     $data['mi'] = '';
     $data['innerJSs'] = array('panel/home.php');
     $data['jscripts'] = array('tinymce/tinymce.min.js');
     $this->load->model('MTexts', 'MTexts', TRUE);
     $this->load->model('MFilms', 'MFilms', TRUE);
     $this->load->helper('directory');
     $this->load->helper('file');
     $map = directory_map('./resources/', 1);
     $this->load->model('MPosts', 'MPosts', TRUE);
     $dataPage['posts'] = $this->MPosts->getAllTable('date', 'desc');
     $dataPage['homelatest1'] = $this->MTexts->get('name', 'homelatest1')->pl;
     $dataPage['homelatest1link'] = $this->MTexts->get('name', 'homelatest1')->en;
     $dataPage['homelatest2'] = $this->MTexts->get('name', 'homelatest2')->pl;
     $dataPage['homelatest2link'] = $this->MTexts->get('name', 'homelatest2')->en;
     $dataPage['homelatest3'] = $this->MTexts->get('name', 'homelatest3')->pl;
     $dataPage['homelatest3link'] = $this->MTexts->get('name', 'homelatest3')->en;
     $dataPage['numberOfNewFiles'] = $this->MFilms->update();
     $dataPage['mp4s'] = $this->MFilms->getAllTable();
     $this->load->view('panel/header', $data);
     $this->load->view('panel/page/home', $dataPage);
     $this->load->view('panel/footer');
 }
 function __construct($id = NULL, $core_attributes_only = FALSE)
 {
     // Get our CI instance
     $this->_CI =& get_instance();
     // Prepare the extension list based on files in our extensions directory not starting with an underscore
     if (count(self::$extensions) == 0) {
         $this->_CI->load->helper('directory');
         $map = directory_map(REGISTRY_APP_PATH . 'registry_object/models/extensions/');
         include_once 'extensions/_base.php';
         foreach ($map as $file) {
             if (!preg_match("/\\.php\$/", $file)) {
                 continue;
             }
             if (substr($file, 0, 1) != '_') {
                 include_once 'extensions/' . $file;
                 $extension_name = str_replace(".php", "", $file);
                 self::$extensions[] = $extension_name;
             }
         }
     }
     parent::__construct();
     // Setup our object id
     if (!is_numeric($id) && !is_null($id)) {
         throw new Exception("Registry Object Wrapper must be initialised with a numeric Identifier");
     }
     $this->id = $id;
     // Load up all our extensions (effectively providing multiple class inheritence)
     foreach (self::$extensions as $extension) {
         $this->_extends($extension);
     }
     // Initialise the object if we haven't done so yet!
     if (!is_null($id)) {
         $this->init($core_attributes_only);
     }
 }
Exemplo n.º 10
0
 /**
  * Find all themes in the themes directory
  *
  * @access public
  * @return array
  */
 function get_themes()
 {
     $this->load->helper('directory');
     $dir = './themes/';
     $themes = directory_map($dir, TRUE);
     return $themes;
 }
 /**
  * XML method - output sitemap in XML format for search engines
  * 
  * @return void
  */
 public function index()
 {
     $this->load->helper('directory');
     $this->load->helper('file');
     $module_dirs = array();
     $dir_map = directory_map(APPPATH . 'modules', 1);
     foreach ($dir_map as $key => $name) {
         if (strpos($name, '.') !== false) {
             continue;
             // Skip files.
         }
         $module_dirs[] = rtrim($name, DIRECTORY_SEPARATOR);
     }
     @sort($module_dirs);
     $doc = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
     foreach ($module_dirs as $module_name) {
         if ($module_name == 'sitemap') {
             continue;
         }
         if (!file_exists(APPPATH . 'modules/' . $module_name . '/controllers/Sitemap_controller.php') && !file_exists(APPPATH . 'modules/' . $module_name . '/controllers/Sitemap.php') && !file_exists(APPPATH . 'modules/' . $module_name . '/controllers/sitemap_controller.php') && !file_exists(APPPATH . 'modules/' . $module_name . '/controllers/sitemap.php')) {
             continue;
         }
         $doc->addChild('sitemap')->addChild('loc', site_url($module_name . '/sitemap/xml'));
     }
     $this->output->set_content_type('application/xml')->set_output($doc->asXML());
 }
Exemplo n.º 12
0
 /**
  * Get all template modules
  */
 public function list_services()
 {
     $this->load->helper('directory');
     $path_array = array('../system/tomatocart/libraries/service/');
     $modules = array();
     $loaded = array();
     foreach ($path_array as $path) {
         $directories = directory_map($path, 1, TRUE);
         foreach ($directories as $file) {
             if (strpos($file, '.php') !== FALSE && $file != 'service_module.php') {
                 $module = substr($file, 0, strpos($file, '.php'));
                 //load language xml file
                 $this->lang->ini_load('modules/services/' . str_replace('service_', '', $module) . '.php');
                 //include path file
                 include_once $path . $file;
                 //get class
                 $class = config_item('subclass_prefix') . $module;
                 $class = str_replace('service', 'Service', $class);
                 $class = new $class();
                 if ($class->is_installed()) {
                     $edit_cls = 'icon-edit-record';
                     $install_cls = 'icon-uninstall-record';
                 } else {
                     $edit_cls = 'icon-edit-gray-record';
                     $install_cls = 'icon-install-record';
                 }
                 //$loaded[] = $directory;
                 $modules[] = array('code' => $class->get_code(), 'title' => $class->get_title(), 'is_installed' => $class->is_installed(), 'edit_cls' => $edit_cls, 'install_cls' => $install_cls);
             }
         }
     }
     $this->output->set_output(json_encode($modules));
 }
Exemplo n.º 13
0
 private function controllers()
 {
     $controller_path = FCPATH . APPPATH . "controllers";
     $this->load->helper("directory");
     $listing = directory_map($controller_path);
     $controllers = array();
     foreach ($listing as $file) {
         // don't include the welcome controller
         if (!in_array($file, array("contents.php"))) {
             // check if current file is an array
             if (is_array($file)) {
                 foreach ($file as $actual_file) {
                     $controllers[] = $this->format_controller_methods($controller_path, $actual_file);
                 }
             }
             // prepare class information
             $controllers[] = $this->format_controller_methods($controller_path, $file);
         }
     }
     // remove empty entries
     foreach (array_keys($controllers) as $key) {
         if (empty($controllers[$key])) {
             unset($controllers[$key]);
         }
     }
     // sort controllers
     sort($controllers);
     return $controllers;
 }
Exemplo n.º 14
0
 public function edit($id = null)
 {
     // Fetch a article or set new one
     if ($id) {
         $this->data['article'] = $this->Article_M->get($id);
         count($this->data['article']) or $this->data['errors'] = 'article Could not be found';
     } else {
         $this->data['article'] = $this->Article_M->get_new();
     }
     // Set up the form
     $rules = $this->Article_M->rules;
     $this->form_validation->set_rules($rules);
     // Process the form
     if ($this->form_validation->run() == true) {
         $data = $this->Article_M->array_from_post(['title', 'slug', 'body', 'pubdate', 'image']);
         $data['user_id'] = $this->session->userdata('id');
         $this->Article_M->save($data, $id);
         $message = isset($id) ? 'article Updated Successfully' : 'article added Successfully';
         $this->session->set_flashdata('success', $message);
         redirect('admin/article');
     }
     // get assets folder content
     $this->load->helper('file');
     $this->load->helper('directory');
     $this->data['files'] = directory_map(FCPATH . 'assets/img/');
     // Load the view
     $this->data['subview'] = 'admin/article/edit';
     $this->load->view('admin/_layout_main', $this->data);
 }
Exemplo n.º 15
0
 public function upgrade_tables()
 {
     // Collect the available SQL files
     $sql_files = directory_map(APPPATH . 'modules/setup/sql', TRUE);
     // Sort them so they're in natural order
     sort($sql_files);
     // Unset the installer
     unset($sql_files[0]);
     // Loop through the files and take appropriate action
     foreach ($sql_files as $sql_file) {
         if (substr($sql_file, -4) == '.sql') {
             // $this->db->select('COUNT(*) AS update_applied');
             $this->db->where('version_file', $sql_file);
             // $update_applied = $this->db->get('fi_versions')->row()->update_applied;
             $update_applied = $this->db->get('fi_versions');
             // if (!$update_applied)
             if (!$update_applied->num_rows()) {
                 $file_contents = read_file(APPPATH . 'modules/setup/sql/' . $sql_file);
                 $this->execute_contents($file_contents);
                 $this->save_version($sql_file);
                 // Check for any required upgrade methods
                 $upgrade_method = 'upgrade_' . str_replace('.', '_', substr($sql_file, 0, -4));
                 if (method_exists($this, $upgrade_method)) {
                     $this->{$upgrade_method}();
                 }
             }
         }
     }
     if ($this->errors) {
         return FALSE;
     }
     $this->install_default_settings();
     return TRUE;
 }
Exemplo n.º 16
0
 public function getUserImages($userID)
 {
     if (is_dir($this->config->item('images_uploadDir') . "/" . $userID)) {
         $folderContent = directory_map($this->config->item('images_uploadDir') . "/" . $userID, 2);
         //die( print_r($folderContent) );
         if ($folderContent) {
             $userImages = array();
             foreach ($folderContent as $key => $item) {
                 if (!is_array($item)) {
                     //check the file extension
                     $tmp = explode(".", $item);
                     //prep allowed extensions array
                     $temp = explode("|", $this->config->item('images_allowedExtensions'));
                     if (in_array(strtolower($tmp[1]), $temp)) {
                         array_push($userImages, $item);
                     }
                 }
             }
             return $userImages;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Exemplo n.º 17
0
function shjs_scan_files($cat = 'css')
{
    $CI =& get_instance();
    $CI->load->helper('directory');
    $path = getinfo('plugins_dir') . '/shjs/' . $cat;
    $files = directory_map($path, true);
    if (!$files) {
        return '';
    }
    $all_files = array();
    // функция directory_map возвращает не только файлы, но и подкаталоги
    // нам нужно оставить только файлы. Делаем это в цикле
    foreach ($files as $file) {
        if (@is_dir($path . $file)) {
            continue;
        }
        // это каталог
        $file = str_replace('.min.js', '', $file);
        $file = str_replace('.min.css', '', $file);
        $all_files[] = $file;
    }
    // отсортируем список для красоты
    sort($all_files);
    // преобразуем массив в строчку с разделителем #
    return implode($all_files, '#');
}
Exemplo n.º 18
0
 public function form($dir)
 {
     //tampil('mahasiswa/__mahasiswa_form',$this->data);
     //echo $dir;
     $temp_dir = directory_map('C:/DIKTI');
     var_dump($temp_dir);
 }
Exemplo n.º 19
0
 /**
  * Constructor
  *
  * @access     public
  * @return     void
  */
 public function __construct()
 {
     // include parent filter class
     if (!class_exists('Low_search_filter')) {
         require_once PATH_THIRD . 'low_search/filter.low_search.php';
     }
     // Set filter path
     $this->_filter_path = PATH_THIRD . LOW_SEARCH_PACKAGE . '/filters/';
     // Load directory helper
     ee()->load->helper('directory');
     // Read filters directory and load up the filters
     foreach (directory_map($this->_filter_path, 1) as $item) {
         // Compose directory
         $dir = $this->_filter_path . $item;
         // Skip if not a dir
         if (!is_dir($dir)) {
             continue;
         }
         // Compose file name
         $file = $dir . "/lsf.{$item}.php";
         // Skip if not a file
         if (!file_exists($file)) {
             continue;
         }
         // Compose class name
         $class = 'Low_search_filter_' . $item;
         if (!class_exists($class)) {
             require_once $file;
         }
         $this->_filters[] = new $class();
     }
     // Sort by priority
     usort($this->_filters, array($this, '_by_priority'));
 }
Exemplo n.º 20
0
 public function addFolder()
 {
     $path = './app/' . VIEWFOLDERNAME . '/frontend/' . MAIN_THEME;
     $dirs = directory_map($path, FALSE, FALSE);
     Htmladmin::getFoldersRecurs($dirs);
     Backend::tpl('templates/addfolder');
 }
Exemplo n.º 21
0
 function get_widgets($type = 'core')
 {
     $widgets = array();
     if (!($files = directory_map($this->widget_path[$type], 1))) {
         return false;
     }
     foreach ($files as $file) {
         // if it is folder
         if (strpos($file, DIRECTORY_SEPARATOR)) {
             // get foldername
             $foldername = str_replace(DIRECTORY_SEPARATOR, "", $file);
             if (file_exists($this->widget_path[$type] . $file . 'Widget_' . $foldername . '.php')) {
                 // load widget class
                 $widget_obj = $this->cpformutil->load('Widget_' . $foldername, $this->widget_path[$type] . $file);
                 // get neccesary properties
                 $widget_obj->init();
                 foreach ($widget_obj as $key => $value) {
                     if (strpos($key, 'widget') !== FALSE) {
                         $widgets[$foldername][$key] = $value;
                     }
                 }
                 // get widget form
                 $widgets[$foldername]['form'] = $widget_obj->generate('paragraph');
                 // destroy object
                 unset($widget_obj);
             }
         }
     }
     return $widgets;
 }
Exemplo n.º 22
0
    public function index()
    {
        if (!$this->tank_auth->is_logged_in()) {
            redirect('/auth/login/');
        } else {
            $this->load->model('images');
            $output['user_id'] = $this->tank_auth->get_user_id();
            $output['username'] = $this->tank_auth->get_username();
            $out = array('page' => 'dashboard/selected_card', 'data' => $output);
            $this->load->view('middle.php', $out);
            $this->load->helper('directory');
            //load directory helper
            $dir = "images/";
            // Your Path to folder
            $map = directory_map($dir);
            /* This function reads the directory path specified in the first parameter and builds an array representation of it and all its contained files. */
            foreach ($map as $k) {
                ?>
     <img src="<?php 
                echo base_url($dir) . "/" . $k;
                ?>
" alt="">
   
<?php 
            }
        }
    }
Exemplo n.º 23
0
 public function init()
 {
     $this->load->library('csapp');
     //判断安装
     if (file_exists(FCPATH . 'packs/install/plub_install.lock')) {
         admin_msg(L('plub_opt_04'), site_url('opt/main'), 'no', 'red');
     }
     // 搜索本地模块
     $this->load->helper('directory');
     $local = directory_map(FCPATH . 'plugins/', 1);
     $module = array();
     if ($local) {
         foreach ($local as $dir) {
             if (is_dir(FCPATH . 'plugins/' . $dir)) {
                 $api_file = FCPATH . 'plugins/' . $dir . '/config/setting.php';
                 if (is_file($api_file)) {
                     $API = (require_once $api_file);
                     if ($API['mid']) {
                         $module[$dir] = $API['name'];
                         $modules[] = $API['mid'];
                     }
                 }
             }
         }
         unset($local);
     }
     $data['plub'] = $module;
     $data['mids'] = $modules;
     $this->load->view('init.html', $data);
 }
Exemplo n.º 24
0
 /**
  * Retrieves the list of files in a folder and preps the name and
  * filename so that it's ready for creating the HTML.
  *
  * @param  String $folder The path to the folder to retrieve
  * @param  String $type   The type of documentation being retrieved
  *                        ('application', 'bonfire', or the name of the module)
  *
  * @return Array  An associative array @see parse_ini_file for format details
  */
 private function get_folder_files($folder, $type)
 {
     $tocFile = '/_toc.ini';
     $toc = array();
     if (is_dir($folder)) {
         // If a file called _toc.ini file exists in the folder,
         // we'll skip that and use it to build the links from.
         if (is_file($folder . $tocFile)) {
             $toc = parse_ini_file($folder . $tocFile, true);
         } else {
             $map = directory_map($folder);
             if (!is_array($map)) {
                 return array();
             }
             foreach ($map as $file) {
                 if (strpos($file, 'index') === false) {
                     $title = str_replace($this->docsExt, '', $file);
                     $title = str_replace('_', ' ', $title);
                     $title = ucwords($title);
                     $toc[strtolower($type) . '/' . $file] = $title;
                 }
             }
         }
     }
     return $toc;
 }
Exemplo n.º 25
0
 function directory_map($source_dir, $directory_depth = 0, $hidden = FALSE)
 {
     if ($fp = @opendir($source_dir)) {
         $filedata = array();
         $new_depth = $directory_depth - 1;
         $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
         while (FALSE !== ($file = readdir($fp))) {
             // Remove '.', '..', and hidden files [optional]
             if (!trim($file, '.') or $hidden == FALSE && $file[0] == '.') {
                 continue;
             }
             if ($file == '.DS_Store') {
                 continue;
             }
             if (($directory_depth < 1 or $new_depth > 0) && @is_dir($source_dir . $file)) {
                 if (strstr($source_dir . $file, '.svn')) {
                     continue;
                 }
                 $filedata[$file] = directory_map($source_dir . $file . DIRECTORY_SEPARATOR, $new_depth, $hidden);
             } else {
                 $filedata[] = $file;
             }
         }
         closedir($fp);
         return $filedata;
     }
     return FALSE;
 }
Exemplo n.º 26
0
 function centinelas()
 {
     $this->load->helper('directory');
     $this->load->library('table');
     $tmpl = array('row_start' => '<tr valign="top">');
     $this->table->set_template($tmpl);
     $map = directory_map('./system/logs/');
     $lista = array();
     foreach ($map as $file) {
         if ($file != 'index.html') {
             $lista[] = anchor("supervisor/mantenimiento/borracentinela/{$file}", 'X') . " <a href='javascript:void(0)' onclick=\"carga('{$file}')\" >{$file}</a>";
         }
     }
     $copy = "<br><a href='javascript:void(0)' class='mininegro'  onclick=\"copiar()\" >Copiar texto</a>";
     $tadata = array('name' => 'sql', 'id' => 'log', 'rows' => '20', 'cols' => '60');
     $form = form_open('ejecutasql/filteredgrid/process') . form_textarea($tadata) . '<br>' . form_submit('mysubmit', 'Ejecutar como SQL') . form_close();
     $this->table->add_row(ul($lista), '<b id="fnom">Seleccione un archivo de centinela</b><br>' . $form);
     $link = site_url('supervisor/mantenimiento/vercentinela');
     $data['script'] = "<script>\n\t\t  function carga(arch){\n\t\t    link='{$link}'+'/'+arch;\n\t\t    //alert(link);\n\t\t    \$('#fnom').text(arch);\n\t\t    \$('#log').load(link);\n\t\t  };\n\t\t  function copiar(){\n\t\t    \$('#log').copy();\n\t\t  };\n\t\t</script>";
     $data['content'] = $this->table->generate();
     $data['title'] = " Centinelas ";
     //script('plugins/jquery.clipboard.pack.js')
     $data["head"] = script("jquery.pack.js") . script('plugins/jquery.copy.min.js') . $this->rapyd->get_head() . style('marcos.css') . style('estilos.css');
     $this->load->view('view_ventanas', $data);
 }
Exemplo n.º 27
0
 private static function _scan_common_modules()
 {
     $ci = get_instance();
     $ci->load->helper('directory');
     $module_dirs = array();
     $dir_map = directory_map(COMMONPATH . 'modules', 1);
     if (!empty($dir_map)) {
         foreach ($dir_map as $key => $name) {
             if (strpos($name, '.') !== false) {
                 continue;
                 // Skip files.
             }
             $module_dirs[] = rtrim($name, DIRECTORY_SEPARATOR);
         }
     }
     @sort($module_dirs);
     if (!empty($module_dirs)) {
         foreach ($module_dirs as $dir) {
             $events_file = COMMONPATH . 'modules/' . $dir . '/events.php';
             $class = 'Common_Events_' . ucfirst(strtolower($dir));
             if (is_file($events_file) && !class_exists($class, false)) {
                 include_once $events_file;
                 if (class_exists($class, false)) {
                     new $class();
                 }
             }
         }
     }
     return true;
 }
Exemplo n.º 28
0
function iconbox($name, $folder, $selected, $attrs = '')
{
    $folder = 'webroot/images/' . $folder;
    $folder_array = directory_map($folder, True);
    for ($i = 0; $i < count($folder_array); $i++) {
        if (preg_match('/(.png|.jpg|.jpeg|.gif)$/', $folder_array[$i])) {
            $nicename = explode(".", $folder_array[$i]);
            $icons_array[$i + 1] = $folder_array[$i];
            //$nicename[0];
            $nicename = "";
        }
    }
    unset($folder_array);
    asort($icons_array);
    $html = '';
    #$html .= '<div class="iconbox">';
    foreach ($icons_array as $icon) {
        $checked = $icon == $selected ? true : false;
        $data = array('name' => $name, 'id' => 'icon' . $icon, 'value' => $icon, 'checked' => $checked);
        $html .= '<div class="g' . "{$checked}" . '">';
        $html .= '<label class="ni" for="icon' . $icon . '"><img src="' . $folder . '/' . $icon . '" alt="' . $icon . '" title="' . $icon . '" width="16" height="16" /></label>';
        $html .= '<p>' . "\n" . form_radio($data, NULL, NULL, $attrs) . '</p>';
        $html .= '</div>' . "\n";
    }
    #$html .= '</div>';
    return $html;
}
Exemplo n.º 29
0
 function index()
 {
     $test_name = $this->input->get('test_name', TRUE);
     $test_full_path = APPPATH . '/unit_test/' . $test_name;
     if (!empty($test_name) && file_exists($test_full_path)) {
         include $test_full_path;
     } else {
         $this->load->helper('directory');
         $map = directory_map(APPPATH . '/unit_test/', 1);
         /**
          * 显示所有可用的测试的链接
          * 每一个函数对应于一个链接
          */
         echo "<h2>Heisenberg unit test.</h2><hr />";
         echo "<ol>";
         foreach ($map as $no => $test_name) {
             if (preg_match('/^[test].*/', $test_name)) {
                 //输出全部以test开头的测试方法的链接
                 echo "<li><a href='/unit_test/?test_name={$test_name}'>{$test_name}</a></li>";
             }
         }
         echo "</ol>";
         return;
     }
 }
Exemplo n.º 30
0
 public function index()
 {
     $this->load->helper('directory');
     $map = directory_map(APPPATH . DS . 'modules', 1);
     // get all modules
     $module = array();
     if (count($map) > 0) {
         for ($i = 0; $i < count($map); $i++) {
             $file = APPPATH . DS . 'modules' . DS . $map[$i] . DS . $map[$i] . '.xml';
             if (file_exists($file)) {
                 $module[] = $map[$i];
             }
         }
     }
     // load modules info
     $this->load->library('xml');
     $xml = new Xml();
     $modules = array();
     $j = 0;
     for ($i = 0; $i < count($module); $i++) {
         $file = APPPATH . DS . 'modules' . DS . $module[$i] . DS . $module[$i] . '.xml';
         $data = $xml->parse($file);
         if (isset($data['name']) && $data['name'] != '' && isset($data['description']) && $data['description'] != '') {
             $modules[$j] = new stdclass();
             $modules[$j]->name = $module[$i];
             $modules[$j]->title = $data['name'];
             $modules[$j]->description = $data['description'];
             $modules[$j]->thumb = 'application/modules/' . $module[$i] . '/thumb.png';
             $j++;
         }
     }
     // get page layout
     $this->load->library('xml');
     $xml = new Xml();
     $file = APPPATH . DS . 'views' . DS . 'layouts' . DS . 'layouts.xml';
     $layouts = $xml->parse($file);
     $pages = array();
     if (count($layouts)) {
         $i = 0;
         //echo '<pre>'; print_r($layouts['group']); exit;
         foreach ($layouts['group'] as $group) {
             if (empty($group['@attributes']['description'])) {
                 continue;
             }
             $pages[$i] = new stdClass();
             $pages[$i]->name = $group['@attributes']['name'];
             $pages[$i]->description = $group['@attributes']['description'];
             if (empty($group['@attributes']['icon']) || $group['@attributes']['icon'] == '') {
                 $pages[$i]->icon = base_url('assets/images/system/home.png');
             } else {
                 $pages[$i]->icon = base_url('assets/images/system/' . $group['@attributes']['icon']);
             }
             $i++;
         }
     }
     $this->data['pages'] = $pages;
     $this->data['modules'] = $modules;
     $this->load->view('admin/module/index', $this->data);
 }