26

Re: Easy Poll + PROBLEMS :(

Could you send me your mail address then? Can't attach files to the PunBB mail function.
Thx in advance

wobo

FSFE Fellow #359 - The Freedom of Knowledge is a Human Right

Re: Easy Poll + PROBLEMS :(

Sent you a mail, you can mail them to that address.

28

Re: Easy Poll + PROBLEMS :(

Thx, will do tomorrow (or tonight if I had not too much hop blossom soup) ...

wobo

FSFE Fellow #359 - The Freedom of Knowledge is a Human Right

29

Re: Easy Poll + PROBLEMS :(

Bah, found the cause of the problem!
I uploaded only the English version of the plugin AP_Polls.php. The readme says to upload either the English plugin or the French Plugin (AP_Sondage.php).
Now, just for a change I uploaded the French version as well, and Boom! It works!

Thx for your efforts, Ben, I appreciate it!

wobo

FSFE Fellow #359 - The Freedom of Knowledge is a Human Right

Re: Easy Poll + PROBLEMS :(

No problem, happy to help smile

31

Re: Easy Poll + PROBLEMS :(

Well, now I have it installed I played with the poll function for a while. Questions about some important features arose:

1. How do I edit a poll after it was published? (very important)
Sometimes you forget an option or want to edit an option.

2. How do I hide the results from people until they have casted their vote? (very important)
In some polls you do not want to influence the voters by showing the results. Many people tend to vote for the most popular option.

3. How do I close a vote or let it run until a given date or for a number of days? (important)
Many votes are limited to a certain time span and you have to close the poll and show the final results of a contest.

4. How do I add a poll to an existing topic? (not really important)
Sometimes you discuss an issue and then you want to come to an end by having a poll.

I haven't found a way to do any of these things.

wobo

FSFE Fellow #359 - The Freedom of Knowledge is a Human Right

Re: Easy Poll + PROBLEMS :(

Can someone please help me out here. I have the image upload mod installed and I just installed the Easy Poll + mod. It all seems to work fine but I have a problem in the admin_option.php file. When I click on the checkbox to save the permissions, it just remains blank.

Here is the code I am using at the moment:

                // Now let's deal with the permissions
        if (isset($_POST['read_forum_old']))
        {
            $result = $db->query('SELECT g_id, g_read_board, g_post_replies, g_post_topics, g_post_polls FROM '.$db->prefix.'groups WHERE g_id!='.PUN_ADMIN) or error('Impossible de reFIND la liste des groupes d\'utilisateurs', __FILE__, __LINE__, $db->error());
            while ($cur_group = $db->fetch_assoc($result))
            {
                $read_forum_new = ($cur_group['g_read_board'] == '1') ? isset($_POST['read_forum_new'][$cur_group['g_id']]) ? $_POST['read_forum_new'][$cur_group['g_id']] : '0' : $_POST['read_forum_old'][$cur_group['g_id']];
                $post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? $_POST['post_replies_new'][$cur_group['g_id']] : '0';
                $post_topics_new = isset($_POST['post_topics_new'][$cur_group['g_id']]) ? $_POST['post_topics_new'][$cur_group['g_id']] : '0';
                $post_polls_new = isset($_POST['post_polls_new'][$cur_group['g_id']]) ? $_POST['post_polls_new'][$cur_group['g_id']] : '0';

                // Check if the new settings differ from the old
                if ($read_forum_new != $_POST['read_forum_old'][$cur_group['g_id']] || $post_replies_new != $_POST['post_replies_old'][$cur_group['g_id']] || $post_topics_new != $_POST['post_topics_old'][$cur_group['g_id']] || $post_polls_new != $_POST['post_polls_old'][$cur_group['g_id']])
                {
                    // If the new settings are identical to the default settings for this group, delete it's row in forum_perms
                    if ($read_forum_new == '1' && $post_replies_new == $cur_group['g_post_replies'] && $post_topics_new == $cur_group['g_post_topics'] && $post_polls_new == $cur_group['g_post_polls'])
                        $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Impossible de supprimer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
                    else
                    {
                        // Run an UPDATE and see if it affected a row, if not, INSERT
                        $db->query('UPDATE '.$db->prefix.'forum_perms SET read_forum='.$read_forum_new.', post_replies='.$post_replies_new.', post_topics='.$post_topics_new.', post_polls='.$post_polls_new.' WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Impossible d\'insérer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
                        if (!$db->affected_rows())
                            $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics, post_polls) VALUES('.$cur_group['g_id'].', '.$forum_id.', '.$read_forum_new.', '.$post_replies_new.', '.$post_topics_new.', '.$post_polls_new.')') or error('Impossible d\'insérer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
                    }
                }
            }
        }

and this is the code from the readme.txt file of the Easy Poll +

                // Now let's deal with the permissions
        if (isset($_POST['read_forum_old']))
        {
            $result = $db->query('SELECT g_id, g_read_board, g_post_replies, g_post_topics, g_post_polls FROM '.$db->prefix.'groups WHERE g_id!='.PUN_ADMIN) or error('Impossible de reFIND la liste des groupes d\'utilisateurs', __FILE__, __LINE__, $db->error());
            while ($cur_group = $db->fetch_assoc($result))
            {
                $read_forum_new = ($cur_group['g_read_board'] == '1') ? isset($_POST['read_forum_new'][$cur_group['g_id']]) ? $_POST['read_forum_new'][$cur_group['g_id']] : '0' : $_POST['read_forum_old'][$cur_group['g_id']];
                $post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? $_POST['post_replies_new'][$cur_group['g_id']] : '0';
                $post_topics_new = isset($_POST['post_topics_new'][$cur_group['g_id']]) ? $_POST['post_topics_new'][$cur_group['g_id']] : '0';
                $post_polls_new = isset($_POST['post_polls_new'][$cur_group['g_id']]) ? $_POST['post_polls_new'][$cur_group['g_id']] : '0';

                // Check if the new settings differ from the old
                if ($read_forum_new != $_POST['read_forum_old'][$cur_group['g_id']] || $post_replies_new != $_POST['post_replies_old'][$cur_group['g_id']] || $post_topics_new != $_POST['post_topics_old'][$cur_group['g_id']] || $post_polls_new != $_POST['post_polls_old'][$cur_group['g_id']])
                {
                    // If the new settings are identical to the default settings for this group, delete it's row in forum_perms
                    if ($read_forum_new == '1' && $post_replies_new == $cur_group['g_post_replies'] && $post_topics_new == $cur_group['g_post_topics'] && $post_polls_new == $cur_group['g_post_polls'])
                        $db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Impossible de supprimer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
                    else
                    {
                        // Run an UPDATE and see if it affected a row, if not, INSERT
                        $db->query('UPDATE '.$db->prefix.'forum_perms SET read_forum='.$read_forum_new.', post_replies='.$post_replies_new.', post_topics='.$post_topics_new.', post_polls='.$post_polls_new.' WHERE group_id='.$cur_group['g_id'].' AND forum_id='.$forum_id) or error('Impossible d\'insérer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
                        if (!$db->affected_rows())
                            $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics, post_polls) VALUES('.$cur_group['g_id'].', '.$forum_id.', '.$read_forum_new.', '.$post_replies_new.', '.$post_topics_new.', '.$post_polls_new.')') or error('Impossible d\'insérer les permissions de groupes du forum', __FILE__, __LINE__, $db->error());
                    }
                }
            }
        }

I need to incorporate the code below with the one above where you can see I am using the image_upload mod.

Thank you for any help.

Bingiman

Re: Easy Poll + PROBLEMS :(

Even though I know I won't get an answer for this problem on these forums, I figure it would be worth a final try. So here goes. I am using the Easy Poll + mod but also have the Icon Topics installed. This is my problem. When I use the Topic Icons in the post they are not displayed unless I remove the Easy Poll MOD code from the post.php file. Hopefully someone can help me with it. Here is the code area I know the problem is in.

        // If it's a new topic
        else if ($fid)
        {
            $icon_topic = $_POST['icon_topic'];
            if(isset($ptype)) // Si c'est un sondage
            {
                if ($ptype == 3) 
                    $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, last_post, last_poster, forum_id, question, yes, no) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape($subject) . '\', ' . $now . ', ' . $now . ', \'' . $db->escape($username) . '\', ' . $fid . ', \'' . $db->escape($question) . '\', \'' . $db->escape($yesval) . '\', \'' . $db->escape($noval) . '\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
                else
                    $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, last_post, last_poster, forum_id, question) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape($subject) . '\', ' . $now . ', ' . $now . ', \'' . $db->escape($username) . '\', ' . $fid . ', \'' . $db->escape($question) . '\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());

                $new_tid = $db->insert_id();
                if ($ptype != 0) 
                    $db->query('INSERT INTO ' . $db->prefix . 'polls (pollid, options, ptype) VALUES(' . $new_tid . ', \'' . $db->escape(serialize($option)) . '\', ' . $ptype . ')') or error('Unable to create poll', __FILE__, __LINE__, $db->error());
            }
            else
            {
            // Create the topic
    $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id, icon_topic) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.', '.$icon_topic.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
            $new_tid = $db->insert_id();
            }
            if (!$pun_user['is_guest'])
            {
                // To subscribe or not to subscribe, that ...
                if ($pun_config['o_subscriptions'] == '1' && (isset($_POST['subscribe']) && $_POST['subscribe'] == '1'))
                    $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$new_tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());

                // Create the post ("topic post")
                $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
            }
            else
            {
                // Create the post ("topic post")
                $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
                $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
            }
            $new_pid = $db->insert_id();

            // Update the topic with last_post_id
            $db->query('UPDATE '.$db->prefix.'topics SET last_post_id='.$new_pid.' WHERE id='.$new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());

            update_search_index('post', $new_pid, $message, $subject);

            update_forum($fid);
        }

        // If the posting user is logged in, increment his/her post count
        if (!$pun_user['is_guest'])
        {
            $low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
            $db->query('UPDATE '.$low_prio.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
        }

                $upload_result = process_uploaded_images($new_pid);
        redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $upload_result.$lang_post['Post redirect']);
    }
}