示例#1
0
 private function imageFromId($imageId)
 {
     if ($this->connection->isConnected()) {
         // make sure it's a valid id
         //if(isValidDespotifyId($trackId))
         //{
         if (DEBUG_MODE) {
             debug_msg('writing:' . 'image ' . $imageId . '\\n');
         }
         $this->connection->write('image ' . $imageId . "\n");
         if (($length = $this->connection->readHeader()) === false) {
             return false;
         }
         if (DEBUG_MODE) {
             debug_msg('received image data');
         }
         $imageData = $this->connection->read($length);
         $this->image = $imageData;
         //$this->imageFromXMLObject($xmlObject);
         /*}
         		else
         		{
         			echo 'invalid id: ' . $imageId . '<br/>';
         			return false;
         		}
         		*/
     } else {
         return false;
     }
 }
function config_write()
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    global $dbcfg_type, $dbcfg_host, $dbcfg_name, $dbcfg_user, $dbcfg_password, $dbcfg_prefix, $dbcfg_port, $dbcfg_persistent, $dbcfg_path, $action;
    // Location of the main configuration file
    $config_file = '../config.php';
    // Contents of the main configuration file
    $config_contents = "<?php\n/*\nconfig.php\n\nGeneral Configuration\n*/\n\n// Debug level\nif(!defined('S9YCONF_DEBUG_LEVEL')) define('S9YCONF_DEBUG_LEVEL', 0);\n\n// Installed\nif(!defined('S9YCONF_INSTALLED')) define('S9YCONF_INSTALLED', TRUE);\n\n// Version\nif(!defined('S9YCONF_VERSION')) define('S9YCONF_VERSION', '2.0');\n\n// Program Name\nif(!defined('S9YCONF_PROGRAM_NAME')) define('S9YCONF_PROGRAM_NAME', 'S9Y_Conf');\n\n// path to include files\nif(!defined('S9YCONF_INC_PATH')) define('S9YCONF_INC_PATH', './inc/');\n\n// DB Type\nif(!defined('S9YCONF_DBTYPE')) define('S9YCONF_DBTYPE', '" . $dbcfg_type . "');\n\n// path to DB config file\nif(!defined('S9YCONF_DBCFG_PATH')) define('S9YCONF_DBCFG_PATH', '" . $dbcfg_path . "');\n\n// Include functions\n\n// General Uncategorised Functions\ninclude_once S9YCONF_INC_PATH.'functions.inc.php';\n\n// Database Funcctions\ninclude_once S9YCONF_INC_PATH.'db.inc.php';\n\n// HTML Functions\ninclude_once S9YCONF_INC_PATH.'html.functions.inc.php';\n\n// Include DB configuration\ninclude_once S9YCONF_DBCFG_PATH.'dbconfig.php';\n\ndebug_msg (\"FILE: \".__FILE__,3);\n\n?>";
    debug_msg(nl2br(htmlentities($config_contents, ENT_COMPAT, LANG_CHARSET)), 5);
    // Open the file for writing
    if (!($file_handle = @fopen($config_file, 'wb'))) {
        // Failed to open the file?
        return 1;
    }
    // Write the file
    if (fwrite($file_handle, $config_contents) === FALSE) {
        fclose($file_handle);
        return 2;
    }
    // Close the file
    fclose($file_handle);
    // File written readable?
    if (!is_readable($config_file)) {
        return 4;
    }
    return 0;
}
示例#3
0
function save_xml_tutorial(&$file)
{
    global $username;
    debug_msg("File type is XML");
    $tmpfile = $file["tmp_name"];
    $filename = $file["name"];
    $filepath = "users/{$username}";
    debug_msg("Path: {$filepath}");
    $pathname = "../run/{$filepath}/{$filename}";
    debug_msg("File will be saved as {$pathname}");
    // Check if file exists and if not, write the data
    if (file_exists($pathname)) {
        debug_msg("File exists - temporary storage");
        if (!is_dir("../run/{$filepath}/temp/")) {
            mkdir("../run/{$filepath}/temp/");
        }
        move_uploaded_file($tmpfile, "../run/{$filepath}/temp/{$filename}");
        $result = false;
    } else {
        move_uploaded_file($tmpfile, $pathname);
        debug_msg("Move succeeded");
        // update database
        $filenoext = stripextension($filename);
        open_db();
        $date = date("Y-m-d");
        $sql = "INSERT INTO file (file_date, file_author, file_path, file_name)" . " VALUES ('{$date}','{$username}','{$filepath}','{$filenoext}')" . " ON DUPLICATE KEY UPDATE file_date='{$date}';";
        query_db($sql);
        $result = $filenoext;
    }
    return $result;
}
示例#4
0
/**
 * Checks if password is correct or database exists
 */
