cleanup tabs and whites
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
@ -128,7 +128,6 @@ if ( $serendipity['GET']['adminAction'] == 'delete' ) {
|
||||
foreach ($cats as $cat_data) {
|
||||
if ($cat_data['categoryid'] != $serendipity['GET']['cid'] && (serendipity_checkPermission('adminCategoriesMaintainOthers') || $cat_data['authorid'] == '0' || $cat_data['authorid'] == $serendipity['authorid'])) {
|
||||
$data['cats'][] = $cat_data;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php #
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ('Don\'t hack!');
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# 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';
|
||||
@ -34,103 +34,103 @@ class Serendipity_Import_Blogger extends Serendipity_Import {
|
||||
'name' => 'bCharset',
|
||||
'value' => 'UTF-8',
|
||||
'default' => $this->getCharsets())
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
function getImportNotes(){
|
||||
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 .= '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>';
|
||||
return $msg;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
function getImportNotes(){
|
||||
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 .= '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>';
|
||||
return $msg;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function validateData() {
|
||||
return sizeof($this->data);
|
||||
}
|
||||
|
||||
function getInputFields() {
|
||||
// Make sure Google login has been completed
|
||||
if (!empty($_REQUEST['token'])) {
|
||||
// Make sure Google login has been completed
|
||||
if (!empty($_REQUEST['token'])) {
|
||||
|
||||
// Prepare session token request
|
||||
$req = new HTTP_Request('https://www.google.com/accounts/AuthSubSessionToken');
|
||||
$req->addHeader('Authorization', 'AuthSub token="'. $_REQUEST['token'] .'"');
|
||||
// Prepare session token request
|
||||
$req = new HTTP_Request('https://www.google.com/accounts/AuthSubSessionToken');
|
||||
$req->addHeader('Authorization', 'AuthSub token="'. $_REQUEST['token'] .'"');
|
||||
|
||||
// Request token
|
||||
$req->sendRequest();
|
||||
// Request token
|
||||
$req->sendRequest();
|
||||
|
||||
// Handle token reponse
|
||||
if ($req->getResponseCode() != '200') return;
|
||||
// Handle token reponse
|
||||
if ($req->getResponseCode() != '200') return;
|
||||
|
||||
// Extract Auth token
|
||||
preg_match_all('/^(.+)=(.+)$/m', $req->getResponseBody(), $matches);
|
||||
$tokens = array_combine($matches[1], $matches[2]);
|
||||
unset($matches);
|
||||
// Extract Auth token
|
||||
preg_match_all('/^(.+)=(.+)$/m', $req->getResponseBody(), $matches);
|
||||
$tokens = array_combine($matches[1], $matches[2]);
|
||||
unset($matches);
|
||||
|
||||
// Add hidden auth token field to input field list
|
||||
array_unshift($this->inputFields, array( 'text' => 'Google Auth Token (leave alone)',
|
||||
'type' => 'input',
|
||||
'name' => 'bAuthToken',
|
||||
'default' => $tokens['Token']));
|
||||
// Add hidden auth token field to input field list
|
||||
array_unshift($this->inputFields, array( 'text' => 'Google Auth Token (leave alone)',
|
||||
'type' => 'input',
|
||||
'name' => 'bAuthToken',
|
||||
'default' => $tokens['Token']));
|
||||
|
||||
// Prepare blog list request
|
||||
$req = new HTTP_Request('http://www.blogger.com/feeds/default/blogs');
|
||||
$req->addHeader('GData-Version', 2);
|
||||
$req->addHeader('Authorization', 'AuthSub token="'. $tokens['Token'] .'"');
|
||||
// Prepare blog list request
|
||||
$req = new HTTP_Request('http://www.blogger.com/feeds/default/blogs');
|
||||
$req->addHeader('GData-Version', 2);
|
||||
$req->addHeader('Authorization', 'AuthSub token="'. $tokens['Token'] .'"');
|
||||
|
||||
// Fetch blog list
|
||||
$req->sendRequest();
|
||||
// Fetch blog list
|
||||
$req->sendRequest();
|
||||
|
||||
// Handle errors
|
||||
if ($req->getResponseCode() != '200') return false;
|
||||
// Handle errors
|
||||
if ($req->getResponseCode() != '200') return false;
|
||||
|
||||
// Load list
|
||||
$bXml = simplexml_load_string($req->getResponseBody());
|
||||
// Load list
|
||||
$bXml = simplexml_load_string($req->getResponseBody());
|
||||
|
||||
// Generate list of the blogs under the authenticated account
|
||||
$bList = array();
|
||||
foreach ($bXml->entry as $entry) {
|
||||
$bList[substr($entry->id, strpos($entry->id, 'blog-') + 5)] = $entry->title;
|
||||
}
|
||||
// Generate list of the blogs under the authenticated account
|
||||
$bList = array();
|
||||
foreach ($bXml->entry as $entry) {
|
||||
$bList[substr($entry->id, strpos($entry->id, 'blog-') + 5)] = $entry->title;
|
||||
}
|
||||
|
||||
// Add blog list to input fields for selection
|
||||
array_unshift($this->inputFields, array('text' => 'Blog to import',
|
||||
'type' => 'list',
|
||||
'name' => 'bId',
|
||||
'value' => 0,
|
||||
'default' => $bList));
|
||||
// Add blog list to input fields for selection
|
||||
array_unshift($this->inputFields, array('text' => 'Blog to import',
|
||||
'type' => 'list',
|
||||
'name' => 'bId',
|
||||
'value' => 0,
|
||||
'default' => $bList));
|
||||
|
||||
return $this->inputFields;
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
return $this->inputFields;
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
function _getCategoryList() {
|
||||
$res = serendipity_fetchCategories('all');
|
||||
$ret = array(0 => NO_CATEGORY);
|
||||
if (is_array($res)) {
|
||||
foreach ($res as $v) {
|
||||
$ret[$v['categoryid']] = $v['category_name'];
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
function _getCategoryList() {
|
||||
$res = serendipity_fetchCategories('all');
|
||||
$ret = array(0 => NO_CATEGORY);
|
||||
if (is_array($res)) {
|
||||
foreach ($res as $v) {
|
||||
$ret[$v['categoryid']] = $v['category_name'];
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function import() {
|
||||
global $serendipity;
|
||||
function import() {
|
||||
global $serendipity;
|
||||
|
||||
// Force user to select a blog to act on
|
||||
if (empty($this->data['bId']) || $this->data['bId'] == 0) {
|
||||
echo 'Please select a blog to import!';
|
||||
return false;
|
||||
}
|
||||
// Force user to select a blog to act on
|
||||
if (empty($this->data['bId']) || $this->data['bId'] == 0) {
|
||||
echo 'Please select a blog to import!';
|
||||
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;
|
||||
|
||||
if ($this->data['autodiscovery'] == 'false') {
|
||||
@ -139,142 +139,142 @@ class Serendipity_Import_Blogger extends Serendipity_Import {
|
||||
|
||||
$this->getTransTable();
|
||||
|
||||
// Prepare export request
|
||||
$req = new HTTP_Request('http://www.blogger.com/feeds/'. $this->data['bId'] .'/archive');
|
||||
$req->addHeader('GData-Version', 2);
|
||||
$req->addHeader('Authorization', 'AuthSub token="'. $this->data['bAuthToken'] .'"');
|
||||
// Prepare export request
|
||||
$req = new HTTP_Request('http://www.blogger.com/feeds/'. $this->data['bId'] .'/archive');
|
||||
$req->addHeader('GData-Version', 2);
|
||||
$req->addHeader('Authorization', 'AuthSub token="'. $this->data['bAuthToken'] .'"');
|
||||
|
||||
// Attempt fetch blog export
|
||||
$req->sendRequest();
|
||||
// Attempt fetch blog export
|
||||
$req->sendRequest();
|
||||
|
||||
// Handle errors
|
||||
if ($req->getResponseCode() != '200') {
|
||||
echo "Error occured while trying to export the blog.";
|
||||
return false;
|
||||
}
|
||||
// Handle errors
|
||||
if ($req->getResponseCode() != '200') {
|
||||
echo "Error occured while trying to export the blog.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Export success
|
||||
echo '<span class="block_level">Successfully exported entries from Blogger</span>';
|
||||
// Export success
|
||||
echo '<span class="block_level">Successfully exported entries from Blogger</span>';
|
||||
|
||||
// Get Serendipity authors list
|
||||
$authorList = array();
|
||||
$s9y_users = serendipity_fetchUsers();
|
||||
foreach ($s9y_users as $user) {
|
||||
$authorList[$user['authorid']] = $user['username'];
|
||||
}
|
||||
unset($s9y_users);
|
||||
// Get Serendipity authors list
|
||||
$authorList = array();
|
||||
$s9y_users = serendipity_fetchUsers();
|
||||
foreach ($s9y_users as $user) {
|
||||
$authorList[$user['authorid']] = $user['username'];
|
||||
}
|
||||
unset($s9y_users);
|
||||
|
||||
// Load export
|
||||
$bXml = simplexml_load_string($req->getResponseBody());
|
||||
// Load export
|
||||
$bXml = simplexml_load_string($req->getResponseBody());
|
||||
|
||||
// Process entries
|
||||
$entryList = $entryFailList = array();
|
||||
foreach ($bXml->entry as $bEntry) {
|
||||
// Process entries
|
||||
$entryList = $entryFailList = array();
|
||||
foreach ($bXml->entry as $bEntry) {
|
||||
|
||||
// Check entry type
|
||||
switch ($bEntry->category['term']) {
|
||||
case 'http://schemas.google.com/blogger/2008/kind#post':
|
||||
// Process posts:
|
||||
// Check entry type
|
||||
switch ($bEntry->category['term']) {
|
||||
case 'http://schemas.google.com/blogger/2008/kind#post':
|
||||
// Process posts:
|
||||
|
||||
// Create author if not in serendipity
|
||||
$author = (string) $bEntry->author->name;
|
||||
if (!array_search($author, $authorList)) {
|
||||
serendipity_db_insert( 'authors',
|
||||
array( 'right_publish' => 1,
|
||||
'realname' => $author,
|
||||
'username' => $author,
|
||||
'userlevel' => 0,
|
||||
'password' => md5($this->data['defaultpass']))
|
||||
);
|
||||
$authorid = serendipity_db_insert_id('authors', 'authorid');
|
||||
$authorList[$authorid] = $author;
|
||||
}
|
||||
// Create author if not in serendipity
|
||||
$author = (string) $bEntry->author->name;
|
||||
if (!array_search($author, $authorList)) {
|
||||
serendipity_db_insert('authors',
|
||||
array('right_publish' => 1,
|
||||
'realname' => $author,
|
||||
'username' => $author,
|
||||
'userlevel' => 0,
|
||||
'password' => md5($this->data['defaultpass']))
|
||||
);
|
||||
$authorid = serendipity_db_insert_id('authors', 'authorid');
|
||||
$authorList[$authorid] = $author;
|
||||
}
|
||||
|
||||
$sEntry = array('title' => $this->decode((string) $bEntry->title),
|
||||
'isdraft' => ($bEntry->children('http://purl.org/atom/app#')->control->draft == 'yes') ? 'true' : 'false',
|
||||
'allow_comments' => (count($bEntry->xpath("*[@rel='replies']")) > 0) ? 'true' : 'false',
|
||||
'timestamp' => strtotime($bEntry->published),
|
||||
'body' => $this->strtr((string) $bEntry->content),
|
||||
'extended' => '',
|
||||
'categories' => $this->data['bCategory'],
|
||||
'author' => $author,
|
||||
'authorid' => $authorid
|
||||
);
|
||||
$sEntry = array('title' => $this->decode((string) $bEntry->title),
|
||||
'isdraft' => ($bEntry->children('http://purl.org/atom/app#')->control->draft == 'yes') ? 'true' : 'false',
|
||||
'allow_comments' => (count($bEntry->xpath("*[@rel='replies']")) > 0) ? 'true' : 'false',
|
||||
'timestamp' => strtotime($bEntry->published),
|
||||
'body' => $this->strtr((string) $bEntry->content),
|
||||
'extended' => '',
|
||||
'categories' => $this->data['bCategory'],
|
||||
'author' => $author,
|
||||
'authorid' => $authorid
|
||||
);
|
||||
|
||||
// Add entry to s9y
|
||||
echo '..~.. ';
|
||||
if (is_int($id = serendipity_updertEntry($sEntry))) {
|
||||
// Add entry id to processed table for later lookups
|
||||
$entryList[(string) $bEntry->id] = array($id, $sEntry['title'], 0);
|
||||
} else {
|
||||
// Add to fail list
|
||||
$entryFailList[] = $sEntry['title'];
|
||||
}
|
||||
// Add entry to s9y
|
||||
echo '..~.. ';
|
||||
if (is_int($id = serendipity_updertEntry($sEntry))) {
|
||||
// Add entry id to processed table for later lookups
|
||||
$entryList[(string) $bEntry->id] = array($id, $sEntry['title'], 0);
|
||||
} else {
|
||||
// Add to fail list
|
||||
$entryFailList[] = $sEntry['title'];
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'http://schemas.google.com/blogger/2008/kind#comment':
|
||||
// Process comments:
|
||||
case 'http://schemas.google.com/blogger/2008/kind#comment':
|
||||
// Process comments:
|
||||
|
||||
// Extract entry id for comment
|
||||
$cEntryId = $bEntry->xpath("thr:in-reply-to[@ref]");
|
||||
$cEntryId = (string) $cEntryId[0]['ref'];
|
||||
// Extract entry id for comment
|
||||
$cEntryId = $bEntry->xpath("thr:in-reply-to[@ref]");
|
||||
$cEntryId = (string) $cEntryId[0]['ref'];
|
||||
|
||||
// Check to make sure the related entry has been added to s9y
|
||||
if (array_key_exists($cEntryId, $entryList)) {
|
||||
// Add to s9y
|
||||
$sComment = array( 'entry_id ' => $entryList[$cEntryId][0],
|
||||
'parent_id' => 0,
|
||||
'timestamp' => strtotime($bEntry->published),
|
||||
'author' => (string) $bEntry->author->name,
|
||||
'email' => (string) $bEntry->author->email,
|
||||
'url' => (string) (isset($bEntry->author->uri)) ? $bEntry->author->uri : '',
|
||||
'ip' => '',
|
||||
'status' => 'approved',
|
||||
'body' => $this->strtr((string) $bEntry->content),
|
||||
'subscribed'=> 'false',
|
||||
'type' => 'NORMAL'
|
||||
);
|
||||
serendipity_db_insert('comments', $sComment);
|
||||
// Check to make sure the related entry has been added to s9y
|
||||
if (array_key_exists($cEntryId, $entryList)) {
|
||||
// Add to s9y
|
||||
$sComment = array( 'entry_id ' => $entryList[$cEntryId][0],
|
||||
'parent_id' => 0,
|
||||
'timestamp' => strtotime($bEntry->published),
|
||||
'author' => (string) $bEntry->author->name,
|
||||
'email' => (string) $bEntry->author->email,
|
||||
'url' => (string) (isset($bEntry->author->uri)) ? $bEntry->author->uri : '',
|
||||
'ip' => '',
|
||||
'status' => 'approved',
|
||||
'body' => $this->strtr((string) $bEntry->content),
|
||||
'subscribed'=> 'false',
|
||||
'type' => 'NORMAL'
|
||||
);
|
||||
serendipity_db_insert('comments', $sComment);
|
||||
|
||||
// Update entry list with comment count
|
||||
$entryList[$cEntryId][2]++;
|
||||
}
|
||||
// Update entry list with comment count
|
||||
$entryList[$cEntryId][2]++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Report on resultant authors
|
||||
echo '<span class="block_level">Current list of authors: </span>'. join(', ', array_values($authorList));
|
||||
// Report on resultant authors
|
||||
echo '<span class="block_level">Current list of authors: </span>'. join(', ', array_values($authorList));
|
||||
|
||||
// Do cleanup and report on entries
|
||||
echo '<span class="block_level">The following entries were successfully imported:</span>';
|
||||
echo '<ul>';
|
||||
foreach ($entryList as $eId => $eDetails) {
|
||||
// Update comment count for entry in s9y
|
||||
serendipity_db_query("UPDATE ". $serendipity['dbPrefix'] ."entries SET comments = ". $eDetails[2] ." WHERE id = ". $eDetails[0]);
|
||||
// Do cleanup and report on entries
|
||||
echo '<span class="block_level">The following entries were successfully imported:</span>';
|
||||
echo '<ul>';
|
||||
foreach ($entryList as $eId => $eDetails) {
|
||||
// Update comment count for entry in s9y
|
||||
serendipity_db_query("UPDATE ". $serendipity['dbPrefix'] ."entries SET comments = ". $eDetails[2] ." WHERE id = ". $eDetails[0]);
|
||||
|
||||
echo '<li>'. $eDetails[1] .' comments('. $eDetails[2] .')</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
echo '<li>'. $eDetails[1] .' comments('. $eDetails[2] .')</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
|
||||
// Report fails
|
||||
echo '<span class="block_level">The following entries ran into trouble and was not imported:</span>';
|
||||
echo '<ul>';
|
||||
foreach ($entryFailList as $eId => $eDetails) {
|
||||
echo '<li>'. $eDetails .'</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
// Report fails
|
||||
echo '<span class="block_level">The following entries ran into trouble and was not imported:</span>';
|
||||
echo '<ul>';
|
||||
foreach ($entryFailList as $eId => $eDetails) {
|
||||
echo '<li>'. $eDetails .'</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
|
||||
// Reset autodiscovery
|
||||
$serendipity['noautodiscovery'] = $noautodiscovery;
|
||||
// Reset autodiscovery
|
||||
$serendipity['noautodiscovery'] = $noautodiscovery;
|
||||
|
||||
// All done!
|
||||
echo '<span class="msg_notice">Import finished.</span>';
|
||||
return true;
|
||||
}
|
||||
// All done!
|
||||
echo '<span class="msg_notice">Import finished.</span>';
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -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) 2009, Matthew Weigel
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -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)
|
||||
# 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) {
|
||||
$primary_vals[$primary_key] = $row[$primary_key];
|
||||
if ($table == 'comments') {
|
||||
$primary_vals['entry_id'] = $row['entry_id'];
|
||||
$primary_vals['entry_id'] = $row['entry_id'];
|
||||
}
|
||||
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_relation AS $fix_relation_table => $fix_relation_primary_key) {
|
||||
|
||||
if ($table == 'comments' && $fix_relation_table == 'entries') {
|
||||
$assoc_val = $primary_vals['entry_id'];
|
||||
} elseif (isset($primary_vals[$fix_relation_primary_key])) {
|
||||
if ($table == 'comments' && $fix_relation_table == 'entries') {
|
||||
$assoc_val = $primary_vals['entry_id'];
|
||||
} elseif (isset($primary_vals[$fix_relation_primary_key])) {
|
||||
$assoc_val = $primary_vals[$fix_relation_primary_key];
|
||||
} else {
|
||||
$assoc_val = $row[$primary_key];
|
||||
$assoc_val = $row[$primary_key];
|
||||
}
|
||||
|
||||
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($primary_data AS $primary_val => $replace_val) {
|
||||
serendipity_set_config_var('import_s9y_' . $table . '_' . $primary_key . '_' . $primary_val, $replace_val, 99);
|
||||
}
|
||||
foreach($primary_data AS $primary_val => $replace_val) {
|
||||
serendipity_set_config_var('import_s9y_' . $table . '_' . $primary_key . '_' . $primary_val, $replace_val, 99);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($this->debug && !$this->execute) {
|
||||
|
@ -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
|
||||
|
||||
/*****************************************************************
|
||||
@ -141,7 +142,7 @@ class Serendipity_Import_VoodooPad extends Serendipity_Import {
|
||||
|
||||
$thispage['filename'] = $mykey.'.htm';
|
||||
// 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;
|
||||
|
||||
case 'alias': // The title and the string used to match links
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php #
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ('Don\'t hack!');
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ('Don\'t hack!');
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -255,7 +255,7 @@ function &serendipity_db_query($sql, $single = false, $result_type = "both", $re
|
||||
$rows = array();
|
||||
|
||||
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)) {
|
||||
// You can fetch a key-associated array via the two function parameters assocKey and assocVal
|
||||
if (empty($assocVal)) {
|
||||
|
@ -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)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
@ -49,7 +50,7 @@ function serendipity_db_connect()
|
||||
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');
|
||||
|
||||
return $serendipity['dbConn'];
|
||||
|
@ -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)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
@ -49,7 +50,7 @@ function serendipity_db_connect()
|
||||
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');
|
||||
|
||||
return $serendipity['dbConn'];
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -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)
|
||||
# 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='') {
|
||||
|
||||
if($timestamp==''){
|
||||
$timestamp = mktime();
|
||||
if($timestamp==''){
|
||||
$timestamp = mktime();
|
||||
}
|
||||
|
||||
$g_d=date('j', $timestamp);
|
||||
@ -276,10 +277,10 @@ function persian_strftime_utf($format, $timestamp='') {
|
||||
function persian_date_utf($format, $timestamp='') {
|
||||
|
||||
if($timestamp==''){
|
||||
$timestamp = mktime();
|
||||
$timestamp = mktime();
|
||||
}
|
||||
|
||||
$g_d=date('j', $timestamp);
|
||||
$g_d=date('j', $timestamp);
|
||||
$g_m=date('n', $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);
|
||||
$leap = 0;
|
||||
if ($g_m>1 && (($g_y%4==0 && $g_y%100!=0) || ($g_y%400==0))){
|
||||
$j_days_in_month[12]++;
|
||||
$leap = 1;
|
||||
$j_days_in_month[12]++;
|
||||
$leap = 1;
|
||||
}
|
||||
|
||||
$j_month_name = array('', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر',
|
||||
@ -360,7 +361,7 @@ function persian_date_utf($format, $timestamp='') {
|
||||
$output_str.=$j_days_in_month[$jm];
|
||||
break;
|
||||
case 'L':
|
||||
$output_str.=$leap;
|
||||
$output_str.=$leap;
|
||||
break;
|
||||
case 'o':
|
||||
case 'Y':
|
||||
@ -444,71 +445,71 @@ function persian_date_utf($format, $timestamp='') {
|
||||
* @return int returned timestamp
|
||||
*/
|
||||
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) $min == '') { $min = persian_date_utf('i'); }
|
||||
if ( (string) $sec == '') { $sec = persian_date_utf('s'); }
|
||||
if ( (string) $day == '') { $day = persian_date_utf('j'); }
|
||||
if ( (string) $mon == '') { $mon = persian_date_utf('n'); }
|
||||
if ( (string) $year == '') { $year = persian_date_utf('Y'); }
|
||||
if ( (string) $hour == '') { $hour = persian_date_utf('H'); }
|
||||
if ( (string) $min == '') { $min = persian_date_utf('i'); }
|
||||
if ( (string) $sec == '') { $sec = persian_date_utf('s'); }
|
||||
if ( (string) $day == '') { $day = persian_date_utf('j'); }
|
||||
if ( (string) $mon == '') { $mon = persian_date_utf('n'); }
|
||||
if ( (string) $year == '') { $year = persian_date_utf('Y'); }
|
||||
|
||||
/*
|
||||
an ugly, beta code snippet to support days <= zero!
|
||||
it should work, but days in one or more months should calculate!
|
||||
*/
|
||||
/*
|
||||
an ugly, beta code snippet to support days <= zero!
|
||||
it should work, but days in one or more months should calculate!
|
||||
*/
|
||||
|
||||
/*
|
||||
if($day <= 0){
|
||||
// change sign
|
||||
$day = abs($day);
|
||||
/*
|
||||
if($day <= 0){
|
||||
// change sign
|
||||
$day = abs($day);
|
||||
|
||||
// calculate months and days that shall decrease
|
||||
// this do-while has a lot of errors!!!
|
||||
do{
|
||||
// $month_days = $j_days_in_month[$mon]
|
||||
$months = floor($day/30);
|
||||
$days = $day % 30;
|
||||
}while();
|
||||
// calculate months and days that shall decrease
|
||||
// this do-while has a lot of errors!!!
|
||||
do{
|
||||
// $month_days = $j_days_in_month[$mon]
|
||||
$months = floor($day/30);
|
||||
$days = $day % 30;
|
||||
}while();
|
||||
|
||||
$mon -= $months;
|
||||
$day -= $days;
|
||||
if ($day < 1) {
|
||||
$mon--;
|
||||
}
|
||||
}
|
||||
*/
|
||||
$mon -= $months;
|
||||
$day -= $days;
|
||||
if ($day < 1) {
|
||||
$mon--;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if($mon <= 0){
|
||||
// change sign
|
||||
$mon = abs($mon);
|
||||
if($mon <= 0){
|
||||
// change sign
|
||||
$mon = abs($mon);
|
||||
|
||||
// calculate years and months that shall decrease
|
||||
$years = floor($mon/12);
|
||||
$months = $mon % 12;
|
||||
// calculate years and months that shall decrease
|
||||
$years = floor($mon/12);
|
||||
$months = $mon % 12;
|
||||
|
||||
$year -= $years;
|
||||
$mon -= $months;
|
||||
if ($mon < 1) {
|
||||
$year--;
|
||||
$mon += 12;
|
||||
}
|
||||
}
|
||||
$year -= $years;
|
||||
$mon -= $months;
|
||||
if ($mon < 1) {
|
||||
$year--;
|
||||
$mon += 12;
|
||||
}
|
||||
}
|
||||
|
||||
if ($day < 1) {
|
||||
$temp_month = $mon-1;
|
||||
$temp_year = $year;
|
||||
if($temp_month <= 0){
|
||||
$temp_month = 12;
|
||||
$temp_year--;
|
||||
}
|
||||
if ($temp_month>1 && (($temp_year%4==0 && $temp_year%100!=0) || ($temp_year%400==0))){
|
||||
$j_days_in_month[12] = 30;
|
||||
}else{
|
||||
$j_days_in_month[12] = 29;
|
||||
}
|
||||
$day += $j_days_in_month[$temp_month];
|
||||
}
|
||||
if ($day < 1) {
|
||||
$temp_month = $mon-1;
|
||||
$temp_year = $year;
|
||||
if($temp_month <= 0){
|
||||
$temp_month = 12;
|
||||
$temp_year--;
|
||||
}
|
||||
if ($temp_month>1 && (($temp_year%4==0 && $temp_year%100!=0) || ($temp_year%400==0))){
|
||||
$j_days_in_month[12] = 30;
|
||||
}else{
|
||||
$j_days_in_month[12] = 29;
|
||||
}
|
||||
$day += $j_days_in_month[$temp_month];
|
||||
}
|
||||
|
||||
list($year, $mon, $day)=p2g($year, $mon, $day);
|
||||
return mktime($hour, $min, $sec, $mon, $day, $year, $is_dst);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# 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
|
||||
}
|
||||
|
||||
$flip = false;
|
||||
if ($moderate === 'flip') {
|
||||
$flip = true;
|
||||
$flip = false;
|
||||
if ($moderate === 'flip') {
|
||||
$flip = true;
|
||||
|
||||
if ($rs['status'] == 'pending') {
|
||||
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid;
|
||||
$moderate = false;
|
||||
} else {
|
||||
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid;
|
||||
$moderate = true;
|
||||
}
|
||||
} elseif ($moderate) {
|
||||
if ($rs['status'] == 'pending') {
|
||||
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid;
|
||||
$moderate = false;
|
||||
} else {
|
||||
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid;
|
||||
$moderate = true;
|
||||
}
|
||||
} elseif ($moderate) {
|
||||
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid;
|
||||
} else {
|
||||
$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);
|
||||
}
|
||||
|
||||
if ($flip) {
|
||||
if ($moderate) return -1; // comment set to pending
|
||||
if (!$moderate) return 1; // comment set to approved
|
||||
}
|
||||
if ($flip) {
|
||||
if ($moderate) return -1; // comment set to pending
|
||||
if (!$moderate) return 1; // comment set to approved
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -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)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -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)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php # $Id$
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php #
|
||||
<?php
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
|
Reference in New Issue
Block a user