예제 #1
0
 function profile_load(&$a, $nickname, $profile = 0, $profiledata = array())
 {
     $user = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1", dbesc($nickname));
     if (!$user && count($user) && !count($profiledata)) {
         logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
         notice(t('Requested account is not available.') . EOL);
         $a->error = 404;
         return;
     }
     $pdata = get_profiledata_by_nick($nickname, $user[0]['uid'], $profile);
     if ($pdata === false || !count($pdata) && !count($profiledata)) {
         logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
         notice(t('Requested profile is not available.') . EOL);
         $a->error = 404;
         return;
     }
     // fetch user tags if this isn't the default profile
     if (!$pdata['is-default']) {
         $x = q("SELECT `pub_keywords` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", intval($pdata['profile_uid']));
         if ($x && count($x)) {
             $pdata['pub_keywords'] = $x[0]['pub_keywords'];
         }
     }
     $a->profile = $pdata;
     $a->profile_uid = $pdata['profile_uid'];
     $a->profile['mobile-theme'] = get_pconfig($a->profile['profile_uid'], 'system', 'mobile_theme');
     $a->profile['network'] = NETWORK_DFRN;
     $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename'];
     //		if (!$profiledata)
     //			$_SESSION['theme'] = $a->profile['theme'];
     $_SESSION['mobile-theme'] = $a->profile['mobile-theme'];
     /**
      * load/reload current theme info
      */
     $a->set_template_engine();
     // reset the template engine to the default in case the user's theme doesn't specify one
     $theme_info_file = "view/theme/" . current_theme() . "/theme.php";
     if (file_exists($theme_info_file)) {
         require_once $theme_info_file;
     }
     if (!x($a->page, 'aside')) {
         $a->page['aside'] = '';
     }
     if (local_user() && local_user() == $a->profile['uid'] && $profiledata) {
         $a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'), array('$editprofile' => t('Edit profile'), '$profid' => $a->profile['id']));
     }
     $block = get_config('system', 'block_public') && !local_user() && !remote_user() ? true : false;
     // To-Do:
     // By now, the contact block isn't shown, when a different profile is given
     // But: When this profile was on the same server, then we could display the contacts
     if ($profiledata) {
         $a->page['aside'] .= profile_sidebar($profiledata, true);
     } else {
         $a->page['aside'] .= profile_sidebar($a->profile, $block);
     }
     /*if(! $block)
     	 $a->page['aside'] .= contact_block();*/
     return;
 }
예제 #2
0
 /**
  * If exists, this method can process local alternative values for
  * realizing the template. Type information structure dependant.
  * @param object $data the hash of label content fields
  */
 function field_preprocess(&$data)
 {
     global $CFG;
     $data->disciplinimage = str_replace(' ', '_', $data->disciplinoption);
     if (!file_exists($CFG->dirroot . "/theme/" . current_theme() . '/lppix/disciplin/' . $data->disciplinimage . ".jpg")) {
         $data->disciplinimage = 'other';
     }
 }
예제 #3
0
 /**
  * If exists, this method can process local alternative values for
  * realizing the template. Type information structure dependant.
  * @param object $data the hash of label content fields
  */
 function preprocess_data()
 {
     global $CFG;
     $this->data->stepimage = str_replace(' ', '_', $this->data->stepoption);
     if (!file_exists($CFG->dirroot . "/theme/" . current_theme() . '/lppix/taosteps/' . $this->data->stepimage . ".jpg")) {
         $this->data->stepimage = 'outofsteps';
     }
 }
 /**
  * Display the specified category.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function show($id)
 {
     $category = Category::find($id);
     if (!$category) {
         abort(404);
     }
     $viewData = ['category' => $category, 'pageTitle' => 'Category: ' . $category->title];
     if (current_theme_exists() && theme_view_exists(current_theme(), 'categories.show')) {
         return response(current_theme_view('categories.show', $viewData));
     }
     return view('categories.show', $viewData);
 }
예제 #5
0
 /**
  *
  *
  */
 function get_name()
 {
     // $textlib = textlib_get_instance();
     $this->data->customlabelcss = customlabel_get_stylesheet($this->type);
     $this->data->currenttheme = current_theme();
     $this->data->title = $this->title;
     $name = $this->make_template();
     if (empty($name)) {
         // arbitrary name
         $name = "customlabel{$customlabel->instance}";
     }
     return $name;
 }
예제 #6
0
 public function getHome()
 {
     $recentPosts = Post::where('is_published', '=', true)->orderBy('published_at', 'desc')->take(4)->get();
     $featuredPost = $recentPosts->shift();
     $more = false;
     if (Post::where('is_published', '=', true)->count() > 5) {
         $more = true;
     }
     $viewData = ['pageTitle' => 'Home', 'featuredPost' => $featuredPost, 'recentPosts' => $recentPosts, 'more' => $more];
     if (current_theme_exists() && theme_view_exists(current_theme(), 'home')) {
         return response(current_theme_view('home', $viewData));
     }
     return view('home', $viewData);
 }
function less_compiler($theme, $override = array())
{
    global $CFG;
    $swatch = $theme->settings->subtheme;
    $responsive = $theme->settings->responsive;
    $awesome = $theme->settings->awesome;
    // TODO: add setting for padding between breadcrumb and fixed navbar.
    $extra_padding = 0;
    $padding = 0;
    $icon_color = 'inherit';
    $icon_opacity = 1;
    if ($swatch == 'random') {
        $colors = array('inherit', 'red', 'yellow', 'pink', 'purple', 'orange', 'blue', 'green');
        $color_key = array_rand($colors);
        $icon_color = $colors[$color_key];
        $opacities = array(0.2, 0.4, 0.6, 0.8, 1);
        $opacity_key = array_rand($opacities);
        $icon_opacity = $colors[$opacity_key];
        $swatches = array('amelia', 'cerulean', 'cosmo', 'cyborg', 'journal', 'readable', 'simplex', 'slate', 'spacelab', 'spruce', 'superhero', 'united');
        $swatch = $swatches[array_rand($swatches)];
        $responsive = rand(0, 1);
        $awesome = rand(0, 1);
        $extra_padding = rand(0, 1);
        if ($extra_padding == 1) {
            $padding = 20;
        }
    }
    $cache_name = md5(serialize(array($swatch, $responsive, $awesome, $extra_padding, $icon_color, $icon_opacity)));
    $current_theme = current_theme();
    $cachedir = "{$CFG->cachedir}/theme/{$current_theme}";
    $cachefile = "{$cachedir}/{$cache_name}.css";
    $themedir = $theme->dir;
    $themewww = $current_theme;
    if (isset($CFG->themewww)) {
        $themewww = "{$CFG->themewww}/{$current_theme}";
    }
    $less_variables = array('swatch' => "'{$swatch}'", 'navbarMargin' => $padding, 'php_fontAwesomePath' => "'{$themewww}/pix/font'", 'iconColor' => $icon_color, 'iconOpacity' => $icon_opacity, 'php_iconSpritePath' => "'{$themewww}/pix/glyphicons-halflings.png'", 'php_iconWhiteSpritePath' => "'{$themewww}/pix/glyphicons-halflings-white.png'", 'php_horizontalComponentOffset' => '200px');
    if ($awesome) {
        $import_dirs[] = "{$themedir}/style/font-awesome";
    } else {
        $import_dirs[] = "{$themedir}/style/glyphicons";
    }
    $import_dirs[] = "{$themedir}/style";
    $less_input = less_input($swatch, $responsive);
    $output = compile($less_input, $less_variables, $import_dirs);
    $search[] = 'fonts/';
    $replace[] = $less_variables['php_fontAwesomePath'] . '/';
    $output = str_replace($search, $replace, $output);
    return $output;
}
예제 #8
0
/**
 * @brief Load page template in dependence of the template mode
 * 
 * @todo Check if this is really needed.
 */
function load_page(&$a)
{
    if (isset($_GET["mode"]) and $_GET["mode"] == "minimal") {
        require "view/theme/frio/minimal.php";
    } elseif (isset($_GET["mode"]) and $_GET["mode"] == "none") {
        require "view/theme/frio/none.php";
    } else {
        $template = 'view/theme/' . current_theme() . '/' . (x($a->page, 'template') ? $a->page['template'] : 'default') . '.php';
        if (file_exists($template)) {
            require_once $template;
        } else {
            require_once str_replace('theme/' . current_theme() . '/', '', $template);
        }
    }
}
예제 #9
0
파일: lib.php 프로젝트: ajv/Offline-Caching
/**
 * Retrieve all static files for the turbo manifest
 *
 * @return string[] The array of static files
 */
function offline_get_static_files()
{
    global $CFG, $THEME;
    // Include static JavaScript files
    $files = array($CFG->wwwroot . '/lib/javascript-static.js', $CFG->wwwroot . '/lib/javascript-deprecated.js', $CFG->wwwroot . '/lib/javascript-mod.php', $CFG->wwwroot . '/lib/overlib/overlib.js', $CFG->wwwroot . '/lib/overlib/overlib_cssstyle.js', $CFG->wwwroot . '/lib/cookies.js', $CFG->wwwroot . '/lib/ufo.js', $CFG->wwwroot . '/lib/dropdown.js', $CFG->wwwroot . '/blocks/admin_tree/admintree.js', $CFG->wwwroot . '/mod/forum/forum.js', $CFG->wwwroot . '/pix/t/stop.gif', $CFG->wwwroot . '/pix/t/go.gif');
    foreach (get_list_of_plugins() as $module) {
        $files[] = $CFG->wwwroot . '/mod/' . $module . '/icon.gif';
    }
    $themefiles = offline_get_files_from_dir($CFG->dirroot . '/theme/' . current_theme());
    $themefiles = str_replace($CFG->dirroot . '/theme', $CFG->themewww, $themefiles);
    $files = array_merge($files, $THEME->get_stylesheet_urls(), $themefiles);
    $files[] = $CFG->wwwroot . '/lib/offline/gears_init.js';
    $files = str_replace('&', '&', $files);
    return $files;
}
예제 #10
0
 /**
  * Display the specified resource.
  * GET /options/{id}
  *
  * @param  $slug
  *
  * @return Response
  */
 public function show($slug)
 {
     $themes = [];
     $currentTheme = current_theme();
     $id = '';
     $optionTabs = OptionTab::all();
     $optionTab = OptionTab::where('slug', '=', $slug)->get()->first();
     $slug = $optionTab->slug;
     $pageTitle = $optionTab->display_name . ' Options';
     $options = $optionTab->options->all();
     if ($slug == 'themes') {
         $themes = theme_manager()->all();
         $id = $optionTab->options->first()->id;
     }
     return view('options.index', compact('slug', 'optionTabs', 'options', 'pageTitle', 'themes', 'currentTheme', 'id'));
 }
예제 #11
0
/**
* get a suitable CSS for a class
* @uses $CFG
*/
function customlabel_get_stylesheet($classname)
{
    global $CFG;
    $theme = current_theme();
    $css = $CFG->themewww . "/{$theme}/customlabel/{$classname}/customlabel.css";
    $cssloc = $CFG->dirroot . "/theme/{$theme}/customlabel/{$classname}/customlabel.css";
    if (file_exists($cssloc)) {
        return $css;
    }
    $css = $CFG->wwwroot . "/mod/customlabel/type/{$classname}/customlabel.css";
    $cssloc = $CFG->dirroot . "/mod/customlabel/type/{$classname}/customlabel.css";
    if (file_exists($cssloc)) {
        return $css;
    }
    return '';
}
 function get_content()
 {
     global $CFG, $ME, $COURSE;
     //get list of themes
     $themes = get_list_of_themes();
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content->footer = '';
     $this->content->text = '';
     $context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
     if (has_capability('block/session_theme:switchthemes', $context)) {
         $this->content->text .= popup_form($ME . '?id=' . $COURSE->id . '&theme=', $themes, 'sessionthemeform', current_theme(), 'choose', '', '', true);
         $this->content->footer .= '';
     } else {
         $this->content = '';
     }
     return $this->content;
 }
 function __construct($data)
 {
     global $CFG;
     parent::__construct($data);
     $this->type = 'sequenceheading';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'heading';
     $field->size = 80;
     $field->type = 'textfield';
     $this->fields['heading'] = $field;
     $field = new StdClass();
     $field->name = 'shortdesc';
     $field->type = 'textarea';
     $this->fields['shortdesc'] = $field;
     $field = new StdClass();
     $field->name = 'imageurl';
     $field->type = 'textfield';
     $field->size = 60;
     if (!is_file($CFG->dirroot . '/theme/' . current_theme() . '/pix/customlabel_icons/defaultsequenceheading.png')) {
         $field->default = $CFG->wwwroot . '/mod/customlabel/type/sequenceheading/defaultsequenceheading.jpg';
     } else {
         $field->default = $CFG->wwwroot . '/theme/' . current_theme() . '/pix/customlabel_icons/defaultsequenceheading.png';
     }
     $this->fields['imageurl'] = $field;
     $field = new StdClass();
     $field->name = 'overimagetext';
     $field->type = 'textfield';
     $field->size = 20;
     $this->fields['overimagetext'] = $field;
     $field = new StdClass();
     $field->name = 'imageposition';
     $field->type = 'list';
     $field->options = array('none', 'left', 'right');
     $field->default = 'left';
     $this->fields['imageposition'] = $field;
     $field = new StdClass();
     $field->name = 'verticalalign';
     $field->type = 'list';
     $field->options = array('top', 'middle', 'bottom');
     $field->default = 'top';
     $this->fields['verticalalign'] = $field;
 }
