本文整理汇总了PHP中plugin_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_hook函数的具体用法?PHP plugin_hook怎么用?PHP plugin_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activate_group
function activate_group($group_id)
{
global $feedback;
$group =& group_get_object($group_id);
if (!$group || !is_object($group)) {
$feedback .= _('Error creating group object') . '<br />';
return false;
} else {
if ($group->isError()) {
$feedback .= $group->getErrorMessage() . '<br />';
return false;
}
}
$feedback .= sprintf(_('Approving Group: %1$s'), $group->getUnixName()) . '<br />';
if (!$group->approve(session_get_user())) {
$feedback .= $group->getErrorMessage() . '<br />';
return false;
}
$hook_params = array();
$hook_params['group_id'] = $group_id;
plugin_hook("group_approved", $hook_params);
//plugin webcalendar
//create webcal group
plugin_hook('add_cal_group', $group_id);
return true;
}
示例2: array
/**
* getSCMs - get an array of Plugin SCM objects.
*
* @return array The array of SCM objects.
*/
function &getSCMs()
{
$scm_plugins = array();
if ($this->scms) {
return $this->scms;
}
$hookParams['scm_plugins'] =& $scm_plugins;
plugin_hook("scm_plugin", $hookParams);
$this->scms = $scm_plugins;
return $this->scms;
}
示例3: plugin_hook
//
// CommSy is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// CommSy is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You have received a copy of the GNU General Public License
// along with CommSy.
// CommSy-Plugin logout-hook
plugin_hook('logout');
// delete session
$session = $environment->getSessionItem();
$history = $session->getValue('history');
$cookie = $session->getValue('cookie');
$javascript = $session->getValue('javascript');
$https = $session->getValue('https');
$flash = $session->getValue('flash');
if ( $session->issetValue('root_session_id') ) {
$root_session_id = $session->getValue('root_session_id');
}
$config = $environment->getConfiguration('c_shibboleth_redirect_url');
if ($environment->getConfiguration('c_shibboleth_direct_login') and !empty($config)){
if ($_SERVER['Shib_userId']){
$session_manager->delete($SID,true);
示例4: profile_update
function profile_update($profile_new)
{
global $CFG;
global $data;
global $messages;
global $page_owner;
global $profile_name;
$profiledetails = optional_param('profiledetails', array());
if (count($profiledetails) > 0) {
// delete_records('profile_data','owner',$page_owner);
$insertvalues = array();
$requiredmissing = array();
foreach ($profiledetails as $field => $value) {
$field = trim($field);
$value = trim($value);
if (!empty($value)) {
//TODO get rid of variable duplication here. (Penny)
if (!empty($data['profile:details'][$field]->invisible)) {
$access = 'user' . $page_owner;
} else {
$access = $_POST['profileaccess'][$field];
}
$pd = new StdClass();
$pd->name = $field;
$pd->value = $value;
$pd->access = $access;
$pd->owner = $page_owner;
// $insert_id = insert_record('profile_data',$pd);
$insertvalues[] = $pd;
} else {
foreach ($data['profile:details'] as $datatype) {
if (is_array($datatype)) {
$fname = !empty($datatype[1]) ? $datatype[1] : '';
$flabel = !empty($field[0]) ? $field[0] : '';
$frequired = false;
$fcat = __gettext("Main");
// Otherwise map things the new way!
} else {
$fname = $datatype->internal_name;
$flabel = $datatype->name;
$frequired = $datatype->required;
if (empty($datatype->category)) {
$fcat = __gettext("Main");
} else {
$fcat = $datatype->category;
}
}
if ($fname == $field) {
if ($frequired == true) {
$requiredmissing[] = sprintf(__gettext("%s (in category %s)"), $flabel, $fcat);
} else {
delete_records('profile_data', 'owner', $page_owner, 'name', $fname);
}
}
}
}
}
if (sizeof($requiredmissing) == 0) {
$updatedok = true;
foreach ($insertvalues as $insertvalue) {
delete_records('profile_data', 'owner', $page_owner, 'name', $insertvalue->name);
$insertvalue = plugin_hook("profile_data", "create", $insertvalue);
if (!empty($insertvalue)) {
$insert_id = insert_record('profile_data', $insertvalue);
$insertvalue->ident = $insert_id;
plugin_hook("profile_data", "publish", $insertvalue);
foreach ($data['profile:details'] as $datatype) {
if (is_array($datatype)) {
$fname = !empty($datatype[1]) ? $datatype[1] : '';
$ftype = !empty($datatype[2]) ? $datatype[2] : '';
// Otherwise map things the new way!
} else {
$fname = $datatype->internal_name;
$ftype = $datatype->field_type;
}
if ($fname == $insertvalue->name && $ftype == "keywords") {
delete_records('tags', 'tagtype', $insertvalue->name, 'owner', $page_owner);
$value = insert_tags_from_string($insertvalue->value, $insertvalue->name, $insert_id, $insertvalue->access, $page_owner);
}
if (isset($CFG->display_field_module[$ftype])) {
$callback = $CFG->display_field_module[$ftype] . "_validate_input_field";
$updatedok = $callback($insertvalue);
}
}
}
}
$messages[] = __gettext("Profile updated.");
} else {
$savedata = array();
foreach ($insertvalues as $insertvalue) {
$savedata['profile:preload'][$insertvalue->name] = $insertvalue->value;
$savedata['profile:preload:access'][$insertvalue->name] = $insertvalue->access;
}
foreach ($requiredmissing as $key => $missinglabel) {
$message = "";
if ($key > 0) {
$message .= ", ";
}
$message .= $missinglabel;
}
//.........这里部分代码省略.........
示例5: save
//.........这里部分代码省略.........
// user id
if (!empty($form_data['user_id']) && $form_data['user_id'] != $portalUser->getUserID()) {
$check = true;
$auth_source = $portalUser->getAuthSource();
if (!empty($auth_source)) {
$authentication = $this->_environment->getAuthenticationObject();
if (!$authentication->is_free($form_data['user_id'], $auth_source)) {
$this->_popup_controller->setErrorReturn("1011", "user id error(duplicated)", array());
$check = false;
} elseif (withUmlaut($form_data['user_id'])) {
$this->_popup_controller->setErrorReturn("1012", "user id error(umlaut)", array());
$check = false;
}
} else {
$this->_popup_controller->setErrorReturn("1013", "user id error(auth source error)", array());
$check = false;
}
if ($check === true) {
if ($authentication->changeUserID($form_data['user_id'], $portalUser)) {
$session_manager = $this->_environment->getSessionManager();
$session = $this->_environment->getSessionItem();
$session_id_old = $session->getSessionID();
$session_manager->delete($session_id_old, true);
$session->createSessionID($form_data['user_id']);
$cookie = $session->getValue('cookie');
if ($cookie == 1) {
$session->setValue('cookie', 2);
}
$session_manager->save($session);
unset($session_manager);
$portalUser->setUserID($form_data['user_id']);
$currentUser->setUserID($form_data['user_id']);
require_once 'functions/misc_functions.php';
plugin_hook('user_save', $portalUser);
}
} else {
$this->_popup_controller->setErrorReturn("117", "user id error(duplicated, umlaut, etc)", array());
}
} else {
// $success_1 = true
}
$save = false;
// language
if (!empty($form_data['language']) && $form_data['language'] != $portalUser->getLanguage()) {
$portalUser->setLanguage($form_data['language']);
$save = true;
if ($this->_environment->inPrivateRoom()) {
$currentUser->setLanguage($form_data['language']);
$currentUser->save();
}
}
if (isset($form_data['mail_account'])) {
$currentUser->setAccountWantMail('yes');
$currentUser->save();
#$save = true;
} else {
$currentUser->setAccountWantMail('no');
$currentUser->save();
#$save = true;
}
if (isset($form_data['mail_room'])) {
$currentUser->setOpenRoomWantMail('yes');
$currentUser->save();
#$save = true;
} else {
$currentUser->setOpenRoomWantMail('no');
示例6: role_box
" /></td>
</tr></form>
<?php
}
}
//
// RBAC Editing Functions
//
echo $HTML->boxMiddle(_('Edit Roles'));
echo '<form action="roleedit.php?group_id=' . $group_id . '" method="POST">';
echo role_box($group_id, 'role_id', '');
echo '<input type="submit" name="edit" value="' . _('Edit Role') . '"></form>';
echo '<p><a href="roleedit.php?group_id=' . $group_id . '">' . _('Add Role') . '</a>';
//
// Project hierarchy functions
plugin_hook('admin_project_link', $group_id);
echo $HTML->boxBottom();
?>
</td>
</tr>
</table>
<?php
project_admin_footer(array());
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
示例7: user_friend_delete
/**
* Delete a user from a friends list
*
* @param integer $user_id the user id
* @param integer $friend_id the friend id
* @return mixed an ADODB RecordSet object with the results or false
* @author Misja Hoebe <misja@curverider.co.uk>
*/
function user_friend_delete($user_id, $friend_id)
{
if (empty($user_id) || empty($friend_id)) {
trigger_error(__FUNCTION__ . ": invalid arguments (user id: {$user_id}, friend id: {$friend_id})", E_ERROR);
}
$result = delete_records('friends', 'owner', $user_id, 'friend', $friend_id);
if ($result != false) {
$obj = new StdClass();
$obj->owner = $user_id;
$obj->friend = $friend_id;
plugin_hook("friendship", "delete", $obj);
}
return $result;
}
示例8: projectTabs
/**
* projectTabs() - Prints out the project tabs, contained here in case
* we want to allow it to be overriden
*
* @param string Is the tab currently selected
* @param string Is the group we should look up get title info
*/
function projectTabs($toptab, $group)
{
// get group info using the common result set
$project =& group_get_object($group);
if (!$project || !is_object($project)) {
return;
}
if ($project->isError()) {
//wasn't found or some other problem
return;
}
if (!$project->isProject()) {
return;
}
// Summary
if (isset($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
$TABS_DIRS[] = '/project/?group_id=' . $project->getId();
} else {
$TABS_DIRS[] = '/projects/' . $project->getUnixName() . '/';
}
$TABS_TITLES[] = _('Summary');
$toptab == 'home' ? $selected = count($TABS_TITLES) - 1 : '';
// Project Admin
$perm =& $project->getPermission(session_get_user());
if ($perm->isAdmin()) {
$TABS_DIRS[] = '/project/admin/?group_id=' . $group;
$TABS_TITLES[] = _('Admin');
$toptab == 'admin' ? $selected = count($TABS_TITLES) - 1 : '';
}
/* Homepage
$TABS_DIRS[]='http://'. $project->getHomePage();
$TABS_TITLES[]=_('Home Page');
*/
// Project Activity tab
$TABS_DIRS[] = '/activity/?group_id=' . $group;
$TABS_TITLES[] = _('Activity');
$toptab == 'activity' ? $selected = count($TABS_TITLES) - 1 : '';
// Forums
if ($project->usesForum()) {
$TABS_DIRS[] = '/forum/?group_id=' . $group;
$TABS_TITLES[] = _('Forums');
$toptab == 'forums' ? $selected = count($TABS_TITLES) - 1 : '';
}
// Artifact Tracking
if ($project->usesTracker()) {
$TABS_DIRS[] = '/tracker/?group_id=' . $group;
$TABS_TITLES[] = _('Tracker');
$toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch' ? $selected = count($TABS_TITLES) - 1 : '';
}
// Mailing Lists
if ($project->usesMail()) {
$TABS_DIRS[] = '/mail/?group_id=' . $group;
$TABS_TITLES[] = _('Lists');
$toptab == 'mail' ? $selected = count($TABS_TITLES) - 1 : '';
}
// Project Manager
if ($project->usesPm()) {
$TABS_DIRS[] = '/pm/?group_id=' . $group;
$TABS_TITLES[] = _('Tasks');
$toptab == 'pm' ? $selected = count($TABS_TITLES) - 1 : '';
}
// Doc Manager
if ($project->usesDocman()) {
$TABS_DIRS[] = '/docman/?group_id=' . $group;
$TABS_TITLES[] = _('Docs');
$toptab == 'docman' ? $selected = count($TABS_TITLES) - 1 : '';
}
// Surveys
if ($project->usesSurvey()) {
$TABS_DIRS[] = '/survey/?group_id=' . $group;
$TABS_TITLES[] = _('Surveys');
$toptab == 'surveys' ? $selected = count($TABS_TITLES) - 1 : '';
}
//newsbytes
if ($project->usesNews()) {
$TABS_DIRS[] = '/news/?group_id=' . $group;
$TABS_TITLES[] = _('News');
$toptab == 'news' ? $selected = count($TABS_TITLES) - 1 : '';
}
// SCM systems
if ($project->usesSCM()) {
$TABS_DIRS[] = '/scm/?group_id=' . $group;
$TABS_TITLES[] = _('SCM');
$toptab == 'scm' ? $selected = count($TABS_TITLES) - 1 : '';
}
// groupmenu_after_scm hook
$hookParams['DIRS'] =& $TABS_DIRS;
$hookParams['TITLES'] =& $TABS_TITLES;
$hookParams['toptab'] =& $toptab;
$hookParams['selected'] =& $selected;
$hookParams['group_id'] = $group;
plugin_hook("groupmenu_scm", $hookParams);
// Downloads
//.........这里部分代码省略.........
示例9: __construct
/**
* constructor
*/
public function __construct(cs_environment $environment)
{
// CommSy-Plugin logout-hook
plugin_hook('logout');
// delete session
$session_manager = $environment->getSessionManager();
$session = $environment->getSessionItem();
$history = $session->getValue('history');
$cookie = $session->getValue('cookie');
$javascript = $session->getValue('javascript');
$https = $session->getValue('https');
$flash = $session->getValue('flash');
if ($session->issetValue('root_session_id')) {
$root_session_id = $session->getValue('root_session_id');
}
$session_manager->delete($session->getSessionID(), true);
$session->reset();
include_once 'classes/cs_session_item.php';
$session = new cs_session_item();
$session->createSessionID('guest');
if ($cookie == '1') {
$session->setValue('cookie', 2);
} else {
$session->setValue('cookie', 0);
}
if ($javascript == '1') {
$session->setValue('javascript', 1);
} elseif ($javascript == '-1') {
$session->setValue('javascript', -1);
}
if ($https == '1') {
$session->setValue('https', 1);
} elseif ($https == '-1') {
$session->setValue('https', -1);
}
if ($flash == '1') {
$session->setValue('flash', 1);
} elseif ($flash == '-1') {
$session->setValue('flash', -1);
}
if (!empty($_GET['back_tool'])) {
$back_tool = $_GET['back_tool'];
$back_file = $back_tool . '.php';
} else {
$back_tool = '';
$back_file = '';
}
if (mb_stristr($_SERVER['PHP_SELF'], 'homepage.php')) {
$session->setToolName('homepage');
}
$environment->setSessionItem($session);
// redirect
$current_context = $environment->getCurrentContextItem();
if (isset($root_session_id) and !empty($root_session_id)) {
// change cookie
if ($cookie == '1') {
$session_manager = $environment->getSessionManager();
$session = $session_manager->get($root_session_id);
$session->setValue('cookie', 2);
unset($session_manager);
$environment->setSessionItem($session);
}
$params = $history[0]['parameter'];
$params['SID'] = $root_session_id;
redirect($history[0]['context'], $history[0]['module'], $history[0]['function'], $params, '', '', $back_tool);
} elseif (!$current_context->isOpenForGuests() and (empty($back_tool) or !empty($back_tool) and $back_tool == 'commsy')) {
if (!$current_context->isServer()) {
$parent_context = $current_context->getContextItem();
if ($parent_context->isOpenForGuests()) {
if ($parent_context->isPortal()) {
$params = array();
$params['room_id'] = $current_context->getItemID();
if ($current_context->isGroupRoom()) {
$project_room_item_id = $current_context->getLinkedProjectItemID();
if (!empty($project_room_item_id)) {
$params['room_id'] = $project_room_item_id;
}
}
redirect($parent_context->getItemID(), 'home', 'index', $params, '', '', $back_tool);
unset($params);
} else {
redirect($parent_context->getItemID(), 'home', 'index', '', '', '', $back_tool);
}
}
} else {
redirect($current_context->getItemID(), 'home', 'index', '', '', '', $back_tool);
}
} else {
redirect($history[0]['context'], $history[0]['module'], $history[0]['function'], $history[0]['parameter'], '', '', $back_tool);
}
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
redirect_with_url($url);
}
示例10: _
<input type="hidden" name="approve" value="y" />
<input type="hidden" name="post_changes" value="y" />
<input type="radio" name="status" value="1" /> ' . _('Approve For Front Page') . '<br />
<input type="radio" name="status" value="0" /> ' . _('Do Nothing') . '<br />
<input type="radio" name="status" value="2" checked="checked" /> ' . _('Reject') . '<br />
<strong>' . _('Subject') . ':</strong><br />
<input type="text" name="summary" value="' . db_result($result, 0, 'summary') . '" size="30" maxlength="60" /><br />
<strong>' . _('Details') . ':</strong><br />';
$GLOBALS['editor_was_set_up'] = false;
$params = array();
$params['name'] = 'details';
$params['width'] = "600";
$params['height'] = "300";
$params['group'] = db_result($result, 0, 'group_id');
$params['body'] = db_result($result, 0, 'details');
plugin_hook("text_editor", $params);
if (!$GLOBALS['editor_was_set_up']) {
//if we don't have any plugin for text editor, display a simple textarea edit box
echo '<textarea name="details" rows="5" cols="50" wrap="soft">' . db_result($result, 0, 'details') . '</textarea><br />';
}
unset($GLOBALS['editor_was_set_up']);
echo '<br />
<input type="submit" name="submit" value="' . _('Submit') . '" />
</form>';
} else {
/*
Show list of waiting news items
*/
$old_date = time() - 60 * 60 * 24 * 30;
$sql_pending = "\n\t\t\tSELECT groups.group_id,id,post_date,summary,\n\t\t\t\tgroup_name,unix_group_name\n\t\t\tFROM news_bytes,groups\n\t\t\tWHERE is_approved=0\n\t\t\tAND news_bytes.group_id=groups.group_id\n\t\t\tAND post_date > '{$old_date}'\n\t\t\tAND groups.is_public=1\n\t\t\tAND groups.status='A'\n\t\t\tORDER BY post_date\n\t\t";
$old_date = time() - 60 * 60 * 24 * 7;
示例11: save
function save()
{
$user_manager = $this->_environment->getUserManager();
$this->_save($user_manager);
$item_id = $this->getItemID();
if (empty($item_id)) {
$this->setItemID($user_mananger->getCreateID());
}
plugin_hook('user_save', $this);
// ContactPersonString
$context_item = $this->getContextItem();
// get grouproom
if ($context_item->getType() == 'group') {
$grouproom_array = $context_item->_getItemData();
$grouproom_id = $grouproom_array['extras']['GROUP_ROOM_ID'];
$room_manager = $this->_environment->getRoomManager();
$context_item = $room_manager->getItem($grouproom_id);
}
if (isset($context_item) and !$context_item->isPortal() and !$context_item->isServer() and $this->getUserID() and mb_strtoupper($this->getUserID()) != 'GUEST' and (!isset($this->_old_status) or !isset($this->_old_contact) or $this->_old_status != $this->getStatus() or $this->_old_contact != $this->getContactStatus())) {
$context_item->renewContactPersonString();
unset($context_item);
}
// set old status to current status
$this->_old_status = $this->getStatus();
$this->_old_contact = $this->getContactStatus();
if ($this->getStatus() == 2 or $this->getStatus() == 3) {
// wenn $this->getStatus() einen freigeschalteten Benutzer angibt
// 2 = normaler Benutzer
// 3 = Moderator
if ($this->_environment->getCurrentContextItem()->WikiEnableDiscussion() == "1") {
$this->updateWikiProfile();
}
if ($this->_environment->getCurrentContextItem()->WikiEnableDiscussionNotification() == "1") {
$this->updateWikiNotification();
}
} else {
// Wenn der Benutzer gesperrt oder geloescht ist, müssen Profile und
// Notification entsprechend angepasst werden
// 0 = gesperrt & geloescht (+ deletion_date)
//
// Entscheidung 30.09.2008 - Eintraege bleiben unveraendert im Forum
//$this->updateWikiRemoveUser();
}
}
示例12: session_require
session_require(array('group' => '1', 'admin_flags' => 'A'));
$group_id = getIntFromGet('group_id');
$group =& group_get_object($group_id);
if (!$group || !is_object($group)) {
exit_error('Error', 'Could Not Get Group');
} elseif ($group->isError()) {
exit_error('Error', $group->getErrorMessage());
}
if (getStringFromPost('submit')) {
$sure = getIntFromPost('sure');
$reallysure = getIntFromPost('reallysure');
$reallyreallysure = getIntFromPost('reallyreallysure');
if (!$group->delete($sure, $reallysure, $reallyreallysure)) {
exit_error('Error', $group->getErrorMessage());
} else {
plugin_hook('delete_link', $_GET['group_id']);
header("Location: " . util_make_url("/admin/?feedback=DELETED"));
}
}
site_admin_header(array('title' => _('Permanently Delete Project')));
echo '<h2>' . _('Permanently and irretrievably delete project') . ': ' . $group->getPublicName() . '</h2>';
?>
<p>
<form action="<?php
echo getStringFromServer('PHP_SELF') . '?group_id=' . $group_id;
?>
" method="post">
<input type="checkbox" value="1" name="sure"> <?php
echo _('Confirm Delete');
?>
示例13: getInstance
public static function getInstance()
{
if (isset(self::$_instance)) {
return self::$_instance;
}
$c = __CLASS__;
self::$_instance = new $c();
$res = db_query_params('SELECT r.role_id FROM pfo_role r, pfo_role_class c WHERE r.role_class = c.class_id AND c.class_name = "$1"', array('PFO_RoleLoggedIn'));
if (!$res || !db_numrows($res)) {
throw new Exception("No PFO_RoleLoggedIn role in the database");
}
self::$_instance->_role_id = db_result($res, 0, 'role_id');
$hook_params = array();
$hook_params['role'] =& self::$_instance;
plugin_hook("role_get", $hook_params);
self::$_instance->fetchData(self::$_instance->_role_id);
return self::$_instance;
}
示例14: getIntFromRequest
}
// Administrative functions
$group_id = getIntFromRequest('group_id');
$action = getStringFromRequest('action');
$user_id = getStringFromRequest('user_id');
if ($action == 'delete') {
performAction('D', "DELETED", $user_id);
//plugin webcal
//del webcal user
plugin_hook('del_cal_user', $user_id);
} else {
if ($action == 'activate') {
performAction('A', "ACTIVE", $user_id);
//plugin webcal
//create webcal user
plugin_hook('add_cal_user', $user_id);
} else {
if ($action == 'suspend') {
performAction('S', "SUSPENDED", $user_id);
}
}
}
// Add a user to this group
if (getStringFromRequest('action') == 'add_to_group') {
echo "ACTION NOT SUPPORTED";
}
// Show list of users
print "<p>" . _('User list for group:');
if (!$group_id) {
$user_name_search = getStringFromRequest('user_name_search');
print "<strong>" . _('All Groups') . "</strong>";
示例15: plugin_hook
<?php
echo $pt->showRelatedArtifacts();
?>
</td>
</tr>
<tr>
<td colspan="2">
<?php
echo $pt->showMessages();
?>
</td>
</tr>
<?php
$hookParams['task_id'] = $project_task_id;
plugin_hook("task_extra_detail", $hookParams);
?>
<tr>
<td colspan="2">
<?php
echo $pt->showHistory();
?>
</td>
</tr>
</table>
<?php
pm_footer(array());
// Local Variables:
// mode: php
// c-file-style: "bsd"