コード例 #1
0
function get_smilies_table2()
{
    global $lang_smilies_inc_php;
    $smilies_display = array(array(':lol:', 'lol.gif', $lang_smilies_inc_php['Laughing']), array(':-P', 'razz.gif', $lang_smilies_inc_php['Razz']), array(':-D', 'biggrin.gif', $lang_smilies_inc_php['Very Happy']), array(':-)', 'smile.gif', $lang_smilies_inc_php['Smile']), array(':-|', 'neutral.gif', $lang_smilies_inc_php['Neutral']), array(':-(', 'sad.gif', $lang_smilies_inc_php['Sad']), array(':cry:', 'cry.gif', $lang_smilies_inc_php['Crying or Very sad']), array('8-)', 'cool.gif', $lang_smilies_inc_php['Cool']), array(':-o', 'surprised.gif', $lang_smilies_inc_php['Surprised']), array(':-?', 'confused.gif', $lang_smilies_inc_php['Confused']), array(':oops:', 'redface.gif', $lang_smilies_inc_php['Embarrassed']), array(':shock:', 'eek.gif', $lang_smilies_inc_php['Shocked']), array(':-x', 'mad.gif', $lang_smilies_inc_php['Mad']), array(':roll:', 'rolleyes.gif', $lang_smilies_inc_php['Rolling Eyes']), array(';-)', 'wink.gif', $lang_smilies_inc_php['Wink']), array(':idea:', 'idea.gif', $lang_smilies_inc_php['Idea']), array(':!:', 'exclaim.gif', $lang_smilies_inc_php['Exclamation']), array(':?:', 'question.gif', $lang_smilies_inc_php['Question']));
    $smilies_display = CPGPluginAPI::filter('smilies_display', $smilies_display);
    return $smilies_display;
}
コード例 #2
0
ファイル: codebase.php プロジェクト: phill104/branches
function mirror_configure()
{
    global $CONFIG, $CPG_PLUGINS;
    $icon_array['ok'] = cpg_fetch_icon('ok', 1);
    $icon_array['cancel'] = cpg_fetch_icon('cancel', 1);
    $allow_continue = 1;
    echo <<<EOT
    <form action="" method="post" name="mirror_config" id="mirror_config">
        <ul>
EOT;
    if ($CONFIG['transparent_overlay'] != '0') {
        echo <<<EOT
            <li>The mirror plugin doesn't work with the config option '<em>Insert a transparent overlay to minimize image theft</em>'. If you decide to continue, that option will be disabled for you. Don't turn it back on while using this plugin.</li>
EOT;
    }
    if (($plugin_id = CPGPluginAPI::installed('image_manipulation')) !== false) {
        echo <<<EOT
            <li>You have installed the plugin '<em>Image Manipulation (image_manipulation)</em>' that can't be run at the same time with the Mirror plugin. Return to the plugin manager and uninstall that other plugin first before installing this plugin.</li>
EOT;
        $allow_continue = 0;
    }
    echo <<<EOT
        </ul>
EOT;
    if ($allow_continue == 1) {
        echo <<<EOT
        <input type="hidden" name="mirror_continue_anyway" id="mirror_continue_anyway" value="1" />
        <button type="submit" class="button" name="submit" value="Continue anyway">{$icon_array['ok']}Continue anyway</button>
EOT;
    }
    echo <<<EOT
        <a href="pluginmgr.php" class="admin_menu">{$icon_array['cancel']}Cancel</a>
EOT;
    echo <<<EOT
    </form>
EOT;
}
コード例 #3
0
ファイル: pluginmgr.php プロジェクト: JoseCOCA/baudprint
function display_plugin_list()
{
    global $CPG_PLUGINS, $lang_pluginmgr_php, $lang_plugin_php, $lang_common, $CONFIG, $CPG_PHP_SELF;
    list($timestamp, $form_token) = getFormToken();
    $help = '&nbsp;' . cpg_display_help('f=plugins.htm&amp;as=plugin_manager&amp;ae=plugin_manager_end&amp;top=1', '800', '600');
    $help_plugin_enable = cpg_display_help('f=configuration.htm&amp;as=admin_general_enable-plugins&amp;ae=admin_general_enable-plugins_end', 400, 300);
    // configure plugin api (enabled or disabled)
    $yes_selected = $CONFIG['enable_plugins'] ? 'checked="checked"' : '';
    $no_selected = !$CONFIG['enable_plugins'] ? 'checked="checked"' : '';
    print '<form name="pluginenableconfig" id="cpgform2" action="' . $CPG_PHP_SELF . '" method="post" style="margin:0px;padding:0px">';
    starttable('-1', cpg_fetch_icon('plugin_mgr', 2) . $lang_pluginmgr_php['pmgr'] . $help, 3);
    echo <<<EOT
        <tr>
                <td class="tableh2" colspan="3">
                    {$lang_pluginmgr_php['explanation']}
                </td>
        </tr>
        <tr>
                <td class="tableb">
                    {$lang_pluginmgr_php['plugin_enabled']}
                </td>
                <td class="tableb">
                    <input type="radio" id="enable_plugins1" name="enable_plugins" value="1"  onclick="document.pluginenableconfig.submit();" {$yes_selected} class="radio" /><label for="enable_plugins1" class="clickable_option">{$lang_common['yes']}</label>
                    &nbsp;&nbsp;
                    <input type="radio" id="enable_plugins0" name="enable_plugins" value="0"  onclick="document.pluginenableconfig.submit();" {$no_selected} class="radio" /><label for="enable_plugins0" class="clickable_option">{$lang_common['no']}</label>
                    <input type="hidden" name="update_config" value="1" />
                    <input type="hidden" name="form_token" value="{$form_token}" />
                    <input type="hidden" name="timestamp" value="{$timestamp}" />
                </td>
                <td class="tableb">
                    {$help_plugin_enable}
                </td>
        </tr>
EOT;
    endtable();
    print '</form>';
    echo <<<EOT
        <br />
EOT;
    $help = '&nbsp;' . cpg_display_help('f=plugins.htm&amp;as=plugin_manager_uninstall&amp;ae=plugin_manager_uninstall_end&amp;top=1', '640', '480');
    $available_plugins = cpg_get_dir_list('./plugins/');
    starttable('100%');
    echo <<<EOT
        <tr>
                <td class="tableh1" width="90%"><strong><span class="statlink">{$lang_pluginmgr_php['i_plugins']}</span></strong></td>
                <td colspan="3" class="tableh1" align="center" width="10%"><strong><span class="statlink">{$lang_pluginmgr_php['operation']}</span></strong>{$help}</td>
        </tr>
EOT;
    unset($installed_plugins);
    if ($CONFIG['enable_plugins'] == 1) {
        $loop_counter = 0;
        foreach ($CPG_PLUGINS as $thisplugin) {
            $installed_plugins[$loop_counter] = array('index' => $thisplugin->index, 'plugin_id' => $thisplugin->plugin_id, 'path' => $thisplugin->path, 'priority' => $thisplugin->priority, 'error' => $thisplugin->error);
            $loop_counter++;
        }
    } else {
        // If plugin system is turned off, grab installed plugins from database table
        $query = 'SELECT * FROM ' . $CONFIG['TABLE_PLUGINS'] . ' ORDER BY priority ASC;';
        $result = cpg_db_query($query);
        $loop_counter = 0;
        while ($installed_plugin = mysql_fetch_assoc($result)) {
            $installed_plugins[$loop_counter] = array('index' => $loop_counter, 'plugin_id' => $installed_plugin['plugin_id'], 'path' => $installed_plugin['path'], 'priority' => $installed_plugin['priority'], 'error' => array());
            $loop_counter++;
        }
    }
    $installed_count = 0;
    $loop_counter = 0;
    if (isset($installed_plugins) == TRUE) {
        $plugins_count = count($installed_plugins);
        foreach ($installed_plugins as $thisplugin) {
            $installed_count++;
            unset($extra_info);
            unset($install_info);
            include './plugins/' . $thisplugin['path'] . '/configuration.php';
            $pluginPath = $thisplugin['path'];
            $safename = addslashes(str_replace('&nbsp;', '', $name));
            if (isset($extra_info) == TRUE) {
                $extra = $extra_info;
            } else {
                $extra = '';
            }
            if (sizeof($thisplugin['error']) > 0) {
                $error = $thisplugin['error']['desc'];
                $extra = '<tr><td class="tableb" width="100%" colspan="2">' . '<strong>' . $lang_common['error'] . ':</strong> <span style="color:red;">' . $error . '</span>' . '</td></tr>' . $extra;
            }
            if ($loop_counter == 0) {
                $row_style_class = 'tableb';
            } else {
                $row_style_class = 'tableb tableb_alternate';
            }
            $loop_counter++;
            if ($loop_counter > 1) {
                $loop_counter = 0;
            }
            echo <<<EOT
        <tr>
            <td width="90%" class="{$row_style_class}">
                <a name="{$pluginPath}"></a>
                <table border="0" width="100%" cellspacing="0" cellpadding="0" class="maintable">
                    <tr>
                        <td colspan="2" class="tableh1">{$name} ({$pluginPath}): {$lang_pluginmgr_php['vers']}{$version}</td>
                    </tr>
                    <tr>
                        <td class="tableb" valign="top">{$lang_pluginmgr_php['author']}:</td>
                        <td class="tableb" valign="top">{$author}</td>
                    </tr>
                    <tr>
                        <td class="tableb tableb_alternate" valign="top">{$lang_pluginmgr_php['desc']}</td>
                        <td class="tableb tableb_alternate" valign="top">{$description}</td>
                    </tr>
EOT;
            if ($extra != '') {
                echo <<<EOT
                    <tr>
                        <td class="tableb" width="20%" valign="top">{$lang_pluginmgr_php['extra']}:</td>
                        <td class="tableb" valign="top">{$extra}</td>
                    </tr>
EOT;
            }
            echo <<<EOT
                </table>
            </td>
            <td class="{$row_style_class}" valign="top">
            <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
EOT;
            if ($thisplugin['index'] > 0 && $plugins_count > 1) {
                $up = cpg_fetch_icon('up', 0);
                echo <<<EOT
            <td width="3%" align="center" valign="middle">
                <a href="pluginmgr.php?op=moveu&amp;p={$thisplugin['plugin_id']}&amp;form_token={$form_token}&amp;timestamp={$timestamp}#{$pluginPath}">{$up}</a>
            </td>
EOT;
            } else {
                echo '<td width="3%"></td>';
            }
            if ($thisplugin['index'] < $plugins_count - 1) {
                $down = cpg_fetch_icon('down', 0);
                echo <<<EOT
            <td width="3%" align="center" valign="middle">
                <a href="pluginmgr.php?op=moved&amp;p={$thisplugin['plugin_id']}&amp;form_token={$form_token}&amp;timestamp={$timestamp}#{$pluginPath}">{$down}</a>
            </td>
EOT;
            } else {
                echo '<td width="3%"></td>';
            }
            $confirm_function = $CONFIG['enable_plugins'] == 1 ? 'confirmUninstall' : 'confirmRemove';
            $delete = cpg_fetch_icon('plugin_uninstall', 0);
            echo <<<EOT
            <td width="3%" align="center" valign="middle">
                <a href="pluginmgr.php?op=uninstall&amp;p={$thisplugin['plugin_id']}&amp;form_token={$form_token}&amp;timestamp={$timestamp}" onclick="return {$confirm_function}('{$safename}')" title="{$lang_pluginmgr_php['uninstall']}">
                    {$delete}
                </a>
            </td>

        </tr>
        </table>
        </td>
        </tr>
EOT;
        }
    }
    if ($installed_count == 0) {
        echo '<tr><td colspan="4" class="tableb" align="center">' . $lang_pluginmgr_php['none_installed'] . '</td></tr>';
    }
    endtable();
    echo '<p>&nbsp;</p>';
    echo '<form name="cpgform" id="cpgform" action="pluginmgr.php?op=upload" method="post" enctype="multipart/form-data">';
    $help_upload = '&nbsp;' . cpg_display_help('f=plugins.htm&amp;as=plugin_manager_upload&amp;ae=plugin_manager_upload_end&amp;top=1', '640', '480');
    $help_install = '&nbsp;' . cpg_display_help('f=plugins.htm&amp;as=plugin_manager_install&amp;ae=plugin_manager_install_end&amp;top=1', '640', '480');
    starttable('100%');
    echo <<<EOT
        <tr>
                <td class="tableh1" width="90%">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td align="left">
                                <strong><span class="statlink">{$lang_pluginmgr_php['n_plugins']}</span></strong>{$help_install}
                            </td>
                            <td align="right">
                                    <input type="file" size="40" name="plugin" class="textinput" />
                                    <input type="hidden" name="form_token" value="{$form_token}" />
                                    <input type="hidden" name="timestamp" value="{$timestamp}" />
                                    <input type="submit" class="button" value="{$lang_pluginmgr_php['upload']}" />
                                    {$help_upload}
                            </td>
                        </tr>
                    </table>
                </td>
                <td colspan="3" class="tableh1" align="center" width="10%"><strong><span class="statlink">{$lang_pluginmgr_php['operation']}</span></strong></td>
        </tr>
EOT;
    $loop_counter = 0;
    // Note: CPGPluginAPI::installed() works even if Plugin API is disabled.
    foreach ($available_plugins as $path) {
        if (($plugin_id = CPGPluginAPI::installed($path)) === false) {
            // If codebase.php and configuration.php don't exist, skip this folder
            if (!(file_exists('./plugins/' . $path . '/codebase.php') && file_exists('./plugins/' . $path . '/configuration.php'))) {
                continue;
            }
            unset($extra_info);
            unset($install_info);
            include './plugins/' . $path . '/configuration.php';
            $pluginPath = $path;
            $safename = addslashes(str_replace('&nbsp;', '', $name));
            if (isset($install_info) == TRUE) {
                $extra = $install_info;
            } else {
                $extra = '';
            }
            if ($loop_counter == 0) {
                $row_style_class = 'tableb';
            } else {
                $row_style_class = 'tableb tableb_alternate';
            }
            $loop_counter++;
            if ($loop_counter > 1) {
                $loop_counter = 0;
            }
            echo <<<EOT
            <tr>
            <td width="90%" class="{$row_style_class}">
                <table border="0" width="100%" cellspacing="0" cellpadding="0" class="maintable">
                    <tr>
                        <td colspan="2" class="tableh1">{$name} ({$pluginPath}): {$lang_pluginmgr_php['vers']}{$version}</td>
                    </tr>
                    <tr>
                        <td class="tableb tableb_alternate" width="20%" valign="top">{$lang_pluginmgr_php['author']}:</td>
                        <td class="tableb tableb_alternate" valign="top">{$author}</td>
                    </tr>
                    <tr>
                        <td class="tableb" valign="top">{$lang_pluginmgr_php['desc']}:</td>
                        <td class="tableb" valign="top">{$description}</td>
                    </tr>
EOT;
            if ($extra != '') {
                echo <<<EOT
                    <tr>
                        <td class="tableb tableb_alternate" width="20%" valign="top">{$lang_pluginmgr_php['install_info']}:</td>
                        <td class="tableb tableb_alternate" valign="top">{$extra}</td>
                    </tr>
EOT;
            }
            // Take care of version requirements
            if (isset($plugin_cpg_version['min']) == TRUE) {
                if (version_compare(COPPERMINE_VERSION, $plugin_cpg_version['min']) >= 0) {
                    $plugin_cpg_version['min_ok'] = '1';
                } else {
                    $plugin_cpg_version['min_ok'] = '-1';
                }
            } else {
                $plugin_cpg_version['min_ok'] = '0';
            }
            if (isset($plugin_cpg_version['max']) == TRUE) {
                if (version_compare(COPPERMINE_VERSION, $plugin_cpg_version['max']) <= 0) {
                    $plugin_cpg_version['max_ok'] = '1';
                } else {
                    $plugin_cpg_version['max_ok'] = '-1';
                }
            } else {
                $plugin_cpg_version['max_ok'] = '0';
            }
            if ($CONFIG['enable_plugins'] == 1) {
                if ($plugin_cpg_version['min_ok'] > 0 && $plugin_cpg_version['max_ok'] >= 0) {
                    $install_button = '<a href="pluginmgr.php?op=install&amp;p=' . $path . '&amp;form_token=' . $form_token . '&amp;timestamp=' . $timestamp . '" title="' . $lang_pluginmgr_php['install'] . '">' . cpg_fetch_icon('plugin_install', 0) . '</a>';
                } elseif ($plugin_cpg_version['min_ok'] < 0 || $plugin_cpg_version['max_ok'] < 0) {
                    if (isset($lang_pluginmgr_php['minimum_requirements_not_met']) != TRUE) {
                        $lang_pluginmgr_php['minimum_requirements_not_met'] = 'Minimum requirements not met';
                    }
                    $install_button = '<span title="' . $lang_pluginmgr_php['minimum_requirements_not_met'] . '">' . cpg_fetch_icon('cancel', 0) . '</span>';
                } else {
                    $install_button = '<a href="pluginmgr.php?op=install&amp;p=' . $path . '&amp;form_token=' . $form_token . '&amp;timestamp=' . $timestamp . '" onclick="return confirmVersionMissing(\'' . $safename . '\')" title="' . $lang_pluginmgr_php['install'] . '" >' . cpg_fetch_icon('plugin_mgr', 0) . '</a>';
                }
            } else {
                $install_button = cpg_fetch_icon('blank', 0);
            }
            unset($plugin_cpg_version);
            $delete = cpg_fetch_icon('delete', 0);
            echo <<<EOT
                </table>
            </td>
            <td class="{$row_style_class}" valign="top">
                <table border="0" width="100%" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="5%" align="center" valign="top">

                    </td>
                    <td width="5%" align="center" valign="top">
                        {$install_button}
                    </td>
                    <td width="5%" align="center" valign="top">
                        <a href="pluginmgr.php?op=delete&amp;p={$path}&amp;form_token={$form_token}&amp;timestamp={$timestamp}" onclick="return confirmDel('{$safename}')" title="{$lang_common['delete']}">
                            {$delete}
                        </a>
                    </td>
                </tr>
                </table>
            </td>
            </tr>
EOT;
        }
    }
    endtable();
    echo '</form>';
}
コード例 #4
0
ファイル: index.php プロジェクト: CatBerg-TestOrg/coppermine
/**
* list_users()
*
* Get a list of users galleries
*/
function list_users()
{
    global $CONFIG, $PAGE;
    global $lang_list_users, $template_user_list_info_box, $cpg_udb;
    $user_count = 0;
    $rowset = $cpg_udb->list_users_query($user_count);
    if (!$rowset) {
        msg_box($lang_list_users['user_list'], $lang_list_users['no_user_gal'], '', '', 'info');
        return;
    }
    $user_per_page = $CONFIG['thumbcols'] * $CONFIG['thumbrows'];
    $totalPages = ceil($user_count / $user_per_page);
    $user_list = array();
    foreach ($rowset as $user) {
        $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $user['user_id']);
        $user_thumb = '<img src="' . $cpg_nopic_data['thumb'] . '" ' . $cpg_nopic_data['whole'] . ' class="image thumbnail" border="0" alt="" />';
        $user_pic_count = $user['pic_count'];
        $user_thumb_pid = $user['gallery_pid'] ? $user['gallery_pid'] : $user['thumb_pid'];
        $user_album_count = $user['alb_count'];
        if ($user_pic_count) {
            $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$user_thumb_pid}' AND approved='YES'";
            $result = cpg_db_query($sql);
            if ($result->numRows()) {
                $picture = $result->fetchAssoc(true);
                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }
                //thumb cropping
                //$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']);
                if (array_key_exists('system_icon', $picture) && $picture['system_icon'] == true) {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb');
                } else {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], false, 'cat_thumb');
                }
                $user_thumb = "<img src=\"" . $pic_url . "\" class=\"image thumbnail\" {$image_size['geom']} border=\"0\" alt=\"\" />";
            }
        }
        $albums_txt = sprintf($lang_list_users['n_albums'], $user_album_count);
        $pictures_txt = sprintf($lang_list_users['n_pics'], $user_pic_count);
        $params = CPGPluginAPI::filter('user_caption_params', array('{USER_NAME}' => $user['user_name'], '{USER_ID}' => $user['user_id'], '{ALBUMS}' => $albums_txt, '{PICTURES}' => $pictures_txt));
        $caption = template_eval($template_user_list_info_box, $params);
        $user_list[] = array('cat' => FIRST_USER_CAT + $user['user_id'], 'image' => $user_thumb, 'caption' => $caption);
    }
    theme_display_thumbnails($user_list, $user_count, '', '', 1, $PAGE, $totalPages, false, true, 'user');
}
コード例 #5
0
ファイル: pluginmgr.php プロジェクト: phill104/branches
function display_plugin_list()
{
    global $CPG_PLUGINS, $lang_pluginmgr_php, $lang_plugin_php, $lang_common, $CONFIG, $CPG_PHP_SELF;
    $help = '&nbsp;' . cpg_display_help('f=plugins.htm&amp;as=plugin_manager&amp;ae=plugin_manager_end&amp;top=1', '800', '600');
    $help_plugin_enable = cpg_display_help('f=configuration.htm&amp;as=admin_general_enable-plugins&amp;ae=admin_general_enable-plugins_end', 400, 300);
    // configure plugin api (enabled or disabled)
    $yes_selected = $CONFIG['enable_plugins'] ? 'checked="checked"' : '';
    $no_selected = !$CONFIG['enable_plugins'] ? 'checked="checked"' : '';
    print '<form name="pluginenableconfig" id="cpgform2" action="' . $CPG_PHP_SELF . '" method="post" style="margin:0px;padding:0px">';
    starttable('-1', $lang_pluginmgr_php['pmgr'] . $help, 3);
    echo <<<EOT
        <tr>
                <td class="tableh2" colspan="3">
                    {$lang_pluginmgr_php['explanation']}
                </td>
        </tr>
        <tr>
                <td class="tableb">
                    {$lang_pluginmgr_php['plugin_enabled']}
                </td>
                <td class="table">
                    <input type="radio" id="enable_plugins1" name="enable_plugins" value="1"  onclick="document.pluginenableconfig.submit();" {$yes_selected} /><label for="enable_plugins1" class="clickable_option">{$lang_common['yes']}</label>
                    &nbsp;&nbsp;
                    <input type="radio" id="enable_plugins0" name="enable_plugins" value="0"  onclick="document.pluginenableconfig.submit();" {$no_selected} /><label for="enable_plugins0" class="clickable_option">{$lang_common['no']}</label>
                    <input type="hidden" name="update_config" value="1" />
                </td>
                <td class="tableb">
                    {$help_plugin_enable}
                </td>
        </tr>
EOT;
    endtable();
    print '</form>';
    echo <<<EOT
        <br />
EOT;
    $help = '&nbsp;' . cpg_display_help('f=plugins.htm&amp;as=plugin_manager_uninstall&amp;ae=plugin_manager_uninstall_end&amp;top=1', '640', '480');
    $available_plugins = cpg_get_dir_list('./plugins/');
    starttable('100%');
    echo <<<EOT
        <tr>
                <td class="tableh1" width="90%"><strong><span class="statlink">{$lang_pluginmgr_php['i_plugins']}</span></strong></td>
                <td colspan="3" class="tableh1" align="center" width="10%"><strong><span class="statlink">{$lang_pluginmgr_php['operation']}</span></strong>{$help}</td>
        </tr>
EOT;
    $installed_count = 0;
    $loop_counter = 0;
    foreach ($CPG_PLUGINS as $thisplugin) {
        $installed_count++;
        unset($extra_info);
        unset($install_info);
        include './plugins/' . $thisplugin->path . '/configuration.php';
        $pluginPath = $thisplugin->path;
        $safename = addslashes(str_replace('&nbsp;', '', $name));
        if (isset($extra_info) == TRUE) {
            $extra = $extra_info;
        } else {
            $extra = '';
        }
        if (sizeof($thisplugin->error) > 0) {
            $error = $thisplugin->error['desc'];
            $extra = '<tr><td class="tableb" width="100%" colspan="2">' . '<strong>' . $lang_common['error'] . ':</strong> <span style="color:red;">' . $error . '</span>' . '</td></tr>' . $extra;
        }
        if ($loop_counter == 0) {
            $row_style_class = 'tableb';
        } else {
            $row_style_class = 'tableb tableb_alternate';
        }
        $loop_counter++;
        if ($loop_counter > 1) {
            $loop_counter = 0;
        }
        echo <<<EOT
        <tr>
            <td width="90%" class="{$row_style_class}">
                <table border="0" width="100%" cellspacing="0" cellpadding="0" class="maintable">
                    <tr>
                        <td colspan="2" class="tableh1">{$name} ({$pluginPath}): {$lang_pluginmgr_php['vers']}{$version}</td>
                    </tr>
                    <tr>
                        <td class="tableb" width="20%" valign="top">{$lang_pluginmgr_php['extra']}:</td>
                        <td class="tableb" valign="top">{$extra}</td>
                    </tr>
                    <tr>
                        <td class="tableb tableb_alternate" valign="top">{$lang_pluginmgr_php['author']}:</td>
                        <td class="tableb tableb_alternate" valign="top">{$author}</td>
                    </tr>
                    <tr>
                        <td class="tableb" valign="top">{$lang_pluginmgr_php['desc']}</td>
                        <td class="tableb" valign="top">{$description}</td>
                    </tr>
                </table>
            </td>
            <td class="{$row_style_class}" valign="top">
            <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
EOT;
        if ($thisplugin->index > 0 && count($CPG_PLUGINS) > 1) {
            echo <<<EOT
            <td width="3%" align="center" valign="middle">
                <a href="pluginmgr.php?op=moveu&amp;p={$thisplugin->plugin_id}"><img src="images/up.gif"  border="0" alt="" /></a>
            </td>
EOT;
        } else {
            echo '<td width="3%"><img src="images/spacer.gif" width="16" height="16" /></td>';
        }
        if ($thisplugin->index < count($CPG_PLUGINS) - 1) {
            echo <<<EOT
            <td width="3%" align="center" valign="middle">
                <a href="pluginmgr.php?op=moved&amp;p={$thisplugin->plugin_id}"><img src="images/down.gif"  border="0" alt="" /></a>
            </td>
EOT;
        } else {
            echo '<td width="3%"><img src="images/spacer.gif" width="16" height="16" /></td>';
        }
        echo <<<EOT
            <td width="3%" align="center" valign="middle">
                <a href="pluginmgr.php?op=uninstall&amp;p={$thisplugin->plugin_id}" onClick="return confirmUninstall('{$safename}')">
                    <img src="images/delete.gif"  border="0" alt="" />
                </a>
            </td>

        </tr>
        </table>
        </td>
        </tr>
EOT;
    }
    if ($installed_count == 0) {
        echo '<tr><td colspan="4" class="tableb" align="center">' . $lang_pluginmgr_php['none_installed'] . '</td></tr>';
    }
    endtable();
    echo '<p>&nbsp;</p>';
    echo '<form name="cpgform" id="cpgform" action="pluginmgr.php?op=upload" method="post" enctype="multipart/form-data">';
    $help_upload = '&nbsp;' . cpg_display_help('f=plugins.htm&amp;as=plugin_manager_upload&amp;ae=plugin_manager_upload_end&amp;top=1', '640', '480');
    $help_install = '&nbsp;' . cpg_display_help('f=plugins.htm&amp;as=plugin_manager_install&amp;ae=plugin_manager_install_end&amp;top=1', '640', '480');
    starttable('100%');
    echo <<<EOT
        <tr>
                <td class="tableh1" width="90%">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td align="left">
                                <strong><span class="statlink">{$lang_pluginmgr_php['n_plugins']}</span></strong>{$help_install}
                            </td>
                            <td align="right">
                                    <input type="file" size="40" name="plugin" class="textinput" />
                                    <input type="submit" class="button" value="{$lang_pluginmgr_php['upload']}" />
                                    {$help_upload}
                            </td>
                        </tr>
                    </table>
                </td>
                <td colspan="3" class="tableh1" align="center" width="10%"><strong><span class="statlink">{$lang_pluginmgr_php['operation']}</span></strong></td>
        </tr>
EOT;
    $loop_counter = 0;
    foreach ($available_plugins as $path) {
        if (($plugin_id = CPGPluginAPI::installed($path)) === false) {
            // If codebase.php and configuration.php don't exist, skip this folder
            if (!(file_exists('./plugins/' . $path . '/codebase.php') && file_exists('./plugins/' . $path . '/configuration.php'))) {
                continue;
            }
            unset($extra_info);
            unset($install_info);
            include './plugins/' . $path . '/configuration.php';
            $pluginPath = $path;
            $safename = addslashes(str_replace('&nbsp;', '', $name));
            if (isset($install_info) == TRUE) {
                $extra = $install_info;
            } else {
                $extra = '';
            }
            if ($loop_counter == 0) {
                $row_style_class = 'tableb';
            } else {
                $row_style_class = 'tableb tableb_alternate';
            }
            $loop_counter++;
            if ($loop_counter > 1) {
                $loop_counter = 0;
            }
            echo <<<EOT
            <tr>
            <td width="90%" class="{$row_style_class}">
                <table border="0" width="100%" cellspacing="0" cellpadding="0" class="maintable">
                    <tr>
                        <td colspan="2" class="tableh1">{$name} ({$pluginPath}): {$lang_pluginmgr_php['vers']}{$version}</td>
                    </tr>
                    <tr>
                        <td class="tableb tableb_alternate" width="20%" valign="top">{$lang_pluginmgr_php['author']}:</td>
                        <td class="tableb tableb_alternate" valign="top">{$author}</td>
                    </tr>
                    <tr>
                        <td class="tableb" valign="top">{$lang_pluginmgr_php['desc']}:</td>
                        <td class="tableb" valign="top">{$description}</td>
                    </tr>
EOT;
            if ($extra != '') {
                echo <<<EOT
                    <tr>
                        <td class="tableb tableb_alternate" width="20%" valign="top">{$lang_pluginmgr_php['install_info']}:</td>
                        <td class="tableb tableb_alternate" valign="top">{$extra}</td>
                    </tr>
EOT;
            }
            echo <<<EOT
                </table>
            </td>
            <td class="{$row_style_class}" valign="top">
                <table border="0" width="100%" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="5%" align="center" valign="top">
                        <img src="images/spacer.gif" width="16" height="16" />
                    </td>
                    <td width="5%" align="center" valign="top">
                        <a href="pluginmgr.php?op=install&amp;p={$path}"><img src="images/info.gif"  border="0" alt="" /></a>
                    </td>
                    <td width="5%" align="center" valign="top">
                        <a href="pluginmgr.php?op=delete&amp;p={$path}" onClick="return confirmDel('{$safename}')">
                            <img src="images/delete.gif"  border="0" alt="" />
                        </a>
                    </td>
                </tr>
                </table>
            </td>
            </tr>
EOT;
        }
    }
    echo '</form>';
    endtable();
}
コード例 #6
0
ファイル: plugin_api.inc.php プロジェクト: phill104/branches
 /**
  * CPGPluginAPI::uninstall()
  *
  * Uninstalls a plugin and executes 'plugin_uninstall' action
  *
  * @param integer $plugin_id
  * @return N/A
  **/
 function uninstall($plugin_id)
 {
     global $CONFIG, $USER_DATA, $CPG_PLUGINS, $thisplugin, $lang_plugin_api;
     if (!isset($CPG_PLUGINS[$plugin_id])) {
         return true;
     }
     // Grab the plugin from the global scope
     $thisplugin =& $CPG_PLUGINS[$plugin_id];
     // Grab the priority level, so you can shift the ones in the database
     $priority = $thisplugin->priority;
     // If plugin has an uninstall action, execute it
     $uninstalled = CPGPluginAPI::action('plugin_uninstall', true, $plugin_id);
     if (is_bool($uninstalled) && $uninstalled) {
         $sql = 'delete from ' . $CONFIG['TABLE_PLUGINS'] . ' ' . 'where plugin_id=' . $plugin_id . ';';
         $result = cpg_db_query($sql);
         // Shift the plugins up
         $sql = 'update ' . $CONFIG['TABLE_PLUGINS'] . ' set priority=priority-1 where priority>' . $priority . ';';
         $result = cpg_db_query($sql);
         unset($CPG_PLUGINS[$plugin_id]);
         if ($CONFIG['log_mode']) {
             log_write("Plugin '" . $name . "' uninstalled at " . date("F j, Y, g:i a"), CPG_GLOBAL_LOG);
         }
         return true;
         // If $uninstalled is an integer then the plugin needs to be cleaned up; Return the value
     } elseif (is_numeric($uninstalled)) {
         return $uninstalled;
     } else {
         // The plugin's uninstall action failed
         cpg_die(CRITICAL_ERROR, sprintf($lang_plugin_api['error_uninstall'], $thisplugin->name), __FILE__, __LINE__);
     }
 }