function icon_check($icon_name, $type)
{
    global $CFG, $USER, $THEME;
    if ($type == 'mod') {
        $icon_name_mod = '/theme/' . current_theme() . '/pix/' . $icon_name;
    } else {
        $icon_name_mod = '/theme/' . current_theme() . '/' . $icon_name;
    }
    if ($icon_name == 'pix/i/course.gif') {
        //echo $CFG->dirroot.$icon_name_mod;
        // echo ' '.$USER->id.' ';
        print_r($USER);
    }
    if (file_exists($CFG->dirroot . $icon_name_mod)) {
        echo $CFG->wwwroot . $icon_name_mod;
    } else {
        echo '/' . $icon_name;
    }
}
예제 #15
0
 function __construct()
 {
     parent::__construct();
     $a = get_app();
     $theme = current_theme();
     // setTemplateDir can be set to an array, which Smarty will parse in order.
     // The order is thus very important here
     $template_dirs = array('theme' => "view/theme/{$theme}/" . SMARTY3_TEMPLATE_FOLDER . "/");
     if (x($a->theme_info, "extends")) {
         $template_dirs = $template_dirs + array('extends' => "view/theme/" . $a->theme_info["extends"] . "/" . SMARTY3_TEMPLATE_FOLDER . "/");
     }
     $template_dirs = $template_dirs + array('base' => "view/" . SMARTY3_TEMPLATE_FOLDER . "/");
     $this->setTemplateDir($template_dirs);
     $this->setCompileDir('view/smarty3/compiled/');
     $this->setConfigDir('view/smarty3/config/');
     $this->setCacheDir('view/smarty3/cache/');
     $this->left_delimiter = $a->get_template_ldelim('smarty3');
     $this->right_delimiter = $a->get_template_rdelim('smarty3');
     // Don't report errors so verbosely
     $this->error_reporting = E_ALL & ~E_NOTICE;
 }
예제 #16
0
파일: schema.php 프로젝트: rabuzarus/frio
/**
 * @brief: Get info header of the shema
 * 
 * This function parses the header of the shemename.php file for inormations like
 * Author, Description and Overwrites. Most of the code comes from the get_plugin_info()
 * function. We use this to get the variables which get overwritten through the shema.
 * All color variables which get overwritten through the theme have to be
 * listed (comma seperated) in the shema header under Overwrites:
 * This seemst not to be the best solution. We need to investigate further.
 * 
 * @param string $schema Name of the shema
 * @return array With theme information
 *    'author' => Author Name
 *    'description' => Schema description
 *    'version' => Schema version
 *    'overwrites' => Variables which overwriting custom settings
 */
function get_schema_info($schema)
{
    $theme = current_theme();
    $themepath = "view/theme/" . $theme . "/";
    $schema = get_pconfig(local_user(), 'frio', 'schema');
    $info = array('name' => $schema, 'description' => "", 'author' => array(), 'version' => "", 'overwrites' => "");
    if (!is_file($themepath . "schema/" . $schema . ".php")) {
        return $info;
    }
    $f = file_get_contents($themepath . "schema/" . $schema . ".php");
    $r = preg_match("|/\\*.*\\*/|msU", $f, $m);
    if ($r) {
        $ll = explode("\n", $m[0]);
        foreach ($ll as $l) {
            $l = trim($l, "\t\n\r */");
            if ($l != "") {
                list($k, $v) = array_map("trim", explode(":", $l, 2));
                $k = strtolower($k);
                if ($k == "author") {
                    $r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
                    if ($r) {
                        $info['author'][] = array('name' => $m[1], 'link' => $m[2]);
                    } else {
                        $info['author'][] = array('name' => $v);
                    }
                } elseif ($k == "overwrites") {
                    $theme_settings = explode(',', str_replace(' ', '', $v));
                    foreach ($theme_settings as $key => $value) {
                        $info["overwrites"][$value] = true;
                    }
                } else {
                    if (array_key_exists($k, $info)) {
                        $info[$k] = $v;
                    }
                }
            }
        }
    }
    return $info;
}
예제 #17
0
 function __construct()
 {
     parent::__construct();
     $a = get_app();
     $theme = current_theme();
     // setTemplateDir can be set to an array, which Smarty will parse in order.
     // The order is thus very important here
     $template_dirs = array('theme' => "view/theme/{$theme}/tpl/");
     if (x(App::$theme_info, "extends")) {
         $template_dirs = $template_dirs + array('extends' => "view/theme/" . App::$theme_info["extends"] . "/tpl/");
     }
     $template_dirs = $template_dirs + array('base' => 'view/tpl/');
     $this->setTemplateDir($template_dirs);
     $basecompiledir = App::$config['system']['smarty3_folder'];
     $this->setCompileDir($basecompiledir . '/compiled/');
     $this->setConfigDir($basecompiledir . '/config/');
     $this->setCacheDir($basecompiledir . '/cache/');
     $this->left_delimiter = App::get_template_ldelim('smarty3');
     $this->right_delimiter = App::get_template_rdelim('smarty3');
     // Don't report errors so verbosely
     $this->error_reporting = E_ALL & ~E_NOTICE;
 }
