ABA


"צריך בבקשה עזרה ב-PHP, להפוך תמונה ללינק."
גירסת הדפסה        
קבוצות דיון בניית אתרים נושא #13646 מנהל    סגן המנהל    מפקח   Winner    צל"ש   מומחה  
אשכול מספר 13646
n-v
חבר מתאריך 1.9.02
64 הודעות
   22:29   04.03.08   
אל הפורום  
  צריך בבקשה עזרה ב-PHP, להפוך תמונה ללינק.  
 
   הינה האתר:
http://www.kleancar.co.il/gallery/main.php?g2_view=core.ShowItem&g2_navId=x14f81713

אני רוצה להפוך את התמונה למעלה ללינק שיוביל לאתר הראשי:
www.kleancar.co.il

אשמח אם משיהו יוכל לעזור לי.
הינה הקוד של הדף main.php


<?php
/*
* $RCSfile: main.php,v $
*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2005 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
include(dirname(__FILE__) . '/bootstrap.inc');

/*
* If they don't have a setup password, we assume that the config.php is
* empty and this is an initial install.
*/
if (!@$gallery->getConfig('setup.password')) {
/* May be invalid if a multisite install lost its config.php; galleryBaseUrl unknown */
header('Location: install/');
return;
}

if (GalleryUtilities::isEmbedded()) {
require_once(dirname(__FILE__) . '/init.inc');
} else {
/* If this is a request for a public data file, give it to the user immediately */
list ($view, $itemId) = GalleryUtilities::getRequestVariables('view', 'itemId');
if ($view == 'core.DownloadItem' && !empty($itemId)) {
/*
* Our urls are immutable because they have the serial numbers embedded.
* So if the browser presents us with an If-Modified-Since then it has
* the latest version of the file already.
*/
if (function_exists('getallheaders')) {
$headers = GetAllHeaders();
if (isset($headers) || isset($headers)) {
header('HTTP/1.x 304 Not Modified');
return;
}
}

/*
* Fast download depends on having data.gallery.cache set, so set it now. If for some
* reason we fail, we'll reset it in init.inc (but that's ok).
*/
$gallery->setConfig(
'data.gallery.cache', $gallery->getConfig('data.gallery.base') . '/cache/');

$path = GalleryDataCache::getCachePath(
array('type' => 'fast-download', 'itemId' => $itemId));
/* We don't have a platform yet so we have to use the raw file_exists */
if (file_exists($path)) {
include($path);
if (GalleryFastDownload()) {
return;
}
}
}

/* Otherwise, proceed with our regular process */
require_once(dirname(__FILE__) . '/init.inc');
$ret = GalleryInitFirstPass();
if ($ret->isError()) {
_GalleryMain_errorHandler($ret->wrap(__FILE__, __LINE__), null, false);
return;
}

/* Process the request */
GalleryMain();
}

function GalleryMain($embedded=false) {
global $gallery;

/* Process the request */
list($ret, $g2Data) = _GalleryMain($embedded);
if ($ret->isSuccess()) {
$gallery->performShutdownActions();

/* Write out our session data */
$session =& $gallery->getSession();
$ret = $session->save();
}

/* Complete our transaction */
if ($ret->isSuccess() && $gallery->isStorageInitialized()) {
$storage =& $gallery->getStorage();
$ret = $storage->commitTransaction();
}

/* Error handling (or redirect info in debug mode) */
if ($ret->isError()) {
_GalleryMain_errorHandler($ret->wrap(__FILE__, __LINE__), $g2Data);
$g2Data = true;

if ($ret->isError() && $gallery->isStorageInitialized()) {
/* Nuke our transaction, too */
$storage =& $gallery->getStorage();
$storage->rollbackTransaction();
}
} else if (isset($g2Data)) {
/* If we're in debug mode, show a redirect page */
print '<h1> Debug Redirect </h1> ' .
'Not automatically redirecting you to the next page because we\'re in debug mode<br/>';
printf('<a href="%s">Continue to the next page</a>', $g2Data);
print '<hr/>';
print $gallery->getDebugBuffer();
}

return $g2Data;
}

