Geeklog
[ class tree: Geeklog ] [ index: Geeklog ] [ all elements ]

Class: Story

Source Location: /system/classes/story.class.php

Class Overview




Variables

Methods



Class Details

[line 85]


[ Top ]


Class Variables

$mode =  'admin'

[line 95]

Mode, either 'admin' for in the admin screens, or submission, for when the user is using submit.php. Controls tons of stuff.


Type:   mixed


[ Top ]

$type =  'article'

[line 101]

Type of story. User submission or normal editor entered stuff.

Will be 'submission' if it's from the submission queue.



Type:   mixed


[ Top ]

$_access =

[line 157]

The access level.


Type:   mixed


[ Top ]

$_advanced_editor_mode =

[line 132]


Type:   mixed


[ Top ]

$_bodytext =

[line 114]


Type:   mixed


[ Top ]

$_commentcode =

[line 128]


Type:   mixed


[ Top ]

$_comments =

[line 123]


Type:   mixed


[ Top ]

$_comment_expire =

[line 122]


Type:   mixed


[ Top ]

$_date =

[line 119]


Type:   mixed


[ Top ]

$_dbFields = array
         (
           'sid' => 1,
           'uid' => 1,
           'draft_flag' => 1,
           'tid' => 1,
           'date' => 1,
           'title' => 1,
           'page_title' => 1, 
           'meta_description' => 1,
           'meta_keywords' => 1,           
           'introtext' => 1,
           'bodytext' => 1,
           'hits' => 1,
           'numemails' => 1,
           'comments' => 1,
           'trackbacks' => 1,
           'related' => 1,
           'featured' => 1,
           'show_topic_icon' => 1,
           'commentcode' => 1,
           'comment_expire' => 1,
           'trackbackcode' => 1,
           'statuscode' => 1,
           'expire' => 1,
           'postmode' => 1,
           'advanced_editor_mode' => 1,
           'frontpage' => 1,
           'owner_id' => 1,
           'group_id' => 1,
           'perm_owner' => 1,
           'perm_group' => 1,
           'perm_members' => 1,
           'perm_anon' => 1,
           'imageurl' => 0,
           'topic' => 0,
           'access' => 0,
           'photo' => 0,
           'email' => 0
         )

[line 176]

Magic array used for cheating when loading/saving stories from/to db.

List of database field names (which are translated into member variables by prepending _ to the value) as pointers to whether or not they are used to save data. Everything with a save value of 1 will be saved, those with a save value of 0 will just be loaded.

This allows us to automate the loading of story, user and topic from a database result array, and generate saving of a story, from the same magic array.



Type:   mixed


[ Top ]

$_draft_flag =

[line 117]


Type:   mixed


[ Top ]

$_email =

[line 145]


Type:   mixed


[ Top ]

$_expire =

[line 131]


Type:   mixed


[ Top ]

$_featured =

[line 126]


Type:   mixed


[ Top ]

$_frontpage =

[line 133]


Type:   mixed


[ Top ]

$_fullname =

[line 143]


Type:   mixed


[ Top ]

$_group_id =

[line 135]


Type:   mixed


[ Top ]

$_hits =

[line 120]


Type:   mixed


[ Top ]

$_imageurl =

[line 147]


Type:   mixed


[ Top ]

$_introtext =

[line 113]


Type:   mixed


[ Top ]

$_meta_description =

[line 111]


Type:   mixed


[ Top ]

$_meta_keywords =

[line 112]


Type:   mixed


[ Top ]

$_numemails =

[line 121]


Type:   mixed


[ Top ]

$_originalSid =

[line 152]

The original SID of the article, cached incase it's changed:


Type:   mixed


[ Top ]

$_owner_id =

[line 134]


Type:   mixed


[ Top ]

$_page_title =

[line 110]


Type:   mixed


[ Top ]

$_perm_anon =

[line 139]


Type:   mixed


[ Top ]

$_perm_group =

[line 137]


Type:   mixed


[ Top ]

$_perm_members =

[line 138]


