[geeklog-cvs] Geeklog-1.x/system lib-story.php,1.129,1.130
Dirk Haun
dhaun at qs1489.pair.com
Sat Aug 16 14:08:13 EDT 2008
Update of /cvsroot/geeklog/Geeklog-1.x/system
In directory qs1489.pair.com:/tmp/cvs-serv99973/system
Modified Files:
lib-story.php
Log Message:
Removed unused code (now in story.class.php)
Index: lib-story.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/lib-story.php,v
retrieving revision 1.129
retrieving revision 1.130
diff -C2 -d -r1.129 -r1.130
*** lib-story.php 7 Aug 2008 19:54:35 -0000 1.129
--- lib-story.php 16 Aug 2008 18:08:11 -0000 1.130
***************
*** 779,986 ****
/**
- * This replaces all article image HTML in intro and body with
- * GL special syntax
- *
- * @param string $sid ID for story to parse
- * @param string $intro Intro text
- * @param string $body Body text
- * @return string processed text
- *
- */
- function STORY_replace_images($sid, $intro, $body)
- {
- global $_CONF, $_TABLES, $LANG24;
-
- $stdImageLoc = true;
- if (!strstr($_CONF['path_images'], $_CONF['path_html'])) {
- $stdImageLoc = false;
- }
- $result = DB_query("SELECT ai_filename FROM {$_TABLES['article_images']} WHERE ai_sid = '$sid' ORDER BY ai_img_num");
- $nrows = DB_numRows($result);
- for ($i = 1; $i <= $nrows; $i++) {
- $A = DB_fetchArray($result);
-
- $imageX = '[image' . $i . ']';
- $imageX_left = '[image' . $i . '_left]';
- $imageX_right = '[image' . $i . '_right]';
-
- $sizeattributes = COM_getImgSizeAttributes ($_CONF['path_images'] . 'articles/' . $A['ai_filename']);
-
- $lLinkPrefix = '';
- $lLinkSuffix = '';
- if ($_CONF['keep_unscaled_image'] == 1) {
- $lFilename_large = substr_replace ($A['ai_filename'], '_original.',
- strrpos ($A['ai_filename'], '.'), 1);
- $lFilename_large_complete = $_CONF['path_images'] . 'articles/'
- . $lFilename_large;
- if ($stdImageLoc) {
- $imgpath = substr ($_CONF['path_images'],
- strlen ($_CONF['path_html']));
- $lFilename_large_URL = $_CONF['site_url'] . '/' . $imgpath
- . 'articles/' . $lFilename_large;
- } else {
- $lFilename_large_URL = $_CONF['site_url']
- . '/getimage.php?mode=show&image=' . $lFilename_large;
- }
- if (file_exists ($lFilename_large_complete)) {
- $lLinkPrefix = '<a href="' . $lFilename_large_URL
- . '" title="' . $LANG24[57] . '">';
- $lLinkSuffix = '</a>';
- }
- }
-
- if ($stdImageLoc) {
- $imgpath = substr ($_CONF['path_images'],
- strlen ($_CONF['path_html']));
- $imgSrc = $_CONF['site_url'] . '/' . $imgpath . 'articles/'
- . $A['ai_filename'];
- } else {
- $imgSrc = $_CONF['site_url']
- . '/getimage.php?mode=articles&image=' . $A['ai_filename'];
- }
- $norm = $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix;
- $left = $lLinkPrefix . '<img ' . $sizeattributes . 'class="alignleft" src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix;
- $right = $lLinkPrefix . '<img ' . $sizeattributes . 'class="alignright" src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix;
-
- $fulltext = $intro . ' ' . $body;
- $intro = str_replace ($norm, $imageX, $intro);
- $body = str_replace ($norm, $imageX, $body);
- $intro = str_replace ($left, $imageX_left, $intro);
- $body = str_replace ($left, $imageX_left, $body);
- $intro = str_replace ($right, $imageX_right, $intro);
- $body = str_replace ($right, $imageX_right, $body);
-
- if (($_CONF['allow_user_scaling'] == 1) and
- ($_CONF['keep_unscaled_image'] == 1)){
-
- $unscaledX = '[unscaled' . $i . ']';
- $unscaledX_left = '[unscaled' . $i . '_left]';
- $unscaledX_right = '[unscaled' . $i . '_right]';
-
- if (file_exists ($lFilename_large_complete)) {
- $sizeattributes = COM_getImgSizeAttributes($lFilename_large_complete);
- $norm = '<img ' . $sizeattributes . 'src="' . $lFilename_large_URL . '" alt=""' . XHTML . '>';
- $left = '<img ' . $sizeattributes . 'align="left" src="' . $lFilename_large_URL . '" alt=""' . XHTML . '>';
- $right = '<img ' . $sizeattributes . 'align="right" src="' . $lFilename_large_URL . '" alt=""' . XHTML . '>';
- }
- $intro = str_replace ($norm, $unscaledX, $intro);
- $body = str_replace ($norm, $unscaledX, $body);
- $intro = str_replace ($left, $unscaledX_left, $intro);
- $body = str_replace ($left, $unscaledX_left, $body);
- $intro = str_replace ($right, $unscaledX_right, $intro);
- $body = str_replace ($right, $unscaledX_right, $body);
- }
- }
-
- return array($intro, $body);
- }
-
- /**
- * Replaces simple image syntax with actual HTML in the intro and body.
- * If errors occur it will return all errors in $error
- *
- * @param string $sid ID for story to parse
- * @param string $intro Intro text
- * @param string $body Body text
- * @param string $usage 'html' for normal use, 'email' for email use
- * @return string Processed text
- *
- */
- function STORY_insert_images($sid, $intro, $body, $usage='html')
- {
- global $_CONF, $_TABLES, $LANG24;
-
- $result = DB_query("SELECT ai_filename FROM {$_TABLES['article_images']} WHERE ai_sid = '$sid' ORDER BY ai_img_num");
- $nrows = DB_numRows($result);
- $errors = array();
- $stdImageLoc = true;
- if (!strstr($_CONF['path_images'], $_CONF['path_html'])) {
- $stdImageLoc = false;
- }
- for ($i = 1; $i <= $nrows; $i++) {
- $A = DB_fetchArray($result);
-
- $lLinkPrefix = '';
- $lLinkSuffix = '';
- if ($_CONF['keep_unscaled_image'] == 1) {
- $lFilename_large = substr_replace ($A['ai_filename'], '_original.',
- strrpos ($A['ai_filename'], '.'), 1);
- $lFilename_large_complete = $_CONF['path_images'] . 'articles/'
- . $lFilename_large;
- if ($stdImageLoc) {
- $imgpath = substr ($_CONF['path_images'],
- strlen ($_CONF['path_html']));
- $lFilename_large_URL = $_CONF['site_url'] . '/' . $imgpath
- . 'articles/' . $lFilename_large;
- } else {
- $lFilename_large_URL = $_CONF['site_url']
- . '/getimage.php?mode=show&image=' . $lFilename_large;
- }
- if (file_exists ($lFilename_large_complete)) {
- $lLinkPrefix = '<a href="' . $lFilename_large_URL
- . '" title="' . $LANG24[57] . '">';
- $lLinkSuffix = '</a>';
- }
- }
-
- $sizeattributes = COM_getImgSizeAttributes ($_CONF['path_images'] . 'articles/' . $A['ai_filename']);
-
- $norm = '[image' . $i . ']';
- $left = '[image' . $i . '_left]';
- $right = '[image' . $i . '_right]';
-
- $unscalednorm = '[unscaled' . $i . ']';
- $unscaledleft = '[unscaled' . $i . '_left]';
- $unscaledright = '[unscaled' . $i . '_right]';
-
- $fulltext = $intro . ' ' . $body;
- $icount = substr_count($fulltext, $norm) + substr_count($fulltext, $left) + substr_count($fulltext, $right);
- $icount = $icount + substr_count($fulltext, $unscalednorm) + substr_count($fulltext, $unscaledleft) + substr_count($fulltext, $unscaledright);
- if ($icount == 0) {
- // There is an image that wasn't used, create an error
- $errors[] = $LANG24[48] . " #$i, {$A['ai_filename']}, " . $LANG24[53];
- } else {
- // Only parse if we haven't encountered any error to this point
- if (count($errors) == 0) {
- if ($usage=='email') { // image will be attached, no path necessary
- $imgSrc = $A['ai_filename'];
- } elseif ($stdImageLoc) {
- $imgpath = substr ($_CONF['path_images'],
- strlen ($_CONF['path_html']));
- $imgSrc = $_CONF['site_url'] . '/' . $imgpath . 'articles/'
- . $A['ai_filename'];
- } else {
- $imgSrc = $_CONF['site_url'] . '/getimage.php?mode=articles&image=' . $A['ai_filename'];
- }
- $intro = str_replace($norm, $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix, $intro);
- $body = str_replace($norm, $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix, $body);
- $intro = str_replace($left, $lLinkPrefix . '<img ' . $sizeattributes . 'align="left" src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix, $intro);
- $body = str_replace($left, $lLinkPrefix . '<img ' . $sizeattributes . 'align="left" src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix, $body);
- $intro = str_replace($right, $lLinkPrefix . '<img ' . $sizeattributes . 'align="right" src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix, $intro);
- $body = str_replace($right, $lLinkPrefix . '<img ' . $sizeattributes . 'align="right" src="' . $imgSrc . '" alt=""' . XHTML . '>' . $lLinkSuffix, $body);
-
- if (($_CONF['allow_user_scaling'] == 1) and
- ($_CONF['keep_unscaled_image'] == 1)) {
-
- if (file_exists ($lFilename_large_complete)) {
- $imgSrc = $lFilename_large_URL;
- $sizeattributes = COM_getImgSizeAttributes ($lFilename_large_complete);
- }
- $intro = str_replace($unscalednorm, '<img ' . $sizeattributes . 'src="' . $imgSrc . '" alt=""' . XHTML . '>', $intro);
- $body = str_replace($unscalednorm, '<img ' . $sizeattributes . 'src="' . $imgSrc . '" alt=""' . XHTML . '>', $body);
- $intro = str_replace($unscaledleft, '<img ' . $sizeattributes . 'align="left" src="' . $imgSrc . '" alt=""' . XHTML . '>', $intro);
- $body = str_replace($unscaledleft, '<img ' . $sizeattributes . 'align="left" src="' . $imgSrc . '" alt=""' . XHTML . '>', $body);
- $intro = str_replace($unscaledright, '<img ' . $sizeattributes . 'align="right" src="' . $imgSrc . '" alt=""' . XHTML . '>', $intro);
- $body = str_replace($unscaledright, '<img ' . $sizeattributes . 'align="right" src="' . $imgSrc . '" alt=""' . XHTML . '>', $body);
- }
-
- }
- }
- }
-
- return array($errors, $intro, $body);
- }
-
- /**
* Delete a story.
*
--- 779,782 ----
More information about the geeklog-cvs
mailing list