예제 #18
0
function moodle_optimization_stylessheets_setup_event_handler($eventdata)
{
    global $CFG, $HTTPSPAGEREQUIRED;
    if (empty($CFG->stylesheets)) {
        return true;
        // nothing to do, this should never happen
    }
    // get it back to wwwroot since we are going to compile these files into one
    if (!empty($HTTPSPAGEREQUIRED)) {
        foreach ($CFG->stylesheets as $key => $stylesheet) {
            $CFG->stylesheets[$key] = str_replace('https:', 'http:', $stylesheet);
        }
    }
    // convert into a operating system directory
    foreach ($CFG->stylesheets as $key => $stylesheet) {
        $CFG->stylesheets[$key] = str_replace($CFG->wwwroot, $CFG->dirroot, $stylesheet);
    }
    // print the new link
    $version = get_field('mo_cache_versions', 'version', 'source', 'theme' . current_theme());
    $CFG->stylesheets = array();
    $CFG->stylesheets[] = $CFG->wwwroot . '/mod/moodle_optimization/styles.css?version=' . $version;
    return true;
}
예제 #19
0
파일: lib.php 프로젝트: ajv/Offline-Caching
 protected function get_init_params($elementid, array $options = null)
 {
     global $CFG, $PAGE;
     //TODO: we need to implement user preferences that affec tthe editor setup too
     //TODO: reimplement rulesets, maybe it would be better to implement it some other way
     //$xmlruleset     = file_get_contents('extra/xhtml_ruleset.txt');
     $directionality = get_string('thisdirection');
     $strtime = get_string('strftimetime');
     $strdate = get_string('strftimedaydate');
     $lang = str_replace('_utf8', '', current_language());
     // use more standard language codes
     $contentcss = $CFG->themewww . '/' . current_theme() . '/styles.php';
     // should be customizable
     $context = empty($options['context']) ? get_context_instance(CONTEXT_SYSTEM) : $options['context'];
     if (!empty($options['legacy'])) {
         $xmedia = '';
     } else {
         if (!empty($options['noclean']) or !empty($options['trusted'])) {
             $xmedia = 'media,';
         } else {
             $xmedia = '';
         }
     }
     $filters = filter_get_active_in_context($context);
     if (array_key_exists('filter/tex', $filters)) {
         $xdragmath = 'dragmath,';
     } else {
         $xdragmath = '';
     }
     $params = array('mode' => "exact", 'elements' => $elementid, 'relative_urls' => false, 'document_base_url' => $CFG->httpswwwroot, 'content_css' => $contentcss, 'language' => $lang, 'directionality' => $directionality, 'plugin_insertdate_dateFormat ' => $strdate, 'plugin_insertdate_timeFormat ' => $strtime, 'theme' => "advanced", 'skin' => "o2k7", 'skin_variant' => "silver", 'apply_source_formatting' => true, 'remove_script_host' => false, 'entity_encoding' => "raw", 'plugins' => "safari,table,style,layer,advhr,advimage,advlink,emotions,inlinepopups,{$xmedia}searchreplace,paste,directionality,fullscreen,moodlenolink,{$xdragmath}nonbreaking,contextmenu,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak", 'theme_advanced_font_sizes' => "1,2,3,4,5,6,7", 'theme_advanced_layout_manager' => "SimpleLayout", 'theme_advanced_toolbar_align' => "left", 'theme_advanced_buttons1' => "fontselect,fontsizeselect,formatselect,styleselect", 'theme_advanced_buttons1_add' => "|,undo,redo,|,search,replace,|,fullscreen", 'theme_advanced_buttons2' => "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull,|,cite,abbr,acronym", 'theme_advanced_buttons2_add' => "|,selectall,cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl", 'theme_advanced_buttons3' => "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,anchor,|,emotions,image,{$xmedia}{$xdragmath}advhr,nonbreaking,charmap", 'theme_advanced_buttons3_add' => "|,table,insertlayer,styleprops,visualchars,|,code,preview", 'theme_advanced_fonts' => "Trebuchet=Trebuchet MS,Verdana,Arial,Helvetica,sans-serif;Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;Wingdings=wingdings", 'theme_advanced_resize_horizontal' => true, 'theme_advanced_resizing' => true, 'theme_advanced_toolbar_location' => "top", 'theme_advanced_statusbar_location' => "bottom");
     if (empty($options['legacy'])) {
         if (isset($options['maxfiles']) and $options['maxfiles'] != 0) {
             $params['file_browser_callback'] = "mce_moodlefilemanager";
         }
     }
     return $params;
 }
예제 #20
0
<?php

