protected function __construct() { self::$_db = dbMysql::getInstance(); if (!self::$_db) { return NULL; } }
private static function connect() { $connectionStruct = Config::$mysqlConnection; if ($connectionStruct !== NULL) { self::$_link = @mysql_connect($connectionStruct["server"], $connectionStruct["user"], $connectionStruct["pswd"]); if (!self::$_link) { self::raiseException(ERR_MYSQL_CONNECTION_STRING, mysql_error()); return NULL; } if (!@mysql_select_db($connectionStruct["database"], self::$_link)) { self::raiseException(ERR_MYSQL_SELECT_DB, mysql_error()); return NULL; } return true; } else { self::raiseException(ERR_MYSQL_DONT_SEE_CONNECTION_STRING, mysql_error()); return NULL; } }
public static function getMenuWithOneActive($params) { //title, type, active, href, id, imgSrc self::$_db = dbMysql::getInstance(); if (self::$_db) { if (self::_exists("gallerySections", "href", $params["params"]["name"])) { $sql = "select request as \"href\", html_id as \"id\", imgSrc,"; $sql .= " ( select term from dic_data where up = " . self::DIC_MENU_ITEM_TYPE . " and code = type ) as \"type\","; $sql .= " case when href = '" . $params["params"]["name"] . "' then 'true' else 'false' end as \"active\""; $sql .= " from gallerySections order by type, ord"; $res = self::$_db->fireSQL($sql); $vars = Request::getAllVar(); for ($i = 0; $i < count($res); $i++) { //$vars[ "params" ][ "name" ] = $res[ $i ][ "href" ]; //$vars[ "show" ] = "gallery"; $res[$i]["href"] = $_SERVER["PHP_SELF"] . "?" . $res[$i]["href"]; //Registry::get( "requestTemplate" )->getRequestString( $vars ); } //print_r( $res ); die; return $res; } } return NULL; }
private function __construct() { self::$_db = dbMysql::getInstance(); }
require_once './includes/user.class.php'; // HTML_Template_IT-1.1 // License: PHP License 2.02 // Author: Ulf Wendel <*****@*****.**> // Package from PEAR require_once './includes/IT.php'; session_start(); define("PHPSESSID", session_id()); $HTTP_SESSION_VARS["remoteip"] = $HTTP_SERVER_VARS["REMOTE_ADDR"]; if (!isset($HTTP_GET_VARS["PHPSESSID"])) { header("Location: index.php?PHPSESSID=" . session_id()); return 0; } //error_reporting(E_ALL); $ref = $HTTP_GET_VARS["ref"]; $walnut_db = new dbMysql(); $tpl = new HTML_Template_IT("./templates"); $user = new user(); $tpl->loadTemplatefile("index.tpl", true, true); // data for the news $news_id = $walnut_db->fetchDataDB('news', 'news_id', 'desc'); $news_author = $walnut_db->fetchDataDB('news', 'news_author', 'desc'); $news_title = $walnut_db->fetchDataDB('news', 'news_title', 'desc'); $news_date = $walnut_db->fetchDataDB('news', 'news_date', 'desc'); $news_content = $walnut_db->fetchDataDB('news', 'news_content', 'desc'); $num = count($news_id); for ($i = 0; $i < $num; $i++) { $tpl->setCurrentBlock("news"); $tpl->setVariable("TIT_NEWS", $news_title[$i]); $tpl->setVariable("AUTHOR_NEWS", $news_author[$i]); $tpl->setVariable("DATE_NEWS", $news_date[$i]);
* limitations under the License. */ require_once './includes/db_mysql.class.php'; require_once './includes/user.class.php'; // HTML_Template_IT-1.1 // License: PHP License 2.02 // Author: Ulf Wendel <*****@*****.**> // Package from PEAR require_once './includes/IT.php'; session_start(); define("PHPSESSID", session_id()); if (!isset($HTTP_GET_VARS["PHPSESSID"])) { header("Location: login.php?PHPSESSID=" . session_id()); return 0; } $walnut_db = new dbMysql(); $tpl = new HTML_Template_IT("./templates"); $user = new user(); if (!isset($HTTP_GET_VARS["action"])) { $tpl->loadTemplatefile("login.tpl", true, true); } if ($HTTP_GET_VARS["action"] == "logging_in") { $username = $walnut_db->fetchDataDB('users', 'username', 'asc', 'user_name', $HTTP_POST_VARS["username"]); $password_md5 = $walnut_db->fetchDataDB('users', 'user_password', 'asc', 'user_name', $HTTP_POST_VARS["username"]); $password2_md5 = md5($HTTP_POST_VARS["password"]); $user->login($username, $password_md5, $password2_md5); } // data for title and logo url $title = $walnut_db->fetchDataDB('settings', 'title'); $logo = $walnut_db->fetchDataDB('settings', 'logo_url'); $tpl->setVariable("TITLE", $title["0"]);