From f86febf4e0719142b0566af5c6c4b371ac8116f7 Mon Sep 17 00:00:00 2001 From: Athmane Madjoudj Date: Jul 13 2013 07:42:47 +0000 Subject: - Update to 0.4 - Drop upstreamed patches - Unbundle new libs - Simplify the specfile. - Add a patch to use free URL shortener ur1.ca instead of Google's goo.gl --- diff --git a/.gitignore b/.gitignore index 611229b..319c0b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /sticky-notes-0.3.09062012.4.tar.gz /sticky-notes-0.3.13112012.2.tar.gz +/sticky-notes-0.4.tar.gz diff --git a/sources b/sources index 5a13cba..06bd284 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -da2772675520c23a84282aabf842cbcf sticky-notes-0.3.13112012.2.tar.gz +c504565ba41204125f27254e95a4d15b sticky-notes-0.4.tar.gz diff --git a/sticky-notes-unbundle-php-libs.patch b/sticky-notes-unbundle-php-libs.patch new file mode 100644 index 0000000..95e356c --- /dev/null +++ b/sticky-notes-unbundle-php-libs.patch @@ -0,0 +1,43 @@ +diff -ru sticky-notes-0.4/classes/class_email.php sticky-notes-0.4.unbundled/classes/class_email.php +--- sticky-notes-0.4/classes/class_email.php 2013-07-12 20:12:48.000000000 +0100 ++++ sticky-notes-0.4.unbundled/classes/class_email.php 2013-07-13 01:45:09.393153764 +0100 +@@ -20,7 +20,7 @@ + global $config, $core; + + // Referene the SwiftMailer library +- require_once "{$core->root_dir}addons/swiftmailer/swift_required.php"; ++ require_once "Swift/swift_required.php"; + + // Create the Transport + $transport = Swift_SmtpTransport::newInstance($config->smtp_host, $config->smtp_port); +diff -ru sticky-notes-0.4/classes/class_skin.php sticky-notes-0.4.unbundled/classes/class_skin.php +--- sticky-notes-0.4/classes/class_skin.php 2013-07-12 20:12:48.000000000 +0100 ++++ sticky-notes-0.4.unbundled/classes/class_skin.php 2013-07-13 01:31:35.274153764 +0100 +@@ -274,7 +274,7 @@ + // Instantiates GeSHi with default settings + function geshi($code, $language) + { +- require_once "addons/geshi/geshi.php"; ++ require_once "geshi.php"; + + $geshi = new GeSHi($code, $language); + $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2); +@@ -465,4 +465,4 @@ + } + } + +-?> +\ No newline at end of file ++?> +diff -ru sticky-notes-0.4/list.php sticky-notes-0.4.unbundled/list.php +--- sticky-notes-0.4/list.php 2013-07-12 20:12:48.000000000 +0100 ++++ sticky-notes-0.4.unbundled/list.php 2013-07-13 03:09:37.798153764 +0100 +@@ -10,7 +10,7 @@ + + // Invoke required files + include_once('init.php'); +-include_once('addons/geshi/geshi.php'); ++include_once('geshi.php'); + + // Collect some data + $project = $core->variable('project', ''); diff --git a/sticky-notes-use-free-url-shortener.patch b/sticky-notes-use-free-url-shortener.patch new file mode 100644 index 0000000..6cbc8f0 --- /dev/null +++ b/sticky-notes-use-free-url-shortener.patch @@ -0,0 +1,68 @@ +diff -ru sticky-notes-0.4.unbundled/shorten.php sticky-notes-0.4.url-short-patch/shorten.php +--- sticky-notes-0.4.unbundled/shorten.php 2013-07-12 20:12:48.000000000 +0100 ++++ sticky-notes-0.4.url-short-patch/shorten.php 2013-07-13 07:11:00.025153764 +0100 +@@ -5,6 +5,7 @@ + * @license BSD License - www.opensource.org/licenses/bsd-license.php + * + * Copyright (c) 2013 Sayak Banerjee ++* Copyright (c) 2013 Athmane Madjoudj + * All rights reserved. Do not remove this copyright notice. + */ + +@@ -15,15 +16,9 @@ + $paste_id = $core->variable('id', ''); + $project = $core->variable('project', ''); + $hash = $core->variable('hash', 0); +-$api_url = "https://www.googleapis.com/urlshortener/v1/url?key={$config->google_api_key}"; ++$api_url = "http://ur1.ca/"; + $is_key = false; + +-// We need the google API key for this to work +-if (empty($config->google_api_key)) +-{ +- die("ERROR"); +-} +- + // Prepare the paste ID for use + if (!empty($paste_id)) + { +@@ -88,32 +83,19 @@ + + // Now that we know the paste exists, generate the paste URL + $paste_url = $nav->get_paste($row['id'], $row['urlkey'], $hash, $project); +- + // Create cURL + $ch = curl_init(); +-curl_setopt($ch, CURLOPT_URL, $api_url); +-curl_setopt($ch, CURLOPT_POST, true); +-curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array("longUrl" => $paste_url))); +-curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); ++curl_setopt($ch, CURLOPT_URL,"http://ur1.ca/"); ++curl_setopt($ch, CURLOPT_POST, 1); ++curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('longurl' => $paste_url))); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +-curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); +- +-// Execute the post + $result = curl_exec($ch); +- +-// Close the connection + curl_close($ch); +- +-// Parse the response +-$response = json_decode($result, true); +- +-if (isset($response['id'])) +-{ +- die($response['id']); +-} ++preg_match( '/

