Exemple #1
0
function social_bookmarks_initialize()
{
    global $CONFIG, $JS, $lang_plugin_social_bookmarks, $social_bookmarks_icon_array;
    $superCage = Inspekt::makeSuperCage();
    if (in_array('js/jquery.spinbutton.js', $JS['includes']) != TRUE) {
        $JS['includes'][] = 'js/jquery.spinbutton.js';
    }
    if (in_array('plugins/social_bookmarks/script.js', $JS['includes']) != TRUE) {
        $JS['includes'][] = 'plugins/social_bookmarks/script.js';
    }
    require_once "./plugins/social_bookmarks/lang/english.php";
    if ($CONFIG['lang'] != 'english' && file_exists("./plugins/social_bookmarks/lang/{$CONFIG['lang']}.php")) {
        require_once "./plugins/social_bookmarks/lang/{$CONFIG['lang']}.php";
    }
    if ($CONFIG['enable_menu_icons'] >= 1) {
        $social_bookmarks_icon_array['configure'] = '<img src="./plugins/social_bookmarks/images/icons/configure.png" border="0" width="16" height="16" alt="" class="icon" />';
        $social_bookmarks_icon_array['menu'] = '<img src="./plugins/social_bookmarks/images/icons/social_bookmarks.png" border="0" width="16" height="16" alt="" class="icon" />';
    } else {
        $social_bookmarks_icon_array['configure'] = '';
        $social_bookmarks_icon_array['menu'] = '';
    }
    if ($CONFIG['enable_menu_icons'] == 2) {
        $social_bookmarks_icon_array['page'] = '<img src="./plugins/social_bookmarks/images/icons/social_bookmarks.png" border="0" width="16" height="16" alt="" class="icon" />';
    } else {
        $social_bookmarks_icon_array['page'] = '';
    }
    $social_bookmarks_icon_array['announcement'] = cpg_fetch_icon('announcement', 1);
    $social_bookmarks_icon_array['ok'] = cpg_fetch_icon('ok', 0);
    $social_bookmarks_icon_array['cancel'] = cpg_fetch_icon('cancel', 0);
    $social_bookmarks_icon_array['stop'] = cpg_fetch_icon('stop', 0);
    $return['language'] = $lang_plugin_social_bookmarks;
    $return['icon'] = $social_bookmarks_icon_array;
    return $return;
}
Exemple #2
0
 public static function Factory(&$source, $conf_file = NULL, $conf_section = NULL, $strict = TRUE)
 {
     if (!is_array($source)) {
         user_error('$source ' . $source . ' is not an array', E_USER_NOTICE);
     }
     $cage = new Inspekt_Cage_Session();
     $cage->_setSource($source);
     $cage->_parseAndApplyAutoFilters($conf_file);
     if (ini_get('session.use_cookies') || ini_get('session.use_only_cookies')) {
         if (isset($_COOKIE) && isset($_COOKIE[session_name()])) {
             session_id($_COOKIE[session_name()]);
         } elseif ($cookie = Inspekt::makeSessionCage()) {
             session_id($cookie->getAlnum(session_name()));
         }
     } else {
         // we're using session ids passed via GET
         if (isset($_GET) && isset($_GET[session_name()])) {
             session_id($_GET[session_name()]);
         } elseif ($cookie = Inspekt::makeSessionCage()) {
             session_id($cookie->getAlnum(session_name()));
         }
     }
     if ($strict) {
         $source = NULL;
     }
     return $cage;
     register_shutdown_function();
     register_shutdown_function(array($this, '_repopulateSession'));
 }
Exemple #3
0
function picture_navigation_page_start()
{
    $superCage = Inspekt::makeSuperCage();
    if (!$superCage->get->keyExists('slideshow')) {
        js_include('plugins/picture_navigation/picture_navigation.js');
    }
}
Exemple #4
0
function album_share_codes_main()
{
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->testInt('album')) {
        global $CONFIG;
        $aid = $superCage->get->getInt('album');
        $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '{$aid}'");
        if (mysql_num_rows($result) > 0) {
            while ($row = mysql_fetch_assoc($result)) {
                $url = $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $row['pid'];
                $thumb = $CONFIG['ecards_more_pic_target'] . get_pic_url($row, 'thumb');
                $content1 .= '[url=' . $url . '][img]' . $thumb . '[/img][/url]' . "\n";
                $content2 .= '<a href="' . $url . '"><img src="' . $thumb . ' /></a>' . "\n";
            }
            starttable(-1, 'Share codes for <i>all files</i> in this album');
            echo <<<EOT
                <tr>
                    <td class="tableb">
                        <tt>[url][img][/url]</tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content1}</textarea>
                        <br />
                        <tt>&lt;a&gt;&lt;img&gt;&lt;/a&gt;</tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content2}</textarea>
                    </td>
                </tr>
