Commit 937fe732 authored by lphuberdeau's avatar lphuberdeau

[ENH] Converting trklib

parent 497eeaeb
...@@ -11,7 +11,7 @@ if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) { ...@@ -11,7 +11,7 @@ if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) {
exit; exit;
} }
include_once ('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
if (isset($_REQUEST['trkset'])) { if (isset($_REQUEST['trkset'])) {
check_ticket('admin-inc-trackers'); check_ticket('admin-inc-trackers');
......
...@@ -111,6 +111,7 @@ ...@@ -111,6 +111,7 @@
}, },
"classmap": [ "classmap": [
"vendor_extra/pear/", "vendor_extra/pear/",
"lib/tikidate.php",
"lib/openpgp/", "lib/openpgp/",
"lib/language/", "lib/language/",
"lib/TikiWebdav/", "lib/TikiWebdav/",
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
<service id="tiki.lib.comments" class="Comments"> <service id="tiki.lib.comments" class="Comments">
<file>%kernel.root_dir%/lib/comments/commentslib.php</file> <file>%kernel.root_dir%/lib/comments/commentslib.php</file>
</service> </service>
<service id="tiki.lib.css" class="cssLib">
<file>%kernel.root_dir%/lib/csslib.php</file>
</service>
<service id="tiki.lib.filegal" class="FileGalLib"> <service id="tiki.lib.filegal" class="FileGalLib">
<file>%kernel.root_dir%/lib/filegals/filegallib.php</file> <file>%kernel.root_dir%/lib/filegals/filegallib.php</file>
</service> </service>
...@@ -29,6 +32,10 @@ ...@@ -29,6 +32,10 @@
<service id="tiki.lib.service" class="ServiceLib"> <service id="tiki.lib.service" class="ServiceLib">
<file>%kernel.root_dir%/lib/servicelib.php</file> <file>%kernel.root_dir%/lib/servicelib.php</file>
</service> </service>
<service id="tiki.lib.tikidate" class="TikiDate"/>
<service id="tiki.lib.trk" class="TrackerLib">
<file>%kernel.root_dir%/lib/trackers/trackerlib.php</file>
</service>
<service id="tiki.lib.user" class="UsersLib"> <service id="tiki.lib.user" class="UsersLib">
<file>%kernel.root_dir%/lib/userslib.php</file> <file>%kernel.root_dir%/lib/userslib.php</file>
</service> </service>
......
...@@ -941,8 +941,7 @@ if ( ...@@ -941,8 +941,7 @@ if (
require_once 'lib/tikilib.php'; require_once 'lib/tikilib.php';
$tikilib = new TikiLib; $tikilib = new TikiLib;
$userlib = TikiLib::lib('user'); $userlib = TikiLib::lib('user');
require_once 'lib/tikidate.php'; $tikidate = TikiLib::lib('tikidate');
$tikidate = new TikiDate();
} }
if (isset($_POST['update'])) { if (isset($_POST['update'])) {
......
...@@ -80,7 +80,7 @@ class CategLib extends ObjectLib ...@@ -80,7 +80,7 @@ class CategLib extends ObjectLib
return $this->getOne("select `name` from `tiki_trackers` where `trackerId`=?", array((int) $trackerId)); return $this->getOne("select `name` from `tiki_trackers` where `trackerId`=?", array((int) $trackerId));
} }
if (preg_match('/^Tracker Item ([0-9]+)$/', $res['name'])) { if (preg_match('/^Tracker Item ([0-9]+)$/', $res['name'])) {
global $trklib;require_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$itemId=preg_replace('/^Tracker Item ([0-9]+)$/', "$1", $res['name']); $itemId=preg_replace('/^Tracker Item ([0-9]+)$/', "$1", $res['name']);
return $trklib->get_isMain_value(-1, $itemId); return $trklib->get_isMain_value(-1, $itemId);
} }
...@@ -523,7 +523,7 @@ class CategLib extends ObjectLib ...@@ -523,7 +523,7 @@ class CategLib extends ObjectLib
foreach ( $result as $res ) { foreach ( $result as $res ) {
if (!in_array($res['catObjectId'].'-'.$res['categId'], $objs)) { // same object and same category if (!in_array($res['catObjectId'].'-'.$res['categId'], $objs)) { // same object and same category
if (preg_match('/trackeritem/', $res['type'])&&$res['description']=='') { if (preg_match('/trackeritem/', $res['type'])&&$res['description']=='') {
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$trackerId=preg_replace('/^.*trackerId=([0-9]+).*$/', '$1', $res['href']); $trackerId=preg_replace('/^.*trackerId=([0-9]+).*$/', '$1', $res['href']);
$res['name']=$trklib->get_isMain_value($trackerId, $res['itemId']); $res['name']=$trklib->get_isMain_value($trackerId, $res['itemId']);
$filed=$trklib->get_field_id($trackerId, "description"); $filed=$trklib->get_field_id($trackerId, "description");
......
...@@ -76,9 +76,7 @@ class Tiki_Profile_InstallHandler_TrackerItem extends Tiki_Profile_InstallHandle ...@@ -76,9 +76,7 @@ class Tiki_Profile_InstallHandler_TrackerItem extends Tiki_Profile_InstallHandle
$data = array_merge($this->getDefaultValues(), $data); $data = array_merge($this->getDefaultValues(), $data);
global $trklib; $trklib = TikiLib::lib('trk');
if ( ! $trklib )
require_once 'lib/trackers/trackerlib.php';
$fields = $trklib->list_tracker_fields($data['tracker']); $fields = $trklib->list_tracker_fields($data['tracker']);
$providedfields = array(); $providedfields = array();
......
...@@ -278,7 +278,7 @@ class Tracker_Definition ...@@ -278,7 +278,7 @@ class Tracker_Definition
*/ */
function getItemUser($itemId) function getItemUser($itemId)
{ {
global $trklib; $trklib = TikiLib::lib('trk');
return $trklib->get_item_creator($this->trackerInfo['trackerId'], $itemId); return $trklib->get_item_creator($this->trackerInfo['trackerId'], $itemId);
} }
......
...@@ -761,7 +761,8 @@ class Tracker_Query ...@@ -761,7 +761,8 @@ class Tracker_Query
*/ */
function query() function query()
{ {
global $tikilib, $trklib; $trklib = TikiLib::lib('trk');
$tikilib = TikiLib::lib('tiki');
$params = array(); $params = array();
$fields_safe = ""; $fields_safe = "";
$status_safe = ""; $status_safe = "";
...@@ -1021,7 +1022,7 @@ class Tracker_Query ...@@ -1021,7 +1022,7 @@ class Tracker_Query
*/ */
private function render_field_value($fieldDefinition, $value) private function render_field_value($fieldDefinition, $value)
{ {
global $trklib; $trklib = TikiLib::lib('trk');
$fieldDefinition['value'] = $value; $fieldDefinition['value'] = $value;
//if type is text, no need to render value //if type is text, no need to render value
...@@ -1294,7 +1295,7 @@ class Tracker_Query ...@@ -1294,7 +1295,7 @@ class Tracker_Query
*/ */
public function delete($bulkMode = false) public function delete($bulkMode = false)
{ {
global $trklib; $trklib = TikiLib::lib('trk');
if ($this->canDelete()) { if ($this->canDelete()) {
$results = $this->query(); $results = $this->query();
......
...@@ -199,4 +199,3 @@ class cssLib extends TikiLib ...@@ -199,4 +199,3 @@ class cssLib extends TikiLib
return $version; return $version;
} }
} }
$csslib = new cssLib;
...@@ -170,10 +170,8 @@ class GeoLib ...@@ -170,10 +170,8 @@ class GeoLib
*/ */
function setTrackerGeo($itemId, $geo) function setTrackerGeo($itemId, $geo)
{ {
global $prefs, $trklib; global $prefs;
if (!is_object($trklib)) { $trklib = TikiLib::lib('trk');
include_once('lib/trackers/trackerlib.php');
}
$item = $trklib->get_tracker_item($itemId); $item = $trklib->get_tracker_item($itemId);
$fields = $trklib->list_tracker_fields($item['trackerId']); $fields = $trklib->list_tracker_fields($item['trackerId']);
foreach ($fields["data"] as $f) { foreach ($fields["data"] as $f) {
......
...@@ -141,7 +141,7 @@ class ObjectLib extends TikiLib ...@@ -141,7 +141,7 @@ class ObjectLib extends TikiLib
break; break;
case 'tracker': case 'tracker':
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$info = $trklib->get_tracker($itemId); $info = $trklib->get_tracker($itemId);
$description = $info['description']; $description = $info['description'];
...@@ -150,7 +150,7 @@ class ObjectLib extends TikiLib ...@@ -150,7 +150,7 @@ class ObjectLib extends TikiLib
break; break;
case 'trackeritem': case 'trackeritem':
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$info = $trklib->get_tracker_item($itemId); $info = $trklib->get_tracker_item($itemId);
$description = ''; $description = '';
......
...@@ -2086,7 +2086,7 @@ if ( \$('#$id') ) { ...@@ -2086,7 +2086,7 @@ if ( \$('#$id') ) {
break; break;
} }
case 'lastItemVersion': case 'lastItemVersion':
global $trklib; include_once ('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$auto_query_args = array('itemId'); $auto_query_args = array('itemId');
if (!empty($_REQUEST['itemId'])) { if (!empty($_REQUEST['itemId'])) {
$item_info = $trklib->get_item_info($_REQUEST['itemId']); $item_info = $trklib->get_item_info($_REQUEST['itemId']);
...@@ -2113,7 +2113,7 @@ if ( \$('#$id') ) { ...@@ -2113,7 +2113,7 @@ if ( \$('#$id') ) {
break; break;
} }
case 'lastItemAuthor': case 'lastItemAuthor':
global $trklib; include_once ('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$auto_query_args = array('itemId'); $auto_query_args = array('itemId');
if (!empty($_REQUEST['itemId'])) { if (!empty($_REQUEST['itemId'])) {
$item_info = $trklib->get_item_info($_REQUEST['itemId']); $item_info = $trklib->get_item_info($_REQUEST['itemId']);
...@@ -2140,7 +2140,7 @@ if ( \$('#$id') ) { ...@@ -2140,7 +2140,7 @@ if ( \$('#$id') ) {
break; break;
} }
case 'lastItemModif': case 'lastItemModif':
global $trklib; include_once ('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$auto_query_args = array('itemId'); $auto_query_args = array('itemId');
if (!empty($_REQUEST['itemId'])) { if (!empty($_REQUEST['itemId'])) {
$item_info = $trklib->get_item_info($_REQUEST['itemId']); $item_info = $trklib->get_item_info($_REQUEST['itemId']);
......
...@@ -14,8 +14,7 @@ function payment_behavior_cart_exchange_product( $exchangeorderitemid = 0, $exch ...@@ -14,8 +14,7 @@ function payment_behavior_cart_exchange_product( $exchangeorderitemid = 0, $exch
return false; return false;
} }
global $trklib; $trklib = TikiLib::lib('trk');
include_once ('lib/trackers/trackerlib.php');
$orderitemsTrackerId = $prefs['payment_cart_orderitems_tracker']; $orderitemsTrackerId = $prefs['payment_cart_orderitems_tracker'];
......
...@@ -13,7 +13,7 @@ function payment_behavior_cart_gift_certificate_purchase( ...@@ -13,7 +13,7 @@ function payment_behavior_cart_gift_certificate_purchase(
$orderItemId = 0 $orderItemId = 0
) )
{ {
global $trklib; require_once("lib/trackers/trackerlib.php"); $trklib = TikiLib::lib('trk');
global $prefs; global $prefs;
$params['trackerId'] = $prefs['payment_cart_giftcert_tracker']; $params['trackerId'] = $prefs['payment_cart_giftcert_tracker'];
......
...@@ -502,8 +502,8 @@ class CartLib ...@@ -502,8 +502,8 @@ class CartLib
function has_gift_certificate() function has_gift_certificate()
{ {
global $trklib, $prefs; global $prefs;
require_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
return ($trklib->get_tracker_by_name($prefs['payment_cart_giftcert_tracker_name']) ? true : false ); return ($trklib->get_tracker_by_name($prefs['payment_cart_giftcert_tracker_name']) ? true : false );
} }
...@@ -1103,8 +1103,7 @@ class CartLib ...@@ -1103,8 +1103,7 @@ class CartLib
global $prefs; global $prefs;
$productTrackerId = $prefs['payment_cart_product_tracker']; $productTrackerId = $prefs['payment_cart_product_tracker'];
$inventoryTypeFieldId = $prefs['payment_cart_inventory_type_field']; $inventoryTypeFieldId = $prefs['payment_cart_inventory_type_field'];
global $trklib; $trklib = TikiLib::lib('trk');
require_once('lib/trackers/trackerlib.php');
return $trklib->get_item_value($productTrackerId, $productId, $inventoryTypeFieldId); return $trklib->get_item_value($productTrackerId, $productId, $inventoryTypeFieldId);
} }
...@@ -1128,8 +1127,7 @@ class CartLib ...@@ -1128,8 +1127,7 @@ class CartLib
} else { } else {
$inventoryFieldId = $inventoryTotalFieldId; $inventoryFieldId = $inventoryTotalFieldId;
} }
global $trklib; $trklib = TikiLib::lib('trk');
require_once('lib/trackers/trackerlib.php');
return $trklib->get_item_value($productTrackerId, $productId, $inventoryFieldId); return $trklib->get_item_value($productTrackerId, $productId, $inventoryFieldId);
} }
...@@ -1216,8 +1214,7 @@ class CartLib ...@@ -1216,8 +1214,7 @@ class CartLib
private function modify_tracker_item( $trackerId, $itemId, $trackerFields ) private function modify_tracker_item( $trackerId, $itemId, $trackerFields )
{ {
global $trklib; $trklib = TikiLib::lib('trk');
require_once('lib/trackers/trackerlib.php');
$tracker_fields_info = $trklib->list_tracker_fields($trackerId); $tracker_fields_info = $trklib->list_tracker_fields($trackerId);
$fieldTypes = array(); $fieldTypes = array();
foreach ($tracker_fields_info['data'] as $t) { foreach ($tracker_fields_info['data'] as $t) {
...@@ -1319,8 +1316,7 @@ class CartLib ...@@ -1319,8 +1316,7 @@ class CartLib
function get_missing_user_information_fields( $product_class_id, $type = 'required' ) function get_missing_user_information_fields( $product_class_id, $type = 'required' )
{ {
global $user, $prefs; global $user, $prefs;
global $trklib; $trklib = TikiLib::lib('trk');
require_once('lib/trackers/trackerlib.php');
if ($type == 'required') { if ($type == 'required') {
$fields_str = $this->get_tracker_value_custom($prefs['payment_cart_productclasses_tracker_name'], 'Required Field IDs', $product_class_id); $fields_str = $this->get_tracker_value_custom($prefs['payment_cart_productclasses_tracker_name'], 'Required Field IDs', $product_class_id);
} else if ($type == 'postpurchase') { } else if ($type == 'postpurchase') {
......
...@@ -839,7 +839,7 @@ class SearchLib extends TikiLib ...@@ -839,7 +839,7 @@ class SearchLib extends TikiLib
*/ */
function find_trackers($words = '', $offset = 0, $maxRecords = -1, $fulltext = false, $filter='', $boolean='n', $searchDate = 0, $categId = 0) function find_trackers($words = '', $offset = 0, $maxRecords = -1, $fulltext = false, $filter='', $boolean='n', $searchDate = 0, $categId = 0)
{ {
global $trklib; require_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
global $tiki_p_view_trackers_pending; global $tiki_p_view_trackers_closed; global $tiki_p_view_trackers_pending; global $tiki_p_view_trackers_closed;
static $search_trackers = array( static $search_trackers = array(
......
...@@ -65,15 +65,6 @@ class TikiLib extends TikiDb_Bridge ...@@ -65,15 +65,6 @@ class TikiLib extends TikiDb_Bridge
case 'tiki': case 'tiki':
global $tikilib; global $tikilib;
return self::$libraries[$name] = $tikilib; return self::$libraries[$name] = $tikilib;
case 'tikidate':
require_once('lib/tikidate.php');
return self::$libraries[$name] = new TikiDate;
case 'css':
global $csslib; include_once("lib/csslib.php");
return self::$libraries[$name] = $csslib;
case 'trk':
global $trklib; require_once('lib/trackers/trackerlib.php');
return self::$libraries[$name] = $trklib;
case 'wiki': case 'wiki':
global $wikilib; include_once('lib/wiki/wikilib.php'); global $wikilib; include_once('lib/wiki/wikilib.php');
return self::$libraries[$name] = $wikilib; return self::$libraries[$name] = $wikilib;
......
...@@ -239,7 +239,7 @@ class TodoLib ...@@ -239,7 +239,7 @@ class TodoLib
function listObjectsTodo_tracker($todo, $except=null) function listObjectsTodo_tracker($todo, $except=null)
{ {
global $tikilib; global $tikilib;
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
switch ($todo['event']) { switch ($todo['event']) {
case 'creation': case 'creation':
...@@ -287,7 +287,7 @@ class TodoLib ...@@ -287,7 +287,7 @@ class TodoLib
*/ */
function applyTodo_tracker($todo, $objects) function applyTodo_tracker($todo, $objects)
{ {
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$trklib->change_status($objects, $todo['to']['status']); $trklib->change_status($objects, $todo['to']['status']);
} }
...@@ -298,7 +298,7 @@ class TodoLib ...@@ -298,7 +298,7 @@ class TodoLib
function notifyTodo_tracker($todo, $objects) function notifyTodo_tracker($todo, $objects)
{ {
global $smarty, $tikilib, $prefs; global $smarty, $tikilib, $prefs;
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
foreach ($objects as $object) { foreach ($objects as $object) {
// get the creator // get the creator
$u = $object['field_values'][0]['value']; $u = $object['field_values'][0]['value'];
......
...@@ -4965,5 +4965,3 @@ class TrackerLib extends TikiLib ...@@ -4965,5 +4965,3 @@ class TrackerLib extends TikiLib
} }
} }
global $trklib;
$trklib = new TrackerLib;
...@@ -6718,7 +6718,7 @@ class UsersLib extends TikiLib ...@@ -6718,7 +6718,7 @@ class UsersLib extends TikiLib
if (!empty($chosenGroup)) { if (!empty($chosenGroup)) {
$smarty->assign_by_ref('chosenGroup', $chosenGroup); $smarty->assign_by_ref('chosenGroup', $chosenGroup);
if ($prefs['userTracker'] == 'y') { if ($prefs['userTracker'] == 'y') {
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$re = $this->get_group_info(isset($chosenGroup)? $chosenGroup: 'Registered'); $re = $this->get_group_info(isset($chosenGroup)? $chosenGroup: 'Registered');
$fields = $trklib->list_tracker_fields( $fields = $trklib->list_tracker_fields(
$re['usersTrackerId'], $re['usersTrackerId'],
......
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
function validator_distinct($input, $parameter = '', $message = '') function validator_distinct($input, $parameter = '', $message = '')
{ {
global $trklib; $trklib = TikiLib::lib('trk');
include_once 'lib/trackers/trackerlib.php';
parse_str($parameter, $arr); parse_str($parameter, $arr);
if (count($arr) < 2 || !isset($arr['trackerId']) || !isset($arr['fieldId'])) { if (count($arr) < 2 || !isset($arr['trackerId']) || !isset($arr['fieldId'])) {
......
...@@ -39,7 +39,7 @@ class watershedLib ...@@ -39,7 +39,7 @@ class watershedLib
function getAllViewableChannels( $channelName = '', $brandId = '') function getAllViewableChannels( $channelName = '', $brandId = '')
{ {
global $prefs; global $prefs;
global $trklib; include_once ('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$channels = array(); $channels = array();
if ($channelName && $brandId) { if ($channelName && $brandId) {
...@@ -88,7 +88,7 @@ class watershedLib ...@@ -88,7 +88,7 @@ class watershedLib
function filterChannels( $channels, $mode = 'viewer' ) function filterChannels( $channels, $mode = 'viewer' )
{ {
global $prefs, $tikilib; global $prefs, $tikilib;
global $trklib; include_once ('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$tracker_info = $trklib->get_tracker($prefs['watershed_channel_trackerId']); $tracker_info = $trklib->get_tracker($prefs['watershed_channel_trackerId']);
if ($t = $trklib->get_tracker_options($prefs['watershed_channel_trackerId'])) { if ($t = $trklib->get_tracker_options($prefs['watershed_channel_trackerId'])) {
...@@ -121,7 +121,7 @@ class watershedLib ...@@ -121,7 +121,7 @@ class watershedLib
function checkArchiveViewable( $videoId, $channels ) function checkArchiveViewable( $videoId, $channels )
{ {
global $prefs, $tikilib; global $prefs, $tikilib;
global $trklib; include_once ('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$archive = $trklib->get_item($prefs['watershed_archive_trackerId'], $prefs['watershed_archive_fieldId'], $videoId); $archive = $trklib->get_item($prefs['watershed_archive_trackerId'], $prefs['watershed_archive_fieldId'], $videoId);
$archiveChannelCode = $archive[$prefs['watershed_archive_channel_fieldId']]; $archiveChannelCode = $archive[$prefs['watershed_archive_channel_fieldId']];
...@@ -156,7 +156,7 @@ class watershedLib ...@@ -156,7 +156,7 @@ class watershedLib
function storeArchive( $recording ) function storeArchive( $recording )
{ {
global $prefs; global $prefs;
global $trklib; include_once ('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$fields = array(); $fields = array();
if (empty($prefs['watershed_archive_trackerId'])) { if (empty($prefs['watershed_archive_trackerId'])) {
return false; return false;
......
...@@ -146,7 +146,7 @@ function wikiplugin_attach($data, $params) ...@@ -146,7 +146,7 @@ function wikiplugin_attach($data, $params)
// See if we're being called from a tracker page. // See if we're being called from a tracker page.
if ( $section == 'trackers' ) { if ( $section == 'trackers' ) {
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$atts_item_name = $_REQUEST["itemId"]; $atts_item_name = $_REQUEST["itemId"];
$tracker_info = $trklib->get_tracker($atts_item_name); $tracker_info = $trklib->get_tracker($atts_item_name);
$tracker_info = array_merge($tracker_info, $trklib->get_tracker_options($atts_item_name)); $tracker_info = array_merge($tracker_info, $trklib->get_tracker_options($atts_item_name));
......
...@@ -80,7 +80,7 @@ function wikiplugin_hasticket( $data, $params ) ...@@ -80,7 +80,7 @@ function wikiplugin_hasticket( $data, $params )
$data = substr($data, 0, strpos($data, '{ELSE}')); $data = substr($data, 0, strpos($data, '{ELSE}'));
} }
// check code // check code
global $trklib; require_once("lib/trackers/trackerlib.php"); $trklib = TikiLib::lib('trk');
$correctcode = $trklib->get_item_value($params['trackerId'], $params['itemId'], $params['fieldId']); $correctcode = $trklib->get_item_value($params['trackerId'], $params['itemId'], $params['fieldId']);
if ($_SESSION['wikiplugin_trackerpasscode'][$key] == $correctcode) { if ($_SESSION['wikiplugin_trackerpasscode'][$key] == $correctcode) {
return $data; return $data;
......
...@@ -38,7 +38,7 @@ function shuf(&$ar) ...@@ -38,7 +38,7 @@ function shuf(&$ar)
function wikiplugin_miniquiz($data, $params) function wikiplugin_miniquiz($data, $params)
{ {
global $tikilib, $user, $group, $prefs, $smarty; global $tikilib, $user, $group, $prefs, $smarty;
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
extract($params, EXTR_SKIP); extract($params, EXTR_SKIP);
if ($prefs['feature_trackers'] != 'y' || !isset($trackerId) || !($tracker = $trklib->get_tracker($trackerId))) { if ($prefs['feature_trackers'] != 'y' || !isset($trackerId) || !($tracker = $trklib->get_tracker($trackerId))) {
......
...@@ -47,7 +47,7 @@ function wikiplugin_trackercomments_info() ...@@ -47,7 +47,7 @@ function wikiplugin_trackercomments_info()
} }
function wikiplugin_trackercomments($data, $params) function wikiplugin_trackercomments($data, $params)
{ {
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
global $user; global $user;
extract($params, EXTR_SKIP); extract($params, EXTR_SKIP);
$ret = ''; $ret = '';
......
...@@ -145,8 +145,9 @@ function wikiplugin_trackerfilter_info() ...@@ -145,8 +145,9 @@ function wikiplugin_trackerfilter_info()
function wikiplugin_trackerfilter($data, $params) function wikiplugin_trackerfilter($data, $params)
{ {
global $smarty, $prefs; global $prefs;
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$smarty = TikiLib::lib('smarty');
static $iTrackerFilter = 0; static $iTrackerFilter = 0;
if ($prefs['feature_trackers'] != 'y') { if ($prefs['feature_trackers'] != 'y') {
return $smarty->fetch("wiki-plugins/error_tracker.tpl"); return $smarty->fetch("wiki-plugins/error_tracker.tpl");
...@@ -376,7 +377,7 @@ function wikiplugin_trackerfilter($data, $params) ...@@ -376,7 +377,7 @@ function wikiplugin_trackerfilter($data, $params)
function wikiplugin_trackerfilter_build_trackerlist_filter($input, $formats, &$ffs, &$values, &$exactValues, Tracker_Definition $tracker_definition) function wikiplugin_trackerfilter_build_trackerlist_filter($input, $formats, &$ffs, &$values, &$exactValues, Tracker_Definition $tracker_definition)
{ {
global $trklib; $trklib = TikiLib::lib('trk');
foreach ($input as $key =>$val) { foreach ($input as $key =>$val) {
if (substr($key, 0, 2) == 'f_' && !empty($val) && (!is_array($val) || !empty($val[0]))) { if (substr($key, 0, 2) == 'f_' && !empty($val) && (!is_array($val) || !empty($val[0]))) {
...@@ -495,8 +496,10 @@ function wikiplugin_trackerFilter_split_filters($filters) ...@@ -495,8 +496,10 @@ function wikiplugin_trackerFilter_split_filters($filters)
function wikiplugin_trackerFilter_get_filters($trackerId=0, $listfields='', &$formats, $status='opc') function wikiplugin_trackerFilter_get_filters($trackerId=0, $listfields='', &$formats, $status='opc')
{ {
global $tiki_p_admin_trackers, $smarty, $tikilib; global $tiki_p_admin_trackers;
global $trklib; include_once('lib/trackers/trackerlib.php'); $trklib = TikiLib::lib('trk');
$tikilib = TikiLib::lib('tiki');
$smarty = TikiLib::lib('smarty');
$filters = array(); $filters = array();
if (empty($trackerId) && !empty($listfields[0])) { if (empty($trackerId) && !empty($listfields[0])) {
$field = $trklib->get_tracker_field($listfields[0]); $field = $trklib->get_tracker_field($listfields[0]);
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
// $Id$ // $Id$
require_once('lib/ldap/filter.php'); require_once('lib/ldap/filter.php');
require_once('lib/trackers/trackerlib.php');
function wikiplugin_trackerif_info() function wikiplugin_trackerif_info()
{ {
...@@ -35,7 +34,7 @@ function wikiplugin_trackerif_info() ...@@ -35,7 +34,7 @@ function wikiplugin_trackerif_info()
function wikiplugin_trackerif ($data, $params) function wikiplugin_trackerif ($data, $params)
{ {
global $trklib; $trklib = TikiLib::lib('trk');
$test = null; $test = null;
$values = array(); $values = array();
$dataelse = ''; $dataelse = '';
......
...@@ -90,8 +90,8 @@ function wikiplugin_trackeritemcopy_info() ...@@ -90,8 +90,8 @@ function wikiplugin_trackeritemcopy_info()
function wikiplugin_trackeritemcopy( $data, $params ) function wikiplugin_trackeritemcopy( $data, $params )
{ {
global $smarty;
$trklib = TikiLib::lib("trk"); $trklib = TikiLib::lib("trk");