PDA

Voir la version complète : Installation De La Section Album Photos


apdcanari
27/02/2005, 20h59
Bonsoir,

Une nouvelle section est désormais disponible, il sagit de l'Album Photos (http://www.apdcanari.com/album.php). Il est en cours de réalisation, actuellement, vous pouvez consulter l'Album sur Les Standards en Canaris de Couleurs (http://www.apdcanari.com/album_standards_couleurs.php).

N'hésitez pas à nous envoyer vos photos pour completer cet album qui comporte plus de 4500 photos (site et forum).

Bonne soirée,

Cédric

Mic
28/02/2005, 13h12
Salut Cédric, Cet album est très bien présenté, les photos sont très agréables à regarder, surtout celles où les canaris ne sont pas cachés derrière les barreaux. :rolleyes:
(Ce que je ne comprends pas, c'est pourquoi j'apparaîs hors ligne, même après m'être identifiée - Faut-il se réinscrire dans cette partie du site ?) Mic #)

apdcanari
01/03/2005, 08h38
Salut mic,

Merci. En effet, tu dois te connecter à nouveau quand tu viens sur le forum. Le problème de déconnexion n'est toujours pas réglé, c'est un bug. Mais pour l'instant, je préfère avancer dans le site et dans son contenu que de régler ce problème.

Donc, quand tu viens du site sur le forum, il faut se reconnecter.

Tu ne dois pas te réinscrire, parce que le module de connexion sur le site a la même base sql que le forum (donc même base).

Désolé pour ce problème, malheureusement je ne suis pas programmeur chevroné en php et sql, mais j'essaye de faire comme je peux, surtout que tout seul c'est pas évident.

Voilà, bonne journée,

Cédric

Mic
01/03/2005, 10h39
Salut Cédric, Merci de me répondre. Je ne sais pas si cela fait parti du bug mais lorsque je me connecte à l'aide de mon pseudo et de mon mot de passe, il est écrit : "connexion réussie" mais je n'apparaîs pas au bas de la page avec les membres que l'on voit connecter. C'est plutôt ça qui me faisais penser à une réinscription. Je sais maintenant que je ne dois pas me réinscrire. Pour l'instant, le problème est-il normal ? Mic.

apdcanari
01/03/2005, 10h56
C'est un problème de cookies entre le site et le forum. Mais j'ai tellement de fichiers de codes à vérifier que c'est pas évident, une petite virgule oubliée sur une page de 1500 lignes et hop tout est foutu. Si le site te dit que tu es connecté, c'est normal, même si tu ne l'est pas, cette partie de mon code est juste. Mais il y a une autre erreur ailleurs... :rolleyes:

Je crois que l'erreur doit se trouver dans cette page...mais pas certain (j'ai plus de 1000 pages référencés...)

Cette page fait 4958 lignes :D


<?php
/**
* IPB SDK - Version 1.5 beta
* <br>Main SDK Class.
*
* IPB SDK is a library of PHP functions, which will help you develop advanced applications on your site. Integration between your forum and site is essential in the websites of today. IPB already has a great member system, why re-write another one if you can use one member database for both?
* <br>Designed for Invision Power Board Version 2.0.
*
* Code (c) 2003-2004 IPB SDK Development Team
* http://ipbsdk.sourceforge.net
*
* @package IPBSDK
* @author IPB SDK Development Team (Run {@link IPBSDK::sdk_info()} for credits)
* @version 1.5.0 beta (testing release 06/10/2004)
* @copyright 2003-2004 IPB SDK Development Team
*/

/**
* Full qualified path to the SDK class file.
*/
if (!defined('SDK_PATH')) {
define ('SDK_PATH', dirname(__FILE__) . '/');
}
/**
* The full qualified path to the DocumentRoot of the VirtualHost/Domain,
* always ending with a slash.
*
* This variable is usually available as of all releases of PHP 4 running
* on Apache and Linux. However, on Window's IIS webserver, this variable
* may not exist, so we try to rebuild it from the path of the calling script.
*
* @global string
* @name DOCUMENT_ROOT
* @see SDK_PATH
* @since 1.0.1
*/
if (!isset($_SERVER['DOCUMENT_ROOT'])) {
$_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], '', str_replace("\\\\", DIRECTORY_SEPARATOR, $_SERVER['PATH_TRANSLATED'] ) );
}