/**
* Process our request
* @return array object GalleryStatus a status code
* array
*/
function _GalleryMain($embedded=false) {
global $gallery;

$main = array();
$urlGenerator =& $gallery->getUrlGenerator();
$urlGenerator->initNavigation();

/* Figure out the target view/controller */
list($viewName, $controllerName) = GalleryUtilities::getRequestVariables('view', 'controller');

if (!$embedded && $gallery->getConfig('mode.embed.only') &&
$viewName != 'core.DownloadItem' && $viewName != 'imageframe.CSS') {
/* Lock out direct access when embed-only is set */
return array(GalleryStatus::error(ERROR_PERMISSION_DENIED, __FILE__, __LINE__), null);
}

/* Check if core module needs upgrading */
list ($ret, $core) = GalleryCoreApi::loadPlugin('module', 'core', true);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
$installedVersions = $core->getInstalledVersions();
if ($installedVersions != $core->getVersion()) {
$redirectUrl = $urlGenerator->getCurrentUrlDir(true) . 'upgrade/index.php';
return array(GalleryStatus::success(), _GalleryMain_doRedirect($redirectUrl));
}

$ret = GalleryInitSecondPass();
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

/* Load and run the appropriate controller */
$results = array();
if (!empty($controllerName)) {
GalleryCoreApi::relativeRequireOnce('modules/core/classes/GalleryController.class');
list ($ret, $controller) = GalleryController::loadController($controllerName);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

/* Get our form and return variables */
$form = GalleryUtilities::getFormVariables('form');

/* Let the controller handle the input */
list ($ret, $results) = $controller->handleRequest($form);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
/* Check to make sure we got back everything we want */
if (!isset($results) ||
!isset($results) ||
(!isset($results) &&
!isset($results) &&
!isset($results))) {
return array(GalleryStatus::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__,
'Controller results are missing status, ' .
'error, (redirect, delegate, return)'),
null);
}

/* Try to return if the controller instructs it */
if (!empty($results)) {
list ($ret, $navigationLinks) = $urlGenerator->getNavigationLinks(1);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
if (count($navigationLinks) > 0) {
/* Go back to the previous navigation point in our history */
$redirectUrl = $navigationLinks;
} else {
$redirectUrl = GalleryUtilities::getRequestVariables('return');
if (empty($redirectUrl)) {
$redirectUrl = GalleryUtilities::getRequestVariables('formUrl');
}
}
}

/* Failing that, redirect if so instructed */
if (empty($redirectUrl) && !empty($results)) {
/*
* If we have a status, store its data in the session and attach it
* to the URL.
*/
if (!empty($results)) {
$session =& $gallery->getSession();
$results = $session->putStatus($results);
}

$urlToGenerate = $results;
/* Keep our navId in the URL */
$navId = $urlGenerator->getNavigationId();
if (!empty($navId)) {
$urlToGenerate = $navId;
}
$redirectUrl = $urlGenerator->generateUrl($urlToGenerate);
}

/* If we have a redirect url.. use it */
if (!empty($redirectUrl)) {
return array(GalleryStatus::success(),
_GalleryMain_doRedirect($redirectUrl, null, $controllerName));
}

/* Let the controller specify the next view */
if (!empty($results)) {
/* Load any errors into the request */
if (!empty($results)) {
foreach ($results as $error) {
GalleryUtilities::putRequestVariable($error, 1);
}
}

/* Save the view name, put the rest into the request so the view can get it */
foreach ($results as $key => $value) {
switch($key) {
case 'view':
$viewName = $value;
break;

default:
GalleryUtilities::putRequestVariable($key, $value);
break;
}
}
}
}

/* Load and run the appropriate view */
if (empty($viewName)) {
$viewName = 'core.ShowItem';
}

list ($ret, $view) = GalleryView::loadView($viewName);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

/* Initialize our container for template data */
$gallery->setCurrentView($viewName);

