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


PHP Controller::service方法代码示例

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


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

示例1: load_tpl

 static function load_tpl(&$data, $file)
 {
     include_once __DIR__ . '/../library/fileDuck/FileDuck.php';
     $config = array();
     $config['lang'] = 'pt_BR';
     $sql = "SELECT * FROM phpgw_preferences where preference_app = 'common' AND preference_owner IN ( '-2' , '-1' , " . Config::me('uidNumber') . " ) ORDER BY preference_owner";
     $preferences = Controller::service('PostgreSQL')->execResultSql($sql);
     foreach ($preferences as $preference) {
         $values = unserialize($preference['preference_value']);
         if (isset($values['lang'])) {
             $config['lang'] = $values['lang'];
         }
     }
     $config['provider'] = 'expresso';
     $config['YUICompressor'] = false;
     $configProvider = array();
     $configProvider['module'] = 'expressoCalendar';
     if (preg_match('/\\/modules\\/([a-z\\_\\-]+)\\//i', $file, $matches)) {
         $moduleMap = parse_ini_file(__DIR__ . "/../config/moduleMap.ini", true);
         $configProvider['module'] = isset($moduleMap[$matches[1]]) ? $moduleMap[$matches[1]] : 'phpgwapi';
     }
     $fileDuck = new FileDuck($config, $configProvider);
     $fileDuck->add($file, 'ISO-8859-1');
     $tpl = $fileDuck->renderContent();
     foreach ($data as $i => $v) {
         $tpl = str_replace('[' . $i . ']', $v, $tpl);
     }
     return $tpl;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:29,代码来源:parseTPL.php

示例2: futureEventDecodedRepeat

 public static function futureEventDecodedRepeat($startTime, $idSchedulable, $nowMicrotime)
 {
     $sql = 'SELECT calendar_repeat_occurrence.occurrence as "occurrence" ' . 'FROM calendar_repeat, calendar_repeat_occurrence WHERE calendar_repeat_occurrence.occurrence >= \'' . $startTime . '\' ' . 'AND calendar_repeat.object_id = \'' . $idSchedulable . '\' ' . 'AND calendar_repeat.id = calendar_repeat_occurrence.repeat_id AND ' . 'calendar_repeat_occurrence.exception != 1';
     $ocurrences = Controller::service('PostgreSQL')->execResultSql($sql);
     if ($ocurrences) {
         $valid = FALSE;
         foreach ($ocurrences as $value) {
             if ($value['occurrence'] / 1000 > $nowMicrotime) {
                 $valid = true;
                 break;
             }
         }
         return $valid;
     } else {
         return false;
     }
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:17,代码来源:Helpers.php

示例3: findEventsSearch

 function findEventsSearch($summary, $description, $calendars, $timezones, $limit, $offset)
 {
     $sql = ' SELECT calendar_object.id as id ,calendar_object.cal_uid as "uid", calendar_object.type_id as "type", ' . 'calendar_object.dtstart as "startTime", calendar_object.summary as "summary", ' . 'calendar_object.description as "description", calendar_object.dtend as "endTime" , ' . 'calendar_object.priority as "priority", calendar_object.due as "due", ' . 'calendar_object.percentage as "percentage", calendar_object.status as "status", ' . 'calendar_object.location as "location", calendar_object.allday as "allDay", ' . 'calendar_object.transp as "transparent", calendar_object.class_id as "class", ' . 'calendar_object.repeat as "repeat", calendar_object.range_start as "rangeStart", ' . 'calendar_object.range_end as "rangeEnd", calendar_object.last_update as "lastUpdate", ' . 'calendar_object.dtstamp as "dtstamp", calendar_object.sequence as "sequence", ' . 'count(calendar_task_to_activity_object.id) as "tasks", ' . 'calendar_object.tzid as "timezone" ,calendar_to_calendar_object.calendar_id as ' . 'calendar FROM calendar_object left join calendar_task_to_activity_object on ( calendar_object.id = calendar_task_to_activity_object.calendar_object_activity_id  ), calendar_to_calendar_object ' . 'WHERE ( calendar_to_calendar_object.calendar_id IN (\'' . implode('\',\'', $calendars) . '\')) ' . 'AND calendar_to_calendar_object.calendar_object_id = calendar_object.id ' . 'AND calendar_object.id NOT IN(select calendar_object_task_id from calendar_task_to_activity_object where owner = \'' . Config::me('uidNumber') . '\') ';
     $where = 'AND (((upper("summary") like upper(\'%' . $summary . '%\') OR upper("description") like upper(\'%' . $description . '%\'))))
             group by
                 calendar_object.id, calendar_object.cal_uid, calendar_object.type_id,
                 calendar_object.dtstart, calendar_object.summary, calendar_object.description,
                 calendar_object.dtend, calendar_object.priority, calendar_object.due, calendar_object.percentage,
                 calendar_object.status, calendar_object.location, calendar_object.allday, calendar_object.transp,
                 calendar_object.class_id, calendar_object.repeat, calendar_object.range_start, calendar_object.range_end,
                 calendar_object.last_update, calendar_object.dtstamp, calendar_object.sequence,
                 calendar_object.tzid, calendar_to_calendar_object.calendar_id
             ORDER BY
                 dtstart LIMIT ' . $limit . '  OFFSET ' . $offset . ' ';
     $params = Controller::service('PostgreSQL')->execResultSql($sql . $where);
     return $this->normalizeEvents($params, $timezones);
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:17,代码来源:schedules.php

示例4: isEnabledDynamicContacts

 private function isEnabledDynamicContacts($user)
 {
     //recuperando as preferencias (suas preferencias, preferencia padrão, preferencia obrigatoria)
     //dos contatos dinamicos
     $sql = 'SELECT preference_owner, preference_value ' . 'FROM phpgw_preferences ' . 'WHERE preference_app = \'expressoMail\' AND ' . 'preference_owner in (-1,-2, ' . $user . ')';
     $preferences = Controller::service('PostgreSQL')->execResultSql($sql);
     $array = array();
     if (count($preferences) > 0) {
         foreach ($preferences as $preference) {
             //recupera a preferencia
             $preference_value = unserialize($preference['preference_value']);
             //gera um array com o owner e o valor da preferencia:
             //true: SIM  (1)
             //false: NAO (0)
             //null: escolha pelo usuario/ usar padrao / sem padrao
             $value = null;
             if (isset($preference_value['use_dynamic_contacts'])) {
                 $value = isset($preference_value['use_dynamic_contacts']) ? $preference_value['use_dynamic_contacts'] == '1' : false;
             }
             $array[$preference['preference_owner']] = $value;
         }
     }
     //preferencia obrigatoria (SIM)
     if (array_key_exists(-1, $array) && $array[-1]) {
         return true;
     } else {
         if (array_key_exists($user, $array) && $array[$user]) {
             return true;
         } else {
             if (array_key_exists($user, $array) && $array[$user] === null && array_key_exists(-2, $array) && $array[-2]) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:36,代码来源:DynamicContactResource.php

示例5: schedulable2calendarToObject

 private static function schedulable2calendarToObject($Schedulable, $user = false)
 {
     return Controller::service('PostgreSQL')->execResultSql('SELECT calendar_to_calendar_object.id as calendar_to_calendar_Object , calendar.name as calendar_name ,calendar.location as calendar_location, calendar.id as calendar_id FROM calendar_to_calendar_object , calendar , calendar_signature' . ' WHERE calendar_signature.user_uidnumber = ' . $user ? $user : Config::me('uidNumber') . ' AND calendar_signature.calendar_id = calendar.id' . ' AND calendar_to_calendar_object.calendar_id = calendar.id' . ' AND calendar_to_calendar_object.calendar_object_id = ' . addslashes($Schedulable));
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:4,代码来源:iCal.php

示例6: get

 /**
  * Retorna um contato compartilhado 
  *
  * @license    http://www.gnu.org/copyleft/gpl.html GPL
  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @sponsor    Caixa Econômica Federal
  * @author     José Vicente Tezza Jr. 
  * @return     Retorna um contato Compartilhado
  * @access     public
  * */
 function get($request, $id)
 {
     $this->secured();
     $response = new Response($request);
     $response->addHeader('Content-type', 'aplication/json');
     $response->code = Response::OK;
     $h = new Hypermedia();
     $c = new Collection($request->resources, 'SharedGroupResource');
     try {
         //Recupera o contato
         $contact = Controller::find(array('concept' => 'contact'), false, array('filter' => array('=', 'id', $id)));
         if (!$contact) {
             $this->createException($request, $response, Response::NOTFOUND, 'Bad request', 'Resource not found.');
             return $response;
         }
         //Proprietario do contato
         $ownerId = $contact[0]['user'];
         $idS = array(Config::me("uidNumber"));
         $acl = array();
         //Recupera o uidNumber do usuário que compartilhou o grupo com o usuário logado
         $sql = 'SELECT acl_account as "uidNumber", acl_rights as "acl" ' . 'FROM phpgw_acl ' . 'WHERE (acl_location =   \'' . Config::me("uidNumber") . '\' AND acl_appname =  \'contactcenter\' AND acl_account = \'' . $ownerId . '\')';
         $shareds = Controller::service('PostgreSQL')->execResultSql($sql);
         //Verifica o acesso definido para o usuario logado
         $flagContact = false;
         if (!empty($shareds) && $shareds) {
             foreach ($shareds as $s) {
                 array_push($idS, $s['uidNumber']);
                 $acl[$s['uidNumber']] = $this->decodeAcl(decbin($s['acl']));
                 //verifica se o proprietario do contato habilitou o acesso de leitura para o usuario logado
                 if ($s['uidNumber'] == $ownerId && $acl[$s['uidNumber']]['read']) {
                     $flagContact = true;
                 }
             }
         }
         //Se o contato nao esta compartilhado
         if (!$flagContact) {
             $this->createException($request, $response, Response::UNAUTHORIZED, 'unauthorized', 'Resource unauthorized.');
             return $response;
         }
         //Obtem informacoes do proprietario do contato
         $userOwner = Controller::read(array('concept' => 'user', 'service' => 'OpenLDAP'), false, array('filter' => array('=', 'id', $ownerId), 'notExternal' => true));
         if (is_array($userOwner)) {
             $userOwner = $userOwner[0];
         }
         $t = new Template();
         $d = new Data();
         $d->setName('name');
         $d->setValue(null);
         $d->setPrompt('Nome do Contato');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $d = new Data();
         $d->setName('email');
         $d->setValue(null);
         $d->setPrompt('Email do Contato');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $d = new Data();
         $d->setName('telefone');
         $d->setValue(null);
         $d->setPrompt('Telefone do Contato');
         $d->setDataType('string');
         $d->setMaxLength(100);
         $d->setMinLength(null);
         $d->setRequired(true);
         $t->addData($d);
         $c->setTemplate($t);
         $d = new Data();
         $d->setName('name');
         $d->setValue($contact[0]['name']);
         $d->setPrompt('Nome do Contato');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
         $c->addData($d);
         $d = new Data();
         $d->setName('email');
         $d->setValue($contact[0]['email']);
         $d->setPrompt('Email do Contato');
         $d->setDataType('string');
         $d->setMaxLength('100');
         $d->setMinLength(null);
         $d->setRequired(true);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:SharedContactResource.php

示例7: define

<?php

if (!defined('ROOTPATH')) {
    define('ROOTPATH', dirname(__FILE__) . '/../..');
}
require_once ROOTPATH . '/api/controller.php';
require_once ROOTPATH . '/modules/calendar/constants.php';
require_once ROOTPATH . '/api/parseTPL.php';
use prototype\api\Config;
$target = gmdate('U') - 300 . '000';
$parts = Controller::service('PostgreSQL')->execSql('SELECT part.user_info_id as "user", co.id as "schedulable", co.type_id as "type", co.allDay as "allDay" ,co.dtend as "endTime", co.dtstart as "startTime", co.summary as "summary", co.tzid as "timezone", co.location as "location", al.id as "id" FROM calendar_object as co INNER JOIN calendar_alarm al ON co.id = al.object_id JOIN calendar_participant part  ON part.id = al.participant_id LEFT JOIN calendar_repeat rep ON  rep.object_id = co.id  LEFT JOIN calendar_repeat_occurrence occ ON occ.repeat_id = rep.id WHERE ( al.action_id = \'' . ALARM_MAIL . '\' AND al.sent = \'0\' AND CASE WHEN occ.occurrence > 0 THEN occ.occurrence - al.alarm_offset ELSE co.dtstart - al.alarm_offset END BETWEEN \'' . $target . '\' AND \'' . ($target + 360000) . '\') ');
if (!is_array($parts)) {
    return;
}
$ids = array();
foreach ($parts as $i => $part) {
    ///Montando lista de participantes
    $users = Controller::find(array('concept' => 'participant'), array('user', 'id', 'isExternal'), array('filter' => array('=', 'schedulable', $part['schedulable']), 'deepness' => 1));
    $attList = array();
    foreach ($users as $user) {
        if ($part['user'] === $user['user']['id']) {
            $part['mail'] = $user['user']['mail'];
        }
        $attList[] = $user['user']['name'];
    }
    $timezone = new DateTimeZone('UTC');
    $sTime = new DateTime('@' . (int) ($part['startTime'] / 1000), $timezone);
    $eTime = new DateTime('@' . (int) ($part['endTime'] / 1000), $timezone);
    $timezone = $part['timezone'];
    $sTime->setTimezone(new DateTimeZone($part['timezone']));
    $eTime->setTimezone(new DateTimeZone($part['timezone']));
开发者ID:cjvaz,项目名称:expressomail,代码行数:31,代码来源:alarms.php

示例8: allContactsUser

 /**
  * Busca todos os contatos que o usario possui, que sao os seguintes:
  * - contatos dynamicos
  * - contatos pessoais
  * - grupos pessoais
  * - contatos compartilhados
  * - grupos compartilhados
  * Converte nomes acentuados de iso para utf-8 (para o json_encode) e elimina repeticoes.
  * @param string $uidNumber: Id de identificacao do usuario no banco de dados.
  * @return array: Contem a lista dos contatos e o rate maior de um
  * contato dinamico.
  */
 public function allContactsUser($uidNumber)
 {
     $relations = Controller::service('PostgreSQL')->execResultSql("select id_related from phpgw_cc_contact_rels where id_contact='{$uidNumber}' and id_typeof_contact_relation=1");
     $sqlOwnerContacts = '';
     $sqlOwnerGroups = '';
     if (empty($relations)) {
         $sqlOwnerContacts = " A.id_owner={$uidNumber} ";
         $sqlOwnerGroups = " owner={$uidNumber} ";
     } else {
         $idRelations = "{$uidNumber},";
         foreach ($relations as $value) {
             $idRelations .= $value['id_related'] . ',';
         }
         $idRelations = substr($idRelations, 0, -1);
         $sqlOwnerContacts = " A.id_owner in ({$idRelations}) ";
         $sqlOwnerGroups = " owner in ({$idRelations}) ";
     }
     $sql = "select\n\t\t\t\t\tid,\n\t\t\t\t\tname,\n\t\t\t\t\tmail,\n\t\t\t\t\ttext('/dynamiccontacts') as type,\n\t\t\t\t\ttext('/dynamiccontacts') as typel,\n\t\t\t\t\towner,\n\t\t\t\t\tnumber_of_messages\n\t\t\t\tfrom expressomail_dynamic_contact\n\t\t\t\twhere owner={$uidNumber}\n\t\t\t\tunion all\n\t\t\t\tselect A.id_contact as id,\n\t\t\t\t\tA.names_ordered as name,\n\t\t\t\t\tC.connection_value as mail,\n\t\t\t\t\tCASE WHEN A.id_owner='{$uidNumber}' THEN '/personalContact' ELSE '/sharedcontact' END as type,\n\t\t\t\t\tCASE WHEN A.id_owner='{$uidNumber}' THEN '/personalContact' ELSE '/contacts' END as typel,\n\t\t\t\t\tA.id_owner as owner,\n\t\t\t\t\tnull as number_of_messages\n\t\t\t\tfrom phpgw_cc_contact A,\n\t\t\t\t\tphpgw_cc_contact_conns B,\n\t\t\t\t\tphpgw_cc_connections C\n\t\t\t\twhere A.id_contact = B.id_contact and B.id_connection = C.id_connection\n\t\t\t\t\tand B.id_typeof_contact_connection = 1 and\n\t\t\t\t\t{$sqlOwnerContacts}\n\t\t\t\tunion all\n\t\t\t\tselect id_group as id,\n\t\t\t\t\ttitle as name,\n\t\t\t\t\tshort_name as mail,\n\t\t\t\t\tCASE WHEN owner='{$uidNumber}' THEN '/groups' ELSE '/sharedgroup' END as type,\n\t\t\t\t\tCASE WHEN owner='{$uidNumber}' THEN '/groups' ELSE '/groups' END as typel,\n\t\t\t\t    owner,\n\t\t\t\t    null as number_of_messages\n\t\t\t\tfrom phpgw_cc_groups\n\t\t\t\twhere {$sqlOwnerGroups}\n\t\t\t\torder by name";
     $contacts = Controller::service('PostgreSQL')->execResultSql($sql);
     $total = count($contacts);
     $topContact = 0;
     $arrContacts = array('dynamiccontacts' => array(), 'personalContact' => array(), 'groups' => array(), 'sharedcontact' => array(), 'sharedgroup' => array());
     $tmp = array();
     for ($x = 0; $x < $total; $x++) {
         $contacts[$x]['name'] = mb_convert_encoding($contacts[$x]['name'], 'UTF-8', 'UTF-8 , ISO-8859-1');
         $contacts[$x]['value'] = empty($contacts[$x]['name']) ? $contacts[$x]['mail'] : $contacts[$x]['name'] . ' - ' . $contacts[$x]['mail'];
         if ($contacts[$x]['number_of_messages'] === null) {
             unset($contacts[$x]['number_of_messages']);
         } else {
             $topContact = $contacts[$x]['number_of_messages'] > $topContact ? $contacts[$x]['number_of_messages'] : $topContact;
         }
         // Se a lista de contatos contiver emails repetidos seguir
         // a seguinte regra:
         // os emails do contato pessoal sempre prevalecem,
         // seguidos pelo contato compartilhado. Contato dinamico
         // soh aparecera se nao contiver em nenhum outro catalogo
         // do usuario. Logica:
         // email X == Y verificar:
         // ->se X eh dinamico e o Y eh pessoal
         // 	 ->nao adiciona
         // ->se X eh compartilhado e o Y eh pessoal
         // 	 ->nao adiciona
         // ->se X eh dynamico e o Y eh compartilhado
         // 	 ->nao adiciona
         $addToArray = true;
         for ($y = 0; $y < $total; $y++) {
             if ($contacts[$x]['mail'] == $contacts[$y]['mail'] && ($contacts[$x]['type'] === '/dynamiccontacts' && $contacts[$y]['type'] === '/personalContact' || $contacts[$x]['type'] === '/sharedcontact' && $contacts[$y]['type'] === '/personalContact' || $contacts[$x]['type'] === '/dynamiccontacts' && $contacts[$y]['type'] === '/sharedcontact')) {
                 $addToArray = false;
                 break;
             }
         }
         /*
          */
         if ($addToArray === true) {
             switch ($contacts[$x]['type']) {
                 case '/dynamiccontacts':
                     $arrContacts['dynamiccontacts'][] = $contacts[$x];
                     break;
                 case '/personalContact':
                     $arrContacts['personalContact'][] = $contacts[$x];
                     break;
                 case '/groups':
                     $arrContacts['groups'][] = $contacts[$x];
                     break;
                 case '/sharedcontact':
                     $arrContacts['sharedcontact'][] = $contacts[$x];
                     break;
                 case '/sharedgroup':
                     $arrContacts['sharedgroup'][] = $contacts[$x];
                     break;
             }
         }
     }
     $return['contacts'] = array_merge($arrContacts['dynamiccontacts'], $arrContacts['personalContact'], $arrContacts['groups'], $arrContacts['sharedcontact'], $arrContacts['sharedgroup']);
     $return['topContact'] = $topContact;
     return $return;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:89,代码来源:CatalogDBMapping.php

示例9: foreach

 foreach ($users as $key => $value) {
     /*	
     
     	 SELECT * FROM  
     		calendar_object as co inner join
     		calendar_to_calendar_object as ctco on
     		ctco.calendar_object_id = co.id
     		WHERE (range_start >=  1331434800000 AND range_end <= 1332039600000) AND 
     		ctco.calendar_id IN(5)
     	
     	 SELECT * FROM  
     		calendar_object WHERE (range_start >=  1331434800000 AND range_end <= 1332039600000 AND id IN 
     		( SELECT calendar_object_id from calendar_to_calendar_object where calendar_id IN (5)  ))
     */
     $sql = 'SELECT calendar_object.range_start as "startTime" , calendar_object.range_end as "endTime", calendar_object.allday as "allDay", calendar_object.tzid as "timezone" FROM calendar_object WHERE (' . '((range_start >=  ' . $data['startTime'] . ' AND range_start <= ' . $data['endTime'] . ')' . ' OR (range_end >=  ' . $data['startTime'] . ' AND range_end <= ' . $data['endTime'] . ')' . ' OR (range_start <=  ' . $data['startTime'] . ' AND range_end >= ' . $data['endTime'] . ') )' . ' AND transp = 0  AND id IN ( SELECT calendar_object_id from calendar_to_calendar_object where ' . 'calendar_id IN (SELECT calendar_id FROM calendar_signature WHERE (user_uidnumber = ' . $value['id'] . '  AND is_owner = 1 ))  )' . 'AND (calendar_object.id NOT IN (SELECT calendar_object_activity_id FROM calendar_task_to_activity_object)' . 'OR calendar_object.type_id = 1))';
     $result = Controller::service('PostgreSQL')->execResultSql($sql);
     if (!count($result)) {
         continue;
     }
     $disponibilyUser = array();
     $startTime = new DateTime('now', new DateTimeZone($data['timezone']));
     $endTime = new DateTime('now', new DateTimeZone($data['timezone']));
     foreach ($result as $ke => $va) {
         $startTime->setTimestamp((int) ($va['startTime'] / 1000));
         $endTime->setTimestamp((int) ($va['endTime'] / 1000));
         array_push($disponibilyUser, array('startTime' => $startTime->format('U') + $startTime->format('O') * 36 . '000', 'endTime' => $endTime->format('U') + $startTime->format('O') * 36 . '000', 'allDay' => $va['allDay']));
         /* 
         		*
         		* A implementação abaixo une eventos que convergem os horários
         		*
         		
开发者ID:cjvaz,项目名称:expressomail,代码行数:30,代码来源:mapDisponibility.php

示例10: applySieveFilter

 /**
  * Método que aplica o filtro para as mensagens do usuário.
  *
  * @license    http://www.gnu.org/copyleft/gpl.html GPL
  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @sponsor    Caixa Econômica Federal
  * @author     Airton Bordin Junior <airton@prognus.com.br>
  * @author	  Gustavo Pereira dos Santos <gustavo@prognus.com.br>
  * @param      <$uri>
  * @param      <$result>
  * @param      <$criteria>
  * @param      <$original>
  * @access     <public>
  */
 public function applySieveFilter(&$uri, &$result, &$criteria, $original)
 {
     $rule_apply = array();
     $filter = Controller::read($uri);
     $filter_ = $this->parseSieveScript($filter['content']);
     foreach ($filter_ as $f_) {
         if ($f_['id'] == $uri['id']) {
             $rule_apply = $f_;
         }
     }
     $actions = array();
     $actions['type'] = $rule_apply['actions'][0]['type'];
     $actions['parameter'] = $rule_apply['actions'][0]['parameter'];
     $actions['keep'] = is_array($rule_apply['actions'][1]);
     if ($actions['keep']) {
         $actions['value'] = $rule_apply['actions'][0]['parameter'];
     }
     //$messages = $rule_apply['applyMessages'];
     $messages = $this->msgs_apply[0];
     $this->msgs_apply = array();
     $imap = Controller::service('Imap');
     $imap->apliSieveFilter($messages, $actions);
     return $result;
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:38,代码来源:FilterMapping.php

示例11: validateNumberSlots

 public function validateNumberSlots(&$uri, &$params, &$criteria, $original)
 {
     $used = Controller::read(array('concept' => 'label', 'id' => '1'), array('id'), array('uid' => Config::me('uidNumber')));
     if (!isset($used['id'])) {
         $params['id'] = '1';
         return;
     }
     $max = Controller::service('PostgreSQL')->execSql("SELECT config_value as value FROM phpgw_config where config_app = 'expressoMail' and config_name = 'expressoMail_limit_labels' LIMIT 1");
     $total = Controller::service('PostgreSQL')->execSql("SELECT count(id) as value FROM expressomail_label WHERE user_id = " . Config::me('uidNumber'));
     if ($total >= $max) {
         throw new Exception('#LabelSlotError');
     }
     $slot = Controller::service('PostgreSQL')->execSql('SELECT label.slot + 1 as id FROM expressomail_label as label, phpgw_config as config WHERE label.user_id = ' . Config::me('uidNumber') . ' AND config.config_name = \'expressoMail_limit_labels\' AND label.slot <= config.config_value::integer AND ( SELECT count(slot) FROM expressomail_label WHERE slot = label.slot + 1 AND user_id = ' . Config::me('uidNumber') . ' ) = 0 limit 1', true);
     if (empty($slot)) {
         throw new Exception('#LabelSlotError');
     }
     $params['id'] = $slot['id'];
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:18,代码来源:Helpers.php

示例12: dirname

<?php

require_once dirname(__FILE__) . '/api/controller.php';
use prototype\api\Config;
$uidNumber = Config::me('uidNumber') ? Config::me('uidNumber') : $_SESSION['phpgw_info']['expressomail']['user']['account_id'];
$me = Controller::read(array('concept' => 'user', 'service' => 'OpenLDAP', 'id' => $uidNumber));
$sql = "SELECT * FROM phpgw_preferences where preference_app = 'common' AND preference_owner IN ( '-2' , '-1' , {$me['id']} ) ORDER BY preference_owner DESC";
$preferences = Controller::service('PostgreSQL')->execResultSql($sql);
foreach ($preferences as $preference) {
    $values = unserialize($preference['preference_value']);
    if (isset($values['lang'])) {
        $me['lang'] = $values['lang'];
    }
}
echo json_encode($me);
开发者ID:cjvaz,项目名称:expressomail,代码行数:15,代码来源:me.php

示例13: findPersonalContacts

 static function findPersonalContacts($search_for)
 {
     $query = 'select' . ' C.id_connection,' . ' A.id_contact,' . ' A.names_ordered,' . ' A.alias,' . ' A.birthdate,' . ' A.sex,' . ' A.pgp_key,' . ' A.notes,' . ' A.web_page,' . ' A.corporate_name,' . ' A.job_title,' . ' A.department,' . ' C.connection_name,' . ' C.connection_value,' . ' B.id_typeof_contact_connection,' . ' phpgw_cc_contact_addrs.id_typeof_contact_address,' . ' phpgw_cc_addresses.address1,' . ' phpgw_cc_addresses.address2,' . ' phpgw_cc_addresses.complement,' . ' phpgw_cc_addresses.postal_code,' . ' phpgw_cc_city.city_name,' . ' phpgw_cc_state.state_name,' . ' phpgw_cc_addresses.id_country';
     $query .= ' from' . ' phpgw_cc_contact A' . ' inner join phpgw_cc_contact_conns B on ( A.id_contact = B.id_contact )' . ' inner join phpgw_cc_connections C on ( B.id_connection = C.id_connection )' . ' left join phpgw_cc_contact_addrs on ( A.id_contact = phpgw_cc_contact_addrs.id_contact )' . ' left join phpgw_cc_addresses on ( phpgw_cc_contact_addrs.id_address = phpgw_cc_addresses.id_address )' . ' left join phpgw_cc_city on ( phpgw_cc_addresses.id_city = phpgw_cc_city.id_city )' . ' left join phpgw_cc_state on ( phpgw_cc_addresses.id_state = phpgw_cc_state.id_state)';
     $query .= ' where ' . 'A.id_owner=' . Config::me('uidNumber') . ' and lower(translate(names_ordered, \'áàâãäéèêëíìïóòôõöúùûüÁÀÂÃÄÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜçÇñÑ\',\'aaaaaeeeeiiiooooouuuuAAAAAEEEEIIIOOOOOUUUUcCnN\'))' . ' LIKE lower(translate(\'%' . $search_for . '%\', \'áàâãäéèêëíìïóòôõöúùûüÁÀÂÃÄÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜçÇñÑ\',\'aaaaaeeeeiiiooooouuuuAAAAAEEEEIIIOOOOOUUUUcCnN\'))';
     //Se não existir parametro na busca, limita os usuarios no resultado da pesquisa.
     if (!$search_for) {
         $query .= 'LIMIT 11';
     }
     $r = Controller::service('PostgreSQL')->execResultSql($query);
     $all_contacts = array();
     foreach ($r as $i => $object) {
         if (!array_key_exists($object['id_contact'], $all_contacts)) {
             $all_contacts[$object['id_contact']] = array('connection_value' => '', 'telephonenumber' => '', 'mobile' => '', 'cn' => '', 'id_contact' => '', 'id_connection' => '', 'alias' => '', 'birthdate' => '', 'sex' => '', 'pgp_key' => '', 'notes' => '', 'web_page' => '', 'corporate_name' => '', 'job_title' => '', 'department' => '', 'mail' => '', 'aternative-mail' => '', 'business-phone' => '', 'business-address' => '', 'business-complement' => '', 'business-postal_code' => '', 'business-city_name' => '', 'business-state_name' => '', 'business-id_country' => '', 'business-fax' => '', 'business-pager' => '', 'business-mobile' => '', 'business-address-2' => '', 'home-phone' => '', 'home-address' => '', 'home-complement' => '', 'home-postal_code' => '', 'home-city_name' => '', 'home-state_name' => '', 'home-fax' => '', 'home-pager' => '', 'home-address-2' => '');
         }
         switch ($object['id_typeof_contact_connection']) {
             case 1:
                 $all_contacts[$object['id_contact']]['connection_value'] = $object['connection_value'];
                 switch (strtolower($object['connection_name'])) {
                     case 'alternativo':
                         $all_contacts[$object['id_contact']]['alternative-mail'] = $object['connection_value'];
                         break;
                     case 'principal':
                         $all_contacts[$object['id_contact']]['mail'] = $object['connection_value'];
                         break;
                 }
                 break;
             case 2:
                 $all_contacts[$object['id_contact']]['telephonenumber'] = $object['connection_value'];
                 switch (strtolower($object['connection_name'])) {
                     case 'casa':
                         $all_contacts[$object['id_contact']]['home-phone'] = $object['connection_value'];
                         break;
                     case 'celular':
                         $all_contacts[$object['id_contact']]['mobile'] = $object['connection_value'];
                         break;
                     case 'trabalho':
                         $all_contacts[$object['id_contact']]['business-phone'] = $object['connection_value'];
                         break;
                     case 'fax':
                         $all_contacts[$object['id_contact']]['home-fax'] = $object['connection_value'];
                         break;
                     case 'pager':
                         $all_contacts[$object['id_contact']]['home-pager'] = $object['connection_value'];
                         break;
                     case 'celular corporativo':
                         $all_contacts[$object['id_contact']]['business-mobile'] = $object['connection_value'];
                         break;
                     case 'pager corporativo':
                         $all_contacts[$object['id_contact']]['business-pager'] = $object['connection_value'];
                         break;
                     case 'fax corporativo':
                         $all_contacts[$object['id_contact']]['business-fax'] = $object['connection_value'];
                         break;
                 }
                 break;
         }
         $all_contacts[$object['id_contact']]['cn'] = utf8_encode($object['names_ordered']);
         $all_contacts[$object['id_contact']]['id_contact'] = $object['id_contact'];
         $all_contacts[$object['id_contact']]['id_connection'] = $object['id_connection'];
         $all_contacts[$object['id_contact']]['alias'] = $object['alias'];
         $all_contacts[$object['id_contact']]['birthdate'] = $object['birthdate'];
         $all_contacts[$object['id_contact']]['sex'] = $object['sex'];
         $all_contacts[$object['id_contact']]['pgp_key'] = $object['pgp_key'];
         $all_contacts[$object['id_contact']]['notes'] = $object['notes'];
         $all_contacts[$object['id_contact']]['web_page'] = $object['web_page'];
         $all_contacts[$object['id_contact']]['corporate_name'] = $object['corporate_name'];
         $all_contacts[$object['id_contact']]['job_title'] = $object['job_title'];
         $all_contacts[$object['id_contact']]['department'] = $object['department'];
         switch ($object['id_typeof_contact_address']) {
             case 1:
                 $all_contacts[$object['id_contact']]['business-address'] = $object['address1'];
                 $all_contacts[$object['id_contact']]['business-address-2'] = $object['address2'];
                 $all_contacts[$object['id_contact']]['business-complement'] = $object['complement'];
                 $all_contacts[$object['id_contact']]['business-postal_code'] = $object['postal_code'];
                 $all_contacts[$object['id_contact']]['business-city_name'] = $object['city_name'];
                 $all_contacts[$object['id_contact']]['business-state_name'] = $object['state_name'];
                 $all_contacts[$object['id_contact']]['business-id_country'] = $object['id_country'];
                 break;
             case 2:
                 $all_contacts[$object['id_contact']]['home-address'] = $object['address1'];
                 $all_contacts[$object['id_contact']]['home-address-2'] = $object['address2'];
                 $all_contacts[$object['id_contact']]['home-complement'] = $object['complement'];
                 $all_contacts[$object['id_contact']]['home-postal_code'] = $object['postal_code'];
                 $all_contacts[$object['id_contact']]['home-city_name'] = $object['city_name'];
                 $all_contacts[$object['id_contact']]['home-state_name'] = $object['state_name'];
                 $all_contacts[$object['id_contact']]['home-id_country'] = $object['id_country'];
                 break;
         }
     }
     $all = array_values($all_contacts);
     $result = array();
     foreach ($all as $i => $v) {
         if (!$v['mail']) {
             continue;
         }
         $tmp = array();
         $tmp['mail'] = $v['mail'];
         $tmp['name'] = $v['cn'];
         $tmp['isExternal'] = '1';
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:DBMapping.php


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