EOT;
            endtable();
        }
    }
}
Exemple #5
0
 function getDateLink($day, $month, $year)
 {
     global $CONFIG, $lang_calendar_php;
     $superCage = Inspekt::makeSuperCage();
     $date = sprintf('%s-%02s-%02s', $year, $month, $day);
     $query = "SELECT COUNT(pid) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND substring(from_unixtime(ctime),1,10) = '" . substr($date, 0, 10) . "' {$META_ALBUM_SET}";
     $result = cpg_db_query($query);
     $nb_pics = mysql_result($result, 0, 0);
     if ($matches = $superCage->get->getMatched('action', '/^[a-z]+$/')) {
         $action = $matches[0];
     } elseif ($matches = $superCage->post->getMatched('action', '/^[a-z]+$/')) {
         $action = $matches[0];
     } else {
         $action = '';
     }
     if ($action == 'browsebydate') {
         if ($nb_pics) {
             $link = '<a href="#" onclick="sendDate(\'' . $month . '\', \'' . $day . '\', \'' . $year . '\');" class="user_thumb_infobox"  title="' . $nb_pics . ' ' . $lang_calendar_php['files'] . '">';
         } else {
             $link = '';
         }
     } else {
         $link = "<a href=\"#\" onclick=\"sendDate('" . $month . "', '" . $day . "', '" . $year . "');\" class=\"user_thumb_infobox\" >";
     }
     return $link;
 }
Exemple #6
0
function flv_player_cleanup($action)
{
    $superCage = Inspekt::makeSuperCage();
    $cleanup = $superCage->server->getEscaped('REQUEST_URI');
    if ($action == 1) {
        global $lang_common;
        list($timestamp, $form_token) = getFormToken();
        echo <<<EOT
            <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td class="tableb">
                        Playback of existing flv files won't work anymore!
                    </td>
                    <td class="tableb">
                        <form action="pluginmgr.php" method="post">
                            <input type="submit" name="submit" value="{$lang_common['back']}" class="button" />
                        </form>
                    </td>
                    <td class="tableb">
                        <form action="{$cleanup}" method="post">
                            <input type="hidden" name="drop" value="1" />
                            <input type="hidden" name="form_token" value="{$form_token}" />
                            <input type="hidden" name="timestamp" value="{$timestamp}" />
                            <input type="submit" name="submit" value="{$lang_common['continue']}" class="button" />
                        </form>
                    </td>
                </tr>
            </table>
EOT;
    }
}
Exemple #7
0
function token_modifier_criteria($criteria)
{
    global $raw_ip;
    $superCage = Inspekt::makeSuperCage();
    $criteria['ip_addr'] = $raw_ip;
    $criteria['browser'] = $superCage->server->getRaw('HTTP_USER_AGENT');
    return $criteria;
}
Exemple #8
0
function get_post_var($name, $default = '')
{
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->post->keyExists($name)) {
        return get_magic_quotes_gpc() ? stripslashes($superCage->post->noTags($name)) : $superCage->post->noTags($name);
    } else {
        return $default;
    }
}
Exemple #9
0
function album_addfav_html($html)
{
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->getInt('album') > 0) {
        $addfav_button = ' <a href="index.php?file=album_addfav/add&amp;aid=' . $superCage->get->getInt('album') . '" onclick="return confirm(\'Do you really want to add all files of this album to your favorites?\');" title="Add all pictures of this album to your favorites"><img src="images/icons/favorites.png" border="0" style="display:inline" /></a>';
        $html = preg_replace('/(<td style="vertical-align:top" class="statlink">.*<h2>)(.*)(<\\/h2>.*<\\/td>)/Usi', '\\1\\2' . $addfav_button . '\\3', $html, 1);
    }
    return $html;
}
Exemple #10
0
function fullsize_check_user()
{
    global $CONFIG;
    $superCage = Inspekt::makeSuperCage();
    if (USER_ID && $superCage->cookie->getInt($CONFIG['cookie_name'] . '_agb') === 1) {
        return true;
    } else {
        return false;
    }
}
Exemple #11
0
function psc_check_captcha($name)
{
    global $CONFIG;
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->post->getRaw('comment') == '' && strtolower(trim($superCage->post->getRaw($name))) == strtolower(trim($CONFIG[PSC_ANSWER_PREFIX . $superCage->post->getInt('captcha_id')]))) {
        return true;
    } else {
        return false;
    }
}
Exemple #12
0
function template_uninstall()
{
    global $CONFIG, $lang_errors;
    $superCage = Inspekt::makeSuperCage();
    if (!checkFormToken()) {
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    // Delete the plugin config records
    return true;
}
Exemple #13
0
function downloadZip_header($html)
{
    $lang_plugin_albumdownload = albumdownload_language();
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->getInt('album') > 0) {
        $imgcode = '<img src="plugins/albumdownload/ico/ziparrow.png" alt="' . $lang_plugin_albumdownload['albumDownload'] . '" title="' . $lang_plugin_albumdownload['albumDownload'] . '" style="vertical-align:text-top;" />';
        $html['{ALBUM_NAME}'] = $html['{ALBUM_NAME}'] . ' <a href="index.php?file=albumdownload/zip&aid=' . $superCage->get->getInt('album') . '">' . $imgcode . '</a>';
    }
    return $html;
}
/**
 * second level of scoping
 *
 */