/*
* If this is an immediate view, it will send its own output directly. This is
* used in the situation where we want to send back data that's not controlled by the
* layout. That's usually something that's not user-visible like a binary file.
*/
$data = array();
if ($view->isImmediate()) {
$status = isset($results) ? $results : array();
$error = isset($results) ? $results : array();
$ret = $view->renderImmediate($status, $error);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
$data = true;
} else {
GalleryCoreApi::relativeRequireOnce('modules/core/classes/GalleryTemplate.class');
$template = new GalleryTemplate(dirname(__FILE__));
list ($ret, $results, $theme) = $view->doLoadTemplate($template, $embedded);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
if (isset($results) || isset($results)) {
if (isset($results)) {
$redirectUrl = $results;
} else {
$redirectUrl = $urlGenerator->generateUrl($results);
}
return array(GalleryStatus::success(),
_GalleryMain_doRedirect($redirectUrl, $template));
}

if (empty($results)) {
return array(GalleryStatus::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__,
'View results are missing body file'), null);
}

$templatePath = 'gallery:' . $results;
$template->setVariable('l10Domain', $theme->getL10Domain());
$template->setVariable('isEmbedded', $embedded);

if ($embedded) {
list ($ret, $html) = $template->fetch($templatePath);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
$data = $theme->splitHtml($html, $results);
$data = false;
} else {
$ret = $template->display($templatePath);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
$data = true;
}
}

return array(GalleryStatus::success(), $data);
}

function _GalleryMain_doRedirect($redirectUrl, $template=null, $controller=null) {
global $gallery;
if ($gallery->getDebug() == false || $gallery->getDebug() == 'logged') {
/*
* The URL generator makes HTML 4.01 compliant URLs using
* & but we don't want those in our Location: header.
*/
$redirectUrl = str_replace('&', '&', $redirectUrl);

/*
* IIS 3.0 - 5.0 webservers will ignore all other headers if the location header is set.
* It will simply not send other headers, e.g. the set-cookie header, which is important
* for us in the login and logout requests / redirects.
* see: http://support.microsoft.com/kb/q176113/
* Our solution: detect IIS version and append GALLERYSID to the Location URL if necessary
*/
if (in_array($controller, array('core.Logout', 'core.UserLogin', 'publishxp.Login'))) {
/* Check if it's IIS and if the version is < 6.0 */
$webserver = GalleryUtilities::getServerVar('SERVER_SOFTWARE');
if (!empty($webserver) &&
preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($webserver), $matches) &&
$matches < 6) {
/*
* It is IIS and it's a version with this bug, check if GALLERYSID is already in
* the URL, else append it
*/
$session =& $gallery->getSession();
$sessionParamString =
GalleryUtilities::prefixFormVariable(urlencode($session->getKey())) . '=' .
urlencode($session->getId());
if (!strstr($redirectUrl, $sessionParamString)) {
$redirectUrl .= (strpos($redirectUrl, '?') === false) ? '?' : '&';
$redirectUrl .= $sessionParamString;
}
}
}

/* Use our PHP VM for testability */
$phpVm = $gallery->getPhpVm();
$phpVm->header("Location: $redirectUrl");
return array('isDone' => true);
} else {
return array('isDone' => true, 'redirectUrl' => $redirectUrl, 'template' => $template);
}
}

