Пример #1
0
/**
 * SET
 * Add data to a cache file
 */
function set($key, $data)
{
    // Get file path
    $file_path = get_file_path($key);
    // Add content to file
    file_put_contents($file_path, serialize($data));
}
Пример #2
0
 function loadController()
 {
     $controllerName = $this->router->getController();
     $controllerPath = get_file_path($controllerName, "controllers");
     if (file_exists($controllerPath)) {
         require $controllerPath;
         $controller = new $controllerName();
         return $controller;
     } else {
         $this->showError("Not found controller.");
         return false;
     }
 }
function ParsePHPFile($file, $prepend_out = '')
{
    $contents = file_get_contents($file);
    $contents = strip_comments($contents);
    if (preg_match_all("/<\\?(php)?(.*?)(\\?>|\$\$)/s", $contents, $matchs)) {
        foreach ($matchs[2] as $match) {
            $match = strip_comments($match);
            $results = lookForPaths($match);
            if ($results) {
                for ($i = 0; $i < count($results[0]); $i++) {
                    $file_param = get_file_path($results[1][$i], $results[2][$i]);
                    if (is_absolute_file($file_param)) {
                        echo $prepend_out . "{$file} : " . trim($results[0][$i]) . PHP_EOL;
                    }
                }
            }
        }
    }
}
Пример #4
0
/**
 *   Main Visual Setting Plugin
 *   -------------------------------------------
 *   main_visual.inc.php
 *   
 *   Copyright (c) 2010 hokuken
 *   http://hokuken.com/
 *   
 *   created  : 2010-09-13
 *   modified :
 *   
 *   hokukenstyleデザインで、main_visualを利用するときに使うプラグイン
 *  
 *   Usage : 
 *     #mainvidual(imgurl|PageName[,title]);
 *
 */
