Ejemplo n.º 1
0
function album_share_codes_main()
{
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->testInt('album')) {
        global $CONFIG;
        $aid = $superCage->get->getInt('album');
        $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '{$aid}'");
        if (mysql_num_rows($result) > 0) {
            while ($row = mysql_fetch_assoc($result)) {
                $url = $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $row['pid'];
                $thumb = $CONFIG['ecards_more_pic_target'] . get_pic_url($row, 'thumb');
                $content1 .= '[url=' . $url . '][img]' . $thumb . '[/img][/url]' . "\n";
                $content2 .= '<a href="' . $url . '"><img src="' . $thumb . ' /></a>' . "\n";
            }
            starttable(-1, 'Share codes for <i>all files</i> in this album');
            echo <<<EOT
                <tr>
                    <td class="tableb">
                        <tt>[url][img][/url]</tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content1}</textarea>
                        <br />
                        <tt>&lt;a&gt;&lt;img&gt;&lt;/a&gt;</tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content2}</textarea>
                    </td>
                </tr>
EOT;
            endtable();
        }
    }
}
function cpg_phpinfo_mod_output($search, $output_type)
{
    // first parameter is the module name, second parameter is the way you want your output to look like: table or text
    $pieces = cpg_phpinfo_mod($search);
    $summ = '';
    $return = '';
    $debug_underline = '&#0010;------------------&#0010;';
    $debug_separate = '&#0010;==========================&#0010;';
    if ($output_type == 'table') {
        ob_start();
        starttable('100%', 'Module: ' . $search, 2);
        $return .= ob_get_contents();
        ob_end_clean();
    } else {
        $return .= 'Module: ' . $search . $debug_underline;
    }
    foreach ($pieces as $val) {
        if ($output_type == 'table') {
            $return .= '<tr><td>';
        }
        $return .= $val[0];
        if ($output_type == 'table') {
            $return .= '</td><td>';
        }
        $return .= $val[1];
        if ($output_type == 'table') {
            $return .= '</td></tr>';
        }
        $summ .= $val[0];
    }
    if (!$summ) {
        if ($output_type == 'table') {
            $return .= '<tr><td colspan="2">';
        }
        $return .= 'module doesn\'t exist';
        if ($output_type == 'table') {
            $return .= '</td></tr>';
        }
    }
    if ($output_type == 'table') {
        ob_start();
        endtable();
        $return .= ob_get_contents();
        ob_end_clean();
    } else {
        $return .= $debug_separate;
    }
    return $return;
}
Ejemplo n.º 3
0
function edit_user($user_id)
{
    global $CONFIG, $CPG_PHP_SELF, $LINEBREAK;
    //, $PHP_SELF;
    global $lang_usermgr_php, $lang_common, $icon_array, $op;
    $form_data = array(array('input', 'user_name', cpg_fetch_icon('my_profile', 2) . $lang_usermgr_php['name'], 25), array('password', 'user_password', cpg_fetch_icon('key_enter', 2) . $lang_usermgr_php['password'], 25), array('yesno', 'user_active', cpg_fetch_icon('online', 2) . $lang_usermgr_php['user_active']), array('group_list', 'user_group', cpg_fetch_icon('groups_mgr', 2) . $lang_usermgr_php['user_group']), array('input', 'user_email', cpg_fetch_icon('mail', 2) . $lang_usermgr_php['user_email'], 255));
    if ($CONFIG['user_profile1_name'] != '') {
        $form_data[] = array('input', 'user_profile1', cpg_fetch_icon('blank', 2) . $CONFIG['user_profile1_name'], 255);
    }
    if ($CONFIG['user_profile2_name'] != '') {
        $form_data[] = array('input', 'user_profile2', cpg_fetch_icon('blank', 2) . $CONFIG['user_profile2_name'], 255);
    }
    if ($CONFIG['user_profile3_name'] != '') {
        $form_data[] = array('input', 'user_profile3', cpg_fetch_icon('blank', 2) . $CONFIG['user_profile3_name'], 255);
    }
    if ($CONFIG['user_profile4_name'] != '') {
        $form_data[] = array('input', 'user_profile4', cpg_fetch_icon('blank', 2) . $CONFIG['user_profile4_name'], 255);
    }
    if ($CONFIG['user_profile5_name'] != '') {
        $form_data[] = array('input', 'user_profile5', cpg_fetch_icon('blank', 2) . $CONFIG['user_profile5_name'], 255);
    }
    if ($CONFIG['user_profile6_name'] != '') {
        $form_data[] = array('textarea', 'user_profile6', cpg_fetch_icon('blank', 2) . $CONFIG['user_profile6_name'], 255);
    }
    //$form_data = CPGPluginAPI::filter('usermgr_form_list', array(0 => $form_data, 1 => $user_id);
    list($timestamp, $form_token) = getFormToken();
    if ($user_id != 'new_user') {
        $sql = "SELECT * FROM {$CONFIG['TABLE_USERS']} WHERE user_id = '{$user_id}'";
        $result = cpg_db_query($sql);
        if (!mysql_num_rows($result)) {
            cpg_die(CRITICAL_ERROR, $lang_usermgr_php['err_unknown_user'], __FILE__, __LINE__);
        }
        $user_data = mysql_fetch_array($result);
        mysql_free_result($result);
        if (mysql_num_rows(cpg_db_query("SELECT user_name FROM {$CONFIG['TABLE_BANNED']} WHERE user_name = '" . addslashes($user_data['user_name']) . "' AND brute_force=0 LIMIT 1"))) {
            $user_status = $lang_usermgr_php['user_is_banned'];
        } elseif ($user_data['user_active'] == 'YES') {
            $user_status = $lang_usermgr_php['status_active'];
        } else {
            $user_status = $lang_usermgr_php['status_inactive'];
        }
    } else {
        // If this is a new user then add a checkbox for 'send login data to user' option
        $form_data[] = array('checkbox', 'send_login_data', $lang_usermgr_php['send_login_data']);
        $user_data = array('user_name' => '', 'user_active' => '', 'user_group' => '', 'user_group_list' => '', 'user_email' => '', 'user_profile1' => '', 'user_profile2' => '', 'user_profile3' => '', 'user_profile4' => '', 'user_profile6' => '');
    }
    $status_icon = cpg_fetch_icon('online', 2);
    echo <<<EOT
        <form name="cpgform3" id="cpgform3" method="post" action="{$CPG_PHP_SELF}?op=update&amp;user_id={$user_id}">

EOT;
    if ($op == 'new_user') {
        starttable(500, $icon_array['add_user'] . $lang_usermgr_php['create_new_user'], 2);
    } else {
        starttable(500, $icon_array['edit'] . $lang_usermgr_php['modify_user'], 2);
        echo <<<EOT
        <tr>
                <td class="tableb">
                        {$status_icon}{$lang_usermgr_php['status']}
                </td>
                <td class="tableb">
                        {$user_status}
                </td>
        </tr>
EOT;
    }
    $loopCounter = 0;
    foreach ($form_data as $element) {
        if ($loopCounter / 2 == floor($loopCounter / 2)) {
            $row_style_class = 'tableb tableb_alternate';
        } else {
            $row_style_class = 'tableb';
        }
        $loopCounter++;
        switch ($element[0]) {
            case 'input':
                $value = $user_data[$element[1]];
                if ($element[2]) {
                    echo <<<EOT
            <tr>
                <td width="40%" class="{$row_style_class}" valign="top">
                            {$element[2]}
            </td>
            <td width="60%" class="{$row_style_class}" valign="top">
                    <input type="text" style="width: 100%" name="{$element[1]}" maxlength="{$element[3]}" value="{$value}" class="textinput" />
                    </td>
            </tr>


EOT;
                }
                break;
            case 'textarea':
                $value = $user_data[$element[1]];
                if ($element[2]) {
                    echo <<<EOT
            <tr>
                <td width="40%" class="{$row_style_class}" height="25" valign="top">
                            {$element[2]}
            </td>
            <td width="60%" class="{$row_style_class}" valign="top">
                    <textarea name="{$element[1]}" rows="7" cols="40" class="textinput" style="width: 100%">{$value}</textarea>
                    </td>
            </tr>


EOT;
                }
                break;
            case 'password':
                echo <<<EOT
            <tr>
                <td width="40%" class="{$row_style_class}" valign="top">
                            {$element[2]}
            </td>
            <td width="60%" class="{$row_style_class}" valign="top">
                    <input type="password" style="width: 100%" name="{$element[1]}" maxlength="{$element[3]}" value="" class="textinput" />
                    </td>
            </tr>

EOT;
                break;
            case 'yesno':
                $value = $user_data[$element[1]];
                $yes_selected = $value == 'YES' || $op == 'new_user' ? 'checked="checked"' : '';
                $no_selected = $value == 'NO' ? 'checked="checked"' : '';
                echo <<<EOT
            <tr>
                <td class="{$row_style_class}" valign="top">
                            {$element[2]}
            </td>
                    <td class="{$row_style_class}" valign="top">
                        <input type="radio" id="yes" name="{$element[1]}" value="YES" {$yes_selected} /><label for="yes" class="clickable_option">{$lang_common['yes']}</label>
                        &nbsp;&nbsp;
                        <input type="radio" id="no" name="{$element[1]}" value="NO" {$no_selected} /><label for="no" class="clickable_option">{$lang_common['no']}</label>
                    </td>
            </tr>

EOT;
                break;
            case 'group_list':
                $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);
                $sel_group = $user_data[$element[1]];
                $user_group_list = $user_data['user_group_list'] == '' ? ',' . $sel_group . ',' : ',' . $user_data['user_group_list'] . ',' . $sel_group . ',';
                echo <<<EOT
            <tr>
                <td class="{$row_style_class}" valign="top">
                            {$element[2]}
            </td>
            <td class="{$row_style_class}" valign="top">
                    <select name="{$element[1]}" class="listbox">

EOT;
                $group_cb = '';
                foreach ($group_list as $group) {
                    echo '                        <option value="' . $group['group_id'] . '"' . ($group['group_id'] == $sel_group || $op == 'new_user' && $group['group_id'] == 2 ? ' selected="selected"' : '') . '>' . $group['group_name'] . '</option>' . $LINEBREAK;
                    if ($group['group_id'] != 3) {
                        $checked = strpos(' ' . $user_group_list, ',' . $group['group_id'] . ',') ? 'checked="checked"' : '';
                        $group_cb .= '<input name="group_list[]" type="checkbox" value="' . $group['group_id'] . '" ' . $checked . ' />' . $group['group_name'] . '<br />' . $LINEBREAK;
                    }
                }
                $assignedGroupsHelp = cpg_display_help('f=users.htm&amp;as=user_cp_edit_permission_by_group&amp;ae=user_cp_edit_permission_by_group_end', '450', '300');
                echo <<<EOT
                            </select><br />
                            {$group_cb}
                            <br />
                            <a href="usermgr.php?op=groups_alb_access&amp;form_token={$form_token}&amp;timestamp={$timestamp}" class="admin_menu">{$lang_usermgr_php['groups_alb_access']}</a>
                            {$assignedGroupsHelp}

              </td>
            </tr>

EOT;
                break;
            case 'checkbox':
                echo <<<EOT
            <tr>
                <td class="{$row_style_class}" valign="top">
                            <label for="send_login_data">{$element[2]}</label>
            </td>
                    <td class="{$row_style_class} valign="top"">
                        <input type="checkbox" id="send_login_data" name="{$element[1]}" value="YES" />
                    </td>
            </tr>

EOT;
                break;
            default:
                cpg_die(CRITICAL_ERROR, 'Invalid action for form creation ' . $element[0], __FILE__, __LINE__);
        }
    }
    if ($op == 'new_user') {
        echo <<<EOT
        <tr>
                <td colspan="2" align="center" class="tablef">
                        <button type="submit" class="button" name="usermgr_edit_submit" value="{$lang_usermgr_php['submit']}">{$icon_array['ok']}{$lang_usermgr_php['submit']}</button>
                        <input type="hidden" name="form_token" value="{$form_token}" />
                        <input type="hidden" name="timestamp" value="{$timestamp}" />
                </td>
        </tr>

EOT;
    } else {
        echo <<<EOT
        <tr>
                <td colspan="2" class="tableh2">
                        {$lang_usermgr_php['notes']}
                </td>
        </tr>
        <tr>
                <td colspan="2" class="tableb">
                        <ul>
                            <li>{$lang_usermgr_php['note_list']}</li>
                        </ul>
                </td>
        </tr>
        <tr>
                <td colspan="2" align="center" class="tablef">
                        <button type="submit" class="button" name="usermgr_edit_submit" value="{$lang_usermgr_php['modify_user']}">{$icon_array['ok']}{$lang_usermgr_php['modify_user']}</button>
                        <input type="hidden" name="form_token" value="{$form_token}" />
                        <input type="hidden" name="timestamp" value="{$timestamp}" />
                </td>
        </tr>

EOT;
    }
    endtable();
    echo '</form>';
}
Ejemplo n.º 4
0
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>';
}
Ejemplo n.º 5
0
function theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip)
{
    global $CONFIG, $LINEBREAK;
    $superCage = Inspekt::makeSuperCage();
    $width = $CONFIG['picture_table_width'];
    echo '<a name="top_display_media"></a>';
    // set the navbar-anchor
    starttable();
    echo $nav_menu;
    endtable();
    starttable();
    echo "<tr>";
    echo "<td height='100%'><table width='100%'><!-- gb before picture -->";
    echo $picture;
    echo "</table></td><!-- gb after picture -->";
    if ($CONFIG['display_film_strip'] == 1) {
        echo "<td width='200' height='100%' class=\"tablebspecial\"><!-- gb before film_strip -->";
        echo $film_strip;
        echo "</td><!-- gb after film_strip -->";
    }
    echo "</tr>";
    endtable();
    echo $votes;
    $picinfo = $superCage->cookie->keyExists('picinfo') ? $superCage->cookie->getAlpha('picinfo') : ($CONFIG['display_pic_info'] ? 'block' : 'none');
    echo $LINEBREAK . '<div id="picinfo" style="display: ' . $picinfo . ';">' . $LINEBREAK;
    starttable();
    echo $pic_info;
    endtable();
    echo '</div>' . $LINEBREAK;
    echo '<a name="comments_top"></a>';
    echo '<div id="comments">' . $LINEBREAK;
    echo $comments;
    echo '</div>' . $LINEBREAK;
}
Ejemplo n.º 6
0
function reload()
{
    global $filelist, $counter, $lang_plugin_mass_import, $output_array, $lang_common, $mass_import_icon_array;
    // Create the super cage
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->post->keyExists('auto') || $superCage->post->keyExists('directory') || $superCage->post->keyExists('sleep') || $superCage->post->keyExists('hardlimit')) {
        // Do nothing
    } else {
        exit;
    }
    $remaining = countup($filelist);
    $filelist = base64_encode(serialize($filelist));
    if ($superCage->post->keyExists('auto') && $superCage->post->getInt('auto') == 1) {
        $auto = 'checked = "checked"';
    } else {
        $auto = '';
    }
    if ($counter != 0) {
        $counter = $output_array['row_start'] . $lang_plugin_mass_import['files_added'] . ': ' . $output_array['row_separator'] . $counter . $output_array['row_end'];
    } else {
        $counter = $output_array['row_start'] . $lang_plugin_mass_import['structure_created'] . $output_array['row_separator'] . $output_array['row_end'];
    }
    if ($superCage->post->keyExists('directory')) {
        $directory = $superCage->post->getRaw('directory');
        // We rely on the fact that only the admin can run this page
    } else {
        $directory = '';
    }
    if ($superCage->post->keyExists('sleep')) {
        $sleep = $superCage->post->getInt('sleep');
    } else {
        $sleep = '1000';
    }
    if ($superCage->post->keyExists('hardlimit')) {
        $hardlimit = $superCage->post->getInt('hardlimit');
    } else {
        $hardlimit = '0';
    }
    $js = $superCage->post->keyExists('auto') && $remaining ? '<script type="text/javascript"> onload = document.form.submit();</script>' : '';
    if (!connection_aborted()) {
        echo $counter;
        echo $output_array['row_start'] . $lang_plugin_mass_import['files_to_add'] . ': ' . $output_array['row_separator'] . $remaining . $output_array['row_end'];
        echo <<<EOT
    {$output_array['row_start']}
        <input name="filelist" type="hidden" value="{$filelist}" />
        <input type="hidden" name="directory" value="{$directory}" />\t
        {$lang_plugin_mass_import['sleep_desc']}:
        {$output_array['row_separator']}\t
        <input type="text" name="sleep" id="sleep" value="{$sleep}" size="5" maxlength="5" class="textinput spin-button" /> ({$lang_plugin_mass_import['in_milliseconds']})
        {$output_array['row_end']}
        {$output_array['row_start']}
        {$lang_plugin_mass_import['hardlimit_desc']}: 
        {$output_array['row_separator']}\t
        <input type="text" name="hardlimit" id="hardlimit" value="{$hardlimit}" size="3" maxlength="3" class="textinput spin-button" />
        {$output_array['row_end']}
        {$output_array['row_start']}
        <label for="auto" class="clickable_option">{$lang_plugin_mass_import['autorun_desc']}</label>: 
        {$output_array['row_separator']}\t
        <input type="checkbox" name="auto" id="auto" value="1" class="checkbox" {$auto} />
        {$output_array['row_end']}
        {$output_array['row_start']}
        <button type="submit" class="button" name="continue" value="{$lang_common['continue']}">{$mass_import_icon_array['continue']}{$lang_common['continue']}</button>
        {$output_array['row_separator']}
        {$output_array['row_end']}

EOT;
    }
    echo $js;
    endtable();
    echo <<<EOT
    </form>
