2008-03-09 Christian Bayle <bayle@debian.org>
- * include/*: Migrate to util_make_url() and util_make_link()
+ * snippet/*: Migrate to util_make_url() and util_make_link()
+ * include/*: Ditto
* admin/*: Ditto
* my/*: Ditto
* tracker/*: Ditto
$result=db_query("SELECT * FROM snippet_version WHERE snippet_version_id='$snippet_version_id'");
if (!$result || db_numrows($result) < 1) {
echo '<h1>' ._('Error - That snippet doesn\'t exist.').'</h1>';
- echo '<a href="'.$GLOBALS['sys_urlprefix'].'/snippet/add_snippet_to_package.php?snippet_package_version_id='.$snippet_package_version_id.'">' ._('Back To Add Page').'</a>';
+ echo util_make_link ('/snippet/add_snippet_to_package.php?snippet_package_version_id='.$snippet_package_version_id,_('Back To Add Page'));
handle_add_exit();
}
"AND snippet_version_id='$snippet_version_id'");
if ($result && db_numrows($result) > 0) {
echo '<h1>'._('Error - That snippet was already added to this package.').'</h1>';
- echo '<a href="'.$GLOBALS['sys_urlprefix'].'/snippet/add_snippet_to_package.php?snippet_package_version_id='.$snippet_package_version_id.'">'._('Back To Add Page').'</a>';
+ echo util_make_url ('/snippet/add_snippet_to_package.php?snippet_package_version_id='.$snippet_package_version_id,_('Back To Add Page'));
handle_add_exit();
}
}
} else {
echo '<h1>' ._('Error - Go back and fill in all the information').'</h1>';
- echo '<a href="'.$GLOBALS['sys_urlprefix'].'/snippet/add_snippet_to_package.php?snippet_package_version_id='.$snippet_package_version_id.'">'._('Back To Add Page').'</a>';
+ echo util_make_link ('/snippet/add_snippet_to_package.php?snippet_package_version_id='.$snippet_package_version_id,_('Back To Add Page'));
handle_add_exit();
}
for ($i=0; $i<$rows; $i++) {
echo '
<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td style="text-align:center">
- <a href="'.$GLOBALS['sys_urlprefix'].'/snippet/delete.php?type=frompackage&snippet_version_id='.
- db_result($result,$i,'snippet_version_id').
- '&snippet_package_version_id='.$snippet_package_version_id.
+ <a href="'.util_make_url ('/snippet/delete.php?type=frompackage&snippet_version_id='.db_result($result,$i,'snippet_version_id').'&snippet_package_version_id='.$snippet_package_version_id).
'">' . html_image("ic/trash.png","16","16",array("border"=>"0")) . '</a></td><td width="99%">'.
db_result($result,$i,'name').' '.db_result($result,$i,'version')."</td></tr>";
<?php echo _('If a new window opened, use it to add snippets to your package. If a new window did not open, use the following link to add to your package BEFORE you leave this page.'); ?>
</p>
<p>
-<a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/snippet/add_snippet_to_package.php?snippet_package_version_id=<?php echo $snippet_package_version_id; ?>" target="_blank"><?php echo _('Add snippets to package'); ?></a></p>
+<?php echo util_make_url ('/snippet/add_snippet_to_package.php?snippet_package_version_id='.$snippet_package_version_id,_('Add snippets to package'),array('target'=>'_blank')); ?></p>
<p><?php echo _('<strong>Browse the library</strong> to find the snippets you want to add, then add them using the new window link shown above.'); ?></p>
<p>
}
for ($i=0; $i<$rows2; $i++) {
echo '
- <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td rowspan="2"><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/detail.php?type=package&id='.
- db_result($result2,$i,'snippet_package_id').'"><strong>'.
- db_result($result2,$i,'snippet_package_id').'</strong></a></td><td><strong>'.
+ <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td rowspan="2">'.
+ util_make_link ('/snippet/detail.php?type=package&id='.db_result($result2,$i,'snippet_package_id'),'<strong>'.db_result($result2,$i,'snippet_package_id').'</strong>').'</td><td><strong>'.
db_result($result2,$i,'name').'</td><td>'.
$GLOBALS['HTML']->createLinkToUserHome(db_result($result2, $i, 'user_name'), db_result($result2, $i, 'realname')).'</td></tr>';
echo '
}
for ($i=0; $i<$rows; $i++) {
echo '
- <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td rowspan="2"><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/detail.php?type=snippet&id='.
- db_result($result,$i,'snippet_id').'"><strong>'.
- db_result($result,$i,'snippet_id').'</strong></a></td><td><strong><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/detail.php?type=snippet&id='.
- db_result($result,$i,'snippet_id').'">'.db_result($result,$i,'name').'</a></td><td>'.
+ <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td rowspan="2">'.
+ util_make_link ('/snippet/detail.php?type=snippet&id='.db_result($result,$i,'snippet_id'),'<strong>'.db_result($result,$i,'snippet_id').'</strong>').
+ '</td><td><strong>'.
+ util_make_link ('/snippet/detail.php?type=snippet&id='.db_result($result,$i,'snippet_id'),db_result($result,$i,'name')).
+ '</strong></td><td>'.
$GLOBALS['HTML']->createLinkToUserHome(db_result($result, $i, 'user_name'), db_result($result, $i, 'realname')).'</td></tr>';
echo '
<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td colspan="2">'.util_make_links(nl2br(db_result($result,$i,'description'))).'</td></tr>';
for ($i=0; $i<$rows; $i++) {
echo '
<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.db_result($result,$i,'snippet_version_id').
- '</td><td><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/download.php?type=snippet&id='.
- db_result($result,$i,'snippet_version_id').'"><strong>'.
- db_result($result,$i,'version').'</strong></a></td><td>'.
+ '</td><td>'.
+ util_make_link ('/snippet/download.php?type=snippet&id='.db_result($result,$i,'snippet_version_id'),'<strong>'. db_result($result,$i,'version').'</strong>').'</td><td>'.
date(_('Y-m-d H:i'),db_result($result,$i,'post_date')).'</td><td>'.
$GLOBALS['HTML']->createLinkToUserHome(db_result($result, $i, 'user_name'), db_result($result, $i, 'realname')).'</td>'.
- '<td style="text-align:center"><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/delete.php?type=snippet&snippet_version_id='.
- db_result($result,$i,'snippet_version_id').
- '">' . html_image("ic/trash.png","16","16",array("border"=>"0")) . '</a></td></tr>';
+ '<td style="text-align:center"><a href="'.util_make_url ('/snippet/delete.php?type=snippet&snippet_version_id='.db_result($result,$i,'snippet_version_id')).'">' . html_image("ic/trash.png","16","16",array("border"=>"0")) . '</a></td></tr>';
if ($i != ($rows - 1)) {
echo '
Show a link so you can add a new version of this snippet
*/
echo '
- <h3><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/addversion.php?type=snippet&id='.htmlspecialchars($id).'"><span class="important">'._('Submit a new version').'</span></a></h3>
+ <h3><a href="'.util_make_url ('/snippet/addversion.php?type=snippet&id='.htmlspecialchars($id)).'"><span class="important">'._('Submit a new version').'</span></a></h3>
<p>' ._('You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others.').'.</p>';
snippet_footer(array());
for ($i=0; $i<$rows; $i++) {
echo '
- <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/detail.php?type=packagever&id='.
- db_result($result,$i,'snippet_package_version_id').'"><strong>'.
- db_result($result,$i,'version').'</strong></a></td><td>'.
+ <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.
+ util_make_link ('/snippet/detail.php?type=packagever&id='.db_result($result,$i,'snippet_package_version_id'),'<strong>'.db_result($result,$i,'version').'</strong>').'</td><td>'.
date(_('Y-m-d H:i'),db_result($result,$i,'post_date')).'</td><td>'.
$GLOBALS['HTML']->createLinkToUserHome(db_result($result, $i, 'user_name'), db_result($result, $i, 'realname')).'</td>'.
- '<td style="text-align:center"><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/add_snippet_to_package.php?snippet_package_version_id='.
- db_result($result,$i,'snippet_package_version_id').
+ '<td style="text-align:center"><a href="'.util_make_url ('/snippet/add_snippet_to_package.php?snippet_package_version_id='.db_result($result,$i,'snippet_package_version_id')).
'">' . html_image("ic/pencil.png","20","25",array("border"=>"0")) .
- '</a> <a href="'.$GLOBALS['sys_urlprefix'].'/snippet/delete.php?type=package&snippet_package_version_id='.
- db_result($result,$i,'snippet_package_version_id').
+ '</a> <a href="'.
+ util_make_url ('/snippet/delete.php?type=package&snippet_package_version_id='.db_result($result,$i,'snippet_package_version_id')).
'">' . html_image("ic/trash.png","16","16",array("border"=>"0")) . '</a></td></tr>';
}
Show a form so you can add a new version of this package
*/
echo '
- <h3><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/addversion.php?type=package&id='.$id.'"><span class="important">' ._('Submit a new version').'</span></a></h3>
+ <h3><a href="'.util_make_url ('/snippet/addversion.php?type=package&id='.$id).'"><span class="important">' ._('Submit a new version').'</span></a></h3>
<p>' ._('You can submit a new version of this package if you have modified it and you feel it is appropriate to share with others.').'.</p>';
snippet_footer(array());
$existing_snippets = create_snippet_hash("SELECT language, count(*) as count from snippet group by language", "language");
for ($i=1; $i<count($SCRIPT_LANGUAGE); $i++) {
- $return .= '<li><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/browse.php?by=lang&lang='.$i.'">'.$SCRIPT_LANGUAGE[$i].'</a> (';
+ $return .= '<li>'.util_make_link ('/snippet/browse.php?by=lang&lang='.$i,$SCRIPT_LANGUAGE[$i]).' (';
// Remove warning
if (@$existing_snippets[$i]) {
$return .= $existing_snippets[$i].')</li>';
$existing_categories = create_snippet_hash("SELECT category, count(*) as count from snippet group by category", "category");
for ($i=1; $i<count($SCRIPT_CATEGORY); $i++) {
// Remove warning
- @$return .= '<li><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/browse.php?by=cat&cat='.$i.'">'.$SCRIPT_CATEGORY[$i].'</a> (';
+ @$return .= '<li>'.util_make_link ('/snippet/browse.php?by=cat&cat='.$i,$SCRIPT_CATEGORY[$i]).' (';
// Remove warning
if (@$existing_categories[$i]) {
$return .= $existing_categories[$i].')</li>';
<p>
<?php echo _('If a new window opened, use it to add snippets to your package. If a new window did not open, use the following link to add to your package BEFORE you leave this page.'); ?></p>
-<p><a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/snippet/add_snippet_to_package.php?snippet_package_version_id=<?php echo $snippet_package_version_id; ?>" target="_blank"><?php echo _('Add snippets to package'); ?></a></p>
+<p><?php echo util_make_link ('/snippet/add_snippet_to_package.php?snippet_package_version_id='.$snippet_package_version_id,_('Add snippets to package'),array('target'=>'_blank')); ?></p>
<p>
<?php echo _('<strong>Browse the library</strong> to find the snippets you want to add, then add them using the new window link shown above.'); ?>
<td><strong><?php echo _('Language') ?>:</strong><?php echo utils_requiredField(); ?><br />
<?php echo html_build_select_box_from_array ($SCRIPT_LANGUAGE,'language'); ?>
<br />
- <!--<a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/support/?func=addsupport&group_id=1"><?php echo _('Suggest a Language'); ?></a>-->
+ <!--<?php echo util_make_link ('/support/?func=addsupport&group_id=1',_('Suggest a Language')); ?>-->
</td>
<td><strong><?php echo _('Category') ?></strong><?php echo utils_requiredField(); ?><br />
<?php echo html_build_select_box_from_array ($SCRIPT_CATEGORY,'category'); ?>
<br />
- <!-- <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/support/?func=addsupport&group_id=1"><?php echo _('Suggest a Category'); ?></a>-->
+ <!--<?php echo util_make_link ('/support/?func=addsupport&group_id=1',_('Suggest a Category')); ?>-->
</td>
</tr>
*/
echo '<p><strong>';
- echo '<a href="'.$GLOBALS['sys_urlprefix'].'/snippet/">' ._('Browse').'</a>
- | <a href="'.$GLOBALS['sys_urlprefix'].'/snippet/submit.php">' ._('Submit A New Snippet').'</a>
- | <a href="'.$GLOBALS['sys_urlprefix'].'/snippet/package.php">' ._('Create A Package').'</a></strong>';
+ echo util_make_link ('/snippet/',_('Browse')).'
+ | '.util_make_link ('/snippet/submit.php',_('Submit A New Snippet')).'
+ | '.util_make_link ('/snippet/package.php',_('Create A Package')).'</strong>';
echo ' ';
}
for ($i=0; $i<$rows; $i++) {
echo '
<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.db_result($result,$i,'snippet_version_id').
- '</td><td><a href="'.$GLOBALS['sys_urlprefix'].'/snippet/download.php?type=snippet&id='.
- db_result($result,$i,'snippet_version_id').'">'.
- db_result($result,$i,'version').'</a></td><td>'.
+ '</td><td>'.
+ util_make_link ('/snippet/download.php?type=snippet&id='.db_result($result,$i,'snippet_version_id'),db_result($result,$i,'version')).
+ '</td><td>'.
db_result($result,$i,'name').'</td><td>'.
db_result($result,$i,'user_name').'</td></tr>';
}
<td><strong><?php echo _('Language'); ?>:</strong><?php echo utils_requiredField(); ?><br />
<?php echo html_build_select_box_from_array ($SCRIPT_LANGUAGE,'language'); ?>
<br />
- <!-- FIXME: Where should this link go to? <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/support/?func=addsupport&group_id=1"><?php echo _('Suggest a Language'); ?></a> -->
+ <!-- FIXME: Where should this link go to? <?php echo util_make_link ('/support/?func=addsupport&group_id=1',_('Suggest a Language')); ?> -->
</td>
<td><strong><?php echo _('Category'); ?></strong><?php echo utils_requiredField(); ?><br />
<?php echo html_build_select_box_from_array ($SCRIPT_CATEGORY,'category'); ?>
<br />
- <!-- FIXME: Where should this link go to? <a href="<?php echo $GLOBALS['sys_urlprefix']; ?>/support/?func=addsupport&group_id=1"><?php echo _('Suggest a Category'); ?></a> -->
+ <!-- FIXME: Where should this link go to? <?php echo util_make_link ('/support/?func=addsupport&group_id=1',_('Suggest a Category')); ?> -->
</td>
</tr>