當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Inspekt::MakeSuperCage方法代碼示例

本文整理匯總了PHP中Inspekt::MakeSuperCage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inspekt::MakeSuperCage方法的具體用法?PHP Inspekt::MakeSuperCage怎麽用?PHP Inspekt::MakeSuperCage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Inspekt的用法示例。


在下文中一共展示了Inspekt::MakeSuperCage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: annotate_page_start

function annotate_page_start()
{
    global $CONFIG, $lang_meta_album_names, $valid_meta_albums;
    require_once './plugins/annotate/init.inc.php';
    $annotate_init_array = annotate_initialize();
    $lang_plugin_annotate = $annotate_init_array['language'];
    $annotate_icon_array = $annotate_init_array['icon'];
    $superCage = Inspekt::MakeSuperCage();
    $note = $superCage->get->keyExists('note') ? $superCage->get->getRaw('note') : $superCage->cookie->getRaw($CONFIG['cookie_name'] . 'note');
    $lang_meta_album_names['lastnotes'] = $lang_plugin_annotate['lastnotes'];
    $lang_meta_album_names['shownotes'] = $lang_plugin_annotate['shownotes'] . " '{$note}'";
    $valid_meta_albums[] = 'lastnotes';
    $valid_meta_albums[] = 'shownotes';
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->getAlpha('plugin') == "annotate" && $superCage->get->keyExists('delete_orphans')) {
        global $CONFIG;
        require_once './plugins/annotate/init.inc.php';
        $annotate_init_array = annotate_initialize();
        $lang_plugin_annotate = $annotate_init_array['language'];
        $annotate_icon_array = $annotate_init_array['icon'];
        load_template();
        pageheader($lang_plugin_annotate['delete_orphaned_entries']);
        if (version_compare(cpg_phpinfo_mysql_version(), '4.1', '>=')) {
            // we can use subqueries here
            cpg_db_query("DELETE FROM {$CONFIG['TABLE_PREFIX']}plugin_annotate WHERE pid NOT IN (SELECT pid FROM {$CONFIG['TABLE_PICTURES']})");
        } else {
            $result = cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']}");
            $pids = array();
            while ($row = mysql_fetch_row($result)) {
                $pids[] = $row[0];
            }
            $pids = implode(",", $pids);
            mysql_free_result($result);
            // cpg_db_query can cause browser to crash if debug output is enabled
            mysql_query("DELETE FROM {$CONFIG['TABLE_PREFIX']}plugin_annotate WHERE pid NOT IN ({$pids})");
        }
        $count = mysql_affected_rows();
        if ($count == 1) {
            $count_output = $lang_plugin_annotate['1_orphaned_entry_deleted'];
        } else {
            $count_output = sprintf($lang_plugin_annotate['x_orphaned_entries_deleted'], $count);
        }
        starttable('-1', $annotate_icon_array['delete'] . $lang_plugin_annotate['delete_orphaned_entries']);
        echo <<<EOT
        <tr>
            <td class="tableb">
                {$count_output}
            </td>
        </tr>
EOT;
        endtable();
        pagefooter();
        exit;
    }
    if ($superCage->get->getAlpha('plugin') == "annotate" && $superCage->get->keyExists('import')) {
        global $CONFIG;
        require_once './plugins/annotate/init.inc.php';
        $annotate_init_array = annotate_initialize();
        $lang_plugin_annotate = $annotate_init_array['language'];
        $annotate_icon_array = $annotate_init_array['icon'];
        load_template();
        pageheader($lang_plugin_annotate['import']);
        starttable('-1', $annotate_icon_array['import'] . $lang_plugin_annotate['import']);
        if ($superCage->get->keyExists('do') && $CONFIG['plugin_annotate_import'] != "1") {
            if (!mysql_query("SELECT user_time FROM {$CONFIG['TABLE_PREFIX']}notes")) {
                cpg_db_query("INSERT INTO {$CONFIG['TABLE_PREFIX']}plugin_annotate (pid, posx, posy, width, height, note, user_id, user_time) \n                              SELECT pid, posx, posy, width, height, note, user_id, UNIX_TIMESTAMP() FROM {$CONFIG['TABLE_PREFIX']}notes");
            } else {
                cpg_db_query("INSERT INTO {$CONFIG['TABLE_PREFIX']}plugin_annotate (pid, posx, posy, width, height, note, user_id, user_time) \n                              SELECT pid, posx, posy, width, height, note, user_id, user_time FROM {$CONFIG['TABLE_PREFIX']}notes");
            }
            echo '<tr><td class="tableb">' . sprintf($lang_plugin_annotate['import_success'], mysql_affected_rows()) . '</td></tr>';
            cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES ('plugin_annotate_import', '1')");
        } else {
            $notes_to_import = mysql_result(cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PREFIX']}notes"), 0);
            if (!$notes_to_import) {
                echo '<tr><td class="tableb">' . sprintf($lang_plugin_annotate['import_found'], $notes_to_import) . '</td></tr>';
            } elseif ($CONFIG['plugin_annotate_import'] == "1") {
                echo '<tr><td class="tableb">' . $lang_plugin_annotate['imported_already'] . '</td></tr>';
            } else {
                echo '<tr><td class="tableb">' . sprintf($lang_plugin_annotate['import_found'], $notes_to_import) . ' <a href="index.php?plugin=annotate&import&do" class="admin_menu">' . $lang_plugin_annotate['import'] . '</a></td></tr>';
            }
        }
        endtable();
        pagefooter();
        exit;
    }
    if ($superCage->get->getAlpha('plugin') == "annotate" && $superCage->get->keyExists('update_database')) {
        global $CONFIG;
        require_once './plugins/annotate/init.inc.php';
        $annotate_init_array = annotate_initialize();
        $lang_plugin_annotate = $annotate_init_array['language'];
        $annotate_icon_array = $annotate_init_array['icon'];
        load_template();
        pageheader($lang_plugin_annotate['update_database']);
        require 'include/sql_parse.php';
        $db_schema = './plugins/annotate/update.sql';
        $sql_query = fread(fopen($db_schema, 'r'), filesize($db_schema));
        $sql_query = preg_replace('/CPG_/', $CONFIG['TABLE_PREFIX'], $sql_query);
        $sql_query = remove_remarks($sql_query);
        $sql_query = split_sql_file($sql_query, ';');
        foreach ($sql_query as $q) {
//.........這裏部分代碼省略.........
開發者ID:phill104,項目名稱:branches,代碼行數:101,代碼來源:codebase.php

示例2: shorturl_page_start

function shorturl_page_start()
{
    if (defined('INDEX_PHP')) {
        global $CONFIG, $lang_common, $lang_errors, $cpg_udb, $lang_gallery_admin_menu;
        require "./plugins/shorturl/lang/english.php";
        if ($CONFIG['lang'] != 'english' && file_exists("./plugins/shorturl/lang/{$CONFIG['lang']}.php")) {
            require "./plugins/shorturl/lang/{$CONFIG['lang']}.php";
        }
        $superCage = Inspekt::MakeSuperCage();
        if ($superCage->get->keyExists('c')) {
            header("Location: index.php?cat=" . $superCage->get->getInt('c'));
        }
        if ($superCage->get->keyExists('a')) {
            header("Location: thumbnails.php?album=" . $superCage->get->getInt('a'));
        }
        if ($superCage->get->keyExists('p')) {
            header("Location: displayimage.php?pid=" . $superCage->get->getInt('p'));
        }
        if ($superCage->get->keyExists('r')) {
            $result = cpg_db_query("SELECT url FROM {$CONFIG['TABLE_PREFIX']}plugin_shorturl WHERE rid = " . $superCage->get->getInt('r'));
            $url = mysql_result($result, 0);
            mysql_free_result($result);
            if ($CONFIG['plugin_shorturl_preview'] == 1 || $superCage->get->keyExists('preview')) {
                load_template();
                pageheader($lang_plugin_shorturl['redirection_preview']);
                starttable('100%', $lang_plugin_shorturl['redirection_preview']);
                echo <<<EOT
                    <tr>
                        <td class="tableb">
                            <a href="{$url}" class="external">{$url}</a>
                        </td>
                    </tr>
EOT;
                endtable();
                pagefooter();
                exit;
            } else {
                header("Location: {$url}");
            }
        }
        if ($superCage->get->keyExists('shorturl')) {
            if ($superCage->get->getAlpha('shorturl') == 'config') {
                if (!GALLERY_ADMIN_MODE) {
                    load_template();
                    cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
                }
                if ($superCage->post->keyExists('submit') == TRUE) {
                    if (!checkFormToken()) {
                        load_template();
                        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
                    }
                    $superCage = Inspekt::makeSuperCage();
                    if (!isset($CONFIG['plugin_shorturl_preview'])) {
                        cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES('plugin_shorturl_preview', '" . $superCage->post->getInt('plugin_shorturl_preview') . "')");
                    } else {
                        cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '" . $superCage->post->getInt('plugin_shorturl_preview') . "' WHERE name = 'plugin_shorturl_preview'");
                    }
                    $CONFIG['plugin_shorturl_preview'] = $superCage->post->getInt('plugin_shorturl_preview');
                    $result = cpg_db_query("SELECT group_id FROM {$CONFIG['TABLE_USERGROUPS']} WHERE has_admin_access != '1'");
                    while ($row = mysql_fetch_assoc($result)) {
                        if (!isset($CONFIG['plugin_shorturl_permissions_' . $row['group_id']])) {
                            cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES('plugin_shorturl_permissions_{$row['group_id']}', '" . $superCage->post->getInt('plugin_shorturl_permissions_' . $row['group_id']) . "')");
                        } else {
                            cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '" . $superCage->post->getInt('plugin_shorturl_permissions_' . $row['group_id']) . "' WHERE name = 'plugin_shorturl_permissions_{$row['group_id']}'");
                        }
                        $CONFIG['plugin_shorturl_permissions_' . $row['group_id']] = $superCage->post->getInt('plugin_shorturl_permissions_' . $row['group_id']);
                    }
                    mysql_free_result($result);
                }
                load_template();
                pageheader($lang_plugin_shorturl['plugin_name'] . ' ' . $lang_gallery_admin_menu['admin_lnk']);
                $permissions = "";
                $result = cpg_db_query("SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_id ASC");
                while ($row = mysql_fetch_assoc($result)) {
                    if (in_array($row['group_id'], $cpg_udb->admingroups)) {
                        $permissions .= <<<EOT
                            <tr>
                                <td valign="top" align="left" class="tableb">
                                    {$row['group_name']}
                                </td>
                                <td valign="top" align="center" class="tableb">
                                    <input type="radio" class="radio" disabled="disabled" />
                                </td>
                                <td valign="top" align="center" class="tableb">
                                    <input type="radio" class="radio" checked="checked" />
                                </td>
                            </tr>
EOT;
                    } else {
                        $row['permission'] = mysql_result(cpg_db_query("SELECT value FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_shorturl_permissions_{$row['group_id']}'"), 0);
                        $permissions .= <<<EOT
                            <tr>
                                <td valign="top" align="left" class="tableb">
                                    {$row['group_name']}
                                </td>
EOT;
                        for ($i = 0; $i <= 1; $i++) {
                            if (!is_numeric($row['permission']) && $i == 0) {
                                $checked = "checked=\"checked\"";
                            } else {
//.........這裏部分代碼省略.........
開發者ID:phill104,項目名稱:branches,代碼行數:101,代碼來源:codebase.php


注:本文中的Inspekt::MakeSuperCage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。