Changeset 260
- Timestamp:
- 07/04/08 02:17:44 (5 months ago)
- Files:
-
- trunk/Phergie/Plugin/Set.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Plugin/Set.php
r223 r260 34 34 if (preg_match('#^(' . str_replace('.', '\\.', $var) . '\s*= *)(.*)$#im', $contents, $m)) { 35 35 $contents = preg_replace('#^' . str_replace('.', '\\.', $var) . '\s*=.*$#im', $var . ' = ' . str_replace('$', '\\$', $this->makeIniValue($value, $m[2], $append)), $contents); 36 $this->setIni($var, $this->parseIniValue($this->makeIniValue($value, $m[2], $append )));37 $this->doNotice($user, 'Updated Setting: ' . $var . ' = ' . $this-> getIni($var));36 $this->setIni($var, $this->parseIniValue($this->makeIniValue($value, $m[2], $append, true))); 37 $this->doNotice($user, 'Updated Setting: ' . $var . ' = ' . $this->makeIniValue($this->getIni($var))); 38 38 // Insert it if not set 39 39 } else { 40 40 $contents .= PHP_EOL . $var . ' = ' . $this->makeIniValue($value); 41 41 $this->setIni($var, $this->parseIniValue($value)); 42 $this->doNotice($user, 'Inserted Setting: ' . $var . ' = ' . $this-> getIni($var));42 $this->doNotice($user, 'Inserted Setting: ' . $var . ' = ' . $this->makeIniValue($this->getIni($var))); 43 43 } 44 44 // Save ini file … … 56 56 $user = $this->event->getNick(); 57 57 if ($this->fromAdmin(true)) { 58 $this->do Privmsg($this->event->getSource(), $var . ' = ' . $this->getIni($var));58 $this->doNotice($user, $var . ' = ' . $this->makeIniValue($this->getIni($var))); 59 59 } else { 60 60 $this->doNotice($user, 'You do not have permission to get any settings.'); … … 65 65 * Builds a ini value 66 66 */ 67 protected function makeIniValue($new, $old = "", $append = false )67 protected function makeIniValue($new, $old = "", $append = false, $noquotes = false) 68 68 { 69 69 $new = trim($new, "\" '"); … … 71 71 72 72 if ($append && !empty($old)) { 73 return '"' . $old . ', ' . $new . '"';73 return ($noquotes?'':'"') . $old . ', ' . $new . ($noquotes?'':'"'); 74 74 } 75 75 … … 81 81 return (strtolower($new) != 'null' ? $new : ''); 82 82 } else { 83 return '"' . $new . '"';83 return ($noquotes?'':'"') . $new . ($noquotes?'':'"'); 84 84 } 85 85 }