/* TODO: move this out of main.php so that we don't have load it on every page view */
function _GalleryMain_errorHandler($error, $g2Data=null, $initOk=true) {
global $gallery;
$failsafe = false;
if (!$initOk) {
$failsafe = true;
}

if (!$failsafe) {
list ($ret, $themeId) =
GalleryCoreApi::getPluginParameter('module', 'core', 'default.theme');
if ($ret->isError()) {
$failsafe = true;
}
}

if (!$failsafe) {
list ($ret, $theme) = GalleryCoreApi::loadPlugin('theme', $themeId);
if ($ret->isError()) {
$failsafe = true;
}
$templateAdapter =& $gallery->getTemplateAdapter();
$templateAdapter->setTheme($theme);
}

if (!$failsafe) {
list ($ret, $view) = GalleryView::loadView('core.ErrorPage');
if ($ret->isError()) {
$failsafe = true;
}
}

if (!$failsafe) {
$dummyForm = array();
GalleryCoreApi::relativeRequireOnce('modules/core/classes/GalleryTemplate.class');
$template = new GalleryTemplate(dirname(__FILE__));
$view->setError($error);
list ($ret, $results) = $view->loadTemplate($template, $dummyForm);
if ($ret->isError()) {
$failsafe = true;
}

$t =& $template->getVariableByReference('theme');
$t = $results;
}

if (!$failsafe) {
$template->setVariable('l10Domain', 'modules_core');
list ($ret, $templatePath) = $theme->showErrorPage($template);
if ($ret->isError()) {
$failsafe = true;
}
}

if (!$failsafe) {
$template->setVariable('l10Domain', 'themes_' . $themeId);
$ret = $template->display("themes/$themeId/templates/$templatePath");
if ($ret->isError()) {
$failsafe = true;
}
}

if ($failsafe) {
/* Some kind of catastrophic failure. Just dump the error out to the browser. */
print '<h2>Error</h2>' . $error->getAsHtml(false);
if ($gallery->getDebug() == 'buffered') {
print '<h3>Debug Output</h3><pre>' . $gallery->getDebugBuffer() . '</pre>';
}
return;
}
}
?>


                                שתף        
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד

  האשכול     מחבר     תאריך כתיבה     מספר  
  כנס אחי asco88  04.03.08 23:17 1
  בדף הזה אין שום זכר לתמונה שלך. הקוד נמצא בדף אחר... Ice Cold  05.03.08 08:38 2
  הקוד נמצא בTemplate שאחראי על התצוגה של התמונות. akoka 05.03.08 13:56 3
     הינה תוכן הסיפרייה, תגיד לי איפה זה: n-v 05.03.08 15:48 6
         הייתי מהמר על modules... לא מכיר את המערכת. Ice Cold  05.03.08 15:54 7
         מכתב MoonHunter 05.03.08 23:08 8
             הינה n-v 08.03.08 21:17 9
                 ? n-v 11.03.08 18:56 10
                     ? n-v 16.03.08 22:10 11
                 תחפש אתה קוד שהתמונה מופיעה בו ותביא אותו MoonHunter 22.03.08 20:18 12
  אתה יודע שרושמים Clean ? :\ Rayman  05.03.08 13:58 4
     כן :) n-v 05.03.08 15:47 5

       
asco88 
חבר מתאריך 17.6.04
26757 הודעות
   23:17   04.03.08   
אל הפורום  
  1. כנס אחי  
בתגובה להודעה מספר 0
 
בעיקרון, פשוט צריך ליצור קישור בHTML ובמקום לשים טקסט, לשים תמונה.
הייתי מדגים אבל אני בפלא'
זה נורא פשוט, אם לא הבנת מישהו כבר יסביר יותר ברור..


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
Ice Cold  לחץ כאן להצגת דירוג המשתמש
חבר מתאריך 3.8.02
28041 הודעות, 19 פידבק
   08:38   05.03.08   
אל הפורום  
  2. בדף הזה אין שום זכר לתמונה שלך. הקוד נמצא בדף אחר...  
בתגובה להודעה מספר 0
 


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
akoka

   13:56   05.03.08   
אל הפורום  
  3. הקוד נמצא בTemplate שאחראי על התצוגה של התמונות.  
בתגובה להודעה מספר 0
 
  


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
n-v
חבר מתאריך 1.9.02
64 הודעות
   15:48   05.03.08   
אל הפורום  
  6. הינה תוכן הסיפרייה, תגיד לי איפה זה:  
בתגובה להודעה מספר 3
 
   http://rotter.name/User_files/nor/47cea49a619e4bc9.gif


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
Ice Cold  לחץ כאן להצגת דירוג המשתמש
חבר מתאריך 3.8.02
28041 הודעות, 19 פידבק
   15:54   05.03.08   
אל הפורום  
  7. הייתי מהמר על modules... לא מכיר את המערכת.  