Your ur1 is: (.+)<\/a><\/p>/', $result, $match ); ++if (!empty($match)) ++ die($match[1]); + else +-{ + die("ERROR"); +-} ++ + + ?> diff --git a/sticky-notes.conf b/sticky-notes.conf index 7099fac..7749f24 100644 --- a/sticky-notes.conf +++ b/sticky-notes.conf @@ -1,6 +1,6 @@ Alias /sticky-notes "/usr/share/sticky-notes" - + # ACL for Apache 2.4 @@ -24,8 +24,10 @@ Alias /sticky-notes "/usr/share/sticky-notes" RewriteEngine on RewriteBase /sticky-notes - # Setup link + + # Setup links RewriteRule ^install/?$ install.php [NC] + RewriteRule ^upgrade/?$ upgrade.php [NC] # Documentation links RewriteRule ^doc/([a-z]+)/?$ doc.php?cat=$1 [NC] @@ -35,32 +37,36 @@ Alias /sticky-notes "/usr/share/sticky-notes" RewriteRule ^~([a-z.]+)/?$ index.php?project=$1 [NC] RewriteRule ^~([a-z.]+)/api/([a-z]+)/?$ index.php?project=$1&mode=$2 [NC] - # Paste list + # Paste list, trending and RSS RewriteRule ^all/?$ list.php [NC] RewriteRule ^api/([a-z]+)/all/?$ list.php?mode=$1 [NC] RewriteRule ^~([a-z.]+)/all/?$ list.php?project=$1 [NC] RewriteRule ^~([a-z.]+)/api/([a-z]+)/all/?$ list.php?project=$1&mode=$2 [NC] - RewriteRule ^rss/?$ list.php?rss=1 [NC] - RewriteRule ^~([a-z.]+)/rss/?$ list.php?project=$1&rss=1 [NC] RewriteRule ^all/([0-9]+)/?$ list.php?page=$1 [NC] RewriteRule ^api/([a-z]+)/all/([0-9]+)/?$ list.php?mode=$1&page=$2 [NC] RewriteRule ^~([a-z.]+)/all/([0-9]+)/?$ list.php?project=$1&page=$2 [NC] RewriteRule ^~([a-z.]+)/api/([a-z]+)/all/([0-9]+)/?$ list.php?project=$1&mode=$2&page=$3 [NC] + RewriteRule ^trending/([a-z]+)/?$ list.php?trending=1&age=$1 [NC] + RewriteRule ^~([a-z.]+)/trending/([a-z]+)/?$ list.php?project=$1&trending=1&age=$2 [NC] + RewriteRule ^trending/?$ list.php?trending=1 [NC] + RewriteRule ^~([a-z.]+)/trending/?$ list.php?project=$1&trending=1 [NC] + RewriteRule ^rss/?$ list.php?rss=1 [NC] + RewriteRule ^~([a-z.]+)/rss/?$ list.php?project=$1&rss=1 [NC] # General links - RewriteRule ^([0-9]+)/?$ show.php?id=$1 [NC] - RewriteRule ^~([a-z.]+)/([0-9]+)/?$ show.php?project=$1&id=$2 [NC] - RewriteRule ^([0-9]+)/([a-z|A-Z]+)/?$ show.php?id=$1&mode=$2 [NC] - RewriteRule ^~([a-z.]+)/([0-9]+)/([a-z|A-Z]+)/?$ show.php?project=$1&id=$2&mode=$3 [NC] - RewriteRule ^api/([a-z|A-Z]+)/([0-9]+)/?$ show.php?mode=$1&id=$2 [NC] - RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/?$ show.php?project=$1&mode=$2&id=$3 [NC] - RewriteRule ^([0-9]+)/([0-9]+)/?$ show.php?id=$1&hash=$2 [NC] - RewriteRule ^~([a-z.]+)/([0-9]+)/([0-9]+)/?$ show.php?project=$1&id=$2&hash=$3 [NC] - RewriteRule ^([0-9]+)/([0-9]+)/([a-z|A-Z]+)/?$ show.php?id=$1&hash=$2&mode=$3 [NC] - RewriteRule ^~([a-z.]+)/([0-9]+)/([0-9]+)/([a-z|A-Z]+)/?$ show.php?project=$1&id=$2&hash=$3&mode=$4 [NC] - RewriteRule ^api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/?$ show.php?mode=$1&id=$2&hash=$3 [NC] - RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/?$ show.php?project=$1&mode=$2&id=$3&hash=$4 [NC] - RewriteRule ^api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/(.*)$ show.php?mode=$1&id=$2&hash=$3&password=$4 [NC] - RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/(.*)$ show.php?project=$1&mode=$2&id=$3&hash=$4&password=$5 [NC] + RewriteRule ^([0-9]+|p[0-9a-zA-Z]{8})/?$ show.php?id=$1 [NC] + RewriteRule ^~([a-z.]+)/([0-9]+|p[0-9a-zA-Z]{8})/?$ show.php?project=$1&id=$2 [NC] + RewriteRule ^([0-9]+|p[0-9a-zA-Z]{8})/([a-z|A-Z]+)/?$ show.php?id=$1&mode=$2 [NC] + RewriteRule ^~([a-z.]+)/([0-9]+|p[0-9a-zA-Z]{8})/([a-z|A-Z]+)/?$ show.php?project=$1&id=$2&mode=$3 [NC] + RewriteRule ^api/([a-z|A-Z]+)/([0-9]+|p[0-9a-zA-Z]{8})/?$ show.php?mode=$1&id=$2 [NC] + RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+|p[0-9a-zA-Z]{8})/?$ show.php?project=$1&mode=$2&id=$3 [NC] + RewriteRule ^([0-9]+|p[0-9a-zA-Z]{8})/([0-9]+)/?$ show.php?id=$1&hash=$2 [NC] + RewriteRule ^~([a-z.]+)/([0-9]+|p[0-9a-zA-Z]{8})/([0-9]+)/?$ show.php?project=$1&id=$2&hash=$3 [NC] + RewriteRule ^([0-9]+|p[0-9a-zA-Z]{8})/([0-9]+)/([a-z|A-Z]+)/?$ show.php?id=$1&hash=$2&mode=$3 [NC] + RewriteRule ^~([a-z.]+)/([0-9]+|p[0-9a-zA-Z]{8})/([0-9]+)/([a-z|A-Z]+)/?$ show.php?project=$1&id=$2&hash=$3&mode=$4 [NC] + RewriteRule ^api/([a-z|A-Z]+)/([0-9]+|p[0-9a-zA-Z]{8})/([0-9]+)/?$ show.php?mode=$1&id=$2&hash=$3 [NC] + RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+|p[0-9a-zA-Z]{8})/([0-9]+)/?$ show.php?project=$1&mode=$2&id=$3&hash=$4 [NC] + RewriteRule ^api/([a-z|A-Z]+)/([0-9]+|p[0-9a-zA-Z]{8})/([0-9]+)/(.*)$ show.php?mode=$1&id=$2&hash=$3&password=$4 [NC] + RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+|p[0-9a-zA-Z]{8})/([0-9]+)/(.*)$ show.php?project=$1&mode=$2&id=$3&hash=$4&password=$5 [NC] diff --git a/sticky-notes.spec b/sticky-notes.spec index ae0af3a..47c51d2 100644 --- a/sticky-notes.spec +++ b/sticky-notes.spec @@ -1,7 +1,7 @@ Summary: Sticky notes is a free and open source paste-bin application Name: sticky-notes -Version: 0.3.13112012.2 -Release: 1%{?dist} +Version: 0.4 +Release: 2%{?dist} License: BSD Group: Applications/Internet URL: https://github.com/sayakb/sticky-notes @@ -10,18 +10,18 @@ URL: https://github.com/sayakb/sticky-notes # wget https://nodeload.github.com/sayakb/sticky-notes/tar.gz/master Source0: sticky-notes-%{version}.tar.gz Source1: sticky-notes.conf -Patch0: 0001-Add-support-for-an-URL-shortener-ur1.ca-used-by-Iden.patch -Patch1: sticky-notes-unbundle-php-geshi.patch +Patch0: sticky-notes-unbundle-php-libs.patch +Patch1: sticky-notes-use-free-url-shortener.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch Requires: httpd -Requires: php, php-geshi, php-mysql +Requires: php, php-geshi, php-mysql, php-swift-Swift %description Sticky notes is a free and open source paste-bin application. %prep -%setup -q -n sticky-notes-master +%setup -q %patch0 -p1 %patch1 -p1 %build @@ -35,6 +35,7 @@ find . -type f -exec chmod -x {} \; # Remove bundled php-geshi rm -rf addons/geshi +rm -rf addons/swiftmailer rm -f lighttpd.conf cp -pr * ${RPM_BUILD_ROOT}%{_datadir}/%{name} mkdir ${RPM_BUILD_ROOT}%{_sysconfdir}/sticky-notes @@ -47,25 +48,22 @@ ln -sf ../../../etc/sticky-notes/install.php ${RPM_BUILD_ROOT}%{_datadir}/%{name %config(noreplace) %{_sysconfdir}/httpd/conf.d/sticky-notes.conf %config(noreplace) %{_sysconfdir}/%{name}/config.php %config(noreplace) %{_sysconfdir}/%{name}/install.php -%dir %{_datadir}/%{name} -%dir %{_sysconfdir}/sticky-notes -%{_datadir}/%{name}/addons -%{_datadir}/%{name}/admin -%{_datadir}/%{name}/api -%{_datadir}/%{name}/skins -%{_datadir}/%{name}/classes -%{_datadir}/%{name}/rss -%{_datadir}/%{name}/lang -%{_datadir}/%{name}/*.php -%{_datadir}/%{name}/robots.txt -%{_datadir}/%{name}/LICENSE -%{_datadir}/%{name}/README* -%{_datadir}/%{name}/VERSION +%dir %{_sysconfdir}/%{name} +%{_datadir}/%{name} %doc LICENSE %doc README* %doc VERSION %changelog +* Sat Jul 13 2013 Athmane Madjoudj 0.4-2 +- Patch to use free URL shortener ur1.ca instead of Google's goo.gl. + +* Sat Jul 13 2013 Athmane Madjoudj 0.4-1 +- Update to 0.4 +- Drop upstreamed patches +- Unbundle new libs +- Simplify the specfile. + * Sun Apr 14 2013 Athmane Madjoudj 0.3.13112012.2-1 - Drop upstreamed patches - Update spec (url change / download method)