1
0

cleanup tabs and whites

This commit is contained in:
Ian
2014-11-24 14:17:38 +01:00
parent 6d7e2f44a3
commit 8da4c647a8
38 changed files with 665 additions and 658 deletions

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -128,7 +128,6 @@ if ( $serendipity['GET']['adminAction'] == 'delete' ) {
foreach ($cats as $cat_data) { foreach ($cats as $cat_data) {
if ($cat_data['categoryid'] != $serendipity['GET']['cid'] && (serendipity_checkPermission('adminCategoriesMaintainOthers') || $cat_data['authorid'] == '0' || $cat_data['authorid'] == $serendipity['authorid'])) { if ($cat_data['categoryid'] != $serendipity['GET']['cid'] && (serendipity_checkPermission('adminCategoriesMaintainOthers') || $cat_data['authorid'] == '0' || $cat_data['authorid'] == $serendipity['authorid'])) {
$data['cats'][] = $cat_data; $data['cats'][] = $cat_data;
} }
} }
} }

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
if (IN_serendipity !== true) { if (IN_serendipity !== true) {
die ("Don't hack!"); die ("Don't hack!");

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
if (IN_serendipity !== true) { if (IN_serendipity !== true) {
die ("Don't hack!"); die ("Don't hack!");

View File

@ -1,4 +1,4 @@
<?php # <?php
if (IN_serendipity !== true) { if (IN_serendipity !== true) {
die ('Don\'t hack!'); die ('Don\'t hack!');

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
if (IN_serendipity !== true) { if (IN_serendipity !== true) {
die ("Don't hack!"); die ("Don't hack!");

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,9 +1,9 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
/**************************************************************** /****************************************************************
* Blogger Importer v0.2, by Jawish Hameed (jawish.org) * * Blogger Importer v0.2, by Jawish Hameed (jawish.org) *
****************************************************************/ ****************************************************************/
require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
@ -34,103 +34,103 @@ class Serendipity_Import_Blogger extends Serendipity_Import {
'name' => 'bCharset', 'name' => 'bCharset',
'value' => 'UTF-8', 'value' => 'UTF-8',
'default' => $this->getCharsets()) 'default' => $this->getCharsets())
); );
} }
function getImportNotes(){ function getImportNotes(){
if (empty($_REQUEST['token'])) { if (empty($_REQUEST['token'])) {
$msg = 'In order to import your blog on Blogger, Serendipity needs to be able to access it via Google\'s Blogger Data APIs.'; $msg = 'In order to import your blog on Blogger, Serendipity needs to be able to access it via Google\'s Blogger Data APIs.';
$msg .= 'Login to your Google/Blogger account and then click the link below.'; $msg .= 'Login to your Google/Blogger account and then click the link below.';
$msg .= '<a class="block_level standalone" href="https://www.google.com/accounts/AuthSubRequest?scope=http%3A%2F%2Fwww.blogger.com%2Ffeeds%2F&session=1&secure=0&next='. urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) .'">Go to Google to grant access</a>'; $msg .= '<a class="block_level standalone" href="https://www.google.com/accounts/AuthSubRequest?scope=http%3A%2F%2Fwww.blogger.com%2Ffeeds%2F&session=1&secure=0&next='. urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) .'">Go to Google to grant access</a>';
return $msg; return $msg;
} else { } else {
return ''; return '';
} }
} }
function validateData() { function validateData() {
return sizeof($this->data); return sizeof($this->data);
} }
function getInputFields() { function getInputFields() {
// Make sure Google login has been completed // Make sure Google login has been completed
if (!empty($_REQUEST['token'])) { if (!empty($_REQUEST['token'])) {
// Prepare session token request // Prepare session token request
$req = new HTTP_Request('https://www.google.com/accounts/AuthSubSessionToken'); $req = new HTTP_Request('https://www.google.com/accounts/AuthSubSessionToken');
$req->addHeader('Authorization', 'AuthSub token="'. $_REQUEST['token'] .'"'); $req->addHeader('Authorization', 'AuthSub token="'. $_REQUEST['token'] .'"');
// Request token // Request token
$req->sendRequest(); $req->sendRequest();
// Handle token reponse // Handle token reponse
if ($req->getResponseCode() != '200') return; if ($req->getResponseCode() != '200') return;
// Extract Auth token // Extract Auth token
preg_match_all('/^(.+)=(.+)$/m', $req->getResponseBody(), $matches); preg_match_all('/^(.+)=(.+)$/m', $req->getResponseBody(), $matches);
$tokens = array_combine($matches[1], $matches[2]); $tokens = array_combine($matches[1], $matches[2]);
unset($matches); unset($matches);
// Add hidden auth token field to input field list // Add hidden auth token field to input field list
array_unshift($this->inputFields, array( 'text' => 'Google Auth Token (leave alone)', array_unshift($this->inputFields, array( 'text' => 'Google Auth Token (leave alone)',
'type' => 'input', 'type' => 'input',
'name' => 'bAuthToken', 'name' => 'bAuthToken',
'default' => $tokens['Token'])); 'default' => $tokens['Token']));
// Prepare blog list request // Prepare blog list request
$req = new HTTP_Request('http://www.blogger.com/feeds/default/blogs'); $req = new HTTP_Request('http://www.blogger.com/feeds/default/blogs');
$req->addHeader('GData-Version', 2); $req->addHeader('GData-Version', 2);
$req->addHeader('Authorization', 'AuthSub token="'. $tokens['Token'] .'"'); $req->addHeader('Authorization', 'AuthSub token="'. $tokens['Token'] .'"');
// Fetch blog list // Fetch blog list
$req->sendRequest(); $req->sendRequest();
// Handle errors // Handle errors
if ($req->getResponseCode() != '200') return false; if ($req->getResponseCode() != '200') return false;
// Load list // Load list
$bXml = simplexml_load_string($req->getResponseBody()); $bXml = simplexml_load_string($req->getResponseBody());
// Generate list of the blogs under the authenticated account // Generate list of the blogs under the authenticated account
$bList = array(); $bList = array();
foreach ($bXml->entry as $entry) { foreach ($bXml->entry as $entry) {
$bList[substr($entry->id, strpos($entry->id, 'blog-') + 5)] = $entry->title; $bList[substr($entry->id, strpos($entry->id, 'blog-') + 5)] = $entry->title;
} }
// Add blog list to input fields for selection // Add blog list to input fields for selection
array_unshift($this->inputFields, array('text' => 'Blog to import', array_unshift($this->inputFields, array('text' => 'Blog to import',
'type' => 'list', 'type' => 'list',
'name' => 'bId', 'name' => 'bId',
'value' => 0, 'value' => 0,
'default' => $bList)); 'default' => $bList));
return $this->inputFields; return $this->inputFields;
} else { } else {
return array(); return array();
} }
} }
function _getCategoryList() { function _getCategoryList() {
$res = serendipity_fetchCategories('all'); $res = serendipity_fetchCategories('all');
$ret = array(0 => NO_CATEGORY); $ret = array(0 => NO_CATEGORY);
if (is_array($res)) { if (is_array($res)) {
foreach ($res as $v) { foreach ($res as $v) {
$ret[$v['categoryid']] = $v['category_name']; $ret[$v['categoryid']] = $v['category_name'];
} }
} }
return $ret; return $ret;
} }
function import() { function import() {
global $serendipity; global $serendipity;
// Force user to select a blog to act on // Force user to select a blog to act on
if (empty($this->data['bId']) || $this->data['bId'] == 0) { if (empty($this->data['bId']) || $this->data['bId'] == 0) {
echo 'Please select a blog to import!'; echo 'Please select a blog to import!';
return false; return false;
} }
// Save this so we can return it to its original value at the end of this method. // Save this so we can return it to its original value at the end of this method.
$noautodiscovery = isset($serendipity['noautodiscovery']) ? $serendipity['noautodiscovery'] : false; $noautodiscovery = isset($serendipity['noautodiscovery']) ? $serendipity['noautodiscovery'] : false;
if ($this->data['autodiscovery'] == 'false') { if ($this->data['autodiscovery'] == 'false') {
@ -139,142 +139,142 @@ class Serendipity_Import_Blogger extends Serendipity_Import {
$this->getTransTable(); $this->getTransTable();
// Prepare export request // Prepare export request
$req = new HTTP_Request('http://www.blogger.com/feeds/'. $this->data['bId'] .'/archive'); $req = new HTTP_Request('http://www.blogger.com/feeds/'. $this->data['bId'] .'/archive');
$req->addHeader('GData-Version', 2); $req->addHeader('GData-Version', 2);
$req->addHeader('Authorization', 'AuthSub token="'. $this->data['bAuthToken'] .'"'); $req->addHeader('Authorization', 'AuthSub token="'. $this->data['bAuthToken'] .'"');
// Attempt fetch blog export // Attempt fetch blog export
$req->sendRequest(); $req->sendRequest();
// Handle errors // Handle errors
if ($req->getResponseCode() != '200') { if ($req->getResponseCode() != '200') {
echo "Error occured while trying to export the blog."; echo "Error occured while trying to export the blog.";
return false; return false;
} }
// Export success // Export success
echo '<span class="block_level">Successfully exported entries from Blogger</span>'; echo '<span class="block_level">Successfully exported entries from Blogger</span>';
// Get Serendipity authors list // Get Serendipity authors list
$authorList = array(); $authorList = array();
$s9y_users = serendipity_fetchUsers(); $s9y_users = serendipity_fetchUsers();
foreach ($s9y_users as $user) { foreach ($s9y_users as $user) {
$authorList[$user['authorid']] = $user['username']; $authorList[$user['authorid']] = $user['username'];
} }
unset($s9y_users); unset($s9y_users);
// Load export // Load export
$bXml = simplexml_load_string($req->getResponseBody()); $bXml = simplexml_load_string($req->getResponseBody());
// Process entries // Process entries
$entryList = $entryFailList = array(); $entryList = $entryFailList = array();
foreach ($bXml->entry as $bEntry) { foreach ($bXml->entry as $bEntry) {
// Check entry type // Check entry type
switch ($bEntry->category['term']) { switch ($bEntry->category['term']) {
case 'http://schemas.google.com/blogger/2008/kind#post': case 'http://schemas.google.com/blogger/2008/kind#post':
// Process posts: // Process posts:
// Create author if not in serendipity // Create author if not in serendipity
$author = (string) $bEntry->author->name; $author = (string) $bEntry->author->name;
if (!array_search($author, $authorList)) { if (!array_search($author, $authorList)) {
serendipity_db_insert( 'authors', serendipity_db_insert('authors',
array( 'right_publish' => 1, array('right_publish' => 1,
'realname' => $author, 'realname' => $author,
'username' => $author, 'username' => $author,
'userlevel' => 0, 'userlevel' => 0,
'password' => md5($this->data['defaultpass'])) 'password' => md5($this->data['defaultpass']))
); );
$authorid = serendipity_db_insert_id('authors', 'authorid'); $authorid = serendipity_db_insert_id('authors', 'authorid');
$authorList[$authorid] = $author; $authorList[$authorid] = $author;
} }
$sEntry = array('title' => $this->decode((string) $bEntry->title), $sEntry = array('title' => $this->decode((string) $bEntry->title),
'isdraft' => ($bEntry->children('http://purl.org/atom/app#')->control->draft == 'yes') ? 'true' : 'false', 'isdraft' => ($bEntry->children('http://purl.org/atom/app#')->control->draft == 'yes') ? 'true' : 'false',
'allow_comments' => (count($bEntry->xpath("*[@rel='replies']")) > 0) ? 'true' : 'false', 'allow_comments' => (count($bEntry->xpath("*[@rel='replies']")) > 0) ? 'true' : 'false',
'timestamp' => strtotime($bEntry->published), 'timestamp' => strtotime($bEntry->published),
'body' => $this->strtr((string) $bEntry->content), 'body' => $this->strtr((string) $bEntry->content),
'extended' => '', 'extended' => '',
'categories' => $this->data['bCategory'], 'categories' => $this->data['bCategory'],
'author' => $author, 'author' => $author,
'authorid' => $authorid 'authorid' => $authorid
); );
// Add entry to s9y // Add entry to s9y
echo '..~.. '; echo '..~.. ';
if (is_int($id = serendipity_updertEntry($sEntry))) { if (is_int($id = serendipity_updertEntry($sEntry))) {
// Add entry id to processed table for later lookups // Add entry id to processed table for later lookups
$entryList[(string) $bEntry->id] = array($id, $sEntry['title'], 0); $entryList[(string) $bEntry->id] = array($id, $sEntry['title'], 0);
} else { } else {
// Add to fail list // Add to fail list
$entryFailList[] = $sEntry['title']; $entryFailList[] = $sEntry['title'];
} }
break; break;
case 'http://schemas.google.com/blogger/2008/kind#comment': case 'http://schemas.google.com/blogger/2008/kind#comment':
// Process comments: // Process comments:
// Extract entry id for comment // Extract entry id for comment
$cEntryId = $bEntry->xpath("thr:in-reply-to[@ref]"); $cEntryId = $bEntry->xpath("thr:in-reply-to[@ref]");
$cEntryId = (string) $cEntryId[0]['ref']; $cEntryId = (string) $cEntryId[0]['ref'];
// Check to make sure the related entry has been added to s9y // Check to make sure the related entry has been added to s9y
if (array_key_exists($cEntryId, $entryList)) { if (array_key_exists($cEntryId, $entryList)) {
// Add to s9y // Add to s9y
$sComment = array( 'entry_id ' => $entryList[$cEntryId][0], $sComment = array( 'entry_id ' => $entryList[$cEntryId][0],
'parent_id' => 0, 'parent_id' => 0,
'timestamp' => strtotime($bEntry->published), 'timestamp' => strtotime($bEntry->published),
'author' => (string) $bEntry->author->name, 'author' => (string) $bEntry->author->name,
'email' => (string) $bEntry->author->email, 'email' => (string) $bEntry->author->email,
'url' => (string) (isset($bEntry->author->uri)) ? $bEntry->author->uri : '', 'url' => (string) (isset($bEntry->author->uri)) ? $bEntry->author->uri : '',
'ip' => '', 'ip' => '',
'status' => 'approved', 'status' => 'approved',
'body' => $this->strtr((string) $bEntry->content), 'body' => $this->strtr((string) $bEntry->content),
'subscribed'=> 'false', 'subscribed'=> 'false',
'type' => 'NORMAL' 'type' => 'NORMAL'
); );
serendipity_db_insert('comments', $sComment); serendipity_db_insert('comments', $sComment);
// Update entry list with comment count // Update entry list with comment count
$entryList[$cEntryId][2]++; $entryList[$cEntryId][2]++;
} }
break; break;
} }
} }
// Report on resultant authors // Report on resultant authors
echo '<span class="block_level">Current list of authors: </span>'. join(', ', array_values($authorList)); echo '<span class="block_level">Current list of authors: </span>'. join(', ', array_values($authorList));
// Do cleanup and report on entries // Do cleanup and report on entries
echo '<span class="block_level">The following entries were successfully imported:</span>'; echo '<span class="block_level">The following entries were successfully imported:</span>';
echo '<ul>'; echo '<ul>';
foreach ($entryList as $eId => $eDetails) { foreach ($entryList as $eId => $eDetails) {
// Update comment count for entry in s9y // Update comment count for entry in s9y
serendipity_db_query("UPDATE ". $serendipity['dbPrefix'] ."entries SET comments = ". $eDetails[2] ." WHERE id = ". $eDetails[0]); serendipity_db_query("UPDATE ". $serendipity['dbPrefix'] ."entries SET comments = ". $eDetails[2] ." WHERE id = ". $eDetails[0]);
echo '<li>'. $eDetails[1] .' comments('. $eDetails[2] .')</li>'; echo '<li>'. $eDetails[1] .' comments('. $eDetails[2] .')</li>';
} }
echo '</ul>'; echo '</ul>';
// Report fails // Report fails
echo '<span class="block_level">The following entries ran into trouble and was not imported:</span>'; echo '<span class="block_level">The following entries ran into trouble and was not imported:</span>';
echo '<ul>'; echo '<ul>';
foreach ($entryFailList as $eId => $eDetails) { foreach ($entryFailList as $eId => $eDetails) {
echo '<li>'. $eDetails .'</li>'; echo '<li>'. $eDetails .'</li>';
} }
echo '</ul>'; echo '</ul>';
// Reset autodiscovery // Reset autodiscovery
$serendipity['noautodiscovery'] = $noautodiscovery; $serendipity['noautodiscovery'] = $noautodiscovery;
// All done! // All done!
echo '<span class="msg_notice">Import finished.</span>'; echo '<span class="msg_notice">Import finished.</span>';
return true; return true;
} }
} }

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,5 @@
<?php # $Id: generic.inc.php 717 2005-11-21 09:56:25Z garvinhicking $ <?php
# $Id: generic.inc.php 717 2005-11-21 09:56:25Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# Copyright (c) 2009, Matthew Weigel # Copyright (c) 2009, Matthew Weigel
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,5 @@
<?php # $Id: b2evolution.inc.php 1093 2006-04-13 10:49:52Z garvinhicking $ <?php
# $Id: b2evolution.inc.php 1093 2006-04-13 10:49:52Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -119,7 +120,7 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {
foreach($primary_keys AS $primary_key) { foreach($primary_keys AS $primary_key) {
$primary_vals[$primary_key] = $row[$primary_key]; $primary_vals[$primary_key] = $row[$primary_key];
if ($table == 'comments') { if ($table == 'comments') {
$primary_vals['entry_id'] = $row['entry_id']; $primary_vals['entry_id'] = $row['entry_id'];
} }
unset($row[$primary_key]); unset($row[$primary_key]);
} }
@ -132,12 +133,12 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {
foreach($fix_relations AS $primary_key => $fix_relation) { foreach($fix_relations AS $primary_key => $fix_relation) {
foreach($fix_relation AS $fix_relation_table => $fix_relation_primary_key) { foreach($fix_relation AS $fix_relation_table => $fix_relation_primary_key) {
if ($table == 'comments' && $fix_relation_table == 'entries') { if ($table == 'comments' && $fix_relation_table == 'entries') {
$assoc_val = $primary_vals['entry_id']; $assoc_val = $primary_vals['entry_id'];
} elseif (isset($primary_vals[$fix_relation_primary_key])) { } elseif (isset($primary_vals[$fix_relation_primary_key])) {
$assoc_val = $primary_vals[$fix_relation_primary_key]; $assoc_val = $primary_vals[$fix_relation_primary_key];
} else { } else {
$assoc_val = $row[$primary_key]; $assoc_val = $row[$primary_key];
} }
if (!$this->execute && empty($assoc_val)) { if (!$this->execute && empty($assoc_val)) {
@ -192,9 +193,9 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {
} }
foreach($this->storage[$table] AS $primary_key => $primary_data) { foreach($this->storage[$table] AS $primary_key => $primary_data) {
foreach($primary_data AS $primary_val => $replace_val) { foreach($primary_data AS $primary_val => $replace_val) {
serendipity_set_config_var('import_s9y_' . $table . '_' . $primary_key . '_' . $primary_val, $replace_val, 99); serendipity_set_config_var('import_s9y_' . $table . '_' . $primary_key . '_' . $primary_val, $replace_val, 99);
} }
} }
} else { } else {
if ($this->debug && !$this->execute) { if ($this->debug && !$this->execute) {

View File

@ -1,4 +1,5 @@
<?php # $Id: voodoopad.inc.php 1 2005-04-16 06:39:31Z timputnam $ <?php
# $Id: voodoopad.inc.php 1 2005-04-16 06:39:31Z timputnam $
# Copyright (c) 2003-2005, Tim Putnam # Copyright (c) 2003-2005, Tim Putnam
/***************************************************************** /*****************************************************************
@ -141,7 +142,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
$thispage['filename'] = $mykey.'.htm'; $thispage['filename'] = $mykey.'.htm';
// Thanks for pointing this out to me and not just fixing it, I'm learning. // Thanks for pointing this out to me and not just fixing it, I'm learning.
$thispage['permalink'] = $serendipity['serendipityHTTPPath'] . 'index.php?serendipity[subpage]=' . $mykey; $thispage['permalink'] = $serendipity['serendipityHTTPPath'] . 'index.php?serendipity[subpage]=' . $mykey;
break; break;
case 'alias': // The title and the string used to match links case 'alias': // The title and the string used to match links

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # <?php
if (IN_serendipity !== true) { if (IN_serendipity !== true) {
die ("Don't hack!"); die ("Don't hack!");

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
if (IN_serendipity !== true) { if (IN_serendipity !== true) {
die ("Don't hack!"); die ("Don't hack!");

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
if (IN_serendipity !== true) { if (IN_serendipity !== true) {
die ('Don\'t hack!'); die ('Don\'t hack!');

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
if (IN_serendipity !== true) { if (IN_serendipity !== true) {
die ('Don\'t hack!'); die ('Don\'t hack!');

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -255,7 +255,7 @@ function &serendipity_db_query($sql, $single = false, $result_type = "both", $re
$rows = array(); $rows = array();
foreach($serendipity['dbSth']->fetchAll($result_type) AS $row) { foreach($serendipity['dbSth']->fetchAll($result_type) AS $row) {
$row = serendipity_db_sqlite_fetch_array($row, $result_type); $row = serendipity_db_sqlite_fetch_array($row, $result_type);
if (!empty($assocKey)) { if (!empty($assocKey)) {
// You can fetch a key-associated array via the two function parameters assocKey and assocVal // You can fetch a key-associated array via the two function parameters assocKey and assocVal
if (empty($assocVal)) { if (empty($assocVal)) {

View File

@ -1,4 +1,5 @@
<?php # $Id: sqlite.inc.php 1670 2007-04-10 13:23:34Z garvinhicking $ <?php
# $Id: sqlite.inc.php 1670 2007-04-10 13:23:34Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -49,7 +50,7 @@ function serendipity_db_connect()
return $serendipity['dbConn']; return $serendipity['dbConn'];
} }
// SQLite3 doesn't support persistent connections // SQLite3 doesn't support persistent connections
$serendipity['dbConn'] = sqlite3_open((defined('S9Y_DATA_PATH') ? S9Y_DATA_PATH : $serendipity['serendipityPath']) . $serendipity['dbName'] . '.db'); $serendipity['dbConn'] = sqlite3_open((defined('S9Y_DATA_PATH') ? S9Y_DATA_PATH : $serendipity['serendipityPath']) . $serendipity['dbName'] . '.db');
return $serendipity['dbConn']; return $serendipity['dbConn'];

View File

@ -1,4 +1,5 @@
<?php # $Id: sqlite.inc.php 1670 2007-04-10 13:23:34Z garvinhicking $ <?php
# $Id: sqlite.inc.php 1670 2007-04-10 13:23:34Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -49,7 +50,7 @@ function serendipity_db_connect()
return $serendipity['dbConn']; return $serendipity['dbConn'];
} }
// SQLite3 doesn't support persistent connections // SQLite3 doesn't support persistent connections
$serendipity['dbConn'] = new SQLite3((defined('S9Y_DATA_PATH') ? S9Y_DATA_PATH : $serendipity['serendipityPath']) . $serendipity['dbName'] . '.db'); $serendipity['dbConn'] = new SQLite3((defined('S9Y_DATA_PATH') ? S9Y_DATA_PATH : $serendipity['serendipityPath']) . $serendipity['dbName'] . '.db');
return $serendipity['dbConn']; return $serendipity['dbConn'];

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,5 @@
<?php # $Id: functions.inc.php 114 2005-05-22 15:37:11Z garvinhicking $ <?php
# $Id: functions.inc.php 114 2005-05-22 15:37:11Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -126,8 +127,8 @@ function p2g($j_y, $j_m, $j_d){
*/ */
function persian_strftime_utf($format, $timestamp='') { function persian_strftime_utf($format, $timestamp='') {
if($timestamp==''){ if($timestamp==''){
$timestamp = mktime(); $timestamp = mktime();
} }
$g_d=date('j', $timestamp); $g_d=date('j', $timestamp);
@ -276,10 +277,10 @@ function persian_strftime_utf($format, $timestamp='') {
function persian_date_utf($format, $timestamp='') { function persian_date_utf($format, $timestamp='') {
if($timestamp==''){ if($timestamp==''){
$timestamp = mktime(); $timestamp = mktime();
} }
$g_d=date('j', $timestamp); $g_d=date('j', $timestamp);
$g_m=date('n', $timestamp); $g_m=date('n', $timestamp);
$g_y=date('Y', $timestamp); $g_y=date('Y', $timestamp);
@ -288,8 +289,8 @@ function persian_date_utf($format, $timestamp='') {
$j_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); $j_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
$leap = 0; $leap = 0;
if ($g_m>1 && (($g_y%4==0 && $g_y%100!=0) || ($g_y%400==0))){ if ($g_m>1 && (($g_y%4==0 && $g_y%100!=0) || ($g_y%400==0))){
$j_days_in_month[12]++; $j_days_in_month[12]++;
$leap = 1; $leap = 1;
} }
$j_month_name = array('', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', $j_month_name = array('', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر',
@ -360,7 +361,7 @@ function persian_date_utf($format, $timestamp='') {
$output_str.=$j_days_in_month[$jm]; $output_str.=$j_days_in_month[$jm];
break; break;
case 'L': case 'L':
$output_str.=$leap; $output_str.=$leap;
break; break;
case 'o': case 'o':
case 'Y': case 'Y':
@ -444,71 +445,71 @@ function persian_date_utf($format, $timestamp='') {
* @return int returned timestamp * @return int returned timestamp
*/ */
function persian_mktime($hour='', $min='', $sec='', $mon='', $day='', $year='', $is_dst=-1){ function persian_mktime($hour='', $min='', $sec='', $mon='', $day='', $year='', $is_dst=-1){
$j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
if ( (string) $hour == '') { $hour = persian_date_utf('H'); } if ( (string) $hour == '') { $hour = persian_date_utf('H'); }
if ( (string) $min == '') { $min = persian_date_utf('i'); } if ( (string) $min == '') { $min = persian_date_utf('i'); }
if ( (string) $sec == '') { $sec = persian_date_utf('s'); } if ( (string) $sec == '') { $sec = persian_date_utf('s'); }
if ( (string) $day == '') { $day = persian_date_utf('j'); } if ( (string) $day == '') { $day = persian_date_utf('j'); }
if ( (string) $mon == '') { $mon = persian_date_utf('n'); } if ( (string) $mon == '') { $mon = persian_date_utf('n'); }
if ( (string) $year == '') { $year = persian_date_utf('Y'); } if ( (string) $year == '') { $year = persian_date_utf('Y'); }
/* /*
an ugly, beta code snippet to support days <= zero! an ugly, beta code snippet to support days <= zero!
it should work, but days in one or more months should calculate! it should work, but days in one or more months should calculate!
*/ */
/* /*
if($day <= 0){ if($day <= 0){
// change sign // change sign
$day = abs($day); $day = abs($day);
// calculate months and days that shall decrease // calculate months and days that shall decrease
// this do-while has a lot of errors!!! // this do-while has a lot of errors!!!
do{ do{
// $month_days = $j_days_in_month[$mon] // $month_days = $j_days_in_month[$mon]
$months = floor($day/30); $months = floor($day/30);
$days = $day % 30; $days = $day % 30;
}while(); }while();
$mon -= $months; $mon -= $months;
$day -= $days; $day -= $days;
if ($day < 1) { if ($day < 1) {
$mon--; $mon--;
} }
} }
*/ */
if($mon <= 0){ if($mon <= 0){
// change sign // change sign
$mon = abs($mon); $mon = abs($mon);
// calculate years and months that shall decrease // calculate years and months that shall decrease
$years = floor($mon/12); $years = floor($mon/12);
$months = $mon % 12; $months = $mon % 12;
$year -= $years; $year -= $years;
$mon -= $months; $mon -= $months;
if ($mon < 1) { if ($mon < 1) {
$year--; $year--;
$mon += 12; $mon += 12;
} }
} }
if ($day < 1) { if ($day < 1) {
$temp_month = $mon-1; $temp_month = $mon-1;
$temp_year = $year; $temp_year = $year;
if($temp_month <= 0){ if($temp_month <= 0){
$temp_month = 12; $temp_month = 12;
$temp_year--; $temp_year--;
} }
if ($temp_month>1 && (($temp_year%4==0 && $temp_year%100!=0) || ($temp_year%400==0))){ if ($temp_month>1 && (($temp_year%4==0 && $temp_year%100!=0) || ($temp_year%400==0))){
$j_days_in_month[12] = 30; $j_days_in_month[12] = 30;
}else{ }else{
$j_days_in_month[12] = 29; $j_days_in_month[12] = 29;
} }
$day += $j_days_in_month[$temp_month]; $day += $j_days_in_month[$temp_month];
} }
list($year, $mon, $day)=p2g($year, $mon, $day); list($year, $mon, $day)=p2g($year, $mon, $day);
return mktime($hour, $min, $sec, $mon, $day, $year, $is_dst); return mktime($hour, $min, $sec, $mon, $day, $year, $is_dst);

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details
@ -658,18 +658,18 @@ function serendipity_approveComment($cid, $entry_id, $force = false, $moderate =
return false; // wrong user having no adminEntriesMaintainOthers right return false; // wrong user having no adminEntriesMaintainOthers right
} }
$flip = false; $flip = false;
if ($moderate === 'flip') { if ($moderate === 'flip') {
$flip = true; $flip = true;
if ($rs['status'] == 'pending') { if ($rs['status'] == 'pending') {
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid; $sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid;
$moderate = false; $moderate = false;
} else { } else {
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid; $sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid;
$moderate = true; $moderate = true;
} }
} elseif ($moderate) { } elseif ($moderate) {
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid; $sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid;
} else { } else {
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid; $sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid;
@ -722,10 +722,10 @@ function serendipity_approveComment($cid, $entry_id, $force = false, $moderate =
serendipity_plugin_api::hook_event('backend_approvecomment', $rs); serendipity_plugin_api::hook_event('backend_approvecomment', $rs);
} }
if ($flip) { if ($flip) {
if ($moderate) return -1; // comment set to pending if ($moderate) return -1; // comment set to pending
if (!$moderate) return 1; // comment set to approved if (!$moderate) return 1; // comment set to approved
} }
return true; return true;
} }

View File

@ -1,4 +1,5 @@
<?php # $Id: functions.inc.php 85 2005-05-10 10:11:05Z garvinhicking $ <?php
# $Id: functions.inc.php 85 2005-05-10 10:11:05Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,5 @@
<?php # $entry['feed_id']: functions_entries.inc.php 435 2005-08-25 12:36:39Z garvinhicking $ <?php
# $entry['feed_id']: functions_entries.inc.php 435 2005-08-25 12:36:39Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details

View File

@ -1,4 +1,4 @@
<?php # <?php
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details # All rights reserved. See LICENSE file for licensing details