コード例 #7
0
ファイル: codebase.php プロジェクト: phill104/branches
function image_manipulation_configure()
{
    global $CONFIG, $CPG_PLUGINS, $lang_plugin_image_manipulation;
    require './plugins/image_manipulation/init.inc.php';
    $icon_array['ok'] = cpg_fetch_icon('ok', 1);
    $icon_array['cancel'] = cpg_fetch_icon('cancel', 1);
    $allow_continue = 1;
    echo <<<EOT
    <form action="" method="post" name="image_manipulation_config" id="image_manipulation_config">
        <ul>
EOT;
    if ($CONFIG['transparent_overlay'] != '0') {
        echo <<<EOT
            <li>{$lang_plugin_image_manipulation['transparent_overlay_warning']}
            {$lang_plugin_image_manipulation['continue_will_disable_warning']}
            {$lang_plugin_image_manipulation['do_not_turn_on_again']}</li>
EOT;
    }
    if (($plugin_id = CPGPluginAPI::installed('mirror')) !== false) {
        $warning_coexist = sprintf($lang_plugin_image_manipulation['plugins_cant_coexist'], '<em>Mirror</em>');
        echo <<<EOT
            <li>{$warning_coexist}</li>
EOT;
        $allow_continue = 0;
    }
    echo <<<EOT
        </ul>
EOT;
    if ($allow_continue == 1) {
        echo <<<EOT
        <input type="hidden" name="image_manipulation_continue_anyway" id="image_manipulation_continue_anyway" value="1" />
        <button type="submit" class="button" name="submit" value="{$lang_plugin_image_manipulation['continue_anyway']}">{$icon_array['ok']}{$lang_plugin_image_manipulation['continue_anyway']}</button>
EOT;
    }
    echo <<<EOT
        <a href="pluginmgr.php" class="admin_menu">{$icon_array['cancel']}{$lang_plugin_image_manipulation['cancel']}</a>
EOT;
    echo <<<EOT
    </form>
EOT;
}
コード例 #8
0
// define some vars that need to exist in JS
set_js_var('lang_warning_dont_submit', $lang_admin_php['warning_dont_submit']);
set_js_var('lang_reset_to_default', $lang_admin_php['reset_to_default']);
set_js_var('lang_no_change_needed', $lang_admin_php['no_change_needed']);
set_js_var('display_reset_boxes', $CONFIG['display_reset_boxes_in_config']);
// Include the JS for admin.php
js_include('js/jquery.spinbutton.js');
js_include('js/admin.js');
$admin_data_array = $CONFIG;
$optionLoopCounter = 0;
$submit_icon = cpg_fetch_icon('ok', 1);
$factory_icon = cpg_fetch_icon('delete', 1);
require_once 'include/admin.inc.php';
// populate the array for the admin data (could later be done using an XML file)
// Filter upload choices to allow plugins to add upload methods
$config_data['user_settings']['upload_mechanism']['options'] = CPGPluginAPI::filter('upload_options', $config_data['user_settings']['upload_mechanism']['options']);
// loop through the config sections and populate the array that determines what sections to expand/collapse
$collapseSections_array = array();
// By default, all sections should be hidden. Let's populate the array first with all existing sections and then later remove the ones that are supposed to be expanded by default
foreach ($config_data as $key => $value) {
    $collapseSections_array[] = $key;
}
$userMessage = '';
//The message that the will be displayed if something went wrong or to tell the user that we had success
$problemFields_array = array();
// we'll add field-wrapper-IDs to this array to visualize that something went wrong. Onload we'll assign the class "important" to the boxes that correspond to the array data
if ($superCage->post->keyExists('restore_config')) {
    // user has chosen to factory-reset the config --- start
    // first we check if the form token is valid
    if (!checkFormToken()) {
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
コード例 #9
0
        } else {
            $user_status = '';
        }
        if ($user_thumb != '') {
            $user_thumb = '<td width="50%" valign="top" align="center">' . '<a href="thumbnails.php?album=lastupby&amp;uid=' . $uid . '">' . '<span class="thumb_title">' . $lang_register_php['last_uploads'] . '<br />' . sprintf($lang_register_php['last_uploads_detail'], $user_data['user_name']) . '<br /></span>' . $user_thumb . '</a></td>';
        }
        $lastComArray = cpgUserLastComment($uid);
        if ($lastComArray['count'] != 0) {
            $lastcom = '<td width="50%" valign="top" align="center">' . '<a href="thumbnails.php?album=lastcomby&amp;uid=' . $uid . '">' . '<span class="thumb_title">' . $lang_register_php['last_comments'] . '<br />' . sprintf($lang_register_php['last_comments_detail'], $user_data['user_name']) . '<br /></span>' . $lastComArray['thumb'] . '</a><br />';
            $lastcom .= "<span class=\"thumb_caption\">" . localised_date($lastComArray['msg_date'], $lang_date['lastcom']) . '</span>' . "<span class=\"thumb_caption\">" . bb_decode(process_smilies($lastComArray['comment'])) . '</span></td>';
        }
        $quick_jump = $user_thumb . $lastcom ? '<table width="100%" border="0" cellspacing="5"><tr>' . $user_thumb . $lastcom . '</tr></table>' : '';
        list($timestamp, $form_token) = getFormToken();
        if ($uid == USER_ID) {
            $adminLink = '<a href="profile.php?op=edit_profile" class="admin_menu">' . $lang_register_php['edit_my_profile'] . '</a>';
        } elseif (GALLERY_ADMIN_MODE) {
            $adminLink = '<a href="usermgr.php?op=edit&user_id=' . $uid . '&form_token=' . $form_token . '&timestamp=' . $timestamp . '" class="admin_menu">' . $icon_array['edit'] . sprintf($lang_register_php['edit_xs_profile'], $user_data['user_name']) . '</a>';
        } else {
            $adminLink = '';
        }
        $form_data = array('username' => $user_data['user_name'], 'status' => $user_status, 'reg_date' => localised_date($user_data['user_regdate'], $lang_date['register']), 'group' => $user_data['group_name'], 'user_profile1' => $user_data['user_profile1'], 'user_profile2' => $user_data['user_profile2'], 'user_profile3' => $user_data['user_profile3'], 'user_profile4' => $user_data['user_profile4'], 'user_profile5' => $user_data['user_profile5'], 'user_profile6' => bb_decode($user_data['user_profile6']), 'user_thumb' => $quick_jump, 'pic_count' => cpgUserPicCount($uid), 'admin_link' => $adminLink);
        $title = sprintf($lang_register_php['x_s_profile'], $user_data['user_name']);
        pageheader($title);
        // Displays the profile of any user
        starttable(-1, cpg_fetch_icon('my_profile', 2) . $title, 2);
        $profile_data = CPGPluginAPI::filter('profile_add_data', array(0 => $display_profile_form_param, 1 => $form_data));
        make_form($display_profile_form_param, $form_data);
        endtable();
        pagefooter();
        break;
}
コード例 #10
0
    <tr>
        <td class="tableb" valign="top" align="right">
            {$lang_contact_php['confirmation']}&nbsp;{$captcha_help}
        </td>
        <td class="tableb" valign="top">
            <span id="captcha_wrapper" class="{$highlightFieldCSS}">
                <input type="text" class="textinput" name="captcha" size="5" maxlength="5" value="" />
            </span>
            <img src="captcha.php" align="middle" border="0" alt="" />
        </td>
        <td class="tableb">
            <span id="captcha_remark" style="display:{$captcha_remark_visibility}">{$captcha_remark}</span>
        </td>
    </tr>