function plugin_main_visual_convert()
{
    $args = func_get_args();
    //error
    if (count($args) == 0) {
        return '';
    }
    $url = get_file_path($args[0]);
    $title = count($args) > 1 ? htmlspecialchars($args[1]) : htmlspecialchars($url);
    $align = 'center';
    if (isset($args[2])) {
        switch ($args[2]) {
            case 'right':
                $align = 'right';
                break;
            case 'left':
                $align = 'left';
                break;
        }
    }
    $mv = '';
    if (preg_match('/.*\\.(png|gif|jpg|jpeg)/i', $url)) {
        $fp = fopen($url, 'r');
        if ($fp) {
            $mv = '<div style="text-align:' . $align . '"><img src="' . $url . '" title="' . $title . '" alt="' . $title . '" /></div>';
        }
        fclose($fp);
    } else {
        if (is_page($url)) {
            $mv = convert_html(get_source($url));
        }
    }
    if ($mv != '') {
        $qt = get_qt();
        $qt->setv('main_visual', "<div id=\"main_visual\">\n" . $mv . "\n</div>\n");
    }
    return '';
}
Пример #5
0
$cancel = isset($HTTP_POST_VARS['cancel']) ? TRUE : FALSE;
if (empty($HTTP_POST_VARS['send_file'])) {
    $no_page_header = $cancel ? TRUE : FALSE;
    require $phpbb_root_path . 'admin/pagestart.php';
}
if ($cancel) {
    $header_location = @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ? 'Refresh: 0; URL=' : 'Location: ';
    header($header_location . append_sid("admin_styles.php"));
    exit;
}
if (isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode'])) {
    $mode = isset($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
} else {
    $mode = "";
}
$styles_dir_name = get_file_path('/design/phpbb/templates');
switch ($mode) {
    case "edit":
        $submit = isset($HTTP_POST_VARS['submit']) ? TRUE : 0;
        if ($submit) {
            //
            // DAMN! Thats alot of data to validate...
            //
            $updated['style_name'] = $HTTP_POST_VARS['style_name'];
            $updated['template_name'] = $HTTP_POST_VARS['template_name'];
            $updated['head_stylesheet'] = $HTTP_POST_VARS['head_stylesheet'];
            $updated['body_background'] = $HTTP_POST_VARS['body_background'];
            $updated['body_bgcolor'] = $HTTP_POST_VARS['body_bgcolor'];
            $updated['body_text'] = $HTTP_POST_VARS['body_text'];
            $updated['body_link'] = $HTTP_POST_VARS['body_link'];
            $updated['body_vlink'] = $HTTP_POST_VARS['body_vlink'];
Пример #6
0
function get_random_image($cat_id = 0, $show_link = 1, $return_file = 0)
{
    global $site_template, $random_image_cache;
    if (!isset($random_image_cache)) {
        $random_image_cache = get_random_image_cache();
    }
    if ($cat_id && SHOW_RANDOM_CAT_IMAGE) {
        $template = 'random_cat_image';
        $category_id = $cat_id;
    } else {
        $template = 'random_image';
        if (SHOW_RANDOM_CAT_IMAGE) {
            srand((double) microtime() * 1000000);
            $category_id = array_rand($random_image_cache);
        } else {
            $category_id = 0;
        }
    }
    if (!empty($random_image_cache[$category_id])) {
        if (!$return_file) {
            show_image($random_image_cache[$category_id], "", $show_link);
            $random_image = $site_template->parse_template($template);
            return $random_image;
        } else {
            return get_file_path($random_image_cache[$category_id]['image_thumb_file'], "thumb", $category_id, 0, 1);
        }
    }
}
Пример #7
0
<?php

// Define system path path
$system_path = "";
if (realpath($system_path) !== false) {
    $system_path = realpath($system_path) . '/';
}
define("BASEPATH", str_replace("\\", "/", $system_path));
// load common functions
require BASEPATH . "/libs/Common.php";
// load config file
require get_file_path("paths", "config");
require get_file_path("database", "config");
// Use an autoloader!
require get_file_path("Bootstrap", "libs");
require get_file_path("Controller", "libs");
require get_file_path("Model", "libs");
require get_file_path("View", "libs");
require get_file_path("Database", "libs");
require get_file_path("Session", "libs");
$app = new Bootstrap();
Пример #8
0
    $ret = '';
    if ($colluded_list['more'] <= 0) {
        $shares = get_shares_as_string($_GET['fid']);
        $info['shares'] = $shares;
        $info['file-name'] = get_file_name($_GET['fid']);
        $info['fid'] = $_GET['fid'];
        //		print_r($info);
        $result = reconstruct($info);
        set_decryption_status($_GET['fid'], $result);
        //		print_r($result);
        $data = "<a href='/toyapp/repo/{$result}'>Download file</a><br />";
        $ret = array('status' => 'success', 'data' => $data);
    } else {
        $data = '';
        foreach ($colluded_list['list'] as $key => $value) {
            $data .= $value['uid'] . ', ';
        }
        //$data = trim($data);
        $data .= ' shared secrets. Needs ' . $colluded_list['more'] . ' more shares.';
        $ret = array('status' => 'fail', 'data' => $data);
    }
} else {
    $file = get_file_path($_GET['fid']);
    if (!empty($file)) {
        $data = "<a href='/toyapp/repo/{$file}'>Download file</a><br />";
    } else {
        $data = "Decryption failed";
    }
    $ret = array('status' => 'success', 'data' => $data);
}
echo json_encode($ret);
Пример #9
0
function prepare_batch($user)
{
    $structure_file_path = get_file_path($user, 'structure_file');
    $command_file_path = get_file_path($user, 'lammps_script');
    $cmdline_file_path = get_file_path($user, 'cmdline_file');
    $pot_files_path = get_file_path($user, 'zip');
    $info = new StdClass();
    $info->structure_file_path = $structure_file_path;
    $info->command_file_path = $command_file_path;
    $info->cmdline_file_path = $cmdline_file_path;
    $info->pot_files_path = $pot_files_path;
    $info->area = get_str("area");
    // get the directory in which to run the test,
    // clear it out,
    // and set up links to the input files
    //
    $test_dir = "../../lammps_test/{$user->id}";
    //echo "test_dir is ".$test_dir;
    if (!is_dir($test_dir)) {
        mkdir($test_dir);
    }
    $old_dir = getcwd();
    if (!chdir($test_dir)) {
        error_page("Can't chdir");
    }
    system("rm *");
    symlink($structure_file_path, "structure_file");
    symlink($command_file_path, "lammps_script");
    symlink($cmdline_file_path, "cmd_variables");
    symlink($pot_files_path, "pot_files");
    list($error, $est_cpu_time, $disk) = lammps_est();
    if ($GLOBALS["debug"]) {
        print "est_cpu_time is " . $est_cpu_time . "<br>";
    }
    if ($error == 0) {
        $err_msgs = file("output");
        $err = "Your test job <strong>failed</strong>\n            <br>Please refer to the following Error Message:<br><p>\n        ";
        foreach ($err_msgs as $line) {
            $err = $err . $line . "<br>";
        }
        $err = $err . " <p>\n            <a href=sandbox.php><strong> File_Sandbox </strong></a>\n        ";
        error_page($err);
    }
    system("rm *");
    $info->rsc_fpops_est = $est_cpu_time * 1500000000.0;
    $info->rsc_fpops_bound = $info->rsc_fpops_est * 20;
    if ($disk == 0) {
        $info->rsc_disk_bound = 1000000;
    } else {
        $info->rsc_disk_bound = $disk;
    }
    $tmpfile = tempnam("/tmp", "lammps_");
    file_put_contents($tmpfile, serialize($info));
    // get the # of jobs
    //
    $njobs = count(file($cmdline_file_path));
    $secs_est = estimated_makespan($njobs, $info->rsc_fpops_est);
    if ($GLOBALS["debug"]) {
        echo "secs_est is {$secs_est}\n";
    }
    //assume the server's flops is 1.5G and the average client's flops is 1G
    $hrs_est = number_format($secs_est * 1.5 / 60, 2);
    //$hrs_est = number_format($secs_est, 2);
    $client_mb = number_format($info->rsc_disk_bound / 1000000.0, 1);
    $server_mb = number_format($njobs * $info->rsc_disk_bound / 1000000.0, 1);
    chdir($old_dir);
    page_head("Batch prepared");
    echo "\n        Your batch has {$njobs} jobs.\n        <p>\n        Estimated time to completion: {$hrs_est} Minutes.\n        <p>\n        Estimated client disk usage: {$client_mb} MB\n        <p>\n        Estimated server disk usage: {$server_mb} MB\n        <p>\n    ";
    show_button("lammps.php?action=submit&tmpfile={$tmpfile}", "Submit Batch");
    page_tail();
}
Пример #10
0
            echo json_encode($DB->getFieldsList($id));
            break;
        case 'lines':
            echo json_encode($DB->getLinesList($id));
        default:
    }
    die;
}
if (isset($_FILES['file'])) {
    $uploadedFileArray = $_FILES['file'];
    if ($uploadedFileArray['error'] != UPLOAD_ERR_OK) {
        echo 'Ошибка загрузки файла';
    } else {
        if (!isset($tableId) || !isset($fieldId) || !isset($lineId)) {
            echo 'Должны быть выбраны Таблица, Поле, Строка';
        } else {
            $fileName = $uploadedFileArray['name'];
            $tmpFilePath = $uploadedFileArray['tmp_name'];
            $newFilePath = get_file_path($fieldId, $lineId, $fileName);
            $DB->setFileName($tableId, $fieldId, $lineId, $fileName);
            create_data_file_dirs($fieldId, $lineId, $fileName);
            if (!move_uploaded_file($tmpFilePath, $newFilePath)) {
                echo 'Ошибка загрузки файла';
            } else {
                echo 'Файл загружен ';
            }
        }
    }
} else {
    showMainPage();
}
Пример #11
0
    foreach ($fragments as $key => $value) {
        if ($key == $filename) {
            continue;
        }
        //                echo FRAGMENT_PLACE_HOLDER.$key.LINE_BREAK.'<br/>'.
        //                    "<pre>".
        //                    FRAGMENT_BEGIN.$key.LINE_BREAK.
        //                    $value.LINE_BREAK.
        //                    FRAGMENT_END.$key.LINE_BREAK.'</pre>';
        $key = basename($key, '.js');
        $newFile = str_replace(FRAGMENT_PLACE_HOLDER . $key . LINE_BREAK, FRAGMENT_BEGIN . $key . LINE_BREAK . $value . FRAGMENT_END . $key . LINE_BREAK, $newFile);
    }
    echo "after join file length: " . strlen($newFile) . "<br/>";
    $oldFile = file_get_contents(get_file_path());
    file_put_contents(get_file_path() . '.bak', $oldFile);
    file_put_contents(get_file_path(), $newFile);
    run_action('view');
}, 'default' => function () {
    run_action('view');
});
function run_action($action)
{
    global $actions;
    if ($actions[$action]) {
        return $actions[$action]();
    } else {
        return $actions['default']();
    }
}
?>
<!DOCTYPE html>
Пример #12
0
function verify_asset_json($json)
{
    $path = get_file_path($json);
    $url = get_url($json);
    $aid = get_asset_id($json);
    $file = file_get_contents($url . '/' . $path);
    $regex = "/^{$aid}\n|\n{$aid}\n|\n{$aid}\$/";
    preg_match($regex, $file, $matches);
    // return (trim($matches[0]) == $aid)?TRUE:var_dump($matches);	#for debu
    return trim($matches[0]) == $aid ? TRUE : false;
}
function cmo_import_tc_settings_ajax()
{
    cmo_import_tc_settings(get_file_path('tc-settings.json'));
    ajax_finish(true, "done");
}
Пример #14
0
function plugin_video_body($args = array(), $body = "")
{
    static $num = 0;
    static $called_sources = array();
    $num++;
    $id = "qhm_plugin_video_{$num}";
    $qt = get_qt();
    $qt->setv("jquery_include", TRUE);
    if (exist_plugin("icon")) {
        plugin_icon_set_font_awesome();
    }
    $embed_url = $popup = FALSE;
    $sources = array();
    $poster = FALSE;
    $aspect_ratio = "16by9";
    $width = PLUGIN_VIDEO_EMBED_WIDTH;
    $height = PLUGIN_VIDEO_EMBED_HEIGHT;
    $aspect_ratio_float = 0.5625;
    $theme = FALSE;
    $youtube_thumbnail_type = FALSE;
    $rel = true;
    // 関連動画の表示(youtube)
    foreach ($args as $arg) {
        $arg = trim($arg);
        switch ($arg) {
            case "16:9":
            case "4:3":
                list($aspect_width, $aspect_height) = explode(':', $arg);
                $aspect_ratio_float = (double) $aspect_height / (double) $aspect_width;
                $aspect_ratio = str_replace(":", "by", $arg);
                break;
            case "popup":
                $popup = TRUE;
                break;
            case preg_match('*^https?://(www\\.youtube\\.com|youtu\\.be|vimeo.com)/*', $arg) ? TRUE : FALSE:
                $embed_url = $arg;
                break;
            case preg_match('/\\Aytpreview=(.+)\\z/', $arg, $mts) ? TRUE : FALSE:
                // YouTube thumbnail type
                $_types = array('thumb-default', 'thumb-1', 'thumb-2', 'thumb-3', 'default', 'medium', 'high');
                if (in_array($mts[1], $_types)) {
                    $youtube_thumbnail_type = $mts[1];
                }
                break;
            case preg_match('/^(.+\\.(png|jpeg|jpg|gif))\\z/i', $arg, $mts) ? TRUE : FALSE:
                $poster = get_file_path($mts[1]);
                break;
            case preg_match('/^(.+\\.mp4)\\z/i', $arg, $mts) ? TRUE : FALSE:
                $sources[PLUGIN_VIDEO_MIMETYPE_MP4] = get_file_path($mts[1]);
                break;
            case "ted":
            case "wmp":
                $theme = $arg;
                break;
            case "norel":
                $rel = false;
                break;
        }
    }
    $mediaelement_path = 'js/mediaelementplayer/';
    $include_mediaelement = '
<link rel="stylesheet" href="' . $mediaelement_path . 'mediaelementplayer.min.css">
<script src="' . $mediaelement_path . 'mediaelement-and-player.min.js"></script>
';
    $qt->appendv_once("include_mediaelement", "beforescript", $include_mediaelement);
    $addstyle = '
<link rel="stylesheet" href="' . $mediaelement_path . 'mejs-skins.css">
<link rel="stylesheet" href="' . PLUGIN_DIR . 'video/video.min.css">
';
    $qt->appendv_once("plugin_video_style", "beforescript", $addstyle);
    $qt->appendv_once("plugin_video_script", "beforescript", '<script src="' . PLUGIN_DIR . 'video/video.min.js"></script>');
    $popup_html = $popup_style = '';
    if ($popup) {
        if ($body == '') {
            if ($poster !== FALSE) {
                $body = '<img src="' . h($poster) . '">';
            } else {
                $body = '<i class="fa fa-play-circle-o"></i>';
            }
        }
        $popup_html = <<<EOD
<a class="qhm-plugin-video-trigger" data-toggle="modal" data-target="#{$id}_modal">{$body}</a>
EOD;
    }
    if ($embed_url !== FALSE) {
        return $popup_html . plugin_video_embed($embed_url, $id, $aspect_ratio, $body, $popup, $poster, $youtube_thumbnail_type, $rel);
    }
    if (!isset($sources[PLUGIN_VIDEO_MIMETYPE_MP4])) {
        return '<p>Usage: #video(video.mp4)</p>' . "\n";
    } else {
        if (is_url($sources[PLUGIN_VIDEO_MIMETYPE_MP4])) {
            $sources[PLUGIN_VIDEO_MIMETYPE_WEBM] = substr($sources[PLUGIN_VIDEO_MIMETYPE_MP4], 0, -3) . "webm";
        } else {
            if (file_exists($sources[PLUGIN_VIDEO_MIMETYPE_MP4])) {
                $webm_path = substr($sources[PLUGIN_VIDEO_MIMETYPE_MP4], 0, -3) . "webm";
                if (file_exists($webm_path)) {
                    $sources[PLUGIN_VIDEO_MIMETYPE_WEBM] = $webm_path;
                }
            }
        }
    }
    foreach ($sources as $mime_type => $url) {
        if (isset($called_sources[$url])) {
            $called_sources[$url] += 1;
            $sources[$mime_type] = $url . '?' . $called_sources[$url];
        } else {
            $called_sources[$url] = 1;
        }
    }
    if ($poster !== FALSE) {
        if (!is_url($poster) && !file_exists($poster)) {
            $poster = FALSE;
        }
    }
    $sources_html = '';
    foreach ($sources as $type => $source) {
        $sources_html .= <<<EOD
  <source src="{$source}" type="{$type}">
EOD;
    }
    // video tag attribute params
    $params = array('controls' => TRUE, 'preload' => $poster === FALSE ? "auto" : "none", 'poster' => $poster, 'style' => '"width:100%; height:100%;', 'width' => '100%', 'height' => '100%', 'data-aspect-ratio' => $aspect_ratio_float);
    if ($theme !== FALSE) {
        $params['class'] = "mejs-{$theme}";
    }
    if ($popup) {
        $params['data-popup'] = 'popup';
    }
    $attrs = '';
    foreach ($params as $key => $val) {
        if ($val === FALSE) {
            continue;
        }
        if ($val === TRUE) {
            $attrs[] = $key;
            continue;
        }
        $attrs[] = $key . '="' . $val . '"';
    }
    $attrs = join(' ', $attrs);
    $mp4 = $sources[PLUGIN_VIDEO_MIMETYPE_MP4];
    $not_support_html = '<p>動画を再生するには、videoタグをサポートしたブラウザが必要です。</p>';
    $poster_html = '';
    if ($poster !== FALSE) {
        $poster_html = <<<EOD
        <img src="{$poster}" width="320" height="240" title="No video playback capabilities">
EOD;
    }
    $video_html = <<<EOD
  <div class="qhm-plugin-video-video embed-responsive-item">
    <video id="{$id}_video" {$attrs}>
      {$sources_html}
      <object width="320" height="240" type="application/x-shockwave-flash" data="{$mediaelement_path}flashmediaelement.swf">
        <param name="movie" value="{$mediaelement_path}flashmediaelement.swf">
        <param name="flashvars" value="controls=true&file={$mp4}">
        {$poster_html}
      </object>
      {$not_support_html}
    </video>
  </div>
EOD;
    if ($popup) {
        $html = <<<EOD
{$popup_html}
<div id="{$id}_modal" class="qhm-plugin-video modal fade" data-type="video">
  <div class="modal-dialog modal-lg">
    <div class="embed-responsive embed-responsive-{$aspect_ratio}">
      {$video_html}
    </div>
  </div>
</div>
EOD;
    } else {
        $html = <<<EOD
<div id="{$id}" class="qhm-plugin-video embed-responsive embed-responsive-{$aspect_ratio}" {$popup_style}>
  {$video_html}
</div>
EOD;
    }
    return $html;
}
Пример #15
0
/**
 *   Section Plugin
 *   -------------------------------------------
 *   /plugin/section.inc.php
 *
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *
 *   created  : 2013/12/09
 *   modified : 2014/07/18
 *
 *   Description
 *
 *   Usage :
 *
 *   ### Notice: Background-Video on any Browser
 *   When specify background-video of MP4 Search Webm(.webm) and Ogg Video(.ogv) in same dir.
 *   Video sources founded are output in video element.
 *   But, Firefox occurs warning and ignore video unless web server return valid Content-Type.
 *
 *     *Apache solution*
 *     AddType video/webm .webm
 *     AddType video/ogg  .ogv
 *
 */
