Commit c59381c0 authored by damosoft's avatar damosoft

Instant-Auto-Merge from BRANCH-1-9 to HEAD

parent 0e0a3296
......@@ -1707,6 +1707,7 @@ tiki/img/flags/Iraq.gif -text
tiki/img/flags/Ireland.gif -text
tiki/img/flags/Israel.gif -text
tiki/img/flags/Italy.gif -text
tiki/img/flags/Ivory_Coast.gif -text
tiki/img/flags/Jamaica.gif -text
tiki/img/flags/Japan.gif -text
tiki/img/flags/Jordan.gif -text
......@@ -2876,6 +2877,7 @@ tiki/lib/pear/tests/XML_Tree/tests/test.php -text
tiki/lib/phplot.php -text
tiki/lib/polls/index.php -text
tiki/lib/polls/polllib.php -text
tiki/lib/polls/polllib_shared.php -text
tiki/lib/quicktags/index.php -text
tiki/lib/quicktags/quicktagslib.php -text
tiki/lib/quizzes/index.php -text
......
......@@ -22,42 +22,56 @@ $tikidomain = '';
/*
CVS Developers: Do not change any of the above.
Instead, create a file, called local.php, containing any of
Instead, create a file, called db/local.php, containing any of
the variables listed above that are different for your
development environment. This will protect you from
accidentally committing your username/password to CVS!
For example:
cd <tiki_dir>/db
cat >local.php <<EOF
example of db/local.php
<?php
\$api_tiki = 'pear';
\$db_tiki = 'mysql';
\$dbversion_tiki = 'mysql3';
\$host_tiki = 'myhost';
\$user_tiki = 'myuser';
\$pass_tiki = 'mypass';
\$dbs_tiki = 'mytiki';
$host_tiki = 'myhost';
$user_tiki = 'myuser';
$pass_tiki = 'mypass';
$dbs_tiki = 'mytiki';
?>
EOF
** Multi-tiki
**************************************
read comments in local_multi.php
see http://tikiwiki.org/MultiTiki19
*/
// change next value to true if you use multi-domain
$tikidomain_multi = false;
Setup of virtual tikis is done using setup.sh script
-----------------------------------------------------------
-> Multi-tiki trick for virtualhosting
$file_local_php = dirname(__FILE__). '/local.php';
$file_local_php_multi = dirname(__FILE__). '/local_multi.php';
$tikidomain variable is set to :
or TIKI_VIRTUAL
That is set in apache virtual conf : SetEnv TIKI_VIRTUAL myvirtual
or SERVER_NAME
From apache directive ServerName set for that virtualhost block
or HTTP_HOST
From the real domain name called in the browser
(can be ServerAlias from apache conf)
*/
if ($tikidomain_multi and file_exists($file_local_php_multi)) {
require_once ($file_local_php_multi);
$local_php = 'db/local.php';
if (is_file('db/virtuals.inc')) {
if (isset($_SERVER['TIKI_VIRTUAL']) and is_file('db/'.$_SERVER['TIKI_VIRTUAL'].'/local.php')) {
$multi = $_SERVER['TIKI_VIRTUAL'];
} elseif (isset($_SERVER['SERVER_NAME']) and is_file('db/'.$_SERVER['SERVER_NAME'].'/local.php')) {
$multi = $_SERVER['SERVER_NAME'];
} elseif (isset($_SERVER['HTTP_HOST']) and is_file('db/'.$_SERVER['HTTP_HOST'].'/local.php')) {
$multi = $_SERVER['HTTP_HOST'];
}
if (isset($multi)) {
$local_php = "db/$multi/local.php";
$tikidomain = $multi;
}
}
if (file_exists($file_local_php)) {
require_once ($file_local_php);
if (is_file($local_php)) {
require_once($local_php);
} else {
die("<b style=color:red;>$local_php not found.</b><br /><br />Please run <a href=tiki-install.php>tiki-install.php</a>");
}
if (preg_match('/^adodb$/i', $api_tiki)) {
TikiInit::prependIncludePath('lib/adodb');
......
# $Rev$
# $Date: 2004-10-08 09:59:45 $
# $Date: 2004-10-15 15:54:46 $
# $Author: damosoft $
# $Name: not supported by cvs2svn $
# phpMyAdmin MySQL-Dump
......@@ -3763,6 +3763,7 @@ CREATE TABLE users_groups (
groupName varchar(255) NOT NULL default '',
groupDesc varchar(255) default NULL,
groupHome varchar(255),
groupHomeLocalized char(1) default 'n',
usersTrackerId int(11),
groupTrackerId int(11),
usersFieldId int(11),
......@@ -3784,7 +3785,7 @@ CREATE TABLE users_objectpermissions (
permName varchar(30) NOT NULL default '',
objectType varchar(20) NOT NULL default '',
objectId varchar(32) NOT NULL default '',
PRIMARY KEY (objectId,groupName(30),permName)
PRIMARY KEY (objectId, objectType, groupName(30),permName)
) TYPE=MyISAM;
# --------------------------------------------------------
......@@ -3991,6 +3992,9 @@ INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_view_user_information', 'Can view user info on tiki-user_information.php', 'registered', 'tiki');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES('tiki_p_admin_users', 'Can admin users', 'admin', 'user');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_wiki_view_comments', 'Can view wiki coments', 'basic', 'wiki');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_wiki_view_ratings', 'Can view rating of wiki pages', 'basic', 'wiki');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_wiki_vote_ratings', 'Can participate to rating of wiki pages', 'registered', 'wiki');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_wiki_admin_ratings', 'Can add and change ratings on wiki pages', 'admin', 'wiki');
# --------------------------------------------------------
......@@ -4203,7 +4207,6 @@ INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_poll_item_comme
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_poll_submissions','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_polls','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_quizzes','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_ranking','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_referer_stats','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_right_column','y');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_sandbox','y');
......@@ -4247,6 +4250,7 @@ INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_open_as_st
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_pdf','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_pictures','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_rankings','y');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_ratings','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_tables','old');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_templates','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_undo','n');
......@@ -4385,6 +4389,7 @@ INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('user_assigned_modules',
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('user_list_order','score_desc');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('userfiles_quota','30');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('validateEmail','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('validateRegistration','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('validateUsers','n');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('w_use_db','y');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('w_use_dir','');
......
# $Header: /cvsroot/tikiwiki/tiki/db/tiki_1.8to1.9.sql,v 1.91 2004-10-08 09:59:45 damosoft Exp $
# $Header: /cvsroot/tikiwiki/tiki/db/tiki_1.8to1.9.sql,v 1.92 2004-10-15 15:54:46 damosoft Exp $
# The following script will update a tiki database from verion 1.8 to 1.9
#
......@@ -666,7 +666,7 @@ CREATE TABLE `tiki_download` (
KEY `userId` (`userId`),
KEY `type` (`type`),
KEY `date` (`date`)
) TYPE=MyISAM AUTO_INCREMENT=32;
) TYPE=MyISAM ;
# added on 2004-09-18 by franck for adding geographic capability to image galleries
ALTER TABLE `tiki_galleries` ADD `geographic` char(1) default NULL AFTER `visible`;
......@@ -680,4 +680,12 @@ INSERT INTO tiki_menu_options (menuId,type,name,url,position,section,perm,groupn
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_wiki_view_comments', 'Can view wiki coments', 'basic', 'wiki');
insert into users_grouppermissions (groupName,permName) values('Anonymous','tiki_p_wiki_view_comments');
# added on 11 10 04 06:28:29 by more for registration validation by admin
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('validateRegistration','n');
# added on 12 10 04 08:21:46 by mose for wiki_rating system
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_wiki_view_ratings', 'Can view rating of wiki pages', 'basic', 'wiki');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_wiki_vote_ratings', 'Can participate to rating of wiki pages', 'registered', 'wiki');
INSERT INTO users_permissions (permName, permDesc, level, type) VALUES ('tiki_p_wiki_admin_ratings', 'Can add and change ratings on wiki pages', 'admin', 'wiki');
INSERT IGNORE INTO tiki_preferences(name,value) VALUES ('feature_wiki_ratings','n');
<?php
// $Header: /cvsroot/tikiwiki/tiki/doc/devtools/ggg-trace.php,v 1.3 2004-10-15 15:54:46 damosoft Exp $
//
// George G. Geller
// January 24, 2004
// Revised: October 11, 2004
//
// doc/devtools/ggg-trace.php
// A simple debugging tool.
......@@ -28,7 +31,7 @@ class ggg_trace
$this->fp = fopen($nameStr,"a");
fwrite($this->fp,"\n");
// e.g. 20031231 17:00:20
fwrite($this->fp,"*".date("Ymd G:i:s")."*Starting*****************************************************\n");
fwrite($this->fp,"*".date("Ymd G:i:s")."*Starting*****************************************************\n");
// print date("Ymd G:i:s<br>",time()); // e.g. 20031231 17:00:20
}
......@@ -42,19 +45,29 @@ class ggg_trace
}
function outvar($var, $indent=0)
{
if ($indent > 8) {
fwrite($this->fp,"Too many levels of recursion! \n");
return;
}
$spaces = sprintf("%".$indent."s",'');
fwrite($this->fp,$spaces.$var."\n");
if (is_array($var)) {
$indent++;
$spaces = sprintf("%".$indent."s",'');
foreach($var as $key=>$val){
if (is_array($val)) {
$this->out($spaces."$key = ");
$this->outvar($val, $indent);
}
else {
fwrite($this->fp,$spaces.$key."=>".$val."\n");
}
if ($key === 'GLOBALS' && is_array($val)) {
// In case we are called with $ggg_tracer->outvar($GLOBALS);
// and we don't check here, we get an infinite recursion.
// If another array has an element called GLOBALS, oh well.
fwrite($this->fp,"ggg-trace.php, line 62: Found GLOBALS array, not recursing. \n");
}
elseif (is_array($val)) {
$this->out($spaces."$key = ");
$this->outvar($val, $indent);
}
else {
fwrite($this->fp,$spaces.$key."=>".$val."\n");
}
}
}
}
......
<?php
// $Header: /cvsroot/tikiwiki/tiki/get_strings.php,v 1.39 2004-08-16 02:26:40 teedog Exp $
// $Header: /cvsroot/tikiwiki/tiki/get_strings.php,v 1.40 2004-10-15 15:54:41 damosoft Exp $
// Copyright (c) 2002-2004, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
......@@ -351,10 +351,10 @@ foreach ($languages as $sel) {
// Only extract tra () and hawtra () in .php-files
// Extract from SINGLE qouted strings
preg_match_all ('/(?s)[^a-zA-Z0-9_\x7f-\xff](?:haw)?tra\s*\(\s*\'(.+?)\'\s*\)/', $data, $sqwords);
preg_match_all ('/(?s)[^a-zA-Z0-9_\x7f-\xff](?:haw)?tra\s*\(\s*\'(.+?)\'\s*[\),]/', $data, $sqwords);
// Extract from DOUBLE quoted strings
preg_match_all ('/(?s)[^a-zA-Z0-9_\x7f-\xff](?:haw)?tra\s*\(\s*"(.+?)"\s*\)/', $data, $dqwords);
preg_match_all ('/(?s)[^a-zA-Z0-9_\x7f-\xff](?:haw)?tra\s*\(\s*"(.+?)"\s*[\),]/', $data, $dqwords);
}
if (preg_match ("/\.tpl$/", $file)) {
......
<?php // -*- coding:utf-8 -*- $Header: /cvsroot/tikiwiki/tiki/img/flags/flagnames.php,v 1.4 2004-10-08 09:59:46 damosoft Exp $
<?php // -*- coding:utf-8 -*- $Header: /cvsroot/tikiwiki/tiki/img/flags/flagnames.php,v 1.5 2004-10-15 15:54:46 damosoft Exp $
/*
* The listing associates country names used as filenames for flags in TikiWiki for language translation
*/
......@@ -65,6 +65,7 @@ tra('Iraq');
tra('Ireland');
tra('Israel');
tra('Italy');
tra('Ivory_Coast');
tra('Jamaica');
tra('Japan');
tra('Jordan');
......
......@@ -115,9 +115,9 @@ class CalendarLib extends TikiLib {
$bindvars[] = (int)$tstop;
$bindvars[] = (int)$tstart;
$query = "select i.`calitemId` as calitemId, i.`name` as name, i.`description` as description, i.`start` as start, i.`end` as end, ";
$query .= "i.`url` as url, i.`status` as status, i.`priority` as priority, c.`name` as calname, i.`calendarId` as calendarId, ";
$query .= "i.`locationID` as locationID, i.`categoryID` as categoryID ";
$query = "select i.`calitemId` as `calitemId`, i.`name` as `name`, i.`description` as `description`, i.`start` as `start`, i.`end` as `end`, ";
$query .= "i.`url` as `url`, i.`status` as `status`, i.`priority` as `priority`, c.`name` as `calname`, i.`calendarId` as `calendarId`, ";
$query .= "i.`locationID` as `locationID`, i.`categoryID` as `categoryID` ";
$query .= "from `tiki_calendar_items` as i left join `tiki_calendars` as c on i.`calendarId`=c.`calendarId` where ($cond) ";
$result = $this->query($query,$bindvars);
$ret = array();
......@@ -212,8 +212,8 @@ class CalendarLib extends TikiLib {
break;
case "gal":
$query = "select i.`imageId` as imageid, i.`created` as created, i.`user` as user, i.`name` as name, ";
$query.= "g.`name` as galname, g.`galleryId` as galid from `tiki_images` as i ";
$query = "select i.`imageId` as `imageid`, i.`created` as `created`, i.`user` as `user`, i.`name` as `name`, ";
$query.= "g.`name` as `galname`, g.`galleryId` as `galid` from `tiki_images` as i ";
$query.= "left join `tiki_galleries` as g on g.`galleryId`=i.`galleryId` where (i.`created`>? and i.`created`<?)";
$result = $this->query($query,array($tstart,$tstop));
......@@ -235,7 +235,7 @@ class CalendarLib extends TikiLib {
break;
case "art":
$query = "select `articleId`, `title`, `heading`, `authorName`, `topicName`, `publishDate` as created ";
$query = "select `articleId`, `title`, `heading`, `authorName`, `topicName`, `publishDate` as `created` ";
$query.= "from `tiki_articles` where (`publishDate`>? and `publishDate`<?)";
$result = $this->query($query,array($tstart,$tstop));
......@@ -257,7 +257,7 @@ class CalendarLib extends TikiLib {
break;
case "blog":
$query = "select p.`created` as created, p.`user` as user, p.`title` as postname, b.`title` as blogname, b.`blogId` as blogid ";
$query = "select p.`created` as `created`, p.`user` as `user`, p.`title` as `postname`, b.`title` as `blogname`, b.`blogId` as `blogid` ";
$query.= "from `tiki_blog_posts` as p left join `tiki_blogs` as b on p.`blogId`=b.`blogId` where (p.`created`>? and p.`created`<?)";
$result = $this->query($query,array($tstart,$tstop));
......@@ -283,7 +283,7 @@ class CalendarLib extends TikiLib {
//$query = "select c.`commentDate` as created, c.`threadId` as threadId, c.`userName` as user, c.`title` as name, f.`name` as forum, f.`forumId` as forumid, c.`parentId` as parentId ";
//$query.= "from `tiki_comments` as c left join `tiki_forums` as f on c.`object`=f.`forumId` and c.`objectType` = ? ";
//$query.= "where (c.`commentDate`>? and c.`commentDate`<?)";
$query = "select c.`commentDate` as created, c.`threadId` as threadId, c.`userName` as user, c.`title` as name, f.`name` as forum, f.`forumId` as forumid, c.`parentId` as parentId ";
$query = "select c.`commentDate` as `created`, c.`threadId` as `threadId`, c.`userName` as `user`, c.`title` as `name`, f.`name` as `forum`, f.`forumId` as `forumid`, c.`parentId` as `parentId` ";
$query.= "from `tiki_comments` as c, `tiki_forums` as f where c.`object`=f.`forumId`and c.`objectType` = ? ";
$query.= "and (c.`commentDate`>? and c.`commentDate`<?)";
$result = $this->query($query,array('forum',$tstart,$tstop));
......@@ -331,7 +331,7 @@ class CalendarLib extends TikiLib {
break;
case "fgal":
$query = "select f.`created` as created, f.`user` as user, f.`name` as name, f.`description` as description, g.`galleryId` as fgalId, g.`name` as fgalname ";
$query = "select f.`created` as `created`, f.`user` as `user`, f.`name` as `name`, f.`description` as `description`, g.`galleryId` as `fgalId`, g.`name` as `fgalname` ";
$query.= "from `tiki_files` as f left join `tiki_file_galleries` as g on f.`galleryId`=g.`galleryId` where (f.`created`>? and f.`created`<?)";
$result = $this->query($query,array($tstart,$tstop));
......@@ -397,7 +397,7 @@ class CalendarLib extends TikiLib {
break;
case "track":
$query = "select i.`itemId` as itemId, i.`created` as created, t.`name` as name, t.`trackerId` as tracker ";
$query = "select i.`itemId` as `itemId`, i.`created` as `created`, t.`name` as `name`, t.`trackerId` as `tracker` ";
$query.= "from `tiki_tracker_items` as i left join `tiki_trackers` as t on t.`trackerId`=i.`trackerId` where (i.`created`>? and i.`created`<?)";
$result = $this->query($query,array($tstart,$tstop));
......@@ -442,7 +442,7 @@ class CalendarLib extends TikiLib {
break;
case "nl":
$query = "select count(s.`email`) as count, FROM_UNIXTIME(s.`subscribed`,'%d') as d, max(s.`subscribed`) as day, s.`nlId` as nlId, n.`name` as name ";
$query = "select count(s.`email`) as count, FROM_UNIXTIME(s.`subscribed`,'%d') as d, max(s.`subscribed`) as day, s.`nlId` as `nlId`, n.`name` as `name` ";
$query.= " from `tiki_newsletter_subscriptions` as s left join `tiki_newsletters` as n ";
$query.= " on n.`nlId`=s.`nlId` where (`subscribed`>? and `subscribed`<?) group by s.`nlId`, d";
$result = $this->query($query,array($tstart,$tstop));
......@@ -465,7 +465,7 @@ class CalendarLib extends TikiLib {
break;
case "eph":
$query = "select `publish` as created, `title` as name, `textdata` as description ";
$query = "select `publish` as `created`, `title` as `name`, `textdata` as `description` ";
$query.= "from `tiki_eph` where (`publish`>? and `publish`<?)";
$result = $this->query($query,array($tstart,$tstop));
......@@ -487,7 +487,7 @@ class CalendarLib extends TikiLib {
break;
case "chart":
$query = "select `chartId`, `created`, `title` as name, `description` ";
$query = "select `chartId`, `created`, `title` as `name`, `description` ";
$query .= "from `tiki_charts` where (`created`>? and `created`<?)";
$result = $this->query($query,array($tstart,$tstop));
......@@ -514,11 +514,11 @@ class CalendarLib extends TikiLib {
}
function get_item($calitemId) {
$query = "select i.`calitemId` as calitemId, i.`calendarId` as calendarId, i.`user` as user, i.`start` as start, i.`end` as end, t.`name` as calname, ";
$query.= "i.`locationId` as locationId, l.`name` as locationName, i.`categoryId` as categoryId, c.`name` as categoryName, i.`priority` as priority, ";
$query.= "i.`status` as status, i.`url` as url, i.`lang` as lang, i.`name` as name, i.`description` as description, i.`created` as created, i.`lastmodif` as lastModif, ";
$query.= "t.`customlocations` as customlocations, t.`customcategories` as customcategories, t.`customlanguages` as customlanguages, t.`custompriorities` as custompriorities, ";
$query.= "t.`customparticipants` as customparticipants from `tiki_calendar_items` as i left join `tiki_calendar_locations` as l on i.`locationId`=l.`callocId` ";
$query = "select i.`calitemId` as `calitemId`, i.`calendarId` as `calendarId`, i.`user` as `user`, i.`start` as `start`, i.`end` as `end`, t.`name` as `calname`, ";
$query.= "i.`locationId` as `locationId`, l.`name` as `locationName`, i.`categoryId` as `categoryId`, c.`name` as `categoryName`, i.`priority` as `priority`, ";
$query.= "i.`status` as `status`, i.`url` as `url`, i.`lang` as `lang`, i.`name` as `name`, i.`description` as `description`, i.`created` as `created`, i.`lastmodif` as `lastModif`, ";
$query.= "t.`customlocations` as `customlocations`, t.`customcategories` as `customcategories`, t.`customlanguages` as `customlanguages`, t.`custompriorities` as `custompriorities`, ";
$query.= "t.`customparticipants` as `customparticipants` from `tiki_calendar_items` as i left join `tiki_calendar_locations` as l on i.`locationId`=l.`callocId` ";
$query.= "left join `tiki_calendar_categories` as c on i.`categoryId`=c.`calcatId` left join `tiki_calendars` as t on i.`calendarId`=t.`calendarId` where `calitemId`=?";
$result = $this->query($query,array((int)$calitemId));
$res = $result->fetchRow();
......@@ -623,7 +623,7 @@ class CalendarLib extends TikiLib {
function list_locations($calendarId) {
$res = array();
if ($calendarId > 0) {
$query = "select `callocId` as locationId, `name` from `tiki_calendar_locations` where `calendarId`=?";
$query = "select `callocId` as `locationId`, `name` from `tiki_calendar_locations` where `calendarId`=?";
$result = $this->query($query,array($calendarId));
while ($rez = $result->fetchRow()) {
$res[] = $rez;
......@@ -635,7 +635,7 @@ class CalendarLib extends TikiLib {
function list_categories($calendarId) {
$res = array();
if ($calendarId > 0) {
$query = "select `calcatId` as categoryId, `name` from `tiki_calendar_categories` where `calendarId`=?";
$query = "select `calcatId` as `categoryId`, `name` from `tiki_calendar_categories` where `calendarId`=?";
$result = $this->query($query,array($calendarId));
while ($rez = $result->fetchRow()) {
$res[] = $rez;
......
<?php
/** \file
* $Header: /cvsroot/tikiwiki/tiki/lib/categories/categlib.php,v 1.61 2004-10-08 10:00:00 damosoft Exp $
* $Header: /cvsroot/tikiwiki/tiki/lib/categories/categlib.php,v 1.62 2004-10-15 15:54:49 damosoft Exp $
*
* \brief Categories support class
*
......@@ -121,12 +121,7 @@ class CategLib extends TikiLib {
function get_category_name($categId) {
$query = "select `name` from `tiki_categories` where `categId`=?";
$result = $this->query($query,array((int) $categId));
if (!$result->numRows()) {
return false;
}
$res = $result->fetchRow();
return $res;
return $this->getOne($query,array((int) $categId));
}
function remove_category($categId) {
......@@ -601,12 +596,15 @@ class CategLib extends TikiLib {
}
function categorize_poll($pollId, $categId) {
global $polllib;
// Check if we already have this object in the tiki_categorized_objects page
$catObjectId = $this->is_categorized('poll', $pollId);
if (!$catObjectId) {
if (!is_object($polllib)) {
require_once('lib/polls/polllib_shared.php');
}
// The page is not cateorized
$info = $this->get_poll($pollId);
$info = $pollib->get_poll($pollId);
$href = 'tiki-poll_form.php?pollId=' . $pollId;
$catObjectId = $this->add_categorized_object('poll', $pollId, $info["title"], $info["title"], $href);
......@@ -811,7 +809,7 @@ class CategLib extends TikiLib {
}
//Moved from tikilib.php
function get_categoryobjects($catids,$types="*",$sort='created_desc',$split=true,$sub=false) {
function get_categoryobjects($catids,$types="*",$sort='created_desc',$split=true,$sub=false,$and=false) {
global $smarty;
global $feature_categories;
......@@ -850,12 +848,16 @@ class CategLib extends TikiLib {
);
$out = "";
$listcat = array();
$listcat = $allcats = array();
$title = '';
$find = "";
$offset = 0;
$firstpassed = false;
$maxRecords = 500;
$typesallowed = array();
if ($and) {
$split = false;
}
if ($types == '*') {
$typesallowed = array_keys($typetitles);
} elseif (strpos($types,'+')) {
......@@ -874,28 +876,29 @@ class CategLib extends TikiLib {
}
foreach ($catids as $id) {
$cat = $this->get_category($id);
$titles["$id"] = $cat["name"];
$titles["$id"] = $this->get_category_name($id);
$objectcat = array();
if ($sub) {
$objectcat = $this->list_category_objects_deep($id, $offset, $maxRecords, $sort, $find);
} else {
$objectcat = $this->list_category_objects($id, $offset, $maxRecords, $sort, $find);
}
$acats = $andcat = array();
foreach ($objectcat["data"] as $obj) {
$type = $obj["type"];
if (($types == '*') || in_array($type,$typesallowed)) {
if ($split) {
$listcat[$typetitles["$type"]][] = $obj;
if ($split or !$firstpassed) {
$listcat["$type"][] = $obj;
$cats[] = $type.'.'.$obj['name'];
} elseif ($and) {
if (in_array($type.'.'.$obj['name'], $cats)) {
$andcat["$type"][] = $obj;
$acats[] = $type.'.'.$obj['name'];
}
} else {
if (!($this->in_multi_array($obj['name'], $listcat))) {
if (isset($typetitles["$type"])) {
$listcat["{$typetitles["$type"]}"][] = $obj;
} elseif (isset($type)) {
$listcat["$type"][] = $obj;
}
if (!in_array($type.'.'.$obj['name'], $cats)) {
$listcat["$type"][] = $obj;
$cats[] = $type.'.'.$obj['name'];
}
}
}
......@@ -907,7 +910,12 @@ class CategLib extends TikiLib {
$out .= $smarty->fetch("categobjects.tpl");
$listcat = array();
$titles = array();
$cats = array();
} elseif ($and and $firstpassed) {
$listcat = $andcat;
$cats = $acats;
}
$firstpassed = true;
}
if (!$split) {
$smarty->assign("id", $id);
......
......@@ -6,8 +6,9 @@ if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
exit;
}
class PollLib extends TikiLib {
include_once('lib/polls/polllib_shared.php');
class PollLib extends PollLibShared {
function PollLib($db) {
if (!$db) { die ("Invalid db object passed to PollLib constructor"); }
$this->db = $db;
......
<?php
//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
header("location: index.php");
exit;
}
class PollLibShared extends TikiLib {
var $db;
function PollLibShared($db) {
$this->db = $db;
}
function get_poll($pollId) {
$query = "select * from `tiki_polls` where `pollId`=?";
$result = $this->query($query,array((int)$pollId));
if (!$result->numRows()) return false;
$res = $result->fetchRow();
return $res;
}
function list_poll_options($pollId, $offset, $maxRecords, $sort_mode, $find) {
if ($find) {
$findesc = '%' . $find . '%';
$mid = " where `pollId`=? and (`title` like ?)";
$bindvars=array((int) $pollId,$findesc);
} else {
$mid = " where `pollId`=?";
$bindvars=array((int) $pollId);
}
$query = "select * from `tiki_poll_options` $mid order by ".$this->convert_sortmode($sort_mode);
$query_cant = "select count(*) from `tiki_poll_options` $mid";
$result = $this->query($query,$bindvars,$maxRecords,$offset);
$cant = $this->getOne($query_cant,$bindvars);
$ret = array();
while ($res = $result->fetchRow()) {
$ret[] = $res;
}
$retval = array();
$retval["data"] = $ret;
$retval["cant"] = $cant;
return $retval;
}
function get_random_active_poll() {
$now = date('U');
$pollcount = $this->getOne("select count(*) from `tiki_polls` where `active`=? and `publishDate`<=? ", array('c',(int) $now));
if ($pollcount) {
$bid = rand(0, $pollcount - 1);
$pollId = $this->getOne("select `pollId` from `tiki_polls` where `active`=? and `publishDate`<=? ", array('c',(int) $now),1,$bid);
return $pollId;
} else {
return 0;
}
}
function poll_vote($user, $pollId, $optionId) {
$previous_vote = $this->get_user_vote("poll$pollId",$user);
if (!$previous_vote || $previous_vote == 0) {
$query = "update `tiki_polls` set `votes`=`votes`+1 where `pollId`=?";
$result = $this->query($query,array((int)$pollId));
$query = "update `tiki_poll_options` set `votes`=`votes`+1 where `optionId`=?";
$result = $this->query($query,array((int)$optionId));
} elseif ($previous_vote != $optionId) {
$query = "update `tiki_poll_options` set `votes`=`votes`-1 where `optionId`=?";
$result = $this->query($query,array((int)$previous_vote));
$query = "update `tiki_poll_options` set `votes`=`votes`+1 where `optionId`=?";
$result = $this->query($query,array((int)$optionId));
}
}
}
$polllib = new PollLibShared($dbTiki);
?>
......@@ -59,19 +59,47 @@ class SearchLib extends TikiLib {
function _find($h, $words = '', $offset = 0, $maxRecords = -1, $fulltext = false) {
$words = trim($words);
$sql = sprintf(
$sqlFields = sprintf(
'SELECT %s AS name, LEFT(%s, 240) AS data, %s AS hits, %s AS lastModif, %s AS pageName',
$h['name'], $h['data'], $h['hits'], $h['lastModif'], $h['pageName']);
$id = $h['id'];
$temp_max = count($id);
for ($i = 0; $i < $temp_max; ++$i)
$sql .= ',' . $id[$i] . ' AS id' . ($i + 1);
$sqlFields .= ',' . $id[$i] . ' AS id' . ($i + 1);
if (count($id) < 2)
$sql .= ',1 AS id2';
$sqlFields .= ',1 AS id2';
$sql2 = ' FROM ' . $h['from'] . ' WHERE ';
$sql2 .= (isset($h['filter']))? $h['filter'] : '1';
$sqlFrom = ' FROM ' . $h['from'];
$sqlJoin = '';
$sqlGroup = '';
$sqlHaving = '';
// if we have these three parameters, then only viewable results should show
$wysiwyca = isset($h['permName']) && isset($h['objectType']) && isset($h['objectKey']);
if ($wysiwyca) {
$permName = $h['permName'];
$objType = $h['objectType'];
$objKey = $h['objectKey'];
global $$permName;