EOT;
    $captcha_print = CPGPluginAPI::filter('captcha_contact_print', $captcha_print);
    print $captcha_print;
}
list($timestamp, $form_token) = getFormToken();
// submit button
print <<<EOT
    <tr>
        <td class="tableb" valign="top" align="right">
            <input type="hidden" name="form_token" value="{$form_token}" />
            <input type="hidden" name="timestamp" value="{$timestamp}" />
        </td>
        <td class="tableb" valign="top" colspan="2">
            <button type="submit" class="button" name="submit" id="submit" value="{$lang_common['go']}">{$icon_array['ok']}{$lang_common['go']}</button>
        </td>
    </tr>
EOT;
コード例 #11
0
ファイル: usermgr.php プロジェクト: phill104/branches
function list_users($search = '')
{
    global $CONFIG, $cpg_udb;
    //, $PHP_SELF;
    global $lang_usermgr_php, $lang_byte_units, $register_date_fmt, $lang_common;
    global $lim_user, $number_of_columns;
    global $USER_DATA;
    $number_of_columns_minus_one = $number_of_columns - 1;
    $sort_codes = array('name_a' => 'user_name ASC', 'name_d' => 'user_name DESC', 'group_a' => 'group_name ASC', 'group_d' => 'group_name DESC', 'reg_a' => 'user_regdate ASC', 'reg_d' => 'user_regdate DESC', 'pic_a' => 'pic_count ASC', 'pic_d' => 'pic_count DESC', 'disku_a' => 'disk_usage ASC', 'disku_d' => 'disk_usage DESC', 'lv_a' => 'user_lastvisit ASC', 'lv_d' => 'user_lastvisit DESC');
    $sort = !isset($_GET['sort']) || !isset($sort_codes[$_GET['sort']]) ? 'reg_d' : $_GET['sort'];
    $tab_tmpl = array('left_text' => '<td width="100%" align="left" valign="middle" class="tableh1_compact" style="white-space: nowrap"><b>' . $lang_usermgr_php['u_user_on_p_pages'] . '</b></td>' . "\n", 'tab_header' => '', 'tab_trailer' => '', 'active_tab' => '<td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="tableb_compact"><b>%d</b></td>', 'inactive_tab' => '<td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="' . $_SERVER['PHP_SELF'] . '?page=%d&amp;sort=' . $sort . '"<b>%d</b></a></td>' . "\n");
    $makereadonly = $CONFIG['bridge_enable'] ? 'style="display:none;" disabled="disabled" ' : '';
    $user_count = $cpg_udb->get_user_count();
    if (!$user_count) {
        cpg_die(CRITICAL_ERROR, $lang_usermgr_php['err_no_users'], __FILE__, __LINE__);
    }
    $user_per_page = 25;
    $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
    $lower_limit = ($page - 1) * $user_per_page;
    $total_pages = ceil($user_count / $user_per_page);
    /*
       * Commented out to support bridge files -Omni
       *
      $sql = "SELECT user_id, user_name, user_email, UNIX_TIMESTAMP(user_regdate) as user_regdate, UNIX_TIMESTAMP(user_lastvisit) as user_lastvisit, user_active, ".
           "COUNT(pid) as pic_count, ROUND(SUM(total_filesize)/1024) as disk_usage, group_name, group_quota ".
           "FROM {$CONFIG['TABLE_USERS']} AS u ".
           "INNER JOIN {$CONFIG['TABLE_USERGROUPS']} AS g ON user_group = group_id ".
           "LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.owner_id = u.user_id ".
           $search.
           "GROUP BY user_id " . "ORDER BY " . $sort_codes[$sort] . " ".
           "LIMIT $lower_limit, $user_per_page";
    */
    $users = $cpg_udb->get_users(array('users_per_page' => $user_per_page, 'lower_limit' => $lower_limit, 'search' => $search, 'sort' => $sort));
    /*
     * Commented out to support bridge files -Omni
     *
     */
    //$result = cpg_db_query($sql);
    $tabs = create_tabs($user_count, $page, $total_pages, $tab_tmpl);
    $lb = "<select name=\"album_listbox\" class=\"listbox\" onChange=\"if(this.options[this.selectedIndex].value) window.location.href='{$_SERVER['PHP_SELF']}?page={$page}&amp;sort='+this.options[this.selectedIndex].value;\">\n";
    foreach ($sort_codes as $key => $value) {
        $selected = $key == $sort ? "SELECTED" : "";
        $lb .= "        <option value=\"" . $key . "\" {$selected}>" . $lang_usermgr_php[$key] . "</option>\n";
    }
    $lb .= "</select>\n";
    echo <<<EOT
<script type="text/javascript" language="javascript">
<!--
function selectAll(d,box) {
  var f = document.editForm;
  for (i = 0; i < f.length; i++) {
    //alert (f[i].name.indexOf(box));
    if (f[i].type == "checkbox" && f[i].name.indexOf(box) >= 0) {
      if (d.checked) {
        f[i].checked = true;
      } else {
        f[i].checked = false;
      }
    }
  }
  if (d.name == "checkAll") {
      document.getElementsByName('checkAll2')[0].checked = document.getElementsByName('checkAll')[0].checked;
  } else {
      document.getElementsByName('checkAll')[0].checked = document.getElementsByName('checkAll2')[0].checked;
  }
}

function selectaction(d,box) {
// check if an action has been selected
  var action = document.editForm.action.value;
  if (action == '') {
    return false;
  }
// check if at least one user has been selected
  var checked_counter = 0;
  var checked_string = '';
  var f = document.editForm;
  for (i = 0; i < f.length; i++) {
    if (f[i].type == "checkbox" && f[i].name.indexOf(box) >= 0) {
      if (f[i].checked) {
        checked_counter = checked_counter + 1;
        if (checked_string == '') {
          checked_string = f[i].name;
        } else {
          checked_string = checked_string + ',' + f[i].name;
        }
      }
    }
  }
  if (checked_counter == 0) {
    document.editForm.action.value = '';
    alert('{$lang_usermgr_php['alert_no_selection']}');
    return false;
  }
  document.editForm.id.value = checked_string;
  document.editForm.new_password.style.display = "none";
  document.editForm.group.style.display = "none";
  document.editForm.go.style.display = "none";
  document.editForm.delete_files.style.display = "none";
  document.editForm.delete_comments.style.display = "none";
  switch(document.editForm.action.value) {
    case "delete":
      document.editForm.delete_files.style.display = "inline";
      document.editForm.delete_comments.style.display = "inline";
      document.editForm.go.style.display = "inline";
    break;
    case "reset_password":
      document.editForm.new_password.style.display = "inline";
      document.editForm.go.style.display = "inline";
    break;
    case "change_group":
      document.editForm.new_password.value = '';
      document.editForm.group.style.display = "inline";
      if (document.editForm.group.value != '') {
      document.editForm.submit();
      }
    break;
    case "add_group":
      document.editForm.new_password.value = '';
      document.editForm.group.style.display = "inline";
      if (document.editForm.group.value != '') {
      document.editForm.submit();
      }
    break;
    default:
      document.editForm.new_password.value = '';
      document.editForm.submit();
    break;
  }
}
-->
</script>
EOT;
    starttable('100%');
    if (isset($_POST['username'])) {
        $search_filter = '<td class="tableh1" align="center">' . $lang_usermgr_php['search_result'] . '&laquo;' . $_POST['username'] . '&raquo;</td>';
    } else {
        $search_filter = '';
    }
    $help = '&nbsp;' . cpg_display_help('f=users.htm&amp;as=user_cp&amp;ae=user_cp_end&amp;top=1', '650', '500');
    echo <<<EOT
        <tr>
            <td colspan="{$number_of_columns}" class="tableh1">
                <table border="0" cellspacing="0" cellpadding="0" width="100%">
                    <tr>
                        <td class="tableh1">
EOT;
    if (!$lim_user) {
        echo '<h2>' . $lang_usermgr_php['user_manager'] . $help . '</h2>';
    } else {
        echo '<h2>' . $lang_usermgr_php['memberlist'] . '</h2>';
    }
    echo <<<EOT
                        </td>
                        {$search_filter}
                        <td class="tableh1" align="right"><b>{$lang_usermgr_php['sort_by']}</b>:
                        {$lb}</td>
                    </tr>
                </table>
            </td>
        </tr>
EOT;
    // Accept header addons
    echo CPGPluginAPI::filter('usermgr_header', '');
    print '<form method="get" action="delete.php" name="editForm" id="cpgform">' . "\n";
    print '<input type="hidden" name="id" value="" />';
    if (!$lim_user) {
        echo <<<EOT

        <tr>
                <td class="tableh1" align="center"><input type="checkbox" {$makereadonly}name="checkAll" onClick="selectAll(this,'u');" class="checkbox" title="{$lang_common['check_uncheck_all']}" /></td>
                <td class="tableh1" colspan="2"><b><span class="statlink">{$lang_usermgr_php['name']}</span></b>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=name_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_a']}" /></a>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=name_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_d']}" /></a>
                </td>
                <td class="tableh1"><b><a href="groupmgr.php" class="statlink">{$lang_usermgr_php['group']}</a></b>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=group_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_a']}" /></a>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=group_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_d']}" /></a>
                </td>
                <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['registered_on']}</span></b>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=reg_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_a']}" /></a>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=reg_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_d']}" /></a>
                </td>
                <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['last_visit']}</span></b>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=lv_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_a']}" /></a>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=lv_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_d']}" /></a>
                </td>
                <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['pictures']}</span></b>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=pic_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_a']}" /></a>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=pic_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_d']}" /></a>
                </td>
                <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['disk_space_used']}</span></b>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=disku_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_a']}" /></a>
                <a href="{$_SERVER['PHP_SELF']}?page={$page}&amp;sort=disku_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_d']}" /></a>
                </td>
                <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['disk_space_quota']}</span></b>
                </td>
        </tr>
EOT;
    } else {
        echo <<<EOT

        <tr>
                <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['name']}</span></b></td>
                <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['group']}</span></b></td>
                <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['registered_on']}</span></b></td>
                <td class="tableh1"><b><span class="statlink">{$lang_usermgr_php['last_visit']}</span></b></td>
                <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['pictures']}</span></b></td>
                <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['disk_space_used']}</span></b></td>
                <td class="tableh1" align="center"><b><span class="statlink">{$lang_usermgr_php['disk_space_quota']}</span></b></td>
        </tr>
EOT;
    }
    $loop_counter = 0;
    foreach ($users as $user) {
        if ($loop_counter == 0) {
            $row_style_class = 'tableb';
        } else {
            $row_style_class = 'tableb tableb_alternate';
        }
        $loop_counter++;
        if ($loop_counter > 1) {
            $loop_counter = 0;
        }
        if ($user['disk_usage'] == '') {
            $user['disk_usage'] = 0;
        }
        if ($user['user_active'] == 'NO') {
            $user['group_name'] = '<i>' . $lang_usermgr_php['inactive'] . '</i>';
        }
        $user['user_regdate'] = localised_date($user['user_regdate'], $register_date_fmt);
        if ($user['user_lastvisit']) {
            $user['user_lastvisit'] = localised_date($user['user_lastvisit'], $register_date_fmt);
        } else {
            $user['user_lastvisit'] = $lang_usermgr_php['never'];
        }
        $usr_link = '<a href="profile.php?uid=' . $user['user_id'] . '">' . $user['user_name'];
        if ($user['pic_count']) {
            $usr_link .= '</a> (<a href="thumbnails.php?album=lastupby&uid=' . $user['user_id'] . '">' . $lang_usermgr_php['latest_upload'] . '</a>)';
        } else {
            $usr_link .= '</a>';
        }
        if (!$lim_user) {
            if ($user['user_id'] == $USER_DATA['user_id']) {
                $profile_link = 'profile.php?op=edit_profile';
                $checkbox_html = '';
            } else {
                $profile_link = $_SERVER['PHP_SELF'] . '?op=edit&user_id=' . $user['user_id'];
                $checkbox_html = '<input name="u' . $user['user_id'] . '" ' . $makereadonly . 'type="checkbox" value="" class="checkbox" />';
            }
            echo <<<EOT
        <tr>
                <td class="{$row_style_class}" align="center">{$checkbox_html}</td>
                <td class="{$row_style_class}">{$usr_link}</td>
                <td class="{$row_style_class}" align="center">
                    <button type="button" class="button" {$makereadonly}onclick="window.location.href ='{$profile_link}';">
                        <img src="images/edit.gif" width="16" height="16" border="0" alt="" title="{$lang_usermgr_php['edit']}" />
                    </button>
                </td>
                <td class="{$row_style_class}">{$user['group_name']}</td>
                <td class="{$row_style_class}">{$user['user_regdate']}</td>
                <td class="{$row_style_class}">{$user['user_lastvisit']}</td>
                <td class="{$row_style_class}" align="right">{$user['pic_count']}</td>
                <td class="{$row_style_class}" align="right">{$user['disk_usage']}&nbsp;{$lang_byte_units[1]}</td>
                <td class="{$row_style_class}" align="right">{$user['group_quota']}&nbsp;{$lang_byte_units[1]}</td>
        </tr>

EOT;
        } else {
            echo <<<EOT
        <tr>
                <td class="{$row_style_class}">{$usr_link}</td>
                <td class="{$row_style_class}">{$user['group_name']}</td>
                <td class="{$row_style_class}">{$user['user_regdate']}</td>
                <td class="{$row_style_class}">{$user['user_lastvisit']}</td>
                <td class="{$row_style_class}" align="right">{$user['pic_count']}</td>
                <td class="{$row_style_class}" align="right">{$user['disk_usage']}&nbsp;{$lang_byte_units[1]}</td>
                <td class="{$row_style_class}" align="right">{$user['group_quota']}&nbsp;{$lang_byte_units[1]}</td>
        </tr>

EOT;
        }
    }
    // while
    //mysql_free_result($result);
    if (!$lim_user) {
        if (isset($_POST['username'])) {
            $search_string_default = 'value="' . $_POST['username'] . '"';
        } else {
            $search_string_default = 'value="' . $lang_usermgr_php['search'] . '" onfocus="this.value=\'\'"';
        }
        $help = cpg_display_help('f=users.htm&as=user_cp_search&ae=user_cp_search_end&top=1', '400', '150');
        echo <<<EOT
        <tr>
                <td class="tablef" align="center"><input type="checkbox" name="checkAll2" {$makereadonly}onClick="selectAll(this,'u');" class="checkbox" title="{$lang_common['check_uncheck_all']}" /></td>
                <td colspan="{$number_of_columns_minus_one}"  class="tablef">
                <table cellpadding="0" cellspacing="0" width="100%" border="0">
                <tr>
                        <td align="left">
                            <select name="action" size="1" class="listbox" {$makereadonly}onchange="return selectaction(this,'u');">
                                <option value="" checked="checked">{$lang_usermgr_php['with_selected']}</option>
                                <option value="delete">{$lang_usermgr_php['delete']}</option>
                                <option value="activate">{$lang_usermgr_php['activate']}</option>
                                <option value="deactivate">{$lang_usermgr_php['deactivate']}</option>
                                <option value="reset_password">{$lang_usermgr_php['reset_password']}</option>
                                <option value="change_group">{$lang_usermgr_php['change_primary_membergroup']}</option>
                                <option value="add_group">{$lang_usermgr_php['add_secondary_membergroup']}</option>
                            </select>
                            <input type="hidden" name="what" value="user"/>
                              <input type="text" name="new_password" value="{$lang_usermgr_php['password']}" size="8" maxlength="8" class="textinput" onfocus="this.value='';" style="display:none" />
                              <select name="group" size="1" class="listbox" style="display:none" onchange="return selectaction(this,'u');">
                                  <option value="">{$lang_usermgr_php['select_group']}</option>

EOT;
        $sql = "SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_name";
        $result = cpg_db_query($sql);
        $group_list = cpg_db_fetch_rowset($result);
        mysql_free_result($result);
        if (isset($element[1])) {
            $sel_group = $user_data[$element[1]];
        } else {
            $sel_group = '';
        }
        $user_group_list = $user_data['user_group_list'] == '' ? ',' . $sel_group . ',' : ',' . $user_data['user_group_list'] . ',' . $sel_group . ',';
        foreach ($group_list as $group) {
            print '                                  <option value="' . $group['group_id'] . '"' . ($group['group_id'] == $sel_group ? ' selected' : '') . '>' . $group['group_name'] . "</option>\n";
        }
        $help_create = '&nbsp;' . cpg_display_help('f=users.htm&amp;as=user_cp_new&amp;ae=user_cp_new_end', '600', '250');
        echo <<<EOT
                              </select>
                            <select name="delete_files" size="1" class="listbox" style="display:none">
                                <option value="no">{$lang_usermgr_php['delete_files_no']}</option>
                                <option value="yes">{$lang_usermgr_php['delete_files_yes']}</option>
                            </select>
                            <select name="delete_comments" size="1" class="listbox" style="display:none">
                                <option value="no">{$lang_usermgr_php['delete_comments_no']}</option>
                                <option value="yes">{$lang_usermgr_php['delete_comments_yes']}</option>
                            </select>
                            <input type="submit" name="go" value="{$lang_usermgr_php['submit']}" class="button" style="display:none" />
                        </td>
                        <td align="center">
                        <a href="{$_SERVER['PHP_SELF']}?op=new_user" {$makereadonly}class="admin_menu">{$lang_usermgr_php['create_new_user']}</a>
                        {$help_create}
                        </td>
                        </form>
                </tr>
                </table>
                </td>
        </tr>
        <tr>
            <td colspan="{$number_of_columns}"  class="tablef" align="center" valign="middle">
                <form method="post" action="{$_SERVER['PHP_SELF']}" name="searchUser" id="cpgform2">
                <input type="text" name="username" class="textinput" {$search_string_default} />
                <input type="submit" name="user_search" value="{$lang_usermgr_php['search_submit']}" class="button" />
                {$help}
                </form>
            </td>
        </tr>
EOT;
    }
    // Accept footer addons for the user manager
    echo CPGPluginAPI::filter('usermgr_footer', '');
    echo <<<EOT
        <tr>
                <td colspan="{$number_of_columns}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                        {$tabs}
                                </tr>
                        </table>
                </td>
        </tr>