function testScoping2()
{
    $cage_POST = Inspekt::makePostCage();
    echo "<pre>In " . __FUNCTION__ . "(): ";
    echo var_dump($cage_POST->testAlnum('/funky,_+=_\\|;:!@#$%^&*~time/0/0/`~foo,.+=_\\|;:!@#$%^&*~-bar'));
    echo "</pre>\n";
    echo "<pre>POST is not accessible here: ";
    echo var_dump($_POST);
    echo "</pre>\n";
}
Exemple #15
0
 function cookie_extraction()
 {
     $superCage = Inspekt::makeSuperCage();
     //if (isset($_COOKIE[$this->cookie_name . '_un']) && isset($_COOKIE[$this->cookie_name . '_pw'])){
     //	return array($this->get_user_id($_COOKIE[$this->cookie_name . '_un']), $_COOKIE[$this->cookie_name . '_pw']);
     //}
     if ($superCage->cookie->keyExists($this->cookie_name . '_un') && $superCage->cookie->keyExists($this->cookie_name . '_pw')) {
         return array($this->get_user_id($superCage->cookie->getRaw($this->cookie_name . '_un')), $superCage->cookie->getRaw($this->cookie_name . '_pw'));
     }
     return false;
 }
 function cookie_extraction()
 {
     $superCage = Inspekt::makeSuperCage();
     $id = 0;
     $pass = '';
     if ($superCage->cookie->keyExists('member_id') && $superCage->cookie->keyExists('pass_hash')) {
         $id = $superCage->cookie->getInt('member_id');
         $pass = substr($superCage->cookie->getEscaped('pass_hash'), 0, 32);
     }
     return $id ? array($id, $pass) : false;
 }