if (!empty($THEME->chameleonenabled)) {
    $chameleon_isadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
    $chameleon_isteacher = false;
    if ($COURSE->id == SITEID) {
        $chameleon_courseparam = '';
    } else {
        $chameleon_courseparam = '?id=' . $COURSE->id;
        $chameleon_isteacher = !empty($COURSE->theme) and has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $COURSE->id));
    }
    if ($chameleon_isadmin or $chameleon_isteacher and !empty($CFG->allowcoursethemes) and !empty($THEME->chameleonteachereditenabled)) {
        // either we're an admin or we're a teacher and this is being used as the course theme
        // if we're on a page using a course theme edit that, otherwise edit the main chameleon theme
        // $chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : $CFG->theme;
        $chameleon_theme = current_theme();
        ?>

<style type="text/css"> @import '<?php 
        echo "{$CFG->themewww}/{$chameleon_theme}";
        ?>
/ui/chameleon_ui.css'; </style>

<script type="text/javascript" src="<?php 
        echo "{$CFG->themewww}/{$chameleon_theme}/ui/css_query.js";
        ?>
"> </script>
<script type="text/javascript" src="<?php 
        echo "{$CFG->themewww}/{$chameleon_theme}/ui/sarissa.js";
        ?>
"> </script>
예제 #21
0
     $func($a);
 }
 if (!$a->error) {
     // If a theme has defined an _aside() function, run that first
     //
     // If the theme function doesn't exist, see if this theme extends another,
     // and see if that other theme has an _aside() function--if it does, run it
     //
     // If $aside_default is not False after the theme _aside() function, run the
     // module's _aside() function too
     //
     // This gives themes more control over how the sidebar looks
     $aside_default = true;
     call_hooks($a->module . '_mod_aside', $placeholder);
     if (function_exists(str_replace('-', '_', current_theme()) . '_' . $a->module . '_aside')) {
         $func = str_replace('-', '_', current_theme()) . '_' . $a->module . '_aside';
         $aside_default = $func($a);
     } elseif ($aside_default && x($a->theme_info, "extends") && function_exists(str_replace('-', '_', $a->theme_info["extends"]) . '_' . $a->module . '_aside')) {
         $func = str_replace('-', '_', $a->theme_info["extends"]) . '_' . $a->module . '_aside';
         $aside_default = $func($a);
     }
     if ($aside_default && function_exists($a->module . '_aside')) {
         $func = $a->module . '_aside';
         $func($a);
     }
 }
 if (!$a->error && function_exists($a->module . '_content')) {
     $arr = array('content' => $a->page['content']);
     call_hooks($a->module . '_mod_content', $arr);
     $a->page['content'] = $arr['content'];
     $func = $a->module . '_content';
예제 #22
0
function theme_setup($theme = '', $params = NULL)
{
    /// Sets up global variables related to themes
    global $CFG, $THEME, $SESSION, $USER, $HTTPSPAGEREQUIRED, $PAGE;
    /// Do not mess with THEME if header already printed - this would break all the extra stuff in global $THEME from print_header()!!
    if ($PAGE->headerprinted) {
        return;
    }
    if (empty($theme)) {
        $theme = current_theme();
    }
    /// If the theme doesn't exist for some reason then revert to standardwhite
    if (!file_exists($CFG->themedir . '/' . $theme . '/config.php')) {
        $CFG->theme = $theme = 'standardwhite';
    }
    /// Load up the theme config
    $THEME = NULL;
    // Just to be sure
    include $CFG->themedir . '/' . $theme . '/config.php';
    // Main config for current theme
    /// Put together the parameters
    if (!$params) {
        $params = array();
    }
    if ($theme != $CFG->theme) {
        $params[] = 'forceconfig=' . $theme;
    }
    /// Force language too if required
    if (!empty($THEME->langsheets)) {
        $params[] = 'lang=' . current_language();
    }
    /// Convert params to string
    if ($params) {
        $paramstring = '?' . implode('&', $params);
    } else {
        $paramstring = '';
    }
    /// Set up image paths
    if (isset($CFG->smartpix) && $CFG->smartpix == 1) {
        if ($CFG->slasharguments) {
            // Use this method if possible for better caching
            $extra = '';
        } else {
            $extra = '?file=';
        }
        $CFG->pixpath = $CFG->wwwroot . '/pix/smartpix.php' . $extra . '/' . $theme;
        $CFG->modpixpath = $CFG->wwwroot . '/pix/smartpix.php' . $extra . '/' . $theme . '/mod';
    } else {
        if (empty($THEME->custompix)) {
            // Could be set in the above file
            $CFG->pixpath = $CFG->wwwroot . '/pix';
            $CFG->modpixpath = $CFG->wwwroot . '/mod';
        } else {
            $CFG->pixpath = $CFG->themewww . '/' . $theme . '/pix';
            $CFG->modpixpath = $CFG->themewww . '/' . $theme . '/pix/mod';
        }
    }
    /// Header and footer paths
    $CFG->header = $CFG->themedir . '/' . $theme . '/header.html';
    $CFG->footer = $CFG->themedir . '/' . $theme . '/footer.html';
    /// Define stylesheet loading order
    $CFG->stylesheets = array();
    if ($theme != 'standard') {
        /// The standard sheet is always loaded first
        $CFG->stylesheets[] = $CFG->themewww . '/standard/styles.php' . $paramstring;
    }
    if (!empty($THEME->parent)) {
        /// Parent stylesheets are loaded next
        $CFG->stylesheets[] = $CFG->themewww . '/' . $THEME->parent . '/styles.php' . $paramstring;
    }
    $CFG->stylesheets[] = $CFG->themewww . '/' . $theme . '/styles.php' . $paramstring;
    /// We have to change some URLs in styles if we are in a $HTTPSPAGEREQUIRED page
    if (!empty($HTTPSPAGEREQUIRED)) {
        $CFG->themewww = str_replace('http:', 'https:', $CFG->themewww);
        $CFG->pixpath = str_replace('http:', 'https:', $CFG->pixpath);
        $CFG->modpixpath = str_replace('http:', 'https:', $CFG->modpixpath);
        foreach ($CFG->stylesheets as $key => $stylesheet) {
            $CFG->stylesheets[$key] = str_replace('http:', 'https:', $stylesheet);
        }
    }
    // RTL support - only for RTL languages, add RTL CSS
    if (get_string('thisdirection') == 'rtl') {
        $CFG->stylesheets[] = $CFG->themewww . '/standard/rtl.css' . $paramstring;
        $CFG->stylesheets[] = $CFG->themewww . '/' . $theme . '/rtl.css' . $paramstring;
    }
    /// Set up the block regions.
    if (!empty($THEME->blockregions)) {
        $PAGE->blocks->add_regions($THEME->blockregions);
    } else {
        // Support legacy themes by supplying a sensible default.
        $PAGE->blocks->add_regions(array('side-pre', 'side-post'));
    }
    if (!empty($THEME->defaultblockregion)) {
        $PAGE->blocks->set_default_region($THEME->defaultblockregion);
    } else {
        // Support legacy themes by supplying a sensible default.
        $PAGE->blocks->set_default_region('side-post');
    }
}
예제 #23
0
 function Dispatch(&$a)
 {
     /**
      * Call module functions
      */
     if (\App::$module_loaded) {
         \App::$page['page_title'] = \App::$module;
         $placeholder = '';
         /**
          * No theme has been specified when calling the module_init functions
          * For this reason, please restrict the use of templates to those which
          * do not provide any presentation details - as themes will not be able
          * to over-ride them.
          */
         $arr = array('init' => true, 'replace' => false);
         call_hooks(\App::$module . '_mod_init', $arr);
         if (!$arr['replace']) {
             if ($this->controller && method_exists($this->controller, 'init')) {
                 $this->controller->init();
             } elseif (function_exists(\App::$module . '_init')) {
                 $func = \App::$module . '_init';
                 $func($a);
             }
         }
         /**
          * Do all theme initialisation here before calling any additional module functions.
          * The module_init function may have changed the theme.
          * Additionally any page with a Comanche template may alter the theme.
          * So we'll check for those now.
          */
         /**
          * In case a page has overloaded a module, see if we already have a layout defined
          * otherwise, if a PDL file exists for this module, use it
          * The member may have also created a customised PDL that's stored in the config
          */
         load_pdl($a);
         /**
          * load current theme info
          */
         $theme_info_file = 'view/theme/' . current_theme() . '/php/theme.php';
         if (file_exists($theme_info_file)) {
             require_once $theme_info_file;
         }
         if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
             $func = str_replace('-', '_', current_theme()) . '_init';
             $func($a);
         } elseif (x(\App::$theme_info, 'extends') && file_exists('view/theme/' . \App::$theme_info['extends'] . '/php/theme.php')) {
             require_once 'view/theme/' . \App::$theme_info['extends'] . '/php/theme.php';
             if (function_exists(str_replace('-', '_', \App::$theme_info['extends']) . '_init')) {
                 $func = str_replace('-', '_', \App::$theme_info['extends']) . '_init';
                 $func($a);
             }
         }
         if ($_SERVER['REQUEST_METHOD'] === 'POST' && !\App::$error && !x($_POST, 'auth-params')) {
             call_hooks(\App::$module . '_mod_post', $_POST);
             if ($this->controller && method_exists($this->controller, 'post')) {
                 $this->controller->post();
             } elseif (function_exists(\App::$module . '_post')) {
                 $func = \App::$module . '_post';
                 $func($a);
             }
         }
         if (!\App::$error) {
             $arr = array('content' => \App::$page['content'], 'replace' => false);
             call_hooks(\App::$module . '_mod_content', $arr);
             \App::$page['content'] = $arr['content'];
             if (!$arr['replace']) {
                 if ($this->controller && method_exists($this->controller, 'get')) {
                     $arr = array('content' => $this->controller->get());
                 } elseif (function_exists(\App::$module . '_content')) {
                     $func = \App::$module . '_content';
                     $arr = array('content' => $func($a));
                 }
             }
             call_hooks(\App::$module . '_mod_aftercontent', $arr);
             \App::$page['content'] .= $arr['content'];
         }
     }
 }