EOT;
    pagefooter();
}
Ejemplo n.º 7
0
function theme_minicms_edit_editor(&$cms)
{
    global $MINICMS, $referer, $lang_minicms, $CONFIG, $THEME_DIR;
    ob_start();
    echo '<SELECT name="type">';
    foreach ($MINICMS['conType'] as $key => $conType) {
        if ($key == $cms['type']) {
            echo "<OPTION selected value=\"{$key}\">{$conType}</OPTION>";
        } else {
            echo "<OPTION value=\"{$key}\">{$conType}</OPTION>";
        }
    }
    echo '</SELECT>';
    $cms['select_type'] = ob_get_clean();
    print <<<EOT
        <form name="post" method="post" action="index.php?file=minicms/cms_edit&amp;referer={$referer}">
EOT;
    starttable("100%", $cms['title'], 3);
    print <<<EOT
        <tr>
            <td colspan="3" align="center">
                <h2>{$cms['message']}</h2>
            </td>
        </tr>
        <tr>
            <td>{$lang_minicms['title']}</td>
            <td>{$lang_minicms['type']}</td>
            <td>{$lang_minicms['content']}</td>
        </tr>
        <tr valign="top">
            <td class="row2">
                <input value="{$cms['ID']}" type="hidden" name="id" >
                <input type="text" value="{$cms['title']}" class="post" tabindex="1" style="width: 450px;" maxlength="60" size="45" name="title" />
            </td>
            <td class="row2">
                {$cms['select_type']}
            </td>
            <td class="row2">
                <input type="text" value="{$cms['conid']}" class="post" tabindex="3" style="width: 50px;" maxlength="5" name="conid" />
            </td>
        </tr>
        <tr valign="top">
            <td class="row2" colspan="3">
EOT;
    foreach (get_smilies_table2() as $smiley) {
        $smilies[] = $smiley[1];
    }
    //$smilies="['".implode("','",$smilies)."']";
    //$smilies=implode(",",$smilies);
    //echo "<br>$smilies";
    $superCage = Inspekt::makeSuperCage();
    $cmpath = str_replace('index.php', '', $superCage->server->getRaw('PHP_SELF'));
    $userfilespath = $cmpath . $CONFIG['fullpath'];
    $basepath = $cmpath . 'plugins/minicms/fckeditor/';
    $oFCKeditor = new FCKeditor('minicms_content');
    $oFCKeditor->BasePath = $basepath;
    $oFCKeditor->Width = '100%';
    $oFCKeditor->Height = '350';
    $oFCKeditor->Value = $cms['content'];
    $oFCKeditor->Config['BaseHref'] = $CONFIG['ecards_more_pic_target'];
    $oFCKeditor->Config['CustomConfigurationsPath'] = $basepath . 'minicms_config.js';
    //  $oFCKeditor->Config['SmileyPath']      = $cmpath . 'images/smiles/';  //couldn't get the smilies to work
    //  $oFCKeditor->Config['SmileyImages']    = $smilies;          //I posted the problem of FCK's project site
    $oFCKeditor->Config['EditorAreaCSS'] = $cmpath . $THEME_DIR . 'style.css';
    $oFCKeditor->Config['StylesXmlPath'] = $basepath . 'style.xml';
    //  $oFCKeditor->Config['UseBROnCarriageReturn'] = true;  I don't think we wan't this option.
    //  $oFCKeditor->Config['LinkBrowserURL']  = $basepath . 'editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&ServerPath='.$userfilespath;
    //  $oFCKeditor->Config['ImageBrowserURL'] = $basepath . 'editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php&ServerPath='.$userfilespath;
    //  $oFCKeditor->Config['FlashBrowserURL'] = $basepath . 'editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/php/connector.php&ServerPath='.$userfilespath;
    // 	$oFCKeditor->Config['MediaBrowserURL'] = $basepath . 'editor/filemanager/browser/default/browser.html?Type=Media&Connector=connectors/php/connector.php&ServerPath='.$userfilespath;
    //	$oFCKeditor->Config['LinkUploadURL']   = $basepath . 'editor/filemanager/upload/php/upload.php&ServerPath='.$userfilespath;
    //	$oFCKeditor->Config['ImageUploadURL']  = $basepath . 'editor/filemanager/upload/php/upload.php?Type=Image&ServerPath='.$userfilespath;
    //	$oFCKeditor->Config['FlashUploadURL']  = $basepath . 'editor/filemanager/upload/php/upload.php?Type=Flash&ServerPath='.$userfilespath;
    //	$oFCKeditor->Config['MediaUploadURL']  = $basepath . 'editor/filemanager/upload/php/upload.php?Type=Media&ServerPath='.$userfilespath;
    //  $oFCKeditor->Config['PluginsPath'] = $basepath . 'editor/plugins/';
    //  $oFCKeditor->Config['SkinPath'] = $basepath . 'editor/skins/silver/';
    //  $oFCKeditor->Config['Debug'] = true;
    //  $oFCKeditor->Config['UserFilesPath'] = $userfilespath;
    $oFCKeditor->Create();
    print <<<EOT
            </td>
        </tr>
        <tr>
            <td align="center" colspan="3" class="catBottom">
                <input value="{$lang_minicms['preview']}" class="mainoption" name="submit" tabindex="5" type="submit">&nbsp;
                <input value="{$lang_minicms['submit']}" class="mainoption" name="submit" tabindex="6" accesskey="s" type="submit">
            </td>
        </tr>
    </form>
EOT;
    endtable();
}
Ejemplo n.º 8
0
function write_to_db($step)
{
    global $BRIDGE, $CONFIG, $default_bridge_data, $lang_bridgemgr_php, $previous_step, $next_step;
    $error = 0;
    // do the check for plausibility of posted data
    foreach ($_POST as $key => $value) {
        // loop through the posted data -- start
        // filter the post data that doesn't get written
        if (array_key_exists($key, $BRIDGE)) {
            // post data exists as db key -- start
            // do the lookups
            $options = explode(',', $default_bridge_data[$BRIDGE['short_name']][$key . '_used']);
            foreach ($options as $key2) {
                $options[$key2] = trim($options[$key2], ',');
                // get rid of the delimiters
            }
            if ($options[0] != '') {
                // only continue with this loop if there really is an option to check --- start
                if ($options[0] == 'lookfor') {
                    // check for the existance of a local file/folder --- start
                    if (file_exists($value . $options[1]) == false) {
                        $return[$key] = sprintf($lang_bridgemgr_php['error_folder_not_exist'], '<tt>' . $value . $options[1] . '</tt>', '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                    }
                }
                // check for the existance of a file/folder --- end
                if ($options[0] == 'cookie') {
                    // check for the existance of a cookie --- start
                    foreach ($_COOKIE as $key2 => $value2) {
                        // loop through the cookie global var --- start
                        //print '<br>cookie:'.$key2.', content:'.$value2."<br />\n";
                        if (@strstr($key2, $value) == false && $options[1] == 'not_empty') {
                            $return[$key] = sprintf($lang_bridgemgr_php['error_cookie_not_readible'], '&quot;<tt>' . $value . '</tt>*&quot;', '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                        }
                    }
                    // loop through the cookie global var --- end
                    if (isset($temp_err)) {
                        $return[$key] = $temp_err;
                    }
                }
                // check for the existance of a cookie --- end
                if ($options[1] == 'not_empty') {
                    // check for empty mandatory fields --- start
                    if ($value == '') {
                        $return[$key] = sprintf($lang_bridgemgr_php['error_mandatory_field_empty'], '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                    }
                }
                // check for empty mandatory fields --- end
                if ($options[0] == 'no_trailing_slash' || $options[1] == 'no_trailing_slash' || $options[2] == 'no_trailing_slash') {
                    // check for unneeded trailing slashes --- start
                    if ($value != rtrim($value, '/')) {
                        $return[$key] = sprintf($lang_bridgemgr_php['error_no_trailing_slash'], '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                    }
                }
                // check for unneeded traling slashes --- end
                if ($options[0] == 'trailing_slash' || $options[1] == 'trailing_slash' || $options[2] == 'trailing_slash') {
                    // check for needed trailing slashes --- start
                    if ($value == rtrim($value, '/')) {
                        $return[$key] = sprintf($lang_bridgemgr_php['error_trailing_slash'], '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                    }
                }
                // check for needed traling slashes --- end
                //print "<hr />\n";
                //print $options[0].':'.$options[1].','.$options[2];
                //print "<hr />\n";
            }
            // only continue with this loop if there really is an option to check --- end
        }
        // post data exists as db key -- end
    }
    // loop through the posted data -- end
    // loop through the expected data
    //void
    // do some checking according to the step we're currently in
    switch ($step) {
        case "choose_bbs":
            if ($_POST['short_name'] == '') {
                $return['short_name'] = $lang_bridgemgr_php['error_specify_bbs'];
                $error++;
            }
            if ($_POST['short_name'] == 'custom_selector') {
                $_POST['short_name'] = $_POST['custom_filename'];
                if ($_POST['short_name'] == '') {
                    $return['short_name'] = $lang_bridgemgr_php['error_no_blank_name'];
                }
                if (ereg('[^A-Za-z0-9_-]', $_POST['short_name'])) {
                    $return['short_name'] = $lang_bridgemgr_php['error_no_special_chars'];
                }
            }
            // check if the bridge file actually exists
            if (file_exists('bridge/' . $_POST['short_name'] . '.inc.php') == false) {
                $return['bridge_file_not_exist'] = sprintf($lang_bridgemgr_php['error_bridge_file_not_exist'], '<i>bridge/' . $_POST['short_name'] . '.inc.php</i>');
            }
            break;
        case "settings_path":
            //if ($_POST['short_name'] == '') {
            //    $return['short_name'] = $lang_bridgemgr_php['error_specify_bbs'];
            //}
            break;
        case "db_group":
            //if ($_POST['use_standard_groups'] == '') {
            //    $_POST['use_standard_groups'] = 0 ;
            //}
            break;
        case "db_connect":
            if ($default_bridge_data[$BRIDGE['short_name']]['db_hostname_used'] != '') {
                // check the db connection --- start
                @mysql_close();
                //temporarily disconnect from the coppermine database
                ob_start();
                $link = mysql_connect($_POST['db_hostname'], $_POST['db_username'], $_POST['db_password']);
                $mysql_error_output = ob_get_contents();
                ob_end_clean();
                if (!$link) {
                    $return[$step] = $lang_bridgemgr_php['error_db_connect'] . '<tt>' . $mysql_error_output . '</tt>';
                } elseif ($default_bridge_data[$BRIDGE['short_name']]['db_database_name_used'] != '') {
                    // check the database
                    ob_start();
                    $db_selected = mysql_select_db($_POST['db_database_name'], $link);
                    print mysql_error();
                    $mysql_error_output = ob_get_contents();
                    ob_end_clean();
                    if (!$db_selected) {
                        $return['db_database_name'] = sprintf($lang_bridgemgr_php['error_db_name'], '<i>' . $_POST['db_database_name'] . '</i>', '<i>' . $lang_bridgemgr_php['db_database_name'] . '</i>') . ' <tt>' . $mysql_error_output . '</tt>';
                    }
                }
                @mysql_close($link);
                cpg_db_connect();
                // connect back to coppermine db
            }
            // check the db connection --- end
            break;
        case "db_tables":
            if ($default_bridge_data[$BRIDGE['short_name']]['table_prefix_used'] != '') {
                $prefix_and_table = sprintf($lang_bridgemgr_php['error_prefix_and_table'], '<i>' . $lang_bridgemgr_php['table_prefix'] . '</i>');
            }
            @mysql_close();
            //temporarily disconnect from the coppermine database
            $link = @mysql_connect($BRIDGE['db_hostname'], $BRIDGE['db_username'], $BRIDGE['db_password']);
            $db_selected = @mysql_select_db($BRIDGE['db_database_name'], $link);
            $loop_table_names = array('user_table', 'session_table', 'group_table', 'group_table', 'group_relation_table', 'group_mapping_table');
            foreach ($loop_table_names as $key) {
                // loop through the possible tables --- start
                if ($default_bridge_data[$BRIDGE['short_name']][$key . '_used'] != '') {
                    // check if table exists --- start
                    $temp_tablename = $_POST['table_prefix'] . $_POST[$key];
                    $result = mysql_query('SELECT * FROM ' . $temp_tablename);
                    if (!$result) {
                        $return['db_' . $key] = sprintf($lang_bridgemgr_php['error_db_table'], '<i>' . $temp_tablename . '</i>', $prefix_and_table . '<i>' . $lang_bridgemgr_php[$key] . '</i>') . ' <tt>' . $mysql_error_output . '</tt>';
                    }
                    @mysql_free_result($result);
                }
                // check if table exists --- end
            }
            // loop through the possible tables --- end
            @mysql_close($link);
            cpg_db_connect();
            // connect back to coppermine db
            break;
    }
    // end switch
    // write the post data to the database
    //print_r($_POST);
    foreach ($_POST as $key => $value) {
        // filter the post data that doesn't get written
        if (array_key_exists($key, $BRIDGE)) {
            if ($CONFIG['debug_mode'] != 0) {
                // print what actually get's written when in debug_mode
                print '<span class="explanation">Writing to database: ';
                print $key . '|' . $value;
                print '<br /></span>';
            }
            if ($return[$key] != '') {
                //print '|Error in this key';
            } else {
                cpg_db_query("UPDATE {$CONFIG['TABLE_BRIDGE']} SET value = '{$value}' WHERE name = '{$key}'");
            }
            //print '<br />';
        }
    }
    $value = $_POST['bridge_enable'];
    if ($value != '0' && $value != '1') {
        $value = $CONFIG['bridge_enable'];
    }
    cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '{$value}' WHERE name = 'bridge_enable'");
    if ($_POST['clear_unused_db_fields'] == 1) {
        // clear all database entries that aren't actually used with the current bridge file
        // not implemented yet (not sure if necessary after all)
    }
    // ouput error messages, if any
    if (is_array($return)) {
        starttable('100%', $lang_bridgemgr_php['error_title']);
        print '<tr><td class="tableb" align="left"><ul>';
        foreach ($return as $key) {
            print '<li>' . $key . '</li>';
        }
        print '</ul></td></tr>';
        print '<tr>' . $new_line;
        print '    <td class="tablef" align="center">' . $new_line;
        print '        <a href="javascript:history.back()" class="admin_menu" title="' . $lang_bridgemgr_php['back'] . '" />&laquo;' . $lang_bridgemgr_php['back'] . '</a>' . $new_line;
        print '    </td>' . $new_line;
        print '</tr>' . $new_line;
        endtable();
        $error = 1;
    }
    print '<br />';
    if ($error != '') {
        return 'error';
    }
}
Ejemplo n.º 9
0
                                        <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();
Ejemplo n.º 10
0
function visiblehookpoints_configure()
{
    global $CONFIG, $lang_plugin_visiblehookpoints;
    $superCage = Inspekt::makeSuperCage();
    $req_uri = $superCage->server->getMatched('REQUEST_URI', '/([^\\/]+\\.php)$/');
    $req_uri = $req_uri[1];
    if ($CONFIG['plugin_visiblehookpoints_display'] == 1) {
        $invisible = '';
        $visible = 'checked="checked"';
        $admin_only = '';
    } elseif ($CONFIG['plugin_visiblehookpoints_display'] == 0) {
        $invisible = 'checked="checked"';
        $visible = '';
        $admin_only = '';
    } else {
        $invisible = '';
        $visible = '';
        $admin_only = 'checked="checked"';
    }
    $help_invisible = '&nbsp;' . cpg_display_help('f=empty.htm&amp;h=lang_plugin_visiblehookpoints[help_invisible_header]&amp;t=lang_plugin_visiblehookpoints[help_invisible_text]', 470, 245);
    $help_visible = '&nbsp;' . cpg_display_help('f=empty.htm&amp;h=lang_plugin_visiblehookpoints[help_visible_header]&amp;t=lang_plugin_visiblehookpoints[help_visible_text]', 470, 245);
    echo <<<EOT
    <form name="cpgform" id="cpgform" action="{$req_uri}" method="post">
EOT;
    starttable('100%', $lang_plugin_visiblehookpoints['config_name'] . ' - ' . $lang_plugin_visiblehookpoints['plugin_config'], 1);
    echo <<<EOT
              <tr>
                <td class="tableh2">
                  <h3>{$lang_plugin_visiblehookpoints['visibility_choose']}</h3>
                </td>
              </tr>
              <tr>
                <td class="tableb">
                  <input type="radio" name="visiblehookpoints_display" id="invisible" value="0" class="radio" {$invisible} />
                  <label for="invisible" class="clickable_option">{$lang_plugin_visiblehookpoints['visibility_parameter']}</label>{$help_invisible}
              </tr>
              <tr>
                <td class="tableb tableb_alternate">
                  <input type="radio" name="visiblehookpoints_display" id="visible" value="1" class="radio" {$visible} />
                  <label for="visible" class="clickable_option">{$lang_plugin_visiblehookpoints['visibility_permanent']}</label>{$help_visible}
              </tr>
              <!--<tr>
                <td class="tableb">
                  <input type="radio" name="visiblehookpoints_display" id="admin_only" value="2" class="radio" {$admin_only} />
                  <label for="admin_only" class="clickable_option">{$lang_plugin_visiblehookpoints['visibility_admin']}</label>
              </tr>-->
              <tr>
                <td class="tablef">
                  <input type="submit" value="{$lang_plugin_visiblehookpoints['save']}" class="button" />
                </td>
              </tr>
EOT;
    endtable();
    echo <<<EOT
    </form>
EOT;
}
Ejemplo n.º 11
0
function display()
{
    global $miner, $port;
    global $mcast, $mcastexpect;
    global $readonly, $notify, $rigs;
    global $ignorerefresh, $autorefresh;
    global $allowcustompages, $customsummarypages;
    global $placebuttons;
    global $userlist, $ses;
    $pagesonly = checklogin();
    if ($pagesonly === 'login') {
        return;
    }
    $mcerr = '';
    if ($rigs == null or count($rigs) == 0) {
        if ($mcast === true) {
            $action = 'found';
        } else {
            $action = 'defined';
        }
        minhead();
        otherrow("<td class=bad>No rigs {$action}</td>");
        return;
    } else {
        if ($mcast === true && count($rigs) < $mcastexpect) {
            $mcerr = othrow('<td class=bad>Found ' . count($rigs) . " rigs but expected at least {$mcastexpect}</td>");
        }
    }
    if ($ignorerefresh == false) {
        $ref = trim(getparam('ref', true));
        if ($ref != null && $ref != '') {
            $autorefresh = intval($ref);
        }
    }
    if ($pagesonly !== true) {
        $rig = trim(getparam('rig', true));
        $arg = trim(getparam('arg', true));
        $preprocess = null;
        if ($arg != null and $arg != '') {
            if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) {
                $parts = explode(':', $rigs[$rig], 3);
                if (count($parts) >= 2) {
                    $miner = $parts[0];
                    $port = $parts[1];
                    if ($readonly !== true) {
                        $preprocess = $arg;
                    }
                }
            }
        }
    }
    if ($allowcustompages === true) {
        $pg = trim(getparam('pg', true));
        if ($pagesonly === true) {
            if ($pg !== null && $pg !== '') {
                if ($userlist !== null && isset($userlist['def']) && !in_array($pg, $userlist['def'])) {
                    $pg = null;
                }
            } else {
                if ($userlist !== null && isset($userlist['def'])) {
                    foreach ($userlist['def'] as $pglook) {
                        if (isset($customsummarypages[$pglook])) {
                            $pg = $pglook;
                            break;
                        }
                    }
                }
            }
        }
        if ($pg !== null && $pg !== '') {
            htmlhead($mcerr, false, null, $pg);
            showcustompage($pg, $mcerr);
            return;
        }
    }
    if ($pagesonly === true) {
        onlylogin();
        return;
    }
    if (count($rigs) == 1) {
        $parts = explode(':', $rigs[0], 3);
        if (count($parts) >= 2) {
            $miner = $parts[0];
            $port = $parts[1];
            htmlhead($mcerr, true, 0);
            doOne(0, $preprocess);
        } else {
            minhead($mcerr);
            otherrow('<td class=bad>Invalid "$rigs" array</td>');
        }
        return;
    }
    if ($rig != null and $rig != '' and $rig >= 0 and $rig < count($rigs)) {
        $parts = explode(':', $rigs[$rig], 3);
        if (count($parts) >= 2) {
            $miner = $parts[0];
            $port = $parts[1];
            htmlhead($mcerr, true, 0);
            doOne($rig, $preprocess);
        } else {
            minhead($mcerr);
            otherrow('<td class=bad>Invalid "$rigs" array</td>');
        }
        return;
    }
    htmlhead($mcerr, false, null);
    if ($placebuttons == 'top' || $placebuttons == 'both') {
        pagebuttons(null, null);
    }
    if ($preprocess != null) {
        process(array($preprocess => $preprocess), $rig);
    }
    newtable();
    doforeach('version', 'rig summary', array(), array(), true);
    $sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH', 'Work Utility', 'Diff1 Shares', 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected', 'Difficulty Stale');
    doforeach('summary', 'summary information', $sum, array(), false);
    endtable();
    otherrow('<td><br><br></td>');
    newtable();
    doforeach('devs', 'device list', $sum, array('' => '', 'ID' => '', 'Name' => ''), false);
    endtable();
    otherrow('<td><br><br></td>');
    newtable();
    doforeach('pools', 'pool list', $sum, array('' => ''), false);
    endtable();
    if ($placebuttons == 'bot' || $placebuttons == 'both') {
        pagebuttons(null, null);
    }
}
Ejemplo n.º 12
0
function individualStatsByBrowser($pid = '', $type = 'hits', $tableWidth = '100%')
{
    global $browserArray, $CONFIG, $lang_stat_details_php, $icon_array;
    $maxBarWidth = 200;
    if (GALLERY_ADMIN_MODE == true) {
        foreach ($browserArray as $key => $value) {
            $query = "SELECT COUNT(*) FROM ";
            if ($type == 'vote') {
                $query .= $CONFIG['TABLE_VOTE_STATS'];
            } else {
                $query .= $CONFIG['TABLE_HIT_STATS'];
            }
            $query .= " WHERE browser = '{$key}'";
            if ($pid != '') {
                $query .= " AND pid='{$pid}'";
            }
            // Now this is a very crude way to query the database which is bound to overload larger galleries. Should be reviewed!
            $result = cpg_db_query($query);
            $row = mysql_fetch_array($result);
            if ($row[0] != 0) {
                $browserResultArray[$key] = $row[0];
            }
        }
        array_multisort($browserResultArray, SORT_DESC);
        $browserTotal = array_sum($browserResultArray);
        print '<a name="browser"></a>';
        starttable($tableWidth, $icon_array['browser'] . $lang_stat_details_php['stats_by_browser'], 3);
        print <<<EOT
        <tr>
          <td class="tableh2" colspan="2">{$lang_stat_details_php['browser']}</td>
          <td class="tableh2" align="left">{$lang_stat_details_php['number_of_hits']} (%)</td>
        </tr>
EOT;
        $loopCounter = 0;
        foreach ($browserResultArray as $key => $value) {
            $individualBarWidth = floor($value * $maxBarWidth / $browserTotal);
            $individualPercentage = floor($value * 1000 / $browserTotal) / 10;
            if ($individualPercentage == floor($individualPercentage)) {
                $individualPercentage .= '.0';
            }
            if ($loopCounter == 0) {
                $row_style_class = 'tableb';
                $loopCounter++;
            } else {
                $row_style_class = 'tableb tableb_alternate';
                $loopCounter = 0;
            }
            print <<<EOT
          <tr>
            <td class="{$row_style_class}" width="20"><img src="images/browser/{$browserArray[$key]}" width="14" height="14" border="0" title="{$key}" alt="" /></td>
            <td class="{$row_style_class}">{$key}</td>
            <td class="{$row_style_class}" align="left">
EOT;
            print theme_display_bar($value, $browserTotal, 200, '', '', ' (' . $individualPercentage . ' %)');
            print <<<EOT
            </td>
          </tr>
EOT;
        }
        print <<<EOT
        <tr>
          <td class="tablef" colspan="2">{$lang_stat_details_php['total']}</td>
          <td class="tablef" align="left">{$browserTotal}</td>
        </tr>
EOT;
        endtable();
        print '<br />';
    }
}
Ejemplo n.º 13
0
function slideshow()
{
    global $CONFIG, $template_display_picture, $CPG_M_DIR;
    if (function_exists('theme_slideshow')) {
        theme_slideshow();
        return;
    }
    pageheader(SLIDESHOW_TITLE);
    require_once "includes/coppermine/slideshow.inc";
    $start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>';
    template_extract_block($template_display_picture, 'img_desc', $start_slideshow);
    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100, '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" alt="" /><br />', '{ADMIN_MENU}' => '');
    starttable();
    echo template_eval($template_display_picture, $params);
    endtable();
    starttable();
    echo '
		<tr>
		<td style="text-align:center"  class="navmenu" style="white-space: nowrap;">
		<a href="javascript:endSlideShow()" class="navmenu">' . STOP_SLIDESHOW . '</a>
		</td>
		</tr>
';
    endtable();
    pagefooter();
}
Ejemplo n.º 14
0
function theme_slideshow($start_img, $title)
{
    global $CONFIG, $lang_display_image_php, $template_display_media, $lang_common, $album, $pid, $slideshow;
    global $cat, $date, $THEME_DIR;
    pageheader($lang_display_image_php['slideshow']);
    template_extract_block($template_display_media, 'img_desc', $start_slideshow);
    /** set styles to slideshow background */
    $setDimentionW = $CONFIG['picture_width'] + 100;
    $setDimentionH = $CONFIG['picture_width'] + 10;
    if (defined('THEME_HAS_PROGRESS_GRAPHICS')) {
        $prefix = $THEME_DIR;
    } else {
        $prefix = '';
    }
    $params = array('{SLIDESHOW_STYLE}' => 'width:' . $setDimentionW . 'px; height: ' . $setDimentionH . 'px; position: relative;', '{IMAGE}' => '<img id="showImage" src="' . $start_img . '" class="image" alt="" border="" /><br />', '{ADMIN_MENU}' => '', '{LOADER_ICON_PATH}' => $prefix . 'images/loader.gif');
    echo '<a name="top_display_media"></a>';
    starttable();
    echo <<<EOT
        <tr class="noscript">
            <td align="center" class="tableh2">
              <noscript>
                  {$lang_common['javascript_needed']}
              </noscript>
            </td>
        </tr>
        <tr>
            <td align="center" class="navmenu" style="white-space: nowrap;">
                <div id="title">{$title}</div>
            </td>
        </tr>
EOT;
    endtable();
    starttable();
    echo template_eval($template_display_media, $params);
    endtable();
    starttable();
    echo <<<EOT
        <tr>
                <td align="center" id="back-to" class="navmenu" >
                        <a class="navmenu" style="cursor:pointer">{$lang_display_image_php['stop_slideshow']}</a>
                </td>
        </tr>

EOT;
    endtable();
    pagefooter();
}
Ejemplo n.º 15
0
function processcustompage($pagename, $sections, $sum, $ext, $namemap)
{
    global $sectionmap;
    global $miner, $port;
    global $rigs, $error;
    global $warnfont, $warnoff;
    global $dfmt;
    global $readonly, $showndate;
    $cmds = array();
    $errors = array();
    foreach ($sections as $section => $fields) {
        $all = explode('+', $section);
        foreach ($all as $section) {
            if (isset($sectionmap[$section])) {
                $cmd = $sectionmap[$section];
                if (!isset($cmds[$cmd])) {
                    $cmds[$cmd] = 1;
                }
            } else {
                if ($section != 'DATE') {
                    $errors[] = "Error: unknown section '{$section}' in custom summary page '{$pagename}'";
                }
            }
        }
    }
    $results = array();
    foreach ($rigs as $num => $rig) {
        $parts = explode(':', $rig, 3);
        if (count($parts) >= 1) {
            $miner = $parts[0];
            if (count($parts) >= 2) {
                $port = $parts[1];
            } else {
                $port = '';
            }
            if (count($parts) > 2) {
                $name = $parts[2];
            } else {
                $name = $rig;
            }
            foreach ($cmds as $cmd => $one) {
                $process = api($name, $cmd);
                if ($error != null) {
                    $errors[] = "Error getting {$cmd} for {$name} {$warnfont}{$error}{$warnoff}";
                    break;
                } else {
                    $results[$cmd][$num] = $process;
                }
            }
        } else {
            otherrow('<td class=bad>Bad "$rigs" array</td>');
        }
    }
    // Show API errors at the top
    if (count($errors) > 0) {
        foreach ($errors as $err) {
            otherrow("<td colspan=100>{$err}</td>");
        }
        $errors = array();
    }
    $shownsomething = false;
    if (count($results) > 0) {
        list($results, $errors) = joinsections($sections, $results, $errors);
        $first = true;
        foreach ($sections as $section => $fields) {
            if ($section === 'DATE') {
                if ($shownsomething) {
                    otherrow('<td>&nbsp;</td>');
                }
                newtable();
                showdatetime();
                endtable();
                // On top of the next table
                $shownsomething = false;
                continue;
            }
            if ($section === 'RIGS') {
                if ($shownsomething) {
                    otherrow('<td>&nbsp;</td>');
                }
                newtable();
                showrigs($results['version'], 'Rig', '');
                endtable();
                $shownsomething = true;
                continue;
            }
            if (isset($results[$sectionmap[$section]])) {
                if (isset($ext[$section]['fmt'])) {
                    $cf = $ext[$section]['fmt'];
                } else {
                    $cf = NULL;
                }
                $rigresults = processext($ext, $section, $results[$sectionmap[$section]], $fields);
                $showfields = array();
                $showhead = array();
                foreach ($fields as $field) {
                    foreach ($rigresults as $result) {
                        foreach ($result as $sec => $row) {
                            $secname = preg_replace('/\\d/', '', $sec);
                            if (secmatch($section, $secname)) {
                                if ($field === '*') {
                                    foreach ($row as $f => $v) {
                                        $showfields[$f] = 1;
                                        $map = $section . '.' . $f;
                                        if (isset($namemap[$map])) {
                                            $showhead[$namemap[$map]] = 1;
                                        } else {
                                            $showhead[$f] = 1;
                                        }
                                    }
                                } elseif ($field === '#') {
                                    $showfields[$field] = 1;
                                    $showhead[$field] = 1;
                                } elseif (isset($row[$field])) {
                                    $showfields[$field] = 1;
                                    $map = $section . '.' . $field;
                                    if (isset($namemap[$map])) {
                                        $showhead[$namemap[$map]] = 1;
                                    } else {
                                        $showhead[$field] = 1;
                                    }
                                }
                            }
                        }
                    }
                }
                if (count($showfields) > 0) {
                    if ($shownsomething) {
                        otherrow('<td>&nbsp;</td>');
                    }
                    newtable();
                    if (count($rigresults) == 1 && isset($rigresults[''])) {
                        $ri = array('' => 1) + $showhead;
                    } else {
                        $ri = array('Rig' => 1) + $showhead;
                    }
                    showhead('', $ri, true);
                    $total = array();
                    $add = array('total' => array());
                    foreach ($rigresults as $num => $result) {
                        $total = customset($showfields, $sum, $section, $num, true, $result, $total, $cf);
                    }
                    if (count($total) > 0) {
                        customset($showfields, $sum, $section, '&Sigma;', false, $add, $total, $cf);
                    }
                    $first = false;
                    endtable();
                    $shownsomething = true;
                }
            }
        }
    }
    if (count($errors) > 0) {
        if (count($results) > 0) {
            otherrow('<td>&nbsp;</td>');
        }
        foreach ($errors as $err) {
            otherrow("<td colspan=100>{$err}</td>");
        }
    }
}
Ejemplo n.º 16
0
function input_user_info($errors = '')
{
    global $CONFIG;
    //, $PHP_SELF;
    global $lang_register_php;
    starttable(-1, $lang_register_php['enter_info'], 2);
    echo <<<EOT
        <form method="post" action="{$_SERVER['PHP_SELF']}">

EOT;
    $form_data = array(array('label', $lang_register_php['required_info']), array('input', 'username', $lang_register_php['username'], 25), array('password', 'password', $lang_register_php['password'], 25), array('password', 'password_verification', $lang_register_php['password_again'], 25), array('input', 'email', $lang_register_php['email'], 255), array('label', $lang_register_php['optional_info']), array('input', 'user_profile1', $CONFIG['user_profile1_name'], 255), array('input', 'user_profile2', $CONFIG['user_profile2_name'], 255), array('input', 'user_profile3', $CONFIG['user_profile3_name'], 255), array('input', 'user_profile4', $CONFIG['user_profile4_name'], 255), array('input', 'user_profile5', $CONFIG['user_profile5_name'], 255), array('textarea', 'user_profile6', $CONFIG['user_profile6_name'], 255));
    foreach ($form_data as $element) {
        switch ($element[0]) {
            case 'label':
                echo <<<EOT
        <tr>
            <td colspan="2" class="tableh2">
                        <b>{$element[1]}<b>
        </td>
        </tr>

EOT;
                break;
            case 'input':
                if (isset($_POST[$element[1]])) {
                    $value = $_POST[$element[1]];
                } else {
                    $value = '';
                }
                if ($element[2]) {
                    echo <<<EOT
        <tr>
            <td width="40%" class="tableb"  height="25">
                        {$element[2]}
        </td>
        <td width="60%" class="tableb" valign="top">
                <input type="text" style="width: 100%" name="{$element[1]}" maxlength="{$element[3]}" value="{$value}" class="textinput" />
                </td>
        </tr>

EOT;
                }
                break;
            case 'radio':
                // added the radio option for possible future use. The array definition would have to look like this:
                // array('radio', 'user_var', 'Text label', 'option 1','option 2'),
                // enabling this option requires changes in profile.php and usermgr.php as well
                if (isset($_POST[$element[1]])) {
                    $value = $_POST[$element[1]];
                } else {
                    $value = '';
                }
                if ($element[2]) {
                    echo <<<EOT
        <tr>
            <td width="40%" class="tableb"  height="25">
                        {$element[2]}
        </td>
        <td width="60%" class="tableb" valign="top">
                <input type="radio" name="{$element[1]}" id="{$element[1]}1" value="{$element[3]}" class="radio" /><label for="{$element[1]}1" class="clickable_option">{$element[3]}</label>
                <input type="radio" name="{$element[1]}" id="{$element[1]}2" value="{$element[4]}" class="radio" /><label for="{$element[1]}2" class="clickable_option">{$element[4]}</label>
                </td>
        </tr>

EOT;
                }
                break;
            case 'textarea':
                if (isset($_POST[$element[1]])) {
                    $value = $_POST[$element[1]];
                } else {
                    $value = '';
                }
                if ($element[2]) {
                    echo <<<EOT
        <tr>
            <td width="40%" class="tableb"  height="25">
                        {$element[2]}
        </td>
        <td width="60%" class="tableb" valign="top">
                <textarea name="{$element[1]}" rows="7" wrap="virtual"  class="textinput" style="width:100%">{$value}</textarea>
                </td>
        </tr>


EOT;
                }
                break;
            case 'password':
                echo <<<EOT
        <tr>
            <td width="40%" class="tableb"  height="25">
                        {$element[2]}
        </td>
        <td width="60%" class="tableb" valign="top">
                <input type="password" style="width: 100%" name="{$element[1]}" maxlength="{$element[3]}" value="" class="textinput" />
                </td>
        </tr>

EOT;
                break;
            default:
                cpg_die(CRITICAL_ERROR, 'Invalid action for form creation ' . $element[0], __FILE__, __LINE__);
        }
    }
    if ($errors) {
        echo <<<EOT
        <tr>
                <td colspan="2" class="tableh2" align="center">
                        <b>&#149;&nbsp;&#149;&nbsp;&#149;&nbsp;{$lang_register_php['error']}&nbsp;&#149;&nbsp;&#149;&nbsp;&#149;</b>
                </td>
        </tr>
        <tr>
                <td colspan="2" class="tableb">
                        <b><ul>{$errors}</ul><b>
                </td>
        </tr>

EOT;
    }
    echo <<<EOT
        <tr>
                <td colspan="2" align="center" class="tablef">
                        <input type="submit" name="submit" value="{$lang_register_php['submit']}" class="button" />
                </td>
        </tr>
        </form>

EOT;
    endtable();
}
Ejemplo n.º 17
0
function write_to_db($step)
{
    global $BRIDGE, $CONFIG, $default_bridge_data, $lang_bridgemgr_php, $posted_var, $LINEBREAK;
    $error = 0;
    // do the check for plausibility of posted data
    foreach ($posted_var as $key => $value) {
        // loop through the posted data -- start
        // filter the post data that doesn't get written
        if (array_key_exists($key, $BRIDGE)) {
            // post data exists as db key -- start
            // do the lookups
            $options = explode(',', $default_bridge_data[$BRIDGE['short_name']][$key . '_used']);
            foreach ($options as $key2) {
                $options[$key2] = trim($options[$key2], ',');
                // get rid of the delimiters
            }
            if ($options[0] != '') {
                // only continue with this loop if there really is an option to check --- start
                if ($options[0] == 'lookfor') {
                    // check for the existance of a local file/folder --- start
                    if (file_exists($value . $options[1]) == false) {
                        $return[$key] = sprintf($lang_bridgemgr_php['error_folder_not_exist'], '<tt>' . $value . $options[1] . '</tt>', '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                    }
                }
                // check for the existance of a file/folder --- end
                if ($options[0] == 'cookie') {
                    // check for the existance of a cookie --- start
                    foreach ($_COOKIE as $key2 => $value2) {
                        // loop through the cookie global var --- start
                        //print '<br>cookie:'.$key2.', content:'.$value2.'<br />' . $LINEBREAK;
                        if (@strstr($key2, $value) == false && $options[1] == 'not_empty') {
                            $return[$key] = sprintf($lang_bridgemgr_php['error_cookie_not_readible'], '&quot;<tt>' . $value . '</tt>*&quot;', '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                        }
                    }
                    // loop through the cookie global var --- end
                    if (isset($temp_err)) {
                        $return[$key] = $temp_err;
                    }
                }
                // check for the existance of a cookie --- end
                if ($options[1] == 'not_empty') {
                    // check for empty mandatory fields --- start
                    if ($value == '') {
                        $return[$key] = sprintf($lang_bridgemgr_php['error_mandatory_field_empty'], '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                    }
                }
                // check for empty mandatory fields --- end
                if ($options[0] == 'no_trailing_slash' || $options[1] == 'no_trailing_slash' || $options[2] == 'no_trailing_slash') {
                    // check for unneeded trailing slashes --- start
                    if ($value != rtrim($value, '/')) {
                        $return[$key] = sprintf($lang_bridgemgr_php['error_no_trailing_slash'], '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                    }
                }
                // check for unneeded traling slashes --- end
                if ($options[0] == 'trailing_slash' || $options[1] == 'trailing_slash' || $options[2] == 'trailing_slash') {
                    // check for needed trailing slashes --- start
                    if ($value == rtrim($value, '/')) {
                        $return[$key] = sprintf($lang_bridgemgr_php['error_trailing_slash'], '<i>' . $lang_bridgemgr_php[$key] . '</i>');
                    }
                }
                // check for needed traling slashes --- end
            }
            // only continue with this loop if there really is an option to check --- end
        }
        // post data exists as db key -- end
    }
    // loop through the posted data -- end
    // loop through the expected data
    //void
    // do some checking according to the step we're currently in
    switch ($step) {
        case "choose_bbs":
            if ($posted_var['short_name'] == '') {
                $return['short_name'] = $lang_bridgemgr_php['error_specify_bbs'];
                $error++;
            }
            if ($posted_var['short_name'] == 'custom_selector') {
                $posted_var['short_name'] = $posted_var['custom_filename'];
                if ($posted_var['short_name'] == '') {
                    $return['short_name'] = $lang_bridgemgr_php['error_no_blank_name'];
                }
                if (preg_match('/[^a-z0-9_-]/i', $posted_var['short_name'])) {
                    $return['short_name'] = $lang_bridgemgr_php['error_no_special_chars'];
                }
            }
            // check if the bridge file actually exists
            if (file_exists('bridge/' . $posted_var['short_name'] . '.inc.php') == false) {
                $return['bridge_file_not_exist'] = sprintf($lang_bridgemgr_php['error_bridge_file_not_exist'], '<i>bridge/' . $posted_var['short_name'] . '.inc.php</i>');
            }
            break;
        case "settings_path":
            //if ($posted_var['short_name'] == '') {
            //    $return['short_name'] = $lang_bridgemgr_php['error_specify_bbs'];
            //}
            break;
    }
    // end switch
    // write the post data to the database
    foreach ($posted_var as $key => $value) {
        // filter the post data that doesn't get written
        if (array_key_exists($key, $BRIDGE)) {
            if ($CONFIG['debug_mode'] != 0) {
                // print what actually get's written when in debug_mode
                print '<span class="explanation">Writing to database: ';
                print $key . '|' . $value;
                print '<br /></span>';
            }
            if ($return[$key] != '') {
                //print '|Error in this key';
            } else {
                cpg_db_query("UPDATE {$CONFIG['TABLE_BRIDGE']} SET value = '{$value}' WHERE name = '{$key}'");
            }
            //print '<br />';
        }
    }
    $value = $posted_var['bridge_enable'];
    if ($value != '0' && $value != '1') {
        $value = $CONFIG['bridge_enable'];
    }
    cpg_config_set('bridge_enable', $value);
    if ($posted_var['clear_unused_db_fields'] == 1) {
        // clear all database entries that aren't actually used with the current bridge file
        // not implemented yet (not sure if necessary after all)
    }
    // ouput error messages, if any
    if (is_array($return)) {
        starttable(-1, $lang_bridgemgr_php['error_title']);
        print '<tr><td class="tableb" align="left"><ul>';
        foreach ($return as $key) {
            print '<li>' . $key . '</li>';
        }
        print '</ul></td></tr>';
        print '<tr>' . $LINEBREAK;
        print '    <td class="tablef" align="center">' . $LINEBREAK;
        print '        <a href="javascript:history.back()" class="admin_menu" title="' . $lang_bridgemgr_php['back'] . '" />&laquo;' . $lang_bridgemgr_php['back'] . '</a>' . $LINEBREAK;
        print '    </td>' . $LINEBREAK;
        print '</tr>' . $LINEBREAK;
        endtable();
        $error = 1;
    }
    print '<br />';
    if ($error != '') {
        return 'error';
    }
}
Ejemplo n.º 18
0
/**
* input_user_info()
*
* Display the form fields
*
* @param string $errors
* @return void
**/
function input_user_info($errors = '')
{
    // function input_user_info - start
    global $CONFIG, $CPG_PHP_SELF;
    //, $PHP_SELF;
    global $lang_register_php, $lang_register_disclamer, $lang_common;
    $superCage = Inspekt::makeSuperCage();
    echo <<<EOT
        <form name="cpgform" id="cpgform" method="post" action="{$CPG_PHP_SELF}">

EOT;
    starttable(-1, $lang_register_php['enter_info'], 2);
    $inline_disclaimer = str_replace('{SITE_NAME}', $CONFIG['gallery_name'], $lang_register_disclamer);
    $form_data = array(array('label', $lang_register_php['required_info']), array('input', 'username', $lang_register_php['username'], 25), !empty($CONFIG['global_registration_pw']) ? array('password', 'global_registration_pw', $lang_register_php['global_registration_pw'], 25) : '', array('password', 'password', $lang_register_php['password'], 25), array('password', 'password_verification', $lang_register_php['password_again'], 25), array('input', 'email', $lang_register_php['email'], 255), array('label', $lang_register_php['optional_info']), array('input', 'user_profile1', $CONFIG['user_profile1_name'], 255), array('input', 'user_profile2', $CONFIG['user_profile2_name'], 255), array('input', 'user_profile3', $CONFIG['user_profile3_name'], 255), array('input', 'user_profile4', $CONFIG['user_profile4_name'], 255), array('input', 'user_profile5', $CONFIG['user_profile5_name'], 255), array('textarea', 'user_profile6', $CONFIG['user_profile6_name'], 255));
    if ($CONFIG['user_registration_disclaimer'] == 2) {
        array_push($form_data, array('label', $lang_register_php['term_cond']), array('checkbox', 'agree', $inline_disclaimer, $lang_register_php['i_agree'], 1));
    } else {
        array_push($form_data, array('hidden', 'agree', 1));
    }
    foreach ($form_data as $element) {
        if (empty($element)) {
            continue;
        }
        switch ($element[0]) {
            case 'label':
                echo <<<EOT
          <tr>
              <td colspan="2" class="tableh2">
                          {$element[1]}
          </td>
          </tr>

EOT;
                break;
            case 'input':
                /*if (isset($_POST[$element[1]])) {
                      $value = $_POST[$element[1]];
                  } else {
                      $value = '';
                  }*/
                if ($superCage->post->keyExists($element[1])) {
                    $value = $superCage->post->getEscaped($element[1]);
                } else {
                    $value = '';
                }
                if ($element[2]) {
                    echo <<<EOT
          <tr>
              <td width="40%" class="tableb"  height="25">
                          {$element[2]}
          </td>
          <td width="60%" class="tableb" valign="top">
                  <input type="text" style="width: 100%" name="{$element[1]}" maxlength="{$element[3]}" value="{$value}" class="textinput" />
                  </td>
          </tr>

EOT;
                }
                break;
            case 'radio':
                // added the radio option for possible future use. The array definition would have to look like this:
                // array('radio', 'user_var', 'Text label', 'option 1','option 2'),
                // enabling this option requires changes in profile.php and usermgr.php as well
                //if (isset($_POST[$element[1]])) {
                if ($superCage->post->keyExists($element[1])) {
                    $value = $superCage->post->getAlnum($element[1]);
                } else {
                    $value = '';
                }
                if ($element[2]) {
                    echo <<<EOT
          <tr>
              <td width="40%" class="tableb"  height="25">
                          {$element[2]}
          </td>
          <td width="60%" class="tableb" valign="top">
                  <input type="radio" name="{$element[1]}" id="{$element[1]}1" value="{$element[3]}" class="radio" /><label for="{$element[1]}1" class="clickable_option">{$element[3]}</label>
                  <input type="radio" name="{$element[1]}" id="{$element[1]}2" value="{$element[4]}" class="radio" /><label for="{$element[1]}2" class="clickable_option">{$element[4]}</label>
                  </td>
          </tr>

EOT;
                }
                break;
            case 'checkbox':
                // added the checkbox option for possible future use. The array definition would have to look like this:
                // array('radio', 'user_var', 'preceeding text', 'Text label', 'value'),
                // enabling this option requires changes in profile.php and usermgr.php as well
                if ($superCage->post->keyExists($element[1])) {
                    $value = $superCage->post->getAlnum($element[1]);
                } else {
                    $value = '';
                }
                if ($element[3]) {
                    echo <<<EOT
          <tr>
              <td class="tableb" colspan="2">
                          {$element[2]}
                          <br />
                          <input type="checkbox" name="{$element[1]}" id="{$element[1]}" value="{$element[4]}" class="checkbox" /><label for="{$element[1]}" class="clickable_option">{$element[3]}</label>
              </td>
          </tr>

EOT;
                }
                break;
            case 'textarea':
                /*if (isset($_POST[$element[1]])) {
                      $value = $_POST[$element[1]];
                  } else {
                      $value = '';
                  }*/
                if ($superCage->post->keyExists($element[1])) {
                    $value = $superCage->post->getEscaped($element[1]);
                } else {
                    $value = '';
                }
                if ($element[2]) {
                    echo <<<EOT
          <tr>
              <td width="40%" class="tableb"  height="25">
                          {$element[2]}
          </td>
          <td width="60%" class="tableb" valign="top">
                  <textarea name="{$element[1]}" rows="7" wrap="virtual"  class="textinput" style="width:100%">{$value}</textarea>
                  </td>
          </tr>


EOT;
                }
                break;
            case 'password':
                echo <<<EOT
          <tr>
              <td width="40%" class="tableb"  height="25">
                          {$element[2]}
          </td>
          <td width="60%" class="tableb" valign="top">
                  <input type="password" style="width: 100%" name="{$element[1]}" maxlength="{$element[3]}" value="" class="textinput" />
                  </td>
          </tr>

EOT;
                break;
            case 'hidden':
                echo <<<EOT
                <input type="hidden" name="{$element[1]}" value="{$element[2]}" />

EOT;
                break;
            default:
                cpg_die(CRITICAL_ERROR, 'Invalid action for form creation ' . $element[0], __FILE__, __LINE__);
        }
    }
    if ($errors) {
        echo <<<EOT
        <tr>
                <td colspan="2" class="tableh2" align="center">
                        <b>&#149;&nbsp;&#149;&nbsp;&#149;&nbsp;{$lang_register_php['error']}&nbsp;&#149;&nbsp;&#149;&nbsp;&#149;</b>
                </td>
        </tr>
        <tr>
                <td colspan="2" class="tableb">
                        <ul>{$errors}</ul>
                </td>
        </tr>

EOT;
    }
    // captcha code
    if ($CONFIG['registration_captcha'] != 0) {
        $help = cpg_display_help('f=empty.htm&amp;base=64&amp;h=' . urlencode(base64_encode(serialize($lang_common['captcha_help_title']))) . '&amp;t=' . urlencode(base64_encode(serialize($lang_common['captcha_help']))), 470, 245);
        echo <<<EOT
        <tr>
                <td align="right" class="tablef">
                    {$lang_common['confirm']}&nbsp;{$help}
                </td>
                <td class="tablef">
                    <input type="text" name="confirmCode" size="5" maxlength="5" class="textinput" />
                    <img src="captcha.php" align="middle" border="0" alt="" />
                </td>
        </tr>
EOT;
    }
    echo <<<EOT
        <tr>
                <td colspan="2" align="center" class="tablef">
                        <input type="submit" name="submit" value="{$lang_register_php['submit']}" class="button" />
                </td>
        </tr>
        </form>

EOT;
    endtable();
}
Ejemplo n.º 19
0
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();
}
Ejemplo n.º 20
0
function visiblehookpoints_configure()
{
    global $CONFIG;
    $superCage = Inspekt::makeSuperCage();
    $req_uri = $superCage->server->getMatched('REQUEST_URI', '/([^\\/]+\\.php)$/');
    $req_uri = $req_uri[1];
    if ($CONFIG['plugin_visiblehookpoints_display'] == 1) {
        $invisible = '';
        $visible = 'checked="checked"';
    } else {
        $invisible = 'checked="checked"';
        $visible = '';
    }
    $help_invisible = '&nbsp;' . cpg_display_help('f=empty.htm&amp;base=64&amp;h=' . urlencode(base64_encode(serialize('Adding the hookpoint parameter manually'))) . '&amp;t=' . urlencode(base64_encode(serialize('Manually add the parameter &quot;hookpoint&quot; to the URL in the address bar of your browser (e.g. <tt class="code">' . $CONFIG['ecards_more_pic_target'] . 'index.php?hookpoint</tt>) to see the hookpoints. This option is meant for live, production galleries, where you wouldn\'t want to display the hookpoints to every site visitor.'))), 470, 245);
    $help_visible = '&nbsp;' . cpg_display_help('f=empty.htm&amp;base=64&amp;h=' . urlencode(base64_encode(serialize('Displaying the hookpoints for everyone'))) . '&amp;t=' . urlencode(base64_encode(serialize('Only choose this option on your testbed server, i.e. for galleries that don\'t run in a production environment, as the hookpoints will be displayed for all gallery visitors.'))), 470, 245);
    echo <<<EOT
    <form name="cpgform" id="cpgform" action="{$req_uri}" method="post">
EOT;
    starttable('100%', 'Configuration of plugin &quot;Visible HookPoints&quot;', 1);
    echo <<<EOT
              <tr>
                <td class="tableh2">
                  <h3>Choose visibility option of hooks</h3>
                </td>
              </tr>
              <tr>
                <td class="tableb">
                  <input type="radio" name="visiblehookpoints_display" id="invisible" value="0" class="radio" {$invisible} />
                  <label for="invisible" class="clickable_option">Only visible with URL-parameter &quot;hookpoints&quot;</label>{$help_invisible}
              </tr>
              <tr>
                <td class="tableb">
                  <input type="radio" name="visiblehookpoints_display" id="visible" value="1" class="radio" {$visible} />
                  <label for="visible" class="clickable_option">Visible permanently for everyone</label>{$help_visible}
              </tr>
              <tr>
                <td class="tablef">
                  <input type="submit" value="Go!" class="button" />
                </td>
              </tr>
EOT;
    endtable();
    echo <<<EOT
    </form>
EOT;
}
Ejemplo n.º 21
0
function imageflow_mainpage($matches)
{
    global $CONFIG, $lang_plugin_imageflow, $FORBIDDEN_SET, $IMAGEFLOWSET, $lang_meta_album_names, $META_ALBUM_SET;
    if ($matches[1] != 'imageflow') {
        return $matches;
    }
    require './plugins/imageflow/include/init.inc.php';
    echo "<!-- Start Imageflow PlugIn " . $lang_plugin_imageflow['version'] . " -->\n";
    if ($IMAGEFLOWSET['imageflow_standardtable']) {
        starttable("100%", $lang_meta_album_names[$IMAGEFLOWSET['imageflow_album']]);
        echo "<tr><td>";
    }
    if ($IMAGEFLOWSET['imageflow_align'] == "center") {
        echo "<center>\r\n        ";
    }
    if ($IMAGEFLOWSET['imageflow_intable']) {
        echo "<div id=\"imgflowcontainer\" style=\"width:" . $IMAGEFLOWSET['imageflow_width'] . ";\">\r\n  ";
    }
    ?>
            <div id="imageflow"> 
                <div id="imgflowloading">
                  <b><?php 
    echo $lang_plugin_imageflow['loading'];
    ?>
</b><br/>
                  <img src="plugins/imageflow/js/loading.gif" width="208" height="13" alt="loading" />
                </div>
                <div id="imgflowimages">
<?php 
    // maximum pics to show
    $imageflowlimit = $IMAGEFLOWSET['imageflow_numberofpics'];
    // request of your database
    $imageflow_pics = '';
    $imageflow_FORBIDDEN_SET = "";
    if ($FORBIDDEN_SET != "") {
        $imageflow_FORBIDDEN_SET = "AND {$FORBIDDEN_SET}";
    }
    // request string for meta album toprated
    if ($IMAGEFLOWSET['imageflow_album'] == "toprated") {
        $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} AND votes >= '{$CONFIG['min_votes_for_rating']}' {$META_ALBUM_SET} ORDER BY pic_rating DESC, votes DESC, pid DESC LIMIT {$imageflowlimit}";
    } else {
        if ($IMAGEFLOWSET['imageflow_album'] == "topn") {
            $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} AND hits > 0 {$META_ALBUM_SET} ORDER BY hits DESC, filename LIMIT {$imageflowlimit}";
        } else {
            if ($IMAGEFLOWSET['imageflow_album'] == "lastup") {
                $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} {$META_ALBUM_SET} ORDER BY pid DESC LIMIT {$imageflowlimit}";
            } else {
                $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} {$META_ALBUM_SET} ORDER BY RAND() LIMIT {$imageflowlimit}";
            }
        }
    }
    // result of request
    $imageflow_result = cpg_db_query($imageflow_query);
    // For reading result
    $imageflow_rowset = array();
    // Index of tab
    $i = 0;
    // for each pic build HTML code
    $imgflow_fixedsize = 0;
    if (strtolower(substr($IMAGEFLOWSET['imageflow_width'], -2)) == "px") {
        $imgflow_fixedsize = trim(substr($IMAGEFLOWSET['imageflow_width'], 0, strlen($IMAGEFLOWSET['imageflow_width']) - 2));
    }
    while ($imageflow_row = mysql_fetch_array($imageflow_result)) {
        if (!$IMAGEFLOWSET['imageflow_skipportrait'] || $imageflow_row['pwidth'] > $imageflow_row['pheight']) {
            // reading pid of pic
            $imageflow_key = $imageflow_row['pid'];
            // path of pic, depending if intermediate image is there or not
            $imageflow_file = get_pic_url($imageflow_row, $IMAGEFLOWSET['imageflow_pictype']);
            if (!cpgif_my_is_file($imageflow_file)) {
                $imageflow_file = get_pic_url($imageflow_row, 'fullsize');
            }
            $imageflow_reflfile = get_pic_url($imageflow_row, 'normal');
            if (!cpgif_my_is_file($imageflow_reflfile)) {
                $imageflow_reflfile = get_pic_url($imageflow_row, 'fullsize');
            }
            $imageflow_temppercent = $IMAGEFLOWSET['imageflow_procent'];
            if ($imageflow_row['pwidth'] < $CONFIG['picture_width'] && $imageflow_row['pheight'] < $CONFIG['picture_width']) {
                $imageflow_temppercent = 1;
            }
            // link of pic
            if ($IMAGEFLOWSET['imageflow_useenlarge']) {
                if ($imgflow_fixedsize == 0) {
                    $imageflow_lien = "<img src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;procent=" . $imageflow_temppercent . "&amp;cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&amp;img=" . $imageflow_reflfile . "\" longdesc=\"" . $imageflow_file . "\"  class=\"imgflowimg\" name=\"" . $imageflow_row['pid'] . "\" alt=\"" . $imageflow_row['title'] . "\" id=\"iflowpic" . $i . "\" title=\"\" />";
                } else {
                    $imageflow_lien = "<img src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;fixed=" . $imgflow_fixedsize . "&amp;cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&amp;img=" . $imageflow_reflfile . "\" longdesc=\"" . $imageflow_file . "\"   class=\"imgflowimg\" name=\"" . $imageflow_row['pid'] . "\" alt=\"" . $imageflow_row['title'] . "\" id=\"iflowpic" . $i . "\" title=\"\" />";
                }
            } else {
                if ($imgflow_fixedsize == 0) {
                    $imageflow_lien = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;procent=" . $imageflow_temppercent . "&amp;cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&amp;img=" . $imageflow_reflfile . "\" longdesc=\"displayimage.php?pos=-" . $imageflow_key . "\"  alt=\"" . $imageflow_row['title'] . "\" />";
                } else {
                    $imageflow_lien = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;fixed=" . $imgflow_fixedsize . "&amp;cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&amp;img=" . $imageflow_reflfile . "\" longdesc=\"displayimage.php?pos=-" . $imageflow_key . "\"  alt=\"" . $imageflow_row['title'] . "\" />";
                }
            }
            // building HTML code
            $imageflow_pics .= $imageflow_lien . "\n";
            $i = $i + 1;
        }
    }
    // free memory
    mysql_free_result($imageflow_result);
    /* fill if not enough pictures in current category
       if 3 or 4, repeat once to get 6 or 8 pics; if 2, repeat four times to get 8 pics; if only 1, repeat 8 times to get 8 pics */
    if ($i < 5) {
        $imageflow_pics = $imageflow_pics . str_replace("iflowpic", "iflow2pic", $imageflow_pics);
    }
    if ($i < 3) {
        $imageflow_pics = $imageflow_pics . str_replace("iflowpic", "iflow3pic", str_replace("iflow2pic", "iflow4pic", $imageflow_pics));
    }
    if ($i < 2) {
        $imageflow_pics = $imageflow_pics . str_replace("iflow4pic", "iflow8pic", str_replace("iflow3pic", "iflow7pic", str_replace("iflowpic", "iflow5pic", str_replace("iflow2pic", "iflow6pic", $imageflow_pics))));
    }
    // if no pictures found at all in current category, simply take random pictures from whole gallery
    if ($i < 1) {
        $imageflow_pics = '';
        $imageflow_FORBIDDEN_SET = "";
        if ($FORBIDDEN_SET != "") {
            $imageflow_FORBIDDEN_SET = "AND {$FORBIDDEN_SET}";
        }
        $imageflow_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$imageflow_FORBIDDEN_SET} ORDER BY RAND() LIMIT {$imageflowlimit}";
        // result of request
        $imageflow_result = cpg_db_query($imageflow_query);
        // For reading result
        $imageflow_rowset = array();
        // Index of tab
        $i = 0;
        // For each pic.....building HTML in php
        $imgflow_fixedsize = 0;
        if (strtolower(substr($IMAGEFLOWSET['imageflow_width'], -2)) == "px") {
            $imgflow_fixedsize = trim(substr($IMAGEFLOWSET['imageflow_width'], 0, strlen($IMAGEFLOWSET['imageflow_width']) - 2));
        }
        while ($imageflow_row = mysql_fetch_array($imageflow_result)) {
            if (!$IMAGEFLOWSET['imageflow_skipportrait'] || $imageflow_row['pwidth'] > $imageflow_row['pheight']) {
                // reading pid of pic
                $imageflow_key = $imageflow_row['pid'];
                // path of pic, depending if intermediate image is there or not
                $imageflow_file = get_pic_url($imageflow_row, $IMAGEFLOWSET['imageflow_pictype']);
                if (!cpgif_my_is_file($imageflow_file)) {
                    $imageflow_file = get_pic_url($imageflow_row, 'fullsize');
                }
                $imageflow_reflfile = get_pic_url($imageflow_row, 'normal');
                if (!cpgif_my_is_file($imageflow_reflfile)) {
                    $imageflow_reflfile = get_pic_url($imageflow_row, 'fullsize');
                }
                $imageflow_temppercent = $IMAGEFLOWSET['imageflow_procent'];
                if ($imageflow_row['pwidth'] < $CONFIG['picture_width'] && $imageflow_row['pheight'] < $CONFIG['picture_width']) {
                    $imageflow_temppercent = 1;
                }
                // link of pic
                if ($IMAGEFLOWSET['imageflow_useenlarge']) {
                    if ($imgflow_fixedsize == 0) {
                        $imageflow_lien = "<img src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;procent=" . $imageflow_temppercent . "&amp;cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&amp;img=" . $imageflow_reflfile . "\" longdesc=\"" . $imageflow_file . "\"    class=\"imgflowimg\" name=\"" . $imageflow_row['pid'] . "\" alt=\"" . $imageflow_row['title'] . "\" id=\"iflowpic" . $i . "\" title=\"\" />";
                    } else {
                        $imageflow_lien = "<img src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;fixed=" . $imgflow_fixedsize . "&amp;cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&amp;img=" . $imageflow_reflfile . "\" longdesc=\"" . $imageflow_file . "\"   class=\"imgflowimg\" name=\"" . $imageflow_row['pid'] . "\" alt=\"" . $imageflow_row['title'] . "\" id=\"iflowpic" . $i . "\" title=\"\" />";
                    }
                } else {
                    if ($imgflow_fixedsize == 0) {
                        $imageflow_lien = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;procent=" . $imageflow_temppercent . "&amp;cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&amp;img=" . $imageflow_reflfile . "\" longdesc=\"displayimage.php?pos=-" . $imageflow_key . "\"  alt=\"" . $imageflow_row['title'] . "\" />";
                    } else {
                        $imageflow_lien = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;fixed=" . $imgflow_fixedsize . "&amp;cache=" . $IMAGEFLOWSET['imageflow_cache'] . "&amp;img=" . $imageflow_reflfile . "\" longdesc=\"displayimage.php?pos=-" . $imageflow_key . "\"  alt=\"" . $imageflow_row['title'] . "\" />";
                    }
                }
                // building HTML code
                $imageflow_pics .= $imageflow_lien . "\n";
                $i = $i + 1;
            }
        }
        // free memory
        mysql_free_result($imageflow_result);
        // if not a single pic in the whole gallery, use dummy pic from plugin folder
        if ($i < 1) {
            $imageflow_pics = "<img class=\"imgflowimg\" src=\"plugins/imageflow/js/reflect.php?bgc=" . $IMAGEFLOWSET['imageflow_bgcolor'] . "&amp;procent=" . $IMAGEFLOWSET['imageflow_procent'] . "&amp;cache=0&amp;img=plugins/imageflow/nopicstoshow.jpg\" longdesc=\"\"  alt=\"Add Some Pics!\" />";
        }
        /* fill if not enough random pictures in whole gallery
           if 3 or 4, repeat once to get 6 or 8 pics; if 2, repeat four times to get 8 pics; if only 1, repeat 8 times to get 8 pics */
        if ($i < 5) {
            $imageflow_pics = $imageflow_pics . str_replace("iflowpic", "iflow2pic", $imageflow_pics);
        }
        if ($i < 3) {
            $imageflow_pics = $imageflow_pics . str_replace("iflowpic", "iflow3pic", str_replace("iflow2pic", "iflow4pic", $imageflow_pics));
        }
        if ($i < 2) {
            $imageflow_pics = $imageflow_pics . str_replace("iflow4pic", "iflow8pic", str_replace("iflow3pic", "iflow7pic", str_replace("iflowpic", "iflow5pic", str_replace("iflow2pic", "iflow6pic", $imageflow_pics))));
        }
    }
    echo $imageflow_pics;
    ?>
                                
                </div>
                <div id="imgflowcaptions"></div>
                <div id="imgflowscrollbar">
                  <div id="imgflowslider"></div>
                </div>
              </div>
<?php 
    if ($IMAGEFLOWSET['imageflow_intable']) {
        echo "            </div>\r\n          ";
    }
    if ($IMAGEFLOWSET['imageflow_align'] == "center") {
        echo "</center>\r\n";
    }
    if ($IMAGEFLOWSET['imageflow_standardtable']) {
        echo "</td></tr>";
        endtable();
    }
    echo "<!-- End Imageflow PlugIn -->\n";
}
Ejemplo n.º 22
0
function buildForm($val, $what)
{
    global $CONFIG, $catPerPage, $picPerPage, $albPerPage, $start;
    $langArr = explode(',', $CONFIG['mod_active_lang']);
    $langCount = count($langArr);
    if ($what == 'getAlb' && $val == 'none') {
        return;
    }
    if ($what == 'getCat' && !$val) {
        return;
    }
    if ($what == 'picAlbum' && !$val) {
        return;
    }
    if ($what == 'getCat') {
        $lowerLimit = $start * $catPerPage * $langCount;
        $higherLimit = $catPerPage * $langCount;
        $hiddenFields = '<input type="hidden" name="category" value="' . $val . '">';
        $queryString = "&category={$val}";
        $query = "SELECT * FROM {$CONFIG['TABLE_LANG_STRINGS']} WHERE original != '' AND (type = 'catName' OR type = 'catDesc') ORDER BY origId, type LIMIT {$lowerLimit}, {$higherLimit}";
        $countQuery = "SELECT count(id) FROM {$CONFIG['TABLE_LANG_STRINGS']} WHERE original != '' AND (type = 'catName' OR type = 'catDesc')";
    } elseif ($what == 'getAlb') {
        // Get the albums for the selected category..
        if ($val == 1) {
            $whereClause = " WHERE category > '" . FIRST_USER_CAT . "'";
        } else {
            $whereClause = " WHERE category = '{$val}'";
        }
        $query = "SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} {$whereClause}";
        $result = cpg_db_query($query);
        $aidArr = array();
        while ($row = cpg_db_fetch_row($result)) {
            $aidArr[] = $row['aid'];
        }
        if (!count($aidArr)) {
            cpg_die(ERROR, 'No albums in this category', __FILE__, __LINE__);
        }
        $aidStr = implode(',', $aidArr);
        $lowerLimit = $start * $albPerPage * $langCount;
        $higherLimit = $albPerPage * $langCount;
        $hiddenFields = '<input type="hidden" name="category" value="' . $val . '">';
        $queryString = "&category={$val}";
        $query = "SELECT * FROM {$CONFIG['TABLE_LANG_STRINGS']} WHERE origId IN ({$aidStr}) AND original != '' AND (type = 'albName' OR type = 'albDesc') ORDER BY origId, type LIMIT {$lowerLimit}, {$higherLimit}";
        $countQuery = "SELECT count(id) FROM {$CONFIG['TABLE_LANG_STRINGS']} WHERE origId IN ({$aidStr}) AND original != '' AND (type = 'albName' OR type = 'albDesc')";
    } elseif ($what == 'getPic') {
        $query = "SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '{$val}'";
        $result = cpg_db_query($query);
        $pidArr = array();
        while ($row = cpg_db_fetch_row($result)) {
            $pidArr[] = $row['pid'];
        }
        if (!count($pidArr)) {
            cpg_die(ERROR, 'No pictures in this album', __FILE__, __LINE__);
        }
        $pidStr = implode(',', $pidArr);
        $lowerLimit = $start * $picPerPage * $langCount;
        $higherLimit = $picPerPage * $langCount;
        $hiddenFields = '<input type="hidden" name="picAlbum" value="' . $val . '">';
        $queryString = "&picAlbum={$val}";
        $query = "SELECT * FROM {$CONFIG['TABLE_LANG_STRINGS']} WHERE origId IN ({$pidStr}) AND original != '' AND (type = 'picTitle' OR type = 'picDesc') ORDER BY origId, type LIMIT {$lowerLimit}, {$higherLimit}";
        $countQuery = "SELECT count(id) FROM {$CONFIG['TABLE_LANG_STRINGS']} WHERE origId IN ({$pidStr}) AND original != '' AND (type = 'picTitle' OR type = 'picDesc')";
    }
    $result = cpg_db_query($query);
    $countResult = cpg_db_query($countQuery);
    while ($row1 = cpg_db_fetch_row($result)) {
        $rowset[$row1['origId']][$row1['type']]['lang'][$row1['lang']] = array($row1['id'], $row1['translated']);
        $rowset[$row1['origId']][$row1['type']]['original'] = $row1['original'];
    }
    $nr = cpg_db_fetch_row($countResult);
    $totalCount = $nr[0];
    $totalPages = ceil($totalCount / $higherLimit);
    echo "<br />\n       <form method=\"post\" action=\"mod_lang.php\">\n";
    starttable('100%', 'Manage multiple language strings', 2);
    foreach ($rowset as $origId => $typeArr) {
        foreach ($typeArr as $typeKey => $type) {
            switch ($typeKey) {
                case 'catName':
                    $elementName = 'category name';
                    $elementType = 'text';
                    break;
                case 'catDesc':
                    $elementName = 'category description';
                    $elementType = 'textarea';
                    break;
                case 'albName':
                    $elementName = 'album name';
                    $elementType = 'text';
                    break;
                case 'albDesc':
                    $elementName = 'album description';
                    $elementType = 'textarea';
                    break;
                case 'picTitle':
                    $elementName = 'picture title';
                    $elementType = 'text';
                    break;
                case 'picDesc':
                    $elementName = 'picture description';
                    $elementType = 'textarea';
                    break;
            }
            echo "<tr>\n                  <td class=\"tableh2\">\n                    Original {$elementName}\n                  </td>\n                  <td class=\"tableh2\">\n                    " . nl2br($type['original']) . "\n                  </td>\n                </tr>";
            foreach ($type['lang'] as $lang => $val) {
                echo "<tr>\n                <td class=\"tableb\" valign=\"top\">\n                  Translation In {$lang}\n                </td>\n                <td class=\"tableb\">\n                ";
                if ($elementType == 'textarea') {
                    echo "<textarea name=\"{$val[0]}\" rows=\"2\" cols=\"40\">{$val[1]}</textarea>";
                } else {
                    echo "<input type=\"{$elementType}\" name=\"{$val[0]}\" value=\"{$val[1]}\" size=\"50\">";
                }
                echo "</td>\n                    </tr>";
            }
            echo "<tr>\n                <td class=\"tableh1\" colspan=\"2\" align=\"right\">\n                  &nbsp;\n                </td>\n              </tr>";
        }
    }
    echo "<tr>\n          <td class=\"tablehb_compact\" colspan=\"2\" align=\"right\">\n            Page ";
    for ($i = 1; $i <= $totalPages; $i++) {
        //print "I:$i|";
        if ($i - 1 == $start) {
            echo " {$i}";
        } else {
            echo " <a href=\"mod_lang.php?what={$what}&start=" . ($i - 1) . "{$queryString}\">{$i}</a>";
        }
    }
    echo "</td>\n        </tr>";
    echo "<tr>\n          <td align=\"center\" colspan=\"2\">\n            <input type=\"submit\" value=\"Submit\">\n          </td>\n        </tr>";
    endtable();
    echo <<<EOT
    <input type="hidden" name="what" value="{$what}">
    <input type="hidden" name="update" value="update">
    <input type="hidden" name="start" value="{$start}">
    {$hiddenFields}
    </form>
EOT;
}
Ejemplo n.º 23
0
function update_history($html)
{
    $superCage = Inspekt::makeSuperCage();
    global $CONFIG, $matches, $cat, $USER_DATA, $FORBIDDEN_SET;
    global $lang_plugin_update_history, $lastup_date_fmt;
    require 'plugins/update_history/include/init.inc.php';
    $CONFIG['TABLE_UPDATE_HISTORY_CONFIG'] = $CONFIG['TABLE_PREFIX'] . 'update_history_config';
    $Group_Id = $USER_DATA['groups'][0];
    $result = cpg_db_query("select * FROM {$CONFIG['TABLE_UPDATE_HISTORY_CONFIG']} WHERE Group_Id={$Group_Id}");
    $param = mysql_fetch_array($result);
    //settings
    $GID = $param['Group_Id'];
    $bloc = $param['bloc'];
    $archive = $param['archive'];
    $uploader_name = $param['uploader_name'];
    $days = $param['days'];
    if ($superCage->get->keyExists('cat')) {
        $cat = $superCage->get->getInt('cat');
    } else {
        $cat = '';
    }
    $nb = intval($param['number']);
    $end = time();
    $counter = array();
    $info = array();
    $FORBIDDEN_SET_UPD = $FORBIDDEN_SET ? "AND {$FORBIDDEN_SET}" : '';
    $CAT_FILTER = $cat ? "AND a.category = {$cat}" : '';
    //if $bloc set to 1 display the block
    if ($matches[1] != 'updatehistory' || !$bloc == "1") {
        return $matches;
    }
    //if GALLERY_ADMIN_MODE, display button to plugin admin page
    if (GALLERY_ADMIN_MODE) {
        //if $archive set to 1, button displayed to acces to the plugin archive page
        if ($archive == "1") {
            $bloc_title = $lang_plugin_update_history['update'] . "&nbsp;&nbsp;&nbsp;<a class=\"admin_menu\" href=\"index.php?file=update_history/history_archive\">{$lang_plugin_update_history[archive]}</a>&nbsp;&nbsp;&nbsp;<a class=\"admin_menu\" href=\"index.php?file=update_history/history_admin\">{$lang_plugin_update_history[admin]}</a>";
        } else {
            $bloc_title = $lang_plugin_update_history['update'] . "&nbsp;&nbsp;&nbsp;<a class=\"admin_menu\" href=\"index.php?file=update_history/history_admin\">{$lang_plugin_update_history[admin]}</a>";
        }
    } else {
        if ($archive == "1") {
            $bloc_title = $lang_plugin_update_history['update'] . "&nbsp;&nbsp;&nbsp;<a class=\"admin_menu\" href=\"index.php?file=update_history/history_archive\">{$lang_plugin_update_history[archive]}</a>";
        } else {
            $bloc_title = $lang_plugin_update_history['update'];
        }
    }
    //display update history bloc
    starttable("100%", $bloc_title);
    //If $days set to 1 show the last uploads since the $nb last days (default setting)
    if ($days == "1") {
        echo '<tr><td class="tableh2"><b>' . $lang_plugin_update_history['history'] . $nb . $lang_plugin_update_history['last_days'] . '</b></td></tr>';
        for ($d = 0; $d < $nb; $d++) {
            $start = strtotime(date("Ymd")) - $d * 60 * 60 * 24;
            $result = cpg_db_query("SELECT *,a.title AS album_title,p.owner_id AS owner FROM {$CONFIG['TABLE_PICTURES']} AS p,{$CONFIG['TABLE_ALBUMS']} AS a WHERE (APPROVED ='YES') AND (p.aid = a.aid)  AND (ctime BETWEEN {$start} AND {$end}) {$FORBIDDEN_SET_UPD} {$CAT_FILTER} ORDER BY ctime DESC");
            while ($row = mysql_fetch_assoc($result)) {
                $day = localised_date($row['ctime'], $plugin_update_history_date_fmt);
                //$day = ($day, $lastup_date_fmt);
                $counter[$day][$row[album_title]] += 1;
                $info[$day][$row[album_title]] = $row;
                $users[$day][$row[album_title]][] = $row['owner'];
            }
            $end = $start;
        }
        $i = 0;
        $test = array_keys($counter);
        foreach ($counter as $day) {
            foreach ($day as $album => $number) {
                $date = $test[$i];
                $album_info = $info[$date][$album];
                if ($number == 1) {
                    echo '<tr><td class="tableb">' . $date . ": {$number}" . $lang_plugin_update_history['new'] . "<a href=\"thumbnails.php?album={$album_info['aid']}\">{$album}</a>";
                } else {
                    echo '<tr><td class="tableb">' . $date . ": {$number}" . $lang_plugin_update_history['news'] . "<a href=\"thumbnails.php?album={$album_info['aid']}\">{$album}</a>";
                }
                $links = array();
                foreach ($users[$date][$album] as $u) {
                    if ($uploader_name == 1) {
                        //show the uploader name if $uploader_name set to 1
                        if ($u > 0) {
                            $links[] = $lang_plugin_update_history['by'] . "<a href=\"profile.php?uid={$u}\">" . get_username($u) . "</a>";
                        }
                    }
                }
                $out = array_unique($links);
                echo implode(', ', $out);
                echo "</td></tr>";
            }
            $i++;
        }
    } else {
        //otheerway Show n last uploaded files according settings
        $limit = $nb;
        echo '<tr><td class="tableh2"><b>' . $lang_plugin_update_history['history'] . $nb . $lang_plugin_update_history_admin['uploaded_files'] . '</b></td></tr>';
        $result = cpg_db_query("SELECT *,a.title AS album_title,p.owner_id AS owner FROM {$CONFIG['TABLE_PICTURES']} AS p,{$CONFIG['TABLE_ALBUMS']} AS a WHERE (APPROVED ='YES') AND (p.aid = a.aid) {$FORBIDDEN_SET_UPD} {$CAT_FILTER}  ORDER BY ctime DESC LIMIT {$nb}");
        for ($d = 0; $d < $nb; $d++) {
            while ($row = mysql_fetch_assoc($result)) {
                $day = localised_date($row['ctime'], $plugin_update_history_date_fmt);
                $album = $row['album_title'];
                $thumb = $CONFIG['fullpath'] . "/" . $row['filepath'] . "/" . $CONFIG['thumb_pfx'] . $row['filename'];
                echo '<tr><td class="tableb">' . $day . ": <a href=\"displayimage.php?pos=-{$row['pid']}\"><img border=\"1\" width=\"{$CONFIG['alb_list_thumb_size']}\" src=\"{$thumb}\" alt=\"{$row['filename']}\" title=\"{$row['filename']}\"/></a>" . $lang_plugin_update_history['add'] . "<a href=\"thumbnails.php?album={$row['aid']}\">{$album}</a>";
                if ($uploader_name == 1) {
                    //show the uploader name if $uploader_name set to 1
                    $links[] = $lang_plugin_update_history['by'] . "<a href=\"profile.php?uid={$u}\">" . get_username($row['owner']) . "</a>";
                }
                $out = array_unique($links);
                echo implode(', ', $out);
                echo "</td></tr>";
            }
        }
    }
    endtable();
    mysql_free_result($result);
}
Ejemplo n.º 24
0
/**
 * Function to draw the password box if the album is password protected
 */
function form_albpw()
{
    global $lang_thumb_view, $CURRENT_ALBUM_DATA;
    $login_falied = starttable('-1', $lang_thumb_view['enter_alb_pass'], 2);
    if (isset($_POST['validate_album'])) {
        $login_failed = '<tr><td class="tableh2" colspan="2" align="center">
                               <span style="color:red">' . $lang_thumb_view['invalid_pass'] . '</span></td></tr>
                                         ';
    }
    if (!empty($CURRENT_ALBUM_DATA['alb_password_hint'])) {
        echo <<<EOT
                  <tr>
                    <td colspan="2" align="center" class="tableb">{$CURRENT_ALBUM_DATA['alb_password_hint']}</td>
                  </tr>
EOT;
    }
    echo <<<EOT
                        {$login_failed}
                        <tr>
              <form method="post" action="">
              <input type="hidden" name="validate_album" value="validate_album"/>
              <td class="tableb" width="40%">{$lang_thumb_view['pass']}: </td>
              <td class="tableb" width="60%"><input type="password" class="textinput" name="password" /></td>
             </tr>
             <tr>
              <td class="tablef" colspan="2" align="center"><input type="submit" class="button" name="submit" value={$lang_thumb_view['submit']} />
              </form>
            </tr>
EOT;
    endtable();
}
Ejemplo n.º 25
0
function flf_histotag_configure()
{
    global $CONFIG, $thisplugin, $lang_common, $thumb_rotate_icon_array, $lang_errors, $flf_lang_var, $imagerotate_exist;
    $superCage = Inspekt::makeSuperCage();
    if (!GALLERY_ADMIN_MODE) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }
    // Populate the form fields and run the queries for the submit form
    $config_changes_counter = 0;
    $dump_cache = 0;
    // plugin_flf_histotag_histoquality
    if ($superCage->post->keyExists('plugin_flf_histotag_histoquality') == TRUE) {
        if ($superCage->post->getInt('plugin_flf_histotag_histoquality') >= 0 && $superCage->post->getInt('plugin_flf_histotag_histoquality') <= 100 && $CONFIG['plugin_flf_histotag_histoquality'] != $superCage->post->getInt('plugin_flf_histotag_histoquality')) {
            $CONFIG['plugin_flf_histotag_histoquality'] = $superCage->post->getInt('plugin_flf_histotag_histoquality');
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_histoquality']}' WHERE name='plugin_flf_histotag_histoquality'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    // bgcolor
    if ($superCage->post->keyExists('plugin_flf_histotag_histocolor') == TRUE) {
        $temp = $superCage->post->getRaw('plugin_flf_histotag_histocolor');
        // Usually, we would not use that method, but we'll sanitize later.
        $temp = '#' . strtoupper(ltrim($temp, '#'));
        if (preg_match('/^#(?:(?:[a-f\\d]{3}){1,2})$/i', $temp)) {
            if ($CONFIG['plugin_flf_histotag_histocolor'] != $temp) {
                $CONFIG['plugin_flf_histotag_histocolor'] = $temp;
                $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_histocolor']}' WHERE name='plugin_flf_histotag_histocolor'";
                cpg_db_query($query);
                $config_changes_counter++;
                $dump_cache++;
            }
        }
    }
    // Map Width
    if ($superCage->post->keyExists('plugin_flf_histotag_mapwidth') == TRUE) {
        if ($superCage->post->getInt('plugin_flf_histotag_mapwidth') >= 0 && $superCage->post->getInt('plugin_flf_histotag_mapwidth') <= 1280 && $CONFIG['plugin_flf_histotag_mapwidth'] != $superCage->post->getInt('plugin_flf_histotag_mapwidth')) {
            $CONFIG['plugin_flf_histotag_mapwidth'] = $superCage->post->getInt('plugin_flf_histotag_mapwidth');
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_mapwidth']}' WHERE name='plugin_flf_histotag_mapwidth'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    // Map Height
    if ($superCage->post->keyExists('plugin_flf_histotag_mapheight') == TRUE) {
        if ($superCage->post->getInt('plugin_flf_histotag_mapheight') >= 0 && $superCage->post->getInt('plugin_flf_histotag_mapheight') <= 1024 && $CONFIG['plugin_flf_histotag_mapheight'] != $superCage->post->getInt('plugin_flf_histotag_mapheight')) {
            $CONFIG['plugin_flf_histotag_mapheight'] = $superCage->post->getInt('plugin_flf_histotag_mapheight');
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_mapheight']}' WHERE name='plugin_flf_histotag_mapheight'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    // Map Box Width
    if ($superCage->post->keyExists('plugin_flf_histotag_mapboxwidth') == TRUE) {
        if ($superCage->post->getInt('plugin_flf_histotag_mapboxwidth') >= 0 && $superCage->post->getInt('plugin_flf_histotag_mapboxwidth') <= 1280 && $CONFIG['plugin_flf_histotag_mapboxwidth'] != $superCage->post->getInt('plugin_flf_histotag_mapboxwidth')) {
            $CONFIG['plugin_flf_histotag_mapboxwidth'] = $superCage->post->getInt('plugin_flf_histotag_mapboxwidth');
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_mapboxwidth']}' WHERE name='plugin_flf_histotag_mapboxwidth'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    // Map Height
    if ($superCage->post->keyExists('plugin_flf_histotag_mapboxheight') == TRUE) {
        if ($superCage->post->getInt('plugin_flf_histotag_mapboxheight') >= 0 && $superCage->post->getInt('plugin_flf_histotag_mapboxheight') <= 1024 && $CONFIG['plugin_flf_histotag_mapboxheight'] != $superCage->post->getInt('plugin_flf_histotag_mapboxheight')) {
            $CONFIG['plugin_flf_histotag_mapboxheight'] = $superCage->post->getInt('plugin_flf_histotag_mapboxheight');
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_mapboxheight']}' WHERE name='plugin_flf_histotag_mapboxheight'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    // API key
    if ($superCage->post->keyExists('plugin_flf_histotag_apikey') == TRUE) {
        $temp = $superCage->post->getRaw('plugin_flf_histotag_apikey');
        if ($CONFIG['plugin_flf_histotag_apikey'] != $temp) {
            $CONFIG['plugin_flf_histotag_apikey'] = $temp;
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_apikey']}' WHERE name='plugin_flf_histotag_apikey'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    if ($superCage->post->keyExists('plugin_flf_histotag_mapmode') == TRUE && $superCage->post->getInt('plugin_flf_histotag_mapmode') != $CONFIG['plugin_flf_histotag_mapmode']) {
        $CONFIG['plugin_flf_histotag_mapmode'] = $superCage->post->getInt('plugin_flf_histotag_mapmode');
        $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_mapmode']}' WHERE name='plugin_flf_histotag_mapmode'";
        cpg_db_query($query);
        $config_changes_counter++;
        $dump_cache++;
    }
    switch ($CONFIG['plugin_flf_histotag_mapmode']) {
        case 1:
            $option_output['plugin_flf_histotag_mapmode_2'] = '';
            $option_output['plugin_flf_histotag_mapmode_3'] = '';
            $option_output['plugin_flf_histotag_mapmode_4'] = '';
            $option_output['plugin_flf_histotag_mapmode_5'] = '';
            $option_output['plugin_flf_histotag_mapmode_1'] = 'checked="checked"';
            break;
        case 2:
            $option_output['plugin_flf_histotag_mapmode_1'] = '';
            $option_output['plugin_flf_histotag_mapmode_3'] = '';
            $option_output['plugin_flf_histotag_mapmode_4'] = '';
            $option_output['plugin_flf_histotag_mapmode_5'] = '';
            $option_output['plugin_flf_histotag_mapmode_2'] = 'checked="checked"';
            break;
        case 3:
            $option_output['plugin_flf_histotag_mapmode_2'] = '';
            $option_output['plugin_flf_histotag_mapmode_1'] = '';
            $option_output['plugin_flf_histotag_mapmode_4'] = '';
            $option_output['plugin_flf_histotag_mapmode_5'] = '';
            $option_output['plugin_flf_histotag_mapmode_3'] = 'checked="checked"';
            break;
        case 4:
            $option_output['plugin_flf_histotag_mapmode_2'] = '';
            $option_output['plugin_flf_histotag_mapmode_3'] = '';
            $option_output['plugin_flf_histotag_mapmode_1'] = '';
            $option_output['plugin_flf_histotag_mapmode_5'] = '';
            $option_output['plugin_flf_histotag_mapmode_4'] = 'checked="checked"';
            break;
        case 5:
            $option_output['plugin_flf_histotag_mapmode_2'] = '';
            $option_output['plugin_flf_histotag_mapmode_3'] = '';
            $option_output['plugin_flf_histotag_mapmode_4'] = '';
            $option_output['plugin_flf_histotag_mapmode_1'] = '';
            $option_output['plugin_flf_histotag_mapmode_5'] = 'checked="checked"';
            break;
        default:
            $option_output['plugin_flf_histotag_mapmode_2'] = '';
            $option_output['plugin_flf_histotag_mapmode_3'] = '';
            $option_output['plugin_flf_histotag_mapmode_4'] = '';
            $option_output['plugin_flf_histotag_mapmode_5'] = '';
            $option_output['plugin_flf_histotag_mapmode_1'] = 'checked="checked"';
    }
    if ($superCage->post->keyExists('plugin_flf_histotag_geosupport') == TRUE && $superCage->post->getInt('plugin_flf_histotag_geosupport') != $CONFIG['plugin_flf_histotag_geosupport']) {
        $CONFIG['plugin_flf_histotag_geosupport'] = $superCage->post->getInt('plugin_flf_histotag_geosupport');
        $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_geosupport']}' WHERE name='plugin_flf_histotag_geosupport'";
        cpg_db_query($query);
        $config_changes_counter++;
        $dump_cache++;
    }
    switch ($CONFIG['plugin_flf_histotag_geosupport']) {
        case 1:
            $option_output['plugin_flf_histotag_geosupport_2'] = '';
            $option_output['plugin_flf_histotag_geosupport_3'] = '';
            $option_output['plugin_flf_histotag_geosupport_1'] = 'checked="checked"';
            break;
        case 2:
            $option_output['plugin_flf_histotag_geosupport_1'] = '';
            $option_output['plugin_flf_histotag_geosupport_3'] = '';
            $option_output['plugin_flf_histotag_geosupport_2'] = 'checked="checked"';
            break;
        case 3:
            $option_output['plugin_flf_histotag_geosupport_2'] = '';
            $option_output['plugin_flf_histotag_geosupport_1'] = '';
            $option_output['plugin_flf_histotag_geosupport_3'] = 'checked="checked"';
            break;
        default:
            $option_output['plugin_flf_histotag_geosupport_2'] = '';
            $option_output['plugin_flf_histotag_geosupport_3'] = '';
            $option_output['plugin_flf_histotag_geosupport_1'] = 'checked="checked"';
            break;
    }
    if ($superCage->post->keyExists('plugin_flf_histotag_imagesource') == TRUE && $superCage->post->getInt('plugin_flf_histotag_imagesource') != $CONFIG['plugin_flf_histotag_imagesource']) {
        $CONFIG['plugin_flf_histotag_imagesource'] = $superCage->post->getInt('plugin_flf_histotag_imagesource');
        $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_imagesource']}' WHERE name='plugin_flf_histotag_imagesource'";
        cpg_db_query($query);
        $config_changes_counter++;
        $dump_cache++;
    }
    switch ($CONFIG['plugin_flf_histotag_imagesource']) {
        case 1:
            $option_output['plugin_flf_histotag_imagesource_2'] = '';
            $option_output['plugin_flf_histotag_imagesource_3'] = '';
            $option_output['plugin_flf_histotag_imagesource_1'] = 'checked="checked"';
            break;
        case 2:
            $option_output['plugin_flf_histotag_imagesource_1'] = '';
            $option_output['plugin_flf_histotag_imagesource_3'] = '';
            $option_output['plugin_flf_histotag_imagesource_2'] = 'checked="checked"';
            break;
        case 3:
            $option_output['plugin_flf_histotag_imagesource_2'] = '';
            $option_output['plugin_flf_histotag_imagesource_1'] = '';
            $option_output['plugin_flf_histotag_imagesource_3'] = 'checked="checked"';
            break;
        default:
            $option_output['plugin_flf_histotag_imagesource_2'] = '';
            $option_output['plugin_flf_histotag_imagesource_3'] = '';
            $option_output['plugin_flf_histotag_imagesource_1'] = 'checked="checked"';
            break;
    }
    if ($superCage->post->keyExists('plugin_flf_histotag_histosupport') == TRUE && $superCage->post->getInt('plugin_flf_histotag_histosupport') != $CONFIG['plugin_flf_histotag_histosupport']) {
        $CONFIG['plugin_flf_histotag_histosupport'] = $superCage->post->getInt('plugin_flf_histotag_histosupport');
        $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_histosupport']}' WHERE name='plugin_flf_histotag_histosupport'";
        cpg_db_query($query);
        $config_changes_counter++;
        $dump_cache++;
    }
    switch ($CONFIG['plugin_flf_histotag_histosupport']) {
        case 1:
            $option_output['plugin_flf_histotag_histosupport_2'] = '';
            $option_output['plugin_flf_histotag_histosupport_3'] = '';
            $option_output['plugin_flf_histotag_histosupport_4'] = '';
            $option_output['plugin_flf_histotag_histosupport_1'] = 'checked="checked"';
            break;
        case 2:
            $option_output['plugin_flf_histotag_histosupport_1'] = '';
            $option_output['plugin_flf_histotag_histosupport_3'] = '';
            $option_output['plugin_flf_histotag_histosupport_4'] = '';
            $option_output['plugin_flf_histotag_histosupport_2'] = 'checked="checked"';
            break;
        case 3:
            $option_output['plugin_flf_histotag_histosupport_1'] = '';
            $option_output['plugin_flf_histotag_histosupport_2'] = '';
            $option_output['plugin_flf_histotag_histosupport_4'] = '';
            $option_output['plugin_flf_histotag_histosupport_3'] = 'checked="checked"';
            break;
        case 4:
            $option_output['plugin_flf_histotag_histosupport_1'] = '';
            $option_output['plugin_flf_histotag_histosupport_2'] = '';
            $option_output['plugin_flf_histotag_histosupport_3'] = '';
            $option_output['plugin_flf_histotag_histosupport_4'] = 'checked="checked"';
            break;
        default:
            $option_output['plugin_flf_histotag_histosupport_2'] = '';
            $option_output['plugin_flf_histotag_histosupport_3'] = '';
            $option_output['plugin_flf_histotag_histosupport_4'] = '';
            $option_output['plugin_flf_histotag_histosupport_1'] = 'checked="checked"';
            break;
    }
    // UseHistogram function upon upload of images
    if ($superCage->post->keyExists('plugin_flf_histotag_createonupload') == TRUE && $superCage->post->getInt('plugin_flf_histotag_createonupload') == 1) {
        $temp = 1;
    } elseif ($superCage->post->keyExists('submit') == TRUE) {
        $temp = 0;
    } else {
        $temp = $CONFIG['plugin_flf_histotag_createonupload'];
    }
    if ($CONFIG['plugin_flf_histotag_createonupload'] != $temp) {
        $CONFIG['plugin_flf_histotag_createonupload'] = $temp;
        $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_createonupload']}' WHERE name='plugin_flf_histotag_createonupload'";
        cpg_db_query($query);
        $config_changes_counter++;
    }
    if ($CONFIG['plugin_flf_histotag_createonupload'] == '1') {
        $option_output['plugin_flf_histotag_createonupload'] = 'checked="checked"';
    }
    if ($superCage->post->keyExists('plugin_flf_histotag_histotype') == TRUE && $superCage->post->getInt('plugin_flf_histotag_histotype') != $CONFIG['plugin_flf_histotag_histotype']) {
        $CONFIG['plugin_flf_histotag_histotype'] = $superCage->post->getInt('plugin_flf_histotag_histotype');
        $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_histotype']}' WHERE name='plugin_flf_histotag_histotype'";
        cpg_db_query($query);
        $config_changes_counter++;
        $dump_cache++;
    }
    if ($CONFIG['plugin_flf_histotag_histotype'] == '2') {
        $option_output['plugin_flf_histotag_histotype_combined'] = '';
        $option_output['plugin_flf_histotag_histotype_separate'] = 'checked="checked"';
    } else {
        // default is "combined"
        $option_output['plugin_flf_histotag_histotype_combined'] = 'checked="checked"';
        $option_output['plugin_flf_histotag_histotype_separate'] = '';
    }
    // Histogram  Box Width
    if ($superCage->post->keyExists('plugin_flf_histotag_histoboxwidth') == TRUE) {
        if ($superCage->post->getInt('plugin_flf_histotag_histoboxwidth') >= 0 && $superCage->post->getInt('plugin_flf_histotag_histoboxwidth') <= 1280 && $CONFIG['plugin_flf_histotag_histoboxwidth'] != $superCage->post->getInt('plugin_flf_histotag_histoboxwidth')) {
            $CONFIG['plugin_flf_histotag_histoboxwidth'] = $superCage->post->getInt('plugin_flf_histotag_histoboxwidth');
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_histoboxwidth']}' WHERE name='plugin_flf_histotag_histoboxwidth'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    // Histogram Box Height
    if ($superCage->post->keyExists('plugin_flf_histotag_histoboxheight') == TRUE) {
        if ($superCage->post->getInt('plugin_flf_histotag_histoboxheight') >= 0 && $superCage->post->getInt('plugin_flf_histotag_histoboxheight') <= 1024 && $CONFIG['plugin_flf_histotag_histoboxheight'] != $superCage->post->getInt('plugin_flf_histotag_histoboxheight')) {
            $CONFIG['plugin_flf_histotag_histoboxheight'] = $superCage->post->getInt('plugin_flf_histotag_histoboxheight');
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_histoboxheight']}' WHERE name='plugin_flf_histotag_histoboxheight'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    // Histogram Width
    if ($superCage->post->keyExists('plugin_flf_histotag_histowidth') == TRUE) {
        if ($superCage->post->getInt('plugin_flf_histotag_histowidth') >= 0 && $superCage->post->getInt('plugin_flf_histotag_histowidth') <= 1024 && $CONFIG['plugin_flf_histotag_histowidth'] != $superCage->post->getInt('plugin_flf_histotag_histowidth')) {
            $CONFIG['plugin_flf_histotag_histowidth'] = $superCage->post->getInt('plugin_flf_histotag_histowidth');
            $query = "UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_flf_histotag_histowidth']}' WHERE name='plugin_flf_histotag_histowidth'";
            cpg_db_query($query);
            $config_changes_counter++;
            $dump_cache++;
        }
    }
    // Form submit?
    if ($superCage->post->keyExists('submit') == TRUE) {
        if ($config_changes_counter > 0) {
            $additional_submit_information = '<div class="cpg_message_success">' . $flf_lang_var['changes_saved'] . '</div>';
        } else {
            $additional_submit_information = '<div class="cpg_message_validation">' . $flf_lang_var['no_changes'] . '</div>';
        }
    }
    // TODO: Create the table row that is displayed during initial install
    $install_section = '';
    // Start the actual output
    echo <<<EOT
            <style type="text/css" media="screen">
                .farbtastic {
                  position: relative;
                }
                .farbtastic * {
                  position: absolute;
                  cursor: crosshair;
                }
                .farbtastic, .farbtastic .wheel {
                  width: 195px;
                  height: 195px;
                }
                .farbtastic .color, .farbtastic .overlay {
                  top: 47px;
                  left: 47px;
                  width: 101px;
                  height: 101px;
                }
                .farbtastic .wheel {
                  background: url(plugins/flf_histotag/images/wheel.png) no-repeat;
                  width: 195px;
                  height: 195px;
                }
                .farbtastic .overlay {
                  background: url(plugins/flf_histotag/images/mask.png) no-repeat;
                }
                .farbtastic .marker {
                  width: 17px;
                  height: 17px;
                  margin: -8px 0 0 -8px;
                  overflow: hidden; 
                  background: url(plugins/flf_histotag/images/marker.png) no-repeat;
                }
            </style>
            <script type="text/javascript">
                \$(document).ready(function() {
                    \$('#colorpicker_bgcolor').farbtastic('#plugin_flf_histotag_histocolor');
                \$("#plugin_flf_histotag_histoquality").SpinButton({min: 0,max: 100});
                    \$("#plugin_flf_histotag_mapwidth").SpinButton({min: 200,max: 1280});
                    \$("#plugin_flf_histotag_mapheight").SpinButton({min:100,max: 1024});
                    \$("#plugin_flf_histotag_mapboxwidth").SpinButton({min: 200,max: 1280});
                    \$("#plugin_flf_histotag_mapboxheight").SpinButton({min:100,max: 1024});
                    \$("#plugin_flf_histotag_histoboxwidth").SpinButton({min: 100,max: 1280});
                    \$("#plugin_flf_histotag_histoboxheight").SpinButton({min:100,max: 1024});
                    \$("#plugin_flf_histotag_histowidth").SpinButton({min:256,max: 1024});
                    
                    
});
            </script>
            <form action="" method="post" name="thumb_rotate_config" id="thumb_rotate_config">
EOT;
    starttable('100%', $thumb_rotate_icon_array['config'] . $flf_lang_var['config'], 2);
    echo <<<EOT

            <tr>
                        <td valign="top" class ="tableh1">
                    
                              {$flf_lang_var['configure_geo']}
                              </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$flf_lang_var['geosupport']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate">
                            <input type="radio" name="plugin_flf_histotag_geosupport" id="plugin_flf_histotag_geosupport_1" class="checkbox" value="1" {$option_output['plugin_flf_histotag_geosupport_1']} /> 
                            <label for="plugin_flf_histotag_geosupport_1"> {$flf_lang_var['geosupport_1']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_geosupport" id="plugin_flf_histotag_geosupport_2" class="checkbox" value="2" {$option_output['plugin_flf_histotag_geosupport_2']} /> 
                            <label for="plugin_flf_histotag_geosupport_2"> {$flf_lang_var['geosupport_2']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_geosupport" id="plugin_flf_histotag_geosupport_3" class="checkbox" value="3" {$option_output['plugin_flf_histotag_geosupport_3']} /> 
                            <label for="plugin_flf_histotag_geosupport_3"> {$flf_lang_var['geosupport_3']}</label>
                            <br />
             
                            
                            
                            
                            
                            
                            </td>
                    </tr>
                    
                    
                    
                    
                    
                    
                    
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$flf_lang_var['maptype']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate">
                            <input type="radio" name="plugin_flf_histotag_mapmode" id="plugin_flf_histotag_mapmode_1" class="checkbox" value="1" {$option_output['plugin_flf_histotag_mapmode_1']} /> 
                            <label for="plugin_flf_histotag_mapmode_1"> {$flf_lang_var['maptype_1']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_mapmode" id="plugin_flf_histotag_mapmode_2" class="checkbox" value="2" {$option_output['plugin_flf_histotag_mapmode_2']} /> 
                            <label for="plugin_flf_histotag_mapmode_2"> {$flf_lang_var['maptype_2']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_mapmode" id="plugin_flf_histotag_mapmode_3" class="checkbox" value="3" {$option_output['plugin_flf_histotag_mapmode_3']} /> 
                            <label for="plugin_flf_histotag_mapmode_3"> {$flf_lang_var['maptype_3']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_mapmode" id="plugin_flf_histotag_mapmode_4" class="checkbox" value="4" {$option_output['plugin_flf_histotag_mapmode_4']} /> 
                            <label for="plugin_flf_histotag_mapmode_4"> {$flf_lang_var['maptype_4']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_mapmode" id="plugin_flf_histotag_mapmode_5" class="checkbox" value="5" {$option_output['plugin_flf_histotag_mapmode_5']} /> 
                            <label for="plugin_flf_histotag_mapmode_5"> {$flf_lang_var['maptype_5']}</label>
                            
                            
                            
                            
                            
                            
                            </td>
                    </tr>

                    <tr>
                        <td valign="top" class ="tableb">
                    
                              {$flf_lang_var['configmap']}
                              </td>
                    </tr>
                        <td valign="top" class="tableb">
                            {$flf_lang_var['mapwidth']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_mapwidth" id="plugin_flf_histotag_mapwidth" class="textinput spin-button" size="4" maxlength="4" value="{$CONFIG['plugin_flf_histotag_mapwidth']}" /> px


                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$flf_lang_var['mapheight']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_mapheight" id="plugin_flf_histotag_mapheight" class="textinput spin-button" size="4" maxlength="4" value="{$CONFIG['plugin_flf_histotag_mapheight']}" /> px
                            <br />&nbsp;<br />

                        </td>
                    </tr>  
                            <tr>
                        <td valign="top" class ="tableb">
                    
                              {$flf_lang_var['configmapbox']}
                              </td>
                    </tr>                                    
                    <tr>

                    
                        <td valign="top" class="tableb">
                            {$flf_lang_var['mapwidth']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_mapboxwidth" id="plugin_flf_histotag_mapboxwidth" class="textinput spin-button" size="4" maxlength="4" value="{$CONFIG['plugin_flf_histotag_mapboxwidth']}" /> px
    

                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$flf_lang_var['mapheight']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_mapboxheight" id="plugin_flf_histotag_mapboxheight" class="textinput spin-button" size="4" maxlength="4" value="{$CONFIG['plugin_flf_histotag_mapboxheight']}" /> px
                            <br />&nbsp;<br />

                        </td>
                    </tr>   
                    
                    <tr>
                        <td valign="top" class="tableb">
                            {$flf_lang_var['setapi']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_apikey" id="plugin_flf_histotag_apikey" class="textinput" size="50" maxlength="200" value="{$CONFIG['plugin_flf_histotag_apikey']}" />
                            <br />&nbsp;<br />

                        </td>
                    </tr>   
            
                    
                            <tr>
                        <td valign="top" class ="tableh1">
                            <br>
                              {$flf_lang_var['configure_histo']}
                              <br>
                              </td>
                    </tr>
                    
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$flf_lang_var['histosupport']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate">
                            <input type="radio" name="plugin_flf_histotag_histosupport" id="plugin_flf_histotag_histosupport_1" class="checkbox" value="1" {$option_output['plugin_flf_histotag_histosupport_1']} /> 
                            <label for="plugin_flf_histotag_histosupport_1"> {$flf_lang_var['histosupport_1']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_histosupport" id="plugin_flf_histotag_histosupport_2" class="checkbox" value="2" {$option_output['plugin_flf_histotag_histosupport_2']} /> 
                            <label for="plugin_flf_histotag_histosupport_2"> {$flf_lang_var['histosupport_2']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_histosupport" id="plugin_flf_histotag_histosupport_3" class="checkbox" value="3" {$option_output['plugin_flf_histotag_histosupport_3']} /> 
                            <label for="plugin_flf_histotag_histosupport_3"> {$flf_lang_var['histosupport_3']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_histosupport" id="plugin_flf_histotag_histosupport_4" class="checkbox" value="4" {$option_output['plugin_flf_histotag_histosupport_4']} /> 
                            <label for="plugin_flf_histotag_histosupport_4"> {$flf_lang_var['histosupport_4']}</label>
                            <br />             
                            
                            
                            
                            
                            
                            </td>
                    </tr>
                    
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$flf_lang_var['imagesource']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate">
                            <input type="radio" name="plugin_flf_histotag_imagesource" id="plugin_flf_histotag_imagesource_1" class="checkbox" value="1" {$option_output['plugin_flf_histotag_imagesource_1']} /> 
                            <label for="plugin_flf_histotag_imagesource_1"> {$flf_lang_var['imagesource_1']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_imagesource" id="plugin_flf_histotag_imagesource_2" class="checkbox" value="2" {$option_output['plugin_flf_histotag_imagesource_2']} /> 
                            <label for="plugin_flf_histotag_imagesource_2"> {$flf_lang_var['imagesource_2']}</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_imagesource" id="plugin_flf_histotag_imagesource_3" class="checkbox" value="3" {$option_output['plugin_flf_histotag_imagesource_3']} /> 
                            <label for="plugin_flf_histotag_imagesource_3"> {$flf_lang_var['imagesource_3']}</label>
                            <br />
             
                            
                            
                            
                            
                            
                            </td>
                    </tr>
                    
                    
                    
                    
                    
                       <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$flf_lang_var['createonupload']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate">
                            <input type="checkbox" name="plugin_flf_histotag_createonupload" id="plugin_flf_histotag_createonupload" class="checkbox" value="1" {$option_output['plugin_flf_histotag_createonupload']} /> 
                           {$flf_lang_var['activated']}
                            </td>
                    </tr>         
                                       
         
                  


                    
                    
                    
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$flf_lang_var['histcol']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate">
                                <input type="text" name="plugin_flf_histotag_histocolor" id="plugin_flf_histotag_histocolor" class="textinput" size="8" maxlength="7" value="{$CONFIG['plugin_flf_histotag_histocolor']}" style="text-transform:uppercase;" />
                            <span class="detail_head_collapsed">{$flf_lang_var['toggle_color_picker']}</span>
                            <div id="colorpicker_bgcolor" class="detail_body"></div>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$flf_lang_var['histo_quality']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_histoquality" id="plugin_flf_histotag_histoquality" class="textinput spin-button" size="3" maxlength="3" value="{$CONFIG['plugin_flf_histotag_histoquality']}" /> %
                            <br />&nbsp;<br />

                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$flf_lang_var['histtype']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate">
                            <input type="radio" name="plugin_flf_histotag_histotype" id="plugin_flf_histotag_histotype_combined" class="checkbox" value="1" {$option_output['plugin_flf_histotag_histotype_combined']} /> 
                            <label for="plugin_flf_histotag_histotype_combined"> ({$flf_lang_var['histo_type_combined']})</label>
                            <br />
                            <input type="radio" name="plugin_flf_histotag_histotype" id="plugin_flf_histotag_histotype_separate" class="checkbox" value="2" {$option_output['plugin_flf_histotag_histotype_separate']} /> 
                            <label for="plugin_flf_histotag_histotype_separate"> ({$flf_lang_var['histo_type_separate']})</label>
                        </td>
                    </tr>
                    
                    <tr>
                        <td valign="top" class="tableb">
                            {$flf_lang_var['histowidth']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_histowidth" id="plugin_flf_histotag_histowidth" class="textinput spin-button" size="4" maxlength="4" value="{$CONFIG['plugin_flf_histotag_histowidth']}" /> px
                            <br />&nbsp;<br />

                        </td>
                    </tr>  
                    
                    <tr>
                        <td valign="top" class ="tableb">
                    
                              {$flf_lang_var['configmapbox']}
                              </td>
                    </tr>  
                    <tr>
                        <td valign="top" class="tableb">
                            {$flf_lang_var['mapwidth']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_histoboxwidth" id="plugin_flf_histotag_histoboxwidth" class="textinput spin-button" size="4" maxlength="4" value="{$CONFIG['plugin_flf_histotag_histoboxwidth']}" /> px
    

                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$flf_lang_var['mapheight']}
                        </td>
                        <td valign="top" class="tableb">
                             <input type="text" name="plugin_flf_histotag_histoboxheight" id="plugin_flf_histotag_histoboxheight" class="textinput spin-button" size="4" maxlength="4" value="{$CONFIG['plugin_flf_histotag_histoboxheight']}" /> px
                            <br />&nbsp;<br />

                        </td>
                    </tr>   
               

                    {$install_section}
                    <tr>
                        <td valign="middle" class="tablef">
                        </td>
                        <td valign="middle" class="tablef">
                            <button type="submit" class="button" name="submit" value="{$lang_common['ok']}">{$thumb_rotate_icon_array['ok']}{$lang_common['ok']}</button>
                        </td>
                    </tr>
EOT;
    endtable();
    echo <<<EOT
            {$additional_submit_information}
            </form>

EOT;
}
Ejemplo n.º 26
0
function shorturl_page_start()
{
    if (defined('INDEX_PHP')) {
        global $CONFIG, $lang_common, $lang_errors, $cpg_udb, $lang_gallery_admin_menu;
        require "./plugins/shorturl/lang/english.php";
        if ($CONFIG['lang'] != 'english' && file_exists("./plugins/shorturl/lang/{$CONFIG['lang']}.php")) {
            require "./plugins/shorturl/lang/{$CONFIG['lang']}.php";
        }
        $superCage = Inspekt::MakeSuperCage();
        if ($superCage->get->keyExists('c')) {
            header("Location: index.php?cat=" . $superCage->get->getInt('c'));
        }
        if ($superCage->get->keyExists('a')) {
            header("Location: thumbnails.php?album=" . $superCage->get->getInt('a'));
        }
        if ($superCage->get->keyExists('p')) {
            header("Location: displayimage.php?pid=" . $superCage->get->getInt('p'));
        }
        if ($superCage->get->keyExists('r')) {
            $result = cpg_db_query("SELECT url FROM {$CONFIG['TABLE_PREFIX']}plugin_shorturl WHERE rid = " . $superCage->get->getInt('r'));
            $url = mysql_result($result, 0);
            mysql_free_result($result);
            if ($CONFIG['plugin_shorturl_preview'] == 1 || $superCage->get->keyExists('preview')) {
                load_template();
                pageheader($lang_plugin_shorturl['redirection_preview']);
                starttable('100%', $lang_plugin_shorturl['redirection_preview']);
                echo <<<EOT
                    <tr>
                        <td class="tableb">
                            <a href="{$url}" class="external">{$url}</a>
                        </td>
                    </tr>
EOT;
                endtable();
                pagefooter();
                exit;
            } else {
                header("Location: {$url}");
            }
        }
        if ($superCage->get->keyExists('shorturl')) {
            if ($superCage->get->getAlpha('shorturl') == 'config') {
                if (!GALLERY_ADMIN_MODE) {
                    load_template();
                    cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
                }
                if ($superCage->post->keyExists('submit') == TRUE) {
                    if (!checkFormToken()) {
                        load_template();
                        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
                    }
                    $superCage = Inspekt::makeSuperCage();
                    if (!isset($CONFIG['plugin_shorturl_preview'])) {
                        cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES('plugin_shorturl_preview', '" . $superCage->post->getInt('plugin_shorturl_preview') . "')");
                    } else {
                        cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '" . $superCage->post->getInt('plugin_shorturl_preview') . "' WHERE name = 'plugin_shorturl_preview'");
                    }
                    $CONFIG['plugin_shorturl_preview'] = $superCage->post->getInt('plugin_shorturl_preview');
                    $result = cpg_db_query("SELECT group_id FROM {$CONFIG['TABLE_USERGROUPS']} WHERE has_admin_access != '1'");
                    while ($row = mysql_fetch_assoc($result)) {
                        if (!isset($CONFIG['plugin_shorturl_permissions_' . $row['group_id']])) {
                            cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES('plugin_shorturl_permissions_{$row['group_id']}', '" . $superCage->post->getInt('plugin_shorturl_permissions_' . $row['group_id']) . "')");
                        } else {
                            cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '" . $superCage->post->getInt('plugin_shorturl_permissions_' . $row['group_id']) . "' WHERE name = 'plugin_shorturl_permissions_{$row['group_id']}'");
                        }
                        $CONFIG['plugin_shorturl_permissions_' . $row['group_id']] = $superCage->post->getInt('plugin_shorturl_permissions_' . $row['group_id']);
                    }
                    mysql_free_result($result);
                }
                load_template();
                pageheader($lang_plugin_shorturl['plugin_name'] . ' ' . $lang_gallery_admin_menu['admin_lnk']);
                $permissions = "";
                $result = cpg_db_query("SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_id ASC");
                while ($row = mysql_fetch_assoc($result)) {
                    if (in_array($row['group_id'], $cpg_udb->admingroups)) {
                        $permissions .= <<<EOT
                            <tr>
                                <td valign="top" align="left" class="tableb">
                                    {$row['group_name']}
                                </td>
                                <td valign="top" align="center" class="tableb">
                                    <input type="radio" class="radio" disabled="disabled" />
                                </td>
                                <td valign="top" align="center" class="tableb">
                                    <input type="radio" class="radio" checked="checked" />
                                </td>
                            </tr>
EOT;
                    } else {
                        $row['permission'] = mysql_result(cpg_db_query("SELECT value FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_shorturl_permissions_{$row['group_id']}'"), 0);
                        $permissions .= <<<EOT
                            <tr>
                                <td valign="top" align="left" class="tableb">
                                    {$row['group_name']}
                                </td>
EOT;
                        for ($i = 0; $i <= 1; $i++) {
                            if (!is_numeric($row['permission']) && $i == 0) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = $row['permission'] == $i ? "checked=\"checked\"" : "";
                            }
                            $permissions .= <<<EOT
                                <td valign="top" align="center" class="tableb">
                                    <input type="radio" name="plugin_shorturl_permissions_{$row['group_id']}" id="plugin_shorturl_permissions_{$row['group_id']}_{$i}" class="radio" value="{$i}" {$checked} />
                                </td>
EOT;
                        }
                        $permissions .= <<<EOT
                            </tr>
EOT;
                    }
                }
                mysql_free_result($result);
                $preview = "";
                for ($i = 0; $i <= 1; $i++) {
                    $checked = $CONFIG['plugin_shorturl_preview'] == $i ? "checked=\"checked\"" : "";
                    $preview .= <<<EOT
                        <td valign="top" align="center" class="tableb">
                            <input type="radio" name="plugin_shorturl_preview" id="plugin_shorturl_preview_{$i}" class="radio" value="{$i}" {$checked} />
                        </td>
EOT;
                }
                list($timestamp, $form_token) = getFormToken();
                echo <<<EOT
                    <form action="" method="post" name="shorturl_config" id="shorturl_config">
EOT;
                starttable('100%', $lang_plugin_shorturl['plugin_name'] . ' ' . $lang_gallery_admin_menu['admin_lnk'], 3);
                echo <<<EOT
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_shorturl['display_menu_button']}
                        </td>
                        <td valign="top" class="tableb" colspan="2">
                            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                                <tr>
                                    <th valign="top" align="left" class="tableh2">
                                        {$lang_plugin_shorturl['group']}
                                    </th>
                                    <th valign="top" align="center" class="tableh2">
                                        {$lang_common['no']}
                                    </th>
                                    <th valign="top" align="center" class="tableh2">
                                        {$lang_common['yes']}
                                    </th>
                                </tr>
                                {$permissions}
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td class="tableb">
                            {$lang_plugin_shorturl['show_redirection_preview']}
                        </td>
                        <td class="tableb">
                            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                                <tr>
                                    <th valign="top" align="center" class="tableh2">
                                        {$lang_common['no']}
                                    </th>
                                    <th valign="top" align="center" class="tableh2">
                                        {$lang_common['yes']}
                                    </th>
                                </tr>
                                {$preview}
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" class="tablef">
                        </td>
                        <td valign="middle" class="tablef" colspan="2">
                            <input type="hidden" name="form_token" value="{$form_token}" />
                            <input type="hidden" name="timestamp" value="{$timestamp}" />
                            <button type="submit" class="button" name="submit" value="{$lang_common['ok']}">{$annotate_icon_array['ok']}{$lang_common['ok']}</button>
                        </td>
                    </tr>
EOT;
                endtable();
                pagefooter();
                exit;
            }
            if ($superCage->get->getAlpha('shorturl') == 'add') {
                if (shorturl_get_permission() == 0) {
                    global $lang_errors;
                    load_template();
                    cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
                }
                if ($superCage->post->keyExists('url')) {
                    js_include('plugins/shorturl/jquery.copy.js');
                    load_template();
                    pageheader($lang_plugin_shorturl['your_url']);
                    starttable('100%', $lang_plugin_shorturl['your_url'], 2);
                    echo <<<EOT
                        <tr>
                            <td class="tableb">
EOT;
                    $regex = '^' . '(https?://){1,1}' . '(([0-9a-z_!~*\'().&=+$%-]+: ){0,1}' . '[0-9a-z_!~*\'().&=+$%-]+@){0,1}' . '(([0-9]{1,3}\\.){3}[0-9]{1,3}' . '|' . '(' . '([0-9a-z_!~*\'()-]+\\.)*' . '([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\\.' . '[a-z]{2,6}' . ')' . ')' . '(:[0-9]{1,4}){0,1}' . '((/?)|' . '(/[0-9a-zA-Z_!~*\'().;?:@&=+$,%\\#-]+)+/?)' . '$';
                    $url = $superCage->post->getRaw('url');
                    if (!preg_match('#' . $regex . '#i', $url)) {
                        echo $lang_plugin_shorturl['invalid_url'] . ": <tt>{$url}</tt> <br/> <form action=\"javascript:history.back();\"><button type=\"submit\" class=\"button\">{$lang_common['back']}</button></form>";
                    } else {
                        $result = cpg_db_query("SELECT rid FROM {$CONFIG['TABLE_PREFIX']}plugin_shorturl WHERE url = '{$url}'");
                        if (mysql_num_rows($result) > 0) {
                            $rid = mysql_result($result, 0);
                        } else {
                            cpg_db_query("INSERT INTO {$CONFIG['TABLE_PREFIX']}plugin_shorturl (url) VALUES ('{$url}')");
                            $result = cpg_db_query("SELECT rid FROM {$CONFIG['TABLE_PREFIX']}plugin_shorturl WHERE url = '{$url}'");
                            $rid = mysql_result($result, 0);
                        }
                        mysql_free_result($result);
                        $length = strlen($CONFIG['ecards_more_pic_target'] . "?r={$rid}") + 20;
                        $preview_status = sprintf($lang_plugin_shorturl['preview_status'], $CONFIG['plugin_shorturl_preview'] == 1 ? $lang_plugin_shorturl['enabled'] : $lang_plugin_shorturl['disabled']);
                        echo <<<EOT
                            <input id="shorturl" type="text" name="url" size="{$length}" class="textinput" value="{$CONFIG['ecards_more_pic_target']}?r={$rid}" readonly="readonly" onclick="\$(this).select();" />
                            <span style="cursor:help;" title="{$preview_status}">{$lang_plugin_shorturl['immediate_redirection']}</span>
                            <br />
                            <input id="shorturl_p" type="text" name="url" size="{$length}" class="textinput" value="{$CONFIG['ecards_more_pic_target']}?r={$rid}&amp;preview" readonly="readonly" onclick="\$(this).select();" />
                            {$lang_plugin_shorturl['display_link']}
EOT;
                    }
                    echo <<<EOT
                            </td>
                        </tr>
EOT;
                    endtable();
                    pagefooter();
                    exit;
                } else {
                    load_template();
                    pageheader($lang_plugin_shorturl['create_url']);
                    echo '<form method="post">';
                    starttable('100%', $lang_plugin_shorturl['enter_url'], 2);
                    list($timestamp, $form_token) = getFormToken();
                    echo <<<EOT
                        <tr>
                            <td class="tableb">
                                <input type="text" id="url" name="url" size="40" class="textinput" style="width:90%;" />
                                <input type="hidden" name="form_token" value="{$form_token}" />
                                <input type="hidden" name="timestamp" value="{$timestamp}" />
                            </td>
                            <td class="tableb">
                                <input type="submit" name="commit" class="button" value="{$lang_plugin_shorturl['shorten']}" />
                            </td>
                        </tr>
EOT;
                    endtable();
                    echo '</form>';
                    echo '<script type="text/javascript">$(document).ready(function() { $("#url").select(); });</script>';
                    pagefooter();
                    exit;
                }
            }
        }
    }
}
Ejemplo n.º 27
0
EOT;
    endtable();
    echo '<br />';
}
echo '<form action="index.php?file=limit_upload/admin" method="post">';
starttable("100%", $lang_plugin_limit_upload['limit_upload'] . " - " . $lang_gallery_admin_menu['admin_lnk'], 3);
$upload_limit = mysql_result(cpg_db_query("SELECT value FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'limit_upload_upload_limit'"), 0);
$time_limit = mysql_result(cpg_db_query("SELECT value FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'limit_upload_time_limit'"), 0);
foreach ($lang_plugin_limit_upload['upload_limit_values'] as $key => $value) {
    $selected = $time_limit == $key ? 'selected="selected"' : '';
    $time_limit_options .= "<option value=\"{$key}\" {$selected}>{$value}</option>";
}
$submit_icon = cpg_fetch_icon('ok', 1);
echo <<<EOT
    <tr>
        <td class="tableb">
            {$lang_plugin_limit_upload['upload_limit']}
        </td>
        <td class="tableb">
            <input type="input" class="listbox" size="5" name="upload_limit" id="plugin_limit_upload_files" value="{$upload_limit}" /> <select class="listbox" name="time_limit">{$time_limit_options}</select>
        </td>
        <td class="tableb">
            <button value="{$lang_common['apply_changes']}" name="submit" class="button" type="submit">{$submit_icon}{$lang_common['apply_changes']}</button>
        </td>
    </tr>
EOT;
endtable();
list($timestamp, $form_token) = getFormToken();
echo "<input type=\"hidden\" name=\"form_token\" value=\"{$form_token}\" />";
echo "<input type=\"hidden\" name=\"timestamp\" value=\"{$timestamp}\" />";
pagefooter();
Ejemplo n.º 28
0
function theme_slideshow()
{
    global $CONFIG, $lang_display_image_php, $template_display_media;
    pageheader($lang_display_image_php['slideshow']);
    include "include/slideshow.inc.php";
    $start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>';
    template_extract_block($template_display_media, 'img_desc', $start_slideshow);
    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100, '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />', '{ADMIN_MENU}' => '');
    starttable();
    echo <<<EOT
        <tr>
            <td align="center" class="navmenu" style="white-space: nowrap;">
                <div id="Title"></div>
            </td>
        </tr>
EOT;
    endtable();
    starttable();
    echo template_eval($template_display_media, $params);
    endtable();
    starttable();
    echo <<<EOT
        <tr>
                <td align="center" class="navmenu" style="white-space: nowrap;">
                        <a href="javascript:endSlideShow()" class="navmenu">{$lang_display_image_php['stop_slideshow']}</a>
                </td>
        </tr>

EOT;
    endtable();
    pagefooter();
}
Ejemplo n.º 29
0
function theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip)
{
    global $HTTP_COOKIE_VARS, $CONFIG;
    starttable();
    echo $nav_menu;
    endtable();
    starttable();
    echo $picture;
    endtable();
    if ($CONFIG['display_film_strip'] == 1) {
        // added film strip code: Zarsky
        echo $film_strip;
    }
    starttable();
    echo $votes;
    endtable();
    $picinfo = isset($HTTP_COOKIE_VARS['picinfo']) ? $HTTP_COOKIE_VARS['picinfo'] : ($CONFIG['display_pic_info'] ? 'block' : 'none');
    echo "<div id=\"picinfo\" style=\"display: {$picinfo};\">\n";
    starttable();
    echo $pic_info;
    endtable();
    echo "</div>\n";
    starttable();
    echo $comments;
    endtable();
}
Ejemplo n.º 30
0
function annotate_configure()
{
    global $CONFIG, $cpg_udb, $THEME_DIR, $thisplugin, $lang_plugin_annotate, $lang_common, $annotate_icon_array, $lang_errors, $annotate_installation, $annotate_title, $LINEBREAK;
    $superCage = Inspekt::makeSuperCage();
    $additional_submit_information = '';
    if (!GALLERY_ADMIN_MODE) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }
    // Form submit?
    if ($superCage->post->keyExists('submit') == TRUE) {
        //Check if the form token is valid
        if (!checkFormToken()) {
            cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
        }
        $config_changes_counter = annotate_configuration_submit();
        if ($config_changes_counter > 0) {
            $additional_submit_information .= '<div class="cpg_message_success">' . $lang_plugin_annotate['changes_saved'] . '</div>';
        } else {
            $additional_submit_information .= '<div class="cpg_message_validation">' . $lang_plugin_annotate['no_changes'] . '</div>';
        }
    }
    // Check if guests have greater permissions than registered users
    if ($CONFIG['plugin_annotate_permissions_' . $cpg_udb->guestgroup] > mysql_result(cpg_db_query("SELECT MIN(value) FROM {$CONFIG['TABLE_CONFIG']} WHERE name LIKE 'plugin_annotate_permissions_%'"), 0)) {
        $additional_submit_information .= '<div class="cpg_message_warning">' . $lang_plugin_annotate['guests_more_permissions_than_registered'] . '</div>';
    }
    // Create the table row that is displayed during initial install
    if ($annotate_installation == 1) {
        $additional_submit_information .= '<div class="cpg_message_info">' . $lang_plugin_annotate['submit_to_install'] . '</div>';
    }
    $option_output['plugin_annotate_disable_mobile'] = $CONFIG['plugin_annotate_disable_mobile'] ? 'checked="checked"' : '';
    if ($CONFIG['plugin_annotate_type'] == '0') {
        $option_output['plugin_annotate_type_0'] = 'checked="checked"';
        $option_output['plugin_annotate_type_1'] = '';
        $option_output['plugin_annotate_type_2'] = '';
        $option_output['plugin_annotate_type_3'] = '';
    } elseif ($CONFIG['plugin_annotate_type'] == '1') {
        $option_output['plugin_annotate_type_0'] = '';
        $option_output['plugin_annotate_type_1'] = 'checked="checked"';
        $option_output['plugin_annotate_type_2'] = '';
        $option_output['plugin_annotate_type_3'] = '';
    } elseif ($CONFIG['plugin_annotate_type'] == '2') {
        $option_output['plugin_annotate_type_0'] = '';
        $option_output['plugin_annotate_type_1'] = '';
        $option_output['plugin_annotate_type_2'] = 'checked="checked"';
        $option_output['plugin_annotate_type_3'] = '';
    } elseif ($CONFIG['plugin_annotate_type'] == '3') {
        $option_output['plugin_annotate_type_0'] = '';
        $option_output['plugin_annotate_type_1'] = '';
        $option_output['plugin_annotate_type_2'] = '';
        $option_output['plugin_annotate_type_3'] = 'checked="checked"';
    }
    list($timestamp, $form_token) = getFormToken();
    // Start the actual output
    echo <<<EOT
            <form action="" method="post" name="annotate_config" id="annotate_config">
EOT;
    starttable('100%', $annotate_icon_array['configure'] . $lang_plugin_annotate['configure_plugin'], 8);
    $display_stats_title = sprintf($lang_plugin_annotate['display_stats_title'], $lang_plugin_annotate['annotations_pic'], $lang_plugin_annotate['annotations_album'], $lang_plugin_annotate['annotated_pics']);
    echo <<<EOT
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_annotate['disable_mobile']}
                        </td>
                        <td valign="top" class="tableb" colspan="7">
                            <input type="checkbox" name="plugin_annotate_disable_mobile" id="plugin_annotate_disable_mobile" class="checkbox" value="1" {$option_output['plugin_annotate_disable_mobile']} />
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_annotate['annotation_type']}
                        </td>
                        <td valign="top" class="tableb" colspan="7">
                            <input type="radio" name="plugin_annotate_type" id="plugin_annotate_type_0" class="radio" value="0" {$option_output['plugin_annotate_type_0']} />
                            <label for="plugin_annotate_type_0" class="clickable_option">{$lang_plugin_annotate['drop_down_registered_users']}</label>
                            <br />
                            <input type="radio" name="plugin_annotate_type" id="plugin_annotate_type_1" class="radio" value="1" {$option_output['plugin_annotate_type_1']} />
                            <label for="plugin_annotate_type_1" class="clickable_option">{$lang_plugin_annotate['free_text']}</label>
                            <br />
                            <input type="radio" name="plugin_annotate_type" id="plugin_annotate_type_2" class="radio" value="2" {$option_output['plugin_annotate_type_2']} />
                            <label for="plugin_annotate_type_2" class="clickable_option">{$lang_plugin_annotate['drop_down_existing_annotations']}</label>
                            <br />
                            <input type="radio" name="plugin_annotate_type" id="plugin_annotate_type_3" class="radio" value="3" {$option_output['plugin_annotate_type_3']} />
                            <label for="plugin_annotate_type_3" class="clickable_option">{$lang_plugin_annotate['free_text']} + {$lang_plugin_annotate['drop_down_existing_annotations']}</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableh2" rowspan="2">
                            {$lang_plugin_annotate['group']}
                        </td>
                        <td valign="middle" align="center" class="tableh2" colspan="4">
                            {$lang_plugin_annotate['permissions']}
                        </td>
                        <td valign="middle" align="center" class="tableh2" colspan="1" rowspan="2"><span title="{$lang_plugin_annotate['display_notes_title']}" style="cursor:help;">{$lang_plugin_annotate['display_notes']}</span>
                        </td>
                        <td valign="middle" align="center" class="tableh2" colspan="1" rowspan="2">{$lang_plugin_annotate['display_links']}
                        </td>
                        <td valign="middle" align="center" class="tableh2" colspan="1" rowspan="2"><span title="{$display_stats_title}" style="cursor:help;">{$lang_plugin_annotate['display_stats']}</span>
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="center" class="tableh2">
                            <span title="{$lang_plugin_annotate['no_access']}" style="cursor:help;">{$annotate_icon_array['permission_none']}---</span>
                        </td>
                        <td valign="middle" align="center" class="tableh2">
                            <span title="{$lang_plugin_annotate['read_annotations']}" style="cursor:help;">{$annotate_icon_array['permission_read']}R--</span>
                        </td>
                        <td valign="middle" align="center" class="tableh2">
                            <span title="{$lang_plugin_annotate['read_write_annotations']}" style="cursor:help;">{$annotate_icon_array['permission_write']}RW-</span>
                        </td>
                        <td valign="middle" align="center" class="tableh2">
                            <span title="{$lang_plugin_annotate['read_write_delete_annotations']}" style="cursor:help;">{$annotate_icon_array['permission_delete']}RWD</span>
                        </td>
                    </tr>
EOT;
    // Group output --- start
    $loopCounter = 0;
    $result = cpg_db_query("SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_id ASC");
    while ($row = mysql_fetch_assoc($result)) {
        // while-loop mysql_fetch_assoc groups --- start
        if ($loopCounter / 2 == floor($loopCounter / 2)) {
            $cell_style = 'tableb';
        } else {
            $cell_style = 'tableb tableb_alternate';
        }
        $group_output[$row['group_id']] = '';
        if (in_array($row['group_id'], $cpg_udb->admingroups)) {
            echo <<<EOT
                <tr>
                    <td valign="top" align="left" class="{$cell_style}">
                        {$row['group_name']}
                    </td>
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" class="radio" disabled="disabled" />
                    </td>
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" class="radio" disabled="disabled" />
                    </td>
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" class="radio" disabled="disabled" />
                    </td>
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" class="radio" checked="checked" />
                    </td>
EOT;
        } else {
            $row['permission'] = mysql_result(cpg_db_query("SELECT value FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_annotate_permissions_{$row['group_id']}'"), 0);
            echo <<<EOT
                    <td valign="top" align="left" class="{$cell_style}">
                        {$row['group_name']}
                    </td>
EOT;
            for ($i = 0; $i <= 3; $i++) {
                if (!is_numeric($row['permission']) && $i == 0) {
                    $checked = "checked=\"checked\"";
                } else {
                    $checked = $row['permission'] == $i ? "checked=\"checked\"" : "";
                }
                echo <<<EOT
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" name="plugin_annotate_permissions_{$row['group_id']}" id="plugin_annotate_permissions_{$row['group_id']}_{$i}" class="radio" value="{$i}" {$checked} />
                    </td>
EOT;
            }
        }
        // display notes --- start
        if ($CONFIG['plugin_annotate_display_notes_' . $row['group_id']] == '1') {
            $checked = 'checked="checked"';
        } else {
            $checked = '';
        }
        echo <<<EOT
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="checkbox" name="plugin_annotate_display_notes_{$row['group_id']}" id="plugin_annotate_display_notes_{$row['group_id']}" class="checkbox" value="1" {$checked} />
                    </td>
EOT;
        // display notes --- end
        // display links --- start
        if ($CONFIG['plugin_annotate_display_links_' . $row['group_id']] == '1') {
            $checked = 'checked="checked"';
        } else {
            $checked = '';
        }
        echo <<<EOT
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="checkbox" name="plugin_annotate_display_links_{$row['group_id']}" id="plugin_annotate_display_links_{$row['group_id']}" class="checkbox" value="1" {$checked} />
                    </td>
EOT;
        // display links --- end
        // display stats --- start
        if ($CONFIG['plugin_annotate_display_stats_' . $row['group_id']] == '1') {
            $checked = 'checked="checked"';
        } else {
            $checked = '';
        }
        echo <<<EOT
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="checkbox" name="plugin_annotate_display_stats_{$row['group_id']}" id="plugin_annotate_display_stats_{$row['group_id']}" class="checkbox" value="1" {$checked} />
                    </td>
EOT;
        // display stats --- end
        $loopCounter++;
        echo <<<EOT
                    </tr>
EOT;
    }
    // while-loop mysql_fetch_assoc groups --- end
    mysql_free_result($result);
    // Group output --- end
    echo <<<EOT
                    <tr>
                        <td valign="middle" class="tablef">
                        </td>
                        <td valign="middle" class="tablef" colspan="7">
                            <input type="hidden" name="form_token" value="{$form_token}" />
                            <input type="hidden" name="timestamp" value="{$timestamp}" />
                            <button type="submit" class="button" name="submit" value="{$lang_common['ok']}">{$annotate_icon_array['ok']}{$lang_common['ok']}</button>
                        </td>
                    </tr>
EOT;
    endtable();
    echo <<<EOT
            {$additional_submit_information}
            </form>

EOT;
}