Well it would have been a release day…

If it were not for the spammer. I’ve got a new rev of Camera Control nearly ready to release but have spent all my “free” time today cleaning up.

Wrote this VBA code which helped a bit to clean up the posts table:

' Manipulating a text file with VBA
' Loops through text file and creates revised one
' This code requires a reference (Tools > References) to Microsoft Scripting Runtime
' based on a sample here: http://www.ozgrid.com/forum/showthread.php?t=61822

Dim FSO As FileSystemObject
Dim FSOFile As TextStream, FSOFileRevised As TextStream
Dim FilePath As String, FilePathRevised As String
Dim l As String
Dim i, j As Long
Dim tagName As String
Dim spamStart As Long
Dim spamLength As Long
Dim spamtext As String
Dim linecounter As Integer

FilePath = "C:\wp_posts.sql" ' create a test.txt file or change this

' adds "_Revised" to your file name
FilePathRevised = Left(FilePath, Len(FilePath) - 4) & "_Revised" & Right(FilePath, 4)
linecounter = 0
Set FSO = New FileSystemObject
If FSO.FileExists(FilePath) Then
' opens the file for reading
Set FSOFile = FSO.OpenTextFile(FilePath, 1, False)
' opens "revised" file in write mode
Set FSOFileRevised = FSO.OpenTextFile(FilePathRevised, 2, True)
Do While Not FSOFile.AtEndOfStream

l = FSOFile.ReadLine
linecounter = linecounter + 1
' write maniplulation code here
' code to remove the spam links with style display:none from a wordpress
' wpaa3a_posts table.

' normalize space or no space in the style
l = Replace(l, "display: none", "display:none")

' keep working until they are all gone
Do While (InStr(l, """display:none") > 0)

i = InStr(l, """display:none")
j = i
' scan left to work out what the tag is
Do While (Mid(l, i, 1) <> "<") And (i > 1)
i = i - 1
DoEvents
Loop
If i = 1 Then
Debug.Print "Error, can't complete"
Stop
End If
tagName = ""
spamStart = i
i = i + 1

Do While Mid(l, i, 1) <> " "
tagName = tagName + Mid(l, i, 1)
i = i + 1
DoEvents
Loop

'ok got the tag so find the close
spamLength = InStr(Mid(l, spamStart, 9999999), "/" + tagName) + Len(tagName) + 1

spamtext = Mid(l, spamStart, spamLength)

l = Replace(l, spamtext, "")
'Debug.Print spamtext
'Debug.Print linecounter

DoEvents
Loop

FSOFileRevised.WriteLine (l)

Loop
FSOFile.Close
FSOFileRevised.Close
Else
MsgBox (FilePath & " does not exist")
End If

But the spammer was not entirely consistent or correct in his html coding, so I still had to remove a lot by hand. If you see any left over spam links in old posts please do drop me a comment. Thanks.

I’m going to bed now as it is really late (yet again) but here are a list of the changes so far in my 4.2 development version:

' 4.2 changes
'
' save raw/jpg value between session
' fix raw/jpg bug where wrong type is used if not explicitly selected
' improved Time Lapse time gap calculation
' correctly save/load registry settings first time when they don't already exist
' make preview size saved
' more preview size options such as 50%/100%
' simple viewer to let you preview previous shots
' save the tethering status
' fix which should allow negative expo comp in vista
' made bracketing work in manual mode by using changes in shutter speed
' primitive mark/unmark selected images using file renames (marked will be first when shorted by filename)


Deprecated: Function get_currentuserinfo is deprecated since version 4.5.0! Use wp_get_current_user() instead. in /home/diyphoto/public_html/wp-includes/functions.php on line 6114

Leave a Reply

Your email address will not be published. Required fields are marked *