CS fixes (mostly tab -> spaces)
| | |
| | | */ |
| | | function get_opt($aliases = array()) |
| | | { |
| | | $args = array(); |
| | | for ($i=1; $i < count($_SERVER['argv']); $i++) { |
| | | $arg = $_SERVER['argv'][$i]; |
| | | $value = true; |
| | | $key = null; |
| | | $args = array(); |
| | | |
| | | if ($arg[0] == '-') { |
| | | $key = preg_replace('/^-+/', '', $arg); |
| | | $sp = strpos($arg, '='); |
| | | if ($sp > 0) { |
| | | $key = substr($key, 0, $sp - 2); |
| | | $value = substr($arg, $sp+1); |
| | | } |
| | | else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') { |
| | | $value = $_SERVER['argv'][++$i]; |
| | | } |
| | | for ($i=1; $i < count($_SERVER['argv']); $i++) { |
| | | $arg = $_SERVER['argv'][$i]; |
| | | $value = true; |
| | | $key = null; |
| | | |
| | | $args[$key] = is_string($value) ? preg_replace(array('/^["\']/', '/["\']$/'), '', $value) : $value; |
| | | } |
| | | else |
| | | $args[] = $arg; |
| | | if ($arg[0] == '-') { |
| | | $key = preg_replace('/^-+/', '', $arg); |
| | | $sp = strpos($arg, '='); |
| | | if ($sp > 0) { |
| | | $key = substr($key, 0, $sp - 2); |
| | | $value = substr($arg, $sp+1); |
| | | } |
| | | else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') { |
| | | $value = $_SERVER['argv'][++$i]; |
| | | } |
| | | |
| | | if ($alias = $aliases[$key]) |
| | | $args[$alias] = $args[$key]; |
| | | } |
| | | $args[$key] = is_string($value) ? preg_replace(array('/^["\']/', '/["\']$/'), '', $value) : $value; |
| | | } |
| | | else { |
| | | $args[] = $arg; |
| | | } |
| | | |
| | | return $args; |
| | | if ($alias = $aliases[$key]) { |
| | | $args[$alias] = $args[$key]; |
| | | } |
| | | } |
| | | |
| | | return $args; |
| | | } |
| | | |
| | | |
| | |
| | | $attr = array('href' => $attr); |
| | | } |
| | | return self::tag('a', $attr, $cont, array_merge(self::$common_attrib, |
| | | array('href','target','name','rel','onclick','onmouseover','onmouseout','onmousedown','onmouseup'))); |
| | | array('href','target','name','rel','onclick','onmouseover','onmouseout','onmousedown','onmouseup'))); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | protected $tagname = 'textarea'; |
| | | protected $allowed = array('name','rows','cols','wrap','tabindex', |
| | | 'onchange','disabled','readonly','spellcheck'); |
| | | 'onchange','disabled','readonly','spellcheck'); |
| | | |
| | | /** |
| | | * Get HTML code for this object |
| | |
| | | } |
| | | |
| | | return self::tag($this->tagname, $this->attrib, $value, |
| | | array_merge(self::$common_attrib, $this->allowed)); |
| | | array_merge(self::$common_attrib, $this->allowed)); |
| | | } |
| | | } |
| | | |
| | |
| | | protected $tagname = 'select'; |
| | | protected $options = array(); |
| | | protected $allowed = array('name','size','tabindex','autocomplete', |
| | | 'multiple','onchange','disabled','rel'); |
| | | 'multiple','onchange','disabled','rel'); |
| | | |
| | | /** |
| | | * Add a new option to this drop-down |
| | |
| | | { |
| | | protected $tagname = 'table'; |
| | | protected $allowed = array('id','class','style','width','summary', |
| | | 'cellpadding','cellspacing','border'); |
| | | 'cellpadding','cellspacing','border'); |
| | | |
| | | private $header = array(); |
| | | private $rows = array(); |
| | |
| | | */ |
| | | public function add_header($attr, $cont) |
| | | { |
| | | if (is_string($attr)) |
| | | $attr = array('class' => $attr); |
| | | if (is_string($attr)) { |
| | | $attr = array('class' => $attr); |
| | | } |
| | | |
| | | $cell = new stdClass; |
| | | $cell->attrib = $attr; |
| | |
| | | */ |
| | | public function set_row_attribs($attr = array(), $index = null) |
| | | { |
| | | if (is_string($attr)) |
| | | $attr = array('class' => $attr); |
| | | if (is_string($attr)) { |
| | | $attr = array('class' => $attr); |
| | | } |
| | | |
| | | if ($index === null) |
| | | if ($index === null) { |
| | | $index = $this->rowindex; |
| | | } |
| | | |
| | | $this->rows[$index]->attrib = $attr; |
| | | } |
| | |
| | | */ |
| | | public function get_row_attribs($index = null) |
| | | { |
| | | if ($index === null) |
| | | if ($index === null) { |
| | | $index = $this->rowindex; |
| | | } |
| | | |
| | | return $this->rows[$index] ? $this->rows[$index]->attrib : null; |
| | | } |
| | |
| | | } |
| | | else if ($this->type == 'apc') { |
| | | $data = apc_fetch($this->ckey($key)); |
| | | } |
| | | } |
| | | |
| | | if ($data) { |
| | | $md5sum = md5($data); |
| | |
| | | } |
| | | |
| | | $this->cache[$key] = $data; |
| | | $this->cache_sums[$key] = $md5sum; |
| | | $this->cache_sums[$key] = $md5sum; |
| | | } |
| | | else { |
| | | $this->cache[$key] = null; |
| | |
| | | if (strlen($key) != 24) { |
| | | rcube::raise_error(array( |
| | | 'code' => 500, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Configured crypto key '$key' is not exactly 24 bytes long" |
| | | ), true, true); |
| | | } |
| | |
| | | else |
| | | rcube::raise_error(array( |
| | | 'code' => 500, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Invalid mail_header_delimiter setting" |
| | | ), true, false); |
| | | } |
| | |
| | | |
| | | return array( |
| | | $this->search_string, |
| | | $this->search_set, |
| | | $this->search_charset, |
| | | $this->search_sort_field, |
| | | $this->search_sorted, |
| | | ); |
| | | $this->search_set, |
| | | $this->search_charset, |
| | | $this->search_sort_field, |
| | | $this->search_sorted, |
| | | ); |
| | | } |
| | | |
| | | |
| | |
| | | protected function rsort($folder, $delimiter, &$list, &$out) |
| | | { |
| | | while (list($key, $name) = each($list)) { |
| | | if (strpos($name, $folder.$delimiter) === 0) { |
| | | // set the type of folder name variable (#1485527) |
| | | $out[] = (string) $name; |
| | | unset($list[$key]); |
| | | $this->rsort($name, $delimiter, $list, $out); |
| | | } |
| | | if (strpos($name, $folder.$delimiter) === 0) { |
| | | // set the type of folder name variable (#1485527) |
| | | $out[] = (string) $name; |
| | | unset($list[$key]); |
| | | $this->rsort($name, $delimiter, $list, $out); |
| | | } |
| | | } |
| | | reset($list); |
| | | } |
| | |
| | | # a0 = type context-specific/constructed with a length of 06 (6) bytes following |
| | | # 02 = type integer with 2 bytes following (offset): 01 01 (ie 1) |
| | | # 02 = type integer with 2 bytes following (contentCount): 01 00 |
| | | |
| | | |
| | | # whith a search string present: |
| | | # 81 = type context-specific/constructed with a length of 04 (4) bytes following (the length will change here) |
| | | # 81 indicates a user string is present where as a a0 indicates just a offset search |
| | | # 81 = type context-specific/constructed with a length of 06 (6) bytes following |
| | | |
| | | |
| | | # the following info was taken from the ISO/IEC 8825-1:2003 x.690 standard re: the |
| | | # encoding of integer values (note: these values are in |
| | | # two-complement form so since offset will never be negative bit 8 of the |
| | |
| | | # of the second (to the left of first octet) octet: |
| | | # a) shall not all be ones; and |
| | | # b) shall not all be zero |
| | | |
| | | |
| | | if ($search) |
| | | { |
| | | $search = preg_replace('/[^-[:alpha:] ,.()0-9]+/', '', $search); |
| | |
| | | // now compute length over $str |
| | | $str = self::_ber_addseq($str, 'a0'); |
| | | } |
| | | |
| | | |
| | | // now tack on records per page |
| | | $str = "020100" . self::_ber_addseq(self::_ber_encode_int($rpp-1), '02') . $str; |
| | | |
| | |
| | | class rcube_plugin_api |
| | | { |
| | | static private $instance; |
| | | |
| | | |
| | | public $dir; |
| | | public $url = 'plugins/'; |
| | | public $task = ''; |
| | | public $output; |
| | | |
| | | |
| | | public $handlers = array(); |
| | | private $plugins = array(); |
| | | private $tasks = array(); |
| | |
| | | public function set_keep_alive($keep_alive) |
| | | { |
| | | $this->keep_alive = $keep_alive; |
| | | |
| | | |
| | | if ($this->lifetime < $keep_alive) |
| | | $this->set_lifetime($keep_alive + 30); |
| | | } |
| | |
| | | { |
| | | return $this->ip; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Setter for cookie encryption secret |
| | | */ |
| | |
| | | { |
| | | $this->ip_check = $check; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Setter for the cookie name used for session cookie |
| | | */ |
| | |
| | | $result = true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!$result) |
| | | $this->log("Session authentication failed for " . $this->key . "; invalid auth cookie sent; timeslot = " . date('Y-m-d H:i:s', $prev)); |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * Writes debug information to the log |
| | | */ |
| | | function log($line) |
| | | { |
| | |
| | | $lines[] = $key . ': ' . $value; |
| | | } |
| | | } |
| | | |
| | | |
| | | return array($from, join(SMTP_MIME_CRLF, $lines) . SMTP_MIME_CRLF); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | $data = $rcube->plugins->exec_hook('user_create', |
| | | array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email, 'host'=>$host)); |
| | | array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email, 'host'=>$host)); |
| | | |
| | | // plugin aborted this operation |
| | | if ($data['abort']) |
| | |
| | | |
| | | // from PEAR::Validate |
| | | $regexp = '&^(?: |
| | | ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")| #1 quoted name |
| | | ([-\w!\#\$%\&\'*+~/^`|{}=]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}=]+)*)) #2 OR dot-atom (RFC5322) |
| | | $&xi'; |
| | | ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")| #1 quoted name |
| | | ([-\w!\#\$%\&\'*+~/^`|{}=]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}=]+)*)) #2 OR dot-atom (RFC5322) |
| | | $&xi'; |
| | | |
| | | if (!preg_match($regexp, $local_part)) { |
| | | return false; |
| | |
| | | // %n - host |
| | | $n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']); |
| | | // %t - host name without first part, e.g. %n=mail.domain.tld, %t=domain.tld |
| | | $t = preg_replace('/^[^\.]+\./', '', $n); |
| | | // %d - domain name without first part |
| | | $t = preg_replace('/^[^\.]+\./', '', $n); |
| | | // %d - domain name without first part |
| | | $d = preg_replace('/^[^\.]+\./', '', $_SERVER['HTTP_HOST']); |
| | | // %h - IMAP host |
| | | $h = $_SESSION['storage_host'] ? $_SESSION['storage_host'] : $host; |