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


PHP Domain::singleton方法代码示例

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


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

示例1: validate_form

 /**
  *  validate html form 
  *
  *  @param array $errors    array with error messages
  *  @return bool            TRUE if given values of form are OK, FALSE otherwise
  */
 function validate_form(&$errors)
 {
     global $lang_str, $data, $config;
     if ($this->action['action'] == "insert") {
         if (!$this->validate_number_of_entries($errors)) {
             return false;
         }
         return true;
     }
     if ($this->action['action'] == 'create') {
         if (!$this->validate_number_of_entries($errors)) {
             return false;
         }
     }
     if ($this->action['action'] == 'edit' or $this->action['action'] == 'update' or $this->action['action'] == 'delete') {
         if (!$this->is_edit_allowed($this->edit['un'], $this->edit['did'])) {
             $errors[] = $lang_str['err_uri_modify_not_permited'];
             return false;
         }
     }
     if ($this->action['action'] == 'edit' or $this->action['action'] == 'delete') {
         return true;
     }
     $form_ok = true;
     if (false === parent::validate_form($errors)) {
         $form_ok = false;
     }
     if (!isset($_POST['uri_is_canon'])) {
         $_POST['uri_is_canon'] = 0;
     }
     if (!$this->check_did($_POST['uri_did'])) {
         $d =& Domain::singleton();
         $errors[] = "Operation failed: You haven't access to domain: " . $d->get_domain_name($did);
         return false;
     }
     if ($_POST['uri_is_canon']) {
         if (!$this->check_canon_flag()) {
             return false;
         }
     }
     /* Check wheteher URI is unique */
     $opt = array();
     $opt['filter']['username'] = new Filter("username", $_POST['uri_un'], "=", false, false);
     $opt['filter']['did'] = new Filter("did", $_POST['uri_did'], "=", false, false);
     $opt['filter']['scheme'] = new Filter("scheme", "sip", "=", false, false);
     if (false === ($dups = $data->get_uris(null, $opt))) {
         return false;
     }
     if ($dups) {
         $dup = reset($dups);
         if ($this->action['action'] == "update" and count($dups) == 1 and $dup->username == $this->edit_uri->username and $dup->did == $this->edit_uri->did and $dup->scheme == $this->edit_uri->scheme and $dup->uid == $this->edit_uri->uid) {
         } else {
             $errors[] = $lang_str['err_ri_dup'];
             $form_ok = false;
         }
     }
     return $form_ok;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:64,代码来源:apu_uri_user.php

示例2: validate_form

 function validate_form(&$errors)
 {
     global $lang_str, $data;
     if (false === parent::validate_form($errors)) {
         return false;
     }
     $did = $_POST['al_domain'];
     if (!$this->check_did($did)) {
         $d =& Domain::singleton();
         $errors[] = "You haven't access to domain which you selected: " . $d->get_domain_name($did);
         return false;
     }
     // check if admin has parmission to changed URI and if has not, return flase
     if ($_POST['al_id_d'] != "" and !$this->check_did($_POST['al_id_d'])) {
         $errors[] = "Can not update, you have not access to this URI";
         return false;
     }
     if (!empty($_POST['al_is_canon'])) {
         // chenck if cannonical flag in other URI may be cleared
         $uri_handler =& URIs::singleton($this->user_id->get_uid());
         if (false === ($uris = $uri_handler->get_URIs())) {
             return false;
         }
         foreach ($uris as $k => $v) {
             if ($v->is_canonical() and !$this->check_did($v->get_did())) {
                 $errors[] = $lang_str['err_canon_uri_exists'];
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:32,代码来源:apu_aliases.php


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