EOT;
    endtable();
}
コード例 #12
0
ファイル: db_input.php プロジェクト: JoseCOCA/baudprint
 // Check that the file uploaded has a valid extension
 if (!preg_match("/(.+)\\.(.*?)\\Z/", $picture_name, $matches)) {
     $matches[1] = 'invalid_fname';
     $matches[2] = 'xxx';
 }
 if ($matches[2] == '' || !is_known_filetype($matches)) {
     cpg_die(ERROR, $lang_db_input_php['err_invalid_fext'] . ' ' . $CONFIG['allowed_file_extensions'], __FILE__, __LINE__);
 }
 // Create a unique name for the uploaded file
 $nr = 0;
 $picture_name = $matches[1] . '.' . $matches[2];
 while (file_exists($dest_dir . $picture_name)) {
     $picture_name = $matches[1] . '~' . $nr++ . '.' . $matches[2];
 }
 $uploaded_pic = $dest_dir . $picture_name;
 CPGPluginAPI::action('upload_html_pre_move', $superCage->files->getRaw("/userpicture/tmp_name"));
 // Move the picture into its final location
 // getRaw is safe here since this filename is generated by the server
 if (!move_uploaded_file($superCage->files->getRaw("/userpicture/tmp_name"), $uploaded_pic)) {
     cpg_die(CRITICAL_ERROR, sprintf($lang_db_input_php['err_move'], $picture_name, $dest_dir), __FILE__, __LINE__, true);
 }
 // Change file permission
 chmod($uploaded_pic, octdec($CONFIG['default_file_mode']));
 // Get picture information
 // Check that picture file size is lower than the maximum allowed
 if (filesize($uploaded_pic) > $CONFIG['max_upl_size'] * 1024) {
     @unlink($uploaded_pic);
     cpg_die(ERROR, sprintf($lang_db_input_php['err_imgsize_too_large'], $CONFIG['max_upl_size']), __FILE__, __LINE__);
 } elseif (is_image($picture_name)) {
     $imginfo = cpg_getimagesize($uploaded_pic);
     if ($imginfo == null) {
コード例 #13
0
function cpg_mail($to, $subject, $msg_body = '', $type = 'text/plain', $sender_name = '', $sender_email = '', $msg_body_plaintext = '')
{
    global $CONFIG, $lang_charset, $HTML_SUBST;
    // makeshift plaintext if not set
    if (!$msg_body_plaintext) {
        $msg_body_plaintext = strip_tags($msg_body);
    }
    // convert possible special HTML entities to characters
    $subject = htmlspecialchars_decode($subject, ENT_QUOTES);
    // send mails to ALL admins - not bridged only
    if ($to == 'admin') {
        if (UDB_INTEGRATION == 'coppermine') {
            $to = array($CONFIG['gallery_admin_email']);
            $result = cpg_db_query("SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_group = 1");
            while ($row = mysql_fetch_assoc($result)) {
                if (!empty($row['user_email'])) {
                    $to[] = $row['user_email'];
                }
            }
            $to = array_unique($to);
        } else {
            $to = array($CONFIG['gallery_admin_email']);
        }
    } else {
        $to = array($to);
    }
    $to = CPGPluginAPI::filter('cpg_mail_to_email', $to);
    if ($sender_name == '') {
        $sender_name = $CONFIG['gallery_name'];
    }
    if ($sender_email == '') {
        $sender_email = $CONFIG['gallery_admin_email'];
    }
    $sender_email = CPGPluginAPI::filter('cpg_mail_sender_email', $sender_email);
    $sender_name = strtr($sender_name, array_flip($HTML_SUBST));
    $charset = $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'];
    $mail = new cpg_PHPmailer();
    if ($CONFIG['smtp_host']) {
        $mail->IsSMTP();
        $mail->Host = $CONFIG['smtp_host'];
        if ($CONFIG['smtp_username']) {
            $mail->SMTPAuth = true;
            $mail->Username = $CONFIG['smtp_username'];
            $mail->Password = $CONFIG['smtp_password'];
        } else {
            $mail->SMTPAuth = false;
        }
    } else {
        $mail->IsMail();
    }
    $mail->IsHTML(true);
    foreach ($to as $email) {
        $mail->AddAddress($email);
    }
    $mail->From = $sender_email;
    $mail->FromName = $sender_name;
    $mail->Subject = $subject;
    $mail->Body = $msg_body;
    $mail->AltBody = $msg_body_plaintext;
    $mail->CharSet = $charset;
    $mail->Sender = $CONFIG['gallery_admin_email'];
    if ($CONFIG['smtp_host'] && $CONFIG['log_mode'] == CPG_LOG_ALL) {
        $mail->SMTPDebug = 2;
        ob_start();
    }
    $result = $mail->Send();
    if ($CONFIG['smtp_host'] && $CONFIG['log_mode'] == CPG_LOG_ALL) {
        $log = ob_get_clean();
        log_write($log, CPG_MAIL_LOG);
    }
    return $result;
}
コード例 #14
0
ファイル: theme.php プロジェクト: phill104/branches
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date = '')
{
    global $CONFIG, $CURRENT_ALBUM_DATA;
    global $template_thumb_view_title_row, $template_fav_thumb_view_title_row, $lang_thumb_view, $lang_common, $template_tab_display, $template_thumbnail_view, $lang_album_list, $lang_errors;
    $superCage = Inspekt::makeSuperCage();
    static $header = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $row_separator = '';
    static $footer = '';
    static $tabs = '';
    static $spacer = '';
    if ($header == '') {
        $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
        $tabs = template_extract_block($template_thumbnail_view, 'tabs');
        $header = template_extract_block($template_thumbnail_view, 'header');
        $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
        $row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
        $footer = template_extract_block($template_thumbnail_view, 'footer');
        $spacer = template_extract_block($template_thumbnail_view, 'spacer');
    }
    $cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
    $date_link = $date == '' ? '' : '&amp;date=' . $date;
    if ($superCage->get->getInt('uid')) {
        $uid_link = '&amp;uid=' . $superCage->get->getInt('uid');
    } else {
        $uid_link = '';
    }
    $theme_thumb_tab_tmpl = $template_tab_display;
    if ($mode == 'thumb') {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $date_link . $uid_link . '&amp;page=%d'));
    } else {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
    }
    $thumbcols = $CONFIG['thumbcols'];
    $cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';
    $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
    if (!GALLERY_ADMIN_MODE && stripos($template_thumb_view_title_row, 'admin_buttons') !== false) {
        template_extract_block($template_thumb_view_title_row, 'admin_buttons');
    }
    // The sort order options are not available for meta albums
    if ($sort_options) {
        if (GALLERY_ADMIN_MODE) {
            $param = array('{ALBUM_ID}' => $aid, '{CAT_ID}' => $cat > 0 ? $cat : $CURRENT_ALBUM_DATA['category'], '{MODIFY}' => cpg_fetch_icon('modifyalb', 1) . $lang_common['album_properties'], '{PARENT_CAT}' => cpg_fetch_icon('category', 1) . $lang_common['parent_category'], '{EDIT_PICS}' => cpg_fetch_icon('edit', 1) . $lang_common['edit_files'], '{ALBUM_MGR}' => cpg_fetch_icon('alb_mgr', 1) . $lang_common['album_manager']);
        } else {
            $param = array();
        }
        $param['{ALBUM_NAME}'] = $album_name;
        $title = template_eval($template_thumb_view_title_row, $param);
    } elseif ($aid == 'favpics' && $CONFIG['enable_zipdownload'] > 0) {
        //Lots of stuff can be added here later
        $param = array('{ALBUM_NAME}' => $album_name, '{DOWNLOAD_ZIP}' => cpg_fetch_icon('zip', 2) . $lang_thumb_view['download_zip']);
        $title = template_eval($template_fav_thumb_view_title_row, $param);
    } else {
        $title = $album_name;
    }
    if ($mode == 'thumb') {
        starttable('100%', $title, $thumbcols);
    } else {
        starttable('100%');
    }
    echo $header;
    $i = 0;
    global $thumb;
    // make $thumb accessible to plugins
    foreach ($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if ($aid == 'lastalb') {
                $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => $thumb['admin_menu']);
            } else {
                // determine if thumbnail link targets should open in a pop-up
                if ($CONFIG['thumbnail_to_fullsize'] == 1) {
                    // code for full-size pop-up
                    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                        $target = 'javascript:;" onclick="alert(\'' . sprintf($lang_errors['login_needed'], '', '', '', '') . '\');';
                    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                        $target = 'javascript:;" onclick="alert(\'' . sprintf($lang_errors['access_intermediate_only'], '', '', '', '') . '\');';
                    } else {
                        $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int) $thumb['pwidth'] + (int) $CONFIG['fullsize_padding_x']) . ',height=' . ((int) $thumb['pheight'] + (int) $CONFIG['fullsize_padding_y']) . '\');';
                    }
                } elseif ($aid == 'random') {
                    $target = "displayimage.php?pid={$thumb['pid']}{$uid_link}#top_display_media";
                } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
                    $page = cpg_get_comment_page_number($thumb['msg_id']);
                    $page = is_numeric($page) ? "&amp;page={$page}" : '';
                    $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&amp;pid={$thumb['pid']}{$uid_link}&amp;msg_id={$thumb['msg_id']}{$page}#comment{$thumb['msg_id']}";
                } else {
                    $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&amp;pid={$thumb['pid']}{$uid_link}#top_display_media";
                }
                $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => $thumb['admin_menu']);
            }
        } else {
            // mode != 'thumb'
            // Used for mode = 'user' from list_users() in index.php
            $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "index.php?cat={$thumb['cat']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => str_replace('.gif', '.png', $thumb['caption']), '{ADMIN_MENU}' => '');
        }
        // Plugin Filter: allow plugin to modify or add tags to process
        $params = CPGPluginAPI::filter('theme_display_thumbnails_params', $params);
        echo template_eval($thumb_cell, $params);
        if ($i % $thumbcols == 0 && $i < count($thumb_list)) {
            echo $row_separator;
        }
    }
    // foreach $thumb
    unset($thumb);
    // unset $thumb to avoid conflicting with global
    for (; $i % $thumbcols; $i++) {
        echo $empty_cell;
    }
    echo $footer;
    if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols, '{TABS}' => $tabs_html);
        echo template_eval($tabs, $params);
    }
    endtable();
    echo $spacer;
}
コード例 #15
0
ファイル: functions.inc.php プロジェクト: phill104/branches
/**
 * get_pic_url()
 *
 * Return the url for a picture
 *
 * @param array $pic_row
 * @param string $mode
 * @param boolean $system_pic
 * @return string
 **/
