Zeile 11 | Zeile 11 |
---|
/** * Find and replace a string in a particular template through every template set. *
|
/** * Find and replace a string in a particular template through every template set. *
|
* @param string The name of the template * @param string The regular expression to match in the template * @param string The replacement string * @param int Set to 1 to automatically create templates which do not exist for that set (based off master) - defaults to 1 * @param mixed Template SID to modify, false for every SID > 0 * @param int The maximum possible replacements for the regular expression
| * @param string $title The name of the template * @param string $find The regular expression to match in the template * @param string $replace The replacement string * @param int $autocreate Set to 1 to automatically create templates which do not exist for sets with SID > 0 (based off master) - defaults to 1 * @param mixed $sid Template SID to modify, false for every SID > 0 and SID = -1 * @param int $limit The maximum possible replacements for the regular expression
|
* @return boolean true if updated one or more templates, false if not. */
| * @return boolean true if updated one or more templates, false if not. */
|
Zeile 24 | Zeile 24 |
---|
{ global $db, $mybb;
|
{ global $db, $mybb;
|
$return = false; $template_sets = array(-2, -1);
| $return = false; $template_sets = array(-2, -1);
|
// Select all templates with that title (including global) if not working on a specific template set $sqlwhere = '>0 OR sid=-1';
| // Select all templates with that title (including global) if not working on a specific template set $sqlwhere = '>0 OR sid=-1';
|
Zeile 39 | Zeile 39 |
---|
}
// Select all other modified templates with that title
|
}
// Select all other modified templates with that title
|
$query = $db->simple_select("templates", "tid, sid, template", "title = '".$db->escape_string($title)."' AND sid{$sqlwhere}");
| $query = $db->simple_select("templates", "tid, sid, template", "title = '".$db->escape_string($title)."' AND (sid{$sqlwhere})");
|
while($template = $db->fetch_array($query)) { // Keep track of which templates sets have a modified version of this template already
| while($template = $db->fetch_array($query)) { // Keep track of which templates sets have a modified version of this template already
|
Zeile 72 | Zeile 72 |
---|
if($master_template['new_template'] != $master_template['template']) { // Update the rest of our template sets that are currently inheriting this template from our master set
|
if($master_template['new_template'] != $master_template['template']) { // Update the rest of our template sets that are currently inheriting this template from our master set
|
$query = $db->simple_select("templatesets", "sid", "sid NOT IN (".implode(',', $template_sets).") AND sid{$sqlwhere2}");
| $query = $db->simple_select("templatesets", "sid", "sid NOT IN (".implode(',', $template_sets).") AND (sid{$sqlwhere2})");
|
while($template = $db->fetch_array($query)) { $insert_template = array(
| while($template = $db->fetch_array($query)) { $insert_template = array(
|