diff --git a/boot.php b/boot.php
index 6695d4e52..5a563c991 100644
--- a/boot.php
+++ b/boot.php
@@ -8,11 +8,12 @@ require_once('include/datetime.php');
require_once('include/pgettext.php');
require_once('include/nav.php');
require_once('include/cache.php');
+require_once('library/Mobile_Detect/Mobile_Detect.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
-define ( 'FRIENDICA_VERSION', '3.0.1407' );
+define ( 'FRIENDICA_VERSION', '3.0.1421' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1153 );
+define ( 'DB_UPDATE_VERSION', 1154 );
define ( 'EOL', "
\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -191,6 +192,7 @@ define ( 'NOTIFY_SUGGEST', 0x0020 );
define ( 'NOTIFY_PROFILE', 0x0040 );
define ( 'NOTIFY_TAGSELF', 0x0080 );
define ( 'NOTIFY_TAGSHARE', 0x0100 );
+define ( 'NOTIFY_POKE', 0x0200 );
define ( 'NOTIFY_SYSTEM', 0x8000 );
@@ -215,7 +217,7 @@ define ( 'TERM_OBJ_PHOTO', 2 );
* various namespaces we may need to parse
*/
-define ( 'NAMESPACE_ZOT', 'http://purl.org/macgirvin/zot' );
+define ( 'NAMESPACE_ZOT', 'http://purl.org/zot' );
define ( 'NAMESPACE_DFRN' , 'http://purl.org/macgirvin/dfrn/1.0' );
define ( 'NAMESPACE_THREAD' , 'http://purl.org/syndication/thread/1.0' );
define ( 'NAMESPACE_TOMB' , 'http://purl.org/atompub/tombstones/1.0' );
@@ -250,6 +252,8 @@ define ( 'ACTIVITY_UPDATE', NAMESPACE_ACTIVITY_SCHEMA . 'update' );
define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' );
+define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' );
+
define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' );
define ( 'ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note' );
define ( 'ACTIVITY_OBJ_PERSON', NAMESPACE_ACTIVITY_SCHEMA . 'person' );
@@ -556,7 +560,7 @@ if(! class_exists('App')) {
$interval = 40000;
$this->page['title'] = $this->config['sitename'];
- $tpl = file_get_contents('view/head.tpl');
+ $tpl = get_markup_template('head.tpl');
$this->page['htmlhead'] = replace_macros($tpl,array(
'$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
'$local_user' => local_user(),
@@ -569,6 +573,13 @@ if(! class_exists('App')) {
));
}
+ function init_page_end() {
+ $tpl = get_markup_template('end.tpl');
+ $this->page['end'] = replace_macros($tpl,array(
+ '$baseurl' => $this->get_baseurl() // FIXME for z_path!!!!
+ ));
+ }
+
function set_curl_code($code) {
$this->curl_code = $code;
}
@@ -744,9 +755,10 @@ if(! function_exists('check_config')) {
// If the update fails or times-out completely you may need to
// delete the config entry to try again.
- if(get_config('database','update_' . $x))
+ $t = get_config('database','update_' . $x);
+ if($t !== false)
break;
- set_config('database','update_' . $x, '1');
+ set_config('database','update_' . $x, time());
// call the specific update
@@ -769,13 +781,14 @@ if(! function_exists('check_config')) {
. 'Content-transfer-encoding: 8bit' );
//try the logger
logger('CRITICAL: Update Failed: '. $x);
+ break;
}
- else
+ else {
set_config('database','update_' . $x, 'success');
-
+ set_config('system','build', $x + 1);
+ }
}
}
- set_config('system','build', DB_UPDATE_VERSION);
}
}
}
@@ -1238,6 +1251,12 @@ if(! function_exists('get_birthdays')) {
if(! local_user())
return $o;
+ $mobile_detect = new Mobile_Detect();
+ $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
+
+ if($is_mobile)
+ return $o;
+
$bd_format = t('g A l F d') ; // 8 AM Friday January 18
$bd_short = t('F d');
@@ -1317,6 +1336,13 @@ if(! function_exists('get_events')) {
if(! local_user())
return $o;
+
+ $mobile_detect = new Mobile_Detect();
+ $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
+
+ if($is_mobile)
+ return $o;
+
$bd_format = t('g A l F d') ; // 8 AM Friday January 18
$bd_short = t('F d');
@@ -1438,9 +1464,18 @@ if(! function_exists('current_theme')) {
$a = get_app();
- $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
- $theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
+ $mobile_detect = new Mobile_Detect();
+ $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
+ if($is_mobile) {
+ $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : '');
+ $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
+ }
+ if(!$is_mobile || ($system_theme === '' && $theme_name === '')) {
+ $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
+ $theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
+ }
+
if($theme_name &&
(file_exists('view/theme/' . $theme_name . '/style.css') ||
file_exists('view/theme/' . $theme_name . '/style.php')))
@@ -1576,18 +1611,21 @@ if(! function_exists('profile_tabs')){
'url' => $url,
'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''),
'title' => t('Status Messages and Posts'),
+ 'id' => 'status-tab',
),
array(
'label' => t('Profile'),
'url' => $url.'/?tab=profile',
'sel' => ((isset($tab) && $tab=='profile')?'active':''),
'title' => t('Profile Details'),
+ 'id' => 'profile-tab',
),
array(
'label' => t('Photos'),
'url' => $a->get_baseurl() . '/photos/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''),
'title' => t('Photo Albums'),
+ 'id' => 'photo-tab',
),
);
@@ -1597,12 +1635,14 @@ if(! function_exists('profile_tabs')){
'url' => $a->get_baseurl() . '/events',
'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''),
'title' => t('Events and Calendar'),
+ 'id' => 'events-tab',
);
$tabs[] = array(
'label' => t('Personal Notes'),
'url' => $a->get_baseurl() . '/notes',
'sel' =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''),
'title' => t('Only You Can See This'),
+ 'id' => 'notes-tab',
);
}
diff --git a/database.sql b/database.sql
index 684491685..fa4f1bd58 100644
--- a/database.sql
+++ b/database.sql
@@ -456,6 +456,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
`hook` char(255) NOT NULL,
`file` char(255) NOT NULL,
`function` char(255) NOT NULL,
+ `priority` int(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/include/Contact.php b/include/Contact.php
index 14e1a52cd..ecc271a8e 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -192,6 +192,7 @@ function contact_photo_menu($contact) {
$status_link="";
$photos_link="";
$posts_link="";
+ $poke_link="";
$sparkle = false;
if($contact['network'] === NETWORK_DFRN) {
@@ -211,10 +212,12 @@ function contact_photo_menu($contact) {
$pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
}
+ $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id'];
$contact_url = $a->get_baseurl() . '/contacts/' . $contact['id'];
$posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['id'];
$menu = Array(
+ t("Poke") => $poke_link,
t("View Status") => $status_link,
t("View Profile") => $profile_link,
t("View Photos") => $photos_link,
diff --git a/include/Photo.php b/include/Photo.php
index ba4241a7b..1f751c77f 100644
--- a/include/Photo.php
+++ b/include/Photo.php
@@ -3,495 +3,686 @@
if(! class_exists("Photo")) {
class Photo {
- private $image;
- private $width;
- private $height;
- private $valid;
- private $type;
- private $types;
+ private $image;
- /**
- * supported mimetypes and corresponding file extensions
- */
- static function supportedTypes() {
- $t = array();
- $t['image/jpeg'] ='jpg';
- if (imagetypes() & IMG_PNG) $t['image/png'] = 'png';
- return $t;
- }
+ /**
+ * Put back gd stuff, not everybody have Imagick
+ */
+ private $imagick;
+ private $width;
+ private $height;
+ private $valid;
+ private $type;
+ private $types;
- public function __construct($data, $type="image/jpeg") {
+ /**
+ * supported mimetypes and corresponding file extensions
+ */
+ static function supportedTypes() {
+ if(class_exists('Imagick')) {
+ /**
+ * Imagick::queryFormats won't help us a lot there...
+ * At least, not yet, other parts of friendica uses this array
+ */
+ $t = array(
+ 'image/jpeg' => 'jpg',
+ 'image/png' => 'png',
+ 'image/gif' => 'gif'
+ );
+ } else {
+ $t = array();
+ $t['image/jpeg'] ='jpg';
+ if (imagetypes() & IMG_PNG) $t['image/png'] = 'png';
+ }
- $this->types = $this->supportedTypes();
- if (!array_key_exists($type,$this->types)){
- $type='image/jpeg';
- }
- $this->valid = false;
- $this->type = $type;
- $this->image = @imagecreatefromstring($data);
- if($this->image !== FALSE) {
- $this->width = imagesx($this->image);
- $this->height = imagesy($this->image);
- $this->valid = true;
- imagealphablending($this->image, false);
- imagesavealpha($this->image, true);
- }
- }
+ return $t;
+ }
- public function __destruct() {
- if($this->image)
- imagedestroy($this->image);
- }
+ public function __construct($data, $type=null) {
+ $this->imagick = class_exists('Imagick');
+ $this->types = $this->supportedTypes();
+ if (!array_key_exists($type,$this->types)){
+ $type='image/jpeg';
+ }
+ $this->type = $type;
- public function is_valid() {
- return $this->valid;
- }
+ if($this->is_imagick()) {
+ $this->image = new Imagick();
+ $this->image->readImageBlob($data);
- public function getWidth() {
- return $this->width;
- }
+ /**
+ * Setup the image to the format it will be saved to
+ */
+ $map = $this->get_FormatsMap();
+ $format = $map[$type];
+ $this->image->setFormat($format);
- public function getHeight() {
- return $this->height;
- }
+ // Always coalesce, if it is not a multi-frame image it won't hurt anyway
+ $this->image = $this->image->coalesceImages();
- public function getImage() {
- return $this->image;
- }
-
- public function getType() {
- return $this->type;
- }
- public function getExt() {
- return $this->types[$this->type];
- }
+ /**
+ * setup the compression here, so we'll do it only once
+ */
+ switch($this->getType()){
+ case "image/png":
+ $quality = get_config('system','png_quality');
+ if((! $quality) || ($quality > 9))
+ $quality = PNG_QUALITY;
+ /**
+ * From http://www.imagemagick.org/script/command-line-options.php#quality:
+ *
+ * 'For the MNG and PNG image formats, the quality value sets
+ * the zlib compression level (quality / 10) and filter-type (quality % 10).
+ * The default PNG "quality" is 75, which means compression level 7 with adaptive PNG filtering,
+ * unless the image has a color map, in which case it means compression level 7 with no PNG filtering'
+ */
+ $quality = $quality * 10;
+ $this->image->setCompressionQuality($quality);
+ break;
+ case "image/jpeg":
+ $quality = get_config('system','jpeg_quality');
+ if((! $quality) || ($quality > 100))
+ $quality = JPEG_QUALITY;
+ $this->image->setCompressionQuality($quality);
+ }
+ } else {
+ $this->valid = false;
+ $this->image = @imagecreatefromstring($data);
+ if($this->image !== FALSE) {
+ $this->width = imagesx($this->image);
+ $this->height = imagesy($this->image);
+ $this->valid = true;
+ imagealphablending($this->image, false);
+ imagesavealpha($this->image, true);
+ }
+ }
+ }
- public function scaleImage($max) {
+ public function __destruct() {
+ if($this->image) {
+ if($this->is_imagick()) {
+ $this->image->clear();
+ $this->image->destroy();
+ return;
+ }
+ imagedestroy($this->image);
+ }
+ }
- $width = $this->width;
- $height = $this->height;
+ public function is_imagick() {
+ return $this->imagick;
+ }
- $dest_width = $dest_height = 0;
+ /**
+ * Maps Mime types to Imagick formats
+ */
+ public function get_FormatsMap() {
+ $m = array(
+ 'image/jpeg' => 'JPG',
+ 'image/png' => 'PNG',
+ 'image/gif' => 'GIF'
+ );
+ return $m;
+ }
- if((! $width)|| (! $height))
- return FALSE;
+ public function is_valid() {
+ if($this->is_imagick())
+ return ($this->image !== FALSE);
+ return $this->valid;
+ }
- if($width > $max && $height > $max) {
- if($width > $height) {
- $dest_width = $max;
- $dest_height = intval(( $height * $max ) / $width);
- }
- else {
- $dest_width = intval(( $width * $max ) / $height);
- $dest_height = $max;
- }
- }
- else {
- if( $width > $max ) {
- $dest_width = $max;
- $dest_height = intval(( $height * $max ) / $width);
- }
- else {
- if( $height > $max ) {
- $dest_width = intval(( $width * $max ) / $height);
- $dest_height = $max;
- }
- else {
- $dest_width = $width;
- $dest_height = $height;
- }
- }
- }
+ public function getWidth() {
+ if(!$this->is_valid())
+ return FALSE;
+
+ if($this->is_imagick())
+ return $this->image->getImageWidth();
+ return $this->width;
+ }
+
+ public function getHeight() {
+ if(!$this->is_valid())
+ return FALSE;
+
+ if($this->is_imagick())
+ return $this->image->getImageHeight();
+ return $this->height;
+ }
+
+ public function getImage() {
+ if(!$this->is_valid())
+ return FALSE;
+
+ if($this->is_imagick()) {
+ /* Clean it */
+ $this->image = $this->image->deconstructImages();
+ return $this->image;
+ }
+ return $this->image;
+ }
+
+ public function getType() {
+ if(!$this->is_valid())
+ return FALSE;
+
+ return $this->type;
+ }
+
+ public function getExt() {
+ if(!$this->is_valid())
+ return FALSE;
+
+ return $this->types[$this->getType()];
+ }
+
+ public function scaleImage($max) {
+ if(!$this->is_valid())
+ return FALSE;
+
+ if($this->is_imagick()) {
+ /**
+ * If it is not animated, there will be only one iteration here,
+ * so don't bother checking
+ */
+ // Don't forget to go back to the first frame
+ $this->image->setFirstIterator();
+ do {
+ $this->image->resizeImage($max, $max, imagick::FILTER_LANCZOS, 1, true);
+ } while ($this->image->nextImage());
+ return;
+ }
+
+ $width = $this->width;
+ $height = $this->height;
+
+ $dest_width = $dest_height = 0;
+
+ if((! $width)|| (! $height))
+ return FALSE;
+
+ if($width > $max && $height > $max) {
+ if($width > $height) {
+ $dest_width = $max;
+ $dest_height = intval(( $height * $max ) / $width);
+ }
+ else {
+ $dest_width = intval(( $width * $max ) / $height);
+ $dest_height = $max;
+ }
+ }
+ else {
+ if( $width > $max ) {
+ $dest_width = $max;
+ $dest_height = intval(( $height * $max ) / $width);
+ }
+ else {
+ if( $height > $max ) {
+ $dest_width = intval(( $width * $max ) / $height);
+ $dest_height = $max;
+ }
+ else {
+ $dest_width = $width;
+ $dest_height = $height;
+ }
+ }
+ }
- $dest = imagecreatetruecolor( $dest_width, $dest_height );
- imagealphablending($dest, false);
- imagesavealpha($dest, true);
- if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
- imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height);
- if($this->image)
- imagedestroy($this->image);
- $this->image = $dest;
- $this->width = imagesx($this->image);
- $this->height = imagesy($this->image);
+ $dest = imagecreatetruecolor( $dest_width, $dest_height );
+ imagealphablending($dest, false);
+ imagesavealpha($dest, true);
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
+ imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height);
+ if($this->image)
+ imagedestroy($this->image);
+ $this->image = $dest;
+ $this->width = imagesx($this->image);
+ $this->height = imagesy($this->image);
+ }
- }
+ public function rotate($degrees) {
+ if(!$this->is_valid())
+ return FALSE;
- public function rotate($degrees) {
- $this->image = imagerotate($this->image,$degrees,0);
- $this->width = imagesx($this->image);
- $this->height = imagesy($this->image);
- }
+ if($this->is_imagick()) {
+ $this->image->setFirstIterator();
+ do {
+ $this->image->rotateImage(new ImagickPixel(), $degrees);
+ } while ($this->image->nextImage());
+ return;
+ }
- public function flip($horiz = true, $vert = false) {
- $w = imagesx($this->image);
- $h = imagesy($this->image);
- $flipped = imagecreate($w, $h);
- if($horiz) {
- for ($x = 0; $x < $w; $x++) {
- imagecopy($flipped, $this->image, $x, 0, $w - $x - 1, 0, 1, $h);
- }
- }
- if($vert) {
- for ($y = 0; $y < $h; $y++) {
- imagecopy($flipped, $this->image, 0, $y, 0, $h - $y - 1, $w, 1);
- }
- }
- $this->image = $flipped;
- }
+ $this->image = imagerotate($this->image,$degrees,0);
+ $this->width = imagesx($this->image);
+ $this->height = imagesy($this->image);
+ }
- public function orient($filename) {
- // based off comment on http://php.net/manual/en/function.imagerotate.php
+ public function flip($horiz = true, $vert = false) {
+ if(!$this->is_valid())
+ return FALSE;
- if( (! function_exists('exif_read_data')) || ($this->getType() !== 'image/jpeg') )
- return;
+ if($this->is_imagick()) {
+ $this->image->setFirstIterator();
+ do {
+ if($horiz) $this->image->flipImage();
+ if($vert) $this->image->flopImage();
+ } while ($this->image->nextImage());
+ return;
+ }
- $exif = exif_read_data($filename);
- $ort = $exif['Orientation'];
+ $w = imagesx($this->image);
+ $h = imagesy($this->image);
+ $flipped = imagecreate($w, $h);
+ if($horiz) {
+ for ($x = 0; $x < $w; $x++) {
+ imagecopy($flipped, $this->image, $x, 0, $w - $x - 1, 0, 1, $h);
+ }
+ }
+ if($vert) {
+ for ($y = 0; $y < $h; $y++) {
+ imagecopy($flipped, $this->image, 0, $y, 0, $h - $y - 1, $w, 1);
+ }
+ }
+ $this->image = $flipped;
+ }
- switch($ort)
- {
- case 1: // nothing
- break;
+ public function orient($filename) {
+ // based off comment on http://php.net/manual/en/function.imagerotate.php
- case 2: // horizontal flip
- $this->flip();
- break;
-
- case 3: // 180 rotate left
- $this->rotate(180);
- break;
-
- case 4: // vertical flip
- $this->flip(false, true);
- break;
-
- case 5: // vertical flip + 90 rotate right
- $this->flip(false, true);
+ if(!$this->is_valid())
+ return FALSE;
+
+ if( (! function_exists('exif_read_data')) || ($this->getType() !== 'image/jpeg') )
+ return;
+
+ $exif = exif_read_data($filename);
+ $ort = $exif['Orientation'];
+
+ switch($ort)
+ {
+ case 1: // nothing
+ break;
+
+ case 2: // horizontal flip
+ $this->flip();
+ break;
+
+ case 3: // 180 rotate left
+ $this->rotate(180);
+ break;
+
+ case 4: // vertical flip
+ $this->flip(false, true);
+ break;
+
+ case 5: // vertical flip + 90 rotate right
+ $this->flip(false, true);
$this->rotate(-90);
- break;
-
- case 6: // 90 rotate right
- $this->rotate(-90);
- break;
-
- case 7: // horizontal flip + 90 rotate right
- $this->flip();
- $this->rotate(-90);
- break;
-
- case 8: // 90 rotate left
- $this->rotate(90);
- break;
- }
- }
+ break;
+
+ case 6: // 90 rotate right
+ $this->rotate(-90);
+ break;
+
+ case 7: // horizontal flip + 90 rotate right
+ $this->flip();
+ $this->rotate(-90);
+ break;
+
+ case 8: // 90 rotate left
+ $this->rotate(90);
+ break;
+ }
+ }
- public function scaleImageUp($min) {
+ public function scaleImageUp($min) {
+ if(!$this->is_valid())
+ return FALSE;
- $width = $this->width;
- $height = $this->height;
+ if($this->is_imagick())
+ return $this->scaleImage($min);
- $dest_width = $dest_height = 0;
+ $width = $this->width;
+ $height = $this->height;
- if((! $width)|| (! $height))
- return FALSE;
+ $dest_width = $dest_height = 0;
- if($width < $min && $height < $min) {
- if($width > $height) {
- $dest_width = $min;
- $dest_height = intval(( $height * $min ) / $width);
- }
- else {
- $dest_width = intval(( $width * $min ) / $height);
- $dest_height = $min;
- }
- }
- else {
- if( $width < $min ) {
- $dest_width = $min;
- $dest_height = intval(( $height * $min ) / $width);
- }
- else {
- if( $height < $min ) {
- $dest_width = intval(( $width * $min ) / $height);
- $dest_height = $min;
- }
- else {
- $dest_width = $width;
- $dest_height = $height;
- }
- }
- }
+ if((! $width)|| (! $height))
+ return FALSE;
+
+ if($width < $min && $height < $min) {
+ if($width > $height) {
+ $dest_width = $min;
+ $dest_height = intval(( $height * $min ) / $width);
+ }
+ else {
+ $dest_width = intval(( $width * $min ) / $height);
+ $dest_height = $min;
+ }
+ }
+ else {
+ if( $width < $min ) {
+ $dest_width = $min;
+ $dest_height = intval(( $height * $min ) / $width);
+ }
+ else {
+ if( $height < $min ) {
+ $dest_width = intval(( $width * $min ) / $height);
+ $dest_height = $min;
+ }
+ else {
+ $dest_width = $width;
+ $dest_height = $height;
+ }
+ }
+ }
- $dest = imagecreatetruecolor( $dest_width, $dest_height );
- imagealphablending($dest, false);
- imagesavealpha($dest, true);
- if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
- imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height);
- if($this->image)
- imagedestroy($this->image);
- $this->image = $dest;
- $this->width = imagesx($this->image);
- $this->height = imagesy($this->image);
-
- }
+ $dest = imagecreatetruecolor( $dest_width, $dest_height );
+ imagealphablending($dest, false);
+ imagesavealpha($dest, true);
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
+ imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height);
+ if($this->image)
+ imagedestroy($this->image);
+ $this->image = $dest;
+ $this->width = imagesx($this->image);
+ $this->height = imagesy($this->image);
+ }
- public function scaleImageSquare($dim) {
+ public function scaleImageSquare($dim) {
+ if(!$this->is_valid())
+ return FALSE;
- $dest = imagecreatetruecolor( $dim, $dim );
- imagealphablending($dest, false);
- imagesavealpha($dest, true);
- if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
- imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dim, $dim, $this->width, $this->height);
- if($this->image)
- imagedestroy($this->image);
- $this->image = $dest;
- $this->width = imagesx($this->image);
- $this->height = imagesy($this->image);
- }
+ if($this->is_imagick()) {
+ $this->image->setFirstIterator();
+ do {
+ $this->image->resizeImage($dim, $dim, imagick::FILTER_LANCZOS, 1, false);
+ } while ($this->image->nextImage());
+ return;
+ }
+
+ $dest = imagecreatetruecolor( $dim, $dim );
+ imagealphablending($dest, false);
+ imagesavealpha($dest, true);
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
+ imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dim, $dim, $this->width, $this->height);
+ if($this->image)
+ imagedestroy($this->image);
+ $this->image = $dest;
+ $this->width = imagesx($this->image);
+ $this->height = imagesy($this->image);
+ }
- public function cropImage($max,$x,$y,$w,$h) {
- $dest = imagecreatetruecolor( $max, $max );
- imagealphablending($dest, false);
- imagesavealpha($dest, true);
- if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
- imagecopyresampled($dest, $this->image, 0, 0, $x, $y, $max, $max, $w, $h);
- if($this->image)
- imagedestroy($this->image);
- $this->image = $dest;
- $this->width = imagesx($this->image);
- $this->height = imagesy($this->image);
- }
+ public function cropImage($max,$x,$y,$w,$h) {
+ if(!$this->is_valid())
+ return FALSE;
- public function saveImage($path) {
- switch($this->type){
- case "image/png":
- $quality = get_config('system','png_quality');
- if((! $quality) || ($quality > 9))
- $quality = PNG_QUALITY;
- imagepng($this->image, $path, $quality);
- break;
- default:
- $quality = get_config('system','jpeg_quality');
- if((! $quality) || ($quality > 100))
- $quality = JPEG_QUALITY;
- imagejpeg($this->image,$path,$quality);
- }
-
- }
+ if($this->is_imagick()) {
+ $this->image->setFirstIterator();
+ do {
+ $this->image->cropImage($w, $h, $x, $y);
+ /**
+ * We need to remove the canva,
+ * or the image is not resized to the crop:
+ * http://php.net/manual/en/imagick.cropimage.php#97232
+ */
+ $this->image->setImagePage(0, 0, 0, 0);
+ } while ($this->image->nextImage());
+ return $this->scaleImage($max);
+ }
- public function imageString() {
- ob_start();
- switch($this->type){
- case "image/png":
- $quality = get_config('system','png_quality');
- if((! $quality) || ($quality > 9))
- $quality = PNG_QUALITY;
- imagepng($this->image,NULL, $quality);
- break;
- default:
- $quality = get_config('system','jpeg_quality');
- if((! $quality) || ($quality > 100))
- $quality = JPEG_QUALITY;
+ $dest = imagecreatetruecolor( $max, $max );
+ imagealphablending($dest, false);
+ imagesavealpha($dest, true);
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
+ imagecopyresampled($dest, $this->image, 0, 0, $x, $y, $max, $max, $w, $h);
+ if($this->image)
+ imagedestroy($this->image);
+ $this->image = $dest;
+ $this->width = imagesx($this->image);
+ $this->height = imagesy($this->image);
+ }
- imagejpeg($this->image,NULL,$quality);
- }
- $s = ob_get_contents();
- ob_end_clean();
- return $s;
- }
+ public function saveImage($path) {
+ if(!$this->is_valid())
+ return FALSE;
+
+ $string = $this->imageString();
+ file_put_contents($path, $string);
+ }
+
+ public function imageString() {
+ if(!$this->is_valid())
+ return FALSE;
+
+ if($this->is_imagick()) {
+ /* Clean it */
+ $this->image = $this->image->deconstructImages();
+ $string = $this->image->getImagesBlob();
+ return $string;
+ }
+
+ $quality = FALSE;
+
+ ob_start();
+
+ switch($this->getType()){
+ case "image/png":
+ $quality = get_config('system','png_quality');
+ if((! $quality) || ($quality > 9))
+ $quality = PNG_QUALITY;
+ imagepng($this->image,NULL, $quality);
+ break;
+ case "image/jpeg":
+ $quality = get_config('system','jpeg_quality');
+ if((! $quality) || ($quality > 100))
+ $quality = JPEG_QUALITY;
+ imagejpeg($this->image,NULL,$quality);
+ }
+ $string = ob_get_contents();
+ ob_end_clean();
+
+ return $string;
+ }
- public function store($uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') {
+ public function store($uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') {
- $r = q("select `guid` from photo where `resource-id` = '%s' and `guid` != '' limit 1",
- dbesc($rid)
- );
- if(count($r))
- $guid = $r[0]['guid'];
- else
- $guid = get_guid();
+ $r = q("select `guid` from photo where `resource-id` = '%s' and `guid` != '' limit 1",
+ dbesc($rid)
+ );
+ if(count($r))
+ $guid = $r[0]['guid'];
+ else
+ $guid = get_guid();
- $x = q("select id from photo where `resource-id` = '%s' and uid = %d and `contact-id` = %d and `scale` = %d limit 1",
- dbesc($rid),
- intval($uid),
- intval($cid),
- intval($scale)
- );
- if(count($x)) {
- $r = q("UPDATE `photo`
- set `uid` = %d,
- `contact-id` = %d,
- `guid` = '%s',
- `resource-id` = '%s',
- `created` = '%s',
- `edited` = '%s',
- `filename` = '%s',
- `type` = '%s',
- `album` = '%s',
- `height` = %d,
- `width` = %d,
- `data` = '%s',
- `scale` = %d,
- `profile` = %d,
- `allow_cid` = '%s',
- `allow_gid` = '%s',
- `deny_cid` = '%s',
- `deny_gid` = '%s'
- where id = %d limit 1",
+ $x = q("select id from photo where `resource-id` = '%s' and uid = %d and `contact-id` = %d and `scale` = %d limit 1",
+ dbesc($rid),
+ intval($uid),
+ intval($cid),
+ intval($scale)
+ );
+ if(count($x)) {
+ $r = q("UPDATE `photo`
+ set `uid` = %d,
+ `contact-id` = %d,
+ `guid` = '%s',
+ `resource-id` = '%s',
+ `created` = '%s',
+ `edited` = '%s',
+ `filename` = '%s',
+ `type` = '%s',
+ `album` = '%s',
+ `height` = %d,
+ `width` = %d,
+ `data` = '%s',
+ `scale` = %d,
+ `profile` = %d,
+ `allow_cid` = '%s',
+ `allow_gid` = '%s',
+ `deny_cid` = '%s',
+ `deny_gid` = '%s'
+ where id = %d limit 1",
- intval($uid),
- intval($cid),
- dbesc($guid),
- dbesc($rid),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc(basename($filename)),
- dbesc($this->type),
- dbesc($album),
- intval($this->height),
- intval($this->width),
- dbesc($this->imageString()),
- intval($scale),
- intval($profile),
- dbesc($allow_cid),
- dbesc($allow_gid),
- dbesc($deny_cid),
- dbesc($deny_gid),
- intval($x[0]['id'])
- );
- }
- else {
- $r = q("INSERT INTO `photo`
- ( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
- VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
- intval($uid),
- intval($cid),
- dbesc($guid),
- dbesc($rid),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc(basename($filename)),
- dbesc($this->type),
- dbesc($album),
- intval($this->height),
- intval($this->width),
- dbesc($this->imageString()),
- intval($scale),
- intval($profile),
- dbesc($allow_cid),
- dbesc($allow_gid),
- dbesc($deny_cid),
- dbesc($deny_gid)
- );
- }
- return $r;
- }
+ intval($uid),
+ intval($cid),
+ dbesc($guid),
+ dbesc($rid),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc(basename($filename)),
+ dbesc($this->getType()),
+ dbesc($album),
+ intval($this->getHeight()),
+ intval($this->getWidth()),
+ dbesc($this->imageString()),
+ intval($scale),
+ intval($profile),
+ dbesc($allow_cid),
+ dbesc($allow_gid),
+ dbesc($deny_cid),
+ dbesc($deny_gid),
+ intval($x[0]['id'])
+ );
+ }
+ else {
+ $r = q("INSERT INTO `photo`
+ ( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
+ VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
+ intval($uid),
+ intval($cid),
+ dbesc($guid),
+ dbesc($rid),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc(basename($filename)),
+ dbesc($this->getType()),
+ dbesc($album),
+ intval($this->getHeight()),
+ intval($this->getWidth()),
+ dbesc($this->imageString()),
+ intval($scale),
+ intval($profile),
+ dbesc($allow_cid),
+ dbesc($allow_gid),
+ dbesc($deny_cid),
+ dbesc($deny_gid)
+ );
+ }
+ return $r;
+ }
}}
/**
* Guess image mimetype from filename or from Content-Type header
- *
+ *
* @arg $filename string Image filename
* @arg $fromcurl boolean Check Content-Type header from curl request
*/
function guess_image_type($filename, $fromcurl=false) {
logger('Photo: guess_image_type: '.$filename . ($fromcurl?' from curl headers':''), LOGGER_DEBUG);
- $type = null;
- if ($fromcurl) {
- $a = get_app();
- $headers=array();
- $h = explode("\n",$a->get_curl_headers());
- foreach ($h as $l) {
- list($k,$v) = array_map("trim", explode(":", trim($l), 2));
- $headers[$k] = $v;
- }
- if (array_key_exists('Content-Type', $headers))
- $type = $headers['Content-Type'];
- }
- if (is_null($type)){
- $ext = pathinfo($filename, PATHINFO_EXTENSION);
- $types = Photo::supportedTypes();
- $type = "image/jpeg";
- foreach ($types as $m=>$e){
- if ($ext==$e) $type = $m;
- }
-
- }
+ $type = null;
+ if ($fromcurl) {
+ $a = get_app();
+ $headers=array();
+ $h = explode("\n",$a->get_curl_headers());
+ foreach ($h as $l) {
+ list($k,$v) = array_map("trim", explode(":", trim($l), 2));
+ $headers[$k] = $v;
+ }
+ if (array_key_exists('Content-Type', $headers))
+ $type = $headers['Content-Type'];
+ }
+ if (is_null($type)){
+ // Guessing from extension? Isn't that... dangerous?
+ if(class_exists('Imagick')) {
+ /**
+ * Well, this not much better,
+ * but at least it comes from the data inside the image,
+ * we won't be tricked by a manipulated extension
+ */
+ $image = new Imagick($filename);
+ $type = $image->getImageMimeType();
+ } else {
+ $ext = pathinfo($filename, PATHINFO_EXTENSION);
+ $types = Photo::supportedTypes();
+ $type = "image/jpeg";
+ foreach ($types as $m=>$e){
+ if ($ext==$e) $type = $m;
+ }
+ }
+ }
logger('Photo: guess_image_type: type='.$type, LOGGER_DEBUG);
- return $type;
-
+ return $type;
+
}
function import_profile_photo($photo,$uid,$cid) {
- $a = get_app();
+ $a = get_app();
- $r = q("select `resource-id` from photo where `uid` = %d and `contact-id` = %d and `scale` = 4 and `album` = 'Contact Photos' limit 1",
- intval($uid),
- intval($cid)
- );
- if(count($r)) {
- $hash = $r[0]['resource-id'];
- }
- else {
- $hash = photo_new_resource();
- }
-
- $photo_failure = false;
+ $r = q("select `resource-id` from photo where `uid` = %d and `contact-id` = %d and `scale` = 4 and `album` = 'Contact Photos' limit 1",
+ intval($uid),
+ intval($cid)
+ );
+ if(count($r)) {
+ $hash = $r[0]['resource-id'];
+ }
+ else {
+ $hash = photo_new_resource();
+ }
- $filename = basename($photo);
- $img_str = fetch_url($photo,true);
-
- // guess mimetype from headers or filename
- $type = guess_image_type($photo,true);
+ $photo_failure = false;
-
- $img = new Photo($img_str, $type);
- if($img->is_valid()) {
+ $filename = basename($photo);
+ $img_str = fetch_url($photo,true);
- $img->scaleImageSquare(175);
-
- $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 4 );
+ $type = guess_image_type($photo,true);
+ $img = new Photo($img_str, $type);
+ if($img->is_valid()) {
- if($r === false)
- $photo_failure = true;
+ $img->scaleImageSquare(175);
- $img->scaleImage(80);
+ $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 4 );
- $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 5 );
+ if($r === false)
+ $photo_failure = true;
- if($r === false)
- $photo_failure = true;
+ $img->scaleImage(80);
- $img->scaleImage(48);
+ $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 5 );
- $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 6 );
+ if($r === false)
+ $photo_failure = true;
- if($r === false)
- $photo_failure = true;
+ $img->scaleImage(48);
- $photo = $a->get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
- $thumb = $a->get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
- $micro = $a->get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
- }
- else
- $photo_failure = true;
+ $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 6 );
- if($photo_failure) {
- $photo = $a->get_baseurl() . '/images/person-175.jpg';
- $thumb = $a->get_baseurl() . '/images/person-80.jpg';
- $micro = $a->get_baseurl() . '/images/person-48.jpg';
- }
+ if($r === false)
+ $photo_failure = true;
- return(array($photo,$thumb,$micro));
+ $photo = $a->get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
+ $thumb = $a->get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
+ $micro = $a->get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
+ }
+ else
+ $photo_failure = true;
+
+ if($photo_failure) {
+ $photo = $a->get_baseurl() . '/images/person-175.jpg';
+ $thumb = $a->get_baseurl() . '/images/person-80.jpg';
+ $micro = $a->get_baseurl() . '/images/person-48.jpg';
+ }
+
+ return(array($photo,$thumb,$micro));
}
diff --git a/include/conversation.php b/include/conversation.php
index 546e27db6..9047a9779 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -162,6 +162,49 @@ function localize_item(&$item){
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
}
+ if (stristr($item['verb'],ACTIVITY_POKE)) {
+ $verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
+ if(! $verb)
+ return;
+ if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
+
+ $Aname = $item['author-name'];
+ $Alink = $item['author-link'];
+
+ $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
+
+ $obj = parse_xml_string($xmlhead.$item['object']);
+ $links = parse_xml_string($xmlhead."
tag + */ + +$a->init_page_end(); if(! x($_SESSION,'sysmsg')) diff --git a/js/acl.min.js b/js/acl.min.js new file mode 100644 index 000000000..74904a02c --- /dev/null +++ b/js/acl.min.js @@ -0,0 +1 @@ +function ACL(e,t){that=this,that.url=e,that.kp_timer=null,t==undefined&&(t=[]),that.allow_cid=t[0]||[],that.allow_gid=t[1]||[],that.deny_cid=t[2]||[],that.deny_gid=t[3]||[],that.group_uids=[],that.nw=4,that.list_content=$("#acl-list-content"),that.item_tpl=unescape($(".acl-list-item[rel=acl-template]").html()),that.showall=$("#acl-showall"),t.length==0&&that.showall.addClass("selected"),that.showall.click(that.on_showall),$(".acl-button-show").live("click",that.on_button_show),$(".acl-button-hide").live("click",that.on_button_hide),$("#acl-search").keypress(that.on_search),$("#acl-wrapper").parents("form").submit(that.on_submit),that.get(0,100)}ACL.prototype.on_submit=function(){aclfileds=$("#acl-fields").html(""),$(that.allow_gid).each(function(e,t){aclfileds.append("")}),$(that.allow_cid).each(function(e,t){aclfileds.append("")}),$(that.deny_gid).each(function(e,t){aclfileds.append("")}),$(that.deny_cid).each(function(e,t){aclfileds.append("")})},ACL.prototype.search=function(){var e=$("#acl-search").val();that.list_content.html(""),that.get(0,100,e)},ACL.prototype.on_search=function(e){that.kp_timer&&clearTimeout(that.kp_timer),that.kp_timer=setTimeout(that.search,1e3)},ACL.prototype.on_showall=function(e){return e.preventDefault(),e.stopPropagation(),that.showall.hasClass("selected")?!1:(that.showall.addClass("selected"),that.allow_cid=[],that.allow_gid=[],that.deny_cid=[],that.deny_gid=[],that.update_view(),!1)},ACL.prototype.on_button_show=function(e){return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),that.set_allow($(this).parent().attr("id")),!1},ACL.prototype.on_button_hide=function(e){return e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),that.set_deny($(this).parent().attr("id")),!1},ACL.prototype.set_allow=function(e){type=e[0],id=parseInt(e.substr(1));switch(type){case"g":that.allow_gid.indexOf(id)<0?that.allow_gid.push(id):that.allow_gid.remove(id),that.deny_gid.indexOf(id)>=0&&that.deny_gid.remove(id);break;case"c":that.allow_cid.indexOf(id)<0?that.allow_cid.push(id):that.allow_cid.remove(id),that.deny_cid.indexOf(id)>=0&&that.deny_cid.remove(id)}that.update_view()},ACL.prototype.set_deny=function(e){type=e[0],id=parseInt(e.substr(1));switch(type){case"g":that.deny_gid.indexOf(id)<0?that.deny_gid.push(id):that.deny_gid.remove(id),that.allow_gid.indexOf(id)>=0&&that.allow_gid.remove(id);break;case"c":that.deny_cid.indexOf(id)<0?that.deny_cid.push(id):that.deny_cid.remove(id),that.allow_cid.indexOf(id)>=0&&that.allow_cid.remove(id)}that.update_view()},ACL.prototype.update_view=function(){that.allow_gid.length==0&&that.allow_cid.length==0&&that.deny_gid.length==0&&that.deny_cid.length==0?(that.showall.addClass("selected"),$("#jot-perms-icon").removeClass("lock").addClass("unlock"),$("#jot-public").show(),$(".profile-jot-net input").attr("disabled",!1),typeof editor!="undefined"&&editor!=0&&$("#profile-jot-desc").html(ispublic)):(that.showall.removeClass("selected"),$("#jot-perms-icon").removeClass("unlock").addClass("lock"),$("#jot-public").hide(),$(".profile-jot-net input").attr("disabled","disabled"),$("#profile-jot-desc").html(" ")),$("#acl-list-content .acl-list-item").each(function(){$(this).removeClass("groupshow grouphide")}),$("#acl-list-content .acl-list-item").each(function(){itemid=$(this).attr("id"),type=itemid[0],id=parseInt(itemid.substr(1)),btshow=$(this).children(".acl-button-show").removeClass("selected"),bthide=$(this).children(".acl-button-hide").removeClass("selected");switch(type){case"g":var e="";that.allow_gid.indexOf(id)>=0&&(btshow.addClass("selected"),bthide.removeClass("selected"),e="groupshow"),that.deny_gid.indexOf(id)>=0&&(btshow.removeClass("selected"),bthide.addClass("selected"),e="grouphide"),$(that.group_uids[id]).each(function(t,n){e=="grouphide"&&$("#c"+n).removeClass("groupshow");if(e!=""){var r=$("#c"+n).attr("class");if(r==undefined)return!0;var i=r.indexOf("grouphide");i==-1&&$("#c"+n).addClass(e)}});break;case"c":that.allow_cid.indexOf(id)>=0&&(btshow.addClass("selected"),bthide.removeClass("selected")),that.deny_cid.indexOf(id)>=0&&(btshow.removeClass("selected"),bthide.addClass("selected"))}})},ACL.prototype.get=function(e,t,n){var r={start:e,count:t,search:n};$.ajax({type:"POST",url:that.url,data:r,dataType:"json",success:that.populate})},ACL.prototype.populate=function(e){var t=Math.ceil(e.tot/that.nw)*42;that.list_content.height(t),$(e.items).each(function(){html="
",html=html.format(this.photo,this.name,this.type,this.id,"",this.network,this.link),this.uids!=undefined&&(that.group_uids[this.id]=this.uids),that.list_content.append(html)}),that.update_view()}; \ No newline at end of file diff --git a/js/ajaxupload.min.js b/js/ajaxupload.min.js new file mode 100644 index 000000000..246f2bdb2 --- /dev/null +++ b/js/ajaxupload.min.js @@ -0,0 +1,6 @@ +/** + * AJAX Upload ( http://valums.com/ajax-upload/ ) + * Copyright (c) Andris Valums + * Licensed under the MIT license ( http://valums.com/mit-license/ ) + * Thanks to Gary Haran, David Mark, Corey Burns and others for contributions. + */(function(){function log(){typeof console!="undefined"&&typeof console.log=="function"&&(Array.prototype.unshift.call(arguments,"[Ajax Upload]"),console.log(Array.prototype.join.call(arguments," ")))}function addEvent(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{if(!e.attachEvent)throw new Error("not supported or DOM not loaded");e.attachEvent("on"+t,function(){n.call(e)})}}function addResizeEvent(e){var t;addEvent(window,"resize",function(){t&&clearTimeout(t),t=setTimeout(e,100)})}function getBox(e){var t,n,r,i,s=getOffset(e);return t=s.left,r=s.top,n=t+e.offsetWidth,i=r+e.offsetHeight,{left:t,right:n,top:r,bottom:i}}function addStyles(e,t){for(var n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n])}function copyLayout(e,t){var n=getBox(e);addStyles(t,{position:"absolute",left:n.left+"px",top:n.top+"px",width:e.offsetWidth+"px",height:e.offsetHeight+"px"}),t.title=e.title}function fileFromPath(e){return e.replace(/.*(\/|\\)/,"")}function getExt(e){return-1!==e.indexOf(".")?e.replace(/.*[.]/,""):""}function hasClass(e,t){var n=new RegExp("\\b"+t+"\\b");return n.test(e.className)}function addClass(e,t){hasClass(e,t)||(e.className+=" "+t)}function removeClass(e,t){var n=new RegExp("\\b"+t+"\\b");e.className=e.className.replace(n,"")}function removeNode(e){e.parentNode.removeChild(e)}if(document.documentElement.getBoundingClientRect)var getOffset=function(e){var t=e.getBoundingClientRect(),n=e.ownerDocument,r=n.body,i=n.documentElement,s=i.clientTop||r.clientTop||0,o=i.clientLeft||r.clientLeft||0,u=1;if(r.getBoundingClientRect){var a=r.getBoundingClientRect();u=(a.right-a.left)/r.clientWidth}u>1&&(s=0,o=0);var f=t.top/u+(window.pageYOffset||i&&i.scrollTop/u||r.scrollTop/u)-s,l=t.left/u+(window.pageXOffset||i&&i.scrollLeft/u||r.scrollLeft/u)-o;return{top:f,left:l}};else var getOffset=function(e){var t=0,n=0;do t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;while(e);return{left:n,top:t}};var toElement=function(){var e=document.createElement("div");return function(t){e.innerHTML=t;var n=e.firstChild;return e.removeChild(n)}}(),getUID=function(){var e=0;return function(){return"ValumsAjaxUpload"+e++}}();window.AjaxUpload=function(e,t){this._settings={action:"upload.php",name:"userfile",data:{},autoSubmit:!0,responseType:!1,hoverClass:"hover",focusClass:"focus",disabledClass:"disabled",onChange:function(e,t){},onSubmit:function(e,t){},onComplete:function(e,t){}};for(var n in t)t.hasOwnProperty(n)&&(this._settings[n]=t[n]);e.jquery?e=e[0]:typeof e=="string"&&(/^#.*/.test(e)&&(e=e.slice(1)),e=document.getElementById(e));if(!e||e.nodeType!==1)throw new Error("Please make sure that you're passing a valid element");e.nodeName.toUpperCase()=="A"&&addEvent(e,"click",function(e){e&&e.preventDefault?e.preventDefault():window.event&&(window.event.returnValue=!1)}),this._button=e,this._input=null,this._disabled=!1,this.enable(),this._rerouteClicks()},AjaxUpload.prototype={setData:function(e){this._settings.data=e},disable:function(){addClass(this._button,this._settings.disabledClass),this._disabled=!0;var e=this._button.nodeName.toUpperCase();(e=="INPUT"||e=="BUTTON")&&this._button.setAttribute("disabled","disabled"),this._input&&(this._input.parentNode.style.visibility="hidden")},enable:function(){removeClass(this._button,this._settings.disabledClass),this._button.removeAttribute("disabled"),this._disabled=!1},_createInput:function(){var e=this,t=document.createElement("input");t.setAttribute("type","file"),t.setAttribute("name",this._settings.name),addStyles(t,{position:"absolute",right:0,margin:0,padding:0,fontSize:"480px",fontFamily:"sans-serif",cursor:"pointer"});var n=document.createElement("div");addStyles(n,{display:"block",position:"absolute",overflow:"hidden",margin:0,padding:0,opacity:0,direction:"ltr",zIndex:2147483583,cursor:"pointer"});if(n.style.opacity!=="0"){if(typeof n.filters=="undefined")throw new Error("Opacity not supported by the browser");n.style.filter="alpha(opacity=0)"}addEvent(t,"change",function(){if(!t||t.value==="")return;var n=fileFromPath(t.value);if(!1===e._settings.onChange.call(e,n,getExt(n))){e._clearInput();return}e._settings.autoSubmit&&e.submit()}),addEvent(t,"mouseover",function(){addClass(e._button,e._settings.hoverClass)}),addEvent(t,"mouseout",function(){removeClass(e._button,e._settings.hoverClass),removeClass(e._button,e._settings.focusClass),t.parentNode.style.visibility="hidden"}),addEvent(t,"focus",function(){addClass(e._button,e._settings.focusClass)}),addEvent(t,"blur",function(){removeClass(e._button,e._settings.focusClass)}),n.appendChild(t),document.body.appendChild(n),this._input=t},_clearInput:function(){if(!this._input)return;removeNode(this._input.parentNode),this._input=null,this._createInput(),removeClass(this._button,this._settings.hoverClass),removeClass(this._button,this._settings.focusClass)},_rerouteClicks:function(){var e=this;addEvent(e._button,"mouseover",function(){if(e._disabled)return;e._input||e._createInput();var t=e._input.parentNode;copyLayout(e._button,t),t.style.visibility="visible"})},_createIframe:function(){var e=getUID(),t=toElement('');return t.setAttribute("id",e),t.style.display="none",document.body.appendChild(t),t},_createForm:function(e){var t=this._settings,n=toElement('
');n.setAttribute("action",t.action),n.setAttribute("target",e.name),n.style.display="none",document.body.appendChild(n);for(var r in t.data)if(t.data.hasOwnProperty(r)){var i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",r),i.setAttribute("value",t.data[r]),n.appendChild(i)}return n},_getResponse:function(iframe,file){var toDeleteFlag=!1,self=this,settings=this._settings;addEvent(iframe,"load",function(){if(iframe.src=="javascript:'%3Chtml%3E%3C/html%3E';"||iframe.src=="javascript:'';"){toDeleteFlag&&setTimeout(function(){removeNode(iframe)},0);return}var doc=iframe.contentDocument?iframe.contentDocument:window.frames[iframe.id].document;if(doc.readyState&&doc.readyState!="complete")return;if(doc.body&&doc.body.innerHTML=="false")return;var response;doc.XMLDocument?response=doc.XMLDocument:doc.body?(response=doc.body.innerHTML,settings.responseType&&settings.responseType.toLowerCase()=="json"&&(doc.body.firstChild&&doc.body.firstChild.nodeName.toUpperCase()=="PRE"&&(doc.normalize(),response=doc.body.firstChild.firstChild.nodeValue),response?response=eval("("+response+")"):response={})):response=doc,settings.onComplete.call(self,file,response),toDeleteFlag=!0,iframe.src="javascript:'';"})},submit:function(){var e=this,t=this._settings;if(!this._input||this._input.value==="")return;var n=fileFromPath(this._input.value);if(!1===t.onSubmit.call(this,n,getExt(n))){this._clearInput();return}var r=this._createIframe(),i=this._createForm(r);removeNode(this._input.parentNode),removeClass(e._button,e._settings.hoverClass),removeClass(e._button,e._settings.focusClass),i.appendChild(this._input),i.submit(),removeNode(i),i=null,removeNode(this._input),this._input=null,this._getResponse(r,n),this._createInput()}}})(); \ No newline at end of file diff --git a/js/country.js b/js/country.js index cc7697a1f..bbe9c7a18 100644 --- a/js/country.js +++ b/js/country.js @@ -275,7 +275,7 @@ aStates[249]="|'Adan|'Ataq|Abyan|Al Bayda'|Al Hudaydah|Al Jawf|Al Mahrah|Al Mahw aStates[250]="|Kosovo|Montenegro|Serbia|Vojvodina"; aStates[251]="|Central|Copperbelt|Eastern|Luapula|Lusaka|North-Western|Northern|Southern|Western"; aStates[252]="|Bulawayo|Harare|ManicalandMashonaland Central|Mashonaland East|Mashonaland West|Masvingo|Matabeleland North|Matabeleland South|Midlands"; -aStates[253]="|Self Hosted|Private Server|Architects Of Sleep|DFRN|Distributed Friend Network|Free-Beer.ch|Foojbook|Free-Haven|Friendica.eu|Friendika.me.4.it|Friendika - I Ask Questions|Frndc.com|Hikado|Hipatia|Hungerfreunde|Kaluguran Community|Kak Ste?|Karl.Markx.pm|Loozah Social Club|MyFriendica.net|MyFriendNetwork|Oi!|OpenMindSpace|Recolutionari.es|SPRACI|Sysfu Social Club|theshi.re|Tumpambae|Uzmiac|Other"; +aStates[253]="|Self Hosted|Private Server|Architects Of Sleep|DFRN|Distributed Friend Network|Free-Beer.ch|Foojbook|Free-Haven|Friendica.eu|Friendika.me.4.it|Friendika - I Ask Questions|Frndc.com|Hikado|Hipatia|Hungerfreunde|Kaluguran Community|Kak Ste|Karl.Markx.pm|Loozah Social Club|MyFriendica.net|MyFriendNetwork|Oi!|OpenMindSpace|Optimistisch|Recolutionari.es|Sparkling Network|SPRACI|Styliztique|Sysfu Social Club|Trevena|theshi.re|Tumpambae|Uzmiac|Other"; /* * gArCountryInfo * (0) Country name diff --git a/js/country.min.js b/js/country.min.js new file mode 100644 index 000000000..df293530e --- /dev/null +++ b/js/country.min.js @@ -0,0 +1,11 @@ +// diff --git a/view/theme/frost-mobile/admin_aside.tpl b/view/theme/frost-mobile/admin_aside.tpl new file mode 100644 index 000000000..da3ed23a8 --- /dev/null +++ b/view/theme/frost-mobile/admin_aside.tpl @@ -0,0 +1,31 @@ + +
+
+ +{{ if $admin.update }} +
+{{ endif }} + + +{{ if $admin.plugins_admin }}
{{ endif }} +
+ + +
+
+ diff --git a/view/theme/frost-mobile/admin_site.tpl b/view/theme/frost-mobile/admin_site.tpl new file mode 100644 index 000000000..bb00c2ccc --- /dev/null +++ b/view/theme/frost-mobile/admin_site.tpl @@ -0,0 +1,56 @@ + +
diff --git a/view/theme/frost-mobile/border.jpg b/view/theme/frost-mobile/border.jpg new file mode 100644 index 000000000..034a1cb63 Binary files /dev/null and b/view/theme/frost-mobile/border.jpg differ diff --git a/view/theme/frost-mobile/comment_item.tpl b/view/theme/frost-mobile/comment_item.tpl new file mode 100755 index 000000000..b5b0e9d28 --- /dev/null +++ b/view/theme/frost-mobile/comment_item.tpl @@ -0,0 +1,74 @@ + + +
diff --git a/view/theme/frost-mobile/contact_edit.tpl b/view/theme/frost-mobile/contact_edit.tpl new file mode 100644 index 000000000..6dcb9a72b --- /dev/null +++ b/view/theme/frost-mobile/contact_edit.tpl @@ -0,0 +1,88 @@ + +
+ +
diff --git a/view/theme/frost-mobile/contact_head.tpl b/view/theme/frost-mobile/contact_head.tpl new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/frost-mobile/contact_template.tpl b/view/theme/frost-mobile/contact_template.tpl new file mode 100644 index 000000000..c27060bb3 --- /dev/null +++ b/view/theme/frost-mobile/contact_template.tpl @@ -0,0 +1,30 @@ + +
diff --git a/view/theme/frost-mobile/contacts-end.tpl b/view/theme/frost-mobile/contacts-end.tpl new file mode 100644 index 000000000..820b1c6a0 --- /dev/null +++ b/view/theme/frost-mobile/contacts-end.tpl @@ -0,0 +1,4 @@ + + + + diff --git a/view/theme/frost-mobile/contacts-head.tpl b/view/theme/frost-mobile/contacts-head.tpl new file mode 100644 index 000000000..5ae97f9f0 --- /dev/null +++ b/view/theme/frost-mobile/contacts-head.tpl @@ -0,0 +1,5 @@ + + + diff --git a/view/theme/frost-mobile/contacts-template.tpl b/view/theme/frost-mobile/contacts-template.tpl new file mode 100644 index 000000000..76254c1ca --- /dev/null +++ b/view/theme/frost-mobile/contacts-template.tpl @@ -0,0 +1,28 @@ +
+ +{{ if $finding }}
{{ endif }} + +
+
+ +$tabs + + +
+
+ +$paginate + + + + diff --git a/view/theme/frost-mobile/conversation.tpl b/view/theme/frost-mobile/conversation.tpl new file mode 100644 index 000000000..43b4d63ff --- /dev/null +++ b/view/theme/frost-mobile/conversation.tpl @@ -0,0 +1,27 @@ +{{ for $threads as $thread }} +
+{{ endfor }} + +
+ + +{{ endif }} diff --git a/view/theme/frost-mobile/cropbody.tpl b/view/theme/frost-mobile/cropbody.tpl new file mode 100644 index 000000000..3283084ca --- /dev/null +++ b/view/theme/frost-mobile/cropbody.tpl @@ -0,0 +1,27 @@ +
+
+$desc +
+
+
+ +
+ + + + + + + + + + +
+ + diff --git a/view/theme/frost-mobile/cropend.tpl b/view/theme/frost-mobile/cropend.tpl new file mode 100644 index 000000000..a56c71d92 --- /dev/null +++ b/view/theme/frost-mobile/cropend.tpl @@ -0,0 +1,4 @@ + + + + diff --git a/view/theme/frost-mobile/crophead.tpl b/view/theme/frost-mobile/crophead.tpl new file mode 100644 index 000000000..56e941e3a --- /dev/null +++ b/view/theme/frost-mobile/crophead.tpl @@ -0,0 +1 @@ + diff --git a/view/theme/frost-mobile/default.php b/view/theme/frost-mobile/default.php new file mode 100644 index 000000000..99f96f4b6 --- /dev/null +++ b/view/theme/frost-mobile/default.php @@ -0,0 +1,42 @@ + + +
+
+ + + +
+