function &get_pic_url(&$pic_row, $mode, $system_pic = false)
{
    global $CONFIG, $THEME_DIR;
    static $pic_prefix = array();
    static $url_prefix = array();
    if (!count($pic_prefix)) {
        $pic_prefix = array('thumb' => $CONFIG['thumb_pfx'], 'normal' => $CONFIG['normal_pfx'], 'orig' => $CONFIG['orig_pfx'], 'fullsize' => '');
        $url_prefix = array(0 => $CONFIG['fullpath']);
    }
    $mime_content = cpg_get_type($pic_row['filename']);
    $pic_row = array_merge($pic_row, $mime_content);
    $filepathname = null;
    // Code to handle custom thumbnails
    // If fullsize or normal mode use regular file
    if ($mime_content['content'] != 'image' && $mode == 'normal') {
        $mode = 'fullsize';
    } elseif ($mime_content['content'] != 'image' && $mode == 'thumb' || $system_pic) {
        $thumb_extensions = array('.gif', '.png', '.jpg');
        // Check for user-level custom thumbnails
        // Create custom thumb path and erase extension using filename; Erase filename's extension
        $custom_thumb_path = $url_prefix[$pic_row['url_prefix']] . $pic_row['filepath'] . $pic_prefix[$mode];
        $file_base_name = str_replace('.' . $mime_content['extension'], '', basename($pic_row['filename']));
        // Check for file-specific thumbs
        foreach ($thumb_extensions as $extension) {
            if (file_exists($custom_thumb_path . $file_base_name . $extension)) {
                $filepathname = $custom_thumb_path . $file_base_name . $extension;
                break;
            }
        }
        if (!$system_pic) {
            // Check for extension-specific thumbs
            if (is_null($filepathname)) {
                foreach ($thumb_extensions as $extension) {
                    if (file_exists($custom_thumb_path . $mime_content['extension'] . $extension)) {
                        $filepathname = $custom_thumb_path . $mime_content['extension'] . $extension;
                        break;
                    }
                }
            }
            // Check for content-specific thumbs
            if (is_null($filepathname)) {
                foreach ($thumb_extensions as $extension) {
                    if (file_exists($custom_thumb_path . $mime_content['content'] . $extension)) {
                        $filepathname = $custom_thumb_path . $mime_content['content'] . $extension;
                        break;
                    }
                }
            }
        }
        // Use default thumbs
        if (is_null($filepathname)) {
            // Check for default theme- and global-level thumbs
            $thumb_paths[] = $THEME_DIR . 'images/';
            // Used for custom theme thumbs
            $thumb_paths[] = 'images/';
            // Default Coppermine thumbs
            foreach ($thumb_paths as $default_thumb_path) {
                if (is_dir($default_thumb_path)) {
                    if (!$system_pic) {
                        foreach ($thumb_extensions as $extension) {
                            // Check for extension-specific thumbs
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension;
                                //thumb cropping - if we display a system thumb we calculate the dimension by any and not ex
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                        foreach ($thumb_extensions as $extension) {
                            // Check for media-specific thumbs (movie,document,audio)
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension;
                                //thumb cropping
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                    } else {
                        // Check for file-specific thumbs for system files
                        foreach ($thumb_extensions as $extension) {
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension;
                                //thumb cropping
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                    }
                }
            }
        }
        $filepathname = path2url($filepathname);
    }
    if (is_null($filepathname)) {
        $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']);
    }
    // Added hack:  "&& !isset($pic_row['mode'])" thumb_data filter isn't executed for the fullsize image
    if ($mode == 'thumb' && !isset($pic_row['mode'])) {
        $pic_row['url'] = $filepathname;
        $pic_row['mode'] = $mode;
        $pic_row = CPGPluginAPI::filter('thumb_data', $pic_row);
    } elseif ($mode != 'thumb') {
        $pic_row['url'] = $filepathname;
        $pic_row['mode'] = $mode;
    } else {
        $pic_row['url'] = $filepathname;
    }
    return $pic_row['url'];
}
コード例 #16
0
ファイル: theme.php プロジェクト: phill104/branches
function theme_javascript_head()
{
    global $CONFIG, $JS, $LINEBREAK;
    $return = '';
    // Check if we have any variables being set using set_js_vars function
    $JS['vars']['not_default_theme'] = true;
    if (isset($JS['vars']) && count($JS['vars'])) {
        // Convert the $JS['vars'] array to json object string
        $json_vars = json_encode($JS['vars']);
        // Output the json object
        $return = <<<EOT
<script type="text/javascript">
/* <![CDATA[ */
    var js_vars = {$json_vars};
/* ]]> */
</script>

EOT;
    }
    // Check if we have any js includes
    if (isset($JS['includes']) && count($JS['includes'])) {
        // Bring the jquery core library to the very top of the list
        if (in_array('js/jquery-1.3.2.js', $JS['includes']) == TRUE) {
            $key = array_search('js/jquery-1.3.2.js', $JS['includes']);
            unset($JS['includes'][$key]);
            array_unshift($JS['includes'], 'js/jquery-1.3.2.js');
        }
        $JS['includes'] = CPGPluginAPI::filter('javascript_includes', $JS['includes']);
        // Include all the file which were set using js_include() function
        foreach ($JS['includes'] as $js_file) {
            $return .= '<script type="text/javascript" src="' . $js_file . '"></script>' . $LINEBREAK;
        }
    }
    $return .= <<<EOT

<script language="JavaScript" type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</script>
EOT;
    return $return;
}
コード例 #17
0
ファイル: thumbnails.php プロジェクト: alencarmo/OCF
    if (mysql_num_rows($result)) {
        // This album has a password.
        // Check whether the cookie is set for the current albums password
        if (!empty($_COOKIE[$CONFIG['cookie_name'] . '_albpw'])) {
            $alb_pw = unserialize($_COOKIE[$CONFIG['cookie_name'] . '_albpw']);
            // Check whether the alubm id in the cookie is same as that of the album id send by get
            if (isset($alb_pw[$album]) && ctype_alnum($alb_pw[$album])) {
                $sql = "SELECT aid FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE MD5(alb_password)='{$alb_pw[$album]}' AND aid='{$album}'";
                $result = cpg_db_query($sql);
                if (mysql_num_rows($result)) {
                    $valid = true;
                    //The album password is correct. Show the album details.
                    get_private_album_set();
                }
            }
        }
    } else {
        // Album with no password. Might be a private or normal album. Just set valid as true.
        $valid = true;
    }
}
$META_ALBUM_SET = $ALBUM_SET;
//temporary assignment until we are sure we are keeping the $META_ALBUM_SET functionality.
CPGPluginAPI::filter('post_breadcrumb', null);
if (!$valid) {
    form_albpw();
} else {
    display_thumbnails($album, isset($cat) ? $cat : 0, $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true);
}
pagefooter();
ob_end_flush();
コード例 #18
0
ファイル: topic.php プロジェクト: phill104/branches
 function reply()
 {
     include BASE_DIR . 'include' . DS . 'smilies.inc.php';
     include BASE_DIR . 'include' . DS . 'mailer.inc.php';
     $vars = array();
     $errors = array();
     $authorizer = check_model::getInstance();
     $vars['topic_id'] = $this->validate->get->getInt('id');
     if (!$authorizer->is_topic_id($vars['topic_id'])) {
         cpg_die(ERROR, Lang::item('error.wrong_topic_id'), __FILE__, __LINE__);
     }
     if (!$authorizer->can_reply($vars['topic_id'])) {
         cpg_die(ERROR, Lang::item('error.perm_denied'), __FILE__, __LINE__);
     }
     $vars['nagavitor'] = $this->forum->get_nagavitor();
     $vars['icons'] = $this->forum->get_icons();
     $topic = $this->forum->get_topic_data($vars['topic_id'], 'board_id');
     $messages = $this->forum->get_message($vars['topic_id'], 'subject', 'msg_id asc', '1');
     $data = array('icon' => 'icon1', 'subject' => Lang::item('topic.re') . $messages[0]['subject']);
     if ($this->validate->post->keyExists('submit')) {
         $data = array('topic_id' => $vars['topic_id'], 'icon' => $this->validate->post->getRaw('icon'), 'subject' => $this->validate->post->getEscaped('subject'), 'body' => $this->validate->post->getRaw('body'), 'board_id' => $topic['board_id'], 'poster_time' => time(), 'poster_id' => USER_ID, 'poster_name' => USER_NAME, 'poster_ip' => Config::item('hdr_ip'), 'smileys_enabled' => 1);
         if (Config::item('fr_msg_icons') == 0 && $data['icon'] == '') {
             $data['icon'] = 'icon1';
         }
         if ($data['subject'] == '') {
             $errors[] = Lang::item('error.empty_subject');
         }
         if ($data['icon'] == '') {
             $errors[] = Lang::item('error.no_msg_icon');
         }
         if ($data['body'] == '') {
             $errors[] = Lang::item('error.empty_body');
         }
         if (strlen($data['body']) > Config::item('fr_msg_max_size') && Config::item('fr_msg_max_size')) {
             $data['body'] = substr($data['body'], 0, Config::item('fr_msg_max_size'));
         }
         global $CONFIG;
         if ($CONFIG['comment_captcha'] == 1 || $CONFIG['comment_captcha'] == 2 && !USER_ID) {
             if (!captcha_plugin_enabled('comment')) {
                 global $lang_errors;
                 $superCage = Inspekt::makeSuperCage();
                 require "include/captcha.inc.php";
                 $matches = $superCage->post->getMatched('confirmCode', '/^[a-zA-Z0-9]+$/');
                 if (!$matches[0] || !PhpCaptcha::Validate($matches[0])) {
                     $errors[] = $lang_errors['captcha_error'];
                 }
             } else {
                 CPGPluginAPI::action('captcha_comment_validate', null);
             }
         }
         if (count($errors) == 0) {
             if ($authorizer->double_post()) {
                 cpg_die(ERROR, Lang::item('error.already_post'), __FILE__, __LINE__);
             } else {
                 $msg_id = $this->forum->insert_message($data);
                 // to-do: send notify email
                 $users = $this->forum->get_notify_user('', $vars['topic_id']);
                 foreach ($users as $user) {
                     if ($user['user_id'] == USER_ID) {
                         continue;
                     }
                     $user = $this->forum->get_user_data($user['user_id'], 'user_email');
                     // prepare email
                     $email_subject = Lang::item('topic.topic_reply') . $data['subject'];
                     $email_body = sprintf(Lang::item('topic.notify_email'), Config::item('fr_prefix_url') . 'profile.php?uid=' . USER_ID, USER_NAME, Config::item('fr_prefix_url') . forum::link('message', '', $msg_id), Config::item('fr_prefix_url') . forum::link('message', '', $msg_id), Config::item('fr_prefix_url') . forum::link('topic', 'notify', $vars['topic_id']), Config::item('fr_prefix_url') . forum::link('topic', 'notify', $vars['topic_id']), Config::item('fr_title'));
                     // send mail
                     cpg_mail($user['user_email'], $email_subject, $email_body, 'text/html', Config::item('fr_title'), Config::item('gallery_admin_email'));
                     // set send = 0
                     $this->forum->set_topic_notify($vars['topic_id'], 0, $user['user_id']);
                 }
                 if ($this->validate->post->getInt('notify') === 1) {
                     $this->forum->set_topic_notify($vars['topic_id'], $this->validate->post->getInt('notify'));
                 }
                 if ($this->validate->post->getInt('notify') === 0) {
                     $this->forum->unnotify_topic($vars['topic_id']);
                 }
                 forum::message(Lang::item('common.message'), sprintf(Lang::item('message.new_msg_success'), $data['subject']), 'forum.php?c=message&id=' . $msg_id);
             }
         }
     }
     $vars['errors'] = $errors;
     $vars['form'] = $data;
     $this->view->render('topic/reply', $vars);
 }
コード例 #19
0
ファイル: theme.php プロジェクト: phill104/branches
function theme_html_picture()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
    global $album, $comment_date_fmt, $template_display_media;
    global $lang_display_image_php, $lang_picinfo;
    $pid = $CURRENT_PIC_DATA['pid'];
    $pic_title = '';
    if (!isset($USER['liv']) || !is_array($USER['liv'])) {
        $USER['liv'] = array();
    }
    // Add 1 to hit counter
    if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
        add_hit($pid);
        if (count($USER['liv']) > 4) {
            array_shift($USER['liv']);
        }
        array_push($USER['liv'], $pid);
    }
    if ($CONFIG['thumb_use'] == 'ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width']) {
        // The wierd comparision is because only picture_width is stored
        $condition = true;
    } elseif ($CONFIG['thumb_use'] == 'wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']) {
        $condition = true;
    } elseif ($CONFIG['thumb_use'] == 'any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
        $condition = true;
        //thumb cropping
    } elseif ($CONFIG['thumb_use'] == 'ex' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
        $condition = true;
    } else {
        $condition = false;
    }
    if ($CURRENT_PIC_DATA['title'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
    }
    if ($CURRENT_PIC_DATA['caption'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
    }
    if ($CURRENT_PIC_DATA['keywords'] != '') {
        $pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
    }
    if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
        template_extract_block($template_display_media, 'img_desc');
    } else {
        if (!$CURRENT_PIC_DATA['title']) {
            template_extract_block($template_display_media, 'title');
        }
        if (!$CURRENT_PIC_DATA['caption']) {
            template_extract_block($template_display_media, 'caption');
        }
    }
    $CURRENT_PIC_DATA['menu'] = html_picture_menu();
    //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
    if ($CONFIG['make_intermediate'] && $condition) {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
    } else {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
    }
    //thumb cropping
    $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width'], 'normal');
    $pic_title = '';
    $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
    if ($mime_content['content'] == 'movie' || $mime_content['content'] == 'audio') {
        if ($CURRENT_PIC_DATA['pwidth'] == 0 || $CURRENT_PIC_DATA['pheight'] == 0) {
            $CURRENT_PIC_DATA['pwidth'] = 320;
            // Default width
            // Set default height; if file is a movie
            if ($mime_content['content'] == 'movie') {
                $CURRENT_PIC_DATA['pheight'] = 240;
                // Default height
            }
        }
        $ctrl_offset['mov'] = 15;
        $ctrl_offset['wmv'] = 45;
        $ctrl_offset['swf'] = 0;
        $ctrl_offset['rm'] = 0;
        $ctrl_offset_default = 45;
        $ctrl_height = isset($ctrl_offset[$mime_content['extension']]) ? $ctrl_offset[$mime_content['extension']] : $ctrl_offset_default;
        $image_size['whole'] = 'width="' . $CURRENT_PIC_DATA['pwidth'] . '" height="' . ($CURRENT_PIC_DATA['pheight'] + $ctrl_height) . '"';
    }
    if ($mime_content['content'] == 'image') {
        if (isset($image_size['reduced'])) {
            $imginfo = getimagesize($picture_url);
            $winsizeX = $CURRENT_PIC_DATA['pwidth'] + $CONFIG['fullsize_padding_x'];
            //the +'s are the mysterious FF and IE paddings
            $winsizeY = $CURRENT_PIC_DATA['pheight'] + $CONFIG['fullsize_padding_y'];
            //the +'s are the mysterious FF and IE paddings
            if ($CONFIG['transparent_overlay'] == 1) {
                $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$imginfo[0]}\" height=\"{$imginfo[1]}\" class=\"image\">";
                $pic_html .= "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid={$pid}&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width={$winsizeX},height={$winsizeY}')\">";
                $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
                $pic_html .= "<img src=\"images/image.gif?id=" . floor(rand() * 1000 + rand()) . "\" width={$imginfo[0]} height={$imginfo[1]}  border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
                $pic_html .= "</a>\n </td></tr></table>";
            } else {
                $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid={$pid}&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width={$winsizeX},height={$winsizeY}')\">";
                $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
                $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
                $pic_html .= "</a>\n";
            }
        } else {
            if ($CONFIG['transparent_overlay'] == 1) {
                $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$CURRENT_PIC_DATA['pwidth']}\" height=\"{$CURRENT_PIC_DATA['pheight']}\" class=\"image\">";
                $pic_html .= "<img src=\"images/image.gif?id=" . floor(rand() * 1000 + rand()) . "\" width={$CURRENT_PIC_DATA['pwidth']} height={$CURRENT_PIC_DATA['pheight']} border=\"0\" alt=\"\" /><br />\n";
                $pic_html .= "</td></tr></table>";
            } else {
                $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
            }
        }
    } elseif ($mime_content['content'] == 'document') {
        $pic_thumb_url = get_pic_url($CURRENT_PIC_DATA, 'thumb');
        $pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"" . $pic_thumb_url . "\" border=\"0\" class=\"image\" /></a>\n<br />";
    } else {
        $autostart = $CONFIG['media_autostart'] ? 'true' : 'false';
        $players['WMP'] = array('id' => 'MediaPlayer', 'clsid' => 'classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" ', 'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ', 'mime' => 'type="application/x-mplayer2" ');
        $players['RMP'] = array('id' => 'RealPlayer', 'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ', 'codebase' => '', 'mime' => 'type="audio/x-pn-realaudio-plugin" ');
        $players['QT'] = array('id' => 'QuickTime', 'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ', 'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ', 'mime' => 'type="video/x-quicktime" ');
        $players['SWF'] = array('id' => 'SWFlash', 'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ', 'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ', 'mime' => 'type="application/x-shockwave-flash" ');
        $players['UNK'] = array('id' => 'DefaultPlayer', 'clsid' => '', 'codebase' => '', 'mime' => '');
        if (isset($_COOKIE[$CONFIG['cookie_name'] . '_' . $mime_content['extension'] . 'player'])) {
            $user_player = $_COOKIE[$CONFIG['cookie_name'] . '_' . $mime_content['extension'] . 'player'];
        } else {
            $user_player = $mime_content['player'];
        }
        // There isn't a player selected or user wants client-side control
        if (!$user_player) {
            $user_player = 'UNK';
        }
        $player = $players[$user_player];
        $pic_html = '<object id="' . $player['id'] . '" ' . $player['classid'] . $player['codebase'] . $player['mime'] . $image_size['whole'] . '>';
        $pic_html .= "<param name=\"autostart\" value=\"{$autostart}\" /><param name=\"src\" value=\"" . $picture_url . "\" />";
        $pic_html .= '<embed ' . $image_size['whole'] . ' src="' . $picture_url . '" autostart="' . $autostart . '" ' . $player['mime'] . '></embed>';
        $pic_html .= "</object><br />\n";
    }
    $CURRENT_PIC_DATA['html'] = $pic_html;
    $CURRENT_PIC_DATA['header'] = '';
    $CURRENT_PIC_DATA['footer'] = '';
    $CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data', $CURRENT_PIC_DATA);
    $params = array('{CELL_HEIGHT}' => '100', '{IMAGE}' => $CURRENT_PIC_DATA['header'] . $CURRENT_PIC_DATA['html'] . $CURRENT_PIC_DATA['footer'], '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'], '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']), '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']));
    return template_eval($template_display_media, $params);
}
コード例 #20
0
ファイル: codebase.php プロジェクト: phill104/branches
    function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date = '')
    {
        global $CONFIG;
        global $template_thumb_view_title_row, $template_fav_thumb_view_title_row, $lang_thumb_view, $lang_common, $template_tab_display, $template_thumbnail_view, $lang_album_list, $lang_errors, $lang_main_menu;
        global $REFERER, $lightbox;
        // plugin addition
        $superCage = Inspekt::makeSuperCage();
        static $header = '';
        static $thumb_cell = '';
        static $empty_cell = '';
        static $row_separator = '';
        static $footer = '';
        static $tabs = '';
        static $spacer = '';
        if ($header == '') {
            $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
            $tabs = template_extract_block($template_thumbnail_view, 'tabs');
            $header = template_extract_block($template_thumbnail_view, 'header');
            $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
            $row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
            $footer = template_extract_block($template_thumbnail_view, 'footer');
            $spacer = template_extract_block($template_thumbnail_view, 'spacer');
        }
        $cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
        $date_link = $date == '' ? '' : '&amp;date=' . $date;
        if ($superCage->get->getInt('uid')) {
            $uid_link = '&amp;uid=' . $superCage->get->getInt('uid');
        } else {
            $uid_link = '';
        }
        $theme_thumb_tab_tmpl = $template_tab_display;
        if ($mode == 'thumb') {
            $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
            $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $date_link . $uid_link . '&amp;page=%d'));
        } else {
            $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
            $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
        }
        $thumbcols = $CONFIG['thumbcols'];
        $cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';
        $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
        if (!GALLERY_ADMIN_MODE && stripos($template_thumb_view_title_row, 'admin_buttons') !== false) {
            template_extract_block($template_thumb_view_title_row, 'admin_buttons');
        }
        // The sort order options are not available for meta albums
        if ($sort_options) {
            if (GALLERY_ADMIN_MODE) {
                $param = array('{ALBUM_ID}' => $aid, '{CAT_ID}' => $cat > 0 ? $cat : $cat, '{MODIFY}' => cpg_fetch_icon('modifyalb', 1) . $lang_common['album_properties'], '{PARENT_CAT}' => cpg_fetch_icon('category', 1) . $lang_common['parent_category'], '{EDIT_PICS}' => cpg_fetch_icon('edit', 1) . $lang_common['edit_files'], '{ALBUM_MGR}' => cpg_fetch_icon('alb_mgr', 1) . $lang_common['album_manager']);
            } else {
                $param = array();
            }
            $param['{ALBUM_NAME}'] = $album_name;
            $title = template_eval($template_thumb_view_title_row, $param);
        } elseif ($aid == 'favpics' && $CONFIG['enable_zipdownload'] > 0) {
            //Lots of stuff can be added here later
            $param = array('{ALBUM_NAME}' => $album_name, '{DOWNLOAD_ZIP}' => cpg_fetch_icon('zip', 2) . $lang_thumb_view['download_zip']);
            $title = template_eval($template_fav_thumb_view_title_row, $param);
        } else {
            $title = $album_name;
        }
        // plugin addition
        $lightbox['data']['referrer'] = urldecode($REFERER);
        if ($superCage->post->keyExists('search') && !$superCage->get->keyExists('album')) {
            $lightbox['data']['referrer'] .= "?album=search";
        }
        if (isset($lightbox['data']['activate_favsel'])) {
            echo '<form action="' . $lightbox['data']['referrer'] . '" method="post">';
        }
        if ($mode == 'thumb') {
            starttable('100%', $title, $thumbcols);
        } else {
            starttable('100%');
        }
        echo $header;
        $i = 0;
        global $thumb;
        // make $thumb accessible to plugins
        foreach ($thumb_list as $thumb) {
            $i++;
            if ($mode == 'thumb') {
                if ($aid == 'lastalb') {
                    $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']);
                } elseif ($aid == 'random') {
                    // determine if thumbnail link targets should open in a pop-up
                    if ($CONFIG['thumbnail_to_fullsize'] == 1) {
                        // code for full-size pop-up
                        if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                            $target = 'javascript:;" onClick="alert(\'' . sprintf($lang_errors['login_needed'], '', '', '', '') . '\');';
                        } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                            $target = 'javascript:;" onClick="alert(\'' . sprintf($lang_errors['access_intermediate_only'], '', '', '', '') . '\');';
                        } else {
                            $target = 'javascript:;" onClick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int) $thumb['pwidth'] + (int) $CONFIG['fullsize_padding_x']) . ',height=' . ((int) $thumb['pheight'] + (int) $CONFIG['fullsize_padding_y']) . '\');';
                        }
                    } else {
                        $target = "displayimage.php?pid={$thumb['pid']}{$uid_link}";
                    }
                    $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']);
                } else {
                    // determine if thumbnail link targets should open in a pop-up
                    if ($CONFIG['thumbnail_to_fullsize'] == 1) {
                        // code for full-size pop-up
                        if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                            $target = 'javascript:;" onClick="alert(\'' . sprintf($lang_errors['login_needed'], '', '', '', '') . '\');';
                        } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                            $target = 'javascript:;" onClick="alert(\'' . sprintf($lang_errors['access_intermediate_only'], '', '', '', '') . '\');';
                        } else {
                            $target = 'javascript:;" onClick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int) $thumb['pwidth'] + (int) $CONFIG['fullsize_padding_x']) . ',height=' . ((int) $thumb['pheight'] + (int) $CONFIG['fullsize_padding_y']) . '\');';
                        }
                    } else {
                        $target = "displayimage.php?album={$aid}{$cat_link}{$date_link}&amp;pid={$thumb['pid']}{$uid_link}";
                    }
                    $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => $target, '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => $thumb['admin_menu']);
                }
            } else {
                // mode != 'thumb'
                // Used for mode = 'user' from list_users() in index.php
                $params = array('{CELL_WIDTH}' => $cell_width, '{LINK_TGT}' => "index.php?cat={$thumb['cat']}", '{THUMB}' => $thumb['image'], '{CAPTION}' => $thumb['caption'], '{ADMIN_MENU}' => '');
            }
            // Plugin Filter: allow plugin to modify or add tags to process
            $params = CPGPluginAPI::filter('theme_display_thumbnails_params', $params);
            echo template_eval($thumb_cell, $params);
            if ($i % $thumbcols == 0 && $i < count($thumb_list)) {
                echo $row_separator;
            }
        }
        // foreach $thumb
        unset($thumb);
        // unset $thumb to avoid conflicting with global
        for (; $i % $thumbcols; $i++) {
            echo $empty_cell;
        }
        echo $footer;
        // plugin addition
        if ($lightbox['message'] != '') {
            echo <<<EOT
\t\t<tr>
\t\t\t<td class="tableb" colspan="{$thumbcols}">
\t\t\t\t<div class="cpg_message_info">
\t\t\t\t\t{$lightbox['message']}
\t\t\t\t</div>
\t\t\t</td>
\t\t</tr>
EOT;
        }
        if (isset($lightbox['data']['activate_favkill'])) {
            $confirm = addslashes($lightbox['lang']['Confirm']);
            echo <<<EOT
\t\t<tr>
\t\t\t<td class="tablef" align="center" colspan="{$thumbcols}">
\t\t\t\t<button type="submit" class="button" value="{$lightbox['lang']['Remove selected']}">{$lightbox['icon']['delete']}{$lightbox['lang']['Remove selected']}</button>&nbsp;&nbsp;&nbsp;
\t\t\t\t<button type="submit" class="button" name="clear_favs" value="{$lightbox['lang']['Remove all']}" onclick="return confirm('{$confirm}');">{$lightbox['icon']['delete_all']}{$lightbox['lang']['Remove all']}</button>
\t\t\t</td>
\t\t</tr>
EOT;
        } elseif (isset($lightbox['data']['activate_favsel'])) {
            echo <<<EOT
\t\t<tr>
\t\t\t<td class="tablef" align="center" colspan="{$thumbcols}">
\t\t\t\t<button type="submit" class="button" value="{$lightbox['lang']['Add selected']}" title="{$lightbox['lang']['Add selected files to favorites']}">{$lightbox['icon']['add']}{$lightbox['lang']['Add selected']}</button>&nbsp;
\t\t\t\t<a href="thumbnails.php?album=favpics" title="{$lang_main_menu['fav_title']}" class="admin_menu">{$lightbox['icon']['favorites']}{$lang_main_menu['fav_lnk']}</a>
\t\t\t</td>
\t\t</tr>
EOT;
        }
        if ($display_tabs) {
            $params = array('{THUMB_COLS}' => $thumbcols, '{TABS}' => $tabs_html);
            echo template_eval($tabs, $params);
        }
        endtable();
        // plugin addition
        if (isset($lightbox['data']['activate_favsel'])) {
            echo '</form>';
        }
        echo $spacer;
    }
コード例 #21
0
ファイル: theme.php プロジェクト: phill104/branches
  <!-- END {BLOCK_ID} -->\t
