Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
c44c8816
Commit
c44c8816
authored
12 years ago
by
Giovannoni Laurent
Browse files
Options
Downloads
Patches
Plain Diff
fix: pb with oracle
parent
9abbcc8e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notes/trunk/class/class_modules_tools.php
+101
-100
101 additions, 100 deletions
notes/trunk/class/class_modules_tools.php
with
101 additions
and
100 deletions
notes/trunk/class/class_modules_tools.php
+
101
−
100
View file @
c44c8816
...
@@ -28,7 +28,7 @@ try {
...
@@ -28,7 +28,7 @@ try {
class
notes
extends
dbquery
class
notes
extends
dbquery
{
{
/**
/**
* Dbquery object used to connnect to the database
* Dbquery object used to connnect to the database
*/
*/
private
static
$db
;
private
static
$db
;
...
@@ -75,81 +75,81 @@ class notes extends dbquery
...
@@ -75,81 +75,81 @@ class notes extends dbquery
self
::
$db
->
disconnect
();
self
::
$db
->
disconnect
();
}
}
/**
/**
* Build Maarch module tables into sessions vars with a xml configuration
* Build Maarch module tables into sessions vars with a xml configuration
* file
* file
*/
*/
public
function
build_modules_tables
()
public
function
build_modules_tables
()
{
{
if
(
file_exists
(
if
(
file_exists
(
$_SESSION
[
'config'
][
'corepath'
]
.
'custom'
.
DIRECTORY_SEPARATOR
$_SESSION
[
'config'
][
'corepath'
]
.
'custom'
.
DIRECTORY_SEPARATOR
.
$_SESSION
[
'custom_override_id'
]
.
DIRECTORY_SEPARATOR
.
"modules"
.
$_SESSION
[
'custom_override_id'
]
.
DIRECTORY_SEPARATOR
.
"modules"
.
DIRECTORY_SEPARATOR
.
"notes"
.
DIRECTORY_SEPARATOR
.
"xml"
.
DIRECTORY_SEPARATOR
.
"notes"
.
DIRECTORY_SEPARATOR
.
"xml"
.
DIRECTORY_SEPARATOR
.
"config.xml"
.
DIRECTORY_SEPARATOR
.
"config.xml"
)
)
)
{
)
{
$path
=
$_SESSION
[
'config'
][
'corepath'
]
.
'custom'
$path
=
$_SESSION
[
'config'
][
'corepath'
]
.
'custom'
.
DIRECTORY_SEPARATOR
.
$_SESSION
[
'custom_override_id'
]
.
DIRECTORY_SEPARATOR
.
$_SESSION
[
'custom_override_id'
]
.
DIRECTORY_SEPARATOR
.
"modules"
.
DIRECTORY_SEPARATOR
.
DIRECTORY_SEPARATOR
.
"modules"
.
DIRECTORY_SEPARATOR
.
"notes"
.
DIRECTORY_SEPARATOR
.
"xml"
.
DIRECTORY_SEPARATOR
.
"notes"
.
DIRECTORY_SEPARATOR
.
"xml"
.
DIRECTORY_SEPARATOR
.
"config.xml"
;
.
"config.xml"
;
}
else
{
}
else
{
$path
=
"modules"
.
DIRECTORY_SEPARATOR
.
"notes"
$path
=
"modules"
.
DIRECTORY_SEPARATOR
.
"notes"
.
DIRECTORY_SEPARATOR
.
"xml"
.
DIRECTORY_SEPARATOR
.
DIRECTORY_SEPARATOR
.
"xml"
.
DIRECTORY_SEPARATOR
.
"config.xml"
;
.
"config.xml"
;
}
}
$xmlconfig
=
simplexml_load_file
(
$path
);
$xmlconfig
=
simplexml_load_file
(
$path
);
foreach
(
$xmlconfig
->
TABLENAME
as
$tableName
)
{
foreach
(
$xmlconfig
->
TABLENAME
as
$tableName
)
{
$_SESSION
[
'tablename'
][
'not_notes'
]
=
(
string
)
$tableName
->
not_notes
;
$_SESSION
[
'tablename'
][
'not_notes'
]
=
(
string
)
$tableName
->
not_notes
;
$_SESSION
[
'tablename'
][
'note_entities'
]
=
(
string
)
$tableName
->
note_entities
;
$_SESSION
[
'tablename'
][
'note_entities'
]
=
(
string
)
$tableName
->
note_entities
;
}
}
$hist
=
$xmlconfig
->
HISTORY
;
$hist
=
$xmlconfig
->
HISTORY
;
$_SESSION
[
'history'
][
'noteadd'
]
=
(
string
)
$hist
->
noteadd
;
$_SESSION
[
'history'
][
'noteadd'
]
=
(
string
)
$hist
->
noteadd
;
$_SESSION
[
'history'
][
'noteup'
]
=
(
string
)
$hist
->
noteup
;
$_SESSION
[
'history'
][
'noteup'
]
=
(
string
)
$hist
->
noteup
;
$_SESSION
[
'history'
][
'notedel'
]
=
(
string
)
$hist
->
notedel
;
$_SESSION
[
'history'
][
'notedel'
]
=
(
string
)
$hist
->
notedel
;
}
}
/**
/**
* Function to get all the entities
* Function to get all the entities
*
*
*/
*/
/*
/*
public function getentities()
public function getentities()
{
{
$entitiesOrg = array();
$entitiesOrg = array();
require_once 'modules/entities/class/EntityControler.php';
require_once 'modules/entities/class/EntityControler.php';
$entityControler = new EntityControler();
$entityControler = new EntityControler();
$entitiesOrg = $entityControler->getAllEntities();
$entitiesOrg = $entityControler->getAllEntities();
return $entitiesOrg;
return $entitiesOrg;
}
}
*/
*/
/**
/**
*
*
*
*
*
*
*/
*/
public
function
insertEntities
(
$id
)
public
function
insertEntities
(
$id
)
{
{
//echo "RES_ID : ".$id;
//echo "RES_ID : ".$id;
}
}
/**
/**
* Function to get which user can see a note
* Function to get which user can see a note
* @id note identifier
* @id note identifier
*/
*/
public
function
getNotesEntities
(
$id
)
public
function
getNotesEntities
(
$id
)
{
{
self
::
connect
();
self
::
connect
();
$ent
=
new
EntityControler
();
$ent
=
new
EntityControler
();
$query
=
"select entity_id, entity_label from "
.
self
::
$notes_entities_table
.
" , "
.
self
::
$entities_table
$query
=
"select entity_id, entity_label from "
.
self
::
$notes_entities_table
.
" , "
.
self
::
$entities_table
.
" WHERE item_id LIKE entity_id and note_id = "
.
$id
;
.
" WHERE item_id LIKE entity_id and note_id = "
.
$id
;
try
{
try
{
if
(
$_ENV
[
'DEBUG'
])
if
(
$_ENV
[
'DEBUG'
])
echo
$query
.
' // '
;
echo
$query
.
' // '
;
self
::
$db
->
query
(
$query
);
self
::
$db
->
query
(
$query
);
...
@@ -163,34 +163,35 @@ class notes extends dbquery
...
@@ -163,34 +163,35 @@ class notes extends dbquery
while
(
$res
=
self
::
$db
->
fetch_object
())
while
(
$res
=
self
::
$db
->
fetch_object
())
{
{
array_push
(
$entitiesChosen
,
$ent
->
get
(
$res
->
entity_id
));
array_push
(
$entitiesChosen
,
$ent
->
get
(
$res
->
entity_id
));
}
}
//self::disconnect();
//self::disconnect();
return
$entitiesChosen
;
return
$entitiesChosen
;
}
}
public
function
getUserNotes
(
$noteId
,
$userId
,
$userPrimaryEntity
)
public
function
getUserNotes
(
$noteId
,
$userId
,
$userPrimaryEntity
)
{
{
$query
=
"select id from notes where id in ("
$query
=
"select id from notes where id in ("
.
"select note_id from note_entities where (item_id = '"
.
"select note_id from note_entities where (item_id = '"
.
$userPrimaryEntity
.
"' and note_id = "
.
$noteId
.
"))"
.
$userPrimaryEntity
.
"' and note_id = "
.
$noteId
.
"))"
.
"or (id = "
.
$noteId
.
" and user_id = '"
.
$userId
.
"')"
;
.
"or (id = "
.
$noteId
.
" and user_id = '"
.
$userId
.
"')"
;
$this
->
connect
();
$db
=
new
dbquery
();
$this
->
query
(
$query
);
$db
->
connect
();
//$this->show();
$db
->
query
(
$query
);
if
(
$this
->
nb_result
()
>
0
)
{
//$db->show();exit;
return
true
;
if
(
$db
->
nb_result
()
>
0
)
{
}
else
{
return
true
;
// test if public
}
else
{
$query
=
"select note_id from note_entities where note_id = "
.
$noteId
;
// test if public
$this
->
query
(
$query
);
$query
=
"select note_id from note_entities where note_id = "
.
$noteId
;
if
(
$this
->
nb_result
()
==
0
)
{
$db
->
query
(
$query
);
return
true
;
if
(
$db
->
nb_result
()
==
0
)
{
}
else
{
return
true
;
return
false
;
}
else
{
}
return
false
;
}
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment