$indices = array($objid, 'classid', 'title', 'workspaceid', 'updated', 'permissions'); /* * standard doc information: additional indices, no special source table * where and orderby clauses from above, no limit (all), want only array, not * actual objects, and set the workspaceid based on full index or not (above). */ $objects =& $foowd->getObjList($indices, NULL, $where, $orderby, NULL, FALSE, $currentWorkspace); $list_objects = array(); $i = 0; if (count($objects) > 0) { foreach ($objects as $object) { if (!empty($object['permissions'])) { $object['permissions'] = unserialize($object['permissions']); } // If viewer does not have permission to view this kind of object, skip it if (!$foowd->hasPermission(getClassName($object['classid']), 'view', 'OBJECT', $object['permissions'])) { continue; } $list_objects[$i] = $object; $uri_arr['objectid'] = $object['objectid']; $uri_arr['classid'] = $object['classid']; $list_objects[$i]['url'] = getURI($uri_arr); if ($object['workspaceid'] != 0) { $list_objects[$i]['langid'] = smdoc_translation::getLink($foowd, $object['workspaceid']); } else { $list_objects[$i]['langid'] = ' '; } $list_objects[$i]['updated'] = date(DATETIME_FORMAT, strtotime($object['updated'])); $list_objects[$i]['desc'] = getClassDescription($object['classid']); $i++; }
/** * Call a class method. * * @static * @param smdoc $foowd Reference to the foowd environment object. * @param string $className Name of the class to call the method upon. * @param string $methodName Name of the method to call. * @return bool Success or failure */ function classMethod(&$foowd, $className, $methodName = NULL) { $foowd->track('foowd_object->classMethod', $className, $methodName); // make sure method exists $classMethods = get_class_methods($className); $classMethodName = 'class_' . $methodName; if ($methodName == NULL || !in_array($classMethodName, $classMethods)) { $_SESSION['error'] = INVALID_METHOD; $foowd->loc_forward(getURI(NULL, FALSE)); exit; } $permission = $foowd->hasPermission($className, $methodName, 'class'); if (!$permission) { $_SESSION['error'] = USER_NO_PERMISSION; $foowd->loc_forward(getURI(NULL, FALSE)); exit; } $foowd->template->assign('className', $className); $foowd->template->assign('method', $methodName); call_user_func(array($className, $classMethodName), &$foowd, $className); // call method $foowd->track(); return TRUE; }
* </pre> * * @package smdoc * @subpackage extern */ /** * Initial configuration, start session * @see config.default.php */ require 'smdoc_init.php'; /* * Initialize smdoc/FOOWD environment */ $foowd = new smdoc($smdoc_parameters); $class_list = array(); $classes = getFoowdClassNames(); foreach ($classes as $classid => $className) { if ($foowd->hasPermission($className, 'create', 'class') && strpos($className, 'user') === false) { $class_list[$className] = getClassDescription($classid); } } $foowd->template->assign('title', _("Create New Resource")); $foowd->template->assign('method', ''); $foowd->template->assign_by_ref('classlist', $class_list); $foowd->template->assign('body_template', 'smdoc_external.create.tpl'); $foowd->template->display(); /* * destroy Foowd - triggers cleanup of database object and * display of debug information. */ $foowd->__destruct();
* Initial configuration, start session * @see config.default.php */ require 'smdoc_init.php'; /* * Initialize smdoc/FOOWD environment */ $foowd = new smdoc($smdoc_parameters); $loc_url = getURI(); /* * Links for classes user has permission to create instance of.. * Special */ $classes = getFoowdClassNames(); foreach ($classes as $classid => $className) { if (strpos($className, 'user') === false && $foowd->hasPermission($className, 'create', 'CLASS')) { $create_list[$className] = getClassDescription($classid); } } $foowd->template->assign_by_ref('create_list', $create_list); /* * Admin links */ $admin_link = array(); if ($foowd->hasPermission('smdoc_group_user', 'list', 'CLASS')) { $admin_link[] = '<a href="' . $loc_url . '?class=smdoc_group_user&method=list">' . _("User Groups") . '</a>'; } if ($foowd->hasPermission('smdoc_name_lookup', 'list', 'CLASS')) { $admin_link[] = '<a href="' . $loc_url . '?class=smdoc_name_lookup&method=list">' . _("Short Names") . '</a>'; } if ($foowd->user->inGroup('Gods')) {