Exemple #17
0
function newsletter_initialize()
{
    global $CONFIG, $JS, $lang_plugin_newsletter, $newsletter_icon_array;
    $superCage = Inspekt::makeSuperCage();
    if (in_array('js/jquery.spinbutton.js', $JS['includes']) != TRUE) {
        $JS['includes'][] = 'js/jquery.spinbutton.js';
    }
    if (in_array('plugins/newsletter/js/script.js', $JS['includes']) != TRUE) {
        $JS['includes'][] = 'plugins/newsletter/js/script.js';
    }
    require "./plugins/newsletter/lang/english.php";
    if ($CONFIG['lang'] != 'english' && file_exists("./plugins/newsletter/lang/{$CONFIG['lang']}.php")) {
        require "./plugins/newsletter/lang/{$CONFIG['lang']}.php";
    }
    if ($CONFIG['enable_menu_icons'] == 2) {
        $newsletter_icon_array['config'] = '<img src="./plugins/newsletter/images/icons/config.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['newsletter'] = '<img src="./plugins/newsletter/images/icons/newsletter.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['catlist'] = '<img src="./plugins/newsletter/images/icons/catlist.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['subscribe'] = '<img src="./plugins/newsletter/images/icons/subscribe.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['mailing'] = '<img src="./plugins/newsletter/images/icons/mailing.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['archive'] = '<img src="./plugins/newsletter/images/icons/archive.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['locked'] = '<img src="./plugins/newsletter/images/icons/locked.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['unlocked'] = '<img src="./plugins/newsletter/images/icons/unlocked.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['search'] = '<img src="./plugins/newsletter/images/icons/search.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['send'] = '<img src="./plugins/newsletter/images/icons/send.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['queue'] = '<img src="./plugins/newsletter/images/icons/delete.png" width="16" height="16" border="0" alt="" class="icon" />';
    } else {
        $newsletter_icon_array['config'] = '';
        $newsletter_icon_array['announcement'] = '';
        $newsletter_icon_array['catlist'] = '';
        $newsletter_icon_array['subscribe'] = '';
        $newsletter_icon_array['mailing'] = '';
        $newsletter_icon_array['archive'] = '';
        $newsletter_icon_array['locked'] = '<img src="./plugins/newsletter/images/icons/locked.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['unlocked'] = '<img src="./plugins/newsletter/images/icons/unlocked.png" width="16" height="16" border="0" alt="" class="icon" />';
        $newsletter_icon_array['search'] = '';
        $newsletter_icon_array['send'] = '';
        $newsletter_icon_array['queue'] = '';
    }
    $newsletter_icon_array['announcement'] = cpg_fetch_icon('announcement', 1);
    $newsletter_icon_array['plugin_manager'] = cpg_fetch_icon('plugin_mgr', 2);
    $newsletter_icon_array['ok'] = cpg_fetch_icon('ok', 2);
    $newsletter_icon_array['success'] = cpg_fetch_icon('ok', 0);
    $newsletter_icon_array['failure'] = cpg_fetch_icon('cancel', 0);
    $newsletter_icon_array['cancel'] = cpg_fetch_icon('cancel', 2);
    $newsletter_icon_array['edit'] = cpg_fetch_icon('edit', 0);
    $newsletter_icon_array['delete'] = cpg_fetch_icon('delete', 0);
    $newsletter_icon_array['add'] = cpg_fetch_icon('add', 2);
    $newsletter_icon_array['visible'] = cpg_fetch_icon('online', 0);
    $newsletter_icon_array['invisible'] = cpg_fetch_icon('offline', 0);
    $return['language'] = $lang_plugin_newsletter;
    $return['icon'] = $newsletter_icon_array;
    return $return;
}
Exemple #18
0
function plugin_geoip_uninstall()
{
    global $CONFIG;
    $superCage = Inspekt::makeSuperCage();
    if (!checkFormToken()) {
        global $lang_errors;
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    // Delete the plugin config records
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_geoip_scope'");
    return true;
}
Exemple #19
0
 function Controller()
 {
     $this->validate = Inspekt::makeSuperCage();
     $this->db = Database::getInstance(array('conn_id' => Config::item('LINK_ID')));
     $this->view = new View();
     // auto load helper
     load_helper(array('php', 'time', 'html', 'form', 'table', 'forum'));
     // load forum model
     load_model('forum', FALSE);
     load_model('check', FALSE);
     $this->forum = forum_model::getInstance();
 }
 function cookie_extraction()
 {
     $superCage = Inspekt::makeSuperCage();
     $id = 0;
     $pass_hash = '';
     //if (isset($_COOKIE[$this->cookie_name])){
     //  list($id, $pass_hash) = unserialize($_COOKIE[$this->cookie_name]);
     //}
     if ($superCage->cookie->keyExists($this->cookie_name)) {
         list($id, $pass_hash) = unserialize($superCage->cookie->getRaw($this->cookie_name));
     }
     return $id ? array($id, $pass_hash) : false;
 }
Exemple #21
0
 function panorama_viewer_save_config_value($name)
 {
     global $CONFIG;
     $superCage = Inspekt::makeSuperCage();
     $new_value = $superCage->post->getRaw($name);
     if (!isset($CONFIG[$name])) {
         cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES('{$name}', '{$new_value}')");
         $CONFIG[$name] = $new_value;
     } elseif ($new_value != $CONFIG[$name]) {
         cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '{$new_value}' WHERE name = '{$name}'");
         $CONFIG[$name] = $new_value;
     }
 }
Exemple #22
0
 public function isValid($value)
 {
     // this line populates the "%value%" variables in the error messages
     $this->_setValue($value);
     // check format
     if (!Inspekt::isUri($value)) {
         // this line will insert the error message in the list of errors to
         // be returned to the caller
         $this->_error(self::NOT_URI);
         return false;
     }
     return true;
 }
Exemple #23
0
function album_voting_thumbnails_title($param)
{
    $superCage = Inspekt::makeSuperCage();
    $aid = $superCage->get->getInt('album');
    if ($aid > 0) {
        $param['{ALBUM_NAME}'] .= ' &#124; ';
        if (USER_ID) {
            $param['{ALBUM_NAME}'] .= album_voting_vote_button($aid, 1) . " ";
        }
        $param['{ALBUM_NAME}'] .= album_voting_voting_stats($aid, 1);
    }
    return $param;
}
 function cookie_extraction()
 {
     $superCage = Inspekt::makeSuperCage();
     $id = 0;
     $pass = '';
     //if (isset($_COOKIE['member_id']) && isset($_COOKIE['pass_hash'])) {
     //$id = (int)$_COOKIE['member_id'];
     //$pass = substr(addslashes($_COOKIE['pass_hash']), 0, 32);
     if ($superCage->cookie->keyExists('member_id') && $superCage->cookie->keyExists('pass_hash')) {
         $id = $superCage->cookie->getInt('member_id');
         $pass = substr($superCage->cookie->getEscaped('pass_hash'), 0, 32);
     }
     return $id ? array($id, $pass) : false;
 }
Exemple #25
0
function favorite_mailer_form($html)
{
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->keyExists('fm_mail')) {
        global $CONFIG, $FAVPICS;
        foreach ($FAVPICS as $pid) {
            $fav_pics .= $CONFIG['ecards_more_pic_target'] . "displayimage.php?pid={$pid} \n\n";
        }
        if ($fav_pics) {
            $html = str_replace('<textarea name="message" cols="50" rows="10" class="textinput"></textarea>', '<textarea name="message" cols="50" rows="10" class="textinput">' . $fav_pics . '</textarea>', $html);
        }
    }
    return $html;
}
/**
 * Initialize Inspekt
 *
 * @return object
 */