Type:   mixed


[ Top ]

$_perm_owner =

[line 136]


Type:   mixed


[ Top ]

$_photo =

[line 144]


Type:   mixed


[ Top ]

$_postFields = array
         (
           'uid' => array
              (
                STORY_AL_NUMERIC,
                '_uid'
              ),'tid'=>array(STORY_AL_ALPHANUM,'_tid'),'page_title'=>array(STORY_AL_ANYTHING,'_page_title'),'meta_description'=>array(STORY_AL_ANYTHING,'_meta_description'),'meta_keywords'=>array(STORY_AL_ANYTHING,'_meta_keywords'),'show_topic_icon'=>array(STORY_AL_CHECKBOX,'_show_topic_icon'),'draft_flag'=>array(STORY_AL_CHECKBOX,'_draft_flag'),'statuscode'=>array(STORY_AL_NUMERIC,'_statuscode'),'featured'=>array(STORY_AL_NUMERIC,'_featured'),'frontpage'=>array(STORY_AL_NUMERIC,'_frontpage'),'commentcode'=>array(STORY_AL_NUMERIC,'_commentcode'),'trackbackcode'=>array(STORY_AL_NUMERIC,'_trackbackcode'),'postmode'=>array(STORY_AL_ALPHANUM,'_postmode'),'story_hits'=>array(STORY_AL_NUMERIC,'_hits'),'story_comments'=>array(STORY_AL_NUMERIC,'_comments'),'story_emails'=>array(STORY_AL_NUMERIC,'_numemails'),'story_trackbacks'=>array(STORY_AL_NUMERIC,'_trackbacks'),'owner_id'=>array(STORY_AL_NUMERIC,'_owner_id'),'group_id'=>array(STORY_AL_NUMERIC,'_group_id'),'type'=>array(STORY_AL_ALPHANUM,'type'),'hits'=>array(STORY_AL_NUMERIC,'_hits'),'comments'=>array(STORY_AL_NUMERIC,'_comments'),'trackbacks'=>array(STORY_AL_NUMERIC,'_trackbacks'))

[line 221]

Magic array used for loading basic data from posted form. Of form:

postfield -> numeric, target, used with COM_applyFilter. Some fields have exceptions applied



Type:   mixed


[ Top ]

$_postmode =

[line 115]


Type:   mixed


[ Top ]

$_related =

[line 125]


Type:   mixed


[ Top ]

$_show_topic_icon =

[line 127]


Type:   mixed


[ Top ]

$_sid =

[line 108]

PRIVATE MEMBER VARIABLES: Things that make up a story.


Type:   mixed


[ Top ]

$_statuscode =

[line 130]


Type:   mixed


[ Top ]

$_storyImages =

[line 162]

Array of images uploaded for the story.


Type:   mixed


[ Top ]

$_tid =

[line 118]


Type:   mixed


[ Top ]

$_title =

[line 109]


Type:   mixed


[ Top ]

$_topic =

[line 146]


Type:   mixed


[ Top ]

$_trackbackcode =

[line 129]


Type:   mixed


[ Top ]

$_trackbacks =

[line 124]


Type:   mixed


[ Top ]

$_uid =

[line 116]


Type:   mixed


[ Top ]

$_username =

[line 142]


Type:   mixed


[ Top ]



Class Methods


constructor Story [line 351]

Story Story( [$mode $mode = 'admin'])

Constructor, creates a story, taking a (geeklog) database object.



Parameters:

$mode   $mode   string Story class mode, either 'admin' or 'submission'

[ Top ]

method checkAccess [line 1750]

int checkAccess( )

Perform a security check and return permission level.

saves the bother of accessing dozen's of vars.




Tags:

return:  access level for this story


[ Top ]

method DisplayElements [line 1618]

mixed DisplayElements( [string $item = 'title'])

Provide access to story elements. For display.

This is a peudo-property, implementing a getter for story details as if as an associative array. Personally, I'd rather be able to assign getters and setters to actual properties to mask controlled access to private member variables. But, you get what you get with PHP. So here it is in all it's nastyness.