EOT;
    // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}{HREF_ATTRIBUTES}{HREF_CLASS}
    addbutton($sub_menu_buttons, '{CUSTOM_LNK_LNK}', '{CUSTOM_LNK_TITLE}', '{CUSTOM_LNK_TGT}', 'custom_link', $template_sub_menu_spacer, '', "Custom_Lnk");
    addbutton($sub_menu_buttons, '{ALB_LIST_LNK}', '{ALB_LIST_TITLE}', '{ALB_LIST_TGT}', 'album_list', $template_sub_menu_spacer, '', "Alb_List");
    addbutton($sub_menu_buttons, '{LASTUP_LNK}', '{LASTUP_TITLE}', '{LASTUP_TGT}', 'lastup', $template_sub_menu_spacer, 'rel="nofollow"', "LastUpload");
    addbutton($sub_menu_buttons, '{LASTCOM_LNK}', '{LASTCOM_TITLE}', '{LASTCOM_TGT}', 'lastcom', $template_sub_menu_spacer, 'rel="nofollow"', "LastComment");
    addbutton($sub_menu_buttons, '{TOPN_LNK}', '{TOPN_TITLE}', '{TOPN_TGT}', 'topn', $template_sub_menu_spacer, 'rel="nofollow"', "TopN_Lnk");
    addbutton($sub_menu_buttons, '{FAV_LNK}', '{FAV_TITLE}', '{FAV_TGT}', 'favpics', $template_sub_menu_spacer, 'rel="nofollow"', "Favorite");
    addbutton($sub_menu_buttons, '{TOPRATED_LNK}', '{TOPRATED_TITLE}', '{TOPRATED_TGT}', 'toprated', $template_sub_menu_spacer, 'rel="nofollow"', "TopRated");
    addbutton($sub_menu_buttons, '{SEARCH_LNK}', '{SEARCH_TITLE}', '{SEARCH_TGT}', 'search', $template_sub_menu_spacer, '', "Search");
    if ($CONFIG['browse_by_date'] != 0) {
        addbutton($sub_menu_buttons, '{BROWSEBYDATE_LNK}', '{BROWSEBYDATE_TITLE}', '{BROWSEBYDATE_TGT}', 'browse_by_date', $template_sub_menu_spacer, 'rel="nofollow" class="greybox"', "Browse");
    }
    $sub_menu_buttons = CPGPluginAPI::filter('sub_menu', $sub_menu_buttons);
    $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button, $sub_menu_buttons));
    $template_sub_menu = template_eval($template_sub_menu, $params);
}
/******************************************************************************
** Section <<<THEME_HAS_NO_SUB_MENU_BUTTONS>>> - END
******************************************************************************/
/******************************************************************************
** Section <<<$template_gallery_admin_menu>>> - START
******************************************************************************/
//
// Modified by GFY to add drop down/hover buttoms to admin_menu
//
$template_gallery_admin_menu = <<<EOT
<ul class="menu">
<!-- First button without submenus -->\t
コード例 #22
0
ファイル: delete.php プロジェクト: CatBerg-TestOrg/coppermine
function delete_picture($pid, $tablecellstyle = 'tableb')
{
    global $CONFIG, $header_printed, $lang_errors, $lang_delete_php, $LINEBREAK;
    if (!$header_printed) {
        output_table_header();
    }
    $green = cpg_fetch_icon('ok', 0, $lang_delete_php['del_success']);
    $red = cpg_fetch_icon('stop', 0, $lang_delete_php['err_del']);
    // We will be selecting pid in the query as we need it in $pic array for the plugin filter
    if (GALLERY_ADMIN_MODE) {
        $query = "SELECT pid, aid, filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE pid='{$pid}'";
        $result = cpg_db_query($query);
        if (!$result->numRows()) {
            cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        }
        $pic = $result->fetchAssoc(true);
    } else {
        $query = "SELECT pid, p.aid, category, filepath, filename, owner_id FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE pid='{$pid}'";
        $result = cpg_db_query($query);
        if (!$result->numRows()) {
            cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        }
        $pic = $result->fetchAssoc(true);
        if (!($pic['category'] == FIRST_USER_CAT + USER_ID || $CONFIG['users_can_edit_pics'] && $pic['owner_id'] == USER_ID) || !USER_ID) {
            cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
        }
    }
    $aid = $pic['aid'];
    $dir = $CONFIG['fullpath'] . $pic['filepath'];
    $file = $pic['filename'];
    if (!is_writable($dir)) {
        cpg_die(CRITICAL_ERROR, sprintf($lang_errors['directory_ro'], htmlspecialchars($dir)), __FILE__, __LINE__);
    }
    // Plugin filter to be called before deleting a file
    CPGPluginAPI::action('before_delete_file', $pic);
    echo '<tr>';
    echo "<td class=\"" . $tablecellstyle . "\">" . htmlspecialchars($file) . "</td>";
    $files = array($dir . $file, $dir . $CONFIG['normal_pfx'] . $file, $dir . $CONFIG['orig_pfx'] . $file, $dir . $CONFIG['thumb_pfx'] . $file);
    // Check for custom thumbnails for non-images
    if (!is_image($file)) {
        $mime_content = cpg_get_type($file);
        $file_base_name = str_replace('.' . $mime_content['extension'], '', basename($file));
        foreach (array('.gif', '.png', '.jpg') as $thumb_extension) {
            if (file_exists($dir . $CONFIG['thumb_pfx'] . $file_base_name . $thumb_extension)) {
                // Thumbnail found, check if it's the only file using that thumbnail
                $count = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} WHERE filepath = '{$pic['filepath']}' AND filename LIKE '{$file_base_name}.%'")->result(0);
                if ($count == 1) {
                    unset($files[count($files) - 1]);
                    $files[] = $dir . $CONFIG['thumb_pfx'] . $file_base_name . $thumb_extension;
                    break;
                }
            }
        }
    }
    foreach ($files as $currFile) {
        echo "<td class=\"" . $tablecellstyle . "\" align=\"center\">";
        if (is_file($currFile)) {
            if (@unlink($currFile)) {
                echo $green;
            } else {
                echo $red;
            }
        } else {
            echo "&nbsp;";
        }
        echo "</td>";
    }
    $query = "DELETE FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}'";
    cpg_db_query($query);
    echo "<td class=\"" . $tablecellstyle . "\" align=\"center\">";
    if (cpg_db_affected_rows() > 0) {
        echo $green;
    } else {
        echo "&nbsp;";
    }
    echo "</td>";
    $query = "DELETE FROM {$CONFIG['TABLE_EXIF']} WHERE pid = {$pid}";
    cpg_db_query($query);
    $query = "DELETE FROM {$CONFIG['TABLE_PICTURES']} WHERE pid='{$pid}' LIMIT 1";
    cpg_db_query($query);
    echo "<td class=\"" . $tablecellstyle . "\" align=\"center\">";
    if (cpg_db_affected_rows() > 0) {
        echo $green;
    } else {
        echo $red;
    }
    $query = "UPDATE {$CONFIG['TABLE_ALBUMS']} SET thumb = '0' WHERE thumb = '{$pid}'";
    cpg_db_query($query);
    echo '</td>';
    echo '</tr>' . $LINEBREAK;
    // Plugin filter to be called after a file is deleted
    CPGPluginAPI::action('after_delete_file', $pic);
    return $aid;
}
コード例 #23
0
 /**
  * CPGPluginAPI::uninstall()
  *
  * Uninstalls a plugin and executes 'plugin_uninstall' action
  *
  * @param integer $plugin_id
  * @return N/A
  **/
 public static function uninstall($plugin_id)
 {
     global $CONFIG, $USER_DATA, $CPG_PLUGINS, $thisplugin, $lang_plugin_api, $name;
     if (!isset($CPG_PLUGINS[$plugin_id])) {
         return true;
     }
     // Grab the plugin from the global scope
     $thisplugin =& $CPG_PLUGINS[$plugin_id];
     // Grab the priority level, so you can shift the ones in the database
     $priority = $thisplugin->priority;
     // If plugin has an uninstall action, execute it
     $uninstalled = CPGPluginAPI::action('plugin_uninstall', true, $plugin_id);
     if (is_bool($uninstalled) && $uninstalled) {
         $sql = "DELETE FROM {$CONFIG['TABLE_PLUGINS']} WHERE plugin_id = {$plugin_id}";
         $result = cpg_db_query($sql);
         // Shift the plugins up
         $sql = "UPDATE {$CONFIG['TABLE_PLUGINS']} SET priority = priority - 1 WHERE priority > {$priority}";
         $result = cpg_db_query($sql);
         unset($CPG_PLUGINS[$plugin_id]);
         if ($CONFIG['log_mode']) {
             log_write("Plugin '" . $thisplugin->name . "' uninstalled", CPG_GLOBAL_LOG);
         }
         return true;
         // If $uninstalled is an integer then the plugin needs to be cleaned up; Return the value
     } elseif (is_numeric($uninstalled)) {
         return $uninstalled;
     } else {
         // The plugin's uninstall action failed
         cpg_die(CRITICAL_ERROR, sprintf($lang_plugin_api['error_uninstall'], $thisplugin->name), __FILE__, __LINE__);
     }
 }
コード例 #24
0
                <img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_db_ecard_php['ecard_ascending']}" />
            </a>
            &nbsp;
            <a href="{$urlWithoutSort}sort=red">
                <img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_db_ecard_php['ecard_descending']}" />
            </a>
        </th>
    </tr>

