当前位置: 首页>>代码示例>>PHP>>正文


PHP common::GetDir方法代码示例

本文整理汇总了PHP中common::GetDir方法的典型用法代码示例。如果您正苦于以下问题:PHP common::GetDir方法的具体用法?PHP common::GetDir怎么用?PHP common::GetDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common的用法示例。


在下文中一共展示了common::GetDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ClassesForm

 /**
  * Display form for selecting classes
  *
  */
 function ClassesForm()
 {
     global $dataDir, $langmessage, $addonPathCode, $addonRelativeCode, $page;
     echo '<h2 class="hmargin">Manage Classes</h2>';
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'LoadDefault':
             $classes = self::Defaults();
             break;
         case 'LoadBootstrap':
             $classes = self::Bootstrap();
             break;
         default:
             $classes = self::GetClasses();
             break;
     }
     $classes[] = array('names' => '', 'desc' => '');
     $page->jQueryCode .= '$(".sortable_table").sortable({items : "tr",handle: "td"});';
     // FORM
     echo '<form action="' . $this->admin_link . '" method="post">';
     echo '<table class="bordered full_width sortable_table">';
     echo '<thead><tr><th>className(s)</th><th>Description (optional)</th></tr></thead>';
     echo '<tbody>';
     foreach ($classes as $key => $classArray) {
         echo '<tr><td>';
         echo '<img alt="" src="' . common::GetDir('/include/imgs/drag_handle.gif') . '" /> &nbsp; ';
         echo '<input size="16" class="gpinput" type="text" name="class_names[]" value="' . $classArray['names'] . '"/>';
         echo '</td><td>';
         echo '<input size="64" class="gpinput" type="text" name="class_desc[]" value="' . $classArray['desc'] . '"/> ';
         echo '<a class="gpbutton rm_table_row" title="Remove Item" data-cmd="rm_table_row">&times;</a>';
         echo '</td></tr>';
     }
     echo '<tr><td colspan="3">';
     echo '<a data-cmd="add_table_row">Add Row</a>';
     echo '</td></tr>';
     echo '</tbody>';
     echo '</table>';
     echo '<br/>';
     // SAVE / CANCEL BUTTONS
     echo '<button type="submit" name="cmd" value="SaveClasses" class="gpsubmit">' . $langmessage['save'] . '</button>';
     echo '<button type="submit" name="cmd" value="" class="gpcancel">' . $langmessage['cancel'] . '</button>';
     echo '<div style="margin-top:2em; border:1px solid #ccc; background:#fafafa; border-radius:3px; padding:12px;">';
     echo 'CSS classNames you set here will be easily selectable in the Section Attributes dialog.';
     echo '<ul>';
     echo '<li>Single classNames (like <em>gpRow</em>) will show as checkboxes</li>';
     echo '<li>Multiple, space separated classNames (like <em>gpCol-1 gpCol-2 gpCol-3 [&hellip;]</em> will show as checkable dropdown list.</li>';
     echo '<li>The list is drag&rsquo;n&rsquo;drop sortable.</li>';
     echo '</ul><hr/>';
     echo '</form>';
     //$tooltip = $isBootswatchTheme ? ":-) Your current default theme is Bootstrap based - cleared for Take Off!" : ":-/ You will have to use a Bootstrap based theme for this preset!";
     echo '<p>';
     echo '<form action="' . $this->admin_link . '" method="get">';
     echo '<button class="gpbutton" name="cmd" value="LoadBootstrap">Load the Bootstrap Preset</button> ';
     echo '<button class="gpbutton" name="cmd" value="LoadDefault">Load the Default Preset</button>';
     echo '</p>';
     echo '</div>';
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:61,代码来源:admin_classes.php

示例2: ProtectOptions

function ProtectOptions($title, $menu_key, $menu_value, $layout_info)
{
    global $protect_object;
    $is_protected = $protect_object->IsProtected($menu_key);
    if (!$is_protected) {
        $label = 'Protect Page';
    } elseif ($is_protected === 1) {
        $label = 'Remove Protection';
    } elseif ($is_protected === 2) {
        $label = 'Parent Protected';
    }
    $img = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" height="16" width="16" />';
    //echo common::Link($title,$img.$label,'cmd=passprotect','name="gpajax"');
    echo common::Link('Admin_Menu', $img . $label, 'cmd=passprotect&index=' . $menu_key, 'name="postlink"');
    //menupost
}
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:16,代码来源:MenuPageOptions.php