예제 #24
0
 function call_hooks($name, &$data = null)
 {
     $stamp1 = microtime(true);
     $a = get_app();
     if (is_array($a->hooks) && array_key_exists($name, $a->hooks)) {
         foreach ($a->hooks[$name] as $hook) {
             // Don't run a theme's hook if the user isn't using the theme
             if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . current_theme()) === false) {
                 continue;
             }
             @(include_once $hook[0]);
             if (function_exists($hook[1])) {
                 $func = $hook[1];
                 $func($a, $data);
             } else {
                 // remove orphan hooks
                 q("delete from hook where hook = '%s' and file = '%s' and function = '%s'", dbesc($name), dbesc($hook[0]), dbesc($hook[1]));
             }
         }
     }
 }
예제 #25
0
파일: text.php 프로젝트: jzacman/friendica
 /**
  *
  * @param App $a
  * @param string $filename
  * @param string $root
  * @return string
  */
 function get_template_file($a, $filename, $root = '')
 {
     $theme = current_theme();
     // Make sure $root ends with a slash /
     if ($root !== '' && $root[strlen($root) - 1] !== '/') {
         $root = $root . '/';
     }
     if (file_exists("{$root}view/theme/{$theme}/{$filename}")) {
         $template_file = "{$root}view/theme/{$theme}/{$filename}";
     } elseif (x($a->theme_info, "extends") && file_exists("{$root}view/theme/{$a->theme_info["extends"]}/{$filename}")) {
         $template_file = "{$root}view/theme/{$a->theme_info["extends"]}/{$filename}";
     } elseif (file_exists("{$root}/{$filename}")) {
         $template_file = "{$root}/{$filename}";
     } else {
         $template_file = "{$root}view/{$filename}";
     }
     return $template_file;
 }
예제 #26
0
파일: boot.php 프로젝트: HaakonME/redmatrix
/**
 * @brief build the page.
 *
 * Build the page - now that we have all the components
 *
 * @param App &$a global application object
 */
function construct_page(&$a)
{
    exec_pdl($a);
    $comanche = count($a->layout) ? true : false;
    require_once theme_include('theme_init.php');
    $installing = false;
    if ($a->module == 'setup') {
        $installing = true;
    } else {
        nav($a);
    }
    if ($comanche) {
        if ($a->layout['nav']) {
            $a->page['nav'] = get_custom_nav($a, $a->layout['nav']);
        }
    }
    if (($p = theme_include(current_theme() . '.js')) != '') {
        head_add_js($p);
    }
    if (($p = theme_include('mod_' . $a->module . '.php')) != '') {
        require_once $p;
    }
    require_once 'include/js_strings.php';
    if (x($a->page, 'template_style')) {
        head_add_css($a->page['template_style'] . '.css');
    } else {
        head_add_css((x($a->page, 'template') ? $a->page['template'] : 'default') . '.css');
    }
    head_add_css('mod_' . $a->module . '.css');
    head_add_css(current_theme_url($installing));
    head_add_js('mod_' . $a->module . '.js');
    $a->build_pagehead();
    $arr = $a->get_widgets();
    ksort($arr, SORT_NUMERIC);
    if (count($arr)) {
        foreach ($arr as $x) {
            if (!array_key_exists($x['location'], $a->page)) {
                $a->page[$x['location']] = '';
            }
            $a->page[$x['location']] .= $x['html'];
        }
    }
    // Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'.
    // The text 'region=' identifies a section of the layout by that name. So what we want to do here is leave
    // $a->page['nav'] empty and put the default content from $a->page['nav'] and $a->page['section']
    // into a new region called $a->data['content']. It is presumed that the chosen layout file for this comanche page
    // has a '<content>' element instead of a '<section>'.
    // This way the Comanche layout can include any existing content, alter the layout by adding stuff around it or changing the
    // layout completely with a new layout definition, or replace/remove existing content.
    if ($comanche) {
        $arr = array('module' => $a->module, 'layout' => $a->layout);
        call_hooks('construct_page', $arr);
        $a->layout = $arr['layout'];
        foreach ($a->layout as $k => $v) {
            if (strpos($k, 'region_') === 0 && strlen($v)) {
                if (strpos($v, '$region_') !== false) {
                    $v = preg_replace_callback('/\\$region_([a-zA-Z0-9]+)/ism', 'comanche_replace_region', $v);
                }
                // And a couple of convenience macros
                if (strpos($v, '$htmlhead') !== false) {
                    $v = str_replace('$htmlhead', $a->page['htmlhead'], $v);
                }
                if (strpos($v, '$nav') !== false) {
                    $v = str_replace('$nav', $a->page['nav'], $v);
                }
                if (strpos($v, '$content') !== false) {
                    $v = str_replace('$content', $a->page['content'], $v);
                }
                $a->page[substr($k, 7)] = $v;
            }
        }
    }
    if ($a->is_mobile || $a->is_tablet) {
        if (isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) {
            $link = $a->get_baseurl() . '/toggle_mobile?f=&address=' . curPageURL();
        } else {
            $link = $a->get_baseurl() . '/toggle_mobile?f=&off=1&address=' . curPageURL();
        }
        if (isset($_SESSION) && $_SESSION['mobile_theme'] != '' && $_SESSION['mobile_theme'] != '---' || isset($a->config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme'])) {
            $a->page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array('$toggle_link' => $link, '$toggle_text' => t('toggle mobile')));
        }
    }
    $page = $a->page;
    $profile = $a->profile;
    header("Content-type: text/html; charset=utf-8");
    require_once theme_include((x($a->page, 'template') ? $a->page['template'] : 'default') . '.php');
}
예제 #27
0
파일: cloud.php 프로젝트: Mauru/red
/**
 * @brief Fires up the SabreDAV server.
 *
 * @param App &$a
 */