EOT;
$tempClass = 'tableb';
$ecard_review_icon = cpg_fetch_icon('ecard_review', 0, $lang_db_ecard_php['ecard_display']);
$result = cpg_db_query("SELECT eid, sender_name, sender_email, recipient_name, recipient_email, link, date, sender_ip FROM {$CONFIG['TABLE_ECARDS']} ORDER BY {$sortBy} {$sortDirection} LIMIT {$startFrom}, {$countTo}");
while ($line = mysql_fetch_assoc($result)) {
    $date = strftime($lang_date['lastcom'], $line['date']);
    list($line['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $line['sender_ip']));
    echo <<<EOT
    <tr>
        <td class="{$tempClass}" align="center">
            <input type="checkbox" name="eid[]" value="{$line['eid']}" id="eidselector" class="checkbox" />
        </td>
        <td class="{$tempClass}">
            <span class="thumb_caption">{$line['sender_name']}</span>
        </td>
        <td class="{$tempClass}">
            <span class="thumb_caption">
                <a href="mailto:{$line['sender_email']}">{$line['sender_email']}</a>
            </span>
        </td>
        <td class="{$tempClass}">
            <span class="thumb_caption">
コード例 #25
0
    $CPG_REFERER = 'index.php';
} else {
    /**
     * Using getRaw() since we are checking the referer in the above if condition.
     */
    $CPG_REFERER = $superCage->get->getRaw('referer');
}
/**
 * CPGPluginAPI::action('page_start',null)
 *
 * Executes page_start action on all plugins
 *
 * @param null
 * @return N/A
 **/
CPGPluginAPI::action('page_start', null);
// load the main template
load_template();
$CONFIG['template_loaded'] = true;
// Remove expired bans
$now = date('Y-m-d H:i:s');
if ($CONFIG['purge_expired_bans'] == 1) {
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_BANNED']} WHERE expiry < '{$now}'");
}
// Check if the user is banned
$user_id = USER_ID;
// Compose the query
$query_string = "SELECT null FROM {$CONFIG['TABLE_BANNED']} WHERE (";
if (USER_ID) {
    $query_string .= "user_id={$user_id} OR ";
}
コード例 #26
0
ファイル: ecard.php プロジェクト: CatBerg-TestOrg/coppermine
EOT;
// captcha code
if ($CONFIG['ecard_captcha'] == 1 || $CONFIG['ecard_captcha'] == 2 && !USER_ID) {
    $help = cpg_display_help('f=empty.htm&amp;h=lang_common[captcha_help_title]&amp;t=lang_common[captcha_help]', 470, 245);
    $captcha_print = <<<EOT
    <tr>
        <td class="tableb">
            {$lang_common['confirm']}&nbsp;{$help}
        </td>
        <td class="tableb" colspan="2">
            <input type="text" name="confirmCode" id="confirmCode" size="5" maxlength="5" class="textinput" />
            <img src="captcha.php" align="middle" border="0" alt="" />
        </td>
</tr>
EOT;
    $captcha_print = CPGPluginAPI::filter('captcha_ecard_print', $captcha_print);
    echo $captcha_print;
}
echo <<<EOT
    <tr>
        <td colspan="3" align="center" class="tablef">
            <button type="submit" class="button" name="preview" id="preview" value="{$lang_ecard_php['preview_button']}">{$icon_array['preview']}{$lang_ecard_php['preview_button']}</button>
            &nbsp;&nbsp;
            <button type="submit" class="button" name="submit" id="submit" value="{$lang_ecard_php['submit_button']}">{$icon_array['ok']}{$lang_ecard_php['submit_button']}</button>
        </td>
    </tr>
EOT;
endtable();
list($timestamp, $form_token) = getFormToken();
echo <<<EOT
<input type="hidden" name="form_token" value="{$form_token}" />
コード例 #27
0
/**
* resize_image()
*
* Create a file containing a resized image
*
* @param  $src_file the source file
* @param  $dest_file the destination file
* @param  $new_size the size of the square within which the new image must fit
* @param  $method the method used for image resizing
* @return 'true' in case of success
*/
function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use, $watermark = "false", $sharpen = 0, $media_type = "false")
{
    global $CONFIG, $ERROR;
    global $lang_errors;
    list($sharpen) = CPGPluginAPI::filter('image_sharpen', array($sharpen, $new_size));
    //Make Cage
    $superCage = Inspekt::makeSuperCage();
    $imginfo = cpg_getimagesize($src_file);
    if ($imginfo == null) {
        return false;
    }
    // GD can only handle JPG & PNG images
    if ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && $CONFIG['GIF_support'] == 0) {
        $ERROR = $lang_errors['gd_file_type_err'];
        //return false;
        return array('error' => $ERROR);
    }
    // height/width
    $srcWidth = $imginfo[0];
    $srcHeight = $imginfo[1];
    $crop = 0;
    // initialize
    // if cropping is enabled calculate cropping parameters
    if ($thumb_use == 'ex') {
        $thb_width = $CONFIG['thumb_width'];
        $thb_height = $CONFIG['thumb_height'];
        if ($new_size == $thb_width) {
            $crop = 1;
            switch ($CONFIG['thumb_method']) {
                //cropping parameters for ImageMagick
                case "im":
                    $resize_commands = "";
                    if ($srcWidth / $srcHeight > $thb_width / $thb_height) {
                        $resize_commands .= "-resize x" . $thb_height;
                        $resized_w = $thb_height / $srcHeight * $srcWidth;
                        $resize_commands .= " -crop " . $thb_width . "x" . $thb_height . "+" . round(($resized_w - $thb_width) / 2) . "+0";
                    } else {
                        $resize_commands .= "-resize " . $thb_width;
                        $resized_h = $thb_width / $srcWidth * $srcHeight;
                        $resize_commands .= " -crop " . $thb_width . "x" . $thb_height . "+0+" . round(($resized_h - $thb_height) / 2);
                    }
                    break;
                    // cropping parameters for GD2
                // cropping parameters for GD2
                default:
                    if ($srcHeight < $srcWidth) {
                        $ratio = (double) ($srcHeight / $thb_height);
                        $cpyWidth = round($thb_width * $ratio);
                        if ($cpyWidth > $srcWidth) {
                            $ratio = (double) ($srcWidth / $thb_width);
                            $cpyWidth = $srcWidth;
                            $cpyHeight = round($thb_height * $ratio);
                            $xOffset = 0;
                            $yOffset = round(($srcHeight - $cpyHeight) / 2);
                        } else {
                            $cpyHeight = $srcHeight;
                            $xOffset = round(($srcWidth - $cpyWidth) / 2);
                            $yOffset = 0;
                        }
                    } else {
                        $ratio = (double) ($srcWidth / $thb_width);
                        $cpyHeight = round($thb_height * $ratio);
                        if ($cpyHeight > $srcHeight) {
                            $ratio = (double) ($srcHeight / $thb_height);
                            $cpyHeight = $srcHeight;
                            $cpyWidth = round($thb_width * $ratio);
                            $xOffset = round(($srcWidth - $cpyWidth) / 2);
                            $yOffset = 0;
                        } else {
                            $cpyWidth = $srcWidth;
                            $xOffset = 0;
                            $yOffset = round(($srcHeight - $cpyHeight) / 2);
                        }
                    }
                    $destWidth = $thb_width;
                    $destHeight = $thb_height;
                    $srcWidth = $cpyWidth;
                    $srcHeight = $cpyHeight;
                    break;
            }
        } else {
            $ratio = max($srcWidth, $srcHeight) / $new_size;
        }
    } elseif ($thumb_use == 'wd') {
        // resize method width
        $ratio = $srcWidth / $new_size;
    } elseif ($thumb_use == 'ht') {
        // resize method height
        $ratio = $srcHeight / $new_size;
    } else {
        // resize method any
        $ratio = max($srcWidth, $srcHeight) / $new_size;
    }
    $ratio = max($ratio, 1.0);
    if ($thumb_use == 'orig') {
        $ratio = 1.0;
    }
    if ($crop != 1) {
        $destWidth = (int) ($srcWidth / $ratio);
        $destHeight = (int) ($srcHeight / $ratio);
        $resize_commands = "-geometry " . $destWidth . "x" . $destHeight;
        $xOffset = 0;
        $yOffset = 0;
    }
    // Method for thumbnails creation
    switch ($method) {
        case "im":
            if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) {
                // get the basedir, remove '/include'
                $cur_dir = substr(dirname(__FILE__), 0, -8);
                $src_file = '"' . $cur_dir . '\\' . strtr($src_file, '/', '\\') . '"';
                $im_dest_file = str_replace('%', '%%', '"' . $cur_dir . '\\' . strtr($dest_file, '/', '\\') . '"');
            } else {
                $src_file = escapeshellarg($src_file);
                $im_dest_file = str_replace('%', '%%', escapeshellarg($dest_file));
            }
            $output = array();
            /*
             * Hack for working with ImageMagick on Windows even if IM is installed in C:\Program Files.
             * By Aditya Mooley <*****@*****.**>
             */
            if ($sharpen == 1 && $CONFIG['enable_unsharp'] == 1) {
                $unsharp_mask = " -unsharp " . $CONFIG['unsharp_radius'] . "x" . sqrt($CONFIG['unsharp_radius']) . "+" . $CONFIG['unsharp_amount'] / 100 . "+" . $CONFIG['unsharp_threshold'] / 100 . " ";
            } else {
                $unsharp_mask = "";
            }
            if ($superCage->env->getMatched('OS', '/win/i')) {
                $cmd = "\"" . str_replace("\\", "/", $CONFIG['impath']) . "convert\" -quality {$CONFIG['jpeg_qual']} {$CONFIG['im_options']} " . $resize_commands . " " . $unsharp_mask . " " . str_replace("\\", "/", $src_file) . " " . str_replace("\\", "/", $im_dest_file);
                exec("\"{$cmd}\"", $output, $retval);
            } else {
                $cmd = "{$CONFIG['impath']}convert -quality {$CONFIG['jpeg_qual']} {$CONFIG['im_options']} " . $resize_commands . " " . $unsharp_mask . " {$src_file} {$im_dest_file}";
                exec($cmd, $output, $retval);
            }
            if ($media_type != "false") {
                //if a manual thumb gets generated we watermark the thumb with the media type
                //we now need to get the absolute path to the thumb watermark files
                $path_parts = pathinfo($CONFIG['watermark_file']);
                $CONFIG['watermark_file'] = $path_parts["dirname"] . "/wm_" . $media_type . ".png";
            }
            if ($watermark == "true" || $media_type != "false") {
                //do we need to resize the watermark to fit onto the intermediate?
                $wm_normal = (int) $CONFIG['reduce_watermark'];
                if ($wm_normal > $destWidth) {
                    $wm_resize = (int) ($destWidth / $wm_normal * 100);
                    //we have to create a temporary, downsized watermark file in the edit folder
                    //temp path for small wm
                    $path_to_tmp_wm = './' . $CONFIG['fullpath'] . 'edit/temp_wm.png';
                    if ($superCage->env->getMatched('OS', '/win/i')) {
                        $cmd = "\"" . str_replace("\\", "/", $CONFIG['impath']) . "convert\" -resize " . $wm_resize . "% " . str_replace("\\", "/", $CONFIG['watermark_file']) . " " . str_replace("\\", "/", $path_to_tmp_wm);
                        exec("\"{$cmd}\"", $output, $retval);
                    } else {
                        $cmd = "{$CONFIG['impath']}convert -resize {$wm_resize}% {$CONFIG['watermark_file']} {$path_to_tmp_wm}";
                        exec($cmd, $output, $retval);
                    }
                    $wm_file = $path_to_tmp_wm;
                    //set the path to the wm file to the temp one
                } else {
                    $wm_file = $CONFIG['watermark_file'];
                    //if no downsize... we take the orig watermark
                }
                // now we apply the watermark
                if ($superCage->env->getMatched('OS', '/win/i')) {
                    $cmd = "\"" . str_replace("\\", "/", $CONFIG['impath']) . "composite\" -dissolve {$CONFIG['watermark_transparency']} -gravity {$CONFIG['where_put_watermark']} \"{$wm_file}\" " . str_replace("\\", "/", $im_dest_file) . " " . str_replace("\\", "/", $im_dest_file);
                    exec("\"{$cmd}\"", $output, $retval);
                } else {
                    $cmd = "{$CONFIG['impath']}composite -dissolve {$CONFIG['watermark_transparency']} -gravity {$CONFIG['where_put_watermark']} {$wm_file} {$im_dest_file} {$im_dest_file}";
                    exec($cmd, $output, $retval);
                }
            }
            if ($retval) {
                $ERROR = "Error executing ImageMagick - Return value: {$retval}";
                if ($CONFIG['debug_mode']) {
                    // Re-execute the command with the backtick operator in order to get all outputs
                    // will not work is safe mode is enabled
                    $output = `{$cmd} 2>&1`;
                    $ERROR .= "<br /><br /><div align=\"left\">Cmd line : <br /><span style=\"font-size:120%\">" . nl2br(htmlspecialchars($cmd)) . "</span></div>";
                    $ERROR .= "<br /><br /><div align=\"left\">The convert program said:<br /><span style=\"font-size:120%\">";
                    $ERROR .= nl2br(htmlspecialchars($output));
                    $ERROR .= "</span></div>";
                }
                @unlink($dest_file);
                return array('error' => $ERROR);
            }
            break;
        case "gd1":
            if (!function_exists('imagecreatefromjpeg')) {
                return array('error' => 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed', 'halt_upload' => 1);
            }
            if ($imginfo[2] == GIS_JPG) {
                $src_img = imagecreatefromjpeg($src_file);
            } else {
                $src_img = imagecreatefrompng($src_file);
            }
            if (!$src_img) {
                $ERROR = $lang_errors['invalid_image'];
                return array('error' => $ERROR);
            }
            $dst_img = imagecreate($destWidth, $destHeight);
            imagecopyresized($dst_img, $src_img, 0, 0, $xOffset, $yOffset, (int) $destWidth, (int) $destHeight, $srcWidth, $srcHeight);
            touch($dest_file);
            $fh = fopen($dest_file, 'w');
            fclose($fh);
            imagejpeg($dst_img, $dest_file, $CONFIG['jpeg_qual']);
            imagedestroy($src_img);
            imagedestroy($dst_img);
            break;
        case "gd2":
            if (!function_exists('imagecreatefromjpeg')) {
                return array('error' => 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed', 'halt_upload' => 1);
            }
            if (!function_exists('imagecreatetruecolor')) {
                return array('error' => 'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the admin page', 'halt_upload' => 1);
            }
            if ($imginfo[2] == GIS_GIF && $CONFIG['GIF_support'] == 1) {
                $src_img = imagecreatefromgif($src_file);
            } elseif ($imginfo[2] == GIS_JPG) {
                $src_img = imagecreatefromjpeg($src_file);
            } else {
                $src_img = imagecreatefrompng($src_file);
            }
            if (!$src_img) {
                $ERROR = $lang_errors['invalid_image'];
                //return false;
                return array('error' => $ERROR);
            }
            if ($imginfo[2] == GIS_GIF) {
                $dst_img = imagecreate($destWidth, $destHeight);
            } else {
                $dst_img = imagecreatetruecolor($destWidth, $destHeight);
                if ($imginfo[2] == GIS_PNG) {
                    imagealphablending($dst_img, false);
                }
            }
            imagecopyresampled($dst_img, $src_img, 0, 0, $xOffset, $yOffset, (int) $destWidth, (int) $destHeight, $srcWidth, $srcHeight);
            touch($dest_file);
            $fh = fopen($dest_file, 'w');
            fclose($fh);
            //sharpen the thumb
            if ($sharpen == 1 && $CONFIG['enable_unsharp'] == 1) {
                UnsharpMask($dst_img, $CONFIG['unsharp_amount'], $CONFIG['unsharp_radius'], $CONFIG['unsharp_threshold']);
            }
            if ($media_type != "false") {
                //if a manual thumb gets generated we watermark the thumb with the media type
                //we now need to get the absolute path to the thumb watermark files
                $path_parts = pathinfo($CONFIG['watermark_file']);
                $CONFIG['watermark_file'] = $path_parts["dirname"] . "/wm_" . $media_type . ".png";
            }
            if ($watermark == "true" || $media_type != "false") {
                //shrink watermark on intermediate images -> If I had known that this is that �%&# with the transparency preserve... grrr
                $wm_normal = (int) $CONFIG['reduce_watermark'];
                if ($wm_normal > $destWidth) {
                    $wm_resize = $destWidth / $wm_normal;
                    //load the original, huge sized logo (the one we want to size down)
                    $temp_logoImage = ImageCreateFromPNG($CONFIG['watermark_file']);
                    //get it's size
                    $temp_logoW = ImageSX($temp_logoImage);
                    $temp_logoH = ImageSY($temp_logoImage);
                    //calculate new size
                    $logoW = (int) ($temp_logoW * $wm_resize);
                    $logoH = (int) ($temp_logoH * $wm_resize);
                    //we create a new, resized logo
                    $logoImage = imagecreatetruecolor($logoW, $logoH);
                    //just to be sure that transparency gets preserved
                    imagealphablending($logoImage, FALSE);
                    imagealphablending($temp_logoImage, TRUE);
                    //now copy and resize the big one into the temp resized img
                    imagecopyresampled($logoImage, $temp_logoImage, 0, 0, 0, 0, (int) $logoW, (int) $logoH, $temp_logoW, $temp_logoH);
                    //we do not need the temp (huge) watermark anymore
                    imagedestroy($temp_logoImage);
                } else {
                    // shrink not enabled or no intermediate...
                    $logoImage = ImageCreateFromPNG($CONFIG['watermark_file']);
                    $logoW = ImageSX($logoImage);
                    $logoH = ImageSY($logoImage);
                }
                //where is the watermark displayed...
                $pos = $CONFIG['where_put_watermark'];
                if ($pos == "northwest") {
                    $src_x = 5;
                    $src_y = 5;
                } else {
                    if ($pos == "northeast") {
                        $src_x = $destWidth - ($logoW + 5);
                        $src_y = 5;
                    } else {
                        if ($pos == "southwest") {
                            $src_x = 5;
                            $src_y = $destHeight - ($logoH + 5);
                        } else {
                            if ($pos == "southeast") {
                                $src_x = $destWidth - ($logoW + 5);
                                $src_y = $destHeight - ($logoH + 5);
                            } else {
                                if ($pos == "center") {
                                    $src_x = $destWidth / 2 - $logoW / 2;
                                    $src_y = $destHeight / 2 - $logoH / 2;
                                }
                            }
                        }
                    }
                }
                imagealphablending($dst_img, TRUE);
                imagecolortransparent($logoImage, imagecolorat($logoImage, $CONFIG['watermark_transparency_featherx'], $CONFIG['watermark_transparency_feathery']));
                ImageCopy($dst_img, $logoImage, $src_x, $src_y, 0, 0, $logoW, $logoH);
            }
            if ($imginfo[2] == GIS_PNG) {
                imagesavealpha($dst_img, true);
                imagepng($dst_img, $dest_file, round((100 - $CONFIG['jpeg_qual']) / 10));
            } else {
                imagejpeg($dst_img, $dest_file, $CONFIG['jpeg_qual']);
            }
            imagedestroy($src_img);
            imagedestroy($dst_img);
            break;
    }
    // Set mode of uploaded picture
    @chmod($dest_file, octdec($CONFIG['default_file_mode']));
    //silence the output in case chmod is disabled
    // We check that the image is valid
    $imginfo = cpg_getimagesize($dest_file);
    if ($imginfo == null) {
        $ERROR = $lang_errors['resize_failed'];
        @unlink($dest_file);
        //return false;
        return array('error' => $ERROR);
    } else {
        return true;
    }
}
コード例 #28
0
function theme_display_fullsize_pic()
{
    global $CONFIG, $THEME_DIR, $FORBIDDEN_SET, $LINEBREAK, $pid;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;
    $superCage = Inspekt::makeSuperCage();
    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
        printf($lang_errors['login_needed'], '', '', '', '');
        die;
    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
        printf($lang_errors['access_intermediate_only'], '', '', '', '');
        die;
    }
    if ($superCage->get->keyExists('picfile')) {
        if (!GALLERY_ADMIN_MODE) {
            cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
        }
        //$picfile = $_GET['picfile'];
        //$picfile = $superCage->get->getPath('picfile'); // doesn't work with HTML entities
        $matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z~ \\/_.-]+$/');
        $picfile = $matches[0];
        $picname = $CONFIG['fullpath'] . $picfile;
        $imagesize = @getimagesize($picname);
        $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]);
    } elseif ($pid) {
        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE pid='{$pid}' {$FORBIDDEN_SET}";
        $result = cpg_db_query($sql);
        if (!mysql_num_rows($result)) {
            cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        }
        $row = mysql_fetch_assoc($result);
        if (is_image($row['filename'])) {
            $pic_url = get_pic_url($row, 'fullsize');
            $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"';
            $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom);
        } else {
            $pic_html = theme_html_picture();
            if (is_movie($row['filename'])) {
                $mime_content = cpg_get_type($row['filename']);
                $ctrl_offset['mov'] = 15;
                $ctrl_offset['wmv'] = 45;
                $ctrl_offset['swf'] = 0;
                $ctrl_offset['rm'] = 0;
                $ctrl_offset_default = 45;
                $ctrl_height = isset($ctrl_offset[$mime_content['extension']]) ? $ctrl_offset[$mime_content['extension']] : $ctrl_offset_default;
                preg_match('/width="([0-9]+)".*height="([0-9]+)"/', $pic_html, $matches);
                $width = $matches[1] + $CONFIG['fullsize_padding_x'];
                $height = $matches[2] + $CONFIG['fullsize_padding_y'] + $ctrl_height;
                $resize_window = '<script type="text/javascript">window.resizeTo(' . $width . ', ' . $height . ')</script>';
            }
            preg_match('/<td align="center" style="{SLIDESHOW_STYLE}">.*(.*)<\\/td>/Us', $pic_html, $matches);
            $pic_html = $matches[1] . $resize_window;
        }
    }
    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2 || USER_ID && USER_ACCESS_LEVEL <= 2) {
        // adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message
        $row['pwidth'] = 200;
        $row['pheight'] = 100;
    }
    $charset = $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'];
    $fullsize_html = <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset={$charset}" />
        <title>{$CONFIG['gallery_name']}: {$lang_fullsize_popup['click_to_close']}</title>
        <style type="text/css">
            body { margin: 0; padding: 0; background-color: gray; }
            img { margin:0; padding:0; border:0; }
            #content { margin:0 auto; padding:0; border:0; }
            table { border:0; width:{$row['pwidth']}px; height:{$row['pheight']}px; border-collapse:collapse}
            td { vertical-align: middle; text-align:center; }
        </style>

        <script type="text/javascript" src="js/jquery-1.4.2.js"></script>
        <script type="text/javascript" src="js/jquery.dimensions.pack.js"></script>
        <script type="text/javascript" src="js/displayimage.fullsize.js"></script>
    </head>
    <body style="margin:0px; padding:0px; background-color: gray;">

EOT;
    if ($pic_html) {
        $fullsize_html .= $pic_html;
    } else {
        if ($CONFIG['transparent_overlay'] == 1) {
            $fullsize_html .= <<<EOT
            <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;">
                <tr>

EOT;
            $fullsize_html .= '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">';
            $fullsize_html .= '<div id="content">';
            $fullsize_html .= '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id=' . floor(rand() * 1000 + rand()) . '&amp;fullsize=yes" ' . $imagedata['geometry'] . ' alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . $LINEBREAK . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . $LINEBREAK;
            $fullsize_html .= <<<EOT
                        </div>
                    </td>
                </tr>
            </table>

EOT;
        } else {
            $fullsize_html .= '        <div id="content">' . $LINEBREAK;
            $fullsize_html .= '<a href="javascript: window.close()"><img src="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' id="fullsize_image" alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . $LINEBREAK . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . $LINEBREAK . '        </div>' . $LINEBREAK;
        }
    }
    $fullsize_html .= <<<EOT
  </body>
</html>

EOT;
    $fullsize_html = CPGPluginAPI::filter('fullsize_html', $fullsize_html);
    echo $fullsize_html;
}
コード例 #29
0
function list_users($search = '')
{
    global $CONFIG, $cpg_udb, $CPG_PHP_SELF, $LINEBREAK;
    //, $PHP_SELF;
    global $lang_usermgr_php, $lang_byte_units, $lang_date, $lang_common, $icon_array;
    global $lim_user, $number_of_columns, $template_tab_display;
    global $USER_DATA;
    $superCage = Inspekt::makeSuperCage();
    list($timestamp, $form_token) = getFormToken();
    $number_of_columns_minus_one = $number_of_columns - 1;
    $number_of_columns_minus_three = $number_of_columns - 3;
    $number_of_columns_minus_four = $number_of_columns - 4;
    $sort_codes = array('name_a' => 'user_name ASC', 'name_d' => 'user_name DESC', 'group_a' => 'group_name ASC', 'group_d' => 'group_name DESC', 'reg_a' => 'user_regdate ASC', 'reg_d' => 'user_regdate DESC', 'pic_a' => 'pic_count ASC', 'pic_d' => 'pic_count DESC', 'disku_a' => 'disk_usage ASC', 'disku_d' => 'disk_usage DESC', 'lv_a' => 'user_lastvisit ASC', 'lv_d' => 'user_lastvisit DESC');
    $sort = 'reg_d';
    if ($superCage->get->keyExists('sort') && ($matches = $superCage->get->getMatched('sort', '/^[a-z_]+$/'))) {
        if ($sort_codes[$matches[0]]) {
            $sort = $matches[0];
        }
    }
    $makereadonly = $CONFIG['bridge_enable'] ? 'style="display:none;" disabled="disabled" ' : '';
    $user_count = $cpg_udb->get_user_count();
    if (!$user_count) {
        cpg_die(CRITICAL_ERROR, $lang_usermgr_php['err_no_users'], __FILE__, __LINE__);
    }
    $user_per_page = 25;
    $page = $superCage->get->testInt('page') ? $superCage->get->getInt('page') : 1;
    $lower_limit = ($page - 1) * $user_per_page;
    $lower_limit = ($page - 1) * $user_per_page;
    $username = '';
    if ($search) {
        $username = '******' . $search;
        $users_search = $cpg_udb->get_users(array('users_per_page' => $user_count, 'lower_limit' => 0, 'search' => $search, 'sort' => $sort));
        $user_count = count($users_search);
    }
    $tab_tmpl = $template_tab_display;
    $tab_tmpl['page_link'] = strtr($tab_tmpl['page_link'], array('{LINK}' => 'usermgr.php?sort=' . $sort . '&amp;page=%d' . $username));
    $tab_tmpl['left_text'] = strtr($tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_usermgr_php['u_user_on_p_pages']));
    $users = $cpg_udb->get_users(array('users_per_page' => $user_per_page, 'lower_limit' => $lower_limit, 'search' => $search, 'sort' => $sort));
    $total_pages = ceil($user_count / $user_per_page);
    $tabs = create_tabs($user_count, $page, $total_pages, $tab_tmpl);
    $lb = '<span id="album_listbox_wrapper" style="display:none">';
    $lb .= $lang_usermgr_php['sort_by'] . ': ';
    $lb .= "<select name=\"album_listbox\" id=\"album_listbox\" class=\"listbox\" onchange=\"if(this.options[this.selectedIndex].value) window.location.href='{$CPG_PHP_SELF}?page={$page}&amp;sort='+this.options[this.selectedIndex].value;\">" . $LINEBREAK;
    foreach ($sort_codes as $key => $value) {
        $selected = $key == $sort ? 'selected="selected"' : "";
        $lb .= '        <option value="' . $key . '" ' . $selected . '>' . $lang_usermgr_php[$key] . '</option>' . $LINEBREAK;
    }
    $lb .= '</select>' . $LINEBREAK;
    $lb .= '</span>' . $LINEBREAK;
    echo <<<EOT
<script type="text/javascript" language="javascript">
<!--

function selectaction(d,box) {
// check if an action has been selected
  var action = document.editForm.action.value;
  if (action == '') {
    return false;
  }
// check if at least one user has been selected
  var checked_counter = 0;
  var checked_string = '';
  var f = document.editForm;
  for (i = 0; i < f.length; i++) {
    if (f[i].type == "checkbox" && f[i].name.indexOf(box) >= 0) {
      if (f[i].checked) {
        checked_counter = checked_counter + 1;
        if (checked_string == '') {
          checked_string = f[i].name;
        } else {
          checked_string = checked_string + ',' + f[i].name;
        }
      }
    }
  }
  if (checked_counter == 0) {
    document.editForm.action.value = '';
    alert('{$lang_usermgr_php['alert_no_selection']}');
    return false;
  }
  document.editForm.id.value = checked_string;
  document.editForm.new_password.style.display = "none";
  document.editForm.group.style.display = "none";
  document.editForm.go.style.display = "none";
  document.editForm.delete_files.style.display = "none";
  document.editForm.delete_comments.style.display = "none";
  switch(document.editForm.action.value) {
    case "delete":
      document.editForm.delete_files.style.display = "inline";
      document.editForm.delete_comments.style.display = "inline";
      document.editForm.go.style.display = "inline";
    break;
    case "reset_password":
      document.editForm.new_password.style.display = "inline";
      document.editForm.go.style.display = "inline";
    break;
    case "change_group":
      document.editForm.new_password.value = '';
      document.editForm.group.style.display = "inline";
      if (document.editForm.group.value != '') {
      document.editForm.submit();
      }
    break;
    case "add_group":
      document.editForm.new_password.value = '';
      document.editForm.group.style.display = "inline";
      if (document.editForm.group.value != '') {
      document.editForm.submit();
      }
    break;
    default:
      document.editForm.new_password.value = '';
      document.editForm.submit();
    break;
  }
}
addonload("show_section('album_listbox_wrapper')");
addonload("show_section('checkAll')");
addonload("show_section('checkAll2')");
addonload("show_section('action')");
-->
</script>
EOT;
    echo '<form method="get" action="delete.php" name="editForm" id="cpgform">';
    if ($superCage->post->keyExists('username')) {
        $search_filter = '<td align="center">' . $lang_usermgr_php['search_result'] . $superCage->post->getEscaped('username') . '</td>';
    } else {
        $search_filter = '';
    }
    $help = '&nbsp;' . cpg_display_help('f=users.htm&amp;as=user_cp&amp;ae=user_cp_end&amp;top=1', '650', '500');
    $usermgr_table_header = <<<EOT
                <input type="hidden" name="id" value="" />
                <table border="0" cellspacing="0" cellpadding="0" width="100%">
                    <tr>
                        <td>