בתגובה להודעה מספר 6
 


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
MoonHunter
חבר מתאריך 1.8.02
680 הודעות
   23:08   05.03.08   
אל הפורום  
  8. מכתב  
בתגובה להודעה מספר 6
 
   ערכתי לאחרונה בתאריך 05.03.08 בשעה 23:09 בברכה, MoonHunter
 
תן את הקוד שמופיע בindex.php זה שמופיע פה במסך.
בנוסף אני מאמים שבתיקיה themes יש עוד קובץ Index.php תן גם את הקוד שלו, במידה ויש בתוך עוד תיקיה, כנס אליה ושם ימצא הקובץ.


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
n-v
חבר מתאריך 1.9.02
64 הודעות
   21:17   08.03.08   
אל הפורום  
  9. הינה  
בתגובה להודעה מספר 8
 
   ערכתי לאחרונה בתאריך 08.03.08 בשעה 21:17 בברכה, n-v
 
index.php

<?php
/*
* $RCSfile: index.php,v $
*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2005 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @version $Revision: 1.16 $ $Date: 2005/08/23 03:48:55 $
* @package Gallery
* @author Bharat Mediratta <[email protected]>
*/

/*
* This script will just redirect to main.php. But the Location header requires
* an absolute url to conform with HTTP/1.1
* (Include bootstrap.inc in case config.php overrides GALLERY_MAIN_PHP)
*/
require(dirname(__FILE__) . '/bootstrap.inc');
require(dirname(__FILE__) . '/modules/core/classes/GalleryUrlGenerator.class');

/* The REQUEST_URI can either be /path/index.php or just /path/. Get rid of index.php.* */
$path = preg_replace('|^(/(?: /)*).*|', '$1', GalleryUrlGenerator::getCurrentRequestUri());

header('Location: ' . GalleryUrlGenerator::makeUrl($path) . GALLERY_MAIN_PHP);
?>

תוכן themes/
http://rotter.name/User_files/nor/47d2e60f1d1f5be1.gif

תודה רבה על העזרה


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
n-v
חבר מתאריך 1.9.02
64 הודעות
   18:56   11.03.08   
אל הפורום  
  10. ?  
בתגובה להודעה מספר 9
 
   ערכתי לאחרונה בתאריך 11.03.08 בשעה 18:57 בברכה, n-v
 


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
n-v
חבר מתאריך 1.9.02
64 הודעות
   22:10   16.03.08   
אל הפורום  
  11. ?  
בתגובה להודעה מספר 10
 
  


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
MoonHunter
חבר מתאריך 1.8.02
680 הודעות
   20:18   22.03.08   
אל הפורום  
  12. תחפש אתה קוד שהתמונה מופיעה בו ותביא אותו  
בתגובה להודעה מספר 9
 
   ערכתי לאחרונה בתאריך 22.03.08 בשעה 20:19 בברכה, MoonHunter
 


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
Rayman  לחץ כאן להצגת דירוג המשתמש
חבר מתאריך 2.7.02
61775 הודעות, 6 פידבק
   13:58   05.03.08   
אל הפורום  
  4. אתה יודע שרושמים Clean ? :\  
בתגובה להודעה מספר 0
 
  




אני זה אני וטוב לי ככה כמו שאני

אני חושב על העתיד בשביל לחיות את ההוווה טוב יותר מהעבר...
ותגיד זמן והזמן עובר...
1995-2009


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד
n-v
חבר מתאריך 1.9.02
64 הודעות
   15:47   05.03.08   
אל הפורום  
  5. כן :)  
בתגובה להודעה מספר 4
 
  


                                                         (ניהול: מחק תגובה)
מכתב זה והנלווה אליו, על אחריות ועל דעת הכותב בלבד

תגובה מהירה  למכתב מספר: 
 
___________________________________________________________________

___________________________________________________________________
למנהלים:  נעל | תייק בארכיון | מחק | העבר לפורום אחר | מחק תגובות | עגן אשכול
       



© כל הזכויות שמורות ל-רוטר.נט בע"מ rotter.net