if (!defined('DIRECTORY_SEPARATOR')) {
/**
* DIRECTORY_SEPARATOR is undefined in some versions of PHP 4, so we define it ourselfs if necessary.
*/
define('DIRECTORY_SEPARATOR', (substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/');
}
if (!defined('PATH_SEPARATOR')) {
/**
* PATH_SEPARATOR is undefined in some versions of PHP 4, so we define it ourselfs if necessary.
*/
define('PATH_SEPARATOR', (substr(PHP_OS, 0, 3) == 'WIN') ? ';' : ':');
}
// Add the SDK Path to the include path.
// On some servers ini_set() might be disabled for some
// paranoid reasons so we try set_include_path() first
// thanx to the forxer.net for accidently pointing this out :)
if (function_exists('set_include_path')) {
set_include_path(get_include_path() . PATH_SEPARATOR . SDK_PATH);
} else {
// if this won't work, we have to live without SDK_PATH in the include_path
if (strpos(@ini_get('disable_functions'), 'ini_set') === FALSE ) {
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . SDK_PATH);
}
}

if (!defined('IN_IPB')) {
/**
* Load IPB class wrappers for IPB's own info Class.<br />
* This step is ommitted in IPB SDK runs inside IPB itself.
*/
require_once SDK_PATH . 'lib/ipb_classes.inc.php';
/**
* Instatiates a dummy for later use with IPB's own database connection object.
*
* @global object $DB
*/
$DB = new stdClass();
/**
* Instatiates a dummy for later re-assignment with the wrapper classes of IPB's magic $ibforums object
*
* @global object $ibforums
* @see get_info()
*/
$ibforums = new stdClass();
/**
* Instatiates a dummy for later re-assignment of IPB's native classed from function.php
*
* @global object $std
*/
$std = new stdClass();
/**
* Instatiates a dummy for later re-assignment with IPB's native session object.
*
* @global object $sess
*/
$sess = new stdClass();
/**
* Instatiates a dummy for later re-assignment with the parser class.
*
* @global object $parser
*/
$parser = new stdClass();
/**
* Placeholder for what's in IPB's configuration file config_global.php
*
* @global array $INFO
*/
$INFO = array();
}

/**
* The Main class wrapps all the functionality of the IPB SDK library and extensions modules.
*
* Usage example:
* <code>require_once('ipbsdk/ipbsdk_class.inc.php');
* $SDK =& new IPBSDK();
* $SDK->sdk_info();
* </code>
*
* @package IPBSDK
*/
class IPBSDK {
/**
* Guess what ...
* @access protected
* @var string
*/
var $ipbsdk_version = '1.5.0 beta';
/**
* Configuration settings, many comming from the config file and changed on initialization.
* @var array
*/
var $ipbsdk_settings = array();
/**
* Current language code used for localization. Language files are located in the <var>lib/</var> subfolder of {@link SDK_PATH}
* @var string
*/
var $lang;
/**
* The full qualified URL to your board without '/index.php'.
* It must not end with a trailing slash.
*
* <b>Default URL:</b> 'http://' . $_SERVER['HTTP_HOST'] . '/forum';
* <b>Example URL:</b> "http://www.mydomain.com/community/forums";
* @var string a backup
*/
var $board_url;
/**
* An internal copy of the database connection from IPB. Created from the mySQL driver class.
* @access protected
* @var object
*/
var $DB;
/**
* Extra libraries and object references most taken from what's in IPB /sources/.
* @var array
*/
var $extra = array();
/**
* Last known member data from {@link get_info()}, {@link get_advinfo()}
* @var array
*/
var $member;
/**
* Last known member ID from {@link get_info()}, {@link get_advinfo()}
* @var string
*/
var $memberid = '';
/**
* Whether the member is logged in ('0', '1')
* @var string
*/
var $loggedin = '0';

// -- private properties go here -----------------
/**#@+
* @access private
*/
/**
* Runtime options
*/
var $_options = array();
/**
* List of last error occured in both IPB and the SDK.
*/
var $_errors = array();
/**
* Last error occured in any of IPB and the SDK.
*/
var $_lasterror;
/**
* Cached SQL query results, used if {@link $allow_caching} is on.
*/
var $_cache = array();
/**
* This is what's allowed to come via $options, other keys are ignored (see constructor)
*/
var $_allowedOptions = array(
'root_path'=>'root_path',
'board_url'=>'board_url',
'language'=>'sdklang',
'board_version'=>'board_version',
'allow_caching'=>'allow_caching',
'timer'=>'timer',
'debug'=>'debug');

/**
* @ignore
* this one's temporary until support for the deprecated methods is dropped :)
*/
var $_depr_msg = '<b>NOTICE:</b> Use of deprecated method: "<b>%s</b>"! This method may not be supported in future versions of the IPB SDK. Please update your scripts to use "<b>%s</b>" instead.';

/**
* Class constructor.
* Does all the dirty work for IPB to run as smooth as possible.
*
* Initilaizes the database connection, loads the language pack, and does other nice tricks to easy your life as a PHP developer.
*
* @param array $options Use this to overwrite settings from the configuration file.
* @author CirTap <cirtap@otherone.org>
* @author Cow <khlo@global-centre.com>
* @since 1.0.0
* @return object Instance of IPBSDK
*/
function IPBSDK($options = array('root_path' => '', 'board_url' => '', 'sdklang' => '', 'board_version' =>'', 'allow_caching'=>'', 'timer'=>'', 'debug'=>'')) {
// Board vars, SDK Settings etc. No $ibforums!!!
global $INFO;

// load SDK configuration
$config = $this->load_config();
foreach (array_keys($options) as $k) {
if (empty($options[$k])) {
$options[$k] = @$config[$k];
}
}

// argh. design errors always persist;-)
$this->_options['language'] = $options['sdklang'];

// assign IPB SDK related settings
// $ipbsdk_settings is always for the boards settings
// Meanwhile $_options can be runtime ones, too.
// $_options should be used everywhere else.
$this->ipbsdk_settings['board_url'] = $config['board_url'];
$this->ipbsdk_settings['root_path'] = $config['root_path'];
$this->ipbsdk_settings['allow_caching'] = $config['allow_caching'];
$this->ipbsdk_settings['sdklang'] = $config['sdklang'];
$this->ipbsdk_settings['board_version'] = $config['board_version'];
$this->board_url = $config['board_url'];

// Put runtime options in $this->_options
// E_ALL compliant;)
$this->_options['board_url'] = (isset($options['board_url'])) ? $options['board_url'] : $config['board_url'];
$this->_options['board_path'] = (isset($options['root_path'])) ? $options['root_path'] : $config['root_path'];
$this->_options['board_version'] = (isset($options['board_version'])) ? $options['board_version'] : $config['board_version'];

// for BC: global out some settings
$GLOBALS['board_url'] = $this->_options['board_url'];
$GLOBALS['root_path'] = $this->_options['board_path'];

if (!defined('ROOT_PATH')) {
define('ROOT_PATH', $this->_options['board_path']);
}
if (!defined('KERNEL_PATH')) {
define( 'KERNEL_PATH', ROOT_PATH.'ips_kernel/' );
}
if (!defined('USE_SHUTDOWN')) {
define( 'USE_SHUTDOWN', 1);
}
if (defined('IN_IPB')) {
// Load classes for use within IPB itself.
require_once SDK_PATH . 'lib/inipb/classes.inc.php';
$GLOBALS['parser'] = new SDK_post_parser;
} else {
/**
* Load IPB's own configuration file into $INFO
*/
require_once $this->_options['root_path'] . 'forum/conf_global.php';
// some food for IPB
$INFO['board_url'] = $this->_options['board_url'];

$this->base_url = $this->_options['board_url'] . '/index.' . $INFO['php_ext'];
// Now: shut up!
// swallows all the annoying notices & warnings of functions.php
ob_start();

ipb_set_objects(array('std', 'sess', 'DB', 'parser'));
// assign sql_* settings and connect
ipb_set_database();

$this->_errors['IPB Related'] = (ob_get_length()) ? ob_get_contents() : 'Clean Run! WOW! Now try E_ALL;-)';
// Do you need a stopwatch?
// This IPB Stopwatch is very special, but we won't bother
// loading it unless it's requested as it's a waste of time.
if (isset($options['timer'])) {
ipb_set_timer();
$this->_options['timer'] = '1';
}
/*
info as of IPB 1.2 Forum (not 1.1.2 nor any ACP <g>)
Praise the Creator (no, not 'Homer') there's no is_subclass_of()
in the IPB code that verifies an object's origin;-)
we need to use $GLOBALS['ibforums'], as PHP won't update the simple $ibforum
when using global (and whick is a copy by then) until we're done and 'return'
from this constructor.
but the IPB functions already need the vars and props assigned in the next
couple of steps.
*/

$GLOBALS['ibforums'] = &get_info($this->_options['board_version'], FALSE);

// work out the proper version, as the one already defined could be inaccurate.

$GLOBALS['DB']->query("SELECT upgrade_version_id, upgrade_version_human FROM ipb_upgrade_history ORDER BY upgrade_id DESC");
while($ver = $GLOBALS['DB']->fetch_row())
{
$humanver[$ver['upgrade_version_id']] = $ver['upgrade_version_human'];
if($ver['upgrade_version_id'] > $this->_options['board_version'])
{
$this->_options['board_version'] = $ver['upgrade_version_id'];
}
}
if(!array_key_exists($this->_options['board_version'],$humanver))
{
$arr = array_keys($humanver);
rsort($arr);
reset($arr);
$this->_options['board_version'] = $arr[0];
}
$GLOBALS['ibforums']->version = $humanver[$this->_options['board_version']];
$GLOBALS['ibforums']->board_version = $this->_options['board_version'];
$this->ipbsdk_settings['board_version'] = $this->_options['board_version'];

// add input array

$GLOBALS['ibforums']->input = $GLOBALS['std']->parse_incoming();

// add/fix some of the always missing input keys; they'll be empty, but they exist
settype($GLOBALS['ibforums']->input['act'], 'string');
settype($GLOBALS['ibforums']->input['code'], 'string');
settype($GLOBALS['ibforums']->input['s'], 'string');
settype($GLOBALS['ibforums']->input['Privacy'], 'string');

// strange fix: sometimes parse_incoming doesn't parse the ip address... we'll fix that :)

if(!$GLOBALS['ibforums']->input['IP_ADDRESS'] | !isset($GLOBALS['ibforums']->input['IP_ADDRESS']))
{
$GLOBALS['ibforums']->input['IP_ADDRESS'] = $_SERVER['REMOTE_ADDR'];
}

// authenticate the user, adds to $GLOBALS['ibforums']->member
ipb_set_session();
$GLOBALS['ibforums']->input['last_activity'] = @$GLOBALS['ibforums']->member['last_activity'];
$GLOBALS['ibforums']->input['last_visit'] = @$GLOBALS['ibforums']->member['last_visit'];

// Sort out the ibforums cache and skin

ipb_set_cache();
$GLOBALS['std']->load_skin();
$GLOBALS['parser']->check_caches(1);

// Finally, register shutdown function...
ipb_do_shutdown();

// back in business, errors that follow belong to us :)
$this->_errors['IPB Related'] = (ob_get_length()) ? ob_get_contents() : 'Clean Run! WOW! Now try E_ALL;)';
ob_end_clean();
}

// REFERENCE DB for all internal requests (ie, dont forget it's '=&')

$this->DB =& $GLOBALS['DB'];

require_once(ROOT_PATH.'ips_kernel/class_converge.php');
$GLOBALS['ibforums']->converge = new class_converge( $this->DB );
if (empty($GLOBALS['ibforums']->member['mgroup']) OR $GLOBALS['ibforums']->member['mgroup'] == $GLOBALS['ibforums']->vars['guest_group'] OR $GLOBALS['ibforums']->member['id'] == '0') {
$GLOBALS['ibforums']->loggedin = 0;
} else {
$GLOBALS['ibforums']->loggedin = 1;
}
$this->loggedin = $GLOBALS['ibforums']->loggedin;

// See what language pack. If it's unavailable, load default
// SDK Language Pack as in Settings. This can be changed later in the
// main script so one can change it to the members setting or whatever.
if (isset($options['language']) && $options['language']) {
if (!$this->sdk_set_language($options['language'])) {
$this->sdk_set_language($this->ipbsdk_settings['sdklang']);
}
} else {
$this->sdk_set_language($this->ipbsdk_settings['sdklang']);
}
$this->_options['language'] = $this->ipbsdk_settings['sdklang'];


} // function IPBSDK


/**
* The Factory method will instatiate the requested Module and
* returns a reference to the newly create object.
*
* @param string $obj_class The module to be created
* @param array $options Possible runtime options used by the module.
* @return object Instance of requested module.
*/
function &factory($obj_class, $options = array()) {
// Load the module
require_once SDK_PATH . 'lib/lib_' . $obj_class . '.php';
$cls = 'SDK_' . $obj_class;
return new $cls($this, $options);
}

/**#@+
* @group Utilities
*/
/**
* Loads the configuration file and returns its settings as an associated array.
* If the config files is missing, some general, well guessed defaults are returned :)
*
* This method can be also called statically in your script using <code>$config = IPBSDK::load_config().</code>
*
* @author CirTap
* @return array
* @since 1.0.1
*/
function load_config() {
$cfg = FALSE;

if ( @include(SDK_PATH . 'ipbsdk_conf.inc.php') ) {
$cfg = get_defined_vars();
}

// If we had no config file when try and guess it or if the path is wrong

if (!$cfg OR !realpath($cfg['root_path'])) {
$cfg = array();
if (@$GLOBALS['INFO'] && @$GLOBALS['INFO']['board_url'] && @$GLOBALS['INFO']['base_dir']) {
$board_url = $GLOBALS['INFO']['board_url'];
$root_path = $GLOBALS['INFO']['base_dir'];
} else {
$board_url = (isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
foreach(array('/forum','/forums','/board','/','/Forum','/Forums') as $f) {
if (is_dir($_SERVER['DOCUMENT_ROOT'] . $f)) {
$root_path = $_SERVER['DOCUMENT_ROOT'] . $f . DIRECTORY_SEPARATOR;
$board_url = 'http://' . $board_url . $f;
break;
}
}
}
$cfg['board_url'] = $board_url;
$cfg['root_path'] = $root_path;
$cfg['allow_caching'] = 1;
$cfg['sdklang'] = 'en';
$cfg['board_version'] = 200;
}

$cfg['root_path'] = realpath($cfg['root_path']) . DIRECTORY_SEPARATOR;

return $cfg;
}

/**
* Debuggin helper routine. Writes the given variables $v to the output stream.
* This method can be also called statically in your script using <code>IPBSDK::dbg_print(arguments).</code>
*
* If your PHP script runs in a webpage that also loads a stylesheet you may customize the
* default visibility of the XMP element by adding <code>pre.DbgPrint xmp.DbgPrint { display:none; }</code>
* to this page's stylesheet. To <em>visually</em> prevent any output by default use
* <code>pre.DbgPrint { display:none; }</code>.
* Note that this ONLY affects the visibility of the generated XMP element, it's content will
* still exist in this page and contain sensible information!
*
* @param mixed $v The variable you may wish to debug
* @param integer $lines The height of the debug area in CSS em units applied to the XMP element.
* @param bool $rem Optional: short remark printed above the output. Tip: Use __FILE__ .' '. __LINE_ to locate and identify a particular call of dbg_print() more easily :)
*
* @author CirTap <cirtap@otherone.org>
* @since 1.0.1
*/
function dbg_print($v, $lines=0, $rem=FALSE) {
// a header-like section
$click = $title = $css = '';
$rem = (!$rem) ? '' : $rem;
if ($lines>0) {
$click = '<span title="Click here to show/hide debug output" style="color:#c00;cursor:pointer;cursor:hand;" onclick="var cn=this.parentNode.childNodes;var s=cn[cn.length-1].style;s.display=(s.display==\'none\')?\'block\' :\'none\';">[+]</span>';
$title = "title='Click the [+] to show/hide debug output'";
$css = "height:{$lines}em;clip:rect(0em,99%,{$lines}em,0e m);overflow:auto;";
}
if ($lines>0) echo "<pre {$title} class='DbgPrint' style='position:relative;font-size:0.9em;line-height:auto;width:98%;background-color:#efefef;color:black;border:1px solid gray;margin:2px;padding:1px 2px;'>{$click}<b>{$rem}</b>";
echo "<xmp class='DbgPrint' {$title} style='display:none;position:relative;font-size:11px;line-height:11px;width:99%;{$css}background:white;color :black;border:1px solid gray;margin:0px;padding:2px 4px;'>";
print_r($v);
echo '</xmp>';
if ($lines>0) echo '</pre>';
}


/**
* Makes a string safe for usage.
*
* This method can be also called statically in your script using <code>$string = IPBSDK::makesafe($string).</code>
*
* @param string $value HTML string
* @author Cow <khlo@global-centre.com>
* @return string safe version of value
*/
function makesafe($html) {
$html = stripslashes($html);
$html = str_replace ('<!--', '<!--', $html);
$html = str_replace ('-->', '-->', $html);
$html = str_replace ('<', '<', $html);
$html = str_replace ('>', '>', $html);
$html = str_replace (' ', ' ', $html);
$html = str_replace ("\n", '<br />', $html);
$html = str_replace ("'", ''', $html);
$html = str_replace ('\'', '"', $html);
return $html;
}

/**
* Get execution time if timer enabled.
*
* @author Cow <khlo@global-centre.com>
* @return mixed Time or flase if timer was not enabled.
*/
function get_exectime() {
return ($this->_options['timer']) ? $GLOBALS['Debug']->EndTimer() : FALSE;
}

/**
* Get database query count.
*
* @author Cow <khlo@global-centre.com>
* @return integer Amount of queries
*/
function get_querycount() {
return $this->DB->query_count;
}

/**#@+
* @group Caching
*/
/**
* Gets function results cache.
*
* @access private
* @author Cow <khlo@global-centre.com>
* @param string $function SDK Method who's query results have been cached
* @param string $id Key to identify a query from the function
* @return mixed Cached item or FALSE if $key does not exist.
*/
function get_cache($function, $id) {
if ($this->ipbsdk_settings['allow_caching'] && array_key_exists($function, $this->_cache)) {
return (array_key_exists($id, $this->_cache[$function])) ? $this->_cache[$function][$id] : FALSE;
} else {
return FALSE;
}
}

/**
* Saves/Updates function results cache.
*
* @access private
* @author Cow <khlo@global-centre.com>
* @param string $function SDK Method who's query results have been cached
* @param string $id Key to identify a query from the function
* @param string $data Data being cached
* @return void
*/
function save_cache($function, $id, $data) {
if ($this->ipbsdk_settings['allow_caching']) {
$this->_cache[$function][$id] = $data;
}
}

/**
* Attempts to find some value/object in the cache for cross variable assignments.
*
* @author CirTap <cirtap@otherone.org>
* @param string $function SDK Method who's query results have been cached
* @param string $key Key to search for in this method's results
* @return mixed value/object whatever found in cache
*/
function find_cache($function, $key) {
// Firstly see if caching is disabled
if (!$this->ipbsdk_settings['allow_caching']) {
return FALSE;
}

$data = array();
if ($this->_cache[$function]) {
foreach (array_keys($this->_cache[$function]) as $id) {
$vtype = gettype($this->_cache[$function][$id]);
if ($vtype == 'array' && isset($this->_cache[$function][$id][$key])) {
// find array element
$val = &$this->_cache[$function][$id][$id][$key];
} else if ($vtype == 'object' && isset($this->_cache[$function][$id]->$key)) {
// find object property
$val = &$this->_cache[$function][$id]->$key;
} else {
// find value
$val = &$this->_cache[$function][$id];
}

if (isset($val)) {
$data[] = $val;
}

unset($val);
}
}
return $data;
}

/**
* Attempts to sort out the weird permissions array.
*
* @author Pita <peter@randomnity.com>
* @param string $perm_array the permission array to be sorted
* @return array or permissions
*/
function sort_perms($perm_array) {
# (C) IPS
$perms = unserialize(stripslashes($perm_array));

$fr['read_perms'] = $perms['read_perms'];
$fr['reply_perms'] = $perms['reply_perms'];
$fr['start_perms'] = $perms['start_perms'];
$fr['upload_perms'] = $perms['upload_perms'];
$fr['show_perms'] = $perms['show_perms'];
RETURN $fr;
}


// -----------------------------------------------
// Main SDK Functions Follow...
// -----------------------------------------------

// -----------------------------------------------
// BBCODE FUNCTIONS
// If you like BBCode these thingys are for you :P
// -----------------------------------------------
/**#@+
* @group BBCode
*/
/**
* Converts BBCode to HTML using IPB's native
* parser.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @return string HTML version of input
* @see html2bbcode(), parse_dohtml()
*/
function bbcode2html($input, $smilies = '1') {
$input = $GLOBALS['parser']->convert(array('TEXT' => $input, 'SMILIES' => $smilies, 'CODE' => 1, 'SIGNATURE' => 0, 'HTML' => 0));
if($smilies == '1')
{
$input = str_replace("<#EMO_DIR#>",$GLOBALS['ibforums']->skin['_emodir'],$input);
$input = str_replace("<img src='style_emoticons","<img src='".$this->ipbsdk_settings['board_url']."/style_emoticons",$input);
}
return $input;
}

/**
* Converts HTML to BBCode using IPB's native parser.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @return string BBCode version of input
* @see bbcode2html(), parse_dohtml()
*/
function html2bbcode($input) {
$input = $GLOBALS['parser']->unconvert($input, 1);

return $input;
}

/**
* Parses [doHTML] tags.
* This is a wrapper for IPB's native parser. You can turn doHTML parsing on or off.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param string $input String to parse for BBCode
* @param integer $dohtml Parse for doHTML tags; 1 = yes (default), 0 = no
* @return string doHTML parsed version of input
*/
function parse_dohtml($input, $dohtml = '1') {
$GLOBALS['parser']->pp_do_html = $dohtml;
$input = $GLOBALS['parser']->post_db_parse($input);

// Apparently, some of the bracket parsing is missing, so...

while(preg_match("/\[doHTML\][\S\s]+\[\/doHTML\]/",$input))
{
$input = preg_replace("/\[doHTML\](.+?)\[\/doHTML\]/","\\1",$input);
}

return $input;
}

// -----------------------------------------------
// CACHE STORE FUNCTIONS
// The IPB Cache Store is something very little
// people know about but can be very very useful.
// -----------------------------------------------
/**#@+
* @group CacheStore
*/
/**
* List all cache stores.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @return array all cache store key, values and extra.
* @see set_cache_store_value(), get_cache_store_value(), search_cache_store()
*/
function list_cache_stores() {
if ($cache = $this->get_cache('list_cache_stores', '1')) {
return $cache;
} else {
$this->DB->query ('SELECT cs_key, cs_value, cs_extra FROM ipb_cache_store');
$cs = array();

while ($row = $this->DB->fetch_row()) {
$cs[$row['cs_key']] = $row;
}

$this->save_cache('list_cache_stores', '1', $cs);
return $cs;
}
}

/**
* Get the value of a cache store.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param string $key Key of the cache store
* @return string value of a cache store.
* @see set_cache_store_value(), list_cache_stores(), search_cache_store()
*/
function get_cache_store_value($key) {
$cs = $this->list_cache_stores();

if ($cs[$key]) {
return $cs[$key]['cs_value'];
} else {
return FALSE;
}
}

/**
* Sets or updates the value of a cache store.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param string $key Key of the cache store
* @param string $value Value to store
* @return bool TRUE on success.
* @see get_cache_store_value(), list_cache_stores(), search_cache_store()
*/
function set_cache_store_value($key, $value = '') {
$cs = $this->list_cache_stores();

if ($cs[$key]) {
// Already exists so just use UPDATE
$this->DB->query ("UPDATE ipb_cache_store SET cs_value='" . $value . "' WHERE cs_key='" . $key . "'");

if ($this->DB->get_affected_rows()) {
// And update our cached copy
$cs[$key] = array('cs_key' => $key,
'cs_value' => $value,
'cs_extra' => '',
);

$this->save_cache('list_cache_stores', '1', $cs);

return TRUE; // We're done.
} else {
// What happened? I dunno.
return FALSE;
}
} else {
// Doesn't exist so use INSERT
$this->DB->query ("INSERT INTO ipb_cache_store (cs_key, cs_value) VALUES ('" . $key . "', '" . $value . "')");
if ($this->DB->get_affected_rows()) {
// And update our cached copy
$cs[$key] = array('cs_key' => $key,
'cs_value' => $value,
'cs_extra' => '',
);

$this->save_cache('list_cache_stores', '1', $cs);
return TRUE; // And your done...
} else {
// I don't know why on earth it wouldn't work but it might not
return FALSE;
}
}
}

/**
* Searches the cache store.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param mixed $value Storage value to search
* @param bool $exactmatch Use exact matching or wildcard search
* @return array cache stores matching criteria
* @see set_cache_store_value(), get_cache_store_value(), list_cache_stores()
*/
function search_cache_store($value, $exactmatch = FALSE) {
// Do the SQL Query
if ($exactmatch) {
$this->DB->query ("SELECT * FROM ipb_cache_store WHERE cs_value='" . $value . "'");
} else {
$this->DB->query ("SELECT * FROM ipb_cache_store WHERE cs_value LIKE '%" . $value . "%'");
}

$cs = array();

while ($row = $this->DB->fetch_row()) {
$cs[$row['cs_key']] = $row;
}

return $cs;
}

// -----------------------------------------------
// CATEGORIES FUNCTIONS
// Do stuff with categories.
// -----------------------------------------------
/**#@+
* @group Categories
*/
/**
* List categories.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @return array Board Categories
* @see get_category_info(), new_category()
*/
function list_categories() {
if ($cache = $this->get_cache('list_categories', '1')) {
return $cache;
} else {
$this->DB->query ("SELECT * FROM ipb_forums WHERE parent_id = '-1'");
$cat = array();

while ($row = $this->DB->fetch_row()) {
$cat[$row['id']] = $row;
}

$this->save_cache('list_categories', '1', $cat);
return $cat;
}
}


/**
* Get Information on a Category
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param integer $categoryid Unique ID of the category
* @return array Information on category categoryid
* @see list_categories(), new_category()
*/
function get_category_info($categoryid) {
$cats = $this->list_categories();

if ($cats[$categoryid]) {
return $cats[$categoryid];
} else {
// Category doesn't exist.
return FALSE;
}
}

/**
* Creates a new category.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param string $name Name of the category to create
* @return mixed Category ID or FALSE on failure
* @see list_categories(), get_category_info()
*/
function new_category($name) {
// Grab the biggest number
$this->DB->query('SELECT MAX(id) as mmpie FROM ipb_forums');
// This SQL Query was dedicated to Weebl and Bob.
$row = $this->DB->fetch_row();

$id = intval($row['mmpie']) + 1;
// Insert it
$this->DB->query ("INSERT INTO ipb_forums (id,topics,posts,last_poster_id,name,position,allo w_poll,allow_pollbump,inc_postcount,parent_id,sub_ can_post,quick_reply,redirect_on,redirect_hits) VALUES ('" . $id . "','0','0','0','" . $this->makesafe($name) . "','1','1','0','1','-1','0','0','0','0') ");
// Check it worked
if ($this->DB->get_affected_rows()) {
return $id;
} else {
return FALSE;
}
}

// -----------------------------------------------
// CUSTOM FIELDS FUNCTIONS
// You know those special fields in profiles :)
// -----------------------------------------------
/**#@+
* @group CustomFields
*/
/**
* Gets the value of a custom profile field for a given member.
* If $memberid is ommitted, the last known member id is used.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param integer $fieldid Field ID (number) to retrieve.
* @param integer $memberid Member ID to read the custom profile field from.
* @return string Value of memberid's custom profile field field-id
* @see list_customfields(), update_customfield()
*/
function get_customfield_value($fieldid, $memberid = '') {
if ($memberid) {
$info = $this->get_advinfo($memberid);
} else {
$info = $this->get_advinfo();
}

if ($info['field_' . $fieldid]) {
return $info['field_' . $fieldid];
} else {
return FALSE;
}
}

/**
* Grab a list of custom profile fields, and their properties.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @return array custom profile fields and properties
* @see get_customfield_value(), update_customfield()
*/
function list_customfields() {
// Check for cache...
if ($cache = $this->get_cache('list_customfields', '1')) {
return $cache;
} else {
$this->DB->query ('SELECT * FROM ipb_pfields_data ORDER BY pf_id');
if ($this->DB->get_num_rows()) {
while ($info = $this->DB->fetch_row()) {
$fields['field_' . $info['pf_id']] = $info;
}

$this->save_cache('list_customfields', '1', $fields);

return $fields;
} else {
return array();
}
}
}

/**
* Updates the value of a custom profile field.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param integer $id
* @param string $newvalue
* @param bool $bypassperms
* @return bool whether the action was successful
* @see list_customfields(), get_customfield_value()
*/
function update_customfield($id, $newvalue, $bypassperms = FALSE) {
$bypassperms = (bool)$bypassperms;
$fieldinfo = $this->list_customfields();
if ($info = $fieldinfo['field_' . $id]) {
if ($info['pf_member_edit'] OR $bypassperms) {
if ($info['pf_type'] == 'drop') {
$allowed = array();

$i = explode ('|', $info['pf_content']);
foreach ($i as $j) {
$k = explode ('=', $j);
$allowed[] = $k['0'];
}

if (!in_array($newvalue, $allowed)) {
$this->sdkerror($this->lang['sdk_cfinvalidvalue']);
return FALSE;
}
}

if ($info['pf_not_null'] AND !$newvalue) {
$this->sdkerror(sprintf($this->lang['sdk_cfmustfillin']), $id);
return FALSE;
}

$this->DB->query ("UPDATE ipb_pfields_content SET field_" . $id . "='" . $newvalue . "' WHERE member_id='" . $GLOBALS['ibforums']->member['id'] . "'");
return TRUE;
} else {
$this->sdkerror(sprintf($this->lang['sdk_cfcantedit'], $id));
return FALSE;
}
} else {
$this->sdkerror(sprintf($this->lang['sdk_cfnotexist'], $id));
return FALSE;
}
}

// -----------------------------------------------
// EMAIL FUNCTIONS
// Sends an e-mail to a member.
// -----------------------------------------------
/**#@+
* @group EMail
*/
/**
* Sends an email to a member.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @param integer $id Member ID
* @param string $subject Message subject
* @param string $message Message body
* @return bool Success
*/
function mail_member($id, $subject, $message) {
if ($info = $this->get_advinfo($id)) {
if (!$this->extra['emailer']) {
// OMG, a usable lib;)
$this->extra = array_merge($this->extra, ipb_set_objects(array('emailer'), TRUE));
}

$this->extra['emailer']->to = $info['email']; // Set to
$this->extra['emailer']->subject = $subject;
$this->extra['emailer']->template = $this->lang['sdk_email_template']; // Oh dear

$this->extra['emailer']->build_message(array('MESSAGE' => $message));

$this->extra['emailer']->send_mail();
return TRUE;
} else {
return FALSE;
}
}

// -----------------------------------------------
// EMOTICONS FUNCTIONS
// Functions to do with Emoticons.
// -----------------------------------------------
/**#@+
* @group Emoticons
*/
/**
* List emoticons, optional limit the result to clickable emoticons only.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author Cow <khlo@global-centre.com>
* @author Foxrer
* @param bool $clickable Clickable emoticons only. Default: FALSE
* @return array Assoc array with Emoticons, keys 'typed', 'image'
*/
function list_emoticons($clickable = FALSE) {
if ($clickable) {
$this->DB->query ("SELECT typed, image FROM ipb_emoticons WHERE clickable='1'");
} else {
$this->DB->query ("SELECT typed, image FROM ipb_emoticons");
}

$this->DB->query ("SELECT typed, image FROM ipb_emoticons");
$emos = array();

while ($row = $this->DB->fetch_row()) {
$row['typed'] = str_replace(array('<', '>'), array('<', '>'), $row['typed']);
$emos[$row['typed']] = $row['image'];
}

return $emos;
}

// -----------------------------------------------
// GROUP FUNCTIONS
// Group stuff
// -----------------------------------------------
/**#@+
* @group Groups
*/
/**
* Returns information on a group.
* If $group is ommited, the last known group (of the last member) is used.
*
* @author Pita (conversion to 2.0) <peter@randomnity.com>
* @author CTiga <crouchintiga@comcast.net>
* @param integer $group Group ID
* @return array Group Information
*/
function get_groupinfo($group = '') {
if (!$group) {
// No Group? Return current group info
$group = $GLOBALS['ibforums']->member['mgroup'];
}
// Check for cache - if exists don't bother getting it again
if ($cache = $this->get_cache('get_groupinfo', $group)) {
return $cache;
} else {
// Return group info if group given
$this->DB->query ("SELECT g.* FROM ipb_groups g WHERE g_id='" . intval($group) . "'");
if ($this->DB->get_num_rows()) {
$info = $this->DB->fetch_row();
$this->save_cache('get_groupinfo', $group, $info);
return $info;
} else {
return FALSE;
}
}
}

// -----------------------------------------------
// SDK FUNCTIONS
// Misc functions which don't interact with IPB
// but the SDK.
// -----------------------------------------------
/**#@+
* @group SDK
*/
/**
* Adds an error message to the list of existing SDK error messages.
* Sets the last error property which get be retrieved by sdk_error()
*
* @access private
* @author Cow <khlo@global-centre.com>
* @param string $error
* @return void
* @see sdk_error()
*/
function sdkerror($error) {
// Update _lasterror
$this->_lasterror = $error;
$this->_errors[] = $error;
}

/**
* Returns the last error message generated by IPB SDK.
*
* @author Cow <khlo@global-centre.com>
* @return string Last error generated by IPB SDK
*/
function sdk_error() {
if ($this->_lasterror) {
return $this->_lasterror;
} else {
return FALSE;
}
}

/**
* Returns SDK version.
*
* @author Cow <khlo@global-centre.com>
* @return string SDK Version Number.
* @since 1.0.0 Returns a phpversion() compliant format.
*/
function sdk_version() {
return $this->ipbsdk_version;
}

/**
* Prints a useful page with debug information on IPB SDK and the things behind the scene.
*
* @author Cow <khlo@global-centre.com>
* @since 1.1 Out-sourced to reduce file-weight of the main class.
*/
function sdk_info() {
@include(SDK_PATH . 'lib/sdk_info.inc.php');
}

/**
* Returns textual/timestamp offsetted date by board and by
* member offset and DST setting.
*
* @author Cow <khlo@global-centre.com>
* @param integer $timestamp Numeric representation of the time beeing formatted
* @param string $dateformat date() compliant format (see PHP manual)
* @param integer $noboard 1=Offset with Board Time firstly, default = 0
* @param integer $nomember 1=Bypass member's time offset and DST, default = 0
* @return mixed textual/timestamp offsetted date by board and by member offset and DST setting.
*/


Voilà, je n'ai même pas tout affiché :D Donc, tu vois comme c'est compliqué de trouver l'erreur dans tout le site et surtout quand tu es tout seul et que tu n'as jamais eu de cours de php et de sql. :rolleyes:

Mic
01/03/2005, 13h03
Je te comprends tout à fait Cédric. Je te souhaite beaucoup de courage si tu décides de chercher l'erreur. Pour moi, déjà, ce n'est pas en français mais en plus tous ces lettres et ces signes, c'est du charabia :D Finalement, ce n'est pas très grave de ne pas apparaître en ligne. C'est seulement utile, si parfois on décide de contacter un membre sur le tchat. Bye, bye. #) Mic.