add('name', PLUGIN_POLL_TITLE); $propbag->add('description', PLUGIN_POLL_TITLE_BLAHBLAH); $propbag->add('event_hooks', array( 'backend_sidebar_entries_event_display_poll' => true, 'backend_sidebar_entries' => true, 'entries_header' => true, 'entry_display' => true, 'genpage' => true)); $propbag->add('configuration', array('permalink', "articleformat", "pagetitle", "articleformattitle")); $propbag->add('author', 'Garvin Hicking, Matthias Mees'); $propbag->add('groups', array('STATISTICS')); $propbag->add('version', '2.17'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', 'php' => '4.1.0' )); $propbag->add('stackable', false); $propbag->add('legal', array( 'services' => array( ), 'frontend' => array( 'Anonymized voting only increases the vote count number, no other user data is stored.', 'A session cookie is used to store session data (so that multiple votes can be prevented).', 'Sessiondata plus a user cookie is set for each poll so that multiple votes can be prevented.', ), 'backend' => array( ), 'cookies' => array( 'PHP Session ID cookie', 'User cookie "pollHasVotedX" which identifies an existing vote' ), 'stores_user_input' => true, 'stores_ip' => false, 'uses_ip' => false, 'transmits_user_input' => true )); $this->dependencies = array('serendipity_plugin_pollbox' => 'keep'); } function introspect_config_item($name, &$propbag) { global $serendipity; switch($name) { case 'permalink': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_POLL_PERMALINK); $propbag->add('description', PLUGIN_POLL_PERMALINK_BLAHBLAH); $propbag->add('default', $serendipity['rewrite'] != 'none' ? $serendipity['serendipityHTTPPath'] . 'pages/poll.html' : $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?/pages/poll.html'); break; case 'pagetitle': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_POLL_PAGETITLE); $propbag->add('description', ''); $propbag->add('default', PLUGIN_POLL_TITLE); break; case 'articleformat': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_POLL_ARTICLEFORMAT); $propbag->add('description', PLUGIN_POLL_ARTICLEFORMAT_BLAHBLAH); $propbag->add('default', 'true'); break; case 'articleformattitle': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_POLL_ARTICLEFORMAT_PAGETITLE); $propbag->add('description', PLUGIN_POLL_ARTICLEFORMAT_PAGETITLE_BLAHBLAH); $propbag->add('default', $serendipity['blogTitle'] . ' :: ' . $this->pagetitle); break; default: return false; } return true; } function setupDB() { global $serendipity; $built = $this->get_config('db_built', null); if (empty($built) && !defined('PLUGIN_POLL_UPGRADE_DONE')) { serendipity_db_schema_import("CREATE TABLE {$serendipity['dbPrefix']}polls ( id {AUTOINCREMENT} {PRIMARY}, title varchar(255) not null default '', content text, active int(1) default '1', votes int(4) default '0', timestamp int(10) {UNSIGNED} default null);"); serendipity_db_schema_import("CREATE TABLE {$serendipity['dbPrefix']}polls_options ( id {AUTOINCREMENT} {PRIMARY}, pollid int(10) {UNSIGNED}, title varchar(255) not null default '', votes int(4) default '0', timestamp int(10) {UNSIGNED} default null);"); serendipity_db_schema_import("CREATE INDEX pollidx ON {PREFIX}polls_options (pollid);"); $this->set_config('db_built', '1'); @define('PLUGIN_POLL_UPGRADE_DONE', true); // No further static pages may be called! } } function &get_polldata($key, $default = null) { if (isset($this->poll[$key])) { return $this->poll[$key]; } else { return $default; } } function show() { global $serendipity; if ($this->selected()) { if (!headers_sent()) { header('HTTP/1.0 200'); header('Status: 200'); } if (!is_object($serendipity['smarty'])) { serendipity_smarty_init(); } $_ENV['staticpage_pagetitle'] = preg_replace('@[^a-z0-9]@i', '_',$this->get_config('pagetitle')); $serendipity['smarty']->assign('staticpage_pagetitle', $_ENV['staticpage_pagetitle']); echo '
' . TITLE . ' | '; echo ''; echo ' | '; echo ' |
---|---|---|
'; echo ' | '; echo ' | ' . (int)$option['votes'] . ' ' . PLUGIN_POLL_VOTES . ' | '; echo '
'; echo ' | '; echo ' |