EOT;
    if (!$lim_user) {
        $usermgr_table_header .= cpg_fetch_icon('user_mgr', 2) . $lang_usermgr_php['user_manager'] . $help;
    } else {
        $usermgr_table_header .= cpg_fetch_icon('user_mgr', 2) . $lang_usermgr_php['memberlist'];
    }
    $usermgr_table_header .= <<<EOT
                        </td>
                        {$search_filter}
                        <td class="sortorder_options" align="right">
                            {$lb}
                        </td>
                    </tr>
                </table>
EOT;
    starttable('100%', $usermgr_table_header, $number_of_columns);
    // Accept header addons
    echo CPGPluginAPI::filter('usermgr_header', '');
    if ($CONFIG['user_manager_hide_file_stats']) {
        $pictures_quota_header = '';
    } else {
        $pictures_quota_header = <<<EOT
                <td class="tableh1" align="center">
                    <span class="statlink">{$lang_usermgr_php['pictures']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=pic_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=pic_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_d']}" /></a>
                </td>
                <td class="tableh1" align="center">
                    <span class="statlink">{$lang_usermgr_php['disk_space_used']}/{$lang_usermgr_php['disk_space_quota']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=disku_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=disku_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_d']}" /></a>
                </td>
EOT;
    }
    if (!$lim_user) {
        echo <<<EOT

        <tr>
                <td class="tableh1" align="center">
                    <input type="checkbox" {$makereadonly}name="checkAll" id="checkAll" onclick="selectAll('cpgform');" class="checkbox" title="{$lang_common['check_uncheck_all']}" style="display:none" />
                </td>
                <td class="tableh1" colspan="2">
                    <span class="statlink">{$lang_usermgr_php['name']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=name_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=name_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_d']}" /></a>
                </td>
                <td class="tableh1" align="center">
                    <span class="statlink">{$lang_usermgr_php['status']}</span>
                </td>
                <td class="tableh1">
                    <span class="statlink"><a href="groupmgr.php" class="statlink">{$lang_usermgr_php['group']}</a></span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=group_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=group_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_d']}" /></a>
                </td>
                <td class="tableh1">
                    <span class="statlink">{$lang_usermgr_php['registered_on']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=reg_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=reg_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_d']}" /></a>
                </td>
                <td class="tableh1">
                    <span class="statlink">{$lang_usermgr_php['last_visit']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=lv_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=lv_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_d']}" /></a>
                </td>
                <td class="tableh1" align="center">
                    <span class="statlink">{$lang_usermgr_php['comments']}</span>
                </td>
                {$pictures_quota_header}
        </tr>
EOT;
    } else {
        echo <<<EOT

        <tr>
                <td class="tableh1" colspan="2">
                    <span class="statlink">{$lang_usermgr_php['name']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=name_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=name_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_d']}" /></a>
                </td>
                <td class="tableh1" align="center">
                    <span class="statlink">{$lang_usermgr_php['status']}</span>
                </td>
                <td class="tableh1"><span class="statlink">{$lang_usermgr_php['group']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=group_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=group_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_d']}" /></a>
                </td>
                <td class="tableh1">
                    <span class="statlink">{$lang_usermgr_php['registered_on']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=reg_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=reg_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_d']}" /></a>
                </td>
                <td class="tableh1">
                    <span class="statlink">{$lang_usermgr_php['last_visit']}</span>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=lv_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_a']}" /></a>
                    <a href="{$CPG_PHP_SELF}?page={$page}&amp;sort=lv_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_d']}" /></a>
                </td>
                <td class="tableh1" align="center">
                    <span class="statlink">{$lang_usermgr_php['comments']}</span>
                </td>
                {$pictures_quota_header}
        </tr>
EOT;
    }
    $loop_counter = 0;
    // query total number of files uploaded
    $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} LIMIT 1");
    $tempPicCount = mysql_fetch_array($result);
    $totalPictureCount = $tempPicCount[0];
    $totalPictureCount_fmt = cpg_float2decimal($totalPictureCount);
    mysql_free_result($result);
    unset($tempPicCount);
    // query total space used
    $result = cpg_db_query("SELECT SUM(total_filesize) FROM {$CONFIG['TABLE_PICTURES']} LIMIT 1");
    $tempSpaceCount = mysql_fetch_array($result);
    $totalSpaceCount = $tempSpaceCount[0];
    $totalSpaceCount_fmt = cpg_format_bytes($totalSpaceCount);
    mysql_free_result($result);
    unset($tempSpaceCount);
    // query total number of comments posted
    $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} LIMIT 1");
    $tempCommentCount = mysql_fetch_array($result);
    $totalCommentCount = $tempCommentCount[0];
    $totalCommentCount_fmt = cpg_float2decimal($totalCommentCount);
    mysql_free_result($result);
    unset($tempCommentCount);
    foreach ($users as $user) {
        if ($loop_counter == 0) {
            $row_style_class = 'tableb';
        } else {
            $row_style_class = 'tableb tableb_alternate';
        }
        $loop_counter++;
        if ($loop_counter > 1) {
            $loop_counter = 0;
        }
        if ($user['disk_usage'] == '') {
            $user['disk_usage'] = 0;
        }
        $group_quota_separator = '/';
        // Determine actual quota if user belongs to more than one user group
        if ($user_groups = cpg_get_groups($user['user_id'])) {
            $quota = mysql_fetch_assoc(cpg_db_query("SELECT MAX(group_quota) AS disk_max, MIN(group_quota) AS disk_min FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_quota >= 0 AND group_id IN (" . implode(", ", $user_groups) . ")"));
            $user['group_quota'] = $quota["disk_min"] ? $quota["disk_max"] : 0;
        }
        if ($user['group_quota']) {
            $disk_usage_output = theme_display_bar($user['disk_usage'], $user['group_quota'], 150, '', '', $group_quota_separator . $user['group_quota'] . '&nbsp;' . $lang_byte_units[1], 'red', 'green');
        } else {
            $disk_usage_output = theme_display_bar($user['disk_usage'], $user['group_quota'], 150, '', '', '&nbsp;' . $lang_byte_units[1], 'green', 'green');
        }
        if ($user['user_active'] == 'NO') {
            //$user['group_name'] = '<i>' . $lang_usermgr_php['inactive'] . '</i>';
            $user['status'] = cpg_fetch_icon('offline', 0, $lang_usermgr_php['status_inactive']);
            $action = 'activate';
        } else {
            $user['status'] = cpg_fetch_icon('online', 0, $lang_usermgr_php['status_active']);
            $action = 'deactivate';
        }
        if (!$lim_user) {
            $user['status'] = '<a href="delete.php?id=u' . $user['user_id'] . '&amp;album_listbox=' . $sort . '&amp;action=' . $action . '&amp;what=user&amp;form_token=' . $form_token . '&amp;timestamp=' . $timestamp . '" title="">' . $user['status'] . '</a>';
        }
        $user['user_regdate'] = localised_date($user['user_regdate'], $lang_date['register']);
        if ($user['user_lastvisit']) {
            $user['user_lastvisit'] = localised_date($user['user_lastvisit'], $lang_date['register']);
        } else {
            $user['user_lastvisit'] = $lang_usermgr_php['never'];
        }
        $view_profile = '<a href="profile.php?uid=' . $user['user_id'] . '">' . cpg_fetch_icon('my_profile', 0, $lang_usermgr_php['view_profile']) . '</a>';
        if ($user['pic_count']) {
            $last_uploads = '<a href="thumbnails.php?album=lastupby&amp;uid=' . $user['user_id'] . '">' . cpg_fetch_icon('last_uploads', 0, $lang_usermgr_php['latest_upload']) . '</a>';
        } else {
            if ($lim_user == 0) {
                $last_uploads = cpg_fetch_icon('last_uploads_disabled', 0, $lang_usermgr_php['no_latest_upload']);
            } else {
                $last_uploads = cpg_fetch_icon('blank', 0);
            }
        }
        // fetch number of comments and add link to comments if applicable
        if ($lim_user == 0) {
            $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = {$user['user_id']}");
            // display all comments for the admin
        } else {
            $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = {$user['user_id']} AND approval = 'YES' ");
            // only display approved comments for non-admin
        }
        $commentCount = mysql_fetch_array($result);
        $user['comment_num'] = $commentCount[0];
        mysql_free_result($result);
        if ($user['comment_num'] > 0) {
            $user_comment_link = '<a href="thumbnails.php?album=lastcomby&amp;uid=' . $user['user_id'] . '">' . cpg_fetch_icon('comment', 0, $lang_usermgr_php['last_comments'] . '(' . $user['comment_num'] . ')') . '</a>';
        } else {
            $user_comment_link = cpg_fetch_icon('blank', 0, $lang_usermgr_php['no_last_comments']);
        }
        // create comments bar
        $comment_quota_output = theme_display_bar($user['comment_num'], $totalCommentCount, 60, '', '', '', 'red', '');
        // create files bar
        $file_quota_output = theme_display_bar($user['pic_count'], $totalPictureCount, 60, '', '', '', 'red', '');
        // Look up banned table
        if (mysql_num_rows(cpg_db_query("SELECT user_name FROM {$CONFIG['TABLE_BANNED']} WHERE user_name = '" . addslashes($user['user_name']) . "' AND brute_force=0 LIMIT 1"))) {
            $ban_user_link = '<a href="banning.php">' . cpg_fetch_icon('ban_user_disabled', 0, $lang_usermgr_php['user_is_banned']) . '</a>';
            $ban_memberlist = cpg_fetch_icon('ban_user_disabled', 0, $lang_usermgr_php['user_is_banned']);
        } else {
            $ban_user_link = '<a href="banning.php?ban_user='******'user_id'] . '">' . cpg_fetch_icon('ban_user', 0, $lang_usermgr_php['ban_user']) . '</a>';
            $ban_memberlist = '';
        }
        if (!$lim_user) {
            if ($user['user_id'] == $USER_DATA['user_id']) {
                $profile_link = 'profile.php?op=edit_profile';
                $checkbox_html = '';
                $ban_user_link = cpg_fetch_icon('blank', 0);
            } else {
                $profile_link = $CPG_PHP_SELF . '?op=edit&amp;user_id=' . $user['user_id'] . '&amp;form_token=' . $form_token . '&amp;timestamp=' . $timestamp;
                $checkbox_html = '<input name="u' . $user['user_id'] . '" ' . $makereadonly . 'type="checkbox" value="" class="checkbox" />';
            }
            $profile_link = '<a href="' . $profile_link . '">' . cpg_fetch_icon('edit', 0, $lang_usermgr_php['edit_profile']) . '</a>';
            if ($CONFIG['user_manager_hide_file_stats']) {
                $pictures_quota_data = '';
            } else {
                $pictures_quota_data = <<<EOT
                <td class="{$row_style_class}" align="right">{$file_quota_output}</td>
                <td class="{$row_style_class}" align="center">{$disk_usage_output}</td>
EOT;
            }
            echo <<<EOT
        <tr>
                <td class="{$row_style_class}" align="center">{$checkbox_html}</td>
                <td class="{$row_style_class}">{$user['user_name']}</td>
                <td class="{$row_style_class}" align="left">
                    {$view_profile}
                    {$profile_link}
                    {$last_uploads}
                    {$ban_user_link}
                    {$user_comment_link}
                </td>
                <td class="{$row_style_class}">{$user['status']}</td>
                <td class="{$row_style_class}">{$user['group_name']}</td>
                <td class="{$row_style_class}">{$user['user_regdate']}</td>
                <td class="{$row_style_class}">{$user['user_lastvisit']}</td>
                <td class="{$row_style_class}" align="right">{$comment_quota_output}</td>
                {$pictures_quota_data}
        </tr>

EOT;
        } else {
            if ($CONFIG['user_manager_hide_file_stats']) {
                $pictures_quota_data = '';
            } else {
                $pictures_quota_data = <<<EOT
                <td class="{$row_style_class}" align="right">{$user['pic_count']}</td>
                <td class="{$row_style_class}" align="center">{$disk_usage_output}</td>
EOT;
            }
            echo <<<EOT
        <tr>
                <td class="{$row_style_class}">{$user['user_name']}</td>
                <td class="{$row_style_class}">{$view_profile}{$last_uploads}{$user_comment_link}</td>
                <td class="{$row_style_class}">{$user['status']}{$ban_memberlist}</td>
                <td class="{$row_style_class}">{$user['group_name']}</td>
                <td class="{$row_style_class}">{$user['user_regdate']}</td>
                <td class="{$row_style_class}">{$user['user_lastvisit']}</td>
                <td class="{$row_style_class}" align="right">{$user['comment_num']}</td>
                {$pictures_quota_data}
        </tr>

EOT;
        }
    }
    // while
    //mysql_free_result($result);
    if ($CONFIG['user_manager_hide_file_stats']) {
        $pictures_quota_footer = '';
    } else {
        $pictures_quota_footer = <<<EOT
            <td align="right" class="tablef">{$totalPictureCount_fmt}</td>
            <td align="right" class="tablef">{$totalSpaceCount_fmt}</td>
EOT;
    }
    if (!$lim_user) {
        if ($search) {
            $search_string_default = 'value="' . $search . '"';
        } else {
            $search_string_default = 'value="' . $lang_usermgr_php['search'] . '" onfocus="this.value=\'\'"';
        }
        $help = cpg_display_help('f=users.htm&amp;as=user_cp_search&amp;ae=user_cp_search_end&amp;top=1', '400', '150');
        echo <<<EOT
        <tr>
                <td class="tablef" align="center"><input type="checkbox" name="checkAll2" id="checkAll2" {$makereadonly}onclick="selectAll('cpgform');" class="checkbox" title="{$lang_common['check_uncheck_all']}" style="display:none" /></td>
                <td colspan="{$number_of_columns_minus_four}"  class="tablef">
                <table cellpadding="0" cellspacing="0" width="100%" border="0">
                <tr>
                        <td align="left">
                            <select name="action" id="action" size="1" class="listbox" {$makereadonly}onchange="return selectaction(this,'u');" style="display:none">
                                <option value="" selected="selected">{$lang_usermgr_php['with_selected']}</option>
                                <option value="delete">{$lang_common['delete']}</option>
                                <option value="activate">{$lang_usermgr_php['activate']}</option>
                                <option value="deactivate">{$lang_usermgr_php['deactivate']}</option>
                                <option value="reset_password">{$lang_usermgr_php['reset_password']}</option>
                                <option value="change_group">{$lang_usermgr_php['change_primary_membergroup']}</option>
                                <option value="add_group">{$lang_usermgr_php['add_secondary_membergroup']}</option>
                            </select>
                            <input type="hidden" name="what" value="user"/>
                              <input type="text" name="new_password" value="{$lang_usermgr_php['password']}" size="8" maxlength="25" class="textinput" onfocus="this.value='';" style="display:none" />
                              <select name="group" size="1" class="listbox" style="display:none" onchange="return selectaction(this,'u');">
                                  <option value="">{$lang_usermgr_php['select_group']}</option>

EOT;
        $sql = "SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_name";
        $result = cpg_db_query($sql);
        $group_list = cpg_db_fetch_rowset($result);
        mysql_free_result($result);
        if (isset($element[1])) {
            $sel_group = $user_data[$element[1]];
        } else {
            $sel_group = '';
        }
        foreach ($group_list as $group) {
            if ($group['group_id'] != 3) {
                print '                                  <option value="' . $group['group_id'] . '"' . ($group['group_id'] == $sel_group ? ' selected' : '') . '>' . $group['group_name'] . '</option>' . $LINEBREAK;
            }
        }
        $help_create = '&nbsp;' . cpg_display_help('f=users.htm&amp;as=user_cp_new&amp;ae=user_cp_new_end', '600', '250');
        $create_new_user_icon = cpg_fetch_icon('add_user', 2);
        list($timestamp, $form_token) = getFormToken();
        echo <<<EOT
                              </select>
                            <select name="delete_files" size="1" class="listbox" style="display:none">
                                <option value="no">{$lang_usermgr_php['delete_files_no']}</option>
                                <option value="yes">{$lang_usermgr_php['delete_files_yes']}</option>
                            </select>
                            <select name="delete_comments" size="1" class="listbox" style="display:none">
                                <option value="no">{$lang_usermgr_php['delete_comments_no']}</option>
                                <option value="yes">{$lang_usermgr_php['delete_comments_yes']}</option>
                            </select>
                            <button type="submit" class="button" name="go" value="{$lang_usermgr_php['submit']}" style="display:none">{$icon_array['ok']}{$lang_usermgr_php['submit']}</button>
                        </td>
                </tr>
                </table>
                <input type="hidden" name="form_token" value="{$form_token}" />
                <input type="hidden" name="timestamp" value="{$timestamp}" />
                </td>
                <td align="right" class="tablef">{$totalCommentCount_fmt}</td>
                {$pictures_quota_footer}
        </tr>
EOT;
        endtable();
        echo '</form>';
        starttable('100%');
        echo <<<EOT

        <tr>
            <td colspan="{$number_of_columns}" class="tablef" align="center" valign="middle">
                <table border="0" cellspacing="0" cellpadding="0" width="100%">
                    <tr>
                        <td class="tablef" align="center" valign="middle">
                            <form method="post" action="{$CPG_PHP_SELF}" name="searchUser" id="cpgform2">
                                <input type="text" name="username" class="textinput" {$search_string_default} />
                                <button type="submit" class="button" name="user_search" value="{$lang_usermgr_php['search_submit']}">{$icon_array['search']}{$lang_usermgr_php['search_submit']}</button>
                                {$help}
                            </form>
                        </td>
                        <td class="tablef" align="center" valign="middle">
                            <a href="{$CPG_PHP_SELF}?op=new_user&amp;form_token={$form_token}&amp;timestamp={$timestamp}" {$makereadonly}class="admin_menu">{$create_new_user_icon}{$lang_usermgr_php['create_new_user']}</a>
                            {$help_create}
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
EOT;
    } else {
        echo <<<EOT
        <tr>
            <td colspan="{$number_of_columns_minus_three}" class="tablef" align="left" valign="middle">
                {$lang_usermgr_php['total']}
            </td>
            <td class="tablef" align="right" valign="middle">
                {$totalCommentCount_fmt}
            </td>
            {$pictures_quota_footer}
        </tr>
EOT;
    }
    // Accept footer addons for the user manager
    echo CPGPluginAPI::filter('usermgr_footer', '');
    if ($tabs) {
        echo <<<EOT
        <tr>
                <td colspan="{$number_of_columns}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                        {$tabs}
                                </tr>
                        </table>
                </td>
        </tr>

EOT;
    }
    endtable();
}
コード例 #30
0
ファイル: search.php プロジェクト: CatBerg-TestOrg/coppermine
                                        <tr>
                                                <td class="tableh2">{$lang_search_php['albcatfields']}:</td>
                                                <td class="tableh2">&nbsp;</td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="album_title" id="album_title" class="checkbox" /><label for="album_title" class="clickable_option">{$lang_search_php['album_title']}</label></td>
                                                <td>&nbsp;</td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="category_title" id="category_title" class="checkbox" /><label for="category_title" class="clickable_option">{$lang_search_php['category_title']}</label></td>
                                                <td>&nbsp;</td>
                                        </tr>
                                </table>
                        </td>
                </tr>
EOT;
$text .= endtable(true);
$text .= '</form>';
$text = CPGPluginAPI::filter('search_form', $text);
echo $text;
if ($CONFIG['clickable_keyword_search'] != 0) {
    include 'include/keyword.inc.php';
}
echo <<<EOT
      <script language="javascript" type="text/javascript">
      <!--
      document.searchcpg.search.focus();
      -->
      </script>
EOT;
pagefooter();