[geeklog-cvs] geeklog-1.3/public_html/admin story.php,1.108,1.109
tony at geeklog.net
tony at geeklog.net
Tue Jan 6 23:22:34 EST 2004
Update of /usr/cvs/geeklog/geeklog-1.3/public_html/admin
In directory geeklog_prod:/tmp/cvs-serv11546
Modified Files:
story.php
Log Message:
Now uses $_CONF['path_images'] which may or may not be in the webtree
Index: story.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/story.php,v
retrieving revision 1.108
retrieving revision 1.109
diff -C2 -d -r1.108 -r1.109
*** story.php 28 Sep 2003 13:23:42 -0000 1.108
--- story.php 7 Jan 2004 04:22:32 -0000 1.109
***************
*** 588,596 ****
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);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
! $dimensions = GetImageSize($_CONF['path_html'] . 'images/articles/' . $A['ai_filename']);
if (!empty($dimensions[0]) AND !empty($dimensions[1])) {
$sizeattributes = 'width="' . $dimensions[0] . '" height="' . $dimensions[1] . '" ';
--- 588,600 ----
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);
! $dimensions = GetImageSize($_CONF['path_images'] . 'articles/' . $A['ai_filename']);
if (!empty($dimensions[0]) AND !empty($dimensions[1])) {
$sizeattributes = 'width="' . $dimensions[0] . '" height="' . $dimensions[1] . '" ';
***************
*** 604,611 ****
$lFilename_large = substr_replace ($A['ai_filename'], '_original.',
strrpos ($A['ai_filename'], '.'), 1);
! $lFilename_large_complete = $_CONF['path_html'] . 'images/articles/'
. $lFilename_large;
! $lFilename_large_URL = $_CONF['site_url'] . '/images/articles/'
. $lFilename_large;
if (file_exists ($lFilename_large_complete)) {
$lLinkPrefix = '<a href="' . $lFilename_large_URL
--- 608,620 ----
$lFilename_large = substr_replace ($A['ai_filename'], '_original.',
strrpos ($A['ai_filename'], '.'), 1);
! $lFilename_large_complete = $_CONF['path_images'] . 'articles/'
. $lFilename_large;
! if ($stdImageLoc) {
! $lFilename_large_URL = $_CONF['site_url'] . '/images/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
***************
*** 615,621 ****
}
! $norm = $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix;
! $left = $lLinkPrefix . '<img ' . $sizeattributes . 'align="left" src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix;
! $right = $lLinkPrefix . '<img ' . $sizeattributes . 'align="right" src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix;
$fulltext = $intro . ' ' . $body;
$count = substr_count($fulltext, $norm) + substr_count($fulltext, $left) + substr_count($fulltext, $right);
--- 624,635 ----
}
! if ($stdImageLoc) {
! $imgSrc = $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'];
! } else {
! $imgSrc = $_CONF['site_url'] . '/getimage.php?mode=articles&image=' . $A['ai_filename'];
! }
! $norm = $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $imgSrc . '" alt="">' . $lLinkSuffix;
! $left = $lLinkPrefix . '<img ' . $sizeattributes . 'align="left" src="' . $imgSrc . '" alt="">' . $lLinkSuffix;
! $right = $lLinkPrefix . '<img ' . $sizeattributes . 'align="right" src="' . $imgSrc . '" alt="">' . $lLinkSuffix;
$fulltext = $intro . ' ' . $body;
$count = substr_count($fulltext, $norm) + substr_count($fulltext, $left) + substr_count($fulltext, $right);
***************
*** 648,655 ****
$nrows = DB_numRows($result);
$errors = array();
!
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
! $dimensions = GetImageSize($_CONF['path_html'] . 'images/articles/' . $A['ai_filename']);
if (!empty($dimensions[0]) AND !empty($dimensions[1])) {
$sizeattributes = 'width="' . $dimensions[0] . '" height="' . $dimensions[1] . '" ';
--- 662,672 ----
$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);
! $dimensions = GetImageSize($_CONF['path_images'] . 'articles/' . $A['ai_filename']);
if (!empty($dimensions[0]) AND !empty($dimensions[1])) {
$sizeattributes = 'width="' . $dimensions[0] . '" height="' . $dimensions[1] . '" ';
***************
*** 663,670 ****
$lFilename_large = substr_replace ($A['ai_filename'], '_original.',
strrpos ($A['ai_filename'], '.'), 1);
! $lFilename_large_complete = $_CONF['path_html'] . 'images/articles/'
. $lFilename_large;
! $lFilename_large_URL = $_CONF['site_url'] . '/images/articles/'
. $lFilename_large;
if (file_exists ($lFilename_large_complete)) {
$lLinkPrefix = '<a href="' . $lFilename_large_URL
--- 680,692 ----
$lFilename_large = substr_replace ($A['ai_filename'], '_original.',
strrpos ($A['ai_filename'], '.'), 1);
! $lFilename_large_complete = $_CONF['path_images'] . 'articles/'
. $lFilename_large;
! if ($stdImageLoc) {
! $lFilename_large_URL = $_CONF['site_url'] . '/images/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
***************
*** 685,694 ****
// Only parse if we haven't encountered any error to this point
if (count($errors) == 0) {
! $intro = str_replace($norm, $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix, $intro);
! $body = str_replace($norm, $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix, $body);
! $intro = str_replace($left, $lLinkPrefix . '<img ' . $sizeattributes . 'align="left" src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix, $intro);
! $body = str_replace($left, $lLinkPrefix . '<img ' . $sizeattributes . 'align="left" src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix, $body);
! $intro = str_replace($right, $lLinkPrefix . '<img ' . $sizeattributes . 'align="right" src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix, $intro);
! $body = str_replace($right, $lLinkPrefix . '<img ' . $sizeattributes . 'align="right" src="' . $_CONF['site_url'] . '/images/articles/' . $A['ai_filename'] . '" alt="">' . $lLinkSuffix, $body);
}
}
--- 707,721 ----
// Only parse if we haven't encountered any error to this point
if (count($errors) == 0) {
! if ($stdImageLoc) {
! $imgSrc = $_CONF['site_url'] . '/images/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="">' . $lLinkSuffix, $intro);
! $body = str_replace($norm, $lLinkPrefix . '<img ' . $sizeattributes . 'src="' . $imgSrc . '" alt="">' . $lLinkSuffix, $body);
! $intro = str_replace($left, $lLinkPrefix . '<img ' . $sizeattributes . 'align="left" src="' . $imgSrc . '" alt="">' . $lLinkSuffix, $intro);
! $body = str_replace($left, $lLinkPrefix . '<img ' . $sizeattributes . 'align="left" src="' . $imgSrc . '" alt="">' . $lLinkSuffix, $body);
! $intro = str_replace($right, $lLinkPrefix . '<img ' . $sizeattributes . 'align="right" src="' . $imgSrc . '" alt="">' . $lLinkSuffix, $intro);
! $body = str_replace($right, $lLinkPrefix . '<img ' . $sizeattributes . 'align="right" src="' . $imgSrc . '" alt="">' . $lLinkSuffix, $body);
}
}
***************
*** 733,737 ****
// Convert array values to numeric permission values
list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon);
!
$access = 0;
if (DB_count ($_TABLES['stories'], 'sid', $sid) > 0) {
--- 760,764 ----
// Convert array values to numeric permission values
list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon);
!
$access = 0;
if (DB_count ($_TABLES['stories'], 'sid', $sid) > 0) {
***************
*** 818,823 ****
// Delete any images if needed
for ($i = 1; $i <= count($delete); $i++) {
! $ai_filename = DB_getItem ($_TABLES['article_images'],'ai_filename', "ai_sid = '$sid' AND ai_img_num = " . key ($delete));
! $curfile = $_CONF['path_html'] . 'images/articles/' . $ai_filename;
if (!@unlink($curfile)) {
echo COM_errorLog("Unable to delete image $curfile. Please check file permissions");
--- 845,850 ----
// Delete any images if needed
for ($i = 1; $i <= count($delete); $i++) {
! $ai_filename = DB_getItem ($_TABLES['article_images'],'ai_filename', "ai_sid = '$sid' AND ai_img_num = " . key ($delete));
! $curfile = $_CONF['path_images'] . 'articles/' . $ai_filename;
if (!@unlink($curfile)) {
echo COM_errorLog("Unable to delete image $curfile. Please check file permissions");
***************
*** 827,831 ****
$lFilename_large = substr_replace ($ai_filename, '_original.',
strrpos ($ai_filename, '.'), 1);
! $lFilename_large_complete = $_CONF['path_html'] . 'images/articles/'
. $lFilename_large;
if (file_exists ($lFilename_large_complete)) {
--- 854,858 ----
$lFilename_large = substr_replace ($ai_filename, '_original.',
strrpos ($ai_filename, '.'), 1);
! $lFilename_large_complete = $_CONF['path_images'] . 'articles/'
. $lFilename_large;
if (file_exists ($lFilename_large_complete)) {
***************
*** 875,879 ****
}
$upload->setAllowedMimeTypes(array('image/gif'=>'.gif','image/jpeg'=>'.jpg,.jpeg','image/pjpeg'=>'.jpg,.jpeg','image/x-png'=>'.png','image/png'=>'.png'));
! if (!$upload->setPath($_CONF['path_html'] . 'images/articles')) {
print 'File Upload Errors:<br>' . $upload->printErrors();
exit;
--- 902,906 ----
}
$upload->setAllowedMimeTypes(array('image/gif'=>'.gif','image/jpeg'=>'.jpg,.jpeg','image/pjpeg'=>'.jpg,.jpeg','image/x-png'=>'.png','image/png'=>'.png'));
! if (!$upload->setPath($_CONF['path_images'] . 'articles')) {
print 'File Upload Errors:<br>' . $upload->printErrors();
exit;
***************
*** 980,984 ****
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray ($result);
! $filename = $_CONF['path_html'] . 'images/articles/' . $A['ai_filename'];
if (!@unlink ($filename)) {
// log the problem but don't abort the script
--- 1007,1011 ----
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray ($result);
! $filename = $_CONF['path_images'] . 'articles/' . $A['ai_filename'];
if (!@unlink ($filename)) {
// log the problem but don't abort the script
***************
*** 989,993 ****
$lFilename_large = substr_replace ($A['ai_filename'], '_original.',
strrpos ($A['ai_filename'], '.'), 1);
! $lFilename_large_complete = $_CONF['path_html'] . 'images/articles/'
. $lFilename_large;
if (file_exists ($lFilename_large_complete)) {
--- 1016,1020 ----
$lFilename_large = substr_replace ($A['ai_filename'], '_original.',
strrpos ($A['ai_filename'], '.'), 1);
! $lFilename_large_complete = $_CONF['path_images'] . 'articles/'
. $lFilename_large;
if (file_exists ($lFilename_large_complete)) {
***************
*** 1010,1014 ****
// MAIN
-
$display = '';
if (($mode == $LANG24[11]) && !empty ($LANG24[11])) { // delete
--- 1037,1040 ----
More information about the geeklog-cvs
mailing list