function plugin_section_convert()
{
    global $script;
    static $cnt = 0;
    $qt = get_qt();
    $args = func_get_args();
    $body = array_pop($args);
    $body = str_replace("\r", "\n", str_replace("\r\n", "\n", $body));
    $title = '';
    $h_align = 'center';
    //left|center|right
    $v_align = 'middle';
    //top|middle|bottom
    $height = $height_xs = '';
    //awesome!
    $type = 'cover';
    //cover|repeat
    $style = 'default';
    //primary|info|success|warning|danger
    $fullpage = FALSE;
    //full height section; fit window size
    $relative = FALSE;
    //position: relative
    $container = TRUE;
    //FALSE to enable 'fit' option
    $jumbotron = FALSE;
    //FALSE to remove .jumbotron
    $color = FALSE;
    //inherit
    $background_image = $background_image_xs = FALSE;
    $background_fix = FALSE;
    $filter = FALSE;
    $background_color = FALSE;
    //transparent
    $additional_class = $container_class = '';
    $additional_style = '';
    $background_video = FALSE;
    $background_filename = '';
    $attrs = array('id' => 'qhm_section_' . ++$cnt, 'class' => 'qhm-section');
    $styles = array('__xs__' => array(), '__raw__' => '');
    $is_eyecatch = FALSE;
    foreach ($args as $arg) {
        if (preg_match('/\\A(left|center|right)\\z/i', $arg, $mts)) {
            $h_align = strtolower($mts[1]);
        } else {
            if (preg_match('/\\A(top|middle|bottom)\\z/i', $arg, $mts)) {
                $v_align = strtolower($mts[1]);
            } else {
                if (preg_match('/\\A(cover|repeat)\\z/i', $arg, $mts)) {
                    $type = strtolower($mts[1]);
                } else {
                    if (preg_match('/\\Axsbg=(.+)\\z/', $arg, $mts)) {
                        $background_image_xs = $mts[1];
                    } else {
                        if (preg_match('/\\Axsheight=([\\d.]+)(.*)\\z/', $arg, $mts)) {
                            $height_xs = $mts[1] . ($mts[2] ? $mts[2] : 'px');
                        } else {
                            if (preg_match('/\\.(jpe?g|gif|png)\\z/i', $arg)) {
                                $background_image = trim($arg);
                            } else {
                                if (preg_match('/\\Aimage=(.+)\\z/', $arg, $mts)) {
                                    $background_image = trim($mts[1]);
                                } else {
                                    if (preg_match('/\\A([\\d.]+)(.*)\\z/', $arg, $mts)) {
                                        $height = $mts[1] . ($mts[2] ? $mts[2] : 'px');
                                    } else {
                                        if ($arg === 'page') {
                                            $fullpage = TRUE;
                                        } else {
                                            if (preg_match('/\\A(primary|info|success|warning|danger)\\z/i', $arg, $mts)) {
                                                $style = $mts[1];
                                            } else {
                                                if (preg_match('/\\Aclass=(.+)\\z/', $arg, $mts)) {
                                                    $additional_class .= ' ' . $mts[1];
                                                } else {
                                                    if (preg_match('/\\Astyle=(.+)\\z/', $arg, $mts)) {
                                                        $additional_style .= $mts[1];
                                                    } else {
                                                        if (preg_match('/\\Acolor=(.+)\\z/', $arg, $mts)) {
                                                            $color = $mts[1];
                                                        } else {
                                                            if (preg_match('/\\Abgcolor=(.+)\\z/', $arg, $mts)) {
                                                                $background_color = $mts[1];
                                                            } else {
                                                                if (preg_match('/\\Abgvideo=(.+)\\z/', $arg, $mts)) {
                                                                    $background_video = $mts[1];
                                                                } else {
                                                                    if (preg_match('/\\Atitle=(.+)\\z/', $arg, $mts)) {
                                                                        $title = $mts[1];
                                                                    } else {
                                                                        if ($arg === 'fit') {
                                                                            $container = FALSE;
                                                                            $styles['padding'] = 0;
                                                                            $styles['height'] = 'auto';
                                                                        } else {
                                                                            if ($arg === 'fix') {
                                                                                $background_fix = TRUE;
                                                                            } else {
                                                                                if ($arg === 'relative') {
                                                                                    $relative = TRUE;
                                                                                } else {
                                                                                    if ($arg === 'jumbotron') {
                                                                                        $jumbotron = TRUE;
                                                                                    } else {
                                                                                        if ($arg === 'nojumbotron') {
                                                                                            $jumbotron = FALSE;
                                                                                        } else {
                                                                                            if ($arg === 'eyecatch') {
                                                                                                $additional_class .= ' qhm-eyecatch';
                                                                                                $jumbotron = TRUE;
                                                                                                $is_eyecatch = TRUE;
                                                                                            } else {
                                                                                                if ($arg === 'blur') {
                                                                                                    $filter = 'blur';
                                                                                                } else {
                                                                                                    if (preg_match('/\\A(dark|light)(?:=(.+))?\\z/', $arg, $mts)) {
                                                                                                        $filter = $mts[1];
                                                                                                        $filter_value =& $mts[2];
                                                                                                    } else {
                                                                                                        if ($arg === '__default') {
                                                                                                            $additional_class .= ' qhm-eyecatch-default';
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // !set attributes
    if ($jumbotron) {
        $attrs['class'] = 'jumbotron ' . $attrs['class'];
    }
    //set base class
    $attrs['class'] .= ' qhm-section-' . $style;
    if ($relative) {
        $styles['position'] = 'relative';
    }
    if ($is_eyecatch) {
        if (isset($_SESSION['temp_design'])) {
            $conf = get_skin_custom_vars($_SESSION['temp_design']);
        } else {
            global $style_name;
            $conf = get_skin_custom_vars($style_name);
        }
        if (isset($conf['default_eyecatch']) && $conf['default_eyecatch']) {
            if ($background_color === FALSE && $background_image === FALSE && isset($conf['eyecatch_bgimage'])) {
                $background_image = $conf['eyecatch_bgimage'];
            }
            if ($background_image === FALSE && isset($conf['enable_eyecatch_bgimage']) && !$conf['enable_eyecatch_bgimage']) {
                $background_image = '';
            }
            if ($color === FALSE && isset($conf['eyecatch_color'])) {
                $color = $conf['eyecatch_color'];
            }
        }
    }
    if ($color) {
        $styles['color'] = $color;
    }
    if ($background_color) {
        $styles['background-color'] = $background_color;
    }
    if ($background_image) {
        if (is_url($background_image, TRUE, TRUE)) {
            $background_filename = $background_image;
        } else {
            $background_filename = dirname($script . 'dummy') . '/' . get_file_path($background_image);
        }
        //first image をセット
        $qt->set_first_image($background_filename);
        // フィルター
        if ($filter === 'blur') {
            $attrs['data-filter'] = $filter;
            $svg_html = '
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
  <filter id="blur">
    <feGaussianBlur stdDeviation="6" />
  </filter>
</svg>
';
            $qt->appendv_once('plugin_section_blur_svg', 'lastscript', $svg_html);
            $addjs = '
<script>
$(function(){
  var ua = {};
  ua.name = window.navigator.userAgent.toLowerCase();
  if (ua.name.indexOf("msie") >= 0 || ua.name.indexOf("trident") >= 0) {
    $(".qhm-section[data-filter=blur] > div").css({background: "none", position: "static"});
  }
});
</script>
';
            $qt->appendv_once('plugin_section_kill_blur_on_ie', 'beforescript', $addjs);
        }
        if ($background_video === FALSE) {
            $styles['background-image'] = 'url(' . h($background_filename) . ')';
        }
        if ($background_fix) {
            // iOS, Android では無効にする
            $addjs = '
<script>
$(function(){
  var ua = {};
  ua.name = window.navigator.userAgent.toLowerCase();
  if (ua.name.indexOf("ipad") >= 0 || ua.name.indexOf("ipod") >= 0 || ua.name.indexOf("iphone") >= 0 || ua.name.indexOf("android") >= 0) {
    $(".qhm-section[data-background-attachment=fixed]").css({backgroundAttachment: "inherit"}).removeAttr("data-background-attachment");
  }
});
</script>
';
            $qt->appendv_once('plugin_section_kill_fixed_on_ios+android', 'beforescript', $addjs);
            $styles['background-attachment'] = 'fixed';
            $attrs['data-background-attachment'] = 'fixed';
        }
        $attrs['data-background-image'] = $background_image;
        $attrs['data-background-type'] = $type;
    }
    $filter_wrapper_html = '';
    if ($filter === 'dark' || $filter === 'light') {
        $attrs['data-filter'] = $filter;
        $opacity = $filter_value ? $filter_value / 100.0 : '0.4';
        $bg_color = $filter === 'light' ? 255 : 0;
        $rgba = 'rgba(' . str_repeat($bg_color . ',', 3) . $opacity . ');';
        $filter_wrapper_html = '
<div class="dark-overlay-wrapper">
<div class="dark-overlay" style="background-color:' . $rgba . '"></div>
</div>
';
    }
    if ($background_image_xs) {
        if (is_url($background_image_xs, TRUE, TRUE)) {
            $background_filename = $background_image_xs;
        } else {
            $background_filename = dirname($script . 'dummy') . '/' . get_file_path($background_image_xs);
        }
        //first image をセット
        $qt->set_first_image($background_filename);
        $styles['__xs__']['background-image'] = 'url(' . h($background_filename) . ')';
    }
    if ($background_video) {
        //dark フィルター以外は使えない
        if (isset($attrs['data-filter']) && !in_array($attrs['data-filter'], array('dark', 'light'))) {
            unset($attrs['data-filter']);
        }
        $ext = pathinfo($background_video, PATHINFO_EXTENSION);
        if ($ext == 'mp4') {
            $background_videofile = array();
            if (is_url($background_video)) {
                $background_videofile["video/mp4"] = $background_video;
                $background_videofile["video/webm"] = preg_replace('/\\.mp4$/i', '.webm', $background_video);
                $background_videofile["video/ogg"] = preg_replace('/\\.mp4$/i', '.ogv', $background_video);
            } else {
                $background_videofile["video/mp4"] = $mp4_path = get_file_path($background_video);
                foreach (array("video/webm" => ".webm", "video/ogg" => ".ogv") as $mime => $ext) {
                    $tmpfile = preg_replace('/\\.mp4$/i', $ext, $mp4_path);
                    if (file_exists($tmpfile)) {
                        $background_videofile[$mime] = $tmpfile;
                    }
                }
            }
            if ($background_image) {
                $bg_image_style = 'background-image:url(' . h($background_filename) . ');';
            }
            $add_js = '
<script>
if (navigator.userAgent.toLowerCase().match(/iphone|ipod|ipad|android|windows phone/))
{
  $(window).on("load", function(){$(".qhm-section .background-video .qhm-section-video").hide()});
}
</script>
';
            $qt->appendv_once('plugin_section_prevent_video', 'beforescript', $add_js);
            $video_html = '
    <div class="background-video" style="' . $bg_image_style . '">
      <video class="qhm-section-video" preload="" loop="" autoplay="" muted="" poster="' . h($background_filename) . '">
';
            foreach ($background_videofile as $mime => $path) {
                $video_html .= '<source src="' . h($path) . '" type="' . $mime . '">';
            }
            $video_html .= '
      </video>
    </div>
';
            $attrs['data-video'] = 'video';
        }
    }
    if ($fullpage) {
        $styles['height'] = '600px';
        $styles['__xs__']['height'] = '100vh';
        $attrs['data-height'] = 'page';
        $addjs = '
<script>
$(function(){
  var $sections = $(".qhm-section[data-height=page]");
  if ($sections.length === 0) return;

  var resizeSection = function resizeSection() {
    var windowHeight = $(window).height();
    $sections.innerHeight(windowHeight);
  };
  resizeSection();
  $(window).on("resize", resizeSection);
});
</script>
';
        $qt->appendv_once('plugin_section_page_height', 'beforescript', $addjs);
    } else {
        if ($height != '') {
            $styles['height'] = $height;
        }
        if ($height_xs != '') {
            $styles['__xs__']['height'] = $height_xs;
        }
        $attrs['data-height'] = $height;
    }
    if ($title !== '') {
        $attrs['data-title'] = $title;
    }
    $attrs['data-horizontal-align'] = $h_align;
    $attrs['data-vertical-align'] = $v_align;
    $attrs['class'] .= ' ' . $additional_class;
    $styles['__raw__'] = $additional_style;
    $attr_string = '';
    foreach ($attrs as $name => $value) {
        $attr_string .= ' ' . $name . '="' . h($value) . '"';
    }
    if ($container) {
        $container_class = 'container-fluid';
    }
    // ! make html
    $body = convert_html($body);
    $html = <<<EOH
<section {$attr_string}>
  {$filter_wrapper_html}
  {$video_html}
    <div>
      <div class="{$container_class} qhm-section-content">
        {$body}
      </div>
    </div>
</section>
EOH;
    $addstyle = '
<link rel="stylesheet" href="' . PLUGIN_DIR . 'section/section.css" />
';
    $qt->appendv_once('plugin_section_style', 'beforescript', $addstyle);
    $style_tag = '<style class="qhm-plugin-section-style">';
    $style_tag .= '#' . $attrs['id'] . ' {';
    $style_tag .= plugin_section_make_style($styles);
    $style_tag .= '}';
    if (isset($styles['__xs__']) && $styles['__xs__']) {
        $style_tag .= '@media (max-width:767px){';
        $style_tag .= '#' . $attrs['id'] . ' {';
        $style_tag .= plugin_section_make_style($styles['__xs__']);
        $style_tag .= '}}';
    }
    $style_tag .= '</style>' . "\n";
    $qt->appendv('beforescript', $style_tag);
    return $html;
}
Пример #16
0
<?php

// THESE ARE THE THINGS TO CHANGE, THEY ARE JUST USED IN THE TEMPLATE
$info = array('title' => 'SmartStrap', 'description' => 'Simple and enjoyable blogging.', 'menu_list' => array('Archived Content' => '/archive'));
date_default_timezone_set('UTC');
require './libs/smarty/Smarty.class.php';
require './libs/markdown.php';
require './libs/metadata.php';
$smarty = new Smarty();
$smarty->setTemplateDir('./template/');
$smarty->setCompileDir('./cache/templates_c/');
$smarty->setCacheDir('./cache/cache/');
$vars = parse_file(get_file_path($_GET['path']));
$vars['info'] = $info;
$vars['info']['url'] = 'http://' . $_SERVER["SERVER_NAME"];
$vars['files'] = compiled_metadata();
foreach ($vars as $key => $value) {
    $smarty->assign($key, $value);
}
if (isset($_GET['feed']) && $_GET['feed'] == 'rss') {
    header("Content-type: application/rss+xml");
    $vars['xml_header'] = '<?xml version="1.0" encoding="utf-8"?>';
    $smarty->display('rss.tpl');
} else {
    $smarty->display('index.tpl');
}
Пример #17
0
function catbody($title, $page, $body)
{
    global $script, $script_ssl, $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr;
    global $attach_link, $related_link, $cantedit, $function_freeze;
    global $search_word_color, $_msg_word, $foot_explain, $note_hr, $head_tags;
    global $trackback, $trackback_javascript, $referer, $javascript;
    global $nofollow, $non_list;
    global $_LANG, $_LINK, $_IMAGE;
    global $pkwk_dtd;
    // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional...
    global $page_title;
    // Title of this site
    global $do_backup;
    // Do backup or not
    global $modifier;
    // Site administrator's  web page
    global $modifierlink;
    // Site administrator's name
    global $owneraddr;
    // Site owner address
    global $ownertel;
    // Site owner tel
    global $headcopy;
    // Site headcopy
    global $menuadmin;
    // Menu Administrate Page
    global $style_type, $style_name, $logo_image, $logo_header;
    global $keywords, $description, $accesstag, $ga_tracking_id, $killer_fg, $killer_bg, $noindex, $accesstag_moved;
    //for skin by hokuken
    global $qhm_adminmenu;
    // Site administration menu 20 JUN 2007
    global $custom_meta;
    // Insert meta tag for specific meta tag
    global $adcode;
    // AD code (exp. Google Adwords, Analytics ... )  25 JLY 2007 by hokuken.com
    global $nowindow;
    // Disable including external_link.js
    global $killer_page2;
    // for Killer page Design 2
    global $no_qhm_licence;
    // qhm licence
    global $include_skin_file_path;
    //orignal skin setting
    global $qhm_access_key;
    global $reg_exp_host;
    global $unload_confirm, $check_login;
    global $enable_wp_theme, $enable_wp_theme_name, $wp_add_css;
    //WordPress用のテーマ
    global $mobile_redirect, $googlemaps_apikey;
    global $other_plugins, $other_plugin_categories;
    global $default_script, $init_scripts;
    global $enable_smart_style, $smart_name;
    // smart phone
    global $is_update;
    global $enable_fitvids;
    // body部分以外は、元々の$script を使う(通常のリンク設定)を使う
    // 結果、$body内は、script_sslを使ったリンクになるが、ナビ、メニューなどは、元の$scriptを必ず使う
    $script = $init_scripts['normal'];
    $script_ssl = $init_scripts['ssl'];
    if (!file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) {
        die_message('SKIN_FILE is not found');
    }
    $_LINK = $_IMAGE = array();
    // Add JavaScript header when ...
    if ($trackback && $trackback_javascript) {
        $javascript = 1;
    }
    // Set something If you want
    if (!PKWK_ALLOW_JAVASCRIPT) {
        unset($javascript);
    }
    $_page = isset($vars['page']) ? $vars['page'] : '';
    $r_page = rawurlencode($_page);
    //QHM Template
    $qt = get_qt();
    if (!$qt->set_page) {
        $qt->set_page($_page);
    }
    //QHM Messages
    $qm = get_qm();
    // Set $_LINK for skin
    $_LINK['add'] = "{$script}?cmd=add&amp;page={$r_page}";
    $_LINK['backup'] = "{$script}?cmd=backup&amp;page={$r_page}";
    $_LINK['copy'] = "{$script}?plugin=template&amp;refer={$r_page}";
    $_LINK['diff'] = "{$script}?cmd=diff&amp;page={$r_page}";
    $_LINK['edit'] = "{$script}?cmd=edit&amp;page={$r_page}";
    $_LINK['filelist'] = "{$script}?cmd=filelist";
    $_LINK['freeze'] = "{$script}?cmd=freeze&amp;page={$r_page}";
    $_LINK['help'] = "{$script}?" . rawurlencode($help_page);
    $_LINK['list'] = "{$script}?cmd=list";
    $_LINK['new'] = "{$script}?plugin=newpage&amp;refer={$r_page}";
    $_LINK['rdf'] = "{$script}?cmd=rss&amp;ver=1.0";
    $_LINK['recent'] = "{$script}?" . rawurlencode($whatsnew);
    $_LINK['refer'] = "{$script}?plugin=referer&amp;page={$r_page}";
    $_LINK['reload'] = "{$script}?{$r_page}";
    $_LINK['rename'] = "{$script}?plugin=rename&amp;refer={$r_page}";
    $_LINK['delete'] = "{$script}?plugin=delete&amp;page={$r_page}";
    $_LINK['rss'] = "{$script}?cmd=rss";
    $_LINK['rss10'] = "{$script}?cmd=rss&amp;ver=1.0";
    // Same as 'rdf'
    $_LINK['rss20'] = "{$script}?cmd=rss&amp;ver=2.0";
    $_LINK['search'] = "{$script}?cmd=search";
    $_LINK['top'] = dirname($script . 'dummy.php') . '/';
    if ($trackback) {
        $tb_id = tb_get_id($_page);
        $_LINK['trackback'] = "{$script}?plugin=tb&amp;__mode=view&amp;tb_id={$tb_id}";
    }
    $_LINK['unfreeze'] = "{$script}?cmd=unfreeze&amp;page={$r_page}";
    $_LINK['upload'] = "{$script}?plugin=attach&amp;pcmd=upload&amp;page={$r_page}";
    $_LINK['menuadmin'] = "{$script}?" . rawurlencode($menuadmin);
    //Hokuken.com original
    $_LINK['qhm_adminmenu'] = qhm_get_script_path() . "?cmd=qhmauth";
    $_LINK['qhm_logout'] = "{$script}?cmd=qhmlogout";
    $_LINK['qhm_setting'] = "{$script}?cmd=qhmsetting";
    $_LINK['edit_menu'] = "{$script}?cmd=edit&amp;page=MenuBar";
    $_LINK['edit_menu2'] = "{$script}?cmd=edit&amp;page=MenuBar2";
    $_LINK['edit_navi'] = "{$script}?cmd=edit&amp;page=SiteNavigator";
    $_LINK['edit_navi2'] = "{$script}?cmd=edit&amp;page=SiteNavigator2";
    $_LINK['edit_header'] = "{$script}?cmd=edit&amp;page=SiteHeader";
    $_LINK['yetlist'] = "{$script}?cmd=yetlist";
    // Compat: Skins for 1.4.4 and before
    $link_add =& $_LINK['add'];
    $link_new =& $_LINK['new'];
    // New!
    $link_edit =& $_LINK['edit'];
    $link_diff =& $_LINK['diff'];
    $link_top =& $_LINK['top'];
    $link_list =& $_LINK['list'];
    $link_filelist =& $_LINK['filelist'];
    $link_search =& $_LINK['search'];
    $link_whatsnew =& $_LINK['recent'];
    $link_backup =& $_LINK['backup'];
    $link_help =& $_LINK['help'];
    $link_trackback =& $_LINK['trackback'];
    // New!
    $link_rdf =& $_LINK['rdf'];
    // New!
    $link_rss =& $_LINK['rss'];
    $link_rss10 =& $_LINK['rss10'];
    // New!
    $link_rss20 =& $_LINK['rss20'];
    // New!
    $link_freeze =& $_LINK['freeze'];
    $link_unfreeze =& $_LINK['unfreeze'];
    $link_upload =& $_LINK['upload'];
    $link_template =& $_LINK['copy'];
    $link_refer =& $_LINK['refer'];
    // New!
    $link_rename =& $_LINK['rename'];
    $link_delete =& $_LINK['delete'];
    $link_menuadmin =& $_LINK['menuadmin'];
    //Hokuken.com original
    $link_copy =& $_LINK['copy'];
    $link_qhm_adminmenu =& $_LINK['qhm_adminmenu'];
    //Hokuken.com original
    $link_qhm_logout =& $_LINK['qhm_logout'];
    //Hokuken.com original
    $link_qhm_setting =& $_LINK['qhm_setting'];
    //Hokuken.com original
    $link_edit_menu =& $_LINK['edit_menu'];
    //Hokuken.com original
    $link_edit_menu2 =& $_LINK['edit_menu2'];
    $link_edit_navi =& $_LINK['edit_navi'];
    //Hokuken.com original
    $link_edit_navi2 =& $_LINK['edit_navi2'];
    //Hokuken.com original
    $link_edit_header =& $_LINK['edit_header'];
    //Hokuken.com original
    $link_yetlist =& $_LINK['yetlist'];
    //Hokuken.com original
    // Init flags
    $is_page = is_pagename($_page) && $_page != $whatsnew;
    $is_read = arg_check('read') && is_page($_page);
    $is_freeze = is_freeze($_page);
    // Last modification date (string) of the page
    $lastmodified = $is_read ? format_date(get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : '';
    // List of attached files to the page
    $attaches = $attach_link && $is_read && exist_plugin_action('attach') ? attach_filelist() : '';
    // List of related pages
    $related = $related_link && $is_read ? make_related($_page) : '';
    // List of footnotes
    ksort($foot_explain, SORT_NUMERIC);
    $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : '';
    // Tags will be inserted into <head></head>
    $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : '';
    // 1.3.x compat
    // Last modification date (UNIX timestamp) of the page
    $fmt = $is_read ? get_filetime($_page) + LOCALZONE : 0;
    // Search words
    if ($search_word_color && isset($vars['word'])) {
        $body = '<div class="small">' . $_msg_word . htmlspecialchars($vars['word']) . '</div>' . $hr . "\n" . $body;
        // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
        // with array_splice(), array_flip()
        $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
        $words = array_splice($words, 0, 10);
        // Max: 10 words
        $words = array_flip($words);
        $keys = array();
        foreach ($words as $word => $id) {
            $keys[$word] = strlen($word);
        }
        arsort($keys, SORT_NUMERIC);
        $keys = get_search_words(array_keys($keys), TRUE);
        $id = 0;
        foreach ($keys as $key => $pattern) {
            $s_key = htmlspecialchars($key);
            $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS';
            $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];');
            $body = preg_replace_callback($pattern, $decorate_Nth_word, $body);
            $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes);
            ++$id;
        }
    }
    //-----------------------------------------------------------------------
    //
    // customized by hokuken for QHM (2009/1/28)
    //
    //-----------------------------------------------------------------------
    //----------------- 携帯の場合の処理 --------------------------------------
    if (preg_match('/keitai.skin.php$/', SKIN_FILE)) {
        require LIB_DIR . 'qhm_init.php';
        require LIB_DIR . 'qhm_init_main.php';
        require SKIN_FILE;
        return;
    }
    //------------------- IF UA is mobile, end here -----------------------
    //---------- KILLERPAGE: でもKILLERPAGE2:に統合 いつか消したい --------------
    if ($killer_fg != '') {
        //load common setting and output header
        require LIB_DIR . 'qhm_init.php';
        $killer_page2['fg'] = $killer_fg;
        $killer_page2['bg'] = $killer_bg;
        $killer_page2['width'] = 700;
        $killer_page2['padding'] = 60;
        $killer_page2['bg_body'] = '#fff';
        $killer_page2['fg_body'] = '#000';
        require LIB_DIR . 'qhm_init_killer.php';
        $longtaketime = getmicrotime() - MUTIME;
        $taketime = sprintf('%01.03f', $longtaketime);
        $qt->setv('taketime', $taketime);
    }
    //--------------------------- いつか消したい end here ----------------
    ///////////////////////////////////////////////////////////////////
    //
    // Main
    //
    //common setting
    require LIB_DIR . 'qhm_init.php';
    $qt->enable_cache = $qt->getv('editable') ? false : $qt->enable_cache;
    $qt->set_encode($shiftjis || $eucjp ? true : false);
    if ($shiftjis) {
        $output_encode = 'Shift_JIS';
    } else {
        if ($eucjp) {
            $output_encode = 'EUC-JP';
        } else {
            $output_encode = CONTENT_CHARSET;
        }
    }
    define('WORDPRESS_CHARSET', $output_encode);
    //output common header (available change encode)
    $qt->setv('meta_content_type', qhm_output_dtd($pkwk_dtd, CONTENT_CHARSET, $output_encode));
    //------- KILLERPAGE2: セールスレター型デザイン -------------------
    if (isset($killer_page2['fg']) != '') {
        require LIB_DIR . 'qhm_init_killer.php';
        //JQuery Include
        $jquery_script = '';
        $jquery_cookie_script = '';
        if ($qt->getv('jquery_include')) {
            $jquery_script = '<script type="text/javascript" src="js/jquery.js"></script>';
            $jquery_cookie_script = '<script type="text/javascript" src="js/jquery.cookie.js"></script>';
        }
        $bootstrap_style = $bootstrap_script = '';
        if ($qt->getv('bootstrap_script')) {
            $bootstrap_style = $qt->getv('bootstrap_style');
            $bootstrap_script = $qt->getv('bootstrap_script');
        }
        $qt->setv('jquery_script', $bootstrap_style . $jquery_script . $bootstrap_script);
        $qt->setv('jquery_cookie_script', $jquery_cookie_script);
        $longtaketime = getmicrotime() - MUTIME;
        $taketime = sprintf('%01.03f', $longtaketime);
        $qt->setv('taketime', $taketime);
        $qt->read('skin/killerpage2/pukiwiki.skin.php');
        return;
    }
    //-------------------------------------------------------------
    // ---- include main design skin file ----
    if (isset($_SESSION['temp_skin']) && strlen($_SESSION['temp_skin']) > 0) {
        $style_type = $_SESSION['temp_style_type'];
    }
    //pluginでデザインが指定されている場合
    if ($include_skin_file_path != '') {
        $style_name = $include_skin_file_path;
    }
    require LIB_DIR . 'qhm_init_main.php';
    // meta:GENERATOR
    $generator_tag = '<meta name="GENERATOR" content="Quick Homepage Maker; version=' . QHM_VERSION . '; haik=' . (is_bootstrap_skin() ? 'true' : 'false') . '" />' . "\n";
    $qt->prependv_once('generator_tag', 'beforescript', $generator_tag);
    //-------------------------------------------------
    // ogp タグを挿入
    //-------------------------------------------------
    if (exist_plugin('ogp')) {
        plugin_ogp_set_template($body);
    }
    //独自のテンプレートファイルをチェック
    $skin_file = SKIN_DIR . "{$style_name}/pukiwiki.skin.php";
    if ($qt->getv('layout_name')) {
        $layout_file = $qt->getv('layout_name') . '.skin.php';
        $layout_path = SKIN_DIR . "{$style_name}/{$layout_file}";
        if (file_exists($layout_path)) {
            $skin_file = $layout_path;
        }
    } else {
        $layout_prefix = 'content';
        if ($_page === $defaultpage) {
            $layout_prefix = 'default';
        } else {
            if (is_qblog()) {
                $layout_prefix = 'article';
            }
        }
        $layout_name = isset($style_config["{$layout_prefix}_layout"]) ? $style_config["{$layout_prefix}_layout"] : "";
        $layout_path = SKIN_DIR . "{$style_name}/{$layout_name}.skin.php";
        if (file_exists($layout_path)) {
            $skin_file = $layout_path;
        }
    }
    if (!file_exists($skin_file)) {
        $skin_file = SKIN_FILE;
        //デフォルトの位置
    }
    // Read design config for customize
    $style_config = read_skin_config($style_name);
    $skin_custom_vars = get_skin_custom_vars($style_name);
    $custom_css = make_custom_css($style_name);
    $qt->prependv('beforescript', $custom_css);
    if (isset($style_config['bootstrap']) && $style_config['bootstrap'] !== false) {
        $qt->setv('jquery_include', true);
    }
    // Default Eyecatch
    if (isset($skin_custom_vars['default_eyecatch']) && $skin_custom_vars['default_eyecatch'] && $qt->getv('main_visual') === '' && exist_plugin('eyecatch')) {
        $bg_image = $color = '';
        if (isset($skin_custom_vars['eyecatch_bgimage'])) {
            $bg_image = $skin_custom_vars['eyecatch_bgimage'];
            $bg_image = is_url($bg_image, TRUE, TRUE) || file_exists(get_file_path($bg_image)) ? $bg_image : '';
        }
        if (isset($skin_custom_vars['enable_eyecatch_bgimage']) && !$skin_custom_vars['enable_eyecatch_bgimage']) {
            $bg_image = '';
        }
        if (isset($skin_custom_vars['eyecatch_color'])) {
            $color = 'color=' . $skin_custom_vars['eyecatch_color'];
        }
        if (is_qblog()) {
            $title_copy = $qblog_title;
        } else {
            if (isset($skin_custom_vars['eyecatch_title_type']) && trim($skin_custom_vars['eyecatch_title_type']) == 'site') {
                $title_copy = $page_title;
            } else {
                if ($_page === $defaultpage) {
                    $title_copy = $page_title;
                } else {
                    $title_copy = get_page_title($_page);
                }
            }
        }
        $content = <<<EOD
! {$title_copy}
EOD;
        plugin_eyecatch_convert($bg_image, $color, '__default', $content);
    }
    if ($qt->getv('no_eyecatch')) {
        $qt->setv('main_visual', "<!-- no eyecatch -->");
    }
    // Determine emptiness of eyecatch
    $qt->setv('eyecatch_is_empty', $qt->getv('no_eyecatch') || $qt->getv('main_visual') === '');
    if (isset($skin_custom_vars['palette_color']) && trim($skin_custom_vars['palette_color'])) {
        $qt->setv('palette_color', trim($skin_custom_vars['palette_color']));
        $qt->setv('palette_color_class', 'haik-palette-' . trim($skin_custom_vars['palette_color']));
    }
    //JQuery Include
    $jquery_script = '';
    $jquery_cookie_script = '';
    if ($qt->getv('jquery_include')) {
        $jquery_script = '<script type="text/javascript" src="js/jquery.js"></script>';
        $jquery_cookie_script = '<script type="text/javascript" src="js/jquery.cookie.js"></script>';
    }
    if ($qt->getv('bootstrap_script')) {
        $bootstrap_script = $qt->getv('bootstrap_script');
    }
    $qt->setv('jquery_script', $jquery_script . $bootstrap_script);
    $qt->setv('jquery_cookie_script', $jquery_cookie_script);
    $longtaketime = getmicrotime() - MUTIME;
    $taketime = sprintf('%01.03f', $longtaketime);
    $qt->setv('taketime', $taketime);
    //UniversalAnalytics Tracking Code
    if ($code = $qt->getv('ga_universal_analytics')) {
        $qt->appendv('beforescript', $code);
    }
    //------------------------------------------------------------------
    // WordPressデザイン
    if ($enable_wp_theme && ($vars['cmd'] != 'qhmsetting' && $vars['plugin'] != 'qhmsetting')) {
        define('TEMPLATEPATH', 'skin/wordpress/' . $enable_wp_theme_name);
        include LIB_DIR . 'wp_adapter.php';
        wp_load_functions();
        $skin_file = get_wp_skin_file();
    }
    //-------------------------------------------------------------------
    //-------------------------------------------------------------------
    // 	プレビュー用のskinファイルを表示
    $tmpfilename = '';
    if (isset($_SESSION['temp_skin']) && strlen($_SESSION['temp_skin']) > 0) {
        $tmpfilename = $skin_file = tempnam(realpath(CACHEQHM_DIR), 'qhmdesign');
        file_put_contents($skin_file, $_SESSION['temp_skin']);
        $qt->setv('default_css', $bootstrap_css . $_SESSION['temp_css']);
        $qt->setv('style_path', $_SESSION['temp_style_path']);
    }
    //-------------------------------------------------------------------
    //skinファイルを読み込んで、表示
    $qt->read($skin_file, $_page);
    // 一時ファイルの削除
    if (file_exists($tmpfilename) && strpos(basename($tmpfilename), 'qhmdesign') === 0) {
        unlink($tmpfilename);
    }
}
Пример #18
0
 public static function sendEmail($order_id, array $authors_ids, $subject, $body, $needAttachments = false, $isHTML = false)
 {
     static $order, $manager, $filial, $attachments;
     if (!is_array($authors_ids)) {
         return false;
     }
     if (empty($order)) {
         try {
             $order = Order::find($order_id);
         } catch (Exception $e) {
             return false;
         }
     }
     if (empty($manager)) {
         try {
             $manager = Employee::find($order['manager_id']);
         } catch (Exception $e) {
             return false;
         }
     }
     $replyTo = array('email' => $manager['email'], 'name' => $manager['fio']);
     if (empty($filial)) {
         try {
             $filial = Filial::find($order['filial_id']);
         } catch (Exception $e) {
             return false;
         }
     }
     $from = array('email' => $filial['email'], 'name' => $filial['name']);
     if ($needAttachments && !is_array($attachments)) {
         $attachments = OrderFile::findBy(array('order_id' => $order_id));
         if (count($attachments)) {
             foreach ($attachments as &$file) {
                 $file['path'] = get_file_path($order_id, $file);
             }
             unset($file);
         }
     } else {
         $attachments = is_array($attachments) ? $attachments : array();
     }
     $result = array();
     foreach ($authors_ids as $id) {
         if (is_numeric($id)) {
             try {
                 $author = Employee::find($id);
             } catch (Exception $e) {
                 continue;
             }
             $receiver = array('email' => $author['email'], 'name' => $author['fio']);
             $email = new Email();
             $email->setData($receiver, $subject, $body, $attachments, $isHTML, $replyTo, $from);
             if (!$email->send()) {
                 $result[] = $receiver;
             }
         } else {
             $ids = explode(', ', $id);
             $temp_result = self::sendEmail($order_id, $ids, $subject, $body, $needAttachments, $isHTML);
             if (count($temp_result)) {
                 array_push($result, $temp_result);
             }
         }
     }
     return $result;
 }
Пример #19
0
function get_file_path($code)
{
    return "./index/{$code}/_result_{$code}.log";
}
?>


<?php 
$temp_file = "./c_p";
$c_p_array = array();
$p_c_array = array();
//单key多值数组
$class = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J");
//$class = array("A");
foreach ($class as $c) {
    $path = get_file_path($c);
    $fp = fopen($path, "r");
    while ($line = readLine($fp)) {
        $arr = explode(" ", $line);
        if (count($arr) != 2) {
            continue;
        }
        $line = $arr[0];
        $arr = explode("#", $line);
        $len = count($arr);
        for ($i = 1; $i < $len; $i++) {
            $c_p_array[$arr[$i]] = $arr[$i - 1];
        }
        $p_c_array[$arr[$len - 1]] = array();
        //最后一个是叶子节点,下面就是具体文章了
    }
Пример #20
0
function get_rss_enclosure($file_name, $image_type, $cat_id)
{
    if (!get_file_path($file_name, $image_type, $cat_id, 0, 0)) {
        return array();
    }
    $file = get_file_path($file_name, $image_type, $cat_id, 0, 1);
    $url = get_file_url($file_name, $image_type, $cat_id);
    return array('url' => $url, 'length' => @filesize($file), 'type' => get_mime_content_type($file));
}
Пример #21
0
function generate_smilies($mode, $page_id)
{
    global $db, $board_config, $template, $lang, $images, $theme, $phpbb_root_path;
    global $user_ip, $session_length, $starttime;
    global $userdata;
    $inline_columns = 4;
    $inline_rows = 5;
    $window_columns = 8;
    if ($mode == 'window') {
        $userdata = session_pagestart($user_ip, $page_id);
        init_userprefs($userdata);
        $gen_simple_header = TRUE;
        $page_title = $lang['Review_topic'] . " - {$topic_title}";
        include $phpbb_root_path . 'includes/page_header.php';
        $template->set_filenames(array('smiliesbody' => 'posting_smilies.tpl'));
    }
    $sql = "SELECT emoticon, code, smile_url   \r\n\t\tFROM " . SMILIES_TABLE . " \r\n\t\tORDER BY smilies_id";
    if ($result = $db->sql_query($sql)) {
        $num_smilies = 0;
        $rowset = array();
        while ($row = $db->sql_fetchrow($result)) {
            if (empty($rowset[$row['smile_url']])) {
                $rowset[$row['smile_url']]['code'] = str_replace('\\', '\\\\', str_replace("'", "\\'", $row['code']));
                $rowset[$row['smile_url']]['emoticon'] = $row['emoticon'];
                $num_smilies++;
            }
        }
        if ($num_smilies) {
            $smilies_count = $mode == 'inline' ? min(19, $num_smilies) : $num_smilies;
            $smilies_split_row = $mode == 'inline' ? $inline_columns - 1 : $window_columns - 1;
            $s_colspan = 0;
            $row = 0;
            $col = 0;
            while (list($smile_url, $data) = @each($rowset)) {
                if (!$col) {
                    $template->assign_block_vars('smilies_row', array());
                }
                $template->assign_block_vars('smilies_row.smilies_col', array('SMILEY_CODE' => $data['code'], 'SMILEY_IMG' => get_file_path($smile_url, $board_config['smilies_path'] . '/'), 'SMILEY_DESC' => $data['emoticon']));
                $s_colspan = max($s_colspan, $col + 1);
                if ($col == $smilies_split_row) {
                    if ($mode == 'inline' && $row == $inline_rows - 1) {
                        break;
                    }
                    $col = 0;
                    $row++;
                } else {
                    $col++;
                }
            }
            if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns) {
                $template->assign_block_vars('switch_smilies_extra', array());
                $template->assign_vars(array('L_MORE_SMILIES' => $lang['More_emoticons'], 'U_MORE_SMILIES' => append_sid("posting.php?mode=smilies")));
            }
            $template->assign_vars(array('L_EMOTICONS' => $lang['Emoticons'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'S_SMILIES_COLSPAN' => $s_colspan));
        }
    }
    if ($mode == 'window') {
        $template->pparse('smiliesbody');
        include $phpbb_root_path . 'includes/page_tail.php';
    }
}
function cron_sendEmailNotifications()
{
    $execution_time = ini_get('max_execution_time');
    if (empty($execution_time)) {
        $execution_time = DEF_EXEC_TIME;
    } else {
        if ($execution_time > MAX_EXEC_TIME * 2) {
            $execution_time = MAX_EXEC_TIME * 2;
        }
    }
    $execution_time_start = time();
    $execution_time_end = $execution_time_start + $execution_time / 2;
    $notifications = \Components\Entity\EmailNotification::findBy(array(), array('attempts_to_send' => 'ASC'), EMAIL_NOTIFICATION_LIMIT, 0);
    $notification_index = 0;
    $good_cnt = 0;
    $notification_count = count($notifications);
    while (time() <= $execution_time_end && $notification_index < $notification_count) {
        $notification = $notifications[$notification_index];
        $message = \Components\Entity\Message::find($notification['message_id']);
        if (!empty($message)) {
            //Прочитано, или не шлем - надо его сразу убить, чтобы потом когда включим не повалил шквал старых писем
            if ($message['readed'] || !\Components\Entity\EmailNotificationType::isSendable($notification['type'])) {
                \Components\Entity\EmailNotification::delete($notification['id']);
            } else {
                $attachments = array();
                // надо только для писем типа \Components\Entity\EmailNotification::TO_SUBSCRIBED_AUTHORS_ON_DISTRIBUTION
                $all_added_size = 0;
                $fna = 0;
                if ($notification['type'] == \Components\Entity\EmailNotification::TO_SUBSCRIBED_AUTHORS_ON_DISTRIBUTION && !empty($message['order_id'])) {
                    $files = get_order_files($message['order_id']);
                    foreach ($files as $file) {
                        $all_added_size += $file['size'];
                        if ($all_added_size > 16000000) {
                            // write to body, but not add file
                            $fna++;
                        } else {
                            $attachments[] = array('path' => get_file_path($message['order_id'], $file), 'name' => $file['name']);
                        }
                    }
                }
                $subtext = "";
                if ($fna) {
                    $subtext = "<br><br>-----------------------------------<br>" . "Еще " . $fna . " файла(ов) не были добавлены к письму из-за ограничения размеров";
                }
                // Это условие проверено выше
                //if ( \Components\Entity\EmailNotificationType::isSendable($notification['type']) )
                //{
                $email = new \Components\Classes\Email();
                $email->IsHTML(true);
                $email->setData(array('email' => $notification['receiver_email'], 'name' => ''), $message['subject'], $message['text'] . $subtext, $attachments, true, Message::getReceiverEmailAndName($message['creator_id']), Message::getReceiverEmailAndName($message['creator_id']));
                try {
                    $send_result = $email->send();
                    if ($send_result) {
                        \Components\Entity\EmailNotification::delete($notification['id']);
                        $good_cnt++;
                    } else {
                        \Components\Entity\EmailNotification::update($notification['id'], array('attempts_to_send' => $notification['attempts_to_send'] + 1, 'last_attempt' => time(), 'last_error' => $email->ErrorInfo));
                    }
                } catch (\Components\Exceptions\Exception $e) {
                    \Components\Entity\EmailNotification::update($notification['id'], array('attempts_to_send' => $notification['attempts_to_send'] + 1, 'last_attempt' => time()));
                }
                unset($email);
                //}
            }
        }
        $notification_index++;
    }
    db::query("update ofc_sys_log set p_value=" . $execution_time_start . " where p_name='email_notify_last_tm_start'");
    db::query("update ofc_sys_log set p_value=" . (time() - $execution_time_start) . " where p_name='email_notify_last_tm_work'");
    db::query("update ofc_sys_log set p_value=" . $notification_index . " where p_name='email_notify_last_all_cnt'");
    db::query("update ofc_sys_log set p_value=" . $good_cnt . " where p_name='email_notify_last_good_cnt'");
}
Пример #23
0
 /**
  * Generates a full path+filename for the given filename, which can either
  * be an absolute name, or a name relative to the rootdir for this Template
  * object.
  */
 function make_filename($filename)
 {
     // Check if it's an absolute or relative path.
     $filename = get_file_path($filename, '/design/phpbb/templates/' . $this->style_name . '/');
     if (!file_exists($filename)) {
         die("Template->make_filename(): Error - file {$filename} does not exist");
     }
     return $filename;
 }
Пример #24
0
 $bgcounter = 0;
 echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
 if ($countimages['images'] > 0) {
     echo "<tr class=\"tableseparator\">\n";
     echo "<td class=\"tableseparator\">" . $lang['validate'] . "</td>\n<td class=\"tableseparator\">" . $lang['delete'] . "</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">" . $lang['field_image_name'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_category'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_username'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_date'] . "</td>\n<td class=\"tableseparator\">" . $lang['options'] . "</td>\n</tr>\n";
     $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_date, i.image_media_file" . get_user_table_field(", u.", "user_name") . "\n            FROM " . IMAGES_TEMP_TABLE . " i\n            LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)\n            WHERE {$condition}\n            ORDER BY {$orderby} {$direction}\n            LIMIT {$limitstart}, {$limitnumber}";
     $result = $site_db->query($sql);
     while ($image_row = $site_db->fetch_array($result)) {
         echo "<tr class=\"" . get_row_bg() . "\">";
         $image_path = is_remote($image_row['image_media_file']) ? $image_row['image_media_file'] : MEDIA_TEMP_PATH . "/" . $image_row['image_media_file'];
         $file_src = get_file_path($image_row['image_media_file'], "media", 0, 1);
         echo "<td><input type=\"radio\" name=\"image_list[" . $image_row['image_id'] . "]\" value=\"1\"></td>";
         echo "<td><input type=\"radio\" name=\"image_list[" . $image_row['image_id'] . "]\" value=\"0\"></td>";
         echo "<td><a href=\"" . $image_path . "\" target=\"_blank\"><img src=\"" . $file_src . "\" border=\"1\" height=\"50\"></a></td>";
         echo "<td><b><a href=\"" . $image_path . "\" target=\"_blank\">" . format_text($image_row['image_name'], 2) . "</a></b> (" . $image_row['image_media_file'];
         if (!get_file_path($image_row['image_media_file'], "media", 0, 0, 0)) {
             echo " <b class=\"marktext\">!</b>";
         }
         echo ")</td>\n";
         echo "<td><a href=\"" . $site_sess->url(ROOT_PATH . "categories.php?" . URL_CAT_ID . "=" . $image_row['cat_id']) . "\" target=\"_blank\">" . format_text($cat_cache[$image_row['cat_id']]['cat_name'], 2) . "</a></td>\n";
         $show_user_name = format_text($image_row[$user_table_fields['user_name']], 2);
         if ($image_row['user_id'] != GUEST && empty($url_show_profile)) {
             $show_user_name = "<a href=\"" . $site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $image_row['user_id']) . "\" target=\"_blank\">{$show_user_name}</a>";
         }
         echo "<td>" . $show_user_name . "</td>\n";
         echo "<td>" . format_date($config['date_format'] . " " . $config['time_format'], $image_row['image_date']) . "</td>\n";
         echo "<td><p>";
         show_text_link($lang['edit'], "validateimages.php?action=editimage&image_id=" . $image_row['image_id']);
         echo "</p></td>\n";
         echo "</tr>\n";
     }
Пример #25
0
function smilies_pass($message)
{
    static $orig, $repl;
    if (!isset($orig)) {
        global $db, $board_config;
        $orig = $repl = array();
        $sql = 'SELECT code, smile_url FROM ' . SMILIES_TABLE;
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
        }
        $smilies = $db->sql_fetchrowset($result);
        usort($smilies, 'smiley_sort');
        for ($i = 0; $i < count($smilies); $i++) {
            $orig[] = "/(?<=.\\W|\\W.|^\\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\\W|\\W.|\\W\$)/";
            $smile_file_path = get_file_path($smilies[$i]['smile_url'], $board_config['smilies_path'] . '/');
            $repl[] = '<img src="' . $smile_file_path . '" alt="' . $smilies[$i]['smile_url'] . '" border="0" />';
        }
    }
    if (count($orig)) {
        $message = preg_replace($orig, $repl, ' ' . $message . ' ');
        $message = substr($message, 1, -1);
    }
    return $message;
}
Пример #26
0
    }
}
require $phpbb_root_path . 'admin/pagestart.php';
//
// Check to see what mode we should operate in.
//
if (isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode'])) {
    $mode = isset($HTTP_POST_VARS['mode']) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
} else {
    $mode = "";
}
$delimeter = '=+:';
//
// Read a listing of uploaded smilies for use in the add or edit smliey code...
//
$smilies_dir_name = get_file_path($board_config['smilies_path']);
$dir = @opendir($smilies_dir_name);
while ($file = @readdir($dir)) {
    if (!@is_dir($smilies_dir_name . '/' . $file)) {
        $img_size = @getimagesize($smilies_dir_name . '/' . $file);
        if ($img_size[0] && $img_size[1]) {
            $smiley_images[] = $file;
        } else {
            if (eregi('.pak$', $file)) {
                $smiley_paks[] = $file;
            }
        }
    }
}
@closedir($dir);
//
Пример #27
0
    $next_image_url = REPLACE_EMPTY;
    $next_image_file = REPLACE_EMPTY;
    $next_thumb_file = REPLACE_EMPTY;
}
if (!empty($next_prev_cache[$prev_image_id])) {
    $prev_image_name = format_text($next_prev_cache[$prev_image_id]['image_name'], 2);
    $prev_image_url = $site_sess->url(ROOT_PATH . "details.php?" . URL_IMAGE_ID . "=" . $prev_image_id . (!empty($mode) ? "&amp;mode=" . $mode : ""));
    if (!get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
        $prev_image_file = ICON_PATH . "/404.gif";
    } else {
        $prev_image_file = get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
    }
    if (!get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
        $prev_thumb_file = ICON_PATH . "/" . get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']) . ".gif";
    } else {
        $prev_thumb_file = get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
    }
} else {
    $prev_image_name = REPLACE_EMPTY;
    $prev_image_url = REPLACE_EMPTY;
    $prev_image_file = REPLACE_EMPTY;
    $prev_thumb_file = REPLACE_EMPTY;
}
$site_template->register_vars(array("next_image_id" => $next_image_id, "next_image_name" => $next_image_name, "next_image_url" => $next_image_url, "next_image_file" => $next_image_file, "next_thumb_file" => $next_thumb_file, "prev_image_id" => $prev_image_id, "prev_image_name" => $prev_image_name, "prev_image_url" => $prev_image_url, "prev_image_file" => $prev_image_file, "prev_thumb_file" => $prev_thumb_file));
unset($next_prev_cache);
//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$error = 0;
if ($action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
    $id = intval($HTTP_POST_VARS[URL_ID]);
Пример #28
0
/**
 *   Image Carousel
 *   -------------------------------------------
 *   bs_carousel.inc.php
 *
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *
 *   created  : 14/05/21
 *   modified :
 *
 *   Description
 *
 *
 *   Usage :
 *
 */
function plugin_bs_carousel_convert()
{
    global $vars, $script;
    static $slide_num = 0;
    $qt = get_qt();
    $args = func_get_args();
    $body = strip_autolink(array_pop($args));
    // Already htmlspecialchars(text)
    $indicator = $slide_button = TRUE;
    $item_height = '';
    $item_class = ' fit';
    $fit = TRUE;
    $cols = $cols_offset = NULL;
    //options
    foreach ($args as $arg) {
        switch ($arg) {
            case 'nobutton':
                $indicator = $slide_button = FALSE;
                break;
            case 'noindicator':
                $indicator = FALSE;
                break;
            case 'noslidebutton':
                $slide_button = FALSE;
                break;
            case 'nofit':
                $item_class = '';
                $fit = FALSE;
                break;
            case preg_match('/^height=(.+)$/', $arg, $mts) ? true : false:
                $item_height = $mts[1];
                break;
            case preg_match('/^(\\d+)(?:\\+(\\d+))?$/', $arg, $mts) ? true : false:
                $cols = $mts[1];
                $cols_offset =& $mts[2];
                break;
            default:
        }
    }
    $body = str_replace("\r", "\n", $body);
    $lines = explode("\n", $body);
    $slide_num++;
    $items = array();
    $cnt = 0;
    $min_width = FALSE;
    foreach ($lines as $line) {
        $line = trim($line);
        if ($line == '') {
            continue;
        }
        $options = explode(',', $line);
        $to = '';
        foreach ($options as $i => $opt) {
            $opt = trim($opt);
            if (preg_match('/^link_to=(.*)$/', $opt, $mts)) {
                $to = $mts[1];
                if (!is_url($to) && is_page($to)) {
                    $to = $script . '?' . rawurlencode($to);
                }
                break;
            }
        }
        if ($to) {
            array_splice($options, $i, 1);
        }
        $options = join(',', $options);
        list($filename, $title, $caption) = explode(',', $options, 3);
        $filepath = get_file_path($filename);
        $image = '';
        if (file_exists($filepath)) {
            list($_width, $_height) = getimagesize($filepath);
            $min_width = $min_width !== FALSE ? min($_width, $min_width) : $_width;
            $image = '<img src="' . h($filepath) . '" alt="">';
            $image_url = dirname($script) . '/' . $filepath;
        } else {
            $image = '<img src="' . h($filepath) . '" alt="">';
            $image_url = $filepath;
        }
        // set first image
        $qt->set_first_image($image_url);
        $h = $title ? '<h3 class="no-toc">' . h($title) . '</h3>' : '';
        // アイキャッチの場合は、タイトルをh1にする
        global $is_eyecatch;
        if ($is_eyecatch) {
            $h = $title ? '<h1 class="no-toc">' . h($title) . '</h1>' : '';
        }
        // 画像クリックでリンク可能にする
        $onclick = '';
        $add_style = '';
        if ($to !== '') {
            $onclick = ' onclick="location.href = \'' . h($to) . '\'"';
            $add_style = 'cursor:pointer;';
        }
        $p = $caption ? convert_html($caption) : '';
        $block = ($h or $p);
        $items[] = '
		<div class="item' . ($cnt ? '' : ' active') . $item_class . '" style="' . ($item_height ? ' max-height:' . h($item_height) . 'px;min-height:' . h($item_height) . 'px;' : '') . $add_style . '"' . $onclick . '>
			' . $image . '
			<div class="' . ($block ? 'carousel-caption' : '') . '">
			' . $h . '
			' . $p . '
			</div>
		</div>
';
        $cnt++;
    }
    $plural = $cnt > 1;
    if ($cnt > 0) {
        $id = 'slide_' . $slide_num;
        $html = '
<div id="' . $id . '" class="qhm-bs-carousel carousel slide" data-ride="carousel" style="' . ($fit === FALSE && $min_width !== FALSE ? 'max-width:' . $min_width . 'px;' : '') . '">
';
        if ($plural && $indicator) {
            $html .= '
	<ol class="carousel-indicators">
';
            for ($i = 0; $i < $cnt; $i++) {
                $html .= '
		<li data-target="#' . $id . '" data-slide-to="' . $i . '" class="' . ($i ? '' : 'active') . '"></li>
';
            }
            $html .= '
</ol>';
        }
        $html .= '
	<div class="carousel-inner">
		' . join("\n", $items) . '
	</div>
';
        if ($plural && $slide_button) {
            $html .= '
	<a href="#' . $id . '" class="left carousel-control" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
	<a href="#' . $id . '" class="right carousel-control" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
';
        }
        $html .= '
</div>
';
        if ($cols) {
            $class_attr = 'col-sm-' . $cols;
            if ($cols_offset) {
                $class_attr .= ' col-sm-offset-' . $cols_offset;
            }
            $html = '<div class="row"><div class="' . $class_attr . '">' . $html . '</div></div>' . "\n";
        }
        // Output CSS
        $addstyle = '
<style>
.carousel.qhm-bs-carousel .item.fit > img {
  width: 100%;
  max-width: 100%;
  min-width: 100%;
}
.carousel .carousel-control {
  outline-style: none;
}
</style>
';
        $qt->appendv_once('plugin_bs_carousel_css', 'beforescript', $addstyle);
    }
    return $html;
}
Пример #29
0
function setup_style($style)
{
	global $db, $board_config, $template, $images, $phpbb_root_path;

	$sql = "SELECT *
		FROM " . THEMES_TABLE . "
		WHERE themes_id = $style";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(CRITICAL_ERROR, 'Could not query database for theme info');
	}

	if ( !($row = $db->sql_fetchrow($result)) )
	{
		message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
	}

	$template_name = $row['template_name'] ;

	$template = new Template();

	if ( $template )
	{
		$template->set_style_name($template_name);
		
		$cfg_file_name = get_file_path($template_name . '.cfg', '/design/phpbb/templates/' . $template_name . '/');
		@include($cfg_file_name);

		if ( !defined('TEMPLATE_CONFIG') )
		{
			message_die(CRITICAL_ERROR, "Could not open $template_name template config file", '', __LINE__, __FILE__);
		}

		if(file_exists(PROJECT_DIR . '/design/phpbb/templates/' . $template_name . '/images/lang_' . $board_config['default_lang']))
			$img_lang = $board_config['default_lang'];
		elseif(file_exists(LIMB_DIR . '/design/phpbb/templates/' . $template_name . '/images/lang_' . $board_config['default_lang']))
			$img_lang = $board_config['default_lang'];
		else
			message_die(CRITICAL_ERROR, 'Could not find images folder', '', __LINE__, __FILE__);

		while( list($key, $value) = @each($images) )
		{
			if ( !is_array($value) )
			{
				$images[$key] = str_replace('{LANG}', 'lang_' . $img_lang, $value);			
				$images[$key] = get_file_path($images[$key], '/design/phpbb/templates/' . $template_name . '/images/');
			}
			else
			{
				foreach(array_keys($images[$key]) as $sub_key)
					$images[$key][$sub_key] = get_file_path($images[$key][$sub_key], '/design/phpbb/templates/' . $template_name . '/images/');
			}
		}
	}

	return $row;
}
Пример #30
0
     echo "<b>" . $countimages['images'] . "</b>.";
 }
 echo "<br />" . $lang['no_image_found'];
 show_form_header("images.php", "removeimage", "form");
 echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
 if ($countimages['images'] > 0) {
     echo "<tr class=\"tableseparator\">\n";
     echo "<td class=\"tableseparator\"><input name=\"allbox\" type=\"checkbox\" onClick=\"CheckAll();\" /></td>\n";
     echo "<td class=\"tableseparator\">" . $lang['field_image_name'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_category'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_username'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_date'] . "</td>\n<td class=\"tableseparator\">" . $lang['options'] . "</td>\n</tr>\n";
     $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_date" . get_user_table_field(", u.", "user_name") . "\n            FROM " . IMAGES_TABLE . " i\n            LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)\n            WHERE {$condition}\n            ORDER BY {$orderby} {$direction}\n            LIMIT {$limitstart}, {$limitnumber}";
     $result = $site_db->query($sql);
     while ($image_row = $site_db->fetch_array($result)) {
         echo "<tr class=\"" . get_row_bg() . "\">";
         echo "<td><input type=\"checkbox\" name=\"deleteimages[]\" value=\"" . $image_row['image_id'] . "\" /></td>";
         echo "<td><b><a href=\"" . $site_sess->url(ROOT_PATH . "details.php?" . URL_IMAGE_ID . "=" . $image_row['image_id']) . "\" target=_blank>" . format_text($image_row['image_name'], 2) . "</a></b> (" . $image_row['image_media_file'];
         if (!get_file_path($image_row['image_media_file'], "media", $image_row['cat_id'], 1, 0)) {
             echo " <b class=\"marktext\">!</b>";
         }
         echo ")</td>\n";
         echo "<td><a href=\"" . $site_sess->url(ROOT_PATH . "categories.php?" . URL_CAT_ID . "=" . $image_row['cat_id']) . "\" target=\"_blank\">" . format_text($cat_cache[$image_row['cat_id']]['cat_name'], 2) . "</a></td>\n";
         $show_user_name = format_text($image_row[$user_table_fields['user_name']], 2);
         if ($image_row['user_id'] != GUEST && empty($url_show_profile)) {
             $show_user_name = "<a href=\"" . $site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $image_row['user_id']) . "\" target=\"_blank\">{$show_user_name}</a>";
         }
         echo "<td>" . $show_user_name . "</a></td>\n";
         echo "<td>" . format_date($config['date_format'], $image_row['image_date']) . "</td>\n";
         echo "<td><p>";
         show_text_link($lang['edit'], "images.php?action=editimage&image_id=" . $image_row['image_id']);
         show_text_link($lang['delete'], "images.php?action=removeimage&image_id=" . $image_row['image_id']);
         echo "</p></td>\n";
         echo "</tr>\n";