示例3: GalleryEditBox

 function GalleryEditBox($title, $info)
 {
     if (is_array($info)) {
         $icon = $info['icon'];
     } else {
         $icon = $info;
     }
     if (empty($icon)) {
         $thumbPath = common::GetDir('/include/imgs/blank.gif');
     } elseif (strpos($icon, '/thumbnails/') === false) {
         $thumbPath = common::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
     } else {
         $thumbPath = common::GetDir('/data/_uploaded' . $icon);
     }
     echo '<div class="draggable">';
     echo common::Link('Special_Galleries', htmlspecialchars($title), 'cmd=drag&to=%s&title=' . urlencode($title), 'data-cmd="gpajax" class="dragdroplink nodisplay" ');
     echo '<input type="hidden" name="title" value="' . htmlspecialchars($title) . '" class="title" />';
     echo ' <img src="' . $thumbPath . '" alt="" class="icon"/>';
     echo '<div class="caption">';
     echo str_replace('_', ' ', $title);
     echo '</div>';
     echo '</div>';
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:23,代码来源:admin_galleries.php

示例4: SetDataFolder

 /**
  * Set global path variables for the current addon
  * @param string $addon_key Key used to identify a plugin uniquely in the configuration
  *
  */
 function SetDataFolder($addon_key)
 {
     global $dataDir, $config;
     global $addonDataFolder, $addonCodeFolder;
     //deprecated
     global $addonRelativeCode, $addonRelativeData, $addonPathData, $addonPathCode, $addonFolderName, $addon_current_id, $addon_current_version;
     if (!isset($config['addons'][$addon_key])) {
         return;
     }
     gpPlugin::StackPush();
     $data_folder = gpPlugin::GetDataFolder($addon_key);
     $addon_current_id = $addon_current_version = false;
     if (isset($config['addons'][$addon_key]['id'])) {
         $addon_current_id = $config['addons'][$addon_key]['id'];
     }
     if (isset($config['addons'][$addon_key]['version'])) {
         $addon_current_version = $config['addons'][$addon_key]['version'];
     }
     $addonFolderName = $addon_key;
     $addonPathCode = $addonCodeFolder = $dataDir . '/data/_addoncode/' . $addon_key;
     $addonPathData = $addonDataFolder = $dataDir . '/data/_addondata/' . $data_folder;
     $addonRelativeCode = common::GetDir('/data/_addoncode/' . $addon_key);
     $addonRelativeData = common::GetDir('/data/_addondata/' . $data_folder);
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:29,代码来源:Plugins.php

示例5: CurrentRating

 function CurrentRating($rating)
 {
     $width = 16 * 5;
     $pos = min($width, ceil($width * $rating));
     $pos2 = $width - ceil($pos);
     echo '<span title="' . number_format($rating * 100, 0) . '%" class="addon_rating">';
     echo '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="' . $pos . '" />';
     echo '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="' . $pos2 . '" style="background-position:' . $pos2 . 'px -16px" />';
     echo '</span> ';
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:10,代码来源:admin_addon_install.php

示例6: AdminPanelLinks


//.........这里部分代码省略.........
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //add-ons
     $links = admin_tools::GetAddonLinks($in_panel);
     if (!empty($links)) {
         echo '<div class="panelgroup" id="panelgroup_addons' . $id_piece . '">';
         self::PanelHeading($in_panel, $langmessage['plugins'], 'icon_plug', 'add');
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['plugins'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //settings
     if ($links = admin_tools::GetAdminGroup('settings')) {
         echo '<div class="panelgroup" id="panelgroup_settings' . $id_piece . '">';
         self::PanelHeading($in_panel, $langmessage['Settings'], 'icon_edapp', 'set');
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Settings'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //updates
     if (count(self::$new_versions) > 0) {
         ob_start();
         if (gp_remote_update && isset(self::$new_versions['core'])) {
             echo '<li>';
             echo '<a href="' . common::GetDir('/include/install/update.php') . '">gpEasy ' . self::$new_versions['core'] . '</a>';
             echo '</li>';
         }
         foreach (self::$new_versions as $addon_id => $new_addon_info) {
             if (!is_numeric($addon_id)) {
                 continue;
             }
             $label = $new_addon_info['name'] . ':  ' . $new_addon_info['version'];
             if ($new_addon_info['type'] == 'theme' && gp_remote_themes) {
                 $url = 'Themes';
             } elseif ($new_addon_info['type'] == 'plugin' && gp_remote_plugins) {
                 $url = 'Plugins';
             } else {
                 continue;
             }
             echo '<li><a href="' . addon_browse_path . '/' . $url . '/' . $addon_id . '" data-cmd="remote">' . $label . '</a></li>';
         }
         $list = ob_get_clean();
         if (!empty($list)) {
             echo '<div class="panelgroup" id="panelgroup_versions' . $id_piece . '">';
             self::PanelHeading($in_panel, $langmessage['updates'], 'icon_rfrsh', 'upd');
             echo '<ul class="submenu">';
             echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['updates'] . '</a></li>';
             echo $list;
             echo '</ul>';
             echo '</div>';
             echo '</div>';
         }
     }
     //username
     echo '<div class="panelgroup" id="panelgroup_user' . $id_piece . '">';
     self::PanelHeading($in_panel, $gpAdmin['useralias'], 'icon_user', 'use');
     echo '<ul class="submenu">';
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:67,代码来源:admin_tools.php

示例7: Exported

 function Exported()
 {
     global $langmessage;
     if (count($this->exported) == 0) {
         return;
     }
     echo '<table class="bordered">';
     echo '<tr><th>';
     echo $langmessage['Previous Exports'];
     echo '</th><th> &nbsp; </th><th>';
     echo $langmessage['File Size'];
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     $total_size = 0;
     $total_count = 0;
     foreach ($this->exported as $file) {
         $info = $this->FileInfo($file);
         if (!$info) {
             continue;
         }
         $full_path = $this->export_dir . '/' . $file;
         if ($total_count % 2 == 0) {
             echo '<tr class="even">';
         } else {
             echo '<tr>';
         }
         echo '<td>';
         echo str_replace(' ', '&nbsp;', $info['time']);
         echo '</td><td>';
         echo implode(', ', $info['exported']);
         echo '</td><td>';
         $size = filesize($full_path);
         echo admin_tools::FormatBytes($size);
         echo ' ';
         echo $info['ext'];
         echo '</td><td>';
         echo '<a href="' . common::GetDir('/data/_exports/' . $file) . '">' . $langmessage['Download'] . '</a>';
         echo '&nbsp;&nbsp;';
         if ($this->CanRevert($info['bits'])) {
             echo common::Link('Admin_Port', $langmessage['Revert'], 'cmd=revert&archive=' . rawurlencode($file), '', $file);
         } else {
             echo $langmessage['Revert'];
         }
         echo '&nbsp;&nbsp;';
         echo common::Link('Admin_Port', $langmessage['delete'], 'cmd=delete&file=' . rawurlencode($file), array('data-cmd' => 'postlink', 'title' => $langmessage['delete_confirm'], 'class' => 'gpconfirm'), $file);
         echo '</td></tr>';
         $total_count++;
         $total_size += $size;
     }
     //totals
     echo '<tr><th>';
     echo $langmessage['Total'];
     echo ': ';
     echo $total_count;
     echo '</th><th>&nbsp;</th><th>';
     echo admin_tools::FormatBytes($total_size);
     echo '</th><th>&nbsp;</th></tr>';
     echo '</table>';
 }
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:60,代码来源:admin_port.php

示例8: ShowRedirection

 function ShowRedirection()
 {
     global $langmessage, $page, $gp_index, $config;
     $page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
     $page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
     echo '<p>' . $langmessage['About_Redirection'] . '</p>';
     echo common::Link('Admin_Missing', $langmessage['New Redirection'], 'cmd=newform', array('data-cmd' => 'gpabox'));
     if (empty($this->error_data['redirects'])) {
         return;
     }
     echo '<table class="bordered tablesorter full_width">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['Source URL'];
     echo '</th><th>';
     echo $langmessage['Target URL'];
     echo '</th><th>';
     echo $langmessage['Similarity'];
     echo '</th><th>';
     echo $langmessage['Method'];
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     echo '</thead>';
     echo '<tbody>';
     $has_invalid_target = false;
     $admin_urls = admin_tools::AdminScripts();
     foreach ($this->error_data['redirects'] as $source => $data) {
         echo '<tr><td>';
         $raw_source = $source;
         if (!empty($data['raw_source'])) {
             $raw_source = $data['raw_source'];
         }
         echo htmlspecialchars($raw_source);
         echo '</td><td>';
         $target_show = $data['target'];
         if (strlen($target_show) > 40) {
             $target_show = substr($target_show, 0, 15) . ' ... ' . substr($target_show, -15);
         }
         $full_target = $this->GetTarget($data['target'], false);
         echo '<a href="' . htmlspecialchars($full_target) . '">' . str_replace(' ', '&nbsp;', htmlspecialchars($target_show)) . '</a>';
         $is_gplink = $this->isGPLink($data['target']);
         if (!empty($data['target']) && $is_gplink) {
             if (!isset($gp_index[$data['target']]) && !isset($admin_urls[$data['target']])) {
                 $has_invalid_target = true;
                 echo ' <img src="' . common::GetDir('/include/imgs/error.png') . '" alt="" height="16" width="16" style="vertical-align:middle" title="' . $langmessage['Target URL Invalid'] . '"/> ';
             }
         }
         echo '</td><td>';
         if ($is_gplink) {
             $lower_source = strtolower($raw_source);
             $lower_target = strtolower($target_show);
             similar_text($lower_source, $lower_target, $percent);
             if ($config['auto_redir'] > 0 && $percent >= $config['auto_redir']) {
                 //echo '<span style="color:orange">'.number_format($percent,1).'%</span>';
                 echo number_format($percent, 1) . '%';
             } else {
                 echo number_format($percent, 1) . '%';
             }
         } else {
             echo '&nbsp;';
         }
         echo '</td><td>';
         echo $this->GetCodeLanguage($data['code']);
         echo '</td><td>';
         echo common::Link('Admin_Missing', $langmessage['edit'], 'cmd=editredir&source=' . urlencode($source), array('data-cmd' => 'gpabox'));
         echo ' &nbsp; ';
         echo common::Link($source, $langmessage['Test']);
         echo ' &nbsp; ';
         $title = sprintf($langmessage['generic_delete_confirm'], $source);
         echo common::Link('Admin_Missing', $langmessage['delete'], 'cmd=rmredir&link=' . urlencode($source), array('data-cmd' => 'postlink', 'title' => $title, 'class' => 'gpconfirm'));
         echo '</td></tr>';
     }
     echo '</tbody>';
     echo '</table>';
     echo '<p>';
     echo common::Link('Admin_Missing', $langmessage['New Redirection'], 'cmd=newform', array('data-cmd' => 'gpabox'));
     echo '</p>';
     if ($has_invalid_target) {
         echo '<p>';
         echo ' <img src="' . common::GetDir('/include/imgs/error.png') . '" alt="" height="16" width="16" style="vertical-align:middle" title="' . $langmessage['Target URL Invalid'] . '"/> ';
         echo $langmessage['Target URL Invalid'];
         echo '</p>';
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:85,代码来源:admin_missing.php

示例9: CSS_FixUrl

 function CSS_FixUrl($url, $pos, $pos2)
 {
     global $dataDir;
     $url = trim($url);
     $url = trim($url, '"\'');
     if (empty($url)) {
         return;
     }
     //relative url
     if ($url[0] == '/') {
         return;
     } elseif (strpos($url, '://') > 0) {
         return;
     } elseif (preg_match('/^data:/i', $url)) {
         return;
     }
     //use a relative path so sub.domain.com and domain.com/sub both work
     $replacement = common::GetDir(dirname($this->file) . '/' . $url);
     $replacement = $this->ReduceUrl($replacement);
     $replacement = '"' . $replacement . '"';
     $this->content = substr_replace($this->content, $replacement, $pos, $pos2 - $pos);
 }
开发者ID:AndFer22,项目名称:Typesetter,代码行数:22,代码来源:combine.php

示例10: DefaultContent

 /**
  * @static
  */
 static function DefaultContent($default_content, $type)
 {
     if (!self::ContentKeyMatch($type)) {
         return $default_content;
     }
     $section = array();
     ob_start();
     $id = 'carousel_' . time();
     echo '<div id="' . $id . '" class="gp_twitter_carousel carousel slide">';
     echo '<div style="padding-bottom:30%">';
     echo '<ol class="carousel-indicators">';
     echo '<li class="active gp_to_remove"></li>';
     echo '</ol>';
     //<!-- Carousel items -->
     echo '<div class="carousel-inner">';
     echo '<div class="item active gp_to_remove"><img/></div>';
     echo '</div>';
     //<!-- Carousel nav -->
     echo '<a class="carousel-control left" data-target="#' . $id . '" data-slide="prev">&lsaquo;</a>';
     echo '<a class="carousel-control right" data-target="#' . $id . '" data-slide="next">&rsaquo;</a>';
     echo '<span class="gp_blank_img" data-src="' . common::GetDir('/include/imgs/blank.gif') . '" style="display:none"></span>';
     echo '</div></div>';
     $section['content'] = ob_get_clean();
     $section['height'] = '30%';
     $section['auto_start'] = false;
     $section['interval_speed'] = 5000;
     return $section;
 }
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:31,代码来源:TwitterCarousel.php

示例11: rename_check

    return $args;
}
function rename_check($event, $args, $finder)
{
    $name = $args['name'];
    if (gp_restrict_uploads && !admin_uploaded::AllowedExtension($name)) {
        return false;
    }
    $args['name'] = $name;
    return $args;
}
function SaveFinderData($data)
{
    global $config;
    $config['finder_data'] = $data;
    admin_tools::SaveConfig();
}
function ReturnFinderData()
{
    global $config;
    if (isset($config['finder_data'])) {
        return $config['finder_data'];
    }
    return false;
}
$opts = array('debug' => gpdebug, 'saveData' => 'SaveFinderData', 'returnData' => 'ReturnFinderData', 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $dataDir . '/data/_uploaded/', 'URL' => common::GetDir('data/_uploaded'), 'accessControl' => 'access', 'tmbPath' => $dataDir . '/data/_elthumbs', 'tmbURL' => common::GetDir('data/_elthumbs'), 'separator' => '/', 'tmbBgColor' => 'transparent', 'copyOverwrite' => false, 'uploadOverwrite' => false, 'tmbPathMode' => gp_chmod_dir, 'dirMode' => gp_chmod_dir, 'fileMode' => gp_chmod_file)), 'bind' => array('duplicate upload rename rm paste resize' => array('admin_uploaded', 'FinderChange'), 'upload-before' => 'upload_check', 'rename-before' => 'rename_check'));
$opts = gpPlugin::Filter('FinderOptionsServer', array($opts));
gpSettingsOverride('finder_options_server', $opts);
// run Finder
$connector = new Finder($opts);
$connector->run();
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:31,代码来源:connector.php

示例12: IniContents

 /**
  * Parse the ini a second time with variables
  *
  */
 function IniContents()
 {
     global $dataDir, $dirPrefix;
     $folder = basename($this->dest);
     $variables = array('{$addon}' => $folder, '{$plugin}' => $folder, '{$dataDir}' => $dataDir, '{$dirPrefix}' => $dirPrefix, '{$addonRelativeData}' => common::GetDir('/data/_addondata/' . $this->data_folder), '{$addonRelativeCode}' => common::GetDir($this->addon_folder_rel . '/' . $folder));
     $this->ini_contents = gp_ini::ParseString($this->ini_text, $variables);
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:11,代码来源:admin_addon_installer.php

示例13: DeleteConfirmed

 /**
  * Delete a single file or folder
  *
  */
 function DeleteConfirmed()
 {
     global $langmessage, $page;
     if ($this->isThumbDir) {
         return false;
     }
     if (!common::verify_nonce('delete')) {
         message($langmessage['OOPS'] . ' (Invalid Nonce)');
         return;
     }
     $file = $this->CheckFile();
     if (!$file) {
         return;
     }
     $full_path = $this->currentDir . '/' . $file;
     $rel_path = common::GetDir('/data/_uploaded' . $this->subdir . '/' . $file);
     if (!gpFiles::RmAll($full_path)) {
         message($langmessage['OOPS']);
         return;
     }
     $page->ajaxReplace[] = array('img_deleted', '', $rel_path);
     return;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:27,代码来源:admin_uploaded.php

示例14: ShowFile_Gallery

 /**
  * @static
  */
 static function ShowFile_Gallery($dir_piece, $file)
 {
     global $langmessage, $dataDir;
     if (!admin_uploaded::IsImg($file)) {
         return false;
     }
     //for gallery editing
     $rel_path = '/data/_uploaded' . $dir_piece . '/' . $file;
     $id = self::ImageId($rel_path);
     $file_url = common::GetDir($rel_path);
     $full_path = $dataDir . $rel_path;
     //thumbnail
     $thumb_url = common::ThumbnailPath($file_url);
     $thumb = ' <img src="' . $thumb_url . '" alt="" />';
     //get size
     $size = '';
     $size_a = getimagesize($full_path);
     if ($size_a) {
         $size = ' data-width="' . $size_a[0] . '" data-height="' . $size_a[1] . '"';
     }
     $query_string = 'file_cmd=delete&show=inline&file=' . urlencode($file);
     return '<span class="expand_child" id="' . $id . '">' . '<a href="' . $file_url . '" data-cmd="gp_gallery_add" ' . $size . '>' . $thumb . '</a>' . common::Link('Admin_Uploaded' . $dir_piece, '', $query_string, array('class' => 'delete gpconfirm', 'data-cmd' => 'gpajax', 'title' => $langmessage['delete_confirm']), 'delete') . '</span>';
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:26,代码来源:admin_uploaded.php

示例15: __construct

 /**
  * Check the path of the img, return full path of image if the requested image is found
  *
  */
 function __construct()
 {
     global $dataDir;
     if (!isset($_GET['w']) || !isset($_GET['h']) || !isset($_GET['img'])) {
         self::Send404();
         //dies
     }
     $img = $_GET['img'];
     $height = $_GET['h'];
     $width = $_GET['w'];
     $index = $_GET['i'];
     if (!is_numeric($height) || !is_numeric($width)) {
         self::Send404();
         //dies
     }
     $img = gpFiles::NoNull($img);
     //check file path
     if (strpos($img, './') !== false || strpos($img, '%2f') !== false || strpos($img, '%2F') !== false) {
         return false;
     }
     //make sure the index is set
     gp_resized::SetIndex();
     if (!isset(self::$index[$index])) {
         self::Send404();
         //dies
     }
     //if the image has been renamed, redirect to the new name
     $index_img = self::$index[$index];
     if ($index_img != $img) {
         $path = common::GetDir('/include/image.php', false) . '?i=' . $index . '&w=' . $width . '&h=' . $height . '&img=' . rawurlencode($index_img);
         common::Redirect($path);
     }
     $info = self::ImageInfo($img, $width, $height);
     $folder = $dataDir . '/data/_resized/' . $info['index'];
     $full_path = $folder . '/' . $info['name'];
     //if it exists return true
     if (file_exists($full_path)) {
         header('Cache-Control: public, max-age=5184000');
         //60 days
         //attempt to send 304
         $stats = lstat($full_path);
         if ($stats) {
             common::Send304(common::GenEtag($stats['mtime'], $stats['size']));
         }
         header('Content-Transfer-Encoding: binary');
         header('Content-Type: ' . $info['ctype']);
         readfile($full_path);
         die;
     }
     //redirect to next largest image if available
     $usage = self::GetUsage($info['index']);
     foreach ($usage as $size => $data) {
         if (!$data['uses']) {
             continue;
         }
         list($use_width, $use_height) = explode('x', $size);
         if ($use_width >= $width && $use_height > $height || $use_width > $width && $use_height >= $height) {
             $path = common::GetDir('/include/image.php', false) . '?i=' . $index . '&w=' . $use_width . '&h=' . $use_height . '&img=' . rawurlencode($img);
             common::Redirect($path);
             //dies
         }
     }
     //redirect to full size image
     $original = common::GetDir('/data/_uploaded' . $img, false);
     common::Redirect($original);
     //dies
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:71,代码来源:image.php


注:本文中的common::GetDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。