本文整理汇总了PHP中Kernel::is_connected方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::is_connected方法的具体用法?PHP Kernel::is_connected怎么用?PHP Kernel::is_connected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kernel
的用法示例。
在下文中一共展示了Kernel::is_connected方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: go
/**
* go
*
* Appel automatique, avec détection du noeud à afficher.
* @author Frédéric Mossmann
* @since 10.03.2009
*
*/
public function go()
{
if (!Kernel::is_connected()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nologin'), 'back' => CopixUrl::get('auth|default|login')));
}
CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_concerto.js');
if (!_request("id") || !ereg('^[0-9]+$', _request("id"))) {
return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('kernel||getNodes'));
}
$sql = 'SELECT login,password FROM kernel_bu_auth WHERE node_type=\'responsable\' AND node_id=' . _currentUser()->getExtra('id') . ' AND id=\'' . addslashes(_request("id")) . '\' AND service=\'concerto\'';
$concerto = _doQuery($sql);
if (!$concerto) {
return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('kernel||getNodes'));
}
$tpl = new CopixTpl();
$tpl->assign('TITLE_PAGE', CopixI18N::get('concerto|concerto.title'));
// $tpl->assign ('MENU', '<a href="'.CopixUrl::get ('groupe||getListPublic').'">'.CopixI18N::get ('groupe|groupe.annuaire').'</a> :: <a href="'.CopixUrl::get ('groupe||getListMy').'">'.CopixI18N::get ('groupe|groupe.my').'</a>');
$tplListe = new CopixTpl();
$tplListe->assign('login', $concerto[0]->login);
$tplListe->assign('password', $concerto[0]->password);
$result = $tplListe->fetch("concerto-form.tpl");
$tpl->assign("MAIN", $result);
$tpl->assign('BODY_ON_LOAD', 'concerto_redirect();');
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}
示例2: beforeAction
public function beforeAction()
{
_currentUser()->assertCredential('group:[current_user]');
if (!Kernel::is_connected()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nologin'), 'back' => CopixUrl::get('auth|default|login')));
}
}
示例3: fiche
/**
* Affichage de la fiche d'une ecole
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2008/09/03
* @param integer $id Id de l'ecole
* @param integer $popup 1 pour afficher la fiche en popup Fancybox
*/
public function fiche()
{
$id = $this->getRequest('id', null);
$iPopup = CopixRequest::getInt('popup');
$ecoleDAO = CopixDAOFactory::create('kernel|kernel_bu_ecole');
$ficheDAO = CopixDAOFactory::create("fiches_ecoles");
$criticErrors = array();
if (!($rEcole = $ecoleDAO->get($id))) {
$criticErrors[] = CopixI18N::get('fichesecoles.error.param');
} elseif (!FichesEcolesService::canMakeInFicheEcole($id, 'VIEW')) {
$criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights');
}
if ($criticErrors) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('annuaire||')));
}
$rFiche = $ficheDAO->get($id);
$tpl = new CopixTpl();
CopixHtmlHeader::addJSLink(CopixUrl::get() . 'js/iconito/module_fichesecoles.js');
$fiche = CopixZone::process('fiche', array('rEcole' => $rEcole, 'rFiche' => $rFiche));
$main = $fiche;
$title = $rEcole->nom;
if ($rEcole->type) {
$title .= ' (' . $rEcole->type . ')';
}
$tpl->assign('TITLE_PAGE', $title);
// Get vocabulary catalog to use
$nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog');
$vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode('BU_ECOLE', $rEcole->numero);
if (strtolower($rEcole->type) == 'crèche') {
$tpl->assign('TITLE_CONTEXT', CopixI18N::get('kernel|kernel.codes.mod_fichesecoles_creche'));
} else {
$tpl->assign('TITLE_CONTEXT', CopixCustomI18N::get('kernel|kernel.codes.mod_fiche%%structure%%', array('catalog' => $vocabularyCatalog->id_vc)));
}
$menu = array();
$menu[] = array('url' => CopixUrl::get('public||getListBlogs'), 'txt' => CopixCustomI18N::get('public|public.blog.annuaire.%%structures%%', array('catalog' => $vocabularyCatalog->id_vc)));
if (Kernel::is_connected()) {
$menu[] = array('url' => CopixUrl::get('annuaire||getAnnuaireEcole', array('ecole' => $rEcole->numero)), 'txt' => CopixCustomI18N::get('annuaire|annuaire.back%%structure%%', array('catalog' => $vocabularyCatalog->id_vc)));
}
if (CopixConfig::exists('|can_annuaire_menu') && !CopixConfig::get('|can_annuaire_menu')) {
$menu = array();
}
$tpl->assign('MENU', $menu);
$tpl->assign("MAIN", $main);
if ($iPopup) {
$ppo = new CopixPPO();
$ppo->fiche = $fiche;
$ppo->TITLE = $title;
return _arPPO($ppo, array('template' => 'fiche_popup.tpl', 'mainTemplate' => 'main|main_fancy.php'));
}
return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl);
}
示例4: processGo
public function processGo()
{
$ppo = new CopixPPO();
if (!Kernel::is_connected()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nologin'), 'back' => CopixUrl::get('auth|default|login')));
}
$user = _currentUser();
$ppo->ceriseprim_url = '';
$ppo->ceriseprim_admin = '';
if (preg_match("/^(?P<node_type>[\\w_]+)-(?P<node_id>\\d+)\$/", _request("id"), $regs)) {
if ($regs['node_type'] == "BU_ECOLE" || $regs['node_type'] == "BU_CLASSE") {
if ($regs['node_type'] == "BU_ECOLE") {
$sql = "\n SELECT *\n FROM kernel_bu_ecole\n WHERE numero=:id\n ";
$params = array(':id' => $regs['node_id']);
}
if ($regs['node_type'] == "BU_CLASSE") {
$sql = "\n SELECT kernel_bu_ecole.RNE\n FROM kernel_bu_ecole\n JOIN kernel_bu_ecole_classe ON kernel_bu_ecole.numero=kernel_bu_ecole_classe.ecole\n WHERE kernel_bu_ecole_classe.id=:id\n ";
$params = array(':id' => $regs['node_id']);
}
$ecoles_list = _doQuery($sql, $params);
if (count($ecoles_list)) {
$url = CopixConfig::get('default|conf_Ceriseprim_url') . "/" . $ecoles_list[0]->RNE . "/ico.php?user=personnel-" . $user->getExtra('id') . "&date=" . date('Y-m-d') . "&key=" . md5($ecoles_list[0]->RNE . "personnel-" . $user->getExtra('id') . date('Y-m-d') . CopixConfig::get('default|conf_Ceriseprim_secret'));
$ppo->ceriseprim_url = $url;
if ($regs['node_type'] == "BU_ECOLE") {
$mynodes = Kernel::getMyNodes();
foreach ($mynodes as $node) {
if ($node->type == $regs['node_type'] && $node->id == $regs['node_id'] && $node->droit >= 70) {
$ppo->ceriseprim_admin = CopixConfig::get('default|conf_Ceriseprim_url') . "/support/iconito/updateIconito.php?rne=" . $ecoles_list[0]->RNE;
}
}
}
}
}
}
return _arPPO($ppo, 'default.tpl');
}
示例5: getUserInfo
public function getUserInfo($type = "ME", $id = 0, $options = array())
{
//Kernel::deb("getUserInfo / type=$type / id=$id");
$user = $users = array();
switch ($type) {
case "ID":
$user_dao = _dao("kernel|kernel_bu2user");
$users = $user_dao->getByUserID($id);
break;
case "LOGIN":
$user_dao = _dao("kernel|kernel_bu2user");
$users = $user_dao->getByLogin($id);
break;
case "ME":
if (Kernel::is_connected()) {
return Kernel::getUserInfo(_currentUser()->getExtra('type'), _currentUser()->getExtra('id'));
}
default:
$user_dao = _dao("kernel|kernel_bu2user");
$users = $user_dao->getByBUID($type, $id);
if (count($users)) {
$users[0]->bu_type = $type;
$users[0]->bu_id = $id;
} else {
if (!isset($options['strict']) || $options['strict']) {
// Si pas strict
$record = _record("kernel|kernel_bu2user");
$record->bu_type = $type;
$record->bu_id = $id;
$record->user_id = '';
$record->user_login = '';
$users = array();
$users[0] = $record;
}
}
break;
}
if (!sizeof($users)) {
if (isset($options['strict']) && $options['strict']) {
return false;
}
return array_merge($user, array('nom' => 'Utilisateur inconnu', 'prenom' => $type . ' ' . $id, 'login' => '', 'ALL' => null));
} else {
$userval = $users[0];
$user["type"] = $users[0]->bu_type;
$user["id"] = $users[0]->bu_id;
if (isset($users[0]->user_id)) {
$user["user_id"] = $users[0]->user_id;
}
if (isset($users[0]->user_login)) {
$user["login"] = $users[0]->user_login;
}
switch ($userval->bu_type) {
case "USER_VIL":
case "USER_ENS":
case "USER_ADM":
$pers_dao = _dao("kernel|kernel_bu_personnel");
$personne = $pers_dao->get($userval->bu_id);
if (!$personne) {
return array_merge($user, array('nom' => 'Utilisateur inconnu', 'prenom' => $userval->bu_type . ' ' . $userval->bu_id, 'ALL' => null));
}
$user["nom"] = $personne->pers_nom;
$user["prenom"] = $personne->pers_prenom1;
$user["civilite"] = $personne->pers_civilite;
$user["sexe"] = $personne->pers_id_sexe;
$user["cle_privee"] = $personne->pers_cle_privee;
$user["ALL"] = $personne;
$pers_entite_dao = _dao("kernel|kernel_bu_personnel_entite");
$pers_entites = $pers_entite_dao->getById($userval->bu_id);
foreach ($pers_entites as $key => $value) {
switch ($value->pers_entite_type_ref) {
case "VILLE":
$user["link"]->ville[$value->pers_entite_reference] = $value->pers_entite_role;
break;
case "ECOLE":
$user["link"]->ecole[$value->pers_entite_reference] = $value->pers_entite_role;
break;
case "CLASSE":
$user["link"]->classe[$value->pers_entite_reference] = $value->pers_entite_role;
break;
}
}
break;
case "USER_ELE":
$ele_dao = _dao("kernel|kernel_bu_ele");
$eleve = $ele_dao->get($userval->bu_id);
if (!$eleve) {
return array_merge($user, array('nom' => 'Utilisateur inconnu', 'prenom' => $userval->bu_type . ' ' . $userval->bu_id, 'ALL' => null));
}
$user["nom"] = $eleve->ele_nom;
$user["prenom"] = $eleve->ele_prenom1;
$user["civilite"] = $eleve->ele_civilite;
$user["sexe"] = $eleve->ele_id_sexe;
$user["ALL"] = $eleve;
$parents = Kernel::getNodeParents("USER_ELE", $userval->bu_id);
foreach ($parents as $key => $value) {
switch ($value['type']) {
case "BU_CLASSE":
$user["link"]->classe[$value['id']] = 1;
if (isset($value['ALL'])) {
//.........这里部分代码省略.........
示例6: getPopup
/**
* Affichage de l'annuaire en version popup
*
* Affiche les discussions d'un forum et les informations sur les discussions (titre, dernier message...), avec un lien pour lire chaque discussion.
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2006/01/18
*/
public function getPopup()
{
if (!Kernel::is_connected()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('annuaire|annuaire.error.noLogged'), 'back' => CopixUrl::get('||')));
}
CopixHTMLHeader::addJSLink(_resource("js/iconito/module_annuaire_popup.js"));
CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.tablesorter.min.js"));
CopixHTMLHeader::addJSLink(_resource("js/jquery/jquery.metadata.js"));
CopixHTMLHeader::addCSSLink(_resource("js/jquery/css/jquery.tablesorter.css"));
$grville = _request('grville') ? _request('grville') : NULL;
$ville = _request('ville') ? _request('ville') : NULL;
$ecole = _request('ecole') ? _request('ecole') : NULL;
$classe = _request('classe') ? _request('classe') : NULL;
$field = _request('field') ? _request('field') : '';
$profils = _request('profils') ? _request('profils') : array();
$profil = $this->getRequest('profil');
// Si on force sur un profil unique a afficher
$ALL = CopixConfig::get('annuaire|annu_combo_all');
$annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService');
// Annuaire par défaut, on regarde sa session
if (!$classe && !$ecole && !$ville) {
$home = $annuaireService->getAnnuaireHome();
//print_r($home);
switch ($home['type']) {
case 'BU_GRVILLE':
$grville = $home['id'];
$ville = $ALL;
$ecole = $ALL;
$classe = $ALL;
break;
case 'BU_VILLE':
$info = Kernel::getNodeInfo($home['type'], $home['id']);
if ($info) {
$grville = $info['ALL']->vil_id_grville;
}
$ville = $home['id'];
$ecole = $ALL;
$classe = $ALL;
break;
case 'BU_ECOLE':
$info = Kernel::getNodeInfo($home['type'], $home['id']);
if ($info) {
$grville = $info['ALL']->vil_id_grville;
$ville = $info['ALL']->eco_id_ville;
}
$ecole = $home['id'];
$classe = $ALL;
break;
case 'BU_CLASSE':
$info = Kernel::getNodeInfo($home['type'], $home['id']);
//_dump($info);
if ($info) {
$grville = $info['parent']['ALL']->vil_id_grville;
$ville = $info['parent']['ALL']->eco_id_ville;
$ecole = $info['parent']['id'];
}
$classe = $home['id'];
//echo "grville=$grville / ville=$ville / ecole=$ecole / classe=$classe";
break;
}
}
$comboEcoles = $comboClasses = true;
// On force les valeurs des combos
if ($profil) {
switch ($profil) {
case 'USER_VIL':
$comboEcoles = $comboClasses = false;
$ecole = $classe = $ALL;
break;
}
}
$matrix =& enic::get('matrixCache');
$helper =& enic::get('matrixHelpers');
$right = _request('right', 'voir');
// voir ou communiquer
$iCan = 'communiquer' == $right ? 'iCanTalkToThisType' : 'iCanSeeThisType';
$tplListe = new CopixTpl();
$visib = array('USER_ELE' => $helper->{$iCan}('USER_ELE'), 'USER_ENS' => $helper->{$iCan}('USER_ENS') || $helper->{$iCan}('USER_DIR'), 'USER_RES' => $helper->{$iCan}('USER_RES'), 'USER_EXT' => $helper->{$iCan}('USER_EXT'), 'USER_ADM' => $helper->{$iCan}('USER_ADM'), 'USER_VIL' => $helper->{$iCan}('USER_VIL'));
//_dump($visib);
$debug = false;
$start = microtime(true);
$tplListe->assign('combogrvilles', CopixZone::process('annuaire|combogrvilles', array('droit' => $right, 'value' => $grville, 'fieldName' => 'grville', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_grville(this,this.form);"', 'linesSup' => array())));
if ($debug) {
echo "combogrvilles " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />";
}
$start = microtime(true);
$tplListe->assign('combovilles', CopixZone::process('annuaire|combovilles', array('droit' => $right, 'grville' => $grville, 'value' => $ville, 'fieldName' => 'ville', 'attribs' => 'class="annu_combo_popup" ONCHANGE="change_ville(this,this.form);"', 'linesSup' => array(0 => array('value' => $ALL, 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllVilles'))))));
if ($debug) {
echo "combovilles " . date("H:i:s") . " " . (microtime(true) - $start) . "<br />";
}
$start = microtime(true);
if ($ville == $ALL && $comboEcoles) {
//.........这里部分代码省略.........
示例7: canMakeInBlog
/**
* Gestion des droits dans un blog
*
* Teste si l'usager peut effectuer une certaine opération par rapport à son droit. Le droit sur le blog est calculé ou récupéré de la session dans la fonction
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2007/05/31
* @param string $action Action pour laquelle on veut tester le droit
* @param object $r L'objet sur lequel on teste le droit
* @return bool true s'il a le droit d'effectuer l'action, false sinon
*/
public function canMakeInBlog($action, $r)
{
$can = false;
if (!$r) {
return false;
}
$userInfos = BlogAuth::getUserInfos($r->id_blog);
//print_r($userInfos);
$droit = $userInfos->right;
// Kernel::deb("action=$action / droit=$droit / privacy=".$r->privacy);
switch ($action) {
case "READ":
$can = $droit >= $r->privacy;
if ($r->privacy == 10 && Kernel::is_connected()) {
$can = true;
}
break;
case "ACCESS_ADMIN":
case "ADMIN_ARTICLES":
case "ADMIN_PHOTOS":
case "ADMIN_DOCUMENTS":
$can = $droit >= PROFILE_CCV_VALID;
break;
case "ADMIN_CATEGORIES":
case "ADMIN_COMMENTS":
case "ADMIN_LIENS":
case "ADMIN_PAGES":
case "ADMIN_RSS":
case "ADMIN_ARTICLE_MAKE_ONLINE":
case "ADMIN_ARTICLE_DELETE":
$can = $droit >= PROFILE_CCV_MODERATE;
//$can = false;
break;
case "ADMIN_OPTIONS":
case "ADMIN_DROITS":
case "ADMIN_STATS":
$can = $droit >= PROFILE_CCV_ADMIN;
break;
}
return $can;
}
示例8: doJoin
/**
* Effectue une demande d'inscription � un groupe pour l'utilisateur courant
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2005/11/16
* @param integer $id Id du groupe
*/
public function doJoin()
{
if (!Kernel::is_connected()) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('kernel|kernel.error.nologin'), 'back' => CopixUrl::get('auth|default|login')));
}
$dao = CopixDAOFactory::create("groupe");
$kernel_service =& CopixClassesFactory::Create('kernel|kernel');
$minimail_service =& CopixClassesFactory::Create('minimail|minimailservice');
$groupeService =& CopixClassesFactory::Create('groupe|groupeService');
$id = $this->getRequest('id', null);
$errors = $oks = array();
$groupe = $dao->getGroupe($id);
if (!$groupe) {
$errors[] = CopixI18N::get('groupe|groupe.error.noGroup');
} elseif (!$groupe[0]->is_open) {
$errors[] = CopixI18N::get('groupe|groupe.error.private');
}
$mondroit = $kernel_service->getLevel("CLUB", $id);
if ($mondroit) {
$errors[] = CopixI18N::get('groupe|groupe.error.alreadyMember');
}
if ($errors) {
if (!CopixConfig::exists('|can_group_showlist') || CopixConfig::get('|can_group_showlist')) {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get('groupe||getListPublic')));
} else {
return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get('||')));
}
} else {
$kernel_service->setLevel("CLUB", $id, _currentUser()->getExtra('type'), _currentUser()->getExtra('id'), PROFILE_CCV_SHOW);
CopixCache::clear(_currentUser()->getExtra('type') . '-' . _currentUser()->getExtra('id'), 'getnodeparents');
CopixCache::clear(_currentUser()->getExtra('type') . '-' . _currentUser()->getExtra('id'), 'getmynodes');
// On r�cup�re le propri�taire, afin de lui envoyer un message
$childs = $kernel_service->getNodeChilds("CLUB", $id);
$trouve = false;
foreach ($childs as $child) {
if ($trouve) {
continue;
}
if ($groupeService->canMakeInGroupe('ADMIN', $child["droit"])) {
// Propri�taire trouv� !
$trouve = $child;
}
}
//var_dump($trouve);
/*
while (!$trouve && list(,$child)=each($childs)) {
if ($groupeService->canMakeInGroupe('ADMIN',$child["droit"])) // Propri�taire trouv� !
$trouve = $child;
}
*/
if ($trouve) {
$userInfo = $kernel_service->getUserInfo($trouve["type"], $trouve["id"]);
//print_r2($userInfo);
if ($userInfo && $userInfo["user_id"]) {
$his_nom = _currentUser()->getExtra('prenom') . " " . _currentUser()->getExtra('nom') . " (" . _currentUser()->getExtra('type') . ")";
$msg_from_login = _currentUser()->getLogin();
$msg_title = CopixI18N::get('groupe|groupe.msgJoin.title', array($groupe[0]->titre));
$format = CopixConfig::get('minimail|default_format');
if ($format == 'dokuwiki' || $format == 'wiki') {
$msg_body = CopixI18N::get('groupe|groupe.msgJoin.body', array(CopixUrl::get('groupe||getHomeAdminMembers', array("id" => $id)), $his_nom));
$msg_body = str_replace("\\n", "\n", $msg_body);
} else {
$msg_body = CopixI18N::get('groupe|groupe.msgJoin.bodyHtml', array(CopixUrl::get('groupe||getHomeAdminMembers', array("id" => $id)), $his_nom));
}
//print_r($msg_body);
//die();
$msg_from_id = _currentUser()->getId();
$msg_destin = array($userInfo["user_id"] => 1);
$send = $minimail_service->sendMinimail($msg_title, $msg_body, $msg_from_id, $msg_destin, $format);
if ($send) {
$oks[] = CopixI18N::get('groupe|groupe.msgJoin.Ok');
} else {
$errors[] = CopixI18N::get('groupe|groupe.error.sendJoin');
}
} else {
$errors[] = CopixI18N::get('groupe|groupe.error.owner');
}
} else {
// Pas de proprio, c'est pas normal
$errors[] = CopixI18N::get('groupe|groupe.error.noOwner');
}
$tpl = new CopixTpl();
$tpl->assign('TITLE_PAGE', $groupe[0]->titre);
// $tpl->assign ('MENU', '<a href="'.CopixUrl::get ('groupe||getListPublic').'">'.CopixI18N::get ('groupe|groupe.annuaire').'</a> :: <a href="'.CopixUrl::get ('groupe||getListMy').'">'.CopixI18N::get ('groupe|groupe.my').'</a>');
$tplHome = new CopixTpl();
$tplHome->assign('groupe', $groupe[0]);
$tplHome->assign('errors', $errors);
$tplHome->assign('oks', $oks);
if (!CopixConfig::exists('|can_group_showlist') || CopixConfig::get('|can_group_showlist')) {
$tplHome->assign('can_group_showlist', 1);
} else {
$tplHome->assign('can_group_showlist', 0);
}
//.........这里部分代码省略.........