Tags:

return:  The clean and ready to use value requested.


Parameters:

string   $item   Item to fetch.

[ Top ]

method EditElements [line 1405]

mixed EditElements( [string $item = 'title'])

Provide access to story elements. For the editor.

This is a pseudo-property, implementing a getter for story details as if as an associative array. Personally, I'd rather be able to assign getters and setters to actual properties to mask controlled access to private member variables. But, you get what you get with PHP. So here it is in all its nastiness.




Tags:

return:  The clean and ready to use (in edit mode) value requested.


Parameters:

string   $item   Item to fetch.

[ Top ]

method getAccess [line 1387]

void getAccess( )

Get the access level



[ Top ]

method getSid [line 1375]

void getSid( [$fordb $fordb = false])

Return the SID in a clean way



Parameters:

$fordb   $fordb   boolean True if we want an 'addslashes' version for the db

[ Top ]

method GetSpamCheckFormat [line 1001]

string GetSpamCheckFormat( )

Returns a story formatted for spam check:



Tags:

return:  Story formatted for spam check.


[ Top ]

method hasContent [line 362]

boolean hasContent( )

Check to see if there is any content in the story, for bothering to preview testing really.



Tags:

return:  trim(title+intro+body) != ''


[ Top ]

method initSubmission [line 899]

void initSubmission( string $topic)

Sets up basic data for a new user submission story



Parameters:

string   $topic   Topic the user picked before heading to submission

[ Top ]

method insertImages [line 1102]

array insertImages( )

Inserts image HTML into the place of Image Placeholders for stories with images.



Tags:

return:  containing errors, or empty.


[ Top ]

method loadFromArgsArray [line 816]

void loadFromArgsArray( &$array)

Loads a story from the post data. This is the most exciting function in the whole entire world. First it'll clean up that horrible Magic Quotes crap. Then it'll do all Geeklog's funky security stuff, anti XSS, anti SQL Injection. Yay.



Parameters:

   &$array  

[ Top ]

method loadFromArray [line 385]

nowt? loadFromArray( $story $story)

Loads a story object from an array (that's come back from the db..)

Used from loadFromDatabase, and used on it's own from story list pages.




Parameters:

$story   $story   array Story array from db

[ Top ]

method loadFromDatabase [line 437]

Integer loadFromDatabase( $sid $sid, [ $mode = 'edit'])

Load a Story object from the sid specified, returning a status result.

The result will either be a permission denied message, invalid SID message, or a loaded ok message. If it's loaded ok, then we've got all the exciting gubbins here.

Only used from story admin and submit.php!




Tags:

return:  from a constant.


Parameters:

$sid   $sid   string Story Identifier, valid geeklog story id from the db.
   $mode  

[ Top ]

method loadSubmission [line 939]

void loadSubmission( )

Loads a submitted story from postdata



[ Top ]

method replaceImages [line 1272]

string replaceImages( $text, string $sid, string $intro, string $body)

This replaces all article image HTML in intro and body with GL special syntax



Tags:

return:  processed text


Parameters:

string   $sid   ID for story to parse
string   $intro   Intro text
string   $body   Body text
   $text  

[ Top ]

method saveSubmission [line 1011]

integer saveSubmission( )

Saves a story submission.



Tags:

return:  result code explaining behaviour.


[ Top ]

method saveToDatabase [line 668]

Integer saveToDatabase( )

Saves the story in it's final state to the database.

Handles all the SID magic etc.




Tags:

return:  status result from a constant list.


[ Top ]

method setTid [line 1738]

void setTid( $tid $tid)

Set the TID to a new value.



Parameters:

$tid   $tid   int ID of the topic to set

[ Top ]

method _sanitizeData [line 2147]

void _sanitizeData( )

Perform some basic cleanups of data, dealing with empty required, defaultable fields.



[ Top ]


Documentation generated on Thu, 24 May 2012 02:09:15 -0400 by phpDocumentor 1.4.3