[cc-commits] [CC SVN] r12581 - in cchost/trunk: bin cchost_lib cchost_lib/ccextras ccskins/cc5 ccskins/cc5/css ccskins/shared ccskins/shared/formats ccskins/shared/js ccskins/shared/strings
webmaster at creativecommons.org
webmaster at creativecommons.org
Fri May 8 20:38:45 EDT 2009
Author: fourstones
Date: 2009-05-09 00:38:45 +0000 (Sat, 09 May 2009)
New Revision: 12581
Modified:
cchost/trunk/bin/cc-host-parse-tpl.php
cchost/trunk/cchost_lib/cc-mediahost.php
cchost/trunk/cchost_lib/cc-ratings.php
cchost/trunk/cchost_lib/cc-search.php
cchost/trunk/cchost_lib/cc-template.php
cchost/trunk/cchost_lib/ccextras/cc-format.php
cchost/trunk/ccskins/cc5/body.tpl
cchost/trunk/ccskins/cc5/css/cc5.css
cchost/trunk/ccskins/shared/formats/upload_list_wide.tpl
cchost/trunk/ccskins/shared/js/remix_search.js
cchost/trunk/ccskins/shared/remix_search.tpl
cchost/trunk/ccskins/shared/strings/all_media.php
Log:
format: added [var] for template vars (user_name,site-title, etc.)
added GetArg to $T for safe access to vars
now setting perms on cached header files
disabled TEXTINDEX option in settings
cmdline tpl-parser was broken
accept ?pool and ?sourcesof for submit/remix (phase 1)
bugfix: upload_listing broken for non-audio
Modified: cchost/trunk/bin/cc-host-parse-tpl.php
===================================================================
--- cchost/trunk/bin/cc-host-parse-tpl.php 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/bin/cc-host-parse-tpl.php 2009-05-09 00:38:45 UTC (rev 12581)
@@ -12,7 +12,7 @@
$fname = realpath($fname);
$argv[1] = realpath($argv[1]);
-chdir('/var/www/cchost');
+chdir(dirname(dirname(__FILE__)));
require_once('cchost_lib/cc-tpl-parser.php');
Modified: cchost/trunk/cchost_lib/cc-mediahost.php
===================================================================
--- cchost/trunk/cchost_lib/cc-mediahost.php 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/cchost_lib/cc-mediahost.php 2009-05-09 00:38:45 UTC (rev 12581)
@@ -184,7 +184,24 @@
if( empty($_POST['postremix']) )
{
+ if( !empty($_GET['pool']) )
+ {
+ $pool = CCUtil::Strip($_GET['pool']);
+ $pool_id = sprintf('%d',$pool);
+ if( empty($pool_id) )
+ {
+ $pool_id = CCDatabase::QueryItem('SELECT pool_id FROM cc_tbl_pools WHERE pool_short_name=\''.$pool . '\'');
+ }
+
+ if( !empty($pool_id) )
+ $form->SetFormFieldItem('sources','pool_id',$pool_id);
+ }
+ if( !empty($_GET['sourcesof']) )
+ {
+ $form->SetFormFieldItem('sources','sourcesof',$_GET['sourcesof']);
+ }
$form->SetFormFieldItem('sources','remix_id',empty($etc['url_extra']) ? '' : $etc['url_extra']);
+
CCPage::AddForm( $form->GenerateForm() );
}
else
Modified: cchost/trunk/cchost_lib/cc-ratings.php
===================================================================
--- cchost/trunk/cchost_lib/cc-ratings.php 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/cchost_lib/cc-ratings.php 2009-05-09 00:38:45 UTC (rev 12581)
@@ -63,10 +63,14 @@
/**
* Determine if the current user is allowed to rate a given record
*
+ * WARNING: See also cc-user-hook.php (ok_to_rate)
+ *
* @param array $record Upload record
*/
function IsRateBlocked($record)
{
+ // WARNING: See also cc-user-hook.php (ok_to_rate)
+
global $CC_GLOBALS;
$upload_id = $record['upload_id'];
Modified: cchost/trunk/cchost_lib/cc-search.php
===================================================================
--- cchost/trunk/cchost_lib/cc-search.php 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/cchost_lib/cc-search.php 2009-05-09 00:38:45 UTC (rev 12581)
@@ -288,13 +288,17 @@
{
if( $scope == CC_GLOBAL_SCOPE )
{
+ /*
+ this just doesn't work
+
$fields['use_text_index'] =
array( 'label' => _('Search Method'),
'form_tip' => _('Check this to use mysql TEXTINDEX searching'),
'value' => '',
'formatter' => 'checkbox',
'flags' => CCFF_POPULATE );
-
+ */
+
$fields['show_google_form'] =
array( 'label' => _('Show Google(tm) Search Form'),
'form_tip' => _('Check this to show users a Google search form'),
Modified: cchost/trunk/cchost_lib/cc-template.php
===================================================================
--- cchost/trunk/cchost_lib/cc-template.php 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/cchost_lib/cc-template.php 2009-05-09 00:38:45 UTC (rev 12581)
@@ -114,6 +114,17 @@
}
/**
+ * Get a variable available to the page when rendering
+ *
+ * @param string $name The name of the variable as will be seen in the template
+ * @return string value of variable name or null if not found
+ */
+ function GetArg($name)
+ {
+ return isset($this->vars[$name]) ? $this->vars[$name] : null;
+ }
+
+ /**
* Remove a variable from the page when rendering
*
* @param string $name The name of the variable as will be invisible in the template
@@ -498,6 +509,10 @@
fclose($f_js);
fclose($f_css);
fclose($f_inc);
+
+ chmod( $script_file, cc_default_file_perms() );
+ chmod( $css_file, cc_default_file_perms() );
+ chmod( $inc_file, cc_default_file_perms() );
}
print "\n" . '<script type="text/javascript" src="' . ccd($script_file) . '"></script>';
Modified: cchost/trunk/cchost_lib/ccextras/cc-format.php
===================================================================
--- cchost/trunk/cchost_lib/ccextras/cc-format.php 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/cchost_lib/ccextras/cc-format.php 2009-05-09 00:38:45 UTC (rev 12581)
@@ -91,17 +91,28 @@
!empty($CC_GLOBALS['adminformat']);
}
+function _cc_format_template_tag($tagname,$page)
+{
+ $value = $page->GetArg($tagname);
+ if( $value === null )
+ return $page->String(array('str_invalid_tag',$tagname));
+ return $value;
+}
+
function _cc_format_format($text)
{
require_once('cchost_lib/cc-page.php');
$page =& CCPage::GetPage();
$thumbs_up = ccd( $page->Search('images/thumbs_up.gif') );
-
- $quote = _('Quote:');
+
+ $quote = $page->String('str_quote');
require_once('cchost_lib/smartypants/smartypants.php');
$attrs = '(b|i|u|red|green|blue|big|small|right|left)';
$text = strip_tags($text);
- $map = array( "/\[$attrs\]/" => '<span class="\1">',
+ $map = array(
+ "#\[var=([^\]]+)]\[/var\]#e" => '_cc_format_template_tag(\'\1\',$page)',
+ "#\[define=([^\]]+)\]\[/define\]#e" => '\1',
+ "/\[$attrs\]/" => '<span class="\1">',
"#\[/$attrs\]#" => '</span>',
"/\[quote=?([^\]]+)?\]/" => '<span class="quote"><span>'. $quote . ' $1</span>',
"#\[/quote\]#" => '</span>',
@@ -111,9 +122,9 @@
"#\[/box\]#" => '</div>',
"/\[indent=([0-9]+)]/" => '<div style="padding-left:$1px">',
"#\[/indent\]#" => '</div>',
- "/\[cmd=([^\]]+)]/e" => '"<a href=\"" . ccl(\'\1\') . "\">"',
+ "#\[cmdurl=([^\]]+)\]\[/cmdurl\]#e" => 'ccl(\'\1\')',
+ "/\[cmd=([^\]]+)\]/e" => '"<a href=\"" . ccl(\'\1\') . "\">"',
"#\[/cmd\]#" => '</a>',
- "#\[define=([^\]]+)\]\[/define\]#e" => '\1',
"#\[skinimg=([^\]]+)\]\[/skinimg\]#e" =>
'\'<img class="format_image" src="\' . ccd($page->Search(array("$1","images/$1"))) . \'" />\'',
"#\[img=([^\]]+)\]\[/img\]#" => '<img class="format_image" src="$1" />',
Modified: cchost/trunk/ccskins/cc5/body.tpl
===================================================================
--- cchost/trunk/ccskins/cc5/body.tpl 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/ccskins/cc5/body.tpl 2009-05-09 00:38:45 UTC (rev 12581)
@@ -108,7 +108,7 @@
</div>
<!-- footer -->
- <div id="footer">
+ <div id="footer" class="ccfooter">
<div id="footerContent" class="ccbox">%text(footer)%</div>
<div id="footerLicense">
<p class="ccbox">
Modified: cchost/trunk/ccskins/cc5/css/cc5.css
===================================================================
--- cchost/trunk/ccskins/cc5/css/cc5.css 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/ccskins/cc5/css/cc5.css 2009-05-09 00:38:45 UTC (rev 12581)
@@ -27,7 +27,7 @@
h1, h2, h3, h4, h5 { line-height: 1.5em;}
-a, a:visited {
+a, a:visited, a:link {
text-decoration: none;
color: #1c438b;
}
@@ -239,7 +239,7 @@
/** Footer **/
-#footer {
+.ccfooter {
background-color: #eee;
clear: both;
margin-top: 6em;
@@ -278,5 +278,3 @@
padding-top: 4px;
}
-
-<!-- end
Modified: cchost/trunk/ccskins/shared/formats/upload_list_wide.tpl
===================================================================
--- cchost/trunk/ccskins/shared/formats/upload_list_wide.tpl 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/ccskins/shared/formats/upload_list_wide.tpl 2009-05-09 00:38:45 UTC (rev 12581)
@@ -114,7 +114,8 @@
%if_null(#_GET/noscripts)%
%call('playerembed.xml/eplayer')%
<script type="text/javascript">
- ccEPlayer.hookElements($('upload_listing'));
+ if( window.ccEPlayer )
+ ccEPlayer.hookElements($('upload_listing'));
</script>
<script type="text/javascript">
Modified: cchost/trunk/ccskins/shared/js/remix_search.js
===================================================================
--- cchost/trunk/ccskins/shared/js/remix_search.js 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/ccskins/shared/js/remix_search.js 2009-05-09 00:38:45 UTC (rev 12581)
@@ -14,7 +14,8 @@
{
var html = '<select id="pools"><option value="-1" selected="selected">' + str_remix_this_site + '</option>';
pools.each( function(p) {
- html += '<option value="' + p.pool_id + '">' + p.pool_name + '</option>';
+ var sel = pool_id && (pool_id == p.pool_id) ? 'selected="selected"' : '';
+ html += '<option '+sel+'value="' + p.pool_id + '">' + p.pool_name + '</option>';
});
html += '</select>';
$('pool_select_contaner').innerHTML = html;
@@ -27,6 +28,11 @@
Event.observe( 'remix_toggle_link', 'click', me.onToggleBox.bindAsEventListener(me) );
this._scan_checks(true);
+
+ if( pool_id )
+ {
+ this.onPoolChange(null);
+ }
},
_scan_checks: function(check_all) {
Modified: cchost/trunk/ccskins/shared/remix_search.tpl
===================================================================
--- cchost/trunk/ccskins/shared/remix_search.tpl 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/ccskins/shared/remix_search.tpl 2009-05-09 00:38:45 UTC (rev 12581)
@@ -80,5 +80,10 @@
<script src="%url('js/remix_search.js')%" type="text/javascript"></script>
<script type="text/javascript">
var pools = %query('t=pools&f=js')%;
+%if_null(field/pool_id)%
+var pool_id = 0;
+%else%
+var pool_id = %(field/pool_id)%;
+%end_if%
new ccRemixSearch(<?= empty($A['use_text_index']) ? 'false' : 'true' ?>);
</script>
Modified: cchost/trunk/ccskins/shared/strings/all_media.php
===================================================================
--- cchost/trunk/ccskins/shared/strings/all_media.php 2009-05-09 00:11:31 UTC (rev 12580)
+++ cchost/trunk/ccskins/shared/strings/all_media.php 2009-05-09 00:38:45 UTC (rev 12581)
@@ -269,6 +269,8 @@
$GLOBALS['str_hidi_date'] = _('Upload date');
$GLOBALS['str_hidi_author'] = _('Artist');
+$GLOBALS['str_invalid_tag'] = _('[Don\'t know variable: %s]');
+
$GLOBALS['str_hidden'] = _('Hidden');
$GLOBALS['str_hidden_list'] = _('Unpublished and Moderated Uploads');
$GLOBALS['str_highest_rated'] = _('Highest Rated');
@@ -356,8 +358,9 @@
$GLOBALS['str_no_chart'] = _('No Chart');
$GLOBALS['str_non_public_files'] = _('Non-public Files');
+$GLOBALS['str_notifications'] = _('Notifications');
$GLOBALS['str_notify_dont_respond'] = _('PLEASE DO NOT RESPOND TO THIS EMAIL');
-$GLOBALS['str_notify_edit'] = _('Edit My Notifications');
+$GLOBALS['str_notify_edit'] = _('Manage Notifications');
$GLOBALS['str_notify_get_notified'] = _('%sGet Notified About %s%s');
$GLOBALS['str_notify_got_rating'] = _('This is a notification that "%s" has just received a rating of %d.00');
$GLOBALS['str_notify_got_recc'] = _('This is a notification that "%s" has just been recommended by %s');
@@ -528,6 +531,8 @@
$GLOBALS['str_publicize_yourself_s'] = _('%sPublicize yourself%s');
$GLOBALS['str_publicize_s'] = _('Publicize %s');
+$GLOBALS['str_quote'] = _('Quote:');
+
$GLOBALS['str_radio_create'] = _('Create your own stream or podcast from a random pool of remixes in %s by selecting a style and other choices.');
$GLOBALS['str_radio_remix'] = _('Remix Radio');
$GLOBALS['str_radio_station'] = _('Create Your Own Remix Radio Station');
@@ -865,6 +870,7 @@
$GLOBALS['str_trackback_error'] = _('There was an error reaching the page:');
$GLOBALS['str_trackback_remix_upload'] = _('%sClick here if you want to upload a remix of "%s"%s');
+$GLOBALS['str_preferences'] = _('Preferences');
$GLOBALS['str_pref_title'] = _('Your Preferences');
$GLOBALS['str_pref_default_tab'] = _('Default Profile Tab');
$GLOBALS['str_pref_setting_this'] =_('Setting this will determine which tab is the default when visiting an artist\'s page');
More information about the cc-commits
mailing list