Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7002f7c
Swap apache_request_headers() for
da2x Oct 23, 2016
6b38ff3
Revert "Revert "Tell robots to not index error pages (#820)""
philwareham Oct 28, 2016
7966de0
Update txplib_publish.php
bloatware Oct 28, 2016
4872c74
Don't process atts twice
bloatware Oct 28, 2016
7476063
Include feed type attr in feed_link
da2x Oct 25, 2016
12150e1
Merge pull request #822 from Aeyoun/bugfix_taghandler_feedtypes
bloatware Oct 30, 2016
c4c6c02
House style
philwareham Oct 30, 2016
7e38c00
Latest build of public side theme
philwareham Oct 31, 2016
94d3c74
Update zxcvbn to v4.4.1
philwareham Nov 1, 2016
d54c9bc
Revert atm
bloatware Nov 1, 2016
0ef751f
Revert $txp_current_tag
bloatware Nov 1, 2016
f9919e1
Conditional <txp:hide />
bloatware Nov 2, 2016
7a7afe2
Use new conditional hide tag in public theme
philwareham Nov 2, 2016
d6a968b
Tidy up comments
philwareham Nov 2, 2016
2e36a15
AJAX saving of stylesheets
Bloke Nov 2, 2016
e7abd39
Merge branch 'dev' of https://github.com/textpattern/textpattern into…
Bloke Nov 2, 2016
ac521e7
Todo todone
Bloke Nov 2, 2016
92d0752
Merge pull request #811 from Aeyoun/drop_apache_request_headers
Bloke Nov 2, 2016
3c483dc
Empty trap
bloatware Nov 3, 2016
4c6608d
Fix feed delta implementation.
da2x Nov 3, 2016
4708dc5
Merge pull request #831 from Aeyoun/feature_delta_feeds
philwareham Nov 3, 2016
7da3756
House style
philwareham Nov 4, 2016
6662f12
Fix conflicts
philwareham Nov 4, 2016
9e2a3d5
Merge branch 'Aeyoun-bugfix_pull831_followup' into dev
philwareham Nov 4, 2016
c696d2a
Add JSON for release and prerelease versions
petecooper Nov 5, 2016
4806a6d
Namespace an' stuff
petecooper Nov 5, 2016
829ac04
Top-level namespace, second-level variable names
petecooper Nov 5, 2016
e7be92c
Merge pull request #833 from petecooper/json-version
philwareham Nov 5, 2016
35159a0
Remove really old update scripts
philwareham Nov 5, 2016
ab2683d
Lost $pretext
bloatware Nov 6, 2016
58eaafc
Files gone now
philwareham Nov 6, 2016
4891d8d
What is this 'textile' variable for?
Bloke Nov 7, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Textpattern CMS",
"description": "Textpattern is a flexible, elegant and easy-to-use CMS.",
"homepage": "http://textpattern.com",
"textpattern-version": {
"release": "4.6.2",
"prerelease": null
}
}
2 changes: 0 additions & 2 deletions textpattern/checksums.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
/publish/search.php: 3d7e0fcea6f40d31dae8c7fb208e35e6
/publish/taghandlers.php: 5653e0dcd45db67c5607db6d386738fb
/textpattern.js: d7654c4b09d4b59f08d72a0701e91771
/update/_to_1.0.0.php: 038fee881209aae809666177852f0c64
/update/_to_4.0.2.php: 2fda6b67e48855a503d31b226739c1e8
/update/_to_4.0.3.php: 0ed87e575b17dc7a5c96ae68a3d16397
/update/_to_4.0.4.php: bf3676db9029bcd37c2df43bef3443f0
/update/_to_4.0.5.php: fa4026347c767cfbd6450cd98c9e37f6
Expand Down
38 changes: 4 additions & 34 deletions textpattern/include/txp_article.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,12 +866,7 @@ function article_edit($message = '', $concurrent = false, $refresh_partials = fa
$rs['partials_meta'] = &$partials;

// Get content for volatile partials.
foreach ($partials as $k => $p) {
if ($p['mode'] == PARTIAL_VOLATILE || $p['mode'] == PARTIAL_VOLATILE_VALUE) {
$cb = $p['cb'];
$partials[$k]['html'] = (is_array($cb) ? call_user_func($cb, $rs, $k) : $cb($rs, $k));
}
}
$partials = updatePartials($partials, $rs, array(PARTIAL_VOLATILE, PARTIAL_VOLATILE_VALUE));

if ($refresh_partials) {
$response[] = announce($message);
Expand All @@ -883,40 +878,15 @@ function article_edit($message = '', $concurrent = false, $refresh_partials = fa
$response[] = '$("#article_form").addClass("published").removeClass("saved")';
}

// Update the volatile partials.
foreach ($partials as $k => $p) {
// Volatile partials need a target DOM selector.
if (empty($p['selector']) && $p['mode'] != PARTIAL_STATIC) {
trigger_error("Empty selector for partial '$k'", E_USER_ERROR);
} else {
// Build response script.
list($selector, $fragment) = (array)$p['selector'] + array(null, null);
if (!isset($fragment)) {
$fragment = $selector;
}
if ($p['mode'] == PARTIAL_VOLATILE) {
// Volatile partials replace *all* of the existing HTML
// fragment for their selector with the new one.
$response[] = '$("'.$selector.'").replaceWith($("<div>'.escape_js($p['html']).'</div>").find("'.$fragment.'"))';
} elseif ($p['mode'] == PARTIAL_VOLATILE_VALUE) {
// Volatile partial values replace the *value* of elements
// matching their selector.
$response[] = '$("'.$selector.'").val("'.escape_js($p['html']).'")';
}
}
}
$response = array_merge($response, updateVolatilePartials($partials));
send_script_response(join(";\n", $response));

// Bail out.
return;
}

foreach ($partials as $k => $p) {
if ($p['mode'] == PARTIAL_STATIC) {
$cb = $p['cb'];
$partials[$k]['html'] = (is_array($cb) ? call_user_func($cb, $rs, $k) : $cb($rs, $k));
}
}
// Get content for static partials.
$partials = updatePartials($partials, $rs, PARTIAL_STATIC);

$page_title = $ID ? $Title : gTxt('write');

Expand Down
188 changes: 147 additions & 41 deletions textpattern/include/txp_css.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,24 @@
/**
* Renders a list of stylesheets.
*
* @param string $current The active stylesheet
* @param string $default Not used
* @param array $current Current record set of the edited sheet
* @return string HTML
*/

function css_list($current, $default)
function css_list($current)
{
$out = array();
$protected = safe_column("DISTINCT css", 'txp_section', "1 = 1");

$criteria = 1;
$criteria .= callback_event('admin_criteria', 'css_list', 0, $criteria);

$rs = safe_rows_start("name", 'txp_css', $criteria);
$rs = safe_rows_start("name", 'txp_css', $criteria . ' ORDER BY name');

if ($rs) {
while ($a = nextRow($rs)) {
extract($a);
$active = ($current === $name);
$active = ($current['name'] === $name);

$edit = eLink('css', '', 'name', $name, $name);

Expand All @@ -106,48 +105,73 @@ function css_list($current, $default)
/**
* The main stylesheet editor panel.
*
* @param string|array $message The activity message
* @param string|array $message The activity message
* @param bool $refresh_partials Whether to refresh partial contents
*/

function css_edit($message = '')
function css_edit($message = '', $refresh_partials = false)
{
global $event, $step;

pagetop(gTxt('edit_css'), $message);

$default_name = safe_field("css", 'txp_section', "name = 'default'");
/*
$partials is an array of:
$key => array (
'mode' => {PARTIAL_STATIC | PARTIAL_VOLATILE | PARTIAL_VOLATILE_VALUE},
'selector' => $DOM_selector or array($selector, $fragment) of $DOM_selectors,
'cb' => $callback_function,
'html' => $return_value_of_callback_function (need not be intialised here)
)
*/
$partials = array(
// Stylesheet list.
'list' => array(
'mode' => PARTIAL_VOLATILE,
'selector' => '#all_styles',
'cb' => 'css_list',
),
// Name field.
'name' => array(
'mode' => PARTIAL_VOLATILE,
'selector' => 'div.name',
'cb' => 'css_partial_name',
),
// Name value.
'name_value' => array(
'mode' => PARTIAL_VOLATILE_VALUE,
'selector' => '#new_style,input[name=name]',
'cb' => 'css_partial_name_value',
),
// Textarea.
'css' => array(
'mode' => PARTIAL_STATIC,
'selector' => 'div.css',
'cb' => 'css_partial_css',
),
);

extract(array_map('assert_string', gpsa(array(
'copy',
'save_error',
'savenew',
))));

$default_name = safe_field("css", 'txp_section', "name = 'default'");

$name = sanitizeForPage(assert_string(gps('name')));
$newname = sanitizeForPage(assert_string(gps('newname')));
$class = 'async';

if ($step == 'css_delete' || empty($name) && $step != 'pour' && !$savenew) {
$name = $default_name;
} elseif (((($copy || $savenew) && $newname) || ($newname && ($newname != $name))) && !$save_error) {
} elseif ((($copy || $savenew) && $newname) && !$save_error) {
$name = $newname;
} elseif ((($newname && ($newname != $name)) || $step === 'pour') && !$save_error) {
$name = $newname;
$class = '';
} elseif ($savenew && $save_error) {
$class = '';
}

$titleblock = inputLabel(
'new_style',
fInput('text', 'newname', $name, 'input-medium', '', '', INPUT_MEDIUM, '', 'new_style', false, true),
'css_name',
array('', 'instructions_style_name'),
array('class' => 'txp-form-field name')
);

if ($name === '') {
$titleblock .= hInput('savenew', 'savenew');
} else {
$titleblock .= hInput('name', $name);
}

$titleblock .= eInput('css').sInput('css_save');

$thecss = gps('css');

if (!$save_error) {
Expand Down Expand Up @@ -178,16 +202,39 @@ function css_edit($message = '')
)), ' class="txp-save"'
);

$rs = array(
'name' => $name,
'newname' => $newname,
'default' => $default_name,
'css' => $thecss,
);

// Get content for volatile partials.
$partials = updatePartials($partials, $rs, array(PARTIAL_VOLATILE, PARTIAL_VOLATILE_VALUE));

if ($refresh_partials) {
$response[] = announce($message);
$response = array_merge($response, updateVolatilePartials($partials));
send_script_response(join(";\n", $response));

// Bail out.
return;
}

// Get content for static partials.
$partials = updatePartials($partials, $rs, PARTIAL_STATIC);

pagetop(gTxt('edit_css'), $message);

echo n.'<div class="txp-layout">'.
n.tag(
hed(gTxt('tab_style'), 1, array('class' => 'txp-heading')),
'div', array('class' => 'txp-layout-1col')
);

// Styles create/switcher column.

echo n.tag(
css_list($name, $default_name).n,
$partials['list']['html'].n,
'div', array(
'class' => 'txp-layout-4col-alt',
'id' => 'content_switcher',
Expand All @@ -196,19 +243,12 @@ function css_edit($message = '')
);

// Styles code columm.

echo n.tag(
form(
$actions.
$titleblock.
inputLabel(
'css',
'<textarea class="code" id="css" name="css" cols="'.INPUT_LARGE.'" rows="'.TEXTAREA_HEIGHT_LARGE.'" dir="ltr">'.txpspecialchars($thecss).'</textarea>',
'css_code',
array('', 'instructions_style_code'),
array('class' => 'txp-form-field')
).
$buttons, '', '', 'post', '', '', 'style_form'),
$partials['name']['html'].
$partials['css']['html'].
$buttons, '', '', 'post', $class, '', 'style_form'),
'div', array(
'class' => 'txp-layout-4col-3span',
'id' => 'main_content',
Expand All @@ -225,6 +265,8 @@ function css_edit($message = '')

function css_save()
{
global $app_mode;

extract(doSlash(array_map('assert_string', psa(array(
'savenew',
'copy',
Expand All @@ -250,6 +292,7 @@ function css_save()

if (($newname !== $name) && $exists) {
$message = array(gTxt('css_already_exists', array('{name}' => $newname)), E_ERROR);

if ($savenew) {
$_POST['newname'] = '';
}
Expand All @@ -273,7 +316,7 @@ function css_save()
if (safe_update('txp_css', "css = '$css', name = '".doSlash($newname)."'", "name = '".doSlash($name)."'")) {
safe_update('txp_section', "css = '".doSlash($newname)."'", "css='".doSlash($name)."'");
update_lastmod('css_saved', compact('newname', 'name', 'css'));
$message = gTxt('css_updated', array('{name}' => $name));
$message = gTxt('css_updated', array('{name}' => $newname));
} else {
$message = array(gTxt('css_save_failed'), E_ERROR);
$save_error = true;
Expand All @@ -288,7 +331,7 @@ function css_save()
callback_event('css_saved', '', 0, $name, $newname);
}

css_edit($message);
css_edit($message, ($app_mode === 'async') ? true : false);
}

/**
Expand All @@ -311,3 +354,66 @@ function css_delete()
}
css_edit($message);
}

/**
* Renders css name field.
*
* @param array $rs Record set
* @return string HTML
*/

function css_partial_name($rs)
{
$name = $rs['name'];
$newname = $rs['newname'];

$titleblock = inputLabel(
'new_style',
fInput('text', 'newname', $name, 'input-medium', '', '', INPUT_MEDIUM, '', 'new_style', false, true),
'css_name',
array('', 'instructions_style_name'),
array('class' => 'txp-form-field name')
);

if ($name === '') {
$titleblock .= hInput('savenew', 'savenew');
} else {
$titleblock .= hInput('name', $name);
}

$titleblock .= eInput('css').sInput('css_save');

return $titleblock;
}

/**
* Renders css name field.
*
* @param array $rs Record set
* @return string HTML
*/

function css_partial_name_value($rs)
{
return $rs['name'];
}

/**
* Renders css textarea field.
*
* @param array $rs Record set
* @return string HTML
*/

function css_partial_css($rs)
{
$out = inputLabel(
'css',
'<textarea class="code" id="css" name="css" cols="'.INPUT_LARGE.'" rows="'.TEXTAREA_HEIGHT_LARGE.'" dir="ltr">'.txpspecialchars($rs['css']).'</textarea>',
'css_code',
array('', 'instructions_style_code'),
array('class' => 'txp-form-field css')
);

return $out;
}
1 change: 1 addition & 0 deletions textpattern/lib/txplib_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ function db_down()
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<title>Database unavailable</title>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion textpattern/lib/txplib_html.php
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ function fieldHelp($help_var)

$ui = n.tag($help_text, 'div', array('class' => 'txp-form-field-instructions'));

return pluggable_ui('admin_help_field', $help_var, $ui, compact('help_var', 'textile'));
return pluggable_ui('admin_help_field', $help_var, $ui, compact('help_var'));
}

/**
Expand Down
Loading