function init_inspekt_cage()
{
    $cage = Inspekt::makeSuperCage();
    // Add Hotaru custom methods
    $cage->addAccessor('testAlnumLines');
    $cage->addAccessor('testPage');
    $cage->addAccessor('testUsername');
    $cage->addAccessor('testPassword');
    $cage->addAccessor('getFriendlyUrl');
    $cage->addAccessor('sanitizeAll');
    $cage->addAccessor('sanitizeTags');
    $cage->addAccessor('getHtmLawed');
    return $cage;
}
/**
 * a wrapper to retrieve input from either the get or post Inspekt cages
 *
 * @param string $key the key you're trying to retrieve
 * @param string $accessor the name of the accessor method to use
 * @return mixed  null if key does not exist
 * @author Ed Finkler
 */
function getInputGP($key, $accessor)
{
    /*
    	this returns the singleton
    */
    $sc = Inspekt::makeSuperCage();
    if ($sc->get->keyExists($key)) {
        return $sc->get->{$accessor}($key);
    } elseif ($sc->post->keyExists($key)) {
        return $sc->post->{$accessor}($key);
    } else {
        return null;
    }
}
 /**
  * Constructor
  * Instantiates all neede libraries and makes them available
  */
 public function __construct()
 {
     $this->loadSessionTokens();
     //Wrap all input in Inspekt
     $input = \Inspekt::makeSuperCage();
     \Zend_Registry::set('input', $input);
     //Get a Mustache Factory up
     $tplEngine = new Template\Engine();
     \Zend_Registry::set('tplengine', $tplEngine);
     //Singleton our facebook interface
     if (\defined('FACEBOOK_APP_ID') && \defined('FACEBOOK_APP_SECRET')) {
         $facebook = new Facebook\Client(array('appId' => FACEBOOK_APP_ID, 'secret' => FACEBOOK_APP_SECRET));
         \Zend_Registry::set('facebook', $facebook);
     }
 }
 /**
  * If an array is the value of the given key, this method walks the array
  * recursively, applying $this->inspekt on any non-array values
  *
  * @param mixed $input
  * @return mixed
  * @throws Exception
  * @author Ed Finkler
  */
 protected function walkArray($input)
 {
     if (!Inspekt::isArrayOrArrayObject($input)) {
         throw new Exception('$input must be an array or ArrayObject');
     }
     foreach ($input as $key => $val) {
         if (Inspekt::isArrayOrArrayObject($val)) {
             $input[$key] = $this->walkArray($val);
         } else {
             $val = $this->inspekt($val);
             $input[$key] = $val;
         }
     }
     return $input;
 }
 function session_extraction()
 {
     $superCage = Inspekt::makeSuperCage();
     if ($superCage->cookie->keyExists($this->cookie_name . '_sid')) {
         $this->session_id = $superCage->cookie->getEscaped($this->cookie_name . '_sid');
         $sql = "SELECT user_id, user_password, group_id FROM {$this->sessionstable} INNER JOIN {$this->usertable} ON session_user_id = user_id WHERE session_id = '{$this->session_id}'";
         $result = cpg_db_query($sql, $this->link_id);
         if (mysql_num_rows($result)) {
             $row = mysql_fetch_array($result);
             $this->primary_group = array_pop($row);
             return $row['user_id'] == 1 ? false : $row;
         } else {
             return false;
         }
     }
 }