Exemplo n.º 1
0
 /**
  * Replace serialized values (callback)
  *
  * @param  array  $matches List of matches
  * @return string
  */
 public function replaceSerializedValues($matches)
 {
     // Unescape MySQL special characters
     $input = MysqlUtility::unescapeMysql($matches[1]);
     // Replace serialized values
     $input = MysqlUtility::replaceSerializedValues($this->getOldReplaceValues(), $this->getNewReplaceValues(), $input);
     // Prepare query values
     return "'" . mysql_real_escape_string($input, $this->getConnection()) . "'";
 }
Exemplo n.º 2
0
	/**
	 * Replace table values
	 *
	 * @param  string $input Table value
	 * @return string
	 */
	public function replaceTableValues($input)
	{
		$old = $this->getOldReplaceValues();
		$new = $this->getNewReplaceValues();

		$oldValues = array();
		$newValues = array();

		// Replace strings
		for ($i = 0; $i < count($old); $i++) {
			if (!empty($old[$i]) && ($old[$i] != $new[$i]) && !in_array($old[$i], $oldValues)) {
				$oldValues[] = $old[$i];
				$newValues[] = $new[$i];
			}
		}

		// Replace table prefix
		$oldValues[] = $this->getOldTablePrefix();
		$newValues[] = $this->getNewTablePrefix();

		// Replace table values
		$input = str_replace($oldValues, $newValues, $input);

		// Verify serialization
		return MysqlUtility::pregReplace(
			$input,
			'/s:(\d+):([\\\\]?"[\\\\]?"|[\\\\]?"((.*?)[^\\\\])[\\\\]?");/'
		);
	}