function check_mysql_connection($host, $user, $password, $database)
{
    $link = mysqli_connect($host, $user, $password, $database);
    if (!$link) {
        debug_msg('Unable to connect to MySQL, errorno: ' . mysqli_connect_errno());
        debug_msg(mysqli_connect_error());
        return false;
    }
    mysqli_close($link);
    return true;
}
示例#5
0
function url_maybe_adapt_idp($url, $idpAuthnRequest_url)
{
    if (!$idpAuthnRequest_url) {
        return $url;
    }
    global $currentIdpId;
    global $entityID_to_AuthnRequest_url;
    $currentAuthnRequest = $entityID_to_AuthnRequest_url[$currentIdpId];
    $url_ = removePrefixOrNULL($url, $currentAuthnRequest);
    if ($url_) {
        $url = $idpAuthnRequest_url . $url_;
        debug_msg("personalized shib url is now {$url}");
    }
    return $url;
}
示例#6
0
function overwrite_old_file($fname)
{
    debug_msg("overwrite {$fname}");
    global $username;
    $filepath = "users/{$username}";
    $pathname = "../{$filepath}/{$fname}";
    debug_msg("File will be saved as {$pathname}");
    // move the file
    move_uploaded_file("../{$filepath}/temp/{$filename}", $pathname);
    debug_msg("Move succeeded");
    // update database
    $filenoext = stripextension($fname);
    open_db();
    $date = date("Y-m-d");
    $sql = "INSERT INTO file (file_date, file_author, file_path, file_name)" . " VALUES ('{$date}','{$username}','{$filepath}','{$filenoext}')" . " ON DUPLICATE KEY UPDATE file_date='{$date}';";
    query_db($sql);
}
/**
* My Handy Restaurant
*
* http://www.myhandyrestaurant.org
*
* My Handy Restaurant is a restaurant complete management tool.
* Visit {@link http://www.myhandyrestaurant.org} for more info.
* Copyright (C) 2003-2005 Fabio De Pascale
* 
* 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* @author		Fabio 'Kilyerd' De Pascale <*****@*****.**>
* @package		MyHandyRestaurant
* @copyright		Copyright 2003-2005, Fabio De Pascale
*/
function driver_apply($driver, $msg)
{
    $debug = _FUNCTION_ . ' - Applying driver ' . $driver . ' - to msgline ' . $msg . ' ' . "\n";
    debug_msg(__FILE__, __LINE__, $debug);
    $driver_function = 'driver_' . $driver;
    if (function_exists($driver_function)) {
        $msg = $driver_function($msg);
    } else {
        echo 'driver not found: ' . $driver . '<br>' . "\n";
        $debug = _FUNCTION_ . ' - driver ' . $driver . ' not found' . "\n";
        error_msg(__FILE__, __LINE__, $debug);
    }
    if (!CONF_DEBUG_PRINT_MARKUP) {
        // cleans all not used markups
        $msg = preg_replace("/{[^}]*}/", "", $msg);
    }
    return $msg;
}
示例#8
0
function save_media(&$file)
{
    global $username;
    debug_msg("File type is supported media");
    if ($file["size"] > 9999999) {
        debug_msg("File too large - no upload");
        move_uploaded_file($tmpfile, "../{$filepath}/temp/{$filename}");
        $result = false;
    } else {
        $tmpfile = $file["tmp_name"];
        $filename = $file["name"];
        $filepath = "../users/{$username}";
        debug_msg("Path: {$filepath}");
        $pathname = "{$filepath}/{$filename}";
        debug_msg("File will be saved as {$pathname}");
        // Check if file exists and if not, write the data
        move_uploaded_file($tmpfile, $pathname);
        debug_msg("Move succeeded");
        $result = $filename;
    }
    return $result;
}
示例#9
0
function fz_log($message, $type = null, $vars = null)
{
    if ($type == FZ_LOG_DEBUG && option('debug') !== true) {
        return;
    }
    if ($type !== null) {
        $type = '-' . $type;
    }
    $message = trim($message);
    if ($vars !== null) {
        $message .= var_export($vars, true) . "\n";
    }
    $message = str_replace("\n", "\n   ", $message);
    $message = '[' . strftime('%F %T') . '] ' . str_pad('[' . $_SERVER["REMOTE_ADDR"] . ']', 18) . $message . "\n";
    if (fz_config_get('app', 'log_dir') !== null) {
        $log_file = fz_config_get('app', 'log_dir') . '/filez' . $type . '.log';
        if (file_put_contents($log_file, $message, FILE_APPEND) === false) {
            trigger_error('Can\'t open log file (' . $log_file . ')', E_USER_WARNING);
        }
    }
    if (option('debug') === true) {
        debug_msg($message);
    }
}
示例#10
0
<?php

