-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-\r
-/**\r
- * File containing actions that can be performed by visitors of the site,\r
- * like adding comments, etc...\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: action.php 1721 2012-03-31 10:18:25Z sakamocchi $\r
- */\r
-\r
-$CONF = array();\r
-require('./config.php');\r
-include_libs('ACTION.php');\r
-\r
-$action = requestVar('action');\r
-$a = new Action();\r
-$errorInfo = $a->doAction($action);\r
-\r
-if ( $errorInfo )\r
-{\r
- $skin =& $manager->getSkin($errorInfo['skinid']);\r
- doError($errorInfo['message'], $skin);\r
-}\r
-\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+
+/**
+ * File containing actions that can be performed by visitors of the site,
+ * like adding comments, etc...
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: action.php 1888 2012-06-17 08:38:54Z sakamocchi $
+ */
+
+$CONF = array();
+require('./config.php');
+include_libs('ACTION.php');
+
+$action = requestVar('action');
+$a = new Action();
+$errorInfo = $a->doAction($action);
+
+if ( $errorInfo )
+{
+ $skin =& $manager->getSkin($errorInfo['skinid']);
+ doError($errorInfo['message'], $skin);
+}
+
exit;
\ No newline at end of file
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-\r
-/**\r
- * Nucleus Atom Syndication\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: atom.php 1388 2009-07-18 06:31:28Z shizuki $\r
- */\r
-\r
-header('Pragma: no-cache');\r
-\r
-$CONF = array();\r
-include('./config.php');\r
-\r
-if ( !$CONF['DisableSite'] )\r
-{\r
- // get feed into $feed\r
- ob_start();\r
- selectSkin('feeds/atom');\r
- selector();\r
- $feed = ob_get_contents();\r
- ob_end_clean();\r
- \r
- // create ETAG (hash of feed)\r
- // (HTTP_IF_NONE_MATCH has quotes around it)\r
- $eTag = '"' . md5($feed) . '"';\r
- header('Etag: ' . $eTag);\r
- \r
- // compare Etag to what we got\r
- if ( $eTag == serverVar('HTTP_IF_NONE_MATCH') )\r
- {\r
- header('HTTP/1.0 304 Not Modified');\r
- header('Content-Length: 0');\r
- }\r
- else\r
- {\r
- echo $feed;\r
- }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+
+/**
+ * Nucleus Atom Syndication
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: atom.php 1693 2012-03-10 11:37:56Z sakamocchi $
+ */
+
+header('Pragma: no-cache');
+
+$CONF = array();
+include('./config.php');
+
+if ( !$CONF['DisableSite'] )
+{
+ // get feed into $feed
+ ob_start();
+ selectSkin('feeds/atom');
+ selector();
+ $feed = ob_get_contents();
+ ob_end_clean();
+
+ // create ETAG (hash of feed)
+ // (HTTP_IF_NONE_MATCH has quotes around it)
+ $eTag = '"' . md5($feed) . '"';
+ header('Etag: ' . $eTag);
+
+ // compare Etag to what we got
+ if ( $eTag == serverVar('HTTP_IF_NONE_MATCH') )
+ {
+ header('HTTP/1.0 304 Not Modified');
+ header('Content-Length: 0');
+ }
+ else
+ {
+ echo $feed;
+ }
+}
-<?php\r
-\r
-class NP_ImageCreateThumbnail extends NucleusPlugin {\r
-\r
- /* \r
- * Nucleus Plugin\r
- *\r
- * Copyright 2007 by Kai Greve\r
- * \r
- * This program is free software and open source software; you can redistribute\r
- * it and/or modify it under the terms of the GNU General Public License as\r
- * published by the Free Software Foundation; either version 2 of the License,\r
- * or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful, but WITHOUT\r
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
- * more details.\r
- *\r
- * You should have received a copy of the GNU General Public License along\r
- * with this program; if not, write to the Free Software Foundation, Inc.,\r
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit\r
- * http://www.gnu.org/licenses/gpl.html\r
- * \r
- *\r
- * NP_ImageCreateThumbnail creates a thumbnail after an image is uploaded,\r
- * it demonstrates the uages of the PostMediaUpload event \r
- *\r
- * History:\r
- * v0.01: 2007-01-01\r
- * - initial release \r
- * \r
- */\r
-\r
- function getName() { return 'NP_ImageCreateThumbnail'; }\r
- function getAuthor() { return 'Kai Greve'; }\r
- function getURL() { return 'http://www.nucleuscms.org/'; }\r
- function getVersion() { return '0.01'; }\r
- function getDescription() { return 'Generates Thumbnails after an image is uploaded.'; }\r
- \r
- function getMinNucleusVersion() { return 330; }\r
-\r
- function supportsFeature($what) {\r
- switch($what)\r
- { case 'SqlTablePrefix':\r
- return 1;\r
- default:\r
- return 0; }\r
- }\r
-\r
- function install() {\r
- $this->createOption ('thumbsize', 'Maximal width (landscape format) or height (portrait format) for Thumbnails', 'text', '150');\r
- }\r
-\r
- function unInstall() {\r
- }\r
-\r
- function getEventList() {\r
- return array('PostMediaUpload');\r
- }\r
-\r
-\r
- function event_PostMediaUpload(&$data) {\r
- \r
- $collection = $data['collection'];\r
- $mediadir = $data['mediadir'];\r
- $filename = $data['filename'];\r
- $fullpath = $mediadir.$filename;\r
- \r
- // evaluate the filetype from the filename\r
- $filetype = strtolower(substr($filename, strpos($filename, ".")+1));\r
- \r
- // filetype is jpeg\r
- if ($filetype=='jpg' || $filetype=='jpeg') {\r
- \r
- $size = getimagesize($fullpath);\r
- \r
- $ratio = $size[1]/$size[0]; // ratio = height / width\r
- \r
- if ($ratio < 1) {\r
- $new_height = $this->getOption('thumbsize') * $size[1]/$size[0];\r
- $new_width = $this->getOption('thumbsize');\r
- }\r
- else {\r
- $new_height = $this->getOption('thumbsize');\r
- $new_width = $this->getOption('thumbsize') * $size[0]/$size[1];\r
- } \r
-\r
- $image_orig = imagecreatefromjpeg($fullpath);\r
- $image_new = imagecreatetruecolor($new_width, $new_height);\r
- \r
- imagecopyresampled($image_new, $image_orig, 0, 0, 0, 0, $new_width, $new_height, $size[0], $size[1]);\r
-\r
- $thumbfilename = substr($fullpath, 0, strpos($fullpath, ".")).'_thumb.'.$filetype;\r
- \r
- imagejpeg ($image_new , $thumbfilename);\r
- \r
- // clear the memory\r
- imagedestroy($image_orig);\r
- imagedestroy($image_new);\r
- }\r
- \r
- // filetype is png\r
- if ($filetype=='png') {\r
- \r
- $size = getimagesize($fullpath);\r
- \r
- $ratio = $size[1]/$size[0]; // ratio = height / width\r
- \r
- if ($ratio < 1) {\r
- $new_height = $this->getOption('thumbsize') * $size[1]/$size[0];\r
- $new_width = $this->getOption('thumbsize');\r
- }\r
- else {\r
- $new_height = $this->getOption('thumbsize');\r
- $new_width = $this->getOption('thumbsize') * $size[0]/$size[1];\r
- } \r
-\r
- $image_orig = imagecreatefrompng($fullpath);\r
- $image_new = imagecreatetruecolor($new_width, $new_height);\r
- \r
- imagecopyresampled($image_new, $image_orig, 0, 0, 0, 0, $new_width, $new_height, $size[0], $size[1]);\r
-\r
- $thumbfilename = substr($fullpath, 0, strpos($fullpath, ".")).'_thumb.'.$filetype;\r
- \r
- imagepng ($image_new , $thumbfilename);\r
- \r
- // clear the memory\r
- imagedestroy($image_orig);\r
- imagedestroy($image_new);\r
- }\r
- }\r
-}\r
-\r
-?>\r
+<?php
+
+class NP_ImageCreateThumbnail extends NucleusPlugin {
+
+/*
+ * Nucleus Plugin
+ *
+ * Copyright 2007 by Kai Greve
+ *
+ * This program is free software and open source software; you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ *
+ * NP_ImageCreateThumbnail creates a thumbnail after an image is uploaded,
+ * it demonstrates the uages of the PostMediaUpload event
+ *
+ * History:
+ * v0.01: 2007-01-01
+ * - initial release
+ *
+ */
+
+ function getName() { return 'NP_ImageCreateThumbnail'; }
+ function getAuthor() { return 'Kai Greve'; }
+ function getURL() { return 'http://www.nucleuscms.org/'; }
+ function getVersion() { return '0.01'; }
+ function getDescription() { return 'Generates Thumbnails after an image is uploaded.'; }
+
+ function getMinNucleusVersion() { return 330; }
+
+ function supportsFeature($what) {
+ switch($what)
+ { case 'SqlTablePrefix':
+ return 1;
+ default:
+ return 0; }
+ }
+
+ function install() {
+ $this->createOption ('thumbsize', 'Maximal width (landscape format) or height (portrait format) for Thumbnails', 'text', '150');
+ }
+
+ function unInstall() {
+ }
+
+ function getEventList() {
+ return array('PostMediaUpload');
+ }
+
+
+ function event_PostMediaUpload(&$data) {
+
+ $collection = $data['collection'];
+ $mediadir = $data['mediadir'];
+ $filename = $data['filename'];
+ $fullpath = $mediadir.$filename;
+
+ // evaluate the filetype from the filename
+ $filetype = strtolower(substr($filename, strpos($filename, ".")+1));
+
+ // filetype is jpeg
+ if ($filetype=='jpg' || $filetype=='jpeg') {
+
+ $size = getimagesize($fullpath);
+
+ $ratio = $size[1]/$size[0]; // ratio = height / width
+
+ if ($ratio < 1) {
+ $new_height = $this->getOption('thumbsize') * $size[1]/$size[0];
+ $new_width = $this->getOption('thumbsize');
+ }
+ else {
+ $new_height = $this->getOption('thumbsize');
+ $new_width = $this->getOption('thumbsize') * $size[0]/$size[1];
+ }
+
+ $image_orig = imagecreatefromjpeg($fullpath);
+ $image_new = imagecreatetruecolor($new_width, $new_height);
+
+ imagecopyresampled($image_new, $image_orig, 0, 0, 0, 0, $new_width, $new_height, $size[0], $size[1]);
+
+ $thumbfilename = substr($fullpath, 0, strpos($fullpath, ".")).'_thumb.'.$filetype;
+
+ imagejpeg ($image_new , $thumbfilename);
+
+ // clear the memory
+ imagedestroy($image_orig);
+ imagedestroy($image_new);
+ }
+
+ // filetype is png
+ if ($filetype=='png') {
+
+ $size = getimagesize($fullpath);
+
+ $ratio = $size[1]/$size[0]; // ratio = height / width
+
+ if ($ratio < 1) {
+ $new_height = $this->getOption('thumbsize') * $size[1]/$size[0];
+ $new_width = $this->getOption('thumbsize');
+ }
+ else {
+ $new_height = $this->getOption('thumbsize');
+ $new_width = $this->getOption('thumbsize') * $size[0]/$size[1];
+ }
+
+ $image_orig = imagecreatefrompng($fullpath);
+ $image_new = imagecreatetruecolor($new_width, $new_height);
+
+ imagecopyresampled($image_new, $image_orig, 0, 0, 0, 0, $new_width, $new_height, $size[0], $size[1]);
+
+ $thumbfilename = substr($fullpath, 0, strpos($fullpath, ".")).'_thumb.'.$filetype;
+
+ imagepng ($image_new , $thumbfilename);
+
+ // clear the memory
+ imagedestroy($image_orig);
+ imagedestroy($image_new);
+ }
+ }
+}
+
+?>
-<?php\r
-\r
-class NP_ImageLimitSize extends NucleusPlugin {\r
-/*\r
- Nucleus Plugin\r
- \r
- History:\r
- v0.01 (2006-12-30):\r
- - release for testing purposes (demonstrates the usage of the PreMediaUpload event)\r
-\r
-*/\r
-\r
- function getName() { return 'NP_ImageLimitSize'; }\r
- function getAuthor() { return 'Kai Greve'; }\r
- function getURL() { return 'http://www.nucleuscms.org/'; }\r
- function getVersion() { return '0.01'; }\r
- function getDescription() { return 'Rescales an image (jpg/png) during the upload if it is bigger then a maximum with.'; }\r
-\r
- function getMinNucleusVersion() { return 330; }\r
-\r
- function supportsFeature($what) {\r
- switch($what)\r
- { case 'SqlTablePrefix':\r
- return 1;\r
- default:\r
- return 0; }\r
- }\r
-\r
- function install() {\r
- $this->createOption('maxwidth', 'Maximal width for images', 'text', '450'); \r
- }\r
-\r
- function unInstall() {\r
- }\r
-\r
- function getEventList() {\r
- return array('PreMediaUpload');\r
- }\r
-\r
- function event_PreMediaUpload(&$data) {\r
-\r
- $collection = $data['collection'];\r
- $uploadfile = $data['uploadfile'];\r
- $filename = $data['filename'];\r
- \r
- // evaluate the filetype from the filename\r
- $filetype = strtolower(substr($filename, strpos($filename, ".")+1));\r
- \r
- // filetype is jpeg\r
- if ($filetype=='jpg' || $filetype=='jpeg') {\r
- \r
- $size=getimagesize($data['uploadfile']);\r
- \r
- // size[0] is the image width \r
- if ($size[0]>$this->getOption('maxwidth')) {\r
-\r
- $newheight = $this->getOption('maxwidth') * $size[1]/$size[0];\r
- $image_orig = imagecreatefromjpeg($uploadfile);\r
- $image_new = imagecreatetruecolor($this->getOption('maxwidth'), $newheight);\r
- \r
- imagecopyresampled($image_new, $image_orig, 0, 0, 0, 0, $this->getOption('maxwidth'), $newheight, $size[0], $size[1]);\r
-\r
- imagejpeg ($image_new , $uploadfile);\r
- \r
- // clear the memory\r
- imagedestroy($image_orig);\r
- imagedestroy($image_new);\r
- \r
- }\r
- }\r
- \r
- // filetype is png\r
- if ($filetype=='png') {\r
- \r
- $size=getimagesize($data['uploadfile']);\r
- \r
- // size[0] is the image width\r
- if ($size[0]>$this->getOption('maxwidth')) {\r
- \r
- $newheight = $this->getOption('maxwidth') * $size[1]/$size[0];\r
- $image_orig = imagecreatefrompng($uploadfile);\r
- $image_new = imagecreatetruecolor($this->getOption('maxwidth'), $newheight);\r
-\r
- imagecopyresampled($image_new, $image_orig, 0, 0, 0, 0, $this->getOption('maxwidth'), $newheight, $size[0], $size[1]);\r
- \r
- imagepng ( $image_new , $uploadfile);\r
- \r
- // clear the memory\r
- imagedestroy($image_orig);\r
- imagedestroy($image_new);\r
-\r
- }\r
- }\r
- }\r
-}\r
-\r
-?>\r
+<?php
+
+class NP_ImageLimitSize extends NucleusPlugin {
+/*
+ Nucleus Plugin
+
+ History:
+ v0.01 (2006-12-30):
+ - release for testing purposes (demonstrates the usage of the PreMediaUpload event)
+*/
+
+ function getName() { return 'NP_ImageLimitSize'; }
+ function getAuthor() { return 'Kai Greve'; }
+ function getURL() { return 'http://www.nucleuscms.org/'; }
+ function getVersion() { return '0.01'; }
+ function getDescription() { return 'Rescales an image (jpg/png) during the upload if it is bigger then a maximum with.'; }
+
+ function getMinNucleusVersion() { return 330; }
+
+ function supportsFeature($what) {
+ switch($what)
+ { case 'SqlTablePrefix':
+ return 1;
+ default:
+ return 0; }
+ }
+
+ function install() {
+ $this->createOption('maxwidth', 'Maximal width for images', 'text', '450');
+ }
+
+ function unInstall() {
+ }
+
+ function getEventList() {
+ return array('PreMediaUpload');
+ }
+
+ function event_PreMediaUpload(&$data) {
+
+ $collection = $data['collection'];
+ $uploadfile = $data['uploadfile'];
+ $filename = $data['filename'];
+
+ // evaluate the filetype from the filename
+ $filetype = strtolower(substr($filename, strpos($filename, ".")+1));
+
+ // filetype is jpeg
+ if ($filetype=='jpg' || $filetype=='jpeg') {
+
+ $size=getimagesize($data['uploadfile']);
+
+ // size[0] is the image width
+ if ($size[0]>$this->getOption('maxwidth')) {
+
+ $newheight = $this->getOption('maxwidth') * $size[1]/$size[0];
+ $image_orig = imagecreatefromjpeg($uploadfile);
+ $image_new = imagecreatetruecolor($this->getOption('maxwidth'), $newheight);
+
+ imagecopyresampled($image_new, $image_orig, 0, 0, 0, 0, $this->getOption('maxwidth'), $newheight, $size[0], $size[1]);
+
+ imagejpeg ($image_new , $uploadfile);
+
+ // clear the memory
+ imagedestroy($image_orig);
+ imagedestroy($image_new);
+
+ }
+ }
+
+ // filetype is png
+ if ($filetype=='png') {
+
+ $size=getimagesize($data['uploadfile']);
+
+ // size[0] is the image width
+ if ($size[0]>$this->getOption('maxwidth')) {
+
+ $newheight = $this->getOption('maxwidth') * $size[1]/$size[0];
+ $image_orig = imagecreatefrompng($uploadfile);
+ $image_new = imagecreatetruecolor($this->getOption('maxwidth'), $newheight);
+
+ imagecopyresampled($image_new, $image_orig, 0, 0, 0, 0, $this->getOption('maxwidth'), $newheight, $size[0], $size[1]);
+
+ imagepng ( $image_new , $uploadfile);
+
+ // clear the memory
+ imagedestroy($image_orig);
+ imagedestroy($image_new);
+
+ }
+ }
+ }
+}
+
+?>
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-20011 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-\r
-/**\r
- * Registration form for new users\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-20011 The Nucleus Group\r
- * @version $Id: createaccount.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
- */\r
-\r
-// we are using admin stuff:\r
-$CONF = array();\r
-$CONF['UsingAdminArea'] = 1;\r
-\r
-require_once "./config.php";\r
-include_libs('ACTION.php');\r
-\r
-if ( !Admin::initialize() )\r
-{\r
- /* TODO: something to handling errors */\r
- exit;\r
-}\r
-\r
-Admin::action('createaccount');\r
-exit;\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-20011 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+
+/**
+ * Registration form for new users
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-20011 The Nucleus Group
+ * @version $Id: createaccount.php 1888 2012-06-17 08:38:54Z sakamocchi $
+ */
+
+// we are using admin stuff:
+$CONF = array();
+$CONF['UsingAdminArea'] = 1;
+
+require_once "./config.php";
+include_libs('ACTION.php');
+
+if ( !Admin::initialize() )
+{
+ /* TODO: something to handling errors */
+ exit;
+}
+
+Admin::action('createaccount');
+exit;
-PLEASE NOTE: the skins.htaccess file in this directory is intended to prohibit, for enhanced security, direct access .inc and .php files in the skin folders. Depending on the web server configuration, the code in this .htaccess file may not work as intended. In this case, your site will be displayed incorrectly, with missing content or style. Renaming the .htaccess file should fix the problem.\r
-\r
-To apply it, follow these instructions:\r
-\r
-1. Be sure that another .htaccess file does not exist in the /skins folder\r
-2. Copy the skins.htaccess file into the skins folder of your Nucleus CMS installation\r
-3. Rename the file to .htaccess\r
-4. If you have an existing .htaccess file in your skins folder, copy the contents from the skins.htaccess file into the existing .htacces file.\r
-\r
+PLEASE NOTE: the skins.htaccess file in this directory is intended to prohibit, for enhanced security, direct access .inc and .php files in the skin folders. Depending on the web server configuration, the code in this .htaccess file may not work as intended. In this case, your site will be displayed incorrectly, with missing content or style. Renaming the .htaccess file should fix the problem.
+
+To apply it, follow these instructions:
+
+1. Be sure that another .htaccess file does not exist in the /skins folder.
+2. Copy the skins.htaccess file into the skins folder of your Nucleus CMS installation.
+3. Rename the file to .htaccess.
+4. If you have an existing .htaccess file in your skins folder, copy the contents from the skins.htaccess file into the existing .htacces file.
+
You can disable after installing it by renaming the file to something else, or by removing the file from that folder.
\ No newline at end of file
-<?php\r
-// This file will generate and return the main page of the site\r
-$CONF = array();\r
-$CONF['Self'] = 'index.php';\r
-\r
-include('./config.php');\r
-\r
-selector();\r
+<?php
+// This file will generate and return the main page of the site
+$CONF = array();
+$CONF['Self'] = 'index.php';
+
+include('./config.php');
+
+selector();
+
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- *\r
- * This script will install the Nucleus tables in your SQL-database,\r
- * and initialize the data in those tables.\r
- */\r
-\r
-/**\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: index.php 1745 2012-04-12 23:45:47Z sakamocchi $\r
- */\r
-\r
-/* global values initialize */\r
-$CONF = array();\r
-\r
-/* reporting all errors for support */\r
-error_reporting(E_ALL);\r
-\r
-$minimum_php_version = '5.0.6';\r
-$minimum_mysql_version = '3.23';\r
-\r
-$page_footer_copyright = '© 2001-2012 The Nucleus Groupe . Running Nucleus CMS v4.00';\r
-\r
-// begin if: server's PHP version is below the minimum; halt installation\r
-if ( version_compare(PHP_VERSION, $minimum_php_version, '<') )\r
-{\r
- exit('<div style="font-size: xx-large;"> Nucleus requires at least PHP version ' . $minimum_php_version . '</div>');\r
-}\r
-\r
-// make sure there's no unnecessary escaping: # set_magic_quotes_runtime(0);\r
-if ( version_compare(PHP_VERSION, '5.3.0', '<') )\r
-{\r
- ini_set('magic_quotes_runtime', '0');\r
-}\r
-\r
-/* default installed plugins and skins */\r
-$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Medium');\r
-$aConfSkinsToImport = array('atom', 'rss2.0', 'rsd', 'default', 'admin/default', 'admin/bookmarklet');\r
-\r
-// Check if some important files\r
-do_check_files();\r
-\r
-/* i18n class is needed for internationalization */\r
-include_once('../nucleus/libs/i18n.php');\r
-if ( !i18n::init('UTF-8', '../nucleus/locales') )\r
-{\r
- exit('<div style="font-size: xx-large;"> Failed to initialize iconv or mbstring extension. Would you please contact the administrator of your PHP server? </div>');\r
-}\r
-\r
-// include core classes that are needed for login & plugin handling\r
-\r
-// added for 3.5 sql_* wrapper\r
-global $MYSQL_HANDLER;\r
-\r
-if ( !isset($MYSQL_HANDLER) )\r
-{\r
- $MYSQL_HANDLER = array('mysql', '');\r
- \r
- // check if mysql support is installed; this check may not make sense, as is, in a version past 3.5x\r
- if ( !function_exists('mysql_query') && !function_exists('mysqli_query') )\r
- {\r
- exit('<div style="font-size: xx-large;"> Your PHP version does not have support for MySQL :( </div>');\r
- }\r
-}\r
-include_once('../nucleus/libs/sql/sql.php');\r
-\r
-session_start();\r
-if ( count($_GET) == 0 && count($_POST) == 0 )\r
-{\r
- unset($_SESSION['param_manager']);\r
-}\r
-\r
-// restore the $param from the session\r
-if ( array_key_exists('param_manager', $_SESSION) )\r
-{\r
- $param = $_SESSION['param_manager'];\r
-}\r
-else\r
-{\r
- $param = new ParamManager();\r
-}\r
-\r
-// include translation file\r
-$param->set_locale();\r
-\r
-do_action();\r
-\r
-// $param is saved to the session\r
-if ( isset($param) )\r
-{\r
- $_SESSION['param_manager'] = $param;\r
-}\r
-else\r
-{\r
- unset($_SESSION['param_manager']);\r
-}\r
-exit;\r
-\r
-/**\r
- * installer action\r
- */\r
-function do_action()\r
-{\r
- global $param;\r
-\r
- if ( array_key_exists('action', $_POST) )\r
- {\r
- $isPostback = true;\r
- }\r
- else\r
- {\r
- $isPostback = false;\r
- }\r
-\r
- // mode change\r
- if ( array_key_exists('mode', $_REQUEST) )\r
- {\r
- if ( $_REQUEST['mode'] == 'detail' )\r
- {\r
- $param->set_state('detail');\r
- }\r
- elseif ( $_REQUEST['mode'] == 'simple' )\r
- {\r
- $param->set_state('mysql');\r
- }\r
- }\r
-\r
- // input parameter check\r
- if ( $isPostback )\r
- {\r
- switch ( $param->state )\r
- {\r
- case 'locale':\r
- $param->set_state('mysql');\r
- $isPostback = false;\r
- break;\r
- case 'mysql':\r
- if ( count($param->check_mysql_parameters()) == 0 )\r
- {\r
- $param->set_state('weblog');\r
- $isPostback = false;\r
- }\r
- break;\r
- case 'weblog':\r
- if ( count($param->check_user_parameters()) == 0\r
- && count($param->check_weblog_parameters()) == 0 )\r
- {\r
- $param->set_state('install');\r
- $isPostback = false;\r
- }\r
- break;\r
- case 'detail':\r
- if ( $param->check_all_parameters() )\r
- {\r
- $param->set_state('install');\r
- $isPostback = false;\r
- }\r
- break;\r
- }\r
- }\r
-\r
- // page render\r
- show_header();\r
- switch ( $param->state )\r
- {\r
- case 'locale':\r
- show_select_locale_form();\r
- break;\r
- case 'mysql':\r
- show_database_setting_form($isPostback);\r
- break;\r
- case 'weblog':\r
- show_blog_setting_form($isPostback);\r
- break;\r
- case 'detail':\r
- show_detail_setting_form($isPostback);\r
- break;\r
- case 'install':\r
- show_install_complete_form();\r
- break;\r
- }\r
- show_footer();\r
-}\r
-\r
-/**\r
- * header tag of the installation screens\r
- **/\r
-function show_header()\r
-{\r
- global $param;\r
-\r
- /* HTTP 1.1 application for no caching */\r
- header("Cache-Control: no-cache, must-revalidate");\r
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");\r
- header('Content-Type: text/html; charset=' . i18n::get_current_charset());\r
-?>\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
- <head>\r
- <title><?php echo _TITLE; ?></title>\r
- <link rel="stylesheet" type="text/css" href="./styles/inst.css" />\r
- <style type="text/css">\r
- <!--\r
- <?php echo _BODYFONTSTYLE; ?>\r
- -->\r
- </style>\r
- <script type="text/javascript">\r
- function SelectText( element ) {\r
- window.setTimeout( function() { element.select() }, 0 );\r
- }\r
- var isSubmit = false;\r
- function OnceSubmit() {\r
- if (!isSubmit) {\r
- isSubmit = true;\r
- window.setTimeout( function() { isSubmit = false; }, 10000 );\r
- return true;\r
- }\r
- return false;\r
- }\r
- </script>\r
- </head>\r
- <body>\r
- <div id="header">\r
- <div id="navigation">\r
- <h1><img src="./styles/nucleus_rogo.png" alt="NucleusCMS" /></h1>\r
- <ul>\r
-<?php\r
- echo '<li>';\r
- $label = '_LOCALE_' . strtoupper($param->locale);\r
- if ( !defined($label) )\r
- {\r
- echo $param->locale;\r
- }\r
- else\r
- {\r
- echo constant($label);\r
- }\r
- echo "</li>\n";\r
- \r
- if ( in_array($param->state, array('mysql', 'weblog', 'install')) )\r
- {\r
- echo '<li> > ' . _STEP1, '</li><li';\r
- if ( $param->state == 'mysql' )\r
- {\r
- echo ' class="gry"';\r
- }\r
- echo '> > ', _STEP2, '</li><li';\r
- if ( in_array($param->state, array('mysql', 'weblog')) )\r
- {\r
- echo ' class="gry"';\r
- }\r
- echo '> > ', _STEP3, "</li>\n";\r
- }\r
- \r
- if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )\r
- {\r
- echo '<li class="rightbox">';\r
- if ( in_array($param->state, array('mysql', 'weblog')) )\r
- {\r
- echo '<a href="./?mode=detail">', _MODE2, '</a>';\r
- }\r
- else\r
- {\r
- echo '<a href="./?mode=simple">', _MODE1, '</a>';\r
- }\r
- echo '</li>';\r
- }\r
-?>\r
- </ul>\r
- </div>\r
- </div>\r
-<?php\r
-}\r
-\r
-/**\r
- * footer tag of the installation screens\r
- **/\r
-function show_footer()\r
-{\r
- global $page_footer_copyright;\r
-?>\r
- <div id="footer">\r
- <?php echo $page_footer_copyright; ?>\r
- </div>\r
- </body>\r
-</html>\r
-<?php\r
-}\r
-\r
-/**\r
- * Display the form for language select\r
- */\r
-function show_select_locale_form()\r
-{\r
- global $param;\r
- \r
-?>\r
- <div id="container">\r
- <p style="font-size:152%;font-weight:bold;">\r
- <?php echo _LOCALE_HEADER; ?>\r
- </p>\r
- <form method="post" action="./index.php">\r
-\r
- <div class="prt">\r
- <select name="locale">\r
-<?php\r
- $locales = i18n::get_available_locale_list();\r
- foreach ( $locales as $locale )\r
- {\r
- if ( $param->locale != $locale )\r
- {\r
- echo "<option value=\"{$locale}\">";\r
- }\r
- else\r
- {\r
- echo "<option value=\"{$locale}\" selected=\"selected\">";\r
- }\r
- \r
- $checkfile = "./locales/{$locale}." . i18n::get_current_charset() . '.php';\r
- if ( !file_exists($checkfile) )\r
- {\r
- echo '* ';\r
- }\r
- \r
- $label = '_LOCALE_' . strtoupper($locale);\r
- if ( !defined($label) )\r
- {\r
- echo $locale;\r
- }\r
- else\r
- {\r
- echo constant($label);\r
- }\r
- echo "</option>\n";\r
- }\r
-?>\r
- </select>\r
- <p><?php echo _LOCALE_DESC1; ?></p>\r
- <p><?php echo _LOCALE_DESC2; ?></p>\r
- <p><?php echo _LOCALE_NEED_HELP;?></p>\r
- <p class="sbt">\r
- <button type="submit" name="action" value="locale" class="sbt_arw">START</button>\r
- </p>\r
- </div>\r
- </form>\r
- </div>\r
-<?php\r
-}\r
-\r
-/**\r
- * Display the form to set up a database\r
- * @param bool $isPostback\r
- */\r
-function show_database_setting_form($isPostback)\r
-{\r
- global $param, $minimum_mysql_version;\r
-\r
- $config_writable = canConfigFileWritable();\r
- $mysql_version = getMySqlVersion();\r
-?>\r
- <div id="container">\r
- <p class="msg">\r
-<?php\r
- echo _SIMPLE_NAVI1;\r
- if ( $config_writable != '' )\r
- {\r
- echo '<span class="err">', $config_writable, '</span>';\r
- }\r
- if ( $mysql_version == '0.0.0' )\r
- {\r
- echo '<span class="err">', _DBVERSION_UNKOWN, '</span>';\r
- }\r
- elseif ( version_compare($mysql_version, $minimum_mysql_version, '<') )\r
- {\r
- echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';\r
- }\r
-?>\r
- </p>\r
- <form method="post" action="./index.php">\r
- <div class="prt">\r
- <h2><?php echo _DB_HEADER; ?></h2>\r
- <p class="msg">\r
-<?php\r
- if ( $isPostback )\r
- {\r
- $errors = $param->check_mysql_parameters();\r
- if ( is_array($errors) )\r
- {\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- }\r
-?>\r
- </p>\r
- <table>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>\r
- <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>\r
- <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>\r
- <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>\r
- <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>\r
- </tr>\r
- </table>\r
- <p class="sbt">\r
- <button type="submit" name="mode" value="detail" class="sbt_sqr"><?php echo _MODE2; ?></button>\r
- <button type="submit" name="action" value="mysql" class="sbt_arw"><?php echo _NEXT; ?></button>\r
- </p>\r
- <p class="msg">\r
- <?php echo _DB_TEXT1; ?>\r
- </p>\r
- </div>\r
- </form>\r
- </div>\r
-<?php\r
-}\r
-\r
-/**\r
- * Displays a form to the blog settings\r
- * @param bool $isPostback\r
- */\r
-function show_blog_setting_form($isPostback)\r
-{\r
- global $param;\r
-?>\r
- <div id="container">\r
- <p class="msg">\r
- <?php echo _SIMPLE_NAVI2; ?>\r
- </p>\r
- <form method="post" action="./index.php">\r
- <div class="prt">\r
- <h2><?php echo _BLOG_HEADER; ?></h2>\r
- <p class="msg">\r
-<?php\r
- if ( $isPostback )\r
- {\r
- $errors = $param->check_weblog_parameters();\r
- if ( is_array($errors) )\r
- {\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- }\r
-?>\r
- </p>\r
- <table>\r
- <tr>\r
- <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>\r
- <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>\r
- <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>\r
- </tr>\r
- </table>\r
- </div>\r
-\r
- <div class="prt">\r
- <h2><?php echo _ADMIN_HEADER; ?></h2>\r
- <p class="msg">\r
-<?php\r
- if ( $isPostback )\r
- {\r
- $errors = $param->check_user_parameters();\r
- if ( is_array($errors) )\r
- {\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- }\r
-?>\r
- </p>\r
- <table>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>\r
- <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>\r
- <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>\r
- <td><input type="password" name="user_password" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>\r
- <td><input type="password" name="user_password2" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>\r
- <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>\r
- </tr>\r
- </table>\r
- <p class="sbt">\r
- <button type="submit" name="action" value="weblog" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>\r
- </p>\r
- </div>\r
- </form>\r
- </div>\r
-<?php\r
-}\r
-\r
-/**\r
- * Displays a form to the detail settings\r
- * @param bool $isPostback\r
- */\r
-function show_detail_setting_form($isPostback)\r
-{\r
- global $param, $minimum_mysql_version;\r
-\r
- $mysql_version = getMySqlVersion();\r
-?>\r
- <div id="container_detailed">\r
- <p class="msg">\r
- <?php echo _DETAIL_NAVI1; ?>\r
-<?php\r
- if ( $isPostback && !$param->check_all_parameters() )\r
- {\r
- echo '<span class="err">', _VALID_ERROR, "</span>\n";\r
- }\r
-?>\r
- </p>\r
- <ul class="msg">\r
- <li>PHP: <?php echo phpversion(); ?></li>\r
- <li>MySQL:\r
-<?php\r
- echo ($mysql_version == '0.0.0') ? _DBVERSION_UNKOWN : $mysql_version;\r
- if ( version_compare($mysql_version, $minimum_mysql_version, '<') )\r
- {\r
- echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';\r
- }\r
-?></li>\r
- </ul>\r
- <form method="post" action="">\r
-\r
- <div class="prt">\r
- <h2><?php echo _DETAIL_HEADER1; ?></h2>\r
- <p class="msg">\r
-<?php\r
- if ( $isPostback )\r
- {\r
- $errors = $param->check_mysql_parameters();\r
- if ( is_array($errors) )\r
- {\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- }\r
-?>\r
- </p>\r
- <table>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>\r
- <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>\r
- <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>\r
- <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>\r
- <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _DB_FIELD5; ?></span><span class="sub"><?php echo _DB_FIELD5_DESC; ?></span></th>\r
- <td><input type="text" name="mysql_tablePrefix" value="<?php echo $param->mysql_tablePrefix; ?>" /></td>\r
- </tr>\r
- </table>\r
-\r
- <h2><?php echo _DETAIL_HEADER2; ?></h2>\r
- <p class="msg">\r
-<?php\r
- if ( $isPostback )\r
- {\r
- $errors = $param->check_uri_parameters();\r
- if ( is_array($errors) )\r
- {\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- $errors = $param->check_path_parameters();\r
- if ( is_array($errors) )\r
- {\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- }\r
-?>\r
- </p>\r
- <table>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD1; ?></span></th>\r
- <td><input type="text" name="IndexURL" value="<?php echo $param->IndexURL; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD2; ?></span></th>\r
- <td><input type="text" name="AdminURL" value="<?php echo $param->AdminURL; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD3; ?></span></th>\r
- <td><input type="text" name="AdminPath" value="<?php echo $param->AdminPath; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD4; ?></span></th>\r
- <td><input type="text" name="MediaURL" value="<?php echo $param->MediaURL; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD5; ?></span></th>\r
- <td><input type="text" name="MediaPath" value="<?php echo $param->MediaPath; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD6; ?></span></th>\r
- <td><input type="text" name="SkinsURL" value="<?php echo $param->SkinsURL; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD7; ?></span></th>\r
- <td><input type="text" name="SkinsPath" value="<?php echo $param->SkinsPath; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD8; ?></span></th>\r
- <td><input type="text" name="PluginURL" value="<?php echo $param->PluginURL; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _PATH_FIELD9; ?></span></th>\r
- <td><input type="text" name="ActionURL" value="<?php echo $param->ActionURL; ?>" /></td>\r
- </tr>\r
- </table>\r
- <p class="msg">\r
- <?php echo _DETAIL_TEXT3; ?>\r
- </p>\r
-\r
- <h2><?php echo _DETAIL_HEADER3; ?></h2>\r
- <p class="msg">\r
-<?php\r
- echo _DETAIL_TEXT4;\r
- if ( $isPostback )\r
- {\r
- $errors = $param->check_user_parameters();\r
- if ( is_array($errors) )\r
- {\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- }\r
-?>\r
- </p>\r
- <table>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>\r
- <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>\r
- <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>\r
- <td><input type="password" name="user_password" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>\r
- <td><input type="password" name="user_password2" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>\r
- <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>\r
- </tr>\r
- </table>\r
-\r
- <h2><?php echo _DETAIL_HEADER4; ?></h2>\r
- <p class="msg">\r
-<?php\r
- echo _DETAIL_TEXT5;\r
- if ( $isPostback )\r
- {\r
- $errors = $param->check_weblog_parameters();\r
- if ( is_array($errors) )\r
- {\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- }\r
-?>\r
- </p>\r
- <table>\r
- <tr>\r
- <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>\r
- <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>\r
- </tr>\r
- <tr>\r
- <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>\r
- <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>\r
- </tr>\r
- </table>\r
-\r
- <p class="msg">\r
- <?php echo _DETAIL_TEXT6; ?>\r
- </p>\r
-\r
- <p class="sbt">\r
- <button type="submit" name="action" value="detail" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>\r
- </p>\r
- </div>\r
- </form>\r
- </div>\r
-<?php\r
-}\r
-\r
-/**\r
- * Displays a screen to signal the completion of the installation\r
- */\r
-function show_install_complete_form()\r
-{\r
- global $MYSQL_HANDLER, $param;\r
- $errors = do_install();\r
-?>\r
- <div id="container">\r
- <p class="msg">\r
-<?php\r
- if ( is_array($errors) && count($errors) > 0 )\r
- {\r
- echo _INST_ERROR;\r
- foreach ( $errors as $error )\r
- {\r
- echo '<span class="err">', $error, "</span>\n";\r
- }\r
- }\r
- else\r
- {\r
- echo _INST_TEXT;\r
- if ( array_key_exists('config_data', $_SESSION) )\r
- {\r
- echo '<span class="err">', _INST_TEXT4, '</span>';\r
-?>\r
-<textarea id="config_text" readonly="readonly" onfocus="SelectText(this);"><?php echo htmlentities($_SESSION['config_data'], null, i18n::get_current_charset()) ?></textarea>\r
-<?php\r
- }\r
- else\r
- {\r
- echo '<span class="err">', _INST_TEXT5, '</span>';\r
- }\r
-?>\r
- </p>\r
- <form method="post" action="./index.php">\r
- <div class="prt">\r
- <h2><?php echo _INST_HEADER1; ?></h2>\r
- <p class="msg">\r
- <?php echo sprintf(_INST_TEXT1, $param->blog_name); ?>\r
- </p>\r
- <p class="sbt">\r
- <button type="button" name="toBlog" onclick="location.href='<?php echo $param->IndexURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON1; ?></button>\r
- </p>\r
- </div>\r
-\r
- <div class="prt">\r
- <h2><?php echo _INST_HEADER2; ?></h2>\r
- <p class="msg">\r
- <?php echo _INST_TEXT2; ?>\r
- </p>\r
- <p class="sbt">\r
- <button type="button" name="toMng" onclick="location.href='<?php echo $param->AdminURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON2; ?></button>\r
- </p>\r
- </div>\r
-\r
- <div class="prt">\r
- <h2><?php echo _INST_HEADER3; ?></h2>\r
- <p class="msg">\r
- <?php echo _INST_TEXT3; ?>\r
- </p>\r
- <p class="sbt">\r
- <button type="button" name="toAddBlog" onclick="location.href='<?php echo $param->AdminURL; ?>index.php?action=createnewlog';" class="sbt_arw"><?php echo _INST_BUTTON3; ?></button>\r
- </p>\r
- </div>\r
- </form>\r
-<?php\r
- }\r
-?>\r
- </div>\r
-<?php\r
- unset($param);\r
-}\r
-\r
-/**\r
- * The installation process itself\r
- * @return array error messages\r
- */\r
-function do_install()\r
-{\r
- global $param;\r
- global $MYSQL_HANDLER, $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX, $MYSQL_CONN;\r
- global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;\r
- $errors = array();\r
-\r
- /*\r
- * 1. put all param-vars into vars\r
- */\r
- $MYSQL_HOST = $param->mysql_host;\r
- $MYSQL_USER = $param->mysql_user;\r
- $MYSQL_PASSWORD = $param->mysql_password;\r
- $MYSQL_DATABASE = $param->mysql_database;\r
- $MYSQL_PREFIX = $param->mysql_tablePrefix;\r
-\r
- $DIR_NUCLEUS = $param->AdminPath;\r
- $DIR_MEDIA = $param->MediaPath;\r
- $DIR_SKINS = $param->SkinsPath;\r
- $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';\r
- $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';\r
- $DIR_LIBS = $DIR_NUCLEUS . 'libs/';\r
-\r
- /*\r
- * 2.open mySQL connection\r
- */\r
- $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);\r
- if ( $MYSQL_CONN == FALSE )\r
- {\r
- $errors[] = _DBCONNECT_ERROR;\r
- return $errors;\r
- }\r
-\r
- /*\r
- * 3. try to create database if needed\r
- */\r
- if ( DB::execute("CREATE DATABASE IF NOT EXISTS {$MYSQL_DATABASE}") === FALSE )\r
- {\r
- $errinfo = DB::getError();\r
- $errors[] = _INST_ERROR1 . ': ' . $errinfo[2];\r
- }\r
-\r
- /*\r
- * 4. try to select database\r
- */\r
- $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);\r
- if ( !$MYSQL_CONN )\r
- {\r
- $errors[] = _INST_ERROR2;\r
- }\r
-\r
- if ( count($errors) > 0 )\r
- {\r
- return $errors;\r
- }\r
-\r
- /*\r
- * 5. execute queries\r
- */\r
- $table_names = array(\r
- 'nucleus_actionlog',\r
- 'nucleus_ban',\r
- 'nucleus_blog',\r
- 'nucleus_category',\r
- 'nucleus_comment',\r
- 'nucleus_config',\r
- 'nucleus_item',\r
- 'nucleus_karma',\r
- 'nucleus_member',\r
- 'nucleus_plugin',\r
- 'nucleus_skin',\r
- 'nucleus_template',\r
- 'nucleus_team',\r
- 'nucleus_activation',\r
- 'nucleus_tickets'\r
- );\r
-\r
- $prefixed_table_names = array();\r
- foreach ( $table_names as $table_name )\r
- {\r
- $prefixed_table_names[] = $MYSQL_PREFIX . $table_name;\r
- }\r
-\r
- // table exists check\r
- $result = DB::getResult('SHOW TABLES');\r
- foreach ( $result as $row )\r
- {\r
- if ( in_array($row[0], $prefixed_table_names) )\r
- {\r
- $errors[] = _INST_ERROR3;\r
- break;\r
- }\r
- }\r
- if ( count($errors) > 0 )\r
- {\r
- return $errors;\r
- }\r
-\r
- $filename = 'install.sql';\r
- $fd = fopen($filename, 'r');\r
- $queries = fread($fd, filesize($filename));\r
- fclose($fd);\r
-\r
- $queries = preg_split('#(;\n|;\r)#', $queries);\r
-\r
- foreach ( $queries as $query )\r
- {\r
- if ( preg_match('/\w+/', $query) )\r
- {\r
- if ( $MYSQL_PREFIX )\r
- {\r
- $query = str_replace($table_names, $prefixed_table_names, $query);\r
- }\r
-\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $errinfo = DB::getError();\r
- $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];\r
- }\r
- }\r
- }\r
-\r
- /*\r
- * 6. put needed records\r
- */\r
- /* push first post */\r
- $query = "INSERT INTO %s VALUES (1, %s, %s, %s, 1, 1, %s, 0, 0, 0, 1, 0, 1)";\r
- $query = sprintf($query,\r
- tableName('nucleus_item'),\r
- DB::quoteValue(_1ST_POST_TITLE),\r
- DB::quoteValue(_1ST_POST),\r
- DB::quoteValue(_1ST_POST2),\r
- DB::formatDateTime()\r
- );\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $errinfo = DB::getError();\r
- $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];\r
- }\r
-\r
- /* push configurations */\r
- array_merge($errors, updateConfig('IndexURL', $param->IndexURL));\r
- array_merge($errors, updateConfig('AdminURL', $param->AdminURL));\r
- array_merge($errors, updateConfig('MediaURL', $param->MediaURL));\r
- array_merge($errors, updateConfig('SkinsURL', $param->SkinsURL));\r
- array_merge($errors, updateConfig('PluginURL', $param->PluginURL));\r
- array_merge($errors, updateConfig('ActionURL', $param->ActionURL));\r
- array_merge($errors, updateConfig('AdminEmail', $param->user_email));\r
- array_merge($errors, updateConfig('SiteName', $param->blog_name));\r
- array_merge($errors, updateConfig('Locale', i18n::get_current_locale()));\r
-\r
- /* push super admin */\r
- $query = "UPDATE %s SET mname = %s, mrealname = %s, mpassword = %s, memail = %s, murl = %s, madmin = 1, mcanlogin = 1 WHERE mnumber = 1";\r
- $query = sprintf($query,\r
- tableName('nucleus_member'),\r
- DB::quoteValue($param->user_name),\r
- DB::quoteValue($param->user_realname),\r
- DB::quoteValue(md5($param->user_password)),\r
- DB::quoteValue($param->user_email),\r
- DB::quoteValue($param->IndexURL)\r
- );\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $errinfo = DB::getError();\r
- $errors[] = _INST_ERROR5 . ': ' . $errinfo[2];\r
- }\r
-\r
- /* push new weblog */\r
- $query = "UPDATE %s SET bname = %s, bshortname = %s, burl = %s WHERE bnumber = 1";\r
- $query = sprintf($query,\r
- tableName('nucleus_blog'),\r
- DB::quoteValue($param->blog_name),\r
- DB::quoteValue($param->blog_shortname),\r
- DB::quoteValue($param->IndexURL)\r
- );\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $errinfo = DB::getError();\r
- $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];\r
- }\r
-\r
- /* push default category */\r
- $query = "UPDATE %s SET cname = %s, cdesc = %s WHERE catid = 1";\r
- $query = sprintf($query,\r
- tableName('nucleus_category'),\r
- DB::quoteValue(_GENERALCAT_NAME),\r
- DB::quoteValue(_GENERALCAT_DESC)\r
- );\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $errinfo = DB::getError();\r
- $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];\r
- }\r
-\r
- /*\r
- * 7. install default plugins and skins\r
- */\r
- global $aConfPlugsToInstall, $aConfSkinsToImport;\r
- $aSkinErrors = array();\r
- $aPlugErrors = array();\r
-\r
- if ( (count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) )\r
- {\r
- include_once($DIR_LIBS . 'globalfunctions.php');\r
- global $manager;\r
- if ( !isset($manager) )\r
- {\r
- $manager = new Manager();\r
- }\r
-\r
- include_once($DIR_LIBS . 'skinie.php');\r
- \r
- $aSkinErrors = installCustomSkins();\r
- if ( count($aSkinErrors) > 0 )\r
- {\r
- array_merge($errors, $aSkinErrors);\r
- }\r
- \r
- $query = "SELECT sdnumber FROM %s WHERE sdname='admin/default'";\r
- $query = sprintf($query, tableName('nucleus_skin_desc'));\r
- $res = intval(DB::getValue($query));\r
- array_merge($errors, updateConfig('AdminSkin', $res));\r
- \r
- $query = "SELECT sdnumber FROM %s WHERE sdname='admin/bookmarklet'";\r
- $query = sprintf($query, tableName('nucleus_skin_desc'));\r
- $res = intval(DB::getValue($query));\r
- array_merge($errors, updateConfig('BookmarkletSkin', $res));\r
- \r
- $query = "SELECT sdnumber FROM %s WHERE sdname='default'";\r
- $query = sprintf($query, tableName('nucleus_skin_desc'));\r
- $defSkinID = intval(DB::getValue($query));\r
-\r
- $query = "UPDATE %s SET bdefskin=%d WHERE bnumber=1";\r
- $query = sprintf($query, tableName('nucleus_blog'), $defSkinID);\r
- DB::execute($query);\r
- \r
- $query = "UPDATE %s SET value=%d WHERE name='BaseSkin'";\r
- $query = sprintf($query, tableName('nucleus_config'), $defSkinID);\r
- DB::execute($query);\r
-\r
- $aPlugErrors = installCustomPlugs();\r
- if ( count($aPlugErrors) > 0 )\r
- {\r
- array_merge($errors, $aPlugErrors);\r
- }\r
- }\r
-\r
- /*\r
- * 8. Write config file ourselves (if possible)\r
- */\r
- $config_data = '<' . '?php' . "\n";\r
- $config_data .= "// mySQL connection information\n";\r
- $config_data .= "\$MYSQL_HOST = '" . $MYSQL_HOST . "';\n";\r
- $config_data .= "\$MYSQL_USER = '" . $MYSQL_USER . "';\n";\r
- $config_data .= "\$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';\n";\r
- $config_data .= "\$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';\n";\r
- $config_data .= "\$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';\n";\r
- $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler\n";\r
- $config_data .= "// default is \$MYSQL_HANDLER = array('mysql','mysql');\n";\r
- $config_data .= "//\$MYSQL_HANDLER = array('mysql','mysql');\n";\r
- $config_data .= "//\$MYSQL_HANDLER = array('pdo','mysql');\n";\r
- $config_data .= "\$MYSQL_HANDLER = array('" . $MYSQL_HANDLER[0] . "','" . $MYSQL_HANDLER[1] . "');\n";\r
- $config_data .= "\n";\r
- $config_data .= "// main nucleus directory\n";\r
- $config_data .= "\$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';\n";\r
- $config_data .= "\n";\r
- $config_data .= "// path to media dir\n";\r
- $config_data .= "\$DIR_MEDIA = '" . $DIR_MEDIA . "';\n";\r
- $config_data .= "\n";\r
- $config_data .= "// extra skin files for imported skins\n";\r
- $config_data .= "\$DIR_SKINS = '" . $DIR_SKINS . "';\n";\r
- $config_data .= "\n";\r
- $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but \n";\r
- $config_data .= "// you can redefine them if you wish\n";\r
- $config_data .= "\$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";\r
- $config_data .= "\$DIR_LOCALES = \$DIR_NUCLEUS . 'locales/';\n";\r
- $config_data .= "\$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n";\r
- $config_data .= "\n";\r
- $config_data .= "// include libs\n";\r
- $config_data .= "include(\$DIR_LIBS.'globalfunctions.php');\n";\r
- $config_data .= "?" . ">";\r
-\r
- $result = false;\r
- if ( @!file_exists('../config.php') || is_writable('../config.php') )\r
- {\r
- if ( $fp = @fopen('../config.php', 'w') )\r
- {\r
- $result = @fwrite($fp, $config_data, i18n::strlen($config_data));\r
- fclose($fp);\r
- }\r
- }\r
-\r
- if ( $result )\r
- {\r
- // try to change the read-only permission.\r
- if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
- {\r
- @chmod('../config.php', 0444);\r
- }\r
- }\r
- else\r
- {\r
- $_SESSION['config_data'] = $config_data;\r
- }\r
-\r
- return $errors;\r
-}\r
-\r
-/**\r
- * Confirm that you can write to the configuration file\r
- * @return string error message\r
- */\r
-function canConfigFileWritable()\r
-{\r
- if ( @file_exists('../config.php') && @!is_writable('../config.php') )\r
- {\r
- // try to change the read-write permission.\r
- if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
- {\r
- @chmod('../config.php', 0666);\r
- }\r
-\r
- if ( @!is_writable('../config.php') )\r
- {\r
- return _INST_ERROR8;\r
- }\r
- }\r
- return '';\r
-}\r
-\r
-/**\r
- * To obtain the version of MySQL\r
- * @return string\r
- */\r
-function getMySqlVersion()\r
-{\r
- global $MYSQL_HANDLER, $minimum_mysql_version, $errors;\r
- // Turn on output buffer\r
- // Needed to repress the output of the sql function that are\r
- // not part of php (in this case the @ operator doesn't work)\r
- ob_start();\r
-\r
- // note: this piece of code is taken from phpMyAdmin\r
- $conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], 'localhost', '', '');\r
-\r
- if ( $conn )\r
- {\r
- $row = DB::getAttribute(PDO::ATTR_SERVER_VERSION);\r
- $match = preg_split('#\.#', $row);\r
- }\r
- else\r
- {\r
- $row = @DB::getRow('SHOW VARIABLES LIKE \'version\'');\r
-\r
- if ( $row )\r
- {\r
- $match = preg_split('#\.#', $row[1]);\r
- }\r
- else\r
- {\r
- $output = (function_exists('shell_exec')) ? @shell_exec('mysql -V') : '0.0.0';\r
- preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);\r
- $match = preg_split('#\.#', $version[0]);\r
-\r
- if ( $match[0] == '' )\r
- {\r
- $match = array('0', '0', '0');\r
- }\r
- }\r
- }\r
-\r
- @DB::disConnect();\r
-\r
- //End and clean output buffer\r
- ob_end_clean();\r
-\r
- return implode($match, '.');\r
-}\r
-\r
-/**\r
- * Add a table prefix if it is used\r
- *\r
- * @param string $input table name with prefix\r
- * @return string\r
- */\r
-function tableName($input)\r
-{\r
- global $MYSQL_PREFIX;\r
- if ( $MYSQL_PREFIX )\r
- {\r
- return $MYSQL_PREFIX . $input;\r
- }\r
- else\r
- {\r
- return $input;\r
- }\r
-}\r
-\r
-/**\r
- * Install custom plugins\r
- */\r
-function installCustomPlugs()\r
-{\r
- global $aConfPlugsToInstall, $DIR_LIBS, $manager;\r
-\r
- $aErrors = array();\r
- if ( count($aConfPlugsToInstall) == 0 )\r
- {\r
- return $aErrors;\r
- }\r
-\r
- $query = sprintf('SELECT * FROM %s', tableName('nucleus_plugin'));\r
- $res = DB::getResult($query);\r
- $numCurrent = $res->rowCount();\r
-\r
- foreach ( $aConfPlugsToInstall as $plugName )\r
- {\r
- $query = sprintf('INSERT INTO %s (porder, pfile) VALUES (%d, %s)',\r
- tableName('nucleus_plugin'),\r
- (++$numCurrent),\r
- DB::quoteValue($plugName));\r
- DB::execute($query);\r
-\r
- $manager->clearCachedInfo('installedPlugins');\r
- $plugin =& $manager->getPlugin($plugName);\r
- $plugin->setID($numCurrent);\r
-\r
- if ( !$plugin )\r
- {\r
- $query = sprintf('DELETE FROM %s WHERE pfile = %s',\r
- tableName('nucleus_plugin'),\r
- DB::quoteValue($plugName));\r
- DB::execute($query);\r
- $numCurrent--;\r
- array_push($aErrors, sprintf(_INST_ERROR9, $plugName));\r
- continue;\r
- }\r
- $plugin->install();\r
- }\r
-\r
- $query = sprintf('DELETE FROM %s', tableName('nucleus_plugin_event'));\r
- DB::execute($query);\r
- $query = sprintf('SELECT pid, pfile FROM %s', tableName('nucleus_plugin'));\r
- $res = DB::getResult($query);\r
-\r
- foreach ( $res as $row )\r
- {\r
- $plug =& $manager->getPlugin($row['pfile']);\r
-\r
- if ( $plug )\r
- {\r
- $eventList = $plug->getEventList();\r
- foreach ( $eventList as $eventName )\r
- {\r
- $query = sprintf('INSERT INTO %s (pid, event) VALUES (%d, %s)',\r
- tableName('nucleus_plugin_event'),\r
- intval($row['pid']),\r
- DB::quoteValue($eventName));\r
- DB::execute($query);\r
- }\r
- }\r
- }\r
- return $aErrors;\r
-}\r
-\r
-/**\r
- * Install custom skins\r
- * Prepares the installation of custom skins\r
- */\r
-function installCustomSkins()\r
-{\r
- global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS;\r
-\r
- $aErrors = array();\r
- if ( count($aConfSkinsToImport) == 0 )\r
- {\r
- return $aErrors;\r
- }\r
-\r
- $importer = new SkinImport();\r
-\r
- foreach ( $aConfSkinsToImport as $skinName )\r
- {\r
- $importer->reset();\r
- $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml';\r
-\r
- if ( !@file_exists($skinFile) )\r
- {\r
- array_push($aErrors, sprintf(_INST_ERROR10, $skinFile));\r
- continue;\r
- }\r
-\r
- $error = $importer->readFile($skinFile);\r
-\r
- if ( $error )\r
- {\r
- array_push($aErrors, sprintf(_INST_ERROR11, $skinName) . ' : ' . $error);\r
- continue;\r
- }\r
-\r
- $error = $importer->writeToDatabase(1);\r
-\r
- if ( $error )\r
- {\r
- array_push($aErrors, sprintf(_INST_ERROR12, $skinName) . ' : ' . $error);\r
- continue;\r
- }\r
- }\r
- return $aErrors;\r
-}\r
-\r
-/**\r
- * Check if some important files of the Nucleus CMS installation are available\r
- * Give an error if one or more files are not accessible\r
- */\r
-function do_check_files()\r
-{\r
- $missingfiles = array();\r
- $files = array(\r
- './install.sql',\r
- '../index.php',\r
- '../action.php',\r
- '../nucleus/index.php',\r
- '../nucleus/libs/ACTION.php',\r
- '../nucleus/libs/ACTIONLOG.php',\r
- '../nucleus/libs/ACTIONS.php',\r
- '../nucleus/libs/ADMIN.php',\r
- '../nucleus/libs/BaseActions.php',\r
- '../nucleus/libs/BLOG.php',\r
- '../nucleus/libs/BODYACTIONS.php',\r
- '../nucleus/libs/COMMENT.php',\r
- '../nucleus/libs/COMMENTACTIONS.php',\r
- '../nucleus/libs/COMMENTS.php',\r
- '../nucleus/libs/ENTITY.php',\r
- '../nucleus/libs/globalfunctions.php',\r
- '../nucleus/libs/i18n.php',\r
- '../nucleus/libs/ITEM.php',\r
- '../nucleus/libs/ITEMACTIONS.php',\r
- '../nucleus/libs/LINK.php',\r
- '../nucleus/libs/MANAGER.php',\r
- '../nucleus/libs/MEDIA.php',\r
- '../nucleus/libs/MEMBER.php',\r
- '../nucleus/libs/NOTIFICATION.php',\r
- '../nucleus/libs/PARSER.php',\r
- '../nucleus/libs/PLUGIN.php',\r
- '../nucleus/libs/PLUGINADMIN.php',\r
- '../nucleus/libs/SEARCH.php',\r
- '../nucleus/libs/showlist.php',\r
- '../nucleus/libs/SKIN.php',\r
- '../nucleus/libs/TEMPLATE.php',\r
- '../nucleus/libs/vars4.1.0.php',\r
- '../nucleus/libs/xmlrpc.inc.php',\r
- '../nucleus/libs/xmlrpcs.inc.php',\r
- '../nucleus/libs/sql/DB.php',\r
- '../nucleus/libs/sql/MYSQLPDO.php'\r
- );\r
-\r
- $count = count($files);\r
- for ( $i = 0; $i < $count; $i++ )\r
- {\r
- if ( !is_readable($files[$i]) )\r
- {\r
- array_push($missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.<br />');\r
- }\r
- }\r
-\r
- if ( count($missingfiles) > 0 )\r
- {\r
- exit(implode("\n", $missingfiles));\r
- }\r
-}\r
-\r
-/**\r
- * Updates the configuration in the database\r
- *\r
- * @param string $name name of the config var\r
- * @param string $value new value of the config var\r
- * @return array\r
- */\r
-function updateConfig($name, $value)\r
-{\r
- $errors = array();\r
-\r
- $query = "UPDATE %s SET value = %s WHERE name = %s";\r
- $query = sprintf($query, tableName('nucleus_config'), DB::quoteValue(trim($value)), DB::quoteValue($name));\r
-\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $errinfo = DB::getError();\r
- $errors[] = _INST_ERROR4 . ': ' . $errinfo[2];\r
- }\r
- return $errors;\r
-}\r
-\r
-class ParamManager\r
-{\r
- /* process parameter */\r
- public $state;\r
- public $locale;\r
-\r
- /* mysql connection parameters */\r
- public $mysql_host;\r
- public $mysql_user;\r
- public $mysql_password;\r
- public $mysql_database;\r
- public $mysql_tablePrefix;\r
-\r
- /* weblog configuration parameters */\r
- public $blog_name;\r
- public $blog_shortname;\r
-\r
- /* member configuration parameters */\r
- public $user_name;\r
- public $user_realname;\r
- public $user_password;\r
- private $user_password2;\r
- public $user_email;\r
-\r
- /* URI parameters */\r
- private $root_url;\r
- public $IndexURL;\r
- public $AdminURL;\r
- public $MediaURL;\r
- public $SkinsURL;\r
- public $PluginURL;\r
- public $ActionURL;\r
-\r
- /* path parameters */\r
- private $root_path;\r
- public $AdminPath;\r
- public $MediaPath;\r
- public $SkinsPath;\r
-\r
- /**\r
- * constructor\r
- */\r
- public function __construct()\r
- {\r
- $this->init();\r
- }\r
-\r
- public function init()\r
- {\r
- // set default values\r
- $this->state = 'locale';\r
- $this->install_mode = 'simple';\r
- $this->locale = '';\r
- $this->mysql_host = @ini_get('mysql.default_host');\r
- $this->blog_name = 'My Nucleus CMS';\r
- $this->blog_shortname = 'mynucleuscms';\r
-\r
- /* root path */\r
- $directory_separator = preg_quote(DIRECTORY_SEPARATOR, '|');\r
- $this->root_path = implode('/', preg_split("|$directory_separator|", realpath(dirname(__FILE__) . '/..')));\r
- if ( substr($this->root_path, -1, 1) !== '/' )\r
- {\r
- $this->root_path .= '/';\r
- }\r
- $base_path_pcre = preg_quote($this->root_path, '|');\r
-\r
- /* current directry name */\r
- $directory_name = preg_replace("#{$base_path_pcre}#", '', implode('/', preg_split("#{$directory_separator}#", realpath(dirname(__FILE__)))));\r
- $directory_name_pcre = preg_quote($directory_name, '|');\r
-\r
- /* root uri */\r
- $root_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];\r
- $this->root_url = preg_replace("|$directory_name_pcre(.*)$|", '', $root_url);\r
-\r
- $this->AdminPath = $this->root_path . 'nucleus/';\r
- $this->MediaPath = $this->root_path . 'media/';\r
- $this->SkinsPath = $this->root_path . 'skins/';\r
-\r
- $this->IndexURL = $this->root_url;\r
- $this->AdminURL = $this->root_url . 'nucleus/';\r
- $this->MediaURL = $this->root_url . 'media/';\r
- $this->SkinsURL = $this->root_url . 'skins/';\r
- $this->PluginURL = $this->root_url . 'nucleus/plugins/';\r
- $this->ActionURL = $this->root_url . 'action.php';\r
- }\r
-\r
- private function read_parameter($parameter)\r
- {\r
- foreach ( $parameter as $element )\r
- {\r
- if ( array_key_exists($element, $_POST) )\r
- {\r
- $this->$element = $_POST[$element];\r
- }\r
- }\r
- }\r
-\r
- public function set_state($state)\r
- {\r
- $states = array('locale', 'mysql', 'weblog', 'detail', 'install');\r
- if ( in_array($state, $states) )\r
- {\r
- $this->state = $state;\r
- }\r
- }\r
-\r
- public function set_locale()\r
- {\r
- $this->read_parameter(array('locale'));\r
- \r
- if ( !$this->locale )\r
- {\r
- /**\r
- * default locale select simple implementation\r
- * \r
- * NOTE:\r
- * RFC2616: Hypertext Transfer Protocol -- HTTP/1.1\r
- * http://www.ietf.org/rfc/rfc2616.txt\r
- * \r
- * 14.4 Accept-Language\r
- * \r
- * The Accept-Language request-header field is similar to Accept, but\r
- * restricts the set of natural languages that are preferred as a\r
- * response to the request. Language tags are defined in section 3.10.\r
- * \r
- * Accept-Language = "Accept-Language" ":"\r
- * 1#( language-range [ ";" "q" "=" qvalue ] )\r
- * language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )\r
- * \r
- * Each language-range MAY be given an associated quality value which\r
- * represents an estimate of the user's preference for the languages\r
- * specified by that range. The quality value defaults to "q=1". For\r
- * example,\r
- * \r
- * Accept-Language: da, en-gb;q=0.8, en;q=0.7\r
- * \r
- * would mean: "I prefer Danish, but will accept British English and\r
- * other types of English." A language-range matches a language-tag if\r
- * it exactly equals the tag, or if it exactly equals a prefix of the\r
- * tag such that the first tag character following the prefix is "-".\r
- * The special range "*", if present in the Accept-Language field,\r
- * matches every tag not matched by any other range present in the\r
- * Accept-Language field.\r
- * \r
- * TODO: this is appropriate implement or not\r
- */\r
- $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);\r
- \r
- /* retrieve language token of language tag from first token */\r
- $language = '';\r
- if ( is_array($languages) && count($languages) > 0 )\r
- {\r
- $language = preg_replace('#^([\w]+).*$#', '$1', $languages[0]);\r
- }\r
- \r
- $locales = i18n::get_available_locale_list();\r
- foreach ( $locales as $locale )\r
- {\r
- if ( i18n::strpos($locale, $language) === 0 )\r
- {\r
- $this->locale = $locale;\r
- break;\r
- }\r
- }\r
- }\r
- \r
- /* include installer translation messages */\r
- $translation_file = "./locales/{$this->locale}." . i18n::get_current_charset() . '.php';\r
- if ( !file_exists($translation_file) )\r
- {\r
- $translation_file = './locales/en_Latn_US.UTF-8.php';\r
- }\r
- include($translation_file);\r
- \r
- /* include global translation messages */\r
- $translation_file = "../nucleus/locales/{$this->locale}." . i18n::get_current_charset() . '.php';\r
- if ( !file_exists($translation_file) )\r
- {\r
- $translation_file = './locales/en_Latn_US.UTF-8.php';\r
- }\r
- include($translation_file);\r
- \r
- i18n::set_current_locale($this->locale);\r
- \r
- return;\r
- }\r
-\r
- public function check_mysql_parameters()\r
- {\r
- global $MYSQL_HANDLER;\r
- \r
- $parameters = array('mysql_host', 'mysql_user', 'mysql_password', 'mysql_database', 'mysql_tablePrefix');\r
- $this->read_parameter($parameters);\r
-\r
- $errors = array();\r
- if ( $this->mysql_host == '' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD1);\r
- }\r
-\r
- if ( $this->mysql_user == '' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD2);\r
- }\r
- \r
- if ( $this->mysql_user != ''\r
- && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_user) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD2);\r
- }\r
- \r
- if ( $this->mysql_database == '' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD4);\r
- }\r
-\r
- if ( $this->mysql_database != ''\r
- && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_database) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD4);\r
- }\r
-\r
- if ( $this->mysql_tablePrefix != ''\r
- && !preg_match('/^[a-z0-9_]+$/i', $this->mysql_tablePrefix) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR3, _DB_FIELD5);\r
- }\r
- \r
- if ( count($errors) == 0 )\r
- {\r
- $mysql_conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], $this->mysql_host, $this->mysql_user, $this->mysql_password);\r
- if ( $mysql_conn == false )\r
- {\r
- $errors[] = _DBCONNECT_ERROR;\r
- }\r
- else\r
- {\r
- @DB::disConnect();\r
- }\r
- }\r
-\r
- return $errors;\r
- }\r
-\r
- public function check_user_parameters()\r
- {\r
- $parameters = array('user_name', 'user_realname', 'user_password', 'user_password2', 'user_email');\r
- $this->read_parameter($parameters);\r
-\r
- $errors = array();\r
- if ( $this->user_realname == '' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD1);\r
- }\r
-\r
- if ( $this->user_name == '' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD2);\r
- }\r
- elseif ( !preg_match("/^[a-z0-9]+([ a-z0-9]*[a-z0-9]+)?$/i", $this->user_name) )\r
- {\r
- $errors[] = _VALID_ERROR5;\r
- }\r
-\r
- if ( $this->user_password == '' || $this->user_password2 == '' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD3);\r
- $this->user_password = '';\r
- }\r
- elseif ( $this->user_password != $this->user_password2 )\r
- {\r
- $errors[] = _VALID_ERROR6;\r
- $this->user_password = '';\r
- }\r
-\r
- if ( !preg_match("/^[a-z0-9\._+\-]+@[a-z0-9\._\-]+\.[a-z]{2,6}$/i", $this->user_email) )\r
- {\r
- $errors[] = _VALID_ERROR7;\r
- }\r
-\r
- return $errors;\r
- }\r
-\r
- public function check_weblog_parameters()\r
- {\r
- $parameters = array('blog_name', 'blog_shortname');\r
- $this->read_parameter($parameters);\r
-\r
- $errors = array();\r
- if ( $this->blog_name == '' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD1);\r
- }\r
-\r
- if ( $this->blog_shortname == '' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD2);\r
- }\r
-\r
- if ( !preg_match("/^[a-z0-9]+$/i", $this->blog_shortname) )\r
- {\r
- $errors[] = _VALID_ERROR4;\r
- }\r
-\r
- return $errors;\r
- }\r
-\r
- public function check_uri_parameters()\r
- {\r
- $parameters = array('IndexURL', 'AdminURL', 'MediaURL', 'SkinsURL', 'PluginURL', 'ActionURL');\r
- $this->read_parameter($parameters);\r
-\r
- $errors = array();\r
- if ( substr($this->IndexURL, -1, 1) !== '/' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD1);\r
- }\r
-\r
- if ( substr($this->AdminURL, -1, 1) !== '/' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD2);\r
- }\r
-\r
- if ( substr($this->MediaURL, -1, 1) !== '/' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD4);\r
- }\r
-\r
- if ( substr($this->SkinsURL, -1, 1) !== '/' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD6);\r
- }\r
-\r
- if ( substr($this->PluginURL, -1, 1) !== '/' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD8);\r
- }\r
-\r
- if ( strrchr($this->ActionURL, '/') != '/action.php' )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR9, _PATH_FIELD9);\r
- }\r
-\r
- return $errors;\r
- }\r
-\r
- public function check_path_parameters()\r
- {\r
- $parameters = array('AdminPath', 'MediaPath', 'SkinsPath');\r
- $this->read_parameter($parameters);\r
-\r
- $separators = array('/', DIRECTORY_SEPARATOR);\r
- $errors = array();\r
- if ( !in_array(substr($this->AdminPath, -1, 1), $separators) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD3);\r
- }\r
- elseif ( !file_exists($this->AdminPath) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD3);\r
- }\r
-\r
- if ( !in_array(substr($this->MediaPath, -1, 1), $separators) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD5);\r
- }\r
- elseif ( !file_exists($this->MediaPath) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD5);\r
- }\r
-\r
- if ( !in_array(substr($this->SkinsPath, -1, 1), $separators) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD7);\r
- }\r
- elseif ( !file_exists($this->SkinsPath) )\r
- {\r
- $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD7);\r
- }\r
-\r
- return $errors;\r
- }\r
-\r
- /**\r
- * check all parameters\r
- * @return bool\r
- */\r
- public function check_all_parameters()\r
- {\r
- $this->set_locale();\r
-\r
- $isValid = true;\r
- $isValid &= (count($this->check_mysql_parameters()) == 0);\r
- $isValid &= (count($this->check_user_parameters()) == 0);\r
- $isValid &= (count($this->check_weblog_parameters()) == 0);\r
- $isValid &= (count($this->check_uri_parameters()) == 0);\r
- $isValid &= (count($this->check_path_parameters()) == 0);\r
-\r
- return $isValid;\r
- }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ *
+ * This script will install the Nucleus tables in your SQL-database,
+ * and initialize the data in those tables.
+ */
+
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: index.php 1889 2012-06-17 08:46:45Z sakamocchi $
+ */
+
+/* global values initialize */
+$CONF = array();
+
+/* reporting all errors for support */
+error_reporting(E_ALL);
+
+$minimum_php_version = '5.0.6';
+$minimum_mysql_version = '3.23';
+
+$page_footer_copyright = '© 2001-2012 The Nucleus Groupe . Running Nucleus CMS v4.00';
+
+// begin if: server's PHP version is below the minimum; halt installation
+if ( version_compare(PHP_VERSION, $minimum_php_version, '<') )
+{
+ exit('<div style="font-size: xx-large;"> Nucleus requires at least PHP version ' . $minimum_php_version . '</div>');
+}
+
+// make sure there's no unnecessary escaping: # set_magic_quotes_runtime(0);
+if ( version_compare(PHP_VERSION, '5.3.0', '<') )
+{
+ ini_set('magic_quotes_runtime', '0');
+}
+
+/* default installed plugins and skins */
+$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Medium');
+$aConfSkinsToImport = array('atom', 'rss2.0', 'rsd', 'default', 'admin/default', 'admin/bookmarklet');
+
+// Check if some important files
+do_check_files();
+
+/* i18n class is needed for internationalization */
+include_once('../nucleus/libs/i18n.php');
+if ( !i18n::init('UTF-8', '../nucleus/locales') )
+{
+ exit('<div style="font-size: xx-large;"> Failed to initialize iconv or mbstring extension. Would you please contact the administrator of your PHP server? </div>');
+}
+
+// include core classes that are needed for login & plugin handling
+
+// added for 3.5 sql_* wrapper
+global $MYSQL_HANDLER;
+
+if ( !isset($MYSQL_HANDLER) )
+{
+ $MYSQL_HANDLER = array('mysql', '');
+
+ // check if mysql support is installed; this check may not make sense, as is, in a version past 3.5x
+ if ( !function_exists('mysql_query') && !function_exists('mysqli_query') )
+ {
+ exit('<div style="font-size: xx-large;"> Your PHP version does not have support for MySQL :( </div>');
+}
+}
+include_once('../nucleus/libs/sql/sql.php');
+
+session_start();
+if ( count($_GET) == 0 && count($_POST) == 0 )
+{
+ unset($_SESSION['param_manager']);
+}
+
+// restore the $param from the session
+if ( array_key_exists('param_manager', $_SESSION) )
+{
+ $param = $_SESSION['param_manager'];
+}
+else
+{
+ $param = new ParamManager();
+}
+
+// include translation file
+$param->set_locale();
+
+do_action();
+
+// $param is saved to the session
+if ( isset($param) )
+{
+ $_SESSION['param_manager'] = $param;
+}
+else
+{
+ unset($_SESSION['param_manager']);
+}
+exit;
+
+/**
+ * installer action
+ */
+function do_action()
+{
+ global $param;
+
+ if ( array_key_exists('action', $_POST) )
+ {
+ $isPostback = true;
+ }
+ else
+ {
+ $isPostback = false;
+ }
+
+ // mode change
+ if ( array_key_exists('mode', $_REQUEST) )
+ {
+ if ( $_REQUEST['mode'] == 'detail' )
+ {
+ $param->set_state('detail');
+ }
+ elseif ( $_REQUEST['mode'] == 'simple' )
+ {
+ $param->set_state('mysql');
+ }
+ }
+
+ // input parameter check
+ if ( $isPostback )
+ {
+ switch ( $param->state )
+ {
+ case 'locale':
+ $param->set_state('mysql');
+ $isPostback = false;
+ break;
+ case 'mysql':
+ if ( count($param->check_mysql_parameters()) == 0 )
+ {
+ $param->set_state('weblog');
+ $isPostback = false;
+ }
+ break;
+ case 'weblog':
+ if ( count($param->check_user_parameters()) == 0
+ && count($param->check_weblog_parameters()) == 0 )
+ {
+ $param->set_state('install');
+ $isPostback = false;
+ }
+ break;
+ case 'detail':
+ if ( $param->check_all_parameters() )
+ {
+ $param->set_state('install');
+ $isPostback = false;
+ }
+ break;
+ }
+ }
+
+ // page render
+ show_header();
+ switch ( $param->state )
+ {
+ case 'locale':
+ show_select_locale_form();
+ break;
+ case 'mysql':
+ show_database_setting_form($isPostback);
+ break;
+ case 'weblog':
+ show_blog_setting_form($isPostback);
+ break;
+ case 'detail':
+ show_detail_setting_form($isPostback);
+ break;
+ case 'install':
+ show_install_complete_form();
+ break;
+ }
+ show_footer();
+}
+
+/**
+ * header tag of the installation screens
+ **/
+function show_header()
+{
+ global $param;
+
+ /* HTTP 1.1 application for no caching */
+ header("Cache-Control: no-cache, must-revalidate");
+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+ header('Content-Type: text/html; charset=' . i18n::get_current_charset());
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title><?php echo _TITLE; ?></title>
+ <link rel="stylesheet" type="text/css" href="./styles/inst.css" />
+ <style type="text/css">
+ <!--
+ <?php echo _BODYFONTSTYLE; ?>
+ -->
+ </style>
+ <script type="text/javascript">
+ function SelectText( element ) {
+ window.setTimeout( function() { element.select() }, 0 );
+ }
+ var isSubmit = false;
+ function OnceSubmit() {
+ if (!isSubmit) {
+ isSubmit = true;
+ window.setTimeout( function() { isSubmit = false; }, 10000 );
+ return true;
+ }
+ return false;
+ }
+ </script>
+ </head>
+ <body>
+ <div id="header">
+ <div id="navigation">
+ <h1><img src="./styles/nucleus_rogo.png" alt="NucleusCMS" /></h1>
+ <ul>
+<?php
+ echo '<li>';
+ $label = '_LOCALE_' . strtoupper($param->locale);
+ if ( !defined($label) )
+ {
+ echo $param->locale;
+ }
+ else
+ {
+ echo constant($label);
+ }
+ echo "</li>\n";
+
+ if ( in_array($param->state, array('mysql', 'weblog', 'install')) )
+ {
+ echo '<li> > ' . _STEP1, '</li><li';
+ if ( $param->state == 'mysql' )
+ {
+ echo ' class="gry"';
+ }
+ echo '> > ', _STEP2, '</li><li';
+ if ( in_array($param->state, array('mysql', 'weblog')) )
+ {
+ echo ' class="gry"';
+ }
+ echo '> > ', _STEP3, "</li>\n";
+ }
+ if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )
+ {
+ echo '<li class="rightbox">';
+ if ( in_array($param->state, array('mysql', 'weblog')) )
+ {
+ echo '<a href="./?mode=detail">', _MODE2, '</a>';
+ }
+ else
+ {
+ echo '<a href="./?mode=simple">', _MODE1, '</a>';
+ }
+ echo '</li>';
+ }
+?>
+ </ul>
+ </div>
+ </div>
+<?php
+}
+
+/**
+ * footer tag of the installation screens
+ **/
+function show_footer()
+{
+ global $page_footer_copyright;
+?>
+ <div id="footer">
+ <?php echo $page_footer_copyright; ?>
+ </div>
+ </body>
+</html>
+<?php
+}
+
+/**
+ * Display the form for language select
+ */
+function show_select_locale_form()
+{
+ global $param;
+
+?>
+ <div id="container">
+ <p style="font-size:152%;font-weight:bold;">
+ <?php echo _LOCALE_HEADER; ?>
+ </p>
+ <form method="post" action="./index.php">
+
+ <div class="prt">
+ <select name="locale">
+<?php
+ $locales = i18n::get_available_locale_list();
+ foreach ( $locales as $locale )
+ {
+ if ( $param->locale != $locale )
+ {
+ echo "<option value=\"{$locale}\">";
+ }
+ else
+ {
+ echo "<option value=\"{$locale}\" selected=\"selected\">";
+ }
+
+ $checkfile = "./locales/{$locale}." . i18n::get_current_charset() . '.php';
+ if ( !file_exists($checkfile) )
+ {
+ echo '* ';
+ }
+
+ $label = '_LOCALE_' . strtoupper($locale);
+ if ( !defined($label) )
+ {
+ echo $locale;
+ }
+ else
+ {
+ echo constant($label);
+ }
+ echo "</option>\n";
+ }
+?>
+ </select>
+ <p><?php echo _LOCALE_DESC1; ?></p>
+ <p><?php echo _LOCALE_DESC2; ?></p>
+ <p><?php echo _LOCALE_NEED_HELP;?></p>
+ <p class="sbt">
+ <button type="submit" name="action" value="locale" class="sbt_arw">START</button>
+ </p>
+ </div>
+ </form>
+ </div>
+<?php
+}
+
+/**
+ * Display the form to set up a database
+ * @param bool $isPostback
+ */
+function show_database_setting_form($isPostback)
+{
+ global $param, $minimum_mysql_version;
+
+ $config_writable = canConfigFileWritable();
+ $mysql_version = getMySqlVersion();
+?>
+ <div id="container">
+ <p class="msg">
+<?php
+ echo _SIMPLE_NAVI1;
+ if ( $config_writable != '' )
+ {
+ echo '<span class="err">', $config_writable, '</span>';
+ }
+ if ( $mysql_version == '0.0.0' )
+ {
+ echo '<span class="err">', _DBVERSION_UNKOWN, '</span>';
+ }
+ elseif ( version_compare($mysql_version, $minimum_mysql_version, '<') )
+ {
+ echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';
+ }
+?>
+ </p>
+ <form method="post" action="./index.php">
+ <div class="prt">
+ <h2><?php echo _DB_HEADER; ?></h2>
+ <p class="msg">
+<?php
+ if ( $isPostback )
+ {
+ $errors = $param->check_mysql_parameters();
+ if ( is_array($errors) )
+ {
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ }
+?>
+ </p>
+ <table>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>
+ <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>
+ <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>
+ <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>
+ <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>
+ </tr>
+ </table>
+ <p class="sbt">
+ <button type="submit" name="mode" value="detail" class="sbt_sqr"><?php echo _MODE2; ?></button>
+ <button type="submit" name="action" value="mysql" class="sbt_arw"><?php echo _NEXT; ?></button>
+ </p>
+ <p class="msg">
+ <?php echo _DB_TEXT1; ?>
+ </p>
+ </div>
+ </form>
+ </div>
+<?php
+}
+
+/**
+ * Displays a form to the blog settings
+ * @param bool $isPostback
+ */
+function show_blog_setting_form($isPostback)
+{
+ global $param;
+?>
+ <div id="container">
+ <p class="msg">
+ <?php echo _SIMPLE_NAVI2; ?>
+ </p>
+ <form method="post" action="./index.php">
+ <div class="prt">
+ <h2><?php echo _BLOG_HEADER; ?></h2>
+ <p class="msg">
+<?php
+ if ( $isPostback )
+ {
+ $errors = $param->check_weblog_parameters();
+ if ( is_array($errors) )
+ {
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ }
+?>
+ </p>
+ <table>
+ <tr>
+ <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>
+ <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>
+ <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="prt">
+ <h2><?php echo _ADMIN_HEADER; ?></h2>
+ <p class="msg">
+<?php
+ if ( $isPostback )
+ {
+ $errors = $param->check_user_parameters();
+ if ( is_array($errors) )
+ {
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ }
+?>
+ </p>
+ <table>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>
+ <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>
+ <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>
+ <td><input type="password" name="user_password" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>
+ <td><input type="password" name="user_password2" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>
+ <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>
+ </tr>
+ </table>
+ <p class="sbt">
+ <button type="submit" name="action" value="weblog" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>
+ </p>
+ </div>
+ </form>
+ </div>
+<?php
+}
+
+/**
+ * Displays a form to the detail settings
+ * @param bool $isPostback
+ */
+function show_detail_setting_form($isPostback)
+{
+ global $param, $minimum_mysql_version;
+
+ $mysql_version = getMySqlVersion();
+?>
+ <div id="container_detailed">
+ <p class="msg">
+ <?php echo _DETAIL_NAVI1; ?>
+<?php
+ if ( $isPostback && !$param->check_all_parameters() )
+ {
+ echo '<span class="err">', _VALID_ERROR, "</span>\n";
+ }
+?>
+ </p>
+ <ul class="msg">
+ <li>PHP: <?php echo phpversion(); ?></li>
+ <li>MySQL:
+<?php
+ echo ($mysql_version == '0.0.0') ? _DBVERSION_UNKOWN : $mysql_version;
+ if ( version_compare($mysql_version, $minimum_mysql_version, '<') )
+ {
+ echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';
+ }
+?></li>
+ </ul>
+ <form method="post" action="">
+
+ <div class="prt">
+ <h2><?php echo _DETAIL_HEADER1; ?></h2>
+ <p class="msg">
+<?php
+ if ( $isPostback )
+ {
+ $errors = $param->check_mysql_parameters();
+ if ( is_array($errors) )
+ {
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ }
+?>
+ </p>
+ <table>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>
+ <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>
+ <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>
+ <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>
+ <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _DB_FIELD5; ?></span><span class="sub"><?php echo _DB_FIELD5_DESC; ?></span></th>
+ <td><input type="text" name="mysql_tablePrefix" value="<?php echo $param->mysql_tablePrefix; ?>" /></td>
+ </tr>
+ </table>
+
+ <h2><?php echo _DETAIL_HEADER2; ?></h2>
+ <p class="msg">
+<?php
+ if ( $isPostback )
+ {
+ $errors = $param->check_uri_parameters();
+ if ( is_array($errors) )
+ {
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ $errors = $param->check_path_parameters();
+ if ( is_array($errors) )
+ {
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ }
+?>
+ </p>
+ <table>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD1; ?></span></th>
+ <td><input type="text" name="IndexURL" value="<?php echo $param->IndexURL; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD2; ?></span></th>
+ <td><input type="text" name="AdminURL" value="<?php echo $param->AdminURL; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD3; ?></span></th>
+ <td><input type="text" name="AdminPath" value="<?php echo $param->AdminPath; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD4; ?></span></th>
+ <td><input type="text" name="MediaURL" value="<?php echo $param->MediaURL; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD5; ?></span></th>
+ <td><input type="text" name="MediaPath" value="<?php echo $param->MediaPath; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD6; ?></span></th>
+ <td><input type="text" name="SkinsURL" value="<?php echo $param->SkinsURL; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD7; ?></span></th>
+ <td><input type="text" name="SkinsPath" value="<?php echo $param->SkinsPath; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD8; ?></span></th>
+ <td><input type="text" name="PluginURL" value="<?php echo $param->PluginURL; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _PATH_FIELD9; ?></span></th>
+ <td><input type="text" name="ActionURL" value="<?php echo $param->ActionURL; ?>" /></td>
+ </tr>
+ </table>
+ <p class="msg">
+ <?php echo _DETAIL_TEXT3; ?>
+ </p>
+
+ <h2><?php echo _DETAIL_HEADER3; ?></h2>
+ <p class="msg">
+<?php
+ echo _DETAIL_TEXT4;
+ if ( $isPostback )
+ {
+ $errors = $param->check_user_parameters();
+ if ( is_array($errors) )
+ {
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ }
+?>
+ </p>
+ <table>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>
+ <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>
+ <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>
+ <td><input type="password" name="user_password" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>
+ <td><input type="password" name="user_password2" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>
+ <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>
+ </tr>
+ </table>
+
+ <h2><?php echo _DETAIL_HEADER4; ?></h2>
+ <p class="msg">
+<?php
+ echo _DETAIL_TEXT5;
+ if ( $isPostback )
+ {
+ $errors = $param->check_weblog_parameters();
+ if ( is_array($errors) )
+ {
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ }
+?>
+ </p>
+ <table>
+ <tr>
+ <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>
+ <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>
+ </tr>
+ <tr>
+ <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>
+ <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>
+ </tr>
+ </table>
+
+ <p class="msg">
+ <?php echo _DETAIL_TEXT6; ?>
+ </p>
+
+ <p class="sbt">
+ <button type="submit" name="action" value="detail" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>
+ </p>
+ </div>
+ </form>
+ </div>
+<?php
+}
+
+/**
+ * Displays a screen to signal the completion of the installation
+ */
+function show_install_complete_form()
+{
+ global $MYSQL_HANDLER, $param;
+ $errors = do_install();
+?>
+ <div id="container">
+ <p class="msg">
+<?php
+ if ( is_array($errors) && count($errors) > 0 )
+ {
+ echo _INST_ERROR;
+ foreach ( $errors as $error )
+ {
+ echo '<span class="err">', $error, "</span>\n";
+ }
+ }
+ else
+ {
+ echo _INST_TEXT;
+ if ( array_key_exists('config_data', $_SESSION) )
+ {
+ echo '<span class="err">', _INST_TEXT4, '</span>';
+?>
+<textarea id="config_text" readonly="readonly" onfocus="SelectText(this);"><?php echo htmlentities($_SESSION['config_data'], null, i18n::get_current_charset()) ?></textarea>
+<?php
+ }
+ else
+ {
+ echo '<span class="err">', _INST_TEXT5, '</span>';
+ }
+?>
+ </p>
+ <form method="post" action="./index.php">
+ <div class="prt">
+ <h2><?php echo _INST_HEADER1; ?></h2>
+ <p class="msg">
+ <?php echo sprintf(_INST_TEXT1, $param->blog_name); ?>
+ </p>
+ <p class="sbt">
+ <button type="button" name="toBlog" onclick="location.href='<?php echo $param->IndexURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON1; ?></button>
+ </p>
+ </div>
+
+ <div class="prt">
+ <h2><?php echo _INST_HEADER2; ?></h2>
+ <p class="msg">
+ <?php echo _INST_TEXT2; ?>
+ </p>
+ <p class="sbt">
+ <button type="button" name="toMng" onclick="location.href='<?php echo $param->AdminURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON2; ?></button>
+ </p>
+ </div>
+
+ <div class="prt">
+ <h2><?php echo _INST_HEADER3; ?></h2>
+ <p class="msg">
+ <?php echo _INST_TEXT3; ?>
+ </p>
+ <p class="sbt">
+ <button type="button" name="toAddBlog" onclick="location.href='<?php echo $param->AdminURL; ?>index.php?action=createnewlog';" class="sbt_arw"><?php echo _INST_BUTTON3; ?></button>
+ </p>
+ </div>
+ </form>
+<?php
+ }
+?>
+ </div>
+<?php
+ unset($param);
+}
+
+/**
+ * The installation process itself
+ * @return array error messages
+ */
+function do_install()
+{
+ global $param;
+ global $MYSQL_HANDLER, $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX, $MYSQL_CONN;
+ global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;
+ $errors = array();
+
+ /*
+ * 1. put all param-vars into vars
+ */
+ $MYSQL_HOST = $param->mysql_host;
+ $MYSQL_USER = $param->mysql_user;
+ $MYSQL_PASSWORD = $param->mysql_password;
+ $MYSQL_DATABASE = $param->mysql_database;
+ $MYSQL_PREFIX = $param->mysql_tablePrefix;
+
+ $DIR_NUCLEUS = $param->AdminPath;
+ $DIR_MEDIA = $param->MediaPath;
+ $DIR_SKINS = $param->SkinsPath;
+ $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
+ $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';
+ $DIR_LIBS = $DIR_NUCLEUS . 'libs/';
+
+ /*
+ * 2.open mySQL connection
+ */
+ $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);
+ if ( $MYSQL_CONN == FALSE )
+ {
+ $errors[] = _DBCONNECT_ERROR;
+ return $errors;
+ }
+
+ /*
+ * 3. try to create database if needed
+ */
+ if ( DB::execute("CREATE DATABASE IF NOT EXISTS {$MYSQL_DATABASE}") === FALSE )
+ {
+ $errinfo = DB::getError();
+ $errors[] = _INST_ERROR1 . ': ' . $errinfo[2];
+ }
+
+ /*
+ * 4. try to select database
+ */
+ $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);
+ if ( !$MYSQL_CONN )
+ {
+ $errors[] = _INST_ERROR2;
+ }
+
+ if ( count($errors) > 0 )
+ {
+ return $errors;
+ }
+
+ /*
+ * 5. execute queries
+ */
+ $table_names = array(
+ 'nucleus_actionlog',
+ 'nucleus_ban',
+ 'nucleus_blog',
+ 'nucleus_category',
+ 'nucleus_comment',
+ 'nucleus_config',
+ 'nucleus_item',
+ 'nucleus_karma',
+ 'nucleus_member',
+ 'nucleus_plugin',
+ 'nucleus_skin',
+ 'nucleus_template',
+ 'nucleus_team',
+ 'nucleus_activation',
+ 'nucleus_tickets'
+ );
+
+ $prefixed_table_names = array();
+ foreach ( $table_names as $table_name )
+ {
+ $prefixed_table_names[] = $MYSQL_PREFIX . $table_name;
+ }
+
+ // table exists check
+ $result = DB::getResult('SHOW TABLES');
+ foreach ( $result as $row )
+ {
+ if ( in_array($row[0], $prefixed_table_names) )
+ {
+ $errors[] = _INST_ERROR3;
+ break;
+ }
+ }
+ if ( count($errors) > 0 )
+ {
+ return $errors;
+ }
+
+ $filename = 'install.sql';
+ $fd = fopen($filename, 'r');
+ $queries = fread($fd, filesize($filename));
+ fclose($fd);
+
+ $queries = preg_split('#(;\n|;\r)#', $queries);
+
+ foreach ( $queries as $query )
+ {
+ if ( preg_match('/\w+/', $query) )
+ {
+ if ( $MYSQL_PREFIX )
+ {
+ $query = str_replace($table_names, $prefixed_table_names, $query);
+ }
+
+ if ( DB::execute($query) === FALSE )
+ {
+ $errinfo = DB::getError();
+ $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];
+ }
+ }
+ }
+
+ /*
+ * 6. put needed records
+ */
+ /* push first post */
+ $query = "INSERT INTO %s VALUES (1, %s, %s, %s, 1, 1, %s, 0, 0, 0, 1, 0, 1)";
+ $query = sprintf($query,
+ tableName('nucleus_item'),
+ DB::quoteValue(_1ST_POST_TITLE),
+ DB::quoteValue(_1ST_POST),
+ DB::quoteValue(_1ST_POST2),
+ DB::formatDateTime()
+ );
+ if ( DB::execute($query) === FALSE )
+ {
+ $errinfo = DB::getError();
+ $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];
+ }
+
+ /* push configurations */
+ array_merge($errors, updateConfig('IndexURL', $param->IndexURL));
+ array_merge($errors, updateConfig('AdminURL', $param->AdminURL));
+ array_merge($errors, updateConfig('MediaURL', $param->MediaURL));
+ array_merge($errors, updateConfig('SkinsURL', $param->SkinsURL));
+ array_merge($errors, updateConfig('PluginURL', $param->PluginURL));
+ array_merge($errors, updateConfig('ActionURL', $param->ActionURL));
+ array_merge($errors, updateConfig('AdminEmail', $param->user_email));
+ array_merge($errors, updateConfig('SiteName', $param->blog_name));
+ array_merge($errors, updateConfig('Locale', i18n::get_current_locale()));
+
+ /* push super admin */
+ $query = "UPDATE %s SET mname = %s, mrealname = %s, mpassword = %s, memail = %s, murl = %s, madmin = 1, mcanlogin = 1 WHERE mnumber = 1";
+ $query = sprintf($query,
+ tableName('nucleus_member'),
+ DB::quoteValue($param->user_name),
+ DB::quoteValue($param->user_realname),
+ DB::quoteValue(md5($param->user_password)),
+ DB::quoteValue($param->user_email),
+ DB::quoteValue($param->IndexURL)
+ );
+ if ( DB::execute($query) === FALSE )
+ {
+ $errinfo = DB::getError();
+ $errors[] = _INST_ERROR5 . ': ' . $errinfo[2];
+ }
+
+ /* push new weblog */
+ $query = "UPDATE %s SET bname = %s, bshortname = %s, burl = %s WHERE bnumber = 1";
+ $query = sprintf($query,
+ tableName('nucleus_blog'),
+ DB::quoteValue($param->blog_name),
+ DB::quoteValue($param->blog_shortname),
+ DB::quoteValue($param->IndexURL)
+ );
+ if ( DB::execute($query) === FALSE )
+ {
+ $errinfo = DB::getError();
+ $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];
+ }
+
+ /* push default category */
+ $query = "UPDATE %s SET cname = %s, cdesc = %s WHERE catid = 1";
+ $query = sprintf($query,
+ tableName('nucleus_category'),
+ DB::quoteValue(_GENERALCAT_NAME),
+ DB::quoteValue(_GENERALCAT_DESC)
+ );
+ if ( DB::execute($query) === FALSE )
+ {
+ $errinfo = DB::getError();
+ $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];
+ }
+
+ /*
+ * 7. install default plugins and skins
+ */
+ global $aConfPlugsToInstall, $aConfSkinsToImport;
+ $aSkinErrors = array();
+ $aPlugErrors = array();
+
+ if ( (count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) )
+ {
+ include_once($DIR_LIBS . 'globalfunctions.php');
+ global $manager;
+ if ( !isset($manager) )
+ {
+ $manager = new Manager();
+ }
+
+ include_once($DIR_LIBS . 'skinie.php');
+
+ $aSkinErrors = installCustomSkins();
+ if ( count($aSkinErrors) > 0 )
+ {
+ array_merge($errors, $aSkinErrors);
+ }
+
+ $query = "SELECT sdnumber FROM %s WHERE sdname='admin/default'";
+ $query = sprintf($query, tableName('nucleus_skin_desc'));
+ $res = intval(DB::getValue($query));
+ array_merge($errors, updateConfig('AdminSkin', $res));
+
+ $query = "SELECT sdnumber FROM %s WHERE sdname='admin/bookmarklet'";
+ $query = sprintf($query, tableName('nucleus_skin_desc'));
+ $res = intval(DB::getValue($query));
+ array_merge($errors, updateConfig('BookmarkletSkin', $res));
+
+ $query = "SELECT sdnumber FROM %s WHERE sdname='default'";
+ $query = sprintf($query, tableName('nucleus_skin_desc'));
+ $defSkinID = intval(DB::getValue($query));
+
+ $query = "UPDATE %s SET bdefskin=%d WHERE bnumber=1";
+ $query = sprintf($query, tableName('nucleus_blog'), $defSkinID);
+ DB::execute($query);
+ $query = "UPDATE %s SET value=%d WHERE name='BaseSkin'";
+ $query = sprintf($query, tableName('nucleus_config'), $defSkinID);
+ DB::execute($query);
+
+ $aPlugErrors = installCustomPlugs();
+ if ( count($aPlugErrors) > 0 )
+ {
+ array_merge($errors, $aPlugErrors);
+ }
+ }
+
+ /*
+ * 8. Write config file ourselves (if possible)
+ */
+ $config_data = '<' . '?php' . "\n";
+ $config_data .= "// mySQL connection information\n";
+ $config_data .= "\$MYSQL_HOST = '" . $MYSQL_HOST . "';\n";
+ $config_data .= "\$MYSQL_USER = '" . $MYSQL_USER . "';\n";
+ $config_data .= "\$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';\n";
+ $config_data .= "\$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';\n";
+ $config_data .= "\$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';\n";
+ $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler\n";
+ $config_data .= "// default is \$MYSQL_HANDLER = array('mysql','mysql');\n";
+ $config_data .= "//\$MYSQL_HANDLER = array('mysql','mysql');\n";
+ $config_data .= "//\$MYSQL_HANDLER = array('pdo','mysql');\n";
+ $config_data .= "\$MYSQL_HANDLER = array('" . $MYSQL_HANDLER[0] . "','" . $MYSQL_HANDLER[1] . "');\n";
+ $config_data .= "\n";
+ $config_data .= "// main nucleus directory\n";
+ $config_data .= "\$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';\n";
+ $config_data .= "\n";
+ $config_data .= "// path to media dir\n";
+ $config_data .= "\$DIR_MEDIA = '" . $DIR_MEDIA . "';\n";
+ $config_data .= "\n";
+ $config_data .= "// extra skin files for imported skins\n";
+ $config_data .= "\$DIR_SKINS = '" . $DIR_SKINS . "';\n";
+ $config_data .= "\n";
+ $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but \n";
+ $config_data .= "// you can redefine them if you wish\n";
+ $config_data .= "\$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";
+ $config_data .= "\$DIR_LOCALES = \$DIR_NUCLEUS . 'locales/';\n";
+ $config_data .= "\$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n";
+ $config_data .= "\n";
+ $config_data .= "// include libs\n";
+ $config_data .= "include(\$DIR_LIBS.'globalfunctions.php');\n";
+ $config_data .= "?" . ">";
+
+ $result = false;
+ if ( @!file_exists('../config.php') || is_writable('../config.php') )
+ {
+ if ( $fp = @fopen('../config.php', 'w') )
+ {
+ $result = @fwrite($fp, $config_data, i18n::strlen($config_data));
+ fclose($fp);
+ }
+ }
+
+ if ( $result )
+ {
+ // try to change the read-only permission.
+ if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )
+ {
+ @chmod('../config.php', 0444);
+ }
+ }
+ else
+ {
+ $_SESSION['config_data'] = $config_data;
+ }
+
+ return $errors;
+}
+
+/**
+ * Confirm that you can write to the configuration file
+ * @return string error message
+ */
+function canConfigFileWritable()
+{
+ if ( @file_exists('../config.php') && @!is_writable('../config.php') )
+ {
+ // try to change the read-write permission.
+ if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )
+ {
+ @chmod('../config.php', 0666);
+ }
+
+ if ( @!is_writable('../config.php') )
+ {
+ return _INST_ERROR8;
+ }
+ }
+ return '';
+}
+
+/**
+ * To obtain the version of MySQL
+ * @return string
+ */
+function getMySqlVersion()
+{
+ global $MYSQL_HANDLER, $minimum_mysql_version, $errors;
+ // Turn on output buffer
+ // Needed to repress the output of the sql function that are
+ // not part of php (in this case the @ operator doesn't work)
+ ob_start();
+
+ // note: this piece of code is taken from phpMyAdmin
+ $conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], 'localhost', '', '');
+
+ if ( $conn )
+ {
+ $row = DB::getAttribute(PDO::ATTR_SERVER_VERSION);
+ $match = preg_split('#\.#', $row);
+ }
+ else
+ {
+ $row = @DB::getRow('SHOW VARIABLES LIKE \'version\'');
+
+ if ( $row )
+ {
+ $match = preg_split('#\.#', $row[1]);
+ }
+ else
+ {
+ $output = (function_exists('shell_exec')) ? @shell_exec('mysql -V') : '0.0.0';
+ preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
+ $match = preg_split('#\.#', $version[0]);
+
+ if ( $match[0] == '' )
+ {
+ $match = array('0', '0', '0');
+ }
+ }
+ }
+
+ @DB::disConnect();
+
+ //End and clean output buffer
+ ob_end_clean();
+
+ return implode($match, '.');
+}
+
+/**
+ * Add a table prefix if it is used
+ *
+ * @param string $input table name with prefix
+ * @return string
+ */
+function tableName($input)
+{
+ global $MYSQL_PREFIX;
+ if ( $MYSQL_PREFIX )
+ {
+ return $MYSQL_PREFIX . $input;
+ }
+ else
+ {
+ return $input;
+ }
+}
+
+/**
+ * Install custom plugins
+ */
+function installCustomPlugs()
+{
+ global $aConfPlugsToInstall, $DIR_LIBS, $manager;
+
+ $aErrors = array();
+ if ( count($aConfPlugsToInstall) == 0 )
+ {
+ return $aErrors;
+ }
+
+ $query = sprintf('SELECT * FROM %s', tableName('nucleus_plugin'));
+ $res = DB::getResult($query);
+ $numCurrent = $res->rowCount();
+
+ foreach ( $aConfPlugsToInstall as $plugName )
+ {
+ $query = sprintf('INSERT INTO %s (porder, pfile) VALUES (%d, %s)',
+ tableName('nucleus_plugin'),
+ (++$numCurrent),
+ DB::quoteValue($plugName));
+ DB::execute($query);
+
+ $manager->clearCachedInfo('installedPlugins');
+ $plugin =& $manager->getPlugin($plugName);
+ $plugin->setID($numCurrent);
+
+ if ( !$plugin )
+ {
+ $query = sprintf('DELETE FROM %s WHERE pfile = %s',
+ tableName('nucleus_plugin'),
+ DB::quoteValue($plugName));
+ DB::execute($query);
+ $numCurrent--;
+ array_push($aErrors, sprintf(_INST_ERROR9, $plugName));
+ continue;
+ }
+ $plugin->install();
+ }
+
+ $query = sprintf('DELETE FROM %s', tableName('nucleus_plugin_event'));
+ DB::execute($query);
+ $query = sprintf('SELECT pid, pfile FROM %s', tableName('nucleus_plugin'));
+ $res = DB::getResult($query);
+
+ foreach ( $res as $row )
+ {
+ $plug =& $manager->getPlugin($row['pfile']);
+
+ if ( $plug )
+ {
+ $eventList = $plug->getEventList();
+ foreach ( $eventList as $eventName )
+ {
+ $query = sprintf('INSERT INTO %s (pid, event) VALUES (%d, %s)',
+ tableName('nucleus_plugin_event'),
+ intval($row['pid']),
+ DB::quoteValue($eventName));
+ DB::execute($query);
+ }
+ }
+ }
+ return $aErrors;
+}
+
+/**
+ * Install custom skins
+ * Prepares the installation of custom skins
+ */
+function installCustomSkins()
+{
+ global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS;
+
+ $aErrors = array();
+ if ( count($aConfSkinsToImport) == 0 )
+ {
+ return $aErrors;
+ }
+
+ $importer = new SkinImport();
+
+ foreach ( $aConfSkinsToImport as $skinName )
+ {
+ $importer->reset();
+ $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml';
+
+ if ( !@file_exists($skinFile) )
+ {
+ array_push($aErrors, sprintf(_INST_ERROR10, $skinFile));
+ continue;
+ }
+
+ $error = $importer->readFile($skinFile);
+
+ if ( $error )
+ {
+ array_push($aErrors, sprintf(_INST_ERROR11, $skinName) . ' : ' . $error);
+ continue;
+ }
+
+ $error = $importer->writeToDatabase(1);
+
+ if ( $error )
+ {
+ array_push($aErrors, sprintf(_INST_ERROR12, $skinName) . ' : ' . $error);
+ continue;
+ }
+ }
+ return $aErrors;
+}
+
+/**
+ * Check if some important files of the Nucleus CMS installation are available
+ * Give an error if one or more files are not accessible
+ */
+function do_check_files()
+{
+ $missingfiles = array();
+ $files = array(
+ './install.sql',
+ '../index.php',
+ '../action.php',
+ '../nucleus/index.php',
+ '../nucleus/libs/ACTION.php',
+ '../nucleus/libs/ACTIONLOG.php',
+ '../nucleus/libs/ACTIONS.php',
+ '../nucleus/libs/ADMIN.php',
+ '../nucleus/libs/BaseActions.php',
+ '../nucleus/libs/BLOG.php',
+ '../nucleus/libs/BODYACTIONS.php',
+ '../nucleus/libs/COMMENT.php',
+ '../nucleus/libs/COMMENTACTIONS.php',
+ '../nucleus/libs/COMMENTS.php',
+ '../nucleus/libs/ENTITY.php',
+ '../nucleus/libs/globalfunctions.php',
+ '../nucleus/libs/i18n.php',
+ '../nucleus/libs/ITEM.php',
+ '../nucleus/libs/ITEMACTIONS.php',
+ '../nucleus/libs/LINK.php',
+ '../nucleus/libs/MANAGER.php',
+ '../nucleus/libs/MEDIA.php',
+ '../nucleus/libs/MEMBER.php',
+ '../nucleus/libs/NOTIFICATION.php',
+ '../nucleus/libs/PARSER.php',
+ '../nucleus/libs/PLUGIN.php',
+ '../nucleus/libs/PLUGINADMIN.php',
+ '../nucleus/libs/SEARCH.php',
+ '../nucleus/libs/showlist.php',
+ '../nucleus/libs/SKIN.php',
+ '../nucleus/libs/TEMPLATE.php',
+ '../nucleus/libs/vars4.1.0.php',
+ '../nucleus/libs/xmlrpc.inc.php',
+ '../nucleus/libs/xmlrpcs.inc.php',
+ '../nucleus/libs/sql/DB.php',
+ '../nucleus/libs/sql/MYSQLPDO.php'
+ );
+
+ $count = count($files);
+ for ( $i = 0; $i < $count; $i++ )
+ {
+ if ( !is_readable($files[$i]) )
+ {
+ array_push($missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.<br />');
+ }
+ }
+
+ if ( count($missingfiles) > 0 )
+ {
+ exit(implode("\n", $missingfiles));
+ }
+}
+
+/**
+ * Updates the configuration in the database
+ *
+ * @param string $name name of the config var
+ * @param string $value new value of the config var
+ * @return array
+ */
+function updateConfig($name, $value)
+{
+ $errors = array();
+
+ $query = "UPDATE %s SET value = %s WHERE name = %s";
+ $query = sprintf($query, tableName('nucleus_config'), DB::quoteValue(trim($value)), DB::quoteValue($name));
+
+ if ( DB::execute($query) === FALSE )
+ {
+ $errinfo = DB::getError();
+ $errors[] = _INST_ERROR4 . ': ' . $errinfo[2];
+ }
+ return $errors;
+}
+
+class ParamManager
+{
+ /* process parameter */
+ public $state;
+ public $locale;
+
+ /* mysql connection parameters */
+ public $mysql_host;
+ public $mysql_user;
+ public $mysql_password;
+ public $mysql_database;
+ public $mysql_tablePrefix;
+
+ /* weblog configuration parameters */
+ public $blog_name;
+ public $blog_shortname;
+
+ /* member configuration parameters */
+ public $user_name;
+ public $user_realname;
+ public $user_password;
+ private $user_password2;
+ public $user_email;
+
+ /* URI parameters */
+ private $root_url;
+ public $IndexURL;
+ public $AdminURL;
+ public $MediaURL;
+ public $SkinsURL;
+ public $PluginURL;
+ public $ActionURL;
+
+ /* path parameters */
+ private $root_path;
+ public $AdminPath;
+ public $MediaPath;
+ public $SkinsPath;
+
+ /**
+ * constructor
+ */
+ public function __construct()
+ {
+ $this->init();
+ }
+
+ public function init()
+ {
+ // set default values
+ $this->state = 'locale';
+ $this->install_mode = 'simple';
+ $this->locale = '';
+ $this->mysql_host = @ini_get('mysql.default_host');
+ $this->blog_name = 'My Nucleus CMS';
+ $this->blog_shortname = 'mynucleuscms';
+
+ /* root path */
+ $directory_separator = preg_quote(DIRECTORY_SEPARATOR, '|');
+ $this->root_path = implode('/', preg_split("|$directory_separator|", realpath(dirname(__FILE__) . '/..')));
+ if ( substr($this->root_path, -1, 1) !== '/' )
+ {
+ $this->root_path .= '/';
+ }
+ $base_path_pcre = preg_quote($this->root_path, '|');
+
+ /* current directry name */
+ $directory_name = preg_replace("#{$base_path_pcre}#", '', implode('/', preg_split("#{$directory_separator}#", realpath(dirname(__FILE__)))));
+ $directory_name_pcre = preg_quote($directory_name, '|');
+
+ /* root uri */
+ $root_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
+ $this->root_url = preg_replace("|$directory_name_pcre(.*)$|", '', $root_url);
+
+ $this->AdminPath = $this->root_path . 'nucleus/';
+ $this->MediaPath = $this->root_path . 'media/';
+ $this->SkinsPath = $this->root_path . 'skins/';
+
+ $this->IndexURL = $this->root_url;
+ $this->AdminURL = $this->root_url . 'nucleus/';
+ $this->MediaURL = $this->root_url . 'media/';
+ $this->SkinsURL = $this->root_url . 'skins/';
+ $this->PluginURL = $this->root_url . 'nucleus/plugins/';
+ $this->ActionURL = $this->root_url . 'action.php';
+ }
+
+ private function read_parameter($parameter)
+ {
+ foreach ( $parameter as $element )
+ {
+ if ( array_key_exists($element, $_POST) )
+ {
+ $this->$element = $_POST[$element];
+ }
+ }
+ }
+
+ public function set_state($state)
+ {
+ $states = array('locale', 'mysql', 'weblog', 'detail', 'install');
+ if ( in_array($state, $states) )
+ {
+ $this->state = $state;
+ }
+ }
+
+ public function set_locale()
+ {
+ $this->read_parameter(array('locale'));
+
+ if ( !$this->locale )
+ {
+ /**
+ * default locale select simple implementation
+ *
+ * NOTE:
+ * RFC2616: Hypertext Transfer Protocol -- HTTP/1.1
+ * http://www.ietf.org/rfc/rfc2616.txt
+ *
+ * 14.4 Accept-Language
+ *
+ * The Accept-Language request-header field is similar to Accept, but
+ * restricts the set of natural languages that are preferred as a
+ * response to the request. Language tags are defined in section 3.10.
+ *
+ * Accept-Language = "Accept-Language" ":"
+ * 1#( language-range [ ";" "q" "=" qvalue ] )
+ * language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
+ *
+ * Each language-range MAY be given an associated quality value which
+ * represents an estimate of the user's preference for the languages
+ * specified by that range. The quality value defaults to "q=1". For
+ * example,
+ *
+ * Accept-Language: da, en-gb;q=0.8, en;q=0.7
+ *
+ * would mean: "I prefer Danish, but will accept British English and
+ * other types of English." A language-range matches a language-tag if
+ * it exactly equals the tag, or if it exactly equals a prefix of the
+ * tag such that the first tag character following the prefix is "-".
+ * The special range "*", if present in the Accept-Language field,
+ * matches every tag not matched by any other range present in the
+ * Accept-Language field.
+ *
+ * TODO: this is appropriate implement or not
+ */
+ $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+
+ /* retrieve language token of language tag from first token */
+ $language = '';
+ if ( is_array($languages) && count($languages) > 0 )
+ {
+ $language = preg_replace('#^([\w]+).*$#', '$1', $languages[0]);
+ }
+
+ $locales = i18n::get_available_locale_list();
+ foreach ( $locales as $locale )
+ {
+ if ( i18n::strpos($locale, $language) === 0 )
+ {
+ $this->locale = $locale;
+ break;
+ }
+ }
+ }
+
+ /* include installer translation messages */
+ $translation_file = "./locales/{$this->locale}." . i18n::get_current_charset() . '.php';
+ if ( !file_exists($translation_file) )
+ {
+ $translation_file = './locales/en_Latn_US.UTF-8.php';
+ }
+ include($translation_file);
+
+ /* include global translation messages */
+ $translation_file = "../nucleus/locales/{$this->locale}." . i18n::get_current_charset() . '.php';
+ if ( !file_exists($translation_file) )
+ {
+ $translation_file = './locales/en_Latn_US.UTF-8.php';
+ }
+ include($translation_file);
+
+ i18n::set_current_locale($this->locale);
+
+ return;
+ }
+
+ public function check_mysql_parameters()
+ {
+ global $MYSQL_HANDLER;
+
+ $parameters = array('mysql_host', 'mysql_user', 'mysql_password', 'mysql_database', 'mysql_tablePrefix');
+ $this->read_parameter($parameters);
+
+ $errors = array();
+ if ( $this->mysql_host == '' )
+ {
+ $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD1);
+ }
+
+ if ( $this->mysql_user == '' )
+ {
+ $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD2);
+ }
+
+ if ( $this->mysql_user != ''
+ && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_user) )
+ {
+ $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD2);
+ }
+
+ if ( $this->mysql_database == '' )
+ {
+ $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD4);
+ }
+
+ if ( $this->mysql_database != ''
+ && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_database) )
+ {
+ $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD4);
+ }
+
+ if ( $this->mysql_tablePrefix != ''
+ && !preg_match('/^[a-z0-9_]+$/i', $this->mysql_tablePrefix) )
+ {
+ $errors[] = sprintf(_VALID_ERROR3, _DB_FIELD5);
+ }
+
+ if ( count($errors) == 0 )
+ {
+ $mysql_conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], $this->mysql_host, $this->mysql_user, $this->mysql_password);
+ if ( $mysql_conn == false )
+ {
+ $errors[] = _DBCONNECT_ERROR;
+ }
+ else
+ {
+ @DB::disConnect();
+ }
+ }
+
+ return $errors;
+ }
+
+ public function check_user_parameters()
+ {
+ $parameters = array('user_name', 'user_realname', 'user_password', 'user_password2', 'user_email');
+ $this->read_parameter($parameters);
+
+ $errors = array();
+ if ( $this->user_realname == '' )
+ {
+ $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD1);
+ }
+
+ if ( $this->user_name == '' )
+ {
+ $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD2);
+ }
+ elseif ( !preg_match("/^[a-z0-9]+([ a-z0-9]*[a-z0-9]+)?$/i", $this->user_name) )
+ {
+ $errors[] = _VALID_ERROR5;
+ }
+
+ if ( $this->user_password == '' || $this->user_password2 == '' )
+ {
+ $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD3);
+ $this->user_password = '';
+ }
+ elseif ( $this->user_password != $this->user_password2 )
+ {
+ $errors[] = _VALID_ERROR6;
+ $this->user_password = '';
+ }
+
+ if ( !preg_match("/^[a-z0-9\._+\-]+@[a-z0-9\._\-]+\.[a-z]{2,6}$/i", $this->user_email) )
+ {
+ $errors[] = _VALID_ERROR7;
+ }
+
+ return $errors;
+ }
+
+ public function check_weblog_parameters()
+ {
+ $parameters = array('blog_name', 'blog_shortname');
+ $this->read_parameter($parameters);
+
+ $errors = array();
+ if ( $this->blog_name == '' )
+ {
+ $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD1);
+ }
+
+ if ( $this->blog_shortname == '' )
+ {
+ $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD2);
+ }
+
+ if ( !preg_match("/^[a-z0-9]+$/i", $this->blog_shortname) )
+ {
+ $errors[] = _VALID_ERROR4;
+ }
+
+ return $errors;
+ }
+
+ public function check_uri_parameters()
+ {
+ $parameters = array('IndexURL', 'AdminURL', 'MediaURL', 'SkinsURL', 'PluginURL', 'ActionURL');
+ $this->read_parameter($parameters);
+
+ $errors = array();
+ if ( substr($this->IndexURL, -1, 1) !== '/' )
+ {
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD1);
+ }
+
+ if ( substr($this->AdminURL, -1, 1) !== '/' )
+ {
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD2);
+ }
+
+ if ( substr($this->MediaURL, -1, 1) !== '/' )
+ {
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD4);
+ }
+
+ if ( substr($this->SkinsURL, -1, 1) !== '/' )
+ {
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD6);
+ }
+
+ if ( substr($this->PluginURL, -1, 1) !== '/' )
+ {
+ $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD8);
+ }
+
+ if ( strrchr($this->ActionURL, '/') != '/action.php' )
+ {
+ $errors[] = sprintf(_VALID_ERROR9, _PATH_FIELD9);
+ }
+
+ return $errors;
+ }
+
+ public function check_path_parameters()
+ {
+ $parameters = array('AdminPath', 'MediaPath', 'SkinsPath');
+ $this->read_parameter($parameters);
+
+ $separators = array('/', DIRECTORY_SEPARATOR);
+ $errors = array();
+ if ( !in_array(substr($this->AdminPath, -1, 1), $separators) )
+ {
+ $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD3);
+ }
+ elseif ( !file_exists($this->AdminPath) )
+ {
+ $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD3);
+ }
+
+ if ( !in_array(substr($this->MediaPath, -1, 1), $separators) )
+ {
+ $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD5);
+ }
+ elseif ( !file_exists($this->MediaPath) )
+ {
+ $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD5);
+ }
+
+ if ( !in_array(substr($this->SkinsPath, -1, 1), $separators) )
+ {
+ $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD7);
+ }
+ elseif ( !file_exists($this->SkinsPath) )
+ {
+ $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD7);
+ }
+
+ return $errors;
+ }
+
+ /**
+ * check all parameters
+ * @return bool
+ */
+ public function check_all_parameters()
+ {
+ $this->set_locale();
+
+ $isValid = true;
+ $isValid &= (count($this->check_mysql_parameters()) == 0);
+ $isValid &= (count($this->check_user_parameters()) == 0);
+ $isValid &= (count($this->check_weblog_parameters()) == 0);
+ $isValid &= (count($this->check_uri_parameters()) == 0);
+ $isValid &= (count($this->check_path_parameters()) == 0);
+
+ return $isValid;
+ }
+}
-CREATE TABLE nucleus_actionlog (\r
- timestamp datetime NOT NULL default '0000-00-00 00:00:00',\r
- message varchar(255) NOT NULL default ''\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_activation (\r
- vkey varchar(40) NOT NULL default '',\r
- vtime datetime NOT NULL default '0000-00-00 00:00:00',\r
- vmember int(11) NOT NULL default '0',\r
- vtype varchar(15) NOT NULL default '',\r
- vextra varchar(128) NOT NULL default '',\r
- PRIMARY KEY (vkey)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_ban (\r
- iprange varchar(15) NOT NULL default '',\r
- reason varchar(255) NOT NULL default '',\r
- blogid int(11) NOT NULL default '0'\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_blog (\r
- bnumber int(11) NOT NULL auto_increment,\r
- bname varchar(60) NOT NULL default '',\r
- bshortname varchar(15) NOT NULL default '',\r
- bdesc varchar(200) default NULL,\r
- bcomments tinyint(2) NOT NULL default '1',\r
- bmaxcomments int(11) NOT NULL default '0',\r
- btimeoffset decimal(3,1) NOT NULL default '0.0',\r
- bnotify varchar(128) default NULL,\r
- burl varchar(100) default NULL,\r
- bupdate varchar(60) default NULL,\r
- bdefskin int(11) NOT NULL default '1',\r
- bpublic tinyint(2) NOT NULL default '1',\r
- bconvertbreaks tinyint(2) NOT NULL default '1',\r
- bdefcat int(11) default NULL,\r
- bnotifytype int(11) NOT NULL default '15',\r
- ballowpast tinyint(2) NOT NULL default '0',\r
- bincludesearch tinyint(2) NOT NULL default '0',\r
- breqemail TINYINT( 2 ) DEFAULT '0' NOT NULL,\r
- bfuturepost TINYINT(2) DEFAULT '0' NOT NULL,\r
- PRIMARY KEY (bnumber),\r
--- UNIQUE KEY bnumber (bnumber),\r
- UNIQUE KEY bshortname (bshortname)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-INSERT INTO nucleus_blog VALUES (1, 'My Nucleus CMS', 'mynucleuscms', '', 1, 0, 0.0, '', 'http://localhost:8080/nucleus/', '', 5, 1, 1, 1, 1, 1, 0, 0, 0);\r
-\r
-CREATE TABLE nucleus_category (\r
- catid int(11) NOT NULL auto_increment,\r
- cblog int(11) NOT NULL default '0',\r
- cname varchar(200) default NULL,\r
- cdesc varchar(200) default NULL,\r
- PRIMARY KEY (catid)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-INSERT INTO nucleus_category VALUES (1, 1, 'General', 'Items that do not fit in other categories');\r
-\r
-CREATE TABLE nucleus_comment (\r
- cnumber int(11) NOT NULL auto_increment,\r
- cbody text NOT NULL,\r
- cuser varchar(40) default NULL,\r
- cmail varchar(100) default NULL,\r
- cemail VARCHAR( 100 ),\r
- cmember int(11) default NULL,\r
- citem int(11) NOT NULL default '0',\r
- ctime datetime NOT NULL default '0000-00-00 00:00:00',\r
- chost varchar(60) default NULL,\r
- cip varchar(15) NOT NULL default '',\r
- cblog int(11) NOT NULL default '0',\r
- PRIMARY KEY (cnumber),\r
--- UNIQUE KEY cnumber (cnumber),\r
- KEY citem (citem),\r
- FULLTEXT KEY cbody (cbody),\r
- INDEX cblog (cblog)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_config (\r
- name varchar(20) NOT NULL default '',\r
- value varchar(128) default NULL,\r
- PRIMARY KEY (name)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-INSERT INTO nucleus_config VALUES ('DefaultBlog', '1');\r
-INSERT INTO nucleus_config VALUES ('AdminEmail', 'example@example.org');\r
-INSERT INTO nucleus_config VALUES ('IndexURL', 'http://localhost:8080/nucleus/');\r
-INSERT INTO nucleus_config VALUES ('Locale', 'en_Latn_US');\r
-INSERT INTO nucleus_config VALUES ('SessionCookie', '');\r
-INSERT INTO nucleus_config VALUES ('AllowMemberCreate', '');\r
-INSERT INTO nucleus_config VALUES ('AllowMemberMail', '1');\r
-INSERT INTO nucleus_config VALUES ('SiteName', 'My Nucleus CMS');\r
-INSERT INTO nucleus_config VALUES ('AdminURL', 'http://localhost:8080/nucleus/nucleus/');\r
-INSERT INTO nucleus_config VALUES ('NewMemberCanLogon', '1');\r
-INSERT INTO nucleus_config VALUES ('DisableSite', '');\r
-INSERT INTO nucleus_config VALUES ('DisableSiteURL', 'http://www.this-page-intentionally-left-blank.org/');\r
-INSERT INTO nucleus_config VALUES ('LastVisit', '');\r
-INSERT INTO nucleus_config VALUES ('MediaURL', 'http://localhost:8080/nucleus/media/');\r
-INSERT INTO nucleus_config VALUES ('AllowedTypes', 'jpg,jpeg,gif,mpg,mpeg,avi,mov,mp3,swf,png');\r
-INSERT INTO nucleus_config VALUES ('AllowLoginEdit', '');\r
-INSERT INTO nucleus_config VALUES ('AllowUpload', '1');\r
-INSERT INTO nucleus_config VALUES ('DisableJsTools', '2');\r
-INSERT INTO nucleus_config VALUES ('CookiePath', '/');\r
-INSERT INTO nucleus_config VALUES ('CookieDomain', '');\r
-INSERT INTO nucleus_config VALUES ('CookieSecure', '');\r
-INSERT INTO nucleus_config VALUES ('CookiePrefix', '');\r
-INSERT INTO nucleus_config VALUES ('MediaPrefix', '1');\r
-INSERT INTO nucleus_config VALUES ('MaxUploadSize', '1048576');\r
-INSERT INTO nucleus_config VALUES ('NonmemberMail', '');\r
-INSERT INTO nucleus_config VALUES ('PluginURL', 'http://localhost:8080/nucleus/nucleus/plugins/');\r
-INSERT INTO nucleus_config VALUES ('ProtectMemNames', '1');\r
-INSERT INTO nucleus_config VALUES ('BaseSkin', '5');\r
-INSERT INTO nucleus_config VALUES ('SkinsURL', 'http://localhost:8080/nucleus/skins/');\r
-INSERT INTO nucleus_config VALUES ('ActionURL', 'http://localhost:8080/nucleus/action.php');\r
-INSERT INTO nucleus_config VALUES ('URLMode', 'normal');\r
-INSERT INTO nucleus_config VALUES ('DatabaseVersion', '350');\r
-INSERT INTO nucleus_config VALUES ('DebugVars', '0');\r
-INSERT INTO nucleus_config VALUES ('DefaultListSize', '10');\r
-INSERT INTO nucleus_config VALUES ('AdminCSS', 'original');\r
-INSERT INTO nucleus_config VALUES ('AdminSkin', '0');\r
-INSERT INTO nucleus_config VALUES ('BookmarkletSkin', '0');\r
-\r
-CREATE TABLE nucleus_item (\r
- inumber int(11) NOT NULL auto_increment,\r
- ititle varchar(160) default NULL,\r
- ibody text NOT NULL,\r
- imore text,\r
- iblog int(11) NOT NULL default '0',\r
- iauthor int(11) NOT NULL default '0',\r
- itime datetime NOT NULL default '0000-00-00 00:00:00',\r
- iclosed tinyint(2) NOT NULL default '0',\r
- idraft tinyint(2) NOT NULL default '0',\r
- ikarmapos int(11) NOT NULL default '0',\r
- icat int(11) default NULL,\r
- ikarmaneg int(11) NOT NULL default '0',\r
- iposted tinyint(2) NOT NULL default '1',\r
- PRIMARY KEY (inumber),\r
--- UNIQUE KEY inumber (inumber),\r
- KEY itime (itime),\r
- INDEX iblog (iblog),\r
- INDEX idraft (idraft),\r
- INDEX icat (icat),\r
- FULLTEXT KEY ibody (ibody,ititle,imore)\r
-) ENGINE=MyISAM PACK_KEYS=0 DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_karma (\r
- itemid int(11) NOT NULL default '0',\r
- ip char(15) NOT NULL default ''\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_member (\r
- mnumber int(11) NOT NULL auto_increment,\r
- mname varchar(32) NOT NULL default '',\r
- mrealname varchar(60) default NULL,\r
- mpassword varchar(40) NOT NULL default '',\r
- memail varchar(60) default NULL,\r
- murl varchar(100) default NULL,\r
- mnotes varchar(100) default NULL,\r
- madmin tinyint(2) NOT NULL default '0',\r
- mcanlogin tinyint(2) NOT NULL default '1',\r
- mcookiekey varchar(40) default NULL,\r
- mlocale varchar(20) NOT NULL default '',\r
- mautosave tinyint(2) NOT NULL default '1',\r
- madminskin tinyint(2) NOT NULL default '0',\r
- mbkmklt tinyint(2) NOT NULL default '0',\r
- PRIMARY KEY (mnumber),\r
--- UNIQUE KEY mnumber (mnumber),\r
- UNIQUE KEY mname (mname)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-INSERT INTO nucleus_member VALUES (1, 'example', 'example', '1a79a4d60de6718e8e5b326e338ae533', 'example@example.org', 'http://localhost:8080/nucleus/', '', 1, 1, 'd767aefc60415859570d64c649257f19', '', 1, 0, 0);\r
-\r
-CREATE TABLE nucleus_plugin (\r
- pid int(11) NOT NULL auto_increment,\r
- pfile varchar(40) NOT NULL default '',\r
- porder int(11) NOT NULL default '0',\r
- PRIMARY KEY (pid),\r
--- KEY pid (pid),\r
- KEY porder (porder)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_plugin_event (\r
- pid int(11) NOT NULL default '0',\r
- event varchar(40) default NULL,\r
- KEY pid (pid)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_plugin_option (\r
- ovalue text NOT NULL,\r
- oid int(11) NOT NULL auto_increment,\r
- ocontextid int(11) NOT NULL default '0',\r
- PRIMARY KEY (oid,ocontextid)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_plugin_option_desc (\r
- oid int(11) NOT NULL auto_increment,\r
- opid int(11) NOT NULL default '0',\r
- oname varchar(20) NOT NULL default '',\r
- ocontext varchar(20) NOT NULL default '',\r
- odesc varchar(255) default NULL,\r
- otype varchar(20) default NULL,\r
- odef text,\r
- oextra text,\r
- PRIMARY KEY (opid,oname,ocontext),\r
- UNIQUE KEY oid (oid)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-CREATE TABLE nucleus_skin (\r
- sdesc int(11) NOT NULL default '0',\r
- stype varchar(20) NOT NULL default '',\r
- scontent text NOT NULL,\r
- PRIMARY KEY (sdesc,stype)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- INSERT INTO nucleus_skin VALUES (2, 'index', '<?xml version=\"1.0\" encoding=\"<%charset%>\"?>\n\n<feed xml:lang=\"en-us\" xmlns=\"http://www.w3.org/2005/Atom\">\n <title><%blogsetting(name)%></title>\n <id><%blogsetting(url)%>:<%blogsetting(id)%></id>\n\n <link rel=\"alternate\" type=\"text/html\" href=\"<%blogsetting(url)%>\" />\n <link rel=\"self\" type=\"application/atom+xml\" href=\"<%blogsetting(url)%><%self%>\" />\n <generator uri=\"http://nucleuscms.org/\"><%version%></generator>\n <updated><%blog(feeds/atom/modified,1)%></updated>\n\n <%blog(feeds/atom/entries,10)%>\n</feed>');\r
--- INSERT INTO nucleus_skin VALUES (4, 'index', '<?xml version="1.0"?>\r\n<rsd version="1.0">\r\n <service>\r\n <engineName><%version%></engineName>\r\n <engineLink>http://nucleuscms.org/</engineLink>\r\n <homepageLink><%sitevar(url)%></homepageLink>\r\n <apis>\r\n <api name="MetaWeblog" preferred="true" apiLink="<%adminurl%>xmlrpc/server.php" blogID="<%blogsetting(id)%>">\r\n <docs>http://nucleuscms.org/documentation/devdocs/xmlrpc.html</docs>\r\n </api>\r\n <api name="Blogger" preferred="false" apiLink="<%adminurl%>xmlrpc/server.php" blogID="<%blogsetting(id)%>">\r\n <docs>http://nucleuscms.org/documentation/devdocs/xmlrpc.html</docs>\r\n </api>\r\n </apis>\r\n </service>\r\n</rsd>');\r
--- INSERT INTO nucleus_skin VALUES (3, 'index', '<?xml version="1.0" encoding="<%charset%>"?>\r\n<rss version="2.0">\r\n <channel>\r\n <title><%blogsetting(name)%></title>\r\n <link><%blogsetting(url)%></link>\r\n <description><%blogsetting(desc)%></description>\r\n <language>en-us</language> \r\n <generator><%version%></generator>\r\n <copyright>?</copyright> \r\n <category>Weblog</category>\r\n <docs>http://backend.userland.com/rss</docs>\r\n <image>\r\n <url><%blogsetting(url)%>/nucleus/nucleus2.gif</url>\r\n <title><%blogsetting(name)%></title>\r\n <link><%blogsetting(url)%></link>\r\n </image>\r\n <%blog(feeds/rss20,10)%>\r\n </channel>\r\n</rss>');\r
-\r
-CREATE TABLE nucleus_skin_desc (\r
- sdnumber int(11) NOT NULL auto_increment,\r
- sdname varchar(20) NOT NULL default '',\r
- sddesc varchar(200) default NULL,\r
- sdtype varchar(40) NOT NULL default 'text/html',\r
- sdincmode varchar(10) NOT NULL default 'normal',\r
- sdincpref varchar(50) NOT NULL default '',\r
- PRIMARY KEY (sdnumber),\r
--- UNIQUE KEY sdnumber (sdnumber),\r
- UNIQUE KEY sdname (sdname)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- INSERT INTO nucleus_skin_desc VALUES (2, 'feeds/atom', 'Atom 1.0 weblog syndication', 'application/atom+xml', 'normal', '');\r
--- INSERT INTO nucleus_skin_desc VALUES (3, 'feeds/rss20', 'RSS 2.0 syndication of weblogs', 'text/xml', 'normal', '');\r
--- INSERT INTO nucleus_skin_desc VALUES (4, 'xml/rsd', 'RSD (Really Simple Discovery) information for weblog clients', 'text/xml', 'normal', '');\r
--- INSERT INTO nucleus_skin_desc VALUES (5, 'default', 'Nucleus CMS default skin', 'text/html', 'skindir', 'default/');\r
-\r
-CREATE TABLE nucleus_team (\r
- tmember int(11) NOT NULL default '0',\r
- tblog int(11) NOT NULL default '0',\r
- tadmin tinyint(2) NOT NULL default '0',\r
- PRIMARY KEY (tmember,tblog)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
-INSERT INTO nucleus_team VALUES (1, 1, 1);\r
-\r
-CREATE TABLE nucleus_template (\r
- tdesc int(11) NOT NULL default '0',\r
- tpartname varchar(64) NOT NULL default '',\r
- tcontent text NOT NULL,\r
- PRIMARY KEY (tdesc,tpartname)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- INSERT INTO nucleus_template VALUES (3, 'ITEM', '<item>\r\n <title><%title(xml)%></title>\r\n <link><%blogurl%>index.php?itemid=<%itemid%></link>\r\n<description><![CDATA[<%body%><%more%>]]></description>\r\n <category><%category%></category>\r\n<comments><%blogurl%>index.php?itemid=<%itemid%></comments>\r\n <pubDate><%date(rfc822)%></pubDate>\r\n</item>');\r
--- INSERT INTO nucleus_template VALUES (3, 'EDITLINK', '<a href="<%editlink%>" onclick="<%editpopupcode%>">edit</a>');\r
--- INSERT INTO nucleus_template VALUES (3, 'FORMAT_DATE', '%x');\r
--- INSERT INTO nucleus_template VALUES (3, 'FORMAT_TIME', '%X');\r
--- INSERT INTO nucleus_template VALUES (4, 'ITEM', '<%date(utc)%>');\r
--- INSERT INTO nucleus_template VALUES (5, 'ITEM', '<entry>\n <title type=\"html\"><![CDATA[<%title%>]]></title>\n <link rel=\"alternate\" type=\"text/html\" href=\"<%blogurl%>index.php?itemid=<%itemid%>\" />\n <author>\n <name><%author%></name>\n </author>\n <updated><%date(utc)%></updated>\n <published><%date(iso8601)%></published>\n <content type=\"html\"><![CDATA[<%body%><%more%>]]></content>\n <id><%blogurl%>:<%blogid%>:<%itemid%></id>\n</entry>');\r
--- INSERT INTO nucleus_template VALUES (5, 'POPUP_CODE', '<%media%>');\r
--- INSERT INTO nucleus_template VALUES (5, 'IMAGE_CODE', '<%image%>');\r
--- INSERT INTO nucleus_template VALUES (5, 'MEDIA_CODE', '<%media%>');\r
--- INSERT INTO nucleus_template VALUES (3, 'POPUP_CODE', '<%image%>');\r
--- INSERT INTO nucleus_template VALUES (3, 'MEDIA_CODE', '<%media%>');\r
--- INSERT INTO nucleus_template VALUES (3, 'IMAGE_CODE', '<%media%>');\r
-\r
-CREATE TABLE nucleus_template_desc (\r
- tdnumber int(11) NOT NULL auto_increment,\r
- tdname varchar(64) NOT NULL default '',\r
- tddesc varchar(200) default NULL,\r
- PRIMARY KEY (tdnumber),\r
--- UNIQUE KEY tdnumber (tdnumber),\r
- UNIQUE KEY tdname (tdname)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
-\r
--- INSERT INTO nucleus_template_desc VALUES (4, 'feeds/atom/modified', 'Atom feeds: Inserts last modification date');\r
--- INSERT INTO nucleus_template_desc VALUES (5, 'feeds/atom/entries', 'Atom feeds: Feed items');\r
--- INSERT INTO nucleus_template_desc VALUES (3, 'feeds/rss20', 'Used for RSS 2.0 syndication of your blog');\r
--- INSERT INTO nucleus_template_desc VALUES (8, 'default/index', 'Nucleus CMS default index template');\r
--- INSERT INTO nucleus_template_desc VALUES (9, 'default/item', 'Nucleus CMS default item template');\r
-\r
-CREATE TABLE nucleus_tickets (\r
- ticket varchar(40) NOT NULL default '',\r
- ctime datetime NOT NULL default '0000-00-00 00:00:00',\r
- member int(11) NOT NULL default '0',\r
- PRIMARY KEY (ticket,member)\r
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;\r
+CREATE TABLE nucleus_actionlog (
+ timestamp datetime NOT NULL default '0000-00-00 00:00:00',
+ message varchar(255) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_activation (
+ vkey varchar(40) NOT NULL default '',
+ vtime datetime NOT NULL default '0000-00-00 00:00:00',
+ vmember int(11) NOT NULL default '0',
+ vtype varchar(15) NOT NULL default '',
+ vextra varchar(128) NOT NULL default '',
+ PRIMARY KEY (vkey)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_ban (
+ iprange varchar(15) NOT NULL default '',
+ reason varchar(255) NOT NULL default '',
+ blogid int(11) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_blog (
+ bnumber int(11) NOT NULL auto_increment,
+ bname varchar(60) NOT NULL default '',
+ bshortname varchar(15) NOT NULL default '',
+ bdesc varchar(200) default NULL,
+ bcomments tinyint(2) NOT NULL default '1',
+ bmaxcomments int(11) NOT NULL default '0',
+ btimeoffset decimal(3,1) NOT NULL default '0.0',
+ bnotify varchar(128) default NULL,
+ burl varchar(100) default NULL,
+ bupdate varchar(60) default NULL,
+ bdefskin int(11) NOT NULL default '1',
+ bpublic tinyint(2) NOT NULL default '1',
+ bconvertbreaks tinyint(2) NOT NULL default '1',
+ bdefcat int(11) default NULL,
+ bnotifytype int(11) NOT NULL default '15',
+ ballowpast tinyint(2) NOT NULL default '0',
+ bincludesearch tinyint(2) NOT NULL default '0',
+ breqemail TINYINT( 2 ) DEFAULT '0' NOT NULL,
+ bfuturepost TINYINT(2) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (bnumber),
+-- UNIQUE KEY bnumber (bnumber),
+ UNIQUE KEY bshortname (bshortname)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO nucleus_blog VALUES (1, 'My Nucleus CMS', 'mynucleuscms', '', 1, 0, 0.0, '', 'http://localhost:8080/nucleus/', '', 5, 1, 1, 1, 1, 1, 0, 0, 0);
+
+CREATE TABLE nucleus_category (
+ catid int(11) NOT NULL auto_increment,
+ cblog int(11) NOT NULL default '0',
+ cname varchar(200) default NULL,
+ cdesc varchar(200) default NULL,
+ PRIMARY KEY (catid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO nucleus_category VALUES (1, 1, 'General', 'Items that do not fit in other categories');
+
+CREATE TABLE nucleus_comment (
+ cnumber int(11) NOT NULL auto_increment,
+ cbody text NOT NULL,
+ cuser varchar(40) default NULL,
+ cmail varchar(100) default NULL,
+ cemail VARCHAR( 100 ),
+ cmember int(11) default NULL,
+ citem int(11) NOT NULL default '0',
+ ctime datetime NOT NULL default '0000-00-00 00:00:00',
+ chost varchar(60) default NULL,
+ cip varchar(15) NOT NULL default '',
+ cblog int(11) NOT NULL default '0',
+ PRIMARY KEY (cnumber),
+-- UNIQUE KEY cnumber (cnumber),
+ KEY citem (citem),
+ FULLTEXT KEY cbody (cbody),
+ INDEX cblog (cblog)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_config (
+ name varchar(20) NOT NULL default '',
+ value varchar(128) default NULL,
+ PRIMARY KEY (name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO nucleus_config VALUES ('DefaultBlog', '1');
+INSERT INTO nucleus_config VALUES ('AdminEmail', 'example@example.org');
+INSERT INTO nucleus_config VALUES ('IndexURL', 'http://localhost:8080/nucleus/');
+INSERT INTO nucleus_config VALUES ('Locale', 'en_Latn_US');
+INSERT INTO nucleus_config VALUES ('SessionCookie', '');
+INSERT INTO nucleus_config VALUES ('AllowMemberCreate', '');
+INSERT INTO nucleus_config VALUES ('AllowMemberMail', '1');
+INSERT INTO nucleus_config VALUES ('SiteName', 'My Nucleus CMS');
+INSERT INTO nucleus_config VALUES ('AdminURL', 'http://localhost:8080/nucleus/nucleus/');
+INSERT INTO nucleus_config VALUES ('NewMemberCanLogon', '1');
+INSERT INTO nucleus_config VALUES ('DisableSite', '');
+INSERT INTO nucleus_config VALUES ('DisableSiteURL', 'http://www.this-page-intentionally-left-blank.org/');
+INSERT INTO nucleus_config VALUES ('LastVisit', '');
+INSERT INTO nucleus_config VALUES ('MediaURL', 'http://localhost:8080/nucleus/media/');
+INSERT INTO nucleus_config VALUES ('AllowedTypes', 'jpg,jpeg,gif,mpg,mpeg,avi,mov,mp3,swf,png');
+INSERT INTO nucleus_config VALUES ('AllowLoginEdit', '');
+INSERT INTO nucleus_config VALUES ('AllowUpload', '1');
+INSERT INTO nucleus_config VALUES ('DisableJsTools', '2');
+INSERT INTO nucleus_config VALUES ('CookiePath', '/');
+INSERT INTO nucleus_config VALUES ('CookieDomain', '');
+INSERT INTO nucleus_config VALUES ('CookieSecure', '');
+INSERT INTO nucleus_config VALUES ('CookiePrefix', '');
+INSERT INTO nucleus_config VALUES ('MediaPrefix', '1');
+INSERT INTO nucleus_config VALUES ('MaxUploadSize', '1048576');
+INSERT INTO nucleus_config VALUES ('NonmemberMail', '');
+INSERT INTO nucleus_config VALUES ('PluginURL', 'http://localhost:8080/nucleus/nucleus/plugins/');
+INSERT INTO nucleus_config VALUES ('ProtectMemNames', '1');
+INSERT INTO nucleus_config VALUES ('BaseSkin', '5');
+INSERT INTO nucleus_config VALUES ('SkinsURL', 'http://localhost:8080/nucleus/skins/');
+INSERT INTO nucleus_config VALUES ('ActionURL', 'http://localhost:8080/nucleus/action.php');
+INSERT INTO nucleus_config VALUES ('URLMode', 'normal');
+INSERT INTO nucleus_config VALUES ('DatabaseVersion', '350');
+INSERT INTO nucleus_config VALUES ('DebugVars', '0');
+INSERT INTO nucleus_config VALUES ('DefaultListSize', '10');
+INSERT INTO nucleus_config VALUES ('AdminCSS', 'original');
+INSERT INTO nucleus_config VALUES ('AdminSkin', '0');
+INSERT INTO nucleus_config VALUES ('BookmarkletSkin', '0');
+
+CREATE TABLE nucleus_item (
+ inumber int(11) NOT NULL auto_increment,
+ ititle varchar(160) default NULL,
+ ibody text NOT NULL,
+ imore text,
+ iblog int(11) NOT NULL default '0',
+ iauthor int(11) NOT NULL default '0',
+ itime datetime NOT NULL default '0000-00-00 00:00:00',
+ iclosed tinyint(2) NOT NULL default '0',
+ idraft tinyint(2) NOT NULL default '0',
+ ikarmapos int(11) NOT NULL default '0',
+ icat int(11) default NULL,
+ ikarmaneg int(11) NOT NULL default '0',
+ iposted tinyint(2) NOT NULL default '1',
+ PRIMARY KEY (inumber),
+-- UNIQUE KEY inumber (inumber),
+ KEY itime (itime),
+ INDEX iblog (iblog),
+ INDEX idraft (idraft),
+ INDEX icat (icat),
+ FULLTEXT KEY ibody (ibody,ititle,imore)
+) ENGINE=MyISAM PACK_KEYS=0 DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_karma (
+ itemid int(11) NOT NULL default '0',
+ ip char(15) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_member (
+ mnumber int(11) NOT NULL auto_increment,
+ mname varchar(32) NOT NULL default '',
+ mrealname varchar(60) default NULL,
+ mpassword varchar(40) NOT NULL default '',
+ memail varchar(60) default NULL,
+ murl varchar(100) default NULL,
+ mnotes varchar(100) default NULL,
+ madmin tinyint(2) NOT NULL default '0',
+ mcanlogin tinyint(2) NOT NULL default '1',
+ mcookiekey varchar(40) default NULL,
+ mlocale varchar(20) NOT NULL default '',
+ mautosave tinyint(2) NOT NULL default '1',
+ madminskin tinyint(2) NOT NULL default '0',
+ mbkmklt tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (mnumber),
+-- UNIQUE KEY mnumber (mnumber),
+ UNIQUE KEY mname (mname)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO nucleus_member VALUES (1, 'example', 'example', '1a79a4d60de6718e8e5b326e338ae533', 'example@example.org', 'http://localhost:8080/nucleus/', '', 1, 1, 'd767aefc60415859570d64c649257f19', '', 1, 0, 0);
+
+CREATE TABLE nucleus_plugin (
+ pid int(11) NOT NULL auto_increment,
+ pfile varchar(40) NOT NULL default '',
+ porder int(11) NOT NULL default '0',
+ PRIMARY KEY (pid),
+-- KEY pid (pid),
+ KEY porder (porder)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_plugin_event (
+ pid int(11) NOT NULL default '0',
+ event varchar(40) default NULL,
+ KEY pid (pid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_plugin_option (
+ ovalue text NOT NULL,
+ oid int(11) NOT NULL auto_increment,
+ ocontextid int(11) NOT NULL default '0',
+ PRIMARY KEY (oid,ocontextid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_plugin_option_desc (
+ oid int(11) NOT NULL auto_increment,
+ opid int(11) NOT NULL default '0',
+ oname varchar(20) NOT NULL default '',
+ ocontext varchar(20) NOT NULL default '',
+ odesc varchar(255) default NULL,
+ otype varchar(20) default NULL,
+ odef text,
+ oextra text,
+ PRIMARY KEY (opid,oname,ocontext),
+ UNIQUE KEY oid (oid)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE nucleus_skin (
+ sdesc int(11) NOT NULL default '0',
+ stype varchar(20) NOT NULL default '',
+ scontent text NOT NULL,
+ PRIMARY KEY (sdesc,stype)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- INSERT INTO nucleus_skin VALUES (2, 'index', '<?xml version=\"1.0\" encoding=\"<%charset%>\"?>\n\n<feed xml:lang=\"en-us\" xmlns=\"http://www.w3.org/2005/Atom\">\n <title><%blogsetting(name)%></title>\n <id><%blogsetting(url)%>:<%blogsetting(id)%></id>\n\n <link rel=\"alternate\" type=\"text/html\" href=\"<%blogsetting(url)%>\" />\n <link rel=\"self\" type=\"application/atom+xml\" href=\"<%blogsetting(url)%><%self%>\" />\n <generator uri=\"http://nucleuscms.org/\"><%version%></generator>\n <updated><%blog(feeds/atom/modified,1)%></updated>\n\n <%blog(feeds/atom/entries,10)%>\n</feed>');
+-- INSERT INTO nucleus_skin VALUES (4, 'index', '<?xml version="1.0"?>\r\n<rsd version="1.0">\r\n <service>\r\n <engineName><%version%></engineName>\r\n <engineLink>http://nucleuscms.org/</engineLink>\r\n <homepageLink><%sitevar(url)%></homepageLink>\r\n <apis>\r\n <api name="MetaWeblog" preferred="true" apiLink="<%adminurl%>xmlrpc/server.php" blogID="<%blogsetting(id)%>">\r\n <docs>http://nucleuscms.org/documentation/devdocs/xmlrpc.html</docs>\r\n </api>\r\n <api name="Blogger" preferred="false" apiLink="<%adminurl%>xmlrpc/server.php" blogID="<%blogsetting(id)%>">\r\n <docs>http://nucleuscms.org/documentation/devdocs/xmlrpc.html</docs>\r\n </api>\r\n </apis>\r\n </service>\r\n</rsd>');
+-- INSERT INTO nucleus_skin VALUES (3, 'index', '<?xml version="1.0" encoding="<%charset%>"?>\r\n<rss version="2.0">\r\n <channel>\r\n <title><%blogsetting(name)%></title>\r\n <link><%blogsetting(url)%></link>\r\n <description><%blogsetting(desc)%></description>\r\n <language>en-us</language> \r\n <generator><%version%></generator>\r\n <copyright>?</copyright> \r\n <category>Weblog</category>\r\n <docs>http://backend.userland.com/rss</docs>\r\n <image>\r\n <url><%blogsetting(url)%>/nucleus/nucleus2.gif</url>\r\n <title><%blogsetting(name)%></title>\r\n <link><%blogsetting(url)%></link>\r\n </image>\r\n <%blog(feeds/rss20,10)%>\r\n </channel>\r\n</rss>');
+
+CREATE TABLE nucleus_skin_desc (
+ sdnumber int(11) NOT NULL auto_increment,
+ sdname varchar(20) NOT NULL default '',
+ sddesc varchar(200) default NULL,
+ sdtype varchar(40) NOT NULL default 'text/html',
+ sdincmode varchar(10) NOT NULL default 'normal',
+ sdincpref varchar(50) NOT NULL default '',
+ PRIMARY KEY (sdnumber),
+-- UNIQUE KEY sdnumber (sdnumber),
+ UNIQUE KEY sdname (sdname)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- INSERT INTO nucleus_skin_desc VALUES (2, 'feeds/atom', 'Atom 1.0 weblog syndication', 'application/atom+xml', 'normal', '');
+-- INSERT INTO nucleus_skin_desc VALUES (3, 'feeds/rss20', 'RSS 2.0 syndication of weblogs', 'text/xml', 'normal', '');
+-- INSERT INTO nucleus_skin_desc VALUES (4, 'xml/rsd', 'RSD (Really Simple Discovery) information for weblog clients', 'text/xml', 'normal', '');
+-- INSERT INTO nucleus_skin_desc VALUES (5, 'default', 'Nucleus CMS default skin', 'text/html', 'skindir', 'default/');
+
+CREATE TABLE nucleus_team (
+ tmember int(11) NOT NULL default '0',
+ tblog int(11) NOT NULL default '0',
+ tadmin tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (tmember,tblog)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO nucleus_team VALUES (1, 1, 1);
+
+CREATE TABLE nucleus_template (
+ tdesc int(11) NOT NULL default '0',
+ tpartname varchar(64) NOT NULL default '',
+ tcontent text NOT NULL,
+ PRIMARY KEY (tdesc,tpartname)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- INSERT INTO nucleus_template VALUES (3, 'ITEM', '<item>\r\n <title><%title(xml)%></title>\r\n <link><%blogurl%>index.php?itemid=<%itemid%></link>\r\n<description><![CDATA[<%body%><%more%>]]></description>\r\n <category><%category%></category>\r\n<comments><%blogurl%>index.php?itemid=<%itemid%></comments>\r\n <pubDate><%date(rfc822)%></pubDate>\r\n</item>');
+-- INSERT INTO nucleus_template VALUES (3, 'EDITLINK', '<a href="<%editlink%>" onclick="<%editpopupcode%>">edit</a>');
+-- INSERT INTO nucleus_template VALUES (3, 'FORMAT_DATE', '%x');
+-- INSERT INTO nucleus_template VALUES (3, 'FORMAT_TIME', '%X');
+-- INSERT INTO nucleus_template VALUES (4, 'ITEM', '<%date(utc)%>');
+-- INSERT INTO nucleus_template VALUES (5, 'ITEM', '<entry>\n <title type=\"html\"><![CDATA[<%title%>]]></title>\n <link rel=\"alternate\" type=\"text/html\" href=\"<%blogurl%>index.php?itemid=<%itemid%>\" />\n <author>\n <name><%author%></name>\n </author>\n <updated><%date(utc)%></updated>\n <published><%date(iso8601)%></published>\n <content type=\"html\"><![CDATA[<%body%><%more%>]]></content>\n <id><%blogurl%>:<%blogid%>:<%itemid%></id>\n</entry>');
+-- INSERT INTO nucleus_template VALUES (5, 'POPUP_CODE', '<%media%>');
+-- INSERT INTO nucleus_template VALUES (5, 'IMAGE_CODE', '<%image%>');
+-- INSERT INTO nucleus_template VALUES (5, 'MEDIA_CODE', '<%media%>');
+-- INSERT INTO nucleus_template VALUES (3, 'POPUP_CODE', '<%image%>');
+-- INSERT INTO nucleus_template VALUES (3, 'MEDIA_CODE', '<%media%>');
+-- INSERT INTO nucleus_template VALUES (3, 'IMAGE_CODE', '<%media%>');
+
+CREATE TABLE nucleus_template_desc (
+ tdnumber int(11) NOT NULL auto_increment,
+ tdname varchar(64) NOT NULL default '',
+ tddesc varchar(200) default NULL,
+ PRIMARY KEY (tdnumber),
+-- UNIQUE KEY tdnumber (tdnumber),
+ UNIQUE KEY tdname (tdname)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- INSERT INTO nucleus_template_desc VALUES (4, 'feeds/atom/modified', 'Atom feeds: Inserts last modification date');
+-- INSERT INTO nucleus_template_desc VALUES (5, 'feeds/atom/entries', 'Atom feeds: Feed items');
+-- INSERT INTO nucleus_template_desc VALUES (3, 'feeds/rss20', 'Used for RSS 2.0 syndication of your blog');
+-- INSERT INTO nucleus_template_desc VALUES (8, 'default/index', 'Nucleus CMS default index template');
+-- INSERT INTO nucleus_template_desc VALUES (9, 'default/item', 'Nucleus CMS default item template');
+
+CREATE TABLE nucleus_tickets (
+ ticket varchar(40) NOT NULL default '',
+ ctime datetime NOT NULL default '0000-00-00 00:00:00',
+ member int(11) NOT NULL default '0',
+ PRIMARY KEY (ticket,member)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-\r
-/**\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: install.php 1227 2007-12-14 16:48:40Z ehui $\r
- */\r
-\r
-// header\r
-define('_TITLE', 'Nucleus Install');\r
-define('_BODYFONTSTYLE', '');\r
-\r
-// common\r
-define('_STEP1', 'Check DB');\r
-define('_STEP2', 'Setting Blog');\r
-define('_STEP3', 'Finish');\r
-define('_MODE1', 'Step by Step');\r
-define('_MODE2', 'Detailed setting');\r
-define('_NEXT', 'NEXT');\r
-define('_INSTALL', 'INSTALL');\r
-\r
-// locale setting\r
-define('_LOCALE_HEADER', 'Select Your Locale');\r
-define('_LOCALE_DESC1', 'Nucleus CMS can be used under several locales.');\r
-define('_LOCALE_DESC2', 'If you can see prefixed name with asterisk in above select box, it means translation for the locale is not enough yet.');\r
-define('_LOCALE_NEED_HELP', 'We\'re waiting for your contribution to translate!');\r
-\r
-// database settings\r
-define('_SIMPLE_NAVI1', 'At first I confirm the connection of the database. I input setting of MySQL, and please click to "next".<br />When I input detailed information and set it, please click "Detailed Setting".');\r
-define('_DB_HEADER', 'Check Database');\r
-define('_DB_TEXT1', '"Detailed setting" is recommended if used to Nucleus.');\r
-define('_DB_FIELD1', 'Hostname');\r
-define('_DB_FIELD1_DESC', '(It is usually localhost)');\r
-define('_DB_FIELD2', 'Username');\r
-define('_DB_FIELD2_DESC', '(alphabet, number, _, -)');\r
-define('_DB_FIELD3', 'Password');\r
-define('_DB_FIELD4', 'Database');\r
-define('_DB_FIELD4_DESC', '(alphabet, number, _, -)');\r
-define('_DB_FIELD5', 'Table Prefix');\r
-define('_DB_FIELD5_DESC', 'Don\'t usually set this.');\r
-\r
-// blog settings\r
-define('_SIMPLE_NAVI2', 'I was able to confirm the connection of the database.<br />Setting Blog and Information of the ADMIN, and please click to "NEXT".');\r
-define('_BLOG_HEADER', 'Weblog Data');\r
-define('_BLOG_FIELD1', 'Blog Name');\r
-define('_BLOG_FIELD2', 'Blog Short Name');\r
-define('_BLOG_FIELD2_DESC', '(alphabet, number)');\r
-\r
-// admin settings\r
-define('_ADMIN_HEADER', 'Administrator User');\r
-define('_ADMIN_FIELD1', 'Manager Name');\r
-define('_ADMIN_FIELD2', 'Login ID');\r
-define('_ADMIN_FIELD2_DESC', '(alphabet, number)');\r
-define('_ADMIN_FIELD3', 'Password');\r
-define('_ADMIN_FIELD4', 'Password Again');\r
-define('_ADMIN_FIELD5', 'E-mail Address');\r
-\r
-// url/path settings\r
-define('_PATH_FIELD1', 'Site URL');\r
-define('_PATH_FIELD2', 'Admin-area URL');\r
-define('_PATH_FIELD3', 'Admin-area path');\r
-define('_PATH_FIELD4', 'Media files URL');\r
-define('_PATH_FIELD5', 'Media dir path');\r
-define('_PATH_FIELD6', 'Skin files URL');\r
-define('_PATH_FIELD7', 'Skin files dir path');\r
-define('_PATH_FIELD8', 'Plugin files URL');\r
-define('_PATH_FIELD9', 'Action URL');\r
-\r
-// detail\r
-define('_DETAIL_NAVI1', 'All fields are mandatory. Optional information can be set from the Nucleus admin-area when installation is completed.');\r
-define('_DETAIL_HEADER1', 'MySQL Login Data');\r
-define('_DETAIL_TEXT1', 'Enter your MySQL data below. This install script needs it to be able to create and fill your database tables.');\r
-define('_DETAIL_HEADER2', 'Directories and URLs');\r
-define('_DETAIL_TEXT2', 'This install script has attempted to find out the directories and URLs in which Nucleus is installed. Please check the values below and correct if necessary. The URLs and file paths should end with a slash.');\r
-define('_DETAIL_TEXT3', 'Note: Use absolute paths instead of relative paths.');\r
-define('_DETAIL_HEADER3', 'Administrator User');\r
-define('_DETAIL_TEXT4', 'You need to enter some information to create the first user of your site.');\r
-define('_DETAIL_HEADER4', 'Weblog Data');\r
-define('_DETAIL_TEXT5', 'Below, you need to enter some information to create a default weblog. The name of this weblog will also be used as name for your site.');\r
-define('_DETAIL_TEXT6', 'Verify the data above, and click the button below to set up your database tables and initial data. This can take a while, so have patience. ONLY CLICK THE BUTTON ONCE !');\r
-\r
-// install complete\r
-define('_INST_TEXT', 'Congratulations. The installation was completed!');\r
-define('_INST_HEADER1', 'New Blog');\r
-define('_INST_TEXT1', 'Let\'s take a look at once you have created [%s].');\r
-define('_INST_BUTTON1', 'New Blog');\r
-define('_INST_HEADER2', 'Management page');\r
-define('_INST_TEXT2', 'A design change, user addition, the category setting to the management page.');\r
-define('_INST_BUTTON2', 'Management Page');\r
-define('_INST_HEADER3', 'Addition of the Blog');\r
-define('_INST_TEXT3', 'If necessary, you can even add a blog.');\r
-define('_INST_BUTTON3', 'Add Blog');\r
-define('_INST_TEXT4', 'Was unable to write to the <i>config.php</i>. Please replace with the following contents.');\r
-define('_INST_TEXT5', 'Please make sure the <i>config.php</i> permissions if it were a <span style="font-weight:bold;">444</span>. If different, please change the "444".');\r
-\r
-// errors\r
-define('_DBCONNECT_ERROR', 'Could not connect to MySQL Server.');\r
-define('_DBVERSION_UNKOWN', 'Indeterminable');\r
-define('_DBVERSION_TOOLOW', 'You must have MySQL version %s or more at least in the Nucleus.');\r
-\r
-define('_VALID_ERROR', 'There is an error in your input. Please re-look at the input value to see the error message for each section.');\r
-define('_VALID_ERROR1', '"%s" has not been entered.');\r
-define('_VALID_ERROR2', '"%s" character that can be used are A-Z, a-z ,0-9, _ and -.');\r
-define('_VALID_ERROR3', '"%s" character that can be used are A-Z, a-z ,0-9 and _.');\r
-define('_VALID_ERROR4', 'It contains characters that can not be used to "Blog Short Name". (Characters that can be used: A-Z, a-z and 0-9, blank can not be used)');\r
-define('_VALID_ERROR5', 'Contains characters that can not be used in "Login ID". (A-Z, a-z, 0-9 and the first and last non-blank characters that can be used)');\r
-define('_VALID_ERROR6', 'Passwords entered do not match.');\r
-define('_VALID_ERROR7', '"E-mail address" is incorrect.');\r
-define('_VALID_ERROR8', 'Does not end with a forward slash "/" is "%s".');\r
-define('_VALID_ERROR9', 'Does not end with "action.php" the URL of the "%s".');\r
-define('_VALID_ERROR10', 'Does not end with a forward slash "/" directory path of "%s".');\r
-define('_VALID_ERROR11', 'Directory path in the "%s" does not exist on the server.');\r
-\r
-define('_INST_ERROR', 'Failed to install. Please run the installation script again to fix the cause of the following.');\r
-define('_INST_ERROR1', 'Could not create the database. Please make sure that there is a permission to create.');\r
-define('_INST_ERROR2', 'Could not find the database. Please make sure that the database exists.');\r
-define('_INST_ERROR3', 'Database table was trying to create already exists.');\r
-define('_INST_ERROR4', 'An error occurred execution of the query');\r
-define('_INST_ERROR5', 'An error occurred during the execution of the "Configuring Members"');\r
-define('_INST_ERROR6', 'An error occurred during the execution of the "Blog Settings"');\r
-define('_INST_ERROR7', 'An error occurred during the execution of the "Setting item"');\r
-define('_INST_ERROR8', 'can not write to the config.php. Once you have the permissions to <span style="font-weight:bold;">666</span> of config.php, the script will automatically write the configuration information. (<a href="../nucleus/documentation/tips.html#filepermissions">Quick Guide to change permissions</a>)');\r
-define('_INST_ERROR9', 'Could not install the plug-in "%s".');\r
-define('_INST_ERROR10', 'File "%s" can not be found.');\r
-define('_INST_ERROR11', 'Theme file "%s" could not be read.');\r
-define('_INST_ERROR12', 'Could not import the theme "%s".');\r
-\r
-\r
-// General category\r
-define('_GENERALCAT_NAME', 'General');\r
-define('_GENERALCAT_DESC', 'Items that do not fit in other categories');\r
-define('_1ST_POST_TITLE', 'Welcome to Nucleus CMS v4.0');\r
-define('_1ST_POST', 'This is the first post on your Nucleus CMS. Nucleus offers you the building blocks you need to create a web presence. Whether you want to\r
-create a personal blog, a family page, or an online business site, Nucleus CMS can help you achieve your goals.<br /> <br /> We\\\'ve loaded this first entry with links and information to get you started. Though you can delete this entry, it will eventually scroll off the main page as you add content to your site. Add your comments while you learn to work with Nucleus CMS, or bookmark this page so you can come back to it when you need to.');\r
-define('_1ST_POST2', '<b>Home - <a href="http://nucleuscms.org/" title="Nucleus CMS home">nucleuscms.org</a></b><br /> Welcome to the world of Nucleus CMS. In 2001 a set of PHP scripts were let loose on the open Internet. Those scripts, which took user-generated data and used it to dynamically create html pages, contained the ideas and the algorithms that are the core of today\\\'s Nucleus CMS. Though Nucleus CMS 3.5 is far more flexible and powerful than the scripts from which it emerged, it still expresses the values that guided its birth: flexibility, security, and computational elegance.<br /> <br /> Thanks to an international community of sophisticated developers and designers, Nucleus CMS remains simple enough for anyone to learn, and expandable enough to allow you to build almost any website you can imagine. Nucleus CMS lets you integrate text, images, and user comments in a seamless package that will make your web presence as serious, professional, personal, or fun as you want it to be. We hope you enjoy its power.<br /> <br /> <b>Documentation - <a href="http://docs.nucleuscms.org/" title="Nucleus CMS Documentation">docs.nucleuscms.org</a></b><br /> The install process places a <a href="nucleus/documentation/">user</a> and a <a href="nucleus/documentation/devdocs/">developer</a> documentation on your web server. Pop-up <a href="/nucleus/documentation/help.html">help</a> is available throughout the administration area to assist you in maintaining and customizing your site. When in the Nucleus CMS admin area, click on this symbol <img src="nucleus/documentation/icon-help.gif" width="15" height="15" alt="help icon" /> for context-sensitive help. You can also read this documentation online under <a href="http://docs.nucleuscms.org/" title="Nucleus CMS Documentation">docs.nucleuscms.org</a>.<br /> <br /> <b>Frequently Asked Questions - <a nicetitle="Nucleus CMS FAQ" href="http://faq.nucleuscms.org/">faq.nucleuscms.org</a></b><br /> If you need more information about managing, extending or troubleshooting your Nucleus CMS the Nucleus FAQ is the first place to search information. Over 170 frequently asked questions are answered from experienced Nucleus users.<br /> <br /> <b>Support - <a href="http://forum.nucleuscms.org/" title="Nucleus CMS Support Forum">forum.nucleuscms.org</a></b><br /> Should you require assistance, please don\\\'t hesitate to <a href="http://forum.nucleuscms.org/faq.php">join</a> the 6,800+ registered users on our forums. With its built-in search capability of the 73,000+ posted articles, your answers are just a few clicks away. Remember: almost any question you think of has already been asked on the forums, and almost anything you want to do with Nucleus has been tried and explained there. Be sure to check them out.<br /> <br /> <b>Demonstration - <a href="http://demo.nucleuscms.org/" title="Nucleus CMS Demonstration">demo.nucleuscms.org</a></b><br /> Want to play around, test changes or tell a friend or relative about Nucleus CMS? Visit our live <a href="http://demo.nucleuscms.org/">demo site</a>.<br /> <br /> <b>Skins - <a href="http://skins.nucleuscms.org/" title="Nucleus CMS Skins">skins.nucleuscms.org</a></b><br /> The combination of multi-weblogs and skins/templates make for a powerful duo in personalizing your site or designing one for a friend, relative or business client. Import new skins to change the look of your website, or create your own skins and share them with the Nucleus community! Help designing or modifying skins is only a few clicks away in the Nucleus forums.<br /> <br /> <b>Plugins - <a href="http://plugins.nucleuscms.org/" title="Nucleus plugins">plugins.nucleuscms.org</a></b><br /> Looking to add some extra functionality to the base Nucleus CMS package? Our <a href="http://wiki.nucleuscms.org/plugin">plugin repository</a> gives you plenty of ways to extend and expand what Nucleus CMS can do; your imagination and creativity are the only limit on how Nucleus CMS can work for you.<br /> <br /> <b>Development - <a href="http://dev.nucleuscms.org/" title="Nucleus Development">dev.nucleuscms.org</a></b><br /> If you need more information about the Nucleus development you can find Informations in the developer documents at <a href="http://dev.nucleuscms.org/" title="Nucleus Development">dev.nucleuscms.org</a> or in the <a href="http://forum.nucleuscms.org/">Support Forum</a>. Sourceforge.net graciously hosts our <a href="http://sourceforge.net/projects/nucleuscms/">Open Source project page</a> which contains our software downloads and CVS repository.<br /> <br /> <b>Donators</b><br /> We would like to thank these <a href="http://nucleuscms.org/donators.php">nice people</a> for their <a href="http://nucleuscms.org/donate.php">support</a>. <em>Thanks all!</em><br /> <br /> <b>Vote for Nucleus CMS</b><br /> Like Nucleus CMS? Vote for us at <a href="http://www.hotscripts.com/Detailed/13368.html?RID=nucleus@demuynck.org">HotScripts</a> and <a href="http://www.opensourcecms.com/index.php?option=content&task=view&id=145">opensourceCMS</a>.<br /> <br /> <b>License</b><br /> When we speak of free software, we are referring to freedom, not price. Our <a href="http://www.gnu.org/licenses/gpl.html">General Public Licenses</a> are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.');\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: install.php 1227 2007-12-14 16:48:40Z ehui $
+ */
+
+// header
+define('_TITLE', 'Nucleus Install');
+define('_BODYFONTSTYLE', '');
+
+// common
+define('_STEP1', 'Check DB');
+define('_STEP2', 'Setting Blog');
+define('_STEP3', 'Finish');
+define('_MODE1', 'Step by Step');
+define('_MODE2', 'Detailed setting');
+define('_NEXT', 'NEXT');
+define('_INSTALL', 'INSTALL');
+
+// locale setting
+define('_LOCALE_HEADER', 'Select Your Locale');
+define('_LOCALE_DESC1', 'Nucleus CMS can be used under several locales.');
+define('_LOCALE_DESC2', 'If you can see prefixed name with asterisk in above select box, it means translation for the locale is not enough yet.');
+define('_LOCALE_NEED_HELP', 'We\'re waiting for your contribution to translate!');
+
+// database settings
+define('_SIMPLE_NAVI1', 'At first I confirm the connection of the database. I input setting of MySQL, and please click to "next".<br />When I input detailed information and set it, please click "Detailed Setting".');
+define('_DB_HEADER', 'Check Database');
+define('_DB_TEXT1', '"Detailed setting" is recommended if used to Nucleus.');
+define('_DB_FIELD1', 'Hostname');
+define('_DB_FIELD1_DESC', '(It is usually localhost)');
+define('_DB_FIELD2', 'Username');
+define('_DB_FIELD2_DESC', '(alphabet, number, _, -)');
+define('_DB_FIELD3', 'Password');
+define('_DB_FIELD4', 'Database');
+define('_DB_FIELD4_DESC', '(alphabet, number, _, -)');
+define('_DB_FIELD5', 'Table Prefix');
+define('_DB_FIELD5_DESC', 'Don\'t usually set this.');
+
+// blog settings
+define('_SIMPLE_NAVI2', 'I was able to confirm the connection of the database.<br />Setting Blog and Information of the ADMIN, and please click to "NEXT".');
+define('_BLOG_HEADER', 'Weblog Data');
+define('_BLOG_FIELD1', 'Blog Name');
+define('_BLOG_FIELD2', 'Blog Short Name');
+define('_BLOG_FIELD2_DESC', '(alphabet, number)');
+
+// admin settings
+define('_ADMIN_HEADER', 'Administrator User');
+define('_ADMIN_FIELD1', 'Manager Name');
+define('_ADMIN_FIELD2', 'Login ID');
+define('_ADMIN_FIELD2_DESC', '(alphabet, number)');
+define('_ADMIN_FIELD3', 'Password');
+define('_ADMIN_FIELD4', 'Password Again');
+define('_ADMIN_FIELD5', 'E-mail Address');
+
+// url/path settings
+define('_PATH_FIELD1', 'Site URL');
+define('_PATH_FIELD2', 'Admin-area URL');
+define('_PATH_FIELD3', 'Admin-area path');
+define('_PATH_FIELD4', 'Media files URL');
+define('_PATH_FIELD5', 'Media dir path');
+define('_PATH_FIELD6', 'Skin files URL');
+define('_PATH_FIELD7', 'Skin files dir path');
+define('_PATH_FIELD8', 'Plugin files URL');
+define('_PATH_FIELD9', 'Action URL');
+
+// detail
+define('_DETAIL_NAVI1', 'All fields are mandatory. Optional information can be set from the Nucleus admin-area when installation is completed.');
+define('_DETAIL_HEADER1', 'MySQL Login Data');
+define('_DETAIL_TEXT1', 'Enter your MySQL data below. This install script needs it to be able to create and fill your database tables.');
+define('_DETAIL_HEADER2', 'Directories and URLs');
+define('_DETAIL_TEXT2', 'This install script has attempted to find out the directories and URLs in which Nucleus is installed. Please check the values below and correct if necessary. The URLs and file paths should end with a slash.');
+define('_DETAIL_TEXT3', 'Note: Use absolute paths instead of relative paths.');
+define('_DETAIL_HEADER3', 'Administrator User');
+define('_DETAIL_TEXT4', 'You need to enter some information to create the first user of your site.');
+define('_DETAIL_HEADER4', 'Weblog Data');
+define('_DETAIL_TEXT5', 'Below, you need to enter some information to create a default weblog. The name of this weblog will also be used as name for your site.');
+define('_DETAIL_TEXT6', 'Verify the data above, and click the button below to set up your database tables and initial data. This can take a while, so have patience. ONLY CLICK THE BUTTON ONCE !');
+
+// install complete
+define('_INST_TEXT', 'Congratulations. The installation was completed!');
+define('_INST_HEADER1', 'New Blog');
+define('_INST_TEXT1', 'Let\'s take a look at once you have created [%s].');
+define('_INST_BUTTON1', 'New Blog');
+define('_INST_HEADER2', 'Management page');
+define('_INST_TEXT2', 'A design change, user addition, the category setting to the management page.');
+define('_INST_BUTTON2', 'Management Page');
+define('_INST_HEADER3', 'Addition of the Blog');
+define('_INST_TEXT3', 'If necessary, you can even add a blog.');
+define('_INST_BUTTON3', 'Add Blog');
+define('_INST_TEXT4', 'Was unable to write to the <i>config.php</i>. Please replace with the following contents.');
+define('_INST_TEXT5', 'Please make sure the <i>config.php</i> permissions if it were a <span style="font-weight:bold;">444</span>. If different, please change the "444".');
+
+// errors
+define('_DBCONNECT_ERROR', 'Could not connect to MySQL Server.');
+define('_DBVERSION_UNKOWN', 'Indeterminable');
+define('_DBVERSION_TOOLOW', 'You must have MySQL version %s or more at least in the Nucleus.');
+
+define('_VALID_ERROR', 'There is an error in your input. Please re-look at the input value to see the error message for each section.');
+define('_VALID_ERROR1', '"%s" has not been entered.');
+define('_VALID_ERROR2', '"%s" character that can be used are A-Z, a-z ,0-9, _ and -.');
+define('_VALID_ERROR3', '"%s" character that can be used are A-Z, a-z ,0-9 and _.');
+define('_VALID_ERROR4', 'It contains characters that can not be used to "Blog Short Name". (Characters that can be used: A-Z, a-z and 0-9, blank can not be used)');
+define('_VALID_ERROR5', 'Contains characters that can not be used in "Login ID". (A-Z, a-z, 0-9 and the first and last non-blank characters that can be used)');
+define('_VALID_ERROR6', 'Passwords entered do not match.');
+define('_VALID_ERROR7', '"E-mail address" is incorrect.');
+define('_VALID_ERROR8', 'Does not end with a forward slash "/" is "%s".');
+define('_VALID_ERROR9', 'Does not end with "action.php" the URL of the "%s".');
+define('_VALID_ERROR10', 'Does not end with a forward slash "/" directory path of "%s".');
+define('_VALID_ERROR11', 'Directory path in the "%s" does not exist on the server.');
+
+define('_INST_ERROR', 'Failed to install. Please run the installation script again to fix the cause of the following.');
+define('_INST_ERROR1', 'Could not create the database. Please make sure that there is a permission to create.');
+define('_INST_ERROR2', 'Could not find the database. Please make sure that the database exists.');
+define('_INST_ERROR3', 'Database table was trying to create already exists.');
+define('_INST_ERROR4', 'An error occurred execution of the query');
+define('_INST_ERROR5', 'An error occurred during the execution of the "Configuring Members"');
+define('_INST_ERROR6', 'An error occurred during the execution of the "Blog Settings"');
+define('_INST_ERROR7', 'An error occurred during the execution of the "Setting item"');
+define('_INST_ERROR8', 'can not write to the config.php. Once you have the permissions to <span style="font-weight:bold;">666</span> of config.php, the script will automatically write the configuration information. (<a href="../nucleus/documentation/tips.html#filepermissions">Quick Guide to change permissions</a>)');
+define('_INST_ERROR9', 'Could not install the plug-in "%s".');
+define('_INST_ERROR10', 'File "%s" can not be found.');
+define('_INST_ERROR11', 'Theme file "%s" could not be read.');
+define('_INST_ERROR12', 'Could not import the theme "%s".');
+
+
+// General category
+define('_GENERALCAT_NAME', 'General');
+define('_GENERALCAT_DESC', 'Items that do not fit in other categories');
+define('_1ST_POST_TITLE', 'Welcome to Nucleus CMS v4.0');
+define('_1ST_POST', 'This is the first post on your Nucleus CMS. Nucleus offers you the building blocks you need to create a web presence. Whether you want to
+create a personal blog, a family page, or an online business site, Nucleus CMS can help you achieve your goals.<br /> <br /> We\\\'ve loaded this first entry with links and information to get you started. Though you can delete this entry, it will eventually scroll off the main page as you add content to your site. Add your comments while you learn to work with Nucleus CMS, or bookmark this page so you can come back to it when you need to.');
+define('_1ST_POST2', '<b>Home - <a href="http://nucleuscms.org/" title="Nucleus CMS home">nucleuscms.org</a></b><br /> Welcome to the world of Nucleus CMS. In 2001 a set of PHP scripts were let loose on the open Internet. Those scripts, which took user-generated data and used it to dynamically create html pages, contained the ideas and the algorithms that are the core of today\\\'s Nucleus CMS. Though Nucleus CMS 3.5 is far more flexible and powerful than the scripts from which it emerged, it still expresses the values that guided its birth: flexibility, security, and computational elegance.<br /> <br /> Thanks to an international community of sophisticated developers and designers, Nucleus CMS remains simple enough for anyone to learn, and expandable enough to allow you to build almost any website you can imagine. Nucleus CMS lets you integrate text, images, and user comments in a seamless package that will make your web presence as serious, professional, personal, or fun as you want it to be. We hope you enjoy its power.<br /> <br /> <b>Documentation - <a href="http://docs.nucleuscms.org/" title="Nucleus CMS Documentation">docs.nucleuscms.org</a></b><br /> The install process places a <a href="nucleus/documentation/">user</a> and a <a href="nucleus/documentation/devdocs/">developer</a> documentation on your web server. Pop-up <a href="/nucleus/documentation/help.html">help</a> is available throughout the administration area to assist you in maintaining and customizing your site. When in the Nucleus CMS admin area, click on this symbol <img src="nucleus/documentation/icon-help.gif" width="15" height="15" alt="help icon" /> for context-sensitive help. You can also read this documentation online under <a href="http://docs.nucleuscms.org/" title="Nucleus CMS Documentation">docs.nucleuscms.org</a>.<br /> <br /> <b>Frequently Asked Questions - <a nicetitle="Nucleus CMS FAQ" href="http://faq.nucleuscms.org/">faq.nucleuscms.org</a></b><br /> If you need more information about managing, extending or troubleshooting your Nucleus CMS the Nucleus FAQ is the first place to search information. Over 170 frequently asked questions are answered from experienced Nucleus users.<br /> <br /> <b>Support - <a href="http://forum.nucleuscms.org/" title="Nucleus CMS Support Forum">forum.nucleuscms.org</a></b><br /> Should you require assistance, please don\\\'t hesitate to <a href="http://forum.nucleuscms.org/faq.php">join</a> the 6,800+ registered users on our forums. With its built-in search capability of the 73,000+ posted articles, your answers are just a few clicks away. Remember: almost any question you think of has already been asked on the forums, and almost anything you want to do with Nucleus has been tried and explained there. Be sure to check them out.<br /> <br /> <b>Demonstration - <a href="http://demo.nucleuscms.org/" title="Nucleus CMS Demonstration">demo.nucleuscms.org</a></b><br /> Want to play around, test changes or tell a friend or relative about Nucleus CMS? Visit our live <a href="http://demo.nucleuscms.org/">demo site</a>.<br /> <br /> <b>Skins - <a href="http://skins.nucleuscms.org/" title="Nucleus CMS Skins">skins.nucleuscms.org</a></b><br /> The combination of multi-weblogs and skins/templates make for a powerful duo in personalizing your site or designing one for a friend, relative or business client. Import new skins to change the look of your website, or create your own skins and share them with the Nucleus community! Help designing or modifying skins is only a few clicks away in the Nucleus forums.<br /> <br /> <b>Plugins - <a href="http://plugins.nucleuscms.org/" title="Nucleus plugins">plugins.nucleuscms.org</a></b><br /> Looking to add some extra functionality to the base Nucleus CMS package? Our <a href="http://wiki.nucleuscms.org/plugin">plugin repository</a> gives you plenty of ways to extend and expand what Nucleus CMS can do; your imagination and creativity are the only limit on how Nucleus CMS can work for you.<br /> <br /> <b>Development - <a href="http://dev.nucleuscms.org/" title="Nucleus Development">dev.nucleuscms.org</a></b><br /> If you need more information about the Nucleus development you can find Informations in the developer documents at <a href="http://dev.nucleuscms.org/" title="Nucleus Development">dev.nucleuscms.org</a> or in the <a href="http://forum.nucleuscms.org/">Support Forum</a>. Sourceforge.net graciously hosts our <a href="http://sourceforge.net/projects/nucleuscms/">Open Source project page</a> which contains our software downloads and CVS repository.<br /> <br /> <b>Donators</b><br /> We would like to thank these <a href="http://nucleuscms.org/donators.php">nice people</a> for their <a href="http://nucleuscms.org/donate.php">support</a>. <em>Thanks all!</em><br /> <br /> <b>Vote for Nucleus CMS</b><br /> Like Nucleus CMS? Vote for us at <a href="http://www.hotscripts.com/Detailed/13368.html?RID=nucleus@demuynck.org">HotScripts</a> and <a href="http://www.opensourcecms.com/index.php?option=content&task=view&id=145">opensourceCMS</a>.<br /> <br /> <b>License</b><br /> When we speak of free software, we are referring to freedom, not price. Our <a href="http://www.gnu.org/licenses/gpl.html">General Public Licenses</a> are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.');
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-\r
-/**\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: install_lang_japanese.php 1189 2011-03-28 14:45:08Z sakamocchi $\r
- */\r
-\r
-// header\r
-define('_TITLE', 'Nucleusのインストール');\r
-define('_BODYFONTSTYLE', 'body {\r
- font:14px/20px "メイリオ", "Meiryo", "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "Osaka", "MS Pゴシック", "MS PGothic",sans-serif;\r
- *font-size:small; /* for IE */\r
- *font:x-small; /* for IE in quirks mode */\r
-}\r
-\r
-#container h2{\r
- padding:7px 0 3px 35px;\r
-}\r
-\r
-.prt .sbt .sbt_sqr,.prt .sbt .sbt_arw{\r
- letter-spacing:0.2em;\r
-}');\r
-\r
-// common\r
-define('_STEP1', 'データベースの確認');\r
-define('_STEP2', 'ブログ設定');\r
-define('_STEP3', '完了');\r
-define('_MODE1', '簡易設定');\r
-define('_MODE2', '詳細設定');\r
-define('_NEXT', '次へ');\r
-define('_INSTALL', 'インストール');\r
-\r
-// locale setting\r
-define('_LOCALE_HEADER', 'あなたのロケールを選択して下さい');\r
-define('_LOCALE_DESC1', 'Nucleus CMSはさまざまなロケールで使うことができるよう作られています。');\r
-define('_LOCALE_DESC2', '上のセレクトボックスに表示される名前のうち、アスタリスクで始まるものは翻訳が十分ではありません。');\r
-define('_LOCALE_NEED_HELP', 'もし余裕がありましたら、ぜひ翻訳したファイルを送って下さい!');\r
-\r
-// database settings\r
-define('_SIMPLE_NAVI1', 'まずデータベースの接続を確認します。MySQLの設定を入力して「次へ」をクリックしてください。<br />詳細な情報を入力して設定する場合は「詳細情報」をクリックしてください。');\r
-define('_DB_HEADER', 'データベース接続');\r
-define('_DB_TEXT1', 'Nucleusになれているなら、詳細設定がおすすめです。');\r
-define('_DB_FIELD1', 'ホスト名');\r
-define('_DB_FIELD1_DESC', '(通常は localhost)');\r
-define('_DB_FIELD2', 'ユーザー名');\r
-define('_DB_FIELD2_DESC', '(半角英数 , _ , - )');\r
-define('_DB_FIELD3', 'パスワード');\r
-define('_DB_FIELD4', 'データベース名');\r
-define('_DB_FIELD4_DESC', '(半角英数 , _ , - )');\r
-define('_DB_FIELD5', 'プリフィックス');\r
-define('_DB_FIELD5_DESC', '通常は空白で結構です');\r
-\r
-// blog settings\r
-define('_SIMPLE_NAVI2', 'データベースの接続が確認できました。<br />ブログと管理者の設定をして「次へ」をクリックしてください。');\r
-define('_BLOG_HEADER', 'ブログ設定');\r
-define('_BLOG_FIELD1', 'ブログ名');\r
-define('_BLOG_FIELD2', 'ブログ短縮名');\r
-define('_BLOG_FIELD2_DESC', '(半角英数)');\r
-\r
-// admin settings\r
-define('_ADMIN_HEADER', '管理者の情報');\r
-define('_ADMIN_FIELD1', '管理者名');\r
-define('_ADMIN_FIELD2', 'ログインID');\r
-define('_ADMIN_FIELD2_DESC', '(半角英数)');\r
-define('_ADMIN_FIELD3', 'パスワード');\r
-define('_ADMIN_FIELD4', 'パスワード:確認');\r
-define('_ADMIN_FIELD5', 'メールアドレス');\r
-\r
-// url/path settings\r
-define('_PATH_FIELD1', 'サイトのURL');\r
-define('_PATH_FIELD2', '管理URL');\r
-define('_PATH_FIELD3', '管理パス');\r
-define('_PATH_FIELD4', 'メディアURL');\r
-define('_PATH_FIELD5', 'メディアパス');\r
-define('_PATH_FIELD6', 'スキンファイルURL');\r
-define('_PATH_FIELD7', 'スキンファイルパス');\r
-define('_PATH_FIELD8', 'プラグインURL');\r
-define('_PATH_FIELD9', 'アクションURL');\r
-\r
-// detail\r
-define('_DETAIL_NAVI1', 'すべての項目を入力してください。オプション設定は、インストール完了後Nucleusの管理ページから変更できます。');\r
-define('_DETAIL_HEADER1', 'MySQLのログイン情報');\r
-define('_DETAIL_TEXT1', 'データベースのログイン情報を入力してください。この情報が分からない場合は、システム管理者かホスティング元に確認をとってください。');\r
-define('_DETAIL_HEADER2', 'ディレクトリとURL');\r
-define('_DETAIL_TEXT2', 'ディレクトリとURLを下記の設定でインストールします。特殊なディレクトリ構成で運用したい場合は、ここで変更できます。<br />ディレクトリのパス及びURLはスラッシュ「/」で閉じてください。');\r
-define('_DETAIL_TEXT3', 'Note: パスは相対パスではなく絶対パスを使用してください。');\r
-define('_DETAIL_HEADER3', '管理権限をもつユーザー');\r
-define('_DETAIL_TEXT4', 'サイトの最初のユーザーを作成するための情報を入力してください。');\r
-define('_DETAIL_HEADER4', 'ブログ設定');\r
-define('_DETAIL_TEXT5', 'デフォルトのブログを作成するための情報を入力してください。このブログの名前は、サイト名としても利用されます。');\r
-define('_DETAIL_TEXT6', '上に書いてきたデータが正しいか確かめてください。よければデータベース・テーブルと最初のデータを設定するために下のボタンを押してください。少し時間がかかるかもしれませんがご辛抱を。ボタンをクリックするのは一回だけにしてください。');\r
-\r
-// install complete\r
-define('_INST_TEXT', 'おめでとうございます。インストールは完了しました!');\r
-define('_INST_HEADER1', '作成したブログ');\r
-define('_INST_TEXT1', 'さっそく作成した "%s" を見てみましょう。');\r
-define('_INST_BUTTON1', 'ブログへ');\r
-define('_INST_HEADER2', '管理ページ');\r
-define('_INST_TEXT2', 'デザイン変更、ユーザー追加、カテゴリ設定は管理ページへ。');\r
-define('_INST_BUTTON2', '管理ページ');\r
-define('_INST_HEADER3', 'ブログの追加');\r
-define('_INST_TEXT3', '必要であれば、さらにブログを追加できます。');\r
-define('_INST_BUTTON3', '追加作成');\r
-define('_INST_TEXT4', '<i>config.php</i>への書き込みが行えませんでした。以下の内容で書き換えてください。');\r
-define('_INST_TEXT5', '<i>config.php</i>のパーミッションが"<span style="font-weight:bold;">444</span>"であるか確認してください。もし、違うならば"444"に変更してください。');\r
-\r
-// errors\r
-define('_DBCONNECT_ERROR', 'MySQL Serverに接続できませんでした。');\r
-define('_DBVERSION_UNKOWN', '判別不能');\r
-define('_DBVERSION_TOOLOW', 'Nucleusでは少なくともバージョン "%s" 以上のMySQLが必要です。');\r
-\r
-define('_VALID_ERROR', '入力内容に誤りがあります。各セクションのエラーメッセージを確認して入力値を見なおしてください。');\r
-define('_VALID_ERROR1', '"%s" が入力されていません。');\r
-define('_VALID_ERROR2', '"%s" に使用できる文字は半角の A-Z、a-z、0-9、_(アンダーライン)、-(ハイフン)のみです。');\r
-define('_VALID_ERROR3', '"%s" に使用できる文字は半角の A-Z、a-z、0-9、_(アンダーライン)のみです。');\r
-define('_VALID_ERROR4', '"ブログの短縮名(略称)" に使用できる文字は A-Z、a-z、0-9(半角英数)のみです。');\r
-define('_VALID_ERROR5', '"ログインID" に使用できる文字は A-Z、a-z、0-9(半角英数)のみです。ただし、最初と最後以外では半角スペースも使用できます。');\r
-define('_VALID_ERROR6', '入力された二つのパスワードが一致しません。');\r
-define('_VALID_ERROR7', '"メールアドレス" が不正です。');\r
-define('_VALID_ERROR8', '"%s" が"/(スラッシュ)"で終わっていません。');\r
-define('_VALID_ERROR9', '"%s" のアドレスが"action.php"で終わっていません。');\r
-define('_VALID_ERROR10', '"%s" のディレクトリパスが"/(スラッシュ)"で終わっていません。');\r
-define('_VALID_ERROR11', '"%s" のディレクトリパスがサーバ上に存在しません。');\r
-\r
-define('_INST_ERROR', 'インストールに失敗しました。以下の原因を解決して再度インストールスクリプトを実行してください。');\r
-define('_INST_ERROR1', 'データベースを作成できませんでした。作成の権限があるかどうか確認してください。');\r
-define('_INST_ERROR2', 'データベースを見つけられませんでした。データベースが存在するか確認してください。');\r
-define('_INST_ERROR3', '作成しようとしたテーブルが既に存在しています。');\r
-define('_INST_ERROR4', 'クエリの実行中にエラーが発生しました');\r
-define('_INST_ERROR5', '"メンバー設定" の実行中にエラーが発生しました');\r
-define('_INST_ERROR6', '"ブログ設定" の実行中にエラーが発生しました');\r
-define('_INST_ERROR7', '"アイテム設定" の実行中にエラーが発生しました');\r
-define('_INST_ERROR8', 'config.php への書き込みができません。config.php のパーミッションを<span style="font-weight:bold;">666</span>にしておけば、スクリプトが自動で設定情報を書き込みます。(<a href="../nucleus/documentation/tips.html#filepermissions">パーミッション変更の簡易ガイド</a>)。');\r
-define('_INST_ERROR9', 'プラグイン "%s" をインストールできませんでした。');\r
-define('_INST_ERROR10', 'ファイル "%s" が見つかりません。');\r
-define('_INST_ERROR11', 'テーマファイル "%s" が読み込めませんでした。');\r
-define('_INST_ERROR12', 'テーマ "%s" をインポートできませんでした。');\r
-\r
-\r
-// General category\r
-define('_GENERALCAT_NAME', '総合');\r
-define('_GENERALCAT_DESC', '投稿した記事に合うカテゴリが無い時にこのカテゴリを使用すると良いでしょう');\r
-define('_1ST_POST_TITLE', 'Nucleus CMS バージョン4.00 へようこそ');\r
-define('_1ST_POST', 'ウェブサイトの作成を補助する積み木がここにあります。それは心躍るブログになるかもしれませんし、見る人を和ませる家族のサイトになるかもしれませんし、実り多い趣味のサイトになるかもしれません。あるいは現在のあなたには想像がつかないものになることだってあるでしょう。<br />\r
-<br />用途が思いつきませんでしたか? それならここへ来て正解です。なぜならあなた同様私たちにもわからないのですから。');\r
-define('_1ST_POST2', 'これはサイトにおける最初のエントリーです。スタートを切りやすいように、リンクと情報を入れておきました。<br />\r
-<br />\r
-この記事を削除することもできますが、どちらにせよ記事を追加していくことによってやがてメインページからは見えなくなります。Nucleusを扱ううちに生じたメモをコメントとして追加し、将来アクセスできるようにこのページをブックマークしておくのも手です。<br />\r
-<br />\r
-<b>リンク</b><br />\r
-<br />\r
-Nucleus CMSの<a href="http://nucleuscms.org">本家</a>と<a href="http://japan.nucleuscms.org">日本語公式</a>ページ。<br />\r
-<br />\r
-Nucleus CMSのSourceForge<a href="http://sourceforge.net/projects/nucleuscms/">プロジェクト</a>(<a href="http://sourceforge.jp/projects/nucleus-jp/">日本版</a>)ページ。<br />\r
-<br />\r
-Nucleus CMSの<a href="http://wakka.xiffy.nl/Plugin/">プラグイン倉庫</a>と<a href="http://japan.nucleuscms.org/wiki/plugins">日本語のリスト</a>ページ。<br />\r
-<br />\r
-<b>ドキュメント - <a href="http://docs.nucleuscms.org/">docs.nucleuscms.org</a></b><br />\r
-<br />\r
-Nucleusの<a href="http://japan.nucleuscms.org/faq.php">FAQ(よくある質問集)</a>(<a href="http://nucleuscms.org/faq.php">原文</a>)ページ。<br />\r
-<br />\r
-インストール方法等は<a href="nucleus/documentation/">ユーザー向け</a>と<a href="nucleus/documentation/devdocs/">開発者向け</a>文書がファイルに含まれています。<br />\r
-<br />\r
-ポップアップ<a href="./nucleus/documentation/help.html">ヘルプ</a>が管理エリアのいたるところにあり、サイトのカスタマイズやデザインを手助けしてくれることでしょう。<br />\r
-<br />\r
-一度用意されているドキュメントに目を通したら、<a href="http://wiki.nucleuscms.org/">Wiki</a>(<a href="http://japan.nucleuscms.org/wiki/">日本版</a>)を訪れてください。ユーザーの書いたハウツーや小技が掲載されています。<br />\r
-<br />\r
-<b>サポート</b><br />\r
-<br />\r
-<a href="http://forum.nucleuscms.org/">forum.nucleuscms.org</a>(本家)<br />\r
-<a href="http://japan.nucleuscms.org/bb/">japan.nucleuscms.org/bb/</a>(日本版)<br />\r
-<br />\r
-<a href="http://forum.nucleuscms.org/groupcp.php?g=3">moderators</a>とサポートフォーラムで活動する全てのボランティアに感謝します。<br />\r
-<br />\r
-- <a href="http://edmondhui.homeip.net/blog/">admun</a> - Ottawa, ON, Canada<br />\r
-- <a href="http://www.tamizhan.com/">anand</a> - Bangalore, India<br />\r
-- <a href="http://hcgtv.com">hcgtv</a> - Miami, Florida, USA<br />\r
-- <a href="http://www.adrenalinsports.nl/">ikeizer</a> - Maastricht<br />\r
-- <a href="http://www.tipos.com.br/">moraes</a> - Brazil<br />\r
-- <a href="http://roelg.nl/">roel </a>- The Netherlands<br />\r
-- <a href="http://budts.be/weblog/">TeRanEX </a>- Ekeren, Antwerp, Belgium<br />\r
-- <a href="http://www.trentadams.com/">Trent </a>- Alberta, Canada<br />\r
-- <a href="http://xiffy.nl/weblog/">xiffy </a>- Deventer<br />\r
-<br />\r
-もし手助けが必要なら、1400を超える登録ユーザーのいる私たちのフォーラムに参加してください。23,000を超える投稿された記事を検索できるようになっておりますので、求める答えに数回のクリックでたどり着けるかもしれません。<br />\r
-<br />\r
-<b>カスタマイズ - <a href="http://skins.nucleuscms.org/">skins.nucleuscms.org</a></b><br />\r
-<br />\r
-マルチウェブログとスキン/テンプレートの組み合わせは強力な相乗効果を生み出します。個人的なサイト作成、友人や親戚あるいはクライアントに対するサイトデザインいずれに対してもです。<br />\r
-<br />\r
-636の登録された<a href="http://nucleuscms.org/sites.php">Nucleusで運用されているサイト</a>(<a href="http://japan.nucleuscms.org/sites.php">日本版</a>)の中から特色あるサイトをサンプルとしてご紹介します。<br />\r
-<br />\r
-個人サイト<br />\r
-- <a href="http://bloggard.com/">bloggard.com</a> - The Adventures of Bloggard<br />\r
-- <a href="http://www.yetanotherblog.de/">yetanotherblog.de</a> - Yet Another Blog<br />\r
-<br />\r
-趣味、旅行、ニュースサイト<br />\r
-- <a href="http://adrenalinsports.nl/">adrenalinsports.nl</a> - Extreme sports<br />\r
-- <a href="http://groningen-info.de/">groningen-info.de</a> - Neues aus Groningen. Fr Leute aus Duitsland.<br />\r
-<br />\r
-<b>Nucleus Developer Network - <a href="http://dev.nucleuscms.org/">dev.nucleuscms.org</a></b><br />\r
-<br />\r
-NUDNは、開発者サイトおよびプログラミングリソースのハブです。<br />\r
-<br />\r
-NUDN satellite sites, handles, location and UTC offset:<br />\r
-- <a href="http://karma.nucleuscms.org/">karma</a> - Izegem +02<br />\r
-- <a href="http://edmondhui.homeip.net/blog/">admun</a> - Ottawa -04<br />\r
-- <a href="http://dev.budts.be/nucleus/">TeRanEX</a> - Ekeren +02<br />\r
-<br />\r
-Sourceforge.net には私たちの <a href="http://sourceforge.net/projects/nucleuscms/">SVNリポジトリ</a> をホストをして頂いています。<br />\r
-<br />\r
-遊んだり、テスト更新を行ってみたい場合は、<a href="http://demo.nucleuscms.org/">demo.nucleuscms.org</a>にあるデモサイトを訪れてみてください。<br />\r
-<br />\r
-Not sure what plugins to use, visit the <a href="http://showcase.trentadams.com/">showcase site</a> where you can see plugins at play in their native habitat.<br />\r
-<br />\r
-Then visit the plugin repository at <a href="http://plugins.nucleuscms.org/">plugins.nucleuscms.org</a> for download and installation instructions.<br />\r
-<br />\r
-<b>寄付者一覧</b><br />\r
-<br />\r
-<a href="http://nucleuscms.org/donators.php">素晴らしい人々</a>による<a href="http://nucleuscms.org/donate.php">援助</a>感謝を捧げます。<em>ありがとう!</em><br />\r
-<br />\r
-<b>Nucleus CMS への投票</b><br />\r
-<br />\r
-Nucleusが気に入りましたか? <a href="http://www.hotscripts.com/Detailed/13368.html?RID=nucleus@demuynck.org">HotScripts</a>や<a href="http://www.opensourcecms.com/index.php?option=content&task=view&id=145">opensourceCMS</a>での投票をお願いします。<br />\r
-<br />\r
-<b>ライセンス</b><br />\r
-<br />\r
-私たちがフリー・ソフトウェアについて口にする場合は自由のことに言及しているのであって、価格のことではありません。私たちの<a href="http://www.gnu.org/licenses/gpl.html">GNU General Public Licenses(一般公有使用許諾書)</a>(<a href="http://www.gnu.org/licenses/gpl.ja.html">日本語訳(参考)</a>と<a href="http://www.atmarkit.co.jp/aig/03linux/gpl.html">概要</a>)は、フリー・ソフトウェアの複製物を自由に頒布できること(そして、望むならこのサービスに対して対価を請求できること)、ソース・コードを実際に受け取るか希望しさえすれば入手することが可能であること、入手したソフトウェアを変更したり新しいフリー・プログラムの一部として使用できること、以上の各内容を行なうことができるということをユーザ自身が知っていることを実現できるようにデザインされています。');\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: install_lang_japanese.php 1189 2011-03-28 14:45:08Z sakamocchi $
+ */
+
+// header
+define('_TITLE', 'Nucleusのインストール');
+define('_BODYFONTSTYLE', 'body {
+ font:14px/20px "メイリオ", "Meiryo", "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "Osaka", "MS Pゴシック", "MS PGothic",sans-serif;
+ *font-size:small; /* for IE */
+ *font:x-small; /* for IE in quirks mode */
+}
+
+#container h2{
+ padding:7px 0 3px 35px;
+}
+
+.prt .sbt .sbt_sqr,.prt .sbt .sbt_arw{
+ letter-spacing:0.2em;
+}');
+
+// common
+define('_STEP1', 'データベースの確認');
+define('_STEP2', 'ブログ設定');
+define('_STEP3', '完了');
+define('_MODE1', '簡易設定');
+define('_MODE2', '詳細設定');
+define('_NEXT', '次へ');
+define('_INSTALL', 'インストール');
+
+// locale setting
+define('_LOCALE_HEADER', 'あなたのロケールを選択して下さい');
+define('_LOCALE_DESC1', 'Nucleus CMSはさまざまなロケールで使うことができるよう作られています。');
+define('_LOCALE_DESC2', '上のセレクトボックスに表示される名前のうち、アスタリスクで始まるものは翻訳が十分ではありません。');
+define('_LOCALE_NEED_HELP', 'もし余裕がありましたら、ぜひ翻訳したファイルを送って下さい!');
+
+// database settings
+define('_SIMPLE_NAVI1', 'まずデータベースの接続を確認します。MySQLの設定を入力して「次へ」をクリックしてください。<br />詳細な情報を入力して設定する場合は「詳細情報」をクリックしてください。');
+define('_DB_HEADER', 'データベース接続');
+define('_DB_TEXT1', 'Nucleusになれているなら、詳細設定がおすすめです。');
+define('_DB_FIELD1', 'ホスト名');
+define('_DB_FIELD1_DESC', '(通常は localhost)');
+define('_DB_FIELD2', 'ユーザー名');
+define('_DB_FIELD2_DESC', '(半角英数 , _ , - )');
+define('_DB_FIELD3', 'パスワード');
+define('_DB_FIELD4', 'データベース名');
+define('_DB_FIELD4_DESC', '(半角英数 , _ , - )');
+define('_DB_FIELD5', 'プリフィックス');
+define('_DB_FIELD5_DESC', '通常は空白で結構です');
+
+// blog settings
+define('_SIMPLE_NAVI2', 'データベースの接続が確認できました。<br />ブログと管理者の設定をして「次へ」をクリックしてください。');
+define('_BLOG_HEADER', 'ブログ設定');
+define('_BLOG_FIELD1', 'ブログ名');
+define('_BLOG_FIELD2', 'ブログ短縮名');
+define('_BLOG_FIELD2_DESC', '(半角英数)');
+
+// admin settings
+define('_ADMIN_HEADER', '管理者の情報');
+define('_ADMIN_FIELD1', '管理者名');
+define('_ADMIN_FIELD2', 'ログインID');
+define('_ADMIN_FIELD2_DESC', '(半角英数)');
+define('_ADMIN_FIELD3', 'パスワード');
+define('_ADMIN_FIELD4', 'パスワード:確認');
+define('_ADMIN_FIELD5', 'メールアドレス');
+
+// url/path settings
+define('_PATH_FIELD1', 'サイトのURL');
+define('_PATH_FIELD2', '管理URL');
+define('_PATH_FIELD3', '管理パス');
+define('_PATH_FIELD4', 'メディアURL');
+define('_PATH_FIELD5', 'メディアパス');
+define('_PATH_FIELD6', 'スキンファイルURL');
+define('_PATH_FIELD7', 'スキンファイルパス');
+define('_PATH_FIELD8', 'プラグインURL');
+define('_PATH_FIELD9', 'アクションURL');
+
+// detail
+define('_DETAIL_NAVI1', 'すべての項目を入力してください。オプション設定は、インストール完了後Nucleusの管理ページから変更できます。');
+define('_DETAIL_HEADER1', 'MySQLのログイン情報');
+define('_DETAIL_TEXT1', 'データベースのログイン情報を入力してください。この情報が分からない場合は、システム管理者かホスティング元に確認をとってください。');
+define('_DETAIL_HEADER2', 'ディレクトリとURL');
+define('_DETAIL_TEXT2', 'ディレクトリとURLを下記の設定でインストールします。特殊なディレクトリ構成で運用したい場合は、ここで変更できます。<br />ディレクトリのパス及びURLはスラッシュ「/」で閉じてください。');
+define('_DETAIL_TEXT3', 'Note: パスは相対パスではなく絶対パスを使用してください。');
+define('_DETAIL_HEADER3', '管理権限をもつユーザー');
+define('_DETAIL_TEXT4', 'サイトの最初のユーザーを作成するための情報を入力してください。');
+define('_DETAIL_HEADER4', 'ブログ設定');
+define('_DETAIL_TEXT5', 'デフォルトのブログを作成するための情報を入力してください。このブログの名前は、サイト名としても利用されます。');
+define('_DETAIL_TEXT6', '上に書いてきたデータが正しいか確かめてください。よければデータベース・テーブルと最初のデータを設定するために下のボタンを押してください。少し時間がかかるかもしれませんがご辛抱を。ボタンをクリックするのは一回だけにしてください。');
+
+// install complete
+define('_INST_TEXT', 'おめでとうございます。インストールは完了しました!');
+define('_INST_HEADER1', '作成したブログ');
+define('_INST_TEXT1', 'さっそく作成した "%s" を見てみましょう。');
+define('_INST_BUTTON1', 'ブログへ');
+define('_INST_HEADER2', '管理ページ');
+define('_INST_TEXT2', 'デザイン変更、ユーザー追加、カテゴリ設定は管理ページへ。');
+define('_INST_BUTTON2', '管理ページ');
+define('_INST_HEADER3', 'ブログの追加');
+define('_INST_TEXT3', '必要であれば、さらにブログを追加できます。');
+define('_INST_BUTTON3', '追加作成');
+define('_INST_TEXT4', '<i>config.php</i>への書き込みが行えませんでした。以下の内容で書き換えてください。');
+define('_INST_TEXT5', '<i>config.php</i>のパーミッションが"<span style="font-weight:bold;">444</span>"であるか確認してください。もし、違うならば"444"に変更してください。');
+
+// errors
+define('_DBCONNECT_ERROR', 'MySQL Serverに接続できませんでした。');
+define('_DBVERSION_UNKOWN', '判別不能');
+define('_DBVERSION_TOOLOW', 'Nucleusでは少なくともバージョン "%s" 以上のMySQLが必要です。');
+
+define('_VALID_ERROR', '入力内容に誤りがあります。各セクションのエラーメッセージを確認して入力値を見なおしてください。');
+define('_VALID_ERROR1', '"%s" が入力されていません。');
+define('_VALID_ERROR2', '"%s" に使用できる文字は半角の A-Z、a-z、0-9、_(アンダーライン)、-(ハイフン)のみです。');
+define('_VALID_ERROR3', '"%s" に使用できる文字は半角の A-Z、a-z、0-9、_(アンダーライン)のみです。');
+define('_VALID_ERROR4', '"ブログの短縮名(略称)" に使用できる文字は A-Z、a-z、0-9(半角英数)のみです。');
+define('_VALID_ERROR5', '"ログインID" に使用できる文字は A-Z、a-z、0-9(半角英数)のみです。ただし、最初と最後以外では半角スペースも使用できます。');
+define('_VALID_ERROR6', '入力された二つのパスワードが一致しません。');
+define('_VALID_ERROR7', '"メールアドレス" が不正です。');
+define('_VALID_ERROR8', '"%s" が"/(スラッシュ)"で終わっていません。');
+define('_VALID_ERROR9', '"%s" のアドレスが"action.php"で終わっていません。');
+define('_VALID_ERROR10', '"%s" のディレクトリパスが"/(スラッシュ)"で終わっていません。');
+define('_VALID_ERROR11', '"%s" のディレクトリパスがサーバ上に存在しません。');
+
+define('_INST_ERROR', 'インストールに失敗しました。以下の原因を解決して再度インストールスクリプトを実行してください。');
+define('_INST_ERROR1', 'データベースを作成できませんでした。作成の権限があるかどうか確認してください。');
+define('_INST_ERROR2', 'データベースを見つけられませんでした。データベースが存在するか確認してください。');
+define('_INST_ERROR3', '作成しようとしたテーブルが既に存在しています。');
+define('_INST_ERROR4', 'クエリの実行中にエラーが発生しました');
+define('_INST_ERROR5', '"メンバー設定" の実行中にエラーが発生しました');
+define('_INST_ERROR6', '"ブログ設定" の実行中にエラーが発生しました');
+define('_INST_ERROR7', '"アイテム設定" の実行中にエラーが発生しました');
+define('_INST_ERROR8', 'config.php への書き込みができません。config.php のパーミッションを<span style="font-weight:bold;">666</span>にしておけば、スクリプトが自動で設定情報を書き込みます。(<a href="../nucleus/documentation/tips.html#filepermissions">パーミッション変更の簡易ガイド</a>)。');
+define('_INST_ERROR9', 'プラグイン "%s" をインストールできませんでした。');
+define('_INST_ERROR10', 'ファイル "%s" が見つかりません。');
+define('_INST_ERROR11', 'テーマファイル "%s" が読み込めませんでした。');
+define('_INST_ERROR12', 'テーマ "%s" をインポートできませんでした。');
+
+
+// General category
+define('_GENERALCAT_NAME', '総合');
+define('_GENERALCAT_DESC', '投稿した記事に合うカテゴリが無い時にこのカテゴリを使用すると良いでしょう');
+define('_1ST_POST_TITLE', 'Nucleus CMS バージョン4.00 へようこそ');
+define('_1ST_POST', 'ウェブサイトの作成を補助する積み木がここにあります。それは心躍るブログになるかもしれませんし、見る人を和ませる家族のサイトになるかもしれませんし、実り多い趣味のサイトになるかもしれません。あるいは現在のあなたには想像がつかないものになることだってあるでしょう。<br />
+<br />用途が思いつきませんでしたか? それならここへ来て正解です。なぜならあなた同様私たちにもわからないのですから。');
+define('_1ST_POST2', 'これはサイトにおける最初のエントリーです。スタートを切りやすいように、リンクと情報を入れておきました。<br />
+<br />
+この記事を削除することもできますが、どちらにせよ記事を追加していくことによってやがてメインページからは見えなくなります。Nucleusを扱ううちに生じたメモをコメントとして追加し、将来アクセスできるようにこのページをブックマークしておくのも手です。<br />
+<br />
+<b>リンク</b><br />
+<br />
+Nucleus CMSの<a href="http://nucleuscms.org">本家</a>と<a href="http://japan.nucleuscms.org">日本語公式</a>ページ。<br />
+<br />
+Nucleus CMSのSourceForge<a href="http://sourceforge.net/projects/nucleuscms/">プロジェクト</a>(<a href="http://sourceforge.jp/projects/nucleus-jp/">日本版</a>)ページ。<br />
+<br />
+Nucleus CMSの<a href="http://wakka.xiffy.nl/Plugin/">プラグイン倉庫</a>と<a href="http://japan.nucleuscms.org/wiki/plugins">日本語のリスト</a>ページ。<br />
+<br />
+<b>ドキュメント - <a href="http://docs.nucleuscms.org/">docs.nucleuscms.org</a></b><br />
+<br />
+Nucleusの<a href="http://japan.nucleuscms.org/faq.php">FAQ(よくある質問集)</a>(<a href="http://nucleuscms.org/faq.php">原文</a>)ページ。<br />
+<br />
+インストール方法等は<a href="nucleus/documentation/">ユーザー向け</a>と<a href="nucleus/documentation/devdocs/">開発者向け</a>文書がファイルに含まれています。<br />
+<br />
+ポップアップ<a href="./nucleus/documentation/help.html">ヘルプ</a>が管理エリアのいたるところにあり、サイトのカスタマイズやデザインを手助けしてくれることでしょう。<br />
+<br />
+一度用意されているドキュメントに目を通したら、<a href="http://wiki.nucleuscms.org/">Wiki</a>(<a href="http://japan.nucleuscms.org/wiki/">日本版</a>)を訪れてください。ユーザーの書いたハウツーや小技が掲載されています。<br />
+<br />
+<b>サポート</b><br />
+<br />
+<a href="http://forum.nucleuscms.org/">forum.nucleuscms.org</a>(本家)<br />
+<a href="http://japan.nucleuscms.org/bb/">japan.nucleuscms.org/bb/</a>(日本版)<br />
+<br />
+<a href="http://forum.nucleuscms.org/groupcp.php?g=3">moderators</a>とサポートフォーラムで活動する全てのボランティアに感謝します。<br />
+<br />
+- <a href="http://edmondhui.homeip.net/blog/">admun</a> - Ottawa, ON, Canada<br />
+- <a href="http://www.tamizhan.com/">anand</a> - Bangalore, India<br />
+- <a href="http://hcgtv.com">hcgtv</a> - Miami, Florida, USA<br />
+- <a href="http://www.adrenalinsports.nl/">ikeizer</a> - Maastricht<br />
+- <a href="http://www.tipos.com.br/">moraes</a> - Brazil<br />
+- <a href="http://roelg.nl/">roel </a>- The Netherlands<br />
+- <a href="http://budts.be/weblog/">TeRanEX </a>- Ekeren, Antwerp, Belgium<br />
+- <a href="http://www.trentadams.com/">Trent </a>- Alberta, Canada<br />
+- <a href="http://xiffy.nl/weblog/">xiffy </a>- Deventer<br />
+<br />
+もし手助けが必要なら、1400を超える登録ユーザーのいる私たちのフォーラムに参加してください。23,000を超える投稿された記事を検索できるようになっておりますので、求める答えに数回のクリックでたどり着けるかもしれません。<br />
+<br />
+<b>カスタマイズ - <a href="http://skins.nucleuscms.org/">skins.nucleuscms.org</a></b><br />
+<br />
+マルチウェブログとスキン/テンプレートの組み合わせは強力な相乗効果を生み出します。個人的なサイト作成、友人や親戚あるいはクライアントに対するサイトデザインいずれに対してもです。<br />
+<br />
+636の登録された<a href="http://nucleuscms.org/sites.php">Nucleusで運用されているサイト</a>(<a href="http://japan.nucleuscms.org/sites.php">日本版</a>)の中から特色あるサイトをサンプルとしてご紹介します。<br />
+<br />
+個人サイト<br />
+- <a href="http://bloggard.com/">bloggard.com</a> - The Adventures of Bloggard<br />
+- <a href="http://www.yetanotherblog.de/">yetanotherblog.de</a> - Yet Another Blog<br />
+<br />
+趣味、旅行、ニュースサイト<br />
+- <a href="http://adrenalinsports.nl/">adrenalinsports.nl</a> - Extreme sports<br />
+- <a href="http://groningen-info.de/">groningen-info.de</a> - Neues aus Groningen. Fr Leute aus Duitsland.<br />
+<br />
+<b>Nucleus Developer Network - <a href="http://dev.nucleuscms.org/">dev.nucleuscms.org</a></b><br />
+<br />
+NUDNは、開発者サイトおよびプログラミングリソースのハブです。<br />
+<br />
+NUDN satellite sites, handles, location and UTC offset:<br />
+- <a href="http://karma.nucleuscms.org/">karma</a> - Izegem +02<br />
+- <a href="http://edmondhui.homeip.net/blog/">admun</a> - Ottawa -04<br />
+- <a href="http://dev.budts.be/nucleus/">TeRanEX</a> - Ekeren +02<br />
+<br />
+Sourceforge.net には私たちの <a href="http://sourceforge.net/projects/nucleuscms/">SVNリポジトリ</a> をホストをして頂いています。<br />
+<br />
+遊んだり、テスト更新を行ってみたい場合は、<a href="http://demo.nucleuscms.org/">demo.nucleuscms.org</a>にあるデモサイトを訪れてみてください。<br />
+<br />
+Not sure what plugins to use, visit the <a href="http://showcase.trentadams.com/">showcase site</a> where you can see plugins at play in their native habitat.<br />
+<br />
+Then visit the plugin repository at <a href="http://plugins.nucleuscms.org/">plugins.nucleuscms.org</a> for download and installation instructions.<br />
+<br />
+<b>寄付者一覧</b><br />
+<br />
+<a href="http://nucleuscms.org/donators.php">素晴らしい人々</a>による<a href="http://nucleuscms.org/donate.php">援助</a>感謝を捧げます。<em>ありがとう!</em><br />
+<br />
+<b>Nucleus CMS への投票</b><br />
+<br />
+Nucleusが気に入りましたか? <a href="http://www.hotscripts.com/Detailed/13368.html?RID=nucleus@demuynck.org">HotScripts</a>や<a href="http://www.opensourcecms.com/index.php?option=content&task=view&id=145">opensourceCMS</a>での投票をお願いします。<br />
+<br />
+<b>ライセンス</b><br />
+<br />
+私たちがフリー・ソフトウェアについて口にする場合は自由のことに言及しているのであって、価格のことではありません。私たちの<a href="http://www.gnu.org/licenses/gpl.html">GNU General Public Licenses(一般公有使用許諾書)</a>(<a href="http://www.gnu.org/licenses/gpl.ja.html">日本語訳(参考)</a>と<a href="http://www.atmarkit.co.jp/aig/03linux/gpl.html">概要</a>)は、フリー・ソフトウェアの複製物を自由に頒布できること(そして、望むならこのサービスに対して対価を請求できること)、ソース・コードを実際に受け取るか希望しさえすれば入手することが可能であること、入手したソフトウェアを変更したり新しいフリー・プログラムの一部として使用できること、以上の各内容を行なうことができるということをユーザ自身が知っていることを実現できるようにデザインされています。');
-/*\r
- * style sheet for installer\r
- * \r
- * $Id: \r
-*/\r
-\r
-@charset 'UTF-8';\r
-/* CSS Document */\r
-\r
-/* Layout */\r
-body{\r
- margin:0;\r
- padding:0;\r
- text-align:center;\r
- color:#666;\r
-}\r
-#header{\r
- width: 100%;\r
- height:40px;\r
- background:#000;\r
- position: fixed; \r
- top:0; \r
- left:0; \r
-}\r
-#container,#container_detailed,#footer,#navigation{\r
- margin:0 auto;\r
- text-align:left;\r
- border-width:0 1px;\r
-}\r
-#navigation{\r
- width:800px;\r
- height:40px;\r
-}\r
-#container,#container_detailed{\r
- width:550px;\r
- padding:40px 20px 0 30px;\r
-}\r
-#footer{\r
- width:600px;\r
-}\r
-\r
-/* Common Settings */\r
-p{\r
- margin:20px 0;\r
-}\r
-img{\r
- border:none;\r
-}\r
-a{\r
- text-decoration:none;\r
-}\r
-pre{\r
- font-size: small;\r
- line-height: 1em;\r
- background-color:#eee;\r
- border:1px solid gray;\r
- padding: 2px;\r
-}\r
-.err{\r
- display:block;\r
- color:#c00;\r
-}\r
-\r
-/* Top navigation */\r
-#navigation h1{\r
- width:120px;\r
- height:35px;\r
- margin:0 30px 0 0;\r
- padding:4px 0 1px 0;\r
- float:left;\r
-}\r
-#navigation ul{\r
- margin:0 100px 0 0; \r
- padding:18px 0 2px 0;\r
- height:20px;\r
- list-style-type:none;\r
-}\r
-#navigation li{\r
- float:left;\r
- font-size:93%;\r
- height:20px;\r
-}\r
-#navigation li.rightbox{\r
- float:right;\r
-}\r
-#navigation li,#navigation a{\r
- color:#dedede;\r
-}\r
-#navigation li.gry{\r
- color:#787878;\r
-}\r
-#navigation a:hover{\r
- color:#fff;\r
-}\r
-\r
-/* Content */\r
-#container h2,#container_detailed h2{\r
- line-height:20px;\r
- height:20px;\r
- margin:0 -20px 0 -30px;\r
- padding:6px 0 4px 35px;\r
- background:url("nuc_h2_bk.png") 4px 4px no-repeat #d0d0d0;\r
- font-size:136%;\r
- color:#454545;\r
-}\r
-\r
-/* Form table */\r
-.prt table{\r
- width: 100%;\r
- margin-bottom:20px;\r
-}\r
-.prt table th{\r
- font-size:99%;\r
- text-align:right;\r
- width:135px;\r
- height:40px;\r
-}\r
-.prt table th .nam{\r
- margin:5px 0 0 0;\r
- padding:5px 0 0 0;\r
- height:15px;\r
- line-height:15px;\r
- font-weight:bold;\r
- color:#454545;\r
-}\r
-.prt table th .sub{\r
- display:block;\r
- margin:0;\r
- padding:0 0 5px 0;\r
- height:10px;\r
- line-height:10px;\r
- font-size:65%;\r
- font-weight:normal;\r
- color:#666;\r
-}\r
-.prt table td input{\r
- width:390px;\r
- height:35px;\r
- margin:0 0 0 5px;\r
- font-size:182%;\r
- font-weight:bold;\r
- color:#333;\r
- background:url("nuc_input_bk.png") no-repeat;\r
- border:1px solid #999;\r
- border-right-color:#ccc;\r
- border-bottom-color:#ccc;\r
-}\r
-\r
-#container_detailed .prt table td input{\r
- height:25px;\r
- margin:0 0 0 5px;\r
- font-size:122%;\r
- font-weight:normal;\r
- color:#000;\r
-}\r
-\r
-/* Select */\r
-.prt select{\r
- width:510px;\r
- height:35px;\r
- line-height:35px;\r
- margin:0 20px 10px 0;\r
- font-size:152%;\r
- font-weight:bold;\r
- color:#333;\r
- border:1px solid #999;\r
- border-left-color:#ccc;\r
- border-top-color:#ccc;\r
- background:url("nuc_input_bk.png") no-repeat;\r
-}\r
-\r
-#container_detailed .prt select{\r
- height:25px;\r
- line-height:25px;\r
- margin:0 20px 10px 0;\r
- font-size:122%;\r
-}\r
-\r
-/* Button */\r
-.prt .sbt{\r
- height:40px;\r
- margin:10px 0;\r
- text-align:center;\r
-}\r
-.prt .sbt .sbt_sqr,.prt .sbt .sbt_arw{\r
- height:35px;\r
- border:none;\r
- background:#000;\r
- color:#dedede;\r
- font-size:136%;\r
- font-weight:bold;\r
-}\r
-.prt .sbt .sbt_sqr{\r
- padding:0 20px;\r
- margin-right:5px;\r
- border-radius:5px;\r
-}\r
-.prt .sbt .sbt_arw{\r
- padding:0 30px 0 20px;\r
- border-radius:5px 0 0 5px;\r
- background:url("nuc_but_bk_03.png") right top no-repeat #000;\r
-}\r
-.prt .sbt .sbt_sqr:hover{\r
- color:#ffde00;\r
- background:#292929;\r
-}\r
-.prt .sbt .sbt_arw:hover{\r
- color:#ffde00;\r
- background:url("nuc_but_bk_03.png") right top no-repeat #292929;\r
-}\r
-\r
-/* Text */\r
-#config_text{\r
- width:100%;\r
- height:50px;\r
- border:1px solid gray;\r
-}\r
-\r
-/* Footer */\r
-#footer{\r
- border-top:1px solid #999;\r
- text-align:right;\r
- height:25px;\r
- margin-top:10px;\r
- padding:5px 10px 0 0;\r
- font-size:77%;\r
-}\r
-\r
+/*
+ * style sheet for installer
+ *
+ * $Id:
+*/
+
+@charset 'UTF-8';
+/* CSS Document */
+
+/* Layout */
+body{
+ margin:0;
+ padding:0;
+ text-align:center;
+ color:#666;
+}
+#header{
+ width: 100%;
+ height:40px;
+ background:#000;
+ position: fixed;
+ top:0;
+ left:0;
+}
+#container,#container_detailed,#footer,#navigation{
+ margin:0 auto;
+ text-align:left;
+ border-width:0 1px;
+}
+#navigation{
+ width:800px;
+ height:40px;
+}
+#container,#container_detailed{
+ width:550px;
+ padding:40px 20px 0 30px;
+}
+#footer{
+ width:600px;
+}
+
+/* Common Settings */
+p{
+ margin:20px 0;
+}
+img{
+ border:none;
+}
+a{
+ text-decoration:none;
+}
+pre{
+ font-size: small;
+ line-height: 1em;
+ background-color:#eee;
+ border:1px solid gray;
+ padding: 2px;
+}
+.err{
+ display:block;
+ color:#c00;
+}
+
+/* Top navigation */
+#navigation h1{
+ width:120px;
+ height:35px;
+ margin:0 30px 0 0;
+ padding:4px 0 1px 0;
+ float:left;
+}
+#navigation ul{
+ margin:0 100px 0 0;
+ padding:18px 0 2px 0;
+ height:20px;
+ list-style-type:none;
+}
+#navigation li{
+ float:left;
+ font-size:93%;
+ height:20px;
+}
+#navigation li.rightbox{
+ float:right;
+}
+#navigation li,#navigation a{
+ color:#dedede;
+}
+#navigation li.gry{
+ color:#787878;
+}
+#navigation a:hover{
+ color:#fff;
+}
+
+/* Content */
+#container h2,#container_detailed h2{
+ line-height:20px;
+ height:20px;
+ margin:0 -20px 0 -30px;
+ padding:6px 0 4px 35px;
+ background:url("nuc_h2_bk.png") 4px 4px no-repeat #d0d0d0;
+ font-size:136%;
+ color:#454545;
+}
+
+/* Form table */
+.prt table{
+ width: 100%;
+ margin-bottom:20px;
+}
+.prt table th{
+ font-size:99%;
+ text-align:right;
+ width:135px;
+ height:40px;
+}
+.prt table th .nam{
+ margin:5px 0 0 0;
+ padding:5px 0 0 0;
+ height:15px;
+ line-height:15px;
+ font-weight:bold;
+ color:#454545;
+}
+.prt table th .sub{
+ display:block;
+ margin:0;
+ padding:0 0 5px 0;
+ height:10px;
+ line-height:10px;
+ font-size:65%;
+ font-weight:normal;
+ color:#666;
+}
+.prt table td input{
+ width:390px;
+ height:35px;
+ margin:0 0 0 5px;
+ font-size:182%;
+ font-weight:bold;
+ color:#333;
+ background:url("nuc_input_bk.png") no-repeat;
+ border:1px solid #999;
+ border-right-color:#ccc;
+ border-bottom-color:#ccc;
+}
+
+#container_detailed .prt table td input{
+ height:25px;
+ margin:0 0 0 5px;
+ font-size:122%;
+ font-weight:normal;
+ color:#000;
+}
+
+/* Select */
+.prt select{
+ width:510px;
+ height:35px;
+ line-height:35px;
+ margin:0 20px 10px 0;
+ font-size:152%;
+ font-weight:bold;
+ color:#333;
+ border:1px solid #999;
+ border-left-color:#ccc;
+ border-top-color:#ccc;
+ background:url("nuc_input_bk.png") no-repeat;
+}
+
+#container_detailed .prt select{
+ height:25px;
+ line-height:25px;
+ margin:0 20px 10px 0;
+ font-size:122%;
+}
+
+/* Button */
+.prt .sbt{
+ height:40px;
+ margin:10px 0;
+ text-align:center;
+}
+.prt .sbt .sbt_sqr,.prt .sbt .sbt_arw{
+ height:35px;
+ border:none;
+ background:#000;
+ color:#dedede;
+ font-size:136%;
+ font-weight:bold;
+}
+.prt .sbt .sbt_sqr{
+ padding:0 20px;
+ margin-right:5px;
+ border-radius:5px;
+}
+.prt .sbt .sbt_arw{
+ padding:0 30px 0 20px;
+ border-radius:5px 0 0 5px;
+ background:url("nuc_but_bk_03.png") right top no-repeat #000;
+}
+.prt .sbt .sbt_sqr:hover{
+ color:#ffde00;
+ background:#292929;
+}
+.prt .sbt .sbt_arw:hover{
+ color:#ffde00;
+ background:url("nuc_but_bk_03.png") right top no-repeat #292929;
+}
+
+/* Text */
+#config_text{
+ width:100%;
+ height:50px;
+ border:1px solid gray;
+}
+
+/* Footer */
+#footer{
+ border-top:1px solid #999;
+ text-align:right;
+ height:25px;
+ margin-top:10px;
+ padding:5px 10px 0 0;
+ font-size:77%;
+}
+
- GNU GENERAL PUBLIC LICENSE\r
- Version 2, June 1991\r
-\r
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.\r
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- Everyone is permitted to copy and distribute verbatim copies\r
- of this license document, but changing it is not allowed.\r
-\r
- Preamble\r
-\r
- The licenses for most software are designed to take away your\r
-freedom to share and change it. By contrast, the GNU General Public\r
-License is intended to guarantee your freedom to share and change free\r
-software--to make sure the software is free for all its users. This\r
-General Public License applies to most of the Free Software\r
-Foundation's software and to any other program whose authors commit to\r
-using it. (Some other Free Software Foundation software is covered by\r
-the GNU Library General Public License instead.) You can apply it to\r
-your programs, too.\r
-\r
- When we speak of free software, we are referring to freedom, not\r
-price. Our General Public Licenses are designed to make sure that you\r
-have the freedom to distribute copies of free software (and charge for\r
-this service if you wish), that you receive source code or can get it\r
-if you want it, that you can change the software or use pieces of it\r
-in new free programs; and that you know you can do these things.\r
-\r
- To protect your rights, we need to make restrictions that forbid\r
-anyone to deny you these rights or to ask you to surrender the rights.\r
-These restrictions translate to certain responsibilities for you if you\r
-distribute copies of the software, or if you modify it.\r
-\r
- For example, if you distribute copies of such a program, whether\r
-gratis or for a fee, you must give the recipients all the rights that\r
-you have. You must make sure that they, too, receive or can get the\r
-source code. And you must show them these terms so they know their\r
-rights.\r
-\r
- We protect your rights with two steps: (1) copyright the software, and\r
-(2) offer you this license which gives you legal permission to copy,\r
-distribute and/or modify the software.\r
-\r
- Also, for each author's protection and ours, we want to make certain\r
-that everyone understands that there is no warranty for this free\r
-software. If the software is modified by someone else and passed on, we\r
-want its recipients to know that what they have is not the original, so\r
-that any problems introduced by others will not reflect on the original\r
-authors' reputations.\r
-\r
- Finally, any free program is threatened constantly by software\r
-patents. We wish to avoid the danger that redistributors of a free\r
-program will individually obtain patent licenses, in effect making the\r
-program proprietary. To prevent this, we have made it clear that any\r
-patent must be licensed for everyone's free use or not licensed at all.\r
-\r
- The precise terms and conditions for copying, distribution and\r
-modification follow.\r
-\r
- GNU GENERAL PUBLIC LICENSE\r
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
-\r
- 0. This License applies to any program or other work which contains\r
-a notice placed by the copyright holder saying it may be distributed\r
-under the terms of this General Public License. The "Program", below,\r
-refers to any such program or work, and a "work based on the Program"\r
-means either the Program or any derivative work under copyright law:\r
-that is to say, a work containing the Program or a portion of it,\r
-either verbatim or with modifications and/or translated into another\r
-language. (Hereinafter, translation is included without limitation in\r
-the term "modification".) Each licensee is addressed as "you".\r
-\r
-Activities other than copying, distribution and modification are not\r
-covered by this License; they are outside its scope. The act of\r
-running the Program is not restricted, and the output from the Program\r
-is covered only if its contents constitute a work based on the\r
-Program (independent of having been made by running the Program).\r
-Whether that is true depends on what the Program does.\r
-\r
- 1. You may copy and distribute verbatim copies of the Program's\r
-source code as you receive it, in any medium, provided that you\r
-conspicuously and appropriately publish on each copy an appropriate\r
-copyright notice and disclaimer of warranty; keep intact all the\r
-notices that refer to this License and to the absence of any warranty;\r
-and give any other recipients of the Program a copy of this License\r
-along with the Program.\r
-\r
-You may charge a fee for the physical act of transferring a copy, and\r
-you may at your option offer warranty protection in exchange for a fee.\r
-\r
- 2. You may modify your copy or copies of the Program or any portion\r
-of it, thus forming a work based on the Program, and copy and\r
-distribute such modifications or work under the terms of Section 1\r
-above, provided that you also meet all of these conditions:\r
-\r
- a) You must cause the modified files to carry prominent notices\r
- stating that you changed the files and the date of any change.\r
-\r
- b) You must cause any work that you distribute or publish, that in\r
- whole or in part contains or is derived from the Program or any\r
- part thereof, to be licensed as a whole at no charge to all third\r
- parties under the terms of this License.\r
-\r
- c) If the modified program normally reads commands interactively\r
- when run, you must cause it, when started running for such\r
- interactive use in the most ordinary way, to print or display an\r
- announcement including an appropriate copyright notice and a\r
- notice that there is no warranty (or else, saying that you provide\r
- a warranty) and that users may redistribute the program under\r
- these conditions, and telling the user how to view a copy of this\r
- License. (Exception: if the Program itself is interactive but\r
- does not normally print such an announcement, your work based on\r
- the Program is not required to print an announcement.)\r
-\r
-These requirements apply to the modified work as a whole. If\r
-identifiable sections of that work are not derived from the Program,\r
-and can be reasonably considered independent and separate works in\r
-themselves, then this License, and its terms, do not apply to those\r
-sections when you distribute them as separate works. But when you\r
-distribute the same sections as part of a whole which is a work based\r
-on the Program, the distribution of the whole must be on the terms of\r
-this License, whose permissions for other licensees extend to the\r
-entire whole, and thus to each and every part regardless of who wrote it.\r
-\r
-Thus, it is not the intent of this section to claim rights or contest\r
-your rights to work written entirely by you; rather, the intent is to\r
-exercise the right to control the distribution of derivative or\r
-collective works based on the Program.\r
-\r
-In addition, mere aggregation of another work not based on the Program\r
-with the Program (or with a work based on the Program) on a volume of\r
-a storage or distribution medium does not bring the other work under\r
-the scope of this License.\r
-\r
- 3. You may copy and distribute the Program (or a work based on it,\r
-under Section 2) in object code or executable form under the terms of\r
-Sections 1 and 2 above provided that you also do one of the following:\r
-\r
- a) Accompany it with the complete corresponding machine-readable\r
- source code, which must be distributed under the terms of Sections\r
- 1 and 2 above on a medium customarily used for software interchange; or,\r
-\r
- b) Accompany it with a written offer, valid for at least three\r
- years, to give any third party, for a charge no more than your\r
- cost of physically performing source distribution, a complete\r
- machine-readable copy of the corresponding source code, to be\r
- distributed under the terms of Sections 1 and 2 above on a medium\r
- customarily used for software interchange; or,\r
-\r
- c) Accompany it with the information you received as to the offer\r
- to distribute corresponding source code. (This alternative is\r
- allowed only for noncommercial distribution and only if you\r
- received the program in object code or executable form with such\r
- an offer, in accord with Subsection b above.)\r
-\r
-The source code for a work means the preferred form of the work for\r
-making modifications to it. For an executable work, complete source\r
-code means all the source code for all modules it contains, plus any\r
-associated interface definition files, plus the scripts used to\r
-control compilation and installation of the executable. However, as a\r
-special exception, the source code distributed need not include\r
-anything that is normally distributed (in either source or binary\r
-form) with the major components (compiler, kernel, and so on) of the\r
-operating system on which the executable runs, unless that component\r
-itself accompanies the executable.\r
-\r
-If distribution of executable or object code is made by offering\r
-access to copy from a designated place, then offering equivalent\r
-access to copy the source code from the same place counts as\r
-distribution of the source code, even though third parties are not\r
-compelled to copy the source along with the object code.\r
-\r
- 4. You may not copy, modify, sublicense, or distribute the Program\r
-except as expressly provided under this License. Any attempt\r
-otherwise to copy, modify, sublicense or distribute the Program is\r
-void, and will automatically terminate your rights under this License.\r
-However, parties who have received copies, or rights, from you under\r
-this License will not have their licenses terminated so long as such\r
-parties remain in full compliance.\r
-\r
- 5. You are not required to accept this License, since you have not\r
-signed it. However, nothing else grants you permission to modify or\r
-distribute the Program or its derivative works. These actions are\r
-prohibited by law if you do not accept this License. Therefore, by\r
-modifying or distributing the Program (or any work based on the\r
-Program), you indicate your acceptance of this License to do so, and\r
-all its terms and conditions for copying, distributing or modifying\r
-the Program or works based on it.\r
-\r
- 6. Each time you redistribute the Program (or any work based on the\r
-Program), the recipient automatically receives a license from the\r
-original licensor to copy, distribute or modify the Program subject to\r
-these terms and conditions. You may not impose any further\r
-restrictions on the recipients' exercise of the rights granted herein.\r
-You are not responsible for enforcing compliance by third parties to\r
-this License.\r
-\r
- 7. If, as a consequence of a court judgment or allegation of patent\r
-infringement or for any other reason (not limited to patent issues),\r
-conditions are imposed on you (whether by court order, agreement or\r
-otherwise) that contradict the conditions of this License, they do not\r
-excuse you from the conditions of this License. If you cannot\r
-distribute so as to satisfy simultaneously your obligations under this\r
-License and any other pertinent obligations, then as a consequence you\r
-may not distribute the Program at all. For example, if a patent\r
-license would not permit royalty-free redistribution of the Program by\r
-all those who receive copies directly or indirectly through you, then\r
-the only way you could satisfy both it and this License would be to\r
-refrain entirely from distribution of the Program.\r
-\r
-If any portion of this section is held invalid or unenforceable under\r
-any particular circumstance, the balance of the section is intended to\r
-apply and the section as a whole is intended to apply in other\r
-circumstances.\r
-\r
-It is not the purpose of this section to induce you to infringe any\r
-patents or other property right claims or to contest validity of any\r
-such claims; this section has the sole purpose of protecting the\r
-integrity of the free software distribution system, which is\r
-implemented by public license practices. Many people have made\r
-generous contributions to the wide range of software distributed\r
-through that system in reliance on consistent application of that\r
-system; it is up to the author/donor to decide if he or she is willing\r
-to distribute software through any other system and a licensee cannot\r
-impose that choice.\r
-\r
-This section is intended to make thoroughly clear what is believed to\r
-be a consequence of the rest of this License.\r
-\r
- 8. If the distribution and/or use of the Program is restricted in\r
-certain countries either by patents or by copyrighted interfaces, the\r
-original copyright holder who places the Program under this License\r
-may add an explicit geographical distribution limitation excluding\r
-those countries, so that distribution is permitted only in or among\r
-countries not thus excluded. In such case, this License incorporates\r
-the limitation as if written in the body of this License.\r
-\r
- 9. The Free Software Foundation may publish revised and/or new versions\r
-of the General Public License from time to time. Such new versions will\r
-be similar in spirit to the present version, but may differ in detail to\r
-address new problems or concerns.\r
-\r
-Each version is given a distinguishing version number. If the Program\r
-specifies a version number of this License which applies to it and "any\r
-later version", you have the option of following the terms and conditions\r
-either of that version or of any later version published by the Free\r
-Software Foundation. If the Program does not specify a version number of\r
-this License, you may choose any version ever published by the Free Software\r
-Foundation.\r
-\r
- 10. If you wish to incorporate parts of the Program into other free\r
-programs whose distribution conditions are different, write to the author\r
-to ask for permission. For software which is copyrighted by the Free\r
-Software Foundation, write to the Free Software Foundation; we sometimes\r
-make exceptions for this. Our decision will be guided by the two goals\r
-of preserving the free status of all derivatives of our free software and\r
-of promoting the sharing and reuse of software generally.\r
-\r
- NO WARRANTY\r
-\r
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\r
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\r
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\r
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\r
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\r
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\r
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\r
-REPAIR OR CORRECTION.\r
-\r
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\r
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\r
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\r
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\r
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\r
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\r
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\r
-POSSIBILITY OF SUCH DAMAGES.\r
-\r
- END OF TERMS AND CONDITIONS\r
-\r
- How to Apply These Terms to Your New Programs\r
-\r
- If you develop a new program, and you want it to be of the greatest\r
-possible use to the public, the best way to achieve this is to make it\r
-free software which everyone can redistribute and change under these terms.\r
-\r
- To do so, attach the following notices to the program. It is safest\r
-to attach them to the start of each source file to most effectively\r
-convey the exclusion of warranty; and each file should have at least\r
-the "copyright" line and a pointer to where the full notice is found.\r
-\r
- <one line to give the program's name and a brief idea of what it does.>\r
- Copyright (C) <year> <name of author>\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-\r
-\r
-Also add information on how to contact you by electronic and paper mail.\r
-\r
-If the program is interactive, make it output a short notice like this\r
-when it starts in an interactive mode:\r
-\r
- Gnomovision version 69, Copyright (C) year name of author\r
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\r
- This is free software, and you are welcome to redistribute it\r
- under certain conditions; type `show c' for details.\r
-\r
-The hypothetical commands `show w' and `show c' should show the appropriate\r
-parts of the General Public License. Of course, the commands you use may\r
-be called something other than `show w' and `show c'; they could even be\r
-mouse-clicks or menu items--whatever suits your program.\r
-\r
-You should also get your employer (if you work as a programmer) or your\r
-school, if any, to sign a "copyright disclaimer" for the program, if\r
-necessary. Here is a sample; alter the names:\r
-\r
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program\r
- `Gnomovision' (which makes passes at compilers) written by James Hacker.\r
-\r
- <signature of Ty Coon>, 1 April 1989\r
- Ty Coon, President of Vice\r
-\r
-This General Public License does not permit incorporating your program into\r
-proprietary programs. If your program is a subroutine library, you may\r
-consider it more useful to permit linking proprietary applications with the\r
-library. If this is what you want to do, use the GNU Library General\r
-Public License instead of this License.\r
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: blogger.php 846 2005-12-30 10:38:32Z dekarma $
+ * @version $Id: blogger.php 1692 2012-03-10 11:22:09Z sakamocchi $
*/
include("../../config.php");
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: bloggercaif.php 1624 2012-01-09 11:36:20Z sakamocchi $
+ * @version $Id: bloggercaif.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
include("../../config.php");
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: functions.inc.php 1624 2012-01-09 11:36:20Z sakamocchi $
+ * @version $Id: functions.inc.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
// try to set a long timeout time
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: genericImport.php 846 2005-12-30 10:38:32Z dekarma $
+ * @version $Id: genericImport.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
include("../../config.php");
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: greymatter.php 1624 2012-01-09 11:36:20Z sakamocchi $
+ * @version $Id: greymatter.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
include("../../config.php");
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: livejournal.php 1624 2012-01-09 11:36:20Z sakamocchi $
+ * @version $Id: livejournal.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
include("../../config.php");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
- <!-- $Id: plugins.html 1545 2011-06-28 21:31:37Z ftruscot $ -->
+ <!-- $Id: plugins.html 1721 2012-03-31 10:18:25Z sakamocchi $ -->
<title>Nucleus - Plugin API</title>
<link rel="stylesheet" type="text/css" href="styles/manual.css" />
<style type="text/css">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
- <!-- $Id: sqltables.html 1457 2010-10-26 15:47:41Z ftruscot $ -->
+ <!-- $Id: sqltables.html 1686 2012-03-01 15:29:57Z sakamocchi $ -->
<title>Nucleus - SQL Table Structure</title>
<link rel="stylesheet" type="text/css" href="styles/manual.css" />
<style type="text/css">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <!-- $Id: help.html 1500 2011-03-01 19:32:53Z ftruscot $ -->
+ <!-- $Id: help.html 1889 2012-06-17 08:46:45Z sakamocchi $ -->
<title>Nucleus Admin Help</title>
<style type="text/css">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us">
<head>
- <!-- $Id: history.html 1594 2011-11-01 20:18:32Z ftruscot $ -->
+ <!-- $Id: history.html 1721 2012-03-31 10:18:25Z sakamocchi $ -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <!-- $Id: index.html 1457 2010-10-26 15:47:41Z ftruscot $ -->
+ <!-- $Id: index.html 1678 2012-02-26 07:31:36Z sakamocchi $ -->
<title>Nucleus CMS - Manual</title>
<link rel="stylesheet" type="text/css" href="styles/manual.css" />
</head>
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-20011 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-\r
-/**\r
- * Registration form for new users\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-20011 The Nucleus Group\r
- * @version $Id: createaccount.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
- */\r
-\r
-// we are using admin stuff:\r
-$CONF = array();\r
-$CONF['UsingAdminArea'] = 1;\r
-\r
-require_once "../config.php";\r
-include_libs('ACTION.php');\r
-\r
-if ( !Admin::initialize() )\r
-{\r
- /* TODO: something to handling errors */\r
- exit;\r
-}\r
-\r
-Admin::action('forgotpassword');\r
-exit;\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-20011 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+
+/**
+ * Registration form for new users
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-20011 The Nucleus Group
+ * @version $Id: forgotpassword.php 1888 2012-06-17 08:38:54Z sakamocchi $
+ */
+
+// we are using admin stuff:
+$CONF = array();
+$CONF['UsingAdminArea'] = 1;
+
+require_once "../config.php";
+include_libs('ACTION.php');
+
+if ( !Admin::initialize() )
+{
+ /* TODO: something to handling errors */
+ exit;
+}
+
+Admin::action('forgotpassword');
+exit;
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: index.php 1748 2012-04-13 13:27:57Z sakamocchi $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: index.php 1888 2012-06-17 08:38:54Z sakamocchi $
*/
// we are using admin stuff:
-Order allow,deny\r
-Deny from all\r
+Order allow,deny
+Deny from all
\ No newline at end of file
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Actions that can be called via action.php\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: ACTION.php 1646 2012-01-29 10:47:32Z sakamocchi $\r
- */\r
-class Action\r
-{\r
- /**\r
- * Action::__construct()\r
- * Constructor for an new ACTION object\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function __construct()\r
- {\r
- return;\r
- }\r
- \r
- /**\r
- * Action::doAction()\r
- * Calls functions that handle an action called from action.php\r
- * \r
- * @param string $action action type\r
- * @return mixed\r
- */\r
- public function doAction($action)\r
- {\r
- switch ( $action )\r
- {\r
- case 'autodraft':\r
- return $this->autoDraft();\r
- break;\r
- case 'updateticket':\r
- return $this->updateTicket();\r
- break;\r
- case 'addcomment':\r
- return $this->addComment();\r
- break;\r
- case 'sendmessage':\r
- return $this->sendMessage();\r
- break;\r
- case 'createaccount':\r
- return $this->createAccount();\r
- break;\r
- case 'forgotpassword':\r
- return $this->forgotPassword();\r
- break;\r
- case 'votepositive':\r
- return $this->doKarma('pos');\r
- break;\r
- case 'votenegative':\r
- return $this->doKarma('neg');\r
- break;\r
- case 'plugin':\r
- return $this->callPlugin();\r
- break;\r
- default:\r
- doError(_ERROR_BADACTION);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Action::addComment()\r
- * Adds a new comment to an item (if IP isn't banned)\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function addComment()\r
- {\r
- global $CONF, $errormessage, $manager;\r
- \r
- $post['itemid'] = intPostVar('itemid');\r
- $post['user'] = postVar('user');\r
- $post['userid'] = postVar('userid');\r
- $post['email'] = postVar('email');\r
- $post['body'] = postVar('body');\r
- $post['remember'] = intPostVar('remember');\r
- \r
- // begin if: "Remember Me" box checked\r
- if ( $post['remember'] == 1 )\r
- {\r
- $lifetime = time() + 2592000;\r
- setcookie($CONF['CookiePrefix'] . 'comment_user', $post['user'], $lifetime, '/', '', 0);\r
- setcookie($CONF['CookiePrefix'] . 'comment_userid', $post['userid'], $lifetime, '/', '', 0);\r
- setcookie($CONF['CookiePrefix'] . 'comment_email', $post['email'], $lifetime, '/', '', 0);\r
- }\r
- \r
- $item =& $manager->getItem($post['itemid'], 0, 0);\r
- $this->checkban($item['blogid']);\r
- $blog =& $manager->getBlog($item['blogid']);\r
- \r
- // note: PreAddComment and PostAddComment gets called somewhere inside addComment\r
- $comments = new Comments($post['itemid']);\r
- $errormessage = $comments->addComment($blog->getCorrectTime(), $post);\r
- \r
- if ( $errormessage != '1' )\r
- {\r
- // show error message using default skin for blo\r
- return array(\r
- 'message' => $errormessage,\r
- 'skinid' => $blog->getDefaultSkin()\r
- );\r
- }\r
- else\r
- {\r
- // redirect when adding comments succeeded\r
- if ( postVar('url') )\r
- {\r
- redirect(postVar('url') );\r
- }\r
- else\r
- {\r
- $url = Link::create_item_link($post['itemid']);\r
- redirect($url);\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Action::sendMessage()\r
- * Sends a message from the current member to the member given as argument\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function sendMessage()\r
- {\r
- global $CONF, $member;\r
- \r
- $error = $this->validateMessage();\r
- \r
- if ( $error != '' )\r
- {\r
- return array('message' => $error);\r
- }\r
- \r
- if ( !$member->isLoggedIn() )\r
- {\r
- $fromMail = postVar('frommail');\r
- $fromName = _MMAIL_FROMANON;\r
- }\r
- else\r
- {\r
- $fromMail = $member->getEmail();\r
- $fromName = $member->getDisplayName();\r
- }\r
- \r
- /* TODO: validation */\r
- $memberid = postVar('memberid');\r
- $tomem = new Member();\r
- $tomem->readFromId($memberid);\r
- \r
- /* TODO: validation */\r
- $message = postVar('message');\r
- $message = _MMAIL_MSG . ' ' . $fromName . "\n"\r
- . '(' . _MMAIL_FROMNUC. ' ' . $CONF['IndexURL'] .") \n\n"\r
- . _MMAIL_MAIL . " \n\n"\r
- . $message;\r
- $message .= Notification::get_mail_footer();\r
- \r
- $title = _MMAIL_TITLE . ' ' . $fromName;\r
- Notification::mail($tomem->getEmail(), $title, $message, $fromMail, i18n::get_current_charset());\r
- \r
- /* TODO: validation */\r
- $url = postVar('url');\r
- if ( empty($url) )\r
- {\r
- $CONF['MemberURL'] = $CONF['IndexURL'];\r
- \r
- if ( $CONF['URLMode'] == 'pathinfo' )\r
- {\r
- $data = array(\r
- 'memberid' => $tomem->getID(),\r
- 'name' => $tomem->getDisplayName()\r
- );\r
- $url = Link::create_link('member', $data);\r
- }\r
- else\r
- {\r
- $url = $CONF['IndexURL'] . Link::create_member_link($tomem->getID());\r
- }\r
- }\r
- redirect($url );\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Action::validateMessage()\r
- * Checks if a mail to a member is allowed\r
- * Returns a string with the error message if the mail is disallowed\r
- * \r
- * @param void\r
- * @return String Null character string\r
- */\r
- private function validateMessage()\r
- {\r
- global $CONF, $member, $manager;\r
- \r
- if ( !$CONF['AllowMemberMail'] )\r
- {\r
- return _ERROR_MEMBERMAILDISABLED;\r
- }\r
- \r
- if ( !$member->isLoggedIn() && !$CONF['NonmemberMail'] )\r
- {\r
- return _ERROR_DISALLOWED;\r
- }\r
- \r
- if ( !$member->isLoggedIn() && !Notification::address_validation(postVar('frommail')) )\r
- {\r
- return _ERROR_BADMAILADDRESS;\r
- }\r
- \r
- /*\r
- * let plugins do verification (any plugin which thinks the comment is\r
- * invalid can change 'error' to something other than '')\r
- */\r
- $result = '';\r
- $data = array(\r
- 'type' => 'membermail',\r
- 'error' => &$result\r
- );\r
- $manager->notify('ValidateForm', $data);\r
- \r
- return $result;\r
- }\r
- \r
- /**\r
- * Action::createAccount()\r
- * Creates a new user account\r
- * \r
- * @param void\r
- * @return mixed\r
- */\r
- private function createAccount()\r
- {\r
- global $CONF, $manager;\r
- \r
- if ( array_key_exists('AllowMemberCreate', $CONF) && !$CONF['AllowMemberCreate'] )\r
- {\r
- doError(_ERROR_MEMBERCREATEDISABLED);\r
- return;\r
- }\r
- \r
- // evaluate content from FormExtra\r
- $result = 1;\r
- $data = array(\r
- 'type' => 'membermail',\r
- 'error' => &$result\r
- );\r
- $manager->notify('ValidateForm', $data);\r
- \r
- if ( $result != 1 )\r
- {\r
- return $result;\r
- }\r
- \r
- // even though the member can not log in, set some random initial password. One never knows.\r
- srand((double) microtime() * 1000000);\r
- $initialPwd = md5(uniqid(rand(), TRUE) );\r
- \r
- // create member (non admin/can not login/no notes/random string as password)\r
- $name = Entity::shorten(postVar('name'), 32, '');\r
- $relname = postVar('realname');\r
- $email = postVar('email');\r
- $url = postVar('url');\r
- \r
- $r = Member::create($name, $realname, $initialPwd, $email, $url, 0, 0, '');\r
- \r
- if ( $r != 1 )\r
- {\r
- return $r;\r
- }\r
- \r
- // send message containing password.\r
- $newmem = new Member();\r
- $newmem->readFromName($name);\r
- $newmem->sendActivationLink('register');\r
- \r
- $manager->notify('PostRegister', array('member' => &$newmem) );\r
- \r
- if ( postVar('desturl') )\r
- {\r
- redirect(postVar('desturl') );\r
- }\r
- \r
- return 1;\r
- }\r
- \r
- /**\r
- * Action::forgotPassword()\r
- * Sends a new password\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function forgotPassword()\r
- {\r
- $membername = trim(postVar('name') );\r
- \r
- if ( !Member::exists($membername) )\r
- {\r
- doError(_ERROR_NOSUCHMEMBER);\r
- return;\r
- }\r
- \r
- $mem = Member::createFromName($membername);\r
- \r
- // check if e-mail address is correct\r
- $email = postVar('email');\r
- if ( $mem->getEmail() != $email )\r
- {\r
- doError(_ERROR_INCORRECTEMAIL);\r
- return;\r
- }\r
- \r
- // send activation link\r
- $mem->sendActivationLink('forgot');\r
- \r
- // redirection\r
- $url = postVar('url');\r
- if ( !empty($url) )\r
- {\r
- redirect(postVar('url') );\r
- }\r
- else\r
- {\r
- echo _MSG_ACTIVATION_SENT;\r
- echo "<br />"\r
- . "<br />"\r
- . "Return to <a href=\"{$CONF['IndexURL']}\" title=\"{$CONF['SiteName']}\">{$CONF['SiteName']}</a>\n";\r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Action::doKarma()\r
- * Handle karma votes\r
- * \r
- * @param string $type pos or neg\r
- * @return Void\r
- */\r
- private function doKarma($type)\r
- {\r
- global $itemid, $member, $CONF, $manager;\r
- \r
- // check if itemid exists\r
- if ( !$manager->existsItem($itemid, 0, 0) )\r
- {\r
- doError(_ERROR_NOSUCHITEM);\r
- return;\r
- }\r
- \r
- $item =& $manager->getItem($itemid, 0, 0);\r
- $this->checkban($item['blogid']);\r
- \r
- $karma =& $manager->getKarma($itemid);\r
- \r
- // check if not already voted\r
- if ( !$karma->isVoteAllowed(serverVar('REMOTE_ADDR') ) )\r
- {\r
- doError(_ERROR_VOTEDBEFORE);\r
- return;\r
- }\r
- \r
- // check if item does allow voting\r
- $item =& $manager->getItem($itemid, 0, 0);\r
- \r
- if ( $item['closed'] )\r
- {\r
- doError(_ERROR_ITEMCLOSED);\r
- return;\r
- }\r
- \r
- switch ( $type )\r
- {\r
- case 'pos':\r
- $karma->votePositive();\r
- break;\r
- \r
- case 'neg':\r
- $karma->voteNegative();\r
- break;\r
- }\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- \r
- // send email to notification address, if any\r
- if ( $blog->getNotifyAddress() && $blog->notifyOnVote() )\r
- {\r
- $message = _NOTIFY_KV_MSG . ' ' . $itemid . "\n";\r
- $itemLink = Link::create_item_link((integer)$itemid);\r
- $temp = parse_url($itemLink);\r
- \r
- if ( !$temp['scheme'] )\r
- {\r
- $itemLink = $CONF['IndexURL'] . $itemLink;\r
- }\r
- \r
- $message .= $itemLink . "\n\n";\r
- \r
- if ( $member->isLoggedIn() )\r
- {\r
- $message .= _NOTIFY_MEMBER . ' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";\r
- }\r
- \r
- $message .= _NOTIFY_IP . ' ' . serverVar('REMOTE_ADDR') . "\n";\r
- $message .= _NOTIFY_HOST . ' ' . gethostbyaddr(serverVar('REMOTE_ADDR')) . "\n";\r
- $message .= _NOTIFY_VOTE . "\n " . $type . "\n";\r
- $message .= Notification::get_mail_footer();\r
- \r
- $subject = _NOTIFY_KV_TITLE . ' ' . strip_tags($item['title']) . ' (' . $itemid . ')';\r
- \r
- $from = $member->getNotifyFromMailAddress();\r
- \r
- Notification::mail($blog->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());\r
- }\r
- \r
- $refererUrl = serverVar('HTTP_REFERER');\r
- \r
- if ( !$refererUrl )\r
- {\r
- $url = $itemLink;\r
- }\r
- else\r
- {\r
- $url = $refererUrl;\r
- }\r
- \r
- redirect($url);\r
- return;\r
- }\r
- \r
- /**\r
- * Action::callPlugin()\r
- * Calls a plugin action\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function callPlugin()\r
- {\r
- global $manager;\r
- \r
- $name = requestVar('name');\r
- $pluginName = "NP_{$name}";\r
- $actionType = requestVar('type');\r
- \r
- // 1: check if plugin is installed\r
- if ( !$manager->pluginInstalled($pluginName) )\r
- {\r
- doError(_ERROR_NOSUCHPLUGIN);\r
- return;\r
- }\r
- \r
- // 2: call plugin\r
- $pluginObject =& $manager->getPlugin($pluginName);\r
- if ( !$pluginObject )\r
- {\r
- $error = 'Could not load plugin (see actionlog)';\r
- }\r
- else\r
- {\r
- $error = $pluginObject->doAction($actionType);\r
- }\r
- \r
- /*\r
- * doAction returns error when:\r
- * - an error occurred (duh)\r
- * - no actions are allowed (doAction is not implemented)\r
- */\r
- if ( $error )\r
- {\r
- doError($error);\r
- return;\r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Action::checkban()\r
- * Checks if an IP or IP range is banned\r
- * \r
- * @param integer $blogid\r
- * @return void\r
- */\r
- private function checkban($blogid)\r
- {\r
- // check if banned\r
- $ban = Ban::isBanned($blogid, serverVar('REMOTE_ADDR') );\r
- \r
- if ( $ban != 0 )\r
- {\r
- doError(_ERROR_BANNED1 . $ban->iprange . _ERROR_BANNED2 . $ban->message . _ERROR_BANNED3);\r
- return;\r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Action::updateTicket()\r
- * Gets a new ticket\r
- * \r
- * @param void\r
- * @return boolean FALSE\r
- */\r
- private function updateTicket()\r
- {\r
- global $manager;\r
- \r
- if ( !$manager->checkTicket() )\r
- {\r
- echo _ERROR . ':' . _ERROR_BADTICKET;\r
- }\r
- else\r
- {\r
- echo $manager->getNewTicket();\r
- }\r
- \r
- return FALSE;\r
- }\r
- \r
- /**\r
- * Action::autoDraft()\r
- * Handles AutoSaveDraft\r
- * \r
- * @param void\r
- * @return boolean FALSE\r
- */\r
- private function autoDraft()\r
- {\r
- global $manager;\r
- \r
- if ( !$manager->checkTicket() )\r
- {\r
- echo _ERROR . ':' . _ERROR_BADTICKET;\r
- }\r
- else\r
- {\r
- $manager->loadClass('ITEM');\r
- $info = Item::createDraftFromRequest();\r
- \r
- if ( $info['status'] != 'error' )\r
- {\r
- echo $info['draftid'];\r
- }\r
- else\r
- {\r
- echo $info['message'];\r
- }\r
- }\r
- \r
- return FALSE;\r
- }\r
-}\r
-\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Actions that can be called via action.php
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: ACTION.php 1646 2012-01-29 10:47:32Z sakamocchi $
+ */
+class Action
+{
+ /**
+ * Action::__construct()
+ * Constructor for an new ACTION object
+ *
+ * @param void
+ * @return void
+ */
+ public function __construct()
+ {
+ return;
+ }
+
+ /**
+ * Action::doAction()
+ * Calls functions that handle an action called from action.php
+ *
+ * @param string $action action type
+ * @return mixed
+ */
+ public function doAction($action)
+ {
+ switch ( $action )
+ {
+ case 'autodraft':
+ return $this->autoDraft();
+ break;
+ case 'updateticket':
+ return $this->updateTicket();
+ break;
+ case 'addcomment':
+ return $this->addComment();
+ break;
+ case 'sendmessage':
+ return $this->sendMessage();
+ break;
+ case 'createaccount':
+ return $this->createAccount();
+ break;
+ case 'forgotpassword':
+ return $this->forgotPassword();
+ break;
+ case 'votepositive':
+ return $this->doKarma('pos');
+ break;
+ case 'votenegative':
+ return $this->doKarma('neg');
+ break;
+ case 'plugin':
+ return $this->callPlugin();
+ break;
+ default:
+ doError(_ERROR_BADACTION);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Action::addComment()
+ * Adds a new comment to an item (if IP isn't banned)
+ *
+ * @param void
+ * @return void
+ */
+ private function addComment()
+ {
+ global $CONF, $errormessage, $manager;
+
+ $post['itemid'] = intPostVar('itemid');
+ $post['user'] = postVar('user');
+ $post['userid'] = postVar('userid');
+ $post['email'] = postVar('email');
+ $post['body'] = postVar('body');
+ $post['remember'] = intPostVar('remember');
+
+ // begin if: "Remember Me" box checked
+ if ( $post['remember'] == 1 )
+ {
+ $lifetime = time() + 2592000;
+ setcookie($CONF['CookiePrefix'] . 'comment_user', $post['user'], $lifetime, '/', '', 0);
+ setcookie($CONF['CookiePrefix'] . 'comment_userid', $post['userid'], $lifetime, '/', '', 0);
+ setcookie($CONF['CookiePrefix'] . 'comment_email', $post['email'], $lifetime, '/', '', 0);
+ }
+
+ $item =& $manager->getItem($post['itemid'], 0, 0);
+ $this->checkban($item['blogid']);
+ $blog =& $manager->getBlog($item['blogid']);
+
+ // note: PreAddComment and PostAddComment gets called somewhere inside addComment
+ $comments = new Comments($post['itemid']);
+ $errormessage = $comments->addComment($blog->getCorrectTime(), $post);
+
+ if ( $errormessage != '1' )
+ {
+ // show error message using default skin for blo
+ return array(
+ 'message' => $errormessage,
+ 'skinid' => $blog->getDefaultSkin()
+ );
+ }
+ else
+ {
+ // redirect when adding comments succeeded
+ if ( postVar('url') )
+ {
+ redirect(postVar('url') );
+ }
+ else
+ {
+ $url = Link::create_item_link($post['itemid']);
+ redirect($url);
+ }
+ }
+ return;
+ }
+
+ /**
+ * Action::sendMessage()
+ * Sends a message from the current member to the member given as argument
+ *
+ * @param void
+ * @return void
+ */
+ private function sendMessage()
+ {
+ global $CONF, $member;
+
+ $error = $this->validateMessage();
+
+ if ( $error != '' )
+ {
+ return array('message' => $error);
+ }
+
+ if ( !$member->isLoggedIn() )
+ {
+ $fromMail = postVar('frommail');
+ $fromName = _MMAIL_FROMANON;
+ }
+ else
+ {
+ $fromMail = $member->getEmail();
+ $fromName = $member->getDisplayName();
+ }
+
+ /* TODO: validation */
+ $memberid = postVar('memberid');
+ $tomem = new Member();
+ $tomem->readFromId($memberid);
+
+ /* TODO: validation */
+ $message = postVar('message');
+ $message = _MMAIL_MSG . ' ' . $fromName . "\n"
+ . '(' . _MMAIL_FROMNUC. ' ' . $CONF['IndexURL'] .") \n\n"
+ . _MMAIL_MAIL . " \n\n"
+ . $message;
+ $message .= Notification::get_mail_footer();
+
+ $title = _MMAIL_TITLE . ' ' . $fromName;
+ Notification::mail($tomem->getEmail(), $title, $message, $fromMail, i18n::get_current_charset());
+
+ /* TODO: validation */
+ $url = postVar('url');
+ if ( empty($url) )
+ {
+ $CONF['MemberURL'] = $CONF['IndexURL'];
+
+ if ( $CONF['URLMode'] == 'pathinfo' )
+ {
+ $data = array(
+ 'memberid' => $tomem->getID(),
+ 'name' => $tomem->getDisplayName()
+ );
+ $url = Link::create_link('member', $data);
+ }
+ else
+ {
+ $url = $CONF['IndexURL'] . Link::create_member_link($tomem->getID());
+ }
+ }
+ redirect($url );
+
+ return;
+ }
+
+ /**
+ * Action::validateMessage()
+ * Checks if a mail to a member is allowed
+ * Returns a string with the error message if the mail is disallowed
+ *
+ * @param void
+ * @return String Null character string
+ */
+ private function validateMessage()
+ {
+ global $CONF, $member, $manager;
+
+ if ( !$CONF['AllowMemberMail'] )
+ {
+ return _ERROR_MEMBERMAILDISABLED;
+ }
+
+ if ( !$member->isLoggedIn() && !$CONF['NonmemberMail'] )
+ {
+ return _ERROR_DISALLOWED;
+ }
+
+ if ( !$member->isLoggedIn() && !Notification::address_validation(postVar('frommail')) )
+ {
+ return _ERROR_BADMAILADDRESS;
+ }
+
+ /*
+ * let plugins do verification (any plugin which thinks the comment is
+ * invalid can change 'error' to something other than '')
+ */
+ $result = '';
+ $data = array(
+ 'type' => 'membermail',
+ 'error' => &$result
+ );
+ $manager->notify('ValidateForm', $data);
+
+ return $result;
+ }
+
+ /**
+ * Action::createAccount()
+ * Creates a new user account
+ *
+ * @param void
+ * @return mixed
+ */
+ private function createAccount()
+ {
+ global $CONF, $manager;
+
+ if ( array_key_exists('AllowMemberCreate', $CONF) && !$CONF['AllowMemberCreate'] )
+ {
+ doError(_ERROR_MEMBERCREATEDISABLED);
+ return;
+ }
+
+ // evaluate content from FormExtra
+ $result = 1;
+ $data = array(
+ 'type' => 'membermail',
+ 'error' => &$result
+ );
+ $manager->notify('ValidateForm', $data);
+
+ if ( $result != 1 )
+ {
+ return $result;
+ }
+
+ // even though the member can not log in, set some random initial password. One never knows.
+ srand((double) microtime() * 1000000);
+ $initialPwd = md5(uniqid(rand(), TRUE) );
+
+ // create member (non admin/can not login/no notes/random string as password)
+ $name = Entity::shorten(postVar('name'), 32, '');
+ $relname = postVar('realname');
+ $email = postVar('email');
+ $url = postVar('url');
+
+ $r = Member::create($name, $realname, $initialPwd, $email, $url, 0, 0, '');
+
+ if ( $r != 1 )
+ {
+ return $r;
+ }
+
+ // send message containing password.
+ $newmem = new Member();
+ $newmem->readFromName($name);
+ $newmem->sendActivationLink('register');
+
+ $manager->notify('PostRegister', array('member' => &$newmem) );
+
+ if ( postVar('desturl') )
+ {
+ redirect(postVar('desturl') );
+ }
+
+ return 1;
+ }
+
+ /**
+ * Action::forgotPassword()
+ * Sends a new password
+ *
+ * @param void
+ * @return void
+ */
+ private function forgotPassword()
+ {
+ $membername = trim(postVar('name') );
+
+ if ( !Member::exists($membername) )
+ {
+ doError(_ERROR_NOSUCHMEMBER);
+ return;
+ }
+
+ $mem = Member::createFromName($membername);
+
+ // check if e-mail address is correct
+ $email = postVar('email');
+ if ( $mem->getEmail() != $email )
+ {
+ doError(_ERROR_INCORRECTEMAIL);
+ return;
+ }
+
+ // send activation link
+ $mem->sendActivationLink('forgot');
+
+ // redirection
+ $url = postVar('url');
+ if ( !empty($url) )
+ {
+ redirect(postVar('url') );
+ }
+ else
+ {
+ echo _MSG_ACTIVATION_SENT;
+ echo "<br />"
+ . "<br />"
+ . "Return to <a href=\"{$CONF['IndexURL']}\" title=\"{$CONF['SiteName']}\">{$CONF['SiteName']}</a>\n";
+ }
+
+ return;
+ }
+
+ /**
+ * Action::doKarma()
+ * Handle karma votes
+ *
+ * @param string $type pos or neg
+ * @return Void
+ */
+ private function doKarma($type)
+ {
+ global $itemid, $member, $CONF, $manager;
+
+ // check if itemid exists
+ if ( !$manager->existsItem($itemid, 0, 0) )
+ {
+ doError(_ERROR_NOSUCHITEM);
+ return;
+ }
+
+ $item =& $manager->getItem($itemid, 0, 0);
+ $this->checkban($item['blogid']);
+
+ $karma =& $manager->getKarma($itemid);
+
+ // check if not already voted
+ if ( !$karma->isVoteAllowed(serverVar('REMOTE_ADDR') ) )
+ {
+ doError(_ERROR_VOTEDBEFORE);
+ return;
+ }
+
+ // check if item does allow voting
+ $item =& $manager->getItem($itemid, 0, 0);
+
+ if ( $item['closed'] )
+ {
+ doError(_ERROR_ITEMCLOSED);
+ return;
+ }
+
+ switch ( $type )
+ {
+ case 'pos':
+ $karma->votePositive();
+ break;
+
+ case 'neg':
+ $karma->voteNegative();
+ break;
+ }
+
+ $blog =& $manager->getBlog($blogid);
+
+ // send email to notification address, if any
+ if ( $blog->getNotifyAddress() && $blog->notifyOnVote() )
+ {
+ $message = _NOTIFY_KV_MSG . ' ' . $itemid . "\n";
+ $itemLink = Link::create_item_link((integer)$itemid);
+ $temp = parse_url($itemLink);
+
+ if ( !$temp['scheme'] )
+ {
+ $itemLink = $CONF['IndexURL'] . $itemLink;
+ }
+
+ $message .= $itemLink . "\n\n";
+
+ if ( $member->isLoggedIn() )
+ {
+ $message .= _NOTIFY_MEMBER . ' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";
+ }
+
+ $message .= _NOTIFY_IP . ' ' . serverVar('REMOTE_ADDR') . "\n";
+ $message .= _NOTIFY_HOST . ' ' . gethostbyaddr(serverVar('REMOTE_ADDR')) . "\n";
+ $message .= _NOTIFY_VOTE . "\n " . $type . "\n";
+ $message .= Notification::get_mail_footer();
+
+ $subject = _NOTIFY_KV_TITLE . ' ' . strip_tags($item['title']) . ' (' . $itemid . ')';
+
+ $from = $member->getNotifyFromMailAddress();
+
+ Notification::mail($blog->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());
+ }
+
+ $refererUrl = serverVar('HTTP_REFERER');
+
+ if ( !$refererUrl )
+ {
+ $url = $itemLink;
+ }
+ else
+ {
+ $url = $refererUrl;
+ }
+
+ redirect($url);
+ return;
+ }
+
+ /**
+ * Action::callPlugin()
+ * Calls a plugin action
+ *
+ * @param void
+ * @return void
+ */
+ private function callPlugin()
+ {
+ global $manager;
+
+ $name = requestVar('name');
+ $pluginName = "NP_{$name}";
+ $actionType = requestVar('type');
+
+ // 1: check if plugin is installed
+ if ( !$manager->pluginInstalled($pluginName) )
+ {
+ doError(_ERROR_NOSUCHPLUGIN);
+ return;
+ }
+
+ // 2: call plugin
+ $pluginObject =& $manager->getPlugin($pluginName);
+ if ( !$pluginObject )
+ {
+ $error = 'Could not load plugin (see actionlog)';
+ }
+ else
+ {
+ $error = $pluginObject->doAction($actionType);
+ }
+
+ /*
+ * doAction returns error when:
+ * - an error occurred (duh)
+ * - no actions are allowed (doAction is not implemented)
+ */
+ if ( $error )
+ {
+ doError($error);
+ return;
+ }
+
+ return;
+ }
+
+ /**
+ * Action::checkban()
+ * Checks if an IP or IP range is banned
+ *
+ * @param integer $blogid
+ * @return void
+ */
+ private function checkban($blogid)
+ {
+ // check if banned
+ $ban = Ban::isBanned($blogid, serverVar('REMOTE_ADDR') );
+
+ if ( $ban != 0 )
+ {
+ doError(_ERROR_BANNED1 . $ban->iprange . _ERROR_BANNED2 . $ban->message . _ERROR_BANNED3);
+ return;
+ }
+
+ return;
+ }
+
+ /**
+ * Action::updateTicket()
+ * Gets a new ticket
+ *
+ * @param void
+ * @return boolean FALSE
+ */
+ private function updateTicket()
+ {
+ global $manager;
+
+ if ( !$manager->checkTicket() )
+ {
+ echo _ERROR . ':' . _ERROR_BADTICKET;
+ }
+ else
+ {
+ echo $manager->getNewTicket();
+ }
+
+ return FALSE;
+ }
+
+ /**
+ * Action::autoDraft()
+ * Handles AutoSaveDraft
+ *
+ * @param void
+ * @return boolean FALSE
+ */
+ private function autoDraft()
+ {
+ global $manager;
+
+ if ( !$manager->checkTicket() )
+ {
+ echo _ERROR . ':' . _ERROR_BADTICKET;
+ }
+ else
+ {
+ $manager->loadClass('ITEM');
+ $info = Item::createDraftFromRequest();
+
+ if ( $info['status'] != 'error' )
+ {
+ echo $info['draftid'];
+ }
+ else
+ {
+ echo $info['message'];
+ }
+ }
+
+ return FALSE;
+ }
+}
+
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Actionlog class for Nucleus\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: ACTIONLOG.php 1470 2010-11-29 22:10:16Z ftruscot $\r
- */\r
-define('ERROR',1); // only errors\r
-define('WARNING',2); // errors and warnings\r
-define('INFO',3); // info, errors and warnings\r
-define('DEBUG',4); // everything\r
-$CONF['LogLevel'] = INFO;\r
-\r
-class ActionLog\r
-{\r
- /**\r
- * ActionLog::add()\r
- * Method to add a message to the action log\r
- * \r
- * @static\r
- * @param Integer $level log level\r
- * @param String $message log message\r
- * @return \r
- * \r
- */\r
- function add($level, $message)\r
- {\r
- global $member, $CONF;\r
- \r
- if ( $CONF['LogLevel'] < $level )\r
- {\r
- return;\r
- }\r
- \r
- if ( $member && $member->isLoggedIn() )\r
- {\r
- $message = "[" . $member->getDisplayName() . "] " . $message;\r
- }\r
- \r
- $query = "INSERT INTO %s (timestamp, message) VALUES (%s, %s)";\r
- $query = sprintf($query, sql_table('actionlog'), DB::formatDateTime(), DB::quoteValue($message));\r
- DB::execute($query);\r
- \r
- self::trimLog();\r
- return;\r
- }\r
- \r
- /**\r
- * (Static) Method to clear the whole action log\r
- */\r
- function clear() {\r
- global $manager;\r
-\r
- $query = sprintf('DELETE FROM %s', sql_table('actionlog'));\r
-\r
- $manager->notify('ActionLogCleared',array());\r
-\r
- return DB::execute($query) !== FALSE;\r
- }\r
-\r
- /**\r
- * (Static) Method to trim the action log (from over 500 back to 250 entries)\r
- */\r
- function trimLog() {\r
- static $checked = 0;\r
-\r
- // only check once per run\r
- if ($checked) return;\r
-\r
- // trim\r
- $checked = 1;\r
-\r
- $query = sprintf('SELECT COUNT(*) AS result FROM %s', sql_table('actionlog'));\r
- $iTotal = DB::getValue($query);\r
-\r
- // if size > 500, drop back to about 250\r
- $iMaxSize = 500;\r
- $iDropSize = 250;\r
- if ($iTotal > $iMaxSize) {\r
- $query = sprintf('SELECT timestamp as result FROM %s ORDER BY timestamp DESC LIMIT %d,1',\r
- sql_table('actionlog'), intval($iDropSize));\r
- $tsChop = DB::getValue($query);\r
- $query = sprintf("DELETE FROM %s WHERE timestamp < '%s'", sql_table('actionlog'), $tsChop);\r
- DB::execute($query);\r
- }\r
-\r
- }\r
-\r
-}\r
-\r
-?>\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Actionlog class for Nucleus
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: ACTIONLOG.php 1822 2012-05-04 13:47:22Z sakamocchi $
+ */
+define('ERROR',1); // only errors
+define('WARNING',2); // errors and warnings
+define('INFO',3); // info, errors and warnings
+define('DEBUG',4); // everything
+$CONF['LogLevel'] = INFO;
+
+class ActionLog
+{
+ /**
+ * ActionLog::add()
+ * Method to add a message to the action log
+ *
+ * @static
+ * @param Integer $level log level
+ * @param String $message log message
+ * @return
+ *
+ */
+ function add($level, $message)
+ {
+ global $member, $CONF;
+
+ if ( $CONF['LogLevel'] < $level )
+ {
+ return;
+ }
+
+ if ( $member && $member->isLoggedIn() )
+ {
+ $message = "[" . $member->getDisplayName() . "] " . $message;
+ }
+
+ $query = "INSERT INTO %s (timestamp, message) VALUES (%s, %s)";
+ $query = sprintf($query, sql_table('actionlog'), DB::formatDateTime(), DB::quoteValue($message));
+ DB::execute($query);
+
+ self::trimLog();
+ return;
+ }
+
+ /**
+ * (Static) Method to clear the whole action log
+ */
+ function clear() {
+ global $manager;
+
+ $query = sprintf('DELETE FROM %s', sql_table('actionlog'));
+
+ $manager->notify('ActionLogCleared',array());
+
+ return DB::execute($query) !== FALSE;
+ }
+
+ /**
+ * (Static) Method to trim the action log (from over 500 back to 250 entries)
+ */
+ function trimLog() {
+ static $checked = 0;
+
+ // only check once per run
+ if ($checked) return;
+
+ // trim
+ $checked = 1;
+
+ $query = sprintf('SELECT COUNT(*) AS result FROM %s', sql_table('actionlog'));
+ $iTotal = DB::getValue($query);
+
+ // if size > 500, drop back to about 250
+ $iMaxSize = 500;
+ $iDropSize = 250;
+ if ($iTotal > $iMaxSize) {
+ $query = sprintf('SELECT timestamp as result FROM %s ORDER BY timestamp DESC LIMIT %d,1',
+ sql_table('actionlog'), intval($iDropSize));
+ $tsChop = DB::getValue($query);
+ $query = sprintf("DELETE FROM %s WHERE timestamp < '%s'", sql_table('actionlog'), $tsChop);
+ DB::execute($query);
+ }
+
+ }
+
+}
+
+?>
\ No newline at end of file
-<?php\r
-/**\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * This class contains the functions that get called by using\r
- * the special tags in the skins\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: ACTIONS.php 1863 2012-05-19 10:50:27Z sakamocchi $
- */\r
-\r
-class Actions extends BaseActions\r
-{\r
- // part of the skin currently being parsed ('index', 'item', 'archive',\r
- // 'archivelist', 'member', 'search', 'error', 'imagepopup')\r
- private $skintype;\r
- \r
- // contains an assoc array with parameters that need to be included when\r
- // generating links to items/archives/... (e.g. catid)\r
- private $linkparams;\r
- \r
- // used when including templated forms from the include/ dir. The $formdata var\r
- // contains the values to fill out in there (assoc array name -> value)\r
- private $formdata;\r
- \r
- // filled out with the number of displayed items after calling one of the\r
- // (other)blog/(other)searchresults skinvars.\r
- private $amountfound;\r
- \r
- /**\r
- * Actions::$default_actions\r
- * list of whole action names with which this class can deal\r
- */\r
- static private $default_actions = array(\r
- 'addlink',\r
- 'addpopupcode',\r
- 'adminurl',\r
- 'archivelink',\r
- 'bloglist',\r
- 'category',\r
- 'loginform',\r
- 'member',\r
- 'nucleusbutton',\r
- 'otherarchivedaylist',\r
- 'otherarchivelist',\r
- 'otherarchiveyearlist',\r
- 'otherblog',\r
- 'plugin',\r
- 'referer',\r
- 'searchform',\r
- 'self',\r
- 'sitevar',\r
- 'skinname',\r
- 'sticky',\r
- 'todaylink',\r
- 'version',\r
- // deprecated (Nucleus v2.0)\r
- /* TODO: remove this */\r
- 'ifcat'\r
- );\r
- \r
- /**\r
- * Actions::$normal_skin_types\r
- * friendly name for wrapped page types\r
- */\r
- static public $normal_skin_types = array(\r
- 'index' => _SKIN_PART_MAIN,\r
- 'item' => _SKIN_PART_ITEM,\r
- 'archivelist' => _SKIN_PART_ALIST,\r
- 'archive' => _SKIN_PART_ARCHIVE,\r
- 'search' => _SKIN_PART_SEARCH,\r
- 'error' => _SKIN_PART_ERROR,\r
- 'member' => _SKIN_PART_MEMBER,\r
- 'imagepopup' => _SKIN_PART_POPUP\r
- );\r
- \r
- /**\r
- * Actions::getNormalSkinTypes()\r
- * \r
- * @static\r
- * @param void\r
- * @return array list of friendly names for page actions\r
- */\r
- static public function getNormalSkinTypes()\r
- {\r
- return self::$normal_skin_types;\r
- }\r
- \r
- /**\r
- * Actions::__construct()\r
- * Constructor for a new Actions object\r
- * \r
- * @param string $type\r
- * @return void\r
- */\r
- public function __construct($type)\r
- {\r
- global $catid;\r
- \r
- // call constructor of superclass first\r
- parent::__construct();\r
- $this->skintype = $type;\r
- \r
- if ( $catid )\r
- {\r
- $this->linkparams = array('catid' => $catid);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::getAvailableActions()\r
- * \r
- * @param void\r
- * @return array allowed actions for the page type\r
- */\r
- public function getAvailableActions()\r
- {\r
- $extra_actions = array();\r
- \r
- switch ( $this->skintype )\r
- {\r
- case 'index':\r
- $extra_actions = array(\r
- 'blog',\r
- 'blogsetting',\r
- 'preview',\r
- 'additemform',\r
- 'categorylist',\r
- 'archivelist',\r
- 'archivedaylist',\r
- 'archiveyearlist',\r
- 'nextlink',\r
- 'prevlink'\r
- );\r
- break;\r
- case 'archive':\r
- $extra_actions = array(\r
- 'blog',\r
- 'archive',\r
- 'otherarchive',\r
- 'categorylist',\r
- 'archivelist',\r
- 'archivedaylist',\r
- 'archiveyearlist',\r
- 'blogsetting',\r
- 'archivedate',\r
- 'nextarchive',\r
- 'prevarchive',\r
- 'nextlink',\r
- 'prevlink',\r
- 'archivetype'\r
- );\r
- break;\r
- case 'archivelist':\r
- $extra_actions = array(\r
- 'blog',\r
- 'archivelist',\r
- 'archivedaylist',\r
- 'archiveyearlist',\r
- 'categorylist',\r
- 'blogsetting'\r
- );\r
- break;\r
- case 'search':\r
- $extra_actions = array(\r
- 'blog',\r
- 'archivelist',\r
- 'archivedaylist',\r
- 'archiveyearlist',\r
- 'categorylist',\r
- 'searchresults',\r
- 'othersearchresults',\r
- 'blogsetting',\r
- 'query',\r
- 'nextlink',\r
- 'prevlink'\r
- );\r
- break;\r
- case 'imagepopup':\r
- $extra_actions = array(\r
- 'image',\r
- // deprecated (Nucleus v2.0)\r
- /* TODO: remove this */\r
- 'imagetext'\r
- );\r
- break;\r
- case 'member':\r
- $extra_actions = array(\r
- 'membermailform',\r
- 'blogsetting',\r
- 'nucleusbutton',\r
- 'categorylist'\r
- );\r
- break;\r
- case 'item':\r
- $extra_actions = array(\r
- 'blog',\r
- 'item',\r
- 'comments',\r
- 'commentform',\r
- 'vars',\r
- 'blogsetting',\r
- 'nextitem',\r
- 'previtem',\r
- 'nextlink',\r
- 'prevlink',\r
- 'nextitemtitle',\r
- 'previtemtitle',\r
- 'categorylist',\r
- 'archivelist',\r
- 'archivedaylist',\r
- 'archiveyearlist',\r
- 'itemtitle',\r
- 'itemid',\r
- 'itemlink'\r
- );\r
- break;\r
- case 'error':\r
- $extra_actions = array(\r
- 'errormessage',\r
- 'categorylist'\r
- );\r
- break;\r
- default:\r
- $extra_actions = array(\r
- 'blog',\r
- 'blogsetting',\r
- 'preview',\r
- 'additemform',\r
- 'categorylist',\r
- 'archivelist',\r
- 'archivedaylist',\r
- 'archiveyearlist',\r
- 'nextlink',\r
- 'prevlink',\r
- 'membermailform',\r
- 'nucleusbutton',\r
- 'categorylist'\r
- );\r
- break;\r
- }\r
- \r
- $defined_actions = array_merge(self::$default_actions, $extra_actions);\r
- \r
- return array_merge($defined_actions, parent::getAvailableActions());\r
- }\r
- \r
- /**\r
- * Actions::doForm()\r
- * Forms get parsedincluded now, using an extra <formdata> skinvar\r
- *\r
- * @param string $filename\r
- * @return void\r
- */\r
- public function doForm($filename)\r
- {\r
- global $DIR_NUCLEUS;\r
- array_push($this->parser->actions,'formdata', 'callback','errordiv','ticket');\r
- \r
- $oldIncludeMode = Parser::getProperty('IncludeMode');\r
- $oldIncludePrefix = Parser::getProperty('IncludePrefix');\r
- Parser::setProperty('IncludeMode','normal');\r
- Parser::setProperty('IncludePrefix','');\r
- \r
- $this->parse_parsedinclude($DIR_NUCLEUS . 'forms/' . $filename . '.template');\r
- Parser::setProperty('IncludeMode',$oldIncludeMode);\r
- Parser::setProperty('IncludePrefix',$oldIncludePrefix);\r
- \r
- array_pop($this->parser->actions); // errordiv\r
- array_pop($this->parser->actions); // callback\r
- array_pop($this->parser->actions); // formdata\r
- array_pop($this->parser->actions); // ticket\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::checkCondition()\r
- * Checks conditions for if statements\r
- *\r
- * @param string $field type of <%if%>\r
- * @param string $name property of field\r
- * @param string $value value of property\r
- * @return boolean condition\r
- */\r
- protected function checkCondition($field, $name='', $value = '')\r
- {\r
- global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;\r
- \r
- $condition = 0;\r
- switch ( $field )\r
- {\r
- case 'category':\r
- $condition = ($blog && $this->ifCategory($name,$value));\r
- break;\r
- case 'blogsetting':\r
- $condition = ($blog && ($blog->getSetting($name) == $value));\r
- break;\r
- case 'loggedin':\r
- $condition = $member->isLoggedIn();\r
- break;\r
- case 'onteam':\r
- $condition = $member->isLoggedIn() && $this->ifOnTeam($name);\r
- break;\r
- case 'admin':\r
- $condition = $member->isLoggedIn() && $this->ifAdmin($name);\r
- break;\r
- case 'nextitem':\r
- $condition = ($itemidnext != '');\r
- break;\r
- case 'previtem':\r
- $condition = ($itemidprev != '');\r
- break;\r
- case 'archiveprevexists':\r
- $condition = ($archiveprevexists == true);\r
- break;\r
- case 'archivenextexists':\r
- $condition = ($archivenextexists == true);\r
- break;\r
- case 'skintype':\r
- $condition = (($name == $this->skintype) || ($name == requestVar('action')));\r
- break;\r
- case 'hasplugin':\r
- $condition = $this->ifHasPlugin($name, $value);\r
- break;\r
- default:\r
- $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);\r
- break;\r
- }\r
- return $condition;\r
- }\r
- \r
- /**\r
- * Actions::_ifHasPlugin()\r
- * hasplugin,PlugName\r
- * -> checks if plugin exists\r
- * hasplugin,PlugName,OptionName\r
- * -> checks if the option OptionName from plugin PlugName is not set to 'no'\r
- * hasplugin,PlugName,OptionName=value\r
- * -> checks if the option OptionName from plugin PlugName is set to value\r
- *\r
- * @param string $name name of plugin\r
- * @param string $value \r
- * @return \r
- */\r
- private function ifHasPlugin($name, $value)\r
- {\r
- global $manager;\r
- $condition = false;\r
- // (pluginInstalled method won't write a message in the actionlog on failure)\r
- if ( $manager->pluginInstalled("NP_{$name}") )\r
- {\r
- $plugin =& $manager->getPlugin("NP_{$name}");\r
- if ( $plugin != NULL )\r
- {\r
- if ( $value == "" )\r
- {\r
- $condition = true;\r
- }\r
- else\r
- {\r
- list($name2, $value2) = preg_split('#=#', $value, 2);\r
- if ( $value2 == "" && $plugin->getOption($name2) != 'no' )\r
- {\r
- $condition = true;\r
- }\r
- else if ( $plugin->getOption($name2) == $value2 )\r
- {\r
- $condition = true;\r
- }\r
- }\r
- }\r
- }\r
- return $condition;\r
- }\r
- \r
- /**\r
- * Actions::ifPlugin()\r
- * Checks if a plugin exists and call its doIf function\r
- * \r
- * @param string $name name of plugin\r
- * @param string $key name of plugin option\r
- * @param string $value value of plugin option\r
- * @return void\r
- */\r
- private function ifPlugin($name, $key = '', $value = '')\r
- {\r
- global $manager;\r
- \r
- $plugin =& $manager->getPlugin("NP_{$name}");\r
- if ( !$plugin )\r
- {\r
- return;\r
- }\r
- \r
- $params = func_get_args();\r
- array_shift($params);\r
- \r
- return call_user_func_array(array(&$plugin, 'doIf'), $params);\r
- }\r
- \r
- /**\r
- * Actions::ifCategory()\r
- * Different checks for a category\r
- * \r
- * @param string $name \r
- * @param string $value \r
- * @return boolean \r
- */\r
- private function ifCategory($name = '', $value='')\r
- {\r
- global $blog, $catid;\r
- \r
- // when no parameter is defined, just check if a category is selected\r
- if ( ($name != 'catname' && $name != 'catid') || ($value == '') )\r
- {\r
- return $blog->isValidCategory($catid);\r
- }\r
- \r
- // check category name\r
+<?php
+/**
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * This class contains the functions that get called by using
+ * the special tags in the skins
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: ACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
+ */
+
+class Actions extends BaseActions
+{
+ // part of the skin currently being parsed ('index', 'item', 'archive',
+ // 'archivelist', 'member', 'search', 'error', 'imagepopup')
+ private $skintype;
+
+ // contains an assoc array with parameters that need to be included when
+ // generating links to items/archives/... (e.g. catid)
+ private $linkparams;
+
+ // used when including templated forms from the include/ dir. The $formdata var
+ // contains the values to fill out in there (assoc array name -> value)
+ private $formdata;
+
+ // filled out with the number of displayed items after calling one of the
+ // (other)blog/(other)searchresults skinvars.
+ private $amountfound;
+
+ /**
+ * Actions::$default_actions
+ * list of whole action names with which this class can deal
+ */
+ static private $default_actions = array(
+ 'addlink',
+ 'addpopupcode',
+ 'adminurl',
+ 'archivelink',
+ 'bloglist',
+ 'category',
+ 'loginform',
+ 'member',
+ 'nucleusbutton',
+ 'otherarchivedaylist',
+ 'otherarchivelist',
+ 'otherarchiveyearlist',
+ 'otherblog',
+ 'plugin',
+ 'referer',
+ 'searchform',
+ 'self',
+ 'sitevar',
+ 'skinname',
+ 'sticky',
+ 'todaylink',
+ 'version',
+ // deprecated (Nucleus v2.0)
+ /* TODO: remove this */
+ 'ifcat'
+ );
+
+ /**
+ * Actions::$normal_skin_types
+ * friendly name for wrapped page types
+ */
+ static public $normal_skin_types = array(
+ 'index' => _SKIN_PART_MAIN,
+ 'item' => _SKIN_PART_ITEM,
+ 'archivelist' => _SKIN_PART_ALIST,
+ 'archive' => _SKIN_PART_ARCHIVE,
+ 'search' => _SKIN_PART_SEARCH,
+ 'error' => _SKIN_PART_ERROR,
+ 'member' => _SKIN_PART_MEMBER,
+ 'imagepopup' => _SKIN_PART_POPUP
+ );
+
+ /**
+ * Actions::getNormalSkinTypes()
+ *
+ * @static
+ * @param void
+ * @return array list of friendly names for page actions
+ */
+ static public function getNormalSkinTypes()
+ {
+ return self::$normal_skin_types;
+ }
+
+ /**
+ * Actions::__construct()
+ * Constructor for a new Actions object
+ *
+ * @param string $type
+ * @return void
+ */
+ public function __construct($type)
+ {
+ global $catid;
+
+ // call constructor of superclass first
+ parent::__construct();
+ $this->skintype = $type;
+
+ if ( $catid )
+ {
+ $this->linkparams = array('catid' => $catid);
+ }
+ return;
+ }
+
+ /**
+ * Actions::getAvailableActions()
+ *
+ * @param void
+ * @return array allowed actions for the page type
+ */
+ public function getAvailableActions()
+ {
+ $extra_actions = array();
+
+ switch ( $this->skintype )
+ {
+ case 'index':
+ $extra_actions = array(
+ 'blog',
+ 'blogsetting',
+ 'preview',
+ 'additemform',
+ 'categorylist',
+ 'archivelist',
+ 'archivedaylist',
+ 'archiveyearlist',
+ 'nextlink',
+ 'prevlink'
+ );
+ break;
+ case 'archive':
+ $extra_actions = array(
+ 'blog',
+ 'archive',
+ 'otherarchive',
+ 'categorylist',
+ 'archivelist',
+ 'archivedaylist',
+ 'archiveyearlist',
+ 'blogsetting',
+ 'archivedate',
+ 'nextarchive',
+ 'prevarchive',
+ 'nextlink',
+ 'prevlink',
+ 'archivetype'
+ );
+ break;
+ case 'archivelist':
+ $extra_actions = array(
+ 'blog',
+ 'archivelist',
+ 'archivedaylist',
+ 'archiveyearlist',
+ 'categorylist',
+ 'blogsetting'
+ );
+ break;
+ case 'search':
+ $extra_actions = array(
+ 'blog',
+ 'archivelist',
+ 'archivedaylist',
+ 'archiveyearlist',
+ 'categorylist',
+ 'searchresults',
+ 'othersearchresults',
+ 'blogsetting',
+ 'query',
+ 'nextlink',
+ 'prevlink'
+ );
+ break;
+ case 'imagepopup':
+ $extra_actions = array(
+ 'image',
+ // deprecated (Nucleus v2.0)
+ /* TODO: remove this */
+ 'imagetext'
+ );
+ break;
+ case 'member':
+ $extra_actions = array(
+ 'membermailform',
+ 'blogsetting',
+ 'nucleusbutton',
+ 'categorylist'
+ );
+ break;
+ case 'item':
+ $extra_actions = array(
+ 'blog',
+ 'item',
+ 'comments',
+ 'commentform',
+ 'vars',
+ 'blogsetting',
+ 'nextitem',
+ 'previtem',
+ 'nextlink',
+ 'prevlink',
+ 'nextitemtitle',
+ 'previtemtitle',
+ 'categorylist',
+ 'archivelist',
+ 'archivedaylist',
+ 'archiveyearlist',
+ 'itemtitle',
+ 'itemid',
+ 'itemlink'
+ );
+ break;
+ case 'error':
+ $extra_actions = array(
+ 'errormessage',
+ 'categorylist'
+ );
+ break;
+ default:
+ $extra_actions = array(
+ 'blog',
+ 'blogsetting',
+ 'preview',
+ 'additemform',
+ 'categorylist',
+ 'archivelist',
+ 'archivedaylist',
+ 'archiveyearlist',
+ 'nextlink',
+ 'prevlink',
+ 'membermailform',
+ 'nucleusbutton',
+ 'categorylist'
+ );
+ break;
+ }
+
+ $defined_actions = array_merge(self::$default_actions, $extra_actions);
+
+ return array_merge($defined_actions, parent::getAvailableActions());
+ }
+
+ /**
+ * Actions::doForm()
+ * Forms get parsedincluded now, using an extra <formdata> skinvar
+ *
+ * @param string $filename
+ * @return void
+ */
+ public function doForm($filename)
+ {
+ global $DIR_NUCLEUS;
+ array_push($this->parser->actions,'formdata', 'callback','errordiv','ticket');
+
+ $oldIncludeMode = Parser::getProperty('IncludeMode');
+ $oldIncludePrefix = Parser::getProperty('IncludePrefix');
+ Parser::setProperty('IncludeMode','normal');
+ Parser::setProperty('IncludePrefix','');
+
+ $this->parse_parsedinclude($DIR_NUCLEUS . 'forms/' . $filename . '.template');
+ Parser::setProperty('IncludeMode',$oldIncludeMode);
+ Parser::setProperty('IncludePrefix',$oldIncludePrefix);
+
+ array_pop($this->parser->actions); // errordiv
+ array_pop($this->parser->actions); // callback
+ array_pop($this->parser->actions); // formdata
+ array_pop($this->parser->actions); // ticket
+ return;
+ }
+
+ /**
+ * Actions::checkCondition()
+ * Checks conditions for if statements
+ *
+ * @param string $field type of <%if%>
+ * @param string $name property of field
+ * @param string $value value of property
+ * @return boolean condition
+ */
+ protected function checkCondition($field, $name='', $value = '')
+ {
+ global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
+
+ $condition = 0;
+ switch ( $field )
+ {
+ case 'category':
+ $condition = ($blog && $this->ifCategory($name,$value));
+ break;
+ case 'blogsetting':
+ $condition = ($blog && ($blog->getSetting($name) == $value));
+ break;
+ case 'loggedin':
+ $condition = $member->isLoggedIn();
+ break;
+ case 'onteam':
+ $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
+ break;
+ case 'admin':
+ $condition = $member->isLoggedIn() && $this->ifAdmin($name);
+ break;
+ case 'nextitem':
+ $condition = ($itemidnext != '');
+ break;
+ case 'previtem':
+ $condition = ($itemidprev != '');
+ break;
+ case 'archiveprevexists':
+ $condition = ($archiveprevexists == true);
+ break;
+ case 'archivenextexists':
+ $condition = ($archivenextexists == true);
+ break;
+ case 'skintype':
+ $condition = (($name == $this->skintype) || ($name == requestVar('action')));
+ break;
+ case 'hasplugin':
+ $condition = $this->ifHasPlugin($name, $value);
+ break;
+ default:
+ $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
+ break;
+ }
+ return $condition;
+ }
+
+ /**
+ * Actions::_ifHasPlugin()
+ * hasplugin,PlugName
+ * -> checks if plugin exists
+ * hasplugin,PlugName,OptionName
+ * -> checks if the option OptionName from plugin PlugName is not set to 'no'
+ * hasplugin,PlugName,OptionName=value
+ * -> checks if the option OptionName from plugin PlugName is set to value
+ *
+ * @param string $name name of plugin
+ * @param string $value
+ * @return
+ */
+ private function ifHasPlugin($name, $value)
+ {
+ global $manager;
+ $condition = false;
+ // (pluginInstalled method won't write a message in the actionlog on failure)
+ if ( $manager->pluginInstalled("NP_{$name}") )
+ {
+ $plugin =& $manager->getPlugin("NP_{$name}");
+ if ( $plugin != NULL )
+ {
+ if ( $value == "" )
+ {
+ $condition = true;
+ }
+ else
+ {
+ list($name2, $value2) = preg_split('#=#', $value, 2);
+ if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
+ {
+ $condition = true;
+ }
+ else if ( $plugin->getOption($name2) == $value2 )
+ {
+ $condition = true;
+ }
+ }
+ }
+ }
+ return $condition;
+ }
+
+ /**
+ * Actions::ifPlugin()
+ * Checks if a plugin exists and call its doIf function
+ *
+ * @param string $name name of plugin
+ * @param string $key name of plugin option
+ * @param string $value value of plugin option
+ * @return void
+ */
+ private function ifPlugin($name, $key = '', $value = '')
+ {
+ global $manager;
+
+ $plugin =& $manager->getPlugin("NP_{$name}");
+ if ( !$plugin )
+ {
+ return;
+ }
+
+ $params = func_get_args();
+ array_shift($params);
+
+ return call_user_func_array(array(&$plugin, 'doIf'), $params);
+ }
+
+ /**
+ * Actions::ifCategory()
+ * Different checks for a category
+ *
+ * @param string $name
+ * @param string $value
+ * @return boolean
+ */
+ private function ifCategory($name = '', $value='')
+ {
+ global $blog, $catid;
+
+ // when no parameter is defined, just check if a category is selected
+ if ( ($name != 'catname' && $name != 'catid') || ($value == '') )
+ {
+ return $blog->isValidCategory($catid);
+ }
+ // check category name
else if ( $name == 'catname' )
- {\r
- $value = $blog->getCategoryIdFromName($value);\r
- if ( $value == $catid )\r
- {\r
- return $blog->isValidCategory($catid);\r
- }\r
- }\r
- \r
- // check category id\r
+ {
+ $value = $blog->getCategoryIdFromName($value);
+ if ( $value == $catid )
+ {
+ return $blog->isValidCategory($catid);
+ }
+ }
+ // check category id
else if ( ($name == 'catid') && ($value == $catid) )
- {\r
- return $blog->isValidCategory($catid);\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
- * Actions::ifOnTeam()\r
- * Checks if a member is on the team of a blog and return his rights\r
- * \r
- * @param string $blogName name of weblog\r
- * @return mixed\r
- */\r
- private function ifOnTeam($blogName = '')\r
- {\r
- global $blog, $member, $manager;\r
- \r
- // when no blog found\r
- if ( ($blogName == '') && !is_object($blog) )\r
- {\r
- return 0;\r
- }\r
- \r
- // explicit blog selection\r
- if ( $blogName != '' )\r
- {\r
- $blogid = getBlogIDFromName($blogName);\r
- }\r
- \r
- if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
- {\r
- // use current blog\r
- $blogid = $blog->getID();\r
- }\r
- \r
- return $member->teamRights($blogid);\r
- }\r
-\r
- /**\r
- * Actions::ifAdmin()\r
- * Checks if a member is admin of a blog\r
- * \r
- * @param string $blogName name of weblog\r
- * @return mixed\r
- */\r
- private function ifAdmin($blogName = '')\r
- {\r
- global $blog, $member, $manager;\r
- \r
- // when no blog found\r
- if ( ($blogName == '') && (!is_object($blog)) )\r
- {\r
- return 0;\r
- }\r
- \r
- // explicit blog selection\r
- if ( $blogName != '' )\r
- {\r
- $blogid = getBlogIDFromName($blogName);\r
- }\r
- \r
- if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
- {\r
- // use current blog\r
- $blogid = $blog->getID();\r
- }\r
- \r
- return $member->isBlogAdmin($blogid);\r
- }\r
- \r
- /**\r
- * Actions::link()\r
- * returns either\r
- * - a raw link (html/xml encoded) when no linktext is provided\r
- * - a (x)html <a href... link when a text is present (text htmlencoded)\r
- * \r
- * @param string $url URL for href attribute of anchor element\r
- * @param string $linktext content of anchor element\r
- * @return \r
- */\r
- private function link($url, $linktext = '')\r
- {\r
- $u = Entity::hsc($url);\r
- // fix URLs that already had encoded ampersands\r
- $u = preg_replace("#&amp;#", '&', $u);\r
- if ( $linktext != '' )\r
- {\r
- $l = '<a href="' . $u .'">' . Entity::hsc($linktext) . '</a>';\r
- }\r
- else\r
- {\r
- $l = $u;\r
- }\r
- return $l;\r
- }\r
- \r
- /**\r
- * Actions::searchlink()\r
- * Outputs a next/prev link\r
- *\r
- * @param $maxresults\r
- * The maximum amount of items shown per page (e.g. 10)\r
- * @param $startpos\r
- * Current start position (requestVar('startpos'))\r
- * @param $direction\r
- * either 'prev' or 'next'\r
- * @param $linktext\r
- * When present, the output will be a full <a href...> link. When empty,\r
- * only a raw link will be outputted\r
- */\r
- private function searchlink($maxresults, $startpos, $direction, $linktext = '', $recount = '')\r
- {\r
- global $CONF, $blog, $query, $amount;\r
- // TODO: Move request uri to linkparams. this is ugly. sorry for that.\r
- $startpos = (integer) $startpos;\r
- $parsed = parse_url(serverVar('REQUEST_URI'));\r
- $path = ( in_array('path', $parsed) ) ? $parsed['path'] : '';\r
- $parsed = ( in_array('query', $parsed) ) ? $parsed['query'] : '';\r
- $url = '';\r
- \r
- if ( $direction == 'prev' )\r
- {\r
- if ( intval($startpos) - intval($maxresults) >= 0 )\r
- {\r
- $startpos = intval($startpos) - intval($maxresults);\r
- \r
- if ( $this->skintype == 'index' )\r
- {\r
- $url = $path;\r
- }\r
- else if ( $this->skintype == 'search' )\r
- {\r
- $url = $CONF['SearchURL'];\r
- }\r
- $url .= '?' . alterQueryStr($parsed, 'startpos', $startpos);\r
- }\r
- }\r
- else if ( $direction == 'next' )\r
- {\r
- global $navigationItems;\r
- if ( !isset($navigationItems) )\r
- {\r
- $navigationItems = 0;\r
- }\r
- \r
- if ( $recount )\r
- {\r
- $iAmountOnPage = 0;\r
- }\r
- else \r
- {\r
- $iAmountOnPage = $this->amountfound;\r
- }\r
- \r
- if ( intval($navigationItems) > 0 )\r
- {\r
- $iAmountOnPage = intval($navigationItems) - intval($startpos);\r
- }\r
- elseif ( $iAmountOnPage == 0 )\r
- {\r
- /*\r
- * [%nextlink%] or [%prevlink%] probably called before [%blog%] or [%searchresults%]\r
- * try a count query\r
- */\r
- if ( $this->skintype == 'index' )\r
- {\r
- $sqlquery = $blog->getSqlBlog('', 'count');\r
- $url = $path;\r
- }\r
- else if ( $this->skintype == 'search' )\r
- {\r
- $unused_highlight = '';\r
- $sqlquery = $blog->getSqlSearch($query, $amount, $unused_highlight, 'count');\r
- $url = $CONF['SearchURL'];\r
- }\r
- if ( $sqlquery )\r
- {\r
- $iAmountOnPage = intval(DB::getValue($sqlquery)) - intval($startpos);\r
- }\r
- }\r
- \r
- $url = '';\r
- if ( intval($iAmountOnPage) >= intval($maxresults) )\r
- {\r
- $startpos = intval($startpos) + intval($maxresults);\r
- $url .= '?' . alterQueryStr($parsed, 'startpos', $startpos);\r
- }\r
- }\r
- \r
- if ( $url != '' )\r
- {\r
- echo $this->link($url, $linktext);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::itemlink()\r
- * Creates an item link and if no id is given a todaylink \r
- * \r
- * @param integer $id id for link\r
- * @param string $linktext text for link\r
- * @return void\r
- */\r
- private function itemlink($id, $linktext = '')\r
- {\r
- global $CONF;\r
- if ( $id != 0 )\r
- {\r
- echo $this->link(Link::create_item_link($id, $this->linkparams), $linktext);\r
- }\r
- else\r
- {\r
- $this->parse_todaylink($linktext);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::archivelink)\r
- * Creates an archive link and if no id is given a todaylink \r
- * \r
- * @param integer $id id for link\r
- * @param string $linktext text for link\r
- * @return void\r
- */\r
- private function archivelink($id, $linktext = '')\r
- {\r
- global $CONF, $blog;\r
- if ( $id != 0 )\r
- {\r
- echo $this->link(Link::create_archive_link($blog->getID(), $id, $this->linkparams), $linktext);\r
- }\r
- else\r
- {\r
- $this->parse_todaylink($linktext);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions:setBlogCategory()\r
- * Helper function that sets the category that a blog will need to use\r
- *\r
- * @param string $blog An object of the blog class, passed by reference (we want to make changes to it)\r
- * @param string $catname The name of the category to use\r
- * @return void\r
- */\r
- private function setBlogCategory(&$blog, $catname)\r
- {\r
- global $catid;\r
- if ( $catname != '' )\r
- {\r
- $blog->setSelectedCategoryByName($catname);\r
- }\r
- else\r
- {\r
- $blog->setSelectedCategory($catid);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::preBlogContent()\r
- * Notifies the Manager that a PreBlogContent event occurs\r
- * \r
- * @param string $type type of skin\r
- * @param object $blog an instance of Blog class\r
- * @return void\r
- */\r
- private function preBlogContent($type, &$blog)\r
- {\r
- global $manager;\r
- $manager->notify('PreBlogContent',array('blog' => &$blog, 'type' => $type));\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::postBlogContent()\r
- * Notifies the Manager that a PostBlogContent event occurs\r
- * \r
- * @param string $type type of skin\r
- * @param objecct $blog an instance of Blog class\r
- * @return void\r
- */\r
- private function postBlogContent($type, &$blog)\r
- {\r
- global $manager;\r
- $manager->notify('PostBlogContent', array('blog' => &$blog, 'type' => $type));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_additemform()\r
- * Parse skinvar additemform\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_additemform()\r
- {\r
- global $blog, $CONF;\r
- $this->formdata = array(\r
- 'adminurl' => Entity::hsc($CONF['AdminURL']),\r
- 'catid' => $blog->getDefaultCategory()\r
- );\r
- $blog->InsertJavaScriptInfo();\r
- $this->doForm('additemform');\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_addlink()\r
- * Parse skinvar addlink\r
- * A Link that allows to open a bookmarklet to add an item\r
- */\r
- public function parse_addlink()\r
- {\r
- global $CONF, $member, $blog;\r
- if ( $member->isLoggedIn() && $member->isTeamMember($blog->blogid) )\r
- {\r
- echo $CONF['AdminURL'].'bookmarklet.php?blogid='.$blog->blogid;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_addpopupcode()\r
- * Parse skinvar addpopupcode\r
- * Code that opens a bookmarklet in an popup window\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_addpopupcode()\r
- {\r
- echo "if (event && event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=500,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";\r
- return;\r
- }\r
- \r
- /**\r
- * Parse skinvar adminurl\r
- * (shortcut for admin url)\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_adminurl()\r
- {\r
- $this->parse_sitevar('adminurl');\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_archive()\r
- * Parse skinvar archive\r
- * \r
- * @param string $template name of template\r
- * @param string $category name of category\r
- * @return \r
- */\r
- public function parse_archive($template, $category = '')\r
- {\r
- global $blog, $archive;\r
- // can be used with either yyyy-mm or yyyy-mm-dd\r
- sscanf($archive,'%d-%d-%d', $y, $m, $d);\r
- $this->setBlogCategory($blog, $category);\r
- $this->preBlogContent('achive',$blog);\r
- $blog->showArchive($template, $y, $m, $d);\r
- $this->postBlogContent('achive',$blog);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_archivedate()\r
- * %archivedate(locale,date format)%\r
- * \r
- * @param string $locale\r
- * @return void\r
- */\r
- public function parse_archivedate($locale = '-def-')\r
- {\r
- global $archive;\r
- \r
- /* \r
- * TODO: these lines are no meaning because there is no $template.\r
- if ( $locale == '-def-' )\r
- {\r
- setlocale(LC_TIME, $template['LOCALE']);\r
- }\r
- else\r
- {\r
- setlocale(LC_TIME, $locale);\r
- }\r
- */\r
- \r
- // get archive date\r
- sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
- \r
- // get format\r
- $args = func_get_args();\r
- // format can be spread over multiple parameters\r
- if ( sizeof($args) > 1 )\r
- {\r
- // take away locale\r
- array_shift($args);\r
- // implode\r
- $format=implode(',',$args);\r
- }\r
- elseif ( $d == 0 && $m !=0 )\r
- {\r
- $format = '%B %Y';\r
- }\r
- elseif ( $m == 0 )\r
- {\r
- $format = '%Y';\r
- }\r
- else\r
- {\r
- $format = '%d %B %Y';\r
- }\r
- echo i18n::formatted_datetime($format, mktime(0,0,0,$m?$m:1,$d?$d:1,$y));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_archivedaylist()\r
- * Parse skinvar archivedaylist\r
- * \r
- * @param string $template name of template\r
- * @param string $category name of category\r
- * @param integer $limit the number of items in a display\r
- * @return void\r
- */\r
- public function parse_archivedaylist($template, $category = 'all', $limit = 0)\r
- {\r
- global $blog;\r
- if ( $category == 'all' )\r
- {\r
- $category = '';\r
- }\r
- $this->preBlogContent('archivelist',$blog);\r
- $this->setBlogCategory($blog, $category);\r
- $blog->showArchiveList($template, 'day', $limit);\r
- $this->postBlogContent('archivelist',$blog);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_archivelink()\r
- * A link to the archives for the current blog (or for default blog)\r
- * \r
- * @param string $linktext text for link\r
- * @return void\r
- */\r
- public function parse_archivelink($linktext = '')\r
- {\r
- global $blog, $CONF;\r
- if ( $blog )\r
- {\r
- echo $this->link(Link::create_archivelist_link($blog->getID(), $this->linkparams), $linktext);\r
- }\r
- else\r
- {\r
- echo $this->link(Link::create_archivelist_link(), $linktext);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_archivelist()\r
- * \r
- * @param string $template name of template\r
- * @param string $category name of category\r
- * @param integer $limit the number of items in a display\r
- * @return void\r
- */\r
- public function parse_archivelist($template, $category = 'all', $limit = 0)\r
- {\r
- global $blog;\r
- if ( $category == 'all' )\r
- {\r
- $category = '';\r
- }\r
- $this->preBlogContent('archivelist',$blog);\r
- $this->setBlogCategory($blog, $category);\r
- $blog->showArchiveList($template, 'month', $limit);\r
- $this->postBlogContent('archivelist',$blog);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_archiveyearlist()\r
- * \r
- * @param string $template name of template\r
- * @param string $category name of category\r
- * @param integer $limit the number of items in a display\r
- */\r
- public function parse_archiveyearlist($template, $category = 'all', $limit = 0)\r
- {\r
- global $blog;\r
- if ( $category == 'all' )\r
- {\r
- $category = '';\r
- }\r
- $this->preBlogContent('archivelist',$blog);\r
- $this->setBlogCategory($blog, $category);\r
- $blog->showArchiveList($template, 'year', $limit);\r
- $this->postBlogContent('archivelist',$blog);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_archivetype()\r
- * Parse skinvar archivetype\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_archivetype()\r
- {\r
- global $archivetype;\r
- echo $archivetype;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blog()\r
- * Parse skinvar blog\r
- * \r
- * @param string $template name of template\r
- * @param mixed $amount the number of items in a display, in case it includes the beginning\r
- * @param string $category name of category\r
- * @return void\r
- */\r
- public function parse_blog($template, $amount = 10, $category = '')\r
- {\r
- global $blog, $startpos;\r
- \r
- list($limit, $offset) = sscanf($amount, '%d(%d)');\r
- $this->setBlogCategory($blog, $category);\r
- $this->preBlogContent('blog',$blog);\r
- $this->amountfound = $blog->readLog($template, $limit, $offset, $startpos);\r
- $this->postBlogContent('blog',$blog);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_bloglist()\r
- * Parse skinvar bloglist\r
- * Shows a list of all blogs\r
- * \r
- * @param string $template name of template\r
- * @param string $bnametype whether 'name' or 'shortname' is used for the link text\r
- * @param string $orderby order criteria\r
- * @param string $direction order ascending or descending \r
- * @return void\r
- */\r
- public function parse_bloglist($template, $bnametype = '', $orderby='number', $direction='asc')\r
- {\r
- Blog::showBlogList($template, $bnametype, $orderby, $direction);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blogsetting()\r
- * Parse skinvar blogsetting\r
- * \r
- * @param string $which key of weblog settings\r
- * @return void\r
- */\r
- public function parse_blogsetting($which)\r
- {\r
- global $blog;\r
- switch( $which )\r
- {\r
- case 'id':\r
- echo Entity::hsc($blog->getID());\r
- break;\r
- case 'url':\r
- echo Entity::hsc($blog->getURL());\r
- break;\r
- case 'name':\r
- echo Entity::hsc($blog->getName());\r
- break;\r
- case 'desc':\r
- echo Entity::hsc($blog->getDescription());\r
- break;\r
- case 'short':\r
- echo Entity::hsc($blog->getShortName());\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_callback()\r
- * Parse callback\r
- * \r
- * @param string $eventName name of event\r
- * @param string $type type of skin\r
- * @return void\r
- */\r
- public function parse_callback($eventName, $type)\r
- {\r
- global $manager;\r
- $manager->notify($eventName, array('type' => $type));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_category()\r
- * Parse skinvar category\r
- * \r
- * @param string $type key of category settings\r
- * @return void\r
- */\r
- public function parse_category($type = 'name')\r
- {\r
- global $catid, $blog;\r
- if ( !$blog->isValidCategory($catid) )\r
- {\r
- return;\r
- }\r
- \r
- switch ( $type )\r
- {\r
- case 'name':\r
- echo $blog->getCategoryName($catid);\r
- break;\r
- case 'desc':\r
- echo $blog->getCategoryDesc($catid);\r
- break;\r
- case 'id':\r
- echo $catid;\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_categorylist()\r
- * Parse categorylist\r
- * \r
- * @param string $template name of template\r
- * @param string $blogname name of weblog\r
- * @return void\r
- */\r
- public function parse_categorylist($template, $blogname = '')\r
- {\r
- global $blog, $manager;\r
- \r
- // when no blog found\r
- if ( ($blogname == '') && (!is_object($blog)) )\r
- {\r
- return 0;\r
- }\r
- \r
- if ( $blogname == '' )\r
- {\r
- $this->preBlogContent('categorylist',$blog);\r
- $blog->showCategoryList($template);\r
- $this->postBlogContent('categorylist',$blog);\r
- }\r
- else\r
- {\r
- $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
- $this->preBlogContent('categorylist',$b);\r
- $b->showCategoryList($template);\r
- $this->postBlogContent('categorylist',$b);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_commentform()\r
- * Parse skinvar commentform\r
- * \r
- * @param string $destinationurl URI for redirection\r
- * @return void\r
- */\r
- public function parse_commentform($destinationurl = '')\r
- {\r
- global $blog, $itemid, $member, $CONF, $manager, $DIR_LIBS, $errormessage;\r
- \r
- // warn when trying to provide a actionurl (used to be a parameter in Nucleus <2.0)\r
- if ( stristr($destinationurl, 'action.php') )\r
- {\r
- $args = func_get_args();\r
- $destinationurl = $args[1];\r
- ActionLog::add(WARNING,_ACTIONURL_NOTLONGER_PARAMATER);\r
- }\r
- \r
- $actionurl = $CONF['ActionURL'];\r
- \r
- // if item is closed, show message and do nothing\r
- $item =& $manager->getItem($itemid,0,0);\r
- if ( $item['closed'] || !$blog->commentsEnabled() )\r
- {\r
- $this->doForm('commentform-closed');\r
- return;\r
- }\r
- \r
- if ( !$blog->isPublic() && !$member->isLoggedIn() )\r
- {\r
- $this->doForm('commentform-closedtopublic');\r
- return;\r
- }\r
- \r
- if ( !$destinationurl )\r
- {\r
- // note: createLink returns an HTML encoded URL\r
- $destinationurl = Link::create_link(\r
- 'item',\r
- array(\r
- 'itemid' => $itemid,\r
- 'title' => $item['title'],\r
- 'timestamp' => $item['timestamp'],\r
- 'extra' => $this->linkparams\r
- )\r
- );\r
- }\r
- else\r
- {\r
- // HTML encode URL\r
- $destinationurl = Entity::hsc($destinationurl);\r
- }\r
- \r
- // values to prefill\r
- $user = cookieVar($CONF['CookiePrefix'] .'comment_user');\r
- if ( !$user )\r
- {\r
- $user = postVar('user');\r
- }\r
- \r
- $userid = cookieVar($CONF['CookiePrefix'] .'comment_userid');\r
- if ( !$userid )\r
- {\r
- $userid = postVar('userid');\r
- }\r
- \r
- $email = cookieVar($CONF['CookiePrefix'] .'comment_email');\r
- if (!$email)\r
- {\r
- $email = postVar('email');\r
- }\r
- \r
- $body = postVar('body');\r
- \r
- $this->formdata = array(\r
- 'destinationurl' => $destinationurl, // url is already HTML encoded\r
- 'actionurl' => Entity::hsc($actionurl),\r
- 'itemid' => $itemid,\r
- 'user' => Entity::hsc($user),\r
- 'userid' => Entity::hsc($userid),\r
- 'email' => Entity::hsc($email),\r
- 'body' => Entity::hsc($body),\r
- 'membername' => $member->getDisplayName(),\r
- 'rememberchecked' => cookieVar($CONF['CookiePrefix'] .'comment_user')?'checked="checked"':''\r
- );\r
- \r
- if ( !$member->isLoggedIn() )\r
- {\r
- $this->doForm('commentform-notloggedin');\r
- }\r
- else\r
- {\r
- $this->doForm('commentform-loggedin');\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_comments()\r
- * Parse skinvar comments\r
- * include comments for one item\r
- * \r
- * @param string $template name of template\r
- * @return void\r
- */\r
- public function parse_comments($template)\r
- {\r
- global $manager, $blog, $highlight, $itemid;\r
- \r
- $template =& $manager->getTemplate($template);\r
- $item =& $manager->getitem($itemid, 0, 0);\r
- \r
- // create parser object & action handler\r
- $handler = new ItemActions($blog);\r
- $handler->setTemplate($template);\r
- $handler->setCurrentItem($item);\r
- \r
- $parser = new Parser($handler);\r
- \r
- $comments = new Comments($itemid);\r
- $comments->setItemActions($handler);\r
- // shows ALL comments\r
- $comments->showComments($template, -1, 1, $highlight);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_errordiv()\r
- * Parse errordiv\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_errordiv()\r
- {\r
- global $errormessage;\r
- if ( $errormessage )\r
- {\r
- echo '<div class="error">' . Entity::hsc($errormessage) . "</div>\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_errormessage()\r
- * Parse skinvar errormessage\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_errormessage()\r
- {\r
- global $errormessage;\r
- echo $errormessage;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_formdata()\r
- * Parse formdata\r
- * \r
- * @param string $what key of format data\r
- * @return void\r
- */\r
- public function parse_formdata($what)\r
- {\r
- echo $this->formdata[$what];\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_ifcat()\r
- * Parse ifcat\r
- * \r
- * @param string $text\r
- * @return void\r
- */\r
- public function parse_ifcat($text = '')\r
- {\r
- if ( $text == '' )\r
- {\r
- // new behaviour\r
- $this->parse_if('category');\r
- }\r
- else\r
- {\r
- // old behaviour\r
- global $catid, $blog;\r
- if ( $blog->isValidCategory($catid) )\r
- {\r
- echo $text;\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_image()\r
- * Parse skinvar image\r
- * \r
- * @param string $what name of tag\r
- * @return void\r
- */\r
- public function parse_image($what = 'imgtag')\r
- {\r
- global $CONF;\r
- \r
- $imagetext = Entity::hsc(requestVar('imagetext'));\r
- $imagepopup = requestVar('imagepopup');\r
- $width = intRequestVar('width');\r
- $height = intRequestVar('height');\r
- $fullurl = Entity::hsc($CONF['MediaURL'] . $imagepopup);\r
- \r
- switch ( $what )\r
- {\r
- case 'url':\r
- echo $fullurl;\r
- break;\r
- case 'width':\r
- echo $width;\r
- break;\r
- case 'height':\r
- echo $height;\r
- break;\r
- case 'caption':\r
- case 'text':\r
- echo $imagetext;\r
- break;\r
- case 'imgtag':\r
- default:\r
- echo "<img src=\"$fullurl\" width=\"$width\" height=\"$height\" alt=\"$imagetext\" title=\"$imagetext\" />";\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_imagetext()\r
- * Parse skinvar imagetext\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_imagetext()\r
- {\r
- $this->parse_image('imagetext');\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::parse_item()\r
- * Parse skinvar item\r
- * include one item (no comments)\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_item($template)\r
- {\r
- global $blog, $itemid, $highlight;\r
- \r
- // need this to select default category\r
- $this->setBlogCategory($blog, '');\r
- $this->preBlogContent('item',$blog);\r
- $r = $blog->showOneitem($itemid, $template, $highlight);\r
- if ( $r == 0 )\r
- {\r
- echo _ERROR_NOSUCHITEM;\r
- }\r
- $this->postBlogContent('item',$blog);\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::parse_itemid()\r
- * Parse skinvar itemid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_itemid()\r
- {\r
- global $itemid;\r
- echo $itemid;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parseitemlink()\r
- * Parse skinvar itemlink\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_itemlink($linktext = '')\r
- {\r
- global $itemid;\r
- $this->itemlink($itemid, $linktext);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_itemtitle()\r
- * Parse itemtitle\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_itemtitle($format = '')\r
- {\r
- global $manager, $itemid;\r
- $item =& $manager->getItem($itemid, 1, 1);\r
- \r
- switch ( $format )\r
- {\r
- case 'xml':\r
- echo Entity::hen($item['title']);\r
- break;\r
- case 'raw':\r
- echo $item['title'];\r
- break;\r
- case 'attribute':\r
- default:\r
- echo Entity::hsc(strip_tags($item['title']));\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_loginform()\r
- * Parse skinvar loginform\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_loginform()\r
- {\r
- global $member, $CONF;\r
- if ( !$member->isLoggedIn() )\r
- {\r
- $filename = 'loginform-notloggedin';\r
- $this->formdata = array();\r
- }\r
- else\r
- {\r
- $filename = 'loginform-loggedin';\r
- $this->formdata = array(\r
- 'membername' => $member->getDisplayName(),\r
- );\r
- }\r
- $this->doForm($filename);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_member()\r
- * Parse skinvar member\r
- * (includes a member info thingie)\r
- * \r
- * @param string $what which memberdata is needed\r
- * @return void\r
- */\r
- public function parse_member($what)\r
- {\r
- global $memberinfo, $member, $CONF;\r
- \r
- // 1. only allow the member-details-page specific variables on member pages\r
- if ( $this->skintype == 'member' )\r
- {\r
- switch( $what )\r
- {\r
- case 'name':\r
- echo Entity::hsc($memberinfo->getDisplayName());\r
- break;\r
- case 'realname':\r
- echo Entity::hsc($memberinfo->getRealName());\r
- break;\r
- case 'notes':\r
- echo Entity::hsc($memberinfo->getNotes());\r
- break;\r
- case 'url':\r
- echo Entity::hsc($memberinfo->getURL());\r
- break;\r
- case 'email':\r
- echo Entity::hsc($memberinfo->getEmail());\r
- break;\r
- case 'id':\r
- echo Entity::hsc($memberinfo->getID());\r
- break;\r
- }\r
- }\r
- \r
- // 2. the next bunch of options is available everywhere, as long as the user is logged in\r
- if ( $member->isLoggedIn() )\r
- {\r
- switch( $what )\r
- {\r
- case 'yourname':\r
- echo $member->getDisplayName();\r
- break;\r
- case 'yourrealname':\r
- echo $member->getRealName();\r
- break;\r
- case 'yournotes':\r
- echo $member->getNotes();\r
- break;\r
- case 'yoururl':\r
- echo $member->getURL();\r
- break;\r
- case 'youremail':\r
- echo $member->getEmail();\r
- break;\r
- case 'yourid':\r
- echo $member->getID();\r
- break;\r
- case 'yourprofileurl':\r
- if ($CONF['URLMode'] == 'pathinfo')\r
- echo Link::create_member_link($member->getID());\r
- else\r
- echo $CONF['IndexURL'] . Link::create_member_link($member->getID());\r
- break;\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Link::parse_membermailform()\r
- * Parse skinvar membermailform\r
- * \r
- * @param integer $rows the height for textarea\r
- * @param integer $cols the width for textarea\r
- * @param string $desturl URI to redirect\r
- * @return void\r
- */\r
- public function parse_membermailform($rows = 10, $cols = 40, $desturl = '')\r
- {\r
- global $member, $CONF, $memberid;\r
- \r
- if ( $desturl == '' )\r
- {\r
- if ( $CONF['URLMode'] == 'pathinfo' )\r
- {\r
- $desturl = Link::create_member_link($memberid);\r
- }\r
- else\r
- {\r
- $desturl = $CONF['IndexURL'] . Link::create_member_link($memberid);\r
- }\r
- }\r
- \r
- $message = postVar('message');\r
- $frommail = postVar('frommail');\r
- \r
- $this->formdata = array(\r
- 'url' => Entity::hsc($desturl),\r
- 'actionurl' => Entity::hsc($CONF['ActionURL']),\r
- 'memberid' => $memberid,\r
- 'rows' => $rows,\r
- 'cols' => $cols,\r
- 'message' => Entity::hsc($message),\r
- 'frommail' => Entity::hsc($frommail)\r
- );\r
- \r
- if ( $member->isLoggedIn() )\r
- {\r
- $this->doForm('membermailform-loggedin');\r
- }\r
- else if ( $CONF['NonmemberMail'] )\r
- {\r
- $this->doForm('membermailform-notloggedin');\r
- }\r
- else\r
- {\r
- $this->doForm('membermailform-disallowed');\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_nextarchive()\r
- * Parse skinvar nextarchive\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_nextarchive()\r
- {\r
- global $archivenext;\r
- echo $archivenext;\r
- return;\r
- }\r
- \r
- /**\r
- * Parse skinvar nextitem\r
- * (include itemid of next item)\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_nextitem()\r
- {\r
- global $itemidnext;\r
- if ( isset($itemidnext) )\r
- {\r
- echo (int)$itemidnext;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_nextitemtitle()\r
- * Parse skinvar nextitemtitle\r
- * (include itemtitle of next item)\r
- * \r
- * @param string $format format of text\r
- * @return void\r
- */\r
- public function parse_nextitemtitle($format = '')\r
- {\r
- global $itemtitlenext;\r
- \r
- switch ( $format )\r
- {\r
- case 'xml':\r
- echo Entity::hen($itemtitlenext);\r
- break;\r
- case 'raw':\r
- echo $itemtitlenext;\r
- break;\r
- case 'attribute':\r
- default:\r
- echo Entity::hsc($itemtitlenext);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_nextlink()\r
- * Parse skinvar nextlink\r
- * \r
- * @param string $linktext text for content of anchor element\r
- * @param integer $amount the amount of items in a display\r
- * @param integer $recount increment from this value\r
- * @return void\r
- */\r
- public function parse_nextlink($linktext = '', $amount = 10, $recount = '')\r
- {\r
- global $itemidnext, $archivenext, $startpos;\r
- if ( $this->skintype == 'item' )\r
- {\r
- $this->itemlink($itemidnext, $linktext);\r
- }\r
- else if ( $this->skintype == 'search' || $this->skintype == 'index' )\r
- {\r
- $this->searchlink($amount, $startpos, 'next', $linktext, $recount);\r
- }\r
- else\r
- {\r
- $this->archivelink($archivenext, $linktext);\r
- }\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::parse_nucleusbutton()\r
- * Parse skinvar nucleusbutton\r
- * \r
- * @param string $imgurl URL for image\r
- * @param integer $imgwidth width of image\r
- * @param integer $imgheidht height of image\r
- */\r
- public function parse_nucleusbutton($imgurl = '', $imgwidth = '85', $imgheight = '31')\r
- {\r
- global $CONF;\r
- if ( $imgurl == '' )\r
- {\r
- $imgurl = $CONF['AdminURL'] . 'nucleus.gif';\r
- }\r
- else if ( Parser::getProperty('IncludeMode') == 'skindir' )\r
- {\r
- // when skindit IncludeMode is used: start from skindir\r
- $imgurl = $CONF['SkinsURL'] . Parser::getProperty('IncludePrefix') . $imgurl;\r
- }\r
- \r
- $this->formdata = array(\r
- 'imgurl' => $imgurl,\r
- 'imgwidth' => $imgwidth,\r
- 'imgheight' => $imgheight,\r
- );\r
- $this->doForm('nucleusbutton');\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_otherarchive()\r
- * Parse skinvar otherarchive\r
- * \r
- * @param string $blogname name of weblog\r
- * @param string $template name of template\r
- * @param string $category name of category\r
- * @return void\r
- */ \r
- public function parse_otherarchive($blogname, $template, $category = '')\r
- {\r
- global $archive, $manager;\r
- sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
- $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
- $this->setBlogCategory($b, $category);\r
- $this->preBlogContent('otherachive',$b);\r
- $b->showArchive($template, $y, $m, $d);\r
- $this->postBlogContent('otherachive',$b);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_otherarchivedaylist()\r
- * Parse skinvar otherarchivedaylist\r
- * \r
- * @param string $blogname name of weblog\r
- * @param string $template name of template\r
- * @param string $category name of category\r
- * @param integer $limit the amount of items in a display\r
- * @return void\r
- */\r
- public function parse_otherarchivedaylist($blogname, $template, $category = 'all', $limit = 0)\r
- {\r
- global $manager;\r
- if ( $category == 'all')\r
- {\r
- $category = '';\r
- }\r
- $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
- $this->setBlogCategory($b, $category);\r
- $this->preBlogContent('otherarchivelist',$b);\r
- $b->showArchiveList($template, 'day', $limit);\r
- $this->postBlogContent('otherarchivelist',$b);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_otherarchivelist()\r
- * Parse skinvar otherarchivelist\r
- * \r
- * @param string $blogname name of weblog\r
- * @param string $template name of template\r
- * @param string $category name of category\r
- * @param integer $limit the amount of items in a display\r
- * @return void\r
- */\r
- public function parse_otherarchivelist($blogname, $template, $category = 'all', $limit = 0)\r
- {\r
- global $manager;\r
- if ( $category == 'all' )\r
- {\r
- $category = '';\r
- }\r
- $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
- $this->setBlogCategory($b, $category);\r
- $this->preBlogContent('otherarchivelist',$b);\r
- $b->showArchiveList($template, 'month', $limit);\r
- $this->postBlogContent('otherarchivelist',$b);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_otherarchiveyearlist()\r
- * Parse skinvar otherarchiveyearlist\r
- * \r
- * @param string $blogname name of weblog\r
- * @param string $template name of template\r
- * @param string $category name of category\r
- * @limit integer $limit the amount of items in a display\r
- */\r
- public function parse_otherarchiveyearlist($blogname, $template, $category = 'all', $limit = 0)\r
- {\r
- global $manager;\r
- if ( $category == 'all' )\r
- {\r
- $category = '';\r
- }\r
- $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
- $this->setBlogCategory($b, $category);\r
- $this->preBlogContent('otherarchivelist',$b);\r
- $b->showArchiveList($template, 'year', $limit);\r
- $this->postBlogContent('otherarchivelist',$b);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_otherblog()\r
- * Parse skinvar otherblog\r
- * \r
- * @param string $blogname name of weblog\r
- * @param string $template name of template\r
- * @param mixed $amount the amount of items, in case it includes the beginning\r
- * @param string $category name of category\r
- * @return void\r
- */\r
- public function parse_otherblog($blogname, $template, $amount = 10, $category = '')\r
- {\r
- global $manager;\r
- \r
- list($limit, $offset) = sscanf($amount, '%d(%d)');\r
- \r
- $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
- $this->setBlogCategory($b, $category);\r
- $this->preBlogContent('otherblog',$b);\r
- $this->amountfound = $b->readLog($template, $limit, $offset);\r
- $this->postBlogContent('otherblog',$b);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_othersearchresults()\r
- * Parse skinvar othersearchresults\r
- * \r
- * @param string $blogname name of weblog\r
- * @param string $template name of template\r
- * @param integer $maxresults the amount of results\r
- * @return void\r
- */\r
- public function parse_othersearchresults($blogname, $template, $maxresults = 50)\r
- {\r
- global $query, $amount, $manager, $startpos;\r
- $b =& $manager->getBlog(getBlogIDFromName($blogname));\r
- // need this to select default category\r
- $this->setBlogCategory($b, '');\r
- $this->preBlogContent('othersearchresults',$b);\r
- $b->search($query, $template, $amount, $maxresults, $startpos);\r
- $this->postBlogContent('othersearchresults',$b);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_plugin()\r
- * Executes a plugin skinvar\r
- * extra parameters can be added\r
- * \r
- * @param string $pluginName name of plugin (without the NP_)\r
- * @return void\r
- */\r
- public function parse_plugin($pluginName)\r
- {\r
- global $manager;\r
- \r
- $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
- if ( !$plugin )\r
- {\r
- return;\r
- }\r
- \r
- // get arguments\r
- $params = func_get_args();\r
- \r
- // remove plugin name\r
- array_shift($params);\r
- \r
- // add skin type on front\r
- array_unshift($params, $this->skintype);\r
- \r
- call_user_func_array(array(&$plugin,'doSkinVar'), $params);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_prevarchive()\r
- * Parse skinvar prevarchive\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_prevarchive()\r
- {\r
- global $archiveprev;\r
- echo $archiveprev;\r
- }\r
- \r
- /**\r
- * Actions::parse_preview()\r
- * Parse skinvar preview\r
- * \r
- * @param string $template name of tempalte\r
- * @return void\r
- */\r
- public function parse_preview($template)\r
- {\r
- global $blog, $CONF, $manager;\r
- \r
- $template =& $manager->getTemplate($template);\r
- \r
- $row['body'] = '<span id="prevbody"></span>';\r
- $row['title'] = '<span id="prevtitle"></span>';\r
- $row['more'] = '<span id="prevmore"></span>';\r
- $row['itemlink'] = '';\r
- $row['itemid'] = 0; $row['blogid'] = $blog->getID();\r
- \r
- echo Template::fill($template['ITEM_HEADER'],$row);\r
- echo Template::fill($template['ITEM'],$row);\r
- echo Template::fill($template['ITEM_FOOTER'],$row);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_previtem()\r
- * Parse skinvar previtem\r
- * (include itemid of prev item)\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_previtem()\r
- {\r
- global $itemidprev;\r
- if ( isset($itemidprev) )\r
- {\r
- echo (integer) $itemidprev;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_previtemtitle()\r
- * Parse skinvar previtemtitle\r
- * (include itemtitle of prev item)\r
- * \r
- * @param String $format string format\r
- * @return String formatted string\r
- */\r
- public function parse_previtemtitle($format = '')\r
- {\r
- global $itemtitleprev;\r
- \r
- switch ( $format )\r
- {\r
- case 'xml':\r
- echo Entity::hen($itemtitleprev);\r
- break;\r
- case 'raw':\r
- echo $itemtitleprev;\r
- break;\r
- case 'attribute':\r
- default:\r
- echo Entity::hsc($itemtitleprev);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_prevlink()\r
- * Parse skinvar prevlink\r
- * \r
- * @param string $linktext text as a content of anchor element\r
- * @param integer the amount of links\r
- * @return void\r
- */\r
- public function parse_prevlink($linktext = '', $amount = 10)\r
- {\r
- global $itemidprev, $archiveprev, $startpos;\r
- \r
- if ( $this->skintype == 'item' )\r
- {\r
- $this->itemlink($itemidprev, $linktext);\r
- }\r
- else if ( $this->skintype == 'search' || $this->skintype == 'index' )\r
- {\r
- $this->searchlink($amount, $startpos, 'prev', $linktext);\r
- }\r
- else\r
- {\r
- $this->archivelink($archiveprev, $linktext);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_query()\r
- * Parse skinvar query\r
- * (includes the search query) \r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_query()\r
- {\r
- global $query;\r
- echo Entity::hsc($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_referer()\r
- * Parse skinvar referer\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_referer()\r
- {\r
- echo Entity::hsc(serverVar('HTTP_REFERER'));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_searchform()\r
- * Parse skinvar searchform\r
- * \r
- * @param string $blogname name of weblog\r
- * @return void\r
- */\r
- public function parse_searchform($blogname = '')\r
- {\r
- global $CONF, $manager, $maxresults;\r
- if ( $blogname )\r
- {\r
- $blog =& $manager->getBlog(getBlogIDFromName($blogname));\r
- }\r
- else\r
- {\r
- global $blog;\r
- }\r
- // use default blog when no blog is selected\r
- $this->formdata = array(\r
- 'id' => $blog?$blog->getID():$CONF['DefaultBlog'],\r
- 'query' => Entity::hsc(getVar('query')),\r
- );\r
- $this->doForm('searchform');\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_searchresults()\r
- * Parse skinvar searchresults\r
- * \r
- * @param string $template name of tempalte\r
- * @param integer $maxresults searched items in a display\r
- * @return void;\r
- */\r
- public function parse_searchresults($template, $maxresults = 50 )\r
- {\r
- global $blog, $query, $amount, $startpos;\r
- \r
- $this->setBlogCategory($blog, ''); // need this to select default category\r
- $this->preBlogContent('searchresults',$blog);\r
- $this->amountfound = $blog->search($query, $template, $amount, $maxresults, $startpos);\r
- $this->postBlogContent('searchresults',$blog);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_self()\r
- * Parse skinvar self\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_self()\r
- {\r
- global $CONF;\r
- echo $CONF['Self'];\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_sitevar()\r
- * Parse skinvar sitevar\r
- * (include a sitevar)\r
- * \r
- * @param string $which\r
- * @return void\r
- */\r
- public function parse_sitevar($which)\r
- {\r
- global $CONF;\r
- switch ( $which )\r
- {\r
- case 'url':\r
- echo $CONF['IndexURL'];\r
- break;\r
- case 'name':\r
- echo $CONF['SiteName'];\r
- break;\r
- case 'admin':\r
- echo $CONF['AdminEmail'];\r
- break;\r
- case 'adminurl':\r
- echo $CONF['AdminURL'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_skinname()\r
- * Parse skinname\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_skinname()\r
- {\r
- echo $this->parser->skin->getName();\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_skintype()\r
- * Parse skintype (experimental)\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_skintype()\r
- {\r
- echo $this->skintype;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_ticket()\r
- * Parse ticket\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_ticket()\r
- {\r
- global $manager;\r
- $manager->addTicketHidden();\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::parse_todaylink()\r
- * Parse skinvar todaylink\r
- * A link to the today page (depending on selected blog, etc...)\r
- *\r
- * @param string $linktext text for link\r
- * @return void\r
- */\r
- public function parse_todaylink($linktext = '')\r
- {\r
- global $blog, $CONF;\r
- if ( $blog )\r
- {\r
- echo $this->link(Link::create_blogid_link($blog->getID(),$this->linkparams), $linktext);\r
- }\r
- else\r
- {\r
- echo $this->link($CONF['SiteUrl'], $linktext);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Parse vars\r
- * When commentform is not used, to include a hidden field with itemid \r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_vars()\r
- {\r
- global $itemid;\r
- echo '<input type="hidden" name="itemid" value="'.$itemid.'" />' . "\n";\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::parse_version()\r
- * Parse skinvar version\r
- * (include nucleus versionnumber) \r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_version()\r
- {\r
- global $nucleus;\r
- echo 'Nucleus CMS ' . $nucleus['version'];\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_sticky()\r
- * Parse skinvar sticky\r
- * \r
- * @param integer $itemnumber id of item\r
- * @param string $template name of template\r
- * @return void\r
- */\r
- public function parse_sticky($itemid = 0, $template = '')\r
- {\r
- global $manager;\r
- \r
- $itemid = (integer) $itemid;\r
- $itemarray = array($itemid);\r
- \r
- $item =& $manager->getItem($post['itemid'], 1, 1);\r
- $blog =& $manager->getBlog($item['blogid']);\r
- \r
- $this->preBlogContent('sticky', $blog);\r
- $this->amountfound = $blog->readLogFromList($itemarray, $template);\r
- $this->postBlogContent('sticky', $blog);\r
- return;\r
- }\r
-}\r
+ {
+ return $blog->isValidCategory($catid);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Actions::ifOnTeam()
+ * Checks if a member is on the team of a blog and return his rights
+ *
+ * @param string $blogName name of weblog
+ * @return mixed
+ */
+ private function ifOnTeam($blogName = '')
+ {
+ global $blog, $member, $manager;
+
+ // when no blog found
+ if ( ($blogName == '') && !is_object($blog) )
+ {
+ return 0;
+ }
+
+ // explicit blog selection
+ if ( $blogName != '' )
+ {
+ $blogid = getBlogIDFromName($blogName);
+ }
+
+ if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+ {
+ // use current blog
+ $blogid = $blog->getID();
+ }
+
+ return $member->teamRights($blogid);
+ }
+
+ /**
+ * Actions::ifAdmin()
+ * Checks if a member is admin of a blog
+ *
+ * @param string $blogName name of weblog
+ * @return mixed
+ */
+ private function ifAdmin($blogName = '')
+ {
+ global $blog, $member, $manager;
+
+ // when no blog found
+ if ( ($blogName == '') && (!is_object($blog)) )
+ {
+ return 0;
+ }
+
+ // explicit blog selection
+ if ( $blogName != '' )
+ {
+ $blogid = getBlogIDFromName($blogName);
+ }
+
+ if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+ {
+ // use current blog
+ $blogid = $blog->getID();
+ }
+
+ return $member->isBlogAdmin($blogid);
+ }
+
+ /**
+ * Actions::link()
+ * returns either
+ * - a raw link (html/xml encoded) when no linktext is provided
+ * - a (x)html <a href... link when a text is present (text htmlencoded)
+ *
+ * @param string $url URL for href attribute of anchor element
+ * @param string $linktext content of anchor element
+ * @return
+ */
+ private function link($url, $linktext = '')
+ {
+ $u = Entity::hsc($url);
+ // fix URLs that already had encoded ampersands
+ $u = preg_replace("#&amp;#", '&', $u);
+ if ( $linktext != '' )
+ {
+ $l = '<a href="' . $u .'">' . Entity::hsc($linktext) . '</a>';
+ }
+ else
+ {
+ $l = $u;
+ }
+ return $l;
+ }
+
+ /**
+ * Actions::searchlink()
+ * Outputs a next/prev link
+ *
+ * @param $maxresults
+ * The maximum amount of items shown per page (e.g. 10)
+ * @param $startpos
+ * Current start position (requestVar('startpos'))
+ * @param $direction
+ * either 'prev' or 'next'
+ * @param $linktext
+ * When present, the output will be a full <a href...> link. When empty,
+ * only a raw link will be outputted
+ */
+ private function searchlink($maxresults, $startpos, $direction, $linktext = '', $recount = '')
+ {
+ global $CONF, $blog, $query, $amount;
+ // TODO: Move request uri to linkparams. this is ugly. sorry for that.
+ $startpos = (integer) $startpos;
+ $parsed = parse_url(serverVar('REQUEST_URI'));
+ $path = ( in_array('path', $parsed) ) ? $parsed['path'] : '';
+ $parsed = ( in_array('query', $parsed) ) ? $parsed['query'] : '';
+ $url = '';
+
+ if ( $direction == 'prev' )
+ {
+ if ( intval($startpos) - intval($maxresults) >= 0 )
+ {
+ $startpos = intval($startpos) - intval($maxresults);
+
+ if ( $this->skintype == 'index' )
+ {
+ $url = $path;
+ }
+ else if ( $this->skintype == 'search' )
+ {
+ $url = $CONF['SearchURL'];
+ }
+ $url .= '?' . alterQueryStr($parsed,'startpos',$startpos);
+ }
+ }
+ else if ( $direction == 'next' )
+ {
+ global $navigationItems;
+ if ( !isset($navigationItems) )
+ {
+ $navigationItems = 0;
+ }
+
+ if ( $recount )
+ {
+ $iAmountOnPage = 0;
+ }
+ else
+ {
+ $iAmountOnPage = $this->amountfound;
+ }
+
+ if ( intval($navigationItems) > 0 )
+ {
+ $iAmountOnPage = intval($navigationItems) - intval($startpos);
+ }
+ elseif ( $iAmountOnPage == 0 )
+ {
+ /*
+ * [%nextlink%] or [%prevlink%] probably called before [%blog%] or [%searchresults%]
+ * try a count query
+ */
+ if ( $this->skintype == 'index' )
+ {
+ $sqlquery = $blog->getSqlBlog('', 'count');
+ $url = $path;
+ }
+ else if ( $this->skintype == 'search' )
+ {
+ $unused_highlight = '';
+ $sqlquery = $blog->getSqlSearch($query, $amount, $unused_highlight, 'count');
+ $url = $CONF['SearchURL'];
+ }
+ if ( $sqlquery )
+ {
+ $iAmountOnPage = intval(DB::getValue($sqlquery)) - intval($startpos);
+ }
+ }
+
+ $url = '';
+ if ( intval($iAmountOnPage) >= intval($maxresults) )
+ {
+ $startpos = intval($startpos) + intval($maxresults);
+ $url .= '?' . alterQueryStr($parsed, 'startpos', $startpos);
+ }
+ }
+
+ if ( $url != '' )
+ {
+ echo $this->link($url, $linktext);
+ }
+ return;
+ }
+
+ /**
+ * Actions::itemlink()
+ * Creates an item link and if no id is given a todaylink
+ *
+ * @param integer $id id for link
+ * @param string $linktext text for link
+ * @return void
+ */
+ private function itemlink($id, $linktext = '')
+ {
+ global $CONF;
+ if ( $id != 0 )
+ {
+ echo $this->link(Link::create_item_link($id, $this->linkparams), $linktext);
+ }
+ else
+ {
+ $this->parse_todaylink($linktext);
+ }
+ return;
+ }
+
+ /**
+ * Actions::archivelink)
+ * Creates an archive link and if no id is given a todaylink
+ *
+ * @param integer $id id for link
+ * @param string $linktext text for link
+ * @return void
+ */
+ private function archivelink($id, $linktext = '')
+ {
+ global $CONF, $blog;
+ if ( $id != 0 )
+ {
+ echo $this->link(Link::create_archive_link($blog->getID(), $id, $this->linkparams), $linktext);
+ }
+ else
+ {
+ $this->parse_todaylink($linktext);
+ }
+ return;
+ }
+
+ /**
+ * Actions:setBlogCategory()
+ * Helper function that sets the category that a blog will need to use
+ *
+ * @param string $blog An object of the blog class, passed by reference (we want to make changes to it)
+ * @param string $catname The name of the category to use
+ * @return void
+ */
+ private function setBlogCategory(&$blog, $catname)
+ {
+ global $catid;
+ if ( $catname != '' )
+ {
+ $blog->setSelectedCategoryByName($catname);
+ }
+ else
+ {
+ $blog->setSelectedCategory($catid);
+ }
+ return;
+ }
+
+ /**
+ * Actions::preBlogContent()
+ * Notifies the Manager that a PreBlogContent event occurs
+ *
+ * @param string $type type of skin
+ * @param object $blog an instance of Blog class
+ * @return void
+ */
+ private function preBlogContent($type, &$blog)
+ {
+ global $manager;
+ $manager->notify('PreBlogContent',array('blog' => &$blog, 'type' => $type));
+ return;
+ }
+
+ /**
+ * Actions::postBlogContent()
+ * Notifies the Manager that a PostBlogContent event occurs
+ *
+ * @param string $type type of skin
+ * @param objecct $blog an instance of Blog class
+ * @return void
+ */
+ private function postBlogContent($type, &$blog)
+ {
+ global $manager;
+ $manager->notify('PostBlogContent', array('blog' => &$blog, 'type' => $type));
+ return;
+ }
+
+ /**
+ * Actions::parse_additemform()
+ * Parse skinvar additemform
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_additemform()
+ {
+ global $blog, $CONF;
+ $this->formdata = array(
+ 'adminurl' => Entity::hsc($CONF['AdminURL']),
+ 'catid' => $blog->getDefaultCategory()
+ );
+ $blog->InsertJavaScriptInfo();
+ $this->doForm('additemform');
+ return;
+ }
+
+ /**
+ * Actions::parse_addlink()
+ * Parse skinvar addlink
+ * A Link that allows to open a bookmarklet to add an item
+ */
+ public function parse_addlink()
+ {
+ global $CONF, $member, $blog;
+ if ( $member->isLoggedIn() && $member->isTeamMember($blog->blogid) )
+ {
+ echo $CONF['AdminURL'].'bookmarklet.php?blogid='.$blog->blogid;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_addpopupcode()
+ * Parse skinvar addpopupcode
+ * Code that opens a bookmarklet in an popup window
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_addpopupcode()
+ {
+ echo "if (event && event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=500,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";
+ return;
+ }
+
+ /**
+ * Parse skinvar adminurl
+ * (shortcut for admin url)
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_adminurl()
+ {
+ $this->parse_sitevar('adminurl');
+ return;
+ }
+
+ /**
+ * Actions::parse_archive()
+ * Parse skinvar archive
+ *
+ * @param string $template name of template
+ * @param string $category name of category
+ * @return
+ */
+ public function parse_archive($template, $category = '')
+ {
+ global $blog, $archive;
+ // can be used with either yyyy-mm or yyyy-mm-dd
+ sscanf($archive,'%d-%d-%d', $y, $m, $d);
+ $this->setBlogCategory($blog, $category);
+ $this->preBlogContent('achive',$blog);
+ $blog->showArchive($template, $y, $m, $d);
+ $this->postBlogContent('achive',$blog);
+ return;
+ }
+
+ /**
+ * Actions::parse_archivedate()
+ * %archivedate(locale,date format)%
+ *
+ * @param string $locale
+ * @return void
+ */
+ public function parse_archivedate($locale = '-def-')
+ {
+ global $archive;
+
+ /*
+ * TODO: these lines are no meaning because there is no $template.
+ if ( $locale == '-def-' )
+ {
+ setlocale(LC_TIME, $template['LOCALE']);
+ }
+ else
+ {
+ setlocale(LC_TIME, $locale);
+ }
+ */
+
+ // get archive date
+ sscanf($archive,'%d-%d-%d',$y,$m,$d);
+
+ // get format
+ $args = func_get_args();
+ // format can be spread over multiple parameters
+ if ( sizeof($args) > 1 )
+ {
+ // take away locale
+ array_shift($args);
+ // implode
+ $format=implode(',',$args);
+ }
+ elseif ( $d == 0 && $m !=0 )
+ {
+ $format = '%B %Y';
+ }
+ elseif ( $m == 0 )
+ {
+ $format = '%Y';
+ }
+ else
+ {
+ $format = '%d %B %Y';
+ }
+ echo i18n::formatted_datetime($format, mktime(0,0,0,$m?$m:1,$d?$d:1,$y));
+ return;
+ }
+
+ /**
+ * Actions::parse_archivedaylist()
+ * Parse skinvar archivedaylist
+ *
+ * @param string $template name of template
+ * @param string $category name of category
+ * @param integer $limit the number of items in a display
+ * @return void
+ */
+ public function parse_archivedaylist($template, $category = 'all', $limit = 0)
+ {
+ global $blog;
+ if ( $category == 'all' )
+ {
+ $category = '';
+ }
+ $this->preBlogContent('archivelist',$blog);
+ $this->setBlogCategory($blog, $category);
+ $blog->showArchiveList($template, 'day', $limit);
+ $this->postBlogContent('archivelist',$blog);
+ return;
+ }
+
+ /**
+ * Actions::parse_archivelink()
+ * A link to the archives for the current blog (or for default blog)
+ *
+ * @param string $linktext text for link
+ * @return void
+ */
+ public function parse_archivelink($linktext = '')
+ {
+ global $blog, $CONF;
+ if ( $blog )
+ {
+ echo $this->link(Link::create_archivelist_link($blog->getID(), $this->linkparams), $linktext);
+ }
+ else
+ {
+ echo $this->link(Link::create_archivelist_link(), $linktext);
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_archivelist()
+ *
+ * @param string $template name of template
+ * @param string $category name of category
+ * @param integer $limit the number of items in a display
+ * @return void
+ */
+ public function parse_archivelist($template, $category = 'all', $limit = 0)
+ {
+ global $blog;
+ if ( $category == 'all' )
+ {
+ $category = '';
+ }
+ $this->preBlogContent('archivelist',$blog);
+ $this->setBlogCategory($blog, $category);
+ $blog->showArchiveList($template, 'month', $limit);
+ $this->postBlogContent('archivelist',$blog);
+ return;
+ }
+
+ /**
+ * Actions::parse_archiveyearlist()
+ *
+ * @param string $template name of template
+ * @param string $category name of category
+ * @param integer $limit the number of items in a display
+ */
+ public function parse_archiveyearlist($template, $category = 'all', $limit = 0)
+ {
+ global $blog;
+ if ( $category == 'all' )
+ {
+ $category = '';
+ }
+ $this->preBlogContent('archivelist',$blog);
+ $this->setBlogCategory($blog, $category);
+ $blog->showArchiveList($template, 'year', $limit);
+ $this->postBlogContent('archivelist',$blog);
+ return;
+ }
+
+ /**
+ * Actions::parse_archivetype()
+ * Parse skinvar archivetype
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_archivetype()
+ {
+ global $archivetype;
+ echo $archivetype;
+ return;
+ }
+
+ /**
+ * Actions::parse_blog()
+ * Parse skinvar blog
+ *
+ * @param string $template name of template
+ * @param mixed $amount the number of items in a display, in case it includes the beginning
+ * @param string $category name of category
+ * @return void
+ */
+ public function parse_blog($template, $amount = 10, $category = '')
+ {
+ global $blog, $startpos;
+
+ list($limit, $offset) = sscanf($amount, '%d(%d)');
+ $this->setBlogCategory($blog, $category);
+ $this->preBlogContent('blog',$blog);
+ $this->amountfound = $blog->readLog($template, $limit, $offset, $startpos);
+ $this->postBlogContent('blog',$blog);
+ return;
+ }
+
+ /**
+ * Actions::parse_bloglist()
+ * Parse skinvar bloglist
+ * Shows a list of all blogs
+ *
+ * @param string $template name of template
+ * @param string $bnametype whether 'name' or 'shortname' is used for the link text
+ * @param string $orderby order criteria
+ * @param string $direction order ascending or descending
+ * @return void
+ */
+ public function parse_bloglist($template, $bnametype = '', $orderby='number', $direction='asc')
+ {
+ Blog::showBlogList($template, $bnametype, $orderby, $direction);
+ return;
+ }
+
+ /**
+ * Actions::parse_blogsetting()
+ * Parse skinvar blogsetting
+ *
+ * @param string $which key of weblog settings
+ * @return void
+ */
+ public function parse_blogsetting($which)
+ {
+ global $blog;
+ switch( $which )
+ {
+ case 'id':
+ echo Entity::hsc($blog->getID());
+ break;
+ case 'url':
+ echo Entity::hsc($blog->getURL());
+ break;
+ case 'name':
+ echo Entity::hsc($blog->getName());
+ break;
+ case 'desc':
+ echo Entity::hsc($blog->getDescription());
+ break;
+ case 'short':
+ echo Entity::hsc($blog->getShortName());
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_callback()
+ * Parse callback
+ *
+ * @param string $eventName name of event
+ * @param string $type type of skin
+ * @return void
+ */
+ public function parse_callback($eventName, $type)
+ {
+ global $manager;
+ $manager->notify($eventName, array('type' => $type));
+ return;
+ }
+
+ /**
+ * Actions::parse_category()
+ * Parse skinvar category
+ *
+ * @param string $type key of category settings
+ * @return void
+ */
+ public function parse_category($type = 'name')
+ {
+ global $catid, $blog;
+ if ( !$blog->isValidCategory($catid) )
+ {
+ return;
+ }
+
+ switch ( $type )
+ {
+ case 'name':
+ echo $blog->getCategoryName($catid);
+ break;
+ case 'desc':
+ echo $blog->getCategoryDesc($catid);
+ break;
+ case 'id':
+ echo $catid;
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_categorylist()
+ * Parse categorylist
+ *
+ * @param string $template name of template
+ * @param string $blogname name of weblog
+ * @return void
+ */
+ public function parse_categorylist($template, $blogname = '')
+ {
+ global $blog, $manager;
+
+ // when no blog found
+ if ( ($blogname == '') && (!is_object($blog)) )
+ {
+ return 0;
+ }
+
+ if ( $blogname == '' )
+ {
+ $this->preBlogContent('categorylist',$blog);
+ $blog->showCategoryList($template);
+ $this->postBlogContent('categorylist',$blog);
+ }
+ else
+ {
+ $b =& $manager->getBlog(getBlogIDFromName($blogname));
+ $this->preBlogContent('categorylist',$b);
+ $b->showCategoryList($template);
+ $this->postBlogContent('categorylist',$b);
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_commentform()
+ * Parse skinvar commentform
+ *
+ * @param string $destinationurl URI for redirection
+ * @return void
+ */
+ public function parse_commentform($destinationurl = '')
+ {
+ global $blog, $itemid, $member, $CONF, $manager, $DIR_LIBS, $errormessage;
+
+ // warn when trying to provide a actionurl (used to be a parameter in Nucleus <2.0)
+ if ( stristr($destinationurl, 'action.php') )
+ {
+ $args = func_get_args();
+ $destinationurl = $args[1];
+ ActionLog::add(WARNING,_ACTIONURL_NOTLONGER_PARAMATER);
+ }
+
+ $actionurl = $CONF['ActionURL'];
+
+ // if item is closed, show message and do nothing
+ $item =& $manager->getItem($itemid,0,0);
+ if ( $item['closed'] || !$blog->commentsEnabled() )
+ {
+ $this->doForm('commentform-closed');
+ return;
+ }
+
+ if ( !$blog->isPublic() && !$member->isLoggedIn() )
+ {
+ $this->doForm('commentform-closedtopublic');
+ return;
+ }
+
+ if ( !$destinationurl )
+ {
+ // note: createLink returns an HTML encoded URL
+ $destinationurl = Link::create_link(
+ 'item',
+ array(
+ 'itemid' => $itemid,
+ 'title' => $item['title'],
+ 'timestamp' => $item['timestamp'],
+ 'extra' => $this->linkparams
+ )
+ );
+ }
+ else
+ {
+ // HTML encode URL
+ $destinationurl = Entity::hsc($destinationurl);
+ }
+
+ // values to prefill
+ $user = cookieVar($CONF['CookiePrefix'] .'comment_user');
+ if ( !$user )
+ {
+ $user = postVar('user');
+ }
+
+ $userid = cookieVar($CONF['CookiePrefix'] .'comment_userid');
+ if ( !$userid )
+ {
+ $userid = postVar('userid');
+ }
+
+ $email = cookieVar($CONF['CookiePrefix'] .'comment_email');
+ if (!$email)
+ {
+ $email = postVar('email');
+ }
+
+ $body = postVar('body');
+
+ $this->formdata = array(
+ 'destinationurl' => $destinationurl, // url is already HTML encoded
+ 'actionurl' => Entity::hsc($actionurl),
+ 'itemid' => $itemid,
+ 'user' => Entity::hsc($user),
+ 'userid' => Entity::hsc($userid),
+ 'email' => Entity::hsc($email),
+ 'body' => Entity::hsc($body),
+ 'membername' => $member->getDisplayName(),
+ 'rememberchecked' => cookieVar($CONF['CookiePrefix'] .'comment_user')?'checked="checked"':''
+ );
+
+ if ( !$member->isLoggedIn() )
+ {
+ $this->doForm('commentform-notloggedin');
+ }
+ else
+ {
+ $this->doForm('commentform-loggedin');
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_comments()
+ * Parse skinvar comments
+ * include comments for one item
+ *
+ * @param string $template name of template
+ * @return void
+ */
+ public function parse_comments($template)
+ {
+ global $manager, $blog, $highlight, $itemid;
+
+ $template =& $manager->getTemplate($template);
+ $item =& $manager->getitem($itemid, 0, 0);
+
+ // create parser object & action handler
+ $handler = new ItemActions($blog);
+ $handler->setTemplate($template);
+ $handler->setCurrentItem($item);
+
+ $parser = new Parser($handler);
+
+ $comments = new Comments($itemid);
+ $comments->setItemActions($handler);
+ // shows ALL comments
+ $comments->showComments($template, -1, 1, $highlight);
+ return;
+ }
+
+ /**
+ * Actions::parse_errordiv()
+ * Parse errordiv
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_errordiv()
+ {
+ global $errormessage;
+ if ( $errormessage )
+ {
+ echo '<div class="error">' . Entity::hsc($errormessage) . "</div>\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_errormessage()
+ * Parse skinvar errormessage
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_errormessage()
+ {
+ global $errormessage;
+ echo $errormessage;
+ return;
+ }
+
+ /**
+ * Actions::parse_formdata()
+ * Parse formdata
+ *
+ * @param string $what key of format data
+ * @return void
+ */
+ public function parse_formdata($what)
+ {
+ echo $this->formdata[$what];
+ return;
+ }
+
+ /**
+ * Actions::parse_ifcat()
+ * Parse ifcat
+ *
+ * @param string $text
+ * @return void
+ */
+ public function parse_ifcat($text = '')
+ {
+ if ( $text == '' )
+ {
+ // new behaviour
+ $this->parse_if('category');
+ }
+ else
+ {
+ // old behaviour
+ global $catid, $blog;
+ if ( $blog->isValidCategory($catid) )
+ {
+ echo $text;
+ }
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_image()
+ * Parse skinvar image
+ *
+ * @param string $what name of tag
+ * @return void
+ */
+ public function parse_image($what = 'imgtag')
+ {
+ global $CONF;
+
+ $imagetext = Entity::hsc(requestVar('imagetext'));
+ $imagepopup = requestVar('imagepopup');
+ $width = intRequestVar('width');
+ $height = intRequestVar('height');
+ $fullurl = Entity::hsc($CONF['MediaURL'] . $imagepopup);
+
+ switch ( $what )
+ {
+ case 'url':
+ echo $fullurl;
+ break;
+ case 'width':
+ echo $width;
+ break;
+ case 'height':
+ echo $height;
+ break;
+ case 'caption':
+ case 'text':
+ echo $imagetext;
+ break;
+ case 'imgtag':
+ default:
+ echo "<img src=\"$fullurl\" width=\"$width\" height=\"$height\" alt=\"$imagetext\" title=\"$imagetext\" />";
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_imagetext()
+ * Parse skinvar imagetext
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_imagetext()
+ {
+ $this->parse_image('imagetext');
+ return;
+ }
+
+ /**
+ * Actions::parse_item()
+ * Parse skinvar item
+ * include one item (no comments)
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_item($template)
+ {
+ global $blog, $itemid, $highlight;
+
+ // need this to select default category
+ $this->setBlogCategory($blog, '');
+ $this->preBlogContent('item',$blog);
+ $r = $blog->showOneitem($itemid, $template, $highlight);
+ if ( $r == 0 )
+ {
+ echo _ERROR_NOSUCHITEM;
+ }
+ $this->postBlogContent('item',$blog);
+ return;
+ }
+
+ /**
+ * Actions::parse_itemid()
+ * Parse skinvar itemid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_itemid()
+ {
+ global $itemid;
+ echo $itemid;
+ return;
+ }
+
+ /**
+ * Actions::parseitemlink()
+ * Parse skinvar itemlink
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_itemlink($linktext = '')
+ {
+ global $itemid;
+ $this->itemlink($itemid, $linktext);
+ return;
+ }
+
+ /**
+ * Actions::parse_itemtitle()
+ * Parse itemtitle
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_itemtitle($format = '')
+ {
+ global $manager, $itemid;
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ switch ( $format )
+ {
+ case 'xml':
+ echo Entity::hen($item['title']);
+ break;
+ case 'raw':
+ echo $item['title'];
+ break;
+ case 'attribute':
+ default:
+ echo Entity::hsc(strip_tags($item['title']));
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_loginform()
+ * Parse skinvar loginform
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_loginform()
+ {
+ global $member, $CONF;
+ if ( !$member->isLoggedIn() )
+ {
+ $filename = 'loginform-notloggedin';
+ $this->formdata = array();
+ }
+ else
+ {
+ $filename = 'loginform-loggedin';
+ $this->formdata = array(
+ 'membername' => $member->getDisplayName(),
+ );
+ }
+ $this->doForm($filename);
+ return;
+ }
+
+ /**
+ * Actions::parse_member()
+ * Parse skinvar member
+ * (includes a member info thingie)
+ *
+ * @param string $what which memberdata is needed
+ * @return void
+ */
+ public function parse_member($what)
+ {
+ global $memberinfo, $member, $CONF;
+
+ // 1. only allow the member-details-page specific variables on member pages
+ if ( $this->skintype == 'member' )
+ {
+ switch( $what )
+ {
+ case 'name':
+ echo Entity::hsc($memberinfo->getDisplayName());
+ break;
+ case 'realname':
+ echo Entity::hsc($memberinfo->getRealName());
+ break;
+ case 'notes':
+ echo Entity::hsc($memberinfo->getNotes());
+ break;
+ case 'url':
+ echo Entity::hsc($memberinfo->getURL());
+ break;
+ case 'email':
+ echo Entity::hsc($memberinfo->getEmail());
+ break;
+ case 'id':
+ echo Entity::hsc($memberinfo->getID());
+ break;
+ }
+ }
+
+ // 2. the next bunch of options is available everywhere, as long as the user is logged in
+ if ( $member->isLoggedIn() )
+ {
+ switch( $what )
+ {
+ case 'yourname':
+ echo $member->getDisplayName();
+ break;
+ case 'yourrealname':
+ echo $member->getRealName();
+ break;
+ case 'yournotes':
+ echo $member->getNotes();
+ break;
+ case 'yoururl':
+ echo $member->getURL();
+ break;
+ case 'youremail':
+ echo $member->getEmail();
+ break;
+ case 'yourid':
+ echo $member->getID();
+ break;
+ case 'yourprofileurl':
+ if ($CONF['URLMode'] == 'pathinfo')
+ echo Link::create_member_link($member->getID());
+ else
+ echo $CONF['IndexURL'] . Link::create_member_link($member->getID());
+ break;
+ }
+ }
+ return;
+ }
+
+ /**
+ * Link::parse_membermailform()
+ * Parse skinvar membermailform
+ *
+ * @param integer $rows the height for textarea
+ * @param integer $cols the width for textarea
+ * @param string $desturl URI to redirect
+ * @return void
+ */
+ public function parse_membermailform($rows = 10, $cols = 40, $desturl = '')
+ {
+ global $member, $CONF, $memberid;
+
+ if ( $desturl == '' )
+ {
+ if ( $CONF['URLMode'] == 'pathinfo' )
+ {
+ $desturl = Link::create_member_link($memberid);
+ }
+ else
+ {
+ $desturl = $CONF['IndexURL'] . Link::create_member_link($memberid);
+ }
+ }
+
+ $message = postVar('message');
+ $frommail = postVar('frommail');
+
+ $this->formdata = array(
+ 'url' => Entity::hsc($desturl),
+ 'actionurl' => Entity::hsc($CONF['ActionURL']),
+ 'memberid' => $memberid,
+ 'rows' => $rows,
+ 'cols' => $cols,
+ 'message' => Entity::hsc($message),
+ 'frommail' => Entity::hsc($frommail)
+ );
+
+ if ( $member->isLoggedIn() )
+ {
+ $this->doForm('membermailform-loggedin');
+ }
+ else if ( $CONF['NonmemberMail'] )
+ {
+ $this->doForm('membermailform-notloggedin');
+ }
+ else
+ {
+ $this->doForm('membermailform-disallowed');
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_nextarchive()
+ * Parse skinvar nextarchive
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_nextarchive()
+ {
+ global $archivenext;
+ echo $archivenext;
+ return;
+ }
+
+ /**
+ * Parse skinvar nextitem
+ * (include itemid of next item)
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_nextitem()
+ {
+ global $itemidnext;
+ if ( isset($itemidnext) )
+ {
+ echo (int)$itemidnext;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_nextitemtitle()
+ * Parse skinvar nextitemtitle
+ * (include itemtitle of next item)
+ *
+ * @param string $format format of text
+ * @return void
+ */
+ public function parse_nextitemtitle($format = '')
+ {
+ global $itemtitlenext;
+
+ switch ( $format )
+ {
+ case 'xml':
+ echo Entity::hen($itemtitlenext);
+ break;
+ case 'raw':
+ echo $itemtitlenext;
+ break;
+ case 'attribute':
+ default:
+ echo Entity::hsc($itemtitlenext);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_nextlink()
+ * Parse skinvar nextlink
+ *
+ * @param string $linktext text for content of anchor element
+ * @param integer $amount the amount of items in a display
+ * @param integer $recount increment from this value
+ * @return void
+ */
+ public function parse_nextlink($linktext = '', $amount = 10, $recount = '')
+ {
+ global $itemidnext, $archivenext, $startpos;
+ if ( $this->skintype == 'item' )
+ {
+ $this->itemlink($itemidnext, $linktext);
+ }
+ else if ( $this->skintype == 'search' || $this->skintype == 'index' )
+ {
+ $this->searchlink($amount, $startpos, 'next', $linktext, $recount);
+ }
+ else
+ {
+ $this->archivelink($archivenext, $linktext);
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_nucleusbutton()
+ * Parse skinvar nucleusbutton
+ *
+ * @param string $imgurl URL for image
+ * @param integer $imgwidth width of image
+ * @param integer $imgheidht height of image
+ */
+ public function parse_nucleusbutton($imgurl = '', $imgwidth = '85', $imgheight = '31')
+ {
+ global $CONF;
+ if ( $imgurl == '' )
+ {
+ $imgurl = $CONF['AdminURL'] . 'nucleus.gif';
+ }
+ else if ( Parser::getProperty('IncludeMode') == 'skindir' )
+ {
+ // when skindit IncludeMode is used: start from skindir
+ $imgurl = $CONF['SkinsURL'] . Parser::getProperty('IncludePrefix') . $imgurl;
+ }
+
+ $this->formdata = array(
+ 'imgurl' => $imgurl,
+ 'imgwidth' => $imgwidth,
+ 'imgheight' => $imgheight,
+ );
+ $this->doForm('nucleusbutton');
+ return;
+ }
+
+ /**
+ * Actions::parse_otherarchive()
+ * Parse skinvar otherarchive
+ *
+ * @param string $blogname name of weblog
+ * @param string $template name of template
+ * @param string $category name of category
+ * @return void
+ */
+ public function parse_otherarchive($blogname, $template, $category = '')
+ {
+ global $archive, $manager;
+ sscanf($archive,'%d-%d-%d',$y,$m,$d);
+ $b =& $manager->getBlog(getBlogIDFromName($blogname));
+ $this->setBlogCategory($b, $category);
+ $this->preBlogContent('otherachive',$b);
+ $b->showArchive($template, $y, $m, $d);
+ $this->postBlogContent('otherachive',$b);
+ return;
+ }
+
+ /**
+ * Actions::parse_otherarchivedaylist()
+ * Parse skinvar otherarchivedaylist
+ *
+ * @param string $blogname name of weblog
+ * @param string $template name of template
+ * @param string $category name of category
+ * @param integer $limit the amount of items in a display
+ * @return void
+ */
+ public function parse_otherarchivedaylist($blogname, $template, $category = 'all', $limit = 0)
+ {
+ global $manager;
+ if ( $category == 'all')
+ {
+ $category = '';
+ }
+ $b =& $manager->getBlog(getBlogIDFromName($blogname));
+ $this->setBlogCategory($b, $category);
+ $this->preBlogContent('otherarchivelist',$b);
+ $b->showArchiveList($template, 'day', $limit);
+ $this->postBlogContent('otherarchivelist',$b);
+ return;
+ }
+
+ /**
+ * Actions::parse_otherarchivelist()
+ * Parse skinvar otherarchivelist
+ *
+ * @param string $blogname name of weblog
+ * @param string $template name of template
+ * @param string $category name of category
+ * @param integer $limit the amount of items in a display
+ * @return void
+ */
+ public function parse_otherarchivelist($blogname, $template, $category = 'all', $limit = 0)
+ {
+ global $manager;
+ if ( $category == 'all' )
+ {
+ $category = '';
+ }
+ $b =& $manager->getBlog(getBlogIDFromName($blogname));
+ $this->setBlogCategory($b, $category);
+ $this->preBlogContent('otherarchivelist',$b);
+ $b->showArchiveList($template, 'month', $limit);
+ $this->postBlogContent('otherarchivelist',$b);
+ return;
+ }
+
+ /**
+ * Actions::parse_otherarchiveyearlist()
+ * Parse skinvar otherarchiveyearlist
+ *
+ * @param string $blogname name of weblog
+ * @param string $template name of template
+ * @param string $category name of category
+ * @limit integer $limit the amount of items in a display
+ */
+ public function parse_otherarchiveyearlist($blogname, $template, $category = 'all', $limit = 0)
+ {
+ global $manager;
+ if ( $category == 'all' )
+ {
+ $category = '';
+ }
+ $b =& $manager->getBlog(getBlogIDFromName($blogname));
+ $this->setBlogCategory($b, $category);
+ $this->preBlogContent('otherarchivelist',$b);
+ $b->showArchiveList($template, 'year', $limit);
+ $this->postBlogContent('otherarchivelist',$b);
+ return;
+ }
+
+ /**
+ * Actions::parse_otherblog()
+ * Parse skinvar otherblog
+ *
+ * @param string $blogname name of weblog
+ * @param string $template name of template
+ * @param mixed $amount the amount of items, in case it includes the beginning
+ * @param string $category name of category
+ * @return void
+ */
+ public function parse_otherblog($blogname, $template, $amount = 10, $category = '')
+ {
+ global $manager;
+
+ list($limit, $offset) = sscanf($amount, '%d(%d)');
+
+ $b =& $manager->getBlog(getBlogIDFromName($blogname));
+ $this->setBlogCategory($b, $category);
+ $this->preBlogContent('otherblog',$b);
+ $this->amountfound = $b->readLog($template, $limit, $offset);
+ $this->postBlogContent('otherblog',$b);
+ return;
+ }
+
+ /**
+ * Actions::parse_othersearchresults()
+ * Parse skinvar othersearchresults
+ *
+ * @param string $blogname name of weblog
+ * @param string $template name of template
+ * @param integer $maxresults the amount of results
+ * @return void
+ */
+ public function parse_othersearchresults($blogname, $template, $maxresults = 50)
+ {
+ global $query, $amount, $manager, $startpos;
+ $b =& $manager->getBlog(getBlogIDFromName($blogname));
+ // need this to select default category
+ $this->setBlogCategory($b, '');
+ $this->preBlogContent('othersearchresults',$b);
+ $b->search($query, $template, $amount, $maxresults, $startpos);
+ $this->postBlogContent('othersearchresults',$b);
+ return;
+ }
+
+ /**
+ * Actions::parse_plugin()
+ * Executes a plugin skinvar
+ * extra parameters can be added
+ *
+ * @param string $pluginName name of plugin (without the NP_)
+ * @return void
+ */
+ public function parse_plugin($pluginName)
+ {
+ global $manager;
+
+ $plugin =& $manager->getPlugin('NP_' . $pluginName);
+ if ( !$plugin )
+ {
+ return;
+ }
+
+ // get arguments
+ $params = func_get_args();
+
+ // remove plugin name
+ array_shift($params);
+
+ // add skin type on front
+ array_unshift($params, $this->skintype);
+
+ call_user_func_array(array(&$plugin,'doSkinVar'), $params);
+ return;
+ }
+
+ /**
+ * Actions::parse_prevarchive()
+ * Parse skinvar prevarchive
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_prevarchive()
+ {
+ global $archiveprev;
+ echo $archiveprev;
+ }
+
+ /**
+ * Actions::parse_preview()
+ * Parse skinvar preview
+ *
+ * @param string $template name of tempalte
+ * @return void
+ */
+ public function parse_preview($template)
+ {
+ global $blog, $CONF, $manager;
+
+ $template =& $manager->getTemplate($template);
+
+ $row['body'] = '<span id="prevbody"></span>';
+ $row['title'] = '<span id="prevtitle"></span>';
+ $row['more'] = '<span id="prevmore"></span>';
+ $row['itemlink'] = '';
+ $row['itemid'] = 0; $row['blogid'] = $blog->getID();
+
+ echo Template::fill($template['ITEM_HEADER'],$row);
+ echo Template::fill($template['ITEM'],$row);
+ echo Template::fill($template['ITEM_FOOTER'],$row);
+ return;
+ }
+
+ /**
+ * Actions::parse_previtem()
+ * Parse skinvar previtem
+ * (include itemid of prev item)
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_previtem()
+ {
+ global $itemidprev;
+ if ( isset($itemidprev) )
+ {
+ echo (integer) $itemidprev;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_previtemtitle()
+ * Parse skinvar previtemtitle
+ * (include itemtitle of prev item)
+ *
+ * @param String $format string format
+ * @return String formatted string
+ */
+ public function parse_previtemtitle($format = '')
+ {
+ global $itemtitleprev;
+
+ switch ( $format )
+ {
+ case 'xml':
+ echo Entity::hen($itemtitleprev);
+ break;
+ case 'raw':
+ echo $itemtitleprev;
+ break;
+ case 'attribute':
+ default:
+ echo Entity::hsc($itemtitleprev);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_prevlink()
+ * Parse skinvar prevlink
+ *
+ * @param string $linktext text as a content of anchor element
+ * @param integer the amount of links
+ * @return void
+ */
+ public function parse_prevlink($linktext = '', $amount = 10)
+ {
+ global $itemidprev, $archiveprev, $startpos;
+
+ if ( $this->skintype == 'item' )
+ {
+ $this->itemlink($itemidprev, $linktext);
+ }
+ else if ( $this->skintype == 'search' || $this->skintype == 'index' )
+ {
+ $this->searchlink($amount, $startpos, 'prev', $linktext);
+ }
+ else
+ {
+ $this->archivelink($archiveprev, $linktext);
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_query()
+ * Parse skinvar query
+ * (includes the search query)
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_query()
+ {
+ global $query;
+ echo Entity::hsc($query);
+ return;
+ }
+
+ /**
+ * Actions::parse_referer()
+ * Parse skinvar referer
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_referer()
+ {
+ echo Entity::hsc(serverVar('HTTP_REFERER'));
+ return;
+ }
+
+ /**
+ * Actions::parse_searchform()
+ * Parse skinvar searchform
+ *
+ * @param string $blogname name of weblog
+ * @return void
+ */
+ public function parse_searchform($blogname = '')
+ {
+ global $CONF, $manager, $maxresults;
+ if ( $blogname )
+ {
+ $blog =& $manager->getBlog(getBlogIDFromName($blogname));
+ }
+ else
+ {
+ global $blog;
+ }
+ // use default blog when no blog is selected
+ $this->formdata = array(
+ 'id' => $blog?$blog->getID():$CONF['DefaultBlog'],
+ 'query' => Entity::hsc(getVar('query')),
+ );
+ $this->doForm('searchform');
+ return;
+ }
+
+ /**
+ * Actions::parse_searchresults()
+ * Parse skinvar searchresults
+ *
+ * @param string $template name of tempalte
+ * @param integer $maxresults searched items in a display
+ * @return void;
+ */
+ public function parse_searchresults($template, $maxresults = 50 )
+ {
+ global $blog, $query, $amount, $startpos;
+
+ $this->setBlogCategory($blog, ''); // need this to select default category
+ $this->preBlogContent('searchresults',$blog);
+ $this->amountfound = $blog->search($query, $template, $amount, $maxresults, $startpos);
+ $this->postBlogContent('searchresults',$blog);
+ return;
+ }
+
+ /**
+ * Actions::parse_self()
+ * Parse skinvar self
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_self()
+ {
+ global $CONF;
+ echo $CONF['Self'];
+ return;
+ }
+
+ /**
+ * Actions::parse_sitevar()
+ * Parse skinvar sitevar
+ * (include a sitevar)
+ *
+ * @param string $which
+ * @return void
+ */
+ public function parse_sitevar($which)
+ {
+ global $CONF;
+ switch ( $which )
+ {
+ case 'url':
+ echo $CONF['IndexURL'];
+ break;
+ case 'name':
+ echo $CONF['SiteName'];
+ break;
+ case 'admin':
+ echo $CONF['AdminEmail'];
+ break;
+ case 'adminurl':
+ echo $CONF['AdminURL'];
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_skinname()
+ * Parse skinname
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_skinname()
+ {
+ echo $this->parser->skin->getName();
+ return;
+ }
+
+ /**
+ * Actions::parse_skintype()
+ * Parse skintype (experimental)
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_skintype()
+ {
+ echo $this->skintype;
+ return;
+ }
+
+ /**
+ * Actions::parse_ticket()
+ * Parse ticket
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_ticket()
+ {
+ global $manager;
+ $manager->addTicketHidden();
+ return;
+ }
+
+ /**
+ * Actions::parse_todaylink()
+ * Parse skinvar todaylink
+ * A link to the today page (depending on selected blog, etc...)
+ *
+ * @param string $linktext text for link
+ * @return void
+ */
+ public function parse_todaylink($linktext = '')
+ {
+ global $blog, $CONF;
+ if ( $blog )
+ {
+ echo $this->link(Link::create_blogid_link($blog->getID(),$this->linkparams), $linktext);
+ }
+ else
+ {
+ echo $this->link($CONF['SiteUrl'], $linktext);
+ }
+ return;
+ }
+
+ /**
+ * Parse vars
+ * When commentform is not used, to include a hidden field with itemid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_vars()
+ {
+ global $itemid;
+ echo '<input type="hidden" name="itemid" value="'.$itemid.'" />' . "\n";
+ return;
+ }
+
+ /**
+ * Actions::parse_version()
+ * Parse skinvar version
+ * (include nucleus versionnumber)
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_version()
+ {
+ global $nucleus;
+ echo 'Nucleus CMS ' . $nucleus['version'];
+ return;
+ }
+
+ /**
+ * Actions::parse_sticky()
+ * Parse skinvar sticky
+ *
+ * @param integer $itemnumber id of item
+ * @param string $template name of template
+ * @return void
+ */
+ public function parse_sticky($itemid = 0, $template = '')
+ {
+ global $manager;
+
+ $itemid = (integer) $itemid;
+ $itemarray = array($itemid);
+
+ $item =& $manager->getItem($post['itemid'], 1, 1);
+ $blog =& $manager->getBlog($item['blogid']);
+
+ $this->preBlogContent('sticky', $blog);
+ $this->amountfound = $blog->readLogFromList($itemarray, $template);
+ $this->postBlogContent('sticky', $blog);
+ return;
+ }
+}
-<?php\r
-/**\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * The code for the Nucleus admin area\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: ADMIN.php 1661 2012-02-12 11:55:39Z sakamocchi $\r
- */\r
-\r
-if ( !function_exists('requestVar') ) exit;\r
-require_once dirname(__FILE__) . '/showlist.php';\r
-\r
-class Admin\r
-{\r
- static private $skin;\r
- \r
- static public $action;\r
- static public $aOptions;\r
- static public $blog;\r
- static public $contents;\r
- static public $extrahead;\r
- static public $headMess;\r
- static public $passvar;\r
- \r
- static private $skinless_actions = array(\r
- 'plugindeleteconfirm',\r
- 'pluginoptionsupdate',\r
- 'blogsettingsupdate',\r
- 'settingsupdate',\r
- 'addnewlog2',\r
- 'additem',\r
- 'banlistnewfromitem',\r
- 'itemdeleteconfirm',\r
- 'itemupdate',\r
- 'changemembersettings',\r
- 'clearactionlog',\r
- 'memberedit',\r
- 'login',\r
- \r
- 'skinremovetypeconfirm',\r
- 'skinclone',\r
- 'skindeleteconfirm',\r
- 'skinnew',\r
- 'skineditgeneral',\r
- 'skinupdate',\r
- \r
- 'skinieexport',\r
- \r
- 'templateupdate',\r
- 'templatedeleteconfirm',\r
- 'templatenew',\r
- 'templateclone',\r
- \r
- 'adminskinremovetypeconfirm',\r
- 'adminskinclone',\r
- 'adminskindeleteconfirm',\r
- 'adminskinnew',\r
- 'adminskineditgeneral',\r
- 'adminskinupdate',\r
- \r
- 'adminskinieexport',\r
- \r
- 'admintemplateupdate',\r
- 'admintemplatedeleteconfirm',\r
- 'admintemplatenew',\r
- 'admintemplateclone'\r
- );\r
- \r
- static private $ticketless_actions = array(\r
- 'showlogin',\r
- 'login',\r
- 'overview',\r
- 'itemlist',\r
- 'blogcommentlist',\r
- 'bookmarklet',\r
- 'blogsettings',\r
- 'banlist',\r
- 'createaccount',\r
- 'deleteblog',\r
- 'editmembersettings',\r
- 'createaccount',\r
- 'forgotpassword',\r
- 'browseowncomments',\r
- 'createitem',\r
- 'browseownitems',\r
- 'itemedit',\r
- 'itemmove',\r
- 'categoryedit',\r
- 'categorydelete',\r
- 'manage',\r
- 'actionlog',\r
- 'settingsedit',\r
- 'backupoverview',\r
- 'pluginlist',\r
- 'createnewlog',\r
- 'usermanagement',\r
- 'itemcommentlist',\r
- 'commentedit',\r
- 'commentdelete',\r
- 'banlistnewfromitem',\r
- 'banlistdelete',\r
- 'itemdelete',\r
- 'manageteam',\r
- 'teamdelete',\r
- 'banlistnew',\r
- 'memberedit',\r
- 'memberdelete',\r
- 'pluginhelp',\r
- 'pluginoptions',\r
- 'plugindelete',\r
- \r
- 'activate',\r
- 'systemoverview',\r
- 'activatesetpwd',\r
- \r
- 'skinoverview',\r
- 'skinclone',\r
- 'skindelete',\r
- 'skinedit',\r
- 'skinedittype',\r
- 'skinnew',\r
- 'skinremovetype',\r
- \r
- 'skinieoverview',\r
- \r
- 'templateoverview',\r
- 'templateclone',\r
- 'templateedit',\r
- 'templatedelete',\r
- \r
- 'adminskinoverview',\r
- 'adminskinclone',\r
- 'adminskindelete',\r
- 'adminskinedit',\r
- 'adminskinedittype',\r
- 'adminskinnew',\r
- 'adminskinremovetype',\r
- \r
- 'adminskinieoverview',\r
- \r
- 'admintemplateoverview',\r
- 'admintemplateclone',\r
- 'admintemplateedit',\r
- 'admintemplatedelete'\r
- );\r
- \r
- /**\r
- * NOTE: This is for condition of admin/normal skin actions\r
- */\r
- static public $adminskin_actions = array(\r
- /* ticketless */\r
- 'adminskinoverview',\r
- 'adminskinclone',\r
- 'adminskindelete',\r
- 'adminskinedit',\r
- 'adminskinedittype',\r
- 'adminskinnew',\r
- 'adminskinremovetype',\r
- \r
- 'adminskinieoverview',\r
- \r
- 'admintemplateoverview',\r
- 'admintemplateclone',\r
- 'admintemplateedit',\r
- 'admintemplatedelete',\r
- \r
- /* ticket needed */\r
- 'adminskineditgeneral',\r
- 'adminskinupdate',\r
- 'adminskindeleteconfirm',\r
- 'adminskinremovetypeconfirm',\r
- \r
- 'adminskinieoverview',\r
- 'adminskiniedoimport',\r
- 'adminskinieexport',\r
- 'adminskinieimport',\r
- \r
- 'admintemplatenew',\r
- 'admintemplatedeleteconfirm',\r
- 'admintemplateupdate'\r
- );\r
- \r
- static public function initialize()\r
- {\r
- global $CONF, $manager, $member;\r
- \r
- /* NOTE: 1. decide which skinid to use */\r
- $skinid = $CONF['AdminSkin'];\r
- if ( $member->isLoggedIn() )\r
- {\r
- $memskin = $member->getAdminSkin();\r
- if ( $memskin && Skin::existsID($memskin))\r
- {\r
- $skinid = $memskin;\r
- }\r
- }\r
- \r
- /* NOTE: 2. make an instance of skin object */\r
- if ( !Skin::existsID($skinid) )\r
- {\r
- return FALSE;\r
- }\r
- \r
- /* NOTE: 3. initializing each members */\r
- self::$skin =& $manager->getSkin($skinid, 'AdminActions', 'AdminSkin');\r
- self::$action = '';\r
- self::$extrahead = '';\r
- self::$passvar = '';\r
- self::$headMess = '';\r
- self::$aOptions = '';\r
- return TRUE;\r
- }\r
- \r
- /**\r
- * Admin::action()\r
- * Executes an action\r
- *\r
- * @param string $action action to be performed\r
- * @return void\r
- */\r
- static public function action($action)\r
- {\r
- global $CONF, $manager, $member;\r
- \r
- /* 1. decide action name */\r
- $customAction = postvar('customaction');\r
- if ( empty($customAction) )\r
- {\r
- $alias = array(\r
- 'login' => 'overview',\r
- '' => 'overview',\r
- );\r
- }\r
- else\r
- {\r
- $alias = array(\r
- 'login' => $customAction,\r
- '' => $customAction\r
- );\r
- }\r
- if ( array_key_exists($action, $alias) && isset($alias[$action]) )\r
- {\r
- $action = $alias[$action];\r
- }\r
- $method_name = "action_{$action}";\r
- self::$action = strtolower($action);\r
- \r
- /* 2. check ticket-needed action */\r
- if ( !in_array(self::$action, self::$ticketless_actions) && !$manager->checkTicket() )\r
- {\r
- self::error(_ERROR_BADTICKET);\r
- return;\r
- }\r
- \r
- /* 3. parse according to the action */\r
- else if ( method_exists('Admin', $method_name) )\r
- {\r
- call_user_func(array(__CLASS__, $method_name));\r
- return;\r
- }\r
- /* 4. parse special admin skin */\r
- elseif ( in_array(self::$action, self::$skinless_actions) )\r
- {\r
- /* TODO: need to be implemented or not?\r
- self::action_parseSpecialskin();\r
- */\r
- }\r
- else\r
- {\r
- self::error(_BADACTION . ENTITY::hsc($action));\r
- return;\r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Action::action_showlogin()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_showlogin()\r
- {\r
- global $error;\r
- self::action_login($error);\r
- return;\r
- }\r
- \r
- /**\r
- * Action::action_login()\r
- * \r
- * @param string $msg message for pageheader\r
- * @param integer $passvars ???\r
- */\r
- static private function action_login($msg = '', $passvars = 1)\r
- {\r
- global $member;\r
- \r
- // skip to overview when allowed\r
- if ( $member->isLoggedIn() && $member->canLogin() )\r
- {\r
- self::action_overview();\r
- return;\r
- }\r
- \r
- /* TODO: needless variable??? */\r
- self::$passvar = $passvars;\r
- if ( $msg )\r
- {\r
- self::$headMess = $msg;\r
- }\r
- \r
- self::$skin->parse('showlogin');\r
- }\r
- \r
- /**\r
- * Action::action_overview()\r
- * provides a screen with the overview of the actions available\r
- * \r
- * @param string $msg message for pageheader\r
- * @return void\r
- */\r
- static private function action_overview($msg = '')\r
- {\r
- if ( $msg )\r
- {\r
- self::$headMess = $msg;\r
- }\r
- \r
- self::$skin->parse('overview');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_manage()\r
- * \r
- * @param string $msg message for pageheader\r
- * @retrn void\r
- */\r
- static private function action_manage($msg = '')\r
- {\r
- global $member;\r
- \r
- if ( $msg )\r
- {\r
- self::$headMess = $msg;\r
- }\r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('manage');\r
- return;\r
- }\r
- \r
- /**\r
- * Action::action_itemlist()\r
- * \r
- * @param integer id for weblod\r
- * @return void\r
- */\r
- static private function action_itemlist($blogid = '')\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- if ( $blogid == '' )\r
- {\r
- $blogid = intRequestVar('blogid');\r
- }\r
- \r
- $member->teamRights($blogid) or $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('itemlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Action::action_batchitem()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_batchitem()\r
- {\r
- global $member, $manager;\r
- \r
- $member->isLoggedIn() or self::disallow();\r
- \r
- $selected = requestIntArray('batch');\r
- $action = requestVar('batchaction');\r
- \r
- if ( !is_array($selected) || sizeof($selected) == 0 )\r
- {\r
- self::error(_BATCH_NOSELECTION);\r
- return;\r
- }\r
- \r
- // On move: when no destination blog/category chosen, show choice now\r
- $destCatid = intRequestVar('destcatid');\r
- if ( ($action == 'move') && (!$manager->existsCategory($destCatid)) )\r
- {\r
- self::batchMoveSelectDestination('item', $selected);\r
- }\r
- \r
- // On delete: check if confirmation has been given\r
- if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )\r
- {\r
- self::batchAskDeleteConfirmation('item', $selected);\r
- }\r
- \r
- self::$skin->parse('batchitem');\r
- return;\r
- }\r
- \r
- /**\r
- * Action::action_batchcomment()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_batchcomment()\r
- {\r
- global $member;\r
- \r
- $member->isLoggedIn() or self::disallow();\r
- \r
- $selected = requestIntArray('batch');\r
- $action = requestVar('batchaction');\r
- \r
- // Show error when no items were selected\r
- if ( !is_array($selected) || sizeof($selected) == 0 )\r
- {\r
- self::error(_BATCH_NOSELECTION);\r
- return;\r
- }\r
- \r
- // On delete: check if confirmation has been given\r
- if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )\r
- {\r
- self::batchAskDeleteConfirmation('comment', $selected);\r
- }\r
- \r
- self::$skin->parse('batchcomment');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_batchmember()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_batchmember()\r
- {\r
- global $member;\r
- \r
- ($member->isLoggedIn() && $member->isAdmin()) or self::disallow();\r
- \r
- $selected = requestIntArray('batch');\r
- $action = requestVar('batchaction');\r
- \r
- // Show error when no members selected\r
- if ( !is_array($selected) || sizeof($selected) == 0 )\r
- {\r
- self::error(_BATCH_NOSELECTION);\r
- return;\r
- }\r
- \r
- // On delete: check if confirmation has been given\r
- if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )\r
- {\r
- self::batchAskDeleteConfirmation('member',$selected);\r
- }\r
- \r
- self::$skin->parse('batchmember');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_batchteam()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_batchteam()\r
- {\r
- global $member;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- ($member->isLoggedIn() && $member->blogAdminRights($blogid)) or self::disallow();\r
- \r
- $selected = requestIntArray('batch');\r
- $action = requestVar('batchaction');\r
- \r
- if ( !is_array($selected) || sizeof($selected) == 0 )\r
- {\r
- self::error(_BATCH_NOSELECTION);\r
- return;\r
- }\r
- \r
- // On delete: check if confirmation has been given\r
- if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )\r
- {\r
- self::batchAskDeleteConfirmation('team',$selected);\r
- }\r
- \r
- self::$skin->parse('batchteam');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_batchcategory()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_batchcategory()\r
- {\r
- global $member, $manager;\r
- \r
- $member->isLoggedIn() or self::disallow();\r
- \r
- $selected = requestIntArray('batch');\r
- $action = requestVar('batchaction');\r
- \r
- if ( !is_array($selected) || sizeof($selected) == 0 )\r
- {\r
- self::error(_BATCH_NOSELECTION);\r
- return;\r
- }\r
- \r
- // On move: when no destination blog chosen, show choice now\r
- $destBlogId = intRequestVar('destblogid');\r
- if ( ($action == 'move') && (!$manager->existsBlogID($destBlogId)) )\r
- {\r
- self::batchMoveCategorySelectDestination('category', $selected);\r
- }\r
- \r
- // On delete: check if confirmation has been given\r
- if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )\r
- {\r
- self::batchAskDeleteConfirmation('category', $selected);\r
- }\r
- \r
- self::$skin->parse('batchcategory');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::batchMoveSelectDestination()\r
- * \r
- * @param string $type type of batch action\r
- * @param integer $ids needless???\r
- * @return void\r
- * \r
- * TODO: remove needless argument\r
- */\r
- static private function batchMoveSelectDestination($type, $ids)\r
- {\r
- $_POST['batchmove'] = $type;\r
- self::$skin->parse('batchmove');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::batchMoveCategorySelectDestination()\r
- * \r
- * @param string $type type of batch action\r
- * @param integer $ids needless???\r
- * @return void\r
- * \r
- * TODO: remove needless argument\r
- */\r
- static private function batchMoveCategorySelectDestination($type, $ids)\r
- {\r
- $_POST['batchmove'] = $type;\r
- global $manager;\r
- self::$skin->parse('batchmovecat');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::batchAskDeleteConfirmation()\r
- * \r
- * @param string $type type of batch action\r
- * @param integer $ids needless???\r
- * @return void\r
- * \r
- * TODO: remove needless argument\r
- */\r
- static private function batchAskDeleteConfirmation($type, $ids)\r
- {\r
- self::$skin->parse('batchdelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_browseownitems()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_browseownitems()\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- self::$skin->parse('browseownitems');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_itemcommentlist()\r
- * Show all the comments for a given item\r
- * \r
- * @param integer $itemid ID for item\r
- * @return void\r
- */\r
- static private function action_itemcommentlist($itemid = '')\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- if ( $itemid == '' )\r
- {\r
- $itemid = intRequestVar('itemid');\r
- }\r
- \r
- // only allow if user is allowed to alter item\r
- $member->canAlterItem($itemid) or self::disallow();\r
- \r
- $item =& $manager->getItem($itemid, 1, 1);\r
- $_REQUEST['itemid'] = $item['itemid'];\r
- $_REQUEST['blogid'] = $item['blogid'];\r
- \r
- self::$skin->parse('itemcommentlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_browseowncomments()\r
- * Browse own comments\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_browseowncomments()\r
- {\r
- self::$skin->parse('browseowncomments');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_blogcommentlist()\r
- * Browse all comments for a weblog\r
- * \r
- * @param integer $blogid ID for weblog\r
- * @return void\r
- */\r
- static private function action_blogcommentlist($blogid = '')\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- if ( $blogid == '' )\r
- {\r
- $blogid = intRequestVar('blogid');\r
- }\r
- else\r
- {\r
- $blogid = intval($blogid);\r
- }\r
- \r
- $member->teamRights($blogid) or $member->isAdmin() or self::disallow();\r
- \r
- /* TODO: we consider to use the other way insterad of this */\r
- $_REQUEST['blogid'] = $blogid;\r
- \r
- self::$skin->parse('blogcommentlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_createaccount()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_createaccount()\r
- {\r
- global $CONF;\r
- \r
- if ( $CONF['AllowMemberCreate'] != 1 )\r
- {\r
- self::$skin->parse('createaccountdisable');\r
- return;\r
- }\r
- \r
- $name = '';\r
- $realname ='';\r
- $email = '';\r
- $url = '';\r
- \r
- $contents = array(\r
- 'name' => '',\r
- 'realname' => '',\r
- 'email' => '',\r
- 'url' => ''\r
- );\r
- \r
- if ( array_key_exists('showform', $_POST) && $_POST['showform'] == 1 )\r
- {\r
- $action = new Action();\r
- $message = $action->createAccount();\r
- if ( $message === 1 )\r
- {\r
- self::$headMess = $message;\r
- self::$skin->parse('createaccountsuccess');\r
- return;\r
- }\r
- \r
- /* TODO: validation */\r
- if ( array_key_exists('name', $_POST) )\r
- {\r
- $contents['name'] = $_POST['name'];\r
- }\r
- if ( array_key_exists('realname', $_POST) )\r
- {\r
- $contents['realname'] = $_POST['realname'];\r
- }\r
- if ( array_key_exists('email', $_POST) )\r
- {\r
- $contents['email'] = $_POST['email'];\r
- }\r
- if ( array_key_exists('url', $_POST) )\r
- {\r
- $contents['url'] = $_POST['url'];\r
- }\r
- \r
- self::$contents = $contents;\r
- \r
- }\r
- \r
- self::$skin->parse('createaccountinput');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_createitem()\r
- * Provide a page to item a new item to the given blog\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_createitem()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- // check if allowed\r
- $member->teamRights($blogid) or self::disallow();\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- $contents = array();\r
- \r
- $data = array(\r
- 'blog' => &$blog,\r
- 'contents' => &$contents\r
- );\r
- $manager->notify('PreAddItemForm', $data);\r
- \r
- if ( $blog->convertBreaks() )\r
- {\r
- if ( array_key_exists('body', $contents) && !empty($contents['body']) )\r
- {\r
- $contents['body'] = removeBreaks($contents['body']);\r
- }\r
- if ( array_key_exists('more', $contents) && !empty($contents['more']) )\r
- {\r
- $contents['more'] = removeBreaks($contents['more']);\r
- }\r
- }\r
- \r
- self::$blog = &$blog;\r
- self::$contents = &$contents;\r
- \r
- self::$skin->parse('createitem');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_itemedit()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_itemedit()\r
- {\r
- global $member, $manager;\r
- \r
- $itemid = intRequestVar('itemid');\r
- \r
- // only allow if user is allowed to alter item\r
- $member->canAlterItem($itemid) or self::disallow();\r
- \r
- $item =& $manager->getItem($itemid, 1, 1);\r
- $blog =& $manager->getBlog($item['blogid']);\r
- $manager->notify('PrepareItemForEdit', array('blog'=> &$blog, 'item' => &$item));\r
- \r
- if ( $blog->convertBreaks() )\r
- {\r
- if ( array_key_exists('body', $item) && !empty($item['body']) )\r
- {\r
- $item['body'] = removeBreaks($item['body']);\r
- }\r
- if ( array_key_exists('more', $item) && !empty($item['more']) )\r
- {\r
- $item['more'] = removeBreaks($item['more']);\r
- }\r
- }\r
- \r
- self::$blog = &$blog;\r
- self::$contents = &$item;\r
- \r
- self::$skin->parse('itemedit');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_itemupdate()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_itemupdate()\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- $itemid = intRequestVar('itemid');\r
- $catid = postVar('catid');\r
- \r
- // only allow if user is allowed to alter item\r
- $member->canUpdateItem($itemid, $catid) or self::disallow();\r
- \r
- $actiontype = postVar('actiontype');\r
- \r
- // delete actions are handled by itemdelete (which has confirmation)\r
- if ( $actiontype == 'delete' )\r
- {\r
- self::action_itemdelete();\r
- return;\r
- }\r
- \r
- $body = postVar('body');\r
- $title = postVar('title');\r
- $more = postVar('more');\r
- $closed = intPostVar('closed');\r
- $draftid = intPostVar('draftid');\r
- \r
- // default action = add now\r
- if ( !$actiontype )\r
- {\r
- $actiontype='addnow';\r
- }\r
- \r
- // create new category if needed\r
- if ( i18n::strpos($catid,'newcat') === 0 )\r
- {\r
- // get blogid\r
- list($blogid) = sscanf($catid,"newcat-%d");\r
- \r
- // create\r
- $blog =& $manager->getBlog($blogid);\r
- $catid = $blog->createNewCategory();\r
- \r
- // show error when sth goes wrong\r
- if ( !$catid )\r
- {\r
- self::doError(_ERROR_CATCREATEFAIL);\r
- }\r
- }\r
- \r
- /**\r
- * set some variables based on actiontype\r
- * \r
- * actiontypes:\r
- * draft items -> addnow, addfuture, adddraft, delete\r
- * non-draft items -> edit, changedate, delete\r
- * \r
- * variables set:\r
- * $timestamp: set to a nonzero value for future dates or date changes\r
- * $wasdraft: set to 1 when the item used to be a draft item\r
- * $publish: set to 1 when the edited item is not a draft\r
- */\r
- $blogid = getBlogIDFromItemID($itemid);\r
- $blog =& $manager->getBlog($blogid);\r
- \r
- $wasdrafts = array('adddraft', 'addfuture', 'addnow');\r
- $wasdraft = in_array($actiontype, $wasdrafts) ? 1 : 0;\r
- $publish = ($actiontype != 'adddraft' && $actiontype != 'backtodrafts') ? 1 : 0;\r
- if ( $actiontype == 'addfuture' || $actiontype == 'changedate' )\r
- {\r
- $timestamp = mktime(intPostVar('hour'), intPostVar('minutes'), 0, intPostVar('month'), intPostVar('day'), intPostVar('year'));\r
- }\r
- else\r
- {\r
- $timestamp =0;\r
- }\r
- \r
- // edit the item for real\r
- Item::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp);\r
- \r
- self::updateFuturePosted($blogid);\r
- \r
- if ( $draftid > 0 )\r
- {\r
- // delete permission is checked inside Item::delete()\r
- Item::delete($draftid);\r
- }\r
- \r
- if ( $catid != intPostVar('catid') )\r
- {\r
- self::action_categoryedit(\r
- $catid,\r
- $blog->getID(),\r
- $CONF['AdminURL'] . 'index.php?action=itemlist&blogid=' . getBlogIDFromItemID($itemid)\r
- );\r
- }\r
- else\r
- {\r
- // TODO: set start item correctly for itemlist\r
- $item =& $manager->getitem($itemid, 1, 1);\r
- $query = "SELECT COUNT(*) FROM %s WHERE unix_timestamp(itime) <= '%s';";\r
- $query = sprintf($query, sql_table('item'), $item['timestamp']);\r
- $cnt = DB::getValue($query);\r
- $_REQUEST['start'] = $cnt + 1;\r
- self::action_itemlist(getBlogIDFromItemID($itemid));\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_itemdelete()\r
- * Delete item\r
- * \r
- * @param Void\r
- * @return Void\r
- */\r
- static private function action_itemdelete()\r
- {\r
- global $member, $manager;\r
- \r
- $itemid = intRequestVar('itemid');\r
- \r
- // only allow if user is allowed to alter item\r
- $member->canAlterItem($itemid) or self::disallow();\r
- \r
- if ( !$manager->existsItem($itemid,1,1) )\r
- {\r
- self::error(_ERROR_NOSUCHITEM);\r
- return;\r
- }\r
- \r
- self::$skin->parse('itemdelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_itemdeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_itemdeleteconfirm()\r
- {\r
- global $member, $manager;\r
- \r
- $itemid = intRequestVar('itemid');\r
- \r
- // only allow if user is allowed to alter item\r
- $member->canAlterItem($itemid) or self::disallow();\r
- \r
- // get item first\r
- $item =& $manager->getItem($itemid, 1, 1);\r
- \r
- // delete item (note: some checks will be performed twice)\r
- self::deleteOneItem($item['itemid']);\r
- \r
- self::action_itemlist($item['blogid']);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::deleteOneItem()\r
- * Deletes one item and returns error if something goes wrong\r
- * \r
- * @param integer $itemid ID for item\r
- * @return void\r
- */\r
- static public function deleteOneItem($itemid)\r
- {\r
- global $member, $manager;\r
- \r
- // only allow if user is allowed to alter item (also checks if itemid exists)\r
- if ( !$member->canAlterItem($itemid) )\r
- {\r
- return _ERROR_DISALLOWED;\r
- }\r
- \r
- // need to get blogid before the item is deleted\r
- $item =& $manager->getItem($itemid, 1, 1);\r
- \r
- $manager->loadClass('ITEM');\r
- Item::delete($item['itemid']);\r
- \r
- // update blog's futureposted\r
- self::updateFuturePosted($item['itemid']);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::updateFuturePosted()\r
- * Update a blog's future posted flag\r
- * \r
- * @param integer $blogid\r
- * @return void\r
- */\r
- static private function updateFuturePosted($blogid)\r
- {\r
- global $manager;\r
- \r
- $blogid = intval($blogid);\r
- $blog =& $manager->getBlog($blogid);\r
- $currenttime = $blog->getCorrectTime(time());\r
- \r
- $query = "SELECT * FROM %s WHERE iblog=%d AND iposted=0 AND itime>'%s'";\r
- $query = sprintf($query, sql_table('item'), (integer) $blogid, i18n::formatted_datetime('mysql', $currenttime));\r
- $result = DB::getResult($query);\r
- \r
- if ( $result->rowCount() > 0 )\r
- {\r
- $blog->setFuturePost();\r
- }\r
- else\r
- {\r
- $blog->clearFuturePost();\r
- }\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_itemmove()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_itemmove()\r
- {\r
- global $member, $manager;\r
- \r
- $itemid = intRequestVar('itemid');\r
- \r
- $member->canAlterItem($itemid) or self::disallow();\r
- \r
- self::$skin->parse('itemmove');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_itemmoveto()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_itemmoveto()\r
- {\r
- global $member, $manager;\r
- \r
- $itemid = intRequestVar('itemid');\r
- $catid = requestVar('catid');\r
- \r
- // create new category if needed\r
- if ( i18n::strpos($catid,'newcat') === 0 )\r
- {\r
- // get blogid\r
- list($blogid) = sscanf($catid,'newcat-%d');\r
- \r
- // create\r
- $blog =& $manager->getBlog($blogid);\r
- $catid = $blog->createNewCategory();\r
- \r
- // show error when sth goes wrong\r
- if ( !$catid )\r
- {\r
- self::doError(_ERROR_CATCREATEFAIL);\r
- }\r
- }\r
- \r
- // only allow if user is allowed to alter item\r
- $member->canUpdateItem($itemid, $catid) or self::disallow();\r
- \r
- $old_blogid = getBlogIDFromItemId($itemid);\r
- \r
- Item::move($itemid, $catid);\r
- \r
- // set the futurePosted flag on the blog\r
- self::updateFuturePosted(getBlogIDFromItemId($itemid));\r
- \r
- // reset the futurePosted in case the item is moved from one blog to another\r
- self::updateFuturePosted($old_blogid);\r
- \r
- if ( $catid != intRequestVar('catid') )\r
- {\r
- self::action_categoryedit($catid, $blog->getID());\r
- }\r
- else\r
- {\r
- self::action_itemlist(getBlogIDFromCatID($catid));\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::moveOneItem()\r
- * Moves one item to a given category (category existance should be checked by caller)\r
- * errors are returned\r
- * \r
- * @param integer $itemid ID for item\r
- * @param integer $destCatid ID for category to which the item will be moved\r
- * @return void\r
- */\r
- static public function moveOneItem($itemid, $destCatid)\r
- {\r
- global $member;\r
- \r
- // only allow if user is allowed to move item\r
- if ( !$member->canUpdateItem($itemid, $destCatid) )\r
- {\r
- return _ERROR_DISALLOWED;\r
- }\r
- \r
- Item::move($itemid, $destCatid);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_additem()\r
- * Adds a item to the chosen blog\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_additem()\r
- {\r
- global $manager, $CONF;\r
- \r
- $manager->loadClass('ITEM');\r
- \r
- $result = Item::createFromRequest();\r
- \r
- if ( $result['status'] == 'error' )\r
- {\r
- self::error($result['message']);\r
- return;\r
- }\r
- \r
- $item =& $manager->getItem($result['itemid'], 0, 0);\r
- \r
- if ( $result['status'] == 'newcategory' )\r
- {\r
- $distURI = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=itemList&blogid=' . $item['blogid']);\r
- self::action_categoryedit($result['catid'], $item['blogid'], $distURI);\r
- }\r
- else\r
- {\r
- $methodName = 'action_itemlist';\r
- self::action_itemlist($item['blogid']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_commentedit()\r
- * Allows to edit previously made comments\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_commentedit()\r
- {\r
- global $member, $manager;\r
- \r
- $commentid = intRequestVar('commentid');\r
- \r
- $member->canAlterComment($commentid) or self::disallow();\r
- \r
- $comment = COMMENT::getComment($commentid);\r
- $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));\r
- \r
- self::$contents = $comment;\r
- self::$skin->parse('commentedit');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_commentupdate()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_commentupdate()\r
- {\r
- global $member, $manager;\r
- \r
- $commentid = intRequestVar('commentid');\r
- \r
- $member->canAlterComment($commentid) or self::disallow();\r
- \r
- $url = postVar('url');\r
- $email = postVar('email');\r
- $body = postVar('body');\r
- \r
- // intercept words that are too long\r
- if (preg_match('#[a-zA-Z0-9|\.,;:!\?=\/\\\\]{90,90}#', $body) != FALSE)\r
- {\r
- self::error(_ERROR_COMMENT_LONGWORD);\r
- return;\r
- }\r
- \r
- // check length\r
- if ( i18n::strlen($body) < 3 )\r
- {\r
- self::error(_ERROR_COMMENT_NOCOMMENT);\r
- return;\r
- }\r
- \r
- if ( i18n::strlen($body) > 5000 )\r
- {\r
- self::error(_ERROR_COMMENT_TOOLONG);\r
- return;\r
- }\r
- \r
- // prepare body\r
- $body = Comment::prepareBody($body);\r
- \r
- // call plugins\r
- $data = array(\r
- 'body' => &$body\r
- );\r
- $manager->notify('PreUpdateComment', $data);\r
- \r
- $query = "UPDATE %s SET cmail=%s, cemail=%s, cbody=%s WHERE cnumber=%d;";\r
- $query = sprintf($query, sql_table('comment'), DB::quoteValue($url), DB::quoteValue($email), DB::quoteValue($body), (integer) $commentid);\r
- DB::execute($query);\r
- \r
- // get itemid\r
- $query = "SELECT citem FROM %s WHERE cnumber=%d;";\r
- $query = sprintf($query, sql_table('comment'), (integer) $commentid);\r
- \r
- $itemid = DB::getValue($query);\r
- \r
- if ( $member->canAlterItem($itemid) )\r
- {\r
- self::action_itemcommentlist($itemid);\r
- }\r
- else\r
- {\r
- self::action_browseowncomments();\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_commentdelete()\r
- * Update comment\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_commentdelete()\r
- {\r
- global $member, $manager;\r
- \r
- $commentid = intRequestVar('commentid');\r
- $member->canAlterComment($commentid) or self::disallow();\r
- \r
- self::$skin->parse('commentdelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_commentdeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_commentdeleteconfirm()\r
- {\r
- global $member;\r
- \r
- $commentid = intRequestVar('commentid');\r
- \r
- // get item id first\r
- $query = "SELECT citem FROM %s WHERE cnumber=%d;";\r
- $query = sprintf($query, sql_table('comment'), (integer) $commentid);\r
- \r
- $itemid = DB::getValue($query);\r
- \r
- $error = self::deleteOneComment($commentid);\r
- if ( $error )\r
- {\r
- self::doError($error);\r
- }\r
- \r
- if ( $member->canAlterItem($itemid) )\r
- {\r
- self::action_itemcommentlist($itemid);\r
- }\r
- else\r
- {\r
- self::action_browseowncomments();\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::deleteOneComment()\r
- * \r
- * @param integer $commentid ID for comment\r
- * @return void\r
- */\r
- static public function deleteOneComment($commentid)\r
- {\r
- global $member, $manager;\r
- \r
- $commentid = (integer) $commentid;\r
- \r
- if ( !$member->canAlterComment($commentid) )\r
- {\r
- return _ERROR_DISALLOWED;\r
- }\r
- \r
- $data = array(\r
- 'commentid' => $commentid\r
- );\r
- \r
- $manager->notify('PreDeleteComment', $data);\r
- \r
- // delete the comments associated with the item\r
- $query = "DELETE FROM %s WHERE cnumber=%d;";\r
- $query = sprintf($query, sql_table('comment'), (integer) $commentid);\r
- DB::execute($query);\r
- \r
- $data = array(\r
- 'commentid' => $commentid\r
- );\r
- \r
- $manager->notify('PostDeleteComment', $data);\r
- \r
- return '';\r
- }\r
- \r
- /**\r
- * Admin::action_usermanagement()\r
- * Usermanagement main\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_usermanagement()\r
- {\r
- global $member, $manager;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('usermanagement');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_memberedit()\r
- * Edit member settings\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_memberedit()\r
- {\r
- self::action_editmembersettings(intRequestVar('memberid'));\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_editmembersettings()\r
- * \r
- * @param integer $memberid ID for member\r
- * @return void\r
- * \r
- */\r
- static private function action_editmembersettings($memberid = '')\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- if ( $memberid == '' )\r
- {\r
- $memberid = $member->getID();\r
- }\r
- \r
- /* TODO: we should consider to use the other way insterad of this */\r
- $_REQUEST['memberid'] = $memberid;\r
- \r
- // check if allowed\r
- ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();\r
- \r
- self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";\r
- \r
- self::$skin->parse('editmembersettings');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_changemembersettings()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_changemembersettings()\r
- {\r
- global $member, $CONF, $manager;\r
- \r
- $memberid = intRequestVar('memberid');\r
- \r
- // check if allowed\r
- ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();\r
- \r
- $name = trim(strip_tags(postVar('name')));\r
- $realname = trim(strip_tags(postVar('realname')));\r
- $password = postVar('password');\r
- $repeatpassword = postVar('repeatpassword');\r
- $email = strip_tags(postVar('email'));\r
- $url = strip_tags(postVar('url'));\r
- $adminskin = intPostVar('adminskin');\r
- $bookmarklet = intPostVar('bookmarklet');\r
- \r
- // begin if: sometimes user didn't prefix the URL with http:// or https://, this cause a malformed URL. Let's fix it.\r
- if ( !preg_match('#^https?://#', $url) )\r
- {\r
- $url = 'http://' . $url;\r
- }\r
- \r
- $admin = postVar('admin');\r
- $canlogin = postVar('canlogin');\r
- $notes = strip_tags(postVar('notes'));\r
- $locale = postVar('locale');\r
- \r
- $mem =& $manager->getMember($memberid);\r
- \r
- if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )\r
- {\r
- if ( !isValidDisplayName($name) )\r
- {\r
- self::error(_ERROR_BADNAME);\r
- return;\r
- }\r
- \r
- if ( ($name != $mem->getDisplayName()) && Member::exists($name) )\r
- {\r
- self::error(_ERROR_NICKNAMEINUSE);\r
- return;\r
- }\r
- \r
- if ( $password != $repeatpassword )\r
- {\r
- self::error(_ERROR_PASSWORDMISMATCH);\r
- return;\r
- }\r
- \r
- if ( $password && (i18n::strlen($password) < 6) )\r
- {\r
- self::error(_ERROR_PASSWORDTOOSHORT);\r
- return;\r
- }\r
- \r
- if ( $password )\r
- {\r
- $pwdvalid = true;\r
- $pwderror = '';\r
- \r
- $data = array(\r
- 'password' => $password,\r
- 'errormessage' => &$pwderror,\r
- 'valid' => &$pwdvalid\r
- );\r
- $manager->notify('PrePasswordSet', $data);\r
- \r
- if ( !$pwdvalid )\r
- {\r
- self::error($pwderror);\r
- return;\r
- }\r
- }\r
- }\r
- \r
- if ( !NOTIFICATION::address_validation($email) )\r
- {\r
- self::error(_ERROR_BADMAILADDRESS);\r
- return;\r
- }\r
- if ( !$realname )\r
- {\r
- self::error(_ERROR_REALNAMEMISSING);\r
- return;\r
- }\r
- if ( ($locale != '') && (!in_array($locale, i18n::get_available_locale_list())) )\r
- {\r
- self::error(_ERROR_NOSUCHTRANSLATION);\r
- return;\r
- }\r
- \r
- // check if there will remain at least one site member with both the logon and admin rights\r
- // (check occurs when taking away one of these rights from such a member)\r
- if ( (!$admin && $mem->isAdmin() && $mem->canLogin())\r
- || (!$canlogin && $mem->isAdmin() && $mem->canLogin())\r
- )\r
- {\r
- $r = DB::getResult('SELECT * FROM '.sql_table('member').' WHERE madmin=1 and mcanlogin=1');\r
- if ( $r->rowCount() < 2 )\r
- {\r
- self::error(_ERROR_ATLEASTONEADMIN);\r
- return;\r
- }\r
- }\r
- \r
- if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )\r
- {\r
- $mem->setDisplayName($name);\r
- if ( $password )\r
- {\r
- $mem->setPassword($password);\r
- }\r
- }\r
- \r
- $oldEmail = $mem->getEmail();\r
- \r
- $mem->setRealName($realname);\r
- $mem->setEmail($email);\r
- $mem->setURL($url);\r
- $mem->setNotes($notes);\r
- $mem->setLocale($locale);\r
- $mem->setAdminSkin($adminskin);\r
- $mem->setBookmarklet($bookmarklet);\r
-\r
- // only allow super-admins to make changes to the admin status\r
- if ( $member->isAdmin() )\r
- {\r
- $mem->setAdmin($admin);\r
- $mem->setCanLogin($canlogin);\r
- }\r
- \r
- $autosave = postVar('autosave');\r
- $mem->setAutosave($autosave);\r
- \r
- $mem->write();\r
- \r
- // store plugin options\r
- $aOptions = requestArray('plugoption');\r
- NucleusPlugin::apply_plugin_options($aOptions);\r
- $data = array(\r
- 'context' => 'member',\r
- 'memberid' => $memberid,\r
- 'member' => &$mem\r
- );\r
- $manager->notify('PostPluginOptionsUpdate', $data);\r
- \r
- // if email changed, generate new password\r
- if ( $oldEmail != $mem->getEmail() )\r
- {\r
- $mem->sendActivationLink('addresschange', $oldEmail);\r
- // logout member\r
- $mem->newCookieKey();\r
- \r
- // only log out if the member being edited is the current member.\r
- if ( $member->getID() == $memberid )\r
- {\r
- $member->logout();\r
- }\r
- self::action_login(_MSG_ACTIVATION_SENT, 0);\r
- return;\r
- }\r
- \r
- if ( ($mem->getID() == $member->getID())\r
- && ($mem->getDisplayName() != $member->getDisplayName()) )\r
- {\r
- $mem->newCookieKey();\r
- $member->logout();\r
- self::action_login(_MSG_LOGINAGAIN, 0);\r
- }\r
- else\r
- {\r
- self::action_overview(_MSG_SETTINGSCHANGED);\r
- }\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_memberadd()\r
- * \r
- * @param void\r
- * @return void\r
- * \r
- */\r
- static private function action_memberadd()\r
- {\r
- global $member, $manager;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- if ( postVar('password') != postVar('repeatpassword') )\r
- {\r
- self::error(_ERROR_PASSWORDMISMATCH);\r
- return;\r
- }\r
- \r
- if ( i18n::strlen(postVar('password')) < 6 )\r
- {\r
- self::error(_ERROR_PASSWORDTOOSHORT);\r
- return;\r
- }\r
- \r
- $res = Member::create(\r
- postVar('name'),\r
- postVar('realname'),\r
- postVar('password'),\r
- postVar('email'),\r
- postVar('url'),\r
- postVar('admin'),\r
- postVar('canlogin'),\r
- postVar('notes')\r
- );\r
- \r
- if ( $res != 1 )\r
- {\r
- self::error($res);\r
- return;\r
- }\r
- \r
- // fire PostRegister event\r
- $newmem = new Member();\r
- $newmem->readFromName(postVar('name'));\r
- $data = array(\r
- 'member' => &$newmem\r
- );\r
- $manager->notify('PostRegister', $data);\r
- \r
- self::action_usermanagement();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_forgotpassword()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_forgotpassword()\r
- {\r
- self::$skin->parse('forgotpassword');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_activate()\r
- * Account activation\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_activate()\r
- {\r
- $key = getVar('key');\r
- self::showActivationPage($key);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::showActivationPage()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function showActivationPage($key, $message = '')\r
- {\r
- global $manager;\r
- \r
- // clean up old activation keys\r
- Member::cleanupActivationTable();\r
- \r
- // get activation info\r
- $info = Member::getActivationInfo($key);\r
- \r
- if ( !$info )\r
- {\r
- self::error(_ERROR_ACTIVATE);\r
- return;\r
- }\r
- \r
- $mem =& $manager->getMember($info->vmember);\r
- \r
- if ( !$mem )\r
- {\r
- self::error(_ERROR_ACTIVATE);\r
- return;\r
- }\r
- \r
- /* TODO: we should consider to use the other way insterad of this */\r
- $_POST['ackey'] = $key;\r
- $_POST['bNeedsPasswordChange'] = TRUE;\r
- \r
- self::$headMess = $message;\r
- self::$skin->parse('activate');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_activatesetpwd()\r
- * Account activation - set password part\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_activatesetpwd()\r
- {\r
- global $manager;\r
- $key = postVar('key');\r
- \r
- // clean up old activation keys\r
- Member::cleanupActivationTable();\r
- \r
- // get activation info\r
- $info = Member::getActivationInfo($key);\r
- \r
- if ( !$info || ($info->type == 'addresschange') )\r
- {\r
- return self::showActivationPage($key, _ERROR_ACTIVATE);\r
- }\r
- \r
- $mem =& $manager->getMember($info->vmember);\r
- \r
- if ( !$mem )\r
- {\r
- return self::showActivationPage($key, _ERROR_ACTIVATE);\r
- }\r
- \r
- $password = postVar('password');\r
- $repeatpassword = postVar('repeatpassword');\r
- \r
- if ( $password != $repeatpassword )\r
- {\r
- return self::showActivationPage($key, _ERROR_PASSWORDMISMATCH);\r
- }\r
- \r
- if ( $password && (i18n::strlen($password) < 6) )\r
- {\r
- return self::showActivationPage($key, _ERROR_PASSWORDTOOSHORT);\r
- }\r
- \r
- if ( $password )\r
- {\r
- $pwdvalid = true;\r
- $pwderror = '';\r
- \r
- $data = array(\r
- 'password' => $password,\r
- 'errormessage' => &$pwderror,\r
- 'valid' => &$pwdvalid\r
- );\r
- $manager->notify('PrePasswordSet', $data);\r
- if ( !$pwdvalid )\r
- {\r
- return self::showActivationPage($key,$pwderror);\r
- }\r
- }\r
- \r
- $error = '';\r
- \r
- $data = array(\r
- 'type' => 'activation',\r
- 'member' => $mem,\r
- 'error' => &$error\r
- );\r
- $manager->notify('ValidateForm', $data);\r
- if ( $error != '' )\r
- {\r
- return self::showActivationPage($key, $error);\r
- }\r
- \r
- // set password\r
- $mem->setPassword($password);\r
- $mem->write();\r
- \r
- // do the activation\r
- Member::activate($key);\r
- \r
- self::$skin->parse('activatesetpwd');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_manageteam()\r
- * Manage team\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_manageteam()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- // check if allowed\r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- self::$skin->parse('manageteam');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_teamaddmember()\r
- * Add member to team\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_teamaddmember()\r
- {\r
- global $member, $manager;\r
- \r
- $memberid = intPostVar('memberid');\r
- $blogid = intPostVar('blogid');\r
- $admin = intPostVar('admin');\r
- \r
- // check if allowed\r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- if ( !$blog->addTeamMember($memberid, $admin) )\r
- {\r
- self::error(_ERROR_ALREADYONTEAM);\r
- return;\r
- }\r
- \r
- self::action_manageteam();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_teamdelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_teamdelete()\r
- {\r
- global $member, $manager;\r
- \r
- $memberid = intRequestVar('memberid');\r
- $blogid = intRequestVar('blogid');\r
- \r
- // check if allowed\r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $teammem =& $manager->getMember($memberid);\r
- $blog =& $manager->getBlog($blogid);\r
- \r
- self::$skin->parse('teamdelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_teamdeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_teamdeleteconfirm()\r
- {\r
- global $member;\r
- \r
- $memberid = intRequestVar('memberid');\r
- $blogid = intRequestVar('blogid');\r
- \r
- $error = self::deleteOneTeamMember($blogid, $memberid);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- self::action_manageteam();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::deleteOneTeamMember()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static public function deleteOneTeamMember($blogid, $memberid)\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intval($blogid);\r
- $memberid = intval($memberid);\r
- \r
- // check if allowed\r
- if ( !$member->blogAdminRights($blogid) )\r
- {\r
- return _ERROR_DISALLOWED;\r
- }\r
- \r
- // check if: - there remains at least one blog admin\r
- // - (there remains at least one team member)\r
- $tmem =& $manager->getMember($memberid);\r
- \r
- \r
- $data = array(\r
- 'member' => &$tmem,\r
- 'blogid' => $blogid\r
- );\r
- $manager->notify('PreDeleteTeamMember', $data);\r
- \r
- if ( $tmem->isBlogAdmin($blogid) )\r
- {\r
- /* TODO: why we did double check? */\r
- // check if there are more blog members left and at least one admin\r
- // (check for at least two admins before deletion)\r
- $query = "SELECT * FROM %s WHERE tblog=%d and tadmin=1;";\r
- $query = sprintf($query, sql_table('team'), (integer) $blogid);\r
- $r = DB::getResult($query);\r
- if ( $r->rowCount() < 2 )\r
- {\r
- return _ERROR_ATLEASTONEBLOGADMIN;\r
- }\r
- }\r
- \r
- $query = "DELETE FROM %s WHERE tblog=%d AND tmember=%d;";\r
- $query = sprintf($query, sql_table('team'), (integer) $blogid, (integer) $memberid);\r
- DB::execute($query);\r
- \r
- $data = array(\r
- 'member' => &$tmem,\r
- 'blogid' => $blogid\r
- );\r
- $manager->notify('PostDeleteTeamMember', $data);\r
- \r
- return '';\r
- }\r
- \r
- /**\r
- * Admin::action_teamchangeadmin()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_teamchangeadmin()\r
- {\r
- global $manager, $member;\r
- \r
- $blogid = intRequestVar('blogid');\r
- $memberid = intRequestVar('memberid');\r
- \r
- // check if allowed\r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $mem =& $manager->getMember($memberid);\r
- \r
- // don't allow when there is only one admin at this moment\r
- if ( $mem->isBlogAdmin($blogid) )\r
- {\r
- $query = "SELECT * FROM %s WHERE tblog=%d AND tadmin=1;";\r
- $query = sprintf($query, sql_table('team'), (integer) $blogid);\r
- $r = DB::getResult($query);\r
- if ( $r->rowCount() == 1 )\r
- {\r
- self::error(_ERROR_ATLEASTONEBLOGADMIN);\r
- return;\r
- }\r
- }\r
- \r
- if ( $mem->isBlogAdmin($blogid) )\r
- {\r
- $newval = 0;\r
- }\r
- else\r
- {\r
- $newval = 1;\r
- }\r
- \r
- $query = "UPDATE %s SET tadmin=%d WHERE tblog=%d and tmember=%d;";\r
- $query = sprintf($query, (integer) $blogid, (integer) $newval, (integer) $blogid, (integer) $memberid);\r
- DB::execute($query);\r
- \r
- // only show manageteam if member did not change its own admin privileges\r
- if ( $member->isBlogAdmin($blogid) )\r
- {\r
- self::action_manageteam();\r
- }\r
- else\r
- {\r
- self::action_overview(_MSG_ADMINCHANGED);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_blogsettings()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_blogsettings()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- // check if allowed\r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- \r
- self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";\r
- \r
- self::$skin->parse('blogsettings');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_categorynew()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_categorynew()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $cname = postVar('cname');\r
- $cdesc = postVar('cdesc');\r
- \r
- if ( !isValidCategoryName($cname) )\r
- {\r
- self::error(_ERROR_BADCATEGORYNAME);\r
- return;\r
- }\r
- \r
- $query = "SELECT * FROM %s WHERE cname=%s AND cblog=%d;";\r
- $query = sprintf($query, sql_table('category'), DB::quoteValue($cname), (integer) $blogid);\r
- $res = DB::getResult($query);\r
- if ( $res->rowCount() > 0 )\r
- {\r
- self::error(_ERROR_DUPCATEGORYNAME);\r
- return;\r
- }\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- $newCatID = $blog->createNewCategory($cname, $cdesc);\r
- \r
- self::action_blogsettings();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_categoryedit()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_categoryedit($catid = '', $blogid = '', $desturl = '')\r
- {\r
- global $member, $manager;\r
- \r
- if ( $blogid == '' )\r
- {\r
- $blogid = intGetVar('blogid');\r
- }\r
- else\r
- {\r
- $blogid = intval($blogid);\r
- }\r
- if ( $catid == '' )\r
- {\r
- $catid = intGetVar('catid');\r
- }\r
- else\r
- {\r
- $catid = intval($catid);\r
- }\r
- \r
- /* TODO: we should consider to use the other way insterad of this */\r
- $_REQUEST['blogid'] = $blogid;\r
- $_REQUEST['catid'] = $catid;\r
- $_REQUEST['desturl'] = $desturl;\r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";\r
- \r
- self::$skin->parse('categoryedit');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_categoryupdate()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_categoryupdate()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intPostVar('blogid');\r
- $catid = intPostVar('catid');\r
- $cname = postVar('cname');\r
- $cdesc = postVar('cdesc');\r
- $desturl = postVar('desturl');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- if ( !isValidCategoryName($cname) )\r
- {\r
- self::error(_ERROR_BADCATEGORYNAME);\r
- return;\r
- }\r
- \r
- $query = "SELECT * FROM %s WHERE cname=%s AND cblog=%d AND not(catid=%d);";\r
- $query = sprintf($query, sql_table('category'), DB::quoteValue($cname), (integer) $blogid, (integer) $catid);\r
- $res = DB::getResult($query);\r
- if ( $res->rowCount() > 0 )\r
- {\r
- self::error(_ERROR_DUPCATEGORYNAME);\r
- return;\r
- }\r
- \r
- $query = "UPDATE %s SET cname=%s, cdesc=%s WHERE catid=%d;";\r
- $query = sprintf($query, sql_table('category'), DB::quoteValue($cname), DB::quoteValue($cdesc), (integer) $catid);\r
- DB::execute($query);\r
- \r
- // store plugin options\r
- $aOptions = requestArray('plugoption');\r
- NucleusPlugin::apply_plugin_options($aOptions);\r
- $data = array(\r
- 'context' => 'category',\r
- 'catid' => $catid\r
- );\r
- $manager->notify('PostPluginOptionsUpdate', $data);\r
- \r
- if ( $desturl )\r
- {\r
- redirect($desturl);\r
- return;\r
- }\r
- \r
- self::action_blogsettings();\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_categorydelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_categorydelete()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- $catid = intRequestVar('catid');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- \r
- // check if the category is valid\r
- if ( !$blog->isValidCategory($catid) )\r
- {\r
- self::error(_ERROR_NOSUCHCATEGORY);\r
- return;\r
- }\r
- \r
- // don't allow deletion of default category\r
- if ( $blog->getDefaultCategory() == $catid )\r
- {\r
- self::error(_ERROR_DELETEDEFCATEGORY);\r
- return;\r
- }\r
- \r
- // check if catid is the only category left for blogid\r
- $query = "SELECT catid FROM %s WHERE cblog=%d;";\r
- $query = sprintf($query, sql_table('category'), $blogid);\r
- $res = DB::getResult($query);\r
- if ( $res->rowCount() == 1 )\r
- {\r
- self::error(_ERROR_DELETELASTCATEGORY);\r
- return;\r
- }\r
- \r
- self::$skin->parse('categorydelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_categorydeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_categorydeleteconfirm()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- $catid = intRequestVar('catid');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $error = self::deleteOneCategory($catid);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- self::action_blogsettings();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::deleteOneCategory()\r
- * Delete a category by its id\r
- * \r
- * @param String $catid category id for deleting\r
- * @return Void\r
- */\r
- static public function deleteOneCategory($catid)\r
- {\r
- global $manager, $member;\r
- \r
- $catid = intval($catid);\r
- $blogid = getBlogIDFromCatID($catid);\r
- \r
- if ( !$member->blogAdminRights($blogid) )\r
- {\r
- return ERROR_DISALLOWED;\r
- }\r
- \r
- // get blog\r
- $blog =& $manager->getBlog($blogid);\r
- \r
- // check if the category is valid\r
- if ( !$blog || !$blog->isValidCategory($catid) )\r
- {\r
- return _ERROR_NOSUCHCATEGORY;\r
- }\r
- \r
- $destcatid = $blog->getDefaultCategory();\r
- \r
- // don't allow deletion of default category\r
- if ( $blog->getDefaultCategory() == $catid )\r
- {\r
- return _ERROR_DELETEDEFCATEGORY;\r
- }\r
- \r
- // check if catid is the only category left for blogid\r
- $query = "SELECT catid FROM %s WHERE cblog=%d;";\r
- $query = sprintf($query, sql_table('category'), (integer) $blogid);\r
- \r
- $res = DB::getResult($query);\r
- if ( $res->rowCount() == 1 )\r
- {\r
- return _ERROR_DELETELASTCATEGORY;\r
- }\r
- \r
- $data = array('catid' => $catid);\r
- $manager->notify('PreDeleteCategory', $data);\r
- \r
- // change category for all items to the default category\r
- $query = "UPDATE %s SET icat=%d WHERE icat=%d;";\r
- $query =sprintf($query, sql_table('item'), (integer) $destcatid, (integer) $catid);\r
- DB::execute($query);\r
- \r
- // delete all associated plugin options\r
- NucleusPlugin::delete_option_values('category', (integer) $catid);\r
- \r
- // delete category\r
- $query = "DELETE FROM %s WHERE catid=%d;";\r
- $query = sprintf($query, sql_table('category'), (integer) $catid);\r
- DB::execute($query);\r
- \r
- $data = array('catid' => $catid);\r
- $manager->notify('PostDeleteCategory', $data);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::moveOneCategory()\r
- * Delete a category by its id\r
- * \r
- * @param int $catid category id for move\r
- * @param int $destblogid blog id for destination\r
- * @return void\r
- */\r
- static public function moveOneCategory($catid, $destblogid)\r
- {\r
- global $manager, $member;\r
- $catid = intval($catid);\r
- $destblogid = intval($destblogid);\r
- $blogid = getBlogIDFromCatID($catid);\r
- // mover should have admin rights on both blogs\r
- if (!$member->blogAdminRights($blogid)) {\r
- return _ERROR_DISALLOWED;\r
- }\r
- if (!$member->blogAdminRights($destblogid)) {\r
- return _ERROR_DISALLOWED;\r
- }\r
- // cannot move to self\r
- if ($blogid == $destblogid) {\r
- return _ERROR_MOVETOSELF;\r
- }\r
- // get blogs\r
- $blog =& $manager->getBlog($blogid);\r
- $destblog =& $manager->getBlog($destblogid);\r
- // check if the category is valid\r
- if (!$blog || !$blog->isValidCategory($catid)) {\r
- return _ERROR_NOSUCHCATEGORY;\r
- }\r
- // don't allow default category to be moved\r
- if ($blog->getDefaultCategory() == $catid) {\r
- return _ERROR_MOVEDEFCATEGORY;\r
- }\r
- $manager->notify(\r
- 'PreMoveCategory',\r
- array(\r
- 'catid' => &$catid,\r
- 'sourceblog' => &$blog,\r
- 'destblog' => &$destblog\r
- )\r
- );\r
- // update comments table (cblog)\r
- $query = 'SELECT '\r
- . ' inumber '\r
- . 'FROM '\r
- . sql_table('item') . ' '\r
- . 'WHERE '\r
- . ' icat = %d';\r
- $items = sql_query(sprintf($query, $catid));\r
- while ($oItem = sql_fetch_object($items)) {\r
- $query = 'UPDATE '\r
- . sql_table('comment') . ' '\r
- . 'SET '\r
- . ' cblog = %d' . ' '\r
- . 'WHERE '\r
- . ' citem = %d';\r
- sql_query(sprintf($query, $destblogid, $oItem->inumber));\r
- }\r
- \r
- // update items (iblog)\r
- $query = 'UPDATE '\r
- . sql_table('item') . ' '\r
- . 'SET '\r
- . ' iblog = %d '\r
- . 'WHERE '\r
- . ' icat = %d';\r
- sql_query(sprintf($query, $destblogid, $catid));\r
- \r
- // move category\r
- $query = 'UPDATE '\r
- . sql_table('category') . ' '\r
- . 'SET '\r
- . ' cblog = %d' . ' '\r
- . 'WHERE '\r
- . ' catid = %d';\r
- sql_query(sprintf($query, $destblogid, $catid));\r
- $manager->notify(\r
- 'PostMoveCategory',\r
- array(\r
- 'catid' => &$catid,\r
- 'sourceblog' => &$blog,\r
- 'destblog' => $destblog\r
- )\r
- );\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_blogsettingsupdate\r
- * Updating blog settings\r
- * \r
- * @param Void\r
- * @return Void\r
- */\r
- static private function action_blogsettingsupdate()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- \r
- $notify_address = trim(postVar('notify'));\r
- $shortname = trim(postVar('shortname'));\r
- $updatefile = trim(postVar('update'));\r
- \r
- $notifyComment = intPostVar('notifyComment');\r
- $notifyVote = intPostVar('notifyVote');\r
- $notifyNewItem = intPostVar('notifyNewItem');\r
- \r
- if ( $notifyComment == 0 )\r
- {\r
- $notifyComment = 1;\r
- }\r
- if ( $notifyVote == 0 )\r
- {\r
- $notifyVote = 1;\r
- }\r
- if ( $notifyNewItem == 0 )\r
- {\r
- $notifyNewItem = 1;\r
- }\r
- $notifyType = $notifyComment * $notifyVote * $notifyNewItem;\r
- \r
- if ( $notify_address && !NOTIFICATION::address_validation($notify_address) )\r
- {\r
- self::error(_ERROR_BADNOTIFY);\r
- return;\r
- }\r
- \r
- if ( !isValidShortName($shortname) )\r
- {\r
- self::error(_ERROR_BADSHORTBLOGNAME);\r
- return;\r
- }\r
- \r
- if ( ($blog->getShortName() != $shortname) && $manager->existsBlog($shortname) )\r
- {\r
- self::error(_ERROR_DUPSHORTBLOGNAME);\r
- return;\r
- }\r
- // check if update file is writable\r
- if ( $updatefile && !is_writeable($updatefile) )\r
- {\r
- self::error(_ERROR_UPDATEFILE);\r
- return;\r
- }\r
- \r
- $blog->setName(trim(postVar('name')));\r
- $blog->setShortName($shortname);\r
- $blog->setNotifyAddress($notify_address);\r
- $blog->setNotifyType($notifyType);\r
- $blog->setMaxComments(postVar('maxcomments'));\r
- $blog->setCommentsEnabled(postVar('comments'));\r
- $blog->setTimeOffset(postVar('timeoffset'));\r
- $blog->setUpdateFile($updatefile);\r
- $blog->setURL(trim(postVar('url')));\r
- $blog->setDefaultSkin(intPostVar('defskin'));\r
- $blog->setDescription(trim(postVar('desc')));\r
- $blog->setPublic(postVar('public'));\r
- $blog->setConvertBreaks(intPostVar('convertbreaks'));\r
- $blog->setAllowPastPosting(intPostVar('allowpastposting'));\r
- $blog->setDefaultCategory(intPostVar('defcat'));\r
- $blog->setSearchable(intPostVar('searchable'));\r
- $blog->setEmailRequired(intPostVar('reqemail'));\r
- $blog->writeSettings();\r
- \r
- // store plugin options\r
- $aOptions = requestArray('plugoption');\r
- NucleusPlugin::apply_plugin_options($aOptions);\r
- \r
- $data = array(\r
- 'context' => 'blog',\r
- 'blogid' => $blogid,\r
- 'blog' => &$blog\r
- );\r
- $manager->notify('PostPluginOptionsUpdate', $data);\r
- \r
- self::action_overview(_MSG_SETTINGSCHANGED);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_deleteblog()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_deleteblog()\r
- {\r
- global $member, $CONF, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- // check if blog is default blog\r
- if ( $CONF['DefaultBlog'] == $blogid )\r
- {\r
- self::error(_ERROR_DELDEFBLOG);\r
- return;\r
- }\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- \r
- self::$skin->parse('deleteblog');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_deleteblogconfirm()\r
- * Delete Blog\r
- * \r
- * @param Void\r
- * @return Void\r
- */\r
- static private function action_deleteblogconfirm()\r
- {\r
- global $member, $CONF, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- $data = array('blogid' => $blogid);\r
- $manager->notify('PreDeleteBlog', $data);\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- // check if blog is default blog\r
- if ( $CONF['DefaultBlog'] == $blogid )\r
- {\r
- self::error(_ERROR_DELDEFBLOG);\r
- return;\r
- }\r
- \r
- // delete all comments\r
- $query = 'DELETE FROM ' . sql_table('comment') . ' WHERE cblog='.$blogid;\r
- DB::execute($query);\r
- \r
- // delete all items\r
- $query = 'DELETE FROM ' . sql_table('item') . ' WHERE iblog=' . $blogid;\r
- DB::execute($query);\r
- \r
- // delete all team members\r
- $query = 'DELETE FROM ' . sql_table('team') . ' WHERE tblog=' . $blogid;\r
- DB::execute($query);\r
- \r
- // delete all bans\r
- $query = 'DELETE FROM ' . sql_table('ban') . ' WHERE blogid=' . $blogid;\r
- DB::execute($query);\r
- \r
- // delete all categories\r
- $query = 'DELETE FROM ' . sql_table('category') . ' WHERE cblog=' . $blogid;\r
- DB::execute($query);\r
- \r
- // delete all associated plugin options\r
- NucleusPlugin::delete_option_values('blog', $blogid);\r
- \r
- // delete the blog itself\r
- $query = 'DELETE FROM ' . sql_table('blog') . ' WHERE bnumber=' . $blogid;\r
- DB::execute($query);\r
- \r
- $data = array('blogid' => $blogid);\r
- $manager->notify('PostDeleteBlog', $data);\r
- \r
- self::action_overview(_DELETED_BLOG);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_memberdelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_memberdelete()\r
- {\r
- global $member, $manager;\r
- \r
- $memberid = intRequestVar('memberid');\r
- \r
- ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();\r
- \r
- $mem =& $manager->getMember($memberid);\r
- \r
- self::$skin->parse('memberdelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_memberdeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_memberdeleteconfirm()\r
- {\r
- global $member;\r
- \r
- $memberid = intRequestVar('memberid');\r
- \r
- ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();\r
- \r
- $error = self::deleteOneMember($memberid);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- if ( $member->isAdmin() )\r
- {\r
- self::action_usermanagement();\r
- return;\r
- }\r
- else\r
- {\r
- self::action_overview(_DELETED_MEMBER);\r
- return;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::deleteOneMember()\r
- * Delete a member by id\r
- * \r
- * @static\r
- * @params Integer $memberid member id\r
- * @return String null string or error messages\r
- */\r
- static public function deleteOneMember($memberid)\r
- {\r
- global $manager;\r
- \r
- $memberid = intval($memberid);\r
- $mem =& $manager->getMember($memberid);\r
- \r
- if ( !$mem->canBeDeleted() )\r
- {\r
- return _ERROR_DELETEMEMBER;\r
- }\r
- \r
- $data = array('member' => &$mem);\r
- $manager->notify('PreDeleteMember', $data);\r
- \r
- /* unlink comments from memberid */\r
- if ( $memberid )\r
- {\r
- $query = "UPDATE %s SET cmember=0, cuser=%s WHERE cmember=%d;";\r
- $query = sprintf($query, sql_table('comment'), DB::quoteValue($mem->getDisplayName()), $memberid);\r
- DB::execute($query);\r
- }\r
- \r
- $query = 'DELETE FROM ' . sql_table('member') . ' WHERE mnumber=' . $memberid;\r
- DB::execute($query);\r
- \r
- $query = 'DELETE FROM ' . sql_table('team') . ' WHERE tmember=' . $memberid;\r
- DB::execute($query);\r
- \r
- $query = 'DELETE FROM ' . sql_table('activation') . ' WHERE vmember=' . $memberid;\r
- DB::execute($query);\r
- \r
- // delete all associated plugin options\r
- NucleusPlugin::delete_option_values('member', $memberid);\r
- \r
- $data = array('member' => &$mem);\r
- $manager->notify('PostDeleteMember', $data);\r
- \r
- return '';\r
- }\r
- \r
- /**\r
- * Admin::action_createnewlog()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_createnewlog()\r
- {\r
- global $member, $CONF, $manager;\r
- \r
- // Only Super-Admins can do this\r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('createnewlog');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_addnewlog()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_addnewlog()\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- // Only Super-Admins can do this\r
- $member->isAdmin() or self::disallow();\r
- \r
- $bname = trim(postVar('name'));\r
- $bshortname = trim(postVar('shortname'));\r
- $btimeoffset = postVar('timeoffset');\r
- $bdesc = trim(postVar('desc'));\r
- $bdefskin = postVar('defskin');\r
- \r
- if ( !isValidShortName($bshortname) )\r
- {\r
- self::error(_ERROR_BADSHORTBLOGNAME);\r
- return;\r
- }\r
- \r
- if ( $manager->existsBlog($bshortname) )\r
- {\r
- self::error(_ERROR_DUPSHORTBLOGNAME);\r
- return;\r
- }\r
- \r
- $data = array(\r
- 'name' => &$bname,\r
- 'shortname' => &$bshortname,\r
- 'timeoffset' => &$btimeoffset,\r
- 'description' => &$bdesc,\r
- 'defaultskin' => &$bdefskin\r
- );\r
- $manager->notify('PreAddBlog', $data);\r
- \r
- // add slashes for sql queries\r
- $bname = DB::quoteValue($bname);\r
- $bshortname = DB::quoteValue($bshortname);\r
- $btimeoffset = DB::quoteValue($btimeoffset);\r
- $bdesc = DB::quoteValue($bdesc);\r
- $bdefskin = DB::quoteValue($bdefskin);\r
- \r
- // create blog\r
- $query = "INSERT INTO %s (bname, bshortname, bdesc, btimeoffset, bdefskin) VALUES (%s, %s, %s, %s, %s);";\r
- $query = sprintf($query, sql_table('blog'), $bname, $bshortname, $bdesc, $btimeoffset, $bdefskin);\r
- DB::execute($query);\r
- \r
- $blogid = DB::getInsertId();\r
- $blog =& $manager->getBlog($blogid);\r
- \r
- // create new category\r
- $catdefname = (!defined('_EBLOGDEFAULTCATEGORY_NAME') ? 'General' : _EBLOGDEFAULTCATEGORY_NAME);\r
- $catdefdesc = (!defined('_EBLOGDEFAULTCATEGORY_DESC') ? 'Items that do not fit in other categories' : _EBLOGDEFAULTCATEGORY_DESC);\r
- \r
- $query = 'INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, %s, %s)';\r
- DB::execute(sprintf($query, sql_table('category'), (integer) $blogid, DB::quoteValue($catdefname), DB::quoteValue($catdefdesc)));\r
- $catid = DB::getInsertId();\r
- \r
- // set as default category\r
- $blog->setDefaultCategory($catid);\r
- $blog->writeSettings();\r
- \r
- // create team member\r
- $query = "INSERT INTO %s (tmember, tblog, tadmin) VALUES (%d, %d, 1);";\r
- $query = sprintf($query, sql_table('team'), (integer) $member->getID(), (integer) $blogid);\r
- DB::execute($query);\r
- \r
- $itemdeftitle = (defined('_EBLOG_FIRSTITEM_TITLE') ? _EBLOG_FIRSTITEM_TITLE : 'First Item');\r
- $itemdefbody = (defined('_EBLOG_FIRSTITEM_BODY') ? _EBLOG_FIRSTITEM_BODY : 'This is the first item in your weblog. Feel free to delete it.');\r
- \r
- $blog->additem(\r
- $blog->getDefaultCategory(),\r
- $itemdeftitle,$itemdefbody,\r
- '',\r
- $blogid,\r
- $member->getID(),\r
- $blog->getCorrectTime(),\r
- 0,\r
- 0,\r
- 0\r
- );\r
- \r
- $data = array('blog' => &$blog);\r
- $manager->notify('PostAddBlog', $data);\r
- \r
- $data = array(\r
- 'blog' => &$blog,\r
- 'name' => _EBLOGDEFAULTCATEGORY_NAME,\r
- 'description' => _EBLOGDEFAULTCATEGORY_DESC,\r
- 'catid' => $catid\r
- );\r
- $manager->notify('PostAddCategory', $data);\r
- \r
- /* TODO: we should consider to use the other way insterad of this */\r
- $_REQUEST['blogid'] = $blogid;\r
- $_REQUEST['catid'] = $catid;\r
- self::$skin->parse('addnewlog');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_addnewlog2()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_addnewlog2()\r
- {\r
- global $member, $manager;\r
- $blogid = intRequestVar('blogid');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $burl = requestVar('url');\r
- \r
- $blog =& $manager->getBlog($blogid);\r
- $blog->setURL(trim($burl));\r
- $blog->writeSettings();\r
- \r
- self::action_overview(_MSG_NEWBLOG);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinieoverview()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinieoverview()\r
- {\r
- global $member, $DIR_LIBS, $manager;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- include_once($DIR_LIBS . 'skinie.php');\r
- \r
- self::$skin->parse('skinieoverview');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinieimport()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinieimport()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinFileRaw = postVar('skinfile');\r
- $mode = postVar('mode');\r
- \r
- $error = self::skinieimport($mode, $skinFileRaw);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- self::$skin->parse('skinieimport');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skiniedoimport()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skiniedoimport()\r
- {\r
- global $member, $DIR_LIBS, $DIR_SKINS;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- // load skinie class\r
- include_once($DIR_LIBS . 'skinie.php');\r
- \r
- $mode = postVar('mode');\r
- $skinFileRaw = postVar('skinfile');\r
- $allowOverwrite = intPostVar('overwrite');\r
- \r
- $error = self::skiniedoimport($mode, $skinFileRaw, $allowOverwrite);\r
- if ( $error )\r
- {\r
- self::error($msg);\r
- return;\r
- }\r
- \r
- self::$skin->parse('skiniedoimport');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinieexport()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinieexport()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $aSkins = requestIntArray('skin');\r
- $aTemplates = requestIntArray('template');\r
- $info = postVar('info');\r
- \r
- self::skinieexport($aSkins, $aTemplates, $info);\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_templateoverview()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_templateoverview()\r
- {\r
- global $member, $manager;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('templateoverview');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_templateedit()\r
- * \r
- * @param string $msg message for pageheader\r
- * @return void\r
- */\r
- static private function action_templateedit($msg = '')\r
- {\r
- global $member, $manager;\r
- if ( $msg )\r
- {\r
- self::$headMess = $msg;\r
- }\r
- \r
- $templateid = intRequestVar('templateid');\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(javascript/templateEdit.js)%>\"></script>\n";\r
- self::$extrahead .= "<script type=\"text/javascript\">setTemplateEditText('" . Entity::hsc(_EDITTEMPLATE_EMPTY) . "');</script>\n";\r
- \r
- self::$skin->parse('templateedit');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_templateupdate()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_templateupdate()\r
- {\r
- global $member,$manager;\r
- \r
- $templateid = intRequestVar('templateid');\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $name = postVar('tname');\r
- $desc = postVar('tdesc');\r
- \r
- if ( !isValidTemplateName($name) )\r
- {\r
- self::error(_ERROR_BADTEMPLATENAME);\r
- return;\r
- }\r
- \r
- if ( (Template::getNameFromId($templateid) != $name) && Template::exists($name) )\r
- {\r
- self::error(_ERROR_DUPTEMPLATENAME);\r
- return;\r
- }\r
- \r
- // 1. Remove all template parts\r
- $query = "DELETE FROM %s WHERE tdesc=%d;";\r
- $query = sprintf($query, sql_table('template'), (integer) $templateid);\r
- DB::execute($query);\r
- \r
- // 2. Update description\r
- $query = "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d;";\r
- $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $templateid);\r
- DB::execute($query);\r
- \r
- // 3. Add non-empty template parts\r
- self::addToTemplate($templateid, 'ITEM_HEADER', postVar('ITEM_HEADER'));\r
- self::addToTemplate($templateid, 'ITEM', postVar('ITEM'));\r
- self::addToTemplate($templateid, 'ITEM_FOOTER', postVar('ITEM_FOOTER'));\r
- self::addToTemplate($templateid, 'MORELINK', postVar('MORELINK'));\r
- self::addToTemplate($templateid, 'EDITLINK', postVar('EDITLINK'));\r
- self::addToTemplate($templateid, 'NEW', postVar('NEW'));\r
- self::addToTemplate($templateid, 'COMMENTS_HEADER', postVar('COMMENTS_HEADER'));\r
- self::addToTemplate($templateid, 'COMMENTS_BODY', postVar('COMMENTS_BODY'));\r
- self::addToTemplate($templateid, 'COMMENTS_FOOTER', postVar('COMMENTS_FOOTER'));\r
- self::addToTemplate($templateid, 'COMMENTS_CONTINUED', postVar('COMMENTS_CONTINUED'));\r
- self::addToTemplate($templateid, 'COMMENTS_TOOMUCH', postVar('COMMENTS_TOOMUCH'));\r
- self::addToTemplate($templateid, 'COMMENTS_AUTH', postVar('COMMENTS_AUTH'));\r
- self::addToTemplate($templateid, 'COMMENTS_ONE', postVar('COMMENTS_ONE'));\r
- self::addToTemplate($templateid, 'COMMENTS_MANY', postVar('COMMENTS_MANY'));\r
- self::addToTemplate($templateid, 'COMMENTS_NONE', postVar('COMMENTS_NONE'));\r
- self::addToTemplate($templateid, 'ARCHIVELIST_HEADER', postVar('ARCHIVELIST_HEADER'));\r
- self::addToTemplate($templateid, 'ARCHIVELIST_LISTITEM', postVar('ARCHIVELIST_LISTITEM'));\r
- self::addToTemplate($templateid, 'ARCHIVELIST_FOOTER', postVar('ARCHIVELIST_FOOTER'));\r
- self::addToTemplate($templateid, 'BLOGLIST_HEADER', postVar('BLOGLIST_HEADER'));\r
- self::addToTemplate($templateid, 'BLOGLIST_LISTITEM', postVar('BLOGLIST_LISTITEM'));\r
- self::addToTemplate($templateid, 'BLOGLIST_FOOTER', postVar('BLOGLIST_FOOTER'));\r
- self::addToTemplate($templateid, 'CATLIST_HEADER', postVar('CATLIST_HEADER'));\r
- self::addToTemplate($templateid, 'CATLIST_LISTITEM', postVar('CATLIST_LISTITEM'));\r
- self::addToTemplate($templateid, 'CATLIST_FOOTER', postVar('CATLIST_FOOTER'));\r
- self::addToTemplate($templateid, 'DATE_HEADER', postVar('DATE_HEADER'));\r
- self::addToTemplate($templateid, 'DATE_FOOTER', postVar('DATE_FOOTER'));\r
- self::addToTemplate($templateid, 'FORMAT_DATE', postVar('FORMAT_DATE'));\r
- self::addToTemplate($templateid, 'FORMAT_TIME', postVar('FORMAT_TIME'));\r
- self::addToTemplate($templateid, 'LOCALE', postVar('LOCALE'));\r
- self::addToTemplate($templateid, 'SEARCH_HIGHLIGHT', postVar('SEARCH_HIGHLIGHT'));\r
- self::addToTemplate($templateid, 'SEARCH_NOTHINGFOUND', postVar('SEARCH_NOTHINGFOUND'));\r
- self::addToTemplate($templateid, 'POPUP_CODE', postVar('POPUP_CODE'));\r
- self::addToTemplate($templateid, 'MEDIA_CODE', postVar('MEDIA_CODE'));\r
- self::addToTemplate($templateid, 'IMAGE_CODE', postVar('IMAGE_CODE'));\r
- \r
- $data = array('fields' => array());\r
- $manager->notify('TemplateExtraFields', $data);\r
- foreach ( $data['fields'] as $pfkey=>$pfvalue )\r
- {\r
- foreach ( $pfvalue as $pffield => $pfdesc )\r
- {\r
- self::addToTemplate($templateid, $pffield, postVar($pffield));\r
- }\r
- }\r
- \r
- // jump back to template edit\r
- self::action_templateedit(_TEMPLATE_UPDATED);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::addToTemplate()\r
- * \r
- * @param Integer $id ID for template\r
- * @param String $partname parts name\r
- * @param String $content template contents\r
- * @return Integer record index\r
- * \r
- */\r
- static private function addToTemplate($id, $partname, $content)\r
- {\r
- // don't add empty parts:\r
- if ( !trim($content) )\r
- {\r
- return -1;\r
- }\r
- \r
- $query = "INSERT INTO %s (tdesc, tpartname, tcontent) VALUES (%d, %s, %s);";\r
- $query = sprintf($query, sql_table('template'), (integer) $id, DB::quoteValue($partname), DB::quoteValue($content));\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $err = DB::getError();\r
- exit(_ADMIN_SQLDIE_QUERYERROR . $err[2]);\r
- }\r
- return DB::getInsertId();\r
- }\r
- \r
- /**\r
- * Admin::action_templatedelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_templatedelete()\r
- {\r
- global $member, $manager;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $templateid = intRequestVar('templateid');\r
- // TODO: check if template can be deleted\r
- \r
- self::$skin->parse('templatedelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_templatedeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_templatedeleteconfirm()\r
- {\r
- global $member, $manager;\r
- \r
- $templateid = intRequestVar('templateid');\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $data = array('templateid' => $templateid);\r
- $manager->notify('PreDeleteTemplate', $data);\r
- \r
- // 1. delete description\r
- DB::execute('DELETE FROM ' . sql_table('template_desc') . ' WHERE tdnumber=' . $templateid);\r
- \r
- // 2. delete parts\r
- DB::execute('DELETE FROM ' . sql_table('template') . ' WHERE tdesc=' . $templateid);\r
- \r
- \r
- $data = array('templateid' => $templateid);\r
- $manager->notify('PostDeleteTemplate', $data);\r
- \r
- self::action_templateoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_templatenew()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_templatenew()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $name = postVar('name');\r
- $desc = postVar('desc');\r
- \r
- if ( !isValidTemplateName($name) )\r
- {\r
- self::error(_ERROR_BADTEMPLATENAME);\r
- return;\r
- }\r
- \r
- if ( Template::exists($name) )\r
- {\r
- self::error(_ERROR_DUPTEMPLATENAME);\r
- return;\r
- }\r
- \r
- $newTemplateId = Template::createNew($name, $desc);\r
- \r
- self::action_templateoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_templateclone()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_templateclone()\r
- {\r
- global $member;\r
- \r
- $templateid = intRequestVar('templateid');\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- // 1. read old template\r
- $name = Template::getNameFromId($templateid);\r
- $desc = Template::getDesc($templateid);\r
- \r
- // 2. create desc thing\r
- $name = "cloned" . $name;\r
- \r
- // if a template with that name already exists:\r
- if ( Template::exists($name) )\r
- {\r
- $i = 1;\r
- while (Template::exists($name . $i))\r
- {\r
- $i++;\r
- }\r
- $name .= $i;\r
- }\r
- \r
- $newid = Template::createNew($name, $desc);\r
- \r
- // 3. create clone\r
- // go through parts of old template and add them to the new one\r
- $query = "SELECT tpartname, tcontent FROM %s WHERE tdesc=%d;";\r
- $query = sprintf($query, sql_table('template'), (integer) $templateid);\r
- \r
- $res = DB::getResult($query);\r
- foreach ( $res as $row)\r
- {\r
- self::addToTemplate($newid, $row['tpartname'], $row['tcontent']);\r
- }\r
- \r
- self::action_templateoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_admintemplateoverview()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_admintemplateoverview()\r
- {\r
- global $member;\r
- $member->isAdmin() or self::disallow();\r
- self::$skin->parse('admntemplateoverview');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_admintemplateedit()\r
- * \r
- * @param string $msg message for pageheader\r
- * @return void\r
- */\r
- static private function action_admintemplateedit($msg = '')\r
- {\r
- global $member, $manager;\r
- if ( $msg )\r
- {\r
- self::$headMess = $msg;\r
- }\r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(javascript/templateEdit.js)%>\"></script>\n";\r
- self::$extrahead .= '<script type="text/javascript">setTemplateEditText("' . Entity::hsc(_EDITTEMPLATE_EMPTY) . '");</script>' . "\n";\r
- \r
- self::$skin->parse('admintemplateedit');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_admintemplateupdate()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_admintemplateupdate()\r
- {\r
- global $member, $manager;\r
- $templateid = intRequestVar('templateid');\r
- $member->isAdmin() or self::disallow();\r
- $name = postVar('tname');\r
- $desc = postVar('tdesc');\r
- \r
- if ( !isValidTemplateName($name) )\r
- {\r
- self::error(_ERROR_BADTEMPLATENAME);\r
- return;\r
- }\r
- \r
- if ( (Template::getNameFromId($templateid) != $name) && Template::exists($name) )\r
- {\r
- self::error(_ERROR_DUPTEMPLATENAME);\r
- return;\r
- }\r
- \r
- // 1. Remove all template parts\r
- $query = "DELETE FROM %s WHERE tdesc=%d;";\r
- $query = sprintf($query, sql_table('template'), (integer) $templateid);\r
- DB::execute($query);\r
- \r
- // 2. Update description\r
- $query = "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d;";\r
- $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $templateid);\r
- DB::execute($query);\r
- \r
- // 3. Add non-empty template parts\r
- self::addToTemplate($templateid, 'NORMALSKINLIST_HEAD', postVar('NORMALSKINLIST_HEAD'));\r
- self::addToTemplate($templateid, 'NORMALSKINLIST_BODY', postVar('NORMALSKINLIST_BODY'));\r
- self::addToTemplate($templateid, 'NORMALSKINLIST_FOOT', postVar('NORMALSKINLIST_FOOT'));\r
- self::addToTemplate($templateid, 'ADMIN_CUSTOMHELPLINK_ICON', postVar('ADMIN_CUSTOMHELPLINK_ICON'));\r
- self::addToTemplate($templateid, 'ADMIN_CUSTOMHELPLINK_ANCHOR', postVar('ADMIN_CUSTOMHELPLINK_ANCHOR'));\r
- self::addToTemplate($templateid, 'ADMIN_BLOGLINK', postVar('ADMIN_BLOGLINK'));\r
- self::addToTemplate($templateid, 'ADMIN_BATCHLIST', postVar('ADMIN_BATCHLIST'));\r
- self::addToTemplate($templateid, 'ACTIVATE_FORGOT_TITLE', postVar('ACTIVATE_FORGOT_TITLE'));\r
- self::addToTemplate($templateid, 'ACTIVATE_FORGOT_TEXT', postVar('ACTIVATE_FORGOT_TEXT'));\r
- self::addToTemplate($templateid, 'ACTIVATE_REGISTER_TITLE', postVar('ACTIVATE_REGISTER_TITLE'));\r
- self::addToTemplate($templateid, 'ACTIVATE_REGISTER_TEXT', postVar('ACTIVATE_REGISTER_TEXT'));\r
- self::addToTemplate($templateid, 'ACTIVATE_CHANGE_TITLE', postVar('ACTIVATE_CHANGE_TITLE'));\r
- self::addToTemplate($templateid, 'ACTIVATE_CHANGE_TEXT', postVar('ACTIVATE_CHANGE_TEXT'));\r
- self::addToTemplate($templateid, 'TEMPLATE_EDIT_EXPLUGNAME', postVar('TEMPLATE_EDIT_EXPLUGNAME'));\r
- self::addToTemplate($templateid, 'TEMPLATE_EDIT_ROW_HEAD', postVar('TEMPLATE_EDIT_ROW_HEAD'));\r
- self::addToTemplate($templateid, 'TEMPLATE_EDIT_ROW_TAIL', postVar('TEMPLATE_EDIT_ROW_TAIL'));\r
- self::addToTemplate($templateid, 'SPECIALSKINLIST_HEAD', postVar('SPECIALSKINLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SPECIALSKINLIST_BODY', postVar('SPECIALSKINLIST_BODY'));\r
- self::addToTemplate($templateid, 'SPECIALSKINLIST_FOOT', postVar('SPECIALSKINLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SYSTEMINFO_GDSETTINGS', postVar('SYSTEMINFO_GDSETTINGS'));\r
- self::addToTemplate($templateid, 'BANLIST_DELETED_LIST', postVar('BANLIST_DELETED_LIST'));\r
- self::addToTemplate($templateid, 'INSERT_PLUGOPTION_TITLE', postVar('INSERT_PLUGOPTION_TITLE'));\r
- self::addToTemplate($templateid, 'INSERT_PLUGOPTION_BODY', postVar('INSERT_PLUGOPTION_BODY'));\r
- self::addToTemplate($templateid, 'INPUTYESNO_TEMPLATE_ADMIN', postVar('INPUTYESNO_TEMPLATE_ADMIN'));\r
- self::addToTemplate($templateid, 'INPUTYESNO_TEMPLATE_NORMAL', postVar('INPUTYESNO_TEMPLATE_NORMAL'));\r
- self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_HEAD', postVar('ADMIN_SPECIALSKINLIST_HEAD'));\r
- self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_BODY', postVar('ADMIN_SPECIALSKINLIST_BODY'));\r
- self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_FOOT', postVar('ADMIN_SPECIALSKINLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SKINIE_EXPORT_LIST', postVar('SKINIE_EXPORT_LIST'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_HEAD', postVar('SHOWLIST_LISTPLUG_SELECT_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_BODY', postVar('SHOWLIST_LISTPLUG_SELECT_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_FOOT', postVar('SHOWLIST_LISTPLUG_SELECT_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', postVar('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', postVar('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'));\r
- self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'));\r
- self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_TITLE', postVar('PLUGIN_QUICKMENU_TITLE'));\r
- self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_HEAD', postVar('PLUGIN_QUICKMENU_HEAD'));\r
- self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_BODY', postVar('PLUGIN_QUICKMENU_BODY'));\r
- self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_FOOT', postVar('PLUGIN_QUICKMENU_FOOT'));\r
- \r
- $data = array('fields' => array());\r
- $manager->notify('AdminTemplateExtraFields', $data);\r
- foreach ( $data['fields'] as $pfkey => $pfvalue )\r
- {\r
- foreach ( $pfvalue as $pffield => $pfdesc )\r
- {\r
- self::addToTemplate($templateid, $pffield, postVar($pffield));\r
- }\r
- }\r
- \r
- // jump back to template edit\r
- self::action_admintemplateedit(_TEMPLATE_UPDATED);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_admintemplatedelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_admintemplatedelete()\r
- {\r
- global $member, $manager;\r
- $member->isAdmin() or self::disallow();\r
- \r
- // TODO: check if template can be deleted\r
- self::$skin->parse('admintemplatedelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_admintemplatedeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_admintemplatedeleteconfirm()\r
- {\r
- global $member, $manager;\r
- \r
- $templateid = intRequestVar('templateid');\r
- $member->isAdmin() or self::disallow();\r
- \r
- $data = array('templateid' => $templateid);\r
- $manager->notify('PreDeleteAdminTemplate', $data);\r
- \r
- // 1. delete description\r
- $query = "DELETE FROM %s WHERE tdnumber=%s;";\r
- $query = sprintf($query, sql_table('template_desc'), (integer) $templateid);\r
- DB::execute($query);\r
- \r
- // 2. delete parts\r
- $query = "DELETE FROM %s WHERE tdesc=%d;";\r
- $query = sprintf($query, sql_table('template'), (integer) $templateid);\r
- DB::execute($query);\r
- \r
- $data = array('templateid' => $templateid);\r
- $manager->notify('PostDeleteAdminTemplate', $data);\r
- \r
- self::action_admintemplateoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_admintemplatenew()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_admintemplatenew()\r
- {\r
- global $member;\r
- $member->isAdmin() or self::disallow();\r
- $name = postVar('name');\r
- $desc = postVar('desc');\r
- \r
- if ( !isValidTemplateName($name) )\r
- {\r
- self::error(_ERROR_BADTEMPLATENAME);\r
- return;\r
- }\r
- else if ( !preg_match('#^admin/#', $name) )\r
- {\r
- self::error(_ERROR_BADADMINTEMPLATENAME);\r
- return;\r
- }\r
- else if ( Template::exists($name) )\r
- {\r
- self::error(_ERROR_DUPTEMPLATENAME);\r
- return;\r
- }\r
- \r
- $newTemplateId = Template::createNew($name, $desc);\r
- self::action_admintemplateoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_admintemplateclone()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_admintemplateclone()\r
- {\r
- global $member;\r
- $templateid = intRequestVar('templateid');\r
- $member->isAdmin() or self::disallow();\r
- \r
- // 1. read old template\r
- $name = Template::getNameFromId($templateid);\r
- $desc = Template::getDesc($templateid);\r
- \r
- // 2. create desc thing\r
- $name = $name . "cloned";\r
- \r
- // if a template with that name already exists:\r
- if ( Template::exists($name) )\r
- {\r
- $i = 1;\r
- while ( Template::exists($name . $i) )\r
- {\r
- $i++;\r
- }\r
- $name .= $i;\r
- }\r
- \r
- $newid = Template::createNew($name, $desc);\r
- \r
- // 3. create clone\r
- // go through parts of old template and add them to the new one\r
- $query = "SELECT tpartname, tcontent FROM %s WHERE tdesc=%d;";\r
- $query = sprintf($query, sql_table('template'), (integer) $templateid);\r
- \r
- $res = DB::getResult($query);\r
- foreach ( $res as $row )\r
- {\r
- self::addToTemplate($newid, $row['tpartname'], $row['tcontent']);\r
- }\r
- \r
- self::action_admintemplateoverview();\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_skinoverview()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinoverview()\r
- {\r
- global $member, $manager;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('skinoverview');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinnew()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinnew()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $name = trim(postVar('name'));\r
- $desc = trim(postVar('desc'));\r
- \r
- if ( !isValidSkinName($name) )\r
- {\r
- self::error(_ERROR_BADSKINNAME);\r
- return;\r
- }\r
- else if ( SKIN::exists($name) )\r
- {\r
- self::error(_ERROR_DUPSKINNAME);\r
- return;\r
- }\r
- \r
- SKIN::createNew($name, $desc);\r
- \r
- self::action_skinoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinedit()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinedit()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('skinedit');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skineditgeneral()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skineditgeneral()\r
- {\r
- global $member;\r
- \r
- $skinid = intRequestVar('skinid');\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $error = self::skineditgeneral($skinid);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- self::action_skinedit();\r
- return;\r
- }\r
- \r
- static private function action_skinedittype($msg = '')\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- if ( $msg )\r
- {\r
- self::$headMess = $msg;\r
- }\r
- \r
- $type = requestVar('type');\r
- $type = trim($type);\r
- $type = strtolower($type);\r
- \r
- if ( !isValidShortName($type) )\r
- {\r
- self::error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);\r
- return;\r
- }\r
- \r
- self::$skin->parse('skinedittype');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinupdate()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinupdate()\r
- {\r
- global $manager, $member;\r
- \r
- $skinid = intRequestVar('skinid');\r
- $content = trim(postVar('content'));\r
- $type = postVar('type');\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skin =& $manager->getSKIN($skinid);\r
- $skin->update($type, $content);\r
- \r
- self::action_skinedittype(_SKIN_UPDATED);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skindelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skindelete()\r
- {\r
- global $CONF, $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- \r
- // don't allow default skin to be deleted\r
- if ( $skinid == $CONF['BaseSkin'] )\r
- {\r
- self::error(_ERROR_DEFAULTSKIN);\r
- return;\r
- }\r
- \r
- // don't allow deletion of default skins for blogs\r
- $query = "SELECT bname FROM %s WHERE bdefskin=%d";\r
- $query = sprintf($query, sql_table('blog'), (integer) $skinid);\r
- \r
- $name = DB::getValue($query);\r
- if ( $name )\r
- {\r
- self::error(_ERROR_SKINDEFDELETE . Entity::hsc($name));\r
- return;\r
- }\r
- \r
- self::$skin->parse('skindelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skindeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skindeleteconfirm()\r
- {\r
- global $member, $CONF;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- \r
- // don't allow default skin to be deleted\r
- if ( $skinid == $CONF['BaseSkin'] )\r
- {\r
- self::error(_ERROR_DEFAULTSKIN);\r
- return;\r
- }\r
- \r
- // don't allow deletion of default skins for blogs\r
- $query = "SELECT bname FROM %s WHERE bdefskin=%d;";\r
- $query = sprintf($query, sql_table('blog'), (integer) $skinid);\r
- \r
- $name = DB::getValue($query);\r
- if ( $name )\r
- {\r
- self::error(_ERROR_SKINDEFDELETE . Entity::hsc($name));\r
- return;\r
- }\r
- \r
- self::skindeleteconfirm($skinid);\r
- \r
- self::action_skinoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinremovetype()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinremovetype()\r
- {\r
- global $member, $CONF;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- $skintype = requestVar('type');\r
- \r
- if ( !isValidShortName($skintype) )\r
- {\r
- self::error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);\r
- return;\r
- }\r
- \r
- self::$skin->parse('skinremovetype');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinremovetypeconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinremovetypeconfirm()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- $skintype = requestVar('type');\r
- \r
- $error = self::skinremovetypeconfirm($skinid, $skintype);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- self::action_skinedit();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_skinclone()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_skinclone()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- \r
- self::skinclone($skinid);\r
- \r
- self::action_skinoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskinoverview()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinoverview()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('adminskinoverview');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskinnew()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinnew()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $name = trim(postVar('name'));\r
- $desc = trim(postVar('desc'));\r
- \r
- if ( !isValidSkinName($name) )\r
- {\r
- self::error(_ERROR_BADSKINNAME);\r
- return;\r
- }\r
- else if ( !preg_match('#^admin/#', $name) )\r
- {\r
- self::error(_ERROR_BADADMINSKINNAME);\r
- return;\r
- }\r
- else if ( Skin::exists($name) )\r
- {\r
- self::error(_ERROR_DUPSKINNAME);\r
- return;\r
- }\r
- \r
- Skin::createNew($name, $desc);\r
- \r
- self::action_adminskinoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskinedit()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinedit()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('adminskinedit');\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskineditgeneral()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskineditgeneral()\r
- {\r
- global $member;\r
- \r
- $skinid = intRequestVar('skinid');\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $error = self::skineditgeneral($skinid, 'AdminActions');\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- self::action_adminskinedit();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskinedittype()\r
- * \r
- * @param string $msg message for pageheader\r
- * @return void\r
- */\r
- static private function action_adminskinedittype($msg = '')\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- if ( $msg )\r
- {\r
- self::$headMess = $msg;\r
- }\r
- $type = requestVar('type');\r
- $type = trim($type);\r
- $type = strtolower($type);\r
- \r
- if ( !isValidShortName($type) )\r
- {\r
- self::error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);\r
- return;\r
- }\r
- \r
- self::$skin->parse('adminskinedittype');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskinupdate()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinupdate()\r
- {\r
- global $manager, $member;\r
- \r
- $skinid = intRequestVar('skinid');\r
- $content = trim(postVar('content'));\r
- $type = postVar('type');\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skin =& $manager->getSkin($skinid, 'AdminActions', 'AdminSkin');\r
- $skin->update($type, $content);\r
- \r
- self::action_adminskinedittype(_SKIN_UPDATED);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskindelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskindelete()\r
- {\r
- global $CONF, $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- \r
- // don't allow default skin to be deleted\r
- if ( $skinid == $CONF['AdminSkin'] || $skinid == $CONF['BookmarkletSkin'] )\r
- {\r
- self::error(_ERROR_DEFAULTSKIN);\r
- return;\r
- }\r
- \r
- /* don't allow if someone use it as a default*/\r
- $query = 'SELECT * FROM %s WHERE madminskin = %d or mbkmklt = %d;';\r
- $res = DB::getResult(sprintf($query, sql_table('member'), $skinid, $skinid));\r
- \r
- $members = array();\r
- while ( $row = $res->fetch() ) {\r
- $members[] = $row['mrealname'];\r
- }\r
- if ( count($members) )\r
- {\r
- self::error(_ERROR_SKINDEFDELETE . implode(' ' . _AND . ' ', $members));\r
- return;\r
- }\r
- \r
- self::$skin->parse('adminskindelete');\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_adminskindeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskindeleteconfirm()\r
- {\r
- global $member, $CONF;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- \r
- // don't allow default skin to be deleted\r
- if ( $skinid == $CONF['AdminSkin'] || $skinid == $CONF['BookmarkletSkin'] )\r
- {\r
- self::error(_ERROR_DEFAULTSKIN);\r
- return;\r
- }\r
- \r
- /* don't allow if someone use it as a default*/\r
- $query = 'SELECT * FROM %s WHERE madminskin = %d or mbkmklt = %d;';\r
- $res = DB::getResult(sprintf($query, sql_table('member'), $skinid, $skinid));\r
- \r
- $members = array();\r
- while ( $row = $res->fetch() ) {\r
- $members[] = $row['mrealname'];\r
- }\r
- if ( count($members) )\r
- {\r
- self::error(_ERROR_SKINDEFDELETE . implode(' ' . _AND . ' ', $members));\r
- return;\r
- }\r
- \r
- self::skindeleteconfirm($skinid);\r
- \r
- self::action_adminskinoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskinremovetype()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinremovetype()\r
- {\r
- global $member, $CONF;\r
-\r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- $skintype = requestVar('type');\r
- \r
- if ( !isValidShortName($skintype) )\r
- {\r
- self::error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);\r
- return;\r
- }\r
- \r
- self::$skin->parse('adminskinremovetype');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskinremovetypeconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinremovetypeconfirm()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- $skintype = requestVar('type');\r
- \r
- $error = self::skinremovetypeconfirm($skinid, $skintype);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- self::action_adminskinedit();\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_adminskinclone()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinclone()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinid = intRequestVar('skinid');\r
- \r
- self::skinclone($skinid, 'AdminActions');\r
- \r
- self::action_adminskinoverview();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskinieoverview()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinieoverview()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('adminskinieoverview');\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_adminskinieimport()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinieimport()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $skinFileRaw = postVar('skinfile');\r
- $mode = postVar('mode');\r
- \r
- $error = self::skinieimport($mode, $skinFileRaw);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- if ( !is_object(self::$skin) )\r
- {\r
- self::action_adminskiniedoimport();\r
- }\r
- else\r
- {\r
- self::$skin->parse('adminskinieimport');\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_adminskiniedoimport()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskiniedoimport()\r
- {\r
- global $DIR_SKINS, $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- $mode = postVar('mode');\r
- $skinFileRaw = postVar('skinfile');\r
- $allowOverwrite = intPostVar('overwrite');\r
- \r
- $error = self::skiniedoimport($mode, $skinFileRaw, $allowOverwrite);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- if ( !is_object(self::$skin) )\r
- {\r
- global $DIR_SKINS;\r
- $query = "SELECT min(sdnumber) FROM %s WHERE sdname != 'admin/bookmarklet' AND sdname LIKE 'admin/%%'";\r
- $query = sprintf($query, sql_table('skin_desc'));\r
- $res = intval(DB::getValue($query));\r
- $query = "UPDATE %s SET value = %d WHERE name = 'AdminSkin'";\r
- $query = sprintf($query, sql_table('config'), $res);\r
- DB::execute($query);\r
- $skin = new Skin(0, 'AdminActions', 'AdminSkin');\r
- $skin->parse('importAdmin', $DIR_SKINS . 'admin/defaultimporter.skn');\r
- }\r
- else\r
- {\r
- self::$skin->parse('adminskiniedoimport');\r
- }\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_adminskinieexport()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_adminskinieexport()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- // load skinie class\r
- $aSkins = requestIntArray('skin');\r
- $aTemplates = requestIntArray('template');\r
- $info = postVar('info');\r
- \r
- self::skinieexport($aSkins, $aTemplates, $info);\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_settingsedit()\r
- * \r
- * @param Void\r
- * @return Void\r
- */\r
- static private function action_settingsedit()\r
- {\r
- global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('settingsedit');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_settingsupdate()\r
- * Update $CONFIG and redirect\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_settingsupdate()\r
- {\r
- global $member, $CONF;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- // check if email address for admin is valid\r
- if ( !NOTIFICATION::address_validation(postVar('AdminEmail')) )\r
- {\r
- self::error(_ERROR_BADMAILADDRESS);\r
- return;\r
- }\r
- \r
- // save settings\r
- self::updateConfig('DefaultBlog', postVar('DefaultBlog'));\r
- self::updateConfig('BaseSkin', postVar('BaseSkin'));\r
- self::updateConfig('IndexURL', postVar('IndexURL'));\r
- self::updateConfig('AdminURL', postVar('AdminURL'));\r
- self::updateConfig('PluginURL', postVar('PluginURL'));\r
- self::updateConfig('SkinsURL', postVar('SkinsURL'));\r
- self::updateConfig('ActionURL', postVar('ActionURL'));\r
- self::updateConfig('Locale', postVar('Locale'));\r
- self::updateConfig('AdminEmail', postVar('AdminEmail'));\r
- self::updateConfig('SessionCookie', postVar('SessionCookie'));\r
- self::updateConfig('AllowMemberCreate', postVar('AllowMemberCreate'));\r
- self::updateConfig('AllowMemberMail', postVar('AllowMemberMail'));\r
- self::updateConfig('NonmemberMail', postVar('NonmemberMail'));\r
- self::updateConfig('ProtectMemNames', postVar('ProtectMemNames'));\r
- self::updateConfig('SiteName', postVar('SiteName'));\r
- self::updateConfig('NewMemberCanLogon', postVar('NewMemberCanLogon'));\r
- self::updateConfig('DisableSite', postVar('DisableSite'));\r
- self::updateConfig('DisableSiteURL', postVar('DisableSiteURL'));\r
- self::updateConfig('LastVisit', postVar('LastVisit'));\r
- self::updateConfig('MediaURL', postVar('MediaURL'));\r
- self::updateConfig('AllowedTypes', postVar('AllowedTypes'));\r
- self::updateConfig('AllowUpload', postVar('AllowUpload'));\r
- self::updateConfig('MaxUploadSize', postVar('MaxUploadSize'));\r
- self::updateConfig('MediaPrefix', postVar('MediaPrefix'));\r
- self::updateConfig('AllowLoginEdit', postVar('AllowLoginEdit'));\r
- self::updateConfig('DisableJsTools', postVar('DisableJsTools'));\r
- self::updateConfig('CookieDomain', postVar('CookieDomain'));\r
- self::updateConfig('CookiePath', postVar('CookiePath'));\r
- self::updateConfig('CookieSecure', postVar('CookieSecure'));\r
- self::updateConfig('URLMode', postVar('URLMode'));\r
- self::updateConfig('CookiePrefix', postVar('CookiePrefix'));\r
- self::updateConfig('DebugVars', postVar('DebugVars'));\r
- self::updateConfig('DefaultListSize', postVar('DefaultListSize'));\r
- self::updateConfig('AdminCSS', postVar('AdminCSS'));\r
- self::updateConfig('AdminSkin', postVar('adminskin'));\r
- self::updateConfig('BookmarkletSkin', postVar('bookmarklet'));\r
-\r
- // load new config and redirect (this way, the new locale will be used is necessary)\r
- // note that when changing cookie settings, this redirect might cause the user\r
- // to have to log in again.\r
- getConfig();\r
- redirect($CONF['AdminURL'] . '?action=manage');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_systemoverview()\r
- * Output system overview\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_systemoverview()\r
- {\r
- self::$skin->parse('systemoverview');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::updateConfig()\r
- * \r
- * @param string $name \r
- * @param string $val \r
- * @return integer return the ID in which the latest query posted\r
- */\r
- static private function updateConfig($name, $val)\r
- {\r
- $query = "UPDATE %s SET value=%s WHERE name=%s";\r
- $query = sprintf($query, sql_table('config'), DB::quoteValue($val), DB::quoteValue($name));\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $err = DB::getError();\r
- die(_ADMIN_SQLDIE_QUERYERROR . $err[2]);\r
- }\r
- return DB::getInsertId();\r
- }\r
- \r
- /**\r
- * Admin::error()\r
- * Error message\r
- * \r
- * @param string $msg message that will be shown\r
- * @return void\r
- */\r
- static public function error($msg)\r
- {\r
- self::$headMess = $msg;\r
- self::$skin->parse('adminerrorpage');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::disallow()\r
- * add error log and show error page \r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static public function disallow()\r
- {\r
- ActionLog::add(WARNING, _ACTIONLOG_DISALLOWED . serverVar('REQUEST_URI'));\r
- self::error(_ERROR_DISALLOWED);\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_PluginAdmin()\r
- * Output pluginadmin\r
- *\r
- * @param string $skinContents\r
- * @param string $extrahead\r
- * @return void\r
- */\r
- static public function action_PluginAdmin($skinContents, $extrahead = '')\r
- {\r
- self::$extrahead .= $extrahead;\r
- self::$skin->parse('pluginadmin', $skinContents);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_bookmarklet()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_bookmarklet()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- $member->teamRights($blogid) or self::disallow();\r
- \r
- self::$skin->parse('bookmarklet');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_actionlog()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_actionlog()\r
- {\r
- global $member, $manager;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('actionlog');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_banlist()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_banlist()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- self::$skin->parse('banlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_banlistdelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_banlistdelete()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- self::$skin->parse('banlistdelete');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_banlistdeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_banlistdeleteconfirm()\r
- {\r
- global $member, $manager;\r
- \r
- $blogid = intPostVar('blogid');\r
- $allblogs = postVar('allblogs');\r
- $iprange = postVar('iprange');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- $deleted = array();\r
- \r
- if ( !$allblogs )\r
- {\r
- if ( Ban::removeBan($blogid, $iprange) )\r
- {\r
- $deleted[] = $blogid;\r
- }\r
- }\r
- else\r
- {\r
- // get blogs fot which member has admin rights\r
- $adminblogs = $member->getAdminBlogs();\r
- foreach ($adminblogs as $blogje)\r
- {\r
- if ( Ban::removeBan($blogje, $iprange) )\r
- {\r
- $deleted[] = $blogje;\r
- }\r
- }\r
- }\r
- \r
- if ( sizeof($deleted) == 0 )\r
- {\r
- self::error(_ERROR_DELETEBAN);\r
- return;\r
- }\r
- \r
- /* TODO: we should use other ways */\r
- $_REQUEST['delblogs'] = $deleted;\r
- \r
- self::$skin->parse('banlistdeleteconfirm');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_banlistnewfromitem()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_banlistnewfromitem()\r
- {\r
- global $manager;\r
- \r
- $itemid = intRequestVar('itemid');\r
- $item =& $manager->getItem($itemid, 1, 1);\r
- self::action_banlistnew($item['blogid']);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_banlistnew()\r
- * \r
- * @param integer $blogid ID for weblog\r
- * @return void\r
- */\r
- static private function action_banlistnew($blogid = '')\r
- {\r
- global $member, $manager;\r
- \r
- if ( $blogid == '' )\r
- {\r
- $blogid = intRequestVar('blogid');\r
- }\r
- \r
- $ip = requestVar('ip');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- /* TODO: we should consider to use the other way instead of this */\r
- $_REQUEST['blogid'] = $blogid; \r
- \r
- self::$skin->parse('banlistnew');\r
- \r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_banlistadd()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_banlistadd()\r
- {\r
- global $member;\r
- \r
- $blogid = intPostVar('blogid');\r
- $allblogs = postVar('allblogs');\r
- $iprange = postVar('iprange');\r
- \r
- if ( $iprange == "custom" )\r
- {\r
- $iprange = postVar('customiprange');\r
- }\r
- $reason = postVar('reason');\r
- \r
- $member->blogAdminRights($blogid) or self::disallow();\r
- \r
- // TODO: check IP range validity\r
- \r
- if ( !$allblogs )\r
- {\r
- if ( !Ban::addBan($blogid, $iprange, $reason) )\r
- {\r
- self::error(_ERROR_ADDBAN);\r
- return;\r
- }\r
- }\r
- else\r
- {\r
- // get blogs fot which member has admin rights\r
- $adminblogs = $member->getAdminBlogs();\r
- $failed = 0;\r
- foreach ($adminblogs as $blogje)\r
- {\r
- if ( !Ban::addBan($blogje, $iprange, $reason) )\r
- {\r
- $failed = 1;\r
- }\r
- }\r
- if ( $failed )\r
- {\r
- self::error(_ERROR_ADDBAN);\r
- return;\r
- }\r
- }\r
- self::action_banlist();\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_clearactionlog()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_clearactionlog()\r
- {\r
- global $member;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- ActionLog::clear();\r
- \r
- self::action_manage(_MSG_ACTIONLOGCLEARED);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_backupoverview()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_backupoverview()\r
- {\r
- global $member, $manager;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('backupoverview');\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_backupcreate()\r
- * create file for backup\r
- * \r
- * @param void\r
- * @return void\r
- * \r
- */\r
- static private function action_backupcreate()\r
- {\r
- global $member, $DIR_LIBS;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- // use compression ?\r
- $useGzip = (integer) postVar('gzip');\r
- \r
- include($DIR_LIBS . 'backup.php');\r
- \r
- // try to extend time limit\r
- // (creating/restoring dumps might take a while)\r
- @set_time_limit(1200);\r
- \r
- Backup::do_backup($useGzip);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_backuprestore()\r
- * restoring from uploaded file\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_backuprestore()\r
- {\r
- global $member, $DIR_LIBS;\r
- \r
- $member->isAdmin() or self::disallow();\r
- \r
- if ( intPostVar('letsgo') != 1 )\r
- {\r
- self::error(_ERROR_BACKUP_NOTSURE);\r
- return;\r
- }\r
- \r
- include($DIR_LIBS . 'backup.php');\r
- \r
- // try to extend time limit\r
- // (creating/restoring dumps might take a while)\r
- @set_time_limit(1200);\r
- \r
- $message = Backup::do_restore();\r
- if ( $message != '' )\r
- {\r
- self::error($message);\r
- return;\r
- }\r
- self::$skin->parse('backuprestore');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_pluginlist()\r
- * output the list of installed plugins\r
- * \r
- * @param void\r
- * @return void\r
- * \r
- */\r
- static private function action_pluginlist()\r
- {\r
- global $DIR_PLUGINS, $member, $manager;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- self::$skin->parse('pluginlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_pluginhelp()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_pluginhelp()\r
- {\r
- global $member, $manager, $DIR_PLUGINS, $CONF;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- $plugid = intGetVar('plugid');\r
- \r
- if ( !$manager->pidInstalled($plugid) )\r
- {\r
- self::error(_ERROR_NOSUCHPLUGIN);\r
- return;\r
- }\r
- \r
- self::$skin->parse('pluginhelp');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_pluginadd()\r
- * \r
- * @param Void\r
- * @return Void\r
- * \r
- */\r
- static private function action_pluginadd()\r
- {\r
- global $member, $manager, $DIR_PLUGINS;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- $name = postVar('filename');\r
- \r
- if ( $manager->pluginInstalled($name) )\r
- {\r
- self::error(_ERROR_DUPPLUGIN);\r
- return;\r
- }\r
- \r
- if ( !checkPlugin($name) )\r
- {\r
- self::error(_ERROR_PLUGFILEERROR . ' (' . Entity::hsc($name) . ')');\r
- return;\r
- }\r
- \r
- // get number of currently installed plugins\r
- $res = DB::getResult('SELECT * FROM ' . sql_table('plugin'));\r
- $numCurrent = $res->rowCount();\r
- \r
- // plugin will be added as last one in the list\r
- $newOrder = $numCurrent + 1;\r
- \r
- $data = array('file' => &$name);\r
- $manager->notify('PreAddPlugin', $data);\r
- \r
- // do this before calling getPlugin (in case the plugin id is used there)\r
- $query = "INSERT INTO %s (porder, pfile) VALUES (%d, %s);";\r
- $query = sprintf($query, sql_table('plugin'), (integer) $newOrder, DB::quoteValue($name));\r
- DB::execute($query);\r
- $iPid = DB::getInsertId();\r
- \r
- $manager->clearCachedInfo('installedPlugins');\r
- \r
- // Load the plugin for condition checking and instalation\r
- $plugin =& $manager->getPlugin($name);\r
- \r
- // check if it got loaded (could have failed)\r
- if ( !$plugin )\r
- {\r
- $query = "DELETE FROM %s WHERE pid=%d;";\r
- $query = sprintf($query, sql_table('plugin'), (integer) $iPid);\r
- \r
- DB::execute($query);\r
- \r
- $manager->clearCachedInfo('installedPlugins');\r
- self::error(_ERROR_PLUGIN_LOAD);\r
- return;\r
- }\r
- \r
- // check if plugin needs a newer Nucleus version\r
- if ( getNucleusVersion() < $plugin->getMinNucleusVersion() )\r
- {\r
- // uninstall plugin again...\r
- self::deleteOnePlugin($plugin->getID());\r
- \r
- // ...and show error\r
- self::error(_ERROR_NUCLEUSVERSIONREQ . Entity::hsc($plugin->getMinNucleusVersion()));\r
- return;\r
- }\r
- \r
- // check if plugin needs a newer Nucleus version\r
- if ( (getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()) )\r
- {\r
- // uninstall plugin again...\r
- self::deleteOnePlugin($plugin->getID());\r
- \r
- // ...and show error\r
- self::error(_ERROR_NUCLEUSVERSIONREQ . Entity::hsc( $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel() ) );\r
- return;\r
- }\r
- \r
- $pluginList = $plugin->getPluginDep();\r
- foreach ( $pluginList as $pluginName )\r
- {\r
- $res = DB::getResult('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile=' . DB::quoteValue($pluginName));\r
- if ($res->rowCount() == 0)\r
- {\r
- // uninstall plugin again...\r
- self::deleteOnePlugin($plugin->getID());\r
- self::error(sprintf(_ERROR_INSREQPLUGIN, Entity::hsc($pluginName)));\r
- return;\r
- }\r
- }\r
- \r
- // call the install method of the plugin\r
- $plugin->install();\r
- \r
- $data = array('plugin' => &$plugin);\r
- $manager->notify('PostAddPlugin', $data);\r
- \r
- // update all events\r
- self::action_pluginupdate();\r
- return;\r
- }\r
- \r
- /**\r
- * ADMIN:action_pluginupdate():\r
- * \r
- * @param Void\r
- * @return Void\r
- * \r
- */\r
- static private function action_pluginupdate()\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- // delete everything from plugin_events\r
- DB::execute('DELETE FROM '.sql_table('plugin_event'));\r
- \r
- // loop over all installed plugins\r
- $res = DB::getResult('SELECT pid, pfile FROM '.sql_table('plugin'));\r
- foreach ( $res as $row )\r
- {\r
- $pid = $row['pid'];\r
- $plug =& $manager->getPlugin($row['pfile']);\r
- if ( $plug )\r
- {\r
- $eventList = $plug->getEventList();\r
- foreach ( $eventList as $eventName )\r
- {\r
- $query = "INSERT INTO %s (pid, event) VALUES (%d, %s)";\r
- $query = sprintf($query, sql_table('plugin_event'), (integer) $pid, DB::quoteValue($eventName));\r
- DB::execute($query);\r
- }\r
- }\r
- }\r
- redirect($CONF['AdminURL'] . '?action=pluginlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_plugindelete()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_plugindelete()\r
- {\r
- global $member, $manager;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- $pid = intGetVar('plugid');\r
- \r
- if ( !$manager->pidInstalled($pid) )\r
- {\r
- self::error(_ERROR_NOSUCHPLUGIN);\r
- return;\r
- }\r
- \r
- self::$skin->parse('plugindelete');\r
- return;\r
- }\r
-\r
- /**\r
- * Admin::action_plugindeleteconfirm()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_plugindeleteconfirm()\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- $pid = intPostVar('plugid');\r
- \r
- $error = self::deleteOnePlugin($pid, 1);\r
- if ( $error )\r
- {\r
- self::error($error);\r
- return;\r
- }\r
- \r
- redirect($CONF['AdminURL'] . '?action=pluginlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::deleteOnePlugin()\r
- * \r
- * @param integer $pid\r
- * @param boolean $callUninstall\r
- * @return string empty or message if failed\r
- */\r
- static public function deleteOnePlugin($pid, $callUninstall = 0)\r
- {\r
- global $manager;\r
- \r
- $pid = intval($pid);\r
- \r
- if ( !$manager->pidInstalled($pid) )\r
- {\r
- return _ERROR_NOSUCHPLUGIN;\r
- }\r
- \r
- $query = "SELECT pfile as result FROM %s WHERE pid=%d;";\r
- $query = sprintf($query, sql_table('plugin'), (integer) $pid);\r
- $name = DB::getValue($query);\r
- \r
- // check dependency before delete\r
- $res = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));\r
- foreach ( $res as $row )\r
- {\r
- $plug =& $manager->getPlugin($row['pfile']);\r
- if ( $plug )\r
- {\r
- $depList = $plug->getPluginDep();\r
- foreach ( $depList as $depName )\r
- {\r
- if ( $name == $depName )\r
- {\r
- return sprintf(_ERROR_DELREQPLUGIN, $row['pfile']);\r
- }\r
- }\r
- }\r
- }\r
- \r
- $data = array('plugid' => $pid);\r
- $manager->notify('PreDeletePlugin', $data);\r
- \r
- // call the unInstall method of the plugin\r
- if ( $callUninstall )\r
- {\r
- $plugin =& $manager->getPlugin($name);\r
- if ( $plugin )\r
- {\r
- $plugin->unInstall();\r
- }\r
- }\r
- \r
- // delete all subscriptions\r
- DB::execute('DELETE FROM ' . sql_table('plugin_event') . ' WHERE pid=' . $pid);\r
- \r
- // delete all options\r
- // get OIDs from plugin_option_desc\r
- $res = DB::getResult('SELECT oid FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);\r
- $aOIDs = array();\r
- foreach ( $res as $row )\r
- {\r
- array_push($aOIDs, $row['oid']);\r
- }\r
- \r
- // delete from plugin_option and plugin_option_desc\r
- DB::execute('DELETE FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);\r
- if (count($aOIDs) > 0)\r
- {\r
- DB::execute('DELETE FROM ' . sql_table('plugin_option') . ' WHERE oid in (' . implode(',', $aOIDs) . ')');\r
- }\r
- \r
- // update order numbers\r
- $res = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $pid);\r
- DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=(porder - 1) WHERE porder>' . $res);\r
- \r
- // delete row\r
- DB::execute('DELETE FROM ' . sql_table('plugin') . ' WHERE pid=' . $pid);\r
- \r
- $manager->clearCachedInfo('installedPlugins');\r
- $data = array('plugid' => $pid);\r
- $manager->notify('PostDeletePlugin', $data);\r
- \r
- return '';\r
- }\r
- \r
- /**\r
- * Admin::action_pluginup()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_pluginup()\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- $plugid = intGetVar('plugid');\r
- \r
- if ( !$manager->pidInstalled($plugid) )\r
- {\r
- self::error(_ERROR_NOSUCHPLUGIN);\r
- return;\r
- }\r
- \r
- // 1. get old order number\r
- $oldOrder = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $plugid);\r
- \r
- // 2. calculate new order number\r
- $newOrder = ($oldOrder > 1) ? ($oldOrder - 1) : 1;\r
- \r
- // 3. update plug numbers\r
- DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $oldOrder . ' WHERE porder=' . $newOrder);\r
- DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $newOrder . ' WHERE pid=' . $plugid);\r
- \r
- //self::action_pluginlist();\r
- // To avoid showing ticket in the URL, redirect to pluginlist, instead.\r
- redirect($CONF['AdminURL'] . '?action=pluginlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_plugindown()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_plugindown()\r
- {\r
- global $member, $manager, $CONF;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- $plugid = intGetVar('plugid');\r
- if ( !$manager->pidInstalled($plugid) )\r
- {\r
- self::error(_ERROR_NOSUCHPLUGIN);\r
- return;\r
- }\r
- \r
- // 1. get old order number\r
- $oldOrder = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $plugid);\r
- \r
- $res = DB::getResult('SELECT * FROM ' . sql_table('plugin'));\r
- $maxOrder = $res->rowCount();\r
- \r
- // 2. calculate new order number\r
- $newOrder = ($oldOrder < $maxOrder) ? ($oldOrder + 1) : $maxOrder;\r
- \r
- // 3. update plug numbers\r
- DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $oldOrder . ' WHERE porder=' . $newOrder);\r
- DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $newOrder . ' WHERE pid=' . $plugid);\r
- \r
- //self::action_pluginlist();\r
- // To avoid showing ticket in the URL, redirect to pluginlist, instead.\r
- redirect($CONF['AdminURL'] . '?action=pluginlist');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_pluginoptions()\r
- * \r
- * Output Plugin option page\r
- * \r
- * @access public\r
- * @param string $message message when fallbacked\r
- * @return void\r
- * \r
- */\r
- static private function action_pluginoptions($message = '')\r
- {\r
- global $member, $manager;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- $pid = intRequestVar('plugid');\r
- if ( !$manager->pidInstalled($pid) )\r
- {\r
- self::error(_ERROR_NOSUCHPLUGIN);\r
- return;\r
- }\r
- \r
- if ( isset($message) )\r
- {\r
- self::$headMess = $message;\r
- }\r
- $plugname = $manager->getPluginNameFromPid($pid);\r
- $plugin = $manager->getPlugin($plugname);\r
- self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";\r
- \r
- self::$skin->parse('pluginoptions');\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_pluginoptionsupdate()\r
- * \r
- * Update plugin options and fallback to plugin option page\r
- * \r
- * @access public\r
- * @param void\r
- * @return void\r
- */\r
- static private function action_pluginoptionsupdate()\r
- {\r
- global $member, $manager;\r
- \r
- // check if allowed\r
- $member->isAdmin() or self::disallow();\r
- \r
- $pid = intRequestVar('plugid');\r
- \r
- if ( !$manager->pidInstalled($pid) )\r
- {\r
- self::error(_ERROR_NOSUCHPLUGIN);\r
- return;\r
- }\r
- \r
- $aOptions = requestArray('plugoption');\r
- NucleusPlugin::apply_plugin_options($aOptions);\r
- \r
- $data = array(\r
- 'context' => 'global',\r
- 'plugid' => $pid\r
- );\r
- $manager->notify('PostPluginOptionsUpdate', $data);\r
- \r
- self::action_pluginoptions(_PLUGS_OPTIONS_UPDATED);\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::skineditgeneral()\r
- * \r
- * @param integer $skinid\r
- * @param string $handler\r
- * @return string empty or message if failed\r
- */\r
- static private function skineditgeneral($skinid, $handler='')\r
- {\r
- global $manager;\r
- \r
- $name = postVar('name');\r
- $desc = postVar('desc');\r
- $type = postVar('type');\r
- $inc_mode = postVar('inc_mode');\r
- $inc_prefix = postVar('inc_prefix');\r
- \r
- $skin =& $manager->getSkin($skinid, $handler);\r
- \r
- // 1. Some checks\r
- if ( !isValidSkinName($name) )\r
- {\r
- return _ERROR_BADSKINNAME;\r
- }\r
- \r
- if ( ($skin->getName() != $name) && SKIN::exists($name) )\r
- {\r
- return _ERROR_DUPSKINNAME;\r
- }\r
- \r
- if ( !$type )\r
- {\r
- $type = 'text/html';\r
- }\r
- \r
- if ( !$inc_mode )\r
- {\r
- $inc_mode = 'normal';\r
- }\r
- \r
- // 2. Update description\r
- $skin->updateGeneralInfo($name, $desc, $type, $inc_mode, $inc_prefix);\r
- \r
- return '';\r
- }\r
- /**\r
- * Admin::skindeleteconfirm()\r
- * \r
- * @param integer $skinid\r
- * @return void\r
- */\r
- static private function skindeleteconfirm($skinid)\r
- {\r
- global $manager;\r
- \r
- if ( !in_array(self::$action, self::$adminskin_actions) )\r
- {\r
- $event_identifier = 'Skin';\r
- }\r
- else\r
- {\r
- $event_identifier = 'AdminSkin';\r
- }\r
- \r
- $manager->notify("PreDelete{$event_identifier}", array('skinid' => $skinid));\r
- \r
- // 1. delete description\r
- $query = "DELETE FROM %s WHERE sdnumber=%d;";\r
- $query = sprintf($query, sql_table('skin_desc'), (integer) $skinid);\r
- DB::execute($query);\r
- \r
- // 2. delete parts\r
- $query = "DELETE FROM %s WHERE sdesc=%d;";\r
- $query = sprintf($query, sql_table('skin'), (integer) $skinid);\r
- DB::execute($query);\r
- \r
- $manager->notify("PostDelete{$event_identifier}", array('skinid' => $skinid));\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Admin::skinremovetypeconfirm()\r
- * \r
- * @param integer $skinid\r
- * @param string $skintype\r
- * @return string empty or message if failed\r
- */\r
- static private function skinremovetypeconfirm($skinid, $skintype)\r
- {\r
- global $manager;\r
- \r
- if ( !in_array(self::$action, self::$adminskin_actions) )\r
- {\r
- $event_identifier = 'Skin';\r
- }\r
- else\r
- {\r
- $event_identifier = 'AdminSkin';\r
- }\r
- \r
- if ( !isValidShortName($skintype) )\r
- {\r
- return _ERROR_SKIN_PARTS_SPECIAL_DELETE;\r
- }\r
- \r
- $data = array(\r
- 'skinid' => $skinid,\r
- 'skintype' => $skintype\r
- );\r
- $manager->notify("PreDelete{$event_identifier}Part", $data);\r
- \r
- // delete part\r
- $query = 'DELETE FROM %s WHERE sdesc = %d AND stype = %s;';\r
- $query = sprintf($query, sql_table('skin'), (integer) $skinid, DB::quoteValue($skintype) );\r
- DB::execute($query);\r
- \r
- $data = array(\r
- 'skinid' => $skinid,\r
- 'skintype' => $skintype\r
- );\r
- $manager->notify("PostDelete{$event_identifier}Part", $data);\r
- \r
- return '';\r
- }\r
- \r
- /**\r
- * Admin::skinclone()\r
- * \r
- * @param integer $skinid\r
- * @param string $handler\r
- * @return void\r
- */\r
- static private function skinclone($skinid, $handler='')\r
- {\r
- global $manager;\r
- \r
- // 1. read skin to clone\r
- $skin =& $manager->getSkin($skinid, $handler);\r
- $name = "{$skin->getName()}_clone";\r
- \r
- // if a skin with that name already exists:\r
- if ( Skin::exists($name) )\r
- {\r
- $i = 1;\r
- while ( Skin::exists($name . $i) )\r
- {\r
- $i++;\r
- }\r
- $name .= $i;\r
- }\r
- \r
- // 2. create skin desc\r
- $newid = Skin::createNew(\r
- $name,\r
- $skin->getDescription(),\r
- $skin->getContentType(),\r
- $skin->getIncludeMode(),\r
- $skin->getIncludePrefix()\r
- );\r
- \r
- // 3. clone\r
- $query = "SELECT stype FROM %s WHERE sdesc=%d;";\r
- $query = sprintf($query, sql_table('skin'), (integer) $skinid);\r
- \r
- $res = DB::getResult($query);\r
- foreach ( $res as $row )\r
- {\r
- $content = $skin->getContentFromDB($row['stype']);\r
- if ( $content )\r
- {\r
- $query = "INSERT INTO %s (sdesc, scontent, stype) VALUES (%d, %s, %s)";\r
- $query = sprintf($query, sql_table('skin'), (integer) $newid, DB::quoteValue($content), DB::quoteValue($row['stype']));\r
- DB::execute($query);\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Admin::skinieimport()\r
- * \r
- * @param string $mode\r
- * @param string $skinFileRaw\r
- * @return string empty or message if failed\r
- */\r
- static private function skinieimport($mode, $skinFileRaw)\r
- {\r
- global $DIR_LIBS, $DIR_SKINS;\r
- \r
- // load skinie class\r
- include_once($DIR_LIBS . 'skinie.php');\r
- \r
- $importer = new SkinImport();\r
- \r
- // get full filename\r
- if ( $mode == 'file' )\r
- {\r
- $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';\r
- }\r
- else\r
- {\r
- $skinFile = $skinFileRaw;\r
- }\r
- \r
- // read only metadata\r
- $error = $importer->readFile($skinFile, 1);\r
- if ( $error )\r
- {\r
- unset($importer);\r
- return $error;\r
- }\r
- \r
- self::$contents['mode'] = $mode;\r
- self::$contents['skinfile'] = $skinFileRaw;\r
- self::$contents['skininfo'] = $importer->getInfo();\r
- self::$contents['skinnames'] = $importer->getSkinNames();\r
- self::$contents['tpltnames'] = $importer->getTemplateNames();\r
- \r
- // clashes\r
- $skinNameClashes = $importer->checkSkinNameClashes();\r
- $templateNameClashes = $importer->checkTemplateNameClashes();\r
- $hasNameClashes = (count($skinNameClashes) > 0) || (count($templateNameClashes) > 0);\r
- \r
- self::$contents['skinclashes'] = $skinNameClashes;\r
- self::$contents['tpltclashes'] = $templateNameClashes;\r
- self::$contents['nameclashes'] = $hasNameClashes ? 1 : 0;\r
- \r
- unset($importer);\r
- return '';\r
- }\r
- \r
- /**\r
- * Admin::skinieedoimport()\r
- * \r
- * @param string $mode\r
- * @param string $skinFileRaw\r
- * @param boolean $allowOverwrite\r
- * @return string empty or message if failed\r
- */\r
- static private function skiniedoimport($mode, $skinFileRaw, $allowOverwrite)\r
- {\r
- global $DIR_LIBS, $DIR_SKINS;\r
- \r
- // load skinie class\r
- include_once($DIR_LIBS . 'skinie.php');\r
- \r
- $importer = new SkinImport();\r
- \r
- // get full filename\r
- if ( $mode == 'file' )\r
- {\r
- $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';\r
- }\r
- else\r
- {\r
- $skinFile = $skinFileRaw;\r
- }\r
- \r
- $error = $importer->readFile($skinFile);\r
- if ( $error )\r
- {\r
- unset($importer);\r
- return $error;\r
- }\r
- \r
- $error = $importer->writeToDatabase($allowOverwrite);\r
- if ( $error )\r
- {\r
- unset($importer);\r
- return $error;\r
- }\r
- \r
- self::$contents['mode'] = $mode;\r
- self::$contents['skinfile'] = $skinFileRaw;\r
- self::$contents['skininfo'] = $importer->getInfo();\r
- self::$contents['skinnames'] = $importer->getSkinNames();\r
- self::$contents['tpltnames'] = $importer->getTemplateNames();\r
- \r
- unset($importer);\r
- return '';\r
- }\r
- \r
- /**\r
- * Admin::skinieexport()\r
- * \r
- * @param array $aSkins\r
- * @param array $aTemplates\r
- * @param string $info\r
- * @return void\r
- */\r
- static private function skinieexport($aSkins, $aTemplates, $info)\r
- {\r
- global $DIR_LIBS;\r
- \r
- // load skinie class\r
- include_once($DIR_LIBS . 'skinie.php');\r
- \r
- if ( !is_array($aSkins) )\r
- {\r
- $aSkins = array();\r
- }\r
- \r
- if (!is_array($aTemplates))\r
- {\r
- $aTemplates = array();\r
- }\r
- \r
- $skinList = array_keys($aSkins);\r
- $templateList = array_keys($aTemplates);\r
- \r
- $exporter = new SkinExport();\r
- foreach ( $skinList as $skinId )\r
- {\r
- $exporter->addSkin($skinId);\r
- }\r
- foreach ( $templateList as $templateId )\r
- {\r
- $exporter->addTemplate($templateId);\r
- }\r
- $exporter->setInfo($info);\r
- $exporter->export();\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Admin::action_parseSpecialskin()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- static private function action_parseSpecialskin()\r
- {\r
- self::$skin->parse(self::$action);\r
- return;\r
- }\r
-}\r
+<?php
+/**
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * The code for the Nucleus admin area
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: ADMIN.php 1661 2012-02-12 11:55:39Z sakamocchi $
+ */
+
+if ( !function_exists('requestVar') ) exit;
+require_once dirname(__FILE__) . '/showlist.php';
+
+class Admin
+{
+ static private $skin;
+
+ static public $action;
+ static public $aOptions;
+ static public $blog;
+ static public $contents;
+ static public $extrahead;
+ static public $headMess;
+ static public $passvar;
+
+ static private $skinless_actions = array(
+ 'plugindeleteconfirm',
+ 'pluginoptionsupdate',
+ 'blogsettingsupdate',
+ 'settingsupdate',
+ 'addnewlog2',
+ 'additem',
+ 'banlistnewfromitem',
+ 'itemdeleteconfirm',
+ 'itemupdate',
+ 'changemembersettings',
+ 'clearactionlog',
+ 'memberedit',
+ 'login',
+
+ 'skinremovetypeconfirm',
+ 'skinclone',
+ 'skindeleteconfirm',
+ 'skinnew',
+ 'skineditgeneral',
+ 'skinupdate',
+
+ 'skinieexport',
+
+ 'templateupdate',
+ 'templatedeleteconfirm',
+ 'templatenew',
+ 'templateclone',
+
+ 'adminskinremovetypeconfirm',
+ 'adminskinclone',
+ 'adminskindeleteconfirm',
+ 'adminskinnew',
+ 'adminskineditgeneral',
+ 'adminskinupdate',
+
+ 'adminskinieexport',
+
+ 'admintemplateupdate',
+ 'admintemplatedeleteconfirm',
+ 'admintemplatenew',
+ 'admintemplateclone'
+ );
+
+ static private $ticketless_actions = array(
+ 'showlogin',
+ 'login',
+ 'overview',
+ 'itemlist',
+ 'blogcommentlist',
+ 'bookmarklet',
+ 'blogsettings',
+ 'banlist',
+ 'createaccount',
+ 'deleteblog',
+ 'editmembersettings',
+ 'createaccount',
+ 'forgotpassword',
+ 'browseowncomments',
+ 'createitem',
+ 'browseownitems',
+ 'itemedit',
+ 'itemmove',
+ 'categoryedit',
+ 'categorydelete',
+ 'manage',
+ 'actionlog',
+ 'settingsedit',
+ 'backupoverview',
+ 'pluginlist',
+ 'createnewlog',
+ 'usermanagement',
+ 'itemcommentlist',
+ 'commentedit',
+ 'commentdelete',
+ 'banlistnewfromitem',
+ 'banlistdelete',
+ 'itemdelete',
+ 'manageteam',
+ 'teamdelete',
+ 'banlistnew',
+ 'memberedit',
+ 'memberdelete',
+ 'pluginhelp',
+ 'pluginoptions',
+ 'plugindelete',
+
+ 'activate',
+ 'systemoverview',
+ 'activatesetpwd',
+
+ 'skinoverview',
+ 'skinclone',
+ 'skindelete',
+ 'skinedit',
+ 'skinedittype',
+ 'skinnew',
+ 'skinremovetype',
+
+ 'skinieoverview',
+
+ 'templateoverview',
+ 'templateclone',
+ 'templateedit',
+ 'templatedelete',
+
+ 'adminskinoverview',
+ 'adminskinclone',
+ 'adminskindelete',
+ 'adminskinedit',
+ 'adminskinedittype',
+ 'adminskinnew',
+ 'adminskinremovetype',
+
+ 'adminskinieoverview',
+
+ 'admintemplateoverview',
+ 'admintemplateclone',
+ 'admintemplateedit',
+ 'admintemplatedelete'
+ );
+
+ /**
+ * NOTE: This is for condition of admin/normal skin actions
+ */
+ static public $adminskin_actions = array(
+ /* ticketless */
+ 'adminskinoverview',
+ 'adminskinclone',
+ 'adminskindelete',
+ 'adminskinedit',
+ 'adminskinedittype',
+ 'adminskinnew',
+ 'adminskinremovetype',
+
+ 'adminskinieoverview',
+
+ 'admintemplateoverview',
+ 'admintemplateclone',
+ 'admintemplateedit',
+ 'admintemplatedelete',
+
+ /* ticket needed */
+ 'adminskineditgeneral',
+ 'adminskinupdate',
+ 'adminskindeleteconfirm',
+ 'adminskinremovetypeconfirm',
+
+ 'adminskinieoverview',
+ 'adminskiniedoimport',
+ 'adminskinieexport',
+ 'adminskinieimport',
+
+ 'admintemplatenew',
+ 'admintemplatedeleteconfirm',
+ 'admintemplateupdate'
+ );
+
+ static public function initialize()
+ {
+ global $CONF, $manager, $member;
+
+ /* NOTE: 1. decide which skinid to use */
+ $skinid = $CONF['AdminSkin'];
+ if ( $member->isLoggedIn() )
+ {
+ $memskin = $member->getAdminSkin();
+ if ( $memskin && Skin::existsID($memskin))
+ {
+ $skinid = $memskin;
+ }
+ }
+
+ /* NOTE: 2. make an instance of skin object */
+ if ( !Skin::existsID($skinid) )
+ {
+ return FALSE;
+ }
+
+ /* NOTE: 3. initializing each members */
+ self::$skin =& $manager->getSkin($skinid, 'AdminActions', 'AdminSkin');
+ self::$action = '';
+ self::$extrahead = '';
+ self::$passvar = '';
+ self::$headMess = '';
+ self::$aOptions = '';
+ return TRUE;
+ }
+
+ /**
+ * Admin::action()
+ * Executes an action
+ *
+ * @param string $action action to be performed
+ * @return void
+ */
+ static public function action($action)
+ {
+ global $CONF, $manager, $member;
+
+ /* 1. decide action name */
+ $customAction = postvar('customaction');
+ if ( empty($customAction) )
+ {
+ $alias = array(
+ 'login' => 'overview',
+ '' => 'overview',
+ );
+ }
+ else
+ {
+ $alias = array(
+ 'login' => $customAction,
+ '' => $customAction
+ );
+ }
+ if ( array_key_exists($action, $alias) && isset($alias[$action]) )
+ {
+ $action = $alias[$action];
+ }
+ $method_name = "action_{$action}";
+ self::$action = strtolower($action);
+
+ /* 2. check ticket-needed action */
+ if ( !in_array(self::$action, self::$ticketless_actions) && !$manager->checkTicket() )
+ {
+ self::error(_ERROR_BADTICKET);
+ return;
+ }
+
+ /* 3. parse according to the action */
+ else if ( method_exists('Admin', $method_name) )
+ {
+ call_user_func(array(__CLASS__, $method_name));
+ return;
+ }
+ /* 4. parse special admin skin */
+ elseif ( in_array(self::$action, self::$skinless_actions) )
+ {
+ /* TODO: need to be implemented or not?
+ self::action_parseSpecialskin();
+ */
+ }
+ else
+ {
+ self::error(_BADACTION . ENTITY::hsc($action));
+ return;
+ }
+
+ return;
+ }
+
+ /**
+ * Action::action_showlogin()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_showlogin()
+ {
+ global $error;
+ self::action_login($error);
+ return;
+ }
+
+ /**
+ * Action::action_login()
+ *
+ * @param string $msg message for pageheader
+ * @param integer $passvars ???
+ */
+ static private function action_login($msg = '', $passvars = 1)
+ {
+ global $member;
+
+ // skip to overview when allowed
+ if ( $member->isLoggedIn() && $member->canLogin() )
+ {
+ self::action_overview();
+ return;
+ }
+
+ /* TODO: needless variable??? */
+ self::$passvar = $passvars;
+ if ( $msg )
+ {
+ self::$headMess = $msg;
+ }
+
+ self::$skin->parse('showlogin');
+ }
+
+ /**
+ * Action::action_overview()
+ * provides a screen with the overview of the actions available
+ *
+ * @param string $msg message for pageheader
+ * @return void
+ */
+ static private function action_overview($msg = '')
+ {
+ if ( $msg )
+ {
+ self::$headMess = $msg;
+ }
+
+ self::$skin->parse('overview');
+ return;
+ }
+
+ /**
+ * Admin::action_manage()
+ *
+ * @param string $msg message for pageheader
+ * @retrn void
+ */
+ static private function action_manage($msg = '')
+ {
+ global $member;
+
+ if ( $msg )
+ {
+ self::$headMess = $msg;
+ }
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('manage');
+ return;
+ }
+
+ /**
+ * Action::action_itemlist()
+ *
+ * @param integer id for weblod
+ * @return void
+ */
+ static private function action_itemlist($blogid = '')
+ {
+ global $member, $manager, $CONF;
+
+ if ( $blogid == '' )
+ {
+ $blogid = intRequestVar('blogid');
+ }
+
+ $member->teamRights($blogid) or $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('itemlist');
+ return;
+ }
+
+ /**
+ * Action::action_batchitem()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_batchitem()
+ {
+ global $member, $manager;
+
+ $member->isLoggedIn() or self::disallow();
+
+ $selected = requestIntArray('batch');
+ $action = requestVar('batchaction');
+
+ if ( !is_array($selected) || sizeof($selected) == 0 )
+ {
+ self::error(_BATCH_NOSELECTION);
+ return;
+ }
+
+ // On move: when no destination blog/category chosen, show choice now
+ $destCatid = intRequestVar('destcatid');
+ if ( ($action == 'move') && (!$manager->existsCategory($destCatid)) )
+ {
+ self::batchMoveSelectDestination('item', $selected);
+ }
+
+ // On delete: check if confirmation has been given
+ if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )
+ {
+ self::batchAskDeleteConfirmation('item', $selected);
+ }
+
+ self::$skin->parse('batchitem');
+ return;
+ }
+
+ /**
+ * Action::action_batchcomment()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_batchcomment()
+ {
+ global $member;
+
+ $member->isLoggedIn() or self::disallow();
+
+ $selected = requestIntArray('batch');
+ $action = requestVar('batchaction');
+
+ // Show error when no items were selected
+ if ( !is_array($selected) || sizeof($selected) == 0 )
+ {
+ self::error(_BATCH_NOSELECTION);
+ return;
+ }
+
+ // On delete: check if confirmation has been given
+ if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )
+ {
+ self::batchAskDeleteConfirmation('comment', $selected);
+ }
+
+ self::$skin->parse('batchcomment');
+ return;
+ }
+
+ /**
+ * Admin::action_batchmember()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_batchmember()
+ {
+ global $member;
+
+ ($member->isLoggedIn() && $member->isAdmin()) or self::disallow();
+
+ $selected = requestIntArray('batch');
+ $action = requestVar('batchaction');
+
+ // Show error when no members selected
+ if ( !is_array($selected) || sizeof($selected) == 0 )
+ {
+ self::error(_BATCH_NOSELECTION);
+ return;
+ }
+
+ // On delete: check if confirmation has been given
+ if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )
+ {
+ self::batchAskDeleteConfirmation('member',$selected);
+ }
+
+ self::$skin->parse('batchmember');
+ return;
+ }
+
+ /**
+ * Admin::action_batchteam()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_batchteam()
+ {
+ global $member;
+
+ $blogid = intRequestVar('blogid');
+
+ ($member->isLoggedIn() && $member->blogAdminRights($blogid)) or self::disallow();
+
+ $selected = requestIntArray('batch');
+ $action = requestVar('batchaction');
+
+ if ( !is_array($selected) || sizeof($selected) == 0 )
+ {
+ self::error(_BATCH_NOSELECTION);
+ return;
+ }
+
+ // On delete: check if confirmation has been given
+ if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )
+ {
+ self::batchAskDeleteConfirmation('team',$selected);
+ }
+
+ self::$skin->parse('batchteam');
+ return;
+ }
+
+ /**
+ * Admin::action_batchcategory()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_batchcategory()
+ {
+ global $member, $manager;
+
+ $member->isLoggedIn() or self::disallow();
+
+ $selected = requestIntArray('batch');
+ $action = requestVar('batchaction');
+
+ if ( !is_array($selected) || sizeof($selected) == 0 )
+ {
+ self::error(_BATCH_NOSELECTION);
+ return;
+ }
+
+ // On move: when no destination blog chosen, show choice now
+ $destBlogId = intRequestVar('destblogid');
+ if ( ($action == 'move') && (!$manager->existsBlogID($destBlogId)) )
+ {
+ self::batchMoveCategorySelectDestination('category', $selected);
+ }
+
+ // On delete: check if confirmation has been given
+ if ( ($action == 'delete') && (requestVar('confirmation') != 'yes') )
+ {
+ self::batchAskDeleteConfirmation('category', $selected);
+ }
+
+ self::$skin->parse('batchcategory');
+ return;
+ }
+
+ /**
+ * Admin::batchMoveSelectDestination()
+ *
+ * @param string $type type of batch action
+ * @param integer $ids needless???
+ * @return void
+ *
+ * TODO: remove needless argument
+ */
+ static private function batchMoveSelectDestination($type, $ids)
+ {
+ $_POST['batchmove'] = $type;
+ self::$skin->parse('batchmove');
+ return;
+ }
+
+ /**
+ * Admin::batchMoveCategorySelectDestination()
+ *
+ * @param string $type type of batch action
+ * @param integer $ids needless???
+ * @return void
+ *
+ * TODO: remove needless argument
+ */
+ static private function batchMoveCategorySelectDestination($type, $ids)
+ {
+ $_POST['batchmove'] = $type;
+ global $manager;
+ self::$skin->parse('batchmovecat');
+ return;
+ }
+
+ /**
+ * Admin::batchAskDeleteConfirmation()
+ *
+ * @param string $type type of batch action
+ * @param integer $ids needless???
+ * @return void
+ *
+ * TODO: remove needless argument
+ */
+ static private function batchAskDeleteConfirmation($type, $ids)
+ {
+ self::$skin->parse('batchdelete');
+ return;
+ }
+
+ /**
+ * Admin::action_browseownitems()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_browseownitems()
+ {
+ global $member, $manager, $CONF;
+
+ self::$skin->parse('browseownitems');
+ return;
+ }
+
+ /**
+ * Admin::action_itemcommentlist()
+ * Show all the comments for a given item
+ *
+ * @param integer $itemid ID for item
+ * @return void
+ */
+ static private function action_itemcommentlist($itemid = '')
+ {
+ global $member, $manager, $CONF;
+
+ if ( $itemid == '' )
+ {
+ $itemid = intRequestVar('itemid');
+ }
+
+ // only allow if user is allowed to alter item
+ $member->canAlterItem($itemid) or self::disallow();
+
+ $item =& $manager->getItem($itemid, 1, 1);
+ $_REQUEST['itemid'] = $item['itemid'];
+ $_REQUEST['blogid'] = $item['blogid'];
+
+ self::$skin->parse('itemcommentlist');
+ return;
+ }
+
+ /**
+ * Admin::action_browseowncomments()
+ * Browse own comments
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_browseowncomments()
+ {
+ self::$skin->parse('browseowncomments');
+ return;
+ }
+
+ /**
+ * Admin::action_blogcommentlist()
+ * Browse all comments for a weblog
+ *
+ * @param integer $blogid ID for weblog
+ * @return void
+ */
+ static private function action_blogcommentlist($blogid = '')
+ {
+ global $member, $manager, $CONF;
+
+ if ( $blogid == '' )
+ {
+ $blogid = intRequestVar('blogid');
+ }
+ else
+ {
+ $blogid = intval($blogid);
+ }
+
+ $member->teamRights($blogid) or $member->isAdmin() or self::disallow();
+
+ /* TODO: we consider to use the other way insterad of this */
+ $_REQUEST['blogid'] = $blogid;
+
+ self::$skin->parse('blogcommentlist');
+ return;
+ }
+
+ /**
+ * Admin::action_createaccount()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_createaccount()
+ {
+ global $CONF;
+
+ if ( $CONF['AllowMemberCreate'] != 1 )
+ {
+ self::$skin->parse('createaccountdisable');
+ return;
+ }
+
+ $name = '';
+ $realname ='';
+ $email = '';
+ $url = '';
+
+ $contents = array(
+ 'name' => '',
+ 'realname' => '',
+ 'email' => '',
+ 'url' => ''
+ );
+
+ if ( array_key_exists('showform', $_POST) && $_POST['showform'] == 1 )
+ {
+ $action = new Action();
+ $message = $action->createAccount();
+ if ( $message === 1 )
+ {
+ self::$headMess = $message;
+ self::$skin->parse('createaccountsuccess');
+ return;
+ }
+
+ /* TODO: validation */
+ if ( array_key_exists('name', $_POST) )
+ {
+ $contents['name'] = $_POST['name'];
+ }
+ if ( array_key_exists('realname', $_POST) )
+ {
+ $contents['realname'] = $_POST['realname'];
+ }
+ if ( array_key_exists('email', $_POST) )
+ {
+ $contents['email'] = $_POST['email'];
+ }
+ if ( array_key_exists('url', $_POST) )
+ {
+ $contents['url'] = $_POST['url'];
+ }
+
+ self::$contents = $contents;
+
+ }
+
+ self::$skin->parse('createaccountinput');
+ return;
+ }
+
+ /**
+ * Admin::action_createitem()
+ * Provide a page to item a new item to the given blog
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_createitem()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+
+ // check if allowed
+ $member->teamRights($blogid) or self::disallow();
+
+ $blog =& $manager->getBlog($blogid);
+ $contents = array();
+
+ $data = array(
+ 'blog' => &$blog,
+ 'contents' => &$contents
+ );
+ $manager->notify('PreAddItemForm', $data);
+
+ if ( $blog->convertBreaks() )
+ {
+ if ( array_key_exists('body', $contents) && !empty($contents['body']) )
+ {
+ $contents['body'] = removeBreaks($contents['body']);
+ }
+ if ( array_key_exists('more', $contents) && !empty($contents['more']) )
+ {
+ $contents['more'] = removeBreaks($contents['more']);
+ }
+ }
+
+ self::$blog = &$blog;
+ self::$contents = &$contents;
+
+ self::$skin->parse('createitem');
+ return;
+ }
+
+ /**
+ * Admin::action_itemedit()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_itemedit()
+ {
+ global $member, $manager;
+
+ $itemid = intRequestVar('itemid');
+
+ // only allow if user is allowed to alter item
+ $member->canAlterItem($itemid) or self::disallow();
+
+ $item =& $manager->getItem($itemid, 1, 1);
+ $blog =& $manager->getBlog($item['blogid']);
+ $manager->notify('PrepareItemForEdit', array('blog'=> &$blog, 'item' => &$item));
+
+ if ( $blog->convertBreaks() )
+ {
+ if ( array_key_exists('body', $item) && !empty($item['body']) )
+ {
+ $item['body'] = removeBreaks($item['body']);
+ }
+ if ( array_key_exists('more', $item) && !empty($item['more']) )
+ {
+ $item['more'] = removeBreaks($item['more']);
+ }
+ }
+
+ self::$blog = &$blog;
+ self::$contents = &$item;
+
+ self::$skin->parse('itemedit');
+ return;
+ }
+
+ /**
+ * Admin::action_itemupdate()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_itemupdate()
+ {
+ global $member, $manager, $CONF;
+
+ $itemid = intRequestVar('itemid');
+ $catid = postVar('catid');
+
+ // only allow if user is allowed to alter item
+ $member->canUpdateItem($itemid, $catid) or self::disallow();
+
+ $actiontype = postVar('actiontype');
+
+ // delete actions are handled by itemdelete (which has confirmation)
+ if ( $actiontype == 'delete' )
+ {
+ self::action_itemdelete();
+ return;
+ }
+
+ $body = postVar('body');
+ $title = postVar('title');
+ $more = postVar('more');
+ $closed = intPostVar('closed');
+ $draftid = intPostVar('draftid');
+
+ // default action = add now
+ if ( !$actiontype )
+ {
+ $actiontype='addnow';
+ }
+
+ // create new category if needed
+ if ( i18n::strpos($catid,'newcat') === 0 )
+ {
+ // get blogid
+ list($blogid) = sscanf($catid,"newcat-%d");
+
+ // create
+ $blog =& $manager->getBlog($blogid);
+ $catid = $blog->createNewCategory();
+
+ // show error when sth goes wrong
+ if ( !$catid )
+ {
+ self::doError(_ERROR_CATCREATEFAIL);
+ }
+ }
+
+ /**
+ * set some variables based on actiontype
+ *
+ * actiontypes:
+ * draft items -> addnow, addfuture, adddraft, delete
+ * non-draft items -> edit, changedate, delete
+ *
+ * variables set:
+ * $timestamp: set to a nonzero value for future dates or date changes
+ * $wasdraft: set to 1 when the item used to be a draft item
+ * $publish: set to 1 when the edited item is not a draft
+ */
+ $blogid = getBlogIDFromItemID($itemid);
+ $blog =& $manager->getBlog($blogid);
+
+ $wasdrafts = array('adddraft', 'addfuture', 'addnow');
+ $wasdraft = in_array($actiontype, $wasdrafts) ? 1 : 0;
+ $publish = ($actiontype != 'adddraft' && $actiontype != 'backtodrafts') ? 1 : 0;
+ if ( $actiontype == 'addfuture' || $actiontype == 'changedate' )
+ {
+ $timestamp = mktime(intPostVar('hour'), intPostVar('minutes'), 0, intPostVar('month'), intPostVar('day'), intPostVar('year'));
+ }
+ else
+ {
+ $timestamp =0;
+ }
+
+ // edit the item for real
+ Item::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp);
+
+ self::updateFuturePosted($blogid);
+
+ if ( $draftid > 0 )
+ {
+ // delete permission is checked inside Item::delete()
+ Item::delete($draftid);
+ }
+
+ if ( $catid != intPostVar('catid') )
+ {
+ self::action_categoryedit(
+ $catid,
+ $blog->getID(),
+ $CONF['AdminURL'] . 'index.php?action=itemlist&blogid=' . getBlogIDFromItemID($itemid)
+ );
+ }
+ else
+ {
+ // TODO: set start item correctly for itemlist
+ $item =& $manager->getitem($itemid, 1, 1);
+ $query = "SELECT COUNT(*) FROM %s WHERE unix_timestamp(itime) <= '%s';";
+ $query = sprintf($query, sql_table('item'), $item['timestamp']);
+ $cnt = DB::getValue($query);
+ $_REQUEST['start'] = $cnt + 1;
+ self::action_itemlist(getBlogIDFromItemID($itemid));
+ }
+ return;
+ }
+
+ /**
+ * Admin::action_itemdelete()
+ * Delete item
+ *
+ * @param Void
+ * @return Void
+ */
+ static private function action_itemdelete()
+ {
+ global $member, $manager;
+
+ $itemid = intRequestVar('itemid');
+
+ // only allow if user is allowed to alter item
+ $member->canAlterItem($itemid) or self::disallow();
+
+ if ( !$manager->existsItem($itemid,1,1) )
+ {
+ self::error(_ERROR_NOSUCHITEM);
+ return;
+ }
+
+ self::$skin->parse('itemdelete');
+ return;
+ }
+
+ /**
+ * Admin::action_itemdeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_itemdeleteconfirm()
+ {
+ global $member, $manager;
+
+ $itemid = intRequestVar('itemid');
+
+ // only allow if user is allowed to alter item
+ $member->canAlterItem($itemid) or self::disallow();
+
+ // get item first
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ // delete item (note: some checks will be performed twice)
+ self::deleteOneItem($item['itemid']);
+
+ self::action_itemlist($item['blogid']);
+ return;
+ }
+
+ /**
+ * Admin::deleteOneItem()
+ * Deletes one item and returns error if something goes wrong
+ *
+ * @param integer $itemid ID for item
+ * @return void
+ */
+ static public function deleteOneItem($itemid)
+ {
+ global $member, $manager;
+
+ // only allow if user is allowed to alter item (also checks if itemid exists)
+ if ( !$member->canAlterItem($itemid) )
+ {
+ return _ERROR_DISALLOWED;
+ }
+
+ // need to get blogid before the item is deleted
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ $manager->loadClass('ITEM');
+ Item::delete($item['itemid']);
+
+ // update blog's futureposted
+ self::updateFuturePosted($item['itemid']);
+ return;
+ }
+
+ /**
+ * Admin::updateFuturePosted()
+ * Update a blog's future posted flag
+ *
+ * @param integer $blogid
+ * @return void
+ */
+ static private function updateFuturePosted($blogid)
+ {
+ global $manager;
+
+ $blogid = intval($blogid);
+ $blog =& $manager->getBlog($blogid);
+ $currenttime = $blog->getCorrectTime(time());
+
+ $query = "SELECT * FROM %s WHERE iblog=%d AND iposted=0 AND itime>'%s'";
+ $query = sprintf($query, sql_table('item'), (integer) $blogid, i18n::formatted_datetime('mysql', $currenttime));
+ $result = DB::getResult($query);
+
+ if ( $result->rowCount() > 0 )
+ {
+ $blog->setFuturePost();
+ }
+ else
+ {
+ $blog->clearFuturePost();
+ }
+ return;
+ }
+
+ /**
+ * Admin::action_itemmove()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_itemmove()
+ {
+ global $member, $manager;
+
+ $itemid = intRequestVar('itemid');
+
+ $member->canAlterItem($itemid) or self::disallow();
+
+ self::$skin->parse('itemmove');
+ return;
+ }
+
+ /**
+ * Admin::action_itemmoveto()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_itemmoveto()
+ {
+ global $member, $manager;
+
+ $itemid = intRequestVar('itemid');
+ $catid = requestVar('catid');
+
+ // create new category if needed
+ if ( i18n::strpos($catid,'newcat') === 0 )
+ {
+ // get blogid
+ list($blogid) = sscanf($catid,'newcat-%d');
+
+ // create
+ $blog =& $manager->getBlog($blogid);
+ $catid = $blog->createNewCategory();
+
+ // show error when sth goes wrong
+ if ( !$catid )
+ {
+ self::doError(_ERROR_CATCREATEFAIL);
+ }
+ }
+
+ // only allow if user is allowed to alter item
+ $member->canUpdateItem($itemid, $catid) or self::disallow();
+
+ $old_blogid = getBlogIDFromItemId($itemid);
+
+ Item::move($itemid, $catid);
+
+ // set the futurePosted flag on the blog
+ self::updateFuturePosted(getBlogIDFromItemId($itemid));
+
+ // reset the futurePosted in case the item is moved from one blog to another
+ self::updateFuturePosted($old_blogid);
+
+ if ( $catid != intRequestVar('catid') )
+ {
+ self::action_categoryedit($catid, $blog->getID());
+ }
+ else
+ {
+ self::action_itemlist(getBlogIDFromCatID($catid));
+ }
+ return;
+ }
+
+ /**
+ * Admin::moveOneItem()
+ * Moves one item to a given category (category existance should be checked by caller)
+ * errors are returned
+ *
+ * @param integer $itemid ID for item
+ * @param integer $destCatid ID for category to which the item will be moved
+ * @return void
+ */
+ static public function moveOneItem($itemid, $destCatid)
+ {
+ global $member;
+
+ // only allow if user is allowed to move item
+ if ( !$member->canUpdateItem($itemid, $destCatid) )
+ {
+ return _ERROR_DISALLOWED;
+ }
+
+ Item::move($itemid, $destCatid);
+ return;
+ }
+
+ /**
+ * Admin::action_additem()
+ * Adds a item to the chosen blog
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_additem()
+ {
+ global $manager, $CONF;
+
+ $manager->loadClass('ITEM');
+
+ $result = Item::createFromRequest();
+
+ if ( $result['status'] == 'error' )
+ {
+ self::error($result['message']);
+ return;
+ }
+
+ $item =& $manager->getItem($result['itemid'], 0, 0);
+
+ if ( $result['status'] == 'newcategory' )
+ {
+ $distURI = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=itemList&blogid=' . $item['blogid']);
+ self::action_categoryedit($result['catid'], $item['blogid'], $distURI);
+ }
+ else
+ {
+ $methodName = 'action_itemlist';
+ self::action_itemlist($item['blogid']);
+ }
+ return;
+ }
+
+ /**
+ * Admin::action_commentedit()
+ * Allows to edit previously made comments
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_commentedit()
+ {
+ global $member, $manager;
+
+ $commentid = intRequestVar('commentid');
+
+ $member->canAlterComment($commentid) or self::disallow();
+
+ $comment = COMMENT::getComment($commentid);
+ $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
+
+ self::$contents = $comment;
+ self::$skin->parse('commentedit');
+ return;
+ }
+
+ /**
+ * Admin::action_commentupdate()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_commentupdate()
+ {
+ global $member, $manager;
+
+ $commentid = intRequestVar('commentid');
+
+ $member->canAlterComment($commentid) or self::disallow();
+
+ $url = postVar('url');
+ $email = postVar('email');
+ $body = postVar('body');
+
+ // intercept words that are too long
+ if (preg_match('#[a-zA-Z0-9|\.,;:!\?=\/\\\\]{90,90}#', $body) != FALSE)
+ {
+ self::error(_ERROR_COMMENT_LONGWORD);
+ return;
+ }
+
+ // check length
+ if ( i18n::strlen($body) < 3 )
+ {
+ self::error(_ERROR_COMMENT_NOCOMMENT);
+ return;
+ }
+
+ if ( i18n::strlen($body) > 5000 )
+ {
+ self::error(_ERROR_COMMENT_TOOLONG);
+ return;
+ }
+
+ // prepare body
+ $body = Comment::prepareBody($body);
+
+ // call plugins
+ $data = array(
+ 'body' => &$body
+ );
+ $manager->notify('PreUpdateComment', $data);
+
+ $query = "UPDATE %s SET cmail=%s, cemail=%s, cbody=%s WHERE cnumber=%d;";
+ $query = sprintf($query, sql_table('comment'), DB::quoteValue($url), DB::quoteValue($email), DB::quoteValue($body), (integer) $commentid);
+ DB::execute($query);
+
+ // get itemid
+ $query = "SELECT citem FROM %s WHERE cnumber=%d;";
+ $query = sprintf($query, sql_table('comment'), (integer) $commentid);
+
+ $itemid = DB::getValue($query);
+
+ if ( $member->canAlterItem($itemid) )
+ {
+ self::action_itemcommentlist($itemid);
+ }
+ else
+ {
+ self::action_browseowncomments();
+ }
+ return;
+ }
+
+ /**
+ * Admin::action_commentdelete()
+ * Update comment
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_commentdelete()
+ {
+ global $member, $manager;
+
+ $commentid = intRequestVar('commentid');
+ $member->canAlterComment($commentid) or self::disallow();
+
+ self::$skin->parse('commentdelete');
+ return;
+ }
+
+ /**
+ * Admin::action_commentdeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_commentdeleteconfirm()
+ {
+ global $member;
+
+ $commentid = intRequestVar('commentid');
+
+ // get item id first
+ $query = "SELECT citem FROM %s WHERE cnumber=%d;";
+ $query = sprintf($query, sql_table('comment'), (integer) $commentid);
+
+ $itemid = DB::getValue($query);
+
+ $error = self::deleteOneComment($commentid);
+ if ( $error )
+ {
+ self::doError($error);
+ }
+
+ if ( $member->canAlterItem($itemid) )
+ {
+ self::action_itemcommentlist($itemid);
+ }
+ else
+ {
+ self::action_browseowncomments();
+ }
+ return;
+ }
+
+ /**
+ * Admin::deleteOneComment()
+ *
+ * @param integer $commentid ID for comment
+ * @return void
+ */
+ static public function deleteOneComment($commentid)
+ {
+ global $member, $manager;
+
+ $commentid = (integer) $commentid;
+
+ if ( !$member->canAlterComment($commentid) )
+ {
+ return _ERROR_DISALLOWED;
+ }
+
+ $data = array(
+ 'commentid' => $commentid
+ );
+
+ $manager->notify('PreDeleteComment', $data);
+
+ // delete the comments associated with the item
+ $query = "DELETE FROM %s WHERE cnumber=%d;";
+ $query = sprintf($query, sql_table('comment'), (integer) $commentid);
+ DB::execute($query);
+
+ $data = array(
+ 'commentid' => $commentid
+ );
+
+ $manager->notify('PostDeleteComment', $data);
+
+ return '';
+ }
+
+ /**
+ * Admin::action_usermanagement()
+ * Usermanagement main
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_usermanagement()
+ {
+ global $member, $manager;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('usermanagement');
+ return;
+ }
+
+ /**
+ * Admin::action_memberedit()
+ * Edit member settings
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_memberedit()
+ {
+ self::action_editmembersettings(intRequestVar('memberid'));
+ return;
+ }
+
+ /**
+ * Admin::action_editmembersettings()
+ *
+ * @param integer $memberid ID for member
+ * @return void
+ *
+ */
+ static private function action_editmembersettings($memberid = '')
+ {
+ global $member, $manager, $CONF;
+
+ if ( $memberid == '' )
+ {
+ $memberid = $member->getID();
+ }
+
+ /* TODO: we should consider to use the other way insterad of this */
+ $_REQUEST['memberid'] = $memberid;
+
+ // check if allowed
+ ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();
+
+ self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";
+
+ self::$skin->parse('editmembersettings');
+ return;
+ }
+
+ /**
+ * Admin::action_changemembersettings()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_changemembersettings()
+ {
+ global $member, $CONF, $manager;
+
+ $memberid = intRequestVar('memberid');
+
+ // check if allowed
+ ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();
+
+ $name = trim(strip_tags(postVar('name')));
+ $realname = trim(strip_tags(postVar('realname')));
+ $password = postVar('password');
+ $repeatpassword = postVar('repeatpassword');
+ $email = strip_tags(postVar('email'));
+ $url = strip_tags(postVar('url'));
+ $adminskin = intPostVar('adminskin');
+ $bookmarklet = intPostVar('bookmarklet');
+
+ // begin if: sometimes user didn't prefix the URL with http:// or https://, this cause a malformed URL. Let's fix it.
+ if ( !preg_match('#^https?://#', $url) )
+ {
+ $url = 'http://' . $url;
+ }
+
+ $admin = postVar('admin');
+ $canlogin = postVar('canlogin');
+ $notes = strip_tags(postVar('notes'));
+ $locale = postVar('locale');
+
+ $mem =& $manager->getMember($memberid);
+
+ if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
+ {
+ if ( !isValidDisplayName($name) )
+ {
+ self::error(_ERROR_BADNAME);
+ return;
+ }
+
+ if ( ($name != $mem->getDisplayName()) && Member::exists($name) )
+ {
+ self::error(_ERROR_NICKNAMEINUSE);
+ return;
+ }
+
+ if ( $password != $repeatpassword )
+ {
+ self::error(_ERROR_PASSWORDMISMATCH);
+ return;
+ }
+
+ if ( $password && (i18n::strlen($password) < 6) )
+ {
+ self::error(_ERROR_PASSWORDTOOSHORT);
+ return;
+ }
+
+ if ( $password )
+ {
+ $pwdvalid = true;
+ $pwderror = '';
+
+ $data = array(
+ 'password' => $password,
+ 'errormessage' => &$pwderror,
+ 'valid' => &$pwdvalid
+ );
+ $manager->notify('PrePasswordSet', $data);
+
+ if ( !$pwdvalid )
+ {
+ self::error($pwderror);
+ return;
+ }
+ }
+ }
+
+ if ( !NOTIFICATION::address_validation($email) )
+ {
+ self::error(_ERROR_BADMAILADDRESS);
+ return;
+ }
+ if ( !$realname )
+ {
+ self::error(_ERROR_REALNAMEMISSING);
+ return;
+ }
+ if ( ($locale != '') && (!in_array($locale, i18n::get_available_locale_list())) )
+ {
+ self::error(_ERROR_NOSUCHTRANSLATION);
+ return;
+ }
+
+ // check if there will remain at least one site member with both the logon and admin rights
+ // (check occurs when taking away one of these rights from such a member)
+ if ( (!$admin && $mem->isAdmin() && $mem->canLogin())
+ || (!$canlogin && $mem->isAdmin() && $mem->canLogin())
+ )
+ {
+ $r = DB::getResult('SELECT * FROM '.sql_table('member').' WHERE madmin=1 and mcanlogin=1');
+ if ( $r->rowCount() < 2 )
+ {
+ self::error(_ERROR_ATLEASTONEADMIN);
+ return;
+ }
+ }
+
+ if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
+ {
+ $mem->setDisplayName($name);
+ if ( $password )
+ {
+ $mem->setPassword($password);
+ }
+ }
+
+ $oldEmail = $mem->getEmail();
+
+ $mem->setRealName($realname);
+ $mem->setEmail($email);
+ $mem->setURL($url);
+ $mem->setNotes($notes);
+ $mem->setLocale($locale);
+ $mem->setAdminSkin($adminskin);
+ $mem->setBookmarklet($bookmarklet);
+
+ // only allow super-admins to make changes to the admin status
+ if ( $member->isAdmin() )
+ {
+ $mem->setAdmin($admin);
+ $mem->setCanLogin($canlogin);
+ }
+
+ $autosave = postVar('autosave');
+ $mem->setAutosave($autosave);
+
+ $mem->write();
+
+ // store plugin options
+ $aOptions = requestArray('plugoption');
+ NucleusPlugin::apply_plugin_options($aOptions);
+ $data = array(
+ 'context' => 'member',
+ 'memberid' => $memberid,
+ 'member' => &$mem
+ );
+ $manager->notify('PostPluginOptionsUpdate', $data);
+
+ // if email changed, generate new password
+ if ( $oldEmail != $mem->getEmail() )
+ {
+ $mem->sendActivationLink('addresschange', $oldEmail);
+ // logout member
+ $mem->newCookieKey();
+
+ // only log out if the member being edited is the current member.
+ if ( $member->getID() == $memberid )
+ {
+ $member->logout();
+ }
+ self::action_login(_MSG_ACTIVATION_SENT, 0);
+ return;
+ }
+
+ if ( ($mem->getID() == $member->getID())
+ && ($mem->getDisplayName() != $member->getDisplayName()) )
+ {
+ $mem->newCookieKey();
+ $member->logout();
+ self::action_login(_MSG_LOGINAGAIN, 0);
+ }
+ else
+ {
+ self::action_overview(_MSG_SETTINGSCHANGED);
+ }
+ return;
+ }
+
+ /**
+ * Admin::action_memberadd()
+ *
+ * @param void
+ * @return void
+ *
+ */
+ static private function action_memberadd()
+ {
+ global $member, $manager;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ if ( postVar('password') != postVar('repeatpassword') )
+ {
+ self::error(_ERROR_PASSWORDMISMATCH);
+ return;
+ }
+
+ if ( i18n::strlen(postVar('password')) < 6 )
+ {
+ self::error(_ERROR_PASSWORDTOOSHORT);
+ return;
+ }
+
+ $res = Member::create(
+ postVar('name'),
+ postVar('realname'),
+ postVar('password'),
+ postVar('email'),
+ postVar('url'),
+ postVar('admin'),
+ postVar('canlogin'),
+ postVar('notes')
+ );
+
+ if ( $res != 1 )
+ {
+ self::error($res);
+ return;
+ }
+
+ // fire PostRegister event
+ $newmem = new Member();
+ $newmem->readFromName(postVar('name'));
+ $data = array(
+ 'member' => &$newmem
+ );
+ $manager->notify('PostRegister', $data);
+
+ self::action_usermanagement();
+ return;
+ }
+
+ /**
+ * Admin::action_forgotpassword()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_forgotpassword()
+ {
+ self::$skin->parse('forgotpassword');
+ return;
+ }
+
+ /**
+ * Admin::action_activate()
+ * Account activation
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_activate()
+ {
+ $key = getVar('key');
+ self::showActivationPage($key);
+ return;
+ }
+
+ /**
+ * Admin::showActivationPage()
+ *
+ * @param void
+ * @return void
+ */
+ static private function showActivationPage($key, $message = '')
+ {
+ global $manager;
+
+ // clean up old activation keys
+ Member::cleanupActivationTable();
+
+ // get activation info
+ $info = Member::getActivationInfo($key);
+
+ if ( !$info )
+ {
+ self::error(_ERROR_ACTIVATE);
+ return;
+ }
+
+ $mem =& $manager->getMember($info->vmember);
+
+ if ( !$mem )
+ {
+ self::error(_ERROR_ACTIVATE);
+ return;
+ }
+
+ /* TODO: we should consider to use the other way insterad of this */
+ $_POST['ackey'] = $key;
+ $_POST['bNeedsPasswordChange'] = TRUE;
+
+ self::$headMess = $message;
+ self::$skin->parse('activate');
+ return;
+ }
+
+ /**
+ * Admin::action_activatesetpwd()
+ * Account activation - set password part
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_activatesetpwd()
+ {
+ global $manager;
+ $key = postVar('key');
+
+ // clean up old activation keys
+ Member::cleanupActivationTable();
+
+ // get activation info
+ $info = Member::getActivationInfo($key);
+
+ if ( !$info || ($info->type == 'addresschange') )
+ {
+ return self::showActivationPage($key, _ERROR_ACTIVATE);
+ }
+
+ $mem =& $manager->getMember($info->vmember);
+
+ if ( !$mem )
+ {
+ return self::showActivationPage($key, _ERROR_ACTIVATE);
+ }
+
+ $password = postVar('password');
+ $repeatpassword = postVar('repeatpassword');
+
+ if ( $password != $repeatpassword )
+ {
+ return self::showActivationPage($key, _ERROR_PASSWORDMISMATCH);
+ }
+
+ if ( $password && (i18n::strlen($password) < 6) )
+ {
+ return self::showActivationPage($key, _ERROR_PASSWORDTOOSHORT);
+ }
+
+ if ( $password )
+ {
+ $pwdvalid = true;
+ $pwderror = '';
+
+ $data = array(
+ 'password' => $password,
+ 'errormessage' => &$pwderror,
+ 'valid' => &$pwdvalid
+ );
+ $manager->notify('PrePasswordSet', $data);
+ if ( !$pwdvalid )
+ {
+ return self::showActivationPage($key,$pwderror);
+ }
+ }
+
+ $error = '';
+
+ $data = array(
+ 'type' => 'activation',
+ 'member' => $mem,
+ 'error' => &$error
+ );
+ $manager->notify('ValidateForm', $data);
+ if ( $error != '' )
+ {
+ return self::showActivationPage($key, $error);
+ }
+
+ // set password
+ $mem->setPassword($password);
+ $mem->write();
+
+ // do the activation
+ Member::activate($key);
+
+ self::$skin->parse('activatesetpwd');
+ return;
+ }
+
+ /**
+ * Admin::action_manageteam()
+ * Manage team
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_manageteam()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+
+ // check if allowed
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ self::$skin->parse('manageteam');
+ return;
+ }
+
+ /**
+ * Admin::action_teamaddmember()
+ * Add member to team
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_teamaddmember()
+ {
+ global $member, $manager;
+
+ $memberid = intPostVar('memberid');
+ $blogid = intPostVar('blogid');
+ $admin = intPostVar('admin');
+
+ // check if allowed
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $blog =& $manager->getBlog($blogid);
+ if ( !$blog->addTeamMember($memberid, $admin) )
+ {
+ self::error(_ERROR_ALREADYONTEAM);
+ return;
+ }
+
+ self::action_manageteam();
+ return;
+ }
+
+ /**
+ * Admin::action_teamdelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_teamdelete()
+ {
+ global $member, $manager;
+
+ $memberid = intRequestVar('memberid');
+ $blogid = intRequestVar('blogid');
+
+ // check if allowed
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $teammem =& $manager->getMember($memberid);
+ $blog =& $manager->getBlog($blogid);
+
+ self::$skin->parse('teamdelete');
+ return;
+ }
+
+ /**
+ * Admin::action_teamdeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_teamdeleteconfirm()
+ {
+ global $member;
+
+ $memberid = intRequestVar('memberid');
+ $blogid = intRequestVar('blogid');
+
+ $error = self::deleteOneTeamMember($blogid, $memberid);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+ self::action_manageteam();
+ return;
+ }
+
+ /**
+ * Admin::deleteOneTeamMember()
+ *
+ * @param void
+ * @return void
+ */
+ static public function deleteOneTeamMember($blogid, $memberid)
+ {
+ global $member, $manager;
+
+ $blogid = intval($blogid);
+ $memberid = intval($memberid);
+
+ // check if allowed
+ if ( !$member->blogAdminRights($blogid) )
+ {
+ return _ERROR_DISALLOWED;
+ }
+
+ // check if: - there remains at least one blog admin
+ // - (there remains at least one team member)
+ $tmem =& $manager->getMember($memberid);
+
+
+ $data = array(
+ 'member' => &$tmem,
+ 'blogid' => $blogid
+ );
+ $manager->notify('PreDeleteTeamMember', $data);
+
+ if ( $tmem->isBlogAdmin($blogid) )
+ {
+ /* TODO: why we did double check? */
+ // check if there are more blog members left and at least one admin
+ // (check for at least two admins before deletion)
+ $query = "SELECT * FROM %s WHERE tblog=%d and tadmin=1;";
+ $query = sprintf($query, sql_table('team'), (integer) $blogid);
+ $r = DB::getResult($query);
+ if ( $r->rowCount() < 2 )
+ {
+ return _ERROR_ATLEASTONEBLOGADMIN;
+ }
+ }
+
+ $query = "DELETE FROM %s WHERE tblog=%d AND tmember=%d;";
+ $query = sprintf($query, sql_table('team'), (integer) $blogid, (integer) $memberid);
+ DB::execute($query);
+
+ $data = array(
+ 'member' => &$tmem,
+ 'blogid' => $blogid
+ );
+ $manager->notify('PostDeleteTeamMember', $data);
+
+ return '';
+ }
+
+ /**
+ * Admin::action_teamchangeadmin()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_teamchangeadmin()
+ {
+ global $manager, $member;
+
+ $blogid = intRequestVar('blogid');
+ $memberid = intRequestVar('memberid');
+
+ // check if allowed
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $mem =& $manager->getMember($memberid);
+
+ // don't allow when there is only one admin at this moment
+ if ( $mem->isBlogAdmin($blogid) )
+ {
+ $query = "SELECT * FROM %s WHERE tblog=%d AND tadmin=1;";
+ $query = sprintf($query, sql_table('team'), (integer) $blogid);
+ $r = DB::getResult($query);
+ if ( $r->rowCount() == 1 )
+ {
+ self::error(_ERROR_ATLEASTONEBLOGADMIN);
+ return;
+ }
+ }
+
+ if ( $mem->isBlogAdmin($blogid) )
+ {
+ $newval = 0;
+ }
+ else
+ {
+ $newval = 1;
+ }
+
+ $query = "UPDATE %s SET tadmin=%d WHERE tblog=%d and tmember=%d;";
+ $query = sprintf($query, (integer) $blogid, (integer) $newval, (integer) $blogid, (integer) $memberid);
+ DB::execute($query);
+
+ // only show manageteam if member did not change its own admin privileges
+ if ( $member->isBlogAdmin($blogid) )
+ {
+ self::action_manageteam();
+ }
+ else
+ {
+ self::action_overview(_MSG_ADMINCHANGED);
+ }
+ return;
+ }
+
+ /**
+ * Admin::action_blogsettings()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_blogsettings()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+
+ // check if allowed
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $blog =& $manager->getBlog($blogid);
+
+ self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";
+
+ self::$skin->parse('blogsettings');
+ return;
+ }
+
+ /**
+ * Admin::action_categorynew()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_categorynew()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $cname = postVar('cname');
+ $cdesc = postVar('cdesc');
+
+ if ( !isValidCategoryName($cname) )
+ {
+ self::error(_ERROR_BADCATEGORYNAME);
+ return;
+ }
+
+ $query = "SELECT * FROM %s WHERE cname=%s AND cblog=%d;";
+ $query = sprintf($query, sql_table('category'), DB::quoteValue($cname), (integer) $blogid);
+ $res = DB::getResult($query);
+ if ( $res->rowCount() > 0 )
+ {
+ self::error(_ERROR_DUPCATEGORYNAME);
+ return;
+ }
+
+ $blog =& $manager->getBlog($blogid);
+ $newCatID = $blog->createNewCategory($cname, $cdesc);
+
+ self::action_blogsettings();
+ return;
+ }
+
+ /**
+ * Admin::action_categoryedit()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_categoryedit($catid = '', $blogid = '', $desturl = '')
+ {
+ global $member, $manager;
+
+ if ( $blogid == '' )
+ {
+ $blogid = intGetVar('blogid');
+ }
+ else
+ {
+ $blogid = intval($blogid);
+ }
+ if ( $catid == '' )
+ {
+ $catid = intGetVar('catid');
+ }
+ else
+ {
+ $catid = intval($catid);
+ }
+
+ /* TODO: we should consider to use the other way insterad of this */
+ $_REQUEST['blogid'] = $blogid;
+ $_REQUEST['catid'] = $catid;
+ $_REQUEST['desturl'] = $desturl;
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";
+
+ self::$skin->parse('categoryedit');
+ return;
+ }
+
+ /**
+ * Admin::action_categoryupdate()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_categoryupdate()
+ {
+ global $member, $manager;
+
+ $blogid = intPostVar('blogid');
+ $catid = intPostVar('catid');
+ $cname = postVar('cname');
+ $cdesc = postVar('cdesc');
+ $desturl = postVar('desturl');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ if ( !isValidCategoryName($cname) )
+ {
+ self::error(_ERROR_BADCATEGORYNAME);
+ return;
+ }
+
+ $query = "SELECT * FROM %s WHERE cname=%s AND cblog=%d AND not(catid=%d);";
+ $query = sprintf($query, sql_table('category'), DB::quoteValue($cname), (integer) $blogid, (integer) $catid);
+ $res = DB::getResult($query);
+ if ( $res->rowCount() > 0 )
+ {
+ self::error(_ERROR_DUPCATEGORYNAME);
+ return;
+ }
+
+ $query = "UPDATE %s SET cname=%s, cdesc=%s WHERE catid=%d;";
+ $query = sprintf($query, sql_table('category'), DB::quoteValue($cname), DB::quoteValue($cdesc), (integer) $catid);
+ DB::execute($query);
+
+ // store plugin options
+ $aOptions = requestArray('plugoption');
+ NucleusPlugin::apply_plugin_options($aOptions);
+ $data = array(
+ 'context' => 'category',
+ 'catid' => $catid
+ );
+ $manager->notify('PostPluginOptionsUpdate', $data);
+
+ if ( $desturl )
+ {
+ redirect($desturl);
+ return;
+ }
+
+ self::action_blogsettings();
+
+ return;
+ }
+
+ /**
+ * Admin::action_categorydelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_categorydelete()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+ $catid = intRequestVar('catid');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $blog =& $manager->getBlog($blogid);
+
+ // check if the category is valid
+ if ( !$blog->isValidCategory($catid) )
+ {
+ self::error(_ERROR_NOSUCHCATEGORY);
+ return;
+ }
+
+ // don't allow deletion of default category
+ if ( $blog->getDefaultCategory() == $catid )
+ {
+ self::error(_ERROR_DELETEDEFCATEGORY);
+ return;
+ }
+
+ // check if catid is the only category left for blogid
+ $query = "SELECT catid FROM %s WHERE cblog=%d;";
+ $query = sprintf($query, sql_table('category'), $blogid);
+ $res = DB::getResult($query);
+ if ( $res->rowCount() == 1 )
+ {
+ self::error(_ERROR_DELETELASTCATEGORY);
+ return;
+ }
+
+ self::$skin->parse('categorydelete');
+ return;
+ }
+
+ /**
+ * Admin::action_categorydeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_categorydeleteconfirm()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+ $catid = intRequestVar('catid');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $error = self::deleteOneCategory($catid);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ self::action_blogsettings();
+ return;
+ }
+
+ /**
+ * Admin::deleteOneCategory()
+ * Delete a category by its id
+ *
+ * @param String $catid category id for deleting
+ * @return Void
+ */
+ static public function deleteOneCategory($catid)
+ {
+ global $manager, $member;
+
+ $catid = intval($catid);
+ $blogid = getBlogIDFromCatID($catid);
+
+ if ( !$member->blogAdminRights($blogid) )
+ {
+ return ERROR_DISALLOWED;
+ }
+
+ // get blog
+ $blog =& $manager->getBlog($blogid);
+
+ // check if the category is valid
+ if ( !$blog || !$blog->isValidCategory($catid) )
+ {
+ return _ERROR_NOSUCHCATEGORY;
+ }
+
+ $destcatid = $blog->getDefaultCategory();
+
+ // don't allow deletion of default category
+ if ( $blog->getDefaultCategory() == $catid )
+ {
+ return _ERROR_DELETEDEFCATEGORY;
+ }
+
+ // check if catid is the only category left for blogid
+ $query = "SELECT catid FROM %s WHERE cblog=%d;";
+ $query = sprintf($query, sql_table('category'), (integer) $blogid);
+
+ $res = DB::getResult($query);
+ if ( $res->rowCount() == 1 )
+ {
+ return _ERROR_DELETELASTCATEGORY;
+ }
+
+ $data = array('catid' => $catid);
+ $manager->notify('PreDeleteCategory', $data);
+
+ // change category for all items to the default category
+ $query = "UPDATE %s SET icat=%d WHERE icat=%d;";
+ $query =sprintf($query, sql_table('item'), (integer) $destcatid, (integer) $catid);
+ DB::execute($query);
+
+ // delete all associated plugin options
+ NucleusPlugin::delete_option_values('category', (integer) $catid);
+
+ // delete category
+ $query = "DELETE FROM %s WHERE catid=%d;";
+ $query = sprintf($query, sql_table('category'), (integer) $catid);
+ DB::execute($query);
+
+ $data = array('catid' => $catid);
+ $manager->notify('PostDeleteCategory', $data);
+ return;
+ }
+
+ /**
+ * Admin::moveOneCategory()
+ * Delete a category by its id
+ *
+ * @param int $catid category id for move
+ * @param int $destblogid blog id for destination
+ * @return void
+ */
+ static public function moveOneCategory($catid, $destblogid)
+ {
+ global $manager, $member;
+ $catid = intval($catid);
+ $destblogid = intval($destblogid);
+ $blogid = getBlogIDFromCatID($catid);
+ // mover should have admin rights on both blogs
+ if (!$member->blogAdminRights($blogid)) {
+ return _ERROR_DISALLOWED;
+ }
+ if (!$member->blogAdminRights($destblogid)) {
+ return _ERROR_DISALLOWED;
+ }
+ // cannot move to self
+ if ($blogid == $destblogid) {
+ return _ERROR_MOVETOSELF;
+ }
+ // get blogs
+ $blog =& $manager->getBlog($blogid);
+ $destblog =& $manager->getBlog($destblogid);
+ // check if the category is valid
+ if (!$blog || !$blog->isValidCategory($catid)) {
+ return _ERROR_NOSUCHCATEGORY;
+ }
+ // don't allow default category to be moved
+ if ($blog->getDefaultCategory() == $catid) {
+ return _ERROR_MOVEDEFCATEGORY;
+ }
+ $manager->notify(
+ 'PreMoveCategory',
+ array(
+ 'catid' => &$catid,
+ 'sourceblog' => &$blog,
+ 'destblog' => &$destblog
+ )
+ );
+ // update comments table (cblog)
+ $query = 'SELECT '
+ . ' inumber '
+ . 'FROM '
+ . sql_table('item') . ' '
+ . 'WHERE '
+ . ' icat = %d';
+ $items = sql_query(sprintf($query, $catid));
+ while ($oItem = sql_fetch_object($items)) {
+ $query = 'UPDATE '
+ . sql_table('comment') . ' '
+ . 'SET '
+ . ' cblog = %d' . ' '
+ . 'WHERE '
+ . ' citem = %d';
+ sql_query(sprintf($query, $destblogid, $oItem->inumber));
+ }
+
+ // update items (iblog)
+ $query = 'UPDATE '
+ . sql_table('item') . ' '
+ . 'SET '
+ . ' iblog = %d '
+ . 'WHERE '
+ . ' icat = %d';
+ sql_query(sprintf($query, $destblogid, $catid));
+
+ // move category
+ $query = 'UPDATE '
+ . sql_table('category') . ' '
+ . 'SET '
+ . ' cblog = %d' . ' '
+ . 'WHERE '
+ . ' catid = %d';
+ sql_query(sprintf($query, $destblogid, $catid));
+ $manager->notify(
+ 'PostMoveCategory',
+ array(
+ 'catid' => &$catid,
+ 'sourceblog' => &$blog,
+ 'destblog' => $destblog
+ )
+ );
+ return;
+ }
+
+ /**
+ * Admin::action_blogsettingsupdate
+ * Updating blog settings
+ *
+ * @param Void
+ * @return Void
+ */
+ static private function action_blogsettingsupdate()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $blog =& $manager->getBlog($blogid);
+
+ $notify_address = trim(postVar('notify'));
+ $shortname = trim(postVar('shortname'));
+ $updatefile = trim(postVar('update'));
+
+ $notifyComment = intPostVar('notifyComment');
+ $notifyVote = intPostVar('notifyVote');
+ $notifyNewItem = intPostVar('notifyNewItem');
+
+ if ( $notifyComment == 0 )
+ {
+ $notifyComment = 1;
+ }
+ if ( $notifyVote == 0 )
+ {
+ $notifyVote = 1;
+ }
+ if ( $notifyNewItem == 0 )
+ {
+ $notifyNewItem = 1;
+ }
+ $notifyType = $notifyComment * $notifyVote * $notifyNewItem;
+
+ if ( $notify_address && !NOTIFICATION::address_validation($notify_address) )
+ {
+ self::error(_ERROR_BADNOTIFY);
+ return;
+ }
+
+ if ( !isValidShortName($shortname) )
+ {
+ self::error(_ERROR_BADSHORTBLOGNAME);
+ return;
+ }
+
+ if ( ($blog->getShortName() != $shortname) && $manager->existsBlog($shortname) )
+ {
+ self::error(_ERROR_DUPSHORTBLOGNAME);
+ return;
+ }
+ // check if update file is writable
+ if ( $updatefile && !is_writeable($updatefile) )
+ {
+ self::error(_ERROR_UPDATEFILE);
+ return;
+ }
+
+ $blog->setName(trim(postVar('name')));
+ $blog->setShortName($shortname);
+ $blog->setNotifyAddress($notify_address);
+ $blog->setNotifyType($notifyType);
+ $blog->setMaxComments(postVar('maxcomments'));
+ $blog->setCommentsEnabled(postVar('comments'));
+ $blog->setTimeOffset(postVar('timeoffset'));
+ $blog->setUpdateFile($updatefile);
+ $blog->setURL(trim(postVar('url')));
+ $blog->setDefaultSkin(intPostVar('defskin'));
+ $blog->setDescription(trim(postVar('desc')));
+ $blog->setPublic(postVar('public'));
+ $blog->setConvertBreaks(intPostVar('convertbreaks'));
+ $blog->setAllowPastPosting(intPostVar('allowpastposting'));
+ $blog->setDefaultCategory(intPostVar('defcat'));
+ $blog->setSearchable(intPostVar('searchable'));
+ $blog->setEmailRequired(intPostVar('reqemail'));
+ $blog->writeSettings();
+
+ // store plugin options
+ $aOptions = requestArray('plugoption');
+ NucleusPlugin::apply_plugin_options($aOptions);
+
+ $data = array(
+ 'context' => 'blog',
+ 'blogid' => $blogid,
+ 'blog' => &$blog
+ );
+ $manager->notify('PostPluginOptionsUpdate', $data);
+
+ self::action_overview(_MSG_SETTINGSCHANGED);
+ return;
+ }
+
+ /**
+ * Admin::action_deleteblog()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_deleteblog()
+ {
+ global $member, $CONF, $manager;
+
+ $blogid = intRequestVar('blogid');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ // check if blog is default blog
+ if ( $CONF['DefaultBlog'] == $blogid )
+ {
+ self::error(_ERROR_DELDEFBLOG);
+ return;
+ }
+
+ $blog =& $manager->getBlog($blogid);
+
+ self::$skin->parse('deleteblog');
+ return;
+ }
+
+ /**
+ * Admin::action_deleteblogconfirm()
+ * Delete Blog
+ *
+ * @param Void
+ * @return Void
+ */
+ static private function action_deleteblogconfirm()
+ {
+ global $member, $CONF, $manager;
+
+ $blogid = intRequestVar('blogid');
+
+ $data = array('blogid' => $blogid);
+ $manager->notify('PreDeleteBlog', $data);
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ // check if blog is default blog
+ if ( $CONF['DefaultBlog'] == $blogid )
+ {
+ self::error(_ERROR_DELDEFBLOG);
+ return;
+ }
+
+ // delete all comments
+ $query = 'DELETE FROM ' . sql_table('comment') . ' WHERE cblog='.$blogid;
+ DB::execute($query);
+
+ // delete all items
+ $query = 'DELETE FROM ' . sql_table('item') . ' WHERE iblog=' . $blogid;
+ DB::execute($query);
+
+ // delete all team members
+ $query = 'DELETE FROM ' . sql_table('team') . ' WHERE tblog=' . $blogid;
+ DB::execute($query);
+
+ // delete all bans
+ $query = 'DELETE FROM ' . sql_table('ban') . ' WHERE blogid=' . $blogid;
+ DB::execute($query);
+
+ // delete all categories
+ $query = 'DELETE FROM ' . sql_table('category') . ' WHERE cblog=' . $blogid;
+ DB::execute($query);
+
+ // delete all associated plugin options
+ NucleusPlugin::delete_option_values('blog', $blogid);
+
+ // delete the blog itself
+ $query = 'DELETE FROM ' . sql_table('blog') . ' WHERE bnumber=' . $blogid;
+ DB::execute($query);
+
+ $data = array('blogid' => $blogid);
+ $manager->notify('PostDeleteBlog', $data);
+
+ self::action_overview(_DELETED_BLOG);
+ return;
+ }
+
+ /**
+ * Admin::action_memberdelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_memberdelete()
+ {
+ global $member, $manager;
+
+ $memberid = intRequestVar('memberid');
+
+ ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();
+
+ $mem =& $manager->getMember($memberid);
+
+ self::$skin->parse('memberdelete');
+ return;
+ }
+
+ /**
+ * Admin::action_memberdeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_memberdeleteconfirm()
+ {
+ global $member;
+
+ $memberid = intRequestVar('memberid');
+
+ ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();
+
+ $error = self::deleteOneMember($memberid);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ if ( $member->isAdmin() )
+ {
+ self::action_usermanagement();
+ return;
+ }
+ else
+ {
+ self::action_overview(_DELETED_MEMBER);
+ return;
+ }
+ return;
+ }
+
+ /**
+ * Admin::deleteOneMember()
+ * Delete a member by id
+ *
+ * @static
+ * @params Integer $memberid member id
+ * @return String null string or error messages
+ */
+ static public function deleteOneMember($memberid)
+ {
+ global $manager;
+
+ $memberid = intval($memberid);
+ $mem =& $manager->getMember($memberid);
+
+ if ( !$mem->canBeDeleted() )
+ {
+ return _ERROR_DELETEMEMBER;
+ }
+
+ $data = array('member' => &$mem);
+ $manager->notify('PreDeleteMember', $data);
+
+ /* unlink comments from memberid */
+ if ( $memberid )
+ {
+ $query = "UPDATE %s SET cmember=0, cuser=%s WHERE cmember=%d;";
+ $query = sprintf($query, sql_table('comment'), DB::quoteValue($mem->getDisplayName()), $memberid);
+ DB::execute($query);
+ }
+
+ $query = 'DELETE FROM ' . sql_table('member') . ' WHERE mnumber=' . $memberid;
+ DB::execute($query);
+
+ $query = 'DELETE FROM ' . sql_table('team') . ' WHERE tmember=' . $memberid;
+ DB::execute($query);
+
+ $query = 'DELETE FROM ' . sql_table('activation') . ' WHERE vmember=' . $memberid;
+ DB::execute($query);
+
+ // delete all associated plugin options
+ NucleusPlugin::delete_option_values('member', $memberid);
+
+ $data = array('member' => &$mem);
+ $manager->notify('PostDeleteMember', $data);
+
+ return '';
+ }
+
+ /**
+ * Admin::action_createnewlog()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_createnewlog()
+ {
+ global $member, $CONF, $manager;
+
+ // Only Super-Admins can do this
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('createnewlog');
+ return;
+ }
+
+ /**
+ * Admin::action_addnewlog()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_addnewlog()
+ {
+ global $member, $manager, $CONF;
+
+ // Only Super-Admins can do this
+ $member->isAdmin() or self::disallow();
+
+ $bname = trim(postVar('name'));
+ $bshortname = trim(postVar('shortname'));
+ $btimeoffset = postVar('timeoffset');
+ $bdesc = trim(postVar('desc'));
+ $bdefskin = postVar('defskin');
+
+ if ( !isValidShortName($bshortname) )
+ {
+ self::error(_ERROR_BADSHORTBLOGNAME);
+ return;
+ }
+
+ if ( $manager->existsBlog($bshortname) )
+ {
+ self::error(_ERROR_DUPSHORTBLOGNAME);
+ return;
+ }
+
+ $data = array(
+ 'name' => &$bname,
+ 'shortname' => &$bshortname,
+ 'timeoffset' => &$btimeoffset,
+ 'description' => &$bdesc,
+ 'defaultskin' => &$bdefskin
+ );
+ $manager->notify('PreAddBlog', $data);
+
+ // add slashes for sql queries
+ $bname = DB::quoteValue($bname);
+ $bshortname = DB::quoteValue($bshortname);
+ $btimeoffset = DB::quoteValue($btimeoffset);
+ $bdesc = DB::quoteValue($bdesc);
+ $bdefskin = DB::quoteValue($bdefskin);
+
+ // create blog
+ $query = "INSERT INTO %s (bname, bshortname, bdesc, btimeoffset, bdefskin) VALUES (%s, %s, %s, %s, %s);";
+ $query = sprintf($query, sql_table('blog'), $bname, $bshortname, $bdesc, $btimeoffset, $bdefskin);
+ DB::execute($query);
+
+ $blogid = DB::getInsertId();
+ $blog =& $manager->getBlog($blogid);
+
+ // create new category
+ $catdefname = (!defined('_EBLOGDEFAULTCATEGORY_NAME') ? 'General' : _EBLOGDEFAULTCATEGORY_NAME);
+ $catdefdesc = (!defined('_EBLOGDEFAULTCATEGORY_DESC') ? 'Items that do not fit in other categories' : _EBLOGDEFAULTCATEGORY_DESC);
+
+ $query = 'INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, %s, %s)';
+ DB::execute(sprintf($query, sql_table('category'), (integer) $blogid, DB::quoteValue($catdefname), DB::quoteValue($catdefdesc)));
+ $catid = DB::getInsertId();
+
+ // set as default category
+ $blog->setDefaultCategory($catid);
+ $blog->writeSettings();
+
+ // create team member
+ $query = "INSERT INTO %s (tmember, tblog, tadmin) VALUES (%d, %d, 1);";
+ $query = sprintf($query, sql_table('team'), (integer) $member->getID(), (integer) $blogid);
+ DB::execute($query);
+
+ $itemdeftitle = (defined('_EBLOG_FIRSTITEM_TITLE') ? _EBLOG_FIRSTITEM_TITLE : 'First Item');
+ $itemdefbody = (defined('_EBLOG_FIRSTITEM_BODY') ? _EBLOG_FIRSTITEM_BODY : 'This is the first item in your weblog. Feel free to delete it.');
+
+ $blog->additem(
+ $blog->getDefaultCategory(),
+ $itemdeftitle,$itemdefbody,
+ '',
+ $blogid,
+ $member->getID(),
+ $blog->getCorrectTime(),
+ 0,
+ 0,
+ 0
+ );
+
+ $data = array('blog' => &$blog);
+ $manager->notify('PostAddBlog', $data);
+
+ $data = array(
+ 'blog' => &$blog,
+ 'name' => _EBLOGDEFAULTCATEGORY_NAME,
+ 'description' => _EBLOGDEFAULTCATEGORY_DESC,
+ 'catid' => $catid
+ );
+ $manager->notify('PostAddCategory', $data);
+
+ /* TODO: we should consider to use the other way insterad of this */
+ $_REQUEST['blogid'] = $blogid;
+ $_REQUEST['catid'] = $catid;
+ self::$skin->parse('addnewlog');
+ return;
+ }
+
+ /**
+ * Admin::action_addnewlog2()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_addnewlog2()
+ {
+ global $member, $manager;
+ $blogid = intRequestVar('blogid');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $burl = requestVar('url');
+
+ $blog =& $manager->getBlog($blogid);
+ $blog->setURL(trim($burl));
+ $blog->writeSettings();
+
+ self::action_overview(_MSG_NEWBLOG);
+ return;
+ }
+
+ /**
+ * Admin::action_skinieoverview()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinieoverview()
+ {
+ global $member, $DIR_LIBS, $manager;
+
+ $member->isAdmin() or self::disallow();
+
+ include_once($DIR_LIBS . 'skinie.php');
+
+ self::$skin->parse('skinieoverview');
+ return;
+ }
+
+ /**
+ * Admin::action_skinieimport()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinieimport()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinFileRaw = postVar('skinfile');
+ $mode = postVar('mode');
+
+ $error = self::skinieimport($mode, $skinFileRaw);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ self::$skin->parse('skinieimport');
+ return;
+ }
+
+ /**
+ * Admin::action_skiniedoimport()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skiniedoimport()
+ {
+ global $member, $DIR_LIBS, $DIR_SKINS;
+
+ $member->isAdmin() or self::disallow();
+
+ // load skinie class
+ include_once($DIR_LIBS . 'skinie.php');
+
+ $mode = postVar('mode');
+ $skinFileRaw = postVar('skinfile');
+ $allowOverwrite = intPostVar('overwrite');
+
+ $error = self::skiniedoimport($mode, $skinFileRaw, $allowOverwrite);
+ if ( $error )
+ {
+ self::error($msg);
+ return;
+ }
+
+ self::$skin->parse('skiniedoimport');
+ return;
+ }
+
+ /**
+ * Admin::action_skinieexport()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinieexport()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $aSkins = requestIntArray('skin');
+ $aTemplates = requestIntArray('template');
+ $info = postVar('info');
+
+ self::skinieexport($aSkins, $aTemplates, $info);
+
+ return;
+ }
+
+ /**
+ * Admin::action_templateoverview()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_templateoverview()
+ {
+ global $member, $manager;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('templateoverview');
+ return;
+ }
+
+ /**
+ * Admin::action_templateedit()
+ *
+ * @param string $msg message for pageheader
+ * @return void
+ */
+ static private function action_templateedit($msg = '')
+ {
+ global $member, $manager;
+ if ( $msg )
+ {
+ self::$headMess = $msg;
+ }
+
+ $templateid = intRequestVar('templateid');
+
+ $member->isAdmin() or self::disallow();
+
+ self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(javascript/templateEdit.js)%>\"></script>\n";
+ self::$extrahead .= "<script type=\"text/javascript\">setTemplateEditText('" . Entity::hsc(_EDITTEMPLATE_EMPTY) . "');</script>\n";
+
+ self::$skin->parse('templateedit');
+ return;
+ }
+
+ /**
+ * Admin::action_templateupdate()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_templateupdate()
+ {
+ global $member,$manager;
+
+ $templateid = intRequestVar('templateid');
+
+ $member->isAdmin() or self::disallow();
+
+ $name = postVar('tname');
+ $desc = postVar('tdesc');
+
+ if ( !isValidTemplateName($name) )
+ {
+ self::error(_ERROR_BADTEMPLATENAME);
+ return;
+ }
+
+ if ( (Template::getNameFromId($templateid) != $name) && Template::exists($name) )
+ {
+ self::error(_ERROR_DUPTEMPLATENAME);
+ return;
+ }
+
+ // 1. Remove all template parts
+ $query = "DELETE FROM %s WHERE tdesc=%d;";
+ $query = sprintf($query, sql_table('template'), (integer) $templateid);
+ DB::execute($query);
+
+ // 2. Update description
+ $query = "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d;";
+ $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $templateid);
+ DB::execute($query);
+
+ // 3. Add non-empty template parts
+ self::addToTemplate($templateid, 'ITEM_HEADER', postVar('ITEM_HEADER'));
+ self::addToTemplate($templateid, 'ITEM', postVar('ITEM'));
+ self::addToTemplate($templateid, 'ITEM_FOOTER', postVar('ITEM_FOOTER'));
+ self::addToTemplate($templateid, 'MORELINK', postVar('MORELINK'));
+ self::addToTemplate($templateid, 'EDITLINK', postVar('EDITLINK'));
+ self::addToTemplate($templateid, 'NEW', postVar('NEW'));
+ self::addToTemplate($templateid, 'COMMENTS_HEADER', postVar('COMMENTS_HEADER'));
+ self::addToTemplate($templateid, 'COMMENTS_BODY', postVar('COMMENTS_BODY'));
+ self::addToTemplate($templateid, 'COMMENTS_FOOTER', postVar('COMMENTS_FOOTER'));
+ self::addToTemplate($templateid, 'COMMENTS_CONTINUED', postVar('COMMENTS_CONTINUED'));
+ self::addToTemplate($templateid, 'COMMENTS_TOOMUCH', postVar('COMMENTS_TOOMUCH'));
+ self::addToTemplate($templateid, 'COMMENTS_AUTH', postVar('COMMENTS_AUTH'));
+ self::addToTemplate($templateid, 'COMMENTS_ONE', postVar('COMMENTS_ONE'));
+ self::addToTemplate($templateid, 'COMMENTS_MANY', postVar('COMMENTS_MANY'));
+ self::addToTemplate($templateid, 'COMMENTS_NONE', postVar('COMMENTS_NONE'));
+ self::addToTemplate($templateid, 'ARCHIVELIST_HEADER', postVar('ARCHIVELIST_HEADER'));
+ self::addToTemplate($templateid, 'ARCHIVELIST_LISTITEM', postVar('ARCHIVELIST_LISTITEM'));
+ self::addToTemplate($templateid, 'ARCHIVELIST_FOOTER', postVar('ARCHIVELIST_FOOTER'));
+ self::addToTemplate($templateid, 'BLOGLIST_HEADER', postVar('BLOGLIST_HEADER'));
+ self::addToTemplate($templateid, 'BLOGLIST_LISTITEM', postVar('BLOGLIST_LISTITEM'));
+ self::addToTemplate($templateid, 'BLOGLIST_FOOTER', postVar('BLOGLIST_FOOTER'));
+ self::addToTemplate($templateid, 'CATLIST_HEADER', postVar('CATLIST_HEADER'));
+ self::addToTemplate($templateid, 'CATLIST_LISTITEM', postVar('CATLIST_LISTITEM'));
+ self::addToTemplate($templateid, 'CATLIST_FOOTER', postVar('CATLIST_FOOTER'));
+ self::addToTemplate($templateid, 'DATE_HEADER', postVar('DATE_HEADER'));
+ self::addToTemplate($templateid, 'DATE_FOOTER', postVar('DATE_FOOTER'));
+ self::addToTemplate($templateid, 'FORMAT_DATE', postVar('FORMAT_DATE'));
+ self::addToTemplate($templateid, 'FORMAT_TIME', postVar('FORMAT_TIME'));
+ self::addToTemplate($templateid, 'LOCALE', postVar('LOCALE'));
+ self::addToTemplate($templateid, 'SEARCH_HIGHLIGHT', postVar('SEARCH_HIGHLIGHT'));
+ self::addToTemplate($templateid, 'SEARCH_NOTHINGFOUND', postVar('SEARCH_NOTHINGFOUND'));
+ self::addToTemplate($templateid, 'POPUP_CODE', postVar('POPUP_CODE'));
+ self::addToTemplate($templateid, 'MEDIA_CODE', postVar('MEDIA_CODE'));
+ self::addToTemplate($templateid, 'IMAGE_CODE', postVar('IMAGE_CODE'));
+
+ $data = array('fields' => array());
+ $manager->notify('TemplateExtraFields', $data);
+ foreach ( $data['fields'] as $pfkey=>$pfvalue )
+ {
+ foreach ( $pfvalue as $pffield => $pfdesc )
+ {
+ self::addToTemplate($templateid, $pffield, postVar($pffield));
+ }
+ }
+
+ // jump back to template edit
+ self::action_templateedit(_TEMPLATE_UPDATED);
+ return;
+ }
+
+ /**
+ * Admin::addToTemplate()
+ *
+ * @param Integer $id ID for template
+ * @param String $partname parts name
+ * @param String $content template contents
+ * @return Integer record index
+ *
+ */
+ static private function addToTemplate($id, $partname, $content)
+ {
+ // don't add empty parts:
+ if ( !trim($content) )
+ {
+ return -1;
+ }
+
+ $query = "INSERT INTO %s (tdesc, tpartname, tcontent) VALUES (%d, %s, %s);";
+ $query = sprintf($query, sql_table('template'), (integer) $id, DB::quoteValue($partname), DB::quoteValue($content));
+ if ( DB::execute($query) === FALSE )
+ {
+ $err = DB::getError();
+ exit(_ADMIN_SQLDIE_QUERYERROR . $err[2]);
+ }
+ return DB::getInsertId();
+ }
+
+ /**
+ * Admin::action_templatedelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_templatedelete()
+ {
+ global $member, $manager;
+
+ $member->isAdmin() or self::disallow();
+
+ $templateid = intRequestVar('templateid');
+ // TODO: check if template can be deleted
+
+ self::$skin->parse('templatedelete');
+ return;
+ }
+
+ /**
+ * Admin::action_templatedeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_templatedeleteconfirm()
+ {
+ global $member, $manager;
+
+ $templateid = intRequestVar('templateid');
+
+ $member->isAdmin() or self::disallow();
+
+ $data = array('templateid' => $templateid);
+ $manager->notify('PreDeleteTemplate', $data);
+
+ // 1. delete description
+ DB::execute('DELETE FROM ' . sql_table('template_desc') . ' WHERE tdnumber=' . $templateid);
+
+ // 2. delete parts
+ DB::execute('DELETE FROM ' . sql_table('template') . ' WHERE tdesc=' . $templateid);
+
+
+ $data = array('templateid' => $templateid);
+ $manager->notify('PostDeleteTemplate', $data);
+
+ self::action_templateoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_templatenew()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_templatenew()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $name = postVar('name');
+ $desc = postVar('desc');
+
+ if ( !isValidTemplateName($name) )
+ {
+ self::error(_ERROR_BADTEMPLATENAME);
+ return;
+ }
+
+ if ( Template::exists($name) )
+ {
+ self::error(_ERROR_DUPTEMPLATENAME);
+ return;
+ }
+
+ $newTemplateId = Template::createNew($name, $desc);
+
+ self::action_templateoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_templateclone()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_templateclone()
+ {
+ global $member;
+
+ $templateid = intRequestVar('templateid');
+
+ $member->isAdmin() or self::disallow();
+
+ // 1. read old template
+ $name = Template::getNameFromId($templateid);
+ $desc = Template::getDesc($templateid);
+
+ // 2. create desc thing
+ $name = "cloned" . $name;
+
+ // if a template with that name already exists:
+ if ( Template::exists($name) )
+ {
+ $i = 1;
+ while (Template::exists($name . $i))
+ {
+ $i++;
+ }
+ $name .= $i;
+ }
+
+ $newid = Template::createNew($name, $desc);
+
+ // 3. create clone
+ // go through parts of old template and add them to the new one
+ $query = "SELECT tpartname, tcontent FROM %s WHERE tdesc=%d;";
+ $query = sprintf($query, sql_table('template'), (integer) $templateid);
+
+ $res = DB::getResult($query);
+ foreach ( $res as $row)
+ {
+ self::addToTemplate($newid, $row['tpartname'], $row['tcontent']);
+ }
+
+ self::action_templateoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_admintemplateoverview()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_admintemplateoverview()
+ {
+ global $member;
+ $member->isAdmin() or self::disallow();
+ self::$skin->parse('admntemplateoverview');
+ return;
+ }
+
+ /**
+ * Admin::action_admintemplateedit()
+ *
+ * @param string $msg message for pageheader
+ * @return void
+ */
+ static private function action_admintemplateedit($msg = '')
+ {
+ global $member, $manager;
+ if ( $msg )
+ {
+ self::$headMess = $msg;
+ }
+ $member->isAdmin() or self::disallow();
+
+ self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(javascript/templateEdit.js)%>\"></script>\n";
+ self::$extrahead .= '<script type="text/javascript">setTemplateEditText("' . Entity::hsc(_EDITTEMPLATE_EMPTY) . '");</script>' . "\n";
+
+ self::$skin->parse('admintemplateedit');
+ return;
+ }
+
+ /**
+ * Admin::action_admintemplateupdate()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_admintemplateupdate()
+ {
+ global $member, $manager;
+ $templateid = intRequestVar('templateid');
+ $member->isAdmin() or self::disallow();
+ $name = postVar('tname');
+ $desc = postVar('tdesc');
+
+ if ( !isValidTemplateName($name) )
+ {
+ self::error(_ERROR_BADTEMPLATENAME);
+ return;
+ }
+
+ if ( (Template::getNameFromId($templateid) != $name) && Template::exists($name) )
+ {
+ self::error(_ERROR_DUPTEMPLATENAME);
+ return;
+ }
+
+ // 1. Remove all template parts
+ $query = "DELETE FROM %s WHERE tdesc=%d;";
+ $query = sprintf($query, sql_table('template'), (integer) $templateid);
+ DB::execute($query);
+
+ // 2. Update description
+ $query = "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d;";
+ $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $templateid);
+ DB::execute($query);
+
+ // 3. Add non-empty template parts
+ self::addToTemplate($templateid, 'NORMALSKINLIST_HEAD', postVar('NORMALSKINLIST_HEAD'));
+ self::addToTemplate($templateid, 'NORMALSKINLIST_BODY', postVar('NORMALSKINLIST_BODY'));
+ self::addToTemplate($templateid, 'NORMALSKINLIST_FOOT', postVar('NORMALSKINLIST_FOOT'));
+ self::addToTemplate($templateid, 'ADMIN_CUSTOMHELPLINK_ICON', postVar('ADMIN_CUSTOMHELPLINK_ICON'));
+ self::addToTemplate($templateid, 'ADMIN_CUSTOMHELPLINK_ANCHOR', postVar('ADMIN_CUSTOMHELPLINK_ANCHOR'));
+ self::addToTemplate($templateid, 'ADMIN_BLOGLINK', postVar('ADMIN_BLOGLINK'));
+ self::addToTemplate($templateid, 'ADMIN_BATCHLIST', postVar('ADMIN_BATCHLIST'));
+ self::addToTemplate($templateid, 'ACTIVATE_FORGOT_TITLE', postVar('ACTIVATE_FORGOT_TITLE'));
+ self::addToTemplate($templateid, 'ACTIVATE_FORGOT_TEXT', postVar('ACTIVATE_FORGOT_TEXT'));
+ self::addToTemplate($templateid, 'ACTIVATE_REGISTER_TITLE', postVar('ACTIVATE_REGISTER_TITLE'));
+ self::addToTemplate($templateid, 'ACTIVATE_REGISTER_TEXT', postVar('ACTIVATE_REGISTER_TEXT'));
+ self::addToTemplate($templateid, 'ACTIVATE_CHANGE_TITLE', postVar('ACTIVATE_CHANGE_TITLE'));
+ self::addToTemplate($templateid, 'ACTIVATE_CHANGE_TEXT', postVar('ACTIVATE_CHANGE_TEXT'));
+ self::addToTemplate($templateid, 'TEMPLATE_EDIT_EXPLUGNAME', postVar('TEMPLATE_EDIT_EXPLUGNAME'));
+ self::addToTemplate($templateid, 'TEMPLATE_EDIT_ROW_HEAD', postVar('TEMPLATE_EDIT_ROW_HEAD'));
+ self::addToTemplate($templateid, 'TEMPLATE_EDIT_ROW_TAIL', postVar('TEMPLATE_EDIT_ROW_TAIL'));
+ self::addToTemplate($templateid, 'SPECIALSKINLIST_HEAD', postVar('SPECIALSKINLIST_HEAD'));
+ self::addToTemplate($templateid, 'SPECIALSKINLIST_BODY', postVar('SPECIALSKINLIST_BODY'));
+ self::addToTemplate($templateid, 'SPECIALSKINLIST_FOOT', postVar('SPECIALSKINLIST_FOOT'));
+ self::addToTemplate($templateid, 'SYSTEMINFO_GDSETTINGS', postVar('SYSTEMINFO_GDSETTINGS'));
+ self::addToTemplate($templateid, 'BANLIST_DELETED_LIST', postVar('BANLIST_DELETED_LIST'));
+ self::addToTemplate($templateid, 'INSERT_PLUGOPTION_TITLE', postVar('INSERT_PLUGOPTION_TITLE'));
+ self::addToTemplate($templateid, 'INSERT_PLUGOPTION_BODY', postVar('INSERT_PLUGOPTION_BODY'));
+ self::addToTemplate($templateid, 'INPUTYESNO_TEMPLATE_ADMIN', postVar('INPUTYESNO_TEMPLATE_ADMIN'));
+ self::addToTemplate($templateid, 'INPUTYESNO_TEMPLATE_NORMAL', postVar('INPUTYESNO_TEMPLATE_NORMAL'));
+ self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_HEAD', postVar('ADMIN_SPECIALSKINLIST_HEAD'));
+ self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_BODY', postVar('ADMIN_SPECIALSKINLIST_BODY'));
+ self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_FOOT', postVar('ADMIN_SPECIALSKINLIST_FOOT'));
+ self::addToTemplate($templateid, 'SKINIE_EXPORT_LIST', postVar('SKINIE_EXPORT_LIST'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_HEAD', postVar('SHOWLIST_LISTPLUG_SELECT_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_BODY', postVar('SHOWLIST_LISTPLUG_SELECT_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_FOOT', postVar('SHOWLIST_LISTPLUG_SELECT_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', postVar('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', postVar('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'));
+ self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'));
+ self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_TITLE', postVar('PLUGIN_QUICKMENU_TITLE'));
+ self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_HEAD', postVar('PLUGIN_QUICKMENU_HEAD'));
+ self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_BODY', postVar('PLUGIN_QUICKMENU_BODY'));
+ self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_FOOT', postVar('PLUGIN_QUICKMENU_FOOT'));
+
+ $data = array('fields' => array());
+ $manager->notify('AdminTemplateExtraFields', $data);
+ foreach ( $data['fields'] as $pfkey => $pfvalue )
+ {
+ foreach ( $pfvalue as $pffield => $pfdesc )
+ {
+ self::addToTemplate($templateid, $pffield, postVar($pffield));
+ }
+ }
+
+ // jump back to template edit
+ self::action_admintemplateedit(_TEMPLATE_UPDATED);
+ return;
+ }
+
+ /**
+ * Admin::action_admintemplatedelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_admintemplatedelete()
+ {
+ global $member, $manager;
+ $member->isAdmin() or self::disallow();
+
+ // TODO: check if template can be deleted
+ self::$skin->parse('admintemplatedelete');
+ return;
+ }
+
+ /**
+ * Admin::action_admintemplatedeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_admintemplatedeleteconfirm()
+ {
+ global $member, $manager;
+
+ $templateid = intRequestVar('templateid');
+ $member->isAdmin() or self::disallow();
+
+ $data = array('templateid' => $templateid);
+ $manager->notify('PreDeleteAdminTemplate', $data);
+
+ // 1. delete description
+ $query = "DELETE FROM %s WHERE tdnumber=%s;";
+ $query = sprintf($query, sql_table('template_desc'), (integer) $templateid);
+ DB::execute($query);
+
+ // 2. delete parts
+ $query = "DELETE FROM %s WHERE tdesc=%d;";
+ $query = sprintf($query, sql_table('template'), (integer) $templateid);
+ DB::execute($query);
+
+ $data = array('templateid' => $templateid);
+ $manager->notify('PostDeleteAdminTemplate', $data);
+
+ self::action_admintemplateoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_admintemplatenew()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_admintemplatenew()
+ {
+ global $member;
+ $member->isAdmin() or self::disallow();
+ $name = postVar('name');
+ $desc = postVar('desc');
+
+ if ( !isValidTemplateName($name) )
+ {
+ self::error(_ERROR_BADTEMPLATENAME);
+ return;
+ }
+ else if ( !preg_match('#^admin/#', $name) )
+ {
+ self::error(_ERROR_BADADMINTEMPLATENAME);
+ return;
+ }
+ else if ( Template::exists($name) )
+ {
+ self::error(_ERROR_DUPTEMPLATENAME);
+ return;
+ }
+
+ $newTemplateId = Template::createNew($name, $desc);
+ self::action_admintemplateoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_admintemplateclone()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_admintemplateclone()
+ {
+ global $member;
+ $templateid = intRequestVar('templateid');
+ $member->isAdmin() or self::disallow();
+
+ // 1. read old template
+ $name = Template::getNameFromId($templateid);
+ $desc = Template::getDesc($templateid);
+
+ // 2. create desc thing
+ $name = $name . "cloned";
+
+ // if a template with that name already exists:
+ if ( Template::exists($name) )
+ {
+ $i = 1;
+ while ( Template::exists($name . $i) )
+ {
+ $i++;
+ }
+ $name .= $i;
+ }
+
+ $newid = Template::createNew($name, $desc);
+
+ // 3. create clone
+ // go through parts of old template and add them to the new one
+ $query = "SELECT tpartname, tcontent FROM %s WHERE tdesc=%d;";
+ $query = sprintf($query, sql_table('template'), (integer) $templateid);
+
+ $res = DB::getResult($query);
+ foreach ( $res as $row )
+ {
+ self::addToTemplate($newid, $row['tpartname'], $row['tcontent']);
+ }
+
+ self::action_admintemplateoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_skinoverview()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinoverview()
+ {
+ global $member, $manager;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('skinoverview');
+ return;
+ }
+
+ /**
+ * Admin::action_skinnew()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinnew()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $name = trim(postVar('name'));
+ $desc = trim(postVar('desc'));
+
+ if ( !isValidSkinName($name) )
+ {
+ self::error(_ERROR_BADSKINNAME);
+ return;
+ }
+ else if ( SKIN::exists($name) )
+ {
+ self::error(_ERROR_DUPSKINNAME);
+ return;
+ }
+
+ SKIN::createNew($name, $desc);
+
+ self::action_skinoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_skinedit()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinedit()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('skinedit');
+ return;
+ }
+
+ /**
+ * Admin::action_skineditgeneral()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skineditgeneral()
+ {
+ global $member;
+
+ $skinid = intRequestVar('skinid');
+
+ $member->isAdmin() or self::disallow();
+
+ $error = self::skineditgeneral($skinid);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ self::action_skinedit();
+ return;
+ }
+
+ static private function action_skinedittype($msg = '')
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ if ( $msg )
+ {
+ self::$headMess = $msg;
+ }
+
+ $type = requestVar('type');
+ $type = trim($type);
+ $type = strtolower($type);
+
+ if ( !isValidShortName($type) )
+ {
+ self::error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);
+ return;
+ }
+
+ self::$skin->parse('skinedittype');
+ return;
+ }
+
+ /**
+ * Admin::action_skinupdate()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinupdate()
+ {
+ global $manager, $member;
+
+ $skinid = intRequestVar('skinid');
+ $content = trim(postVar('content'));
+ $type = postVar('type');
+
+ $member->isAdmin() or self::disallow();
+
+ $skin =& $manager->getSKIN($skinid);
+ $skin->update($type, $content);
+
+ self::action_skinedittype(_SKIN_UPDATED);
+ return;
+ }
+
+ /**
+ * Admin::action_skindelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skindelete()
+ {
+ global $CONF, $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+
+ // don't allow default skin to be deleted
+ if ( $skinid == $CONF['BaseSkin'] )
+ {
+ self::error(_ERROR_DEFAULTSKIN);
+ return;
+ }
+
+ // don't allow deletion of default skins for blogs
+ $query = "SELECT bname FROM %s WHERE bdefskin=%d";
+ $query = sprintf($query, sql_table('blog'), (integer) $skinid);
+
+ $name = DB::getValue($query);
+ if ( $name )
+ {
+ self::error(_ERROR_SKINDEFDELETE . Entity::hsc($name));
+ return;
+ }
+
+ self::$skin->parse('skindelete');
+ return;
+ }
+
+ /**
+ * Admin::action_skindeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skindeleteconfirm()
+ {
+ global $member, $CONF;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+
+ // don't allow default skin to be deleted
+ if ( $skinid == $CONF['BaseSkin'] )
+ {
+ self::error(_ERROR_DEFAULTSKIN);
+ return;
+ }
+
+ // don't allow deletion of default skins for blogs
+ $query = "SELECT bname FROM %s WHERE bdefskin=%d;";
+ $query = sprintf($query, sql_table('blog'), (integer) $skinid);
+
+ $name = DB::getValue($query);
+ if ( $name )
+ {
+ self::error(_ERROR_SKINDEFDELETE . Entity::hsc($name));
+ return;
+ }
+
+ self::skindeleteconfirm($skinid);
+
+ self::action_skinoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_skinremovetype()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinremovetype()
+ {
+ global $member, $CONF;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+ $skintype = requestVar('type');
+
+ if ( !isValidShortName($skintype) )
+ {
+ self::error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
+ return;
+ }
+
+ self::$skin->parse('skinremovetype');
+ return;
+ }
+
+ /**
+ * Admin::action_skinremovetypeconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinremovetypeconfirm()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+ $skintype = requestVar('type');
+
+ $error = self::skinremovetypeconfirm($skinid, $skintype);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ self::action_skinedit();
+ return;
+ }
+
+ /**
+ * Admin::action_skinclone()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_skinclone()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+
+ self::skinclone($skinid);
+
+ self::action_skinoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinoverview()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinoverview()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('adminskinoverview');
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinnew()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinnew()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $name = trim(postVar('name'));
+ $desc = trim(postVar('desc'));
+
+ if ( !isValidSkinName($name) )
+ {
+ self::error(_ERROR_BADSKINNAME);
+ return;
+ }
+ else if ( !preg_match('#^admin/#', $name) )
+ {
+ self::error(_ERROR_BADADMINSKINNAME);
+ return;
+ }
+ else if ( Skin::exists($name) )
+ {
+ self::error(_ERROR_DUPSKINNAME);
+ return;
+ }
+
+ Skin::createNew($name, $desc);
+
+ self::action_adminskinoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinedit()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinedit()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('adminskinedit');
+
+ return;
+ }
+
+ /**
+ * Admin::action_adminskineditgeneral()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskineditgeneral()
+ {
+ global $member;
+
+ $skinid = intRequestVar('skinid');
+
+ $member->isAdmin() or self::disallow();
+
+ $error = self::skineditgeneral($skinid, 'AdminActions');
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ self::action_adminskinedit();
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinedittype()
+ *
+ * @param string $msg message for pageheader
+ * @return void
+ */
+ static private function action_adminskinedittype($msg = '')
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ if ( $msg )
+ {
+ self::$headMess = $msg;
+ }
+ $type = requestVar('type');
+ $type = trim($type);
+ $type = strtolower($type);
+
+ if ( !isValidShortName($type) )
+ {
+ self::error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);
+ return;
+ }
+
+ self::$skin->parse('adminskinedittype');
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinupdate()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinupdate()
+ {
+ global $manager, $member;
+
+ $skinid = intRequestVar('skinid');
+ $content = trim(postVar('content'));
+ $type = postVar('type');
+
+ $member->isAdmin() or self::disallow();
+
+ $skin =& $manager->getSkin($skinid, 'AdminActions', 'AdminSkin');
+ $skin->update($type, $content);
+
+ self::action_adminskinedittype(_SKIN_UPDATED);
+ return;
+ }
+
+ /**
+ * Admin::action_adminskindelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskindelete()
+ {
+ global $CONF, $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+
+ // don't allow default skin to be deleted
+ if ( $skinid == $CONF['AdminSkin'] || $skinid == $CONF['BookmarkletSkin'] )
+ {
+ self::error(_ERROR_DEFAULTSKIN);
+ return;
+ }
+
+ /* don't allow if someone use it as a default*/
+ $query = 'SELECT * FROM %s WHERE madminskin = %d or mbkmklt = %d;';
+ $res = DB::getResult(sprintf($query, sql_table('member'), $skinid, $skinid));
+
+ $members = array();
+ while ( $row = $res->fetch() ) {
+ $members[] = $row['mrealname'];
+ }
+ if ( count($members) )
+ {
+ self::error(_ERROR_SKINDEFDELETE . implode(' ' . _AND . ' ', $members));
+ return;
+ }
+
+ self::$skin->parse('adminskindelete');
+ return;
+ }
+
+ /**
+ * Admin::action_adminskindeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskindeleteconfirm()
+ {
+ global $member, $CONF;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+
+ // don't allow default skin to be deleted
+ if ( $skinid == $CONF['AdminSkin'] || $skinid == $CONF['BookmarkletSkin'] )
+ {
+ self::error(_ERROR_DEFAULTSKIN);
+ return;
+ }
+
+ /* don't allow if someone use it as a default*/
+ $query = 'SELECT * FROM %s WHERE madminskin = %d or mbkmklt = %d;';
+ $res = DB::getResult(sprintf($query, sql_table('member'), $skinid, $skinid));
+
+ $members = array();
+ while ( $row = $res->fetch() ) {
+ $members[] = $row['mrealname'];
+ }
+ if ( count($members) )
+ {
+ self::error(_ERROR_SKINDEFDELETE . implode(' ' . _AND . ' ', $members));
+ return;
+ }
+
+ self::skindeleteconfirm($skinid);
+
+ self::action_adminskinoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinremovetype()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinremovetype()
+ {
+ global $member, $CONF;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+ $skintype = requestVar('type');
+
+ if ( !isValidShortName($skintype) )
+ {
+ self::error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
+ return;
+ }
+
+ self::$skin->parse('adminskinremovetype');
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinremovetypeconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinremovetypeconfirm()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+ $skintype = requestVar('type');
+
+ $error = self::skinremovetypeconfirm($skinid, $skintype);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ self::action_adminskinedit();
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinclone()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinclone()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinid = intRequestVar('skinid');
+
+ self::skinclone($skinid, 'AdminActions');
+
+ self::action_adminskinoverview();
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinieoverview()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinieoverview()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('adminskinieoverview');
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinieimport()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinieimport()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $skinFileRaw = postVar('skinfile');
+ $mode = postVar('mode');
+
+ $error = self::skinieimport($mode, $skinFileRaw);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ if ( !is_object(self::$skin) )
+ {
+ self::action_adminskiniedoimport();
+ }
+ else
+ {
+ self::$skin->parse('adminskinieimport');
+ }
+ return;
+ }
+
+ /**
+ * Admin::action_adminskiniedoimport()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskiniedoimport()
+ {
+ global $DIR_SKINS, $member;
+
+ $member->isAdmin() or self::disallow();
+
+ $mode = postVar('mode');
+ $skinFileRaw = postVar('skinfile');
+ $allowOverwrite = intPostVar('overwrite');
+
+ $error = self::skiniedoimport($mode, $skinFileRaw, $allowOverwrite);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ if ( !is_object(self::$skin) )
+ {
+ global $DIR_SKINS;
+ $query = "SELECT min(sdnumber) FROM %s WHERE sdname != 'admin/bookmarklet' AND sdname LIKE 'admin/%%'";
+ $query = sprintf($query, sql_table('skin_desc'));
+ $res = intval(DB::getValue($query));
+ $query = "UPDATE %s SET value = %d WHERE name = 'AdminSkin'";
+ $query = sprintf($query, sql_table('config'), $res);
+ DB::execute($query);
+ $skin = new Skin(0, 'AdminActions', 'AdminSkin');
+ $skin->parse('importAdmin', $DIR_SKINS . 'admin/defaultimporter.skn');
+ }
+ else
+ {
+ self::$skin->parse('adminskiniedoimport');
+ }
+ return;
+ }
+
+ /**
+ * Admin::action_adminskinieexport()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_adminskinieexport()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ // load skinie class
+ $aSkins = requestIntArray('skin');
+ $aTemplates = requestIntArray('template');
+ $info = postVar('info');
+
+ self::skinieexport($aSkins, $aTemplates, $info);
+
+ return;
+ }
+
+ /**
+ * Admin::action_settingsedit()
+ *
+ * @param Void
+ * @return Void
+ */
+ static private function action_settingsedit()
+ {
+ global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('settingsedit');
+ return;
+ }
+
+ /**
+ * Admin::action_settingsupdate()
+ * Update $CONFIG and redirect
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_settingsupdate()
+ {
+ global $member, $CONF;
+
+ $member->isAdmin() or self::disallow();
+
+ // check if email address for admin is valid
+ if ( !NOTIFICATION::address_validation(postVar('AdminEmail')) )
+ {
+ self::error(_ERROR_BADMAILADDRESS);
+ return;
+ }
+
+ // save settings
+ self::updateConfig('DefaultBlog', postVar('DefaultBlog'));
+ self::updateConfig('BaseSkin', postVar('BaseSkin'));
+ self::updateConfig('IndexURL', postVar('IndexURL'));
+ self::updateConfig('AdminURL', postVar('AdminURL'));
+ self::updateConfig('PluginURL', postVar('PluginURL'));
+ self::updateConfig('SkinsURL', postVar('SkinsURL'));
+ self::updateConfig('ActionURL', postVar('ActionURL'));
+ self::updateConfig('Locale', postVar('Locale'));
+ self::updateConfig('AdminEmail', postVar('AdminEmail'));
+ self::updateConfig('SessionCookie', postVar('SessionCookie'));
+ self::updateConfig('AllowMemberCreate', postVar('AllowMemberCreate'));
+ self::updateConfig('AllowMemberMail', postVar('AllowMemberMail'));
+ self::updateConfig('NonmemberMail', postVar('NonmemberMail'));
+ self::updateConfig('ProtectMemNames', postVar('ProtectMemNames'));
+ self::updateConfig('SiteName', postVar('SiteName'));
+ self::updateConfig('NewMemberCanLogon', postVar('NewMemberCanLogon'));
+ self::updateConfig('DisableSite', postVar('DisableSite'));
+ self::updateConfig('DisableSiteURL', postVar('DisableSiteURL'));
+ self::updateConfig('LastVisit', postVar('LastVisit'));
+ self::updateConfig('MediaURL', postVar('MediaURL'));
+ self::updateConfig('AllowedTypes', postVar('AllowedTypes'));
+ self::updateConfig('AllowUpload', postVar('AllowUpload'));
+ self::updateConfig('MaxUploadSize', postVar('MaxUploadSize'));
+ self::updateConfig('MediaPrefix', postVar('MediaPrefix'));
+ self::updateConfig('AllowLoginEdit', postVar('AllowLoginEdit'));
+ self::updateConfig('DisableJsTools', postVar('DisableJsTools'));
+ self::updateConfig('CookieDomain', postVar('CookieDomain'));
+ self::updateConfig('CookiePath', postVar('CookiePath'));
+ self::updateConfig('CookieSecure', postVar('CookieSecure'));
+ self::updateConfig('URLMode', postVar('URLMode'));
+ self::updateConfig('CookiePrefix', postVar('CookiePrefix'));
+ self::updateConfig('DebugVars', postVar('DebugVars'));
+ self::updateConfig('DefaultListSize', postVar('DefaultListSize'));
+ self::updateConfig('AdminCSS', postVar('AdminCSS'));
+ self::updateConfig('AdminSkin', postVar('adminskin'));
+ self::updateConfig('BookmarkletSkin', postVar('bookmarklet'));
+
+ // load new config and redirect (this way, the new locale will be used is necessary)
+ // note that when changing cookie settings, this redirect might cause the user
+ // to have to log in again.
+ getConfig();
+ redirect($CONF['AdminURL'] . '?action=manage');
+ return;
+ }
+
+ /**
+ * Admin::action_systemoverview()
+ * Output system overview
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_systemoverview()
+ {
+ self::$skin->parse('systemoverview');
+ return;
+ }
+
+ /**
+ * Admin::updateConfig()
+ *
+ * @param string $name
+ * @param string $val
+ * @return integer return the ID in which the latest query posted
+ */
+ static private function updateConfig($name, $val)
+ {
+ $query = "UPDATE %s SET value=%s WHERE name=%s";
+ $query = sprintf($query, sql_table('config'), DB::quoteValue($val), DB::quoteValue($name));
+ if ( DB::execute($query) === FALSE )
+ {
+ $err = DB::getError();
+ die(_ADMIN_SQLDIE_QUERYERROR . $err[2]);
+ }
+ return DB::getInsertId();
+ }
+
+ /**
+ * Admin::error()
+ * Error message
+ *
+ * @param string $msg message that will be shown
+ * @return void
+ */
+ static public function error($msg)
+ {
+ self::$headMess = $msg;
+ self::$skin->parse('adminerrorpage');
+ return;
+ }
+
+ /**
+ * Admin::disallow()
+ * add error log and show error page
+ *
+ * @param void
+ * @return void
+ */
+ static public function disallow()
+ {
+ ActionLog::add(WARNING, _ACTIONLOG_DISALLOWED . serverVar('REQUEST_URI'));
+ self::error(_ERROR_DISALLOWED);
+ return;
+ }
+
+ /**
+ * Admin::action_PluginAdmin()
+ * Output pluginadmin
+ *
+ * @param string $skinContents
+ * @param string $extrahead
+ * @return void
+ */
+ static public function action_PluginAdmin($skinContents, $extrahead = '')
+ {
+ self::$extrahead .= $extrahead;
+ self::$skin->parse('pluginadmin', $skinContents);
+ return;
+ }
+
+ /**
+ * Admin::action_bookmarklet()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_bookmarklet()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+ $member->teamRights($blogid) or self::disallow();
+
+ self::$skin->parse('bookmarklet');
+ return;
+ }
+
+ /**
+ * Admin::action_actionlog()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_actionlog()
+ {
+ global $member, $manager;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('actionlog');
+ return;
+ }
+
+ /**
+ * Admin::action_banlist()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_banlist()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ self::$skin->parse('banlist');
+ return;
+ }
+
+ /**
+ * Admin::action_banlistdelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_banlistdelete()
+ {
+ global $member, $manager;
+
+ $blogid = intRequestVar('blogid');
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ self::$skin->parse('banlistdelete');
+ return;
+ }
+
+ /**
+ * Admin::action_banlistdeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_banlistdeleteconfirm()
+ {
+ global $member, $manager;
+
+ $blogid = intPostVar('blogid');
+ $allblogs = postVar('allblogs');
+ $iprange = postVar('iprange');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ $deleted = array();
+
+ if ( !$allblogs )
+ {
+ if ( Ban::removeBan($blogid, $iprange) )
+ {
+ $deleted[] = $blogid;
+ }
+ }
+ else
+ {
+ // get blogs fot which member has admin rights
+ $adminblogs = $member->getAdminBlogs();
+ foreach ($adminblogs as $blogje)
+ {
+ if ( Ban::removeBan($blogje, $iprange) )
+ {
+ $deleted[] = $blogje;
+ }
+ }
+ }
+
+ if ( sizeof($deleted) == 0 )
+ {
+ self::error(_ERROR_DELETEBAN);
+ return;
+ }
+
+ /* TODO: we should use other ways */
+ $_REQUEST['delblogs'] = $deleted;
+
+ self::$skin->parse('banlistdeleteconfirm');
+ return;
+ }
+
+ /**
+ * Admin::action_banlistnewfromitem()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_banlistnewfromitem()
+ {
+ global $manager;
+
+ $itemid = intRequestVar('itemid');
+ $item =& $manager->getItem($itemid, 1, 1);
+ self::action_banlistnew($item['blogid']);
+ return;
+ }
+
+ /**
+ * Admin::action_banlistnew()
+ *
+ * @param integer $blogid ID for weblog
+ * @return void
+ */
+ static private function action_banlistnew($blogid = '')
+ {
+ global $member, $manager;
+
+ if ( $blogid == '' )
+ {
+ $blogid = intRequestVar('blogid');
+ }
+
+ $ip = requestVar('ip');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ /* TODO: we should consider to use the other way instead of this */
+ $_REQUEST['blogid'] = $blogid;
+
+ self::$skin->parse('banlistnew');
+
+ return;
+ }
+
+ /**
+ * Admin::action_banlistadd()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_banlistadd()
+ {
+ global $member;
+
+ $blogid = intPostVar('blogid');
+ $allblogs = postVar('allblogs');
+ $iprange = postVar('iprange');
+
+ if ( $iprange == "custom" )
+ {
+ $iprange = postVar('customiprange');
+ }
+ $reason = postVar('reason');
+
+ $member->blogAdminRights($blogid) or self::disallow();
+
+ // TODO: check IP range validity
+
+ if ( !$allblogs )
+ {
+ if ( !Ban::addBan($blogid, $iprange, $reason) )
+ {
+ self::error(_ERROR_ADDBAN);
+ return;
+ }
+ }
+ else
+ {
+ // get blogs fot which member has admin rights
+ $adminblogs = $member->getAdminBlogs();
+ $failed = 0;
+ foreach ($adminblogs as $blogje)
+ {
+ if ( !Ban::addBan($blogje, $iprange, $reason) )
+ {
+ $failed = 1;
+ }
+ }
+ if ( $failed )
+ {
+ self::error(_ERROR_ADDBAN);
+ return;
+ }
+ }
+ self::action_banlist();
+ return;
+ }
+
+ /**
+ * Admin::action_clearactionlog()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_clearactionlog()
+ {
+ global $member;
+
+ $member->isAdmin() or self::disallow();
+
+ ActionLog::clear();
+
+ self::action_manage(_MSG_ACTIONLOGCLEARED);
+ return;
+ }
+
+ /**
+ * Admin::action_backupoverview()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_backupoverview()
+ {
+ global $member, $manager;
+
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('backupoverview');
+ return;
+ }
+
+ /**
+ * Admin::action_backupcreate()
+ * create file for backup
+ *
+ * @param void
+ * @return void
+ *
+ */
+ static private function action_backupcreate()
+ {
+ global $member, $DIR_LIBS;
+
+ $member->isAdmin() or self::disallow();
+
+ // use compression ?
+ $useGzip = (integer) postVar('gzip');
+
+ include($DIR_LIBS . 'backup.php');
+
+ // try to extend time limit
+ // (creating/restoring dumps might take a while)
+ @set_time_limit(1200);
+
+ Backup::do_backup($useGzip);
+ return;
+ }
+
+ /**
+ * Admin::action_backuprestore()
+ * restoring from uploaded file
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_backuprestore()
+ {
+ global $member, $DIR_LIBS;
+
+ $member->isAdmin() or self::disallow();
+
+ if ( intPostVar('letsgo') != 1 )
+ {
+ self::error(_ERROR_BACKUP_NOTSURE);
+ return;
+ }
+
+ include($DIR_LIBS . 'backup.php');
+
+ // try to extend time limit
+ // (creating/restoring dumps might take a while)
+ @set_time_limit(1200);
+
+ $message = Backup::do_restore();
+ if ( $message != '' )
+ {
+ self::error($message);
+ return;
+ }
+ self::$skin->parse('backuprestore');
+ return;
+ }
+
+ /**
+ * Admin::action_pluginlist()
+ * output the list of installed plugins
+ *
+ * @param void
+ * @return void
+ *
+ */
+ static private function action_pluginlist()
+ {
+ global $DIR_PLUGINS, $member, $manager;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ self::$skin->parse('pluginlist');
+ return;
+ }
+
+ /**
+ * Admin::action_pluginhelp()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_pluginhelp()
+ {
+ global $member, $manager, $DIR_PLUGINS, $CONF;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ $plugid = intGetVar('plugid');
+
+ if ( !$manager->pidInstalled($plugid) )
+ {
+ self::error(_ERROR_NOSUCHPLUGIN);
+ return;
+ }
+
+ self::$skin->parse('pluginhelp');
+ return;
+ }
+
+ /**
+ * Admin::action_pluginadd()
+ *
+ * @param Void
+ * @return Void
+ *
+ */
+ static private function action_pluginadd()
+ {
+ global $member, $manager, $DIR_PLUGINS;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ $name = postVar('filename');
+
+ if ( $manager->pluginInstalled($name) )
+ {
+ self::error(_ERROR_DUPPLUGIN);
+ return;
+ }
+
+ if ( !checkPlugin($name) )
+ {
+ self::error(_ERROR_PLUGFILEERROR . ' (' . Entity::hsc($name) . ')');
+ return;
+ }
+
+ // get number of currently installed plugins
+ $res = DB::getResult('SELECT * FROM ' . sql_table('plugin'));
+ $numCurrent = $res->rowCount();
+
+ // plugin will be added as last one in the list
+ $newOrder = $numCurrent + 1;
+
+ $data = array('file' => &$name);
+ $manager->notify('PreAddPlugin', $data);
+
+ // do this before calling getPlugin (in case the plugin id is used there)
+ $query = "INSERT INTO %s (porder, pfile) VALUES (%d, %s);";
+ $query = sprintf($query, sql_table('plugin'), (integer) $newOrder, DB::quoteValue($name));
+ DB::execute($query);
+ $iPid = DB::getInsertId();
+
+ $manager->clearCachedInfo('installedPlugins');
+
+ // Load the plugin for condition checking and instalation
+ $plugin =& $manager->getPlugin($name);
+
+ // check if it got loaded (could have failed)
+ if ( !$plugin )
+ {
+ $query = "DELETE FROM %s WHERE pid=%d;";
+ $query = sprintf($query, sql_table('plugin'), (integer) $iPid);
+
+ DB::execute($query);
+
+ $manager->clearCachedInfo('installedPlugins');
+ self::error(_ERROR_PLUGIN_LOAD);
+ return;
+ }
+
+ // check if plugin needs a newer Nucleus version
+ if ( getNucleusVersion() < $plugin->getMinNucleusVersion() )
+ {
+ // uninstall plugin again...
+ self::deleteOnePlugin($plugin->getID());
+
+ // ...and show error
+ self::error(_ERROR_NUCLEUSVERSIONREQ . Entity::hsc($plugin->getMinNucleusVersion()));
+ return;
+ }
+
+ // check if plugin needs a newer Nucleus version
+ if ( (getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()) )
+ {
+ // uninstall plugin again...
+ self::deleteOnePlugin($plugin->getID());
+
+ // ...and show error
+ self::error(_ERROR_NUCLEUSVERSIONREQ . Entity::hsc( $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel() ) );
+ return;
+ }
+
+ $pluginList = $plugin->getPluginDep();
+ foreach ( $pluginList as $pluginName )
+ {
+ $res = DB::getResult('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile=' . DB::quoteValue($pluginName));
+ if ($res->rowCount() == 0)
+ {
+ // uninstall plugin again...
+ self::deleteOnePlugin($plugin->getID());
+ self::error(sprintf(_ERROR_INSREQPLUGIN, Entity::hsc($pluginName)));
+ return;
+ }
+ }
+
+ // call the install method of the plugin
+ $plugin->install();
+
+ $data = array('plugin' => &$plugin);
+ $manager->notify('PostAddPlugin', $data);
+
+ // update all events
+ self::action_pluginupdate();
+ return;
+ }
+
+ /**
+ * ADMIN:action_pluginupdate():
+ *
+ * @param Void
+ * @return Void
+ *
+ */
+ static private function action_pluginupdate()
+ {
+ global $member, $manager, $CONF;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ // delete everything from plugin_events
+ DB::execute('DELETE FROM '.sql_table('plugin_event'));
+
+ // loop over all installed plugins
+ $res = DB::getResult('SELECT pid, pfile FROM '.sql_table('plugin'));
+ foreach ( $res as $row )
+ {
+ $pid = $row['pid'];
+ $plug =& $manager->getPlugin($row['pfile']);
+ if ( $plug )
+ {
+ $eventList = $plug->getEventList();
+ foreach ( $eventList as $eventName )
+ {
+ $query = "INSERT INTO %s (pid, event) VALUES (%d, %s)";
+ $query = sprintf($query, sql_table('plugin_event'), (integer) $pid, DB::quoteValue($eventName));
+ DB::execute($query);
+ }
+ }
+ }
+ redirect($CONF['AdminURL'] . '?action=pluginlist');
+ return;
+ }
+
+ /**
+ * Admin::action_plugindelete()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_plugindelete()
+ {
+ global $member, $manager;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ $pid = intGetVar('plugid');
+
+ if ( !$manager->pidInstalled($pid) )
+ {
+ self::error(_ERROR_NOSUCHPLUGIN);
+ return;
+ }
+
+ self::$skin->parse('plugindelete');
+ return;
+ }
+
+ /**
+ * Admin::action_plugindeleteconfirm()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_plugindeleteconfirm()
+ {
+ global $member, $manager, $CONF;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ $pid = intPostVar('plugid');
+
+ $error = self::deleteOnePlugin($pid, 1);
+ if ( $error )
+ {
+ self::error($error);
+ return;
+ }
+
+ redirect($CONF['AdminURL'] . '?action=pluginlist');
+ return;
+ }
+
+ /**
+ * Admin::deleteOnePlugin()
+ *
+ * @param integer $pid
+ * @param boolean $callUninstall
+ * @return string empty or message if failed
+ */
+ static public function deleteOnePlugin($pid, $callUninstall = 0)
+ {
+ global $manager;
+
+ $pid = intval($pid);
+
+ if ( !$manager->pidInstalled($pid) )
+ {
+ return _ERROR_NOSUCHPLUGIN;
+ }
+
+ $query = "SELECT pfile as result FROM %s WHERE pid=%d;";
+ $query = sprintf($query, sql_table('plugin'), (integer) $pid);
+ $name = DB::getValue($query);
+
+ // check dependency before delete
+ $res = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
+ foreach ( $res as $row )
+ {
+ $plug =& $manager->getPlugin($row['pfile']);
+ if ( $plug )
+ {
+ $depList = $plug->getPluginDep();
+ foreach ( $depList as $depName )
+ {
+ if ( $name == $depName )
+ {
+ return sprintf(_ERROR_DELREQPLUGIN, $row['pfile']);
+ }
+ }
+ }
+ }
+
+ $data = array('plugid' => $pid);
+ $manager->notify('PreDeletePlugin', $data);
+
+ // call the unInstall method of the plugin
+ if ( $callUninstall )
+ {
+ $plugin =& $manager->getPlugin($name);
+ if ( $plugin )
+ {
+ $plugin->unInstall();
+ }
+ }
+
+ // delete all subscriptions
+ DB::execute('DELETE FROM ' . sql_table('plugin_event') . ' WHERE pid=' . $pid);
+
+ // delete all options
+ // get OIDs from plugin_option_desc
+ $res = DB::getResult('SELECT oid FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
+ $aOIDs = array();
+ foreach ( $res as $row )
+ {
+ array_push($aOIDs, $row['oid']);
+ }
+
+ // delete from plugin_option and plugin_option_desc
+ DB::execute('DELETE FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
+ if (count($aOIDs) > 0)
+ {
+ DB::execute('DELETE FROM ' . sql_table('plugin_option') . ' WHERE oid in (' . implode(',', $aOIDs) . ')');
+ }
+
+ // update order numbers
+ $res = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $pid);
+ DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=(porder - 1) WHERE porder>' . $res);
+
+ // delete row
+ DB::execute('DELETE FROM ' . sql_table('plugin') . ' WHERE pid=' . $pid);
+
+ $manager->clearCachedInfo('installedPlugins');
+ $data = array('plugid' => $pid);
+ $manager->notify('PostDeletePlugin', $data);
+
+ return '';
+ }
+
+ /**
+ * Admin::action_pluginup()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_pluginup()
+ {
+ global $member, $manager, $CONF;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ $plugid = intGetVar('plugid');
+
+ if ( !$manager->pidInstalled($plugid) )
+ {
+ self::error(_ERROR_NOSUCHPLUGIN);
+ return;
+ }
+
+ // 1. get old order number
+ $oldOrder = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $plugid);
+
+ // 2. calculate new order number
+ $newOrder = ($oldOrder > 1) ? ($oldOrder - 1) : 1;
+
+ // 3. update plug numbers
+ DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $oldOrder . ' WHERE porder=' . $newOrder);
+ DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $newOrder . ' WHERE pid=' . $plugid);
+
+ //self::action_pluginlist();
+ // To avoid showing ticket in the URL, redirect to pluginlist, instead.
+ redirect($CONF['AdminURL'] . '?action=pluginlist');
+ return;
+ }
+
+ /**
+ * Admin::action_plugindown()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_plugindown()
+ {
+ global $member, $manager, $CONF;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ $plugid = intGetVar('plugid');
+ if ( !$manager->pidInstalled($plugid) )
+ {
+ self::error(_ERROR_NOSUCHPLUGIN);
+ return;
+ }
+
+ // 1. get old order number
+ $oldOrder = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $plugid);
+
+ $res = DB::getResult('SELECT * FROM ' . sql_table('plugin'));
+ $maxOrder = $res->rowCount();
+
+ // 2. calculate new order number
+ $newOrder = ($oldOrder < $maxOrder) ? ($oldOrder + 1) : $maxOrder;
+
+ // 3. update plug numbers
+ DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $oldOrder . ' WHERE porder=' . $newOrder);
+ DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $newOrder . ' WHERE pid=' . $plugid);
+
+ //self::action_pluginlist();
+ // To avoid showing ticket in the URL, redirect to pluginlist, instead.
+ redirect($CONF['AdminURL'] . '?action=pluginlist');
+ return;
+ }
+
+ /**
+ * Admin::action_pluginoptions()
+ *
+ * Output Plugin option page
+ *
+ * @access public
+ * @param string $message message when fallbacked
+ * @return void
+ *
+ */
+ static private function action_pluginoptions($message = '')
+ {
+ global $member, $manager;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ $pid = intRequestVar('plugid');
+ if ( !$manager->pidInstalled($pid) )
+ {
+ self::error(_ERROR_NOSUCHPLUGIN);
+ return;
+ }
+
+ if ( isset($message) )
+ {
+ self::$headMess = $message;
+ }
+ $plugname = $manager->getPluginNameFromPid($pid);
+ $plugin = $manager->getPlugin($plugname);
+ self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";
+
+ self::$skin->parse('pluginoptions');
+ return;
+ }
+
+ /**
+ * Admin::action_pluginoptionsupdate()
+ *
+ * Update plugin options and fallback to plugin option page
+ *
+ * @access public
+ * @param void
+ * @return void
+ */
+ static private function action_pluginoptionsupdate()
+ {
+ global $member, $manager;
+
+ // check if allowed
+ $member->isAdmin() or self::disallow();
+
+ $pid = intRequestVar('plugid');
+
+ if ( !$manager->pidInstalled($pid) )
+ {
+ self::error(_ERROR_NOSUCHPLUGIN);
+ return;
+ }
+
+ $aOptions = requestArray('plugoption');
+ NucleusPlugin::apply_plugin_options($aOptions);
+
+ $data = array(
+ 'context' => 'global',
+ 'plugid' => $pid
+ );
+ $manager->notify('PostPluginOptionsUpdate', $data);
+
+ self::action_pluginoptions(_PLUGS_OPTIONS_UPDATED);
+ return;
+ }
+
+ /**
+ * Admin::skineditgeneral()
+ *
+ * @param integer $skinid
+ * @param string $handler
+ * @return string empty or message if failed
+ */
+ static private function skineditgeneral($skinid, $handler='')
+ {
+ global $manager;
+
+ $name = postVar('name');
+ $desc = postVar('desc');
+ $type = postVar('type');
+ $inc_mode = postVar('inc_mode');
+ $inc_prefix = postVar('inc_prefix');
+
+ $skin =& $manager->getSkin($skinid, $handler);
+
+ // 1. Some checks
+ if ( !isValidSkinName($name) )
+ {
+ return _ERROR_BADSKINNAME;
+ }
+
+ if ( ($skin->getName() != $name) && SKIN::exists($name) )
+ {
+ return _ERROR_DUPSKINNAME;
+ }
+
+ if ( !$type )
+ {
+ $type = 'text/html';
+ }
+
+ if ( !$inc_mode )
+ {
+ $inc_mode = 'normal';
+ }
+
+ // 2. Update description
+ $skin->updateGeneralInfo($name, $desc, $type, $inc_mode, $inc_prefix);
+
+ return '';
+ }
+ /**
+ * Admin::skindeleteconfirm()
+ *
+ * @param integer $skinid
+ * @return void
+ */
+ static private function skindeleteconfirm($skinid)
+ {
+ global $manager;
+
+ if ( !in_array(self::$action, self::$adminskin_actions) )
+ {
+ $event_identifier = 'Skin';
+ }
+ else
+ {
+ $event_identifier = 'AdminSkin';
+ }
+
+ $manager->notify("PreDelete{$event_identifier}", array('skinid' => $skinid));
+
+ // 1. delete description
+ $query = "DELETE FROM %s WHERE sdnumber=%d;";
+ $query = sprintf($query, sql_table('skin_desc'), (integer) $skinid);
+ DB::execute($query);
+
+ // 2. delete parts
+ $query = "DELETE FROM %s WHERE sdesc=%d;";
+ $query = sprintf($query, sql_table('skin'), (integer) $skinid);
+ DB::execute($query);
+
+ $manager->notify("PostDelete{$event_identifier}", array('skinid' => $skinid));
+
+ return;
+ }
+
+ /**
+ * Admin::skinremovetypeconfirm()
+ *
+ * @param integer $skinid
+ * @param string $skintype
+ * @return string empty or message if failed
+ */
+ static private function skinremovetypeconfirm($skinid, $skintype)
+ {
+ global $manager;
+
+ if ( !in_array(self::$action, self::$adminskin_actions) )
+ {
+ $event_identifier = 'Skin';
+ }
+ else
+ {
+ $event_identifier = 'AdminSkin';
+ }
+
+ if ( !isValidShortName($skintype) )
+ {
+ return _ERROR_SKIN_PARTS_SPECIAL_DELETE;
+ }
+
+ $data = array(
+ 'skinid' => $skinid,
+ 'skintype' => $skintype
+ );
+ $manager->notify("PreDelete{$event_identifier}Part", $data);
+
+ // delete part
+ $query = 'DELETE FROM %s WHERE sdesc = %d AND stype = %s;';
+ $query = sprintf($query, sql_table('skin'), (integer) $skinid, DB::quoteValue($skintype) );
+ DB::execute($query);
+
+ $data = array(
+ 'skinid' => $skinid,
+ 'skintype' => $skintype
+ );
+ $manager->notify("PostDelete{$event_identifier}Part", $data);
+
+ return '';
+ }
+
+ /**
+ * Admin::skinclone()
+ *
+ * @param integer $skinid
+ * @param string $handler
+ * @return void
+ */
+ static private function skinclone($skinid, $handler='')
+ {
+ global $manager;
+
+ // 1. read skin to clone
+ $skin =& $manager->getSkin($skinid, $handler);
+ $name = "{$skin->getName()}_clone";
+
+ // if a skin with that name already exists:
+ if ( Skin::exists($name) )
+ {
+ $i = 1;
+ while ( Skin::exists($name . $i) )
+ {
+ $i++;
+ }
+ $name .= $i;
+ }
+
+ // 2. create skin desc
+ $newid = Skin::createNew(
+ $name,
+ $skin->getDescription(),
+ $skin->getContentType(),
+ $skin->getIncludeMode(),
+ $skin->getIncludePrefix()
+ );
+
+ // 3. clone
+ $query = "SELECT stype FROM %s WHERE sdesc=%d;";
+ $query = sprintf($query, sql_table('skin'), (integer) $skinid);
+
+ $res = DB::getResult($query);
+ foreach ( $res as $row )
+ {
+ $content = $skin->getContentFromDB($row['stype']);
+ if ( $content )
+ {
+ $query = "INSERT INTO %s (sdesc, scontent, stype) VALUES (%d, %s, %s)";
+ $query = sprintf($query, sql_table('skin'), (integer) $newid, DB::quoteValue($content), DB::quoteValue($row['stype']));
+ DB::execute($query);
+ }
+ }
+ return;
+ }
+
+ /**
+ * Admin::skinieimport()
+ *
+ * @param string $mode
+ * @param string $skinFileRaw
+ * @return string empty or message if failed
+ */
+ static private function skinieimport($mode, $skinFileRaw)
+ {
+ global $DIR_LIBS, $DIR_SKINS;
+
+ // load skinie class
+ include_once($DIR_LIBS . 'skinie.php');
+
+ $importer = new SkinImport();
+
+ // get full filename
+ if ( $mode == 'file' )
+ {
+ $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
+ }
+ else
+ {
+ $skinFile = $skinFileRaw;
+ }
+
+ // read only metadata
+ $error = $importer->readFile($skinFile, 1);
+ if ( $error )
+ {
+ unset($importer);
+ return $error;
+ }
+
+ self::$contents['mode'] = $mode;
+ self::$contents['skinfile'] = $skinFileRaw;
+ self::$contents['skininfo'] = $importer->getInfo();
+ self::$contents['skinnames'] = $importer->getSkinNames();
+ self::$contents['tpltnames'] = $importer->getTemplateNames();
+
+ // clashes
+ $skinNameClashes = $importer->checkSkinNameClashes();
+ $templateNameClashes = $importer->checkTemplateNameClashes();
+ $hasNameClashes = (count($skinNameClashes) > 0) || (count($templateNameClashes) > 0);
+
+ self::$contents['skinclashes'] = $skinNameClashes;
+ self::$contents['tpltclashes'] = $templateNameClashes;
+ self::$contents['nameclashes'] = $hasNameClashes ? 1 : 0;
+
+ unset($importer);
+ return '';
+ }
+
+ /**
+ * Admin::skinieedoimport()
+ *
+ * @param string $mode
+ * @param string $skinFileRaw
+ * @param boolean $allowOverwrite
+ * @return string empty or message if failed
+ */
+ static private function skiniedoimport($mode, $skinFileRaw, $allowOverwrite)
+ {
+ global $DIR_LIBS, $DIR_SKINS;
+
+ // load skinie class
+ include_once($DIR_LIBS . 'skinie.php');
+
+ $importer = new SkinImport();
+
+ // get full filename
+ if ( $mode == 'file' )
+ {
+ $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
+ }
+ else
+ {
+ $skinFile = $skinFileRaw;
+ }
+
+ $error = $importer->readFile($skinFile);
+ if ( $error )
+ {
+ unset($importer);
+ return $error;
+ }
+
+ $error = $importer->writeToDatabase($allowOverwrite);
+ if ( $error )
+ {
+ unset($importer);
+ return $error;
+ }
+
+ self::$contents['mode'] = $mode;
+ self::$contents['skinfile'] = $skinFileRaw;
+ self::$contents['skininfo'] = $importer->getInfo();
+ self::$contents['skinnames'] = $importer->getSkinNames();
+ self::$contents['tpltnames'] = $importer->getTemplateNames();
+
+ unset($importer);
+ return '';
+ }
+
+ /**
+ * Admin::skinieexport()
+ *
+ * @param array $aSkins
+ * @param array $aTemplates
+ * @param string $info
+ * @return void
+ */
+ static private function skinieexport($aSkins, $aTemplates, $info)
+ {
+ global $DIR_LIBS;
+
+ // load skinie class
+ include_once($DIR_LIBS . 'skinie.php');
+
+ if ( !is_array($aSkins) )
+ {
+ $aSkins = array();
+ }
+
+ if (!is_array($aTemplates))
+ {
+ $aTemplates = array();
+ }
+
+ $skinList = array_keys($aSkins);
+ $templateList = array_keys($aTemplates);
+
+ $exporter = new SkinExport();
+ foreach ( $skinList as $skinId )
+ {
+ $exporter->addSkin($skinId);
+ }
+ foreach ( $templateList as $templateId )
+ {
+ $exporter->addTemplate($templateId);
+ }
+ $exporter->setInfo($info);
+ $exporter->export();
+
+ return;
+ }
+
+ /**
+ * Admin::action_parseSpecialskin()
+ *
+ * @param void
+ * @return void
+ */
+ static private function action_parseSpecialskin()
+ {
+ self::$skin->parse(self::$action);
+ return;
+ }
+}
'contents',
'pluginextras',
'eventformextra',
- );\r
+ );
break;
case 'createaccountsuccess':
- $extra_actions = array(\r
+ $extra_actions = array(
'contents',
- );\r
+ );
break;
case 'createaccountdisable':
$extra_actions = array(
/* nothing special */
- );\r
+ );
break;
case 'createitem':
$extra_actions = array(
/* default option */
if ( $this->skintype == 'editmembersettings' )
{
- if ( !$member->getLocale() )\r
- {\r
- echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";\r
- }\r
- else\r
- {\r
- echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";\r
- }\r
+ if ( !$member->getLocale() )
+ {
+ echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
+ }
+ else
+ {
+ echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
+ }
}
else
{
- if ( $CONF['Locale'] == 'en_Latn_US' )\r
- {\r
- echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";\r
- }\r
- else\r
- {\r
- echo "<option value=\"\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";\r
- }\r
+ if ( $CONF['Locale'] == 'en_Latn_US' )
+ {
+ echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";
+ }
+ else
+ {
+ echo "<option value=\"\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";
+ }
}
/* optional options */
foreach ( $locales as $locale )
{
- if ( $this->skintype == 'editmembersettings' )\r
+ if ( $this->skintype == 'editmembersettings' )
{
- if ( $locale != $member->getLocale() )\r
- {\r
- echo "<option value=\"{$locale}\">";\r
- }\r
- else\r
- {\r
- echo "<option value=\"{$locale}\" selected=\"selected\">";\r
+ if ( $locale != $member->getLocale() )
+ {
+ echo "<option value=\"{$locale}\">";
+ }
+ else
+ {
+ echo "<option value=\"{$locale}\" selected=\"selected\">";
}
}
else
/* already output */
continue;
}
- else if ( $locale != $CONF['Locale'] )\r
- {\r
- echo "<option value=\"{$locale}\">";\r
- }\r
- else\r
- {\r
- echo "<option value=\"{$locale}\" selected=\"selected\">";\r
- }\r
+ else if ( $locale != $CONF['Locale'] )
+ {
+ echo "<option value=\"{$locale}\">";
+ }
+ else
+ {
+ echo "<option value=\"{$locale}\" selected=\"selected\">";
+ }
}
$label = '_LOCALE_' . strtoupper($locale);
if ( !defined($label) )
{
echo constant($label);
}
- echo "</option>\n";\r
+ echo "</option>\n";
}
return;
}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * PHP class responsible for ban-management.\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: BAN.php 1525 2011-06-21 10:20:19Z sakamocchi $\r
- */\r
-\r
-class Ban\r
-{\r
- /**\r
- * Checks if a given IP is banned from commenting/voting\r
- *\r
- * Returns 0 when not banned, or a BanInfo object containing the\r
- * message and other information of the ban\r
- */\r
- public function isBanned($blogid, $ip)\r
- {\r
- $blogid = intval($blogid);\r
- $query = sprintf('SELECT * FROM %s WHERE blogid=%d', sql_table('ban'), intval($blogid));\r
- $res = DB::getResult($query);\r
- foreach ( $res as $row )\r
- {\r
- $found = i18n::strpos ($ip, $row['iprange']);\r
- if ( $found !== false )\r
- {\r
- // found a match!\r
- return new BanInfo($row['iprange'], $row['reason']);\r
- }\r
- }\r
- return 0;\r
- }\r
-\r
- /**\r
- * Ban::addBan()\r
- * Adds a new ban to the banlist. Returns 1 on success, 0 on error\r
- * \r
- * @param Integer $blogid ID for weblog\r
- * @param String $iprange IP range\r
- * @param String $reason reason for banning\r
- * @return Boolean\r
- * \r
- */\r
- public function addBan($blogid, $iprange, $reason)\r
- {\r
- global $manager;\r
- \r
- $manager->notify(\r
- 'PreAddBan',\r
- array(\r
- 'blogid' => $blogid,\r
- 'iprange' => &$iprange,\r
- 'reason' => &$reason\r
- )\r
- );\r
- \r
- $query = 'INSERT INTO %s (blogid, iprange, reason) VALUES (%d, %s, %s)';\r
- $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange), DB::quoteValue($reason));\r
- $res = DB::execute($query);\r
- \r
- $manager->notify(\r
- 'PostAddBan',\r
- array(\r
- 'blogid' => $blogid,\r
- 'iprange' => $iprange,\r
- 'reason' => $reason\r
- )\r
- );\r
- \r
- return $res !== FALSE ? 1 : 0;\r
- }\r
- \r
- /**\r
- * Removes a ban from the banlist (correct iprange is needed as argument)\r
- * Returns 1 on success, 0 on error\r
- */\r
- public function removeBan($blogid, $iprange)\r
- {\r
- global $manager;\r
- \r
- $manager->notify(\r
- 'PreDeleteBan',\r
- array(\r
- 'blogid' => $blogid,\r
- 'range' => $iprange\r
- )\r
- );\r
- \r
- $query = 'DELETE FROM %s WHERE blogid=%d and iprange=%s';\r
- $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange));\r
- $res = DB::execute($query);\r
- \r
- $manager->notify(\r
- 'PostDeleteBan',\r
- array(\r
- 'blogid' => $blogid,\r
- 'range' => $iprange\r
- )\r
- );\r
- \r
- return $res !== FALSE ? 1 : 0;\r
- }\r
-}\r
-\r
-class BanInfo\r
-{\r
- public $iprange;\r
- public $message;\r
- \r
- public function __construct($iprange, $message)\r
- {\r
- $this->iprange = $iprange;\r
- $this->message = $message;\r
- return;\r
- }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * PHP class responsible for ban-management.
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: BAN.php 1812 2012-05-01 14:59:07Z sakamocchi $
+ */
+
+class Ban
+{
+ /**
+ * Checks if a given IP is banned from commenting/voting
+ *
+ * Returns 0 when not banned, or a BanInfo object containing the
+ * message and other information of the ban
+ */
+ public function isBanned($blogid, $ip)
+ {
+ $blogid = intval($blogid);
+ $query = sprintf('SELECT * FROM %s WHERE blogid=%d', sql_table('ban'), intval($blogid));
+ $res = DB::getResult($query);
+ foreach ( $res as $row )
+ {
+ $found = i18n::strpos ($ip, $row['iprange']);
+ if ( $found !== false )
+ {
+ // found a match!
+ return new BanInfo($row['iprange'], $row['reason']);
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Ban::addBan()
+ * Adds a new ban to the banlist. Returns 1 on success, 0 on error
+ *
+ * @param Integer $blogid ID for weblog
+ * @param String $iprange IP range
+ * @param String $reason reason for banning
+ * @return Boolean
+ *
+ */
+ public function addBan($blogid, $iprange, $reason)
+ {
+ global $manager;
+
+ $manager->notify(
+ 'PreAddBan',
+ array(
+ 'blogid' => $blogid,
+ 'iprange' => &$iprange,
+ 'reason' => &$reason
+ )
+ );
+
+ $query = 'INSERT INTO %s (blogid, iprange, reason) VALUES (%d, %s, %s)';
+ $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange), DB::quoteValue($reason));
+ $res = DB::execute($query);
+
+ $manager->notify(
+ 'PostAddBan',
+ array(
+ 'blogid' => $blogid,
+ 'iprange' => $iprange,
+ 'reason' => $reason
+ )
+ );
+
+ return $res !== FALSE ? 1 : 0;
+ }
+
+ /**
+ * Removes a ban from the banlist (correct iprange is needed as argument)
+ * Returns 1 on success, 0 on error
+ */
+ public function removeBan($blogid, $iprange)
+ {
+ global $manager;
+
+ $manager->notify(
+ 'PreDeleteBan',
+ array(
+ 'blogid' => $blogid,
+ 'range' => $iprange
+ )
+ );
+
+ $query = 'DELETE FROM %s WHERE blogid=%d and iprange=%s';
+ $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange));
+ $res = DB::execute($query);
+
+ $manager->notify(
+ 'PostDeleteBan',
+ array(
+ 'blogid' => $blogid,
+ 'range' => $iprange
+ )
+ );
+
+ return $res !== FALSE ? 1 : 0;
+ }
+}
+
+class BanInfo
+{
+ public $iprange;
+ public $message;
+
+ public function __construct($iprange, $message)
+ {
+ $this->iprange = $iprange;
+ $this->message = $message;
+ return;
+ }
+}
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class representing a blog and containing functions to get that blog shown\r
- * on the screen\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: BLOG.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
- */\r
-\r
-if ( !function_exists('requestVar') ) exit;\r
-require_once dirname(__FILE__) . '/ITEMACTIONS.php';\r
-\r
-class Blog\r
-{\r
- // blog id\r
- public $blogid;\r
- \r
- // After creating an object of the blog class, contains true if the BLOG object is\r
- // valid (the blog exists)\r
- public $isValid;\r
- \r
- // associative array, containing all blogsettings (use the get/set functions instead)\r
- private $settings;\r
- \r
- // ID of currently selected category\r
- private $selectedcatid;\r
- \r
- /**\r
- * Blog::_\construct()\r
- * Creates a new BLOG object for the given blog\r
- *\r
- * @param integer $id blogid\r
- * @return void\r
- */\r
- public function __construct($id)\r
- {\r
- global $catid;\r
- \r
- $this->blogid = (integer) $id;\r
- $this->readSettings();\r
- $this->setSelectedCategory($catid);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::readLog()\r
- * Shows the given amount of items for this blog\r
- *\r
- * @param string $template String representing the template _NAME_ (!)\r
- * @param integer $amountEntries amount of entries to show\r
- * @param integer $startpos offset from where items should be shown (e.g. 5 = start at fifth item)\r
- * @return integer amount of items shown\r
- */\r
- public function readLog($template, $amountEntries, $offset = 0, $startpos = 0)\r
- {\r
- return $this->readLogAmount($template,$amountEntries,'','',1,1,$offset, $startpos);\r
- }\r
- \r
- /**\r
- * Blog::showArchive()\r
- * Shows an archive for a given month\r
- *\r
- * @param integer $year year\r
- * @param integer $month month\r
- * @param string $template String representing the template name to be used\r
- * @return void\r
- */\r
- public function showArchive($templatename, $year, $month=0, $day=0)\r
- {\r
- // create extra where clause for select query\r
- if ( $day == 0 && $month != 0 )\r
- {\r
- $timestamp_start = mktime(0,0,0,$month,1,$year);\r
- // also works when $month==12\r
- $timestamp_end = mktime(0,0,0,$month+1,1,$year);\r
- }\r
- elseif ( $month == 0 )\r
- {\r
- $timestamp_start = mktime(0,0,0,1,1,$year);\r
- // also works when $month==12\r
- $timestamp_end = mktime(0,0,0,12,31,$year);\r
- }\r
- else\r
- {\r
- $timestamp_start = mktime(0,0,0,$month,$day,$year);\r
- $timestamp_end = mktime(0,0,0,$month,$day+1,$year);\r
- }\r
- $extra_query = " and i.itime>=%s and i.itime<%s";\r
- $extra_query = sprintf($extra_query, DB::formatDateTime($timestamp_start), DB::formatDateTime($timestamp_end));\r
- \r
- $this->readLogAmount($templatename,0,$extra_query,'',1,1);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setSelectedCategory()\r
- * Sets the selected category by id (only when category exists)\r
- * \r
- * @param integer $catid ID for category\r
- * @return void\r
- */\r
- public function setSelectedCategory($catid)\r
- {\r
- if ( $this->isValidCategory($catid) || (intval($catid) == 0) )\r
- {\r
- $this->selectedcatid = intval($catid);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setSelectedCategoryByName()\r
- * Sets the selected category by name\r
- * \r
- * @param string $catname name of category\r
- * @return void\r
- */\r
- public function setSelectedCategoryByName($catname)\r
- {\r
- $this->setSelectedCategory($this->getCategoryIdFromName($catname));\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::getSelectedCategory()\r
- * Returns the selected category\r
- * \r
- * @param void\r
- * @return integer\r
- */\r
- public function getSelectedCategory()\r
- {\r
- return $this->selectedcatid;\r
- }\r
- \r
- /**\r
- * Shows the given amount of items for this blog\r
- *\r
- * @param string $template string representing the template _NAME_ (!)\r
- * @param integer $amountEntries amount of entries to show (0 = no limit)\r
- * @param string $extraQuery extra conditions to be added to the query\r
- * @param string $highlight contains a query that should be highlighted\r
- * @param integer $comments 1=show comments 0=don't show comments\r
- * @param integer $dateheads 1=show dateheads 0=don't show dateheads\r
- * @param integer $offset offset\r
- * @return integer amount of items shown\r
- */\r
- private function readLogAmount($template, $amountEntries, $extraQuery, $highlight, $comments, $dateheads, $offset = 0, $startpos = 0)\r
- {\r
- $query = $this->getSqlBlog($extraQuery);\r
- \r
- if ( $amountEntries > 0 )\r
- {\r
- // $offset zou moeten worden:\r
- // (($startpos / $amountentries) + 1) * $offset ... later testen ...\r
- $query .= ' LIMIT ' . intval($startpos + $offset).',' . intval($amountEntries);\r
- }\r
- return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);\r
- }\r
- \r
- /**\r
- * Blog::showUsingQuery()\r
- * Do the job for readLogAmmount\r
- * \r
- * @param string $templateName template name\r
- * @param string $query string for query\r
- * @param string $highlight string to be highlighted\r
- * @param integer $comments the number of comments\r
- * @param boolean $dateheads date header is needed or not\r
- * @return integer the number of rows as a result of mysql query\r
- */\r
- private function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1)\r
- {\r
- global $CONF, $manager, $currentTemplateName;\r
- \r
- $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit');\r
- if ( $lastVisit != 0 )\r
- {\r
- $lastVisit = $this->getCorrectTime($lastVisit);\r
- }\r
- \r
- // set templatename as global variable (so plugins can access it)\r
- $currentTemplateName = $templateName;\r
- $template =& $manager->getTemplate($templateName);\r
- \r
- // create parser object & action handler\r
- $handler = new ItemActions($this);\r
- $handler->setTemplate($template);\r
- $handler->setHighlight($highlight);\r
- $handler->setLastVisit($lastVisit);\r
- $handler->setShowComments($comments);\r
- \r
- $parser = new Parser($handler);\r
- \r
- // execute query\r
- $items = DB::getResult($query);\r
- \r
- // loop over all items\r
- $old_date = 0;\r
- foreach ( $items as $item )\r
- {\r
- // string timestamp -> unix timestamp\r
- $item['timestamp'] = strtotime($item['itime']);\r
- \r
- // action handler needs to know the item we're handling\r
- $handler->setCurrentItem($item);\r
- \r
- // add date header if needed\r
- if ( $dateheads )\r
- {\r
- $new_date = date('dFY', $item['timestamp']);\r
- if ( $new_date != $old_date )\r
- {\r
- // unless this is the first time, write date footer\r
- $timestamp = $item['timestamp'];\r
- if ( $old_date != 0 )\r
- {\r
- $oldTS = strtotime($old_date);\r
- $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));\r
- \r
- if ( !in_array('DATE_FOOTER', $template) || empty($template['DATE_FOOTER']) )\r
- {\r
- $tmp_footer = '';\r
- }\r
- else\r
- {\r
- $tmp_footer = i18n::formatted_datetime($template['DATE_FOOTER'], $oldTS);\r
- }\r
- $parser->parse($tmp_footer);\r
- $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));\r
- }\r
- \r
- $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));\r
- \r
- // note, to use templatvars in the dateheader, the %-characters need to be doubled in\r
- // order to be preserved by strftime\r
- if ( !in_array('DATE_HEADER', $template) || empty($template['DATE_HEADER']) )\r
- {\r
- $tmp_header = '';\r
- }\r
- else\r
- {\r
- $tmp_header = i18n::formatted_datetime($template['DATE_HEADER'], $timestamp);\r
- }\r
- $parser->parse($tmp_header);\r
- $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));\r
- }\r
- $old_date = $new_date;\r
- }\r
- \r
- // parse item\r
- $parser->parse($template['ITEM_HEADER']);\r
- $manager->notify('PreItem', array('blog' => &$this, 'item' => &$item));\r
- $parser->parse($template['ITEM']);\r
- $manager->notify('PostItem', array('blog' => &$this, 'item' => &$item));\r
- $parser->parse($template['ITEM_FOOTER']);\r
- }\r
- \r
- $numrows = $items->rowCount();\r
- \r
- // add another date footer if there was at least one item\r
- if ( ($numrows > 0) && $dateheads )\r
- {\r
- $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));\r
- $parser->parse($template['DATE_FOOTER']);\r
- $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));\r
- }\r
- \r
- $items->closeCursor();\r
- return $numrows;\r
- }\r
- \r
- /**\r
- * Blog::showOneitem()\r
- * Simplified function for showing only one item\r
- * \r
- * @param integer $itemid ID for item\r
- * @param array $template template for item\r
- * @param string $highlight string for highlight\r
- * @return integer 1\r
- */\r
- public function showOneitem($itemid, $template, $highlight)\r
- {\r
- $extraQuery = ' and inumber=' . intval($itemid);\r
- \r
- return $this->readLogAmount($template, 1, $extraQuery, $highlight, 0, 0);\r
- }\r
- \r
- /**\r
- * Blog::addItem()\r
- * Adds an item to this blog\r
- * \r
- * @param integer $catid ID for category\r
- * @param string $title ID for \r
- * @param string $body text for body\r
- * @param string $more text for more\r
- * @param integer $blogid ID for blog\r
- * @param integer $authorid ID for author\r
- * @param timestamp $timestamp UNIX timestamp for post\r
- * @param boolean $closed opened or closed\r
- * @param boolean $draft draft or not\r
- * @param boolean $posted posted or not\r
- * @return integer ID for added item\r
- */\r
- function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft, $posted='1')\r
- {\r
- global $manager;\r
- \r
- $blogid = (integer) $blogid;\r
- $authorid = (integer) $authorid;\r
- $title = $title;\r
- $body = $body;\r
- $more = $more;\r
- $catid = intval($catid);\r
- \r
- // convert newlines to <br />\r
- if ( $this->convertBreaks() )\r
- {\r
- $body = addBreaks($body);\r
- $more = addBreaks($more);\r
- }\r
-\r
- if ( $closed != '1' )\r
- {\r
- $closed = '0';\r
- }\r
- if ( $draft != '0' )\r
- {\r
- $draft = '1';\r
- }\r
- \r
- if ( !$this->isValidCategory($catid) )\r
- {\r
- $catid = $this->getDefaultCategory();\r
- }\r
- \r
- $isFuture = 0;\r
- if ( $timestamp > $this->getCorrectTime() )\r
- {\r
- $isFuture = 1;\r
- }\r
- \r
- $timestamp = date('Y-m-d H:i:s',$timestamp);\r
- \r
- $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid));\r
- \r
- $ititle = DB::quoteValue($title);\r
- $ibody = DB::quoteValue($body);\r
- $imore = DB::quoteValue($more);\r
- $timestamp = DB::formatDateTime(strtotime($timestamp));\r
- \r
- $query = "INSERT INTO %s (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT, IPOSTED) VALUES (%s, %s, %s, %d, %d, %s, %s, %s, %s, %s)";\r
- $query = sprintf($query, sql_table('item'), $ititle, $ibody, $imore, $blogid, $authorid, $timestamp, $closed, $draft, $catid, $posted);\r
- DB::execute($query);\r
- $itemid = DB::getInsertId();\r
- \r
- $manager->notify('PostAddItem',array('itemid' => $itemid));\r
- \r
- if ( !$draft )\r
- {\r
- $this->updateUpdateFile();\r
- }\r
- // send notification mail\r
- if ( !$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem() )\r
- {\r
- $this->sendNewItemNotification($itemid, $title, $body);\r
- }\r
- return $itemid;\r
- }\r
- \r
- /**\r
- * Blog::sendNewItemNotification()\r
- * Send a new item notification to the notification list\r
- * \r
- * @param string $itemid ID of the item\r
- * @param string $title title of the item\r
- * @param string $body body of the item\r
- * @return void\r
- */\r
- public function sendNewItemNotification($itemid, $title, $body)\r
- {\r
- global $CONF, $member;\r
- \r
- $ascii = Entity::anchor_footnoting($body);\r
- \r
- $message = _NOTIFY_NI_MSG . " \n";\r
- $temp = parse_url($CONF['Self']);\r
- if ( $temp['scheme'] )\r
- {\r
- $message .= Link::create_item_link($itemid) . "\n\n";\r
- }\r
- else\r
- {\r
- $tempurl = $this->getURL();\r
- if ( i18n::substr($tempurl, -1) == '/' || i18n::substr($tempurl, -4) == '.php' )\r
- {\r
- $message .= $tempurl . '?itemid=' . $itemid . "\n\n";\r
- }\r
- else\r
- {\r
- $message .= $tempurl . '/?itemid=' . $itemid . "\n\n";\r
- }\r
- }\r
- $message .= _NOTIFY_TITLE . ' ' . strip_tags($title) . "\n";\r
- $message .= _NOTIFY_CONTENTS . "\n " . $ascii . "\n";\r
- $message .= NOTIFICATION::get_mail_footer();\r
- \r
- $subject = $this->getName() . ': ' . _NOTIFY_NI_TITLE;\r
- \r
- $from = $member->getNotifyFromMailAddress();\r
- \r
- NOTIFICATION::mail($this->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::createNewCategory()\r
- * Creates a new category for this blog\r
- *\r
- * @param string $catName name of the new category. When empty, a name is generated automatically (starting with newcat)\r
- * @param string $catDescription description of the new category. Defaults to 'New Category'\r
- * @return integer ID for new category on success. 0 on failure\r
- */\r
- public function createNewCategory($catName = '', $catDescription = _CREATED_NEW_CATEGORY_DESC)\r
- {\r
- global $member, $manager;\r
- \r
- if ( !$member->blogAdminRights($this->blogid) )\r
- {\r
- return 0;\r
- }\r
- \r
- // generate\r
- if ( $catName == '' )\r
- {\r
- $catName = _CREATED_NEW_CATEGORY_NAME;\r
- $i = 1;\r
- \r
- $res = DB::getResult('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->blogid);\r
- while ( $res->rowCount() > 0 )\r
- {\r
- $i++;\r
- $res = DB::getResult('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->blogid);\r
- }\r
- \r
- $catName = $catName . $i;\r
- }\r
- \r
- $data = array(\r
- 'blog' => &$this,\r
- 'name' => &$catName,\r
- 'description' => $catDescription\r
- );\r
- $manager->notify('PreAddCategory', $data);\r
- \r
- $query = "INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, %s, %s)";\r
- $query = sprintf($query, sql_table('category'), (integer) $this->blogid, DB::quoteValue($catName), DB::quoteValue($catDescription));\r
- DB::execute($query);\r
- $catid = DB::getInsertId();\r
- \r
- $data = array(\r
- 'blog' => &$this,\r
- 'name' => $catName,\r
- 'description' => $catDescription,\r
- 'catid' => $catid\r
- );\r
- $manager->notify('PostAddCategory', $data);\r
- \r
- return $catid;\r
- }\r
- \r
- /**\r
- * Blog::search()\r
- * Searches all months of this blog for the given query\r
- *\r
- * @param string $query search query\r
- * @param array $template template to be used (__NAME__ of the template)\r
- * @param integer $amountMonths max amount of months to be search (0 = all)\r
- * @param integer $maxresults max number of results to show\r
- * @param integer $startpos offset\r
- * @return amount of hits found\r
- */\r
- public function search($query, $template, $amountMonths, $maxresults, $startpos) {\r
- global $CONF, $manager;\r
- \r
- $highlight = '';\r
- $sqlquery = $this->getSqlSearch($query, $amountMonths, $highlight);\r
- \r
- if ( $sqlquery == '' )\r
- {\r
- // no query -> show everything\r
- $extraquery = '';\r
- $amountfound = $this->readLogAmount($template, $maxresults, $extraQuery, $query, 1, 1);\r
- }\r
- else\r
- {\r
- // add LIMIT to query (to split search results into pages)\r
- if ( intval($maxresults > 0) )\r
- {\r
- $sqlquery .= ' LIMIT ' . intval($startpos) . ',' . intval($maxresults);\r
- }\r
- \r
- // show results\r
- $amountfound = $this->showUsingQuery($template, $sqlquery, $highlight, 1, 1);\r
- \r
- // when no results were found, show a message\r
- if ( $amountfound == 0 )\r
- {\r
- $template =& $manager->getTemplate($template);\r
- $vars = array(\r
- 'query' => Entity::hsc($query),\r
- 'blogid' => $this->blogid\r
- );\r
- echo Template::fill($template['SEARCH_NOTHINGFOUND'], $vars);\r
- }\r
- }\r
- return $amountfound;\r
- }\r
- \r
- /**\r
- * Blog::getSqlSearch()\r
- * Returns an SQL query to use for a search query\r
- * No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
- *\r
- * @param string $query search query\r
- * @param integer $amountMonths amount of months to search back. Default = 0 = unlimited\r
- * @param string $mode either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query\r
- * @return string $highlight words to highlight (out parameter)\r
- * @return string either a full SQL query, or an empty string (if querystring empty)\r
- */\r
- public function getSqlSearch($query, $amountMonths = 0, &$highlight, $mode = '')\r
- {\r
- $searchclass = new Search($query);\r
- \r
- $highlight = $searchclass->inclusive;\r
- \r
- // if querystring is empty, return empty string\r
- if ( $searchclass->inclusive == '' )\r
- {\r
- return '';\r
- }\r
- \r
- $where = $searchclass->boolean_sql_where('ititle,ibody,imore');\r
- $select = $searchclass->boolean_sql_select('ititle,ibody,imore');\r
- \r
- // get list of blogs to search\r
- $blogs = $searchclass->blogs; // array containing blogs that always need to be included\r
- $blogs[] = $this->blogid; // also search current blog (duh)\r
- $blogs = array_unique($blogs); // remove duplicates\r
- $selectblogs = '';\r
- if ( count($blogs) > 0 )\r
- {\r
- $selectblogs = ' and i.iblog in (' . implode(',', $blogs) . ')';\r
- }\r
- \r
- if ( $mode == '' )\r
- {\r
- $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, i.itime, i.imore as more, i.icat as catid, i.iclosed as closed,\r
- m.mname as author, m.mrealname as authorname, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl,\r
- c.cname as category';\r
- \r
- if ( $select )\r
- {\r
- $query .= ', '.$select. ' as score ';\r
- }\r
- }\r
- else\r
- {\r
- $query = 'SELECT COUNT(*) as result ';\r
- }\r
- \r
- $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'\r
- . ' WHERE i.iauthor=m.mnumber'\r
- . ' and i.icat=c.catid'\r
- // exclude drafts\r
- . ' and i.idraft=0'\r
- . $selectblogs\r
- // don't show future items\r
- . ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime())\r
- . ' and '.$where;\r
- \r
- // take into account amount of months to search\r
- if ( $amountMonths > 0 )\r
- {\r
- $localtime = getdate($this->getCorrectTime());\r
- $timestamp_start = mktime(0,0,0,$localtime['mon'] - $amountMonths,1,$localtime['year']);\r
- $query .= ' and i.itime>' . DB::formatDateTime($timestamp_start);\r
- }\r
- \r
- if ( $mode == '' )\r
- {\r
- if ( $select )\r
- {\r
- $query .= ' ORDER BY score DESC';\r
- }\r
- else\r
- {\r
- $query .= ' ORDER BY i.itime DESC ';\r
- }\r
- }\r
- \r
- return $query;\r
- }\r
- \r
- /**\r
- * Blog::getSqlBlog()\r
- * Returns the SQL query that's normally used to display the blog items on the index type skins\r
- * No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
- *\r
- * @param string $extraQuery extra query string\r
- * @param string $mode either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query\r
- * @return string either a full SQL query, or an empty string\r
- */\r
- public function getSqlBlog($extraQuery, $mode = '')\r
- {\r
- if ( $mode == '' )\r
- {\r
- $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author,\r
- m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail,\r
- m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';\r
- }\r
- else\r
- {\r
- $query = 'SELECT COUNT(*) as result ';\r
- }\r
- \r
- $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'\r
- . ' WHERE i.iblog='.$this->blogid\r
- . ' and i.iauthor=m.mnumber'\r
- . ' and i.icat=c.catid'\r
- . ' and i.idraft=0' // exclude drafts\r
- . ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime()); // don't show future items\r
- \r
- if ( $this->selectedcatid )\r
- {\r
- $query .= ' and i.icat=' . $this->selectedcatid . ' ';\r
- }\r
- \r
- $query .= $extraQuery;\r
- \r
- if ( $mode == '' )\r
- {\r
- $query .= ' ORDER BY i.itime DESC';\r
- }\r
- return $query;\r
- }\r
- \r
- /**\r
- * Blog::showArchiveList()\r
- * Shows the archivelist using the given template\r
- * \r
- * @param string $template template name\r
- * @param string $mode year/month/day\r
- * @param integer $limit limit of record count\r
- * @return void\r
- */\r
- public function showArchiveList($template, $mode = 'month', $limit = 0)\r
- {\r
- global $CONF, $catid, $manager;\r
- \r
- if ( !isset ($linkparams) )\r
- {\r
- $linkparams = array();\r
- }\r
- \r
- if ( $catid )\r
- {\r
- $linkparams = array('catid' => $catid);\r
- }\r
- \r
- $template =& $manager->getTemplate($template);\r
- $data['blogid'] = $this->blogid;\r
- \r
- if ( !array_key_exists('ARCHIVELIST_HEADER', $template) || !$template['ARCHIVELIST_HEADER'] )\r
- {\r
- $tplt = '';\r
- }\r
- else\r
- {\r
- $tplt = $template['ARCHIVELIST_HEADER'];\r
- }\r
- \r
- echo Template::fill($tplt, $data);\r
- \r
- $query = 'SELECT itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) AS Day'\r
- . ' FROM '.sql_table('item')\r
- . ' WHERE iblog=' . $this->blogid\r
- . ' AND itime <=' . DB::formatDateTime($this->getCorrectTime()) // don't show future items!\r
- . ' AND idraft=0'; // don't show draft items\r
- \r
- if ( $catid )\r
- {\r
- $query .= ' and icat=' . intval($catid);\r
- }\r
- \r
- $query .= ' GROUP BY Year';\r
- if ( $mode == 'month' || $mode == 'day' )\r
- {\r
- $query .= ', Month';\r
- }\r
- if ( $mode == 'day' )\r
- {\r
- $query .= ', Day';\r
- }\r
- \r
- $query .= ' ORDER BY itime DESC';\r
- \r
- if ( $limit > 0 )\r
- {\r
- $query .= ' LIMIT ' . intval($limit);\r
- }\r
- \r
- $res = DB::getResult($query);\r
- foreach ( $res as $current )\r
- {\r
- /* string time -> unix timestamp */\r
- $current['itime'] = strtotime($current['itime']);\r
- \r
- if ( $mode == 'day' )\r
- {\r
- $archivedate = date('Y-m-d',$current['itime']);\r
- $archive['day'] = date('d',$current['itime']);\r
- $data['day'] = date('d',$current['itime']);\r
- $data['month'] = date('m',$current['itime']);\r
- $archive['month'] = $data['month'];\r
- }\r
- elseif ( $mode == 'year' )\r
- {\r
- $archivedate = date('Y',$current['itime']);\r
- $data['day'] = '';\r
- $data['month'] = '';\r
- $archive['day'] = '';\r
- $archive['month'] = '';\r
- }\r
- else\r
- {\r
- $archivedate = date('Y-m',$current['itime']);\r
- $data['month'] = date('m',$current['itime']);\r
- $archive['month'] = $data['month'];\r
- $data['day'] = '';\r
- $archive['day'] = '';\r
- }\r
- \r
- $data['year'] = date('Y',$current['itime']);\r
- $archive['year'] = $data['year'];\r
- $data['archivelink'] = Link::create_archive_link($this->blogid,$archivedate,$linkparams);\r
- \r
- $manager->notify('PreArchiveListItem', array('listitem' => &$data));\r
- \r
- $temp = Template::fill($template['ARCHIVELIST_LISTITEM'],$data);\r
- echo i18n::formatted_datetime($temp, $current['itime']);\r
- return;\r
- }\r
- \r
- $res->closeCursor();\r
- \r
- if ( !array_key_exists('ARCHIVELIST_FOOTER', $template) || !$template['ARCHIVELIST_FOOTER'] )\r
- {\r
- $tplt = '';\r
- }\r
- else\r
- {\r
- $tplt = $template['ARCHIVELIST_FOOTER'];\r
- }\r
- \r
- echo Template::fill($tplt, $data);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::showCategoryList()\r
- * Shows the list of categories using a given template\r
- * \r
- * @param string $template Template Name\r
- * @return void\r
- */\r
- public function showCategoryList($template)\r
- {\r
- global $CONF, $archive, $archivelist, $manager;\r
- \r
- /*\r
- * determine arguments next to catids\r
- * I guess this can be done in a better way, but it works\r
- */\r
- $linkparams = array();\r
- if ( $archive )\r
- {\r
- $blogurl = Link::create_archive_link($this->blogid, $archive, '');\r
- $linkparams['blogid'] = $this->blogid;\r
- $linkparams['archive'] = $archive;\r
- }\r
- else if ( $archivelist )\r
- {\r
- $blogurl = Link::create_archivelist_link($this->blogid, '');\r
- $linkparams['archivelist'] = $archivelist;\r
- }\r
- else\r
- {\r
- $blogurl = Link::create_blogid_link($this->blogid, '');\r
- $linkparams['blogid'] = $this->blogid;\r
- }\r
- \r
- $template =& $manager->getTemplate($template);\r
- \r
- //: Change: Set nocatselected variable\r
- if ( $this->selectedcatid )\r
- {\r
- $nocatselected = 'no';\r
- }\r
- else\r
- {\r
- $nocatselected = 'yes';\r
- } \r
- \r
- $args = array(\r
- 'blogid' => $this->blogid,\r
- 'blogurl' => $blogurl,\r
- 'self' => $CONF['Self'],\r
- 'catiscurrent' => $nocatselected, // Change: Set catiscurrent template variable for header\r
- 'currentcat' => $nocatselected \r
- );\r
- \r
- /* output header of category list item */\r
- if ( !array_key_exists('CATLIST_HEADER', $template) || empty($template['CATLIST_HEADER']) )\r
- {\r
- echo Template::fill(NULL, $args);\r
- }\r
- else\r
- {\r
- echo Template::fill($template['CATLIST_HEADER'], $args);\r
- }\r
- \r
- $query = "SELECT catid, cdesc as catdesc, cname as catname FROM %s WHERE cblog=%d ORDER BY cname ASC;";\r
- $query = sprintf($query, sql_table('category'), (integer) $this->blogid);\r
- $res = DB::getResult($query);\r
- \r
- foreach ( $res as $data )\r
- {\r
- $args = array(\r
- 'catid' => $data['catid'],\r
- 'name' => $data['catname'],\r
- 'extra' => $linkparams\r
- );\r
- \r
- $data['blogid'] = $this->blogid;\r
- $data['blogurl'] = $blogurl;\r
- $data['catlink'] = Link::create_link('category', $args);\r
- $data['self'] = $CONF['Self'];\r
- \r
- // this gives catiscurrent = no when no category is selected.\r
- $data['catiscurrent'] = 'no';\r
- $data['currentcat'] = 'no';\r
- \r
- if ( $this->selectedcatid )\r
- {\r
- if ( $this->selectedcatid == $data['catid'] )\r
- {\r
- $data['catiscurrent'] = 'yes';\r
- $data['currentcat'] = 'yes';\r
- }\r
- }\r
- else\r
- {\r
- global $itemid;\r
- if ( (integer) $itemid && $manager->existsItem((integer) $itemid, 0, 0) )\r
- {\r
- $iobj =& $manager->getItem($itemid, 0, 0);\r
- $cid = $iobj['catid'];\r
- \r
- if ( $cid == $data['catid'] )\r
- {\r
- $data['catiscurrent'] = 'yes';\r
- $data['currentcat'] = 'yes';\r
- }\r
- }\r
- }\r
- \r
- $manager->notify('PreCategoryListItem', array('listitem' => &$data));\r
- \r
- if ( !array_key_exists('CATLIST_LISTITEM', $template) || empty($template['CATLIST_LISTITEM']))\r
- {\r
- echo Template::fill(NULL, $data);\r
- }\r
- else\r
- {\r
- echo Template::fill($template['CATLIST_LISTITEM'], $data);\r
- }\r
- }\r
- \r
- $res->closeCursor();\r
- \r
- $args = array(\r
- 'blogid' => $this->blogid,\r
- 'blogurl' => $blogurl,\r
- 'self' => $CONF['Self'],\r
- 'catiscurrent' => $nocatselected, //: Change: Set catiscurrent template variable for footer\r
- 'currentcat' => $nocatselected\r
- );\r
- \r
- if ( !array_key_exists('CATLIST_FOOTER', $template) || empty($template['CATLIST_FOOTER']))\r
- {\r
- echo Template::fill(NULL, $args);\r
- }\r
- else\r
- {\r
- echo Template::fill($template['CATLIST_FOOTER'], $args);\r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Blog::showBlogList()\r
- * Shows a list of all blogs in the system using a given template\r
- * ordered by number, name, shortname or description\r
- * in ascending or descending order\r
- * \r
- * @param string $template tempalte name\r
- * @param string $bnametype bname/bshortname\r
- * @param string $orderby string for 'ORDER BY' SQL\r
- * @param string $direction ASC/DESC\r
- * @return void\r
- */\r
- public function showBlogList($template, $bnametype, $orderby, $direction)\r
- {\r
- global $CONF, $manager;\r
- \r
- switch ( $orderby )\r
- {\r
- case 'number':\r
- $orderby='bnumber';\r
- break;\r
- case 'name':\r
- $orderby='bname';\r
- break;\r
- case 'shortname':\r
- $orderby='bshortname';\r
- break;\r
- case 'description':\r
- $orderby='bdesc';\r
- break;\r
- default:\r
- $orderby='bnumber';\r
- break;\r
- }\r
- \r
- $direction=strtolower($direction);\r
- switch ( $direction )\r
- {\r
- case 'asc':\r
- $direction='ASC';\r
- break;\r
- case 'desc':\r
- $direction='DESC';\r
- break;\r
- default:\r
- $direction='ASC';\r
- break;\r
- }\r
- \r
- $template =& $manager->getTemplate($template);\r
- \r
- if ( array_key_exists('BLOGLIST_HEADER', $template) && !empty($template['BLOGLIST_HEADER']) )\r
- {\r
- $vars = array(\r
- 'sitename' => $CONF['SiteName'],\r
- 'siteurl' => $CONF['IndexURL']\r
- );\r
- \r
- echo Template::fill($template['BLOGLIST_HEADER'], $vars);\r
- }\r
- \r
- if ( array_key_exists('BLOGLIST_LISTITEM', $template) && !empty($template['BLOGLIST_LISTITEM']) )\r
- {\r
- $query = 'SELECT bnumber, bname, bshortname, bdesc, burl FROM '.sql_table('blog').' ORDER BY '.$orderby.' '.$direction;\r
- $res = DB::getResult($query);\r
- \r
- foreach ( $res as $data )\r
- {\r
- $list = array();\r
- $list['bloglink'] = Link::create_blogid_link($data['bnumber']);\r
- $list['blogdesc'] = $data['bdesc'];\r
- $list['blogurl'] = $data['burl'];\r
- \r
- if ( $bnametype == 'shortname' )\r
- {\r
- $list['blogname'] = $data['bshortname'];\r
- }\r
- else\r
- {\r
- /* all other cases */\r
- $list['blogname'] = $data['bname'];\r
- }\r
- \r
- $manager->notify('PreBlogListItem',array('listitem' => &$list));\r
- \r
- echo Template::fill($template['BLOGLIST_LISTITEM'], $list);\r
- }\r
- \r
- $res->closeCursor();\r
- }\r
- \r
- \r
- if ( array_key_exists('BLOGLIST_FOOTER', $template) && !empty($template['BLOGLIST_FOOTER']) )\r
- {\r
- $vars = array(\r
- 'sitename' => $CONF['SiteName'],\r
- 'siteurl' => $CONF['IndexURL']\r
- );\r
- echo Template::fill($template['BLOGLIST_FOOTER']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::readSettings()\r
- * Read the blog settings\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function readSettings()\r
- {\r
- $query = 'SELECT * FROM %s WHERE bnumber=%d;';\r
- $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);\r
- $res = DB::getResult($query);\r
- \r
- $this->isValid = ($res->rowCount() > 0);\r
- if ( $this->isValid )\r
- {\r
- $this->settings = $res->fetch(PDO::FETCH_ASSOC);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::writeSettings()\r
- * Write the blog settings\r
- */\r
- public function writeSettings()\r
- {\r
- // (can't use floatval since not available prior to PHP 4.2)\r
- $offset = $this->getTimeOffset();\r
- if ( !is_float($offset) )\r
- {\r
- $offset = (integer) $offset;\r
- }\r
- \r
- $query = 'UPDATE '.sql_table('blog')\r
- . ' SET bname=' . DB::quoteValue($this->getName()) . ','\r
- . ' bshortname='. DB::quoteValue($this->getShortName()) . ','\r
- . ' bcomments='. intval($this->commentsEnabled()) . ','\r
- . ' bmaxcomments=' . intval($this->getMaxComments()) . ','\r
- . ' btimeoffset=' . $offset . ','\r
- . ' bpublic=' . intval($this->isPublic()) . ','\r
- . ' breqemail=' . intval($this->emailRequired()) . ','\r
- . ' bconvertbreaks=' . intval($this->convertBreaks()) . ','\r
- . ' ballowpast=' . intval($this->allowPastPosting()) . ','\r
- . ' bnotify=' . DB::quoteValue($this->getNotifyAddress()) . ','\r
- . ' bnotifytype=' . intval($this->getNotifyType()) . ','\r
- . ' burl=' . DB::quoteValue($this->getURL()) . ','\r
- . ' bupdate=' . DB::quoteValue($this->getUpdateFile()) . ','\r
- . ' bdesc=' . DB::quoteValue($this->getDescription()) . ','\r
- . ' bdefcat=' . intval($this->getDefaultCategory()) . ','\r
- . ' bdefskin=' . intval($this->getDefaultSkin()) . ','\r
- . ' bincludesearch=' . intval($this->getSearchable())\r
- . ' WHERE bnumber=' . intval($this->blogid);\r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::updateUpdatefile()\r
- * Update the update file if requested\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function updateUpdatefile()\r
- {\r
- if ( $this->getUpdateFile() )\r
- {\r
- $f_update = fopen($this->getUpdateFile(), 'w');\r
- fputs($f_update,$this->getCorrectTime());\r
- fclose($f_update);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::isValidCategory()\r
- * Check if a category with a given catid is valid\r
- * \r
- * @param integer $catid ID for category\r
- * @return boolean exists or not\r
- */\r
- public function isValidCategory($catid)\r
- {\r
- $query = 'SELECT * FROM %s WHERE cblog=%d and catid=%d;';\r
- $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);\r
- $res = DB::getResult($query);\r
- return ($res->rowCount() != 0);\r
- }\r
- \r
- /**\r
- * Blog::getCategoryName()\r
- * Get the category name for a given catid\r
- * \r
- * @param integer $catid ID for category\r
- * @return string name of category\r
- */\r
- public function getCategoryName($catid)\r
- {\r
- $query = 'SELECT cname FROM %s WHERE cblog=%d and catid=%d;';\r
- $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);\r
- $res = DB::getValue($query);\r
- return $res;\r
- }\r
- \r
- /**\r
- * Blog::getCategoryDesc()\r
- * Get the category description for a given catid\r
- * \r
- * @param $catid\r
- * category id\r
- */\r
- public function getCategoryDesc($catid)\r
- {\r
- $query = 'SELECT cdesc FROM %s WHERE cblog=%d and catid=%d;';\r
- $query = sprintf($querym, sql_table('category'), (integer) $this->blogid, (integer) $catid);\r
- $res = DB::getValue();\r
- return $res;\r
- }\r
- \r
- /**\r
- * Blog::getCategoryIdFromName\r
- * Get the category id for a given category name\r
- * \r
- * @param string $name category name\r
- * @return ID for category\r
- */\r
- public function getCategoryIdFromName($name)\r
- {\r
- $query = 'SELECT catid FROM %s WHERE cblog=%d and cname=%s;';\r
- $query = sprintf($query, sql_table('category'), (integer) $this->blogid, DB::quoteValue($name));\r
- \r
- $res = DB::getValue();\r
- if ( !$res )\r
- {\r
- return $this->getDefaultCategory();\r
- }\r
- return $res;\r
- }\r
- \r
- /**\r
- * Blog::insertJavaScriptInfo()\r
- * Insert a javascript that includes information about the settings\r
- * of an author: ConvertBreaks, MediaUrl and AuthorId\r
- * \r
- * @param $authorid id of the author\r
- */\r
- public function insertJavaScriptInfo($authorid = '')\r
- {\r
- global $member, $CONF;\r
- \r
- if ( $authorid == '' )\r
- {\r
- $authorid = $member->getID();\r
- }\r
- \r
- echo "<script type=\"text/javascript\">\n";\r
- \r
- if ( !$this->convertBreaks() )\r
- {\r
- echo "setConvertBreaks(false);\n";\r
- }\r
- else\r
- {\r
- echo "setConvertBreaks(true);\n";\r
- }\r
- echo "setMediaUrl('{$CONF['MediaURL']}');\n";\r
- echo "setAuthorId('{$authorid}');\n";\r
- echo "</script>\n";\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setAllowPastPosting()\r
- * Set the the setting for allowing to publish postings in the past\r
- * \r
- * @param boolean $val new value for ballowpast\r
- * @return void\r
- */\r
- public function setAllowPastPosting($val)\r
- {\r
- $this->setSetting('ballowpast', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::allowPastPosting()\r
- * Get the the setting if it is allowed to publish postings in the past\r
- * [should be named as getAllowPastPosting()]\r
- * \r
- * @param void\r
- * @return boolean\r
- */\r
- public function allowPastPosting()\r
- {\r
- return $this->getSetting('ballowpast');\r
- }\r
- \r
- /**\r
- * Blog::getCorrectTime()\r
- * \r
- * @param integer $t\r
- * @return integer\r
- */\r
- public function getCorrectTime($t=0)\r
- {\r
- if ( $t == 0 )\r
- {\r
- $t = time();\r
- }\r
- return ($t + 3600 * $this->getTimeOffset());\r
- }\r
- \r
- /**\r
- * Blog::getName()\r
- * \r
- * @param void\r
- * @return string name of this weblog\r
- */\r
- public function getName()\r
- {\r
- return $this->getSetting('bname');\r
- }\r
- \r
- /**\r
- * Blog::getShortName()\r
- * \r
- * @param void\r
- * @return string short name of this weblog\r
- */\r
- public function getShortName()\r
- {\r
- return $this->getSetting('bshortname');\r
- }\r
- \r
- /**\r
- * Blog::getMaxComments()\r
- * \r
- * @param void\r
- * @return integer maximum number of comments\r
- */\r
- public function getMaxComments()\r
- {\r
- return $this->getSetting('bmaxcomments');\r
- }\r
- \r
- /**\r
- * Blog::getNotifyAddress()\r
- * \r
- * @param void\r
- * @return string mail address for notifying\r
- */\r
- public function getNotifyAddress()\r
- {\r
- return $this->getSetting('bnotify');\r
- }\r
- \r
- /**\r
- * Blog::getNotifyType()\r
- * \r
- * @param void\r
- * @return integer notifycation type\r
- */\r
- public function getNotifyType()\r
- {\r
- return $this->getSetting('bnotifytype');\r
- }\r
- \r
- /**\r
- * Blog::notifyOnComment()\r
- * \r
- * @param void\r
- * @return boolean\r
- */\r
- public function notifyOnComment()\r
- {\r
- $n = $this->getNotifyType();\r
- return (($n != 0) && (($n % 3) == 0));\r
- }\r
- \r
- /**\r
- * Blog::notifyOnVote()\r
- * \r
- * @param void\r
- * @return boolean\r
- */\r
- public function notifyOnVote()\r
- {\r
- $n = $this->getNotifyType();\r
- return (($n != 0) && (($n % 5) == 0));\r
- }\r
- \r
- /**\r
- * Blog::notifyOnNewItem()\r
- * \r
- * @param void\r
- * @return boolean\r
- */\r
- public function notifyOnNewItem()\r
- {\r
- $n = $this->getNotifyType();\r
- return (($n != 0) && (($n % 7) == 0));\r
- }\r
- \r
- /**\r
- * Blog::setNotifyType()\r
- * \r
- * @param integer $val\r
- * @return void\r
- */\r
- public function setNotifyType($val)\r
- {\r
- $this->setSetting('bnotifytype',$val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::getTimeOffset()\r
- * @param void\r
- * @return \r
- */\r
- public function getTimeOffset()\r
- {\r
- return $this->getSetting('btimeoffset');\r
- }\r
- \r
- /**\r
- * Blog::commentsEnabled()\r
- * @param void\r
- * @return integer enabled or not\r
- */\r
- public function commentsEnabled()\r
- {\r
- return $this->getSetting('bcomments');\r
- }\r
- \r
- /**\r
- * Blog::getURL()\r
- * @param void\r
- * @return string URI for this weblog\r
- */\r
- public function getURL()\r
- {\r
- return $this->getSetting('burl');\r
- }\r
- \r
- /**\r
- * Blog::getDefaultSkin()\r
- * @param void\r
- * @return name of skin as default for this weblog\r
- */\r
- public function getDefaultSkin()\r
- {\r
- return $this->getSetting('bdefskin');\r
- }\r
- \r
- /**\r
- * Blog::getUpdateFile()\r
- * @param void\r
- * @return string name of file to be updated when weblog is updated\r
- */\r
- public function getUpdateFile()\r
- {\r
- return $this->getSetting('bupdate');\r
- }\r
- \r
- /**\r
- * Blog::getDescription()\r
- * @param void\r
- * @return string description for this weblog\r
- */\r
- public function getDescription()\r
- {\r
- return $this->getSetting('bdesc');\r
- }\r
- \r
- /**\r
- * Blog::isPublic()\r
- * @param void\r
- * @return integer publlic or not\r
- */\r
- public function isPublic()\r
- {\r
- return $this->getSetting('bpublic');\r
- }\r
- \r
- /**\r
- * Blog::emailRequired()\r
- * @param void\r
- * @return integer email is required when posting comment or not\r
- */\r
- public function emailRequired()\r
- {\r
- return $this->getSetting('breqemail');\r
- }\r
- \r
- /**\r
- * Blog::getSearchable()\r
- * @param void\r
- * @return integer searchable or not\r
- */\r
- public function getSearchable()\r
- {\r
- return $this->getSetting('bincludesearch');\r
- }\r
- \r
- /**\r
- * Blog::getDefaultCategory()\r
- * @param void\r
- * @return ID for category as a default\r
- */\r
- public function getDefaultCategory()\r
- {\r
- return $this->getSetting('bdefcat');\r
- }\r
- \r
- /**\r
- * Blog::setPublic()\r
- * @param integer $val allow comments by non-registered members or not\r
- * @return void\r
- */\r
- public function setPublic($val)\r
- {\r
- $this->setSetting('bpublic', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setSearchable()\r
- * @param integer $val searchable from the other blogs or not\r
- * @return void\r
- */\r
- public function setSearchable($val)\r
- {\r
- $this->setSetting('bincludesearch', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setDescription\r
- * @param string $val description for this weblog\r
- * @return void\r
- */\r
- public function setDescription($val)\r
- {\r
- $this->setSetting('bdesc',$val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setUpdateFile()\r
- * @param string $val name of file to beupdated when weblog is updated\r
- * @return \r
- */\r
- public function setUpdateFile($val)\r
- {\r
- $this->setSetting('bupdate',$val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setDefaultSkin()\r
- * @param integer $val ID for default skin to use when displaying this weblog\r
- * @return void\r
- */\r
- public function setDefaultSkin($val)\r
- {\r
- $this->setSetting('bdefskin', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setURL()\r
- * @param string $val URI for this weblog\r
- * @return \r
- */\r
- public function setURL($val)\r
- {\r
- $this->setSetting('burl', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setName()\r
- * @param string $val name of this weblog\r
- * @return void\r
- */\r
- public function setName($val)\r
- {\r
- $this->setSetting('bname', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setShortName()\r
- * @param string $val short name for this weblog\r
- * @return void\r
- */\r
- public function setShortName($val)\r
- {\r
- $this->setSetting('bshortname', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setCommentsEnabled()\r
- * @param integer $val enabling posting comment or not\r
- * @return void\r
- */\r
- public function setCommentsEnabled($val)\r
- {\r
- $this->setSetting('bcomments',$val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setMaxComments()\r
- * @param integer $val maximum number of comments for this weblog\r
- * @return void\r
- */\r
- public function setMaxComments($val)\r
- {\r
- $this->setSetting('bmaxcomments', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setNotifyAddress()\r
- * @param string $val email to be notified if weblog updated\r
- * @return void\r
- */\r
- public function setNotifyAddress($val)\r
- {\r
- $this->setSetting('bnotify', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setEmailRequired()\r
- * @param string requiring comments with email or not from non member\r
- * @return void\r
- */\r
- public function setEmailRequired($val)\r
- {\r
- $this->setSetting('breqemail', $val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setTimeOffset()\r
- * @param integer $val time offset\r
- * @return void\r
- */\r
- public function setTimeOffset($val)\r
- {\r
- // check validity of value\r
- // 1. replace , by . (common mistake)\r
- $val = str_replace(',','.',$val);\r
- \r
- // 2. cast to float or int\r
- if ( is_numeric($val) && (i18n::strpos($val, '.5') === (i18n::strlen($val) - 2)) )\r
- {\r
- $val = (float) $val;\r
- }\r
- else\r
- {\r
- $val = (integer) $val;\r
- }\r
- \r
- $this->setSetting('btimeoffset',$val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::setDefaultCategory()\r
- * @param integer $val ID for default category for this weblog\r
- * @return \r
- */\r
- public function setDefaultCategory($val)\r
- {\r
- $this->setSetting('bdefcat',$val);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::getSetting()\r
- * @param string $key key for setting of this weblog\r
- * @return mixed value for the setting\r
- */\r
- public function getSetting($key)\r
- {\r
- return $this->settings[$key];\r
- }\r
- \r
- /**\r
- * Blog::setSetting()\r
- * @param string $key key for setting of this weblog\r
- * @param mixed $value value for the key\r
- * @return \r
- */\r
- public function setSetting($key, $value)\r
- {\r
- $this->settings[$key] = $value;\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::addTeamMember()\r
- * Tries to add a member to the team. \r
- * Returns false if the member was already on the team\r
- * \r
- * @param integer $memberid id for member\r
- * @param boolean $admin super-admin or not\r
- * @return boolean Success/Fail\r
- */\r
- public function addTeamMember($memberid, $admin)\r
- {\r
- global $manager;\r
- \r
- $memberid = intval($memberid);\r
- $admin = intval($admin);\r
- \r
- // check if member is already a member\r
- $tmem =& $manager->getMember($memberid);\r
- \r
- if ( $tmem->isTeamMember($this->blogid) )\r
- {\r
- return 0;\r
- }\r
- \r
- $data = array(\r
- 'blog' => &$this,\r
- 'member' => &$tmem,\r
- 'admin' => &$admin\r
- );\r
- $manager->notify('PreAddTeamMember', $data);\r
- \r
- // add to team\r
- $query = "INSERT INTO %s (TMEMBER, TBLOG, TADMIN) VALUES (%d, %d, %d);";\r
- $query = sprintf($query, sql_table('team'), (integer) $memberid, (integer) $this->blogid, (integer) $admin);\r
- DB::execute($query);\r
- \r
- $data = array(\r
- 'blog' => &$this,\r
- 'member' => &$tmem,\r
- 'admin' => $admin\r
- );\r
- $manager->notify('PostAddTeamMember', $data);\r
- \r
- $logMsg = sprintf(_TEAM_ADD_NEWTEAMMEMBER, $tmem->getDisplayName(), $memberid, $this->getName());\r
- ActionLog::add(INFO, $logMsg);\r
- \r
- return 1;\r
- }\r
- \r
- /**\r
- * Blog::getID()\r
- * @param void\r
- * @return integer ID for this weblog\r
- */\r
- public function getID()\r
- {\r
- return (integer) $this->blogid;\r
- }\r
- \r
- /**\r
- * Checks if a blog with a given shortname exists \r
- * Returns true if there is a blog with the given shortname (static)\r
- * \r
- * @param string $name blog shortname\r
- * @return boolean exists or not\r
- */\r
- public function exists($name)\r
- {\r
- $r = DB::getResult('SELECT * FROM '.sql_table('blog').' WHERE bshortname='. DB::quoteValue($name));\r
- return ($r->rowCount() != 0);\r
- }\r
- \r
- /**\r
- * Checks if a blog with a given id exists \r
- * Returns true if there is a blog with the given ID (static)\r
- * \r
- * @param integer $id ID for searched weblog\r
- * @return boolean exists or not\r
- */\r
- public function existsID($id)\r
- {\r
- $r = DB::getResult('SELECT * FROM '.sql_table('blog').' WHERE bnumber='.intval($id));\r
- return ($r->rowCount() != 0);\r
- }\r
- \r
- /**\r
- * Blog::setFuturePost()\r
- * flag there is a future post pending\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function setFuturePost()\r
- {\r
- $query = "UPDATE %s SET bfuturepost='1' WHERE bnumber=%d;";\r
- $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);\r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::clearFuturePost()\r
- * clear there is a future post pending\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function clearFuturePost()\r
- {\r
- $query = "UPDATE %s SET bfuturepost='0' WHERE bnumber=%d;";\r
- $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);\r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::checkJustPosted()\r
- * check if we should throw justPosted event \r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function checkJustPosted()\r
- {\r
- global $manager;\r
- \r
- if ( $this->settings['bfuturepost'] == 1 )\r
- {\r
- $query = "SELECT * FROM %s WHERE iposted=0 AND iblog=%d AND itime < NOW();";\r
- $query = sprintf($query, sql_table('item'), (integer) $this->blogid);\r
- \r
- $result = DB::getResult($query);\r
- if ( $result->rowCount() > 0 )\r
- {\r
- // This $pinged is allow a plugin to tell other hook to the event that a ping is sent already\r
- // Note that the plugins's calling order is subject to thri order in the plugin list\r
- $pinged = FALSE;\r
- $manager->notify('JustPosted', array('blogid' => $this->blogid, 'pinged' => &$pinged));\r
- \r
- // clear all expired future posts\r
- $query = "UPDATE %s SET iposted='1' WHERE iblog=%d AND itime < NOW();";\r
- $query = spriintf($query, sql_table('item'), (integer) $this->blogid);\r
- DB::execute($query);\r
- \r
- // check to see any pending future post, clear the flag is none\r
- $query = "SELECT * FROM %s WHERE iposted=0 AND iblog=%d;";\r
- $query = sprintf($query, sql_table('item'), (integer) $this->blogid);\r
- \r
- $result = DB::getResult($query);\r
- if ( $result->rowCount() == 0 )\r
- {\r
- $this->clearFuturePost();\r
- }\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Blog::readLogFromList()\r
- * Shows the given list of items for this blog\r
- *\r
- * @param array $itemarray array of item numbers to be displayed\r
- * @param string $template string representing the template _NAME_ (!)\r
- * @param string $highlight contains a query that should be highlighted\r
- * @param boolean $comments 1=show comments 0=don't show comments\r
- * @param boolean $dateheads 1=show dateheads 0=don't show dateheads\r
- * @param boolean $showDrafts 0=do not show drafts 1=show drafts\r
- * @param boolean $showFuture 0=do not show future posts 1=show future posts\r
- * @return integer amount of items shown\r
- */\r
- public function readLogFromList($itemarray, $template, $highlight = '', $comments = 1, $dateheads = 1,$showDrafts = 0, $showFuture = 0)\r
- {\r
- $query = $this->getSqlItemList($itemarray,$showDrafts,$showFuture);\r
- return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);\r
- }\r
- \r
- /**\r
- * Blog::getSqlItemList()\r
- * Returns the SQL query used to fill out templates for a list of items\r
- * No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
- *\r
- * @param array $itemarray an array holding the item numbers of the items to be displayed\r
- * @param integer $showDrafts 0=do not show drafts 1=show drafts\r
- * @param integer $showFuture 0=do not show future posts 1=show future posts\r
- * @return string either a full SQL query, or an empty string\r
- */\r
- public function getSqlItemList($itemarray,$showDrafts = 0,$showFuture = 0)\r
- {\r
- if ( !is_array($itemarray) )\r
- {\r
- return '';\r
- }\r
- \r
- $showDrafts = intval($showDrafts);\r
- $showFuture = intval($showFuture);\r
- $items = array();\r
- \r
- foreach ( $itemarray as $value )\r
- {\r
- if ( intval($value) )\r
- {\r
- $items[] = intval($value);\r
- }\r
- }\r
- if ( !count($items) )\r
- {\r
- return '';\r
- }\r
- \r
- $i = count($items);\r
- $query = '';\r
- foreach ( $items as $value )\r
- {\r
- $query .= '('\r
- . 'SELECT'\r
- . ' i.inumber as itemid,'\r
- . ' i.ititle as title,'\r
- . ' i.ibody as body,'\r
- . ' m.mname as author,'\r
- . ' m.mrealname as authorname,'\r
- . ' i.itime,'\r
- . ' i.imore as more,'\r
- . ' m.mnumber as authorid,'\r
- . ' m.memail as authormail,'\r
- . ' m.murl as authorurl,'\r
- . ' c.cname as category,'\r
- . ' i.icat as catid,'\r
- . ' i.iclosed as closed';\r
- \r
- $query .= ' FROM '\r
- . sql_table('item') . ' as i, '\r
- . sql_table('member') . ' as m, '\r
- . sql_table('category') . ' as c'\r
- . ' WHERE'\r
- . ' i.iblog='.$this->blogid\r
- . ' and i.iauthor=m.mnumber'\r
- . ' and i.icat=c.catid';\r
- \r
- // exclude drafts \r
- if ( !$showDrafts )\r
- {\r
- $query .= ' and i.idraft=0';\r
- }\r
- if ( !$showFuture )\r
- {\r
- // don't show future items\r
- $query .= ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime());\r
- }\r
- \r
- $query .= ' and i.inumber='.intval($value);\r
- $query .= ')';\r
- $i--;\r
- if ($i) $query .= ' UNION ';\r
- }\r
- \r
- return $query;\r
- }\r
- \r
- /**\r
- * Blog::convertBreaks()\r
- * Get the the setting for the line break handling\r
- * [should be named as getConvertBreaks()]\r
- * \r
- * @deprecated\r
- * @param void\r
- * @return \r
- */\r
- public function convertBreaks()\r
- {\r
- return $this->getSetting('bconvertbreaks');\r
- }\r
- \r
- /**\r
- * Set the the setting for the line break handling\r
- * \r
- * @deprecated\r
- * @param boolean $val new value for bconvertbreaks\r
- * @return void\r
- */\r
- public function setConvertBreaks($val)\r
- {\r
- $this->setSetting('bconvertbreaks', $val);\r
- return;\r
- }\r
-}\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class representing a blog and containing functions to get that blog shown
+ * on the screen
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: BLOG.php 1624 2012-01-09 11:36:20Z sakamocchi $
+ */
+
+if ( !function_exists('requestVar') ) exit;
+require_once dirname(__FILE__) . '/ITEMACTIONS.php';
+
+class Blog
+{
+ // blog id
+ public $blogid;
+
+ // After creating an object of the blog class, contains true if the BLOG object is
+ // valid (the blog exists)
+ public $isValid;
+
+ // associative array, containing all blogsettings (use the get/set functions instead)
+ private $settings;
+
+ // ID of currently selected category
+ private $selectedcatid;
+
+ /**
+ * Blog::_\construct()
+ * Creates a new BLOG object for the given blog
+ *
+ * @param integer $id blogid
+ * @return void
+ */
+ public function __construct($id)
+ {
+ global $catid;
+
+ $this->blogid = (integer) $id;
+ $this->readSettings();
+ $this->setSelectedCategory($catid);
+ return;
+ }
+
+ /**
+ * Blog::readLog()
+ * Shows the given amount of items for this blog
+ *
+ * @param string $template String representing the template _NAME_ (!)
+ * @param integer $amountEntries amount of entries to show
+ * @param integer $startpos offset from where items should be shown (e.g. 5 = start at fifth item)
+ * @return integer amount of items shown
+ */
+ public function readLog($template, $amountEntries, $offset = 0, $startpos = 0)
+ {
+ return $this->readLogAmount($template,$amountEntries,'','',1,1,$offset, $startpos);
+ }
+
+ /**
+ * Blog::showArchive()
+ * Shows an archive for a given month
+ *
+ * @param integer $year year
+ * @param integer $month month
+ * @param string $template String representing the template name to be used
+ * @return void
+ */
+ public function showArchive($templatename, $year, $month=0, $day=0)
+ {
+ // create extra where clause for select query
+ if ( $day == 0 && $month != 0 )
+ {
+ $timestamp_start = mktime(0,0,0,$month,1,$year);
+ // also works when $month==12
+ $timestamp_end = mktime(0,0,0,$month+1,1,$year);
+ }
+ elseif ( $month == 0 )
+ {
+ $timestamp_start = mktime(0,0,0,1,1,$year);
+ // also works when $month==12
+ $timestamp_end = mktime(0,0,0,12,31,$year);
+ }
+ else
+ {
+ $timestamp_start = mktime(0,0,0,$month,$day,$year);
+ $timestamp_end = mktime(0,0,0,$month,$day+1,$year);
+ }
+ $extra_query = " and i.itime>=%s and i.itime<%s";
+ $extra_query = sprintf($extra_query, DB::formatDateTime($timestamp_start), DB::formatDateTime($timestamp_end));
+
+ $this->readLogAmount($templatename,0,$extra_query,'',1,1);
+ return;
+ }
+
+ /**
+ * Blog::setSelectedCategory()
+ * Sets the selected category by id (only when category exists)
+ *
+ * @param integer $catid ID for category
+ * @return void
+ */
+ public function setSelectedCategory($catid)
+ {
+ if ( $this->isValidCategory($catid) || (intval($catid) == 0) )
+ {
+ $this->selectedcatid = intval($catid);
+ }
+ return;
+ }
+
+ /**
+ * Blog::setSelectedCategoryByName()
+ * Sets the selected category by name
+ *
+ * @param string $catname name of category
+ * @return void
+ */
+ public function setSelectedCategoryByName($catname)
+ {
+ $this->setSelectedCategory($this->getCategoryIdFromName($catname));
+ return;
+ }
+
+ /**
+ * Blog::getSelectedCategory()
+ * Returns the selected category
+ *
+ * @param void
+ * @return integer
+ */
+ public function getSelectedCategory()
+ {
+ return $this->selectedcatid;
+ }
+
+ /**
+ * Shows the given amount of items for this blog
+ *
+ * @param string $template string representing the template _NAME_ (!)
+ * @param integer $amountEntries amount of entries to show (0 = no limit)
+ * @param string $extraQuery extra conditions to be added to the query
+ * @param string $highlight contains a query that should be highlighted
+ * @param integer $comments 1=show comments 0=don't show comments
+ * @param integer $dateheads 1=show dateheads 0=don't show dateheads
+ * @param integer $offset offset
+ * @return integer amount of items shown
+ */
+ private function readLogAmount($template, $amountEntries, $extraQuery, $highlight, $comments, $dateheads, $offset = 0, $startpos = 0)
+ {
+ $query = $this->getSqlBlog($extraQuery);
+
+ if ( $amountEntries > 0 )
+ {
+ // $offset zou moeten worden:
+ // (($startpos / $amountentries) + 1) * $offset ... later testen ...
+ $query .= ' LIMIT ' . intval($startpos + $offset).',' . intval($amountEntries);
+ }
+ return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);
+ }
+
+ /**
+ * Blog::showUsingQuery()
+ * Do the job for readLogAmmount
+ *
+ * @param string $templateName template name
+ * @param string $query string for query
+ * @param string $highlight string to be highlighted
+ * @param integer $comments the number of comments
+ * @param boolean $dateheads date header is needed or not
+ * @return integer the number of rows as a result of mysql query
+ */
+ private function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1)
+ {
+ global $CONF, $manager, $currentTemplateName;
+
+ $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit');
+ if ( $lastVisit != 0 )
+ {
+ $lastVisit = $this->getCorrectTime($lastVisit);
+ }
+
+ // set templatename as global variable (so plugins can access it)
+ $currentTemplateName = $templateName;
+ $template =& $manager->getTemplate($templateName);
+
+ // create parser object & action handler
+ $handler = new ItemActions($this);
+ $handler->setTemplate($template);
+ $handler->setHighlight($highlight);
+ $handler->setLastVisit($lastVisit);
+ $handler->setShowComments($comments);
+
+ $parser = new Parser($handler);
+
+ // execute query
+ $items = DB::getResult($query);
+
+ // loop over all items
+ $old_date = 0;
+ foreach ( $items as $item )
+ {
+ // string timestamp -> unix timestamp
+ $item['timestamp'] = strtotime($item['itime']);
+
+ // action handler needs to know the item we're handling
+ $handler->setCurrentItem($item);
+
+ // add date header if needed
+ if ( $dateheads )
+ {
+ $new_date = date('dFY', $item['timestamp']);
+ if ( $new_date != $old_date )
+ {
+ // unless this is the first time, write date footer
+ $timestamp = $item['timestamp'];
+ if ( $old_date != 0 )
+ {
+ $oldTS = strtotime($old_date);
+ $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));
+
+ if ( !in_array('DATE_FOOTER', $template) || empty($template['DATE_FOOTER']) )
+ {
+ $tmp_footer = '';
+ }
+ else
+ {
+ $tmp_footer = i18n::formatted_datetime($template['DATE_FOOTER'], $oldTS);
+ }
+ $parser->parse($tmp_footer);
+ $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));
+ }
+
+ $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));
+
+ // note, to use templatvars in the dateheader, the %-characters need to be doubled in
+ // order to be preserved by strftime
+ if ( !in_array('DATE_HEADER', $template) || empty($template['DATE_HEADER']) )
+ {
+ $tmp_header = '';
+ }
+ else
+ {
+ $tmp_header = i18n::formatted_datetime($template['DATE_HEADER'], $timestamp);
+ }
+ $parser->parse($tmp_header);
+ $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));
+ }
+ $old_date = $new_date;
+ }
+
+ // parse item
+ $parser->parse($template['ITEM_HEADER']);
+ $manager->notify('PreItem', array('blog' => &$this, 'item' => &$item));
+ $parser->parse($template['ITEM']);
+ $manager->notify('PostItem', array('blog' => &$this, 'item' => &$item));
+ $parser->parse($template['ITEM_FOOTER']);
+ }
+
+ $numrows = $items->rowCount();
+
+ // add another date footer if there was at least one item
+ if ( ($numrows > 0) && $dateheads )
+ {
+ $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));
+ $parser->parse($template['DATE_FOOTER']);
+ $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));
+ }
+
+ $items->closeCursor();
+ return $numrows;
+ }
+
+ /**
+ * Blog::showOneitem()
+ * Simplified function for showing only one item
+ *
+ * @param integer $itemid ID for item
+ * @param array $template template for item
+ * @param string $highlight string for highlight
+ * @return integer 1
+ */
+ public function showOneitem($itemid, $template, $highlight)
+ {
+ $extraQuery = ' and inumber=' . intval($itemid);
+
+ return $this->readLogAmount($template, 1, $extraQuery, $highlight, 0, 0);
+ }
+
+ /**
+ * Blog::addItem()
+ * Adds an item to this blog
+ *
+ * @param integer $catid ID for category
+ * @param string $title ID for
+ * @param string $body text for body
+ * @param string $more text for more
+ * @param integer $blogid ID for blog
+ * @param integer $authorid ID for author
+ * @param timestamp $timestamp UNIX timestamp for post
+ * @param boolean $closed opened or closed
+ * @param boolean $draft draft or not
+ * @param boolean $posted posted or not
+ * @return integer ID for added item
+ */
+ function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft, $posted='1')
+ {
+ global $manager;
+
+ $blogid = (integer) $blogid;
+ $authorid = (integer) $authorid;
+ $title = $title;
+ $body = $body;
+ $more = $more;
+ $catid = intval($catid);
+
+ // convert newlines to <br />
+ if ( $this->convertBreaks() )
+ {
+ $body = addBreaks($body);
+ $more = addBreaks($more);
+ }
+
+ if ( $closed != '1' )
+ {
+ $closed = '0';
+ }
+ if ( $draft != '0' )
+ {
+ $draft = '1';
+ }
+
+ if ( !$this->isValidCategory($catid) )
+ {
+ $catid = $this->getDefaultCategory();
+ }
+
+ $isFuture = 0;
+ if ( $timestamp > $this->getCorrectTime() )
+ {
+ $isFuture = 1;
+ }
+
+ $timestamp = date('Y-m-d H:i:s',$timestamp);
+
+ $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid));
+
+ $ititle = DB::quoteValue($title);
+ $ibody = DB::quoteValue($body);
+ $imore = DB::quoteValue($more);
+ $timestamp = DB::formatDateTime(strtotime($timestamp));
+
+ $query = "INSERT INTO %s (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT, IPOSTED) VALUES (%s, %s, %s, %d, %d, %s, %s, %s, %s, %s)";
+ $query = sprintf($query, sql_table('item'), $ititle, $ibody, $imore, $blogid, $authorid, $timestamp, $closed, $draft, $catid, $posted);
+ DB::execute($query);
+ $itemid = DB::getInsertId();
+
+ $manager->notify('PostAddItem',array('itemid' => $itemid));
+
+ if ( !$draft )
+ {
+ $this->updateUpdateFile();
+ }
+ // send notification mail
+ if ( !$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem() )
+ {
+ $this->sendNewItemNotification($itemid, $title, $body);
+ }
+ return $itemid;
+ }
+
+ /**
+ * Blog::sendNewItemNotification()
+ * Send a new item notification to the notification list
+ *
+ * @param string $itemid ID of the item
+ * @param string $title title of the item
+ * @param string $body body of the item
+ * @return void
+ */
+ public function sendNewItemNotification($itemid, $title, $body)
+ {
+ global $CONF, $member;
+
+ $ascii = Entity::anchor_footnoting($body);
+
+ $message = _NOTIFY_NI_MSG . " \n";
+ $temp = parse_url($CONF['Self']);
+ if ( $temp['scheme'] )
+ {
+ $message .= Link::create_item_link($itemid) . "\n\n";
+ }
+ else
+ {
+ $tempurl = $this->getURL();
+ if ( i18n::substr($tempurl, -1) == '/' || i18n::substr($tempurl, -4) == '.php' )
+ {
+ $message .= $tempurl . '?itemid=' . $itemid . "\n\n";
+ }
+ else
+ {
+ $message .= $tempurl . '/?itemid=' . $itemid . "\n\n";
+ }
+ }
+ $message .= _NOTIFY_TITLE . ' ' . strip_tags($title) . "\n";
+ $message .= _NOTIFY_CONTENTS . "\n " . $ascii . "\n";
+ $message .= NOTIFICATION::get_mail_footer();
+
+ $subject = $this->getName() . ': ' . _NOTIFY_NI_TITLE;
+
+ $from = $member->getNotifyFromMailAddress();
+
+ NOTIFICATION::mail($this->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());
+ return;
+ }
+
+ /**
+ * Blog::createNewCategory()
+ * Creates a new category for this blog
+ *
+ * @param string $catName name of the new category. When empty, a name is generated automatically (starting with newcat)
+ * @param string $catDescription description of the new category. Defaults to 'New Category'
+ * @return integer ID for new category on success. 0 on failure
+ */
+ public function createNewCategory($catName = '', $catDescription = _CREATED_NEW_CATEGORY_DESC)
+ {
+ global $member, $manager;
+
+ if ( !$member->blogAdminRights($this->blogid) )
+ {
+ return 0;
+ }
+
+ // generate
+ if ( $catName == '' )
+ {
+ $catName = _CREATED_NEW_CATEGORY_NAME;
+ $i = 1;
+
+ $res = DB::getResult('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->blogid);
+ while ( $res->rowCount() > 0 )
+ {
+ $i++;
+ $res = DB::getResult('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->blogid);
+ }
+
+ $catName = $catName . $i;
+ }
+
+ $data = array(
+ 'blog' => &$this,
+ 'name' => &$catName,
+ 'description' => $catDescription
+ );
+ $manager->notify('PreAddCategory', $data);
+
+ $query = "INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, %s, %s)";
+ $query = sprintf($query, sql_table('category'), (integer) $this->blogid, DB::quoteValue($catName), DB::quoteValue($catDescription));
+ DB::execute($query);
+ $catid = DB::getInsertId();
+
+ $data = array(
+ 'blog' => &$this,
+ 'name' => $catName,
+ 'description' => $catDescription,
+ 'catid' => $catid
+ );
+ $manager->notify('PostAddCategory', $data);
+
+ return $catid;
+ }
+
+ /**
+ * Blog::search()
+ * Searches all months of this blog for the given query
+ *
+ * @param string $query search query
+ * @param array $template template to be used (__NAME__ of the template)
+ * @param integer $amountMonths max amount of months to be search (0 = all)
+ * @param integer $maxresults max number of results to show
+ * @param integer $startpos offset
+ * @return amount of hits found
+ */
+ public function search($query, $template, $amountMonths, $maxresults, $startpos) {
+ global $CONF, $manager;
+
+ $highlight = '';
+ $sqlquery = $this->getSqlSearch($query, $amountMonths, $highlight);
+
+ if ( $sqlquery == '' )
+ {
+ // no query -> show everything
+ $extraquery = '';
+ $amountfound = $this->readLogAmount($template, $maxresults, $extraQuery, $query, 1, 1);
+ }
+ else
+ {
+ // add LIMIT to query (to split search results into pages)
+ if ( intval($maxresults > 0) )
+ {
+ $sqlquery .= ' LIMIT ' . intval($startpos) . ',' . intval($maxresults);
+ }
+
+ // show results
+ $amountfound = $this->showUsingQuery($template, $sqlquery, $highlight, 1, 1);
+
+ // when no results were found, show a message
+ if ( $amountfound == 0 )
+ {
+ $template =& $manager->getTemplate($template);
+ $vars = array(
+ 'query' => Entity::hsc($query),
+ 'blogid' => $this->blogid
+ );
+ echo Template::fill($template['SEARCH_NOTHINGFOUND'], $vars);
+ }
+ }
+ return $amountfound;
+ }
+
+ /**
+ * Blog::getSqlSearch()
+ * Returns an SQL query to use for a search query
+ * No LIMIT clause is added. (caller should add this if multiple pages are requested)
+ *
+ * @param string $query search query
+ * @param integer $amountMonths amount of months to search back. Default = 0 = unlimited
+ * @param string $mode either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query
+ * @return string $highlight words to highlight (out parameter)
+ * @return string either a full SQL query, or an empty string (if querystring empty)
+ */
+ public function getSqlSearch($query, $amountMonths = 0, &$highlight, $mode = '')
+ {
+ $searchclass = new Search($query);
+
+ $highlight = $searchclass->inclusive;
+
+ // if querystring is empty, return empty string
+ if ( $searchclass->inclusive == '' )
+ {
+ return '';
+ }
+
+ $where = $searchclass->boolean_sql_where('ititle,ibody,imore');
+ $select = $searchclass->boolean_sql_select('ititle,ibody,imore');
+
+ // get list of blogs to search
+ $blogs = $searchclass->blogs; // array containing blogs that always need to be included
+ $blogs[] = $this->blogid; // also search current blog (duh)
+ $blogs = array_unique($blogs); // remove duplicates
+ $selectblogs = '';
+ if ( count($blogs) > 0 )
+ {
+ $selectblogs = ' and i.iblog in (' . implode(',', $blogs) . ')';
+ }
+
+ if ( $mode == '' )
+ {
+ $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, i.itime, i.imore as more, i.icat as catid, i.iclosed as closed,
+ m.mname as author, m.mrealname as authorname, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl,
+ c.cname as category';
+
+ if ( $select )
+ {
+ $query .= ', '.$select. ' as score ';
+ }
+ }
+ else
+ {
+ $query = 'SELECT COUNT(*) as result ';
+ }
+
+ $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'
+ . ' WHERE i.iauthor=m.mnumber'
+ . ' and i.icat=c.catid'
+ // exclude drafts
+ . ' and i.idraft=0'
+ . $selectblogs
+ // don't show future items
+ . ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime())
+ . ' and '.$where;
+
+ // take into account amount of months to search
+ if ( $amountMonths > 0 )
+ {
+ $localtime = getdate($this->getCorrectTime());
+ $timestamp_start = mktime(0,0,0,$localtime['mon'] - $amountMonths,1,$localtime['year']);
+ $query .= ' and i.itime>' . DB::formatDateTime($timestamp_start);
+ }
+
+ if ( $mode == '' )
+ {
+ if ( $select )
+ {
+ $query .= ' ORDER BY score DESC';
+ }
+ else
+ {
+ $query .= ' ORDER BY i.itime DESC ';
+ }
+ }
+
+ return $query;
+ }
+
+ /**
+ * Blog::getSqlBlog()
+ * Returns the SQL query that's normally used to display the blog items on the index type skins
+ * No LIMIT clause is added. (caller should add this if multiple pages are requested)
+ *
+ * @param string $extraQuery extra query string
+ * @param string $mode either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query
+ * @return string either a full SQL query, or an empty string
+ */
+ public function getSqlBlog($extraQuery, $mode = '')
+ {
+ if ( $mode == '' )
+ {
+ $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author,
+ m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail,
+ m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';
+ }
+ else
+ {
+ $query = 'SELECT COUNT(*) as result ';
+ }
+
+ $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'
+ . ' WHERE i.iblog='.$this->blogid
+ . ' and i.iauthor=m.mnumber'
+ . ' and i.icat=c.catid'
+ . ' and i.idraft=0' // exclude drafts
+ . ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime()); // don't show future items
+
+ if ( $this->selectedcatid )
+ {
+ $query .= ' and i.icat=' . $this->selectedcatid . ' ';
+ }
+
+ $query .= $extraQuery;
+
+ if ( $mode == '' )
+ {
+ $query .= ' ORDER BY i.itime DESC';
+ }
+ return $query;
+ }
+
+ /**
+ * Blog::showArchiveList()
+ * Shows the archivelist using the given template
+ *
+ * @param string $template template name
+ * @param string $mode year/month/day
+ * @param integer $limit limit of record count
+ * @return void
+ */
+ public function showArchiveList($template, $mode = 'month', $limit = 0)
+ {
+ global $CONF, $catid, $manager;
+
+ if ( !isset ($linkparams) )
+ {
+ $linkparams = array();
+ }
+
+ if ( $catid )
+ {
+ $linkparams = array('catid' => $catid);
+ }
+
+ $template =& $manager->getTemplate($template);
+ $data['blogid'] = $this->blogid;
+
+ if ( !array_key_exists('ARCHIVELIST_HEADER', $template) || !$template['ARCHIVELIST_HEADER'] )
+ {
+ $tplt = '';
+ }
+ else
+ {
+ $tplt = $template['ARCHIVELIST_HEADER'];
+ }
+
+ echo Template::fill($tplt, $data);
+
+ $query = 'SELECT itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) AS Day'
+ . ' FROM '.sql_table('item')
+ . ' WHERE iblog=' . $this->blogid
+ . ' AND itime <=' . DB::formatDateTime($this->getCorrectTime()) // don't show future items!
+ . ' AND idraft=0'; // don't show draft items
+
+ if ( $catid )
+ {
+ $query .= ' and icat=' . intval($catid);
+ }
+
+ $query .= ' GROUP BY Year';
+ if ( $mode == 'month' || $mode == 'day' )
+ {
+ $query .= ', Month';
+ }
+ if ( $mode == 'day' )
+ {
+ $query .= ', Day';
+ }
+
+ $query .= ' ORDER BY itime DESC';
+
+ if ( $limit > 0 )
+ {
+ $query .= ' LIMIT ' . intval($limit);
+ }
+
+ $res = DB::getResult($query);
+ foreach ( $res as $current )
+ {
+ /* string time -> unix timestamp */
+ $current['itime'] = strtotime($current['itime']);
+
+ if ( $mode == 'day' )
+ {
+ $archivedate = date('Y-m-d',$current['itime']);
+ $archive['day'] = date('d',$current['itime']);
+ $data['day'] = date('d',$current['itime']);
+ $data['month'] = date('m',$current['itime']);
+ $archive['month'] = $data['month'];
+ }
+ elseif ( $mode == 'year' )
+ {
+ $archivedate = date('Y',$current['itime']);
+ $data['day'] = '';
+ $data['month'] = '';
+ $archive['day'] = '';
+ $archive['month'] = '';
+ }
+ else
+ {
+ $archivedate = date('Y-m',$current['itime']);
+ $data['month'] = date('m',$current['itime']);
+ $archive['month'] = $data['month'];
+ $data['day'] = '';
+ $archive['day'] = '';
+ }
+
+ $data['year'] = date('Y',$current['itime']);
+ $archive['year'] = $data['year'];
+ $data['archivelink'] = Link::create_archive_link($this->blogid,$archivedate,$linkparams);
+
+ $manager->notify('PreArchiveListItem', array('listitem' => &$data));
+
+ $temp = Template::fill($template['ARCHIVELIST_LISTITEM'],$data);
+ echo i18n::formatted_datetime($temp, $current['itime']);
+ return;
+ }
+
+ $res->closeCursor();
+
+ if ( !array_key_exists('ARCHIVELIST_FOOTER', $template) || !$template['ARCHIVELIST_FOOTER'] )
+ {
+ $tplt = '';
+ }
+ else
+ {
+ $tplt = $template['ARCHIVELIST_FOOTER'];
+ }
+
+ echo Template::fill($tplt, $data);
+ return;
+ }
+
+ /**
+ * Blog::showCategoryList()
+ * Shows the list of categories using a given template
+ *
+ * @param string $template Template Name
+ * @return void
+ */
+ public function showCategoryList($template)
+ {
+ global $CONF, $archive, $archivelist, $manager;
+
+ /*
+ * determine arguments next to catids
+ * I guess this can be done in a better way, but it works
+ */
+ $linkparams = array();
+ if ( $archive )
+ {
+ $blogurl = Link::create_archive_link($this->blogid, $archive, '');
+ $linkparams['blogid'] = $this->blogid;
+ $linkparams['archive'] = $archive;
+ }
+ else if ( $archivelist )
+ {
+ $blogurl = Link::create_archivelist_link($this->blogid, '');
+ $linkparams['archivelist'] = $archivelist;
+ }
+ else
+ {
+ $blogurl = Link::create_blogid_link($this->blogid, '');
+ $linkparams['blogid'] = $this->blogid;
+ }
+
+ $template =& $manager->getTemplate($template);
+
+ //: Change: Set nocatselected variable
+ if ( $this->selectedcatid )
+ {
+ $nocatselected = 'no';
+ }
+ else
+ {
+ $nocatselected = 'yes';
+ }
+
+ $args = array(
+ 'blogid' => $this->blogid,
+ 'blogurl' => $blogurl,
+ 'self' => $CONF['Self'],
+ 'catiscurrent' => $nocatselected, // Change: Set catiscurrent template variable for header
+ 'currentcat' => $nocatselected
+ );
+
+ /* output header of category list item */
+ if ( !array_key_exists('CATLIST_HEADER', $template) || empty($template['CATLIST_HEADER']) )
+ {
+ echo Template::fill(NULL, $args);
+ }
+ else
+ {
+ echo Template::fill($template['CATLIST_HEADER'], $args);
+ }
+
+ $query = "SELECT catid, cdesc as catdesc, cname as catname FROM %s WHERE cblog=%d ORDER BY cname ASC;";
+ $query = sprintf($query, sql_table('category'), (integer) $this->blogid);
+ $res = DB::getResult($query);
+
+ foreach ( $res as $data )
+ {
+ $args = array(
+ 'catid' => $data['catid'],
+ 'name' => $data['catname'],
+ 'extra' => $linkparams
+ );
+
+ $data['blogid'] = $this->blogid;
+ $data['blogurl'] = $blogurl;
+ $data['catlink'] = Link::create_link('category', $args);
+ $data['self'] = $CONF['Self'];
+
+ // this gives catiscurrent = no when no category is selected.
+ $data['catiscurrent'] = 'no';
+ $data['currentcat'] = 'no';
+
+ if ( $this->selectedcatid )
+ {
+ if ( $this->selectedcatid == $data['catid'] )
+ {
+ $data['catiscurrent'] = 'yes';
+ $data['currentcat'] = 'yes';
+ }
+ }
+ else
+ {
+ global $itemid;
+ if ( (integer) $itemid && $manager->existsItem((integer) $itemid, 0, 0) )
+ {
+ $iobj =& $manager->getItem($itemid, 0, 0);
+ $cid = $iobj['catid'];
+
+ if ( $cid == $data['catid'] )
+ {
+ $data['catiscurrent'] = 'yes';
+ $data['currentcat'] = 'yes';
+ }
+ }
+ }
+
+ $manager->notify('PreCategoryListItem', array('listitem' => &$data));
+
+ if ( !array_key_exists('CATLIST_LISTITEM', $template) || empty($template['CATLIST_LISTITEM']))
+ {
+ echo Template::fill(NULL, $data);
+ }
+ else
+ {
+ echo Template::fill($template['CATLIST_LISTITEM'], $data);
+ }
+ }
+
+ $res->closeCursor();
+
+ $args = array(
+ 'blogid' => $this->blogid,
+ 'blogurl' => $blogurl,
+ 'self' => $CONF['Self'],
+ 'catiscurrent' => $nocatselected, //: Change: Set catiscurrent template variable for footer
+ 'currentcat' => $nocatselected
+ );
+
+ if ( !array_key_exists('CATLIST_FOOTER', $template) || empty($template['CATLIST_FOOTER']))
+ {
+ echo Template::fill(NULL, $args);
+ }
+ else
+ {
+ echo Template::fill($template['CATLIST_FOOTER'], $args);
+ }
+
+ return;
+ }
+
+ /**
+ * Blog::showBlogList()
+ * Shows a list of all blogs in the system using a given template
+ * ordered by number, name, shortname or description
+ * in ascending or descending order
+ *
+ * @param string $template tempalte name
+ * @param string $bnametype bname/bshortname
+ * @param string $orderby string for 'ORDER BY' SQL
+ * @param string $direction ASC/DESC
+ * @return void
+ */
+ public function showBlogList($template, $bnametype, $orderby, $direction)
+ {
+ global $CONF, $manager;
+
+ switch ( $orderby )
+ {
+ case 'number':
+ $orderby='bnumber';
+ break;
+ case 'name':
+ $orderby='bname';
+ break;
+ case 'shortname':
+ $orderby='bshortname';
+ break;
+ case 'description':
+ $orderby='bdesc';
+ break;
+ default:
+ $orderby='bnumber';
+ break;
+ }
+
+ $direction=strtolower($direction);
+ switch ( $direction )
+ {
+ case 'asc':
+ $direction='ASC';
+ break;
+ case 'desc':
+ $direction='DESC';
+ break;
+ default:
+ $direction='ASC';
+ break;
+ }
+
+ $template =& $manager->getTemplate($template);
+
+ if ( array_key_exists('BLOGLIST_HEADER', $template) && !empty($template['BLOGLIST_HEADER']) )
+ {
+ $vars = array(
+ 'sitename' => $CONF['SiteName'],
+ 'siteurl' => $CONF['IndexURL']
+ );
+
+ echo Template::fill($template['BLOGLIST_HEADER'], $vars);
+ }
+
+ if ( array_key_exists('BLOGLIST_LISTITEM', $template) && !empty($template['BLOGLIST_LISTITEM']) )
+ {
+ $query = 'SELECT bnumber, bname, bshortname, bdesc, burl FROM '.sql_table('blog').' ORDER BY '.$orderby.' '.$direction;
+ $res = DB::getResult($query);
+
+ foreach ( $res as $data )
+ {
+ $list = array();
+ $list['bloglink'] = Link::create_blogid_link($data['bnumber']);
+ $list['blogdesc'] = $data['bdesc'];
+ $list['blogurl'] = $data['burl'];
+
+ if ( $bnametype == 'shortname' )
+ {
+ $list['blogname'] = $data['bshortname'];
+ }
+ else
+ {
+ /* all other cases */
+ $list['blogname'] = $data['bname'];
+ }
+
+ $manager->notify('PreBlogListItem',array('listitem' => &$list));
+
+ echo Template::fill($template['BLOGLIST_LISTITEM'], $list);
+ }
+
+ $res->closeCursor();
+ }
+
+
+ if ( array_key_exists('BLOGLIST_FOOTER', $template) && !empty($template['BLOGLIST_FOOTER']) )
+ {
+ $vars = array(
+ 'sitename' => $CONF['SiteName'],
+ 'siteurl' => $CONF['IndexURL']
+ );
+ echo Template::fill($template['BLOGLIST_FOOTER']);
+ }
+ return;
+ }
+
+ /**
+ * Blog::readSettings()
+ * Read the blog settings
+ *
+ * @param void
+ * @return void
+ */
+ public function readSettings()
+ {
+ $query = 'SELECT * FROM %s WHERE bnumber=%d;';
+ $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);
+ $res = DB::getResult($query);
+
+ $this->isValid = ($res->rowCount() > 0);
+ if ( $this->isValid )
+ {
+ $this->settings = $res->fetch(PDO::FETCH_ASSOC);
+ }
+ return;
+ }
+
+ /**
+ * Blog::writeSettings()
+ * Write the blog settings
+ */
+ public function writeSettings()
+ {
+ // (can't use floatval since not available prior to PHP 4.2)
+ $offset = $this->getTimeOffset();
+ if ( !is_float($offset) )
+ {
+ $offset = (integer) $offset;
+ }
+
+ $query = 'UPDATE '.sql_table('blog')
+ . ' SET bname=' . DB::quoteValue($this->getName()) . ','
+ . ' bshortname='. DB::quoteValue($this->getShortName()) . ','
+ . ' bcomments='. intval($this->commentsEnabled()) . ','
+ . ' bmaxcomments=' . intval($this->getMaxComments()) . ','
+ . ' btimeoffset=' . $offset . ','
+ . ' bpublic=' . intval($this->isPublic()) . ','
+ . ' breqemail=' . intval($this->emailRequired()) . ','
+ . ' bconvertbreaks=' . intval($this->convertBreaks()) . ','
+ . ' ballowpast=' . intval($this->allowPastPosting()) . ','
+ . ' bnotify=' . DB::quoteValue($this->getNotifyAddress()) . ','
+ . ' bnotifytype=' . intval($this->getNotifyType()) . ','
+ . ' burl=' . DB::quoteValue($this->getURL()) . ','
+ . ' bupdate=' . DB::quoteValue($this->getUpdateFile()) . ','
+ . ' bdesc=' . DB::quoteValue($this->getDescription()) . ','
+ . ' bdefcat=' . intval($this->getDefaultCategory()) . ','
+ . ' bdefskin=' . intval($this->getDefaultSkin()) . ','
+ . ' bincludesearch=' . intval($this->getSearchable())
+ . ' WHERE bnumber=' . intval($this->blogid);
+ DB::execute($query);
+ return;
+ }
+
+ /**
+ * Blog::updateUpdatefile()
+ * Update the update file if requested
+ *
+ * @param void
+ * @return void
+ */
+ public function updateUpdatefile()
+ {
+ if ( $this->getUpdateFile() )
+ {
+ $f_update = fopen($this->getUpdateFile(), 'w');
+ fputs($f_update,$this->getCorrectTime());
+ fclose($f_update);
+ }
+ return;
+ }
+
+ /**
+ * Blog::isValidCategory()
+ * Check if a category with a given catid is valid
+ *
+ * @param integer $catid ID for category
+ * @return boolean exists or not
+ */
+ public function isValidCategory($catid)
+ {
+ $query = 'SELECT * FROM %s WHERE cblog=%d and catid=%d;';
+ $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);
+ $res = DB::getResult($query);
+ return ($res->rowCount() != 0);
+ }
+
+ /**
+ * Blog::getCategoryName()
+ * Get the category name for a given catid
+ *
+ * @param integer $catid ID for category
+ * @return string name of category
+ */
+ public function getCategoryName($catid)
+ {
+ $query = 'SELECT cname FROM %s WHERE cblog=%d and catid=%d;';
+ $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);
+ $res = DB::getValue($query);
+ return $res;
+ }
+
+ /**
+ * Blog::getCategoryDesc()
+ * Get the category description for a given catid
+ *
+ * @param $catid
+ * category id
+ */
+ public function getCategoryDesc($catid)
+ {
+ $query = 'SELECT cdesc FROM %s WHERE cblog=%d and catid=%d;';
+ $query = sprintf($querym, sql_table('category'), (integer) $this->blogid, (integer) $catid);
+ $res = DB::getValue();
+ return $res;
+ }
+
+ /**
+ * Blog::getCategoryIdFromName
+ * Get the category id for a given category name
+ *
+ * @param string $name category name
+ * @return ID for category
+ */
+ public function getCategoryIdFromName($name)
+ {
+ $query = 'SELECT catid FROM %s WHERE cblog=%d and cname=%s;';
+ $query = sprintf($query, sql_table('category'), (integer) $this->blogid, DB::quoteValue($name));
+
+ $res = DB::getValue();
+ if ( !$res )
+ {
+ return $this->getDefaultCategory();
+ }
+ return $res;
+ }
+
+ /**
+ * Blog::insertJavaScriptInfo()
+ * Insert a javascript that includes information about the settings
+ * of an author: ConvertBreaks, MediaUrl and AuthorId
+ *
+ * @param $authorid id of the author
+ */
+ public function insertJavaScriptInfo($authorid = '')
+ {
+ global $member, $CONF;
+
+ if ( $authorid == '' )
+ {
+ $authorid = $member->getID();
+ }
+
+ echo "<script type=\"text/javascript\">\n";
+
+ if ( !$this->convertBreaks() )
+ {
+ echo "setConvertBreaks(false);\n";
+ }
+ else
+ {
+ echo "setConvertBreaks(true);\n";
+ }
+ echo "setMediaUrl('{$CONF['MediaURL']}');\n";
+ echo "setAuthorId('{$authorid}');\n";
+ echo "</script>\n";
+ return;
+ }
+
+ /**
+ * Blog::setAllowPastPosting()
+ * Set the the setting for allowing to publish postings in the past
+ *
+ * @param boolean $val new value for ballowpast
+ * @return void
+ */
+ public function setAllowPastPosting($val)
+ {
+ $this->setSetting('ballowpast', $val);
+ return;
+ }
+
+ /**
+ * Blog::allowPastPosting()
+ * Get the the setting if it is allowed to publish postings in the past
+ * [should be named as getAllowPastPosting()]
+ *
+ * @param void
+ * @return boolean
+ */
+ public function allowPastPosting()
+ {
+ return $this->getSetting('ballowpast');
+ }
+
+ /**
+ * Blog::getCorrectTime()
+ *
+ * @param integer $t
+ * @return integer
+ */
+ public function getCorrectTime($t=0)
+ {
+ if ( $t == 0 )
+ {
+ $t = time();
+ }
+ return ($t + 3600 * $this->getTimeOffset());
+ }
+
+ /**
+ * Blog::getName()
+ *
+ * @param void
+ * @return string name of this weblog
+ */
+ public function getName()
+ {
+ return $this->getSetting('bname');
+ }
+
+ /**
+ * Blog::getShortName()
+ *
+ * @param void
+ * @return string short name of this weblog
+ */
+ public function getShortName()
+ {
+ return $this->getSetting('bshortname');
+ }
+
+ /**
+ * Blog::getMaxComments()
+ *
+ * @param void
+ * @return integer maximum number of comments
+ */
+ public function getMaxComments()
+ {
+ return $this->getSetting('bmaxcomments');
+ }
+
+ /**
+ * Blog::getNotifyAddress()
+ *
+ * @param void
+ * @return string mail address for notifying
+ */
+ public function getNotifyAddress()
+ {
+ return $this->getSetting('bnotify');
+ }
+
+ /**
+ * Blog::getNotifyType()
+ *
+ * @param void
+ * @return integer notifycation type
+ */
+ public function getNotifyType()
+ {
+ return $this->getSetting('bnotifytype');
+ }
+
+ /**
+ * Blog::notifyOnComment()
+ *
+ * @param void
+ * @return boolean
+ */
+ public function notifyOnComment()
+ {
+ $n = $this->getNotifyType();
+ return (($n != 0) && (($n % 3) == 0));
+ }
+
+ /**
+ * Blog::notifyOnVote()
+ *
+ * @param void
+ * @return boolean
+ */
+ public function notifyOnVote()
+ {
+ $n = $this->getNotifyType();
+ return (($n != 0) && (($n % 5) == 0));
+ }
+
+ /**
+ * Blog::notifyOnNewItem()
+ *
+ * @param void
+ * @return boolean
+ */
+ public function notifyOnNewItem()
+ {
+ $n = $this->getNotifyType();
+ return (($n != 0) && (($n % 7) == 0));
+ }
+
+ /**
+ * Blog::setNotifyType()
+ *
+ * @param integer $val
+ * @return void
+ */
+ public function setNotifyType($val)
+ {
+ $this->setSetting('bnotifytype',$val);
+ return;
+ }
+
+ /**
+ * Blog::getTimeOffset()
+ * @param void
+ * @return
+ */
+ public function getTimeOffset()
+ {
+ return $this->getSetting('btimeoffset');
+ }
+
+ /**
+ * Blog::commentsEnabled()
+ * @param void
+ * @return integer enabled or not
+ */
+ public function commentsEnabled()
+ {
+ return $this->getSetting('bcomments');
+ }
+
+ /**
+ * Blog::getURL()
+ * @param void
+ * @return string URI for this weblog
+ */
+ public function getURL()
+ {
+ return $this->getSetting('burl');
+ }
+
+ /**
+ * Blog::getDefaultSkin()
+ * @param void
+ * @return name of skin as default for this weblog
+ */
+ public function getDefaultSkin()
+ {
+ return $this->getSetting('bdefskin');
+ }
+
+ /**
+ * Blog::getUpdateFile()
+ * @param void
+ * @return string name of file to be updated when weblog is updated
+ */
+ public function getUpdateFile()
+ {
+ return $this->getSetting('bupdate');
+ }
+
+ /**
+ * Blog::getDescription()
+ * @param void
+ * @return string description for this weblog
+ */
+ public function getDescription()
+ {
+ return $this->getSetting('bdesc');
+ }
+
+ /**
+ * Blog::isPublic()
+ * @param void
+ * @return integer publlic or not
+ */
+ public function isPublic()
+ {
+ return $this->getSetting('bpublic');
+ }
+
+ /**
+ * Blog::emailRequired()
+ * @param void
+ * @return integer email is required when posting comment or not
+ */
+ public function emailRequired()
+ {
+ return $this->getSetting('breqemail');
+ }
+
+ /**
+ * Blog::getSearchable()
+ * @param void
+ * @return integer searchable or not
+ */
+ public function getSearchable()
+ {
+ return $this->getSetting('bincludesearch');
+ }
+
+ /**
+ * Blog::getDefaultCategory()
+ * @param void
+ * @return ID for category as a default
+ */
+ public function getDefaultCategory()
+ {
+ return $this->getSetting('bdefcat');
+ }
+
+ /**
+ * Blog::setPublic()
+ * @param integer $val allow comments by non-registered members or not
+ * @return void
+ */
+ public function setPublic($val)
+ {
+ $this->setSetting('bpublic', $val);
+ return;
+ }
+
+ /**
+ * Blog::setSearchable()
+ * @param integer $val searchable from the other blogs or not
+ * @return void
+ */
+ public function setSearchable($val)
+ {
+ $this->setSetting('bincludesearch', $val);
+ return;
+ }
+
+ /**
+ * Blog::setDescription
+ * @param string $val description for this weblog
+ * @return void
+ */
+ public function setDescription($val)
+ {
+ $this->setSetting('bdesc',$val);
+ return;
+ }
+
+ /**
+ * Blog::setUpdateFile()
+ * @param string $val name of file to beupdated when weblog is updated
+ * @return
+ */
+ public function setUpdateFile($val)
+ {
+ $this->setSetting('bupdate',$val);
+ return;
+ }
+
+ /**
+ * Blog::setDefaultSkin()
+ * @param integer $val ID for default skin to use when displaying this weblog
+ * @return void
+ */
+ public function setDefaultSkin($val)
+ {
+ $this->setSetting('bdefskin', $val);
+ return;
+ }
+
+ /**
+ * Blog::setURL()
+ * @param string $val URI for this weblog
+ * @return
+ */
+ public function setURL($val)
+ {
+ $this->setSetting('burl', $val);
+ return;
+ }
+
+ /**
+ * Blog::setName()
+ * @param string $val name of this weblog
+ * @return void
+ */
+ public function setName($val)
+ {
+ $this->setSetting('bname', $val);
+ return;
+ }
+
+ /**
+ * Blog::setShortName()
+ * @param string $val short name for this weblog
+ * @return void
+ */
+ public function setShortName($val)
+ {
+ $this->setSetting('bshortname', $val);
+ return;
+ }
+
+ /**
+ * Blog::setCommentsEnabled()
+ * @param integer $val enabling posting comment or not
+ * @return void
+ */
+ public function setCommentsEnabled($val)
+ {
+ $this->setSetting('bcomments',$val);
+ return;
+ }
+
+ /**
+ * Blog::setMaxComments()
+ * @param integer $val maximum number of comments for this weblog
+ * @return void
+ */
+ public function setMaxComments($val)
+ {
+ $this->setSetting('bmaxcomments', $val);
+ return;
+ }
+
+ /**
+ * Blog::setNotifyAddress()
+ * @param string $val email to be notified if weblog updated
+ * @return void
+ */
+ public function setNotifyAddress($val)
+ {
+ $this->setSetting('bnotify', $val);
+ return;
+ }
+
+ /**
+ * Blog::setEmailRequired()
+ * @param string requiring comments with email or not from non member
+ * @return void
+ */
+ public function setEmailRequired($val)
+ {
+ $this->setSetting('breqemail', $val);
+ return;
+ }
+
+ /**
+ * Blog::setTimeOffset()
+ * @param integer $val time offset
+ * @return void
+ */
+ public function setTimeOffset($val)
+ {
+ // check validity of value
+ // 1. replace , by . (common mistake)
+ $val = str_replace(',','.',$val);
+
+ // 2. cast to float or int
+ if ( is_numeric($val) && (i18n::strpos($val, '.5') === (i18n::strlen($val) - 2)) )
+ {
+ $val = (float) $val;
+ }
+ else
+ {
+ $val = (integer) $val;
+ }
+
+ $this->setSetting('btimeoffset',$val);
+ return;
+ }
+
+ /**
+ * Blog::setDefaultCategory()
+ * @param integer $val ID for default category for this weblog
+ * @return
+ */
+ public function setDefaultCategory($val)
+ {
+ $this->setSetting('bdefcat',$val);
+ return;
+ }
+
+ /**
+ * Blog::getSetting()
+ * @param string $key key for setting of this weblog
+ * @return mixed value for the setting
+ */
+ public function getSetting($key)
+ {
+ return $this->settings[$key];
+ }
+
+ /**
+ * Blog::setSetting()
+ * @param string $key key for setting of this weblog
+ * @param mixed $value value for the key
+ * @return
+ */
+ public function setSetting($key, $value)
+ {
+ $this->settings[$key] = $value;
+ return;
+ }
+
+ /**
+ * Blog::addTeamMember()
+ * Tries to add a member to the team.
+ * Returns false if the member was already on the team
+ *
+ * @param integer $memberid id for member
+ * @param boolean $admin super-admin or not
+ * @return boolean Success/Fail
+ */
+ public function addTeamMember($memberid, $admin)
+ {
+ global $manager;
+
+ $memberid = intval($memberid);
+ $admin = intval($admin);
+
+ // check if member is already a member
+ $tmem =& $manager->getMember($memberid);
+
+ if ( $tmem->isTeamMember($this->blogid) )
+ {
+ return 0;
+ }
+
+ $data = array(
+ 'blog' => &$this,
+ 'member' => &$tmem,
+ 'admin' => &$admin
+ );
+ $manager->notify('PreAddTeamMember', $data);
+
+ // add to team
+ $query = "INSERT INTO %s (TMEMBER, TBLOG, TADMIN) VALUES (%d, %d, %d);";
+ $query = sprintf($query, sql_table('team'), (integer) $memberid, (integer) $this->blogid, (integer) $admin);
+ DB::execute($query);
+
+ $data = array(
+ 'blog' => &$this,
+ 'member' => &$tmem,
+ 'admin' => $admin
+ );
+ $manager->notify('PostAddTeamMember', $data);
+
+ $logMsg = sprintf(_TEAM_ADD_NEWTEAMMEMBER, $tmem->getDisplayName(), $memberid, $this->getName());
+ ActionLog::add(INFO, $logMsg);
+
+ return 1;
+ }
+
+ /**
+ * Blog::getID()
+ * @param void
+ * @return integer ID for this weblog
+ */
+ public function getID()
+ {
+ return (integer) $this->blogid;
+ }
+
+ /**
+ * Checks if a blog with a given shortname exists
+ * Returns true if there is a blog with the given shortname (static)
+ *
+ * @param string $name blog shortname
+ * @return boolean exists or not
+ */
+ public function exists($name)
+ {
+ $r = DB::getResult('SELECT * FROM '.sql_table('blog').' WHERE bshortname='. DB::quoteValue($name));
+ return ($r->rowCount() != 0);
+ }
+
+ /**
+ * Checks if a blog with a given id exists
+ * Returns true if there is a blog with the given ID (static)
+ *
+ * @param integer $id ID for searched weblog
+ * @return boolean exists or not
+ */
+ public function existsID($id)
+ {
+ $r = DB::getResult('SELECT * FROM '.sql_table('blog').' WHERE bnumber='.intval($id));
+ return ($r->rowCount() != 0);
+ }
+
+ /**
+ * Blog::setFuturePost()
+ * flag there is a future post pending
+ *
+ * @param void
+ * @return void
+ */
+ public function setFuturePost()
+ {
+ $query = "UPDATE %s SET bfuturepost='1' WHERE bnumber=%d;";
+ $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);
+ DB::execute($query);
+ return;
+ }
+
+ /**
+ * Blog::clearFuturePost()
+ * clear there is a future post pending
+ *
+ * @param void
+ * @return void
+ */
+ public function clearFuturePost()
+ {
+ $query = "UPDATE %s SET bfuturepost='0' WHERE bnumber=%d;";
+ $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);
+ DB::execute($query);
+ return;
+ }
+
+ /**
+ * Blog::checkJustPosted()
+ * check if we should throw justPosted event
+ *
+ * @param void
+ * @return void
+ */
+ public function checkJustPosted()
+ {
+ global $manager;
+
+ if ( $this->settings['bfuturepost'] == 1 )
+ {
+ $query = "SELECT * FROM %s WHERE iposted=0 AND iblog=%d AND itime < NOW();";
+ $query = sprintf($query, sql_table('item'), (integer) $this->blogid);
+
+ $result = DB::getResult($query);
+ if ( $result->rowCount() > 0 )
+ {
+ // This $pinged is allow a plugin to tell other hook to the event that a ping is sent already
+ // Note that the plugins's calling order is subject to thri order in the plugin list
+ $pinged = FALSE;
+ $manager->notify('JustPosted', array('blogid' => $this->blogid, 'pinged' => &$pinged));
+
+ // clear all expired future posts
+ $query = "UPDATE %s SET iposted='1' WHERE iblog=%d AND itime < NOW();";
+ $query = spriintf($query, sql_table('item'), (integer) $this->blogid);
+ DB::execute($query);
+
+ // check to see any pending future post, clear the flag is none
+ $query = "SELECT * FROM %s WHERE iposted=0 AND iblog=%d;";
+ $query = sprintf($query, sql_table('item'), (integer) $this->blogid);
+
+ $result = DB::getResult($query);
+ if ( $result->rowCount() == 0 )
+ {
+ $this->clearFuturePost();
+ }
+ }
+ }
+ return;
+ }
+
+ /**
+ * Blog::readLogFromList()
+ * Shows the given list of items for this blog
+ *
+ * @param array $itemarray array of item numbers to be displayed
+ * @param string $template string representing the template _NAME_ (!)
+ * @param string $highlight contains a query that should be highlighted
+ * @param boolean $comments 1=show comments 0=don't show comments
+ * @param boolean $dateheads 1=show dateheads 0=don't show dateheads
+ * @param boolean $showDrafts 0=do not show drafts 1=show drafts
+ * @param boolean $showFuture 0=do not show future posts 1=show future posts
+ * @return integer amount of items shown
+ */
+ public function readLogFromList($itemarray, $template, $highlight = '', $comments = 1, $dateheads = 1,$showDrafts = 0, $showFuture = 0)
+ {
+ $query = $this->getSqlItemList($itemarray,$showDrafts,$showFuture);
+ return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);
+ }
+
+ /**
+ * Blog::getSqlItemList()
+ * Returns the SQL query used to fill out templates for a list of items
+ * No LIMIT clause is added. (caller should add this if multiple pages are requested)
+ *
+ * @param array $itemarray an array holding the item numbers of the items to be displayed
+ * @param integer $showDrafts 0=do not show drafts 1=show drafts
+ * @param integer $showFuture 0=do not show future posts 1=show future posts
+ * @return string either a full SQL query, or an empty string
+ */
+ public function getSqlItemList($itemarray,$showDrafts = 0,$showFuture = 0)
+ {
+ if ( !is_array($itemarray) )
+ {
+ return '';
+ }
+
+ $showDrafts = intval($showDrafts);
+ $showFuture = intval($showFuture);
+ $items = array();
+
+ foreach ( $itemarray as $value )
+ {
+ if ( intval($value) )
+ {
+ $items[] = intval($value);
+ }
+ }
+ if ( !count($items) )
+ {
+ return '';
+ }
+
+ $i = count($items);
+ $query = '';
+ foreach ( $items as $value )
+ {
+ $query .= '('
+ . 'SELECT'
+ . ' i.inumber as itemid,'
+ . ' i.ititle as title,'
+ . ' i.ibody as body,'
+ . ' m.mname as author,'
+ . ' m.mrealname as authorname,'
+ . ' i.itime,'
+ . ' i.imore as more,'
+ . ' m.mnumber as authorid,'
+ . ' m.memail as authormail,'
+ . ' m.murl as authorurl,'
+ . ' c.cname as category,'
+ . ' i.icat as catid,'
+ . ' i.iclosed as closed';
+
+ $query .= ' FROM '
+ . sql_table('item') . ' as i, '
+ . sql_table('member') . ' as m, '
+ . sql_table('category') . ' as c'
+ . ' WHERE'
+ . ' i.iblog='.$this->blogid
+ . ' and i.iauthor=m.mnumber'
+ . ' and i.icat=c.catid';
+
+ // exclude drafts
+ if ( !$showDrafts )
+ {
+ $query .= ' and i.idraft=0';
+ }
+ if ( !$showFuture )
+ {
+ // don't show future items
+ $query .= ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime());
+ }
+
+ $query .= ' and i.inumber='.intval($value);
+ $query .= ')';
+ $i--;
+ if ($i) $query .= ' UNION ';
+ }
+
+ return $query;
+ }
+
+ /**
+ * Blog::convertBreaks()
+ * Get the the setting for the line break handling
+ * [should be named as getConvertBreaks()]
+ *
+ * @deprecated
+ * @param void
+ * @return
+ */
+ public function convertBreaks()
+ {
+ return $this->getSetting('bconvertbreaks');
+ }
+
+ /**
+ * Set the the setting for the line break handling
+ *
+ * @deprecated
+ * @param boolean $val new value for bconvertbreaks
+ * @return void
+ */
+ public function setConvertBreaks($val)
+ {
+ $this->setSetting('bconvertbreaks', $val);
+ return;
+ }
+}
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class to parses plugin calls inside items\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: BODYACTIONS.php 1757 2012-04-15 09:02:32Z sakamocchi $\r
- */\r
-\r
-class BodyActions extends BaseActions\r
-{\r
- private $currentItem;\r
- private $template;\r
- \r
- static private $defined_actions = array(\r
- 'image',\r
- 'media',\r
- 'popup',\r
- 'plugin',\r
- );\r
- \r
- /**\r
- * BodyActions::__construct()\r
- * Constructor of the BODYACTIONS\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function __construct()\r
- {\r
- parent::__construct();
- return;\r
- }\r
- \r
- /**\r
- * BodyActions::getAvailableActions()\r
- * Get the defined actions in an item\r
- * \r
- * @param void\r
- * @return array self::$defined_actions\r
- */\r
- public function getAvailableActions()\r
- {\r
- return array_merge(self::$defined_actions, parent::getAvailableActions());\r
- }\r
- \r
- /**\r
- * BodyActions::setCurrentItem()\r
- * Set the current item\r
- * \r
- * @param object &$item reference to the current item\r
- * @return void\r
- */\r
- public function setCurrentItem(&$item)\r
- {\r
- global $currentitemid;\r
- $this->currentItem =& $item;\r
- $currentitemid = $this->currentItem['itemid'];\r
- return;\r
- }\r
- \r
- /**\r
- * BodyActions::setTemplate()\r
- * Set the current template\r
- * \r
- * @param string $template Template to be used\r
- * @return void\r
- */\r
- public function setTemplate($template)\r
- {\r
- $this->template =& $template;\r
- return;\r
- }\r
- \r
- /**\r
- * BodyActions::parse_plugin()\r
- * Parse a plugin var\r
- * Called if <%plugin(...)%> in an item appears\r
- * \r
- * Calls the doItemVar function in the plugin\r
- */\r
- public function parse_plugin($pluginName)\r
- {\r
- global $manager;\r
- \r
- $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
- if ( !$plugin )\r
- {\r
- return; \r
- }\r
- \r
- // get arguments\r
- $params = func_get_args();\r
- \r
- // remove plugin name\r
- array_shift($params);\r
- \r
- // add item reference (array_unshift didn't work)\r
- $params = array_merge(array(&$this->currentItem), $params);\r
- \r
- call_user_func_array(array(&$plugin, 'doItemVar'), $params);\r
- return;\r
- }\r
- \r
- /**\r
- * BodyActions::parse_image()\r
- * Parse image\r
- * Called if <%image(...)%> in an item appears\r
- * \r
- * @param void\r
- * @return parsed image tag\r
- */\r
- public function parse_image()\r
- {\r
- // image/popup calls have arguments separated by |\r
- $args = func_get_args();\r
- $args = preg_split('#\|#', implode($args, ', '));\r
- echo call_user_func_array(array(&$this, 'createImageCode'), $args);\r
- }\r
- \r
- /**\r
- * BodyActions::createImageCode()\r
- * Creates the code for an image\r
- * \r
- * @param string $filename name of file from tag\r
- * @param integer $width width of file from tag\r
- * @param integer $height height of file from tag\r
- * @return string image element with anchor element\r
- */\r
- public function createImageCode($filename, $width, $height, $text = '')\r
- {\r
- global $CONF;\r
- \r
- // select private collection when no collection given\r
- if ( i18n::strpos($filename, '/') === FALSE )\r
- {\r
- $filename = $this->currentItem['authorid'] . '/' . $filename;\r
- }\r
- \r
- $windowwidth = $width;\r
- $windowheight = $height;\r
- \r
- $vars['link'] = Entity::hsc($CONF['MediaURL']. $filename);\r
- $vars['text'] = Entity::hsc($text);\r
- $vars['image'] = '<img src="' . $vars['link'] . '" width="' . $width . '" height="' . $height . '" alt="' . $vars['text'] . '" title="' . $vars['text'] . '" />';\r
- $vars['width'] = $width;\r
- $vars['height'] = $height;\r
- $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';\r
- \r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class to parses plugin calls inside items
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: BODYACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
+ */
+
+class BodyActions extends BaseActions
+{
+ private $currentItem;
+ private $template;
+
+ static private $defined_actions = array(
+ 'image',
+ 'media',
+ 'popup',
+ 'plugin',
+ );
+
+ /**
+ * BodyActions::__construct()
+ * Constructor of the BODYACTIONS
+ *
+ * @param void
+ * @return void
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ return;
+ }
+
+ /**
+ * BodyActions::getAvailableActions()
+ * Get the defined actions in an item
+ *
+ * @param void
+ * @return array self::$defined_actions
+ */
+ public function getAvailableActions()
+ {
+ return array_merge(self::$defined_actions, parent::getAvailableActions());
+ }
+
+ /**
+ * BodyActions::setCurrentItem()
+ * Set the current item
+ *
+ * @param object &$item reference to the current item
+ * @return void
+ */
+ public function setCurrentItem(&$item)
+ {
+ global $currentitemid;
+ $this->currentItem =& $item;
+ $currentitemid = $this->currentItem['itemid'];
+ return;
+ }
+
+ /**
+ * BodyActions::setTemplate()
+ * Set the current template
+ *
+ * @param string $template Template to be used
+ * @return void
+ */
+ public function setTemplate($template)
+ {
+ $this->template =& $template;
+ return;
+ }
+
+ /**
+ * BodyActions::parse_plugin()
+ * Parse a plugin var
+ * Called if <%plugin(...)%> in an item appears
+ *
+ * Calls the doItemVar function in the plugin
+ */
+ public function parse_plugin($pluginName)
+ {
+ global $manager;
+
+ $plugin =& $manager->getPlugin('NP_' . $pluginName);
+ if ( !$plugin )
+ {
+ return;
+ }
+
+ // get arguments
+ $params = func_get_args();
+
+ // remove plugin name
+ array_shift($params);
+
+ // add item reference (array_unshift didn't work)
+ $params = array_merge(array(&$this->currentItem), $params);
+
+ call_user_func_array(array(&$plugin, 'doItemVar'), $params);
+ return;
+ }
+
+ /**
+ * BodyActions::parse_image()
+ * Parse image
+ * Called if <%image(...)%> in an item appears
+ *
+ * @param void
+ * @return parsed image tag
+ */
+ public function parse_image()
+ {
+ // image/popup calls have arguments separated by |
+ $args = func_get_args();
+ $args = preg_split('#\|#', implode($args, ', '));
+ echo call_user_func_array(array(&$this, 'createImageCode'), $args);
+ }
+
+ /**
+ * BodyActions::createImageCode()
+ * Creates the code for an image
+ *
+ * @param string $filename name of file from tag
+ * @param integer $width width of file from tag
+ * @param integer $height height of file from tag
+ * @return string image element with anchor element
+ */
+ public function createImageCode($filename, $width, $height, $text = '')
+ {
+ global $CONF;
+
+ // select private collection when no collection given
+ if ( i18n::strpos($filename, '/') === FALSE )
+ {
+ $filename = $this->currentItem['authorid'] . '/' . $filename;
+ }
+
+ $windowwidth = $width;
+ $windowheight = $height;
+
+ $vars['link'] = Entity::hsc($CONF['MediaURL']. $filename);
+ $vars['text'] = Entity::hsc($text);
+ $vars['image'] = '<img src="' . $vars['link'] . '" width="' . $width . '" height="' . $height . '" alt="' . $vars['text'] . '" title="' . $vars['text'] . '" />';
+ $vars['width'] = $width;
+ $vars['height'] = $height;
+ $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';
+
return Template::fill($this->template['IMAGE_CODE'], $vars);
- }\r
- \r
- /**\r
- * BodyActions::parse_media()\r
- * Parse media\r
- * Called if <%media(...)%> in an item appears\r
- * \r
- * @param void\r
- * @param parsed media tag\r
- */\r
- public function parse_media()\r
- {\r
- // image/popup calls have arguments separated by |\r
- $args = func_get_args();\r
- $args = preg_split('#\|#', implode($args, ', '));\r
- echo call_user_func_array(array(&$this, 'createMediaCode'), $args);\r
- }\r
- \r
- /**\r
- * BodyActions::createMediaCode()\r
- * Creates the code for a media\r
- * \r
- * @param string $filename name of file from tag\r
- * @param string $text alternative text from tag\r
- * @return string text element with anchor element\r
- */\r
- public function createMediaCode($filename, $text = '')\r
- {\r
- global $CONF;\r
- \r
- // select private collection when no collection given\r
- if ( i18n::strpos($filename, '/') === FALSE )\r
- {\r
- $filename = $this->currentItem['authorid'] . '/' . $filename;\r
- }\r
- \r
- $vars['link'] = Entity::hsc($CONF['MediaURL'] . $filename);\r
- $vars['text'] = Entity::hsc($text);\r
- $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';\r
- \r
- return Template::fill($this->template['MEDIA_CODE'], $vars);;\r
- }\r
- \r
- /**\r
- * BodyActions::parse_popup()\r
- * Parse popup\r
- * Called if <%popup(...)%> in an item appears\r
- * \r
- * @param void\r
- * @return string parsed popup tag\r
- */\r
- public function parse_popup()\r
- {\r
- // image/popup calls have arguments separated by |\r
- $args = func_get_args();\r
- $args = preg_split('#\|#', implode($args, ', '));\r
- echo call_user_func_array(array(&$this, 'createPopupCode'), $args);\r
- }\r
- \r
- /**\r
- * BodyActions::createPopupCode()\r
- * Creates the code for a popup\r
- * \r
- * @param string $filename name of file from tag\r
- * @param integer $width width of file from tag\r
- * @param integer $height height of file from tag\r
- * @param string $text alternative text from tag\r
- * @return string text element with anchor element of JavaScript window.open\r
- */\r
- public function createPopupCode($filename, $width, $height, $text = '')\r
- {\r
- global $CONF;\r
- \r
- // select private collection when no collection given\r
- if ( i18n::strpos($filename, '/') === FALSE )\r
- {\r
- $filename = $this->currentItem['authorid'] . '/' . $filename;\r
- }\r
- \r
- $windowwidth = $width;\r
- $windowheight = $height;\r
- \r
- $vars['rawpopuplink'] = $CONF['Self'] . "?imagepopup=" . Entity::hsc($filename) . "&width=$width&height=$height&imagetext=" . urlencode(Entity::hsc($text));\r
- $vars['popupcode'] = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width=$windowwidth,height=$windowheight');return false;";\r
- $vars['popuptext'] = Entity::hsc($text);\r
- $vars['popuplink'] = '<a href="' . $vars['rawpopuplink']. '" onclick="'. $vars['popupcode'].'" >' . $vars['popuptext'] . '</a>';\r
- $vars['width'] = $width;\r
- $vars['height'] = $height;\r
- $vars['text'] = $text;\r
- $vars['link'] = Entity::hsc($CONF['MediaURL'] . $filename);\r
- $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['popuptext'] . '</a>';\r
- \r
- return Template::fill($this->template['POPUP_CODE'], $vars);\r
- }\r
- \r
- /**\r
- * BodyActions::checkCondition()\r
- * Checks conditions for if statements\r
- *\r
- * @param string $field type of <%if%>\r
- * @param string $name property of field\r
- * @param string $value value of property\r
- * @return condition\r
- */\r
- protected function checkCondition($field, $name='', $value = '')\r
- {\r
- global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;\r
- \r
- $condition = 0;\r
- switch ( $field )\r
- {\r
- case 'category':\r
- $condition = ($blog && $this->ifCategory($name,$value));\r
- break;\r
- case 'itemcategory':\r
- $condition = ($this->ifItemCategory($name,$value));\r
- break;\r
- case 'blogsetting':\r
- $condition = ($blog && ($blog->getSetting($name) == $value));\r
- break;\r
- case 'itemblogsetting':\r
- $b =& $manager->getBlog($this->currentItem['blogid']);\r
- $condition = ($b && ($b->getSetting($name) == $value));\r
- break;\r
- case 'loggedin':\r
- $condition = $member->isLoggedIn();\r
- break;\r
- case 'onteam':\r
- $condition = $member->isLoggedIn() && $this->ifOnTeam($name);\r
- break;\r
- case 'admin':\r
- $condition = $member->isLoggedIn() && $this->ifAdmin($name);\r
- break;\r
- case 'author':\r
- $condition = ($this->ifAuthor($name,$value));\r
- break;\r
- case 'hasplugin':\r
- $condition = $this->ifHasPlugin($name, $value);\r
- break;\r
- default:\r
- $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);\r
- break;\r
- }\r
- return $condition;\r
- } \r
- \r
- /**\r
- * BodyActions::ifCategory()\r
- * Different checks for a category\r
- * \r
- * @param string $key key for data of category\r
- * @param string $value value for data of category\r
- * @return boolean\r
- */\r
- private function ifCategory($key = '', $value = '')\r
- {\r
- global $blog, $catid;\r
- \r
- // when no parameter is defined, just check if a category is selected\r
- if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
- {\r
- return $blog->isValidCategory($catid);\r
- }\r
- \r
- // check category name\r
- if ( $key == 'catname' )\r
- {\r
- $value = $blog->getCategoryIdFromName($value);\r
- if ( $value == $catid )\r
- {\r
- return $blog->isValidCategory($catid);\r
- }\r
- }\r
- \r
- // check category id\r
- if ( ($key == 'catid') && ($value == $catid) )\r
- {\r
- return $blog->isValidCategory($catid);\r
- }\r
- \r
- return FALSE;\r
- }\r
- \r
- /**\r
- * BodyActions::ifAuthor()\r
- * Different checks for an author\r
- * \r
- * @param string $key key for data of author\r
- * @param string $value value for data of author\r
- * @return boolean\r
- */\r
- private function ifAuthor($key = '', $value = '')\r
- {\r
- global $member, $manager;\r
- \r
- $b =& $manager->getBlog($this->currentItem['blogid']);\r
- \r
- // when no parameter is defined, just check if author is current visitor\r
- if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )\r
- {\r
- return (intval($member->getID()) > 0 && intval($member->getID()) == intval($this->currentItem['authorid']));\r
- }\r
- \r
- // check author name\r
- if ( $key == 'name' )\r
- {\r
- $value = strtolower($value);\r
- if ( $value == strtolower($this->currentItem['author']) )\r
- {\r
- return TRUE;\r
- }\r
- }\r
- \r
- // check if author is admin\r
- if ( ($key == 'isadmin') )\r
- {\r
- $aid = intval($this->currentItem['authorid']);\r
- $blogid = intval($b->getID()); \r
- $amember =& $manager->getMember($aid);\r
- if ( $amember->isAdmin() )\r
- {\r
- return TRUE;\r
- } \r
- return $amember->isBlogAdmin($blogid);\r
- }\r
- \r
- return FALSE;\r
- }\r
- \r
- /**\r
- * BodyActions::ifItemCategory()\r
- * Different checks for a category\r
- * \r
- * @param string $key key for data of category\r
- * @param string $value value for data of category\r
- * @return boolean \r
- */\r
- private function ifItemCategory($key = '', $value = '')\r
- {\r
- global $catid, $manager;\r
- \r
- $b =& $manager->getBlog($this->currentItem['blogid']);\r
- \r
- // when no parameter is defined, just check if a category is selected\r
- if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
- {\r
- return $b->isValidCategory($catid);\r
- }\r
- \r
- $icatid = $this->currentItem['catid'];\r
- \r
- // check category name\r
- if ( $key == 'catname' )\r
- {\r
- $value = $b->getCategoryIdFromName($value);\r
- if ( $value == $icatid )\r
- {\r
- return $b->isValidCategory($icatid);\r
- }\r
- }\r
- \r
- // check category id\r
- if ( ($key == 'catid') && ($value == $icatid) )\r
- {\r
- return $b->isValidCategory($icatid);\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
- * BodyActions::ifOnTeam()\r
- * Checks if a member is on the team of a blog and return his rights\r
- * \r
- * @param string $blogName name of weblog\r
- * @return boolean\r
- */\r
- private function ifOnTeam($blogName = '')\r
- {\r
- global $blog, $member, $manager;\r
- \r
- // when no blog found\r
- if ( ($blogName == '') && (!is_object($blog)) )\r
- {\r
- return 0;\r
- }\r
- \r
- // explicit blog selection\r
- if ( $blogName != '' )\r
- {\r
- $blogid = getBlogIDFromName($blogName);\r
- }\r
- \r
- if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
- {\r
- // use current blog\r
- $blogid = $blog->getID();\r
- }\r
- return $member->teamRights($blogid);\r
- }\r
- \r
- /**\r
- * BodyActions::ifAdmin()\r
- * Checks if a member is admin of a blog\r
- * \r
- * @param string $blogName name of weblog\r
- * @return boolean\r
- */\r
- private function ifAdmin($blogName = '')\r
- {\r
- global $blog, $member, $manager;\r
- \r
- // when no blog found\r
- if ( ($blogName == '') && (!is_object($blog)) )\r
- {\r
- return 0;\r
- }\r
- \r
- // explicit blog selection\r
- if ( $blogName != '' )\r
- {\r
- $blogid = getBlogIDFromName($blogName);\r
- }\r
- \r
- if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
- {\r
- // use current blog\r
- $blogid = $blog->getID();\r
- }\r
- return $member->isBlogAdmin($blogid);\r
- }\r
- \r
- \r
- /**\r
- * BodyActions::ifHasPlugin()\r
- * hasplugin,PlugName\r
- * -> checks if plugin exists\r
- * hasplugin,PlugName,OptionName\r
- * -> checks if the option OptionName from plugin PlugName is not set to 'no'\r
- * hasplugin,PlugName,OptionName=value\r
- * -> checks if the option OptionName from plugin PlugName is set to value\r
- *\r
- * @param string $name name of plugin\r
- * @param string $value value for plugin argument\r
- * @return boolean\r
- */\r
- private function ifHasPlugin($name, $value)\r
- {\r
- global $manager;\r
- $condition = false;\r
- \r
- // (pluginInstalled method won't write a message in the actionlog on failure)\r
- if ( $manager->pluginInstalled("NP_{$name}") )\r
- {\r
- $plugin =& $manager->getPlugin("NP_{$name}");\r
- if ( $plugin != NULL )\r
- {\r
- if ( $value == "" )\r
- {\r
- $condition = TRUE;\r
- }\r
- else\r
- {\r
- list($name2, $value2) = preg_split('#=#', $value, 2);\r
- if ( $value2 == "" && $plugin->getOption($name2) != 'no' )\r
- {\r
- $condition = TRUE;\r
- }\r
- else if ( $plugin->getOption($name2) == $value2 )\r
- {\r
- $condition = TRUE;\r
- }\r
- }\r
- }\r
- }\r
- return $condition;\r
- }\r
- \r
- /**\r
- * BodyActions::ifPlugin()\r
- * Checks if a plugin exists and call its doIf function\r
- * \r
- * @param string $name name of plugin\r
- * @param string $key ...\r
- * @param string $value ...\r
- * @return string result of plugin 'doIf'\r
- */\r
- private function ifPlugin($name, $key = '', $value = '')\r
- {\r
- global $manager;\r
- \r
- $plugin =& $manager->getPlugin("NP_{$name}");\r
- if ( !$plugin )\r
- {\r
- return;\r
- }\r
- \r
- $params = func_get_args();\r
- array_shift($params);\r
- \r
- return call_user_func_array(array(&$plugin, 'doIf'), $params);\r
- }\r
-}\r
+ }
+
+ /**
+ * BodyActions::parse_media()
+ * Parse media
+ * Called if <%media(...)%> in an item appears
+ *
+ * @param void
+ * @param parsed media tag
+ */
+ public function parse_media()
+ {
+ // image/popup calls have arguments separated by |
+ $args = func_get_args();
+ $args = preg_split('#\|#', implode($args, ', '));
+ echo call_user_func_array(array(&$this, 'createMediaCode'), $args);
+ }
+
+ /**
+ * BodyActions::createMediaCode()
+ * Creates the code for a media
+ *
+ * @param string $filename name of file from tag
+ * @param string $text alternative text from tag
+ * @return string text element with anchor element
+ */
+ public function createMediaCode($filename, $text = '')
+ {
+ global $CONF;
+
+ // select private collection when no collection given
+ if ( i18n::strpos($filename, '/') === FALSE )
+ {
+ $filename = $this->currentItem['authorid'] . '/' . $filename;
+ }
+
+ $vars['link'] = Entity::hsc($CONF['MediaURL'] . $filename);
+ $vars['text'] = Entity::hsc($text);
+ $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>';
+
+ return Template::fill($this->template['MEDIA_CODE'], $vars);;
+ }
+
+ /**
+ * BodyActions::parse_popup()
+ * Parse popup
+ * Called if <%popup(...)%> in an item appears
+ *
+ * @param void
+ * @return string parsed popup tag
+ */
+ public function parse_popup()
+ {
+ // image/popup calls have arguments separated by |
+ $args = func_get_args();
+ $args = preg_split('#\|#', implode($args, ', '));
+ echo call_user_func_array(array(&$this, 'createPopupCode'), $args);
+ }
+
+ /**
+ * BodyActions::createPopupCode()
+ * Creates the code for a popup
+ *
+ * @param string $filename name of file from tag
+ * @param integer $width width of file from tag
+ * @param integer $height height of file from tag
+ * @param string $text alternative text from tag
+ * @return string text element with anchor element of JavaScript window.open
+ */
+ public function createPopupCode($filename, $width, $height, $text = '')
+ {
+ global $CONF;
+
+ // select private collection when no collection given
+ if ( i18n::strpos($filename, '/') === FALSE )
+ {
+ $filename = $this->currentItem['authorid'] . '/' . $filename;
+ }
+
+ $windowwidth = $width;
+ $windowheight = $height;
+
+ $vars['rawpopuplink'] = $CONF['Self'] . "?imagepopup=" . Entity::hsc($filename) . "&width=$width&height=$height&imagetext=" . urlencode(Entity::hsc($text));
+ $vars['popupcode'] = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width=$windowwidth,height=$windowheight');return false;";
+ $vars['popuptext'] = Entity::hsc($text);
+ $vars['popuplink'] = '<a href="' . $vars['rawpopuplink']. '" onclick="'. $vars['popupcode'].'" >' . $vars['popuptext'] . '</a>';
+ $vars['width'] = $width;
+ $vars['height'] = $height;
+ $vars['text'] = $text;
+ $vars['link'] = Entity::hsc($CONF['MediaURL'] . $filename);
+ $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['popuptext'] . '</a>';
+
+ return Template::fill($this->template['POPUP_CODE'], $vars);
+ }
+
+ /**
+ * BodyActions::checkCondition()
+ * Checks conditions for if statements
+ *
+ * @param string $field type of <%if%>
+ * @param string $name property of field
+ * @param string $value value of property
+ * @return condition
+ */
+ protected function checkCondition($field, $name='', $value = '')
+ {
+ global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
+
+ $condition = 0;
+ switch ( $field )
+ {
+ case 'category':
+ $condition = ($blog && $this->ifCategory($name,$value));
+ break;
+ case 'itemcategory':
+ $condition = ($this->ifItemCategory($name,$value));
+ break;
+ case 'blogsetting':
+ $condition = ($blog && ($blog->getSetting($name) == $value));
+ break;
+ case 'itemblogsetting':
+ $b =& $manager->getBlog($this->currentItem['blogid']);
+ $condition = ($b && ($b->getSetting($name) == $value));
+ break;
+ case 'loggedin':
+ $condition = $member->isLoggedIn();
+ break;
+ case 'onteam':
+ $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
+ break;
+ case 'admin':
+ $condition = $member->isLoggedIn() && $this->ifAdmin($name);
+ break;
+ case 'author':
+ $condition = ($this->ifAuthor($name,$value));
+ break;
+ case 'hasplugin':
+ $condition = $this->ifHasPlugin($name, $value);
+ break;
+ default:
+ $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);
+ break;
+ }
+ return $condition;
+ }
+
+ /**
+ * BodyActions::ifCategory()
+ * Different checks for a category
+ *
+ * @param string $key key for data of category
+ * @param string $value value for data of category
+ * @return boolean
+ */
+ private function ifCategory($key = '', $value = '')
+ {
+ global $blog, $catid;
+
+ // when no parameter is defined, just check if a category is selected
+ if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+ {
+ return $blog->isValidCategory($catid);
+ }
+
+ // check category name
+ if ( $key == 'catname' )
+ {
+ $value = $blog->getCategoryIdFromName($value);
+ if ( $value == $catid )
+ {
+ return $blog->isValidCategory($catid);
+ }
+ }
+
+ // check category id
+ if ( ($key == 'catid') && ($value == $catid) )
+ {
+ return $blog->isValidCategory($catid);
+ }
+
+ return FALSE;
+ }
+
+ /**
+ * BodyActions::ifAuthor()
+ * Different checks for an author
+ *
+ * @param string $key key for data of author
+ * @param string $value value for data of author
+ * @return boolean
+ */
+ private function ifAuthor($key = '', $value = '')
+ {
+ global $member, $manager;
+
+ $b =& $manager->getBlog($this->currentItem['blogid']);
+
+ // when no parameter is defined, just check if author is current visitor
+ if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )
+ {
+ return (intval($member->getID()) > 0 && intval($member->getID()) == intval($this->currentItem['authorid']));
+ }
+
+ // check author name
+ if ( $key == 'name' )
+ {
+ $value = strtolower($value);
+ if ( $value == strtolower($this->currentItem['author']) )
+ {
+ return TRUE;
+ }
+ }
+
+ // check if author is admin
+ if ( ($key == 'isadmin') )
+ {
+ $aid = intval($this->currentItem['authorid']);
+ $blogid = intval($b->getID());
+ $amember =& $manager->getMember($aid);
+ if ( $amember->isAdmin() )
+ {
+ return TRUE;
+ }
+ return $amember->isBlogAdmin($blogid);
+ }
+
+ return FALSE;
+ }
+
+ /**
+ * BodyActions::ifItemCategory()
+ * Different checks for a category
+ *
+ * @param string $key key for data of category
+ * @param string $value value for data of category
+ * @return boolean
+ */
+ private function ifItemCategory($key = '', $value = '')
+ {
+ global $catid, $manager;
+
+ $b =& $manager->getBlog($this->currentItem['blogid']);
+
+ // when no parameter is defined, just check if a category is selected
+ if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+ {
+ return $b->isValidCategory($catid);
+ }
+
+ $icatid = $this->currentItem['catid'];
+
+ // check category name
+ if ( $key == 'catname' )
+ {
+ $value = $b->getCategoryIdFromName($value);
+ if ( $value == $icatid )
+ {
+ return $b->isValidCategory($icatid);
+ }
+ }
+
+ // check category id
+ if ( ($key == 'catid') && ($value == $icatid) )
+ {
+ return $b->isValidCategory($icatid);
+ }
+ return FALSE;
+ }
+
+ /**
+ * BodyActions::ifOnTeam()
+ * Checks if a member is on the team of a blog and return his rights
+ *
+ * @param string $blogName name of weblog
+ * @return boolean
+ */
+ private function ifOnTeam($blogName = '')
+ {
+ global $blog, $member, $manager;
+
+ // when no blog found
+ if ( ($blogName == '') && (!is_object($blog)) )
+ {
+ return 0;
+ }
+
+ // explicit blog selection
+ if ( $blogName != '' )
+ {
+ $blogid = getBlogIDFromName($blogName);
+ }
+
+ if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+ {
+ // use current blog
+ $blogid = $blog->getID();
+ }
+ return $member->teamRights($blogid);
+ }
+
+ /**
+ * BodyActions::ifAdmin()
+ * Checks if a member is admin of a blog
+ *
+ * @param string $blogName name of weblog
+ * @return boolean
+ */
+ private function ifAdmin($blogName = '')
+ {
+ global $blog, $member, $manager;
+
+ // when no blog found
+ if ( ($blogName == '') && (!is_object($blog)) )
+ {
+ return 0;
+ }
+
+ // explicit blog selection
+ if ( $blogName != '' )
+ {
+ $blogid = getBlogIDFromName($blogName);
+ }
+
+ if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+ {
+ // use current blog
+ $blogid = $blog->getID();
+ }
+ return $member->isBlogAdmin($blogid);
+ }
+
+
+ /**
+ * BodyActions::ifHasPlugin()
+ * hasplugin,PlugName
+ * -> checks if plugin exists
+ * hasplugin,PlugName,OptionName
+ * -> checks if the option OptionName from plugin PlugName is not set to 'no'
+ * hasplugin,PlugName,OptionName=value
+ * -> checks if the option OptionName from plugin PlugName is set to value
+ *
+ * @param string $name name of plugin
+ * @param string $value value for plugin argument
+ * @return boolean
+ */
+ private function ifHasPlugin($name, $value)
+ {
+ global $manager;
+ $condition = false;
+
+ // (pluginInstalled method won't write a message in the actionlog on failure)
+ if ( $manager->pluginInstalled("NP_{$name}") )
+ {
+ $plugin =& $manager->getPlugin("NP_{$name}");
+ if ( $plugin != NULL )
+ {
+ if ( $value == "" )
+ {
+ $condition = TRUE;
+ }
+ else
+ {
+ list($name2, $value2) = preg_split('#=#', $value, 2);
+ if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
+ {
+ $condition = TRUE;
+ }
+ else if ( $plugin->getOption($name2) == $value2 )
+ {
+ $condition = TRUE;
+ }
+ }
+ }
+ }
+ return $condition;
+ }
+
+ /**
+ * BodyActions::ifPlugin()
+ * Checks if a plugin exists and call its doIf function
+ *
+ * @param string $name name of plugin
+ * @param string $key ...
+ * @param string $value ...
+ * @return string result of plugin 'doIf'
+ */
+ private function ifPlugin($name, $key = '', $value = '')
+ {
+ global $manager;
+
+ $plugin =& $manager->getPlugin("NP_{$name}");
+ if ( !$plugin )
+ {
+ return;
+ }
+
+ $params = func_get_args();
+ array_shift($params);
+
+ return call_user_func_array(array(&$plugin, 'doIf'), $params);
+ }
+}
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2009 The Nucleus Group
- * @version $Id: BaseActions.php 1848 2012-05-16 12:17:00Z sakamocchi $
+ * @version $Id: BaseActions.php 1882 2012-06-17 07:52:43Z sakamocchi $
*/
class BaseActions
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2007 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class representing a single comment\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2007 The Nucleus Group\r
- * @version $Id: COMMENT.php 1721 2012-03-31 10:18:25Z sakamocchi $
- */\r
-class Comment\r
-{\r
- /**\r
- * Comment::getComment()\r
- * Returns the requested comment\r
- * \r
- * @static\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2007 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class representing a single comment
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: COMMENT.php 1844 2012-05-13 11:14:38Z sakamocchi $
+ */
+class Comment
+{
+ /**
+ * Comment::getComment()
+ * Returns the requested comment
+ *
+ * @static
* @param integer $commentid id for comment
- * @return array comment information\r
- * \r
- */\r
- function getComment($commentid)\r
- {\r
- $query = 'SELECT cnumber AS commentid,'\r
- . ' cbody AS body,'\r
- . ' cuser AS user,'\r
- . ' cmail AS userid,'\r
- . ' cemail AS email,'\r
- . ' cmember AS memberid,'\r
- . ' ctime,'\r
- . ' chost AS host,'\r
- . ' mname AS member,'\r
- . ' cip AS ip,'\r
- . ' cblog AS blogid'\r
- . ' FROM %s LEFT OUTER JOIN %s ON cmember = mnumber'\r
- . ' WHERE cnumber = %d;';\r
- \r
- $query = sprintf($query, sql_table('comment'), sql_table('member'), (integer) $commentid);\r
- $aCommentInfo = DB::getRow($query);\r
-\r
+ * @return array comment information
+ *
+ */
+ static function getComment($commentid)
+ {
+ $query = 'SELECT cnumber AS commentid,'
+ . ' cbody AS body,'
+ . ' cuser AS user,'
+ . ' cmail AS userid,'
+ . ' cemail AS email,'
+ . ' cmember AS memberid,'
+ . ' ctime,'
+ . ' chost AS host,'
+ . ' mname AS member,'
+ . ' cip AS ip,'
+ . ' cblog AS blogid'
+ . ' FROM %s LEFT OUTER JOIN %s ON cmember = mnumber'
+ . ' WHERE cnumber = %d;';
+
+ $query = sprintf($query, sql_table('comment'), sql_table('member'), (integer) $commentid);
+ $aCommentInfo = DB::getRow($query);
+
if ( $aCommentInfo )
{
- $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);\r
- }\r
-\r
- return $aCommentInfo;\r
- }\r
-\r
- /**\r
+ $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);
+ }
+
+ return $aCommentInfo;
+ }
+
+ /**
* Comment::prepare()
- * Prepares a comment to be saved\r
- *\r
- * @static\r
+ * Prepares a comment to be saved
+ *
+ * @static
* @param array $comment comment data
* @return array comment date
*
- */\r
- function prepare($comment)\r
- {\r
- $comment['user'] = strip_tags($comment['user']);\r
- $comment['userid'] = strip_tags($comment['userid']);\r
- $comment['email'] = strip_tags($comment['email']);\r
-\r
- // remove newlines from user; remove quotes and newlines from userid and email; trim whitespace from beginning and end\r
- $comment['user'] = trim(strtr($comment['user'], "\n", ' ') );\r
- $comment['userid'] = trim(strtr($comment['userid'], "\'\"\n", '-- ') );\r
- $comment['email'] = trim(strtr($comment['email'], "\'\"\n", '-- ') );\r
-\r
- // begin if: a comment userid is supplied, but does not have an "http://" or "https://" at the beginning - prepend an "http://"\r
+ */
+ static function prepare($comment)
+ {
+ $comment['user'] = strip_tags($comment['user']);
+ $comment['userid'] = strip_tags($comment['userid']);
+ $comment['email'] = strip_tags($comment['email']);
+
+ // remove newlines from user; remove quotes and newlines from userid and email; trim whitespace from beginning and end
+ $comment['user'] = trim(strtr($comment['user'], "\n", ' ') );
+ $comment['userid'] = trim(strtr($comment['userid'], "\'\"\n", '-- ') );
+ $comment['email'] = trim(strtr($comment['email'], "\'\"\n", '-- ') );
+
+ // begin if: a comment userid is supplied, but does not have an "http://" or "https://" at the beginning - prepend an "http://"
if ( array_key_exists('userid', $comment)
&& !empty($comment['userid'])
&& (i18n::strpos($comment['userid'], 'http://') !== 0)
&& (i18n::strpos($comment['userid'], 'https://') !== 0) )
- {\r
- $comment['userid'] = 'http://' . $comment['userid'];\r
+ {
+ $comment['userid'] = 'http://' . $comment['userid'];
}
-\r
- $comment['body'] = Comment::prepareBody($comment['body']);\r
-\r
- return $comment;\r
- }\r
-\r
- /**\r
+
+ $comment['body'] = Comment::prepareBody($comment['body']);
+
+ return $comment;
+ }
+
+ /**
* Comment::prepareBody()
- * Prepares the body of a comment\r
- *\r
- * @ static\r
+ * Prepares the body of a comment
+ *
+ * @static
* @param string $body string for comment body
* @return string validate string for comment body
- *
- */\r
- function prepareBody($body)
+ */
+ static public function prepareBody($body)
{
- # replaced ereg_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0\r
- # original ereg_replace: ereg_replace("\n.\n.\n", "\n", $body);\r
-\r
- // convert Windows and Mac style 'returns' to *nix newlines\r
- $body = preg_replace("/\r\n/", "\n", $body);\r
- $body = preg_replace("/\r/", "\n", $body);\r
-\r
- // then remove newlines when too many in a row (3 or more newlines get converted to 1 newline)\r
- $body = preg_replace("/\n{3,}/", "\n\n", $body);\r
-\r
- // encode special characters as entities\r
- $body = Entity::hsc($body);\r
-\r
- // trim away whitespace and newlines at beginning and end\r
- $body = trim($body);\r
-\r
- // add <br /> tags\r
- $body = addBreaks($body);\r
-\r
- // create hyperlinks for http:// addresses\r
- // there's a testcase for this in /build/testcases/urllinking.txt\r
-\r
- $replace_from = array(\r
- '/([^:\/\/\w]|^)((https:\/\/)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',\r
- '/([^:\/\/\w]|^)((http:\/\/|www\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',\r
- '/([^:\/\/\w]|^)((ftp:\/\/|ftp\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',\r
- '/([^:\/\/\w]|^)(mailto:(([a-zA-Z\@\%\.\-\+_])+))/i'\r
- );\r
-\r
- $body = preg_replace_callback($replace_from, array('self', 'prepareBody_cb'), $body);\r
-\r
- return $body;\r
- }\r
- \r
- /**\r
- * Comment::createLinkCode()\r
- * Creates a link code for unlinked URLs with different protocols\r
- *\r
- * @static\r
+ // convert Windows and Mac style 'returns' to *nix newlines
+ $body = preg_replace("/\r\n/", "\n", $body);
+ $body = preg_replace("/\r/", "\n", $body);
+
+ // then remove newlines when too many in a row (3 or more newlines get converted to 1 newline)
+ $body = preg_replace("/\n{3,}/", "\n\n", $body);
+
+ // encode special characters as entities
+ $body = Entity::hsc($body);
+
+ // trim away whitespace and newlines at beginning and end
+ $body = trim($body);
+
+ // add <br /> tags
+ $body = addBreaks($body);
+
+ // create hyperlinks for http:// addresses
+ // there's a testcase for this in /build/testcases/urllinking.txt
+ $replace_from = array(
+ '/([^:\/\/\w]|^)((https:\/\/)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',
+ '/([^:\/\/\w]|^)((http:\/\/|www\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',
+ '/([^:\/\/\w]|^)((ftp:\/\/|ftp\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',
+ '/([^:\/\/\w]|^)(mailto:(([a-zA-Z\@\%\.\-\+_])+))/i'
+ );
+
+ return preg_replace_callback($replace_from, array(__CLASS__, 'prepareBody_cb'), $body);
+ }
+
+ /**
+ * Comment::createLinkCode()
+ * Creates a link code for unlinked URLs with different protocols
+ *
+ * @static
* @param string $pre Prefix of comment
* @param string $url URL
* @param string $protocol http, mailto and so on
* @return string string including anchor element and child text
- *
- */\r
- function createLinkCode($pre, $url, $protocol = 'http')\r
- {\r
- $post = '';\r
- \r
- // it's possible that $url ends contains entities we don't want,\r
- // since htmlspecialchars is applied _before_ URL linking\r
- // move the part of URL, starting from the disallowed entity to the 'post' link part\r
- $aBadEntities = array('"', '>', '<');\r
- foreach ( $aBadEntities as $entity )\r
- {\r
- $pos = i18n::strpos($url, $entity);\r
- \r
- if ( $pos )\r
- {\r
- $post = i18n::substr($url, $pos) . $post;\r
- $url = i18n::substr($url, 0, $pos);\r
- }\r
- }\r
- \r
- // remove entities at end (&&&&)\r
- if ( preg_match('/(&\w+;)+$/i', $url, $matches) )\r
- {\r
- $post = $matches[0] . $post; // found entities (1 or more)\r
- $url = i18n::substr($url, 0, i18n::strlen($url) - i18n::strlen($post) );\r
- }\r
- \r
- // move ending comma from url to 'post' part\r
- if ( i18n::substr($url, i18n::strlen($url) - 1) == ',' )\r
- {\r
- $url = i18n::substr($url, 0, i18n::strlen($url) - 1);\r
- $post = ',' . $post;\r
- }\r
- \r
- # replaced ereg() below with preg_match(). ereg* functions are deprecated in PHP 5.3.0\r
- # original ereg: ereg('^' . $protocol . '://', $url)\r
- \r
- if ( !preg_match('#^' . $protocol . '://#', $url) )\r
- {\r
- $linkedUrl = $protocol . ( ($protocol == 'mailto') ? ':' : '://') . $url;\r
- }\r
- else\r
- {\r
- $linkedUrl = $url;\r
- }\r
- \r
- if ( $protocol != 'mailto' )\r
- {\r
- $displayedUrl = $linkedUrl;\r
- }\r
- else\r
- {\r
- $displayedUrl = $url;\r
- }\r
- \r
- return $pre . '<a href="' . $linkedUrl . '" rel="nofollow">' . Entity::hsc(Entity::shorten($displayedUrl,30,'...')) . '</a>' . $post;\r
- }\r
- \r
- /**\r
+ */
+ static private function createLinkCode($pre, $url, $protocol = 'http')
+ {
+ $post = '';
+
+ // it's possible that $url ends contains entities we don't want,
+ // since htmlspecialchars is applied _before_ URL linking
+ // move the part of URL, starting from the disallowed entity to the 'post' link part
+ $aBadEntities = array('"', '>', '<');
+ foreach ( $aBadEntities as $entity )
+ {
+ $pos = i18n::strpos($url, $entity);
+
+ if ( $pos )
+ {
+ $post = i18n::substr($url, $pos) . $post;
+ $url = i18n::substr($url, 0, $pos);
+ }
+ }
+
+ // remove entities at end (&&&&)
+ if ( preg_match('/(&\w+;)+$/i', $url, $matches) )
+ {
+ $post = $matches[0] . $post; // found entities (1 or more)
+ $url = i18n::substr($url, 0, i18n::strlen($url) - i18n::strlen($post) );
+ }
+
+ // move ending comma from url to 'post' part
+ if ( i18n::substr($url, i18n::strlen($url) - 1) == ',' )
+ {
+ $url = i18n::substr($url, 0, i18n::strlen($url) - 1);
+ $post = ',' . $post;
+ }
+
+ if ( !preg_match('#^' . $protocol . '://#', $url) )
+ {
+ $linkedUrl = $protocol . ( ($protocol == 'mailto') ? ':' : '://') . $url;
+ }
+ else
+ {
+ $linkedUrl = $url;
+ }
+
+ if ( $protocol != 'mailto' )
+ {
+ $displayedUrl = $linkedUrl;
+ }
+ else
+ {
+ $displayedUrl = $url;
+ }
+
+ return $pre . '<a href="' . $linkedUrl . '" rel="nofollow">' . Entity::hsc(Entity::shorten($displayedUrl,30,'...')) . '</a>' . $post;
+ }
+
+ /**
* Comment::prepareBody_cb()
- * This method is a callback for creating link codes\r
+ * This method is a callback for creating link codes
*
* @param array $match elements for achor
* @return string including anchor element and child text
*
- */\r
- function prepareBody_cb($match)\r
- {\r
- if ( !preg_match('/^[a-z]+/i', $match[2], $protocol) )\r
- {\r
- return $match[0];\r
- }\r
-\r
- switch( strtolower($protocol[0]) )\r
- {\r
- case 'https':\r
- return self::createLinkCode($match[1], $match[2], 'https');\r
- break;\r
-\r
- case 'ftp':\r
- return self::createLinkCode($match[1], $match[2], 'ftp');\r
- break;\r
-\r
- case 'mailto':\r
- return self::createLinkCode($match[1], $match[3], 'mailto');\r
- break;\r
-\r
- default:\r
- return self::createLinkCode($match[1], $match[2], 'http');\r
- break;\r
- }\r
+ */
+ static public function prepareBody_cb($match)
+ {
+ if ( !preg_match('/^[a-z]+/i', $match[2], $protocol) )
+ {
+ return $match[0];
+ }
+
+ switch( strtolower($protocol[0]) )
+ {
+ case 'https':
+ return self::createLinkCode($match[1], $match[2], 'https');
+ break;
+
+ case 'ftp':
+ return self::createLinkCode($match[1], $match[2], 'ftp');
+ break;
+
+ case 'mailto':
+ return self::createLinkCode($match[1], $match[3], 'mailto');
+ break;
+
+ default:
+ return self::createLinkCode($match[1], $match[2], 'http');
+ break;
+ }
return;
- }\r
-\r
-}\r
-\r
+ }
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * This class is used when parsing comment templates\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: CommentActions.php 1626 2012-01-09 15:46:54Z sakamocchi $\r
- */\r
-\r
-class CommentActions extends BaseActions\r
-{\r
- /**\r
- * CommentsActions::$commentsObj\r
- * ref to COMMENTS object which is using this object to handle its templatevars\r
- */\r
- private $commentsObj;\r
- \r
- /**\r
- * CommentsActions::$template\r
- * template to use to parse the comments\r
- */\r
- private $template;\r
- \r
- /**\r
- * CommentsActions::$currentComment\r
- * comment currenlty being handled (mysql result assoc array; see Comments::showComments())\r
- */\r
- private $currentComment;\r
- \r
- /**\r
- * CommentsActions::$defined_actions\r
- * defined actions in this class\r
- */\r
- static private $defined_actions = array(\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * This class is used when parsing comment templates
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: CommentActions.php 1626 2012-01-09 15:46:54Z sakamocchi $
+ */
+
+class CommentActions extends BaseActions
+{
+ /**
+ * CommentsActions::$commentsObj
+ * ref to COMMENTS object which is using this object to handle its templatevars
+ */
+ private $commentsObj;
+
+ /**
+ * CommentsActions::$template
+ * template to use to parse the comments
+ */
+ private $template;
+
+ /**
+ * CommentsActions::$currentComment
+ * comment currenlty being handled (mysql result assoc array; see Comments::showComments())
+ */
+ private $currentComment;
+
+ /**
+ * CommentsActions::$defined_actions
+ * defined actions in this class
+ */
+ static private $defined_actions = array(
'authtext',
'blogid',
- 'blogurl',\r
+ 'blogurl',
'body',
- 'commentcount',\r
+ 'commentcount',
'commentid',
- 'commentword',\r
+ 'commentword',
'date',
- 'email',\r
+ 'email',
'excerpt',
'host',
'ip',
'itemid',
- 'itemlink',\r
- 'itemtitle',\r
+ 'itemlink',
+ 'itemtitle',
'memberid',
'plugin',
'short',
- 'time',\r
- 'timestamp',\r
- 'user',\r
+ 'time',
+ 'timestamp',
+ 'user',
'useremail',
- 'userid',\r
+ 'userid',
'userlink',
- 'userlinkraw',\r
- 'userwebsite',\r
+ 'userlinkraw',
+ 'userwebsite',
'userwebsitelink'
- );\r
- \r
- /**\r
- * CommentActions::__construct()\r
- * \r
- * @param object $comments instance of Comments class\r
- * @return void\r
- */\r
- public function __construct(&$comments)\r
- {\r
- // call constructor of superclass first\r
+ );
+
+ /**
+ * CommentActions::__construct()
+ *
+ * @param object $comments instance of Comments class
+ * @return void
+ */
+ public function __construct(&$comments)
+ {
+ // call constructor of superclass first
parent::__construct();
- \r
- // reference to the comments object\r
- $this->setCommentsObj($comments);\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::getAvailableActions()\r
- * \r
- * @param void\r
- * @return array actions array\r
- */\r
- public function getAvailableActions()\r
- {\r
- return array_merge(self::$defined_actions, parent::getAvailableActions());\r
- }\r
- \r
- /**\r
- * \r
- * CommentActions::setCommentsObj()\r
- * \r
- * @param object $commentsObj instance of Comments class\r
- * @return void\r
- */\r
- public function setCommentsObj(&$commentsObj)\r
- {\r
- $this->commentsObj =& $commentsObj;\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::setTemplate()\r
- * \r
- * @param array $template array includes templates\r
- * @return void\r
- */\r
- public function setTemplate($template)\r
- {\r
- $this->template =& $template;\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::setCurrentComment()\r
- * Set $currentcommentid and $currentcommentarray\r
- * \r
- * @param array $comment associated array includes comment information\r
- * @return void\r
- */\r
- public function setCurrentComment(&$comment)\r
- {\r
- global $currentcommentid, $currentcommentarray, $manager;\r
- \r
- if ( $comment['memberid'] != 0 )\r
- {\r
- if ( !array_key_exists('COMMENTS_AUTH', $this->template) )\r
- {\r
- $comment['authtext'] = '';\r
- }\r
- else\r
- {\r
- $comment['authtext'] = $this->template['COMMENTS_AUTH'];\r
- }\r
- \r
- $mem =& $manager->getMember($comment['memberid']);\r
- $comment['user'] = $mem->getDisplayName();\r
- \r
- if ( $mem->getURL() )\r
- {\r
- $comment['userid'] = $mem->getURL();\r
- }\r
- else\r
- {\r
- $comment['userid'] = $mem->getEmail();\r
- }\r
- \r
- $data = array(\r
- 'memberid' => $comment['memberid'],\r
- 'name' => $mem->getDisplayName(),\r
- 'extra' => $this->commentsObj->itemActions->linkparams\r
- );\r
- \r
- $comment['userlinkraw'] = Link::create_link('member', $data);\r
- }\r
- else\r
- {\r
- // create smart links\r
- if ( !array_key_exists('userid', $comment) || !empty($comment['userid']) )\r
- {\r
- if ( (i18n::strpos($comment['userid'], 'http://') === 0) || (i18n::strpos($comment['userid'], 'https://') === 0) )\r
- {\r
- $comment['userlinkraw'] = $comment['userid'];\r
- }\r
- else\r
- {\r
- $comment['userlinkraw'] = 'http://' . $comment['userid'];\r
- }\r
- }\r
- else if ( NOTIFICATION::address_validation($comment['email']) )\r
- {\r
- $comment['userlinkraw'] = 'mailto:' . $comment['email'];\r
- }\r
- else if ( NOTIFICATION::address_validation($comment['userid']) )\r
- {\r
- $comment['userlinkraw'] = 'mailto:' . $comment['userid'];\r
- }\r
- }\r
- \r
- $this->currentComment =& $comment;\r
- $currentcommentid = $comment['commentid'];\r
- $currentcommentarray = $comment;\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_authtext()\r
- * Parse templatevar authtext\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_authtext()\r
- {\r
- if ( $this->currentComment['memberid'] != 0 )\r
- {\r
- $this->parser->parse($this->template['COMMENTS_AUTH']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_blogid()\r
- * Parse templatevar blogid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_blogid() {\r
- echo $this->currentComment['blogid'];\r
- }\r
- \r
- /**\r
- * CommentActions::parse_blogurl()\r
- * Parse templatevar blogurl\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_blogurl()\r
- {\r
- global $manager;\r
- $item =& $manager->getItem($this->commentsObj->itemid, 1, 1);\r
- $blog =& $manager->getBlog($item['blogid']);\r
- echo $blog->getURL();\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_body()\r
- * Parse templatevar body\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_body() {\r
- echo $this->highlight($this->currentComment['body']);\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_commentcount()\r
- * Parse templatevar commentcount\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_commentcount()\r
- {\r
- echo $this->commentsObj->commentcount;\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_commentid()\r
- * Parse templatevar commentid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_commentid()\r
- {\r
- echo $this->currentComment['commentid'];\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_commentword()\r
- * Parse templatevar commentword\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_commentword()\r
- {\r
- if ( $this->commentsObj->commentcount == 1 )\r
- {\r
- echo $this->template['COMMENTS_ONE'];\r
- }\r
- else\r
- {\r
- echo $this->template['COMMENTS_MANY'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_date()\r
- * Parse templatevar date\r
- * \r
- * @format String $format Date format according to PHP\r
- * @return void\r
- */\r
- public function parse_date($format = '')\r
- {\r
- if ( $format !== '' )\r
- {\r
- /* do nothing */\r
- ;\r
- }\r
- else if ( !array_key_exists('FORMAT_DATE', $this->template) || $this->template['FORMAT_DATE'] === '' )\r
- {\r
- $format = '%X';\r
- }\r
- else\r
- {\r
- $format = $this->template['FORMAT_DATE'];\r
- }\r
- \r
- $offset = $this->commentsObj->itemActions->blog->getTimeOffset() * 3600;\r
- \r
- echo i18n::formatted_datetime($format, $this->currentComment['timestamp'], $offset);\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_excerpt()\r
- * Parse templatevar email\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_email()\r
- {\r
- $email = $this->currentComment['email'];\r
- $email = str_replace('@', ' (at) ', $email);\r
- $email = str_replace('.', ' (dot) ', $email);\r
- echo $email;\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_excerpt()\r
- * Parse templatevar excerpt\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_excerpt()\r
- {\r
- echo Entity::hen(Entity::shorten($this->currentComment['body'], 60, '...'));\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_host()\r
- * Parse templatevar host\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_host()\r
- {\r
- echo $this->currentComment['host'];\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_ip()\r
- * Parse templatevar ip\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_ip()\r
- {\r
- echo $this->currentComment['ip'];\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_itemid()\r
- * Parse templatevar itemid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_itemid()\r
- {\r
- echo $this->commentsObj->itemid;\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_itemlink()\r
- * Parse templatevar itemlink\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_itemlink()\r
- {\r
- $data = array(\r
- 'itemid' => $this->commentsObj->itemid,\r
- 'timestamp' => $this->commentsObj->itemActions->currentItem['timestamp'],\r
- 'title' => $this->commentsObj->itemActions->currentItem['title'],\r
- 'extra' => $this->commentsObj->itemActions->linkparams\r
- );\r
- \r
- echo Link::create_link('item', $data);\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_itemtitle()\r
- * Parse templatevar itemtitle\r
- * \r
- * @param integer $maxLength maximum length for item title\r
- * @return void\r
- */\r
- public function parse_itemtitle($maxLength = 0)\r
- {\r
- if ( $maxLength == 0 )\r
- {\r
- $this->commentsObj->itemActions->parse_title();\r
- }\r
- else\r
- {\r
- $this->commentsObj->itemActions->parse_syndicate_title($maxLength);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_memberid()\r
- * Parse templatevar memberid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_memberid()\r
- {\r
- echo $this->currentComment['memberid'];\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_short()\r
- * Parse templatevar short\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_short()\r
- {\r
- $tmp = strtok($this->currentComment['body'], "\n");\r
- $tmp = str_replace('<br />', '', $tmp);\r
- echo $tmp;\r
- if ( $tmp != $this->currentComment['body'] )\r
- {\r
- $this->parser->parse($this->template['COMMENTS_CONTINUED']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_time()\r
- * Parse templatevar time\r
- * \r
- * @param string $format datetime format referring to strftime() in PHP's built-in function\r
- * @return void\r
- */\r
- public function parse_time($format = '')\r
- {\r
+
+ // reference to the comments object
+ $this->setCommentsObj($comments);
+ return;
+ }
+
+ /**
+ * CommentActions::getAvailableActions()
+ *
+ * @param void
+ * @return array actions array
+ */
+ public function getAvailableActions()
+ {
+ return array_merge(self::$defined_actions, parent::getAvailableActions());
+ }
+
+ /**
+ *
+ * CommentActions::setCommentsObj()
+ *
+ * @param object $commentsObj instance of Comments class
+ * @return void
+ */
+ public function setCommentsObj(&$commentsObj)
+ {
+ $this->commentsObj =& $commentsObj;
+ return;
+ }
+
+ /**
+ * CommentActions::setTemplate()
+ *
+ * @param array $template array includes templates
+ * @return void
+ */
+ public function setTemplate($template)
+ {
+ $this->template =& $template;
+ return;
+ }
+
+ /**
+ * CommentActions::setCurrentComment()
+ * Set $currentcommentid and $currentcommentarray
+ *
+ * @param array $comment associated array includes comment information
+ * @return void
+ */
+ public function setCurrentComment(&$comment)
+ {
+ global $currentcommentid, $currentcommentarray, $manager;
+
+ if ( $comment['memberid'] != 0 )
+ {
+ if ( !array_key_exists('COMMENTS_AUTH', $this->template) )
+ {
+ $comment['authtext'] = '';
+ }
+ else
+ {
+ $comment['authtext'] = $this->template['COMMENTS_AUTH'];
+ }
+
+ $mem =& $manager->getMember($comment['memberid']);
+ $comment['user'] = $mem->getDisplayName();
+
+ if ( $mem->getURL() )
+ {
+ $comment['userid'] = $mem->getURL();
+ }
+ else
+ {
+ $comment['userid'] = $mem->getEmail();
+ }
+
+ $data = array(
+ 'memberid' => $comment['memberid'],
+ 'name' => $mem->getDisplayName(),
+ 'extra' => $this->commentsObj->itemActions->linkparams
+ );
+
+ $comment['userlinkraw'] = Link::create_link('member', $data);
+ }
+ else
+ {
+ // create smart links
+ if ( !array_key_exists('userid', $comment) || !empty($comment['userid']) )
+ {
+ if ( (i18n::strpos($comment['userid'], 'http://') === 0) || (i18n::strpos($comment['userid'], 'https://') === 0) )
+ {
+ $comment['userlinkraw'] = $comment['userid'];
+ }
+ else
+ {
+ $comment['userlinkraw'] = 'http://' . $comment['userid'];
+ }
+ }
+ else if ( NOTIFICATION::address_validation($comment['email']) )
+ {
+ $comment['userlinkraw'] = 'mailto:' . $comment['email'];
+ }
+ else if ( NOTIFICATION::address_validation($comment['userid']) )
+ {
+ $comment['userlinkraw'] = 'mailto:' . $comment['userid'];
+ }
+ }
+
+ $this->currentComment =& $comment;
+ $currentcommentid = $comment['commentid'];
+ $currentcommentarray = $comment;
+ return;
+ }
+
+ /**
+ * CommentActions::parse_authtext()
+ * Parse templatevar authtext
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_authtext()
+ {
+ if ( $this->currentComment['memberid'] != 0 )
+ {
+ $this->parser->parse($this->template['COMMENTS_AUTH']);
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::parse_blogid()
+ * Parse templatevar blogid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_blogid() {
+ echo $this->currentComment['blogid'];
+ }
+
+ /**
+ * CommentActions::parse_blogurl()
+ * Parse templatevar blogurl
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_blogurl()
+ {
+ global $manager;
+ $item =& $manager->getItem($this->commentsObj->itemid, 1, 1);
+ $blog =& $manager->getBlog($item['blogid']);
+ echo $blog->getURL();
+ return;
+ }
+
+ /**
+ * CommentActions::parse_body()
+ * Parse templatevar body
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_body() {
+ echo $this->highlight($this->currentComment['body']);
+ return;
+ }
+
+ /**
+ * CommentActions::parse_commentcount()
+ * Parse templatevar commentcount
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_commentcount()
+ {
+ echo $this->commentsObj->commentcount;
+ return;
+ }
+
+ /**
+ * CommentActions::parse_commentid()
+ * Parse templatevar commentid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_commentid()
+ {
+ echo $this->currentComment['commentid'];
+ return;
+ }
+
+ /**
+ * CommentActions::parse_commentword()
+ * Parse templatevar commentword
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_commentword()
+ {
+ if ( $this->commentsObj->commentcount == 1 )
+ {
+ echo $this->template['COMMENTS_ONE'];
+ }
+ else
+ {
+ echo $this->template['COMMENTS_MANY'];
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::parse_date()
+ * Parse templatevar date
+ *
+ * @format String $format Date format according to PHP
+ * @return void
+ */
+ public function parse_date($format = '')
+ {
if ( $format !== '' )
- {\r
- /* do nothing */\r
- ;\r
- }\r
- else if ( !array_key_exists('FORMAT_TIME', $this->template) || $this->template['FORMAT_TIME'] === '' )\r
- {\r
- $format = '%x';\r
- }\r
- else\r
- {\r
- $format = $this->template['FORMAT_TIME'];\r
- }\r
- \r
- echo i18n::formatted_datetime($format, $this->currentComment['timestamp']);\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_timestamp()\r
- * Parse templatevar timestamp\r
- * \r
- * @param void\r
- * @return void\r
- * \r
- */\r
- public function parse_timestamp()\r
- {\r
- echo $this->currentComment['timestamp'];\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_plugin()\r
- * Executes a plugin templatevar\r
- *\r
- * @param string $pluginName name of plugin (without the NP_)\r
- * @param extra parameters can be added\r
- * @return void\r
- */\r
- public function parse_plugin($pluginName)\r
- {\r
- global $manager;\r
- \r
- // only continue when the plugin is really installed\r
- if ( !$manager->pluginInstalled("NP_{$pluginName}") )\r
- {\r
- return;\r
- }\r
- \r
- $plugin =& $manager->getPlugin("NP_{$pluginName}");\r
- if ( !$plugin )\r
- {\r
- return;\r
- }\r
- \r
- // get arguments\r
- $params = func_get_args();\r
- \r
- // remove plugin name\r
- array_shift($params);\r
- \r
- // pass info on current item and current comment as well\r
- $params = array_merge(array(&$this->currentComment), $params);\r
- $params = array_merge(array(&$this->commentsObj->itemActions->currentItem), $params);\r
- \r
- call_user_func_array(array(&$plugin,'doTemplateCommentsVar'), $params);\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_user()\r
- * Parse templatevar user\r
- * \r
- * @param string $mode realname or else\r
- * @return void\r
- */\r
- public function parse_user($mode = '')\r
- {\r
- global $manager;\r
- \r
- if ( $mode == 'realname' && $this->currentComment['memberid'] > 0 )\r
- {\r
- $member =& $manager->getMember($this->currentComment['memberid']);\r
- echo $member->getRealName();\r
- }\r
- else\r
- {\r
- echo Entity::hsc($this->currentComment['user']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_useremail()\r
- * Output mail address\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_useremail() {\r
- global $manager;\r
- if ( $this->currentComment['memberid'] > 0 )\r
- {\r
- $member =& $manager->getMember($this->currentComment['memberid']);\r
- \r
- if ( $member->email != '' )\r
- {\r
- echo $member->email;\r
- }\r
- }\r
- else\r
- {\r
- if ( NOTIFICATION::address_validation($this->currentComment['email']) )\r
- {\r
- echo $this->currentComment['email'];\r
- }\r
- elseif ( NOTIFICATION::address_validation($this->currentComment['userid']) )\r
- {\r
- echo $this->currentComment['userid'];\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_userid()\r
- * Parse templatevar userid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_userid()\r
- {\r
- echo $this->currentComment['userid'];\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_userlink()\r
- * Parse templatevar userlink\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_userlink()\r
- {\r
- if ( $this->currentComment['userlinkraw'] )\r
- {\r
- echo '<a href="'.$this->currentComment['userlinkraw'].'" rel="nofollow">'.$this->currentComment['user'].'</a>';\r
- }\r
- else\r
- {\r
- echo $this->currentComment['user'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_userlinkraw()\r
- * Parse templatevar userlinkraw\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_userlinkraw()\r
- {\r
- echo (array_key_exists('userlinkraw', $this->currentComment) && !empty($this->currentComment['userlinkraw'])) ? $this->currentComment['userlinkraw'] : '';\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_userwebsite()\r
- * Parse templatevar userwebsite\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_userwebsite()\r
- {\r
- if ( !(i18n::strpos($this->currentComment['userlinkraw'], 'http://') === false) )\r
- {\r
- echo $this->currentComment['userlinkraw'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::parse_userwebsitelink()\r
- * Parse templatevar userwebsitelink\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_userwebsitelink()\r
- {\r
- if ( !(i18n::strpos($this->currentComment['userlinkraw'], 'http://') === false) )\r
- {\r
- echo '<a href="'.$this->currentComment['userlinkraw'].'" rel="nofollow">'.$this->currentComment['user'].'</a>';\r
- }\r
- else\r
- {\r
- echo $this->currentComment['user'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * CommentActions::checkCondition()\r
- * Checks conditions for if statements\r
- *\r
- * @param string $field type of <%if%>\r
- * @param string $name property of field\r
- * @param string $value value of property\r
- * @return boolean\r
- */\r
- protected function checkCondition($field, $name='', $value = '') {\r
- global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;\r
- $condition = 0;\r
- switch ( $field )\r
- {\r
- case 'category':\r
- $condition = ($blog && $this->ifCategory($name,$value));\r
- break;\r
- case 'itemcategory':\r
- $condition = ($this->ifItemCategory($name,$value));\r
- break;\r
- case 'blogsetting':\r
- $condition = ($blog && ($blog->getSetting($name) == $value));\r
- break;\r
- case 'itemblogsetting':\r
- $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);\r
- $blog =& $manager->getBlog($item['blogid']);\r
- $condition = ($blog && ($blog->getSetting($name) == $value));\r
- break;\r
- case 'loggedin':\r
- $condition = $member->isLoggedIn();\r
- break;\r
- case 'onteam':\r
- $condition = $member->isLoggedIn() && $this->ifOnTeam($name);\r
- break;\r
- case 'admin':\r
- $condition = $member->isLoggedIn() && $this->ifAdmin($name);\r
- break;\r
- case 'author':\r
- $condition = ($this->ifAuthor($name,$value));\r
- break;\r
- case 'hasplugin':\r
- $condition = $this->ifHasPlugin($name, $value);\r
- break;\r
- default:\r
- $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);\r
- break;\r
- }\r
- return $condition;\r
- }\r
- \r
- /**\r
- * CommentActions::ifCategory()\r
- * Different checks for a category\r
- * \r
- * @param string $key key of category\r
- * @param string $value value for key of category\r
- * @return boolean\r
- */\r
- private function ifCategory($key = '', $value = '')\r
- {\r
- global $blog, $catid;\r
- \r
- // when no parameter is defined, just check if a category is selected\r
- if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
- {\r
- return $blog->isValidCategory($catid);\r
- }\r
- \r
- // check category name\r
- if ( $key == 'catname' )\r
- {\r
- $value = $blog->getCategoryIdFromName($value);\r
- if ($value == $catid)\r
- return $blog->isValidCategory($catid);\r
- }\r
- \r
- // check category id\r
- if ( ($key == 'catid') && ($value == $catid) )\r
- {\r
- return $blog->isValidCategory($catid);\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
- * CommentActions::ifAuthor()\r
- * Different checks for an author\r
- *\r
- * @param string $key key of data for author\r
- * @param string $value value of data for author\r
- * @return boolean correct or not\r
- */\r
- private function ifAuthor($key = '', $value = '')\r
- {\r
- global $member, $manager;\r
- \r
- if ( $this->currentComment['memberid'] == 0 )\r
- {\r
- return FALSE;\r
- }\r
- \r
- $member =& $manager->getMember($this->currentComment['memberid']);\r
- $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);\r
- \r
- // when no parameter is defined, just check if item author is current visitor\r
- if ( ($key != 'isadmin' && $key != 'name' && $key != 'isauthor' && $key != 'isonteam') )\r
- {\r
- return (intval($memberber->getID()) > 0 && intval($memberber->getID()) == (integer) $item['authorid']);\r
- }\r
- \r
- // check comment author name\r
- if ( $key == 'name' )\r
- {\r
- $value = trim(strtolower($value));\r
- if ( $value == '' )\r
- {\r
- return FALSE;\r
- }\r
- if ( $value == strtolower($member->getDisplayName()) )\r
- {\r
- return TRUE;\r
- }\r
- }\r
- \r
- // check if comment author is admin\r
- if ( $key == 'isadmin' )\r
- {\r
- if ( $member->isAdmin() )\r
- {\r
- return TRUE;\r
- }\r
- return $member->isBlogAdmin($item['blogid']);\r
- }\r
- \r
- // check if comment author is item author\r
- if ( $key == 'isauthor' )\r
- {\r
- return ((integer) $item['authorid'] == (integer) $this->currentComment['memberid']);\r
- }\r
- \r
- // check if comment author is on team\r
- if ( $key == 'isonteam' )\r
- {\r
- return $member->teamRights((integer) $item['blogid']);\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
- * CommentActions::ifItemCategory()\r
- * Different checks for a category\r
- *\r
- * @param string $key key of data for category to which item belongs\r
- * @param string $value value of data for category to which item belongs\r
- * @return boolean correct or not\r
- */\r
- private function ifItemCategory($key = '', $value = '')\r
- {\r
- global $catid, $manager;\r
- \r
- $item =& $manager->getItem($this->currentComment['itemid'],1,1);\r
- $blog =& $manager->getBlog($item['blogid']);\r
- \r
- // when no parameter is defined, just check if a category is selected\r
- if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
- {\r
- return $blog->isValidCategory($item['catid']);\r
- }\r
- \r
- // check category name\r
- if ( $key == 'catname' )\r
- {\r
- $value = $blog->getCategoryIdFromName($value);\r
- if ( $value == $item['catid'] )\r
- {\r
- return $blog->isValidCategory($item['catid']);\r
- }\r
- }\r
- \r
- // check category id\r
- if ( ($key == 'catid') && ($value == $item['catid']) )\r
- {\r
- return $blog->isValidCategory($item['catid']);\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
- * CommentActions::ifOnTeam()\r
- * Checks if a member is on the team of a blog and return his rights\r
- * \r
- * @param string $blogName name of weblog\r
- * @return boolean correct or not\r
- */\r
- private function ifOnTeam($blogName = '')\r
- {\r
- global $member, $manager;\r
- \r
- $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);\r
- $blog =& $manager->getBlog($item['blogid']);\r
- \r
- // when no blog found\r
- if ( ($blogName == '') && !is_object($blog) )\r
- {\r
- return 0;\r
- }\r
- \r
- // explicit blog selection\r
- if ( $blogName != '' )\r
- {\r
- $blogid = getBlogIDFromName($blogName);\r
- }\r
- \r
- // use current blog\r
- if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
- {\r
- $blogid = $blog->getID();\r
- }\r
- \r
- return $member->teamRights($blogid);\r
- }\r
- \r
- /**\r
- * CommentActions::ifAdmin()\r
- * Checks if a member is admin of a blog\r
- * \r
- * @param string $blogName name of weblog\r
- * @return boolean correct or not\r
- */\r
- private function ifAdmin($blogName = '')\r
- {\r
- global $member, $manager;\r
- \r
- $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);\r
- $blog =& $manager->getBlog($item['blogid']);\r
- \r
- // when no blog found\r
- if ( ($blogName == '') && !is_object($blog) )\r
- {\r
- return 0;\r
- }\r
- \r
- // explicit blog selection\r
- if ( $blogName != '' )\r
- {\r
- $blogid = getBlogIDFromName($blogName);\r
- }\r
- \r
- // use current blog\r
- if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
- {\r
- $blogid = $blog->getID();\r
- }\r
- \r
- return $member->isBlogAdmin($blogid);\r
- }\r
- \r
- /**\r
- * CommentActions::ifHasPlugin()\r
- * hasplugin,PlugName\r
- * -> checks if plugin exists\r
- * hasplugin,PlugName,OptionName\r
- * -> checks if the option OptionName from plugin PlugName is not set to 'no'\r
- * hasplugin,PlugName,OptionName=value\r
- * -> checks if the option OptionName from plugin PlugName is set to value\r
- *\r
- * @param string $name name of plugin\r
- * @param string $value key (and value) of plugin option\r
- * @return boolean correct or not\r
- */\r
- private function ifHasPlugin($name, $value)\r
- {\r
- global $manager;\r
- $condition = FALSE;\r
- \r
- // (pluginInstalled method won't write a message in the actionlog on failure)\r
- if ( $manager->pluginInstalled('NP_'.$name) )\r
- {\r
- $plugin =& $manager->getPlugin("NP_{$name}");\r
- if ( $plugin != NULL )\r
- {\r
- if ( $value == "" )\r
- {\r
- $condition = true;\r
- }\r
- else\r
- {\r
- list($name2, $value2) = preg_split('#=#', $value, 2);\r
- if ( $value2 == "" && $plugin->getOption($name2) != 'no' )\r
- {\r
- $condition = true;\r
- }\r
- else if ( $plugin->getOption($name2) == $value2 )\r
- {\r
- $condition = true;\r
- }\r
- }\r
- }\r
- }\r
- return $condition;\r
- }\r
- \r
- /**\r
- * CommentActions::ifPlugin()\r
- * Checks if a plugin exists and call its doIf function\r
- * \r
- * @param string $name name of plugin\r
- * @param string $key key of plugin option\r
- * @param string $value value of plugin option\r
- * @return boolean callback output from plugin\r
- */\r
- private function ifPlugin($name, $key = '', $value = '')\r
- {\r
- global $manager;\r
- \r
- $plugin =& $manager->getPlugin("NP_{$name}");\r
- if ( !$plugin )\r
- {\r
- return;\r
- }\r
- \r
- $params = func_get_args();\r
- array_shift($params);\r
- \r
- return call_user_func_array(array(&$plugin, 'doIf'), $params);\r
- }\r
-}\r
+ {
+ /* do nothing */
+ ;
+ }
+ else if ( !array_key_exists('FORMAT_DATE', $this->template) || $this->template['FORMAT_DATE'] === '' )
+ {
+ $format = '%X';
+ }
+ else
+ {
+ $format = $this->template['FORMAT_DATE'];
+ }
+
+ $offset = $this->commentsObj->itemActions->blog->getTimeOffset() * 3600;
+
+ echo i18n::formatted_datetime($format, $this->currentComment['timestamp'], $offset);
+ return;
+ }
+
+ /**
+ * CommentActions::parse_excerpt()
+ * Parse templatevar email
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_email()
+ {
+ $email = $this->currentComment['email'];
+ $email = str_replace('@', ' (at) ', $email);
+ $email = str_replace('.', ' (dot) ', $email);
+ echo $email;
+ return;
+ }
+
+ /**
+ * CommentActions::parse_excerpt()
+ * Parse templatevar excerpt
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_excerpt()
+ {
+ echo Entity::hen(Entity::shorten($this->currentComment['body'], 60, '...'));
+ return;
+ }
+
+ /**
+ * CommentActions::parse_host()
+ * Parse templatevar host
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_host()
+ {
+ echo $this->currentComment['host'];
+ return;
+ }
+
+ /**
+ * CommentActions::parse_ip()
+ * Parse templatevar ip
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_ip()
+ {
+ echo $this->currentComment['ip'];
+ return;
+ }
+
+ /**
+ * CommentActions::parse_itemid()
+ * Parse templatevar itemid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_itemid()
+ {
+ echo $this->commentsObj->itemid;
+ return;
+ }
+
+ /**
+ * CommentActions::parse_itemlink()
+ * Parse templatevar itemlink
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_itemlink()
+ {
+ $data = array(
+ 'itemid' => $this->commentsObj->itemid,
+ 'timestamp' => $this->commentsObj->itemActions->currentItem['timestamp'],
+ 'title' => $this->commentsObj->itemActions->currentItem['title'],
+ 'extra' => $this->commentsObj->itemActions->linkparams
+ );
+
+ echo Link::create_link('item', $data);
+ return;
+ }
+
+ /**
+ * CommentActions::parse_itemtitle()
+ * Parse templatevar itemtitle
+ *
+ * @param integer $maxLength maximum length for item title
+ * @return void
+ */
+ public function parse_itemtitle($maxLength = 0)
+ {
+ if ( $maxLength == 0 )
+ {
+ $this->commentsObj->itemActions->parse_title();
+ }
+ else
+ {
+ $this->commentsObj->itemActions->parse_syndicate_title($maxLength);
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::parse_memberid()
+ * Parse templatevar memberid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_memberid()
+ {
+ echo $this->currentComment['memberid'];
+ return;
+ }
+
+ /**
+ * CommentActions::parse_short()
+ * Parse templatevar short
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_short()
+ {
+ $tmp = strtok($this->currentComment['body'], "\n");
+ $tmp = str_replace('<br />', '', $tmp);
+ echo $tmp;
+ if ( $tmp != $this->currentComment['body'] )
+ {
+ $this->parser->parse($this->template['COMMENTS_CONTINUED']);
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::parse_time()
+ * Parse templatevar time
+ *
+ * @param string $format datetime format referring to strftime() in PHP's built-in function
+ * @return void
+ */
+ public function parse_time($format = '')
+ {
+ if ( $format !== '' )
+ {
+ /* do nothing */
+ ;
+ }
+ else if ( !array_key_exists('FORMAT_TIME', $this->template) || $this->template['FORMAT_TIME'] === '' )
+ {
+ $format = '%x';
+ }
+ else
+ {
+ $format = $this->template['FORMAT_TIME'];
+ }
+
+ echo i18n::formatted_datetime($format, $this->currentComment['timestamp']);
+ return;
+ }
+
+ /**
+ * CommentActions::parse_timestamp()
+ * Parse templatevar timestamp
+ *
+ * @param void
+ * @return void
+ *
+ */
+ public function parse_timestamp()
+ {
+ echo $this->currentComment['timestamp'];
+ return;
+ }
+
+ /**
+ * CommentActions::parse_plugin()
+ * Executes a plugin templatevar
+ *
+ * @param string $pluginName name of plugin (without the NP_)
+ * @param extra parameters can be added
+ * @return void
+ */
+ public function parse_plugin($pluginName)
+ {
+ global $manager;
+
+ // only continue when the plugin is really installed
+ if ( !$manager->pluginInstalled("NP_{$pluginName}") )
+ {
+ return;
+ }
+
+ $plugin =& $manager->getPlugin("NP_{$pluginName}");
+ if ( !$plugin )
+ {
+ return;
+ }
+
+ // get arguments
+ $params = func_get_args();
+
+ // remove plugin name
+ array_shift($params);
+
+ // pass info on current item and current comment as well
+ $params = array_merge(array(&$this->currentComment), $params);
+ $params = array_merge(array(&$this->commentsObj->itemActions->currentItem), $params);
+
+ call_user_func_array(array(&$plugin,'doTemplateCommentsVar'), $params);
+ return;
+ }
+
+ /**
+ * CommentActions::parse_user()
+ * Parse templatevar user
+ *
+ * @param string $mode realname or else
+ * @return void
+ */
+ public function parse_user($mode = '')
+ {
+ global $manager;
+
+ if ( $mode == 'realname' && $this->currentComment['memberid'] > 0 )
+ {
+ $member =& $manager->getMember($this->currentComment['memberid']);
+ echo $member->getRealName();
+ }
+ else
+ {
+ echo Entity::hsc($this->currentComment['user']);
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::parse_useremail()
+ * Output mail address
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_useremail() {
+ global $manager;
+ if ( $this->currentComment['memberid'] > 0 )
+ {
+ $member =& $manager->getMember($this->currentComment['memberid']);
+
+ if ( $member->email != '' )
+ {
+ echo $member->email;
+ }
+ }
+ else
+ {
+ if ( NOTIFICATION::address_validation($this->currentComment['email']) )
+ {
+ echo $this->currentComment['email'];
+ }
+ elseif ( NOTIFICATION::address_validation($this->currentComment['userid']) )
+ {
+ echo $this->currentComment['userid'];
+ }
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::parse_userid()
+ * Parse templatevar userid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_userid()
+ {
+ echo $this->currentComment['userid'];
+ return;
+ }
+
+ /**
+ * CommentActions::parse_userlink()
+ * Parse templatevar userlink
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_userlink()
+ {
+ if ( $this->currentComment['userlinkraw'] )
+ {
+ echo '<a href="'.$this->currentComment['userlinkraw'].'" rel="nofollow">'.$this->currentComment['user'].'</a>';
+ }
+ else
+ {
+ echo $this->currentComment['user'];
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::parse_userlinkraw()
+ * Parse templatevar userlinkraw
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_userlinkraw()
+ {
+ echo (array_key_exists('userlinkraw', $this->currentComment) && !empty($this->currentComment['userlinkraw'])) ? $this->currentComment['userlinkraw'] : '';
+ return;
+ }
+
+ /**
+ * CommentActions::parse_userwebsite()
+ * Parse templatevar userwebsite
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_userwebsite()
+ {
+ if ( !(i18n::strpos($this->currentComment['userlinkraw'], 'http://') === false) )
+ {
+ echo $this->currentComment['userlinkraw'];
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::parse_userwebsitelink()
+ * Parse templatevar userwebsitelink
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_userwebsitelink()
+ {
+ if ( !(i18n::strpos($this->currentComment['userlinkraw'], 'http://') === false) )
+ {
+ echo '<a href="'.$this->currentComment['userlinkraw'].'" rel="nofollow">'.$this->currentComment['user'].'</a>';
+ }
+ else
+ {
+ echo $this->currentComment['user'];
+ }
+ return;
+ }
+
+ /**
+ * CommentActions::checkCondition()
+ * Checks conditions for if statements
+ *
+ * @param string $field type of <%if%>
+ * @param string $name property of field
+ * @param string $value value of property
+ * @return boolean
+ */
+ protected function checkCondition($field, $name='', $value = '') {
+ global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
+ $condition = 0;
+ switch ( $field )
+ {
+ case 'category':
+ $condition = ($blog && $this->ifCategory($name,$value));
+ break;
+ case 'itemcategory':
+ $condition = ($this->ifItemCategory($name,$value));
+ break;
+ case 'blogsetting':
+ $condition = ($blog && ($blog->getSetting($name) == $value));
+ break;
+ case 'itemblogsetting':
+ $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);
+ $blog =& $manager->getBlog($item['blogid']);
+ $condition = ($blog && ($blog->getSetting($name) == $value));
+ break;
+ case 'loggedin':
+ $condition = $member->isLoggedIn();
+ break;
+ case 'onteam':
+ $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
+ break;
+ case 'admin':
+ $condition = $member->isLoggedIn() && $this->ifAdmin($name);
+ break;
+ case 'author':
+ $condition = ($this->ifAuthor($name,$value));
+ break;
+ case 'hasplugin':
+ $condition = $this->ifHasPlugin($name, $value);
+ break;
+ default:
+ $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);
+ break;
+ }
+ return $condition;
+ }
+
+ /**
+ * CommentActions::ifCategory()
+ * Different checks for a category
+ *
+ * @param string $key key of category
+ * @param string $value value for key of category
+ * @return boolean
+ */
+ private function ifCategory($key = '', $value = '')
+ {
+ global $blog, $catid;
+
+ // when no parameter is defined, just check if a category is selected
+ if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+ {
+ return $blog->isValidCategory($catid);
+ }
+
+ // check category name
+ if ( $key == 'catname' )
+ {
+ $value = $blog->getCategoryIdFromName($value);
+ if ($value == $catid)
+ return $blog->isValidCategory($catid);
+ }
+
+ // check category id
+ if ( ($key == 'catid') && ($value == $catid) )
+ {
+ return $blog->isValidCategory($catid);
+ }
+ return FALSE;
+ }
+
+ /**
+ * CommentActions::ifAuthor()
+ * Different checks for an author
+ *
+ * @param string $key key of data for author
+ * @param string $value value of data for author
+ * @return boolean correct or not
+ */
+ private function ifAuthor($key = '', $value = '')
+ {
+ global $member, $manager;
+
+ if ( $this->currentComment['memberid'] == 0 )
+ {
+ return FALSE;
+ }
+
+ $member =& $manager->getMember($this->currentComment['memberid']);
+ $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);
+
+ // when no parameter is defined, just check if item author is current visitor
+ if ( ($key != 'isadmin' && $key != 'name' && $key != 'isauthor' && $key != 'isonteam') )
+ {
+ return (intval($memberber->getID()) > 0 && intval($memberber->getID()) == (integer) $item['authorid']);
+ }
+
+ // check comment author name
+ if ( $key == 'name' )
+ {
+ $value = trim(strtolower($value));
+ if ( $value == '' )
+ {
+ return FALSE;
+ }
+ if ( $value == strtolower($member->getDisplayName()) )
+ {
+ return TRUE;
+ }
+ }
+
+ // check if comment author is admin
+ if ( $key == 'isadmin' )
+ {
+ if ( $member->isAdmin() )
+ {
+ return TRUE;
+ }
+ return $member->isBlogAdmin($item['blogid']);
+ }
+
+ // check if comment author is item author
+ if ( $key == 'isauthor' )
+ {
+ return ((integer) $item['authorid'] == (integer) $this->currentComment['memberid']);
+ }
+
+ // check if comment author is on team
+ if ( $key == 'isonteam' )
+ {
+ return $member->teamRights((integer) $item['blogid']);
+ }
+ return FALSE;
+ }
+
+ /**
+ * CommentActions::ifItemCategory()
+ * Different checks for a category
+ *
+ * @param string $key key of data for category to which item belongs
+ * @param string $value value of data for category to which item belongs
+ * @return boolean correct or not
+ */
+ private function ifItemCategory($key = '', $value = '')
+ {
+ global $catid, $manager;
+
+ $item =& $manager->getItem($this->currentComment['itemid'],1,1);
+ $blog =& $manager->getBlog($item['blogid']);
+
+ // when no parameter is defined, just check if a category is selected
+ if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+ {
+ return $blog->isValidCategory($item['catid']);
+ }
+
+ // check category name
+ if ( $key == 'catname' )
+ {
+ $value = $blog->getCategoryIdFromName($value);
+ if ( $value == $item['catid'] )
+ {
+ return $blog->isValidCategory($item['catid']);
+ }
+ }
+
+ // check category id
+ if ( ($key == 'catid') && ($value == $item['catid']) )
+ {
+ return $blog->isValidCategory($item['catid']);
+ }
+ return FALSE;
+ }
+
+ /**
+ * CommentActions::ifOnTeam()
+ * Checks if a member is on the team of a blog and return his rights
+ *
+ * @param string $blogName name of weblog
+ * @return boolean correct or not
+ */
+ private function ifOnTeam($blogName = '')
+ {
+ global $member, $manager;
+
+ $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);
+ $blog =& $manager->getBlog($item['blogid']);
+
+ // when no blog found
+ if ( ($blogName == '') && !is_object($blog) )
+ {
+ return 0;
+ }
+
+ // explicit blog selection
+ if ( $blogName != '' )
+ {
+ $blogid = getBlogIDFromName($blogName);
+ }
+
+ // use current blog
+ if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+ {
+ $blogid = $blog->getID();
+ }
+
+ return $member->teamRights($blogid);
+ }
+
+ /**
+ * CommentActions::ifAdmin()
+ * Checks if a member is admin of a blog
+ *
+ * @param string $blogName name of weblog
+ * @return boolean correct or not
+ */
+ private function ifAdmin($blogName = '')
+ {
+ global $member, $manager;
+
+ $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);
+ $blog =& $manager->getBlog($item['blogid']);
+
+ // when no blog found
+ if ( ($blogName == '') && !is_object($blog) )
+ {
+ return 0;
+ }
+
+ // explicit blog selection
+ if ( $blogName != '' )
+ {
+ $blogid = getBlogIDFromName($blogName);
+ }
+
+ // use current blog
+ if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+ {
+ $blogid = $blog->getID();
+ }
+
+ return $member->isBlogAdmin($blogid);
+ }
+
+ /**
+ * CommentActions::ifHasPlugin()
+ * hasplugin,PlugName
+ * -> checks if plugin exists
+ * hasplugin,PlugName,OptionName
+ * -> checks if the option OptionName from plugin PlugName is not set to 'no'
+ * hasplugin,PlugName,OptionName=value
+ * -> checks if the option OptionName from plugin PlugName is set to value
+ *
+ * @param string $name name of plugin
+ * @param string $value key (and value) of plugin option
+ * @return boolean correct or not
+ */
+ private function ifHasPlugin($name, $value)
+ {
+ global $manager;
+ $condition = FALSE;
+
+ // (pluginInstalled method won't write a message in the actionlog on failure)
+ if ( $manager->pluginInstalled('NP_'.$name) )
+ {
+ $plugin =& $manager->getPlugin("NP_{$name}");
+ if ( $plugin != NULL )
+ {
+ if ( $value == "" )
+ {
+ $condition = true;
+ }
+ else
+ {
+ list($name2, $value2) = preg_split('#=#', $value, 2);
+ if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
+ {
+ $condition = true;
+ }
+ else if ( $plugin->getOption($name2) == $value2 )
+ {
+ $condition = true;
+ }
+ }
+ }
+ }
+ return $condition;
+ }
+
+ /**
+ * CommentActions::ifPlugin()
+ * Checks if a plugin exists and call its doIf function
+ *
+ * @param string $name name of plugin
+ * @param string $key key of plugin option
+ * @param string $value value of plugin option
+ * @return boolean callback output from plugin
+ */
+ private function ifPlugin($name, $key = '', $value = '')
+ {
+ global $manager;
+
+ $plugin =& $manager->getPlugin("NP_{$name}");
+ if ( !$plugin )
+ {
+ return;
+ }
+
+ $params = func_get_args();
+ array_shift($params);
+
+ return call_user_func_array(array(&$plugin, 'doIf'), $params);
+ }
+}
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class representing the comments (all of them) for a certain post on a ceratin blog\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: COMMENTS.php 1527 2011-06-21 10:43:44Z sakamocchi $\r
- */\r
-\r
-if ( !function_exists('requestVar') ) exit;\r
-require_once dirname(__FILE__) . '/COMMENTACTIONS.php';\r
-\r
-class Comments\r
-{\r
-\r
- // item for which comment are being displayed\r
- var $itemid;\r
-\r
- // reference to the itemActions object that is calling the showComments function\r
- var $itemActions;\r
-\r
- // total amount of comments displayed\r
- var $commentcount;\r
-\r
- /**\r
- * Creates a new Comments object for the given blog and item\r
- *\r
- * @param $itemid\r
- * id of the item\r
- */\r
- function COMMENTS($itemid) {\r
- $this->itemid = intval($itemid);\r
- }\r
- \r
- /**\r
- * Used when parsing comments\r
- *\r
- * @param $itemActions\r
- * itemActions object, that will take care of the parsing\r
- */\r
- function setItemActions(&$itemActions) {\r
- $this->itemActions =& $itemActions;\r
- }\r
-\r
- /**\r
- * Shows maximum $max comments to the given item using the given template\r
- * returns the amount of shown comments (if maxToShow = -1, then there is no limit)\r
- *\r
- * @param template\r
- * template to use\r
- * @param maxToShow\r
- * max. comments to show\r
- * @param showNone\r
- * indicates if the 'no comments' thingie should be outputted when there are no comments\r
- * (useful for closed items)\r
- * @param highlight\r
- * Highlight to use (if any)\r
- */\r
- function showComments($template, $maxToShow = -1, $showNone = 1, $highlight = '') {\r
- global $CONF, $manager;\r
-\r
- // create parser object & action handler\r
- $handler = new CommentActions($this);\r
- $handler->setTemplate($template);\r
- \r
- $parser = new Parser($handler);\r
- \r
- if ($maxToShow == 0) {\r
- $this->commentcount = $this->amountComments();\r
- } else {\r
- $query = 'SELECT c.citem as itemid, c.cnumber as commentid, c.cbody as body, c.cuser as user, c.cmail as userid, c.cemail as email, c.cmember as memberid, c.ctime, c.chost as host, c.cip as ip, c.cblog as blogid'\r
- . ' FROM '.sql_table('comment').' as c'\r
- . ' WHERE c.citem=' . $this->itemid\r
- . ' ORDER BY c.ctime';\r
-\r
- $comments = DB::getResult($query);\r
- $this->commentcount = $comments->rowCount();\r
- }\r
-\r
- // if no result was found\r
- if ($this->commentcount == 0) {\r
- // note: when no reactions, COMMENTS_HEADER and COMMENTS_FOOTER are _NOT_ used\r
- if ($showNone) $parser->parse($template['COMMENTS_NONE']);\r
- return 0;\r
- }\r
-\r
- // if too many comments to show\r
- if (($maxToShow != -1) && ($this->commentcount > $maxToShow)) {\r
- $parser->parse($template['COMMENTS_TOOMUCH']);\r
- return 0;\r
- }\r
-\r
- $parser->parse($template['COMMENTS_HEADER']);\r
-\r
- foreach ( $comments as $comment ) {\r
- $comment['timestamp'] = strtotime($comment['ctime']);\r
- $handler->setCurrentComment($comment);\r
- $handler->setHighlight($highlight);\r
- $manager->notify('PreComment', array('comment' => &$comment));\r
- $parser->parse($template['COMMENTS_BODY']);\r
- $manager->notify('PostComment', array('comment' => &$comment));\r
- }\r
-\r
- $parser->parse($template['COMMENTS_FOOTER']);\r
-\r
- $comments->closeCursor();\r
-\r
- return $this->commentcount;\r
- }\r
-\r
- /**\r
- * Returns the amount of comments for this itemid\r
- */\r
- function amountComments() {\r
- $query = 'SELECT COUNT(*)'\r
- . ' FROM '.sql_table('comment').' as c'\r
- . ' WHERE c.citem='. $this->itemid;\r
- $res = DB::getValue($query);\r
-\r
- return $res;\r
- }\r
-\r
- /**\r
- * Comments::addComment()\r
- * Adds a new comment to the database\r
- * \r
- * @param string $timestamp\r
- * @param array $comment\r
- * @return mixed\r
- */\r
- function addComment($timestamp, $comment)\r
- {\r
- global $CONF, $member, $manager;\r
- \r
- $item =& $manager->getItem($this->itemid, 0, 0);\r
- $settings =& $manager->getBlog($item['blogid']);\r
- $settings->readSettings();\r
- \r
- // begin if: comments disabled\r
- if ( !$settings->commentsEnabled() )\r
- {\r
- return _ERROR_COMMENTS_DISABLED;\r
- }\r
- \r
- // begin if: public cannot comment\r
- if ( !$settings->isPublic() && !$member->isLoggedIn() )\r
- {\r
- return _ERROR_COMMENTS_NONPUBLIC;\r
- }\r
- \r
- // begin if: comment uses a protected member name\r
- if ( $CONF['ProtectMemNames'] && !$member->isLoggedIn() && Member::isNameProtected($comment['user']) )\r
- {\r
- return _ERROR_COMMENTS_MEMBERNICK;\r
- }\r
- \r
- // begin if: email required, but missing (doesn't apply to members)\r
- if ( $settings->emailRequired() && i18n::strlen($comment['email']) == 0 && !$member->isLoggedIn() )\r
- {\r
- return _ERROR_EMAIL_REQUIRED;\r
- }\r
- \r
- // begin if: commenter's name is too long\r
- if ( i18n::strlen($comment['user']) > 40 )\r
- {\r
- return _ERROR_USER_TOO_LONG;\r
- }\r
- \r
- // begin if: commenter's email is too long\r
- if ( i18n::strlen($comment['email']) > 100 )\r
- {\r
- return _ERROR_EMAIL_TOO_LONG;\r
- }\r
- \r
- // begin if: commenter's url is too long\r
- if ( i18n::strlen($comment['userid']) > 100 )\r
- {\r
- return _ERROR_URL_TOO_LONG;\r
- }\r
- \r
- $comment['timestamp'] = $timestamp;\r
- $comment['host'] = gethostbyaddr(serverVar('REMOTE_ADDR') );\r
- $comment['ip'] = serverVar('REMOTE_ADDR');\r
- \r
- // begin if: member is logged in, use that data\r
- if ( $member->isLoggedIn() )\r
- {\r
- $comment['memberid'] = $member->getID();\r
- $comment['user'] = '';\r
- $comment['userid'] = '';\r
- $comment['email'] = '';\r
- }\r
- else\r
- {\r
- $comment['memberid'] = 0;\r
- }\r
- \r
- // spam check\r
- $continue = FALSE;\r
- $plugins = array();\r
- \r
- if ( isset($manager->subscriptions['ValidateForm']) )\r
- {\r
- $plugins = array_merge($plugins, $manager->subscriptions['ValidateForm']);\r
- }\r
- \r
- if ( isset($manager->subscriptions['PreAddComment']) )\r
- {\r
- $plugins = array_merge($plugins, $manager->subscriptions['PreAddComment']);\r
- }\r
- \r
- if ( isset($manager->subscriptions['PostAddComment']) )\r
- {\r
- $plugins = array_merge($plugins, $manager->subscriptions['PostAddComment']);\r
- }\r
- \r
- $plugins = array_unique($plugins);\r
- \r
- while ( list(, $plugin) = each($plugins) )\r
- {\r
- $p = $manager->getPlugin($plugin);\r
- $continue = $continue || $p->supportsFeature('handleSpam');\r
- }\r
- \r
- $spamcheck = array(\r
- 'type' => 'comment',\r
- 'body' => $comment['body'],\r
- 'id' => $comment['itemid'],\r
- 'live' => TRUE,\r
- 'return' => $continue\r
- );\r
- \r
- // begin if: member logged in\r
- if ( $member->isLoggedIn() )\r
- {\r
- $spamcheck['author'] = $member->displayname;\r
- $spamcheck['email'] = $member->email;\r
- }\r
- // else: public\r
- else\r
- {\r
- $spamcheck['author'] = $comment['user'];\r
- $spamcheck['email'] = $comment['email'];\r
- $spamcheck['url'] = $comment['userid'];\r
- }\r
- \r
- $manager->notify('SpamCheck', array('spamcheck' => &$spamcheck) );\r
- \r
- if ( !$continue && isset($spamcheck['result']) && $spamcheck['result'] == TRUE )\r
- {\r
- return _ERROR_COMMENTS_SPAM;\r
- }\r
- \r
- // isValidComment returns either "1" or an error message\r
- $isvalid = $this->isValidComment($comment, $spamcheck);\r
- \r
- if ( $isvalid != 1 )\r
- {\r
- return $isvalid;\r
- }\r
- \r
- // begin if: send email to notification address\r
- if ( $settings->getNotifyAddress() && $settings->notifyOnComment() )\r
- {\r
- \r
- $message = _NOTIFY_NC_MSG . ' ' . $this->itemid . "\n";\r
- $temp = parse_url($CONF['Self']);\r
- \r
- if ( $temp['scheme'] )\r
- {\r
- $message .= Link::create_item_link($this->itemid) . "\n\n";\r
- }\r
- else\r
- {\r
- $tempurl = $settings->getURL();\r
- \r
- if ( i18n::substr($tempurl, -1) == '/' || i18n::substr($tempurl, -4) == '.php' )\r
- {\r
- $message .= $tempurl . '?itemid=' . $this->itemid . "\n\n";\r
- }\r
- else\r
- {\r
- $message .= $tempurl . '/?itemid=' . $this->itemid . "\n\n";\r
- }\r
- }\r
- \r
- if ( $comment['memberid'] == 0 )\r
- {\r
- $message .= _NOTIFY_USER . ' ' . $comment['user'] . "\n";\r
- $message .= _NOTIFY_USERID . ' ' . $comment['userid'] . "\n";\r
- }\r
- else\r
- {\r
- $message .= _NOTIFY_MEMBER .' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";\r
- }\r
- \r
- $message .= _NOTIFY_HOST . ' ' . $comment['host'] . "\n";\r
- $message .= _NOTIFY_COMMENT . "\n " . $comment['body'] . "\n";\r
- $message .= NOTIFICATION::get_mail_footer();\r
- \r
- $subject = _NOTIFY_NC_TITLE . ' ' . strip_tags($item['title']) . ' (' . $this->itemid . ')';\r
- \r
- $from = $member->getNotifyFromMailAddress($comment['email']);\r
- \r
- NOTIFICATION::mail($settings->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());\r
- }\r
- \r
- $comment = Comment::prepare($comment);\r
- \r
- $manager->notify('PreAddComment', array('comment' => &$comment, 'spamcheck' => &$spamcheck) );\r
- \r
- $name = DB::quoteValue($comment['user']);\r
- $url = DB::quoteValue($comment['userid']);\r
- $email = DB::quoteValue($comment['email']);\r
- $body = DB::quoteValue($comment['body']);\r
- $host = DB::quoteValue($comment['host']);\r
- $ip = DB::quoteValue($comment['ip']);\r
- $memberid = (integer) $comment['memberid'];\r
- $timestamp = DB::formatDateTime($comment['timestamp']);\r
- $itemid = $this->itemid;\r
- \r
- $qSql = 'SELECT COUNT(*) AS result '\r
- . 'FROM ' . sql_table('comment')\r
- . ' WHERE '\r
- . 'cmail = ' . $url\r
- . ' AND cmember = ' . $memberid\r
- . ' AND cbody = ' . $body\r
- . ' AND citem = ' . $itemid\r
- . ' AND cblog = ' . $item['blogid'];\r
- $result = (integer) DB::getValue($qSql);\r
- \r
- if ( $result > 0 )\r
- {\r
- return _ERROR_BADACTION;\r
- }\r
- \r
- $query = sprintf('INSERT INTO %s (cuser, cmail, cemail, cmember, cbody, citem, ctime, chost, cip, cblog) '\r
- . 'VALUES (%s, %s, %s, %d, %s, %d, %s, %s, %s, %d)'\r
- , sql_table('comment'), $name, $url, $email, $memberid, $body, $itemid, $timestamp, $host, $ip, $item['blogid']);\r
- \r
- DB::execute($query);\r
- \r
- // post add comment\r
- $commentid = DB::getInsertId();\r
- $manager->notify('PostAddComment', array('comment' => &$comment, 'commentid' => &$commentid, 'spamcheck' => &$spamcheck) );\r
- \r
- // succeeded !\r
- return TRUE;\r
- }\r
-\r
-\r
- /**\r
- * Comments::isValidComment()\r
- * Checks if a comment is valid and call plugins\r
- * that can check if the comment is a spam comment \r
- * \r
- * @param Array $comment array with comment elements\r
- * @param Array $spamcheck array with spamcheck elements\r
- */\r
- function isValidComment(&$comment, &$spamcheck)\r
- {\r
- global $member, $manager;\r
- \r
- // check if there exists a item for this date\r
- $item =& $manager->getItem($this->itemid, 0, 0);\r
- \r
- if ( !$item )\r
- {\r
- return _ERROR_NOSUCHITEM;\r
- }\r
- \r
- if ( $item['closed'] )\r
- {\r
- return _ERROR_ITEMCLOSED;\r
- }\r
- \r
- // don't allow words that are too long\r
- if ( preg_match('/[a-zA-Z0-9|\.,;:!\?=\/\\\\]{90,90}/', $comment['body']) != 0 )\r
- {\r
- return _ERROR_COMMENT_LONGWORD;\r
- }\r
- \r
- // check lengths of comment\r
- if ( i18n::strlen($comment['body']) < 3 )\r
- {\r
- return _ERROR_COMMENT_NOCOMMENT;\r
- }\r
- \r
- if ( i18n::strlen($comment['body']) > 5000 )\r
- {\r
- return _ERROR_COMMENT_TOOLONG;\r
- }\r
- \r
- // only check username if no member logged in\r
- if ( !$member->isLoggedIn() && (i18n::strlen($comment['user']) < 2) )\r
- {\r
- return _ERROR_COMMENT_NOUSERNAME;\r
- }\r
- \r
- if ( (i18n::strlen($comment['email']) != 0) && !NOTIFICATION::address_validation(trim($comment['email'])) )\r
- {\r
- return _ERROR_BADMAILADDRESS;\r
- }\r
- \r
- // let plugins do verification (any plugin which thinks the comment is invalid\r
- // can change 'error' to something other than '1')\r
- $result = 1;\r
- $manager->notify('ValidateForm', array('type' => 'comment', 'comment' => &$comment, 'error' => &$result, 'spamcheck' => &$spamcheck) );\r
- \r
- return $result;\r
- }\r
-}\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class representing the comments (all of them) for a certain post on a ceratin blog
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: COMMENTS.php 1527 2011-06-21 10:43:44Z sakamocchi $
+ */
+
+if ( !function_exists('requestVar') ) exit;
+require_once dirname(__FILE__) . '/COMMENTACTIONS.php';
+
+class Comments
+{
+ // reference to the itemActions object that is calling the showComments function
+ public $itemActions;
+
+ // item for which comment are being displayed
+ public $itemid;
+
+ // total amount of comments displayed
+ public $commentcount;
+
+ /**
+ * Comments::__construct()
+ * Creates a new Comments object for the given blog and item
+ *
+ * @param integer $itemid id of the item
+ * @return void
+ */
+ public function __construct($itemid)
+ {
+ $this->itemid = (integer) $itemid;
+ return;
+ }
+
+ /**
+ * Comments::setItemActions()
+ * Used when parsing comments
+ *
+ * @param object $itemActions itemActions object, that will take care of the parsing
+ * @return void
+ */
+ public function setItemActions(&$itemActions)
+ {
+ $this->itemActions =& $itemActions;
+ return;
+ }
+
+ /**
+ * Comments::showComments()
+ * Shows maximum $max comments to the given item using the given template
+ * returns the amount of shown comments (if maxToShow = -1, then there is no limit)
+ *
+ * @param array template template to use
+ * @param integer maxToShow max. comments to show
+ * @param integer showNone indicates if the 'no comments' thingie should be outputted
+ * when there are no comments (useful for closed items)
+ * @param string highlight Highlight to use (if any)
+ * @return integer number of comments
+ */
+ public function showComments($template, $maxToShow = -1, $showNone = 1, $highlight = '')
+ {
+ global $CONF, $manager;
+
+ if ( $maxToShow == 0 )
+ {
+ $this->commentcount = $this->amountComments();
+ }
+ else
+ {
+ $query = 'SELECT citem as itemid, cnumber as commentid, cbody as body, cuser as user, cmail as userid, '
+ . 'cemail as email, cmember as memberid, ctime, chost as host, cip as ip, cblog as blogid '
+ . 'FROM %s as c WHERE citem=%d ORDER BY ctime';
+
+ $query = sprintf($query, sql_table('comment'), (integer) $this->itemid);
+ $comments = DB::getResult($query);
+ $this->commentcount = $comments->rowCount();
+ }
+
+ // create parser object & action handler
+ $handler = new CommentActions($this);
+ $handler->setTemplate($template);
+
+ $parser = new Parser($handler);
+
+ // if no result was found
+ if ( $this->commentcount == 0 )
+ {
+ // note: when no reactions, COMMENTS_HEADER and COMMENTS_FOOTER are _NOT_ used
+ if ( $showNone )
+ {
+ $parser->parse($template['COMMENTS_NONE']);
+ }
+ return 0;
+ }
+
+ // if too many comments to show
+ if ( ($maxToShow != -1) && ($this->commentcount > $maxToShow) )
+ {
+ $parser->parse($template['COMMENTS_TOOMUCH']);
+ return 0;
+ }
+
+ $parser->parse($template['COMMENTS_HEADER']);
+
+ foreach ( $comments as $comment )
+ {
+ $comment['timestamp'] = strtotime($comment['ctime']);
+ $handler->setCurrentComment($comment);
+ $handler->setHighlight($highlight);
+
+ $manager->notify('PreComment', array('comment' => &$comment));
+ $parser->parse($template['COMMENTS_BODY']);
+ $manager->notify('PostComment', array('comment' => &$comment));
+ }
+
+ $parser->parse($template['COMMENTS_FOOTER']);
+
+ $comments->closeCursor();
+
+ return $this->commentcount;
+ }
+
+ /**
+ * Comments::amountComments()
+ * Returns the amount of comments for this itemid
+ *
+ * @param void
+ * @return integer number of comments
+ */
+ public function amountComments()
+ {
+ $query = 'SELECT COUNT(*) FROM %s WHERE citem=%d;';
+ $query = sprintf($query, sql_table('comment'), (integer) $this->itemid);
+ $res = DB::getValue($query);
+
+ return $res;
+ }
+
+ /**
+ * Comments::addComment()
+ * Adds a new comment to the database
+ *
+ * @param string $timestamp
+ * @param array $comment
+ * @return mixed
+ */
+ public function addComment($timestamp, $comment)
+ {
+ global $CONF, $member, $manager;
+
+ $blogid = getBlogIDFromItemID($this->itemid);
+
+ $settings =& $manager->getBlog($blogid);
+ $settings->readSettings();
+
+ // begin if: comments disabled
+ if ( !$settings->commentsEnabled() )
+ {
+ return _ERROR_COMMENTS_DISABLED;
+ }
+
+ // begin if: public cannot comment
+ if ( !$settings->isPublic() && !$member->isLoggedIn() )
+ {
+ return _ERROR_COMMENTS_NONPUBLIC;
+ }
+
+ // begin if: comment uses a protected member name
+ if ( $CONF['ProtectMemNames'] && !$member->isLoggedIn() && Member::isNameProtected($comment['user']) )
+ {
+ return _ERROR_COMMENTS_MEMBERNICK;
+ }
+
+ // begin if: email required, but missing (doesn't apply to members)
+ if ( $settings->emailRequired() && i18n::strlen($comment['email']) == 0 && !$member->isLoggedIn() )
+ {
+ return _ERROR_EMAIL_REQUIRED;
+ }
+
+ // begin if: commenter's name is too long
+ if ( i18n::strlen($comment['user']) > 40 )
+ {
+ return _ERROR_USER_TOO_LONG;
+ }
+
+ // begin if: commenter's email is too long
+ if ( i18n::strlen($comment['email']) > 100 )
+ {
+ return _ERROR_EMAIL_TOO_LONG;
+ }
+
+ // begin if: commenter's url is too long
+ if ( i18n::strlen($comment['userid']) > 100 )
+ {
+ return _ERROR_URL_TOO_LONG;
+ }
+
+ $comment['timestamp'] = $timestamp;
+ $comment['host'] = gethostbyaddr(serverVar('REMOTE_ADDR') );
+ $comment['ip'] = serverVar('REMOTE_ADDR');
+
+ // begin if: member is logged in, use that data
+ if ( $member->isLoggedIn() )
+ {
+ $comment['memberid'] = $member->getID();
+ $comment['user'] = '';
+ $comment['userid'] = '';
+ $comment['email'] = '';
+ }
+ else
+ {
+ $comment['memberid'] = 0;
+ }
+
+ // spam check
+ $continue = FALSE;
+ $plugins = array();
+
+ if ( isset($manager->subscriptions['ValidateForm']) )
+ {
+ $plugins = array_merge($plugins, $manager->subscriptions['ValidateForm']);
+ }
+
+ if ( isset($manager->subscriptions['PreAddComment']) )
+ {
+ $plugins = array_merge($plugins, $manager->subscriptions['PreAddComment']);
+ }
+
+ if ( isset($manager->subscriptions['PostAddComment']) )
+ {
+ $plugins = array_merge($plugins, $manager->subscriptions['PostAddComment']);
+ }
+
+ $plugins = array_unique($plugins);
+
+ while ( list(, $plugin) = each($plugins) )
+ {
+ $p = $manager->getPlugin($plugin);
+ $continue = $continue || $p->supportsFeature('handleSpam');
+ }
+
+ $spamcheck = array(
+ 'type' => 'comment',
+ 'body' => $comment['body'],
+ 'id' => $comment['itemid'],
+ 'live' => TRUE,
+ 'return' => $continue
+ );
+
+ // begin if: member logged in
+ if ( $member->isLoggedIn() )
+ {
+ $spamcheck['author'] = $member->displayname;
+ $spamcheck['email'] = $member->email;
+ }
+ // else: public
+ else
+ {
+ $spamcheck['author'] = $comment['user'];
+ $spamcheck['email'] = $comment['email'];
+ $spamcheck['url'] = $comment['userid'];
+ }
+
+ $manager->notify('SpamCheck', array('spamcheck' => &$spamcheck) );
+
+ if ( !$continue && isset($spamcheck['result']) && $spamcheck['result'] == TRUE )
+ {
+ return _ERROR_COMMENTS_SPAM;
+ }
+
+ // isValidComment returns either "1" or an error message
+ $isvalid = $this->isValidComment($comment, $spamcheck);
+ if ( $isvalid != 1 )
+ {
+ return $isvalid;
+ }
+
+ // begin if: send email to notification address
+ if ( $settings->getNotifyAddress() && $settings->notifyOnComment() )
+ {
+
+ $message = _NOTIFY_NC_MSG . ' ' . $this->itemid . "\n";
+ $temp = parse_url($CONF['Self']);
+
+ if ( $temp['scheme'] )
+ {
+ $message .= Link::create_item_link($this->itemid) . "\n\n";
+ }
+ else
+ {
+ $tempurl = $settings->getURL();
+
+ if ( i18n::substr($tempurl, -1) == '/' || i18n::substr($tempurl, -4) == '.php' )
+ {
+ $message .= $tempurl . '?itemid=' . $this->itemid . "\n\n";
+ }
+ else
+ {
+ $message .= $tempurl . '/?itemid=' . $this->itemid . "\n\n";
+ }
+ }
+
+ if ( $comment['memberid'] == 0 )
+ {
+ $message .= _NOTIFY_USER . ' ' . $comment['user'] . "\n";
+ $message .= _NOTIFY_USERID . ' ' . $comment['userid'] . "\n";
+ }
+ else
+ {
+ $message .= _NOTIFY_MEMBER .' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";
+ }
+
+ $message .= _NOTIFY_HOST . ' ' . $comment['host'] . "\n";
+ $message .= _NOTIFY_COMMENT . "\n " . $comment['body'] . "\n";
+ $message .= NOTIFICATION::get_mail_footer();
+
+ $item =& $manager->getItem($this->itemid, 0, 0);
+ $subject = _NOTIFY_NC_TITLE . ' ' . strip_tags($item['title']) . ' (' . $this->itemid . ')';
+
+ $from = $member->getNotifyFromMailAddress($comment['email']);
+
+ NOTIFICATION::mail($settings->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());
+ }
+
+ $comment = Comment::prepare($comment);
+
+ $manager->notify('PreAddComment', array('comment' => &$comment, 'spamcheck' => &$spamcheck) );
+
+ $name = DB::quoteValue($comment['user']);
+ $url = DB::quoteValue($comment['userid']);
+ $email = DB::quoteValue($comment['email']);
+ $body = DB::quoteValue($comment['body']);
+ $host = DB::quoteValue($comment['host']);
+ $ip = DB::quoteValue($comment['ip']);
+ $memberid = intval($comment['memberid']);
+ $timestamp = DB::formatDateTime($comment['timestamp']);
+ $itemid = $this->itemid;
+
+ $qSql = 'SELECT COUNT(*) AS result '
+ . 'FROM ' . sql_table('comment')
+ . ' WHERE '
+ . 'cmail = ' . $url
+ . ' AND cmember = ' . $memberid
+ . ' AND cbody = ' . $body
+ . ' AND citem = ' . $itemid
+ . ' AND cblog = ' . $blogid;
+ $result = (integer) DB::getValue($qSql);
+
+ if ( $result > 0 )
+ {
+ return _ERROR_BADACTION;
+ }
+
+ $query = sprintf('INSERT INTO %s (cuser, cmail, cemail, cmember, cbody, citem, ctime, chost, cip, cblog) '
+ . 'VALUES (%s, %s, %s, %d, %s, %d, %s, %s, %s, %d)'
+ , sql_table('comment'), $name, $url, $email, $memberid, $body, $itemid, $timestamp, $host, $ip, $blogid);
+
+ DB::execute($query);
+
+ // post add comment
+ $commentid = DB::getInsertId();
+ $manager->notify('PostAddComment', array('comment' => &$comment, 'commentid' => &$commentid, 'spamcheck' => &$spamcheck) );
+
+ // succeeded !
+ return TRUE;
+ }
+
+ /**
+ * Comments::isValidComment()
+ * Checks if a comment is valid and call plugins
+ * that can check if the comment is a spam comment
+ *
+ * @param array $comment array with comment elements
+ * @param array $spamcheck array with spamcheck elements
+ * @return boolean valid or not
+ */
+ private function isValidComment(&$comment, &$spamcheck)
+ {
+ global $member, $manager;
+
+ // check if there exists a item for this date
+ $item =& $manager->getItem($this->itemid, 0, 0);
+
+ if ( !$item )
+ {
+ return _ERROR_NOSUCHITEM;
+ }
+
+ if ( $item['closed'] )
+ {
+ return _ERROR_ITEMCLOSED;
+ }
+
+ // don't allow words that are too long
+ if ( preg_match('/[a-zA-Z0-9|\.,;:!\?=\/\\\\]{90,90}/', $comment['body']) != 0 )
+ {
+ return _ERROR_COMMENT_LONGWORD;
+ }
+
+ // check lengths of comment
+ if ( i18n::strlen($comment['body']) < 3 )
+ {
+ return _ERROR_COMMENT_NOCOMMENT;
+ }
+
+ if ( i18n::strlen($comment['body']) > 5000 )
+ {
+ return _ERROR_COMMENT_TOOLONG;
+ }
+
+ // only check username if no member logged in
+ if ( !$member->isLoggedIn() && (i18n::strlen($comment['user']) < 2) )
+ {
+ return _ERROR_COMMENT_NOUSERNAME;
+ }
+
+ if ( (i18n::strlen($comment['email']) != 0) && !NOTIFICATION::address_validation(trim($comment['email'])) )
+ {
+ return _ERROR_BADMAILADDRESS;
+ }
+
+ // let plugins do verification (any plugin which thinks the comment is invalid
+ // can change 'error' to something other than '1')
+ $result = 1;
+ $manager->notify('ValidateForm', array('type' => 'comment', 'comment' => &$comment, 'error' => &$result, 'spamcheck' => &$spamcheck) );
+
+ return $result;
+ }
+}
-<?php\r
-\r
-class Entity\r
-{\r
- /**\r
- * Entity::hen\r
- * htmlentities wrapper\r
- * \r
- * @static\r
- * @access public\r
- * @param string $string target string\r
- * @param string $quotation quotation mode. please refer to the argument of PHP built-in htmlentities\r
- * @return string escaped string\r
- */\r
- static public function hen($string, $quotation=ENT_QUOTES)\r
- {\r
- /*\r
- * we can use 'double_encode' flag instead of this when dropping supports for PHP 5.2.2 or lower\r
- */\r
- $string = html_entity_decode($string, $quotation, i18n::get_current_charset());\r
- return (string) htmlentities($string, $quotation, i18n::get_current_charset());\r
- }\r
- \r
- /**\r
- * Entity::hsc\r
- * htmlspecialchars wrapper\r
- * \r
- * NOTE: htmlspecialchars_decode() is ASCII-to-ACII conversion\r
- * and its target string consists of several letters.\r
- * There are no problems.\r
- * \r
- * @static\r
- * @access public\r
- * @param string $string target string\r
- * @param string $quotation quotation mode. please refer to the argument of PHP built-in htmlspecialchars\r
- * @return string escaped string\r
- * \r
- */\r
- static public function hsc($string, $quotation=ENT_QUOTES)\r
- {\r
- /*\r
- * we can use 'double_encode' flag instead of this when dropping supports for PHP 5.2.2 or lower\r
- */\r
- $string = htmlspecialchars_decode($string, $quotation);\r
- return (string) htmlspecialchars($string, $quotation, i18n::get_current_charset());\r
- }\r
- \r
- /**\r
- * Entity::strip_tags()\r
- * Strip HTML tags from a string\r
- * \r
- * This function is a bit more intelligent than a regular call to strip_tags(),\r
- * because it also deletes the contents of certain tags and cleans up any\r
- * unneeded whitespace.\r
- * \r
- * @static\r
- * @param String $string target string\r
- * @return String string with stripped tags\r
- */\r
- static public function strip_tags($string)\r
- {\r
- $string = preg_replace("#<del[^>]*>.+<\/del[^>]*>#isU", '', $string);\r
- $string = preg_replace("#<script[^>]*>.+<\/script[^>]*>#isU", '', $string);\r
- $string = preg_replace("#<style[^>]*>.+<\/style[^>]*>#isU", '', $string);\r
- $string = preg_replace('#>#', '> ', $string);\r
- $string = preg_replace('#<#', ' <', $string);\r
- $string = strip_tags($string);\r
- $string = preg_replace("#\s+#", " ", $string);\r
- $string = trim($string);\r
- return $string;\r
- }\r
- \r
- /**\r
- * shortens a text string to maxlength.\r
- * $suffix is what needs to be added at the end (end length is <= $maxlength)\r
- *\r
- * The purpose is to limit the width of string for rendered screen in web browser.\r
- * So it depends on style sheet, browser's rendering scheme, client's system font.\r
- *\r
- * NOTE: In general, non-Latin font such as Japanese, Chinese, Cyrillic have two times as width as Latin fonts,\r
- * but this is not always correct, for example, rendered by proportional font.\r
- *\r
- * @static\r
- * @param string $escaped_string target string\r
- * @param integer $maxlength maximum length of return string which includes suffix\r
- * @param string $suffix added in the end of shortened-string\r
- * @return string\r
- */\r
- static public function shorten($string, $maxlength, $suffix)\r
- {\r
- static $flag;\r
- \r
- $decoded_entities_pcre = array();\r
- $encoded_entities = array();\r
- \r
- /* 1. store html entities */\r
- preg_match('#&[^&]+?;#', $string, $encoded_entities);\r
- if ( !$encoded_entities )\r
- {\r
- $flag = FALSE;\r
- }\r
- else\r
- {\r
- $flag = TRUE;\r
- }\r
- if ( $flag )\r
- {\r
- foreach ( $encoded_entities as $encoded_entity )\r
- {\r
- $decoded_entities_pcre[] = '#' . html_entity_decode($encoded_entity, ENT_QUOTES, i18n::get_current_charset()) . '#';\r
- }\r
- }\r
- \r
- /* 2. decode string */\r
- $string = html_entity_decode($string, ENT_QUOTES, i18n::get_current_charset());\r
- \r
- /* 3. shorten string and add suffix if string length is longer */\r
- if ( i18n::strlen($string) > $maxlength - i18n::strlen($suffix) )\r
- {\r
- $string = i18n::substr($string, 0, $maxlength - i18n::strlen($suffix) );\r
- $string .= $suffix;\r
- }\r
- \r
- /* 4. recover entities */\r
- if ( $flag )\r
- {\r
- $string = preg_replace($decoded_entities_pcre, $encoded_entities, $string);\r
- }\r
- \r
- return $string;\r
- }\r
- \r
- /**\r
- * Entity::highlight()\r
- * highlights a specific query in a given HTML text (not within HTML tags)\r
- * \r
- * @static\r
- * @param string $text text to be highlighted\r
- * @param string $expression regular expression to be matched (can be an array of expressions as well)\r
- * @param string $highlight highlight to be used (use \\0 to indicate the matched expression)\r
- * @return string\r
- */\r
- static public function highlight($text, $expression, $highlight)\r
- {\r
- if ( !$highlight || !$expression )\r
- {\r
- return $text;\r
- }\r
- \r
- if ( is_array($expression) && (count($expression) == 0) )\r
- {\r
- return $text;\r
- }\r
- \r
- $text = "<!--h-->{$text}";\r
- preg_match_all('#(<[^>]+>)([^<>]*)#', $text, $matches);\r
- $result = '';\r
- $count = count($matches[2]);\r
- \r
- for ( $i = 0; $i < $count; $i++ )\r
- {\r
- if ( $i != 0 )\r
- {\r
- $result .= $matches[1][$i];\r
- }\r
- \r
- if ( is_array($expression) )\r
- {\r
- foreach ( $expression as $regex )\r
- {\r
- $matches[2][$i] = preg_replace("#{$regex}#i", $highlight, $matches[2][$i]);\r
- }\r
- $result .= $matches[2][$i];\r
- }\r
- else\r
- {\r
- $result .= preg_replace("#{$expression}#i", $highlight, $matches[2][$i]);\r
- }\r
- }\r
- return $result;\r
- }\r
- \r
- /**\r
- * Entity::anchor_footnoting()\r
- * change strings with footnoticing generated from anchor elements\r
- * \r
- * @static\r
- * @param String $string strings which includes html elements\r
- * @return String string with footnotes\r
- */\r
- static public function anchor_footnoting($string)\r
- {\r
- /* 1. detect anchor elements */\r
- $anchors = array();\r
- if ( !preg_match_all("#<a[^>]*href=[\"\']([^\"^']*)[\"\'][^>]*>([^<]*)<\/a>#i", $subject, $anchors) )\r
- {\r
- return $string;\r
- }\r
- \r
- /* 2. add footnotes */\r
- $string .= "\n\n";\r
- $count = 1;\r
- foreach ( $anchors as $anchor )\r
- {\r
- preg_replace("#{$anchor[0]}#", "{$anchor[2]} [{$count}] ", $subject);\r
- $subject .= "[{$count}] {$anchor[1]}\n";\r
- $count++;\r
- }\r
- \r
- return strip_tags($ascii);\r
- }\r
- \r
- /*\r
- * NOTE: Obsoleted functions\r
- */\r
- \r
- /**\r
- * Entity::named_to_numeric()\r
- * \r
- * @deprecated\r
- * @param String $string\r
- */\r
- function named_to_numeric ($string)\r
- {\r
- $string = preg_replace('/(&[0-9A-Za-z]+)(;?\=?|([^A-Za-z0-9\;\:\.\-\_]))/e', "Entity::_named('\\1', '\\2') . '\\3'", $string);\r
- return $string;\r
- }\r
- \r
- /**\r
- * Entity::named_to_numeric()\r
- * \r
- * @deprecated\r
- * @param String $string\r
- */\r
- function normalize_numeric ($string) {\r
- $string = preg_replace('/&#([0-9]+)(;)?/e', "'&#x'.dechex('\\1').';'", $string);\r
- $string = preg_replace('/&#[Xx](0)*([0-9A-Fa-f]+)(;?|([^A-Za-z0-9\;\:\.\-\_]))/e', "'&#x' . strtoupper('\\2') . ';\\4'", $string);\r
- $string = strtr($string, self::$entities['Windows-1252']);\r
- return $string;\r
- }\r
- \r
- /**\r
- * Entity::numeric_to_utf8()\r
- * \r
- * @deprecated\r
- * @param String $string\r
- */\r
- function numeric_to_utf8 ($string) {\r
- $string = preg_replace('/&#([0-9]+)(;)?/e', "'&#x'.dechex('\\1').';'", $string);\r
- $string = preg_replace('/&#[Xx](0)*([0-9A-Fa-f]+)(;?|([^A-Za-z0-9\;\:\.\-\_]))/e', "'&#x' . strtoupper('\\2') . ';\\4'", $string);\r
- $string = preg_replace('/&#x([0-9A-Fa-f]+);/e', "Entity::_hex_to_utf8('\\1')", $string); \r
- return $string; \r
- }\r
- \r
- /**\r
- * Entity::numeric_to_named()\r
- * convert decimal and hexadecimal numeric character references into named character references\r
- * \r
- * @deprecated\r
- * @param String $string\r
- */\r
- function numeric_to_named ($string)\r
- {\r
- $string = preg_replace('/&#[Xx]([0-9A-Fa-f]+)/e', "'&#'.hexdec('\\1')", $string);\r
- $string = strtr($string, array_flip(self::$entities['named_to_numeric']));\r
- return $string; \r
- }\r
- \r
- /**\r
- * Entity::specialchars()\r
- * convert HTML entities to named character reference\r
- * \r
- * @deprecated\r
- * @param String $string\r
- */\r
- function specialchars ($string, $type = 'xml')\r
- {\r
- $specialchars = array(\r
- '"' => '"',\r
- '&' => '&',\r
- '<' => '<',\r
- '>' => '>'\r
- );\r
- if ( $type != 'xml' )\r
- {\r
- $specialchars["'"] = ''';\r
- }\r
- else\r
- {\r
- $specialchars["'"] = ''';\r
- }\r
- \r
- $string = preg_replace('/&(#?[Xx]?[0-9A-Za-z]+);/', "[[[ENTITY:\\1]]]", $string);\r
- $string = strtr($string, $specialchars);\r
- $string = preg_replace('/\[\[\[ENTITY\:([^\]]+)\]\]\]/', "&\\1;", $string); \r
- return $string;\r
- }\r
- \r
- /**\r
- * Entity::_hex_to_utf8()\r
- * convert decimal numeric character references to hexadecimal numeric character references\r
- * \r
- * @deprecated\r
- * @param String $string\r
- */\r
- function _hex_to_utf8($s)\r
- {\r
- $c = hexdec($s);\r
- \r
- if ( $c < 0x80 )\r
- {\r
- $str = chr($c);\r
- }\r
- else if ( $c < 0x800 )\r
- {\r
- $str = chr(0xC0 | $c>>6) . chr(0x80 | $c & 0x3F);\r
- }\r
- else if ( $c < 0x10000 )\r
- {\r
- $str = chr(0xE0 | $c>>12) . chr(0x80 | $c>>6 & 0x3F) . chr(0x80 | $c & 0x3F);\r
- }\r
- else if ( $c < 0x200000 )\r
- {\r
- $str = chr(0xF0 | $c>>18) . chr(0x80 | $c>>12 & 0x3F) . chr(0x80 | $c>>6 & 0x3F) . chr(0x80 | $c & 0x3F);\r
- }\r
- return $str;\r
- }\r
- \r
- /**\r
- * Entity::_named()\r
- * convert entities to named character reference\r
- * \r
- * @deprecated\r
- * @param String $string\r
- * @param String $extra\r
- * @return \r
- */\r
- function _named($entity, $extra)\r
- {\r
- if ( $extra == '=' )\r
- {\r
- return $entity . '=';\r
- }\r
- \r
- $length = i18n::strlen($entity);\r
- \r
- while ( $length > 0 )\r
- {\r
- $check = i18n::substr($entity, 0, $length);\r
- if ( array_key_exists($check, self::$entities['named_to_numeric']) )\r
- {\r
- return self::$entities['named_to_numeric'][$check] . ';' . i18n::substr($entity, $length);\r
- }\r
- $length--;\r
- }\r
- \r
- if ( $extra != ';' )\r
- {\r
- return $entity;\r
- }\r
- else\r
- {\r
- return "{$entity};";\r
- }\r
- }\r
- \r
- /**\r
- * ENTITIY::$entities\r
- * \r
- * HTML 4.01 Specification\r
- * @link http://www.w3.org/TR/html4/sgml/entities.html\r
- * @see 24 Character entity references in HTML 4\r
- * \r
- * XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition)\r
- * A Reformulation of HTML 4 in XML 1.0\r
- * @link http://www.w3.org/TR/xhtml1/\r
- * @see 4.12. Entity references as hex values\r
- * @see C.16. The Named Character Reference '\r
- * \r
- * @static\r
- * @deprecated\r
- */\r
- static private $entities = array (\r
- 'named_to_numeric' => array (\r
- ' ' => ' ',\r
- '¡' => '¡',\r
- '¢' => '¢',\r
- '£' => '£',\r
- '¤' => '¤',\r
- '¥' => '¥',\r
- '¦' => '¦',\r
- '§' => '§',\r
- '¨' => '¨',\r
- '©' => '©',\r
- 'ª' => 'ª',\r
- '«' => '«',\r
- '¬' => '¬',\r
- '­' => '­',\r
- '®' => '®',\r
- '¯' => '¯',\r
- '°' => '°',\r
- '±' => '±',\r
- '²' => '²',\r
- '³' => '³',\r
- '´' => '´',\r
- 'µ' => 'µ',\r
- '¶' => '¶',\r
- '·' => '·',\r
- '¸' => '¸',\r
- '¹' => '¹',\r
- 'º' => 'º',\r
- '»' => '»',\r
- '¼' => '¼',\r
- '½' => '½',\r
- '¾' => '¾',\r
- '¿' => '¿',\r
- 'À' => 'À',\r
- 'Á' => 'Á',\r
- 'Â' => 'Â',\r
- 'Ã' => 'Ã',\r
- 'Ä' => 'Ä',\r
- 'Å' => 'Å',\r
- 'Æ' => 'Æ',\r
- 'Ç' => 'Ç',\r
- 'È' => 'È',\r
- 'É' => 'É',\r
- 'Ê' => 'Ê',\r
- 'Ë' => 'Ë',\r
- 'Ì' => 'Ì',\r
- 'Í' => 'Í',\r
- 'Î' => 'Î',\r
- 'Ï' => 'Ï',\r
- 'Ð' => 'Ð',\r
- 'Ñ' => 'Ñ',\r
- 'Ò' => 'Ò',\r
- 'Ó' => 'Ó',\r
- 'Ô' => 'Ô',\r
- 'Õ' => 'Õ',\r
- 'Ö' => 'Ö',\r
- '×' => '×',\r
- 'Ø' => 'Ø',\r
- 'Ù' => 'Ù',\r
- 'Ú' => 'Ú',\r
- 'Û' => 'Û',\r
- 'Ü' => 'Ü',\r
- 'Ý' => 'Ý',\r
- 'Þ' => 'Þ',\r
- 'ß' => 'ß',\r
- 'à' => 'à',\r
- 'á' => 'á',\r
- 'â' => 'â',\r
- 'ã' => 'ã',\r
- 'ä' => 'ä',\r
- 'å' => 'å',\r
- 'æ' => 'æ',\r
- 'ç' => 'ç',\r
- 'è' => 'è',\r
- 'é' => 'é',\r
- 'ê' => 'ê',\r
- 'ë' => 'ë',\r
- 'ì' => 'ì',\r
- 'í' => 'í',\r
- 'î' => 'î',\r
- 'ï' => 'ï',\r
- 'ð' => 'ð',\r
- 'ñ' => 'ñ',\r
- 'ò' => 'ò',\r
- 'ó' => 'ó',\r
- 'ô' => 'ô',\r
- 'õ' => 'õ',\r
- 'ö' => 'ö',\r
- '÷' => '÷',\r
- 'ø' => 'ø',\r
- 'ù' => 'ù',\r
- 'ú' => 'ú',\r
- 'û' => 'û',\r
- 'ü' => 'ü',\r
- 'ý' => 'ý',\r
- 'þ' => 'þ',\r
- 'ÿ' => 'ÿ',\r
- '&OElig' => 'Œ',\r
- '&oelig' => 'å',\r
- '&Scaron' => 'Š',\r
- '&scaron' => 'š',\r
- '&Yuml' => 'Ÿ',\r
- '&circ' => 'ˆ',\r
- '&tilde' => '˜',\r
- '&esnp' => ' ',\r
- '&emsp' => ' ',\r
- '&thinsp' => ' ',\r
- '&zwnj' => '‌',\r
- '&zwj' => '‍',\r
- '&lrm' => '‎',\r
- '&rlm' => '‏',\r
- '&ndash' => '–',\r
- '&mdash' => '—',\r
- '&lsquo' => '‘',\r
- '&rsquo' => '’',\r
- '&sbquo' => '‚',\r
- '&ldquo' => '“',\r
- '&rdquo' => '”',\r
- '&bdquo' => '„',\r
- '&dagger' => '†',\r
- '&Dagger' => '‡',\r
- '&permil' => '‰',\r
- '&lsaquo' => '‹',\r
- '&rsaquo' => '›',\r
- '&euro' => '€',\r
- '&fnof' => 'ƒ',\r
- '&Alpha' => 'Α',\r
- '&Beta' => 'Β',\r
- '&Gamma' => 'Γ',\r
- '&Delta' => 'Δ',\r
- '&Epsilon' => 'Ε',\r
- '&Zeta' => 'Ζ',\r
- '&Eta' => 'Η',\r
- '&Theta' => 'Θ',\r
- '&Iota' => 'Ι',\r
- '&Kappa' => 'Κ',\r
- '&Lambda' => 'Λ',\r
- '&Mu' => 'Μ',\r
- '&Nu' => 'Ν',\r
- '&Xi' => 'Ξ',\r
- '&Omicron' => 'Ο',\r
- '&Pi' => 'Π',\r
- '&Rho' => 'Ρ',\r
- '&Sigma' => 'Σ',\r
- '&Tau' => 'Τ',\r
- '&Upsilon' => 'Υ',\r
- '&Phi' => 'Φ',\r
- '&Chi' => 'Χ',\r
- '&Psi' => 'Ψ',\r
- '&Omega' => 'Ω',\r
- '&alpha' => 'α',\r
- '&beta' => 'β',\r
- '&gamma' => 'γ',\r
- '&delta' => 'δ',\r
- '&epsilon' => 'ε',\r
- '&zeta' => 'ζ',\r
- '&eta' => 'η',\r
- '&theta' => 'θ',\r
- '&iota' => 'ι',\r
- '&kappa' => 'κ',\r
- '&lambda' => 'λ',\r
- '&mu' => 'μ',\r
- '&nu' => 'ν',\r
- '&xi' => 'ξ',\r
- '&omicron' => 'ο',\r
- '&pi' => 'π',\r
- '&rho' => 'ρ',\r
- '&sigmaf' => 'ς',\r
- '&sigma' => 'σ',\r
- '&tau' => 'τ',\r
- '&upsilon' => 'υ',\r
- '&phi' => 'φ',\r
- '&chi' => 'χ',\r
- '&psi' => 'ψ',\r
- '&omega' => 'ω',\r
- '&thetasym' => 'ϑ',\r
- '&upsih' => 'ϒ',\r
- '&piv' => 'ϖ',\r
- '&bull' => '•',\r
- '&hellip' => '…',\r
- '&prime' => '′',\r
- '&Prime' => '″',\r
- '&oline' => '‾',\r
- '&frasl' => '⁄',\r
- '&weierp' => '℘',\r
- '&image' => 'ℑ',\r
- '&real' => 'ℜ',\r
- '&trade' => 'ℒ',\r
- '&alefsym' => 'ℵ',\r
- '&larr' => '←',\r
- '&uarr' => '↑',\r
- '&rarr' => '→',\r
- '&darr' => '↓',\r
- '&harr' => '↔',\r
- '&crarr' => '↵',\r
- '&lArr' => '⇐',\r
- '&uArr' => '⇑',\r
- '&rArr' => '⇒',\r
- '&dArr' => '⇓',\r
- '&hArr' => '⇔',\r
- '&forall' => '∀',\r
- '&part' => '∂',\r
- '&exist' => '∃',\r
- '&empty' => '∅',\r
- '&nabla' => '∇',\r
- '&isin' => '∈',\r
- '¬in' => '∉',\r
- '&ni' => '∋',\r
- '&prod' => '∏',\r
- '&sum' => '∑',\r
- '&minus' => '−',\r
- '&lowast' => '∗',\r
- '&radic' => '√',\r
- '&prop' => '∝',\r
- '&infin' => '∞',\r
- '&ang' => '∠',\r
- '&and' => '∧',\r
- '&or' => '∨',\r
- '&cap' => '∩',\r
- '&cup' => '∪',\r
- '&int' => '∫',\r
- '&there4' => '∴',\r
- '&sim' => '∼',\r
- '&cong' => '≅',\r
- '&asymp' => '≈',\r
- '&ne' => '≠',\r
- '&equiv' => '≡',\r
- '&le' => '≤',\r
- '&ge' => '≥',\r
- '&sub' => '⊂',\r
- '&sup' => '⊃',\r
- '&nsub' => '⊄',\r
- '&sube' => '⊆',\r
- '&supe' => '⊇',\r
- '&oplus' => '⊕',\r
- '&otimes' => '⊖',\r
- '&perp' => '⊥',\r
- '&sdot' => '⋅',\r
- '&lceil' => '⍨',\r
- '&rceil' => '⌉',\r
- '&lfloor' => '⌊',\r
- '&rfloor' => '⌋',\r
- '&lang' => '〈',\r
- '&rang' => '⌰',\r
- '&loz' => '◊',\r
- '&spades' => '♠',\r
- '&clubs' => '♣',\r
- '&hearts' => '♥',\r
- '&diams' => '♦'\r
- ),\r
- 'Windows-1252' => array(\r
- '€' => '€',\r
- '‚' => '‚',\r
- 'ƒ' => 'ƒ',\r
- '„' => '„',\r
- '…' => '…',\r
- '†' => '†',\r
- '‡' => '‡',\r
- 'ˆ' => 'ˆ',\r
- '‰' => '‰',\r
- 'Š' => 'Š',\r
- '‹' => '‹',\r
- 'Œ' => 'Œ',\r
- 'Ž' => 'Ž',\r
- '‘' => '‘',\r
- '’' => '’',\r
- '“' => '“',\r
- '”' => '”',\r
- '•' => '•',\r
- '–' => '–',\r
- '—' => '—',\r
- '˜' => '˜',\r
- '™' => '™',\r
- 'š' => 'š',\r
- '›' => '›',\r
- 'œ' => 'œ',\r
- 'ž' => 'ž',\r
- 'Ÿ' => 'Ÿ',\r
- )\r
- );\r
-}\r
+<?php
+
+class Entity
+{
+ /**
+ * Entity::hen
+ * htmlentities wrapper
+ *
+ * @static
+ * @access public
+ * @param string $string target string
+ * @param string $quotation quotation mode. please refer to the argument of PHP built-in htmlentities
+ * @return string escaped string
+ */
+ static public function hen($string, $quotation=ENT_QUOTES)
+ {
+ /*
+ * we can use 'double_encode' flag instead of this when dropping supports for PHP 5.2.2 or lower
+ */
+ $string = html_entity_decode($string, $quotation, i18n::get_current_charset());
+ return (string) htmlentities($string, $quotation, i18n::get_current_charset());
+ }
+
+ /**
+ * Entity::hsc
+ * htmlspecialchars wrapper
+ *
+ * NOTE: htmlspecialchars_decode() is ASCII-to-ACII conversion
+ * and its target string consists of several letters.
+ * There are no problems.
+ *
+ * @static
+ * @access public
+ * @param string $string target string
+ * @param string $quotation quotation mode. please refer to the argument of PHP built-in htmlspecialchars
+ * @return string escaped string
+ *
+ */
+ static public function hsc($string, $quotation=ENT_QUOTES)
+ {
+ /*
+ * we can use 'double_encode' flag instead of this when dropping supports for PHP 5.2.2 or lower
+ */
+ $string = htmlspecialchars_decode($string, $quotation);
+ return (string) htmlspecialchars($string, $quotation, i18n::get_current_charset());
+ }
+
+ /**
+ * Entity::strip_tags()
+ * Strip HTML tags from a string
+ *
+ * This function is a bit more intelligent than a regular call to strip_tags(),
+ * because it also deletes the contents of certain tags and cleans up any
+ * unneeded whitespace.
+ *
+ * @static
+ * @param String $string target string
+ * @return String string with stripped tags
+ */
+ static public function strip_tags($string)
+ {
+ $string = preg_replace("#<del[^>]*>.+<\/del[^>]*>#isU", '', $string);
+ $string = preg_replace("#<script[^>]*>.+<\/script[^>]*>#isU", '', $string);
+ $string = preg_replace("#<style[^>]*>.+<\/style[^>]*>#isU", '', $string);
+ $string = preg_replace('#>#', '> ', $string);
+ $string = preg_replace('#<#', ' <', $string);
+ $string = strip_tags($string);
+ $string = preg_replace("#\s+#", " ", $string);
+ $string = trim($string);
+ return $string;
+ }
+
+ /**
+ * shortens a text string to maxlength.
+ * $suffix is what needs to be added at the end (end length is <= $maxlength)
+ *
+ * The purpose is to limit the width of string for rendered screen in web browser.
+ * So it depends on style sheet, browser's rendering scheme, client's system font.
+ *
+ * NOTE: In general, non-Latin font such as Japanese, Chinese, Cyrillic have two times as width as Latin fonts,
+ * but this is not always correct, for example, rendered by proportional font.
+ *
+ * @static
+ * @param string $escaped_string target string
+ * @param integer $maxlength maximum length of return string which includes suffix
+ * @param string $suffix added in the end of shortened-string
+ * @return string
+ */
+ static public function shorten($string, $maxlength, $suffix)
+ {
+ static $flag;
+
+ $decoded_entities_pcre = array();
+ $encoded_entities = array();
+
+ /* 1. store html entities */
+ preg_match('#&[^&]+?;#', $string, $encoded_entities);
+ if ( !$encoded_entities )
+ {
+ $flag = FALSE;
+ }
+ else
+ {
+ $flag = TRUE;
+ }
+ if ( $flag )
+ {
+ foreach ( $encoded_entities as $encoded_entity )
+ {
+ $decoded_entities_pcre[] = '#' . html_entity_decode($encoded_entity, ENT_QUOTES, i18n::get_current_charset()) . '#';
+ }
+ }
+
+ /* 2. decode string */
+ $string = html_entity_decode($string, ENT_QUOTES, i18n::get_current_charset());
+
+ /* 3. shorten string and add suffix if string length is longer */
+ if ( i18n::strlen($string) > $maxlength - i18n::strlen($suffix) )
+ {
+ $string = i18n::substr($string, 0, $maxlength - i18n::strlen($suffix) );
+ $string .= $suffix;
+ }
+
+ /* 4. recover entities */
+ if ( $flag )
+ {
+ $string = preg_replace($decoded_entities_pcre, $encoded_entities, $string);
+ }
+
+ return $string;
+ }
+
+ /**
+ * Entity::highlight()
+ * highlights a specific query in a given HTML text (not within HTML tags)
+ *
+ * @static
+ * @param string $text text to be highlighted
+ * @param string $expression regular expression to be matched (can be an array of expressions as well)
+ * @param string $highlight highlight to be used (use \\0 to indicate the matched expression)
+ * @return string
+ */
+ static public function highlight($text, $expression, $highlight)
+ {
+ if ( !$highlight || !$expression )
+ {
+ return $text;
+ }
+
+ if ( is_array($expression) && (count($expression) == 0) )
+ {
+ return $text;
+ }
+
+ $text = "<!--h-->{$text}";
+ preg_match_all('#(<[^>]+>)([^<>]*)#', $text, $matches);
+ $result = '';
+ $count = count($matches[2]);
+
+ for ( $i = 0; $i < $count; $i++ )
+ {
+ if ( $i != 0 )
+ {
+ $result .= $matches[1][$i];
+ }
+
+ if ( is_array($expression) )
+ {
+ foreach ( $expression as $regex )
+ {
+ $matches[2][$i] = preg_replace("#{$regex}#i", $highlight, $matches[2][$i]);
+ }
+ $result .= $matches[2][$i];
+ }
+ else
+ {
+ $result .= preg_replace("#{$expression}#i", $highlight, $matches[2][$i]);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Entity::anchor_footnoting()
+ * change strings with footnoticing generated from anchor elements
+ *
+ * @static
+ * @param String $string strings which includes html elements
+ * @return String string with footnotes
+ */
+ static public function anchor_footnoting($string)
+ {
+ /* 1. detect anchor elements */
+ $anchors = array();
+ if ( !preg_match_all("#<a[^>]*href=[\"\']([^\"^']*)[\"\'][^>]*>([^<]*)<\/a>#i", $subject, $anchors) )
+ {
+ return $string;
+ }
+
+ /* 2. add footnotes */
+ $string .= "\n\n";
+ $count = 1;
+ foreach ( $anchors as $anchor )
+ {
+ preg_replace("#{$anchor[0]}#", "{$anchor[2]} [{$count}] ", $subject);
+ $subject .= "[{$count}] {$anchor[1]}\n";
+ $count++;
+ }
+
+ return strip_tags($ascii);
+ }
+
+ /*
+ * NOTE: Obsoleted functions
+ */
+
+ /**
+ * Entity::named_to_numeric()
+ *
+ * @deprecated
+ * @param String $string
+ */
+ function named_to_numeric ($string)
+ {
+ $string = preg_replace('/(&[0-9A-Za-z]+)(;?\=?|([^A-Za-z0-9\;\:\.\-\_]))/e', "Entity::_named('\\1', '\\2') . '\\3'", $string);
+ return $string;
+ }
+
+ /**
+ * Entity::named_to_numeric()
+ *
+ * @deprecated
+ * @param String $string
+ */
+ function normalize_numeric ($string) {
+ $string = preg_replace('/&#([0-9]+)(;)?/e', "'&#x'.dechex('\\1').';'", $string);
+ $string = preg_replace('/&#[Xx](0)*([0-9A-Fa-f]+)(;?|([^A-Za-z0-9\;\:\.\-\_]))/e', "'&#x' . strtoupper('\\2') . ';\\4'", $string);
+ $string = strtr($string, self::$entities['Windows-1252']);
+ return $string;
+ }
+
+ /**
+ * Entity::numeric_to_utf8()
+ *
+ * @deprecated
+ * @param String $string
+ */
+ function numeric_to_utf8 ($string) {
+ $string = preg_replace('/&#([0-9]+)(;)?/e', "'&#x'.dechex('\\1').';'", $string);
+ $string = preg_replace('/&#[Xx](0)*([0-9A-Fa-f]+)(;?|([^A-Za-z0-9\;\:\.\-\_]))/e', "'&#x' . strtoupper('\\2') . ';\\4'", $string);
+ $string = preg_replace('/&#x([0-9A-Fa-f]+);/e', "Entity::_hex_to_utf8('\\1')", $string);
+ return $string;
+ }
+
+ /**
+ * Entity::numeric_to_named()
+ * convert decimal and hexadecimal numeric character references into named character references
+ *
+ * @deprecated
+ * @param String $string
+ */
+ function numeric_to_named ($string)
+ {
+ $string = preg_replace('/&#[Xx]([0-9A-Fa-f]+)/e', "'&#'.hexdec('\\1')", $string);
+ $string = strtr($string, array_flip(self::$entities['named_to_numeric']));
+ return $string;
+ }
+
+ /**
+ * Entity::specialchars()
+ * convert HTML entities to named character reference
+ *
+ * @deprecated
+ * @param String $string
+ */
+ function specialchars ($string, $type = 'xml')
+ {
+ $specialchars = array(
+ '"' => '"',
+ '&' => '&',
+ '<' => '<',
+ '>' => '>'
+ );
+ if ( $type != 'xml' )
+ {
+ $specialchars["'"] = ''';
+ }
+ else
+ {
+ $specialchars["'"] = ''';
+ }
+
+ $string = preg_replace('/&(#?[Xx]?[0-9A-Za-z]+);/', "[[[ENTITY:\\1]]]", $string);
+ $string = strtr($string, $specialchars);
+ $string = preg_replace('/\[\[\[ENTITY\:([^\]]+)\]\]\]/', "&\\1;", $string);
+ return $string;
+ }
+
+ /**
+ * Entity::_hex_to_utf8()
+ * convert decimal numeric character references to hexadecimal numeric character references
+ *
+ * @deprecated
+ * @param String $string
+ */
+ function _hex_to_utf8($s)
+ {
+ $c = hexdec($s);
+
+ if ( $c < 0x80 )
+ {
+ $str = chr($c);
+ }
+ else if ( $c < 0x800 )
+ {
+ $str = chr(0xC0 | $c>>6) . chr(0x80 | $c & 0x3F);
+ }
+ else if ( $c < 0x10000 )
+ {
+ $str = chr(0xE0 | $c>>12) . chr(0x80 | $c>>6 & 0x3F) . chr(0x80 | $c & 0x3F);
+ }
+ else if ( $c < 0x200000 )
+ {
+ $str = chr(0xF0 | $c>>18) . chr(0x80 | $c>>12 & 0x3F) . chr(0x80 | $c>>6 & 0x3F) . chr(0x80 | $c & 0x3F);
+ }
+ return $str;
+ }
+
+ /**
+ * Entity::_named()
+ * convert entities to named character reference
+ *
+ * @deprecated
+ * @param String $string
+ * @param String $extra
+ * @return
+ */
+ function _named($entity, $extra)
+ {
+ if ( $extra == '=' )
+ {
+ return $entity . '=';
+ }
+
+ $length = i18n::strlen($entity);
+
+ while ( $length > 0 )
+ {
+ $check = i18n::substr($entity, 0, $length);
+ if ( array_key_exists($check, self::$entities['named_to_numeric']) )
+ {
+ return self::$entities['named_to_numeric'][$check] . ';' . i18n::substr($entity, $length);
+ }
+ $length--;
+ }
+
+ if ( $extra != ';' )
+ {
+ return $entity;
+ }
+ else
+ {
+ return "{$entity};";
+ }
+ }
+
+ /**
+ * ENTITIY::$entities
+ *
+ * HTML 4.01 Specification
+ * @link http://www.w3.org/TR/html4/sgml/entities.html
+ * @see 24 Character entity references in HTML 4
+ *
+ * XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition)
+ * A Reformulation of HTML 4 in XML 1.0
+ * @link http://www.w3.org/TR/xhtml1/
+ * @see 4.12. Entity references as hex values
+ * @see C.16. The Named Character Reference '
+ *
+ * @static
+ * @deprecated
+ */
+ static private $entities = array (
+ 'named_to_numeric' => array (
+ ' ' => ' ',
+ '¡' => '¡',
+ '¢' => '¢',
+ '£' => '£',
+ '¤' => '¤',
+ '¥' => '¥',
+ '¦' => '¦',
+ '§' => '§',
+ '¨' => '¨',
+ '©' => '©',
+ 'ª' => 'ª',
+ '«' => '«',
+ '¬' => '¬',
+ '­' => '­',
+ '®' => '®',
+ '¯' => '¯',
+ '°' => '°',
+ '±' => '±',
+ '²' => '²',
+ '³' => '³',
+ '´' => '´',
+ 'µ' => 'µ',
+ '¶' => '¶',
+ '·' => '·',
+ '¸' => '¸',
+ '¹' => '¹',
+ 'º' => 'º',
+ '»' => '»',
+ '¼' => '¼',
+ '½' => '½',
+ '¾' => '¾',
+ '¿' => '¿',
+ 'À' => 'À',
+ 'Á' => 'Á',
+ 'Â' => 'Â',
+ 'Ã' => 'Ã',
+ 'Ä' => 'Ä',
+ 'Å' => 'Å',
+ 'Æ' => 'Æ',
+ 'Ç' => 'Ç',
+ 'È' => 'È',
+ 'É' => 'É',
+ 'Ê' => 'Ê',
+ 'Ë' => 'Ë',
+ 'Ì' => 'Ì',
+ 'Í' => 'Í',
+ 'Î' => 'Î',
+ 'Ï' => 'Ï',
+ 'Ð' => 'Ð',
+ 'Ñ' => 'Ñ',
+ 'Ò' => 'Ò',
+ 'Ó' => 'Ó',
+ 'Ô' => 'Ô',
+ 'Õ' => 'Õ',
+ 'Ö' => 'Ö',
+ '×' => '×',
+ 'Ø' => 'Ø',
+ 'Ù' => 'Ù',
+ 'Ú' => 'Ú',
+ 'Û' => 'Û',
+ 'Ü' => 'Ü',
+ 'Ý' => 'Ý',
+ 'Þ' => 'Þ',
+ 'ß' => 'ß',
+ 'à' => 'à',
+ 'á' => 'á',
+ 'â' => 'â',
+ 'ã' => 'ã',
+ 'ä' => 'ä',
+ 'å' => 'å',
+ 'æ' => 'æ',
+ 'ç' => 'ç',
+ 'è' => 'è',
+ 'é' => 'é',
+ 'ê' => 'ê',
+ 'ë' => 'ë',
+ 'ì' => 'ì',
+ 'í' => 'í',
+ 'î' => 'î',
+ 'ï' => 'ï',
+ 'ð' => 'ð',
+ 'ñ' => 'ñ',
+ 'ò' => 'ò',
+ 'ó' => 'ó',
+ 'ô' => 'ô',
+ 'õ' => 'õ',
+ 'ö' => 'ö',
+ '÷' => '÷',
+ 'ø' => 'ø',
+ 'ù' => 'ù',
+ 'ú' => 'ú',
+ 'û' => 'û',
+ 'ü' => 'ü',
+ 'ý' => 'ý',
+ 'þ' => 'þ',
+ 'ÿ' => 'ÿ',
+ '&OElig' => 'Œ',
+ '&oelig' => 'å',
+ '&Scaron' => 'Š',
+ '&scaron' => 'š',
+ '&Yuml' => 'Ÿ',
+ '&circ' => 'ˆ',
+ '&tilde' => '˜',
+ '&esnp' => ' ',
+ '&emsp' => ' ',
+ '&thinsp' => ' ',
+ '&zwnj' => '‌',
+ '&zwj' => '‍',
+ '&lrm' => '‎',
+ '&rlm' => '‏',
+ '&ndash' => '–',
+ '&mdash' => '—',
+ '&lsquo' => '‘',
+ '&rsquo' => '’',
+ '&sbquo' => '‚',
+ '&ldquo' => '“',
+ '&rdquo' => '”',
+ '&bdquo' => '„',
+ '&dagger' => '†',
+ '&Dagger' => '‡',
+ '&permil' => '‰',
+ '&lsaquo' => '‹',
+ '&rsaquo' => '›',
+ '&euro' => '€',
+ '&fnof' => 'ƒ',
+ '&Alpha' => 'Α',
+ '&Beta' => 'Β',
+ '&Gamma' => 'Γ',
+ '&Delta' => 'Δ',
+ '&Epsilon' => 'Ε',
+ '&Zeta' => 'Ζ',
+ '&Eta' => 'Η',
+ '&Theta' => 'Θ',
+ '&Iota' => 'Ι',
+ '&Kappa' => 'Κ',
+ '&Lambda' => 'Λ',
+ '&Mu' => 'Μ',
+ '&Nu' => 'Ν',
+ '&Xi' => 'Ξ',
+ '&Omicron' => 'Ο',
+ '&Pi' => 'Π',
+ '&Rho' => 'Ρ',
+ '&Sigma' => 'Σ',
+ '&Tau' => 'Τ',
+ '&Upsilon' => 'Υ',
+ '&Phi' => 'Φ',
+ '&Chi' => 'Χ',
+ '&Psi' => 'Ψ',
+ '&Omega' => 'Ω',
+ '&alpha' => 'α',
+ '&beta' => 'β',
+ '&gamma' => 'γ',
+ '&delta' => 'δ',
+ '&epsilon' => 'ε',
+ '&zeta' => 'ζ',
+ '&eta' => 'η',
+ '&theta' => 'θ',
+ '&iota' => 'ι',
+ '&kappa' => 'κ',
+ '&lambda' => 'λ',
+ '&mu' => 'μ',
+ '&nu' => 'ν',
+ '&xi' => 'ξ',
+ '&omicron' => 'ο',
+ '&pi' => 'π',
+ '&rho' => 'ρ',
+ '&sigmaf' => 'ς',
+ '&sigma' => 'σ',
+ '&tau' => 'τ',
+ '&upsilon' => 'υ',
+ '&phi' => 'φ',
+ '&chi' => 'χ',
+ '&psi' => 'ψ',
+ '&omega' => 'ω',
+ '&thetasym' => 'ϑ',
+ '&upsih' => 'ϒ',
+ '&piv' => 'ϖ',
+ '&bull' => '•',
+ '&hellip' => '…',
+ '&prime' => '′',
+ '&Prime' => '″',
+ '&oline' => '‾',
+ '&frasl' => '⁄',
+ '&weierp' => '℘',
+ '&image' => 'ℑ',
+ '&real' => 'ℜ',
+ '&trade' => 'ℒ',
+ '&alefsym' => 'ℵ',
+ '&larr' => '←',
+ '&uarr' => '↑',
+ '&rarr' => '→',
+ '&darr' => '↓',
+ '&harr' => '↔',
+ '&crarr' => '↵',
+ '&lArr' => '⇐',
+ '&uArr' => '⇑',
+ '&rArr' => '⇒',
+ '&dArr' => '⇓',
+ '&hArr' => '⇔',
+ '&forall' => '∀',
+ '&part' => '∂',
+ '&exist' => '∃',
+ '&empty' => '∅',
+ '&nabla' => '∇',
+ '&isin' => '∈',
+ '¬in' => '∉',
+ '&ni' => '∋',
+ '&prod' => '∏',
+ '&sum' => '∑',
+ '&minus' => '−',
+ '&lowast' => '∗',
+ '&radic' => '√',
+ '&prop' => '∝',
+ '&infin' => '∞',
+ '&ang' => '∠',
+ '&and' => '∧',
+ '&or' => '∨',
+ '&cap' => '∩',
+ '&cup' => '∪',
+ '&int' => '∫',
+ '&there4' => '∴',
+ '&sim' => '∼',
+ '&cong' => '≅',
+ '&asymp' => '≈',
+ '&ne' => '≠',
+ '&equiv' => '≡',
+ '&le' => '≤',
+ '&ge' => '≥',
+ '&sub' => '⊂',
+ '&sup' => '⊃',
+ '&nsub' => '⊄',
+ '&sube' => '⊆',
+ '&supe' => '⊇',
+ '&oplus' => '⊕',
+ '&otimes' => '⊖',
+ '&perp' => '⊥',
+ '&sdot' => '⋅',
+ '&lceil' => '⍨',
+ '&rceil' => '⌉',
+ '&lfloor' => '⌊',
+ '&rfloor' => '⌋',
+ '&lang' => '〈',
+ '&rang' => '⌰',
+ '&loz' => '◊',
+ '&spades' => '♠',
+ '&clubs' => '♣',
+ '&hearts' => '♥',
+ '&diams' => '♦'
+ ),
+ 'Windows-1252' => array(
+ '€' => '€',
+ '‚' => '‚',
+ 'ƒ' => 'ƒ',
+ '„' => '„',
+ '…' => '…',
+ '†' => '†',
+ '‡' => '‡',
+ 'ˆ' => 'ˆ',
+ '‰' => '‰',
+ 'Š' => 'Š',
+ '‹' => '‹',
+ 'Œ' => 'Œ',
+ 'Ž' => 'Ž',
+ '‘' => '‘',
+ '’' => '’',
+ '“' => '“',
+ '”' => '”',
+ '•' => '•',
+ '–' => '–',
+ '—' => '—',
+ '˜' => '˜',
+ '™' => '™',
+ 'š' => 'š',
+ '›' => '›',
+ 'œ' => 'œ',
+ 'ž' => 'ž',
+ 'Ÿ' => 'Ÿ',
+ )
+ );
+}
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: ITEM.php 1668 2012-02-19 14:36:44Z sakamocchi $\r
- */\r
-\r
-/**\r
- * A class representing an item\r
- *\r
- */\r
-class Item\r
-{\r
- /**\r
- * Item::$actiontypes\r
- * actiontype list for handling items\r
- * \r
- * @static\r
- */\r
- static private $actiontypes\r
- = array('addnow', 'adddraft', 'addfuture', 'edit', 'changedate', 'backtodrafts', 'delete');\r
- \r
- /**\r
- * Item::$itemid\r
- * item id\r
- * @deprecated\r
- * \r
- */\r
- public $itemid;\r
- \r
- /**\r
- * Item::__construct()\r
- * Creates a new ITEM object\r
- * \r
- * @deprecated\r
- * @param integer $item_id id for item\r
- * @return void\r
- */\r
- public function __construct($item_id)\r
- {\r
- $this->itemid = $item_id;\r
- return;\r
- }\r
- \r
- /**\r
- * Item::getitem()\r
- * Returns one item with the specific itemid\r
- *\r
- * @param int $item_id\r
- * @param bool $allow_draft\r
- * @param bool $allow_future\r
- * @return mixed\r
- * \r
- */\r
- static public function getitem($item_id, $allow_draft, $allow_future)\r
- {\r
- global $manager;\r
- \r
- $item_id = (integer) $item_id;\r
- \r
- $query = 'SELECT ' .\r
- 'i.idraft AS draft, ' .\r
- 'i.inumber AS itemid, ' .\r
- 'i.iclosed AS closed, ' .\r
- 'i.ititle AS title, ' .\r
- 'i.ibody AS body, ' .\r
- 'm.mname AS author, ' .\r
- 'i.iauthor AS authorid, ' .\r
- 'i.itime, ' .\r
- 'i.imore AS more, ' .\r
- 'i.ikarmapos AS karmapos, ' .\r
- 'i.ikarmaneg AS karmaneg, ' .\r
- 'i.icat AS catid, ' .\r
- 'i.iblog AS blogid ' .\r
- 'FROM %s AS i, %s AS m, %s AS b ' .\r
- 'WHERE i.inumber = %d ' .\r
- 'AND i.iauthor = m.mnumber ' .\r
- 'AND i.iblog = b.bnumber ';\r
- \r
- $query = sprintf($query, sql_table('item'), sql_table('member'), sql_table('blog'), $item_id);\r
- \r
- if ( !$allow_draft )\r
- {\r
- $query .= "AND i.idraft = 0 ";\r
- }\r
- \r
- if ( !$allow_future )\r
- {\r
- /* FIXME: should be rewritten! */\r
- $blog =& $manager->getBlog(getBlogIDFromItemID($item_id));\r
- $query .= 'AND i.itime <= ' . DB::formatDateTime($blog->getCorrectTime());\r
- }\r
- \r
- $query .= ' LIMIT 1';\r
- $result = DB::getResult($query);\r
- \r
- if ( $result->rowCount() != 1 )\r
- {\r
- return 0;\r
- }\r
- $aItemInfo = $result->fetch(PDO::FETCH_ASSOC);\r
- $aItemInfo['timestamp'] = strtotime($aItemInfo['itime']);\r
- return $aItemInfo;\r
- }\r
- \r
- /**\r
- * Item::createFromRequest()\r
- * Tries to create an item from the data in the current request (comes from\r
- * bookmarklet or admin area\r
- *\r
- * @static\r
- * @param void\r
- * @return array (status = added/error/newcategory, message)\r
- * \r
- */\r
- static public function createFromRequest()\r
- {\r
- global $member, $manager;\r
- \r
- /*\r
- * TODO: these values from user agent should be validated but not implemented yet\r
- */\r
- $i_author = $member->getID();\r
- $i_body = postVar('body');\r
- $i_title = postVar('title');\r
- $i_more = postVar('more');\r
- $i_actiontype = postVar('actiontype');\r
- $i_closed = intPostVar('closed');\r
- $i_hour = intPostVar('hour');\r
- $i_minutes = intPostVar('minutes');\r
- $i_month = intPostVar('month');\r
- $i_day = intPostVar('day');\r
- $i_year = intPostVar('year');\r
- $i_catid = postVar('catid');\r
- $i_draftid = intPostVar('draftid');\r
- \r
- if ( !$member->canAddItem($i_catid) )\r
- {\r
- return array('status' => 'error', 'message' => _ERROR_DISALLOWED);\r
- }\r
- \r
- if ( !in_array($i_actiontype, self::$actiontypes) )\r
- {\r
- $i_actiontype = 'addnow';\r
- }\r
- \r
- $i_draft = (integer) ( $i_actiontype == 'adddraft' );\r
- \r
- if ( !trim($i_body) )\r
- {\r
- return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);\r
- }\r
- \r
- // create new category if needed\r
- if ( i18n::strpos($i_catid, 'newcat') === 0 )\r
- {\r
- // get blogid\r
- list($i_blogid) = sscanf($i_catid, "newcat-%d");\r
- \r
- // create\r
- $blog =& $manager->getBlog($i_blogid);\r
- $i_catid = $blog->createNewCategory();\r
- \r
- // show error when sth goes wrong\r
- if ( !$i_catid )\r
- {\r
- return array('status' => 'error','message' => 'Could not create new category');\r
- }\r
- }\r
- else\r
- {\r
- // force blogid (must be same as category id)\r
- $i_blogid = getBlogIDFromCatID($i_catid);\r
- $blog =& $manager->getBlog($i_blogid);\r
- }\r
- \r
- if ( $i_actiontype == 'addfuture' )\r
- {\r
- $posttime = mktime($i_hour, $i_minutes, 0, $i_month, $i_day, $i_year);\r
- \r
- // make sure the date is in the future, unless we allow past dates\r
- if ( (!$blog->allowPastPosting()) && ($posttime < $blog->getCorrectTime()) )\r
- {\r
- $posttime = $blog->getCorrectTime();\r
- }\r
- }\r
- else\r
- {\r
- if ( !$i_draft )\r
- {\r
- $posttime = $blog->getCorrectTime();\r
- }\r
- else\r
- {\r
- $posttime = 0;\r
- }\r
- }\r
- \r
- if ( $posttime > $blog->getCorrectTime() )\r
- {\r
- $posted = 0;\r
- $blog->setFuturePost();\r
- }\r
- else\r
- {\r
- $posted = 1;\r
- }\r
- \r
- $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft, $posted);\r
- \r
- //Setting the itemOptions\r
- $aOptions = requestArray('plugoption');\r
- NucleusPlugin::apply_plugin_options($aOptions, $itemid);\r
- $manager->notify('PostPluginOptionsUpdate', array(\r
- 'context' => 'item',\r
- 'itemid' => $itemid,\r
- 'item' => array(\r
- 'title' => $i_title,\r
- 'body' => $i_body,\r
- 'more' => $i_more,\r
- 'closed' => $i_closed,\r
- 'catid' => $i_catid\r
- )\r
- )\r
- );\r
- \r
- if ( $i_draftid > 0 )\r
- {\r
- // delete permission is checked inside Item::delete()\r
- self::delete($i_draftid);\r
- }\r
- \r
- // success\r
- if ( $i_catid != intRequestVar('catid') )\r
- {\r
- return array('status' => 'newcategory', 'itemid' => $itemid, 'catid' => $i_catid);\r
- }\r
- else\r
- {\r
- return array('status' => 'added', 'itemid' => $itemid);\r
- }\r
- }\r
- \r
- /**\r
- * Item::update()\r
- * Updates an item\r
- *\r
- * @static\r
- * @param integer $itemid item id\r
- * @param integer $catid category id\r
- * @param string $title title\r
- * @param string $body body text\r
- * @param string $more more text\r
- * @param boolean $closed closed or not\r
- * @param boolean $wasdraft previously draft or not\r
- * @param boolean $publish published or not\r
- * @param timestamp $timestamp timestamp\r
- * @return void\r
- * \r
- */\r
- static public function update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp = 0)\r
- {\r
- global $manager;\r
- \r
- $itemid = (integer) $itemid;\r
- $closed = (boolean) $closed;\r
- \r
- // get destination blogid\r
- $new_blogid = getBlogIDFromCatID($catid);\r
- $old_blogid = getBlogIDFromItemID($itemid);\r
- \r
- // move will be done on end of method\r
- $moveNeeded = 0;\r
- if ( $new_blogid != $old_blogid )\r
- {\r
- $moveNeeded = 1;\r
- }\r
- \r
- $blog =& $manager->getBlog($new_blogid);\r
- \r
- // begin if: convert line breaks to <br/>\r
- if ( $blog->convertBreaks() )\r
- {\r
- $body = addBreaks($body);\r
- $more = addBreaks($more);\r
- }\r
- \r
- // call plugins\r
- $manager->notify('PreUpdateItem', array(\r
- 'itemid' => $itemid,\r
- 'title' => &$title,\r
- 'body' => &$body,\r
- 'more' => &$more,\r
- 'blog' => &$blog,\r
- 'closed' => &$closed,\r
- 'catid' => &$catid\r
- )\r
- );\r
- \r
- // update item itself\r
- $query = 'UPDATE ' . sql_table('item')\r
- . ' SET'\r
- . ' ibody = ' . DB::quoteValue($body) . ','\r
- . ' ititle = ' . DB::quoteValue($title) . ','\r
- . ' imore = ' . DB::quoteValue($more) . ','\r
- . ' iclosed = ' . intval($closed) . ','\r
- . ' icat = ' . intval($catid);\r
- \r
- // if we received an updated timestamp that is in the past, but past posting is not allowed, reject that date change (timestamp = 0 will make sure the current date is kept)\r
- if ( (!$blog->allowPastPosting()) && ($timestamp < $blog->getCorrectTime()) )\r
- {\r
- $timestamp = 0;\r
- }\r
- \r
- // begin if: post is in the future\r
- if ( $timestamp > $blog->getCorrectTime(time()) )\r
- {\r
- $isFuture = 1;\r
- $query .= ', iposted = 0';\r
- }\r
- else\r
- {\r
- $isFuture = 0;\r
- $query .= ', iposted = 1';\r
- }\r
- \r
- if ( $wasdraft && $publish )\r
- {\r
- // set timestamp to current date only if it's not a future item\r
- // draft items have timestamp == 0\r
- // don't allow timestamps in the past (unless otherwise defined in blogsettings)\r
- $query .= ', idraft = 0';\r
- \r
- if ( $timestamp == 0 )\r
- {\r
- $timestamp = $blog->getCorrectTime();\r
- }\r
- \r
- // send new item notification\r
- if ( !$isFuture && $blog->getNotifyAddress() && $blog->notifyOnNewItem() )\r
- {\r
- $blog->sendNewItemNotification($itemid, $title, $body);\r
- }\r
- }\r
- \r
- // save back to drafts\r
- if ( !$wasdraft && !$publish )\r
- {\r
- $query .= ', idraft = 1';\r
- // set timestamp back to zero for a draft\r
- $query .= ', itime = ' . DB::formatDateTime($timestamp);\r
- }\r
- \r
- // update timestamp when needed\r
- if ( $timestamp != 0 )\r
- {\r
- $query .= ', itime = ' . DB::formatDateTime($timestamp);\r
- }\r
- \r
- // make sure the correct item is updated\r
- $query .= ' WHERE inumber = ' . $itemid;\r
- \r
- // off we go!\r
- DB::execute($query);\r
- \r
- $manager->notify('PostUpdateItem', array('itemid' => $itemid));\r
- \r
- // when needed, move item and comments to new blog\r
- if ( $moveNeeded )\r
- {\r
- self::move($itemid, $catid);\r
- }\r
- \r
- //update the itemOptions\r
- $aOptions = requestArray('plugoption');\r
- NucleusPlugin::apply_plugin_options($aOptions);\r
- $manager->notify('PostPluginOptionsUpdate', array(\r
- 'context' => 'item',\r
- 'itemid' => $itemid,\r
- 'item' => array(\r
- 'title' => $title,\r
- 'body' => $body,\r
- 'more' => $more,\r
- 'closed' => $closed,\r
- 'catid' => $catid\r
- )\r
- )\r
- );\r
- return;\r
- }\r
- \r
- /**\r
- * Item::move()\r
- * Move an item to another blog (no checks)\r
- *\r
- * @static\r
- * @param integer $itemid\r
- * @param integer $new_catid\r
- * @return void\r
- */\r
- static public function move($itemid, $new_catid)\r
- {\r
- global $manager;\r
- \r
- $itemid = (integer) $itemid;\r
- $new_catid = (integer) $new_catid;\r
- $new_blogid = getBlogIDFromCatID($new_catid);\r
- \r
- $manager->notify(\r
- 'PreMoveItem',\r
- array(\r
- 'itemid' => $itemid,\r
- 'destblogid' => $new_blogid,\r
- 'destcatid' => $new_catid\r
- )\r
- );\r
- \r
- // update item table\r
- $query = "UPDATE %s SET iblog=%d, icat=%d WHERE inumber=%d";\r
- $query = sprintf($query, sql_table('item'), $new_blogid, $new_catid, $itemid);\r
- DB::execute($query);\r
- \r
- // update comments\r
- $query = "UPDATE %s SET cblog=%d WHERE citem=%d";\r
- $query = sprintf($query, sql_table('comment'), $new_blogid, $itemid);\r
- DB::execute($query);\r
- \r
- $manager->notify(\r
- 'PostMoveItem',\r
- array(\r
- 'itemid' => $itemid,\r
- 'destblogid' => $new_blogid,\r
- 'destcatid' => $new_catid\r
- )\r
- );\r
- return;\r
- }\r
- \r
- /**\r
- * Item::delete()\r
- * Deletes an item\r
- * \r
- * @param integer $itemid\r
- * @return void\r
- */\r
- static public function delete($itemid)\r
- {\r
- global $manager, $member;\r
- \r
- $itemid = (integer) $itemid;\r
- \r
- // check permission\r
- if ( !$member->canAlterItem($itemid) )\r
- {\r
- return 1;\r
- }\r
- \r
- $manager->notify('PreDeleteItem', array('itemid' => $itemid));\r
- \r
- // delete item\r
- $query = "DELETE FROM %s WHERE inumber=%d";\r
- $query = sprintf($query, sql_table('item'), $itemid);\r
- DB::execute($query);\r
- \r
- // delete the comments associated with the item\r
- $query = "DELETE FROM %s WHERE citem=%d";\r
- $query = sprintf($query, sql_table('comment'), $itemid);\r
- DB::execute($query);\r
- \r
- // delete all associated plugin options\r
- NucleusPlugin::delete_option_values('item', $itemid);\r
- \r
- $manager->notify('PostDeleteItem', array('itemid' => $itemid));\r
- \r
- return 0;\r
- }\r
- \r
- /**\r
- * Item::exists()\r
- * Returns true if there is an item with the given ID\r
- *\r
- * @static\r
- * @param integer $itemid\r
- * @param boolean $future\r
- * @param boolean $draft\r
- * @return boolean exists or not\r
- * \r
- */\r
- static public function exists($itemid, $future, $draft)\r
- {\r
- global $manager;\r
- \r
- $itemid = (integer) $itemid;\r
- $query = 'SELECT * FROM '.sql_table('item').' WHERE inumber='.$itemid;\r
- \r
- if ( !$future )\r
- {\r
- $blogid = getBlogIDFromItemID($itemid);\r
- if ( !$blogid )\r
- {\r
- return 0;\r
- }\r
- $blog =& $manager->getBlog($blogid);\r
- $query .= ' and itime<=' . DB::formatDateTime($blog->getCorrectTime());\r
- }\r
- if ( !$draft )\r
- {\r
- $query .= ' and idraft=0';\r
- }\r
- $result = DB::getResult($query);\r
- return ( $result->rowCount() != 0 );\r
- }\r
- \r
- /**\r
- * Item::createDraftFromRequest()\r
- * Tries to create an draft from the data\r
- * in the current request (comes from bookmarklet or admin area)\r
- * Used by xmlHTTPRequest AutoDraft\r
- *\r
- * Returns an array with status info:\r
- * status = 'added', 'error', 'newcategory'\r
- *\r
- * @static\r
- * @param void\r
- * @return array (status = added/error/newcategory, message)\r
- *\r
- */\r
- static public function createDraftFromRequest()\r
- {\r
- global $member, $manager;\r
- \r
- /*\r
- * TODO: these values from user agent should be validated but not implemented yet\r
- */\r
- $i_author = $member->getID();\r
- $i_body = postVar('body');\r
- $i_title = postVar('title');\r
- $i_more = postVar('more');\r
- $i_closed = intPostVar('closed');\r
- $i_catid = postVar('catid');\r
- $i_draft = 1;\r
- $type = postVar('type');\r
- $i_draftid = intPostVar('draftid');\r
- \r
- if ( $type == 'edit' )\r
- {\r
- $itemid = intPostVar('itemid');\r
- $item =& $manager->getItem($itemid, 0, 0);\r
- $i_blogid = $item['blogid'];\r
- }\r
- else\r
- {\r
- $i_blogid = intPostVar('blogid');\r
- }\r
- \r
- if ( !$member->canAddItem($i_catid) )\r
- {\r
- return array('status' => 'error', 'message' => _ERROR_DISALLOWED);\r
- }\r
- \r
- if ( !trim($i_body) )\r
- {\r
- return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);\r
- }\r
- \r
- // create new category if needed\r
- if ( i18n::strpos($i_catid,'newcat') === 0 )\r
- {\r
- // Set in default category\r
- $blog =& $manager->getBlog($i_blogid);\r
- $i_catid = $blog->getDefaultCategory();\r
- }\r
- else\r
- {\r
- // force blogid (must be same as category id)\r
- $i_blogid = getBlogIDFromCatID($i_catid);\r
- $blog =& $manager->getBlog($i_blogid);\r
- }\r
- \r
- $posttime = 0;\r
- \r
- if ( $i_draftid > 0 )\r
- {\r
- self::update($i_draftid, $i_catid, $i_title, $i_body, $i_more, $i_closed, 1, 0, 0);\r
- $itemid = $i_draftid;\r
- }\r
- else\r
- {\r
- $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft);\r
- }\r
- \r
- return array('status' => 'added', 'draftid' => $itemid);\r
- }\r
-}\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: ITEM.php 1877 2012-06-17 07:40:11Z sakamocchi $
+ */
+
+/**
+ * A class representing an item
+ *
+ */
+class Item
+{
+ /**
+ * Item::$actiontypes
+ * actiontype list for handling items
+ *
+ * @static
+ */
+ static private $actiontypes = array(
+ 'addnow', 'adddraft', 'addfuture', 'edit',
+ 'changedate', 'backtodrafts', 'delete'
+ );
+
+ /**
+ * Item::$itemid
+ * item id
+ * @deprecated
+ */
+ public $itemid;
+
+ /**
+ * Item::__construct()
+ * Creates a new ITEM object
+ *
+ * @deprecated
+ * @param integer $item_id id for item
+ * @return void
+ */
+ public function __construct($item_id)
+ {
+ $this->itemid = $item_id;
+ return;
+ }
+
+ /**
+ * Item::getitem()
+ * Returns one item with the specific itemid
+ *
+ * @static
+ * @param int $item_id
+ * @param bool $allow_draft
+ * @param bool $allow_future
+ * @return mixed
+ */
+ static public function getitem($item_id, $allow_draft, $allow_future)
+ {
+ global $manager;
+
+ $item_id = (integer) $item_id;
+
+ $query = 'SELECT ' .
+ 'i.idraft AS draft, ' .
+ 'i.inumber AS itemid, ' .
+ 'i.iclosed AS closed, ' .
+ 'i.ititle AS title, ' .
+ 'i.ibody AS body, ' .
+ 'm.mname AS author, ' .
+ 'i.iauthor AS authorid, ' .
+ 'i.itime, ' .
+ 'i.imore AS more, ' .
+ 'i.ikarmapos AS karmapos, ' .
+ 'i.ikarmaneg AS karmaneg, ' .
+ 'i.icat AS catid, ' .
+ 'i.iblog AS blogid ' .
+ 'FROM %s AS i, %s AS m, %s AS b ' .
+ 'WHERE i.inumber = %d ' .
+ 'AND i.iauthor = m.mnumber ' .
+ 'AND i.iblog = b.bnumber ';
+
+ $query = sprintf($query, sql_table('item'), sql_table('member'), sql_table('blog'), $item_id);
+
+ if ( !$allow_draft )
+ {
+ $query .= "AND i.idraft = 0 ";
+ }
+
+ if ( !$allow_future )
+ {
+ $blog =& $manager->getBlog(getBlogIDFromItemID($item_id));
+ $query .= 'AND i.itime <= ' . DB::formatDateTime($blog->getCorrectTime());
+ }
+
+ $query .= ' LIMIT 1';
+ $result = DB::getResult($query);
+
+ if ( $result->rowCount() != 1 )
+ {
+ return 0;
+ }
+
+ $aItemInfo = $result->fetch(PDO::FETCH_ASSOC);
+ $aItemInfo['timestamp'] = strtotime($aItemInfo['itime']);
+ return $aItemInfo;
+ }
+
+ /**
+ * Item::createFromRequest()
+ * Tries to create an item from the data in the current request (comes from
+ * bookmarklet or admin area
+ *
+ * @static
+ * @param void
+ * @return array (status = added/error/newcategory, message)
+ *
+ */
+ static public function createFromRequest()
+ {
+ global $member, $manager;
+
+ /*
+ * TODO: these values from user agent should be validated but not implemented yet
+ */
+ $i_author = $member->getID();
+ $i_body = postVar('body');
+ $i_title = postVar('title');
+ $i_more = postVar('more');
+ $i_actiontype = postVar('actiontype');
+ $i_closed = intPostVar('closed');
+ $i_hour = intPostVar('hour');
+ $i_minutes = intPostVar('minutes');
+ $i_month = intPostVar('month');
+ $i_day = intPostVar('day');
+ $i_year = intPostVar('year');
+ $i_catid = postVar('catid');
+ $i_draftid = intPostVar('draftid');
+
+ if ( !$member->canAddItem($i_catid) )
+ {
+ return array('status' => 'error', 'message' => _ERROR_DISALLOWED);
+ }
+
+ if ( !in_array($i_actiontype, self::$actiontypes) )
+ {
+ $i_actiontype = 'addnow';
+ }
+
+ $i_draft = (integer) ( $i_actiontype == 'adddraft' );
+
+ if ( !trim($i_body) )
+ {
+ return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);
+ }
+
+ // create new category if needed
+ if ( i18n::strpos($i_catid, 'newcat') === 0 )
+ {
+ // get blogid
+ list($i_blogid) = sscanf($i_catid, "newcat-%d");
+
+ // create
+ $blog =& $manager->getBlog($i_blogid);
+ $i_catid = $blog->createNewCategory();
+
+ // show error when sth goes wrong
+ if ( !$i_catid )
+ {
+ return array('status' => 'error','message' => 'Could not create new category');
+ }
+ }
+ else
+ {
+ // force blogid (must be same as category id)
+ $i_blogid = getBlogIDFromCatID($i_catid);
+ $blog =& $manager->getBlog($i_blogid);
+ }
+
+ if ( $i_actiontype == 'addfuture' )
+ {
+ $posttime = mktime($i_hour, $i_minutes, 0, $i_month, $i_day, $i_year);
+
+ // make sure the date is in the future, unless we allow past dates
+ if ( (!$blog->allowPastPosting()) && ($posttime < $blog->getCorrectTime()) )
+ {
+ $posttime = $blog->getCorrectTime();
+ }
+ }
+ else
+ {
+ if ( !$i_draft )
+ {
+ $posttime = $blog->getCorrectTime();
+ }
+ else
+ {
+ $posttime = 0;
+ }
+ }
+
+ if ( $posttime > $blog->getCorrectTime() )
+ {
+ $posted = 0;
+ $blog->setFuturePost();
+ }
+ else
+ {
+ $posted = 1;
+ }
+
+ $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft, $posted);
+
+ //Setting the itemOptions
+ $aOptions = requestArray('plugoption');
+ NucleusPlugin::apply_plugin_options($aOptions, $itemid);
+ $data = array(
+ 'context' => 'item',
+ 'itemid' => $itemid,
+ 'item' => array(
+ 'title' => $i_title,
+ 'body' => $i_body,
+ 'more' => $i_more,
+ 'closed' => $i_closed,
+ 'catid' => $i_catid
+ )
+ );
+
+ $manager->notify('PostPluginOptionsUpdate', $data);
+
+ if ( $i_draftid > 0 )
+ {
+ // delete permission is checked inside Item::delete()
+ self::delete($i_draftid);
+ }
+
+ // success
+ if ( $i_catid != intRequestVar('catid') )
+ {
+ return array('status' => 'newcategory', 'itemid' => $itemid, 'catid' => $i_catid);
+ }
+
+ return array('status' => 'added', 'itemid' => $itemid);
+ }
+
+ /**
+ * Item::update()
+ * Updates an item
+ *
+ * @static
+ * @param integer $itemid item id
+ * @param integer $catid category id
+ * @param string $title title
+ * @param string $body body text
+ * @param string $more more text
+ * @param boolean $closed closed or not
+ * @param boolean $wasdraft previously draft or not
+ * @param boolean $publish published or not
+ * @param timestamp $timestamp timestamp
+ * @return void
+ */
+ static public function update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp = 0)
+ {
+ global $manager;
+
+ $itemid = (integer) $itemid;
+ $closed = (boolean) $closed;
+
+ // get destination blogid
+ $new_blogid = getBlogIDFromCatID($catid);
+ $old_blogid = getBlogIDFromItemID($itemid);
+
+ // move will be done on end of method
+ $moveNeeded = 0;
+ if ( $new_blogid != $old_blogid )
+ {
+ $moveNeeded = 1;
+ }
+
+ $blog =& $manager->getBlog($new_blogid);
+
+ // begin if: convert line breaks to <br/>
+ if ( $blog->convertBreaks() )
+ {
+ $body = addBreaks($body);
+ $more = addBreaks($more);
+ }
+
+ // call plugins
+ $data = array(
+ 'itemid' => $itemid,
+ 'title' => &$title,
+ 'body' => &$body,
+ 'more' => &$more,
+ 'blog' => &$blog,
+ 'closed' => &$closed,
+ 'catid' => &$catid
+ );
+ $manager->notify('PreUpdateItem', $data);
+
+ // update item itself
+ $query = 'UPDATE ' . sql_table('item')
+ . ' SET'
+ . ' ibody = ' . DB::quoteValue($body) . ','
+ . ' ititle = ' . DB::quoteValue($title) . ','
+ . ' imore = ' . DB::quoteValue($more) . ','
+ . ' iclosed = ' . intval($closed) . ','
+ . ' icat = ' . intval($catid);
+
+ // if we received an updated timestamp that is in the past, but past posting is not allowed,
+ // reject that date change (timestamp = 0 will make sure the current date is kept)
+ if ( (!$blog->allowPastPosting()) && ($timestamp < $blog->getCorrectTime()) )
+ {
+ $timestamp = 0;
+ }
+
+ // begin if: post is in the future
+ if ( $timestamp > $blog->getCorrectTime(time()) )
+ {
+ $isFuture = 1;
+ $query .= ', iposted = 0';
+ }
+ else
+ {
+ $isFuture = 0;
+ $query .= ', iposted = 1';
+ }
+
+ if ( $wasdraft && $publish )
+ {
+ // set timestamp to current date only if it's not a future item
+ // draft items have timestamp == 0
+ // don't allow timestamps in the past (unless otherwise defined in blogsettings)
+ $query .= ', idraft = 0';
+
+ if ( $timestamp == 0 )
+ {
+ $timestamp = $blog->getCorrectTime();
+ }
+
+ // send new item notification
+ if ( !$isFuture && $blog->getNotifyAddress() && $blog->notifyOnNewItem() )
+ {
+ $blog->sendNewItemNotification($itemid, $title, $body);
+ }
+ }
+
+ // save back to drafts
+ if ( !$wasdraft && !$publish )
+ {
+ $query .= ', idraft = 1';
+ // set timestamp back to zero for a draft
+ $query .= ', itime = ' . DB::formatDateTime($timestamp);
+ }
+
+ // update timestamp when needed
+ if ( $timestamp != 0 )
+ {
+ $query .= ', itime = ' . DB::formatDateTime($timestamp);
+ }
+
+ // make sure the correct item is updated
+ $query .= ' WHERE inumber = ' . $itemid;
+
+ // off we go!
+ DB::execute($query);
+
+ $manager->notify('PostUpdateItem', array('itemid' => $itemid));
+
+ // when needed, move item and comments to new blog
+ if ( $moveNeeded )
+ {
+ self::move($itemid, $catid);
+ }
+
+ //update the itemOptions
+ $aOptions = requestArray('plugoption');
+ NucleusPlugin::apply_plugin_options($aOptions);
+ $data = array(
+ 'context' => 'item',
+ 'itemid' => $itemid,
+ 'item' => array(
+ 'title' => $title,
+ 'body' => $body,
+ 'more' => $more,
+ 'closed' => $closed,
+ 'catid' => $catid
+ )
+ );
+ $manager->notify('PostPluginOptionsUpdate', $data);
+ return;
+ }
+
+ /**
+ * Item::move()
+ * Move an item to another blog (no checks)
+ *
+ * @static
+ * @param integer $itemid
+ * @param integer $new_catid
+ * @return void
+ */
+ static public function move($itemid, $new_catid)
+ {
+ global $manager;
+
+ $itemid = (integer) $itemid;
+ $new_catid = (integer) $new_catid;
+ $new_blogid = getBlogIDFromCatID($new_catid);
+
+ $data = array(
+ 'itemid' => $itemid,
+ 'destblogid' => $new_blogid,
+ 'destcatid' => $new_catid
+ );
+ $manager->notify('PreMoveItem', $data);
+
+ // update item table
+ $query = "UPDATE %s SET iblog=%d, icat=%d WHERE inumber=%d";
+ $query = sprintf($query, sql_table('item'), $new_blogid, $new_catid, $itemid);
+ DB::execute($query);
+
+ // update comments
+ $query = "UPDATE %s SET cblog=%d WHERE citem=%d";
+ $query = sprintf($query, sql_table('comment'), $new_blogid, $itemid);
+ DB::execute($query);
+
+ $data = array(
+ 'itemid' => $itemid,
+ 'destblogid' => $new_blogid,
+ 'destcatid' => $new_catid
+ );
+ $manager->notify('PostMoveItem', $data);
+ return;
+ }
+
+ /**
+ * Item::delete()
+ * Deletes an item
+ *
+ * @param integer $itemid
+ * @return void
+ */
+ static public function delete($itemid)
+ {
+ global $manager, $member;
+
+ $itemid = (integer) $itemid;
+
+ // check permission
+ if ( !$member->canAlterItem($itemid) )
+ {
+ return 1;
+ }
+
+ $manager->notify('PreDeleteItem', array('itemid' => $itemid));
+
+ // delete item
+ $query = "DELETE FROM %s WHERE inumber=%d;";
+ $query = sprintf($query, sql_table('item'), $itemid);
+ DB::execute($query);
+
+ // delete the comments associated with the item
+ $query = "DELETE FROM %s WHERE citem=%d;";
+ $query = sprintf($query, sql_table('comment'), $itemid);
+ DB::execute($query);
+
+ // delete all associated plugin options
+ NucleusPlugin::delete_option_values('item', $itemid);
+
+ $manager->notify('PostDeleteItem', array('itemid' => $itemid));
+
+ return 0;
+ }
+
+ /**
+ * Item::exists()
+ * Returns true if there is an item with the given ID
+ *
+ * @static
+ * @param integer $itemid
+ * @param boolean $future
+ * @param boolean $draft
+ * @return boolean exists or not
+ */
+ static public function exists($itemid, $future, $draft)
+ {
+ global $manager;
+
+ $itemid = (integer) $itemid;
+
+ $query = 'SELECT * FROM %s WHERE inumber=%d';
+ $query = sprintf($query, sql_table('item'), $itemid);
+
+ if ( !$future )
+ {
+ $blogid = getBlogIDFromItemID($itemid);
+ if ( !$blogid )
+ {
+ return 0;
+ }
+ $blog =& $manager->getBlog($blogid);
+ $query .= ' AND itime<=' . DB::formatDateTime($blog->getCorrectTime());
+ }
+
+ if ( !$draft )
+ {
+ $query .= ' AND idraft=0';
+ }
+
+ $result = DB::getResult($query);
+ return ( $result->rowCount() != 0 );
+ }
+
+ /**
+ * Item::createDraftFromRequest()
+ * Tries to create an draft from the data
+ * in the current request (comes from bookmarklet or admin area)
+ * Used by xmlHTTPRequest AutoDraft
+ *
+ * Returns an array with status info:
+ * status = 'added', 'error', 'newcategory'
+ *
+ * @static
+ * @param void
+ * @return array (status = added/error/newcategory, message)
+ */
+ static public function createDraftFromRequest()
+ {
+ global $member, $manager;
+
+ /*
+ * TODO: these values from user agent should be validated but not implemented yet
+ */
+ $i_author = $member->getID();
+ $i_body = postVar('body');
+ $i_title = postVar('title');
+ $i_more = postVar('more');
+ $i_closed = intPostVar('closed');
+ $i_catid = postVar('catid');
+ $i_draft = 1;
+ $type = postVar('type');
+ $i_draftid = intPostVar('draftid');
+
+ if ( $type == 'edit' )
+ {
+ $itemid = intPostVar('itemid');
+ $i_blogid = getBlogIDFromItemID($itemid);
+ }
+ else
+ {
+ $i_blogid = intPostVar('blogid');
+ }
+
+ if ( !$member->canAddItem($i_catid) )
+ {
+ return array('status' => 'error', 'message' => _ERROR_DISALLOWED);
+ }
+
+ if ( !trim($i_body) )
+ {
+ return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);
+ }
+
+ // create new category if needed
+ if ( i18n::strpos($i_catid,'newcat') === 0 )
+ {
+ // Set in default category
+ $blog =& $manager->getBlog($i_blogid);
+ $i_catid = $blog->getDefaultCategory();
+ }
+ else
+ {
+ // force blogid (must be same as category id)
+ $i_blogid = getBlogIDFromCatID($i_catid);
+ $blog =& $manager->getBlog($i_blogid);
+ }
+
+ $posttime = 0;
+
+ if ( $i_draftid > 0 )
+ {
+ self::update($i_draftid, $i_catid, $i_title, $i_body, $i_more, $i_closed, 1, 0, 0);
+ $itemid = $i_draftid;
+ }
+ else
+ {
+ $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft);
+ }
+
+ return array('status' => 'added', 'draftid' => $itemid);
+ }
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * This class is used to parse item templates\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: ITEMACTIONS.php 1757 2012-04-15 09:02:32Z sakamocchi $\r
- */\r
-class ItemActions extends BaseActions\r
-{\r
- /**\r
- * ItemActions::$currentItem\r
- * item currently being handled (mysql result object, see Blog::showUsingQuery)\r
- */\r
- public $currentItem;\r
- \r
- /**\r
- * ItemActions::$linkparams\r
- * contains an assoc array with parameters that need to be included when\r
- * generating links to items/archives/... (e.g. catid)\r
- */\r
- public $linkparams;\r
- \r
- /**\r
- * ItemActions::$allowEditAll\r
- * true when the current user is a blog admin (and thus allowed to edit all items) \r
- */\r
- private $allowEditAll;\r
- \r
- /**\r
- * ItemActions::$lastVisit\r
- * timestamp of last visit\r
- */\r
- private $lastVisit;\r
- \r
- /**\r
- * ItemActions::$blog\r
- * reference to the blog currently being displayed\r
- */\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * This class is used to parse item templates
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: ITEMACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
+ */
+class ItemActions extends BaseActions
+{
+ /**
+ * ItemActions::$currentItem
+ * item currently being handled (mysql result object, see Blog::showUsingQuery)
+ */
+ public $currentItem;
+
+ /**
+ * ItemActions::$linkparams
+ * contains an assoc array with parameters that need to be included when
+ * generating links to items/archives/... (e.g. catid)
+ */
+ public $linkparams;
+
+ /**
+ * ItemActions::$allowEditAll
+ * true when the current user is a blog admin (and thus allowed to edit all items)
+ */
+ private $allowEditAll;
+
+ /**
+ * ItemActions::$lastVisit
+ * timestamp of last visit
+ */
+ private $lastVisit;
+
+ /**
+ * ItemActions::$blog
+ * reference to the blog currently being displayed
+ */
public $blog;
- \r
- /**\r
- * ItemActions::$template\r
- * associative array with template info (part name => contents)\r
- */\r
- private $template;\r
- \r
- /**\r
- * ItemActions::$showComments\r
- * true when comments need to be displayed\r
- */\r
- private $showComments;\r
- \r
- /**\r
- * ItemActions::$defined_actions\r
- * defined actions in this class\r
- */\r
- static private $defined_actions = array(\r
+
+ /**
+ * ItemActions::$template
+ * associative array with template info (part name => contents)
+ */
+ private $template;
+
+ /**
+ * ItemActions::$showComments
+ * true when comments need to be displayed
+ */
+ private $showComments;
+
+ /**
+ * ItemActions::$defined_actions
+ * defined actions in this class
+ */
+ static private $defined_actions = array(
'author',
'authorid',
'authorlink',
- 'blogid',\r
+ 'blogid',
'blogurl',
- 'body',\r
- 'category',\r
- 'categorylink',\r
- 'catid',\r
+ 'body',
+ 'category',
+ 'categorylink',
+ 'catid',
'closed',
'comments',
- 'date',\r
+ 'date',
'daylink',
'edit',
'editlink',
'editpopupcode',
'itemid',
- 'itemlink',\r
+ 'itemlink',
'karma',
'karmaneglink',
- 'karmaposlink',\r
+ 'karmaposlink',
'more',
'morelink',
- 'new',\r
+ 'new',
'plugin',
'query',
'relevance',
- 'smartbody',\r
- 'syndicate_description',\r
- 'syndicate_title',\r
- 'time',\r
- 'title',\r
- /* actions defined in BodyAction class */\r
- 'image',\r
- 'media',\r
- 'popup'\r
- );\r
- \r
- /**\r
- * ItemActions::__construct\r
- * Enter description here ...\r
- * @param unknown_type $blog\r
- */\r
- public function __construct(&$blog)\r
- {\r
- global $catid, $member;\r
- \r
- // call constructor of superclass first\r
+ 'smartbody',
+ 'syndicate_description',
+ 'syndicate_title',
+ 'time',
+ 'title',
+ /* actions defined in BodyAction class */
+ 'image',
+ 'media',
+ 'popup'
+ );
+
+ /**
+ * ItemActions::__construct
+ * Enter description here ...
+ * @param unknown_type $blog
+ */
+ public function __construct(&$blog)
+ {
+ global $catid, $member;
+
+ // call constructor of superclass first
parent::__construct();
- \r
- // extra parameters for created links\r
- if ( $catid )\r
- {\r
- $this->linkparams = array('catid' => $catid);\r
- }\r
- \r
- // check if member is blog admin (and thus allowed to edit all items)\r
- $this->allowEditAll = ($member->isLoggedIn() && $member->blogAdminRights($blog->getID()));\r
- $this->setBlog($blog);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::getAvailableActions()\r
- * Returns an array with the actions that are defined\r
- * in the ItemActions class\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function getAvailableActions()\r
- {\r
- return array_merge(self::$defined_actions, parent::getAvailableActions());\r
- }\r
- \r
- /**\r
- * ItemActions::setLastVisit()\r
- * \r
- * @param timestamp $lastVisit timestamp of latest visit\r
- * @return void\r
- */\r
- public function setLastVisit($lastVisit)\r
- {\r
- $this->lastVisit = $lastVisit;\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::setCurrentItem()\r
- * \r
- * @param object $item instance of Item class\r
- * @return void\r
- */\r
- public function setCurrentItem(&$item)\r
- {\r
- global $currentitemid;\r
- $this->currentItem =& $item;\r
- $currentitemid = $this->currentItem['itemid'];\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::setBlog()\r
- * \r
- * @param object &$blog instance of Blog class\r
- * @return void\r
- */\r
- public function setBlog(&$blog)\r
- {\r
- $this->blog =& $blog;\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::setTemplate()\r
- * \r
- * @param array $template array including templates\r
- * @return void\r
- */\r
- public function setTemplate($template)\r
- {\r
- $this->template =& $template;\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::setShowComments()\r
- * \r
- * @param boolean $val need to be displayed or not\r
- * @return void\r
- */\r
- public function setShowComments($val)\r
- {\r
- $this->showComments = (boolean) $val;\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_blogid()\r
- * Parse templatevar blogid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_blogid()\r
- {\r
- echo $this->blog->getID();\r
- }\r
-\r
- /**\r
- * ItemActions::parse_body()\r
- * Parse templatevar body\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_body()\r
- {\r
- $this->highlightAndParse($this->currentItem['body']);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_more()\r
- * Parse templatevar more\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_more()\r
- {\r
- $this->highlightAndParse($this->currentItem['more']);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_itemid()\r
- * Parse templatevar itemid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_itemid()\r
- {\r
- echo $this->currentItem['itemid'];\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_category()\r
- * Parse templatevar category\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_category()\r
- {\r
- echo $this->currentItem['category'];\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_categorylink()\r
- * Parse templatevar categorylink\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_categorylink()\r
- {\r
- echo Link::create_link('category', array('catid' => $this->currentItem['catid'], 'name' => $this->currentItem['category']));\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_catid()\r
- * Parse templatevar catid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_catid()\r
- {\r
- echo $this->currentItem['catid'];\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_authorid()\r
- * Parse templatevar authorid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_authorid()\r
- {\r
- echo $this->currentItem['authorid'];\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_authorlink()\r
- * Parse templatevar authorlink\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_authorlink()\r
- {\r
- $data = array(\r
- 'memberid' => $this->currentItem['authorid'],\r
- 'name' => $this->currentItem['author'],\r
- 'extra' => $this->linkparams\r
- );\r
- \r
- echo Link::create_link('member', $data);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_query()\r
- * Parse templatevar query\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_query()\r
- {\r
- echo $this->strHighlight;\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_itemlink()\r
- * Parse templatevar itemlink\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_itemlink()\r
- {\r
- $data = array(\r
- 'itemid' => $this->currentItem['itemid'],\r
- 'title' => $this->currentItem['title'],\r
- 'timestamp' => $this->currentItem['timestamp'],\r
- 'extra' => $this->linkparams\r
- );\r
- \r
- echo Link::create_link('item', $data);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_blogurl()\r
- * Parse templatevar blogurl\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_blogurl()\r
- {\r
- echo $this->blog->getURL();\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_closed()\r
- * Parse templatevar closed\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_closed()\r
- {\r
- echo $this->currentItem['closed'];\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_relevance()\r
- * Parse templatevar relevance\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_relevance()\r
- {\r
- echo round($this->currentItem['score'], 2);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_title()\r
- * Parse templatevar title\r
- *\r
- * @param string $format defines in which format the title is shown\r
- * @return void\r
- */\r
- public function parse_title($format = '')\r
- {\r
- if ( is_array($this->currentItem) )\r
- {\r
- $itemtitle = $this->currentItem['title'];\r
- }\r
- switch ( $format )\r
- {\r
- case 'xml':\r
- echo Entity::hen($itemtitle);\r
- break;\r
- case 'attribute':\r
- echo Entity::hsc($itemtitle);\r
- break;\r
- case 'raw':\r
- echo $itemtitle;\r
- break;\r
- default:\r
- $this->highlightAndParse($itemtitle);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_karma()\r
- * Parse templatevar karma\r
- * \r
- * @param string $type type of data for karma\r
- * @return void\r
- */\r
- public function parse_karma($type = 'totalscore')\r
- {\r
- global $manager;\r
- \r
- // get karma object\r
- $karma =& $manager->getKarma($this->currentItem['itemid']);\r
- \r
- switch ( $type )\r
- {\r
- case 'pos':\r
- echo $karma->getNbPosVotes();\r
- break;\r
- case 'neg':\r
- echo $karma->getNbNegVotes();\r
- break;\r
- case 'votes':\r
- echo $karma->getNbOfVotes();\r
- break;\r
- case 'posp':\r
- $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbPosVotes() / $karma->getNbOfVotes()) : 50;\r
- echo number_format($percentage,2), '%';\r
- break;\r
- case 'negp':\r
- $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbNegVotes() / $karma->getNbOfVotes()) : 50;\r
- echo number_format($percentage,2), '%';\r
- break;\r
- case 'totalscore':\r
- default:\r
- echo $karma->getTotalScore();\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_author()\r
- * Parse templatevar author\r
- * \r
- * @param string $which key of data for author\r
- * @return void\r
- */\r
- public function parse_author($which = '')\r
- {\r
- switch ( $which )\r
- {\r
- case 'realname':\r
- echo $this->currentItem['authorname'];\r
- break;\r
- case 'id':\r
- echo $this->currentItem['authorid'];\r
- break;\r
- case 'email':\r
- echo $this->currentItem['authormail'];\r
- break;\r
- case 'url':\r
- echo $this->currentItem['authorurl'];\r
- break;\r
- case 'name':\r
- default:\r
- echo $this->currentItem['author'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_smartbody()\r
- * Parse templatevar smartbody\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_smartbody()\r
- {\r
- if ( !$this->currentItem['more'] )\r
- {\r
- $this->highlightAndParse($this->currentItem['body']);\r
- }\r
- else\r
- {\r
- $this->highlightAndParse($this->currentItem['more']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_morelink()\r
- * Parse templatevar morelink\r
- */\r
- public function parse_morelink()\r
- {\r
- if ( $this->currentItem['more'] )\r
- {\r
- $this->parser->parse($this->template['MORELINK']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_date()\r
- * Parse templatevar date\r
- *\r
- * @param string $format format optional strftime format\r
- * @return void\r
- */\r
- public function parse_date($format = '')\r
- {\r
- if ( $format !== '' )\r
- {\r
- /* do nothing */\r
- ;\r
- }\r
- else if ( !array_key_exists('FORMAT_DATE', $this->template) || $this->template['FORMAT_DATE'] === '' )\r
- {\r
- /* depends on the PHP's current locale */\r
- $format = '%X';\r
- }\r
- else\r
- {\r
- $format = $this->template['FORMAT_DATE'];\r
- }\r
- \r
- $offset = 0;\r
- if ( $this->blog )\r
- {\r
- $offset = $this->blog->getTimeOffset() * 3600;\r
- }\r
- \r
- echo i18n::formatted_datetime($format, $this->currentItem['timestamp'], $offset);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_time()\r
- * Parse templatevar time\r
- *\r
- * @param string $format format optional strftime format\r
- * @return void\r
- */\r
- public function parse_time($format = '')\r
- {\r
- if ( $format !== '' )\r
- {\r
- /* do nothing */\r
- ;\r
- }\r
- else if ( !array_key_exists('FORMAT_TIME', $this->template) || $this->template['FORMAT_TIME'] === '' )\r
- {\r
- /* depends on the PHP's current locale */\r
- $format = '%x';\r
- }\r
- else\r
- {\r
- $format = $this->template['FORMAT_TIME'];\r
- }\r
- echo i18n::formatted_datetime($format, $this->currentItem['timestamp']);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_syndicate_title()\r
- * Parse templatevar syndicate_title\r
- *\r
- * @param string $maxLength maxLength optional maximum length\r
- * @return string syndicated title\r
- */\r
- public function parse_syndicate_title($maxLength = 100) {\r
- $syndicated = strip_tags($this->currentItem['title']);\r
- echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
- }\r
- \r
- /**\r
- * ItemActions::parse_syndicate_description()\r
- * Parse templatevar syndicate_description\r
- *\r
- * @param stromg $maxLength maxlength optional maximum length\r
- * @param string $addHighlight highlighted string\r
- * @return void\r
- */\r
- public function parse_syndicate_description($maxLength = 250, $addHighlight = 0)\r
- {\r
- $syndicated = strip_tags($this->currentItem['body']);\r
- if ( $addHighlight )\r
- {\r
- $tmp_highlight = Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
- echo $this->highlightAndParse($tmp_highlight);\r
- }\r
- else\r
- {\r
- echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_karmaposlink()\r
- * Parse templatevar karmaposlink\r
- *\r
- * @param string $text text element for anchor element\r
- * @return void\r
- */\r
- public function parse_karmaposlink($text = '')\r
- {\r
- global $CONF;\r
- $link = $CONF['ActionURL'] . '?action=votepositive&itemid=' . $this->currentItem['itemid'];\r
- if ( !$text )\r
- {\r
- echo '<a href="'.$link.'">' . $text . '</a>';\r
- }\r
- else\r
- {\r
- echo $link;\r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_karmaneglink()\r
- * Parse templatevar karmaneglink\r
- *\r
- * @param string $text text element for anchor element\r
- * @return void\r
- */\r
- public function parse_karmaneglink($text = '')\r
- {\r
- global $CONF;\r
- $link = $CONF['ActionURL'] . '?action=votenegative&itemid='.$this->currentItem['itemid'];\r
- \r
- if ( !$text )\r
- {\r
- echo '<a href="'.$link.'">' . $text . '</a>';\r
- }\r
- else\r
- {\r
- echo $link;\r
- }\r
- \r
- return;\r
- }\r
-\r
- /**\r
- * ItemActions::parse_new()\r
- * Parse templatevar new\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_new()\r
- {\r
- if ( ($this->lastVisit != 0) && ($this->currentItem['timestamp'] > $this->lastVisit) )\r
- {\r
- echo $this->template['NEW'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_daylink()\r
- * Parse templatevar daylink\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_daylink()\r
- {\r
- echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem['timestamp']), $this->linkparams);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_comments(\r
- * Parse templatevar comments\r
- * \r
- * @param integer $maxToShow maximum number of comments in a display\r
- * @return void\r
- */\r
- public function parse_comments($maxToShow = 0)\r
- {\r
- if ( $maxToShow == 0 )\r
- {\r
- $maxToShow = $this->blog->getMaxComments();\r
- }\r
- \r
- // add comments\r
- if ( $this->showComments && $this->blog->commentsEnabled() )\r
- {\r
- $comments = new Comments($this->currentItem['itemid']);\r
- $comments->setItemActions($this);\r
- $comments->showComments($this->template, $maxToShow, $this->currentItem['closed'] ? 0 : 1, $this->strHighlight);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_plugin()\r
- * Executes a plugin templatevar\r
- *\r
- * @param string $pluginName name of plugin (without the NP_)\r
- * @param extra parameters can be added\r
- * @return void\r
- */\r
- public function parse_plugin($pluginName)\r
- {\r
- global $manager;\r
- \r
- $plugin =& $manager->getPlugin("NP_{$pluginName}");\r
- if ( !$plugin )\r
- {\r
- return;\r
- }\r
- \r
- // get arguments\r
- $params = func_get_args();\r
- \r
- // remove plugin name\r
- array_shift($params);\r
- \r
- // add item reference (array_unshift didn't work)\r
- $params = array_merge(array(&$this->currentItem),$params);\r
- \r
- call_user_func_array(array(&$plugin,'doTemplateVar'), $params);\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_edit()\r
- * Parse templatevar edit\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_edit()\r
- {\r
- global $member, $CONF;\r
- if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem['authorid'])) )\r
- {\r
- $this->parser->parse($this->template['EDITLINK']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_editlink()\r
- * Parse templatevar editlink\r
- */\r
- public function parse_editlink()\r
- {\r
- global $CONF;\r
- echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&itemid=' . $this->currentItem['itemid'];\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::parse_editpopupcode()\r
- * Parse templatevar editpopupcode\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_editpopupcode()\r
- {\r
- echo "if (event && event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=550,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";\r
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::highlightAndParse()\r
- * Parses highlighted text, with limited actions only (to prevent not fully trusted team members\r
- * from hacking your weblog.\r
- * 'plugin variables in items' implementation by Andy\r
- * \r
- * @param array $data \r
- * @return void\r
- */\r
- public function highlightAndParse(&$data)\r
- {\r
+
+ // extra parameters for created links
+ if ( $catid )
+ {
+ $this->linkparams = array('catid' => $catid);
+ }
+
+ // check if member is blog admin (and thus allowed to edit all items)
+ $this->allowEditAll = ($member->isLoggedIn() && $member->blogAdminRights($blog->getID()));
+ $this->setBlog($blog);
+ return;
+ }
+
+ /**
+ * ItemActions::getAvailableActions()
+ * Returns an array with the actions that are defined
+ * in the ItemActions class
+ *
+ * @param void
+ * @return void
+ */
+ public function getAvailableActions()
+ {
+ return array_merge(self::$defined_actions, parent::getAvailableActions());
+ }
+
+ /**
+ * ItemActions::setLastVisit()
+ *
+ * @param timestamp $lastVisit timestamp of latest visit
+ * @return void
+ */
+ public function setLastVisit($lastVisit)
+ {
+ $this->lastVisit = $lastVisit;
+ return;
+ }
+
+ /**
+ * ItemActions::setCurrentItem()
+ *
+ * @param object $item instance of Item class
+ * @return void
+ */
+ public function setCurrentItem(&$item)
+ {
+ global $currentitemid;
+ $this->currentItem =& $item;
+ $currentitemid = $this->currentItem['itemid'];
+ return;
+ }
+
+ /**
+ * ItemActions::setBlog()
+ *
+ * @param object &$blog instance of Blog class
+ * @return void
+ */
+ public function setBlog(&$blog)
+ {
+ $this->blog =& $blog;
+ return;
+ }
+
+ /**
+ * ItemActions::setTemplate()
+ *
+ * @param array $template array including templates
+ * @return void
+ */
+ public function setTemplate($template)
+ {
+ $this->template =& $template;
+ return;
+ }
+
+ /**
+ * ItemActions::setShowComments()
+ *
+ * @param boolean $val need to be displayed or not
+ * @return void
+ */
+ public function setShowComments($val)
+ {
+ $this->showComments = (boolean) $val;
+ return;
+ }
+
+ /**
+ * ItemActions::parse_blogid()
+ * Parse templatevar blogid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_blogid()
+ {
+ echo $this->blog->getID();
+ }
+
+ /**
+ * ItemActions::parse_body()
+ * Parse templatevar body
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_body()
+ {
+ $this->highlightAndParse($this->currentItem['body']);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_more()
+ * Parse templatevar more
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_more()
+ {
+ $this->highlightAndParse($this->currentItem['more']);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_itemid()
+ * Parse templatevar itemid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_itemid()
+ {
+ echo $this->currentItem['itemid'];
+ return;
+ }
+
+ /**
+ * ItemActions::parse_category()
+ * Parse templatevar category
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_category()
+ {
+ echo $this->currentItem['category'];
+ return;
+ }
+
+ /**
+ * ItemActions::parse_categorylink()
+ * Parse templatevar categorylink
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_categorylink()
+ {
+ echo Link::create_link('category', array('catid' => $this->currentItem['catid'], 'name' => $this->currentItem['category']));
+ return;
+ }
+
+ /**
+ * ItemActions::parse_catid()
+ * Parse templatevar catid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_catid()
+ {
+ echo $this->currentItem['catid'];
+ return;
+ }
+
+ /**
+ * ItemActions::parse_authorid()
+ * Parse templatevar authorid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_authorid()
+ {
+ echo $this->currentItem['authorid'];
+ return;
+ }
+
+ /**
+ * ItemActions::parse_authorlink()
+ * Parse templatevar authorlink
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_authorlink()
+ {
+ $data = array(
+ 'memberid' => $this->currentItem['authorid'],
+ 'name' => $this->currentItem['author'],
+ 'extra' => $this->linkparams
+ );
+
+ echo Link::create_link('member', $data);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_query()
+ * Parse templatevar query
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_query()
+ {
+ echo $this->strHighlight;
+ return;
+ }
+
+ /**
+ * ItemActions::parse_itemlink()
+ * Parse templatevar itemlink
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_itemlink()
+ {
+ $data = array(
+ 'itemid' => $this->currentItem['itemid'],
+ 'title' => $this->currentItem['title'],
+ 'timestamp' => $this->currentItem['timestamp'],
+ 'extra' => $this->linkparams
+ );
+
+ echo Link::create_link('item', $data);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_blogurl()
+ * Parse templatevar blogurl
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_blogurl()
+ {
+ echo $this->blog->getURL();
+ return;
+ }
+
+ /**
+ * ItemActions::parse_closed()
+ * Parse templatevar closed
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_closed()
+ {
+ echo $this->currentItem['closed'];
+ return;
+ }
+
+ /**
+ * ItemActions::parse_relevance()
+ * Parse templatevar relevance
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_relevance()
+ {
+ echo round($this->currentItem['score'], 2);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_title()
+ * Parse templatevar title
+ *
+ * @param string $format defines in which format the title is shown
+ * @return void
+ */
+ public function parse_title($format = '')
+ {
+ if ( is_array($this->currentItem) )
+ {
+ $itemtitle = $this->currentItem['title'];
+ }
+ switch ( $format )
+ {
+ case 'xml':
+ echo Entity::hen($itemtitle);
+ break;
+ case 'attribute':
+ echo Entity::hsc($itemtitle);
+ break;
+ case 'raw':
+ echo $itemtitle;
+ break;
+ default:
+ $this->highlightAndParse($itemtitle);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_karma()
+ * Parse templatevar karma
+ *
+ * @param string $type type of data for karma
+ * @return void
+ */
+ public function parse_karma($type = 'totalscore')
+ {
+ global $manager;
+
+ // get karma object
+ $karma =& $manager->getKarma($this->currentItem['itemid']);
+
+ switch ( $type )
+ {
+ case 'pos':
+ echo $karma->getNbPosVotes();
+ break;
+ case 'neg':
+ echo $karma->getNbNegVotes();
+ break;
+ case 'votes':
+ echo $karma->getNbOfVotes();
+ break;
+ case 'posp':
+ $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbPosVotes() / $karma->getNbOfVotes()) : 50;
+ echo number_format($percentage,2), '%';
+ break;
+ case 'negp':
+ $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbNegVotes() / $karma->getNbOfVotes()) : 50;
+ echo number_format($percentage,2), '%';
+ break;
+ case 'totalscore':
+ default:
+ echo $karma->getTotalScore();
+ break;
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_author()
+ * Parse templatevar author
+ *
+ * @param string $which key of data for author
+ * @return void
+ */
+ public function parse_author($which = '')
+ {
+ switch ( $which )
+ {
+ case 'realname':
+ echo $this->currentItem['authorname'];
+ break;
+ case 'id':
+ echo $this->currentItem['authorid'];
+ break;
+ case 'email':
+ echo $this->currentItem['authormail'];
+ break;
+ case 'url':
+ echo $this->currentItem['authorurl'];
+ break;
+ case 'name':
+ default:
+ echo $this->currentItem['author'];
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_smartbody()
+ * Parse templatevar smartbody
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_smartbody()
+ {
+ if ( !$this->currentItem['more'] )
+ {
+ $this->highlightAndParse($this->currentItem['body']);
+ }
+ else
+ {
+ $this->highlightAndParse($this->currentItem['more']);
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_morelink()
+ * Parse templatevar morelink
+ */
+ public function parse_morelink()
+ {
+ if ( $this->currentItem['more'] )
+ {
+ $this->parser->parse($this->template['MORELINK']);
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_date()
+ * Parse templatevar date
+ *
+ * @param string $format format optional strftime format
+ * @return void
+ */
+ public function parse_date($format = '')
+ {
+ if ( $format !== '' )
+ {
+ /* do nothing */
+ ;
+ }
+ else if ( !array_key_exists('FORMAT_DATE', $this->template) || $this->template['FORMAT_DATE'] === '' )
+ {
+ /* depends on the PHP's current locale */
+ $format = '%X';
+ }
+ else
+ {
+ $format = $this->template['FORMAT_DATE'];
+ }
+
+ $offset = 0;
+ if ( $this->blog )
+ {
+ $offset = $this->blog->getTimeOffset() * 3600;
+ }
+
+ echo i18n::formatted_datetime($format, $this->currentItem['timestamp'], $offset);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_time()
+ * Parse templatevar time
+ *
+ * @param string $format format optional strftime format
+ * @return void
+ */
+ public function parse_time($format = '')
+ {
+ if ( $format !== '' )
+ {
+ /* do nothing */
+ ;
+ }
+ else if ( !array_key_exists('FORMAT_TIME', $this->template) || $this->template['FORMAT_TIME'] === '' )
+ {
+ /* depends on the PHP's current locale */
+ $format = '%x';
+ }
+ else
+ {
+ $format = $this->template['FORMAT_TIME'];
+ }
+ echo i18n::formatted_datetime($format, $this->currentItem['timestamp']);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_syndicate_title()
+ * Parse templatevar syndicate_title
+ *
+ * @param string $maxLength maxLength optional maximum length
+ * @return string syndicated title
+ */
+ public function parse_syndicate_title($maxLength = 100) {
+ $syndicated = strip_tags($this->currentItem['title']);
+ echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));
+ }
+
+ /**
+ * ItemActions::parse_syndicate_description()
+ * Parse templatevar syndicate_description
+ *
+ * @param stromg $maxLength maxlength optional maximum length
+ * @param string $addHighlight highlighted string
+ * @return void
+ */
+ public function parse_syndicate_description($maxLength = 250, $addHighlight = 0)
+ {
+ $syndicated = strip_tags($this->currentItem['body']);
+ if ( $addHighlight )
+ {
+ $tmp_highlight = Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));
+ echo $this->highlightAndParse($tmp_highlight);
+ }
+ else
+ {
+ echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_karmaposlink()
+ * Parse templatevar karmaposlink
+ *
+ * @param string $text text element for anchor element
+ * @return void
+ */
+ public function parse_karmaposlink($text = '')
+ {
+ global $CONF;
+ $link = $CONF['ActionURL'] . '?action=votepositive&itemid=' . $this->currentItem['itemid'];
+ if ( !$text )
+ {
+ echo '<a href="'.$link.'">' . $text . '</a>';
+ }
+ else
+ {
+ echo $link;
+ }
+
+ return;
+ }
+
+ /**
+ * ItemActions::parse_karmaneglink()
+ * Parse templatevar karmaneglink
+ *
+ * @param string $text text element for anchor element
+ * @return void
+ */
+ public function parse_karmaneglink($text = '')
+ {
+ global $CONF;
+ $link = $CONF['ActionURL'] . '?action=votenegative&itemid='.$this->currentItem['itemid'];
+
+ if ( !$text )
+ {
+ echo '<a href="'.$link.'">' . $text . '</a>';
+ }
+ else
+ {
+ echo $link;
+ }
+
+ return;
+ }
+
+ /**
+ * ItemActions::parse_new()
+ * Parse templatevar new
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_new()
+ {
+ if ( ($this->lastVisit != 0) && ($this->currentItem['timestamp'] > $this->lastVisit) )
+ {
+ echo $this->template['NEW'];
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_daylink()
+ * Parse templatevar daylink
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_daylink()
+ {
+ echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem['timestamp']), $this->linkparams);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_comments(
+ * Parse templatevar comments
+ *
+ * @param integer $maxToShow maximum number of comments in a display
+ * @return void
+ */
+ public function parse_comments($maxToShow = 0)
+ {
+ if ( $maxToShow == 0 )
+ {
+ $maxToShow = $this->blog->getMaxComments();
+ }
+
+ // add comments
+ if ( $this->showComments && $this->blog->commentsEnabled() )
+ {
+ $comments = new Comments($this->currentItem['itemid']);
+ $comments->setItemActions($this);
+ $comments->showComments($this->template, $maxToShow, $this->currentItem['closed'] ? 0 : 1, $this->strHighlight);
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_plugin()
+ * Executes a plugin templatevar
+ *
+ * @param string $pluginName name of plugin (without the NP_)
+ * @param extra parameters can be added
+ * @return void
+ */
+ public function parse_plugin($pluginName)
+ {
+ global $manager;
+
+ $plugin =& $manager->getPlugin("NP_{$pluginName}");
+ if ( !$plugin )
+ {
+ return;
+ }
+
+ // get arguments
+ $params = func_get_args();
+
+ // remove plugin name
+ array_shift($params);
+
+ // add item reference (array_unshift didn't work)
+ $params = array_merge(array(&$this->currentItem),$params);
+
+ call_user_func_array(array(&$plugin,'doTemplateVar'), $params);
+ return;
+ }
+
+ /**
+ * ItemActions::parse_edit()
+ * Parse templatevar edit
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_edit()
+ {
+ global $member, $CONF;
+ if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem['authorid'])) )
+ {
+ $this->parser->parse($this->template['EDITLINK']);
+ }
+ return;
+ }
+
+ /**
+ * ItemActions::parse_editlink()
+ * Parse templatevar editlink
+ */
+ public function parse_editlink()
+ {
+ global $CONF;
+ echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&itemid=' . $this->currentItem['itemid'];
+ return;
+ }
+
+ /**
+ * ItemActions::parse_editpopupcode()
+ * Parse templatevar editpopupcode
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_editpopupcode()
+ {
+ echo "if (event && event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=550,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";
+ return;
+ }
+
+ /**
+ * ItemActions::highlightAndParse()
+ * Parses highlighted text, with limited actions only (to prevent not fully trusted team members
+ * from hacking your weblog.
+ * 'plugin variables in items' implementation by Andy
+ *
+ * @param array $data
+ * @return void
+ */
+ public function highlightAndParse(&$data)
+ {
$handler = new BodyActions($this->blog);
$handler->setTemplate($this->template);
$handler->setHighlight($this->strHighlight);
$handler->setCurrentItem($this->currentItem);
- \r
- $parser = new Parser($handler);\r
+
+ $parser = new Parser($handler);
$parser->parse($handler->highlight($data));
- return;\r
- }\r
- \r
- /**\r
- * ItemActions::checkCondition()\r
- * Checks conditions for if statements\r
- *\r
- * @param string $field type of <%if%>\r
- * @param string $name property of field\r
- * @param string $value value of property\r
- * @return boolean\r
- */\r
- protected function checkCondition($field, $name='', $value = '')\r
- {\r
- global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;\r
- \r
- $condition = 0;\r
- switch ( $field )\r
- {\r
- case 'category':\r
- $condition = ($blog && $this->ifCategory($name,$value));\r
- break;\r
- case 'itemcategory':\r
- $condition = ($this->ifItemCategory($name,$value));\r
- break;\r
- case 'blogsetting':\r
- $condition = ($blog && ($blog->getSetting($name) == $value));\r
- break;\r
- case 'itemblogsetting':\r
- $item =& $manager->getItem($this->currentItem['itemid'], 1, 1);\r
- $t_blog =& $manager->getBlog($item['blogid']);\r
- $condition = ($t_blog && ($t_blog->getSetting($name) == $value));\r
- break;\r
- case 'loggedin':\r
- $condition = $member->isLoggedIn();\r
- break;\r
- case 'onteam':\r
- $condition = $member->isLoggedIn() && $this->ifOnTeam($name);\r
- break;\r
- case 'admin':\r
- $condition = $member->isLoggedIn() && $this->ifAdmin($name);\r
- break;\r
- case 'author':\r
- $condition = ($this->ifAuthor($name,$value));\r
- break;\r
- case 'hasplugin':\r
- $condition = $this->ifHasPlugin($name, $value);\r
- break;\r
- default:\r
- $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);\r
- break;\r
- }\r
- return $condition;\r
- } \r
- \r
- /**\r
- * ItemActions::ifCategory()\r
- * Different checks for a category\r
- * \r
- * @param string $key key of category\r
- * @param string $value value for key of category\r
- * @return boolean\r
- */\r
- private function ifCategory($key = '', $value = '')\r
- {\r
- global $blog, $catid;\r
- \r
- // when no parameter is defined, just check if a category is selected\r
- if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
- {\r
- return (boolean) $blog->isValidCategory($catid);\r
- }\r
- \r
- // check category name\r
- if ( $key == 'catname' )\r
- {\r
- $value = $blog->getCategoryIdFromName($value);\r
- if ( $value == $catid )\r
- {\r
- return (boolean) $blog->isValidCategory($catid);\r
- }\r
- }\r
- \r
- // check category id\r
- if ( ($key == 'catid') && ($value == $catid) )\r
- {\r
- return (boolean) $blog->isValidCategory($catid);\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
- * ItemActions::ifAuthor()\r
- * Different checks for an author\r
- * \r
- * @param string $key key of data for author\r
- * @param string $value value of data for author\r
- * @return boolean correct or not\r
- */\r
- private function ifAuthor($key = '', $value = '')\r
- {\r
- global $member, $manager;\r
- \r
- // when no parameter is defined, just check if author is current visitor\r
- if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )\r
- {\r
- return (boolean) ((integer) $member->getID() > 0 && (integer) $member->getID() == (integer) $this->currentItem['authorid']);\r
- }\r
- \r
- // check author name\r
- if ( $key == 'name' )\r
- {\r
- $value = strtolower($value);\r
- if ( $value == strtolower($this->currentItem['author']) )\r
- {\r
- return TRUE;\r
- }\r
- }\r
- \r
- // check if author is admin\r
- if ( ($key == 'isadmin') )\r
- {\r
- $i_author =& $manager->getMember($this->currentItem['authorid']);\r
- if ( $i_author->isAdmin() )\r
- {\r
- return TRUE;\r
- }\r
- return (boolean) $i_author->isBlogAdmin($this->currentItem['blogid']);\r
- }\r
- \r
- return FALSE;\r
- }\r
- \r
- /**\r
- * ItemActions::ifItemCategory()\r
- * Different checks for a category\r
- * \r
- * @param string $key key of data for category to which item belongs\r
- * @param string $value value of data for category to which item belongs\r
- * @return boolean correct or not\r
- */\r
- private function ifItemCategory($key = '', $value='')\r
- {\r
- global $catid, $manager;\r
- \r
- $blog =& $manager->getBlog($this->currentItem['blogid']);\r
- \r
- // when no parameter is defined, just check if a category is selected\r
- if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
- {\r
- return (boolean) $blog->isValidCategory($catid);\r
- }\r
- \r
- $icatid = $this->currentItem['catid'];\r
- \r
- // check category name\r
- if ( $key == 'catname' )\r
- {\r
- $value = $blog->getCategoryIdFromName($value);\r
- if ( $value == $icatid )\r
- {\r
- return (boolean) $blog->isValidCategory($icatid);\r
- }\r
- }\r
- \r
- // check category id\r
- if ( ($key == 'catid') && ($value == $icatid) )\r
- {\r
- return (boolean) $blog->isValidCategory($icatid);\r
- }\r
- return FALSE;\r
- }\r
-\r
- \r
- /**\r
- * ItemActions::ifOnTeam()\r
- * Checks if a member is on the team of a blog and return his rights\r
- * \r
- * @param string $blogName name of weblog\r
- * @return boolean correct or not\r
- */\r
- private function ifOnTeam($blogName = '')\r
- {\r
- global $blog, $member, $manager;\r
- \r
- // when no blog found\r
- if ( ($blogName == '') && (!is_object($blog)) )\r
- {\r
- return 0;\r
- }\r
- \r
- // explicit blog selection\r
- if ( $blogName != '' )\r
- {\r
- $blogid = getBlogIDFromName($blogName);\r
- }\r
- \r
- // use current blog\r
- if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
- {\r
- $blogid = $blog->getID();\r
- }\r
- return (boolean) $member->teamRights($blogid);\r
- }\r
- \r
- /**\r
- * ItemActions::ifAdmin()\r
- * Checks if a member is admin of a blog\r
- * \r
- * @param string $blogName name of weblog\r
- * @return boolean correct or not\r
- */\r
- private function ifAdmin($blogName = '')\r
- {\r
- global $blog, $member, $manager;\r
- \r
- // when no blog found\r
- if ( ($blogName == '') && (!is_object($blog)) )\r
- {\r
- return 0;\r
- }\r
- \r
- // explicit blog selection\r
- if ( $blogName != '' )\r
- {\r
- $blogid = getBlogIDFromName($blogName);\r
- }\r
- \r
- // use current blog\r
- if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
- {\r
- $blogid = $blog->getID();\r
- }\r
- return (boolean) $member->isBlogAdmin($blogid);\r
- }\r
- \r
- \r
- /**\r
- * ItemActions::ifHasPlugin()\r
- * hasplugin,PlugName\r
- * -> checks if plugin exists\r
- * hasplugin,PlugName,OptionName\r
- * -> checks if the option OptionName from plugin PlugName is not set to 'no'\r
- * hasplugin,PlugName,OptionName=value\r
- * -> checks if the option OptionName from plugin PlugName is set to value\r
- *\r
- * @param string $name name of plugin\r
- * @param string $value key (and value) of plugin option\r
- * @return boolean correct or not\r
- */\r
- private function ifHasPlugin($name, $value)\r
- {\r
- global $manager;\r
- $condition = FALSE;\r
- // (pluginInstalled method won't write a message in the actionlog on failure)\r
- if ( $manager->pluginInstalled("NP_{$name}"))\r
- {\r
- $plugin =& $manager->getPlugin('NP_' . $name);\r
- if ( $plugin != NULL )\r
- {\r
- if ( $value == "" )\r
- {\r
- $condition = TRUE;\r
- }\r
- else\r
- {\r
- list($name2, $value2) = preg_split('#=#', $value, 2);\r
- if ( $value2 == "" && $plugin->getOption($name2) != 'no' )\r
- {\r
- $condition = TRUE;\r
- }\r
- else if ( $plugin->getOption($name2) == $value2 )\r
- {\r
- $condition = TRUE;\r
- }\r
- }\r
- }\r
- }\r
- return (boolean) $condition;\r
- }\r
- \r
- /**\r
- * ItemActions::ifPlugin()\r
- * Checks if a plugin exists and call its doIf function\r
- * \r
- * @param string $name name of plugin\r
- * @param string $key key of plugin option\r
- * @param string $value value of plugin option\r
- * @return boolean callback output from plugin\r
- */\r
- private function ifPlugin($name, $key = '', $value = '')\r
- {\r
- global $manager;\r
- \r
- $plugin =& $manager->getPlugin("NP_{$name}");\r
- if ( !$plugin )\r
- {\r
- return;\r
- }\r
- $params = func_get_args();\r
- array_shift($params);\r
- \r
- return (boolean) call_user_func_array(array(&$plugin, 'doIf'), $params);\r
- }\r
-}
\ No newline at end of file
+ return;
+ }
+
+ /**
+ * ItemActions::checkCondition()
+ * Checks conditions for if statements
+ *
+ * @param string $field type of <%if%>
+ * @param string $name property of field
+ * @param string $value value of property
+ * @return boolean
+ */
+ protected function checkCondition($field, $name='', $value = '')
+ {
+ global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
+
+ $condition = 0;
+ switch ( $field )
+ {
+ case 'category':
+ $condition = ($blog && $this->ifCategory($name,$value));
+ break;
+ case 'itemcategory':
+ $condition = ($this->ifItemCategory($name,$value));
+ break;
+ case 'blogsetting':
+ $condition = ($blog && ($blog->getSetting($name) == $value));
+ break;
+ case 'itemblogsetting':
+ $item =& $manager->getItem($this->currentItem['itemid'], 1, 1);
+ $t_blog =& $manager->getBlog($item['blogid']);
+ $condition = ($t_blog && ($t_blog->getSetting($name) == $value));
+ break;
+ case 'loggedin':
+ $condition = $member->isLoggedIn();
+ break;
+ case 'onteam':
+ $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
+ break;
+ case 'admin':
+ $condition = $member->isLoggedIn() && $this->ifAdmin($name);
+ break;
+ case 'author':
+ $condition = ($this->ifAuthor($name,$value));
+ break;
+ case 'hasplugin':
+ $condition = $this->ifHasPlugin($name, $value);
+ break;
+ default:
+ $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);
+ break;
+ }
+ return $condition;
+ }
+
+ /**
+ * ItemActions::ifCategory()
+ * Different checks for a category
+ *
+ * @param string $key key of category
+ * @param string $value value for key of category
+ * @return boolean
+ */
+ private function ifCategory($key = '', $value = '')
+ {
+ global $blog, $catid;
+
+ // when no parameter is defined, just check if a category is selected
+ if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+ {
+ return (boolean) $blog->isValidCategory($catid);
+ }
+
+ // check category name
+ if ( $key == 'catname' )
+ {
+ $value = $blog->getCategoryIdFromName($value);
+ if ( $value == $catid )
+ {
+ return (boolean) $blog->isValidCategory($catid);
+ }
+ }
+
+ // check category id
+ if ( ($key == 'catid') && ($value == $catid) )
+ {
+ return (boolean) $blog->isValidCategory($catid);
+ }
+ return FALSE;
+ }
+
+ /**
+ * ItemActions::ifAuthor()
+ * Different checks for an author
+ *
+ * @param string $key key of data for author
+ * @param string $value value of data for author
+ * @return boolean correct or not
+ */
+ private function ifAuthor($key = '', $value = '')
+ {
+ global $member, $manager;
+
+ // when no parameter is defined, just check if author is current visitor
+ if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )
+ {
+ return (boolean) ((integer) $member->getID() > 0 && (integer) $member->getID() == (integer) $this->currentItem['authorid']);
+ }
+
+ // check author name
+ if ( $key == 'name' )
+ {
+ $value = strtolower($value);
+ if ( $value == strtolower($this->currentItem['author']) )
+ {
+ return TRUE;
+ }
+ }
+
+ // check if author is admin
+ if ( ($key == 'isadmin') )
+ {
+ $i_author =& $manager->getMember($this->currentItem['authorid']);
+ if ( $i_author->isAdmin() )
+ {
+ return TRUE;
+ }
+ return (boolean) $i_author->isBlogAdmin($this->currentItem['blogid']);
+ }
+
+ return FALSE;
+ }
+
+ /**
+ * ItemActions::ifItemCategory()
+ * Different checks for a category
+ *
+ * @param string $key key of data for category to which item belongs
+ * @param string $value value of data for category to which item belongs
+ * @return boolean correct or not
+ */
+ private function ifItemCategory($key = '', $value='')
+ {
+ global $catid, $manager;
+
+ $blog =& $manager->getBlog($this->currentItem['blogid']);
+
+ // when no parameter is defined, just check if a category is selected
+ if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+ {
+ return (boolean) $blog->isValidCategory($catid);
+ }
+
+ $icatid = $this->currentItem['catid'];
+
+ // check category name
+ if ( $key == 'catname' )
+ {
+ $value = $blog->getCategoryIdFromName($value);
+ if ( $value == $icatid )
+ {
+ return (boolean) $blog->isValidCategory($icatid);
+ }
+ }
+
+ // check category id
+ if ( ($key == 'catid') && ($value == $icatid) )
+ {
+ return (boolean) $blog->isValidCategory($icatid);
+ }
+ return FALSE;
+ }
+
+
+ /**
+ * ItemActions::ifOnTeam()
+ * Checks if a member is on the team of a blog and return his rights
+ *
+ * @param string $blogName name of weblog
+ * @return boolean correct or not
+ */
+ private function ifOnTeam($blogName = '')
+ {
+ global $blog, $member, $manager;
+
+ // when no blog found
+ if ( ($blogName == '') && (!is_object($blog)) )
+ {
+ return 0;
+ }
+
+ // explicit blog selection
+ if ( $blogName != '' )
+ {
+ $blogid = getBlogIDFromName($blogName);
+ }
+
+ // use current blog
+ if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+ {
+ $blogid = $blog->getID();
+ }
+ return (boolean) $member->teamRights($blogid);
+ }
+
+ /**
+ * ItemActions::ifAdmin()
+ * Checks if a member is admin of a blog
+ *
+ * @param string $blogName name of weblog
+ * @return boolean correct or not
+ */
+ private function ifAdmin($blogName = '')
+ {
+ global $blog, $member, $manager;
+
+ // when no blog found
+ if ( ($blogName == '') && (!is_object($blog)) )
+ {
+ return 0;
+ }
+
+ // explicit blog selection
+ if ( $blogName != '' )
+ {
+ $blogid = getBlogIDFromName($blogName);
+ }
+
+ // use current blog
+ if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+ {
+ $blogid = $blog->getID();
+ }
+ return (boolean) $member->isBlogAdmin($blogid);
+ }
+
+
+ /**
+ * ItemActions::ifHasPlugin()
+ * hasplugin,PlugName
+ * -> checks if plugin exists
+ * hasplugin,PlugName,OptionName
+ * -> checks if the option OptionName from plugin PlugName is not set to 'no'
+ * hasplugin,PlugName,OptionName=value
+ * -> checks if the option OptionName from plugin PlugName is set to value
+ *
+ * @param string $name name of plugin
+ * @param string $value key (and value) of plugin option
+ * @return boolean correct or not
+ */
+ private function ifHasPlugin($name, $value)
+ {
+ global $manager;
+ $condition = FALSE;
+ // (pluginInstalled method won't write a message in the actionlog on failure)
+ if ( $manager->pluginInstalled("NP_{$name}"))
+ {
+ $plugin =& $manager->getPlugin('NP_' . $name);
+ if ( $plugin != NULL )
+ {
+ if ( $value == "" )
+ {
+ $condition = TRUE;
+ }
+ else
+ {
+ list($name2, $value2) = preg_split('#=#', $value, 2);
+ if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
+ {
+ $condition = TRUE;
+ }
+ else if ( $plugin->getOption($name2) == $value2 )
+ {
+ $condition = TRUE;
+ }
+ }
+ }
+ }
+ return (boolean) $condition;
+ }
+
+ /**
+ * ItemActions::ifPlugin()
+ * Checks if a plugin exists and call its doIf function
+ *
+ * @param string $name name of plugin
+ * @param string $key key of plugin option
+ * @param string $value value of plugin option
+ * @return boolean callback output from plugin
+ */
+ private function ifPlugin($name, $key = '', $value = '')
+ {
+ global $manager;
+
+ $plugin =& $manager->getPlugin("NP_{$name}");
+ if ( !$plugin )
+ {
+ return;
+ }
+ $params = func_get_args();
+ array_shift($params);
+
+ return (boolean) call_user_func_array(array(&$plugin, 'doIf'), $params);
+ }
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Class representing the karma votes for a certain item\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: KARMA.php 1470 2010-11-29 22:10:16Z ftruscot $\r
- */\r
-class Karma\r
-{\r
- // id of item about which this object contains information\r
- var $itemid;\r
- \r
- // indicates if the karma vote info has already been intialized from the DB\r
- var $inforead;\r
- \r
- // amount of positive/negative votes\r
- var $karmapos;\r
- var $karmaneg;\r
- \r
- function KARMA($itemid, $initpos = 0, $initneg = 0, $initread = 0) {\r
- // itemid\r
- $this->itemid = intval($itemid);\r
-\r
- // have we read the karma info yet?\r
- $this->inforead = intval($initread);\r
-\r
- // number of positive and negative votes\r
- $this->karmapos = intval($initpos);\r
- $this->karmaneg = intval($initneg);\r
- }\r
-\r
- function getNbPosVotes() {\r
- if (!$this->inforead) $this->readFromDatabase();\r
- return $this->karmapos;\r
- }\r
- function getNbNegVotes() {\r
- if (!$this->inforead) $this->readFromDatabase();\r
- return $this->karmaneg;\r
- }\r
- function getNbOfVotes() {\r
- if (!$this->inforead) $this->readFromDatabase();\r
- return ($this->karmapos + $this->karmaneg);\r
- }\r
- function getTotalScore() {\r
- if (!$this->inforead) $this->readFromDatabase();\r
- return ($this->karmapos - $this->karmaneg);\r
- }\r
-\r
- function setNbPosVotes($val) {\r
- $this->karmapos = intval($val);\r
- }\r
- function setNbNegVotes($val) {\r
- $this->karmaneg = intval($val);\r
- }\r
-\r
-\r
- // adds a positive vote\r
- function votePositive() {\r
- $newKarma = $this->getNbPosVotes() + 1;\r
- $this->setNbPosVotes($newKarma);\r
- $this->writeToDatabase();\r
- $this->saveIP();\r
- }\r
-\r
- // adds a negative vote\r
- function voteNegative() {\r
- $newKarma = $this->getNbNegVotes() + 1;\r
- $this->setNbNegVotes($newKarma);\r
- $this->writeToDatabase();\r
- $this->saveIP();\r
- }\r
-\r
-\r
-\r
- // these methods shouldn't be called directly\r
- function readFromDatabase() {\r
- $query = 'SELECT ikarmapos, ikarmaneg FROM '.sql_table('item').' WHERE inumber=' . $this->itemid;\r
- $res = DB::getRow($query);\r
-\r
- $this->karmapos = $res['ikarmapos'];\r
- $this->karmaneg = $res['ikarmaneg'];\r
- $this->inforead = 1;\r
- }\r
-\r
-\r
- function writeToDatabase() {\r
- $query = 'UPDATE '.sql_table('item').' SET ikarmapos=' . $this->karmapos . ', ikarmaneg='.$this->karmaneg.' WHERE inumber=' . $this->itemid;\r
- DB::execute($query);\r
- }\r
-\r
- // checks if a vote is still allowed for an IP\r
- function isVoteAllowed($ip) {\r
- $query = 'SELECT * FROM '.sql_table('karma')." WHERE itemid={$this->itemid} and ip=". DB::quoteValue($ip);\r
- $res = DB::getResult($query);\r
- return ($res->rowCount() == 0);\r
- }\r
-\r
- // save IP in database so no multiple votes are possible\r
- function saveIP() {\r
- $query = 'INSERT INTO ' . sql_table('karma') .' (itemid, ip) VALUES (' . $this->itemid . ','. DB::quoteValue(serverVar('REMOTE_ADDR')) .')';\r
- DB::execute($query);\r
- }\r
-}\r
-\r
-?>\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Class representing the karma votes for a certain item
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: KARMA.php 1812 2012-05-01 14:59:07Z sakamocchi $
+ */
+class Karma
+{
+ // id of item about which this object contains information
+ var $itemid;
+
+ // indicates if the karma vote info has already been intialized from the DB
+ var $inforead;
+
+ // amount of positive/negative votes
+ var $karmapos;
+ var $karmaneg;
+
+ function KARMA($itemid, $initpos = 0, $initneg = 0, $initread = 0) {
+ // itemid
+ $this->itemid = intval($itemid);
+
+ // have we read the karma info yet?
+ $this->inforead = intval($initread);
+
+ // number of positive and negative votes
+ $this->karmapos = intval($initpos);
+ $this->karmaneg = intval($initneg);
+ }
+
+ function getNbPosVotes() {
+ if (!$this->inforead) $this->readFromDatabase();
+ return $this->karmapos;
+ }
+ function getNbNegVotes() {
+ if (!$this->inforead) $this->readFromDatabase();
+ return $this->karmaneg;
+ }
+ function getNbOfVotes() {
+ if (!$this->inforead) $this->readFromDatabase();
+ return ($this->karmapos + $this->karmaneg);
+ }
+ function getTotalScore() {
+ if (!$this->inforead) $this->readFromDatabase();
+ return ($this->karmapos - $this->karmaneg);
+ }
+
+ function setNbPosVotes($val) {
+ $this->karmapos = intval($val);
+ }
+ function setNbNegVotes($val) {
+ $this->karmaneg = intval($val);
+ }
+
+
+ // adds a positive vote
+ function votePositive() {
+ $newKarma = $this->getNbPosVotes() + 1;
+ $this->setNbPosVotes($newKarma);
+ $this->writeToDatabase();
+ $this->saveIP();
+ }
+
+ // adds a negative vote
+ function voteNegative() {
+ $newKarma = $this->getNbNegVotes() + 1;
+ $this->setNbNegVotes($newKarma);
+ $this->writeToDatabase();
+ $this->saveIP();
+ }
+
+
+
+ // these methods shouldn't be called directly
+ function readFromDatabase() {
+ $query = 'SELECT ikarmapos, ikarmaneg FROM '.sql_table('item').' WHERE inumber=' . $this->itemid;
+ $res = DB::getRow($query);
+
+ $this->karmapos = $res['ikarmapos'];
+ $this->karmaneg = $res['ikarmaneg'];
+ $this->inforead = 1;
+ }
+
+
+ function writeToDatabase() {
+ $query = 'UPDATE '.sql_table('item').' SET ikarmapos=' . $this->karmapos . ', ikarmaneg='.$this->karmaneg.' WHERE inumber=' . $this->itemid;
+ DB::execute($query);
+ }
+
+ // checks if a vote is still allowed for an IP
+ function isVoteAllowed($ip) {
+ $query = 'SELECT * FROM '.sql_table('karma')." WHERE itemid={$this->itemid} and ip=". DB::quoteValue($ip);
+ $res = DB::getResult($query);
+ return ($res->rowCount() == 0);
+ }
+
+ // save IP in database so no multiple votes are possible
+ function saveIP() {
+ $query = 'INSERT INTO ' . sql_table('karma') .' (itemid, ip) VALUES (' . $this->itemid . ','. DB::quoteValue(serverVar('REMOTE_ADDR')) .')';
+ DB::execute($query);
+ }
+}
+
+?>
\ No newline at end of file
-<?php \r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2011 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * This class is a collections of functions that produce links\r
- * \r
- * All functions in this clss should only be called statically,\r
- * for example: Link::create_item_link(...)\r
- * \r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2011 The Nucleus Group\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2011 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * This class is a collections of functions that produce links
+ *
+ * All functions in this clss should only be called statically,
+ * for example: Link::create_item_link(...)
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2011 The Nucleus Group
* @version $Id: LINK.php 1721 2012-03-31 10:18:25Z sakamocchi $
- */\r
-class Link\r
-{\r
- /**\r
- * Link::create_item_link()\r
- * Create a link to an item\r
- * @static\r
- * @param $itemid item id\r
- * @param $extra extra parameter\r
- */\r
- static public function create_item_link($itemid, $extra = '') {\r
- return self::create_link('item', array('itemid' => $itemid, 'extra' => $extra) );\r
- }\r
-\r
- /**\r
- * Link::create_member_link()\r
- * Create a link to a member\r
- * \r
- * @static\r
- * @param $memberid member id\r
- * @param $extra extra parameter\r
- */\r
- static public function create_member_link($memberid, $extra = '') {\r
- return self::create_link('member', array('memberid' => $memberid, 'extra' => $extra) );\r
- }\r
- \r
- /**\r
- * Link::create_category_link()\r
- * Create a link to a category\r
- * \r
- * @static\r
- * @param $catid category id\r
- * @param $extra extra parameter\r
- */\r
- static public function create_category_link($catid, $extra = '') {\r
- return self::create_link('category', array('catid' => $catid, 'extra' => $extra) );\r
- }\r
-\r
- /**\r
- * Link::cteate_archive_link()\r
- * Create a link to an archive\r
- * \r
- * @static\r
- * @param $blogid blog id\r
- * @param $archive archive identifier\r
- * @param $extra extra parameter\r
- */\r
- static public function create_archive_link($blogid, $archive, $extra = '') {\r
- return self::create_link('archive', array('blogid' => $blogid, 'archive' => $archive, 'extra' => $extra) );\r
- }\r
-\r
- /**\r
- * Link::create_archivelist_link()\r
- * Create a link to an archive list\r
- * \r
- * @static\r
- * @param $blogid blog id\r
- * @param $extra extra parameter\r
- */\r
- static public function create_archivelist_link($blogid = '', $extra = '') {\r
- return self::create_link('archivelist', array('blogid' => $blogid, 'extra' => $extra) );\r
- }\r
-\r
- /**\r
- * Link::create_blogid_link()\r
- * Create a link to a blog\r
- * \r
- * @static\r
- * @param $blogid blog id\r
- * @param $extra extra parameter\r
- */\r
- static public function create_blogid_link($blogid, $params = '') {\r
- return self::create_link('blog', array('blogid' => $blogid, 'extra' => $params) );\r
- }\r
-\r
- /**\r
- * Link::create_link()\r
- * Create a link\r
- * \r
- * Universell function that creates link of different types (like item, blog ...)\r
- * and with an array of parameters\r
- * \r
- * @static\r
- * @param $type type of the link\r
- * @param $params array with parameters\r
- */\r
- static public function create_link($type, $params) {\r
- global $manager, $CONF;\r
- \r
- $generatedURL = '';\r
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');\r
- \r
- // ask plugins first\r
- $created = false;\r
- \r
- if ($usePathInfo)\r
- {\r
- $manager->notify(\r
- 'GenerateURL',\r
- array(\r
- 'type' => $type,\r
- 'params' => $params,\r
- 'completed' => &$created,\r
- 'url' => &$url\r
- )\r
- );\r
- }\r
- \r
- // if a plugin created the URL, return it\r
- if ($created)\r
- {\r
- return $url;\r
- }\r
- \r
- // default implementation\r
- switch ($type) {\r
- case 'item':\r
- if ($usePathInfo) {\r
- $url = $CONF['ItemURL'] . '/' . $CONF['ItemKey'] . '/' . $params['itemid'];\r
- } else {\r
- $url = $CONF['ItemURL'] . '?itemid=' . $params['itemid'];\r
- }\r
- break;\r
- \r
- case 'member':\r
- if ($usePathInfo) {\r
- $url = $CONF['MemberURL'] . '/' . $CONF['MemberKey'] . '/' . $params['memberid'];\r
- } else {\r
- $url = $CONF['MemberURL'] . '?memberid=' . $params['memberid'];\r
- }\r
- break;\r
- \r
- case 'category':\r
- if ($usePathInfo) {\r
- $url = $CONF['CategoryURL'] . '/' . $CONF['CategoryKey'] . '/' . $params['catid'];\r
- } else {\r
- $url = $CONF['CategoryURL'] . '?catid=' . $params['catid'];\r
- }\r
- break;\r
- \r
- case 'archivelist':\r
- if (!$params['blogid']) {\r
- $params['blogid'] = $CONF['DefaultBlog'];\r
- }\r
- \r
- if ($usePathInfo) {\r
- $url = $CONF['ArchiveListURL'] . '/' . $CONF['ArchivesKey'] . '/' . $params['blogid'];\r
- } else {\r
- $url = $CONF['ArchiveListURL'] . '?archivelist=' . $params['blogid'];\r
- }\r
- break;\r
- \r
- case 'archive':\r
- if ($usePathInfo) {\r
- $url = $CONF['ArchiveURL'] . '/' . $CONF['ArchiveKey'] . '/'.$params['blogid'].'/' . $params['archive'];\r
- } else {\r
- $url = $CONF['ArchiveURL'] . '?blogid='.$params['blogid'].'&archive=' . $params['archive'];\r
- }\r
- break;\r
- \r
- case 'blog':\r
- if ($usePathInfo) {\r
- $url = $CONF['BlogURL'] . '/' . $CONF['BlogKey'] . '/' . $params['blogid'];\r
- } else {\r
- $url = $CONF['BlogURL'] . '?blogid=' . $params['blogid'];\r
- }\r
- break;\r
- }\r
- \r
- return Link::add_link_params($url, (isset($params['extra'])? $params['extra'] : null));\r
- }\r
- \r
- static private function add_link_params($link, $params)\r
- {\r
- global $CONF;\r
- \r
- if (is_array($params) ) {\r
- \r
- if ($CONF['URLMode'] == 'pathinfo') {\r
- \r
- foreach ($params as $param => $value) {\r
- // change in 3.63 to fix problem where URL generated with extra params mike look like category/4/blogid/1\r
- // but they should use the URL keys like this: category/4/blog/1\r
- // if user wants old urls back, set $CONF['NoURLKeysInExtraParams'] = 1; in config.php\r
- if (isset($CONF['NoURLKeysInExtraParams']) && $CONF['NoURLKeysInExtraParams'] == 1) \r
- {\r
- $link .= '/' . $param . '/' . urlencode($value);\r
- } else {\r
- switch ($param) {\r
- case 'itemid':\r
- $link .= '/' . $CONF['ItemKey'] . '/' . urlencode($value);\r
- break;\r
- case 'memberid':\r
- $link .= '/' . $CONF['MemberKey'] . '/' . urlencode($value);\r
- break;\r
- case 'catid':\r
- $link .= '/' . $CONF['CategoryKey'] . '/' . urlencode($value);\r
- break;\r
- case 'archivelist':\r
- $link .= '/' . $CONF['ArchivesKey'] . '/' . urlencode($value);\r
- break;\r
- case 'archive':\r
- $link .= '/' . $CONF['ArchiveKey'] . '/' . urlencode($value);\r
- break;\r
- case 'blogid':\r
- $link .= '/' . $CONF['BlogKey'] . '/' . urlencode($value);\r
- break;\r
- default:\r
- $link .= '/' . $param . '/' . urlencode($value);\r
- break;\r
- }\r
- }\r
- }\r
- \r
- } else {\r
- \r
- foreach ($params as $param => $value) {\r
- $link .= '&' . $param . '=' . urlencode($value);\r
- }\r
- \r
- }\r
- }\r
- \r
- return $link;\r
- }\r
-\r
- /**\r
- * Link::create_blog_link()\r
- * Create an link to a blog\r
- * \r
- * This function considers the URLMode of the blog\r
- * \r
- * @static\r
- * @param $url url\r
- * @param $params parameters\r
- */\r
- static public function create_blog_link($url, $params) {\r
- global $CONF;\r
- if ($CONF['URLMode'] == 'normal') {\r
- if (i18n::strpos($url, '?') === FALSE && is_array($params)) {\r
- $fParam = reset($params);\r
- $fKey = key($params);\r
- array_shift($params);\r
- $url .= '?' . $fKey . '=' . $fParam;\r
- }\r
- } elseif ($CONF['URLMode'] == 'pathinfo' && i18n::substr($url, -1) == '/') {\r
- $url = i18n::substr($url, 0, -1);\r
- }\r
- return addLinkParams($url, $params);\r
- }\r
-\r
-}\r
+ */
+class Link
+{
+
+ /**
+ * Link::create_item_link()
+ * Create a link to an item
+ * @static
+ * @param $itemid item id
+ * @param $extra extra parameter
+ */
+ static public function create_item_link($itemid, $extra = '') {
+ return self::create_link('item', array('itemid' => $itemid, 'extra' => $extra) );
+ }
+
+ /**
+ * Link::create_member_link()
+ * Create a link to a member
+ *
+ * @static
+ * @param $memberid member id
+ * @param $extra extra parameter
+ */
+ static public function create_member_link($memberid, $extra = '') {
+ return self::create_link('member', array('memberid' => $memberid, 'extra' => $extra) );
+ }
+
+ /**
+ * Link::create_category_link()
+ * Create a link to a category
+ *
+ * @static
+ * @param $catid category id
+ * @param $extra extra parameter
+ */
+ static public function create_category_link($catid, $extra = '') {
+ return self::create_link('category', array('catid' => $catid, 'extra' => $extra) );
+ }
+
+ /**
+ * Link::cteate_archive_link()
+ * Create a link to an archive
+ *
+ * @static
+ * @param $blogid blog id
+ * @param $archive archive identifier
+ * @param $extra extra parameter
+ */
+ static public function create_archive_link($blogid, $archive, $extra = '') {
+ return self::create_link('archive', array('blogid' => $blogid, 'archive' => $archive, 'extra' => $extra) );
+ }
+
+ /**
+ * Link::create_archivelist_link()
+ * Create a link to an archive list
+ *
+ * @static
+ * @param $blogid blog id
+ * @param $extra extra parameter
+ */
+ static public function create_archivelist_link($blogid = '', $extra = '') {
+ return self::create_link('archivelist', array('blogid' => $blogid, 'extra' => $extra) );
+ }
+
+ /**
+ * Link::create_blogid_link()
+ * Create a link to a blog
+ *
+ * @static
+ * @param $blogid blog id
+ * @param $extra extra parameter
+ */
+ static public function create_blogid_link($blogid, $params = '') {
+ return self::create_link('blog', array('blogid' => $blogid, 'extra' => $params) );
+ }
+
+ /**
+ * Link::create_link()
+ * Create a link
+ *
+ * Universell function that creates link of different types (like item, blog ...)
+ * and with an array of parameters
+ *
+ * @static
+ * @param $type type of the link
+ * @param $params array with parameters
+ */
+ static public function create_link($type, $params) {
+ global $manager, $CONF;
+
+ $generatedURL = '';
+ $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
+
+ // ask plugins first
+ $created = false;
+
+ if ($usePathInfo)
+ {
+ $manager->notify(
+ 'GenerateURL',
+ array(
+ 'type' => $type,
+ 'params' => $params,
+ 'completed' => &$created,
+ 'url' => &$url
+ )
+ );
+ }
+
+ // if a plugin created the URL, return it
+ if ($created)
+ {
+ return $url;
+ }
+
+ // default implementation
+ switch ($type) {
+ case 'item':
+ if ($usePathInfo) {
+ $url = $CONF['ItemURL'] . '/' . $CONF['ItemKey'] . '/' . $params['itemid'];
+ } else {
+ $url = $CONF['ItemURL'] . '?itemid=' . $params['itemid'];
+ }
+ break;
+
+ case 'member':
+ if ($usePathInfo) {
+ $url = $CONF['MemberURL'] . '/' . $CONF['MemberKey'] . '/' . $params['memberid'];
+ } else {
+ $url = $CONF['MemberURL'] . '?memberid=' . $params['memberid'];
+ }
+ break;
+
+ case 'category':
+ if ($usePathInfo) {
+ $url = $CONF['CategoryURL'] . '/' . $CONF['CategoryKey'] . '/' . $params['catid'];
+ } else {
+ $url = $CONF['CategoryURL'] . '?catid=' . $params['catid'];
+ }
+ break;
+
+ case 'archivelist':
+ if (!$params['blogid']) {
+ $params['blogid'] = $CONF['DefaultBlog'];
+ }
+
+ if ($usePathInfo) {
+ $url = $CONF['ArchiveListURL'] . '/' . $CONF['ArchivesKey'] . '/' . $params['blogid'];
+ } else {
+ $url = $CONF['ArchiveListURL'] . '?archivelist=' . $params['blogid'];
+ }
+ break;
+
+ case 'archive':
+ if ($usePathInfo) {
+ $url = $CONF['ArchiveURL'] . '/' . $CONF['ArchiveKey'] . '/'.$params['blogid'].'/' . $params['archive'];
+ } else {
+ $url = $CONF['ArchiveURL'] . '?blogid='.$params['blogid'].'&archive=' . $params['archive'];
+ }
+ break;
+
+ case 'blog':
+ if ($usePathInfo) {
+ $url = $CONF['BlogURL'] . '/' . $CONF['BlogKey'] . '/' . $params['blogid'];
+ } else {
+ $url = $CONF['BlogURL'] . '?blogid=' . $params['blogid'];
+ }
+ break;
+ }
+
+ return Link::add_link_params($url, (isset($params['extra'])? $params['extra'] : null));
+ }
+
+ static private function add_link_params($link, $params)
+ {
+ global $CONF;
+
+ if (is_array($params) ) {
+
+ if ($CONF['URLMode'] == 'pathinfo') {
+
+ foreach ($params as $param => $value) {
+ // change in 3.63 to fix problem where URL generated with extra params mike look like category/4/blogid/1
+ // but they should use the URL keys like this: category/4/blog/1
+ // if user wants old urls back, set $CONF['NoURLKeysInExtraParams'] = 1; in config.php
+ if (isset($CONF['NoURLKeysInExtraParams']) && $CONF['NoURLKeysInExtraParams'] == 1)
+ {
+ $link .= '/' . $param . '/' . urlencode($value);
+ } else {
+ switch ($param) {
+ case 'itemid':
+ $link .= '/' . $CONF['ItemKey'] . '/' . urlencode($value);
+ break;
+ case 'memberid':
+ $link .= '/' . $CONF['MemberKey'] . '/' . urlencode($value);
+ break;
+ case 'catid':
+ $link .= '/' . $CONF['CategoryKey'] . '/' . urlencode($value);
+ break;
+ case 'archivelist':
+ $link .= '/' . $CONF['ArchivesKey'] . '/' . urlencode($value);
+ break;
+ case 'archive':
+ $link .= '/' . $CONF['ArchiveKey'] . '/' . urlencode($value);
+ break;
+ case 'blogid':
+ $link .= '/' . $CONF['BlogKey'] . '/' . urlencode($value);
+ break;
+ default:
+ $link .= '/' . $param . '/' . urlencode($value);
+ break;
+ }
+ }
+ }
+
+ } else {
+
+ foreach ($params as $param => $value) {
+ $link .= '&' . $param . '=' . urlencode($value);
+ }
+
+ }
+ }
+
+ return $link;
+ }
+
+ /**
+ * Link::create_blog_link()
+ * Create an link to a blog
+ *
+ * This function considers the URLMode of the blog
+ *
+ * @static
+ * @param $url url
+ * @param $params parameters
+ */
+ static public function create_blog_link($url, $params) {
+ global $CONF;
+ if ($CONF['URLMode'] == 'normal') {
+ if (i18n::strpos($url, '?') === FALSE && is_array($params)) {
+ $fParam = reset($params);
+ $fKey = key($params);
+ array_shift($params);
+ $url .= '?' . $fKey . '=' . $fParam;
+ }
+ } elseif ($CONF['URLMode'] == 'pathinfo' && i18n::substr($url, -1) == '/') {
+ $url = i18n::substr($url, 0, -1);
+ }
+ return addLinkParams($url, $params);
+ }
+
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * This class makes sure each item/weblog/comment object gets requested from\r
- * the database only once, by keeping them in a cache. The class also acts as\r
- * a dynamic classloader, loading classes _only_ when they are first needed,\r
- * hoping to diminish execution time\r
- *\r
- * The class is a singleton, meaning that there will be only one object of it\r
- * active at all times. The object can be requested using Manager::instance()\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: MANAGER.php 1731 2012-04-08 15:10:35Z sakamocchi $\r
- */\r
-class Manager\r
-{\r
- /**\r
- * Cached ITEM, BLOG, PLUGIN, KARMA and MEMBER objects. When these objects are requested\r
- * through the global $manager object (getItem, getBlog, ...), only the first call\r
- * will create an object. Subsequent calls will return the same object.\r
- *\r
- * The $items, $blogs, ... arrays map an id to an object (for plugins, the name is used\r
- * rather than an ID)\r
- */\r
- private $items;\r
- private $blogs;\r
- private $plugins;\r
- private $karma;\r
- private $templates;\r
- private $members;\r
- private $skins;\r
- \r
- /**\r
- * cachedInfo to avoid repeated SQL queries (see pidInstalled/pluginInstalled/getPidFromName)\r
- * e.g. which plugins exists?\r
- *\r
- * $cachedInfo['installedPlugins'] = array($pid -> $name)\r
- */\r
- private $cachedInfo;\r
- \r
- /**\r
- * The plugin subscriptionlist\r
- *\r
- * The subcription array has the following structure\r
- * $subscriptions[$EventName] = array containing names of plugin classes to be\r
- * notified when that event happens\r
- * \r
- * NOTE: this is referred by Comments::addComment() for spamcheck API\r
- * TODO: we should add new methods to get this\r
- */\r
- public $subscriptions;\r
- \r
- /**\r
- * Ticket functions. These are uses by the admin area to make it impossible to simulate certain GET/POST\r
- * requests. tickets are user specific\r
- */\r
- private $currentRequestTicket = '';\r
- \r
- /**\r
- * Returns the only instance of this class. Creates the instance if it\r
- * does not yet exists. Users should use this function as\r
- * $manager =& Manager::instance(); to get a reference to the object\r
- * instead of a copy\r
- */\r
- public function &instance()\r
- {\r
- static $instance = array();\r
- if ( empty($instance) )\r
- {\r
- $instance[0] = new Manager();\r
- }\r
- return $instance[0];\r
- }\r
- \r
- /**\r
- * The constructor of this class initializes the object caches\r
- */\r
- public function __construct()\r
- {\r
- $this->items = array();\r
- $this->blogs = array();\r
- $this->plugins = array();\r
- $this->karma = array();\r
- $this->templates = array();\r
- $this->skins = array();\r
- $this->parserPrefs = array();\r
- $this->cachedInfo = array();\r
- $this->members = array();\r
- return;\r
- }\r
- \r
- /**\r
- * Returns the requested item object. If it is not in the cache, it will\r
- * first be loaded and then placed in the cache.\r
- * Intended use: $item =& $manager->getItem(1234, 0, 0)\r
- */\r
- public function &getItem($itemid, $allowdraft, $allowfuture)\r
- {\r
- /* confirm to cached */\r
- if ( !array_key_exists($itemid, $this->items) )\r
- {\r
- $this->loadClass('ITEM');\r
- $item = Item::getitem($itemid, $allowdraft, $allowfuture);\r
- $this->items[$itemid] = $item;\r
- }\r
- \r
- $item =& $this->items[$itemid];\r
- if ( !$allowdraft && ($item['draft']) )\r
- {\r
- return 0;\r
- }\r
- \r
- $blog =& $this->getBlog($item['blogid']);\r
- if ( !$allowfuture && ($item['timestamp'] > $blog->getCorrectTime()) )\r
- {\r
- return 0;\r
- }\r
- \r
- return $item;\r
- }\r
- \r
- /**\r
- * Loads a class if it has not yet been loaded\r
- */\r
- public function loadClass($name)\r
- {\r
- $this->_loadClass($name, $name . '.php');\r
- return;\r
- }\r
- \r
- /**\r
- * Checks if an item exists\r
- */\r
- public function existsItem($id,$future,$draft)\r
- {\r
- $this->_loadClass('ITEM','ITEM.php');\r
- return Item::exists($id,$future,$draft);\r
- }\r
- \r
- /**\r
- * Checks if a category exists\r
- */\r
- public function existsCategory($id)\r
- {\r
- return (DB::getValue('SELECT COUNT(*) as result FROM '.sql_table('category').' WHERE catid='.intval($id)) > 0);\r
- }\r
- \r
- /**\r
- * Returns the blog object for a given blogid\r
- */\r
- public function &getBlog($blogid)\r
- {\r
- if ( !array_key_exists($blogid, $this->blogs) )\r
- {\r
- $this->_loadClass('BLOG','BLOG.php');\r
- $this->blogs[$blogid] = new Blog($blogid);\r
- }\r
- return $this->blogs[$blogid];\r
- }\r
- \r
- /**\r
- * Checks if a blog exists\r
- */\r
- public function existsBlog($name)\r
- {\r
- $this->_loadClass('BLOG','BLOG.php');\r
- return Blog::exists($name);\r
- }\r
- \r
- /**\r
- * Checks if a blog id exists\r
- */\r
- public function existsBlogID($id)\r
- {\r
- $this->_loadClass('BLOG','BLOG.php');\r
- return Blog::existsID($id);\r
- }\r
- \r
- /**\r
- * Returns a previously read template\r
- */\r
- public function &getTemplate($templateName)\r
- {\r
- if ( !array_key_exists($templateName, $this->templates) )\r
- {\r
- $this->_loadClass('Template','TEMPLATE.php');\r
- $this->templates[$templateName] =& Template::read($templateName);\r
- }\r
- return $this->templates[$templateName];\r
- }\r
- \r
- /**\r
- * Returns a KARMA object (karma votes)\r
- */\r
- public function &getKarma($itemid)\r
- {\r
- if ( !array_key_exists($itemid, $this->karma) )\r
- {\r
- $this->_loadClass('Karma','KARMA.php');\r
- $this->karma[$itemid] = new Karma($itemid);\r
- }\r
- return $this->karma[$itemid];\r
- }\r
- \r
- /**\r
- * Returns a MEMBER object\r
- */\r
- public function &getMember($memberid)\r
- {\r
- if ( !array_key_exists($memberid, $this->members) )\r
- {\r
- $this->_loadClass('Member','MEMBER.php');\r
- $this->members[$memberid] =& Member::createFromID($memberid);;\r
- }\r
- return $this->members[$memberid];\r
- }\r
- \r
- /**\r
- * Manager::getSkin()\r
- * \r
- * @param integer $skinid ID for skin\r
- * @param string $action_class action class for handling skin variables\r
- * @param string $event_identifier identifier for event name\r
- * @return object instance of Skin class\r
- */\r
- public function &getSkin($skinid, $action_class='Actions', $event_identifier='Skin')\r
- {\r
- if ( !array_key_exists($skinid, $this->skins) )\r
- {\r
- $this->_loadClass('Skin', 'SKIN.php');\r
- $this->skins[$skinid] = new Skin($skinid, $action_class, $event_identifier);\r
- }\r
- \r
- return $this->skins[$skinid];\r
- }\r
- \r
- /**\r
- * Set the global parser preferences\r
- */\r
- public function setParserProperty($name, $value)\r
- {\r
- $this->parserPrefs[$name] = $value;\r
- return;\r
- }\r
- \r
- /**\r
- * Get the global parser preferences\r
- */\r
- public function getParserProperty($name)\r
- {\r
- return $this->parserPrefs[$name];\r
- }\r
- \r
- /**\r
- * A helper function to load a class\r
- * \r
- * private\r
- */\r
- private function _loadClass($name, $filename)\r
- {\r
- global $DIR_LIBS;\r
- \r
- if ( !class_exists($name) )\r
- {\r
- include($DIR_LIBS . $filename);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Manager::_loadPlugin()\r
- * loading a certain plugin\r
- * \r
- * @param string $name plugin name\r
- * @return void\r
- */\r
- private function _loadPlugin($name)\r
- {\r
- global $DIR_PLUGINS, $MYSQL_HANDLER, $MYSQL_PREFIX;\r
- \r
- if ( class_exists($name) )\r
- {\r
- return;\r
- }\r
- \r
- $fileName = "{$DIR_PLUGINS}{$name}.php";\r
- \r
- if ( !file_exists($fileName) )\r
- {\r
- if ( !defined('_MANAGER_PLUGINFILE_NOTFOUND') )\r
- {\r
- define('_MANAGER_PLUGINFILE_NOTFOUND', 'Plugin %s was not loaded (File not found)');\r
- }\r
- ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINFILE_NOTFOUND, $name)); \r
- return 0;\r
- }\r
- \r
- // load plugin\r
- include($fileName);\r
- \r
- // check if class exists (avoid errors in eval'd code)\r
- if ( !class_exists($name) )\r
- {\r
- ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINFILE_NOCLASS, $name));\r
- return 0;\r
- }\r
- \r
- // add to plugin array\r
- $this->plugins[$name] = new $name();\r
- \r
- // get plugid\r
- $this->plugins[$name]->setID($this->getPidFromName($name));\r
- \r
- // unload plugin if a prefix is used and the plugin cannot handle this\r
- if ( ($MYSQL_PREFIX != '')\r
- && !$this->plugins[$name]->supportsFeature('SqlTablePrefix') )\r
- {\r
- unset($this->plugins[$name]);\r
- ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINTABLEPREFIX_NOTSUPPORT, $name));\r
- return 0;\r
- }\r
- \r
- // unload plugin if using non-mysql handler and plugin does not support it \r
- if ( (!in_array('mysql',$MYSQL_HANDLER))\r
- && !$this->plugins[$name]->supportsFeature('SqlApi') )\r
- {\r
- unset($this->plugins[$name]);\r
- ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINSQLAPI_NOTSUPPORT, $name));\r
- return 0;\r
- }\r
- \r
- // call init method\r
- $this->plugins[$name]->init();\r
- \r
- return;\r
- }\r
-\r
- /**\r
- * Manager:getPlugin()\r
- * Returns a PLUGIN object\r
- * \r
- * @param string $name name of plugin\r
- * @return object plugin object\r
- */\r
- public function &getPlugin($name)\r
- {\r
- // retrieve the name of the plugin in the right capitalisation\r
- $name = $this->getUpperCaseName ($name);\r
- \r
- // get the plugin \r
- $plugin =& $this->plugins[$name]; \r
- \r
- if ( !$plugin )\r
- {\r
- // load class if needed\r
- $this->_loadPlugin($name);\r
- $plugin =& $this->plugins[$name];\r
- }\r
- return $plugin;\r
- }\r
- \r
- /**\r
- * Manager::pluginLoaded()\r
- * Checks if the given plugin IS loaded or not\r
- * \r
- * @param string $name name of plugin\r
- * @return object plugin object\r
- */\r
- public function &pluginLoaded($name)\r
- {\r
- $plugin =& $this->plugins[$name];\r
- return $plugin;\r
- }\r
- \r
- /**\r
- * Manager::pidLoaded()\r
- * \r
- * @param integer $pid id for plugin\r
- * @return object plugin object\r
- */\r
- public function &pidLoaded($pid)\r
- {\r
- $plugin=false;\r
- reset($this->plugins);\r
- while ( list($name) = each($this->plugins) )\r
- {\r
- if ( $pid!=$this->plugins[$name]->getId() )\r
- {\r
- continue;\r
- }\r
- $plugin= & $this->plugins[$name];\r
- break;\r
- }\r
- return $plugin;\r
- }\r
- \r
- /**\r
- * Manager::pluginInstalled()\r
- * checks if the given plugin IS installed or not\r
- * \r
- * @param string $name name of plugin\r
- * @return boolean exists or not\r
- */\r
- public function pluginInstalled($name)\r
- {\r
- $this->_initCacheInfo('installedPlugins');\r
- return ($this->getPidFromName($name) != -1);\r
- }\r
-\r
- /**\r
- * Manager::pidInstalled()\r
- * checks if the given plugin IS installed or not\r
- * \r
- * @param integer $pid id of plugin\r
- * @return boolean exists or not\r
- */\r
- public function pidInstalled($pid)\r
- {\r
- $this->_initCacheInfo('installedPlugins');\r
- return ($this->cachedInfo['installedPlugins'][$pid] != '');\r
- }\r
- \r
- /**\r
- * Manager::getPidFromName()\r
- * \r
- * @param string $name name of plugin\r
- * @return mixed id for plugin or -1 if not exists\r
- */\r
- public function getPidFromName($name)\r
- {\r
- $this->_initCacheInfo('installedPlugins');\r
- foreach ( $this->cachedInfo['installedPlugins'] as $pid => $pfile )\r
- {\r
- if (strtolower($pfile) == strtolower($name))\r
- {\r
- return $pid;\r
- }\r
- }\r
- return -1;\r
- }\r
- \r
- /**\r
- * Manager::getPluginNameFromPid()\r
- * \r
- * @param string $pid ID for plugin\r
- * @return string name of plugin\r
- */\r
- public function getPluginNameFromPid($pid)\r
- {\r
- if ( !array_key_exists($pid, $this->cachedInfo['installedPlugins']) )\r
- {\r
- $query = 'SELECT pfile FROM %s WHERE pid=%d;';\r
- $query = sprintf($query, sql_table('plugin'), (integer) $pid);\r
- return DB::getValue($query);\r
- }\r
- return $this->cachedInfo['installedPlugins'][$pid];\r
- }\r
- \r
- /**\r
- * Manager::getUpperCaseName()\r
- * Retrieve the name of a plugin in the right capitalisation\r
- * \r
- * @param string $name name of plugin\r
- * @return string name according to UpperCamelCase\r
- */\r
- public function getUpperCaseName ($name)\r
- {\r
- $this->_initCacheInfo('installedPlugins');\r
- foreach ( $this->cachedInfo['installedPlugins'] as $pid => $pfile )\r
- {\r
- if ( strtolower($pfile) == strtolower($name) )\r
- {\r
- return $pfile;\r
- }\r
- }\r
- return -1;\r
- }\r
- \r
- /**\r
- * Manager::clearCachedInfo()\r
- * \r
- * @param string $what\r
- * @return void\r
- */\r
- public function clearCachedInfo($what)\r
- {\r
- unset($this->cachedInfo[$what]);\r
- return;\r
- }\r
- \r
- /**\r
- * Manager::_initCacheInfo()\r
- * Loads some info on the first call only\r
- * \r
- * @param string $what 'installedPlugins'\r
- * @return void\r
- */\r
- private function _initCacheInfo($what)\r
- {\r
- if ( array_key_exists($what, $this->cachedInfo)\r
- && is_array($this->cachedInfo[$what]) )\r
- {\r
- return;\r
- }\r
- \r
- switch ($what)\r
- {\r
- // 'installedPlugins' = array ($pid => $name)\r
- case 'installedPlugins':\r
- $this->cachedInfo['installedPlugins'] = array();\r
- $res = DB::getResult('SELECT pid, pfile FROM ' . sql_table('plugin'));\r
- foreach ( $res as $row )\r
- {\r
- $this->cachedInfo['installedPlugins'][$row['pid']] = $row['pfile'];\r
- }\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Manager::notify()\r
- * A function to notify plugins that something has happened. Only the plugins\r
- * that are subscribed to the event will get notified.\r
- * Upon the first call, the list of subscriptions will be fetched from the\r
- * database. The plugins itsself will only get loaded when they are first needed\r
- *\r
- * @param string $eventName Name of the event (method to be called on plugins)\r
- * @param string $data Can contain any type of data,\r
- * depending on the event type. Usually this is an itemid, blogid, ...\r
- * but it can also be an array containing multiple values\r
- * @return void\r
- */\r
- public function notify($eventName, $data)\r
- {\r
- // load subscription list if needed\r
- if ( !is_array($this->subscriptions) )\r
- {\r
- $this->_loadSubscriptions();\r
- }\r
- \r
- // get listening objects\r
- $listeners = false;\r
- if ( array_key_exists($eventName, $this->subscriptions)\r
- && !empty($this->subscriptions[$eventName]) )\r
- {\r
- $listeners = $this->subscriptions[$eventName];\r
- }\r
- \r
- // notify all of them\r
- if ( is_array($listeners) )\r
- {\r
- foreach( $listeners as $listener )\r
- {\r
- // load class if needed\r
- $this->_loadPlugin($listener);\r
- \r
- // do notify (if method exists)\r
- if ( array_key_exists($listener, $this->plugins)\r
- && !empty($this->plugins[$listener])\r
- && method_exists($this->plugins[$listener], 'event_' . $eventName) )\r
- {\r
- call_user_func(array(&$this->plugins[$listener],'event_' . $eventName), $data);\r
- }\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Manager::_loadSubscriptions()\r
- * Loads plugin subscriptions\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function _loadSubscriptions()\r
- {\r
- // initialize as array\r
- $this->subscriptions = array();\r
- \r
- $query = "SELECT p.pfile as pfile, e.event as event"\r
- . " FROM %s as e, %s as p"\r
- . " WHERE e.pid=p.pid ORDER BY p.porder ASC";\r
- $query = sprintf($query, sql_table('plugin_event'), sql_table('plugin'));\r
- $res = DB::getResult($query);\r
- \r
- foreach ( $res as $row )\r
- {\r
- $pluginName = $row['pfile'];\r
- $eventName = $row['event'];\r
- $this->subscriptions[$eventName][] = $pluginName;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Manager::getNumberOfSubscribers()\r
- * \r
- * @param string $event name of events\r
- * @return integer number of event subscriber\r
- */\r
- public function getNumberOfSubscribers($event)\r
- {\r
- $query = 'SELECT COUNT(*) as count FROM %s WHERE event=%s;';\r
- $query = sprintf($query, sql_table('plugin_event'), DB::quoteValue($event));\r
- return (integer) DB::getValue($query);\r
- }\r
- \r
- /**\r
- * Manager::addTicketToUrl()\r
- * GET requests: Adds ticket to URL (URL should NOT be html-encoded!, ticket is added at the end)\r
- * \r
- * @param string url string for URI\r
- * @return void\r
- */\r
- public function addTicketToUrl($url)\r
- {\r
- $ticketCode = 'ticket=' . $this->_generateTicket();\r
- if ( i18n::strpos($url, '?') === FALSE )\r
- {\r
- $ticketCode = "{$url}?{$ticketCode}";\r
- }\r
- else\r
- {\r
- $ticketCode = "{$url}&{$ticketCode}";\r
- }\r
- return $ticketCode;\r
- }\r
- \r
- /**\r
- * Manager::addTicketHidden()\r
- * POST requests: Adds ticket as hidden formvar\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function addTicketHidden()\r
- {\r
- $ticket = $this->_generateTicket();\r
- echo '<input type="hidden" name="ticket" value="', Entity::hsc($ticket), '" />';\r
- return;\r
- }\r
- \r
- /**\r
- * Manager::getNewTicket()\r
- * Get a new ticket\r
- * (xmlHTTPRequest AutoSaveDraft uses this to refresh the ticket)\r
- * \r
- * @param void\r
- * @return string string of ticket\r
- */\r
- public function getNewTicket()\r
- {\r
- $this->currentRequestTicket = '';\r
- return $this->_generateTicket();\r
- }\r
- \r
- /**\r
- * Manager::checkTicket()\r
- * Checks the ticket that was passed along with the current request\r
- * \r
- * @param void\r
- * @return boolean correct or not\r
- */\r
- public function checkTicket()\r
- {\r
- global $member;\r
- \r
- // get ticket from request\r
- $ticket = requestVar('ticket');\r
- \r
- // no ticket -> don't allow\r
- if ( $ticket == '' )\r
- {\r
- return FALSE;\r
- }\r
- \r
- // remove expired tickets first\r
- $this->_cleanUpExpiredTickets();\r
- \r
- // get member id\r
- if (!$member->isLoggedIn())\r
- {\r
- $memberId = -1;\r
- }\r
- else\r
- {\r
- $memberId = $member->getID();\r
- }\r
- \r
- // check if ticket is a valid one\r
- $query = sprintf('SELECT COUNT(*) as result FROM %s WHERE member=%d and ticket=%s',\r
- sql_table('tickets'),\r
- intval($memberId),\r
- DB::quoteValue($ticket)\r
- );\r
- \r
- /*\r
- * NOTE:\r
- * [in the original implementation, the checked ticket was deleted. This would lead to invalid\r
- * tickets when using the browsers back button and clicking another link/form\r
- * leaving the keys in the database is not a real problem, since they're member-specific and\r
- * only valid for a period of one hour]\r
- */\r
- if ( DB::getValue($query) != 1 )\r
- {\r
- return FALSE;\r
- }\r
- \r
- return TRUE;\r
- }\r
-\r
- /**\r
- * Manager::_cleanUpExpiredTickets()\r
- * Removes the expired tickets\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function _cleanUpExpiredTickets()\r
- {\r
- // remove tickets older than 1 hour\r
- $oldTime = time() - 60 * 60;\r
- $query = 'DELETE FROM %s WHERE ctime < %s';\r
- $query = sprintf($query, sql_table('tickets'), DB::formatDateTime($oldTime));\r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Manager::_generateTicket()\r
- * Generates/returns a ticket (one ticket per page request)\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function _generateTicket()\r
- {\r
- if ( $this->currentRequestTicket == '' )\r
- {\r
- // generate new ticket (only one ticket will be generated per page request)\r
- // and store in database\r
- global $member;\r
- // get member id\r
- if ( !$member->isLoggedIn() )\r
- {\r
- $memberId = -1;\r
- }\r
- else\r
- {\r
- $memberId = $member->getID();\r
- }\r
- \r
- $ok = false;\r
- while ( !$ok )\r
- {\r
- // generate a random token\r
- srand((double)microtime()*1000000);\r
- $ticket = md5(uniqid(rand(), true));\r
- \r
- // add in database as non-active\r
- $query = 'INSERT INTO %s (ticket, member, ctime) VALUES (%s, %d, %s)';\r
- $query = sprintf($query, sql_table('tickets'), DB::quoteValue($ticket), (integer) $memberId, DB::formatDateTime());\r
- \r
- if ( DB::execute($query) !== FALSE )\r
- {\r
- $ok = true;\r
- }\r
- }\r
- $this->currentRequestTicket = $ticket;\r
- }\r
- return $this->currentRequestTicket;\r
- }\r
-}\r
-\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * This class makes sure each item/weblog/comment object gets requested from
+ * the database only once, by keeping them in a cache. The class also acts as
+ * a dynamic classloader, loading classes _only_ when they are first needed,
+ * hoping to diminish execution time
+ *
+ * The class is a singleton, meaning that there will be only one object of it
+ * active at all times. The object can be requested using Manager::instance()
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: MANAGER.php 1878 2012-06-17 07:42:07Z sakamocchi $
+ */
+class Manager
+{
+ /**
+ * Cached ITEM, BLOG, PLUGIN, KARMA and MEMBER objects. When these objects are requested
+ * through the global $manager object (getItem, getBlog, ...), only the first call
+ * will create an object. Subsequent calls will return the same object.
+ *
+ * The $items, $blogs, ... arrays map an id to an object (for plugins, the name is used
+ * rather than an ID)
+ */
+ private $items;
+ private $blogs;
+ private $plugins;
+ private $karma;
+ private $templates;
+ private $members;
+ private $skins;
+
+ /**
+ * cachedInfo to avoid repeated SQL queries (see pidInstalled/pluginInstalled/getPidFromName)
+ * e.g. which plugins exists?
+ *
+ * $cachedInfo['installedPlugins'] = array($pid -> $name)
+ */
+ private $cachedInfo;
+
+ /**
+ * The plugin subscriptionlist
+ *
+ * The subcription array has the following structure
+ * $subscriptions[$EventName] = array containing names of plugin classes to be
+ * notified when that event happens
+ *
+ * NOTE: this is referred by Comments::addComment() for spamcheck API
+ * TODO: we should add new methods to get this
+ */
+ public $subscriptions;
+
+ /**
+ * Ticket functions. These are uses by the admin area to make it impossible to simulate certain GET/POST
+ * requests. tickets are user specific
+ */
+ private $currentRequestTicket = '';
+
+ /**
+ * Returns the only instance of this class. Creates the instance if it
+ * does not yet exists. Users should use this function as
+ * $manager =& Manager::instance(); to get a reference to the object
+ * instead of a copy
+ */
+ public function &instance()
+ {
+ static $instance = array();
+ if ( empty($instance) )
+ {
+ $instance[0] = new Manager();
+ }
+ return $instance[0];
+ }
+
+ /**
+ * The constructor of this class initializes the object caches
+ */
+ public function __construct()
+ {
+ $this->items = array();
+ $this->blogs = array();
+ $this->plugins = array();
+ $this->karma = array();
+ $this->templates = array();
+ $this->skins = array();
+ $this->parserPrefs = array();
+ $this->cachedInfo = array();
+ $this->members = array();
+ return;
+ }
+
+ /**
+ * Returns the requested item object. If it is not in the cache, it will
+ * first be loaded and then placed in the cache.
+ * Intended use: $item =& $manager->getItem(1234, 0, 0)
+ */
+ public function &getItem($itemid, $allowdraft, $allowfuture)
+ {
+ /* confirm to cached */
+ if ( !array_key_exists($itemid, $this->items) )
+ {
+ $this->loadClass('ITEM');
+ $item = Item::getitem($itemid, $allowdraft, $allowfuture);
+ $this->items[$itemid] = $item;
+ }
+
+ $item =& $this->items[$itemid];
+ if ( !$allowdraft && ($item['draft']) )
+ {
+ return 0;
+ }
+
+ $blog =& $this->getBlog($item['blogid']);
+ if ( !$allowfuture && ($item['timestamp'] > $blog->getCorrectTime()) )
+ {
+ return 0;
+ }
+
+ return $item;
+ }
+
+ /**
+ * Loads a class if it has not yet been loaded
+ */
+ public function loadClass($name)
+ {
+ $this->_loadClass($name, $name . '.php');
+ return;
+ }
+
+ /**
+ * Checks if an item exists
+ */
+ public function existsItem($id,$future,$draft)
+ {
+ $this->_loadClass('ITEM','ITEM.php');
+ return Item::exists($id,$future,$draft);
+ }
+
+ /**
+ * Checks if a category exists
+ */
+ public function existsCategory($id)
+ {
+ return (DB::getValue('SELECT COUNT(*) as result FROM '.sql_table('category').' WHERE catid='.intval($id)) > 0);
+ }
+
+ /**
+ * Returns the blog object for a given blogid
+ */
+ public function &getBlog($blogid)
+ {
+ if ( !array_key_exists($blogid, $this->blogs) )
+ {
+ $this->_loadClass('BLOG','BLOG.php');
+ $this->blogs[$blogid] = new Blog($blogid);
+ }
+ return $this->blogs[$blogid];
+ }
+
+ /**
+ * Checks if a blog exists
+ */
+ public function existsBlog($name)
+ {
+ $this->_loadClass('BLOG','BLOG.php');
+ return Blog::exists($name);
+ }
+
+ /**
+ * Checks if a blog id exists
+ */
+ public function existsBlogID($id)
+ {
+ $this->_loadClass('BLOG','BLOG.php');
+ return Blog::existsID($id);
+ }
+
+ /**
+ * Returns a previously read template
+ */
+ public function &getTemplate($templateName)
+ {
+ if ( !array_key_exists($templateName, $this->templates) )
+ {
+ $this->_loadClass('Template','TEMPLATE.php');
+ $this->templates[$templateName] =& Template::read($templateName);
+ }
+ return $this->templates[$templateName];
+ }
+
+ /**
+ * Returns a KARMA object (karma votes)
+ */
+ public function &getKarma($itemid)
+ {
+ if ( !array_key_exists($itemid, $this->karma) )
+ {
+ $this->_loadClass('Karma','KARMA.php');
+ $this->karma[$itemid] = new Karma($itemid);
+ }
+ return $this->karma[$itemid];
+ }
+
+ /**
+ * Returns a MEMBER object
+ */
+ public function &getMember($memberid)
+ {
+ if ( !array_key_exists($memberid, $this->members) )
+ {
+ $this->_loadClass('Member','MEMBER.php');
+ $this->members[$memberid] =& Member::createFromID($memberid);;
+ }
+ return $this->members[$memberid];
+ }
+
+ /**
+ * Manager::getSkin()
+ *
+ * @param integer $skinid ID for skin
+ * @param string $action_class action class for handling skin variables
+ * @param string $event_identifier identifier for event name
+ * @return object instance of Skin class
+ */
+ public function &getSkin($skinid, $action_class='Actions', $event_identifier='Skin')
+ {
+ if ( !array_key_exists($skinid, $this->skins) )
+ {
+ $this->_loadClass('Skin', 'SKIN.php');
+ $this->skins[$skinid] = new Skin($skinid, $action_class, $event_identifier);
+ }
+
+ return $this->skins[$skinid];
+ }
+
+ /**
+ * Set the global parser preferences
+ */
+ public function setParserProperty($name, $value)
+ {
+ $this->parserPrefs[$name] = $value;
+ return;
+ }
+
+ /**
+ * Get the global parser preferences
+ */
+ public function getParserProperty($name)
+ {
+ return $this->parserPrefs[$name];
+ }
+
+ /**
+ * A helper function to load a class
+ *
+ * private
+ */
+ private function _loadClass($name, $filename)
+ {
+ global $DIR_LIBS;
+
+ if ( !class_exists($name) )
+ {
+ include($DIR_LIBS . $filename);
+ }
+ return;
+ }
+
+ /**
+ * Manager::_loadPlugin()
+ * loading a certain plugin
+ *
+ * @param string $name plugin name
+ * @return void
+ */
+ private function _loadPlugin($name)
+ {
+ global $DIR_PLUGINS, $MYSQL_HANDLER, $MYSQL_PREFIX;
+
+ if ( class_exists($name) )
+ {
+ return;
+ }
+
+ $fileName = "{$DIR_PLUGINS}{$name}.php";
+
+ if ( !file_exists($fileName) )
+ {
+ if ( !defined('_MANAGER_PLUGINFILE_NOTFOUND') )
+ {
+ define('_MANAGER_PLUGINFILE_NOTFOUND', 'Plugin %s was not loaded (File not found)');
+ }
+ ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINFILE_NOTFOUND, $name));
+ return 0;
+ }
+
+ // load plugin
+ include($fileName);
+
+ // check if class exists (avoid errors in eval'd code)
+ if ( !class_exists($name) )
+ {
+ ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINFILE_NOCLASS, $name));
+ return 0;
+ }
+
+ // add to plugin array
+ $this->plugins[$name] = new $name();
+
+ // get plugid
+ $this->plugins[$name]->setID($this->getPidFromName($name));
+
+ // unload plugin if a prefix is used and the plugin cannot handle this
+ if ( ($MYSQL_PREFIX != '')
+ && !$this->plugins[$name]->supportsFeature('SqlTablePrefix') )
+ {
+ unset($this->plugins[$name]);
+ ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINTABLEPREFIX_NOTSUPPORT, $name));
+ return 0;
+ }
+
+ // unload plugin if using non-mysql handler and plugin does not support it
+ if ( (!in_array('mysql',$MYSQL_HANDLER))
+ && !$this->plugins[$name]->supportsFeature('SqlApi') )
+ {
+ unset($this->plugins[$name]);
+ ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINSQLAPI_NOTSUPPORT, $name));
+ return 0;
+ }
+
+ // call init method
+ $this->plugins[$name]->init();
+
+ return;
+ }
+
+ /**
+ * Manager:getPlugin()
+ * Returns a PLUGIN object
+ *
+ * @param string $name name of plugin
+ * @return object plugin object
+ */
+ public function &getPlugin($name)
+ {
+ // retrieve the name of the plugin in the right capitalisation
+ $name = $this->getUpperCaseName ($name);
+
+ // get the plugin
+ $plugin =& $this->plugins[$name];
+
+ if ( !$plugin )
+ {
+ // load class if needed
+ $this->_loadPlugin($name);
+ $plugin =& $this->plugins[$name];
+ }
+ return $plugin;
+ }
+
+ /**
+ * Manager::pluginLoaded()
+ * Checks if the given plugin IS loaded or not
+ *
+ * @param string $name name of plugin
+ * @return object plugin object
+ */
+ public function &pluginLoaded($name)
+ {
+ $plugin =& $this->plugins[$name];
+ return $plugin;
+ }
+
+ /**
+ * Manager::pidLoaded()
+ *
+ * @param integer $pid id for plugin
+ * @return object plugin object
+ */
+ public function &pidLoaded($pid)
+ {
+ $plugin=false;
+ reset($this->plugins);
+ while ( list($name) = each($this->plugins) )
+ {
+ if ( $pid!=$this->plugins[$name]->getId() )
+ {
+ continue;
+ }
+ $plugin= & $this->plugins[$name];
+ break;
+ }
+ return $plugin;
+ }
+
+ /**
+ * Manager::pluginInstalled()
+ * checks if the given plugin IS installed or not
+ *
+ * @param string $name name of plugin
+ * @return boolean exists or not
+ */
+ public function pluginInstalled($name)
+ {
+ $this->_initCacheInfo('installedPlugins');
+ return ($this->getPidFromName($name) != -1);
+ }
+
+ /**
+ * Manager::pidInstalled()
+ * checks if the given plugin IS installed or not
+ *
+ * @param integer $pid id of plugin
+ * @return boolean exists or not
+ */
+ public function pidInstalled($pid)
+ {
+ $this->_initCacheInfo('installedPlugins');
+ return ($this->cachedInfo['installedPlugins'][$pid] != '');
+ }
+
+ /**
+ * Manager::getPidFromName()
+ *
+ * @param string $name name of plugin
+ * @return mixed id for plugin or -1 if not exists
+ */
+ public function getPidFromName($name)
+ {
+ $this->_initCacheInfo('installedPlugins');
+ foreach ( $this->cachedInfo['installedPlugins'] as $pid => $pfile )
+ {
+ if (strtolower($pfile) == strtolower($name))
+ {
+ return $pid;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Manager::getPluginNameFromPid()
+ *
+ * @param string $pid ID for plugin
+ * @return string name of plugin
+ */
+ public function getPluginNameFromPid($pid)
+ {
+ if ( !array_key_exists($pid, $this->cachedInfo['installedPlugins']) )
+ {
+ $query = 'SELECT pfile FROM %s WHERE pid=%d;';
+ $query = sprintf($query, sql_table('plugin'), (integer) $pid);
+ return DB::getValue($query);
+ }
+ return $this->cachedInfo['installedPlugins'][$pid];
+ }
+
+ /**
+ * Manager::getUpperCaseName()
+ * Retrieve the name of a plugin in the right capitalisation
+ *
+ * @param string $name name of plugin
+ * @return string name according to UpperCamelCase
+ */
+ public function getUpperCaseName ($name)
+ {
+ $this->_initCacheInfo('installedPlugins');
+ foreach ( $this->cachedInfo['installedPlugins'] as $pid => $pfile )
+ {
+ if ( strtolower($pfile) == strtolower($name) )
+ {
+ return $pfile;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Manager::clearCachedInfo()
+ *
+ * @param string $what
+ * @return void
+ */
+ public function clearCachedInfo($what)
+ {
+ unset($this->cachedInfo[$what]);
+ return;
+ }
+
+ /**
+ * Manager::_initCacheInfo()
+ * Loads some info on the first call only
+ *
+ * @param string $what 'installedPlugins'
+ * @return void
+ */
+ private function _initCacheInfo($what)
+ {
+ if ( array_key_exists($what, $this->cachedInfo)
+ && is_array($this->cachedInfo[$what]) )
+ {
+ return;
+ }
+
+ switch ($what)
+ {
+ // 'installedPlugins' = array ($pid => $name)
+ case 'installedPlugins':
+ $this->cachedInfo['installedPlugins'] = array();
+ $res = DB::getResult('SELECT pid, pfile FROM ' . sql_table('plugin'));
+ foreach ( $res as $row )
+ {
+ $this->cachedInfo['installedPlugins'][$row['pid']] = $row['pfile'];
+ }
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Manager::notify()
+ * A function to notify plugins that something has happened. Only the plugins
+ * that are subscribed to the event will get notified.
+ * Upon the first call, the list of subscriptions will be fetched from the
+ * database. The plugins itsself will only get loaded when they are first needed
+ *
+ * @param string $eventName Name of the event (method to be called on plugins)
+ * @param string $data Can contain any type of data,
+ * depending on the event type. Usually this is an itemid, blogid, ...
+ * but it can also be an array containing multiple values
+ * @return void
+ */
+ public function notify($eventName, $data)
+ {
+ // load subscription list if needed
+ if ( !is_array($this->subscriptions) )
+ {
+ $this->_loadSubscriptions();
+ }
+
+ // get listening objects
+ $listeners = false;
+ if ( array_key_exists($eventName, $this->subscriptions)
+ && !empty($this->subscriptions[$eventName]) )
+ {
+ $listeners = $this->subscriptions[$eventName];
+ }
+
+ // notify all of them
+ if ( is_array($listeners) )
+ {
+ foreach( $listeners as $listener )
+ {
+ // load class if needed
+ $this->_loadPlugin($listener);
+
+ // do notify (if method exists)
+ if ( array_key_exists($listener, $this->plugins)
+ && !empty($this->plugins[$listener])
+ && method_exists($this->plugins[$listener], 'event_' . $eventName) )
+ {
+ call_user_func(array(&$this->plugins[$listener],'event_' . $eventName), $data);
+ }
+ }
+ }
+ return;
+ }
+
+ /**
+ * Manager::_loadSubscriptions()
+ * Loads plugin subscriptions
+ *
+ * @param void
+ * @return void
+ */
+ private function _loadSubscriptions()
+ {
+ // initialize as array
+ $this->subscriptions = array();
+
+ $query = "SELECT p.pfile as pfile, e.event as event"
+ . " FROM %s as e, %s as p"
+ . " WHERE e.pid=p.pid ORDER BY p.porder ASC";
+ $query = sprintf($query, sql_table('plugin_event'), sql_table('plugin'));
+ $res = DB::getResult($query);
+
+ foreach ( $res as $row )
+ {
+ $pluginName = $row['pfile'];
+ $eventName = $row['event'];
+ $this->subscriptions[$eventName][] = $pluginName;
+ }
+ return;
+ }
+
+ /**
+ * Manager::getNumberOfSubscribers()
+ *
+ * @param string $event name of events
+ * @return integer number of event subscriber
+ */
+ public function getNumberOfSubscribers($event)
+ {
+ $query = 'SELECT COUNT(*) as count FROM %s WHERE event=%s;';
+ $query = sprintf($query, sql_table('plugin_event'), DB::quoteValue($event));
+ return (integer) DB::getValue($query);
+ }
+
+ /**
+ * Manager::addTicketToUrl()
+ * GET requests: Adds ticket to URL (URL should NOT be html-encoded!, ticket is added at the end)
+ *
+ * @param string url string for URI
+ * @return void
+ */
+ public function addTicketToUrl($url)
+ {
+ $ticketCode = 'ticket=' . $this->_generateTicket();
+ if ( i18n::strpos($url, '?') === FALSE )
+ {
+ $ticketCode = "{$url}?{$ticketCode}";
+ }
+ else
+ {
+ $ticketCode = "{$url}&{$ticketCode}";
+ }
+ return $ticketCode;
+ }
+
+ /**
+ * Manager::addTicketHidden()
+ * POST requests: Adds ticket as hidden formvar
+ *
+ * @param void
+ * @return void
+ */
+ public function addTicketHidden()
+ {
+ $ticket = $this->_generateTicket();
+ echo '<input type="hidden" name="ticket" value="', Entity::hsc($ticket), '" />';
+ return;
+ }
+
+ /**
+ * Manager::getNewTicket()
+ * Get a new ticket
+ * (xmlHTTPRequest AutoSaveDraft uses this to refresh the ticket)
+ *
+ * @param void
+ * @return string string of ticket
+ */
+ public function getNewTicket()
+ {
+ $this->currentRequestTicket = '';
+ return $this->_generateTicket();
+ }
+
+ /**
+ * Manager::checkTicket()
+ * Checks the ticket that was passed along with the current request
+ *
+ * @param void
+ * @return boolean correct or not
+ */
+ public function checkTicket()
+ {
+ global $member;
+
+ // get ticket from request
+ $ticket = requestVar('ticket');
+
+ // no ticket -> don't allow
+ if ( $ticket == '' )
+ {
+ return FALSE;
+ }
+
+ // remove expired tickets first
+ $this->_cleanUpExpiredTickets();
+
+ // get member id
+ if (!$member->isLoggedIn())
+ {
+ $memberId = -1;
+ }
+ else
+ {
+ $memberId = $member->getID();
+ }
+
+ // check if ticket is a valid one
+ $query = sprintf('SELECT COUNT(*) as result FROM %s WHERE member=%d and ticket=%s',
+ sql_table('tickets'),
+ intval($memberId),
+ DB::quoteValue($ticket)
+ );
+
+ /*
+ * NOTE:
+ * [in the original implementation, the checked ticket was deleted. This would lead to invalid
+ * tickets when using the browsers back button and clicking another link/form
+ * leaving the keys in the database is not a real problem, since they're member-specific and
+ * only valid for a period of one hour]
+ */
+ if ( DB::getValue($query) != 1 )
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+ /**
+ * Manager::_cleanUpExpiredTickets()
+ * Removes the expired tickets
+ *
+ * @param void
+ * @return void
+ */
+ private function _cleanUpExpiredTickets()
+ {
+ // remove tickets older than 1 hour
+ $oldTime = time() - 60 * 60;
+ $query = 'DELETE FROM %s WHERE ctime < %s';
+ $query = sprintf($query, sql_table('tickets'), DB::formatDateTime($oldTime));
+ DB::execute($query);
+ return;
+ }
+
+ /**
+ * Manager::_generateTicket()
+ * Generates/returns a ticket (one ticket per page request)
+ *
+ * @param void
+ * @return void
+ */
+ private function _generateTicket()
+ {
+ if ( $this->currentRequestTicket == '' )
+ {
+ // generate new ticket (only one ticket will be generated per page request)
+ // and store in database
+ global $member;
+ // get member id
+ if ( !$member->isLoggedIn() )
+ {
+ $memberId = -1;
+ }
+ else
+ {
+ $memberId = $member->getID();
+ }
+
+ $ok = false;
+ while ( !$ok )
+ {
+ // generate a random token
+ srand((double)microtime()*1000000);
+ $ticket = md5(uniqid(rand(), true));
+
+ // add in database as non-active
+ $query = 'INSERT INTO %s (ticket, member, ctime) VALUES (%s, %d, %s)';
+ $query = sprintf($query, sql_table('tickets'), DB::quoteValue($ticket), (integer) $memberId, DB::formatDateTime());
+
+ if ( DB::execute($query) !== FALSE )
+ {
+ $ok = true;
+ }
+ }
+ $this->currentRequestTicket = $ticket;
+ }
+ return $this->currentRequestTicket;
+ }
+}
+
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Media classes for nucleus\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: MEDIA.php 1870 2012-05-22 14:57:15Z sakamocchi $\r
- */\r
-\r
-define('PRIVATE_COLLECTION', 'Private Collection');\r
-define('READ_ONLY_MEDIA_FOLDER', '(Read Only)');\r
-\r
-class Media\r
-{\r
- static public $thumbdir = '.thumb';\r
- static public $algorism = 'md5';\r
- static public $image_mime = array(\r
- 'image/jpeg' => '.jpeg',\r
- 'image/png' => '.png',\r
- 'image/gif' => '.gif',\r
- );\r
- \r
- /**\r
- * Media::getCollectionList()\r
- * Gets the list of collections available to the currently logged\r
- * in member\r
- * \r
- * @param boolean $exceptReadOnly\r
- * @return array dirname => display name\r
- */\r
- static public function getCollectionList($exceptReadOnly = FALSE)\r
- {\r
- global $member, $DIR_MEDIA;\r
- \r
- $collections = array();\r
- \r
- // add private directory for member\r
- $collections[$member->getID()] = PRIVATE_COLLECTION;\r
- \r
- // add global collections\r
- if ( !is_dir($DIR_MEDIA) )\r
- {\r
- return $collections;\r
- }\r
- \r
- $dirhandle = opendir($DIR_MEDIA);\r
- while ( $dirname = readdir($dirhandle) )\r
- {\r
- // only add non-numeric (numeric=private) dirs\r
- if ( @is_dir($DIR_MEDIA . $dirname) &&\r
- ($dirname != '.') &&\r
- ($dirname != '..') &&\r
- ($dirname != self::$thumbdir) &&\r
- (!is_numeric($dirname)) )\r
- {\r
- if ( @is_writable($DIR_MEDIA . $dirname) )\r
- {\r
- $collections[$dirname] = $dirname;\r
- }\r
- else if ( $exceptReadOnly == FALSE )\r
- {\r
- $collections[$dirname] = $dirname . ' ' . READ_ONLY_MEDIA_FOLDER;\r
- }\r
- }\r
- }\r
- closedir($dirhandle);\r
- \r
- return $collections;\r
- }\r
- \r
- /**\r
- * Media::getMediaListByCollection()\r
- * Returns an array of MediaObject objects for a certain collection\r
- *\r
- * @param string $collection name of the collection\r
- * @param string $filter filter on filename (defaults to none)\r
- * @return void\r
- */\r
- static public function getMediaListByCollection($collection, $filter = '')\r
- {\r
- global $CONF, $DIR_MEDIA;\r
- \r
- $filelist = array();\r
- \r
- // 1. go through all objects and add them to the filelist\r
- $mediadir = $DIR_MEDIA . $collection . '/';\r
- \r
- // return if dir does not exist\r
- if ( !is_dir($mediadir) )\r
- {\r
- return $filelist;\r
- }\r
- \r
- $dirhandle = opendir($mediadir);\r
- while ( $filename = readdir($dirhandle) )\r
- {\r
- // only add files that match the filter\r
- if ( !is_dir($mediadir . $filename) && self::checkFilter($filename, $filter) )\r
- {\r
- array_push($filelist, new MediaObject($collection, $filename, $DIR_MEDIA));\r
- }\r
- }\r
- closedir($dirhandle);\r
- \r
- /* sort array */\r
- if ( !$CONF['MediaPrefix'] )\r
- {\r
- usort($filelist, array(__CLASS__, 'sort_media_by_timestamp'));\r
- }\r
- else\r
- {\r
- usort($filelist, array(__CLASS__, 'sort_media_by_filename'));\r
- }\r
- \r
- return $filelist;\r
- }\r
- \r
- /**\r
- * Media::checkFilter()\r
- * \r
- * @param string $strText\r
- * @param string $strFilter\r
- * @return boolean\r
- */\r
- static public function checkFilter($strText, $strFilter)\r
- {\r
- if ( $strFilter == '' )\r
- {\r
- return 1;\r
- }\r
- else\r
- {\r
- return is_integer(i18n::strpos(strtolower($strText), strtolower($strFilter)));\r
- }\r
- }\r
- \r
- /**\r
- * Media::isValidCollection()\r
- * checks if a collection exists with the given name, and if it's\r
- * allowed for the currently logged in member to upload files to it\r
- * \r
- * @param string $collectionName\r
- * @param string $exceptReadOnly\r
- * @return boolean\r
- */\r
- static public function isValidCollection($collectionName, $exceptReadOnly = FALSE)\r
- {\r
- global $member, $DIR_MEDIA;\r
- \r
- // allow creating new private directory\r
- if ( $collectionName === (string)$member->getID() )\r
- {\r
- return TRUE;\r
- }\r
- \r
- $collections = self::getCollectionList($exceptReadOnly);\r
- $dirname = $collections[$collectionName];\r
- \r
- if ( $dirname == NULL || $dirname === PRIVATE_COLLECTION )\r
- {\r
- return FALSE;\r
- }\r
- \r
- // other collections should exist and be writable\r
- $collectionDir = $DIR_MEDIA . $collectionName;\r
- if ( $exceptReadOnly )\r
- {\r
- return ( @is_dir($collectionDir) && @is_writable($collectionDir) );\r
- }\r
- \r
- // other collections should exist\r
- return @is_dir($collectionDir);\r
- }\r
- \r
- /**\r
- * Media::addMediaObject()\r
- * Adds an uploaded file to the media archive\r
- *\r
- * @param string $collection collection\r
- * @param array $uploadfile the postFileInfo(..) array\r
- * @param string $filename the filename that should be used to save the file as\r
- * (date prefix should be already added here)\r
- * @return string blank if success, message if failed\r
- */\r
- static public function addMediaObject($collection, $uploadfile, $filename)\r
- {\r
- global $DIR_MEDIA, $manager;\r
- \r
- // clean filename of characters that may cause trouble in a filename using cleanFileName() function from globalfunctions.php\r
- $filename = cleanFileName($filename);\r
- \r
- // should already have tested for allowable types before calling this method. This will only catch files with no extension at all\r
- if ( $filename === FALSE )\r
- {\r
- return _ERROR_BADFILETYPE;\r
- }\r
- \r
- // trigger PreMediaUpload event\r
- $manager->notify('PreMediaUpload',array('collection' => &$collection, 'uploadfile' => $uploadfile, 'filename' => &$filename));\r
- \r
- // don't allow uploads to unknown or forbidden collections\r
- $exceptReadOnly = TRUE;\r
- if ( !self::isValidCollection($collection,$exceptReadOnly) )\r
- {\r
- return _ERROR_DISALLOWED;\r
- }\r
- \r
- // check dir permissions (try to create dir if it does not exist)\r
- $mediadir = $DIR_MEDIA . $collection;\r
- \r
- // try to create new private media directories if needed\r
- if ( !@is_dir($mediadir) && is_numeric($collection) )\r
- {\r
- $oldumask = umask(0000);\r
- if ( !@mkdir($mediadir, 0777) )\r
- {\r
- return _ERROR_BADPERMISSIONS;\r
- }\r
- umask($oldumask);\r
- }\r
- \r
- // if dir still not exists, the action is disallowed\r
- if ( !@is_dir($mediadir) )\r
- {\r
- return _ERROR_DISALLOWED;\r
- }\r
- \r
- if ( !is_writeable($mediadir) )\r
- {\r
- return _ERROR_BADPERMISSIONS;\r
- }\r
- \r
- // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)\r
- $mediadir .= '/';\r
- \r
- if ( file_exists($mediadir . $filename) )\r
- {\r
- return _ERROR_UPLOADDUPLICATE;\r
- }\r
- \r
- // move file to directory\r
- if ( is_uploaded_file($uploadfile) )\r
- {\r
- if ( !@move_uploaded_file($uploadfile, $mediadir . $filename) )\r
- {\r
- return _ERROR_UPLOADMOVEP;\r
- }\r
- }\r
- else\r
- {\r
- if ( !copy($uploadfile, $mediadir . $filename) )\r
- {\r
- return _ERROR_UPLOADCOPY ;\r
- }\r
- }\r
- \r
- // chmod uploaded file\r
- $oldumask = umask(0000);\r
- @chmod($mediadir . $filename, 0644);\r
- umask($oldumask);\r
- \r
- $manager->notify('PostMediaUpload',array('collection' => $collection, 'mediadir' => $mediadir, 'filename' => $filename));\r
- \r
- return '';\r
- }\r
- \r
- /**\r
- * Media::addMediaObjectRaw()\r
- * Adds an uploaded file to the media dir.\r
- * \r
- * NOTE: does not check if $collection is valid.\r
- * \r
- * @param string $collection collection to use\r
- * @param string $filename the filename that should be used to save the file\r
- * as (date prefix should be already added here)\r
- * @param &$data File data (binary)\r
- * @return string blank if success, message if failed\r
- */\r
- static public function addMediaObjectRaw($collection, $filename, &$data)\r
- {\r
- global $DIR_MEDIA;\r
- \r
- // check dir permissions (try to create dir if it does not exist)\r
- $mediadir = $DIR_MEDIA . $collection;\r
- \r
- // try to create new private media directories if needed\r
- if ( !@is_dir($mediadir) && is_numeric($collection) )\r
- {\r
- $oldumask = umask(0000);\r
- if ( !@mkdir($mediadir, 0777) )\r
- {\r
- return _ERROR_BADPERMISSIONS;\r
- }\r
- umask($oldumask);\r
- }\r
- \r
- // if dir still not exists, the action is disallowed\r
- if ( !@is_dir($mediadir) )\r
- {\r
- return _ERROR_DISALLOWED;\r
- }\r
- \r
- if ( !is_writeable($mediadir) )\r
- {\r
- return _ERROR_BADPERMISSIONS;\r
- }\r
- \r
- // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)\r
- $mediadir .= '/';\r
- \r
- if ( file_exists($mediadir . $filename) )\r
- {\r
- return _ERROR_UPLOADDUPLICATE;\r
- }\r
- \r
- // create file\r
- $fh = @fopen($mediadir . $filename, 'wb');\r
- if ( !$fh )\r
- {\r
- return _ERROR_UPLOADFAILED;\r
- }\r
- $ok = @fwrite($fh, $data);\r
- @fclose($fh);\r
- if ( !$ok )\r
- {\r
- return _ERROR_UPLOADFAILED;\r
- }\r
- \r
- // chmod uploaded file\r
- $oldumask = umask(0000);\r
- @chmod($mediadir . $filename, 0644);\r
- umask($oldumask);\r
- \r
- return '';\r
- }\r
- \r
- /**\r
- * Media::responseResampledImage()\r
- * send resampled image via HTTP\r
- * \r
- * @param object $medium MediaObject Object\r
- * @exit\r
- */\r
- static public function responseResampledImage($medium, $maxwidth=0, $maxheight=0)\r
- {\r
- if ( get_class($medium) !== 'MediaObject' )\r
- {\r
- header("HTTP/1.1 500 Internal Server Error");\r
- exit('Nucleus CMS: Fail to generate resampled image');\r
- return;\r
- }\r
- \r
- $resampledimage = $medium->getResampledBinary($maxwidth, $maxheight);\r
- if ( $resampledimage === FALSE )\r
- {\r
- unset($resampledimage);\r
- header("HTTP/1.1 503 Service Unavailable");\r
- exit('Nucleus CMS: Fail to generate resampled image');\r
- return;\r
- }\r
- \r
- header("Content-type: {$medium->mime}");\r
- echo $resampledimage;\r
- \r
- unset($resampledimage);\r
- \r
- exit;\r
- }\r
- \r
- /**\r
- * Media::storeResampledImage()\r
- * Store resampled image binary to filesystem as file\r
- * \r
- * @param object $medium MediaObject Object\r
- * @param integer $maxwidth maximum width\r
- * @param integer $maxheight maximum height\r
- * @param string $path directory path for destination\r
- * @param string $name file name for destination\r
- * @return boolean\r
- */\r
- static public function storeResampledImage($medium, $maxwidth=0, $maxheight=0, $path='', $name='')\r
- {\r
- global $DIR_MEDIA;\r
- \r
- if ( get_class($medium) !== 'MediaObject' )\r
- {\r
- return FALSE;\r
- }\r
- \r
- if ( $path !== '' )\r
- {\r
- $path = realpath($path);\r
- if ( !file_exists($path)\r
- || strpos($path, $DIR_MEDIA) !== 0 )\r
- {\r
- return FALSE;\r
- }\r
- }\r
- else\r
- {\r
- $path = '$DIR_MEDIA/' . self::$thumbdir;\r
- }\r
- \r
- if ( $name === '' )\r
- {\r
- $name = $medium->getHashedname();\r
- }\r
- \r
- $resampledimage = $medium->getResampledBinary($maxwidth, $maxheight);\r
- if ( !$resampledimage )\r
- {\r
- unset($resampledimage);\r
- return FALSE;\r
- }\r
- \r
- $handle = @fopen("{$path}/{$name}", 'w');\r
- if ( !$handle )\r
- {\r
- unset ($resampledimage);\r
- return FALSE;\r
- }\r
- \r
- if ( !@fwrite($handle, $resampledimage) )\r
- {\r
- unset($resampledimage);\r
- @unlink("{$path}/{$name}");\r
- return FALSE;\r
- }\r
- \r
- unset($resampledimage);\r
- fclose($handle);\r
- \r
- if ( !@chmod("{$path}/{$name}", 0774) )\r
- {\r
- @unlink("{$path}/{$name}");\r
- return FALSE;\r
- }\r
- \r
- return TRUE;\r
- }\r
- \r
- /**\r
- * Media::sort_media_by_timestamp()\r
- * User-defined sort method to sort an array of MediaObjects\r
- * \r
- * @param object $a\r
- * @param object $b\r
- * @return boolean\r
- */\r
- static private function sort_media_by_timestamp($a, $b)\r
- {\r
- if ($a->timestamp == $b->timestamp) return 0;\r
- return ($a->timestamp > $b->timestamp) ? -1 : 1;\r
- }\r
- \r
- /**\r
- * Media::sort_media_by_filename()\r
- * User-defined sort method to sort an array of MediaObjects\r
- * \r
- * @param object $a\r
- * @param object $b\r
- * @return boolean\r
- */\r
- static private function sort_media_by_filename($a, $b)\r
- {\r
- if ($a->filename == $b->filename) return 0;\r
- return ($a->filename > $b->filename) ? -1 : 1;\r
- }\r
-}\r
-\r
-class MediaObject\r
-{\r
- public $mime = '';\r
- \r
- public $root = '';\r
- public $path = '';\r
- public $private;\r
- public $collection;\r
- public $filename = '';\r
- \r
- public $prefix = '';\r
- public $name = '';\r
- public $suffix = '';\r
- \r
- public $timestamp = 0;\r
- public $size = 0;\r
- \r
- public $width = 0;\r
- public $height = 0;\r
- public $resampledwidth = 0;\r
- public $resampledheight = 0;\r
- \r
- /**\r
- * MediaObject::__construct()\r
- * \r
- * @param string $collection \r
- * @param string $filename \r
- * @param string $root fullpath to media directory\r
- */\r
- public function __construct($collection, $filename, $root=0)\r
- {\r
- global $CONF, $DIR_MEDIA;\r
- \r
- /* for backward compatibility */\r
- if ( is_numeric($root) )\r
- {\r
- $root = $DIR_MEDIA;\r
- }\r
- \r
- $root = preg_replace('#/*$#', '', $root);\r
- \r
- /* get and validate fullpath for the medium */\r
- if ( !file_exists($root)\r
- || FALSE === ($fullpath = realpath("{$root}/{$collection}/{$filename}"))\r
- || strpos($fullpath, $root) !== 0\r
- || !file_exists($fullpath) )\r
- {\r
- return FALSE;\r
- }\r
- \r
- /* store fundamentals */\r
- $this->root = $root;\r
- $this->private = (integer) $collection;\r
- $this->collection = $collection;\r
- $this->filename = basename($fullpath);\r
- $this->timestamp = filemtime($fullpath);\r
- \r
- /* store relative directory path from root directory for media */\r
- $this->path = preg_replace(array("#{$this->root}/#", "#/{$this->filename}#"), '', $fullpath);\r
- if ( $this->path === $this->name )\r
- {\r
- $this->path = ''; \r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * MediaObject::refine()\r
- * refine data\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function refine()\r
- {\r
- global $CONF;\r
- \r
- /* store size (byte order) */\r
- $this->size = filesize("{$this->root}/{$this->path}/{$this->filename}");\r
- \r
- /* get width and height if this is image binary */\r
- if ( FALSE === ($info = @getimagesize ("{$this->root}/{$this->path}/{$this->filename}")) )\r
- {\r
- $this->mime = 'application/octet-stream';\r
- $this->width = 0;\r
- $this->height = 0;\r
- }\r
- else\r
- {\r
- $this->mime = $info['mime'];\r
- $this->width = $info[0];\r
- $this->height = $info[1];\r
- }\r
- \r
- /* utilise Fileinfo subsystem if available */\r
- if ( defined('FILEINFO_MIME_TYPE') && function_exists ('finfo_open')\r
- && (FALSE !== ($info = finfo_open(FILEINFO_MIME_TYPE))) )\r
- {\r
- $this->mime = finfo_file($info, "{$this->root}/{$this->path}/{$this->filename}");\r
- }\r
- \r
- /* store data with parsed filename */\r
- if ( preg_match('#^(.*)\.([a-zA-Z0-9]{2,})$#', $this->filename, $info) === 1 )\r
- {\r
- $this->name = $info[1];\r
- $this->suffix = $info[2];\r
- \r
- if ( $CONF['MediaPrefix'] && preg_match('#^([0-9]{8})\-(.*)$#', $this->name, $info) == 1 )\r
- {\r
- $this->prefix = preg_replace('#^([0-9]{4})([0-9]{2})([0-9]{2})$#', '$1/$2/$3', $info[1]);\r
- $this->name = $info[2];\r
- }\r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * MediaObject::setResampledSize()\r
- * Set resampled size\r
- * \r
- * @param integer $maxwidth\r
- * @param integer $maxheight\r
- * @return boolean\r
- */\r
- public function setResampledSize($maxwidth=0, $maxheight=0)\r
- {\r
- if ( ($maxwidth == 0) && ($maxheight == 0) )\r
- {\r
- return FALSE;\r
- }\r
- else if ( $this->width == 0 || $this->height == 0 )\r
- {\r
- return FALSE;\r
- }\r
- else if ($this->width < $maxwidth && $this->height < $maxheight )\r
- {\r
- $this->resampledwidth = $this->width;\r
- $this->resampledheight = $this->height;\r
- }\r
- else if ( $maxheight == 0 || $this->width > $this->height )\r
- {\r
- $this->resampledheight = intval ($this->height * $maxwidth / $this->width);\r
- $this->resampledwidth = $maxwidth;\r
- }\r
- else if ( $maxwidth == 0 || $this->width <= $this->height )\r
- {\r
- $this->resampledwidth = intval ($this->width * $maxheight / $this->height);\r
- $this->resampledheight = $maxheight;\r
- }\r
- return TRUE;\r
- }\r
- \r
- /**\r
- * MediaObject::getResampledBinary()\r
- * Return resampled image binary\r
- * \r
- * @param void\r
- * @return mixed binary if success, FALSE if failed\r
- */\r
- public function getResampledBinary($maxwidth=0, $maxheight=0)\r
- {\r
- static $gdinfo = array();\r
- static $original;\r
- static $resampledimage;\r
- \r
- if ( !$this->setResampledSize($maxwidth, $maxheight) )\r
- {\r
- return FALSE;\r
- }\r
- \r
- if ( $gdinfo = array() )\r
- {\r
- $gdinfo = gd_info();\r
- }\r
- \r
- if ( $this->path !== '' )\r
- {\r
- $fullpath = "{$this->root}/{$this->path}/{$this->name}";\r
- }\r
- else\r
- {\r
- $fullpath = "{$this->root}/{$this->name}";\r
- }\r
- if ( !file_exists($fullpath) )\r
- {\r
- return FALSE;\r
- }\r
- \r
- if ( !array_key_exists($this->mime, Media::$image_mime)\r
- || $this->width == 0\r
- || $this->height == 0\r
- || $this->resampledwidth == 0\r
- || $this->resampledheight == 0 )\r
- {\r
- return FALSE;\r
- }\r
- \r
- /* check current available memory */\r
- $memorymax = trim(ini_get("memory_limit"));\r
- switch ( strtolower ($memorymax[strlen($memorymax)-1]) )\r
- {\r
- case 'g':\r
- $memorymax *= 1024;\r
- case 'm':\r
- $memorymax *= 1024;\r
- case 'k':\r
- $memorymax *= 1024;\r
- }\r
- \r
- /*\r
- * this code is based on analyze if gd.c in php source code\r
- * if you can read C/C++, please check these elements and notify us if you have some ideas\r
- */\r
- if ( (memory_get_usage()\r
- + ($this->resampledwidth * $this->resampledheight * 5 + $this->resampledheight * 24 + 10000)\r
- + ($this->width * $this->height * 5 + $this->height * 24 + 10000))\r
- > $memorymax )\r
- {\r
- return FALSE;\r
- }\r
- \r
- switch ( $this->mime )\r
- {\r
- case 'image/gif':\r
- if ( (!array_key_exists('GIF Read Support', $gdinfo) || !isset($gdinfo['GIF Read Support']))\r
- || (!array_key_exists('GIF Create Support', $gdinfo) || !isset($gdinfo['GIF Create Support'])) )\r
- {\r
- return FALSE;\r
- }\r
- $function = 'imagecreatefromgif';\r
- break;\r
- case 'image/jpeg':\r
- if ( (!array_key_exists('JPEG Support', $gdinfo) || !isset($gdinfo['JPEG Support']))\r
- && (!array_key_exists('JPG Support', $gdinfo) || !isset($gdinfo['JPG Support'])) )\r
- {\r
- return FALSE;\r
- }\r
- $function = 'imagecreatefromjpeg';\r
- break;\r
- case 'image/png':\r
- if ( !array_key_exists('PNG Support', $gdinfo) || !isset($gdinfo['PNG Support']) )\r
- {\r
- return FALSE;\r
- }\r
- $function = 'imagecreatefrompng';\r
- break;\r
- default:\r
- return FALSE;\r
- }\r
- \r
- if ( !is_callable($function) )\r
- {\r
- return FALSE;\r
- }\r
- \r
- $original = call_user_func_array($function, array(&$fullpath));\r
- if ( !$original )\r
- {\r
- return FALSE;\r
- }\r
- \r
- $resampledimage = imagecreatetruecolor($this->resampledwidth, $this->resampledheight);\r
- if ( !$resampledimage )\r
- {\r
- imagedestroy($original);\r
- return FALSE;\r
- }\r
- \r
- @set_time_limit(ini_get('max_execution_time'));\r
- if ( !ImageCopyResampled($resampledimage, $original, 0, 0, 0, 0, $this->resampledwidth, $this->resampledheight, $this->width, $this->height) )\r
- {\r
- return FALSE;\r
- }\r
- \r
- imagedestroy($original);\r
- \r
- ob_start();\r
- \r
- switch ( $this->mime )\r
- {\r
- case 'image/gif':\r
- imagegif($resampledimage);\r
- break;\r
- case 'image/jpeg':\r
- imagejpeg($resampledimage);\r
- break;\r
- case 'image/png':\r
- imagepng($resampledimage);\r
- break;\r
- case 'image/bmp':\r
- case 'image/x-ms-bmp':\r
- imagepng($resampledimage);\r
- break;\r
- default:\r
- return FALSE;\r
- }\r
- \r
- imagedestroy($resampledimage);\r
- \r
- return ob_get_clean();\r
- }\r
- \r
- public function getHashedName()\r
- {\r
- return (string) hash(Media::$algorism, "{$this->path}/{$this->name}", FALSE);\r
- }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Media classes for nucleus
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: MEDIA.php 1875 2012-06-17 07:30:44Z sakamocchi $
+ */
+
+define('PRIVATE_COLLECTION', 'Private Collection');
+define('READ_ONLY_MEDIA_FOLDER', '(Read Only)');
+
+class Media
+{
+ static public $thumbdir = '.thumb';
+ static public $algorism = 'md5';
+ static public $image_mime = array(
+ 'image/jpeg' => '.jpeg',
+ 'image/png' => '.png',
+ 'image/gif' => '.gif',
+ );
+
+ /**
+ * Media::getCollectionList()
+ * Gets the list of collections available to the currently logged
+ * in member
+ *
+ * @param boolean $exceptReadOnly
+ * @return array dirname => display name
+ */
+ static public function getCollectionList($exceptReadOnly = FALSE)
+ {
+ global $member, $DIR_MEDIA;
+
+ $collections = array();
+
+ // add private directory for member
+ $collections[$member->getID()] = PRIVATE_COLLECTION;
+
+ // add global collections
+ if ( !is_dir($DIR_MEDIA) )
+ {
+ return $collections;
+ }
+
+ $dirhandle = opendir($DIR_MEDIA);
+ while ( $dirname = readdir($dirhandle) )
+ {
+ // only add non-numeric (numeric=private) dirs
+ if ( @is_dir($DIR_MEDIA . $dirname) &&
+ ($dirname != '.') &&
+ ($dirname != '..') &&
+ ($dirname != self::$thumbdir) &&
+ (!is_numeric($dirname)) )
+ {
+ if ( @is_writable($DIR_MEDIA . $dirname) )
+ {
+ $collections[$dirname] = $dirname;
+ }
+ else if ( $exceptReadOnly == FALSE )
+ {
+ $collections[$dirname] = $dirname . ' ' . READ_ONLY_MEDIA_FOLDER;
+ }
+ }
+ }
+ closedir($dirhandle);
+
+ return $collections;
+ }
+
+ /**
+ * Media::getMediaListByCollection()
+ * Returns an array of MediaObject objects for a certain collection
+ *
+ * @param string $collection name of the collection
+ * @param string $filter filter on filename (defaults to none)
+ * @return void
+ */
+ static public function getMediaListByCollection($collection, $filter = '')
+ {
+ global $CONF, $DIR_MEDIA;
+
+ $filelist = array();
+
+ // 1. go through all objects and add them to the filelist
+ $mediadir = $DIR_MEDIA . $collection . '/';
+
+ // return if dir does not exist
+ if ( !is_dir($mediadir) )
+ {
+ return $filelist;
+ }
+
+ $dirhandle = opendir($mediadir);
+ while ( $filename = readdir($dirhandle) )
+ {
+ // only add files that match the filter
+ if ( !is_dir($mediadir . $filename) && self::checkFilter($filename, $filter) )
+ {
+ array_push($filelist, new MediaObject($collection, $filename, $DIR_MEDIA));
+ }
+ }
+ closedir($dirhandle);
+
+ /* sort array */
+ if ( !$CONF['MediaPrefix'] )
+ {
+ usort($filelist, array(__CLASS__, 'sort_media_by_timestamp'));
+ }
+ else
+ {
+ usort($filelist, array(__CLASS__, 'sort_media_by_filename'));
+ }
+
+ return $filelist;
+ }
+
+ /**
+ * Media::checkFilter()
+ *
+ * @param string $strText
+ * @param string $strFilter
+ * @return boolean
+ */
+ static public function checkFilter($strText, $strFilter)
+ {
+ if ( $strFilter == '' )
+ {
+ return 1;
+ }
+ else
+ {
+ return is_integer(i18n::strpos(strtolower($strText), strtolower($strFilter)));
+ }
+ }
+
+ /**
+ * Media::isValidCollection()
+ * checks if a collection exists with the given name, and if it's
+ * allowed for the currently logged in member to upload files to it
+ *
+ * @param string $collectionName
+ * @param string $exceptReadOnly
+ * @return boolean
+ */
+ static public function isValidCollection($collectionName, $exceptReadOnly = FALSE)
+ {
+ global $member, $DIR_MEDIA;
+
+ // allow creating new private directory
+ if ( $collectionName === (string)$member->getID() )
+ {
+ return TRUE;
+ }
+
+ $collections = self::getCollectionList($exceptReadOnly);
+ $dirname = $collections[$collectionName];
+
+ if ( $dirname == NULL || $dirname === PRIVATE_COLLECTION )
+ {
+ return FALSE;
+ }
+
+ // other collections should exist and be writable
+ $collectionDir = $DIR_MEDIA . $collectionName;
+ if ( $exceptReadOnly )
+ {
+ return ( @is_dir($collectionDir) && @is_writable($collectionDir) );
+ }
+
+ // other collections should exist
+ return @is_dir($collectionDir);
+ }
+
+ /**
+ * Media::addMediaObject()
+ * Adds an uploaded file to the media archive
+ *
+ * @param string $collection collection
+ * @param array $uploadfile the postFileInfo(..) array
+ * @param string $filename the filename that should be used to save the file as
+ * (date prefix should be already added here)
+ * @return string blank if success, message if failed
+ */
+ static public function addMediaObject($collection, $uploadfile, $filename)
+ {
+ global $DIR_MEDIA, $manager;
+
+ // clean filename of characters that may cause trouble in a filename using cleanFileName() function from globalfunctions.php
+ $filename = cleanFileName($filename);
+
+ // should already have tested for allowable types before calling this method. This will only catch files with no extension at all
+ if ( $filename === FALSE )
+ {
+ return _ERROR_BADFILETYPE;
+ }
+
+ // trigger PreMediaUpload event
+ $manager->notify('PreMediaUpload',array('collection' => &$collection, 'uploadfile' => $uploadfile, 'filename' => &$filename));
+
+ // don't allow uploads to unknown or forbidden collections
+ $exceptReadOnly = TRUE;
+ if ( !self::isValidCollection($collection,$exceptReadOnly) )
+ {
+ return _ERROR_DISALLOWED;
+ }
+
+ // check dir permissions (try to create dir if it does not exist)
+ $mediadir = $DIR_MEDIA . $collection;
+
+ // try to create new private media directories if needed
+ if ( !@is_dir($mediadir) && is_numeric($collection) )
+ {
+ $oldumask = umask(0000);
+ if ( !@mkdir($mediadir, 0777) )
+ {
+ return _ERROR_BADPERMISSIONS;
+ }
+ umask($oldumask);
+ }
+
+ // if dir still not exists, the action is disallowed
+ if ( !@is_dir($mediadir) )
+ {
+ return _ERROR_DISALLOWED;
+ }
+
+ if ( !is_writeable($mediadir) )
+ {
+ return _ERROR_BADPERMISSIONS;
+ }
+
+ // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)
+ $mediadir .= '/';
+
+ if ( file_exists($mediadir . $filename) )
+ {
+ return _ERROR_UPLOADDUPLICATE;
+ }
+
+ // move file to directory
+ if ( is_uploaded_file($uploadfile) )
+ {
+ if ( !@move_uploaded_file($uploadfile, $mediadir . $filename) )
+ {
+ return _ERROR_UPLOADMOVEP;
+ }
+ }
+ else
+ {
+ if ( !copy($uploadfile, $mediadir . $filename) )
+ {
+ return _ERROR_UPLOADCOPY ;
+ }
+ }
+
+ // chmod uploaded file
+ $oldumask = umask(0000);
+ @chmod($mediadir . $filename, 0644);
+ umask($oldumask);
+
+ $manager->notify('PostMediaUpload',array('collection' => $collection, 'mediadir' => $mediadir, 'filename' => $filename));
+
+ return '';
+ }
+
+ /**
+ * Media::addMediaObjectRaw()
+ * Adds an uploaded file to the media dir.
+ *
+ * NOTE: does not check if $collection is valid.
+ *
+ * @param string $collection collection to use
+ * @param string $filename the filename that should be used to save the file
+ * as (date prefix should be already added here)
+ * @param &$data File data (binary)
+ * @return string blank if success, message if failed
+ */
+ static public function addMediaObjectRaw($collection, $filename, &$data)
+ {
+ global $DIR_MEDIA;
+
+ // check dir permissions (try to create dir if it does not exist)
+ $mediadir = $DIR_MEDIA . $collection;
+
+ // try to create new private media directories if needed
+ if ( !@is_dir($mediadir) && is_numeric($collection) )
+ {
+ $oldumask = umask(0000);
+ if ( !@mkdir($mediadir, 0777) )
+ {
+ return _ERROR_BADPERMISSIONS;
+ }
+ umask($oldumask);
+ }
+
+ // if dir still not exists, the action is disallowed
+ if ( !@is_dir($mediadir) )
+ {
+ return _ERROR_DISALLOWED;
+ }
+
+ if ( !is_writeable($mediadir) )
+ {
+ return _ERROR_BADPERMISSIONS;
+ }
+
+ // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)
+ $mediadir .= '/';
+
+ if ( file_exists($mediadir . $filename) )
+ {
+ return _ERROR_UPLOADDUPLICATE;
+ }
+
+ // create file
+ $fh = @fopen($mediadir . $filename, 'wb');
+ if ( !$fh )
+ {
+ return _ERROR_UPLOADFAILED;
+ }
+ $ok = @fwrite($fh, $data);
+ @fclose($fh);
+ if ( !$ok )
+ {
+ return _ERROR_UPLOADFAILED;
+ }
+
+ // chmod uploaded file
+ $oldumask = umask(0000);
+ @chmod($mediadir . $filename, 0644);
+ umask($oldumask);
+
+ return '';
+ }
+
+ /**
+ * Media::responseResampledImage()
+ * send resampled image via HTTP
+ *
+ * @param object $medium MediaObject Object
+ * @exit
+ */
+ static public function responseResampledImage($medium, $maxwidth=0, $maxheight=0)
+ {
+ if ( get_class($medium) !== 'MediaObject' )
+ {
+ header("HTTP/1.1 500 Internal Server Error");
+ exit('Nucleus CMS: Fail to generate resampled image');
+ return;
+ }
+
+ $resampledimage = $medium->getResampledBinary($maxwidth, $maxheight);
+ if ( $resampledimage === FALSE )
+ {
+ unset($resampledimage);
+ header("HTTP/1.1 503 Service Unavailable");
+ exit('Nucleus CMS: Fail to generate resampled image');
+ return;
+ }
+
+ header("Content-type: {$medium->mime}");
+ echo $resampledimage;
+
+ unset($resampledimage);
+
+ exit;
+ }
+
+ /**
+ * Media::storeResampledImage()
+ * Store resampled image binary to filesystem as file
+ *
+ * @param object $medium MediaObject Object
+ * @param integer $maxwidth maximum width
+ * @param integer $maxheight maximum height
+ * @param string $path directory path for destination
+ * @param string $name file name for destination
+ * @return boolean
+ */
+ static public function storeResampledImage($medium, $maxwidth=0, $maxheight=0, $path='', $name='')
+ {
+ global $DIR_MEDIA;
+
+ if ( get_class($medium) !== 'MediaObject' )
+ {
+ return FALSE;
+ }
+
+ if ( $path !== '' )
+ {
+ $path = realpath($path);
+ if ( !file_exists($path)
+ || strpos($path, $DIR_MEDIA) !== 0 )
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ $path = '$DIR_MEDIA/' . self::$thumbdir;
+ }
+
+ if ( $name === '' )
+ {
+ $name = $medium->getHashedname();
+ }
+
+ $resampledimage = $medium->getResampledBinary($maxwidth, $maxheight);
+ if ( !$resampledimage )
+ {
+ unset($resampledimage);
+ return FALSE;
+ }
+
+ $handle = @fopen("{$path}/{$name}", 'w');
+ if ( !$handle )
+ {
+ unset ($resampledimage);
+ return FALSE;
+ }
+
+ if ( !@fwrite($handle, $resampledimage) )
+ {
+ unset($resampledimage);
+ @unlink("{$path}/{$name}");
+ return FALSE;
+ }
+
+ unset($resampledimage);
+ fclose($handle);
+
+ if ( !@chmod("{$path}/{$name}", 0774) )
+ {
+ @unlink("{$path}/{$name}");
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+ /**
+ * Media::sort_media_by_timestamp()
+ * User-defined sort method to sort an array of MediaObjects
+ *
+ * @param object $a
+ * @param object $b
+ * @return boolean
+ */
+ static private function sort_media_by_timestamp($a, $b)
+ {
+ if ($a->timestamp == $b->timestamp) return 0;
+ return ($a->timestamp > $b->timestamp) ? -1 : 1;
+ }
+
+ /**
+ * Media::sort_media_by_filename()
+ * User-defined sort method to sort an array of MediaObjects
+ *
+ * @param object $a
+ * @param object $b
+ * @return boolean
+ */
+ static private function sort_media_by_filename($a, $b)
+ {
+ if ($a->filename == $b->filename) return 0;
+ return ($a->filename > $b->filename) ? -1 : 1;
+ }
+}
+
+class MediaObject
+{
+ public $mime = '';
+
+ public $root = '';
+ public $path = '';
+ public $private;
+ public $collection;
+ public $filename = '';
+
+ public $prefix = '';
+ public $name = '';
+ public $suffix = '';
+
+ public $timestamp = 0;
+ public $size = 0;
+
+ public $width = 0;
+ public $height = 0;
+ public $resampledwidth = 0;
+ public $resampledheight = 0;
+
+ /**
+ * MediaObject::__construct()
+ *
+ * @param string $collection
+ * @param string $filename
+ * @param string $root fullpath to media directory
+ */
+ public function __construct($collection, $filename, $root=0)
+ {
+ global $CONF, $DIR_MEDIA;
+
+ /* for backward compatibility */
+ if ( is_numeric($root) )
+ {
+ $root = $DIR_MEDIA;
+ }
+
+ $root = preg_replace('#/*$#', '', $root);
+
+ /* get and validate fullpath for the medium */
+ if ( !file_exists($root)
+ || FALSE === ($fullpath = realpath("{$root}/{$collection}/{$filename}"))
+ || strpos($fullpath, $root) !== 0
+ || !file_exists($fullpath) )
+ {
+ return FALSE;
+ }
+
+ /* store fundamentals */
+ $this->root = $root;
+ $this->private = (integer) $collection;
+ $this->collection = $collection;
+ $this->filename = basename($fullpath);
+ $this->timestamp = filemtime($fullpath);
+
+ /* store relative directory path from root directory for media */
+ $this->path = preg_replace(array("#{$this->root}/#", "#/{$this->filename}#"), '', $fullpath);
+ if ( $this->path === $this->name )
+ {
+ $this->path = '';
+ }
+
+ return;
+ }
+
+ /**
+ * MediaObject::refine()
+ * refine data
+ *
+ * @param void
+ * @return void
+ */
+ public function refine()
+ {
+ global $CONF;
+
+ /* store size (byte order) */
+ $this->size = filesize("{$this->root}/{$this->path}/{$this->filename}");
+
+ /* get width and height if this is image binary */
+ if ( FALSE === ($info = @getimagesize ("{$this->root}/{$this->path}/{$this->filename}")) )
+ {
+ $this->mime = 'application/octet-stream';
+ $this->width = 0;
+ $this->height = 0;
+ }
+ else
+ {
+ $this->mime = $info['mime'];
+ $this->width = $info[0];
+ $this->height = $info[1];
+ }
+
+ /* utilise Fileinfo subsystem if available */
+ if ( defined('FILEINFO_MIME_TYPE') && function_exists ('finfo_open')
+ && (FALSE !== ($info = finfo_open(FILEINFO_MIME_TYPE))) )
+ {
+ $this->mime = finfo_file($info, "{$this->root}/{$this->path}/{$this->filename}");
+ }
+
+ /* store data with parsed filename */
+ if ( preg_match('#^(.*)\.([a-zA-Z0-9]{2,})$#', $this->filename, $info) === 1 )
+ {
+ $this->name = $info[1];
+ $this->suffix = $info[2];
+
+ if ( $CONF['MediaPrefix'] && preg_match('#^([0-9]{8})\-(.*)$#', $this->name, $info) == 1 )
+ {
+ $this->prefix = preg_replace('#^([0-9]{4})([0-9]{2})([0-9]{2})$#', '$1/$2/$3', $info[1]);
+ $this->name = $info[2];
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * MediaObject::setResampledSize()
+ * Set resampled size
+ *
+ * @param integer $maxwidth
+ * @param integer $maxheight
+ * @return boolean
+ */
+ public function setResampledSize($maxwidth=0, $maxheight=0)
+ {
+ if ( ($maxwidth == 0) && ($maxheight == 0) )
+ {
+ return FALSE;
+ }
+ else if ( $this->width == 0 || $this->height == 0 )
+ {
+ return FALSE;
+ }
+ else if ($this->width < $maxwidth && $this->height < $maxheight )
+ {
+ $this->resampledwidth = $this->width;
+ $this->resampledheight = $this->height;
+ }
+ else if ( $maxheight == 0 || $this->width > $this->height )
+ {
+ $this->resampledheight = intval ($this->height * $maxwidth / $this->width);
+ $this->resampledwidth = $maxwidth;
+ }
+ else if ( $maxwidth == 0 || $this->width <= $this->height )
+ {
+ $this->resampledwidth = intval ($this->width * $maxheight / $this->height);
+ $this->resampledheight = $maxheight;
+ }
+ return TRUE;
+ }
+
+ /**
+ * MediaObject::getResampledBinary()
+ * Return resampled image binary
+ *
+ * @param void
+ * @return mixed binary if success, FALSE if failed
+ */
+ public function getResampledBinary($maxwidth=0, $maxheight=0)
+ {
+ static $gdinfo = array();
+ static $original;
+ static $resampledimage;
+
+ if ( !$this->setResampledSize($maxwidth, $maxheight) )
+ {
+ return FALSE;
+ }
+
+ if ( $gdinfo = array() )
+ {
+ $gdinfo = gd_info();
+ }
+
+ if ( $this->path !== '' )
+ {
+ $fullpath = "{$this->root}/{$this->path}/{$this->name}";
+ }
+ else
+ {
+ $fullpath = "{$this->root}/{$this->name}";
+ }
+ if ( !file_exists($fullpath) )
+ {
+ return FALSE;
+ }
+
+ if ( !array_key_exists($this->mime, Media::$image_mime)
+ || $this->width == 0
+ || $this->height == 0
+ || $this->resampledwidth == 0
+ || $this->resampledheight == 0 )
+ {
+ return FALSE;
+ }
+
+ /* check current available memory */
+ $memorymax = trim(ini_get("memory_limit"));
+ switch ( strtolower ($memorymax[strlen($memorymax)-1]) )
+ {
+ case 'g':
+ $memorymax *= 1024;
+ case 'm':
+ $memorymax *= 1024;
+ case 'k':
+ $memorymax *= 1024;
+ }
+
+ /*
+ * this code is based on analyze if gd.c in php source code
+ * if you can read C/C++, please check these elements and notify us if you have some ideas
+ */
+ if ( (memory_get_usage()
+ + ($this->resampledwidth * $this->resampledheight * 5 + $this->resampledheight * 24 + 10000)
+ + ($this->width * $this->height * 5 + $this->height * 24 + 10000))
+ > $memorymax )
+ {
+ return FALSE;
+ }
+
+ switch ( $this->mime )
+ {
+ case 'image/gif':
+ if ( (!array_key_exists('GIF Read Support', $gdinfo) || !isset($gdinfo['GIF Read Support']))
+ || (!array_key_exists('GIF Create Support', $gdinfo) || !isset($gdinfo['GIF Create Support'])) )
+ {
+ return FALSE;
+ }
+ $function = 'imagecreatefromgif';
+ break;
+ case 'image/jpeg':
+ if ( (!array_key_exists('JPEG Support', $gdinfo) || !isset($gdinfo['JPEG Support']))
+ && (!array_key_exists('JPG Support', $gdinfo) || !isset($gdinfo['JPG Support'])) )
+ {
+ return FALSE;
+ }
+ $function = 'imagecreatefromjpeg';
+ break;
+ case 'image/png':
+ if ( !array_key_exists('PNG Support', $gdinfo) || !isset($gdinfo['PNG Support']) )
+ {
+ return FALSE;
+ }
+ $function = 'imagecreatefrompng';
+ break;
+ default:
+ return FALSE;
+ }
+
+ if ( !is_callable($function) )
+ {
+ return FALSE;
+ }
+
+ $original = call_user_func_array($function, array(&$fullpath));
+ if ( !$original )
+ {
+ return FALSE;
+ }
+
+ $resampledimage = imagecreatetruecolor($this->resampledwidth, $this->resampledheight);
+ if ( !$resampledimage )
+ {
+ imagedestroy($original);
+ return FALSE;
+ }
+
+ @set_time_limit(ini_get('max_execution_time'));
+ if ( !ImageCopyResampled($resampledimage, $original, 0, 0, 0, 0, $this->resampledwidth, $this->resampledheight, $this->width, $this->height) )
+ {
+ return FALSE;
+ }
+
+ imagedestroy($original);
+
+ ob_start();
+
+ switch ( $this->mime )
+ {
+ case 'image/gif':
+ imagegif($resampledimage);
+ break;
+ case 'image/jpeg':
+ imagejpeg($resampledimage);
+ break;
+ case 'image/png':
+ imagepng($resampledimage);
+ break;
+ case 'image/bmp':
+ case 'image/x-ms-bmp':
+ imagepng($resampledimage);
+ break;
+ default:
+ return FALSE;
+ }
+
+ imagedestroy($resampledimage);
+
+ return ob_get_clean();
+ }
+
+ public function getHashedName()
+ {
+ return (string) hash(Media::$algorism, "{$this->path}/{$this->name}", FALSE);
+ }
+}
-<?php\r
-\r
-/* \r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- * \r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class representing site members\r
- * \r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: MEMBER.php 1616 2012-01-08 09:48:15Z sakamocchi $\r
- */\r
-class Member\r
-{\r
- // 1 when authenticated, 0 when not\r
- public $loggedin = 0;\r
- public $password; // not the actual password, but rather a MD5 hash\r
- private $algorism = 'md5';\r
- \r
- public $cookiekey; // value that should also be in the client cookie to allow authentication\r
- private $cookie_salt = FALSE;\r
- \r
- // member info\r
- public $id = -1;\r
- public $realname;\r
- public $displayname;\r
- public $email;\r
- public $url;\r
- public $admin = 0; // (either 0 or 1)\r
- public $canlogin = 0; // (either 0 or 1)\r
- public $notes;\r
- public $autosave = 1; // if the member use the autosave draft function\r
- public $adminskin = 0; // if the member use the autosave draft function\r
- public $bookmarklet = 0; // if the member use the autosave draft function\r
- private $locale = '';\r
- \r
- /**\r
- * Member::__construct()\r
- * Constructor for a member object\r
- * \r
- * @param Void\r
- * @return Void\r
- * \r
- */\r
- public function __construct()\r
- {\r
- return;\r
- }\r
- \r
- /**\r
- * Member::createFromName()\r
- * Create a member object for a given displayname\r
- * \r
- * @static\r
- * @param String $displayname login name\r
- * @return Object member object\r
- * \r
- */\r
- public static function &createFromName($displayname)\r
- {\r
- $mem = new Member();\r
- $mem->readFromName($displayname);\r
- return $mem;\r
- }\r
- \r
- /**\r
- * Member::createFromID()\r
- * Create a member object for a given ID\r
- * \r
- * @static\r
- * @param Integer $id id for member\r
- */\r
- public static function &createFromID($id)\r
- {\r
- $mem = new Member();\r
- $mem->readFromID($id);\r
- return $mem;\r
- }\r
- \r
- /**\r
- * Member::readFromName()\r
- * Read member table in database\r
- * \r
- * @param String $displayname login name\r
- * @return Object SQL resource\r
- * \r
- */\r
- public function readFromName($displayname)\r
- {\r
- return $this->read('mname='.DB::quoteValue($displayname));\r
- }\r
- \r
- /**\r
- * Member::readFromID()\r
- * Read member table in database\r
- * \r
- * @param Integer $id id for member\r
- * @return Object SQL resource\r
- * \r
- */\r
- public function readFromID($id)\r
- {\r
- return $this->read("mnumber=" . intval($id));\r
- }\r
- \r
- /**\r
- * Member::hash()\r
- * hash the target string\r
- * \r
- * @param String $string target string\r
- * @return Void hashed string\r
- */\r
- public function hash($string)\r
- {\r
- switch ( $this->algorism )\r
- {\r
- case 'md5':\r
- default:\r
- $string = md5($string);\r
- }\r
- return $string;\r
- }\r
- \r
- /**\r
- * Member::set_cookie_salt()\r
- * \r
- * @param integer $key secureCookieKey value\r
- * @return void\r
- * \r
- */\r
- private function set_cookie_salt($key = 0)\r
- {\r
- if ( !$key )\r
- {\r
- $key = 24;\r
- }\r
- \r
- switch( $key )\r
- {\r
- case 8:\r
- $this->cookie_salt = preg_replace('/\.[0-9]+\.[0-9]+\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));\r
- break;\r
- case 16:\r
- $this->cookie_salt = preg_replace('/\.[0-9]+\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));\r
- break;\r
- case 24:\r
- $this->cookie_salt = preg_replace('/\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));\r
- break;\r
- case 32:\r
- $this->cookie_salt = serverVar('REMOTE_ADDR');\r
- break;\r
- default:\r
- $this->cookie_salt = 'none';\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Member::login()\r
- * Tries to login as a given user.\r
- * Returns true when succeeded, returns false when failed\r
- * 3.40 adds CustomLogin event\r
- * \r
- * @param String $login login name for member\r
- * @param String $password password for member\r
- * @param Integer $shared whether the user agent is shared or not\r
- * \r
- */\r
- public function login($login, $password, $shared=1)\r
- {\r
- global $CONF, $errormessage, $manager;\r
- \r
- /* TODO: validation for $login, $password, $shared */\r
- if ( $login == '' || $password == '' )\r
- {\r
- return 0;\r
- }\r
- /* limiting the length of password to avoid hash collision */\r
- $password=i18n::substr($password, 0, 40);\r
- \r
- /* \r
- * generate cookie salt from secure cookie key settings\r
- * (either 'none', 0, 8, 16, 24, or 32)\r
- */\r
- if ( !$this->cookie_salt )\r
- {\r
- $salt = 0;\r
- if ( array_key_exists('secureCookieKey', $CONF) )\r
- {\r
- $salt = $CONF['secureCookieKey'];\r
- }\r
- $this->set_cookie_salt($salt);\r
- }\r
- \r
- $success = 0;\r
- $allowlocal = 1;\r
- $manager->notify('CustomLogin', array('login' => &$login, 'password'=>&$password, 'success'=>&$success, 'allowlocal'=>&$allowlocal));\r
- \r
- $this->loggedin = 0;\r
- if ( $success )\r
- {\r
- $this->loggedin = ( $this->readFromName($login) );\r
- }\r
- elseif ( $allowlocal )\r
- {\r
- $this->loggedin = ( $this->readFromName($login) && $this->checkPassword($password) );\r
- }\r
- \r
- /* login failed */\r
- if ( !$this->loggedin )\r
- {\r
- $trimlogin = trim($login);\r
- if ( empty($trimlogin) )\r
- {\r
- $errormessage = "Please enter a username.";\r
- }\r
- else\r
- {\r
- $errormessage = 'Login failed for ' . $login;\r
- }\r
- $manager->notify('LoginFailed', array('username' => $login) );\r
- ActionLog::add(INFO, $errormessage);\r
- }\r
- /* login success */\r
- else\r
- {\r
- /* For lower compatibility */\r
- if ( strlen($this->password) === 32 )\r
- {\r
- $this->password = $this->hash($password);\r
- }\r
- \r
- $this->newCookieKey();\r
- $this->setCookies($shared);\r
- \r
- if ( $this->cookie_salt !== 'none' )\r
- {\r
- /* secure cookie key */\r
- $this->setCookieKey($this->hash($this->getCookieKey() . $this->cookie_salt));\r
- $this->write();\r
- }\r
- \r
- $errormessage = '';\r
- $manager->notify('LoginSuccess', array('member' => &$member, 'username' => $login) );\r
- ActionLog::add(INFO, "Login successful for $login (sharedpc=$shared)");\r
- }\r
- \r
- return $this->loggedin;\r
- }\r
- \r
- /**\r
- * Member::cookielogin()\r
- * Login using cookie key\r
- * \r
- * @param String $login not used\r
- * @param String $cookiekey not used\r
- * @return Boolean login or not\r
- */\r
- public function cookielogin($login='', $cookiekey='')\r
- {\r
- global $CONF, $manager;\r
- \r
- if ( !headers_sent() && cookieVar("{$CONF['CookiePrefix']}user") )\r
- {\r
- /* Cookie Authentication */\r
- $ck = cookieVar("{$CONF['CookiePrefix']}loginkey");\r
- \r
- /* TODO: validation for each cookie values */\r
- \r
- /* limiting the length of password to avoid hash collision */\r
- $ck = i18n::substr($ck,0,32);\r
- \r
- /* \r
- * generate cookie salt from secure cookie key settings\r
- * (either 'none', 0, 8, 16, 24, or 32)\r
- */\r
- if ( !$this->cookie_salt )\r
- {\r
- $salt = 0;\r
- if ( array_key_exists('secureCookieKey', $CONF) )\r
- {\r
- $salt = $CONF['secureCookieKey'];\r
- }\r
- $this->set_cookie_salt($salt);\r
- }\r
- \r
- if ( $this->cookie_salt !== 'none' )\r
- {\r
- $ck = $this->hash($ck . $this->cookie_salt);\r
- }\r
- $this->loggedin = ( $this->readFromName(cookieVar("{$CONF['CookiePrefix']}user")) && $this->checkCookieKey($ck) );\r
- unset($ck);\r
- \r
- /* renew cookies when not on a shared computer */\r
- if ( $this->loggedin && (cookieVar($CONF['CookiePrefix'] . 'sharedpc') != 1) )\r
- {\r
- $this->setCookieKey(cookieVar("{$CONF['CookiePrefix']}loginkey"));\r
- $this->setCookies();\r
- }\r
- }\r
- return $this->loggedin;\r
- }\r
- \r
- /**\r
- * Member::logout()\r
- * logout and expire cookie\r
- * \r
- * @param Void\r
- * @return Void\r
- */\r
- public function logout()\r
- {\r
- global $CONF, $manager;\r
- \r
- if ( !headers_sent() && cookieVar("{$CONF['CookiePrefix']}user") )\r
- {\r
- /* remove cookies on logout */\r
- setcookie("{$CONF['CookiePrefix']}user", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
- setcookie("{$CONF['CookiePrefix']}loginkey", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
- $manager->notify('Logout', array('username' => cookieVar("{$CONF['CookiePrefix']}user") ) );\r
- }\r
- \r
- $this->loggedin = 0;\r
- return;\r
- }\r
- \r
- /**\r
- * Member::isLoggedIn()\r
- * return member is loggedin or not\r
- * \r
- * @param Void\r
- * @return Void\r
- */\r
- public function isLoggedIn()\r
- {\r
- return $this->loggedin;\r
- }\r
- \r
- /**\r
- * MEMBER:read()\r
- * Read member information from the database\r
- * \r
- * @param String $where where statement\r
- * @return Resource SQL resource\r
- * \r
- */\r
- public function read($where)\r
- {\r
- // read info\r
- $query = 'SELECT * FROM '.sql_table('member') . ' WHERE ' . $where;\r
- \r
- $row = DB::getRow($query);\r
- \r
- $this->setRealName($row['mrealname']);\r
- $this->setEmail($row['memail']);\r
- $this->password = $row['mpassword'];\r
- $this->setCookieKey($row['mcookiekey']);\r
- $this->setURL($row['murl']);\r
- $this->setDisplayName($row['mname']);\r
- $this->setAdmin($row['madmin']);\r
- $this->id = $row['mnumber'];\r
- $this->setCanLogin($row['mcanlogin']);\r
- $this->setNotes($row['mnotes']);\r
- $this->setLocale($row['mlocale']);\r
- $this->setAutosave($row['mautosave']);\r
- $this->setAdminSkin($row['madminskin']);\r
- $this->setBookmarklet($row['mbkmklt']);\r
-\r
- return $row ? TRUE : FALSE;\r
- }\r
- \r
- /**\r
- * Member::isBlogAdmin()\r
- * Returns true if member is an admin for the given blog\r
- * (returns false if not a team member)\r
- * \r
- * @param Integer $blogid weblog id\r
- * @return Integer weblog admin or not\r
- * \r
- */\r
- public function isBlogAdmin($blogid)\r
- {\r
- $query = 'SELECT tadmin FROM '.sql_table('team').' WHERE'\r
- . ' tblog=' . intval($blogid)\r
- . ' and tmember='. $this->getID();\r
- $res = DB::getValue($query);\r
- if ( $res )\r
- return ($res == 1);\r
- else\r
- return 0;\r
- }\r
- \r
- /**\r
- * Member::blogAdminRights()\r
- * \r
- * @param integer $blogid ID of target weblog\r
- * @return boolean whether to have admin rights to the weblog or not\r
- * \r
- */\r
- public function blogAdminRights($blogid)\r
- {\r
- return ($this->isAdmin() || $this->isBlogAdmin($blogid));\r
- }\r
- \r
- /**\r
- * Member::teamRights()\r
- * \r
- * @param integer $blogid ID of target weblog\r
- * @return boolean whether to have admin right to the weblog or not\r
- * \r
- */\r
- public function teamRights($blogid)\r
- {\r
- return ($this->isAdmin() || $this->isTeamMember($blogid));\r
- }\r
- \r
- /**\r
- * Member::isTeamMember()\r
- * Returns true if this member is a team member of the given blog\r
- * \r
- * @param integer $blogid ID of target weblog\r
- * @return boolean whether to join the weblog or not\r
- * \r
- */\r
- public function isTeamMember($blogid)\r
- {\r
- $query = 'SELECT * FROM '.sql_table('team').' WHERE'\r
- . ' tblog=' . intval($blogid)\r
- . ' and tmember='. $this->getID();\r
- $res = DB::getResult($query);\r
- return ($res->rowCount() != 0);\r
- }\r
- \r
- /**\r
- * Member::canAddItem()\r
- * \r
- * @param integer $catid ID of target category\r
- * @return boolean whether to be able to add items to the category or not\r
- * \r
- */\r
- public function canAddItem($catid)\r
- {\r
- global $manager;\r
- \r
- // if this is a 'newcat' style newcat\r
- // no blog admin of destination blog -> NOK\r
- // blog admin of destination blog -> OK\r
- if ( i18n::strpos($catid,'newcat') === 0 )\r
- {\r
- // get blogid\r
- list($blogid) = sscanf($catid,"newcat-%d");\r
- return $this->blogAdminRights($blogid);\r
- }\r
- \r
- // category does not exist -> NOK\r
- if ( !$manager->existsCategory($catid) )\r
- {\r
- return 0;\r
- }\r
- \r
- $blogid = getBlogIDFromCatID($catid);\r
- \r
- // no team rights for blog -> NOK\r
- if (!$this->teamRights($blogid))\r
- {\r
- return 0;\r
- }\r
- \r
- // all other cases: OK\r
- return 1;\r
- }\r
- \r
- /**\r
- * Member::canAlterComment()\r
- * Returns true if this member can edit/delete a commentitem. This can be in the\r
- * following cases:\r
- * - member is a super-admin\r
- * - member is the author of the comment\r
- * - member is admin of the blog associated with the comment\r
- * - member is author of the item associated with the comment\r
- * \r
- * @param integer $commentid ID of target comment\r
- * @return boolean delete/edit the comment or not\r
- * \r
- */\r
- public function canAlterComment($commentid)\r
- {\r
- if ( $this->isAdmin() )\r
- {\r
- return 1;\r
- }\r
- \r
- $query = 'SELECT citem as itemid, iblog as blogid, cmember as cauthor, iauthor'\r
- . ' FROM '.sql_table('comment') .', '.sql_table('item').', '.sql_table('blog')\r
- . ' WHERE citem=inumber and iblog=bnumber and cnumber=' . intval($commentid);\r
- $res = DB::getRow($query);\r
- \r
- return ($res['cauthor'] == $this->getID()) or $this->isBlogAdmin($res['blogid']) or ($res['iauthor'] == $this->getID());\r
- }\r
- \r
- /**\r
- * Member::canAlterItem()\r
- * Returns true if this member can edit/delete an item. This is true in the following\r
- * cases: - member is a super-admin\r
- * - member is the author of the item\r
- * - member is admin of the the associated blog\r
- * \r
- * @param integer $itemid ID of target item\r
- * @return boolean delete/edit the item or not\r
- * \r
- */\r
- public function canAlterItem($itemid)\r
- {\r
- if ($this->isAdmin()) return 1;\r
- \r
- $query = 'SELECT iblog, iauthor FROM '.sql_table('item').' WHERE inumber=' . intval($itemid);\r
- $res = DB::getRow($query);\r
- return ($res['iauthor'] == $this->getID()) or $this->isBlogAdmin($res['iblog']);\r
- }\r
- \r
- /**\r
- * Member::canBeDeleted()\r
- * Return true if member can be deleted. This means that there are no items posted by the member left\r
- * \r
- * @param void\r
- * @return boolean whether there is no items or exists\r
- * \r
- */\r
- public function canBeDeleted()\r
- {\r
- $res = DB::getResult('SELECT * FROM '.sql_table('item').' WHERE iauthor=' . $this->getID());\r
- return ( $res->rowCount() == 0 );\r
- }\r
- \r
- /**\r
- * Member::canUpdateItem()\r
- * returns true if this member can move/update an item to a given category,\r
- * false if not (see comments fot the tests that are executed)\r
- * \r
- * @param integer $itemid\r
- * @param string $newcat (can also be of form 'newcat-x' with x=blogid)\r
- * @return boolean whether being able to update the item or not\r
- * \r
- */\r
- public function canUpdateItem($itemid, $newcat)\r
- {\r
- global $manager;\r
- \r
- // item does not exists -> NOK\r
- if ( !$manager->existsItem($itemid, 1, 1) )\r
- {\r
- return 0;\r
- }\r
- \r
- // cannot alter item -> NOK\r
- if (!$this->canAlterItem($itemid))\r
- {\r
- return 0;\r
- }\r
- \r
- // if this is a 'newcat' style newcat\r
- // no blog admin of destination blog -> NOK\r
- // blog admin of destination blog -> OK\r
- if ( i18n::strpos($newcat, 'newcat') === 0 )\r
- {\r
- // get blogid\r
- list($blogid) = sscanf($newcat, 'newcat-%d');\r
- return $this->blogAdminRights($blogid);\r
- }\r
- \r
- // category does not exist -> NOK\r
- if (!$manager->existsCategory($newcat))\r
- {\r
- return 0;\r
- }\r
- \r
- // get item\r
- $item =& $manager->getItem($itemid, 1, 1);\r
- \r
- // old catid = new catid -> OK\r
- if ($item['catid'] == $newcat)\r
- {\r
- return 1;\r
- }\r
- \r
- // not a valid category -> NOK\r
- $validCat = DB::getValue('SELECT COUNT(*) AS result FROM '.sql_table('category').' WHERE catid='.intval($newcat));\r
- if ( !$validCat )\r
- {\r
- return 0;\r
- }\r
- \r
- // get destination blog\r
- $item =& $manager->getItem($itemid, 1, 1);\r
- $source_blogid = $item['blogid'];\r
- $dest_blogid = getBlogIDFromCatID($newcat);\r
- \r
- // not a team member of destination blog -> NOK\r
- if ( !$this->teamRights($dest_blogid) )\r
- {\r
- return 0;\r
- }\r
- \r
- // if member is author of item -> OK\r
- if ( $item['authorid'] == $this->getID() )\r
- {\r
- return 1;\r
- }\r
- \r
- // if member has admin rights on both blogs: OK\r
- if ( ($this->blogAdminRights($dest_blogid)) && ($this->blogAdminRights($source_blogid)) )\r
- {\r
- return 1;\r
- }\r
- \r
- // all other cases: NOK\r
- return 0;\r
- }\r
- \r
- /**\r
- * Member::setCookies()\r
- * Sets the cookies for the member\r
- * \r
- * @param boolean $shared set this to 1 when using a shared computer. Cookies will expire\r
- * at the end of the session in this case.\r
- * @return void\r
- * \r
- */\r
- public function setCookies($shared = 0)\r
- {\r
- global $CONF;\r
- \r
- if ( $CONF['SessionCookie'] || $shared )\r
- {\r
- $lifetime = 0;\r
- }\r
- else\r
- {\r
- $lifetime = time()+2592000;\r
- }\r
- \r
- setcookie($CONF['CookiePrefix'] . 'user', $this->getDisplayName(), $lifetime, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
- setcookie($CONF['CookiePrefix'] . 'loginkey', $this->getCookieKey(), $lifetime, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
- \r
- // make sure cookies on shared pcs don't get renewed\r
- if ( $shared )\r
- {\r
- setcookie($CONF['CookiePrefix'] .'sharedpc', '1',$lifetime,$CONF['CookiePath'],$CONF['CookieDomain'],$CONF['CookieSecure']);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Member::sendActivationLink()\r
- * Send activation mail\r
- * \r
- * @param string $type activation type\r
- * @param string $extra extra info\r
- * @return void\r
- */\r
- public function sendActivationLink($type, $extra='')\r
- {\r
- global $CONF;\r
- \r
- if ( !isset($CONF['ActivationDays']) )\r
- {\r
- $CONF['ActivationDays'] = 2;\r
- }\r
- \r
- // generate key and URL\r
- $key = $this->generateActivationEntry($type, $extra);\r
- $url = $CONF['AdminURL'] . 'index.php?action=activate&key=' . $key;\r
- \r
- // choose text to use in mail\r
- switch ( $type )\r
- {\r
- case 'register':\r
- $message = _ACTIVATE_REGISTER_MAIL;\r
- $subject = _ACTIVATE_REGISTER_MAILTITLE;\r
- break;\r
- case 'forgot':\r
- $message = _ACTIVATE_FORGOT_MAIL;\r
- $subject = _ACTIVATE_FORGOT_MAILTITLE;\r
- break;\r
- case 'addresschange':\r
- $message = _ACTIVATE_CHANGE_MAIL;\r
- $subject = _ACTIVATE_CHANGE_MAILTITLE;\r
- break;\r
- default;\r
- }\r
- \r
- // fill out variables in text\r
- $aVars = array(\r
- 'siteName' => $CONF['SiteName'],\r
- 'siteUrl' => $CONF['IndexURL'],\r
- 'memberName' => $this->getDisplayName(),\r
- 'activationUrl' => $url,\r
- 'activationDays' => $CONF['ActivationDays']\r
- );\r
- \r
- $message = Template::fill($message, $aVars);\r
- $subject = Template::fill($subject, $aVars);\r
- \r
- // send mail\r
- NOTIFICATION::mail($this->getEmail(), $subject ,$message, $CONF['AdminEmail'], i18n::get_current_charset());\r
- \r
- ActionLog::add(INFO, _ACTIONLOG_ACTIVATIONLINK . ' (' . $this->getDisplayName() . ' / type: ' . $type . ')');\r
- return;\r
- }\r
- \r
- /**\r
- * Member::getAdminBlogs()\r
- * Returns an array of all blogids for which member has admin rights\r
- * \r
- * @param void\r
- * @return array weblog IDs in which this member has admin rights\r
- * \r
- */\r
- public function getAdminBlogs()\r
- {\r
- $blogs = array();\r
- \r
- if ($this->isAdmin())\r
- {\r
- $query = 'SELECT bnumber as blogid from '.sql_table('blog');\r
- }\r
- else\r
- {\r
- $query = 'SELECT tblog as blogid from '.sql_table('team').' where tadmin=1 and tmember=' . $this->getID();\r
- }\r
- \r
- $res = DB::getResult($query);\r
- if ( $res->rowCount() > 0 )\r
- {\r
- foreach ( $res as $row )\r
- {\r
- array_push($blogs, $row['blogid']);\r
- }\r
- }\r
- return $blogs;\r
- }\r
- \r
- /**\r
- * Member::getTeamBlogs()\r
- * Returns an array of all blogids for which member has team rights\r
- * \r
- * @param boolean $incAdmin whether checking weblog admin rights or not\r
- * @return array weblog IDs in which this member join\r
- * \r
- */\r
- public function getTeamBlogs($incAdmin = 1)\r
- {\r
- $incAdmin = intval($incAdmin);\r
- $blogs = array();\r
- \r
- if ( $this->isAdmin() && $incAdmin )\r
- {\r
- $query = 'SELECT bnumber as blogid from '.sql_table('blog');\r
- }\r
- else\r
- {\r
- $query = 'SELECT tblog as blogid from '.sql_table('team').' where tmember=' . $this->getID();\r
- }\r
- \r
- $res = DB::getResult($query);\r
- if ( $res->rowCount() > 0 )\r
- {\r
- foreach ( $res as $row )\r
- {\r
- array_push($blogs, $row['blogid']);\r
- }\r
- }\r
- return $blogs;\r
- }\r
- \r
- /**\r
- * Member::getNotifyFromMailAddress()\r
- * \r
- * Returns an email address from which notification of commenting/karma voting can\r
- * be sent. A suggestion can be given for when the member is not logged in\r
- * \r
- * @param String $suggest\r
- * @return String mail address or suggestion\r
- */\r
- public function getNotifyFromMailAddress($suggest = "")\r
- {\r
- global $CONF;\r
- if ( $this->isLoggedIn() )\r
- {\r
- return $this->getDisplayName() . " <" . $this->getEmail() . ">";\r
- }\r
- else if ( NOTIFICATION::address_validation($suggest) )\r
- {\r
- return $suggest;\r
- }\r
- return $CONF['AdminEmail'];\r
- }\r
- \r
- /**\r
- * Member::write()\r
- * Write data to database\r
- * \r
- * @param void\r
- * @return void\r
- * \r
- */\r
- public function write()\r
- {\r
- $query = 'UPDATE '.sql_table('member')\r
- . ' SET mname=' . DB::quoteValue($this->displayname) . ', '\r
- . 'mrealname='. DB::quoteValue($this->realname) . ', '\r
- . 'mpassword='. DB::quoteValue($this->password) . ', '\r
- . 'mcookiekey='. DB::quoteValue($this->cookiekey) . ', '\r
- . 'murl=' . DB::quoteValue($this->url) . ', '\r
- . 'memail=' . DB::quoteValue($this->email) . ', '\r
- . 'madmin=' . intval($this->admin) . ', '\r
- . 'mnotes=' . DB::quoteValue($this->notes) . ', '\r
- . 'mcanlogin=' . intval($this->canlogin) . ', '\r
- . 'mlocale=' . DB::quoteValue($this->locale) . ', '\r
- . 'madminskin=' . DB::quoteValue($this->adminskin) . ', '\r
- . 'mbkmklt=' . DB::quoteValue($this->bookmarklet) . ', '\r
- . 'mautosave=' . intval($this->autosave) . ' '\r
- . 'WHERE mnumber=' . intval($this->id);\r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- public function checkCookieKey($key)\r
- {\r
- return ( ($key != '') && ( $key == $this->getCookieKey() ) );\r
- }\r
- \r
- public function checkPassword($pw)\r
- {\r
- /* for lower compatibility (md5) */\r
- if ( strlen($this->password) === 32 )\r
- {\r
- return (md5($pw) == $this->password);\r
- }\r
- return ($this->hash($pw) == $this->password);\r
- }\r
- \r
- public function getRealName()\r
- {\r
- return $this->realname;\r
- }\r
- \r
- public function setRealName($name)\r
- {\r
- $this->realname = $name;\r
- }\r
- \r
- public function getEmail()\r
- {\r
- return $this->email;\r
- }\r
- \r
- public function setEmail($email)\r
- {\r
- $this->email = $email;\r
- }\r
- \r
- public function getPassword()\r
- {\r
- return $this->password;\r
- }\r
- \r
- public function setPassword($pwd)\r
- {\r
- $this->password = $this->hash($pwd);\r
- }\r
- \r
- public function getCookieKey()\r
- {\r
- return $this->cookiekey;\r
- }\r
- \r
- /**\r
- * Member::newCookieKey()\r
- * Generate new cookiekey, save it, and return it\r
- * \r
- * @param void\r
- * @return void\r
- * \r
- */\r
- public function newCookieKey()\r
- {\r
- mt_srand( (double) microtime() * 1000000);\r
- $this->cookiekey = $this->hash(uniqid(mt_rand()));\r
- $this->write();\r
- return $this->cookiekey;\r
- }\r
- \r
- public function setCookieKey($val)\r
- {\r
- $this->cookiekey = $val;\r
- }\r
- \r
- public function getURL()\r
- {\r
- return $this->url;\r
- }\r
- \r
- public function setURL($site)\r
- {\r
- $this->url = $site;\r
- }\r
- \r
- public function setAdminSkin($skin)\r
- {\r
- $this->adminskin = $skin;\r
- }\r
-\r
- public function setBookmarklet($skin)\r
- {\r
- $this->bookmarklet = $skin;\r
- }\r
- \r
- public function getAdminSkin()\r
- {\r
- return $this->adminskin;\r
- }\r
-\r
- public function getBookmarklet()\r
- {\r
- return $this->bookmarklet;\r
- }\r
-\r
- public function getLocale()\r
- {\r
- return $this->locale;\r
- }\r
- \r
- public function setLocale($locale)\r
- {\r
- if ( !preg_match('#^(.+)_(.+)_(.+)$#', $locale)\r
- && ($locale = i18n::convert_old_language_file_name_to_locale($locale)) === FALSE )\r
- {\r
- $locale = '';\r
- }\r
- $this->locale = $locale;\r
- return;\r
- }\r
- \r
- public function setDisplayName($nick)\r
- {\r
- $this->displayname = $nick;\r
- }\r
- \r
- public function getDisplayName()\r
- {\r
- return $this->displayname;\r
- }\r
- \r
- public function isAdmin()\r
- {\r
- return $this->admin;\r
- }\r
- \r
- public function setAdmin($val)\r
- {\r
- $this->admin = $val;\r
- }\r
- \r
- public function canLogin()\r
- {\r
- return $this->canlogin;\r
- }\r
- \r
- public function setCanLogin($val)\r
- {\r
- $this->canlogin = $val;\r
- }\r
- \r
- public function getNotes()\r
- {\r
- return $this->notes;\r
- }\r
- \r
- public function setNotes($val)\r
- {\r
- $this->notes = $val;\r
- }\r
- \r
- public function getAutosave()\r
- {\r
- return $this->autosave;\r
- }\r
- \r
- public function setAutosave($val)\r
- {\r
- $this->autosave = $val;\r
- return;\r
- }\r
- \r
- /**\r
- * Member::getID()\r
- * \r
- * @param void\r
- * @return integer id of this member object\r
- * \r
- */\r
- public function getID()\r
- {\r
- return $this->id;\r
- }\r
- \r
- /**\r
- * Member::exists()\r
- * Returns true if there is a member with the given login name\r
- * \r
- * @static\r
- * @param string $name target name\r
- * @return boolean whether target name exists or not\r
- */\r
- public static function exists($name)\r
- {\r
- $r = DB::getResult('SELECT * FROM ' . sql_table('member') . ' WHERE mname=' . DB::quoteValue($name));\r
- return ( $r->rowCount() != 0 );\r
- }\r
- \r
- /**\r
- * Member::existsID()\r
- * Returns true if there is a member with the given ID\r
- * \r
- * @static\r
- * @param integer $id target id\r
- * @return boolean whether target id exists or not\r
- * \r
- */\r
- public static function existsID($id)\r
- {\r
- $r = DB::getResult('SELECT * FROM ' . sql_table('member') . ' WHERE mnumber=' . intval($id));\r
- return ( $r->rowCount() != 0 );\r
- }\r
- \r
- /**\r
- * Member::isNameProtected()\r
- * Checks if a username is protected.\r
- * If so, it can not be used on anonymous comments\r
- * \r
- * @param string $name target name\r
- * @return boolean whether the name exists or not\r
- * \r
- */\r
- public function isNameProtected($name)\r
- {\r
- // extract name\r
- $name = strip_tags($name);\r
- $name = trim($name);\r
- return self::exists($name);\r
- }\r
- \r
- /**\r
- * Member::create()\r
- * Adds a new member\r
- * \r
- * @static\r
- * @param String $name\r
- * @param String $realname\r
- * @param String $password\r
- * @param String $email\r
- * @param String $url\r
- * @param String $admin\r
- * @param String $canlogin\r
- * @param String $notes\r
- * @return String 1 if success, others if fail\r
- */\r
- static public function create($name, $realname, $password, $email, $url, $admin, $canlogin, $notes)\r
- {\r
- if ( !NOTIFICATION::address_validation($email) )\r
- {\r
- return _ERROR_BADMAILADDRESS;\r
- }\r
- \r
- /* TODO: this method should be in MEMBER class, not globalfunctions */\r
- if ( !isValidDisplayName($name) )\r
- {\r
- return _ERROR_BADNAME;\r
- }\r
- \r
- if ( self::exists($name) )\r
- {\r
- return _ERROR_NICKNAMEINUSE;\r
- }\r
- \r
- if ( !$realname )\r
- {\r
- return _ERROR_REALNAMEMISSING;\r
- }\r
- \r
- /* TODO: check the number of characters */\r
- if ( !$password )\r
- {\r
- return _ERROR_PASSWORDMISSING;\r
- }\r
- \r
- /* \r
- * begin if: sometimes user didn't prefix the URL with http:// or https://,\r
- * this cause a malformed URL. Let's fix it.\r
- */\r
- \r
- if ( !preg_match('#^https?://#', $url) )\r
- {\r
- $url = 'http://' . $url;\r
- }\r
- \r
- $name = DB::quoteValue($name);\r
- $realname = DB::quoteValue($realname);\r
- /* NOTE: hashed password is automatically updated if the length is 32 bytes when logging in */\r
- $password = DB::quoteValue(md5($password));\r
- $email = DB::quoteValue($email);\r
- $url = DB::quoteValue($url);\r
- $admin = (integer) $admin;\r
- $canlogin = (integer) $canlogin;\r
- $notes = DB::quoteValue($notes);\r
- \r
- $query = "INSERT INTO %s"\r
- . " (MNAME,MREALNAME,MPASSWORD,MEMAIL,MURL, MADMIN, MCANLOGIN, MNOTES)"\r
- . " VALUES (%s, %s, %s, %s, %s, %d, %d, %s)";\r
- $query = sprintf($query, sql_table('member'), $name, $realname, $password, $email, $url, $admin, $canlogin, $notes);\r
- DB::execute($query);\r
- \r
- ActionLog::add(INFO, _ACTIONLOG_NEWMEMBER . ' ' . $name);\r
- \r
- return 1;\r
- }\r
- \r
- /**\r
- * Member::getActivationInfo()\r
- * Returns activation info for a certain key (an object with properties vkey, vmember, ...)\r
- * \r
- * @static\r
- * @param string $key activation key\r
- * @return mixed return 0 if failed, else return activation table object\r
- * \r
- */\r
- public static function getActivationInfo($key)\r
- {\r
- $query = 'SELECT * FROM ' . sql_table('activation') . ' WHERE vkey=' . DB::quoteValue($key);\r
- $res = DB::getResult($query);\r
- \r
- if ( !$res || ($res->rowCount() == 0) )\r
- {\r
- return 0;\r
- }\r
- return $res->fetch();\r
- }\r
- \r
- /**\r
- * Member::generateActivationEntry()\r
- * Creates an account activation key\r
- * addresschange -> old email address\r
- * \r
- * @param string $type one of the following values (determines what to do when activation expires)\r
- * 'register' (new member registration)\r
- * 'forgot' (forgotton password)\r
- * 'addresschange' (member address has changed)\r
- * @param string $extra extra info (needed when validation link expires)\r
- * @return string activation key\r
- */\r
- public function generateActivationEntry($type, $extra = '')\r
- {\r
- // clean up old entries\r
- $this->cleanupActivationTable();\r
- \r
- // kill any existing entries for the current member (delete is ok)\r
- // (only one outstanding activation key can be present for a member)\r
- DB::execute('DELETE FROM ' . sql_table('activation') . ' WHERE vmember=' . intval($this->getID()));\r
- \r
- // indicates if the member can log in while the link is active\r
- $canLoginWhileActive = false;\r
- switch ( $type )\r
- {\r
- case 'forgot':\r
- $canLoginWhileActive = true;\r
- break;\r
- case 'register':\r
- break;\r
- case 'addresschange':\r
- $extra = $extra . '/' . ( $this->canLogin() ? '1' : '0' );\r
- break;\r
- }\r
- \r
- $ok = false;\r
- while ( !$ok )\r
- {\r
- // generate a random key\r
- srand((double)microtime()*1000000);\r
- $key = $this->hash(uniqid(rand(), true));\r
- \r
- // attempt to add entry in database\r
- // add in database as non-active\r
- $query = 'INSERT INTO %s (vkey, vtime, vmember, vtype, vextra) VALUES (%s, %s, %d, %s, %s)';\r
- $query = sprintf($query\r
- , sql_table('activation')\r
- , DB::quoteValue($key)\r
- , DB::formatDateTime()\r
- , intval($this->getID())\r
- , DB::quoteValue($type)\r
- , DB::quoteValue($extra)\r
- );\r
- if ( DB::execute($query) !== FALSE )\r
- $ok = true;\r
- }\r
- \r
- // mark member as not allowed to log in\r
- if ( !$canLoginWhileActive )\r
- {\r
- $this->setCanLogin(0);\r
- $this->write();\r
- }\r
- \r
- // return the key\r
- return $key;\r
- }\r
- \r
- /**\r
- * Member::activate()\r
- * Inidicates that an activation link has been clicked and any forms displayed\r
- * there have been successfully filled out.\r
- * \r
- * @param string $key activation key\r
- * @return boolean\r
- * \r
- */\r
- public function activate($key)\r
- {\r
- // get activate info\r
- $info = self::getActivationInfo($key);\r
- \r
- // no active key\r
- if ( !$info )\r
- {\r
- return false;\r
- }\r
- \r
- switch ( $info['vtype'] )\r
- {\r
- case 'forgot':\r
- // nothing to do\r
- break;\r
- case 'register':\r
- // set canlogin value\r
- global $CONF;\r
- DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($CONF['NewMemberCanLogon']). ' WHERE mnumber=' . intval($info['vmember']));\r
- break;\r
- case 'addresschange':\r
- // reset old 'canlogin' value\r
- list($oldEmail, $oldCanLogin) = preg_split('#/#', $info['vextra']);\r
- DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin). ' WHERE mnumber=' . intval($info['vmember']));\r
- break;\r
- }\r
- \r
- // delete from activation table\r
- DB::execute('DELETE FROM ' . sql_table('activation') . ' WHERE vkey=' . DB::quoteValue($key));\r
- \r
- // success!\r
- return true;\r
- }\r
- \r
- /**\r
- * Member::cleanupActivationTable()\r
- * Cleans up entries in the activation table. All entries older than 2 days are removed.\r
- * (static)\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function cleanupActivationTable()\r
- {\r
- $actdays = 2;\r
- if ( isset($CONF['ActivationDays']) && intval($CONF['ActivationDays']) > 0 )\r
- {\r
- $actdays = intval($CONF['ActivationDays']);\r
- }\r
- else\r
- {\r
- $CONF['ActivationDays'] = 2;\r
- }\r
- $boundary = time() - (60 * 60 * 24 * $actdays);\r
- \r
- // 1. walk over all entries, and see if special actions need to be performed\r
- $query = sprintf('SELECT * FROM %s WHERE vtime < %s', sql_table('activation'), DB::formatDateTime($boundary));\r
- $res = DB::getResult($query);\r
- \r
- foreach ( $res as $row )\r
- {\r
- switch ( $row['vtype'] )\r
- {\r
- case 'register':\r
- // delete all information about this site member. registration is undone because there was\r
- // no timely activation\r
- include_once($DIR_LIBS . 'ADMIN.php');\r
- Admin::deleteOneMember(intval($row['vmember']));\r
- break;\r
- case 'addresschange':\r
- // revert the e-mail address of the member back to old address\r
- list($oldEmail, $oldCanLogin) = preg_split('#/#', $row['vextra']);\r
- DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin). ', memail=' . DB::quoteValue($oldEmail). ' WHERE mnumber=' . intval($row['vmember']));\r
- break;\r
- case 'forgot':\r
- // delete the activation link and ignore. member can request a new password using the\r
- // forgot password link\r
- break;\r
- }\r
- }\r
- \r
- // 2. delete activation entries for real\r
- $query = sprintf('DELETE FROM %s WHERE vtime < %s', sql_table('activation'), DB::formatDateTime($boundary));\r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Member::$language\r
- * \r
- * @obsolete\r
- * @param void\r
- * @return void\r
- * \r
- */\r
- public $language = '';\r
- /**\r
- * Member::getLanguage()\r
- * \r
- * @obsolete\r
- * @param void\r
- * @return void\r
- * \r
- */\r
- public function getLanguage()\r
- {\r
- if ( ($language = i18n::convert_locale_to_old_language_file_name($this->locale)) === FALSE )\r
- {\r
- $language = '';\r
- }\r
- return $language;\r
- }\r
-}\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class representing site members
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: MEMBER.php 1616 2012-01-08 09:48:15Z sakamocchi $
+ */
+class Member
+{
+ // 1 when authenticated, 0 when not
+ public $loggedin = 0;
+ public $password; // not the actual password, but rather a MD5 hash
+ private $algorism = 'md5';
+
+ public $cookiekey; // value that should also be in the client cookie to allow authentication
+ private $cookie_salt = FALSE;
+
+ // member info
+ public $id = -1;
+ public $realname;
+ public $displayname;
+ public $email;
+ public $url;
+ public $admin = 0; // (either 0 or 1)
+ public $canlogin = 0; // (either 0 or 1)
+ public $notes;
+ public $autosave = 1; // if the member use the autosave draft function
+ public $adminskin = 0; // if the member use the autosave draft function
+ public $bookmarklet = 0; // if the member use the autosave draft function
+ private $locale = '';
+
+ /**
+ * Member::__construct()
+ * Constructor for a member object
+ *
+ * @param Void
+ * @return Void
+ *
+ */
+ public function __construct()
+ {
+ return;
+ }
+
+ /**
+ * Member::createFromName()
+ * Create a member object for a given displayname
+ *
+ * @static
+ * @param String $displayname login name
+ * @return Object member object
+ *
+ */
+ public static function &createFromName($displayname)
+ {
+ $mem = new Member();
+ $mem->readFromName($displayname);
+ return $mem;
+ }
+
+ /**
+ * Member::createFromID()
+ * Create a member object for a given ID
+ *
+ * @static
+ * @param Integer $id id for member
+ */
+ public static function &createFromID($id)
+ {
+ $mem = new Member();
+ $mem->readFromID($id);
+ return $mem;
+ }
+
+ /**
+ * Member::readFromName()
+ * Read member table in database
+ *
+ * @param String $displayname login name
+ * @return Object SQL resource
+ *
+ */
+ public function readFromName($displayname)
+ {
+ return $this->read('mname='.DB::quoteValue($displayname));
+ }
+
+ /**
+ * Member::readFromID()
+ * Read member table in database
+ *
+ * @param Integer $id id for member
+ * @return Object SQL resource
+ *
+ */
+ public function readFromID($id)
+ {
+ return $this->read("mnumber=" . intval($id));
+ }
+
+ /**
+ * Member::hash()
+ * hash the target string
+ *
+ * @param String $string target string
+ * @return Void hashed string
+ */
+ public function hash($string)
+ {
+ switch ( $this->algorism )
+ {
+ case 'md5':
+ default:
+ $string = md5($string);
+ }
+ return $string;
+ }
+
+ /**
+ * Member::set_cookie_salt()
+ *
+ * @param integer $key secureCookieKey value
+ * @return void
+ *
+ */
+ private function set_cookie_salt($key = 0)
+ {
+ if ( !$key )
+ {
+ $key = 24;
+ }
+
+ switch( $key )
+ {
+ case 8:
+ $this->cookie_salt = preg_replace('/\.[0-9]+\.[0-9]+\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));
+ break;
+ case 16:
+ $this->cookie_salt = preg_replace('/\.[0-9]+\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));
+ break;
+ case 24:
+ $this->cookie_salt = preg_replace('/\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));
+ break;
+ case 32:
+ $this->cookie_salt = serverVar('REMOTE_ADDR');
+ break;
+ default:
+ $this->cookie_salt = 'none';
+ }
+ return;
+ }
+
+ /**
+ * Member::login()
+ * Tries to login as a given user.
+ * Returns true when succeeded, returns false when failed
+ * 3.40 adds CustomLogin event
+ *
+ * @param String $login login name for member
+ * @param String $password password for member
+ * @param Integer $shared whether the user agent is shared or not
+ *
+ */
+ public function login($login, $password, $shared=1)
+ {
+ global $CONF, $errormessage, $manager;
+
+ /* TODO: validation for $login, $password, $shared */
+ if ( $login == '' || $password == '' )
+ {
+ return 0;
+ }
+ /* limiting the length of password to avoid hash collision */
+ $password=i18n::substr($password, 0, 40);
+
+ /*
+ * generate cookie salt from secure cookie key settings
+ * (either 'none', 0, 8, 16, 24, or 32)
+ */
+ if ( !$this->cookie_salt )
+ {
+ $salt = 0;
+ if ( array_key_exists('secureCookieKey', $CONF) )
+ {
+ $salt = $CONF['secureCookieKey'];
+ }
+ $this->set_cookie_salt($salt);
+ }
+
+ $success = 0;
+ $allowlocal = 1;
+ $manager->notify('CustomLogin', array('login' => &$login, 'password'=>&$password, 'success'=>&$success, 'allowlocal'=>&$allowlocal));
+
+ $this->loggedin = 0;
+ if ( $success )
+ {
+ $this->loggedin = ( $this->readFromName($login) );
+ }
+ elseif ( $allowlocal )
+ {
+ $this->loggedin = ( $this->readFromName($login) && $this->checkPassword($password) );
+ }
+
+ /* login failed */
+ if ( !$this->loggedin )
+ {
+ $trimlogin = trim($login);
+ if ( empty($trimlogin) )
+ {
+ $errormessage = "Please enter a username.";
+ }
+ else
+ {
+ $errormessage = 'Login failed for ' . $login;
+ }
+ $manager->notify('LoginFailed', array('username' => $login) );
+ ActionLog::add(INFO, $errormessage);
+ }
+ /* login success */
+ else
+ {
+ /* For lower compatibility */
+ if ( strlen($this->password) === 32 )
+ {
+ $this->password = $this->hash($password);
+ }
+
+ $this->newCookieKey();
+ $this->setCookies($shared);
+
+ if ( $this->cookie_salt !== 'none' )
+ {
+ /* secure cookie key */
+ $this->setCookieKey($this->hash($this->getCookieKey() . $this->cookie_salt));
+ $this->write();
+ }
+
+ $errormessage = '';
+ $manager->notify('LoginSuccess', array('member' => &$member, 'username' => $login) );
+ ActionLog::add(INFO, "Login successful for $login (sharedpc=$shared)");
+ }
+
+ return $this->loggedin;
+ }
+
+ /**
+ * Member::cookielogin()
+ * Login using cookie key
+ *
+ * @param String $login not used
+ * @param String $cookiekey not used
+ * @return Boolean login or not
+ */
+ public function cookielogin($login='', $cookiekey='')
+ {
+ global $CONF, $manager;
+
+ if ( !headers_sent() && cookieVar("{$CONF['CookiePrefix']}user") )
+ {
+ /* Cookie Authentication */
+ $ck = cookieVar("{$CONF['CookiePrefix']}loginkey");
+
+ /* TODO: validation for each cookie values */
+
+ /* limiting the length of password to avoid hash collision */
+ $ck = i18n::substr($ck,0,32);
+
+ /*
+ * generate cookie salt from secure cookie key settings
+ * (either 'none', 0, 8, 16, 24, or 32)
+ */
+ if ( !$this->cookie_salt )
+ {
+ $salt = 0;
+ if ( array_key_exists('secureCookieKey', $CONF) )
+ {
+ $salt = $CONF['secureCookieKey'];
+ }
+ $this->set_cookie_salt($salt);
+ }
+
+ if ( $this->cookie_salt !== 'none' )
+ {
+ $ck = $this->hash($ck . $this->cookie_salt);
+ }
+ $this->loggedin = ( $this->readFromName(cookieVar("{$CONF['CookiePrefix']}user")) && $this->checkCookieKey($ck) );
+ unset($ck);
+
+ /* renew cookies when not on a shared computer */
+ if ( $this->loggedin && (cookieVar($CONF['CookiePrefix'] . 'sharedpc') != 1) )
+ {
+ $this->setCookieKey(cookieVar("{$CONF['CookiePrefix']}loginkey"));
+ $this->setCookies();
+ }
+ }
+ return $this->loggedin;
+ }
+
+ /**
+ * Member::logout()
+ * logout and expire cookie
+ *
+ * @param Void
+ * @return Void
+ */
+ public function logout()
+ {
+ global $CONF, $manager;
+
+ if ( !headers_sent() && cookieVar("{$CONF['CookiePrefix']}user") )
+ {
+ /* remove cookies on logout */
+ setcookie("{$CONF['CookiePrefix']}user", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+ setcookie("{$CONF['CookiePrefix']}loginkey", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+ $manager->notify('Logout', array('username' => cookieVar("{$CONF['CookiePrefix']}user") ) );
+ }
+
+ $this->loggedin = 0;
+ return;
+ }
+
+ /**
+ * Member::isLoggedIn()
+ * return member is loggedin or not
+ *
+ * @param Void
+ * @return Void
+ */
+ public function isLoggedIn()
+ {
+ return $this->loggedin;
+ }
+
+ /**
+ * MEMBER:read()
+ * Read member information from the database
+ *
+ * @param String $where where statement
+ * @return Resource SQL resource
+ *
+ */
+ public function read($where)
+ {
+ // read info
+ $query = 'SELECT * FROM '.sql_table('member') . ' WHERE ' . $where;
+
+ $row = DB::getRow($query);
+
+ $this->setRealName($row['mrealname']);
+ $this->setEmail($row['memail']);
+ $this->password = $row['mpassword'];
+ $this->setCookieKey($row['mcookiekey']);
+ $this->setURL($row['murl']);
+ $this->setDisplayName($row['mname']);
+ $this->setAdmin($row['madmin']);
+ $this->id = $row['mnumber'];
+ $this->setCanLogin($row['mcanlogin']);
+ $this->setNotes($row['mnotes']);
+ $this->setLocale($row['mlocale']);
+ $this->setAutosave($row['mautosave']);
+ $this->setAdminSkin($row['madminskin']);
+ $this->setBookmarklet($row['mbkmklt']);
+
+ return $row ? TRUE : FALSE;
+ }
+
+ /**
+ * Member::isBlogAdmin()
+ * Returns true if member is an admin for the given blog
+ * (returns false if not a team member)
+ *
+ * @param Integer $blogid weblog id
+ * @return Integer weblog admin or not
+ *
+ */
+ public function isBlogAdmin($blogid)
+ {
+ $query = 'SELECT tadmin FROM '.sql_table('team').' WHERE'
+ . ' tblog=' . intval($blogid)
+ . ' and tmember='. $this->getID();
+ $res = DB::getValue($query);
+ if ( $res )
+ return ($res == 1);
+ else
+ return 0;
+ }
+
+ /**
+ * Member::blogAdminRights()
+ *
+ * @param integer $blogid ID of target weblog
+ * @return boolean whether to have admin rights to the weblog or not
+ *
+ */
+ public function blogAdminRights($blogid)
+ {
+ return ($this->isAdmin() || $this->isBlogAdmin($blogid));
+ }
+
+ /**
+ * Member::teamRights()
+ *
+ * @param integer $blogid ID of target weblog
+ * @return boolean whether to have admin right to the weblog or not
+ *
+ */
+ public function teamRights($blogid)
+ {
+ return ($this->isAdmin() || $this->isTeamMember($blogid));
+ }
+
+ /**
+ * Member::isTeamMember()
+ * Returns true if this member is a team member of the given blog
+ *
+ * @param integer $blogid ID of target weblog
+ * @return boolean whether to join the weblog or not
+ *
+ */
+ public function isTeamMember($blogid)
+ {
+ $query = 'SELECT * FROM '.sql_table('team').' WHERE'
+ . ' tblog=' . intval($blogid)
+ . ' and tmember='. $this->getID();
+ $res = DB::getResult($query);
+ return ($res->rowCount() != 0);
+ }
+
+ /**
+ * Member::canAddItem()
+ *
+ * @param integer $catid ID of target category
+ * @return boolean whether to be able to add items to the category or not
+ *
+ */
+ public function canAddItem($catid)
+ {
+ global $manager;
+
+ // if this is a 'newcat' style newcat
+ // no blog admin of destination blog -> NOK
+ // blog admin of destination blog -> OK
+ if ( i18n::strpos($catid,'newcat') === 0 )
+ {
+ // get blogid
+ list($blogid) = sscanf($catid,"newcat-%d");
+ return $this->blogAdminRights($blogid);
+ }
+
+ // category does not exist -> NOK
+ if ( !$manager->existsCategory($catid) )
+ {
+ return 0;
+ }
+
+ $blogid = getBlogIDFromCatID($catid);
+
+ // no team rights for blog -> NOK
+ if (!$this->teamRights($blogid))
+ {
+ return 0;
+ }
+
+ // all other cases: OK
+ return 1;
+ }
+
+ /**
+ * Member::canAlterComment()
+ * Returns true if this member can edit/delete a commentitem. This can be in the
+ * following cases:
+ * - member is a super-admin
+ * - member is the author of the comment
+ * - member is admin of the blog associated with the comment
+ * - member is author of the item associated with the comment
+ *
+ * @param integer $commentid ID of target comment
+ * @return boolean delete/edit the comment or not
+ *
+ */
+ public function canAlterComment($commentid)
+ {
+ if ( $this->isAdmin() )
+ {
+ return 1;
+ }
+
+ $query = 'SELECT citem as itemid, iblog as blogid, cmember as cauthor, iauthor'
+ . ' FROM '.sql_table('comment') .', '.sql_table('item').', '.sql_table('blog')
+ . ' WHERE citem=inumber and iblog=bnumber and cnumber=' . intval($commentid);
+ $res = DB::getRow($query);
+
+ return ($res['cauthor'] == $this->getID()) or $this->isBlogAdmin($res['blogid']) or ($res['iauthor'] == $this->getID());
+ }
+
+ /**
+ * Member::canAlterItem()
+ * Returns true if this member can edit/delete an item. This is true in the following
+ * cases: - member is a super-admin
+ * - member is the author of the item
+ * - member is admin of the the associated blog
+ *
+ * @param integer $itemid ID of target item
+ * @return boolean delete/edit the item or not
+ *
+ */
+ public function canAlterItem($itemid)
+ {
+ if ($this->isAdmin()) return 1;
+
+ $query = 'SELECT iblog, iauthor FROM '.sql_table('item').' WHERE inumber=' . intval($itemid);
+ $res = DB::getRow($query);
+ return ($res['iauthor'] == $this->getID()) or $this->isBlogAdmin($res['iblog']);
+ }
+
+ /**
+ * Member::canBeDeleted()
+ * Return true if member can be deleted. This means that there are no items posted by the member left
+ *
+ * @param void
+ * @return boolean whether there is no items or exists
+ *
+ */
+ public function canBeDeleted()
+ {
+ $res = DB::getResult('SELECT * FROM '.sql_table('item').' WHERE iauthor=' . $this->getID());
+ return ( $res->rowCount() == 0 );
+ }
+
+ /**
+ * Member::canUpdateItem()
+ * returns true if this member can move/update an item to a given category,
+ * false if not (see comments fot the tests that are executed)
+ *
+ * @param integer $itemid
+ * @param string $newcat (can also be of form 'newcat-x' with x=blogid)
+ * @return boolean whether being able to update the item or not
+ *
+ */
+ public function canUpdateItem($itemid, $newcat)
+ {
+ global $manager;
+
+ // item does not exists -> NOK
+ if ( !$manager->existsItem($itemid,1,1) )
+ {
+ return 0;
+ }
+
+ // cannot alter item -> NOK
+ if (!$this->canAlterItem($itemid))
+ {
+ return 0;
+ }
+
+ // if this is a 'newcat' style newcat
+ // no blog admin of destination blog -> NOK
+ // blog admin of destination blog -> OK
+ if ( i18n::strpos($newcat, 'newcat') === 0 )
+ {
+ // get blogid
+ list($blogid) = sscanf($newcat, 'newcat-%d');
+ return $this->blogAdminRights($blogid);
+ }
+
+ // category does not exist -> NOK
+ if (!$manager->existsCategory($newcat))
+ {
+ return 0;
+ }
+
+ // get item
+ $item =& $manager->getItem($itemid,1,1);
+
+ // old catid = new catid -> OK
+ if ($item['catid'] == $newcat)
+ {
+ return 1;
+ }
+
+ // not a valid category -> NOK
+ $validCat = DB::getValue('SELECT COUNT(*) AS result FROM '.sql_table('category').' WHERE catid='.intval($newcat));
+ if ( !$validCat )
+ {
+ return 0;
+ }
+
+ // get destination blog
+ $item =& $manager->getItem($itemid, 1, 1);
+ $source_blogid = $item['blogid'];
+ $dest_blogid = getBlogIDFromCatID($newcat);
+
+ // not a team member of destination blog -> NOK
+ if ( !$this->teamRights($dest_blogid) )
+ {
+ return 0;
+ }
+
+ // if member is author of item -> OK
+ if ( $item['authorid'] == $this->getID() )
+ {
+ return 1;
+ }
+
+ // if member has admin rights on both blogs: OK
+ if ( ($this->blogAdminRights($dest_blogid)) && ($this->blogAdminRights($source_blogid)) )
+ {
+ return 1;
+ }
+
+ // all other cases: NOK
+ return 0;
+ }
+
+ /**
+ * Member::setCookies()
+ * Sets the cookies for the member
+ *
+ * @param boolean $shared set this to 1 when using a shared computer. Cookies will expire
+ * at the end of the session in this case.
+ * @return void
+ *
+ */
+ public function setCookies($shared = 0)
+ {
+ global $CONF;
+
+ if ( $CONF['SessionCookie'] || $shared )
+ {
+ $lifetime = 0;
+ }
+ else
+ {
+ $lifetime = time()+2592000;
+ }
+
+ setcookie($CONF['CookiePrefix'] . 'user', $this->getDisplayName(), $lifetime, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+ setcookie($CONF['CookiePrefix'] . 'loginkey', $this->getCookieKey(), $lifetime, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+
+ // make sure cookies on shared pcs don't get renewed
+ if ( $shared )
+ {
+ setcookie($CONF['CookiePrefix'] .'sharedpc', '1',$lifetime,$CONF['CookiePath'],$CONF['CookieDomain'],$CONF['CookieSecure']);
+ }
+ return;
+ }
+
+ /**
+ * Member::sendActivationLink()
+ * Send activation mail
+ *
+ * @param string $type activation type
+ * @param string $extra extra info
+ * @return void
+ */
+ public function sendActivationLink($type, $extra='')
+ {
+ global $CONF;
+
+ if ( !isset($CONF['ActivationDays']) )
+ {
+ $CONF['ActivationDays'] = 2;
+ }
+
+ // generate key and URL
+ $key = $this->generateActivationEntry($type, $extra);
+ $url = $CONF['AdminURL'] . 'index.php?action=activate&key=' . $key;
+
+ // choose text to use in mail
+ switch ( $type )
+ {
+ case 'register':
+ $message = _ACTIVATE_REGISTER_MAIL;
+ $subject = _ACTIVATE_REGISTER_MAILTITLE;
+ break;
+ case 'forgot':
+ $message = _ACTIVATE_FORGOT_MAIL;
+ $subject = _ACTIVATE_FORGOT_MAILTITLE;
+ break;
+ case 'addresschange':
+ $message = _ACTIVATE_CHANGE_MAIL;
+ $subject = _ACTIVATE_CHANGE_MAILTITLE;
+ break;
+ default;
+ }
+
+ // fill out variables in text
+ $aVars = array(
+ 'siteName' => $CONF['SiteName'],
+ 'siteUrl' => $CONF['IndexURL'],
+ 'memberName' => $this->getDisplayName(),
+ 'activationUrl' => $url,
+ 'activationDays' => $CONF['ActivationDays']
+ );
+
+ $message = Template::fill($message, $aVars);
+ $subject = Template::fill($subject, $aVars);
+
+ // send mail
+ NOTIFICATION::mail($this->getEmail(), $subject ,$message, $CONF['AdminEmail'], i18n::get_current_charset());
+
+ ActionLog::add(INFO, _ACTIONLOG_ACTIVATIONLINK . ' (' . $this->getDisplayName() . ' / type: ' . $type . ')');
+ return;
+ }
+
+ /**
+ * Member::getAdminBlogs()
+ * Returns an array of all blogids for which member has admin rights
+ *
+ * @param void
+ * @return array weblog IDs in which this member has admin rights
+ *
+ */
+ public function getAdminBlogs()
+ {
+ $blogs = array();
+
+ if ($this->isAdmin())
+ {
+ $query = 'SELECT bnumber as blogid from '.sql_table('blog');
+ }
+ else
+ {
+ $query = 'SELECT tblog as blogid from '.sql_table('team').' where tadmin=1 and tmember=' . $this->getID();
+ }
+
+ $res = DB::getResult($query);
+ if ( $res->rowCount() > 0 )
+ {
+ foreach ( $res as $row )
+ {
+ array_push($blogs, $row['blogid']);
+ }
+ }
+ return $blogs;
+ }
+
+ /**
+ * Member::getTeamBlogs()
+ * Returns an array of all blogids for which member has team rights
+ *
+ * @param boolean $incAdmin whether checking weblog admin rights or not
+ * @return array weblog IDs in which this member join
+ *
+ */
+ public function getTeamBlogs($incAdmin = 1)
+ {
+ $incAdmin = intval($incAdmin);
+ $blogs = array();
+
+ if ( $this->isAdmin() && $incAdmin )
+ {
+ $query = 'SELECT bnumber as blogid from '.sql_table('blog');
+ }
+ else
+ {
+ $query = 'SELECT tblog as blogid from '.sql_table('team').' where tmember=' . $this->getID();
+ }
+
+ $res = DB::getResult($query);
+ if ( $res->rowCount() > 0 )
+ {
+ foreach ( $res as $row )
+ {
+ array_push($blogs, $row['blogid']);
+ }
+ }
+ return $blogs;
+ }
+
+ /**
+ * Member::getNotifyFromMailAddress()
+ *
+ * Returns an email address from which notification of commenting/karma voting can
+ * be sent. A suggestion can be given for when the member is not logged in
+ *
+ * @param String $suggest
+ * @return String mail address or suggestion
+ */
+ public function getNotifyFromMailAddress($suggest = "")
+ {
+ global $CONF;
+ if ( $this->isLoggedIn() )
+ {
+ return $this->getDisplayName() . " <" . $this->getEmail() . ">";
+ }
+ else if ( NOTIFICATION::address_validation($suggest) )
+ {
+ return $suggest;
+ }
+ return $CONF['AdminEmail'];
+ }
+
+ /**
+ * Member::write()
+ * Write data to database
+ *
+ * @param void
+ * @return void
+ *
+ */
+ public function write()
+ {
+ $query = 'UPDATE '.sql_table('member')
+ . ' SET mname=' . DB::quoteValue($this->displayname) . ', '
+ . 'mrealname='. DB::quoteValue($this->realname) . ', '
+ . 'mpassword='. DB::quoteValue($this->password) . ', '
+ . 'mcookiekey='. DB::quoteValue($this->cookiekey) . ', '
+ . 'murl=' . DB::quoteValue($this->url) . ', '
+ . 'memail=' . DB::quoteValue($this->email) . ', '
+ . 'madmin=' . intval($this->admin) . ', '
+ . 'mnotes=' . DB::quoteValue($this->notes) . ', '
+ . 'mcanlogin=' . intval($this->canlogin) . ', '
+ . 'mlocale=' . DB::quoteValue($this->locale) . ', '
+ . 'madminskin=' . DB::quoteValue($this->adminskin) . ', '
+ . 'mbkmklt=' . DB::quoteValue($this->bookmarklet) . ', '
+ . 'mautosave=' . intval($this->autosave) . ' '
+ . 'WHERE mnumber=' . intval($this->id);
+ DB::execute($query);
+ return;
+ }
+
+ public function checkCookieKey($key)
+ {
+ return ( ($key != '') && ( $key == $this->getCookieKey() ) );
+ }
+
+ public function checkPassword($pw)
+ {
+ /* for lower compatibility (md5) */
+ if ( strlen($this->password) === 32 )
+ {
+ return (md5($pw) == $this->password);
+ }
+ return ($this->hash($pw) == $this->password);
+ }
+
+ public function getRealName()
+ {
+ return $this->realname;
+ }
+
+ public function setRealName($name)
+ {
+ $this->realname = $name;
+ }
+
+ public function getEmail()
+ {
+ return $this->email;
+ }
+
+ public function setEmail($email)
+ {
+ $this->email = $email;
+ }
+
+ public function getPassword()
+ {
+ return $this->password;
+ }
+
+ public function setPassword($pwd)
+ {
+ $this->password = $this->hash($pwd);
+ }
+
+ public function getCookieKey()
+ {
+ return $this->cookiekey;
+ }
+
+ /**
+ * Member::newCookieKey()
+ * Generate new cookiekey, save it, and return it
+ *
+ * @param void
+ * @return void
+ *
+ */
+ public function newCookieKey()
+ {
+ mt_srand( (double) microtime() * 1000000);
+ $this->cookiekey = $this->hash(uniqid(mt_rand()));
+ $this->write();
+ return $this->cookiekey;
+ }
+
+ public function setCookieKey($val)
+ {
+ $this->cookiekey = $val;
+ }
+
+ public function getURL()
+ {
+ return $this->url;
+ }
+
+ public function setURL($site)
+ {
+ $this->url = $site;
+ }
+
+ public function setAdminSkin($skin)
+ {
+ $this->adminskin = $skin;
+ }
+
+ public function setBookmarklet($skin)
+ {
+ $this->bookmarklet = $skin;
+ }
+
+ public function getAdminSkin()
+ {
+ return $this->adminskin;
+ }
+
+ public function getBookmarklet()
+ {
+ return $this->bookmarklet;
+ }
+
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ public function setLocale($locale)
+ {
+ if ( !preg_match('#^(.+)_(.+)_(.+)$#', $locale)
+ && ($locale = i18n::convert_old_language_file_name_to_locale($locale)) === FALSE )
+ {
+ $locale = '';
+ }
+ $this->locale = $locale;
+ return;
+ }
+
+ public function setDisplayName($nick)
+ {
+ $this->displayname = $nick;
+ }
+
+ public function getDisplayName()
+ {
+ return $this->displayname;
+ }
+
+ public function isAdmin()
+ {
+ return $this->admin;
+ }
+
+ public function setAdmin($val)
+ {
+ $this->admin = $val;
+ }
+
+ public function canLogin()
+ {
+ return $this->canlogin;
+ }
+
+ public function setCanLogin($val)
+ {
+ $this->canlogin = $val;
+ }
+
+ public function getNotes()
+ {
+ return $this->notes;
+ }
+
+ public function setNotes($val)
+ {
+ $this->notes = $val;
+ }
+
+ public function getAutosave()
+ {
+ return $this->autosave;
+ }
+
+ public function setAutosave($val)
+ {
+ $this->autosave = $val;
+ return;
+ }
+
+ /**
+ * Member::getID()
+ *
+ * @param void
+ * @return integer id of this member object
+ *
+ */
+ public function getID()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Member::exists()
+ * Returns true if there is a member with the given login name
+ *
+ * @static
+ * @param string $name target name
+ * @return boolean whether target name exists or not
+ */
+ public static function exists($name)
+ {
+ $r = DB::getResult('SELECT * FROM ' . sql_table('member') . ' WHERE mname=' . DB::quoteValue($name));
+ return ( $r->rowCount() != 0 );
+ }
+
+ /**
+ * Member::existsID()
+ * Returns true if there is a member with the given ID
+ *
+ * @static
+ * @param integer $id target id
+ * @return boolean whether target id exists or not
+ *
+ */
+ public static function existsID($id)
+ {
+ $r = DB::getResult('SELECT * FROM ' . sql_table('member') . ' WHERE mnumber=' . intval($id));
+ return ( $r->rowCount() != 0 );
+ }
+
+ /**
+ * Member::isNameProtected()
+ * Checks if a username is protected.
+ * If so, it can not be used on anonymous comments
+ *
+ * @param string $name target name
+ * @return boolean whether the name exists or not
+ *
+ */
+ public function isNameProtected($name)
+ {
+ // extract name
+ $name = strip_tags($name);
+ $name = trim($name);
+ return self::exists($name);
+ }
+
+ /**
+ * Member::create()
+ * Adds a new member
+ *
+ * @static
+ * @param String $name
+ * @param String $realname
+ * @param String $password
+ * @param String $email
+ * @param String $url
+ * @param String $admin
+ * @param String $canlogin
+ * @param String $notes
+ * @return String 1 if success, others if fail
+ */
+ static public function create($name, $realname, $password, $email, $url, $admin, $canlogin, $notes)
+ {
+ if ( !NOTIFICATION::address_validation($email) )
+ {
+ return _ERROR_BADMAILADDRESS;
+ }
+
+ /* TODO: this method should be in MEMBER class, not globalfunctions */
+ if ( !isValidDisplayName($name) )
+ {
+ return _ERROR_BADNAME;
+ }
+
+ if ( self::exists($name) )
+ {
+ return _ERROR_NICKNAMEINUSE;
+ }
+
+ if ( !$realname )
+ {
+ return _ERROR_REALNAMEMISSING;
+ }
+
+ /* TODO: check the number of characters */
+ if ( !$password )
+ {
+ return _ERROR_PASSWORDMISSING;
+ }
+
+ /*
+ * begin if: sometimes user didn't prefix the URL with http:// or https://,
+ * this cause a malformed URL. Let's fix it.
+ */
+
+ if ( !preg_match('#^https?://#', $url) )
+ {
+ $url = 'http://' . $url;
+ }
+
+ $name = DB::quoteValue($name);
+ $realname = DB::quoteValue($realname);
+ /* NOTE: hashed password is automatically updated if the length is 32 bytes when logging in */
+ $password = DB::quoteValue(md5($password));
+ $email = DB::quoteValue($email);
+ $url = DB::quoteValue($url);
+ $admin = (integer) $admin;
+ $canlogin = (integer) $canlogin;
+ $notes = DB::quoteValue($notes);
+
+ $query = "INSERT INTO %s"
+ . " (MNAME,MREALNAME,MPASSWORD,MEMAIL,MURL, MADMIN, MCANLOGIN, MNOTES)"
+ . " VALUES (%s, %s, %s, %s, %s, %d, %d, %s)";
+ $query = sprintf($query, sql_table('member'), $name, $realname, $password, $email, $url, $admin, $canlogin, $notes);
+ DB::execute($query);
+
+ ActionLog::add(INFO, _ACTIONLOG_NEWMEMBER . ' ' . $name);
+
+ return 1;
+ }
+
+ /**
+ * Member::getActivationInfo()
+ * Returns activation info for a certain key (an object with properties vkey, vmember, ...)
+ *
+ * @static
+ * @param string $key activation key
+ * @return mixed return 0 if failed, else return activation table object
+ *
+ */
+ public static function getActivationInfo($key)
+ {
+ $query = 'SELECT * FROM ' . sql_table('activation') . ' WHERE vkey=' . DB::quoteValue($key);
+ $res = DB::getResult($query);
+
+ if ( !$res || ($res->rowCount() == 0) )
+ {
+ return 0;
+ }
+ return $res->fetch();
+ }
+
+ /**
+ * Member::generateActivationEntry()
+ * Creates an account activation key
+ * addresschange -> old email address
+ *
+ * @param string $type one of the following values (determines what to do when activation expires)
+ * 'register' (new member registration)
+ * 'forgot' (forgotton password)
+ * 'addresschange' (member address has changed)
+ * @param string $extra extra info (needed when validation link expires)
+ * @return string activation key
+ */
+ public function generateActivationEntry($type, $extra = '')
+ {
+ // clean up old entries
+ $this->cleanupActivationTable();
+
+ // kill any existing entries for the current member (delete is ok)
+ // (only one outstanding activation key can be present for a member)
+ DB::execute('DELETE FROM ' . sql_table('activation') . ' WHERE vmember=' . intval($this->getID()));
+
+ // indicates if the member can log in while the link is active
+ $canLoginWhileActive = false;
+ switch ( $type )
+ {
+ case 'forgot':
+ $canLoginWhileActive = true;
+ break;
+ case 'register':
+ break;
+ case 'addresschange':
+ $extra = $extra . '/' . ( $this->canLogin() ? '1' : '0' );
+ break;
+ }
+
+ $ok = false;
+ while ( !$ok )
+ {
+ // generate a random key
+ srand((double)microtime()*1000000);
+ $key = $this->hash(uniqid(rand(), true));
+
+ // attempt to add entry in database
+ // add in database as non-active
+ $query = 'INSERT INTO %s (vkey, vtime, vmember, vtype, vextra) VALUES (%s, %s, %d, %s, %s)';
+ $query = sprintf($query
+ , sql_table('activation')
+ , DB::quoteValue($key)
+ , DB::formatDateTime()
+ , intval($this->getID())
+ , DB::quoteValue($type)
+ , DB::quoteValue($extra)
+ );
+ if ( DB::execute($query) !== FALSE )
+ $ok = true;
+ }
+
+ // mark member as not allowed to log in
+ if ( !$canLoginWhileActive )
+ {
+ $this->setCanLogin(0);
+ $this->write();
+ }
+
+ // return the key
+ return $key;
+ }
+
+ /**
+ * Member::activate()
+ * Inidicates that an activation link has been clicked and any forms displayed
+ * there have been successfully filled out.
+ *
+ * @param string $key activation key
+ * @return boolean
+ *
+ */
+ public function activate($key)
+ {
+ // get activate info
+ $info = self::getActivationInfo($key);
+
+ // no active key
+ if ( !$info )
+ {
+ return false;
+ }
+
+ switch ( $info['vtype'] )
+ {
+ case 'forgot':
+ // nothing to do
+ break;
+ case 'register':
+ // set canlogin value
+ global $CONF;
+ DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($CONF['NewMemberCanLogon']). ' WHERE mnumber=' . intval($info['vmember']));
+ break;
+ case 'addresschange':
+ // reset old 'canlogin' value
+ list($oldEmail, $oldCanLogin) = preg_split('#/#', $info['vextra']);
+ DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin). ' WHERE mnumber=' . intval($info['vmember']));
+ break;
+ }
+
+ // delete from activation table
+ DB::execute('DELETE FROM ' . sql_table('activation') . ' WHERE vkey=' . DB::quoteValue($key));
+
+ // success!
+ return true;
+ }
+
+ /**
+ * Member::cleanupActivationTable()
+ * Cleans up entries in the activation table. All entries older than 2 days are removed.
+ * (static)
+ *
+ * @param void
+ * @return void
+ */
+ public function cleanupActivationTable()
+ {
+ $actdays = 2;
+ if ( isset($CONF['ActivationDays']) && intval($CONF['ActivationDays']) > 0 )
+ {
+ $actdays = intval($CONF['ActivationDays']);
+ }
+ else
+ {
+ $CONF['ActivationDays'] = 2;
+ }
+ $boundary = time() - (60 * 60 * 24 * $actdays);
+
+ // 1. walk over all entries, and see if special actions need to be performed
+ $query = sprintf('SELECT * FROM %s WHERE vtime < %s', sql_table('activation'), DB::formatDateTime($boundary));
+ $res = DB::getResult($query);
+
+ foreach ( $res as $row )
+ {
+ switch ( $row['vtype'] )
+ {
+ case 'register':
+ // delete all information about this site member. registration is undone because there was
+ // no timely activation
+ include_once($DIR_LIBS . 'ADMIN.php');
+ Admin::deleteOneMember(intval($row['vmember']));
+ break;
+ case 'addresschange':
+ // revert the e-mail address of the member back to old address
+ list($oldEmail, $oldCanLogin) = preg_split('#/#', $row['vextra']);
+ DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin). ', memail=' . DB::quoteValue($oldEmail). ' WHERE mnumber=' . intval($row['vmember']));
+ break;
+ case 'forgot':
+ // delete the activation link and ignore. member can request a new password using the
+ // forgot password link
+ break;
+ }
+ }
+
+ // 2. delete activation entries for real
+ $query = sprintf('DELETE FROM %s WHERE vtime < %s', sql_table('activation'), DB::formatDateTime($boundary));
+ DB::execute($query);
+ return;
+ }
+
+ /**
+ * Member::$language
+ *
+ * @obsolete
+ * @param void
+ * @return void
+ *
+ */
+ public $language = '';
+ /**
+ * Member::getLanguage()
+ *
+ * @obsolete
+ * @param void
+ * @return void
+ *
+ */
+ public function getLanguage()
+ {
+ if ( ($language = i18n::convert_locale_to_old_language_file_name($this->locale)) === FALSE )
+ {
+ $language = '';
+ }
+ return $language;
+ }
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Class used to represent a collection of e-mail addresses, to which a\r
- * message can be sent (e.g. comment or karma vote notification).\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: NOTIFICATION.php 1534 2011-06-22 06:13:23Z sakamocchi $\r
- */\r
-class Notification\r
-{\r
- static private $charset;\r
- static private $scheme = 'B';\r
- \r
- /**\r
- * NOTIFICATION::address_validation()\r
- * Validating the string as address\r
- * \r
- * FIXME: this is just migrated from globalfunctions.php\r
- * we should confirm this regular expression refering to RFC 5322\r
- * \r
- * @link http://www.ietf.org/rfc/rfc5322.txt\r
- * @see 3.4. Address Specification\r
- * \r
- * @static\r
- * @param String $address Address\r
- * @return Boolean valid or not\r
- */\r
- static public function address_validation($address)\r
- {\r
- return (boolean) preg_match('#^(?!\\.)(?:\\.?[-a-zA-Z0-9!\\#$%&\'*+/=?^_`{|}~]+)+@(?!\\.)(?:\\.?(?!-)[-a-zA-Z0-9]+(?<!-)){2,}$#', $address);\r
- }\r
- \r
- /**\r
- * NOTIFICATION::get_mail_footer()\r
- * Return mail footer with Nucleus CMS singnature\r
- * \r
- * @static\r
- * @param void\r
- * @return String Message body with \r
- */\r
- static public function get_mail_footer()\r
- {\r
- $message = "\n";\r
- $message .= "\n";\r
- $message .= "-----------------------------\n";\r
- $message .= " Powered by Nucleus CMS\n";\r
- $message .= "(http://www.nucleuscms.org/)\n";\r
- return $message;\r
- }\r
- \r
- /**\r
- * NOTIFICATION::mail\r
- * Send mails with headers including 7bit-encoded multibyte string\r
- * \r
- * @static\r
- * @param string $to receivers including singlebyte and multibyte strings, based on RFC 5322\r
- * @param string $subject subject including singlebyte and multibyte strings\r
- * @param string $message message including singlebyte and multibyte strings\r
- * @param string $from senders including singlebyte and multibyte strings, based on RFC 5322\r
- * @param string(B/Q) $scheme 7bit-encoder scheme based on RFC 2047\r
- * @return boolean accepted delivery or not\r
- */\r
- static public function mail($to, $subject, $message, $from, $charset, $scheme='B')\r
- {\r
- self::$charset = $charset;\r
- self::$scheme = $scheme;\r
- \r
- $to = self::mailbox_list_encoder($to);\r
- $subject = self::seven_bit_characters_encoder($subject);\r
- $from = 'From: ' . self::mailbox_list_encoder($from);\r
- \r
- /*\r
- * All of 7bit character encoding derives from ISO/IEC 646\r
- * So we can decide the body's encoding bit count by this regular expression.\r
- * \r
- */\r
- $bitcount = '8bit';\r
- if ( preg_match('#\A[\x00-\x7f]*\z#', $message) )\r
- {\r
- $bitcount = '7bit';\r
- }\r
- \r
- $header = 'Content-Type: text/html; charset=' . self::$charset . "; format=flowed; delsp=yes\n";\r
- $header .= "Content-Transfer-Encoding: {$bitcount}\n";\r
- $header .= "X-Mailer: Nucleus CMS NOTIFICATION class\n";\r
- \r
- return mail($to, $subject, $message, "{$from}\n{$header}");\r
- }\r
- \r
- /**\r
- * NOTIFICATION::mailbox_list_encoder\r
- * Encode multi byte strings included in mailbox.\r
- * The format of mailbox is based on RFC 5322, which obsoletes RFC 2822\r
- * \r
- * @link http://www.ietf.org/rfc/rfc5322.txt\r
- * @see 3.4. Address Specification\r
- * \r
- * @static\r
- * @param string $mailbox_list mailbox list\r
- * @return string encoded string \r
- * \r
- */\r
- static private function mailbox_list_encoder ($mailbox_list)\r
- {\r
- $encoded_mailboxes = array();\r
- $mailboxes = preg_split('#,#', $mailbox_list);\r
- foreach ( $mailboxes as $mailbox )\r
- {\r
- if ( preg_match("#^([^,]+)?<([^,]+)?@([^,]+)?>$#", $mailbox, $match) )\r
- {\r
- $display_name = self::seven_bit_characters_encoder(trim($match[1]));\r
- $local_part = trim($match[2]);\r
- $domain = trim($match[3]);\r
- $encoded_mailboxes[] = "{$display_name} <{$local_part}@{$domain}>";\r
- }\r
- else if ( preg_match("#([^,]+)?@([^,]+)?#", $mailbox) )\r
- {\r
- $encoded_mailboxes[] = $mailbox;\r
- }\r
- else\r
- {\r
- continue;\r
- }\r
- }\r
- if ( $encoded_mailboxes == array() )\r
- {\r
- return FALSE;\r
- }\r
- return implode(',', $encoded_mailboxes);\r
- }\r
- \r
- /**\r
- * NOTIFICATION::seven_bit_characters_encoder\r
- * Encoder into 7bit ASCII expression for Non-ASCII Text based on RFC 2047.\r
- * \r
- * @link http://www.ietf.org/rfc/rfc2047.txt\r
- * @see 2. Syntax of encoded-words\r
- * \r
- * NOTE: RFC 2047 has a ambiguousity for dealing with 'linear-white-space'.\r
- * This causes a trouble related to line breaking between single byte and multi-byte strings.\r
- * To avoid this, single byte string is encoded as well as multi byte string here.\r
- * \r
- * NOTE: RFC 2231 also defines the way to use non-ASCII characters in MIME header.\r
- * http://www.ietf.org/rfc/rfc2231.txt\r
- * \r
- * NOTE: iconv extension give the same functions as this in PHP5\r
- * iconv_mime_encode():\r
- * http://www.php.net/manual/en/function.iconv-mime-encode.php\r
- * \r
- * @static\r
- * @param string $charset Character set encoding\r
- * @param string $type type of 7 bit encoding, should be 'B' or 'Q'\r
- * @param string $string Target string with header field\r
- * @return string encoded string\r
- * \r
- */\r
- static private function seven_bit_characters_encoder($string)\r
- {\r
- $header = chr(13) . chr(10) . chr(32) . '=?' . self::$charset . '?' . self::$scheme . '?';\r
- $footer = "?=";\r
- $restriction = 78 - strlen($header) - strlen($footer) ;\r
- \r
- $encoded_words = array();\r
- for ( $i = 0; $i < i18n::strlen($string); $i++ )\r
- {\r
- if ( self::$scheme == 'B' )\r
- {\r
- if ( $i == 0 )\r
- {\r
- $letters = '';\r
- }\r
- \r
- $letter = i18n::substr($string, $i, 1);\r
- $expected_length = strlen($letters) + strlen($letter) * 4 / 3;\r
- \r
- if ( $expected_length > $restriction )\r
- {\r
- $encoded_text = self::b_encoder($letters);\r
- $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
- $letters = '';\r
- }\r
- \r
- $letters .= $letter;\r
- \r
- if ( $i == i18n::strlen($string) - 1 )\r
- {\r
- $encoded_text = self::b_encoder($letters);\r
- $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
- break;\r
- }\r
- continue;\r
- }\r
- else\r
- {\r
- if ( $i == 0 )\r
- {\r
- $encoded_text = '';\r
- }\r
- \r
- $encoded_letter = self::q_encoder(self::substr($string, $i, 1));\r
- $expected_length = strlen($encoded_text) + strlen($encoded_letter);\r
- \r
- if ( $expected_length > $restriction )\r
- {\r
- $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
- $letters = '';\r
- }\r
- \r
- $encoded_text .= $encoded_letter;\r
- \r
- if ( $i == i18n::strlen($string) - 1 )\r
- {\r
- $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
- break;\r
- }\r
- continue;\r
- }\r
- }\r
- \r
- return implode('', $encoded_words);\r
- }\r
- \r
- /**\r
- * NOTIFICATION::b_encoder()\r
- * \r
- * B encoder according to RFC 2047.\r
- * The "B" encoding is identical to the "BASE64" encoding defined by RFC 4648.\r
- * \r
- * @link http://www.ietf.org/rfc/rfc4648.txt\r
- * @see 6.8. Base64 Content-Transfer-Encoding\r
- * \r
- * NOTE: According to RFC 4648\r
- * (1) The final quantum of encoding input is an integral multiple of 24 bits;\r
- * here, the final unit of encoded output will be an integral multiple\r
- * of 4 characters with no "=" padding.\r
- * (2) The final quantum of encoding input is exactly 8 bits; here,\r
- * the final unit of encoded output will be two characters followed\r
- * by two "=" padding characters.\r
- * (3) The final quantum of encoding input is exactly 16 bits; here,\r
- * the final unit of encoded output will be three characters followed\r
- * by one "=" padding character.\r
- * \r
- * @static\r
- * @param string $target targetted string\r
- * @return string encoded string\r
- */\r
- static private function b_encoder($target)\r
- {\r
- return base64_encode($target);\r
- }\r
- \r
- /**\r
- * NOTIFICATION::q_encoder()\r
- * \r
- * Q encoder according to RFC 2047.\r
- * The "Q" encoding is similar to "Quoted-Printable" content-transfer-encoding defined in RFC 2045,\r
- * but the "Q" encoding and the "Quoted-Printable" are different a bit.\r
- * \r
- * @link http://www.ietf.org/rfc/rfc2047.txt\r
- * @see 4.2. The "Q" encoding\r
- * \r
- * NOTE: According to RFC 2047\r
- * (1) Any 8-bit value may be represented by a "=" followed by two hexadecimal digits.\r
- * For example, if the character set in use were ISO-8859-1,\r
- * the "=" character would thus be encoded as "=3D", and a SPACE by "=20".\r
- * (Upper case should be used for hexadecimal digits "A" through "F".)\r
- * (2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be\r
- * represented as "_" (underscore, ASCII 95.).\r
- * (This character may not pass through some internetwork mail gateways,\r
- * but its use will greatly enhance readability of "Q" encoded data\r
- * with mail readers that do not support this encoding.)\r
- * Note that the "_" always represents hexadecimal 20,\r
- * even if the SPACE character occupies a different code position\r
- * in the character set in use.\r
- * (3) 8-bit values which correspond to printable ASCII characters\r
- * other than "=", "?", and "_" (underscore), MAY be represented as those characters.\r
- * (But see section 5 for restrictions.)\r
- * In particular, SPACE and TAB MUST NOT be represented as themselves within encoded words.\r
- * \r
- * @static\r
- * @param string $target targetted string\r
- * @return string encoded string\r
- */\r
- static private function q_encoder($target)\r
- {\r
- $string = '';\r
- \r
- for ( $i = 0; $i < strlen($target); $i++ )\r
- {\r
- $letter = substr ($target, $i, 1);\r
- $order = ord($letter);\r
- \r
- // Printable ASCII characters without "=", "?", "_"\r
- if ((33 <= $order && $order <= 60)\r
- || (62 == $order)\r
- || (64 <= $order && $order <= 94)\r
- || (96 <= $order && $order <= 126))\r
- {\r
- $string .= strtoupper(dechex($order));\r
- }\r
- // Space shuold be encoded as the same strings as "_"\r
- else if ($order == 32)\r
- {\r
- $string .= '_';\r
- }\r
- // Other characters\r
- else\r
- {\r
- $string .= '=' . strtoupper(dechex($order));\r
- }\r
- }\r
- \r
- return $string;\r
- }\r
- \r
- /**\r
- * NOTICE: Deprecated\r
- * NOTIFICATION::$addresses\r
- * \r
- * @deprecated\r
- */\r
- private $addresses = array();\r
- \r
- /**\r
- * NOTICE: Deprecated\r
- * takes one string as argument, containing multiple e-mail addresses\r
- * separated by semicolons\r
- * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com\r
- * \r
- * @deprecated\r
- */\r
- function __construct($addresses)\r
- {\r
- $this->addresses = preg_split('#;#' , $addresses);\r
- }\r
- \r
- /**\r
- * NOTICE: Deprecated\r
- * NOTIFICATION::validAddresses()\r
- * \r
- * returns true if all addresses are valid\r
- * \r
- * @deprecated\r
- * @param Void\r
- * @return Boolean\r
- */\r
- function validAddresses()\r
- {\r
- foreach ( $this->addresses as $address )\r
- {\r
- if ( !self::address_validation(trim($address)) )\r
- {\r
- return 0;\r
- }\r
- }\r
- return 1;\r
- }\r
- \r
- /**\r
- * NOTICE: Deprecated\r
- * NOTIFICATION::notify()\r
- * \r
- * Sends email messages to all the email addresses\r
- * \r
- * @deprecated\r
- * @param String $title \r
- * @param String $message \r
- * @param String $from \r
- * @return Void\r
- */\r
- function notify($title, $message, $from)\r
- {\r
- global $member;\r
- $addresses = array();\r
- \r
- foreach ($this->addresses as $address)\r
- {\r
- if ( $member->isLoggedIn() && ($member->getEmail() == $address) )\r
- {\r
- continue;\r
- }\r
- $addresses[] = $address;\r
- }\r
- \r
- self::mail(implode(',', $addresses), $title, $message , $from);\r
- return;\r
- }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Class used to represent a collection of e-mail addresses, to which a
+ * message can be sent (e.g. comment or karma vote notification).
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: NOTIFICATION.php 1836 2012-05-12 10:38:31Z sakamocchi $
+ */
+class Notification
+{
+ static private $charset;
+ static private $scheme = 'B';
+
+ /**
+ * NOTIFICATION::address_validation()
+ * Validating the string as address
+ *
+ * FIXME: this is just migrated from globalfunctions.php
+ * we should confirm this regular expression refering to RFC 5322
+ *
+ * @link http://www.ietf.org/rfc/rfc5322.txt
+ * @see 3.4. Address Specification
+ *
+ * @static
+ * @param String $address Address
+ * @return Boolean valid or not
+ */
+ static public function address_validation($address)
+ {
+ return (boolean) preg_match('#^(?!\\.)(?:\\.?[-a-zA-Z0-9!\\#$%&\'*+/=?^_`{|}~]+)+@(?!\\.)(?:\\.?(?!-)[-a-zA-Z0-9]+(?<!-)){2,}$#', $address);
+ }
+
+ /**
+ * NOTIFICATION::get_mail_footer()
+ * Return mail footer with Nucleus CMS singnature
+ *
+ * @static
+ * @param void
+ * @return String Message body with
+ */
+ static public function get_mail_footer()
+ {
+ $message = "\n";
+ $message .= "\n";
+ $message .= "-----------------------------\n";
+ $message .= " Powered by Nucleus CMS\n";
+ $message .= "(http://www.nucleuscms.org/)\n";
+ return $message;
+ }
+
+ /**
+ * NOTIFICATION::mail
+ * Send mails with headers including 7bit-encoded multibyte string
+ *
+ * @static
+ * @param string $to receivers including singlebyte and multibyte strings, based on RFC 5322
+ * @param string $subject subject including singlebyte and multibyte strings
+ * @param string $message message including singlebyte and multibyte strings
+ * @param string $from senders including singlebyte and multibyte strings, based on RFC 5322
+ * @param string(B/Q) $scheme 7bit-encoder scheme based on RFC 2047
+ * @return boolean accepted delivery or not
+ */
+ static public function mail($to, $subject, $message, $from, $charset, $scheme='B')
+ {
+ self::$charset = $charset;
+ self::$scheme = $scheme;
+
+ $to = self::mailbox_list_encoder($to);
+ $subject = self::seven_bit_characters_encoder($subject);
+ $from = 'From: ' . self::mailbox_list_encoder($from);
+
+ /*
+ * All of 7bit character encoding derives from ISO/IEC 646
+ * So we can decide the body's encoding bit count by this regular expression.
+ *
+ */
+ $bitcount = '8bit';
+ if ( preg_match('#\A[\x00-\x7f]*\z#', $message) )
+ {
+ $bitcount = '7bit';
+ }
+
+ $header = 'Content-Type: text/plain; charset=' . self::$charset . "; format=flowed; delsp=yes\n";
+ $header .= "Content-Transfer-Encoding: {$bitcount}\n";
+ $header .= "X-Mailer: Nucleus CMS NOTIFICATION class\n";
+
+ return mail($to, $subject, $message, "{$from}\n{$header}");
+ }
+
+ /**
+ * NOTIFICATION::mailbox_list_encoder
+ * Encode multi byte strings included in mailbox.
+ * The format of mailbox is based on RFC 5322, which obsoletes RFC 2822
+ *
+ * @link http://www.ietf.org/rfc/rfc5322.txt
+ * @see 3.4. Address Specification
+ *
+ * @static
+ * @param string $mailbox_list mailbox list
+ * @return string encoded string
+ *
+ */
+ static private function mailbox_list_encoder ($mailbox_list)
+ {
+ $encoded_mailboxes = array();
+ $mailboxes = preg_split('#,#', $mailbox_list);
+ foreach ( $mailboxes as $mailbox )
+ {
+ if ( preg_match("#^([^,]+)?<([^,]+)?@([^,]+)?>$#", $mailbox, $match) )
+ {
+ $display_name = self::seven_bit_characters_encoder(trim($match[1]));
+ $local_part = trim($match[2]);
+ $domain = trim($match[3]);
+ $encoded_mailboxes[] = "{$display_name} <{$local_part}@{$domain}>";
+ }
+ else if ( preg_match("#([^,]+)?@([^,]+)?#", $mailbox) )
+ {
+ $encoded_mailboxes[] = $mailbox;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ if ( $encoded_mailboxes == array() )
+ {
+ return FALSE;
+ }
+ return implode(',', $encoded_mailboxes);
+ }
+
+ /**
+ * NOTIFICATION::seven_bit_characters_encoder
+ * Encoder into 7bit ASCII expression for Non-ASCII Text based on RFC 2047.
+ *
+ * @link http://www.ietf.org/rfc/rfc2047.txt
+ * @see 2. Syntax of encoded-words
+ *
+ * NOTE: RFC 2047 has a ambiguousity for dealing with 'linear-white-space'.
+ * This causes a trouble related to line breaking between single byte and multi-byte strings.
+ * To avoid this, single byte string is encoded as well as multi byte string here.
+ *
+ * NOTE: RFC 2231 also defines the way to use non-ASCII characters in MIME header.
+ * http://www.ietf.org/rfc/rfc2231.txt
+ *
+ * NOTE: iconv extension give the same functions as this in PHP5
+ * iconv_mime_encode():
+ * http://www.php.net/manual/en/function.iconv-mime-encode.php
+ *
+ * @static
+ * @param string $charset Character set encoding
+ * @param string $type type of 7 bit encoding, should be 'B' or 'Q'
+ * @param string $string Target string with header field
+ * @return string encoded string
+ *
+ */
+ static private function seven_bit_characters_encoder($string)
+ {
+ $header = chr(13) . chr(10) . chr(32) . '=?' . self::$charset . '?' . self::$scheme . '?';
+ $footer = "?=";
+ $restriction = 78 - strlen($header) - strlen($footer) ;
+
+ $encoded_words = array();
+ for ( $i = 0; $i < i18n::strlen($string); $i++ )
+ {
+ if ( self::$scheme == 'B' )
+ {
+ if ( $i == 0 )
+ {
+ $letters = '';
+ }
+
+ $letter = i18n::substr($string, $i, 1);
+ $expected_length = strlen($letters) + strlen($letter) * 4 / 3;
+
+ if ( $expected_length > $restriction )
+ {
+ $encoded_text = self::b_encoder($letters);
+ $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+ $letters = '';
+ }
+
+ $letters .= $letter;
+
+ if ( $i == i18n::strlen($string) - 1 )
+ {
+ $encoded_text = self::b_encoder($letters);
+ $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+ break;
+ }
+ continue;
+ }
+ else
+ {
+ if ( $i == 0 )
+ {
+ $encoded_text = '';
+ }
+
+ $encoded_letter = self::q_encoder(i18n::substr($string, $i, 1));
+ $expected_length = strlen($encoded_text) + strlen($encoded_letter);
+
+ if ( $expected_length > $restriction )
+ {
+ $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+ $letters = '';
+ }
+
+ $encoded_text .= $encoded_letter;
+
+ if ( $i == i18n::strlen($string) - 1 )
+ {
+ $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+ break;
+ }
+ continue;
+ }
+ }
+
+ return implode('', $encoded_words);
+ }
+
+ /**
+ * NOTIFICATION::b_encoder()
+ *
+ * B encoder according to RFC 2047.
+ * The "B" encoding is identical to the "BASE64" encoding defined by RFC 4648.
+ *
+ * @link http://www.ietf.org/rfc/rfc4648.txt
+ * @see 6.8. Base64 Content-Transfer-Encoding
+ *
+ * NOTE: According to RFC 4648
+ * (1) The final quantum of encoding input is an integral multiple of 24 bits;
+ * here, the final unit of encoded output will be an integral multiple
+ * of 4 characters with no "=" padding.
+ * (2) The final quantum of encoding input is exactly 8 bits; here,
+ * the final unit of encoded output will be two characters followed
+ * by two "=" padding characters.
+ * (3) The final quantum of encoding input is exactly 16 bits; here,
+ * the final unit of encoded output will be three characters followed
+ * by one "=" padding character.
+ *
+ * @static
+ * @param string $target targetted string
+ * @return string encoded string
+ */
+ static private function b_encoder($target)
+ {
+ return base64_encode($target);
+ }
+
+ /**
+ * NOTIFICATION::q_encoder()
+ *
+ * Q encoder according to RFC 2047.
+ * The "Q" encoding is similar to "Quoted-Printable" content-transfer-encoding defined in RFC 2045,
+ * but the "Q" encoding and the "Quoted-Printable" are different a bit.
+ *
+ * @link http://www.ietf.org/rfc/rfc2047.txt
+ * @see 4.2. The "Q" encoding
+ *
+ * NOTE: According to RFC 2047
+ * (1) Any 8-bit value may be represented by a "=" followed by two hexadecimal digits.
+ * For example, if the character set in use were ISO-8859-1,
+ * the "=" character would thus be encoded as "=3D", and a SPACE by "=20".
+ * (Upper case should be used for hexadecimal digits "A" through "F".)
+ * (2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
+ * represented as "_" (underscore, ASCII 95.).
+ * (This character may not pass through some internetwork mail gateways,
+ * but its use will greatly enhance readability of "Q" encoded data
+ * with mail readers that do not support this encoding.)
+ * Note that the "_" always represents hexadecimal 20,
+ * even if the SPACE character occupies a different code position
+ * in the character set in use.
+ * (3) 8-bit values which correspond to printable ASCII characters
+ * other than "=", "?", and "_" (underscore), MAY be represented as those characters.
+ * (But see section 5 for restrictions.)
+ * In particular, SPACE and TAB MUST NOT be represented as themselves within encoded words.
+ *
+ * @static
+ * @param string $target targetted string
+ * @return string encoded string
+ */
+ static private function q_encoder($target)
+ {
+ $string = '';
+
+ for ( $i = 0; $i < strlen($target); $i++ )
+ {
+ $letter = substr ($target, $i, 1);
+ $order = ord($letter);
+
+ // Printable ASCII characters without "=", "?", "_"
+ if ((33 <= $order && $order <= 60)
+ || (62 == $order)
+ || (64 <= $order && $order <= 94)
+ || (96 <= $order && $order <= 126))
+ {
+ $string .= strtoupper(dechex($order));
+ }
+ // Space shuold be encoded as the same strings as "_"
+ else if ($order == 32)
+ {
+ $string .= '_';
+ }
+ // Other characters
+ else
+ {
+ $string .= '=' . strtoupper(dechex($order));
+ }
+ }
+
+ return $string;
+ }
+
+ /**
+ * NOTICE: Deprecated
+ * NOTIFICATION::$addresses
+ *
+ * @deprecated
+ */
+ private $addresses = array();
+
+ /**
+ * NOTICE: Deprecated
+ * takes one string as argument, containing multiple e-mail addresses
+ * separated by semicolons
+ * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com
+ *
+ * @deprecated
+ */
+ function __construct($addresses)
+ {
+ $this->addresses = preg_split('#;#' , $addresses);
+ }
+
+ /**
+ * NOTICE: Deprecated
+ * NOTIFICATION::validAddresses()
+ *
+ * returns true if all addresses are valid
+ *
+ * @deprecated
+ * @param Void
+ * @return Boolean
+ */
+ function validAddresses()
+ {
+ foreach ( $this->addresses as $address )
+ {
+ if ( !self::address_validation(trim($address)) )
+ {
+ return 0;
+ }
+ }
+ return 1;
+ }
+
+ /**
+ * NOTICE: Deprecated
+ * NOTIFICATION::notify()
+ *
+ * Sends email messages to all the email addresses
+ *
+ * @deprecated
+ * @param String $title
+ * @param String $message
+ * @param String $from
+ * @return Void
+ */
+ function notify($title, $message, $from)
+ {
+ global $member;
+ $addresses = array();
+
+ foreach ($this->addresses as $address)
+ {
+ if ( $member->isLoggedIn() && ($member->getEmail() == $address) )
+ {
+ continue;
+ }
+ $addresses[] = $address;
+ }
+
+ self::mail(implode(',', $addresses), $title, $message , $from);
+ return;
+ }
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: PARSER.php 1757 2012-04-15 09:02:32Z sakamocchi $\r
- */\r
-\r
-if ( !function_exists('requestVar') )\r
-{\r
- exit;\r
-}\r
-require_once dirname(__FILE__) . '/BaseActions.php';\r
-\r
-/**\r
- * This is the parser class of Nucleus. It is used for various things\r
- * (skin parsing, form generation, ...)\r
- */\r
-class Parser\r
-{\r
- // array with the names of all allowed actions\r
- public $actions;\r
- \r
- // reference to actions handler\r
- public $handler;\r
- \r
- // reference to an instance of Skin class\r
- public $skin = NULL;\r
- \r
- // delimiters that can be used for skin/templatevars\r
- public $delim;\r
- \r
- // parameter delimiter (to separate skinvar params)\r
- public $pdelim;\r
- \r
- // usually set to 0. When set to 1, all skinvars are allowed regardless of $actions\r
- public $norestrictions;\r
- \r
- /**\r
- * Parset::__construct()\r
- * Creates a new parser object with the given allowed actions\r
- * and the given handler\r
- *\r
- * @param $handler class object with functions for each action (reference)\r
- * @param $delim optional delimiter\r
- * @param $paramdelim optional parameterdelimiter\r
- */\r
- public function __construct( &$handler, $delim = '(<%|%>)', $pdelim = ',')\r
- {\r
- $this->handler = &$handler;\r
- $this->actions = $handler->getAvailableActions();\r
- $this->delim = $delim;\r
- $this->pdelim = $pdelim;\r
- $this->norestrictions = 0; // set this to 1 to disable checking for allowedActions\r
- \r
- $this->skin = NULL;\r
- \r
- $handler->setParser($this);\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Parses the given contents and outputs it\r
- */\r
- public function parse(&$contents)\r
- {\r
- /* escaping only pcre delimiter */\r
- $pcre = preg_replace('#\##', '#', $this->delim);\r
- \r
- $pieces = preg_split("#{$pcre}#", $contents);\r
- \r
- $maxidx = sizeof($pieces);\r
- for ( $idx = 0; $idx < $maxidx; $idx++ )\r
- {\r
- echo $pieces[$idx];\r
- $idx++;\r
- if ( $idx < $maxidx )\r
- {\r
- $this->doAction($pieces[$idx]);\r
- }\r
- }\r
- return;\r
- }\r
-\r
-\r
- /**\r
- * Parset::doAction()\r
- * Called from the parser to handle an action\r
- * \r
- * @param string $action name of the action (e.g. blog, image ...)\r
- * @return void\r
- */\r
- public function doAction($action)\r
- {\r
- global $manager, $CONF;\r
-\r
- if ( !$action )\r
- {\r
- return;\r
- }\r
- \r
- // split into action name + arguments\r
- if ( i18n::strpos($action, '(') != FALSE )\r
- {\r
- $paramStartPos = i18n::strpos($action, '(');\r
- $params = i18n::substr($action, $paramStartPos + 1, i18n::strlen($action) - $paramStartPos - 2);\r
- $action = i18n::substr($action, 0, $paramStartPos);\r
- $params = preg_split ('#' . preg_quote($this->pdelim, '#') . '#', $params);\r
- $params = array_map('trim', $params);\r
- }\r
- else\r
- {\r
- // no parameters\r
- $params = array();\r
- }\r
- \r
- $actionlc = strtolower($action);\r
- \r
- // skip execution of skinvars while inside an if condition which hides this part of the page\r
- $if_tags = array('else', 'elseif', 'endif', 'ifnot', 'elseifnot');\r
- if ( !$this->handler->getTopIfCondition()\r
- && !in_array($actionlc, $if_tags)\r
- && (i18n::substr($actionlc, 0, 2) != 'if') )\r
- {\r
- return;\r
- }\r
- \r
- if ( in_array($actionlc, $this->actions) || $this->norestrictions )\r
- {\r
- call_user_func_array(array(&$this->handler, "parse_{$actionlc}"), $params);\r
- }\r
- else\r
- {\r
- // redirect to plugin action if possible\r
- if ( in_array('plugin', $this->actions) && $manager->pluginInstalled("NP_{$action}") )\r
- {\r
- $this->doAction('plugin(' . $action . $this->pdelim . implode($this->pdelim,$params) . ')');\r
- }\r
- else\r
- {\r
- if ( $CONF['DebugVars']==true )\r
- {\r
- echo '<%' , $action , '(', implode($this->pdelim, $params), ')%>';\r
- }\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Parser::setSkin()\r
- * Set the skin\r
- * @param object $skin an instance of Skin class\r
- * @return void\r
- */\r
- public function setSkin(&$skin)\r
- {\r
- $this->skin = &$skin;\r
- return;\r
- }\r
- \r
- /**\r
- * Parser::setProperty()\r
- * Set a property of the parser in the manager\r
- * \r
- * @static\r
- * @param string $property additional parser property (e.g. include prefix of the skin)\r
- * @param string $value new value\r
- * @return void\r
- */\r
- static public function setProperty($property, $value)\r
- {\r
- global $manager;\r
- $manager->setParserProperty($property, $value);\r
- return;\r
- }\r
-\r
- /**\r
- * Parser::getProperty()\r
- * Get a property of the parser from the manager\r
- * \r
- * @static\r
- * @param string $name name of the property\r
- * @return string value of the property\r
- */\r
- static public function getProperty($name)\r
- {\r
- global $manager;\r
- return $manager->getParserProperty($name);\r
- }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: PARSER.php 1879 2012-06-17 07:45:09Z sakamocchi $
+ */
+
+if ( !function_exists('requestVar') )
+{
+ exit;
+}
+require_once dirname(__FILE__) . '/BaseActions.php';
+
+/**
+ * This is the parser class of Nucleus. It is used for various things
+ * (skin parsing, form generation, ...)
+ */
+class Parser
+{
+ // array with the names of all allowed actions
+ public $actions;
+
+ // reference to actions handler
+ public $handler;
+
+ // reference to an instance of Skin class
+ public $skin = NULL;
+
+ // delimiters that can be used for skin/templatevars
+ public $delim;
+
+ // parameter delimiter (to separate skinvar params)
+ public $pdelim;
+
+ // usually set to 0. When set to 1, all skinvars are allowed regardless of $actions
+ public $norestrictions;
+
+ /**
+ * Parset::__construct()
+ * Creates a new parser object with the given allowed actions
+ * and the given handler
+ *
+ * @param $handler class object with functions for each action (reference)
+ * @param $delim optional delimiter
+ * @param $paramdelim optional parameterdelimiter
+ */
+ public function __construct( &$handler, $delim = '(<%|%>)', $pdelim = ',')
+ {
+ $this->handler = &$handler;
+ $this->actions = $handler->getAvailableActions();
+ $this->delim = $delim;
+ $this->pdelim = $pdelim;
+ $this->norestrictions = 0; // set this to 1 to disable checking for allowedActions
+
+ $handler->setParser($this);
+
+ return;
+ }
+
+ /**
+ * Parses the given contents and outputs it
+ */
+ public function parse(&$contents)
+ {
+ /* escaping only pcre delimiter */
+ $pcre = preg_replace('#\##', '#', $this->delim);
+
+ $pieces = preg_split("#{$pcre}#", $contents);
+
+ $maxidx = sizeof($pieces);
+ for ( $idx = 0; $idx < $maxidx; $idx++ )
+ {
+ echo $pieces[$idx];
+ $idx++;
+ if ( $idx < $maxidx )
+ {
+ $this->doAction($pieces[$idx]);
+ }
+ }
+ return;
+ }
+
+
+ /**
+ * Parset::doAction()
+ * Called from the parser to handle an action
+ *
+ * @param string $action name of the action (e.g. blog, image ...)
+ * @return void
+ */
+ public function doAction($action)
+ {
+ global $manager, $CONF;
+
+ if ( !$action )
+ {
+ return;
+ }
+
+ // split into action name + arguments
+ if ( i18n::strpos($action, '(') != FALSE )
+ {
+ $paramStartPos = i18n::strpos($action, '(');
+ $params = i18n::substr($action, $paramStartPos + 1, i18n::strlen($action) - $paramStartPos - 2);
+ $action = i18n::substr($action, 0, $paramStartPos);
+ $params = preg_split ('#' . preg_quote($this->pdelim, '#') . '#', $params);
+ $params = array_map('trim', $params);
+ }
+ else
+ {
+ // no parameters
+ $params = array();
+ }
+
+ $actionlc = strtolower($action);
+
+ // skip execution of skinvars while inside an if condition which hides this part of the page
+ $if_tags = array('else', 'elseif', 'endif', 'ifnot', 'elseifnot');
+ if ( !$this->handler->getTopIfCondition()
+ && !in_array($actionlc, $if_tags)
+ && (i18n::substr($actionlc, 0, 2) != 'if') )
+ {
+ return;
+ }
+
+ if ( in_array($actionlc, $this->actions) || $this->norestrictions )
+ {
+ call_user_func_array(array(&$this->handler, "parse_{$actionlc}"), $params);
+ }
+ else
+ {
+ // redirect to plugin action if possible
+ if ( in_array('plugin', $this->actions) && $manager->pluginInstalled("NP_{$action}") )
+ {
+ $this->doAction('plugin(' . $action . $this->pdelim . implode($this->pdelim,$params) . ')');
+ }
+ else
+ {
+ if ( $CONF['DebugVars']==true )
+ {
+ echo '<%' , $action , '(', implode($this->pdelim, $params), ')%>';
+ }
+ }
+ }
+ return;
+ }
+
+ /**
+ * Parser::setSkin()
+ * Set the skin
+ * @param object $skin an instance of Skin class
+ * @return void
+ */
+ public function setSkin(&$skin)
+ {
+ $this->skin = &$skin;
+ return;
+ }
+
+ /**
+ * Parser::setProperty()
+ * Set a property of the parser in the manager
+ *
+ * @static
+ * @param string $property additional parser property (e.g. include prefix of the skin)
+ * @param string $value new value
+ * @return void
+ */
+ static public function setProperty($property, $value)
+ {
+ global $manager;
+ $manager->setParserProperty($property, $value);
+ return;
+ }
+
+ /**
+ * Parser::getProperty()
+ * Get a property of the parser from the manager
+ *
+ * @static
+ * @param string $name name of the property
+ * @return string value of the property
+ */
+ static public function getProperty($name)
+ {
+ global $manager;
+ return $manager->getParserProperty($name);
+ }
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * This is an (abstract) class of which all Nucleus Plugins must inherit\r
- *\r
- * for more information on plugins and how to write your own, see the\r
- * plugins.html file that is included with the Nucleus documenation\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: PLUGIN.php 1630 2012-01-28 12:16:14Z sakamocchi $\r
- */\r
-abstract class NucleusPlugin\r
-{\r
- // these public functions should to be redefined in your plugin\r
- public function getName()\r
- {\r
- return __CLASS__;\r
- }\r
- \r
- public function getAuthor()\r
- {\r
- return 'Undefined';\r
- }\r
- \r
- public function getURL()\r
- {\r
- return 'Undefined';\r
- }\r
- \r
- public function getVersion()\r
- {\r
- return '0.0';\r
- }\r
- \r
- public function getDescription()\r
- {\r
- return 'Undefined';\r
- }\r
- \r
- // these final public function _may_ be redefined in your plugin\r
- \r
- public function getMinNucleusVersion()\r
- {\r
- return 150;\r
- }\r
- \r
- public function getMinNucleusPatchLevel()\r
- {\r
- return 0;\r
- }\r
- \r
- public function getEventList()\r
- {\r
- return array();\r
- }\r
- \r
- public function getTableList()\r
- {\r
- return array();\r
- }\r
- \r
- public function hasAdminArea()\r
- {\r
- return 0;\r
- }\r
- \r
- public function install()\r
- {\r
- return;\r
- }\r
- \r
- public function unInstall()\r
- {\r
- return;\r
- }\r
- \r
- public function init()\r
- {\r
- return;\r
- }\r
- \r
- public function doSkinVar($skinType)\r
- {\r
- return;\r
- }\r
- \r
- public function doTemplateVar(&$item)\r
- {\r
- $args = func_get_args();\r
- array_shift($args);\r
- array_unshift($args, 'template');\r
- call_user_func_array(array(&$this,'doSkinVar'),$args);\r
- return;\r
- }\r
- \r
- public function doTemplateCommentsVar(&$item, &$comment)\r
- {\r
- $args = func_get_args();\r
- array_shift($args);\r
- array_shift($args);\r
- array_unshift($args, 'template');\r
- call_user_func_array(array(&$this,'doSkinVar'),$args);\r
- return;\r
- }\r
- \r
- public function doAction($type)\r
- {\r
- return _ERROR_PLUGIN_NOSUCHACTION;\r
- }\r
- \r
- public function doIf($key,$value)\r
- {\r
- return false;\r
- }\r
- \r
- public function doItemVar (&$item)\r
- {\r
- return;\r
- }\r
- \r
- /**\r
- * Checks if a plugin supports a certain feature.\r
- *\r
- * @returns 1 if the feature is reported, 0 if not\r
- * @param $feature\r
- * Name of the feature. See plugin documentation for more info\r
- * 'SqlTablePrefix' -> if the plugin uses the sql_table() method to get table names\r
- * 'HelpPage' -> if the plugin provides a helppage\r
- * 'SqlApi' -> if the plugin uses the complete sql_* or DB::* api (must also require nucleuscms 3.5)\r
- */\r
- public function supportsFeature($feature)\r
- {\r
- return 0;\r
- }\r
- \r
- /**\r
- * Report a list of plugin that is required to final public function\r
- *\r
- * @returns an array of names of plugin, an empty array indicates no dependency\r
- */\r
- public function getPluginDep()\r
- {\r
- return array();\r
- }\r
- \r
- // these helper final public functions should not be redefined in your plugin\r
- \r
- /**\r
- * Creates a new option for this plugin\r
- *\r
- * @param name\r
- * A string uniquely identifying your option. (max. length is 20 characters)\r
- * @param description\r
- * A description that will show up in the nucleus admin area (max. length: 255 characters)\r
- * @param type\r
- * Either 'text', 'yesno' or 'password'\r
- * This info is used when showing 'edit plugin options' screens\r
- * @param value\r
- * Initial value for the option (max. value length is 128 characters)\r
- */\r
- final public function createOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
- {\r
- return $this->create_option('global', $name, $desc, $type, $defValue, $typeExtras);\r
- }\r
- \r
- final public function createBlogOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
- {\r
- return $this->create_option('blog', $name, $desc, $type, $defValue, $typeExtras);\r
- }\r
- \r
- final public function createMemberOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
- {\r
- return $this->create_option('member', $name, $desc, $type, $defValue, $typeExtras);\r
- }\r
- \r
- final public function createCategoryOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
- {\r
- return $this->create_option('category', $name, $desc, $type, $defValue, $typeExtras);\r
- }\r
- \r
- final public function createItemOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
- {\r
- return $this->create_option('item', $name, $desc, $type, $defValue, $typeExtras);\r
- }\r
- \r
- /**\r
- * Removes the option from the database\r
- *\r
- * Note: Options get erased automatically on plugin uninstall\r
- */\r
- final public function deleteOption($name)\r
- {\r
- return $this->delete_option('global', $name);\r
- }\r
- \r
- final public function deleteBlogOption($name)\r
- {\r
- return $this->delete_option('blog', $name);\r
- }\r
- \r
- final public function deleteMemberOption($name)\r
- {\r
- return $this->delete_option('member', $name);\r
- }\r
- \r
- final public function deleteCategoryOption($name)\r
- {\r
- return $this->delete_option('category', $name);\r
- }\r
- \r
- final public function deleteItemOption($name)\r
- {\r
- return $this->delete_option('item', $name);\r
- }\r
- \r
- /**\r
- * Sets the value of an option to something new\r
- */\r
- final public function setOption($name, $value)\r
- {\r
- return $this->set_option('global', 0, $name, $value);\r
- }\r
- \r
- final public function setBlogOption($blogid, $name, $value)\r
- {\r
- return $this->set_option('blog', $blogid, $name, $value);\r
- }\r
- \r
- final public function setMemberOption($memberid, $name, $value)\r
- {\r
- return $this->set_option('member', $memberid, $name, $value);\r
- }\r
- \r
- final public function setCategoryOption($catid, $name, $value)\r
- {\r
- return $this->set_option('category', $catid, $name, $value);\r
- }\r
- \r
- final public function setItemOption($itemid, $name, $value) {\r
- return $this->set_option('item', $itemid, $name, $value);\r
- }\r
- \r
- /**\r
- * Retrieves the current value for an option\r
- */\r
- final public function getOption($name)\r
- {\r
- // only request the options the very first time. On subsequent requests\r
- // the static collection is used to save SQL queries.\r
- if ( $this->plugin_options == 0 )\r
- {\r
- $this->plugin_options = array();\r
- \r
- $query = "SELECT d.oname as name, o.ovalue as value FROM %s o, %s d WHERE d.opid=%d AND d.oid=o.oid;";\r
- $query = sprintf($query, sql_table('plugin_option'), sql_table('plugin_option_desc'), (integer) $this->plugid);\r
- $result = DB::getResult($query);\r
- foreach ( $result as $row )\r
- {\r
- $this->plugin_options[strtolower($row['name'])] = $row['value'];\r
- }\r
- }\r
- if ( isset($this->plugin_options[strtolower($name)]) )\r
- {\r
- return $this->plugin_options[strtolower($name)];\r
- }\r
- else\r
- {\r
- return $this->get_option('global', 0, $name);\r
- }\r
- }\r
- \r
- final public function getBlogOption($blogid, $name)\r
- {\r
- return $this->get_option('blog', $blogid, $name);\r
- }\r
- \r
- final public function getMemberOption($memberid, $name)\r
- {\r
- return $this->get_option('member', $memberid, $name);\r
- }\r
- \r
- final public function getCategoryOption($catid, $name)\r
- {\r
- return $this->get_option('category', $catid, $name);\r
- }\r
- \r
- final public function getItemOption($itemid, $name)\r
- {\r
- return $this->get_option('item', $itemid, $name);\r
- }\r
- \r
- /**\r
- * Retrieves an associative array with the option value for each\r
- * context id\r
- */\r
- final public function getAllBlogOptions($name)\r
- {\r
- return $this->get_all_options('blog', $name);\r
- }\r
- \r
- final public function getAllMemberOptions($name)\r
- {\r
- return $this->get_all_options('member', $name);\r
- }\r
- \r
- final public function getAllCategoryOptions($name)\r
- {\r
- return $this->get_all_options('category', $name);\r
- }\r
- \r
- final public function getAllItemOptions($name)\r
- {\r
- return $this->get_all_options('item', $name);\r
- }\r
- \r
- /**\r
- * Retrieves an indexed array with the top (or bottom) of an option\r
- * (delegates to getOptionTop())\r
- */\r
- final public function getBlogOptionTop($name, $amount = 10, $sort = 'desc')\r
- {\r
- return $this->get_option_top('blog', $name, $amount, $sort);\r
- }\r
- \r
- final public function getMemberOptionTop($name, $amount = 10, $sort = 'desc')\r
- {\r
- return $this->get_option_top('member', $name, $amount, $sort);\r
- }\r
- \r
- final public function getCategoryOptionTop($name, $amount = 10, $sort = 'desc')\r
- {\r
- return $this->get_option_top('category', $name, $amount, $sort);\r
- }\r
- \r
- final public function getItemOptionTop($name, $amount = 10, $sort = 'desc')\r
- {\r
- return $this->get_option_top('item', $name, $amount, $sort);\r
- }\r
- \r
- /**\r
- * NucleusPlugin::getID()\r
- * get id for this plugin\r
- * \r
- * @access public\r
- * @param void\r
- * @return integer this plugid id\r
- */\r
- final public function getID()\r
- {\r
- return (integer) $this->plugid;\r
- }\r
- \r
- /**\r
- * NucleusPlugin::setID()\r
- * set favorite id for this plugin\r
- * \r
- * @access public\r
- * @param integer $plugid favorite id for plugin\r
- * @return void\r
- */\r
- final public function setID($plugid)\r
- {\r
- $this->plugid = (integer) $plugid;\r
- return;\r
- }\r
- \r
- /**\r
- * Returns the URL of the admin area for this plugin (in case there's\r
- * no such area, the returned information is invalid)\r
- *\r
- * public\r
- */\r
- final public function getAdminURL()\r
- {\r
- global $CONF;\r
- return $CONF['PluginURL'] . $this->getShortName() . '/';\r
- }\r
- \r
- /**\r
- * Returns the directory where the admin directory is located and\r
- * where the plugin can maintain his extra files\r
- *\r
- * public\r
- */\r
- final public function getDirectory()\r
- {\r
- global $DIR_PLUGINS;\r
- return $DIR_PLUGINS . $this->getShortName() . '/';\r
- }\r
- \r
- /**\r
- * Derives the short name for the plugin from the classname (all\r
- * lowercase)\r
- *\r
- * public\r
- */\r
- final public function getShortName()\r
- {\r
- return str_replace('np_','',strtolower(get_class($this)));\r
- }\r
- \r
- /**\r
- * Clears the option value cache which saves the option values during\r
- * the plugin execution. This function is usefull if the options has\r
- * changed during the plugin execution (especially in association with\r
- * the PrePluginOptionsUpdate and the PostPluginOptionsUpdate events)\r
- * \r
- * public\r
- **/\r
- final public function clearOptionValueCache()\r
- {\r
- $this->option_values = array();\r
- $this->plugin_options = 0;\r
- return;\r
- }\r
- \r
- // internal functions of the class starts here\r
- protected $option_values; // oid_contextid => value\r
- protected $option_info; // context_name => array('oid' => ..., 'default' => ...)\r
- protected $plugin_options; // see getOption()\r
- protected $plugid; // plugin id\r
- \r
- /**\r
- * Class constructor: Initializes some internal data\r
- */\r
- public function __construct()\r
- {\r
- $this->option_values = array(); // oid_contextid => value\r
- $this->option_info = array(); // context_name => array('oid' => ..., 'default' => ...)\r
- $this->plugin_options = 0;\r
- }\r
- \r
- /**\r
- * Retrieves an array of the top (or bottom) of an option from a plugin.\r
- * @author TeRanEX\r
- * @param string $context the context for the option: item, blog, member,...\r
- * @param string $name the name of the option\r
- * @param int $amount how many rows must be returned\r
- * @param string $sort desc or asc\r
- * @return array array with both values and contextid's\r
- * @access private\r
- */\r
- final protected function get_option_top($context, $name, $amount = 10, $sort = 'desc')\r
- {\r
- if ( ($sort != 'desc') && ($sort != 'asc') )\r
- {\r
- $sort= 'desc';\r
- }\r
- \r
- $oid = $this->get_option_id($context, $name);\r
- \r
- // retrieve the data and return\r
- $query = "SELECT otype, oextra FROM %s WHERE oid = %d;";\r
- $query = sprintf($query, sql_table('plugin_option_desc'), $oid);\r
- $row = DB::getRow($query);\r
- \r
- if ( ($this->optionCanBeNumeric($row['otype'])) && ($row['oextra'] == 'number' ) )\r
- {\r
- $orderby = 'CAST(ovalue AS SIGNED)';\r
- }\r
- else\r
- {\r
- $orderby = 'ovalue';\r
- }\r
- $query = "SELECT ovalue value, ocontextid id FROM %s WHERE oid = %d ORDER BY %s %s LIMIT 0,%d;";\r
- $query = sprintf($query, sql_table('plugin_option'), $oid, $orderby, $sort, (integer) $amount);\r
- $result = DB::getResult($query);\r
- \r
- // create the array\r
- $i = 0;\r
- $top = array();\r
- foreach( $result as $row )\r
- {\r
- $top[$i++] = $row;\r
- }\r
- \r
- // return the array (duh!)\r
- return $top;\r
- }\r
- \r
- /**\r
- * Creates an option in the database table plugin_option_desc\r
- * \r
- * private\r
- */\r
- final protected function create_option($context, $name, $desc, $type, $defValue, $typeExtras = '')\r
- {\r
- // create in plugin_option_desc\r
- $query = 'INSERT INTO ' . sql_table('plugin_option_desc')\r
- .' (opid, oname, ocontext, odesc, otype, odef, oextra)'\r
- .' VALUES ('.intval($this->plugid)\r
- .', '.DB::quoteValue($name)\r
- .', '.DB::quoteValue($context)\r
- .', '.DB::quoteValue($desc)\r
- .', '.DB::quoteValue($type)\r
- .', '.DB::quoteValue($defValue)\r
- .', '.DB::quoteValue($typeExtras).')';\r
- DB::execute($query);\r
- $oid = DB::getInsertId();\r
- \r
- $key = $context . '_' . $name;\r
- $this->option_info[$key] = array('oid' => $oid, 'default' => $defValue);\r
- return 1;\r
- }\r
- \r
- /**\r
- * Deletes an option from the database tables\r
- * plugin_option and plugin_option_desc\r
- *\r
- * private\r
- */\r
- final protected function delete_option($context, $name)\r
- {\r
- $oid = $this->get_option_id($context, $name);\r
- if ( !$oid )\r
- {\r
- return 0; // no such option\r
- }\r
- \r
- // delete all things from plugin_option\r
- $query = "DELETE FROM %s WHERE oid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option'), (integer) $oid);\r
- DB::execute($query);\r
- \r
- // delete entry from plugin_option_desc\r
- $query = "DELETE FROM %s WHERE oid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option_desc'), $oid);\r
- DB::execute($query);\r
- \r
- // clear from cache\r
- unset($this->option_info["{$context}_{$name}"]);\r
- $this->option_values = array();\r
- return 1;\r
- }\r
- \r
- /**\r
- * Update an option in the database table plugin_option\r
- * \r
- * returns: 1 on success, 0 on failure\r
- * private\r
- */\r
- final protected function set_option($context, $contextid, $name, $value)\r
- {\r
- global $manager;\r
- \r
- $oid = $this->get_option_id($context, $name);\r
- if ( !$oid )\r
- {\r
- return 0;\r
- }\r
- \r
- // check if context id exists\r
- switch ( $context )\r
- {\r
- case 'member':\r
- if ( !Member::existsID($contextid) )\r
- {\r
- return 0;\r
- }\r
- break;\r
- case 'blog':\r
- if ( !$manager->existsBlogID($contextid) )\r
- {\r
- return 0;\r
- }\r
- break;\r
- case 'category':\r
- if ( !$manager->existsCategory($contextid) )\r
- {\r
- return 0;\r
- }\r
- break;\r
- case 'item':\r
- if ( !$manager->existsItem($contextid, true, true) )\r
- {\r
- return 0;\r
- }\r
- break;\r
- case 'global':\r
- if ( $contextid != 0 )\r
- {\r
- return 0;\r
- }\r
- break;\r
- }\r
- \r
- // update plugin_option\r
- $query = "DELETE FROM %s WHERE oid=%d and ocontextid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);\r
- DB::execute($query);\r
- \r
- $query = "INSERT INTO %s (ovalue, oid, ocontextid) VALUES (%s, %d, %d);";\r
- $query = sprintf($query, sql_table('plugin_option'), DB::quoteValue($value), $oid, $contextid);\r
- DB::execute($query);\r
- \r
- // update cache\r
- $this->option_values["{$oid}_{$contextid}"] = $value;\r
- if ( $context == 'global' )\r
- {\r
- $this->plugin_options[strtolower($name)] = $value;\r
- }\r
- \r
- return 1;\r
- }\r
- \r
- /**\r
- * Get an option from Cache or database\r
- * - if not in the option Cache read it from the database\r
- * - if not in the database write default values into the database\r
- * \r
- * private \r
- */ \r
- final protected function get_option($context, $contextid, $name)\r
- {\r
- $oid = $this->get_option_id($context, $name);\r
- if ( !$oid )\r
- {\r
- return '';\r
- }\r
- \r
- $key = "{$oid}_{$contextid}";\r
- \r
- if ( isset($this->option_values[$key]) )\r
- {\r
- return $this->option_values[$key];\r
- }\r
- \r
- // get from DB\r
- $query = "SELECT ovalue FROM %s WHERE oid=%d and ocontextid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);\r
- $result = DB::getResult($query);\r
- \r
- if ( !$result || ($result->rowCount() == 0) )\r
- {\r
- // fill DB with default value\r
- $this->option_values[$key] = $this->get_default_value($context, $name);\r
- $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";\r
- $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($this->option_values[$key]));\r
- DB::execute($query);\r
- }\r
- else\r
- {\r
- $row = $result->fetch();\r
- $this->option_values[$key] = $row['ovalue'];\r
- }\r
- \r
- return $this->option_values[$key];\r
- }\r
- \r
- /**\r
- * Returns assoc array with all values for a given option\r
- * (one option per possible context id)\r
- *\r
- * private \r
- */\r
- final protected function get_all_options($context, $name)\r
- {\r
- $oid = $this->get_option_id($context, $name);\r
- if ( !$oid )\r
- {\r
- return array();\r
- }\r
- $default_value = $this->get_default_value($context, $name);\r
- \r
- $options = array();\r
- $query = "SELECT %s as contextid FROM %s;";\r
- switch ( $context )\r
- {\r
- case 'blog':\r
- $query = sprintf($query, 'bnumber', sql_table('blog'));\r
- break;\r
- case 'category':\r
- $query = sprintf($query, 'catid', sql_table('category'));\r
- break;\r
- case 'member':\r
- $query = sprintf($query, 'mnumber', sql_table('member'));\r
- break;\r
- case 'item':\r
- $query = sprintf($query, 'inumber', sql_table('item'));\r
- break;\r
- }\r
- \r
- $result = DB::getResult($query);\r
- if ( $result )\r
- {\r
- foreach ( $result as $row )\r
- {\r
- $options[$row['contextid']] = $default_value;\r
- }\r
- }\r
- \r
- $query = "SELECT ocontextid, ovalue FROM %s WHERE oid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option'), $oid);\r
- $result = DB::getResult($query);\r
- foreach ( $result as $row )\r
- {\r
- $options[$row['ocontextid']] = $row['ovalue'];\r
- }\r
-\r
- return $options;\r
- }\r
- \r
- /**\r
- * NucleusPlugin::get_option_id\r
- * \r
- * Gets the 'option identifier' that corresponds to a given option name.\r
- * When this method is called for the first time, all the OIDs for the plugin\r
- * are loaded into memory, to avoid re-doing the same query all over.\r
- * \r
- * @param string $context option context\r
- * @param string $name plugin name\r
- * @return integer option id\r
- */\r
- final protected function get_option_id($context, $name)\r
- {\r
- $key = "{$context}_{$name}";\r
- \r
- if ( array_key_exists($key, $this->option_info)\r
- && array_key_exists('oid', $this->option_info[$key]) )\r
- {\r
- return $this->option_info[$key]['oid'];\r
- }\r
- \r
- // load all OIDs for this plugin from the database\r
- $this->option_info = array();\r
- $query = "SELECT oid, oname, ocontext, odef FROM %s WHERE opid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option_desc'), $this->plugid);\r
- $result = DB::getResult($query);\r
- foreach ( $result as $row )\r
- {\r
- $k = $row['ocontext'] . '_' . $row['oname'];\r
- $this->option_info[$k] = array('oid' => $row['oid'], 'default' => $row['odef']);\r
- }\r
- $result->closeCursor();\r
- \r
- return $this->option_info[$key]['oid'];\r
- }\r
- final protected function get_default_value($context, $name)\r
- {\r
- $key = $context . '_' . $name;\r
- \r
- if ( array_key_exists($key, $this->option_info)\r
- && array_key_exists('default', $this->option_info[$key]) )\r
- {\r
- return $this->option_info[$key]['default'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * NucleusPlugin::delete_option_values()\r
- * Deletes all option values for a given context and contextid\r
- * (used when e.g. a blog, member or category is deleted)\r
- *\r
- *@static\r
- *@param String $context global/blog/category/item/member\r
- *@param Integer $contextid ID\r
- *@return Void\r
- */\r
- static public function delete_option_values($context, $contextid)\r
- {\r
- // delete all associated plugin options\r
- $aOIDs = array();\r
- // find ids\r
- $query = "SELECT oid FROM %s WHERE ocontext=%s;";\r
- $query = sprintf($query, sql_table('plugin_option_desc'), DB::quoteValue($context));\r
- \r
- $result = DB::getResult($query);\r
- foreach ( $result as $row )\r
- {\r
- array_push($aOIDs, $row['oid']);\r
- }\r
- $result->closeCursor();\r
- // delete those options. go go go\r
- if ( count($aOIDs) > 0 )\r
- {\r
- $query = "DELETE FROM %s WHERE oid in (%s) and ocontextid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option'), implode(',',$aOIDs), (integer) $contextid);\r
- DB::execute($query);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * NucleusPlugin::getOptionMeta()\r
- * splits the option's typeextra field (at ;'s) to split the meta collection\r
- * \r
- * @static\r
- * @param string $typeExtra the value of the typeExtra field of an option\r
- * @return array array of the meta-key/value-pairs\r
- */\r
- static public function getOptionMeta($typeExtra)\r
- {\r
- $meta = array();\r
- \r
- /* 1. if $typeExtra includes delimiter ';', split it to tokens */\r
- $tokens = preg_split('#;#', $typeExtra);\r
- \r
- /*\r
- * 2. if each of tokens includes "=", it consists of key => value\r
- * else it's 'select' option\r
- */\r
- foreach ( $tokens as $token )\r
- {\r
- $matches = array();\r
- if ( preg_match("#^([^=]+)?=([^=]+)?$#", $token, $matches) )\r
- {\r
- $meta[$matches[1]] = $matches[2];\r
- }\r
- else\r
- {\r
- $meta['select'] = $token;\r
- }\r
- }\r
- return $meta;\r
- }\r
- \r
- /**\r
- * NucleusPlugin::getOptionSelectValues()\r
- * filters the selectlists out of the meta collection\r
- * \r
- * @static\r
- * @param string $typeExtra the value of the typeExtra field of an option\r
- * @return string the selectlist\r
- */\r
- static public function getOptionSelectValues($typeExtra)\r
- {\r
- $meta = NucleusPlugin::getOptionMeta($typeExtra);\r
- \r
- if ( array_key_exists('select', $meta) )\r
- {\r
- return $meta['select'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * checks if the eventlist in the database is up-to-date\r
- * @return bool if it is up-to-date it return true, else false\r
- * @author TeRanEX\r
- */\r
- public function subscribtionListIsUptodate()\r
- {\r
- $res = DB::getResult('SELECT event FROM '.sql_table('plugin_event').' WHERE pid = '.$this->plugid);\r
- $ev = array();\r
- foreach ( $res as $row )\r
- {\r
- array_push($ev, $row['event']);\r
- }\r
- if ( count($ev) != count($this->getEventList()) )\r
- {\r
- return false;\r
- }\r
- $d = array_diff($ev, $this->getEventList());\r
- if ( count($d) > 0 )\r
- {\r
- // there are differences so the db is not up-to-date\r
- return false;\r
- }\r
- return true;\r
- }\r
- \r
- /**\r
- * NucleusPlugin::apply_plugin_options()\r
- * Update its entry in database table\r
- * \r
- * @static\r
- * @param $options: array ( 'oid' => array( 'contextid' => 'value'))\r
- * (taken from request using requestVar())\r
- * @param $new_contextid: integer (accepts a contextid when it is for a new\r
- * contextid there was no id available at the moment of writing the\r
- * formcontrols into the page (by ex: itemOptions for new item)\r
- * @return void\r
- */\r
- static public function apply_plugin_options(&$options, $new_contextid = 0)\r
- {\r
- global $manager;\r
- \r
- if ( !is_array($options) )\r
- {\r
- return;\r
- }\r
- \r
- foreach ( $options as $oid => $values )\r
- {\r
- // get option type info\r
- $query = "SELECT opid, oname, ocontext, otype, oextra, odef FROM %s WHERE oid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $oid);\r
- $result = DB::getRow($query);\r
- if ( $result )\r
- {\r
- foreach ( $values as $id => $value )\r
- {\r
- // decide wether we are using the contextid of newContextid\r
- if ( $new_contextid != 0 )\r
- {\r
- $contextid = $new_contextid;\r
- }\r
- else\r
- {\r
- $contextid = $id;\r
- }\r
- \r
- // retreive any metadata\r
- $meta = NucleusPlugin::getOptionMeta($result['oextra']);\r
- \r
- // if the option is readonly or hidden it may not be saved\r
- if ( array_key_exists('access', $meta)\r
- && in_array($meta['access'], array('readonly', 'hidden')) )\r
- {\r
- return;\r
- }\r
- \r
- // value comes from request\r
- $value = undoMagic($value);\r
- \r
- /* validation the value according to its type */\r
- switch ( $result['otype'] )\r
- {\r
- case 'yesno':\r
- if ( ($value != 'yes') && ($value != 'no') )\r
- {\r
- $value = 'no';\r
- }\r
- break;\r
- case 'text':\r
- case 'select':\r
- if ( array_key_exists('datatype', $meta)\r
- && ($meta['datatype'] == 'numerical') && ($value != (integer) $value) )\r
- {\r
- $value = (integer) $result['odef'];\r
- }\r
- break;\r
- case 'password':\r
- case 'textarea':\r
- default:\r
- break;\r
- }\r
- \r
- /*\r
- * trigger event PrePluginOptionsUpdate to give the plugin the\r
- * possibility to change/validate the new value for the option\r
- */\r
- $data = array(\r
- 'context' => $result['ocontext'],\r
- 'plugid' => $result['opid'],\r
- 'optionname' => $result['oname'],\r
- 'contextid' => $contextid,\r
- 'value' => &$value);\r
- $manager->notify('PrePluginOptionsUpdate', $data);\r
- \r
- // delete and insert its fields of table in database\r
- $query = "DELETE FROM %s WHERE oid=%d AND ocontextid=%d;";\r
- $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);\r
- DB::execute($query);\r
- $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";\r
- $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($value));\r
- DB::execute($query);\r
- \r
- // clear option value cache if the plugin object is already loaded\r
- $plugin=& $manager->pidLoaded($result['opid']);\r
- if ( $plugin )\r
- {\r
- $plugin->clearOptionValueCache();\r
- }\r
- \r
- continue;\r
- }\r
- }\r
- continue;\r
- }\r
- return;\r
- }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * This is an (abstract) class of which all Nucleus Plugins must inherit
+ *
+ * for more information on plugins and how to write your own, see the
+ * plugins.html file that is included with the Nucleus documenation
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: PLUGIN.php 1866 2012-05-20 13:21:55Z sakamocchi $
+ */
+abstract class NucleusPlugin
+{
+ // these public functions should to be redefined in your plugin
+ public function getName()
+ {
+ return __CLASS__;
+ }
+
+ public function getAuthor()
+ {
+ return 'Undefined';
+ }
+
+ public function getURL()
+ {
+ return 'Undefined';
+ }
+
+ public function getVersion()
+ {
+ return '0.0';
+ }
+
+ public function getDescription()
+ {
+ return 'Undefined';
+ }
+
+ // these final public function _may_ be redefined in your plugin
+
+ public function getMinNucleusVersion()
+ {
+ return 150;
+ }
+
+ public function getMinNucleusPatchLevel()
+ {
+ return 0;
+ }
+
+ public function getEventList()
+ {
+ return array();
+ }
+
+ public function getTableList()
+ {
+ return array();
+ }
+
+ public function hasAdminArea()
+ {
+ return 0;
+ }
+
+ public function install()
+ {
+ return;
+ }
+
+ public function unInstall()
+ {
+ return;
+ }
+
+ public function init()
+ {
+ return;
+ }
+
+ public function doSkinVar($skinType)
+ {
+ return;
+ }
+
+ public function doTemplateVar(&$item)
+ {
+ $args = func_get_args();
+ array_shift($args);
+ array_unshift($args, 'template');
+ call_user_func_array(array(&$this,'doSkinVar'),$args);
+ return;
+ }
+
+ public function doTemplateCommentsVar(&$item, &$comment)
+ {
+ $args = func_get_args();
+ array_shift($args);
+ array_shift($args);
+ array_unshift($args, 'template');
+ call_user_func_array(array(&$this,'doSkinVar'),$args);
+ return;
+ }
+
+ public function doAction($type)
+ {
+ return _ERROR_PLUGIN_NOSUCHACTION;
+ }
+
+ public function doIf($key,$value)
+ {
+ return false;
+ }
+
+ public function doItemVar (&$item)
+ {
+ return;
+ }
+
+ /**
+ * Checks if a plugin supports a certain feature.
+ *
+ * @returns 1 if the feature is reported, 0 if not
+ * @param $feature
+ * Name of the feature. See plugin documentation for more info
+ * 'SqlTablePrefix' -> if the plugin uses the sql_table() method to get table names
+ * 'HelpPage' -> if the plugin provides a helppage
+ * 'SqlApi' -> if the plugin uses the complete sql_* or DB::* api (must also require nucleuscms 3.5)
+ */
+ public function supportsFeature($feature)
+ {
+ return 0;
+ }
+
+ /**
+ * Report a list of plugin that is required to final public function
+ *
+ * @returns an array of names of plugin, an empty array indicates no dependency
+ */
+ public function getPluginDep()
+ {
+ return array();
+ }
+
+ // these helper final public functions should not be redefined in your plugin
+
+ /**
+ * Creates a new option for this plugin
+ *
+ * @param name
+ * A string uniquely identifying your option. (max. length is 20 characters)
+ * @param description
+ * A description that will show up in the nucleus admin area (max. length: 255 characters)
+ * @param type
+ * Either 'text', 'yesno' or 'password'
+ * This info is used when showing 'edit plugin options' screens
+ * @param value
+ * Initial value for the option (max. value length is 128 characters)
+ */
+ final public function createOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+ {
+ return $this->create_option('global', $name, $desc, $type, $defValue, $typeExtras);
+ }
+
+ final public function createBlogOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+ {
+ return $this->create_option('blog', $name, $desc, $type, $defValue, $typeExtras);
+ }
+
+ final public function createMemberOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+ {
+ return $this->create_option('member', $name, $desc, $type, $defValue, $typeExtras);
+ }
+
+ final public function createCategoryOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+ {
+ return $this->create_option('category', $name, $desc, $type, $defValue, $typeExtras);
+ }
+
+ final public function createItemOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+ {
+ return $this->create_option('item', $name, $desc, $type, $defValue, $typeExtras);
+ }
+
+ /**
+ * Removes the option from the database
+ *
+ * Note: Options get erased automatically on plugin uninstall
+ */
+ final public function deleteOption($name)
+ {
+ return $this->delete_option('global', $name);
+ }
+
+ final public function deleteBlogOption($name)
+ {
+ return $this->delete_option('blog', $name);
+ }
+
+ final public function deleteMemberOption($name)
+ {
+ return $this->delete_option('member', $name);
+ }
+
+ final public function deleteCategoryOption($name)
+ {
+ return $this->delete_option('category', $name);
+ }
+
+ final public function deleteItemOption($name)
+ {
+ return $this->delete_option('item', $name);
+ }
+
+ /**
+ * Sets the value of an option to something new
+ */
+ final public function setOption($name, $value)
+ {
+ return $this->set_option('global', 0, $name, $value);
+ }
+
+ final public function setBlogOption($blogid, $name, $value)
+ {
+ return $this->set_option('blog', $blogid, $name, $value);
+ }
+
+ final public function setMemberOption($memberid, $name, $value)
+ {
+ return $this->set_option('member', $memberid, $name, $value);
+ }
+
+ final public function setCategoryOption($catid, $name, $value)
+ {
+ return $this->set_option('category', $catid, $name, $value);
+ }
+
+ final public function setItemOption($itemid, $name, $value) {
+ return $this->set_option('item', $itemid, $name, $value);
+ }
+
+ /**
+ * Retrieves the current value for an option
+ */
+ final public function getOption($name)
+ {
+ // only request the options the very first time. On subsequent requests
+ // the static collection is used to save SQL queries.
+ if ( $this->plugin_options == 0 )
+ {
+ $this->plugin_options = array();
+
+ $query = "SELECT d.oname as name, o.ovalue as value FROM %s o, %s d WHERE d.opid=%d AND d.oid=o.oid;";
+ $query = sprintf($query, sql_table('plugin_option'), sql_table('plugin_option_desc'), (integer) $this->plugid);
+ $result = DB::getResult($query);
+ foreach ( $result as $row )
+ {
+ $this->plugin_options[strtolower($row['name'])] = $row['value'];
+ }
+ }
+ if ( isset($this->plugin_options[strtolower($name)]) )
+ {
+ return $this->plugin_options[strtolower($name)];
+ }
+ else
+ {
+ return $this->get_option('global', 0, $name);
+ }
+ }
+
+ final public function getBlogOption($blogid, $name)
+ {
+ return $this->get_option('blog', $blogid, $name);
+ }
+
+ final public function getMemberOption($memberid, $name)
+ {
+ return $this->get_option('member', $memberid, $name);
+ }
+
+ final public function getCategoryOption($catid, $name)
+ {
+ return $this->get_option('category', $catid, $name);
+ }
+
+ final public function getItemOption($itemid, $name)
+ {
+ return $this->get_option('item', $itemid, $name);
+ }
+
+ /**
+ * Retrieves an associative array with the option value for each
+ * context id
+ */
+ final public function getAllBlogOptions($name)
+ {
+ return $this->get_all_options('blog', $name);
+ }
+
+ final public function getAllMemberOptions($name)
+ {
+ return $this->get_all_options('member', $name);
+ }
+
+ final public function getAllCategoryOptions($name)
+ {
+ return $this->get_all_options('category', $name);
+ }
+
+ final public function getAllItemOptions($name)
+ {
+ return $this->get_all_options('item', $name);
+ }
+
+ /**
+ * Retrieves an indexed array with the top (or bottom) of an option
+ * (delegates to getOptionTop())
+ */
+ final public function getBlogOptionTop($name, $amount = 10, $sort = 'desc')
+ {
+ return $this->get_option_top('blog', $name, $amount, $sort);
+ }
+
+ final public function getMemberOptionTop($name, $amount = 10, $sort = 'desc')
+ {
+ return $this->get_option_top('member', $name, $amount, $sort);
+ }
+
+ final public function getCategoryOptionTop($name, $amount = 10, $sort = 'desc')
+ {
+ return $this->get_option_top('category', $name, $amount, $sort);
+ }
+
+ final public function getItemOptionTop($name, $amount = 10, $sort = 'desc')
+ {
+ return $this->get_option_top('item', $name, $amount, $sort);
+ }
+
+ /**
+ * NucleusPlugin::getID()
+ * get id for this plugin
+ *
+ * @access public
+ * @param void
+ * @return integer this plugid id
+ */
+ final public function getID()
+ {
+ return (integer) $this->plugid;
+ }
+
+ /**
+ * NucleusPlugin::setID()
+ * set favorite id for this plugin
+ *
+ * @access public
+ * @param integer $plugid favorite id for plugin
+ * @return void
+ */
+ final public function setID($plugid)
+ {
+ $this->plugid = (integer) $plugid;
+ return;
+ }
+
+ /**
+ * Returns the URL of the admin area for this plugin (in case there's
+ * no such area, the returned information is invalid)
+ *
+ * public
+ */
+ final public function getAdminURL()
+ {
+ global $CONF;
+ return $CONF['PluginURL'] . $this->getShortName() . '/';
+ }
+
+ /**
+ * Returns the directory where the admin directory is located and
+ * where the plugin can maintain his extra files
+ *
+ * public
+ */
+ final public function getDirectory()
+ {
+ global $DIR_PLUGINS;
+ return $DIR_PLUGINS . $this->getShortName() . '/';
+ }
+
+ /**
+ * Derives the short name for the plugin from the classname (all
+ * lowercase)
+ *
+ * public
+ */
+ final public function getShortName()
+ {
+ return str_replace('np_','',strtolower(get_class($this)));
+ }
+
+ /**
+ * Clears the option value cache which saves the option values during
+ * the plugin execution. This function is usefull if the options has
+ * changed during the plugin execution (especially in association with
+ * the PrePluginOptionsUpdate and the PostPluginOptionsUpdate events)
+ *
+ * public
+ **/
+ final public function clearOptionValueCache()
+ {
+ $this->option_values = array();
+ $this->plugin_options = 0;
+ return;
+ }
+
+ // internal functions of the class starts here
+ protected $option_values; // oid_contextid => value
+ protected $option_info; // context_name => array('oid' => ..., 'default' => ...)
+ protected $plugin_options; // see getOption()
+ protected $plugid; // plugin id
+
+ /**
+ * Class constructor: Initializes some internal data
+ */
+ public function __construct()
+ {
+ $this->option_values = array(); // oid_contextid => value
+ $this->option_info = array(); // context_name => array('oid' => ..., 'default' => ...)
+ $this->plugin_options = 0;
+ }
+
+ /**
+ * Retrieves an array of the top (or bottom) of an option from a plugin.
+ * @author TeRanEX
+ * @param string $context the context for the option: item, blog, member,...
+ * @param string $name the name of the option
+ * @param int $amount how many rows must be returned
+ * @param string $sort desc or asc
+ * @return array array with both values and contextid's
+ * @access private
+ */
+ final protected function get_option_top($context, $name, $amount = 10, $sort = 'desc')
+ {
+ if ( ($sort != 'desc') && ($sort != 'asc') )
+ {
+ $sort= 'desc';
+ }
+
+ $oid = $this->get_option_id($context, $name);
+
+ // retrieve the data and return
+ $query = "SELECT otype, oextra FROM %s WHERE oid = %d;";
+ $query = sprintf($query, sql_table('plugin_option_desc'), $oid);
+ $row = DB::getRow($query);
+
+ if ( ($this->optionCanBeNumeric($row['otype'])) && ($row['oextra'] == 'number' ) )
+ {
+ $orderby = 'CAST(ovalue AS SIGNED)';
+ }
+ else
+ {
+ $orderby = 'ovalue';
+ }
+ $query = "SELECT ovalue value, ocontextid id FROM %s WHERE oid = %d ORDER BY %s %s LIMIT 0,%d;";
+ $query = sprintf($query, sql_table('plugin_option'), $oid, $orderby, $sort, (integer) $amount);
+ $result = DB::getResult($query);
+
+ // create the array
+ $i = 0;
+ $top = array();
+ foreach( $result as $row )
+ {
+ $top[$i++] = $row;
+ }
+
+ // return the array (duh!)
+ return $top;
+ }
+
+ /**
+ * Creates an option in the database table plugin_option_desc
+ *
+ * private
+ */
+ final protected function create_option($context, $name, $desc, $type, $defValue, $typeExtras = '')
+ {
+ // create in plugin_option_desc
+ $query = 'INSERT INTO ' . sql_table('plugin_option_desc')
+ .' (opid, oname, ocontext, odesc, otype, odef, oextra)'
+ .' VALUES ('.intval($this->plugid)
+ .', '.DB::quoteValue($name)
+ .', '.DB::quoteValue($context)
+ .', '.DB::quoteValue($desc)
+ .', '.DB::quoteValue($type)
+ .', '.DB::quoteValue($defValue)
+ .', '.DB::quoteValue($typeExtras).')';
+ DB::execute($query);
+ $oid = DB::getInsertId();
+
+ $key = $context . '_' . $name;
+ $this->option_info[$key] = array('oid' => $oid, 'default' => $defValue);
+ return 1;
+ }
+
+ /**
+ * Deletes an option from the database tables
+ * plugin_option and plugin_option_desc
+ *
+ * private
+ */
+ final protected function delete_option($context, $name)
+ {
+ $oid = $this->get_option_id($context, $name);
+ if ( !$oid )
+ {
+ return 0; // no such option
+ }
+
+ // delete all things from plugin_option
+ $query = "DELETE FROM %s WHERE oid=%d;";
+ $query = sprintf($query, sql_table('plugin_option'), (integer) $oid);
+ DB::execute($query);
+
+ // delete entry from plugin_option_desc
+ $query = "DELETE FROM %s WHERE oid=%d;";
+ $query = sprintf($query, sql_table('plugin_option_desc'), $oid);
+ DB::execute($query);
+
+ // clear from cache
+ unset($this->option_info["{$context}_{$name}"]);
+ $this->option_values = array();
+ return 1;
+ }
+
+ /**
+ * Update an option in the database table plugin_option
+ *
+ * returns: 1 on success, 0 on failure
+ * private
+ */
+ final protected function set_option($context, $contextid, $name, $value)
+ {
+ global $manager;
+
+ $oid = $this->get_option_id($context, $name);
+ if ( !$oid )
+ {
+ return 0;
+ }
+
+ // check if context id exists
+ switch ( $context )
+ {
+ case 'member':
+ if ( !Member::existsID($contextid) )
+ {
+ return 0;
+ }
+ break;
+ case 'blog':
+ if ( !$manager->existsBlogID($contextid) )
+ {
+ return 0;
+ }
+ break;
+ case 'category':
+ if ( !$manager->existsCategory($contextid) )
+ {
+ return 0;
+ }
+ break;
+ case 'item':
+ if ( !$manager->existsItem($contextid, true, true) )
+ {
+ return 0;
+ }
+ break;
+ case 'global':
+ if ( $contextid != 0 )
+ {
+ return 0;
+ }
+ break;
+ }
+
+ // update plugin_option
+ $query = "DELETE FROM %s WHERE oid=%d and ocontextid=%d;";
+ $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);
+ DB::execute($query);
+
+ $query = "INSERT INTO %s (ovalue, oid, ocontextid) VALUES (%s, %d, %d);";
+ $query = sprintf($query, sql_table('plugin_option'), DB::quoteValue($value), $oid, $contextid);
+ DB::execute($query);
+
+ // update cache
+ $this->option_values["{$oid}_{$contextid}"] = $value;
+ if ( $context == 'global' )
+ {
+ $this->plugin_options[strtolower($name)] = $value;
+ }
+
+ return 1;
+ }
+
+ /**
+ * Get an option from Cache or database
+ * - if not in the option Cache read it from the database
+ * - if not in the database write default values into the database
+ *
+ * private
+ */
+ final protected function get_option($context, $contextid, $name)
+ {
+ $oid = $this->get_option_id($context, $name);
+ if ( !$oid )
+ {
+ return '';
+ }
+
+ $key = "{$oid}_{$contextid}";
+
+ if ( isset($this->option_values[$key]) )
+ {
+ return $this->option_values[$key];
+ }
+
+ // get from DB
+ $query = "SELECT ovalue FROM %s WHERE oid=%d and ocontextid=%d;";
+ $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);
+ $result = DB::getResult($query);
+
+ if ( !$result || ($result->rowCount() == 0) )
+ {
+ // fill DB with default value
+ $this->option_values[$key] = $this->get_default_value($context, $name);
+ $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";
+ $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($this->option_values[$key]));
+ DB::execute($query);
+ }
+ else
+ {
+ $row = $result->fetch();
+ $this->option_values[$key] = $row['ovalue'];
+ }
+
+ return $this->option_values[$key];
+ }
+
+ /**
+ * Returns assoc array with all values for a given option
+ * (one option per possible context id)
+ *
+ * private
+ */
+ final protected function get_all_options($context, $name)
+ {
+ $oid = $this->get_option_id($context, $name);
+ if ( !$oid )
+ {
+ return array();
+ }
+ $default_value = $this->get_default_value($context, $name);
+
+ $options = array();
+ $query = "SELECT %s as contextid FROM %s;";
+ switch ( $context )
+ {
+ case 'blog':
+ $query = sprintf($query, 'bnumber', sql_table('blog'));
+ break;
+ case 'category':
+ $query = sprintf($query, 'catid', sql_table('category'));
+ break;
+ case 'member':
+ $query = sprintf($query, 'mnumber', sql_table('member'));
+ break;
+ case 'item':
+ $query = sprintf($query, 'inumber', sql_table('item'));
+ break;
+ }
+
+ $result = DB::getResult($query);
+ if ( $result )
+ {
+ foreach ( $result as $row )
+ {
+ $options[$row['contextid']] = $default_value;
+ }
+ }
+
+ $query = "SELECT ocontextid, ovalue FROM %s WHERE oid=%d;";
+ $query = sprintf($query, sql_table('plugin_option'), $oid);
+ $result = DB::getResult($query);
+ foreach ( $result as $row )
+ {
+ $options[$row['ocontextid']] = $row['ovalue'];
+ }
+
+ return $options;
+ }
+
+ /**
+ * NucleusPlugin::get_option_id
+ *
+ * Gets the 'option identifier' that corresponds to a given option name.
+ * When this method is called for the first time, all the OIDs for the plugin
+ * are loaded into memory, to avoid re-doing the same query all over.
+ *
+ * @param string $context option context
+ * @param string $name plugin name
+ * @return integer option id
+ */
+ final protected function get_option_id($context, $name)
+ {
+ $key = "{$context}_{$name}";
+
+ if ( array_key_exists($key, $this->option_info)
+ && array_key_exists('oid', $this->option_info[$key]) )
+ {
+ return $this->option_info[$key]['oid'];
+ }
+
+ // load all OIDs for this plugin from the database
+ $this->option_info = array();
+ $query = "SELECT oid, oname, ocontext, odef FROM %s WHERE opid=%d;";
+ $query = sprintf($query, sql_table('plugin_option_desc'), $this->plugid);
+ $result = DB::getResult($query);
+ foreach ( $result as $row )
+ {
+ $k = $row['ocontext'] . '_' . $row['oname'];
+ $this->option_info[$k] = array('oid' => $row['oid'], 'default' => $row['odef']);
+ }
+ $result->closeCursor();
+
+ return $this->option_info[$key]['oid'];
+ }
+ final protected function get_default_value($context, $name)
+ {
+ $key = $context . '_' . $name;
+
+ if ( array_key_exists($key, $this->option_info)
+ && array_key_exists('default', $this->option_info[$key]) )
+ {
+ return $this->option_info[$key]['default'];
+ }
+ return;
+ }
+
+ /**
+ * NucleusPlugin::delete_option_values()
+ * Deletes all option values for a given context and contextid
+ * (used when e.g. a blog, member or category is deleted)
+ *
+ *@static
+ *@param String $context global/blog/category/item/member
+ *@param Integer $contextid ID
+ *@return Void
+ */
+ static public function delete_option_values($context, $contextid)
+ {
+ // delete all associated plugin options
+ $aOIDs = array();
+ // find ids
+ $query = "SELECT oid FROM %s WHERE ocontext=%s;";
+ $query = sprintf($query, sql_table('plugin_option_desc'), DB::quoteValue($context));
+
+ $result = DB::getResult($query);
+ foreach ( $result as $row )
+ {
+ array_push($aOIDs, $row['oid']);
+ }
+ $result->closeCursor();
+ // delete those options. go go go
+ if ( count($aOIDs) > 0 )
+ {
+ $query = "DELETE FROM %s WHERE oid in (%s) and ocontextid=%d;";
+ $query = sprintf($query, sql_table('plugin_option'), implode(',',$aOIDs), (integer) $contextid);
+ DB::execute($query);
+ }
+ return;
+ }
+
+ /**
+ * NucleusPlugin::getOptionMeta()
+ * splits the option's typeextra field (at ;'s) to split the meta collection
+ *
+ * @static
+ * @param string $typeExtra the value of the typeExtra field of an option
+ * @return array array of the meta-key/value-pairs
+ */
+ static public function getOptionMeta($typeExtra)
+ {
+ $meta = array();
+
+ /* 1. if $typeExtra includes delimiter ';', split it to tokens */
+ $tokens = preg_split('#;#', $typeExtra);
+
+ /*
+ * 2. if each of tokens includes "=", it consists of key => value
+ * else it's 'select' option
+ */
+ foreach ( $tokens as $token )
+ {
+ $matches = array();
+ if ( preg_match("#^([^=]+)?=([^=]+)?$#", $token, $matches) )
+ {
+ $meta[$matches[1]] = $matches[2];
+ }
+ else
+ {
+ $meta['select'] = $token;
+ }
+ }
+ return $meta;
+ }
+
+ /**
+ * NucleusPlugin::getOptionSelectValues()
+ * filters the selectlists out of the meta collection
+ *
+ * @static
+ * @param string $typeExtra the value of the typeExtra field of an option
+ * @return string the selectlist
+ */
+ static public function getOptionSelectValues($typeExtra)
+ {
+ $meta = NucleusPlugin::getOptionMeta($typeExtra);
+
+ if ( array_key_exists('select', $meta) )
+ {
+ return $meta['select'];
+ }
+ return;
+ }
+
+ /**
+ * checks if the eventlist in the database is up-to-date
+ * @return bool if it is up-to-date it return true, else false
+ * @author TeRanEX
+ */
+ public function subscribtionListIsUptodate()
+ {
+ $res = DB::getResult('SELECT event FROM '.sql_table('plugin_event').' WHERE pid = '.$this->plugid);
+ $ev = array();
+ foreach ( $res as $row )
+ {
+ array_push($ev, $row['event']);
+ }
+ if ( count($ev) != count($this->getEventList()) )
+ {
+ return false;
+ }
+ $d = array_diff($ev, $this->getEventList());
+ if ( count($d) > 0 )
+ {
+ // there are differences so the db is not up-to-date
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * NucleusPlugin::apply_plugin_options()
+ * Update its entry in database table
+ *
+ * @static
+ * @param $options: array ( 'oid' => array( 'contextid' => 'value'))
+ * (taken from request using requestVar())
+ * @param $new_contextid: integer (accepts a contextid when it is for a new
+ * contextid there was no id available at the moment of writing the
+ * formcontrols into the page (by ex: itemOptions for new item)
+ * @return void
+ */
+ static public function apply_plugin_options(&$options, $new_contextid = 0)
+ {
+ global $manager;
+
+ if ( !is_array($options) )
+ {
+ return;
+ }
+
+ foreach ( $options as $oid => $values )
+ {
+ // get option type info
+ $query = "SELECT opid, oname, ocontext, otype, oextra, odef FROM %s WHERE oid=%d;";
+ $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $oid);
+ $result = DB::getRow($query);
+ if ( $result )
+ {
+ foreach ( $values as $id => $value )
+ {
+ // decide wether we are using the contextid of newContextid
+ if ( $new_contextid != 0 )
+ {
+ $contextid = $new_contextid;
+ }
+ else
+ {
+ $contextid = $id;
+ }
+
+ // retreive any metadata
+ $meta = NucleusPlugin::getOptionMeta($result['oextra']);
+
+ // if the option is readonly or hidden it may not be saved
+ if ( array_key_exists('access', $meta)
+ && in_array($meta['access'], array('readonly', 'hidden')) )
+ {
+ return;
+ }
+
+ // value comes from request
+ $value = undoMagic($value);
+
+ /* validation the value according to its type */
+ switch ( $result['otype'] )
+ {
+ case 'yesno':
+ if ( ($value != 'yes') && ($value != 'no') )
+ {
+ $value = 'no';
+ }
+ break;
+ case 'text':
+ case 'select':
+ if ( array_key_exists('datatype', $meta)
+ && ($meta['datatype'] == 'numerical') && ($value != (integer) $value) )
+ {
+ $value = (integer) $result['odef'];
+ }
+ break;
+ case 'password':
+ case 'textarea':
+ default:
+ break;
+ }
+
+ /*
+ * trigger event PrePluginOptionsUpdate to give the plugin the
+ * possibility to change/validate the new value for the option
+ */
+ $data = array(
+ 'context' => $result['ocontext'],
+ 'plugid' => $result['opid'],
+ 'optionname' => $result['oname'],
+ 'contextid' => $contextid,
+ 'value' => &$value);
+ $manager->notify('PrePluginOptionsUpdate', $data);
+
+ // delete and insert its fields of table in database
+ $query = "DELETE FROM %s WHERE oid=%d AND ocontextid=%d;";
+ $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);
+ DB::execute($query);
+ $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";
+ $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($value));
+ DB::execute($query);
+
+ // clear option value cache if the plugin object is already loaded
+ $plugin=& $manager->pidLoaded($result['opid']);
+ if ( $plugin )
+ {
+ $plugin->clearOptionValueCache();
+ }
+
+ continue;
+ }
+ }
+ continue;
+ }
+ return;
+ }
+}
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * code to make it easier to create plugin admin areas\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: PLUGINADMIN.php 1626 2012-01-09 15:46:54Z sakamocchi $\r
- */\r
-\r
-class PluginAdmin\r
-{\r
- public $strFullName; // NP_SomeThing\r
- public $plugin; // ref. to plugin object\r
- public $bValid; // evaluates to true when object is considered valid\r
- public $admin; // ref to an admin object\r
-\r
- private $skinContents; // PluginAdmin contents\r
- private $extrahead; // extrahead\r
-\r
- public function __construct($pluginName)\r
- {\r
- global $manager, $DIR_LIBS;\r
- \r
- if ( !class_exists('Admin', FALSE) )\r
- {\r
- include($DIR_LIBS . 'ADMIN.php');\r
- }\r
- \r
- $this->strFullName = "NP_{$pluginName}";\r
- \r
- // check if plugin exists and is installed\r
- if ( !$manager->pluginInstalled($this->strFullName) )\r
- {\r
- doError(_ERROR_INVALID_PLUGIN);\r
- return;\r
- }\r
- \r
- $this->plugin = &$manager->getPlugin($this->strFullName);\r
- $this->bValid = $this->plugin;\r
- \r
- if ( !$this->bValid )\r
- {\r
- doError(_ERROR_INVALID_PLUGIN);\r
- return;\r
- }\r
- \r
- Admin::initialize();\r
- Admin::$action = "plugin_{$pluginName}";\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * PluginAdmin::start()\r
- * \r
- * @param string $extraHead child elements for header element\r
- * @return void\r
- */\r
- public function start($extraHead = '')\r
- {\r
- global $CONF;\r
- $this->extrahead = $extraHead . '<base href="' . Entity::hsc($CONF['AdminURL']) . '" />' . "\n";\r
- ob_start();\r
- return;\r
- }\r
- \r
- /**\r
- * PluginAdmin::end()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function end()\r
- {\r
- $this->AddTicketByJS();\r
- $contents = ob_get_contents();\r
- ob_end_clean();\r
- $this->skinContents = '<%pagehead%>' . $contents . '<%pagefoot%>';\r
- Admin::action_PluginAdmin($this->skinContents, $this->extrahead);\r
- return;\r
- }\r
- \r
- /**\r
- * PluginAdmin::_AddTicketByJS()\r
- * Add ticket when not used in plugin's admin page\r
- * to avoid CSRF.\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function AddTicketByJS()\r
- {\r
- global $CONF,$ticketforplugin;\r
- if ( !($ticket = $ticketforplugin['ticket']) )\r
- {\r
- return;\r
- }\r
- $ticket=Entity::hsc($ticket);\r
-\r
-?><script type="text/javascript">\r
-/*<![CDATA[*/\r
-/* Add tickets for available links (outside blog excluded) */\r
-for (i=0;document.links[i];i++){\r
- if (document.links[i].href.indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0\r
- && !(document.links[i].href.indexOf('//',0)<0)) continue;\r
- if ((j=document.links[i].href.indexOf('?',0))<0) continue;\r
- if (document.links[i].href.indexOf('ticket=',j)>=0) continue;\r
- document.links[i].href=document.links[i].href.substring(0,j+1)+'ticket=<?php echo $ticket; ?>&'+document.links[i].href.substring(j+1);\r
-}\r
-/* Add tickets for forms (outside blog excluded) */\r
-for (i=0;document.forms[i];i++){\r
- /* check if ticket is already used */\r
- for (j=0;document.forms[i].elements[j];j++) {\r
- if (document.forms[i].elements[j].name=='ticket') {\r
- j=-1;\r
- break;\r
- }\r
- }\r
- if (j==-1) continue;\r
- \r
- /* check if the modification works */\r
- try{document.forms[i].innerHTML+='';}catch(e){\r
- /* Modificaion falied: this sometime happens on IE */\r
- if (!document.forms[i].action.name && document.forms[i].method.toUpperCase()=="POST") {\r
- /* <input name="action"/> is not used for POST method*/\r
- if (document.forms[i].action.indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0\r
- && !(document.forms[i].action.indexOf('//',0)<0)) continue;\r
- if (0<(j=document.forms[i].action.indexOf('?',0))) if (0<document.forms[i].action.indexOf('ticket=',j)) continue;\r
- if (j<0) document.forms[i].action+='?'+'ticket=<?php echo $ticket; ?>';\r
- else document.forms[i].action+='&'+'ticket=<?php echo $ticket; ?>';\r
- continue;\r
- }\r
- document.write('<?php echo _PLUGINADMIN_TICKETS_JAVASCRIPT ?>');\r
- j=document.forms[i].outerHTML;\r
- while (j!=j.replace('<','<')) j=j.replace('<','<');\r
- document.write('<p>'+j+'</p>');\r
- continue;\r
- }\r
- /* check the action paramer in form tag */\r
- /* note that <input name="action"/> may be used here */\r
- j=document.forms[i].innerHTML;\r
- document.forms[i].innerHTML='';\r
- if ((document.forms[i].action+'').indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0\r
- && !((document.forms[i].action+'').indexOf('//',0)<0)) {\r
- document.forms[i].innerHTML=j;\r
- continue;\r
- }\r
- /* add ticket */\r
- document.forms[i].innerHTML=j+'<input type="hidden" name="ticket" value="<?php echo $ticket; ?>"/>';\r
-}\r
-/*]]>*/\r
-</script><?php\r
- return;\r
- }\r
-}\r
-\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * code to make it easier to create plugin admin areas
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: PLUGINADMIN.php 1886 2012-06-17 08:27:27Z sakamocchi $
+ */
+
+class PluginAdmin
+{
+ public $strFullName; // NP_SomeThing
+ public $plugin; // ref. to plugin object
+ public $bValid; // evaluates to true when object is considered valid
+ public $admin; // ref to an admin object
+
+ private $skinContents; // PluginAdmin contents
+ private $extrahead; // extrahead
+
+ public function __construct($pluginName)
+ {
+ global $manager, $DIR_LIBS;
+
+ if ( !class_exists('Admin', FALSE) )
+ {
+ include($DIR_LIBS . 'ADMIN.php');
+ }
+
+ $this->strFullName = "NP_{$pluginName}";
+
+ // check if plugin exists and is installed
+ if ( !$manager->pluginInstalled($this->strFullName) )
+ {
+ doError(_ERROR_INVALID_PLUGIN);
+ return;
+ }
+
+ $this->plugin = &$manager->getPlugin($this->strFullName);
+ $this->bValid = $this->plugin;
+
+ if ( !$this->bValid )
+ {
+ doError(_ERROR_INVALID_PLUGIN);
+ return;
+ }
+
+ Admin::initialize();
+ Admin::$action = "plugin_{$pluginName}";
+
+ return;
+ }
+
+ /**
+ * PluginAdmin::start()
+ *
+ * @param string $extraHead child elements for header element
+ * @return void
+ */
+ public function start($extraHead = '')
+ {
+ global $CONF;
+ $this->extrahead = $extraHead . '<base href="' . Entity::hsc($CONF['AdminURL']) . '" />' . "\n";
+ ob_start();
+ return;
+ }
+
+ /**
+ * PluginAdmin::end()
+ *
+ * @param void
+ * @return void
+ */
+ public function end()
+ {
+ $this->AddTicketByJS();
+ $contents = ob_get_contents();
+ ob_end_clean();
+ $this->skinContents = '<%pagehead%>' . $contents . '<%pagefoot%>';
+ Admin::action_PluginAdmin($this->skinContents, $this->extrahead);
+ return;
+ }
+
+ /**
+ * PluginAdmin::_AddTicketByJS()
+ * Add ticket when not used in plugin's admin page
+ * to avoid CSRF.
+ *
+ * @param void
+ * @return void
+ */
+ private function AddTicketByJS()
+ {
+ global $CONF,$ticketforplugin;
+ if ( !($ticket = $ticketforplugin['ticket']) )
+ {
+ return;
+ }
+ $ticket=Entity::hsc($ticket);
+
+?><script type="text/javascript">
+/*<![CDATA[*/
+/* Add tickets for available links (outside blog excluded) */
+for (i=0;document.links[i];i++){
+ if (document.links[i].href.indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0
+ && !(document.links[i].href.indexOf('//',0)<0)) continue;
+ if ((j=document.links[i].href.indexOf('?',0))<0) continue;
+ if (document.links[i].href.indexOf('ticket=',j)>=0) continue;
+ document.links[i].href=document.links[i].href.substring(0,j+1)+'ticket=<?php echo $ticket; ?>&'+document.links[i].href.substring(j+1);
+}
+/* Add tickets for forms (outside blog excluded) */
+for (i=0;document.forms[i];i++){
+ /* check if ticket is already used */
+ for (j=0;document.forms[i].elements[j];j++) {
+ if (document.forms[i].elements[j].name=='ticket') {
+ j=-1;
+ break;
+ }
+ }
+ if (j==-1) continue;
+
+ /* check if the modification works */
+ try{document.forms[i].innerHTML+='';}catch(e){
+ /* Modificaion falied: this sometime happens on IE */
+ if (!document.forms[i].action.name && document.forms[i].method.toUpperCase()=="POST") {
+ /* <input name="action"/> is not used for POST method*/
+ if (document.forms[i].action.indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0
+ && !(document.forms[i].action.indexOf('//',0)<0)) continue;
+ if (0<(j=document.forms[i].action.indexOf('?',0))) if (0<document.forms[i].action.indexOf('ticket=',j)) continue;
+ if (j<0) document.forms[i].action+='?'+'ticket=<?php echo $ticket; ?>';
+ else document.forms[i].action+='&'+'ticket=<?php echo $ticket; ?>';
+ continue;
+ }
+ document.write('<?php echo _PLUGINADMIN_TICKETS_JAVASCRIPT ?>');
+ j=document.forms[i].outerHTML;
+ while (j!=j.replace('<','<')) j=j.replace('<','<');
+ document.write('<p>'+j+'</p>');
+ continue;
+ }
+ /* check the action paramer in form tag */
+ /* note that <input name="action"/> may be used here */
+ j=document.forms[i].innerHTML;
+ document.forms[i].innerHTML='';
+ if ((document.forms[i].action+'').indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0
+ && !((document.forms[i].action+'').indexOf('//',0)<0)) {
+ document.forms[i].innerHTML=j;
+ continue;
+ }
+ /* add ticket */
+ document.forms[i].innerHTML=j+'<input type="hidden" name="ticket" value="<?php echo $ticket; ?>"/>';
+}
+/*]]>*/
+</script><?php
+ return;
+ }
+}
+
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2003-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * SEARCH(querystring) offers different functionality to create an\r
- * SQL query to find certain items. (and comments)\r
- *\r
- * based on code by David Altherr:\r
- * http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_MySQL/18/15665/\r
- * http://davidaltherr.net/web/php_functions/boolean/funcs.mysql.boolean.txt\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: SEARCH.php 1556 2011-07-11 14:18:48Z ftruscot $\r
- */\r
-\r
-\r
-\r
-class Search\r
-{\r
- var $querystring;\r
- var $marked;\r
- var $inclusive;\r
- var $blogs;\r
-\r
-\r
- function SEARCH($text) {\r
- global $blogid;\r
- $text = preg_replace ("/[<,>,=,?,!,#,^,(,),[,\],:,;,\\\,%]/","",$text);\r
- $this->querystring = $text;\r
- $this->marked = $this->boolean_mark_atoms($text);\r
- $this->inclusive = $this->boolean_inclusive_atoms($text);\r
- $this->blogs = array();\r
-\r
- // get all public searchable blogs, no matter what, include the current blog allways.\r
- $res = DB::getResult('SELECT bnumber FROM '.sql_table('blog').' WHERE bincludesearch=1 ');\r
- foreach ( $res as $row )\r
- $this->blogs[] = intval($row['bnumber']);\r
- }\r
-\r
- function boolean_sql_select($match){\r
- if (i18n::strlen($this->inclusive) > 0) {\r
- /* build sql for determining score for each record */\r
- $result=preg_split("# #",$this->inclusive);\r
- for($cth=0;$cth<count($result);$cth++){\r
- if(i18n::strlen($result[$cth])>=4){\r
- $stringsum_long .= " $result[$cth] ";\r
- }else{\r
- $stringsum_a[] = ' '.$this->boolean_sql_select_short($result[$cth],$match).' ';\r
- }\r
- }\r
-\r
- if(i18n::strlen($stringsum_long)>0){\r
- $stringsum_long = DB::quoteValue($stringsum_long);\r
- $stringsum_a[] = " match ({$match}) against ({$stringsum_long}) ";\r
- }\r
-\r
- $stringsum .= implode("+",$stringsum_a);\r
- return $stringsum;\r
- }\r
- }\r
-\r
- function boolean_inclusive_atoms($string){\r
- $result = trim($string);\r
- $result = preg_replace("#([[:space:]]{2,})#", ' ', $result);\r
-\r
- # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0\r
- # just added delimiters to regex and the 'i' for case-insensitive matching\r
-\r
- /* convert normal boolean operators to shortened syntax */\r
- $result = preg_replace('# not #i', ' -', $result);\r
- $result = preg_replace('# and #i', ' ', $result);\r
- $result = preg_replace('# or #i', ',', $result);\r
-\r
- /* drop unnecessary spaces */\r
- $result = str_replace(' ,', ',', $result);\r
- $result = str_replace(', ', ',', $result);\r
- $result = str_replace('- ', '-', $result);\r
- $result = str_replace('+', '', $result);\r
-\r
- /* strip exlusive atoms */\r
- $result = preg_replace(\r
- "#\-\([A-Za-z0-9]{1,}[A-Za-z0-9\-\.\_\,]{0,}\)#",\r
- '',\r
- $result);\r
-\r
- $result = str_replace('(', ' ', $result);\r
- $result = str_replace(')', ' ', $result);\r
- $result = str_replace(',', ' ', $result);\r
-\r
- return $result;\r
- }\r
-\r
- function boolean_sql_where($match){\r
-\r
- $result = $this->marked;\r
-\r
- $this->boolean_sql_where_cb1($match); // set the static $match\r
-\r
- $result = preg_replace_callback(\r
-\r
- "/foo\[\(\'([^\)]{4,})\'\)\]bar/",\r
-\r
- array($this,'boolean_sql_where_cb1'),\r
-\r
- $result);\r
-\r
- $this->boolean_sql_where_cb2($match); // set the static $match\r
-\r
- $result = preg_replace_callback(\r
-\r
- "/foo\[\(\'([^\)]{1,3})\'\)\]bar/",\r
-\r
- array($this,'boolean_sql_where_cb2'),\r
-\r
- $result);\r
-\r
- return $result;\r
-\r
- }\r
-\r
- function boolean_sql_where_cb1($matches){\r
-\r
- static $match;\r
-\r
- if (!is_array($matches)) $match=$matches;\r
-\r
- else return ' match ('.$match.') against ('.DB::quoteValue($matches[1]).') > 0 ';\r
-\r
- }\r
-\r
- function boolean_sql_where_cb2($matches){\r
-\r
- static $match;\r
-\r
- if (!is_array($matches)) $match=$matches;\r
-\r
- else return ' ('.$this->boolean_sql_where_short($matches[1], $match).') ';\r
-\r
- } \r
-\r
- function boolean_mark_atoms($string){\r
- $result = trim($string);\r
- $result = preg_replace("/([[:space:]]{2,})/",' ',$result);\r
-\r
- # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0\r
- # just added delimiters to regex and the 'i' for case-insensitive matching\r
-\r
- /* convert normal boolean operators to shortened syntax */\r
- $result = preg_replace('# not #i', ' -', $result);\r
- $result = preg_replace('# and #i', ' ', $result);\r
- $result = preg_replace('# or #i', ',', $result);\r
-\r
- /* strip excessive whitespace */\r
- $result = str_replace('( ', '(', $result);\r
- $result = str_replace(' )', ')', $result);\r
- $result = str_replace(', ', ',', $result);\r
- $result = str_replace(' ,', ',', $result);\r
- $result = str_replace('- ', '-', $result);\r
- $result = str_replace('+', '', $result);\r
-\r
- // remove double spaces (we might have introduced some new ones above)\r
- $result = trim($result);\r
- $result = preg_replace("#([[:space:]]{2,})#", ' ', $result);\r
-\r
- /* apply arbitrary function to all 'word' atoms */\r
-\r
- $result_a = preg_split('# #', $result);\r
-\r
- for($word = 0;$word<count($result_a);$word++)\r
- {\r
- $result_a[$word] = "foo[('" . $result_a[$word] . "')]bar";\r
- }\r
-\r
- $result = implode(' ', $result_a);\r
-\r
- /* dispatch ' ' to ' AND ' */\r
- $result = str_replace(' ', ' AND ', $result);\r
-\r
- /* dispatch ',' to ' OR ' */\r
- $result = str_replace(',', ' OR ', $result);\r
-\r
- /* dispatch '-' to ' NOT ' */\r
- $result = str_replace(' -', ' NOT ', $result);\r
- return $result;\r
- }\r
-\r
- function boolean_sql_where_short($string,$match){\r
- $match_a = preg_split('#,#',$match);\r
- for($ith=0;$ith<count($match_a);$ith++){\r
- $like_a[$ith] = ' $match_a[$ith] LIKE ' . DB::quoteValue("% {$string} %") . ' ';\r
- }\r
- $like = implode(" OR ",$like_a);\r
-\r
- return $like;\r
- }\r
- function boolean_sql_select_short($string,$match){\r
- $match_a = preg_split('#,#',$match);\r
- $score_unit_weight = .2;\r
- for($ith=0;$ith<count($match_a);$ith++){\r
- $score_a[$ith] =\r
- " $score_unit_weight*(\r
- LENGTH(" . DB::quoteValue($match_a[$ith]) . ") -\r
- LENGTH(REPLACE(LOWER(" . DB::quoteValue($match_a[$ith]) . "),LOWER(" . DB::quoteValue($string) . "),'')))\r
- /LENGTH(" . DB::quoteValue($string) . ") ";\r
- }\r
- $score = implode(" + ",$score_a);\r
-\r
- return $score;\r
- }\r
-}\r
-?>\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2003-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * SEARCH(querystring) offers different functionality to create an
+ * SQL query to find certain items. (and comments)
+ *
+ * based on code by David Altherr:
+ * http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_MySQL/18/15665/
+ * http://davidaltherr.net/web/php_functions/boolean/funcs.mysql.boolean.txt
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: SEARCH.php 1886 2012-06-17 08:27:27Z sakamocchi $
+ */
+
+
+
+class Search
+{
+ var $querystring;
+ var $marked;
+ var $inclusive;
+ var $blogs;
+
+
+ function SEARCH($text) {
+ global $blogid;
+ $text = preg_replace ("/[<,>,=,?,!,#,^,(,),[,\],:,;,\\\,%]/","",$text);
+ $this->querystring = $text;
+ $this->marked = $this->boolean_mark_atoms($text);
+ $this->inclusive = $this->boolean_inclusive_atoms($text);
+ $this->blogs = array();
+
+ // get all public searchable blogs, no matter what, include the current blog allways.
+ $res = DB::getResult('SELECT bnumber FROM '.sql_table('blog').' WHERE bincludesearch=1 ');
+ foreach ( $res as $row )
+ $this->blogs[] = intval($row['bnumber']);
+ }
+
+ function boolean_sql_select($match){
+ if (i18n::strlen($this->inclusive) > 0) {
+ /* build sql for determining score for each record */
+ $result=preg_split("# #",$this->inclusive);
+ for($cth=0;$cth<count($result);$cth++){
+ if(i18n::strlen($result[$cth])>=4){
+ $stringsum_long .= " $result[$cth] ";
+ }else{
+ $stringsum_a[] = ' '.$this->boolean_sql_select_short($result[$cth],$match).' ';
+ }
+ }
+
+ if(i18n::strlen($stringsum_long)>0){
+ $stringsum_long = DB::quoteValue($stringsum_long);
+ $stringsum_a[] = " match ({$match}) against ({$stringsum_long}) ";
+ }
+
+ $stringsum .= implode("+",$stringsum_a);
+ return $stringsum;
+ }
+ }
+
+ function boolean_inclusive_atoms($string){
+ $result = trim($string);
+ $result = preg_replace("#([[:space:]]{2,})#", ' ', $result);
+
+ # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0
+ # just added delimiters to regex and the 'i' for case-insensitive matching
+
+ /* convert normal boolean operators to shortened syntax */
+ $result = preg_replace('# not #i', ' -', $result);
+ $result = preg_replace('# and #i', ' ', $result);
+ $result = preg_replace('# or #i', ',', $result);
+
+ /* drop unnecessary spaces */
+ $result = str_replace(' ,', ',', $result);
+ $result = str_replace(', ', ',', $result);
+ $result = str_replace('- ', '-', $result);
+ $result = str_replace('+', '', $result);
+
+ /* strip exlusive atoms */
+ $result = preg_replace(
+ "#\-\([A-Za-z0-9]{1,}[A-Za-z0-9\-\.\_\,]{0,}\)#",
+ '',
+ $result);
+
+ $result = str_replace('(', ' ', $result);
+ $result = str_replace(')', ' ', $result);
+ $result = str_replace(',', ' ', $result);
+
+ return $result;
+ }
+
+ function boolean_sql_where($match){
+
+ $result = $this->marked;
+
+ $this->boolean_sql_where_cb1($match); // set the static $match
+
+ $result = preg_replace_callback(
+
+ "/foo\[\(\'([^\)]{4,})\'\)\]bar/",
+
+ array($this,'boolean_sql_where_cb1'),
+
+ $result);
+
+ $this->boolean_sql_where_cb2($match); // set the static $match
+
+ $result = preg_replace_callback(
+
+ "/foo\[\(\'([^\)]{1,3})\'\)\]bar/",
+
+ array($this,'boolean_sql_where_cb2'),
+
+ $result);
+
+ return $result;
+
+ }
+
+ function boolean_sql_where_cb1($matches){
+
+ static $match;
+
+ if (!is_array($matches)) $match=$matches;
+
+ else return ' match ('.$match.') against ('.DB::quoteValue($matches[1]).') > 0 ';
+
+ }
+
+ function boolean_sql_where_cb2($matches){
+
+ static $match;
+
+ if (!is_array($matches)) $match=$matches;
+
+ else return ' ('.$this->boolean_sql_where_short($matches[1], $match).') ';
+
+ }
+
+ function boolean_mark_atoms($string){
+ $result = trim($string);
+ $result = preg_replace("/([[:space:]]{2,})/",' ',$result);
+
+ # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0
+ # just added delimiters to regex and the 'i' for case-insensitive matching
+
+ /* convert normal boolean operators to shortened syntax */
+ $result = preg_replace('# not #i', ' -', $result);
+ $result = preg_replace('# and #i', ' ', $result);
+ $result = preg_replace('# or #i', ',', $result);
+
+ /* strip excessive whitespace */
+ $result = str_replace('( ', '(', $result);
+ $result = str_replace(' )', ')', $result);
+ $result = str_replace(', ', ',', $result);
+ $result = str_replace(' ,', ',', $result);
+ $result = str_replace('- ', '-', $result);
+ $result = str_replace('+', '', $result);
+
+ // remove double spaces (we might have introduced some new ones above)
+ $result = trim($result);
+ $result = preg_replace("#([[:space:]]{2,})#", ' ', $result);
+
+ /* apply arbitrary function to all 'word' atoms */
+
+ $result_a = preg_split('# #', $result);
+
+ for($word = 0;$word<count($result_a);$word++)
+ {
+ $result_a[$word] = "foo[('" . $result_a[$word] . "')]bar";
+ }
+
+ $result = implode(' ', $result_a);
+
+ /* dispatch ' ' to ' AND ' */
+ $result = str_replace(' ', ' AND ', $result);
+
+ /* dispatch ',' to ' OR ' */
+ $result = str_replace(',', ' OR ', $result);
+
+ /* dispatch '-' to ' NOT ' */
+ $result = str_replace(' -', ' NOT ', $result);
+ return $result;
+ }
+
+ function boolean_sql_where_short($string,$match){
+ $match_a = preg_split('#,#',$match);
+ for($ith=0;$ith<count($match_a);$ith++){
+ $like_a[$ith] = ' $match_a[$ith] LIKE ' . DB::quoteValue("% {$string} %") . ' ';
+ }
+ $like = implode(" OR ",$like_a);
+
+ return $like;
+ }
+ function boolean_sql_select_short($string,$match){
+ $match_a = preg_split('#,#',$match);
+ $score_unit_weight = .2;
+ for($ith=0;$ith<count($match_a);$ith++){
+ $score_a[$ith] =
+ " $score_unit_weight*(
+ LENGTH(" . DB::quoteValue($match_a[$ith]) . ") -
+ LENGTH(REPLACE(LOWER(" . DB::quoteValue($match_a[$ith]) . "),LOWER(" . DB::quoteValue($string) . "),'')))
+ /LENGTH(" . DB::quoteValue($string) . ") ";
+ }
+ $score = implode(" + ",$score_a);
+
+ return $score;
+ }
+}
+?>
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Class representing a skin\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: SKIN.php 1816 2012-05-03 01:40:10Z sakamocchi $\r
- */\r
-\r
-if ( !function_exists('requestVar') )\r
-{\r
- exit;\r
-}\r
-\r
-class Skin\r
-{\r
- // after creating a SKIN object, evaluates to true when the skin exists\r
- private $valid;\r
- \r
- // skin characteristics. Use the getXXX methods rather than accessing directly\r
- private $id;\r
- private $description;\r
- private $contentType;\r
- private $includeMode; // either 'normal' or 'skindir'\r
- private $includePrefix;\r
- private $name;\r
- \r
- /* action class */\r
- private $action_class;\r
- private $event_identifier;\r
- \r
- /**\r
- * Skin::__construct()\r
- * Constructor for a new SKIN object\r
- * \r
- * @param integer $id id of the skin\r
- * @param string $action_class name of class extended from BaseActions\r
- * @param string $event_identifier event identifier. for example, InitAdminSkinParse if AdminSkin is used\r
- * @return void\r
- */\r
- public function __construct($id, $action_class='Actions', $event_identifier='Skin')\r
- {\r
- global $DIR_LIBS;\r
- \r
- $this->id = (integer) $id;\r
- \r
- /* NOTE: include needed action class */\r
- if ( $action_class != 'Actions' )\r
- {\r
- if ( !class_exists($action_class, FALSE)\r
- && (!file_exists("{$DIR_LIBS}{$action_class}.php")\r
- || !include("{$DIR_LIBS}{$action_class}.php")) )\r
- {\r
- return;\r
- }\r
- }\r
- else\r
- {\r
- if ( !class_exists('Actions', FALSE)\r
- && (!file_exists("{$DIR_LIBS}ACTIONS.php")\r
- || !include("{$DIR_LIBS}ACTIONS.php")) )\r
- {\r
- return;\r
- }\r
- }\r
- \r
- $this->action_class = $action_class;\r
- $this->event_identifier = $event_identifier;\r
- \r
- // read skin name/description/content type\r
- $query = "SELECT * FROM %s WHERE sdnumber=%d;";\r
- $query = sprintf($query, sql_table('skin_desc'), $this->id);\r
- $res = DB::getRow($query);\r
- \r
- $this->valid = !empty($res);\r
- if ( $this->valid )\r
- { $this->name = $res['sdname'];\r
- $this->description = $res['sddesc'];\r
- $this->contentType = $res['sdtype'];\r
- $this->includeMode = $res['sdincmode'];\r
- $this->includePrefix = $res['sdincpref'];\r
- }\r
- \r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Skin::getID()\r
- * Get SKIN id\r
- * \r
- * @param void\r
- * @return integer id for this skin instance\r
- */\r
- public function getID()\r
- {\r
- return (integer) $this->id;\r
- }\r
- \r
- /**\r
- * Skin::isValid()\r
- * \r
- * @param void\r
- * @return boolean\r
- */\r
- public function isValid()\r
- {\r
- return (boolean) $this->valid;\r
- }\r
- \r
- /**\r
- * Skin::getName()\r
- * Get SKIN name\r
- * \r
- * @param void\r
- * @return string name of this skin instance\r
- */\r
- public function getName()\r
- {\r
- return (string) $this->name;\r
- }\r
- \r
- /**\r
- * Skin::getDescription()\r
- * Get SKIN description\r
- * \r
- * @param void\r
- * @return string description of this skin instance\r
- */\r
- public function getDescription()\r
- {\r
- return (string) $this->description;\r
- }\r
- \r
- /**\r
- * Skin::getContentType()\r
- * Get SKIN content type\r
- * e.g. text/xml, text/html, application/atom+xml\r
- * \r
- * @param void\r
- * @return string name of this skin instance\r
- */\r
- public function getContentType()\r
- {\r
- return (string) $this->contentType;\r
- }\r
- \r
- /**\r
- * Skin::getIncludeMode()\r
- * Get include mode of the SKIN\r
- * \r
- * Returns either 'normal' or 'skindir':\r
- * 'normal': if a all data of the skin can be found in the databse\r
- * 'skindir': if the skin has data in the it's skin driectory\r
- * \r
- * @param void\r
- * @return string normal/skindir\r
- */\r
- public function getIncludeMode()\r
- {\r
- return (string) $this->includeMode;\r
- }\r
- \r
- /**\r
- * Skin::getIncludePrefix()\r
- * Get include prefix of the SKIN\r
- * \r
- * Get name of the subdirectory (with trailing slash) where\r
- * the files of the current skin can be found (e.g. 'default/')\r
- * \r
- * @param void\r
- * @return string include prefix of this skin instance\r
- */\r
- public function getIncludePrefix()\r
- {\r
- return (string) $this->includePrefix;\r
- }\r
- \r
- /**\r
- * Skin::exists()\r
- * Checks if a skin with a given shortname exists\r
- * \r
- * @static\r
- * @param string $name Skin short name\r
- * @return integer number of skins with the given ID\r
- */\r
- static public function exists($name)\r
- {\r
- $query = "SELECT COUNT(*) AS result FROM %s WHERE sdname=%s;";\r
- $query = sprintf($query, sql_table('skin_desc'), DB::quoteValue($name));\r
- return (DB::getValue($query) > 0);\r
- }\r
- \r
- /**\r
- * Skin::existsID()\r
- * Checks if a skin with a given ID exists\r
- * \r
- * @static\r
- * @param string $id Skin ID\r
- * @return integer number of skins with the given ID\r
- */\r
- static public function existsID($id)\r
- {\r
- $query = "SELECT COUNT(*) AS result FROM %s WHERE sdnumber=%d;";\r
- $query = sprintf($query, sql_table('skin_desc'), (integer) $id);\r
- return (DB::getValue($query) > 0);\r
- }\r
- \r
- /**\r
- * Skin::createFromName()\r
- * Returns a skin given its shortname\r
- * \r
- * @static\r
- * @param string $name Skin shortname\r
- * @return object instance of Skin class\r
- */\r
- static public function createFromName($name)\r
- {\r
- return new SKIN(SKIN::getIdFromName($name));\r
- }\r
- \r
- /**\r
- * Skin::getIdFromName()\r
- * Returns a skin ID given its shortname\r
- * \r
- * @static\r
- * @param string $name Skin shortname\r
- * @return integer Skin ID\r
- */\r
- static public function getIdFromName($name)\r
- {\r
- $query = "SELECT sdnumber FROM %s WHERE sdname=%s;";\r
- $query = sprintf($query, sql_table('skin_desc'), DB::quoteValue($name));\r
- return DB::getValue($query);\r
- }\r
- \r
- /**\r
- * Skin::getNameFromId()\r
- * Returns a skin shortname given its ID\r
- * \r
- * @static\r
- * @param string $name\r
- * @return string Skin short name\r
- */\r
- static public function getNameFromId($id)\r
- {\r
- $query = "SELECT sdname AS result FROM %s WHERE sdnumber=%d;";\r
- $query = sprintf($query, sql_table('skin_desc'), (integer) $id);\r
- return DB::getValue($query);\r
- }\r
- \r
- /**\r
- * SKIN::createNew()\r
- * Creates a new skin, with the given characteristics.\r
- *\r
- * @static\r
- * @param String $name value for nucleus_skin.sdname\r
- * @param String $desc value for nucleus_skin.sddesc\r
- * @param String $type value for nucleus_skin.sdtype\r
- * @param String $includeMode value for nucleus_skin.sdinclude\r
- * @param String $includePrefix value for nucleus_skin.sdincpref\r
- * @return Integer ID for just inserted record\r
- */\r
- public function createNew($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '')\r
- {\r
- global $manager;\r
- \r
- $data = array(\r
- 'name' => &$name,\r
- 'description' => &$desc,\r
- 'type' => &$type,\r
- 'includeMode' => &$includeMode,\r
- 'includePrefix' => &$includePrefix\r
- );\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Class representing a skin
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: SKIN.php 1886 2012-06-17 08:27:27Z sakamocchi $
+ */
+
+if ( !function_exists('requestVar') )
+{
+ exit;
+}
+
+class Skin
+{
+ // after creating a SKIN object, evaluates to true when the skin exists
+ private $valid;
+
+ // skin characteristics. Use the getXXX methods rather than accessing directly
+ private $id;
+ private $description;
+ private $contentType;
+ private $includeMode; // either 'normal' or 'skindir'
+ private $includePrefix;
+ private $name;
+
+ /* action class */
+ private $action_class;
+ private $event_identifier;
+
+ /**
+ * Skin::__construct()
+ * Constructor for a new SKIN object
+ *
+ * @param integer $id id of the skin
+ * @param string $action_class name of class extended from BaseActions
+ * @param string $event_identifier event identifier. for example, InitAdminSkinParse if AdminSkin is used
+ * @return void
+ */
+ public function __construct($id, $action_class='Actions', $event_identifier='Skin')
+ {
+ global $DIR_LIBS;
+
+ $this->id = (integer) $id;
+
+ /* NOTE: include needed action class */
+ if ( $action_class != 'Actions' )
+ {
+ if ( !class_exists($action_class, FALSE)
+ && (!file_exists("{$DIR_LIBS}{$action_class}.php")
+ || !include("{$DIR_LIBS}{$action_class}.php")) )
+ {
+ return;
+ }
+ }
+ else
+ {
+ if ( !class_exists('Actions', FALSE)
+ && (!file_exists("{$DIR_LIBS}ACTIONS.php")
+ || !include("{$DIR_LIBS}ACTIONS.php")) )
+ {
+ return;
+ }
+ }
+
+ $this->action_class = $action_class;
+ $this->event_identifier = $event_identifier;
+
+ // read skin name/description/content type
+ $query = "SELECT * FROM %s WHERE sdnumber=%d;";
+ $query = sprintf($query, sql_table('skin_desc'), $this->id);
+ $res = DB::getRow($query);
+
+ $this->valid = !empty($res);
+ if ( $this->valid )
+ {
+ $this->name = $res['sdname'];
+ $this->description = $res['sddesc'];
+ $this->contentType = $res['sdtype'];
+ $this->includeMode = $res['sdincmode'];
+ $this->includePrefix = $res['sdincpref'];
+ }
+
+ return;
+ }
+
+ /**
+ * Skin::getID()
+ * Get SKIN id
+ *
+ * @param void
+ * @return integer id for this skin instance
+ */
+ public function getID()
+ {
+ return (integer) $this->id;
+ }
+
+ /**
+ * Skin::isValid()
+ *
+ * @param void
+ * @return boolean
+ */
+ public function isValid()
+ {
+ return (boolean) $this->valid;
+ }
+
+ /**
+ * Skin::getName()
+ * Get SKIN name
+ *
+ * @param void
+ * @return string name of this skin instance
+ */
+ public function getName()
+ {
+ return (string) $this->name;
+ }
+
+ /**
+ * Skin::getDescription()
+ * Get SKIN description
+ *
+ * @param void
+ * @return string description of this skin instance
+ */
+ public function getDescription()
+ {
+ return (string) $this->description;
+ }
+
+ /**
+ * Skin::getContentType()
+ * Get SKIN content type
+ * e.g. text/xml, text/html, application/atom+xml
+ *
+ * @param void
+ * @return string name of this skin instance
+ */
+ public function getContentType()
+ {
+ return (string) $this->contentType;
+ }
+
+ /**
+ * Skin::getIncludeMode()
+ * Get include mode of the SKIN
+ *
+ * Returns either 'normal' or 'skindir':
+ * 'normal': if a all data of the skin can be found in the databse
+ * 'skindir': if the skin has data in the it's skin driectory
+ *
+ * @param void
+ * @return string normal/skindir
+ */
+ public function getIncludeMode()
+ {
+ return (string) $this->includeMode;
+ }
+
+ /**
+ * Skin::getIncludePrefix()
+ * Get include prefix of the SKIN
+ *
+ * Get name of the subdirectory (with trailing slash) where
+ * the files of the current skin can be found (e.g. 'default/')
+ *
+ * @param void
+ * @return string include prefix of this skin instance
+ */
+ public function getIncludePrefix()
+ {
+ return (string) $this->includePrefix;
+ }
+
+ /**
+ * Skin::exists()
+ * Checks if a skin with a given shortname exists
+ *
+ * @static
+ * @param string $name Skin short name
+ * @return integer number of skins with the given ID
+ */
+ static public function exists($name)
+ {
+ $query = "SELECT COUNT(*) AS result FROM %s WHERE sdname=%s;";
+ $query = sprintf($query, sql_table('skin_desc'), DB::quoteValue($name));
+ return (DB::getValue($query) > 0);
+ }
+
+ /**
+ * Skin::existsID()
+ * Checks if a skin with a given ID exists
+ *
+ * @static
+ * @param string $id Skin ID
+ * @return integer number of skins with the given ID
+ */
+ static public function existsID($id)
+ {
+ $query = "SELECT COUNT(*) AS result FROM %s WHERE sdnumber=%d;";
+ $query = sprintf($query, sql_table('skin_desc'), (integer) $id);
+ return (DB::getValue($query) > 0);
+ }
+
+ /**
+ * Skin::createFromName()
+ * Returns a skin given its shortname
+ *
+ * @static
+ * @param string $name Skin shortname
+ * @return object instance of Skin class
+ */
+ static public function createFromName($name)
+ {
+ return new SKIN(SKIN::getIdFromName($name));
+ }
+
+ /**
+ * Skin::getIdFromName()
+ * Returns a skin ID given its shortname
+ *
+ * @static
+ * @param string $name Skin shortname
+ * @return integer Skin ID
+ */
+ static public function getIdFromName($name)
+ {
+ $query = "SELECT sdnumber FROM %s WHERE sdname=%s;";
+ $query = sprintf($query, sql_table('skin_desc'), DB::quoteValue($name));
+ return DB::getValue($query);
+ }
+
+ /**
+ * Skin::getNameFromId()
+ * Returns a skin shortname given its ID
+ *
+ * @static
+ * @param string $name
+ * @return string Skin short name
+ */
+ static public function getNameFromId($id)
+ {
+ $query = "SELECT sdname AS result FROM %s WHERE sdnumber=%d;";
+ $query = sprintf($query, sql_table('skin_desc'), (integer) $id);
+ return DB::getValue($query);
+ }
+
+ /**
+ * SKIN::createNew()
+ * Creates a new skin, with the given characteristics.
+ *
+ * @static
+ * @param String $name value for nucleus_skin.sdname
+ * @param String $desc value for nucleus_skin.sddesc
+ * @param String $type value for nucleus_skin.sdtype
+ * @param String $includeMode value for nucleus_skin.sdinclude
+ * @param String $includePrefix value for nucleus_skin.sdincpref
+ * @return Integer ID for just inserted record
+ */
+ public function createNew($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '')
+ {
+ global $manager;
+
+ $data = array(
+ 'name' => &$name,
+ 'description' => &$desc,
+ 'type' => &$type,
+ 'includeMode' => &$includeMode,
+ 'includePrefix' => &$includePrefix
+ );
$manager->notify('PreAddSkin', $data);
- \r
- $query = "INSERT INTO %s (sdname, sddesc, sdtype, sdincmode, sdincpref) VALUES (%s, %s, %s, %s, %s);";\r
- $sdname = DB::quoteValue($name);\r
- $sddesc = DB::quoteValue($desc);\r
- $sdtype = DB::quoteValue($type);\r
- $sdincmode = DB::quoteValue($includeMode);\r
- $sdincpref = DB::quoteValue($includePrefix);\r
- $query = sprintf($query, sql_table('skin_desc'), $sdname, $sddesc, $sdtype, $sdincmode, $sdincpref);\r
- DB::execute($query);\r
- $newid = DB::getInsertId();\r
- \r
- $data = array(\r
- 'skinid' => $newid,\r
- 'name' => $name,\r
- 'description' => $desc,\r
- 'type' => $type,\r
- 'includeMode' => $includeMode,\r
- 'includePrefix' => $includePrefix\r
- );\r
+
+ $query = "INSERT INTO %s (sdname, sddesc, sdtype, sdincmode, sdincpref) VALUES (%s, %s, %s, %s, %s);";
+ $sdname = DB::quoteValue($name);
+ $sddesc = DB::quoteValue($desc);
+ $sdtype = DB::quoteValue($type);
+ $sdincmode = DB::quoteValue($includeMode);
+ $sdincpref = DB::quoteValue($includePrefix);
+ $query = sprintf($query, sql_table('skin_desc'), $sdname, $sddesc, $sdtype, $sdincmode, $sdincpref);
+ DB::execute($query);
+ $newid = DB::getInsertId();
+
+ $data = array(
+ 'skinid' => $newid,
+ 'name' => $name,
+ 'description' => $desc,
+ 'type' => $type,
+ 'includeMode' => $includeMode,
+ 'includePrefix' => $includePrefix
+ );
$manager->notify('PostAddSkin', $data);
- return $newid;\r
- }\r
- \r
- /**\r
- * Skin::parse()\r
- * Parse a SKIN\r
- * \r
- * @param string $type\r
- * @param string $path path to file if using fileparser\r
- * @return void\r
- */\r
- public function parse($type, $path='')\r
- {\r
- global $currentSkinName, $manager, $CONF, $DIR_NUCLEUS;\r
- \r
+ return $newid;
+ }
+
+ /**
+ * Skin::parse()
+ * Parse a SKIN
+ *
+ * @param string $type
+ * @param string $path path to file if using fileparser
+ * @return void
+ */
+ public function parse($type, $path='')
+ {
+ global $currentSkinName, $manager, $CONF, $DIR_NUCLEUS;
+
$data = array(
'skin' => &$this,
'type' => $type
);
$manager->notify("Init{$this->event_identifier}Parse", $data);
- \r
- // include skin locale file for <%text%> tag if useable\r
- $this->includeTranslation();\r
- \r
- // set output type\r
- sendContentType($this->getContentType(), 'skin');\r
- \r
- /* FIX: should be obsoleted */\r
- $currentSkinName = $this->getName();\r
- \r
- // retrieve contents\r
- $contents = FALSE;\r
- if ( $type == 'pluginadmin' )\r
- {\r
- $contents = $path;\r
- }\r
- else\r
- {\r
- if ( $type != 'fileparse' && $type != 'importAdmin')\r
- {\r
- $contents = $this->getContentFromDB($type);\r
- }\r
- else if ( $path !== '' && i18n::strpos(realpath($path), realpath("$DIR_NUCLEUS/../")) == 0 )\r
- {\r
- $contents = $this->getContentFromFile($path);\r
- }\r
- }\r
- // use base skin if this skin does not have contents\r
- if ( $contents === FALSE )\r
- {\r
- $defskin = new SKIN($CONF['BaseSkin']);\r
- $contents = $defskin->getContentFromDB($type);\r
- if ( !$contents )\r
- {\r
- echo _ERROR_SKIN;\r
- return;\r
- }\r
- }\r
- \r
+
+ // include skin locale file for <%text%> tag if useable
+ $this->includeTranslation();
+
+ // set output type
+ sendContentType($this->getContentType(), 'skin');
+
+ /* FIX: should be obsoleted */
+ $currentSkinName = $this->getName();
+
+ // retrieve contents
+ $contents = FALSE;
+ if ( $type == 'pluginadmin' )
+ {
+ $contents = $path;
+ }
+ else
+ {
+ if ( $type != 'fileparse' && $type != 'importAdmin')
+ {
+ $contents = $this->getContentFromDB($type);
+ }
+ else if ( $path !== '' && i18n::strpos(realpath($path), realpath("$DIR_NUCLEUS/../")) == 0 )
+ {
+ $contents = $this->getContentFromFile($path);
+ }
+ }
+ // use base skin if this skin does not have contents
+ if ( $contents === FALSE )
+ {
+ $defskin = new SKIN($CONF['BaseSkin']);
+ $contents = $defskin->getContentFromDB($type);
+ if ( !$contents )
+ {
+ echo _ERROR_SKIN;
+ return;
+ }
+ }
+
$data = array(
'skin' => &$this,
'type' => $type,
'contents' => &$contents
);
$manager->notify("Pre{$this->event_identifier}Parse", $data);
- \r
- // set IncludeMode properties of parser\r
- Parser::setProperty('IncludeMode', $this->getIncludeMode());\r
- Parser::setProperty('IncludePrefix', $this->getIncludePrefix());\r
- \r
- // call action handler\r
- $action_class = $this->action_class;\r
- $handler = new $action_class($type);\r
- \r
- // register action handler to parser\r
- $parser = new Parser($handler);\r
- $parser->setSkin($this);\r
- $parser->parse($contents);\r
- \r
+
+ // set IncludeMode properties of parser
+ Parser::setProperty('IncludeMode', $this->getIncludeMode());
+ Parser::setProperty('IncludePrefix', $this->getIncludePrefix());
+
+ // call action handler
+ $action_class = $this->action_class;
+ $handler = new $action_class($type);
+
+ // register action handler to parser
+ $parser = new Parser($handler);
+ $parser->setSkin($this);
+ $parser->parse($contents);
+
$data = array(
'skin' => &$this,
'type' => $type
);
$manager->notify("Post{$this->event_identifier}Parse", $data);
- return;\r
- }\r
- \r
- /**\r
- * Skin::getContentFromDB()\r
- * \r
- * @param string $skintype skin type\r
- * @return string content for the skin type\r
- */\r
- public function getContentFromDB($skintype)\r
- {\r
- $query = "SELECT scontent FROM %s WHERE sdesc=%d and stype=%s;";\r
- $query = sprintf($query, sql_table('skin'), (integer) $this->id, DB::quoteValue($skintype));\r
- $res = DB::getValue($query);\r
- \r
- return $res ? $res : '';\r
- }\r
- \r
- /**\r
- * Skin::getContentFromFile()\r
- * \r
- * @param string $fullpath fullpath to the file to parse\r
- * @return mixed file contents or FALSE\r
- */\r
- public function getContentFromFile($fullpath)\r
- {\r
- $fsize = filesize($fullpath);\r
- if ( $fsize <= 0 )\r
- {\r
- return;\r
- }\r
- \r
- $fd = fopen ($fullpath, 'r');\r
- if ( $fd === FALSE )\r
- {\r
- return FALSE;\r
- }\r
- \r
- $contents = fread ($fd, $fsize);\r
- if ( $contents === FALSE )\r
- {\r
- return FALSE;\r
- }\r
- \r
- fclose ($fd);\r
- return $contents;\r
- }\r
- \r
- /**\r
- * SKIN::update()\r
- * Updates the contents for one part of the skin in the database\r
- * \r
- * @param string $type type of the skin part (e.g. index, item, search ...) \r
- * @param string $content new content for this skin part\r
- * @return void\r
- * \r
- */\r
- public function update($type, $content)\r
- {\r
- global $manager;\r
- \r
- $query = "SELECT sdesc FROM %s WHERE stype=%s and sdesc=%d;";\r
- $query = sprintf($query, sql_table('skin'), DB::quoteValue($type), (integer) $this->id);\r
- $res = DB::getValue($query);\r
- \r
- $skintypeexists = !empty($res);\r
- $skintypevalue = !empty($content);\r
- \r
- if( $skintypevalue && $skintypeexists )\r
- {\r
- $data = array(\r
- 'skinid' => $this->id,\r
- 'type' => $type,\r
- 'content' => &$content\r
- );\r
- $manager->notify("PreUpdate{$this->event_identifier}Part", $data);\r
- }\r
- else if( $skintypevalue )\r
- {\r
- $data = array(\r
- 'skinid' => $this->id,\r
- 'type' => $type,\r
- 'content' => &$content\r
- );\r
- $manager->notify("PreAdd{$this->event_identifier}Part", $data);\r
- }\r
- else if( $skintypeexists )\r
- {\r
- $data = array(\r
- 'skinid' => $this->id,\r
- 'type' => $type\r
- );\r
- $manager->notify("PreDelete{$this->event_identifier}Part", $data);\r
- }\r
- \r
- // delete old thingie\r
- $query = "DELETE FROM %s WHERE stype=%s and sdesc=%d;";\r
- $query = sprintf($query, sql_table('skin'), DB::quoteValue($type), (integer) $this->id);\r
- DB::execute($query);\r
- \r
- // write new thingie\r
- if ( $content )\r
- {\r
- $query = "INSERT INTO %s (scontent, stype, sdesc) VALUES (%s, %s, %d);";\r
- $query = sprintf($query, sql_table('skin'), DB::quoteValue($content), DB::quoteValue($type), (integer) $this->id);\r
- DB::execute($query);\r
- }\r
- \r
- if( $skintypevalue && $skintypeexists )\r
- {\r
- $data = array(\r
- 'skinid' => $this->id,\r
- 'type' => $type,\r
- 'content' => &$content\r
- );\r
- $manager->notify("PostUpdate{$this->event_identifier}Part", $data);\r
- }\r
- else if( $skintypevalue )\r
- {\r
- $data = array(\r
- 'skinid' => $this->id,\r
- 'type' => $type,\r
- 'content' => &$content\r
- );\r
- $manager->notify("PostAdd{$this->event_identifier}Part", $data);\r
- }\r
- else if( $skintypeexists )\r
- {\r
- $data = array(\r
- 'skinid' => $this->id,\r
- 'type' => $type\r
- );\r
- $manager->notify("PostDelete{$this->event_identifier}Part", $data);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Skin::deleteAllParts()\r
- * Deletes all skin parts from the database\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function deleteAllParts()\r
- {\r
- $query = "DELETE FROM %s WHERE sdesc=%d;";\r
- $query = sprintf($query, sql_table('skin'), (integer) $this->id);\r
- DB::execute($query);\r
- }\r
- \r
- /**\r
- * Skin::updateGeneralInfo()\r
- * Updates the general information about the skin\r
- * \r
- * @param string $name name of the skin\r
- * @param string $desc description of the skin\r
- * @param string $type type of the skin\r
- * @param string $includeMode include mode of the skin\r
- * @param string $includePrefix include prefix of the skin\r
- * @return void\r
- */\r
- public function updateGeneralInfo($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '')\r
- {\r
- $name = DB::quoteValue($name);\r
- $desc = DB::quoteValue($desc);\r
- $type = DB::quoteValue($type);\r
- $includeMode = DB::quoteValue($includeMode);\r
- $includePrefix = DB::quoteValue($includePrefix);\r
- \r
- $query ="UPDATE %s SET sdname=%s, sddesc=%s, sdtype=%s, sdincmode=%s, sdincpref=%s WHERE sdnumber=%d";\r
- $query = sprintf($query, sql_table('skin_desc'), $name, $desc, $type, $includeMode, $includePrefix, (integer) $this->id);\r
- \r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Skin::includeTranslation()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function includeTranslation()\r
- {\r
- global $DIR_SKINS;\r
- \r
- $locale = i18n::get_current_locale() . '.' . i18n::get_current_charset();\r
- \r
- if( $this->includeMode == "normal" )\r
- {\r
- $filename = "./locales/{$locale}.php";\r
- }\r
- else if( $this->includeMode == "skindir" )\r
- {\r
- if ( $this->includePrefix == '' )\r
- {\r
- $filename = "{$DIR_SKINS}locales/{$locale}.php";\r
- }\r
- else\r
- {\r
- $filename = "{$DIR_SKINS}{$this->includePrefix}locales/{$locale}.php";\r
- }\r
- }\r
- else\r
- {\r
- return;\r
- }\r
- \r
- if ( !file_exists($filename) )\r
- {\r
- return;\r
- }\r
- \r
- include_once($filename);\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Skin::getNormalTypes()\r
- * \r
- * @param string void\r
- * @return array default skin types\r
- */\r
- public function getNormalTypes()\r
- {\r
- return call_user_func(array($this->action_class, 'getNormalSkinTypes'));\r
- }\r
- \r
- /**\r
- * Skin::getAvailableTypes()\r
- * \r
- * @param string void\r
- * @return array registered skin types\r
- */\r
- public function getAvailableTypes()\r
- {\r
- $default_skintypes = $this->getNormalTypes();\r
- $query = "SELECT stype FROM %s WHERE sdesc=%d;";\r
- $query = sprintf($query, sql_table('skin'), (integer) $this->id);\r
- \r
- /* NOTE: force to put default types in the beginning */\r
- $in_default = array();\r
- $no_default = array();\r
- \r
- $res = DB::getResult($query);\r
- foreach ( $res as $row )\r
- {\r
- if ( !array_key_exists($row['stype'], $default_skintypes) )\r
- {\r
- $no_default[$row['stype']] = FALSE;\r
- }\r
- else\r
- {\r
- $in_default[$row['stype']] = $default_skintypes[$row['stype']];\r
- }\r
- }\r
- \r
- return array_merge($in_default, $no_default);\r
- }\r
- \r
- /**\r
- * Skin::getAllowedActionsForType()\r
- * Get the allowed actions for a skin type\r
- * returns an array with the allowed actions\r
- * @return array allowed action types\r
- * @param string $skintype type of the skin\r
- * @return array allowed action types\r
- */\r
- public function getAllowedActionsForType($skintype)\r
- {\r
- $handler = new $this->action_class($skintype);\r
- return $handler->getAvailableActions();\r
- }\r
- \r
-}\r
+ return;
+ }
+
+ /**
+ * Skin::getContentFromDB()
+ *
+ * @param string $skintype skin type
+ * @return string content for the skin type
+ */
+ public function getContentFromDB($skintype)
+ {
+ $query = "SELECT scontent FROM %s WHERE sdesc=%d and stype=%s;";
+ $query = sprintf($query, sql_table('skin'), (integer) $this->id, DB::quoteValue($skintype));
+ $res = DB::getValue($query);
+
+ return $res ? $res : '';
+ }
+
+ /**
+ * Skin::getContentFromFile()
+ *
+ * @param string $fullpath fullpath to the file to parse
+ * @return mixed file contents or FALSE
+ */
+ public function getContentFromFile($fullpath)
+ {
+ $fsize = filesize($fullpath);
+ if ( $fsize <= 0 )
+ {
+ return;
+ }
+
+ $fd = fopen ($fullpath, 'r');
+ if ( $fd === FALSE )
+ {
+ return FALSE;
+ }
+
+ $contents = fread ($fd, $fsize);
+ if ( $contents === FALSE )
+ {
+ return FALSE;
+ }
+
+ fclose ($fd);
+ return $contents;
+ }
+
+ /**
+ * SKIN::update()
+ * Updates the contents for one part of the skin in the database
+ *
+ * @param string $type type of the skin part (e.g. index, item, search ...)
+ * @param string $content new content for this skin part
+ * @return void
+ *
+ */
+ public function update($type, $content)
+ {
+ global $manager;
+
+ $query = "SELECT sdesc FROM %s WHERE stype=%s and sdesc=%d;";
+ $query = sprintf($query, sql_table('skin'), DB::quoteValue($type), (integer) $this->id);
+ $res = DB::getValue($query);
+
+ $skintypeexists = !empty($res);
+ $skintypevalue = !empty($content);
+
+ if( $skintypevalue && $skintypeexists )
+ {
+ $data = array(
+ 'skinid' => $this->id,
+ 'type' => $type,
+ 'content' => &$content
+ );
+ $manager->notify("PreUpdate{$this->event_identifier}Part", $data);
+ }
+ else if( $skintypevalue )
+ {
+ $data = array(
+ 'skinid' => $this->id,
+ 'type' => $type,
+ 'content' => &$content
+ );
+ $manager->notify("PreAdd{$this->event_identifier}Part", $data);
+ }
+ else if( $skintypeexists )
+ {
+ $data = array(
+ 'skinid' => $this->id,
+ 'type' => $type
+ );
+ $manager->notify("PreDelete{$this->event_identifier}Part", $data);
+ }
+
+ // delete old thingie
+ $query = "DELETE FROM %s WHERE stype=%s and sdesc=%d;";
+ $query = sprintf($query, sql_table('skin'), DB::quoteValue($type), (integer) $this->id);
+ DB::execute($query);
+
+ // write new thingie
+ if ( $content )
+ {
+ $query = "INSERT INTO %s (scontent, stype, sdesc) VALUES (%s, %s, %d);";
+ $query = sprintf($query, sql_table('skin'), DB::quoteValue($content), DB::quoteValue($type), (integer) $this->id);
+ DB::execute($query);
+ }
+
+ if( $skintypevalue && $skintypeexists )
+ {
+ $data = array(
+ 'skinid' => $this->id,
+ 'type' => $type,
+ 'content' => &$content
+ );
+ $manager->notify("PostUpdate{$this->event_identifier}Part", $data);
+ }
+ else if( $skintypevalue )
+ {
+ $data = array(
+ 'skinid' => $this->id,
+ 'type' => $type,
+ 'content' => &$content
+ );
+ $manager->notify("PostAdd{$this->event_identifier}Part", $data);
+ }
+ else if( $skintypeexists )
+ {
+ $data = array(
+ 'skinid' => $this->id,
+ 'type' => $type
+ );
+ $manager->notify("PostDelete{$this->event_identifier}Part", $data);
+ }
+ return;
+ }
+
+ /**
+ * Skin::deleteAllParts()
+ * Deletes all skin parts from the database
+ *
+ * @param void
+ * @return void
+ */
+ public function deleteAllParts()
+ {
+ $query = "DELETE FROM %s WHERE sdesc=%d;";
+ $query = sprintf($query, sql_table('skin'), (integer) $this->id);
+ DB::execute($query);
+ }
+
+ /**
+ * Skin::updateGeneralInfo()
+ * Updates the general information about the skin
+ *
+ * @param string $name name of the skin
+ * @param string $desc description of the skin
+ * @param string $type type of the skin
+ * @param string $includeMode include mode of the skin
+ * @param string $includePrefix include prefix of the skin
+ * @return void
+ */
+ public function updateGeneralInfo($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '')
+ {
+ $name = DB::quoteValue($name);
+ $desc = DB::quoteValue($desc);
+ $type = DB::quoteValue($type);
+ $includeMode = DB::quoteValue($includeMode);
+ $includePrefix = DB::quoteValue($includePrefix);
+
+ $query ="UPDATE %s SET sdname=%s, sddesc=%s, sdtype=%s, sdincmode=%s, sdincpref=%s WHERE sdnumber=%d";
+ $query = sprintf($query, sql_table('skin_desc'), $name, $desc, $type, $includeMode, $includePrefix, (integer) $this->id);
+
+ DB::execute($query);
+ return;
+ }
+
+ /**
+ * Skin::includeTranslation()
+ *
+ * @param void
+ * @return void
+ */
+ private function includeTranslation()
+ {
+ global $DIR_SKINS;
+
+ $locale = i18n::get_current_locale() . '.' . i18n::get_current_charset();
+
+ if( $this->includeMode == "normal" )
+ {
+ $filename = "./locales/{$locale}.php";
+ }
+ else if( $this->includeMode == "skindir" )
+ {
+ if ( $this->includePrefix == '' )
+ {
+ $filename = "{$DIR_SKINS}locales/{$locale}.php";
+ }
+ else
+ {
+ $filename = "{$DIR_SKINS}{$this->includePrefix}locales/{$locale}.php";
+ }
+ }
+ else
+ {
+ return;
+ }
+
+ if ( !file_exists($filename) )
+ {
+ return;
+ }
+
+ include_once($filename);
+
+ return;
+ }
+
+ /**
+ * Skin::getNormalTypes()
+ *
+ * @param string void
+ * @return array default skin types
+ */
+ public function getNormalTypes()
+ {
+ return call_user_func(array($this->action_class, 'getNormalSkinTypes'));
+ }
+
+ /**
+ * Skin::getAvailableTypes()
+ *
+ * @param string void
+ * @return array registered skin types
+ */
+ public function getAvailableTypes()
+ {
+ $default_skintypes = $this->getNormalTypes();
+ $query = "SELECT stype FROM %s WHERE sdesc=%d;";
+ $query = sprintf($query, sql_table('skin'), (integer) $this->id);
+
+ /* NOTE: force to put default types in the beginning */
+ $in_default = array();
+ $no_default = array();
+
+ $res = DB::getResult($query);
+ foreach ( $res as $row )
+ {
+ if ( !array_key_exists($row['stype'], $default_skintypes) )
+ {
+ $no_default[$row['stype']] = FALSE;
+ }
+ else
+ {
+ $in_default[$row['stype']] = $default_skintypes[$row['stype']];
+ }
+ }
+
+ return array_merge($in_default, $no_default);
+ }
+
+ /**
+ * Skin::getAllowedActionsForType()
+ * Get the allowed actions for a skin type
+ * returns an array with the allowed actions
+ * @return array allowed action types
+ * @param string $skintype type of the skin
+ * @return array allowed action types
+ */
+ public function getAllowedActionsForType($skintype)
+ {
+ $handler = new $this->action_class($skintype);
+ return $handler->getAvailableActions();
+ }
+
+}
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * A class representing a template\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: TEMPLATE.php 1726 2012-04-07 02:23:46Z sakamocchi $\r
- */\r
-class Template\r
-{\r
- /**\r
- * Template::$id\r
- */\r
- private $id;\r
- \r
- /**\r
- * Template::__construct()\r
- * \r
- * @param integer $templateid id for template\r
- * @return void\r
- */\r
- public function __construct($templateid)\r
- {\r
- $this->id = intval($templateid);\r
- return;\r
- }\r
- \r
- /**\r
- * Template::getID()\r
- * \r
- * @param void\r
- * @return integer id for this instance of Template class\r
- */\r
- public function getID()\r
- {\r
- return (integer) $this->id;\r
- }\r
- \r
- /**\r
- * Template::createFromName()\r
- * \r
- * @statc\r
- * @param string $name template name\r
- * @return object instance of Template class generated by the name\r
- */\r
- static public function createFromName($name)\r
- {\r
- return new Template(Template::getIdFromName($name));\r
- }\r
- \r
- /**\r
- * Template::getIdFromName()\r
- * \r
- * @static\r
- * @param string $name template name\r
- * @return integer id for the template\r
- */\r
- static public function getIdFromName($name)\r
- {\r
- $name = DB::quoteValue($name);\r
- $query = "SELECT tdnumber FROM %s WHERE tdname=%s";\r
- $query = sprintf($query, sql_table('template_desc'), $name);\r
- return DB::getValue($query);\r
- }\r
- \r
- /**\r
- * Template::updateGeneralInfo()\r
- * Updates the general information about the template\r
- * \r
- * @param string $name template name\r
- * @param string $desc description for this template\r
- * @return void\r
- */\r
- public function updateGeneralInfo($name, $desc)\r
- {\r
- $query = "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d";\r
- $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $this->getID());\r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Template::update()\r
- * Updates the contents of one part of the template\r
- * \r
- * @param String $type value for nucleus_template.tpartname\r
- * @param String $content value for nucleus_template.tcontent\r
- * @return Void\r
- */\r
- public function update($type, $content)\r
- {\r
- // delete old thingie\r
- $query = "DELETE FROM %s WHERE tpartname=%s and tdesc=%d";\r
- $query = sprintf($query, sql_table('template'), DB::quoteValue($type), (integer) $this->getID());\r
- DB::execute($query);\r
- \r
- // write new thingie\r
- if ( $content )\r
- {\r
- $query = "INSERT INTO %s (tcontent, tpartname, tdesc) VALUES (%s, %s, %d)";\r
- $query = sprintf($query, sql_table('template'), DB::quoteValue($content), DB::quoteValue($type), (integer) $this->getID());\r
- DB::execute($query);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Template::deleteAllParts()\r
- * Deletes all template parts from the database\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function deleteAllParts()\r
- {\r
- $query = "DELETE FROM %s WHERE tdesc=%d";\r
- $query = sprintf($query, sql_table('template'), (integer) $this->getID());\r
- DB::execute($query);\r
- return;\r
- }\r
- \r
- /**\r
- * Template::createNew()\r
- * Creates a new template\r
- *\r
- * @static\r
- * @param string $name name for new template\r
- * @param string $desc description for new template\r
- * @return integer id for new template\r
- */\r
- static public function createNew($name, $desc)\r
- {\r
- global $manager;\r
- \r
- $manager->notify(\r
- 'PreAddTemplate',\r
- array(\r
- 'name' => &$name,\r
- 'description' => &$desc\r
- )\r
- );\r
- \r
- DB::execute('INSERT INTO '.sql_table('template_desc').' (tdname, tddesc) VALUES (' . DB::quoteValue($name) . ',' . DB::quoteValue($desc) . ')');\r
- $newId = DB::getInsertId();\r
- \r
- $manager->notify(\r
- 'PostAddTemplate',\r
- array(\r
- 'templateid' => $newId,\r
- 'name' => $name,\r
- 'description' => $desc\r
- )\r
- );\r
- \r
- return $newId;\r
- }\r
- \r
- /**\r
- * Reads a template and returns an array with the parts.\r
- *\r
- * @static\r
- * @param string $name name of the template file\r
- * @return array template array\r
- */\r
- static public function read($name)\r
- {\r
- global $manager;\r
- $manager->notify(\r
- 'PreTemplateRead',\r
- array(\r
- 'template' => &$name\r
- )\r
- );\r
- \r
- $query = "SELECT tpartname, tcontent FROM %s, %s WHERE tdesc=tdnumber and tdname=%s";\r
- $query = sprintf($query, sql_table('template_desc'), sql_table('template'), DB::quoteValue($name));\r
- $res = DB::getResult($query);\r
-\r
- $template = array();\r
- foreach ( $res as $row )\r
- {\r
- $template[$row['tpartname']] = $row['tcontent'];\r
- }\r
- \r
- /*\r
- * TODO: this is appropriate or not?\r
- */\r
- if ( array_key_exists('LOCALE', $template) && !empty($template['LOCALE']) )\r
- {\r
- setlocale(LC_TIME, $template['LOCALE']);\r
- }\r
- else\r
- {\r
- setlocale(LC_TIME,'');\r
- }\r
- \r
- return $template;\r
- }\r
- \r
- /**\r
- * fills a template with values\r
- * \r
- * @static\r
- * @param string $template Template to be used\r
- * @param array $values Array of all the values\r
- * @return string string filled with tag contents\r
- */\r
- static public function fill($template, $values)\r
- {\r
- \r
- if ( sizeof($values) != 0 )\r
- {\r
- foreach ( $values as $key => $value )\r
- {\r
- $template = preg_replace('#<%' . preg_quote($key, '#') . '%>#', $value, $template);\r
- }\r
- }\r
- \r
- // remove non matched template-tags\r
- return preg_replace('#<%([a-zA-Z]+)?%>#', '', $template);\r
- }\r
- \r
- /**\r
- * Template::exists()\r
- * returns true if there is a template with the given shortname\r
- * \r
- * @static\r
- * @param string $name template name\r
- * @return boolean exists or not\r
- */\r
- static public function exists($name)\r
- {\r
- $query = "SELECT * FROM %s WHERE tdname=%s";\r
- $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name));\r
- $r = DB::getResult($query);\r
- return ($r->rowCount() != 0);\r
- }\r
- \r
- /**\r
- * Template::existsID()\r
- * returns true if there is a template with the given ID\r
- * \r
- * @static\r
- * @param integer $id id for template\r
- * @return bookean exists or not\r
- */\r
- static public function existsID($id)\r
- {\r
- $query = "SELECT * FROM %s WHERE tdnumber=%d";\r
- $query = sprintf($query, sql_table('template_desc'), (integer) $id);\r
- $r = DB::getResult($query);\r
- return ($r->rowCount() != 0);\r
- }\r
- \r
- /**\r
- * Template::getNameFromId()\r
- * \r
- * @static\r
- * @param integer $id id for template\r
- * @return object sql object\r
- */\r
- static public function getNameFromId($id)\r
- {\r
- $query = "SELECT tdname as result FROM %s WHERE tdnumber=%d";\r
- $query = sprintf($query, sql_table('template_desc'), (integer) $id);\r
- return DB::getValue($query);\r
- }\r
- \r
- /**\r
- * Template::getDesc()\r
- * \r
- * @static\r
- * @param integer $id id for template\r
- * @return string description for the template\r
- */\r
- static public function getDesc($id)\r
- {\r
- $query = "SELECT tddesc FROM %s WHERE tdnumber=%d";\r
- $query = sprintf($query, sql_table('template_desc'), (integer) $id);\r
- return DB::getValue($query);\r
- }\r
-}\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * A class representing a template
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: TEMPLATE.php 1880 2012-06-17 07:48:14Z sakamocchi $
+ */
+class Template
+{
+ /**
+ * Template::$id
+ */
+ private $id;
+
+ /**
+ * Template::__construct()
+ *
+ * @param integer $templateid id for template
+ * @return void
+ */
+ public function __construct($templateid)
+ {
+ $this->id = intval($templateid);
+ return;
+ }
+
+ /**
+ * Template::getID()
+ *
+ * @param void
+ * @return integer id for this instance of Template class
+ */
+ public function getID()
+ {
+ return (integer) $this->id;
+ }
+
+ /**
+ * Template::createFromName()
+ *
+ * @statc
+ * @param string $name template name
+ * @return object instance of Template class generated by the name
+ */
+ static public function createFromName($name)
+ {
+ return new Template(Template::getIdFromName($name));
+ }
+
+ /**
+ * Template::getIdFromName()
+ *
+ * @static
+ * @param string $name template name
+ * @return integer id for the template
+ */
+ static public function getIdFromName($name)
+ {
+ $name = DB::quoteValue($name);
+ $query = "SELECT tdnumber FROM %s WHERE tdname=%s";
+ $query = sprintf($query, sql_table('template_desc'), $name);
+ return DB::getValue($query);
+ }
+
+ /**
+ * Template::updateGeneralInfo()
+ * Updates the general information about the template
+ *
+ * @param string $name template name
+ * @param string $desc description for this template
+ * @return void
+ */
+ public function updateGeneralInfo($name, $desc)
+ {
+ $query = "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d";
+ $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $this->getID());
+ DB::execute($query);
+ return;
+ }
+
+ /**
+ * Template::update()
+ * Updates the contents of one part of the template
+ *
+ * @param String $type value for nucleus_template.tpartname
+ * @param String $content value for nucleus_template.tcontent
+ * @return Void
+ */
+ public function update($type, $content)
+ {
+ // delete old thingie
+ $query = "DELETE FROM %s WHERE tpartname=%s and tdesc=%d";
+ $query = sprintf($query, sql_table('template'), DB::quoteValue($type), (integer) $this->getID());
+ DB::execute($query);
+
+ // write new thingie
+ if ( $content )
+ {
+ $query = "INSERT INTO %s (tcontent, tpartname, tdesc) VALUES (%s, %s, %d)";
+ $query = sprintf($query, sql_table('template'), DB::quoteValue($content), DB::quoteValue($type), (integer) $this->getID());
+ DB::execute($query);
+ }
+ return;
+ }
+
+ /**
+ * Template::deleteAllParts()
+ * Deletes all template parts from the database
+ *
+ * @param void
+ * @return void
+ */
+ public function deleteAllParts()
+ {
+ $query = "DELETE FROM %s WHERE tdesc=%d";
+ $query = sprintf($query, sql_table('template'), (integer) $this->getID());
+ DB::execute($query);
+ return;
+ }
+
+ /**
+ * Template::createNew()
+ * Creates a new template
+ *
+ * @static
+ * @param string $name name for new template
+ * @param string $desc description for new template
+ * @return integer id for new template
+ */
+ static public function createNew($name, $desc)
+ {
+ global $manager;
+
+ $manager->notify(
+ 'PreAddTemplate',
+ array(
+ 'name' => &$name,
+ 'description' => &$desc
+ )
+ );
+
+ DB::execute('INSERT INTO '.sql_table('template_desc').' (tdname, tddesc) VALUES (' . DB::quoteValue($name) . ',' . DB::quoteValue($desc) . ')');
+ $newId = DB::getInsertId();
+
+ $manager->notify(
+ 'PostAddTemplate',
+ array(
+ 'templateid' => $newId,
+ 'name' => $name,
+ 'description' => $desc
+ )
+ );
+
+ return $newId;
+ }
+
+ /**
+ * Reads a template and returns an array with the parts.
+ *
+ * @static
+ * @param string $name name of the template file
+ * @return array template array
+ */
+ static public function read($name)
+ {
+ global $manager;
+ $manager->notify(
+ 'PreTemplateRead',
+ array(
+ 'template' => &$name
+ )
+ );
+
+ $query = "SELECT tpartname, tcontent FROM %s, %s WHERE tdesc=tdnumber and tdname=%s";
+ $query = sprintf($query, sql_table('template_desc'), sql_table('template'), DB::quoteValue($name));
+ $res = DB::getResult($query);
+
+ $template = array();
+ foreach ( $res as $row )
+ {
+ $template[$row['tpartname']] = $row['tcontent'];
+ }
+
+ /*
+ * TODO: this is appropriate or not?
+ */
+ if ( array_key_exists('LOCALE', $template) && !empty($template['LOCALE']) )
+ {
+ setlocale(LC_TIME, $template['LOCALE']);
+ }
+ else
+ {
+ setlocale(LC_TIME,'');
+ }
+
+ return $template;
+ }
+
+ /**
+ * fills a template with values
+ *
+ * @static
+ * @param string $template Template to be used
+ * @param array $values Array of all the values
+ * @return string string filled with tag contents
+ */
+ static public function fill($template, $values)
+ {
+
+ if ( sizeof($values) != 0 )
+ {
+ foreach ( $values as $key => $value )
+ {
+ $template = preg_replace('#<%' . preg_quote($key, '#') . '%>#', $value, $template);
+ }
+ }
+
+ // remove non matched template-tags
+ return preg_replace('#<%([a-zA-Z]+)?%>#', '', $template);
+ }
+
+ /**
+ * Template::exists()
+ * returns true if there is a template with the given shortname
+ *
+ * @static
+ * @param string $name template name
+ * @return boolean exists or not
+ */
+ static public function exists($name)
+ {
+ $query = "SELECT * FROM %s WHERE tdname=%s";
+ $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name));
+ $r = DB::getResult($query);
+ return ($r->rowCount() != 0);
+ }
+
+ /**
+ * Template::existsID()
+ * returns true if there is a template with the given ID
+ *
+ * @static
+ * @param integer $id id for template
+ * @return bookean exists or not
+ */
+ static public function existsID($id)
+ {
+ $query = "SELECT * FROM %s WHERE tdnumber=%d";
+ $query = sprintf($query, sql_table('template_desc'), (integer) $id);
+ $r = DB::getResult($query);
+ return ($r->rowCount() != 0);
+ }
+
+ /**
+ * Template::getNameFromId()
+ *
+ * @static
+ * @param integer $id id for template
+ * @return object sql object
+ */
+ static public function getNameFromId($id)
+ {
+ $query = "SELECT tdname as result FROM %s WHERE tdnumber=%d";
+ $query = sprintf($query, sql_table('template_desc'), (integer) $id);
+ return DB::getValue($query);
+ }
+
+ /**
+ * Template::getDesc()
+ *
+ * @static
+ * @param integer $id id for template
+ * @return string description for the template
+ */
+ static public function getDesc($id)
+ {
+ $query = "SELECT tddesc FROM %s WHERE tdnumber=%d";
+ $query = sprintf($query, sql_table('template_desc'), (integer) $id);
+ return DB::getValue($query);
+ }
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Scripts to create/restore a backup of the Nucleus database\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: backup.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
- */\r
-\r
-class Backup\r
-{\r
- /**\r
- * Backup::Backup()\r
- * Constructor, just for compatibility\r
- *\r
- * @deprecated\r
- * @param void\r
- * @return void\r
- *\r
- */\r
- public function Backup()\r
- {\r
- return;\r
- }\r
-\r
- /**\r
- * Backup::do_backup()\r
- * This function creates an sql dump of the database and sends it to\r
- * the user as a file (can be gzipped if they want)\r
- *\r
- * NOTE: this remains not-static for compatibility\r
- *\r
- * @param boolean $gzip 1 = compress backup file, 0 = no compression (default)\r
- * @return void\r
- *\r
- */\r
- public function do_backup($gzip = 0)\r
- {\r
- global $manager, $nucleus;\r
-\r
- // tables of which backup is needed\r
- $tables = array(\r
- sql_table('actionlog'),\r
- sql_table('ban'),\r
- sql_table('blog'),\r
- sql_table('comment'),\r
- sql_table('config'),\r
- sql_table('item'),\r
- sql_table('karma'),\r
- sql_table('member'),\r
- sql_table('skin'),\r
- sql_table('skin_desc'),\r
- sql_table('team'),\r
- sql_table('template'),\r
- sql_table('template_desc'),\r
- sql_table('plugin'),\r
- sql_table('plugin_event'),\r
- sql_table('plugin_option'),\r
- sql_table('plugin_option_desc'),\r
- sql_table('category'),\r
- sql_table('activation'),\r
- sql_table('tickets'),\r
- );\r
-\r
- // add tables that plugins want to backup to the list\r
- // catch all output generated by plugins\r
- ob_start();\r
- $query = sprintf('SELECT pfile FROM %s', sql_table('plugin'));\r
- $res = DB::getResult($query);\r
- foreach ( $res as $row )\r
- {\r
- $plug =& $manager->getPlugin($row['pfile']);\r
- if ( $plug )\r
- {\r
- $tables = array_merge($tables, (array) $plug->getTableList());\r
- }\r
- }\r
- ob_end_clean();\r
-\r
- // remove duplicates\r
- $tables = array_unique($tables);\r
-\r
- // make sure browsers don't cache the backup\r
- header("Pragma: no-cache");\r
-\r
- // don't allow gzip compression when extension is not loaded\r
- if ( ($gzip != 0) && !extension_loaded("zlib") )\r
- {\r
- $gzip = 0;\r
- }\r
-\r
- if ( !$gzip )\r
- {\r
- $filename = 'nucleus_db_backup_' . i18n::formatted_datetime('%Y-%m-%d-%H-%M-%S', time()) . ".sql";\r
- }\r
- else\r
- {\r
- // use an output buffer\r
- @ob_start();\r
- @ob_implicit_flush(0);\r
-\r
- // set filename\r
- $filename = 'nucleus_db_backup_' . i18n::formatted_datetime('%Y-%m-%d-%H-%M-%S', time()) . ".sql.gz";\r
- }\r
-\r
- // send headers that tell the browser a file is coming\r
- header("Content-Type: text/x-delimtext; name=\"$filename\"");\r
- header("Content-disposition: attachment; filename=$filename");\r
-\r
- // dump header\r
- echo "/*\n";\r
- echo " * This is a backup file generated by Nucleus \n";\r
- echo " * http://www.nucleuscms.org/\n";\r
- echo " * \n";\r
- echo " * backup-date: " . i18n::formatted_datetime('rfc822GMT', time()) . "\n";\r
- echo " * Nucleus CMS version: " . $nucleus['version'] . "\n";\r
- echo " * \n";\r
- echo " * WARNING: Only try to restore on servers running the exact same version of Nucleus\n";\r
- echo " */\n";\r
-\r
- // dump all tables\r
- reset($tables);\r
- array_walk($tables, array(__CLASS__, 'dump_table'));\r
-\r
- if ( $gzip )\r
- {\r
- $Size = ob_get_length();\r
- $Crc = crc32(ob_get_contents());\r
- $contents = gzcompress(ob_get_contents());\r
- ob_end_clean();\r
- echo "\x1f\x8b\x08\x00\x00\x00\x00\x00" . substr($contents, 0, strlen($contents) - 4)\r
- . self::gzip_print_four_characters($Crc) . self::gzip_print_four_characters($Size);\r
- }\r
- exit;\r
- }\r
-\r
- /**\r
- * Backup::dump_table()\r
- * Creates a dump for a single table\r
- * ($tablename and $key are filled in by array_walk)\r
- *\r
- * @static\r
- * @param string $tablename\r
- * @param string $key\r
- */\r
- static private function dump_table($tablename, $key)\r
- {\r
- echo "/*\n";\r
- echo " * TABLE: " . $tablename . "\n";\r
- echo " */\n";\r
-\r
- // dump table structure\r
- self::dump_structure($tablename);\r
-\r
- // dump table contents\r
- self::dump_contents($tablename);\r
- return;\r
- }\r
-\r
- /**\r
- * Backup::dump_structure()\r
- * Creates a dump of the table structure for one table\r
- *\r
- * @static\r
- * @param string $tablename\r
- * @return void\r
- *\r
- */\r
- static private function dump_structure($tablename)\r
- {\r
- // add command to drop table on restore\r
- echo "DROP TABLE IF EXISTS {$tablename};\n\n";\r
- $result = DB::getRow("SHOW CREATE TABLE {$tablename}");\r
- echo $result['Create Table'];\r
- echo ";\n\n";\r
- return;\r
- }\r
-\r
- /**\r
- * Backup::get_field_names()\r
- * Returns the field named for the given table in the\r
- * following format:\r
- * (column1, column2, ..., columnn)\r
- *\r
- * @static\r
- * @param resource $result\r
- * @param integer $num_fields\r
- * @return string\r
- */\r
- static private function get_field_names($result, $num_fields)\r
- {\r
- $fields = array();\r
- for ( $j = 0; $j < $num_fields; $j++ )\r
- {\r
- $col = $result->getColumnMeta($j);\r
- $fields[] = $col['name'];\r
- }\r
-\r
- return '(' . implode(', ', $fields) . ')';\r
- }\r
-\r
- /**\r
- * Backup::dump_contents()\r
- * Creates a dump of the table content for one table\r
- *\r
- * @static\r
- * @param string $tablename\r
- * @return void\r
- *\r
- */\r
- static private function dump_contents($tablename)\r
- {\r
- /*\r
- * Grab the data from the table.\r
- */\r
- $result = DB::getResult("SELECT * FROM $tablename");\r
-\r
- if ( $result->rowCount() > 0 )\r
- {\r
- echo "\n";\r
- echo "/*\n";\r
- echo " * Table Data for {$tablename}\n";\r
- echo " */\n";\r
- }\r
-\r
- $num_fields = $result->columnCount();\r
-\r
- /*\r
- * Compose fieldname list\r
- */\r
- $tablename_list = self::get_field_names($result, $num_fields);\r
-\r
- /*\r
- * Loop through the resulting rows and build the sql statement.\r
- */\r
- foreach ( $result as $row )\r
- {\r
- // Start building the SQL statement.\r
- echo 'INSERT INTO ' . $tablename . ' ' . $tablename_list . ' VALUES(';\r
-\r
- // Loop through the rows and fill in data for each column\r
- for ( $j = 0; $j < $num_fields; $j++ )\r
- {\r
- if ( !isset($row[$j]) )\r
- {\r
- // no data for column\r
- echo ' NULL';\r
- }\r
- elseif ( $row[$j] != '' )\r
- {\r
- // data\r
- echo ' ' . DB::quoteValue($row[$j]);\r
- }\r
- else\r
- {\r
- // empty column (!= no data!)\r
- echo "''";\r
- }\r
-\r
- // only add comma when not last column\r
- if ( $j != ($num_fields - 1) )\r
- {\r
- echo ',';\r
- }\r
- }\r
- echo ");\n";\r
- }\r
- echo "\n";\r
- return;\r
- }\r
-\r
- /**\r
- * Backup::gzip_print_four_characters()\r
- *\r
- * @static\r
- * @param integer $val\r
- * @return integer\r
- */\r
- static private function gzip_print_four_characters($Val)\r
- {\r
- for ( $i = 0; $i < 4; $i ++ )\r
- {\r
- $return .= chr($Val % 256);\r
- $Val = floor($Val / 256);\r
- }\r
- return $return;\r
- }\r
-\r
- /**\r
- * Backup::do_restore()\r
- * Restores a database backup\r
- *\r
- * NOTE: this remains not-static for compatibility\r
- *\r
- * @param void\r
- * @return void\r
- */\r
- public function do_restore()\r
- {\r
- $uploadInfo = postFileInfo('backup_file');\r
-\r
- // first of all: get uploaded file:\r
- if ( array_key_exists('name', $uploadInfo) && empty($uploadInfo['name']) )\r
- {\r
- return 'No file uploaded';\r
- }\r
- if ( !is_uploaded_file($uploadInfo['tmp_name']) )\r
- {\r
- return 'No file uploaded';\r
- }\r
-\r
- $backup_file_name = $uploadInfo['name'];\r
- $backup_file_tmpname = $uploadInfo['tmp_name'];\r
- $backup_file_type = $uploadInfo['type'];\r
-\r
- if ( !file_exists($backup_file_tmpname) )\r
- {\r
- return 'File Upload Error';\r
- }\r
-\r
- if ( !preg_match("#^(text/[a-zA-Z]+)|(application/(x\-)?gzip(\-compressed)?)|(application/octet-stream)$#i", $backup_file_type) )\r
- {\r
- return 'The uploaded file is not of the correct type';\r
- }\r
-\r
- $gzip = 0;\r
- if ( preg_match("#\.gz#i", $backup_file_name) )\r
- {\r
- $gzip = 1;\r
- }\r
-\r
- if ( !extension_loaded("zlib") && $gzip )\r
- {\r
- return 'Cannot decompress gzipped backup (zlib package not installed)';\r
- }\r
-\r
- // get sql query according to gzip setting (either decompress, or not)\r
- $contents = self::get_contents($backup_file_tmpname, $gzip);\r
- if ( $contents == '' )\r
- {\r
- return 'Cannot get contents from this file.';\r
- }\r
-\r
- /* detect lines */\r
- $lines = preg_split('/[\r\n]/', $contents);\r
- if( $lines === $contents )\r
- {\r
- return 'Cannot parse contents from this file';\r
- }\r
-\r
- /* get sql statements from each lines */\r
- $queries = self::get_queries($lines);\r
- if ( $queries === array() )\r
- {\r
- return "Cannot get SQL queries from this file.";\r
- }\r
-\r
- /* execute sql statements */\r
- foreach ( $queries as $query )\r
- {\r
- if ( DB::execute($query) === FALSE )\r
- {\r
- $error = DB::getError();\r
- debug('SQL Error: ' . $error[2]);\r
- break;\r
- }\r
- continue;\r
- }\r
- return;\r
- }\r
-\r
- static private function get_contents($temporary_name, $gzip = 0)\r
- {\r
- $contents = '';\r
- if ( $gzip )\r
- {\r
- // decompress and read\r
- $gz_ptr = gzopen($temporary_name, 'rb');\r
- while ( !gzeof($gz_ptr) )\r
- {\r
- $contents .= gzgets($gz_ptr, 100000);\r
- }\r
- }\r
- else\r
- {\r
- // just read\r
- $fsize = filesize($temporary_name);\r
- if ( $fsize > 0 )\r
- {\r
- $contents = fread(fopen($temporary_name, 'r'), $fsize);\r
- }\r
- }\r
- return $contents;\r
- }\r
-\r
- static private function get_queries($lines)\r
- {\r
- $query = '';\r
- $queries = array();\r
- foreach ( $lines as $line )\r
- {\r
- $line = trim($line);\r
- if ( !$line || $line[0] == '#' || preg_match('#^[\s|/]?\*#', $line) )\r
- {\r
- continue;\r
- }\r
-\r
- if ( preg_match('/^(.*);$/', $line, $matches) === 0 )\r
- {\r
- $query .= $line;\r
- }\r
- else\r
- {\r
- $query .= $matches[1];\r
- $queries[] = $query;\r
- $query = '';\r
- }\r
- continue;\r
- }\r
- return $queries;\r
- }\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Scripts to create/restore a backup of the Nucleus database
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: backup.php 1812 2012-05-01 14:59:07Z sakamocchi $
+ */
+
+class Backup
+{
+ /**
+ * Backup::Backup()
+ * Constructor, just for compatibility
+ *
+ * @deprecated
+ * @param void
+ * @return void
+ *
+ */
+ public function Backup()
+ {
+ return;
+ }
+
+ /**
+ * Backup::do_backup()
+ * This function creates an sql dump of the database and sends it to
+ * the user as a file (can be gzipped if they want)
+ *
+ * NOTE: this remains not-static for compatibility
+ *
+ * @param boolean $gzip 1 = compress backup file, 0 = no compression (default)
+ * @return void
+ *
+ */
+ public function do_backup($gzip = 0)
+ {
+ global $manager, $nucleus;
+
+ // tables of which backup is needed
+ $tables = array(
+ sql_table('actionlog'),
+ sql_table('ban'),
+ sql_table('blog'),
+ sql_table('comment'),
+ sql_table('config'),
+ sql_table('item'),
+ sql_table('karma'),
+ sql_table('member'),
+ sql_table('skin'),
+ sql_table('skin_desc'),
+ sql_table('team'),
+ sql_table('template'),
+ sql_table('template_desc'),
+ sql_table('plugin'),
+ sql_table('plugin_event'),
+ sql_table('plugin_option'),
+ sql_table('plugin_option_desc'),
+ sql_table('category'),
+ sql_table('activation'),
+ sql_table('tickets'),
+ );
+
+ // add tables that plugins want to backup to the list
+ // catch all output generated by plugins
+ ob_start();
+ $query = sprintf('SELECT pfile FROM %s', sql_table('plugin'));
+ $res = DB::getResult($query);
+ foreach ( $res as $row )
+ {
+ $plug =& $manager->getPlugin($row['pfile']);
+ if ( $plug )
+ {
+ $tables = array_merge($tables, (array) $plug->getTableList());
+ }
+ }
+ ob_end_clean();
+
+ // remove duplicates
+ $tables = array_unique($tables);
+
+ // make sure browsers don't cache the backup
+ header("Pragma: no-cache");
+
+ // don't allow gzip compression when extension is not loaded
+ if ( ($gzip != 0) && !extension_loaded("zlib") )
+ {
+ $gzip = 0;
+ }
+
+ if ( !$gzip )
+ {
+ $filename = 'nucleus_db_backup_' . i18n::formatted_datetime('%Y-%m-%d-%H-%M-%S', time()) . ".sql";
+ }
+ else
+ {
+ // use an output buffer
+ @ob_start();
+ @ob_implicit_flush(0);
+
+ // set filename
+ $filename = 'nucleus_db_backup_' . i18n::formatted_datetime('%Y-%m-%d-%H-%M-%S', time()) . ".sql.gz";
+ }
+
+ // send headers that tell the browser a file is coming
+ header("Content-Type: text/x-delimtext; name=\"$filename\"");
+ header("Content-disposition: attachment; filename=$filename");
+
+ // dump header
+ echo "/*\n";
+ echo " * This is a backup file generated by Nucleus \n";
+ echo " * http://www.nucleuscms.org/\n";
+ echo " * \n";
+ echo " * backup-date: " . i18n::formatted_datetime('rfc822GMT', time()) . "\n";
+ echo " * Nucleus CMS version: " . $nucleus['version'] . "\n";
+ echo " * \n";
+ echo " * WARNING: Only try to restore on servers running the exact same version of Nucleus\n";
+ echo " */\n";
+
+ // dump all tables
+ reset($tables);
+ /* NOTE: hope to use 'self' keyword here but works bad so here use __CLASS__ macro. */
+ array_walk($tables, array(__CLASS__, 'dump_table'));
+
+ if ( $gzip )
+ {
+ $Size = ob_get_length();
+ $Crc = crc32(ob_get_contents());
+ $contents = gzcompress(ob_get_contents());
+ ob_end_clean();
+ echo "\x1f\x8b\x08\x00\x00\x00\x00\x00" . substr($contents, 0, strlen($contents) - 4)
+ . self::gzip_print_four_characters($Crc) . self::gzip_print_four_characters($Size);
+ }
+ exit;
+ }
+
+ /**
+ * Backup::dump_table()
+ * Creates a dump for a single table
+ * ($tablename and $key are filled in by array_walk)
+ *
+ * @static
+ * @param string $tablename
+ * @param string $key
+ */
+ static private function dump_table($tablename, $key)
+ {
+ echo "/*\n";
+ echo " * TABLE: " . $tablename . "\n";
+ echo " */\n";
+
+ // dump table structure
+ self::dump_structure($tablename);
+
+ // dump table contents
+ self::dump_contents($tablename);
+ return;
+ }
+
+ /**
+ * Backup::dump_structure()
+ * Creates a dump of the table structure for one table
+ *
+ * @static
+ * @param string $tablename
+ * @return void
+ *
+ */
+ static private function dump_structure($tablename)
+ {
+ // add command to drop table on restore
+ echo "DROP TABLE IF EXISTS {$tablename};\n\n";
+ $result = DB::getRow("SHOW CREATE TABLE {$tablename}");
+ echo $result['Create Table'];
+ echo ";\n\n";
+ return;
+ }
+
+ /**
+ * Backup::get_field_names()
+ * Returns the field named for the given table in the
+ * following format:
+ * (column1, column2, ..., columnn)
+ *
+ * @static
+ * @param resource $result
+ * @param integer $num_fields
+ * @return string
+ */
+ static private function get_field_names($result, $num_fields)
+ {
+ $fields = array();
+ for ( $j = 0; $j < $num_fields; $j++ )
+ {
+ $col = $result->getColumnMeta($j);
+ $fields[] = $col['name'];
+ }
+
+ return '(' . implode(', ', $fields) . ')';
+ }
+
+ /**
+ * Backup::dump_contents()
+ * Creates a dump of the table content for one table
+ *
+ * @static
+ * @param string $tablename
+ * @return void
+ *
+ */
+ static private function dump_contents($tablename)
+ {
+ /*
+ * Grab the data from the table.
+ */
+ $result = DB::getResult("SELECT * FROM $tablename");
+
+ if ( $result->rowCount() > 0 )
+ {
+ echo "\n";
+ echo "/*\n";
+ echo " * Table Data for {$tablename}\n";
+ echo " */\n";
+ }
+
+ $num_fields = $result->columnCount();
+
+ /*
+ * Compose fieldname list
+ */
+ $tablename_list = self::get_field_names($result, $num_fields);
+
+ /*
+ * Loop through the resulting rows and build the sql statement.
+ */
+ foreach ( $result as $row )
+ {
+ // Start building the SQL statement.
+ echo 'INSERT INTO ' . $tablename . ' ' . $tablename_list . ' VALUES(';
+
+ // Loop through the rows and fill in data for each column
+ for ( $j = 0; $j < $num_fields; $j++ )
+ {
+ if ( !isset($row[$j]) )
+ {
+ // no data for column
+ echo ' NULL';
+ }
+ elseif ( $row[$j] != '' )
+ {
+ // data
+ echo ' ' . DB::quoteValue($row[$j]);
+ }
+ else
+ {
+ // empty column (!= no data!)
+ echo "''";
+ }
+
+ // only add comma when not last column
+ if ( $j != ($num_fields - 1) )
+ {
+ echo ',';
+ }
+ }
+ echo ");\n";
+ }
+ echo "\n";
+ return;
+ }
+
+ /**
+ * Backup::gzip_print_four_characters()
+ *
+ * @static
+ * @param integer $val
+ * @return integer
+ */
+ static private function gzip_print_four_characters($Val)
+ {
+ for ( $i = 0; $i < 4; $i ++ )
+ {
+ $return .= chr($Val % 256);
+ $Val = floor($Val / 256);
+ }
+ return $return;
+ }
+
+ /**
+ * Backup::do_restore()
+ * Restores a database backup
+ *
+ * NOTE: this remains not-static for compatibility
+ *
+ * @param void
+ * @return void
+ */
+ public function do_restore()
+ {
+ $uploadInfo = postFileInfo('backup_file');
+
+ // first of all: get uploaded file:
+ if ( array_key_exists('name', $uploadInfo) && empty($uploadInfo['name']) )
+ {
+ return 'No file uploaded';
+ }
+ if ( !is_uploaded_file($uploadInfo['tmp_name']) )
+ {
+ return 'No file uploaded';
+ }
+
+ $backup_file_name = $uploadInfo['name'];
+ $backup_file_tmpname = $uploadInfo['tmp_name'];
+ $backup_file_type = $uploadInfo['type'];
+
+ if ( !file_exists($backup_file_tmpname) )
+ {
+ return 'File Upload Error';
+ }
+
+ if ( !preg_match("#^(text/[a-zA-Z]+)|(application/(x\-)?gzip(\-compressed)?)|(application/octet-stream)$#i", $backup_file_type) )
+ {
+ return 'The uploaded file is not of the correct type';
+ }
+
+ $gzip = 0;
+ if ( preg_match("#\.gz#i", $backup_file_name) )
+ {
+ $gzip = 1;
+ }
+
+ if ( !extension_loaded("zlib") && $gzip )
+ {
+ return 'Cannot decompress gzipped backup (zlib package not installed)';
+ }
+
+ // get sql query according to gzip setting (either decompress, or not)
+ $contents = self::get_contents($backup_file_tmpname, $gzip);
+ if ( $contents == '' )
+ {
+ return 'Cannot get contents from this file.';
+ }
+
+ /* detect lines */
+ $lines = preg_split('/[\r\n]/', $contents);
+ if( $lines === $contents )
+ {
+ return 'Cannot parse contents from this file';
+ }
+
+ /* get sql statements from each lines */
+ $queries = self::get_queries($lines);
+ if ( $queries === array() )
+ {
+ return "Cannot get SQL queries from this file.";
+ }
+
+ /* execute sql statements */
+ foreach ( $queries as $query )
+ {
+ if ( DB::execute($query) === FALSE )
+ {
+ $error = DB::getError();
+ debug('SQL Error: ' . $error[2]);
+ break;
+ }
+ continue;
+ }
+ return;
+ }
+
+ static private function get_contents($temporary_name, $gzip = 0)
+ {
+ $contents = '';
+ if ( $gzip )
+ {
+ // decompress and read
+ $gz_ptr = gzopen($temporary_name, 'rb');
+ while ( !gzeof($gz_ptr) )
+ {
+ $contents .= gzgets($gz_ptr, 100000);
+ }
+ }
+ else
+ {
+ // just read
+ $fsize = filesize($temporary_name);
+ if ( $fsize > 0 )
+ {
+ $contents = fread(fopen($temporary_name, 'r'), $fsize);
+ }
+ }
+ return $contents;
+ }
+
+ static private function get_queries($lines)
+ {
+ $query = '';
+ $queries = array();
+ foreach ( $lines as $line )
+ {
+ $line = trim($line);
+ if ( !$line || $line[0] == '#' || preg_match('#^[\s|/]?\*#', $line) )
+ {
+ continue;
+ }
+
+ if ( preg_match('/^(.*);$/', $line, $matches) === 0 )
+ {
+ $query .= $line;
+ }
+ else
+ {
+ $query .= $matches[1];
+ $queries[] = $query;
+ $query = '';
+ }
+ continue;
+ }
+ return $queries;
+ }
}
\ No newline at end of file
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2009 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: globalfunctions.php 1856 2012-05-18 09:30:16Z sakamocchi $
- */\r
-\r
-/* needed if we include globalfunctions from install.php */\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: globalfunctions.php 1886 2012-06-17 08:27:27Z sakamocchi $
+ */
+
+/* needed if we include globalfunctions from install.php */
global $nucleus, $CONF, $DIR_LIBS, $DIR_LOCALES, $manager, $member, $MYSQL_HANDLER, $StartTime;
-/* just for benchmark tag */
-$StartTime = microtime(TRUE);
-\r
-$nucleus['version'] = 'v4.00 SVN';\r
-$nucleus['codename'] = '';\r
-\r
-/*\r
- * make sure there's no unnecessary escaping:\r
- * set_magic_quotes_runtime(0);\r
- */\r
-if ( version_compare(PHP_VERSION, '5.3.0', '<') )\r
-{\r
- ini_set('magic_quotes_runtime', '0');\r
-}\r
-\r
-/* check and die if someone is trying to override internal globals (when register_globals turn on) */\r
-checkVars(array('nucleus', 'CONF', 'DIR_LIBS',
-'MYSQL_HOST', 'MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_DATABASE',
-'DIR_LOCALES', 'DIR_PLUGINS',
-'HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_ENV_VARS',
-'HTTP_SESSION_VARS', 'HTTP_POST_FILES', 'HTTP_SERVER_VARS',
-'GLOBALS', 'argv', 'argc', '_GET', '_POST', '_COOKIE', '_ENV', '_SESSION', '_SERVER', '_FILES'));
-\r
-if ( !isset($CONF) )\r
-{\r
- $CONF = array();\r
-}\r
-\r
-/* debug mode */\r
-if ( array_key_exists('debug', $CONF) && $CONF['debug'] )\r
-{\r
- /* report all errors! */\r
- error_reporting(E_ALL);\r
-}\r
-else\r
-{\r
- ini_set('display_errors','0');\r
- error_reporting(E_ERROR | E_WARNING | E_PARSE);\r
-}\r
-\r
-/*\r
- * alertOnHeadersSent\r
- * Displays an error when visiting a public Nucleus page and headers have\r
- * been sent out to early. This usually indicates an error in either a\r
- * configuration file or a translation file, and could cause Nucleus to\r
- * malfunction\r
- */\r
-if ( !array_key_exists('alertOnHeadersSent', $CONF) )\r
-{\r
- $CONF['alertOnHeadersSent'] = 1;\r
-}\r
-\r
-/*\r
- * alertOnSecurityRisk\r
- * Displays an error only when visiting the admin area, and when one or\r
- * more of the installation files (install.php, install.sql, upgrades/\r
- * directory) are still on the server.\r
- */\r
-if ( !array_key_exists('alertOnSecurityRisk', $CONF) )\r
-{\r
- $CONF['alertOnSecurityRisk'] = 1;\r
-}\r
-\r
-/*\r
- * Set these to 1 to allow viewing of future items or draft items\r
- * Should really never do this, but can be useful for some plugins that might need to\r
- * Could cause some other issues if you use future posts otr drafts\r
- * So use with care\r
- */\r
-$CONF['allowDrafts'] = 0;\r
-$CONF['allowFuture'] = 0;\r
-\r
-if ( getNucleusPatchLevel() > 0 )\r
-{\r
- $nucleus['version'] .= '/' . getNucleusPatchLevel();\r
-}\r
-\r
-/* Avoid notices */\r
-if ( !array_key_exists('installscript', $CONF) || empty($CONF['installscript']) )\r
-{\r
- $CONF['installscript'] = 0;\r
-}\r
-if ( !array_key_exists('UsingAdminArea', $CONF) )\r
-{\r
- $CONF['UsingAdminArea'] = 0;\r
-}\r
-\r
-if ( !headers_sent() )\r
-{\r
- header('Generator: Nucleus CMS ' . $nucleus['version']);\r
-}\r
-\r
-\r
-/* TODO: This is for compatibility since 4.0, should be obsoleted at future release. */\r
-if ( !isset($DIR_LOCALES) )\r
-{\r
- $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';\r
-}\r
-global $DIR_LANG;\r
-if ( !isset($DIR_LANG) )\r
-{\r
- $DIR_LANG = $DIR_LOCALES;\r
-}\r
-\r
-/* load and initialize i18n class */\r
-if (!class_exists('i18n', FALSE))\r
-{\r
- include($DIR_LIBS . 'i18n.php');\r
-}\r
-if ( !i18n::init('UTF-8', $DIR_LOCALES) )\r
-{\r
- exit('Fail to initialize i18n class.');\r
-}\r
-\r
-/* TODO: This is just for compatibility since 4.0, should be obsoleted at future release. */\r
-define('_CHARSET', i18n::get_current_charset());\r
-\r
-\r
-/*\r
- * NOTE: Since 4.0 release, Entity class becomes to be important class\r
- * with some wrapper functions for htmlspechalchars/htmlentity PHP's built-in function\r
- */\r
-include($DIR_LIBS . 'ENTITY.php');\r
-\r
-/* we will use postVar, getVar, ... methods instead of $_GET, $_POST ... */\r
-if ( $CONF['installscript'] != 1 )\r
-{\r
- /* vars were already included in install.php */\r
- include_once($DIR_LIBS . 'vars4.1.0.php');\r
- \r
- /* added for 4.0 DB::* wrapper and compatibility sql_* */\r
- include_once($DIR_LIBS . 'sql/sql.php');\r
-}\r
-\r
-/* include core classes that are needed for login & plugin handling */\r
-include($DIR_LIBS . 'MEMBER.php');\r
-include($DIR_LIBS . 'ACTIONLOG.php');\r
-include($DIR_LIBS . 'MANAGER.php');\r
-include($DIR_LIBS . 'PLUGIN.php');\r
-\r
-$manager =& MANAGER::instance();\r
-\r
-/* only needed when updating logs */\r
-if ( $CONF['UsingAdminArea'] )\r
-{\r
- /* XML-RPC client classes */\r
- include($DIR_LIBS . 'xmlrpc.inc.php');\r
- include($DIR_LIBS . 'ADMIN.php');\r
-}\r
-\r
-\r
-/* connect to database */\r
-if ( !isset($MYSQL_HANDLER) )\r
-{\r
- $MYSQL_HANDLER = array('mysql','');\r
-}\r
-if ( $MYSQL_HANDLER[0] == '' )\r
-{\r
- $MYSQL_HANDLER[0] = 'mysql';\r
-}\r
-DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);\r
-\r
-\r
-/* force locale or charset */\r
-$locale = '';\r
-$charset = i18n::get_current_charset();\r
-\r
-$data = array(\r
- 'locale' => &$locale,\r
- 'charset' => &$charset\r
-);\r
-$manager->notify('ForceLocale', $data);\r
-\r
-if ( $data['locale'] !== '' )\r
-{\r
- i18n::set_forced_locale($data['locale']);\r
-}\r
-if ( $data['charset'] !== '' )\r
-{\r
- i18n::set_forced_charset($data['charset']);\r
-}\r
-unset($locale);\r
-unset($charset);\r
-\r
-\r
-/* convert forced charset to current charset */\r
-if ( i18n::get_forced_charset() != i18n::get_current_charset() )\r
-{\r
- $_POST = i18n::convert_array($_POST, i18n::get_forced_charset());\r
- $_GET = i18n::convert_array($_GET, i18n::get_forced_charset());\r
- $_REQUEST = i18n::convert_array($_REQUEST, i18n::get_forced_charset());\r
- $_COOKIE = i18n::convert_array($_COOKIE, i18n::get_forced_charset());\r
- $_FILES = i18n::convert_array($_FILES, i18n::get_forced_charset());\r
- \r
- if ( session_id() !== '' )\r
- {\r
- $_SESSION = i18n::convert_array($_SESSION, i18n::get_forced_charset());\r
- }\r
-}\r
-\r
-\r
-/* sanitize option */\r
-$bLoggingSanitizedResult = 0;\r
-$bSanitizeAndContinue = 0;\r
-$orgRequestURI = serverVar('REQUEST_URI');\r
-sanitizeParams();\r
-\r
-/* logs sanitized result if need */\r
-if ( $orgRequestURI !== serverVar('REQUEST_URI') )\r
-{\r
- $msg = "Sanitized [" . serverVar('REMOTE_ADDR') . "] ";\r
- $msg .= $orgRequestURI . " -> " . serverVar('REQUEST_URI');\r
- if ( $bLoggingSanitizedResult )\r
- {\r
- addToLog(WARNING, $msg);\r
- }\r
- if ( !$bSanitizeAndContinue )\r
- {\r
- die("");\r
- }\r
-}\r
-\r
-/* get all variables that can come from the request and put them in the global scope */\r
-$blogid = requestVar('blogid');\r
-$itemid = intRequestVar('itemid');\r
-$catid = intRequestVar('catid');\r
-$skinid = requestVar('skinid');\r
-$memberid = requestVar('memberid');\r
-$archivelist = requestVar('archivelist');\r
-$imagepopup = requestVar('imagepopup');\r
-$archive = requestVar('archive');\r
-$query = requestVar('query');\r
-$highlight = requestVar('highlight');\r
-$amount = requestVar('amount');\r
-$action = requestVar('action');\r
-$nextaction = requestVar('nextaction');\r
-$maxresults = requestVar('maxresults');\r
-$startpos = intRequestVar('startpos');\r
-$errormessage = '';\r
-$error = '';\r
-$special = requestVar('special');\r
-\r
-\r
-/* read config */\r
-getConfig();\r
-\r
-\r
-/* Properly set $CONF['Self'] and others if it's not set...\r
- * usually when we are access from admin menu\r
- */\r
-if ( !array_key_exists('Self', $CONF) )\r
-{\r
- $CONF['Self'] = $CONF['IndexURL'];\r
- /* strip trailing */\r
- if ( $CONF['Self'][i18n::strlen($CONF['Self']) -1] == "/" )\r
- {\r
- $CONF['Self'] = i18n::substr($CONF['Self'], 0, i18n::strlen($CONF['Self']) -1);\r
- }\r
-}\r
-\r
-$CONF['ItemURL'] = $CONF['Self'];\r
-$CONF['ArchiveURL'] = $CONF['Self'];\r
-$CONF['ArchiveListURL'] = $CONF['Self'];\r
-$CONF['MemberURL'] = $CONF['Self'];\r
-$CONF['SearchURL'] = $CONF['Self'];\r
-$CONF['BlogURL'] = $CONF['Self'];\r
-$CONF['CategoryURL'] = $CONF['Self'];\r
-\r
-/* automatically use simpler toolbar for mozilla */\r
-if ( ($CONF['DisableJsTools'] == 0)\r
- && i18n::strpos(serverVar('HTTP_USER_AGENT'), 'Mozilla/5.0') !== FALSE\r
- && i18n::strpos(serverVar('HTTP_USER_AGENT'), 'Gecko') !== FALSE )\r
-{\r
- $CONF['DisableJsTools'] = 2;\r
-}\r
-\r
-/* login processing */
-$member = new Member();\r
-\r
-if ( $action == 'login' )\r
-{\r
- $login = postVar('login');\r
- $password = postVar('password');\r
- $shared = intPostVar('shared');\r
- $member->login($login, $password, $shared);\r
-}\r
-elseif ( ($action == 'logout') )\r
-{\r
- $member->logout();\r
-}\r
-else\r
-{\r
- $member->cookielogin();\r
-}\r
-\r
-\r
-/* TODO: This is for backward compatibility, should be obsoleted near future. */\r
-if ( !preg_match('#^(.+)_(.+)_(.+)$#', $CONF['Locale'])\r
- && ($CONF['Locale'] = i18n::convert_old_language_file_name_to_locale($CONF['Locale'])) === FALSE )\r
-{\r
- $CONF['Locale'] = 'en_Latn_US';\r
-}\r
-if ( !array_key_exists('Language', $CONF) )\r
-{\r
- $CONF['Language'] = i18n::convert_locale_to_old_language_file_name($CONF['Locale']);\r
-}\r
-$locale = $CONF['Locale'];\r
-\r
-\r
-/* NOTE: include translation file and set locale */\r
-if ( $member->isLoggedIn() )\r
-{\r
- if ( $member->getLocale() )\r
- {\r
- $locale = $member->getLocale();\r
- }\r
-}\r
-else\r
-{\r
- if ( i18n::get_forced_locale() !== '' )\r
- {\r
- $locale = i18n::get_forced_locale();\r
- }\r
-}\r
-include_translation($locale);\r
-i18n::set_current_locale($locale);\r
-\r
-\r
-/* login completed */\r
-$manager->notify('PostAuthentication', array('loggedIn' => $member->isLoggedIn() ) );\r
-\r
-/* next action */\r
-if ( $member->isLoggedIn() && $nextaction )\r
-{\r
- $action = $nextaction;\r
-}\r
-\r
-/* first, let's see if the site is disabled or not. always allow admin area access. */\r
-if ( $CONF['DisableSite'] && !$member->isAdmin() && !$CONF['UsingAdminArea'] )\r
-{\r
- redirect($CONF['DisableSiteURL']);\r
- exit;\r
-}\r
-\r
-/* load other classes */\r
-include($DIR_LIBS . 'PARSER.php');\r
-include($DIR_LIBS . 'SKIN.php');\r
-include($DIR_LIBS . 'TEMPLATE.php');\r
-include($DIR_LIBS . 'BLOG.php');\r
-include($DIR_LIBS . 'BODYACTIONS.php');\r
-include($DIR_LIBS . 'COMMENTS.php');\r
-include($DIR_LIBS . 'COMMENT.php');\r
-include($DIR_LIBS . 'NOTIFICATION.php');\r
-include($DIR_LIBS . 'BAN.php');\r
-include($DIR_LIBS . 'SEARCH.php');\r
-include($DIR_LIBS . 'LINK.php');\r
-\r
-/* set lastVisit cookie (if allowed) */\r
-if ( !headers_sent() )\r
-{\r
- if ( $CONF['LastVisit'] )\r
- {\r
- setcookie($CONF['CookiePrefix'] . 'lastVisit', time(), time() + 2592000, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
- }\r
- else\r
- {\r
- setcookie($CONF['CookiePrefix'] . 'lastVisit', '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
- }\r
-}\r
-\r
-/* for path resolving */
-$virtualpath = getVar('virtualpath');
-if ( getVar('virtualpath') == '' )
- {\r
- $virtualpath = serverVar('PATH_INFO');
- }\r
- \r
-/*
- * switch URLMode back to normal when $CONF['Self'] ends in .php
- * this avoids urls like index.php/item/13/index.php/item/15
+/* just for benchmark tag */
+$StartTime = microtime(TRUE);
+
+$nucleus['version'] = 'v4.00 SVN';
+$nucleus['codename'] = '';
+
+/*
+ * make sure there's no unnecessary escaping:
+ * set_magic_quotes_runtime(0);
+ */
+if ( version_compare(PHP_VERSION, '5.3.0', '<') )
+{
+ ini_set('magic_quotes_runtime', '0');
+}
+
+/* check and die if someone is trying to override internal globals (when register_globals turn on) */
+checkVars(array('nucleus', 'CONF', 'DIR_LIBS',
+'MYSQL_HOST', 'MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_DATABASE',
+'DIR_LOCALES', 'DIR_PLUGINS',
+'HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_ENV_VARS',
+'HTTP_SESSION_VARS', 'HTTP_POST_FILES', 'HTTP_SERVER_VARS',
+'GLOBALS', 'argv', 'argc', '_GET', '_POST', '_COOKIE', '_ENV', '_SESSION', '_SERVER', '_FILES'));
+
+if ( !isset($CONF) )
+{
+ $CONF = array();
+}
+
+/* debug mode */
+if ( array_key_exists('debug', $CONF) && $CONF['debug'] )
+{
+ /* report all errors! */
+ error_reporting(E_ALL);
+}
+else
+{
+ ini_set('display_errors','0');
+ error_reporting(E_ERROR | E_WARNING | E_PARSE);
+}
+
+/*
+ * alertOnHeadersSent
+ * Displays an error when visiting a public Nucleus page and headers have
+ * been sent out to early. This usually indicates an error in either a
+ * configuration file or a translation file, and could cause Nucleus to
+ * malfunction
+ */
+if ( !array_key_exists('alertOnHeadersSent', $CONF) )
+{
+ $CONF['alertOnHeadersSent'] = 1;
+}
+/*
+ * alertOnSecurityRisk
+ * Displays an error only when visiting the admin area, and when one or
+ * more of the installation files (install.php, install.sql, upgrades/
+ * directory) are still on the server.
+ */
+if ( !array_key_exists('alertOnSecurityRisk', $CONF) )
+{
+ $CONF['alertOnSecurityRisk'] = 1;
+}
+/*
+ * Set these to 1 to allow viewing of future items or draft items
+ * Should really never do this, but can be useful for some plugins that might need to
+ * Could cause some other issues if you use future posts otr drafts
+ * So use with care
+ */
+$CONF['allowDrafts'] = 0;
+$CONF['allowFuture'] = 0;
+
+if ( getNucleusPatchLevel() > 0 )
+{
+ $nucleus['version'] .= '/' . getNucleusPatchLevel();
+}
+
+/* Avoid notices */
+if ( !array_key_exists('installscript', $CONF) || empty($CONF['installscript']) )
+{
+ $CONF['installscript'] = 0;
+}
+if ( !array_key_exists('UsingAdminArea', $CONF) )
+{
+ $CONF['UsingAdminArea'] = 0;
+}
+
+if ( !headers_sent() )
+{
+ header('Generator: Nucleus CMS ' . $nucleus['version']);
+}
+
+
+/* TODO: This is for compatibility since 4.0, should be obsoleted at future release. */
+if ( !isset($DIR_LOCALES) )
+{
+ $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';
+}
+global $DIR_LANG;
+if ( !isset($DIR_LANG) )
+{
+ $DIR_LANG = $DIR_LOCALES;
+}
+
+/* load and initialize i18n class */
+if (!class_exists('i18n', FALSE))
+{
+ include($DIR_LIBS . 'i18n.php');
+}
+if ( !i18n::init('UTF-8', $DIR_LOCALES) )
+{
+ exit('Fail to initialize i18n class.');
+}
+
+/* TODO: This is just for compatibility since 4.0, should be obsoleted at future release. */
+define('_CHARSET', i18n::get_current_charset());
+
+
+/*
+ * NOTE: Since 4.0 release, Entity class becomes to be important class
+ * with some wrapper functions for htmlspechalchars/htmlentity PHP's built-in function
+ */
+include($DIR_LIBS . 'ENTITY.php');
+
+/* we will use postVar, getVar, ... methods instead of $_GET, $_POST ... */
+if ( $CONF['installscript'] != 1 )
+{
+ /* vars were already included in install.php */
+ include_once($DIR_LIBS . 'vars4.1.0.php');
+
+ /* added for 4.0 DB::* wrapper and compatibility sql_* */
+ include_once($DIR_LIBS . 'sql/sql.php');
+}
+
+/* include core classes that are needed for login & plugin handling */
+include($DIR_LIBS . 'MEMBER.php');
+include($DIR_LIBS . 'ACTIONLOG.php');
+include($DIR_LIBS . 'MANAGER.php');
+include($DIR_LIBS . 'PLUGIN.php');
+
+$manager =& MANAGER::instance();
+
+/* only needed when updating logs */
+if ( $CONF['UsingAdminArea'] )
+{
+ /* XML-RPC client classes */
+ include($DIR_LIBS . 'xmlrpc.inc.php');
+ include($DIR_LIBS . 'ADMIN.php');
+}
+
+
+/* connect to database */
+if ( !isset($MYSQL_HANDLER) )
+{
+ $MYSQL_HANDLER = array('mysql','');
+}
+if ( $MYSQL_HANDLER[0] == '' )
+{
+ $MYSQL_HANDLER[0] = 'mysql';
+}
+DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);
+
+
+/* force locale or charset */
+$locale = '';
+$charset = i18n::get_current_charset();
+
+$data = array(
+ 'locale' => &$locale,
+ 'charset' => &$charset
+);
+$manager->notify('ForceLocale', $data);
+
+if ( $data['locale'] !== '' )
+{
+ i18n::set_forced_locale($data['locale']);
+}
+if ( $data['charset'] !== '' )
+{
+ i18n::set_forced_charset($data['charset']);
+}
+unset($locale);
+unset($charset);
+
+
+/* convert forced charset to current charset */
+if ( i18n::get_forced_charset() != i18n::get_current_charset() )
+{
+ $_POST = i18n::convert_array($_POST, i18n::get_forced_charset());
+ $_GET = i18n::convert_array($_GET, i18n::get_forced_charset());
+ $_REQUEST = i18n::convert_array($_REQUEST, i18n::get_forced_charset());
+ $_COOKIE = i18n::convert_array($_COOKIE, i18n::get_forced_charset());
+ $_FILES = i18n::convert_array($_FILES, i18n::get_forced_charset());
+
+ if ( session_id() !== '' )
+ {
+ $_SESSION = i18n::convert_array($_SESSION, i18n::get_forced_charset());
+ }
+}
+
+
+/* sanitize option */
+$bLoggingSanitizedResult = 0;
+$bSanitizeAndContinue = 0;
+$orgRequestURI = serverVar('REQUEST_URI');
+sanitizeParams();
+
+/* logs sanitized result if need */
+if ( $orgRequestURI !== serverVar('REQUEST_URI') )
+{
+ $msg = "Sanitized [" . serverVar('REMOTE_ADDR') . "] ";
+ $msg .= $orgRequestURI . " -> " . serverVar('REQUEST_URI');
+ if ( $bLoggingSanitizedResult )
+ {
+ addToLog(WARNING, $msg);
+ }
+ if ( !$bSanitizeAndContinue )
+ {
+ die("");
+ }
+}
+
+/* get all variables that can come from the request and put them in the global scope */
+$blogid = requestVar('blogid');
+$itemid = intRequestVar('itemid');
+$catid = intRequestVar('catid');
+$skinid = requestVar('skinid');
+$memberid = requestVar('memberid');
+$archivelist = requestVar('archivelist');
+$imagepopup = requestVar('imagepopup');
+$archive = requestVar('archive');
+$query = requestVar('query');
+$highlight = requestVar('highlight');
+$amount = requestVar('amount');
+$action = requestVar('action');
+$nextaction = requestVar('nextaction');
+$maxresults = requestVar('maxresults');
+$startpos = intRequestVar('startpos');
+$errormessage = '';
+$error = '';
+$special = requestVar('special');
+
+
+/* read config */
+getConfig();
+
+
+/* Properly set $CONF['Self'] and others if it's not set...
+ * usually when we are access from admin menu
+ */
+if ( !array_key_exists('Self', $CONF) )
+{
+ $CONF['Self'] = $CONF['IndexURL'];
+ /* strip trailing */
+ if ( $CONF['Self'][i18n::strlen($CONF['Self']) -1] == "/" )
+ {
+ $CONF['Self'] = i18n::substr($CONF['Self'], 0, i18n::strlen($CONF['Self']) -1);
+ }
+}
+
+$CONF['ItemURL'] = $CONF['Self'];
+$CONF['ArchiveURL'] = $CONF['Self'];
+$CONF['ArchiveListURL'] = $CONF['Self'];
+$CONF['MemberURL'] = $CONF['Self'];
+$CONF['SearchURL'] = $CONF['Self'];
+$CONF['BlogURL'] = $CONF['Self'];
+$CONF['CategoryURL'] = $CONF['Self'];
+
+/* automatically use simpler toolbar for mozilla */
+if ( ($CONF['DisableJsTools'] == 0)
+ && i18n::strpos(serverVar('HTTP_USER_AGENT'), 'Mozilla/5.0') !== FALSE
+ && i18n::strpos(serverVar('HTTP_USER_AGENT'), 'Gecko') !== FALSE )
+{
+ $CONF['DisableJsTools'] = 2;
+}
+
+/* login processing */
+$member = new Member();
+if ( $action == 'login' )
+{
+ $login = postVar('login');
+ $password = postVar('password');
+ $shared = intPostVar('shared');
+ $member->login($login, $password, $shared);
+}
+elseif ( ($action == 'logout') )
+{
+ $member->logout();
+}
+else
+{
+ $member->cookielogin();
+}
+
+/* TODO: This is for backward compatibility, should be obsoleted near future. */
+if ( !preg_match('#^(.+)_(.+)_(.+)$#', $CONF['Locale'])
+ && ($CONF['Locale'] = i18n::convert_old_language_file_name_to_locale($CONF['Locale'])) === FALSE )
+{
+ $CONF['Locale'] = 'en_Latn_US';
+}
+if ( !array_key_exists('Language', $CONF) )
+{
+ $CONF['Language'] = i18n::convert_locale_to_old_language_file_name($CONF['Locale']);
+}
+$locale = $CONF['Locale'];
+
+
+/* NOTE: include translation file and set locale */
+if ( $member->isLoggedIn() )
+{
+ if ( $member->getLocale() )
+ {
+ $locale = $member->getLocale();
+ }
+}
+else
+{
+ if ( i18n::get_forced_locale() !== '' )
+ {
+ $locale = i18n::get_forced_locale();
+ }
+}
+include_translation($locale);
+i18n::set_current_locale($locale);
+
+
+/* login completed */
+$manager->notify('PostAuthentication', array('loggedIn' => $member->isLoggedIn() ) );
+
+/* next action */
+if ( $member->isLoggedIn() && $nextaction )
+{
+ $action = $nextaction;
+}
+
+/* first, let's see if the site is disabled or not. always allow admin area access. */
+if ( $CONF['DisableSite'] && !$member->isAdmin() && !$CONF['UsingAdminArea'] )
+{
+ redirect($CONF['DisableSiteURL']);
+ exit;
+}
+
+/* load other classes */
+include($DIR_LIBS . 'PARSER.php');
+include($DIR_LIBS . 'SKIN.php');
+include($DIR_LIBS . 'TEMPLATE.php');
+include($DIR_LIBS . 'BLOG.php');
+include($DIR_LIBS . 'BODYACTIONS.php');
+include($DIR_LIBS . 'COMMENTS.php');
+include($DIR_LIBS . 'COMMENT.php');
+include($DIR_LIBS . 'NOTIFICATION.php');
+include($DIR_LIBS . 'BAN.php');
+include($DIR_LIBS . 'SEARCH.php');
+include($DIR_LIBS . 'LINK.php');
+
+/* set lastVisit cookie (if allowed) */
+if ( !headers_sent() )
+{
+ if ( $CONF['LastVisit'] )
+ {
+ setcookie($CONF['CookiePrefix'] . 'lastVisit', time(), time() + 2592000, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+ }
+ else
+ {
+ setcookie($CONF['CookiePrefix'] . 'lastVisit', '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+ }
+}
+
+/* for path resolving */
+$virtualpath = getVar('virtualpath');
+if ( getVar('virtualpath') == '' )
+{
+ $virtualpath = serverVar('PATH_INFO');
+}
+
+/*
+ * switch URLMode back to normal when $CONF['Self'] ends in .php
+ * this avoids urls like index.php/item/13/index.php/item/15
+ */
+if ( !array_key_exists('URLMode', $CONF) || ($CONF['URLMode'] != 'pathinfo') )
+{
+ $CONF['URLMode'] = 'normal';
+}
+else
+{
+ if ( i18n::substr($CONF['Self'], i18n::strlen($CONF['Self']) - 4) != '.php' )
+ {
+ decodePathInfo($virtualpath);
+ }
+}
+
+/*
+ * PostParseURL is a place to cleanup any of the path-related global variables before the selector function is run.
+ * It has 2 values in the data in case the original virtualpath is needed, but most the use will be in tweaking
+ * global variables to clean up (scrub out catid or add catid) or to set someother global variable based on
+ * the values of something like catid or itemid
+ * New in 3.60
+ */
+$data = array(
+ 'type' => basename(serverVar('SCRIPT_NAME')),
+ 'info' => $virtualpath
+);
+$manager->notify('PostParseURL', $data);
+
+/*
+ * NOTE: Here is the end of initialization
+ */
+
+/**
+ * include_libs()
+ * This function includes or requires the specified library file
+ *
+ * @param string $file
+ * @param boolean $once use the _once() version
+ * @param boolean $require use require() instead of include()
+ * @return void
+ */
+function include_libs($file, $once = TRUE, $require = TRUE)
+{
+ global $DIR_LIBS;
+
+ // $DIR_LIBS isn't a directory
+ if ( !is_dir($DIR_LIBS) )
+ {
+ exit;
+ }
+
+ $lib_path = $DIR_LIBS . $file;
+
+ if ( $once && $require )
+ {
+ require_once($lib_path);
+ }
+ else if ( $once && !$require )
+ {
+ include_once($lib_path);
+ }
+ else if ( $require )
+ {
+ require($lib_path);
+ }
+ else
+ {
+ include($lib_path);
+ }
+ return;
+}
+
+/**
+ * include_plugins()
+ * This function includes or requires the specified plugin file
+ *
+ * @param string $file
+ * @param boolean $once use the _once() version
+ * @param boolean $require use require() instead of include()
+ * @return
+ */
+function include_plugins($file, $once = TRUE, $require = TRUE)
+{
+ global $DIR_PLUGINS;
+
+ // begin if: $DIR_LIBS isn't a directory
+ if ( !is_dir($DIR_PLUGINS) )
+ {
+ exit;
+ }
+
+ $plugin_path = $DIR_PLUGINS . $file;
+
+ // begin if:
+ if ( $once && $require )
+ {
+ require_once($plugin_path);
+ }
+ else if ( $once && !$require )
+ {
+ include_once($plugin_path);
+ }
+ elseif ( $require )
+ {
+ require($plugin_path);
+ }
+ else
+ {
+ include($plugin_path);
+ }
+ return;
+}
+
+/**
+ * include_translation()
+ * This function decide which locale is used and include translation
+ *
+ * @param string &$locale locale name referring to 'language tags' defined in RFC 5646
+ * @return void
+ */
+function include_translation(&$locale)
+{
+ global $DIR_LOCALES;
+
+ $translation_file = $DIR_LOCALES . $locale . '.' . i18n::get_current_charset() . '.php';
+ if ( !file_exists($translation_file) )
+ {
+ $locale = 'en_Latn_US';
+ $translation_file = $DIR_LOCALES . 'en_Latn_US.ISO-8859-1.php';
+ }
+ include($translation_file);
+ return;
+}
+
+/**
+ * intPostVar()
+ * This function returns the integer value of $_POST for the variable $name
+ *
+ * @param string $name field to get the integer value of
+ * @return integer
+ */
+function intPostVar($name)
+{
+ return (integer) postVar($name);
+}
+
+
+/**
+ * intGetVar()
+ * This function returns the integer value of $_GET for the variable $name
+ *
+ * @param string $name field to get the integer value of
+ * @return integer
+ */
+function intGetVar($name)
+{
+ return (integer) getVar($name);
+}
+
+
+/**
+ * intRequestVar()
+ * This function returns the integer value of $_REQUEST for the variable $name. Also checks $_GET and $_POST if not found in $_REQUEST
+ *
+ * @param string $name field to get the integer value of
+ * @return int
+ */
+function intRequestVar($name)
+{
+ return (integer) requestVar($name);
+}
+
+
+/**
+ * intCookieVar()
+ * This function returns the integer value of $_COOKIE for the variable $name
+ *
+ * @param string $name field to get the integer value of
+ * @return integer
+ */
+function intCookieVar($name)
+{
+ return (integer) cookieVar($name);
+}
+
+/**
+ * getNucleusVersion()
+ * This function returns the current Nucleus version (100 = 1.00, 101 = 1.01, etc...)
+ *
+ * @param void
+ * @return integer
+ */
+function getNucleusVersion()
+{
+ return 400;
+}
+
+/**
+ * getNucleusPatchLevel()
+ * TODO: Better description of this function.
+ *
+ * Power users can install patches in between nucleus releases. These patches
+ * usually add new functionality in the plugin API and allow those to
+ * be tested without having to install CVS.
+ *
+ *@param void
+ * @return integer
+ */
+function getNucleusPatchLevel()
+{
+ return 0;
+}
+
+/**
+ * getLatestVersion()
+ * This function returns the latest Nucleus version available for download from nucleuscms.org or FALSE if unable to attain data
+ * Format will be major.minor/patachlevel e.g. 3.41 or 3.41/02
+ *
+ * @param void
+ * @return mixed
+ */
+function getLatestVersion()
+{
+ // begin if: cURL is not available in this PHP installation
+ if ( !function_exists('curl_init') )
+ {
+ return FALSE;
+ }
+
+ $curl = curl_init();
+ $timeout = 5;
+
+ curl_setopt ($curl, CURLOPT_URL, 'http://nucleuscms.org/version_check.php');
+ curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
+
+ $return = curl_exec($curl);
+
+ curl_close($curl);
+
+ return $return;
+}
+
+/**
+ * sql_table()
+ * This function returns a Nucleus table name with the appropriate prefix
+ * @param string $name
+ * @return string
+ */
+function sql_table($name)
+{
+ global $MYSQL_PREFIX;
+
+ // begin if: no MySQL prefix
+ if ( empty($MYSQL_PREFIX) )
+ {
+ return 'nucleus_' . $name;
+ }
+ // else: use MySQL prefix
+ else
+ {
+ return $MYSQL_PREFIX . 'nucleus_' . $name;
+ }
+ return;
+}
+
+/**
+ * sendContentType()
+ * This function sends the Content-Type header if headers have not already been sent
+ * It also determines if the browser can accept application/xhtml+xml and sends it only to those that can.
+ *
+ * if content type is application/xhtml+xml, only send it to browsers
+ * that can handle it (IE6 cannot). Otherwise, send text/html
+ *
+ * v2.5:
+ * For admin area pages, keep sending text/html (unless it's a debug version)
+ * application/xhtml+xml still causes too much problems with the javascript implementations
+ *
+ * v3.3:
+ * ($CONF['UsingAdminArea'] && !$CONF['debug']) gets removed,
+ * application/xhtml+xml seems to be working, so we're going to use it if we can.
+ *
+ * @param string $content_type MIME media type registered to IANA, http://www.iana.org/assignments/media-types/index.html
+ * @param string $page_type
+ * @param string $charset Deprecated. This has no meaning.
+ * @return void
+ *
+ */
+function sendContentType($content_type, $page_type = '', $charset = '')
+{
+ global $manager, $CONF;
+
+ if ( headers_sent() )
+ {
+ return;
+ }
+
+ /* NOTE: MIME Media Type */
+ if ( ($content_type == 'application/xhtml+xml')
+ && (!stristr(serverVar('HTTP_ACCEPT'), 'application/xhtml+xml') ) )
+ {
+ $content_type = 'text/html';
+ }
+
+ /* NOTE: generate event */
+ $data = array(
+ 'pageType' => $page_type,
+ 'contentType' => &$content_type
+ );
+ $manager->notify('PreSendContentType', $data);
+
+ /* NOTE: confirm MIME Media Type */
+ $content_type = preg_replace('#[^a-zA-Z0-9-+./]#', '', $content_type);
+
+ /* NOTE: confirm character set */
+ $charset = i18n::get_current_charset();
+ if ( i18n::get_forced_charset() !== '' )
+ {
+ $charset = i18n::get_forced_charset();
+ }
+
+ /* NOTE: send HTTP 1.1 header */
+ header("Content-Type: {$content_type}; charset={$charset}");
+
+ /* NOTE: set handler for translating character set */
+ if ( $charset != i18n::get_current_charset() )
+ {
+ ob_start(array('i18n', 'convert_handler'));
+ }
+
+ return;
+}
+
+/**
+ * parseHighlight()
+ * This function parses a query into an array of expressions that can be passed on to the highlight method
+ * @param string $query
+ * @return void
+ */
+function parseHighlight($query)
+{
+ // TODO: add more intelligent splitting logic
+
+ // get rid of quotes
+ $query = preg_replace('/\'|"/', '', $query);
+
+ if ( !$query )
+ {
+ return array();
+ }
+
+ $aHighlight = preg_split('# #', $query);
+
+ for ( $i = 0; $i < count($aHighlight); $i++ )
+ {
+ $aHighlight[$i] = trim($aHighlight[$i]);
+
+ if ( i18n::strlen($aHighlight[$i]) < 3 )
+ {
+ unset($aHighlight[$i]);
+ }
+ }
+
+ if ( count($aHighlight) == 1 )
+ {
+ return $aHighlight[0];
+ }
+ else
+ {
+ return $aHighlight;
+ }
+ return;
+}
+
+/**
+ * getConfig()
+ *
+ * @param void
+ * @return void
+ */
+function getConfig()
+{
+ global $CONF;
+
+ $query = sprintf('SELECT * FROM %s', sql_table('config'));
+ $res = DB::getResult($query);
+
+ foreach ( $res as $row )
+ {
+ $CONF[$row['name']] = $row['value'];
+ }
+ return;
+}
+
+/**
+ * This function gets the blog ID from the blog name
+ * @param string $name
+ * @return
+ */
+function getBlogIDFromName($name)
+{
+ $query = sprintf('SELECT bnumber AS result FROM %s WHERE bshortname=%s', sql_table('blog'), DB::quoteValue($name));
+ return DB::getValue($query);
+}
+
+/**
+ * This function gets the blog name from the blog ID
+ * @param int $id
+ * @return object
+ */
+function getBlogNameFromID($id)
+{
+ $query = sprintf('SELECT bname AS result FROM %s WHERE bnumber=%d', sql_table('blog'), intval($id));
+ return DB::getValue($query);
+}
+
+/**
+ * This function gets the blog ID from the item ID
+ * @param int $item_id
+ * @return object
+ */
+function getBlogIDFromItemID($item_id)
+{
+ $query = sprintf('SELECT iblog AS result FROM %s WHERE inumber=%d', sql_table('item'), intval($item_id));
+ return DB::getValue($query);
+}
+
+/**
+ * This function gets the blog ID from the comment ID
+ * @param int $comment_id
+ * @return object
+ */
+function getBlogIDFromCommentID($comment_id)
+{
+ $query = sprintf('SELECT cblog AS result FROM %s WHERE cnumber=%d', sql_table('comment'), intval($comment_id));
+ return DB::getValue($query);
+}
+
+/**
+ * This function gets the blog ID from the category ID
+ * @param int $category_id
+ * @return object
+ */
+function getBlogIDFromCatID($category_id)
+{
+ $query = sprintf('SELECT cblog AS result FROM %s WHERE catid=%d', sql_table('category'), intval($category_id));
+ return DB::getValue($query);
+}
+
+/**
+ * This function gets the category ID from the category name
+ * @param int $name
+ * @return object
+ */
+function getCatIDFromName($name)
+{
+ $query = sprintf('SELECT catid AS result FROM %s WHERE cname=%s', sql_table('category'), DB::quoteValue($name));
+ return DB::getValue($query);
+}
+
+
+/**
+ * functions to be used in index.php to select something
+ */
+function selectBlog($shortname)
+{
+ global $blogid, $archivelist;
+ $blogid = getBlogIDFromName($shortname);
+
+ // also force archivelist variable, if it is set
+ if ( $archivelist )
+ {
+ $archivelist = $blogid;
+ }
+ return;
+}
+function selectSkin($skinname)
+{
+ global $skinid;
+ $skinid = SKIN::getIdFromName($skinname);
+ return;
+}
+function selectCategory($cat)
+{
+ global $catid;
+ if ( is_numeric($cat) )
+ {
+ $catid = (integer) $cat;
+ }
+ else
+ {
+ $catid = getCatIDFromName($cat);
+ }
+ return;
+}
+function selectItem($id)
+{
+ global $itemid;
+ $itemid = (integer) $id;
+ return;
+}
+function selectSpecialSkinType($id)
+{
+ global $special;
+ $special = strtolower($id);
+ return;
+}
+function selector()
+{
+ global $archive, $archivelist, $archivenext, $archivenextexists, $archiveprev, $archiveprevexists, $archivetype;
+ global $blog, $blogid;
+ global $catid;
+ global $itemid, $itemidnext, $itemidprev, $itemtitlenext, $itemtitleprev;
+ global $CONF, $DIR_LIBS, $amount, $errormessage, $imagepopup;
+ global $manager, $maxresults, $query;
+ global $member, $memberid, $memberinfo;
+ global $skinid, $skinpart, $special;
+
+ $actionNames = array('addcomment', 'sendmessage', 'createaccount', 'forgotpassword', 'votepositive', 'votenegative', 'plugin');
+ $action = requestVar('action');
+
+ if ( in_array($action, $actionNames) )
+ {
+ include_once($DIR_LIBS . 'ACTION.php');
+ $a = new Action();
+ $errorInfo = $a->doAction($action);
+
+ if ( $errorInfo )
+ {
+ $errormessage = $errorInfo['message'];
+ }
+ }
+
+ // show error when headers already sent out
+ if ( headers_sent() && $CONF['alertOnHeadersSent'] )
+ {
+ // try to get line number/filename (extra headers_sent params only exists in PHP 4.3+)
+ if ( function_exists('version_compare') && version_compare('4.3.0', phpversion(), '<=') )
+ {
+ headers_sent($hsFile, $hsLine);
+ $extraInfo = ' in <code>' . $hsFile . '</code> line <code>' . $hsLine . '</code>';
+ }
+ else
+ {
+ $extraInfo = '';
+ }
+
+ startUpError(
+ "<p>The page headers have already been sent out{$extraInfo}. This could cause Nucleus not to work in the expected way.</p>"
+ . "<p>Usually, this is caused by spaces or newlines at the end of the <code>config.php</code> file, "
+ . "at the end of the translation file or at the end of a plugin file.</p>"
+ . "<p>Please check this and try again.</p>"
+ . "<p>If you don't want to see this error message again, without solving the problem, "
+ . "set <code>{$CONF['alertOnHeadersSent']}</code> in <code>globalfunctions.php</code> to <code>0</code></p>"
+ . "Page headers already sent"
+ );
+ exit;
+ }
+
+ // make is so ?archivelist without blogname or blogid shows the archivelist
+ // for the default weblog
+ if ( serverVar('QUERY_STRING') == 'archivelist' )
+ {
+ $archivelist = $CONF['DefaultBlog'];
+ }
+
+ // now decide which type of skin we need
+ if ( $itemid )
+ {
+ // itemid given -> only show that item
+ $type = 'item';
+
+ if ( !$manager->existsItem($itemid,intval($CONF['allowFuture']),intval($CONF['allowDrafts'])) )
+ {
+ doError(_ERROR_NOSUCHITEM);
+ return;
+ }
+
+ // 1. get timestamp, blogid and catid for item
+ $query = 'SELECT itime, iblog, icat FROM %s WHERE inumber=%d';
+ $query = sprintf($query, sql_table('item'), intval($itemid));
+ $row = DB::getRow($query);
+
+ // if a different blog id has been set through the request or selectBlog(),
+ // deny access
+
+ if ( $blogid && (intval($blogid) != $row['iblog']) )
+ {
+ doError(_ERROR_NOSUCHITEM);
+ return;
+ }
+
+ // if a category has been selected which doesn't match the item, ignore the
+ // category. #85
+ if ( ($catid != 0) && ($catid != $row['icat']) )
+ {
+ $catid = 0;
+ }
+
+ $blogid = $row['iblog'];
+ $timestamp = strtotime($row['itime']);
+
+ $b =& $manager->getBlog($blogid);
+
+ if ( !$b->isValidCategory($catid) )
+ {
+ $query = "SELECT inumber, ititle FROM %s WHERE itime<%s AND idraft=0 AND iblog=%d ORDER BY itime DESC LIMIT 1";
+ $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), intval($blogid));
+ }
+ else
+ {
+ $query = "SELECT inumber, ititle FROM %s WHERE itime<%s AND idraft=0 AND iblog=%d AND icat=%d ORDER BY itime DESC LIMIT 1";
+ $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), intval($blogid), intval($catid));
+ }
+ $row = DB::getRow($query);
+
+ if ( $row )
+ {
+ $itemidprev = $row['inumber'];
+ $itemtitleprev = $row['ititle'];
+ }
+
+ // get next itemid and title
+ if ( !$b->isValidCategory($catid) )
+ {
+ $query = "SELECT inumber, ititle FROM %s WHERE itime>%s AND itime<=%s AND idraft=0 AND iblog=%d ORDER BY itime ASC LIMIT 1";
+ $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), DB::formatDateTime($b->getCorrectTime()), intval($blogid));
+ }
+ else
+ {
+ $query = "SELECT inumber, ititle FROM %s WHERE itime>%s AND itime<=%s AND idraft=0 AND iblog=%d AND icat=%d ORDER BY itime ASC LIMIT 1";
+ $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), DB::formatDateTime($b->getCorrectTime()), intval($blogid), intval($catid));
+ }
+ $row = DB::getRow($query);
+
+ if ( $row )
+ {
+ $itemidnext = $row['inumber'];
+ $itemtitlenext = $row['ititle'];
+ }
+ }
+ elseif ( $archive )
+ {
+ // show archive
+ $type = 'archive';
+
+ // sql queries for the timestamp of the first and the last published item
+ $query = sprintf('SELECT UNIX_TIMESTAMP(itime) as result FROM %s WHERE idraft=0 ORDER BY itime ASC', sql_table('item'));
+ $first_timestamp = DB::getValue($query);
+ $query = sprintf('SELECT UNIX_TIMESTAMP(itime) as result FROM %s WHERE idraft=0 ORDER BY itime DESC', sql_table('item'));
+ $last_timestamp = DB::getValue($query);
+
+ sscanf($archive, '%d-%d-%d', $y, $m, $d);
+
+ if ( $d != 0 )
+ {
+ $archivetype = _LABEL_DAY_UNIT;
+ $t = mktime(0, 0, 0, $m, $d, $y);
+ // one day has 24 * 60 * 60 = 86400 seconds
+ $archiveprev = i18n::formatted_datetime('%Y-%m-%d', $t - 86400 );
+ // check for published items
+ if ( $t > $first_timestamp )
+ {
+ $archiveprevexists = true;
+ }
+ else
+ {
+ $archiveprevexists = false;
+ }
+
+ // one day later
+ $t += 86400;
+ $archivenext = i18n::formatted_datetime('%Y-%m-%d', $t);
+ if ( $t < $last_timestamp )
+ {
+ $archivenextexists = true;
+ }
+ else
+ {
+ $archivenextexists = false;
+ }
+ }
+ elseif ( $m == 0 )
+ {
+ $archivetype = _LABEL_YEAR_UNIT;
+ $t = mktime(0, 0, 0, 12, 31, $y - 1);
+ // one day before is in the previous year
+ $archiveprev = i18n::formatted_datetime('%Y', $t);
+ if ( $t > $first_timestamp )
+ {
+ $archiveprevexists = true;
+ }
+ else
+ {
+ $archiveprevexists = false;
+ }
+
+ // timestamp for the next year
+ $t = mktime(0, 0, 0, 1, 1, $y + 1);
+ $archivenext = i18n::formatted_datetime('%Y', $t);
+ if ( $t < $last_timestamp )
+ {
+ $archivenextexists = true;
+ }
+ else
+ {
+ $archivenextexists = false;
+ }
+ }
+ else
+ {
+ $archivetype = _LABEL_MONTH_UNIT;
+ $t = mktime(0, 0, 0, $m, 1, $y);
+ // one day before is in the previous month
+ $archiveprev = i18n::formatted_datetime('%Y-%m', $t - 86400);
+ if ( $t > $first_timestamp )
+ {
+ $archiveprevexists = true;
+ }
+ else
+ {
+ $archiveprevexists = false;
+ }
+
+ // timestamp for the next month
+ $t = mktime(0, 0, 0, $m+1, 1, $y);
+ $archivenext = i18n::formatted_datetime('%Y-%m', $t);
+ if ( $t < $last_timestamp )
+ {
+ $archivenextexists = true;
+ }
+ else
+ {
+ $archivenextexists = false;
+ }
+ }
+ }
+ elseif ( $archivelist )
+ {
+ $type = 'archivelist';
+
+ if ( is_numeric($archivelist) )
+ {
+ $blogid = intVal($archivelist);
+ }
+ else
+ {
+ $blogid = getBlogIDFromName($archivelist);
+ }
+
+ if ( !$blogid )
+ {
+ doError(_ERROR_NOSUCHBLOG);
+ return;
+ }
+ }
+ elseif ( $query )
+ {
+ global $startpos;
+ $type = 'search';
+ $query = stripslashes($query);
+
+ if ( is_numeric($blogid) )
+ {
+ $blogid = intVal($blogid);
+ }
+ else
+ {
+ $blogid = getBlogIDFromName($blogid);
+ }
+
+ if ( !$blogid )
+ {
+ doError(_ERROR_NOSUCHBLOG);
+ return;
+ }
+ }
+ elseif ( $memberid )
+ {
+ $type = 'member';
+
+ if ( !Member::existsID($memberid) )
+ {
+ doError(_ERROR_NOSUCHMEMBER);
+ return;
+ }
+ $memberinfo = $manager->getMember($memberid);
+ }
+ elseif ( $imagepopup )
+ {
+ // media object (images etc.)
+ $type = 'imagepopup';
+
+ // TODO: check if media-object exists
+ // TODO: set some vars?
+ }
+ else
+ {
+ // show regular index page
+ global $startpos;
+ $type = 'index';
+ }
+
+ // any type of skin with catid
+ if ( $catid && !$blogid )
+ {
+ $blogid = getBlogIDFromCatID($catid);
+ }
+
+ // decide which blog should be displayed
+ if ( !$blogid )
+ {
+ $blogid = $CONF['DefaultBlog'];
+ }
+
+ $b =& $manager->getBlog($blogid);
+ $blog = $b; // references can't be placed in global variables?
+
+ if ( !$blog->isValid )
+ {
+ doError(_ERROR_NOSUCHBLOG);
+ return;
+ }
+
+ // set catid if necessary
+ if ( $catid )
+ {
+ // check if the category is valid
+ if ( !$blog->isValidCategory($catid) )
+ {
+ doError(_ERROR_NOSUCHCATEGORY);
+ return;
+ }
+ else
+ {
+ $blog->setSelectedCategory($catid);
+ }
+ }
+
+ if ( !$skinid )
+ {
+ $skinid = $blog->getDefaultSkin();
+ }
+
+ if ( !empty($special) && isValidShortName($special) )
+ {
+ $type = strtolower($special);
+ }
+
+ $skin =& $manager->getSkin($skinid);
+
+ if ( !$skin->isValid() )
+ {
+ doError(_ERROR_NOSUCHSKIN);
+ return;
+ }
+
+ // set global skinpart variable so can determine quickly what is being parsed from any plugin or phpinclude
+ $skinpart = $type;
+
+ // parse the skin
+ $skin->parse($type);
+
+ // check to see we should throw JustPosted event
+ $blog->checkJustPosted();
+ return;
+}
+
+/**
+ * doError()
+ * Show error skin with given message. An optional skin-object to use can be given
+ *
+ * @param string $msg
+ * @param string $skin
+ * @return void
+ */
+function doError($msg, $skin = '')
+{
+ global $errormessage, $CONF, $skinid, $blogid, $manager;
+
+ if ( $skin == '' )
+ {
+ if ( Skin::existsID($skinid) )
+ {
+ $id = $skinid;
+ }
+ elseif ( $manager->existsBlogID($blogid) )
+ {
+ $blog =& $manager->getBlog($blogid);
+ $id = $blog->getDefaultSkin();
+ }
+ elseif ($CONF['DefaultBlog'] )
+ {
+ $blog =& $manager->getBlog($CONF['DefaultBlog']);
+ $id = $blog->getDefaultSkin();
+ }
+ else
+ {
+ // this statement should actually never be executed
+ $id = $CONF['BaseSkin'];
+ }
+ $skin =& $manager->getSkin($id);
+ }
+
+ $errormessage = $msg;
+ $skin->parse('error');
+ return;
+}
+
+/**
+ * Errors before the database connection has been made
+ *
+ * @param string $msg message to notify
+ * @param string $title page title
+ * @return void
+ */
+function startUpError($msg, $title)
+{
+ header('Content-Type: text/xml; charset=' . i18n::get_current_charset());
+ echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
+ echo "<head>\n";
+ echo "<title>{$title}</title></head>\n";
+ echo "<body>\n";
+ echo "<h1>{$title}</h1>\n";
+ echo $msg;
+ echo "</body>\n";
+ echo "</html>\n";
+ exit;
+}
+
+function isValidShortName($name)
+{
+ return preg_match('#^[a-z0-9]+$#i', $name);
+}
+function isValidDisplayName($name)
+{
+ return preg_match('#^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$#i', $name);
+}
+function isValidCategoryName($name)
+{
+ return 1;
+}
+function isValidTemplateName($name)
+{
+ return preg_match('#^[a-z0-9/_\-]+$#i', $name);
+}
+function isValidSkinName($name)
+{
+ return preg_match('#^[a-z0-9/_\-]+$#i', $name);
+}
+
+// add and remove linebreaks
+function addBreaks($var)
+{
+ return nl2br($var);
+}
+function removeBreaks($var)
+{
+ return preg_replace("/<br \/>([\r\n])/", "$1", $var);
+}
+
+/**
+ * parseFile()
+ *
+ * @param string $filename
+ * @param string $includeMode
+ * @param string $includePrefix
+ * @return void
+ */
+function parseFile($filename, $includeMode = 'normal', $includePrefix = '')
+{
+ global $manager, $skinid;
+
+ if ( !$skinid || !existsID($skinid) )
+ {
+ $skin =& $manager->getSkin($CONF['BaseSkin']);
+ }
+ else
+ {
+ $skin =& $manager->getSkin($skinid);
+ }
+
+ $oldIncludeMode = Parser::getProperty('IncludeMode');
+ $oldIncludePrefix = Parser::getProperty('IncludePrefix');
+
+ $skin->parse('fileparse', $filename);
+
+ Parser::setProperty('IncludeMode', $oldIncludeMode);
+ Parser::setProperty('IncludePrefix', $oldIncludePrefix);
+
+ return;
+}
+
+/**
+ * debug()
+ * Outputs a debug message
+ *
+ * @param string $msg
+ * @return void
+ */
+function debug($msg)
+{
+ echo '<p><b>' . $msg . "</b></p>\n";
+ return;
+}
+
+// shows a link to help file
+function help($id)
+{
+ echo helpHtml($id);
+ return;
+}
+function helpHtml($id)
+{
+ global $CONF;
+ return helplink($id) . '<img src="' . $CONF['AdminURL'] . 'documentation/icon-help.gif" width="15" height="15" alt="' . _HELP_TT . '" title="' . _HELP_TT . '" /></a>';
+}
+function helplink($id)
+{
+ global $CONF;
+ return '<a href="' . $CONF['AdminURL'] . 'documentation/help.html#'. $id . '" onclick="if (event && event.preventDefault) event.preventDefault(); return help(this.href);">';
+}
+
+/**
+ * includephp()
+ * Includes a PHP file. This method can be called while parsing templates and skins
+ *
+ * @param string $filename name of file to parse
+ * @return void
+ */
+function includephp($filename)
+{
+ // make predefined variables global, so most simple scripts can be used here
+
+ // apache (names taken from PHP doc)
+ global $GATEWAY_INTERFACE, $SERVER_NAME, $SERVER_SOFTWARE, $SERVER_PROTOCOL;
+ global $REQUEST_METHOD, $QUERY_STRING, $DOCUMENT_ROOT, $HTTP_ACCEPT;
+ global $HTTP_ACCEPT_CHARSET, $HTTP_ACCEPT_ENCODING, $HTTP_ACCEPT_LANGUAGE;
+ global $HTTP_CONNECTION, $HTTP_HOST, $HTTP_REFERER, $HTTP_USER_AGENT;
+ global $REMOTE_ADDR, $REMOTE_PORT, $SCRIPT_FILENAME, $SERVER_ADMIN;
+ global $SERVER_PORT, $SERVER_SIGNATURE, $PATH_TRANSLATED, $SCRIPT_NAME;
+ global $REQUEST_URI;
+
+ // php (taken from PHP doc)
+ global $argv, $argc, $PHP_SELF, $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS;
+ global $HTTP_POST_FILES, $HTTP_ENV_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS;
+
+ // other
+ global $PATH_INFO, $HTTPS, $HTTP_RAW_POST_DATA, $HTTP_X_FORWARDED_FOR;
+
+ if ( @file_exists($filename) )
+ {
+ include($filename);
+ }
+ return;
+}
+
+/**
+ * Checks if a certain plugin exists
+ * @param string $plug name of plugin
+ * @return boolean exists or not
+ */
+function checkPlugin($name)
+{
+ global $DIR_PLUGINS;
+ return file_exists($DIR_PLUGINS . preg_replace('#[\\\\|/]#', '', $name) . '.php');
+}
+
+/**
+ * alterQueryStr()
+ *
+ * @param string $querystr querystring to alter (e.g. foo=1&bar=2&x=y)
+ * @param string $param name of parameter to change (e.g. 'foo')
+ * @param string $value New value for that parameter (e.g. 3)
+ * @return string altered query string (for the examples above: foo=3&bar=2&x=y)
+ */
+function alterQueryStr($querystr, $param, $value)
+{
+ $vars = preg_split('#&#', $querystr);
+ $set = FALSE;
+
+ for ( $i = 0; $i < count($vars); $i++ )
+ {
+ $v = preg_split('#=#', $vars[$i]);
+
+ if ( $v[0] == $param )
+ {
+ $v[1] = $value;
+ $vars[$i] = implode('=', $v);
+ $set = true;
+ break;
+ }
+ }
+ if ( !$set )
+ {
+ $vars[] = "{$param}={$value}";
+ }
+ return ltrim(implode('&', $vars), '&');
+}
+
+/**
+ * passVar()
+ * passes one variable as hidden input field (multiple fields for arrays)
+ * @see passRequestVars in varsx.x.x.php
+ *
+ * @param string $key
+ * @param string $value
+ * @return void
+ */
+function passVar($key, $value)
+{
+ // array ?
+ if ( is_array($value) )
+ {
+ for ( $i = 0; $i < sizeof($value); $i++ )
+ {
+ passVar($key . '[' . $i . ']', $value[$i]);
+ }
+ return;
+ }
+
+ // other values: do stripslashes if needed
+ echo '<input type="hidden" name="' . Entity::hsc($key) . '" value="' . Entity::hsc(undoMagic($value)) . '" />' . "\n";
+ return;
+}
+
+/**
+ * checkVars()
+ *
+ * @param string $variables
+ * @return void
+ */
+function checkVars($variables)
+{
+ foreach ( $variables as $variable )
+ {
+ if ( array_key_exists($variable, $_GET)
+ || array_key_exists($variable, $_POST)
+ || array_key_exists($variable, $_COOKIE)
+ || array_key_exists($variable, $_ENV)
+ || (session_id() !== '' && array_key_exists($variable, $_SESSION))
+ || array_key_exists($variable, $_FILES) )
+ {
+ die('Sorry. An error occurred.');
+ }
+ }
+ return;
+}
+
+/**
+ * sanitizeParams()
+ * Sanitize parameters such as $_GET and $_SERVER['REQUEST_URI'] etc.
+ * to avoid XSS.
+ *
+ * @param void
+ * @return void
+ */
+function sanitizeParams()
+{
+ $array = array();
+ $str = '';
+ $frontParam = '';
+
+ // REQUEST_URI of $_SERVER
+ $str =& $_SERVER["REQUEST_URI"];
+ serverStringToArray($str, $array, $frontParam);
+ sanitizeArray($array);
+ arrayToServerString($array, $frontParam, $str);
+
+ // QUERY_STRING of $_SERVER
+ $str =& $_SERVER["QUERY_STRING"];
+ serverStringToArray($str, $array, $frontParam);
+ sanitizeArray($array);
+ arrayToServerString($array, $frontParam, $str);
+
+ // $_GET
+ convArrayForSanitizing($_GET, $array);
+ sanitizeArray($array);
+ revertArrayForSanitizing($array, $_GET);
+
+ // $_REQUEST (only GET param)
+ convArrayForSanitizing($_REQUEST, $array);
+ sanitizeArray($array);
+ revertArrayForSanitizing($array, $_REQUEST);
+
+ return;
+}
+
+function _addInputTags(&$keys,$prefix='')
+{
+ foreach ( $keys as $key=>$value )
+ {
+ if ( $prefix )
+ {
+ $key=$prefix.'['.$key.']';
+ }
+ if ( is_array($value) )
+ {
+ _addInputTags($value,$key);
+ }
+ else
+ {
+ if ( get_magic_quotes_gpc() )
+ {$value=stripslashes($value);
+ }
+ if ( $key == 'ticket' )
+ {
+ continue;
+ }
+ echo '<input type="hidden" name="'.Entity::hsc($key).
+ '" value="'.Entity::hsc($value).'" />'."\n";
+ }
+ }
+ return;
+}
+
+/**
+ * serverStringToArray()
+ * Convert the server string such as $_SERVER['REQUEST_URI']
+ * to arry like arry['blogid']=1 and array['page']=2 etc.
+ *
+ * @param string $uri string
+ * @param string &$query_elements elements of query according to application/x-www-form-urlencoded
+ * @param string &$hier_part hierarchical part includes path
+ *
+ * NOTE:
+ * RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax
+ * 3. Syntax Components
+ * http://www.ietf.org/rfc/rfc3986.txt
+ *
+ * Hypertext Markup Language - 2.0
+ * 8.2.1. The form-urlencoded Media Type
+ * http://tools.ietf.org/html/rfc1866#section-8.2.1
+ *
+ * $_SERVER > Language Reference > Predefined Variables > PHP Manual
+ * http://www.php.net/manual/en/reserved.variables.server.php
+ */
+function serverStringToArray($uri, &$query_elements, &$hier_part)
+{
+ // init param
+ $query_elements = array();
+ $hier_part = "";
+
+ // split hierarchical part, e.g. /index.php, query and fragment, e.g. blogid=1&page=2#section1
+ if ( i18n::strpos($uri, "?") > 0 )
+ {
+ list($hier_part, $query_and_fragment) = preg_split("#\?#", $uri, 2);
+ }
+ else
+ {
+ $query_and_fragment = $uri;
+ $hier_part = '';
+ }
+
+ // If there is no query like blogid=1&page=2, return
+ if ( i18n::strpos($uri, "=") == FALSE && !i18n::strlen($hier_part) )
+ {
+ $hier_part = $uri;
+ return;
+ }
+
+ $query_elements = preg_split("#&#", $query_and_fragment);
+ return;
+}
+
+/**
+ * arrayToServerString()
+ * Convert array like array['blogid'] to server string
+ * such as $_SERVER['REQUEST_URI']
+ *
+ * @param array $query_elements elements of query according to application/x-www-form-urlencoded
+ * @param string $hier_part hier-part defined in RFC3986
+ * @param string &$uri return value
+ * @return void
+ *
+ * NOTE:
+ * RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax
+ * 3. Syntax Components
+ * http://www.ietf.org/rfc/rfc3986.txt
+ *
+ * Hypertext Markup Language - 2.0
+ * 8.2.1. The form-urlencoded Media Type
+ * http://tools.ietf.org/html/rfc1866#section-8.2.1
+ *
+ * $_SERVER > Language Reference > Predefined Variables > PHP Manual
+ * http://www.php.net/manual/en/reserved.variables.server.php
*/
-if ( !array_key_exists('URLMode', $CONF) || ($CONF['URLMode'] != 'pathinfo') )
- {\r
- $CONF['URLMode'] = 'normal';
- }\r
-else
- {\r
- if ( i18n::substr($CONF['Self'], i18n::strlen($CONF['Self']) - 4) != '.php' )
- {\r
- decodePathInfo($virtualpath);
- }\r
-}\r
-\r
-/*\r
- * PostParseURL is a place to cleanup any of the path-related global variables before the selector function is run.\r
- * It has 2 values in the data in case the original virtualpath is needed, but most the use will be in tweaking\r
- * global variables to clean up (scrub out catid or add catid) or to set someother global variable based on\r
- * the values of something like catid or itemid\r
- * New in 3.60\r
- */\r
-$data = array(\r
- 'type' => basename(serverVar('SCRIPT_NAME')),\r
- 'info' => $virtualpath\r
-);\r
-$manager->notify('PostParseURL', $data);\r
-\r
-/*\r
- * NOTE: Here is the end of initialization\r
- */\r
-\r
-/**\r
- * include_libs()\r
- * This function includes or requires the specified library file\r
- * \r
- * @param string $file\r
- * @param boolean $once use the _once() version\r
- * @param boolean $require use require() instead of include()\r
- * @return void\r
- */\r
-function include_libs($file, $once = TRUE, $require = TRUE)\r
-{\r
- global $DIR_LIBS;\r
- \r
- // $DIR_LIBS isn't a directory\r
- if ( !is_dir($DIR_LIBS) )\r
- {\r
- exit;\r
- }\r
- \r
- $lib_path = $DIR_LIBS . $file;\r
- \r
- if ( $once && $require )\r
- {\r
- require_once($lib_path);\r
- }\r
- else if ( $once && !$require )\r
- {\r
- include_once($lib_path);\r
- }\r
- else if ( $require )\r
- {\r
- require($lib_path);\r
- }\r
- else\r
- {\r
- include($lib_path);\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * include_plugins()\r
- * This function includes or requires the specified plugin file\r
- * \r
- * @param string $file\r
- * @param boolean $once use the _once() version\r
- * @param boolean $require use require() instead of include()\r
- * @return \r
- */\r
-function include_plugins($file, $once = TRUE, $require = TRUE)\r
-{\r
- global $DIR_PLUGINS;\r
- \r
- // begin if: $DIR_LIBS isn't a directory\r
- if ( !is_dir($DIR_PLUGINS) )\r
- {\r
- exit;\r
- }\r
- \r
- $plugin_path = $DIR_PLUGINS . $file;\r
- \r
- // begin if: \r
- if ( $once && $require )\r
- {\r
- require_once($plugin_path);\r
- }\r
- else if ( $once && !$require )\r
- {\r
- include_once($plugin_path);\r
- }\r
- elseif ( $require )\r
- {\r
- require($plugin_path);\r
- }\r
- else\r
- {\r
- include($plugin_path);\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * include_translation()\r
- * This function decide which locale is used and include translation\r
- * \r
- * @param string &$locale locale name referring to 'language tags' defined in RFC 5646\r
- * @return void\r
- */\r
-function include_translation(&$locale)\r
-{\r
- global $DIR_LOCALES;\r
- \r
- $translation_file = $DIR_LOCALES . $locale . '.' . i18n::get_current_charset() . '.php';\r
- if ( !file_exists($translation_file) )\r
- {\r
- $locale = 'en_Latn_US';\r
- $translation_file = $DIR_LOCALES . 'en_Latn_US.ISO-8859-1.php';\r
- }\r
- include($translation_file);\r
- return;\r
-}\r
-\r
-/**\r
- * intPostVar()\r
- * This function returns the integer value of $_POST for the variable $name\r
- * \r
- * @param string $name field to get the integer value of\r
- * @return integer\r
- */\r
-function intPostVar($name)\r
-{\r
- return (integer) postVar($name);\r
-}\r
-\r
-\r
-/**\r
- * intGetVar()\r
- * This function returns the integer value of $_GET for the variable $name\r
- * \r
- * @param string $name field to get the integer value of\r
- * @return integer\r
- */\r
-function intGetVar($name)\r
-{\r
- return (integer) getVar($name);\r
-}\r
-\r
-\r
-/**\r
- * intRequestVar()\r
- * This function returns the integer value of $_REQUEST for the variable $name. Also checks $_GET and $_POST if not found in $_REQUEST\r
- * \r
- * @param string $name field to get the integer value of\r
- * @return int\r
- */\r
-function intRequestVar($name)\r
-{\r
- return (integer) requestVar($name);\r
-}\r
-\r
-\r
-/**\r
- * intCookieVar()\r
- * This function returns the integer value of $_COOKIE for the variable $name\r
- * \r
- * @param string $name field to get the integer value of\r
- * @return integer\r
- */\r
-function intCookieVar($name)\r
-{\r
- return (integer) cookieVar($name);\r
-}\r
-\r
-/**\r
- * getNucleusVersion()\r
- * This function returns the current Nucleus version (100 = 1.00, 101 = 1.01, etc...)\r
- * \r
- * @param void\r
- * @return integer\r
- */\r
-function getNucleusVersion()\r
-{\r
- return 400;\r
-}\r
-\r
-/**\r
- * getNucleusPatchLevel()\r
- * TODO: Better description of this function.\r
- *\r
- * Power users can install patches in between nucleus releases. These patches\r
- * usually add new functionality in the plugin API and allow those to\r
- * be tested without having to install CVS.\r
- *\r
- *@param void\r
- * @return integer\r
- */\r
-function getNucleusPatchLevel()\r
-{\r
- return 0;\r
-}\r
-\r
-/**\r
- * getLatestVersion()\r
- * This function returns the latest Nucleus version available for download from nucleuscms.org or FALSE if unable to attain data\r
- * Format will be major.minor/patachlevel e.g. 3.41 or 3.41/02\r
- * \r
- * @param void\r
- * @return mixed\r
- */\r
-function getLatestVersion()\r
-{\r
- // begin if: cURL is not available in this PHP installation\r
- if ( !function_exists('curl_init') )\r
- {\r
- return FALSE;\r
- }\r
- \r
- $curl = curl_init();\r
- $timeout = 5;\r
- \r
- curl_setopt ($curl, CURLOPT_URL, 'http://nucleuscms.org/version_check.php');\r
- curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);\r
- curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);\r
- \r
- $return = curl_exec($curl);\r
- \r
- curl_close($curl);\r
- \r
- return $return;\r
-}\r
-\r
-/**\r
- * sql_table()\r
- * This function returns a Nucleus table name with the appropriate prefix\r
- * @param string $name\r
- * @return string\r
- */\r
-function sql_table($name)\r
-{\r
- global $MYSQL_PREFIX;\r
- \r
- // begin if: no MySQL prefix\r
- if ( empty($MYSQL_PREFIX) )\r
- {\r
- return 'nucleus_' . $name;\r
- }\r
- // else: use MySQL prefix\r
- else\r
- {\r
- return $MYSQL_PREFIX . 'nucleus_' . $name;\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * sendContentType()\r
- * This function sends the Content-Type header if headers have not already been sent\r
- * It also determines if the browser can accept application/xhtml+xml and sends it only to those that can.\r
- * \r
- * if content type is application/xhtml+xml, only send it to browsers\r
- * that can handle it (IE6 cannot). Otherwise, send text/html\r
- *\r
- * v2.5:\r
- * For admin area pages, keep sending text/html (unless it's a debug version)\r
- * application/xhtml+xml still causes too much problems with the javascript implementations\r
- *\r
- * v3.3:\r
- * ($CONF['UsingAdminArea'] && !$CONF['debug']) gets removed,\r
- * application/xhtml+xml seems to be working, so we're going to use it if we can.\r
- * \r
- * @param string $content_type MIME media type registered to IANA, http://www.iana.org/assignments/media-types/index.html\r
- * @param string $page_type \r
- * @param string $charset Deprecated. This has no meaning.\r
- * @return void\r
- * \r
- */\r
-function sendContentType($content_type, $page_type = '', $charset = '')\r
-{\r
- global $manager, $CONF;\r
- \r
- if ( headers_sent() )\r
- {\r
- return;\r
- }\r
- \r
- /* NOTE: MIME Media Type */\r
- if ( ($content_type == 'application/xhtml+xml')\r
- && (!stristr(serverVar('HTTP_ACCEPT'), 'application/xhtml+xml') ) )\r
- {\r
- $content_type = 'text/html';\r
- }\r
- \r
- /* NOTE: generate event */\r
- $data = array(\r
- 'pageType' => $page_type,\r
- 'contentType' => &$content_type\r
- );\r
- $manager->notify('PreSendContentType', $data);\r
- \r
- /* NOTE: confirm MIME Media Type */\r
- $content_type = preg_replace('#[^a-zA-Z0-9-+./]#', '', $content_type);\r
- \r
- /* NOTE: confirm character set */\r
- $charset = i18n::get_current_charset();\r
- if ( i18n::get_forced_charset() !== '' )\r
- {\r
- $charset = i18n::get_forced_charset();\r
- }\r
- \r
- /* NOTE: send HTTP 1.1 header */\r
- header("Content-Type: {$content_type}; charset={$charset}");\r
- \r
- /* NOTE: set handler for translating character set */\r
- if ( $charset != i18n::get_current_charset() )\r
- {\r
- ob_start(array('i18n', 'convert_handler'));\r
- }\r
- \r
- return;\r
-}\r
-\r
-/**\r
- * parseHighlight()\r
- * This function parses a query into an array of expressions that can be passed on to the highlight method\r
- * @param string $query\r
- * @return void\r
- */\r
-function parseHighlight($query)\r
-{\r
- // TODO: add more intelligent splitting logic\r
- \r
- // get rid of quotes\r
- $query = preg_replace('/\'|"/', '', $query);\r
- \r
- if ( !$query )\r
- {\r
- return array();\r
- }\r
- \r
- $aHighlight = preg_split('# #', $query);\r
- \r
- for ( $i = 0; $i < count($aHighlight); $i++ )\r
- {\r
- $aHighlight[$i] = trim($aHighlight[$i]);\r
- \r
- if ( i18n::strlen($aHighlight[$i]) < 3 )\r
- {\r
- unset($aHighlight[$i]);\r
- }\r
- }\r
- \r
- if ( count($aHighlight) == 1 )\r
- {\r
- return $aHighlight[0];\r
- }\r
- else\r
- {\r
- return $aHighlight;\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * getConfig()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
-function getConfig()\r
-{\r
- global $CONF;\r
- \r
- $query = sprintf('SELECT * FROM %s', sql_table('config'));\r
- $res = DB::getResult($query);\r
- \r
- foreach ( $res as $row )\r
- {\r
- $CONF[$row['name']] = $row['value'];\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * This function gets the blog ID from the blog name\r
- * @param string $name\r
- * @return\r
- */\r
-function getBlogIDFromName($name)\r
-{\r
- $query = sprintf('SELECT bnumber AS result FROM %s WHERE bshortname=%s', sql_table('blog'), DB::quoteValue($name));\r
- return DB::getValue($query);\r
-}\r
-\r
-/**\r
- * This function gets the blog name from the blog ID\r
- * @param int $id\r
- * @return object\r
- */\r
-function getBlogNameFromID($id)\r
-{\r
- $query = sprintf('SELECT bname AS result FROM %s WHERE bnumber=%d', sql_table('blog'), intval($id));\r
- return DB::getValue($query);\r
-}\r
-\r
-/**\r
- * This function gets the blog ID from the item ID\r
- * @param int $item_id\r
- * @return object\r
- */\r
-function getBlogIDFromItemID($item_id)\r
-{\r
- $query = sprintf('SELECT iblog AS result FROM %s WHERE inumber=%d', sql_table('item'), intval($item_id));\r
- return DB::getValue($query);\r
-}\r
-\r
-/**\r
- * This function gets the blog ID from the comment ID\r
- * @param int $comment_id\r
- * @return object\r
- */\r
-function getBlogIDFromCommentID($comment_id)\r
-{\r
- $query = sprintf('SELECT cblog AS result FROM %s WHERE cnumber=%d', sql_table('comment'), intval($comment_id));\r
- return DB::getValue($query);\r
-}\r
-\r
-/**\r
- * This function gets the blog ID from the category ID\r
- * @param int $category_id\r
- * @return object\r
- */\r
-function getBlogIDFromCatID($category_id)\r
-{\r
- $query = sprintf('SELECT cblog AS result FROM %s WHERE catid=%d', sql_table('category'), intval($category_id));\r
- return DB::getValue($query);\r
-}\r
-\r
-/**\r
- * This function gets the category ID from the category name\r
- * @param int $name\r
- * @return object\r
- */\r
-function getCatIDFromName($name)\r
-{\r
- $query = sprintf('SELECT catid AS result FROM %s WHERE cname=%s', sql_table('category'), DB::quoteValue($name));\r
- return DB::getValue($query);\r
-}\r
-\r
-\r
-/**\r
- * functions to be used in index.php to select something\r
- */\r
-function selectBlog($shortname)\r
-{\r
- global $blogid, $archivelist;\r
- $blogid = getBlogIDFromName($shortname);\r
- \r
- // also force archivelist variable, if it is set\r
- if ( $archivelist )\r
- {\r
- $archivelist = $blogid;\r
- }\r
- return;\r
-}\r
-function selectSkin($skinname)\r
-{\r
- global $skinid;\r
- $skinid = SKIN::getIdFromName($skinname);\r
- return;\r
-}\r
-function selectCategory($cat)\r
-{\r
- global $catid;\r
- if ( is_numeric($cat) )\r
- {\r
- $catid = (integer) $cat;\r
- }\r
- else\r
- {\r
- $catid = getCatIDFromName($cat);\r
- }\r
- return;\r
-}\r
-function selectItem($id)\r
-{\r
- global $itemid;\r
- $itemid = (integer) $id;\r
- return;\r
-}\r
-function selectSpecialSkinType($id)\r
-{\r
- global $special;\r
- $special = strtolower($id);\r
- return;\r
-}\r
-function selector()\r
-{\r
- global $archive, $archivelist, $archivenext, $archivenextexists, $archiveprev, $archiveprevexists, $archivetype;\r
- global $blog, $blogid;\r
- global $catid;\r
- global $itemid, $itemidnext, $itemidprev, $itemtitlenext, $itemtitleprev;\r
- global $CONF, $DIR_LIBS, $amount, $errormessage, $imagepopup;\r
- global $manager, $maxresults, $query;\r
- global $member, $memberid, $memberinfo;\r
- global $skinid, $skinpart, $special;\r
- \r
- $actionNames = array('addcomment', 'sendmessage', 'createaccount', 'forgotpassword', 'votepositive', 'votenegative', 'plugin');\r
- $action = requestVar('action');\r
- \r
- if ( in_array($action, $actionNames) )\r
- {\r
- include_once($DIR_LIBS . 'ACTION.php');\r
- $a = new Action();\r
- $errorInfo = $a->doAction($action);\r
- \r
- if ( $errorInfo )\r
- {\r
- $errormessage = $errorInfo['message'];\r
- }\r
- }\r
- \r
- // show error when headers already sent out\r
- if ( headers_sent() && $CONF['alertOnHeadersSent'] )\r
- {\r
- // try to get line number/filename (extra headers_sent params only exists in PHP 4.3+)\r
- if ( function_exists('version_compare') && version_compare('4.3.0', phpversion(), '<=') )\r
- {\r
- headers_sent($hsFile, $hsLine);\r
- $extraInfo = ' in <code>' . $hsFile . '</code> line <code>' . $hsLine . '</code>';\r
- }\r
- else\r
- {\r
- $extraInfo = '';\r
- }\r
- \r
- startUpError(\r
- "<p>The page headers have already been sent out{$extraInfo}. This could cause Nucleus not to work in the expected way.</p>"\r
- . "<p>Usually, this is caused by spaces or newlines at the end of the <code>config.php</code> file, "\r
- . "at the end of the translation file or at the end of a plugin file.</p>"\r
- . "<p>Please check this and try again.</p>"\r
- . "<p>If you don't want to see this error message again, without solving the problem, "\r
- . "set <code>{$CONF['alertOnHeadersSent']}</code> in <code>globalfunctions.php</code> to <code>0</code></p>"\r
- . "Page headers already sent"\r
- );\r
- exit;\r
- }\r
- \r
- // make is so ?archivelist without blogname or blogid shows the archivelist\r
- // for the default weblog\r
- if ( serverVar('QUERY_STRING') == 'archivelist' )\r
- {\r
- $archivelist = $CONF['DefaultBlog'];\r
- }\r
- \r
- // now decide which type of skin we need\r
- if ( $itemid )\r
- {\r
- // itemid given -> only show that item\r
- $type = 'item';\r
- \r
- if ( !$manager->existsItem($itemid,intval($CONF['allowFuture']),intval($CONF['allowDrafts'])) )\r
- {\r
- doError(_ERROR_NOSUCHITEM);\r
- return;\r
- }\r
- \r
- // 1. get timestamp, blogid and catid for item\r
- $query = 'SELECT itime, iblog, icat FROM %s WHERE inumber=%d';\r
- $query = sprintf($query, sql_table('item'), intval($itemid));\r
- $row = DB::getRow($query);\r
- \r
- // if a different blog id has been set through the request or selectBlog(),\r
- // deny access\r
- \r
- if ( $blogid && (intval($blogid) != $row['iblog']) )\r
- {\r
- doError(_ERROR_NOSUCHITEM);\r
- return;\r
- }\r
- \r
- // if a category has been selected which doesn't match the item, ignore the\r
- // category. #85\r
- if ( ($catid != 0) && ($catid != $row['icat']) )\r
- {\r
- $catid = 0;\r
- }\r
- \r
- $blogid = $row['iblog'];\r
- $timestamp = strtotime($row['itime']);\r
- \r
- $b =& $manager->getBlog($blogid);\r
- \r
- if ( !$b->isValidCategory($catid) )\r
- {\r
- $query = "SELECT inumber, ititle FROM %s WHERE itime<%s AND idraft=0 AND iblog=%d ORDER BY itime DESC LIMIT 1";\r
- $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), intval($blogid));\r
- }\r
- else\r
- {\r
- $query = "SELECT inumber, ititle FROM %s WHERE itime<%s AND idraft=0 AND iblog=%d AND icat=%d ORDER BY itime DESC LIMIT 1";\r
- $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), intval($blogid), intval($catid));\r
- }\r
- $row = DB::getRow($query);\r
- \r
- if ( $row )\r
- {\r
- $itemidprev = $row['inumber'];\r
- $itemtitleprev = $row['ititle'];\r
- }\r
- \r
- // get next itemid and title\r
- if ( !$b->isValidCategory($catid) )\r
- {\r
- $query = "SELECT inumber, ititle FROM %s WHERE itime>%s AND itime<=%s AND idraft=0 AND iblog=%d ORDER BY itime ASC LIMIT 1";\r
- $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), DB::formatDateTime($b->getCorrectTime()), intval($blogid));\r
- }\r
- else\r
- {\r
- $query = "SELECT inumber, ititle FROM %s WHERE itime>%s AND itime<=%s AND idraft=0 AND iblog=%d AND icat=%d ORDER BY itime ASC LIMIT 1";\r
- $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), DB::formatDateTime($b->getCorrectTime()), intval($blogid), intval($catid));\r
- }\r
- $row = DB::getRow($query);\r
- \r
- if ( $row )\r
- {\r
- $itemidnext = $row['inumber'];\r
- $itemtitlenext = $row['ititle'];\r
- }\r
- }\r
- elseif ( $archive )\r
- {\r
- // show archive\r
- $type = 'archive';\r
- \r
- // sql queries for the timestamp of the first and the last published item\r
- $query = sprintf('SELECT UNIX_TIMESTAMP(itime) as result FROM %s WHERE idraft=0 ORDER BY itime ASC', sql_table('item'));\r
- $first_timestamp = DB::getValue($query);\r
- $query = sprintf('SELECT UNIX_TIMESTAMP(itime) as result FROM %s WHERE idraft=0 ORDER BY itime DESC', sql_table('item'));\r
- $last_timestamp = DB::getValue($query);\r
- \r
- sscanf($archive, '%d-%d-%d', $y, $m, $d);\r
- \r
- if ( $d != 0 )\r
- {\r
- $archivetype = _LABEL_DAY_UNIT;\r
- $t = mktime(0, 0, 0, $m, $d, $y);\r
- // one day has 24 * 60 * 60 = 86400 seconds\r
- $archiveprev = i18n::formatted_datetime('%Y-%m-%d', $t - 86400 );\r
- // check for published items\r
- if ( $t > $first_timestamp )\r
- {\r
- $archiveprevexists = true;\r
- }\r
- else\r
- {\r
- $archiveprevexists = false;\r
- }\r
- \r
- // one day later\r
- $t += 86400;\r
- $archivenext = i18n::formatted_datetime('%Y-%m-%d', $t);\r
- if ( $t < $last_timestamp )\r
- {\r
- $archivenextexists = true;\r
- }\r
- else\r
- {\r
- $archivenextexists = false;\r
- }\r
- }\r
- elseif ( $m == 0 )\r
- {\r
- $archivetype = _LABEL_YEAR_UNIT;\r
- $t = mktime(0, 0, 0, 12, 31, $y - 1);\r
- // one day before is in the previous year\r
- $archiveprev = i18n::formatted_datetime('%Y', $t);\r
- if ( $t > $first_timestamp )\r
- {\r
- $archiveprevexists = true;\r
- }\r
- else\r
- {\r
- $archiveprevexists = false;\r
- }\r
- \r
- // timestamp for the next year\r
- $t = mktime(0, 0, 0, 1, 1, $y + 1);\r
- $archivenext = i18n::formatted_datetime('%Y', $t);\r
- if ( $t < $last_timestamp )\r
- {\r
- $archivenextexists = true;\r
- }\r
- else\r
- {\r
- $archivenextexists = false;\r
- }\r
- }\r
- else\r
- {\r
- $archivetype = _LABEL_MONTH_UNIT;\r
- $t = mktime(0, 0, 0, $m, 1, $y);\r
- // one day before is in the previous month\r
- $archiveprev = i18n::formatted_datetime('%Y-%m', $t - 86400);\r
- if ( $t > $first_timestamp )\r
- {\r
- $archiveprevexists = true;\r
- }\r
- else\r
- {\r
- $archiveprevexists = false;\r
- }\r
- \r
- // timestamp for the next month\r
- $t = mktime(0, 0, 0, $m+1, 1, $y);\r
- $archivenext = i18n::formatted_datetime('%Y-%m', $t);\r
- if ( $t < $last_timestamp )\r
- {\r
- $archivenextexists = true;\r
- }\r
- else\r
- {\r
- $archivenextexists = false;\r
- }\r
- }\r
- }\r
- elseif ( $archivelist )\r
- {\r
- $type = 'archivelist';\r
- \r
- if ( is_numeric($archivelist) )\r
- {\r
- $blogid = intVal($archivelist);\r
- }\r
- else\r
- {\r
- $blogid = getBlogIDFromName($archivelist);\r
- }\r
- \r
- if ( !$blogid )\r
- {\r
- doError(_ERROR_NOSUCHBLOG);\r
- return;\r
- }\r
- }\r
- elseif ( $query )\r
- {\r
- global $startpos;\r
- $type = 'search';\r
- $query = stripslashes($query);\r
- \r
- if ( is_numeric($blogid) )\r
- {\r
- $blogid = intVal($blogid);\r
- }\r
- else\r
- {\r
- $blogid = getBlogIDFromName($blogid);\r
- }\r
- \r
- if ( !$blogid )\r
- {\r
- doError(_ERROR_NOSUCHBLOG);\r
- return;\r
- }\r
- }\r
- elseif ( $memberid )\r
- {\r
- $type = 'member';\r
- \r
- if ( !Member::existsID($memberid) )\r
- {\r
- doError(_ERROR_NOSUCHMEMBER);\r
- return;\r
- }\r
- $memberinfo = $manager->getMember($memberid);\r
- }\r
- elseif ( $imagepopup )\r
- {\r
- // media object (images etc.)\r
- $type = 'imagepopup';\r
- \r
- // TODO: check if media-object exists\r
- // TODO: set some vars?\r
- }\r
- else\r
- {\r
- // show regular index page\r
- global $startpos;\r
- $type = 'index';\r
- }\r
- \r
- // any type of skin with catid\r
- if ( $catid && !$blogid )\r
- {\r
- $blogid = getBlogIDFromCatID($catid);\r
- }\r
- \r
- // decide which blog should be displayed\r
- if ( !$blogid )\r
- {\r
- $blogid = $CONF['DefaultBlog'];\r
- }\r
- \r
- $b =& $manager->getBlog($blogid);\r
- $blog = $b; // references can't be placed in global variables?\r
- \r
- if ( !$blog->isValid )\r
- {\r
- doError(_ERROR_NOSUCHBLOG);\r
- return;\r
- }\r
- \r
- // set catid if necessary\r
- if ( $catid )\r
- {\r
- // check if the category is valid\r
- if ( !$blog->isValidCategory($catid) )\r
- {\r
- doError(_ERROR_NOSUCHCATEGORY);\r
- return;\r
- }\r
- else\r
- {\r
- $blog->setSelectedCategory($catid);\r
- }\r
- }\r
- \r
- if ( !$skinid )\r
- {\r
- $skinid = $blog->getDefaultSkin();\r
- }\r
- \r
- if ( !empty($special) && isValidShortName($special) )\r
- {\r
- $type = strtolower($special);\r
- }\r
- \r
- $skin =& $manager->getSkin($skinid);\r
- \r
- if ( !$skin->isValid() )\r
- {\r
- doError(_ERROR_NOSUCHSKIN);\r
- return;\r
- }\r
- \r
- // set global skinpart variable so can determine quickly what is being parsed from any plugin or phpinclude\r
- $skinpart = $type;\r
- \r
- // parse the skin\r
- $skin->parse($type);\r
- \r
- // check to see we should throw JustPosted event\r
- $blog->checkJustPosted();\r
- return;\r
-}\r
-\r
-/**\r
- * doError()\r
- * Show error skin with given message. An optional skin-object to use can be given\r
- * \r
- * @param string $msg\r
- * @param string $skin\r
- * @return void\r
- */\r
-function doError($msg, $skin = '')\r
-{\r
- global $errormessage, $CONF, $skinid, $blogid, $manager;\r
- \r
- if ( $skin == '' )\r
- {\r
- if ( Skin::existsID($skinid) )\r
- {\r
- $id = $skinid;\r
- }\r
- elseif ( $manager->existsBlogID($blogid) )\r
- {\r
- $blog =& $manager->getBlog($blogid);\r
- $id = $blog->getDefaultSkin();\r
- }\r
- elseif ($CONF['DefaultBlog'] )\r
- {\r
- $blog =& $manager->getBlog($CONF['DefaultBlog']);\r
- $id = $blog->getDefaultSkin();\r
- }\r
- else\r
- {\r
- // this statement should actually never be executed\r
- $id = $CONF['BaseSkin'];\r
- }\r
- $skin =& $manager->getSkin($id);\r
- }\r
- \r
- $errormessage = $msg;\r
- $skin->parse('error');\r
+function arrayToServerString($query_elements, $hier_part, &$uri)
+{
+ if ( i18n::strpos($uri, "?") !== FALSE )
+ {
+ $uri = $hier_part . "?";
+ }
+ else
+ {
+ $uri = $hier_part;
+ }
+ if ( count($query_elements) > 0 )
+ {
+ $uri .= implode("&", $query_elements);
+ }
+ return;
+}
+
+/**
+ * sanitizeArray()
+ * Sanitize array parameters.
+ * This function checks both key and value.
+ * - check key if it inclues " (double quote), remove from array
+ * - check value if it includes \ (escape sequece), remove remaining string
+ *
+ * @param array &$array elements of query according to application/x-www-form-urlencoded
+ * @return void
+ */
+function sanitizeArray(&$array)
+{
+ $excludeListForSanitization = array('query');
+
+ foreach ( $array as $k => $v )
+ {
+ // split to key and value
+ list($key, $val) = preg_split("#=#", $v, 2);
+ if ( !isset($val) )
+ {
+ continue;
+ }
+
+ // when magic quotes is on, need to use stripslashes,
+ // and then addslashes
+ if ( get_magic_quotes_gpc() )
+ {
+ $val = stripslashes($val);
+ }
+
+ // note that we must use addslashes here because this function is called before the db connection is made
+ // and sql_real_escape_string needs a db connection
+ $val = addslashes($val);
+
+ // if $key is included in exclude list, skip this param
+ if ( !in_array($key, $excludeListForSanitization) )
+ {
+ // check value
+ if ( i18n::strpos($val, '\\') > 0 )
+ {
+ list($val, $tmp) = preg_split('#\\\\#', $val);
+ }
+
+ // remove control code etc.
+ $val = strtr($val, "\0\r\n<>'\"", " ");
+
+ // check key
+ if ( preg_match('#\"#', $key) > 0 )
+ {
+ unset($array[$k]);
+ continue;
+ }
+
+ // set sanitized info
+ $array[$k] = sprintf("%s=%s", $key, $val);
+ }
+ }
+ return;
+}
+
+/**
+ * convArrayForSanitizing()
+ * Convert array for sanitizeArray function
+ *
+ * @param string $src array to be sanitized
+ * @param array &$array array to be temporarily stored
+ * @return void
+ */
+function convArrayForSanitizing($src, &$array)
+{
+ $array = array();
+ foreach ( $src as $key => $val )
+ {
+ if ( !key_exists($key, $_GET) )
+ {
+ continue;
+ }
+ $array[] = sprintf("%s=%s", $key, $val);
+ continue;
+ }
+ return;
+}
+
+/**
+ * revertArrayForSanitizing()
+ * Revert array after sanitizeArray function
+ *
+ * @param array $array element of query according to application/x-www-form-urlencoded
+ * @param array &$dst combination of key and value
+ * @return void
+ */
+function revertArrayForSanitizing($array, &$dst)
+{
+ foreach ( $array as $v )
+ {
+ list($key, $val) = preg_split("#=#", $v, 2);
+ $dst[$key] = $val;
+ continue;
+ }
return;
-}\r
-\r
-/**\r
- * Errors before the database connection has been made\r
- * \r
- * @param string $msg message to notify\r
- * @param string $title page title\r
- * @return void\r
- */\r
-function startUpError($msg, $title)\r
-{\r
- header('Content-Type: text/xml; charset=' . i18n::get_current_charset());\r
- echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";\r
- echo "<head>\n";\r
- echo "<title>{$title}</title></head>\n";\r
- echo "<body>\n";\r
- echo "<h1>{$title}</h1>\n";\r
- echo $msg;\r
- echo "</body>\n";\r
- echo "</html>\n";\r
- exit;\r
-}\r
-\r
-function isValidShortName($name)\r
-{\r
- return preg_match('#^[a-z0-9]+$#i', $name);\r
-}\r
-function isValidDisplayName($name)\r
-{\r
- return preg_match('#^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$#i', $name);\r
-}\r
-function isValidCategoryName($name)\r
-{\r
- return 1;\r
-}\r
-function isValidTemplateName($name)\r
-{\r
- return preg_match('#^[a-z0-9/_\-]+$#i', $name);\r
-}\r
-function isValidSkinName($name)\r
-{\r
- return preg_match('#^[a-z0-9/_\-]+$#i', $name);\r
-}\r
-\r
-// add and remove linebreaks\r
-function addBreaks($var)\r
-{\r
- return nl2br($var);\r
-}\r
-function removeBreaks($var)\r
-{\r
- return preg_replace("/<br \/>([\r\n])/", "$1", $var);\r
-}\r
-\r
-/**\r
- * parseFile()\r
- * \r
- * @param string $filename\r
- * @param string $includeMode\r
- * @param string $includePrefix\r
- * @return void\r
- */\r
-function parseFile($filename, $includeMode = 'normal', $includePrefix = '')\r
-{\r
- global $manager, $skinid;\r
- \r
- if ( !$skinid || !existsID($skinid) )\r
- {\r
- $skin =& $manager->getSkin($CONF['BaseSkin']);\r
- }\r
- else\r
- {\r
- $skin =& $manager->getSkin($skinid);\r
- }\r
- \r
- $oldIncludeMode = Parser::getProperty('IncludeMode');\r
- $oldIncludePrefix = Parser::getProperty('IncludePrefix');\r
- \r
- $skin->parse('fileparse', $filename);\r
- \r
- Parser::setProperty('IncludeMode', $oldIncludeMode);\r
- Parser::setProperty('IncludePrefix', $oldIncludePrefix);\r
- \r
- return;\r
-}\r
-\r
-/**\r
- * debug()\r
- * Outputs a debug message\r
- * \r
- * @param string $msg\r
- * @return void\r
- */\r
-function debug($msg)\r
-{\r
- echo '<p><b>' . $msg . "</b></p>\n";\r
- return;\r
-}\r
-\r
-// shows a link to help file\r
-function help($id)\r
-{\r
- echo helpHtml($id);\r
- return;\r
-}\r
-function helpHtml($id)\r
-{\r
- global $CONF;\r
- return helplink($id) . '<img src="' . $CONF['AdminURL'] . 'documentation/icon-help.gif" width="15" height="15" alt="' . _HELP_TT . '" title="' . _HELP_TT . '" /></a>';\r
-}\r
-function helplink($id)\r
-{\r
- global $CONF;\r
- return '<a href="' . $CONF['AdminURL'] . 'documentation/help.html#'. $id . '" onclick="if (event && event.preventDefault) event.preventDefault(); return help(this.href);">';\r
-}\r
-\r
-/**\r
- * includephp()\r
- * Includes a PHP file. This method can be called while parsing templates and skins\r
- * \r
- * @param string $filename name of file to parse\r
- * @return void\r
- */\r
-function includephp($filename)\r
-{\r
- // make predefined variables global, so most simple scripts can be used here\r
- \r
- // apache (names taken from PHP doc)\r
- global $GATEWAY_INTERFACE, $SERVER_NAME, $SERVER_SOFTWARE, $SERVER_PROTOCOL;\r
- global $REQUEST_METHOD, $QUERY_STRING, $DOCUMENT_ROOT, $HTTP_ACCEPT;\r
- global $HTTP_ACCEPT_CHARSET, $HTTP_ACCEPT_ENCODING, $HTTP_ACCEPT_LANGUAGE;\r
- global $HTTP_CONNECTION, $HTTP_HOST, $HTTP_REFERER, $HTTP_USER_AGENT;\r
- global $REMOTE_ADDR, $REMOTE_PORT, $SCRIPT_FILENAME, $SERVER_ADMIN;\r
- global $SERVER_PORT, $SERVER_SIGNATURE, $PATH_TRANSLATED, $SCRIPT_NAME;\r
- global $REQUEST_URI;\r
- \r
- // php (taken from PHP doc)\r
- global $argv, $argc, $PHP_SELF, $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS;\r
- global $HTTP_POST_FILES, $HTTP_ENV_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS;\r
- \r
- // other\r
- global $PATH_INFO, $HTTPS, $HTTP_RAW_POST_DATA, $HTTP_X_FORWARDED_FOR;\r
- \r
- if ( @file_exists($filename) )\r
- {\r
- include($filename);\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * Checks if a certain plugin exists\r
- * @param string $plug name of plugin\r
- * @return boolean exists or not\r
- */\r
-function checkPlugin($name)\r
-{\r
- global $DIR_PLUGINS;\r
- return file_exists($DIR_PLUGINS . preg_replace('#[\\\\|/]#', '', $name) . '.php');\r
-}\r
-\r
-/**\r
- * alterQueryStr()\r
- * \r
- * @param string $querystr querystring to alter (e.g. foo=1&bar=2&x=y)\r
- * @param string $param name of parameter to change (e.g. 'foo')\r
- * @param string $value New value for that parameter (e.g. 3)\r
- * @return string altered query string (for the examples above: foo=3&bar=2&x=y)\r
- */\r
-function alterQueryStr($querystr, $param, $value)\r
-{\r
- $vars = preg_split('#&#', $querystr);\r
- $set = FALSE;\r
- \r
- for ( $i = 0; $i < count($vars); $i++ )\r
- {\r
- $v = preg_split('#=#', $vars[$i]);\r
- \r
- if ( $v[0] == $param )\r
- {\r
- $v[1] = $value;\r
- $vars[$i] = implode('=', $v);\r
- $set = true;\r
- break;\r
- }\r
- }\r
- if ( !$set )\r
- {\r
- $vars[] = "{$param}={$value}";\r
- }\r
- return ltrim(implode('&', $vars), '&');\r
-}\r
-\r
-/**\r
- * passVar()\r
- * passes one variable as hidden input field (multiple fields for arrays)\r
- * @see passRequestVars in varsx.x.x.php\r
- * \r
- * @param string $key\r
- * @param string $value\r
- * @return void\r
- */\r
-function passVar($key, $value)\r
-{\r
- // array ?\r
- if ( is_array($value) )\r
- {\r
- for ( $i = 0; $i < sizeof($value); $i++ )\r
- {\r
- passVar($key . '[' . $i . ']', $value[$i]);\r
- }\r
- return;\r
- }\r
- \r
- // other values: do stripslashes if needed\r
- echo '<input type="hidden" name="' . Entity::hsc($key) . '" value="' . Entity::hsc(undoMagic($value)) . '" />' . "\n";\r
- return;\r
-}\r
-\r
-/**\r
- * checkVars()\r
- * \r
- * @param string $variables\r
- * @return void\r
- */\r
-function checkVars($variables)\r
-{\r
- foreach ( $variables as $variable )\r
- {\r
- if ( array_key_exists($variable, $_GET)\r
- || array_key_exists($variable, $_POST)\r
- || array_key_exists($variable, $_COOKIE)\r
- || array_key_exists($variable, $_ENV)\r
- || (session_id() !== '' && array_key_exists($variable, $_SESSION))\r
- || array_key_exists($variable, $_FILES) )\r
- {\r
- die('Sorry. An error occurred.');\r
- }\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * sanitizeParams()\r
- * Sanitize parameters such as $_GET and $_SERVER['REQUEST_URI'] etc.\r
- * to avoid XSS.\r
- * \r
- * @param void\r
- * @return void\r
- */\r
-function sanitizeParams()\r
-{\r
- $array = array();\r
- $str = '';\r
- $frontParam = '';\r
- \r
- // REQUEST_URI of $_SERVER\r
- $str =& $_SERVER["REQUEST_URI"];\r
- serverStringToArray($str, $array, $frontParam);\r
- sanitizeArray($array);\r
- arrayToServerString($array, $frontParam, $str);\r
- \r
- // QUERY_STRING of $_SERVER\r
- $str =& $_SERVER["QUERY_STRING"];\r
- serverStringToArray($str, $array, $frontParam);\r
- sanitizeArray($array);\r
- arrayToServerString($array, $frontParam, $str);\r
- \r
- // $_GET\r
- convArrayForSanitizing($_GET, $array);\r
- sanitizeArray($array);\r
- revertArrayForSanitizing($array, $_GET);\r
- \r
- // $_REQUEST (only GET param)\r
- convArrayForSanitizing($_REQUEST, $array);\r
- sanitizeArray($array);\r
- revertArrayForSanitizing($array, $_REQUEST);\r
- \r
- return;\r
-}\r
-\r
-function _addInputTags(&$keys,$prefix='')\r
-{\r
- foreach ( $keys as $key=>$value )\r
- {\r
- if ( $prefix )\r
- {\r
- $key=$prefix.'['.$key.']';\r
- }\r
- if ( is_array($value) )\r
- {\r
- _addInputTags($value,$key);\r
- }\r
- else\r
- {\r
- if ( get_magic_quotes_gpc() )\r
- {$value=stripslashes($value);\r
- }\r
- if ( $key == 'ticket' )\r
- {\r
- continue;\r
- }\r
- echo '<input type="hidden" name="'.Entity::hsc($key).\r
- '" value="'.Entity::hsc($value).'" />'."\n";\r
- }\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * serverStringToArray()\r
- * Convert the server string such as $_SERVER['REQUEST_URI']\r
- * to arry like arry['blogid']=1 and array['page']=2 etc.\r
- * \r
- * @param string $uri string\r
- * @param string &$query_elements elements of query according to application/x-www-form-urlencoded\r
- * @param string &$hier_part hierarchical part includes path\r
- * \r
- * NOTE:\r
- * RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax\r
- * 3. Syntax Components\r
- * http://www.ietf.org/rfc/rfc3986.txt\r
- * \r
- * Hypertext Markup Language - 2.0\r
- * 8.2.1. The form-urlencoded Media Type\r
- * http://tools.ietf.org/html/rfc1866#section-8.2.1\r
- * \r
- * $_SERVER > Language Reference > Predefined Variables > PHP Manual\r
- * http://www.php.net/manual/en/reserved.variables.server.php\r
- */\r
-function serverStringToArray($uri, &$query_elements, &$hier_part)\r
-{\r
- // init param\r
- $query_elements = array();\r
- $hier_part = "";\r
- \r
- // split hierarchical part, e.g. /index.php, query and fragment, e.g. blogid=1&page=2#section1\r
- if ( i18n::strpos($uri, "?") > 0 )\r
- {\r
- list($hier_part, $query_and_fragment) = preg_split("#\?#", $uri, 2);\r
- }\r
- else\r
- {\r
- $query_and_fragment = $uri;\r
- $hier_part = '';\r
- }\r
- \r
- // If there is no query like blogid=1&page=2, return\r
- if ( i18n::strpos($uri, "=") == FALSE && !i18n::strlen($hier_part) )\r
- {\r
- $hier_part = $uri;\r
- return;\r
- }\r
- \r
- $query_elements = preg_split("#&#", $query_and_fragment);\r
- return;\r
-}\r
-\r
-/**\r
- * arrayToServerString()\r
- * Convert array like array['blogid'] to server string\r
- * such as $_SERVER['REQUEST_URI']\r
- * \r
- * @param array $query_elements elements of query according to application/x-www-form-urlencoded\r
- * @param string $hier_part hier-part defined in RFC3986\r
- * @param string &$uri return value\r
- * @return void\r
- * \r
- * NOTE:\r
- * RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax\r
- * 3. Syntax Components\r
- * http://www.ietf.org/rfc/rfc3986.txt\r
- * \r
- * Hypertext Markup Language - 2.0\r
- * 8.2.1. The form-urlencoded Media Type\r
- * http://tools.ietf.org/html/rfc1866#section-8.2.1\r
- * \r
- * $_SERVER > Language Reference > Predefined Variables > PHP Manual\r
- * http://www.php.net/manual/en/reserved.variables.server.php\r
- */\r
-function arrayToServerString($query_elements, $hier_part, &$uri)\r
-{\r
- if ( i18n::strpos($uri, "?") !== FALSE )\r
- {\r
- $uri = $hier_part . "?";\r
- }\r
- else\r
- {\r
- $uri = $hier_part;\r
- }\r
- if ( count($query_elements) > 0 )\r
- {\r
- $uri .= implode("&", $query_elements);\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * sanitizeArray()\r
- * Sanitize array parameters.\r
- * This function checks both key and value.\r
- * - check key if it inclues " (double quote), remove from array\r
- * - check value if it includes \ (escape sequece), remove remaining string\r
- * \r
- * @param array &$array elements of query according to application/x-www-form-urlencoded\r
- * @return void\r
- */\r
-function sanitizeArray(&$array)\r
-{\r
- $excludeListForSanitization = array('query');\r
- \r
- foreach ( $array as $k => $v )\r
- {\r
- // split to key and value\r
- list($key, $val) = preg_split("#=#", $v, 2);\r
- if ( !isset($val) )\r
- {\r
- continue;\r
- }\r
- \r
- // when magic quotes is on, need to use stripslashes,\r
- // and then addslashes\r
- if ( get_magic_quotes_gpc() )\r
- {\r
- $val = stripslashes($val);\r
- }\r
- \r
- // note that we must use addslashes here because this function is called before the db connection is made\r
- // and sql_real_escape_string needs a db connection\r
- $val = addslashes($val);\r
- \r
- // if $key is included in exclude list, skip this param\r
- if ( !in_array($key, $excludeListForSanitization) )\r
- {\r
- // check value\r
- if ( i18n::strpos($val, '\\') > 0 )\r
- {\r
- list($val, $tmp) = preg_split('#\\\\#', $val);\r
- }\r
- \r
- // remove control code etc.\r
- $val = strtr($val, "\0\r\n<>'\"", " ");\r
- \r
- // check key\r
- if ( preg_match('#\"#', $key) > 0 )\r
- {\r
- unset($array[$k]);\r
- continue;\r
- }\r
- \r
- // set sanitized info\r
- $array[$k] = sprintf("%s=%s", $key, $val);\r
- }\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * convArrayForSanitizing()\r
- * Convert array for sanitizeArray function\r
- * \r
- * @param string $src array to be sanitized\r
- * @param array &$array array to be temporarily stored\r
- * @return void\r
- */\r
-function convArrayForSanitizing($src, &$array)\r
-{\r
- $array = array();\r
- foreach ( $src as $key => $val )\r
- {\r
- if ( !key_exists($key, $_GET) )\r
- {\r
- continue;\r
- }\r
- $array[] = sprintf("%s=%s", $key, $val);\r
- continue;\r
- }\r
- return;\r
-}\r
-\r
-/**\r
- * revertArrayForSanitizing()\r
- * Revert array after sanitizeArray function\r
- * \r
- * @param array $array element of query according to application/x-www-form-urlencoded\r
- * @param array &$dst combination of key and value\r
- * @return void\r
- */\r
-function revertArrayForSanitizing($array, &$dst)\r
-{\r
- foreach ( $array as $v )\r
- {\r
- list($key, $val) = preg_split("#=#", $v, 2);\r
- $dst[$key] = $val;\r
- continue;\r
- }\r
- return;\r
-}\r
-\r
-/**\r
+}
+
+/**
* decodePathInfo()
*
* @param string $virtualpath
/**
- * redirect()\r
- * Stops processing the request and redirects to the given URL.\r
- * - no actual contents should have been sent to the output yet\r
- * - the URL will be stripped of illegal or dangerous characters\r
- * \r
- * @param string $uri\r
- * @return void\r
- */\r
-function redirect($url)\r
-{\r
- $url = preg_replace('#[^a-z0-9-~+_.?\#=&;,/:@%*]#i', '', $url);\r
- header('Location: ' . $url);\r
- exit;\r
-}\r
-\r
-/**\r
- * getBookmarklet()\r
- * Returns the Javascript code for a bookmarklet that works on most modern browsers\r
- * \r
- * @param integer $blogid ID for weblog\r
- * @return script to call Bookmarklet\r
- */\r
-function getBookmarklet($blogid, $width=600, $height=500)\r
-{\r
- global $CONF;\r
- \r
- $script = "Q='';"\r
- . "x=document;"\r
- . "y=window;"\r
- . "if ( x.selection )"\r
- . "{"\r
- . " Q=x.selection.createRange().text;"\r
- . "}"\r
- . "else if ( y.getSelection )"\r
- . "{"\r
- . " Q=y.getSelection();"\r
- . "}"\r
- . "else if ( x.getSelection )"\r
- . "{"\r
- . " Q=x.getSelection();"\r
- . "}"\r
- . "wingm = window.open('{$CONF['AdminURL']}bookmarklet.php?blogid={$blogid}"\r
- . " &logtext=' + encodeURIComponent(Q) +"\r
- . " '&loglink=' + encodeURIComponent(x.location.href) +"\r
- . " '&loglinktitle=' + encodeURIComponent(x.title),"\r
- . " 'nucleusbm',"\r
- . " 'scrollbars=yes,width={$width},height={$height},left=10,top=10,status=yes,resizable=yes');"\r
- . "wingm.focus();";\r
- \r
- return $script;\r
-}\r
-\r
-/**\r
- * cleanFileName()\r
- * cleans filename of uploaded file for writing to file system\r
- *\r
- * @param string $str\r
- * @return string $cleaned filename ready for use\r
- */\r
-function cleanFileName($str)\r
-{\r
- $str = strtolower($str);\r
- $ext_point = i18n::strrpos($str,".");\r
- if ( $ext_point === FALSE )\r
- {\r
- return FALSE;\r
- }\r
- $ext = i18n::substr($str,$ext_point,i18n::strlen($str));\r
- $str = i18n::substr($str,0,$ext_point);\r
- \r
- return preg_replace("#[^a-z0-9-]#", "_", $str) . $ext;\r
-}\r
-\r
-/**\r
- * use Notification class instead of this\r
- * Deprecated since 4.0:\r
- */\r
-function getMailFooter()\r
-{\r
- NOTIFICATION::get_mail_footer();\r
-}\r
-function isValidMailAddress($address)\r
-{\r
- return NOTIFICATION::address_validation($address);\r
-}\r
-/**\r
- * use Entity class instead of this\r
- * Deprecated since 4.0:\r
- */\r
-function highlight($text, $expression, $highlight)\r
-{\r
- return Entity::highlight($text, $expression, $highlight);\r
-}\r
-function shorten($string, $maxlength, $suffix)\r
-{\r
- return Entity::shorten($string, $maxlength, $suffix);\r
-}\r
-function stringStripTags ($string)\r
-{\r
- return Entity::strip_tags($string);\r
-}\r
-function toAscii($string)\r
-{\r
- return Entity::anchor_footnoting($string);\r
-}\r
-function stringToAttribute ($string)\r
-{\r
- return Entity::hsc($string);\r
-}\r
-function stringToXML ($string)\r
-{\r
- return Entity::hen($string);\r
-}\r
-function encode_desc($data)\r
-{\r
- return Entity::hen($data);\r
-}\r
-/**\r
- * Centralisation of the functions that deals with locales\r
- * This functions is based on the old way to deal with languages\r
- * Deprecated since 4.0:\r
- */\r
-function getLanguageName()\r
-{\r
- if( ($language = i18n::convert_locale_to_old_language_file_name(i18n::get_current_locale())) === FALSE )\r
- {\r
- $language ='english';\r
- }\r
- return $language;\r
-}\r
-function selectLanguage($language)\r
-{\r
- global $DIR_LANG;\r
- include($DIR_LANG . preg_replace('#[\\\\|/]#', '', $language) . '.php');\r
- return;\r
-}\r
-/**\r
- * use i18n class instead of these\r
- * Deprecated since 4.0\r
- */\r
-function checkLanguage($lang)\r
-{\r
- return ( preg_match('#^(.+)_(.+)_(.+)$#', $lang)\r
- || i18n::convert_old_language_file_name_to_locale($lang) );\r
-}\r
-function formatDate($format, $timestamp, $default_format, &$blog)\r
-{\r
- $offset = date('Z', $timestamp);\r
- if ( $blog )\r
- {\r
- $offset += $blog->getTimeOffset() * 3600;\r
- }\r
- return i18n::formatted_datetime($format, $timestamp, $offset, $default_format);\r
-}\r
-\r
-/**\r
- * use DB class instead of these\r
- * Deprecated since 4.0\r
- */\r
-function quickQuery($query)\r
-{\r
- $row = DB::getRow($query);\r
- return $row['result'];\r
-}\r
-function mysqldate($timestamp)\r
-{\r
- return DB::formatDateTime($timestamp);\r
- }\r
-/**\r
- * Centralisation of the functions that generate links\r
- * Deprecated since 4.0:\r
- * Please use Link::FunctionName(...) instead\r
- */\r
-function createItemLink($itemid, $extra = '')\r
-{\r
- return Link::create_item_link($itemid, $extra);\r
-}\r
-function createMemberLink($memberid, $extra = '')\r
-{\r
- return Link::create_member_link($memberid, $extra);\r
-}\r
-function createCategoryLink($catid, $extra = '')\r
-{\r
- return Link::create_category_link($catid, $extra);\r
-}\r
-function createArchiveListLink($blogid = '', $extra = '')\r
-{\r
- return Link::create_archivelist_link($blogid, $extra);\r
-}\r
-function createArchiveLink($blogid, $archive, $extra = '')\r
-{\r
- return Link::create_archive_link($blogid, $archive, $extra);\r
-}\r
-function createBlogidLink($blogid, $params = '')\r
-{\r
- return Link::create_blogid_link($blogid, $params = '');\r
-}\r
-function createLink($type, $params)\r
-{\r
- return Link::create_link($type, $params);\r
-}\r
-function createBlogLink($url, $params)\r
-{\r
- return Link::create_blog_link($url, $params);\r
-}\r
-/**\r
- * use ActionLog class instead of this\r
- * Deprecated since 4.0\r
- */\r
-function addToLog($level, $msg)\r
-{\r
- ActionLog::add($level, $msg);\r
-}\r
-/**\r
- * use PHP's implement\r
- * Deprecated since 4.0\r
- */\r
-function ifset(&$var)\r
-{\r
- if ( isset($var) )\r
- {\r
- return $var;\r
- }\r
- \r
- return NULL;\r
-}\r
-/**\r
- * use Manager::getPluginNameFromPid() instead of this\r
- * Deprecated since 4.0\r
- */\r
-function getPluginNameFromPid($pid)\r
-{\r
- global $manager;\r
- return $manager->getPluginNameFromPid($pid);\r
-}\r
-/**\r
- * use Manager::numberOfEventSubscribers() instead of this\r
- * Deprecated since 4.0\r
- */\r
-function numberOfEventSubscribers($event)\r
-{\r
- global $manager;\r
- return $manager->getNumberOfSubscribers($event);\r
-}\r
-\r
-/**\r
- * PluginAdmin has already the alternative implement\r
- * Deprecated since 4.0\r
- */\r
-function ticketForPlugin()\r
-{\r
- global $CONF, $DIR_LIBS, $DIR_LOCALES, $DIR_PLUGINS, $manager, $member, $ticketforplugin;\r
- \r
- /* initialize */\r
- $ticketforplugin = array();\r
- $ticketforplugin['ticket'] = FALSE;\r
- \r
- /* Check if using plugin's php file. */\r
- $p_translated = serverVar('SCRIPT_FILENAME');\r
- \r
- if (!file_exists($p_translated) )\r
- {\r
- header("HTTP/1.0 404 Not Found");\r
- exit('');\r
- }\r
- \r
- // check whether this is plugin or not\r
- $p_translated = str_replace('\\', '/', $p_translated);\r
- $d_plugins = str_replace('\\', '/', $DIR_PLUGINS);\r
- if ( i18n::strpos($p_translated, $d_plugins) !== 0 )\r
- {\r
- return;\r
- }\r
- \r
- // Solve the plugin php file or admin directory\r
- $phppath = i18n::substr($p_translated, i18n::strlen($d_plugins) );\r
- // Remove the first "/" if exists.\r
- $phppath = preg_replace('#^/#', '', $phppath);\r
- // Remove the first "NP_" and the last ".php" if exists.\r
- $path = preg_replace('#^NP_(.*)\.php$#', '$1', $phppath);\r
- // Remove the "/" and beyond.\r
- $path = preg_replace('#^([^/]*)/(.*)$#', '$1', $path);\r
- \r
- // Solve the plugin name.\r
- $plugins = array();\r
- $query = sprintf('SELECT pfile FROM %s;', sql_table('plugin'));\r
- $res = DB::getResult($query);\r
- \r
- foreach ( $res as $row )\r
- {\r
- $name = i18n::substr($row['pfile'], 3);\r
- $plugins[strtolower($name)] = $name;\r
- }\r
- \r
- $res->closeCursor();\r
- \r
- if ( !array_key_exists($path, $plugins) )\r
- {\r
- header("HTTP/1.0 404 Not Found");\r
- exit('');\r
- }\r
- else\r
- {\r
- $plugin_name = $plugins[$path];\r
- }\r
- \r
- /* Return if not index.php */\r
- if ( ($phppath != strtolower($plugin_name) . '/')\r
- && ($phppath != strtolower($plugin_name) . '/index.php') )\r
- {\r
- return;\r
- }\r
- \r
- /* Exit if not logged in. */\r
- if ( !$member->isLoggedIn() )\r
- {\r
- exit('You aren\'t logged in.');\r
- }\r
- \r
- /* Check if this feature is needed (ie, if "$manager->checkTicket()" is not included in the script). */\r
- if ( $file = @file($p_translated) )\r
- {\r
- $prevline = '';\r
- \r
- foreach($file as $line)\r
- {\r
- if (preg_match('#[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]#i', $prevline . $line) )\r
- {\r
- return;\r
- }\r
- \r
- $prevline = $line;\r
- }\r
- }\r
- \r
- /* Show a form if not valid ticket */\r
- if ( (i18n::strpos(serverVar('REQUEST_URI'), '?') !== FALSE\r
- || serverVar('QUERY_STRING')\r
- || strtoupper(serverVar('REQUEST_METHOD') ) == 'POST')\r
- && !$manager->checkTicket() )\r
- {\r
- $oPluginAdmin = new PluginAdmin($plugin_name);\r
- $oPluginAdmin->start();\r
- \r
- echo '<p>' . _ERROR_BADTICKET . "</p>\n";\r
- \r
- // Resolve URI and QUERY_STRING\r
- if ($uri = serverVar('REQUEST_URI') )\r
- {\r
- list($uri, $qstring) = preg_split('#\?#', $uri);\r
- }\r
- else\r
- {\r
- if ( !($uri = serverVar('PHP_SELF') ) )\r
- {\r
- $uri = serverVar('SCRIPT_NAME');\r
- }\r
- $qstring = serverVar('QUERY_STRING');\r
- }\r
- if ($qstring)\r
- {\r
- $qstring = '?' . $qstring;\r
- }\r
- \r
- echo '<p>' . _SETTINGS_UPDATE . ' : ' . _QMENU_PLUGINS . ' <span style="color:red;">' . Entity::hsc($plugin_name) . "</span> ?</p>\n";\r
- \r
- switch(strtoupper(serverVar('REQUEST_METHOD') ) )\r
- {\r
- case 'POST':\r
- echo '<form method="POST" action="'.Entity::hsc($uri.$qstring).'">';\r
- $manager->addTicketHidden();\r
- _addInputTags($_POST);\r
- break;\r
- \r
- case 'GET':\r
- echo '<form method="GET" action="'.Entity::hsc($uri).'">';\r
- $manager->addTicketHidden();\r
- _addInputTags($_GET);\r
- \r
- default:\r
- break;\r
- }\r
- \r
- echo '<input type="submit" value="' . _YES . '" /> ';\r
- echo '<input type="button" value="' . _NO . '" onclick="history.back(); return false;" />';\r
- echo "</form>\n";\r
- \r
- $oPluginAdmin->end();\r
- exit;\r
- }\r
- \r
- /* Create new ticket */\r
- $ticket=$manager->addTicketToUrl('');\r
- $ticketforplugin['ticket'] = preg_split($ticket, i18n::strpos($ticket, 'ticket=') + 7);\r
- return;\r
-}\r
+ * redirect()
+ * Stops processing the request and redirects to the given URL.
+ * - no actual contents should have been sent to the output yet
+ * - the URL will be stripped of illegal or dangerous characters
+ *
+ * @param string $uri
+ * @return void
+ */
+function redirect($url)
+{
+ $url = preg_replace('#[^a-z0-9-~+_.?\#=&;,/:@%*]#i', '', $url);
+ header('Location: ' . $url);
+ exit;
+}
+
+/**
+ * getBookmarklet()
+ * Returns the Javascript code for a bookmarklet that works on most modern browsers
+ *
+ * @param integer $blogid ID for weblog
+ * @return script to call Bookmarklet
+ */
+function getBookmarklet($blogid, $width=600, $height=500)
+{
+ global $CONF;
+
+ $script = "Q='';"
+ . "x=document;"
+ . "y=window;"
+ . "if ( x.selection )"
+ . "{"
+ . " Q=x.selection.createRange().text;"
+ . "}"
+ . "else if ( y.getSelection )"
+ . "{"
+ . " Q=y.getSelection();"
+ . "}"
+ . "else if ( x.getSelection )"
+ . "{"
+ . " Q=x.getSelection();"
+ . "}"
+ . "wingm = window.open('{$CONF['AdminURL']}bookmarklet.php?blogid={$blogid}"
+ . " &logtext=' + encodeURIComponent(Q) +"
+ . " '&loglink=' + encodeURIComponent(x.location.href) +"
+ . " '&loglinktitle=' + encodeURIComponent(x.title),"
+ . " 'nucleusbm',"
+ . " 'scrollbars=yes,width={$width},height={$height},left=10,top=10,status=yes,resizable=yes');"
+ . "wingm.focus();";
+
+ return $script;
+}
+
+/**
+ * cleanFileName()
+ * cleans filename of uploaded file for writing to file system
+ *
+ * @param string $str
+ * @return string $cleaned filename ready for use
+ */
+function cleanFileName($str)
+{
+ $str = strtolower($str);
+ $ext_point = i18n::strrpos($str,".");
+ if ( $ext_point === FALSE )
+ {
+ return FALSE;
+ }
+ $ext = i18n::substr($str,$ext_point,i18n::strlen($str));
+ $str = i18n::substr($str,0,$ext_point);
+
+ return preg_replace("#[^a-z0-9-]#", "_", $str) . $ext;
+}
+
+/**
+ * use Notification class instead of this
+ * Deprecated since 4.0:
+ */
+function getMailFooter()
+{
+ NOTIFICATION::get_mail_footer();
+}
+function isValidMailAddress($address)
+{
+ return NOTIFICATION::address_validation($address);
+}
+/**
+ * use Entity class instead of this
+ * Deprecated since 4.0:
+ */
+function highlight($text, $expression, $highlight)
+{
+ return Entity::highlight($text, $expression, $highlight);
+}
+function shorten($string, $maxlength, $suffix)
+{
+ return Entity::shorten($string, $maxlength, $suffix);
+}
+function stringStripTags ($string)
+{
+ return Entity::strip_tags($string);
+}
+function toAscii($string)
+{
+ return Entity::anchor_footnoting($string);
+}
+function stringToAttribute ($string)
+{
+ return Entity::hsc($string);
+}
+function stringToXML ($string)
+{
+ return Entity::hen($string);
+}
+function encode_desc($data)
+{
+ return Entity::hen($data);
+}
+/**
+ * Centralisation of the functions that deals with locales
+ * This functions is based on the old way to deal with languages
+ * Deprecated since 4.0:
+ */
+function getLanguageName()
+{
+ if( ($language = i18n::convert_locale_to_old_language_file_name(i18n::get_current_locale())) === FALSE )
+ {
+ $language ='english';
+ }
+ return $language;
+}
+function selectLanguage($language)
+{
+ global $DIR_LANG;
+ include($DIR_LANG . preg_replace('#[\\\\|/]#', '', $language) . '.php');
+ return;
+}
+/**
+ * use i18n class instead of these
+ * Deprecated since 4.0
+ */
+function checkLanguage($lang)
+{
+ return ( preg_match('#^(.+)_(.+)_(.+)$#', $lang)
+ || i18n::convert_old_language_file_name_to_locale($lang) );
+}
+function formatDate($format, $timestamp, $default_format, &$blog)
+{
+ $offset = date('Z', $timestamp);
+ if ( $blog )
+ {
+ $offset += $blog->getTimeOffset() * 3600;
+ }
+ return i18n::formatted_datetime($format, $timestamp, $offset, $default_format);
+}
+
+/**
+ * use DB class instead of these
+ * Deprecated since 4.0
+ */
+function quickQuery($query)
+{
+ $row = DB::getRow($query);
+ return $row['result'];
+}
+function mysqldate($timestamp)
+{
+ return DB::formatDateTime($timestamp);
+ }
+/**
+ * Centralisation of the functions that generate links
+ * Deprecated since 4.0:
+ * Please use Link::FunctionName(...) instead
+ */
+function createItemLink($itemid, $extra = '')
+{
+ return Link::create_item_link($itemid, $extra);
+}
+function createMemberLink($memberid, $extra = '')
+{
+ return Link::create_member_link($memberid, $extra);
+}
+function createCategoryLink($catid, $extra = '')
+{
+ return Link::create_category_link($catid, $extra);
+}
+function createArchiveListLink($blogid = '', $extra = '')
+{
+ return Link::create_archivelist_link($blogid, $extra);
+}
+function createArchiveLink($blogid, $archive, $extra = '')
+{
+ return Link::create_archive_link($blogid, $archive, $extra);
+}
+function createBlogidLink($blogid, $params = '')
+{
+ return Link::create_blogid_link($blogid, $params = '');
+}
+function createLink($type, $params)
+{
+ return Link::create_link($type, $params);
+}
+function createBlogLink($url, $params)
+{
+ return Link::create_blog_link($url, $params);
+}
+/**
+ * use ActionLog class instead of this
+ * Deprecated since 4.0
+ */
+function addToLog($level, $msg)
+{
+ ActionLog::add($level, $msg);
+}
+/**
+ * use PHP's implement
+ * Deprecated since 4.0
+ */
+function ifset(&$var)
+{
+ if ( isset($var) )
+ {
+ return $var;
+ }
+
+ return NULL;
+}
+/**
+ * use Manager::getPluginNameFromPid() instead of this
+ * Deprecated since 4.0
+ */
+function getPluginNameFromPid($pid)
+{
+ global $manager;
+ return $manager->getPluginNameFromPid($pid);
+}
+/**
+ * use Manager::numberOfEventSubscribers() instead of this
+ * Deprecated since 4.0
+ */
+function numberOfEventSubscribers($event)
+{
+ global $manager;
+ return $manager->getNumberOfSubscribers($event);
+}
+
+/**
+ * PluginAdmin has already the alternative implement
+ * Deprecated since 4.0
+ */
+function ticketForPlugin()
+{
+ global $CONF, $DIR_LIBS, $DIR_LOCALES, $DIR_PLUGINS, $manager, $member, $ticketforplugin;
+
+ /* initialize */
+ $ticketforplugin = array();
+ $ticketforplugin['ticket'] = FALSE;
+
+ /* Check if using plugin's php file. */
+ $p_translated = serverVar('SCRIPT_FILENAME');
+
+ if (!file_exists($p_translated) )
+ {
+ header("HTTP/1.0 404 Not Found");
+ exit('');
+ }
+
+ // check whether this is plugin or not
+ $p_translated = str_replace('\\', '/', $p_translated);
+ $d_plugins = str_replace('\\', '/', $DIR_PLUGINS);
+ if ( i18n::strpos($p_translated, $d_plugins) !== 0 )
+ {
+ return;
+ }
+
+ // Solve the plugin php file or admin directory
+ $phppath = i18n::substr($p_translated, i18n::strlen($d_plugins) );
+ // Remove the first "/" if exists.
+ $phppath = preg_replace('#^/#', '', $phppath);
+ // Remove the first "NP_" and the last ".php" if exists.
+ $path = preg_replace('#^NP_(.*)\.php$#', '$1', $phppath);
+ // Remove the "/" and beyond.
+ $path = preg_replace('#^([^/]*)/(.*)$#', '$1', $path);
+
+ // Solve the plugin name.
+ $plugins = array();
+ $query = sprintf('SELECT pfile FROM %s;', sql_table('plugin'));
+ $res = DB::getResult($query);
+
+ foreach ( $res as $row )
+ {
+ $name = i18n::substr($row['pfile'], 3);
+ $plugins[strtolower($name)] = $name;
+ }
+
+ $res->closeCursor();
+
+ if ( !array_key_exists($path, $plugins) )
+ {
+ header("HTTP/1.0 404 Not Found");
+ exit('');
+ }
+ else
+ {
+ $plugin_name = $plugins[$path];
+ }
+
+ /* Return if not index.php */
+ if ( ($phppath != strtolower($plugin_name) . '/')
+ && ($phppath != strtolower($plugin_name) . '/index.php') )
+ {
+ return;
+ }
+
+ /* Exit if not logged in. */
+ if ( !$member->isLoggedIn() )
+ {
+ exit('You aren\'t logged in.');
+ }
+
+ /* Check if this feature is needed (ie, if "$manager->checkTicket()" is not included in the script). */
+ if ( $file = @file($p_translated) )
+ {
+ $prevline = '';
+
+ foreach($file as $line)
+ {
+ if (preg_match('#[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]#i', $prevline . $line) )
+ {
+ return;
+ }
+
+ $prevline = $line;
+ }
+ }
+
+ /* Show a form if not valid ticket */
+ if ( (i18n::strpos(serverVar('REQUEST_URI'), '?') !== FALSE
+ || serverVar('QUERY_STRING')
+ || strtoupper(serverVar('REQUEST_METHOD') ) == 'POST')
+ && !$manager->checkTicket() )
+ {
+ $oPluginAdmin = new PluginAdmin($plugin_name);
+ $oPluginAdmin->start();
+
+ echo '<p>' . _ERROR_BADTICKET . "</p>\n";
+
+ // Resolve URI and QUERY_STRING
+ if ($uri = serverVar('REQUEST_URI') )
+ {
+ list($uri, $qstring) = preg_split('#\?#', $uri);
+ }
+ else
+ {
+ if ( !($uri = serverVar('PHP_SELF') ) )
+ {
+ $uri = serverVar('SCRIPT_NAME');
+ }
+ $qstring = serverVar('QUERY_STRING');
+ }
+ if ($qstring)
+ {
+ $qstring = '?' . $qstring;
+ }
+
+ echo '<p>' . _SETTINGS_UPDATE . ' : ' . _QMENU_PLUGINS . ' <span style="color:red;">' . Entity::hsc($plugin_name) . "</span> ?</p>\n";
+
+ switch(strtoupper(serverVar('REQUEST_METHOD') ) )
+ {
+ case 'POST':
+ echo '<form method="POST" action="'.Entity::hsc($uri.$qstring).'">';
+ $manager->addTicketHidden();
+ _addInputTags($_POST);
+ break;
+
+ case 'GET':
+ echo '<form method="GET" action="'.Entity::hsc($uri).'">';
+ $manager->addTicketHidden();
+ _addInputTags($_GET);
+
+ default:
+ break;
+ }
+
+ echo '<input type="submit" value="' . _YES . '" /> ';
+ echo '<input type="button" value="' . _NO . '" onclick="history.back(); return false;" />';
+ echo "</form>\n";
+
+ $oPluginAdmin->end();
+ exit;
+ }
+
+ /* Create new ticket */
+ $ticket=$manager->addTicketToUrl('');
+ $ticketforplugin['ticket'] = preg_split($ticket, i18n::strpos($ticket, 'ticket=') + 7);
+ return;
+}
-<?php\r
-/**\r
- * i18n class for Nucleus CMS\r
- * written by Takashi Sakamoto as of Feb 03, 2012\r
- * \r
- * This includes wrapper functions of iconv and mbstring\r
- * for multibyte processing and includes parameters related to locale.\r
- * \r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2011 The Nucleus Group\r
- * @version $Id: i18n.php 1678 2012-02-26 07:31:36Z sakamocchi $\r
- */\r
-class i18n\r
-{\r
- static private $mode = FALSE;\r
- \r
- static private $current_charset = '';\r
- static private $current_language = '';\r
- static private $current_script = '';\r
- static private $current_region = '';\r
- \r
- static private $locale_list = array();\r
- static private $timezone = 'UTC';\r
- \r
- static private $forced_charset = '';\r
- static private $forced_language = '';\r
- static private $forced_script = '';\r
- static private $forced_region = '';\r
- \r
- /**\r
- * i18n::init\r
- * Initializing i18n class\r
- * \r
- * @static\r
- * @param string $charset character set\r
- * @return boolean \r
- */\r
- static public function init($charset, $dir)\r
- {\r
- /* i18n is already initialized */\r
- if ( self::$mode )\r
- {\r
- return TRUE;\r
- }\r
- \r
- /* make locale list in this Nucleus CMS */\r
- if ( ($handle = opendir($dir)) === FALSE )\r
- {\r
- return FALSE;\r
- }\r
- while ($filename = readdir($handle))\r
- {\r
- if (preg_match("#^(.+_.+_.+)\.{$charset}\.php$#", $filename, $matches) )\r
- {\r
- if ( !in_array($matches[1], self::$locale_list) )\r
- {\r
- self::$locale_list[] = $matches[1];\r
- }\r
- }\r
- }\r
- closedir($handle);\r
- \r
- /* set i18n backend and validate character set */\r
- if ( extension_loaded('iconv') )\r
- {\r
- /* this is just for checking the charset. */\r
- if ( iconv_set_encoding('internal_encoding', $charset)\r
- && iconv_set_encoding('output_encoding', $charset)\r
- && iconv_set_encoding('internal_encoding', $charset) )\r
- {\r
- self::$current_charset = $charset;\r
- self::$mode = 'iconv';\r
- }\r
- }\r
- else if ( extension_loaded('mbstring') )\r
- {\r
- /* this is just for checking the charset. */\r
- if ( mb_http_output($charset)\r
- && mb_internal_encoding($charset)\r
- && mb_regex_encoding($charset) )\r
- {\r
- self::$current_charset = $charset;\r
- self::$mode = 'mbstring';\r
- }\r
- }\r
- \r
- return TRUE;\r
- }\r
- \r
- /**\r
- * i18n::get_available_locale_list\r
- * return available locale list with current charset\r
- * \r
- * @static\r
- * @param void\r
- * @return array available locale list\r
- */\r
- static public function get_available_locale_list()\r
- {\r
- return self::$locale_list;\r
- }\r
- \r
- /**\r
- * i18n::get_current_charset\r
- * return current charset\r
- * \r
- * @static\r
- * @param void\r
- * @return string $charset current character set\r
- */\r
- static public function get_current_charset()\r
- {\r
- return self::$current_charset;\r
- }\r
- \r
- /**\r
- * i18n::set_locale\r
- * Set current locale\r
- * \r
- * NOTE:\r
- * naming rule is "$language_$script_$region.$charset.php", refer to RFC 5646.\r
- * @link http://www.ietf.org/rfc/rfc5646.txt\r
- * @see 2. The Language Tag\r
- * \r
- * @static\r
- * @param string $locale\r
- * @return bool TRUE/FALSE\r
- * \r
- */\r
- static public function set_current_locale($locale)\r
- {\r
- if ( preg_match('#^(.+)_(.+)_(.+)$#', $locale, $match) )\r
- {\r
- self::$current_language = $match[1];\r
- self::$current_script = $match[2];\r
- self::$current_region = $match[3];\r
- return TRUE;\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
- * i18n::get_locale\r
- * Get current locale\r
- * \r
- * @static\r
- * @param void\r
- * @return $locale\r
- */\r
- static public function get_current_locale()\r
- {\r
- $elements = array(self::$current_language, self::$current_script, self::$current_region);\r
- return implode('_', $elements);\r
- }\r
- \r
- /**\r
- * i18n::set_forced_locale()\r
- * Set forced locale\r
- * \r
- * @static\r
- * @param string $forced_locale\r
- * @return bool TRUE/FALSE\r
- * \r
- */\r
- static public function set_forced_locale($forced_locale)\r
- {\r
- if ( preg_match('#^(.+)_(.+)_(.+)$#', $forced_locale, $match) )\r
- {\r
- self::$forced_language = $match[1];\r
- self::$forced_script = $match[2];\r
- self::$forced_region = $match[3];\r
- return TRUE;\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
- * i18n::get_forced_locale\r
- * Get forced locale\r
- * \r
- * @static\r
- * @param void\r
- * @return $forced_locale\r
- */\r
- static public function get_forced_locale()\r
- {\r
- if ( !self::$forced_language )\r
- {\r
- return '';\r
- }\r
- \r
- $elements = array(self::$forced_language, self::$forced_script, self::$forced_region);\r
- return implode('_', $elements);\r
- }\r
- \r
- /**\r
- * i18n::set_forced_charset\r
- * return forced charset\r
- * \r
- * @static\r
- * @param void $charset forced character set\r
- * @return void\r
- */\r
- static public function set_forced_charset($forced_charset)\r
- {\r
- self::$forced_charset = $forced_charset;\r
- return;\r
- }\r
- \r
- /**\r
- * i18n::get_forced_charset\r
- * return forced charset\r
- * \r
- * @static\r
- * @param void\r
- * @return string $charset forced character set\r
- */\r
- static public function get_forced_charset()\r
- {\r
- return self::$forced_charset;\r
- }\r
- \r
- /**\r
- * i18n::confirm_default_date_timezone\r
- * to avoid E_NOTICE or E_WARNING generated when every calling to a date/time function.\r
- * \r
- * NOTE:\r
- * Some private servers are lack of its timezone setting\r
- * http://www.php.net/manual/en/function.date-default-timezone-set.php\r
- * \r
- * @static\r
- * @param void\r
- * @return void\r
- */\r
- static public function confirm_default_date_timezone()\r
- {\r
- if ( function_exists('date_default_timezone_get') \r
- && FALSE !== ($timezone = @date_default_timezone_get()))\r
- {\r
- self::$timezone = $timezone;\r
- }\r
- if (function_exists('date_default_timezone_set')) {\r
- @date_default_timezone_set(self::$timezone);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * i18n::get_current_date_timezone()\r
- * get current timezone\r
- * \r
- * @static\r
- * @param void\r
- * @return $timezone\r
- */\r
- static public function get_date_timezone()\r
- {\r
- return self::$timezone;\r
- }\r
- \r
- /**\r
- * i18n::convert\r
- * character set converter\r
- * \r
- * @static\r
- * @param string $string target string binary\r
- * @param string $from original character set encoding\r
- * @param string $to target character set encoding\r
- * @return string converted string\r
- */\r
- static public function convert($string, $from, $to='')\r
- {\r
- if ( $to == '' )\r
- {\r
- $to = self::$current_charset;\r
- }\r
- \r
- if ( $from == $to )\r
- {\r
- /* do nothing */\r
- }\r
- else if ( self::$mode == 'iconv' )\r
- {\r
- $string = iconv($from, $to.'//TRANSLIT', $string);\r
- }\r
- else if ( self::$mode == 'mbstring' )\r
- {\r
- $string = mb_convert_encoding($string, $to, $from);\r
- }\r
- return (string) $string;\r
- }\r
- \r
- /**\r
- * i18n::convert_handler\r
- * callable handler for character set converter\r
- * \r
- * @static\r
- * @param string $string target string binary\r
- * @return void\r
- */\r
- static public function convert_handler($string)\r
- {\r
- return self::convert($string, self::$current_charset, self::$forced_charset);\r
- }\r
- \r
- /**\r
- * i18n::convert_array\r
- * recursively converting array\r
- * \r
- * @static\r
- * @param array $array array to convert\r
- * @return void\r
- */\r
- static public function convert_array($array, $from, $to='')\r
- {\r
- if ( !is_array($array) )\r
- {\r
- $array = self::convert($array, $from, $to);\r
- }\r
- else\r
- {\r
- foreach ( $array as $key => $value )\r
- {\r
- if ( !is_array($value) )\r
- {\r
- $array[$key] = self::convert($value, $from, $to);\r
- }\r
- else\r
- {\r
- self::convert_array($array[$key]);\r
- }\r
- }\r
- }\r
- \r
- return $array;\r
- }\r
- \r
- /**\r
- * i18n::strlen\r
- * strlen wrapper\r
- * \r
- * @static\r
- * @param string $string target string\r
- * @return integer the number of letters\r
- */\r
- static public function strlen($string)\r
- {\r
- $length = 0;\r
- if ( self::$mode == 'iconv' )\r
- {\r
- $length = iconv_strlen($string, self::$current_charset);\r
- }\r
- else if ( self::$mode == 'mbstring' )\r
- {\r
- $length = mb_strlen($string, self::$current_charset);\r
- }\r
- else\r
- {\r
- $length = strlen($string);\r
- }\r
- return (integer) $length;\r
- }\r
- \r
- /**\r
- * i18n::strpos\r
- * strpos wrapper\r
- * \r
- * @static\r
- * @param string $haystack string to search\r
- * @param string $needle string for search\r
- * @param integer $offset the position from which the search should be performed. \r
- * @return integer/FALSE the numeric position of the first occurrence of needle in haystack\r
- */\r
- static public function strpos($haystack, $needle, $offset=0)\r
- {\r
- $position = 0;\r
- if ( self::$mode == 'iconv' )\r
- {\r
- $position = iconv_strpos($haystack, $needle, $offset, self::$current_charset);\r
- }\r
- else if ( self::$mode == 'mbstring' )\r
- {\r
- $position = mb_strpos($haystack, $needle, $offset, self::$current_charset);\r
- }\r
- else\r
- {\r
- $position = strpos($haystack, $needle, $offset);\r
- }\r
- \r
- if ( $position !== FALSE)\r
- {\r
- $position = (integer) $position;\r
- }\r
- return $position;\r
- }\r
- \r
- /**\r
- * i18n::strrpos\r
- * strrpos wrapper\r
- * \r
- * @static\r
- * @param string $haystack string to search\r
- * @param string $needle string for search\r
- * @return integer/FALSE the numeric position of the last occurrence of needle in haystack\r
- */\r
- static public function strrpos ($haystack, $needle)\r
- {\r
- $position = 0;\r
- if ( self::$mode == 'iconv' )\r
- {\r
- $position = iconv_strrpos($haystack, $needle, self::$current_charset);\r
- }\r
- else if ( self::$mode == 'mbstring' )\r
- {\r
- $position = mb_strrpos($haystack, $needle, 0, self::$current_charset);\r
- }\r
- else\r
- {\r
- $position = strrpos($haystack, $needle, 0);\r
- }\r
- \r
- if ( $position !== FALSE)\r
- {\r
- $position = (integer) $position;\r
- }\r
- return $position;\r
- }\r
- \r
- /**\r
- * i18n::substr\r
- * substr wrapper\r
- * \r
- * @static\r
- * @param string $string string to be cut\r
- * @param string $start the position of starting\r
- * @param integer $length the length to be cut\r
- * @return string the extracted part of string\r
- */\r
- static public function substr($string, $start, $length=0)\r
- {\r
- $return = '';\r
- \r
- if ( $length == 0 )\r
- {\r
- $length = self::strlen($string) - $start;\r
- }\r
- \r
- if ( self::$mode == 'iconv' )\r
- {\r
- $return = iconv_substr($string, $start, $length, self::$current_charset);\r
- }\r
- else if ( self::$mode == 'mbstring' )\r
- {\r
- $return = mb_substr($string, $start, $length, self::$current_charset);\r
- }\r
- else\r
- {\r
- $return = strrpos($string, $start, $length);\r
- }\r
- return (string) $return;\r
- }\r
- \r
- /**\r
- * i18n::strftime\r
- * strftime function based on multibyte processing\r
- * \r
- * @static\r
- * @param string $format format with singlebyte or multibyte\r
- * @param timestamp $timestamp UNIX timestamp\r
- * @return string formatted timestamp\r
- */\r
- static public function strftime($format, $timestamp='')\r
- {\r
- return preg_replace_callback('/(%[a-z%])/i',\r
- create_function('$matches', 'return strftime($matches[1], ' . intval($timestamp) . ');'),\r
- $format\r
- );\r
- }\r
- \r
- /**\r
- * i18n::formatted_datetime()\r
- * return formatted datetime string\r
- * \r
- * Date and Time Formats\r
- * @link http://www.w3.org/TR/NOTE-datetime\r
- * \r
- * Working with Time Zones\r
- * @link http://www.w3.org/TR/timezone/\r
- * \r
- * @param String $format time expression format\r
- * @param String $timestamp UNIX timestamp\r
- * @param Integer $offset timestamp offset\r
- * @return String formatted datetime\r
- */\r
- static public function formatted_datetime($format, $timestamp, $offset=0)\r
- {\r
- $suffix = '';\r
- $string = '';\r
- \r
- switch ( $format )\r
- {\r
- case 'mysql':\r
- /*\r
- * MySQL 5.0 Reference Manual\r
- * 10.3.1. The DATE, DATETIME, and TIMESTAMP Types\r
- * http://dev.mysql.com/doc/refman/5.0/en/datetime.html\r
- */\r
- $timestamp += $offset;\r
- $format = '%Y-%m-%d %H:%M:%S';\r
- $suffix ='';\r
- break;\r
- case 'rfc822':\r
- /*\r
- * RFC 822: STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES\r
- * 5. DATE AND TIME SPECIFICATION\r
- * http://www.ietf.org/rfc/rfc0822.txt\r
- */\r
- $format = '%a, %d %m %y %H:%M:%S ';\r
- if ( $offset < 0 )\r
- {\r
- $suffix = '-';\r
- $offset = -$offset;\r
- }\r
- else\r
- {\r
- $suffix = '+';\r
- }\r
- \r
- $suffix .= sprintf("%02d%02d", floor($offset / 3600), round(($offset % 3600) / 60) );\r
- break;\r
- case 'rfc822GMT':\r
- /*\r
- * RFC 822: STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES\r
- * 5. DATE AND TIME SPECIFICATION\r
- * http://www.ietf.org/rfc/rfc0822.txt\r
- */\r
- $format = '%a, %d %m %y %H:%M:%S ';\r
- $timestamp -= $offset;\r
- $suffix = 'GMT';\r
- break;\r
- case 'iso8601':\r
- case 'rfc3339':\r
- /*\r
- * RFC3339: Date and Time on the Internet: Timestamps\r
- * 5. Date and Time format\r
- * http://www.ietf.org/rfc/rfc3339.txt\r
- */\r
- $format = '%Y-%m-%dT%H:%M:%S';\r
- if ( $offset < 0 )\r
- {\r
- $suffix = '-';\r
- $offset = -$offset;\r
- }\r
- else\r
- {\r
- $suffix = '+';\r
- }\r
- $suffix .= sprintf("%02d:%02d", floor($offset / 3600), round(($offset % 3600) / 60) );\r
- break;\r
- case 'utc':\r
- case 'iso8601UTC':\r
- case 'rfc3339UTC':\r
- /*\r
- * RFC3339: Date and Time on the Internet: Timestamps\r
- * 5. Date and Time format\r
- * http://www.ietf.org/rfc/rfc3339.txt\r
- */\r
- $timestamp -= $offset;\r
- $format = '%Y-%m-%dT%H:%M:%SZ';\r
- $suffix = '';\r
- break;\r
- case '':\r
- $format = '%X %x';\r
- $offset = '';\r
- break;\r
- default:\r
- $suffix = '';\r
- break;\r
- }\r
- return i18n::strftime($format, $timestamp) . $suffix;\r
- }\r
- \r
- /**\r
- * i18n::convert_locale_to_old_language_file_name()\r
- * NOTE: this should be obsoleted near future.\r
- * \r
- * @static\r
- * @param string $target_locale locale name as language_script_region\r
- * @return string old translation file name\r
- */\r
- static public function convert_locale_to_old_language_file_name($target_locale)\r
- {\r
- $target_language = '';\r
- foreach ( self::$lang_refs as $language => $locale )\r
- {\r
- if ( preg_match('#-#', $language) )\r
- {\r
- if ( $target_locale . '.' . self::$current_charset == $locale )\r
- {\r
- $target_language = $language;\r
- break;\r
- }\r
- }\r
- else if ( $target_locale == $locale )\r
- {\r
- $target_language = $language;\r
- }\r
- }\r
- return $target_language;\r
- }\r
- \r
- /**\r
- * i18n::convert_old_language_file_name_to_locale()\r
- * NOTE: this should be obsoleted near future.\r
- * \r
- * @static\r
- * @param string $target_language old translation file name\r
- * @return string locale name as language_script_region\r
- */\r
- static public function convert_old_language_file_name_to_locale($target_language)\r
- {\r
- $target_locale = '';\r
- foreach ( self::$lang_refs as $language => $locale )\r
- {\r
- if ( $target_language == $language )\r
- {\r
- if ( preg_match('#^(.+)\.(.+)$#', $locale, $match) )\r
- {\r
- $target_locale = $match[1];\r
- }\r
- else\r
- {\r
- $target_locale = $locale;\r
- }\r
- break;\r
- }\r
- }\r
- return $target_locale;\r
- }\r
- \r
- /**\r
- * i18n::$lang_refs\r
- * reference table to convert old and new way to name translation files.\r
- * NOTE: this should be obsoleted as soon as possible.\r
- * \r
- * @static\r
- */\r
- static private $lang_refs = array(\r
- "english" => "en_Latn_US",\r
- "english-utf8" => "en_Latn_US.UTF-8",\r
- "bulgarian" => "bg_Cyrl_BG",\r
- "finnish" => "fi_Latn_FI",\r
- "catalan" => "ca_Latn_ES",\r
- "french" => "fr_Latn_FR",\r
- "russian" => "ru_Cyrl_RU",\r
- "chinese" => "zh_Hans_CN",\r
- "simchinese" => "zh_Hans_CN",\r
- "chineseb5" => "zh_Hant_TW",\r
- "traditional_chinese" => "zh_Hant_TW",\r
- "galego" => "gl_Latn_ES",\r
- "german" => "de_Latn_DE",\r
- "korean-utf" => "ko_Kore_KR.UTF-8",\r
- "korean-euc-kr" => "ko_Kore_KR.EUC-KR",\r
- "slovak" => "sk_Latn_SK",\r
- "czech" => "cs_Latn_CZ",\r
- "hungarian" => "hu_Latn_HU",\r
- "latvian" => "lv_Latn_LV",\r
- "nederlands" => "nl_Latn_NL",\r
- "italiano" => "it_Latn_IT",\r
- "persian" => "fa_Arab_IR",\r
- "spanish" => "es_Latn_ES",\r
- "spanish-utf8" => "es_Latn_ES.UTF-8",\r
- "japanese-euc" => "ja_Jpan_JP.EUC-JP",\r
- "japanese-utf8" => "ja_Jpan_JP.UTF-8",\r
- "portuguese_brazil" => "pt_Latn_BR"\r
- );\r
-}\r
+<?php
+/**
+ * i18n class for Nucleus CMS
+ * written by Takashi Sakamoto as of Feb 03, 2012
+ *
+ * This includes wrapper functions of iconv and mbstring
+ * for multibyte processing and includes parameters related to locale.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2011 The Nucleus Group
+ * @version $Id: i18n.php 1876 2012-06-17 07:33:00Z sakamocchi $
+ */
+class i18n
+{
+ static private $mode = FALSE;
+
+ static private $current_charset = '';
+ static private $current_language = '';
+ static private $current_script = '';
+ static private $current_region = '';
+
+ static private $locale_list = array();
+ static private $timezone = 'UTC';
+
+ static private $forced_charset = '';
+ static private $forced_language = '';
+ static private $forced_script = '';
+ static private $forced_region = '';
+
+ /**
+ * i18n::init
+ * Initializing i18n class
+ *
+ * @static
+ * @param string $charset character set
+ * @return boolean
+ */
+ static public function init($charset, $dir)
+ {
+ /* i18n is already initialized */
+ if ( self::$mode )
+ {
+ return TRUE;
+ }
+
+ /* make locale list in this Nucleus CMS */
+ if ( ($handle = opendir($dir)) === FALSE )
+ {
+ return FALSE;
+ }
+ while ($filename = readdir($handle))
+ {
+ if (preg_match("#^(.+_.+_.+)\.{$charset}\.php$#", $filename, $matches) )
+ {
+ if ( !in_array($matches[1], self::$locale_list) )
+ {
+ self::$locale_list[] = $matches[1];
+ }
+ }
+ }
+ closedir($handle);
+
+ /* set i18n backend and validate character set */
+ if ( extension_loaded('iconv') )
+ {
+ /* this is just for checking the charset. */
+ if ( iconv_set_encoding('internal_encoding', $charset)
+ && iconv_set_encoding('output_encoding', $charset)
+ && iconv_set_encoding('internal_encoding', $charset) )
+ {
+ self::$current_charset = $charset;
+ self::$mode = 'iconv';
+ }
+ }
+ else if ( extension_loaded('mbstring') )
+ {
+ /* this is just for checking the charset. */
+ if ( mb_http_output($charset)
+ && mb_internal_encoding($charset)
+ && mb_regex_encoding($charset) )
+ {
+ self::$current_charset = $charset;
+ self::$mode = 'mbstring';
+ }
+ }
+
+ return TRUE;
+ }
+
+ /**
+ * i18n::get_available_locale_list
+ * return available locale list with current charset
+ *
+ * @static
+ * @param void
+ * @return array available locale list
+ */
+ static public function get_available_locale_list()
+ {
+ return self::$locale_list;
+ }
+
+ /**
+ * i18n::get_current_charset
+ * return current charset
+ *
+ * @static
+ * @param void
+ * @return string $charset current character set
+ */
+ static public function get_current_charset()
+ {
+ return self::$current_charset;
+ }
+
+ /**
+ * i18n::set_locale
+ * Set current locale
+ *
+ * NOTE:
+ * naming rule is "$language_$script_$region.$charset.php", refer to RFC 5646.
+ * @link http://www.ietf.org/rfc/rfc5646.txt
+ * @see 2. The Language Tag
+ *
+ * @static
+ * @param string $locale
+ * @return bool TRUE/FALSE
+ *
+ */
+ static public function set_current_locale($locale)
+ {
+ if ( preg_match('#^(.+)_(.+)_(.+)$#', $locale, $match) )
+ {
+ self::$current_language = $match[1];
+ self::$current_script = $match[2];
+ self::$current_region = $match[3];
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ /**
+ * i18n::get_locale
+ * Get current locale
+ *
+ * @static
+ * @param void
+ * @return $locale
+ */
+ static public function get_current_locale()
+ {
+ $elements = array(self::$current_language, self::$current_script, self::$current_region);
+ return implode('_', $elements);
+ }
+
+ /**
+ * i18n::set_forced_locale()
+ * Set forced locale
+ *
+ * @static
+ * @param string $forced_locale
+ * @return bool TRUE/FALSE
+ *
+ */
+ static public function set_forced_locale($forced_locale)
+ {
+ if ( preg_match('#^(.+)_(.+)_(.+)$#', $forced_locale, $match) )
+ {
+ self::$forced_language = $match[1];
+ self::$forced_script = $match[2];
+ self::$forced_region = $match[3];
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ /**
+ * i18n::get_forced_locale
+ * Get forced locale
+ *
+ * @static
+ * @param void
+ * @return $forced_locale
+ */
+ static public function get_forced_locale()
+ {
+ if ( !self::$forced_language )
+ {
+ return '';
+ }
+
+ $elements = array(self::$forced_language, self::$forced_script, self::$forced_region);
+ return implode('_', $elements);
+ }
+
+ /**
+ * i18n::set_forced_charset
+ * return forced charset
+ *
+ * @static
+ * @param void $charset forced character set
+ * @return void
+ */
+ static public function set_forced_charset($forced_charset)
+ {
+ self::$forced_charset = $forced_charset;
+ return;
+ }
+
+ /**
+ * i18n::get_forced_charset
+ * return forced charset
+ *
+ * @static
+ * @param void
+ * @return string $charset forced character set
+ */
+ static public function get_forced_charset()
+ {
+ return self::$forced_charset;
+ }
+
+ /**
+ * i18n::confirm_default_date_timezone
+ * to avoid E_NOTICE or E_WARNING generated when every calling to a date/time function.
+ *
+ * NOTE:
+ * Some private servers are lack of its timezone setting
+ * http://www.php.net/manual/en/function.date-default-timezone-set.php
+ *
+ * @static
+ * @param void
+ * @return void
+ */
+ static public function confirm_default_date_timezone()
+ {
+ if ( function_exists('date_default_timezone_get')
+ && FALSE !== ($timezone = @date_default_timezone_get()))
+ {
+ self::$timezone = $timezone;
+ }
+ if (function_exists('date_default_timezone_set')) {
+ @date_default_timezone_set(self::$timezone);
+ }
+ return;
+ }
+
+ /**
+ * i18n::get_current_date_timezone()
+ * get current timezone
+ *
+ * @static
+ * @param void
+ * @return $timezone
+ */
+ static public function get_date_timezone()
+ {
+ return self::$timezone;
+ }
+
+ /**
+ * i18n::convert
+ * character set converter
+ *
+ * @static
+ * @param string $string target string binary
+ * @param string $from original character set encoding
+ * @param string $to target character set encoding
+ * @return string converted string
+ */
+ static public function convert($string, $from, $to='')
+ {
+ if ( $to == '' )
+ {
+ $to = self::$current_charset;
+ }
+
+ if ( $from == $to )
+ {
+ /* do nothing */
+ }
+ else if ( self::$mode == 'iconv' )
+ {
+ $string = iconv($from, $to.'//TRANSLIT', $string);
+ }
+ else if ( self::$mode == 'mbstring' )
+ {
+ $string = mb_convert_encoding($string, $to, $from);
+ }
+ return (string) $string;
+ }
+
+ /**
+ * i18n::convert_handler
+ * callable handler for character set converter
+ *
+ * @static
+ * @param string $string target string binary
+ * @return void
+ */
+ static public function convert_handler($string)
+ {
+ return self::convert($string, self::$current_charset, self::$forced_charset);
+ }
+
+ /**
+ * i18n::convert_array
+ * recursively converting array
+ *
+ * @static
+ * @param array $array array to convert
+ * @return void
+ */
+ static public function convert_array($array, $from, $to='')
+ {
+ if ( !is_array($array) )
+ {
+ $array = self::convert($array, $from, $to);
+ }
+ else
+ {
+ foreach ( $array as $key => $value )
+ {
+ if ( !is_array($value) )
+ {
+ $array[$key] = self::convert($value, $from, $to);
+ }
+ else
+ {
+ self::convert_array($array[$key]);
+ }
+ }
+ }
+
+ return $array;
+ }
+
+ /**
+ * i18n::strlen
+ * strlen wrapper
+ *
+ * @static
+ * @param string $string target string
+ * @return integer the number of letters
+ */
+ static public function strlen($string)
+ {
+ $length = 0;
+ if ( self::$mode == 'iconv' )
+ {
+ $length = iconv_strlen($string, self::$current_charset);
+ }
+ else if ( self::$mode == 'mbstring' )
+ {
+ $length = mb_strlen($string, self::$current_charset);
+ }
+ else
+ {
+ $length = strlen($string);
+ }
+ return (integer) $length;
+ }
+
+ /**
+ * i18n::strpos
+ * strpos wrapper
+ *
+ * @static
+ * @param string $haystack string to search
+ * @param string $needle string for search
+ * @param integer $offset the position from which the search should be performed.
+ * @return integer/FALSE the numeric position of the first occurrence of needle in haystack
+ */
+ static public function strpos($haystack, $needle, $offset=0)
+ {
+ $position = 0;
+ if ( self::$mode == 'iconv' )
+ {
+ $position = iconv_strpos($haystack, $needle, $offset, self::$current_charset);
+ }
+ else if ( self::$mode == 'mbstring' )
+ {
+ $position = mb_strpos($haystack, $needle, $offset, self::$current_charset);
+ }
+ else
+ {
+ $position = strpos($haystack, $needle, $offset);
+ }
+
+ if ( $position !== FALSE)
+ {
+ $position = (integer) $position;
+ }
+ return $position;
+ }
+
+ /**
+ * i18n::strrpos
+ * strrpos wrapper
+ *
+ * @static
+ * @param string $haystack string to search
+ * @param string $needle string for search
+ * @return integer/FALSE the numeric position of the last occurrence of needle in haystack
+ */
+ static public function strrpos ($haystack, $needle)
+ {
+ $position = 0;
+ if ( self::$mode == 'iconv' )
+ {
+ $position = iconv_strrpos($haystack, $needle, self::$current_charset);
+ }
+ else if ( self::$mode == 'mbstring' )
+ {
+ $position = mb_strrpos($haystack, $needle, 0, self::$current_charset);
+ }
+ else
+ {
+ $position = strrpos($haystack, $needle, 0);
+ }
+
+ if ( $position !== FALSE)
+ {
+ $position = (integer) $position;
+ }
+ return $position;
+ }
+
+ /**
+ * i18n::substr
+ * substr wrapper
+ *
+ * @static
+ * @param string $string string to be cut
+ * @param string $start the position of starting
+ * @param integer $length the length to be cut
+ * @return string the extracted part of string
+ */
+ static public function substr($string, $start, $length=0)
+ {
+ $return = '';
+
+ if ( $length == 0 )
+ {
+ $length = self::strlen($string) - $start;
+ }
+
+ if ( self::$mode == 'iconv' )
+ {
+ $return = iconv_substr($string, $start, $length, self::$current_charset);
+ }
+ else if ( self::$mode == 'mbstring' )
+ {
+ $return = mb_substr($string, $start, $length, self::$current_charset);
+ }
+ else
+ {
+ $return = strrpos($string, $start, $length);
+ }
+ return (string) $return;
+ }
+
+ /**
+ * i18n::strftime
+ * strftime function based on multibyte processing
+ *
+ * @static
+ * @param string $format format with singlebyte or multibyte
+ * @param timestamp $timestamp UNIX timestamp
+ * @return string formatted timestamp
+ */
+ static public function strftime($format, $timestamp='')
+ {
+ return preg_replace_callback('/(%[a-z%])/i',
+ create_function('$matches', 'return strftime($matches[1], ' . intval($timestamp) . ');'),
+ $format
+ );
+ }
+
+ /**
+ * i18n::formatted_datetime()
+ * return formatted datetime string
+ *
+ * Date and Time Formats
+ * @link http://www.w3.org/TR/NOTE-datetime
+ *
+ * Working with Time Zones
+ * @link http://www.w3.org/TR/timezone/
+ *
+ * @param String $format time expression format
+ * @param String $timestamp UNIX timestamp
+ * @param Integer $offset timestamp offset
+ * @return String formatted datetime
+ */
+ static public function formatted_datetime($format, $timestamp, $offset=0)
+ {
+ $suffix = '';
+ $string = '';
+
+ switch ( $format )
+ {
+ case 'mysql':
+ /*
+ * MySQL 5.0 Reference Manual
+ * 10.3.1. The DATE, DATETIME, and TIMESTAMP Types
+ * http://dev.mysql.com/doc/refman/5.0/en/datetime.html
+ */
+ $timestamp += $offset;
+ $format = '%Y-%m-%d %H:%M:%S';
+ $suffix ='';
+ break;
+
+ case 'rfc822':
+ /*
+ * RFC 822: STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES
+ * 5. DATE AND TIME SPECIFICATION
+ * http://www.ietf.org/rfc/rfc0822.txt
+ */
+ $format = '%a, %d %m %y %H:%M:%S ';
+ if ( $offset < 0 )
+ {
+ $suffix = '-';
+ $offset = -$offset;
+ }
+ else
+ {
+ $suffix = '+';
+ }
+
+ $suffix .= sprintf("%02d%02d", floor($offset / 3600), round(($offset % 3600) / 60) );
+ break;
+ case 'rfc822GMT':
+ /*
+ * RFC 822: STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES
+ * 5. DATE AND TIME SPECIFICATION
+ * http://www.ietf.org/rfc/rfc0822.txt
+ */
+ $format = '%a, %d %m %y %H:%M:%S ';
+ $timestamp -= $offset;
+ $suffix = 'GMT';
+ break;
+ case 'iso8601':
+ case 'rfc3339':
+ /*
+ * RFC3339: Date and Time on the Internet: Timestamps
+ * 5. Date and Time format
+ * http://www.ietf.org/rfc/rfc3339.txt
+ */
+ $format = '%Y-%m-%dT%H:%M:%S';
+ if ( $offset < 0 )
+ {
+ $suffix = '-';
+ $offset = -$offset;
+ }
+ else
+ {
+ $suffix = '+';
+ }
+ $suffix .= sprintf("%02d:%02d", floor($offset / 3600), round(($offset % 3600) / 60) );
+ break;
+ case 'utc':
+ case 'iso8601UTC':
+ case 'rfc3339UTC':
+ /*
+ * RFC3339: Date and Time on the Internet: Timestamps
+ * 5. Date and Time format
+ * http://www.ietf.org/rfc/rfc3339.txt
+ */
+ $timestamp -= $offset;
+ $format = '%Y-%m-%dT%H:%M:%SZ';
+ $suffix = '';
+ break;
+ case '':
+ $format = '%X %x';
+ $offset = '';
+ break;
+ default:
+ $suffix = '';
+ break;
+ }
+ return i18n::strftime($format, $timestamp) . $suffix;
+ }
+
+ /**
+ * i18n::convert_locale_to_old_language_file_name()
+ * NOTE: this should be obsoleted near future.
+ *
+ * @static
+ * @param string $target_locale locale name as language_script_region
+ * @return string old translation file name
+ */
+ static public function convert_locale_to_old_language_file_name($target_locale)
+ {
+ $target_language = '';
+ foreach ( self::$lang_refs as $language => $locale )
+ {
+ if ( preg_match('#-#', $language) )
+ {
+ if ( $target_locale . '.' . self::$current_charset == $locale )
+ {
+ $target_language = $language;
+ break;
+ }
+ }
+ else if ( $target_locale == $locale )
+ {
+ $target_language = $language;
+ }
+ }
+ return $target_language;
+ }
+
+ /**
+ * i18n::convert_old_language_file_name_to_locale()
+ * NOTE: this should be obsoleted near future.
+ *
+ * @static
+ * @param string $target_language old translation file name
+ * @return string locale name as language_script_region
+ */
+ static public function convert_old_language_file_name_to_locale($target_language)
+ {
+ $target_locale = '';
+ foreach ( self::$lang_refs as $language => $locale )
+ {
+ if ( $target_language == $language )
+ {
+ if ( preg_match('#^(.+)\.(.+)$#', $locale, $match) )
+ {
+ $target_locale = $match[1];
+ }
+ else
+ {
+ $target_locale = $locale;
+ }
+ break;
+ }
+ }
+ return $target_locale;
+ }
+
+ /**
+ * i18n::$lang_refs
+ * reference table to convert old and new way to name translation files.
+ * NOTE: this should be obsoleted as soon as possible.
+ *
+ * @static
+ */
+ static private $lang_refs = array(
+ "english" => "en_Latn_US",
+ "english-utf8" => "en_Latn_US.UTF-8",
+ "bulgarian" => "bg_Cyrl_BG",
+ "finnish" => "fi_Latn_FI",
+ "catalan" => "ca_Latn_ES",
+ "french" => "fr_Latn_FR",
+ "russian" => "ru_Cyrl_RU",
+ "chinese" => "zh_Hans_CN",
+ "simchinese" => "zh_Hans_CN",
+ "chineseb5" => "zh_Hant_TW",
+ "traditional_chinese" => "zh_Hant_TW",
+ "galego" => "gl_Latn_ES",
+ "german" => "de_Latn_DE",
+ "korean-utf" => "ko_Kore_KR.UTF-8",
+ "korean-euc-kr" => "ko_Kore_KR.EUC-KR",
+ "slovak" => "sk_Latn_SK",
+ "czech" => "cs_Latn_CZ",
+ "hungarian" => "hu_Latn_HU",
+ "latvian" => "lv_Latn_LV",
+ "nederlands" => "nl_Latn_NL",
+ "italiano" => "it_Latn_IT",
+ "persian" => "fa_Arab_IR",
+ "spanish" => "es_Latn_ES",
+ "spanish-utf8" => "es_Latn_ES.UTF-8",
+ "japanese-euc" => "ja_Jpan_JP.EUC-JP",
+ "japanese-utf8" => "ja_Jpan_JP.UTF-8",
+ "portuguese_brazil" => "pt_Latn_BR"
+ );
+}
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<head>\r
- <title>Nothing Here</title>\r
-</head>\r
-<body>\r
-\r
-<h1>Nothing to see here</h1>\r
-\r
-</body>\r
-</html>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Nothing Here</title>
+</head>
+<body>
+
+<h1>Nothing to see here</h1>
+
+</body>
+</html>
\ No newline at end of file
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * Functions to create lists of things inside the admin are\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: showlist.php 1662 2012-02-12 12:18:37Z sakamocchi $\r
- */\r
-\r
-\r
-// can take either an array of objects, or an SQL query\r
-function showlist($query, $type, $vars, $template_name = '')\r
-{\r
- $contents = '';\r
- \r
- /* count */\r
- if ( is_string($query) )\r
- {\r
- $resource = DB::getResult($query);\r
- }\r
- else\r
- {\r
- $resource = $query;\r
- }\r
- \r
- /* HEAD */\r
- $contents .= call_user_func("listplug_{$type}", $vars, 'HEAD', $template_name);\r
- \r
- /* BODY */\r
- foreach ( $resource as $row )\r
- {\r
- $vars['current'] = $row;\r
- $contents .= call_user_func("listplug_{$type}", $vars, 'BODY', $template_name);\r
- }\r
- \r
- /* FOOT */\r
- $contents .= call_user_func("listplug_{$type}", $vars, 'FOOT', $template_name);\r
- \r
- /* close SQL resource */\r
- if ( is_string($query) )\r
- {\r
- $resource->closeCursor();\r
- }\r
- \r
- return $contents;\r
-}\r
-\r
-function listplug_select($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )\r
- {\r
- $template = "<select name=\"<%name%>\" tabindex=\"<%tabindex%>\" <%javascript%>>\n"\r
- . "<%extraoption%>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];\r
- }\r
- $data = array(\r
- 'name' => $vars['name'],\r
- 'tabindex' => $vars['tabindex'],\r
- 'javascript' => !array_key_exists('javascript', $vars) ? '' : $vars['javascript'],\r
- 'extraoption' => !array_key_exists('extra', $vars) ? '' : "<option value=\"\">{$vars['extra']}</option>"\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) )\r
- {\r
- $template = "<option value=\"<%value%>\" <%selected%> title=\"<%title%>\"><%option%></option>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_SELECT_BODY'];\r
- }\r
- $data = array(\r
- 'value' => Entity::hsc($current['value']),\r
- 'selected' => ($vars['selected'] == $current['value']) ? 'selected="selected"' : '',\r
- );\r
- if ( array_key_exists('shorten', $vars) && $vars['shorten'] > 0 )\r
- {\r
- $data['title'] = Entity::hsc($current['text']);\r
- $data['option'] = Entity::hsc(Entity::shorten($current['text'], $vars['shorten'], $vars['shortenel']));\r
- }\r
- else\r
- {\r
- $data['title'] = '';\r
- }\r
- $data['option'] = Entity::hsc($current['text']);\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) )\r
- {\r
- $template = "</select>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- \r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )\r
- {\r
- $template = "<table frame=\"box\" rules=\"all\" summary=\"{$vars['content']}\">\n"\r
- . "<thead>\n"\r
- . "<tr>\n"\r
- . "<%typehead%>\n"\r
- . "</tr>\n"\r
- . "</thead>\n"\r
- . "<tbody>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];\r
- }\r
- $data = array(\r
- 'summary' => $vars['content'],\r
- 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $template_name)\r
- );\r
- break;\r
- case 'BODY':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )\r
- {\r
- $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\">\n"\r
- . "<%typebody%>\n"\r
- . "</tr>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];\r
- }\r
- // tabletype specific thingies\r
- $data = array(\r
- 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $template_name)\r
- );\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )\r
- {\r
- $template = "<%typefoot%>\n"\r
- . "</tbody>\n"\r
- . "</table>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];\r
- }\r
- // tabletype specific thingies\r
- $data = array(\r
- 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $template_name)\r
- );\r
- break;\r
- }\r
- \r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_memberlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )\r
- {\r
- $template = "<th><%colmembername%></th>\n"\r
- . "<th><%colmemberrname%></th>\n"\r
- . "<th><%colmemberurl%></th>\n"\r
- . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"\r
- . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"\r
- . "<th colspan=\"2\"><%colactions%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colmembername' => _LIST_MEMBER_NAME,\r
- 'colmemberrname' => _LIST_MEMBER_RNAME,\r
- 'colmemberurl' => _LIST_MEMBER_URL,\r
- 'colmemberadmin' => _LIST_MEMBER_ADMIN,\r
- 'colmemberlogin' => _LIST_MEMBER_LOGIN,\r
- 'colactions' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )\r
- {\r
- $template = "<td>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"\r
- . "<label for=\"batch<%id%>\">\n"\r
- . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"\r
- . "</label>\n</td>\n"\r
- . "<td><%realname%></td>\n"\r
- . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"\r
- . "<td><%admin%></td>\n"\r
- . "<td><%login%></td>\n"\r
- . "<td><a href=\"index.php?action=memberedit&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"\r
- . "<td><a href=\"index.php?action=memberdelete&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];\r
- }\r
- $data = array(\r
- 'id' => listplug_nextBatchId(),\r
- 'memberid' => $current['mnumber'],\r
- 'mailaddress' => Entity::hsc($current['memail']),\r
- 'tabindex' => $vars['tabindex'],\r
- 'name' => Entity::hsc($current['mname']),\r
- 'realname' => Entity::hsc($current['mrealname']),\r
- 'url' => Entity::hsc($current['murl']),\r
- 'admin' => $current['madmin'] ? _YES : _NO,\r
- 'login' => $current['mcanlogin'] ? _YES : _NO,\r
- 'editbtn' => _LISTS_EDIT,\r
- 'deletebtn' => _LISTS_DELETE,\r
- );\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )\r
- {\r
- $template = "";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_teamlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )\r
- {\r
- $template = "<th><%colmembername%></th>\n"\r
- . "<th><%colmemberrname%></th>\n"\r
- . "<th><%colteamadmin%><%helplink(teamadmin)%></th>\n"\r
- . "<th colspan=\"2\"><%colactions%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colmembername' => _LIST_MEMBER_NAME,\r
- 'colmemberrname' => _LIST_MEMBER_RNAME,\r
- 'colteamadmin' => _LIST_TEAM_ADMIN,\r
- 'colactions' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )\r
- {\r
- $template = "<td>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"\r
- . "<label for=\"batch<%id%>\">\n"\r
- . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"\r
- . "</label>\n</td>\n"\r
- . "<td><%realname%></td>\n"\r
- . "<td><%admin%></td>\n"\r
- . "<td><a href=\"index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n"\r
- . "<td><a href=\"<%chadminurl%>\" tabindex=\"<%tabindex%>\"><%chadminbtn%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];\r
- }\r
- $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current['tmember']) . '&blogid=' . intval($current['tblog']);\r
- $url = $manager->addTicketToUrl($url);\r
- $data = array(\r
- 'id' => listplug_nextBatchId(),\r
- 'memberid' => $current['tmember'],\r
- 'mailaddress' => Entity::hsc($current['memail']),\r
- 'tabindex' => $vars['tabindex'],\r
- 'name' => Entity::hsc($current['mname']),\r
- 'realname' => Entity::hsc($current['mrealname']),\r
- 'admin' => ($current['tadmin'] ? _YES : _NO),\r
- 'blogid' => $current['tblog'],\r
- 'deletebtn' => '<%text(_LISTS_DELETE)%>',\r
- 'chadminurl' => Entity::hsc($url),\r
- 'chadminbtn' => '<%text(_LIST_TEAM_CHADMIN)%>'\r
- );\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )\r
- {\r
- $template = "";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_pluginlist($vars, $type, $template_name = '')\r
-{\r
- static $plugins = array();\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )\r
- {\r
- $template = "<th><%colinfo%></th>\n"\r
- . "<th><%coldesc%></th>\n"\r
- . "<th colspan=\"2\"><%colactions%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colinfo' => _LISTS_INFO,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colactions' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- \r
- $plug =& $manager->getPlugin($current['pfile']);\r
- if ( $plug )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )\r
- {\r
- $template = "<td>\n"\r
- . "<strong><%plugname%></strong><br />\n"\r
- . "<%autherlabel%> <%plugauther%><br />\n"\r
- . "<%versionlabel%> <%plugversion%><br />\n"\r
- . "<%pluggeturl%><br />\n"\r
- . "</td>\n"\r
- . "<td>\n"\r
- . "<%desclabel%><br /><%plugdesc%>\n"\r
- . "<%eventlist%>\n"\r
- . "<%needupdate%>\n"\r
- . "<%dependlist%>\n"\r
- . "<%depreqlist%>\n"\r
- . "</td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];\r
- }\r
- $data = array(\r
- 'plugname' => Entity::hsc($plug->getName()),\r
- 'autherlabel' => _LIST_PLUGS_AUTHOR,\r
- 'plugauther' => Entity::hsc($plug->getAuthor()),\r
- 'versionlabel' => _LIST_PLUGS_VER,\r
- 'plugversion' => Entity::hsc($plug->getVersion()),\r
- 'tabindex' => $vars['tabindex'],\r
- 'desclabel' => _LIST_PLUGS_DESC,\r
- 'plugdesc' => Entity::hen($plug->getDescription()),\r
- );\r
- if ( $plug->getURL() )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )\r
- {\r
- $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];\r
- }\r
- $subData = array(\r
- 'plugurl' => Entity::hsc($plug->getURL()),\r
- 'tabindex' => $vars['tabindex'],\r
- 'plugsite' => _LIST_PLUGS_SITE,\r
- );\r
- $data['pluggeturl'] = Template::fill($subTpl, $subData);\r
- }\r
- else\r
- {\r
- $data['pluggeturl'] = '';\r
- }\r
- if ( count($plug->getEventList()) > 0 )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )\r
- {\r
- $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];\r
- }\r
- $subData = array(\r
- 'evntlstlbl' => _LIST_PLUGS_SUBS,\r
- 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),\r
- );\r
- $data['eventlist'] = Template::fill($subTpl, $subData);\r
- }\r
- else\r
- {\r
- $data['eventlist'] = '';\r
- }\r
- if ( !$plug->subscribtionListIsUptodate() )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )\r
- {\r
- $subTpl = "<br /><br /><strong><%updatealert%></strong>";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];\r
- }\r
- $subData = array(\r
- 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,\r
- );\r
- $data['needupdate'] = Template::fill($subTpl, $subData);\r
- }\r
- else\r
- {\r
- $data['needupdate'] = '';\r
- }\r
- if ( count($plug->getPluginDep() ) > 0)\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )\r
- {\r
- $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];\r
- }\r
- $subData = array(\r
- 'deplistlbl' => _LIST_PLUGS_DEP,\r
- 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),\r
- );\r
- $data['dependlist'] = Template::fill($subTpl, $subData);\r
- }\r
- else\r
- {\r
- $data['dependlist'] = '';\r
- }\r
- /* check dependency */\r
- if ( empty($plugins) )\r
- {\r
- $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));\r
- }\r
- $req = array();\r
- foreach ( $plugins as $plugin )\r
- {\r
- $preq =& $manager->getPlugin($plugin['pfile']);\r
- if ( $preq )\r
- {\r
- $depList = $preq->getPluginDep();\r
- foreach ( $depList as $depName )\r
- {\r
- if ( $current['pfile'] == $depName )\r
- {\r
- $req[] = $plugin['pfile'];\r
- }\r
- }\r
- }\r
- }\r
- \r
- if ( count($req) > 0 )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )\r
- {\r
- $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];\r
- }\r
- $subData = array(\r
- 'deprlstlbl' => _LIST_PLUGS_DEPREQ,\r
- 'depreqlist' => Entity::hsc(implode(', ', $req)),\r
- );\r
- $data['depreqlist'] = Template::fill($subTpl, $subData);\r
- }\r
- else\r
- {\r
- $data['depreqlist'] = '';\r
- }\r
- }\r
- else\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )\r
- {\r
- $template = "<td colspan=\"2\"><%noplugalert%></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];\r
- }\r
- $data = array(\r
- 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])),\r
- );\r
- }\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )\r
- {\r
- $template .= "<td>\n"\r
- . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"\r
- . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"\r
- . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"\r
- . "<%plugadminurl%>\n"\r
- . "<%plughelpurl%>\n"\r
- . "<%plugoptsetting%>\n"\r
- . "</td>\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];\r
- }\r
- \r
- $baseUrl = 'index.php?plugid=' . $current['pid'] . '&action=';\r
- $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');\r
- $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');\r
- \r
- $data['actionuptxt'] = _LIST_PLUGS_UP;\r
- $data['actionupurl'] = Entity::hsc($upUrl);\r
- $data['actiondowntxt'] = _LIST_PLUGS_DOWN;\r
- $data['actiondownurl'] = Entity::hsc($downUrl);\r
- $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;\r
- $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $current['pid'];\r
- \r
- if ( $plug && ($plug->hasAdminArea() > 0) )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )\r
- {\r
- $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];\r
- }\r
- $subData = array(\r
- 'actadminurl' => Entity::hsc($plug->getAdminURL()),\r
- 'tabindex' => $vars['tabindex'],\r
- 'actadmintxt' => _LIST_PLUGS_ADMIN,\r
- );\r
- $data['plugadminurl'] = Template::fill($subTpl, $subData);\r
- }\r
- else\r
- {\r
- $data['plugadminurl'] = '';\r
- }\r
- if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )\r
- {\r
- $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];\r
- }\r
- $subData = array(\r
- 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $current['pid'],\r
- 'tabindex' => $vars['tabindex'],\r
- 'acthelptxt' => _LIST_PLUGS_HELP,\r
- );\r
- $data['plughelpurl'] = Template::fill($subTpl, $subData);\r
- }\r
- else\r
- {\r
- $data['plughelpurl'] = '';\r
- }\r
- $optQuery = 'SELECT '\r
- . ' COUNT(*) AS result '\r
- . 'FROM '\r
- . sql_table('plugin_option_desc') . ' '\r
- . 'WHERE '\r
- . ' ocontext = "global" '\r
- . 'AND opid = %d';\r
- $pOptions = DB::getValue(sprintf($optQuery, $current['pid']));\r
- if ( $pOptions > 0 )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )\r
- {\r
- $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];\r
- }\r
- $subData = array(\r
- 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $current['pid'],\r
- 'tabindex' => $vars['tabindex'],\r
- 'actoptiontxt' => _LIST_PLUGS_OPTIONS,\r
- );\r
- $data['plugoptsetting'] = Template::fill($subTpl, $subData);\r
- }\r
- else\r
- {\r
- $data['plugoptsetting'] = '';\r
- }\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )\r
- {\r
- $template = "";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_plugoptionlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )\r
- {\r
- $template = "<th><%colinfo%></th>\n"\r
- . "<th><%colvalue%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colinfo' => _LISTS_INFO,\r
- 'colvalue' => _LISTS_VALUE,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- $template = listplug_plugOptionRow($current, $template_name);\r
- $data = array();\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )\r
- {\r
- $template = "<tr>\n"\r
- . "<th colspan=\"2\"><%savetext%></th>\n"\r
- . "</tr>\n"\r
- . "<tr>\n"\r
- . "<td><%savetext%></td>\n"\r
- . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>\n"\r
- . "</tr>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];\r
- }\r
- $data = array(\r
- 'savetext' => _PLUGS_SAVE,\r
- );\r
- break;\r
- }\r
- \r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_plugOptionRow($current, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";\r
- \r
- // retreive the optionmeta\r
- $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);\r
- \r
- // only if it is not a hidden option write the controls to the page\r
- if ( in_array('access', $meta) && $meta['access'] == 'hidden' )\r
- {\r
- return false;\r
- }\r
- else\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )\r
- {\r
- $template = "<td><%description%></td>\n"\r
- . "<td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];\r
- }\r
- \r
- $data = array();\r
- \r
- switch($current['type'])\r
- {\r
- case 'yesno':\r
- $template .= listplug_input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $template_name, 1);\r
- break;\r
- case 'password':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )\r
- {\r
- $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];\r
- }\r
- $data = array(\r
- 'varname' => Entity::hsc($varname),\r
- 'value' => Entity::hsc($current['value']),\r
- );\r
- break;\r
- case 'select':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )\r
- {\r
- $template .= "<select name=\"<%varname%>\">\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];\r
- }\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )\r
- {\r
- $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];\r
- }\r
- $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);\r
- $options = preg_split('#\|#', $options);\r
- \r
- for ( $i=0; $i<(count($options)-1); $i+=2 )\r
- {\r
- $name = $options[$i];\r
- $value = $options[$i+1];\r
- if ( defined($name) )\r
- {\r
- $name = constant($name);\r
- }\r
- \r
- $subData = array(\r
- 'optname' => Entity::hsc($name),\r
- 'value' => Entity::hsc($value)\r
- );\r
- if ($value != $current['value'])\r
- {\r
- $subData['selected'] = '';\r
- }\r
- else\r
- {\r
- $subData['selected'] = ' selected="selected"';\r
- }\r
- $template .= Template::fill($subTpl, $subData);\r
- }\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )\r
- {\r
- $template .= "</select>\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];\r
- }\r
- $data['varname'] = Entity::hsc($varname);\r
- break;\r
- case 'textarea':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )\r
- {\r
- $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];\r
- }\r
- $data = array(\r
- 'varname' => Entity::hsc($varname),\r
- 'value' => Entity::hsc($current['value'])\r
- );\r
- if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')\r
- {\r
- $data['readonly'] = '';\r
- }\r
- else\r
- {\r
- $data['readonly'] = ' readonly="readonly"';\r
- }\r
- break;\r
- case 'text':\r
- default:\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )\r
- {\r
- $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];\r
- }\r
- $data = array(\r
- 'varname' => Entity::hsc($varname),\r
- 'value' => Entity::hsc($current['value'])\r
- );\r
- if ( !array_key_exists('datatype', $current) || $current['datatype'] != 'numerical')\r
- {\r
- $data['datatype'] = '';\r
- }\r
- else\r
- {\r
- $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';\r
- }\r
- if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')\r
- {\r
- $data['readonly'] = '';\r
- }\r
- else\r
- {\r
- $data['readonly'] = ' readonly="readonly"';\r
- }\r
- }\r
- \r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )\r
- {\r
- $template .= "<%extra%></td>\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];\r
- }\r
- \r
- if ( !array_key_exists('extra', $current) )\r
- {\r
- $data['extra'] = '';\r
- }\r
- else\r
- {\r
- $data['extra'] = Entity::hsc($current['extra']);\r
- }\r
- \r
- if ( !array_key_exists('description', $current) )\r
- {\r
- $data['description'] = Entity::hsc($current['name']);\r
- }\r
- else if ( !defined($current['description']) )\r
- {\r
- $data['description'] = Entity::hsc($current['description']);\r
- }\r
- else\r
- {\r
- $data['description'] = Entity::hsc(constant($current['description']));\r
- }\r
- }\r
- return Template::fill($template, $data, 1);\r
-}\r
-\r
-/**\r
- * listplug_templateEditRow()\r
- * \r
- * @param array $content content of target template\r
- * @param string $desc description of target template\r
- * @param string $name name of target template\r
- * @param string $help help text\r
- * @param integer $tabindex a number for tab index\r
- * @param boolean $big large or small textarea\r
- * @param array $template_name name of template for filling\r
- * @return void\r
- */\r
-function listplug_templateEditRow($content, $desc, $name, $help = '', $tabindex = 0, $big = 0, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- static $count = 0;\r
- \r
- $tmplt = array();\r
- $base = array();\r
- \r
- $templates = array();\r
- if ( $template_name )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- $data = array(\r
- 'description' => $desc,\r
- 'help' => empty($help) ? '' : helpHtml('template' . $help),\r
- 'count' => $count++,\r
- 'name' => $name,\r
- 'tabindex' => $tabindex,\r
- 'rows' => $big ? 10 : 5,\r
- );\r
- \r
- $message = '';\r
- \r
- /* row head */\r
- if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )\r
- {\r
- $template = "<tr>\n"\r
- . "<td><%description%><%help%></td>\n"\r
- . "<td id=\"td<%count%>\">\n"\r
- . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">";\r
- }\r
- else\r
- {\r
- $template = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];\r
- }\r
- $message .= TEMPLATE::fill($template, $data);\r
- \r
- /* row content */\r
- $message .= ENTITY::hsc($content);\r
- \r
- /* row tail */\r
- if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )\r
- {\r
- $template = "</textarea>\n"\r
- . "</td>\n"\r
- . "</tr>\n";\r
- }\r
- else\r
- {\r
- $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];\r
- }\r
- $message .= TEMPLATE::fill($template, $data);\r
- \r
- return $message;\r
-}\r
-\r
-function listplug_table_itemlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $cssclass = '';\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )\r
- {\r
- $template = "<th><%colinfo%></th>\n"\r
- . "<th><%colcontent%></th>\n"\r
- . "<th style=\"white-space:nowrap\"><%colaction%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colinfo' => _LIST_ITEM_INFO,\r
- 'colcontent' => _LIST_ITEM_CONTENT,\r
- 'colaction' => _LISTS_ACTIONS\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- // string -> unix timestamp\r
- $current['itime'] = strtotime($current['itime']);\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )\r
- {\r
- $template = "<td<%cssclass%>>\n"\r
- . "<%bshortlabel%> <%bshortnameval%><br />\n"\r
- . "<%categorylabel%> <%categorynameval%><br />\n"\r
- . "<%authorlabel%> <%authornameval%><br />\n"\r
- . "<%itemdatelabel%> <%itemdateval%><br />\n"\r
- . "<%itemtimelabel%> <%itemtimeval%>\n"\r
- . "</td>\n"\r
- . "<td<%cssclass%>>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n"\r
- . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"\r
- . "<%itembody%>\n"\r
- . "</td>\n"\r
- . "<td<%cssclass%>>\n"\r
- . "<a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a><br />\n"\r
- . "<a href=\"index.php?action=itemmove&itemid=<%itemid%>\"><%movebtn%></a><br />\n"\r
- . "<a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a><br />\n"\r
- . "<%camount%>\n"\r
- . "</td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];\r
- }\r
- $cssclass = '';\r
- \r
- if ( $current['idraft'] == 1 )\r
- {\r
- $cssclass = ' class="draft"';\r
- }\r
- \r
- // (can't use offset time since offsets might vary between blogs)\r
- if ( $current['itime'] > $vars['now'] )\r
- {\r
- $cssclass = ' class="future"';\r
- }\r
- $body = strip_tags($current['ibody']);\r
- $data = array(\r
- 'cssclass' => $cssclass,\r
- 'bshortlabel' => _LIST_ITEM_BLOG,\r
- 'bshortnameval' => Entity::hsc($current['bshortname']),\r
- 'categorylabel' => _LIST_ITEM_CAT,\r
- 'categorynameval' => Entity::hsc($current['cname']),\r
- 'authorlabel' => _LIST_ITEM_AUTHOR,\r
- 'authornameval' => Entity::hsc($current['mname']),\r
- 'itemdatelabel' => _LIST_ITEM_DATE,\r
- 'itemdateval' => date("Y-m-d",$current['itime']),\r
- 'itemdatelabel' => _LIST_ITEM_TIME,\r
- 'itemdateval' => date("H:i",$current['itime']),\r
- 'batchid' => listplug_nextBatchId(),\r
- 'itemid' => $current['inumber'],\r
- 'itemtitle' => Entity::hsc(strip_tags($current['ititle'])),\r
- 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'movebtn' => _LISTS_MOVE,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- // evaluate amount of comments for the item\r
- $comment = new Comments($current['inumber']);\r
- $camount = $comment->amountComments();\r
- if ( $camount > 0 )\r
- {\r
- $data['camount'] = "<a href=\"index.php?action=itemcommentlist&itemid={$current['inumber']}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";\r
- }\r
- else\r
- {\r
- $data['camount'] = _LIST_ITEM_NOCONTENT . "<br />\n";\r
- }\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-// for batch operations: generates the index numbers for checkboxes\r
-function listplug_nextBatchId()\r
-{\r
- static $id = 0;\r
- return $id++;\r
-}\r
-\r
-function listplug_table_commentlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )\r
- {\r
- $template = "<th><%colinfo%></th>\n"\r
- . "<th><%colcontent%></th>\n"\r
- . "<th colspan=\"3\"><%colaction%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colinfo' => _LISTS_INFO,\r
- 'colcontent' => _LIST_COMMENT,\r
- 'colaction' => _LISTS_ACTIONS\r
- );\r
- break;\r
- case 'BODY':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )\r
- {\r
- $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"\r
- . "<td>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"\r
- . "<label for=\"batch<%batchid%>\"><%commentbody%></label>\n"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">\n"\r
- . "<a href=\"index.php?action=commentedit&commentid=<%commentid%>\"><%editbtn%></a>\n"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">\n"\r
- . "<a href=\"index.php?action=commentdelete&commentid=<%commentid%>\"><%delbtn%></a>\n"\r
- . "</td>\n"\r
- . "<%addbanlist%>";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];\r
- }\r
- $current = $vars['current'];\r
- $body = strip_tags($current['cbody']);\r
- $data = array(\r
- 'commentdate' => date("Y-m-d@H:i", strtotime($current['ctime'])),\r
- 'batchid' => listplug_nextBatchId(),\r
- 'commentid' => $current['cnumber'],\r
- 'commentbody' => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- if ( isset($current['mname']) )\r
- {\r
- $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER;\r
- }\r
- else\r
- {\r
- $data['commentator'] = Entity::hsc($current['cuser']);\r
- }\r
- if ( isset($current['cmail']) && $current['cmail'] )\r
- {\r
- $data['commentsite'] = Entity::hsc($current['cmail']);\r
- }\r
- else\r
- {\r
- $data['commentsite'] = '';\r
- }\r
- if ( isset($current['cemail']) && $current['cemail'] )\r
- {\r
- $data['commentmail'] = Entity::hsc($current['cemail']);\r
- }\r
- else\r
- {\r
- $data['commentmail'] = '';\r
- }\r
- if ( $vars['canAddBan'] )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )\r
- {\r
- $subTpl = "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a>"\r
- . "</td>\n";\r
- }\r
- else\r
- {\r
- $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];\r
- }\r
- $subData = array(\r
- 'itemid' => $current['citem'],\r
- 'banip' => Entity::hsc($current['cip']),\r
- 'banbtn' => _LIST_COMMENT_BANIP,\r
- );\r
- $data['addbanlist'] = Template::fill($subTpl, $subData);\r
- }\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )\r
- {\r
- $template = "";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_bloglist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )\r
- {\r
- $template = "<th><%blognames%></th>\n"\r
- . "<th colspan=\"7\"><%actionshead%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'blognames' => _NAME,\r
- 'actionshead' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )\r
- {\r
- $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"\r
- . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"\r
- . "<td><a href=\"index.php?action=createitem&blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"\r
- . "<td><a href=\"index.php?action=itemlist&blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"\r
- . "<td><a href=\"index.php?action=blogcommentlist&blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"\r
- . "<td><a href=\"index.php?action=bookmarklet&blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];\r
- }\r
- $data = array(\r
- 'blogid' => $current['bnumber'],\r
- 'shortname' => Entity::hsc($current['bshortname']),\r
- 'blogurl' => $current['burl'],\r
- 'blogname' => Entity::hsc($current['bname']),\r
- 'ttaddtext' => _BLOGLIST_TT_ADD,\r
- 'addtext' => _BLOGLIST_ADD,\r
- 'ttedittext' => _BLOGLIST_TT_EDIT,\r
- 'edittext' => _BLOGLIST_EDIT,\r
- 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,\r
- 'commenttext' => _BLOGLIST_COMMENTS,\r
- 'ttbmlettext' => _BLOGLIST_TT_BMLET,\r
- 'bmlettext' => _BLOGLIST_BMLET,\r
- );\r
- if ( $current['tadmin'] == 1 )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )\r
- {\r
- $template .= "<td><a href=\"index.php?action=blogsettings&blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"\r
- . "<td><a href=\"index.php?action=banlist&blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];\r
- }\r
- $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;\r
- $data['settingtext'] = _BLOGLIST_SETTINGS;\r
- $data['ttbanstext'] = _BLOGLIST_TT_BANS;\r
- $data['banstext'] = _BLOGLIST_BANS;\r
- }\r
- \r
- if ( $vars['superadmin'] )\r
- {\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )\r
- {\r
- $template .= "<td><a href=\"index.php?action=deleteblog&blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"><%deletetext%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'];\r
- }\r
- $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;\r
- $data['deletetext'] = _BLOGLIST_DELETE;\r
- }\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_shortblognames($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )\r
- {\r
- $template = "<th><%colshortname%></th>\n"\r
- . "<th><%colblogname%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];\r
- }\r
- $data = array(\r
- 'colshortname' => _EBLOG_SHORTNAME,\r
- 'colblogname' => _EBLOG_NAME,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )\r
- {\r
- $template = "<td><%bshortname%></td>\n"\r
- . "<td><%blogname%></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];\r
- }\r
- $data = array(\r
- 'bshortname' => Entity::hsc($current['bshortname']),\r
- 'blogname' => Entity::hsc($current['bname']),\r
- );\r
- break;\r
- case 'FOOT':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_shortnames($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )\r
- {\r
- $template = "<th><%colname%></th>\n"\r
- . "<th><%coldesc%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];\r
- }\r
- $data = array(\r
- 'colname' => _NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )\r
- {\r
- $template = "<td><%name%></td>\n"\r
- . "<td><%desc%></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];\r
- }\r
- $data = array(\r
- 'name' => Entity::hsc($current['name']),\r
- 'desc' => Entity::hsc($current['description']),\r
- );\r
- break;\r
- case 'FOOT':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_categorylist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )\r
- {\r
- $template = "<th><%colname%></th>\n"\r
- . "<th><%coldesc%></th>\n"\r
- . "<th colspan=\"2\"><%colact%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colname' => _LISTS_NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )\r
- {\r
- $template = "<td>\n"\r
- . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"\r
- . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"\r
- . "</td>\n"\r
- . "<td><%catdesc%></td>\n"\r
- . "<td><a href=\"index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"\r
- . "<td><a href=\"index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];\r
- }\r
- \r
- $data = array(\r
- 'batchid' => listplug_nextBatchId(),\r
- 'catid' => intval($current['catid']),\r
- 'catname' => Entity::hsc($current['cname']),\r
- 'catdesc' => Entity::hsc($current['cdesc']),\r
- 'blogid' => intval($current['cblog']),\r
- 'tabindex' => intval($vars['tabindex']),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_templatelist($vars, $type, $template_name = '')\r
-{\r
- global $manager, $CONF;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )\r
- {\r
- $template = "<th><%colname%></th>\n"\r
- . "<th><%coldesc%></th>\n"\r
- . "<th colspan=\"3\"><%colact%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colname' => _LISTS_NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )\r
- {\r
- $template = "<td><%templatename%></td>\n"\r
- . "<td><%templatedesc%></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">\n"\r
- . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">\n"\r
- . "<a href=\"<%deleteurl%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"\r
- . "</td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];\r
- }\r
- \r
- $data = array(\r
- 'templatename' => Entity::hsc($current['tdname']),\r
- 'templatedesc' => Entity::hsc($current['tddesc']),\r
- 'templateid' => (integer) $current['tdnumber'],\r
- 'tabindex' => (integer) $vars['tabindex'],\r
- \r
- 'clonebtn' => _LISTS_CLONE,\r
- 'cloneaction' => $vars['cloneaction'],\r
- 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&templateid={$current['tdnumber']}",\r
- \r
- 'delbtn' => _LISTS_DELETE,\r
- 'deleteaction' => $vars['deleteaction'],\r
- 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&templateid={$current['tdnumber']}",\r
- \r
- 'editbtn' => _LISTS_EDIT,\r
- 'editaction' => $vars['editaction'],\r
- 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&templateid={$current['tdnumber']}"\r
- );\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_skinlist($vars, $type, $template_name = '')\r
-{\r
- global $CONF, $DIR_SKINS, $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )\r
- {\r
- $template = "<th><%colname%></th>\n"\r
- . "<th><%coldesc%></th>\n"\r
- . "<th colspan=\"3\"><%colact%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colname' => _LISTS_NAME,\r
- 'coldesc' => _LISTS_DESC,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )\r
- {\r
- $template = "<td><%skinname%><br /><br />\n"\r
- . "<%skintypelabel%> <%skintype%><br />\n"\r
- . "<%incmodelabel%> <%incmode%><br />\n"\r
- . "<%incpreflabel%> <%incpref%><br />\n"\r
- . "<%skinthumb%>"\r
- . "<%readme%></td>\n"\r
- . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>"\r
- . "</td>\n"\r
- . "<td style=\"white-space:nowrap\">"\r
- . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>"\r
- . "</td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];\r
- }\r
- \r
- $data = array(\r
- 'tabindex' => $vars['tabindex']++,\r
- \r
- 'skinid' => (integer) $current['sdnumber'],\r
- 'skindesc' => Entity::hsc($current['sddesc']),\r
- \r
- 'skintypelabel' => _LISTS_TYPE,\r
- 'skintype' => Entity::hsc($current['sdtype']),\r
- \r
- 'incmodelabel' => _LIST_SKINS_INCMODE,\r
- 'incmode' => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,\r
- \r
- 'incpreflabel' => ($current['sdincpref']) ? _SKIN_INCLUDE_PREFIX : '',\r
- 'incpref' => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '',\r
- \r
- 'editbtn' => _LISTS_EDIT,\r
- 'editaction' => $vars['editaction'],\r
- 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}",\r
- \r
- 'clonebtn' => _LISTS_CLONE,\r
- 'cloneaction' => $vars['cloneaction'],\r
- 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}",\r
- \r
- 'delbtn' => _LISTS_DELETE,\r
- 'deleteaction' => $vars['deleteaction'],\r
- 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}"\r
- );\r
- \r
- if ( $current['sdnumber'] != $vars['default'] )\r
- {\r
- $data['skinname'] = Entity::hsc($current['sdname']);\r
- }\r
- else\r
- {\r
- $data['skinname'] = '<strong>' . Entity::hsc($current['sdname']) . '</strong>';\r
- }\r
- \r
- // add preview image when present\r
- if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )\r
- {\r
- $data['skinthumb'] = "<p>\n";\r
- \r
- $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);\r
- $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');\r
- if ( $has_enlargement )\r
- {\r
- $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";\r
- }\r
- $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";\r
- if ( $has_enlargement )\r
- {\r
- $data['skinthumb'] .= "</a><br />\n";\r
- }\r
- \r
- if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )\r
- {\r
- $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';\r
- $title = sprintf(_LIST_SKIN_README, $current['sdname']);\r
- $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";\r
- }\r
- else\r
- {\r
- $data['readme'] ="";\r
- }\r
- \r
- $data['skinthumb'] .= "</p>\n";\r
- }\r
- \r
- $skin =& $manager->getSkin($current['sdnumber'], $vars['handler']);\r
- $available_types = $skin->getAvailableTypes();\r
- \r
- $data['skinparts'] = _LIST_SKINS_DEFINED\r
- . "<ul>\n";\r
- foreach ( $available_types as $type => $label )\r
- {\r
- if ( $label === FALSE )\r
- {\r
- $label = ucfirst($type);\r
- $article = 'skinpartspecial';\r
- }\r
- else\r
- {\r
- $article = "skinpart{$type}";\r
- }\r
- $data['skinparts'] .= "<li>\n"\r
- . helpHtml($article) . "\n"\r
- . "<a href=\"{$CONF['AdminURL']}index.php?action={$vars['edittypeaction']}&skinid={$current['sdnumber']}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"\r
- . Entity::hsc($label)\r
- . "</a>\n"\r
- . "</li>\n";\r
- }\r
- $data['skinparts'] .= "</ul>\n";\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )\r
- {\r
- $template = "";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_draftlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )\r
- {\r
- $template = "<th><%colblog%></th>\n"\r
- . "<th><%coldesc%></th>\n"\r
- . "<th colspan=\"2\"><%colact%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colblog' => _LISTS_BLOG,\r
- 'coldesc' => _LISTS_TITLE,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )\r
- {\r
- $template = "<td><%bshortname%></td>\n"\r
- . "<td><%ititle%></td>\n"\r
- . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"\r
- . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];\r
- }\r
- $data = array(\r
- 'bshortname' => Entity::hsc($current['bshortname']),\r
- 'ititle' => Entity::hsc(strip_tags($current['ititle'])),\r
- 'itemid' => intval($current['inumber']),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_otherdraftlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )\r
- {\r
- $template = "<th><%colblog%></th>\n"\r
- . "<th><%coldesc%></th>\n"\r
- . "<th><%colautr%></th>\n"\r
- . "<th colspan=\"2\"><%colact%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'colblog' => _LISTS_BLOG,\r
- 'coldesc' => _LISTS_TITLE,\r
- 'colautr' => _LISTS_AUTHOR,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )\r
- {\r
- $template = "<td><%bshortname%></td>\n"\r
- . "<td><%ititle%></td>\n"\r
- . "<td><%iauthor%></td>\n"\r
- . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"\r
- . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];\r
- }\r
- $data = array(\r
- 'bshortname' => Entity::hsc($current['bshortname']),\r
- 'ititle' => Entity::hsc(strip_tags($current['ititle'])),\r
- 'iauthor' => Entity::hsc(strip_tags($current['mname'])),\r
- 'itemid' => intval($current['inumber']),\r
- 'editbtn' => _LISTS_EDIT,\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_actionlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )\r
- {\r
- $template = "<th><%coltime%></th>\n"\r
- . "<th><%colmesg%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'coltime' => _LISTS_TIME,\r
- 'colmesg' => _LIST_ACTION_MSG,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )\r
- {\r
- $template = "<td><%timestamp%></td>\n"\r
- . "<td><%message%></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];\r
- }\r
- $data = array(\r
- 'timestamp' => Entity::hsc($current['timestamp']),\r
- 'message' => Entity::hsc($current['message']),\r
- );\r
- break;\r
- case 'FOOT':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-function listplug_table_banlist($vars, $type, $template_name = '')\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( !empty($template_name) )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )\r
- {\r
- $template = "<th><%iprange%></th>\n"\r
- . "<th><%reason%></th>\n"\r
- . "<th><%colact%></th>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];\r
- }\r
- $data = array(\r
- 'iprange' => _LIST_BAN_IPRANGE,\r
- 'reason' => _LIST_BAN_REASON,\r
- 'colact' => _LISTS_ACTIONS,\r
- );\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )\r
- {\r
- $template = "<td><%iprange%></td>\n"\r
- . "<td><%reason%></td>\n"\r
- . "<td><a href=\"index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>\"><%delbtn%></a></td>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];\r
- }\r
- $data = array(\r
- 'iprange' => Entity::hsc($current['iprange']),\r
- 'reason' => Entity::hsc($current['reason']),\r
- 'blogid' => intval($current['blogid']),\r
- 'delbtn' => _LISTS_DELETE,\r
- );\r
- break;\r
- case 'FOOT':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )\r
- {\r
- $template = "\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];\r
- }\r
- $data = array();\r
- break;\r
- }\r
- return Template::fill($template, $data);\r
-}\r
-\r
-/**\r
- * listplug_list_normalskinlist()\r
- * \r
- * @param array $vars array for variables\r
- * @param string $type HEAD/BODY/FOOT\r
- * @param string $template_name name of template\r
- * @return string marked-up string\r
- */\r
-function listplug_list_normalskinlist($vars, $type, $template_name = '')\r
-{\r
- global $manager, $CONF;\r
- \r
- /* available variables as a default */\r
- $data = array(\r
- 'skinid' => (integer) $vars['skinid'],\r
- 'skinname' => Entity::hsc($vars['skinname']),\r
- );\r
- \r
- $templates = array();\r
- if ( $template_name )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch ( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('NORMALSKINLIST_HEAD', $templates) || empty($templates['NORMALSKINLIST_HEAD']) )\r
- {\r
- $template = "<ul>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['NORMALSKINLIST_HEAD'];\r
- }\r
- \r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('NORMALSKINLIST_BODY', $templates) || empty($templates['NORMALSKINLIST_BODY']) )\r
- {\r
- $template = "<li>"\r
- . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%skintypename%></a>"\r
- . " <%help%>"\r
- . "</li>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['NORMALSKINLIST_BODY'];\r
- }\r
- \r
- $data['tabindex'] = $vars['tabindex']++;\r
- $data['skintype'] = $current['skintype'];\r
- $data['skintypename'] = $current['skintypename'];\r
- $data['editaction'] = $vars['editaction'];\r
- $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";\r
- /* TODO: removeaction? */\r
- /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */\r
- $data['help'] = '';\r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) )\r
- {\r
- $template = "</ul>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['NORMALSKINLIST_FOOT'];\r
- }\r
- \r
- break;\r
- }\r
- \r
- return Template::fill($template, $data);\r
-}\r
-\r
-/**\r
- * listplug_list_specialskinlist()\r
- * \r
- * @param array $vars array for variables\r
- * @param string $type HEAD/BODY/FOOT\r
- * @param string $template_name name of template\r
- * @return string marked-up string\r
- */\r
-function listplug_list_specialskinlist($vars, $type, $template_name = '')\r
-{\r
- global $manager, $CONF;\r
- \r
- /* available variables as a default */\r
- $data = array(\r
- 'skinid' => (integer) $vars['skinid'],\r
- 'skinname' => Entity::hsc($vars['skinname']),\r
- );\r
- \r
- /* retrieve templates */\r
- $templates = array();\r
- if ( $template_name )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- switch ( $type )\r
- {\r
- case 'HEAD':\r
- if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) )\r
- {\r
- $template = "<ul>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SPECIALSKINLIST_HEAD'];\r
- }\r
- break;\r
- case 'BODY':\r
- $current = $vars['current'];\r
- if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )\r
- {\r
- $template = "<li>"\r
- . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\">"\r
- . "<%skintype%>"\r
- . "</a>"\r
- . " ("\r
- . "<a href=\"<%removeurl%>\" tabindex=\"<%tabindex%>\" >"\r
- . "<%text(_LISTS_DELETE)%>"\r
- . "</a>"\r
- . ")"\r
- . "</li>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SPECIALSKINLIST_BODY'];\r
- }\r
- \r
- $data['tabindex'] = (integer) $vars['tabindex']++;\r
- $data['skintype'] = Entity::hsc($current['skintype']);\r
- $data['skintypename'] = Entity::hsc($current['skintypename']);\r
- $data['editaction'] = $vars['editaction'];\r
- $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";\r
- $data['removeaction'] = $vars['editaction'];\r
- $data['removeurl'] = "{$CONF['AdminURL']}?action={$vars['removeaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";\r
- \r
- break;\r
- case 'FOOT':\r
- if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) )\r
- {\r
- $template = "</ul>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['SPECIALSKINLIST_FOOT'];\r
- }\r
- break;\r
- }\r
- \r
- return Template::fill($template, $data);\r
-}\r
-\r
-/**\r
- * listplug_input_yesno()\r
- *\r
- * @param string $name name of input element with radio type attribute\r
- * @param string $checkedval value which should be checked\r
- * @param integer $tabindex tabindex number\r
- * @param string $value1 value of radio 1\r
- * @param string $value2 value of radio 2\r
- * @param string $yesval label for yes\r
- * @param string $noval label for no\r
- * @param boolean $isAdmin super admin or not\r
- * @param string $template_name name of template\r
- * @param boolean $showlist used in showlist or not\r
- * @return string marked-up string\r
- */\r
-function listplug_input_yesno($name, $checkedval, $tabindex = 0,\r
- $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO,\r
- $isAdmin = 0, $template_name = '', $showlist = FALSE)\r
-{\r
- global $manager;\r
- \r
- $templates = array();\r
- if ( $template_name )\r
- {\r
- $templates =& $manager->getTemplate($template_name);\r
- }\r
- \r
- if ( $name == 'admin' )\r
- {\r
- if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )\r
- {\r
- $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n"\r
- . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"\r
- . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n"\r
- . "<label for=\"<%noid%>\"><%novaltext%></label>\n";\r
- }\r
- else\r
- {\r
- $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];\r
- }\r
- }\r
- else\r
- {\r
- if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )\r
- {\r
- $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];\r
- }\r
- else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];\r
- }\r
- else\r
- {\r
- $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n"\r
- . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"\r
- . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n"\r
- . "<label for=\"<%noid%>\"><%novaltext%></label>\n";\r
- }\r
- }\r
- \r
- $id = preg_replace('#[|]#', '-', $name);\r
- $id1 = $id . $value1;\r
- $id2 = $id . $value2;\r
- $dat = array(\r
- 'name' => Entity::hsc($name),\r
- 'yesval' => Entity::hsc($value1),\r
- 'noval' => Entity::hsc($value2),\r
- 'yesid' => Entity::hsc($id1),\r
- 'noid' => Entity::hsc($id2),\r
- 'yesvaltext' => $yesval,\r
- 'novaltext' => $noval,\r
- 'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',\r
- 'nocheckedval' => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',\r
- 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',\r
- );\r
- \r
- return Template::fill($template, $dat);\r
-}\r
-\r
-/**\r
- * listplug_batchlist()\r
- * \r
- * @param string $attr item/member/team/category/comment\r
- * @param resource $query SQL resorce\r
- * @param string $type type for showlist()\r
- * @param array $vars array for variables\r
- */\r
-function listplug_batchlist($attr, $query, $type, $vars, $template_name)\r
-{\r
- global $manager;\r
- \r
- /* HEAD */\r
- $content = "<form method=\"post\" action=\"index.php\">\n";\r
- \r
- /* BODY */\r
- $content .= showlist($query, $type, $vars, $template_name);\r
- \r
- /* FOOT */\r
- switch ( $attr )\r
- {\r
- case 'item':\r
- $options = array(\r
- 'delete' => _BATCH_ITEM_DELETE,\r
- 'move' => _BATCH_ITEM_MOVE\r
- );\r
- break;\r
- case 'member':\r
- $options = array(\r
- 'delete' => _BATCH_MEMBER_DELETE,\r
- 'setadmin' => _BATCH_MEMBER_SET_ADM,\r
- 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM\r
- );\r
- break;\r
- case 'team':\r
- $options = array(\r
- 'delete' => _BATCH_TEAM_DELETE,\r
- 'setadmin' => _BATCH_TEAM_SET_ADM,\r
- 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,\r
- );\r
- break;\r
- case 'category':\r
- $options = array(\r
- 'delete' => _BATCH_CAT_DELETE,\r
- 'move' => _BATCH_CAT_MOVE,\r
- );\r
- break;\r
- case 'comment':\r
- $options = array(\r
- 'delete' => _BATCH_COMMENT_DELETE,\r
- );\r
- break;\r
- default:\r
- $options = array();\r
- break;\r
- }\r
- \r
- $content .= "<p class=\"batchoperations\">\n"\r
- . _BATCH_WITH_SEL\r
- . "<select name=\"batchaction\">\n";\r
- \r
- foreach ( $options as $option => $label )\r
- {\r
- $content .= "<option value=\"{$option}\">{$label}</option>\n";\r
- }\r
- $content .= "</select>\n";\r
- \r
- if ( $attr == 'team' )\r
- {\r
- $content .= '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . '" />';\r
- }\r
- else if ( $attr == 'comment' )\r
- {\r
- $content .= '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . '" />';\r
- }\r
- \r
- $content .= '<input type="submit" value="' . _BATCH_EXEC . '" />'\r
- . "("\r
- . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(1); \">" . _BATCH_SELECTALL . "</a>"\r
- . " - "\r
- . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(0); \">" . _BATCH_DESELECTALL . "</a>"\r
- . ")\n"\r
- . "<input type=\"hidden\" name=\"action\" value=\"batch{$attr}\" />\n"\r
- . '<input type="hidden" name="ticket" value="' . Entity::hsc($manager->getNewTicket()) . '" />' . "\n"\r
- . "</p>\n"\r
- . "</form>\n";\r
- \r
- return $content;\r
-}\r
-\r
-/**\r
- * listplug_navlist()\r
- * \r
- * @param string $attr item/member/team/category/comment\r
- * @param resource $query SQL resorce\r
- * @param string $type type for showlist()\r
- * @param array $vars array for variables\r
- * @param string $template_name name of template\r
- * @return string contents\r
- */\r
-function listplug_navlist($attribute, $query, $type, $vars, $template_name)\r
-{\r
- global $CONF;\r
- \r
- $prev = $vars['start'] - $vars['amount'];\r
- if ( $prev < $vars['minamount'] )\r
- {\r
- $prev = $vars['minamount'];\r
- }\r
- \r
- $next = $vars['start'] + $vars['amount'];\r
- \r
- $navi = "\n";\r
- $navi .= "<table frame=\"box\" rules=\"all\" sumamry=\"navigation actions\" class=\"navigation\">\n"\r
- . "<tr>\n";\r
- $navi .= "<td>\n"\r
- . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"\r
- . "<input type=\"hidden\" name=\"start\" value=\"{$prev}\" />\n"\r
- . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">< < " . _LISTS_PREV . "</button>\n"\r
- . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"\r
- . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"\r
- . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"\r
- . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"\r
- . "</form>\n"\r
- . "</td>\n";\r
- $navi .= "<td>\n"\r
- . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"\r
- . "<input type=\"text\" name=\"amount\" size=\"3\" value=\"{$vars['amount']}\" />\n"\r
- . _LISTS_PERPAGE\r
- . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"\r
- . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_CHANGE . "</button>\n"\r
- . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"\r
- . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"\r
- . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"\r
- . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"\r
- . "</form>\n"\r
- . "</td>\n";\r
- $navi .= "<td>\n"\r
- . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"\r
- . "<input type=\"text\" name=\"search\" value=\"{$vars['search']}\" size=\"7\" />\n"\r
- . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"\r
- . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_SEARCH . "</button>\n"\r
- . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"\r
- . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"\r
- . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"\r
- . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"\r
- . "</form>\n"\r
- . "</td>\n";\r
- $navi .= "<td>\n"\r
- . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"\r
- . "<input type=\"hidden\" name=\"start\" value=\"{$next}\" />\n"\r
- . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">" . _LISTS_NEXT . "> > </button>\n"\r
- . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"\r
- . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"\r
- . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"\r
- . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"\r
- . "</form>\n"\r
- . "</td>\n";\r
- $navi .= "</tr>\n"\r
- . "</table>\n";\r
- \r
- /* HEAD */\r
- $template = $navi;\r
- \r
- /* BODY */\r
- $template .= listplug_batchlist($attribute, $query, $type, $vars, $template_name);\r
- \r
- /* FOOT */\r
- $template .= $navi;\r
- \r
- return $template;\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Functions to create lists of things inside the admin are
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: showlist.php 1886 2012-06-17 08:27:27Z sakamocchi $
+ */
+
+
+// can take either an array of objects, or an SQL query
+function showlist($query, $type, $vars, $template_name = '')
+{
+ $contents = '';
+
+ /* count */
+ if ( is_string($query) )
+ {
+ $resource = DB::getResult($query);
+ }
+ else
+ {
+ $resource = $query;
+ }
+
+ /* HEAD */
+ $contents .= call_user_func("listplug_{$type}", $vars, 'HEAD', $template_name);
+
+ /* BODY */
+ foreach ( $resource as $row )
+ {
+ $vars['current'] = $row;
+ $contents .= call_user_func("listplug_{$type}", $vars, 'BODY', $template_name);
+ }
+
+ /* FOOT */
+ $contents .= call_user_func("listplug_{$type}", $vars, 'FOOT', $template_name);
+
+ /* close SQL resource */
+ if ( is_string($query) )
+ {
+ $resource->closeCursor();
+ }
+
+ return $contents;
+}
+
+function listplug_select($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )
+ {
+ $template = "<select name=\"<%name%>\" tabindex=\"<%tabindex%>\" <%javascript%>>\n"
+ . "<%extraoption%>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];
+ }
+ $data = array(
+ 'name' => $vars['name'],
+ 'tabindex' => $vars['tabindex'],
+ 'javascript' => !array_key_exists('javascript', $vars) ? '' : $vars['javascript'],
+ 'extraoption' => !array_key_exists('extra', $vars) ? '' : "<option value=\"\">{$vars['extra']}</option>"
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) )
+ {
+ $template = "<option value=\"<%value%>\" <%selected%> title=\"<%title%>\"><%option%></option>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_SELECT_BODY'];
+ }
+ $data = array(
+ 'value' => Entity::hsc($current['value']),
+ 'selected' => ($vars['selected'] == $current['value']) ? 'selected="selected"' : '',
+ );
+ if ( array_key_exists('shorten', $vars) && $vars['shorten'] > 0 )
+ {
+ $data['title'] = Entity::hsc($current['text']);
+ $data['option'] = Entity::hsc(Entity::shorten($current['text'], $vars['shorten'], $vars['shortenel']));
+ }
+ else
+ {
+ $data['title'] = '';
+ }
+ $data['option'] = Entity::hsc($current['text']);
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) )
+ {
+ $template = "</select>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+
+ return Template::fill($template, $data);
+}
+
+function listplug_table($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )
+ {
+ $template = "<table frame=\"box\" rules=\"all\" summary=\"{$vars['content']}\">\n"
+ . "<thead>\n"
+ . "<tr>\n"
+ . "<%typehead%>\n"
+ . "</tr>\n"
+ . "</thead>\n"
+ . "<tbody>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];
+ }
+ $data = array(
+ 'summary' => $vars['content'],
+ 'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $template_name)
+ );
+ break;
+ case 'BODY':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )
+ {
+ $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\">\n"
+ . "<%typebody%>\n"
+ . "</tr>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];
+ }
+ // tabletype specific thingies
+ $data = array(
+ 'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $template_name)
+ );
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )
+ {
+ $template = "<%typefoot%>\n"
+ . "</tbody>\n"
+ . "</table>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];
+ }
+ // tabletype specific thingies
+ $data = array(
+ 'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $template_name)
+ );
+ break;
+ }
+
+ return Template::fill($template, $data);
+}
+
+function listplug_table_memberlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )
+ {
+ $template = "<th><%colmembername%></th>\n"
+ . "<th><%colmemberrname%></th>\n"
+ . "<th><%colmemberurl%></th>\n"
+ . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"
+ . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"
+ . "<th colspan=\"2\"><%colactions%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];
+ }
+ $data = array(
+ 'colmembername' => _LIST_MEMBER_NAME,
+ 'colmemberrname' => _LIST_MEMBER_RNAME,
+ 'colmemberurl' => _LIST_MEMBER_URL,
+ 'colmemberadmin' => _LIST_MEMBER_ADMIN,
+ 'colmemberlogin' => _LIST_MEMBER_LOGIN,
+ 'colactions' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )
+ {
+ $template = "<td>\n"
+ . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
+ . "<label for=\"batch<%id%>\">\n"
+ . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
+ . "</label>\n</td>\n"
+ . "<td><%realname%></td>\n"
+ . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"
+ . "<td><%admin%></td>\n"
+ . "<td><%login%></td>\n"
+ . "<td><a href=\"index.php?action=memberedit&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
+ . "<td><a href=\"index.php?action=memberdelete&memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];
+ }
+ $data = array(
+ 'id' => listplug_nextBatchId(),
+ 'memberid' => $current['mnumber'],
+ 'mailaddress' => Entity::hsc($current['memail']),
+ 'tabindex' => $vars['tabindex'],
+ 'name' => Entity::hsc($current['mname']),
+ 'realname' => Entity::hsc($current['mrealname']),
+ 'url' => Entity::hsc($current['murl']),
+ 'admin' => $current['madmin'] ? _YES : _NO,
+ 'login' => $current['mcanlogin'] ? _YES : _NO,
+ 'editbtn' => _LISTS_EDIT,
+ 'deletebtn' => _LISTS_DELETE,
+ );
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )
+ {
+ $template = "";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_teamlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )
+ {
+ $template = "<th><%colmembername%></th>\n"
+ . "<th><%colmemberrname%></th>\n"
+ . "<th><%colteamadmin%><%helplink(teamadmin)%></th>\n"
+ . "<th colspan=\"2\"><%colactions%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];
+ }
+ $data = array(
+ 'colmembername' => _LIST_MEMBER_NAME,
+ 'colmemberrname' => _LIST_MEMBER_RNAME,
+ 'colteamadmin' => _LIST_TEAM_ADMIN,
+ 'colactions' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )
+ {
+ $template = "<td>\n"
+ . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
+ . "<label for=\"batch<%id%>\">\n"
+ . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
+ . "</label>\n</td>\n"
+ . "<td><%realname%></td>\n"
+ . "<td><%admin%></td>\n"
+ . "<td><a href=\"index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n"
+ . "<td><a href=\"<%chadminurl%>\" tabindex=\"<%tabindex%>\"><%chadminbtn%></a></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];
+ }
+ $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current['tmember']) . '&blogid=' . intval($current['tblog']);
+ $url = $manager->addTicketToUrl($url);
+ $data = array(
+ 'id' => listplug_nextBatchId(),
+ 'memberid' => $current['tmember'],
+ 'mailaddress' => Entity::hsc($current['memail']),
+ 'tabindex' => $vars['tabindex'],
+ 'name' => Entity::hsc($current['mname']),
+ 'realname' => Entity::hsc($current['mrealname']),
+ 'admin' => ($current['tadmin'] ? _YES : _NO),
+ 'blogid' => $current['tblog'],
+ 'deletebtn' => '<%text(_LISTS_DELETE)%>',
+ 'chadminurl' => Entity::hsc($url),
+ 'chadminbtn' => '<%text(_LIST_TEAM_CHADMIN)%>'
+ );
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )
+ {
+ $template = "";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_pluginlist($vars, $type, $template_name = '')
+{
+ static $plugins = array();
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )
+ {
+ $template = "<th><%colinfo%></th>\n"
+ . "<th><%coldesc%></th>\n"
+ . "<th colspan=\"2\"><%colactions%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];
+ }
+ $data = array(
+ 'colinfo' => _LISTS_INFO,
+ 'coldesc' => _LISTS_DESC,
+ 'colactions' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+
+ $plug =& $manager->getPlugin($current['pfile']);
+ if ( $plug )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )
+ {
+ $template = "<td>\n"
+ . "<strong><%plugname%></strong><br />\n"
+ . "<%autherlabel%> <%plugauther%><br />\n"
+ . "<%versionlabel%> <%plugversion%><br />\n"
+ . "<%pluggeturl%><br />\n"
+ . "</td>\n"
+ . "<td>\n"
+ . "<%desclabel%><br /><%plugdesc%>\n"
+ . "<%eventlist%>\n"
+ . "<%needupdate%>\n"
+ . "<%dependlist%>\n"
+ . "<%depreqlist%>\n"
+ . "</td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];
+ }
+ $data = array(
+ 'plugname' => Entity::hsc($plug->getName()),
+ 'autherlabel' => _LIST_PLUGS_AUTHOR,
+ 'plugauther' => Entity::hsc($plug->getAuthor()),
+ 'versionlabel' => _LIST_PLUGS_VER,
+ 'plugversion' => Entity::hsc($plug->getVersion()),
+ 'tabindex' => $vars['tabindex'],
+ 'desclabel' => _LIST_PLUGS_DESC,
+ 'plugdesc' => Entity::hen($plug->getDescription()),
+ );
+ if ( $plug->getURL() )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )
+ {
+ $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];
+ }
+ $subData = array(
+ 'plugurl' => Entity::hsc($plug->getURL()),
+ 'tabindex' => $vars['tabindex'],
+ 'plugsite' => _LIST_PLUGS_SITE,
+ );
+ $data['pluggeturl'] = Template::fill($subTpl, $subData);
+ }
+ else
+ {
+ $data['pluggeturl'] = '';
+ }
+ if ( count($plug->getEventList()) > 0 )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )
+ {
+ $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];
+ }
+ $subData = array(
+ 'evntlstlbl' => _LIST_PLUGS_SUBS,
+ 'eventlist' => Entity::hsc(implode(', ', $plug->getEventList())),
+ );
+ $data['eventlist'] = Template::fill($subTpl, $subData);
+ }
+ else
+ {
+ $data['eventlist'] = '';
+ }
+ if ( !$plug->subscribtionListIsUptodate() )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )
+ {
+ $subTpl = "<br /><br /><strong><%updatealert%></strong>";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];
+ }
+ $subData = array(
+ 'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,
+ );
+ $data['needupdate'] = Template::fill($subTpl, $subData);
+ }
+ else
+ {
+ $data['needupdate'] = '';
+ }
+ if ( count($plug->getPluginDep() ) > 0)
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )
+ {
+ $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];
+ }
+ $subData = array(
+ 'deplistlbl' => _LIST_PLUGS_DEP,
+ 'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),
+ );
+ $data['dependlist'] = Template::fill($subTpl, $subData);
+ }
+ else
+ {
+ $data['dependlist'] = '';
+ }
+ /* check dependency */
+ if ( empty($plugins) )
+ {
+ $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
+ }
+ $req = array();
+ foreach ( $plugins as $plugin )
+ {
+ $preq =& $manager->getPlugin($plugin['pfile']);
+ if ( $preq )
+ {
+ $depList = $preq->getPluginDep();
+ foreach ( $depList as $depName )
+ {
+ if ( $current['pfile'] == $depName )
+ {
+ $req[] = $plugin['pfile'];
+ }
+ }
+ }
+ }
+
+ if ( count($req) > 0 )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )
+ {
+ $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];
+ }
+ $subData = array(
+ 'deprlstlbl' => _LIST_PLUGS_DEPREQ,
+ 'depreqlist' => Entity::hsc(implode(', ', $req)),
+ );
+ $data['depreqlist'] = Template::fill($subTpl, $subData);
+ }
+ else
+ {
+ $data['depreqlist'] = '';
+ }
+ }
+ else
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )
+ {
+ $template = "<td colspan=\"2\"><%noplugalert%></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];
+ }
+ $data = array(
+ 'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])),
+ );
+ }
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )
+ {
+ $template .= "<td>\n"
+ . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"
+ . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"
+ . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"
+ . "<%plugadminurl%>\n"
+ . "<%plughelpurl%>\n"
+ . "<%plugoptsetting%>\n"
+ . "</td>\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];
+ }
+
+ $baseUrl = 'index.php?plugid=' . $current['pid'] . '&action=';
+ $upUrl = $manager->addTicketToUrl($baseUrl . 'pluginup');
+ $downUrl = $manager->addTicketToUrl($baseUrl . 'plugindown');
+
+ $data['actionuptxt'] = _LIST_PLUGS_UP;
+ $data['actionupurl'] = Entity::hsc($upUrl);
+ $data['actiondowntxt'] = _LIST_PLUGS_DOWN;
+ $data['actiondownurl'] = Entity::hsc($downUrl);
+ $data['actuninsttxt'] = _LIST_PLUGS_UNINSTALL;
+ $data['actuninsturl'] = 'index.php?action=plugindelete&plugid=' . $current['pid'];
+
+ if ( $plug && ($plug->hasAdminArea() > 0) )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )
+ {
+ $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];
+ }
+ $subData = array(
+ 'actadminurl' => Entity::hsc($plug->getAdminURL()),
+ 'tabindex' => $vars['tabindex'],
+ 'actadmintxt' => _LIST_PLUGS_ADMIN,
+ );
+ $data['plugadminurl'] = Template::fill($subTpl, $subData);
+ }
+ else
+ {
+ $data['plugadminurl'] = '';
+ }
+ if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )
+ {
+ $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];
+ }
+ $subData = array(
+ 'acthelpurl' => 'index.php?action=pluginhelp&plugid=' . $current['pid'],
+ 'tabindex' => $vars['tabindex'],
+ 'acthelptxt' => _LIST_PLUGS_HELP,
+ );
+ $data['plughelpurl'] = Template::fill($subTpl, $subData);
+ }
+ else
+ {
+ $data['plughelpurl'] = '';
+ }
+ $optQuery = 'SELECT '
+ . ' COUNT(*) AS result '
+ . 'FROM '
+ . sql_table('plugin_option_desc') . ' '
+ . 'WHERE '
+ . ' ocontext = "global" '
+ . 'AND opid = %d';
+ $pOptions = DB::getValue(sprintf($optQuery, $current['pid']));
+ if ( $pOptions > 0 )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )
+ {
+ $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];
+ }
+ $subData = array(
+ 'actoptionurl' => 'index.php?action=pluginoptions&plugid=' . $current['pid'],
+ 'tabindex' => $vars['tabindex'],
+ 'actoptiontxt' => _LIST_PLUGS_OPTIONS,
+ );
+ $data['plugoptsetting'] = Template::fill($subTpl, $subData);
+ }
+ else
+ {
+ $data['plugoptsetting'] = '';
+ }
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )
+ {
+ $template = "";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_plugoptionlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )
+ {
+ $template = "<th><%colinfo%></th>\n"
+ . "<th><%colvalue%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];
+ }
+ $data = array(
+ 'colinfo' => _LISTS_INFO,
+ 'colvalue' => _LISTS_VALUE,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ $template = listplug_plugOptionRow($current, $template_name);
+ $data = array();
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )
+ {
+ $template = "<tr>\n"
+ . "<th colspan=\"2\"><%savetext%></th>\n"
+ . "</tr>\n"
+ . "<tr>\n"
+ . "<td><%savetext%></td>\n"
+ . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>\n"
+ . "</tr>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];
+ }
+ $data = array(
+ 'savetext' => _PLUGS_SAVE,
+ );
+ break;
+ }
+
+ return Template::fill($template, $data);
+}
+
+function listplug_plugOptionRow($current, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
+
+ // retreive the optionmeta
+ $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
+
+ // only if it is not a hidden option write the controls to the page
+ if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
+ {
+ return false;
+ }
+ else
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )
+ {
+ $template = "<td><%description%></td>\n"
+ . "<td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];
+ }
+
+ $data = array();
+
+ switch($current['type'])
+ {
+ case 'yesno':
+ $template .= listplug_input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $template_name, 1);
+ break;
+ case 'password':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )
+ {
+ $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];
+ }
+ $data = array(
+ 'varname' => Entity::hsc($varname),
+ 'value' => Entity::hsc($current['value']),
+ );
+ break;
+ case 'select':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )
+ {
+ $template .= "<select name=\"<%varname%>\">\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];
+ }
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )
+ {
+ $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];
+ }
+ $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
+ $options = preg_split('#\|#', $options);
+
+ for ( $i=0; $i<(count($options)-1); $i+=2 )
+ {
+ $name = $options[$i];
+ $value = $options[$i+1];
+ if ( defined($name) )
+ {
+ $name = constant($name);
+ }
+
+ $subData = array(
+ 'optname' => Entity::hsc($name),
+ 'value' => Entity::hsc($value)
+ );
+ if ($value != $current['value'])
+ {
+ $subData['selected'] = '';
+ }
+ else
+ {
+ $subData['selected'] = ' selected="selected"';
+ }
+ $template .= Template::fill($subTpl, $subData);
+ }
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )
+ {
+ $template .= "</select>\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];
+ }
+ $data['varname'] = Entity::hsc($varname);
+ break;
+ case 'textarea':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )
+ {
+ $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];
+ }
+ $data = array(
+ 'varname' => Entity::hsc($varname),
+ 'value' => Entity::hsc($current['value'])
+ );
+ if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
+ {
+ $data['readonly'] = '';
+ }
+ else
+ {
+ $data['readonly'] = ' readonly="readonly"';
+ }
+ break;
+ case 'text':
+ default:
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )
+ {
+ $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];
+ }
+ $data = array(
+ 'varname' => Entity::hsc($varname),
+ 'value' => Entity::hsc($current['value'])
+ );
+ if ( !array_key_exists('datatype', $current) || $current['datatype'] != 'numerical')
+ {
+ $data['datatype'] = '';
+ }
+ else
+ {
+ $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
+ }
+ if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
+ {
+ $data['readonly'] = '';
+ }
+ else
+ {
+ $data['readonly'] = ' readonly="readonly"';
+ }
+ }
+
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )
+ {
+ $template .= "<%extra%></td>\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];
+ }
+
+ if ( !array_key_exists('extra', $current) )
+ {
+ $data['extra'] = '';
+ }
+ else
+ {
+ $data['extra'] = Entity::hsc($current['extra']);
+ }
+
+ if ( !array_key_exists('description', $current) )
+ {
+ $data['description'] = Entity::hsc($current['name']);
+ }
+ else if ( !defined($current['description']) )
+ {
+ $data['description'] = Entity::hsc($current['description']);
+ }
+ else
+ {
+ $data['description'] = Entity::hsc(constant($current['description']));
+ }
+ }
+ return Template::fill($template, $data, 1);
+}
+
+/**
+ * listplug_templateEditRow()
+ *
+ * @param array $content content of target template
+ * @param string $desc description of target template
+ * @param string $name name of target template
+ * @param string $help help text
+ * @param integer $tabindex a number for tab index
+ * @param boolean $big large or small textarea
+ * @param array $template_name name of template for filling
+ * @return void
+ */
+function listplug_templateEditRow($content, $desc, $name, $help = '', $tabindex = 0, $big = 0, $template_name = '')
+{
+ global $manager;
+
+ static $count = 0;
+
+ $tmplt = array();
+ $base = array();
+
+ $templates = array();
+ if ( $template_name )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ $data = array(
+ 'description' => $desc,
+ 'help' => empty($help) ? '' : helpHtml('template' . $help),
+ 'count' => $count++,
+ 'name' => $name,
+ 'tabindex' => $tabindex,
+ 'rows' => $big ? 10 : 5,
+ );
+
+ $message = '';
+
+ /* row head */
+ if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
+ {
+ $template = "<tr>\n"
+ . "<td><%description%><%help%></td>\n"
+ . "<td id=\"td<%count%>\">\n"
+ . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">";
+ }
+ else
+ {
+ $template = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
+ }
+ $message .= TEMPLATE::fill($template, $data);
+
+ /* row content */
+ $message .= ENTITY::hsc($content);
+
+ /* row tail */
+ if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
+ {
+ $template = "</textarea>\n"
+ . "</td>\n"
+ . "</tr>\n";
+ }
+ else
+ {
+ $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
+ }
+ $message .= TEMPLATE::fill($template, $data);
+
+ return $message;
+}
+
+function listplug_table_itemlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $cssclass = '';
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )
+ {
+ $template = "<th><%colinfo%></th>\n"
+ . "<th><%colcontent%></th>\n"
+ . "<th style=\"white-space:nowrap\"><%colaction%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];
+ }
+ $data = array(
+ 'colinfo' => _LIST_ITEM_INFO,
+ 'colcontent' => _LIST_ITEM_CONTENT,
+ 'colaction' => _LISTS_ACTIONS
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ // string -> unix timestamp
+ $current['itime'] = strtotime($current['itime']);
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )
+ {
+ $template = "<td<%cssclass%>>\n"
+ . "<%bshortlabel%> <%bshortnameval%><br />\n"
+ . "<%categorylabel%> <%categorynameval%><br />\n"
+ . "<%authorlabel%> <%authornameval%><br />\n"
+ . "<%itemdatelabel%> <%itemdateval%><br />\n"
+ . "<%itemtimelabel%> <%itemtimeval%>\n"
+ . "</td>\n"
+ . "<td<%cssclass%>>\n"
+ . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n"
+ . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"
+ . "<%itembody%>\n"
+ . "</td>\n"
+ . "<td<%cssclass%>>\n"
+ . "<a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a><br />\n"
+ . "<a href=\"index.php?action=itemmove&itemid=<%itemid%>\"><%movebtn%></a><br />\n"
+ . "<a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a><br />\n"
+ . "<%camount%>\n"
+ . "</td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];
+ }
+ $cssclass = '';
+
+ if ( $current['idraft'] == 1 )
+ {
+ $cssclass = ' class="draft"';
+ }
+
+ // (can't use offset time since offsets might vary between blogs)
+ if ( $current['itime'] > $vars['now'] )
+ {
+ $cssclass = ' class="future"';
+ }
+ $body = strip_tags($current['ibody']);
+ $data = array(
+ 'cssclass' => $cssclass,
+ 'bshortlabel' => _LIST_ITEM_BLOG,
+ 'bshortnameval' => Entity::hsc($current['bshortname']),
+ 'categorylabel' => _LIST_ITEM_CAT,
+ 'categorynameval' => Entity::hsc($current['cname']),
+ 'authorlabel' => _LIST_ITEM_AUTHOR,
+ 'authornameval' => Entity::hsc($current['mname']),
+ 'itemdatelabel' => _LIST_ITEM_DATE,
+ 'itemdateval' => date("Y-m-d",$current['itime']),
+ 'itemdatelabel' => _LIST_ITEM_TIME,
+ 'itemdateval' => date("H:i",$current['itime']),
+ 'batchid' => listplug_nextBatchId(),
+ 'itemid' => $current['inumber'],
+ 'itemtitle' => Entity::hsc(strip_tags($current['ititle'])),
+ 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')),
+ 'editbtn' => _LISTS_EDIT,
+ 'movebtn' => _LISTS_MOVE,
+ 'delbtn' => _LISTS_DELETE,
+ );
+ // evaluate amount of comments for the item
+ $comment = new Comments($current['inumber']);
+ $camount = $comment->amountComments();
+ if ( $camount > 0 )
+ {
+ $data['camount'] = "<a href=\"index.php?action=itemcommentlist&itemid={$current['inumber']}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";
+ }
+ else
+ {
+ $data['camount'] = _LIST_ITEM_NOCONTENT . "<br />\n";
+ }
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+// for batch operations: generates the index numbers for checkboxes
+function listplug_nextBatchId()
+{
+ static $id = 0;
+ return $id++;
+}
+
+function listplug_table_commentlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )
+ {
+ $template = "<th><%colinfo%></th>\n"
+ . "<th><%colcontent%></th>\n"
+ . "<th colspan=\"3\"><%colaction%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];
+ }
+ $data = array(
+ 'colinfo' => _LISTS_INFO,
+ 'colcontent' => _LIST_COMMENT,
+ 'colaction' => _LISTS_ACTIONS
+ );
+ break;
+ case 'BODY':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )
+ {
+ $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"
+ . "<td>\n"
+ . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"
+ . "<label for=\"batch<%batchid%>\"><%commentbody%></label>\n"
+ . "</td>\n"
+ . "<td style=\"white-space:nowrap\">\n"
+ . "<a href=\"index.php?action=commentedit&commentid=<%commentid%>\"><%editbtn%></a>\n"
+ . "</td>\n"
+ . "<td style=\"white-space:nowrap\">\n"
+ . "<a href=\"index.php?action=commentdelete&commentid=<%commentid%>\"><%delbtn%></a>\n"
+ . "</td>\n"
+ . "<%addbanlist%>";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];
+ }
+ $current = $vars['current'];
+ $body = strip_tags($current['cbody']);
+ $data = array(
+ 'commentdate' => date("Y-m-d@H:i", strtotime($current['ctime'])),
+ 'batchid' => listplug_nextBatchId(),
+ 'commentid' => $current['cnumber'],
+ 'commentbody' => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')),
+ 'editbtn' => _LISTS_EDIT,
+ 'delbtn' => _LISTS_DELETE,
+ );
+ if ( isset($current['mname']) )
+ {
+ $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER;
+ }
+ else
+ {
+ $data['commentator'] = Entity::hsc($current['cuser']);
+ }
+ if ( isset($current['cmail']) && $current['cmail'] )
+ {
+ $data['commentsite'] = Entity::hsc($current['cmail']);
+ }
+ else
+ {
+ $data['commentsite'] = '';
+ }
+ if ( isset($current['cemail']) && $current['cemail'] )
+ {
+ $data['commentmail'] = Entity::hsc($current['cemail']);
+ }
+ else
+ {
+ $data['commentmail'] = '';
+ }
+ if ( $vars['canAddBan'] )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )
+ {
+ $subTpl = "<td style=\"white-space:nowrap\">"
+ . "<a href=\"index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a>"
+ . "</td>\n";
+ }
+ else
+ {
+ $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];
+ }
+ $subData = array(
+ 'itemid' => $current['citem'],
+ 'banip' => Entity::hsc($current['cip']),
+ 'banbtn' => _LIST_COMMENT_BANIP,
+ );
+ $data['addbanlist'] = Template::fill($subTpl, $subData);
+ }
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )
+ {
+ $template = "";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_bloglist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )
+ {
+ $template = "<th><%blognames%></th>\n"
+ . "<th colspan=\"7\"><%actionshead%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];
+ }
+ $data = array(
+ 'blognames' => _NAME,
+ 'actionshead' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )
+ {
+ $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"
+ . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"
+ . "<td><a href=\"index.php?action=createitem&blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"
+ . "<td><a href=\"index.php?action=itemlist&blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"
+ . "<td><a href=\"index.php?action=blogcommentlist&blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"
+ . "<td><a href=\"index.php?action=bookmarklet&blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];
+ }
+ $data = array(
+ 'blogid' => $current['bnumber'],
+ 'shortname' => Entity::hsc($current['bshortname']),
+ 'blogurl' => $current['burl'],
+ 'blogname' => Entity::hsc($current['bname']),
+ 'ttaddtext' => _BLOGLIST_TT_ADD,
+ 'addtext' => _BLOGLIST_ADD,
+ 'ttedittext' => _BLOGLIST_TT_EDIT,
+ 'edittext' => _BLOGLIST_EDIT,
+ 'ttcommenttext' => _BLOGLIST_TT_COMMENTS,
+ 'commenttext' => _BLOGLIST_COMMENTS,
+ 'ttbmlettext' => _BLOGLIST_TT_BMLET,
+ 'bmlettext' => _BLOGLIST_BMLET,
+ );
+ if ( $current['tadmin'] == 1 )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
+ {
+ $template .= "<td><a href=\"index.php?action=blogsettings&blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"
+ . "<td><a href=\"index.php?action=banlist&blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
+ }
+ $data['ttsettingtext'] = _BLOGLIST_TT_SETTINGS;
+ $data['settingtext'] = _BLOGLIST_SETTINGS;
+ $data['ttbanstext'] = _BLOGLIST_TT_BANS;
+ $data['banstext'] = _BLOGLIST_BANS;
+ }
+
+ if ( $vars['superadmin'] )
+ {
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
+ {
+ $template .= "<td><a href=\"index.php?action=deleteblog&blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"><%deletetext%></a></td>\n";
+ }
+ else
+ {
+ $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'];
+ }
+ $data['ttdeletetext'] = _BLOGLIST_TT_DELETE;
+ $data['deletetext'] = _BLOGLIST_DELETE;
+ }
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_shortblognames($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )
+ {
+ $template = "<th><%colshortname%></th>\n"
+ . "<th><%colblogname%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];
+ }
+ $data = array(
+ 'colshortname' => _EBLOG_SHORTNAME,
+ 'colblogname' => _EBLOG_NAME,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )
+ {
+ $template = "<td><%bshortname%></td>\n"
+ . "<td><%blogname%></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];
+ }
+ $data = array(
+ 'bshortname' => Entity::hsc($current['bshortname']),
+ 'blogname' => Entity::hsc($current['bname']),
+ );
+ break;
+ case 'FOOT':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_shortnames($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )
+ {
+ $template = "<th><%colname%></th>\n"
+ . "<th><%coldesc%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];
+ }
+ $data = array(
+ 'colname' => _NAME,
+ 'coldesc' => _LISTS_DESC,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )
+ {
+ $template = "<td><%name%></td>\n"
+ . "<td><%desc%></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];
+ }
+ $data = array(
+ 'name' => Entity::hsc($current['name']),
+ 'desc' => Entity::hsc($current['description']),
+ );
+ break;
+ case 'FOOT':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_categorylist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )
+ {
+ $template = "<th><%colname%></th>\n"
+ . "<th><%coldesc%></th>\n"
+ . "<th colspan=\"2\"><%colact%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];
+ }
+ $data = array(
+ 'colname' => _LISTS_NAME,
+ 'coldesc' => _LISTS_DESC,
+ 'colact' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )
+ {
+ $template = "<td>\n"
+ . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"
+ . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"
+ . "</td>\n"
+ . "<td><%catdesc%></td>\n"
+ . "<td><a href=\"index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
+ . "<td><a href=\"index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];
+ }
+
+ $data = array(
+ 'batchid' => listplug_nextBatchId(),
+ 'catid' => intval($current['catid']),
+ 'catname' => Entity::hsc($current['cname']),
+ 'catdesc' => Entity::hsc($current['cdesc']),
+ 'blogid' => intval($current['cblog']),
+ 'tabindex' => intval($vars['tabindex']),
+ 'editbtn' => _LISTS_EDIT,
+ 'delbtn' => _LISTS_DELETE,
+ );
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_templatelist($vars, $type, $template_name = '')
+{
+ global $manager, $CONF;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
+ {
+ $template = "<th><%colname%></th>\n"
+ . "<th><%coldesc%></th>\n"
+ . "<th colspan=\"3\"><%colact%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
+ }
+ $data = array(
+ 'colname' => _LISTS_NAME,
+ 'coldesc' => _LISTS_DESC,
+ 'colact' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
+ {
+ $template = "<td><%templatename%></td>\n"
+ . "<td><%templatedesc%></td>\n"
+ . "<td style=\"white-space:nowrap\">"
+ . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"
+ . "</td>\n"
+ . "<td style=\"white-space:nowrap\">\n"
+ . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"
+ . "</td>\n"
+ . "<td style=\"white-space:nowrap\">\n"
+ . "<a href=\"<%deleteurl%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"
+ . "</td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
+ }
+
+ $data = array(
+ 'templatename' => Entity::hsc($current['tdname']),
+ 'templatedesc' => Entity::hsc($current['tddesc']),
+ 'templateid' => (integer) $current['tdnumber'],
+ 'tabindex' => (integer) $vars['tabindex'],
+
+ 'clonebtn' => _LISTS_CLONE,
+ 'cloneaction' => $vars['cloneaction'],
+ 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&templateid={$current['tdnumber']}",
+
+ 'delbtn' => _LISTS_DELETE,
+ 'deleteaction' => $vars['deleteaction'],
+ 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&templateid={$current['tdnumber']}",
+
+ 'editbtn' => _LISTS_EDIT,
+ 'editaction' => $vars['editaction'],
+ 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&templateid={$current['tdnumber']}"
+ );
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_skinlist($vars, $type, $template_name = '')
+{
+ global $CONF, $DIR_SKINS, $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
+ {
+ $template = "<th><%colname%></th>\n"
+ . "<th><%coldesc%></th>\n"
+ . "<th colspan=\"3\"><%colact%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
+ }
+ $data = array(
+ 'colname' => _LISTS_NAME,
+ 'coldesc' => _LISTS_DESC,
+ 'colact' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
+ {
+ $template = "<td><%skinname%><br /><br />\n"
+ . "<%skintypelabel%> <%skintype%><br />\n"
+ . "<%incmodelabel%> <%incmode%><br />\n"
+ . "<%incpreflabel%> <%incpref%><br />\n"
+ . "<%skinthumb%>"
+ . "<%readme%></td>\n"
+ . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"
+ . "<td style=\"white-space:nowrap\">"
+ . "<a href=\"index.php?action=skinedit&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>"
+ . "</td>\n"
+ . "<td style=\"white-space:nowrap\">"
+ . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>"
+ . "</td>\n"
+ . "<td style=\"white-space:nowrap\">"
+ . "<a href=\"index.php?action=skindelete&skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>"
+ . "</td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
+ }
+
+ $data = array(
+ 'tabindex' => $vars['tabindex']++,
+
+ 'skinid' => (integer) $current['sdnumber'],
+ 'skindesc' => Entity::hsc($current['sddesc']),
+
+ 'skintypelabel' => _LISTS_TYPE,
+ 'skintype' => Entity::hsc($current['sdtype']),
+
+ 'incmodelabel' => _LIST_SKINS_INCMODE,
+ 'incmode' => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
+
+ 'incpreflabel' => ($current['sdincpref']) ? _SKIN_INCLUDE_PREFIX : '',
+ 'incpref' => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '',
+
+ 'editbtn' => _LISTS_EDIT,
+ 'editaction' => $vars['editaction'],
+ 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}",
+
+ 'clonebtn' => _LISTS_CLONE,
+ 'cloneaction' => $vars['cloneaction'],
+ 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}",
+
+ 'delbtn' => _LISTS_DELETE,
+ 'deleteaction' => $vars['deleteaction'],
+ 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}"
+ );
+
+ if ( $current['sdnumber'] != $vars['default'] )
+ {
+ $data['skinname'] = Entity::hsc($current['sdname']);
+ }
+ else
+ {
+ $data['skinname'] = '<strong>' . Entity::hsc($current['sdname']) . '</strong>';
+ }
+
+ // add preview image when present
+ if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )
+ {
+ $data['skinthumb'] = "<p>\n";
+
+ $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);
+ $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');
+ if ( $has_enlargement )
+ {
+ $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
+ }
+ $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
+ if ( $has_enlargement )
+ {
+ $data['skinthumb'] .= "</a><br />\n";
+ }
+
+ if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )
+ {
+ $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';
+ $title = sprintf(_LIST_SKIN_README, $current['sdname']);
+ $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
+ }
+ else
+ {
+ $data['readme'] ="";
+ }
+
+ $data['skinthumb'] .= "</p>\n";
+ }
+
+ $skin =& $manager->getSkin($current['sdnumber'], $vars['handler']);
+ $available_types = $skin->getAvailableTypes();
+
+ $data['skinparts'] = _LIST_SKINS_DEFINED
+ . "<ul>\n";
+ foreach ( $available_types as $type => $label )
+ {
+ if ( $label === FALSE )
+ {
+ $label = ucfirst($type);
+ $article = 'skinpartspecial';
+ }
+ else
+ {
+ $article = "skinpart{$type}";
+ }
+ $data['skinparts'] .= "<li>\n"
+ . helpHtml($article) . "\n"
+ . "<a href=\"{$CONF['AdminURL']}index.php?action={$vars['edittypeaction']}&skinid={$current['sdnumber']}&type={$type}\" tabindex=\"{$vars['tabindex']}\">"
+ . Entity::hsc($label)
+ . "</a>\n"
+ . "</li>\n";
+ }
+ $data['skinparts'] .= "</ul>\n";
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
+ {
+ $template = "";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_draftlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD']) )
+ {
+ $template = "<th><%colblog%></th>\n"
+ . "<th><%coldesc%></th>\n"
+ . "<th colspan=\"2\"><%colact%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'];
+ }
+ $data = array(
+ 'colblog' => _LISTS_BLOG,
+ 'coldesc' => _LISTS_TITLE,
+ 'colact' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']) )
+ {
+ $template = "<td><%bshortname%></td>\n"
+ . "<td><%ititle%></td>\n"
+ . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
+ . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'];
+ }
+ $data = array(
+ 'bshortname' => Entity::hsc($current['bshortname']),
+ 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
+ 'itemid' => intval($current['inumber']),
+ 'editbtn' => _LISTS_EDIT,
+ 'delbtn' => _LISTS_DELETE,
+ );
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_otherdraftlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD']) )
+ {
+ $template = "<th><%colblog%></th>\n"
+ . "<th><%coldesc%></th>\n"
+ . "<th><%colautr%></th>\n"
+ . "<th colspan=\"2\"><%colact%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_HEAD'];
+ }
+ $data = array(
+ 'colblog' => _LISTS_BLOG,
+ 'coldesc' => _LISTS_TITLE,
+ 'colautr' => _LISTS_AUTHOR,
+ 'colact' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']) )
+ {
+ $template = "<td><%bshortname%></td>\n"
+ . "<td><%ititle%></td>\n"
+ . "<td><%iauthor%></td>\n"
+ . "<td><a href=\"index.php?action=itemedit&itemid=<%itemid%>\"><%editbtn%></a></td>\n"
+ . "<td><a href=\"index.php?action=itemdelete&itemid=<%itemid%>\"><%delbtn%></a></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY'];
+ }
+ $data = array(
+ 'bshortname' => Entity::hsc($current['bshortname']),
+ 'ititle' => Entity::hsc(strip_tags($current['ititle'])),
+ 'iauthor' => Entity::hsc(strip_tags($current['mname'])),
+ 'itemid' => intval($current['inumber']),
+ 'editbtn' => _LISTS_EDIT,
+ 'delbtn' => _LISTS_DELETE,
+ );
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_actionlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD']) )
+ {
+ $template = "<th><%coltime%></th>\n"
+ . "<th><%colmesg%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'];
+ }
+ $data = array(
+ 'coltime' => _LISTS_TIME,
+ 'colmesg' => _LIST_ACTION_MSG,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']) )
+ {
+ $template = "<td><%timestamp%></td>\n"
+ . "<td><%message%></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'];
+ }
+ $data = array(
+ 'timestamp' => Entity::hsc($current['timestamp']),
+ 'message' => Entity::hsc($current['message']),
+ );
+ break;
+ case 'FOOT':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+function listplug_table_banlist($vars, $type, $template_name = '')
+{
+ global $manager;
+
+ $templates = array();
+ if ( !empty($template_name) )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD']) )
+ {
+ $template = "<th><%iprange%></th>\n"
+ . "<th><%reason%></th>\n"
+ . "<th><%colact%></th>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'];
+ }
+ $data = array(
+ 'iprange' => _LIST_BAN_IPRANGE,
+ 'reason' => _LIST_BAN_REASON,
+ 'colact' => _LISTS_ACTIONS,
+ );
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']) )
+ {
+ $template = "<td><%iprange%></td>\n"
+ . "<td><%reason%></td>\n"
+ . "<td><a href=\"index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>\"><%delbtn%></a></td>\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'];
+ }
+ $data = array(
+ 'iprange' => Entity::hsc($current['iprange']),
+ 'reason' => Entity::hsc($current['reason']),
+ 'blogid' => intval($current['blogid']),
+ 'delbtn' => _LISTS_DELETE,
+ );
+ break;
+ case 'FOOT':
+ $current = $vars['current'];
+ if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT']) )
+ {
+ $template = "\n";
+ }
+ else
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'];
+ }
+ $data = array();
+ break;
+ }
+ return Template::fill($template, $data);
+}
+
+/**
+ * listplug_list_normalskinlist()
+ *
+ * @param array $vars array for variables
+ * @param string $type HEAD/BODY/FOOT
+ * @param string $template_name name of template
+ * @return string marked-up string
+ */
+function listplug_list_normalskinlist($vars, $type, $template_name = '')
+{
+ global $manager, $CONF;
+
+ /* available variables as a default */
+ $data = array(
+ 'skinid' => (integer) $vars['skinid'],
+ 'skinname' => Entity::hsc($vars['skinname']),
+ );
+
+ $templates = array();
+ if ( $template_name )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch ( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('NORMALSKINLIST_HEAD', $templates) || empty($templates['NORMALSKINLIST_HEAD']) )
+ {
+ $template = "<ul>\n";
+ }
+ else
+ {
+ $template = $templates['NORMALSKINLIST_HEAD'];
+ }
+
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('NORMALSKINLIST_BODY', $templates) || empty($templates['NORMALSKINLIST_BODY']) )
+ {
+ $template = "<li>"
+ . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%skintypename%></a>"
+ . " <%help%>"
+ . "</li>\n";
+ }
+ else
+ {
+ $template = $templates['NORMALSKINLIST_BODY'];
+ }
+
+ $data['tabindex'] = $vars['tabindex']++;
+ $data['skintype'] = $current['skintype'];
+ $data['skintypename'] = $current['skintypename'];
+ $data['editaction'] = $vars['editaction'];
+ $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
+ /* TODO: removeaction? */
+ /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */
+ $data['help'] = '';
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) )
+ {
+ $template = "</ul>\n";
+ }
+ else
+ {
+ $template = $templates['NORMALSKINLIST_FOOT'];
+ }
+
+ break;
+ }
+
+ return Template::fill($template, $data);
+}
+
+/**
+ * listplug_list_specialskinlist()
+ *
+ * @param array $vars array for variables
+ * @param string $type HEAD/BODY/FOOT
+ * @param string $template_name name of template
+ * @return string marked-up string
+ */
+function listplug_list_specialskinlist($vars, $type, $template_name = '')
+{
+ global $manager, $CONF;
+
+ /* available variables as a default */
+ $data = array(
+ 'skinid' => (integer) $vars['skinid'],
+ 'skinname' => Entity::hsc($vars['skinname']),
+ );
+
+ /* retrieve templates */
+ $templates = array();
+ if ( $template_name )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ switch ( $type )
+ {
+ case 'HEAD':
+ if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) )
+ {
+ $template = "<ul>\n";
+ }
+ else
+ {
+ $template = $templates['SPECIALSKINLIST_HEAD'];
+ }
+ break;
+ case 'BODY':
+ $current = $vars['current'];
+ if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
+ {
+ $template = "<li>"
+ . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\">"
+ . "<%skintype%>"
+ . "</a>"
+ . " ("
+ . "<a href=\"<%removeurl%>\" tabindex=\"<%tabindex%>\" >"
+ . "<%text(_LISTS_DELETE)%>"
+ . "</a>"
+ . ")"
+ . "</li>\n";
+ }
+ else
+ {
+ $template = $templates['SPECIALSKINLIST_BODY'];
+ }
+
+ $data['tabindex'] = (integer) $vars['tabindex']++;
+ $data['skintype'] = Entity::hsc($current['skintype']);
+ $data['skintypename'] = Entity::hsc($current['skintypename']);
+ $data['editaction'] = $vars['editaction'];
+ $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
+ $data['removeaction'] = $vars['editaction'];
+ $data['removeurl'] = "{$CONF['AdminURL']}?action={$vars['removeaction']}&skinid={$vars['skinid']}&type={$current['skintype']}";
+
+ break;
+ case 'FOOT':
+ if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) )
+ {
+ $template = "</ul>\n";
+ }
+ else
+ {
+ $template = $templates['SPECIALSKINLIST_FOOT'];
+ }
+ break;
+ }
+
+ return Template::fill($template, $data);
+}
+
+/**
+ * listplug_input_yesno()
+ *
+ * @param string $name name of input element with radio type attribute
+ * @param string $checkedval value which should be checked
+ * @param integer $tabindex tabindex number
+ * @param string $value1 value of radio 1
+ * @param string $value2 value of radio 2
+ * @param string $yesval label for yes
+ * @param string $noval label for no
+ * @param boolean $isAdmin super admin or not
+ * @param string $template_name name of template
+ * @param boolean $showlist used in showlist or not
+ * @return string marked-up string
+ */
+function listplug_input_yesno($name, $checkedval, $tabindex = 0,
+ $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO,
+ $isAdmin = 0, $template_name = '', $showlist = FALSE)
+{
+ global $manager;
+
+ $templates = array();
+ if ( $template_name )
+ {
+ $templates =& $manager->getTemplate($template_name);
+ }
+
+ if ( $name == 'admin' )
+ {
+ if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
+ {
+ $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n"
+ . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
+ . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n"
+ . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
+ }
+ else
+ {
+ $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
+ }
+ }
+ else
+ {
+ if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
+ {
+ $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
+ }
+ else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
+ }
+ else
+ {
+ $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n"
+ . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
+ . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n"
+ . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
+ }
+ }
+
+ $id = preg_replace('#[|]#', '-', $name);
+ $id1 = $id . $value1;
+ $id2 = $id . $value2;
+ $dat = array(
+ 'name' => Entity::hsc($name),
+ 'yesval' => Entity::hsc($value1),
+ 'noval' => Entity::hsc($value2),
+ 'yesid' => Entity::hsc($id1),
+ 'noid' => Entity::hsc($id2),
+ 'yesvaltext' => $yesval,
+ 'novaltext' => $noval,
+ 'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
+ 'nocheckedval' => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
+ 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
+ );
+
+ return Template::fill($template, $dat);
+}
+
+/**
+ * listplug_batchlist()
+ *
+ * @param string $attr item/member/team/category/comment
+ * @param resource $query SQL resorce
+ * @param string $type type for showlist()
+ * @param array $vars array for variables
+ */
+function listplug_batchlist($attr, $query, $type, $vars, $template_name)
+{
+ global $manager;
+
+ /* HEAD */
+ $content = "<form method=\"post\" action=\"index.php\">\n";
+
+ /* BODY */
+ $content .= showlist($query, $type, $vars, $template_name);
+
+ /* FOOT */
+ switch ( $attr )
+ {
+ case 'item':
+ $options = array(
+ 'delete' => _BATCH_ITEM_DELETE,
+ 'move' => _BATCH_ITEM_MOVE
+ );
+ break;
+ case 'member':
+ $options = array(
+ 'delete' => _BATCH_MEMBER_DELETE,
+ 'setadmin' => _BATCH_MEMBER_SET_ADM,
+ 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM
+ );
+ break;
+ case 'team':
+ $options = array(
+ 'delete' => _BATCH_TEAM_DELETE,
+ 'setadmin' => _BATCH_TEAM_SET_ADM,
+ 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,
+ );
+ break;
+ case 'category':
+ $options = array(
+ 'delete' => _BATCH_CAT_DELETE,
+ 'move' => _BATCH_CAT_MOVE,
+ );
+ break;
+ case 'comment':
+ $options = array(
+ 'delete' => _BATCH_COMMENT_DELETE,
+ );
+ break;
+ default:
+ $options = array();
+ break;
+ }
+
+ $content .= "<p class=\"batchoperations\">\n"
+ . _BATCH_WITH_SEL
+ . "<select name=\"batchaction\">\n";
+
+ foreach ( $options as $option => $label )
+ {
+ $content .= "<option value=\"{$option}\">{$label}</option>\n";
+ }
+ $content .= "</select>\n";
+
+ if ( $attr == 'team' )
+ {
+ $content .= '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . '" />';
+ }
+ else if ( $attr == 'comment' )
+ {
+ $content .= '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . '" />';
+ }
+
+ $content .= '<input type="submit" value="' . _BATCH_EXEC . '" />'
+ . "("
+ . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(1); \">" . _BATCH_SELECTALL . "</a>"
+ . " - "
+ . "<a href=\"\" onclick=\"if( event && event.preventDefault ) event.preventDefault(); return batchSelectAll(0); \">" . _BATCH_DESELECTALL . "</a>"
+ . ")\n"
+ . "<input type=\"hidden\" name=\"action\" value=\"batch{$attr}\" />\n"
+ . '<input type="hidden" name="ticket" value="' . Entity::hsc($manager->getNewTicket()) . '" />' . "\n"
+ . "</p>\n"
+ . "</form>\n";
+
+ return $content;
+}
+
+/**
+ * listplug_navlist()
+ *
+ * @param string $attr item/member/team/category/comment
+ * @param resource $query SQL resorce
+ * @param string $type type for showlist()
+ * @param array $vars array for variables
+ * @param string $template_name name of template
+ * @return string contents
+ */
+function listplug_navlist($attribute, $query, $type, $vars, $template_name)
+{
+ global $CONF;
+
+ $prev = $vars['start'] - $vars['amount'];
+ if ( $prev < $vars['minamount'] )
+ {
+ $prev = $vars['minamount'];
+ }
+
+ $next = $vars['start'] + $vars['amount'];
+
+ $navi = "\n";
+ $navi .= "<table frame=\"box\" rules=\"all\" sumamry=\"navigation actions\" class=\"navigation\">\n"
+ . "<tr>\n";
+ $navi .= "<td>\n"
+ . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
+ . "<input type=\"hidden\" name=\"start\" value=\"{$prev}\" />\n"
+ . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">< < " . _LISTS_PREV . "</button>\n"
+ . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
+ . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
+ . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
+ . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
+ . "</form>\n"
+ . "</td>\n";
+ $navi .= "<td>\n"
+ . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
+ . "<input type=\"text\" name=\"amount\" size=\"3\" value=\"{$vars['amount']}\" />\n"
+ . _LISTS_PERPAGE
+ . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
+ . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_CHANGE . "</button>\n"
+ . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
+ . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
+ . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
+ . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
+ . "</form>\n"
+ . "</td>\n";
+ $navi .= "<td>\n"
+ . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
+ . "<input type=\"text\" name=\"search\" value=\"{$vars['search']}\" size=\"7\" />\n"
+ . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
+ . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">> " . _LISTS_SEARCH . "</button>\n"
+ . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
+ . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
+ . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
+ . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
+ . "</form>\n"
+ . "</td>\n";
+ $navi .= "<td>\n"
+ . "<form method=\"post\" action=\"{$CONF['AdminURL']}\">\n"
+ . "<input type=\"hidden\" name=\"start\" value=\"{$next}\" />\n"
+ . "<button type=\"submit\" name=\"action\" value=\"{$vars['action']}\">" . _LISTS_NEXT . "> > </button>\n"
+ . "<input type=\"hidden\" name=\"blogid\" value=\"{$vars['blogid']}\" />\n"
+ . "<input type=\"hidden\" name=\"itemid\" value=\"{$vars['itemid']}\" />\n"
+ . "<input type=\"hidden\" name=\"search\" value=\"{$vars['search']}\" />\n"
+ . "<input type=\"hidden\" name=\"amount\" value=\"{$vars['amount']}\" />\n"
+ . "</form>\n"
+ . "</td>\n";
+ $navi .= "</tr>\n"
+ . "</table>\n";
+
+ /* HEAD */
+ $template = $navi;
+
+ /* BODY */
+ $template .= listplug_batchlist($attribute, $query, $type, $vars, $template_name);
+
+ /* FOOT */
+ $template .= $navi;
+
+ return $template;
+}
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * This class contains two classes that can be used for importing and\r
- * exporting Nucleus skins: SKINIMPORT and SKINEXPORT\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: skinie.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
- */\r
-\r
-class SkinImport\r
-{\r
- // hardcoded value (see constructor). When 1, interesting info about the\r
- // parsing process is sent to the output\r
- private $debug;\r
- \r
- // parser/file pointer\r
- private $parser;\r
- private $fp;\r
- \r
- // parset internal charset, US-ASCII/ISO-8859-1/UTF-8\r
- private $parse_charset = 'UTF-8';\r
- \r
- // which data has been read?\r
- private $metaDataRead;\r
- private $allRead;\r
- \r
- // extracted data\r
- private $skins;\r
- private $templates;\r
- private $info;\r
- \r
- // to maintain track of where we are inside the XML file\r
- private $inXml;\r
- private $inData;\r
- private $inMeta;\r
- private $inSkin;\r
- private $inTemplate;\r
- private $currentName;\r
- private $currentPartName;\r
- private $cdata;\r
- \r
- /**\r
- * constructor initializes data structures\r
- */\r
- public function __construct()\r
- {\r
- // disable magic_quotes_runtime if it's turned on\r
- //set_magic_quotes_runtime(0);\r
- if ( version_compare(PHP_VERSION, '5.3.0', '<') )\r
- {\r
- ini_set('magic_quotes_runtime', '0');\r
- }\r
- \r
- // debugging mode?\r
- $this->debug = 0;\r
- \r
- $this->reset();\r
- return;\r
- }\r
- \r
- public function __destruct()\r
- {\r
- return;\r
- }\r
- \r
- public function reset()\r
- {\r
- if ( $this->parser )\r
- {\r
- xml_parser_free($this->parser);\r
- }\r
- \r
- // XML file pointer\r
- $this->fp = 0;\r
- \r
- // which data has been read?\r
- $this->metaDataRead = 0;\r
- $this->allRead = 0;\r
- \r
- // to maintain track of where we are inside the XML file\r
- $this->inXml = 0;\r
- $this->inData = 0;\r
- $this->inMeta = 0;\r
- $this->inSkin = 0;\r
- $this->inTemplate = 0;\r
- $this->currentName = '';\r
- $this->currentPartName = '';\r
- \r
- // character data pile\r
- $this->cdata = '';\r
- \r
- // list of skinnames and templatenames (will be array of array)\r
- $this->skins = array();\r
- $this->templates = array();\r
- \r
- // extra info included in the XML files (e.g. installation notes)\r
- $this->info = '';\r
- \r
- // init XML parser, this parser deal with characters as encoded by UTF-8\r
- $this->parser = xml_parser_create($this->parse_charset);\r
- xml_set_object($this->parser, $this);\r
- xml_set_element_handler($this->parser, 'start_element', 'end_element');\r
- xml_set_character_data_handler($this->parser, 'character_data');\r
- xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Reads an XML file into memory\r
- *\r
- * @param $filename\r
- * Which file to read\r
- * @param $metaOnly\r
- * Set to 1 when only the metadata needs to be read (optional, default 0)\r
- */\r
- public function readFile($filename, $metaOnly = 0)\r
- {\r
- // open file\r
- $this->fp = @fopen($filename, 'r');\r
- if ( !$this->fp )\r
- {\r
- return _SKINIE_ERROR_FAILEDOPEN_FILEURL;\r
- }\r
- \r
- // here we go!\r
- $this->inXml = 1;\r
- \r
- $tempbuffer = null;\r
- \r
- while ( !feof($this->fp) )\r
- {\r
- $tempbuffer .= fread($this->fp, 4096);\r
- }\r
- fclose($this->fp);\r
- \r
- /*\r
- * NOTE: conver character set.\r
- * We hope all characters in the file also includes UTF-8 coded character set,\r
- * because this PHP extension implements support for James Clark's expat in PHP\r
- * and it supports juust US-ASCII, ISO-8859-1, UTF-8 character coding scheme.\r
- */\r
- if ( i18n::get_current_charset() != $this->parse_charset )\r
- {\r
- $tempbuffer = i18n::convert($tempbuffer, i18n::get_current_charset(), $this->parse_charset);\r
- }\r
- \r
- $temp = tmpfile();\r
- fwrite($temp, $tempbuffer);\r
- rewind($temp);\r
- \r
- while ( ($buffer = fread($temp, 4096) )\r
- && (!$metaOnly || ($metaOnly && !$this->metaDataRead)) )\r
- {\r
- $err = xml_parse( $this->parser, $buffer, feof($temp) );\r
- if ( !$err && $this->debug )\r
- {\r
- echo 'ERROR: ', xml_error_string(xml_get_error_code($this->parser)), '<br />';\r
- }\r
- }\r
- \r
- // all done\r
- $this->inXml = 0;\r
- fclose($temp);\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Returns the list of skin names\r
- */\r
- public function getSkinNames()\r
- {\r
- return array_keys($this->skins);\r
- }\r
- \r
- /**\r
- * Returns the list of template names\r
- */\r
- public function getTemplateNames()\r
- {\r
- return array_keys($this->templates);\r
- }\r
- \r
- /**\r
- * Returns the extra information included in the XML file\r
- */\r
- public function getInfo()\r
- {\r
- return $this->info;\r
- }\r
- \r
- /**\r
- * Writes the skins and templates to the database\r
- *\r
- * @param $allowOverwrite\r
- * set to 1 when allowed to overwrite existing skins with the same name\r
- * (default = 0)\r
- */\r
- public function writeToDatabase($allowOverwrite = 0)\r
- {\r
- global $manager;\r
- \r
- $existingSkins = $this->checkSkinNameClashes();\r
- $existingTemplates = $this->checkTemplateNameClashes();\r
- $invalidSkinNames = $this->checkSkinNamesValid();\r
- $invalidTemplateNames = $this->checkTemplateNamesValid();\r
- \r
- // if there are invalid skin or template names, stop executioin and return and error\r
- if ( (sizeof($invalidSkinNames) > 0) || (sizeof($invalidTemplateNames) > 0) )\r
- {\r
- $inames_error = "<p>"._SKINIE_INVALID_NAMES_DETECTED."</p>\n";\r
- $inames_error .= "<ul>";\r
- foreach( $invalidSkinNames as $sName )\r
- {\r
- $inames_error .= "<li>".Entity::hsc($sName)."</li>";\r
- }\r
- foreach( $invalidTemplateNames as $sName )\r
- {\r
- $inames_error .= "<li>".Entity::hsc($sName)."</li>";\r
- }\r
- $inames_error .= "</ul>";\r
- return $inames_error;\r
- }\r
- \r
- // if not allowed to overwrite, check if any nameclashes exists\r
- if ( !$allowOverwrite )\r
- {\r
- if ( (sizeof($existingSkins) > 0) || (sizeof($existingTemplates) > 0) )\r
- {\r
- return _SKINIE_NAME_CLASHES_DETECTED;\r
- }\r
- }\r
- \r
- foreach ( $this->skins as $skinName => $data )\r
- {\r
- // 1. if exists: delete all part data, update desc data\r
- // if not exists: create desc\r
- if ( in_array($skinName, $existingSkins) )\r
- {\r
- $skinObj = SKIN::createFromName($skinName);\r
- \r
- // delete all parts of the skin\r
- $skinObj->deleteAllParts();\r
- \r
- // update general info\r
- $skinObj->updateGeneralInfo(\r
- $skinName,\r
- $data['description'],\r
- $data['type'],\r
- $data['includeMode'],\r
- $data['includePrefix']\r
- );\r
- }\r
- else\r
- {\r
- $skinid = SKIN::createNew(\r
- $skinName,\r
- $data['description'],\r
- $data['type'],\r
- $data['includeMode'],\r
- $data['includePrefix']\r
- );\r
- $skinObj =& $manager->getSkin($skinid);\r
- }\r
- \r
- // 2. add parts\r
- foreach ( $data['parts'] as $partName => $partContent )\r
- {\r
- $skinObj->update($partName, $partContent);\r
- }\r
- }\r
- \r
- foreach ( $this->templates as $templateName => $data )\r
- {\r
- // 1. if exists: delete all part data, update desc data\r
- // if not exists: create desc\r
- if ( in_array($templateName, $existingTemplates) )\r
- {\r
- $templateObj = Template::createFromName($templateName);\r
- \r
- // delete all parts of the template\r
- $templateObj->deleteAllParts();\r
- \r
- // update general info\r
- $templateObj->updateGeneralInfo($templateName, $data['description']);\r
- }\r
- else\r
- {\r
- $templateid = Template::createNew($templateName, $data['description']);\r
- $templateObj = new Template($templateid);\r
- }\r
- \r
- // 2. add parts\r
- foreach ( $data['parts'] as $partName => $partContent )\r
- {\r
- $templateObj->update($partName, $partContent);\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * returns an array of all the skin nameclashes (empty array when no name clashes)\r
- */\r
- public function checkSkinNameClashes()\r
- {\r
- $clashes = array();\r
- \r
- foreach ( $this->skins as $skinName => $data )\r
- {\r
- if ( SKIN::exists($skinName) )\r
- {\r
- array_push($clashes, $skinName);\r
- }\r
- }\r
- return $clashes;\r
- }\r
- \r
- /**\r
- * returns an array of all the template nameclashes\r
- * (empty array when no name clashes)\r
- */\r
- public function checkTemplateNameClashes()\r
- {\r
- $clashes = array();\r
- \r
- foreach ( $this->templates as $templateName => $data )\r
- {\r
- if ( Template::exists($templateName) )\r
- {\r
- array_push($clashes, $templateName);\r
- }\r
- }\r
- return $clashes;\r
- }\r
- \r
- /**\r
- * returns an array of all the invalid skin names (empty array when no invalid names )\r
- */\r
- private function checkSkinNamesValid()\r
- {\r
- $notValid = array();\r
- \r
- foreach ( $this->skins as $skinName => $data )\r
- {\r
- if ( !isValidSkinName($skinName) )\r
- {\r
- array_push($notValid, $skinName);\r
- }\r
- }\r
- return $notValid;\r
- }\r
- \r
- /**\r
- * returns an array of all the invalid template names (empty array when no invalid names )\r
- */\r
- private function checkTemplateNamesValid()\r
- {\r
- $notValid = array();\r
- \r
- foreach ( $this->templates as $templateName => $data )\r
- {\r
- if ( !isValidTemplateName($templateName) )\r
- {\r
- array_push($notValid, $templateName);\r
- }\r
- }\r
- return $notValid;\r
- }\r
- \r
- /**\r
- * Called by XML parser for each new start element encountered\r
- */\r
- private function start_element($parser, $name, $attrs)\r
- {\r
- foreach( $attrs as $key=>$value )\r
- {\r
- if ( $this->parse_charset != i18n::get_current_charset() )\r
- {\r
- $name = i18n::convert($name, $this->parse_charset, i18n::get_current_charset());\r
- $value = i18n::convert($value, $this->parse_charset, i18n::get_current_charset());\r
- }\r
- \r
- $attrs[$key] = $value;\r
- }\r
- \r
- if ( $this->debug )\r
- {\r
- echo 'START: ', Entity::hsc($name), '<br />';\r
- }\r
- \r
- switch ( $name )\r
- {\r
- case 'nucleusskin':\r
- $this->inData = 1;\r
- break;\r
- case 'meta':\r
- $this->inMeta = 1;\r
- break;\r
- case 'info':\r
- // no action needed\r
- break;\r
- case 'skin':\r
- if ( !$this->inMeta )\r
- {\r
- $this->inSkin = 1;\r
- $this->currentName = $attrs['name'];\r
- $this->skins[$this->currentName]['type'] = $attrs['type'];\r
- $this->skins[$this->currentName]['includeMode'] = $attrs['includeMode'];\r
- $this->skins[$this->currentName]['includePrefix'] = $attrs['includePrefix'];\r
- $this->skins[$this->currentName]['parts'] = array();\r
- }\r
- else\r
- {\r
- $this->skins[$attrs['name']] = array();\r
- $this->skins[$attrs['name']]['parts'] = array();\r
- }\r
- break;\r
- case 'template':\r
- if ( !$this->inMeta )\r
- {\r
- $this->inTemplate = 1;\r
- $this->currentName = $attrs['name'];\r
- $this->templates[$this->currentName]['parts'] = array();\r
- }\r
- else\r
- {\r
- $this->templates[$attrs['name']] = array();\r
- $this->templates[$attrs['name']]['parts'] = array();\r
- }\r
- break;\r
- case 'description':\r
- // no action needed\r
- break;\r
- case 'part':\r
- $this->currentPartName = $attrs['name'];\r
- break;\r
- default:\r
- echo _SKINIE_SEELEMENT_UNEXPECTEDTAG . Entity::hsc($name) . '<br />';\r
- break;\r
- }\r
- // character data never contains other tags\r
- $this->clear_character_data();\r
- return;\r
- }\r
- \r
- /**\r
- * Called by the XML parser for each closing tag encountered\r
- */\r
- private function end_element($parser, $name)\r
- {\r
- if ( $this->debug )\r
- {\r
- echo 'END: ' . Entity::hsc($name) . '<br />';\r
- }\r
- \r
- if ( $this->parse_charset != i18n::get_current_charset() )\r
- {\r
- $name = i18n::convert($name, $this->parse_charset, i18n::get_current_charset());\r
- $charset_data = i18n::convert($this->get_character_data(), $this->parse_charset, i18n::get_current_charset());\r
- }\r
- else\r
- {\r
- $charset_data = $this->get_character_data();\r
- }\r
- \r
- switch ( $name )\r
- {\r
- case 'nucleusskin':\r
- $this->inData = 0;\r
- $this->allRead = 1;\r
- break;\r
- case 'meta':\r
- $this->inMeta = 0;\r
- $this->metaDataRead = 1;\r
- break;\r
- case 'info':\r
- $this->info = $charset_data;\r
- case 'skin':\r
- if ( !$this->inMeta )\r
- {\r
- $this->inSkin = 0;\r
- }\r
- break;\r
- case 'template':\r
- if ( !$this->inMeta )\r
- {\r
- $this->inTemplate = 0;\r
- }\r
- break;\r
- case 'description':\r
- if ( $this->inSkin )\r
- {\r
- $this->skins[$this->currentName]['description'] = $charset_data;\r
- }\r
- else\r
- {\r
- $this->templates[$this->currentName]['description'] = $charset_data;\r
- }\r
- break;\r
- case 'part':\r
- if ( $this->inSkin )\r
- {\r
- $this->skins[$this->currentName]['parts'][$this->currentPartName] = $charset_data;\r
- }\r
- else\r
- {\r
- $this->templates[$this->currentName]['parts'][$this->currentPartName] = $charset_data;\r
- }\r
- break;\r
- default:\r
- echo _SKINIE_SEELEMENT_UNEXPECTEDTAG . Entity::hsc($name) . '<br />';\r
- break;\r
- }\r
- $this->clear_character_data();\r
- return;\r
- }\r
- \r
- /**\r
- * Called by XML parser for data inside elements\r
- */\r
- private function character_data ($parser, $data)\r
- {\r
- if ( $this->debug )\r
- {\r
- echo 'NEW DATA: ' . Entity::hsc($data) . '<br />';\r
- }\r
- $this->cdata .= $data;\r
- return;\r
- }\r
- \r
- /**\r
- * Returns the data collected so far\r
- */\r
- private function get_character_data()\r
- {\r
- return $this->cdata;\r
- }\r
- \r
- /**\r
- * Clears the data buffer\r
- */\r
- private function clear_character_data()\r
- {\r
- $this->cdata = '';\r
- return;\r
- }\r
- \r
- /**\r
- * Static method that looks for importable XML files in subdirs of the given dir\r
- */\r
- static public function searchForCandidates($dir)\r
- {\r
- $candidates = array();\r
- \r
- $dirhandle = opendir($dir);\r
- while ( $filename = readdir($dirhandle) )\r
- {\r
- if ( @is_dir($dir . $filename) && ($filename != '.') && ($filename != '..') )\r
- {\r
- $xml_file = $dir . $filename . '/skinbackup.xml';\r
- if ( file_exists($xml_file) && is_readable($xml_file) )\r
- {\r
- //$xml_file;\r
- $candidates[$filename] = $filename;\r
- }\r
- \r
- // backwards compatibility\r
- $xml_file = $dir . $filename . '/skindata.xml';\r
- if ( file_exists($xml_file) && is_readable($xml_file) )\r
- {\r
- //$xml_file;\r
- $candidates[$filename] = $filename;\r
- }\r
- }\r
- }\r
- closedir($dirhandle);\r
- return $candidates;\r
- }\r
-}\r
-\r
-class SkinExport\r
-{\r
- private $templates;\r
- private $skins;\r
- private $info;\r
- \r
- /**\r
- * Constructor initializes data structures\r
- */\r
- public function __construct()\r
- {\r
- // list of templateIDs to export\r
- $this->templates = array();\r
- \r
- // list of skinIDs to export\r
- $this->skins = array();\r
- \r
- // extra info to be in XML file\r
- $this->info = '';\r
- }\r
- \r
- /**\r
- * Adds a template to be exported\r
- *\r
- * @param id\r
- * template ID\r
- * @result false when no such ID exists\r
- */\r
- public function addTemplate($id)\r
- {\r
- if ( !Template::existsID($id) )\r
- {\r
- return 0;\r
- }\r
- \r
- $this->templates[$id] = Template::getNameFromId($id);\r
- return 1;\r
- }\r
- \r
- /**\r
- * Adds a skin to be exported\r
- *\r
- * @param id\r
- * skin ID\r
- * @result false when no such ID exists\r
- */\r
- public function addSkin($id)\r
- {\r
- if ( !SKIN::existsID($id) )\r
- {\r
- return 0;\r
- }\r
- \r
- $this->skins[$id] = SKIN::getNameFromId($id);\r
- return 1;\r
- }\r
- \r
- /**\r
- * Sets the extra info to be included in the exported file\r
- */\r
- public function setInfo($info)\r
- {\r
- $this->info = $info;\r
- }\r
- \r
- /**\r
- * Outputs the XML contents of the export file\r
- *\r
- * @param $setHeaders\r
- * set to 0 if you don't want to send out headers\r
- * (optional, default 1)\r
- */\r
- public function export($setHeaders = 1)\r
- {\r
- global $manager;\r
- \r
- if ( $setHeaders )\r
- {\r
- // make sure the mimetype is correct, and that the data does not show up\r
- // in the browser, but gets saved into and XML file (popup download window)\r
- header('Content-Type: text/xml; charset=' . i18n::get_current_charset());\r
- header('Content-Disposition: attachment; filename="skinbackup.xml"');\r
- header('Expires: 0');\r
- header('Pragma: no-cache');\r
- }\r
- \r
- echo "<nucleusskin>\n";\r
- \r
- // meta\r
- echo "\t<meta>\n";\r
- // skins\r
- foreach ( $this->skins as $skinId => $skinName )\r
- {\r
- echo "\t\t" . '<skin name="' . Entity::hsc($skinName) . '" />' . "\n";\r
- }\r
- // templates\r
- foreach ( $this->templates as $templateId => $templateName )\r
- {\r
- echo "\t\t" . '<template name="' . Entity::hsc($templateName) . '" />' . "\n";\r
- }\r
- // extra info\r
- if ( $this->info )\r
- {\r
- echo "\t\t<info><![CDATA[" . $this->info . "]]></info>\n";\r
- }\r
- echo "\t</meta>\n\n\n";\r
- \r
- // contents skins\r
- foreach ($this->skins as $skinId => $skinName)\r
- {\r
- $skinId = (integer) $skinId;\r
- $skinObj =& $manager->getSkin($skinId);\r
- \r
- echo "\t" . '<skin name="' . Entity::hsc($skinName) . '" type="' . Entity::hsc($skinObj->getContentType()) . '" includeMode="' . Entity::hsc($skinObj->getIncludeMode()) . '" includePrefix="' . Entity::hsc($skinObj->getIncludePrefix()) . '">' . "\n";\r
- echo "\t\t<description>" . Entity::hsc($skinObj->getDescription()) . "</description>\n";\r
- \r
- $res = DB::getResult('SELECT stype, scontent FROM '. sql_table('skin') .' WHERE sdesc=' . $skinId);\r
- foreach ( $res as $row )\r
- {\r
- echo "\t\t" . '<part name="',Entity::hsc($row['stype']) . '">';\r
- echo '<![CDATA[' . $this->escapeCDATA($row['scontent']) . ']]>';\r
- echo "</part>\n\n";\r
- }\r
- echo "\t</skin>\n\n\n";\r
- }\r
- \r
- // contents templates\r
- foreach ( $this->templates as $templateId => $templateName )\r
- {\r
- $templateId = intval($templateId);\r
- \r
- echo "\t" . '<template name="' . Entity::hsc($templateName) . '">' . "\n";\r
- echo "\t\t<description>" . Entity::hsc(Template::getDesc($templateId)) . "</description>\n";\r
- \r
- $res = DB::getResult('SELECT tpartname, tcontent FROM '. sql_table('template') .' WHERE tdesc=' . $templateId);\r
- foreach ( $res as $row )\r
- {\r
- echo "\t\t" . '<part name="' . Entity::hsc($row['tpartname']) . '">';\r
- echo '<![CDATA[' . $this->escapeCDATA($row['tcontent']) . ']]>';\r
- echo "</part>\n\n";\r
- }\r
- \r
- echo "\t</template>\n\n\n";\r
- }\r
- echo '</nucleusskin>';\r
- }\r
- \r
- /**\r
- * Escapes CDATA content so it can be included in another CDATA section\r
- */\r
- private function escapeCDATA($cdata)\r
- {\r
- return preg_replace('/]]>/', ']]]]><![CDATA[>', $cdata);\r
- }\r
-}\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * This class contains two classes that can be used for importing and
+ * exporting Nucleus skins: SKINIMPORT and SKINEXPORT
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: skinie.php 1883 2012-06-17 07:55:47Z sakamocchi $
+ */
+
+class SkinImport
+{
+ // hardcoded value (see constructor). When 1, interesting info about the
+ // parsing process is sent to the output
+ private $debug;
+
+ // parser/file pointer
+ private $parser;
+ private $fp;
+
+ // parset internal charset, US-ASCII/ISO-8859-1/UTF-8
+ private $parse_charset = 'UTF-8';
+
+ // which data has been read?
+ private $metaDataRead;
+ private $allRead;
+
+ // extracted data
+ private $skins;
+ private $templates;
+ private $info;
+
+ // to maintain track of where we are inside the XML file
+ private $inXml;
+ private $inData;
+ private $inMeta;
+ private $inSkin;
+ private $inTemplate;
+ private $currentName;
+ private $currentPartName;
+ private $cdata;
+
+ /**
+ * constructor initializes data structures
+ */
+ public function __construct()
+ {
+ // disable magic_quotes_runtime if it's turned on
+ //set_magic_quotes_runtime(0);
+ if ( version_compare(PHP_VERSION, '5.3.0', '<') )
+ {
+ ini_set('magic_quotes_runtime', '0');
+ }
+
+ // debugging mode?
+ $this->debug = 0;
+
+ $this->reset();
+ return;
+ }
+
+ public function __destruct()
+ {
+ return;
+ }
+
+ public function reset()
+ {
+ if ( $this->parser )
+ {
+ xml_parser_free($this->parser);
+ }
+
+ // XML file pointer
+ $this->fp = 0;
+
+ // which data has been read?
+ $this->metaDataRead = 0;
+ $this->allRead = 0;
+
+ // to maintain track of where we are inside the XML file
+ $this->inXml = 0;
+ $this->inData = 0;
+ $this->inMeta = 0;
+ $this->inSkin = 0;
+ $this->inTemplate = 0;
+ $this->currentName = '';
+ $this->currentPartName = '';
+
+ // character data pile
+ $this->cdata = '';
+
+ // list of skinnames and templatenames (will be array of array)
+ $this->skins = array();
+ $this->templates = array();
+
+ // extra info included in the XML files (e.g. installation notes)
+ $this->info = '';
+
+ // init XML parser, this parser deal with characters as encoded by UTF-8
+ $this->parser = xml_parser_create($this->parse_charset);
+ xml_set_object($this->parser, $this);
+ xml_set_element_handler($this->parser, 'start_element', 'end_element');
+ xml_set_character_data_handler($this->parser, 'character_data');
+ xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
+
+ return;
+ }
+
+ /**
+ * Reads an XML file into memory
+ *
+ * @param $filename
+ * Which file to read
+ * @param $metaOnly
+ * Set to 1 when only the metadata needs to be read (optional, default 0)
+ */
+ public function readFile($filename, $metaOnly = 0)
+ {
+ // open file
+ $this->fp = @fopen($filename, 'r');
+ if ( !$this->fp )
+ {
+ return _SKINIE_ERROR_FAILEDOPEN_FILEURL;
+ }
+
+ // here we go!
+ $this->inXml = 1;
+
+ $tempbuffer = null;
+
+ while ( !feof($this->fp) )
+ {
+ $tempbuffer .= fread($this->fp, 4096);
+ }
+ fclose($this->fp);
+
+ /*
+ * NOTE: conver character set.
+ * We hope all characters in the file also includes UTF-8 coded character set,
+ * because this PHP extension implements support for James Clark's expat in PHP
+ * and it supports juust US-ASCII, ISO-8859-1, UTF-8 character coding scheme.
+ */
+ if ( i18n::get_current_charset() != $this->parse_charset )
+ {
+ $tempbuffer = i18n::convert($tempbuffer, i18n::get_current_charset(), $this->parse_charset);
+ }
+
+ $temp = tmpfile();
+ fwrite($temp, $tempbuffer);
+ rewind($temp);
+
+ while ( ($buffer = fread($temp, 4096) )
+ && (!$metaOnly || ($metaOnly && !$this->metaDataRead)) )
+ {
+ $err = xml_parse( $this->parser, $buffer, feof($temp) );
+ if ( !$err && $this->debug )
+ {
+ echo 'ERROR: ', xml_error_string(xml_get_error_code($this->parser)), '<br />';
+ }
+ }
+
+ // all done
+ $this->inXml = 0;
+ fclose($temp);
+
+ return;
+ }
+
+ /**
+ * Returns the list of skin names
+ */
+ public function getSkinNames()
+ {
+ return array_keys($this->skins);
+ }
+
+ /**
+ * Returns the list of template names
+ */
+ public function getTemplateNames()
+ {
+ return array_keys($this->templates);
+ }
+
+ /**
+ * Returns the extra information included in the XML file
+ */
+ public function getInfo()
+ {
+ return $this->info;
+ }
+
+ /**
+ * Writes the skins and templates to the database
+ *
+ * @param $allowOverwrite
+ * set to 1 when allowed to overwrite existing skins with the same name
+ * (default = 0)
+ */
+ public function writeToDatabase($allowOverwrite = 0)
+ {
+ global $manager;
+
+ $existingSkins = $this->checkSkinNameClashes();
+ $existingTemplates = $this->checkTemplateNameClashes();
+ $invalidSkinNames = $this->checkSkinNamesValid();
+ $invalidTemplateNames = $this->checkTemplateNamesValid();
+
+ // if there are invalid skin or template names, stop executioin and return and error
+ if ( (sizeof($invalidSkinNames) > 0) || (sizeof($invalidTemplateNames) > 0) )
+ {
+ $inames_error = "<p>"._SKINIE_INVALID_NAMES_DETECTED."</p>\n";
+ $inames_error .= "<ul>";
+ foreach( $invalidSkinNames as $sName )
+ {
+ $inames_error .= "<li>".Entity::hsc($sName)."</li>";
+ }
+ foreach( $invalidTemplateNames as $sName )
+ {
+ $inames_error .= "<li>".Entity::hsc($sName)."</li>";
+ }
+ $inames_error .= "</ul>";
+ return $inames_error;
+ }
+
+ // if not allowed to overwrite, check if any nameclashes exists
+ if ( !$allowOverwrite )
+ {
+ if ( (sizeof($existingSkins) > 0) || (sizeof($existingTemplates) > 0) )
+ {
+ return _SKINIE_NAME_CLASHES_DETECTED;
+ }
+ }
+
+ foreach ( $this->skins as $skinName => $data )
+ {
+ // 1. if exists: delete all part data, update desc data
+ // if not exists: create desc
+ if ( in_array($skinName, $existingSkins) )
+ {
+ $skinObj = SKIN::createFromName($skinName);
+
+ // delete all parts of the skin
+ $skinObj->deleteAllParts();
+
+ // update general info
+ $skinObj->updateGeneralInfo(
+ $skinName,
+ $data['description'],
+ $data['type'],
+ $data['includeMode'],
+ $data['includePrefix']
+ );
+ }
+ else
+ {
+ $skinid = SKIN::createNew(
+ $skinName,
+ $data['description'],
+ $data['type'],
+ $data['includeMode'],
+ $data['includePrefix']
+ );
+ $skinObj =& $manager->getSkin($skinid);
+ }
+
+ // 2. add parts
+ foreach ( $data['parts'] as $partName => $partContent )
+ {
+ $skinObj->update($partName, $partContent);
+ }
+ }
+
+ foreach ( $this->templates as $templateName => $data )
+ {
+ // 1. if exists: delete all part data, update desc data
+ // if not exists: create desc
+ if ( in_array($templateName, $existingTemplates) )
+ {
+ $templateObj = Template::createFromName($templateName);
+
+ // delete all parts of the template
+ $templateObj->deleteAllParts();
+
+ // update general info
+ $templateObj->updateGeneralInfo($templateName, $data['description']);
+ }
+ else
+ {
+ $templateid = Template::createNew($templateName, $data['description']);
+ $templateObj = new Template($templateid);
+ }
+
+ // 2. add parts
+ foreach ( $data['parts'] as $partName => $partContent )
+ {
+ $templateObj->update($partName, $partContent);
+ }
+ }
+ return;
+ }
+
+ /**
+ * returns an array of all the skin nameclashes (empty array when no name clashes)
+ */
+ public function checkSkinNameClashes()
+ {
+ $clashes = array();
+
+ foreach ( $this->skins as $skinName => $data )
+ {
+ if ( SKIN::exists($skinName) )
+ {
+ array_push($clashes, $skinName);
+ }
+ }
+ return $clashes;
+ }
+
+ /**
+ * returns an array of all the template nameclashes
+ * (empty array when no name clashes)
+ */
+ public function checkTemplateNameClashes()
+ {
+ $clashes = array();
+
+ foreach ( $this->templates as $templateName => $data )
+ {
+ if ( Template::exists($templateName) )
+ {
+ array_push($clashes, $templateName);
+ }
+ }
+ return $clashes;
+ }
+
+ /**
+ * returns an array of all the invalid skin names (empty array when no invalid names )
+ */
+ private function checkSkinNamesValid()
+ {
+ $notValid = array();
+
+ foreach ( $this->skins as $skinName => $data )
+ {
+ if ( !isValidSkinName($skinName) )
+ {
+ array_push($notValid, $skinName);
+ }
+ }
+ return $notValid;
+ }
+
+ /**
+ * returns an array of all the invalid template names (empty array when no invalid names )
+ */
+ private function checkTemplateNamesValid()
+ {
+ $notValid = array();
+
+ foreach ( $this->templates as $templateName => $data )
+ {
+ if ( !isValidTemplateName($templateName) )
+ {
+ array_push($notValid, $templateName);
+ }
+ }
+ return $notValid;
+ }
+
+ /**
+ * Called by XML parser for each new start element encountered
+ */
+ private function start_element($parser, $name, $attrs)
+ {
+ foreach( $attrs as $key=>$value )
+ {
+ if ( $this->parse_charset != i18n::get_current_charset() )
+ {
+ $name = i18n::convert($name, $this->parse_charset, i18n::get_current_charset());
+ $value = i18n::convert($value, $this->parse_charset, i18n::get_current_charset());
+ }
+
+ $attrs[$key] = $value;
+ }
+
+ if ( $this->debug )
+ {
+ echo 'START: ', Entity::hsc($name), '<br />';
+ }
+
+ switch ( $name )
+ {
+ case 'nucleusskin':
+ $this->inData = 1;
+ break;
+ case 'meta':
+ $this->inMeta = 1;
+ break;
+ case 'info':
+ // no action needed
+ break;
+ case 'skin':
+ if ( !$this->inMeta )
+ {
+ $this->inSkin = 1;
+ $this->currentName = $attrs['name'];
+ $this->skins[$this->currentName]['type'] = $attrs['type'];
+ $this->skins[$this->currentName]['includeMode'] = $attrs['includeMode'];
+ $this->skins[$this->currentName]['includePrefix'] = $attrs['includePrefix'];
+ $this->skins[$this->currentName]['parts'] = array();
+ }
+ else
+ {
+ $this->skins[$attrs['name']] = array();
+ $this->skins[$attrs['name']]['parts'] = array();
+ }
+ break;
+ case 'template':
+ if ( !$this->inMeta )
+ {
+ $this->inTemplate = 1;
+ $this->currentName = $attrs['name'];
+ $this->templates[$this->currentName]['parts'] = array();
+ }
+ else
+ {
+ $this->templates[$attrs['name']] = array();
+ $this->templates[$attrs['name']]['parts'] = array();
+ }
+ break;
+ case 'description':
+ // no action needed
+ break;
+ case 'part':
+ $this->currentPartName = $attrs['name'];
+ break;
+ default:
+ echo _SKINIE_SEELEMENT_UNEXPECTEDTAG . Entity::hsc($name) . '<br />';
+ break;
+ }
+ // character data never contains other tags
+ $this->clear_character_data();
+ return;
+ }
+
+ /**
+ * Called by the XML parser for each closing tag encountered
+ */
+ private function end_element($parser, $name)
+ {
+ if ( $this->debug )
+ {
+ echo 'END: ' . Entity::hsc($name) . '<br />';
+ }
+
+ if ( $this->parse_charset != i18n::get_current_charset() )
+ {
+ $name = i18n::convert($name, $this->parse_charset, i18n::get_current_charset());
+ $charset_data = i18n::convert($this->get_character_data(), $this->parse_charset, i18n::get_current_charset());
+ }
+ else
+ {
+ $charset_data = $this->get_character_data();
+ }
+
+ switch ( $name )
+ {
+ case 'nucleusskin':
+ $this->inData = 0;
+ $this->allRead = 1;
+ break;
+ case 'meta':
+ $this->inMeta = 0;
+ $this->metaDataRead = 1;
+ break;
+ case 'info':
+ $this->info = $charset_data;
+ case 'skin':
+ if ( !$this->inMeta )
+ {
+ $this->inSkin = 0;
+ }
+ break;
+ case 'template':
+ if ( !$this->inMeta )
+ {
+ $this->inTemplate = 0;
+ }
+ break;
+ case 'description':
+ if ( $this->inSkin )
+ {
+ $this->skins[$this->currentName]['description'] = $charset_data;
+ }
+ else
+ {
+ $this->templates[$this->currentName]['description'] = $charset_data;
+ }
+ break;
+ case 'part':
+ if ( $this->inSkin )
+ {
+ $this->skins[$this->currentName]['parts'][$this->currentPartName] = $charset_data;
+ }
+ else
+ {
+ $this->templates[$this->currentName]['parts'][$this->currentPartName] = $charset_data;
+ }
+ break;
+ default:
+ echo _SKINIE_SEELEMENT_UNEXPECTEDTAG . Entity::hsc($name) . '<br />';
+ break;
+ }
+ $this->clear_character_data();
+ return;
+ }
+
+ /**
+ * Called by XML parser for data inside elements
+ */
+ private function character_data ($parser, $data)
+ {
+ if ( $this->debug )
+ {
+ echo 'NEW DATA: ' . Entity::hsc($data) . '<br />';
+ }
+ $this->cdata .= $data;
+ return;
+ }
+
+ /**
+ * Returns the data collected so far
+ */
+ private function get_character_data()
+ {
+ return $this->cdata;
+ }
+
+ /**
+ * Clears the data buffer
+ */
+ private function clear_character_data()
+ {
+ $this->cdata = '';
+ return;
+ }
+
+ /**
+ * Static method that looks for importable XML files in subdirs of the given dir
+ */
+ static public function searchForCandidates($dir)
+ {
+ $candidates = array();
+
+ $dirhandle = opendir($dir);
+ while ( $filename = readdir($dirhandle) )
+ {
+ if ( @is_dir($dir . $filename) && ($filename != '.') && ($filename != '..') )
+ {
+ $xml_file = $dir . $filename . '/skinbackup.xml';
+ if ( file_exists($xml_file) && is_readable($xml_file) )
+ {
+ //$xml_file;
+ $candidates[$filename] = $filename;
+ }
+
+ // backwards compatibility
+ $xml_file = $dir . $filename . '/skindata.xml';
+ if ( file_exists($xml_file) && is_readable($xml_file) )
+ {
+ //$xml_file;
+ $candidates[$filename] = $filename;
+ }
+ }
+ }
+ closedir($dirhandle);
+ return $candidates;
+ }
+}
+
+class SkinExport
+{
+ private $templates;
+ private $skins;
+ private $info;
+
+ /**
+ * Constructor initializes data structures
+ */
+ public function __construct()
+ {
+ // list of templateIDs to export
+ $this->templates = array();
+
+ // list of skinIDs to export
+ $this->skins = array();
+
+ // extra info to be in XML file
+ $this->info = '';
+ }
+
+ /**
+ * Adds a template to be exported
+ *
+ * @param id
+ * template ID
+ * @result false when no such ID exists
+ */
+ public function addTemplate($id)
+ {
+ if ( !Template::existsID($id) )
+ {
+ return 0;
+ }
+
+ $this->templates[$id] = Template::getNameFromId($id);
+ return 1;
+ }
+
+ /**
+ * Adds a skin to be exported
+ *
+ * @param id
+ * skin ID
+ * @result false when no such ID exists
+ */
+ public function addSkin($id)
+ {
+ if ( !SKIN::existsID($id) )
+ {
+ return 0;
+ }
+
+ $this->skins[$id] = SKIN::getNameFromId($id);
+ return 1;
+ }
+
+ /**
+ * Sets the extra info to be included in the exported file
+ */
+ public function setInfo($info)
+ {
+ $this->info = $info;
+ }
+
+ /**
+ * Outputs the XML contents of the export file
+ *
+ * @param $setHeaders
+ * set to 0 if you don't want to send out headers
+ * (optional, default 1)
+ */
+ public function export($setHeaders = 1)
+ {
+ global $manager;
+
+ if ( $setHeaders )
+ {
+ // make sure the mimetype is correct, and that the data does not show up
+ // in the browser, but gets saved into and XML file (popup download window)
+ header('Content-Type: text/xml; charset=' . i18n::get_current_charset());
+ header('Content-Disposition: attachment; filename="skinbackup.xml"');
+ header('Expires: 0');
+ header('Pragma: no-cache');
+ }
+
+ echo "<nucleusskin>\n";
+
+ // meta
+ echo "\t<meta>\n";
+ // skins
+ foreach ( $this->skins as $skinId => $skinName )
+ {
+ echo "\t\t" . '<skin name="' . Entity::hsc($skinName) . '" />' . "\n";
+ }
+ // templates
+ foreach ( $this->templates as $templateId => $templateName )
+ {
+ echo "\t\t" . '<template name="' . Entity::hsc($templateName) . '" />' . "\n";
+ }
+ // extra info
+ if ( $this->info )
+ {
+ echo "\t\t<info><![CDATA[" . $this->info . "]]></info>\n";
+ }
+ echo "\t</meta>\n\n\n";
+
+ // contents skins
+ foreach ($this->skins as $skinId => $skinName)
+ {
+ $skinId = (integer) $skinId;
+ $skinObj =& $manager->getSkin($skinId);
+
+ echo "\t" . '<skin name="' . Entity::hsc($skinName) . '" type="' . Entity::hsc($skinObj->getContentType()) . '" includeMode="' . Entity::hsc($skinObj->getIncludeMode()) . '" includePrefix="' . Entity::hsc($skinObj->getIncludePrefix()) . '">' . "\n";
+ echo "\t\t<description>" . Entity::hsc($skinObj->getDescription()) . "</description>\n";
+
+ $res = DB::getResult('SELECT stype, scontent FROM '. sql_table('skin') .' WHERE sdesc=' . $skinId);
+ foreach ( $res as $row )
+ {
+ echo "\t\t" . '<part name="',Entity::hsc($row['stype']) . '">';
+ echo '<![CDATA[' . $this->escapeCDATA($row['scontent']) . ']]>';
+ echo "</part>\n\n";
+ }
+ echo "\t</skin>\n\n\n";
+ }
+
+ // contents templates
+ foreach ( $this->templates as $templateId => $templateName )
+ {
+ $templateId = intval($templateId);
+
+ echo "\t" . '<template name="' . Entity::hsc($templateName) . '">' . "\n";
+ echo "\t\t<description>" . Entity::hsc(Template::getDesc($templateId)) . "</description>\n";
+
+ $res = DB::getResult('SELECT tpartname, tcontent FROM '. sql_table('template') .' WHERE tdesc=' . $templateId);
+ foreach ( $res as $row )
+ {
+ echo "\t\t" . '<part name="' . Entity::hsc($row['tpartname']) . '">';
+ echo '<![CDATA[' . $this->escapeCDATA($row['tcontent']) . ']]>';
+ echo "</part>\n\n";
+ }
+
+ echo "\t</template>\n\n\n";
+ }
+ echo '</nucleusskin>';
+ }
+
+ /**
+ * Escapes CDATA content so it can be included in another CDATA section
+ */
+ private function escapeCDATA($cdata)
+ {
+ return preg_replace('/]]>/', ']]]]><![CDATA[>', $cdata);
+ }
+}
\ No newline at end of file
* of the License, or (at your option) any later version.
* (see nucleus/documentation/index.html#license for more info)
*/
-
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2012 The Nucleus Group
if ( !class_exists('PDO') )
{
-
/**
* Dummy constant of the PDO class
*/
* @copyright Copyright (C) 2012 The Nucleus Group
* @version $Id$
*/
-
/*
* sql_* wrappers for DB class access
*/
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: vars4.1.0.php 1544 2011-06-25 22:32:50Z kaigreve $\r
- */\r
-\r
-/**\r
- * Return the value of $_GET for the variable $name\r
- * \r
- * If the variable is set the function returns the value,\r
- * if it is not set it returns null (which is equal to false).\r
- * \r
- * @param unknown_type $name\r
- */\r
-function getVar($name) {\r
- if (!isset($_GET[$name])) {\r
- return;\r
- }\r
-\r
- return undoMagic($_GET[$name]);\r
-}\r
-\r
-/**\r
- * Return the value of $_POST for the variable $name\r
- * \r
- * If the variable is set the function returns the value,\r
- * if it is not set it returns null (which is equal to false).\r
- * \r
- * @param unknown_type $name\r
- */\r
-function postVar($name) {\r
- if (!isset($_POST[$name])) {\r
- return;\r
- }\r
-\r
- return undoMagic($_POST[$name]);\r
-}\r
-\r
-/**\r
- * Return the value of $_COOKIE for the variable $name\r
- * \r
- * If the variable is set the function returns the value,\r
- * if it is not set it returns null (which is equal to false).\r
- * \r
- * @param unknown_type $name\r
- */\r
-function cookieVar($name) {\r
- if (!isset($_COOKIE[$name])) {\r
- return;\r
- }\r
-\r
- return undoMagic($_COOKIE[$name]);\r
-}\r
-\r
-/**\r
- * Return the request var for the variable $name\r
- * \r
- * If the variable is set the function returns the value,\r
- * if it is not set it returns null (which is equal to false).\r
- * Trys to resolve also $_GET and $_POST\r
- * \r
- * @param unknown_type $name\r
- */\r
-function requestVar($name) {\r
- if(array_key_exists($name,$_REQUEST))\r
- return undoMagic($_REQUEST[$name]);\r
- elseif( array_key_exists($name,$_GET))\r
- return undoMagic($_GET[$name]);\r
- elseif( array_key_exists($name,$_POST))\r
- return undoMagic($_POST[$name]);\r
- else\r
- return;\r
-}\r
-\r
-/**\r
- * Return the value of $_SERVER for the variable $name\r
- * \r
- * If the variable is set the function returns the value,\r
- * if it is not set it returns null (which is equal to false)\r
- * \r
- * @param unknown_type $name\r
- */\r
-function serverVar($name) {\r
- if (!isset($_SERVER[$name])) {\r
- return false;\r
- }\r
-\r
- return $_SERVER[$name];\r
-}\r
-\r
-/**\r
- * Removes magic quotes if that option is enabled\r
- * \r
- * @param $data\r
- */\r
-function undoMagic($data) {\r
- if (!get_magic_quotes_gpc())\r
- return $data;\r
- if (ini_get('magic_quotes_sybase') != 1)\r
- return stripslashes_array($data);\r
- else\r
- return undoSybaseQuotes_array($data);\r
-}\r
-\r
-/**\r
- * Strip slashes from a variable or an array\r
- * \r
- * @param $data\r
- */\r
-function stripslashes_array($data) {\r
- return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);\r
-}\r
-\r
-/**\r
- * Undo Sybase Quotes from an array\r
- * \r
- * @param $data\r
- */\r
-function undoSybaseQuotes_array($data) {\r
- return is_array($data) ? array_map('undoSybaseQuotes', $data) : stripslashes($data);\r
-}\r
-\r
-/**\r
- * Undo Sybase Quotes from a variable\r
- * \r
- * @param $data\r
- */\r
-function undoSybaseQuotes($data) {\r
- return str_replace("''", "'", $data);\r
-}\r
-\r
-/**\r
- * Integer array from request\r
- * \r
- * @param unknown_type $name\r
- */\r
-function requestIntArray($name) {\r
- if (!isset($_REQUEST[$name])) {\r
- return;\r
- }\r
-\r
- return $_REQUEST[$name];\r
-}\r
-\r
-/**\r
- * Array from request. Be sure to call undoMagic on the strings inside.\r
- * \r
- * @param $name\r
- */\r
-function requestArray($name) {\r
- if (!isset($_REQUEST[$name])) {\r
- return;\r
- }\r
-\r
- return $_REQUEST[$name];\r
-}\r
-\r
-/**\r
- * add all the variables from the request as hidden input field\r
- * @see globalfunctions.php#passVar\r
- * \r
- */\r
-function passRequestVars() {\r
- foreach ($_REQUEST as $key => $value) {\r
- if (($key == 'action') && ($value != requestVar('nextaction')))\r
- $key = 'nextaction';\r
-\r
- // a nextaction of 'showlogin' makes no sense\r
- if (($key == 'nextaction') && ($value == 'showlogin'))\r
- continue;\r
-\r
- if (($key != 'login') && ($key != 'password'))\r
- passVar($key, $value);\r
- }\r
-}\r
-\r
-/**\r
- * Return the value of $_FILES for the variable $name\r
- * \r
- * If the variable is set the function returns the value,\r
- * if it is not set it returns null (which is equal to false)\r
- * \r
- * @param $name\r
- */\r
-function postFileInfo($name) {\r
- if (!isset($_FILES[$name])) {\r
- return;\r
- }\r
-\r
- return $_FILES[$name];\r
-}\r
-\r
-/**\r
- * Sets the $_POST variable oldaction to the given value\r
- * \r
- * @param $value\r
- */\r
-function setOldAction($value) {\r
- $_POST['oldaction'] = $value;\r
-}\r
-\r
-?>\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: vars4.1.0.php 1544 2011-06-25 22:32:50Z kaigreve $
+ */
+
+/**
+ * Return the value of $_GET for the variable $name
+ *
+ * If the variable is set the function returns the value,
+ * if it is not set it returns null (which is equal to false).
+ *
+ * @param unknown_type $name
+ */
+function getVar($name) {
+ if (!isset($_GET[$name])) {
+ return;
+ }
+
+ return undoMagic($_GET[$name]);
+}
+
+/**
+ * Return the value of $_POST for the variable $name
+ *
+ * If the variable is set the function returns the value,
+ * if it is not set it returns null (which is equal to false).
+ *
+ * @param unknown_type $name
+ */
+function postVar($name) {
+ if (!isset($_POST[$name])) {
+ return;
+ }
+
+ return undoMagic($_POST[$name]);
+}
+
+/**
+ * Return the value of $_COOKIE for the variable $name
+ *
+ * If the variable is set the function returns the value,
+ * if it is not set it returns null (which is equal to false).
+ *
+ * @param unknown_type $name
+ */
+function cookieVar($name) {
+ if (!isset($_COOKIE[$name])) {
+ return;
+ }
+
+ return undoMagic($_COOKIE[$name]);
+}
+
+/**
+ * Return the request var for the variable $name
+ *
+ * If the variable is set the function returns the value,
+ * if it is not set it returns null (which is equal to false).
+ * Trys to resolve also $_GET and $_POST
+ *
+ * @param unknown_type $name
+ */
+function requestVar($name) {
+ if(array_key_exists($name,$_REQUEST))
+ return undoMagic($_REQUEST[$name]);
+ elseif( array_key_exists($name,$_GET))
+ return undoMagic($_GET[$name]);
+ elseif( array_key_exists($name,$_POST))
+ return undoMagic($_POST[$name]);
+ else
+ return;
+}
+
+/**
+ * Return the value of $_SERVER for the variable $name
+ *
+ * If the variable is set the function returns the value,
+ * if it is not set it returns null (which is equal to false)
+ *
+ * @param unknown_type $name
+ */
+function serverVar($name) {
+ if (!isset($_SERVER[$name])) {
+ return false;
+ }
+
+ return $_SERVER[$name];
+}
+
+/**
+ * Removes magic quotes if that option is enabled
+ *
+ * @param $data
+ */
+function undoMagic($data) {
+ if (!get_magic_quotes_gpc())
+ return $data;
+ if (ini_get('magic_quotes_sybase') != 1)
+ return stripslashes_array($data);
+ else
+ return undoSybaseQuotes_array($data);
+}
+
+/**
+ * Strip slashes from a variable or an array
+ *
+ * @param $data
+ */
+function stripslashes_array($data) {
+ return is_array($data) ? array_map('stripslashes_array', $data) : stripslashes($data);
+}
+
+/**
+ * Undo Sybase Quotes from an array
+ *
+ * @param $data
+ */
+function undoSybaseQuotes_array($data) {
+ return is_array($data) ? array_map('undoSybaseQuotes', $data) : stripslashes($data);
+}
+
+/**
+ * Undo Sybase Quotes from a variable
+ *
+ * @param $data
+ */
+function undoSybaseQuotes($data) {
+ return str_replace("''", "'", $data);
+}
+
+/**
+ * Integer array from request
+ *
+ * @param unknown_type $name
+ */
+function requestIntArray($name) {
+ if (!isset($_REQUEST[$name])) {
+ return;
+ }
+
+ return $_REQUEST[$name];
+}
+
+/**
+ * Array from request. Be sure to call undoMagic on the strings inside.
+ *
+ * @param $name
+ */
+function requestArray($name) {
+ if (!isset($_REQUEST[$name])) {
+ return;
+ }
+
+ return $_REQUEST[$name];
+}
+
+/**
+ * add all the variables from the request as hidden input field
+ * @see globalfunctions.php#passVar
+ *
+ */
+function passRequestVars() {
+ foreach ($_REQUEST as $key => $value) {
+ if (($key == 'action') && ($value != requestVar('nextaction')))
+ $key = 'nextaction';
+
+ // a nextaction of 'showlogin' makes no sense
+ if (($key == 'nextaction') && ($value == 'showlogin'))
+ continue;
+
+ if (($key != 'login') && ($key != 'password'))
+ passVar($key, $value);
+ }
+}
+
+/**
+ * Return the value of $_FILES for the variable $name
+ *
+ * If the variable is set the function returns the value,
+ * if it is not set it returns null (which is equal to false)
+ *
+ * @param $name
+ */
+function postFileInfo($name) {
+ if (!isset($_FILES[$name])) {
+ return;
+ }
+
+ return $_FILES[$name];
+}
+
+/**
+ * Sets the $_POST variable oldaction to the given value
+ *
+ * @param $value
+ */
+function setOldAction($value) {
+ $_POST['oldaction'] = $value;
+}
+
+?>
\ No newline at end of file
-<?php\r
-// by Edd Dumbill (C) 1999-2002\r
-// <edd@usefulinc.com>\r
-// $Original: xmlrpc.inc,v 1.158 2007/03/01 21:21:02 ggiunta Exp $\r
-// $Id: xmlrpc.inc.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
-\r
-\r
-// Copyright (c) 1999,2000,2002 Edd Dumbill.\r
-// All rights reserved.\r
-//\r
-// Redistribution and use in source and binary forms, with or without\r
-// modification, are permitted provided that the following conditions\r
-// are met:\r
-//\r
-// * Redistributions of source code must retain the above copyright\r
-// notice, this list of conditions and the following disclaimer.\r
-//\r
-// * Redistributions in binary form must reproduce the above\r
-// copyright notice, this list of conditions and the following\r
-// disclaimer in the documentation and/or other materials provided\r
-// with the distribution.\r
-//\r
-// * Neither the name of the "XML-RPC for PHP" nor the names of its\r
-// contributors may be used to endorse or promote products derived\r
-// from this software without specific prior written permission.\r
-//\r
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
-// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
-// OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
- if(!function_exists('xml_parser_create'))\r
- {\r
- // For PHP 4 onward, XML functionality is always compiled-in on windows:\r
- // no more need to dl-open it. It might have been compiled out on *nix...\r
- //if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN'))\r
- $phpver = phpversion();\r
- if (!extension_loaded('xml') && version_compare($phpver,'5.3.0','<'))\r
- {\r
- dl('xml.so');\r
- }\r
- }\r
-\r
- // Try to be backward compat with php < 4.2 (are we not being nice ?)\r
- $phpversion = phpversion();\r
- if($phpversion[0] == '4' && $phpversion[2] < 2)\r
- {\r
- // give an opportunity to user to specify where to include other files from\r
- if(!defined('PHP_XMLRPC_COMPAT_DIR'))\r
- {\r
- define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/');\r
- }\r
- if($phpversion[2] == '0')\r
- {\r
- if($phpversion[4] < 6)\r
- {\r
- include(PHP_XMLRPC_COMPAT_DIR.'is_callable.php');\r
- }\r
- include(PHP_XMLRPC_COMPAT_DIR.'is_scalar.php');\r
- include(PHP_XMLRPC_COMPAT_DIR.'array_key_exists.php');\r
- include(PHP_XMLRPC_COMPAT_DIR.'version_compare.php');\r
- }\r
- include(PHP_XMLRPC_COMPAT_DIR.'var_export.php');\r
- include(PHP_XMLRPC_COMPAT_DIR.'is_a.php');\r
- }\r
-\r
- // G. Giunta 2005/01/29: declare global these variables,\r
- // so that xmlrpc.inc will work even if included from within a function\r
- // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.\r
- $GLOBALS['xmlrpcI4']='i4';\r
- $GLOBALS['xmlrpcInt']='int';\r
- $GLOBALS['xmlrpcBoolean']='boolean';\r
- $GLOBALS['xmlrpcDouble']='double';\r
- $GLOBALS['xmlrpcString']='string';\r
- $GLOBALS['xmlrpcDateTime']='dateTime.iso8601';\r
- $GLOBALS['xmlrpcBase64']='base64';\r
- $GLOBALS['xmlrpcArray']='array';\r
- $GLOBALS['xmlrpcStruct']='struct';\r
- $GLOBALS['xmlrpcValue']='undefined';\r
-\r
- $GLOBALS['xmlrpcTypes']=array(\r
- $GLOBALS['xmlrpcI4'] => 1,\r
- $GLOBALS['xmlrpcInt'] => 1,\r
- $GLOBALS['xmlrpcBoolean'] => 1,\r
- $GLOBALS['xmlrpcString'] => 1,\r
- $GLOBALS['xmlrpcDouble'] => 1,\r
- $GLOBALS['xmlrpcDateTime'] => 1,\r
- $GLOBALS['xmlrpcBase64'] => 1,\r
- $GLOBALS['xmlrpcArray'] => 2,\r
- $GLOBALS['xmlrpcStruct'] => 3\r
- );\r
-\r
- $GLOBALS['xmlrpc_valid_parents'] = array(\r
- 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'),\r
- 'BOOLEAN' => array('VALUE'),\r
- 'I4' => array('VALUE'),\r
- 'INT' => array('VALUE'),\r
- 'STRING' => array('VALUE'),\r
- 'DOUBLE' => array('VALUE'),\r
- 'DATETIME.ISO8601' => array('VALUE'),\r
- 'BASE64' => array('VALUE'),\r
- 'MEMBER' => array('STRUCT'),\r
- 'NAME' => array('MEMBER'),\r
- 'DATA' => array('ARRAY'),\r
- 'ARRAY' => array('VALUE'),\r
- 'STRUCT' => array('VALUE'),\r
- 'PARAM' => array('PARAMS'),\r
- 'METHODNAME' => array('METHODCALL'),\r
- 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),\r
- 'FAULT' => array('METHODRESPONSE'),\r
- 'NIL' => array('VALUE') // only used when extension activated\r
- );\r
-\r
- // define extra types for supporting NULL (useful for json or <NIL/>)\r
- $GLOBALS['xmlrpcNull']='null';\r
- $GLOBALS['xmlrpcTypes']['null']=1;\r
-\r
- // Not in use anymore since 2.0. Shall we remove it?\r
- /// @deprecated\r
- $GLOBALS['xmlEntities']=array(\r
- 'amp' => '&',\r
- 'quot' => '"',\r
- 'lt' => '<',\r
- 'gt' => '>',\r
- 'apos' => "'"\r
- );\r
-\r
- // tables used for transcoding different charsets into us-ascii xml\r
-\r
- $GLOBALS['xml_iso88591_Entities']=array();\r
- $GLOBALS['xml_iso88591_Entities']['in'] = array();\r
- $GLOBALS['xml_iso88591_Entities']['out'] = array();\r
- for ($i = 0; $i < 32; $i++)\r
- {\r
- $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);\r
- $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';\r
- }\r
- for ($i = 160; $i < 256; $i++)\r
- {\r
- $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);\r
- $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';\r
- }\r
-\r
- /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159.\r
- /// These will NOT be present in true ISO-8859-1, but will save the unwary\r
- /// windows user from sending junk.\r
-/*\r
-$cp1252_to_xmlent =\r
- array(\r
- '\x80'=>'€', '\x81'=>'?', '\x82'=>'‚', '\x83'=>'ƒ',\r
- '\x84'=>'„', '\x85'=>'…', '\x86'=>'†', \x87'=>'‡',\r
- '\x88'=>'ˆ', '\x89'=>'‰', '\x8A'=>'Š', '\x8B'=>'‹',\r
- '\x8C'=>'Œ', '\x8D'=>'?', '\x8E'=>'Ž', '\x8F'=>'?',\r
- '\x90'=>'?', '\x91'=>'‘', '\x92'=>'’', '\x93'=>'“',\r
- '\x94'=>'”', '\x95'=>'•', '\x96'=>'–', '\x97'=>'—',\r
- '\x98'=>'˜', '\x99'=>'™', '\x9A'=>'š', '\x9B'=>'›',\r
- '\x9C'=>'œ', '\x9D'=>'?', '\x9E'=>'ž', '\x9F'=>'Ÿ'\r
- );\r
-*/\r
-\r
- $GLOBALS['xmlrpcerr']['unknown_method']=1;\r
- $GLOBALS['xmlrpcstr']['unknown_method']='Unknown method';\r
- $GLOBALS['xmlrpcerr']['invalid_return']=2;\r
- $GLOBALS['xmlrpcstr']['invalid_return']='Invalid return payload: enable debugging to examine incoming payload';\r
- $GLOBALS['xmlrpcerr']['incorrect_params']=3;\r
- $GLOBALS['xmlrpcstr']['incorrect_params']='Incorrect parameters passed to method';\r
- $GLOBALS['xmlrpcerr']['introspect_unknown']=4;\r
- $GLOBALS['xmlrpcstr']['introspect_unknown']="Can't introspect: method unknown";\r
- $GLOBALS['xmlrpcerr']['http_error']=5;\r
- $GLOBALS['xmlrpcstr']['http_error']="Didn't receive 200 OK from remote server.";\r
- $GLOBALS['xmlrpcerr']['no_data']=6;\r
- $GLOBALS['xmlrpcstr']['no_data']='No data received from server.';\r
- $GLOBALS['xmlrpcerr']['no_ssl']=7;\r
- $GLOBALS['xmlrpcstr']['no_ssl']='No SSL support compiled in.';\r
- $GLOBALS['xmlrpcerr']['curl_fail']=8;\r
- $GLOBALS['xmlrpcstr']['curl_fail']='CURL error';\r
- $GLOBALS['xmlrpcerr']['invalid_request']=15;\r
- $GLOBALS['xmlrpcstr']['invalid_request']='Invalid request payload';\r
- $GLOBALS['xmlrpcerr']['no_curl']=16;\r
- $GLOBALS['xmlrpcstr']['no_curl']='No CURL support compiled in.';\r
- $GLOBALS['xmlrpcerr']['server_error']=17;\r
- $GLOBALS['xmlrpcstr']['server_error']='Internal server error';\r
- $GLOBALS['xmlrpcerr']['multicall_error']=18;\r
- $GLOBALS['xmlrpcstr']['multicall_error']='Received from server invalid multicall response';\r
-\r
- $GLOBALS['xmlrpcerr']['multicall_notstruct'] = 9;\r
- $GLOBALS['xmlrpcstr']['multicall_notstruct'] = 'system.multicall expected struct';\r
- $GLOBALS['xmlrpcerr']['multicall_nomethod'] = 10;\r
- $GLOBALS['xmlrpcstr']['multicall_nomethod'] = 'missing methodName';\r
- $GLOBALS['xmlrpcerr']['multicall_notstring'] = 11;\r
- $GLOBALS['xmlrpcstr']['multicall_notstring'] = 'methodName is not a string';\r
- $GLOBALS['xmlrpcerr']['multicall_recursion'] = 12;\r
- $GLOBALS['xmlrpcstr']['multicall_recursion'] = 'recursive system.multicall forbidden';\r
- $GLOBALS['xmlrpcerr']['multicall_noparams'] = 13;\r
- $GLOBALS['xmlrpcstr']['multicall_noparams'] = 'missing params';\r
- $GLOBALS['xmlrpcerr']['multicall_notarray'] = 14;\r
- $GLOBALS['xmlrpcstr']['multicall_notarray'] = 'params is not an array';\r
-\r
- $GLOBALS['xmlrpcerr']['cannot_decompress']=103;\r
- $GLOBALS['xmlrpcstr']['cannot_decompress']='Received from server compressed HTTP and cannot decompress';\r
- $GLOBALS['xmlrpcerr']['decompress_fail']=104;\r
- $GLOBALS['xmlrpcstr']['decompress_fail']='Received from server invalid compressed HTTP';\r
- $GLOBALS['xmlrpcerr']['dechunk_fail']=105;\r
- $GLOBALS['xmlrpcstr']['dechunk_fail']='Received from server invalid chunked HTTP';\r
- $GLOBALS['xmlrpcerr']['server_cannot_decompress']=106;\r
- $GLOBALS['xmlrpcstr']['server_cannot_decompress']='Received from client compressed HTTP request and cannot decompress';\r
- $GLOBALS['xmlrpcerr']['server_decompress_fail']=107;\r
- $GLOBALS['xmlrpcstr']['server_decompress_fail']='Received from client invalid compressed HTTP request';\r
-\r
- // The charset encoding used by the server for received messages and\r
- // by the client for received responses when received charset cannot be determined\r
- // or is not supported\r
- $GLOBALS['xmlrpc_defencoding']='UTF-8';\r
-\r
- // The encoding used internally by PHP.\r
- // String values received as xml will be converted to this, and php strings will be converted to xml\r
- // as if having been coded with this\r
- $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';\r
-\r
- $GLOBALS['xmlrpcName']='XML-RPC for PHP';\r
- $GLOBALS['xmlrpcVersion']='2.2';\r
-\r
- // let user errors start at 800\r
- $GLOBALS['xmlrpcerruser']=800;\r
- // let XML parse errors start at 100\r
- $GLOBALS['xmlrpcerrxml']=100;\r
-\r
- // formulate backslashes for escaping regexp\r
- // Not in use anymore since 2.0. Shall we remove it?\r
- /// @deprecated\r
- $GLOBALS['xmlrpc_backslash']=chr(92).chr(92);\r
-\r
- // set to TRUE to enable correct decoding of <NIL/> values\r
- $GLOBALS['xmlrpc_null_extension']=false;\r
-\r
- // used to store state during parsing\r
- // quick explanation of components:\r
- // ac - used to accumulate values\r
- // isf - used to indicate a parsing fault (2) or xmlrpcresp fault (1)\r
- // isf_reason - used for storing xmlrpcresp fault string\r
- // lv - used to indicate "looking for a value": implements\r
- // the logic to allow values with no types to be strings\r
- // params - used to store parameters in method calls\r
- // method - used to store method name\r
- // stack - array with genealogy of xml elements names:\r
- // used to validate nesting of xmlrpc elements\r
- $GLOBALS['_xh']=null;\r
-\r
- /**\r
- * Convert a string to the correct XML representation in a target charset\r
- * To help correct communication of non-ascii chars inside strings, regardless\r
- * of the charset used when sending requests, parsing them, sending responses\r
- * and parsing responses, an option is to convert all non-ascii chars present in the message\r
- * into their equivalent 'charset entity'. Charset entities enumerated this way\r
- * are independent of the charset encoding used to transmit them, and all XML\r
- * parsers are bound to understand them.\r
- * Note that in the std case we are not sending a charset encoding mime type\r
- * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.\r
- *\r
- * @todo do a bit of basic benchmarking (strtr vs. str_replace)\r
- * @todo make usage of iconv() or recode_string() or mb_string() where available\r
- */\r
- function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='')\r
- {\r
- if ($src_encoding == '')\r
- {\r
- // lame, but we know no better...\r
- $src_encoding = $GLOBALS['xmlrpc_internalencoding'];\r
- }\r
-\r
- switch(strtoupper($src_encoding.'_'.$dest_encoding))\r
- {\r
- case 'ISO-8859-1_':\r
- case 'ISO-8859-1_US-ASCII':\r
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data);\r
- $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);\r
- break;\r
- case 'ISO-8859-1_UTF-8':\r
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data);\r
- $escaped_data = utf8_encode($escaped_data);\r
- break;\r
- case 'ISO-8859-1_ISO-8859-1':\r
- case 'US-ASCII_US-ASCII':\r
- case 'US-ASCII_UTF-8':\r
- case 'US-ASCII_':\r
- case 'US-ASCII_ISO-8859-1':\r
- case 'UTF-8_UTF-8':\r
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data);\r
- break;\r
- case 'UTF-8_':\r
- case 'UTF-8_US-ASCII':\r
- case 'UTF-8_ISO-8859-1':\r
- // NB: this will choke on invalid UTF-8, going most likely beyond EOF\r
- $escaped_data = '';\r
- // be kind to users creating string xmlrpcvals out of different php types\r
- $data = (string) $data;\r
- $ns = i18n::strlen ($data);\r
- for ($nn = 0; $nn < $ns; $nn++)\r
- {\r
- $ch = $data[$nn];\r
- $ii = ord($ch);\r
- //1 7 0bbbbbbb (127)\r
- if ($ii < 128)\r
- {\r
- /// @todo shall we replace this with a (supposedly) faster str_replace?\r
- switch($ii){\r
- case 34:\r
- $escaped_data .= '"';\r
- break;\r
- case 38:\r
- $escaped_data .= '&';\r
- break;\r
- case 39:\r
- $escaped_data .= ''';\r
- break;\r
- case 60:\r
- $escaped_data .= '<';\r
- break;\r
- case 62:\r
- $escaped_data .= '>';\r
- break;\r
- default:\r
- $escaped_data .= $ch;\r
- } // switch\r
- }\r
- //2 11 110bbbbb 10bbbbbb (2047)\r
- else if ($ii>>5 == 6)\r
- {\r
- $b1 = ($ii & 31);\r
- $ii = ord($data[$nn+1]);\r
- $b2 = ($ii & 63);\r
- $ii = ($b1 * 64) + $b2;\r
- $ent = sprintf ('&#%d;', $ii);\r
- $escaped_data .= $ent;\r
- $nn += 1;\r
- }\r
- //3 16 1110bbbb 10bbbbbb 10bbbbbb\r
- else if ($ii>>4 == 14)\r
- {\r
- $b1 = ($ii & 31);\r
- $ii = ord($data[$nn+1]);\r
- $b2 = ($ii & 63);\r
- $ii = ord($data[$nn+2]);\r
- $b3 = ($ii & 63);\r
- $ii = ((($b1 * 64) + $b2) * 64) + $b3;\r
- $ent = sprintf ('&#%d;', $ii);\r
- $escaped_data .= $ent;\r
- $nn += 2;\r
- }\r
- //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb\r
- else if ($ii>>3 == 30)\r
- {\r
- $b1 = ($ii & 31);\r
- $ii = ord($data[$nn+1]);\r
- $b2 = ($ii & 63);\r
- $ii = ord($data[$nn+2]);\r
- $b3 = ($ii & 63);\r
- $ii = ord($data[$nn+3]);\r
- $b4 = ($ii & 63);\r
- $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;\r
- $ent = sprintf ('&#%d;', $ii);\r
- $escaped_data .= $ent;\r
- $nn += 3;\r
- }\r
- }\r
- break;\r
- default:\r
- $escaped_data = '';\r
- error_log("Converting from $src_encoding to $dest_encoding: not supported...");\r
- }\r
- return $escaped_data;\r
- }\r
-\r
- /// xml parser handler function for opening element tags\r
- function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false)\r
- {\r
- // if invalid xmlrpc already detected, skip all processing\r
- if ($GLOBALS['_xh']['isf'] < 2)\r
- {\r
- // check for correct element nesting\r
- // top level element can only be of 2 types\r
- /// @todo optimization creep: save this check into a bool variable, instead of using count() every time:\r
- /// there is only a single top level element in xml anyway\r
- if (count($GLOBALS['_xh']['stack']) == 0)\r
- {\r
- if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && (\r
- $name != 'VALUE' && !$accept_single_vals))\r
- {\r
- $GLOBALS['_xh']['isf'] = 2;\r
- $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';\r
- return;\r
- }\r
- else\r
- {\r
- $GLOBALS['_xh']['rt'] = strtolower($name);\r
- }\r
- }\r
- else\r
- {\r
- // not top level element: see if parent is OK\r
- $parent = end($GLOBALS['_xh']['stack']);\r
- if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name]))\r
- {\r
- $GLOBALS['_xh']['isf'] = 2;\r
- $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent";\r
- return;\r
- }\r
- }\r
-\r
- switch($name)\r
- {\r
- // optimize for speed switch cases: most common cases first\r
- case 'VALUE':\r
- /// @todo we could check for 2 VALUE elements inside a MEMBER or PARAM element\r
- $GLOBALS['_xh']['vt']='value'; // indicator: no value found yet\r
- $GLOBALS['_xh']['ac']='';\r
- $GLOBALS['_xh']['lv']=1;\r
- $GLOBALS['_xh']['php_class']=null;\r
- break;\r
- case 'I4':\r
- case 'INT':\r
- case 'STRING':\r
- case 'BOOLEAN':\r
- case 'DOUBLE':\r
- case 'DATETIME.ISO8601':\r
- case 'BASE64':\r
- if ($GLOBALS['_xh']['vt']!='value')\r
- {\r
- //two data elements inside a value: an error occurred!\r
- $GLOBALS['_xh']['isf'] = 2;\r
- $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";\r
- return;\r
- }\r
- $GLOBALS['_xh']['ac']=''; // reset the accumulator\r
- break;\r
- case 'STRUCT':\r
- case 'ARRAY':\r
- if ($GLOBALS['_xh']['vt']!='value')\r
- {\r
- //two data elements inside a value: an error occurred!\r
- $GLOBALS['_xh']['isf'] = 2;\r
- $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";\r
- return;\r
- }\r
- // create an empty array to hold child values, and push it onto appropriate stack\r
- $cur_val = array();\r
- $cur_val['values'] = array();\r
- $cur_val['type'] = $name;\r
- // check for out-of-band information to rebuild php objs\r
- // and in case it is found, save it\r
- if (@isset($attrs['PHP_CLASS']))\r
- {\r
- $cur_val['php_class'] = $attrs['PHP_CLASS'];\r
- }\r
- $GLOBALS['_xh']['valuestack'][] = $cur_val;\r
- $GLOBALS['_xh']['vt']='data'; // be prepared for a data element next\r
- break;\r
- case 'DATA':\r
- if ($GLOBALS['_xh']['vt']!='data')\r
- {\r
- //two data elements inside a value: an error occurred!\r
- $GLOBALS['_xh']['isf'] = 2;\r
- $GLOBALS['_xh']['isf_reason'] = "found two data elements inside an array element";\r
- return;\r
- }\r
- case 'METHODCALL':\r
- case 'METHODRESPONSE':\r
- case 'PARAMS':\r
- // valid elements that add little to processing\r
- break;\r
- case 'METHODNAME':\r
- case 'NAME':\r
- /// @todo we could check for 2 NAME elements inside a MEMBER element\r
- $GLOBALS['_xh']['ac']='';\r
- break;\r
- case 'FAULT':\r
- $GLOBALS['_xh']['isf']=1;\r
- break;\r
- case 'MEMBER':\r
- $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on\r
- //$GLOBALS['_xh']['ac']='';\r
- // Drop trough intentionally\r
- case 'PARAM':\r
- // clear value type, so we can check later if no value has been passed for this param/member\r
- $GLOBALS['_xh']['vt']=null;\r
- break;\r
- case 'NIL':\r
- if ($GLOBALS['xmlrpc_null_extension'])\r
- {\r
- if ($GLOBALS['_xh']['vt']!='value')\r
- {\r
- //two data elements inside a value: an error occurred!\r
- $GLOBALS['_xh']['isf'] = 2;\r
- $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";\r
- return;\r
- }\r
- $GLOBALS['_xh']['ac']=''; // reset the accumulator\r
- break;\r
- }\r
- // we do not support the <NIL/> extension, so\r
- // drop through intentionally\r
- default:\r
- /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!!\r
- $GLOBALS['_xh']['isf'] = 2;\r
- $GLOBALS['_xh']['isf_reason'] = "found not-xmlrpc xml element $name";\r
- break;\r
- }\r
-\r
- // Save current element name to stack, to validate nesting\r
- $GLOBALS['_xh']['stack'][] = $name;\r
-\r
- /// @todo optimization creep: move this inside the big switch() above\r
- if($name!='VALUE')\r
- {\r
- $GLOBALS['_xh']['lv']=0;\r
- }\r
- }\r
- }\r
-\r
- /// Used in decoding xml chunks that might represent single xmlrpc values\r
- function xmlrpc_se_any($parser, $name, $attrs)\r
- {\r
- xmlrpc_se($parser, $name, $attrs, true);\r
- }\r
-\r
- /// xml parser handler function for close element tags\r
- function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)\r
- {\r
- if ($GLOBALS['_xh']['isf'] < 2)\r
- {\r
- // push this element name from stack\r
- // NB: if XML validates, correct opening/closing is guaranteed and\r
- // we do not have to check for $name == $curr_elem.\r
- // we also checked for proper nesting at start of elements...\r
- $curr_elem = array_pop($GLOBALS['_xh']['stack']);\r
-\r
- switch($name)\r
- {\r
- case 'VALUE':\r
- // This if() detects if no scalar was inside <VALUE></VALUE>\r
- if ($GLOBALS['_xh']['vt']=='value')\r
- {\r
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];\r
- $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString'];\r
- }\r
-\r
- if ($rebuild_xmlrpcvals)\r
- {\r
- // build the xmlrpc val out of the data received, and substitute it\r
- $temp = new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);\r
- // in case we got info about underlying php class, save it\r
- // in the object we're rebuilding\r
- if (isset($GLOBALS['_xh']['php_class']))\r
- $temp->_php_class = $GLOBALS['_xh']['php_class'];\r
- // check if we are inside an array or struct:\r
- // if value just built is inside an array, let's move it into array on the stack\r
- $vscount = count($GLOBALS['_xh']['valuestack']);\r
- if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')\r
- {\r
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;\r
- }\r
- else\r
- {\r
- $GLOBALS['_xh']['value'] = $temp;\r
- }\r
- }\r
- else\r
- {\r
- /// @todo this needs to treat correctly php-serialized objects,\r
- /// since std deserializing is done by php_xmlrpc_decode,\r
- /// which we will not be calling...\r
- if (isset($GLOBALS['_xh']['php_class']))\r
- {\r
- }\r
-\r
- // check if we are inside an array or struct:\r
- // if value just built is inside an array, let's move it into array on the stack\r
- $vscount = count($GLOBALS['_xh']['valuestack']);\r
- if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')\r
- {\r
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value'];\r
- }\r
- }\r
- break;\r
- case 'BOOLEAN':\r
- case 'I4':\r
- case 'INT':\r
- case 'STRING':\r
- case 'DOUBLE':\r
- case 'DATETIME.ISO8601':\r
- case 'BASE64':\r
- $GLOBALS['_xh']['vt']=strtolower($name);\r
- /// @todo: optimization creep - remove the if/elseif cycle below\r
- /// since the case() in which we are already did that\r
- if ($name=='STRING')\r
- {\r
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];\r
- }\r
- elseif ($name=='DATETIME.ISO8601')\r
- {\r
- if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac']))\r
- {\r
- error_log('XML-RPC: invalid value received in DATETIME: '.$GLOBALS['_xh']['ac']);\r
- }\r
- $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];\r
- $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];\r
- }\r
- elseif ($name=='BASE64')\r
- {\r
- /// @todo check for failure of base64 decoding / catch warnings\r
- $GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);\r
- }\r
- elseif ($name=='BOOLEAN')\r
- {\r
- // special case here: we translate boolean 1 or 0 into PHP\r
- // constants true or false.\r
- // Strings 'true' and 'false' are accepted, even though the\r
- // spec never mentions them (see eg. Blogger api docs)\r
- // NB: this simple checks helps a lot sanitizing input, ie no\r
- // security problems around here\r
- if ($GLOBALS['_xh']['ac']=='1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0)\r
- {\r
- $GLOBALS['_xh']['value']=true;\r
- }\r
- else\r
- {\r
- // log if receiveing something strange, even though we set the value to false anyway\r
- if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($_xh[$parser]['ac'], 'false') != 0)\r
- error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);\r
- $GLOBALS['_xh']['value']=false;\r
- }\r
- }\r
- elseif ($name=='DOUBLE')\r
- {\r
- // we have a DOUBLE\r
- // we must check that only 0123456789-.<space> are characters here\r
- if (!preg_match('/^[+-]?[eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac']))\r
- {\r
- /// @todo: find a better way of throwing an error\r
- // than this!\r
- error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);\r
- $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';\r
- }\r
- else\r
- {\r
- // it's ok, add it on\r
- $GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];\r
- }\r
- }\r
- else\r
- {\r
- // we have an I4/INT\r
- // we must check that only 0123456789-<space> are characters here\r
- if (!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac']))\r
- {\r
- /// @todo find a better way of throwing an error\r
- // than this!\r
- error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']);\r
- $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';\r
- }\r
- else\r
- {\r
- // it's ok, add it on\r
- $GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];\r
- }\r
- }\r
- //$GLOBALS['_xh']['ac']=''; // is this necessary?\r
- $GLOBALS['_xh']['lv']=3; // indicate we've found a value\r
- break;\r
- case 'NAME':\r
- $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac'];\r
- break;\r
- case 'MEMBER':\r
- //$GLOBALS['_xh']['ac']=''; // is this necessary?\r
- // add to array in the stack the last element built,\r
- // unless no VALUE was found\r
- if ($GLOBALS['_xh']['vt'])\r
- {\r
- $vscount = count($GLOBALS['_xh']['valuestack']);\r
- $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value'];\r
- } else\r
- error_log('XML-RPC: missing VALUE inside STRUCT in received xml');\r
- break;\r
- case 'DATA':\r
- //$GLOBALS['_xh']['ac']=''; // is this necessary?\r
- $GLOBALS['_xh']['vt']=null; // reset this to check for 2 data elements in a row - even if they're empty\r
- break;\r
- case 'STRUCT':\r
- case 'ARRAY':\r
- // fetch out of stack array of values, and promote it to current value\r
- $curr_val = array_pop($GLOBALS['_xh']['valuestack']);\r
- $GLOBALS['_xh']['value'] = $curr_val['values'];\r
- $GLOBALS['_xh']['vt']=strtolower($name);\r
- if (isset($curr_val['php_class']))\r
- {\r
- $GLOBALS['_xh']['php_class'] = $curr_val['php_class'];\r
- }\r
- break;\r
- case 'PARAM':\r
- // add to array of params the current value,\r
- // unless no VALUE was found\r
- if ($GLOBALS['_xh']['vt'])\r
- {\r
- $GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];\r
- $GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];\r
- }\r
- else\r
- error_log('XML-RPC: missing VALUE inside PARAM in received xml');\r
- break;\r
- case 'METHODNAME':\r
- $GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']);\r
- break;\r
- case 'NIL':\r
- if ($GLOBALS['xmlrpc_null_extension'])\r
- {\r
- $GLOBALS['_xh']['vt']='null';\r
- $GLOBALS['_xh']['value']=null;\r
- $GLOBALS['_xh']['lv']=3;\r
- break;\r
- }\r
- // drop through intentionally if nil extension not enabled\r
- case 'PARAMS':\r
- case 'FAULT':\r
- case 'METHODCALL':\r
- case 'METHORESPONSE':\r
- break;\r
- default:\r
- // End of INVALID ELEMENT!\r
- // shall we add an assert here for unreachable code???\r
- break;\r
- }\r
- }\r
- }\r
-\r
- /// Used in decoding xmlrpc requests/responses without rebuilding xmlrpc values\r
- function xmlrpc_ee_fast($parser, $name)\r
- {\r
- xmlrpc_ee($parser, $name, false);\r
- }\r
-\r
- /// xml parser handler function for character data\r
- function xmlrpc_cd($parser, $data)\r
- {\r
- // skip processing if xml fault already detected\r
- if ($GLOBALS['_xh']['isf'] < 2)\r
- {\r
- // "lookforvalue==3" means that we've found an entire value\r
- // and should discard any further character data\r
- if($GLOBALS['_xh']['lv']!=3)\r
- {\r
- // G. Giunta 2006-08-23: useless change of 'lv' from 1 to 2\r
- //if($GLOBALS['_xh']['lv']==1)\r
- //{\r
- // if we've found text and we're just in a <value> then\r
- // say we've found a value\r
- //$GLOBALS['_xh']['lv']=2;\r
- //}\r
- // we always initialize the accumulator before starting parsing, anyway...\r
- //if(!@isset($GLOBALS['_xh']['ac']))\r
- //{\r
- // $GLOBALS['_xh']['ac'] = '';\r
- //}\r
- $GLOBALS['_xh']['ac'].=$data;\r
- }\r
- }\r
- }\r
-\r
- /// xml parser handler function for 'other stuff', ie. not char data or\r
- /// element start/end tag. In fact it only gets called on unknown entities...\r
- function xmlrpc_dh($parser, $data)\r
- {\r
- // skip processing if xml fault already detected\r
- if ($GLOBALS['_xh']['isf'] < 2)\r
- {\r
- if(i18n::substr($data, 0, 1) == '&' && i18n::substr($data, -1, 1) == ';')\r
- {\r
- // G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2\r
- //if($GLOBALS['_xh']['lv']==1)\r
- //{\r
- // $GLOBALS['_xh']['lv']=2;\r
- //}\r
- $GLOBALS['_xh']['ac'].=$data;\r
- }\r
- }\r
- return true;\r
- }\r
-\r
- class xmlrpc_client\r
- {\r
- var $path;\r
- var $server;\r
- var $port=0;\r
- var $method='http';\r
- var $errno;\r
- var $errstr;\r
- var $debug=0;\r
- var $username='';\r
- var $password='';\r
- var $authtype=1;\r
- var $cert='';\r
- var $certpass='';\r
- var $cacert='';\r
- var $cacertdir='';\r
- var $key='';\r
- var $keypass='';\r
- var $verifypeer=true;\r
- var $verifyhost=1;\r
- var $no_multicall=false;\r
- var $proxy='';\r
- var $proxyport=0;\r
- var $proxy_user='';\r
- var $proxy_pass='';\r
- var $proxy_authtype=1;\r
- var $cookies=array();\r
- /**\r
- * List of http compression methods accepted by the client for responses.\r
- * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib\r
- *\r
- * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since\r
- * in those cases it will be up to CURL to decide the compression methods\r
- * it supports. You might check for the presence of 'zlib' in the output of\r
- * curl_version() to determine wheter compression is supported or not\r
- */\r
- var $accepted_compression = array();\r
- /**\r
- * Name of compression scheme to be used for sending requests.\r
- * Either null, gzip or deflate\r
- */\r
- var $request_compression = '';\r
- /**\r
- * CURL handle: used for keep-alive connections (PHP 4.3.8 up, see:\r
- * http://curl.haxx.se/docs/faq.html#7.3)\r
- */\r
- var $xmlrpc_curl_handle = null;\r
- /// Wheter to use persistent connections for http 1.1 and https\r
- var $keepalive = false;\r
- /// Charset encodings that can be decoded without problems by the client\r
- var $accepted_charset_encodings = array();\r
- /// Charset encoding to be used in serializing request. NULL = use ASCII\r
- var $request_charset_encoding = '';\r
- /**\r
- * Decides the content of xmlrpcresp objects returned by calls to send()\r
- * valid strings are 'xmlrpcvals', 'phpvals' or 'xml'\r
- */\r
- var $return_type = 'xmlrpcvals';\r
-\r
- /**\r
- * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php\r
- * @param string $server the server name / ip address\r
- * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used\r
- * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed\r
- */\r
- function xmlrpc_client($path, $server='', $port='', $method='')\r
- {\r
- // allow user to specify all params in $path\r
- if($server == '' and $port == '' and $method == '')\r
- {\r
- $parts = parse_url($path);\r
- $server = $parts['host'];\r
- $path = $parts['path'];\r
- if(isset($parts['query']))\r
- {\r
- $path .= '?'.$parts['query'];\r
- }\r
- if(isset($parts['fragment']))\r
- {\r
- $path .= '#'.$parts['fragment'];\r
- }\r
- if(isset($parts['port']))\r
- {\r
- $port = $parts['port'];\r
- }\r
- if(isset($parts['scheme']))\r
- {\r
- $method = $parts['scheme'];\r
- }\r
- if(isset($parts['user']))\r
- {\r
- $this->username = $parts['user'];\r
- }\r
- if(isset($parts['pass']))\r
- {\r
- $this->password = $parts['pass'];\r
- }\r
- }\r
- if($path == '' || $path[0] != '/')\r
- {\r
- $this->path='/'.$path;\r
- }\r
- else\r
- {\r
- $this->path=$path;\r
- }\r
- $this->server=$server;\r
- if($port != '')\r
- {\r
- $this->port=$port;\r
- }\r
- if($method != '')\r
- {\r
- $this->method=$method;\r
- }\r
-\r
- // if ZLIB is enabled, let the client by default accept compressed responses\r
- if(function_exists('gzinflate') || (\r
- function_exists('curl_init') && (($info = curl_version()) &&\r
- ((is_string($info) && i18n::strpos($info, 'zlib') !== null) || isset($info['libz_version'])))\r
- ))\r
- {\r
- $this->accepted_compression = array('gzip', 'deflate');\r
- }\r
-\r
- // keepalives: enabled by default ONLY for PHP >= 4.3.8\r
- // (see http://curl.haxx.se/docs/faq.html#7.3)\r
- if(version_compare(phpversion(), '4.3.8') >= 0)\r
- {\r
- $this->keepalive = true;\r
- }\r
-\r
- // by default the xml parser can support these 3 charset encodings\r
- $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');\r
- }\r
-\r
- /**\r
- * Enables/disables the echoing to screen of the xmlrpc responses received\r
- * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, before received response)\r
- * @access public\r
- */\r
- function setDebug($in)\r
- {\r
- $this->debug=$in;\r
- }\r
-\r
- /**\r
- * Add some http BASIC AUTH credentials, used by the client to authenticate\r
- * @param string $u username\r
- * @param string $p password\r
- * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)\r
- * @access public\r
- */\r
- function setCredentials($u, $p, $t=1)\r
- {\r
- $this->username=$u;\r
- $this->password=$p;\r
- $this->authtype=$t;\r
- }\r
-\r
- /**\r
- * Add a client-side https certificate\r
- * @param string $cert\r
- * @param string $certpass\r
- * @access public\r
- */\r
- function setCertificate($cert, $certpass)\r
- {\r
- $this->cert = $cert;\r
- $this->certpass = $certpass;\r
- }\r
-\r
- /**\r
- * Add a CA certificate to verify server with (see man page about\r
- * CURLOPT_CAINFO for more details\r
- * @param string $cacert certificate file name (or dir holding certificates)\r
- * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false\r
- * @access public\r
- */\r
- function setCaCertificate($cacert, $is_dir=false)\r
- {\r
- if ($is_dir)\r
- {\r
- $this->cacert = $cacert;\r
- }\r
- else\r
- {\r
- $this->cacertdir = $cacert;\r
- }\r
- }\r
-\r
- /**\r
- * Set attributes for SSL communication: private SSL key\r
- * @param string $key The name of a file containing a private SSL key\r
- * @param string $keypass The secret password needed to use the private SSL key\r
- * @access public\r
- * NB: does not work in older php/curl installs\r
- * Thanks to Daniel Convissor\r
- */\r
- function setKey($key, $keypass)\r
- {\r
- $this->key = $key;\r
- $this->keypass = $keypass;\r
- }\r
-\r
- /**\r
- * Set attributes for SSL communication: verify server certificate\r
- * @param bool $i enable/disable verification of peer certificate\r
- * @access public\r
- */\r
- function setSSLVerifyPeer($i)\r
- {\r
- $this->verifypeer = $i;\r
- }\r
-\r
- /**\r
- * Set attributes for SSL communication: verify match of server cert w. hostname\r
- * @param int $i\r
- * @access public\r
- */\r
- function setSSLVerifyHost($i)\r
- {\r
- $this->verifyhost = $i;\r
- }\r
-\r
- /**\r
- * Set proxy info\r
- * @param string $proxyhost\r
- * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS\r
- * @param string $proxyusername Leave blank if proxy has public access\r
- * @param string $proxypassword Leave blank if proxy has public access\r
- * @param int $proxyauthtype set to constant CURLAUTH_NTLM to use NTLM auth with proxy\r
- * @access public\r
- */\r
- function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1)\r
- {\r
- $this->proxy = $proxyhost;\r
- $this->proxyport = $proxyport;\r
- $this->proxy_user = $proxyusername;\r
- $this->proxy_pass = $proxypassword;\r
- $this->proxy_authtype = $proxyauthtype;\r
- }\r
-\r
- /**\r
- * Enables/disables reception of compressed xmlrpc responses.\r
- * Note that enabling reception of compressed responses merely adds some standard\r
- * http headers to xmlrpc requests. It is up to the xmlrpc server to return\r
- * compressed responses when receiving such requests.\r
- * @param string $compmethod either 'gzip', 'deflate', 'any' or ''\r
- * @access public\r
- */\r
- function setAcceptedCompression($compmethod)\r
- {\r
- if ($compmethod == 'any')\r
- $this->accepted_compression = array('gzip', 'deflate');\r
- else\r
- $this->accepted_compression = array($compmethod);\r
- }\r
-\r
- /**\r
- * Enables/disables http compression of xmlrpc request.\r
- * Take care when sending compressed requests: servers might not support them\r
- * (and automatic fallback to uncompressed requests is not yet implemented)\r
- * @param string $compmethod either 'gzip', 'deflate' or ''\r
- * @access public\r
- */\r
- function setRequestCompression($compmethod)\r
- {\r
- $this->request_compression = $compmethod;\r
- }\r
-\r
- /**\r
- * Adds a cookie to list of cookies that will be sent to server.\r
- * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie:\r
- * do not do it unless you know what you are doing\r
- * @param string $name\r
- * @param string $value\r
- * @param string $path\r
- * @param string $domain\r
- * @param int $port\r
- * @access public\r
- *\r
- * @todo check correctness of urlencoding cookie value (copied from php way of doing it...)\r
- */\r
- function setCookie($name, $value='', $path='', $domain='', $port=null)\r
- {\r
- $this->cookies[$name]['value'] = urlencode($value);\r
- if ($path || $domain || $port)\r
- {\r
- $this->cookies[$name]['path'] = $path;\r
- $this->cookies[$name]['domain'] = $domain;\r
- $this->cookies[$name]['port'] = $port;\r
- $this->cookies[$name]['version'] = 1;\r
- }\r
- else\r
- {\r
- $this->cookies[$name]['version'] = 0;\r
- }\r
- }\r
-\r
- /**\r
- * Send an xmlrpc request\r
- * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request\r
- * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply\r
- * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used\r
- * @return xmlrpcresp\r
- * @access public\r
- */\r
- function& send($msg, $timeout=0, $method='')\r
- {\r
- // if user deos not specify http protocol, use native method of this client\r
- // (i.e. method set during call to constructor)\r
- if($method == '')\r
- {\r
- $method = $this->method;\r
- }\r
-\r
- if(is_array($msg))\r
- {\r
- // $msg is an array of xmlrpcmsg's\r
- $r = $this->multicall($msg, $timeout, $method);\r
- return $r;\r
- }\r
- elseif(is_string($msg))\r
- {\r
- $n = new xmlrpcmsg('');\r
- $n->payload = $msg;\r
- $msg = $n;\r
- }\r
-\r
- // where msg is an xmlrpcmsg\r
- $msg->debug=$this->debug;\r
-\r
- if($method == 'https')\r
- {\r
- $r =& $this->sendPayloadHTTPS(\r
- $msg,\r
- $this->server,\r
- $this->port,\r
- $timeout,\r
- $this->username,\r
- $this->password,\r
- $this->authtype,\r
- $this->cert,\r
- $this->certpass,\r
- $this->cacert,\r
- $this->cacertdir,\r
- $this->proxy,\r
- $this->proxyport,\r
- $this->proxy_user,\r
- $this->proxy_pass,\r
- $this->proxy_authtype,\r
- $this->keepalive,\r
- $this->key,\r
- $this->keypass\r
- );\r
- }\r
- elseif($method == 'http11')\r
- {\r
- $r =& $this->sendPayloadCURL(\r
- $msg,\r
- $this->server,\r
- $this->port,\r
- $timeout,\r
- $this->username,\r
- $this->password,\r
- $this->authtype,\r
- null,\r
- null,\r
- null,\r
- null,\r
- $this->proxy,\r
- $this->proxyport,\r
- $this->proxy_user,\r
- $this->proxy_pass,\r
- $this->proxy_authtype,\r
- 'http',\r
- $this->keepalive\r
- );\r
- }\r
- else\r
- {\r
- $r =& $this->sendPayloadHTTP10(\r
- $msg,\r
- $this->server,\r
- $this->port,\r
- $timeout,\r
- $this->username,\r
- $this->password,\r
- $this->authtype,\r
- $this->proxy,\r
- $this->proxyport,\r
- $this->proxy_user,\r
- $this->proxy_pass,\r
- $this->proxy_authtype\r
- );\r
- }\r
-\r
- return $r;\r
- }\r
-\r
- /**\r
- * @access private\r
- */\r
- function &sendPayloadHTTP10($msg, $server, $port, $timeout=0,\r
- $username='', $password='', $authtype=1, $proxyhost='',\r
- $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1)\r
- {\r
- if($port==0)\r
- {\r
- $port=80;\r
- }\r
-\r
- // Only create the payload if it was not created previously\r
- if(empty($msg->payload))\r
- {\r
- $msg->createPayload($this->request_charset_encoding);\r
- }\r
-\r
- $payload = $msg->payload;\r
- // Deflate request body and set appropriate request headers\r
- if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))\r
- {\r
- if($this->request_compression == 'gzip')\r
- {\r
- $a = @gzencode($payload);\r
- if($a)\r
- {\r
- $payload = $a;\r
- $encoding_hdr = "Content-Encoding: gzip\r\n";\r
- }\r
- }\r
- else\r
- {\r
- $a = @gzcompress($payload);\r
- if($a)\r
- {\r
- $payload = $a;\r
- $encoding_hdr = "Content-Encoding: deflate\r\n";\r
- }\r
- }\r
- }\r
- else\r
- {\r
- $encoding_hdr = '';\r
- }\r
-\r
- // thanks to Grant Rauscher <grant7@firstworld.net> for this\r
- $credentials='';\r
- if($username!='')\r
- {\r
- $credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";\r
- if ($authtype != 1)\r
- {\r
- error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth is supported with HTTP 1.0');\r
- }\r
- }\r
-\r
- $accepted_encoding = '';\r
- if(is_array($this->accepted_compression) && count($this->accepted_compression))\r
- {\r
- $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";\r
- }\r
-\r
- $proxy_credentials = '';\r
- if($proxyhost)\r
- {\r
- if($proxyport == 0)\r
- {\r
- $proxyport = 8080;\r
- }\r
- $connectserver = $proxyhost;\r
- $connectport = $proxyport;\r
- $uri = 'http://'.$server.':'.$port.$this->path;\r
- if($proxyusername != '')\r
- {\r
- if ($proxyauthtype != 1)\r
- {\r
- error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth to proxy is supported with HTTP 1.0');\r
- }\r
- $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n";\r
- }\r
- }\r
- else\r
- {\r
- $connectserver = $server;\r
- $connectport = $port;\r
- $uri = $this->path;\r
- }\r
-\r
- // Cookie generation, as per rfc2965 (version 1 cookies) or\r
- // netscape's rules (version 0 cookies)\r
- $cookieheader='';\r
- foreach ($this->cookies as $name => $cookie)\r
- {\r
- if ($cookie['version'])\r
- {\r
- $cookieheader .= 'Cookie: $Version="' . $cookie['version'] . '"; ';\r
- $cookieheader .= $name . '="' . $cookie['value'] . '";';\r
- if ($cookie['path'])\r
- $cookieheader .= ' $Path="' . $cookie['path'] . '";';\r
- if ($cookie['domain'])\r
- $cookieheader .= ' $Domain="' . $cookie['domain'] . '";';\r
- if ($cookie['port'])\r
- $cookieheader .= ' $Port="' . $cookie['domain'] . '";';\r
- $cookieheader = i18n::substr($cookieheader, 0, -1) . "\r\n";\r
- }\r
- else\r
- {\r
- $cookieheader .= 'Cookie: ' . $name . '=' . $cookie['value'] . "\r\n";\r
- }\r
- }\r
-\r
- $op= 'POST ' . $uri. " HTTP/1.0\r\n" .\r
- 'User-Agent: ' . $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion'] . "\r\n" .\r
- 'Host: '. $server . ':' . $port . "\r\n" .\r
- $credentials .\r
- $proxy_credentials .\r
- $accepted_encoding .\r
- $encoding_hdr .\r
- 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .\r
- $cookieheader .\r
- 'Content-Type: ' . $msg->content_type . "\r\nContent-Length: " .\r
- i18n::strlen($payload) . "\r\n\r\n" .\r
- $payload;\r
-\r
- if($this->debug > 1)\r
- {\r
- print "<PRE>\n---SENDING---\n" . Entity::hen($op) . "\n---END---\n</PRE>";\r
- // let the client see this now in case http times out...\r
- flush();\r
- }\r
-\r
- if($timeout>0)\r
- {\r
- $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);\r
- }\r
- else\r
- {\r
- $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr);\r
- }\r
- if($fp)\r
- {\r
- if($timeout>0 && function_exists('stream_set_timeout'))\r
- {\r
- stream_set_timeout($fp, $timeout);\r
- }\r
- }\r
- else\r
- {\r
- $this->errstr='Connect error: '.$this->errstr;\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');\r
- return $r;\r
- }\r
-\r
- if(!fputs($fp, $op, i18n::strlen($op)))\r
- {\r
- $this->errstr='Write error';\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);\r
- return $r;\r
- }\r
- else\r
- {\r
- // reset errno and errstr on succesful socket connection\r
- $this->errstr = '';\r
- }\r
- // G. Giunta 2005/10/24: close socket before parsing.\r
- // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects)\r
- $ipd='';\r
- while($data=fread($fp, 32768))\r
- {\r
- // shall we check for $data === FALSE?\r
- // as per the manual, it signals an error\r
- $ipd.=$data;\r
- }\r
- fclose($fp);\r
- $r =& $msg->parseResponse($ipd, false, $this->return_type);\r
- return $r;\r
-\r
- }\r
-\r
- /**\r
- * @access private\r
- */\r
- function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='',\r
- $password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='',\r
- $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1,\r
- $keepalive=false, $key='', $keypass='')\r
- {\r
- $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username,\r
- $password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport,\r
- $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass);\r
- return $r;\r
- }\r
-\r
- /**\r
- * Contributed by Justin Miller <justin@voxel.net>\r
- * Requires curl to be built into PHP\r
- * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!\r
- * @access private\r
- */\r
- function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='',\r
- $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='',\r
- $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https',\r
- $keepalive=false, $key='', $keypass='')\r
- {\r
- if(!function_exists('curl_init'))\r
- {\r
- $this->errstr='CURL unavailable on this install';\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);\r
- return $r;\r
- }\r
- if($method == 'https')\r
- {\r
- if(($info = curl_version()) &&\r
- ((is_string($info) && i18n::strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version']))))\r
- {\r
- $this->errstr='SSL unavailable on this install';\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);\r
- return $r;\r
- }\r
- }\r
-\r
- if($port == 0)\r
- {\r
- if($method == 'http')\r
- {\r
- $port = 80;\r
- }\r
- else\r
- {\r
- $port = 443;\r
- }\r
- }\r
-\r
- // Only create the payload if it was not created previously\r
- if(empty($msg->payload))\r
- {\r
- $msg->createPayload($this->request_charset_encoding);\r
- }\r
-\r
- // Deflate request body and set appropriate request headers\r
- $payload = $msg->payload;\r
- if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))\r
- {\r
- if($this->request_compression == 'gzip')\r
- {\r
- $a = @gzencode($payload);\r
- if($a)\r
- {\r
- $payload = $a;\r
- $encoding_hdr = 'Content-Encoding: gzip';\r
- }\r
- }\r
- else\r
- {\r
- $a = @gzcompress($payload);\r
- if($a)\r
- {\r
- $payload = $a;\r
- $encoding_hdr = 'Content-Encoding: deflate';\r
- }\r
- }\r
- }\r
- else\r
- {\r
- $encoding_hdr = '';\r
- }\r
-\r
- if($this->debug > 1)\r
- {\r
- print "<PRE>\n---SENDING---\n" . Entity::hen($payload) . "\n---END---\n</PRE>";\r
- // let the client see this now in case http times out...\r
- flush();\r
- }\r
-\r
- if(!$keepalive || !$this->xmlrpc_curl_handle)\r
- {\r
- $curl = curl_init($method . '://' . $server . ':' . $port . $this->path);\r
- if($keepalive)\r
- {\r
- $this->xmlrpc_curl_handle = $curl;\r
- }\r
- }\r
- else\r
- {\r
- $curl = $this->xmlrpc_curl_handle;\r
- }\r
-\r
- // results into variable\r
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\r
-\r
- if($this->debug)\r
- {\r
- curl_setopt($curl, CURLOPT_VERBOSE, 1);\r
- }\r
- curl_setopt($curl, CURLOPT_USERAGENT, $GLOBALS['xmlrpcName'].' '.$GLOBALS['xmlrpcVersion']);\r
- // required for XMLRPC: post the data\r
- curl_setopt($curl, CURLOPT_POST, 1);\r
- // the data\r
- curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);\r
-\r
- // return the header too\r
- curl_setopt($curl, CURLOPT_HEADER, 1);\r
-\r
- // will only work with PHP >= 5.0\r
- // NB: if we set an empty string, CURL will add http header indicating\r
- // ALL methods it is supporting. This is possibly a better option than\r
- // letting the user tell what curl can / cannot do...\r
- if(is_array($this->accepted_compression) && count($this->accepted_compression))\r
- {\r
- //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));\r
- // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)\r
- if (count($this->accepted_compression) == 1)\r
- {\r
- curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]);\r
- }\r
- else\r
- curl_setopt($curl, CURLOPT_ENCODING, '');\r
- }\r
- // extra headers\r
- $headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));\r
- // if no keepalive is wanted, let the server know it in advance\r
- if(!$keepalive)\r
- {\r
- $headers[] = 'Connection: close';\r
- }\r
- // request compression header\r
- if($encoding_hdr)\r
- {\r
- $headers[] = $encoding_hdr;\r
- }\r
-\r
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);\r
- // timeout is borked\r
- if($timeout)\r
- {\r
- curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);\r
- }\r
-\r
- if($username && $password)\r
- {\r
- curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);\r
- if (defined('CURLOPT_HTTPAUTH'))\r
- {\r
- curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype);\r
- }\r
- else if ($authtype != 1)\r
- {\r
- error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth is supported by the current PHP/curl install');\r
- }\r
- }\r
-\r
- if($method == 'https')\r
- {\r
- // set cert file\r
- if($cert)\r
- {\r
- curl_setopt($curl, CURLOPT_SSLCERT, $cert);\r
- }\r
- // set cert password\r
- if($certpass)\r
- {\r
- curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass);\r
- }\r
- // whether to verify remote host's cert\r
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer);\r
- // set ca certificates file/dir\r
- if($cacert)\r
- {\r
- curl_setopt($curl, CURLOPT_CAINFO, $cacert);\r
- }\r
- if($cacertdir)\r
- {\r
- curl_setopt($curl, CURLOPT_CAPATH, $cacertdir);\r
- }\r
- // set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?)\r
- if($key)\r
- {\r
- curl_setopt($curl, CURLOPT_SSLKEY, $key);\r
- }\r
- // set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?)\r
- if($keypass)\r
- {\r
- curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);\r
- }\r
- // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used\r
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);\r
- }\r
-\r
- // proxy info\r
- if($proxyhost)\r
- {\r
- if($proxyport == 0)\r
- {\r
- $proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080\r
- }\r
- curl_setopt($curl, CURLOPT_PROXY,$proxyhost.':'.$proxyport);\r
- //curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport);\r
- if($proxyusername)\r
- {\r
- curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword);\r
- if (defined('CURLOPT_PROXYAUTH'))\r
- {\r
- curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyauthtype);\r
- }\r
- else if ($proxyauthtype != 1)\r
- {\r
- error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth to proxy is supported by the current PHP/curl install');\r
- }\r
- }\r
- }\r
-\r
- // NB: should we build cookie http headers by hand rather than let CURL do it?\r
- // the following code does not honour 'expires', 'path' and 'domain' cookie attributes\r
- // set to clint obj the the user...\r
- if (count($this->cookies))\r
- {\r
- $cookieheader = '';\r
- foreach ($this->cookies as $name => $cookie)\r
- {\r
- $cookieheader .= $name . '=' . $cookie['value'] . ', ';\r
- }\r
- curl_setopt($curl, CURLOPT_COOKIE, i18n::substr($cookieheader, 0, -2));\r
- }\r
-\r
- $result = curl_exec($curl);\r
-\r
- if(!$result)\r
- {\r
- $this->errstr='no response';\r
- $resp = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl));\r
- if(!$keepalive)\r
- {\r
- curl_close($curl);\r
- }\r
- }\r
- else\r
- {\r
- if(!$keepalive)\r
- {\r
- curl_close($curl);\r
- }\r
- $resp =& $msg->parseResponse($result, true, $this->return_type);\r
- }\r
- return $resp;\r
- }\r
-\r
- /**\r
- * Send an array of request messages and return an array of responses.\r
- * Unless $this->no_multicall has been set to true, it will try first\r
- * to use one single xmlrpc call to server method system.multicall, and\r
- * revert to sending many successive calls in case of failure.\r
- * This failure is also stored in $this->no_multicall for subsequent calls.\r
- * Unfortunately, there is no server error code universally used to denote\r
- * the fact that multicall is unsupported, so there is no way to reliably\r
- * distinguish between that and a temporary failure.\r
- * If you are sure that server supports multicall and do not want to\r
- * fallback to using many single calls, set the fourth parameter to FALSE.\r
- *\r
- * NB: trying to shoehorn extra functionality into existing syntax has resulted\r
- * in pretty much convoluted code...\r
- *\r
- * @param array $msgs an array of xmlrpcmsg objects\r
- * @param integer $timeout connection timeout (in seconds)\r
- * @param string $method the http protocol variant to be used\r
- * @param boolean fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted\r
- * @return array\r
- * @access public\r
- */\r
- function multicall($msgs, $timeout=0, $method='', $fallback=true)\r
- {\r
- if ($method == '')\r
- {\r
- $method = $this->method;\r
- }\r
- if(!$this->no_multicall)\r
- {\r
- $results = $this->_try_multicall($msgs, $timeout, $method);\r
- if(is_array($results))\r
- {\r
- // System.multicall succeeded\r
- return $results;\r
- }\r
- else\r
- {\r
- // either system.multicall is unsupported by server,\r
- // or call failed for some other reason.\r
- if ($fallback)\r
- {\r
- // Don't try it next time...\r
- $this->no_multicall = true;\r
- }\r
- else\r
- {\r
- if (is_a($results, 'xmlrpcresp'))\r
- {\r
- $result = $results;\r
- }\r
- else\r
- {\r
- $result = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- // override fallback, in case careless user tries to do two\r
- // opposite things at the same time\r
- $fallback = true;\r
- }\r
-\r
- $results = array();\r
- if ($fallback)\r
- {\r
- // system.multicall is (probably) unsupported by server:\r
- // emulate multicall via multiple requests\r
- foreach($msgs as $msg)\r
- {\r
- $results[] =& $this->send($msg, $timeout, $method);\r
- }\r
- }\r
- else\r
- {\r
- // user does NOT want to fallback on many single calls:\r
- // since we should always return an array of responses,\r
- // return an array with the same error repeated n times\r
- foreach($msgs as $msg)\r
- {\r
- $results[] = $result;\r
- }\r
- }\r
- return $results;\r
- }\r
-\r
- /**\r
- * Attempt to boxcar $msgs via system.multicall.\r
- * Returns either an array of xmlrpcreponses, an xmlrpc error response\r
- * or false (when received response does not respect valid multicall syntax)\r
- * @access private\r
- */\r
- function _try_multicall($msgs, $timeout, $method)\r
- {\r
- // Construct multicall message\r
- $calls = array();\r
- foreach($msgs as $msg)\r
- {\r
- $call['methodName'] = new xmlrpcval($msg->method(),'string');\r
- $numParams = $msg->getNumParams();\r
- $params = array();\r
- for($i = 0; $i < $numParams; $i++)\r
- {\r
- $params[$i] = $msg->getParam($i);\r
- }\r
- $call['params'] = new xmlrpcval($params, 'array');\r
- $calls[] = new xmlrpcval($call, 'struct');\r
- }\r
- $multicall = new xmlrpcmsg('system.multicall');\r
- $multicall->addParam(new xmlrpcval($calls, 'array'));\r
-\r
- // Attempt RPC call\r
- $result =& $this->send($multicall, $timeout, $method);\r
-\r
- if($result->faultCode() != 0)\r
- {\r
- // call to system.multicall failed\r
- return $result;\r
- }\r
-\r
- // Unpack responses.\r
- $rets = $result->value();\r
-\r
- if ($this->return_type == 'xml')\r
- {\r
- return $rets;\r
- }\r
- else if ($this->return_type == 'phpvals')\r
- {\r
- ///@todo test this code branch...\r
- $rets = $result->value();\r
- if(!is_array($rets))\r
- {\r
- return false; // bad return type from system.multicall\r
- }\r
- $numRets = count($rets);\r
- if($numRets != count($msgs))\r
- {\r
- return false; // wrong number of return values.\r
- }\r
-\r
- $response = array();\r
- for($i = 0; $i < $numRets; $i++)\r
- {\r
- $val = $rets[$i];\r
- if (!is_array($val)) {\r
- return false;\r
- }\r
- switch(count($val))\r
- {\r
- case 1:\r
- if(!isset($val[0]))\r
- {\r
- return false; // Bad value\r
- }\r
- // Normal return value\r
- $response[$i] = new xmlrpcresp($val[0], 0, '', 'phpvals');\r
- break;\r
- case 2:\r
- /// @todo remove usage of @: it is apparently quite slow\r
- $code = @$val['faultCode'];\r
- if(!is_int($code))\r
- {\r
- return false;\r
- }\r
- $str = @$val['faultString'];\r
- if(!is_string($str))\r
- {\r
- return false;\r
- }\r
- $response[$i] = new xmlrpcresp(0, $code, $str);\r
- break;\r
- default:\r
- return false;\r
- }\r
- }\r
- return $response;\r
- }\r
- else // return type == 'xmlrpcvals'\r
- {\r
- $rets = $result->value();\r
- if($rets->kindOf() != 'array')\r
- {\r
- return false; // bad return type from system.multicall\r
- }\r
- $numRets = $rets->arraysize();\r
- if($numRets != count($msgs))\r
- {\r
- return false; // wrong number of return values.\r
- }\r
-\r
- $response = array();\r
- for($i = 0; $i < $numRets; $i++)\r
- {\r
- $val = $rets->arraymem($i);\r
- switch($val->kindOf())\r
- {\r
- case 'array':\r
- if($val->arraysize() != 1)\r
- {\r
- return false; // Bad value\r
- }\r
- // Normal return value\r
- $response[$i] = new xmlrpcresp($val->arraymem(0));\r
- break;\r
- case 'struct':\r
- $code = $val->structmem('faultCode');\r
- if($code->kindOf() != 'scalar' || $code->scalartyp() != 'int')\r
- {\r
- return false;\r
- }\r
- $str = $val->structmem('faultString');\r
- if($str->kindOf() != 'scalar' || $str->scalartyp() != 'string')\r
- {\r
- return false;\r
- }\r
- $response[$i] = new xmlrpcresp(0, $code->scalarval(), $str->scalarval());\r
- break;\r
- default:\r
- return false;\r
- }\r
- }\r
- return $response;\r
- }\r
- }\r
- } // end class xmlrpc_client\r
-\r
- class xmlrpcresp\r
- {\r
- var $val = 0;\r
- var $valtyp;\r
- var $errno = 0;\r
- var $errstr = '';\r
- var $payload;\r
- var $hdrs = array();\r
- var $_cookies = array();\r
- var $content_type = 'text/xml';\r
- var $raw_data = '';\r
-\r
- /**\r
- * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)\r
- * @param integer $fcode set it to anything but 0 to create an error response\r
- * @param string $fstr the error string, in case of an error response\r
- * @param string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml'\r
- *\r
- * @todo add check that $val / $fcode / $fstr is of correct type???\r
- * NB: as of now we do not do it, since it might be either an xmlrpcval or a plain\r
- * php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...\r
- */\r
- function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')\r
- {\r
- if($fcode != 0)\r
- {\r
- // error response\r
- $this->errno = $fcode;\r
- $this->errstr = $fstr;\r
- //$this->errstr = Entity::hsc($fstr); // XXX: encoding probably shouldn't be done here; fix later.\r
- }\r
- else\r
- {\r
- // successful response\r
- $this->val = $val;\r
- if ($valtyp == '')\r
- {\r
- // user did not declare type of response value: try to guess it\r
- if (is_object($this->val) && is_a($this->val, 'xmlrpcval'))\r
- {\r
- $this->valtyp = 'xmlrpcvals';\r
- }\r
- else if (is_string($this->val))\r
- {\r
- $this->valtyp = 'xml';\r
-\r
- }\r
- else\r
- {\r
- $this->valtyp = 'phpvals';\r
- }\r
- }\r
- else\r
- {\r
- // user declares type of resp value: believe him\r
- $this->valtyp = $valtyp;\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Returns the error code of the response.\r
- * @return integer the error code of this response (0 for not-error responses)\r
- * @access public\r
- */\r
- function faultCode()\r
- {\r
- return $this->errno;\r
- }\r
-\r
- /**\r
- * Returns the error code of the response.\r
- * @return string the error string of this response ('' for not-error responses)\r
- * @access public\r
- */\r
- function faultString()\r
- {\r
- return $this->errstr;\r
- }\r
-\r
- /**\r
- * Returns the value received by the server.\r
- * @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects\r
- * @access public\r
- */\r
- function value()\r
- {\r
- return $this->val;\r
- }\r
-\r
- /**\r
- * Returns an array with the cookies received from the server.\r
- * Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...)\r
- * with attributes being e.g. 'expires', 'path', domain'.\r
- * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)\r
- * are still present in the array. It is up to the user-defined code to decide\r
- * how to use the received cookies, and wheter they have to be sent back with the next\r
- * request to the server (using xmlrpc_client::setCookie) or not\r
- * @return array array of cookies received from the server\r
- * @access public\r
- */\r
- function cookies()\r
- {\r
- return $this->_cookies;\r
- }\r
-\r
- /**\r
- * Returns xml representation of the response. XML prologue not included\r
- * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed\r
- * @return string the xml representation of the response\r
- * @access public\r
- */\r
- function serialize($charset_encoding='')\r
- {\r
- if ($charset_encoding != '')\r
- $this->content_type = 'text/xml; charset=' . $charset_encoding;\r
- else\r
- $this->content_type = 'text/xml';\r
- $result = "<methodResponse>\n";\r
- if($this->errno)\r
- {\r
- // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients\r
- // by xml-encoding non ascii chars\r
- $result .= "<fault>\n" .\r
-"<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .\r
-"</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .\r
-xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .\r
-"</struct>\n</value>\n</fault>";\r
- }\r
- else\r
- {\r
- if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))\r
- {\r
- if (is_string($this->val) && $this->valtyp == 'xml')\r
- {\r
- $result .= "<params>\n<param>\n" .\r
- $this->val .\r
- "</param>\n</params>";\r
- }\r
- else\r
- {\r
- /// @todo try to build something serializable?\r
- die('cannot serialize xmlrpcresp objects whose content is native php values');\r
- }\r
- }\r
- else\r
- {\r
- $result .= "<params>\n<param>\n" .\r
- $this->val->serialize($charset_encoding) .\r
- "</param>\n</params>";\r
- }\r
- }\r
- $result .= "\n</methodResponse>";\r
- $this->payload = $result;\r
- return $result;\r
- }\r
- }\r
-\r
- class xmlrpcmsg\r
- {\r
- var $payload;\r
- var $methodname;\r
- var $params=array();\r
- var $debug=0;\r
- var $content_type = 'text/xml';\r
-\r
- /**\r
- * @param string $meth the name of the method to invoke\r
- * @param array $pars array of parameters to be paased to the method (xmlrpcval objects)\r
- */\r
- function xmlrpcmsg($meth, $pars=0)\r
- {\r
- $this->methodname=$meth;\r
- if(is_array($pars) && count($pars)>0)\r
- {\r
- for($i=0; $i<count($pars); $i++)\r
- {\r
- $this->addParam($pars[$i]);\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * @access private\r
- */\r
- function xml_header($charset_encoding='')\r
- {\r
- if ($charset_encoding != '')\r
- {\r
- return "<?xml version=\"1.0\" encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n";\r
- }\r
- else\r
- {\r
- return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";\r
- }\r
- }\r
-\r
- /**\r
- * @access private\r
- */\r
- function xml_footer()\r
- {\r
- return '</methodCall>';\r
- }\r
-\r
- /**\r
- * @access private\r
- */\r
- function kindOf()\r
- {\r
- return 'msg';\r
- }\r
-\r
- /**\r
- * @access private\r
- */\r
- function createPayload($charset_encoding='')\r
- {\r
- if ($charset_encoding != '')\r
- $this->content_type = 'text/xml; charset=' . $charset_encoding;\r
- else\r
- $this->content_type = 'text/xml';\r
- $this->payload=$this->xml_header($charset_encoding);\r
- $this->payload.='<methodName>' . $this->methodname . "</methodName>\n";\r
- $this->payload.="<params>\n";\r
- for($i=0; $i<count($this->params); $i++)\r
- {\r
- $p=$this->params[$i];\r
- $this->payload.="<param>\n" . $p->serialize($charset_encoding) .\r
- "</param>\n";\r
- }\r
- $this->payload.="</params>\n";\r
- $this->payload.=$this->xml_footer();\r
- }\r
-\r
- /**\r
- * Gets/sets the xmlrpc method to be invoked\r
- * @param string $meth the method to be set (leave empty not to set it)\r
- * @return string the method that will be invoked\r
- * @access public\r
- */\r
- function method($meth='')\r
- {\r
- if($meth!='')\r
- {\r
- $this->methodname=$meth;\r
- }\r
- return $this->methodname;\r
- }\r
-\r
- /**\r
- * Returns xml representation of the message. XML prologue included\r
- * @return string the xml representation of the message, xml prologue included\r
- * @access public\r
- */\r
- function serialize($charset_encoding='')\r
- {\r
- $this->createPayload($charset_encoding);\r
- return $this->payload;\r
- }\r
-\r
- /**\r
- * Add a parameter to the list of parameters to be used upon method invocation\r
- * @param xmlrpcval $par\r
- * @return boolean false on failure\r
- * @access public\r
- */\r
- function addParam($par)\r
- {\r
- // add check: do not add to self params which are not xmlrpcvals\r
- if(is_object($par) && is_a($par, 'xmlrpcval'))\r
- {\r
- $this->params[]=$par;\r
- return true;\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
- }\r
-\r
- /**\r
- * Returns the nth parameter in the message. The index zero-based.\r
- * @param integer $i the index of the parameter to fetch (zero based)\r
- * @return xmlrpcval the i-th parameter\r
- * @access public\r
- */\r
- function getParam($i) { return $this->params[$i]; }\r
-\r
- /**\r
- * Returns the number of parameters in the messge.\r
- * @return integer the number of parameters currently set\r
- * @access public\r
- */\r
- function getNumParams() { return count($this->params); }\r
-\r
- /**\r
- * Given an open file handle, read all data available and parse it as axmlrpc response.\r
- * NB: the file handle is not closed by this function.\r
- * @access public\r
- * @return xmlrpcresp\r
- * @todo add 2nd & 3rd param to be passed to ParseResponse() ???\r
- */\r
- function &parseResponseFile($fp)\r
- {\r
- $ipd='';\r
- while($data=fread($fp, 32768))\r
- {\r
- $ipd.=$data;\r
- }\r
- //fclose($fp);\r
- $r =& $this->parseResponse($ipd);\r
- return $r;\r
- }\r
-\r
- /**\r
- * Parses HTTP headers and separates them from data.\r
- * @access private\r
- */\r
- function &parseResponseHeaders(&$data, $headers_processed=false)\r
- {\r
- // Support "web-proxy-tunelling" connections for https through proxies\r
- if(preg_match('/^HTTP\/1\.[0-1] 200 Connection established/', $data))\r
- {\r
- // Look for CR/LF or simple LF as line separator,\r
- // (even though it is not valid http)\r
- $pos = i18n::strpos($data,"\r\n\r\n");\r
- if($pos || is_int($pos))\r
- {\r
- $bd = $pos+4;\r
- }\r
- else\r
- {\r
- $pos = i18n::strpos($data,"\n\n");\r
- if($pos || is_int($pos))\r
- {\r
- $bd = $pos+2;\r
- }\r
- else\r
- {\r
- // No separation between response headers and body: fault?\r
- $bd = 0;\r
- }\r
- }\r
- if ($bd)\r
- {\r
- // this filters out all http headers from proxy.\r
- // maybe we could take them into account, too?\r
- $data = i18n::substr($data, $bd);\r
- }\r
- else\r
- {\r
- error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTPS via proxy error, tunnel connection possibly failed');\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (HTTPS via proxy error, tunnel connection possibly failed)');\r
- return $r;\r
- }\r
- }\r
-\r
- // Strip HTTP 1.1 100 Continue header if present\r
- while(preg_match('/^HTTP\/1\.1 1[0-9]{2} /', $data))\r
- {\r
- $pos = i18n::strpos($data, 'HTTP', 12);\r
- // server sent a Continue header without any (valid) content following...\r
- // give the client a chance to know it\r
- if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5\r
- {\r
- break;\r
- }\r
- $data = i18n::substr($data, $pos);\r
- }\r
- if(!preg_match('/^HTTP\/[0-9.]+ 200 /', $data))\r
- {\r
- $errstr= i18n::substr($data, 0, i18n::strpos($data, "\n")-1);\r
- error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: ' .$errstr);\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')');\r
- return $r;\r
- }\r
-\r
- $GLOBALS['_xh']['headers'] = array();\r
- $GLOBALS['_xh']['cookies'] = array();\r
-\r
- // be tolerant to usage of \n instead of \r\n to separate headers and data\r
- // (even though it is not valid http)\r
- $pos = i18n::strpos($data,"\r\n\r\n");\r
- if($pos || is_int($pos))\r
- {\r
- $bd = $pos+4;\r
- }\r
- else\r
- {\r
- $pos = i18n::strpos($data,"\n\n");\r
- if($pos || is_int($pos))\r
- {\r
- $bd = $pos+2;\r
- }\r
- else\r
- {\r
- // No separation between response headers and body: fault?\r
- // we could take some action here instead of going on...\r
- $bd = 0;\r
- }\r
- }\r
- // be tolerant to line endings, and extra empty lines\r
- //$ar = split("\r?\n", trim(substr($data, 0, $pos))); //split() is deprecated\r
- $ar = preg_split("/\r?\n/", trim(i18n::substr($data, 0, $pos)));\r
- while(list(,$line) = @each($ar))\r
- {\r
- // take care of multi-line headers and cookies\r
- $arr = preg_split('#:#',$line,2);\r
- if(count($arr) > 1)\r
- {\r
- $header_name = strtolower(trim($arr[0]));\r
- /// @todo some other headers (the ones that allow a CSV list of values)\r
- /// do allow many values to be passed using multiple header lines.\r
- /// We should add content to $GLOBALS['_xh']['headers'][$header_name]\r
- /// instead of replacing it for those...\r
- if ($header_name == 'set-cookie' || $header_name == 'set-cookie2')\r
- {\r
- if ($header_name == 'set-cookie2')\r
- {\r
- // version 2 cookies:\r
- // there could be many cookies on one line, comma separated\r
- $cookies = preg_split('#,#', $arr[1]);\r
- }\r
- else\r
- {\r
- $cookies = array($arr[1]);\r
- }\r
- foreach ($cookies as $cookie)\r
- {\r
- // glue together all received cookies, using a comma to separate them\r
- // (same as php does with getallheaders())\r
- if (isset($GLOBALS['_xh']['headers'][$header_name]))\r
- $GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);\r
- else\r
- $GLOBALS['_xh']['headers'][$header_name] = trim($cookie);\r
- // parse cookie attributes, in case user wants to correctly honour them\r
- // feature creep: only allow rfc-compliant cookie attributes?\r
- $cookie = preg_split('#;#', $cookie);\r
- foreach ($cookie as $pos => $val)\r
- {\r
- $val = preg_split('#=#', $val, 2);\r
- $tag = trim($val[0]);\r
- $val = trim(@$val[1]);\r
- /// @todo with version 1 cookies, we should strip leading and trailing " chars\r
- if ($pos == 0)\r
- {\r
- $cookiename = $tag;\r
- $GLOBALS['_xh']['cookies'][$tag] = array();\r
- $GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);\r
- }\r
- else\r
- {\r
- $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;\r
- }\r
- }\r
- }\r
- }\r
- else\r
- {\r
- $GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);\r
- }\r
- }\r
- elseif(isset($header_name))\r
- {\r
- /// @todo version1 cookies might span multiple lines, thus breaking the parsing above\r
- $GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);\r
- }\r
- }\r
-\r
- $data = i18n::substr($data, $bd);\r
-\r
- if($this->debug && count($GLOBALS['_xh']['headers']))\r
- {\r
- print '<PRE>';\r
- foreach($GLOBALS['_xh']['headers'] as $header => $value)\r
- {\r
- print Entity::hen("HEADER: $header: $value\n");\r
- }\r
- foreach($GLOBALS['_xh']['cookies'] as $header => $value)\r
- {\r
- print Entity::hen("COOKIE: $header={$value['value']}\n");\r
- }\r
- print "</PRE>\n";\r
- }\r
-\r
- // if CURL was used for the call, http headers have been processed,\r
- // and dechunking + reinflating have been carried out\r
- if(!$headers_processed)\r
- {\r
- // Decode chunked encoding sent by http 1.1 servers\r
- if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked')\r
- {\r
- if(!$data = decode_chunked($data))\r
- {\r
- error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to rebuild the chunked data received from server');\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);\r
- return $r;\r
- }\r
- }\r
-\r
- // Decode gzip-compressed stuff\r
- // code shamelessly inspired from nusoap library by Dietrich Ayala\r
- if(isset($GLOBALS['_xh']['headers']['content-encoding']))\r
- {\r
- $GLOBALS['_xh']['headers']['content-encoding'] = str_replace('x-', '', $GLOBALS['_xh']['headers']['content-encoding']);\r
- if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip')\r
- {\r
- // if decoding works, use it. else assume data wasn't gzencoded\r
- if(function_exists('gzinflate'))\r
- {\r
- if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data))\r
- {\r
- $data = $degzdata;\r
- if($this->debug)\r
- print "<PRE>---INFLATED RESPONSE---[".i18n::strlen($data)." chars]---\n" . Entity::hen($data) . "\n---END---</PRE>";\r
- }\r
- elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(i18n::substr($data, 10)))\r
- {\r
- $data = $degzdata;\r
- if($this->debug)\r
- print "<PRE>---INFLATED RESPONSE---[".i18n::strlen($data)." chars]---\n" . Entity::hen($data) . "\n---END---</PRE>";\r
- }\r
- else\r
- {\r
- error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to decode the deflated data received from server');\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);\r
- return $r;\r
- }\r
- }\r
- else\r
- {\r
- error_log('XML-RPC: xmlrpcmsg::parseResponse: the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);\r
- return $r;\r
- }\r
- }\r
- }\r
- } // end of 'if needed, de-chunk, re-inflate response'\r
-\r
- // real stupid hack to avoid PHP 4 complaining about returning NULL by ref\r
- $r = null;\r
- $r =& $r;\r
- return $r;\r
- }\r
-\r
- /**\r
- * Parse the xmlrpc response contained in the string $data and return an xmlrpcresp object.\r
- * @param string $data the xmlrpc response, eventually including http headers\r
- * @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding\r
- * @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'\r
- * @return xmlrpcresp\r
- * @access public\r
- */\r
- function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals')\r
- {\r
- if($this->debug)\r
- {\r
- print "<PRE>---GOT---\n" . Entity::hen($data) . "\n---END---\n</PRE>";\r
- }\r
-\r
- if($data == '')\r
- {\r
- error_log('XML-RPC: xmlrpcmsg::parseResponse: no response received from server.');\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);\r
- return $r;\r
- }\r
-\r
- $GLOBALS['_xh']=array();\r
-\r
- $raw_data = $data;\r
- // parse the HTTP headers of the response, if present, and separate them from data\r
- if(i18n::substr($data, 0, 4) == 'HTTP')\r
- {\r
- $r =& $this->parseResponseHeaders($data, $headers_processed);\r
- if ($r)\r
- {\r
- // failed processing of HTTP response headers\r
- // save into response obj the full payload received, for debugging\r
- $r->raw_data = $data;\r
- return $r;\r
- }\r
- }\r
- else\r
- {\r
- $GLOBALS['_xh']['headers'] = array();\r
- $GLOBALS['_xh']['cookies'] = array();\r
- }\r
-\r
- if($this->debug)\r
- {\r
- $start = i18n::strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');\r
- if ($start)\r
- {\r
- $start += i18n::strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');\r
- $end = i18n::strpos($data, '-->', $start);\r
- $comments = i18n::substr($data, $start, $end-$start);\r
- print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t".Entity::hen(str_replace("\n", "\n\t", base64_decode($comments)))."\n---END---\n</PRE>";\r
- }\r
- }\r
-\r
- // be tolerant of extra whitespace in response body\r
- $data = trim($data);\r
-\r
- /// @todo return an error msg if $data=='' ?\r
-\r
- // be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts)\r
- // idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib\r
- $bd = false;\r
- // Poor man's version of strrpos for php 4...\r
- $pos = i18n::strpos($data, '</methodResponse>');\r
- while($pos || is_int($pos))\r
- {\r
- $bd = $pos+17;\r
- $pos = i18n::strpos($data, '</methodResponse>', $bd);\r
- }\r
- if($bd)\r
- {\r
- $data = i18n::substr($data, 0, $bd);\r
- }\r
-\r
- // if user wants back raw xml, give it to him\r
- if ($return_type == 'xml')\r
- {\r
- $r = new xmlrpcresp($data, 0, '', 'xml');\r
- $r->hdrs = $GLOBALS['_xh']['headers'];\r
- $r->_cookies = $GLOBALS['_xh']['cookies'];\r
- $r->raw_data = $raw_data;\r
- return $r;\r
- }\r
-\r
- // try to 'guestimate' the character encoding of the received response\r
- $resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);\r
-\r
- $GLOBALS['_xh']['ac']='';\r
- //$GLOBALS['_xh']['qt']=''; //unused...\r
- $GLOBALS['_xh']['stack'] = array();\r
- $GLOBALS['_xh']['valuestack'] = array();\r
- $GLOBALS['_xh']['isf']=0; // 0 = OK, 1 for xmlrpc fault responses, 2 = invalid xmlrpc\r
- $GLOBALS['_xh']['isf_reason']='';\r
- $GLOBALS['_xh']['rt']=''; // 'methodcall or 'methodresponse'\r
-\r
- // if response charset encoding is not known / supported, try to use\r
- // the default encoding and parse the xml anyway, but log a warning...\r
- if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))\r
- // the following code might be better for mb_string enabled installs, but\r
- // makes the lib about 200% slower...\r
- //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))\r
- {\r
- error_log('XML-RPC: xmlrpcmsg::parseResponse: invalid charset encoding of received response: '.$resp_encoding);\r
- $resp_encoding = $GLOBALS['xmlrpc_defencoding'];\r
- }\r
- $parser = xml_parser_create($resp_encoding);\r
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);\r
- // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell\r
- // the xml parser to give us back data in the expected charset\r
- xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);\r
-\r
- if ($return_type == 'phpvals')\r
- {\r
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');\r
- }\r
- else\r
- {\r
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');\r
- }\r
-\r
- xml_set_character_data_handler($parser, 'xmlrpc_cd');\r
- xml_set_default_handler($parser, 'xmlrpc_dh');\r
-\r
- // first error check: xml not well formed\r
- if(!xml_parse($parser, $data, count($data)))\r
- {\r
- // thanks to Peter Kocks <peter.kocks@baygate.com>\r
- if((xml_get_current_line_number($parser)) == 1)\r
- {\r
- $errstr = 'XML error at line 1, check URL';\r
- }\r
- else\r
- {\r
- $errstr = sprintf('XML error: %s at line %d, column %d',\r
- xml_error_string(xml_get_error_code($parser)),\r
- xml_get_current_line_number($parser), xml_get_current_column_number($parser));\r
- }\r
- error_log($errstr);\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')');\r
- xml_parser_free($parser);\r
- if($this->debug)\r
- {\r
- print $errstr;\r
- }\r
- $r->hdrs = $GLOBALS['_xh']['headers'];\r
- $r->_cookies = $GLOBALS['_xh']['cookies'];\r
- $r->raw_data = $raw_data;\r
- return $r;\r
- }\r
- xml_parser_free($parser);\r
- // second error check: xml well formed but not xml-rpc compliant\r
- if ($GLOBALS['_xh']['isf'] > 1)\r
- {\r
- if ($this->debug)\r
- {\r
- /// @todo echo something for user?\r
- }\r
-\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],\r
- $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']);\r
- }\r
- // third error check: parsing of the response has somehow gone boink.\r
- // NB: shall we omit this check, since we trust the parsing code?\r
- elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value']))\r
- {\r
- // something odd has happened\r
- // and it's time to generate a client side error\r
- // indicating something odd went on\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],\r
- $GLOBALS['xmlrpcstr']['invalid_return']);\r
- }\r
- else\r
- {\r
- if ($this->debug)\r
- {\r
- print "<PRE>---PARSED---\n";\r
- print Entity::hsc(var_export($GLOBALS['_xh']['value'], true));\r
- print "\n---END---</PRE>";\r
- }\r
-\r
- // note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object.\r
- $v =& $GLOBALS['_xh']['value'];\r
-\r
- if($GLOBALS['_xh']['isf'])\r
- {\r
- /// @todo we should test here if server sent an int and a string,\r
- /// and/or coerce them into such...\r
- if ($return_type == 'xmlrpcvals')\r
- {\r
- $errno_v = $v->structmem('faultCode');\r
- $errstr_v = $v->structmem('faultString');\r
- $errno = $errno_v->scalarval();\r
- $errstr = $errstr_v->scalarval();\r
- }\r
- else\r
- {\r
- $errno = $v['faultCode'];\r
- $errstr = $v['faultString'];\r
- }\r
-\r
- if($errno == 0)\r
- {\r
- // FAULT returned, errno needs to reflect that\r
- $errno = -1;\r
- }\r
-\r
- $r = new xmlrpcresp(0, $errno, $errstr);\r
- }\r
- else\r
- {\r
- $r = new xmlrpcresp($v, 0, '', $return_type);\r
- }\r
- }\r
-\r
- $r->hdrs = $GLOBALS['_xh']['headers'];\r
- $r->_cookies = $GLOBALS['_xh']['cookies'];\r
- $r->raw_data = $raw_data;\r
- return $r;\r
- }\r
- }\r
-\r
- class xmlrpcval\r
- {\r
- var $me=array();\r
- var $mytype=0;\r
- var $_php_class=null;\r
-\r
- /**\r
- * @param mixed $val\r
- * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed\r
- */\r
- function xmlrpcval($val=-1, $type='')\r
- {\r
- /// @todo: optimization creep - do not call addXX, do it all inline.\r
- /// downside: booleans will not be coerced anymore\r
- if($val!==-1 || $type!='')\r
- {\r
- // optimization creep: inlined all work done by constructor\r
- switch($type)\r
- {\r
- case '':\r
- $this->mytype=1;\r
- $this->me['string']=$val;\r
- break;\r
- case 'i4':\r
- case 'int':\r
- case 'double':\r
- case 'string':\r
- case 'boolean':\r
- case 'dateTime.iso8601':\r
- case 'base64':\r
- case 'null':\r
- $this->mytype=1;\r
- $this->me[$type]=$val;\r
- break;\r
- case 'array':\r
- $this->mytype=2;\r
- $this->me['array']=$val;\r
- break;\r
- case 'struct':\r
- $this->mytype=3;\r
- $this->me['struct']=$val;\r
- break;\r
- default:\r
- error_log("XML-RPC: xmlrpcval::xmlrpcval: not a known type ($type)");\r
- }\r
- /*if($type=='')\r
- {\r
- $type='string';\r
- }\r
- if($GLOBALS['xmlrpcTypes'][$type]==1)\r
- {\r
- $this->addScalar($val,$type);\r
- }\r
- elseif($GLOBALS['xmlrpcTypes'][$type]==2)\r
- {\r
- $this->addArray($val);\r
- }\r
- elseif($GLOBALS['xmlrpcTypes'][$type]==3)\r
- {\r
- $this->addStruct($val);\r
- }*/\r
- }\r
- }\r
-\r
- /**\r
- * Add a single php value to an (unitialized) xmlrpcval\r
- * @param mixed $val\r
- * @param string $type\r
- * @return int 1 or 0 on failure\r
- */\r
- function addScalar($val, $type='string')\r
- {\r
- $typeof=@$GLOBALS['xmlrpcTypes'][$type];\r
- if($typeof!=1)\r
- {\r
- error_log("XML-RPC: xmlrpcval::addScalar: not a scalar type ($type)");\r
- return 0;\r
- }\r
-\r
- // coerce booleans into correct values\r
- // NB: we should iether do it for datetimes, integers and doubles, too,\r
- // or just plain remove this check, implemnted on booleans only...\r
- if($type==$GLOBALS['xmlrpcBoolean'])\r
- {\r
- if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false')))\r
- {\r
- $val=true;\r
- }\r
- else\r
- {\r
- $val=false;\r
- }\r
- }\r
-\r
- switch($this->mytype)\r
- {\r
- case 1:\r
- error_log('XML-RPC: xmlrpcval::addScalar: scalar xmlrpcval can have only one value');\r
- return 0;\r
- case 3:\r
- error_log('XML-RPC: xmlrpcval::addScalar: cannot add anonymous scalar to struct xmlrpcval');\r
- return 0;\r
- case 2:\r
- // we're adding a scalar value to an array here\r
- //$ar=$this->me['array'];\r
- //$ar[] = new xmlrpcval($val, $type);\r
- //$this->me['array']=$ar;\r
- // Faster (?) avoid all the costly array-copy-by-val done here...\r
- $this->me['array'][] = new xmlrpcval($val, $type);\r
- return 1;\r
- default:\r
- // a scalar, so set the value and remember we're scalar\r
- $this->me[$type]=$val;\r
- $this->mytype=$typeof;\r
- return 1;\r
- }\r
- }\r
-\r
- /**\r
- * Add an array of xmlrpcval objects to an xmlrpcval\r
- * @param array $vals\r
- * @return int 1 or 0 on failure\r
- * @access public\r
- *\r
- * @todo add some checking for $vals to be an array of xmlrpcvals?\r
- */\r
- function addArray($vals)\r
- {\r
- if($this->mytype==0)\r
- {\r
- $this->mytype=$GLOBALS['xmlrpcTypes']['array'];\r
- $this->me['array']=$vals;\r
- return 1;\r
- }\r
- elseif($this->mytype==2)\r
- {\r
- // we're adding to an array here\r
- $this->me['array'] = array_merge($this->me['array'], $vals);\r
- return 1;\r
- }\r
- else\r
- {\r
- error_log('XML-RPC: xmlrpcval::addArray: already initialized as a [' . $this->kindOf() . ']');\r
- return 0;\r
- }\r
- }\r
-\r
- /**\r
- * Add an array of named xmlrpcval objects to an xmlrpcval\r
- * @param array $vals\r
- * @return int 1 or 0 on failure\r
- * @access public\r
- *\r
- * @todo add some checking for $vals to be an array?\r
- */\r
- function addStruct($vals)\r
- {\r
- if($this->mytype==0)\r
- {\r
- $this->mytype=$GLOBALS['xmlrpcTypes']['struct'];\r
- $this->me['struct']=$vals;\r
- return 1;\r
- }\r
- elseif($this->mytype==3)\r
- {\r
- // we're adding to a struct here\r
- $this->me['struct'] = array_merge($this->me['struct'], $vals);\r
- return 1;\r
- }\r
- else\r
- {\r
- error_log('XML-RPC: xmlrpcval::addStruct: already initialized as a [' . $this->kindOf() . ']');\r
- return 0;\r
- }\r
- }\r
-\r
- // poor man's version of print_r ???\r
- // DEPRECATED!\r
- function dump($ar)\r
- {\r
- foreach($ar as $key => $val)\r
- {\r
- echo "$key => $val<br />";\r
- if($key == 'array')\r
- {\r
- while(list($key2, $val2) = each($val))\r
- {\r
- echo "-- $key2 => $val2<br />";\r
- }\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Returns a string containing "struct", "array" or "scalar" describing the base type of the value\r
- * @return string\r
- * @access public\r
- */\r
- function kindOf()\r
- {\r
- switch($this->mytype)\r
- {\r
- case 3:\r
- return 'struct';\r
- break;\r
- case 2:\r
- return 'array';\r
- break;\r
- case 1:\r
- return 'scalar';\r
- break;\r
- default:\r
- return 'undef';\r
- }\r
- }\r
-\r
- /**\r
- * @access private\r
- */\r
- function serializedata($typ, $val, $charset_encoding='')\r
- {\r
- $rs='';\r
- switch(@$GLOBALS['xmlrpcTypes'][$typ])\r
- {\r
- case 1:\r
- switch($typ)\r
- {\r
- case $GLOBALS['xmlrpcBase64']:\r
- $rs.="<${typ}>" . base64_encode($val) . "</${typ}>";\r
- break;\r
- case $GLOBALS['xmlrpcBoolean']:\r
- $rs.="<${typ}>" . ($val ? '1' : '0') . "</${typ}>";\r
- break;\r
- case $GLOBALS['xmlrpcString']:\r
- // G. Giunta 2005/2/13: do NOT use htmlentities, since\r
- // it will produce named html entities, which are invalid xml\r
- $rs.="<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding). "</${typ}>";\r
- break;\r
- case $GLOBALS['xmlrpcInt']:\r
- case $GLOBALS['xmlrpcI4']:\r
- $rs.="<${typ}>".(int)$val."</${typ}>";\r
- break;\r
- case $GLOBALS['xmlrpcDouble']:\r
- $rs.="<${typ}>".(double)$val."</${typ}>";\r
- break;\r
- case $GLOBALS['xmlrpcNull']:\r
- $rs.="<nil/>";\r
- break;\r
- default:\r
- // no standard type value should arrive here, but provide a possibility\r
- // for xmlrpcvals of unknown type...\r
- $rs.="<${typ}>${val}</${typ}>";\r
- }\r
- break;\r
- case 3:\r
- // struct\r
- if ($this->_php_class)\r
- {\r
- $rs.='<struct php_class="' . $this->_php_class . "\">\n";\r
- }\r
- else\r
- {\r
- $rs.="<struct>\n";\r
- }\r
- foreach($val as $key2 => $val2)\r
- {\r
- $rs.='<member><name>'.xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding)."</name>\n";\r
- //$rs.=$this->serializeval($val2);\r
- $rs.=$val2->serialize($charset_encoding);\r
- $rs.="</member>\n";\r
- }\r
- $rs.='</struct>';\r
- break;\r
- case 2:\r
- // array\r
- $rs.="<array>\n<data>\n";\r
- for($i=0; $i<count($val); $i++)\r
- {\r
- //$rs.=$this->serializeval($val[$i]);\r
- $rs.=$val[$i]->serialize($charset_encoding);\r
- }\r
- $rs.="</data>\n</array>";\r
- break;\r
- default:\r
- break;\r
- }\r
- return $rs;\r
- }\r
-\r
- /**\r
- * Returns xml representation of the value. XML prologue not included\r
- * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed\r
- * @return string\r
- * @access public\r
- */\r
- function serialize($charset_encoding='')\r
- {\r
- // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...\r
- //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))\r
- //{\r
- reset($this->me);\r
- list($typ, $val) = each($this->me);\r
- return '<value>' . $this->serializedata($typ, $val, $charset_encoding) . "</value>\n";\r
- //}\r
- }\r
-\r
- // DEPRECATED\r
- function serializeval($o)\r
- {\r
- // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...\r
- //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))\r
- //{\r
- $ar=$o->me;\r
- reset($ar);\r
- list($typ, $val) = each($ar);\r
- return '<value>' . $this->serializedata($typ, $val) . "</value>\n";\r
- //}\r
- }\r
-\r
- /**\r
- * Checks wheter a struct member with a given name is present.\r
- * Works only on xmlrpcvals of type struct.\r
- * @param string $m the name of the struct member to be looked up\r
- * @return boolean\r
- * @access public\r
- */\r
- function structmemexists($m)\r
- {\r
- return array_key_exists($m, $this->me['struct']);\r
- }\r
-\r
- /**\r
- * Returns the value of a given struct member (an xmlrpcval object in itself).\r
- * Will raise a php warning if struct member of given name does not exist\r
- * @param string $m the name of the struct member to be looked up\r
- * @return xmlrpcval\r
- * @access public\r
- */\r
- function structmem($m)\r
- {\r
- return $this->me['struct'][$m];\r
- }\r
-\r
- /**\r
- * Reset internal pointer for xmlrpcvals of type struct.\r
- * @access public\r
- */\r
- function structreset()\r
- {\r
- reset($this->me['struct']);\r
- }\r
-\r
- /**\r
- * Return next member element for xmlrpcvals of type struct.\r
- * @return xmlrpcval\r
- * @access public\r
- */\r
- function structeach()\r
- {\r
- return each($this->me['struct']);\r
- }\r
-\r
- // DEPRECATED! this code looks like it is very fragile and has not been fixed\r
- // for a long long time. Shall we remove it for 2.0?\r
- function getval()\r
- {\r
- // UNSTABLE\r
- reset($this->me);\r
- list($a,$b)=each($this->me);\r
- // contributed by I Sofer, 2001-03-24\r
- // add support for nested arrays to scalarval\r
- // i've created a new method here, so as to\r
- // preserve back compatibility\r
-\r
- if(is_array($b))\r
- {\r
- @reset($b);\r
- while(list($id,$cont) = @each($b))\r
- {\r
- $b[$id] = $cont->scalarval();\r
- }\r
- }\r
-\r
- // add support for structures directly encoding php objects\r
- if(is_object($b))\r
- {\r
- $t = get_object_vars($b);\r
- @reset($t);\r
- while(list($id,$cont) = @each($t))\r
- {\r
- $t[$id] = $cont->scalarval();\r
- }\r
- @reset($t);\r
- while(list($id,$cont) = @each($t))\r
- {\r
- @$b->$id = $cont;\r
- }\r
- }\r
- // end contrib\r
- return $b;\r
- }\r
-\r
- /**\r
- * Returns the value of a scalar xmlrpcval\r
- * @return mixed\r
- * @access public\r
- */\r
- function scalarval()\r
- {\r
- reset($this->me);\r
- list(,$b)=each($this->me);\r
- return $b;\r
- }\r
-\r
- /**\r
- * Returns the type of the xmlrpcval.\r
- * For integers, 'int' is always returned in place of 'i4'\r
- * @return string\r
- * @access public\r
- */\r
- function scalartyp()\r
- {\r
- reset($this->me);\r
- list($a,)=each($this->me);\r
- if($a==$GLOBALS['xmlrpcI4'])\r
- {\r
- $a=$GLOBALS['xmlrpcInt'];\r
- }\r
- return $a;\r
- }\r
-\r
- /**\r
- * Returns the m-th member of an xmlrpcval of struct type\r
- * @param integer $m the index of the value to be retrieved (zero based)\r
- * @return xmlrpcval\r
- * @access public\r
- */\r
- function arraymem($m)\r
- {\r
- return $this->me['array'][$m];\r
- }\r
-\r
- /**\r
- * Returns the number of members in an xmlrpcval of array type\r
- * @return integer\r
- * @access public\r
- */\r
- function arraysize()\r
- {\r
- return count($this->me['array']);\r
- }\r
-\r
- /**\r
- * Returns the number of members in an xmlrpcval of struct type\r
- * @return integer\r
- * @access public\r
- */\r
- function structsize()\r
- {\r
- return count($this->me['struct']);\r
- }\r
- }\r
-\r
-\r
- // date helpers\r
-\r
- /**\r
- * Given a timestamp, return the corresponding ISO8601 encoded string.\r
- *\r
- * Really, timezones ought to be supported\r
- * but the XML-RPC spec says:\r
- *\r
- * "Don't assume a timezone. It should be specified by the server in its\r
- * documentation what assumptions it makes about timezones."\r
- *\r
- * These routines always assume localtime unless\r
- * $utc is set to 1, in which case UTC is assumed\r
- * and an adjustment for locale is made when encoding\r
- *\r
- * @param int $timet (timestamp)\r
- * @param int $utc (0 or 1)\r
- * @return string\r
- */\r
- function iso8601_encode($timet, $utc=0)\r
- {\r
- if(!$utc)\r
- {\r
- $t=i18n::formatted_datetime('iso8601UTC', $timet);\r
- }\r
- else\r
- {\r
- $t=i18n::formatted_datetime('iso8601UTC', $timet-date('Z'));\r
- }\r
- return $t;\r
- }\r
-\r
- /**\r
- * Given an ISO8601 date string, return a timet in the localtime, or UTC\r
- * @param string $idate\r
- * @param int $utc either 0 or 1\r
- * @return int (datetime)\r
- */\r
- function iso8601_decode($idate, $utc=0)\r
- {\r
- $t=0;\r
- if(preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $idate, $regs))\r
- {\r
- if($utc)\r
- {\r
- $t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);\r
- }\r
- else\r
- {\r
- $t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);\r
- }\r
- }\r
- return $t;\r
- }\r
-\r
- /**\r
- * Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types.\r
- *\r
- * Works with xmlrpc message objects as input, too.\r
- *\r
- * Given proper options parameter, can rebuild generic php object instances\r
- * (provided those have been encoded to xmlrpc format using a corresponding\r
- * option in php_xmlrpc_encode())\r
- * PLEASE NOTE that rebuilding php objects involves calling their constructor function.\r
- * This means that the remote communication end can decide which php code will\r
- * get executed on your server, leaving the door possibly open to 'php-injection'\r
- * style of attacks (provided you have some classes defined on your server that\r
- * might wreak havoc if instances are built outside an appropriate context).\r
- * Make sure you trust the remote server/client before eanbling this!\r
- *\r
- * @author Dan Libby (dan@libby.com)\r
- *\r
- * @param xmlrpcval $xmlrpc_val\r
- * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects\r
- * @return mixed\r
- */\r
- function php_xmlrpc_decode($xmlrpc_val, $options=array())\r
- {\r
- switch($xmlrpc_val->kindOf())\r
- {\r
- case 'scalar':\r
- if (in_array('extension_api', $options))\r
- {\r
- reset($xmlrpc_val->me);\r
- list($typ,$val) = each($xmlrpc_val->me);\r
- switch ($typ)\r
- {\r
- case 'dateTime.iso8601':\r
- $xmlrpc_val->scalar = $val;\r
- $xmlrpc_val->xmlrpc_type = 'datetime';\r
- $xmlrpc_val->timestamp = iso8601_decode($val);\r
- return $xmlrpc_val;\r
- case 'base64':\r
- $xmlrpc_val->scalar = $val;\r
- $xmlrpc_val->type = $typ;\r
- return $xmlrpc_val;\r
- default:\r
- return $xmlrpc_val->scalarval();\r
- }\r
- }\r
- return $xmlrpc_val->scalarval();\r
- case 'array':\r
- $size = $xmlrpc_val->arraysize();\r
- $arr = array();\r
- for($i = 0; $i < $size; $i++)\r
- {\r
- $arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);\r
- }\r
- return $arr;\r
- case 'struct':\r
- $xmlrpc_val->structreset();\r
- // If user said so, try to rebuild php objects for specific struct vals.\r
- /// @todo should we raise a warning for class not found?\r
- // shall we check for proper subclass of xmlrpcval instead of\r
- // presence of _php_class to detect what we can do?\r
- if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != ''\r
- && class_exists($xmlrpc_val->_php_class))\r
- {\r
- $obj = @new $xmlrpc_val->_php_class;\r
- while(list($key,$value)=$xmlrpc_val->structeach())\r
- {\r
- $obj->$key = php_xmlrpc_decode($value, $options);\r
- }\r
- return $obj;\r
- }\r
- else\r
- {\r
- $arr = array();\r
- while(list($key,$value)=$xmlrpc_val->structeach())\r
- {\r
- $arr[$key] = php_xmlrpc_decode($value, $options);\r
- }\r
- return $arr;\r
- }\r
- case 'msg':\r
- $paramcount = $xmlrpc_val->getNumParams();\r
- $arr = array();\r
- for($i = 0; $i < $paramcount; $i++)\r
- {\r
- $arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i));\r
- }\r
- return $arr;\r
- }\r
- }\r
-\r
- // This constant left here only for historical reasons...\r
- // it was used to decide if we have to define xmlrpc_encode on our own, but\r
- // we do not do it anymore\r
- if(function_exists('xmlrpc_decode'))\r
- {\r
- define('XMLRPC_EPI_ENABLED','1');\r
- }\r
- else\r
- {\r
- define('XMLRPC_EPI_ENABLED','0');\r
- }\r
-\r
- /**\r
- * Takes native php types and encodes them into xmlrpc PHP object format.\r
- * It will not re-encode xmlrpcval objects.\r
- *\r
- * Feature creep -- could support more types via optional type argument\r
- * (string => datetime support has been added, ??? => base64 not yet)\r
- *\r
- * If given a proper options parameter, php object instances will be encoded\r
- * into 'special' xmlrpc values, that can later be decoded into php objects\r
- * by calling php_xmlrpc_decode() with a corresponding option\r
- *\r
- * @author Dan Libby (dan@libby.com)\r
- *\r
- * @param mixed $php_val the value to be converted into an xmlrpcval object\r
- * @param array $options can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'\r
- * @return xmlrpcval\r
- */\r
- function &php_xmlrpc_encode($php_val, $options=array())\r
- {\r
- $type = gettype($php_val);\r
- switch($type)\r
- {\r
- case 'string':\r
- if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val))\r
- $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']);\r
- else\r
- $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcString']);\r
- break;\r
- case 'integer':\r
- $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcInt']);\r
- break;\r
- case 'double':\r
- $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDouble']);\r
- break;\r
- // <G_Giunta_2001-02-29>\r
- // Add support for encoding/decoding of booleans, since they are supported in PHP\r
- case 'boolean':\r
- $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcBoolean']);\r
- break;\r
- // </G_Giunta_2001-02-29>\r
- case 'array':\r
- // PHP arrays can be encoded to either xmlrpc structs or arrays,\r
- // depending on wheter they are hashes or plain 0..n integer indexed\r
- // A shorter one-liner would be\r
- // $tmp = array_diff(array_keys($php_val), range(0, count($php_val)-1));\r
- // but execution time skyrockets!\r
- $j = 0;\r
- $arr = array();\r
- $ko = false;\r
- foreach($php_val as $key => $val)\r
- {\r
- $arr[$key] =& php_xmlrpc_encode($val, $options);\r
- if(!$ko && $key !== $j)\r
- {\r
- $ko = true;\r
- }\r
- $j++;\r
- }\r
- if($ko)\r
- {\r
- $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);\r
- }\r
- else\r
- {\r
- $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcArray']);\r
- }\r
- break;\r
- case 'object':\r
- if(is_a($php_val, 'xmlrpcval'))\r
- {\r
- $xmlrpc_val = $php_val;\r
- }\r
- else\r
- {\r
- $arr = array();\r
- while(list($k,$v) = each($php_val))\r
- {\r
- $arr[$k] = php_xmlrpc_encode($v, $options);\r
- }\r
- $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);\r
- if (in_array('encode_php_objs', $options))\r
- {\r
- // let's save original class name into xmlrpcval:\r
- // might be useful later on...\r
- $xmlrpc_val->_php_class = get_class($php_val);\r
- }\r
- }\r
- break;\r
- case 'NULL':\r
- if (in_array('extension_api', $options))\r
- {\r
- $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']);\r
- }\r
- if (in_array('null_extension', $options))\r
- {\r
- $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']);\r
- }\r
- else\r
- {\r
- $xmlrpc_val = new xmlrpcval();\r
- }\r
- break;\r
- case 'resource':\r
- if (in_array('extension_api', $options))\r
- {\r
- $xmlrpc_val = new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);\r
- }\r
- else\r
- {\r
- $xmlrpc_val = new xmlrpcval();\r
- }\r
- // catch "user function", "unknown type"\r
- default:\r
- // giancarlo pinerolo <ping@alt.it>\r
- // it has to return\r
- // an empty object in case, not a boolean.\r
- $xmlrpc_val = new xmlrpcval();\r
- break;\r
- }\r
- return $xmlrpc_val;\r
- }\r
-\r
- /**\r
- * Convert the xml representation of a method response, method request or single\r
- * xmlrpc value into the appropriate object (a.k.a. deserialize)\r
- * @param string $xml_val\r
- * @param array $options\r
- * @return mixed false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp\r
- */\r
- function php_xmlrpc_decode_xml($xml_val, $options=array())\r
- {\r
- $GLOBALS['_xh'] = array();\r
- $GLOBALS['_xh']['ac'] = '';\r
- $GLOBALS['_xh']['stack'] = array();\r
- $GLOBALS['_xh']['valuestack'] = array();\r
- $GLOBALS['_xh']['params'] = array();\r
- $GLOBALS['_xh']['pt'] = array();\r
- $GLOBALS['_xh']['isf'] = 0;\r
- $GLOBALS['_xh']['isf_reason'] = '';\r
- $GLOBALS['_xh']['method'] = false;\r
- $GLOBALS['_xh']['rt'] = '';\r
- /// @todo 'guestimate' encoding\r
- $parser = xml_parser_create();\r
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);\r
- xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);\r
- xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee');\r
- xml_set_character_data_handler($parser, 'xmlrpc_cd');\r
- xml_set_default_handler($parser, 'xmlrpc_dh');\r
- if(!xml_parse($parser, $xml_val, 1))\r
- {\r
- $errstr = sprintf('XML error: %s at line %d, column %d',\r
- xml_error_string(xml_get_error_code($parser)),\r
- xml_get_current_line_number($parser), xml_get_current_column_number($parser));\r
- error_log($errstr);\r
- xml_parser_free($parser);\r
- return false;\r
- }\r
- xml_parser_free($parser);\r
- if ($GLOBALS['_xh']['isf'] > 1) // test that $GLOBALS['_xh']['value'] is an obj, too???\r
- {\r
- error_log($GLOBALS['_xh']['isf_reason']);\r
- return false;\r
- }\r
- switch ($GLOBALS['_xh']['rt'])\r
- {\r
- case 'methodresponse':\r
- $v =& $GLOBALS['_xh']['value'];\r
- if ($GLOBALS['_xh']['isf'] == 1)\r
- {\r
- $vc = $v->structmem('faultCode');\r
- $vs = $v->structmem('faultString');\r
- $r = new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval());\r
- }\r
- else\r
- {\r
- $r = new xmlrpcresp($v);\r
- }\r
- return $r;\r
- case 'methodcall':\r
- $m = new xmlrpcmsg($GLOBALS['_xh']['method']);\r
- for($i=0; $i < count($GLOBALS['_xh']['params']); $i++)\r
- {\r
- $m->addParam($GLOBALS['_xh']['params'][$i]);\r
- }\r
- return $m;\r
- case 'value':\r
- return $GLOBALS['_xh']['value'];\r
- default:\r
- return false;\r
- }\r
- }\r
-\r
- /**\r
- * decode a string that is encoded w/ "chunked" transfer encoding\r
- * as defined in rfc2068 par. 19.4.6\r
- * code shamelessly stolen from nusoap library by Dietrich Ayala\r
- *\r
- * @param string $buffer the string to be decoded\r
- * @return string\r
- */\r
- function decode_chunked($buffer)\r
- {\r
- // length := 0\r
- $length = 0;\r
- $new = '';\r
-\r
- // read chunk-size, chunk-extension (if any) and crlf\r
- // get the position of the linebreak\r
- $chunkend = i18n::strpos($buffer,"\r\n") + 2;\r
- $temp = i18n::substr($buffer,0,$chunkend);\r
- $chunk_size = hexdec( trim($temp) );\r
- $chunkstart = $chunkend;\r
- while($chunk_size > 0)\r
- {\r
- $chunkend = i18n::strpos($buffer, "\r\n", $chunkstart + $chunk_size);\r
-\r
- // just in case we got a broken connection\r
- if($chunkend == false)\r
- {\r
- $chunk = i18n::substr($buffer,$chunkstart);\r
- // append chunk-data to entity-body\r
- $new .= $chunk;\r
- $length += i18n::strlen($chunk);\r
- break;\r
- }\r
-\r
- // read chunk-data and crlf\r
- $chunk = i18n::substr($buffer,$chunkstart,$chunkend-$chunkstart);\r
- // append chunk-data to entity-body\r
- $new .= $chunk;\r
- // length := length + chunk-size\r
- $length += i18n::strlen($chunk);\r
- // read chunk-size and crlf\r
- $chunkstart = $chunkend + 2;\r
-\r
- $chunkend = i18n::strpos($buffer,"\r\n",$chunkstart)+2;\r
- if($chunkend == false)\r
- {\r
- break; //just in case we got a broken connection\r
- }\r
- $temp = i18n::substr($buffer,$chunkstart,$chunkend-$chunkstart);\r
- $chunk_size = hexdec( trim($temp) );\r
- $chunkstart = $chunkend;\r
- }\r
- return $new;\r
- }\r
-\r
- /**\r
- * xml charset encoding guessing helper function.\r
- * Tries to determine the charset encoding of an XML chunk\r
- * received over HTTP.\r
- * NB: according to the spec (RFC 3023, if text/xml content-type is received over HTTP without a content-type,\r
- * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,\r
- * which will be most probably using UTF-8 anyway...\r
- *\r
- * @param string $httpheaders the http Content-type header\r
- * @param string $xmlchunk xml content buffer\r
- * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)\r
- *\r
- * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!\r
- */\r
- function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null)\r
- {\r
- // discussion: see http://www.yale.edu/pclt/encoding/\r
- // 1 - test if encoding is specified in HTTP HEADERS\r
-\r
- //Details:\r
- // LWS: (\13\10)?( |\t)+\r
- // token: (any char but excluded stuff)+\r
- // header: Content-type = ...; charset=value(; ...)*\r
- // where value is of type token, no LWS allowed between 'charset' and value\r
- // Note: we do not check for invalid chars in VALUE:\r
- // this had better be done using pure ereg as below\r
-\r
- /// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it?\r
- $matches = array();\r
- if(preg_match('/;\s*charset=([^;]+)/i', $httpheader, $matches))\r
- {\r
- return strtoupper(trim($matches[1]));\r
- }\r
-\r
- // 2 - scan the first bytes of the data for a UTF-16 (or other) BOM pattern\r
- // (source: http://www.w3.org/TR/2000/REC-xml-20001006)\r
- // NOTE: actually, according to the spec, even if we find the BOM and determine\r
- // an encoding, we should check if there is an encoding specified\r
- // in the xml declaration, and verify if they match.\r
- /// @todo implement check as described above?\r
- /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM)\r
- if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk))\r
- {\r
- return 'UCS-4';\r
- }\r
- elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk))\r
- {\r
- return 'UTF-16';\r
- }\r
- elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))\r
- {\r
- return 'UTF-8';\r
- }\r
-\r
- // 3 - test if encoding is specified in the xml declaration\r
- // Details:\r
- // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+\r
- // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*\r
- if (preg_match('/^<\?xml\s+version\s*=\s*'. "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".\r
- '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",\r
- $xmlchunk, $matches))\r
- {\r
- return strtoupper(i18n::substr($matches[2], 1, -1));\r
- }\r
-\r
- // 4 - if mbstring is available, let it do the guesswork\r
- // NB: we favour finding an encoding that is compatible with what we can process\r
- if(extension_loaded('mbstring'))\r
- {\r
- if($encoding_prefs)\r
- {\r
- $enc = mb_detect_encoding($xmlchunk, $encoding_prefs);\r
- }\r
- else\r
- {\r
- $enc = mb_detect_encoding($xmlchunk);\r
- }\r
- // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...\r
- // IANA also likes better US-ASCII, so go with it\r
- if($enc == 'ASCII')\r
- {\r
- $enc = 'US-'.$enc;\r
- }\r
- return $enc;\r
- }\r
- else\r
- {\r
- // no encoding specified: as per HTTP1.1 assume it is iso-8859-1?\r
- // Both RFC 2616 (HTTP 1.1) and 1945(http 1.0) clearly state that for text/xxx content types\r
- // this should be the standard. And we should be getting text/xml as request and response.\r
- // BUT we have to be backward compatible with the lib, which always used UTF-8 as default...\r
- return $GLOBALS['xmlrpc_defencoding'];\r
- }\r
- }\r
-\r
- /**\r
- * Checks if a given charset encoding is present in a list of encodings or\r
- * if it is a valid subset of any encoding in the list\r
- * @param string $encoding charset to be tested\r
- * @param mixed $validlist comma separated list of valid charsets (or array of charsets)\r
- */\r
- function is_valid_charset($encoding, $validlist)\r
- {\r
- $charset_supersets = array(\r
- 'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',\r
- 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8',\r
- 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12',\r
- 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',\r
- 'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN')\r
- );\r
- if (is_string($validlist))\r
- $validlist = preg_split('#,#', $validlist);\r
- if (@in_array(strtoupper($encoding), $validlist))\r
- return true;\r
- else\r
- {\r
- if (array_key_exists($encoding, $charset_supersets))\r
- foreach ($validlist as $allowed)\r
- if (in_array($allowed, $charset_supersets[$encoding]))\r
- return true;\r
- return false;\r
- }\r
- }\r
-\r
-?>\r
+<?php
+// by Edd Dumbill (C) 1999-2002
+// <edd@usefulinc.com>
+// $Original: xmlrpc.inc,v 1.158 2007/03/01 21:21:02 ggiunta Exp $
+// $Id: xmlrpc.inc.php 1737 2012-04-10 14:32:11Z sakamocchi $
+
+
+// Copyright (c) 1999,2000,2002 Edd Dumbill.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+//
+// * Neither the name of the "XML-RPC for PHP" nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+// OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ if(!function_exists('xml_parser_create'))
+ {
+ // For PHP 4 onward, XML functionality is always compiled-in on windows:
+ // no more need to dl-open it. It might have been compiled out on *nix...
+ //if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN'))
+ $phpver = phpversion();
+ if (!extension_loaded('xml') && version_compare($phpver,'5.3.0','<'))
+ {
+ dl('xml.so');
+ }
+ }
+
+ // Try to be backward compat with php < 4.2 (are we not being nice ?)
+ $phpversion = phpversion();
+ if($phpversion[0] == '4' && $phpversion[2] < 2)
+ {
+ // give an opportunity to user to specify where to include other files from
+ if(!defined('PHP_XMLRPC_COMPAT_DIR'))
+ {
+ define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/');
+ }
+ if($phpversion[2] == '0')
+ {
+ if($phpversion[4] < 6)
+ {
+ include(PHP_XMLRPC_COMPAT_DIR.'is_callable.php');
+ }
+ include(PHP_XMLRPC_COMPAT_DIR.'is_scalar.php');
+ include(PHP_XMLRPC_COMPAT_DIR.'array_key_exists.php');
+ include(PHP_XMLRPC_COMPAT_DIR.'version_compare.php');
+ }
+ include(PHP_XMLRPC_COMPAT_DIR.'var_export.php');
+ include(PHP_XMLRPC_COMPAT_DIR.'is_a.php');
+ }
+
+ // G. Giunta 2005/01/29: declare global these variables,
+ // so that xmlrpc.inc will work even if included from within a function
+ // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.
+ $GLOBALS['xmlrpcI4']='i4';
+ $GLOBALS['xmlrpcInt']='int';
+ $GLOBALS['xmlrpcBoolean']='boolean';
+ $GLOBALS['xmlrpcDouble']='double';
+ $GLOBALS['xmlrpcString']='string';
+ $GLOBALS['xmlrpcDateTime']='dateTime.iso8601';
+ $GLOBALS['xmlrpcBase64']='base64';
+ $GLOBALS['xmlrpcArray']='array';
+ $GLOBALS['xmlrpcStruct']='struct';
+ $GLOBALS['xmlrpcValue']='undefined';
+
+ $GLOBALS['xmlrpcTypes']=array(
+ $GLOBALS['xmlrpcI4'] => 1,
+ $GLOBALS['xmlrpcInt'] => 1,
+ $GLOBALS['xmlrpcBoolean'] => 1,
+ $GLOBALS['xmlrpcString'] => 1,
+ $GLOBALS['xmlrpcDouble'] => 1,
+ $GLOBALS['xmlrpcDateTime'] => 1,
+ $GLOBALS['xmlrpcBase64'] => 1,
+ $GLOBALS['xmlrpcArray'] => 2,
+ $GLOBALS['xmlrpcStruct'] => 3
+ );
+
+ $GLOBALS['xmlrpc_valid_parents'] = array(
+ 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'),
+ 'BOOLEAN' => array('VALUE'),
+ 'I4' => array('VALUE'),
+ 'INT' => array('VALUE'),
+ 'STRING' => array('VALUE'),
+ 'DOUBLE' => array('VALUE'),
+ 'DATETIME.ISO8601' => array('VALUE'),
+ 'BASE64' => array('VALUE'),
+ 'MEMBER' => array('STRUCT'),
+ 'NAME' => array('MEMBER'),
+ 'DATA' => array('ARRAY'),
+ 'ARRAY' => array('VALUE'),
+ 'STRUCT' => array('VALUE'),
+ 'PARAM' => array('PARAMS'),
+ 'METHODNAME' => array('METHODCALL'),
+ 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
+ 'FAULT' => array('METHODRESPONSE'),
+ 'NIL' => array('VALUE') // only used when extension activated
+ );
+
+ // define extra types for supporting NULL (useful for json or <NIL/>)
+ $GLOBALS['xmlrpcNull']='null';
+ $GLOBALS['xmlrpcTypes']['null']=1;
+
+ // Not in use anymore since 2.0. Shall we remove it?
+ /// @deprecated
+ $GLOBALS['xmlEntities']=array(
+ 'amp' => '&',
+ 'quot' => '"',
+ 'lt' => '<',
+ 'gt' => '>',
+ 'apos' => "'"
+ );
+
+ // tables used for transcoding different charsets into us-ascii xml
+
+ $GLOBALS['xml_iso88591_Entities']=array();
+ $GLOBALS['xml_iso88591_Entities']['in'] = array();
+ $GLOBALS['xml_iso88591_Entities']['out'] = array();
+ for ($i = 0; $i < 32; $i++)
+ {
+ $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
+ $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
+ }
+ for ($i = 160; $i < 256; $i++)
+ {
+ $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
+ $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
+ }
+
+ /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159.
+ /// These will NOT be present in true ISO-8859-1, but will save the unwary
+ /// windows user from sending junk.
+/*
+$cp1252_to_xmlent =
+ array(
+ '\x80'=>'€', '\x81'=>'?', '\x82'=>'‚', '\x83'=>'ƒ',
+ '\x84'=>'„', '\x85'=>'…', '\x86'=>'†', \x87'=>'‡',
+ '\x88'=>'ˆ', '\x89'=>'‰', '\x8A'=>'Š', '\x8B'=>'‹',
+ '\x8C'=>'Œ', '\x8D'=>'?', '\x8E'=>'Ž', '\x8F'=>'?',
+ '\x90'=>'?', '\x91'=>'‘', '\x92'=>'’', '\x93'=>'“',
+ '\x94'=>'”', '\x95'=>'•', '\x96'=>'–', '\x97'=>'—',
+ '\x98'=>'˜', '\x99'=>'™', '\x9A'=>'š', '\x9B'=>'›',
+ '\x9C'=>'œ', '\x9D'=>'?', '\x9E'=>'ž', '\x9F'=>'Ÿ'
+ );
+*/
+
+ $GLOBALS['xmlrpcerr']['unknown_method']=1;
+ $GLOBALS['xmlrpcstr']['unknown_method']='Unknown method';
+ $GLOBALS['xmlrpcerr']['invalid_return']=2;
+ $GLOBALS['xmlrpcstr']['invalid_return']='Invalid return payload: enable debugging to examine incoming payload';
+ $GLOBALS['xmlrpcerr']['incorrect_params']=3;
+ $GLOBALS['xmlrpcstr']['incorrect_params']='Incorrect parameters passed to method';
+ $GLOBALS['xmlrpcerr']['introspect_unknown']=4;
+ $GLOBALS['xmlrpcstr']['introspect_unknown']="Can't introspect: method unknown";
+ $GLOBALS['xmlrpcerr']['http_error']=5;
+ $GLOBALS['xmlrpcstr']['http_error']="Didn't receive 200 OK from remote server.";
+ $GLOBALS['xmlrpcerr']['no_data']=6;
+ $GLOBALS['xmlrpcstr']['no_data']='No data received from server.';
+ $GLOBALS['xmlrpcerr']['no_ssl']=7;
+ $GLOBALS['xmlrpcstr']['no_ssl']='No SSL support compiled in.';
+ $GLOBALS['xmlrpcerr']['curl_fail']=8;
+ $GLOBALS['xmlrpcstr']['curl_fail']='CURL error';
+ $GLOBALS['xmlrpcerr']['invalid_request']=15;
+ $GLOBALS['xmlrpcstr']['invalid_request']='Invalid request payload';
+ $GLOBALS['xmlrpcerr']['no_curl']=16;
+ $GLOBALS['xmlrpcstr']['no_curl']='No CURL support compiled in.';
+ $GLOBALS['xmlrpcerr']['server_error']=17;
+ $GLOBALS['xmlrpcstr']['server_error']='Internal server error';
+ $GLOBALS['xmlrpcerr']['multicall_error']=18;
+ $GLOBALS['xmlrpcstr']['multicall_error']='Received from server invalid multicall response';
+
+ $GLOBALS['xmlrpcerr']['multicall_notstruct'] = 9;
+ $GLOBALS['xmlrpcstr']['multicall_notstruct'] = 'system.multicall expected struct';
+ $GLOBALS['xmlrpcerr']['multicall_nomethod'] = 10;
+ $GLOBALS['xmlrpcstr']['multicall_nomethod'] = 'missing methodName';
+ $GLOBALS['xmlrpcerr']['multicall_notstring'] = 11;
+ $GLOBALS['xmlrpcstr']['multicall_notstring'] = 'methodName is not a string';
+ $GLOBALS['xmlrpcerr']['multicall_recursion'] = 12;
+ $GLOBALS['xmlrpcstr']['multicall_recursion'] = 'recursive system.multicall forbidden';
+ $GLOBALS['xmlrpcerr']['multicall_noparams'] = 13;
+ $GLOBALS['xmlrpcstr']['multicall_noparams'] = 'missing params';
+ $GLOBALS['xmlrpcerr']['multicall_notarray'] = 14;
+ $GLOBALS['xmlrpcstr']['multicall_notarray'] = 'params is not an array';
+
+ $GLOBALS['xmlrpcerr']['cannot_decompress']=103;
+ $GLOBALS['xmlrpcstr']['cannot_decompress']='Received from server compressed HTTP and cannot decompress';
+ $GLOBALS['xmlrpcerr']['decompress_fail']=104;
+ $GLOBALS['xmlrpcstr']['decompress_fail']='Received from server invalid compressed HTTP';
+ $GLOBALS['xmlrpcerr']['dechunk_fail']=105;
+ $GLOBALS['xmlrpcstr']['dechunk_fail']='Received from server invalid chunked HTTP';
+ $GLOBALS['xmlrpcerr']['server_cannot_decompress']=106;
+ $GLOBALS['xmlrpcstr']['server_cannot_decompress']='Received from client compressed HTTP request and cannot decompress';
+ $GLOBALS['xmlrpcerr']['server_decompress_fail']=107;
+ $GLOBALS['xmlrpcstr']['server_decompress_fail']='Received from client invalid compressed HTTP request';
+
+ // The charset encoding used by the server for received messages and
+ // by the client for received responses when received charset cannot be determined
+ // or is not supported
+ $GLOBALS['xmlrpc_defencoding']='UTF-8';
+
+ // The encoding used internally by PHP.
+ // String values received as xml will be converted to this, and php strings will be converted to xml
+ // as if having been coded with this
+ $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';
+
+ $GLOBALS['xmlrpcName']='XML-RPC for PHP';
+ $GLOBALS['xmlrpcVersion']='2.2';
+
+ // let user errors start at 800
+ $GLOBALS['xmlrpcerruser']=800;
+ // let XML parse errors start at 100
+ $GLOBALS['xmlrpcerrxml']=100;
+
+ // formulate backslashes for escaping regexp
+ // Not in use anymore since 2.0. Shall we remove it?
+ /// @deprecated
+ $GLOBALS['xmlrpc_backslash']=chr(92).chr(92);
+
+ // set to TRUE to enable correct decoding of <NIL/> values
+ $GLOBALS['xmlrpc_null_extension']=false;
+
+ // used to store state during parsing
+ // quick explanation of components:
+ // ac - used to accumulate values
+ // isf - used to indicate a parsing fault (2) or xmlrpcresp fault (1)
+ // isf_reason - used for storing xmlrpcresp fault string
+ // lv - used to indicate "looking for a value": implements
+ // the logic to allow values with no types to be strings
+ // params - used to store parameters in method calls
+ // method - used to store method name
+ // stack - array with genealogy of xml elements names:
+ // used to validate nesting of xmlrpc elements
+ $GLOBALS['_xh']=null;
+
+ /**
+ * Convert a string to the correct XML representation in a target charset
+ * To help correct communication of non-ascii chars inside strings, regardless
+ * of the charset used when sending requests, parsing them, sending responses
+ * and parsing responses, an option is to convert all non-ascii chars present in the message
+ * into their equivalent 'charset entity'. Charset entities enumerated this way
+ * are independent of the charset encoding used to transmit them, and all XML
+ * parsers are bound to understand them.
+ * Note that in the std case we are not sending a charset encoding mime type
+ * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.
+ *
+ * @todo do a bit of basic benchmarking (strtr vs. str_replace)
+ * @todo make usage of iconv() or recode_string() or mb_string() where available
+ */
+ function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='')
+ {
+ if ($src_encoding == '')
+ {
+ // lame, but we know no better...
+ $src_encoding = $GLOBALS['xmlrpc_internalencoding'];
+ }
+
+ switch(strtoupper($src_encoding.'_'.$dest_encoding))
+ {
+ case 'ISO-8859-1_':
+ case 'ISO-8859-1_US-ASCII':
+ $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data);
+ $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
+ break;
+ case 'ISO-8859-1_UTF-8':
+ $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data);
+ $escaped_data = utf8_encode($escaped_data);
+ break;
+ case 'ISO-8859-1_ISO-8859-1':
+ case 'US-ASCII_US-ASCII':
+ case 'US-ASCII_UTF-8':
+ case 'US-ASCII_':
+ case 'US-ASCII_ISO-8859-1':
+ case 'UTF-8_UTF-8':
+ $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data);
+ break;
+ case 'UTF-8_':
+ case 'UTF-8_US-ASCII':
+ case 'UTF-8_ISO-8859-1':
+ // NB: this will choke on invalid UTF-8, going most likely beyond EOF
+ $escaped_data = '';
+ // be kind to users creating string xmlrpcvals out of different php types
+ $data = (string) $data;
+ $ns = i18n::strlen ($data);
+ for ($nn = 0; $nn < $ns; $nn++)
+ {
+ $ch = $data[$nn];
+ $ii = ord($ch);
+ //1 7 0bbbbbbb (127)
+ if ($ii < 128)
+ {
+ /// @todo shall we replace this with a (supposedly) faster str_replace?
+ switch($ii){
+ case 34:
+ $escaped_data .= '"';
+ break;
+ case 38:
+ $escaped_data .= '&';
+ break;
+ case 39:
+ $escaped_data .= ''';
+ break;
+ case 60:
+ $escaped_data .= '<';
+ break;
+ case 62:
+ $escaped_data .= '>';
+ break;
+ default:
+ $escaped_data .= $ch;
+ } // switch
+ }
+ //2 11 110bbbbb 10bbbbbb (2047)
+ else if ($ii>>5 == 6)
+ {
+ $b1 = ($ii & 31);
+ $ii = ord($data[$nn+1]);
+ $b2 = ($ii & 63);
+ $ii = ($b1 * 64) + $b2;
+ $ent = sprintf ('&#%d;', $ii);
+ $escaped_data .= $ent;
+ $nn += 1;
+ }
+ //3 16 1110bbbb 10bbbbbb 10bbbbbb
+ else if ($ii>>4 == 14)
+ {
+ $b1 = ($ii & 31);
+ $ii = ord($data[$nn+1]);
+ $b2 = ($ii & 63);
+ $ii = ord($data[$nn+2]);
+ $b3 = ($ii & 63);
+ $ii = ((($b1 * 64) + $b2) * 64) + $b3;
+ $ent = sprintf ('&#%d;', $ii);
+ $escaped_data .= $ent;
+ $nn += 2;
+ }
+ //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+ else if ($ii>>3 == 30)
+ {
+ $b1 = ($ii & 31);
+ $ii = ord($data[$nn+1]);
+ $b2 = ($ii & 63);
+ $ii = ord($data[$nn+2]);
+ $b3 = ($ii & 63);
+ $ii = ord($data[$nn+3]);
+ $b4 = ($ii & 63);
+ $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
+ $ent = sprintf ('&#%d;', $ii);
+ $escaped_data .= $ent;
+ $nn += 3;
+ }
+ }
+ break;
+ default:
+ $escaped_data = '';
+ error_log("Converting from $src_encoding to $dest_encoding: not supported...");
+ }
+ return $escaped_data;
+ }
+
+ /// xml parser handler function for opening element tags
+ function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false)
+ {
+ // if invalid xmlrpc already detected, skip all processing
+ if ($GLOBALS['_xh']['isf'] < 2)
+ {
+ // check for correct element nesting
+ // top level element can only be of 2 types
+ /// @todo optimization creep: save this check into a bool variable, instead of using count() every time:
+ /// there is only a single top level element in xml anyway
+ if (count($GLOBALS['_xh']['stack']) == 0)
+ {
+ if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && (
+ $name != 'VALUE' && !$accept_single_vals))
+ {
+ $GLOBALS['_xh']['isf'] = 2;
+ $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';
+ return;
+ }
+ else
+ {
+ $GLOBALS['_xh']['rt'] = strtolower($name);
+ }
+ }
+ else
+ {
+ // not top level element: see if parent is OK
+ $parent = end($GLOBALS['_xh']['stack']);
+ if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name]))
+ {
+ $GLOBALS['_xh']['isf'] = 2;
+ $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent";
+ return;
+ }
+ }
+
+ switch($name)
+ {
+ // optimize for speed switch cases: most common cases first
+ case 'VALUE':
+ /// @todo we could check for 2 VALUE elements inside a MEMBER or PARAM element
+ $GLOBALS['_xh']['vt']='value'; // indicator: no value found yet
+ $GLOBALS['_xh']['ac']='';
+ $GLOBALS['_xh']['lv']=1;
+ $GLOBALS['_xh']['php_class']=null;
+ break;
+ case 'I4':
+ case 'INT':
+ case 'STRING':
+ case 'BOOLEAN':
+ case 'DOUBLE':
+ case 'DATETIME.ISO8601':
+ case 'BASE64':
+ if ($GLOBALS['_xh']['vt']!='value')
+ {
+ //two data elements inside a value: an error occurred!
+ $GLOBALS['_xh']['isf'] = 2;
+ $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
+ return;
+ }
+ $GLOBALS['_xh']['ac']=''; // reset the accumulator
+ break;
+ case 'STRUCT':
+ case 'ARRAY':
+ if ($GLOBALS['_xh']['vt']!='value')
+ {
+ //two data elements inside a value: an error occurred!
+ $GLOBALS['_xh']['isf'] = 2;
+ $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
+ return;
+ }
+ // create an empty array to hold child values, and push it onto appropriate stack
+ $cur_val = array();
+ $cur_val['values'] = array();
+ $cur_val['type'] = $name;
+ // check for out-of-band information to rebuild php objs
+ // and in case it is found, save it
+ if (@isset($attrs['PHP_CLASS']))
+ {
+ $cur_val['php_class'] = $attrs['PHP_CLASS'];
+ }
+ $GLOBALS['_xh']['valuestack'][] = $cur_val;
+ $GLOBALS['_xh']['vt']='data'; // be prepared for a data element next
+ break;
+ case 'DATA':
+ if ($GLOBALS['_xh']['vt']!='data')
+ {
+ //two data elements inside a value: an error occurred!
+ $GLOBALS['_xh']['isf'] = 2;
+ $GLOBALS['_xh']['isf_reason'] = "found two data elements inside an array element";
+ return;
+ }
+ case 'METHODCALL':
+ case 'METHODRESPONSE':
+ case 'PARAMS':
+ // valid elements that add little to processing
+ break;
+ case 'METHODNAME':
+ case 'NAME':
+ /// @todo we could check for 2 NAME elements inside a MEMBER element
+ $GLOBALS['_xh']['ac']='';
+ break;
+ case 'FAULT':
+ $GLOBALS['_xh']['isf']=1;
+ break;
+ case 'MEMBER':
+ $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on
+ //$GLOBALS['_xh']['ac']='';
+ // Drop trough intentionally
+ case 'PARAM':
+ // clear value type, so we can check later if no value has been passed for this param/member
+ $GLOBALS['_xh']['vt']=null;
+ break;
+ case 'NIL':
+ if ($GLOBALS['xmlrpc_null_extension'])
+ {
+ if ($GLOBALS['_xh']['vt']!='value')
+ {
+ //two data elements inside a value: an error occurred!
+ $GLOBALS['_xh']['isf'] = 2;
+ $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
+ return;
+ }
+ $GLOBALS['_xh']['ac']=''; // reset the accumulator
+ break;
+ }
+ // we do not support the <NIL/> extension, so
+ // drop through intentionally
+ default:
+ /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!!
+ $GLOBALS['_xh']['isf'] = 2;
+ $GLOBALS['_xh']['isf_reason'] = "found not-xmlrpc xml element $name";
+ break;
+ }
+
+ // Save current element name to stack, to validate nesting
+ $GLOBALS['_xh']['stack'][] = $name;
+
+ /// @todo optimization creep: move this inside the big switch() above
+ if($name!='VALUE')
+ {
+ $GLOBALS['_xh']['lv']=0;
+ }
+ }
+ }
+
+ /// Used in decoding xml chunks that might represent single xmlrpc values
+ function xmlrpc_se_any($parser, $name, $attrs)
+ {
+ xmlrpc_se($parser, $name, $attrs, true);
+ }
+
+ /// xml parser handler function for close element tags
+ function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
+ {
+ if ($GLOBALS['_xh']['isf'] < 2)
+ {
+ // push this element name from stack
+ // NB: if XML validates, correct opening/closing is guaranteed and
+ // we do not have to check for $name == $curr_elem.
+ // we also checked for proper nesting at start of elements...
+ $curr_elem = array_pop($GLOBALS['_xh']['stack']);
+
+ switch($name)
+ {
+ case 'VALUE':
+ // This if() detects if no scalar was inside <VALUE></VALUE>
+ if ($GLOBALS['_xh']['vt']=='value')
+ {
+ $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+ $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString'];
+ }
+
+ if ($rebuild_xmlrpcvals)
+ {
+ // build the xmlrpc val out of the data received, and substitute it
+ $temp = new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
+ // in case we got info about underlying php class, save it
+ // in the object we're rebuilding
+ if (isset($GLOBALS['_xh']['php_class']))
+ $temp->_php_class = $GLOBALS['_xh']['php_class'];
+ // check if we are inside an array or struct:
+ // if value just built is inside an array, let's move it into array on the stack
+ $vscount = count($GLOBALS['_xh']['valuestack']);
+ if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
+ {
+ $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;
+ }
+ else
+ {
+ $GLOBALS['_xh']['value'] = $temp;
+ }
+ }
+ else
+ {
+ /// @todo this needs to treat correctly php-serialized objects,
+ /// since std deserializing is done by php_xmlrpc_decode,
+ /// which we will not be calling...
+ if (isset($GLOBALS['_xh']['php_class']))
+ {
+ }
+
+ // check if we are inside an array or struct:
+ // if value just built is inside an array, let's move it into array on the stack
+ $vscount = count($GLOBALS['_xh']['valuestack']);
+ if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
+ {
+ $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value'];
+ }
+ }
+ break;
+ case 'BOOLEAN':
+ case 'I4':
+ case 'INT':
+ case 'STRING':
+ case 'DOUBLE':
+ case 'DATETIME.ISO8601':
+ case 'BASE64':
+ $GLOBALS['_xh']['vt']=strtolower($name);
+ /// @todo: optimization creep - remove the if/elseif cycle below
+ /// since the case() in which we are already did that
+ if ($name=='STRING')
+ {
+ $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+ }
+ elseif ($name=='DATETIME.ISO8601')
+ {
+ if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac']))
+ {
+ error_log('XML-RPC: invalid value received in DATETIME: '.$GLOBALS['_xh']['ac']);
+ }
+ $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];
+ $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+ }
+ elseif ($name=='BASE64')
+ {
+ /// @todo check for failure of base64 decoding / catch warnings
+ $GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);
+ }
+ elseif ($name=='BOOLEAN')
+ {
+ // special case here: we translate boolean 1 or 0 into PHP
+ // constants true or false.
+ // Strings 'true' and 'false' are accepted, even though the
+ // spec never mentions them (see eg. Blogger api docs)
+ // NB: this simple checks helps a lot sanitizing input, ie no
+ // security problems around here
+ if ($GLOBALS['_xh']['ac']=='1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0)
+ {
+ $GLOBALS['_xh']['value']=true;
+ }
+ else
+ {
+ // log if receiveing something strange, even though we set the value to false anyway
+ if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($_xh[$parser]['ac'], 'false') != 0)
+ error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
+ $GLOBALS['_xh']['value']=false;
+ }
+ }
+ elseif ($name=='DOUBLE')
+ {
+ // we have a DOUBLE
+ // we must check that only 0123456789-.<space> are characters here
+ if (!preg_match('/^[+-]?[eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac']))
+ {
+ /// @todo: find a better way of throwing an error
+ // than this!
+ error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);
+ $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
+ }
+ else
+ {
+ // it's ok, add it on
+ $GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];
+ }
+ }
+ else
+ {
+ // we have an I4/INT
+ // we must check that only 0123456789-<space> are characters here
+ if (!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac']))
+ {
+ /// @todo find a better way of throwing an error
+ // than this!
+ error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']);
+ $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
+ }
+ else
+ {
+ // it's ok, add it on
+ $GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];
+ }
+ }
+ //$GLOBALS['_xh']['ac']=''; // is this necessary?
+ $GLOBALS['_xh']['lv']=3; // indicate we've found a value
+ break;
+ case 'NAME':
+ $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac'];
+ break;
+ case 'MEMBER':
+ //$GLOBALS['_xh']['ac']=''; // is this necessary?
+ // add to array in the stack the last element built,
+ // unless no VALUE was found
+ if ($GLOBALS['_xh']['vt'])
+ {
+ $vscount = count($GLOBALS['_xh']['valuestack']);
+ $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value'];
+ } else
+ error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
+ break;
+ case 'DATA':
+ //$GLOBALS['_xh']['ac']=''; // is this necessary?
+ $GLOBALS['_xh']['vt']=null; // reset this to check for 2 data elements in a row - even if they're empty
+ break;
+ case 'STRUCT':
+ case 'ARRAY':
+ // fetch out of stack array of values, and promote it to current value
+ $curr_val = array_pop($GLOBALS['_xh']['valuestack']);
+ $GLOBALS['_xh']['value'] = $curr_val['values'];
+ $GLOBALS['_xh']['vt']=strtolower($name);
+ if (isset($curr_val['php_class']))
+ {
+ $GLOBALS['_xh']['php_class'] = $curr_val['php_class'];
+ }
+ break;
+ case 'PARAM':
+ // add to array of params the current value,
+ // unless no VALUE was found
+ if ($GLOBALS['_xh']['vt'])
+ {
+ $GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];
+ $GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];
+ }
+ else
+ error_log('XML-RPC: missing VALUE inside PARAM in received xml');
+ break;
+ case 'METHODNAME':
+ $GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']);
+ break;
+ case 'NIL':
+ if ($GLOBALS['xmlrpc_null_extension'])
+ {
+ $GLOBALS['_xh']['vt']='null';
+ $GLOBALS['_xh']['value']=null;
+ $GLOBALS['_xh']['lv']=3;
+ break;
+ }
+ // drop through intentionally if nil extension not enabled
+ case 'PARAMS':
+ case 'FAULT':
+ case 'METHODCALL':
+ case 'METHORESPONSE':
+ break;
+ default:
+ // End of INVALID ELEMENT!
+ // shall we add an assert here for unreachable code???
+ break;
+ }
+ }
+ }
+
+ /// Used in decoding xmlrpc requests/responses without rebuilding xmlrpc values
+ function xmlrpc_ee_fast($parser, $name)
+ {
+ xmlrpc_ee($parser, $name, false);
+ }
+
+ /// xml parser handler function for character data
+ function xmlrpc_cd($parser, $data)
+ {
+ // skip processing if xml fault already detected
+ if ($GLOBALS['_xh']['isf'] < 2)
+ {
+ // "lookforvalue==3" means that we've found an entire value
+ // and should discard any further character data
+ if($GLOBALS['_xh']['lv']!=3)
+ {
+ // G. Giunta 2006-08-23: useless change of 'lv' from 1 to 2
+ //if($GLOBALS['_xh']['lv']==1)
+ //{
+ // if we've found text and we're just in a <value> then
+ // say we've found a value
+ //$GLOBALS['_xh']['lv']=2;
+ //}
+ // we always initialize the accumulator before starting parsing, anyway...
+ //if(!@isset($GLOBALS['_xh']['ac']))
+ //{
+ // $GLOBALS['_xh']['ac'] = '';
+ //}
+ $GLOBALS['_xh']['ac'].=$data;
+ }
+ }
+ }
+
+ /// xml parser handler function for 'other stuff', ie. not char data or
+ /// element start/end tag. In fact it only gets called on unknown entities...
+ function xmlrpc_dh($parser, $data)
+ {
+ // skip processing if xml fault already detected
+ if ($GLOBALS['_xh']['isf'] < 2)
+ {
+ if(i18n::substr($data, 0, 1) == '&' && i18n::substr($data, -1, 1) == ';')
+ {
+ // G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2
+ //if($GLOBALS['_xh']['lv']==1)
+ //{
+ // $GLOBALS['_xh']['lv']=2;
+ //}
+ $GLOBALS['_xh']['ac'].=$data;
+ }
+ }
+ return true;
+ }
+
+ class xmlrpc_client
+ {
+ var $path;
+ var $server;
+ var $port=0;
+ var $method='http';
+ var $errno;
+ var $errstr;
+ var $debug=0;
+ var $username='';
+ var $password='';
+ var $authtype=1;
+ var $cert='';
+ var $certpass='';
+ var $cacert='';
+ var $cacertdir='';
+ var $key='';
+ var $keypass='';
+ var $verifypeer=true;
+ var $verifyhost=1;
+ var $no_multicall=false;
+ var $proxy='';
+ var $proxyport=0;
+ var $proxy_user='';
+ var $proxy_pass='';
+ var $proxy_authtype=1;
+ var $cookies=array();
+ /**
+ * List of http compression methods accepted by the client for responses.
+ * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
+ *
+ * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since
+ * in those cases it will be up to CURL to decide the compression methods
+ * it supports. You might check for the presence of 'zlib' in the output of
+ * curl_version() to determine wheter compression is supported or not
+ */
+ var $accepted_compression = array();
+ /**
+ * Name of compression scheme to be used for sending requests.
+ * Either null, gzip or deflate
+ */
+ var $request_compression = '';
+ /**
+ * CURL handle: used for keep-alive connections (PHP 4.3.8 up, see:
+ * http://curl.haxx.se/docs/faq.html#7.3)
+ */
+ var $xmlrpc_curl_handle = null;
+ /// Wheter to use persistent connections for http 1.1 and https
+ var $keepalive = false;
+ /// Charset encodings that can be decoded without problems by the client
+ var $accepted_charset_encodings = array();
+ /// Charset encoding to be used in serializing request. NULL = use ASCII
+ var $request_charset_encoding = '';
+ /**
+ * Decides the content of xmlrpcresp objects returned by calls to send()
+ * valid strings are 'xmlrpcvals', 'phpvals' or 'xml'
+ */
+ var $return_type = 'xmlrpcvals';
+
+ /**
+ * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
+ * @param string $server the server name / ip address
+ * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used
+ * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed
+ */
+ function xmlrpc_client($path, $server='', $port='', $method='')
+ {
+ // allow user to specify all params in $path
+ if($server == '' and $port == '' and $method == '')
+ {
+ $parts = parse_url($path);
+ $server = $parts['host'];
+ $path = $parts['path'];
+ if(isset($parts['query']))
+ {
+ $path .= '?'.$parts['query'];
+ }
+ if(isset($parts['fragment']))
+ {
+ $path .= '#'.$parts['fragment'];
+ }
+ if(isset($parts['port']))
+ {
+ $port = $parts['port'];
+ }
+ if(isset($parts['scheme']))
+ {
+ $method = $parts['scheme'];
+ }
+ if(isset($parts['user']))
+ {
+ $this->username = $parts['user'];
+ }
+ if(isset($parts['pass']))
+ {
+ $this->password = $parts['pass'];
+ }
+ }
+ if($path == '' || $path[0] != '/')
+ {
+ $this->path='/'.$path;
+ }
+ else
+ {
+ $this->path=$path;
+ }
+ $this->server=$server;
+ if($port != '')
+ {
+ $this->port=$port;
+ }
+ if($method != '')
+ {
+ $this->method=$method;
+ }
+
+ // if ZLIB is enabled, let the client by default accept compressed responses
+ if(function_exists('gzinflate') || (
+ function_exists('curl_init') && (($info = curl_version()) &&
+ ((is_string($info) && i18n::strpos($info, 'zlib') !== null) || isset($info['libz_version'])))
+ ))
+ {
+ $this->accepted_compression = array('gzip', 'deflate');
+ }
+
+ // keepalives: enabled by default ONLY for PHP >= 4.3.8
+ // (see http://curl.haxx.se/docs/faq.html#7.3)
+ if(version_compare(phpversion(), '4.3.8') >= 0)
+ {
+ $this->keepalive = true;
+ }
+
+ // by default the xml parser can support these 3 charset encodings
+ $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
+ }
+
+ /**
+ * Enables/disables the echoing to screen of the xmlrpc responses received
+ * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, before received response)
+ * @access public
+ */
+ function setDebug($in)
+ {
+ $this->debug=$in;
+ }
+
+ /**
+ * Add some http BASIC AUTH credentials, used by the client to authenticate
+ * @param string $u username
+ * @param string $p password
+ * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)
+ * @access public
+ */
+ function setCredentials($u, $p, $t=1)
+ {
+ $this->username=$u;
+ $this->password=$p;
+ $this->authtype=$t;
+ }
+
+ /**
+ * Add a client-side https certificate
+ * @param string $cert
+ * @param string $certpass
+ * @access public
+ */
+ function setCertificate($cert, $certpass)
+ {
+ $this->cert = $cert;
+ $this->certpass = $certpass;
+ }
+
+ /**
+ * Add a CA certificate to verify server with (see man page about
+ * CURLOPT_CAINFO for more details
+ * @param string $cacert certificate file name (or dir holding certificates)
+ * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false
+ * @access public
+ */
+ function setCaCertificate($cacert, $is_dir=false)
+ {
+ if ($is_dir)
+ {
+ $this->cacert = $cacert;
+ }
+ else
+ {
+ $this->cacertdir = $cacert;
+ }
+ }
+
+ /**
+ * Set attributes for SSL communication: private SSL key
+ * @param string $key The name of a file containing a private SSL key
+ * @param string $keypass The secret password needed to use the private SSL key
+ * @access public
+ * NB: does not work in older php/curl installs
+ * Thanks to Daniel Convissor
+ */
+ function setKey($key, $keypass)
+ {
+ $this->key = $key;
+ $this->keypass = $keypass;
+ }
+
+ /**
+ * Set attributes for SSL communication: verify server certificate
+ * @param bool $i enable/disable verification of peer certificate
+ * @access public
+ */
+ function setSSLVerifyPeer($i)
+ {
+ $this->verifypeer = $i;
+ }
+
+ /**
+ * Set attributes for SSL communication: verify match of server cert w. hostname
+ * @param int $i
+ * @access public
+ */
+ function setSSLVerifyHost($i)
+ {
+ $this->verifyhost = $i;
+ }
+
+ /**
+ * Set proxy info
+ * @param string $proxyhost
+ * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS
+ * @param string $proxyusername Leave blank if proxy has public access
+ * @param string $proxypassword Leave blank if proxy has public access
+ * @param int $proxyauthtype set to constant CURLAUTH_NTLM to use NTLM auth with proxy
+ * @access public
+ */
+ function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1)
+ {
+ $this->proxy = $proxyhost;
+ $this->proxyport = $proxyport;
+ $this->proxy_user = $proxyusername;
+ $this->proxy_pass = $proxypassword;
+ $this->proxy_authtype = $proxyauthtype;
+ }
+
+ /**
+ * Enables/disables reception of compressed xmlrpc responses.
+ * Note that enabling reception of compressed responses merely adds some standard
+ * http headers to xmlrpc requests. It is up to the xmlrpc server to return
+ * compressed responses when receiving such requests.
+ * @param string $compmethod either 'gzip', 'deflate', 'any' or ''
+ * @access public
+ */
+ function setAcceptedCompression($compmethod)
+ {
+ if ($compmethod == 'any')
+ $this->accepted_compression = array('gzip', 'deflate');
+ else
+ $this->accepted_compression = array($compmethod);
+ }
+
+ /**
+ * Enables/disables http compression of xmlrpc request.
+ * Take care when sending compressed requests: servers might not support them
+ * (and automatic fallback to uncompressed requests is not yet implemented)
+ * @param string $compmethod either 'gzip', 'deflate' or ''
+ * @access public
+ */
+ function setRequestCompression($compmethod)
+ {
+ $this->request_compression = $compmethod;
+ }
+
+ /**
+ * Adds a cookie to list of cookies that will be sent to server.
+ * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie:
+ * do not do it unless you know what you are doing
+ * @param string $name
+ * @param string $value
+ * @param string $path
+ * @param string $domain
+ * @param int $port
+ * @access public
+ *
+ * @todo check correctness of urlencoding cookie value (copied from php way of doing it...)
+ */
+ function setCookie($name, $value='', $path='', $domain='', $port=null)
+ {
+ $this->cookies[$name]['value'] = urlencode($value);
+ if ($path || $domain || $port)
+ {
+ $this->cookies[$name]['path'] = $path;
+ $this->cookies[$name]['domain'] = $domain;
+ $this->cookies[$name]['port'] = $port;
+ $this->cookies[$name]['version'] = 1;
+ }
+ else
+ {
+ $this->cookies[$name]['version'] = 0;
+ }
+ }
+
+ /**
+ * Send an xmlrpc request
+ * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request
+ * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply
+ * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used
+ * @return xmlrpcresp
+ * @access public
+ */
+ function& send($msg, $timeout=0, $method='')
+ {
+ // if user deos not specify http protocol, use native method of this client
+ // (i.e. method set during call to constructor)
+ if($method == '')
+ {
+ $method = $this->method;
+ }
+
+ if(is_array($msg))
+ {
+ // $msg is an array of xmlrpcmsg's
+ $r = $this->multicall($msg, $timeout, $method);
+ return $r;
+ }
+ elseif(is_string($msg))
+ {
+ $n = new xmlrpcmsg('');
+ $n->payload = $msg;
+ $msg = $n;
+ }
+
+ // where msg is an xmlrpcmsg
+ $msg->debug=$this->debug;
+
+ if($method == 'https')
+ {
+ $r =& $this->sendPayloadHTTPS(
+ $msg,
+ $this->server,
+ $this->port,
+ $timeout,
+ $this->username,
+ $this->password,
+ $this->authtype,
+ $this->cert,
+ $this->certpass,
+ $this->cacert,
+ $this->cacertdir,
+ $this->proxy,
+ $this->proxyport,
+ $this->proxy_user,
+ $this->proxy_pass,
+ $this->proxy_authtype,
+ $this->keepalive,
+ $this->key,
+ $this->keypass
+ );
+ }
+ elseif($method == 'http11')
+ {
+ $r =& $this->sendPayloadCURL(
+ $msg,
+ $this->server,
+ $this->port,
+ $timeout,
+ $this->username,
+ $this->password,
+ $this->authtype,
+ null,
+ null,
+ null,
+ null,
+ $this->proxy,
+ $this->proxyport,
+ $this->proxy_user,
+ $this->proxy_pass,
+ $this->proxy_authtype,
+ 'http',
+ $this->keepalive
+ );
+ }
+ else
+ {
+ $r =& $this->sendPayloadHTTP10(
+ $msg,
+ $this->server,
+ $this->port,
+ $timeout,
+ $this->username,
+ $this->password,
+ $this->authtype,
+ $this->proxy,
+ $this->proxyport,
+ $this->proxy_user,
+ $this->proxy_pass,
+ $this->proxy_authtype
+ );
+ }
+
+ return $r;
+ }
+
+ /**
+ * @access private
+ */
+ function &sendPayloadHTTP10($msg, $server, $port, $timeout=0,
+ $username='', $password='', $authtype=1, $proxyhost='',
+ $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1)
+ {
+ if($port==0)
+ {
+ $port=80;
+ }
+
+ // Only create the payload if it was not created previously
+ if(empty($msg->payload))
+ {
+ $msg->createPayload($this->request_charset_encoding);
+ }
+
+ $payload = $msg->payload;
+ // Deflate request body and set appropriate request headers
+ if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
+ {
+ if($this->request_compression == 'gzip')
+ {
+ $a = @gzencode($payload);
+ if($a)
+ {
+ $payload = $a;
+ $encoding_hdr = "Content-Encoding: gzip\r\n";
+ }
+ }
+ else
+ {
+ $a = @gzcompress($payload);
+ if($a)
+ {
+ $payload = $a;
+ $encoding_hdr = "Content-Encoding: deflate\r\n";
+ }
+ }
+ }
+ else
+ {
+ $encoding_hdr = '';
+ }
+
+ // thanks to Grant Rauscher <grant7@firstworld.net> for this
+ $credentials='';
+ if($username!='')
+ {
+ $credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
+ if ($authtype != 1)
+ {
+ error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth is supported with HTTP 1.0');
+ }
+ }
+
+ $accepted_encoding = '';
+ if(is_array($this->accepted_compression) && count($this->accepted_compression))
+ {
+ $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
+ }
+
+ $proxy_credentials = '';
+ if($proxyhost)
+ {
+ if($proxyport == 0)
+ {
+ $proxyport = 8080;
+ }
+ $connectserver = $proxyhost;
+ $connectport = $proxyport;
+ $uri = 'http://'.$server.':'.$port.$this->path;
+ if($proxyusername != '')
+ {
+ if ($proxyauthtype != 1)
+ {
+ error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth to proxy is supported with HTTP 1.0');
+ }
+ $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n";
+ }
+ }
+ else
+ {
+ $connectserver = $server;
+ $connectport = $port;
+ $uri = $this->path;
+ }
+
+ // Cookie generation, as per rfc2965 (version 1 cookies) or
+ // netscape's rules (version 0 cookies)
+ $cookieheader='';
+ foreach ($this->cookies as $name => $cookie)
+ {
+ if ($cookie['version'])
+ {
+ $cookieheader .= 'Cookie: $Version="' . $cookie['version'] . '"; ';
+ $cookieheader .= $name . '="' . $cookie['value'] . '";';
+ if ($cookie['path'])
+ $cookieheader .= ' $Path="' . $cookie['path'] . '";';
+ if ($cookie['domain'])
+ $cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
+ if ($cookie['port'])
+ $cookieheader .= ' $Port="' . $cookie['domain'] . '";';
+ $cookieheader = i18n::substr($cookieheader, 0, -1) . "\r\n";
+ }
+ else
+ {
+ $cookieheader .= 'Cookie: ' . $name . '=' . $cookie['value'] . "\r\n";
+ }
+ }
+
+ $op= 'POST ' . $uri. " HTTP/1.0\r\n" .
+ 'User-Agent: ' . $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion'] . "\r\n" .
+ 'Host: '. $server . ':' . $port . "\r\n" .
+ $credentials .
+ $proxy_credentials .
+ $accepted_encoding .
+ $encoding_hdr .
+ 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
+ $cookieheader .
+ 'Content-Type: ' . $msg->content_type . "\r\nContent-Length: " .
+ i18n::strlen($payload) . "\r\n\r\n" .
+ $payload;
+
+ if($this->debug > 1)
+ {
+ print "<PRE>\n---SENDING---\n" . Entity::hen($op) . "\n---END---\n</PRE>";
+ // let the client see this now in case http times out...
+ flush();
+ }
+
+ if($timeout>0)
+ {
+ $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);
+ }
+ else
+ {
+ $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr);
+ }
+ if($fp)
+ {
+ if($timeout>0 && function_exists('stream_set_timeout'))
+ {
+ stream_set_timeout($fp, $timeout);
+ }
+ }
+ else
+ {
+ $this->errstr='Connect error: '.$this->errstr;
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
+ return $r;
+ }
+
+ if(!fputs($fp, $op, i18n::strlen($op)))
+ {
+ $this->errstr='Write error';
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
+ return $r;
+ }
+ else
+ {
+ // reset errno and errstr on succesful socket connection
+ $this->errstr = '';
+ }
+ // G. Giunta 2005/10/24: close socket before parsing.
+ // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects)
+ $ipd='';
+ while($data=fread($fp, 32768))
+ {
+ // shall we check for $data === FALSE?
+ // as per the manual, it signals an error
+ $ipd.=$data;
+ }
+ fclose($fp);
+ $r =& $msg->parseResponse($ipd, false, $this->return_type);
+ return $r;
+
+ }
+
+ /**
+ * @access private
+ */
+ function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='',
+ $password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='',
+ $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1,
+ $keepalive=false, $key='', $keypass='')
+ {
+ $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username,
+ $password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport,
+ $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass);
+ return $r;
+ }
+
+ /**
+ * Contributed by Justin Miller <justin@voxel.net>
+ * Requires curl to be built into PHP
+ * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!
+ * @access private
+ */
+ function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='',
+ $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='',
+ $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https',
+ $keepalive=false, $key='', $keypass='')
+ {
+ if(!function_exists('curl_init'))
+ {
+ $this->errstr='CURL unavailable on this install';
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);
+ return $r;
+ }
+ if($method == 'https')
+ {
+ if(($info = curl_version()) &&
+ ((is_string($info) && i18n::strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version']))))
+ {
+ $this->errstr='SSL unavailable on this install';
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);
+ return $r;
+ }
+ }
+
+ if($port == 0)
+ {
+ if($method == 'http')
+ {
+ $port = 80;
+ }
+ else
+ {
+ $port = 443;
+ }
+ }
+
+ // Only create the payload if it was not created previously
+ if(empty($msg->payload))
+ {
+ $msg->createPayload($this->request_charset_encoding);
+ }
+
+ // Deflate request body and set appropriate request headers
+ $payload = $msg->payload;
+ if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
+ {
+ if($this->request_compression == 'gzip')
+ {
+ $a = @gzencode($payload);
+ if($a)
+ {
+ $payload = $a;
+ $encoding_hdr = 'Content-Encoding: gzip';
+ }
+ }
+ else
+ {
+ $a = @gzcompress($payload);
+ if($a)
+ {
+ $payload = $a;
+ $encoding_hdr = 'Content-Encoding: deflate';
+ }
+ }
+ }
+ else
+ {
+ $encoding_hdr = '';
+ }
+
+ if($this->debug > 1)
+ {
+ print "<PRE>\n---SENDING---\n" . Entity::hen($payload) . "\n---END---\n</PRE>";
+ // let the client see this now in case http times out...
+ flush();
+ }
+
+ if(!$keepalive || !$this->xmlrpc_curl_handle)
+ {
+ $curl = curl_init($method . '://' . $server . ':' . $port . $this->path);
+ if($keepalive)
+ {
+ $this->xmlrpc_curl_handle = $curl;
+ }
+ }
+ else
+ {
+ $curl = $this->xmlrpc_curl_handle;
+ }
+
+ // results into variable
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+
+ if($this->debug)
+ {
+ curl_setopt($curl, CURLOPT_VERBOSE, 1);
+ }
+ curl_setopt($curl, CURLOPT_USERAGENT, $GLOBALS['xmlrpcName'].' '.$GLOBALS['xmlrpcVersion']);
+ // required for XMLRPC: post the data
+ curl_setopt($curl, CURLOPT_POST, 1);
+ // the data
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
+
+ // return the header too
+ curl_setopt($curl, CURLOPT_HEADER, 1);
+
+ // will only work with PHP >= 5.0
+ // NB: if we set an empty string, CURL will add http header indicating
+ // ALL methods it is supporting. This is possibly a better option than
+ // letting the user tell what curl can / cannot do...
+ if(is_array($this->accepted_compression) && count($this->accepted_compression))
+ {
+ //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));
+ // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+ if (count($this->accepted_compression) == 1)
+ {
+ curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]);
+ }
+ else
+ curl_setopt($curl, CURLOPT_ENCODING, '');
+ }
+ // extra headers
+ $headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
+ // if no keepalive is wanted, let the server know it in advance
+ if(!$keepalive)
+ {
+ $headers[] = 'Connection: close';
+ }
+ // request compression header
+ if($encoding_hdr)
+ {
+ $headers[] = $encoding_hdr;
+ }
+
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
+ // timeout is borked
+ if($timeout)
+ {
+ curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
+ }
+
+ if($username && $password)
+ {
+ curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
+ if (defined('CURLOPT_HTTPAUTH'))
+ {
+ curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype);
+ }
+ else if ($authtype != 1)
+ {
+ error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth is supported by the current PHP/curl install');
+ }
+ }
+
+ if($method == 'https')
+ {
+ // set cert file
+ if($cert)
+ {
+ curl_setopt($curl, CURLOPT_SSLCERT, $cert);
+ }
+ // set cert password
+ if($certpass)
+ {
+ curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass);
+ }
+ // whether to verify remote host's cert
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer);
+ // set ca certificates file/dir
+ if($cacert)
+ {
+ curl_setopt($curl, CURLOPT_CAINFO, $cacert);
+ }
+ if($cacertdir)
+ {
+ curl_setopt($curl, CURLOPT_CAPATH, $cacertdir);
+ }
+ // set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+ if($key)
+ {
+ curl_setopt($curl, CURLOPT_SSLKEY, $key);
+ }
+ // set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+ if($keypass)
+ {
+ curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);
+ }
+ // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);
+ }
+
+ // proxy info
+ if($proxyhost)
+ {
+ if($proxyport == 0)
+ {
+ $proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080
+ }
+ curl_setopt($curl, CURLOPT_PROXY,$proxyhost.':'.$proxyport);
+ //curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport);
+ if($proxyusername)
+ {
+ curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword);
+ if (defined('CURLOPT_PROXYAUTH'))
+ {
+ curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyauthtype);
+ }
+ else if ($proxyauthtype != 1)
+ {
+ error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth to proxy is supported by the current PHP/curl install');
+ }
+ }
+ }
+
+ // NB: should we build cookie http headers by hand rather than let CURL do it?
+ // the following code does not honour 'expires', 'path' and 'domain' cookie attributes
+ // set to clint obj the the user...
+ if (count($this->cookies))
+ {
+ $cookieheader = '';
+ foreach ($this->cookies as $name => $cookie)
+ {
+ $cookieheader .= $name . '=' . $cookie['value'] . ', ';
+ }
+ curl_setopt($curl, CURLOPT_COOKIE, i18n::substr($cookieheader, 0, -2));
+ }
+
+ $result = curl_exec($curl);
+
+ if(!$result)
+ {
+ $this->errstr='no response';
+ $resp = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl));
+ if(!$keepalive)
+ {
+ curl_close($curl);
+ }
+ }
+ else
+ {
+ if(!$keepalive)
+ {
+ curl_close($curl);
+ }
+ $resp =& $msg->parseResponse($result, true, $this->return_type);
+ }
+ return $resp;
+ }
+
+ /**
+ * Send an array of request messages and return an array of responses.
+ * Unless $this->no_multicall has been set to true, it will try first
+ * to use one single xmlrpc call to server method system.multicall, and
+ * revert to sending many successive calls in case of failure.
+ * This failure is also stored in $this->no_multicall for subsequent calls.
+ * Unfortunately, there is no server error code universally used to denote
+ * the fact that multicall is unsupported, so there is no way to reliably
+ * distinguish between that and a temporary failure.
+ * If you are sure that server supports multicall and do not want to
+ * fallback to using many single calls, set the fourth parameter to FALSE.
+ *
+ * NB: trying to shoehorn extra functionality into existing syntax has resulted
+ * in pretty much convoluted code...
+ *
+ * @param array $msgs an array of xmlrpcmsg objects
+ * @param integer $timeout connection timeout (in seconds)
+ * @param string $method the http protocol variant to be used
+ * @param boolean fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted
+ * @return array
+ * @access public
+ */
+ function multicall($msgs, $timeout=0, $method='', $fallback=true)
+ {
+ if ($method == '')
+ {
+ $method = $this->method;
+ }
+ if(!$this->no_multicall)
+ {
+ $results = $this->_try_multicall($msgs, $timeout, $method);
+ if(is_array($results))
+ {
+ // System.multicall succeeded
+ return $results;
+ }
+ else
+ {
+ // either system.multicall is unsupported by server,
+ // or call failed for some other reason.
+ if ($fallback)
+ {
+ // Don't try it next time...
+ $this->no_multicall = true;
+ }
+ else
+ {
+ if (is_a($results, 'xmlrpcresp'))
+ {
+ $result = $results;
+ }
+ else
+ {
+ $result = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);
+ }
+ }
+ }
+ }
+ else
+ {
+ // override fallback, in case careless user tries to do two
+ // opposite things at the same time
+ $fallback = true;
+ }
+
+ $results = array();
+ if ($fallback)
+ {
+ // system.multicall is (probably) unsupported by server:
+ // emulate multicall via multiple requests
+ foreach($msgs as $msg)
+ {
+ $results[] =& $this->send($msg, $timeout, $method);
+ }
+ }
+ else
+ {
+ // user does NOT want to fallback on many single calls:
+ // since we should always return an array of responses,
+ // return an array with the same error repeated n times
+ foreach($msgs as $msg)
+ {
+ $results[] = $result;
+ }
+ }
+ return $results;
+ }
+
+ /**
+ * Attempt to boxcar $msgs via system.multicall.
+ * Returns either an array of xmlrpcreponses, an xmlrpc error response
+ * or false (when received response does not respect valid multicall syntax)
+ * @access private
+ */
+ function _try_multicall($msgs, $timeout, $method)
+ {
+ // Construct multicall message
+ $calls = array();
+ foreach($msgs as $msg)
+ {
+ $call['methodName'] = new xmlrpcval($msg->method(),'string');
+ $numParams = $msg->getNumParams();
+ $params = array();
+ for($i = 0; $i < $numParams; $i++)
+ {
+ $params[$i] = $msg->getParam($i);
+ }
+ $call['params'] = new xmlrpcval($params, 'array');
+ $calls[] = new xmlrpcval($call, 'struct');
+ }
+ $multicall = new xmlrpcmsg('system.multicall');
+ $multicall->addParam(new xmlrpcval($calls, 'array'));
+
+ // Attempt RPC call
+ $result =& $this->send($multicall, $timeout, $method);
+
+ if($result->faultCode() != 0)
+ {
+ // call to system.multicall failed
+ return $result;
+ }
+
+ // Unpack responses.
+ $rets = $result->value();
+
+ if ($this->return_type == 'xml')
+ {
+ return $rets;
+ }
+ else if ($this->return_type == 'phpvals')
+ {
+ ///@todo test this code branch...
+ $rets = $result->value();
+ if(!is_array($rets))
+ {
+ return false; // bad return type from system.multicall
+ }
+ $numRets = count($rets);
+ if($numRets != count($msgs))
+ {
+ return false; // wrong number of return values.
+ }
+
+ $response = array();
+ for($i = 0; $i < $numRets; $i++)
+ {
+ $val = $rets[$i];
+ if (!is_array($val)) {
+ return false;
+ }
+ switch(count($val))
+ {
+ case 1:
+ if(!isset($val[0]))
+ {
+ return false; // Bad value
+ }
+ // Normal return value
+ $response[$i] = new xmlrpcresp($val[0], 0, '', 'phpvals');
+ break;
+ case 2:
+ /// @todo remove usage of @: it is apparently quite slow
+ $code = @$val['faultCode'];
+ if(!is_int($code))
+ {
+ return false;
+ }
+ $str = @$val['faultString'];
+ if(!is_string($str))
+ {
+ return false;
+ }
+ $response[$i] = new xmlrpcresp(0, $code, $str);
+ break;
+ default:
+ return false;
+ }
+ }
+ return $response;
+ }
+ else // return type == 'xmlrpcvals'
+ {
+ $rets = $result->value();
+ if($rets->kindOf() != 'array')
+ {
+ return false; // bad return type from system.multicall
+ }
+ $numRets = $rets->arraysize();
+ if($numRets != count($msgs))
+ {
+ return false; // wrong number of return values.
+ }
+
+ $response = array();
+ for($i = 0; $i < $numRets; $i++)
+ {
+ $val = $rets->arraymem($i);
+ switch($val->kindOf())
+ {
+ case 'array':
+ if($val->arraysize() != 1)
+ {
+ return false; // Bad value
+ }
+ // Normal return value
+ $response[$i] = new xmlrpcresp($val->arraymem(0));
+ break;
+ case 'struct':
+ $code = $val->structmem('faultCode');
+ if($code->kindOf() != 'scalar' || $code->scalartyp() != 'int')
+ {
+ return false;
+ }
+ $str = $val->structmem('faultString');
+ if($str->kindOf() != 'scalar' || $str->scalartyp() != 'string')
+ {
+ return false;
+ }
+ $response[$i] = new xmlrpcresp(0, $code->scalarval(), $str->scalarval());
+ break;
+ default:
+ return false;
+ }
+ }
+ return $response;
+ }
+ }
+ } // end class xmlrpc_client
+
+ class xmlrpcresp
+ {
+ var $val = 0;
+ var $valtyp;
+ var $errno = 0;
+ var $errstr = '';
+ var $payload;
+ var $hdrs = array();
+ var $_cookies = array();
+ var $content_type = 'text/xml';
+ var $raw_data = '';
+
+ /**
+ * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)
+ * @param integer $fcode set it to anything but 0 to create an error response
+ * @param string $fstr the error string, in case of an error response
+ * @param string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml'
+ *
+ * @todo add check that $val / $fcode / $fstr is of correct type???
+ * NB: as of now we do not do it, since it might be either an xmlrpcval or a plain
+ * php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...
+ */
+ function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')
+ {
+ if($fcode != 0)
+ {
+ // error response
+ $this->errno = $fcode;
+ $this->errstr = $fstr;
+ //$this->errstr = Entity::hsc($fstr); // XXX: encoding probably shouldn't be done here; fix later.
+ }
+ else
+ {
+ // successful response
+ $this->val = $val;
+ if ($valtyp == '')
+ {
+ // user did not declare type of response value: try to guess it
+ if (is_object($this->val) && is_a($this->val, 'xmlrpcval'))
+ {
+ $this->valtyp = 'xmlrpcvals';
+ }
+ else if (is_string($this->val))
+ {
+ $this->valtyp = 'xml';
+
+ }
+ else
+ {
+ $this->valtyp = 'phpvals';
+ }
+ }
+ else
+ {
+ // user declares type of resp value: believe him
+ $this->valtyp = $valtyp;
+ }
+ }
+ }
+
+ /**
+ * Returns the error code of the response.
+ * @return integer the error code of this response (0 for not-error responses)
+ * @access public
+ */
+ function faultCode()
+ {
+ return $this->errno;
+ }
+
+ /**
+ * Returns the error code of the response.
+ * @return string the error string of this response ('' for not-error responses)
+ * @access public
+ */
+ function faultString()
+ {
+ return $this->errstr;
+ }
+
+ /**
+ * Returns the value received by the server.
+ * @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects
+ * @access public
+ */
+ function value()
+ {
+ return $this->val;
+ }
+
+ /**
+ * Returns an array with the cookies received from the server.
+ * Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...)
+ * with attributes being e.g. 'expires', 'path', domain'.
+ * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)
+ * are still present in the array. It is up to the user-defined code to decide
+ * how to use the received cookies, and wheter they have to be sent back with the next
+ * request to the server (using xmlrpc_client::setCookie) or not
+ * @return array array of cookies received from the server
+ * @access public
+ */
+ function cookies()
+ {
+ return $this->_cookies;
+ }
+
+ /**
+ * Returns xml representation of the response. XML prologue not included
+ * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
+ * @return string the xml representation of the response
+ * @access public
+ */
+ function serialize($charset_encoding='')
+ {
+ if ($charset_encoding != '')
+ $this->content_type = 'text/xml; charset=' . $charset_encoding;
+ else
+ $this->content_type = 'text/xml';
+ $result = "<methodResponse>\n";
+ if($this->errno)
+ {
+ // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients
+ // by xml-encoding non ascii chars
+ $result .= "<fault>\n" .
+"<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .
+"</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
+xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .
+"</struct>\n</value>\n</fault>";
+ }
+ else
+ {
+ if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))
+ {
+ if (is_string($this->val) && $this->valtyp == 'xml')
+ {
+ $result .= "<params>\n<param>\n" .
+ $this->val .
+ "</param>\n</params>";
+ }
+ else
+ {
+ /// @todo try to build something serializable?
+ die('cannot serialize xmlrpcresp objects whose content is native php values');
+ }
+ }
+ else
+ {
+ $result .= "<params>\n<param>\n" .
+ $this->val->serialize($charset_encoding) .
+ "</param>\n</params>";
+ }
+ }
+ $result .= "\n</methodResponse>";
+ $this->payload = $result;
+ return $result;
+ }
+ }
+
+ class xmlrpcmsg
+ {
+ var $payload;
+ var $methodname;
+ var $params=array();
+ var $debug=0;
+ var $content_type = 'text/xml';
+
+ /**
+ * @param string $meth the name of the method to invoke
+ * @param array $pars array of parameters to be paased to the method (xmlrpcval objects)
+ */
+ function xmlrpcmsg($meth, $pars=0)
+ {
+ $this->methodname=$meth;
+ if(is_array($pars) && count($pars)>0)
+ {
+ for($i=0; $i<count($pars); $i++)
+ {
+ $this->addParam($pars[$i]);
+ }
+ }
+ }
+
+ /**
+ * @access private
+ */
+ function xml_header($charset_encoding='')
+ {
+ if ($charset_encoding != '')
+ {
+ return "<?xml version=\"1.0\" encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n";
+ }
+ else
+ {
+ return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
+ }
+ }
+
+ /**
+ * @access private
+ */
+ function xml_footer()
+ {
+ return '</methodCall>';
+ }
+
+ /**
+ * @access private
+ */
+ function kindOf()
+ {
+ return 'msg';
+ }
+
+ /**
+ * @access private
+ */
+ function createPayload($charset_encoding='')
+ {
+ if ($charset_encoding != '')
+ $this->content_type = 'text/xml; charset=' . $charset_encoding;
+ else
+ $this->content_type = 'text/xml';
+ $this->payload=$this->xml_header($charset_encoding);
+ $this->payload.='<methodName>' . $this->methodname . "</methodName>\n";
+ $this->payload.="<params>\n";
+ for($i=0; $i<count($this->params); $i++)
+ {
+ $p=$this->params[$i];
+ $this->payload.="<param>\n" . $p->serialize($charset_encoding) .
+ "</param>\n";
+ }
+ $this->payload.="</params>\n";
+ $this->payload.=$this->xml_footer();
+ }
+
+ /**
+ * Gets/sets the xmlrpc method to be invoked
+ * @param string $meth the method to be set (leave empty not to set it)
+ * @return string the method that will be invoked
+ * @access public
+ */
+ function method($meth='')
+ {
+ if($meth!='')
+ {
+ $this->methodname=$meth;
+ }
+ return $this->methodname;
+ }
+
+ /**
+ * Returns xml representation of the message. XML prologue included
+ * @return string the xml representation of the message, xml prologue included
+ * @access public
+ */
+ function serialize($charset_encoding='')
+ {
+ $this->createPayload($charset_encoding);
+ return $this->payload;
+ }
+
+ /**
+ * Add a parameter to the list of parameters to be used upon method invocation
+ * @param xmlrpcval $par
+ * @return boolean false on failure
+ * @access public
+ */
+ function addParam($par)
+ {
+ // add check: do not add to self params which are not xmlrpcvals
+ if(is_object($par) && is_a($par, 'xmlrpcval'))
+ {
+ $this->params[]=$par;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the nth parameter in the message. The index zero-based.
+ * @param integer $i the index of the parameter to fetch (zero based)
+ * @return xmlrpcval the i-th parameter
+ * @access public
+ */
+ function getParam($i) { return $this->params[$i]; }
+
+ /**
+ * Returns the number of parameters in the messge.
+ * @return integer the number of parameters currently set
+ * @access public
+ */
+ function getNumParams() { return count($this->params); }
+
+ /**
+ * Given an open file handle, read all data available and parse it as axmlrpc response.
+ * NB: the file handle is not closed by this function.
+ * @access public
+ * @return xmlrpcresp
+ * @todo add 2nd & 3rd param to be passed to ParseResponse() ???
+ */
+ function &parseResponseFile($fp)
+ {
+ $ipd='';
+ while($data=fread($fp, 32768))
+ {
+ $ipd.=$data;
+ }
+ //fclose($fp);
+ $r =& $this->parseResponse($ipd);
+ return $r;
+ }
+
+ /**
+ * Parses HTTP headers and separates them from data.
+ * @access private
+ */
+ function &parseResponseHeaders(&$data, $headers_processed=false)
+ {
+ // Support "web-proxy-tunelling" connections for https through proxies
+ if(preg_match('/^HTTP\/1\.[0-1] 200 Connection established/', $data))
+ {
+ // Look for CR/LF or simple LF as line separator,
+ // (even though it is not valid http)
+ $pos = i18n::strpos($data,"\r\n\r\n");
+ if($pos || is_int($pos))
+ {
+ $bd = $pos+4;
+ }
+ else
+ {
+ $pos = i18n::strpos($data,"\n\n");
+ if($pos || is_int($pos))
+ {
+ $bd = $pos+2;
+ }
+ else
+ {
+ // No separation between response headers and body: fault?
+ $bd = 0;
+ }
+ }
+ if ($bd)
+ {
+ // this filters out all http headers from proxy.
+ // maybe we could take them into account, too?
+ $data = i18n::substr($data, $bd);
+ }
+ else
+ {
+ error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTPS via proxy error, tunnel connection possibly failed');
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (HTTPS via proxy error, tunnel connection possibly failed)');
+ return $r;
+ }
+ }
+
+ // Strip HTTP 1.1 100 Continue header if present
+ while(preg_match('/^HTTP\/1\.1 1[0-9]{2} /', $data))
+ {
+ $pos = i18n::strpos($data, 'HTTP', 12);
+ // server sent a Continue header without any (valid) content following...
+ // give the client a chance to know it
+ if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5
+ {
+ break;
+ }
+ $data = i18n::substr($data, $pos);
+ }
+ if(!preg_match('/^HTTP\/[0-9.]+ 200 /', $data))
+ {
+ $errstr= i18n::substr($data, 0, i18n::strpos($data, "\n")-1);
+ error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: ' .$errstr);
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')');
+ return $r;
+ }
+
+ $GLOBALS['_xh']['headers'] = array();
+ $GLOBALS['_xh']['cookies'] = array();
+
+ // be tolerant to usage of \n instead of \r\n to separate headers and data
+ // (even though it is not valid http)
+ $pos = i18n::strpos($data,"\r\n\r\n");
+ if($pos || is_int($pos))
+ {
+ $bd = $pos+4;
+ }
+ else
+ {
+ $pos = i18n::strpos($data,"\n\n");
+ if($pos || is_int($pos))
+ {
+ $bd = $pos+2;
+ }
+ else
+ {
+ // No separation between response headers and body: fault?
+ // we could take some action here instead of going on...
+ $bd = 0;
+ }
+ }
+ // be tolerant to line endings, and extra empty lines
+ //$ar = split("\r?\n", trim(substr($data, 0, $pos))); //split() is deprecated
+ $ar = preg_split("/\r?\n/", trim(i18n::substr($data, 0, $pos)));
+ while(list(,$line) = @each($ar))
+ {
+ // take care of multi-line headers and cookies
+ $arr = preg_split('#:#',$line,2);
+ if(count($arr) > 1)
+ {
+ $header_name = strtolower(trim($arr[0]));
+ /// @todo some other headers (the ones that allow a CSV list of values)
+ /// do allow many values to be passed using multiple header lines.
+ /// We should add content to $GLOBALS['_xh']['headers'][$header_name]
+ /// instead of replacing it for those...
+ if ($header_name == 'set-cookie' || $header_name == 'set-cookie2')
+ {
+ if ($header_name == 'set-cookie2')
+ {
+ // version 2 cookies:
+ // there could be many cookies on one line, comma separated
+ $cookies = preg_split('#,#', $arr[1]);
+ }
+ else
+ {
+ $cookies = array($arr[1]);
+ }
+ foreach ($cookies as $cookie)
+ {
+ // glue together all received cookies, using a comma to separate them
+ // (same as php does with getallheaders())
+ if (isset($GLOBALS['_xh']['headers'][$header_name]))
+ $GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);
+ else
+ $GLOBALS['_xh']['headers'][$header_name] = trim($cookie);
+ // parse cookie attributes, in case user wants to correctly honour them
+ // feature creep: only allow rfc-compliant cookie attributes?
+ $cookie = preg_split('#;#', $cookie);
+ foreach ($cookie as $pos => $val)
+ {
+ $val = preg_split('#=#', $val, 2);
+ $tag = trim($val[0]);
+ $val = trim(@$val[1]);
+ /// @todo with version 1 cookies, we should strip leading and trailing " chars
+ if ($pos == 0)
+ {
+ $cookiename = $tag;
+ $GLOBALS['_xh']['cookies'][$tag] = array();
+ $GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
+ }
+ else
+ {
+ $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;
+ }
+ }
+ }
+ }
+ else
+ {
+ $GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
+ }
+ }
+ elseif(isset($header_name))
+ {
+ /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
+ $GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
+ }
+ }
+
+ $data = i18n::substr($data, $bd);
+
+ if($this->debug && count($GLOBALS['_xh']['headers']))
+ {
+ print '<PRE>';
+ foreach($GLOBALS['_xh']['headers'] as $header => $value)
+ {
+ print Entity::hen("HEADER: $header: $value\n");
+ }
+ foreach($GLOBALS['_xh']['cookies'] as $header => $value)
+ {
+ print Entity::hen("COOKIE: $header={$value['value']}\n");
+ }
+ print "</PRE>\n";
+ }
+
+ // if CURL was used for the call, http headers have been processed,
+ // and dechunking + reinflating have been carried out
+ if(!$headers_processed)
+ {
+ // Decode chunked encoding sent by http 1.1 servers
+ if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked')
+ {
+ if(!$data = decode_chunked($data))
+ {
+ error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to rebuild the chunked data received from server');
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);
+ return $r;
+ }
+ }
+
+ // Decode gzip-compressed stuff
+ // code shamelessly inspired from nusoap library by Dietrich Ayala
+ if(isset($GLOBALS['_xh']['headers']['content-encoding']))
+ {
+ $GLOBALS['_xh']['headers']['content-encoding'] = str_replace('x-', '', $GLOBALS['_xh']['headers']['content-encoding']);
+ if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip')
+ {
+ // if decoding works, use it. else assume data wasn't gzencoded
+ if(function_exists('gzinflate'))
+ {
+ if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data))
+ {
+ $data = $degzdata;
+ if($this->debug)
+ print "<PRE>---INFLATED RESPONSE---[".i18n::strlen($data)." chars]---\n" . Entity::hen($data) . "\n---END---</PRE>";
+ }
+ elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(i18n::substr($data, 10)))
+ {
+ $data = $degzdata;
+ if($this->debug)
+ print "<PRE>---INFLATED RESPONSE---[".i18n::strlen($data)." chars]---\n" . Entity::hen($data) . "\n---END---</PRE>";
+ }
+ else
+ {
+ error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to decode the deflated data received from server');
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);
+ return $r;
+ }
+ }
+ else
+ {
+ error_log('XML-RPC: xmlrpcmsg::parseResponse: the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);
+ return $r;
+ }
+ }
+ }
+ } // end of 'if needed, de-chunk, re-inflate response'
+
+ // real stupid hack to avoid PHP 4 complaining about returning NULL by ref
+ $r = null;
+ $r =& $r;
+ return $r;
+ }
+
+ /**
+ * Parse the xmlrpc response contained in the string $data and return an xmlrpcresp object.
+ * @param string $data the xmlrpc response, eventually including http headers
+ * @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding
+ * @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'
+ * @return xmlrpcresp
+ * @access public
+ */
+ function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals')
+ {
+ if($this->debug)
+ {
+ print "<PRE>---GOT---\n" . Entity::hen($data) . "\n---END---\n</PRE>";
+ }
+
+ if($data == '')
+ {
+ error_log('XML-RPC: xmlrpcmsg::parseResponse: no response received from server.');
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
+ return $r;
+ }
+
+ $GLOBALS['_xh']=array();
+
+ $raw_data = $data;
+ // parse the HTTP headers of the response, if present, and separate them from data
+ if(i18n::substr($data, 0, 4) == 'HTTP')
+ {
+ $r =& $this->parseResponseHeaders($data, $headers_processed);
+ if ($r)
+ {
+ // failed processing of HTTP response headers
+ // save into response obj the full payload received, for debugging
+ $r->raw_data = $data;
+ return $r;
+ }
+ }
+ else
+ {
+ $GLOBALS['_xh']['headers'] = array();
+ $GLOBALS['_xh']['cookies'] = array();
+ }
+
+ if($this->debug)
+ {
+ $start = i18n::strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
+ if ($start)
+ {
+ $start += i18n::strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
+ $end = i18n::strpos($data, '-->', $start);
+ $comments = i18n::substr($data, $start, $end-$start);
+ print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t".Entity::hen(str_replace("\n", "\n\t", base64_decode($comments)))."\n---END---\n</PRE>";
+ }
+ }
+
+ // be tolerant of extra whitespace in response body
+ $data = trim($data);
+
+ /// @todo return an error msg if $data=='' ?
+
+ // be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts)
+ // idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib
+ $bd = false;
+ // Poor man's version of strrpos for php 4...
+ $pos = i18n::strpos($data, '</methodResponse>');
+ while($pos || is_int($pos))
+ {
+ $bd = $pos+17;
+ $pos = i18n::strpos($data, '</methodResponse>', $bd);
+ }
+ if($bd)
+ {
+ $data = i18n::substr($data, 0, $bd);
+ }
+
+ // if user wants back raw xml, give it to him
+ if ($return_type == 'xml')
+ {
+ $r = new xmlrpcresp($data, 0, '', 'xml');
+ $r->hdrs = $GLOBALS['_xh']['headers'];
+ $r->_cookies = $GLOBALS['_xh']['cookies'];
+ $r->raw_data = $raw_data;
+ return $r;
+ }
+
+ // try to 'guestimate' the character encoding of the received response
+ $resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);
+
+ $GLOBALS['_xh']['ac']='';
+ //$GLOBALS['_xh']['qt']=''; //unused...
+ $GLOBALS['_xh']['stack'] = array();
+ $GLOBALS['_xh']['valuestack'] = array();
+ $GLOBALS['_xh']['isf']=0; // 0 = OK, 1 for xmlrpc fault responses, 2 = invalid xmlrpc
+ $GLOBALS['_xh']['isf_reason']='';
+ $GLOBALS['_xh']['rt']=''; // 'methodcall or 'methodresponse'
+
+ // if response charset encoding is not known / supported, try to use
+ // the default encoding and parse the xml anyway, but log a warning...
+ if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+ // the following code might be better for mb_string enabled installs, but
+ // makes the lib about 200% slower...
+ //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+ {
+ error_log('XML-RPC: xmlrpcmsg::parseResponse: invalid charset encoding of received response: '.$resp_encoding);
+ $resp_encoding = $GLOBALS['xmlrpc_defencoding'];
+ }
+ $parser = xml_parser_create($resp_encoding);
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+ // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
+ // the xml parser to give us back data in the expected charset
+ xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+
+ if ($return_type == 'phpvals')
+ {
+ xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
+ }
+ else
+ {
+ xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
+ }
+
+ xml_set_character_data_handler($parser, 'xmlrpc_cd');
+ xml_set_default_handler($parser, 'xmlrpc_dh');
+
+ // first error check: xml not well formed
+ if(!xml_parse($parser, $data, count($data)))
+ {
+ // thanks to Peter Kocks <peter.kocks@baygate.com>
+ if((xml_get_current_line_number($parser)) == 1)
+ {
+ $errstr = 'XML error at line 1, check URL';
+ }
+ else
+ {
+ $errstr = sprintf('XML error: %s at line %d, column %d',
+ xml_error_string(xml_get_error_code($parser)),
+ xml_get_current_line_number($parser), xml_get_current_column_number($parser));
+ }
+ error_log($errstr);
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')');
+ xml_parser_free($parser);
+ if($this->debug)
+ {
+ print $errstr;
+ }
+ $r->hdrs = $GLOBALS['_xh']['headers'];
+ $r->_cookies = $GLOBALS['_xh']['cookies'];
+ $r->raw_data = $raw_data;
+ return $r;
+ }
+ xml_parser_free($parser);
+ // second error check: xml well formed but not xml-rpc compliant
+ if ($GLOBALS['_xh']['isf'] > 1)
+ {
+ if ($this->debug)
+ {
+ /// @todo echo something for user?
+ }
+
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
+ $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']);
+ }
+ // third error check: parsing of the response has somehow gone boink.
+ // NB: shall we omit this check, since we trust the parsing code?
+ elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value']))
+ {
+ // something odd has happened
+ // and it's time to generate a client side error
+ // indicating something odd went on
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
+ $GLOBALS['xmlrpcstr']['invalid_return']);
+ }
+ else
+ {
+ if ($this->debug)
+ {
+ print "<PRE>---PARSED---\n";
+ print Entity::hsc(var_export($GLOBALS['_xh']['value'], true));
+ print "\n---END---</PRE>";
+ }
+
+ // note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object.
+ $v =& $GLOBALS['_xh']['value'];
+
+ if($GLOBALS['_xh']['isf'])
+ {
+ /// @todo we should test here if server sent an int and a string,
+ /// and/or coerce them into such...
+ if ($return_type == 'xmlrpcvals')
+ {
+ $errno_v = $v->structmem('faultCode');
+ $errstr_v = $v->structmem('faultString');
+ $errno = $errno_v->scalarval();
+ $errstr = $errstr_v->scalarval();
+ }
+ else
+ {
+ $errno = $v['faultCode'];
+ $errstr = $v['faultString'];
+ }
+
+ if($errno == 0)
+ {
+ // FAULT returned, errno needs to reflect that
+ $errno = -1;
+ }
+
+ $r = new xmlrpcresp(0, $errno, $errstr);
+ }
+ else
+ {
+ $r = new xmlrpcresp($v, 0, '', $return_type);
+ }
+ }
+
+ $r->hdrs = $GLOBALS['_xh']['headers'];
+ $r->_cookies = $GLOBALS['_xh']['cookies'];
+ $r->raw_data = $raw_data;
+ return $r;
+ }
+ }
+
+ class xmlrpcval
+ {
+ var $me=array();
+ var $mytype=0;
+ var $_php_class=null;
+
+ /**
+ * @param mixed $val
+ * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed
+ */
+ function xmlrpcval($val=-1, $type='')
+ {
+ /// @todo: optimization creep - do not call addXX, do it all inline.
+ /// downside: booleans will not be coerced anymore
+ if($val!==-1 || $type!='')
+ {
+ // optimization creep: inlined all work done by constructor
+ switch($type)
+ {
+ case '':
+ $this->mytype=1;
+ $this->me['string']=$val;
+ break;
+ case 'i4':
+ case 'int':
+ case 'double':
+ case 'string':
+ case 'boolean':
+ case 'dateTime.iso8601':
+ case 'base64':
+ case 'null':
+ $this->mytype=1;
+ $this->me[$type]=$val;
+ break;
+ case 'array':
+ $this->mytype=2;
+ $this->me['array']=$val;
+ break;
+ case 'struct':
+ $this->mytype=3;
+ $this->me['struct']=$val;
+ break;
+ default:
+ error_log("XML-RPC: xmlrpcval::xmlrpcval: not a known type ($type)");
+ }
+ /*if($type=='')
+ {
+ $type='string';
+ }
+ if($GLOBALS['xmlrpcTypes'][$type]==1)
+ {
+ $this->addScalar($val,$type);
+ }
+ elseif($GLOBALS['xmlrpcTypes'][$type]==2)
+ {
+ $this->addArray($val);
+ }
+ elseif($GLOBALS['xmlrpcTypes'][$type]==3)
+ {
+ $this->addStruct($val);
+ }*/
+ }
+ }
+
+ /**
+ * Add a single php value to an (unitialized) xmlrpcval
+ * @param mixed $val
+ * @param string $type
+ * @return int 1 or 0 on failure
+ */
+ function addScalar($val, $type='string')
+ {
+ $typeof=@$GLOBALS['xmlrpcTypes'][$type];
+ if($typeof!=1)
+ {
+ error_log("XML-RPC: xmlrpcval::addScalar: not a scalar type ($type)");
+ return 0;
+ }
+
+ // coerce booleans into correct values
+ // NB: we should iether do it for datetimes, integers and doubles, too,
+ // or just plain remove this check, implemnted on booleans only...
+ if($type==$GLOBALS['xmlrpcBoolean'])
+ {
+ if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false')))
+ {
+ $val=true;
+ }
+ else
+ {
+ $val=false;
+ }
+ }
+
+ switch($this->mytype)
+ {
+ case 1:
+ error_log('XML-RPC: xmlrpcval::addScalar: scalar xmlrpcval can have only one value');
+ return 0;
+ case 3:
+ error_log('XML-RPC: xmlrpcval::addScalar: cannot add anonymous scalar to struct xmlrpcval');
+ return 0;
+ case 2:
+ // we're adding a scalar value to an array here
+ //$ar=$this->me['array'];
+ //$ar[] = new xmlrpcval($val, $type);
+ //$this->me['array']=$ar;
+ // Faster (?) avoid all the costly array-copy-by-val done here...
+ $this->me['array'][] = new xmlrpcval($val, $type);
+ return 1;
+ default:
+ // a scalar, so set the value and remember we're scalar
+ $this->me[$type]=$val;
+ $this->mytype=$typeof;
+ return 1;
+ }
+ }
+
+ /**
+ * Add an array of xmlrpcval objects to an xmlrpcval
+ * @param array $vals
+ * @return int 1 or 0 on failure
+ * @access public
+ *
+ * @todo add some checking for $vals to be an array of xmlrpcvals?
+ */
+ function addArray($vals)
+ {
+ if($this->mytype==0)
+ {
+ $this->mytype=$GLOBALS['xmlrpcTypes']['array'];
+ $this->me['array']=$vals;
+ return 1;
+ }
+ elseif($this->mytype==2)
+ {
+ // we're adding to an array here
+ $this->me['array'] = array_merge($this->me['array'], $vals);
+ return 1;
+ }
+ else
+ {
+ error_log('XML-RPC: xmlrpcval::addArray: already initialized as a [' . $this->kindOf() . ']');
+ return 0;
+ }
+ }
+
+ /**
+ * Add an array of named xmlrpcval objects to an xmlrpcval
+ * @param array $vals
+ * @return int 1 or 0 on failure
+ * @access public
+ *
+ * @todo add some checking for $vals to be an array?
+ */
+ function addStruct($vals)
+ {
+ if($this->mytype==0)
+ {
+ $this->mytype=$GLOBALS['xmlrpcTypes']['struct'];
+ $this->me['struct']=$vals;
+ return 1;
+ }
+ elseif($this->mytype==3)
+ {
+ // we're adding to a struct here
+ $this->me['struct'] = array_merge($this->me['struct'], $vals);
+ return 1;
+ }
+ else
+ {
+ error_log('XML-RPC: xmlrpcval::addStruct: already initialized as a [' . $this->kindOf() . ']');
+ return 0;
+ }
+ }
+
+ // poor man's version of print_r ???
+ // DEPRECATED!
+ function dump($ar)
+ {
+ foreach($ar as $key => $val)
+ {
+ echo "$key => $val<br />";
+ if($key == 'array')
+ {
+ while(list($key2, $val2) = each($val))
+ {
+ echo "-- $key2 => $val2<br />";
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns a string containing "struct", "array" or "scalar" describing the base type of the value
+ * @return string
+ * @access public
+ */
+ function kindOf()
+ {
+ switch($this->mytype)
+ {
+ case 3:
+ return 'struct';
+ break;
+ case 2:
+ return 'array';
+ break;
+ case 1:
+ return 'scalar';
+ break;
+ default:
+ return 'undef';
+ }
+ }
+
+ /**
+ * @access private
+ */
+ function serializedata($typ, $val, $charset_encoding='')
+ {
+ $rs='';
+ switch(@$GLOBALS['xmlrpcTypes'][$typ])
+ {
+ case 1:
+ switch($typ)
+ {
+ case $GLOBALS['xmlrpcBase64']:
+ $rs.="<${typ}>" . base64_encode($val) . "</${typ}>";
+ break;
+ case $GLOBALS['xmlrpcBoolean']:
+ $rs.="<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
+ break;
+ case $GLOBALS['xmlrpcString']:
+ // G. Giunta 2005/2/13: do NOT use htmlentities, since
+ // it will produce named html entities, which are invalid xml
+ $rs.="<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding). "</${typ}>";
+ break;
+ case $GLOBALS['xmlrpcInt']:
+ case $GLOBALS['xmlrpcI4']:
+ $rs.="<${typ}>".(int)$val."</${typ}>";
+ break;
+ case $GLOBALS['xmlrpcDouble']:
+ $rs.="<${typ}>".(double)$val."</${typ}>";
+ break;
+ case $GLOBALS['xmlrpcNull']:
+ $rs.="<nil/>";
+ break;
+ default:
+ // no standard type value should arrive here, but provide a possibility
+ // for xmlrpcvals of unknown type...
+ $rs.="<${typ}>${val}</${typ}>";
+ }
+ break;
+ case 3:
+ // struct
+ if ($this->_php_class)
+ {
+ $rs.='<struct php_class="' . $this->_php_class . "\">\n";
+ }
+ else
+ {
+ $rs.="<struct>\n";
+ }
+ foreach($val as $key2 => $val2)
+ {
+ $rs.='<member><name>'.xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding)."</name>\n";
+ //$rs.=$this->serializeval($val2);
+ $rs.=$val2->serialize($charset_encoding);
+ $rs.="</member>\n";
+ }
+ $rs.='</struct>';
+ break;
+ case 2:
+ // array
+ $rs.="<array>\n<data>\n";
+ for($i=0; $i<count($val); $i++)
+ {
+ //$rs.=$this->serializeval($val[$i]);
+ $rs.=$val[$i]->serialize($charset_encoding);
+ }
+ $rs.="</data>\n</array>";
+ break;
+ default:
+ break;
+ }
+ return $rs;
+ }
+
+ /**
+ * Returns xml representation of the value. XML prologue not included
+ * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
+ * @return string
+ * @access public
+ */
+ function serialize($charset_encoding='')
+ {
+ // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
+ //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
+ //{
+ reset($this->me);
+ list($typ, $val) = each($this->me);
+ return '<value>' . $this->serializedata($typ, $val, $charset_encoding) . "</value>\n";
+ //}
+ }
+
+ // DEPRECATED
+ function serializeval($o)
+ {
+ // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
+ //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
+ //{
+ $ar=$o->me;
+ reset($ar);
+ list($typ, $val) = each($ar);
+ return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
+ //}
+ }
+
+ /**
+ * Checks wheter a struct member with a given name is present.
+ * Works only on xmlrpcvals of type struct.
+ * @param string $m the name of the struct member to be looked up
+ * @return boolean
+ * @access public
+ */
+ function structmemexists($m)
+ {
+ return array_key_exists($m, $this->me['struct']);
+ }
+
+ /**
+ * Returns the value of a given struct member (an xmlrpcval object in itself).
+ * Will raise a php warning if struct member of given name does not exist
+ * @param string $m the name of the struct member to be looked up
+ * @return xmlrpcval
+ * @access public
+ */
+ function structmem($m)
+ {
+ return $this->me['struct'][$m];
+ }
+
+ /**
+ * Reset internal pointer for xmlrpcvals of type struct.
+ * @access public
+ */
+ function structreset()
+ {
+ reset($this->me['struct']);
+ }
+
+ /**
+ * Return next member element for xmlrpcvals of type struct.
+ * @return xmlrpcval
+ * @access public
+ */
+ function structeach()
+ {
+ return each($this->me['struct']);
+ }
+
+ // DEPRECATED! this code looks like it is very fragile and has not been fixed
+ // for a long long time. Shall we remove it for 2.0?
+ function getval()
+ {
+ // UNSTABLE
+ reset($this->me);
+ list($a,$b)=each($this->me);
+ // contributed by I Sofer, 2001-03-24
+ // add support for nested arrays to scalarval
+ // i've created a new method here, so as to
+ // preserve back compatibility
+
+ if(is_array($b))
+ {
+ @reset($b);
+ while(list($id,$cont) = @each($b))
+ {
+ $b[$id] = $cont->scalarval();
+ }
+ }
+
+ // add support for structures directly encoding php objects
+ if(is_object($b))
+ {
+ $t = get_object_vars($b);
+ @reset($t);
+ while(list($id,$cont) = @each($t))
+ {
+ $t[$id] = $cont->scalarval();
+ }
+ @reset($t);
+ while(list($id,$cont) = @each($t))
+ {
+ @$b->$id = $cont;
+ }
+ }
+ // end contrib
+ return $b;
+ }
+
+ /**
+ * Returns the value of a scalar xmlrpcval
+ * @return mixed
+ * @access public
+ */
+ function scalarval()
+ {
+ reset($this->me);
+ list(,$b)=each($this->me);
+ return $b;
+ }
+
+ /**
+ * Returns the type of the xmlrpcval.
+ * For integers, 'int' is always returned in place of 'i4'
+ * @return string
+ * @access public
+ */
+ function scalartyp()
+ {
+ reset($this->me);
+ list($a,)=each($this->me);
+ if($a==$GLOBALS['xmlrpcI4'])
+ {
+ $a=$GLOBALS['xmlrpcInt'];
+ }
+ return $a;
+ }
+
+ /**
+ * Returns the m-th member of an xmlrpcval of struct type
+ * @param integer $m the index of the value to be retrieved (zero based)
+ * @return xmlrpcval
+ * @access public
+ */
+ function arraymem($m)
+ {
+ return $this->me['array'][$m];
+ }
+
+ /**
+ * Returns the number of members in an xmlrpcval of array type
+ * @return integer
+ * @access public
+ */
+ function arraysize()
+ {
+ return count($this->me['array']);
+ }
+
+ /**
+ * Returns the number of members in an xmlrpcval of struct type
+ * @return integer
+ * @access public
+ */
+ function structsize()
+ {
+ return count($this->me['struct']);
+ }
+ }
+
+
+ // date helpers
+
+ /**
+ * Given a timestamp, return the corresponding ISO8601 encoded string.
+ *
+ * Really, timezones ought to be supported
+ * but the XML-RPC spec says:
+ *
+ * "Don't assume a timezone. It should be specified by the server in its
+ * documentation what assumptions it makes about timezones."
+ *
+ * These routines always assume localtime unless
+ * $utc is set to 1, in which case UTC is assumed
+ * and an adjustment for locale is made when encoding
+ *
+ * @param int $timet (timestamp)
+ * @param int $utc (0 or 1)
+ * @return string
+ */
+ function iso8601_encode($timet, $utc=0)
+ {
+ if(!$utc)
+ {
+ $t=i18n::formatted_datetime('iso8601UTC', $timet);
+ }
+ else
+ {
+ $t=i18n::formatted_datetime('iso8601UTC', $timet-date('Z'));
+ }
+ return $t;
+ }
+
+ /**
+ * Given an ISO8601 date string, return a timet in the localtime, or UTC
+ * @param string $idate
+ * @param int $utc either 0 or 1
+ * @return int (datetime)
+ */
+ function iso8601_decode($idate, $utc=0)
+ {
+ $t=0;
+ if(preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $idate, $regs))
+ {
+ if($utc)
+ {
+ $t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
+ }
+ else
+ {
+ $t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
+ }
+ }
+ return $t;
+ }
+
+ /**
+ * Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types.
+ *
+ * Works with xmlrpc message objects as input, too.
+ *
+ * Given proper options parameter, can rebuild generic php object instances
+ * (provided those have been encoded to xmlrpc format using a corresponding
+ * option in php_xmlrpc_encode())
+ * PLEASE NOTE that rebuilding php objects involves calling their constructor function.
+ * This means that the remote communication end can decide which php code will
+ * get executed on your server, leaving the door possibly open to 'php-injection'
+ * style of attacks (provided you have some classes defined on your server that
+ * might wreak havoc if instances are built outside an appropriate context).
+ * Make sure you trust the remote server/client before eanbling this!
+ *
+ * @author Dan Libby (dan@libby.com)
+ *
+ * @param xmlrpcval $xmlrpc_val
+ * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects
+ * @return mixed
+ */
+ function php_xmlrpc_decode($xmlrpc_val, $options=array())
+ {
+ switch($xmlrpc_val->kindOf())
+ {
+ case 'scalar':
+ if (in_array('extension_api', $options))
+ {
+ reset($xmlrpc_val->me);
+ list($typ,$val) = each($xmlrpc_val->me);
+ switch ($typ)
+ {
+ case 'dateTime.iso8601':
+ $xmlrpc_val->scalar = $val;
+ $xmlrpc_val->xmlrpc_type = 'datetime';
+ $xmlrpc_val->timestamp = iso8601_decode($val);
+ return $xmlrpc_val;
+ case 'base64':
+ $xmlrpc_val->scalar = $val;
+ $xmlrpc_val->type = $typ;
+ return $xmlrpc_val;
+ default:
+ return $xmlrpc_val->scalarval();
+ }
+ }
+ return $xmlrpc_val->scalarval();
+ case 'array':
+ $size = $xmlrpc_val->arraysize();
+ $arr = array();
+ for($i = 0; $i < $size; $i++)
+ {
+ $arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);
+ }
+ return $arr;
+ case 'struct':
+ $xmlrpc_val->structreset();
+ // If user said so, try to rebuild php objects for specific struct vals.
+ /// @todo should we raise a warning for class not found?
+ // shall we check for proper subclass of xmlrpcval instead of
+ // presence of _php_class to detect what we can do?
+ if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != ''
+ && class_exists($xmlrpc_val->_php_class))
+ {
+ $obj = @new $xmlrpc_val->_php_class;
+ while(list($key,$value)=$xmlrpc_val->structeach())
+ {
+ $obj->$key = php_xmlrpc_decode($value, $options);
+ }
+ return $obj;
+ }
+ else
+ {
+ $arr = array();
+ while(list($key,$value)=$xmlrpc_val->structeach())
+ {
+ $arr[$key] = php_xmlrpc_decode($value, $options);
+ }
+ return $arr;
+ }
+ case 'msg':
+ $paramcount = $xmlrpc_val->getNumParams();
+ $arr = array();
+ for($i = 0; $i < $paramcount; $i++)
+ {
+ $arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i));
+ }
+ return $arr;
+ }
+ }
+
+ // This constant left here only for historical reasons...
+ // it was used to decide if we have to define xmlrpc_encode on our own, but
+ // we do not do it anymore
+ if(function_exists('xmlrpc_decode'))
+ {
+ define('XMLRPC_EPI_ENABLED','1');
+ }
+ else
+ {
+ define('XMLRPC_EPI_ENABLED','0');
+ }
+
+ /**
+ * Takes native php types and encodes them into xmlrpc PHP object format.
+ * It will not re-encode xmlrpcval objects.
+ *
+ * Feature creep -- could support more types via optional type argument
+ * (string => datetime support has been added, ??? => base64 not yet)
+ *
+ * If given a proper options parameter, php object instances will be encoded
+ * into 'special' xmlrpc values, that can later be decoded into php objects
+ * by calling php_xmlrpc_decode() with a corresponding option
+ *
+ * @author Dan Libby (dan@libby.com)
+ *
+ * @param mixed $php_val the value to be converted into an xmlrpcval object
+ * @param array $options can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
+ * @return xmlrpcval
+ */
+ function &php_xmlrpc_encode($php_val, $options=array())
+ {
+ $type = gettype($php_val);
+ switch($type)
+ {
+ case 'string':
+ if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val))
+ $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']);
+ else
+ $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcString']);
+ break;
+ case 'integer':
+ $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcInt']);
+ break;
+ case 'double':
+ $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDouble']);
+ break;
+ // <G_Giunta_2001-02-29>
+ // Add support for encoding/decoding of booleans, since they are supported in PHP
+ case 'boolean':
+ $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcBoolean']);
+ break;
+ // </G_Giunta_2001-02-29>
+ case 'array':
+ // PHP arrays can be encoded to either xmlrpc structs or arrays,
+ // depending on wheter they are hashes or plain 0..n integer indexed
+ // A shorter one-liner would be
+ // $tmp = array_diff(array_keys($php_val), range(0, count($php_val)-1));
+ // but execution time skyrockets!
+ $j = 0;
+ $arr = array();
+ $ko = false;
+ foreach($php_val as $key => $val)
+ {
+ $arr[$key] =& php_xmlrpc_encode($val, $options);
+ if(!$ko && $key !== $j)
+ {
+ $ko = true;
+ }
+ $j++;
+ }
+ if($ko)
+ {
+ $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
+ }
+ else
+ {
+ $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcArray']);
+ }
+ break;
+ case 'object':
+ if(is_a($php_val, 'xmlrpcval'))
+ {
+ $xmlrpc_val = $php_val;
+ }
+ else
+ {
+ $arr = array();
+ while(list($k,$v) = each($php_val))
+ {
+ $arr[$k] = php_xmlrpc_encode($v, $options);
+ }
+ $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
+ if (in_array('encode_php_objs', $options))
+ {
+ // let's save original class name into xmlrpcval:
+ // might be useful later on...
+ $xmlrpc_val->_php_class = get_class($php_val);
+ }
+ }
+ break;
+ case 'NULL':
+ if (in_array('extension_api', $options))
+ {
+ $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']);
+ }
+ if (in_array('null_extension', $options))
+ {
+ $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']);
+ }
+ else
+ {
+ $xmlrpc_val = new xmlrpcval();
+ }
+ break;
+ case 'resource':
+ if (in_array('extension_api', $options))
+ {
+ $xmlrpc_val = new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);
+ }
+ else
+ {
+ $xmlrpc_val = new xmlrpcval();
+ }
+ // catch "user function", "unknown type"
+ default:
+ // giancarlo pinerolo <ping@alt.it>
+ // it has to return
+ // an empty object in case, not a boolean.
+ $xmlrpc_val = new xmlrpcval();
+ break;
+ }
+ return $xmlrpc_val;
+ }
+
+ /**
+ * Convert the xml representation of a method response, method request or single
+ * xmlrpc value into the appropriate object (a.k.a. deserialize)
+ * @param string $xml_val
+ * @param array $options
+ * @return mixed false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp
+ */
+ function php_xmlrpc_decode_xml($xml_val, $options=array())
+ {
+ $GLOBALS['_xh'] = array();
+ $GLOBALS['_xh']['ac'] = '';
+ $GLOBALS['_xh']['stack'] = array();
+ $GLOBALS['_xh']['valuestack'] = array();
+ $GLOBALS['_xh']['params'] = array();
+ $GLOBALS['_xh']['pt'] = array();
+ $GLOBALS['_xh']['isf'] = 0;
+ $GLOBALS['_xh']['isf_reason'] = '';
+ $GLOBALS['_xh']['method'] = false;
+ $GLOBALS['_xh']['rt'] = '';
+ /// @todo 'guestimate' encoding
+ $parser = xml_parser_create();
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+ xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+ xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee');
+ xml_set_character_data_handler($parser, 'xmlrpc_cd');
+ xml_set_default_handler($parser, 'xmlrpc_dh');
+ if(!xml_parse($parser, $xml_val, 1))
+ {
+ $errstr = sprintf('XML error: %s at line %d, column %d',
+ xml_error_string(xml_get_error_code($parser)),
+ xml_get_current_line_number($parser), xml_get_current_column_number($parser));
+ error_log($errstr);
+ xml_parser_free($parser);
+ return false;
+ }
+ xml_parser_free($parser);
+ if ($GLOBALS['_xh']['isf'] > 1) // test that $GLOBALS['_xh']['value'] is an obj, too???
+ {
+ error_log($GLOBALS['_xh']['isf_reason']);
+ return false;
+ }
+ switch ($GLOBALS['_xh']['rt'])
+ {
+ case 'methodresponse':
+ $v =& $GLOBALS['_xh']['value'];
+ if ($GLOBALS['_xh']['isf'] == 1)
+ {
+ $vc = $v->structmem('faultCode');
+ $vs = $v->structmem('faultString');
+ $r = new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval());
+ }
+ else
+ {
+ $r = new xmlrpcresp($v);
+ }
+ return $r;
+ case 'methodcall':
+ $m = new xmlrpcmsg($GLOBALS['_xh']['method']);
+ for($i=0; $i < count($GLOBALS['_xh']['params']); $i++)
+ {
+ $m->addParam($GLOBALS['_xh']['params'][$i]);
+ }
+ return $m;
+ case 'value':
+ return $GLOBALS['_xh']['value'];
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * decode a string that is encoded w/ "chunked" transfer encoding
+ * as defined in rfc2068 par. 19.4.6
+ * code shamelessly stolen from nusoap library by Dietrich Ayala
+ *
+ * @param string $buffer the string to be decoded
+ * @return string
+ */
+ function decode_chunked($buffer)
+ {
+ // length := 0
+ $length = 0;
+ $new = '';
+
+ // read chunk-size, chunk-extension (if any) and crlf
+ // get the position of the linebreak
+ $chunkend = i18n::strpos($buffer,"\r\n") + 2;
+ $temp = i18n::substr($buffer,0,$chunkend);
+ $chunk_size = hexdec( trim($temp) );
+ $chunkstart = $chunkend;
+ while($chunk_size > 0)
+ {
+ $chunkend = i18n::strpos($buffer, "\r\n", $chunkstart + $chunk_size);
+
+ // just in case we got a broken connection
+ if($chunkend == false)
+ {
+ $chunk = i18n::substr($buffer,$chunkstart);
+ // append chunk-data to entity-body
+ $new .= $chunk;
+ $length += i18n::strlen($chunk);
+ break;
+ }
+
+ // read chunk-data and crlf
+ $chunk = i18n::substr($buffer,$chunkstart,$chunkend-$chunkstart);
+ // append chunk-data to entity-body
+ $new .= $chunk;
+ // length := length + chunk-size
+ $length += i18n::strlen($chunk);
+ // read chunk-size and crlf
+ $chunkstart = $chunkend + 2;
+
+ $chunkend = i18n::strpos($buffer,"\r\n",$chunkstart)+2;
+ if($chunkend == false)
+ {
+ break; //just in case we got a broken connection
+ }
+ $temp = i18n::substr($buffer,$chunkstart,$chunkend-$chunkstart);
+ $chunk_size = hexdec( trim($temp) );
+ $chunkstart = $chunkend;
+ }
+ return $new;
+ }
+
+ /**
+ * xml charset encoding guessing helper function.
+ * Tries to determine the charset encoding of an XML chunk
+ * received over HTTP.
+ * NB: according to the spec (RFC 3023, if text/xml content-type is received over HTTP without a content-type,
+ * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,
+ * which will be most probably using UTF-8 anyway...
+ *
+ * @param string $httpheaders the http Content-type header
+ * @param string $xmlchunk xml content buffer
+ * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)
+ *
+ * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!
+ */
+ function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null)
+ {
+ // discussion: see http://www.yale.edu/pclt/encoding/
+ // 1 - test if encoding is specified in HTTP HEADERS
+
+ //Details:
+ // LWS: (\13\10)?( |\t)+
+ // token: (any char but excluded stuff)+
+ // header: Content-type = ...; charset=value(; ...)*
+ // where value is of type token, no LWS allowed between 'charset' and value
+ // Note: we do not check for invalid chars in VALUE:
+ // this had better be done using pure ereg as below
+
+ /// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it?
+ $matches = array();
+ if(preg_match('/;\s*charset=([^;]+)/i', $httpheader, $matches))
+ {
+ return strtoupper(trim($matches[1]));
+ }
+
+ // 2 - scan the first bytes of the data for a UTF-16 (or other) BOM pattern
+ // (source: http://www.w3.org/TR/2000/REC-xml-20001006)
+ // NOTE: actually, according to the spec, even if we find the BOM and determine
+ // an encoding, we should check if there is an encoding specified
+ // in the xml declaration, and verify if they match.
+ /// @todo implement check as described above?
+ /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM)
+ if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk))
+ {
+ return 'UCS-4';
+ }
+ elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk))
+ {
+ return 'UTF-16';
+ }
+ elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))
+ {
+ return 'UTF-8';
+ }
+
+ // 3 - test if encoding is specified in the xml declaration
+ // Details:
+ // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
+ // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
+ if (preg_match('/^<\?xml\s+version\s*=\s*'. "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
+ '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
+ $xmlchunk, $matches))
+ {
+ return strtoupper(i18n::substr($matches[2], 1, -1));
+ }
+
+ // 4 - if mbstring is available, let it do the guesswork
+ // NB: we favour finding an encoding that is compatible with what we can process
+ if(extension_loaded('mbstring'))
+ {
+ if($encoding_prefs)
+ {
+ $enc = mb_detect_encoding($xmlchunk, $encoding_prefs);
+ }
+ else
+ {
+ $enc = mb_detect_encoding($xmlchunk);
+ }
+ // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
+ // IANA also likes better US-ASCII, so go with it
+ if($enc == 'ASCII')
+ {
+ $enc = 'US-'.$enc;
+ }
+ return $enc;
+ }
+ else
+ {
+ // no encoding specified: as per HTTP1.1 assume it is iso-8859-1?
+ // Both RFC 2616 (HTTP 1.1) and 1945(http 1.0) clearly state that for text/xxx content types
+ // this should be the standard. And we should be getting text/xml as request and response.
+ // BUT we have to be backward compatible with the lib, which always used UTF-8 as default...
+ return $GLOBALS['xmlrpc_defencoding'];
+ }
+ }
+
+ /**
+ * Checks if a given charset encoding is present in a list of encodings or
+ * if it is a valid subset of any encoding in the list
+ * @param string $encoding charset to be tested
+ * @param mixed $validlist comma separated list of valid charsets (or array of charsets)
+ */
+ function is_valid_charset($encoding, $validlist)
+ {
+ $charset_supersets = array(
+ 'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
+ 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8',
+ 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12',
+ 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',
+ 'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN')
+ );
+ if (is_string($validlist))
+ $validlist = preg_split('#,#', $validlist);
+ if (@in_array(strtoupper($encoding), $validlist))
+ return true;
+ else
+ {
+ if (array_key_exists($encoding, $charset_supersets))
+ foreach ($validlist as $allowed)
+ if (in_array($allowed, $charset_supersets[$encoding]))
+ return true;
+ return false;
+ }
+ }
+
+?>
-<?php\r
-// by Edd Dumbill (C) 1999-2002\r
-// <edd@usefulinc.com>\r
-// $Original: xmlrpcs.inc,v 1.66 2006/09/17 21:25:06 ggiunta Exp $\r
-// $Id: xmlrpcs.inc.php 1539 2011-06-23 10:40:01Z sakamocchi $\r
-\r
-// Copyright (c) 1999,2000,2002 Edd Dumbill.\r
-// All rights reserved.\r
-//\r
-// Redistribution and use in source and binary forms, with or without\r
-// modification, are permitted provided that the following conditions\r
-// are met:\r
-//\r
-// * Redistributions of source code must retain the above copyright\r
-// notice, this list of conditions and the following disclaimer.\r
-//\r
-// * Redistributions in binary form must reproduce the above\r
-// copyright notice, this list of conditions and the following\r
-// disclaimer in the documentation and/or other materials provided\r
-// with the distribution.\r
-//\r
-// * Neither the name of the "XML-RPC for PHP" nor the names of its\r
-// contributors may be used to endorse or promote products derived\r
-// from this software without specific prior written permission.\r
-//\r
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
-// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
-// OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
- // XML RPC Server class\r
- // requires: xmlrpc.inc\r
-\r
- $GLOBALS['xmlrpcs_capabilities'] = array(\r
- // xmlrpc spec: always supported\r
- 'xmlrpc' => new xmlrpcval(array(\r
- 'specUrl' => new xmlrpcval('http://www.xmlrpc.com/spec', 'string'),\r
- 'specVersion' => new xmlrpcval(1, 'int')\r
- ), 'struct'),\r
- // if we support system.xxx functions, we always support multicall, too...\r
- // Note that, as of 2006/09/17, the following URL does not respond anymore\r
- 'system.multicall' => new xmlrpcval(array(\r
- 'specUrl' => new xmlrpcval('http://www.xmlrpc.com/discuss/msgReader$1208', 'string'),\r
- 'specVersion' => new xmlrpcval(1, 'int')\r
- ), 'struct'),\r
- // introspection: version 2! we support 'mixed', too\r
- 'introspection' => new xmlrpcval(array(\r
- 'specUrl' => new xmlrpcval('http://phpxmlrpc.sourceforge.net/doc-2/ch10.html', 'string'),\r
- 'specVersion' => new xmlrpcval(2, 'int')\r
- ), 'struct')\r
- );\r
-\r
- /* Functions that implement system.XXX methods of xmlrpc servers */\r
- $_xmlrpcs_getCapabilities_sig=array(array($GLOBALS['xmlrpcStruct']));\r
- $_xmlrpcs_getCapabilities_doc='This method lists all the capabilites that the XML-RPC server has: the (more or less standard) extensions to the xmlrpc spec that it adheres to';\r
- $_xmlrpcs_getCapabilities_sdoc=array(array('list of capabilities, described as structs with a version number and url for the spec'));\r
- function _xmlrpcs_getCapabilities($server, $m=null)\r
- {\r
- $outAr = $GLOBALS['xmlrpcs_capabilities'];\r
- // NIL extension\r
- if ($GLOBALS['xmlrpc_null_extension']) {\r
- $outAr['nil'] = new xmlrpcval(array(\r
- 'specUrl' => new xmlrpcval('http://www.ontosys.com/xml-rpc/extensions.php', 'string'),\r
- 'specVersion' => new xmlrpcval(1, 'int')\r
- ), 'struct');\r
- }\r
- return new xmlrpcresp(new xmlrpcval($outAr, 'struct'));\r
- }\r
-\r
- // listMethods: signature was either a string, or nothing.\r
- // The useless string variant has been removed\r
- $_xmlrpcs_listMethods_sig=array(array($GLOBALS['xmlrpcArray']));\r
- $_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';\r
- $_xmlrpcs_listMethods_sdoc=array(array('list of method names'));\r
- function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing\r
- {\r
-\r
- $outAr=array();\r
- foreach($server->dmap as $key => $val)\r
- {\r
- $outAr[] = new xmlrpcval($key, 'string');\r
- }\r
- if($server->allow_system_funcs)\r
- {\r
- foreach($GLOBALS['_xmlrpcs_dmap'] as $key => $val)\r
- {\r
- $outAr[] = new xmlrpcval($key, 'string');\r
- }\r
- }\r
- return new xmlrpcresp(new xmlrpcval($outAr, 'array'));\r
- }\r
-\r
- $_xmlrpcs_methodSignature_sig=array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcString']));\r
- $_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';\r
- $_xmlrpcs_methodSignature_sdoc=array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described'));\r
- function _xmlrpcs_methodSignature($server, $m)\r
- {\r
- // let accept as parameter both an xmlrpcval or string\r
- if (is_object($m))\r
- {\r
- $methName=$m->getParam(0);\r
- $methName=$methName->scalarval();\r
- }\r
- else\r
- {\r
- $methName=$m;\r
- }\r
- if(i18n::strpos($methName, "system.") === 0)\r
- {\r
- $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;\r
- }\r
- else\r
- {\r
- $dmap=$server->dmap; $sysCall=0;\r
- }\r
- if(isset($dmap[$methName]))\r
- {\r
- if(isset($dmap[$methName]['signature']))\r
- {\r
- $sigs=array();\r
- foreach($dmap[$methName]['signature'] as $inSig)\r
- {\r
- $cursig=array();\r
- foreach($inSig as $sig)\r
- {\r
- $cursig[]= new xmlrpcval($sig, 'string');\r
- }\r
- $sigs[] = new xmlrpcval($cursig, 'array');\r
- }\r
- $r= new xmlrpcresp(new xmlrpcval($sigs, 'array'));\r
- }\r
- else\r
- {\r
- // NB: according to the official docs, we should be returning a\r
- // "none-array" here, which means not-an-array\r
- $r = new xmlrpcresp(new xmlrpcval('undef', 'string'));\r
- }\r
- }\r
- else\r
- {\r
- $r = new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);\r
- }\r
- return $r;\r
- }\r
-\r
- $_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));\r
- $_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';\r
- $_xmlrpcs_methodHelp_sdoc=array(array('method description', 'name of the method to be described'));\r
- function _xmlrpcs_methodHelp($server, $m)\r
- {\r
- // let accept as parameter both an xmlrpcval or string\r
- if (is_object($m))\r
- {\r
- $methName=$m->getParam(0);\r
- $methName=$methName->scalarval();\r
- }\r
- else\r
- {\r
- $methName=$m;\r
- }\r
- if(i18n::strpos($methName, "system.") === 0)\r
- {\r
- $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;\r
- }\r
- else\r
- {\r
- $dmap=$server->dmap; $sysCall=0;\r
- }\r
- if(isset($dmap[$methName]))\r
- {\r
- if(isset($dmap[$methName]['docstring']))\r
- {\r
- $r = new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string');\r
- }\r
- else\r
- {\r
- $r = new xmlrpcresp(new xmlrpcval('', 'string'));\r
- }\r
- }\r
- else\r
- {\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);\r
- }\r
- return $r;\r
- }\r
-\r
- $_xmlrpcs_multicall_sig = array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcArray']));\r
- $_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details';\r
- $_xmlrpcs_multicall_sdoc = array(array('list of response structs, where each struct has the usual members', 'list of calls, with each call being represented as a struct, with members "methodname" and "params"'));\r
- function _xmlrpcs_multicall_error($err)\r
- {\r
- if(is_string($err))\r
- {\r
- $str = $GLOBALS['xmlrpcstr']["multicall_${err}"];\r
- $code = $GLOBALS['xmlrpcerr']["multicall_${err}"];\r
- }\r
- else\r
- {\r
- $code = $err->faultCode();\r
- $str = $err->faultString();\r
- }\r
- $struct = array();\r
- $struct['faultCode'] = new xmlrpcval($code, 'int');\r
- $struct['faultString'] = new xmlrpcval($str, 'string');\r
- return new xmlrpcval($struct, 'struct');\r
- }\r
-\r
- function _xmlrpcs_multicall_do_call($server, $call)\r
- {\r
- if($call->kindOf() != 'struct')\r
- {\r
- return _xmlrpcs_multicall_error('notstruct');\r
- }\r
- $methName = @$call->structmem('methodName');\r
- if(!$methName)\r
- {\r
- return _xmlrpcs_multicall_error('nomethod');\r
- }\r
- if($methName->kindOf() != 'scalar' || $methName->scalartyp() != 'string')\r
- {\r
- return _xmlrpcs_multicall_error('notstring');\r
- }\r
- if($methName->scalarval() == 'system.multicall')\r
- {\r
- return _xmlrpcs_multicall_error('recursion');\r
- }\r
-\r
- $params = @$call->structmem('params');\r
- if(!$params)\r
- {\r
- return _xmlrpcs_multicall_error('noparams');\r
- }\r
- if($params->kindOf() != 'array')\r
- {\r
- return _xmlrpcs_multicall_error('notarray');\r
- }\r
- $numParams = $params->arraysize();\r
-\r
- $msg = new xmlrpcmsg($methName->scalarval());\r
- for($i = 0; $i < $numParams; $i++)\r
- {\r
- if(!$msg->addParam($params->arraymem($i)))\r
- {\r
- $i++;\r
- return _xmlrpcs_multicall_error(new xmlrpcresp(0,\r
- $GLOBALS['xmlrpcerr']['incorrect_params'],\r
- $GLOBALS['xmlrpcstr']['incorrect_params'] . ": probable xml error in param " . $i));\r
- }\r
- }\r
-\r
- $result = $server->execute($msg);\r
-\r
- if($result->faultCode() != 0)\r
- {\r
- return _xmlrpcs_multicall_error($result); // Method returned fault.\r
- }\r
-\r
- return new xmlrpcval(array($result->value()), 'array');\r
- }\r
-\r
- function _xmlrpcs_multicall_do_call_phpvals($server, $call)\r
- {\r
- if(!is_array($call))\r
- {\r
- return _xmlrpcs_multicall_error('notstruct');\r
- }\r
- if(!array_key_exists('methodName', $call))\r
- {\r
- return _xmlrpcs_multicall_error('nomethod');\r
- }\r
- if (!is_string($call['methodName']))\r
- {\r
- return _xmlrpcs_multicall_error('notstring');\r
- }\r
- if($call['methodName'] == 'system.multicall')\r
- {\r
- return _xmlrpcs_multicall_error('recursion');\r
- }\r
- if(!array_key_exists('params', $call))\r
- {\r
- return _xmlrpcs_multicall_error('noparams');\r
- }\r
- if(!is_array($call['params']))\r
- {\r
- return _xmlrpcs_multicall_error('notarray');\r
- }\r
-\r
- // this is a real dirty and simplistic hack, since we might have received a\r
- // base64 or datetime values, but they will be listed as strings here...\r
- $numParams = count($call['params']);\r
- $pt = array();\r
- foreach($call['params'] as $val)\r
- $pt[] = php_2_xmlrpc_type(gettype($val));\r
-\r
- $result = $server->execute($call['methodName'], $call['params'], $pt);\r
-\r
- if($result->faultCode() != 0)\r
- {\r
- return _xmlrpcs_multicall_error($result); // Method returned fault.\r
- }\r
-\r
- return new xmlrpcval(array($result->value()), 'array');\r
- }\r
-\r
- function _xmlrpcs_multicall($server, $m)\r
- {\r
- $result = array();\r
- // let accept a plain list of php parameters, beside a single xmlrpc msg object\r
- if (is_object($m))\r
- {\r
- $calls = $m->getParam(0);\r
- $numCalls = $calls->arraysize();\r
- for($i = 0; $i < $numCalls; $i++)\r
- {\r
- $call = $calls->arraymem($i);\r
- $result[$i] = _xmlrpcs_multicall_do_call($server, $call);\r
- }\r
- }\r
- else\r
- {\r
- $numCalls=count($m);\r
- for($i = 0; $i < $numCalls; $i++)\r
- {\r
- $result[$i] = _xmlrpcs_multicall_do_call_phpvals($server, $m[$i]);\r
- }\r
- }\r
-\r
- return new xmlrpcresp(new xmlrpcval($result, 'array'));\r
- }\r
-\r
- $GLOBALS['_xmlrpcs_dmap']=array(\r
- 'system.listMethods' => array(\r
- 'function' => '_xmlrpcs_listMethods',\r
- 'signature' => $_xmlrpcs_listMethods_sig,\r
- 'docstring' => $_xmlrpcs_listMethods_doc,\r
- 'signature_docs' => $_xmlrpcs_listMethods_sdoc),\r
- 'system.methodHelp' => array(\r
- 'function' => '_xmlrpcs_methodHelp',\r
- 'signature' => $_xmlrpcs_methodHelp_sig,\r
- 'docstring' => $_xmlrpcs_methodHelp_doc,\r
- 'signature_docs' => $_xmlrpcs_methodHelp_sdoc),\r
- 'system.methodSignature' => array(\r
- 'function' => '_xmlrpcs_methodSignature',\r
- 'signature' => $_xmlrpcs_methodSignature_sig,\r
- 'docstring' => $_xmlrpcs_methodSignature_doc,\r
- 'signature_docs' => $_xmlrpcs_methodSignature_sdoc),\r
- 'system.multicall' => array(\r
- 'function' => '_xmlrpcs_multicall',\r
- 'signature' => $_xmlrpcs_multicall_sig,\r
- 'docstring' => $_xmlrpcs_multicall_doc,\r
- 'signature_docs' => $_xmlrpcs_multicall_sdoc),\r
- 'system.getCapabilities' => array(\r
- 'function' => '_xmlrpcs_getCapabilities',\r
- 'signature' => $_xmlrpcs_getCapabilities_sig,\r
- 'docstring' => $_xmlrpcs_getCapabilities_doc,\r
- 'signature_docs' => $_xmlrpcs_getCapabilities_sdoc)\r
- );\r
-\r
- $GLOBALS['_xmlrpcs_occurred_errors'] = '';\r
- $GLOBALS['_xmlrpcs_prev_ehandler'] = '';\r
- /**\r
- * Error handler used to track errors that occur during server-side execution of PHP code.\r
- * This allows to report back to the client whether an internal error has occurred or not\r
- * using an xmlrpc response object, instead of letting the client deal with the html junk\r
- * that a PHP execution error on the server generally entails.\r
- *\r
- * NB: in fact a user defined error handler can only handle WARNING, NOTICE and USER_* errors.\r
- *\r
- */\r
- function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, $lineno=null, $context=null)\r
- {\r
- // obey the @ protocol\r
- if (error_reporting() == 0)\r
- return;\r
-\r
- //if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode != E_USER_NOTICE && $errcode != E_USER_WARNING)\r
- if($errcode != 2048) // do not use E_STRICT by name, since on PHP 4 it will not be defined\r
- {\r
- $GLOBALS['_xmlrpcs_occurred_errors'] = $GLOBALS['_xmlrpcs_occurred_errors'] . $errstring . "\n";\r
- }\r
- // Try to avoid as much as possible disruption to the previous error handling\r
- // mechanism in place\r
- if($GLOBALS['_xmlrpcs_prev_ehandler'] == '')\r
- {\r
- // The previous error handler was the default: all we should do is log error\r
- // to the default error log (if level high enough)\r
- if(ini_get('log_errors') && (intval(ini_get('error_reporting')) & $errcode))\r
- {\r
- error_log($errstring);\r
- }\r
- }\r
- else\r
- {\r
- // Pass control on to previous error handler, trying to avoid loops...\r
- if($GLOBALS['_xmlrpcs_prev_ehandler'] != '_xmlrpcs_errorHandler')\r
- {\r
- // NB: this code will NOT work on php < 4.0.2: only 2 params were used for error handlers\r
- if(is_array($GLOBALS['_xmlrpcs_prev_ehandler']))\r
- {\r
- $GLOBALS['_xmlrpcs_prev_ehandler'][0]->$GLOBALS['_xmlrpcs_prev_ehandler'][1]($errcode, $errstring, $filename, $lineno, $context);\r
- }\r
- else\r
- {\r
- $GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, $context);\r
- }\r
- }\r
- }\r
- }\r
-\r
- $GLOBALS['_xmlrpc_debuginfo']='';\r
-\r
- /**\r
- * Add a string to the debug info that can be later seralized by the server\r
- * as part of the response message.\r
- * Note that for best compatbility, the debug string should be encoded using\r
- * the $GLOBALS['xmlrpc_internalencoding'] character set.\r
- * @param string $m\r
- * @access public\r
- */\r
- function xmlrpc_debugmsg($m)\r
- {\r
- $GLOBALS['_xmlrpc_debuginfo'] .= $m . "\n";\r
- }\r
-\r
- class xmlrpc_server\r
- {\r
- /// array defining php functions exposed as xmlrpc methods by this server\r
- var $dmap=array();\r
- /**\r
- * Defines how functions in dmap will be invokde: either using an xmlrpc msg object\r
- * or plain php values.\r
- * valid strings are 'xmlrpcvals', 'phpvals' or 'epivals'\r
- */\r
- var $functions_parameters_type='xmlrpcvals';\r
- /// controls wether the server is going to echo debugging messages back to the client as comments in response body. valid values: 0,1,2,3\r
- var $debug = 1;\r
- /**\r
- * When set to true, it will enable HTTP compression of the response, in case\r
- * the client has declared its support for compression in the request.\r
- */\r
- var $compress_response = false;\r
- /**\r
- * List of http compression methods accepted by the server for requests.\r
- * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib\r
- */\r
- var $accepted_compression = array();\r
- /// shall we serve calls to system.* methods?\r
- var $allow_system_funcs = true;\r
- /// list of charset encodings natively accepted for requests\r
- var $accepted_charset_encodings = array();\r
- /**\r
- * charset encoding to be used for response.\r
- * NB: if we can, we will convert the generated response from internal_encoding to the intended one.\r
- * can be: a supported xml encoding (only UTF-8 and ISO-8859-1 at present, unless mbstring is enabled),\r
- * null (leave unspecified in response, convert output stream to US_ASCII),\r
- * 'default' (use xmlrpc library default as specified in xmlrpc.inc, convert output stream if needed),\r
- * or 'auto' (use client-specified charset encoding or same as request if request headers do not specify it (unless request is US-ASCII: then use library default anyway).\r
- * NB: pretty dangerous if you accept every charset and do not have mbstring enabled)\r
- */\r
- var $response_charset_encoding = '';\r
- /// storage for internal debug info\r
- var $debug_info = '';\r
- /// extra data passed at runtime to method handling functions. Used only by EPI layer\r
- var $user_data = null;\r
-\r
- /**\r
- * @param array $dispmap the dispatch map withd efinition of exposed services\r
- * @param boolean $servicenow set to false to prevent the server from runnung upon construction\r
- */\r
- function xmlrpc_server($dispMap=null, $serviceNow=true)\r
- {\r
- // if ZLIB is enabled, let the server by default accept compressed requests,\r
- // and compress responses sent to clients that support them\r
- if(function_exists('gzinflate'))\r
- {\r
- $this->accepted_compression = array('gzip', 'deflate');\r
- $this->compress_response = true;\r
- }\r
-\r
- // by default the xml parser can support these 3 charset encodings\r
- $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');\r
-\r
- // dispMap is a dispatch array of methods\r
- // mapped to function names and signatures\r
- // if a method\r
- // doesn't appear in the map then an unknown\r
- // method error is generated\r
- /* milosch - changed to make passing dispMap optional.\r
- * instead, you can use the class add_to_map() function\r
- * to add functions manually (borrowed from SOAPX4)\r
- */\r
- if($dispMap)\r
- {\r
- $this->dmap = $dispMap;\r
- if($serviceNow)\r
- {\r
- $this->service();\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Set debug level of server.\r
- * @param integer $in debug lvl: determines info added to xmlrpc responses (as xml comments)\r
- * 0 = no debug info,\r
- * 1 = msgs set from user with debugmsg(),\r
- * 2 = add complete xmlrpc request (headers and body),\r
- * 3 = add also all processing warnings happened during method processing\r
- * (NB: this involves setting a custom error handler, and might interfere\r
- * with the standard processing of the php function exposed as method. In\r
- * particular, triggering an USER_ERROR level error will not halt script\r
- * execution anymore, but just end up logged in the xmlrpc response)\r
- * Note that info added at elevel 2 and 3 will be base64 encoded\r
- * @access public\r
- */\r
- function setDebug($in)\r
- {\r
- $this->debug=$in;\r
- }\r
-\r
- /**\r
- * Return a string with the serialized representation of all debug info\r
- * @param string $charset_encoding the target charset encoding for the serialization\r
- * @return string an XML comment (or two)\r
- */\r
- function serializeDebug($charset_encoding='')\r
- {\r
- // Tough encoding problem: which internal charset should we assume for debug info?\r
- // It might contain a copy of raw data received from client, ie with unknown encoding,\r
- // intermixed with php generated data and user generated data...\r
- // so we split it: system debug is base 64 encoded,\r
- // user debug info should be encoded by the end user using the INTERNAL_ENCODING\r
- $out = '';\r
- if ($this->debug_info != '')\r
- {\r
- $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";\r
- }\r
- if($GLOBALS['_xmlrpc_debuginfo']!='')\r
- {\r
-\r
- $out .= "<!-- DEBUG INFO:\n" . xmlrpc_encode_entitites(str_replace('--', '_-', $GLOBALS['_xmlrpc_debuginfo']), $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "\n-->\n";\r
- // NB: a better solution MIGHT be to use CDATA, but we need to insert it\r
- // into return payload AFTER the beginning tag\r
- //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', $GLOBALS['_xmlrpc_debuginfo']) . "\n]]>\n";\r
- }\r
- return $out;\r
- }\r
-\r
- /**\r
- * Execute the xmlrpc request, printing the response\r
- * @param string $data the request body. If null, the http POST request will be examined\r
- * @return xmlrpcresp the response object (usually not used by caller...)\r
- * @access public\r
- */\r
- function service($data=null, $return_payload=false)\r
- {\r
- if ($data === null)\r
- {\r
- $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';\r
- }\r
- $raw_data = $data;\r
-\r
- // reset internal debug info\r
- $this->debug_info = '';\r
-\r
- // Echo back what we received, before parsing it\r
- if($this->debug > 1)\r
- {\r
- $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");\r
- }\r
-\r
- $r = $this->parseRequestHeaders($data, $req_charset, $resp_charset, $resp_encoding);\r
- if (!$r)\r
- {\r
- $r=$this->parseRequest($data, $req_charset);\r
- }\r
-\r
- // save full body of request into response, for more debugging usages\r
- $r->raw_data = $raw_data;\r
-\r
- if($this->debug > 2 && $GLOBALS['_xmlrpcs_occurred_errors'])\r
- {\r
- $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .\r
- $GLOBALS['_xmlrpcs_occurred_errors'] . "+++END+++");\r
- }\r
-\r
- $payload=$this->xml_header($resp_charset);\r
- if($this->debug > 0)\r
- {\r
- $payload = $payload . $this->serializeDebug($resp_charset);\r
- }\r
-\r
- // G. Giunta 2006-01-27: do not create response serialization if it has\r
- // already happened. Helps building json magic\r
- if (empty($r->payload))\r
- {\r
- $r->serialize($resp_charset);\r
- }\r
- $payload = $payload . $r->payload;\r
-\r
- if ($return_payload)\r
- {\r
- return $payload;\r
- }\r
-\r
- // if we get a warning/error that has output some text before here, then we cannot\r
- // add a new header. We cannot say we are sending xml, either...\r
- if(!headers_sent())\r
- {\r
- header('Content-Type: '.$r->content_type);\r
- // we do not know if client actually told us an accepted charset, but if he did\r
- // we have to tell him what we did\r
- header("Vary: Accept-Charset");\r
-\r
- // http compression of output: only\r
- // if we can do it, and we want to do it, and client asked us to,\r
- // and php ini settings do not force it already\r
- $php_no_self_compress = ini_get('zlib.output_compression') == '' && (ini_get('output_handler') != 'ob_gzhandler');\r
- if($this->compress_response && function_exists('gzencode') && $resp_encoding != ''\r
- && $php_no_self_compress)\r
- {\r
- if(i18n::strpos($resp_encoding, 'gzip') !== false)\r
- {\r
- $payload = gzencode($payload);\r
- header("Content-Encoding: gzip");\r
- header("Vary: Accept-Encoding");\r
- }\r
- elseif (i18n::strpos($resp_encoding, 'deflate') !== false)\r
- {\r
- $payload = gzcompress($payload);\r
- header("Content-Encoding: deflate");\r
- header("Vary: Accept-Encoding");\r
- }\r
- }\r
-\r
- // do not ouput content-length header if php is compressing output for us:\r
- // it will mess up measurements\r
- if($php_no_self_compress)\r
- {\r
- header('Content-Length: ' . (int)i18n::strlen($payload));\r
- }\r
- }\r
- else\r
- {\r
- error_log('XML-RPC: xmlrpc_server::service: http headers already sent before response is fully generated. Check for php warning or error messages');\r
- }\r
-\r
- print $payload;\r
-\r
- // return request, in case subclasses want it\r
- return $r;\r
- }\r
-\r
- /**\r
- * Add a method to the dispatch map\r
- * @param string $methodname the name with which the method will be made available\r
- * @param string $function the php function that will get invoked\r
- * @param array $sig the array of valid method signatures\r
- * @param string $doc method documentation\r
- * @access public\r
- */\r
- function add_to_map($methodname,$function,$sig=null,$doc='')\r
- {\r
- $this->dmap[$methodname] = array(\r
- 'function' => $function,\r
- 'docstring' => $doc\r
- );\r
- if ($sig)\r
- {\r
- $this->dmap[$methodname]['signature'] = $sig;\r
- }\r
- }\r
-\r
- /**\r
- * Verify type and number of parameters received against a list of known signatures\r
- * @param array $in array of either xmlrpcval objects or xmlrpc type definitions\r
- * @param array $sig array of known signatures to match against\r
- * @access private\r
- */\r
- function verifySignature($in, $sig)\r
- {\r
- // check each possible signature in turn\r
- if (is_object($in))\r
- {\r
- $numParams = $in->getNumParams();\r
- }\r
- else\r
- {\r
- $numParams = count($in);\r
- }\r
- foreach($sig as $cursig)\r
- {\r
- if(count($cursig)==$numParams+1)\r
- {\r
- $itsOK=1;\r
- for($n=0; $n<$numParams; $n++)\r
- {\r
- if (is_object($in))\r
- {\r
- $p=$in->getParam($n);\r
- if($p->kindOf() == 'scalar')\r
- {\r
- $pt=$p->scalartyp();\r
- }\r
- else\r
- {\r
- $pt=$p->kindOf();\r
- }\r
- }\r
- else\r
- {\r
- $pt= $in[$n] == 'i4' ? 'int' : $in[$n]; // dispatch maps never use i4...\r
- }\r
-\r
- // param index is $n+1, as first member of sig is return type\r
- if($pt != $cursig[$n+1] && $cursig[$n+1] != $GLOBALS['xmlrpcValue'])\r
- {\r
- $itsOK=0;\r
- $pno=$n+1;\r
- $wanted=$cursig[$n+1];\r
- $got=$pt;\r
- break;\r
- }\r
- }\r
- if($itsOK)\r
- {\r
- return array(1,'');\r
- }\r
- }\r
- }\r
- if(isset($wanted))\r
- {\r
- return array(0, "Wanted ${wanted}, got ${got} at param ${pno}");\r
- }\r
- else\r
- {\r
- return array(0, "No method signature matches number of parameters");\r
- }\r
- }\r
-\r
- /**\r
- * Parse http headers received along with xmlrpc request. If needed, inflate request\r
- * @return null on success or an xmlrpcresp\r
- * @access private\r
- */\r
- function parseRequestHeaders(&$data, &$req_encoding, &$resp_encoding, &$resp_compression)\r
- {\r
- // Play nice to PHP 4.0.x: superglobals were not yet invented...\r
- if(!isset($_SERVER))\r
- {\r
- $_SERVER = $GLOBALS['HTTP_SERVER_VARS'];\r
- }\r
-\r
- if($this->debug > 1)\r
- {\r
- if(function_exists('getallheaders'))\r
- {\r
- $this->debugmsg(''); // empty line\r
- foreach(getallheaders() as $name => $val)\r
- {\r
- $this->debugmsg("HEADER: $name: $val");\r
- }\r
- }\r
-\r
- }\r
-\r
- if(isset($_SERVER['HTTP_CONTENT_ENCODING']))\r
- {\r
- $content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);\r
- }\r
- else\r
- {\r
- $content_encoding = '';\r
- }\r
-\r
- // check if request body has been compressed and decompress it\r
- if($content_encoding != '' && i18n::strlen($data))\r
- {\r
- if($content_encoding == 'deflate' || $content_encoding == 'gzip')\r
- {\r
- // if decoding works, use it. else assume data wasn't gzencoded\r
- if(function_exists('gzinflate') && in_array($content_encoding, $this->accepted_compression))\r
- {\r
- if($content_encoding == 'deflate' && $degzdata = @gzuncompress($data))\r
- {\r
- $data = $degzdata;\r
- if($this->debug > 1)\r
- {\r
- $this->debugmsg("\n+++INFLATED REQUEST+++[".i18n::strlen($data)." chars]+++\n" . $data . "\n+++END+++");\r
- }\r
- }\r
- elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(i18n::substr($data, 10)))\r
- {\r
- $data = $degzdata;\r
- if($this->debug > 1)\r
- $this->debugmsg("+++INFLATED REQUEST+++[".i18n::strlen($data)." chars]+++\n" . $data . "\n+++END+++");\r
- }\r
- else\r
- {\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']);\r
- return $r;\r
- }\r
- }\r
- else\r
- {\r
- //error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');\r
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']);\r
- return $r;\r
- }\r
- }\r
- }\r
-\r
- // check if client specified accepted charsets, and if we know how to fulfill\r
- // the request\r
- if ($this->response_charset_encoding == 'auto')\r
- {\r
- $resp_encoding = '';\r
- if (isset($_SERVER['HTTP_ACCEPT_CHARSET']))\r
- {\r
- // here we should check if we can match the client-requested encoding\r
- // with the encodings we know we can generate.\r
- /// @todo we should parse q=0.x preferences instead of getting first charset specified...\r
- $client_accepted_charsets = preg_split('#,#', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']));\r
- // Give preference to internal encoding\r
- $known_charsets = array($this->internal_encoding, 'UTF-8', 'ISO-8859-1', 'US-ASCII');\r
- foreach ($known_charsets as $charset)\r
- {\r
- foreach ($client_accepted_charsets as $accepted)\r
- if (i18n::strpos($accepted, $charset) === 0)\r
- {\r
- $resp_encoding = $charset;\r
- break;\r
- }\r
- if ($resp_encoding)\r
- break;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- $resp_encoding = $this->response_charset_encoding;\r
- }\r
-\r
- if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))\r
- {\r
- $resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING'];\r
- }\r
- else\r
- {\r
- $resp_compression = '';\r
- }\r
-\r
- // 'guestimate' request encoding\r
- /// @todo check if mbstring is enabled and automagic input conversion is on: it might mingle with this check???\r
- $req_encoding = guess_encoding(isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '',\r
- $data);\r
-\r
- return null;\r
- }\r
-\r
- /**\r
- * Parse an xml chunk containing an xmlrpc request and execute the corresponding\r
- * php function registered with the server\r
- * @param string $data the xml request\r
- * @param string $req_encoding (optional) the charset encoding of the xml request\r
- * @return xmlrpcresp\r
- * @access private\r
- */\r
- function parseRequest($data, $req_encoding='')\r
- {\r
- // 2005/05/07 commented and moved into caller function code\r
- //if($data=='')\r
- //{\r
- // $data=$GLOBALS['HTTP_RAW_POST_DATA'];\r
- //}\r
-\r
- // G. Giunta 2005/02/13: we do NOT expect to receive html entities\r
- // so we do not try to convert them into xml character entities\r
- //$data = xmlrpc_html_entity_xlate($data);\r
-\r
- $GLOBALS['_xh']=array();\r
- $GLOBALS['_xh']['ac']='';\r
- $GLOBALS['_xh']['stack']=array();\r
- $GLOBALS['_xh']['valuestack'] = array();\r
- $GLOBALS['_xh']['params']=array();\r
- $GLOBALS['_xh']['pt']=array();\r
- $GLOBALS['_xh']['isf']=0;\r
- $GLOBALS['_xh']['isf_reason']='';\r
- $GLOBALS['_xh']['method']=false; // so we can check later if we got a methodname or not\r
- $GLOBALS['_xh']['rt']='';\r
-\r
- // decompose incoming XML into request structure\r
- if ($req_encoding != '')\r
- {\r
- if (!in_array($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))\r
- // the following code might be better for mb_string enabled installs, but\r
- // makes the lib about 200% slower...\r
- //if (!is_valid_charset($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))\r
- {\r
- error_log('XML-RPC: xmlrpc_server::parseRequest: invalid charset encoding of received request: '.$req_encoding);\r
- $req_encoding = $GLOBALS['xmlrpc_defencoding'];\r
- }\r
- /// @BUG this will fail on PHP 5 if charset is not specified in the xml prologue,\r
- // the encoding is not UTF8 and there are non-ascii chars in the text...\r
- $parser = xml_parser_create($req_encoding);\r
- }\r
- else\r
- {\r
- $parser = xml_parser_create();\r
- }\r
-\r
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);\r
- // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell\r
- // the xml parser to give us back data in the expected charset\r
- xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);\r
-\r
- if ($this->functions_parameters_type != 'xmlrpcvals')\r
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');\r
- else\r
- xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');\r
- xml_set_character_data_handler($parser, 'xmlrpc_cd');\r
- xml_set_default_handler($parser, 'xmlrpc_dh');\r
- if(!xml_parse($parser, $data, 1))\r
- {\r
- // return XML error as a faultCode\r
- $r = new xmlrpcresp(0,\r
- $GLOBALS['xmlrpcerrxml']+xml_get_error_code($parser),\r
- sprintf('XML error: %s at line %d, column %d',\r
- xml_error_string(xml_get_error_code($parser)),\r
- xml_get_current_line_number($parser), xml_get_current_column_number($parser)));\r
- xml_parser_free($parser);\r
- }\r
- elseif ($GLOBALS['_xh']['isf'])\r
- {\r
- xml_parser_free($parser);\r
- $r = new xmlrpcresp(0,\r
- $GLOBALS['xmlrpcerr']['invalid_request'],\r
- $GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']);\r
- }\r
- else\r
- {\r
- xml_parser_free($parser);\r
- if ($this->functions_parameters_type != 'xmlrpcvals')\r
- {\r
- if($this->debug > 1)\r
- {\r
- $this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], true)."\n+++END+++");\r
- }\r
- $r = $this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], $GLOBALS['_xh']['pt']);\r
- }\r
- else\r
- {\r
- // build an xmlrpcmsg object with data parsed from xml\r
- $m= new xmlrpcmsg($GLOBALS['_xh']['method']);\r
- // now add parameters in\r
- for($i=0; $i<count($GLOBALS['_xh']['params']); $i++)\r
- {\r
- $m->addParam($GLOBALS['_xh']['params'][$i]);\r
- }\r
-\r
- if($this->debug > 1)\r
- {\r
- $this->debugmsg("\n+++PARSED+++\n".var_export($m, true)."\n+++END+++");\r
- }\r
-\r
- $r = $this->execute($m);\r
- }\r
- }\r
- return $r;\r
- }\r
-\r
- /**\r
- * Execute a method invoked by the client, checking parameters used\r
- * @param mixed $m either an xmlrpcmsg obj or a method name\r
- * @param array $params array with method parameters as php types (if m is method name only)\r
- * @param array $paramtypes array with xmlrpc types of method parameters (if m is method name only)\r
- * @return xmlrpcresp\r
- * @access private\r
- */\r
- function execute($m, $params=null, $paramtypes=null)\r
- {\r
- if (is_object($m))\r
- {\r
- $methName = $m->method();\r
- }\r
- else\r
- {\r
- $methName = $m;\r
- }\r
- $sysCall = $this->allow_system_funcs && (i18n::strpos($methName, "system.") === 0);\r
- $dmap = $sysCall ? $GLOBALS['_xmlrpcs_dmap'] : $this->dmap;\r
-\r
- if(!isset($dmap[$methName]['function']))\r
- {\r
- // No such method\r
- return new xmlrpcresp(0,\r
- $GLOBALS['xmlrpcerr']['unknown_method'],\r
- $GLOBALS['xmlrpcstr']['unknown_method']);\r
- }\r
-\r
- // Check signature\r
- if(isset($dmap[$methName]['signature']))\r
- {\r
- $sig = $dmap[$methName]['signature'];\r
- if (is_object($m))\r
- {\r
- list($ok, $errstr) = $this->verifySignature($m, $sig);\r
- }\r
- else\r
- {\r
- list($ok, $errstr) = $this->verifySignature($paramtypes, $sig);\r
- }\r
- if(!$ok)\r
- {\r
- // Didn't match.\r
- return new xmlrpcresp(\r
- 0,\r
- $GLOBALS['xmlrpcerr']['incorrect_params'],\r
- $GLOBALS['xmlrpcstr']['incorrect_params'] . ": ${errstr}"\r
- );\r
- }\r
- }\r
-\r
- $func = $dmap[$methName]['function'];\r
- // let the 'class::function' syntax be accepted in dispatch maps\r
- if(is_string($func) && i18n::strpos($func, '::'))\r
- {\r
- $func = preg_split('#::#', $func);\r
- }\r
- // verify that function to be invoked is in fact callable\r
- if(!is_callable($func))\r
- {\r
- error_log("XML-RPC: xmlrpc_server::execute: function $func registered as method handler is not callable");\r
- return new xmlrpcresp(\r
- 0,\r
- $GLOBALS['xmlrpcerr']['server_error'],\r
- $GLOBALS['xmlrpcstr']['server_error'] . ": no function matches method"\r
- );\r
- }\r
-\r
- // If debug level is 3, we should catch all errors generated during\r
- // processing of user function, and log them as part of response\r
- if($this->debug > 2)\r
- {\r
- $GLOBALS['_xmlrpcs_prev_ehandler'] = set_error_handler('_xmlrpcs_errorHandler');\r
- }\r
- if (is_object($m))\r
- {\r
- if($sysCall)\r
- {\r
- $r = call_user_func($func, $this, $m);\r
- }\r
- else\r
- {\r
- $r = call_user_func($func, $m);\r
- }\r
- if (!is_a($r, 'xmlrpcresp'))\r
- {\r
- error_log("XML-RPC: xmlrpc_server::execute: function $func registered as method handler does not return an xmlrpcresp object");\r
- if (is_a($r, 'xmlrpcval'))\r
- {\r
- $r = new xmlrpcresp($r);\r
- }\r
- else\r
- {\r
- $r = new xmlrpcresp(\r
- 0,\r
- $GLOBALS['xmlrpcerr']['server_error'],\r
- $GLOBALS['xmlrpcstr']['server_error'] . ": function does not return xmlrpcresp object"\r
- );\r
- }\r
- }\r
- }\r
- else\r
- {\r
- // call a 'plain php' function\r
- if($sysCall)\r
- {\r
- array_unshift($params, $this);\r
- $r = call_user_func_array($func, $params);\r
- }\r
- else\r
- {\r
- // 3rd API convention for method-handling functions: EPI-style\r
- if ($this->functions_parameters_type == 'epivals')\r
- {\r
- $r = call_user_func_array($func, array($methName, $params, $this->user_data));\r
- // mimic EPI behaviour: if we get an array that looks like an error, make it\r
- // an eror response\r
- if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r))\r
- {\r
- $r = new xmlrpcresp(0, (integer)$r['faultCode'], (string)$r['faultString']);\r
- }\r
- else\r
- {\r
- // functions using EPI api should NOT return resp objects,\r
- // so make sure we encode the return type correctly\r
- $r = new xmlrpcresp(php_xmlrpc_encode($r, array('extension_api')));\r
- }\r
- }\r
- else\r
- {\r
- $r = call_user_func_array($func, $params);\r
- }\r
- }\r
- // the return type can be either an xmlrpcresp object or a plain php value...\r
- if (!is_a($r, 'xmlrpcresp'))\r
- {\r
- // what should we assume here about automatic encoding of datetimes\r
- // and php classes instances???\r
- $r = new xmlrpcresp(php_xmlrpc_encode($r, array('auto_dates')));\r
- }\r
- }\r
- if($this->debug > 2)\r
- {\r
- // note: restore the error handler we found before calling the\r
- // user func, even if it has been changed inside the func itself\r
- if($GLOBALS['_xmlrpcs_prev_ehandler'])\r
- {\r
- set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);\r
- }\r
- else\r
- {\r
- restore_error_handler();\r
- }\r
- }\r
- return $r;\r
- }\r
-\r
- /**\r
- * add a string to the 'internal debug message' (separate from 'user debug message')\r
- * @param string $strings\r
- * @access private\r
- */\r
- function debugmsg($string)\r
- {\r
- $this->debug_info .= $string."\n";\r
- }\r
-\r
- /**\r
- * @access private\r
- */\r
- function xml_header($charset_encoding='')\r
- {\r
- if ($charset_encoding != '')\r
- {\r
- return "<?xml version=\"1.0\" encoding=\"$charset_encoding\"?" . ">\n";\r
- }\r
- else\r
- {\r
- return "<?xml version=\"1.0\"?" . ">\n";\r
- }\r
- }\r
-\r
- /**\r
- * A debugging routine: just echoes back the input packet as a string value\r
- * DEPRECATED!\r
- */\r
- function echoInput()\r
- {\r
- $r = new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . $GLOBALS['HTTP_RAW_POST_DATA'], 'string'));\r
- print $r->serialize();\r
- }\r
- }\r
-?>\r
+<?php
+// by Edd Dumbill (C) 1999-2002
+// <edd@usefulinc.com>
+// $Original: xmlrpcs.inc,v 1.66 2006/09/17 21:25:06 ggiunta Exp $
+// $Id: xmlrpcs.inc.php 1737 2012-04-10 14:32:11Z sakamocchi $
+
+// Copyright (c) 1999,2000,2002 Edd Dumbill.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+//
+// * Neither the name of the "XML-RPC for PHP" nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+// OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ // XML RPC Server class
+ // requires: xmlrpc.inc
+
+ $GLOBALS['xmlrpcs_capabilities'] = array(
+ // xmlrpc spec: always supported
+ 'xmlrpc' => new xmlrpcval(array(
+ 'specUrl' => new xmlrpcval('http://www.xmlrpc.com/spec', 'string'),
+ 'specVersion' => new xmlrpcval(1, 'int')
+ ), 'struct'),
+ // if we support system.xxx functions, we always support multicall, too...
+ // Note that, as of 2006/09/17, the following URL does not respond anymore
+ 'system.multicall' => new xmlrpcval(array(
+ 'specUrl' => new xmlrpcval('http://www.xmlrpc.com/discuss/msgReader$1208', 'string'),
+ 'specVersion' => new xmlrpcval(1, 'int')
+ ), 'struct'),
+ // introspection: version 2! we support 'mixed', too
+ 'introspection' => new xmlrpcval(array(
+ 'specUrl' => new xmlrpcval('http://phpxmlrpc.sourceforge.net/doc-2/ch10.html', 'string'),
+ 'specVersion' => new xmlrpcval(2, 'int')
+ ), 'struct')
+ );
+
+ /* Functions that implement system.XXX methods of xmlrpc servers */
+ $_xmlrpcs_getCapabilities_sig=array(array($GLOBALS['xmlrpcStruct']));
+ $_xmlrpcs_getCapabilities_doc='This method lists all the capabilites that the XML-RPC server has: the (more or less standard) extensions to the xmlrpc spec that it adheres to';
+ $_xmlrpcs_getCapabilities_sdoc=array(array('list of capabilities, described as structs with a version number and url for the spec'));
+ function _xmlrpcs_getCapabilities($server, $m=null)
+ {
+ $outAr = $GLOBALS['xmlrpcs_capabilities'];
+ // NIL extension
+ if ($GLOBALS['xmlrpc_null_extension']) {
+ $outAr['nil'] = new xmlrpcval(array(
+ 'specUrl' => new xmlrpcval('http://www.ontosys.com/xml-rpc/extensions.php', 'string'),
+ 'specVersion' => new xmlrpcval(1, 'int')
+ ), 'struct');
+ }
+ return new xmlrpcresp(new xmlrpcval($outAr, 'struct'));
+ }
+
+ // listMethods: signature was either a string, or nothing.
+ // The useless string variant has been removed
+ $_xmlrpcs_listMethods_sig=array(array($GLOBALS['xmlrpcArray']));
+ $_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
+ $_xmlrpcs_listMethods_sdoc=array(array('list of method names'));
+ function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing
+ {
+
+ $outAr=array();
+ foreach($server->dmap as $key => $val)
+ {
+ $outAr[] = new xmlrpcval($key, 'string');
+ }
+ if($server->allow_system_funcs)
+ {
+ foreach($GLOBALS['_xmlrpcs_dmap'] as $key => $val)
+ {
+ $outAr[] = new xmlrpcval($key, 'string');
+ }
+ }
+ return new xmlrpcresp(new xmlrpcval($outAr, 'array'));
+ }
+
+ $_xmlrpcs_methodSignature_sig=array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcString']));
+ $_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
+ $_xmlrpcs_methodSignature_sdoc=array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described'));
+ function _xmlrpcs_methodSignature($server, $m)
+ {
+ // let accept as parameter both an xmlrpcval or string
+ if (is_object($m))
+ {
+ $methName=$m->getParam(0);
+ $methName=$methName->scalarval();
+ }
+ else
+ {
+ $methName=$m;
+ }
+ if(i18n::strpos($methName, "system.") === 0)
+ {
+ $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
+ }
+ else
+ {
+ $dmap=$server->dmap; $sysCall=0;
+ }
+ if(isset($dmap[$methName]))
+ {
+ if(isset($dmap[$methName]['signature']))
+ {
+ $sigs=array();
+ foreach($dmap[$methName]['signature'] as $inSig)
+ {
+ $cursig=array();
+ foreach($inSig as $sig)
+ {
+ $cursig[]= new xmlrpcval($sig, 'string');
+ }
+ $sigs[] = new xmlrpcval($cursig, 'array');
+ }
+ $r= new xmlrpcresp(new xmlrpcval($sigs, 'array'));
+ }
+ else
+ {
+ // NB: according to the official docs, we should be returning a
+ // "none-array" here, which means not-an-array
+ $r = new xmlrpcresp(new xmlrpcval('undef', 'string'));
+ }
+ }
+ else
+ {
+ $r = new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
+ }
+ return $r;
+ }
+
+ $_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
+ $_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
+ $_xmlrpcs_methodHelp_sdoc=array(array('method description', 'name of the method to be described'));
+ function _xmlrpcs_methodHelp($server, $m)
+ {
+ // let accept as parameter both an xmlrpcval or string
+ if (is_object($m))
+ {
+ $methName=$m->getParam(0);
+ $methName=$methName->scalarval();
+ }
+ else
+ {
+ $methName=$m;
+ }
+ if(i18n::strpos($methName, "system.") === 0)
+ {
+ $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
+ }
+ else
+ {
+ $dmap=$server->dmap; $sysCall=0;
+ }
+ if(isset($dmap[$methName]))
+ {
+ if(isset($dmap[$methName]['docstring']))
+ {
+ $r = new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string');
+ }
+ else
+ {
+ $r = new xmlrpcresp(new xmlrpcval('', 'string'));
+ }
+ }
+ else
+ {
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
+ }
+ return $r;
+ }
+
+ $_xmlrpcs_multicall_sig = array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcArray']));
+ $_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details';
+ $_xmlrpcs_multicall_sdoc = array(array('list of response structs, where each struct has the usual members', 'list of calls, with each call being represented as a struct, with members "methodname" and "params"'));
+ function _xmlrpcs_multicall_error($err)
+ {
+ if(is_string($err))
+ {
+ $str = $GLOBALS['xmlrpcstr']["multicall_${err}"];
+ $code = $GLOBALS['xmlrpcerr']["multicall_${err}"];
+ }
+ else
+ {
+ $code = $err->faultCode();
+ $str = $err->faultString();
+ }
+ $struct = array();
+ $struct['faultCode'] = new xmlrpcval($code, 'int');
+ $struct['faultString'] = new xmlrpcval($str, 'string');
+ return new xmlrpcval($struct, 'struct');
+ }
+
+ function _xmlrpcs_multicall_do_call($server, $call)
+ {
+ if($call->kindOf() != 'struct')
+ {
+ return _xmlrpcs_multicall_error('notstruct');
+ }
+ $methName = @$call->structmem('methodName');
+ if(!$methName)
+ {
+ return _xmlrpcs_multicall_error('nomethod');
+ }
+ if($methName->kindOf() != 'scalar' || $methName->scalartyp() != 'string')
+ {
+ return _xmlrpcs_multicall_error('notstring');
+ }
+ if($methName->scalarval() == 'system.multicall')
+ {
+ return _xmlrpcs_multicall_error('recursion');
+ }
+
+ $params = @$call->structmem('params');
+ if(!$params)
+ {
+ return _xmlrpcs_multicall_error('noparams');
+ }
+ if($params->kindOf() != 'array')
+ {
+ return _xmlrpcs_multicall_error('notarray');
+ }
+ $numParams = $params->arraysize();
+
+ $msg = new xmlrpcmsg($methName->scalarval());
+ for($i = 0; $i < $numParams; $i++)
+ {
+ if(!$msg->addParam($params->arraymem($i)))
+ {
+ $i++;
+ return _xmlrpcs_multicall_error(new xmlrpcresp(0,
+ $GLOBALS['xmlrpcerr']['incorrect_params'],
+ $GLOBALS['xmlrpcstr']['incorrect_params'] . ": probable xml error in param " . $i));
+ }
+ }
+
+ $result = $server->execute($msg);
+
+ if($result->faultCode() != 0)
+ {
+ return _xmlrpcs_multicall_error($result); // Method returned fault.
+ }
+
+ return new xmlrpcval(array($result->value()), 'array');
+ }
+
+ function _xmlrpcs_multicall_do_call_phpvals($server, $call)
+ {
+ if(!is_array($call))
+ {
+ return _xmlrpcs_multicall_error('notstruct');
+ }
+ if(!array_key_exists('methodName', $call))
+ {
+ return _xmlrpcs_multicall_error('nomethod');
+ }
+ if (!is_string($call['methodName']))
+ {
+ return _xmlrpcs_multicall_error('notstring');
+ }
+ if($call['methodName'] == 'system.multicall')
+ {
+ return _xmlrpcs_multicall_error('recursion');
+ }
+ if(!array_key_exists('params', $call))
+ {
+ return _xmlrpcs_multicall_error('noparams');
+ }
+ if(!is_array($call['params']))
+ {
+ return _xmlrpcs_multicall_error('notarray');
+ }
+
+ // this is a real dirty and simplistic hack, since we might have received a
+ // base64 or datetime values, but they will be listed as strings here...
+ $numParams = count($call['params']);
+ $pt = array();
+ foreach($call['params'] as $val)
+ $pt[] = php_2_xmlrpc_type(gettype($val));
+
+ $result = $server->execute($call['methodName'], $call['params'], $pt);
+
+ if($result->faultCode() != 0)
+ {
+ return _xmlrpcs_multicall_error($result); // Method returned fault.
+ }
+
+ return new xmlrpcval(array($result->value()), 'array');
+ }
+
+ function _xmlrpcs_multicall($server, $m)
+ {
+ $result = array();
+ // let accept a plain list of php parameters, beside a single xmlrpc msg object
+ if (is_object($m))
+ {
+ $calls = $m->getParam(0);
+ $numCalls = $calls->arraysize();
+ for($i = 0; $i < $numCalls; $i++)
+ {
+ $call = $calls->arraymem($i);
+ $result[$i] = _xmlrpcs_multicall_do_call($server, $call);
+ }
+ }
+ else
+ {
+ $numCalls=count($m);
+ for($i = 0; $i < $numCalls; $i++)
+ {
+ $result[$i] = _xmlrpcs_multicall_do_call_phpvals($server, $m[$i]);
+ }
+ }
+
+ return new xmlrpcresp(new xmlrpcval($result, 'array'));
+ }
+
+ $GLOBALS['_xmlrpcs_dmap']=array(
+ 'system.listMethods' => array(
+ 'function' => '_xmlrpcs_listMethods',
+ 'signature' => $_xmlrpcs_listMethods_sig,
+ 'docstring' => $_xmlrpcs_listMethods_doc,
+ 'signature_docs' => $_xmlrpcs_listMethods_sdoc),
+ 'system.methodHelp' => array(
+ 'function' => '_xmlrpcs_methodHelp',
+ 'signature' => $_xmlrpcs_methodHelp_sig,
+ 'docstring' => $_xmlrpcs_methodHelp_doc,
+ 'signature_docs' => $_xmlrpcs_methodHelp_sdoc),
+ 'system.methodSignature' => array(
+ 'function' => '_xmlrpcs_methodSignature',
+ 'signature' => $_xmlrpcs_methodSignature_sig,
+ 'docstring' => $_xmlrpcs_methodSignature_doc,
+ 'signature_docs' => $_xmlrpcs_methodSignature_sdoc),
+ 'system.multicall' => array(
+ 'function' => '_xmlrpcs_multicall',
+ 'signature' => $_xmlrpcs_multicall_sig,
+ 'docstring' => $_xmlrpcs_multicall_doc,
+ 'signature_docs' => $_xmlrpcs_multicall_sdoc),
+ 'system.getCapabilities' => array(
+ 'function' => '_xmlrpcs_getCapabilities',
+ 'signature' => $_xmlrpcs_getCapabilities_sig,
+ 'docstring' => $_xmlrpcs_getCapabilities_doc,
+ 'signature_docs' => $_xmlrpcs_getCapabilities_sdoc)
+ );
+
+ $GLOBALS['_xmlrpcs_occurred_errors'] = '';
+ $GLOBALS['_xmlrpcs_prev_ehandler'] = '';
+ /**
+ * Error handler used to track errors that occur during server-side execution of PHP code.
+ * This allows to report back to the client whether an internal error has occurred or not
+ * using an xmlrpc response object, instead of letting the client deal with the html junk
+ * that a PHP execution error on the server generally entails.
+ *
+ * NB: in fact a user defined error handler can only handle WARNING, NOTICE and USER_* errors.
+ *
+ */
+ function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, $lineno=null, $context=null)
+ {
+ // obey the @ protocol
+ if (error_reporting() == 0)
+ return;
+
+ //if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode != E_USER_NOTICE && $errcode != E_USER_WARNING)
+ if($errcode != 2048) // do not use E_STRICT by name, since on PHP 4 it will not be defined
+ {
+ $GLOBALS['_xmlrpcs_occurred_errors'] = $GLOBALS['_xmlrpcs_occurred_errors'] . $errstring . "\n";
+ }
+ // Try to avoid as much as possible disruption to the previous error handling
+ // mechanism in place
+ if($GLOBALS['_xmlrpcs_prev_ehandler'] == '')
+ {
+ // The previous error handler was the default: all we should do is log error
+ // to the default error log (if level high enough)
+ if(ini_get('log_errors') && (intval(ini_get('error_reporting')) & $errcode))
+ {
+ error_log($errstring);
+ }
+ }
+ else
+ {
+ // Pass control on to previous error handler, trying to avoid loops...
+ if($GLOBALS['_xmlrpcs_prev_ehandler'] != '_xmlrpcs_errorHandler')
+ {
+ // NB: this code will NOT work on php < 4.0.2: only 2 params were used for error handlers
+ if(is_array($GLOBALS['_xmlrpcs_prev_ehandler']))
+ {
+ $GLOBALS['_xmlrpcs_prev_ehandler'][0]->$GLOBALS['_xmlrpcs_prev_ehandler'][1]($errcode, $errstring, $filename, $lineno, $context);
+ }
+ else
+ {
+ $GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, $context);
+ }
+ }
+ }
+ }
+
+ $GLOBALS['_xmlrpc_debuginfo']='';
+
+ /**
+ * Add a string to the debug info that can be later seralized by the server
+ * as part of the response message.
+ * Note that for best compatbility, the debug string should be encoded using
+ * the $GLOBALS['xmlrpc_internalencoding'] character set.
+ * @param string $m
+ * @access public
+ */
+ function xmlrpc_debugmsg($m)
+ {
+ $GLOBALS['_xmlrpc_debuginfo'] .= $m . "\n";
+ }
+
+ class xmlrpc_server
+ {
+ /// array defining php functions exposed as xmlrpc methods by this server
+ var $dmap=array();
+ /**
+ * Defines how functions in dmap will be invokde: either using an xmlrpc msg object
+ * or plain php values.
+ * valid strings are 'xmlrpcvals', 'phpvals' or 'epivals'
+ */
+ var $functions_parameters_type='xmlrpcvals';
+ /// controls wether the server is going to echo debugging messages back to the client as comments in response body. valid values: 0,1,2,3
+ var $debug = 1;
+ /**
+ * When set to true, it will enable HTTP compression of the response, in case
+ * the client has declared its support for compression in the request.
+ */
+ var $compress_response = false;
+ /**
+ * List of http compression methods accepted by the server for requests.
+ * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
+ */
+ var $accepted_compression = array();
+ /// shall we serve calls to system.* methods?
+ var $allow_system_funcs = true;
+ /// list of charset encodings natively accepted for requests
+ var $accepted_charset_encodings = array();
+ /**
+ * charset encoding to be used for response.
+ * NB: if we can, we will convert the generated response from internal_encoding to the intended one.
+ * can be: a supported xml encoding (only UTF-8 and ISO-8859-1 at present, unless mbstring is enabled),
+ * null (leave unspecified in response, convert output stream to US_ASCII),
+ * 'default' (use xmlrpc library default as specified in xmlrpc.inc, convert output stream if needed),
+ * or 'auto' (use client-specified charset encoding or same as request if request headers do not specify it (unless request is US-ASCII: then use library default anyway).
+ * NB: pretty dangerous if you accept every charset and do not have mbstring enabled)
+ */
+ var $response_charset_encoding = '';
+ /// storage for internal debug info
+ var $debug_info = '';
+ /// extra data passed at runtime to method handling functions. Used only by EPI layer
+ var $user_data = null;
+
+ /**
+ * @param array $dispmap the dispatch map withd efinition of exposed services
+ * @param boolean $servicenow set to false to prevent the server from runnung upon construction
+ */
+ function xmlrpc_server($dispMap=null, $serviceNow=true)
+ {
+ // if ZLIB is enabled, let the server by default accept compressed requests,
+ // and compress responses sent to clients that support them
+ if(function_exists('gzinflate'))
+ {
+ $this->accepted_compression = array('gzip', 'deflate');
+ $this->compress_response = true;
+ }
+
+ // by default the xml parser can support these 3 charset encodings
+ $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
+
+ // dispMap is a dispatch array of methods
+ // mapped to function names and signatures
+ // if a method
+ // doesn't appear in the map then an unknown
+ // method error is generated
+ /* milosch - changed to make passing dispMap optional.
+ * instead, you can use the class add_to_map() function
+ * to add functions manually (borrowed from SOAPX4)
+ */
+ if($dispMap)
+ {
+ $this->dmap = $dispMap;
+ if($serviceNow)
+ {
+ $this->service();
+ }
+ }
+ }
+
+ /**
+ * Set debug level of server.
+ * @param integer $in debug lvl: determines info added to xmlrpc responses (as xml comments)
+ * 0 = no debug info,
+ * 1 = msgs set from user with debugmsg(),
+ * 2 = add complete xmlrpc request (headers and body),
+ * 3 = add also all processing warnings happened during method processing
+ * (NB: this involves setting a custom error handler, and might interfere
+ * with the standard processing of the php function exposed as method. In
+ * particular, triggering an USER_ERROR level error will not halt script
+ * execution anymore, but just end up logged in the xmlrpc response)
+ * Note that info added at elevel 2 and 3 will be base64 encoded
+ * @access public
+ */
+ function setDebug($in)
+ {
+ $this->debug=$in;
+ }
+
+ /**
+ * Return a string with the serialized representation of all debug info
+ * @param string $charset_encoding the target charset encoding for the serialization
+ * @return string an XML comment (or two)
+ */
+ function serializeDebug($charset_encoding='')
+ {
+ // Tough encoding problem: which internal charset should we assume for debug info?
+ // It might contain a copy of raw data received from client, ie with unknown encoding,
+ // intermixed with php generated data and user generated data...
+ // so we split it: system debug is base 64 encoded,
+ // user debug info should be encoded by the end user using the INTERNAL_ENCODING
+ $out = '';
+ if ($this->debug_info != '')
+ {
+ $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
+ }
+ if($GLOBALS['_xmlrpc_debuginfo']!='')
+ {
+
+ $out .= "<!-- DEBUG INFO:\n" . xmlrpc_encode_entitites(str_replace('--', '_-', $GLOBALS['_xmlrpc_debuginfo']), $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "\n-->\n";
+ // NB: a better solution MIGHT be to use CDATA, but we need to insert it
+ // into return payload AFTER the beginning tag
+ //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', $GLOBALS['_xmlrpc_debuginfo']) . "\n]]>\n";
+ }
+ return $out;
+ }
+
+ /**
+ * Execute the xmlrpc request, printing the response
+ * @param string $data the request body. If null, the http POST request will be examined
+ * @return xmlrpcresp the response object (usually not used by caller...)
+ * @access public
+ */
+ function service($data=null, $return_payload=false)
+ {
+ if ($data === null)
+ {
+ $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
+ }
+ $raw_data = $data;
+
+ // reset internal debug info
+ $this->debug_info = '';
+
+ // Echo back what we received, before parsing it
+ if($this->debug > 1)
+ {
+ $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
+ }
+
+ $r = $this->parseRequestHeaders($data, $req_charset, $resp_charset, $resp_encoding);
+ if (!$r)
+ {
+ $r=$this->parseRequest($data, $req_charset);
+ }
+
+ // save full body of request into response, for more debugging usages
+ $r->raw_data = $raw_data;
+
+ if($this->debug > 2 && $GLOBALS['_xmlrpcs_occurred_errors'])
+ {
+ $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
+ $GLOBALS['_xmlrpcs_occurred_errors'] . "+++END+++");
+ }
+
+ $payload=$this->xml_header($resp_charset);
+ if($this->debug > 0)
+ {
+ $payload = $payload . $this->serializeDebug($resp_charset);
+ }
+
+ // G. Giunta 2006-01-27: do not create response serialization if it has
+ // already happened. Helps building json magic
+ if (empty($r->payload))
+ {
+ $r->serialize($resp_charset);
+ }
+ $payload = $payload . $r->payload;
+
+ if ($return_payload)
+ {
+ return $payload;
+ }
+
+ // if we get a warning/error that has output some text before here, then we cannot
+ // add a new header. We cannot say we are sending xml, either...
+ if(!headers_sent())
+ {
+ header('Content-Type: '.$r->content_type);
+ // we do not know if client actually told us an accepted charset, but if he did
+ // we have to tell him what we did
+ header("Vary: Accept-Charset");
+
+ // http compression of output: only
+ // if we can do it, and we want to do it, and client asked us to,
+ // and php ini settings do not force it already
+ $php_no_self_compress = ini_get('zlib.output_compression') == '' && (ini_get('output_handler') != 'ob_gzhandler');
+ if($this->compress_response && function_exists('gzencode') && $resp_encoding != ''
+ && $php_no_self_compress)
+ {
+ if(i18n::strpos($resp_encoding, 'gzip') !== false)
+ {
+ $payload = gzencode($payload);
+ header("Content-Encoding: gzip");
+ header("Vary: Accept-Encoding");
+ }
+ elseif (i18n::strpos($resp_encoding, 'deflate') !== false)
+ {
+ $payload = gzcompress($payload);
+ header("Content-Encoding: deflate");
+ header("Vary: Accept-Encoding");
+ }
+ }
+
+ // do not ouput content-length header if php is compressing output for us:
+ // it will mess up measurements
+ if($php_no_self_compress)
+ {
+ header('Content-Length: ' . (int)i18n::strlen($payload));
+ }
+ }
+ else
+ {
+ error_log('XML-RPC: xmlrpc_server::service: http headers already sent before response is fully generated. Check for php warning or error messages');
+ }
+
+ print $payload;
+
+ // return request, in case subclasses want it
+ return $r;
+ }
+
+ /**
+ * Add a method to the dispatch map
+ * @param string $methodname the name with which the method will be made available
+ * @param string $function the php function that will get invoked
+ * @param array $sig the array of valid method signatures
+ * @param string $doc method documentation
+ * @access public
+ */
+ function add_to_map($methodname,$function,$sig=null,$doc='')
+ {
+ $this->dmap[$methodname] = array(
+ 'function' => $function,
+ 'docstring' => $doc
+ );
+ if ($sig)
+ {
+ $this->dmap[$methodname]['signature'] = $sig;
+ }
+ }
+
+ /**
+ * Verify type and number of parameters received against a list of known signatures
+ * @param array $in array of either xmlrpcval objects or xmlrpc type definitions
+ * @param array $sig array of known signatures to match against
+ * @access private
+ */
+ function verifySignature($in, $sig)
+ {
+ // check each possible signature in turn
+ if (is_object($in))
+ {
+ $numParams = $in->getNumParams();
+ }
+ else
+ {
+ $numParams = count($in);
+ }
+ foreach($sig as $cursig)
+ {
+ if(count($cursig)==$numParams+1)
+ {
+ $itsOK=1;
+ for($n=0; $n<$numParams; $n++)
+ {
+ if (is_object($in))
+ {
+ $p=$in->getParam($n);
+ if($p->kindOf() == 'scalar')
+ {
+ $pt=$p->scalartyp();
+ }
+ else
+ {
+ $pt=$p->kindOf();
+ }
+ }
+ else
+ {
+ $pt= $in[$n] == 'i4' ? 'int' : $in[$n]; // dispatch maps never use i4...
+ }
+
+ // param index is $n+1, as first member of sig is return type
+ if($pt != $cursig[$n+1] && $cursig[$n+1] != $GLOBALS['xmlrpcValue'])
+ {
+ $itsOK=0;
+ $pno=$n+1;
+ $wanted=$cursig[$n+1];
+ $got=$pt;
+ break;
+ }
+ }
+ if($itsOK)
+ {
+ return array(1,'');
+ }
+ }
+ }
+ if(isset($wanted))
+ {
+ return array(0, "Wanted ${wanted}, got ${got} at param ${pno}");
+ }
+ else
+ {
+ return array(0, "No method signature matches number of parameters");
+ }
+ }
+
+ /**
+ * Parse http headers received along with xmlrpc request. If needed, inflate request
+ * @return null on success or an xmlrpcresp
+ * @access private
+ */
+ function parseRequestHeaders(&$data, &$req_encoding, &$resp_encoding, &$resp_compression)
+ {
+ // Play nice to PHP 4.0.x: superglobals were not yet invented...
+ if(!isset($_SERVER))
+ {
+ $_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
+ }
+
+ if($this->debug > 1)
+ {
+ if(function_exists('getallheaders'))
+ {
+ $this->debugmsg(''); // empty line
+ foreach(getallheaders() as $name => $val)
+ {
+ $this->debugmsg("HEADER: $name: $val");
+ }
+ }
+
+ }
+
+ if(isset($_SERVER['HTTP_CONTENT_ENCODING']))
+ {
+ $content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
+ }
+ else
+ {
+ $content_encoding = '';
+ }
+
+ // check if request body has been compressed and decompress it
+ if($content_encoding != '' && i18n::strlen($data))
+ {
+ if($content_encoding == 'deflate' || $content_encoding == 'gzip')
+ {
+ // if decoding works, use it. else assume data wasn't gzencoded
+ if(function_exists('gzinflate') && in_array($content_encoding, $this->accepted_compression))
+ {
+ if($content_encoding == 'deflate' && $degzdata = @gzuncompress($data))
+ {
+ $data = $degzdata;
+ if($this->debug > 1)
+ {
+ $this->debugmsg("\n+++INFLATED REQUEST+++[".i18n::strlen($data)." chars]+++\n" . $data . "\n+++END+++");
+ }
+ }
+ elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(i18n::substr($data, 10)))
+ {
+ $data = $degzdata;
+ if($this->debug > 1)
+ $this->debugmsg("+++INFLATED REQUEST+++[".i18n::strlen($data)." chars]+++\n" . $data . "\n+++END+++");
+ }
+ else
+ {
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']);
+ return $r;
+ }
+ }
+ else
+ {
+ //error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
+ $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']);
+ return $r;
+ }
+ }
+ }
+
+ // check if client specified accepted charsets, and if we know how to fulfill
+ // the request
+ if ($this->response_charset_encoding == 'auto')
+ {
+ $resp_encoding = '';
+ if (isset($_SERVER['HTTP_ACCEPT_CHARSET']))
+ {
+ // here we should check if we can match the client-requested encoding
+ // with the encodings we know we can generate.
+ /// @todo we should parse q=0.x preferences instead of getting first charset specified...
+ $client_accepted_charsets = preg_split('#,#', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']));
+ // Give preference to internal encoding
+ $known_charsets = array($this->internal_encoding, 'UTF-8', 'ISO-8859-1', 'US-ASCII');
+ foreach ($known_charsets as $charset)
+ {
+ foreach ($client_accepted_charsets as $accepted)
+ if (i18n::strpos($accepted, $charset) === 0)
+ {
+ $resp_encoding = $charset;
+ break;
+ }
+ if ($resp_encoding)
+ break;
+ }
+ }
+ }
+ else
+ {
+ $resp_encoding = $this->response_charset_encoding;
+ }
+
+ if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
+ {
+ $resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING'];
+ }
+ else
+ {
+ $resp_compression = '';
+ }
+
+ // 'guestimate' request encoding
+ /// @todo check if mbstring is enabled and automagic input conversion is on: it might mingle with this check???
+ $req_encoding = guess_encoding(isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '',
+ $data);
+
+ return null;
+ }
+
+ /**
+ * Parse an xml chunk containing an xmlrpc request and execute the corresponding
+ * php function registered with the server
+ * @param string $data the xml request
+ * @param string $req_encoding (optional) the charset encoding of the xml request
+ * @return xmlrpcresp
+ * @access private
+ */
+ function parseRequest($data, $req_encoding='')
+ {
+ // 2005/05/07 commented and moved into caller function code
+ //if($data=='')
+ //{
+ // $data=$GLOBALS['HTTP_RAW_POST_DATA'];
+ //}
+
+ // G. Giunta 2005/02/13: we do NOT expect to receive html entities
+ // so we do not try to convert them into xml character entities
+ //$data = xmlrpc_html_entity_xlate($data);
+
+ $GLOBALS['_xh']=array();
+ $GLOBALS['_xh']['ac']='';
+ $GLOBALS['_xh']['stack']=array();
+ $GLOBALS['_xh']['valuestack'] = array();
+ $GLOBALS['_xh']['params']=array();
+ $GLOBALS['_xh']['pt']=array();
+ $GLOBALS['_xh']['isf']=0;
+ $GLOBALS['_xh']['isf_reason']='';
+ $GLOBALS['_xh']['method']=false; // so we can check later if we got a methodname or not
+ $GLOBALS['_xh']['rt']='';
+
+ // decompose incoming XML into request structure
+ if ($req_encoding != '')
+ {
+ if (!in_array($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+ // the following code might be better for mb_string enabled installs, but
+ // makes the lib about 200% slower...
+ //if (!is_valid_charset($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+ {
+ error_log('XML-RPC: xmlrpc_server::parseRequest: invalid charset encoding of received request: '.$req_encoding);
+ $req_encoding = $GLOBALS['xmlrpc_defencoding'];
+ }
+ /// @BUG this will fail on PHP 5 if charset is not specified in the xml prologue,
+ // the encoding is not UTF8 and there are non-ascii chars in the text...
+ $parser = xml_parser_create($req_encoding);
+ }
+ else
+ {
+ $parser = xml_parser_create();
+ }
+
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+ // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
+ // the xml parser to give us back data in the expected charset
+ xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+
+ if ($this->functions_parameters_type != 'xmlrpcvals')
+ xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
+ else
+ xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
+ xml_set_character_data_handler($parser, 'xmlrpc_cd');
+ xml_set_default_handler($parser, 'xmlrpc_dh');
+ if(!xml_parse($parser, $data, 1))
+ {
+ // return XML error as a faultCode
+ $r = new xmlrpcresp(0,
+ $GLOBALS['xmlrpcerrxml']+xml_get_error_code($parser),
+ sprintf('XML error: %s at line %d, column %d',
+ xml_error_string(xml_get_error_code($parser)),
+ xml_get_current_line_number($parser), xml_get_current_column_number($parser)));
+ xml_parser_free($parser);
+ }
+ elseif ($GLOBALS['_xh']['isf'])
+ {
+ xml_parser_free($parser);
+ $r = new xmlrpcresp(0,
+ $GLOBALS['xmlrpcerr']['invalid_request'],
+ $GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']);
+ }
+ else
+ {
+ xml_parser_free($parser);
+ if ($this->functions_parameters_type != 'xmlrpcvals')
+ {
+ if($this->debug > 1)
+ {
+ $this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], true)."\n+++END+++");
+ }
+ $r = $this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], $GLOBALS['_xh']['pt']);
+ }
+ else
+ {
+ // build an xmlrpcmsg object with data parsed from xml
+ $m= new xmlrpcmsg($GLOBALS['_xh']['method']);
+ // now add parameters in
+ for($i=0; $i<count($GLOBALS['_xh']['params']); $i++)
+ {
+ $m->addParam($GLOBALS['_xh']['params'][$i]);
+ }
+
+ if($this->debug > 1)
+ {
+ $this->debugmsg("\n+++PARSED+++\n".var_export($m, true)."\n+++END+++");
+ }
+
+ $r = $this->execute($m);
+ }
+ }
+ return $r;
+ }
+
+ /**
+ * Execute a method invoked by the client, checking parameters used
+ * @param mixed $m either an xmlrpcmsg obj or a method name
+ * @param array $params array with method parameters as php types (if m is method name only)
+ * @param array $paramtypes array with xmlrpc types of method parameters (if m is method name only)
+ * @return xmlrpcresp
+ * @access private
+ */
+ function execute($m, $params=null, $paramtypes=null)
+ {
+ if (is_object($m))
+ {
+ $methName = $m->method();
+ }
+ else
+ {
+ $methName = $m;
+ }
+ $sysCall = $this->allow_system_funcs && (i18n::strpos($methName, "system.") === 0);
+ $dmap = $sysCall ? $GLOBALS['_xmlrpcs_dmap'] : $this->dmap;
+
+ if(!isset($dmap[$methName]['function']))
+ {
+ // No such method
+ return new xmlrpcresp(0,
+ $GLOBALS['xmlrpcerr']['unknown_method'],
+ $GLOBALS['xmlrpcstr']['unknown_method']);
+ }
+
+ // Check signature
+ if(isset($dmap[$methName]['signature']))
+ {
+ $sig = $dmap[$methName]['signature'];
+ if (is_object($m))
+ {
+ list($ok, $errstr) = $this->verifySignature($m, $sig);
+ }
+ else
+ {
+ list($ok, $errstr) = $this->verifySignature($paramtypes, $sig);
+ }
+ if(!$ok)
+ {
+ // Didn't match.
+ return new xmlrpcresp(
+ 0,
+ $GLOBALS['xmlrpcerr']['incorrect_params'],
+ $GLOBALS['xmlrpcstr']['incorrect_params'] . ": ${errstr}"
+ );
+ }
+ }
+
+ $func = $dmap[$methName]['function'];
+ // let the 'class::function' syntax be accepted in dispatch maps
+ if(is_string($func) && i18n::strpos($func, '::'))
+ {
+ $func = preg_split('#::#', $func);
+ }
+ // verify that function to be invoked is in fact callable
+ if(!is_callable($func))
+ {
+ error_log("XML-RPC: xmlrpc_server::execute: function $func registered as method handler is not callable");
+ return new xmlrpcresp(
+ 0,
+ $GLOBALS['xmlrpcerr']['server_error'],
+ $GLOBALS['xmlrpcstr']['server_error'] . ": no function matches method"
+ );
+ }
+
+ // If debug level is 3, we should catch all errors generated during
+ // processing of user function, and log them as part of response
+ if($this->debug > 2)
+ {
+ $GLOBALS['_xmlrpcs_prev_ehandler'] = set_error_handler('_xmlrpcs_errorHandler');
+ }
+ if (is_object($m))
+ {
+ if($sysCall)
+ {
+ $r = call_user_func($func, $this, $m);
+ }
+ else
+ {
+ $r = call_user_func($func, $m);
+ }
+ if (!is_a($r, 'xmlrpcresp'))
+ {
+ error_log("XML-RPC: xmlrpc_server::execute: function $func registered as method handler does not return an xmlrpcresp object");
+ if (is_a($r, 'xmlrpcval'))
+ {
+ $r = new xmlrpcresp($r);
+ }
+ else
+ {
+ $r = new xmlrpcresp(
+ 0,
+ $GLOBALS['xmlrpcerr']['server_error'],
+ $GLOBALS['xmlrpcstr']['server_error'] . ": function does not return xmlrpcresp object"
+ );
+ }
+ }
+ }
+ else
+ {
+ // call a 'plain php' function
+ if($sysCall)
+ {
+ array_unshift($params, $this);
+ $r = call_user_func_array($func, $params);
+ }
+ else
+ {
+ // 3rd API convention for method-handling functions: EPI-style
+ if ($this->functions_parameters_type == 'epivals')
+ {
+ $r = call_user_func_array($func, array($methName, $params, $this->user_data));
+ // mimic EPI behaviour: if we get an array that looks like an error, make it
+ // an eror response
+ if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r))
+ {
+ $r = new xmlrpcresp(0, (integer)$r['faultCode'], (string)$r['faultString']);
+ }
+ else
+ {
+ // functions using EPI api should NOT return resp objects,
+ // so make sure we encode the return type correctly
+ $r = new xmlrpcresp(php_xmlrpc_encode($r, array('extension_api')));
+ }
+ }
+ else
+ {
+ $r = call_user_func_array($func, $params);
+ }
+ }
+ // the return type can be either an xmlrpcresp object or a plain php value...
+ if (!is_a($r, 'xmlrpcresp'))
+ {
+ // what should we assume here about automatic encoding of datetimes
+ // and php classes instances???
+ $r = new xmlrpcresp(php_xmlrpc_encode($r, array('auto_dates')));
+ }
+ }
+ if($this->debug > 2)
+ {
+ // note: restore the error handler we found before calling the
+ // user func, even if it has been changed inside the func itself
+ if($GLOBALS['_xmlrpcs_prev_ehandler'])
+ {
+ set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);
+ }
+ else
+ {
+ restore_error_handler();
+ }
+ }
+ return $r;
+ }
+
+ /**
+ * add a string to the 'internal debug message' (separate from 'user debug message')
+ * @param string $strings
+ * @access private
+ */
+ function debugmsg($string)
+ {
+ $this->debug_info .= $string."\n";
+ }
+
+ /**
+ * @access private
+ */
+ function xml_header($charset_encoding='')
+ {
+ if ($charset_encoding != '')
+ {
+ return "<?xml version=\"1.0\" encoding=\"$charset_encoding\"?" . ">\n";
+ }
+ else
+ {
+ return "<?xml version=\"1.0\"?" . ">\n";
+ }
+ }
+
+ /**
+ * A debugging routine: just echoes back the input packet as a string value
+ * DEPRECATED!
+ */
+ function echoInput()
+ {
+ $r = new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . $GLOBALS['HTTP_RAW_POST_DATA'], 'string'));
+ print $r->serialize();
+ }
+ }
+?>
-<?php\r
-\r
-// ADMIN-skin skin types\r
-define('_ADM_SKPRT_ACTIONLOG', '[' . _ACTIONLOG_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ACTIVATE', '[' . _QMENU_ACTIVATE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ACTIVATESETPWD', '[' . _MEMBERS_SETPWD . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADDNEWLOG', '[' . _BLOGCREATED_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINERRORPAGE', _OVERVIEW_MANAGE . ':[' . _ERROR . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINSKINOVERVIEW', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _QMENU_LAYOUT_SKINS . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINSKINEDIT', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKIN_EDITONE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BACKUPOVERVIEW', '[' . _QMENU_MANAGE_BACKUPS . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BACKUPRESTORE', '[' . _RESTORE_COMPLETE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BANLIST', '[' . _BAN_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BANLISTDELETE', '[' . _BAN_REMOVE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BANLISTDELETECONFIRM', '[' . _BAN_REMOVED_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BANLISTNEW', '[' . _BAN_NEW_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BATCHCATEGORY', '[' . _BATCH_CATEGORIES . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BATCHCOMMENT', '[' . _BATCH_COMMENTS . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BATCHDELETE', '[' . _BATCH_DELETE_CONFIRM . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BATCHITEM', '[' . _BATCH_ITEMS . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BATCHMEMBER', '[' . _BATCH_MEMBERS . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BATCHMOVE', '[' . _SKINABLEADMIN_BATCH_MOVE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BATCHMOVECAT', '[' . _MOVECAT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BATCHTEAM', '[' . _BATCH_TEAM . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BLOGCOMMENTLIST', '[' . _COMMENTS_BLOG . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BLOGSETTINGS', '[' . _EBLOG_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BOOKMARKLET', '[' . _BOOKMARKLET_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BROWSEOWNCOMMENTS', '[' . _COMMENTS_YOUR . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_BROWSEOWNITEMS', '[' . _ITEMLIST_YOUR . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_CATEGORYDELETE', '[' . _CONFIRMTXT_CATEGORY . '(' . _SKINABLEADMIN_BATCH . ')' .']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_CATEGORYEDIT', '[' . _EBLOG_CAT_UPDATE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_COMMENTDELETE', '[' . _CONFIRMTXT_COMMENT . '(' . _SKINABLEADMIN_BATCH . ')' . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_COMMENTEDIT', '[' . _EDITC_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_CREATENEWLOG', '[' . _EBLOG_CREATE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_DELETEBLOG', '[' . _WARNINGTXT_BLOGDEL . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_EDITMEMBERSETTINGS', '[' . _MEMBERS_EDIT . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_INSERTPLUGINO', '[' . _ADD_PLUGIN_EXTRAS . ']');\r
-define('_ADM_SKPRT_ITEMCOMMENTLIST', '[' . _COMMENTS . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ITEMDELETE', '[' . _CONFIRMTXT_ITEM . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ITEMLIST', '[' . _ITEMLIST_BLOG . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ITEMMOVE', '[' . _MOVE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_MANAGE', '[' . _OVERVIEW_MANAGE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_MANAGETEAM', '[' . _TEAM_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_MEMBERDELETE', '[' . _CONFIRMTXT_MEMBER . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_OVERVIEW', '[' . _QMENU_HOME . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_PAGEFOOT', '[' . _SKINABLEADMIN_PAGEFOOT . ']');\r
-define('_ADM_SKPRT_PAGEHEAD', '[' . _SKINABLEADMIN_PAGEHEAD . ']');\r
-define('_ADM_SKPRT_PLUGINDELETE', '[' . _CONFIRMTXT_PLUGIN . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_PLUGINHELP', '[' . _PLUGS_HELP_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_PLUGINLIST', '[' . _PLUGS_TITLE_MANAGE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_PLUGINOPTIONS', '[' . sprintf(_PLUGIN_OPTIONS_TITLE, _QMENU_PLUGINS) . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SETTINGSEDIT', '[' . _SETTINGS_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SHOWLOGIN', '[' . _LOGIN . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SKINDELETE', '[' . _CONFIRMTXT_SKIN . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SKINEDIT', '[' . _SKIN_EDITONE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SKINEDITTYPE', '[' . _SKIN_EDITPART_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SKINIEDOIMPORT', '[' . _SKINIE_DONE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SKINIEIMPORT', '[' . _SKINIE_CONFIRM_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SKINIEOVERVIEW', '[' . _SKINIE_TITLE_IMPORT . '/' . _SKINIE_TITLE_EXPORT . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SKINOVERVIEW', '[' . _SKIN_EDIT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SKINREMOVETYPE', '[' . _CONFIRMTXT_SKIN_PARTS_SPECIAL . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_SYSTEMOVERVIEW', '[' . _ADMIN_SYSTEMOVERVIEW_HEADING . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_TEAMDELETE', '[' . _CONFIRMTXT_TEAM1 . _CONFIRMTXT_TEAM2 . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_TEMPLATEDELETE', '[' . _CONFIRMTXT_TEMPLATE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_TEMPLATEEDIT', '[' . _TEMPLATE_EDIT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_TEMPLATEOVERVIEW', '[' . _SKINABLEADMIN_TEMPLATEOVERVIEW . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_USERMANAGEMENT', '[' . _MEMBERS_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_CREATEITEM', '[' . _ADD_ADDTO . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ITEMEDIT', '[' . _EDIT_ITEM . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINSKINDELETE', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _CONFIRMTXT_SKIN . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINSKINIEDOIMPORT', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKINIE_DONE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINSKINIEOVERVIEW', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKINIE_TITLE_IMPORT . '/' . _SKINIE_TITLE_EXPORT . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINSKINEDITTYPE', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKIN_EDITPART_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINSKINIEIMPORT', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKINIE_CONFIRM_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINTEMPLATEOVERVIEW', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKINABLEADMIN_TEMPLATEOVERVIEW . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINSKINREMOVETYPE', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _CONFIRMTXT_SKIN_PARTS_SPECIAL . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINTEMPLATEEDIT', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _TEMPLATE_EDIT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_ADMINTEMPLATEDELETE', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _CONFIRMTXT_TEMPLATE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_CREATEACCOUNTINPUT', '[' . _CREATE_ACCOUNT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_CREATEACCOUNTSUCCESS', '[' . _CREATE_ACCOUNT0 . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_CREATEACCOUNTDISALLOWED', '[' . _CREATE_ACCOUNT1 . ']' . _SKINABLEADMIN_PAGE_STR);\r
-define('_ADM_SKPRT_FORGOTPASSWORD', '[' . _FORGOTPASSWORD_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);\r
-\r
-// ADMIN-template template types\r
-\r
-define('_ADM_TPLPT_NORMALSKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_NORMALSKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_NORMALSKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ICON', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [customhelplink] ' . _SKINABLEADMIN_HELPICONURL_STR);\r
-define('_ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ANCHOR', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [customhelplink] ' . _SKINABLEADMIN_HELPFILEURL_STR);\r
-define('_ADM_TPLPT_ADMIN_BLOGLINK', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbloglink]');\r
-define('_ADM_TPLPT_ADMIN_BATCHLIST', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbatchlist]');\r
-define('_ADM_TPLPT_ACTIVATE_FORGOT_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(forgot)]' . _SKINABLEADMIN_TITLE_STR);\r
-define('_ADM_TPLPT_ACTIVATE_FORGOT_TEXT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(forgot)]' . _SKINABLEADMIN_TEXT_STR);\r
-define('_ADM_TPLPT_ACTIVATE_REGISTER_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(register)]' . _SKINABLEADMIN_TITLE_STR);\r
-define('_ADM_TPLPT_ACTIVATE_REGISTER_TEXT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(register)]' . _SKINABLEADMIN_TEXT_STR);\r
-define('_ADM_TPLPT_ACTIVATE_CHANGE_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(addresschange)]' . _SKINABLEADMIN_TITLE_STR);\r
-define('_ADM_TPLPT_ACTIVATE_CHANGE_TEXT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(addresschange)]' . _SKINABLEADMIN_TEXT_STR);\r
-define('_ADM_TPLPT_TEMPLATE_EDIT_EXPLUGNAME', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [edittemplateinfo/editadmintemplateinfo(extratemplate)]');\r
-define('_ADM_TPLPT_TEMPLATE_EDIT_ROW_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [edittemplateinfo/editadmintemplateinfo(extratemplate_default)]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_TEMPLATE_EDIT_ROW_TAIL', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [edittemplateinfo/editadmintemplateinfo(extratemplate_default)]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SPECIALSKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [specialskinlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SPECIALSKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [specialskinlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SPECIALSKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [specialskinlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SYSTEMINFO_GDSETTINGS', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [systemsettings(gdinfo)]');\r
-define('_ADM_TPLPT_BANLIST_DELETED_LIST', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [banlistdeletedlist]');\r
-define('_ADM_TPLPT_INSERT_PLUGOPTION_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginoptions]' . _SKINABLEADMIN_TITLE_STR);\r
-define('_ADM_TPLPT_INSERT_PLUGOPTION_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginoptions]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_INPUTYESNO_TEMPLATE_ADMIN', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [inputyesno] ' . _SKINABLEADMIN_ADMINSETTING_STR);\r
-define('_ADM_TPLPT_INPUTYESNO_TEMPLATE_NORMAL', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [inputyesno] ' . _SKINABLEADMIN_NORMALSETTING_STR);\r
-define('_ADM_TPLPT_ADMIN_SPECIALSKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminspecialskinlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_ADMIN_SPECIALSKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminspecialskinlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_ADMIN_SPECIALSKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminspecialskinlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SKINIE_EXPORT_LIST', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skinielist/adminskinielist]');\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [qmanuaddselect/newmemberselect/defskinselect/defcatselect/defblogselect]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [qmanuaddselect/newmemberselect/defskinselect/defcatselect/defblogselect]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [qmanuaddselect/newmemberselect/defskinselect/defcatselect/defblogselect]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_HEAD', _SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BODY', _SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_FOOT', _SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editmemberlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editmemberlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editmemberlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogteamlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogteamlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogteamlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginlistlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginlistlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginlistlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . _SKINABLEADMIN_BODY_STR . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[yesno]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[password]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[<select>]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[<option />]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[</select>]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[textarea]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[text]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_MNUMER', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[datatype=numerical]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_MRONRY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA, '[access=readonly]'));\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . _SKINABLEADMIN_BODY_STR . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [itemnavlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [itemnavlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [itemnavlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [commentnavlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [commentnavlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [commentnavlist]' . _SKINABLEADMIN_BODY_STR . '(BAN)');\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [commentnavlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(blog)]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(blog)]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(blog)]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(template)]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(template)]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(template)]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogcatlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogcatlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogcatlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [templateoverview/admintemplateoverview]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [templateoverview/admintemplateoverview]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [templateoverview/admintemplateoverview]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skinoverview/adminskinoverview]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skinoverview/adminskinoverview]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skinoverview/adminskinoverview]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist(draft)]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist(draft)]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist(draft)]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [actionloglist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [actionloglist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [actionloglist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbanlist]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbanlist]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbanlist]' . _SKINABLEADMIN_FOOT_STR);\r
-define('_ADM_TPLPT_PLUGIN_QUICKMENU_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [quickmenu]' . _SKINABLEADMIN_TITLE_STR);\r
-define('_ADM_TPLPT_PLUGIN_QUICKMENU_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [quickmenu]' . _SKINABLEADMIN_HEAD_STR);\r
-define('_ADM_TPLPT_PLUGIN_QUICKMENU_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [quickmenu]' . _SKINABLEADMIN_BODY_STR);\r
-define('_ADM_TPLPT_PLUGIN_QUICKMENU_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [quickmenu]' . _SKINABLEADMIN_FOOT_STR);\r
-\r
+<?php
+// ADMIN-skin skin types
+define('_ADM_SKPRT_ACTIONLOG', '[' . _ACTIONLOG_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ACTIVATE', '[' . _QMENU_ACTIVATE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ACTIVATESETPWD', '[' . _MEMBERS_SETPWD . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADDNEWLOG', '[' . _BLOGCREATED_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINERRORPAGE', _OVERVIEW_MANAGE . ':[' . _ERROR . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINSKINOVERVIEW', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _QMENU_LAYOUT_SKINS . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINSKINEDIT', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKIN_EDITONE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BACKUPOVERVIEW', '[' . _QMENU_MANAGE_BACKUPS . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BACKUPRESTORE', '[' . _RESTORE_COMPLETE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BANLIST', '[' . _BAN_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BANLISTDELETE', '[' . _BAN_REMOVE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BANLISTDELETECONFIRM', '[' . _BAN_REMOVED_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BANLISTNEW', '[' . _BAN_NEW_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BATCHCATEGORY', '[' . _BATCH_CATEGORIES . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BATCHCOMMENT', '[' . _BATCH_COMMENTS . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BATCHDELETE', '[' . _BATCH_DELETE_CONFIRM . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BATCHITEM', '[' . _BATCH_ITEMS . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BATCHMEMBER', '[' . _BATCH_MEMBERS . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BATCHMOVE', '[' . _SKINABLEADMIN_BATCH_MOVE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BATCHMOVECAT', '[' . _MOVECAT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BATCHTEAM', '[' . _BATCH_TEAM . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BLOGCOMMENTLIST', '[' . _COMMENTS_BLOG . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BLOGSETTINGS', '[' . _EBLOG_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BOOKMARKLET', '[' . _BOOKMARKLET_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BROWSEOWNCOMMENTS', '[' . _COMMENTS_YOUR . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_BROWSEOWNITEMS', '[' . _ITEMLIST_YOUR . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_CATEGORYDELETE', '[' . _CONFIRMTXT_CATEGORY . '(' . _SKINABLEADMIN_BATCH . ')' .']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_CATEGORYEDIT', '[' . _EBLOG_CAT_UPDATE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_COMMENTDELETE', '[' . _CONFIRMTXT_COMMENT . '(' . _SKINABLEADMIN_BATCH . ')' . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_COMMENTEDIT', '[' . _EDITC_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_CREATENEWLOG', '[' . _EBLOG_CREATE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_DELETEBLOG', '[' . _WARNINGTXT_BLOGDEL . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_EDITMEMBERSETTINGS', '[' . _MEMBERS_EDIT . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_INSERTPLUGINO', '[' . _ADD_PLUGIN_EXTRAS . ']');
+define('_ADM_SKPRT_ITEMCOMMENTLIST', '[' . _COMMENTS . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ITEMDELETE', '[' . _CONFIRMTXT_ITEM . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ITEMLIST', '[' . _ITEMLIST_BLOG . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ITEMMOVE', '[' . _MOVE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_MANAGE', '[' . _OVERVIEW_MANAGE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_MANAGETEAM', '[' . _TEAM_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_MEMBERDELETE', '[' . _CONFIRMTXT_MEMBER . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_OVERVIEW', '[' . _QMENU_HOME . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_PAGEFOOT', '[' . _SKINABLEADMIN_PAGEFOOT . ']');
+define('_ADM_SKPRT_PAGEHEAD', '[' . _SKINABLEADMIN_PAGEHEAD . ']');
+define('_ADM_SKPRT_PLUGINDELETE', '[' . _CONFIRMTXT_PLUGIN . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_PLUGINHELP', '[' . _PLUGS_HELP_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_PLUGINLIST', '[' . _PLUGS_TITLE_MANAGE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_PLUGINOPTIONS', '[' . sprintf(_PLUGIN_OPTIONS_TITLE, _QMENU_PLUGINS) . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SETTINGSEDIT', '[' . _SETTINGS_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SHOWLOGIN', '[' . _LOGIN . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SKINDELETE', '[' . _CONFIRMTXT_SKIN . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SKINEDIT', '[' . _SKIN_EDITONE_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SKINEDITTYPE', '[' . _SKIN_EDITPART_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SKINIEDOIMPORT', '[' . _SKINIE_DONE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SKINIEIMPORT', '[' . _SKINIE_CONFIRM_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SKINIEOVERVIEW', '[' . _SKINIE_TITLE_IMPORT . '/' . _SKINIE_TITLE_EXPORT . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SKINOVERVIEW', '[' . _SKIN_EDIT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SKINREMOVETYPE', '[' . _CONFIRMTXT_SKIN_PARTS_SPECIAL . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_SYSTEMOVERVIEW', '[' . _ADMIN_SYSTEMOVERVIEW_HEADING . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_TEAMDELETE', '[' . _CONFIRMTXT_TEAM1 . _CONFIRMTXT_TEAM2 . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_TEMPLATEDELETE', '[' . _CONFIRMTXT_TEMPLATE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_TEMPLATEEDIT', '[' . _TEMPLATE_EDIT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_TEMPLATEOVERVIEW', '[' . _SKINABLEADMIN_TEMPLATEOVERVIEW . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_USERMANAGEMENT', '[' . _MEMBERS_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_CREATEITEM', '[' . _ADD_ADDTO . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ITEMEDIT', '[' . _EDIT_ITEM . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINSKINDELETE', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _CONFIRMTXT_SKIN . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINSKINIEDOIMPORT', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKINIE_DONE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINSKINIEOVERVIEW', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKINIE_TITLE_IMPORT . '/' . _SKINIE_TITLE_EXPORT . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINSKINEDITTYPE', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKIN_EDITPART_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINSKINIEIMPORT', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKINIE_CONFIRM_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINTEMPLATEOVERVIEW', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _SKINABLEADMIN_TEMPLATEOVERVIEW . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINSKINREMOVETYPE', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _CONFIRMTXT_SKIN_PARTS_SPECIAL . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINTEMPLATEEDIT', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _TEMPLATE_EDIT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_ADMINTEMPLATEDELETE', _SKINABLEADMIN_QMENU_LAYOUT . ':[' . _CONFIRMTXT_TEMPLATE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_CREATEACCOUNTINPUT', '[' . _CREATE_ACCOUNT_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_CREATEACCOUNTSUCCESS', '[' . _CREATE_ACCOUNT0 . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_CREATEACCOUNTDISALLOWED', '[' . _CREATE_ACCOUNT1 . ']' . _SKINABLEADMIN_PAGE_STR);
+define('_ADM_SKPRT_FORGOTPASSWORD', '[' . _FORGOTPASSWORD_TITLE . ']' . _SKINABLEADMIN_PAGE_STR);
+
+// ADMIN-template template types
+
+define('_ADM_TPLPT_NORMALSKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_NORMALSKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_NORMALSKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ICON', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [customhelplink] ' . _SKINABLEADMIN_HELPICONURL_STR);
+define('_ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ANCHOR', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [customhelplink] ' . _SKINABLEADMIN_HELPFILEURL_STR);
+define('_ADM_TPLPT_ADMIN_BLOGLINK', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbloglink]');
+define('_ADM_TPLPT_ADMIN_BATCHLIST', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbatchlist]');
+define('_ADM_TPLPT_ACTIVATE_FORGOT_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(forgot)]' . _SKINABLEADMIN_TITLE_STR);
+define('_ADM_TPLPT_ACTIVATE_FORGOT_TEXT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(forgot)]' . _SKINABLEADMIN_TEXT_STR);
+define('_ADM_TPLPT_ACTIVATE_REGISTER_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(register)]' . _SKINABLEADMIN_TITLE_STR);
+define('_ADM_TPLPT_ACTIVATE_REGISTER_TEXT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(register)]' . _SKINABLEADMIN_TEXT_STR);
+define('_ADM_TPLPT_ACTIVATE_CHANGE_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(addresschange)]' . _SKINABLEADMIN_TITLE_STR);
+define('_ADM_TPLPT_ACTIVATE_CHANGE_TEXT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [activationtitle(addresschange)]' . _SKINABLEADMIN_TEXT_STR);
+define('_ADM_TPLPT_TEMPLATE_EDIT_EXPLUGNAME', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [edittemplateinfo/editadmintemplateinfo(extratemplate)]');
+define('_ADM_TPLPT_TEMPLATE_EDIT_ROW_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [edittemplateinfo/editadmintemplateinfo(extratemplate_default)]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_TEMPLATE_EDIT_ROW_TAIL', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [edittemplateinfo/editadmintemplateinfo(extratemplate_default)]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SPECIALSKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [specialskinlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SPECIALSKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [specialskinlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SPECIALSKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [specialskinlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SYSTEMINFO_GDSETTINGS', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [systemsettings(gdinfo)]');
+define('_ADM_TPLPT_BANLIST_DELETED_LIST', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [banlistdeletedlist]');
+define('_ADM_TPLPT_INSERT_PLUGOPTION_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginoptions]' . _SKINABLEADMIN_TITLE_STR);
+define('_ADM_TPLPT_INSERT_PLUGOPTION_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginoptions]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_INPUTYESNO_TEMPLATE_ADMIN', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [inputyesno] ' . _SKINABLEADMIN_ADMINSETTING_STR);
+define('_ADM_TPLPT_INPUTYESNO_TEMPLATE_NORMAL', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [inputyesno] ' . _SKINABLEADMIN_NORMALSETTING_STR);
+define('_ADM_TPLPT_ADMIN_SPECIALSKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminspecialskinlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_ADMIN_SPECIALSKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminspecialskinlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_ADMIN_SPECIALSKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminspecialskinlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SKINIE_EXPORT_LIST', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skinielist/adminskinielist]');
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [qmanuaddselect/newmemberselect/defskinselect/defcatselect/defblogselect]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [qmanuaddselect/newmemberselect/defskinselect/defcatselect/defblogselect]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [qmanuaddselect/newmemberselect/defskinselect/defcatselect/defblogselect]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_HEAD', _SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BODY', _SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_FOOT', _SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editmemberlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editmemberlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editmemberlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogteamlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogteamlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogteamlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginlistlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginlistlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [pluginlistlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . _SKINABLEADMIN_BODY_STR . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[yesno]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[password]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[<select>]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[<option />]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[</select>]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[textarea]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[text]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_MNUMER', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE, '[datatype=numerical]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_MRONRY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . sprintf(_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA, '[access=readonly]'));
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . _SKINABLEADMIN_BODY_STR . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [editplugoptionslist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [itemnavlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [itemnavlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [itemnavlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [commentnavlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [commentnavlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [commentnavlist]' . _SKINABLEADMIN_BODY_STR . '(BAN)');
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [commentnavlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(blog)]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(blog)]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(blog)]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(template)]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(template)]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skineditallowedlist/adminskineditallowedlist(template)]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogcatlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogcatlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [blogcatlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [templateoverview/admintemplateoverview]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [templateoverview/admintemplateoverview]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [templateoverview/admintemplateoverview]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skinoverview/adminskinoverview]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skinoverview/adminskinoverview]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [skinoverview/adminskinoverview]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist(draft)]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist(draft)]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist(draft)]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [actionloglist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [actionloglist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [actionloglist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbanlist]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbanlist]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbanlist]' . _SKINABLEADMIN_FOOT_STR);
+define('_ADM_TPLPT_PLUGIN_QUICKMENU_TITLE', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [quickmenu]' . _SKINABLEADMIN_TITLE_STR);
+define('_ADM_TPLPT_PLUGIN_QUICKMENU_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [quickmenu]' . _SKINABLEADMIN_HEAD_STR);
+define('_ADM_TPLPT_PLUGIN_QUICKMENU_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [quickmenu]' . _SKINABLEADMIN_BODY_STR);
+define('_ADM_TPLPT_PLUGIN_QUICKMENU_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [quickmenu]' . _SKINABLEADMIN_FOOT_STR);
+
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: bg_Cyrl_BG.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: bg_Cyrl_BG.ISO-8859-5.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: bg_Cyrl_BG.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: bg_Cyrl_BG.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: ca_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: ca_Latn_ES.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: ca_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: ca_Latn_ES.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: cs_Latn_CZ.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: cs_Latn_CZ.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: cs_Latn_CZ.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: cs_Latn_CZ.WINDOWS-1250.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: de_Latn_DE.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: de_Latn_DE.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
// START changed/added after 3.33 START
define('_MEMBERS_USEAUTOSAVE', 'Funktion Automatisches Speichern verwenden?');
-define('_TEMPLATE_PLUGIN_FIELDS', 'Zusätzliche Plugin Felder');
+define('_TEMPLATE_PLUGIN_FIELDS', 'Zusätzliche Plugin Felder');
define('_TEMPLATE_BLOGLIST', 'Template Blog Liste');
define('_TEMPLATE_BLOGHEADER', 'Blog Liste Kopfzeile');
define('_TEMPLATE_BLOGITEM', 'Blog Liste Eintrag');
define('_CREATE_ACCOUNT_URL', 'URL:');
define('_CREATE_ACCOUNT_SUBMIT', 'Konto erstellen');
-define('_BMLET_BACKTODRAFTS', 'Zurück zu den Entwürfen verschieben');
+define('_BMLET_BACKTODRAFTS', 'Zurück zu den Entwürfen verschieben');
define('_BMLET_CANCEL', 'Abbrechen');
define('_LIST_ITEM_NOCONTENT', 'Kein Kommentar');
/* changed */
// plugin dependency
define('_ERROR_INSREQPLUGIN', 'Plugin-Installation misslungen, erfordert ');
-define('_ERROR_DELREQPLUGIN', 'Lö;schen des Plugins misslungen, benö;tigt von ');
+define('_ERROR_DELREQPLUGIN', 'Lö;schen des Plugins misslungen, benö;tigt von ');
//define('_ADD_ADDLATER', 'Add Later');
-define('_ADD_ADDLATER', 'Später hinzufügen');
+define('_ADD_ADDLATER', 'Später hinzufügen');
define('_LOGIN_NAME', 'Name:');
define('_LOGIN_PASSWORD', 'Password:');
define('_UPDATEDPING_MESSAGE', '<h2>Website aktualisiert, jetzt werden verschiedene Weblog Sservices angepingt...</h2><p>This can take a while...</p><p>If you aren\'t automatically passed through, ');
define('_UPDATEDPING_GOPINGPAGE', 'nocheinmal versuchen');
define('_UPDATEDPING_PINGING', 'Pinging Services, bitte warten ...');
-define('_UPDATEDPING_VIEWITEM', 'Siehe Liste für aktuelle Artikel für ');
+define('_UPDATEDPING_VIEWITEM', 'Siehe Liste für aktuelle Artikel für ');
define('_UPDATEDPING_VISITOWNSITE', 'Besuchen Sie Ihre Website');
// General category
define('_ADMIN_SYSTEMOVERVIEW_NUCLEUSVERSION', 'Nucleus CMS version');
define('_ADMIN_SYSTEMOVERVIEW_NUCLEUSPATCHLEVEL', 'Nucleus CMS patch level');
define('_ADMIN_SYSTEMOVERVIEW_NUCLEUSSETTINGS', 'Wichtige Einstellungen');
-define('_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK', 'Prüfen ob eine neue Version erhältlich ist');
-define('_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TXT', 'Prüfen, ob eine neue Version erhältlich ist: ');
+define('_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK', 'Prüfen ob eine neue Version erhältlich ist');
+define('_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TXT', 'Prüfen, ob eine neue Version erhältlich ist: ');
define('_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL', 'http://nucleuscms.org/version.php?v=%d&pl=%d');
-define('_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE', 'Prüfen ob eine neue Version/Uprgrade erhältlich ist');
-define('_ADMIN_SYSTEMOVERVIEW_NOT_ADMIN', "Sie haben nicht genügend Rechte, um die System informationen einzusehen.");
+define('_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE', 'Prüfen ob eine neue Version/Uprgrade erhältlich ist');
+define('_ADMIN_SYSTEMOVERVIEW_NOT_ADMIN', "Sie haben nicht genügend Rechte, um die System informationen einzusehen.");
// ENCAPSULATE.php
define('_ENCAPSULATE_ENCAPSULATE_NOENTRY', 'No entries');
define('_ERROR_EMAIL_REQUIRED', 'Email address is required');
define('_COMMENTFORM_MAIL', 'eMail/HTTP');
define('_COMMENTFORM_EMAIL', 'E-mail:');
-define('_EBLOG_REQUIREDEMAIL', 'E-Mail Addresse für Kommentare voraussetzen?');
+define('_EBLOG_REQUIREDEMAIL', 'E-Mail Addresse für Kommentare voraussetzen?');
define('_ERROR_COMMENTS_SPAM', 'Your comment was rejected because it did not pass the spam test');
// END changed/added after 3.22 END
// START changed/added after 3.1 START
// comments list per weblog
-define('_COMMENTS_BLOG', 'Alle Kommentare für das Blog');
+define('_COMMENTS_BLOG', 'Alle Kommentare für das Blog');
define('_NOCOMMENTS_BLOG', 'Keine Kommentare in diesem Blog vorhanden');
define('_BLOGLIST_COMMENTS', 'Kommentare');
define('_BLOGLIST_TT_COMMENTS', 'Liste aller Kommentaren in diesem Blog');
define('_ARCHIVETYPE_MONTH', 'Monat');
// tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
-define('_ERROR_BADTICKET', 'Ungültiges oder erloschenes Ticket.');
+define('_ERROR_BADTICKET', 'Ungültiges oder erloschenes Ticket.');
// cookie prefix
-define('_SETTINGS_COOKIEPREFIX', 'Cookie-Präfix');
+define('_SETTINGS_COOKIEPREFIX', 'Cookie-Präfix');
// account activation
define('_ERROR_NOLOGON_NOACTIVATE', 'Kann Aktivierungslink nicht senden. Erlaubnis zum Login verweigert.');
-define('_ERROR_ACTIVATE', 'Aktivierungsschlüssel nicht vorhanden, ungültig oder abgelaufen.');
+define('_ERROR_ACTIVATE', 'Aktivierungsschlüssel nicht vorhanden, ungültig oder abgelaufen.');
define('_ACTIONLOG_ACTIVATIONLINK', 'Aktivierungslink gesendet');
-define('_MSG_ACTIVATION_SENT', 'Ein Aktivierungslink wurde per eMail übermittelt.');
+define('_MSG_ACTIVATION_SENT', 'Ein Aktivierungslink wurde per eMail übermittelt.');
// activation link emails
-define('_ACTIVATE_REGISTER_MAIL', "Hi <%memberName%>,\n\nSie müssen Ihren Konto auf <%siteName%> (<%siteUrl%>) aktivieren.\nSie kö;nnen dies durch Klick auf den nachstehenden Link erledigen: \n\n\t<%activationUrl%>\n\nSie haben dafür zwei Tage. Danach wird dieser Aktivierungslink ungültig.");
+define('_ACTIVATE_REGISTER_MAIL', "Hi <%memberName%>,\n\nSie müssen Ihren Konto auf <%siteName%> (<%siteUrl%>) aktivieren.\nSie kö;nnen dies durch Klick auf den nachstehenden Link erledigen: \n\n\t<%activationUrl%>\n\nSie haben dafür zwei Tage. Danach wird dieser Aktivierungslink ungültig.");
define('_ACTIVATE_REGISTER_MAILTITLE', "Aktivieren Sie Ihren '<%memberName%>'-Konto");
define('_ACTIVATE_REGISTER_TITLE', 'Willkommen, <%memberName%>');
-define('_ACTIVATE_REGISTER_TEXT', 'Sie sind fast fertig. Bitte wählen Sie ein Passwort für den nachstehenden Konto.');
-define('_ACTIVATE_FORGOT_MAIL', "Hi <%memberName%>,\n\nMit dem nachstehenden Link kö;nnen Sie ein neues Passwort für Ihren Konto auf <%siteName%> (<%siteUrl%>) bestimmen.\n\n\t<%activationUrl%>\n\nSie haben dafür zwei Tage. Danach wird dieser Aktivierungslink ungültig.");
+define('_ACTIVATE_REGISTER_TEXT', 'Sie sind fast fertig. Bitte wählen Sie ein Passwort für den nachstehenden Konto.');
+define('_ACTIVATE_FORGOT_MAIL', "Hi <%memberName%>,\n\nMit dem nachstehenden Link kö;nnen Sie ein neues Passwort für Ihren Konto auf <%siteName%> (<%siteUrl%>) bestimmen.\n\n\t<%activationUrl%>\n\nSie haben dafür zwei Tage. Danach wird dieser Aktivierungslink ungültig.");
define('_ACTIVATE_FORGOT_MAILTITLE',"Reaktivieren Sie Ihren '<%memberName%>'-Konto");
define('_ACTIVATE_FORGOT_TITLE', 'Willkommen, <%memberName%>');
-define('_ACTIVATE_FORGOT_TEXT', 'Sie kö;nnen für den nachstehenden Konto ein neues Passwort bestimmen:');
-define('_ACTIVATE_CHANGE_MAIL', "Hallo <%memberName%>,\n\nDa Ihre eMail-Adresse geändert wurde, müssen Sie Ihren Konto bei <%siteName%> (<%siteUrl%>) neu aktivieren.\nSie kö;nnen dies durch Klick auf den nachstehenden Link erledigen: \n\n\t<%activationUrl%>\n\nSie haben dafür zwei Tage. Danach wird dieser Aktivierungslink ungültig.");
+define('_ACTIVATE_FORGOT_TEXT', 'Sie kö;nnen für den nachstehenden Konto ein neues Passwort bestimmen:');
+define('_ACTIVATE_CHANGE_MAIL', "Hallo <%memberName%>,\n\nDa Ihre eMail-Adresse geändert wurde, müssen Sie Ihren Konto bei <%siteName%> (<%siteUrl%>) neu aktivieren.\nSie kö;nnen dies durch Klick auf den nachstehenden Link erledigen: \n\n\t<%activationUrl%>\n\nSie haben dafür zwei Tage. Danach wird dieser Aktivierungslink ungültig.");
define('_ACTIVATE_CHANGE_MAILTITLE',"Ereute Aktivierung Ihres '<%memberName%>'-Konto");
define('_ACTIVATE_CHANGE_TITLE', 'Willkommen, <%memberName%>');
-define('_ACTIVATE_CHANGE_TEXT', 'Ihre Adressänderung wurde überprüft. Vielen Dank!');
+define('_ACTIVATE_CHANGE_TEXT', 'Ihre Adressänderung wurde überprüft. Vielen Dank!');
define('_ACTIVATE_SUCCESS_TITLE', 'Aktivierung erfolgreich abgeschlossen');
define('_ACTIVATE_SUCCESS_TEXT', 'Ihr Konto wurde erfolgreich aktiviert.');
define('_MEMBERS_SETPWD', 'Passwort festlegen');
define('_MEMBERS_SETPWD_BTN', 'Passwort festlegen');
define('_QMENU_ACTIVATE', 'Konto Aktivierung');
-define('_QMENU_ACTIVATE_TEXT', '<p>Nachdem Sie Ihr Konto aktiviert haben, kö;nnen Sie sich <a href="index.php?action=showlogin">anmelden</a>.</p>');
+define('_QMENU_ACTIVATE_TEXT', '<p>Nachdem Sie Ihr Konto aktiviert haben, kö;nnen Sie sich <a href="index.php?action=showlogin">anmelden</a>.</p>');
define('_PLUGS_BTN_UPDATE', 'Abonnementliste aktualisieren');
// global settings
define('_SETTINGS_JSTOOLBAR', 'Javascript Werkzeugleisten-Stil');
-define('_SETTINGS_JSTOOLBAR_FULL', 'Vollständige Werkzeugleiste (IE)');
+define('_SETTINGS_JSTOOLBAR_FULL', 'Vollständige Werkzeugleiste (IE)');
define('_SETTINGS_JSTOOLBAR_SIMPLE','Einfache Werkzeugleiste (Nicht-IE)');
define('_SETTINGS_JSTOOLBAR_NONE', 'Deaktiviere Werkzeugleiste');
define('_SETTINGS_URLMODE_HELP', '(Info: <a href="documentation/tips.html#searchengines-fancyurls">Wie werden Fancy URLs aktiviert</a>)');
// extra plugin settings part when editing categories/members/blogs/...
-define('_PLUGINS_EXTRA', 'Zusätzliche Plugin Einstellungen');
+define('_PLUGINS_EXTRA', 'Zusätzliche Plugin Einstellungen');
// itemlist info column keys
define('_LIST_ITEM_BLOG', 'Blog:');
define('_LIST_COMMENTS_MEMBER', '(Mitglied)');
// batch operations
-define('_BATCH_WITH_SEL', 'Mit ausgewählten:');
-define('_BATCH_EXEC', 'Ausführen');
+define('_BATCH_WITH_SEL', 'Mit ausgewählten:');
+define('_BATCH_EXEC', 'Ausführen');
// quickmenu
define('_QMENU_HOME', 'Home');
define('_QMENU_ADD', 'Neuer Artikel');
-define('_QMENU_ADD_SELECT', '-- auswählen --');
+define('_QMENU_ADD_SELECT', '-- auswählen --');
define('_QMENU_USER_SETTINGS', 'Einstellungen');
define('_QMENU_USER_ITEMS', 'Artikel');
define('_QMENU_USER_COMMENTS', 'Kommentare');
define('_QMENU_PLUGINS', 'Plugins');
// quickmenu on logon screen
-define('_QMENU_INTRO', 'Einführung');
-define('_QMENU_INTRO_TEXT', '<p>Dies ist die Login-Seite für das Nucleus CMS, dem Content Management-System zur Verwaltung dieser Website.</p><p>Wenn Sie ein Benutzerkonto besitzen, kö;nnen Sie sich anmelden und mit der Eingabe neuer Artikel beginnen.</p>');
+define('_QMENU_INTRO', 'Einführung');
+define('_QMENU_INTRO_TEXT', '<p>Dies ist die Login-Seite für das Nucleus CMS, dem Content Management-System zur Verwaltung dieser Website.</p><p>Wenn Sie ein Benutzerkonto besitzen, kö;nnen Sie sich anmelden und mit der Eingabe neuer Artikel beginnen.</p>');
// helppages for plugins
-define('_ERROR_PLUGNOHELPFILE', 'Die Hilfedatei für dieses Plugin wurde nicht gefunden');
-define('_PLUGS_HELP_TITLE', 'Hilfe fü das Plugin');
+define('_ERROR_PLUGNOHELPFILE', 'Die Hilfedatei für dieses Plugin wurde nicht gefunden');
+define('_PLUGS_HELP_TITLE', 'Hilfe fü das Plugin');
define('_LIST_PLUGS_HELP', 'Hilfe');
// media library
define('_MEDIA_VIEW', 'anzeigen');
-define('_MEDIA_VIEW_TT', 'Datei anzeigen (ö;ffnet sich in einem neuen Fenster)');
+define('_MEDIA_VIEW_TT', 'Datei anzeigen (ö;ffnet sich in einem neuen Fenster)');
define('_MEDIA_FILTER_APPLY', 'Filter anwenden');
define('_MEDIA_FILTER_LABEL', 'Filter: ');
define('_MEDIA_UPLOAD_TO', 'Upload nach...');
define('_MEDIA_COLLECTION_LABEL', 'Aktuelle Sammlung: ');
// tooltips on toolbar
-define('_ADD_ALIGNLEFT_TT', 'Linksbündig ausrichten');
-define('_ADD_ALIGNRIGHT_TT', 'Rechtsbündig ausrichten');
+define('_ADD_ALIGNLEFT_TT', 'Linksbündig ausrichten');
+define('_ADD_ALIGNRIGHT_TT', 'Rechtsbündig ausrichten');
define('_ADD_ALIGNCENTER_TT', 'Mittig ausrichten');
// posting to the past/edit timestamps
define('_EBLOG_ALLOWPASTPOSTING', 'Posten zu vergangenem Datum erlauben');
-define('_ADD_CHANGEDATE', 'Zeitstempel ändern');
-define('_BMLET_CHANGEDATE', 'Zeitstempel ändern');
+define('_ADD_CHANGEDATE', 'Zeitstempel ändern');
+define('_BMLET_CHANGEDATE', 'Zeitstempel ändern');
// skin import/export
define('_OVERVIEW_SKINIMPORT', 'Designvorlage importieren/exportieren...');
define('_SETTINGS_URLMODE_PATHINFO','Fancy');
// Batch operations
-define('_BATCH_NOSELECTION', 'Kein Ziel für die Aktion ausgewählt');
-define('_BATCH_ITEMS', 'Stapelaktionen für Beiträge');
-define('_BATCH_CATEGORIES', 'Stapelaktionen für Kategorien');
-define('_BATCH_MEMBERS', 'Stapeloperationen für Mitglieder');
-define('_BATCH_TEAM', 'Stapeloperationen für Teammitglieder');
-define('_BATCH_COMMENTS', 'Stapeloperationen für Kommentare');
+define('_BATCH_NOSELECTION', 'Kein Ziel für die Aktion ausgewählt');
+define('_BATCH_ITEMS', 'Stapelaktionen für Beiträge');
+define('_BATCH_CATEGORIES', 'Stapelaktionen für Kategorien');
+define('_BATCH_MEMBERS', 'Stapeloperationen für Mitglieder');
+define('_BATCH_TEAM', 'Stapeloperationen für Teammitglieder');
+define('_BATCH_COMMENTS', 'Stapeloperationen für Kommentare');
define('_BATCH_UNKNOWN', 'Unbekannte Stapeloperation: ');
-define('_BATCH_EXECUTING', 'Wird ausgeführt:');
+define('_BATCH_EXECUTING', 'Wird ausgeführt:');
define('_BATCH_ONCATEGORY', 'in Kategorie');
define('_BATCH_ONITEM', 'an Beitrag');
define('_BATCH_ONCOMMENT', 'an Kommentar');
define('_BATCH_ONTEAM', 'an Teammitglied');
define('_BATCH_SUCCESS', 'Erfolgreich beendet!');
define('_BATCH_DONE', 'Erledigt!');
-define('_BATCH_DELETE_CONFIRM', 'Lö;schen im Batchbetrieb bestätigen');
-define('_BATCH_DELETE_CONFIRM_BTN', 'Lö;schen bestätigen');
-define('_BATCH_SELECTALL', 'Alle auswählen');
-define('_BATCH_DESELECTALL', 'Alle abwählen');
+define('_BATCH_DELETE_CONFIRM', 'Lö;schen im Batchbetrieb bestätigen');
+define('_BATCH_DELETE_CONFIRM_BTN', 'Lö;schen bestätigen');
+define('_BATCH_SELECTALL', 'Alle auswählen');
+define('_BATCH_DESELECTALL', 'Alle abwählen');
// batch operations: options in dropdowns
-define('_BATCH_ITEM_DELETE', 'Lö;schen');
+define('_BATCH_ITEM_DELETE', 'Lö;schen');
define('_BATCH_ITEM_MOVE', 'Verschieben');
-define('_BATCH_MEMBER_DELETE', 'Lö;schen');
+define('_BATCH_MEMBER_DELETE', 'Lö;schen');
define('_BATCH_MEMBER_SET_ADM', 'Administratorrechte geben');
define('_BATCH_MEMBER_UNSET_ADM', 'Administratorrechte nehmen');
-define('_BATCH_TEAM_DELETE', 'Aus Team lö;schen');
+define('_BATCH_TEAM_DELETE', 'Aus Team lö;schen');
define('_BATCH_TEAM_SET_ADM', 'Administratorrechte geben');
define('_BATCH_TEAM_UNSET_ADM', 'Administratorrechte nehmen');
-define('_BATCH_CAT_DELETE', 'Lö;schen');
+define('_BATCH_CAT_DELETE', 'Lö;schen');
define('_BATCH_CAT_MOVE', 'In anderes Blog verschieben');
-define('_BATCH_COMMENT_DELETE', 'Lö;schen');
+define('_BATCH_COMMENT_DELETE', 'Lö;schen');
// itemlist: Add new item...
-define('_ITEMLIST_ADDNEW', 'Neuen Artikel Hinzufügen');
-define('_ADD_PLUGIN_EXTRAS', 'Zusätzliche Plugin Optionen');
+define('_ITEMLIST_ADDNEW', 'Neuen Artikel Hinzufügen');
+define('_ADD_PLUGIN_EXTRAS', 'Zusätzliche Plugin Optionen');
// errors
define('_ERROR_CATCREATEFAIL', 'Neue Kategorie konnte nicht angelegt werden');
define('_ERROR_NUCLEUSVERSIONREQ', 'Das Plugin braucht eine neuere Nucleus Version: ');
// backlinks
-define('_BACK_TO_BLOGSETTINGS', 'Zurück zu den Blog Einstellungen');
+define('_BACK_TO_BLOGSETTINGS', 'Zurück zu den Blog Einstellungen');
// skin import export
define('_SKINIE_TITLE_IMPORT', 'Importieren');
define('_SKINIE_TITLE_EXPORT', 'Exportieren');
define('_SKINIE_BTN_IMPORT', 'Importieren');
-define('_SKINIE_BTN_EXPORT', 'Exportieren der ausgewählten Designvorlagen/Templates');
+define('_SKINIE_BTN_EXPORT', 'Exportieren der ausgewählten Designvorlagen/Templates');
define('_SKINIE_LOCAL', 'Importieren von lokaler Datei:');
define('_SKINIE_NOCANDIDATES', 'Keine Dateien zum Importieren gefunden');
define('_SKINIE_FROMURL', 'Importieren von URL:');
-define('_SKINIE_EXPORT_INTRO', 'Unten auswählen, was exportiert werden soll');
+define('_SKINIE_EXPORT_INTRO', 'Unten auswählen, was exportiert werden soll');
define('_SKINIE_EXPORT_SKINS', 'Designvorlagen');
define('_SKINIE_EXPORT_TEMPLATES', 'Templates');
define('_SKINIE_EXPORT_EXTRA', 'Extra Info');
-define('_SKINIE_CONFIRM_OVERWRITE', 'Bestehende Designvorlagen überschreiben (siehe unten)');
+define('_SKINIE_CONFIRM_OVERWRITE', 'Bestehende Designvorlagen überschreiben (siehe unten)');
define('_SKINIE_CONFIRM_IMPORT', 'Ja, importieren');
define('_SKINIE_CONFIRM_TITLE', 'Designvorlagen und Templates importieren');
define('_SKINIE_INFO_SKINS', 'Designvorlagen in der Datei:');
// skin overview list
define('_LIST_SKINS_INCMODE', 'Include-Modus:');
-define('_LIST_SKINS_INCPREFIX', 'Include-Präfix:');
+define('_LIST_SKINS_INCPREFIX', 'Include-Präfix:');
define('_LIST_SKINS_DEFINED', 'Definierte Teile:');
// backup
define('_BACKUP_BTN', 'Sicherungskopie erstellen');
define('_BACKUP_NOTE', '<b>Achtung:</b> Nur die Datenbank wird gespeichert. Media-Dateien und Einstellungen in der config.php werden <b>NICHT</b> gespeichert.');
define('_RESTORE_TITLE', 'Wiederherstellen');
-define('_RESTORE_NOTE', '<b>WARNUNG:</b> Wiederherstellen wird alle bestehenden Daten <b>Lö;SCHEN</b>!<br /> <b>Achtung:</b> Die Version von Sicherungskopie und Laufzeitsystem muss übereinstimmen, ansonsten wird es nicht funktionieren!');
-define('_RESTORE_INTRO', 'Sicherungsdatei auswählen, danach startet das Wiederherstellen.');
+define('_RESTORE_NOTE', '<b>WARNUNG:</b> Wiederherstellen wird alle bestehenden Daten <b>Lö;SCHEN</b>!<br /> <b>Achtung:</b> Die Version von Sicherungskopie und Laufzeitsystem muss übereinstimmen, ansonsten wird es nicht funktionieren!');
+define('_RESTORE_INTRO', 'Sicherungsdatei auswählen, danach startet das Wiederherstellen.');
define('_RESTORE_IMSURE', 'Ja, ich will wiederherstellen!');
define('_RESTORE_BTN', 'Von Datei wiederherstellen');
define('_RESTORE_WARNING', '(sichergehen, dass die Sicherungsdatei aktuell ist)');
define('_NOTIFY_HOST', 'Host:');
define('_NOTIFY_IP', 'IP:');
define('_NOTIFY_MEMBER', 'Mitglied:');
-define('_NOTIFY_TITLE', 'überschrift:');
+define('_NOTIFY_TITLE', 'überschrift:');
define('_NOTIFY_CONTENTS', 'Inhalt:');
// member mail message
// START introduced after v1.1 START
// bookmarklet buttons
-define('_BMLET_ADD', 'Hinzufügen');
+define('_BMLET_ADD', 'Hinzufügen');
define('_BMLET_EDIT', 'Bearbeiten');
-define('_BMLET_DELETE', 'Lö;schen');
-define('_BMLET_BODY', 'Einführung');
+define('_BMLET_DELETE', 'Lö;schen');
+define('_BMLET_BODY', 'Einführung');
define('_BMLET_MORE', 'Erweitert');
define('_BMLET_OPTIONS', 'Optionen');
define('_BMLET_PREVIEW', 'Vorschau');
// used in bookmarklet
define('_ITEM_UPDATED', 'Bookmarklet wurde aktualisiert');
-define('_ITEM_DELETED', 'Bookmarklet wurde gelö;scht');
+define('_ITEM_DELETED', 'Bookmarklet wurde gelö;scht');
// plugins
-define('_CONFIRMTXT_PLUGIN', 'Plugin wirklich lö;schen');
+define('_CONFIRMTXT_PLUGIN', 'Plugin wirklich lö;schen');
define('_ERROR_NOSUCHPLUGIN', 'Kein solches Plugin');
define('_ERROR_DUPPLUGIN', 'Dieses Plugin ist bereits installiert');
define('_ERROR_PLUGFILEERROR', 'Dieses Plugin existiert nicht oder es sind unzureichende Zugriffsrechte vorhanden');
define('_PLUGS_TITLE_UPDATE', 'Liste aktualisieren');
define('_PLUGS_TEXT_UPDATE', 'Nucleus CMS verwendet einen Cache um die Events, die Plugins abonniert haben, zu speichern. Nach dem Aktualisieren oder der Neuinstallation eines Plugins kann es notwendig werden, die Abonnentenliste zu aktualisieren.');
define('_PLUGS_TITLE_NEW', 'Neues Plugin installieren');
-define('_PLUGS_ADD_TEXT', 'Unten steht eine Liste von mö;glichen, nicht installierten Plugins. Bitte <strong>vor dem Installieren sicherstellen</strong>, dass es tats\1achlich ein Plugin ist.');
+define('_PLUGS_ADD_TEXT', 'Unten steht eine Liste von mö;glichen, nicht installierten Plugins. Bitte <strong>vor dem Installieren sicherstellen</strong>, dass es tats\1achlich ein Plugin ist.');
define('_PLUGS_BTN_INSTALL', 'Plugin installieren');
-define('_BACKTOOVERVIEW', 'Zurück zur übersicht');
+define('_BACKTOOVERVIEW', 'Zurück zur übersicht');
// editlink
define('_TEMPLATE_EDITLINK', 'Link bearbeiten');
// add left / add right tooltips
-define('_ADD_LEFT_TT', 'Linke Box hinzufügen');
-define('_ADD_RIGHT_TT', 'Rechte Box hinzufügen');
+define('_ADD_LEFT_TT', 'Linke Box hinzufügen');
+define('_ADD_RIGHT_TT', 'Rechte Box hinzufügen');
// add/edit item: new category (in dropdown box)
define('_ADD_NEWCAT', 'Neue Kategorie...');
// new settings
define('_SETTINGS_PLUGINURL', 'Plugin-URL');
-define('_SETTINGS_MAXUPLOADSIZE', 'Max. Upload-Dateigrö;ße (Bytes)');
+define('_SETTINGS_MAXUPLOADSIZE', 'Max. Upload-Dateigrö;ße (Bytes)');
define('_SETTINGS_NONMEMBERMSGS', 'Erlaube Nicht-Mitgliedern das Senden von Nachrichten');
-define('_SETTINGS_PROTECTMEMNAMES', 'Mitgliedernamen schützen');
+define('_SETTINGS_PROTECTMEMNAMES', 'Mitgliedernamen schützen');
// overview screen
define('_OVERVIEW_PLUGINS', 'Plugins verwalten...');
define('_LIST_PLUGS_VER', 'Version:');
define('_LIST_PLUGS_SITE', 'Seite besuchen');
define('_LIST_PLUGS_DESC', 'Beschreibung:');
-define('_LIST_PLUGS_SUBS', 'Folgende Ereignisse übermitteln:');
+define('_LIST_PLUGS_SUBS', 'Folgende Ereignisse übermitteln:');
define('_LIST_PLUGS_UP', 'nach oben');
define('_LIST_PLUGS_DOWN', 'nach unten');
define('_LIST_PLUGS_UNINSTALL', 'deinstallieren');
// plugin options
define('_ERROR_NOPLUGOPTIONS', 'Dieses Plugin hat keine Optionen eingestellt');
-define('_PLUGS_BACK', 'Zurück zur Plugin übersicht');
+define('_PLUGS_BACK', 'Zurück zur Plugin übersicht');
define('_PLUGS_SAVE', 'Optionen speichern');
define('_PLUGS_OPTIONS_UPDATED', 'Plugin-Optionen aktualisiert');
define('_OVERVIEW_MANAGEMENT', 'Verwaltung');
define('_MANAGE_GENERAL', 'Verschiedene Einstellungen');
define('_MANAGE_SKINS', 'Skins und Vorlagen');
define('_MANAGE_EXTRA', 'Spezielle Einstellungen');
-define('_BACKTOMANAGE', 'Zurück zur Nucleus Verwaltung');
+define('_BACKTOMANAGE', 'Zurück zur Nucleus Verwaltung');
// END introduced after v1.1 END
// global stuff
define('_SUBMIT', 'Absenden');
define('_ERROR', 'Fehler');
define('_ERRORMSG', 'Es ist ein Fehler aufgetreten!');
-define('_BACK', 'Zurück');
+define('_BACK', 'Zurück');
define('_NOTLOGGEDIN', 'Nicht angemeldet');
define('_LOGGEDINAS', 'Angemeldet als');
define('_ADMINHOME', 'Admin Startseite');
define('_NAME', 'Name');
-define('_BACKHOME', 'Zurück zur Admin Startseite');
+define('_BACKHOME', 'Zurück zur Admin Startseite');
define('_BADACTION', 'Angefragte Aktion existiert nicht');
define('_MESSAGE', 'Nachricht');
define('_HELP_TT', 'Hilfe!');
define('_YOURSITE', 'Ihre Website');
-define('_POPUP_CLOSE', 'Fenster schließen');
+define('_POPUP_CLOSE', 'Fenster schließen');
define('_LOGIN_PLEASE', 'Bitte zuerst anmelden');
// commentform
define('_COMMENTFORM_YOUARE', 'Sie sind');
-define('_COMMENTFORM_SUBMIT', 'Kommentar hinzufügen');
+define('_COMMENTFORM_SUBMIT', 'Kommentar hinzufügen');
define('_COMMENTFORM_COMMENT', 'Ihr Kommentar');
define('_COMMENTFORM_NAME', 'Name');
define('_COMMENTFORM_REMEMBER', 'Informiere mich');
define('_SEARCHFORM_SUBMIT', 'Suchen');
// add item form
-define('_ADD_ADDTO', 'Neuen Artikel hinzufügen zu');
+define('_ADD_ADDTO', 'Neuen Artikel hinzufügen zu');
define('_ADD_CREATENEW', 'Neuen Artikel erstellen');
define('_ADD_BODY', 'Inhalt');
-define('_ADD_TITLE', 'überschrift');
+define('_ADD_TITLE', 'überschrift');
define('_ADD_MORE', 'Erweitert (optional)');
define('_ADD_CATEGORY', 'Kategorie');
define('_ADD_PREVIEW', 'Vorschau');
define('_ADD_DISABLE_COMMENTS', 'Kommentare verbieten?');
-define('_ADD_ADDITEM', 'Artikel hinzufügen');
-define('_ADD_ADDNOW', 'Jetzt hinzufügen');
+define('_ADD_ADDITEM', 'Artikel hinzufügen');
+define('_ADD_ADDNOW', 'Jetzt hinzufügen');
define('_ADD_PLACE_ON', 'am');
-define('_ADD_ADDDRAFT', 'Zu Entwürfen hinzufügen');
-define('_ADD_DRAFTNFUTURE', 'Entwürfe & zukünftige Inhalte');
-define('_ADD_NOPASTDATES', '(Datum und Zeiten aus der Vergangenheit sind ungültig, wird durch aktuelles Datum ersetzt)');
+define('_ADD_ADDDRAFT', 'Zu Entwürfen hinzufügen');
+define('_ADD_DRAFTNFUTURE', 'Entwürfe & zukünftige Inhalte');
+define('_ADD_NOPASTDATES', '(Datum und Zeiten aus der Vergangenheit sind ungültig, wird durch aktuelles Datum ersetzt)');
define('_ADD_BOLD_TT', 'Fett');
define('_ADD_ITALIC_TT', 'Kursiv');
define('_ADD_HREF_TT', 'Link erstellen');
-define('_ADD_MEDIA_TT', 'Bild hinzufügen');
+define('_ADD_MEDIA_TT', 'Bild hinzufügen');
define('_ADD_PREVIEW_TT', 'Zeige/Verberge Vorschau');
-define('_ADD_CUT_TT', 'Lö;schen');
+define('_ADD_CUT_TT', 'Lö;schen');
define('_ADD_COPY_TT', 'Kopieren');
-define('_ADD_PASTE_TT', 'Einfügen');
+define('_ADD_PASTE_TT', 'Einfügen');
// edit item form
define('_EDIT_ITEM', 'Artikel bearbeiten');
define('_EDIT_SUBMIT', 'Artikel freigeben');
define('_EDIT_ORIG_AUTHOR', 'Autor - Urheber');
-define('_EDIT_BACKTODRAFTS', 'Entwurf um Hintergrund ergänzen');
+define('_EDIT_BACKTODRAFTS', 'Entwurf um Hintergrund ergänzen');
define('_EDIT_COMMENTSNOTE', '(Achtung: Beim Ausschalten der Kommentarfunktion bleiben bisherige Kommentare online)');
// used on delete screens
-define('_DELETE_CONFIRM', 'Bitte Lö;schen bestätigen');
-define('_DELETE_CONFIRM_BTN', 'Lö;schen bestätigen');
-define('_CONFIRMTXT_ITEM', 'Sie sind dabei, folgenden Artikel zu lö;schen:');
-define('_CONFIRMTXT_COMMENT', 'Sie sind dabei, den folgenden Kommentar zu lö;schen:');
+define('_DELETE_CONFIRM', 'Bitte Lö;schen bestätigen');
+define('_DELETE_CONFIRM_BTN', 'Lö;schen bestätigen');
+define('_CONFIRMTXT_ITEM', 'Sie sind dabei, folgenden Artikel zu lö;schen:');
+define('_CONFIRMTXT_COMMENT', 'Sie sind dabei, den folgenden Kommentar zu lö;schen:');
define('_CONFIRMTXT_TEAM1', 'Sie sind dabei ');
-define('_CONFIRMTXT_TEAM2', ' aus der Teamliste oder dem Blog zu lö;schen ');
-define('_CONFIRMTXT_BLOG', 'Folgendes Weblog soll gelö;scht werden: ');
-define('_WARNINGTXT_BLOGDEL', 'Achtung! Beim Lö;schung des Weblogs werden alle Artikel und Kommentare mitgelö;scht. Bitte bestätigen Sie diese Aktion noch einmal!<br />Bitte Nukleus während des Lö;schvorgangs nicht unterbrechen.');
-define('_CONFIRMTXT_MEMBER', 'Sie sind dabei, folgendes Mitglied zu lö;schen: ');
-define('_CONFIRMTXT_TEMPLATE', 'Sie sind dabei, folgendes Template zu lö;schen ');
-define('_CONFIRMTXT_SKIN', 'Sie sind dabei, folgende Designvorlage zu lö;schen ');
+define('_CONFIRMTXT_TEAM2', ' aus der Teamliste oder dem Blog zu lö;schen ');
+define('_CONFIRMTXT_BLOG', 'Folgendes Weblog soll gelö;scht werden: ');
+define('_WARNINGTXT_BLOGDEL', 'Achtung! Beim Lö;schung des Weblogs werden alle Artikel und Kommentare mitgelö;scht. Bitte bestätigen Sie diese Aktion noch einmal!<br />Bitte Nukleus während des Lö;schvorgangs nicht unterbrechen.');
+define('_CONFIRMTXT_MEMBER', 'Sie sind dabei, folgendes Mitglied zu lö;schen: ');
+define('_CONFIRMTXT_TEMPLATE', 'Sie sind dabei, folgendes Template zu lö;schen ');
+define('_CONFIRMTXT_SKIN', 'Sie sind dabei, folgende Designvorlage zu lö;schen ');
define('_CONFIRMTXT_BAN', 'Sie sind dabei, folgende blockierte IP-Adressen freizugeben');
-define('_CONFIRMTXT_CATEGORY', 'Sie sind dabei, folgende Kategorie zu lö;schen: ');
+define('_CONFIRMTXT_CATEGORY', 'Sie sind dabei, folgende Kategorie zu lö;schen: ');
// some status messages
-define('_DELETED_ITEM', 'Artikel gelö;scht');
-define('_DELETED_MEMBER', 'Mitglied gelö;scht');
-define('_DELETED_COMMENT', 'Kommentar gelö;scht');
-define('_DELETED_BLOG', 'Blog gelö;scht');
-define('_DELETED_CATEGORY', 'Kategorie gelö;scht');
+define('_DELETED_ITEM', 'Artikel gelö;scht');
+define('_DELETED_MEMBER', 'Mitglied gelö;scht');
+define('_DELETED_COMMENT', 'Kommentar gelö;scht');
+define('_DELETED_BLOG', 'Blog gelö;scht');
+define('_DELETED_CATEGORY', 'Kategorie gelö;scht');
define('_ITEM_MOVED', 'Artikel verschoben');
-define('_ITEM_ADDED', 'Artikel hinzugefügt');
-define('_COMMENT_UPDATED', 'Kommentar geändert');
+define('_ITEM_ADDED', 'Artikel hinzugefügt');
+define('_COMMENT_UPDATED', 'Kommentar geändert');
define('_SKIN_UPDATED', 'Designvorlage wurde gespeichert');
define('_TEMPLATE_UPDATED', 'Template Daten wurden gespeichert');
// errors
define('_ERROR_COMMENT_LONGWORD', 'Bitte keine Worte mit mehr als 90 Zeichen bei Kommentaren verwenden');
define('_ERROR_COMMENT_NOCOMMENT', 'Bitte einen Kommentar abgeben');
-define('_ERROR_COMMENT_NOUSERNAME', 'Username nicht zulässig');
+define('_ERROR_COMMENT_NOUSERNAME', 'Username nicht zulässig');
define('_ERROR_COMMENT_TOOLONG', 'Ihr Kommentar ist zu lang (max. 5.000 Zeichen)');
-define('_ERROR_COMMENTS_DISABLED', 'Kommentare sind in diesem Bereich momentan nicht mö;glich.');
-define('_ERROR_COMMENTS_NONPUBLIC', 'Kommentare kö;nnen hier nur von Mitgliedern abgegeben werden');
-define('_ERROR_COMMENTS_MEMBERNICK','Dieser Benutzername ist bereits vergeben. Bitte einen neuen auswählen.');
+define('_ERROR_COMMENTS_DISABLED', 'Kommentare sind in diesem Bereich momentan nicht mö;glich.');
+define('_ERROR_COMMENTS_NONPUBLIC', 'Kommentare kö;nnen hier nur von Mitgliedern abgegeben werden');
+define('_ERROR_COMMENTS_MEMBERNICK','Dieser Benutzername ist bereits vergeben. Bitte einen neuen auswählen.');
define('_ERROR_SKIN', 'Fehler in der Designvorlage');
-define('_ERROR_ITEMCLOSED', 'Dieser Diskussionspunkt ist geschlossen. Es kö;nnen keine Kommentare vergeben werden.');
+define('_ERROR_ITEMCLOSED', 'Dieser Diskussionspunkt ist geschlossen. Es kö;nnen keine Kommentare vergeben werden.');
define('_ERROR_NOSUCHITEM', 'Dieser Diskussionspunkt existiert nicht');
define('_ERROR_NOSUCHBLOG', 'Weblog nicht vorhanden');
define('_ERROR_NOSUCHSKIN', 'Designvorlage nicht vorhanden');
define('_ERROR_NOSUCHMEMBER', 'Benutzer nicht vorhanden');
-define('_ERROR_NOTONTEAM', 'Sie stehen nicht in der Teamliste für dieses Weblog.');
+define('_ERROR_NOTONTEAM', 'Sie stehen nicht in der Teamliste für dieses Weblog.');
define('_ERROR_BADDESTBLOG', 'Aufgerufenes Weblog existiert nicht');
define('_ERROR_NOTONDESTTEAM', 'Artikel kann nicht in dieses Weblog verschoben werden. Sie sind kein Mitglied dort');
-define('_ERROR_NOEMPTYITEMS', 'Leerer Artikel kann nicht hinzugefügt werden');
-define('_ERROR_BADMAILADDRESS', 'Keine gültige E-Mail-Adresse');
-define('_ERROR_BADNOTIFY', 'Eine oder mehrere der angegebenen E-Mail-Adressen ist ungültig');
-define('_ERROR_BADNAME', 'Benutzername ungültig (nur a-z und 0-9 gestattet, keine Leerzeichen am Beginn und am Ende)');
+define('_ERROR_NOEMPTYITEMS', 'Leerer Artikel kann nicht hinzugefügt werden');
+define('_ERROR_BADMAILADDRESS', 'Keine gültige E-Mail-Adresse');
+define('_ERROR_BADNOTIFY', 'Eine oder mehrere der angegebenen E-Mail-Adressen ist ungültig');
+define('_ERROR_BADNAME', 'Benutzername ungültig (nur a-z und 0-9 gestattet, keine Leerzeichen am Beginn und am Ende)');
define('_ERROR_NICKNAMEINUSE', 'Dieser Spitzname wird von einem anderen Mitglied benutzt');
-define('_ERROR_PASSWORDMISMATCH', 'Die Passwö;rter müsen übereinstimmen');
+define('_ERROR_PASSWORDMISMATCH', 'Die Passwö;rter müsen übereinstimmen');
define('_ERROR_PASSWORDTOOSHORT', 'Das Passwort sollte aus mindestens 6 Zeichen bestehen');
define('_ERROR_PASSWORDMISSING', 'Das Passwort darf nicht leer sein');
-define('_ERROR_REALNAMEMISSING', 'Sie müssen einen echten Namen angeben');
+define('_ERROR_REALNAMEMISSING', 'Sie müssen einen echten Namen angeben');
define('_ERROR_ATLEASTONEADMIN', 'Es muss immer ein Super-Administrator vorhanden sein.');
-define('_ERROR_ATLEASTONEBLOGADMIN','Wenn Sie dies tun, ist Ihr Weblog nicht mehr bearbeitbar. Sie müssen mindestens einen Administrator bestimmen.');
-define('_ERROR_ALREADYONTEAM', 'Mitglied schon vorhanden, kann nicht hinzugefügt werden');
-define('_ERROR_BADSHORTBLOGNAME', 'Der Kurzname für das Weblog kann nur a-z and 0-9 enthalten, ohne Leerzeichen');
-define('_ERROR_DUPSHORTBLOGNAME', 'Dieser Kurzname für ein Weblog ist bereits vergeben');
-define('_ERROR_UPDATEFILE', 'Habe keine Schreibrechte für die Update-Datei. Bitte Rechte korrekt einstellen (chmod 666). Bitte berücksichtigen, dass der Speicherplatz relativ zum Admin-Verzeichnis liegt, eventuell also absoluten Pfad angeben (z.B. /home/www/site10/web/nucleus/)');
-define('_ERROR_DELDEFBLOG', 'Standard Weblog kann nicht gelö;scht werden');
-define('_ERROR_DELETEMEMBER', 'Dieses Mitglied kann nicht gelö;scht werden. Vermutlich ist es als Autor geführt');
-define('_ERROR_BADTEMPLATENAME', 'Ungültiger Template Name, nur a-z und 0-9 verwenden, ohne Leerzeichen');
+define('_ERROR_ATLEASTONEBLOGADMIN','Wenn Sie dies tun, ist Ihr Weblog nicht mehr bearbeitbar. Sie müssen mindestens einen Administrator bestimmen.');
+define('_ERROR_ALREADYONTEAM', 'Mitglied schon vorhanden, kann nicht hinzugefügt werden');
+define('_ERROR_BADSHORTBLOGNAME', 'Der Kurzname für das Weblog kann nur a-z and 0-9 enthalten, ohne Leerzeichen');
+define('_ERROR_DUPSHORTBLOGNAME', 'Dieser Kurzname für ein Weblog ist bereits vergeben');
+define('_ERROR_UPDATEFILE', 'Habe keine Schreibrechte für die Update-Datei. Bitte Rechte korrekt einstellen (chmod 666). Bitte berücksichtigen, dass der Speicherplatz relativ zum Admin-Verzeichnis liegt, eventuell also absoluten Pfad angeben (z.B. /home/www/site10/web/nucleus/)');
+define('_ERROR_DELDEFBLOG', 'Standard Weblog kann nicht gelö;scht werden');
+define('_ERROR_DELETEMEMBER', 'Dieses Mitglied kann nicht gelö;scht werden. Vermutlich ist es als Autor geführt');
+define('_ERROR_BADTEMPLATENAME', 'Ungültiger Template Name, nur a-z und 0-9 verwenden, ohne Leerzeichen');
define('_ERROR_DUPTEMPLATENAME', 'Ein Template mit diesem Namen ist bereits vorhanden');
-define('_ERROR_BADSKINNAME', 'Ungültiger Name für Designvorlage (nur a-z, 0-9 erlaubt, keine Leerzeichen)');
+define('_ERROR_BADSKINNAME', 'Ungültiger Name für Designvorlage (nur a-z, 0-9 erlaubt, keine Leerzeichen)');
define('_ERROR_DUPSKINNAME', 'Eine Designvorlage mit diesem Namen ist bereits vorhanden');
define('_ERROR_DEFAULTSKIN', 'Es muss immer eine Designvorlage mit dem Namen "default" vorhanden sein');
-define('_ERROR_SKINDEFDELETE', 'Designvorlage \'default\' kann nicht gelö;scht werden für das folgende Weblog: ');
+define('_ERROR_SKINDEFDELETE', 'Designvorlage \'default\' kann nicht gelö;scht werden für das folgende Weblog: ');
define('_ERROR_DISALLOWED', 'Sie sind zu dieser Aktion nicht berechtigt');
-define('_ERROR_DELETEBAN', 'Fehler beim lö;schen des IP-Ban (existiert nicht)');
-define('_ERROR_ADDBAN', 'Fehler beim hinzufügen des IP-Ban. Mö;glicherweise nicht in allen Weblogs korrekt hinzugefügt.');
-define('_ERROR_BADACTION', 'Diese Aktion ist nicht mö;glich');
+define('_ERROR_DELETEBAN', 'Fehler beim lö;schen des IP-Ban (existiert nicht)');
+define('_ERROR_ADDBAN', 'Fehler beim hinzufügen des IP-Ban. Mö;glicherweise nicht in allen Weblogs korrekt hinzugefügt.');
+define('_ERROR_BADACTION', 'Diese Aktion ist nicht mö;glich');
define('_ERROR_MEMBERMAILDISABLED', 'eMails von Mitglied zu Mitglied sind gesperrt');
define('_ERROR_MEMBERCREATEDISABLED','Mitgliedereintrag ist gesperrt');
define('_ERROR_INCORRECTEMAIL', 'Falsche eMail-Adresse');
define('_ERROR_VOTEDBEFORE', 'Sie haben zu diesem Thema schon abgestimmt');
-define('_ERROR_BANNED1', 'Aktion nicht durchführbar, weil Sie (IP-Bereich ');
-define('_ERROR_BANNED2', ') hierfür gesperrt sind. Ihre Nachricht: \'');
+define('_ERROR_BANNED1', 'Aktion nicht durchführbar, weil Sie (IP-Bereich ');
+define('_ERROR_BANNED2', ') hierfür gesperrt sind. Ihre Nachricht: \'');
define('_ERROR_BANNED3', '\'');
-define('_ERROR_LOGINNEEDED', 'Für diese Aktion müssen Sie angemeldet sein');
+define('_ERROR_LOGINNEEDED', 'Für diese Aktion müssen Sie angemeldet sein');
define('_ERROR_CONNECT', 'Verbindungsfehler');
define('_ERROR_FILE_TOO_BIG', 'Datei ist zu gross!');
define('_ERROR_BADFILETYPE', 'Dieser Dateityp ist nicht gestattet');
define('_ERROR_BADREQUEST', 'Upload fehlgeschlagen');
-define('_ERROR_DISALLOWEDUPLOAD', 'Sie sind kein Teammitglied. Deshalb dürfen Sie keine Dateien hochladen');
-define('_ERROR_BADPERMISSIONS', 'Zugriffsrechte für Datei oder Verzeichnis falsch eingestellt');
+define('_ERROR_DISALLOWEDUPLOAD', 'Sie sind kein Teammitglied. Deshalb dürfen Sie keine Dateien hochladen');
+define('_ERROR_BADPERMISSIONS', 'Zugriffsrechte für Datei oder Verzeichnis falsch eingestellt');
define('_ERROR_UPLOADMOVEP', 'Datei konnte nicht verschoben werden');
define('_ERROR_UPLOADCOPY', 'Datei konnte nicht kopiert werden');
define('_ERROR_UPLOADDUPLICATE', 'Datei mit diesem Namen bereits vorhanden. Bitte vor dem Upload umbenennen.');
-define('_ERROR_LOGINDISALLOWED', 'Sie sind für den Administrationsbereich nicht freigeschaltet. Sie kö;nnen sich als Benutzer anmelden.');
+define('_ERROR_LOGINDISALLOWED', 'Sie sind für den Administrationsbereich nicht freigeschaltet. Sie kö;nnen sich als Benutzer anmelden.');
define('_ERROR_DBCONNECT', 'Keine Verbindung zum mySQL-Server');
define('_ERROR_DBSELECT', 'Nucleus Datenbank nicht gefunden');
define('_ERROR_NOSUCHLOCALE', 'Keine entsprechende Sprachdatei gefunden');
define('_ERROR_NOSUCHCATEGORY', 'Keine entsprechende Kategorie vorhanden');
define('_ERROR_DELETELASTCATEGORY', 'Es muss mindestens eine Kategorie existieren');
-define('_ERROR_DELETEDEFCATEGORY', 'Standard Kategorie kann nicht gelö;scht werden');
-define('_ERROR_BADCATEGORYNAME', 'Ungültiger Kategoriename');
+define('_ERROR_DELETEDEFCATEGORY', 'Standard Kategorie kann nicht gelö;scht werden');
+define('_ERROR_BADCATEGORYNAME', 'Ungültiger Kategoriename');
define('_ERROR_DUPCATEGORYNAME', 'Eine andere Kategorie deses Namens existiert bereits');
// some warnings (used for mediadir setting)
// media and upload
define('_MEDIA_UPLOADLINK', 'Neue Datei hochladen');
-define('_MEDIA_MODIFIED', 'geändert');
+define('_MEDIA_MODIFIED', 'geändert');
define('_MEDIA_FILENAME', 'Dateiname');
define('_MEDIA_DIMENSIONS', 'Abmessungen');
define('_MEDIA_INLINE', 'Im Text eingebunden');
define('_MEDIA_POPUP', 'Als Popup');
-define('_UPLOAD_TITLE', 'Datei auswählen');
-define('_UPLOAD_MSG', 'Datei, die Sie hochladen mö;chten, auswählen, und Hochladen-Taste klicken.');
+define('_UPLOAD_TITLE', 'Datei auswählen');
+define('_UPLOAD_MSG', 'Datei, die Sie hochladen mö;chten, auswählen, und Hochladen-Taste klicken.');
define('_UPLOAD_BUTTON', 'Hochladen');
// some status messages
//define('_MSG_ACCOUNTCREATED', 'Konto erstellt, Passwort wird per eMail zugestellt');
//define('_MSG_PASSWORDSENT', 'Passwort wurde per eMail zugestellt.');
-define('_MSG_LOGINAGAIN', 'Sie müssen sich neu anmelden, da sich Ihre Benutzerdaten geändert haben');
-define('_MSG_SETTINGSCHANGED', 'Einstellungen geändert');
-define('_MSG_ADMINCHANGED', 'Administrator geändert');
+define('_MSG_LOGINAGAIN', 'Sie müssen sich neu anmelden, da sich Ihre Benutzerdaten geändert haben');
+define('_MSG_SETTINGSCHANGED', 'Einstellungen geändert');
+define('_MSG_ADMINCHANGED', 'Administrator geändert');
define('_MSG_NEWBLOG', 'Neues Weblog angelegt');
-define('_MSG_ACTIONLOGCLEARED', 'Logdatei gelö;scht');
+define('_MSG_ACTIONLOGCLEARED', 'Logdatei gelö;scht');
// actionlog in admin area
define('_ACTIONLOG_DISALLOWED', 'Verbotene Aktion: ');
define('_ACTIONLOG_PWDREMINDERSENT','Neues Passwort geschickt an ');
define('_ACTIONLOG_TITLE', 'Logdatei');
-define('_ACTIONLOG_CLEAR_TITLE', 'Logdatei lö;schen');
-define('_ACTIONLOG_CLEAR_TEXT', 'Logdatei jetzt lö;schen');
+define('_ACTIONLOG_CLEAR_TITLE', 'Logdatei lö;schen');
+define('_ACTIONLOG_CLEAR_TEXT', 'Logdatei jetzt lö;schen');
// team management
-define('_TEAM_TITLE', 'Team verwalten für Blog ');
+define('_TEAM_TITLE', 'Team verwalten für Blog ');
define('_TEAM_CURRENT', 'Derzeitiges Team');
-define('_TEAM_ADDNEW', 'Neues Teammitglied hinzufügen');
-define('_TEAM_CHOOSEMEMBER', 'Teammitglied auswählen');
+define('_TEAM_ADDNEW', 'Neues Teammitglied hinzufügen');
+define('_TEAM_CHOOSEMEMBER', 'Teammitglied auswählen');
define('_TEAM_ADMIN', 'Administratorrechte? ');
-define('_TEAM_ADD', 'Zum Team hinzufügen');
-define('_TEAM_ADD_BTN', 'Zum Team hinzufügen');
+define('_TEAM_ADD', 'Zum Team hinzufügen');
+define('_TEAM_ADD_BTN', 'Zum Team hinzufügen');
// blogsettings
define('_EBLOG_TITLE', 'Weblog Einstellungen bearbeiten');
define('_EBLOG_URL', 'URL');
define('_EBLOG_DEFSKIN', 'Standard Designvorlage');
define('_EBLOG_DEFCAT', 'Standard Kategorie');
-define('_EBLOG_LINEBREAKS', 'Zeilenumbrüche automatisch konvertieren');
-define('_EBLOG_DISABLECOMMENTS', 'Kommentare erlauben?<br /><small>(Wenn nicht erlaubt, sind Kommentare unmö;glich.)</small>');
+define('_EBLOG_LINEBREAKS', 'Zeilenumbrüche automatisch konvertieren');
+define('_EBLOG_DISABLECOMMENTS', 'Kommentare erlauben?<br /><small>(Wenn nicht erlaubt, sind Kommentare unmö;glich.)</small>');
define('_EBLOG_ANONYMOUS', 'Kommentare auch Nicht-Mitgliedern gestatten?');
define('_EBLOG_NOTIFY', 'Benachrichtigungs Addresse(n) (verwenden Sie ; als Trennzeichen)');
define('_EBLOG_NOTIFY_ON', 'Benachrichtigung ein');
define('_EBLOG_NOTIFY_COMMENT', 'Neue Kommentare');
define('_EBLOG_NOTIFY_KARMA', 'Neue Karma-Abstimmungsergebnisse');
-define('_EBLOG_NOTIFY_ITEM', 'Neue Weblog Einträge');
-define('_EBLOG_PING', 'Weblogs.com bei änderungen anpingen?');
+define('_EBLOG_NOTIFY_ITEM', 'Neue Weblog Einträge');
+define('_EBLOG_PING', 'Weblogs.com bei änderungen anpingen?');
define('_EBLOG_MAXCOMMENTS', 'Maximale Kommentarzahl');
define('_EBLOG_UPDATE', 'Update Datei');
define('_EBLOG_OFFSET', 'Zeitverschiebung');
define('_EBLOG_STIME', 'Aktuelle Serverzeit ist');
define('_EBLOG_BTIME', 'Aktuelle Systemzeit ist');
-define('_EBLOG_CHANGE', 'ändern');
-define('_EBLOG_CHANGE_BTN', 'ändern');
+define('_EBLOG_CHANGE', 'ändern');
+define('_EBLOG_CHANGE_BTN', 'ändern');
define('_EBLOG_ADMIN', 'Administrator');
define('_EBLOG_ADMIN_MSG', 'Sie besitzen Administratorrechte');
define('_EBLOG_CREATE_TITLE', 'Neues Weblog erstellen');
-define('_EBLOG_CREATE_TEXT', 'Formular ausfüllen, um ein neues Weblog zu erstellen. <br /><br /> <b>Achtung:</b> Nur die notwendigsten Einstellungen sind hier aufgeführt. Weitere Einstellungen lassen sich anschliessend über die Weblog-Einstellungen vornehmen.');
+define('_EBLOG_CREATE_TEXT', 'Formular ausfüllen, um ein neues Weblog zu erstellen. <br /><br /> <b>Achtung:</b> Nur die notwendigsten Einstellungen sind hier aufgeführt. Weitere Einstellungen lassen sich anschliessend über die Weblog-Einstellungen vornehmen.');
define('_EBLOG_CREATE', 'Erstellen!');
define('_EBLOG_CREATE_BTN', 'Weblog erstellen');
define('_EBLOG_CAT_TITLE', 'Kategorien');
// templates
define('_TEMPLATE_TITLE', 'Templates bearbeiten');
-define('_TEMPLATE_AVAILABLE_TITLE', 'Verfügbare Templates');
+define('_TEMPLATE_AVAILABLE_TITLE', 'Verfügbare Templates');
define('_TEMPLATE_NEW_TITLE', 'Neues Template');
define('_TEMPLATE_NAME', 'Template Name');
define('_TEMPLATE_DESC', 'Template Beschreibung');
define('_TEMPLATE_CREATE', 'Template erstellen');
define('_TEMPLATE_CREATE_BTN', 'Template erstellen');
define('_TEMPLATE_EDIT_TITLE', 'Template bearbeiten');
-define('_TEMPLATE_BACK', 'Zurück zur Template übersicht');
-define('_TEMPLATE_EDIT_MSG', 'Nicht alle Teile des Templates werden gebraucht, bitte nicht benö;tigte einfach leer lassen.');
+define('_TEMPLATE_BACK', 'Zurück zur Template übersicht');
+define('_TEMPLATE_EDIT_MSG', 'Nicht alle Teile des Templates werden gebraucht, bitte nicht benö;tigte einfach leer lassen.');
define('_TEMPLATE_SETTINGS', 'Template Einstellungen');
define('_TEMPLATE_ITEMS', 'Artikel');
define('_TEMPLATE_ITEMHEADER', 'Artikel Kopfzeile');
define('_TEMPLATE_ITEMBODY', 'Artikel Inhalt');
define('_TEMPLATE_ITEMFOOTER', 'Artikel Fusszeile');
-define('_TEMPLATE_MORELINK', 'Link zu ausführlicherem Beitrag');
+define('_TEMPLATE_MORELINK', 'Link zu ausführlicherem Beitrag');
define('_TEMPLATE_NEW', 'Eigenschaften des neuen Artikels');
define('_TEMPLATE_COMMENTS_ANY', 'Kommentare (falls vorhanden)');
-define('_TEMPLATE_CHEADER', 'Kommentar überschrift');
+define('_TEMPLATE_CHEADER', 'Kommentar überschrift');
define('_TEMPLATE_CBODY', 'Kommentar Inhalt');
define('_TEMPLATE_CFOOTER', 'Kommentar Fusszeile');
define('_TEMPLATE_CONE', 'Ein Kommentar');
define('_TEMPLATE_COMMENTS_TOOMUCH','Kommentare (falls vorhanden, aber zu viele, um sie hier darzustellen)');
define('_TEMPLATE_CTOOMUCH', 'Zu viele Kommentare');
define('_TEMPLATE_ARCHIVELIST', 'Archivliste');
-define('_TEMPLATE_AHEADER', 'Archivliste überschriften');
+define('_TEMPLATE_AHEADER', 'Archivliste überschriften');
define('_TEMPLATE_AITEM', 'Archivliste Artikel');
define('_TEMPLATE_AFOOTER', 'Archivliste Fusszeilen');
define('_TEMPLATE_DATETIME', 'Datum und Uhrzeit');
define('_TEMPLATE_SNOTFOUND', 'Suche ergab keine Ergebnisse');
define('_TEMPLATE_UPDATE', 'Neu speichern');
define('_TEMPLATE_UPDATE_BTN', 'Template neu speichern');
-define('_TEMPLATE_RESET_BTN', 'Zurücksetzen');
+define('_TEMPLATE_RESET_BTN', 'Zurücksetzen');
define('_TEMPLATE_CATEGORYLIST', 'Kategorielisten');
-define('_TEMPLATE_CATHEADER', 'Kategorielisten überschriften');
+define('_TEMPLATE_CATHEADER', 'Kategorielisten überschriften');
define('_TEMPLATE_CATITEM', 'Kategorielisten Artikel');
define('_TEMPLATE_CATFOOTER', 'Kategorielisten Fusszeilen');
// skins
define('_SKIN_EDIT_TITLE', 'Designvorlagen bearbeiten');
-define('_SKIN_AVAILABLE_TITLE', 'Verfügbare Designvorlagen');
+define('_SKIN_AVAILABLE_TITLE', 'Verfügbare Designvorlagen');
define('_SKIN_NEW_TITLE', 'Neue Designvorlage');
define('_SKIN_NAME', 'Name');
define('_SKIN_DESC', 'Beschreibung');
define('_SKIN_CREATE', 'Erstellen');
define('_SKIN_CREATE_BTN', 'Designvorlage erstellen');
define('_SKIN_EDITONE_TITLE', 'Designvorlage bearbeiten');
-define('_SKIN_BACK', 'Zurück zum überblick Designvorlagen');
+define('_SKIN_BACK', 'Zurück zum überblick Designvorlagen');
define('_SKIN_PARTS_TITLE', 'Designvorlagen-Teile');
-define('_SKIN_PARTS_MSG', 'Nicht alle Teile werden für Designvorlagen benö;tigt. Nicht benö;tigte Teile leer lassen. Designvorlage zum Bearbeiten auswählen:');
+define('_SKIN_PARTS_MSG', 'Nicht alle Teile werden für Designvorlagen benö;tigt. Nicht benö;tigte Teile leer lassen. Designvorlage zum Bearbeiten auswählen:');
define('_SKIN_PART_MAIN', 'Hauptseite');
define('_SKIN_PART_ITEM', 'Artikelseiten');
define('_SKIN_PART_ALIST', 'Archivliste');
define('_SKIN_PART_MEMBER', 'Benutzerinformationen');
define('_SKIN_PART_POPUP', 'Popup-Bilder');
define('_SKIN_GENSETTINGS_TITLE', 'Allgemeine Einstellungen');
-define('_SKIN_CHANGE', 'ändern');
-define('_SKIN_CHANGE_BTN', 'Diese Einstellungen ändern');
+define('_SKIN_CHANGE', 'ändern');
+define('_SKIN_CHANGE_BTN', 'Diese Einstellungen ändern');
define('_SKIN_UPDATE_BTN', 'Designvorlage neu speichern');
-define('_SKIN_RESET_BTN', 'Zurücksetzen');
+define('_SKIN_RESET_BTN', 'Zurücksetzen');
define('_SKIN_EDITPART_TITLE', 'Designvorlage bearbeiten');
-define('_SKIN_GOBACK', 'Zurück');
-define('_SKIN_ALLOWEDVARS', 'Gültige Variablen (klicken für mehr Infos):');
+define('_SKIN_GOBACK', 'Zurück');
+define('_SKIN_ALLOWEDVARS', 'Gültige Variablen (klicken für mehr Infos):');
// global settings
define('_SETTINGS_TITLE', 'Allgemeine Einstellungen');
define('_SETTINGS_SEECONFIGPHP', '(config.php beachten)');
define('_SETTINGS_MEDIAURL', 'Medien-URL (endet mit /)');
define('_SETTINGS_ALLOWUPLOAD', 'Datei-Upload gestatten?');
-define('_SETTINGS_ALLOWUPLOADTYPES','Gültige Dateitypen für den Upload');
-define('_SETTINGS_CHANGELOGIN', 'Benutzer dürfen Name/Passwort ändern');
+define('_SETTINGS_ALLOWUPLOADTYPES','Gültige Dateitypen für den Upload');
+define('_SETTINGS_CHANGELOGIN', 'Benutzer dürfen Name/Passwort ändern');
define('_SETTINGS_COOKIES_TITLE', 'Cookie Settings');
-define('_SETTINGS_COOKIELIFE', 'Lebensdauer Cookie für Benutzer');
+define('_SETTINGS_COOKIELIFE', 'Lebensdauer Cookie für Benutzer');
define('_SETTINGS_COOKIESESSION', 'Sitzungs-Cookies');
define('_SETTINGS_COOKIEMONTH', 'Lebensdauer ein Monat');
define('_SETTINGS_COOKIEPATH', 'Cookie-Pfad (fortgeschritten)');
define('_SETTINGS_LASTVISIT', 'Cookie des letzten Besuchs speichern');
define('_SETTINGS_ALLOWCREATE', 'Besuchern die Einrichtung eines Benutzer-Konto gestatten');
define('_SETTINGS_NEWLOGIN', 'Anmelden mit selbst erstelltem Konto gestatten');
-define('_SETTINGS_NEWLOGIN2', '(gilt nur für neue Benutzer-Konten)');
+define('_SETTINGS_NEWLOGIN2', '(gilt nur für neue Benutzer-Konten)');
define('_SETTINGS_MEMBERMSGS', 'Mitglied-zu-Mitglied-Kommunikation gestatten');
define('_SETTINGS_LOCALE', 'Standard Sprachmodul');
define('_SETTINGS_DISABLESITE', 'Seite offline schalten');
define('_SETTINGS_MEMBERS', 'Mitglieder Einstellungen');
// bans
-define('_BAN_TITLE', 'Zugriff verweigern für');
-define('_BAN_NONE', 'Keine Zugriffsperren für dieses Weblog');
+define('_BAN_TITLE', 'Zugriff verweigern für');
+define('_BAN_NONE', 'Keine Zugriffsperren für dieses Weblog');
define('_BAN_NEW_TITLE', 'Neue Zugriffssperre erstellen');
-define('_BAN_NEW_TEXT', 'Neue Zugriffssperre hinzufügen');
-define('_BAN_REMOVE_TITLE', 'Zugriffssperre lö;schen');
+define('_BAN_NEW_TEXT', 'Neue Zugriffssperre hinzufügen');
+define('_BAN_REMOVE_TITLE', 'Zugriffssperre lö;schen');
define('_BAN_IPRANGE', 'IP-Bereich');
define('_BAN_BLOGS', 'Welche Weblogs?');
-define('_BAN_DELETE_TITLE', 'Zugriffssperre lö;schen');
+define('_BAN_DELETE_TITLE', 'Zugriffssperre lö;schen');
define('_BAN_ALLBLOGS', 'Alle Zugriffssperren in Ihrem Admin-Bereich.');
-define('_BAN_REMOVED_TITLE', 'Zugriffssperre gelö;scht');
-define('_BAN_REMOVED_TEXT', 'Zugriffssperre in folgenden Weblogs gelö;scht:');
-define('_BAN_ADD_TITLE', 'Zugriffssperre hinzufügen');
-define('_BAN_IPRANGE_TEXT', 'Zu sperrenden IP-Bereich auswählen. Je weniger Nummern, desto mehr Benutzer werden blockiert.');
-define('_BAN_BLOGS_TEXT', 'Sie kö;nnen wahlweise nur ein Weblog sperren oder alle Punkte in Ihrem Admin-Bereich. Bitte auswählen.');
+define('_BAN_REMOVED_TITLE', 'Zugriffssperre gelö;scht');
+define('_BAN_REMOVED_TEXT', 'Zugriffssperre in folgenden Weblogs gelö;scht:');
+define('_BAN_ADD_TITLE', 'Zugriffssperre hinzufügen');
+define('_BAN_IPRANGE_TEXT', 'Zu sperrenden IP-Bereich auswählen. Je weniger Nummern, desto mehr Benutzer werden blockiert.');
+define('_BAN_BLOGS_TEXT', 'Sie kö;nnen wahlweise nur ein Weblog sperren oder alle Punkte in Ihrem Admin-Bereich. Bitte auswählen.');
define('_BAN_REASON_TITLE', 'Grund');
-define('_BAN_REASON_TEXT', 'Sie kö;nnen die Zugriffssperre begründen, dies wird dem Benutzer angezeigt. Maximal 256 Zeichen.');
-define('_BAN_ADD_BTN', 'Zugriffssperre hinzufügen');
+define('_BAN_REASON_TEXT', 'Sie kö;nnen die Zugriffssperre begründen, dies wird dem Benutzer angezeigt. Maximal 256 Zeichen.');
+define('_BAN_ADD_BTN', 'Zugriffssperre hinzufügen');
// LOGIN screen
define('_LOGIN_MESSAGE', 'Nachricht');
define('_MEMBERS_NEW', 'Neuer Benutzer');
define('_MEMBERS_DISPLAY', 'Name anzeigen');
define('_MEMBERS_DISPLAY_INFO', '(Mit diesem Namen melden Sie sich an)');
-define('_MEMBERS_REALNAME', 'Vollständiger Name');
+define('_MEMBERS_REALNAME', 'Vollständiger Name');
define('_MEMBERS_PWD', 'Passwort');
define('_MEMBERS_REPPWD', 'Paswort wiederholen');
define('_MEMBERS_EMAIL', 'eMail');
-define('_MEMBERS_EMAIL_EDIT', '(Beim ändern der eMail-Adresse erhalten Sie umgehend ein neues Passwort per Mail)');
+define('_MEMBERS_EMAIL_EDIT', '(Beim ändern der eMail-Adresse erhalten Sie umgehend ein neues Passwort per Mail)');
define('_MEMBERS_URL', 'Homepage Adresse (URL)');
define('_MEMBERS_SUPERADMIN', 'Administratorrechte');
define('_MEMBERS_CANLOGIN', 'Darf sich in den Admin-Bereich einloggen');
define('_MEMBERS_NOTES', 'Bemerkungen');
-define('_MEMBERS_NEW_BTN', 'Benutzer hinzufügen');
+define('_MEMBERS_NEW_BTN', 'Benutzer hinzufügen');
define('_MEMBERS_EDIT', 'Benutzer bearbeiten');
-define('_MEMBERS_EDIT_BTN', 'Einstellungen ändern');
-define('_MEMBERS_BACKTOOVERVIEW', 'Zurück zur Benutzerverwaltung');
+define('_MEMBERS_EDIT_BTN', 'Einstellungen ändern');
+define('_MEMBERS_BACKTOOVERVIEW', 'Zurück zur Benutzerverwaltung');
define('_MEMBERS_LOCALE', 'Sprache');
define('_MEMBERS_USESITELANG', '- Site-Einstellungen verwenden -');
// List of blogs (TT = tooltip)
-define('_BLOGLIST_TT_VISIT', 'Webseite auswählen');
-define('_BLOGLIST_ADD', 'Artikel hinzufügen');
-define('_BLOGLIST_TT_ADD', 'Neuen Artikel zu diesem Weblog hinzufügen');
-define('_BLOGLIST_EDIT', 'Artikel bearbeiten oder lö;schen');
+define('_BLOGLIST_TT_VISIT', 'Webseite auswählen');
+define('_BLOGLIST_ADD', 'Artikel hinzufügen');
+define('_BLOGLIST_TT_ADD', 'Neuen Artikel zu diesem Weblog hinzufügen');
+define('_BLOGLIST_EDIT', 'Artikel bearbeiten oder lö;schen');
define('_BLOGLIST_TT_EDIT', '');
define('_BLOGLIST_BMLET', 'Favoritenverwaltung');
define('_BLOGLIST_TT_BMLET', '');
define('_BLOGLIST_SETTINGS', 'Einstellungen');
-define('_BLOGLIST_TT_SETTINGS', 'Einstellungen ändern oder Team verwalten');
+define('_BLOGLIST_TT_SETTINGS', 'Einstellungen ändern oder Team verwalten');
define('_BLOGLIST_BANS', 'Zugriffssperren');
define('_BLOGLIST_TT_BANS', 'Zugriffssperren verwalten');
-define('_BLOGLIST_DELETE', 'Alles lö;schen');
-define('_BLOGLIST_TT_DELETE', 'Lö;sche dieses Weblog');
+define('_BLOGLIST_DELETE', 'Alles lö;schen');
+define('_BLOGLIST_TT_DELETE', 'Lö;sche dieses Weblog');
// OVERVIEW screen
define('_OVERVIEW_YRBLOGS', 'Ihre Weblogs');
-define('_OVERVIEW_YRDRAFTS', 'Ihre Entwürfe');
+define('_OVERVIEW_YRDRAFTS', 'Ihre Entwürfe');
define('_OVERVIEW_YRSETTINGS', 'Ihre Einstellungen');
define('_OVERVIEW_GSETTINGS', 'Allgemeine Einstellungen');
-define('_OVERVIEW_NOBLOGS', 'Sie sind nicht als Benutzer aufgeführt');
-define('_OVERVIEW_NODRAFTS', 'Keine Entwürfe');
+define('_OVERVIEW_NOBLOGS', 'Sie sind nicht als Benutzer aufgeführt');
+define('_OVERVIEW_NODRAFTS', 'Keine Entwürfe');
define('_OVERVIEW_EDITSETTINGS', 'Ihre Einstellungen bearbeiten...');
define('_OVERVIEW_BROWSEITEMS', 'Ihre Artikel auflisten...');
define('_OVERVIEW_BROWSECOMM', 'Ihre Kommentare auflisten...');
// LISTS (general)
define('_LISTS_NOMORE', 'Keine (weiteren) Ergebnisse');
-define('_LISTS_PREV', 'Zurück');
+define('_LISTS_PREV', 'Zurück');
define('_LISTS_NEXT', 'Weiter');
define('_LISTS_SEARCH', 'Suchen');
-define('_LISTS_CHANGE', 'ändern');
+define('_LISTS_CHANGE', 'ändern');
define('_LISTS_PERPAGE', 'Artikel/Seite');
define('_LISTS_ACTIONS', 'Aktionen');
-define('_LISTS_DELETE', 'Lö;schen');
+define('_LISTS_DELETE', 'Lö;schen');
define('_LISTS_EDIT', 'Bearbeiten');
define('_LISTS_MOVE', 'Verschieben');
define('_LISTS_CLONE', 'Kopieren');
// member list
define('_LIST_MEMBER_NAME', 'Name anzeigen');
-define('_LIST_MEMBER_RNAME', 'Vollständiger Name');
+define('_LIST_MEMBER_RNAME', 'Vollständiger Name');
define('_LIST_MEMBER_ADMIN', 'Super-Administrator? ');
define('_LIST_MEMBER_LOGIN', 'Kann sich anmelden? ');
define('_LIST_MEMBER_URL', 'Homepage');
// itemlist
define('_LIST_ITEM_INFO', 'Info');
-define('_LIST_ITEM_CONTENT', 'überschrift und Text');
+define('_LIST_ITEM_CONTENT', 'überschrift und Text');
// teamlist
define('_LIST_TEAM_ADMIN', 'Administrator ');
-define('_LIST_TEAM_CHADMIN', 'Administrator ändern');
+define('_LIST_TEAM_CHADMIN', 'Administrator ändern');
// edit comments
define('_EDITC_TITLE', 'Kommentare bearbeiten');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: de_Latn_DE.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: de_Latn_DE.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: el_Latn_GR.Windows-1253.php 1837 2012-05-13 04:12:13Z sakamocchi $
+ * @version $Id: el_Latn_GR.WINDOWS-1253.php 1837 2012-05-13 04:12:13Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2009 The Nucleus Group
- * @version $Id: en_Latn_US.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: en_Latn_US.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2009 The Nucleus Group
- * @version $Id: en_Latn_US.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: en_Latn_US.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: es_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: es_Latn_ES.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: es_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: es_Latn_ES.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: fa_Arab_IR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: fa_Arab_IR.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: fi_Latn_FI.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: fi_Latn_FI.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: fi_Latn_FI.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: fi_Latn_FI.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: fr_Latn_FR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: fr_Latn_FR.ISO-8859-15.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: fr_Latn_FR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: fr_Latn_FR.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
-<?
+<?php
/**
* Nucleus Translation File
* Galician in Spain (Latin script)
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: gl_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: gl_Latn_ES.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
-<?
+<?php
/**
* Nucleus Translation File
* Galician in Spain (Latin script)
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: gl_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: gl_Latn_ES.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: hr_Latn_HR.UTF-8.php 1837 2012-05-13 04:12:13Z sakamocchi $
+ * @version $Id: hr_Latn_HR.WINDOWS-1250.php 1837 2012-05-13 04:12:13Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: hu_Latn_HU.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: hu_Latn_HU.ISO-8859-2.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: hu_Latn_HU.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: hu_Latn_HU.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: id_Latn_ID.UTF-8.php 1837 2012-05-13 04:12:13Z sakamocchi $
+ * @version $Id: id_Latn_ID.ISO-8859-1.php 1837 2012-05-13 04:12:13Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: it_Latn_IT.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: it_Latn_IT.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: it_Latn_IT.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: it_Latn_IT.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2009 The NucleusCMS Japan¥Á¡¼¥à
- * @version $Id: ja_Jpan_JP.EUC-JP.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: ja_Jpan_JP.EUC-JP.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' Ä̾ï»ÅÍÍ');
define('_SKINABLEADMIN_HELPICONURL_STR', ' ¤Ç»ÈÍѤ¹¤ë¥¢¥¤¥³¥ó¤ÎURL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' ¤Ç»ÈÍѤ¹¤ë¥Ø¥ë¥×¥Õ¥¡¥¤¥ë¤ÎURL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ´ÉÍý¥¨¥ê¥¢¥¹¥¥óÍÑ¥¹¥¥óÊÑ¿ô');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ¥¹¥¥óÊÑ¿ô');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', '´ÉÍý¥¨¥ê¥¢¤Ç»ÈÍѤ¹¤ë¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', '°ìÍ÷ɽ¼¨Íѥơ¼¥Ö¥ë');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', '¥¯¥¤¥Ã¥¯¥á¥Ë¥å¡¼¤Ëɽ¼¨¤¹¤ë¥×¥é¥°¥¤¥ó¤Î´ÉÍý¥Ú¡¼¥¸¤Ø¤Î¥ê¥ó¥¯');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2009 The NucleusCMS Japanチーム
- * @version $Id: ja_Jpan_JP.EUC-JP.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: ja_Jpan_JP.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' 通常仕様');
define('_SKINABLEADMIN_HELPICONURL_STR', ' で使用するアイコンのURL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' で使用するヘルプファイルのURL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' 管理エリアスキン用スキン変数');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' スキン変数');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', '管理エリアで使用するセレクトボックス');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', '一覧表示用テーブル');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'クイックメニューに表示するプラグインの管理ページへのリンク');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: ko_Kore_KR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: ko_Kore_KR.EUC-KR.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: ko_Kore_KR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: ko_Kore_KR.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: lv_Latn_LV.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: lv_Latn_LV.ISO-8859-13.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: lv_Latn_LV.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: lv_Latn_LV.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: nl_Latn_NL.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: nl_Latn_NL.ISO-8859-15.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: nl_Latn_NL.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: nl_Latn_NL.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* Nucleus version: v1.0-v2.0
* Author: Rafael Cruz (bataelo@myrealbox.com) (on previous translation by Rodrigo Moraes)
- *
+ *
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: pt_Latn_BR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: pt_Latn_BR.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: pt_Latn_BR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: pt_Latn_BR.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
-INS<?php
+<?php
/**
* Nucleus CMS Translation File
* Romainan in Romania (Latin script)
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: ro_Latn_RO.UTF-8.php 1837 2012-05-13 04:12:13Z sakamocchi $
+ * @version $Id: ro_Latn_RO.ISO-8859-1.php 1837 2012-05-13 04:12:13Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
-INS<?php
+<?php
/**
* Nucleus CMS Translation File
* Romainan in Romania (Latin script)
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: ru_Cyrl_RU.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: ru_Cyrl_RU.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: ru_Cyrl_RU.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: ru_Cyrl_RU.WINDOWS-1251.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: sk_Latn_SK.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: sk_Latn_SK.ISO-8859-2.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: sk_Latn_SK.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: sk_Latn_SK.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: zh_Hans_CN.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: zh_Hans_CN.GB2312.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: zh_Hans_CN.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: zh_Hans_CN.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: zh_Hant_TW.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
+ * @version $Id: zh_Hant_TW.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
*/
/********************************************
define('_SKINABLEADMIN_NORMALSETTING_STR', ' normal');
define('_SKINABLEADMIN_HELPICONURL_STR', ' icon URL');
define('_SKINABLEADMIN_HELPFILEURL_STR', ' help file URL');
-define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' ADMIN area skin skinvars');
+define('_SKINABLEADMIN_ADMINSKINVAR_STR', ' skinvars');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT', 'selectbox used in ADMIN area');
define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE', 'Table for list indication');
define('_SKINABLEADMIN_PLUGIN_QUICKMENU', 'Link to admin page of the plugin shown to the quick-menu');
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
-* @version $Id: NP_SecurityEnforcer.php 1721 2012-03-31 10:18:25Z sakamocchi $
+* @version $Id: NP_SecurityEnforcer.php 1874 2012-06-17 07:27:38Z sakamocchi $
*/
class NP_SecurityEnforcer extends NucleusPlugin
{
-
public function getName()
{
return 'SecurityEnforcer';
*
* Copyright 2005-2007 by Jeff MacMichael and Niels Leenheer
*
- * @version $Id: NP_SkinFiles.php 1678 2012-02-26 07:31:36Z sakamocchi $
+ * @version $Id: NP_SkinFiles.php 1749 2012-04-13 14:06:34Z sakamocchi $
* @version $NucleusJP: NP_SkinFiles.php,v 1.3 2006/07/17 20:03:45 kimitake Exp $
*
* ==========================================================================================
<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Media popup window for Nucleus
+ *
+ * Purpose:
+ * - can be openen from an add-item form or bookmarklet popup
+ * - shows a list of recent files, allowing browsing, search and
+ * upload of new files
+ * - close the popup by selecting a file in the list. The file gets
+ * passed through to the add-item form (linkto, popupimg or inline img)
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: MediumActions.php 1873 2012-06-17 07:23:22Z sakamocchi $
+ *
+ */
+
class MediumActions extends BaseActions
{
private $type = '';
*
* Copyright 2005-2007 by Jeff MacMichael and Niels Leenheer
*
- * @version $Id: index.php 1644 2012-01-29 08:34:58Z sakamocchi $
+ * @version $Id: index.php 1796 2012-04-29 03:46:09Z sakamocchi $
* @version $NucleusJP: index.php,v 1.5.2.1 2005/08/25 07:04:13 kimitake Exp $
*
* ==========================================================================================
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
* @version $Id: index.php 1690 2012-03-08 22:45:08Z ftruscot $
*
*/
/**
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade.functions.php 1690 2012-03-08 22:45:08Z ftruscot $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade.functions.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
/**
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
* @version $Id: upgrade.php 1690 2012-03-08 22:45:08Z ftruscot $
*/
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
* @version $Id: upgrade0.95.php 1388 2009-07-18 06:31:28Z shizuki $
*/
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade0.96.php 1546 2011-06-30 15:36:25Z ftruscot $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade0.96.php 1809 2012-05-01 14:48:30Z sakamocchi $
*/
function upgrade_do96() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade1.0.php 1388 2009-07-18 06:31:28Z shizuki $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade1.0.php 1809 2012-05-01 14:48:30Z sakamocchi $
*/
function upgrade_do100() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade1.1.php 1388 2009-07-18 06:31:28Z shizuki $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade1.1.php 1809 2012-05-01 14:48:30Z sakamocchi $
*/
function upgrade_do110() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade1.5.php 1546 2011-06-30 15:36:25Z ftruscot $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade1.5.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
function upgrade_do150() {
}
}
-?>
\ No newline at end of file
+?>
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade2.0.php 1388 2009-07-18 06:31:28Z shizuki $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade2.0.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
function upgrade_do200() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade2.5.php 1685 2012-03-01 15:28:00Z sakamocchi $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade2.5.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
function upgrade_do250() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
* @version $Id: upgrade3.0.php 1388 2009-07-18 06:31:28Z shizuki $
*/
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
* @version $Id: upgrade3.1.php 1388 2009-07-18 06:31:28Z shizuki $
*/
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade3.2.php 1388 2009-07-18 06:31:28Z shizuki $
+ * @version $Id: upgrade3.2.php 1809 2012-05-01 14:48:30Z sakamocchi $
*/
function upgrade_do320() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade3.3.php 1388 2009-07-18 06:31:28Z shizuki $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade3.3.php 1809 2012-05-01 14:48:30Z sakamocchi $
*/
function upgrade_do330() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade3.4.php 1665 2012-02-13 16:50:35Z ftruscot $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade3.4.php 1714 2012-03-31 06:32:09Z sakamocchi $
*/
function upgrade_do340() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade3.5.php 1665 2012-02-13 16:50:35Z ftruscot $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade3.5.php 1714 2012-03-31 06:32:09Z sakamocchi $
*/
function upgrade_do350() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: upgrade3.6.php 1665 2012-02-13 16:50:35Z ftruscot $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: upgrade3.6.php 1714 2012-03-31 06:32:09Z sakamocchi $
*/
function upgrade_do360() {
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
/**
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
* @version $Id: upgrade2.0.php 1388 2009-07-18 06:31:28Z shizuki $
*/
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* This file contains definitions for the methods in the Blogger API
*
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: api_blogger.inc.php 1388 2009-07-18 06:31:28Z shizuki $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: api_blogger.inc.php 1860 2012-05-19 03:47:59Z sakamocchi $
*/
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* This file contains definitions for the methods of the metaWeblog API
*
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: api_metaweblog.inc.php 1534 2011-06-22 06:13:23Z sakamocchi $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: api_metaweblog.inc.php 1860 2012-05-19 03:47:59Z sakamocchi $
*/
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Wouter Demuynck 2003-08-31
*
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: api_mt.inc.php 1388 2009-07-18 06:31:28Z shizuki $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: api_mt.inc.php 1860 2012-05-19 03:47:59Z sakamocchi $
*/
// mt.supportedMethods
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* NOTE: These functions are deprecated and will most likely be removed!
*
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: api_nucleus.inc.php 1418 2009-10-30 06:25:28Z ehui $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: api_nucleus.inc.php 1860 2012-05-19 03:47:59Z sakamocchi $
*/
// nucleus.addItem
<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* mt.supportedMethods
*
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: server.php 1622 2012-01-09 03:18:59Z sakamocchi $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: server.php 1889 2012-06-17 08:46:45Z sakamocchi $
*/
$CONF = array();
$DIR_LIBS = '';
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<head>\r
- <title>Nucleus - Readme</title>\r
- <style type="text/css">\r
- <!--\r
- @import url(nucleus/styles/manual.css);\r
- -->\r
- </style>\r
-</head>\r
-<body>\r
-<h1>Readme</h1>\r
-\r
-<p>\r
-The only purpose of this file is to guide you to <a href="nucleus/documentation/index.html">the Nucleus manual</a>.\r
-</p>\r
-</body>\r
-</html>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Nucleus - Readme</title>
+ <style type="text/css">
+ <!--
+ @import url(nucleus/styles/manual.css);
+ -->
+ </style>
+</head>
+<body>
+<h1>Readme</h1>
+
+<p>
+The only purpose of this file is to guide you to <a href="nucleus/documentation/index.html">the Nucleus manual</a>.
+</p>
+</body>
+</html>
\ No newline at end of file
-User-agent: *\r
-Disallow: action.php?\r
+User-agent: *
+Disallow: action.php?
-<?php\r
-// RSD file (http://archipelago.phrasewise.com/rsd)\r
-$CONF = array();\r
-include('./config.php');\r
-selectSkin('xml/rsd');\r
-selector();\r
+<?php
+// RSD file (http://archipelago.phrasewise.com/rsd)
+$CONF = array();
+include('./config.php');
+selectSkin('xml/rsd');
+selector();
-<?xml version="1.0"?>\r
-<nucleusskin>\r
-<meta>\r
-<skin name="admin/bookmarklet"/>\r
-<template name="admin/bookmarklet"/>\r
-<info><![CDATA[20120430]]></info>\r
-</meta>\r
-<skin name="admin/bookmarklet" type="text/html" includeMode="skindir" includePrefix="admin/bookmarklet">\r
-<description>\r
-<![CDATA[ADMIN Area Default Bookmarklet Skin]]>\r
-</description>\r
-<part name="createitem">\r
-<![CDATA[<%pagehead%>\r
-<h1><%text(_ADD_ADDTO)%> '<%bloglink%>'</h1>\r
-\r
-<form id="addform" method="post" action="<%adminurl%>bookmarklet.php" >\r
-\r
-<div>\r
-<input type="hidden" name="action" value="additem" />\r
-<input type="hidden" name="blogid" value="<%blogid%>" />\r
-<input type="hidden" name="draftid" value="0" />\r
-\r
-<%ticket%>\r
-\r
-<div id="submit" class="buttonbar">\r
-<div id="switchbuttons">\r
-<input type="button" onclick="flipBlock('body');" value="<%text(_BMLET_BODY)%> >>" />\r
-<input type="button" onclick="flipBlock('more');" value="<%text(_BMLET_MORE)%> >>" />\r
-<input type="button" onclick="flipBlock('options');" value="<%text(_BMLET_OPTIONS)%> >>" />\r
-<input type="button" onclick="updAllPreviews(); flipBlock('preview');" value="<%text(_BMLET_PREVIEW)%> >>" />\r
-</div>\r
-<input type="submit" value="<%text(_BMLET_ADD)%>" onclick="return checkSubmit();" />\r
-<input type="button" value="<%text(_BMLET_CANCEL)%>" onclick="window.close();" />\r
-</div>\r
-\r
-<div id="body" class="contentblock">\r
-<table frame="box" rules="all" summary="<%text(_BMLET_BODY)%>">\r
-<%if(autosave)%>\r
-<tr>\r
-<td><%text(_AUTOSAVEDRAFT)%></td>\r
-<td><span id="info"><%text(_AUTOSAVEDRAFT_NOTYETSAVED)%></span></td>\r
-</tr>\r
-<%endif%>\r
-<tr>\r
-<td><%text(_ADD_TITLE)%></td>\r
-<td><input type="text" id="inputtitle" name="title" value="<%contents(title)%>" size="60" maxlength="160" /></td>\r
-</tr>\r
-<tr>\r
-<td>\r
-<%text(_ADD_BODY)%> <%helplink(additem)%></td>\r
-<td>\r
-\r
-<div class="jsbuttonbar">\r
-<!--[if IE]>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">\r
-<img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">\r
-<img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">\r
-<img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
-<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
-<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
-<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />\r
-</span>\r
-<![endif]-->\r
-<!--[if ! IE]>-->\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
-<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
-<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
-<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />\r
-</span>\r
-<!--<![endif]-->\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">\r
-<img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">\r
-<img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">\r
-<img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">\r
-<img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">\r
-<img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">\r
-<img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />\r
-</span>\r
-<!--[if IE]>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">\r
-<img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />\r
-</span>\r
-<![endif]-->\r
-<div class="jsbuttonend"></div>\r
-</div>\r
-\r
-<textarea id="inputbody" name="body" cols="58" rows="12"><%contents(body)%></textarea></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_ADD_CATEGORY)%></td>\r
-<td><%categories%></td>\r
-</tr>\r
-<tr>\r
-<%if(autosave)%>\r
-<td><%text(_AUTOSAVEDRAFT_NOW)%></td>\r
-<td><input type="button" name="autosavenow" value="<%text(_AUTOSAVEDRAFT_NOW)%>" tabindex="80" onclick="autoSaveDraft();" /></td>\r
-<%endif%>\r
-</tr>\r
-</table>\r
-</div>\r
-\r
-<div id="more" class="contentblock">\r
-<table frame="box" rules="all" summary="<%text(_BMLET_MORE)%>">\r
-<tr>\r
-<td><%text(_ADD_MORE)%> <%helplink(extended)%></td>\r
-<td>\r
-\r
-<div class="jsbuttonbar">\r
-<!--[if IE]>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">\r
-<img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">\r
-<img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">\r
-<img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
-<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
-<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
-<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />\r
-</span>\r
-<![endif]-->\r
-<!--[if ! IE]>-->\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
-<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
-<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
-<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />\r
-</span>\r
-<!--<![endif]-->\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">\r
-<img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">\r
-<img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">\r
-<img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">\r
-<img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">\r
-<img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">\r
-<img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />\r
-</span>\r
-<!--[if IE]>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">\r
-<img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />\r
-</span>\r
-<![endif]-->\r
-<div class="jsbuttonend"></div>\r
-</div>\r
-\r
-<textarea id="inputmore" name="more" cols="58" rows="17"><%contents(more)%></textarea>\r
-</td>\r
-</tr>\r
-</table>\r
-</div>\r
-\r
-<div id="options" class="contentblock">\r
-<table frame="box" rules="all" summary="<%text(_BMLET_OPTIONS)%>">\r
-\r
-<%if(blogsetting, bcomments)%>\r
-<tr>\r
-<td><%text(_ADD_DISABLE_COMMENTS)%></td>\r
-<td>\r
-<input type='radio' id="closed_yes" name='closed' value='1' />\r
-<label for="closed_yes"><%text(_YES)%></label>\r
-<input type='radio' id="closed_no" name='closed' value='0' checked='checked' />\r
-<label for="closed_no"><%text(_NO)%></label>\r
-</td>\r
-</tr>\r
-<%endif%>\r
-\r
-<tr>\r
-<td><%text(_ADD_DRAFTNFUTURE)%></td>\r
-<td>\r
-<input type="radio" name="actiontype" value="addnow" checked='checked' id="act_now" />\r
-<label for="act_now"><%text(_ADD_ADDNOW)%></label><br />\r
-<input type="radio" id="act_future" name="actiontype" value="addfuture" />\r
-<label for="act_future"><%text(_ADD_ADDLATER)%></label> <%helplink(future)%>\r
-<div class="indent">\r
-<%text(_ADD_PLACE_ON)%>\r
-<input id="inputday" name="day" value="<%currenttime(mday)%>" size="2" onchange="document.forms[0].act_future.checked=true;" />/\r
-<input id="inputmonth" name="month" value="<%currenttime(mon)%>" size="2" onchange="document.forms[0].act_future.checked=true;" />/\r
-<input id="inputyear" name="year" value="<%currenttime(year)%>" size="4" onchange="document.forms[0].act_future.checked=true;" />\r
-at\r
-<input id="inputhour" name="hour" value="<%currenttime(hours)%>" size="2" onchange="document.forms[0].act_future.checked=true;" />:\r
-<input id="inputminutes" name="minutes" value="<%currenttime(minutes)%>" size="2" onchange="document.forms[0].act_future.checked=true;" />\r
-(dd/mm/yyyy hh:mm)\r
-\r
-<%if(blogsetting, ballowpast,0)%>\r
-<br />\r
-<%text(_ADD_NOPASTDATES)%>\r
-<%endif%>\r
-\r
-</div>\r
-<input type="radio" name="actiontype" value="adddraft" id="act_draft" />\r
-<label for="act_draft"><%text(_ADD_ADDDRAFT)%></label> <%helplink(draft)%>\r
-</td>\r
-</tr>\r
-\r
-<tr>\r
-<td><%text(_ADD_PLUGIN_EXTRAS)%></td>\r
-<td><%pluginextras%></td>\r
-</tr>\r
-<%itemoptions%>\r
-</table>\r
-\r
-</div>\r
-\r
-<div id="preview" class="contentblock">\r
-<h2><%text(_ADD_PREVIEW)%></h2>\r
-<b><span id="prevtitle"> </span></b><br />\r
-<span id="prevbody"> </span><br />\r
-<span id="prevmore"> </span>\r
-</div>\r
-\r
-<%if(autosave)%>\r
-<script type="text/javascript">\r
- var xmlhttprequest = new Array();\r
- xmlhttprequest[0] = createHTTPHandler(); // AutoDraft handler\r
- xmlhttprequest[1] = createHTTPHandler(); // UpdateTicket handler\r
- var seconds = now(); // Last AutoDraft time\r
- var checks = 0; // Number of checks since last AutoDraft\r
- var addform = document.getElementById('addform');\r
- var goal = document.getElementById('info'); // The html div id where 'Last saved: date time' must come\r
- var goalurl = '../action.php'; // The PHP file where the content must be posted to\r
- var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'\r
- var formtype = 'add';\r
-</script>\r
-<%endif%>\r
-\r
-</div>\r
-\r
-</form>\r
-<%pagefoot%>]]>\r
-</part>\r
-\r
-<part name="itemedit">\r
-<![CDATA[<%pagehead%>\r
-<h1><%text(_EDIT_ITEM)%> (<%contents(itemid)%>)</h1>\r
-<form id="editform" method="post" action="<%adminurl%>bookmarklet.php" ><div>\r
-<input type="hidden" name="action" value="edititem" />\r
-<input type="hidden" name="itemid" value="<%contents(itemid)%>" />\r
-<input type="hidden" name="draftid" value="0" />\r
-<%ticket%>\r
-\r
-<div id="submit" class="buttonbar">\r
-<div id="switchbuttons">\r
-<input type="button" value="<%text(_BMLET_BODY)%> >>" onclick="flipBlock('body');" />\r
-<input type="button" value="<%text(_BMLET_MORE)%> >>" onclick="flipBlock('more');" />\r
-<input type="button" value="<%text(_BMLET_OPTIONS)%> >>" onclick="flipBlock('options');" />\r
-<input type="button" value="<%text(_BMLET_PREVIEW)%> >>" onclick="updAllPreviews(); flipBlock('preview');" />\r
-</div>\r
-<input type="submit" value="<%text(_BMLET_EDIT)%>" onclick="return checkSubmit();" />\r
-<input type="button" value="<%text(_BMLET_CANCEL)%>" onclick="window.close();" />\r
-</div>\r
-\r
-<div id="body" class="contentblock">\r
-<table frame="box" rules="all" summary="<%text(_BMLET_BODY)%>">\r
-\r
-<%if(autosave)%>\r
-<tr>\r
-<td><%text(_AUTOSAVEDRAFT)%></td>\r
-<td><span id="info"><%text(_AUTOSAVEDRAFT_NOTYETSAVED)%></span></td>\r
-</tr>\r
-<%endif%>\r
-\r
-<tr>\r
-<td><%text(_ADD_TITLE)%></td>\r
-<td><input type="text" id="inputtitle" name="title" value="<%contents(title)%>" size="60" maxlength="160" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_ADD_BODY)%></td>\r
-<td>\r
-\r
-<div class="jsbuttonbar">\r
-<!--[if IE]>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">\r
-<img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">\r
-<img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">\r
-<img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
-<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
-<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
-<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />\r
-</span>\r
-<![endif]-->\r
-<!--[if ! IE]>-->\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
-<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
-<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
-<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />\r
-</span>\r
-<!--<![endif]-->\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">\r
-<img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">\r
-<img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">\r
-<img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">\r
-<img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">\r
-<img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">\r
-<img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />\r
-</span>\r
-<!--[if IE]>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">\r
-<img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />\r
-</span>\r
-<![endif]-->\r
-<div class="jsbuttonend"></div>\r
-</div>\r
-\r
-<textarea id="inputbody" name="body" cols="58" rows="12"><%contents(body)%></textarea>\r
-</td>\r
-</tr>\r
-<tr>\r
-<td><%text(_ADD_CATEGORY)%></td>\r
-<td><%categories%></td>\r
-</tr>\r
-<%if(autosave)%>\r
-<tr>\r
-<td><%text(_AUTOSAVEDRAFT_NOW)%></td>\r
-<td><input type="button" name="autosavenow" value="<%text(_AUTOSAVEDRAFT_NOW)%>" tabindex="80" onclick="autoSaveDraft();" /></td>\r
-</tr>\r
-<%endif%>\r
-</table>\r
-</div>\r
-\r
-<div id="more" class="contentblock">\r
-<table frame="box" rules="all" summary="<%text(_BMLET_MORE)%>">\r
-<tr>\r
-<td><%text(_ADD_MORE)%> <%helplink(extended)%></td>\r
-<td>\r
-\r
-<div class="jsbuttonbar">\r
-<!--[if IE]>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">\r
-<img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">\r
-<img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">\r
-<img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
-<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
-<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
-<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />\r
-</span>\r
-<![endif]-->\r
-<!--[if ! IE]>-->\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
-<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
-<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
-<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />\r
-</span>\r
-<!--<![endif]-->\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">\r
-<img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">\r
-<img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">\r
-<img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">\r
-<img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">\r
-<img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />\r
-</span>\r
-<span class="jsbuttonspacer"> </span>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">\r
-<img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />\r
-</span>\r
-<!--[if IE]>\r
-<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">\r
-<img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />\r
-</span>\r
-<![endif]-->\r
-<div class="jsbuttonend"></div>\r
-</div>\r
-\r
-<textarea id="inputmore" name="more" cols="58" rows="17"><%contents(more)%></textarea>\r
-</td>\r
-</tr>\r
-</table>\r
-</div>\r
-\r
-<div id="options" class="contentblock">\r
-<table frame="box" rules="all" summary="<%text(_BMLET_OPTIONS)%>">\r
-<%if(blogsetting, bcomments)%>\r
-<tr>\r
-<td><%text(_ADD_DISABLE_COMMENTS)%></td>\r
-<td>\r
-<input type="radio" name="closed" value="1" id="closed_yes" <%checkedonval(1,closed)%> /><label for="closed_yes"><%text(_YES)%></label>\r
-<input type="radio" name="closed" value="0" id="closed_no" <%checkedonval(0,closed)%> /><label for="closed_no"><%text(_NO)%></label>\r
-</td>\r
-</tr>\r
-<%endif%>\r
-<tr>\r
-<td><%text(_SUBMIT)%></td>\r
-<td>\r
-<input id="act_edit" type="radio" name="actiontype" value="edit" checked="checked" />\r
-<label for="act_edit"><%text(_BMLET_EDIT)%></label><br />\r
-<input id="act_delete" type="radio" name="actiontype" value="delete" />\r
-<label for="act_delete"><%text(_BMLET_DELETE)%></label><br />\r
-\r
-<%if(blogsetting, ballowpast)%>\r
-<input id="act_changedate" name="actiontype" value="changedate" type="radio" tabindex="70" />\r
-<label for="act_changedate"><%text(_BMLET_CHANGEDATE)%></label> <%helplink(changedate)%>\r
-\r
-<div class="indent">\r
-<input id="inputday" name="day" value="<%itemtime(mday)%>" size="2" tabindex="71" onchange="document.forms[0].act_changedate.checked=true;" />/\r
-<input id="inputmonth" name="month" value="<%itemtime(mon)%>" tabindex="72" size="2" onchange="document.forms[0].act_changedate.checked=true;" />/\r
-<input id="inputyear" name="year" tabindex="73" size="4" value="<%itemtime(year)%>" onchange="document.forms[0].act_changedate.checked=true;" />\r
-at\r
-<input id="inputhour" name="hour" value="<%itemtime(hours)%>" size="2" tabindex="74" onchange="document.forms[0].act_changedate.checked=true;" />:\r
-<input id="inputminutes" name="minutes" value="<%itemtime(minutes)%>" size="2" tabindex="75" onchange="document.forms[0].act_changedate.checked=true;" />\r
-(dd/mm/yyyy hh:mm)\r
-</div>\r
-<input type="radio" id="act_backtodrafts" name="actiontype" value="backtodrafts" tabindex="71" />\r
-<label for="act_backtodrafts">\r
-<%text(_BMLET_BACKTODRAFTS)%></label> <%helplink(draft)%>\r
-<%endif%>\r
-\r
-</td>\r
-</tr>\r
-\r
-<tr>\r
-<td><%text(_ADD_PLUGIN_EXTRAS)%></td>\r
-<td><%pluginextras%></td>\r
-</tr>\r
-\r
-<%itemoptions%>\r
-</table>\r
-</div>\r
-\r
-<div id="preview" class="contentblock">\r
-<h2><%text(_ADD_PREVIEW)%></h2>\r
-<b><span id="prevtitle"> </span></b><br />\r
-<span id="prevbody"> </span><br />\r
-<span id="prevmore"> </span>\r
-</div>\r
-</div>\r
-</form>\r
-<%if(autosave)%>\r
-<script type="text/javascript">\r
- var xmlhttprequest = new Array();\r
- xmlhttprequest[0] = createHTTPHandler(); // AutoDraft handler\r
- xmlhttprequest[1] = createHTTPHandler(); // UpdateTicket handler\r
- var seconds = now(); // Last AutoDraft time\r
- var checks = 0; // Number of checks since last AutoDraft\r
- var addform = document.getElementById('editform');\r
- var goal = document.getElementById('info'); // The html div id where 'Last saved: date time' must come\r
- var goalurl = '../action.php'; // The PHP file where the content must be posted to\r
- var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'\r
- var formtype = 'edit';\r
-</script>\r
-<%endif%>\r
-<%pagefoot%>]]>\r
-</part>\r
-\r
-<part name="pagefoot">\r
-<![CDATA[\r
- </body>\r
- </html>\r
-]]></part>\r
-\r
-<part name="pagehead">\r
-<![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%locale%>" lang="<%locale%>">\r
- <head>\r
- <title><%title%></title>\r
- <link rel="stylesheet" type="text/css" href="<%skinfile(/styles/bookmarklet.css)%>" /> \r
- <link rel="stylesheet" type="text/css" href="<%skinfile(/styles/addedit.css)%>" />\r
- <script type="text/javascript" src="<%skinfile(/javascripts/bookmarklet.js)%>"></script>\r
- <script type="text/javascript" src="<%skinfile(/javascripts/edit.js)%>"></script>\r
- <script type="text/javascript" src="<%skinfile(/javascripts/numbercheck.js)%>"></script>\r
- \r
- <%if(autosave)%>\r
- <script type="text/javascript" src="<%skinfile(/javascripts/xmlhttprequest.js)%>"></script>\r
- <%endif%>\r
- \r
- <%init%>\r
- \r
- <%extrahead%>\r
- \r
- <script type="text/javascript">\r
- var nucleus_initbm_oldonload = window.onload;\r
- function nucleus_initbm()\r
- {\r
- initStyles();\r
- updAllPreviews();\r
- \r
- if ( nucleus_initbm_oldonload )\r
- {\r
- nucleus_initbm_oldonload();\r
- }\r
- }\r
- window.onload = nucleus_initbm;\r
- </script>\r
- </head>\r
- <body>\r
-]]></part>\r
-\r
-<part name="showlogin">\r
-<![CDATA[<%pagehead%><h2><%text(_LOGIN)%></h2>\r
- <%headmessage%>\r
- <form method="post" action="<%adminurl%>bookmarklet.php">\r
- <p>\r
- <%text(_LOGIN_NAME)%> <br /><input name="login" tabindex="10" /><br />\r
- <%text(_LOGIN_PASSWORD)%> <br /><input name="password" tabindex="20" type="password" /><br />\r
- <input type="checkbox" value="1" name="shared" tabindex="40" id="shared" />\r
- <label for="shared"><%text(_LOGIN_SHARED)%></label><br />\r
- <a href="forgotpassword.php"><%text(_LOGIN_FORGOT)%></a>\r
- \r
- <%passrequestvars%>\r
- \r
- <input type="hidden" name="blogid" value="<%blogid%>" />\r
- <input type="hidden" name="itemid" value="<%itemid%>" />\r
- <input type="hidden" name="logtext" value="<%log_text%>" />\r
- <input type="hidden" name="loglink" value="<%log_link%>" />\r
- <input type="hidden" name="loglinktitle" value="<%log_linktitle%>" />\r
- \r
- <input type="hidden" name="nextaction" value="<%action%>" />\r
- <button type="submit" name="action" value="login"><%text(_LOGIN)%></button>\r
- </p>\r
- </form>\r
-<%pagefoot%>]]></part>\r
-\r
-<part name="adminerrorpage"><![CDATA[\r
-<%pagehead%>\r
-<%headmessage%>\r
-<p><a href="<%adminurl%>bookmarklet.php" onclick="window.close();window.opener.location.reload();"><%text(_POPUP_CLOSE)%></a></p>\r
-<%pagefoot%>\r
-]]></part>\r
-\r
-</skin>\r
-<template name="admin/bookmarklet">\r
-<description><![CDATA[ADMIN Area Default bookmarklet template]]></description>\r
-</template>\r
-</nucleusskin>\r
+<?xml version="1.0"?>
+<nucleusskin>
+<meta>
+<skin name="admin/bookmarklet"/>
+<template name="admin/bookmarklet"/>
+<info><![CDATA[20120430]]></info>
+</meta>
+<skin name="admin/bookmarklet" type="text/html" includeMode="skindir" includePrefix="admin/bookmarklet">
+<description>
+<![CDATA[ADMIN Area Default Bookmarklet Skin]]>
+</description>
+
+<part name="createitem">
+<![CDATA[<%pagehead%>
+<h1><%text(_ADD_ADDTO)%> '<%bloglink%>'</h1>
+
+<form id="addform" method="post" action="<%adminurl%>bookmarklet.php" >
+
+<div>
+<input type="hidden" name="action" value="additem" />
+<input type="hidden" name="blogid" value="<%blogid%>" />
+<input type="hidden" name="draftid" value="0" />
+
+<%ticket%>
+
+<div id="submit" class="buttonbar">
+<div id="switchbuttons">
+<input type="button" onclick="flipBlock('body');" value="<%text(_BMLET_BODY)%> >>" />
+<input type="button" onclick="flipBlock('more');" value="<%text(_BMLET_MORE)%> >>" />
+<input type="button" onclick="flipBlock('options');" value="<%text(_BMLET_OPTIONS)%> >>" />
+<input type="button" onclick="updAllPreviews(); flipBlock('preview');" value="<%text(_BMLET_PREVIEW)%> >>" />
+</div>
+<input type="submit" value="<%text(_BMLET_ADD)%>" onclick="return checkSubmit();" />
+<input type="button" value="<%text(_BMLET_CANCEL)%>" onclick="window.close();" />
+</div>
+
+<div id="body" class="contentblock">
+<table frame="box" rules="all" summary="<%text(_BMLET_BODY)%>">
+<%if(autosave)%>
+<tr>
+<td><%text(_AUTOSAVEDRAFT)%></td>
+<td><span id="info"><%text(_AUTOSAVEDRAFT_NOTYETSAVED)%></span></td>
+</tr>
+<%endif%>
+<tr>
+<td><%text(_ADD_TITLE)%></td>
+<td><input type="text" id="inputtitle" name="title" value="<%contents(title)%>" size="60" maxlength="160" /></td>
+</tr>
+<tr>
+<td>
+<%text(_ADD_BODY)%> <%helplink(additem)%></td>
+<td>
+
+<div class="jsbuttonbar">
+<!--[if IE]>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">
+<img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">
+<img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">
+<img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />
+</span>
+<![endif]-->
+<!--[if ! IE]>-->
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />
+</span>
+<!--<![endif]-->
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">
+<img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">
+<img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">
+<img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">
+<img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">
+<img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">
+<img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />
+</span>
+<!--[if IE]>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">
+<img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />
+</span>
+<![endif]-->
+<div class="jsbuttonend"></div>
+</div>
+
+<textarea id="inputbody" name="body" cols="58" rows="12"><%contents(body)%></textarea></td>
+</tr>
+<tr>
+<td><%text(_ADD_CATEGORY)%></td>
+<td><%categories%></td>
+</tr>
+<tr>
+<%if(autosave)%>
+<td><%text(_AUTOSAVEDRAFT_NOW)%></td>
+<td><input type="button" name="autosavenow" value="<%text(_AUTOSAVEDRAFT_NOW)%>" tabindex="80" onclick="autoSaveDraft();" /></td>
+<%endif%>
+</tr>
+</table>
+</div>
+
+<div id="more" class="contentblock">
+<table frame="box" rules="all" summary="<%text(_BMLET_MORE)%>">
+<tr>
+<td><%text(_ADD_MORE)%> <%helplink(extended)%></td>
+<td>
+
+<div class="jsbuttonbar">
+<!--[if IE]>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">
+<img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">
+<img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">
+<img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />
+</span>
+<![endif]-->
+<!--[if ! IE]>-->
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />
+</span>
+<!--<![endif]-->
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">
+<img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">
+<img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">
+<img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">
+<img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">
+<img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">
+<img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />
+</span>
+<!--[if IE]>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">
+<img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />
+</span>
+<![endif]-->
+<div class="jsbuttonend"></div>
+</div>
+
+<textarea id="inputmore" name="more" cols="58" rows="17"><%contents(more)%></textarea>
+</td>
+</tr>
+</table>
+</div>
+
+<div id="options" class="contentblock">
+<table frame="box" rules="all" summary="<%text(_BMLET_OPTIONS)%>">
+
+<%if(blogsetting, bcomments)%>
+<tr>
+<td><%text(_ADD_DISABLE_COMMENTS)%></td>
+<td>
+<input type='radio' id="closed_yes" name='closed' value='1' />
+<label for="closed_yes"><%text(_YES)%></label>
+<input type='radio' id="closed_no" name='closed' value='0' checked='checked' />
+<label for="closed_no"><%text(_NO)%></label>
+</td>
+</tr>
+<%endif%>
+
+<tr>
+<td><%text(_ADD_DRAFTNFUTURE)%></td>
+<td>
+<input type="radio" name="actiontype" value="addnow" checked='checked' id="act_now" />
+<label for="act_now"><%text(_ADD_ADDNOW)%></label><br />
+<input type="radio" id="act_future" name="actiontype" value="addfuture" />
+<label for="act_future"><%text(_ADD_ADDLATER)%></label> <%helplink(future)%>
+<div class="indent">
+<%text(_ADD_PLACE_ON)%>
+<input id="inputday" name="day" value="<%currenttime(mday)%>" size="2" onchange="document.forms[0].act_future.checked=true;" />/
+<input id="inputmonth" name="month" value="<%currenttime(mon)%>" size="2" onchange="document.forms[0].act_future.checked=true;" />/
+<input id="inputyear" name="year" value="<%currenttime(year)%>" size="4" onchange="document.forms[0].act_future.checked=true;" />
+at
+<input id="inputhour" name="hour" value="<%currenttime(hours)%>" size="2" onchange="document.forms[0].act_future.checked=true;" />:
+<input id="inputminutes" name="minutes" value="<%currenttime(minutes)%>" size="2" onchange="document.forms[0].act_future.checked=true;" />
+(dd/mm/yyyy hh:mm)
+
+<%if(blogsetting, ballowpast,0)%>
+<br />
+<%text(_ADD_NOPASTDATES)%>
+<%endif%>
+
+</div>
+<input type="radio" name="actiontype" value="adddraft" id="act_draft" />
+<label for="act_draft"><%text(_ADD_ADDDRAFT)%></label> <%helplink(draft)%>
+</td>
+</tr>
+
+<tr>
+<td><%text(_ADD_PLUGIN_EXTRAS)%></td>
+<td><%pluginextras%></td>
+</tr>
+<%itemoptions%>
+</table>
+
+</div>
+
+<div id="preview" class="contentblock">
+<h2><%text(_ADD_PREVIEW)%></h2>
+<b><span id="prevtitle"> </span></b><br />
+<span id="prevbody"> </span><br />
+<span id="prevmore"> </span>
+</div>
+
+<%if(autosave)%>
+<script type="text/javascript">
+ var xmlhttprequest = new Array();
+ xmlhttprequest[0] = createHTTPHandler(); // AutoDraft handler
+ xmlhttprequest[1] = createHTTPHandler(); // UpdateTicket handler
+ var seconds = now(); // Last AutoDraft time
+ var checks = 0; // Number of checks since last AutoDraft
+ var addform = document.getElementById('addform');
+ var goal = document.getElementById('info'); // The html div id where 'Last saved: date time' must come
+ var goalurl = '../action.php'; // The PHP file where the content must be posted to
+ var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'
+ var formtype = 'add';
+</script>
+<%endif%>
+
+</div>
+
+</form>
+<%pagefoot%>]]>
+</part>
+
+<part name="itemedit">
+<![CDATA[<%pagehead%>
+<h1><%text(_EDIT_ITEM)%> (<%contents(itemid)%>)</h1>
+<form id="editform" method="post" action="<%adminurl%>bookmarklet.php" ><div>
+<input type="hidden" name="action" value="edititem" />
+<input type="hidden" name="itemid" value="<%contents(itemid)%>" />
+<input type="hidden" name="draftid" value="0" />
+<%ticket%>
+
+<div id="submit" class="buttonbar">
+<div id="switchbuttons">
+<input type="button" value="<%text(_BMLET_BODY)%> >>" onclick="flipBlock('body');" />
+<input type="button" value="<%text(_BMLET_MORE)%> >>" onclick="flipBlock('more');" />
+<input type="button" value="<%text(_BMLET_OPTIONS)%> >>" onclick="flipBlock('options');" />
+<input type="button" value="<%text(_BMLET_PREVIEW)%> >>" onclick="updAllPreviews(); flipBlock('preview');" />
+</div>
+<input type="submit" value="<%text(_BMLET_EDIT)%>" onclick="return checkSubmit();" />
+<input type="button" value="<%text(_BMLET_CANCEL)%>" onclick="window.close();" />
+</div>
+
+<div id="body" class="contentblock">
+<table frame="box" rules="all" summary="<%text(_BMLET_BODY)%>">
+
+<%if(autosave)%>
+<tr>
+<td><%text(_AUTOSAVEDRAFT)%></td>
+<td><span id="info"><%text(_AUTOSAVEDRAFT_NOTYETSAVED)%></span></td>
+</tr>
+<%endif%>
+
+<tr>
+<td><%text(_ADD_TITLE)%></td>
+<td><input type="text" id="inputtitle" name="title" value="<%contents(title)%>" size="60" maxlength="160" /></td>
+</tr>
+<tr>
+<td><%text(_ADD_BODY)%></td>
+<td>
+
+<div class="jsbuttonbar">
+<!--[if IE]>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">
+<img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">
+<img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">
+<img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />
+</span>
+<![endif]-->
+<!--[if ! IE]>-->
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />
+</span>
+<!--<![endif]-->
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">
+<img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">
+<img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">
+<img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">
+<img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">
+<img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">
+<img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />
+</span>
+<!--[if IE]>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">
+<img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />
+</span>
+<![endif]-->
+<div class="jsbuttonend"></div>
+</div>
+
+<textarea id="inputbody" name="body" cols="58" rows="12"><%contents(body)%></textarea>
+</td>
+</tr>
+<tr>
+<td><%text(_ADD_CATEGORY)%></td>
+<td><%categories%></td>
+</tr>
+<%if(autosave)%>
+<tr>
+<td><%text(_AUTOSAVEDRAFT_NOW)%></td>
+<td><input type="button" name="autosavenow" value="<%text(_AUTOSAVEDRAFT_NOW)%>" tabindex="80" onclick="autoSaveDraft();" /></td>
+</tr>
+<%endif%>
+</table>
+</div>
+
+<div id="more" class="contentblock">
+<table frame="box" rules="all" summary="<%text(_BMLET_MORE)%>">
+<tr>
+<td><%text(_ADD_MORE)%> <%helplink(extended)%></td>
+<td>
+
+<div class="jsbuttonbar">
+<!--[if IE]>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">
+<img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">
+<img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">
+<img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />
+</span>
+<![endif]-->
+<!--[if ! IE]>-->
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+<img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+<img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+<img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />
+</span>
+<!--<![endif]-->
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">
+<img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">
+<img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">
+<img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">
+<img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">
+<img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />
+</span>
+<span class="jsbuttonspacer"> </span>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">
+<img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />
+</span>
+<!--[if IE]>
+<span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">
+<img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />
+</span>
+<![endif]-->
+<div class="jsbuttonend"></div>
+</div>
+
+<textarea id="inputmore" name="more" cols="58" rows="17"><%contents(more)%></textarea>
+</td>
+</tr>
+</table>
+</div>
+
+<div id="options" class="contentblock">
+<table frame="box" rules="all" summary="<%text(_BMLET_OPTIONS)%>">
+<%if(blogsetting, bcomments)%>
+<tr>
+<td><%text(_ADD_DISABLE_COMMENTS)%></td>
+<td>
+<input type="radio" name="closed" value="1" id="closed_yes" <%checkedonval(1,closed)%> /><label for="closed_yes"><%text(_YES)%></label>
+<input type="radio" name="closed" value="0" id="closed_no" <%checkedonval(0,closed)%> /><label for="closed_no"><%text(_NO)%></label>
+</td>
+</tr>
+<%endif%>
+<tr>
+<td><%text(_SUBMIT)%></td>
+<td>
+<input id="act_edit" type="radio" name="actiontype" value="edit" checked="checked" />
+<label for="act_edit"><%text(_BMLET_EDIT)%></label><br />
+<input id="act_delete" type="radio" name="actiontype" value="delete" />
+<label for="act_delete"><%text(_BMLET_DELETE)%></label><br />
+
+<%if(blogsetting, ballowpast)%>
+<input id="act_changedate" name="actiontype" value="changedate" type="radio" tabindex="70" />
+<label for="act_changedate"><%text(_BMLET_CHANGEDATE)%></label> <%helplink(changedate)%>
+
+<div class="indent">
+<input id="inputday" name="day" value="<%itemtime(mday)%>" size="2" tabindex="71" onchange="document.forms[0].act_changedate.checked=true;" />/
+<input id="inputmonth" name="month" value="<%itemtime(mon)%>" tabindex="72" size="2" onchange="document.forms[0].act_changedate.checked=true;" />/
+<input id="inputyear" name="year" tabindex="73" size="4" value="<%itemtime(year)%>" onchange="document.forms[0].act_changedate.checked=true;" />
+at
+<input id="inputhour" name="hour" value="<%itemtime(hours)%>" size="2" tabindex="74" onchange="document.forms[0].act_changedate.checked=true;" />:
+<input id="inputminutes" name="minutes" value="<%itemtime(minutes)%>" size="2" tabindex="75" onchange="document.forms[0].act_changedate.checked=true;" />
+(dd/mm/yyyy hh:mm)
+</div>
+<input type="radio" id="act_backtodrafts" name="actiontype" value="backtodrafts" tabindex="71" />
+<label for="act_backtodrafts">
+<%text(_BMLET_BACKTODRAFTS)%></label> <%helplink(draft)%>
+<%endif%>
+
+</td>
+</tr>
+
+<tr>
+<td><%text(_ADD_PLUGIN_EXTRAS)%></td>
+<td><%pluginextras%></td>
+</tr>
+
+<%itemoptions%>
+</table>
+</div>
+
+<div id="preview" class="contentblock">
+<h2><%text(_ADD_PREVIEW)%></h2>
+<b><span id="prevtitle"> </span></b><br />
+<span id="prevbody"> </span><br />
+<span id="prevmore"> </span>
+</div>
+</div>
+</form>
+<%if(autosave)%>
+<script type="text/javascript">
+ var xmlhttprequest = new Array();
+ xmlhttprequest[0] = createHTTPHandler(); // AutoDraft handler
+ xmlhttprequest[1] = createHTTPHandler(); // UpdateTicket handler
+ var seconds = now(); // Last AutoDraft time
+ var checks = 0; // Number of checks since last AutoDraft
+ var addform = document.getElementById('editform');
+ var goal = document.getElementById('info'); // The html div id where 'Last saved: date time' must come
+ var goalurl = '../action.php'; // The PHP file where the content must be posted to
+ var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'
+ var formtype = 'edit';
+</script>
+<%endif%>
+<%pagefoot%>]]>
+</part>
+
+<part name="pagefoot">
+<![CDATA[
+ </body>
+ </html>
+]]></part>
+
+<part name="pagehead">
+<![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%locale%>" lang="<%locale%>">
+ <head>
+ <title><%title%></title>
+ <link rel="stylesheet" type="text/css" href="<%skinfile(/styles/bookmarklet.css)%>" />
+ <link rel="stylesheet" type="text/css" href="<%skinfile(/styles/addedit.css)%>" />
+ <script type="text/javascript" src="<%skinfile(/javascripts/bookmarklet.js)%>"></script>
+ <script type="text/javascript" src="<%skinfile(/javascripts/edit.js)%>"></script>
+ <script type="text/javascript" src="<%skinfile(/javascripts/numbercheck.js)%>"></script>
+
+ <%if(autosave)%>
+ <script type="text/javascript" src="<%skinfile(/javascripts/xmlhttprequest.js)%>"></script>
+ <%endif%>
+
+ <%init%>
+
+ <%extrahead%>
+
+ <script type="text/javascript">
+ var nucleus_initbm_oldonload = window.onload;
+ function nucleus_initbm()
+ {
+ initStyles();
+ updAllPreviews();
+
+ if ( nucleus_initbm_oldonload )
+ {
+ nucleus_initbm_oldonload();
+ }
+ }
+ window.onload = nucleus_initbm;
+ </script>
+ </head>
+ <body>
+]]></part>
+
+<part name="showlogin">
+<![CDATA[<%pagehead%><h2><%text(_LOGIN)%></h2>
+ <%headmessage%>
+ <form method="post" action="<%adminurl%>bookmarklet.php">
+ <p>
+ <%text(_LOGIN_NAME)%> <br /><input name="login" tabindex="10" /><br />
+ <%text(_LOGIN_PASSWORD)%> <br /><input name="password" tabindex="20" type="password" /><br />
+ <input type="checkbox" value="1" name="shared" tabindex="40" id="shared" />
+ <label for="shared"><%text(_LOGIN_SHARED)%></label><br />
+ <a href="forgotpassword.php"><%text(_LOGIN_FORGOT)%></a>
+
+ <%passrequestvars%>
+
+ <input type="hidden" name="blogid" value="<%blogid%>" />
+ <input type="hidden" name="itemid" value="<%itemid%>" />
+ <input type="hidden" name="logtext" value="<%log_text%>" />
+ <input type="hidden" name="loglink" value="<%log_link%>" />
+ <input type="hidden" name="loglinktitle" value="<%log_linktitle%>" />
+
+ <input type="hidden" name="nextaction" value="<%action%>" />
+ <button type="submit" name="action" value="login"><%text(_LOGIN)%></button>
+ </p>
+ </form>
+<%pagefoot%>]]></part>
+
+<part name="adminerrorpage"><![CDATA[
+<%pagehead%>
+<%headmessage%>
+<p><a href="<%adminurl%>bookmarklet.php" onclick="window.close();window.opener.location.reload();"><%text(_POPUP_CLOSE)%></a></p>
+<%pagefoot%>
+]]></part>
+
+</skin>
+<template name="admin/bookmarklet">
+<description><![CDATA[ADMIN Area Default bookmarklet template]]></description>
+</template>
+</nucleusskin>
/**
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* Some JavaScript code for the admin area
*
- * $Id: admin.js 1388 2009-07-18 06:31:28Z shizuki $
+ * $Id: admin.js 1888 2012-06-17 08:38:54Z sakamocchi $
*/
function help(url) {
/**
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* Some JavaScript code for the bookmarklets
*
- * $Id: bookmarklet.js 1388 2009-07-18 06:31:28Z shizuki $
+ * $Id: bookmarklet.js 1888 2012-06-17 08:38:54Z sakamocchi $
*/
/**
/**
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* That's basically it :)
*
- * $Id: compatibility.js 1388 2009-07-18 06:31:28Z shizuki $
+ * $Id: compatibility.js 1888 2012-06-17 08:38:54Z sakamocchi $
*/
// to get the script working when page is sent as application/xhtml+xml
/**
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* This file contains functions to allow adding items from inside the weblog.
* Also contains code to avoid submitting form data twice.
*
- * $Id: edit.js 1388 2009-07-18 06:31:28Z shizuki $
+ * $Id: edit.js 1888 2012-06-17 08:38:54Z sakamocchi $
*/
var nucleusConvertBreaks = true;
/**
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* script the check (on the clientside) if a entered value
* is a valid number and remove the invalid chars
*
- * $Id: numbercheck.js 1388 2009-07-18 06:31:28Z shizuki $
+ * $Id: numbercheck.js 1888 2012-06-17 08:38:54Z sakamocchi $
*/
function checkNumeric(f)
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* of the License, or (at your option) any later version.
* (see nucleus/documentation/index.html#license for more info)
*
- * $Id: opennew.js 1388 2009-07-18 06:31:28Z shizuki $
+ * $Id: opennew.js 1888 2012-06-17 08:38:54Z sakamocchi $
*
* JavaScript to open non-local links in a new window.
*
/**
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* @require compatibility.js
*
- * $Id: templateEdit.js 1388 2009-07-18 06:31:28Z shizuki $
+ * $Id: templateEdit.js 1888 2012-06-17 08:38:54Z sakamocchi $
*/
var amountOfFields = 1;
/**
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* <input type="button" name="autosavenow" value="AutoSave now" onclick="autoSaveDraft();" />
*
*
- * $Id: xmlhttprequest.js 1388 2009-07-18 06:31:28Z shizuki $
+ * $Id: xmlhttprequest.js 1888 2012-06-17 08:38:54Z sakamocchi $
*/
/**
-<?xml version="1.0"?>\r
-<nucleusskin>\r
-<meta>\r
-<skin name="admin/default"/>\r
-<template name="admin/default"/>\r
-<info><![CDATA[20120525]]></info>\r
-</meta>\r
-<skin name="admin/default" type="text/html" includeMode="skindir" includePrefix="admin/default">\r
-<description>\r
-<![CDATA[ADMIN Area Default skin]]>\r
-</description>\r
-<part name="actionlog"><![CDATA[\r
- <%pagehead%>\r
- \r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- \r
- <h2><%text(_ACTIONLOG_CLEAR_TITLE)%></h2>\r
- <p><a href="<%adminurl%><%addtickettourl(index.php?action=clearactionlog)%>"><%text(_ACTIONLOG_CLEAR_TEXT)%></a></p>\r
- \r
- <h2><%text(_ACTIONLOG_TITLE)%></h2>\r
- <%actionloglist(admin/default)%>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="activate"><![CDATA[\r
- <%pagehead%>\r
- <h2><%activationmessage(title)%></h2>\r
- <p><%activationmessage(text)%></p>\r
- <p class="error"><%headmessage%></p>\r
- <%if(bechangepass)%>\r
- <form action="<%adminurl%>index.php" method="post">\r
- <p>\r
- <input type="hidden" name="action" value="activatesetpwd" />\r
- <%ticket%>\r
- <input type="hidden" name="key" value="<%activationmessage(ackey)%>" />\r
- </p>\r
- <table frame="box" rules="all" summary="<%text(_MEMBERS_SETPWD_BTN)%>">\r
- <tr>\r
- <td><%text(_MEMBERS_PWD)%></td>\r
- <td><input type="password" maxlength="40" size="16" name="password" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_MEMBERS_REPPWD)%></td>\r
- <td><input type="password" maxlength="40" size="16" name="repeatpassword" /></td>\r
- <%eventformextra(activation)%>\r
- </tr>\r
- <tr>\r
- <td><%text(_MEMBERS_SETPWD)%></td>\r
- <td><input type="submit" value="<%text(_MEMBERS_SETPWD_BTN)%>" /></td>\r
- </tr>\r
- </table>\r
- </form>\r
- <%endif%>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="activatesetpwd"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_ACTIVATE_SUCCESS_TITLE)%></h2>\r
- <p><%text(_ACTIVATE_SUCCESS_TEXT)%></p>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="addnewlog"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_BLOGCREATED_TITLE)%></h2>\r
- <p><%sprinttext(_BLOGCREATED_ADDEDTXT,<|%createdblogsetting(name)%|>)%></p>\r
- <ol>\r
- <li><a href="#index_php"><%sprinttext(_BLOGCREATED_SIMPLEWAY,<|%getblogsetting(short)%|>)%></a></li>\r
- <li><a href="#skins"><%text(_BLOGCREATED_ADVANCEDWAY)%></a></li>\r
- </ol>\r
- <h3><a id="index_php"><%sprinttext(_BLOGCREATED_SIMPLEDESC1,<|%getblogsetting(short)%|>)%></a></h3>\r
- <p><%sprinttext(_BLOGCREATED_SIMPLEDESC2,<|%getblogsetting(short)%|>)%></p>\r
- <pre><code><?php\r
- \r
- $CONF['Self'] = '<b><%blogsetting(short)%>.php</b>';\r
- \r
- include('<i>./config.php</i>');\r
- \r
- selectBlog('<b><%blogsetting(short)%></b>');\r
- selector();\r
- \r
- ?></code></pre>\r
- <p><%text(_BLOGCREATED_SIMPLEDESC3)%></p>\r
- <p><%text(_BLOGCREATED_SIMPLEDESC4)%></p>\r
- <form action="<%adminurl%>index.php" method="post">\r
- <p>\r
- <input type="hidden" name="action" value="addnewlog2" />\r
- <%ticket%>\r
- <input type="hidden" name="blogid" value="<%requestblogid%>" />\r
- </p>\r
- \r
- <table frame="box" rules="all" summary="<%text(_BLOGCREATED_TITLE)%>">\r
- <tr>\r
- <td><%text(_EBLOG_URL)%></td>\r
- <td><input name="url" maxlength="100" size="40" value="<%sitevar(url)%><%blogsetting(short)%>.php" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_EBLOG_CREATE)%></td>\r
- <td><input type="submit" value="<%text(_EBLOG_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>\r
- </tr>\r
- </table>\r
- </form>\r
- \r
- <h3><a id="skins"><%text(_BLOGCREATED_ADVANCEDWAY2)%></a></h3>\r
- <p><%text(_BLOGCREATED_ADVANCEDWAY3)%></p>\r
- \r
- <form action="<%adminurl%>index.php" method="post">\r
- <p>\r
- <input type="hidden" name="action" value="addnewlog2" />\r
- <%ticket%>\r
- <input type="hidden" name="blogid" value="<%requestblogid%>" />\r
- </p>\r
- <table frame="box" rules="all" summary="<%text(_BLOGCREATED_ADVANCEDWAY2)%>">\r
- <tr>\r
- <td><%text(_EBLOG_URL)%></td>\r
- <td><input name="url" maxlength="100" size="40" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_EBLOG_CREATE)%></td>\r
- <td><input type="submit" value="<%text(_EBLOG_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>\r
- </tr>\r
- </table>\r
- </div>\r
- </form><%pagefoot%>\r
-]]></part>\r
-<part name="adminerrorpage"><![CDATA[\r
- <%pagehead%>\r
- <h2>Error!</h2>\r
- <%headmessage%><br />\r
- <a href="<%adminurl%>index.php" onclick="history.back()"><%text(_BACK)%></a>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="adminskindelete"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_DELETE_CONFIRM)%></h2>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- <p><%text(_CONFIRMTXT_SKIN)%><b><%editskintype(name)%></b> (<%editskintype(desc)%>)</p>\r
- <input type="hidden" name="action" value="adminskindeleteconfirm" />\r
- <%ticket%>\r
- <input type="hidden" name="skinid" value="<%editskintype(id)%>" />\r
- <input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="adminskinedit"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=adminskinoverview">(<%text(_SKIN_BACK)%>)</a></p>\r
- \r
- <h2><%text(_SKIN_EDITONE_TITLE)%> '<%editskin(name)%>'</h2>\r
- \r
- <h3><%text(_SKIN_PARTS_TITLE)%></h3>\r
- <%text(_SKIN_PARTS_MSG)%>\r
- <%normalskinlist(admin/default)%>\r
- \r
- <h3><%text(_SKIN_PARTS_SPECIAL)%></h3>\r
- <form method="get" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="adminskinedittype" />\r
- <input type="hidden" name="skinid" value="<%editskin(id)%>" />\r
- <input name="type" tabindex="89" size="30" maxlength="64" />\r
- <input type="submit" tabindex="140" value="<%text(_SKIN_CREATE)%>" onclick="return checkSubmit();" />\r
- </p>\r
- </form>\r
- <%specialskinlist(admin/default)%>\r
- \r
- <h3><%text(_SKIN_GENSETTINGS_TITLE)%></h3>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="adminskineditgeneral" />\r
- <%ticket%>\r
- <input type="hidden" name="skinid" value="<%editskin(id)%>" />\r
- </p>\r
- <table frame="box" rules="all" summary="<%text(_SKIN_GENSETTINGS_TITLE)%>">\r
- <tr>\r
- <td><%text(_SKIN_NAME)%> <%helplink(shortnames)%></td>\r
- <td><input name="name" value="<%editskin(name)%>" maxlength="64" size="30" tabindex="90" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_DESC)%></td>\r
- <td><input name="desc" value="<%editskin(desc)%>" maxlength="200" size="50" tabindex="100" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_TYPE)%></td>\r
- <td><input name="type" value="<%editskin(type)%>" maxlength="40" size="20" tabindex="110" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_INCLUDE_MODE)%> <%helplink(includemode)%></td>\r
- <td><%editskin(mode)%></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_INCLUDE_PREFIX)%> <%helplink(includeprefix)%></td>\r
- <td><input name="inc_prefix" value="<%editskin(prefix)%>" maxlength="40" size="20" tabindex="130" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_CHANGE)%></td>\r
- <td><input type="submit" value="<%text(_SKIN_CHANGE_BTN)%>" onclick="return checkSubmit();" tabindex="140" /></td>\r
- </tr>\r
- </table>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="adminskinedittype"><![CDATA[\r
- <%pagehead%>\r
- <p>(<a href="<%adminurl%>index.php?action=adminskinoverview"><%text(_SKIN_GOBACK)%></a>)</p>\r
- \r
- <h2><%text(_SKIN_EDITPART_TITLE)%> '<%editskintype(name)%>': <%editskintype(skintype)%></h2>\r
- <%headmessage%>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="adminskinupdate" />\r
- <%ticket%>\r
- <input type="hidden" name="skinid" value="<%editskintype(id)%>" />\r
- <input type="hidden" name="type" value="<%editskintype(skintyperaw)%>" />\r
- <input type="submit" value="<%text(_SKIN_UPDATE_BTN)%>" onclick="return checkSubmit();" />\r
- <input type="reset" value="<%text(_SKIN_RESET_BTN)%>" />\r
- (skin type: <%editskintype(skintype)%>)<%skintypehelp%><br />\r
- <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><%editskintype(content)%></textarea><br />\r
- <input type="submit" tabindex="20" value="<%text(_SKIN_UPDATE_BTN)%>" onclick="return checkSubmit();" />\r
- <input type="reset" value="<%text(_SKIN_RESET_BTN)%>" />\r
- (skin type: <%editskintype(skintype)%>)\r
- <br />\r
- <br />\r
- <%text(_SKIN_ALLOWEDVARS)%>\r
- <%allowedskinactions%><br /><br />\r
- <%text(_SKINEDIT_ALLOWEDTEMPLATESS)%>\r
- <%skineditallowedlist(template)%><br />\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="adminskiniedoimport"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- \r
- <h2><%text(_SKINIE_DONE)%></h2>\r
- \r
- <ul>\r
- <li><strong><%text(_SKINIE_INFO_GENERAL)%></strong> <%importskininfo(info)%></li>\r
- <li><strong><%text(_SKINIE_INFO_IMPORTEDSKINS)%></strong> <%importskininfo(snames)%></li>\r
- <li><strong><%text(_SKINIE_INFO_IMPORTEDTEMPLS)%></strong> <%importskininfo(tnames)%></li>\r
- </ul>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="adminskinieimport"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=adminskinieoverview">(<%text(_BACK)%>)</a></p>\r
- <h2><%text(_SKINIE_CONFIRM_TITLE)%></h2>\r
- \r
- <ul>\r
- <li><strong><%text(_SKINIE_INFO_GENERAL)%></strong> <%importskininfo(info)%></li>\r
- <li><strong><%text(_SKINIE_INFO_SKINS)%></strong> <%importskininfo(snames)%></li>\r
- <li><strong><%text(_SKINIE_INFO_TEMPLATES)%></strong> <%importskininfo(tnames)%></li>\r
- <%if(nameclashes)%>\r
- <li><strong style="color: red;"><%text(_SKINIE_INFO_SKINCLASH)%></strong> <%importskininfo(sclashes)%></li>\r
- <li><strong style="color: red;"><%text(_SKINIE_INFO_TEMPLCLASH)%></strong> <%importskininfo(tclashes)%></li>\r
- <%endif%>\r
- </ul>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="adminskiniedoimport" />\r
- <%ticket%>\r
- <input type="hidden" name="skinfile" value="<%importskininfo(skinfile)%>" />\r
- <input type="hidden" name="mode" value="<%importskininfo(mode)%>" />\r
- <input type="submit" value="<%text(_SKINIE_CONFIRM_IMPORT)%>" />\r
- <%if(nameclashes)%>\r
- <br />\r
- <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" />\r
- <label for="cb_overwrite"><%text(_SKINIE_CONFIRM_OVERWRITE)%></label>\r
- <%endif%>\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="adminskinieoverview"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- \r
- <h2><%text(_SKINIE_TITLE_IMPORT)%></h2>\r
- \r
- <p>\r
- <label for="skinie_import_local"><%text(_SKINIE_LOCAL)%></label>\r
- </p>\r
- \r
- <%if(superadmin)%>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="adminskinieimport" />\r
- <%ticket%>\r
- <input type="hidden" name="mode" value="file" />\r
- <select name="skinfile" id="skinie_import_local">\r
- <%selectlocalskinfiles%>\r
- </select>\r
- <input type="submit" value="<%text(_SKINIE_BTN_IMPORT)%>" />\r
- </p>\r
- </form>\r
- <%else%>\r
- <p><%text(_SKINIE_NOCANDIDATES)%></p>\r
- <%endif%>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <em><%text(_OR)%></em>\r
- <%ticket%>\r
- <input type="hidden" name="action" value="adminskinieimport" />\r
- <input type="hidden" name="mode" value="url" />\r
- <label for="skinie_import_url"><%text(_SKINIE_FROMURL)%></label>\r
- <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />\r
- <input type="submit" value="<%text(_SKINIE_BTN_IMPORT)%>" />\r
- </p>\r
- </form>\r
- \r
- <h2><%text(_SKINIE_TITLE_EXPORT)%></h2>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- \r
- <p><%text(_SKINIE_EXPORT_INTRO)%></p>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_SKINS)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_SKINIE_EXPORT_SKINS)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%skinielist(skin,admin/default)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_TEMPLATES)%>">\r
- <thead>\r
- <th colspan="2"><%text(_SKINIE_EXPORT_TEMPLATES)%></th>\r
- </thead>\r
- <tbody>\r
- <%skinielist(template,admin/default)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_EXTRA)%>">\r
- <thead>\r
- <th colspan="2"><%text(_SKINIE_EXPORT_EXTRA)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <tr>\r
- <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- \r
- <p>\r
- <input type="hidden" name="action" value="adminskinieexport" />\r
- <%ticket%>\r
- <input type="submit" value="<%text(_SKINIE_BTN_EXPORT)%>" />\r
- </p>\r
- \r
- \r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="adminskinoverview"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- <h2><%text(_SKIN_EDIT_TITLE)%></h2>\r
- \r
- <h3><%text(_SKIN_AVAILABLE_TITLE)%></h3>\r
- <%skinoverview(admin/default)%>\r
- \r
- <h3><%text(_SKIN_NEW_TITLE)%></h3>\r
- <form method="post" action="<%adminurl%>">\r
- <p>\r
- <input type="hidden" name="action" value="adminskinnew" />\r
- <%ticket%>\r
- </p>\r
- <table frame="box" rules="all" summary="<%text(_SKIN_NEW_TITLE)%>">\r
- <tr>\r
- <td><%text(_SKIN_NAME)%> <%helplink(shortnames)%></td>\r
- <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_DESC)%></td>\r
- <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_CREATE)%></td>\r
- <td><input type="submit" tabindex="10030" value="<%text(_SKIN_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>\r
- </tr>\r
- </table>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="adminskinremovetype"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_DELETE_CONFIRM)%></h2>\r
- <p><%text(_CONFIRMTXT_SKIN_PARTS_SPECIAL)%><br />\r
- <b><%editskintype(skintype)%> (<%editskintype(name)%>)</b> (<%editskintype(desc)%>)</p>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="adminskinremovetypeconfirm" />\r
- <%ticket%>\r
- <input type="hidden" name="skinid" value="<%editskintype(id)%>" />\r
- <input type="hidden" name="type" value="<%editskintype(skintype)%>" />\r
- <input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="admintemplatedelete"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_DELETE_CONFIRM)%></h2>\r
- <p><%text(_CONFIRMTXT_TEMPLATE)%><b><%edittemplateinfo(name)%></b> (<%edittemplateinfo(desc)%>)</p>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="admintemplatedeleteconfirm" />\r
- <%ticket%>\r
- <input type="hidden" name="templateid" value="<%edittemplateinfo(id)%>" />\r
- <input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="admintemplateedit"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=admintemplateoverview">(<%text(_TEMPLATE_BACK)%>)</a></p>\r
- \r
- <h2><%text(_TEMPLATE_EDIT_TITLE)%> '<%edittemplateinfo(name)%>'</h2>\r
- <%headmessage%>\r
- \r
- <p><%text(_TEMPLATE_EDIT_MSG)%></p>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="admintemplateupdate" />\r
- <%ticket%>\r
- <input type="hidden" name="templateid" value="<%edittemplateinfo(id)%>" />\r
- </p>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_EDIT_TITLE)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_SETTINGS)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <tr>\r
- <td><%text(_TEMPLATE_NAME)%> <%helplink(shortnames)%></td>\r
- <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<%edittemplateinfo(name)%>" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_TEMPLATE_DESC)%></td>\r
- <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<%edittemplateinfo(desc)%>" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_TEMPLATE_UPDATE)%></td>\r
- <td>\r
- <input type="submit" tabindex="6" value="<%text(_TEMPLATE_UPDATE_BTN)%>" onclick="return checkSubmit();" />\r
- <input type="reset" tabindex="7" value="<%text(_TEMPLATE_RESET_BTN)%>" />\r
- </td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_QMENU_LAYOUT_SKINS)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_QMENU_LAYOUT_SKINS)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_NORMALSKINLIST_HEAD, NORMALSKINLIST_HEAD, ,8)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_NORMALSKINLIST_BODY, NORMALSKINLIST_BODY, ,9)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_NORMALSKINLIST_FOOT, NORMALSKINLIST_FOOT, ,10)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SPECIALSKINLIST_HEAD, SPECIALSKINLIST_HEAD, , 11)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SPECIALSKINLIST_BODY, SPECIALSKINLIST_BODY, , 12)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SPECIALSKINLIST_FOOT, SPECIALSKINLIST_FOOT, , 13)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SKINIE_EXPORT_LIST, SKINIE_EXPORT_LIST, , 17)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_QMENU_LAYOUT_TEMPL)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_QMENU_LAYOUT_TEMPL)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_TEMPLATE_EDIT_EXPLUGNAME, TEMPLATE_EDIT_EXPLUGNAME, , 18)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_TEMPLATE_EDIT_ROW_HEAD, TEMPLATE_EDIT_ROW_HEAD, , 19)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_TEMPLATE_EDIT_ROW_TAIL, TEMPLATE_EDIT_ROW_TAIL, , 20)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_ADMINAREAHEADLINK)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_SKINABLEADMIN_ADMINAREAHEADLINK)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ADMIN_BLOGLINK, ADMIN_BLOGLINK, , 21)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_BATCH)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_SKINABLEADMIN_BATCH)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ADMIN_BATCHLIST, ADMIN_BATCHLIST, , 22)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_QMENU_ACTIVATE)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_QMENU_ACTIVATE)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_FORGOT_TITLE, ACTIVATE_FORGOT_TITLE, , 23)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_FORGOT_TEXT, ACTIVATE_FORGOT_TEXT, , 24)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_REGISTER_TITLE, ACTIVATE_REGISTER_TITLE, , 25)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_REGISTER_TEXT, ACTIVATE_REGISTER_TEXT, , 26)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_CHANGE_TITLE, ACTIVATE_CHANGE_TITLE, , 27)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_CHANGE_TEXT, ACTIVATE_CHANGE_TEXT, , 28)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_QMENU_MANAGE_SYSTEM)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_QMENU_MANAGE_SYSTEM)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SYSTEMINFO_GDSETTINGS, SYSTEMINFO_GDSETTINGS, , 29)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_BLOGLIST_BANS)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_BLOGLIST_BANS)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_BANLIST_DELETED_LIST, BANLIST_DELETED_LIST, , 30)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_TPLSETTING_INGENERAL)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_SKINABLEADMIN_TPLSETTING_INGENERAL)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_INSERT_PLUGOPTION_TITLE, INSERT_PLUGOPTION_TITLE, , 31)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_INSERT_PLUGOPTION_BODY, INSERT_PLUGOPTION_BODY, , 32)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_INPUTYESNO_TEMPLATE_ADMIN, INPUTYESNO_TEMPLATE_ADMIN, , 33)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_INPUTYESNO_TEMPLATE_NORMAL, INPUTYESNO_TEMPLATE_NORMAL, , 34)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ICON, ADMIN_CUSTOMHELPLINK_ICON, , 35)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ANCHOR, ADMIN_CUSTOMHELPLINK_ANCHOR, , 36)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_HEAD, SHOWLIST_LISTPLUG_SELECT_HEAD, , 37)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_BODY, SHOWLIST_LISTPLUG_SELECT_BODY, , 38)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_FOOT, SHOWLIST_LISTPLUG_SELECT_FOOT, , 39)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_HEAD, SHOWLIST_LISTPLUG_TABLE_HEAD, , 40)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BODY, SHOWLIST_LISTPLUG_TABLE_BODY, , 41)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_FOOT, SHOWLIST_LISTPLUG_TABLE_FOOT, , 42)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD, , 43)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY, SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY, , 44)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT, , 45)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD, , 46)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY, SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY, , 47)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT, , 48)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD, , 49)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY, , 50)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL, , 51)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST, SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST, , 52)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE, SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE, , 53)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND, SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND, , 54)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ, SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ, , 55)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE, SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE, , 56)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN, , 57)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN, , 58)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP, , 59)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL, SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL, , 60)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT, , 61)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD, , 62)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY, SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY, , 63)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO, , 64)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD, , 65)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP, , 66)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO, , 67)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC, , 68)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA, , 69)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT, , 70)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT, SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT, , 71)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT, , 72)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD, , 73)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY, SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY, , 74)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT, , 75)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD, , 76)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY, SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY, , 77)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN, SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN, , 78)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT, , 79)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD, , 80)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY, SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY, , 81)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM, SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM, , 82)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM, SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM, , 83)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT, , 84)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD, SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD, , 85)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY, SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY, , 86)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT, SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT, , 87)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD, SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD, , 88)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY, SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY, , 89)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT, SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT, , 90)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD, SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD, , 91)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY, SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY, , 92)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT, SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT, , 93)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD, , 94)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY, SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY, , 95)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT, , 96)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD, , 97)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY, SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY, , 98)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT, , 99)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD, , 100)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY, SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY, , 101)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT, , 102)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD, , 103)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY, SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY, , 104)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT, , 105)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD, , 106)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY, SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY, , 107)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT, , 108)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_PLUGIN_QUICKMENU)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_SKINABLEADMIN_PLUGIN_QUICKMENU)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row, _ADM_TPLPT_PLUGIN_QUICKMENU_TITLE, PLUGIN_QUICKMENU_TITLE, , 109)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_PLUGIN_QUICKMENU_HEAD, PLUGIN_QUICKMENU_HEAD, , 110)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_PLUGIN_QUICKMENU_BODY, PLUGIN_QUICKMENU_BODY, , 111)%>\r
- <%edittemplateinfo(row, _ADM_TPLPT_PLUGIN_QUICKMENU_FOOT, PLUGIN_QUICKMENU_FOOT, , 112)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_PLUGIN_FIELDS)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_PLUGIN_FIELDS)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(extratemplate,admin/default)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_UPDATE)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_UPDATE)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <tr>\r
- <td><%text(_TEMPLATE_UPDATE)%></td>\r
- <td>\r
- <input type="submit" tabindex="800" value="<%text(_TEMPLATE_UPDATE_BTN)%>" onclick="return checkSubmit();" />\r
- <input type="reset" tabindex="810" value="<%text(_TEMPLATE_RESET_BTN)%>" />\r
- </td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- \r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="admntemplateoverview"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- <h2><%text(_TEMPLATE_TITLE)%></h2>\r
- \r
- <h3><%text(_TEMPLATE_AVAILABLE_TITLE)%></h3>\r
- <%templateoverview(admin/default)%>\r
- \r
- <h3><%text(_TEMPLATE_NEW_TITLE)%></h3>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input name="action" value="admintemplatenew" type="hidden" />\r
- <%ticket%>\r
- </p>\r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_NEW_TITLE)%>">\r
- <tr>\r
- <td><%text(_TEMPLATE_NAME)%> <%helplink(shortnames)%></td>\r
- <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_TEMPLATE_DESC)%></td>\r
- <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_TEMPLATE_CREATE)%></td>\r
- <td><input type="submit" tabindex="10030" value="<%text(_TEMPLATE_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>\r
- </tr>\r
- </table>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="backupoverview"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- <h2><%text(_BACKUPS_TITLE)%></h2>\r
- <h3><%text(_BACKUP_TITLE)%></h3>\r
- <p><%text(_BACKUP_INTRO)%></p>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="backupcreate" />\r
- <%ticket%>\r
- <input type="radio" name="gzip" value="1" checked="checked" id="gzip_yes" tabindex="10" /><label for="gzip_yes"><%text(_BACKUP_ZIP_YES)%></label><br />\r
- <input type="radio" name="gzip" value="0" id="gzip_no" tabindex="10" /><label for="gzip_no" ><%text(_BACKUP_ZIP_NO)%></label><br /><br />\r
- <input type="submit" value="<%text(_BACKUP_BTN)%>" tabindex="20" />\r
- </p>\r
- </form>\r
- <p class="note"><%text(_BACKUP_NOTE)%></p>\r
- <h3><%text(_RESTORE_TITLE)%></h3>\r
- <p class="note"><%text(_RESTORE_NOTE)%></p>\r
- <p><%text(_RESTORE_INTRO)%></p>\r
- <form method="post" action="<%adminurl%>index.php" enctype="multipart/form-data">\r
- <p>\r
- <input type="hidden" name="action" value="backuprestore" />\r
- <%ticket%>\r
- <input name="backup_file" type="file" tabindex="30" />\r
- <br /><br />\r
- <input type="submit" value="<%text(_RESTORE_BTN)%>" tabindex="40" /><br />\r
- <input type="checkbox" name="letsgo" value="1" id="letsgo" tabindex="50" /><label for="letsgo"><%text(_RESTORE_IMSURE)%></label><br />\r
- <%text(_RESTORE_WARNING)%>\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="backuprestore"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_RESTORE_COMPLETE)%></h2>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="banlist"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>\r
- <h2><%text(_BAN_TITLE)%> '<%adminbloglink(admin/default)%>'</h2>\r
- <%adminbanlist%>\r
- <h2><%text(_BAN_NEW_TITLE)%></h2>\r
- <p><a href="<%adminurl%>index.php?action=banlistnew&blogid=<%requestblogid%>"><%text(_BAN_NEW_TEXT)%></a></p><%pagefoot%>\r
-]]></part>\r
-<part name="banlistdelete"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_BAN_REMOVE_TITLE)%></h2>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- \r
- <h3><%text(_BAN_IPRANGE)%></h3>\r
- \r
- <p>\r
- <%text(_CONFIRMTXT_BAN)%> <%requestiprange%>\r
- <input name="iprange" type="hidden" value="<%requestiprange%>" />\r
- </p>\r
- \r
- <h3><%text(_BAN_BLOGS)%></h3>\r
- \r
- <p>\r
- <input type="hidden" name="blogid" value="<%requestblogid%>" />\r
- <input name="allblogs" type="radio" value="0" id="allblogs_one" />\r
- <label for="allblogs_one"><%sprinttext(_BAN_BANBLOGNAME,<|%getblogsetting(name)%|>)%></label>\r
- <br />\r
- <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><%text(_BAN_ALLBLOGS)%></label>\r
- </p>\r
- \r
- <h3><%text(_BAN_DELETE_TITLE)%></h3>\r
- \r
- <p>\r
- <%ticket%>\r
- <input type="hidden" name="action" value="banlistdeleteconfirm" />\r
- <input type="submit" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
- </p>\r
- \r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="banlistdeleteconfirm"><![CDATA[\r
- <%pagehead%>\r
- <a href="<%adminurl%>index.php?action=banlist&blogid=<%requestblogid%>">(<%text(_BACK)%>)</a>\r
- <h2><%text(_BAN_REMOVED_TITLE)%></h2>\r
- <p><%text(_BAN_REMOVED_TEXT)%></p>\r
- <ul>\r
- <%banlistdeletedlist%>\r
- </ul>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="banlistnew"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_BAN_ADD_TITLE)%></h2>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <h3><%text(_BAN_IPRANGE)%></h3>\r
- <p><%text(_BAN_IPRANGE_TEXT)%></p>\r
- <p class="note">\r
- <strong><%text(_BAN_EXAMPLE_TITLE)%></strong>\r
- <%text(_BAN_EXAMPLE_TEXT)%>\r
- <%iprangeinput%>\r
- </p>\r
- </div>\r
- <h3><%text(_BAN_BLOGS)%></h3>\r
- <p><%text(_BAN_BLOGS_TEXT)%></p>\r
- <p>\r
- <input type="hidden" name="blogid" value="<%requestblogid%>" />\r
- <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">'<%blogsetting(name)%>'</label><br />\r
- <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><%text(_BAN_ALLBLOGS)%></label>\r
- </p>\r
- <h3><%text(_BAN_REASON_TITLE)%></h3>\r
- <p><%text(_BAN_REASON_TEXT)%></p>\r
- <p><textarea name="reason" cols="40" rows="5"></textarea></p>\r
- <h3><%text(_BAN_ADD_TITLE)%></h3>\r
- <p>\r
- <input name="action" type="hidden" value="banlistadd" />\r
- <%ticket%>\r
- <input type="submit" value="<%text(_BAN_ADD_BTN)%>" />\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="batchcategory"><![CDATA[\r
- <%pagehead%>\r
- <a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>\r
- <h2><%text(_BATCH_CATEGORIES)%></h2>\r
- <p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>\r
- <ul>\r
- <%adminbatchlist%>\r
- </ul>\r
- <b><%text(_BATCH_DONE)%></b>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="batchcomment"><![CDATA[\r
- <%pagehead%>\r
- <a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>\r
- <h2><%text(_BATCH_COMMENTS)%></h2>\r
- <p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>\r
- <ul>\r
- <%adminbatchlist%>\r
- </ul>\r
- <b><%text(_BATCH_DONE)%></b><%pagefoot%>\r
-]]></part>\r
-<part name="batchdelete"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_BATCH_DELETE_CONFIRM)%></h2>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="<%batchdeletetype%>" />\r
- <input type="hidden" name="batchaction" value="delete" />\r
- <input type="hidden" name="confirmation" value="yes" />\r
- <%ticket%>\r
- <%batchdeletelist%>\r
- <input type="submit" value="<%text(_BATCH_DELETE_CONFIRM_BTN)%>" onclick="return checkSubmit();" />\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="batchitem"><![CDATA[\r
- <%pagehead%>\r
- <a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>\r
- <h2><%text(_BATCH_ITEMS)%></h2>\r
- <p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>\r
- <ul>\r
- <%adminbatchlist%>\r
- </ul>\r
- <b><%text(_BATCH_DONE)%></b><%pagefoot%>\r
-]]></part>\r
-<part name="batchmember"><![CDATA[\r
- <%pagehead%>\r
- <a href="<%adminurl%>index.php?action=usermanagement"><%text(_MEMBERS_BACKTOOVERVIEW)%></a>\r
- <h2><%text(_BATCH_MEMBERS)%></h2>\r
- <p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>\r
- <ul>\r
- <%adminbatchlist%>\r
- </ul>\r
- <b><%text(_BATCH_DONE)%></b><%pagefoot%>\r
-]]></part>\r
-<part name="batchmove"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_MOVE_TITLE)%></h2>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="<%batchmovetype%>" />\r
- <input type="hidden" name="batchaction" value="move" />\r
- <%ticket%>\r
- <%batchmovelist%>\r
- <%movedistselect%>\r
- <input type="submit" value="<%batchmovebtn%>" onclick="return checkSubmit();" />\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="batchmovecat"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_MOVECAT_TITLE)%></h2>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="<%batchmovetype%>" />\r
- <input type="hidden" name="batchaction" value="move" />\r
- <%ticket%>\r
- <%batchmovelist%>\r
- <%movedistselect%>\r
- <input type="submit" value="<%batchmovebtn%>" onclick="return checkSubmit();" />\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="batchteam"><![CDATA[\r
-<%pagehead%>\r
-<a href="<%adminurl%>index.php?action=manageteam&blogid=<%requestblogid%>"><%text(_BACK)%></a>\r
-<h2><%text(_BATCH_TEAM)%></h2>\r
-<p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>\r
-<ul>\r
-<%adminbatchlist%>\r
-</ul>\r
-<b><%text(_BATCH_DONE)%></b><%pagefoot%>\r
-]]></part>\r
-<part name="blogcommentlist"><![CDATA[\r
-<%pagehead%>\r
-<p>(<a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>)</p>\r
-<h2><%text(_COMMENTS_BLOG)%> <%adminbloglink(admin/default)%></h2>\r
-<%commentnavlist(admin/default)%><%pagefoot%>\r
-]]></part>\r
-<part name="blogsettings"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>\r
-<h2><%text(_EBLOG_TITLE)%>: '<%adminbloglink(admin/default)%>'</h2>\r
-\r
-<h3><%text(_EBLOG_TEAM_TITLE)%></h3>\r
-\r
-<p>\r
-<%text(_EBLOG_CURRENT_TEAM_MEMBER)%>\r
-<%blogteammembers%>\r
-</p>\r
-\r
-<p><a href="<%adminurl%>index.php?action=manageteam&blogid=<%requestblogid%>"><%text(_EBLOG_TEAM_TEXT)%></a></p>\r
-\r
-<h3><%text(_EBLOG_SETTINGS_TITLE)%></h3>\r
-\r
-<form method="post" action="<%adminurl%>index.php">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="blogsettingsupdate" />\r
-<%ticket%>\r
-<input type="hidden" name="blogid" value="<%requestblogid%>" />\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_EBLOG_SETTINGS_TITLE)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_EBLOG_SETTINGS_TITLE)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td><%text(_EBLOG_NAME)%></td>\r
-<td><input name="name" tabindex="10" size="40" maxlength="60" value="<%blogsetting(name)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td>\r
-<%text(_EBLOG_SHORTNAME)%> <%helplink(shortblogname)%>\r
-<%text(_EBLOG_SHORTNAME_EXTRA)%>\r
-</td>\r
-<td><input name="shortname" tabindex="20" maxlength="15" size="15" value="<%blogsetting(short)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_DESC)%></td>\r
-<td><input name="desc" tabindex="30" maxlength="200" size="40" value="<%blogsetting(desc)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_URL)%></td>\r
-<td><input name="url" tabindex="40" size="40" maxlength="100" value="<%blogsetting(url)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_DEFSKIN)%><%helplink(blogdefaultskin)%></td>\r
-<td><%defskinselect(blog)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_LINEBREAKS)%> <%helplink(convertbreaks)%></td>\r
-<td><%blogsettingyesno(convertbreaks)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_ALLOWPASTPOSTING)%> <%helplink(allowpastposting)%></td>\r
-<td><%blogsettingyesno(allowpastposting)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_DISABLECOMMENTS)%></td>\r
-<td><%blogsettingyesno(comments)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_ANONYMOUS)%></td>\r
-<td><%blogsettingyesno(public)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_REQUIREDEMAIL)%></td>\r
-<td><%blogsettingyesno(reqemail)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_NOTIFY)%> <%helplink(blognotify)%></td>\r
-<td><input name="notify" tabindex="80" maxlength="60" size="40" value="<%blogsetting(notifyaddress)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_NOTIFY_ON)%></td>\r
-<td>\r
-<input name="notifyComment" value="3" type="checkbox" tabindex="81" id="notifyComment"<%blognotifysetting(comment)%> />\r
-<label for="notifyComment"><%text(_EBLOG_NOTIFY_COMMENT)%></label><br />\r
-<input name="notifyVote" value="5" type="checkbox" tabindex="82" id="notifyVote"<%blognotifysetting(vote)%> />\r
-<label for="notifyVote"><%text(_EBLOG_NOTIFY_KARMA)%></label><br />\r
-<input name="notifyNewItem" value="7" type="checkbox" tabindex="83" id="notifyNewItem"<%blognotifysetting(newitem)%> />\r
-<label for="notifyNewItem"><%text(_EBLOG_NOTIFY_ITEM)%></label>\r
-</td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_MAXCOMMENTS)%> <%helplink(blogmaxcomments)%></td>\r
-<td><input name="maxcomments" tabindex="90" size="3" value="<%blogsetting(maxcomments)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_UPDATE)%> <%helplink(blogupdatefile)%></td>\r
-<td><input name="update" tabindex="100" size="40" maxlength="60" value="<%blogsetting(updatefile)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_DEFCAT)%></td>\r
-<td><%defcatselect%></td>\r
-</tr>\r
-<tr>\r
-<td>\r
-<%text(_EBLOG_OFFSET)%> <%helplink(blogtimeoffset)%><br />\r
-<%text(_EBLOG_STIME)%> <b><%blogtime(servertime,"%H:%M")%></b><br />\r
-<%text(_EBLOG_BTIME)%> <b><%blogtime(blogtime,"%H:%M")%></b>\r
-</td>\r
-<td><input name="timeoffset" tabindex="120" size="3" value="<%blogsetting(timeoffset)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_SEARCH)%> <%helplink(blogsearchable)%></td>\r
-<td><%blogsettingyesno(searchable)%></td>\r
-</tr>\r
-<%pluginoptions(blog)%>\r
-<tr>\r
-<td><%text(_EBLOG_CHANGE)%></td>\r
-<td><input type="submit" tabindex="130" value="<%text(_EBLOG_CHANGE_BTN)%>" onclick="return checkSubmit();" /></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-</form>\r
-\r
-<h3><%text(_EBLOG_CAT_TITLE)%></h3>\r
-\r
-<%blogcatlist%>\r
-\r
-<form action="<%adminurl%>index.php" method="post">\r
-<p>\r
-<input name="action" value="categorynew" type="hidden" />\r
-<%ticket%>\r
-<input name="blogid" value="<%blogsetting(id)%>" type="hidden" />\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_EBLOG_CAT_CREATE)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_EBLOG_CAT_CREATE)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td><%text(_EBLOG_CAT_NAME)%></td>\r
-<td><input name="cname" size="40" maxlength="40" tabindex="300" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_CAT_DESC)%></td>\r
-<td><input name="cdesc" size="40" maxlength="200" tabindex="310" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_CAT_CREATE)%></td>\r
-<td><input type="submit" value="<%text(_EBLOG_CAT_CREATE)%>" tabindex="320" /></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-</form>\r
-<h3><%text(_PLUGINS_EXTRA)%></h3>\r
-<%pluginextras(blog)%>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="bookmarklet"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>\r
-<h2><%text(_BOOKMARKLET_TITLE)%></h2>\r
-<p><%text(_BOOKMARKLET_DESC1)%><%text(_BOOKMARKLET_DESC2)%><%text(_BOOKMARKLET_DESC3)%><%text(_BOOKMARKLET_DESC4)%><%text(_BOOKMARKLET_DESC5)%></p>\r
-<h3><%text(_BOOKMARKLET_BOOKARKLET)%></h3>\r
-<p>\r
-<%text(_BOOKMARKLET_BMARKTEXT)%><small><%text(_BOOKMARKLET_BMARKTEST)%></small>\r
-<br />\r
-<br />\r
-<a href="<%bookmarkletadmin(url)%>"><%sprinttext(_BOOKMARKLET_ANCHOR,<|%getblogsetting(name)%|>)%></a><%text(_BOOKMARKLET_BMARKFOLLOW)%>\r
-</p>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="browseowncomments"><![CDATA[\r
-<%pagehead%>\r
-<p>(<a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>)</p>\r
-<h2><%text(_COMMENTS_YOUR)%></h2>\r
-<%commentnavlist(admin/default)%><%pagefoot%>\r
-]]></part>\r
-<part name="browseownitems"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a></p>\r
-<h2><%text(_ITEMLIST_YOUR)%></h2>\r
-<%itemnavlist(admin/default)%><%pagefoot%>\r
-]]></part>\r
-<part name="categorydelete"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-<p>\r
-<%text(_CONFIRMTXT_CATEGORY)%><b><%categorysetting(name)%></b>\r
-</p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="categorydeleteconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="blogid" value="<%requestblogid%>" />\r
-<input type="hidden" name="catid" value="<%categorysetting(id)%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="categoryedit"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=blogsettings&blogid=<%requestblogid%>">(<%text(_BACK_TO_BLOGSETTINGS)%>)</a></p>\r
-<h2><%text(_EBLOG_CAT_UPDATE)%> '<%categorysetting(name)%>'</h2>\r
-<form method='post' action='<%adminurl%>index.php'>\r
-<p>\r
-<input name="blogid" type="hidden" value="<%requestblogid%>" />\r
-<input name="catid" type="hidden" value="<%categorysetting(id)%>" />\r
-<input name="desturl" type="hidden" value="<%editdesturl%>" />\r
-<input name="action" type="hidden" value="categoryupdate" />\r
-<%ticket%>\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_EBLOG_CAT_UPDATE)%>">\r
-<tr>\r
-<th colspan="2"><%text(_EBLOG_CAT_UPDATE)%></th>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_CAT_NAME)%></td>\r
-<td><input type="text" name="cname" value="<%categorysetting(name)%>" size="40" maxlength="40" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_CAT_DESC)%></td>\r
-<td><input type="text" name="cdesc" value="<%categorysetting(desc)%>" size="40" maxlength="200" /></td>\r
-</tr>\r
-<%pluginoptions(category)%>\r
-<tr>\r
-<th colspan="2"><%text(_EBLOG_CAT_UPDATE)%></th>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_CAT_UPDATE)%></td>\r
-<td><input type="submit" value="<%text(_EBLOG_CAT_UPDATE_BTN)%>" /></td>\r
-</tr>\r
-</table>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="commentdelete"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-<p><%text(_CONFIRMTXT_COMMENT)%></p>\r
-<p class="note">\r
-<b><%text(_EDITC_WHO)%>:</b> <%deletecomment(author)%><br />\r
-<b><%text(_EDITC_TEXT)%>:</b> <%deletecomment(body)%></div>\r
-</p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="commentdeleteconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="commentid" value="<%deletecomment(id)%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="commentedit"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_EDITC_TITLE)%></h2>\r
-\r
-<form method="post" action="<%adminurl%>index.php">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="commentupdate" />\r
-<%ticket%>\r
-<input type="hidden" name="commentid" value="<%editcomment(id)%>" />\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_EDITC_TITLE)%>">\r
-<tr>\r
-<th colspan="2"><%text(_EDITC_TITLE)%></th>\r
-</tr>\r
-<tr>\r
-<td><%text(_EDITC_WHO)%></td>\r
-<td><%editcomment(user)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EDITC_WHEN)%></td>\r
-<td><%editcomment(date)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EDITC_HOST)%></td>\r
-<td><%editcomment(host)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EDITC_URL)%></td>\r
-<td><input type="text" name="url" size="30" tabindex="6" value="<%editcomment(url)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EDITC_EMAIL)%></td>\r
-<td><input type="text" name="email" size="30" tabindex="8" value="<%editcomment(email)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EDITC_TEXT)%></td>\r
-<td><textarea name="body" tabindex="10" rows="10" cols="50"><%editcomment(body)%></textarea></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EDITC_EDIT)%></td>\r
-<td><input type="submit" tabindex="20" value="<%text(_EDITC_EDIT)%>" onclick="return checkSubmit();" /></td>\r
-</tr>\r
-</table>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="createitem"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_ADD_ADDTO)%> '<%adminbloglink(admin/default)%>'</h2>\r
- <%init%>\r
- <script type="text/javascript" src="<%skinfile(/javascripts/numbercheck.js)%>"></script>\r
- <%if(autosave)%><script type="text/javascript" src="<%skinfile(/javascripts/xmlhttprequest.js)%>"></script><%endif%>\r
- <form id="addform" method="post" action="<%adminurl%>index.php" >\r
- <p>\r
- <input type="hidden" name="action" value="additem" />\r
- <input name="blogid" value="<%blogid%>" type="hidden" />\r
- <input type="hidden" name="draftid" value="0" />\r
- <%ticket%>\r
- </p>\r
- <table frame="box" rules="all" summary="<%text(_ADD_ADDTO)%>">\r
- <tr>\r
- <th colspan="2"><%text(_ADD_CREATENEW)%></th>\r
- </tr>\r
- <%if(autosave)%>\r
- <tr>\r
- <td><%text(_AUTOSAVEDRAFT)%></td>\r
- <td><span id="info"><%text(_AUTOSAVEDRAFT_NOTYETSAVED)%></span></td>\r
- </tr>\r
- <%endif%>\r
- <tr>\r
- <td><%text(_ADD_TITLE)%></td>\r
- <td><input id="inputtitle" name="title" value="<%contents(title)%>" onkeyup="storeCaret(this); updPreview(title); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);" tabindex="10" size="60" maxlength="160" /></td>\r
- </tr>\r
- <tr>\r
- <td>\r
- <%text(_ADD_BODY)%> <%helplink(additem)%>\r
- </td>\r
- <td>\r
- <div class="jsbuttonbar">\r
- <!--[if IE]>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">\r
- <img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">\r
- <img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">\r
- <img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
- <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
- <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
- <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />\r
- </span>\r
- <![endif]-->\r
- <!--[if ! IE]>-->\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
- <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
- <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
- <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />\r
- </span>\r
- <!--<![endif]-->\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">\r
- <img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">\r
- <img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">\r
- <img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">\r
- <img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">\r
- <img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">\r
- <img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />\r
- </span>\r
- <!--[if IE]>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">\r
- <img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />\r
- </span>\r
- <![endif]-->\r
- <div class="jsbuttonend"></div>\r
- </div>\r
- <textarea id="inputbody" name="body" tabindex="20" cols="60" rows="20" onkeyup="storeCaret(this); updPreview(body); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);"><%contents(body)%></textarea>\r
- </td>\r
- </tr>\r
- <tr id="edit" style="display:none;">\r
- <td><%text(_ADD_PREVIEW)%></td>\r
- <td><b><span id="prevtitle"> </span></b><br />\r
- <span id="prevbody"> </span><br />\r
- <span id="prevmore"> </span><br />\r
- </td>\r
- </tr>\r
- <%if(blogsetting, bcomments)%>\r
- <tr>\r
- <td><%text(_ADD_DISABLE_COMMENTS)%></td>\r
- <td>\r
- <input name="closed" type="radio" tabindex="30" value="1" id="closed_yes" /><label for="closed_yes"><%text(_YES)%></label>\r
- <input name="closed" type="radio" tabindex="30" value="0" checked="checked" id="closed_no" /><label for="closed_no"><%text(_NO)%></label>\r
- </td>\r
- </tr>\r
- <%endif%>\r
- <tr>\r
- <td><%text(_ADD_CATEGORY)%></td>\r
- <td><%categories(40)%></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SUBMIT)%></td>\r
- <td>\r
- <input tabindex="60" type="submit" value="<%text(_ADD_ADDITEM)%>" onclick="return checkSubmit();" /><br />\r
- <br />\r
- <input name="actiontype" value="addnow" type="radio" checked='checked' id="act_now" tabindex="61" />\r
- <label for="act_now"><%text(_ADD_ADDNOW)%></label><br />\r
- <input type="radio" id="act_future" name="actiontype" value="addfuture" tabindex="61" />\r
- <label for="act_future" ><%text(_ADD_ADDLATER)%></label> <%helplink(future)%>\r
- <div class="indent">\r
- <%text(_ADD_PLACE_ON)%>\r
- <input type="text" id="inputyear" name="year" value="<%currenttime(year)%>" tabindex="63" size="4" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_YEAR_UNIT)%>\r
- <input type="text" id="inputmonth" name="month" value="<%currenttime(mon)%>" tabindex="64" size="2" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_MONTH_UNIT)%>\r
- <input type="text" id="inputday" name="day" value="<%currenttime(mday)%>" tabindex="65" size="2" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_DAY_UNIT)%>\r
- <input id="inputhour" name="hour" value="<%currenttime(hours)%>" tabindex="66" size="2" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_HOUR_UNIT)%>\r
- <input type="text" id="inputminutes" name="minutes" value="<%currenttime(minutes)%>" tabindex="67" size="2" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_MINUTE_UNIT)%><br />\r
- \r
- <%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_LABEL_YEAR_UNIT)%>(mm)<%text(_LABEL_MONTH_UNIT)%>(dd)<%text(_LABEL_DAY_UNIT)%> (hh)<%text(_LABEL_HOUR_UNIT)%>(mm)<%text(_LABEL_MINUTE_UNIT)%>\r
- \r
- <%if(blogsetting, ballowpast,0)%>\r
- <br />\r
- <%text(_ADD_NOPASTDATES)%>\r
- <%endif%>\r
- </div>\r
- <input type="radio" id="act_draft" name="actiontype" value="adddraft" tabindex="61" />\r
- <label for="act_draft"><%text(_ADD_ADDDRAFT)%></label> <%helplink(draft)%>\r
- </td>\r
- </tr>\r
- <tr>\r
- <td><%text(_ADD_PLUGIN_EXTRAS)%></td>\r
- <td><%pluginextras%></td>\r
- </tr>\r
- <%pluginoptions(item)%>\r
- <tr>\r
- <th colspan="2"><%text(_ADD_MORE)%></th>\r
- </tr>\r
- <tr>\r
- <td><%text(_ADD_MORE)%><br />\r
- <%helplink(extended)%>\r
- </td>\r
- <td>\r
- <div class="jsbuttonbar">\r
- <!--[if IE]>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">\r
- <img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">\r
- <img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">\r
- <img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
- <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
- <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
- <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />\r
- </span>\r
- <![endif]-->\r
- <!--[if ! IE]>-->\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
- <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
- <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
- <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />\r
- </span>\r
- <!--<![endif]-->\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">\r
- <img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">\r
- <img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">\r
- <img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">\r
- <img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">\r
- <img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">\r
- <img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />\r
- </span>\r
- <!--[if IE]>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">\r
- <img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />\r
- </span>\r
- <![endif]-->\r
- </div>\r
- <textarea id="inputmore" name="more" onkeyup="storeCaret(this); updPreview(more); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);" tabindex="70" cols="60" rows="20"><%contents(more)%></textarea>\r
- </td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SUBMIT)%></td>\r
- <td>\r
- <input type="submit" value="<%text(_ADD_ADDITEM)%>" onclick="return checkSubmit();" tabindex="60" />\r
- <%if(autosave)%>\r
- <input type="button" name="autosavenow" value="<%text(_AUTOSAVEDRAFT_NOW)%>" tabindex="80" onclick="autoSaveDraft();" />\r
- <%endif%>\r
- </td>\r
- </tr>\r
- </table>\r
- \r
- </form>\r
- <%if(autosave)%>\r
- <script type="text/javascript">\r
- var xmlhttprequest = new Array();\r
- xmlhttprequest[0] = createHTTPHandler(); // AutoDraft handler\r
- xmlhttprequest[1] = createHTTPHandler(); // UpdateTicket handler\r
- var seconds = now(); // Last AutoDraft time\r
- var checks = 0; // Number of checks since last AutoDraft\r
- var addform = document.getElementById('addform'); // The form id\r
- var goal = document.getElementById('info'); // The html div id where 'Last saved: date time' must come\r
- var goalurl = '../action.php'; // The PHP file where the content must be posted to\r
- var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'\r
- var formtype = 'add'; // Add or edit form\r
- </script>\r
- <%endif%>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="createnewlog"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
-<h2><%text(_EBLOG_CREATE_TITLE)%></h2>\r
-<h3><%text(_ADMIN_NOTABILIA)%></h3>\r
-<p><%text(_ADMIN_PLEASE_READ)%></p>\r
-<p><%text(_ADMIN_HOW_TO_ACCESS)%></p>\r
-<ol>\r
-<li><%text(_ADMIN_SIMPLE_WAY)%></li>\r
-<li><%text(_ADMIN_ADVANCED_WAY)%></li>\r
-</ol>\r
-\r
-<h3><%text(_ADMIN_HOW_TO_CREATE)%></h3>\r
-\r
-<p><%text(_EBLOG_CREATE_TEXT)%></p>\r
-\r
-<form method="post" action="<%adminurl%>index.php">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="addnewlog" />\r
-<%ticket%>\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_EBLOG_CREATE_TEXT)%>">\r
-<tr>\r
-<td><%text(_EBLOG_NAME)%></td>\r
-<td><input name="name" tabindex="10" size="40" maxlength="60" /></td>\r
-</tr>\r
-<tr>\r
-<td>\r
-<%text(_EBLOG_SHORTNAME)%>\r
-<%helplink(shortblogname)%>\r
-</td>\r
-<td><input name="shortname" tabindex="20" maxlength="15" size="15" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_DESC)%></td>\r
-<td><input name="desc" tabindex="30" maxlength="200" size="40" /></td>\r
-</tr>\r
-<tr>\r
-<td>\r
-<%text(_EBLOG_DEFSKIN)%>\r
-<%helplink(blogdefaultskin)%>\r
-</td>\r
-<td><%defskinselect(blog,admin/default)%></td>\r
-</tr>\r
-<tr>\r
-<td>\r
-<%text(_EBLOG_OFFSET)%>\r
-<%helplink(blogtimeoffset)%><br />\r
-<%text(_EBLOG_STIME)%> <b><%blogtime(servertime,"%H:%M")%></b>\r
-</td>\r
-<td><input name="timeoffset" tabindex="110" size="3" value="0" /></td>\r
-</tr>\r
-<tr>\r
-<td>\r
-<%text(_EBLOG_ADMIN)%>\r
-<%helplink(teamadmin)%>\r
-</td>\r
-<td><%text(_EBLOG_ADMIN_MSG)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_EBLOG_CREATE)%></td>\r
-<td><input type="submit" tabindex="120" value="<%text(_EBLOG_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>\r
-</tr>\r
-</table>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="deleteblog"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-\r
-<p>\r
-<%text(_WARNINGTXT_BLOGDEL)%>\r
-</p>\r
-\r
-<p>\r
-<%text(_CONFIRMTXT_BLOG)%><b><%blogsetting(name)%></b>\r
-</p>\r
-\r
-<form method="post" action="<%adminurl%>index.php">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="deleteblogconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="blogid" value="<%requestblogid%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="editmembersettings"><![CDATA[\r
-<%pagehead%>\r
-<p>\r
-<%if(superadmin)%>\r
-<a href="<%adminurl%>index.php?action=usermanagement">(<%text(_MEMBERS_BACKTOOVERVIEW)%>)\r
-<%else%>\r
-<a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)\r
-<%endif%>\r
-</a>\r
-</p>\r
-<h2><%text(_MEMBERS_EDIT)%></h2>\r
-\r
-<form method="post" action="<%adminurl%>index.php" name="memberedit">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="changemembersettings" />\r
-<input type="hidden" name="memberid" value="<%editmember(id)%>" />\r
-<%ticket%>\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_MEMBERS_EDIT)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_MEMBERS_EDIT)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td>\r
-<%text(_MEMBERS_DISPLAY)%> <%helplink(shortnames)%><br />\r
-<small><%text(_MEMBERS_DISPLAY_INFO)%></small>\r
-</td>\r
-<td><%editmember(displayname)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_REALNAME)%></td>\r
-<td><input name="realname" tabindex="20" maxlength="60" size="40" value="<%editmember(realname)%>" /></td>\r
-</tr>\r
-<tr><%if(allowloginedit)%>\r
-<td><%text(_MEMBERS_PWD)%></td>\r
-<td><input type="password" tabindex="30" maxlength="40" size="16" name="password" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_REPPWD)%></td>\r
-<td><input type="password" tabindex="35" maxlength="40" size="16" name="repeatpassword" /></td>\r
-</tr>\r
-<tr><%endif%>\r
-<td>\r
-<%text(_MEMBERS_EMAIL)%><br />\r
-<small><%text(_MEMBERS_EMAIL_EDIT)%></small>\r
-</td>\r
-<td><input name="email" tabindex="40" size="40" maxlength="60" value="<%editmember(email)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_URL)%></td>\r
-<td><input name="url" tabindex="50" size="40" maxlength="100" value="<%editmember(url)%>" /></td>\r
-</tr>\r
-<%if(superadmin)%>\r
-<tr>\r
-<td><%text(_MEMBERS_SUPERADMIN)%> <%helplink(superadmin)%></td>\r
-<td><%editmember(admin)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_CANLOGIN)%> <%helplink(canlogin)%></td>\r
-<td><%editmember(canlogin)%></td><%endif%>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_NOTES)%></td>\r
-<td><input name="notes" tabindex="80" size="40" maxlength="100" value="<%editmember(notes)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_LOCALE)%> <%helplink(locale)%></td>\r
-<td>\r
-<select name="locale" tabindex="85">\r
-<%localeselectoptions%>\r
-</select>\r
-</td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_USEAUTOSAVE)%> <%helplink(autosave)%></td>\r
-<td><%editmember(autosave)%></td>\r
-</tr><%if(superadmin)%><tr>\r
-<td><%text(_SKINABLEADMIN_MEMBERS_ADMINSKIN)%> <%customhelplink(useadminskin)%></td>\r
-<td>\r
-<%defadminskinselect(admin/default)%>\r
-</td>\r
-</tr><%endif%><%if(superadmin)%><tr>\r
-<td><%text(_MEMBERS_BKMKLTSKIN)%></td>\r
-<td>\r
-<%defbookmarkletselect(admin/default)%>\r
-</td>\r
-</tr>\r
-<%endif%>\r
-<%pluginoptions(member)%>\r
-</tbody>\r
-</table>\r
-\r
-<table frame="box" rules="all" summary="<%text(_MEMBERS_EDIT)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_MEMBERS_EDIT)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td><%text(_MEMBERS_EDIT)%></td>\r
-<td><input type="submit" tabindex="90" value="<%text(_MEMBERS_EDIT_BTN)%>" onclick="return checkSubmit();" /></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-</form>\r
-<h3><%text(_PLUGINS_EXTRA)%></h3>\r
-<%pluginextras(member)%>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="itemcommentlist"><![CDATA[\r
-<%pagehead%>\r
-<p>(<a href="<%adminurl%>index.php?action=itemlist&blogid=<%requestblogid%>"><%text(_BACKTOOVERVIEW)%></a>)</p>\r
-<h2><%text(_COMMENTS)%></h2>\r
-<%commentnavlist(admin/default)%>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="itemdelete"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-<p><%text(_CONFIRMTXT_ITEM)%></p>\r
-<p class="note">\r
-<b>"<%deleteitemtitle%>"</b><br />\r
-<%deleteitembody%>\r
-</p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="itemdeleteconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="itemid" value="<%deleteitemid%>" />\r
-<input type="submit" value="<%text(_DELETE_CONFIRM_BTN)%>" tabindex="10" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="itemedit"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_EDIT_ITEM)%></h2>\r
- \r
- <%init%>\r
- <script type="text/javascript" src="<%skinfile(/javascripts/numbercheck.js)%>"></script>\r
- <%if(autosave)%>\r
- <script type="text/javascript" src="<%skinfile(/javascripts/xmlhttprequest.js)%>"></script>\r
- <%endif%>\r
- \r
- <form id="editform" method="post" action="<%adminurl%>index.php">\r
- \r
- <p>\r
- <input type="hidden" name="action" value="itemupdate" />\r
- <input name="itemid" value="<%contents(itemid)%>" type="hidden" />\r
- <input type="hidden" name="draftid" value="0" />\r
- <%ticket%>\r
- </p>\r
- \r
- <table frame="box" rules="all" summary="<%text(_EDIT_ITEM)%>">\r
- <tr>\r
- <th colspan="2"><%text(_EDIT_ITEM)%></th>\r
- </tr>\r
- <%if(autosave)%><tr>\r
- <td><%text(_AUTOSAVEDRAFT)%></td>\r
- <td><span id="info"><%text(_AUTOSAVEDRAFT_NOTYETSAVED)%></span></td>\r
- </tr>\r
- <%endif%>\r
- <tr>\r
- <td><%text(_EDIT_ORIG_AUTHOR)%></td>\r
- <td><%contents(author)%></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_ADD_TITLE)%></td>\r
- <td><input type="text" id="inputtitle" name="title" value="<%contents(title)%>" tabindex="10" size="60" maxlength="160" onkeyup="storeCaret(this); updPreview(title); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);" />\r
- </td>\r
- </tr>\r
- <tr>\r
- <td><%text(_ADD_BODY)%></td>\r
- <td>\r
- <div class="jsbuttonbar">\r
- <!--[if IE]>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">\r
- <img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">\r
- <img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">\r
- <img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
- <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
- <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
- <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />\r
- </span>\r
- <![endif]-->\r
- <!--[if ! IE]>-->\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
- <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
- <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
- <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />\r
- </span>\r
- <!--<![endif]-->\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">\r
- <img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">\r
- <img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">\r
- <img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">\r
- <img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">\r
- <img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">\r
- <img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />\r
- </span>\r
- <!--[if IE]>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">\r
- <img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />\r
- </span>\r
- <![endif]-->\r
- </div>\r
- <textarea id="inputbody" name="body" tabindex="20" cols="60" rows="20" onkeyup="storeCaret(this); updPreview(body); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);"><%contents(body)%></textarea>\r
- </td>\r
- </tr>\r
- <tr id="edit" style="display:none;">\r
- <td><%text(_ADD_PREVIEW)%></td>\r
- <td><b><span id="prevtitle"> </span></b><br />\r
- <span id="prevbody"> </span><br />\r
- <span id="prevmore"> </span><br />\r
- </td>\r
- </tr>\r
- \r
- <%if(blogsetting, bcomments)%>\r
- <tr>\r
- <td><%text(_ADD_DISABLE_COMMENTS)%></td>\r
- <td> \r
- <input type="radio" name="closed" value="1" <%checkedonval(1,closed)%> tabindex="30" id="closed_yes" /><label for="closed_yes"><%text(_YES)%></label>\r
- <input type="radio" name="closed" value="0" <%checkedonval(0,closed)%> tabindex="30" id="closed_no" /><label for="closed_no"><%text(_NO)%></label><br />\r
- <small><%text(_EDIT_COMMENTSNOTE)%></small>\r
- </td>\r
- </tr>\r
- <%endif%>\r
- \r
- <tr>\r
- <td><%text(_ADD_CATEGORY)%></td>\r
- <td><%categories(40)%></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_EDIT_SUBMIT)%></td>\r
- <td>\r
- <input type="submit" tabindex="60" value="<%text(_EDIT_SUBMIT)%>" onclick="return checkSubmit();" />\r
- <%if(itemproperty, draft)%>\r
- <br />\r
- <br />\r
- <input name="actiontype" value="addnow" type="radio" id="act_now" />\r
- <label for="act_now" tabindex="61"><%text(_ADD_ADDNOW)%></label><br />\r
- <input name="actiontype" value="addfuture" type="radio" id="act_future" tabindex="61" /><label for="act_future"><%text(_ADD_ADDLATER)%></label> <%helplink(future)%>\r
- <div class="indent">\r
- <%text(_ADD_PLACE_ON)%>\r
- <input type="text" id="inputyear" name="year" tabindex="71" size="4" value="<%currenttime(year)%>" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_YEAR_UNIT)%>\r
- <input type="text" id="inputmonth" name="month" tabindex="72" size="2" value="<%currenttime(mon)%>" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_MONTH_UNIT)%>\r
- <input type="text" id="inputday" name="day" tabindex="73" size="2" value="<%currenttime(mday)%>" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_DAY_UNIT)%>\r
- \r
- <input type="text" id="inputhour" name="hour" tabindex="74" size="2" value="<%currenttime(hours)%>" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_HOUR_UNIT)%>\r
- <input type="text" id="inputminutes" name="minutes" tabindex="75" size="2" value="<%currenttime(minutes)%>" onchange="document.forms[0].act_future.checked=true;" />\r
- <%text(_LABEL_MINUTE_UNIT)%><br />\r
- <%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_LABEL_YEAR_UNIT)%>(mm)<%text(_LABEL_MONTH_UNIT)%>(dd)<%text(_LABEL_DAY_UNIT)%> (hh)<%text(_LABEL_HOUR_UNIT)%>(mm)<%text(_LABEL_MINUTE_UNIT)%>\r
- \r
- <%if(blogsetting, ballowpast,0)%>\r
- <br />\r
- <%text(_ADD_NOPASTDATES)%>\r
- <%endif%>\r
- \r
- </div>\r
- <input type="radio" id="act_draft" name="actiontype" value="adddraft" checked='checked' tabindex="61" />\r
- <label for="act_draft"><%text(_EDIT_BACKTODRAFTS)%></label> <%helplink(draft)%><br />\r
- <input type="radio" id="act_delete" name="actiontype" value="delete" tabindex="61" />\r
- <label for="act_delete"><%text(_BMLET_DELETE)%></label>\r
- <%endif%>\r
- \r
- <%if(itemproperty, draft,0)%>\r
- <br />\r
- <br />\r
- <input type="radio" id="act_edit" name="actiontype" value="edit" checked="checked" tabindex="61" />\r
- <label for="act_edit"><%text(_BMLET_EDIT)%></label>\r
- <%if(blogsetting, ballowpast)%>\r
- <br />\r
- <input type="radio" id="act_changedate" name="actiontype" value="changedate" tabindex="70" />\r
- <label for="act_changedate"><%text(_ADD_CHANGEDATE)%></label> <%helplink(changedate)%>\r
- <div class="indent">\r
- <input type="text" id="inputyear" name="year" value="<%itemtime(year)%>" size="4" tabindex="71" onchange="document.forms[0].act_changedate.checked=true;" />\r
- <%text(_LABEL_YEAR_UNIT)%>\r
- <input type="text" id="inputmonth" name="month" value="<%itemtime(mon)%>" size="2" tabindex="72" onchange="document.forms[0].act_changedate.checked=true;" />\r
- <%text(_LABEL_MONTH_UNIT)%>\r
- <input type="text" id="inputday" name="day" value="<%itemtime(mday)%>" size="2" tabindex="73" onchange="document.forms[0].act_changedate.checked=true;" />\r
- <%text(_LABEL_DAY_UNIT)%>\r
- <input type="text" id="inputhour" name="hour" value="<%itemtime(hours)%>" size="2" tabindex="74" onchange="document.forms[0].act_changedate.checked=true;" />\r
- <%text(_LABEL_HOUR_UNIT)%>\r
- <input type="text" id="inputminutes" name="minutes" value="<%itemtime(minutes)%>" size="2" tabindex="75" onchange="document.forms[0].act_changedate.checked=true;" />\r
- <%text(_LABEL_MINUTE_UNIT)%>\r
- <br /><%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_LABEL_YEAR_UNIT)%>(mm)<%text(_LABEL_MONTH_UNIT)%>(dd)<%text(_LABEL_DAY_UNIT)%> (hh)<%text(_LABEL_HOUR_UNIT)%>(mm)<%text(_LABEL_MINUTE_UNIT)%>\r
- </div>\r
- <%endif%>\r
- <input type="radio" id="act_backtodrafts" name="actiontype" value="backtodrafts" tabindex="71" />\r
- <label for="act_backtodrafts"><%text(_BMLET_BACKTODRAFTS)%></label> <%helplink(draft)%><br />\r
- <input type="radio" id="act_delete" name="actiontype" value="delete" tabindex="61" />\r
- <label for="act_delete"><%text(_BMLET_DELETE)%></label>\r
- <%endif%>\r
- \r
- </td>\r
- </tr>\r
- <tr>\r
- <td><%text(_ADD_PLUGIN_EXTRAS)%></td>\r
- <td><%pluginextras%></td>\r
- </tr>\r
- <%pluginoptions(item)%>\r
- <tr>\r
- <th colspan="2"><%text(_ADD_MORE)%></th>\r
- </tr>\r
- <tr>\r
- <td>\r
- <%text(_ADD_MORE)%><br />\r
- <%helplink(extended)%>\r
- </td>\r
- <td>\r
- <div class="jsbuttonbar">\r
- <!--[if IE]>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">\r
- <img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">\r
- <img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">\r
- <img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
- <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
- <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
- <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />\r
- </span>\r
- <![endif]-->\r
- <!--[if ! IE]>-->\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">\r
- <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">\r
- <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">\r
- <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />\r
- </span>\r
- <!--<![endif]-->\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">\r
- <img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">\r
- <img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">\r
- <img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">\r
- <img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">\r
- <img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />\r
- </span>\r
- <span class="jsbuttonspacer"> </span>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">\r
- <img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />\r
- </span>\r
- <!--[if IE]>\r
- <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">\r
- <img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />\r
- </span>\r
- <![endif]-->\r
- </div>\r
- <textarea id="inputmore" name="more" cols="60" rows="20" tabindex="90" onkeyup="storeCaret(this); updPreview(more); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);"><%contents(more)%></textarea>\r
- </td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SUBMIT)%></td>\r
- <td>\r
- <input type="submit" value="<%text(_EDIT_SUBMIT)%>" tabindex="60" onclick="return checkSubmit();" />\r
- <%if(autosave)%>\r
- <input type="button" name="autosavenow" value="<%text(_AUTOSAVEDRAFT_NOW)%>" tabindex="80" onclick="autoSaveDraft();" />\r
- <%endif%>\r
- </td>\r
- </tr>\r
- </table>\r
- </div>\r
- </form>\r
- <%if(autosave)%>\r
- <script type="text/javascript">\r
- var xmlhttprequest = new Array();\r
- xmlhttprequest[0] = createHTTPHandler(); // AutoDraft handler\r
- xmlhttprequest[1] = createHTTPHandler(); // UpdateTicket handler\r
- var seconds = now(); // Last AutoDraft time\r
- var checks = 0; // Number of checks since last AutoDraft\r
- var addform = document.getElementById('editform'); // The form id\r
- var goal = document.getElementById('info'); // The html div id where 'Last saved: date time' must come\r
- var goalurl = '../action.php'; // The PHP file where the content must be posted to\r
- var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'\r
- var formtype = 'edit'; // Add or edit form\r
- </script>\r
- <%endif%>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="itemlist"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>\r
-<h2><%text(_ITEMLIST_BLOG)%><%adminbloglink(admin/default)%></h2>\r
-<%ilistaddnew%>\r
-<%itemnavlist(admin/default)%>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="itemmove"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_MOVE_TITLE)%></h2>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="itemmoveto" />\r
-<input type="hidden" name="itemid" value="<%moveitemid%>" />\r
-<%ticket%>\r
-<%movedistselect%>\r
-<input type="submit" value="<%text(_MOVE_BTN)%>" tabindex="10000" onclick="return checkSubmit();" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="manage"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>\r
-<%headmessage%>\r
-<h2><%text(_MANAGE_GENERAL)%></h2>\r
-\r
-<ul>\r
-<li><a href="<%adminurl%>index.php?action=createnewlog"><%text(_OVERVIEW_NEWLOG)%></a></li>\r
-<li><a href="<%adminurl%>index.php?action=settingsedit"><%text(_OVERVIEW_SETTINGS)%></a></li>\r
-<li><a href="<%adminurl%>index.php?action=usermanagement"><%text(_OVERVIEW_MEMBERS)%></a></li>\r
-<li><a href="<%adminurl%>index.php?action=actionlog"><%text(_OVERVIEW_VIEWLOG)%></a></li>\r
-</ul>\r
-\r
-<h2><%text(_MANAGE_SKINS)%></h2>\r
-<ul>\r
-<li><a href="<%adminurl%>index.php?action=skinoverview"><%text(_OVERVIEW_SKINS)%></a></li>\r
-<li><a href="<%adminurl%>index.php?action=templateoverview"><%text(_OVERVIEW_TEMPLATES)%></a></li>\r
-<li><a href="<%adminurl%>index.php?action=skinieoverview"><%text(_OVERVIEW_SKINIMPORT)%></a></li>\r
-</ul>\r
-\r
-<h2><%text(_MANAGE_EXTRA)%></h2>\r
-<ul>\r
-<li><a href="<%adminurl%>index.php?action=backupoverview"><%text(_OVERVIEW_BACKUP)%></a></li>\r
-<li><a href="<%adminurl%>index.php?action=pluginlist"><%text(_OVERVIEW_PLUGINS)%></a></li>\r
-</ul><%pagefoot%>\r
-]]></part>\r
-<part name="manageteam"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=blogsettings&blogid=<%requestblogid%>">(<%text(_BACK_TO_BLOGSETTINGS)%>)</a></p>\r
-<h2><%text(_TEAM_TITLE)%><%blogsetting(name)%></h2>\r
-<h3><%text(_TEAM_CURRENT)%></h3>\r
-<%blogteamlist(admin/default)%>\r
-<h3><%text(_TEAM_ADDNEW)%></h3>\r
-\r
-<form method='post' action='<%adminurl%>index.php'>\r
-\r
-<p>\r
-<input type='hidden' name='action' value='teamaddmember' />\r
-<input type='hidden' name='blogid' value='<%requestblogid%>' />\r
-<%ticket%>\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_TEAM_ADDNEW)%>">\r
-<tr>\r
-<td><%text(_TEAM_CHOOSEMEMBER)%></td>\r
-<td><%newmemberselect%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_TEAM_ADMIN)%><%helplink(teamadmin)%></td>\r
-<td><%inputyesno(admin,0,10020)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_TEAM_ADD)%></td>\r
-<td><input type='submit' value='<%text(_TEAM_ADD_BTN)%>' tabindex="10030" /></td>\r
-</tr>\r
-</table>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="memberdelete"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-<p><%text(_CONFIRMTXT_MEMBER%><b><%editmember(displayname)%></b></p>\r
-<p><%text(_WARNINGTXT_NOTDELMEDIAFILES)%></p>\r
-\r
-<form method="post" action="<%adminurl%>index.php">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="memberdeleteconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="memberid" value="<%editmember(id)%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="overview"><![CDATA[\r
-<%pagehead%>\r
-<%headmessage%>\r
-<h2><%text(_OVERVIEW_YRBLOGS)%></h2>\r
-<%yrbloglist(admin/default)%>\r
-<h2><%text(_OVERVIEW_YRSETTINGS)%></h2>\r
-<ul>\r
-<li><a href="<%adminurl%>index.php?action=editmembersettings"><%text(_OVERVIEW_EDITSETTINGS)%></a></li>\r
-<li><a href="<%adminurl%>index.php?action=browseownitems"><%text(_OVERVIEW_BROWSEITEMS)%></a></li>\r
-<li><a href="<%adminurl%>index.php?action=browseowncomments"><%text(_OVERVIEW_BROWSECOMM)%></a></li>\r
-</ul>\r
-<%if(superadmin)%>\r
-<h2><%text(_OVERVIEW_MANAGEMENT)%></h2>\r
-<ul>\r
-<li><a href="<%adminurl%>index.php?action=manage"><%text(_OVERVIEW_MANAGE)%></a></li>\r
-</ul>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="pagefoot"><![CDATA[\r
- <%if(loggedin)%>\r
- <%ifnot(adminaction,showlogin)%>\r
- <h2><%text(_LOGOUT)%></h2>\r
- <ul>\r
- <li><a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=logout"><%text(_LOGOUT)%></a></li>\r
- </ul>\r
- <%endif%>\r
- <%endif%>\r
- \r
- <p class="foot">\r
- <a href="<%text(_ADMINPAGEFOOT_OFFICIALURL)%>">Nucleus CMS</a> © 2002- <%date(%Y)%> <%text(_ADMINPAGEFOOT_COPYRIGHT)%>\r
- - <a href="<%text(_ADMINPAGEFOOT_DONATEURL)%>"><%text(_ADMINPAGEFOOT_DONATE)%></a>\r
- </p>\r
- </div>\r
- \r
- <!-- content -->\r
- <div id="quickmenu">\r
- \r
- <%if(loggedin)%>\r
- <%ifnot(adminaction,showlogin)%>\r
- <ul>\r
- <li><a href="<%adminurl%>index.php?action=overview"><%text(_QMENU_HOME)%></a></li>\r
- </ul>\r
- \r
- <h2><%text(_QMENU_ADD)%></h2>\r
- <form method="get" action="<%adminurl%>index.php">\r
- <div>\r
- <input type="hidden" name="action" value="createitem" />\r
- <%qmenuaddselect(admin/default)%>\r
- </div>\r
- </form>\r
- \r
- <h2><%member(yourrealname)%></h2>\r
- <ul>\r
- <li><a href="<%adminurl%>index.php?action=editmembersettings"><%text(_QMENU_USER_SETTINGS)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=browseownitems"><%text(_QMENU_USER_ITEMS)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=browseowncomments"><%text(_QMENU_USER_COMMENTS)%></a></li>\r
- </ul>\r
- \r
- <%if(superadmin)%>\r
- <h2><%text(_QMENU_MANAGE)%></h2>\r
- <ul>\r
- <li><a href="<%adminurl%>index.php?action=actionlog"><%text(_QMENU_MANAGE_LOG)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=settingsedit"><%text(_QMENU_MANAGE_SETTINGS)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=systemoverview"><%text(_QMENU_MANAGE_SYSTEM)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=usermanagement"><%text(_QMENU_MANAGE_MEMBERS)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=createnewlog"><%text(_QMENU_MANAGE_NEWBLOG)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=backupoverview"><%text(_QMENU_MANAGE_BACKUPS)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=pluginlist"><%text(_QMENU_MANAGE_PLUGINS)%></a></li>\r
- </ul>\r
- <h2><%text(_QMENU_LAYOUT)%></h2>\r
- <ul>\r
- <li><a href="<%adminurl%>index.php?action=skinoverview"><%text(_QMENU_LAYOUT_SKINS)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=templateoverview"><%text(_QMENU_LAYOUT_TEMPL)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=skinieoverview"><%text(_QMENU_LAYOUT_IEXPORT)%></a></li>\r
- </ul>\r
- <h2><%text(_SKINABLEADMIN_QMENU_LAYOUT)%></h2>\r
- <ul>\r
- <li><a href="<%adminurl%>index.php?action=adminskinoverview"><%text(_QMENU_LAYOUT_SKINS)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=admintemplateoverview"><%text(_QMENU_LAYOUT_TEMPL)%></a></li>\r
- <li><a href="<%adminurl%>index.php?action=adminskinieoverview"><%text(_QMENU_LAYOUT_IEXPORT)%></a></li>\r
- </ul>\r
- <%endif%>\r
- \r
- <%quickmenu(admin/default)%>\r
- <%endif%>\r
- \r
- <%elseif(adminaction,activate)%>\r
- <h2><%text(_QMENU_ACTIVATE)%></h2>\r
- <%text(_QMENU_ACTIVATE_TEXT)%>\r
- \r
- <%elseif(adminaction,activatesetpwd)%>\r
- <h2><%text(_QMENU_ACTIVATE)%></h2><%text(_QMENU_ACTIVATE_TEXT)%>\r
- \r
- <%else%>\r
- <h2><%text(_QMENU_INTRO)%></h2><%text(_QMENU_INTRO_TEXT)%>\r
- \r
- <%endif%>\r
- \r
- </div>\r
- <!-- content / quickmenu container -->\r
- <div class="clear"></div>\r
- <!-- new -->\r
- </div>\r
- <!-- adminwrapper -->\r
- <!-- new -->\r
- </div>\r
- <!-- new -->\r
- <p style="text-align:right;"><%benchmark%></p>\r
- </body>\r
- </html>\r
-]]></part>\r
-<part name="pagehead"><![CDATA[\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%locale%>" lang="<%locale%>">\r
-<head>\r
-<meta http-equiv="Content-Type" content="text/html; charset=<%charset%>" />\r
-<title><%sitevar(name)%> - Admin</title>\r
-<link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<%skinfile(/styles/admin_contemporary.css)%>" />\r
-<link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<%skinfile(/styles/addedit.css)%>" />\r
-\r
-<script type="text/javascript" src="<%skinfile(/javascripts/edit.js)%>"></script>\r
-<script type="text/javascript" src="<%skinfile(/javascripts/admin.js)%>"></script>\r
-<script type="text/javascript" src="<%skinfile(/javascripts/compatibility.js)%>"></script>\r
-\r
-<meta http-equiv='Pragma' content='no-cache' />\r
-<meta http-equiv='Cache-Control' content='no-cache, must-revalidate' />\r
-<meta http-equiv='Expires' content='-1' />\r
-<%extrahead%>\r
-</head>\r
-<body>\r
-<div id="adminwrapper">\r
-<div class="header">\r
-<h1><%sitevar(name)%></h1>\r
-</div>\r
-<div id="container">\r
-<div id="content">\r
-<div class="loginname">\r
-<%if(loggedin)%>\r
-<%text(_LOGGEDINAS)%> <%member(yourrealname)%> - <a href="<%adminurl%>index.php?action=logout"><%text(_LOGOUT)%></a><br /><a href="<%adminurl%>index.php?action=overview"><%text(_ADMINHOME)%></a> - \r
-<%else%>\r
-<a href="<%adminurl%>index.php?action=showlogin" title="Log in"><%text(_NOTLOGGEDIN)%></a><br />\r
-<%endif%>\r
-<a href="<%sitevar(url)%>"><%text(_YOURSITE)%></a><br />\r
-(\r
-<%if(superadmin)%>\r
-<a href="<%versioncheckurl%>" title="<%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE)%>"><%version%><%codename%></a>\r
-<%else%>\r
-<%version%><%codename%>\r
-<%endif%>\r
-)\r
-</div>\r
-]]></part>\r
-<part name="plugindelete"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-\r
-<p><%text(_CONFIRMTXT_PLUGIN)%> <strong><%editpluginfo(name)%></strong>?</p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<%ticket%>\r
-<input type="hidden" name="action" value="plugindeleteconfirm" />\r
-<input type="hidden" name="plugid" value="<%editpluginfo(id)%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="pluginhelp"><![CDATA[\r
-<p><a href="<%adminurl%>index.php?action=pluginlist">(<%text(_PLUGS_BACK)%>)</a></p>\r
-<h2><%text(_PLUGS_HELP_TITLE)%>: <%helpplugname%></h2>\r
-<%pluginhelp%>\r
-]]></part>\r
-<part name="pluginlist"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
-<h2><%text(_PLUGS_TITLE_MANAGE)%><%helplink(plugins)%></h2>\r
-<h3><%text(_PLUGS_TITLE_INSTALLED)%> <span style="font-size:smaller"><%helplink('getplugins')%><%text(_PLUGS_TITLE_GETPLUGINS)%></a></span></h3>\r
-<%pluginlistlist(admin/default)%>\r
-<h3><%text(_PLUGS_TITLE_UPDATE)%></h3>\r
-<p><%text(_PLUGS_TEXT_UPDATE)%></p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="pluginupdate" />\r
-<%ticket%>\r
-<input type="submit" value="<%text(_PLUGS_BTN_UPDATE)%>" tabindex="20" />\r
-</p>\r
-</form>\r
-<h3><%text(_PLUGS_TITLE_NEW)%></h3>\r
-\r
-<%if(existsnewplugin)%>\r
-<p><%text(_PLUGS_ADD_TEXT)%></p>\r
-<form method='post' action='index.php'>\r
-\r
-<p>\r
-<input type='hidden' name='action' value='pluginadd' />\r
-<%ticket%>\r
-<select name="filename" tabindex="30">\r
-<%newpluginlist%>\r
-</select>\r
-<input type='submit' tabindex="40" value='<%text(_PLUGS_BTN_INSTALL)%>' />\r
-</p>\r
-</form>\r
-<%else%>\r
-<p><%text(_PLUGS_NOCANDIDATES)%></p>\r
-<%endif%>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="pluginoptions"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=pluginlist">(<%text(_PLUGS_BACK)%>)</a></p>\r
-<h2><%sprinttext(_PLUGIN_OPTIONS_TITLE,<|%geteditpluginfo(name)%|>)%></h2>\r
-<%headmessage%>\r
-\r
-<form action="<%adminurl%>index.php" method="post">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="pluginoptionsupdate" />\r
-<input type="hidden" name="plugid" value="<%editpluginfo(id)%>" />\r
-<%ticket%>\r
-</p>\r
-\r
-<%editplugoptionslist(admin/default)%>\r
-\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="settingsedit"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
-<h2><%text(_SETTINGS_TITLE)%></h2>\r
-\r
-<form action="<%adminurl%>index.php" method="post">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="settingsupdate" />\r
-<%ticket%>\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_SETTINGS_SUB_GENERAL)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_SETTINGS_SUB_GENERAL)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td><%text(_SETTINGS_DEFBLOG)%> <%helplink(defaultblog)%></td>\r
-<td><%defblogselect(admin/default)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_BASESKIN)%> <%helplink(baseskin)%></td>\r
-<td><%defskinselect(,admin/default)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_ADMINMAIL)%></td>\r
-<td><input name="AdminEmail" tabindex="10010" size="40" value="<%configsettingsedit(AdminEmail)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_SITENAME)%></td>\r
-<td><input name="SiteName" tabindex="10020" size="40" value="<%configsettingsedit(SiteName)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_SITEURL)%></td>\r
-<td><input name="IndexURL" tabindex="10030" size="40" value="<%configsettingsedit(IndexURL)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_ADMINURL)%></td>\r
-<td><input name="AdminURL" tabindex="10040" size="40" value="<%configsettingsedit(AdminURL)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_PLUGINURL)%> <%helplink(pluginurl)%></td>\r
-<td><input name="PluginURL" tabindex="10045" size="40" value="<%configsettingsedit(PluginURL)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_SKINSURL)%> <%helplink(skinsurl)%></td>\r
-<td><input name="SkinsURL" tabindex="10046" size="40" value="<%configsettingsedit(SkinsURL)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_ACTIONSURL)%> <%helplink(actionurl)%></td>\r
-<td><input name="ActionURL" tabindex="10047" size="40" value="<%configsettingsedit(ActionURL)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_LOCALE)%> <%helplink(locale)%></td>\r
-<td><select name="Locale" tabindex="10050"><%localeselectoptions%></select></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_DISABLESITE)%> <%helplink(disablesite)%></td>\r
-<td>\r
-<%configsettingsyesno(DisableSite, 10060)%><br />\r
-<%text(_SETTINGS_DISABLESITEURL)%> <input name="DisableSiteURL" tabindex="10070" size="40" value="<%configsettingsedit(DisableSiteURL)%>" />\r
-</td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_DIRS)%></td>\r
-<td><%outputspecialdirs(nucleusdir)%><i><%text(_SETTINGS_SEECONFIGPHP)%></i></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_DBLOGIN)%></td>\r
-<td><i><%text(_SETTINGS_SEECONFIGPHP)%></i></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_JSTOOLBAR)%></td>\r
-<td>\r
-<select name="DisableJsTools" tabindex="10075">\r
-<%jstoolbaroptions%>\r
-</select>\r
-</td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_URLMODE)%> <%helplink(urlmode)%></td>\r
-<td><%configsettingsedit(URLMode)%> <%text(_SETTINGS_URLMODE_HELP)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_DEBUGVARS)%> <%helplink(debugvars)%></td>\r
-<td><%configsettingsyesno(DebugVars, 10078)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_DEFAULTLISTSIZE)%> <%helplink(defaultlistsize)%></td>\r
-<td><input name="DefaultListSize" tabindex="10079" size="40" value="<%configsettingsedit(DefaultListSize)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_ADMINSKIN)%></td>\r
-<td><%defadminskinselect(admin/default%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_BKMKLTSKIN)%></td>\r
-<td><%defbookmarkletselect(admin/default%></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<table frame="box" rules="all" summary="<%text(_SETTINGS_MEDIA)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_SETTINGS_MEDIA)%> <%helplink(media)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td><%text(_SETTINGS_MEDIADIR)%></td>\r
-<td>\r
-<%outputspecialdirs(mediadir)%>\r
-<i><%text(_SETTINGS_SEECONFIGPHP)%></i><%mediadirwarning%>\r
-</td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_MEDIAURL)%></td>\r
-<td><input name="MediaURL" tabindex="10090" size="40" value="<%configsettingsedit(MediaURL)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_ALLOWUPLOAD)%></td>\r
-<td><%configsettingsyesno(AllowUpload, 10095)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_ALLOWUPLOADTYPES)%></td>\r
-<td><input name="AllowedTypes" tabindex="10100" size="40" value="<%configsettingsedit(AllowedTypes)%>" />\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_MAXUPLOADSIZE)%></td>\r
-<td><input name="MaxUploadSize" tabindex="10105" size="40" value="<%configsettingsedit(MaxUploadSize)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_MEDIAPREFIX)%></td>\r
-<td><%configsettingsyesno(MediaPrefix, 10110)%></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<table frame="box" rules="all" summary="<%text(_SETTINGS_MEMBERS)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_SETTINGS_MEMBERS)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td><%text(_SETTINGS_CHANGELOGIN)%></td>\r
-<td><%configsettingsyesno(AllowLoginEdit, 10120)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_ALLOWCREATE)%> <%helplink(allowaccountcreation)%>\r
-</td>\r
-<td><%configsettingsyesno(AllowMemberCreate, 10130)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_NEWLOGIN)%> <%helplink(allownewmemberlogin)%><br /><%text(_SETTINGS_NEWLOGIN2)%></td>\r
-<td><%configsettingsyesno(NewMemberCanLogon, 10140)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_MEMBERMSGS)%> <%helplink(messageservice)%></td>\r
-<td><%configsettingsyesno(AllowMemberMail, 10150)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_NONMEMBERMSGS)%> <%helplink(messageservice)%></td>\r
-<td><%configsettingsyesno(NonmemberMail, 10155%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_PROTECTMEMNAMES)%> <%helplink(protectmemnames)%></td>\r
-<td><%configsettingsyesno(ProtectMemNames, 10156)%></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<table frame="box" rules="all" summary="<%text(_SETTINGS_COOKIES_TITLE)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_SETTINGS_COOKIES_TITLE)%> <%helplink(cookies)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td><%text(_SETTINGS_COOKIEPREFIX)%></td>\r
-<td><input name="CookiePrefix" tabindex="10159" size="40" value="<%configsettingsedit(CookiePrefix)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_COOKIEDOMAIN)%></td>\r
-<td><input name="CookieDomain" tabindex="10160" size="40" value="<%configsettingsedit(CookieDomain)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_COOKIEPATH)%></td>\r
-<td><input name="CookiePath" tabindex="10170" size="40" value="<%configsettingsedit(CookiePath)%>" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_COOKIESECURE)%></td>\r
-<td><%configsettingsyesno(CookieSecure, 10180)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_COOKIELIFE)%></td>\r
-<td><%configsettingsedit(SessionCookie)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_SETTINGS_LASTVISIT)%></td>\r
-<td><%configsettingsyesno(LastVisit, 10200)%></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<table frame="box" rules="all" summary="<%text(_SETTINGS_UPDATE)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_SETTINGS_UPDATE)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td><%text(_SETTINGS_UPDATE)%></td>\r
-<td><input type="submit" tabindex="10210" value="<%text(_SETTINGS_UPDATE_BTN)%>" onclick="return checkSubmit();" /></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-</form>\r
-\r
-<h2><%text(_PLUGINS_EXTRA)%></h2>\r
-\r
-<%pluginextras%>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="showlogin"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_LOGIN)%></h2>\r
-<%headmessage%>\r
-<form action="<%adminurl%>index.php" method="post">\r
-<p>\r
-<%text(_LOGIN_NAME)%> <br /><input name="login" tabindex="10" /><br />\r
-<%text(_LOGIN_PASSWORD)%> <br /><input name="password" tabindex="20" type="password" /><br />\r
-<input name="action" value="login" type="hidden" /><br />\r
-<input type="submit" value="<%text(_LOGIN)%>" tabindex="30" /><br />\r
-<small>\r
-<input type="checkbox" value="1" name="shared" tabindex="40" id="shared" /><label for="shared"><%text(_LOGIN_SHARED)%></label><br />\r
-<a href="forgotpassword.php"><%text(_LOGIN_FORGOT)%></a>\r
-</small>\r
-<%passrequestvars%>\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="skindelete"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-<p><%text(_CONFIRMTXT_SKIN)%><b><%editskintype(name)%></b> (<%editskintype(desc)%>)</p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="skindeleteconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="skinid" value="<%editskintype(id)%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="skinedit"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=skinoverview">(<%text(_SKIN_BACK)%>)</a></p>\r
- \r
- <h2><%text(_SKIN_EDITONE_TITLE)%> '<%editskin(name)%>'</h2>\r
- \r
- <h3><%text(_SKIN_PARTS_TITLE)%></h3>\r
- <%text(_SKIN_PARTS_MSG)%>\r
- <%normalskinlist(admin/default)%>\r
- \r
- <h3><%text(_SKIN_PARTS_SPECIAL)%></h3>\r
- <form method="get" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="skinedittype" />\r
- <input type="hidden" name="skinid" value="<%editskin(id)%>" />\r
- <input name="type" tabindex="89" size="20" maxlength="20" />\r
- <input type="submit" tabindex="140" value="<%text(_SKIN_CREATE)%>" onclick="return checkSubmit();" />\r
- </p>\r
- </form>\r
- <%specialskinlist(admin/default)%>\r
- \r
- <h3><%text(_SKIN_GENSETTINGS_TITLE)%></h3>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="skineditgeneral" />\r
- <%ticket%>\r
- <input type="hidden" name="skinid" value="<%editskin(id)%>" />\r
- </p>\r
- <table frame="box" rules="all" summary="<%text(_SKIN_GENSETTINGS_TITLE)%>">\r
- <tr>\r
- <td><%text(_SKIN_NAME)%> <%helplink(shortnames)%></td>\r
- <td><input name="name" tabindex="90" value="<%editskin(name)%>" maxlength="20" size="20" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_DESC)%></td>\r
- <td><input name="desc" tabindex="100" value="<%editskin(desc)%>" maxlength="200" size="50" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_TYPE)%></td>\r
- <td><input name="type" tabindex="110" value="<%editskin(type)%>" maxlength="40" size="20" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_INCLUDE_MODE)%> <%helplink(includemode)%></td>\r
- <td><%editskin(mode)%></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_INCLUDE_PREFIX)%> <%helplink(includeprefix)%></td>\r
- <td><input name="inc_prefix" tabindex="130" value="<%editskin(prefix)%>" maxlength="40" size="20" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_CHANGE)%></td>\r
- <td><input type="submit" tabindex="140" value="<%text(_SKIN_CHANGE_BTN)%>" onclick="return checkSubmit();" /></td>\r
- </tr>\r
- </table>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="skinedittype"><![CDATA[\r
- <%pagehead%>\r
- <p>(<a href="<%adminurl%>index.php?action=skinoverview"><%text(_SKIN_GOBACK)%></a>)</p>\r
- \r
- <h2><%text(_SKIN_EDITPART_TITLE)%> '<%editskintype(name)%>': <%editskintype(skintype)%></h2>\r
- <%headmessage%>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="skinupdate" />\r
- <%ticket%>\r
- <input type="hidden" name="skinid" value="<%editskintype(id)%>" />\r
- <input type="hidden" name="type" value="<%editskintype(skintyperaw)%>" />\r
- <input type="submit" value="<%text(_SKIN_UPDATE_BTN)%>" onclick="return checkSubmit();" />\r
- <input type="reset" value="<%text(_SKIN_RESET_BTN)%>" />\r
- (skin type: <%editskintype(skintype)%>)<%skintypehelp%><br />\r
- <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><%editskintype(content)%></textarea>\r
- <br />\r
- <input type="submit" tabindex="20" value="<%text(_SKIN_UPDATE_BTN)%>" onclick="return checkSubmit();" />\r
- <input type="reset" value="<%text(_SKIN_RESET_BTN)%>" />\r
- (skin type: <%editskintype(skintype)%>)\r
- <br />\r
- <br />\r
- \r
- <%text(_SKIN_ALLOWEDVARS)%>\r
- <%allowedskinactions%><br /><br />\r
- <%text(_SKINEDIT_ALLOWEDBLOGS)%>\r
- <%skineditallowedlist(blog)%>\r
- <%text(_SKINEDIT_ALLOWEDTEMPLATESS)%>\r
- </p>\r
- <%skineditallowedlist(template)%>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="skiniedoimport"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
-<h2><%text(_SKINIE_DONE)%></h2>\r
-\r
-<ul>\r
-<li><strong><%text(_SKINIE_INFO_GENERAL)%></strong> <%importskininfo(info)%></li>\r
-<li><strong><%text(_SKINIE_INFO_IMPORTEDSKINS)%></strong> <%importskininfo(snames)%></li>\r
-<li><strong><%text(_SKINIE_INFO_IMPORTEDTEMPLS)%></strong> <%importskininfo(tnames)%></li>\r
-</ul><%pagefoot%>\r
-]]></part>\r
-<part name="skinieimport"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=skinieoverview">(<%text(_BACK)%>)</a></p>\r
-<h2><%text(_SKINIE_CONFIRM_TITLE)%></h2>\r
-<ul>\r
-<li><strong><%text(_SKINIE_INFO_GENERAL)%></strong> <%importskininfo(info)%></li>\r
-<li><strong><%text(_SKINIE_INFO_SKINS)%></strong> <%importskininfo(snames)%></li>\r
-<li><strong><%text(_SKINIE_INFO_TEMPLATES)%></strong> <%importskininfo(tnames)%></li>\r
-<%if(nameclashes)%>\r
-<li><strong style="color: red;"><%text(_SKINIE_INFO_SKINCLASH)%></strong> <%importskininfo(sclashes)%></li>\r
-<li><strong style="color: red;"><%text(_SKINIE_INFO_TEMPLCLASH)%></strong> <%importskininfo(tclashes)%></li>\r
-<%endif%>\r
-</ul>\r
-\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="skiniedoimport" />\r
-<%ticket%>\r
-<input type="hidden" name="skinfile" value="<%importskininfo(skinfile)%>" />\r
-<input type="hidden" name="mode" value="<%importskininfo(mode)%>" />\r
-<input type="submit" value="<%text(_SKINIE_CONFIRM_IMPORT)%>" />\r
-<%if(nameclashes)%>\r
-<br />\r
-<input type="checkbox" name="overwrite" value="1" id="cb_overwrite" />\r
-<label for="cb_overwrite"><%text(_SKINIE_CONFIRM_OVERWRITE)%></label>\r
-<%endif%>\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="skinieoverview"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- <h2><%text(_SKINIE_TITLE_IMPORT)%></h2>\r
- <p>\r
- <label for="skinie_import_local"><%text(_SKINIE_LOCAL)%></label>\r
- </p>\r
- <%if(skincandidates)%>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input type="hidden" name="action" value="skinieimport" />\r
- <%ticket%>\r
- <input type="hidden" name="mode" value="file" />\r
- <select name="skinfile" id="skinie_import_local">\r
- <%selectlocalskinfiles%>\r
- </select>\r
- <input type="submit" value="<%text(_SKINIE_BTN_IMPORT)%>" />\r
- </p>\r
- </form>\r
- <%else%>\r
- <p>\r
- <%text(_SKINIE_NOCANDIDATES)%>\r
- </p>\r
- <%endif%>\r
- <p><em><%text(_OR)%></em></p>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <%ticket%>\r
- <input type="hidden" name="action" value="skinieimport" />\r
- <input type="hidden" name="mode" value="url" />\r
- <label for="skinie_import_url"><%text(_SKINIE_FROMURL)%></label>\r
- <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />\r
- <input type="submit" value="<%text(_SKINIE_BTN_IMPORT)%>" />\r
- </p>\r
- </form>\r
- \r
- <h2><%text(_SKINIE_TITLE_EXPORT)%></h2>\r
- <form method="post" action="<%adminurl%>index.php">\r
- \r
- <p><%text(_SKINIE_EXPORT_INTRO)%></p>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_SKINS)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_SKINIE_EXPORT_SKINS)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%skinielist(skin,admin/default)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_TEMPLATES)%>">\r
- <thead>\r
- <th colspan="2"><%text(_SKINIE_EXPORT_TEMPLATES)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%skinielist(template,admin/default)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_SKINS)%>">\r
- <thead>\r
- <th colspan="2"><%text(_SKINIE_EXPORT_EXTRA)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <tr>\r
- <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- \r
- <p>\r
- <input type="hidden" name="action" value="skinieexport" />\r
- <%ticket%>\r
- <input type="submit" value="<%text(_SKINIE_BTN_EXPORT)%>" />\r
- </p>\r
- \r
- </form>\r
- \r
- <%pagefoot%>\r
-]]></part>\r
-<part name="skinoverview"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- \r
- <h2><%text(_SKIN_EDIT_TITLE)%></h2>\r
- \r
- <h3><%text(_SKIN_AVAILABLE_TITLE)%></h3>\r
- <%skinoverview(admin/default)%>\r
- \r
- <h3><%text(_SKIN_NEW_TITLE)%></h3>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input name="action" value="skinnew" type="hidden" />\r
- <%ticket%>\r
- </p>\r
- \r
- <table frame="box" rules="all" sumamry="<%text(_SKIN_NEW_TITLE)%>">\r
- <tr>\r
- <td><%text(_SKIN_NAME)%> <%helplink(shortnames)%></td>\r
- <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_DESC)%></td>\r
- <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_SKIN_CREATE)%></td>\r
- <td><input type="submit" tabindex="10030" value="<%text(_SKIN_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>\r
- </tr>\r
- </table>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="skinremovetype"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-<p>\r
-<%text(_CONFIRMTXT_SKIN_PARTS_SPECIAL)%><br />\r
-<b><%editskintype(skintype)%> (<%editskintype(name)%>)</b> (<%editskintype(desc)%>)\r
-</p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="skinremovetypeconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="skinid" value="<%editskintype(id)%>" />\r
-<input type="hidden" name="type" value="<%editskintype(skintype)%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="systemoverview"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_ADMIN_SYSTEMOVERVIEW_HEADING)%></h2>\r
-<%if(superadmin)%>\r
-<h3><%text(_ADMIN_SYSTEMOVERVIEW_PHPANDMYSQL)%></h3>\r
-\r
-<table frame="box" rules="all" summary="<%text(_ADMIN_SYSTEMOVERVIEW_PHPANDMYSQL)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_VERSIONS)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td width="50%"><%text(_ADMIN_SYSTEMOVERVIEW_PHPVERSION)%></td>\r
-<td><%systemsettings(phpversion)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_ADMIN_SYSTEMOVERVIEW_MYSQLVERSION)%></td>\r
-<td><%systemsettings(sqlserverinfo)%> (<%systemsettings(sqlclientinfo)%>)</td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<table frame="box" rules="all" summary="Important PHP settings">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_SETTINGS)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td width="50%">magic_quotes_gpc</td>\r
-<td><%systemsettings(magicquotesgpc)%></td>\r
-</tr>\r
-<tr>\r
-<td width="50%">magic_quotes_runtime</td>\r
-<td><%systemsettings(magicquotesruntime)%></td>\r
-</tr>\r
-<tr>\r
-<td width="50%">register_globals</td>\r
-<td><%systemsettings(registerglobals)%></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<table summary="Information about GD library">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_GDLIBRALY)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<%systemsettings(gdinfo)%>\r
-</tbody>\r
-</table>\r
-\r
-<table frame="box" rules="all" summary="special modules are loaded">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_MODULES)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td width="50%">mod_rewrite</td>\r
-<td><%systemsettings(modrewrite)%></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<h3><%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSSYSTEM)%></h3>\r
-<table frame="box" rules="all" summary="<%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSSYSTEM)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2">Nucleus CMS</th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td width="50%"><%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSVERSION)%></td>\r
-<td><%systemsettings(nucleusversion)%></td>\r
-</tr>\r
-<tr>\r
-<td width="50%"><%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSPATCHLEVEL)%></td>\r
-<td><%systemsettings(nucleuspatchlevel)%></td>\r
-</tr>\r
-<tr>\r
-<td colspan="2"><%newestcompare%></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<table frame="box" rules="all" summary="Important settings of the installation">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSSETTINGS)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td width="50%">$CONF['Self']</td>\r
-<td><%systemsettings(confself)%></td>\r
-</tr>\r
-<tr>\r
-<td width="50%">$CONF['ItemURL']</td>\r
-<td><%systemsettings(confitemurl)%></td>\r
-</tr>\r
-<tr>\r
-<td width="50%">$CONF['alertOnHeadersSent']</td>\r
-<td><%systemsettings(alertonheaderssent)%></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-\r
-<h3><%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK)%></h3>\r
-<!-- Link to the online version test at the Nucleus CMS website -->\r
-<p>\r
-<%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TXT)%>\r
-<a href="<%systemsettings(versioncheckurl)%>" title="<%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE)%>">\r
-Nucleus CMS <%systemsettings(nucleusversion)%> <%systemsettings(nucleuscodename)%></a>\r
-</p>\r
-\r
-<%else%>\r
-<p>\r
-<%text(_ADMIN_SYSTEMOVERVIEW_NOT_ADMIN)%>\r
-</p>\r
-<%endif%>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="teamdelete"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-<p>\r
-<%text(_CONFIRMTXT_TEAM1)%>\r
-<b><%editmember(displayname)%></b>\r
-<%text(_CONFIRMTXT_TEAM2)%>\r
-<b><%blogsetting(name)%></b>\r
-</p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="teamdeleteconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="memberid" value="<%editmember(id)%>" />\r
-<input type="hidden" name="blogid" value="<%requestblogid%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="templatedelete"><![CDATA[\r
-<%pagehead%>\r
-<h2><%text(_DELETE_CONFIRM)%></h2>\r
-<p><%text(_CONFIRMTXT_TEMPLATE)%><b><%edittemplateinfo(name)%></b> (<%edittemplateinfo(desc)%>)</p>\r
-<form method="post" action="<%adminurl%>index.php">\r
-<p>\r
-<input type="hidden" name="action" value="templatedeleteconfirm" />\r
-<%ticket%>\r
-<input type="hidden" name="templateid" value="<%edittemplateinfo(id)%>" />\r
-<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />\r
-</p>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="templateedit"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=templateoverview">(<%text(_TEMPLATE_BACK)%>)</a></p>\r
- \r
- <h2><%text(_TEMPLATE_EDIT_TITLE)%> '<%edittemplateinfo(name)%>'</h2>\r
- <%headmessage%>\r
- \r
- <p><%text(_TEMPLATE_EDIT_MSG)%></p>\r
- \r
- <form method="post" action="<%adminurl%>index.php">\r
- \r
- <p>\r
- <input type="hidden" name="action" value="templateupdate" />\r
- <%ticket%>\r
- <input type="hidden" name="templateid" value="<%edittemplateinfo(id)%>" />\r
- </p>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_SETTINGS)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_SETTINGS)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <tr>\r
- <td><%text(_TEMPLATE_NAME)%> <%helplink(shortnames)%></td>\r
- <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<%edittemplateinfo(name)%>" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_TEMPLATE_DESC)%></td>\r
- <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<%edittemplateinfo(desc)%>" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_TEMPLATE_UPDATE)%></td>\r
- <td>\r
- <input type="submit" tabindex="6" value="<%text(_TEMPLATE_UPDATE_BTN)%>" onclick="return checkSubmit();" />\r
- <input type="reset" tabindex="7" value="<%text(_TEMPLATE_RESET_BTN)%>" />\r
- </td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_ITEMS)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_ITEMS)%> <%helplink(templateitems)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_ITEMHEADER,ITEM_HEADER,,8)%>\r
- <%edittemplateinfo(row,_TEMPLATE_ITEMBODY,ITEM,,9,1)%>\r
- <%edittemplateinfo(row,_TEMPLATE_ITEMFOOTER,ITEM_FOOTER,,10)%>\r
- <%edittemplateinfo(row,_TEMPLATE_MORELINK,MORELINK,morelink, 20)%>\r
- <%edittemplateinfo(row,_TEMPLATE_EDITLINK, EDITLINK, editlink, 25)%>\r
- <%edittemplateinfo(row,_TEMPLATE_NEW, NEW, new, 30)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_COMMENTS_ANY)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_COMMENTS_ANY)%> <%helplink(templatecomments)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_CHEADER, COMMENTS_HEADER, commentheaders, 40)%>\r
- <%edittemplateinfo(row,_TEMPLATE_CBODY, COMMENTS_BODY, commentbody, 50, 1)%>\r
- <%edittemplateinfo(row,_TEMPLATE_CFOOTER, COMMENTS_FOOTER, commentheaders, 60)%>\r
- <%edittemplateinfo(row,_TEMPLATE_CONE, COMMENTS_ONE, commentwords, 70)%>\r
- <%edittemplateinfo(row,_TEMPLATE_CMANY, COMMENTS_MANY, commentwords, 80)%>\r
- <%edittemplateinfo(row,_TEMPLATE_CMORE, COMMENTS_CONTINUED, commentcontinued, 90)%>\r
- <%edittemplateinfo(row,_TEMPLATE_CMEXTRA, COMMENTS_AUTH, memberextra, 100)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_COMMENTS_NONE)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_COMMENTS_NONE)%> <%helplink(templatecomments)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_CNONE, COMMENTS_NONE, , 110)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_COMMENTS_TOOMUCH)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_COMMENTS_TOOMUCH)%> <%helplink(templatecomments)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_CTOOMUCH, COMMENTS_TOOMUCH, , 120)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_ARCHIVELIST)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_ARCHIVELIST)%> <%helplink(templatearchivelists)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_AHEADER, ARCHIVELIST_HEADER, , 130)%>\r
- <%edittemplateinfo(row,_TEMPLATE_AITEM, ARCHIVELIST_LISTITEM, , 140)%>\r
- <%edittemplateinfo(row,_TEMPLATE_AFOOTER, ARCHIVELIST_FOOTER, , 150)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_BLOGLIST)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_BLOGLIST)%> <%helplink(templatebloglists)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_BLOGHEADER, BLOGLIST_HEADER, , 160)%>\r
- <%edittemplateinfo(row,_TEMPLATE_BLOGITEM, BLOGLIST_LISTITEM, , 170)%>\r
- <%edittemplateinfo(row,_TEMPLATE_BLOGFOOTER, BLOGLIST_FOOTER, , 180)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_CATEGORYLIST)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_CATEGORYLIST)%> <%helplink(templatecategorylists)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_CATHEADER, CATLIST_HEADER, , 190)%>\r
- <%edittemplateinfo(row,_TEMPLATE_CATITEM, CATLIST_LISTITEM, , 200)%>\r
- <%edittemplateinfo(row,_TEMPLATE_CATFOOTER, CATLIST_FOOTER, , 210)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_DATETIME)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_DATETIME)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_DHEADER, DATE_HEADER, dateheads, 220)%>\r
- <%edittemplateinfo(row,_TEMPLATE_DFOOTER, DATE_FOOTER, dateheads, 230)%>\r
- <%edittemplateinfo(row,_TEMPLATE_DFORMAT, FORMAT_DATE, datetime, 240)%>\r
- <%edittemplateinfo(row,_TEMPLATE_TFORMAT, FORMAT_TIME, datetime, 250)%>\r
- <%edittemplateinfo(row,_TEMPLATE_LOCALE, LOCALE, locale, 260)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_IMAGE)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_IMAGE)%> <%helplink(templatepopups)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_PCODE, POPUP_CODE, , 270)%>\r
- <%edittemplateinfo(row,_TEMPLATE_ICODE, IMAGE_CODE, , 280)%>\r
- <%edittemplateinfo(row,_TEMPLATE_MCODE, MEDIA_CODE, , 290)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_SEARCH)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_SEARCH)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(row,_TEMPLATE_SHIGHLIGHT, SEARCH_HIGHLIGHT, highlight,300)%>\r
- <%edittemplateinfo(row,_TEMPLATE_SNOTFOUND, SEARCH_NOTHINGFOUND, nothingfound,310)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_PLUGIN_FIELDS)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_PLUGIN_FIELDS)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <%edittemplateinfo(extratemplate,admin/default)%>\r
- </tbody>\r
- </table>\r
- \r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_UPDATE)%>">\r
- <thead>\r
- <tr>\r
- <th colspan="2"><%text(_TEMPLATE_UPDATE)%></th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- <tr>\r
- <td><%text(_TEMPLATE_UPDATE)%></td>\r
- <td>\r
- <input type="submit" tabindex="800" value="<%text(_TEMPLATE_UPDATE_BTN)%>" onclick="return checkSubmit();" />\r
- <input type="reset" tabindex="810" value="<%text(_TEMPLATE_RESET_BTN)%>" />\r
- </td>\r
- </tr>\r
- </tbody>\r
- </table>\r
- \r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="templateoverview"><![CDATA[\r
- <%pagehead%>\r
- <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
- <h2><%text(_TEMPLATE_TITLE)%></h2>\r
- \r
- <h3><%text(_TEMPLATE_AVAILABLE_TITLE)%></h3>\r
- <%templateoverview(admin/default)%>\r
- \r
- <h3><%text(_TEMPLATE_NEW_TITLE)%></h3>\r
- <form method="post" action="<%adminurl%>index.php">\r
- <p>\r
- <input name="action" value="templatenew" type="hidden" />\r
- <%ticket%>\r
- </p>\r
- <table frame="box" rules="all" summary="<%text(_TEMPLATE_NEW_TITLE)%>">\r
- <tr>\r
- <td><%text(_TEMPLATE_NAME)%> <%helplink(shortnames)%></td>\r
- <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_TEMPLATE_DESC)%></td>\r
- <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>\r
- </tr>\r
- <tr>\r
- <td><%text(_TEMPLATE_CREATE)%></td>\r
- <td><input type="submit" tabindex="10030" value="<%text(_TEMPLATE_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>\r
- </tr>\r
- </table>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="usermanagement"><![CDATA[\r
-<%pagehead%>\r
-<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>\r
-<h2><%text(_MEMBERS_TITLE)%></h2>\r
-<h3><%text(_MEMBERS_CURRENT)%></h3>\r
-<%editmemberlist(admin/default)%>\r
-<h3><%text(_MEMBERS_NEW)%></h3>\r
-\r
-<form method="post" action="<%adminurl%>index.php" name="memberedit">\r
-\r
-<p>\r
-<input type="hidden" name="action" value="memberadd" />\r
-<%ticket%>\r
-</p>\r
-\r
-<table frame="box" rules="all" summary="<%text(_MEMBERS_NEW)%>">\r
-<thead>\r
-<tr>\r
-<th colspan="2"><%text(_MEMBERS_NEW)%></th>\r
-</tr>\r
-</thead>\r
-<tbody>\r
-<tr>\r
-<td>\r
-<%text(_MEMBERS_DISPLAY)%> <%helplink(shortnames)%>\r
-<br /><small><%text(_MEMBERS_DISPLAY_INFO)%></small>\r
-</td>\r
-<td><input tabindex="10010" name="name" size="32" maxlength="32" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_REALNAME)%></td>\r
-<td><input name="realname" tabindex="10020" size="40" maxlength="60" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_PWD)%></td>\r
-<td><input name="password" tabindex="10030" size="16" maxlength="40" type="password" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_REPPWD)%></td>\r
-<td><input name="repeatpassword" tabindex="10035" size="16" maxlength="40" type="password" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_EMAIL)%></td>\r
-<td><input name="email" tabindex="10040" size="40" maxlength="60" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_URL)%></td>\r
-<td><input name="url" tabindex="10050" size="40" maxlength="100" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_SUPERADMIN)%> <%helplink(superadmin)%></td>\r
-<td><%inputyesno(admin,1,10060)%> </td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_CANLOGIN)%> <%helplink(canlogin)%></td>\r
-<td><%inputyesno(canlogin,1,10070)%></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_NOTES)%></td>\r
-<td><input name="notes" maxlength="100" size="40" tabindex="10080" /></td>\r
-</tr>\r
-<tr>\r
-<td><%text(_MEMBERS_NEW)%></td>\r
-<td><input type="submit" value="<%text(_MEMBERS_NEW_BTN)%>" tabindex="10090" onclick="return checkSubmit();" /></td>\r
-</tr>\r
-</tbody>\r
-</table>\r
-</form>\r
-<%pagefoot%>\r
-]]></part>\r
-<part name="createaccountinput"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_CREATE_ACCOUNT0)%></h2>\r
- <%headmessage%>\r
- <form method="post" action="<%sitevar(url)%>createaccount.php">\r
- <dl>\r
- <dt><label for="name"><%text(_CREATE_ACCOUNT_LOGIN_NAME)%></label></dt>\r
- <dd>\r
- <input id="name" name="name" value="<%contents(name)%>" size="32" maxlength="32" />\r
- <span style="\small"><%text(_CREATE_ACCOUNT_LOGIN_NAME_VALID)%></span>\r
- </dd>\r
- <dt><label for="realname"><%text(_CREATE_ACCOUNT_REAL_NAME)%></label></dt>\r
- <dd><input id="realname" name="realname" value="<%contents(realname)%>" size="40" /></dd>\r
- <dt><label for="email"><%text(_CREATE_ACCOUNT_EMAIL)%></label></dt>\r
- <dd>\r
- <input id="email"name="email" value="<%contents(email)%>" size="40" />\r
- <span style="\small"><%text(_CREATE_ACCOUNT_EMAIL2)%></span>\r
- </dd>\r
- <dt><label for="url"><%text(_CREATE_ACCOUNT_URL)%></label></dt>\r
- <dd><input id="url"name="url" value="<%contents(url)%>" size="60" /></dd>\r
- </dl>\r
- <%pluginextras(createaccount)%>\r
- <%eventformextra(membermailform-notloggedin)%>\r
- <p>\r
- <input type="hidden" name="showform" value="1" />\r
- <button type="submit" name="action" value="createaccount"><%text(_CREATE_ACCOUNT_SUBMIT)%></button>\r
- </p>\r
- </form>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="createaccountsuccess"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_CREATE_ACCOUNT)%></h2>\r
- <%headmessage%>\r
- <p><%text(_MSG_ACTIVATION_SENT)%></p>\r
- <p><%text(_BACK)%> <a href="<%sitevar(IndexURL)%>" title="<%sitevar(SiteName)%>"><%sitevar(SiteName)%></a></p>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="createaccountdisable"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_CREATE_ACCOUNT0)%></h2>\r
- <p><%text(_CREATE_ACCOUNT1)%></p>\r
- <p><%text(_CREATE_ACCOUNT2)%></p>\r
- <p><%text(_BACK)%> <a href="<%sitevar(IndexURL)%>" title="<%sitevar(SiteName)%>"><%sitevar(SiteName)%></a></p>\r
- <%pagefoot%>\r
-]]></part>\r
-<part name="forgotpassword"><![CDATA[\r
- <%pagehead%>\r
- <h2><%text(_FORGOTPASSWORD_TITLE)%></h2>\r
- <p><%text(_FORGOTPASSWORD_MSG)%></p>\r
- <form method="post" action="<%actionurl%>">\r
- <dl>\r
- <dt><label for="nucleus_pf_username"><%text(_CREATE_ACCOUNT_LOGIN_NAME)%></label></dt>\r
- <dd><input type="text" name="name" id="nucleus_pf_username" /></dd>\r
- <dt><label for="nucleus_pf_email"><%text(_CREATE_ACCOUNT_EMAIL)%></label></dt>\r
- <dd><input type="text" name="email" id="nucleus_pf_email" /></dd>\r
- </dl>\r
- <p>\r
- <input type="hidden" name="action" value="forgotpassword" />\r
- <input type="submit" value="<%text(_FORGOTPASSWORD_SUBMIT)%>" class="transparent" />\r
- </p>\r
- </form>\r
- <p><%text(_FORGOTPASSWORD_CONTACT)%></p>\r
- <%pagefoot%>\r
-]]></part>\r
-</skin>\r
-<template name="admin/default">\r
-<description><![CDATA[\r
- ADMIN Area Default template\r
-]]></description>\r
-\r
-<part name="PLUGIN_QUICKMENU_HEAD"><![CDATA[\r
- <h2><%text(_QMENU_PLUGINS)%></h2>\r
- <ul>\r
-]]></part>\r
-<part name="PLUGIN_QUICKMENU_BODY"><![CDATA[\r
- <li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>\r
-]]></part>\r
-<part name="PLUGIN_QUICKMENU_FOOT"><![CDATA[\r
- </ul>\r
-]]></part>\r
-\r
-<part name="SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD"><![CDATA[\r
- <th><%coltime%></th>\r
- <th><%colmesg%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY"><![CDATA[\r
- <td><%timestamp%></td>\r
- <td><%message%></td>\r
-]]></part>\r
-\r
-<part name="SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD"><![CDATA[\r
- <th><%iprange%></th>\r
- <th><%reason%></th>\r
- <th><%colact%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY"><![CDATA[\r
- <td><%iprange%></td>\r
- <td><%reason%></td>\r
- <td><a href="<%adminurl%>index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>"><%delbtn%></a></td>\r
-]]></part>\r
-\r
-<part name="SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD"><![CDATA[\r
- <th><%colname%></th>\r
- <th><%coldesc%></th>\r
- <th colspan="3"><%colact%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY"><![CDATA[\r
- <td><%skinname%><br /><br />\r
- <%skintypelabel%> <%skintype%><br />\r
- <%incmodelabel%> <%incmode%><br />\r
- <%incpreflabel%> <%incpref%><br />\r
- <%skinthumb%>\r
- <%readme%></td>\r
- <td class="availableSkinTypes"><%skindesc%><%skinparts%></td>\r
- <td style="white-space:nowrap">\r
- <a href="<%editurl%>" tabindex="<%tabindex%>">\r
- <%editbtn%>\r
- </a>\r
- </td>\r
- <td style="white-space:nowrap">\r
- <a href="<%cloneurl%>" tabindex="<%tabindex%>">\r
- <%clonebtn%>\r
- </a>\r
- </td>\r
- <td style="white-space:nowrap">\r
- <a href="<%deleteurl%>" tabindex="<%tabindex%>">\r
- <%delbtn%>\r
- </a>\r
- </td>\r
-]]></part>\r
-\r
-<part name="SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM"><![CDATA[\r
- <td>\r
- <a href="<%adminurl%>index.php?action=blogsettings&blogid=<%blogid%>" title="<%ttsettingtext%>"><%settingtext%></a>\r
- </td>\r
- <td>\r
- <a href="<%adminurl%>index.php?action=banlist&blogid=<%blogid%>" title="<%ttbanstext%>"><%banstext%></a>\r
- </td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM"><![CDATA[\r
- <td>\r
- <a href="<%adminurl%>index.php?action=deleteblog&blogid=<%blogid%>" title="<%ttdeletetext%>"><%deletetext%></a>\r
- </td>\r
-]]></part>\r
-\r
-<part name="SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD"><![CDATA[\r
- <th><%colshortname%></th>\r
- <th><%colblogname%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY"><![CDATA[\r
- <td><%bshortname%></td>\r
- <td><%blogname%></td>\r
-]]></part>\r
-\r
-<part name="SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD"><![CDATA[\r
- <th><%colname%></th>\r
- <th><%coldesc%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY"><![CDATA[\r
- <td><%name%></td>\r
- <td><%desc%></td>\r
-]]></part>\r
-\r
-<part name="SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD"><![CDATA[\r
- <th><%colname%></th>\r
- <th><%coldesc%></th>\r
- <th colspan="2"><%colact%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY"><![CDATA[\r
- <td><input type="checkbox" id="batch<%batchid%>" name="batch[<%batchid%>]" value="<%catid%>" />\r
- <label for="batch<%batchid%>"><%catname%></label>\r
- </td>\r
- <td><%catdesc%></td>\r
- <td><a href="<%adminurl%>index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>" tabindex="<%tabindex%>">\r
- <%delbtn%></a></td>\r
- <td><a href="<%adminurl%>index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>" tabindex="<%tabindex%>">\r
- <%editbtn%></a></td>\r
-]]></part>\r
-\r
-<part name="SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD"><![CDATA[\r
- <th><%colname%></th>\r
- <th><%coldesc%></th>\r
- <th colspan="3"><%colact%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY"><![CDATA[\r
- <td><%templatename%></td>\r
- <td><%templatedesc%></td>\r
- <td style="white-space:nowrap">\r
- <a href="<%editurl%>" tabindex="<%tabindex%>"><%editbtn%>\r
- </a></td>\r
- <td style="white-space:nowrap">\r
- <a href="<%cloneurl%>" tabindex="<%tabindex%>"><%clonebtn%>\r
- </a></td>\r
- <td style="white-space:nowrap">\r
- <a href="<%deleteurl%>" tabindex="<%tabindex%>"><%delbtn%>\r
- </a></td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD"><![CDATA[\r
- <th><%colblog%></th>\r
- <th><%coldesc%></th>\r
- <th colspan="2"><%colact%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY"><![CDATA[\r
- <td><%bshortname%></td>\r
- <td><%ititle%></td>\r
- <td><a href="<%adminurl%>index.php?action=itemedit&itemid=<%itemid%>"><%editbtn%></a></td>\r
- <td><a href="<%adminurl%>index.php?action=itemdelete&itemid=<%itemid%>"><%delbtn%></a></td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN"><![CDATA[\r
- <td style="white-space:nowrap"><a href="<%adminurl%>index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>" title="<%banhost%>"><%banbtn%></a></td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD"><![CDATA[\r
- <th><%blognames%></th><th colspan="8"><%actionshead%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY"><![CDATA[\r
- <td title="blogid:<%blogid%> shortname:<%shortname%>">\r
- <a href="<%blogurl%>"><img src="<%skinfile(/images/globe.gif)%>" width="13" height="13" alt="<%iconalt%>" /></a> <%blogname%>\r
- </td>\r
- <td>\r
- <a href="<%adminurl%>index.php?action=createitem&blogid=<%blogid%>" title="<%ttaddtext%>"><%addtext%></a>\r
- </td>\r
- <td>\r
- <a href="<%adminurl%>index.php?action=itemlist&blogid=<%blogid%>" title="<%ttedittext%>"><%edittext%></a>\r
- </td>\r
- <td>\r
- <a href="<%adminurl%>index.php?action=blogcommentlist&blogid=<%blogid%>" title="<%ttcommenttext%>"><%commenttext%></a>\r
- </td>\r
- <td>\r
- <a href="<%adminurl%>index.php?action=bookmarklet&blogid=<%blogid%>" title="<%ttbmlettext%>"><%bmlettext%></a>\r
- </td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD"><![CDATA[\r
- <th><%colinfo%></th>\r
- <th><%colcontent%></th>\r
- <th colspan="3"><%colaction%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY"><![CDATA[\r
- <td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\r
- <td><input type="checkbox" id="batch<%batchid%>" name="batch[<%batchid%>]" value="<%commentid%>" />\r
- <label for="batch<%batchid%>"><%commentbody%></label></td>\r
- <td style="white-space:nowrap">\r
- <a href="<%adminurl%>index.php?action=commentedit&commentid=<%commentid%>"><%editbtn%></a></td>\r
- <td style="white-space:nowrap">\r
- <a href="<%adminurl%>index.php?action=commentdelete&commentid=<%commentid%>"><%delbtn%></a></td>\r
- <%addbanlist%>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD"><![CDATA[\r
-<input type="password" size="40" maxlength="128" name="<%varname%>" value="<%value%>" />\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP"><![CDATA[\r
-<select name="<%varname%>">\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO"><![CDATA[\r
-<option value="<%value%>"<%selected%>><%optname%></option>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC"><![CDATA[\r
-</select>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA"><![CDATA[\r
-<textarea class="pluginoption" cols="30" rows="5" name="<%varname%>"<%readonly%>><%value%></textarea>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT"><![CDATA[\r
-<input type="text" size="40" maxlength="128" name="<%varname%>" value="<%value%>"<%datatype%><%readonly%> />\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT"><![CDATA[\r
-<%extra%></td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT"><![CDATA[\r
-\r
-<tr>\r
-<td><%savetext%></td>\r
-<td><input type="submit" value="<%savetext%>" /></td>\r
-</tr>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD"><![CDATA[\r
- <th><%colinfo%></th>\r
- <th><%colcontent%></th>\r
- <th style="white-space:nowrap"><%colaction%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY"><![CDATA[\r
- <td<%cssclass%>>\r
- <%bshortlabel%> <%bshortnameval%><br />\r
- <%categorylabel%> <%categorynameval%><br />\r
- <%authorlabel%> <%authornameval%><br />\r
- <%itemdatelabel%> <%itemdateval%><br />\r
- <%itemtimelabel%> <%itemtimeval%>\r
- </td>\r
- <td<%cssclass%>>\r
- <input type="checkbox" id="batch<%batchid%>" name="batch[<%batchid%>]" value="<%itemid%>" />\r
- <label for="batch<%batchid%>"><b><%itemtitle%></b></label><br />\r
- <%itembody%></td>\r
- <td style="white-space:nowrap"<%cssclass%>>\r
- <a href="<%adminurl%>index.php?action=itemedit&itemid=<%itemid%>"><%editbtn%></a><br />\r
- <a href="<%adminurl%>index.php?action=itemmove&itemid=<%itemid%>"><%movebtn%></a><br />\r
- <a href="<%adminurl%>index.php?action=itemdelete&itemid=<%itemid%>"><%delbtn%></a><br />\r
- <%camount%>\r
- </td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD"><![CDATA[\r
- <th><%colinfo%></th>\r
- <th><%colvalue%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND"><![CDATA[\r
- <br /><br /><%deplistlbl%><br /><%dependlist%>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ"><![CDATA[\r
- <br /><br /><%deprlstlbl%><br /><%depreqlist%>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE"><![CDATA[\r
- <td colspan="2"><%noplugalert%></td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN"><![CDATA[\r
- <td>\r
- <a href="<%actionupurl%>" tabindex="<%tabindex%>"><%actionuptxt%></a><br />\r
- <a href="<%actiondownurl%>" tabindex="<%tabindex%>"><%actiondowntxt%></a><br />\r
- <a href="<%actuninsturl%>" tabindex="<%tabindex%>"><%actuninsttxt%></a><br />\r
- <%plugadminurl%>\r
- <%plughelpurl%>\r
- <%plugoptsetting%>\r
- </td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY"><![CDATA[\r
- <td><%description%></td>\r
- <td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO"><![CDATA[\r
- <input type="radio" name="<%name%>" value="<%yesval%>"<%yescheckedval%> id="<%yesid%>" />\r
- <label for="<%yesid%>"><%yesvaltext%></label>\r
- <input type="radio" name="<%name%>" value="<%noval%>"<%nocheckedval%> id="<%noid%>"<%disabled%> />\r
- <label for="<%noid%>"><%novaltext%></label>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL"><![CDATA[\r
- <a href="<%actoptionurl%>" tabindex="<%tabindex%>"><%actoptiontxt%></a><br />\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN"><![CDATA[\r
- <a href="<%actadminurl%>" tabindex="<%tabindex%>"><%actadmintxt%></a><br />\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP"><![CDATA[\r
- <a href="<%acthelpurl%>" tabindex="<%tabindex%>"><%acthelptxt%></a><br />\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL"><![CDATA[\r
- <a href="<%plugurl%>" tabindex="<%tabindex%>"><%plugsite%></a>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD"><![CDATA[\r
- <th><%colinfo%></th>\r
- <th><%coldesc%></th>\r
- <th style=\"white-space:nowrap\"><%colactions%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST"><![CDATA[\r
- <br /><br /><%evntlstlbl%><br /><%eventlist%>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE"><![CDATA[\r
- <br /><br /><strong><%updatealert%></strong>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY"><![CDATA[\r
- <td>\r
- <strong><%plugname%></strong><br />\r
- <%autherlabel%> <%plugauther%><br />\r
- <%versionlabel%> <%plugversion%><br />\r
- <%pluggeturl%><br />\r
- </td>\r
- <td>\r
- <%desclabel%><br /><%plugdesc%>\r
- <%eventlist%>\r
- <%needupdate%>\r
- <%dependlist%>\r
- <%depreqlist%>\r
- </td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD"><![CDATA[\r
- <th><%colmembername%></th>\r
- <th><%colmemberrname%></th>\r
- <th><%colteamadmin%><%helplink(teamadmin)%></th>\r
- <th colspan="2"><%colactions%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY"><![CDATA[\r
- <td>\r
- <input type="checkbox" id="batch<%id%>" name="batch[<%id%>]" value="<%memberid%>" />\r
- <label for="batch<%id%>">\r
- <a href="mailto:<%mailaddress%>" tabindex="<%tabindex%>"><%name%></a>\r
- </label>\r
- </td>\r
- <td><%realname%></td>\r
- <td><%admin%></td>\r
- <td><a href="<%adminurl%>index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>" tabindex="<%tabindex%>"><%deletebtn%></a></td>\r
- <td><a href="<%chadminurl%>" tabindex="<%tabindex%>"><%chadminbtn%></a></td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY"><![CDATA[\r
- <td>\r
- <input type="checkbox" id="batch<%id%>" name="batch[<%id%>]" value="<%memberid%>" />\r
- <label for="batch<%id%>">\r
- <a href="mailto:<%mailaddress%>" tabindex="<%tabindex%>"><%name%></a>\r
- </label>\r
- </td>\r
- <td><%realname%></td>\r
- <td><a href="<%url%>" tabindex="<%tabindex%>"><%url%></a></td>\r
- <td><%admin%></td>\r
- <td><%login%></td>\r
- <td><a href="<%adminurl%>index.php?action=memberedit&memberid=<%memberid%>" tabindex="<%tabindex%>"><%editbtn%></a></td>\r
- <td><a href="<%adminurl%>index.php?action=memberdelete&memberid=<%memberid%>" tabindex="<%tabindex%>"><%deletebtn%></a></td>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_FOOT"><![CDATA[\r
- <%typefoot%>\r
- </tbody>\r
- </table>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD"><![CDATA[\r
- <th><%colmembername%></th>\r
- <th><%colmemberrname%></th>\r
- <th><%colmemberurl%></th>\r
- <th><%colmemberadmin%><%helplink(superadmin)%></th>\r
- <th><%colmemberlogin%><%helplink(canlogin)%></th>\r
- <th colspan="2"><%colactions%></th>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_SELECT_FOOT"><![CDATA[\r
- </select>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_HEAD"><![CDATA[\r
- <table frame="box" rules="all" summary="<%summary%>">\r
- <thead>\r
- <tr>\r
- <%typehead%>\r
- </tr>\r
- </thead>\r
- <tbody>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_TABLE_BODY"><![CDATA[\r
- <tr onmouseover="focusRow(this);" onmouseout="blurRow(this);">\r
- <%typebody%>\r
- </tr>\r
-]]></part>\r
-<part name="SKINIE_EXPORT_LIST"><![CDATA[\r
- <tr>\r
- <td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>\r
- <td><%expdesc%></td>\r
- </tr>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_SELECT_HEAD"><![CDATA[\r
- <select name="<%name%>" tabindex="<%tabindex%>" <%javascript%>>\r
- <%extraoption%>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_SELECT_BODY"><![CDATA[\r
- <option value="<%value%>" <%selected%> title="<%title%>"><%option%></option>\r
-]]></part>\r
-<part name="SHOWLIST_LISTPLUG_SELECT_FOOT"><![CDATA[\r
- </select>\r
-]]></part>\r
-<part name="INPUTYESNO_TEMPLATE_NORMAL"><![CDATA[\r
- <input type="radio" name="<%name%>" value="<%yesval%>"<%yescheckedval%> id="<%yesid%>" />\r
- <label for="<%yesid%>"><%yesvaltext%></label>\r
- <input type="radio" name="<%name%>" value="<%noval%>"<%nocheckedval%> id="<%noid%>"<%disabled%> />\r
- <label for="<%noid%>"><%novaltext%></label>\r
-]]></part>\r
-<part name="SYSTEMINFO_GDSETTINGS"><![CDATA[\r
- <tr>\r
- <td width="50%"><%key%></td>\r
- <td><%value%></td>\r
- </tr>\r
-]]></part>\r
-<part name="BANLIST_DELETED_LIST"><![CDATA[\r
- <li><%blogname%></li>\r
-]]></part>\r
-<part name="INSERT_PLUGOPTION_TITLE"><![CDATA[\r
- <tr>\r
- <th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>\r
- </tr>\r
-]]></part>\r
-<part name="INSERT_PLUGOPTION_BODY"><![CDATA[\r
- <tr><%listplugplugoptionrow(admin/default)%></tr>\r
-]]></part>\r
-<part name="INPUTYESNO_TEMPLATE_ADMIN"><![CDATA[\r
- <input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>"<%yescheckedval%> id="<%yesid%>" />\r
- <label for="<%yesid%>"><%yesvaltext%></label>\r
- <input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>"<%nocheckedval%> id="<%noid%>"<%disabled%> />\r
- <label for="<%noid%>"><%novaltext%></label>\r
-]]></part>\r
-<part name="SPECIALSKINLIST_HEAD"><![CDATA[\r
- <ul>\r
-]]></part>\r
-<part name="SPECIALSKINLIST_BODY"><![CDATA[\r
- <li><a tabindex="<%tabindex%>" href="<%adminurl%>index.php?action=skinedittype&skinid=<%skinid%>&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="<%adminurl%>index.php?action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>\r
-]]></part>\r
-<part name="SPECIALSKINLIST_FOOT"><![CDATA[\r
- </ul>\r
-]]></part>\r
-\r
-<part name="TEMPLATE_EDIT_ROW_HEAD"><![CDATA[\r
- <tr>\r
- <td><%description%><%help%></td>\r
- <td id="td<%count%>">\r
- <textarea class="templateedit" name="<%name%>" tabindex="<%tabindex%>" cols="50" rows="<%rows%>" id="textarea<%count%>">\r
-]]></part>\r
-<part name="TEMPLATE_EDIT_ROW_TAIL"><![CDATA[\r
- </textarea>\r
- </td>\r
- </tr>\r
-]]></part>\r
-\r
-<part name="TEMPLATE_EDIT_EXPLUGNAME"><![CDATA[\r
- <tr>\r
- <th colspan="2"><%explugtplname%></th>\r
- </tr>\r
-]]></part>\r
-\r
-<part name="ADMIN_BATCHLIST"><![CDATA[\r
- <li><%text(_BATCH_EXECUTING)% <b><%adminbatchaction%></b> <%batchlisttype%> <b><%batchid%></b>... <b><%batchlistmsg%></b></li>\r
-]]></part>\r
-<part name="ADMIN_BLOGLINK"><![CDATA[\r
- <a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>\r
-]]></part>\r
-\r
-<part name="ADMIN_CUSTOMHELPLINK_ANCHOR"><![CDATA[\r
- <a href="<%helpurl%>#<%helptarget%>" title="<%title%>" <%onclick%>>\r
-]]></part>\r
-<part name="ADMIN_CUSTOMHELPLINK_ICON"><![CDATA[\r
- <img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>\r
-]]></part>\r
-<part name="NORMALSKINLIST_HEAD"><![CDATA[\r
- <ul>\r
-]]></part>\r
-<part name="NORMALSKINLIST_BODY"><![CDATA[\r
- <li><a href="<%editurl%>" tabindex="<%tabindex%>"><%skintypename%></a> <%help%></li>\r
-]]></part>\r
-<part name="NORMALSKINLIST_FOOT"><![CDATA[\r
- </ul>\r
-]]></part>\r
-<part name="SPECIALSKINLIST_HEAD"><![CDATA[\r
- <ul>\r
-]]></part>\r
-<part name="SPECIALSKINLIST_BODY"><![CDATA[\r
- <li><a href="<%editurl%>" tabindex="<%tabindex%>"><%skintype%></a> (<a href="<%removeurl%>" tabindex="<%tabindex%>">remove</a>)</li>\r
-]]></part>\r
-<part name="SPECIALSKINLIST_FOOT"><![CDATA[\r
- </ul>\r
-]]></part>\r
-<part name="PLUGIN_QUICKMENU_BODY"><![CDATA[\r
- <li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>\r
-]]></part>\r
-<part name="PLUGIN_QUICKMENU_FOOT"><![CDATA[\r
- </ul>\r
-]]></part>\r
-</template>\r
-</nucleusskin>\r
+<?xml version="1.0"?>
+<nucleusskin>
+<meta>
+<skin name="admin/default"/>
+<template name="admin/default"/>
+<info><![CDATA[20120525]]></info>
+</meta>
+<skin name="admin/default" type="text/html" includeMode="skindir" includePrefix="admin/default">
+<description>
+<![CDATA[ADMIN Area Default skin]]>
+</description>
+
+<part name="actionlog"><![CDATA[
+ <%pagehead%>
+
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+
+ <h2><%text(_ACTIONLOG_CLEAR_TITLE)%></h2>
+ <p><a href="<%adminurl%><%addtickettourl(index.php?action=clearactionlog)%>"><%text(_ACTIONLOG_CLEAR_TEXT)%></a></p>
+
+ <h2><%text(_ACTIONLOG_TITLE)%></h2>
+ <%actionloglist(admin/default)%>
+ <%pagefoot%>
+]]></part>
+<part name="activate"><![CDATA[
+ <%pagehead%>
+ <h2><%activationmessage(title)%></h2>
+ <p><%activationmessage(text)%></p>
+ <p class="error"><%headmessage%></p>
+ <%if(bechangepass)%>
+ <form action="<%adminurl%>index.php" method="post">
+ <p>
+ <input type="hidden" name="action" value="activatesetpwd" />
+ <%ticket%>
+ <input type="hidden" name="key" value="<%activationmessage(ackey)%>" />
+ </p>
+ <table frame="box" rules="all" summary="<%text(_MEMBERS_SETPWD_BTN)%>">
+ <tr>
+ <td><%text(_MEMBERS_PWD)%></td>
+ <td><input type="password" maxlength="40" size="16" name="password" /></td>
+ </tr>
+ <tr>
+ <td><%text(_MEMBERS_REPPWD)%></td>
+ <td><input type="password" maxlength="40" size="16" name="repeatpassword" /></td>
+ <%eventformextra(activation)%>
+ </tr>
+ <tr>
+ <td><%text(_MEMBERS_SETPWD)%></td>
+ <td><input type="submit" value="<%text(_MEMBERS_SETPWD_BTN)%>" /></td>
+ </tr>
+ </table>
+ </form>
+ <%endif%>
+ <%pagefoot%>
+]]></part>
+<part name="activatesetpwd"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_ACTIVATE_SUCCESS_TITLE)%></h2>
+ <p><%text(_ACTIVATE_SUCCESS_TEXT)%></p>
+ <%pagefoot%>
+]]></part>
+<part name="addnewlog"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_BLOGCREATED_TITLE)%></h2>
+ <p><%sprinttext(_BLOGCREATED_ADDEDTXT,<|%createdblogsetting(name)%|>)%></p>
+ <ol>
+ <li><a href="#index_php"><%sprinttext(_BLOGCREATED_SIMPLEWAY,<|%getblogsetting(short)%|>)%></a></li>
+ <li><a href="#skins"><%text(_BLOGCREATED_ADVANCEDWAY)%></a></li>
+ </ol>
+ <h3><a id="index_php"><%sprinttext(_BLOGCREATED_SIMPLEDESC1,<|%getblogsetting(short)%|>)%></a></h3>
+ <p><%sprinttext(_BLOGCREATED_SIMPLEDESC2,<|%getblogsetting(short)%|>)%></p>
+ <pre><code><?php
+
+ $CONF['Self'] = '<b><%blogsetting(short)%>.php</b>';
+
+ include('<i>./config.php</i>');
+
+ selectBlog('<b><%blogsetting(short)%></b>');
+ selector();
+
+ ?></code></pre>
+ <p><%text(_BLOGCREATED_SIMPLEDESC3)%></p>
+ <p><%text(_BLOGCREATED_SIMPLEDESC4)%></p>
+ <form action="<%adminurl%>index.php" method="post">
+ <p>
+ <input type="hidden" name="action" value="addnewlog2" />
+ <%ticket%>
+ <input type="hidden" name="blogid" value="<%requestblogid%>" />
+ </p>
+
+ <table frame="box" rules="all" summary="<%text(_BLOGCREATED_TITLE)%>">
+ <tr>
+ <td><%text(_EBLOG_URL)%></td>
+ <td><input name="url" maxlength="100" size="40" value="<%sitevar(url)%><%blogsetting(short)%>.php" /></td>
+ </tr>
+ <tr>
+ <td><%text(_EBLOG_CREATE)%></td>
+ <td><input type="submit" value="<%text(_EBLOG_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>
+ </tr>
+ </table>
+ </form>
+
+ <h3><a id="skins"><%text(_BLOGCREATED_ADVANCEDWAY2)%></a></h3>
+ <p><%text(_BLOGCREATED_ADVANCEDWAY3)%></p>
+
+ <form action="<%adminurl%>index.php" method="post">
+ <p>
+ <input type="hidden" name="action" value="addnewlog2" />
+ <%ticket%>
+ <input type="hidden" name="blogid" value="<%requestblogid%>" />
+ </p>
+ <table frame="box" rules="all" summary="<%text(_BLOGCREATED_ADVANCEDWAY2)%>">
+ <tr>
+ <td><%text(_EBLOG_URL)%></td>
+ <td><input name="url" maxlength="100" size="40" /></td>
+ </tr>
+ <tr>
+ <td><%text(_EBLOG_CREATE)%></td>
+ <td><input type="submit" value="<%text(_EBLOG_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>
+ </tr>
+ </table>
+ </div>
+ </form><%pagefoot%>
+]]></part>
+<part name="adminerrorpage"><![CDATA[
+ <%pagehead%>
+ <h2>Error!</h2>
+ <%headmessage%><br />
+ <a href="<%adminurl%>index.php" onclick="history.back()"><%text(_BACK)%></a>
+ <%pagefoot%>
+]]></part>
+<part name="adminskindelete"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_DELETE_CONFIRM)%></h2>
+
+ <form method="post" action="<%adminurl%>index.php">
+ <p><%text(_CONFIRMTXT_SKIN)%><b><%editskintype(name)%></b> (<%editskintype(desc)%>)</p>
+ <input type="hidden" name="action" value="adminskindeleteconfirm" />
+ <%ticket%>
+ <input type="hidden" name="skinid" value="<%editskintype(id)%>" />
+ <input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="adminskinedit"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=adminskinoverview">(<%text(_SKIN_BACK)%>)</a></p>
+
+ <h2><%text(_SKIN_EDITONE_TITLE)%> '<%editskin(name)%>'</h2>
+
+ <h3><%text(_SKIN_PARTS_TITLE)%></h3>
+ <%text(_SKIN_PARTS_MSG)%>
+ <%normalskinlist(admin/default)%>
+
+ <h3><%text(_SKIN_PARTS_SPECIAL)%></h3>
+ <form method="get" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="adminskinedittype" />
+ <input type="hidden" name="skinid" value="<%editskin(id)%>" />
+ <input name="type" tabindex="89" size="30" maxlength="64" />
+ <input type="submit" tabindex="140" value="<%text(_SKIN_CREATE)%>" onclick="return checkSubmit();" />
+ </p>
+ </form>
+ <%specialskinlist(admin/default)%>
+
+ <h3><%text(_SKIN_GENSETTINGS_TITLE)%></h3>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="adminskineditgeneral" />
+ <%ticket%>
+ <input type="hidden" name="skinid" value="<%editskin(id)%>" />
+ </p>
+ <table frame="box" rules="all" summary="<%text(_SKIN_GENSETTINGS_TITLE)%>">
+ <tr>
+ <td><%text(_SKIN_NAME)%> <%helplink(shortnames)%></td>
+ <td><input name="name" value="<%editskin(name)%>" maxlength="64" size="30" tabindex="90" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_DESC)%></td>
+ <td><input name="desc" value="<%editskin(desc)%>" maxlength="200" size="50" tabindex="100" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_TYPE)%></td>
+ <td><input name="type" value="<%editskin(type)%>" maxlength="40" size="20" tabindex="110" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_INCLUDE_MODE)%> <%helplink(includemode)%></td>
+ <td><%editskin(mode)%></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_INCLUDE_PREFIX)%> <%helplink(includeprefix)%></td>
+ <td><input name="inc_prefix" value="<%editskin(prefix)%>" maxlength="40" size="20" tabindex="130" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_CHANGE)%></td>
+ <td><input type="submit" value="<%text(_SKIN_CHANGE_BTN)%>" onclick="return checkSubmit();" tabindex="140" /></td>
+ </tr>
+ </table>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="adminskinedittype"><![CDATA[
+ <%pagehead%>
+ <p>(<a href="<%adminurl%>index.php?action=adminskinoverview"><%text(_SKIN_GOBACK)%></a>)</p>
+
+ <h2><%text(_SKIN_EDITPART_TITLE)%> '<%editskintype(name)%>': <%editskintype(skintype)%></h2>
+ <%headmessage%>
+
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="adminskinupdate" />
+ <%ticket%>
+ <input type="hidden" name="skinid" value="<%editskintype(id)%>" />
+ <input type="hidden" name="type" value="<%editskintype(skintyperaw)%>" />
+ <input type="submit" value="<%text(_SKIN_UPDATE_BTN)%>" onclick="return checkSubmit();" />
+ <input type="reset" value="<%text(_SKIN_RESET_BTN)%>" />
+ (skin type: <%editskintype(skintype)%>)<%skintypehelp%><br />
+ <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><%editskintype(content)%></textarea><br />
+ <input type="submit" tabindex="20" value="<%text(_SKIN_UPDATE_BTN)%>" onclick="return checkSubmit();" />
+ <input type="reset" value="<%text(_SKIN_RESET_BTN)%>" />
+ (skin type: <%editskintype(skintype)%>)
+ <br />
+ <br />
+ <%text(_SKIN_ALLOWEDVARS)%>
+ <%allowedskinactions%><br /><br />
+ <%text(_SKINEDIT_ALLOWEDTEMPLATESS)%>
+ <%skineditallowedlist(template)%><br />
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="adminskiniedoimport"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+
+ <h2><%text(_SKINIE_DONE)%></h2>
+
+ <ul>
+ <li><strong><%text(_SKINIE_INFO_GENERAL)%></strong> <%importskininfo(info)%></li>
+ <li><strong><%text(_SKINIE_INFO_IMPORTEDSKINS)%></strong> <%importskininfo(snames)%></li>
+ <li><strong><%text(_SKINIE_INFO_IMPORTEDTEMPLS)%></strong> <%importskininfo(tnames)%></li>
+ </ul>
+ <%pagefoot%>
+]]></part>
+<part name="adminskinieimport"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=adminskinieoverview">(<%text(_BACK)%>)</a></p>
+ <h2><%text(_SKINIE_CONFIRM_TITLE)%></h2>
+
+ <ul>
+ <li><strong><%text(_SKINIE_INFO_GENERAL)%></strong> <%importskininfo(info)%></li>
+ <li><strong><%text(_SKINIE_INFO_SKINS)%></strong> <%importskininfo(snames)%></li>
+ <li><strong><%text(_SKINIE_INFO_TEMPLATES)%></strong> <%importskininfo(tnames)%></li>
+ <%if(nameclashes)%>
+ <li><strong style="color: red;"><%text(_SKINIE_INFO_SKINCLASH)%></strong> <%importskininfo(sclashes)%></li>
+ <li><strong style="color: red;"><%text(_SKINIE_INFO_TEMPLCLASH)%></strong> <%importskininfo(tclashes)%></li>
+ <%endif%>
+ </ul>
+
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="adminskiniedoimport" />
+ <%ticket%>
+ <input type="hidden" name="skinfile" value="<%importskininfo(skinfile)%>" />
+ <input type="hidden" name="mode" value="<%importskininfo(mode)%>" />
+ <input type="submit" value="<%text(_SKINIE_CONFIRM_IMPORT)%>" />
+ <%if(nameclashes)%>
+ <br />
+ <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" />
+ <label for="cb_overwrite"><%text(_SKINIE_CONFIRM_OVERWRITE)%></label>
+ <%endif%>
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="adminskinieoverview"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+
+ <h2><%text(_SKINIE_TITLE_IMPORT)%></h2>
+
+ <p>
+ <label for="skinie_import_local"><%text(_SKINIE_LOCAL)%></label>
+ </p>
+
+ <%if(superadmin)%>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="adminskinieimport" />
+ <%ticket%>
+ <input type="hidden" name="mode" value="file" />
+ <select name="skinfile" id="skinie_import_local">
+ <%selectlocalskinfiles%>
+ </select>
+ <input type="submit" value="<%text(_SKINIE_BTN_IMPORT)%>" />
+ </p>
+ </form>
+ <%else%>
+ <p><%text(_SKINIE_NOCANDIDATES)%></p>
+ <%endif%>
+
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <em><%text(_OR)%></em>
+ <%ticket%>
+ <input type="hidden" name="action" value="adminskinieimport" />
+ <input type="hidden" name="mode" value="url" />
+ <label for="skinie_import_url"><%text(_SKINIE_FROMURL)%></label>
+ <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />
+ <input type="submit" value="<%text(_SKINIE_BTN_IMPORT)%>" />
+ </p>
+ </form>
+
+ <h2><%text(_SKINIE_TITLE_EXPORT)%></h2>
+
+ <form method="post" action="<%adminurl%>index.php">
+
+ <p><%text(_SKINIE_EXPORT_INTRO)%></p>
+
+ <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_SKINS)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_SKINIE_EXPORT_SKINS)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%skinielist(skin,admin/default)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_TEMPLATES)%>">
+ <thead>
+ <th colspan="2"><%text(_SKINIE_EXPORT_TEMPLATES)%></th>
+ </thead>
+ <tbody>
+ <%skinielist(template,admin/default)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_EXTRA)%>">
+ <thead>
+ <th colspan="2"><%text(_SKINIE_EXPORT_EXTRA)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>
+ </tr>
+ </tbody>
+ </table>
+
+ <p>
+ <input type="hidden" name="action" value="adminskinieexport" />
+ <%ticket%>
+ <input type="submit" value="<%text(_SKINIE_BTN_EXPORT)%>" />
+ </p>
+
+
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="adminskinoverview"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+ <h2><%text(_SKIN_EDIT_TITLE)%></h2>
+
+ <h3><%text(_SKIN_AVAILABLE_TITLE)%></h3>
+ <%skinoverview(admin/default)%>
+
+ <h3><%text(_SKIN_NEW_TITLE)%></h3>
+ <form method="post" action="<%adminurl%>">
+ <p>
+ <input type="hidden" name="action" value="adminskinnew" />
+ <%ticket%>
+ </p>
+ <table frame="box" rules="all" summary="<%text(_SKIN_NEW_TITLE)%>">
+ <tr>
+ <td><%text(_SKIN_NAME)%> <%helplink(shortnames)%></td>
+ <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_DESC)%></td>
+ <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_CREATE)%></td>
+ <td><input type="submit" tabindex="10030" value="<%text(_SKIN_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>
+ </tr>
+ </table>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="adminskinremovetype"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_DELETE_CONFIRM)%></h2>
+ <p><%text(_CONFIRMTXT_SKIN_PARTS_SPECIAL)%><br />
+ <b><%editskintype(skintype)%> (<%editskintype(name)%>)</b> (<%editskintype(desc)%>)</p>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="adminskinremovetypeconfirm" />
+ <%ticket%>
+ <input type="hidden" name="skinid" value="<%editskintype(id)%>" />
+ <input type="hidden" name="type" value="<%editskintype(skintype)%>" />
+ <input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="admintemplatedelete"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_DELETE_CONFIRM)%></h2>
+ <p><%text(_CONFIRMTXT_TEMPLATE)%><b><%edittemplateinfo(name)%></b> (<%edittemplateinfo(desc)%>)</p>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="admintemplatedeleteconfirm" />
+ <%ticket%>
+ <input type="hidden" name="templateid" value="<%edittemplateinfo(id)%>" />
+ <input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="admintemplateedit"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=admintemplateoverview">(<%text(_TEMPLATE_BACK)%>)</a></p>
+
+ <h2><%text(_TEMPLATE_EDIT_TITLE)%> '<%edittemplateinfo(name)%>'</h2>
+ <%headmessage%>
+
+ <p><%text(_TEMPLATE_EDIT_MSG)%></p>
+
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="admintemplateupdate" />
+ <%ticket%>
+ <input type="hidden" name="templateid" value="<%edittemplateinfo(id)%>" />
+ </p>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_EDIT_TITLE)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_SETTINGS)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><%text(_TEMPLATE_NAME)%> <%helplink(shortnames)%></td>
+ <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<%edittemplateinfo(name)%>" /></td>
+ </tr>
+ <tr>
+ <td><%text(_TEMPLATE_DESC)%></td>
+ <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<%edittemplateinfo(desc)%>" /></td>
+ </tr>
+ <tr>
+ <td><%text(_TEMPLATE_UPDATE)%></td>
+ <td>
+ <input type="submit" tabindex="6" value="<%text(_TEMPLATE_UPDATE_BTN)%>" onclick="return checkSubmit();" />
+ <input type="reset" tabindex="7" value="<%text(_TEMPLATE_RESET_BTN)%>" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_QMENU_LAYOUT_SKINS)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_QMENU_LAYOUT_SKINS)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_NORMALSKINLIST_HEAD, NORMALSKINLIST_HEAD, ,8)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_NORMALSKINLIST_BODY, NORMALSKINLIST_BODY, ,9)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_NORMALSKINLIST_FOOT, NORMALSKINLIST_FOOT, ,10)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SPECIALSKINLIST_HEAD, SPECIALSKINLIST_HEAD, , 11)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SPECIALSKINLIST_BODY, SPECIALSKINLIST_BODY, , 12)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SPECIALSKINLIST_FOOT, SPECIALSKINLIST_FOOT, , 13)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SKINIE_EXPORT_LIST, SKINIE_EXPORT_LIST, , 17)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_QMENU_LAYOUT_TEMPL)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_QMENU_LAYOUT_TEMPL)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_TEMPLATE_EDIT_EXPLUGNAME, TEMPLATE_EDIT_EXPLUGNAME, , 18)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_TEMPLATE_EDIT_ROW_HEAD, TEMPLATE_EDIT_ROW_HEAD, , 19)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_TEMPLATE_EDIT_ROW_TAIL, TEMPLATE_EDIT_ROW_TAIL, , 20)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_ADMINAREAHEADLINK)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_SKINABLEADMIN_ADMINAREAHEADLINK)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_ADMIN_BLOGLINK, ADMIN_BLOGLINK, , 21)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_BATCH)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_SKINABLEADMIN_BATCH)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_ADMIN_BATCHLIST, ADMIN_BATCHLIST, , 22)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_QMENU_ACTIVATE)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_QMENU_ACTIVATE)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_FORGOT_TITLE, ACTIVATE_FORGOT_TITLE, , 23)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_FORGOT_TEXT, ACTIVATE_FORGOT_TEXT, , 24)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_REGISTER_TITLE, ACTIVATE_REGISTER_TITLE, , 25)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_REGISTER_TEXT, ACTIVATE_REGISTER_TEXT, , 26)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_CHANGE_TITLE, ACTIVATE_CHANGE_TITLE, , 27)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_ACTIVATE_CHANGE_TEXT, ACTIVATE_CHANGE_TEXT, , 28)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_QMENU_MANAGE_SYSTEM)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_QMENU_MANAGE_SYSTEM)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_SYSTEMINFO_GDSETTINGS, SYSTEMINFO_GDSETTINGS, , 29)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_BLOGLIST_BANS)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_BLOGLIST_BANS)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_BANLIST_DELETED_LIST, BANLIST_DELETED_LIST, , 30)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_TPLSETTING_INGENERAL)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_SKINABLEADMIN_TPLSETTING_INGENERAL)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_INSERT_PLUGOPTION_TITLE, INSERT_PLUGOPTION_TITLE, , 31)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_INSERT_PLUGOPTION_BODY, INSERT_PLUGOPTION_BODY, , 32)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_INPUTYESNO_TEMPLATE_ADMIN, INPUTYESNO_TEMPLATE_ADMIN, , 33)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_INPUTYESNO_TEMPLATE_NORMAL, INPUTYESNO_TEMPLATE_NORMAL, , 34)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ICON, ADMIN_CUSTOMHELPLINK_ICON, , 35)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ANCHOR, ADMIN_CUSTOMHELPLINK_ANCHOR, , 36)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_HEAD, SHOWLIST_LISTPLUG_SELECT_HEAD, , 37)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_BODY, SHOWLIST_LISTPLUG_SELECT_BODY, , 38)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_SELECT_FOOT, SHOWLIST_LISTPLUG_SELECT_FOOT, , 39)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_HEAD, SHOWLIST_LISTPLUG_TABLE_HEAD, , 40)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BODY, SHOWLIST_LISTPLUG_TABLE_BODY, , 41)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_FOOT, SHOWLIST_LISTPLUG_TABLE_FOOT, , 42)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD, , 43)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY, SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY, , 44)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT, , 45)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD, , 46)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY, SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY, , 47)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT, , 48)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD, , 49)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY, , 50)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL, , 51)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST, SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST, , 52)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE, SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE, , 53)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND, SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND, , 54)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ, SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ, , 55)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE, SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE, , 56)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN, , 57)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN, , 58)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP, , 59)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL, SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL, , 60)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT, , 61)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD, , 62)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY, SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY, , 63)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO, , 64)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD, , 65)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP, , 66)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO, , 67)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC, , 68)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA, , 69)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT, SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT, , 70)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT, SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT, , 71)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT, , 72)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD, , 73)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY, SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY, , 74)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT, , 75)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD, , 76)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY, SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY, , 77)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN, SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN, , 78)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT, , 79)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD, , 80)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY, SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY, , 81)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM, SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM, , 82)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM, SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM, , 83)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT, , 84)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD, SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD, , 85)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY, SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY, , 86)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT, SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT, , 87)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD, SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD, , 88)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY, SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY, , 89)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT, SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT, , 90)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD, SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD, , 91)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY, SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY, , 92)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT, SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT, , 93)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD, , 94)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY, SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY, , 95)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT, , 96)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD, , 97)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY, SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY, , 98)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT, , 99)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD, , 100)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY, SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY, , 101)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT, , 102)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD, , 103)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY, SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY, , 104)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT, , 105)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD, SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD, , 106)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY, SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY, , 107)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT, SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT, , 108)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINABLEADMIN_PLUGIN_QUICKMENU)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_SKINABLEADMIN_PLUGIN_QUICKMENU)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row, _ADM_TPLPT_PLUGIN_QUICKMENU_TITLE, PLUGIN_QUICKMENU_TITLE, , 109)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_PLUGIN_QUICKMENU_HEAD, PLUGIN_QUICKMENU_HEAD, , 110)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_PLUGIN_QUICKMENU_BODY, PLUGIN_QUICKMENU_BODY, , 111)%>
+ <%edittemplateinfo(row, _ADM_TPLPT_PLUGIN_QUICKMENU_FOOT, PLUGIN_QUICKMENU_FOOT, , 112)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_PLUGIN_FIELDS)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_PLUGIN_FIELDS)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(extratemplate,admin/default)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_UPDATE)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_UPDATE)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><%text(_TEMPLATE_UPDATE)%></td>
+ <td>
+ <input type="submit" tabindex="800" value="<%text(_TEMPLATE_UPDATE_BTN)%>" onclick="return checkSubmit();" />
+ <input type="reset" tabindex="810" value="<%text(_TEMPLATE_RESET_BTN)%>" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="admntemplateoverview"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+ <h2><%text(_TEMPLATE_TITLE)%></h2>
+
+ <h3><%text(_TEMPLATE_AVAILABLE_TITLE)%></h3>
+ <%templateoverview(admin/default)%>
+
+ <h3><%text(_TEMPLATE_NEW_TITLE)%></h3>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input name="action" value="admintemplatenew" type="hidden" />
+ <%ticket%>
+ </p>
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_NEW_TITLE)%>">
+ <tr>
+ <td><%text(_TEMPLATE_NAME)%> <%helplink(shortnames)%></td>
+ <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
+ </tr>
+ <tr>
+ <td><%text(_TEMPLATE_DESC)%></td>
+ <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
+ </tr>
+ <tr>
+ <td><%text(_TEMPLATE_CREATE)%></td>
+ <td><input type="submit" tabindex="10030" value="<%text(_TEMPLATE_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>
+ </tr>
+ </table>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="backupoverview"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+ <h2><%text(_BACKUPS_TITLE)%></h2>
+ <h3><%text(_BACKUP_TITLE)%></h3>
+ <p><%text(_BACKUP_INTRO)%></p>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="backupcreate" />
+ <%ticket%>
+ <input type="radio" name="gzip" value="1" checked="checked" id="gzip_yes" tabindex="10" /><label for="gzip_yes"><%text(_BACKUP_ZIP_YES)%></label><br />
+ <input type="radio" name="gzip" value="0" id="gzip_no" tabindex="10" /><label for="gzip_no" ><%text(_BACKUP_ZIP_NO)%></label><br /><br />
+ <input type="submit" value="<%text(_BACKUP_BTN)%>" tabindex="20" />
+ </p>
+ </form>
+ <p class="note"><%text(_BACKUP_NOTE)%></p>
+ <h3><%text(_RESTORE_TITLE)%></h3>
+ <p class="note"><%text(_RESTORE_NOTE)%></p>
+ <p><%text(_RESTORE_INTRO)%></p>
+ <form method="post" action="<%adminurl%>index.php" enctype="multipart/form-data">
+ <p>
+ <input type="hidden" name="action" value="backuprestore" />
+ <%ticket%>
+ <input name="backup_file" type="file" tabindex="30" />
+ <br /><br />
+ <input type="submit" value="<%text(_RESTORE_BTN)%>" tabindex="40" /><br />
+ <input type="checkbox" name="letsgo" value="1" id="letsgo" tabindex="50" /><label for="letsgo"><%text(_RESTORE_IMSURE)%></label><br />
+ <%text(_RESTORE_WARNING)%>
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="backuprestore"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_RESTORE_COMPLETE)%></h2>
+ <%pagefoot%>
+]]></part>
+<part name="banlist"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>
+ <h2><%text(_BAN_TITLE)%> '<%adminbloglink(admin/default)%>'</h2>
+ <%adminbanlist%>
+ <h2><%text(_BAN_NEW_TITLE)%></h2>
+ <p><a href="<%adminurl%>index.php?action=banlistnew&blogid=<%requestblogid%>"><%text(_BAN_NEW_TEXT)%></a></p><%pagefoot%>
+]]></part>
+<part name="banlistdelete"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_BAN_REMOVE_TITLE)%></h2>
+
+ <form method="post" action="<%adminurl%>index.php">
+
+ <h3><%text(_BAN_IPRANGE)%></h3>
+
+ <p>
+ <%text(_CONFIRMTXT_BAN)%> <%requestiprange%>
+ <input name="iprange" type="hidden" value="<%requestiprange%>" />
+ </p>
+
+ <h3><%text(_BAN_BLOGS)%></h3>
+
+ <p>
+ <input type="hidden" name="blogid" value="<%requestblogid%>" />
+ <input name="allblogs" type="radio" value="0" id="allblogs_one" />
+ <label for="allblogs_one"><%sprinttext(_BAN_BANBLOGNAME,<|%getblogsetting(name)%|>)%></label>
+ <br />
+ <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><%text(_BAN_ALLBLOGS)%></label>
+ </p>
+
+ <h3><%text(_BAN_DELETE_TITLE)%></h3>
+
+ <p>
+ <%ticket%>
+ <input type="hidden" name="action" value="banlistdeleteconfirm" />
+ <input type="submit" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+ </p>
+
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="banlistdeleteconfirm"><![CDATA[
+ <%pagehead%>
+ <a href="<%adminurl%>index.php?action=banlist&blogid=<%requestblogid%>">(<%text(_BACK)%>)</a>
+ <h2><%text(_BAN_REMOVED_TITLE)%></h2>
+ <p><%text(_BAN_REMOVED_TEXT)%></p>
+ <ul>
+ <%banlistdeletedlist%>
+ </ul>
+ <%pagefoot%>
+]]></part>
+<part name="banlistnew"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_BAN_ADD_TITLE)%></h2>
+ <form method="post" action="<%adminurl%>index.php">
+ <h3><%text(_BAN_IPRANGE)%></h3>
+ <p><%text(_BAN_IPRANGE_TEXT)%></p>
+ <p class="note">
+ <strong><%text(_BAN_EXAMPLE_TITLE)%></strong>
+ <%text(_BAN_EXAMPLE_TEXT)%>
+ <%iprangeinput%>
+ </p>
+ </div>
+ <h3><%text(_BAN_BLOGS)%></h3>
+ <p><%text(_BAN_BLOGS_TEXT)%></p>
+ <p>
+ <input type="hidden" name="blogid" value="<%requestblogid%>" />
+ <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">'<%blogsetting(name)%>'</label><br />
+ <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><%text(_BAN_ALLBLOGS)%></label>
+ </p>
+ <h3><%text(_BAN_REASON_TITLE)%></h3>
+ <p><%text(_BAN_REASON_TEXT)%></p>
+ <p><textarea name="reason" cols="40" rows="5"></textarea></p>
+ <h3><%text(_BAN_ADD_TITLE)%></h3>
+ <p>
+ <input name="action" type="hidden" value="banlistadd" />
+ <%ticket%>
+ <input type="submit" value="<%text(_BAN_ADD_BTN)%>" />
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="batchcategory"><![CDATA[
+ <%pagehead%>
+ <a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>
+ <h2><%text(_BATCH_CATEGORIES)%></h2>
+ <p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>
+ <ul>
+ <%adminbatchlist%>
+ </ul>
+ <b><%text(_BATCH_DONE)%></b>
+ <%pagefoot%>
+]]></part>
+<part name="batchcomment"><![CDATA[
+ <%pagehead%>
+ <a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>
+ <h2><%text(_BATCH_COMMENTS)%></h2>
+ <p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>
+ <ul>
+ <%adminbatchlist%>
+ </ul>
+ <b><%text(_BATCH_DONE)%></b><%pagefoot%>
+]]></part>
+<part name="batchdelete"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_BATCH_DELETE_CONFIRM)%></h2>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="<%batchdeletetype%>" />
+ <input type="hidden" name="batchaction" value="delete" />
+ <input type="hidden" name="confirmation" value="yes" />
+ <%ticket%>
+ <%batchdeletelist%>
+ <input type="submit" value="<%text(_BATCH_DELETE_CONFIRM_BTN)%>" onclick="return checkSubmit();" />
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="batchitem"><![CDATA[
+ <%pagehead%>
+ <a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>
+ <h2><%text(_BATCH_ITEMS)%></h2>
+ <p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>
+ <ul>
+ <%adminbatchlist%>
+ </ul>
+ <b><%text(_BATCH_DONE)%></b><%pagefoot%>
+]]></part>
+<part name="batchmember"><![CDATA[
+ <%pagehead%>
+ <a href="<%adminurl%>index.php?action=usermanagement"><%text(_MEMBERS_BACKTOOVERVIEW)%></a>
+ <h2><%text(_BATCH_MEMBERS)%></h2>
+ <p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>
+ <ul>
+ <%adminbatchlist%>
+ </ul>
+ <b><%text(_BATCH_DONE)%></b><%pagefoot%>
+]]></part>
+<part name="batchmove"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_MOVE_TITLE)%></h2>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="<%batchmovetype%>" />
+ <input type="hidden" name="batchaction" value="move" />
+ <%ticket%>
+ <%batchmovelist%>
+ <%movedistselect%>
+ <input type="submit" value="<%batchmovebtn%>" onclick="return checkSubmit();" />
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="batchmovecat"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_MOVECAT_TITLE)%></h2>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="<%batchmovetype%>" />
+ <input type="hidden" name="batchaction" value="move" />
+ <%ticket%>
+ <%batchmovelist%>
+ <%movedistselect%>
+ <input type="submit" value="<%batchmovebtn%>" onclick="return checkSubmit();" />
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="batchteam"><![CDATA[
+<%pagehead%>
+<a href="<%adminurl%>index.php?action=manageteam&blogid=<%requestblogid%>"><%text(_BACK)%></a>
+<h2><%text(_BATCH_TEAM)%></h2>
+<p><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b></p>
+<ul>
+<%adminbatchlist%>
+</ul>
+<b><%text(_BATCH_DONE)%></b><%pagefoot%>
+]]></part>
+<part name="blogcommentlist"><![CDATA[
+<%pagehead%>
+<p>(<a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>)</p>
+<h2><%text(_COMMENTS_BLOG)%> <%adminbloglink(admin/default)%></h2>
+<%commentnavlist(admin/default)%><%pagefoot%>
+]]></part>
+<part name="blogsettings"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>
+<h2><%text(_EBLOG_TITLE)%>: '<%adminbloglink(admin/default)%>'</h2>
+
+<h3><%text(_EBLOG_TEAM_TITLE)%></h3>
+
+<p>
+<%text(_EBLOG_CURRENT_TEAM_MEMBER)%>
+<%blogteammembers%>
+</p>
+
+<p><a href="<%adminurl%>index.php?action=manageteam&blogid=<%requestblogid%>"><%text(_EBLOG_TEAM_TEXT)%></a></p>
+
+<h3><%text(_EBLOG_SETTINGS_TITLE)%></h3>
+
+<form method="post" action="<%adminurl%>index.php">
+
+<p>
+<input type="hidden" name="action" value="blogsettingsupdate" />
+<%ticket%>
+<input type="hidden" name="blogid" value="<%requestblogid%>" />
+</p>
+
+<table frame="box" rules="all" summary="<%text(_EBLOG_SETTINGS_TITLE)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_EBLOG_SETTINGS_TITLE)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><%text(_EBLOG_NAME)%></td>
+<td><input name="name" tabindex="10" size="40" maxlength="60" value="<%blogsetting(name)%>" /></td>
+</tr>
+<tr>
+<td>
+<%text(_EBLOG_SHORTNAME)%> <%helplink(shortblogname)%>
+<%text(_EBLOG_SHORTNAME_EXTRA)%>
+</td>
+<td><input name="shortname" tabindex="20" maxlength="15" size="15" value="<%blogsetting(short)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_DESC)%></td>
+<td><input name="desc" tabindex="30" maxlength="200" size="40" value="<%blogsetting(desc)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_URL)%></td>
+<td><input name="url" tabindex="40" size="40" maxlength="100" value="<%blogsetting(url)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_DEFSKIN)%><%helplink(blogdefaultskin)%></td>
+<td><%defskinselect(blog)%></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_LINEBREAKS)%> <%helplink(convertbreaks)%></td>
+<td><%blogsettingyesno(convertbreaks)%></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_ALLOWPASTPOSTING)%> <%helplink(allowpastposting)%></td>
+<td><%blogsettingyesno(allowpastposting)%></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_DISABLECOMMENTS)%></td>
+<td><%blogsettingyesno(comments)%></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_ANONYMOUS)%></td>
+<td><%blogsettingyesno(public)%></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_REQUIREDEMAIL)%></td>
+<td><%blogsettingyesno(reqemail)%></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_NOTIFY)%> <%helplink(blognotify)%></td>
+<td><input name="notify" tabindex="80" maxlength="60" size="40" value="<%blogsetting(notifyaddress)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_NOTIFY_ON)%></td>
+<td>
+<input name="notifyComment" value="3" type="checkbox" tabindex="81" id="notifyComment"<%blognotifysetting(comment)%> />
+<label for="notifyComment"><%text(_EBLOG_NOTIFY_COMMENT)%></label><br />
+<input name="notifyVote" value="5" type="checkbox" tabindex="82" id="notifyVote"<%blognotifysetting(vote)%> />
+<label for="notifyVote"><%text(_EBLOG_NOTIFY_KARMA)%></label><br />
+<input name="notifyNewItem" value="7" type="checkbox" tabindex="83" id="notifyNewItem"<%blognotifysetting(newitem)%> />
+<label for="notifyNewItem"><%text(_EBLOG_NOTIFY_ITEM)%></label>
+</td>
+</tr>
+<tr>
+<td><%text(_EBLOG_MAXCOMMENTS)%> <%helplink(blogmaxcomments)%></td>
+<td><input name="maxcomments" tabindex="90" size="3" value="<%blogsetting(maxcomments)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_UPDATE)%> <%helplink(blogupdatefile)%></td>
+<td><input name="update" tabindex="100" size="40" maxlength="60" value="<%blogsetting(updatefile)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_DEFCAT)%></td>
+<td><%defcatselect%></td>
+</tr>
+<tr>
+<td>
+<%text(_EBLOG_OFFSET)%> <%helplink(blogtimeoffset)%><br />
+<%text(_EBLOG_STIME)%> <b><%blogtime(servertime,"%H:%M")%></b><br />
+<%text(_EBLOG_BTIME)%> <b><%blogtime(blogtime,"%H:%M")%></b>
+</td>
+<td><input name="timeoffset" tabindex="120" size="3" value="<%blogsetting(timeoffset)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_SEARCH)%> <%helplink(blogsearchable)%></td>
+<td><%blogsettingyesno(searchable)%></td>
+</tr>
+<%pluginoptions(blog)%>
+<tr>
+<td><%text(_EBLOG_CHANGE)%></td>
+<td><input type="submit" tabindex="130" value="<%text(_EBLOG_CHANGE_BTN)%>" onclick="return checkSubmit();" /></td>
+</tr>
+</tbody>
+</table>
+</form>
+
+<h3><%text(_EBLOG_CAT_TITLE)%></h3>
+
+<%blogcatlist%>
+
+<form action="<%adminurl%>index.php" method="post">
+<p>
+<input name="action" value="categorynew" type="hidden" />
+<%ticket%>
+<input name="blogid" value="<%blogsetting(id)%>" type="hidden" />
+</p>
+
+<table frame="box" rules="all" summary="<%text(_EBLOG_CAT_CREATE)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_EBLOG_CAT_CREATE)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><%text(_EBLOG_CAT_NAME)%></td>
+<td><input name="cname" size="40" maxlength="40" tabindex="300" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_CAT_DESC)%></td>
+<td><input name="cdesc" size="40" maxlength="200" tabindex="310" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_CAT_CREATE)%></td>
+<td><input type="submit" value="<%text(_EBLOG_CAT_CREATE)%>" tabindex="320" /></td>
+</tr>
+</tbody>
+</table>
+
+</form>
+<h3><%text(_PLUGINS_EXTRA)%></h3>
+<%pluginextras(blog)%>
+<%pagefoot%>
+]]></part>
+<part name="bookmarklet"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>
+<h2><%text(_BOOKMARKLET_TITLE)%></h2>
+<p><%text(_BOOKMARKLET_DESC1)%><%text(_BOOKMARKLET_DESC2)%><%text(_BOOKMARKLET_DESC3)%><%text(_BOOKMARKLET_DESC4)%><%text(_BOOKMARKLET_DESC5)%></p>
+<h3><%text(_BOOKMARKLET_BOOKARKLET)%></h3>
+<p>
+<%text(_BOOKMARKLET_BMARKTEXT)%><small><%text(_BOOKMARKLET_BMARKTEST)%></small>
+<br />
+<br />
+<a href="<%bookmarkletadmin(url)%>"><%sprinttext(_BOOKMARKLET_ANCHOR,<|%getblogsetting(name)%|>)%></a><%text(_BOOKMARKLET_BMARKFOLLOW)%>
+</p>
+<%pagefoot%>
+]]></part>
+<part name="browseowncomments"><![CDATA[
+<%pagehead%>
+<p>(<a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a>)</p>
+<h2><%text(_COMMENTS_YOUR)%></h2>
+<%commentnavlist(admin/default)%><%pagefoot%>
+]]></part>
+<part name="browseownitems"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a></p>
+<h2><%text(_ITEMLIST_YOUR)%></h2>
+<%itemnavlist(admin/default)%><%pagefoot%>
+]]></part>
+<part name="categorydelete"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+<p>
+<%text(_CONFIRMTXT_CATEGORY)%><b><%categorysetting(name)%></b>
+</p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="categorydeleteconfirm" />
+<%ticket%>
+<input type="hidden" name="blogid" value="<%requestblogid%>" />
+<input type="hidden" name="catid" value="<%categorysetting(id)%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="categoryedit"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=blogsettings&blogid=<%requestblogid%>">(<%text(_BACK_TO_BLOGSETTINGS)%>)</a></p>
+<h2><%text(_EBLOG_CAT_UPDATE)%> '<%categorysetting(name)%>'</h2>
+<form method='post' action='<%adminurl%>index.php'>
+<p>
+<input name="blogid" type="hidden" value="<%requestblogid%>" />
+<input name="catid" type="hidden" value="<%categorysetting(id)%>" />
+<input name="desturl" type="hidden" value="<%editdesturl%>" />
+<input name="action" type="hidden" value="categoryupdate" />
+<%ticket%>
+</p>
+
+<table frame="box" rules="all" summary="<%text(_EBLOG_CAT_UPDATE)%>">
+<tr>
+<th colspan="2"><%text(_EBLOG_CAT_UPDATE)%></th>
+</tr>
+<tr>
+<td><%text(_EBLOG_CAT_NAME)%></td>
+<td><input type="text" name="cname" value="<%categorysetting(name)%>" size="40" maxlength="40" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_CAT_DESC)%></td>
+<td><input type="text" name="cdesc" value="<%categorysetting(desc)%>" size="40" maxlength="200" /></td>
+</tr>
+<%pluginoptions(category)%>
+<tr>
+<th colspan="2"><%text(_EBLOG_CAT_UPDATE)%></th>
+</tr>
+<tr>
+<td><%text(_EBLOG_CAT_UPDATE)%></td>
+<td><input type="submit" value="<%text(_EBLOG_CAT_UPDATE_BTN)%>" /></td>
+</tr>
+</table>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="commentdelete"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+<p><%text(_CONFIRMTXT_COMMENT)%></p>
+<p class="note">
+<b><%text(_EDITC_WHO)%>:</b> <%deletecomment(author)%><br />
+<b><%text(_EDITC_TEXT)%>:</b> <%deletecomment(body)%></div>
+</p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="commentdeleteconfirm" />
+<%ticket%>
+<input type="hidden" name="commentid" value="<%deletecomment(id)%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="commentedit"><![CDATA[
+<%pagehead%>
+<h2><%text(_EDITC_TITLE)%></h2>
+
+<form method="post" action="<%adminurl%>index.php">
+
+<p>
+<input type="hidden" name="action" value="commentupdate" />
+<%ticket%>
+<input type="hidden" name="commentid" value="<%editcomment(id)%>" />
+</p>
+
+<table frame="box" rules="all" summary="<%text(_EDITC_TITLE)%>">
+<tr>
+<th colspan="2"><%text(_EDITC_TITLE)%></th>
+</tr>
+<tr>
+<td><%text(_EDITC_WHO)%></td>
+<td><%editcomment(user)%></td>
+</tr>
+<tr>
+<td><%text(_EDITC_WHEN)%></td>
+<td><%editcomment(date)%></td>
+</tr>
+<tr>
+<td><%text(_EDITC_HOST)%></td>
+<td><%editcomment(host)%></td>
+</tr>
+<tr>
+<td><%text(_EDITC_URL)%></td>
+<td><input type="text" name="url" size="30" tabindex="6" value="<%editcomment(url)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EDITC_EMAIL)%></td>
+<td><input type="text" name="email" size="30" tabindex="8" value="<%editcomment(email)%>" /></td>
+</tr>
+<tr>
+<td><%text(_EDITC_TEXT)%></td>
+<td><textarea name="body" tabindex="10" rows="10" cols="50"><%editcomment(body)%></textarea></td>
+</tr>
+<tr>
+<td><%text(_EDITC_EDIT)%></td>
+<td><input type="submit" tabindex="20" value="<%text(_EDITC_EDIT)%>" onclick="return checkSubmit();" /></td>
+</tr>
+</table>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="createitem"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_ADD_ADDTO)%> '<%adminbloglink(admin/default)%>'</h2>
+ <%init%>
+ <script type="text/javascript" src="<%skinfile(/javascripts/numbercheck.js)%>"></script>
+ <%if(autosave)%><script type="text/javascript" src="<%skinfile(/javascripts/xmlhttprequest.js)%>"></script><%endif%>
+ <form id="addform" method="post" action="<%adminurl%>index.php" >
+ <p>
+ <input type="hidden" name="action" value="additem" />
+ <input name="blogid" value="<%blogid%>" type="hidden" />
+ <input type="hidden" name="draftid" value="0" />
+ <%ticket%>
+ </p>
+ <table frame="box" rules="all" summary="<%text(_ADD_ADDTO)%>">
+ <tr>
+ <th colspan="2"><%text(_ADD_CREATENEW)%></th>
+ </tr>
+ <%if(autosave)%>
+ <tr>
+ <td><%text(_AUTOSAVEDRAFT)%></td>
+ <td><span id="info"><%text(_AUTOSAVEDRAFT_NOTYETSAVED)%></span></td>
+ </tr>
+ <%endif%>
+ <tr>
+ <td><%text(_ADD_TITLE)%></td>
+ <td><input id="inputtitle" name="title" value="<%contents(title)%>" onkeyup="storeCaret(this); updPreview(title); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);" tabindex="10" size="60" maxlength="160" /></td>
+ </tr>
+ <tr>
+ <td>
+ <%text(_ADD_BODY)%> <%helplink(additem)%>
+ </td>
+ <td>
+ <div class="jsbuttonbar">
+ <!--[if IE]>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">
+ <img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">
+ <img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">
+ <img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+ <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+ <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+ <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />
+ </span>
+ <![endif]-->
+ <!--[if ! IE]>-->
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+ <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+ <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+ <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />
+ </span>
+ <!--<![endif]-->
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">
+ <img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">
+ <img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">
+ <img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">
+ <img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">
+ <img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">
+ <img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />
+ </span>
+ <!--[if IE]>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">
+ <img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />
+ </span>
+ <![endif]-->
+ <div class="jsbuttonend"></div>
+ </div>
+ <textarea id="inputbody" name="body" tabindex="20" cols="60" rows="20" onkeyup="storeCaret(this); updPreview(body); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);"><%contents(body)%></textarea>
+ </td>
+ </tr>
+ <tr id="edit" style="display:none;">
+ <td><%text(_ADD_PREVIEW)%></td>
+ <td><b><span id="prevtitle"> </span></b><br />
+ <span id="prevbody"> </span><br />
+ <span id="prevmore"> </span><br />
+ </td>
+ </tr>
+ <%if(blogsetting, bcomments)%>
+ <tr>
+ <td><%text(_ADD_DISABLE_COMMENTS)%></td>
+ <td>
+ <input name="closed" type="radio" tabindex="30" value="1" id="closed_yes" /><label for="closed_yes"><%text(_YES)%></label>
+ <input name="closed" type="radio" tabindex="30" value="0" checked="checked" id="closed_no" /><label for="closed_no"><%text(_NO)%></label>
+ </td>
+ </tr>
+ <%endif%>
+ <tr>
+ <td><%text(_ADD_CATEGORY)%></td>
+ <td><%categories(40)%></td>
+ </tr>
+ <tr>
+ <td><%text(_SUBMIT)%></td>
+ <td>
+ <input tabindex="60" type="submit" value="<%text(_ADD_ADDITEM)%>" onclick="return checkSubmit();" /><br />
+ <br />
+ <input name="actiontype" value="addnow" type="radio" checked='checked' id="act_now" tabindex="61" />
+ <label for="act_now"><%text(_ADD_ADDNOW)%></label><br />
+ <input type="radio" id="act_future" name="actiontype" value="addfuture" tabindex="61" />
+ <label for="act_future" ><%text(_ADD_ADDLATER)%></label> <%helplink(future)%>
+ <div class="indent">
+ <%text(_ADD_PLACE_ON)%>
+ <input type="text" id="inputyear" name="year" value="<%currenttime(year)%>" tabindex="63" size="4" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_YEAR_UNIT)%>
+ <input type="text" id="inputmonth" name="month" value="<%currenttime(mon)%>" tabindex="64" size="2" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_MONTH_UNIT)%>
+ <input type="text" id="inputday" name="day" value="<%currenttime(mday)%>" tabindex="65" size="2" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_DAY_UNIT)%>
+ <input id="inputhour" name="hour" value="<%currenttime(hours)%>" tabindex="66" size="2" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_HOUR_UNIT)%>
+ <input type="text" id="inputminutes" name="minutes" value="<%currenttime(minutes)%>" tabindex="67" size="2" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_MINUTE_UNIT)%><br />
+
+ <%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_LABEL_YEAR_UNIT)%>(mm)<%text(_LABEL_MONTH_UNIT)%>(dd)<%text(_LABEL_DAY_UNIT)%> (hh)<%text(_LABEL_HOUR_UNIT)%>(mm)<%text(_LABEL_MINUTE_UNIT)%>
+
+ <%if(blogsetting, ballowpast,0)%>
+ <br />
+ <%text(_ADD_NOPASTDATES)%>
+ <%endif%>
+ </div>
+ <input type="radio" id="act_draft" name="actiontype" value="adddraft" tabindex="61" />
+ <label for="act_draft"><%text(_ADD_ADDDRAFT)%></label> <%helplink(draft)%>
+ </td>
+ </tr>
+ <tr>
+ <td><%text(_ADD_PLUGIN_EXTRAS)%></td>
+ <td><%pluginextras%></td>
+ </tr>
+ <%pluginoptions(item)%>
+ <tr>
+ <th colspan="2"><%text(_ADD_MORE)%></th>
+ </tr>
+ <tr>
+ <td><%text(_ADD_MORE)%><br />
+ <%helplink(extended)%>
+ </td>
+ <td>
+ <div class="jsbuttonbar">
+ <!--[if IE]>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">
+ <img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">
+ <img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">
+ <img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+ <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+ <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+ <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />
+ </span>
+ <![endif]-->
+ <!--[if ! IE]>-->
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+ <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+ <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+ <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />
+ </span>
+ <!--<![endif]-->
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">
+ <img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">
+ <img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">
+ <img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">
+ <img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">
+ <img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">
+ <img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />
+ </span>
+ <!--[if IE]>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">
+ <img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />
+ </span>
+ <![endif]-->
+ </div>
+ <textarea id="inputmore" name="more" onkeyup="storeCaret(this); updPreview(more); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);" tabindex="70" cols="60" rows="20"><%contents(more)%></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td><%text(_SUBMIT)%></td>
+ <td>
+ <input type="submit" value="<%text(_ADD_ADDITEM)%>" onclick="return checkSubmit();" tabindex="60" />
+ <%if(autosave)%>
+ <input type="button" name="autosavenow" value="<%text(_AUTOSAVEDRAFT_NOW)%>" tabindex="80" onclick="autoSaveDraft();" />
+ <%endif%>
+ </td>
+ </tr>
+ </table>
+
+ </form>
+ <%if(autosave)%>
+ <script type="text/javascript">
+ var xmlhttprequest = new Array();
+ xmlhttprequest[0] = createHTTPHandler(); // AutoDraft handler
+ xmlhttprequest[1] = createHTTPHandler(); // UpdateTicket handler
+ var seconds = now(); // Last AutoDraft time
+ var checks = 0; // Number of checks since last AutoDraft
+ var addform = document.getElementById('addform'); // The form id
+ var goal = document.getElementById('info'); // The html div id where 'Last saved: date time' must come
+ var goalurl = '../action.php'; // The PHP file where the content must be posted to
+ var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'
+ var formtype = 'add'; // Add or edit form
+ </script>
+ <%endif%>
+ <%pagefoot%>
+]]></part>
+<part name="createnewlog"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+<h2><%text(_EBLOG_CREATE_TITLE)%></h2>
+<h3><%text(_ADMIN_NOTABILIA)%></h3>
+<p><%text(_ADMIN_PLEASE_READ)%></p>
+<p><%text(_ADMIN_HOW_TO_ACCESS)%></p>
+<ol>
+<li><%text(_ADMIN_SIMPLE_WAY)%></li>
+<li><%text(_ADMIN_ADVANCED_WAY)%></li>
+</ol>
+
+<h3><%text(_ADMIN_HOW_TO_CREATE)%></h3>
+
+<p><%text(_EBLOG_CREATE_TEXT)%></p>
+
+<form method="post" action="<%adminurl%>index.php">
+
+<p>
+<input type="hidden" name="action" value="addnewlog" />
+<%ticket%>
+</p>
+
+<table frame="box" rules="all" summary="<%text(_EBLOG_CREATE_TEXT)%>">
+<tr>
+<td><%text(_EBLOG_NAME)%></td>
+<td><input name="name" tabindex="10" size="40" maxlength="60" /></td>
+</tr>
+<tr>
+<td>
+<%text(_EBLOG_SHORTNAME)%>
+<%helplink(shortblogname)%>
+</td>
+<td><input name="shortname" tabindex="20" maxlength="15" size="15" /></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_DESC)%></td>
+<td><input name="desc" tabindex="30" maxlength="200" size="40" /></td>
+</tr>
+<tr>
+<td>
+<%text(_EBLOG_DEFSKIN)%>
+<%helplink(blogdefaultskin)%>
+</td>
+<td><%defskinselect(blog,admin/default)%></td>
+</tr>
+<tr>
+<td>
+<%text(_EBLOG_OFFSET)%>
+<%helplink(blogtimeoffset)%><br />
+<%text(_EBLOG_STIME)%> <b><%blogtime(servertime,"%H:%M")%></b>
+</td>
+<td><input name="timeoffset" tabindex="110" size="3" value="0" /></td>
+</tr>
+<tr>
+<td>
+<%text(_EBLOG_ADMIN)%>
+<%helplink(teamadmin)%>
+</td>
+<td><%text(_EBLOG_ADMIN_MSG)%></td>
+</tr>
+<tr>
+<td><%text(_EBLOG_CREATE)%></td>
+<td><input type="submit" tabindex="120" value="<%text(_EBLOG_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>
+</tr>
+</table>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="deleteblog"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+
+<p>
+<%text(_WARNINGTXT_BLOGDEL)%>
+</p>
+
+<p>
+<%text(_CONFIRMTXT_BLOG)%><b><%blogsetting(name)%></b>
+</p>
+
+<form method="post" action="<%adminurl%>index.php">
+
+<p>
+<input type="hidden" name="action" value="deleteblogconfirm" />
+<%ticket%>
+<input type="hidden" name="blogid" value="<%requestblogid%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="editmembersettings"><![CDATA[
+<%pagehead%>
+<p>
+<%if(superadmin)%>
+<a href="<%adminurl%>index.php?action=usermanagement">(<%text(_MEMBERS_BACKTOOVERVIEW)%>)
+<%else%>
+<a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)
+<%endif%>
+</a>
+</p>
+<h2><%text(_MEMBERS_EDIT)%></h2>
+
+<form method="post" action="<%adminurl%>index.php" name="memberedit">
+
+<p>
+<input type="hidden" name="action" value="changemembersettings" />
+<input type="hidden" name="memberid" value="<%editmember(id)%>" />
+<%ticket%>
+</p>
+
+<table frame="box" rules="all" summary="<%text(_MEMBERS_EDIT)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_MEMBERS_EDIT)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+<%text(_MEMBERS_DISPLAY)%> <%helplink(shortnames)%><br />
+<small><%text(_MEMBERS_DISPLAY_INFO)%></small>
+</td>
+<td><%editmember(displayname)%></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_REALNAME)%></td>
+<td><input name="realname" tabindex="20" maxlength="60" size="40" value="<%editmember(realname)%>" /></td>
+</tr>
+<tr><%if(allowloginedit)%>
+<td><%text(_MEMBERS_PWD)%></td>
+<td><input type="password" tabindex="30" maxlength="40" size="16" name="password" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_REPPWD)%></td>
+<td><input type="password" tabindex="35" maxlength="40" size="16" name="repeatpassword" /></td>
+</tr>
+<tr><%endif%>
+<td>
+<%text(_MEMBERS_EMAIL)%><br />
+<small><%text(_MEMBERS_EMAIL_EDIT)%></small>
+</td>
+<td><input name="email" tabindex="40" size="40" maxlength="60" value="<%editmember(email)%>" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_URL)%></td>
+<td><input name="url" tabindex="50" size="40" maxlength="100" value="<%editmember(url)%>" /></td>
+</tr>
+<%if(superadmin)%>
+<tr>
+<td><%text(_MEMBERS_SUPERADMIN)%> <%helplink(superadmin)%></td>
+<td><%editmember(admin)%></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_CANLOGIN)%> <%helplink(canlogin)%></td>
+<td><%editmember(canlogin)%></td><%endif%>
+</tr>
+<tr>
+<td><%text(_MEMBERS_NOTES)%></td>
+<td><input name="notes" tabindex="80" size="40" maxlength="100" value="<%editmember(notes)%>" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_LOCALE)%> <%helplink(locale)%></td>
+<td>
+<select name="locale" tabindex="85">
+<%localeselectoptions%>
+</select>
+</td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_USEAUTOSAVE)%> <%helplink(autosave)%></td>
+<td><%editmember(autosave)%></td>
+</tr><%if(superadmin)%><tr>
+<td><%text(_SKINABLEADMIN_MEMBERS_ADMINSKIN)%> <%customhelplink(useadminskin)%></td>
+<td>
+<%defadminskinselect(admin/default)%>
+</td>
+</tr><%endif%><%if(superadmin)%><tr>
+<td><%text(_MEMBERS_BKMKLTSKIN)%></td>
+<td>
+<%defbookmarkletselect(admin/default)%>
+</td>
+</tr>
+<%endif%>
+<%pluginoptions(member)%>
+</tbody>
+</table>
+
+<table frame="box" rules="all" summary="<%text(_MEMBERS_EDIT)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_MEMBERS_EDIT)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><%text(_MEMBERS_EDIT)%></td>
+<td><input type="submit" tabindex="90" value="<%text(_MEMBERS_EDIT_BTN)%>" onclick="return checkSubmit();" /></td>
+</tr>
+</tbody>
+</table>
+</form>
+<h3><%text(_PLUGINS_EXTRA)%></h3>
+<%pluginextras(member)%>
+<%pagefoot%>
+]]></part>
+<part name="itemcommentlist"><![CDATA[
+<%pagehead%>
+<p>(<a href="<%adminurl%>index.php?action=itemlist&blogid=<%requestblogid%>"><%text(_BACKTOOVERVIEW)%></a>)</p>
+<h2><%text(_COMMENTS)%></h2>
+<%commentnavlist(admin/default)%>
+<%pagefoot%>
+]]></part>
+<part name="itemdelete"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+<p><%text(_CONFIRMTXT_ITEM)%></p>
+<p class="note">
+<b>"<%deleteitemtitle%>"</b><br />
+<%deleteitembody%>
+</p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="itemdeleteconfirm" />
+<%ticket%>
+<input type="hidden" name="itemid" value="<%deleteitemid%>" />
+<input type="submit" value="<%text(_DELETE_CONFIRM_BTN)%>" tabindex="10" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="itemedit"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_EDIT_ITEM)%></h2>
+
+ <%init%>
+ <script type="text/javascript" src="<%skinfile(/javascripts/numbercheck.js)%>"></script>
+ <%if(autosave)%>
+ <script type="text/javascript" src="<%skinfile(/javascripts/xmlhttprequest.js)%>"></script>
+ <%endif%>
+
+ <form id="editform" method="post" action="<%adminurl%>index.php">
+
+ <p>
+ <input type="hidden" name="action" value="itemupdate" />
+ <input name="itemid" value="<%contents(itemid)%>" type="hidden" />
+ <input type="hidden" name="draftid" value="0" />
+ <%ticket%>
+ </p>
+
+ <table frame="box" rules="all" summary="<%text(_EDIT_ITEM)%>">
+ <tr>
+ <th colspan="2"><%text(_EDIT_ITEM)%></th>
+ </tr>
+ <%if(autosave)%><tr>
+ <td><%text(_AUTOSAVEDRAFT)%></td>
+ <td><span id="info"><%text(_AUTOSAVEDRAFT_NOTYETSAVED)%></span></td>
+ </tr>
+ <%endif%>
+ <tr>
+ <td><%text(_EDIT_ORIG_AUTHOR)%></td>
+ <td><%contents(author)%></td>
+ </tr>
+ <tr>
+ <td><%text(_ADD_TITLE)%></td>
+ <td><input type="text" id="inputtitle" name="title" value="<%contents(title)%>" tabindex="10" size="60" maxlength="160" onkeyup="storeCaret(this); updPreview(title); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);" />
+ </td>
+ </tr>
+ <tr>
+ <td><%text(_ADD_BODY)%></td>
+ <td>
+ <div class="jsbuttonbar">
+ <!--[if IE]>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">
+ <img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">
+ <img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">
+ <img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+ <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+ <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+ <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />
+ </span>
+ <![endif]-->
+ <!--[if ! IE]>-->
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+ <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+ <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+ <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />
+ </span>
+ <!--<![endif]-->
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">
+ <img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">
+ <img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">
+ <img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">
+ <img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">
+ <img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">
+ <img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />
+ </span>
+ <!--[if IE]>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">
+ <img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />
+ </span>
+ <![endif]-->
+ </div>
+ <textarea id="inputbody" name="body" tabindex="20" cols="60" rows="20" onkeyup="storeCaret(this); updPreview(body); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);"><%contents(body)%></textarea>
+ </td>
+ </tr>
+ <tr id="edit" style="display:none;">
+ <td><%text(_ADD_PREVIEW)%></td>
+ <td><b><span id="prevtitle"> </span></b><br />
+ <span id="prevbody"> </span><br />
+ <span id="prevmore"> </span><br />
+ </td>
+ </tr>
+
+ <%if(blogsetting, bcomments)%>
+ <tr>
+ <td><%text(_ADD_DISABLE_COMMENTS)%></td>
+ <td>
+ <input type="radio" name="closed" value="1" <%checkedonval(1,closed)%> tabindex="30" id="closed_yes" /><label for="closed_yes"><%text(_YES)%></label>
+ <input type="radio" name="closed" value="0" <%checkedonval(0,closed)%> tabindex="30" id="closed_no" /><label for="closed_no"><%text(_NO)%></label><br />
+ <small><%text(_EDIT_COMMENTSNOTE)%></small>
+ </td>
+ </tr>
+ <%endif%>
+
+ <tr>
+ <td><%text(_ADD_CATEGORY)%></td>
+ <td><%categories(40)%></td>
+ </tr>
+ <tr>
+ <td><%text(_EDIT_SUBMIT)%></td>
+ <td>
+ <input type="submit" tabindex="60" value="<%text(_EDIT_SUBMIT)%>" onclick="return checkSubmit();" />
+ <%if(itemproperty, draft)%>
+ <br />
+ <br />
+ <input name="actiontype" value="addnow" type="radio" id="act_now" />
+ <label for="act_now" tabindex="61"><%text(_ADD_ADDNOW)%></label><br />
+ <input name="actiontype" value="addfuture" type="radio" id="act_future" tabindex="61" /><label for="act_future"><%text(_ADD_ADDLATER)%></label> <%helplink(future)%>
+ <div class="indent">
+ <%text(_ADD_PLACE_ON)%>
+ <input type="text" id="inputyear" name="year" tabindex="71" size="4" value="<%currenttime(year)%>" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_YEAR_UNIT)%>
+ <input type="text" id="inputmonth" name="month" tabindex="72" size="2" value="<%currenttime(mon)%>" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_MONTH_UNIT)%>
+ <input type="text" id="inputday" name="day" tabindex="73" size="2" value="<%currenttime(mday)%>" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_DAY_UNIT)%>
+
+ <input type="text" id="inputhour" name="hour" tabindex="74" size="2" value="<%currenttime(hours)%>" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_HOUR_UNIT)%>
+ <input type="text" id="inputminutes" name="minutes" tabindex="75" size="2" value="<%currenttime(minutes)%>" onchange="document.forms[0].act_future.checked=true;" />
+ <%text(_LABEL_MINUTE_UNIT)%><br />
+ <%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_LABEL_YEAR_UNIT)%>(mm)<%text(_LABEL_MONTH_UNIT)%>(dd)<%text(_LABEL_DAY_UNIT)%> (hh)<%text(_LABEL_HOUR_UNIT)%>(mm)<%text(_LABEL_MINUTE_UNIT)%>
+
+ <%if(blogsetting, ballowpast,0)%>
+ <br />
+ <%text(_ADD_NOPASTDATES)%>
+ <%endif%>
+
+ </div>
+ <input type="radio" id="act_draft" name="actiontype" value="adddraft" checked='checked' tabindex="61" />
+ <label for="act_draft"><%text(_EDIT_BACKTODRAFTS)%></label> <%helplink(draft)%><br />
+ <input type="radio" id="act_delete" name="actiontype" value="delete" tabindex="61" />
+ <label for="act_delete"><%text(_BMLET_DELETE)%></label>
+ <%endif%>
+
+ <%if(itemproperty, draft,0)%>
+ <br />
+ <br />
+ <input type="radio" id="act_edit" name="actiontype" value="edit" checked="checked" tabindex="61" />
+ <label for="act_edit"><%text(_BMLET_EDIT)%></label>
+ <%if(blogsetting, ballowpast)%>
+ <br />
+ <input type="radio" id="act_changedate" name="actiontype" value="changedate" tabindex="70" />
+ <label for="act_changedate"><%text(_ADD_CHANGEDATE)%></label> <%helplink(changedate)%>
+ <div class="indent">
+ <input type="text" id="inputyear" name="year" value="<%itemtime(year)%>" size="4" tabindex="71" onchange="document.forms[0].act_changedate.checked=true;" />
+ <%text(_LABEL_YEAR_UNIT)%>
+ <input type="text" id="inputmonth" name="month" value="<%itemtime(mon)%>" size="2" tabindex="72" onchange="document.forms[0].act_changedate.checked=true;" />
+ <%text(_LABEL_MONTH_UNIT)%>
+ <input type="text" id="inputday" name="day" value="<%itemtime(mday)%>" size="2" tabindex="73" onchange="document.forms[0].act_changedate.checked=true;" />
+ <%text(_LABEL_DAY_UNIT)%>
+ <input type="text" id="inputhour" name="hour" value="<%itemtime(hours)%>" size="2" tabindex="74" onchange="document.forms[0].act_changedate.checked=true;" />
+ <%text(_LABEL_HOUR_UNIT)%>
+ <input type="text" id="inputminutes" name="minutes" value="<%itemtime(minutes)%>" size="2" tabindex="75" onchange="document.forms[0].act_changedate.checked=true;" />
+ <%text(_LABEL_MINUTE_UNIT)%>
+ <br /><%text(_ITEM_ADDEDITTEMPLATE_FORMAT)%>(yyyy)<%text(_LABEL_YEAR_UNIT)%>(mm)<%text(_LABEL_MONTH_UNIT)%>(dd)<%text(_LABEL_DAY_UNIT)%> (hh)<%text(_LABEL_HOUR_UNIT)%>(mm)<%text(_LABEL_MINUTE_UNIT)%>
+ </div>
+ <%endif%>
+ <input type="radio" id="act_backtodrafts" name="actiontype" value="backtodrafts" tabindex="71" />
+ <label for="act_backtodrafts"><%text(_BMLET_BACKTODRAFTS)%></label> <%helplink(draft)%><br />
+ <input type="radio" id="act_delete" name="actiontype" value="delete" tabindex="61" />
+ <label for="act_delete"><%text(_BMLET_DELETE)%></label>
+ <%endif%>
+
+ </td>
+ </tr>
+ <tr>
+ <td><%text(_ADD_PLUGIN_EXTRAS)%></td>
+ <td><%pluginextras%></td>
+ </tr>
+ <%pluginoptions(item)%>
+ <tr>
+ <th colspan="2"><%text(_ADD_MORE)%></th>
+ </tr>
+ <tr>
+ <td>
+ <%text(_ADD_MORE)%><br />
+ <%helplink(extended)%>
+ </td>
+ <td>
+ <div class="jsbuttonbar">
+ <!--[if IE]>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="cutThis()">
+ <img src="<%skinfile(/images/button-cut.gif)%>" title="<%text(_ADD_CUT_TT)%>(Ctrl + X)" alt="<%text(_ADD_CUT_TT)%>(Ctrl + X)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="copyThis()">
+ <img src="<%skinfile(/images/button-copy.gif)%>" title="<%text(_ADD_COPY_TT)%>(Ctrl + C)" alt="<%text(_ADD_COPY_TT)%>(Ctrl + C)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="pasteThis()">
+ <img src="<%skinfile(/images/button-paste.gif)%>" title="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" alt="<%text(_ADD_PASTE_TT)%>(Ctrl + V)" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+ <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" alt="<%text(_ADD_BOLD_TT)%>(Ctrl + Shift + B)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+ <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" alt="<%text(_ADD_ITALIC_TT)%>(Ctrl + Shift + I)" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+ <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" alt="<%text(_ADD_HREF_TT)%>(Ctrl + Shift + A)" width="16" height="16" />
+ </span>
+ <![endif]-->
+ <!--[if ! IE]>-->
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="boldThis()">
+ <img src="<%skinfile(/images/button-bold.gif)%>" title="<%text(_ADD_BOLD_TT)%>" alt="<%text(_ADD_BOLD_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="italicThis()">
+ <img src="<%skinfile(/images/button-italic.gif)%>" title="<%text(_ADD_ITALIC_TT)%>" alt="<%text(_ADD_ITALIC_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="ahrefThis()">
+ <img src="<%skinfile(/images/button-link.gif)%>" title="<%text(_ADD_HREF_TT)%>" alt="<%text(_ADD_HREF_TT)%>" width="16" height="16" />
+ </span>
+ <!--<![endif]-->
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignleftThis()">
+ <img src="<%skinfile(/images/button-alignleft.gif)%>" title="<%text(_ADD_ALIGNLEFT_TT)%>" alt="<%text(_ADD_ALIGNLEFT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="alignrightThis()">
+ <img src="<%skinfile(/images/button-alignright.gif)%>" title="<%text(_ADD_ALIGNRIGHT_TT)%>" alt="<%text(_ADD_ALIGNRIGHT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="aligncenterThis()">
+ <img src="<%skinfile(/images/button-aligncenter.gif)%>" title="<%text(_ADD_ALIGNCENTER_TT)%>" alt="<%text(_ADD_ALIGNCENTER_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="leftThis()">
+ <img src="<%skinfile(/images/button-left.gif)%>" title="<%text(_ADD_LEFT_TT)%>" alt="<%text(_ADD_LEFT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="rightThis()">
+ <img src="<%skinfile(/images/button-right.gif)%>" title="<%text(_ADD_RIGHT_TT)%>" alt="<%text(_ADD_RIGHT_TT)%>" width="16" height="16" />
+ </span>
+ <span class="jsbuttonspacer"> </span>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="addMedia()">
+ <img src="<%skinfile(/images/button-media.gif)%>" title="<%text(_ADD_MEDIA_TT)%>" alt="<%text(_ADD_MEDIA_TT)%>" width="16" height="16" />
+ </span>
+ <!--[if IE]>
+ <span class="jsbutton" onmouseover="BtnHighlight(this);" onmouseout="BtnNormal(this);" onclick="showedit()">
+ <img src="<%skinfile(/images/button-preview.gif)%>" title="<%text(_ADD_PREVIEW_TT)%>" alt="<%text(_ADD_PREVIEW_TT)%>" width="16" height="16" />
+ </span>
+ <![endif]-->
+ </div>
+ <textarea id="inputmore" name="more" cols="60" rows="20" tabindex="90" onkeyup="storeCaret(this); updPreview(more); doMonitor();" onclick="storeCaret(this);" onselect="storeCaret(this);"><%contents(more)%></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td><%text(_SUBMIT)%></td>
+ <td>
+ <input type="submit" value="<%text(_EDIT_SUBMIT)%>" tabindex="60" onclick="return checkSubmit();" />
+ <%if(autosave)%>
+ <input type="button" name="autosavenow" value="<%text(_AUTOSAVEDRAFT_NOW)%>" tabindex="80" onclick="autoSaveDraft();" />
+ <%endif%>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </form>
+ <%if(autosave)%>
+ <script type="text/javascript">
+ var xmlhttprequest = new Array();
+ xmlhttprequest[0] = createHTTPHandler(); // AutoDraft handler
+ xmlhttprequest[1] = createHTTPHandler(); // UpdateTicket handler
+ var seconds = now(); // Last AutoDraft time
+ var checks = 0; // Number of checks since last AutoDraft
+ var addform = document.getElementById('editform'); // The form id
+ var goal = document.getElementById('info'); // The html div id where 'Last saved: date time' must come
+ var goalurl = '../action.php'; // The PHP file where the content must be posted to
+ var lastsavedtext = '<%text(_AUTOSAVEDRAFT_LASTSAVED)%>'; // The language variable for 'Last saved'
+ var formtype = 'edit'; // Add or edit form
+ </script>
+ <%endif%>
+ <%pagefoot%>
+]]></part>
+<part name="itemlist"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>
+<h2><%text(_ITEMLIST_BLOG)%><%adminbloglink(admin/default)%></h2>
+<%ilistaddnew%>
+<%itemnavlist(admin/default)%>
+<%pagefoot%>
+]]></part>
+<part name="itemmove"><![CDATA[
+<%pagehead%>
+<h2><%text(_MOVE_TITLE)%></h2>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="itemmoveto" />
+<input type="hidden" name="itemid" value="<%moveitemid%>" />
+<%ticket%>
+<%movedistselect%>
+<input type="submit" value="<%text(_MOVE_BTN)%>" tabindex="10000" onclick="return checkSubmit();" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="manage"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=overview">(<%text(_BACKHOME)%>)</a></p>
+<%headmessage%>
+<h2><%text(_MANAGE_GENERAL)%></h2>
+
+<ul>
+<li><a href="<%adminurl%>index.php?action=createnewlog"><%text(_OVERVIEW_NEWLOG)%></a></li>
+<li><a href="<%adminurl%>index.php?action=settingsedit"><%text(_OVERVIEW_SETTINGS)%></a></li>
+<li><a href="<%adminurl%>index.php?action=usermanagement"><%text(_OVERVIEW_MEMBERS)%></a></li>
+<li><a href="<%adminurl%>index.php?action=actionlog"><%text(_OVERVIEW_VIEWLOG)%></a></li>
+</ul>
+
+<h2><%text(_MANAGE_SKINS)%></h2>
+<ul>
+<li><a href="<%adminurl%>index.php?action=skinoverview"><%text(_OVERVIEW_SKINS)%></a></li>
+<li><a href="<%adminurl%>index.php?action=templateoverview"><%text(_OVERVIEW_TEMPLATES)%></a></li>
+<li><a href="<%adminurl%>index.php?action=skinieoverview"><%text(_OVERVIEW_SKINIMPORT)%></a></li>
+</ul>
+
+<h2><%text(_MANAGE_EXTRA)%></h2>
+<ul>
+<li><a href="<%adminurl%>index.php?action=backupoverview"><%text(_OVERVIEW_BACKUP)%></a></li>
+<li><a href="<%adminurl%>index.php?action=pluginlist"><%text(_OVERVIEW_PLUGINS)%></a></li>
+</ul><%pagefoot%>
+]]></part>
+<part name="manageteam"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=blogsettings&blogid=<%requestblogid%>">(<%text(_BACK_TO_BLOGSETTINGS)%>)</a></p>
+<h2><%text(_TEAM_TITLE)%><%blogsetting(name)%></h2>
+<h3><%text(_TEAM_CURRENT)%></h3>
+<%blogteamlist(admin/default)%>
+<h3><%text(_TEAM_ADDNEW)%></h3>
+
+<form method='post' action='<%adminurl%>index.php'>
+
+<p>
+<input type='hidden' name='action' value='teamaddmember' />
+<input type='hidden' name='blogid' value='<%requestblogid%>' />
+<%ticket%>
+</p>
+
+<table frame="box" rules="all" summary="<%text(_TEAM_ADDNEW)%>">
+<tr>
+<td><%text(_TEAM_CHOOSEMEMBER)%></td>
+<td><%newmemberselect%></td>
+</tr>
+<tr>
+<td><%text(_TEAM_ADMIN)%><%helplink(teamadmin)%></td>
+<td><%inputyesno(admin,0,10020)%></td>
+</tr>
+<tr>
+<td><%text(_TEAM_ADD)%></td>
+<td><input type='submit' value='<%text(_TEAM_ADD_BTN)%>' tabindex="10030" /></td>
+</tr>
+</table>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="memberdelete"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+<p><%text(_CONFIRMTXT_MEMBER%><b><%editmember(displayname)%></b></p>
+<p><%text(_WARNINGTXT_NOTDELMEDIAFILES)%></p>
+
+<form method="post" action="<%adminurl%>index.php">
+
+<p>
+<input type="hidden" name="action" value="memberdeleteconfirm" />
+<%ticket%>
+<input type="hidden" name="memberid" value="<%editmember(id)%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="overview"><![CDATA[
+<%pagehead%>
+<%headmessage%>
+<h2><%text(_OVERVIEW_YRBLOGS)%></h2>
+<%yrbloglist(admin/default)%>
+<h2><%text(_OVERVIEW_YRSETTINGS)%></h2>
+<ul>
+<li><a href="<%adminurl%>index.php?action=editmembersettings"><%text(_OVERVIEW_EDITSETTINGS)%></a></li>
+<li><a href="<%adminurl%>index.php?action=browseownitems"><%text(_OVERVIEW_BROWSEITEMS)%></a></li>
+<li><a href="<%adminurl%>index.php?action=browseowncomments"><%text(_OVERVIEW_BROWSECOMM)%></a></li>
+</ul>
+<%if(superadmin)%>
+<h2><%text(_OVERVIEW_MANAGEMENT)%></h2>
+<ul>
+<li><a href="<%adminurl%>index.php?action=manage"><%text(_OVERVIEW_MANAGE)%></a></li>
+</ul>
+<%pagefoot%>
+]]></part>
+<part name="pagefoot"><![CDATA[
+ <%if(loggedin)%>
+ <%ifnot(adminaction,showlogin)%>
+ <h2><%text(_LOGOUT)%></h2>
+ <ul>
+ <li><a href="<%adminurl%>index.php?action=overview"><%text(_BACKHOME)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=logout"><%text(_LOGOUT)%></a></li>
+ </ul>
+ <%endif%>
+ <%endif%>
+
+ <p class="foot">
+ <a href="<%text(_ADMINPAGEFOOT_OFFICIALURL)%>">Nucleus CMS</a> © 2002- <%date(%Y)%> <%text(_ADMINPAGEFOOT_COPYRIGHT)%>
+ - <a href="<%text(_ADMINPAGEFOOT_DONATEURL)%>"><%text(_ADMINPAGEFOOT_DONATE)%></a>
+ </p>
+ </div>
+
+ <!-- content -->
+ <div id="quickmenu">
+
+ <%if(loggedin)%>
+ <%ifnot(adminaction,showlogin)%>
+ <ul>
+ <li><a href="<%adminurl%>index.php?action=overview"><%text(_QMENU_HOME)%></a></li>
+ </ul>
+
+ <h2><%text(_QMENU_ADD)%></h2>
+ <form method="get" action="<%adminurl%>index.php">
+ <div>
+ <input type="hidden" name="action" value="createitem" />
+ <%qmenuaddselect(admin/default)%>
+ </div>
+ </form>
+
+ <h2><%member(yourrealname)%></h2>
+ <ul>
+ <li><a href="<%adminurl%>index.php?action=editmembersettings"><%text(_QMENU_USER_SETTINGS)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=browseownitems"><%text(_QMENU_USER_ITEMS)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=browseowncomments"><%text(_QMENU_USER_COMMENTS)%></a></li>
+ </ul>
+
+ <%if(superadmin)%>
+ <h2><%text(_QMENU_MANAGE)%></h2>
+ <ul>
+ <li><a href="<%adminurl%>index.php?action=actionlog"><%text(_QMENU_MANAGE_LOG)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=settingsedit"><%text(_QMENU_MANAGE_SETTINGS)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=systemoverview"><%text(_QMENU_MANAGE_SYSTEM)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=usermanagement"><%text(_QMENU_MANAGE_MEMBERS)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=createnewlog"><%text(_QMENU_MANAGE_NEWBLOG)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=backupoverview"><%text(_QMENU_MANAGE_BACKUPS)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=pluginlist"><%text(_QMENU_MANAGE_PLUGINS)%></a></li>
+ </ul>
+ <h2><%text(_QMENU_LAYOUT)%></h2>
+ <ul>
+ <li><a href="<%adminurl%>index.php?action=skinoverview"><%text(_QMENU_LAYOUT_SKINS)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=templateoverview"><%text(_QMENU_LAYOUT_TEMPL)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=skinieoverview"><%text(_QMENU_LAYOUT_IEXPORT)%></a></li>
+ </ul>
+ <h2><%text(_SKINABLEADMIN_QMENU_LAYOUT)%></h2>
+ <ul>
+ <li><a href="<%adminurl%>index.php?action=adminskinoverview"><%text(_QMENU_LAYOUT_SKINS)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=admintemplateoverview"><%text(_QMENU_LAYOUT_TEMPL)%></a></li>
+ <li><a href="<%adminurl%>index.php?action=adminskinieoverview"><%text(_QMENU_LAYOUT_IEXPORT)%></a></li>
+ </ul>
+ <%endif%>
+
+ <%quickmenu(admin/default)%>
+ <%endif%>
+
+ <%elseif(adminaction,activate)%>
+ <h2><%text(_QMENU_ACTIVATE)%></h2>
+ <%text(_QMENU_ACTIVATE_TEXT)%>
+
+ <%elseif(adminaction,activatesetpwd)%>
+ <h2><%text(_QMENU_ACTIVATE)%></h2><%text(_QMENU_ACTIVATE_TEXT)%>
+
+ <%else%>
+ <h2><%text(_QMENU_INTRO)%></h2><%text(_QMENU_INTRO_TEXT)%>
+
+ <%endif%>
+
+ </div>
+ <!-- content / quickmenu container -->
+ <div class="clear"></div>
+ <!-- new -->
+ </div>
+ <!-- adminwrapper -->
+ <!-- new -->
+ </div>
+ <!-- new -->
+ <p style="text-align:right;"><%benchmark%></p>
+ </body>
+ </html>
+]]></part>
+<part name="pagehead"><![CDATA[
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%locale%>" lang="<%locale%>">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=<%charset%>" />
+<title><%sitevar(name)%> - Admin</title>
+<link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<%skinfile(/styles/admin_contemporary.css)%>" />
+<link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<%skinfile(/styles/addedit.css)%>" />
+
+<script type="text/javascript" src="<%skinfile(/javascripts/edit.js)%>"></script>
+<script type="text/javascript" src="<%skinfile(/javascripts/admin.js)%>"></script>
+<script type="text/javascript" src="<%skinfile(/javascripts/compatibility.js)%>"></script>
+
+<meta http-equiv='Pragma' content='no-cache' />
+<meta http-equiv='Cache-Control' content='no-cache, must-revalidate' />
+<meta http-equiv='Expires' content='-1' />
+<%extrahead%>
+</head>
+<body>
+<div id="adminwrapper">
+<div class="header">
+<h1><%sitevar(name)%></h1>
+</div>
+<div id="container">
+<div id="content">
+<div class="loginname">
+<%if(loggedin)%>
+<%text(_LOGGEDINAS)%> <%member(yourrealname)%> - <a href="<%adminurl%>index.php?action=logout"><%text(_LOGOUT)%></a><br /><a href="<%adminurl%>index.php?action=overview"><%text(_ADMINHOME)%></a> -
+<%else%>
+<a href="<%adminurl%>index.php?action=showlogin" title="Log in"><%text(_NOTLOGGEDIN)%></a><br />
+<%endif%>
+<a href="<%sitevar(url)%>"><%text(_YOURSITE)%></a><br />
+(
+<%if(superadmin)%>
+<a href="<%versioncheckurl%>" title="<%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE)%>"><%version%><%codename%></a>
+<%else%>
+<%version%><%codename%>
+<%endif%>
+)
+</div>
+]]></part>
+<part name="plugindelete"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+
+<p><%text(_CONFIRMTXT_PLUGIN)%> <strong><%editpluginfo(name)%></strong>?</p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<%ticket%>
+<input type="hidden" name="action" value="plugindeleteconfirm" />
+<input type="hidden" name="plugid" value="<%editpluginfo(id)%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="pluginhelp"><![CDATA[
+<p><a href="<%adminurl%>index.php?action=pluginlist">(<%text(_PLUGS_BACK)%>)</a></p>
+<h2><%text(_PLUGS_HELP_TITLE)%>: <%helpplugname%></h2>
+<%pluginhelp%>
+]]></part>
+<part name="pluginlist"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+<h2><%text(_PLUGS_TITLE_MANAGE)%><%helplink(plugins)%></h2>
+<h3><%text(_PLUGS_TITLE_INSTALLED)%> <span style="font-size:smaller"><%helplink('getplugins')%><%text(_PLUGS_TITLE_GETPLUGINS)%></a></span></h3>
+<%pluginlistlist(admin/default)%>
+<h3><%text(_PLUGS_TITLE_UPDATE)%></h3>
+<p><%text(_PLUGS_TEXT_UPDATE)%></p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="pluginupdate" />
+<%ticket%>
+<input type="submit" value="<%text(_PLUGS_BTN_UPDATE)%>" tabindex="20" />
+</p>
+</form>
+<h3><%text(_PLUGS_TITLE_NEW)%></h3>
+
+<%if(existsnewplugin)%>
+<p><%text(_PLUGS_ADD_TEXT)%></p>
+<form method='post' action='index.php'>
+
+<p>
+<input type='hidden' name='action' value='pluginadd' />
+<%ticket%>
+<select name="filename" tabindex="30">
+<%newpluginlist%>
+</select>
+<input type='submit' tabindex="40" value='<%text(_PLUGS_BTN_INSTALL)%>' />
+</p>
+</form>
+<%else%>
+<p><%text(_PLUGS_NOCANDIDATES)%></p>
+<%endif%>
+<%pagefoot%>
+]]></part>
+<part name="pluginoptions"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=pluginlist">(<%text(_PLUGS_BACK)%>)</a></p>
+<h2><%sprinttext(_PLUGIN_OPTIONS_TITLE,<|%geteditpluginfo(name)%|>)%></h2>
+<%headmessage%>
+
+<form action="<%adminurl%>index.php" method="post">
+
+<p>
+<input type="hidden" name="action" value="pluginoptionsupdate" />
+<input type="hidden" name="plugid" value="<%editpluginfo(id)%>" />
+<%ticket%>
+</p>
+
+<%editplugoptionslist(admin/default)%>
+
+</form>
+<%pagefoot%>
+]]></part>
+<part name="settingsedit"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+<h2><%text(_SETTINGS_TITLE)%></h2>
+
+<form action="<%adminurl%>index.php" method="post">
+
+<p>
+<input type="hidden" name="action" value="settingsupdate" />
+<%ticket%>
+</p>
+
+<table frame="box" rules="all" summary="<%text(_SETTINGS_SUB_GENERAL)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_SETTINGS_SUB_GENERAL)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><%text(_SETTINGS_DEFBLOG)%> <%helplink(defaultblog)%></td>
+<td><%defblogselect(admin/default)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_BASESKIN)%> <%helplink(baseskin)%></td>
+<td><%defskinselect(,admin/default)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_ADMINMAIL)%></td>
+<td><input name="AdminEmail" tabindex="10010" size="40" value="<%configsettingsedit(AdminEmail)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_SITENAME)%></td>
+<td><input name="SiteName" tabindex="10020" size="40" value="<%configsettingsedit(SiteName)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_SITEURL)%></td>
+<td><input name="IndexURL" tabindex="10030" size="40" value="<%configsettingsedit(IndexURL)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_ADMINURL)%></td>
+<td><input name="AdminURL" tabindex="10040" size="40" value="<%configsettingsedit(AdminURL)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_PLUGINURL)%> <%helplink(pluginurl)%></td>
+<td><input name="PluginURL" tabindex="10045" size="40" value="<%configsettingsedit(PluginURL)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_SKINSURL)%> <%helplink(skinsurl)%></td>
+<td><input name="SkinsURL" tabindex="10046" size="40" value="<%configsettingsedit(SkinsURL)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_ACTIONSURL)%> <%helplink(actionurl)%></td>
+<td><input name="ActionURL" tabindex="10047" size="40" value="<%configsettingsedit(ActionURL)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_LOCALE)%> <%helplink(locale)%></td>
+<td><select name="Locale" tabindex="10050"><%localeselectoptions%></select></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_DISABLESITE)%> <%helplink(disablesite)%></td>
+<td>
+<%configsettingsyesno(DisableSite, 10060)%><br />
+<%text(_SETTINGS_DISABLESITEURL)%> <input name="DisableSiteURL" tabindex="10070" size="40" value="<%configsettingsedit(DisableSiteURL)%>" />
+</td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_DIRS)%></td>
+<td><%outputspecialdirs(nucleusdir)%><i><%text(_SETTINGS_SEECONFIGPHP)%></i></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_DBLOGIN)%></td>
+<td><i><%text(_SETTINGS_SEECONFIGPHP)%></i></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_JSTOOLBAR)%></td>
+<td>
+<select name="DisableJsTools" tabindex="10075">
+<%jstoolbaroptions%>
+</select>
+</td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_URLMODE)%> <%helplink(urlmode)%></td>
+<td><%configsettingsedit(URLMode)%> <%text(_SETTINGS_URLMODE_HELP)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_DEBUGVARS)%> <%helplink(debugvars)%></td>
+<td><%configsettingsyesno(DebugVars, 10078)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_DEFAULTLISTSIZE)%> <%helplink(defaultlistsize)%></td>
+<td><input name="DefaultListSize" tabindex="10079" size="40" value="<%configsettingsedit(DefaultListSize)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_ADMINSKIN)%></td>
+<td><%defadminskinselect(admin/default%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_BKMKLTSKIN)%></td>
+<td><%defbookmarkletselect(admin/default%></td>
+</tr>
+</tbody>
+</table>
+
+<table frame="box" rules="all" summary="<%text(_SETTINGS_MEDIA)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_SETTINGS_MEDIA)%> <%helplink(media)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><%text(_SETTINGS_MEDIADIR)%></td>
+<td>
+<%outputspecialdirs(mediadir)%>
+<i><%text(_SETTINGS_SEECONFIGPHP)%></i><%mediadirwarning%>
+</td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_MEDIAURL)%></td>
+<td><input name="MediaURL" tabindex="10090" size="40" value="<%configsettingsedit(MediaURL)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_ALLOWUPLOAD)%></td>
+<td><%configsettingsyesno(AllowUpload, 10095)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_ALLOWUPLOADTYPES)%></td>
+<td><input name="AllowedTypes" tabindex="10100" size="40" value="<%configsettingsedit(AllowedTypes)%>" />
+</tr>
+<tr>
+<td><%text(_SETTINGS_MAXUPLOADSIZE)%></td>
+<td><input name="MaxUploadSize" tabindex="10105" size="40" value="<%configsettingsedit(MaxUploadSize)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_MEDIAPREFIX)%></td>
+<td><%configsettingsyesno(MediaPrefix, 10110)%></td>
+</tr>
+</tbody>
+</table>
+
+<table frame="box" rules="all" summary="<%text(_SETTINGS_MEMBERS)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_SETTINGS_MEMBERS)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><%text(_SETTINGS_CHANGELOGIN)%></td>
+<td><%configsettingsyesno(AllowLoginEdit, 10120)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_ALLOWCREATE)%> <%helplink(allowaccountcreation)%>
+</td>
+<td><%configsettingsyesno(AllowMemberCreate, 10130)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_NEWLOGIN)%> <%helplink(allownewmemberlogin)%><br /><%text(_SETTINGS_NEWLOGIN2)%></td>
+<td><%configsettingsyesno(NewMemberCanLogon, 10140)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_MEMBERMSGS)%> <%helplink(messageservice)%></td>
+<td><%configsettingsyesno(AllowMemberMail, 10150)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_NONMEMBERMSGS)%> <%helplink(messageservice)%></td>
+<td><%configsettingsyesno(NonmemberMail, 10155%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_PROTECTMEMNAMES)%> <%helplink(protectmemnames)%></td>
+<td><%configsettingsyesno(ProtectMemNames, 10156)%></td>
+</tr>
+</tbody>
+</table>
+
+<table frame="box" rules="all" summary="<%text(_SETTINGS_COOKIES_TITLE)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_SETTINGS_COOKIES_TITLE)%> <%helplink(cookies)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><%text(_SETTINGS_COOKIEPREFIX)%></td>
+<td><input name="CookiePrefix" tabindex="10159" size="40" value="<%configsettingsedit(CookiePrefix)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_COOKIEDOMAIN)%></td>
+<td><input name="CookieDomain" tabindex="10160" size="40" value="<%configsettingsedit(CookieDomain)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_COOKIEPATH)%></td>
+<td><input name="CookiePath" tabindex="10170" size="40" value="<%configsettingsedit(CookiePath)%>" /></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_COOKIESECURE)%></td>
+<td><%configsettingsyesno(CookieSecure, 10180)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_COOKIELIFE)%></td>
+<td><%configsettingsedit(SessionCookie)%></td>
+</tr>
+<tr>
+<td><%text(_SETTINGS_LASTVISIT)%></td>
+<td><%configsettingsyesno(LastVisit, 10200)%></td>
+</tr>
+</tbody>
+</table>
+
+<table frame="box" rules="all" summary="<%text(_SETTINGS_UPDATE)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_SETTINGS_UPDATE)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><%text(_SETTINGS_UPDATE)%></td>
+<td><input type="submit" tabindex="10210" value="<%text(_SETTINGS_UPDATE_BTN)%>" onclick="return checkSubmit();" /></td>
+</tr>
+</tbody>
+</table>
+
+</form>
+
+<h2><%text(_PLUGINS_EXTRA)%></h2>
+
+<%pluginextras%>
+<%pagefoot%>
+]]></part>
+<part name="showlogin"><![CDATA[
+<%pagehead%>
+<h2><%text(_LOGIN)%></h2>
+<%headmessage%>
+<form action="<%adminurl%>index.php" method="post">
+<p>
+<%text(_LOGIN_NAME)%> <br /><input name="login" tabindex="10" /><br />
+<%text(_LOGIN_PASSWORD)%> <br /><input name="password" tabindex="20" type="password" /><br />
+<input name="action" value="login" type="hidden" /><br />
+<input type="submit" value="<%text(_LOGIN)%>" tabindex="30" /><br />
+<small>
+<input type="checkbox" value="1" name="shared" tabindex="40" id="shared" /><label for="shared"><%text(_LOGIN_SHARED)%></label><br />
+<a href="forgotpassword.php"><%text(_LOGIN_FORGOT)%></a>
+</small>
+<%passrequestvars%>
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="skindelete"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+<p><%text(_CONFIRMTXT_SKIN)%><b><%editskintype(name)%></b> (<%editskintype(desc)%>)</p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="skindeleteconfirm" />
+<%ticket%>
+<input type="hidden" name="skinid" value="<%editskintype(id)%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="skinedit"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=skinoverview">(<%text(_SKIN_BACK)%>)</a></p>
+
+ <h2><%text(_SKIN_EDITONE_TITLE)%> '<%editskin(name)%>'</h2>
+
+ <h3><%text(_SKIN_PARTS_TITLE)%></h3>
+ <%text(_SKIN_PARTS_MSG)%>
+ <%normalskinlist(admin/default)%>
+
+ <h3><%text(_SKIN_PARTS_SPECIAL)%></h3>
+ <form method="get" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="skinedittype" />
+ <input type="hidden" name="skinid" value="<%editskin(id)%>" />
+ <input name="type" tabindex="89" size="20" maxlength="20" />
+ <input type="submit" tabindex="140" value="<%text(_SKIN_CREATE)%>" onclick="return checkSubmit();" />
+ </p>
+ </form>
+ <%specialskinlist(admin/default)%>
+
+ <h3><%text(_SKIN_GENSETTINGS_TITLE)%></h3>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="skineditgeneral" />
+ <%ticket%>
+ <input type="hidden" name="skinid" value="<%editskin(id)%>" />
+ </p>
+ <table frame="box" rules="all" summary="<%text(_SKIN_GENSETTINGS_TITLE)%>">
+ <tr>
+ <td><%text(_SKIN_NAME)%> <%helplink(shortnames)%></td>
+ <td><input name="name" tabindex="90" value="<%editskin(name)%>" maxlength="20" size="20" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_DESC)%></td>
+ <td><input name="desc" tabindex="100" value="<%editskin(desc)%>" maxlength="200" size="50" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_TYPE)%></td>
+ <td><input name="type" tabindex="110" value="<%editskin(type)%>" maxlength="40" size="20" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_INCLUDE_MODE)%> <%helplink(includemode)%></td>
+ <td><%editskin(mode)%></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_INCLUDE_PREFIX)%> <%helplink(includeprefix)%></td>
+ <td><input name="inc_prefix" tabindex="130" value="<%editskin(prefix)%>" maxlength="40" size="20" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_CHANGE)%></td>
+ <td><input type="submit" tabindex="140" value="<%text(_SKIN_CHANGE_BTN)%>" onclick="return checkSubmit();" /></td>
+ </tr>
+ </table>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="skinedittype"><![CDATA[
+ <%pagehead%>
+ <p>(<a href="<%adminurl%>index.php?action=skinoverview"><%text(_SKIN_GOBACK)%></a>)</p>
+
+ <h2><%text(_SKIN_EDITPART_TITLE)%> '<%editskintype(name)%>': <%editskintype(skintype)%></h2>
+ <%headmessage%>
+
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="skinupdate" />
+ <%ticket%>
+ <input type="hidden" name="skinid" value="<%editskintype(id)%>" />
+ <input type="hidden" name="type" value="<%editskintype(skintyperaw)%>" />
+ <input type="submit" value="<%text(_SKIN_UPDATE_BTN)%>" onclick="return checkSubmit();" />
+ <input type="reset" value="<%text(_SKIN_RESET_BTN)%>" />
+ (skin type: <%editskintype(skintype)%>)<%skintypehelp%><br />
+ <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><%editskintype(content)%></textarea>
+ <br />
+ <input type="submit" tabindex="20" value="<%text(_SKIN_UPDATE_BTN)%>" onclick="return checkSubmit();" />
+ <input type="reset" value="<%text(_SKIN_RESET_BTN)%>" />
+ (skin type: <%editskintype(skintype)%>)
+ <br />
+ <br />
+
+ <%text(_SKIN_ALLOWEDVARS)%>
+ <%allowedskinactions%><br /><br />
+ <%text(_SKINEDIT_ALLOWEDBLOGS)%>
+ <%skineditallowedlist(blog)%>
+ <%text(_SKINEDIT_ALLOWEDTEMPLATESS)%>
+ </p>
+ <%skineditallowedlist(template)%>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="skiniedoimport"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+<h2><%text(_SKINIE_DONE)%></h2>
+
+<ul>
+<li><strong><%text(_SKINIE_INFO_GENERAL)%></strong> <%importskininfo(info)%></li>
+<li><strong><%text(_SKINIE_INFO_IMPORTEDSKINS)%></strong> <%importskininfo(snames)%></li>
+<li><strong><%text(_SKINIE_INFO_IMPORTEDTEMPLS)%></strong> <%importskininfo(tnames)%></li>
+</ul><%pagefoot%>
+]]></part>
+<part name="skinieimport"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=skinieoverview">(<%text(_BACK)%>)</a></p>
+<h2><%text(_SKINIE_CONFIRM_TITLE)%></h2>
+<ul>
+<li><strong><%text(_SKINIE_INFO_GENERAL)%></strong> <%importskininfo(info)%></li>
+<li><strong><%text(_SKINIE_INFO_SKINS)%></strong> <%importskininfo(snames)%></li>
+<li><strong><%text(_SKINIE_INFO_TEMPLATES)%></strong> <%importskininfo(tnames)%></li>
+<%if(nameclashes)%>
+<li><strong style="color: red;"><%text(_SKINIE_INFO_SKINCLASH)%></strong> <%importskininfo(sclashes)%></li>
+<li><strong style="color: red;"><%text(_SKINIE_INFO_TEMPLCLASH)%></strong> <%importskininfo(tclashes)%></li>
+<%endif%>
+</ul>
+
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="skiniedoimport" />
+<%ticket%>
+<input type="hidden" name="skinfile" value="<%importskininfo(skinfile)%>" />
+<input type="hidden" name="mode" value="<%importskininfo(mode)%>" />
+<input type="submit" value="<%text(_SKINIE_CONFIRM_IMPORT)%>" />
+<%if(nameclashes)%>
+<br />
+<input type="checkbox" name="overwrite" value="1" id="cb_overwrite" />
+<label for="cb_overwrite"><%text(_SKINIE_CONFIRM_OVERWRITE)%></label>
+<%endif%>
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="skinieoverview"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+ <h2><%text(_SKINIE_TITLE_IMPORT)%></h2>
+ <p>
+ <label for="skinie_import_local"><%text(_SKINIE_LOCAL)%></label>
+ </p>
+ <%if(skincandidates)%>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input type="hidden" name="action" value="skinieimport" />
+ <%ticket%>
+ <input type="hidden" name="mode" value="file" />
+ <select name="skinfile" id="skinie_import_local">
+ <%selectlocalskinfiles%>
+ </select>
+ <input type="submit" value="<%text(_SKINIE_BTN_IMPORT)%>" />
+ </p>
+ </form>
+ <%else%>
+ <p>
+ <%text(_SKINIE_NOCANDIDATES)%>
+ </p>
+ <%endif%>
+ <p><em><%text(_OR)%></em></p>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <%ticket%>
+ <input type="hidden" name="action" value="skinieimport" />
+ <input type="hidden" name="mode" value="url" />
+ <label for="skinie_import_url"><%text(_SKINIE_FROMURL)%></label>
+ <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />
+ <input type="submit" value="<%text(_SKINIE_BTN_IMPORT)%>" />
+ </p>
+ </form>
+
+ <h2><%text(_SKINIE_TITLE_EXPORT)%></h2>
+ <form method="post" action="<%adminurl%>index.php">
+
+ <p><%text(_SKINIE_EXPORT_INTRO)%></p>
+
+ <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_SKINS)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_SKINIE_EXPORT_SKINS)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%skinielist(skin,admin/default)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_TEMPLATES)%>">
+ <thead>
+ <th colspan="2"><%text(_SKINIE_EXPORT_TEMPLATES)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%skinielist(template,admin/default)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_SKINIE_EXPORT_SKINS)%>">
+ <thead>
+ <th colspan="2"><%text(_SKINIE_EXPORT_EXTRA)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>
+ </tr>
+ </tbody>
+ </table>
+
+ <p>
+ <input type="hidden" name="action" value="skinieexport" />
+ <%ticket%>
+ <input type="submit" value="<%text(_SKINIE_BTN_EXPORT)%>" />
+ </p>
+
+ </form>
+
+ <%pagefoot%>
+]]></part>
+<part name="skinoverview"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+
+ <h2><%text(_SKIN_EDIT_TITLE)%></h2>
+
+ <h3><%text(_SKIN_AVAILABLE_TITLE)%></h3>
+ <%skinoverview(admin/default)%>
+
+ <h3><%text(_SKIN_NEW_TITLE)%></h3>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input name="action" value="skinnew" type="hidden" />
+ <%ticket%>
+ </p>
+
+ <table frame="box" rules="all" sumamry="<%text(_SKIN_NEW_TITLE)%>">
+ <tr>
+ <td><%text(_SKIN_NAME)%> <%helplink(shortnames)%></td>
+ <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_DESC)%></td>
+ <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
+ </tr>
+ <tr>
+ <td><%text(_SKIN_CREATE)%></td>
+ <td><input type="submit" tabindex="10030" value="<%text(_SKIN_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>
+ </tr>
+ </table>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="skinremovetype"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+<p>
+<%text(_CONFIRMTXT_SKIN_PARTS_SPECIAL)%><br />
+<b><%editskintype(skintype)%> (<%editskintype(name)%>)</b> (<%editskintype(desc)%>)
+</p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="skinremovetypeconfirm" />
+<%ticket%>
+<input type="hidden" name="skinid" value="<%editskintype(id)%>" />
+<input type="hidden" name="type" value="<%editskintype(skintype)%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="systemoverview"><![CDATA[
+<%pagehead%>
+<h2><%text(_ADMIN_SYSTEMOVERVIEW_HEADING)%></h2>
+<%if(superadmin)%>
+<h3><%text(_ADMIN_SYSTEMOVERVIEW_PHPANDMYSQL)%></h3>
+
+<table frame="box" rules="all" summary="<%text(_ADMIN_SYSTEMOVERVIEW_PHPANDMYSQL)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_VERSIONS)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td width="50%"><%text(_ADMIN_SYSTEMOVERVIEW_PHPVERSION)%></td>
+<td><%systemsettings(phpversion)%></td>
+</tr>
+<tr>
+<td><%text(_ADMIN_SYSTEMOVERVIEW_MYSQLVERSION)%></td>
+<td><%systemsettings(sqlserverinfo)%> (<%systemsettings(sqlclientinfo)%>)</td>
+</tr>
+</tbody>
+</table>
+
+<table frame="box" rules="all" summary="Important PHP settings">
+<thead>
+<tr>
+<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_SETTINGS)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td width="50%">magic_quotes_gpc</td>
+<td><%systemsettings(magicquotesgpc)%></td>
+</tr>
+<tr>
+<td width="50%">magic_quotes_runtime</td>
+<td><%systemsettings(magicquotesruntime)%></td>
+</tr>
+<tr>
+<td width="50%">register_globals</td>
+<td><%systemsettings(registerglobals)%></td>
+</tr>
+</tbody>
+</table>
+
+<table summary="Information about GD library">
+<thead>
+<tr>
+<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_GDLIBRALY)%></th>
+</tr>
+</thead>
+<tbody>
+<%systemsettings(gdinfo)%>
+</tbody>
+</table>
+
+<table frame="box" rules="all" summary="special modules are loaded">
+<thead>
+<tr>
+<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_MODULES)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td width="50%">mod_rewrite</td>
+<td><%systemsettings(modrewrite)%></td>
+</tr>
+</tbody>
+</table>
+
+<h3><%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSSYSTEM)%></h3>
+<table frame="box" rules="all" summary="<%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSSYSTEM)%>">
+<thead>
+<tr>
+<th colspan="2">Nucleus CMS</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td width="50%"><%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSVERSION)%></td>
+<td><%systemsettings(nucleusversion)%></td>
+</tr>
+<tr>
+<td width="50%"><%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSPATCHLEVEL)%></td>
+<td><%systemsettings(nucleuspatchlevel)%></td>
+</tr>
+<tr>
+<td colspan="2"><%newestcompare%></td>
+</tr>
+</tbody>
+</table>
+
+<table frame="box" rules="all" summary="Important settings of the installation">
+<thead>
+<tr>
+<th colspan="2"><%text(_ADMIN_SYSTEMOVERVIEW_NUCLEUSSETTINGS)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td width="50%">$CONF['Self']</td>
+<td><%systemsettings(confself)%></td>
+</tr>
+<tr>
+<td width="50%">$CONF['ItemURL']</td>
+<td><%systemsettings(confitemurl)%></td>
+</tr>
+<tr>
+<td width="50%">$CONF['alertOnHeadersSent']</td>
+<td><%systemsettings(alertonheaderssent)%></td>
+</tr>
+</tbody>
+</table>
+
+<h3><%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK)%></h3>
+<!-- Link to the online version test at the Nucleus CMS website -->
+<p>
+<%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TXT)%>
+<a href="<%systemsettings(versioncheckurl)%>" title="<%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE)%>">
+Nucleus CMS <%systemsettings(nucleusversion)%> <%systemsettings(nucleuscodename)%></a>
+</p>
+
+<%else%>
+<p>
+<%text(_ADMIN_SYSTEMOVERVIEW_NOT_ADMIN)%>
+</p>
+<%endif%>
+<%pagefoot%>
+]]></part>
+<part name="teamdelete"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+<p>
+<%text(_CONFIRMTXT_TEAM1)%>
+<b><%editmember(displayname)%></b>
+<%text(_CONFIRMTXT_TEAM2)%>
+<b><%blogsetting(name)%></b>
+</p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="teamdeleteconfirm" />
+<%ticket%>
+<input type="hidden" name="memberid" value="<%editmember(id)%>" />
+<input type="hidden" name="blogid" value="<%requestblogid%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="templatedelete"><![CDATA[
+<%pagehead%>
+<h2><%text(_DELETE_CONFIRM)%></h2>
+<p><%text(_CONFIRMTXT_TEMPLATE)%><b><%edittemplateinfo(name)%></b> (<%edittemplateinfo(desc)%>)</p>
+<form method="post" action="<%adminurl%>index.php">
+<p>
+<input type="hidden" name="action" value="templatedeleteconfirm" />
+<%ticket%>
+<input type="hidden" name="templateid" value="<%edittemplateinfo(id)%>" />
+<input type="submit" tabindex="10" value="<%text(_DELETE_CONFIRM_BTN)%>" />
+</p>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="templateedit"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=templateoverview">(<%text(_TEMPLATE_BACK)%>)</a></p>
+
+ <h2><%text(_TEMPLATE_EDIT_TITLE)%> '<%edittemplateinfo(name)%>'</h2>
+ <%headmessage%>
+
+ <p><%text(_TEMPLATE_EDIT_MSG)%></p>
+
+ <form method="post" action="<%adminurl%>index.php">
+
+ <p>
+ <input type="hidden" name="action" value="templateupdate" />
+ <%ticket%>
+ <input type="hidden" name="templateid" value="<%edittemplateinfo(id)%>" />
+ </p>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_SETTINGS)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_SETTINGS)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><%text(_TEMPLATE_NAME)%> <%helplink(shortnames)%></td>
+ <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<%edittemplateinfo(name)%>" /></td>
+ </tr>
+ <tr>
+ <td><%text(_TEMPLATE_DESC)%></td>
+ <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<%edittemplateinfo(desc)%>" /></td>
+ </tr>
+ <tr>
+ <td><%text(_TEMPLATE_UPDATE)%></td>
+ <td>
+ <input type="submit" tabindex="6" value="<%text(_TEMPLATE_UPDATE_BTN)%>" onclick="return checkSubmit();" />
+ <input type="reset" tabindex="7" value="<%text(_TEMPLATE_RESET_BTN)%>" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_ITEMS)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_ITEMS)%> <%helplink(templateitems)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_ITEMHEADER,ITEM_HEADER,,8)%>
+ <%edittemplateinfo(row,_TEMPLATE_ITEMBODY,ITEM,,9,1)%>
+ <%edittemplateinfo(row,_TEMPLATE_ITEMFOOTER,ITEM_FOOTER,,10)%>
+ <%edittemplateinfo(row,_TEMPLATE_MORELINK,MORELINK,morelink, 20)%>
+ <%edittemplateinfo(row,_TEMPLATE_EDITLINK, EDITLINK, editlink, 25)%>
+ <%edittemplateinfo(row,_TEMPLATE_NEW, NEW, new, 30)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_COMMENTS_ANY)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_COMMENTS_ANY)%> <%helplink(templatecomments)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_CHEADER, COMMENTS_HEADER, commentheaders, 40)%>
+ <%edittemplateinfo(row,_TEMPLATE_CBODY, COMMENTS_BODY, commentbody, 50, 1)%>
+ <%edittemplateinfo(row,_TEMPLATE_CFOOTER, COMMENTS_FOOTER, commentheaders, 60)%>
+ <%edittemplateinfo(row,_TEMPLATE_CONE, COMMENTS_ONE, commentwords, 70)%>
+ <%edittemplateinfo(row,_TEMPLATE_CMANY, COMMENTS_MANY, commentwords, 80)%>
+ <%edittemplateinfo(row,_TEMPLATE_CMORE, COMMENTS_CONTINUED, commentcontinued, 90)%>
+ <%edittemplateinfo(row,_TEMPLATE_CMEXTRA, COMMENTS_AUTH, memberextra, 100)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_COMMENTS_NONE)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_COMMENTS_NONE)%> <%helplink(templatecomments)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_CNONE, COMMENTS_NONE, , 110)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_COMMENTS_TOOMUCH)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_COMMENTS_TOOMUCH)%> <%helplink(templatecomments)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_CTOOMUCH, COMMENTS_TOOMUCH, , 120)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_ARCHIVELIST)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_ARCHIVELIST)%> <%helplink(templatearchivelists)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_AHEADER, ARCHIVELIST_HEADER, , 130)%>
+ <%edittemplateinfo(row,_TEMPLATE_AITEM, ARCHIVELIST_LISTITEM, , 140)%>
+ <%edittemplateinfo(row,_TEMPLATE_AFOOTER, ARCHIVELIST_FOOTER, , 150)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_BLOGLIST)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_BLOGLIST)%> <%helplink(templatebloglists)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_BLOGHEADER, BLOGLIST_HEADER, , 160)%>
+ <%edittemplateinfo(row,_TEMPLATE_BLOGITEM, BLOGLIST_LISTITEM, , 170)%>
+ <%edittemplateinfo(row,_TEMPLATE_BLOGFOOTER, BLOGLIST_FOOTER, , 180)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_CATEGORYLIST)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_CATEGORYLIST)%> <%helplink(templatecategorylists)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_CATHEADER, CATLIST_HEADER, , 190)%>
+ <%edittemplateinfo(row,_TEMPLATE_CATITEM, CATLIST_LISTITEM, , 200)%>
+ <%edittemplateinfo(row,_TEMPLATE_CATFOOTER, CATLIST_FOOTER, , 210)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_DATETIME)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_DATETIME)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_DHEADER, DATE_HEADER, dateheads, 220)%>
+ <%edittemplateinfo(row,_TEMPLATE_DFOOTER, DATE_FOOTER, dateheads, 230)%>
+ <%edittemplateinfo(row,_TEMPLATE_DFORMAT, FORMAT_DATE, datetime, 240)%>
+ <%edittemplateinfo(row,_TEMPLATE_TFORMAT, FORMAT_TIME, datetime, 250)%>
+ <%edittemplateinfo(row,_TEMPLATE_LOCALE, LOCALE, locale, 260)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_IMAGE)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_IMAGE)%> <%helplink(templatepopups)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_PCODE, POPUP_CODE, , 270)%>
+ <%edittemplateinfo(row,_TEMPLATE_ICODE, IMAGE_CODE, , 280)%>
+ <%edittemplateinfo(row,_TEMPLATE_MCODE, MEDIA_CODE, , 290)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_SEARCH)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_SEARCH)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(row,_TEMPLATE_SHIGHLIGHT, SEARCH_HIGHLIGHT, highlight,300)%>
+ <%edittemplateinfo(row,_TEMPLATE_SNOTFOUND, SEARCH_NOTHINGFOUND, nothingfound,310)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_PLUGIN_FIELDS)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_PLUGIN_FIELDS)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%edittemplateinfo(extratemplate,admin/default)%>
+ </tbody>
+ </table>
+
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_UPDATE)%>">
+ <thead>
+ <tr>
+ <th colspan="2"><%text(_TEMPLATE_UPDATE)%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><%text(_TEMPLATE_UPDATE)%></td>
+ <td>
+ <input type="submit" tabindex="800" value="<%text(_TEMPLATE_UPDATE_BTN)%>" onclick="return checkSubmit();" />
+ <input type="reset" tabindex="810" value="<%text(_TEMPLATE_RESET_BTN)%>" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="templateoverview"><![CDATA[
+ <%pagehead%>
+ <p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+ <h2><%text(_TEMPLATE_TITLE)%></h2>
+
+ <h3><%text(_TEMPLATE_AVAILABLE_TITLE)%></h3>
+ <%templateoverview(admin/default)%>
+
+ <h3><%text(_TEMPLATE_NEW_TITLE)%></h3>
+ <form method="post" action="<%adminurl%>index.php">
+ <p>
+ <input name="action" value="templatenew" type="hidden" />
+ <%ticket%>
+ </p>
+ <table frame="box" rules="all" summary="<%text(_TEMPLATE_NEW_TITLE)%>">
+ <tr>
+ <td><%text(_TEMPLATE_NAME)%> <%helplink(shortnames)%></td>
+ <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
+ </tr>
+ <tr>
+ <td><%text(_TEMPLATE_DESC)%></td>
+ <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
+ </tr>
+ <tr>
+ <td><%text(_TEMPLATE_CREATE)%></td>
+ <td><input type="submit" tabindex="10030" value="<%text(_TEMPLATE_CREATE_BTN)%>" onclick="return checkSubmit();" /></td>
+ </tr>
+ </table>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="usermanagement"><![CDATA[
+<%pagehead%>
+<p><a href="<%adminurl%>index.php?action=manage">(<%text(_BACKTOMANAGE)%>)</a></p>
+<h2><%text(_MEMBERS_TITLE)%></h2>
+<h3><%text(_MEMBERS_CURRENT)%></h3>
+<%editmemberlist(admin/default)%>
+<h3><%text(_MEMBERS_NEW)%></h3>
+
+<form method="post" action="<%adminurl%>index.php" name="memberedit">
+
+<p>
+<input type="hidden" name="action" value="memberadd" />
+<%ticket%>
+</p>
+
+<table frame="box" rules="all" summary="<%text(_MEMBERS_NEW)%>">
+<thead>
+<tr>
+<th colspan="2"><%text(_MEMBERS_NEW)%></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>
+<%text(_MEMBERS_DISPLAY)%> <%helplink(shortnames)%>
+<br /><small><%text(_MEMBERS_DISPLAY_INFO)%></small>
+</td>
+<td><input tabindex="10010" name="name" size="32" maxlength="32" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_REALNAME)%></td>
+<td><input name="realname" tabindex="10020" size="40" maxlength="60" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_PWD)%></td>
+<td><input name="password" tabindex="10030" size="16" maxlength="40" type="password" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_REPPWD)%></td>
+<td><input name="repeatpassword" tabindex="10035" size="16" maxlength="40" type="password" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_EMAIL)%></td>
+<td><input name="email" tabindex="10040" size="40" maxlength="60" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_URL)%></td>
+<td><input name="url" tabindex="10050" size="40" maxlength="100" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_SUPERADMIN)%> <%helplink(superadmin)%></td>
+<td><%inputyesno(admin,1,10060)%> </td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_CANLOGIN)%> <%helplink(canlogin)%></td>
+<td><%inputyesno(canlogin,1,10070)%></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_NOTES)%></td>
+<td><input name="notes" maxlength="100" size="40" tabindex="10080" /></td>
+</tr>
+<tr>
+<td><%text(_MEMBERS_NEW)%></td>
+<td><input type="submit" value="<%text(_MEMBERS_NEW_BTN)%>" tabindex="10090" onclick="return checkSubmit();" /></td>
+</tr>
+</tbody>
+</table>
+</form>
+<%pagefoot%>
+]]></part>
+<part name="createaccountinput"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_CREATE_ACCOUNT0)%></h2>
+ <%headmessage%>
+ <form method="post" action="<%sitevar(url)%>createaccount.php">
+ <dl>
+ <dt><label for="name"><%text(_CREATE_ACCOUNT_LOGIN_NAME)%></label></dt>
+ <dd>
+ <input id="name" name="name" value="<%contents(name)%>" size="32" maxlength="32" />
+ <span style="\small"><%text(_CREATE_ACCOUNT_LOGIN_NAME_VALID)%></span>
+ </dd>
+ <dt><label for="realname"><%text(_CREATE_ACCOUNT_REAL_NAME)%></label></dt>
+ <dd><input id="realname" name="realname" value="<%contents(realname)%>" size="40" /></dd>
+ <dt><label for="email"><%text(_CREATE_ACCOUNT_EMAIL)%></label></dt>
+ <dd>
+ <input id="email"name="email" value="<%contents(email)%>" size="40" />
+ <span style="\small"><%text(_CREATE_ACCOUNT_EMAIL2)%></span>
+ </dd>
+ <dt><label for="url"><%text(_CREATE_ACCOUNT_URL)%></label></dt>
+ <dd><input id="url"name="url" value="<%contents(url)%>" size="60" /></dd>
+ </dl>
+ <%pluginextras(createaccount)%>
+ <%eventformextra(membermailform-notloggedin)%>
+ <p>
+ <input type="hidden" name="showform" value="1" />
+ <button type="submit" name="action" value="createaccount"><%text(_CREATE_ACCOUNT_SUBMIT)%></button>
+ </p>
+ </form>
+ <%pagefoot%>
+]]></part>
+<part name="createaccountsuccess"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_CREATE_ACCOUNT)%></h2>
+ <%headmessage%>
+ <p><%text(_MSG_ACTIVATION_SENT)%></p>
+ <p><%text(_BACK)%> <a href="<%sitevar(IndexURL)%>" title="<%sitevar(SiteName)%>"><%sitevar(SiteName)%></a></p>
+ <%pagefoot%>
+]]></part>
+<part name="createaccountdisable"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_CREATE_ACCOUNT0)%></h2>
+ <p><%text(_CREATE_ACCOUNT1)%></p>
+ <p><%text(_CREATE_ACCOUNT2)%></p>
+ <p><%text(_BACK)%> <a href="<%sitevar(IndexURL)%>" title="<%sitevar(SiteName)%>"><%sitevar(SiteName)%></a></p>
+ <%pagefoot%>
+]]></part>
+<part name="forgotpassword"><![CDATA[
+ <%pagehead%>
+ <h2><%text(_FORGOTPASSWORD_TITLE)%></h2>
+ <p><%text(_FORGOTPASSWORD_MSG)%></p>
+ <form method="post" action="<%actionurl%>">
+ <dl>
+ <dt><label for="nucleus_pf_username"><%text(_CREATE_ACCOUNT_LOGIN_NAME)%></label></dt>
+ <dd><input type="text" name="name" id="nucleus_pf_username" /></dd>
+ <dt><label for="nucleus_pf_email"><%text(_CREATE_ACCOUNT_EMAIL)%></label></dt>
+ <dd><input type="text" name="email" id="nucleus_pf_email" /></dd>
+ </dl>
+ <p>
+ <input type="hidden" name="action" value="forgotpassword" />
+ <input type="submit" value="<%text(_FORGOTPASSWORD_SUBMIT)%>" class="transparent" />
+ </p>
+ </form>
+ <p><%text(_FORGOTPASSWORD_CONTACT)%></p>
+ <%pagefoot%>
+]]></part>
+</skin>
+<template name="admin/default">
+<description><![CDATA[
+ ADMIN Area Default template
+]]></description>
+
+<part name="PLUGIN_QUICKMENU_HEAD"><![CDATA[
+ <h2><%text(_QMENU_PLUGINS)%></h2>
+ <ul>
+]]></part>
+<part name="PLUGIN_QUICKMENU_BODY"><![CDATA[
+ <li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>
+]]></part>
+<part name="PLUGIN_QUICKMENU_FOOT"><![CDATA[
+ </ul>
+]]></part>
+
+<part name="SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD"><![CDATA[
+ <th><%coltime%></th>
+ <th><%colmesg%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY"><![CDATA[
+ <td><%timestamp%></td>
+ <td><%message%></td>
+]]></part>
+
+<part name="SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD"><![CDATA[
+ <th><%iprange%></th>
+ <th><%reason%></th>
+ <th><%colact%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY"><![CDATA[
+ <td><%iprange%></td>
+ <td><%reason%></td>
+ <td><a href="<%adminurl%>index.php?action=banlistdelete&blogid=<%blogid%>&iprange=<%iprange%>"><%delbtn%></a></td>
+]]></part>
+
+<part name="SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD"><![CDATA[
+ <th><%colname%></th>
+ <th><%coldesc%></th>
+ <th colspan="3"><%colact%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY"><![CDATA[
+ <td><%skinname%><br /><br />
+ <%skintypelabel%> <%skintype%><br />
+ <%incmodelabel%> <%incmode%><br />
+ <%incpreflabel%> <%incpref%><br />
+ <%skinthumb%>
+ <%readme%></td>
+ <td class="availableSkinTypes"><%skindesc%><%skinparts%></td>
+ <td style="white-space:nowrap">
+ <a href="<%editurl%>" tabindex="<%tabindex%>">
+ <%editbtn%>
+ </a>
+ </td>
+ <td style="white-space:nowrap">
+ <a href="<%cloneurl%>" tabindex="<%tabindex%>">
+ <%clonebtn%>
+ </a>
+ </td>
+ <td style="white-space:nowrap">
+ <a href="<%deleteurl%>" tabindex="<%tabindex%>">
+ <%delbtn%>
+ </a>
+ </td>
+]]></part>
+
+<part name="SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM"><![CDATA[
+ <td>
+ <a href="<%adminurl%>index.php?action=blogsettings&blogid=<%blogid%>" title="<%ttsettingtext%>"><%settingtext%></a>
+ </td>
+ <td>
+ <a href="<%adminurl%>index.php?action=banlist&blogid=<%blogid%>" title="<%ttbanstext%>"><%banstext%></a>
+ </td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM"><![CDATA[
+ <td>
+ <a href="<%adminurl%>index.php?action=deleteblog&blogid=<%blogid%>" title="<%ttdeletetext%>"><%deletetext%></a>
+ </td>
+]]></part>
+
+<part name="SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD"><![CDATA[
+ <th><%colshortname%></th>
+ <th><%colblogname%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY"><![CDATA[
+ <td><%bshortname%></td>
+ <td><%blogname%></td>
+]]></part>
+
+<part name="SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD"><![CDATA[
+ <th><%colname%></th>
+ <th><%coldesc%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY"><![CDATA[
+ <td><%name%></td>
+ <td><%desc%></td>
+]]></part>
+
+<part name="SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD"><![CDATA[
+ <th><%colname%></th>
+ <th><%coldesc%></th>
+ <th colspan="2"><%colact%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY"><![CDATA[
+ <td><input type="checkbox" id="batch<%batchid%>" name="batch[<%batchid%>]" value="<%catid%>" />
+ <label for="batch<%batchid%>"><%catname%></label>
+ </td>
+ <td><%catdesc%></td>
+ <td><a href="<%adminurl%>index.php?action=categorydelete&blogid=<%blogid%>&catid=<%catid%>" tabindex="<%tabindex%>">
+ <%delbtn%></a></td>
+ <td><a href="<%adminurl%>index.php?action=categoryedit&blogid=<%blogid%>&catid=<%catid%>" tabindex="<%tabindex%>">
+ <%editbtn%></a></td>
+]]></part>
+
+<part name="SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD"><![CDATA[
+ <th><%colname%></th>
+ <th><%coldesc%></th>
+ <th colspan="3"><%colact%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY"><![CDATA[
+ <td><%templatename%></td>
+ <td><%templatedesc%></td>
+ <td style="white-space:nowrap">
+ <a href="<%editurl%>" tabindex="<%tabindex%>"><%editbtn%>
+ </a></td>
+ <td style="white-space:nowrap">
+ <a href="<%cloneurl%>" tabindex="<%tabindex%>"><%clonebtn%>
+ </a></td>
+ <td style="white-space:nowrap">
+ <a href="<%deleteurl%>" tabindex="<%tabindex%>"><%delbtn%>
+ </a></td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD"><![CDATA[
+ <th><%colblog%></th>
+ <th><%coldesc%></th>
+ <th colspan="2"><%colact%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY"><![CDATA[
+ <td><%bshortname%></td>
+ <td><%ititle%></td>
+ <td><a href="<%adminurl%>index.php?action=itemedit&itemid=<%itemid%>"><%editbtn%></a></td>
+ <td><a href="<%adminurl%>index.php?action=itemdelete&itemid=<%itemid%>"><%delbtn%></a></td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN"><![CDATA[
+ <td style="white-space:nowrap"><a href="<%adminurl%>index.php?action=banlistnewfromitem&itemid=<%itemid%>&ip=<%banip%>" title="<%banhost%>"><%banbtn%></a></td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD"><![CDATA[
+ <th><%blognames%></th><th colspan="8"><%actionshead%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY"><![CDATA[
+ <td title="blogid:<%blogid%> shortname:<%shortname%>">
+ <a href="<%blogurl%>"><img src="<%skinfile(/images/globe.gif)%>" width="13" height="13" alt="<%iconalt%>" /></a> <%blogname%>
+ </td>
+ <td>
+ <a href="<%adminurl%>index.php?action=createitem&blogid=<%blogid%>" title="<%ttaddtext%>"><%addtext%></a>
+ </td>
+ <td>
+ <a href="<%adminurl%>index.php?action=itemlist&blogid=<%blogid%>" title="<%ttedittext%>"><%edittext%></a>
+ </td>
+ <td>
+ <a href="<%adminurl%>index.php?action=blogcommentlist&blogid=<%blogid%>" title="<%ttcommenttext%>"><%commenttext%></a>
+ </td>
+ <td>
+ <a href="<%adminurl%>index.php?action=bookmarklet&blogid=<%blogid%>" title="<%ttbmlettext%>"><%bmlettext%></a>
+ </td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD"><![CDATA[
+ <th><%colinfo%></th>
+ <th><%colcontent%></th>
+ <th colspan="3"><%colaction%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY"><![CDATA[
+ <td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>
+ <td><input type="checkbox" id="batch<%batchid%>" name="batch[<%batchid%>]" value="<%commentid%>" />
+ <label for="batch<%batchid%>"><%commentbody%></label></td>
+ <td style="white-space:nowrap">
+ <a href="<%adminurl%>index.php?action=commentedit&commentid=<%commentid%>"><%editbtn%></a></td>
+ <td style="white-space:nowrap">
+ <a href="<%adminurl%>index.php?action=commentdelete&commentid=<%commentid%>"><%delbtn%></a></td>
+ <%addbanlist%>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD"><![CDATA[
+<input type="password" size="40" maxlength="128" name="<%varname%>" value="<%value%>" />
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP"><![CDATA[
+<select name="<%varname%>">
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO"><![CDATA[
+<option value="<%value%>"<%selected%>><%optname%></option>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC"><![CDATA[
+</select>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA"><![CDATA[
+<textarea class="pluginoption" cols="30" rows="5" name="<%varname%>"<%readonly%>><%value%></textarea>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT"><![CDATA[
+<input type="text" size="40" maxlength="128" name="<%varname%>" value="<%value%>"<%datatype%><%readonly%> />
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT"><![CDATA[
+<%extra%></td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT"><![CDATA[
+
+<tr>
+<td><%savetext%></td>
+<td><input type="submit" value="<%savetext%>" /></td>
+</tr>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD"><![CDATA[
+ <th><%colinfo%></th>
+ <th><%colcontent%></th>
+ <th style="white-space:nowrap"><%colaction%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY"><![CDATA[
+ <td<%cssclass%>>
+ <%bshortlabel%> <%bshortnameval%><br />
+ <%categorylabel%> <%categorynameval%><br />
+ <%authorlabel%> <%authornameval%><br />
+ <%itemdatelabel%> <%itemdateval%><br />
+ <%itemtimelabel%> <%itemtimeval%>
+ </td>
+ <td<%cssclass%>>
+ <input type="checkbox" id="batch<%batchid%>" name="batch[<%batchid%>]" value="<%itemid%>" />
+ <label for="batch<%batchid%>"><b><%itemtitle%></b></label><br />
+ <%itembody%></td>
+ <td style="white-space:nowrap"<%cssclass%>>
+ <a href="<%adminurl%>index.php?action=itemedit&itemid=<%itemid%>"><%editbtn%></a><br />
+ <a href="<%adminurl%>index.php?action=itemmove&itemid=<%itemid%>"><%movebtn%></a><br />
+ <a href="<%adminurl%>index.php?action=itemdelete&itemid=<%itemid%>"><%delbtn%></a><br />
+ <%camount%>
+ </td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD"><![CDATA[
+ <th><%colinfo%></th>
+ <th><%colvalue%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND"><![CDATA[
+ <br /><br /><%deplistlbl%><br /><%dependlist%>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ"><![CDATA[
+ <br /><br /><%deprlstlbl%><br /><%depreqlist%>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE"><![CDATA[
+ <td colspan="2"><%noplugalert%></td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN"><![CDATA[
+ <td>
+ <a href="<%actionupurl%>" tabindex="<%tabindex%>"><%actionuptxt%></a><br />
+ <a href="<%actiondownurl%>" tabindex="<%tabindex%>"><%actiondowntxt%></a><br />
+ <a href="<%actuninsturl%>" tabindex="<%tabindex%>"><%actuninsttxt%></a><br />
+ <%plugadminurl%>
+ <%plughelpurl%>
+ <%plugoptsetting%>
+ </td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY"><![CDATA[
+ <td><%description%></td>
+ <td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO"><![CDATA[
+ <input type="radio" name="<%name%>" value="<%yesval%>"<%yescheckedval%> id="<%yesid%>" />
+ <label for="<%yesid%>"><%yesvaltext%></label>
+ <input type="radio" name="<%name%>" value="<%noval%>"<%nocheckedval%> id="<%noid%>"<%disabled%> />
+ <label for="<%noid%>"><%novaltext%></label>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL"><![CDATA[
+ <a href="<%actoptionurl%>" tabindex="<%tabindex%>"><%actoptiontxt%></a><br />
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN"><![CDATA[
+ <a href="<%actadminurl%>" tabindex="<%tabindex%>"><%actadmintxt%></a><br />
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP"><![CDATA[
+ <a href="<%acthelpurl%>" tabindex="<%tabindex%>"><%acthelptxt%></a><br />
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL"><![CDATA[
+ <a href="<%plugurl%>" tabindex="<%tabindex%>"><%plugsite%></a>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD"><![CDATA[
+ <th><%colinfo%></th>
+ <th><%coldesc%></th>
+ <th style=\"white-space:nowrap\"><%colactions%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST"><![CDATA[
+ <br /><br /><%evntlstlbl%><br /><%eventlist%>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE"><![CDATA[
+ <br /><br /><strong><%updatealert%></strong>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY"><![CDATA[
+ <td>
+ <strong><%plugname%></strong><br />
+ <%autherlabel%> <%plugauther%><br />
+ <%versionlabel%> <%plugversion%><br />
+ <%pluggeturl%><br />
+ </td>
+ <td>
+ <%desclabel%><br /><%plugdesc%>
+ <%eventlist%>
+ <%needupdate%>
+ <%dependlist%>
+ <%depreqlist%>
+ </td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD"><![CDATA[
+ <th><%colmembername%></th>
+ <th><%colmemberrname%></th>
+ <th><%colteamadmin%><%helplink(teamadmin)%></th>
+ <th colspan="2"><%colactions%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY"><![CDATA[
+ <td>
+ <input type="checkbox" id="batch<%id%>" name="batch[<%id%>]" value="<%memberid%>" />
+ <label for="batch<%id%>">
+ <a href="mailto:<%mailaddress%>" tabindex="<%tabindex%>"><%name%></a>
+ </label>
+ </td>
+ <td><%realname%></td>
+ <td><%admin%></td>
+ <td><a href="<%adminurl%>index.php?action=teamdelete&memberid=<%memberid%>&blogid=<%blogid%>" tabindex="<%tabindex%>"><%deletebtn%></a></td>
+ <td><a href="<%chadminurl%>" tabindex="<%tabindex%>"><%chadminbtn%></a></td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY"><![CDATA[
+ <td>
+ <input type="checkbox" id="batch<%id%>" name="batch[<%id%>]" value="<%memberid%>" />
+ <label for="batch<%id%>">
+ <a href="mailto:<%mailaddress%>" tabindex="<%tabindex%>"><%name%></a>
+ </label>
+ </td>
+ <td><%realname%></td>
+ <td><a href="<%url%>" tabindex="<%tabindex%>"><%url%></a></td>
+ <td><%admin%></td>
+ <td><%login%></td>
+ <td><a href="<%adminurl%>index.php?action=memberedit&memberid=<%memberid%>" tabindex="<%tabindex%>"><%editbtn%></a></td>
+ <td><a href="<%adminurl%>index.php?action=memberdelete&memberid=<%memberid%>" tabindex="<%tabindex%>"><%deletebtn%></a></td>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_FOOT"><![CDATA[
+ <%typefoot%>
+ </tbody>
+ </table>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD"><![CDATA[
+ <th><%colmembername%></th>
+ <th><%colmemberrname%></th>
+ <th><%colmemberurl%></th>
+ <th><%colmemberadmin%><%helplink(superadmin)%></th>
+ <th><%colmemberlogin%><%helplink(canlogin)%></th>
+ <th colspan="2"><%colactions%></th>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_SELECT_FOOT"><![CDATA[
+ </select>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_HEAD"><![CDATA[
+ <table frame="box" rules="all" summary="<%summary%>">
+ <thead>
+ <tr>
+ <%typehead%>
+ </tr>
+ </thead>
+ <tbody>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_TABLE_BODY"><![CDATA[
+ <tr onmouseover="focusRow(this);" onmouseout="blurRow(this);">
+ <%typebody%>
+ </tr>
+]]></part>
+<part name="SKINIE_EXPORT_LIST"><![CDATA[
+ <tr>
+ <td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>
+ <td><%expdesc%></td>
+ </tr>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_SELECT_HEAD"><![CDATA[
+ <select name="<%name%>" tabindex="<%tabindex%>" <%javascript%>>
+ <%extraoption%>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_SELECT_BODY"><![CDATA[
+ <option value="<%value%>" <%selected%> title="<%title%>"><%option%></option>
+]]></part>
+<part name="SHOWLIST_LISTPLUG_SELECT_FOOT"><![CDATA[
+ </select>
+]]></part>
+<part name="INPUTYESNO_TEMPLATE_NORMAL"><![CDATA[
+ <input type="radio" name="<%name%>" value="<%yesval%>"<%yescheckedval%> id="<%yesid%>" />
+ <label for="<%yesid%>"><%yesvaltext%></label>
+ <input type="radio" name="<%name%>" value="<%noval%>"<%nocheckedval%> id="<%noid%>"<%disabled%> />
+ <label for="<%noid%>"><%novaltext%></label>
+]]></part>
+<part name="SYSTEMINFO_GDSETTINGS"><![CDATA[
+ <tr>
+ <td width="50%"><%key%></td>
+ <td><%value%></td>
+ </tr>
+]]></part>
+<part name="BANLIST_DELETED_LIST"><![CDATA[
+ <li><%blogname%></li>
+]]></part>
+<part name="INSERT_PLUGOPTION_TITLE"><![CDATA[
+ <tr>
+ <th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>
+ </tr>
+]]></part>
+<part name="INSERT_PLUGOPTION_BODY"><![CDATA[
+ <tr><%listplugplugoptionrow(admin/default)%></tr>
+]]></part>
+<part name="INPUTYESNO_TEMPLATE_ADMIN"><![CDATA[
+ <input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>"<%yescheckedval%> id="<%yesid%>" />
+ <label for="<%yesid%>"><%yesvaltext%></label>
+ <input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>"<%nocheckedval%> id="<%noid%>"<%disabled%> />
+ <label for="<%noid%>"><%novaltext%></label>
+]]></part>
+<part name="SPECIALSKINLIST_HEAD"><![CDATA[
+ <ul>
+]]></part>
+<part name="SPECIALSKINLIST_BODY"><![CDATA[
+ <li><a tabindex="<%tabindex%>" href="<%adminurl%>index.php?action=skinedittype&skinid=<%skinid%>&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="<%adminurl%>index.php?action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>
+]]></part>
+<part name="SPECIALSKINLIST_FOOT"><![CDATA[
+ </ul>
+]]></part>
+
+<part name="TEMPLATE_EDIT_ROW_HEAD"><![CDATA[
+ <tr>
+ <td><%description%><%help%></td>
+ <td id="td<%count%>">
+ <textarea class="templateedit" name="<%name%>" tabindex="<%tabindex%>" cols="50" rows="<%rows%>" id="textarea<%count%>">
+]]></part>
+<part name="TEMPLATE_EDIT_ROW_TAIL"><![CDATA[
+ </textarea>
+ </td>
+ </tr>
+]]></part>
+
+<part name="TEMPLATE_EDIT_EXPLUGNAME"><![CDATA[
+ <tr>
+ <th colspan="2"><%explugtplname%></th>
+ </tr>
+]]></part>
+
+<part name="ADMIN_BATCHLIST"><![CDATA[
+ <li><%text(_BATCH_EXECUTING)% <b><%adminbatchaction%></b> <%batchlisttype%> <b><%batchid%></b>... <b><%batchlistmsg%></b></li>
+]]></part>
+<part name="ADMIN_BLOGLINK"><![CDATA[
+ <a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>
+]]></part>
+
+<part name="ADMIN_CUSTOMHELPLINK_ANCHOR"><![CDATA[
+ <a href="<%helpurl%>#<%helptarget%>" title="<%title%>" <%onclick%>>
+]]></part>
+<part name="ADMIN_CUSTOMHELPLINK_ICON"><![CDATA[
+ <img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>
+]]></part>
+<part name="NORMALSKINLIST_HEAD"><![CDATA[
+ <ul>
+]]></part>
+<part name="NORMALSKINLIST_BODY"><![CDATA[
+ <li><a href="<%editurl%>" tabindex="<%tabindex%>"><%skintypename%></a> <%help%></li>
+]]></part>
+<part name="NORMALSKINLIST_FOOT"><![CDATA[
+ </ul>
+]]></part>
+<part name="SPECIALSKINLIST_HEAD"><![CDATA[
+ <ul>
+]]></part>
+<part name="SPECIALSKINLIST_BODY"><![CDATA[
+ <li><a href="<%editurl%>" tabindex="<%tabindex%>"><%skintype%></a> (<a href="<%removeurl%>" tabindex="<%tabindex%>">remove</a>)</li>
+]]></part>
+<part name="SPECIALSKINLIST_FOOT"><![CDATA[
+ </ul>
+]]></part>
+<part name="PLUGIN_QUICKMENU_BODY"><![CDATA[
+ <li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>
+]]></part>
+<part name="PLUGIN_QUICKMENU_FOOT"><![CDATA[
+ </ul>
+]]></part>
+</template>
+</nucleusskin>
This stylesheet serves to make item previews look nicer, and to markup the
buttonbar
- $Id: addedit.css 757 2005-08-12 07:29:40Z dekarma $
+ $Id: addedit.css 1888 2012-06-17 08:38:54Z sakamocchi $
*/
.leftbox, .rightbox {
/*
admin area style
- $Id: admin.css 1261 2008-05-22 20:32:43Z kaigreve $
+ $Id: admin_contemporary.css 1888 2012-06-17 08:38:54Z sakamocchi $
*/
body {
/*
admin area style
- $Id: admin_original.css 1652 2012-02-11 06:02:05Z sakamocchi $
+ $Id: admin_original.css 1888 2012-06-17 08:38:54Z sakamocchi $
*/
body {
/*
style definitions for the bookmarklet
- $Id: bookmarklet.css 1277 2008-10-22 08:43:59Z shizuki $
+ $Id: bookmarklet.css 1888 2012-06-17 08:38:54Z sakamocchi $
*/
body {
/*
documentation style
- $Id: manual.css 757 2005-08-12 07:29:40Z dekarma $
+ $Id: manual.css 1888 2012-06-17 08:38:54Z sakamocchi $
*/
body {
/*
media library popup
- $Id: popups.css 757 2005-08-12 07:29:40Z dekarma $
+ $Id: popups.css 1888 2012-06-17 08:38:54Z sakamocchi $
*/
body {
-<div class="clearing"> </div>\r
-</div>\r
-</div>\r
-<!-- end wrapper divs -->\r
-\r
-<!-- page footer, copyrights, etc. -->\r
-<div id="footer">\r
-<div id="copyrights">\r
- <small>Copyright | <a href="http://nucleuscms.org"><%version%></a> | \r
- <a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0 Strict</a> | \r
- <a href="http://jigsaw.w3.org/css-validator/">Valid CSS</a> | \r
- <a href="#top">Back to top</a></small>\r
-</div>\r
-<%benchmark%>\r
-</div>\r
-\r
-</body>\r
-</html>\r
+<div class="clearing"> </div>
+</div>
+</div>
+<!-- end wrapper divs -->
+
+<!-- page footer, copyrights, etc. -->
+<div id="footer">
+<div id="copyrights">
+ <small>Copyright | <a href="http://nucleuscms.org"><%version%></a> |
+ <a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0 Strict</a> |
+ <a href="http://jigsaw.w3.org/css-validator/">Valid CSS</a> |
+ <a href="#top">Back to top</a></small>
+</div>
+<%benchmark%>
+</div>
+
+</body>
+</html>
-// from http://www.kryogenix.org\r
-// by Scott Andrew - http://scottandrew.com\r
-// add an eventlistener to browsers that can do it somehow.\r
-function addEvent(obj, evType, fn)\r
- {\r
- if (obj.addEventListener)\r
- {\r
- obj.addEventListener(evType, fn, false);\r
- return true;\r
- }\r
- else if (obj.attachEvent)\r
- {\r
- var r = obj.attachEvent('on'+evType, fn);\r
- return r;\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
- }\r
-\r
-function floatImages()\r
- {\r
- // adapted from http://www.dithered.com/javascript/browser_detect/\r
- //**************************************************************//\r
- // sniff user agent\r
- var userAgent = navigator.userAgent.toLowerCase();\r
-\r
- // if Mozilla 1.4 then quit\r
- if ((userAgent.indexOf('gecko') != -1) && (userAgent.indexOf('gecko/') + 14 == userAgent.length) && (parseFloat(userAgent.substring(userAgent.indexOf('rv:') + 3)) == '1.4')) return;\r
-\r
- // if Opera then quit\r
- if (document.all && window.Event) return;\r
- //**************************************************************//\r
-\r
- // check this browser can cope with what we want to do\r
- if (!document.getElementById) return;\r
- var blogDiv = document.getElementById('blog');\r
- if (!blogDiv) return;\r
- if (!blogDiv.offsetWidth) return;\r
-\r
- blogDiv.className = (blogDiv.offsetWidth >= 500) ? "float-images" : "block-images";\r
- }\r
-\r
-// Blockquote citations\r
-\r
-// Simon Willison's work:\r
-// http://simon.incutio.com/archive/2002/12/20/#blockquoteCitations\r
-\r
-// Also Dunstan Orchard's work:\r
-// http://1976design.com/blog/archive/2003/11/10/updates/\r
-function blockquoteCite()\r
- {\r
- if (!document.createElementNS)\r
- {\r
- document.createElementNS = function(ns, elt)\r
- {\r
- return document.createElement(elt);\r
- }\r
- }\r
- quotes = document.getElementsByTagName('blockquote');\r
- for (i = 0; i < quotes.length; i++)\r
- {\r
- var cite = quotes[i].getAttribute('cite');\r
- // value of cite attribute should only contain URI, not any other\r
- if ((cite) && (cite != ''))\r
- {\r
- newlink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');\r
- newlink.setAttribute('href', cite);\r
- newlink.className = 'cite-link';\r
- newlink.appendChild(document.createTextNode(cite));\r
- newdiv = document.createElementNS('http://www.w3.org/1999/xhtml', 'cite');\r
- newdiv.className = 'blockquote-cite';\r
- newdiv.appendChild(document.createTextNode('Source: '));\r
- newdiv.appendChild(newlink);\r
- quotes[i].appendChild(newdiv);\r
- quotes[i].removeAttribute('cite');\r
- }\r
- }\r
- }\r
-\r
-// Ins and Del tags citations\r
-function insdelCite()\r
- {\r
- if (!document.createElementNS)\r
- {\r
- document.createElementNS = function(ns, elt)\r
- {\r
- return document.createElement(elt);\r
- }\r
- }\r
- var insdel = new Array(2);\r
- insdel[0] = document.getElementsByTagName('ins');\r
- insdel[1] = document.getElementsByTagName('del');\r
- for (var i=0; i<insdel.length; i++)\r
- {\r
- if (insdel[i])\r
- {\r
- for (var id=0; id<insdel[i].length; id++)\r
- {\r
- var isdl = insdel[i][id].getAttribute('cite');\r
- if ((isdl) && (isdl != ""))\r
- {\r
- idlink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');\r
- idlink.setAttribute('href', isdl);\r
- idlink.className = 'cite-link ' + (i == 0 ? 'ins-cite' : 'del-cite');\r
- idlink.setAttribute('title','citation of ' + (i == 0 ? 'added' : 'deleted') + ' text');\r
- idlink.appendChild(document.createTextNode('#'));\r
- insdel[i][id].appendChild(idlink);\r
- insdel[i][id].removeAttribute('cite');\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
-// Force IE not to show alternate text as tooltip\r
-function noAltTooltip()\r
- {\r
- images = document.getElementsByTagName('img');\r
- for (var i = 0; i < images.length; i++)\r
- {\r
- var title = images[i].getAttribute('title');\r
- var alt = images[i].getAttribute('alt');\r
- if ((document.all) && (alt) && (!title))\r
- {\r
- images[i].setAttribute('title', '');\r
- }\r
- }\r
- }\r
-\r
-// Nice Titles\r
-\r
-// original code by Stuart Langridge 2003-11\r
-// with additions to the code by other good people\r
-// http://www.kryogenix.org/code/browser/nicetitle/\r
-// thank you, sir\r
-\r
-// modified by Peter Janes 2003-03-25\r
-// http://peterjanes.ca/blog/archives/2003/03/25/nicetitles-for-ins-and-del\r
-// added in ins and del tags\r
-\r
-// modified by Dunstan Orchard 2003-11-18\r
-// http://1976design.com/blog/\r
-// added in accesskey information\r
-// tried ever-so-hard, but couldn't work out how to do what Ethan did\r
-\r
-// final genius touch by by Ethan Marcotte 2003-11-18\r
-// http://www.sidesh0w.com/\r
-// worked out how to delay showing the popups to make them more like the browser's own\r
-\r
-// set the namespace\r
-var XHTMLNS = 'http://www.w3.org/1999/xhtml';\r
-var CURRENT_NICE_TITLE;\r
-\r
-// browser sniff\r
-var browser = new Browser();\r
-\r
-// determine browser and version.\r
-function Browser()\r
- {\r
- var ua, s, i;\r
-\r
- this.isIE = false;\r
- this.isNS = false;\r
- this.version = null;\r
-\r
- ua = navigator.userAgent;\r
-\r
- s = 'MSIE';\r
- if ((i = ua.indexOf(s)) >= 0)\r
- {\r
- this.isIE = true;\r
- this.version = parseFloat(ua.substr(i + s.length));\r
- return;\r
- }\r
-\r
- s = 'Netscape6/';\r
- if ((i = ua.indexOf(s)) >= 0)\r
- {\r
- this.isNS = true;\r
- this.version = parseFloat(ua.substr(i + s.length));\r
- return;\r
- }\r
-\r
- // treat any other 'Gecko' browser as NS 6.1.\r
- s = 'Gecko';\r
- if ((i = ua.indexOf(s)) >= 0)\r
- {\r
- this.isNS = true;\r
- this.version = 6.1;\r
- return;\r
- }\r
- }\r
-\r
-// 2003-11-19 sidesh0w\r
-// set delay vars to emulate normal hover delay\r
-var delay;\r
-var interval = 0.60;\r
-\r
-// this function runs on window load\r
-// it runs through all the links on the page as starts listening for actions\r
-function makeNiceTitles()\r
- {\r
- if (!document.createElement || !document.getElementsByTagName) return;\r
- if (!document.createElementNS)\r
- {\r
- document.createElementNS = function(ns, elt)\r
- {\r
- return document.createElement(elt);\r
- }\r
- }\r
-\r
- // do regular links\r
- if (!document.links)\r
- {\r
- document.links = document.getElementsByTagName('a');\r
- }\r
- for (var ti=0; ti<document.links.length; ti++)\r
- {\r
- var lnk = document.links[ti];\r
- // * I added specific class names here..\r
- if (lnk.title)\r
- {\r
- lnk.setAttribute('nicetitle', lnk.title);\r
- lnk.removeAttribute('title');\r
- addEvent(lnk, 'mouseover', showNiceTitle);\r
- addEvent(lnk, 'mousemove', moveNiceTitle);\r
- addEvent(lnk, 'mouseout', hideNiceTitle);\r
- addEvent(lnk, 'focus', showNiceTitle);\r
- addEvent(lnk, 'blur', hideNiceTitle);\r
- }\r
- }\r
-\r
- // 2003-03-25 Peter Janes\r
- // do ins and del tags\r
- var tags = new Array(2);\r
- tags[0] = document.getElementsByTagName('ins');\r
- tags[1] = document.getElementsByTagName('del');\r
- for (var tt=0; tt<tags.length; tt++)\r
- {\r
- if (tags[tt])\r
- {\r
- for (var ti=0; ti<tags[tt].length; ti++)\r
- {\r
- var tag = tags[tt][ti];\r
- if (tag.dateTime)\r
- {\r
- var strDate = tag.dateTime;\r
- // HTML/ISO8601 date: yyyy-mm-ddThh:mm:ssTZD (Z, -hh:mm, +hh:mm)\r
- var month = strDate.substring(5,7);\r
- var day = strDate.substring(8,10);\r
- if (month[0] == '0')\r
- {\r
- month = month[1];\r
- }\r
- if (day[0] == '0')\r
- {\r
- day = day[1];\r
- }\r
- var dtIns = new Date(strDate.substring(0,4), month-1, day, strDate.substring(11,13), strDate.substring(14,16), strDate.substring(17,19));\r
- tag.setAttribute('nicetitle', (tt == 0 ? 'Added' : 'Deleted') + ' on ' + dtIns.toString());\r
- addEvent(tag, 'mouseover', showNiceTitle);\r
- addEvent(tag, 'mousemove', moveNiceTitle);\r
- addEvent(tag, 'mouseout', hideNiceTitle);\r
- addEvent(tag, 'focus', showNiceTitle);\r
- addEvent(tag, 'blur', hideNiceTitle);\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
-function findPosition(oLink)\r
- {\r
- if (oLink.offsetParent)\r
- {\r
- for (var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent)\r
- {\r
- posX += oLink.offsetLeft;\r
- posY += oLink.offsetTop;\r
- }\r
- return [posX, posY];\r
- }\r
- else\r
- {\r
- return [oLink.x, oLink.y];\r
- }\r
- }\r
-\r
-function getParent(el, pTagName)\r
- {\r
- if (el == null)\r
- {\r
- return null;\r
- }\r
- // gecko bug, supposed to be uppercase\r
- else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())\r
- {\r
- return el;\r
- }\r
- else\r
- {\r
- return getParent(el.parentNode, pTagName);\r
- }\r
- }\r
-\r
-// 2003-11-19 sidesh0w\r
-// trailerpark wrapper function\r
-function showDelay()\r
- {\r
- if (CURRENT_NICE_TITLE)\r
- {\r
- CURRENT_NICE_TITLE.style.display = '';\r
- }\r
- }\r
-\r
-// build and show the nice titles\r
-function showNiceTitle(e)\r
- {\r
- if (CURRENT_NICE_TITLE) hideNiceTitle(CURRENT_NICE_TITLE);\r
- if (!document.getElementsByTagName) return;\r
-\r
- if (window.event && window.event.srcElement)\r
- {\r
- lnk = window.event.srcElement\r
- }\r
- else if (e && e.target)\r
- {\r
- lnk = e.target\r
- }\r
- if (!lnk) return;\r
-\r
- // lnk is a textnode or an elementnode that's not ins/del\r
- if (lnk.nodeType == 3 || (lnk.nodeType == 1 && lnk.tagName.toLowerCase() != 'ins' && lnk.tagName.toLowerCase() != 'del'))\r
- {\r
- // ascend parents until we hit a link\r
- lnk = getParent(lnk, 'a');\r
- }\r
-\r
- nicetitle = lnk.getAttribute('nicetitle');\r
-\r
- var d = document.createElementNS(XHTMLNS, 'div');\r
- d.className = 'nicetitle';\r
- var dc = document.createElementNS(XHTMLNS, 'div');\r
- dc.className = 'nicetitle-content';\r
- d.appendChild(dc);\r
- tnt = document.createTextNode(nicetitle);\r
- pat = document.createElementNS(XHTMLNS, 'p');\r
- pat.className = 'titletext';\r
- pat.appendChild(tnt);\r
-\r
- // 2003-11-18 Dunstan Orchard\r
- // added in accesskey info\r
- if (lnk.accessKey)\r
- {\r
- axs = document.createTextNode(' [' + lnk.accessKey + ']');\r
- axsk = document.createElementNS(XHTMLNS, 'span');\r
- axsk.className = 'accesskey';\r
- axsk.appendChild(axs);\r
- pat.appendChild(axsk);\r
- }\r
- dc.appendChild(pat);\r
-\r
- if (lnk.href)\r
- {\r
- tnd = document.createTextNode(lnk.href);\r
- pad = document.createElementNS(XHTMLNS, 'p');\r
- pad.className = 'destination';\r
- pad.appendChild(tnd);\r
- dc.appendChild(pad);\r
- }\r
-\r
- STD_WIDTH = 300;\r
-\r
- if (lnk.href)\r
- {\r
- h = lnk.href.length;\r
- }\r
- else\r
- {\r
- h = nicetitle.length;\r
- }\r
-\r
- if (nicetitle.length)\r
- {\r
- t = nicetitle.length;\r
- }\r
-\r
- h_pixels = h*6;\r
- t_pixels = t*10;\r
-\r
- if (t_pixels > STD_WIDTH)\r
- {\r
- w = t_pixels;\r
- }\r
- else if ((STD_WIDTH > t_pixels) && (t_pixels > h_pixels))\r
- {\r
- w = t_pixels;\r
- }\r
- else if ((STD_WIDTH > h_pixels) && (h_pixels > t_pixels))\r
- {\r
- w = h_pixels;\r
- }\r
- else\r
- {\r
- w = STD_WIDTH;\r
- }\r
-\r
- d.style.width = w + 'px';\r
- d.style.display = 'none';\r
-\r
- document.getElementsByTagName('body')[0].appendChild(d);\r
-\r
- CURRENT_NICE_TITLE = d;\r
-\r
- moveNiceTitle(e);\r
-\r
- delay = setTimeout("showDelay()", interval * 1000);\r
- }\r
-\r
-function moveNiceTitle(e)\r
- {\r
- if (!document.getElementsByTagName) return;\r
- if (!CURRENT_NICE_TITLE) return;\r
-\r
- if (document.all)\r
- {\r
- X = document.body.scrollLeft + window.event.clientX;\r
- }\r
- else if (document.layers || document.getElementById)\r
- {\r
- X = e.pageX;\r
- }\r
- w_title = Number(CURRENT_NICE_TITLE.style.width.replace(/^(\d+).*$/, '$1'));\r
- if (w_title + X > (window.innerWidth + (document.documentElement.scrollLeft || window.pageXOffset) - 20))\r
- {\r
- X = (window.innerWidth + (document.documentElement.scrollLeft || window.pageXOffset) - 20) - w_title;\r
- }\r
-\r
- if (document.all)\r
- {\r
- Y = document.body.scrollTop + window.event.clientY;\r
- }\r
- else if (document.layers || document.getElementById)\r
- {\r
- Y = e.pageY;\r
- }\r
- if (Y > (window.innerHeight + (document.documentElement.scrollTop || window.pageYOffset) - 60))\r
- {\r
- Y = Y - 25 - 60;\r
- }\r
- \r
- CURRENT_NICE_TITLE.style.left = X + 'px';\r
- CURRENT_NICE_TITLE.style.top = (Y + 25) + 'px';\r
- }\r
-\r
-function hideNiceTitle(e)\r
- {\r
- // 2003-11-19 sidesh0w\r
- // clearTimeout\r
- if (delay) clearTimeout(delay);\r
- if (!document.getElementsByTagName) return;\r
- if (CURRENT_NICE_TITLE)\r
- {\r
- document.getElementsByTagName('body')[0].removeChild(CURRENT_NICE_TITLE);\r
- CURRENT_NICE_TITLE = null;\r
- }\r
- }\r
-\r
-addEvent(window, "load", floatImages);\r
-addEvent(window, "resize", floatImages);\r
-addEvent(window, "load", blockquoteCite);\r
-addEvent(window, "load", insdelCite);\r
-addEvent(window, "load", noAltTooltip);\r
-addEvent(window, "load", makeNiceTitles);\r
-\r
-// I'm very poor in JavaScript. Please correct me if I'm wrong.\r
+// from http://www.kryogenix.org
+// by Scott Andrew - http://scottandrew.com
+// add an eventlistener to browsers that can do it somehow.
+function addEvent(obj, evType, fn)
+ {
+ if (obj.addEventListener)
+ {
+ obj.addEventListener(evType, fn, false);
+ return true;
+ }
+ else if (obj.attachEvent)
+ {
+ var r = obj.attachEvent('on'+evType, fn);
+ return r;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+function floatImages()
+ {
+ // adapted from http://www.dithered.com/javascript/browser_detect/
+ //**************************************************************//
+ // sniff user agent
+ var userAgent = navigator.userAgent.toLowerCase();
+
+ // if Mozilla 1.4 then quit
+ if ((userAgent.indexOf('gecko') != -1) && (userAgent.indexOf('gecko/') + 14 == userAgent.length) && (parseFloat(userAgent.substring(userAgent.indexOf('rv:') + 3)) == '1.4')) return;
+
+ // if Opera then quit
+ if (document.all && window.Event) return;
+ //**************************************************************//
+
+ // check this browser can cope with what we want to do
+ if (!document.getElementById) return;
+ var blogDiv = document.getElementById('blog');
+ if (!blogDiv) return;
+ if (!blogDiv.offsetWidth) return;
+
+ blogDiv.className = (blogDiv.offsetWidth >= 500) ? "float-images" : "block-images";
+ }
+
+// Blockquote citations
+
+// Simon Willison's work:
+// http://simon.incutio.com/archive/2002/12/20/#blockquoteCitations
+
+// Also Dunstan Orchard's work:
+// http://1976design.com/blog/archive/2003/11/10/updates/
+function blockquoteCite()
+ {
+ if (!document.createElementNS)
+ {
+ document.createElementNS = function(ns, elt)
+ {
+ return document.createElement(elt);
+ }
+ }
+ quotes = document.getElementsByTagName('blockquote');
+ for (i = 0; i < quotes.length; i++)
+ {
+ var cite = quotes[i].getAttribute('cite');
+ // value of cite attribute should only contain URI, not any other
+ if ((cite) && (cite != ''))
+ {
+ newlink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
+ newlink.setAttribute('href', cite);
+ newlink.className = 'cite-link';
+ newlink.appendChild(document.createTextNode(cite));
+ newdiv = document.createElementNS('http://www.w3.org/1999/xhtml', 'cite');
+ newdiv.className = 'blockquote-cite';
+ newdiv.appendChild(document.createTextNode('Source: '));
+ newdiv.appendChild(newlink);
+ quotes[i].appendChild(newdiv);
+ quotes[i].removeAttribute('cite');
+ }
+ }
+ }
+
+// Ins and Del tags citations
+function insdelCite()
+ {
+ if (!document.createElementNS)
+ {
+ document.createElementNS = function(ns, elt)
+ {
+ return document.createElement(elt);
+ }
+ }
+ var insdel = new Array(2);
+ insdel[0] = document.getElementsByTagName('ins');
+ insdel[1] = document.getElementsByTagName('del');
+ for (var i=0; i<insdel.length; i++)
+ {
+ if (insdel[i])
+ {
+ for (var id=0; id<insdel[i].length; id++)
+ {
+ var isdl = insdel[i][id].getAttribute('cite');
+ if ((isdl) && (isdl != ""))
+ {
+ idlink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
+ idlink.setAttribute('href', isdl);
+ idlink.className = 'cite-link ' + (i == 0 ? 'ins-cite' : 'del-cite');
+ idlink.setAttribute('title','citation of ' + (i == 0 ? 'added' : 'deleted') + ' text');
+ idlink.appendChild(document.createTextNode('#'));
+ insdel[i][id].appendChild(idlink);
+ insdel[i][id].removeAttribute('cite');
+ }
+ }
+ }
+ }
+ }
+
+// Force IE not to show alternate text as tooltip
+function noAltTooltip()
+ {
+ images = document.getElementsByTagName('img');
+ for (var i = 0; i < images.length; i++)
+ {
+ var title = images[i].getAttribute('title');
+ var alt = images[i].getAttribute('alt');
+ if ((document.all) && (alt) && (!title))
+ {
+ images[i].setAttribute('title', '');
+ }
+ }
+ }
+
+// Nice Titles
+
+// original code by Stuart Langridge 2003-11
+// with additions to the code by other good people
+// http://www.kryogenix.org/code/browser/nicetitle/
+// thank you, sir
+
+// modified by Peter Janes 2003-03-25
+// http://peterjanes.ca/blog/archives/2003/03/25/nicetitles-for-ins-and-del
+// added in ins and del tags
+
+// modified by Dunstan Orchard 2003-11-18
+// http://1976design.com/blog/
+// added in accesskey information
+// tried ever-so-hard, but couldn't work out how to do what Ethan did
+
+// final genius touch by by Ethan Marcotte 2003-11-18
+// http://www.sidesh0w.com/
+// worked out how to delay showing the popups to make them more like the browser's own
+
+// set the namespace
+var XHTMLNS = 'http://www.w3.org/1999/xhtml';
+var CURRENT_NICE_TITLE;
+
+// browser sniff
+var browser = new Browser();
+
+// determine browser and version.
+function Browser()
+ {
+ var ua, s, i;
+
+ this.isIE = false;
+ this.isNS = false;
+ this.version = null;
+
+ ua = navigator.userAgent;
+
+ s = 'MSIE';
+ if ((i = ua.indexOf(s)) >= 0)
+ {
+ this.isIE = true;
+ this.version = parseFloat(ua.substr(i + s.length));
+ return;
+ }
+
+ s = 'Netscape6/';
+ if ((i = ua.indexOf(s)) >= 0)
+ {
+ this.isNS = true;
+ this.version = parseFloat(ua.substr(i + s.length));
+ return;
+ }
+
+ // treat any other 'Gecko' browser as NS 6.1.
+ s = 'Gecko';
+ if ((i = ua.indexOf(s)) >= 0)
+ {
+ this.isNS = true;
+ this.version = 6.1;
+ return;
+ }
+ }
+
+// 2003-11-19 sidesh0w
+// set delay vars to emulate normal hover delay
+var delay;
+var interval = 0.60;
+
+// this function runs on window load
+// it runs through all the links on the page as starts listening for actions
+function makeNiceTitles()
+ {
+ if (!document.createElement || !document.getElementsByTagName) return;
+ if (!document.createElementNS)
+ {
+ document.createElementNS = function(ns, elt)
+ {
+ return document.createElement(elt);
+ }
+ }
+
+ // do regular links
+ if (!document.links)
+ {
+ document.links = document.getElementsByTagName('a');
+ }
+ for (var ti=0; ti<document.links.length; ti++)
+ {
+ var lnk = document.links[ti];
+ // * I added specific class names here..
+ if (lnk.title)
+ {
+ lnk.setAttribute('nicetitle', lnk.title);
+ lnk.removeAttribute('title');
+ addEvent(lnk, 'mouseover', showNiceTitle);
+ addEvent(lnk, 'mousemove', moveNiceTitle);
+ addEvent(lnk, 'mouseout', hideNiceTitle);
+ addEvent(lnk, 'focus', showNiceTitle);
+ addEvent(lnk, 'blur', hideNiceTitle);
+ }
+ }
+
+ // 2003-03-25 Peter Janes
+ // do ins and del tags
+ var tags = new Array(2);
+ tags[0] = document.getElementsByTagName('ins');
+ tags[1] = document.getElementsByTagName('del');
+ for (var tt=0; tt<tags.length; tt++)
+ {
+ if (tags[tt])
+ {
+ for (var ti=0; ti<tags[tt].length; ti++)
+ {
+ var tag = tags[tt][ti];
+ if (tag.dateTime)
+ {
+ var strDate = tag.dateTime;
+ // HTML/ISO8601 date: yyyy-mm-ddThh:mm:ssTZD (Z, -hh:mm, +hh:mm)
+ var month = strDate.substring(5,7);
+ var day = strDate.substring(8,10);
+ if (month[0] == '0')
+ {
+ month = month[1];
+ }
+ if (day[0] == '0')
+ {
+ day = day[1];
+ }
+ var dtIns = new Date(strDate.substring(0,4), month-1, day, strDate.substring(11,13), strDate.substring(14,16), strDate.substring(17,19));
+ tag.setAttribute('nicetitle', (tt == 0 ? 'Added' : 'Deleted') + ' on ' + dtIns.toString());
+ addEvent(tag, 'mouseover', showNiceTitle);
+ addEvent(tag, 'mousemove', moveNiceTitle);
+ addEvent(tag, 'mouseout', hideNiceTitle);
+ addEvent(tag, 'focus', showNiceTitle);
+ addEvent(tag, 'blur', hideNiceTitle);
+ }
+ }
+ }
+ }
+ }
+
+function findPosition(oLink)
+ {
+ if (oLink.offsetParent)
+ {
+ for (var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent)
+ {
+ posX += oLink.offsetLeft;
+ posY += oLink.offsetTop;
+ }
+ return [posX, posY];
+ }
+ else
+ {
+ return [oLink.x, oLink.y];
+ }
+ }
+
+function getParent(el, pTagName)
+ {
+ if (el == null)
+ {
+ return null;
+ }
+ // gecko bug, supposed to be uppercase
+ else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())
+ {
+ return el;
+ }
+ else
+ {
+ return getParent(el.parentNode, pTagName);
+ }
+ }
+
+// 2003-11-19 sidesh0w
+// trailerpark wrapper function
+function showDelay()
+ {
+ if (CURRENT_NICE_TITLE)
+ {
+ CURRENT_NICE_TITLE.style.display = '';
+ }
+ }
+
+// build and show the nice titles
+function showNiceTitle(e)
+ {
+ if (CURRENT_NICE_TITLE) hideNiceTitle(CURRENT_NICE_TITLE);
+ if (!document.getElementsByTagName) return;
+
+ if (window.event && window.event.srcElement)
+ {
+ lnk = window.event.srcElement
+ }
+ else if (e && e.target)
+ {
+ lnk = e.target
+ }
+ if (!lnk) return;
+
+ // lnk is a textnode or an elementnode that's not ins/del
+ if (lnk.nodeType == 3 || (lnk.nodeType == 1 && lnk.tagName.toLowerCase() != 'ins' && lnk.tagName.toLowerCase() != 'del'))
+ {
+ // ascend parents until we hit a link
+ lnk = getParent(lnk, 'a');
+ }
+
+ nicetitle = lnk.getAttribute('nicetitle');
+
+ var d = document.createElementNS(XHTMLNS, 'div');
+ d.className = 'nicetitle';
+ var dc = document.createElementNS(XHTMLNS, 'div');
+ dc.className = 'nicetitle-content';
+ d.appendChild(dc);
+ tnt = document.createTextNode(nicetitle);
+ pat = document.createElementNS(XHTMLNS, 'p');
+ pat.className = 'titletext';
+ pat.appendChild(tnt);
+
+ // 2003-11-18 Dunstan Orchard
+ // added in accesskey info
+ if (lnk.accessKey)
+ {
+ axs = document.createTextNode(' [' + lnk.accessKey + ']');
+ axsk = document.createElementNS(XHTMLNS, 'span');
+ axsk.className = 'accesskey';
+ axsk.appendChild(axs);
+ pat.appendChild(axsk);
+ }
+ dc.appendChild(pat);
+
+ if (lnk.href)
+ {
+ tnd = document.createTextNode(lnk.href);
+ pad = document.createElementNS(XHTMLNS, 'p');
+ pad.className = 'destination';
+ pad.appendChild(tnd);
+ dc.appendChild(pad);
+ }
+
+ STD_WIDTH = 300;
+
+ if (lnk.href)
+ {
+ h = lnk.href.length;
+ }
+ else
+ {
+ h = nicetitle.length;
+ }
+
+ if (nicetitle.length)
+ {
+ t = nicetitle.length;
+ }
+
+ h_pixels = h*6;
+ t_pixels = t*10;
+
+ if (t_pixels > STD_WIDTH)
+ {
+ w = t_pixels;
+ }
+ else if ((STD_WIDTH > t_pixels) && (t_pixels > h_pixels))
+ {
+ w = t_pixels;
+ }
+ else if ((STD_WIDTH > h_pixels) && (h_pixels > t_pixels))
+ {
+ w = h_pixels;
+ }
+ else
+ {
+ w = STD_WIDTH;
+ }
+
+ d.style.width = w + 'px';
+ d.style.display = 'none';
+
+ document.getElementsByTagName('body')[0].appendChild(d);
+
+ CURRENT_NICE_TITLE = d;
+
+ moveNiceTitle(e);
+
+ delay = setTimeout("showDelay()", interval * 1000);
+ }
+
+function moveNiceTitle(e)
+ {
+ if (!document.getElementsByTagName) return;
+ if (!CURRENT_NICE_TITLE) return;
+
+ if (document.all)
+ {
+ X = document.body.scrollLeft + window.event.clientX;
+ }
+ else if (document.layers || document.getElementById)
+ {
+ X = e.pageX;
+ }
+ w_title = Number(CURRENT_NICE_TITLE.style.width.replace(/^(\d+).*$/, '$1'));
+ if (w_title + X > (window.innerWidth + (document.documentElement.scrollLeft || window.pageXOffset) - 20))
+ {
+ X = (window.innerWidth + (document.documentElement.scrollLeft || window.pageXOffset) - 20) - w_title;
+ }
+
+ if (document.all)
+ {
+ Y = document.body.scrollTop + window.event.clientY;
+ }
+ else if (document.layers || document.getElementById)
+ {
+ Y = e.pageY;
+ }
+ if (Y > (window.innerHeight + (document.documentElement.scrollTop || window.pageYOffset) - 60))
+ {
+ Y = Y - 25 - 60;
+ }
+
+ CURRENT_NICE_TITLE.style.left = X + 'px';
+ CURRENT_NICE_TITLE.style.top = (Y + 25) + 'px';
+ }
+
+function hideNiceTitle(e)
+ {
+ // 2003-11-19 sidesh0w
+ // clearTimeout
+ if (delay) clearTimeout(delay);
+ if (!document.getElementsByTagName) return;
+ if (CURRENT_NICE_TITLE)
+ {
+ document.getElementsByTagName('body')[0].removeChild(CURRENT_NICE_TITLE);
+ CURRENT_NICE_TITLE = null;
+ }
+ }
+
+addEvent(window, "load", floatImages);
+addEvent(window, "resize", floatImages);
+addEvent(window, "load", blockquoteCite);
+addEvent(window, "load", insdelCite);
+addEvent(window, "load", noAltTooltip);
+addEvent(window, "load", makeNiceTitles);
+
+// I'm very poor in JavaScript. Please correct me if I'm wrong.
-<?php\r
-\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-\r
-/**\r
- * Nucleus RSS syndication channel skin\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: xml-rss2.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
- */\r
-\r
-header('Pragma: no-cache');\r
-\r
-$CONF = array();\r
-include('./config.php');\r
-\r
-if ( !$CONF['DisableSite'] )\r
-{\r
- // get feed into $feed\r
- ob_start();\r
- selectSkin('feeds/rss20');\r
- selector();\r
- $feed = ob_get_contents();\r
- ob_end_clean();\r
- \r
- /*\r
- * create ETAG (hash of feed)\r
- * (HTTP_IF_NONE_MATCH has quotes around it)\r
- */\r
- $eTag = '"' . md5($feed) . '"';\r
- header('Etag: ' . $eTag);\r
- \r
- // compare Etag to what we got\r
- if ( $eTag == serverVar('HTTP_IF_NONE_MATCH') )\r
- {\r
- header('HTTP/1.0 304 Not Modified');\r
- header('Content-Length: 0');\r
- }\r
- else\r
- {\r
- echo $feed;\r
- }\r
-}\r
-// site is disabled, output empty RSS file\r
-else\r
-{\r
- echo '<?xml version="1.0" encoding="' . i18n::get_current_charset() . '"?>' . "\n";\r
- echo "<rss version=\"2.0\">\n";\r
- echo "<channel>\n";\r
- echo '<title>' . Entity::hsc($CONF['SiteName']) . "</title>\n";\r
- echo "<link>" . Entity::hsc($CONF['IndexURL']) . "</link>\n";\r
- echo "<description></description>\n";\r
- echo "<docs>http://backend.userland.com/rss</docs>\n";\r
- echo "</channel>\n";\r
- echo "</rss>\n";\r
-}\r
+<?php
+
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+
+/**
+ * Nucleus RSS syndication channel skin
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: xml-rss2.php 1721 2012-03-31 10:18:25Z sakamocchi $
+ */
+
+header('Pragma: no-cache');
+
+$CONF = array();
+include('./config.php');
+
+if ( !$CONF['DisableSite'] )
+{
+ // get feed into $feed
+ ob_start();
+ selectSkin('feeds/rss20');
+ selector();
+ $feed = ob_get_contents();
+ ob_end_clean();
+
+ /*
+ * create ETAG (hash of feed)
+ * (HTTP_IF_NONE_MATCH has quotes around it)
+ */
+ $eTag = '"' . md5($feed) . '"';
+ header('Etag: ' . $eTag);
+
+ // compare Etag to what we got
+ if ( $eTag == serverVar('HTTP_IF_NONE_MATCH') )
+ {
+ header('HTTP/1.0 304 Not Modified');
+ header('Content-Length: 0');
+ }
+ else
+ {
+ echo $feed;
+ }
+}
+// site is disabled, output empty RSS file
+else
+{
+ echo '<?xml version="1.0" encoding="' . i18n::get_current_charset() . '"?>' . "\n";
+ echo "<rss version=\"2.0\">\n";
+ echo "<channel>\n";
+ echo '<title>' . Entity::hsc($CONF['SiteName']) . "</title>\n";
+ echo "<link>" . Entity::hsc($CONF['IndexURL']) . "</link>\n";
+ echo "<description></description>\n";
+ echo "<docs>http://backend.userland.com/rss</docs>\n";
+ echo "</channel>\n";
+ echo "</rss>\n";
+}