function cloud_init(&$a)
{
    // call ($currenttheme)_init since we're operating outside of index.php
    $theme_info_file = "view/theme/" . current_theme() . "/php/theme.php";
    if (file_exists($theme_info_file)) {
        require_once $theme_info_file;
        if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
            $func = str_replace('-', '_', current_theme()) . '_init';
            $func($a);
        }
    }
    require_once 'include/reddav.php';
    if (!is_dir('store')) {
        os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
    }
    $which = null;
    if (argc() > 1) {
        $which = argv(1);
    }
    $profile = 0;
    $channel = $a->get_channel();
    $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which . '" />' . "\r\n";
    if ($which) {
        profile_load($a, $which, $profile);
    }
    $auth = new RedBasicAuth();
    $ob_hash = get_observer_hash();
    if ($ob_hash) {
        if (local_user()) {
            $channel = $a->get_channel();
            $auth->setCurrentUser($channel['channel_address']);
            $auth->channel_name = $channel['channel_address'];
            $auth->channel_id = $channel['channel_id'];
            $auth->channel_hash = $channel['channel_hash'];
            $auth->channel_account_id = $channel['channel_account_id'];
            if ($channel['channel_timezone']) {
                $auth->timezone = $channel['channel_timezone'];
            }
        }
        $auth->observer = $ob_hash;
    }
    if ($_GET['davguest']) {
        $_SESSION['davguest'] = true;
    }
    $_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
    $_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
    $_SERVER['QUERY_STRING'] = preg_replace('/[\\?&]davguest=(.*?)([\\?&]|$)/ism', '', $_SERVER['QUERY_STRING']);
    $_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']);
    $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']);
    $_SERVER['REQUEST_URI'] = preg_replace('/[\\?&]davguest=(.*?)([\\?&]|$)/ism', '', $_SERVER['REQUEST_URI']);
    $rootDirectory = new RedDirectory('/', $auth);
    // A SabreDAV server-object
    $server = new DAV\Server($rootDirectory);
    // prevent overwriting changes each other with a lock backend
    $lockBackend = new DAV\Locks\Backend\File('store/[data]/locks');
    $lockPlugin = new DAV\Locks\Plugin($lockBackend);
    $server->addPlugin($lockPlugin);
    // The next section of code allows us to bypass prompting for http-auth if a FILE is being accessed anonymously and permissions
    // allow this. This way one can create hotlinks to public media files in their cloud and anonymous viewers won't get asked to login.
    // If a DIRECTORY is accessed or there are permission issues accessing the file and we aren't previously authenticated via zot,
    // prompt for HTTP-auth. This will be the default case for mounting a DAV directory.
    // In order to avoid prompting for passwords for viewing a DIRECTORY, add the URL query parameter 'davguest=1'
    $isapublic_file = false;
    $davguest = x($_SESSION, 'davguest') ? true : false;
    if (!$auth->observer && $_SERVER['REQUEST_METHOD'] === 'GET') {
        try {
            $x = RedFileData('/' . $a->cmd, $auth);
            if ($x instanceof RedFile) {
                $isapublic_file = true;
            }
        } catch (Exception $e) {
            $isapublic_file = false;
        }
    }
    if (!$auth->observer && !$isapublic_file && !$davguest) {
        try {
            $auth->Authenticate($server, t('Red Matrix - Guests: Username: {your email address}, Password: +++'));
        } catch (Exception $e) {
            logger('mod_cloud: auth exception' . $e->getMessage());
            http_status_exit($e->getHTTPCode(), $e->getMessage());
        }
    }
    // provide a directory view for the cloud in Red Matrix
    $browser = new RedBrowser($auth);
    $auth->setBrowserPlugin($browser);
    $server->addPlugin($browser);
    // All we need to do now, is to fire up the server
    $server->exec();
    killme();
}
예제 #28
0
/**
 * Add a "toggle mobile" link if we're using a mobile device
 */
if ($a->is_mobile || $a->is_tablet) {
    if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
        $link = $a->get_baseurl() . '/toggle_mobile?address=' . curPageURL();
    } else {
        $link = $a->get_baseurl() . '/toggle_mobile?off=1&address=' . curPageURL();
    }
    $a->page['footer'] = replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array('$toggle_link' => $link, '$toggle_text' => t('toggle mobile')));
}
/**
 * Build the page - now that we have all the components
 */
