当前位置: 首页>>代码示例>>PHP>>正文


PHP KTUtil::nameToLocalNamespace方法代码示例

本文整理汇总了PHP中KTUtil::nameToLocalNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::nameToLocalNamespace方法的具体用法?PHP KTUtil::nameToLocalNamespace怎么用?PHP KTUtil::nameToLocalNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KTUtil的用法示例。


在下文中一共展示了KTUtil::nameToLocalNamespace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: do_saveSearch

 function do_saveSearch()
 {
     $this->startTransaction();
     $iSearchId = KTUtil::arrayGet($_REQUEST, 'fSearchId', false);
     $sName = KTUtil::arrayGet($_REQUEST, 'name', false);
     $sSearch = KTUtil::arrayGet($_REQUEST, 'boolean_search');
     if ($iSearchId === false && $sName === false) {
         $this->errorRedirectTo('performSearch', _kt('Please either enter a name, or select a search to save over'), sprintf('boolean_search_id=%s', $sSearch));
         exit(0);
     }
     if ($this->oUser->isAnonymous()) {
         $this->errorRedirectTo('performSearch', _kt('Cannot save searches as anonymous user'), sprintf('boolean_search_id=%s', $sSearch));
         exit(0);
     }
     $datavars = $_SESSION['boolean_search'][$sSearch];
     if (!is_array($datavars)) {
         $datavars = unserialize($datavars);
     }
     if (empty($datavars)) {
         $this->errorRedirectToMain(_kt('You need to have at least 1 condition.'));
     }
     if ($iSearchId) {
         $oSearch = KTSavedSearch::get($iSearchId);
         if (PEAR::isError($oSearch) || $oSearch == false) {
             $this->errorRedirectToMain(_kt('No such search'));
             exit(0);
         }
         $oSearch->setSearch($datavars);
         $oSearch = $oSearch->update();
     } else {
         $sName = $this->oValidator->validateEntityName('KTSavedSearch', KTUtil::arrayGet($_REQUEST, 'name'), array('extra_condition' => 'not is_condition', 'redirect_to' => array('new')));
         $sNamespace = KTUtil::nameToLocalNamespace('Saved searches', $sName);
         $oSearch = KTSavedSearch::createFromArray(array('name' => $sName, 'namespace' => $sNamespace, 'iscondition' => false, 'iscomplete' => true, 'userid' => $this->oUser->getId(), 'search' => $datavars));
     }
     $this->oValidator->notError($oSearch, array('redirect_to' => 'main', 'message' => _kt('Search not saved')));
     $this->commitTransaction();
     $this->successRedirectTo('performSearch', _kt('Search saved'), sprintf('boolean_search_id=%s', $sSearch));
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:38,代码来源:booleanSearch.php

示例2: createLdapAuthenticationProvider

 function createLdapAuthenticationProvider()
 {
     if (!file_exists(KT_DIR . '/config/environment.php')) {
         return;
     }
     global $default;
     $new_default = $default;
     $default = null;
     require_once KT_DIR . '/config/environment.php';
     $old_default = $default;
     $default = $new_default;
     if ($old_default->authenticationClass !== "LDAPAuthenticator") {
         return;
     }
     $sName = "Autocreated by upgrade";
     $sNamespace = KTUtil::nameToLocalNamespace("authenticationsources", $sName);
     $aConfig = array('searchattributes' => split(',', 'cn,mail,sAMAccountName'), 'objectclasses' => split(',', 'user,inetOrgPerson,posixAccount'), 'servername' => $old_default->ldapServer, 'basedn' => $old_default->ldapRootDn, 'searchuser' => $old_default->ldapSearchUser, 'searchpassword' => $old_default->ldapSearchPassword);
     if ($old_default->ldapServerType == "ActiveDirectory") {
         $sProvider = "ktstandard.authentication.adprovider";
     } else {
         $sProvider = "ktstandard.authentication.ldapprovider";
     }
     require_once KT_LIB_DIR . '/authentication/authenticationsource.inc.php';
     $oSource = KTAuthenticationSource::createFromArray(array('name' => $sName, 'namespace' => $sNamespace, 'config' => serialize($aConfig), 'authenticationprovider' => $sProvider));
     if (PEAR::isError($oSource)) {
         return $oSource;
     }
     $sUsersTable = KTUtil::getTableName('users');
     $sQuery = "UPDATE {$sUsersTable} SET authentication_source_id = ? WHERE authentication_source_id IS NULL AND LENGTH(authentication_details_s1)";
     $aParams = array($oSource->getId());
     $res = DBUtil::runQuery(array($sQuery, $aParams));
     return $res;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:33,代码来源:UpgradeFunctions.inc.php

示例3: do_create

 function do_create()
 {
     $oForm = $this->form_create();
     $res = $oForm->validate();
     $data = $res['results'];
     $errors = $res['errors'];
     $extra_errors = array();
     if (!empty($data['name'])) {
         $oFieldset = KTFieldset::getByName($data['name']);
         if (!PEAR::isError($oFieldset)) {
             // means we're looking at an existing name
             $extra_errors['name'] = _kt("There is already a fieldset with that name.");
         }
     }
     $is_conditional = false;
     // FIXME this is inelegant.  get it from somewhere else.
     if ($this->bHaveConditional && $data['fieldset_type'] == 'conditional') {
         $is_conditional = true;
     }
     if (!empty($errors) || !empty($extra_errors)) {
         return $oForm->handleError(null, $extra_errors);
     }
     // we also need a namespace.
     $temp_name = $data['name'];
     $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name);
     $oOldFieldset = KTFieldset::getByNamespace($namespace);
     while (!PEAR::isError($oOldFieldset)) {
         $temp_name .= '_';
         $namespace = KTUtil::nameToLocalNamespace('fieldsets', $temp_name);
         $oOldFieldset = KTFieldset::getByNamespace($namespace);
     }
     // we now know its a non-conflicting one.
     // FIXME handle conditional fieldsets, which should be ... a different object.
     $oFieldset = KTFieldset::createFromArray(array("name" => $data['name'], "description" => $data['description'], "namespace" => $namespace, "mandatory" => false, "isConditional" => $is_conditional, "isGeneric" => $data['generic'], "isComplete" => false, "isComplex" => false, "isSystem" => false));
     if (PEAR::isError($oFieldset)) {
         return $oForm->handleError(sprintf(_kt("Failed to create fieldset: %s"), $oFieldset->getMessage()));
     }
     $this->successRedirectTo('edit', _kt("Fieldset created."), sprintf('fFieldsetId=%d', $oFieldset->getId()));
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:39,代码来源:documentFieldsv2.php

示例4: do_newsource_final

 function do_newsource_final()
 {
     $aErrorOptions = array('redirect_to' => array('main'));
     $aErrorOptions['message'] = _kt("No name provided");
     $sName = KTUtil::arrayGet($_REQUEST, 'name');
     $sName = $this->oValidator->validateString($sName, $aErrorOptions);
     $aErrorOptions['message'] = _kt("No authentication provider chosen");
     $sProvider = KTUtil::arrayGet($_REQUEST, 'authentication_provider');
     $sProvider = $this->oValidator->validateString($sProvider, $aErrorOptions);
     $sNamespace = KTUtil::nameToLocalNamespace($sName, 'authentication/sources');
     $sConfig = "";
     $oSource =& KTAuthenticationSource::createFromArray(array('name' => $sName, 'namespace' => $sNamespace, 'authenticationprovider' => $sProvider));
     $this->oValidator->notError($oSource);
     $this->successRedirectTo('editSourceProvider', _kt("Source created"), sprintf('source_id=%d', $oSource->getId()));
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:15,代码来源:authenticationadminpage.inc.php

示例5: do_performSearch

 function do_performSearch()
 {
     $datavars = KTUtil::arrayGet($_REQUEST, 'boolean_search');
     $sName = $this->oValidator->validateEntityName('KTSavedSearch', KTUtil::arrayGet($_REQUEST, 'name'), array('extra_condition' => 'not is_condition', 'redirect_to' => array('new')));
     if (!is_array($datavars)) {
         $datavars = unserialize($datavars);
     }
     if (empty($datavars)) {
         $this->errorRedirectToMain(_kt('You need to have at least 1 condition.'));
     }
     $sNamespace = KTUtil::nameToLocalNamespace('Saved searches', $sName);
     $oSearch = KTSavedSearch::createFromArray(array('name' => $sName, 'namespace' => $sNamespace, 'iscondition' => false, 'iscomplete' => true, 'userid' => null, 'search' => $datavars));
     $this->oValidator->notError($oSearch, array('redirect_to' => 'main', 'message' => _kt('Search not saved')));
     $this->successRedirectToMain(_kt('Search saved'));
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:15,代码来源:savedSearch.php

示例6:

<?php

require_once "../../../config/dmsDefaults.php";
require_once KT_LIB_DIR . "/util/ktutil.inc";
print KTUtil::nameToLocalNamespace("Saved Searches", "Neil's saved search");
开发者ID:5haman,项目名称:knowledgetree,代码行数:5,代码来源:testNameToLocalNamespace.php


注:本文中的KTUtil::nameToLocalNamespace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。