// secure page
require 'login.php';
// uncomment the line below to get execution detail
// $debug=true;
$file_id = trim($_POST["file"]);
$tags = $_POST["tags"];
if ($file_id != "") {
    $tagsArray = explode(";", $tags);
    debug_msg("Tags:" . $tags);
    // open database
    open_db();
    // Remove existing tags
    $sql = "DELETE FROM file_tag WHERE (file_id={$file_id})";
    query_db($sql);
    foreach ($tagsArray as $tag) {
        $tag = trim($tag);
        if ($tag != "") {
            $sql = "INSERT INTO tag(tag,tag_author) VALUES ('{$tag}','{$username}')";
            query_db($sql);
            $sql = "INSERT INTO file_tag VALUES ({$file_id},'{$tag}','{$username}')";
            query_db($sql);
        }
    }
    close_db();
    // on ferme la connexion
}
示例#11
0
文件: upload.php 项目: boisvert/elcid
    fwrite($file, $data);
    fclose($file);
    debug_msg("File written");
    // select database
    open_db();
    // Is there a file in the DB with this name & path?
    $sql = "SELECT file_id FROM file WHERE file_name='{$filename}' AND file_path='{$filepath}';";
    $date = date("Y-m-d");
    $reply = "File {$filename} ";
    if ($key = query_one_item($sql)) {
        $sql = "UPDATE file SET file_date='" . $date . "' WHERE file_id = " . $key . ";";
        $reply .= "updated.";
    } else {
        $sql = "INSERT INTO file (file_date, file_author, file_path, file_name) " . "VALUES ('" . $date . "','" . $username . "','" . $filepath . "','" . $filename . "')";
        $reply .= "created.";
    }
    query_db($sql);
    // if a temp save exists, delete it
    $pathname = "../run/users/{$username}/temp/{$filename}.xml";
    if (file_exists($pathname)) {
        unlink($pathname);
        debug_msg("Temp save removed");
    }
    echo $reply . "\n";
    echo "../users/{$username}/{$filename}.xml";
} else {
    // file does not exist despite fopen
    header("HTTP/1.1 500 Internal Server Error");
    echo "\nFile could not be created";
}
exit;
function dbconfig_write()
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    global $dbcfg_type, $dbcfg_host, $dbcfg_name, $dbcfg_user, $dbcfg_password, $dbcfg_prefix, $dbcfg_port, $dbcfg_persistent, $dbcfg_path, $action;
    $path_separator = '/';
    if ($dbcfg_path == '') {
        // If no path entered then default to ./
        $dbcfg_path = './';
        $path_separator = '';
    }
    debug_msg('dbcfg_path after checking blank: "' . $dbcfg_path . '"', 5);
    if ($dbcfg_path[0] == '/') {
        // full path will start with /
        $path_modifier = '';
        // so we have all the information we need
        $path_separator = '';
    } else {
        // must be a relative path or below main directory
        $path_modifier = '../';
        // so we need to start from the main directory
    }
    debug_msg('First 2 chars: "' . substr($dbcfg_path, 0, 2) . '"', 5);
    debug_msg('First 3 chars: "' . substr($dbcfg_path, 0, 3) . '"', 5);
    if ($dbcfg_path[0] == '/') {
        // full path
        $final_path = $dbcfg_path;
    } elseif (substr($dbcfg_path, 0, 2) == './') {
        // relative path starting with ./
        $final_path = realpath('../') . $path_separator . substr($dbcfg_path, 2, strlen($dbcfg_path) - 2);
    } elseif (substr($dbcfg_path, 0, 3) == '../') {
        // relative path starting with ../
        $final_path = realpath('../../') . $path_separator . substr($dbcfg_path, 3, strlen($dbcfg_path) - 3);
    } else {
        // must be a subdirectory of main directory
        $final_path = realpath('../') . $path_separator . $dbcfg_path;
    }
    debug_msg('path_modifier: "' . $path_modifier . '"', 5);
    debug_msg('path_separator: "' . $path_separator . '"', 5);
    debug_msg('final_path: "' . $final_path . '"', 5);
    if (substr($dbcfg_path, -1) != '/') {
        $dbcfg_path = $dbcfg_path . '/';
    }
    debug_msg('Final dbcfg_path after end slash: "' . $dbcfg_path . '"', 5);
    // Location of the main configuration file
    $dbconfig_file = $final_path . 'dbconfig.php';
    // Contents of the main configuration file
    $dbconfig_contents = "<?php\n/*\ndbconfig.php\n\nDatabase specific configuration\n*/\ndebug_msg (\"FILE: \".__FILE__,3);\n\n\n################################################################################\n#           mySQL SETTINGS                                                     #\n################################################################################\ndefine('S9YCONF_DB_HOST'      , '" . $dbcfg_host . "'); // MySQL server hostname\ndefine('S9YCONF_DB_NAME'      , '" . $dbcfg_name . "'); // name of your database\ndefine('S9YCONF_DB_USER'      , '" . $dbcfg_user . "'); // username\ndefine('S9YCONF_DB_PWD'       , '" . $dbcfg_password . "'); // password\n\n######## optional settings: ####################################################\n\n// Leaving this empty defaults to port 3306\ndefine('S9YCONF_DB_PORT'      , '" . $dbcfg_port . "');\n// To use persistent connections, change this to TRUE\ndefine('S9YCONF_DB_PERSISTENT', ";
    // Set TRUE/FALSE for persistent connections
    if ($dbcfg_persistent == '1') {
        $dbconfig_contents = $dbconfig_contents . "FALSE";
    } else {
        $dbconfig_contents = $dbconfig_contents . "TRUE";
    }
    $dbconfig_contents = $dbconfig_contents . ");\n\n#//in case you need a prefix in front of your tables...\ndefine('S9YCONF_DB_PREFIX'    , '" . $dbcfg_prefix . "');\n#\n#//please enter your old prefix here. The update-script\n#//going to change all your tables automatically to the\n#//new prefix set above.\n#define('S9YCONF_DB_PREFIX_OLD', '');\n################################################################################\n\n?>";
    debug_msg(nl2br(htmlentities($dbconfig_contents, ENT_COMPAT, LANG_CHARSET)), 5);
    // Open the file for writing
    if (!($file_handle = @fopen($dbconfig_file, 'wb'))) {
        // Failed to open the file?
        return 1;
    }
    if (fwrite($file_handle, $dbconfig_contents) === FALSE) {
        fclose($file_handle);
        return 2;
    }
    // Close the file
    fclose($file_handle);
    // File written readable?
    if (!is_readable($dbconfig_file)) {
        return 4;
    }
    return 0;
}
示例#13
0
文件: cmslogin.php 项目: rhempen/cms
function menu($action)
{
    global $menu_arr;
    // Debugging - Fenster �ffnen
    if ($_SESSION['debugging'] === true) {
        debug_open_window();
        debug_var('Seite: ', $_SERVER['PHP_SELF']);
        debug_var('Action: ', $_REQUEST);
        debug_msg('Debugging ist aktiv');
        debug_finish();
        $message = 'Debugging: aktiv!';
    }
    $html = '';
    $html .= '<h2>Menu</h2>' . "\n";
    $html .= '<ul>' . "\n";
    if (in_array($GLOBALS['CMS']['MENU01'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'NAVIGA') . '"><a href="#" onclick="javascript:start_form(\'naviga\');">' . $GLOBALS['CMS']['MENU01'] . '</a></li>' . "\n";
    }
    if (in_array($GLOBALS['CMS']['MENU02'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'SEITEN') . '"><a href="#" onclick="javascript:start_form(\'seiten\');">' . $GLOBALS['CMS']['MENU02'] . '</a></li>' . "\n";
    }
    if (in_array($GLOBALS['CMS']['MENU11'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'FRGMNT') . '"><a href="#" onclick="javascript:start_form(\'frgmnt\');">' . $GLOBALS['CMS']['MENU11'] . '</a></li>' . "\n";
    }
    if (in_array($GLOBALS['CMS']['MENU12'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'ADDONS') . '"><a href="#" onclick="javascript:start_form(\'addons\');">' . $GLOBALS['CMS']['MENU12'] . '</a></li>' . "\n";
    }
    if (in_array($GLOBALS['CMS']['MENU03'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'MEDIEN') . '"><a href="#" onclick="javascript:start_form(\'medien\');">' . $GLOBALS['CMS']['MENU03'] . '</a></li>' . "\n";
    }
    if (in_array($GLOBALS['CMS']['MENU10'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'CONFIG') . '"><a href="#" onclick="javascript:start_form(\'config\');">' . $GLOBALS['CMS']['MENU10'] . '</a></li>' . "\n";
    }
    if (in_array($GLOBALS['CMS']['MENU06'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'XLINKS') . '"><a href="#" onclick="javascript:start_form(\'xlinks\');">' . $GLOBALS['CMS']['MENU06'] . '</a></li>' . "\n";
    }
    if (in_array($GLOBALS['CMS']['MENU07'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'BACKUP') . '"><a href="#" onclick="javascript:start_form(\'backup\');">' . $GLOBALS['CMS']['MENU07'] . '</a></li>' . "\n";
    }
    if (in_array($GLOBALS['CMS']['MENU08'], $menu_arr)) {
        $html .= '<li class="' . set_class($action, 'DOKU') . '"><a href="#" onclick="javascript:start_form(\'docu\');">' . $GLOBALS['CMS']['MENU08'] . '</a></li>' . "\n";
    }
    $html .= '<li class="even">' . "\n";
    $html .= '<p><font color="#00CC00">' . $GLOBALS['TEXTE']['ANGEMELDET'] . ' ' . $_SESSION['username'] . '</font><br />' . "\n";
    if ($message != '') {
        $html .= $message;
    }
    $html .= '</p>' . "\n";
    $html .= '</li>' . "\n";
    $html .= '<li class="even"><a href="#" onclick="javascript:start_form(\'logout\');">' . $GLOBALS['CMS']['MENU09'] . '</a></li>' . "\n";
    $html .= '</ul>' . "\n";
    return $html;
}
示例#14
0
Copyright (C) 2006 Chris Lander

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 St, Fifth Floor, Boston, MA  02110-1301  USA

Contact:
	Chris Lander		Email: clander@labbs.com

	LABBS Web Services
	54 Stanley Street
	Luton
	Bedfordshire
	United Kingdom
	LU1 5AN
*/
debug_msg("FILE: " . __FILE__, 3);
if (S9YCONF_DBTYPE == 'MYSQL') {
    include_once S9YCONF_INC_PATH . 'mysql.functions.inc.php';
}
示例#15
0
 function disconnect()
 {
     $msg = 'INFO destroy.php - ' . $this->data['name'] . ' (' . $this->id . ') disconnected';
     debug_msg(__FILE__, __LINE__, $msg);
     $_SESSION = array();
     unset($_COOKIE[session_name()]);
     session_unset();
     session_destroy();
     if (isset($_SESSION['userid'])) {
         return true;
     }
     return 0;
 }
示例#16
0
 /**
  * Explain the query and dump result to log.
  */
 protected function explain()
 {
     if ($this->query_sql === null) {
         $this->compile();
     }
     $sql = "\n    EXPLAIN\n" . $this->interpolateQuery($this->query_sql, $this->query_params);
     $explain = $this->pdo->query($sql);
     $data = $explain->fetchAll(\PDO::FETCH_ASSOC);
     $col_len = array();
     $t = "\n";
     // Calculate column widths
     foreach ($data as $row) {
         foreach ($row as $k => $v) {
             $col_len[$k] = isset($col_len[$k]) ? max($col_len[$k], strlen($v)) : strlen($v);
         }
     }
     foreach ($col_len as $k => $len) {
         $col_len[$k] = max($len, strlen($k));
     }
     // Horizontal Line
     foreach ($col_len as $k => $len) {
         $t .= '+' . str_repeat('-', $len + 2);
     }
     $t .= "+\n";
     // Table header
     foreach ($col_len as $k => $len) {
         $t .= sprintf('| %-' . $len . 's ', $k);
     }
     $t .= "+\n";
     // Horizontal Line
     foreach ($col_len as $k => $len) {
         $t .= '+' . str_repeat('-', $len + 2);
     }
     $t .= "+\n";
     // Table body
     foreach ($data as $row) {
         foreach ($row as $k => $v) {
             $t .= sprintf('| %-' . $col_len[$k] . 's ', $v);
         }
         $t .= "|\n";
     }
     // Horizontal Line
     foreach ($col_len as $k => $len) {
         $t .= '+' . str_repeat('-', $len + 2);
     }
     $t .= "+\n";
     // Log the table
     if (function_exists('debug_msg')) {
         debug_msg('Explain last query:%s', $t);
     }
     // Make sure EXPLAIN query is destroyed.
     $this->uncompile();
 }
示例#17
0
function calc_db_path($final_path = '')
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    global $dbcfg_type, $dbcfg_host, $dbcfg_name, $dbcfg_user, $dbcfg_password, $dbcfg_prefix, $dbcfg_port, $dbcfg_persistent, $dbcfg_path, $action;
    $path_separator = '/';
    if ($dbcfg_path == '') {
        // If no path entered then default to ./
        $dbcfg_path = './';
        $path_separator = '';
    }
    debug_msg('dbcfg_path after checking blank: "' . $dbcfg_path . '"', 5);
    if ($dbcfg_path[0] == '/') {
        // full path will start with /
        $path_modifier = '';
        // so we have all the information we need
        $path_separator = '';
    } else {
        // must be a relative path or below main directory
        $path_modifier = '../';
        // so we need to start from the main directory
    }
    debug_msg('First 2 chars: "' . substr($dbcfg_path, 0, 2) . '"', 5);
    debug_msg('First 3 chars: "' . substr($dbcfg_path, 0, 3) . '"', 5);
    if ($dbcfg_path[0] == '/') {
        // full path
        $final_path = $dbcfg_path;
    } elseif (substr($dbcfg_path, 0, 2) == './') {
        // relative path starting with ./
        $final_path = realpath('../') . $path_separator . substr($dbcfg_path, 2, strlen($dbcfg_path) - 2);
    } elseif (substr($dbcfg_path, 0, 3) == '../') {
        // relative path starting with ../
        $final_path = realpath('../../') . $path_separator . substr($dbcfg_path, 3, strlen($dbcfg_path) - 3);
    } else {
        // must be a subdirectory of main directory
        $final_path = realpath('../') . $path_separator . $dbcfg_path;
    }
    debug_msg('path_modifier: "' . $path_modifier . '"', 5);
    debug_msg('path_separator: "' . $path_separator . '"', 5);
    debug_msg('final_path: "' . $final_path . '"', 5);
    if (substr($dbcfg_path, -1) != '/') {
        $dbcfg_path = $dbcfg_path . '/';
    }
    debug_msg('Final dbcfg_path after end slash: "' . $dbcfg_path . '"', 5);
    return $final_path;
}
示例#18
0
     $error_description = "{$errstr} ({$errno})\r\n        Status: FAILED";
     debug_msg("4. Connection failed: {$error_description}");
     $res = "FAILED";
     $mailsubject = "PayPal IPN Fatal Error on your Site";
     $mailbody = "Hello,\r\n        A fatal error occured while processing a paypal transaction.\r\n        ----------------------------------\r\n        Hostname: {$hostname}\r\n        URI: {$uri}\r\n        {$error_description}";
     vmMail($mosConfig_mailfrom, $mosConfig_fromname, $debug_email_address, $mailsubject, $mailbody);
 } else {
     debug_msg("4. Connection successful. Now posting to {$hostname}" . "{$uri}");
     fwrite($fp, $header . $workstring);
     $res = '';
     while (!feof($fp)) {
         $res .= fgets($fp, 1024);
     }
     fclose($fp);
     $error_description = "Response from {$hostname}: " . $res . "\n";
     debug_msg("5. {$error_description} ");
     // Get the Order Details from the database
     $qv = "SELECT `order_id`, `order_number`, `user_id`, `order_subtotal`,\r\n                    `order_total`, `order_currency`, `order_tax`, \r\n                    `order_shipping_tax`, `coupon_discount`, `order_discount`\r\n                FROM `#__{vm}_orders` \r\n                WHERE `order_number`='" . $invoice . "'";
     $db = new ps_DB();
     $db->query($qv);
     $db->next_record();
     $order_id = $db->f("order_id");
     $d['order_id'] = $order_id;
     $d['notify_customer'] = "Y";
     // remove post headers if present.
     $res = preg_replace("'Content-type: text/plain'si", "", $res);
     //-------------------------------------------
     // ...read the results of the verification...
     // If VERIFIED = continue to process the TX...
     //-------------------------------------------
     if (eregi("VERIFIED", $res) || @PAYPAL_VERIFIED_ONLY == '0') {
                $fsm = FlipSearchMap::buildSearchMap($url);
                echo $fsm->remapSearch($xml);
            } else {
                $patterns[0] = '/\\n/';
                $patterns[1] = "/\\'/";
                $replac[0] = '';
                $replac[1] = '&#39;';
                // We don't have FlipSearchMap remap since we have our own mapping between
                // scandata.xml leaf numbers and BR indices that happens in BRSearchCallback
                echo "{$callback}('" . preg_replace($patterns, $replac, $xml) . "');";
            }
            //echo $xml;
        }
    }
    //////
    debug_msg("Done and exiting!", 2);
    exit;
    //////
} catch (Exception $e) {
    // an internal method call invoked "fatal()"...
    XML::resultMessage('error', 'internal_error', $e->getMessage());
}
function matches_terms(&$text, &$terms)
{
    foreach ($terms as $term) {
        if (preg_match("/{$term}/i", $text)) {
            return true;
        }
    }
    return false;
}
示例#20
0
文件: utils.php 项目: boisvert/elcid
function query_one_row($sql)
{
    $result = query_db($sql)->fetch_array();
    if (!$result) {
        debug_msg("No result found.");
        return false;
    } else {
        debug_msg("Result found.");
        return $result;
    }
}
示例#21
0
 public function Expand()
 {
     if (count($this->RoosterItemSets) <= 0) {
         return false;
     }
     $this->RoosterItems = array();
     foreach ($this->RoosterItemSets as $k => $v) {
         //var_dump($v,$v->Expand());
         $this->RoosterItems = array_merge($this->RoosterItems, $v->Expand());
     }
     debug_msg('Expanded ' . count($this->RoosterItemSets) . ' sets into ' . count($this->RoosterItems) . ' items');
     return true;
 }
示例#22
0
 protected function open_ok($args)
 {
     $this->is_open = true;
     if ($this->debug) {
         debug_msg("Channel open");
     }
 }
示例#23
0
	$fp= fsockopen("ssl://".$hostname, 443, $errno, $errstr, 30);
	debug_msg("3. Connecting to: $hostname"."$uri
		Using these http Headers:

		$header

		and this String:

		$workstring");
	//----------------------------------------------------------------------
	// Check HTTP connection made to PayPal OK, If not, print an error msg
	//----------------------------------------------------------------------
	if(!$fp) {
		$error_description= "$errstr ($errno)
			Status: FAILED";
		debug_msg("4. Connection failed: $error_description");
		$res= "FAILED";
		$mailsubject= "PayPal IPN Fatal Error on your Site";
		$mailbody= "Hello,
			A fatal error occured while processing a paypal transaction.
			----------------------------------
			Hostname: $hostname
			URI: $uri
			$error_description";
		$emailObj= new stdClass();
		$emailObj->subject= $mailsubject;
		$emailObj->body= $mailbody;
		$apiEmail->sendToAdminGroup($emailObj, $oseMscConfig->admin_group);
	}
	//--------------------------------------------------------
	// If connected OK, write the posted values back, then...
示例#24
0
 /**
  * Convenience function for getting cover art
  * @return Image object representing this album's cover art
  */
 public function getCover()
 {
     if ($this->coverId) {
         if (DEBUG_MODE) {
             debug_msg("About to create Image object to return album's cover");
         }
         return new Image($this->coverId, $this->connection);
     } else {
         return false;
     }
 }
function html_footer()
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    ?>
</td>
</tr>
</table>
<hr />
<table width="100%">
	<tr>
		<td class="left">
			<a target="_blank" href="http://validator.w3.org/check?uri=http://<?php 
    echo $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
    ?>
"><img style="border:0;width:88px;height:31px" src="../images/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
<!-- 
http://validator.w3.org/check?uri=http%3A%2F%2Fvolvo.labbs.com%2F~clander%2Fs9y_conf%2Fphp%2Finstall%2Finstall.php
 -->
		</td>
		<td class="center">
			<?php 
    echo S9YCONF_PROGRAM_NAME . ' v' . S9YCONF_VERSION;
    ?>
 &copy; 2006 Chris Lander<br />
			All logos and trademarks in this site are property of their respective owner.<br />
			This application is licenced under the <a href="../licence.php" onmouseover="window.status='View licence information';return true" onmouseout="window.status='';return true">GNU General Public Licence</a>
<!-- 
			All the rest &copy; 2006 Chris Lander &amp; <a href="http://www.labbs.com/" target="_blank" onmouseover="window.status='Visit LABBS Web Services !';return true" onmouseout="window.status='';return true">LABBS Web Services</a>
 -->		</td>
		</td>
		<td class="right">
			<a target="_blank" href="http://jigsaw.w3.org/css-validator/validator?uri=http://<?php 
    echo $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
    ?>
"><img style="border:0;width:88px;height:31px" src="../images/vcss"  alt="Valid CSS!" /></a>
<!-- 
http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fvolvo.labbs.com%2F~clander%2Fs9y_conf%2Fphp%2Finstall%2Finstall.php
 -->
		</td>
	</tr>
</table>
</body>
</html>
<?php 
}
示例#26
0
                continue;
            }
            $categoryDescription = $indCatArray[2];

            // Update this to query category type
            //if ($categoryType == 1) {
            //    $categoryTypeDisp = "Custom";
            //}
            //else {
            //    $categoryTypeDisp = "Out of the Box";
            //}

            $grepString = "/($categoryType)___(.*)/";

            debug_msg ("Category type: $categoryType");
            debug_msg ("Grep string: $grepString");

            preg_match_all($grepString,$categoryTypes,$catLabelRow,PREG_SET_ORDER);

            debug_var ("Category types matching this type",$catLabelRow);

            foreach ($catLabelRow as $row) {
                $catLabelId = $row[1];
                $categoryTypeDisp = $row[2];

                if ($catLabelId == $categoryType) { continue; }
            }

            debug_var("Result of category label grep",$catLabelRow);

            $categoryDescriptionDisp = $categoryDescription;
function db_install($created = TRUE)
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    // Read SQL from file
    $query = file_get_contents('s9y_conf_sql.tpl');
    // Replace token with value
    $query = str_replace('{DBPREFIX}', S9YCONF_DB_PREFIX, $query);
    // Split SQL file into seperate statements so we don't get a MySQL error
    $chunk = explode(";\n", $query);
    // Cycle through our SQL statements
    foreach ($chunk as $query) {
        $query = trim($query);
        // Remove whitespace from start and end
        if ($query != '') {
            // Ensure we don't send a blank query
            $result = db_query($query, FALSE, TRUE);
            debug_msg("RESULT: " . $result, 4);
        }
        if (!$result) {
            // When there is an error
            $created = FALSE;
            // Set flag
            break;
            // and don't do any more queries
        }
    }
    return $created;
    // Return flag; TRUE=Success, FALSE=Error
}
function print_barcode($code)
{
    $codedata = sprintf("%07d", $code);
    debug_msg(__FILE__, __LINE__, "INFO print_barcode - codedata: {$codedata}");
    $msg = '{align_center}';
    $msg .= '{barcode_code39}' . "{$codedata}" . '{/barcode_code39}';
    //barcode CODE39
    $msg = str_replace("'", "", $msg);
    return $msg;
}
示例#29
0
function template_display($id = '', $name = '', $description = '', $template = '', $message = '')
{
    debug_msg("FUNCTION: " . __FUNCTION__, 3);
    if ($message != '') {
        echo '<div class="information">' . $message . '<br /></div>';
    }
    ?>
<table cellpadding="0" align="center">

<tr>

<td class="right">
Name :
</td>
<td class="left">
<?php 
    echo $name;
    ?>
</td>

</tr>

<tr>

<td class="right">
Description :
</td>
<td class="left">
<?php 
    echo $description;
    ?>
</td>

</tr>

<tr>

<tr>

<td class="topright">
Template :
</td>
<td class="left">
<?php 
    echo nl2br($template);
    ?>
</td>

</tr>


</table>
<?php 
}
function dishes_list_cat_pos($data)
{
    $output = '';
    $cat = new category($data['category']);
    if ($data['category'] <= 0) {
        if (get_conf(__FILE__, __LINE__, "invisible_show")) {
            $query = "SELECT dishes.*\n\t\t\tFROM `dishes`\n\t\t\tWHERE dishes.deleted='0'\n\t\t\tORDER BY category ASC, name ASC";
        } else {
            $query = "SELECT dishes.*, categories.image\n\t\t\tFROM `dishes` \n\t\t\tWHERE `visible`='1' \n\t\t\tAND dishes.deleted='0'\n\t\t\tORDER BY category ASC, name ASC";
        }
    } else {
        if (get_conf(__FILE__, __LINE__, "invisible_show")) {
            $query = "SELECT dishes.*, categories.image as imgcat\n\t\t\t\t\tFROM categories, dishes \n\t\t\t\t\tWHERE category='" . $data['category'] . "'";
        } else {
            $query = "SELECT dishes.*, categories.image as imgcat\n\t\t\tFROM categories, dishes \n\t\t\tWHERE categories.id = '" . $data['category'] . "' AND  \n\t\t\tcategory='" . $data['category'] . "'\n\t\t\tAND `visible`='1'\n\t\t\tAND dishes.deleted='0'";
        }
        $class = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], "categories", "htmlcolor", $data['category']);
        $dishcat = $data['category'];
    }
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return '';
    }
    //$output .= '<table bgcolor="'.COLOR_TABLE_GENERAL.'">';
    $output .= '<table>';
    // ascii letter A
    $i = 65;
    unset($GLOBALS['key_binds_letters']);
    $cikel = -1;
    while ($arr = mysql_fetch_array($res)) {
        $cikel++;
        $dishid = $arr['id'];
        $dishname = $arr['name'];
        if ($dishname == null || strlen(trim($dishname)) == 0) {
            $dishname = $arr['name'];
        }
        $dishprice = $arr['price'];
        $image = isset($arr['image']) ? $arr['image'] : IMAGE_DISH_DEFAULT;
        if ($data['category'] <= 0) {
            $dishcat = $arr['category'];
            debug_msg(__FILE__, __LINE__, "dishcat: {$dishcat}");
            $class = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'categories', "htmlcolor", $dishcat);
            debug_msg(__FILE__, __LINE__, "class: {$class}");
        }
        if (!$cikel % 6) {
            $output .= '<tr>';
        }
        if ($dishcat > 0) {
            // letters array follows
            if ($i < 91) {
                $GLOBALS['key_binds_letters'][$i] = $dishid;
                $letter = chr($i);
                $i++;
            } else {
                $letter = '';
            }
            $output .= '
			<td onclick="dishOrder(' . $dishid . '); return false;">
				<a href="#" class="buttonDish">
						<img src="' . $image . '" >
						<br />
						' . wordwrap(strtoupper($dishname), 25, "<br/>\n") . '
					</a>
			</td>';
            if (!(($cikel + 1) % 6)) {
                $output .= '</tr>';
            }
        }
    }
    $output .= '
	</table>';
    return $output;
}