if (!$a->theme['stylesheet']) {
    $stylesheet = current_theme_url();
} else {
    $stylesheet = $a->theme['stylesheet'];
}
$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
$page = $a->page;
$profile = $a->profile;
header("Content-type: text/html; charset=utf-8");
$template = 'view/theme/' . current_theme() . '/' . (x($a->page, 'template') ? $a->page['template'] : 'default') . '.php';
if (file_exists($template)) {
    require_once $template;
} else {
    require_once str_replace('theme/' . current_theme() . '/', '', $template);
}
session_write_close();
exit;
예제 #29
0
 /**
  * @brief Creates the directory listing for the given path.
  *
  * @param string $path which should be displayed
  */
 public function generateDirectoryIndex($path)
 {
     // (owner_id = channel_id) is visitor owner of this directory?
     $is_owner = local_channel() && $this->auth->owner_id == local_channel() ? true : false;
     if ($this->auth->getTimezone()) {
         date_default_timezone_set($this->auth->getTimezone());
     }
     require_once 'include/conversation.php';
     require_once 'include/text.php';
     if ($this->auth->owner_nick) {
         $html = profile_tabs(get_app(), $is_owner ? true : false, $this->auth->owner_nick);
     }
     $files = $this->server->getPropertiesForPath($path, array('{DAV:}displayname', '{DAV:}resourcetype', '{DAV:}getcontenttype', '{DAV:}getcontentlength', '{DAV:}getlastmodified'), 1);
     $parent = $this->server->tree->getNodeForPath($path);
     $parentpath = array();
     // only show parent if not leaving /cloud/; TODO how to improve this?
     if ($path && $path != "cloud") {
         list($parentUri) = \Sabre\HTTP\URLUtil::splitPath($path);
         $fullPath = \Sabre\HTTP\URLUtil::encodePath($this->server->getBaseUri() . $parentUri);
         $parentpath['icon'] = $this->enableAssets ? '<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl('icons/parent' . $this->iconExtension) . '" width="24" alt="' . t('parent') . '"></a>' : '';
         $parentpath['path'] = $fullPath;
     }
     $f = array();
     foreach ($files as $file) {
         $ft = array();
         $type = null;
         // This is the current directory, we can skip it
         if (rtrim($file['href'], '/') == $path) {
             continue;
         }
         list(, $name) = \Sabre\HTTP\URLUtil::splitPath($file['href']);
         if (isset($file[200]['{DAV:}resourcetype'])) {
             $type = $file[200]['{DAV:}resourcetype']->getValue();
             // resourcetype can have multiple values
             if (!is_array($type)) {
                 $type = array($type);
             }
             foreach ($type as $k => $v) {
                 // Some name mapping is preferred
                 switch ($v) {
                     case '{DAV:}collection':
                         $type[$k] = t('Collection');
                         break;
                     case '{DAV:}principal':
                         $type[$k] = t('Principal');
                         break;
                     case '{urn:ietf:params:xml:ns:carddav}addressbook':
                         $type[$k] = t('Addressbook');
                         break;
                     case '{urn:ietf:params:xml:ns:caldav}calendar':
                         $type[$k] = t('Calendar');
                         break;
                     case '{urn:ietf:params:xml:ns:caldav}schedule-inbox':
                         $type[$k] = t('Schedule Inbox');
                         break;
                     case '{urn:ietf:params:xml:ns:caldav}schedule-outbox':
                         $type[$k] = t('Schedule Outbox');
                         break;
                     case '{http://calendarserver.org/ns/}calendar-proxy-read':
                         $type[$k] = 'Proxy-Read';
                         break;
                     case '{http://calendarserver.org/ns/}calendar-proxy-write':
                         $type[$k] = 'Proxy-Write';
                         break;
                 }
             }
             $type = implode(', ', $type);
         }
         // If no resourcetype was found, we attempt to use
         // the contenttype property
         if (!$type && isset($file[200]['{DAV:}getcontenttype'])) {
             $type = $file[200]['{DAV:}getcontenttype'];
         }
         if (!$type) {
             $type = t('Unknown');
         }
         $size = isset($file[200]['{DAV:}getcontentlength']) ? (int) $file[200]['{DAV:}getcontentlength'] : '';
         $lastmodified = isset($file[200]['{DAV:}getlastmodified']) ? $file[200]['{DAV:}getlastmodified']->getTime()->format('Y-m-d H:i:s') : '';
         $fullPath = \Sabre\HTTP\URLUtil::encodePath('/' . trim($this->server->getBaseUri() . ($path ? $path . '/' : '') . $name, '/'));
         $displayName = isset($file[200]['{DAV:}displayname']) ? $file[200]['{DAV:}displayname'] : $name;
         $displayName = $this->escapeHTML($displayName);
         $type = $this->escapeHTML($type);
         $icon = '';
         if ($this->enableAssets) {
             $node = $this->server->tree->getNodeForPath(($path ? $path . '/' : '') . $name);
             foreach (array_reverse($this->iconMap) as $class => $iconName) {
                 if ($node instanceof $class) {
                     $icon = '<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl($iconName . $this->iconExtension) . '" alt="" width="24"></a>';
                     break;
                 }
             }
         }
         $parentHash = '';
         $owner = $this->auth->owner_id;
         $splitPath = explode('/', $fullPath);
         if (count($splitPath) > 3) {
             for ($i = 3; $i < count($splitPath); $i++) {
                 $attachName = urldecode($splitPath[$i]);
                 $attachHash = $this->findAttachHash($owner, $parentHash, $attachName);
                 $parentHash = $attachHash;
             }
         }
         $attachIcon = "";
         // "<a href=\"attach/".$attachHash."\" title=\"".$displayName."\"><i class=\"fa fa-arrow-circle-o-down\"></i></a>";
         // put the array for this file together
         $ft['attachId'] = $this->findAttachIdByHash($attachHash);
         $ft['fileStorageUrl'] = substr($fullPath, 0, strpos($fullPath, "cloud/")) . "filestorage/" . $this->auth->getCurrentUser();
         $ft['icon'] = $icon;
         $ft['attachIcon'] = $size ? $attachIcon : '';
         // @todo Should this be an item value, not a global one?
         $ft['is_owner'] = $is_owner;
         $ft['fullPath'] = $fullPath;
         $ft['displayName'] = $displayName;
         $ft['type'] = $type;
         $ft['size'] = $size;
         $ft['sizeFormatted'] = userReadableSize($size);
         $ft['lastmodified'] = $lastmodified ? datetime_convert('UTC', date_default_timezone_get(), $lastmodified) : '';
         $ft['iconFromType'] = getIconFromType($type);
         $f[] = $ft;
     }
     $output = '';
     if ($this->enablePost) {
         $this->server->emit('onHTMLActionsPanel', array($parent, &$output));
     }
     $html .= replace_macros(get_markup_template('cloud.tpl'), array('$header' => t('Files') . ": " . $this->escapeHTML($path) . "/", '$total' => t('Total'), '$actionspanel' => $output, '$shared' => t('Shared'), '$create' => t('Create'), '$upload' => t('Upload'), '$is_owner' => $is_owner, '$parentpath' => $parentpath, '$entries' => $f, '$name' => t('Name'), '$type' => t('Type'), '$size' => t('Size'), '$lastmod' => t('Last Modified'), '$parent' => t('parent'), '$edit' => t('Edit'), '$delete' => t('Delete'), '$nick' => $this->auth->getCurrentUser()));
     $a = get_app();
     \App::$page['content'] = $html;
     load_pdl($a);
     $theme_info_file = "view/theme/" . current_theme() . "/php/theme.php";
     if (file_exists($theme_info_file)) {
         require_once $theme_info_file;
         if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
             $func = str_replace('-', '_', current_theme()) . '_init';
             $func($a);
         }
     }
     construct_page($a);
 }
예제 #30
0
파일: index.php 프로젝트: bashrc/hubzilla
  */
 /**
  * In case a page has overloaded a module, see if we already have a layout defined
  * otherwise, if a PDL file exists for this module, use it
  * The member may have also created a customised PDL that's stored in the config
  */
 load_pdl($a);
 /**
  * load current theme info
  */
 $theme_info_file = 'view/theme/' . current_theme() . '/php/theme.php';
 if (file_exists($theme_info_file)) {
     require_once $theme_info_file;
 }
 if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
     $func = str_replace('-', '_', current_theme()) . '_init';
     $func($a);
 } elseif (x($a->theme_info, 'extends') && file_exists('view/theme/' . $a->theme_info['extends'] . '/php/theme.php')) {
     require_once 'view/theme/' . $a->theme_info['extends'] . '/php/theme.php';
     if (function_exists(str_replace('-', '_', $a->theme_info['extends']) . '_init')) {
         $func = str_replace('-', '_', $a->theme_info['extends']) . '_init';
         $func($a);
     }
 }
 if ($_SERVER['REQUEST_METHOD'] === 'POST' && !$a->error && function_exists($a->module . '_post') && !x($_POST, 'auth-params')) {
     call_hooks($a->module . '_mod_post', $_POST);
     $func = $a->module . '_post';
     $func($a);
 }
 if (!$a->error && function_exists($a->module . '_content')) {
     $arr = array('content' => $a->page['content'], 'replace' => false);