Example #1
0
function DKPraidCount($character_name)
{
    $sql99 = new db();
    $count30_total = $sql99->db_Count(DKPDB_TABLE_RAIDS, "(*)", "WHERE (raid_date BETWEEN '" . mktime(0, 0, 0, date('m'), date('d') - 30, date('Y')) . "' AND '" . time() . "')");
    $count60_total = $sql99->db_Count(DKPDB_TABLE_RAIDS, "(*)", "WHERE (raid_date BETWEEN '" . mktime(0, 0, 0, date('m'), date('d') - 60, date('Y')) . "' AND '" . time() . "')");
    $count90_total = $sql99->db_Count(DKPDB_TABLE_RAIDS, "(*)", "WHERE (raid_date BETWEEN '" . mktime(0, 0, 0, date('m'), date('d') - 90, date('Y')) . "' AND '" . time() . "')");
    $sql99->db_Select_gen("SELECT count(*) FROM " . MPREFIX . DKPDB_TABLE_RAIDS . " r, " . MPREFIX . DKPDB_TABLE_RAID_A . " ra WHERE (ra.raid_id = r.raid_id) AND (ra.member_name='" . $character_name . "') AND (r.raid_date BETWEEN " . mktime(0, 0, 0, date('m'), date('d') - 30, date('Y')) . " AND " . time() . ")");
    while ($row99 = $sql99->db_Fetch()) {
        $count30_member = $row99['count(*)'];
    }
    $sql99->db_Select_gen("SELECT count(*) FROM " . MPREFIX . DKPDB_TABLE_RAIDS . " r, " . MPREFIX . DKPDB_TABLE_RAID_A . " ra WHERE (ra.raid_id = r.raid_id) AND (ra.member_name='" . $character_name . "') AND (r.raid_date BETWEEN " . mktime(0, 0, 0, date('m'), date('d') - 60, date('Y')) . " AND " . time() . ")");
    while ($row99 = $sql99->db_Fetch()) {
        $count60_member = $row99['count(*)'];
    }
    $sql99->db_Select_gen("SELECT count(*) FROM " . MPREFIX . DKPDB_TABLE_RAIDS . " r, " . MPREFIX . DKPDB_TABLE_RAID_A . " ra WHERE (ra.raid_id = r.raid_id) AND (ra.member_name='" . $character_name . "') AND (r.raid_date BETWEEN " . mktime(0, 0, 0, date('m'), date('d') - 90, date('Y')) . " AND " . time() . ")");
    while ($row99 = $sql99->db_Fetch()) {
        $count90_member = $row99['count(*)'];
    }
    $percent30 = $count30_total > 0 ? round($count30_member / $count30_total * 100) : 0;
    $percent60 = $count60_total > 0 ? round($count60_member / $count60_total * 100) : 0;
    $percent90 = $count90_total > 0 ? round($count90_member / $count90_total * 100) : 0;
    $return_array = array();
    array_push($return_array, $percent30, $percent60, $percent90);
    return $return_array;
}
Example #2
0
 function get_current_table($table_name, $prefix = "")
 {
     global $sql;
     if (!isset($sql)) {
         $sql = new db();
     }
     if (!$prefix) {
         $prefix = MPREFIX;
     }
     //	echo "Get table structure for: {$table_name}, prefix: {$prefix}<br />";
     $sql->db_Select_gen('SET SQL_QUOTE_SHOW_CREATE = 1');
     $qry = 'SHOW CREATE TABLE `' . $prefix . $table_name . "`";
     if (!($z = $sql->db_Select_gen($qry))) {
         return FALSE;
     }
     $row = $sql->db_Fetch(MYSQL_NUM);
     $tmp = str_replace("`", "", stripslashes($row[1])) . ';';
     // Add semicolon to work with our parser
     $count = preg_match_all("#CREATE\\s+?TABLE\\s+?`{0,1}({$prefix}{$table_name})`{0,1}\\s+?\\((.*?)\\)\\s+?(?:TYPE|ENGINE)\\s*\\=\\s*(.*?);#is", $tmp, $matches, PREG_SET_ORDER);
     if ($count === FALSE) {
         return "Error occurred";
     }
     if (!$count) {
         return "No matches";
     }
     return $matches;
 }
Example #3
0
function getPDFPrefs()
{
    global $sql, $eArrayStorage;
    if (!is_object($sql)) {
        $sql = new db();
    }
    $num_rows = $sql->db_Select("core", "*", "e107_name='pdf' ");
    if ($num_rows == 0) {
        $tmp = getDefaultPDFPrefs();
        $tmp2 = $eArrayStorage->WriteArray($tmp);
        $sql->db_Insert("core", "'pdf', '" . $tmp2 . "' ");
        $sql->db_Select("core", "*", "e107_name='pdf' ");
    }
    $row = $sql->db_Fetch();
    $pdfpref = $eArrayStorage->ReadArray($row['e107_value']);
    return $pdfpref;
}
 function roster_show()
 {
     global $sql, $sql2;
     // make the groups
     $groups_q = $sql->db_Select("roster_groups", "*", "roster_group_id!='0' ORDER BY roster_group_order ASC");
     $tables = "";
     while ($row = $sql->db_Fetch(MYSQL_ASSOC)) {
         $tables .= "<table class=\"roster\" width=\"100%\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"roster_main\" colspan=\"6\">{$row['roster_group_name']}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"roster_header\" width=\"40%\">" . roster_LAN_ROSTER_NAME . "</td>\n\t\t\t\t\t\t<td class=\"roster_header\" width=\"25%\">" . roster_LAN_ROSTER_UASSIGN . "</td>\n\t\t\t\t\t\t<td class=\"roster_header\" width=\"20%\">" . roster_LAN_ROSTER_SERIAL . "</td>\n\t\t\t\t\t\t<td class=\"roster_header\" width=\"15%\">" . roster_LAN_ROSTER_STATUS . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
         $sql3 = new db();
         // get the members in this group
         $members_q = $sql2->db_Select("roster_members", "*", "roster_member_group='" . $row['roster_group_id'] . "' ORDER BY roster_member_ranknum ASC, roster_member_rankdate ASC, roster_member_name ASC");
         while ($row2 = $sql2->db_Fetch(MYSQL_ASSOC)) {
             if ($row2['roster_member_status'] == "Retired") {
                 $status = "<font color=\"#ff0000\">Retired</font>";
             } else {
                 if ($row2['roster_member_status'] == "Reserve") {
                     $status = "<font color=\"#d9c30a\">Reserve</font>";
                 } else {
                     if ($row2['roster_member_status'] == "On Leave") {
                         $status = "<font color=\"#ff9c00\">On Leave</font>";
                     } else {
                         $status = "<font color=\"#48E702\">Active Duty</font>";
                     }
                 }
             }
             $i++;
             $rank = explode(",", $row2['roster_member_rank']);
             $site_name = $rank[2] . "-" . $row2['roster_member_name'];
             $info_q = $sql3->db_Select("user", "*", "user_name='" . $site_name . "'");
             $info_a = $sql3->db_Fetch(MYSQL_ASSOC);
             $pm = "<a href=\"" . e_PLUGIN . "pm/pm.php?send." . $info_a['user_id'] . "\"><img src=\"" . e_THEME . "AA/forum/pm.png\" border=\"0\" /></a>";
             if ($i % 2 == 0) {
                 $tables .= "<tr>\n\t\t\t\t\t\t\t<td class=\"roster_row1\"><a href=\"userinfo.php?m_id={$row1['roster_member_id']}\">{$rank[0]} {$row1['roster_member_name']}</a></td>\n\t\t\t\t\t\t\t<td class=\"roster_row1\">{$row1['roster_member_unit']}</td>\n\t\t\t\t\t\t\t<td class=\"roster_row1\">{$row1['roster_member_serial']}</div></td>\n\t\t\t\t\t\t\t<td class=\"roster_row1\"><div align=\"center\">{$status}</div></td>\n\t\t\t\t\t\t</tr>";
             } else {
                 $tables .= "<tr>\n\t\t\t\t\t\t\t<td class=\"roster_row2\"><a href=\"userinfo.php?m_id={$row2['roster_member_id']}\">{$rank[0]} {$row2['roster_member_name']}</a></td>\n\t\t\t\t\t\t\t<td class=\"roster_row2\">{$row2['roster_member_unit']}</td>\n\t\t\t\t\t\t\t<td class=\"roster_row2\">{$row2['roster_member_serial']}</td>\n\t\t\t\t\t\t\t<td class=\"roster_row2\"><div align=\"center\">{$status}</div></td>\n\t\t\t\t\t\t</tr>";
             }
         }
         $tables .= "</table><br /><br />";
     }
     return $tables;
 }
Example #5
0
function search_content($row)
{
    global $con;
    $sqlCon = new db();
    // Use a separate DB to avoid interfering with main query
    $res['link'] = e_PLUGIN . "content/content.php?content." . $row['content_id'];
    $res['pre_title'] = "";
    $res['title'] = $row['content_heading'];
    $res['summary'] = $row['content_summary'] . ' ' . $row['content_text'];
    //get category heading
    if ($row['content_parent'] == '0') {
        $qry = "\n\t\tSELECT c.content_heading\n\t\tFROM #pcontent as c\n\t\tWHERE c.content_id = '" . $row['content_id'] . "' ";
    } elseif (strpos($row['content_parent'], "0.") !== FALSE) {
        $tmp = explode(".", $row['content_parent']);
        $qry = "\n\t\tSELECT c.content_heading\n\t\tFROM #pcontent as c\n\t\tWHERE c.content_id = '" . intval($tmp[1]) . "' ";
    } else {
        $qry = "\n\t\tSELECT c.*, p.*\n\t\tFROM #pcontent as c\n\t\tLEFT JOIN #pcontent as p ON p.content_id = c.content_parent\n\t\tWHERE c.content_id = '" . $row['content_id'] . "' ";
    }
    $sqlCon->db_Select_gen($qry);
    $cat = $sqlCon->db_Fetch();
    $res['detail'] = LAN_SEARCH_3 . $con->convert_date($row['content_datestamp'], "long") . " " . CONT_SCH_LAN_4 . " " . $cat['content_heading'];
    return $res;
}
Example #6
0
File: faqs.php Project: armpit/e107
 function view_faq($idx)
 {
     global $ns, $row, $sql, $aj, $pref, $cobj, $id, $tp, $FAQ_VIEW_TEMPLATE;
     //require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
     $sc = e107::getScBatch('faqs', TRUE);
     $sql->db_Select("faqs", "*", "faq_id='{$idx}' LIMIT 1");
     $row = $sql->db_Fetch();
     $sc->setVars($row);
     $caption = "&nbsp;FAQ #" . $row['faq_id'];
     $text = $tp->parseTemplate($FAQ_VIEW_TEMPLATE, true);
     //	$text = $tp->toHTML($text, TRUE);
     $ret['text'] = $text;
     $ret['caption'] = $caption;
     $ret['title'] = $row['faq_question'];
     $ret['comments'] = $text;
     return $ret;
     $subject = !$subject ? $aj->formtpa($faq_question) : $subject;
     if (check_class($row['faq_comment'])) {
         $action = "comment";
         $table = "faq";
         $query = $pref['nested_comments'] ? "comment_item_id='{$idx}' AND (comment_type='{$table}' OR comment_type='3') AND comment_pid='0' ORDER BY comment_datestamp" : "comment_item_id='{$idx}' AND (comment_type='{$table}' OR comment_type='3') ORDER BY comment_datestamp";
         unset($text);
         if (!is_object($sql2)) {
             $sql2 = new db();
         }
         if ($comment_total = $sql2->db_Select("comments", "*", $query)) {
             $width = 0;
             while ($row = $sql2->db_Fetch()) {
                 if ($pref['nested_comments']) {
                     $text = $cobj->render_comment($row, $table, $action, $idx . "." . $id, $width, $subject);
                     $ns->tablerender(FAQLAN_38, $text);
                 } else {
                     $text .= $cobj->render_comment($row, $table, $action, $idx . "." . $id, $width, $subject);
                 }
             }
             if (!$pref['nested_comments']) {
                 $ns->tablerender(LAN_COMMENTS, $text);
             }
             if (ADMIN && getperms("B")) {
                 // bkwon 05-Jun-2004 fix URL to moderate comment
                 echo "<div style='text-align:right'><a href='" . e_ADMIN . "modcomment.php?faq.{$faq_id}'>moderate comments</a></div><br />";
             }
         }
         $cobj->form_comment($action, $table, $idx . "." . $id, $subject, $content_type);
     }
     // end of check_class
 }
Example #7
0
function print_item_pdf($id)
{
    global $tp, $pref, $content_shortcodes;
    global $CONTENT_PRINT_IMAGES, $row, $content_image_path, $content_pref, $mainparent;
    //in this section you decide what to needs to be output to the pdf file
    $con = new convert();
    require_once e_PLUGIN . "content/content_shortcodes.php";
    require_once e_PLUGIN . "content/handlers/content_class.php";
    $aa = new content();
    if (!is_object($sql)) {
        $sql = new db();
    }
    $sql->db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_image, content_author, content_parent, content_datestamp, content_class, content_pref", "content_id='" . intval($id) . "' ");
    $row = $sql->db_Fetch();
    if (!check_class($row['content_class'])) {
        header("location:" . e_PLUGIN . "content/content.php");
        exit;
    }
    $authordetails = $aa->getAuthor($row['content_author']);
    $row['content_datestamp'] = $con->convert_date($row['content_datestamp'], "long");
    $img = $tp->parseTemplate('{CONTENT_PRINT_IMAGES}', FALSE, $content_shortcodes);
    $mainparent = $aa->getMainParent(intval($id));
    $content_pref = $aa->getContentPref($mainparent);
    $content_icon_path = $tp->replaceConstants($content_pref["content_icon_path"]);
    $content_image_path = $tp->replaceConstants($content_pref["content_image_path"]);
    $img = $tp->parseTemplate('{CONTENT_PDF_IMAGES}', FALSE, $content_shortcodes);
    //add custom and preset tags if present
    $custom = e107::unserialize($row['content_pref']);
    //$custom						= $eArrayStorage->ReadxxxArray($row['content_pref']);
    $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11);
    $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
    if (!empty($custom)) {
        foreach ($custom as $k => $v) {
            if ($k == "content_custom_presettags") {
                if (isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]) {
                    foreach ($v as $ck => $cv) {
                        if (is_array($cv)) {
                            //date
                            if (!($cv['day'] == "" && $cv['month'] == "" && $cv['year'] == "")) {
                                $vv = $cv['day'] . " " . $months[$cv['month'] - 1] . " " . $cv['year'];
                            }
                        } else {
                            $vv = $cv;
                        }
                        if (isset($ck) && $ck != "" && isset($vv) && $vv != "") {
                            $CUSTOM_TAGS = TRUE;
                            $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($ck, true);
                            $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($vv, true);
                            $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY . " : " . $CONTENT_CONTENT_TABLE_CUSTOM_VALUE . "<br />";
                        }
                    }
                }
            } else {
                if (isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]) {
                    $key = substr($k, 15);
                    if (isset($key) && $key != "" && isset($v) && $v != "") {
                        $CUSTOM_TAGS = TRUE;
                        $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($key, true);
                        $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($v, true);
                        $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY . " : " . $CONTENT_CONTENT_TABLE_CUSTOM_VALUE . "<br />";
                    }
                }
            }
        }
    }
    $text = "\n\t<b>" . $row['content_heading'] . "</b><br />\n\t" . $row['content_subheading'] . "<br />\n\t" . $authordetails[1] . ", " . $row['content_datestamp'] . "<br />\n\t<br />\n\t" . $row['content_text'] . "<br />\n\t" . ($CONTENT_CONTENT_TABLE_CUSTOM_TAGS ? $CONTENT_CONTENT_TABLE_CUSTOM_TAGS : "") . "\n\t<div style='float:left; padding-left:10px;'>" . $img . "</div>\n\t";
    //the following defines are processed in the document properties of the pdf file
    //Do NOT add parser function to the variables, leave them as raw data !
    //as the pdf methods will handle this !
    $text = $text;
    //define text
    $creator = SITENAME;
    //define creator
    $author = $authordetails[1];
    //define author
    $title = $row['content_heading'];
    //define title
    $subject = $row['content_subheading'];
    //define subject
    $keywords = "";
    //define keywords
    //define url to use in the header of the pdf file
    $url = SITEURLBASE . e_PLUGIN_ABS . "content/content.php?content." . $row['content_id'];
    //always return an array with the following data:
    return array($text, $creator, $author, $title, $subject, $keywords, $url);
}
Example #8
0
/**
 * 	Do PM DB maintenance
 *	@param array $opts of tasks key = sent|rec|blocked|expired  (one or more present). ATM value not used
 *	@return array where key is message type (E_MESSAGE_SUCCESS|E_MESSAGE_ERROR|E_MESSAGE_INFO etc), data is array of messages of that type (key = timestamp)
 */
function doMaint($opts, $pmPrefs)
{
    if (!count($opts)) {
        return array(E_MESSAGE_ERROR => array(ADLAN_PM_66));
    }
    $results = array(E_MESSAGE_INFO => array(ADLAN_PM_67));
    // 'Maintenance started' - primarily for a log entry to mark start time
    $logResults = array();
    $e107 = e107::getInstance();
    $e107->admin_log->log_event('PM_ADM_04', implode(', ', array_keys($opts)));
    $pmHandler = new private_message($pmPrefs);
    $db2 = new db();
    // Will usually need a second DB object to avoid over load
    $start = 0;
    // Use to ensure we get different log times
    if (isset($opts['sent'])) {
        $cnt = 0;
        if ($res = $db2->gen("SELECT pm.pm_id FROM `#private_msg` AS pm LEFT JOIN `#user` AS u ON pm.`pm_from` = `#user`.`user_id`\n\t\t\t\t\tWHERE (pm.`pm_read_del = 1) AND `#user`.`user_id` IS NULL")) {
            while ($row = $db2->fetch(MYSQL_ASSOC)) {
                if ($pmHandler->del($row['pm_id']) !== FALSE) {
                    $cnt++;
                }
            }
        }
        $start = time();
        $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $cnt, ADLAN_PM_74);
    }
    if (isset($opts['rec'])) {
        $cnt = 0;
        if ($res = $db2->gen("SELECT pm.pm_id FROM `#private_msg` AS pm LEFT JOIN `#user` AS u ON pm.`pm_to` = `#user`.`user_id`\n\t\t\t\t\tWHERE (pm.`pm_sent_del = 1) AND `#user`.`user_id` IS NULL")) {
            while ($row = $db2->fetch(MYSQL_ASSOC)) {
                if ($pmHandler->del($row['pm_id']) !== FALSE) {
                    $cnt++;
                }
            }
        }
        $start = max($start + 1, time());
        $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $cnt, ADLAN_PM_75);
    }
    if (isset($opts['blocked'])) {
        if ($res = $db2->gen("DELETE `#private_msg_block` FROM `#private_msg_block` LEFT JOIN `#user` ON `#private_msg_block`.`pm_block_from` = `#user`.`user_id`\n\t\t\t\t\tWHERE `#user`.`user_id` IS NULL")) {
            $start = max($start + 1, time());
            $results[E_MESSAGE_ERROR][$start] = str_replace(array('--NUM--', '--TEXT--'), array($this->sql->getLastErrorNum, $this->sql->getLastErrorText), ADLAN_PM_70);
        } else {
            $start = max($start + 1, time());
            $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $res, ADLAN_PM_69);
        }
        if ($res = $db2->gen("DELETE `#private_msg_block` FROM `#private_msg_block` LEFT JOIN `#user` ON `#private_msg_block`.`pm_block_to` = `#user`.`user_id`\n\t\t\t\t\tWHERE `#user`.`user_id` IS NULL")) {
            $start = max($start + 1, time());
            $results[E_MESSAGE_ERROR][$start] = str_replace(array('--NUM--', '--TEXT--'), array($this->sql->getLastErrorNum, $this->sql->getLastErrorText), ADLAN_PM_70);
        } else {
            $start = max($start + 1, time());
            $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $res, ADLAN_PM_68);
        }
    }
    if (isset($opts['expired'])) {
        $del_qry = array();
        $read_timeout = intval($pmPrefs['read_timeout']);
        $unread_timeout = intval($pmPrefs['unread_timeout']);
        if ($read_timeout > 0) {
            $timeout = time() - $read_timeout * 86400;
            $del_qry[] = "(pm_sent < {$timeout} AND pm_read > 0)";
        }
        if ($unread_timeout > 0) {
            $timeout = time() - $unread_timeout * 86400;
            $del_qry[] = "(pm_sent < {$timeout} AND pm_read = 0)";
        }
        if (count($del_qry) > 0) {
            $qry = implode(' OR ', $del_qry);
            $cnt = 0;
            if ($db2->db_Select('private_msg', 'pm_id', $qry)) {
                while ($row = $db2->db_Fetch(MYSQL_ASSOC)) {
                    if ($pmHandler->del($row['pm_id']) !== FALSE) {
                        $cnt++;
                    }
                }
            }
            $start = max($start + 1, time());
            $results[E_MESSAGE_SUCCESS][$start] = str_replace('--COUNT--', $cnt, ADLAN_PM_73);
        } else {
            $start = max($start + 1, time());
            $results[E_MESSAGE_ERROR][$start] = ADLAN_PM_72;
        }
    }
    if (isset($opts['attach'])) {
        // Check for orphaned and missing attachments
        require_once e_HANDLER . 'file_class.php';
        $fl = new e_file();
        $missing = array();
        $orphans = array();
        $fileArray = $fl->get_files(e_PLUGIN . 'pm/attachments');
        if ($db2->select('private_msg', 'pm_id, pm_attachments', "pm_attachments != ''")) {
            while ($row = $db2->fetch(MYSQL_ASSOC)) {
                $attachList = explode(chr(0), $row['pm_attachments']);
                foreach ($attachList as $a) {
                    $found = FALSE;
                    foreach ($fileArray as $k => $fd) {
                        if ($fd['fname'] == $a) {
                            $found = TRUE;
                            unset($fileArray[$k]);
                            break;
                        }
                    }
                    if (!$found) {
                        $missing[] = $row['pm_id'] . ':' . $a;
                    }
                }
            }
        }
        // Any files left in $fileArray now are unused
        if (count($fileArray)) {
            foreach ($fileArray as $k => $fd) {
                unlink($fd['path'] . $fd['fname']);
                $orphans[] = $fd['fname'];
            }
        }
        $attachMessage = str_replace(array('--ORPHANS--', '--MISSING--'), array(count($orphans), count($missing)), ADLAN_PM_79);
        if (TRUE) {
            // Mostly for testing - probably disable this
            if (count($orphans)) {
                $attachMessage .= '[!br!]Orphans:[!br!]' . implode('[!br!]', $orphans);
            }
            if (count($missing)) {
                $attachMessage .= '[!br!]Missing:[!br!]' . implode('[!br!]', $missing);
            }
        }
        $start = max($start + 1, time());
        $results[E_MESSAGE_SUCCESS][$start] = $attachMessage;
    }
    $e107->admin_log->logArrayAll('PM_ADM_03', makeLogEntry($results));
    foreach ($results as $k => $r) {
        foreach ($r as $sk => $s) {
            $results[$k][$sk] = str_replace('[!br!]', '<br />', $s);
        }
    }
    return $results;
}
Example #9
0
// Get language file (assume that the English language file is always present)
include_lan(e_PLUGIN . 'easyshop/languages/' . e_LANGUAGE . '.php');
// Read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
require_once 'includes/ipn_functions.php';
require_once 'easyshop_class.php';
foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&{$key}={$value}";
}
$log = fopen("ipn.log", "a");
fwrite($log, "\n\nipn - " . gmstrftime("%b %d %Y %H:%M:%S", time()));
// Retrieve the sandbox setting from the shop preferences
$sql = new db();
$sql->db_Select(DB_TABLE_SHOP_PREFERENCES, "*", "store_id=1");
if ($row = $sql->db_Fetch()) {
    $sandbox = $row['sandbox'];
    $paypal_primary_email = $row['paypal_primary_email'];
}
if ($sandbox == 2) {
    $actionDomain = "www.sandbox.paypal.com";
} else {
    $actionDomain = "www.paypal.com";
}
// Post back to PayPal system to validate
$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Host: " . $actionDomain . "\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen('ssl://' . $actionDomain, "443", $errno, $errstr, 30);
if (!$fp) {
Example #10
0
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = EB_L1;
$eplug_version = "{$majorRevision}.{$minorRevision}.{$revRevision}";
$eplug_author = "Frederic Marchais (qam4)";
$eplug_logo = "";
$eplug_url = "http://www.ebattles.net";
$eplug_email = "*****@*****.**";
$eplug_description = EB_L2;
$eplug_compatible = "e107v0.7+";
$eplug_compliant = TRUE;
// indicator if plugin is XHTML compliant, shows icon
$eplug_readme = "";
// leave blank if no readme file
$eb_SQL = new db();
$eb_SQL->db_Select("plugin", "plugin_version", "plugin_path='ebattles' AND plugin_installflag > 0");
list($eb_version_string) = $eb_SQL->db_Fetch();
$eb_version_string = preg_replace("/[a-zA-z\\s]/", '', $eb_version_string);
$eb_version = explode('.', $eb_version_string, 3);
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "ebattles";
// Name of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = TRUE;
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "admin_config.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder . "/images/ebattles_32.ico";
$eplug_icon_small = $eplug_folder . "/images/ebattles_16.ico";
//$eplug_caption =  EB_L3;
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_prefs = array("eb_events_update_delay" => 60, "eb_events_update_delay_enable" => 0, "eb_mod_class" => e_UC_ADMIN, "eb_events_create_class" => e_UC_MEMBER, "eb_teams_create_class" => e_UC_MEMBER, "eb_media_submit_class" => e_UC_MEMBER, "eb_tab_theme" => 'default', "eb_max_image_size_check" => 1, "eb_max_image_size" => 16, "eb_default_items_per_page" => 25, "eb_max_avatar_size" => 32, "eb_avatar_enable_playersstandings" => 1, "eb_avatar_default_image" => 'anonymous.png', "eb_avatar_enable_teamsstandings" => 1, "eb_avatar_enable_teamslist" => 1, "eb_avatar_default_team_image" => 'default_group_avatar.png', "eb_links_menuheading" => EB_ADMIN_L29, "eb_activity_menuheading" => EB_ADMIN_L31, "eb_activity_number_of_items" => 10, "eb_activity_max_image_size_check" => 1, "eb_activity_max_image_size" => 16, "eb_disclaimer" => EB_ADMIN_L37, "eb_max_number_media" => 3, "eb_max_map_image_size_check" => 1, "eb_max_map_image_size" => 80, "eb_pm_notifications_class" => e_UC_MEMBER, "eb_email_notifications_class" => e_UC_NOBODY, "eb_links_showcreateevent" => 1, "eb_links_showcreateteam" => 1, "eb_links_showmatchsplayed" => 1, "eb_links_showmatchstoapprove" => 1, "eb_links_showmatchspending" => 1, "eb_links_showmatchesscheduled" => 1, "eb_links_showchallengesrequested" => 1, "eb_links_showchallengesunconfirmed" => 1, "eb_gold_active" => false, "eb_gold_userclass" => e_UC_ADMIN, "eb_gold_playmatch" => 0);
// List of table names -----------------------------------------------------------------------------------------------
Example #11
0
    // End of while for main categories
}
// End of if active main categories count > 0
// Select all active categories without main category  (Remain backwards compatible with EasyShop 1.2 AND main category is not mandatory)
$sql1 = new db();
$sql1->db_Select(DB_TABLE_SHOP_ITEM_CATEGORIES, "*", "category_active_status = '2' AND category_main_id='' AND (category_class IN (" . USERCLASS_LIST . ")) ");
while ($row1 = $sql1->db_Fetch()) {
    $category_id = $row1['category_id'];
    $category_name = $row1['category_name'];
    $sql2 = new db();
    // Count all active products of the fetched category
    $active_prod_count = $sql2->db_Count(DB_TABLE_SHOP_ITEMS, "(*)", "WHERE item_active_status = '2' AND category_id={$category_id}");
    $l_text .= "<tr><td>&nbsp;&nbsp;<a href='" . e_PLUGIN . "easyshop/easyshop.php?cat.{$category_id}'><b>" . $category_name . "</b></a> ({$active_prod_count})</td></tr>";
    $active_prod_count > 0 ? $l_text .= "<tr><td><ul>" : "";
    // For valid XHTML 1.1
    $sql3 = new db();
    // Select all active products of the fetched category
    $sql3->db_Select(DB_TABLE_SHOP_ITEMS, "*", "item_active_status = '2' AND category_id={$category_id} ORDER BY item_order");
    while ($row3 = $sql3->db_Fetch()) {
        $item_id = $row3['item_id'];
        $item_name = $row3['item_name'];
        $l_text .= "<li><a href='" . e_PLUGIN . "easyshop/easyshop.php?prod.{$item_id}'>" . $item_name . "</a></li>";
    }
    // End of while for products
    $active_prod_count > 0 ? $l_text .= "</ul></td></tr>" : "";
    // For valid XHTML 1.1
}
// End of while for categories
$l_text .= "</table>";
$caption = "<div style='text-align:center;'>" . EASYSHOP_PUBLICMENU2_01 . " (" . ($active_main_count > 0 ? $active_main_count : $active_cat_count) . ")</div>";
$ns->tablerender($caption, $l_text);
Example #12
0
 /**
  * Render a single comment and any nested comments it may have. 
  *
  * @param array $row
  * @param string $table
  * @param string $action
  * @param integer $id
  * @param interger $width
  * @param string $subject
  * @param integer $addrating
  * @return html
  */
 function render_comment($row, $table, $action, $id, $width, $subject, $addrating = FALSE)
 {
     //addrating	: boolean, to show rating system in rendered comment
     global $sc_style, $gen;
     $tp = e107::getParser();
     $sql = e107::getDb();
     $pref = e107::getPref();
     if (vartrue($pref['comments_disabled'])) {
         return;
     }
     global $NEWIMAGE, $USERNAME, $RATING, $datestamp;
     global $thisaction, $thistable, $thisid, $e107;
     $comrow = $row;
     $thistable = $table;
     $thisid = $id;
     $thisaction = $action;
     //FIXME - new level handler, currently commented to avoid parse errors
     //require_once (e_HANDLER."level_handler.php");
     if (!$width) {
         $width = 0;
     }
     if (!defined("IMAGE_nonew_comments")) {
         define("IMAGE_nonew_comments", file_exists(THEME . "images/nonew_comments.png") ? "<img src='" . THEME_ABS . "images/nonew_comments.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/nonew_comments.png' alt=''  />");
     }
     if (!defined("IMAGE_new_comments")) {
         define("IMAGE_new_comments", file_exists(THEME . "images/new_comments.png") ? "<img src='" . THEME_ABS . "images/new_comments.png' alt=''  /> " : "<img src='" . e_IMAGE_ABS . "generic/new_comments.png' alt=''  /> ");
     }
     //		$ns = new e107table;
     if (!$gen || !is_object($gen)) {
         $gen = new convert();
     }
     $row['rating_enabled'] = true;
     // Toggles rating shortcode. //TODO add pref
     e107::getScBatch('comment')->setVars($row);
     $COMMENT_TEMPLATE = $this->template;
     $COMMENT_TEMPLATE['ITEM_START'] = "\n\n<div id='{COMMENT_ITEMID}' class='comment-box clearfix'>\n";
     $COMMENT_TEMPLATE['ITEM_END'] = "\n</div><div class='clear_b'><!-- --></div>\n";
     if (vartrue($pref['nested_comments'])) {
         $width2 = 100 - $width;
         $total_width = "95%";
         if ($width) {
             $renderstyle = $COMMENT_TEMPLATE['ITEM_START'];
             $renderstyle .= "<div style='margin-left:{$width}%'>" . $COMMENT_TEMPLATE['ITEM'] . "</div>";
             $renderstyle .= $COMMENT_TEMPLATE['ITEM_END'];
         } else {
             $renderstyle = $COMMENT_TEMPLATE['ITEM_START'] . $COMMENT_TEMPLATE['ITEM'] . $COMMENT_TEMPLATE['ITEM_END'];
         }
         if ($pref['comments_icon']) {
             if ($comrow['comment_datestamp'] > USERLV) {
                 $NEWIMAGE = IMAGE_new_comments;
             } else {
                 $NEWIMAGE = IMAGE_nonew_comments;
             }
         } else {
             $NEWIMAGE = "";
         }
     } else {
         $renderstyle = $COMMENT_TEMPLATE['ITEM'];
     }
     $highlight_search = FALSE;
     if (isset($_POST['highlight_search'])) {
         $highlight_search = TRUE;
     }
     if (!defined("IMAGE_rank_main_admin_image")) {
         define("IMAGE_rank_main_admin_image", isset($pref['rank_main_admin_image']) && $pref['rank_main_admin_image'] && file_exists(THEME . "forum/" . $pref['rank_main_admin_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_main_admin_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/main_admin.png' alt='' />");
     }
     if (!defined("IMAGE_rank_moderator_image")) {
         define("IMAGE_rank_moderator_image", isset($pref['rank_moderator_image']) && $pref['rank_moderator_image'] && file_exists(THEME . "forum/" . $pref['rank_moderator_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_moderator_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/admin.png' alt='' />");
     }
     if (!defined("IMAGE_rank_admin_image")) {
         define("IMAGE_rank_admin_image", isset($pref['rank_admin_image']) && $pref['rank_admin_image'] && file_exists(THEME . "forum/" . $pref['rank_admin_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_admin_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/lite/admin.png' alt='' />");
     }
     //	$RATING = ($addrating == TRUE && $comrow['user_id'] ? $rater->composerating($thistable, $thisid, FALSE, $comrow['user_id']) : "");
     $comment_shortcodes = e107::getScBatch('comment');
     $text = $tp->parseTemplate($renderstyle, TRUE, $comment_shortcodes);
     //FIXME - dramatically increases the number of queries performed.
     if ($action == "comment" && vartrue($pref['nested_comments'])) {
         $type = $this->getCommentType($thistable);
         $sub_query = "\n\t\t\tSELECT c.*, u.*, ue.*, r.*\n\t\t\tFROM #comments AS c\n\t\t\tLEFT JOIN #user AS u ON c.comment_author_id = u.user_id\n\t\t\tLEFT JOIN #user_extended AS ue ON c.comment_author_id = ue.user_extended_id\n\t\t\tLEFT JOIN #rate AS r ON c.comment_id = r.rate_itemid AND r.rate_table = 'comments' \n\t\t\t\n\t\t\tWHERE comment_item_id='" . intval($thisid) . "' AND comment_type='" . $tp->toDB($type, true) . "' AND comment_pid='" . intval($comrow['comment_id']) . "'\n\t\t\t\n\t\t\t\n\t\t\tORDER BY comment_datestamp\n\t\t\t";
         $sql_nc = new db();
         /* a new db must be created here, for nested comment  */
         if ($sub_total = $sql_nc->db_Select_gen($sub_query)) {
             while ($row1 = $sql_nc->db_Fetch()) {
                 if ($this->isPending($row1)) {
                     $sub_total = $sub_total - 1;
                     continue;
                 }
                 if ($pref['nested_comments']) {
                     $width = min($width + 3, 80);
                 }
                 $text .= $this->render_comment($row1, $table, $action, $id, $width, $subject, $addrating);
                 unset($width);
             }
         }
         $this->totalComments = $this->totalComments + $sub_total;
     }
     // End (nested comment handling)
     return $text;
 }
Example #13
0
function editPost($xmlrpcmsg)
{
    $postid = $xmlrpcmsg->getParam(0)->scalarval();
    $username = $xmlrpcmsg->getParam(1)->scalarval();
    $password = $xmlrpcmsg->getParam(2)->scalarval();
    if (userLogin($username, $password, 'H') == true) {
        $content = $xmlrpcmsg->getParam(3);
        $title = $content->structMem('title')->scalarval();
        $description = '[html]' . $content->structMem('description')->scalarval() . '[/html]';
        //22/10/2009 14.48.04 added mt_text_more ie news_extended
        //check if we have something...
        $tempTextMore = checkXmlElementS($content->serialize(), 'mt_text_more');
        if ($tempTextMore == 1) {
            $mt_text_more = '[html]' . $content->structMem('mt_text_more')->scalarval() . '[/html]';
        }
        //if date is null will be replaced with current datetime (wordpress like)
        //check with simplexml for the parameter dateCreated? XMLRPC-PHP seems to not have such functions??
        $tempDate = checkXmlElementS($content->serialize(), 'dateCreated');
        if ($tempDate == 1) {
            $dateCreated = $content->structMem('dateCreated')->serialize();
            // Not all clients send dateCreated info. So add if statement here if you want to use it.
            $timestamp = iso8601_decode($dateCreated);
            // To convert to unix timestamp
        } else {
            $timestamp = time();
        }
        //22/10/2009 11.51.54 added $mt_excerpt
        //add the news summary
        //check if we have something...
        $tempExcerpt = checkXmlElementS($content->serialize(), 'mt_excerpt');
        if ($tempExcerpt == 1) {
            $mt_excerpt = $content->structMem('mt_excerpt')->scalarval();
        }
        //22/10/2009 11.51.54 added $mt_allow_comments
        //add the news_allow_comments flag
        //check if we have something...
        $tempAllowComments = checkXmlElementS($content->serialize(), 'mt_allow_comments');
        if ($tempAllowComments == 1) {
            $mt_allow_comments = $content->structMem('mt_allow_comments')->scalarval();
        }
        //26/10/2009 14.30.41 added mt_keywords ie tags
        //check if we have something...
        $tempKeywords = checkXmlElementS($content->serialize(), 'mt_keywords');
        if ($tempKeywords == 1) {
            $mt_keywords = $content->structMem('mt_keywords')->scalarval();
        }
        //author from e107
        $query = 'SELECT u.user_id FROM `#user` AS u WHERE u.user_loginname = \'' . $username . '\' AND u.user_password = \'' . md5($password) . '\'';
        $sql = new db();
        $sql->db_Select_gen($query);
        $row = $sql->db_Fetch();
        $author = $row['user_id'];
        if ($content->structMem('categories')->arraySize() > 0) {
            $categories = $content->structMem('categories')->arrayMem(0)->scalarval();
            //try to read out the id of the category
            if ($categories != '') {
                $query = 'SELECT c.category_id FROM `#news_category` AS c WHERE c.category_name = \'' . $categories . '\'';
                $sql->db_Select_gen($query);
                $row = $sql->db_Fetch();
                $categories = $row['category_id'];
            }
        }
        $published = $xmlrpcmsg->getParam(4)->scalarval();
        // TODO use:
        // $ix = new news;
        // $ret = $ix->submit_item($arrayvalues);
        //edit data with new fuctions
        $data = array();
        //to update we need to set news id...
        $data['data']['news_id'] = $postid;
        $data['_FIELD_TYPES']['news_id'] = 'int';
        $data['data']['news_title'] = $title;
        $data['_FIELD_TYPES']['news_title'] = 'todb';
        $data['data']['news_body'] = $description;
        $data['_FIELD_TYPES']['news_body'] = 'todb';
        $data['data']['news_extended'] = $mt_text_more;
        $data['_FIELD_TYPES']['news_extended'] = 'todb';
        $data['data']['news_datestamp'] = $timestamp;
        $data['_FIELD_TYPES']['news_datestamp'] = 'int';
        $data['data']['news_author'] = $author;
        $data['_FIELD_TYPES']['news_author'] = 'int';
        $data['data']['news_category'] = $categories;
        //category id is taken by a query against news categories
        $data['_FIELD_TYPES']['news_category'] = 'int';
        $data['data']['news_allow_comments'] = $mt_allow_comments;
        $data['_FIELD_TYPES']['news_allow_comments'] = 'int';
        $data['data']['news_start'] = '';
        //NOT AVAIBLE MAKE A CUSTOM FIELD?
        $data['_FIELD_TYPES']['news_start'] = 'int';
        $data['data']['news_end'] = '';
        //NOT AVAIBLE MAKE A CUSTOM FIELD?
        $data['_FIELD_TYPES']['news_end'] = 'int';
        //$data['data']['news_class'] = $news['news_class'];
        //$data['_FIELD_TYPES']['news_class'] = 'todb';
        $data['data']['news_render_type'] = eXMLRPC_NEWS_RENDER_TYPE_LOC;
        //from preferences
        $data['_FIELD_TYPES']['news_render_type'] = 'int';
        //news_comment_total
        $data['data']['news_summary'] = $mt_excerpt;
        //NOT AVAIBLE MAKE A CUSTOM FIELD?
        $data['_FIELD_TYPES']['news_summary'] = 'todb';
        $data['data']['news_thumbnail'] = '';
        //NOT APPLICABLE?
        $data['_FIELD_TYPES']['news_thumbnail'] = 'todb';
        $data['data']['news_sticky'] = '';
        //NOT AVAIBLE MAKE A CUSTOM FIELD?
        $data['_FIELD_TYPES']['news_sticky'] = 'int';
        $data['data']['news_meta_keywords'] = $mt_keywords;
        $data['_FIELD_TYPES']['news_meta_keywords'] = 'todb';
        $data['data']['news_meta_description'] = '';
        //NOT AVAIBLE MAKE A CUSTOM FIELD?
        $data['_FIELD_TYPES']['news_meta_description'] = 'todb';
        $postid = $sql->db_Update('news', $data);
        return new xmlrpcresp(new xmlrpcval(true, 'boolean'));
    } else {
        return new xmlrpcresp(0, $xmlrpcerruser + 1, 'Login Failed');
    }
}
Example #14
0
    function CreateParentMenu($parentid)
    {
        global $plugintable, $plugindir, $tp, $datequery;
        if (!is_object($sqlcreatemenu)) {
            $sqlcreatemenu = new db();
        }
        if (!$sqlcreatemenu->db_Select($plugintable, "*", "content_id='" . intval($parentid) . "'  ")) {
            return FALSE;
        } else {
            $row = $sqlcreatemenu->db_Fetch();
        }
        $content_path_menu = $plugindir . "menus/";
        if (!is_writable($content_path_menu)) {
            echo "<b>" . CONTENT_ADMIN_ITEM_LAN_22 . " " . $content_path_menu . " " . CONTENT_ADMIN_ITEM_LAN_23 . "</b><br />";
            return FALSE;
        }
        $menufile = "content_" . $row['content_heading'];
        $menuname = $row['content_heading'];
        $data = chr(60) . "?php\n" . chr(47) . "*\n+---------------------------------------------------------------+\n|        e107 website system\n|        " . e_PLUGIN . "content/menus/" . $menufile . "_menu.php\n|\n|        (C)Steve Dunstan 2001-2002\n|        http://e107.org\n|        jalist@e107.org\n|\n|        Released under the terms and conditions of the\n|        GNU General Public License (http://gnu.org).\n+---------------------------------------------------------------+\n\nThis file has been generated by " . e_PLUGIN . "content/handlers/content_class.php.\n\n*" . chr(47) . "\n\n";
        $data .= "\n";
        $data .= "unset(\$text);\n";
        $data .= "\$text = \"\";\n";
        $data .= "\$menutypeid\t\t= \"{$parentid}\";\n";
        $data .= "\$menuname\t\t= \"{$menuname}\";\n";
        $data .= "\n";
        $data .= "\$plugindir\t\t= e_PLUGIN.'content/';\n";
        $data .= "\$plugintable\t= \"pcontent\";\t\t//name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)\n";
        $data .= "\$datequery\t\t= \" AND content_datestamp < \".time().\" AND (content_enddate=0 || content_enddate>\".time().\") \";\n";
        $data .= "\n";
        $data .= "require_once(e_PLUGIN.'content/handlers/content_class.php');\n";
        $data .= "\$aa = new content;\n";
        $data .= "require_once(e_HANDLER.'form_handler.php');\n";
        $data .= "\$rs = new form;\n";
        $data .= "\$gen = new convert;\n";
        $data .= "global \$tp;\n";
        $data .= "\n";
        $data .= "include_lan(e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php');\n";
        $data .= '
					$bullet = \'\';
					if(defined(\'BULLET\'))
					{
						$bullet = \'<img src="\'.THEME.\'images/\'.BULLET.\'" alt="" style="vertical-align: middle;" />\';
					}
					elseif(file_exists(THEME.\'images/bullet2.gif\'))
					{
						$bullet = \'<img src="\'.THEME.\'images/bullet2.gif" alt="" style="vertical-align: middle;" />\';
					}
			';
        $data .= "\$content_pref\t\t\t\t\t= \$aa -> getContentPref(\$menutypeid);\n";
        $data .= "\$content_icon_path\t\t\t\t= \$tp -> replaceConstants(\$content_pref[\"content_icon_path\"]);\n";
        $data .= "\$content_cat_icon_path_small\t= \$tp -> replaceConstants(\$content_pref[\"content_cat_icon_path_small\"]);\n";
        $data .= "\n";
        $data .= "\t\$break = FALSE;\n";
        $data .= "//##### SEARCH SELECT ORDER --------------------------------------------------\n";
        $data .= "//show search box\n";
        $data .= "if(\$content_pref[\"content_menu_search\"]){\n";
        $data .= "\t\$text .= \$aa -> showOptionsSearch(\"menu\", \$menutypeid);\n";
        $data .= "\t\$break = TRUE;\n";
        $data .= "}\n";
        $data .= "//show select box (with either links to other content pages, to categories, to both, or don't show at all)\n";
        $data .= "if( (\$content_pref[\"content_menu_links\"] && \$content_pref[\"content_menu_links_dropdown\"]) || (\$content_pref[\"content_menu_cat\"] && \$content_pref[\"content_menu_cat_dropdown\"]) ){\n";
        $data .= "\t\$text .= \$aa -> showOptionsSelect(\"menu\", \$menutypeid);\n";
        $data .= "\t\$break = TRUE;\n";
        $data .= "}\n";
        $data .= "//show order box\n";
        $data .= "if(\$content_pref[\"content_menu_sort\"]){\n";
        $data .= "\t\$text .= \$aa -> showOptionsOrder(\"menu\", \$menutypeid);\n";
        $data .= "\t\$break = TRUE;\n";
        $data .= "}\n";
        $data .= "\n";
        $data .= "//show links list if chosen so\n";
        $data .= "if(\$content_pref[\"content_menu_links\"] && !\$content_pref[\"content_menu_links_dropdown\"]){\n";
        $data .= "\tif(\$break === TRUE){\n";
        $data .= "\t   \$text .= \"<br />\";\n";
        $data .= "\t}\n";
        $data .= "\t\$text .= (\$content_pref[\"content_menu_links_caption\"] != \"\" ? \$content_pref[\"content_menu_links_caption\"] : CONTENT_MENU_LAN_4).\"<br />\";\n";
        $data .= "\n";
        $data .= "\t//define icon\n";
        $data .= "\tif(\$content_pref[\"content_menu_links_icon\"] == \"0\"){ \$linksicon = \"\";\n";
        $data .= "\t}elseif(\$content_pref[\"content_menu_links_icon\"] == \"1\"){ \$linksicon = \$bullet;\n";
        $data .= "\t}elseif(\$content_pref[\"content_menu_links_icon\"] == \"2\"){ \$linksicon = \"&middot\";\n";
        $data .= "\t}elseif(\$content_pref[\"content_menu_links_icon\"] == \"3\"){ \$linksicon = \"&ordm;\";\n";
        $data .= "\t}elseif(\$content_pref[\"content_menu_links_icon\"] == \"4\"){ \$linksicon = \"&raquo;\";\n";
        $data .= "\t}\n";
        $data .= "\n";
        $data .= "\$urlrow[\"url_content_id\"]\t\t= \$menutypeid;\n";
        $data .= "\tif(\$content_pref[\"content_menu_viewallcat\"]){\n";
        $data .= "\t\t\$text .= \$linksicon.\" <a href='\".e107::url(\"content\", \"catlist\", \$urlrow, \"full\").\"'>\".CONTENT_LAN_6.\"</a><br />\";\n";
        $data .= "\t}\n";
        $data .= "\tif(\$content_pref[\"content_menu_viewallauthor\"]){\n";
        $data .= "\t\t\$text .= \$linksicon.\" <a href='\".e107::url(\"content\", \"authors\", \$urlrow, \"full\").\"'>\".CONTENT_LAN_7.\"</a><br />\";\n";
        $data .= "\t}\n";
        $data .= "\tif(\$content_pref[\"content_menu_viewallitems\"]){\n";
        $data .= "\t\t\$text .= \$linksicon.\" <a href='\".e107::url(\"content\", \"archive\", \$urlrow, \"full\").\"'>\".CONTENT_LAN_83.\"</a><br />\";\n";
        $data .= "\t}\n";
        $data .= "\tif(\$content_pref[\"content_menu_viewtoprated\"]){\n";
        $data .= "\t\t\$text .= \$linksicon.\" <a href='\".e107::url(\"content\", \"toprated\", \$urlrow, \"full\").\"'>\".CONTENT_LAN_8.\"</a><br />\";\n";
        $data .= "\t}\n";
        $data .= "\tif(\$content_pref[\"content_menu_viewtopscore\"]){\n";
        $data .= "\t\t\$text .= \$linksicon.\" <a href='\".e107::url(\"content\", \"topscore\", \$urlrow, \"full\").\"'>\".CONTENT_LAN_12.\"</a><br />\";\n";
        $data .= "\t}\n";
        $data .= "\tif(\$content_pref[\"content_menu_viewrecent\"]){\n";
        $data .= "\t\t\$text .= \$linksicon.\" <a href='\".e107::url(\"content\", \"recent\", \$urlrow, \"full\").\"'>\".CONTENT_LAN_61.\"</a><br />\";\n";
        $data .= "\t}\n";
        $data .= "\tif( \$content_pref[\"content_menu_viewsubmit\"] && \$content_pref[\"content_submit\"] && check_class(\$content_pref[\"content_submit_class\"]) ){\n";
        $data .= "\t\t\$text .= \$linksicon.\" <a href='\".\$plugindir.\"content_submit.php'>\".CONTENT_LAN_75.\"</a><br />\";\n";
        $data .= "\t}\n";
        $data .= "\t\$text .= \"<br />\";\n";
        $data .= "}\n";
        $data .= "\n";
        $data .= "//get category array\n";
        $data .= "\$array = \$aa -> getCategoryTree(\"\", intval(\$menutypeid), TRUE);\n";
        $data .= "\n";
        $data .= "//##### CATEGORY LIST --------------------------------------------------\n";
        $data .= "if(!\$content_pref[\"content_menu_cat_dropdown\"]){\n";
        $data .= "\tif(\$content_pref[\"content_menu_cat\"]){\n";
        $data .= "\t\t\$text .= (\$content_pref[\"content_menu_cat_caption\"] != \"\" ? \$content_pref[\"content_menu_cat_caption\"] : CONTENT_MENU_LAN_3).\"<br />\";\n";
        $data .= "\n";
        $data .= "\t\t\$newparent = \"\";\n";
        $data .= "\t\t\$checkid = \"\";\n";
        $data .= "\t\t\$newarray = array_merge_recursive(\$array);\n";
        $data .= "\t\tfor(\$a=0;\$a<count(\$newarray);\$a++){\n";
        $data .= "\t\t\tfor(\$b=0;\$b<count(\$newarray[\$a]);\$b++){\n";
        $data .= "\t\t\t\t\$newparent[\$newarray[\$a][\$b]] = \$newarray[\$a][\$b+1];\n";
        $data .= "\t\t\t\tif( (\$content_pref[\"content_menu_cat_main\"] && \$newarray[\$a][\$b] == \$menutypeid) || \$newarray[\$a][\$b] != \$menutypeid ){\n";
        $data .= "\t\t\t\t\t\$checkid .= \" content_id = '\".\$newarray[\$a][\$b].\"' OR \";\n";
        $data .= "\t\t\t\t}\n";
        $data .= "\t\t\t\t\$b++;\n";
        $data .= "\t\t\t}\n";
        $data .= "\t\t}\n";
        $data .= "\t\t\$checkid = substr(\$checkid,0,-3);\n";
        $data .= "\t\tif(!is_object(\$sql)){ \$sql = new db; }\n";
        $data .= "\t\tif(\$sql -> db_Select(\$plugintable, \"*\", \" \".\$checkid.\" ORDER BY SUBSTRING_INDEX(content_order, '.', 1)+0 \")){\n";
        $data .= "\t\t\twhile(\$row = \$sql -> db_Fetch()){\n";
        $data .= "\n";
        $data .= "\t\t\t\t//define icon\n";
        $data .= "\t\t\t\t\$ICON = \"\";\n";
        $data .= "\t\t\t\tif(\$content_pref[\"content_menu_cat_icon\"] == \"0\"){ \$ICON = \"\";\n";
        $data .= "\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"1\"){ \$ICON = \$bullet;\n";
        $data .= "\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"2\"){ \$ICON = \"&middot\";\n";
        $data .= "\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"3\"){ \$ICON = \"&ordm;\";\n";
        $data .= "\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"4\"){ \$ICON = \"&raquo;\";\n";
        $data .= "\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"5\"){\n";
        $data .= "\t\t\t\t\tif(\$row['content_icon'] != \"\" && file_exists(\$content_cat_icon_path_small.\$row['content_icon']) ){\n";
        $data .= "\t\t\t\t\t\t\$ICON = \"<img src='\".\$content_cat_icon_path_small.\$row['content_icon'].\"' alt='' style='border:0;' />\";\n";
        $data .= "\t\t\t\t\t}else{\n";
        $data .= "\t\t\t\t\t\t//default category icon\n";
        $data .= "\t\t\t\t\t\tif(\$content_pref[\"content_menu_cat_icon_default\"] == \"0\"){ \$ICON = \"\";\n";
        $data .= "\t\t\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"1\"){ \$ICON = \$bullet;\n";
        $data .= "\t\t\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"2\"){ \$ICON = \"&middot\";\n";
        $data .= "\t\t\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"3\"){ \$ICON = \"&ordm;\";\n";
        $data .= "\t\t\t\t\t\t}elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"4\"){ \$ICON = \"&raquo;\";\n";
        $data .= "\t\t\t\t\t\t}\n";
        $data .= "\t\t\t\t\t}\n";
        $data .= "\t\t\t\t}\n";
        $data .= "\t\t\t\t//display category list\n";
        $data .= "\t\t\t\t\$text .= \"<table style='width:100%; text-align:left; border:0;' cellpadding='0' cellspacing='0'>\";\n";
        $data .= "\t\t\t\t\$text .= \"<tr>\";\n";
        $data .= "\t\t\t\t\$text .= (\$ICON ? \"<td style='width:1%; white-space:nowrap; text-align:left; padding-right:5px;'><a href='\".e_PLUGIN.\"content/content.php?cat.\".\$row['content_id'].\"'>\".\$ICON.\"</a></td>\" : \"\");\n";
        $data .= "\t\t\t\t\$text .= \"<td colspan='2'>\";\n";
        $data .= "\t\t\t\t\$text .= \"<a href='\".e_PLUGIN.\"content/content.php?cat.\".\$row['content_id'].\"'>\".\$row['content_heading'].\"</a>\";\n";
        $data .= "\t\t\t\t\$text .= (\$content_pref[\"content_menu_cat_number\"] ? \" <span class='smalltext'>(\".\$aa -> countCatItems(\$row['content_id']).\")</span>\" : \"\");\n";
        $data .= "\t\t\t\t\$text .= \"</td>\";\n";
        $data .= "\t\t\t\t\$text .= \"</tr>\";\n";
        $data .= "\t\t\t\t\$text .= \"</table>\";\n";
        $data .= "\t\t\t}\n";
        $data .= "\t\t}\n";
        $data .= "\t}\n";
        $data .= "}\n";
        $data .= "\n";
        $data .= "//##### RECENT --------------------------------------------------\n";
        $data .= "if(\$content_pref[\"content_menu_recent\"]){\n";
        $data .= "\t\$text .= \"<br />\";\n";
        $data .= "\n";
        $data .= "\t//prepare query paramaters\n";
        $data .= "\t\$validparent = implode(\",\", array_keys(\$array));\n";
        $data .= "\t\$qry = \" content_parent REGEXP '\".\$aa -> CONTENTREGEXP(\$validparent).\"' \";\n";
        $data .= "\n";
        $data .= "\t\$sql1 = new db;\n";
        $data .= "\t\$contenttotal = \$sql1 -> db_Count(\$plugintable, \"(*)\", \"WHERE content_refer != 'sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' \" );\n";
        $data .= "\n";
        $data .= "\tif(\$resultitem = \$sql1 -> db_Select(\$plugintable, \"*\", \"content_refer !='sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' ORDER BY content_datestamp DESC LIMIT 0,\".\$content_pref[\"content_menu_recent_number\"] )){\n";
        $data .= "\n";
        $data .= "\t\t\$text .= (\$content_pref[\"content_menu_recent_caption\"] != \"\" ? \$content_pref[\"content_menu_recent_caption\"] : CONTENT_MENU_LAN_2).\"<br />\";\n";
        $data .= "\t\twhile(\$row = \$sql1 -> db_Fetch()){\n";
        $data .= "\n";
        $data .= "\t\t\t\$ICON = \"\";\n";
        $data .= "\t\t\t\$DATE = \"\";\n";
        $data .= "\t\t\t\$AUTHOR = \"\";\n";
        $data .= "\t\t\t\$SUBHEADING = \"\";\n";
        $data .= "\n";
        $data .= "\t\t\tif(\$content_pref[\"content_menu_recent_date\"]){\n";
        $data .= "\t\t\t\t\$datestyle = (\$content_pref[\"content_archive_datestyle\"] ? \$content_pref[\"content_archive_datestyle\"] : \"%d %b %Y\");\n";
        $data .= "\t\t\t\t\$DATE = strftime(\$datestyle, \$row['content_datestamp']);\n";
        $data .= "\t\t\t}\n";
        $data .= "\t\t\tif(\$content_pref[\"content_menu_recent_author\"]){\n";
        $data .= "\t\t\t\t\$authordetails = \$aa -> getAuthor(\$row['content_author']);\n";
        $data .= "\t\t\t\t\$AUTHOR = \$authordetails[1];\n";
        $data .= "\t\t\t}\n";
        $data .= "\n";
        $data .= "\t\t\t//subheading\n";
        $data .= "\t\t\tif(\$content_pref[\"content_menu_recent_subheading\"] && \$row['content_subheading']){\n";
        $data .= "\t\t\t\tif(\$content_pref[\"content_menu_recent_subheading_char\"] && \$content_pref[\"content_menu_recent_subheading_char\"] != \"\" && \$content_pref[\"content_menu_recent_subheading_char\"] != \"0\"){\n";
        $data .= "\t\t\t\t\tif(strlen(\$row['content_subheading']) > \$content_pref[\"content_menu_recent_subheading_char\"]) {\n";
        $data .= "\t\t\t\t\t\t\$row['content_subheading'] = substr(\$row['content_subheading'], 0, \$content_pref[\"content_menu_recent_subheading_char\"]).\$content_pref[\"content_menu_recent_subheading_post\"];\n";
        $data .= "\t\t\t\t\t}\n";
        $data .= "\t\t\t\t}\n";
        $data .= "\t\t\t\t\$SUBHEADING = \$row['content_subheading'];\n";
        $data .= "\t\t\t}\n";
        $data .= "\n";
        $data .= "\t\t\t//define icon\n";
        $data .= "\t\t\t\$recenticonwidth = \"\";\n";
        $data .= "\t\t\tif(\$content_pref[\"content_menu_recent_icon\"] == \"0\"){ \$ICON = \"\";\n";
        $data .= "\t\t\t}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"1\"){ \$ICON = \$bullet;\n";
        $data .= "\t\t\t}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"2\"){ \$ICON = \"&middot\";\n";
        $data .= "\t\t\t}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"3\"){ \$ICON = \"&ordm;\";\n";
        $data .= "\t\t\t}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"4\"){ \$ICON = \"&raquo;\";\n";
        $data .= "\t\t\t}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"5\"){\n";
        $data .= "\t\t\t\tif(\$content_pref[\"content_menu_recent_icon\"] == \"5\"){\n";
        $data .= "\t\t\t\t\tif(\$content_pref[\"content_menu_recent_icon_width\"]){\n";
        $data .= "\t\t\t\t\t\t\$recenticonwidth = \" width:\".\$content_pref[\"content_menu_recent_icon_width\"].\"px; \";\n";
        $data .= "\t\t\t\t\t}else{\n";
        $data .= "\t\t\t\t\t\t\$recenticonwidth = \" width:50px; \";\n";
        $data .= "\t\t\t\t\t}\n";
        $data .= "\t\t\t\t}\n";
        $data .= "\t\t\t\tif(\$content_pref[\"content_menu_recent_icon\"] == \"5\" && \$row['content_icon'] != \"\" && file_exists(\$content_icon_path.\$row['content_icon'])){\n";
        $data .= "\t\t\t\t\t\$ICON = \"<img src='\".\$content_icon_path.\$row['content_icon'].\"' alt='' style='\".\$recenticonwidth.\" border:0;' />\";\n";
        $data .= "\t\t\t\t}\n";
        $data .= "\t\t\t}\n";
        $data .= "\n";
        $data .= "\t\t\t//display recent list\n";
        $data .= "\t\t\t\$text .= \"<table style='width:100%; text-align:left; border:0; margin-bottom:10px;' cellpadding='0' cellspacing='0'>\";\n";
        $data .= "\t\t\t\$text .= \"<tr>\";\n";
        $data .= "\t\t\t\$text .= (\$ICON ? \"<td style='width:1%; white-space:nowrap; vertical-align:top; padding-right:5px;'><a href='\".e_PLUGIN.\"content/content.php?content.\".\$row['content_id'].\"'>\".\$ICON.\"</a></td>\" : \"\");\n";
        $data .= "\t\t\t\$text .= \"<td style='width:99%; vertical-align:top;'>\";\n";
        $data .= "\t\t\t\$text .= \"<a href='\".e_PLUGIN.\"content/content.php?content.\".\$row['content_id'].\"'>\".\$row['content_heading'].\"</a><br />\";\n";
        $data .= "\t\t\t\$text .= (\$DATE ? \$DATE.\"<br />\" : \"\" );\n";
        $data .= "\t\t\t\$text .= (\$AUTHOR ? \$AUTHOR.\"<br />\" : \"\" );\n";
        $data .= "\t\t\t\$text .= (\$SUBHEADING ? \$SUBHEADING.\"<br />\" : \"\" );\n";
        $data .= "\t\t\t\$text .= \"</td>\";\n";
        $data .= "\t\t\t\$text .= \"</tr>\";\n";
        $data .= "\t\t\t\$text .= \"</table>\";\n";
        $data .= "\t\t}\n";
        $data .= "\t}\n";
        $data .= "}\n";
        $data .= "\n";
        $data .= "if(!isset(\$text)){ \$text = CONTENT_MENU_LAN_1; }\n";
        $data .= "\$caption = (\$content_pref[\"content_menu_caption\"] != \"\" ? \$content_pref[\"content_menu_caption\"] : CONTENT_MENU_LAN_0.\" \".\$menuname);\n";
        $data .= "\$ns -> tablerender(\$caption, \$text, '{$menufile}');\n";
        $data .= "\n";
        $data .= "?" . chr(62);
        if (file_exists($plugindir . "menus/" . $menufile . "_menu.php")) {
            $message = "";
        } else {
            $fp = @fopen($plugindir . "menus/" . $menufile . "_menu.php", "w");
            if (!@fwrite($fp, $data)) {
                $message = CONTENT_ADMIN_CAT_LAN_51;
            } else {
                fclose($fp);
                $message = CONTENT_ADMIN_CAT_LAN_50;
            }
        }
        return $message;
    }
Example #15
0
             $rss[$i]['link'] = $e107->base_path . $PLUGINS_DIRECTORY . "forum/forum_viewtopic.php?" . $value['thread_id'];
         }
         $rss[$i]['description'] = $value['thread_thread'];
         $rss[$i]['datestamp'] = $value['thread_datestamp'];
         $i++;
     }
     break;
 case topic:
 case 8:
     if (!$this->topicid) {
         return FALSE;
     }
     /* get thread ...  */
     $this->rssQuery = "SELECT t.thread_name, t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, f.forum_id, f.forum_name, f.forum_class, u.user_name\n\t\tFROM #forum_t AS t\n\t\tLEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id\n\t\tLEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id\n\t\tWHERE f.forum_class  IN (" . USERCLASS_LIST . ") AND t.thread_id=" . intval($this->topicid);
     $sqlrss->db_Select_gen($this->rssQuery);
     $topic = $sqlrss->db_Fetch();
     /* get replies ...  */
     $this->rssQuery = "SELECT t.thread_name, t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, f.forum_id, f.forum_name, f.forum_class, u.user_name, u.user_email\n\t\tFROM #forum_t AS t\n\t\tLEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id\n\t\tLEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id\n\t\tWHERE f.forum_class  IN (" . USERCLASS_LIST . ") AND t.thread_parent=" . intval($this->topicid);
     $sqlrss->db_Select_gen($this->rssQuery);
     $replies = $sqlrss->db_getList();
     $rss = array();
     $i = 0;
     if ($value['user_name']) {
         $rss[$i]['author'] = $value['user_name'] . " ( " . $e107->base_path . "user.php?id." . intval($value['thread_user']) . " )";
     } else {
         $tmp = explode(".", $value['thread_user'], 2);
         list($rss[$i]['author'], $ip) = explode(chr(1), $tmp[1]);
     }
     $rss[$i]['title'] = $topic['thread_name'];
     $rss[$i]['link'] = $e107->base_path . $PLUGINS_DIRECTORY . "forum/forum_viewtopic.php?" . $topic['thread_id'];
     $rss[$i]['description'] = $topic['thread_thread'];
Example #16
0
 function view_subscribers($p_id)
 {
     $ns = e107::getRender();
     $mes = e107::getMessage();
     $frm = e107::getForm();
     $nl_sql = new db();
     $_nl_sanatized = '';
     if (!$nl_sql->db_Select('newsletter', '*', 'newsletter_id=' . $p_id)) {
         $mes->addError(NLLAN_56);
         $vs_text .= "<div class='buttons-bar center'>\n\t\t\t\t\t\t\t<input class='btn btn-default button' type=button value='" . LAN_BACK . "' onClick=\"window.location='" . e_SELF . "'\">\n\t\t\t\t\t\t</div>";
         $ns->tablerender(NLLAN_65 . ' ' . $p_id, $mes->render() . $vs_text);
         return;
     } else {
         $vs_text .= "\n\t\t\t<form action='" . e_SELF . "' id='newsletterform' method='post'>\n\t\t\t<table class='table adminlist'>\n\t\t\t<colgroup>\n\t\t\t\t<col style='width: 5%;  text-align: center;' />\n\t\t\t\t<col style='width: 35%;' />\n\t\t\t\t<col style='width: 45%;' />\n\t\t\t\t<col style='width: 15%; text-align: center;' />\n\t\t\t</colgroup>\n\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . LAN_ID . "</td>\n\t\t\t\t\t<td>" . LAN_NAME . "</td>\n\t\t\t\t\t<td>" . LAN_EMAIL . "</td>\n\t\t\t\t\t<td>" . LAN_OPTIONS . "</td>\n\t\t\t\t</tr>";
         if ($nl_row = $nl_sql->db_Fetch()) {
             $subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers']));
             sort($subscriber_list);
             $subscribers_total_count = count($subscribers_list) - 1;
             // Get a null entry as well
         }
         if ($subscribers_total_count < 1) {
             header("location:" . e_SELF);
             exit;
         }
         // Loop through each user in the array subscribers_list & sanatize
         $_last_subscriber = '';
         foreach ($subscribers_list as $val) {
             $val = trim($val);
             if ($val) {
                 if ($val != $_last_subscriber) {
                     $nl_sql->db_Select("user", "*", "user_id=" . $val);
                     if ($nl_row = $nl_sql->db_Fetch()) {
                         $vs_text .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . $val . "</td>\n\t\t\t\t\t\t\t\t<td><a href='" . e_BASE . "user.php?id.{$val}'>" . $nl_row['user_name'] . "</a></td>\n\t\t\t\t\t\t\t\t<td>" . $nl_row['user_email'] . "</td>\n\t\t\t\t\t\t\t\t<td><a href='" . e_SELF . "?remove.{$p_id}.{$val}'>" . ADMIN_DELETE_ICON . "</a>" . ($nl_row['user_ban'] > 0 ? NLLAN_62 : "") . "</td>\n\t\t\t\t\t\t\t</tr>";
                         $_last_subscriber = $val;
                     }
                 } else {
                     // Duplicate user id found in the subscribers_list array!
                     newsletter::remove_subscribers($p_id, $val);
                     // removes all entries for this user id
                     $newsletterArray[$p_id]['newsletter_subscribers'] = chr(1) . $val;
                     // keep this single value in the list
                     $nl_sql->db_Update("newsletter", "newsletter_subscribers='" . $newsletterArray[$p_id]['newsletter_subscribers'] . "' WHERE newsletter_id='" . intval($p_id) . "'");
                     $subscribers_total_count--;
                     $_nl_sanatized = 1;
                 }
             }
         }
     }
     $vs_text .= "\n\t\t<tr>\n\t\t\t<td colspan='4'>" . NLLAN_63 . ": " . $subscribers_total_count . "</td>\n\t\t</tr>\n\t\t </table>\n\t\t\t <div class='buttons-bar center'>\n\t\t\t \t" . $frm->admin_button('submit', LAN_BACK, 'submit') . "\n\t\t\t </div>\t\t\t\n\t\t </form>\n\t\t  ";
     if ($_nl_sanatized == 1) {
         $mes->addInfo(NLLAN_66);
     }
     $ns->tablerender(NLLAN_65 . ' ' . $p_id, $mes->render() . $vs_text);
 }
Example #17
0
 function flood($table, $orderfield)
 {
     /*
     # Test for possible flood
     #
     # - parameter #1                string $table, table being affected
     # - parameter #2                string $orderfield, date entry in respective table
     # - return                                boolean
     # - scope                                        public
     */
     $sql = new db();
     if (FLOODPROTECT == true) {
         $sql->db_Select($table, '*', 'ORDER BY ' . $orderfield . ' DESC LIMIT 1', 'no_where');
         $row = $sql->db_Fetch();
         return $row[$orderfield] > time() - FLOODTIMEOUT ? false : true;
     } else {
         return TRUE;
     }
 }
Example #18
0
 //check so only the preferences from the correct content_type (article, content, review etc) are used and rendered
 if (substr($contentmode, 8) == $rowm['content_id']) {
     if ($mode == "new_page" || $mode == "new_menu") {
         $lvisit = $this->getlvisit();
         $qry = $qry . " AND content_datestamp>" . $lvisit;
     } else {
         $qry = $qry . " " . $datequery;
     }
     $qry .= " ORDER BY content_datestamp DESC LIMIT 0," . intval($arr[7]);
     //get recent content for each main parent
     $sqli = new db();
     if (!($resultitem = $sqli->db_Select("pcontent", "*", $qry))) {
         $LIST_DATA = CONTENT_MENU_LAN_5 . " " . $rowm['content_heading'];
     } else {
         $LIST_DISPLAYSTYLE = $arr[2] ? "" : "none";
         while ($rowi = $sqli->db_Fetch()) {
             $rowheading = $this->parse_heading($rowi['content_heading'], $mode);
             $HEADING = "<a href='" . e_PLUGIN_ABS . "content/content.php?content." . $rowi['content_id'] . "' title='" . $rowi['content_heading'] . "'>" . $rowheading . "</a>";
             //category
             if ($arr[4]) {
                 $crumb = "";
                 if (array_key_exists($rowi['content_parent'], $array)) {
                     $newarr = $array[$rowi['content_parent']];
                     $newarr = array_reverse($newarr);
                     $CATEGORY = "<a href='" . e_PLUGIN_ABS . "content/content.php?cat." . $newarr[1] . "'>" . $newarr[0] . "</a>";
                 }
             }
             $DATE = $arr[5] ? $this->getListDate($rowi['content_datestamp'], $mode) : "";
             //$ICON = $this -> getBullet($arr[6], $mode);
             $image_link_append = "<a href='" . e_PLUGIN_ABS . "content/content.php?content." . $rowi['content_id'] . "'>";
             if ($rowi['content_icon'] && file_exists(e_PLUGIN . "content/images/icon/" . $rowi['content_icon'])) {
Example #19
0
|	For the e107 website system visit http://e107.org
|
|	Released under the terms and conditions of the
|	GNU General Public License (http://gnu.org).
+------------------------------------------------------------------------------+
*/
// class2.php is the heart of e107, always include it first to give access to e107 constants and variables
require_once '../../class2.php';
// Get language file (assume that the English language file is always present)
include_lan(e_PLUGIN . 'easyshop/languages/' . e_LANGUAGE . '.php');
// use HEADERF for USER PAGES and e_ADMIN."auth.php" for admin pages
require_once HEADERF;
require_once 'includes/config.php';
$sql = new db();
$sql->db_Select(DB_TABLE_SHOP_PREFERENCES);
while ($row = $sql->db_Fetch()) {
    $store_name = $row['store_name'];
    $store_address_1 = $row['store_address_1'];
    $store_address_2 = $row['store_address_2'];
    $store_city = $row['store_city'];
    $store_state = $row['store_state'];
    $store_zip = $row['store_zip'];
    $store_country = $row['store_country'];
    $support_email = $row['support_email'];
    $store_welcome_message = $row['store_welcome_message'];
    $store_info = $row['store_info'];
    $thank_you_page_title = $row['thank_you_page_title'];
    $thank_you_page_text = $row['thank_you_page_text'];
}
// Reset the shopping basket arrays when thank you page is called
unset($_SESSION['shopping_cart']);
Example #20
0
 function forumUpdateLastpost($type, $id, $updateThreads = false)
 {
     global $sql, $tp;
     $sql2 = new db();
     if ($type == 'thread') {
         $id = (int) $id;
         $lpInfo = $this->threadGetLastpost($id);
         $tmp = array();
         if ($lpInfo['user_name']) {
             $tmp['thread_lastuser'] = $lpInfo['post_user'];
             $tmp['thread_lastuser_anon'] = '_NULL_';
         } else {
             $tmp['thread_lastuser'] = 0;
             $tmp['thread_lastuser_anon'] = $lpInfo['post_user_anon'] ? $lpInfo['post_user_anon'] : 'Anonymous';
         }
         $tmp['thread_lastpost'] = $lpInfo['post_datestamp'];
         $info = array();
         $info['data'] = $tmp;
         //			$info['_FIELD_TYPES'] = $this->fieldTypes['forum_thread'];
         $info['WHERE'] = 'thread_id = ' . $id;
         $sql->db_Update('forum_thread', $info);
         return $lpInfo;
     }
     if ($type == 'forum') {
         if ($id == 'all') {
             if ($sql->db_Select('forum', 'forum_id', 'forum_parent != 0')) {
                 while ($row = $sql->db_Fetch(MYSQL_ASSOC)) {
                     $parentList[] = $row['forum_id'];
                 }
                 foreach ($parentList as $id) {
                     set_time_limit(60);
                     $this->forumUpdateLastpost('forum', $id, $updateThreads);
                 }
             }
         } else {
             $id = (int) $id;
             $lp_info = '';
             $lp_user = '******';
             if ($updateThreads == true) {
                 if ($sql2->db_Select('forum_t', 'thread_id', "thread_forum_id = {$id} AND thread_parent = 0")) {
                     while ($row = $sql2->db_Fetch(MYSQL_ASSOC)) {
                         set_time_limit(60);
                         $this->forumUpdateLastpost('thread', $row['thread_id']);
                     }
                 }
             }
             if ($sql->db_Select('forum_thread', 'thread_id, thread_lastuser, thread_lastuser_anon, thread_datestamp', 'thread_forum_id=' . $id . ' ORDER BY thread_datestamp DESC LIMIT 1')) {
                 $row = $sql->db_Fetch(MYSQL_ASSOC);
                 $lp_info = $row['thread_datestamp'] . '.' . $row['thread_id'];
                 $lp_user = $row['thread_lastuser'];
             }
             if ($row['thread_lastuser_anon']) {
                 $sql->db_Update('forum', "forum_lastpost_user = 0, forum_lastpost_anon = '{$row['thread_lastuser_anon']}', forum_lastpost_info = '{$lp_info}' WHERE forum_id=" . $id);
             } else {
                 $sql->db_Update('forum', "forum_lastpost_user = {$lp_user}, forum_lastpost_user_anon = NULL, forum_lastpost_info = '{$lp_info}' WHERE forum_id=" . $id);
             }
         }
     }
 }
Example #21
0
//the identifier for the rss feed url
$feed['topic_id'] = '';
//the topic_id, empty on default (to select a certain category)
$feed['path'] = 'featurebox';
//this is the plugin path location
$feed['text'] = 'this is the rss feed for the featurebox entries';
$feed['class'] = '0';
$feed['limit'] = '9';
$eplug_rss_feed[] = $feed;
//##### ------------------------------------------------------------------------------------
//##### create rss data, return as array $eplug_rss_data -----------------------------------
$rss = array();
$sqlrss = new db();
if ($items = $sqlrss->db_Select('featurebox', "*", "fb_class = 0 DESC LIMIT 0," . $this->limit)) {
    $i = 0;
    while ($rowrss = $sqlrss->db_Fetch()) {
        $rss[$i]['author'] = '';
        $rss[$i]['author_email'] = '';
        $rss[$i]['link'] = '';
        $rss[$i]['linkid'] = '';
        $rss[$i]['title'] = $rowrss['fb_title'];
        $rss[$i]['description'] = $rowrss['fb_text'];
        $rss[$i]['category_name'] = '';
        $rss[$i]['category_link'] = '';
        $rss[$i]['datestamp'] = '';
        $rss[$i]['enc_url'] = '';
        $rss[$i]['enc_leng'] = '';
        $rss[$i]['enc_type'] = '';
        $i++;
    }
}
Example #22
0
}
require_once HEADERF;
require_once e_PLUGIN . "e107dkp/includes/config.php";
global $pref;
$item = $_GET['i'];
$userID = USERID;
if (!$_GET['i']) {
    header("Location: /index.php");
}
if ($pref['wcm_version']) {
    require_once e_PLUGIN . "wcm/includes/config.php";
    $charID = WCMgetCharInfoByName($character, "char_id");
    if (WCMCheckChar($userID, $charID) || WCMCheckCharAdmin()) {
        $sql99 = new db();
        $sql99->db_Select(DKPDB_TABLE_ITEMS, "item_name", "item_id='" . $item . "'");
        while ($row99 = $sql99->db_Fetch()) {
            $item_name = $row99["item_name"];
        }
        if (empty($item_name)) {
            $text .= "No item data could be located with the name provided: {$item_name}<br>";
        } else {
            $text .= '
<table width="100%" border="0" cellspacing="1" cellpadding="2">
  <tr class="rowhead">
    <th align="center" colspan="4"><u>Purchase History for ' . $item_name . '</u></th>
  </tr>
  
  <tr>
    <th align="left" width="90" nowrap="nowrap">Date</th>
    <th align="left" width="35%">Buyer</th>
Example #23
0
 function convert_row($name, $query, $startorder)
 {
     global $sql, $tp, $plugintable;
     $plugintable = "pcontent";
     // ##### STAGE 8 : INSERT ROW -------------------------------------------------------------
     if (!is_object($sql)) {
         $sql = new db();
     }
     if (!($thiscount = $sql->db_Select("content", "*", " " . $query . " ORDER BY content_id "))) {
         $check_present = false;
     } else {
         $count = $startorder;
         $check_present = true;
         while ($row = $sql->db_Fetch()) {
             $oldcontentid = $row['content_id'];
             //select main parent id
             if (!is_object($sql2)) {
                 $sql2 = new db();
             }
             $sql2->db_Select($plugintable, "content_id", "content_heading = '" . $name . "' AND content_parent = '0' ");
             list($main_id) = $sql2->db_Fetch();
             //item is in main cat
             if ($row['content_parent'] == "0") {
                 $newcontent_parent = $main_id;
                 //item is in sub cat
             } else {
                 //select old review cat heading
                 if (!is_object($sql3)) {
                     $sql3 = new db();
                 }
                 if (!$sql3->db_Select("content", "content_id, content_heading", "content_id = '" . $row['content_parent'] . "' ")) {
                     $bug_oldcat[] = $row['content_id'] . " " . $row['content_heading'];
                     $newcontent_parent = $main_id;
                 } else {
                     list($old_cat_id, $old_cat_heading) = $sql3->db_Fetch();
                     //select new cat id from the cat with the old_cat_heading
                     if (!is_object($sql4)) {
                         $sql4 = new db();
                     }
                     if (!$sql4->db_Select($plugintable, "content_id", "content_heading = '" . $old_cat_heading . "' AND content_parent = '0." . $main_id . "' ")) {
                         $bug_newcat[] = $row['content_id'] . " " . $row['content_heading'];
                         $newcontent_parent = $main_id;
                     } else {
                         list($new_cat_id) = $sql4->db_Fetch();
                         $newcontent_parent = $new_cat_id;
                     }
                 }
             }
             if (strstr($row['content_content'], "{EMAILPRINT}")) {
                 $row['content_content'] = str_replace("{EMAILPRINT}", "", $row['content_content']);
             }
             $newcontent_heading = $tp->toDB($row['content_heading']);
             $newcontent_subheading = $row['content_subheading'] ? $tp->toDB($row['content_subheading']) : "";
             //summary can contain link to image in e107_images/link_icons/".$summary." THIS STILL NEEDS TO BE CHECKED
             $newcontent_summary = $row['content_summary'] ? $tp->toDB($row['content_summary']) : "";
             $newcontent_text = $tp->toDB($row['content_content']);
             //$newcontent_author	= (is_numeric($row['content_author']) ? $row['content_author'] : "0^".$row['content_author']);
             $newcontent_author = $row['content_author'];
             $newcontent_icon = "";
             $newcontent_attach = "";
             $newcontent_images = "";
             $newcontent_comment = $row['content_comment'];
             $newcontent_rate = "0";
             $newcontent_pe = $row['content_pe_icon'];
             $newcontent_refer = $row['content_type'] == "15" || $row['content_type'] == "16" ? "sa" : "";
             $newcontent_starttime = $row['content_datestamp'];
             $newcontent_endtime = "0";
             $newcontent_class = $row['content_class'];
             $newcontent_pref = "";
             $newcontent_score = $row['content_review_score'] && $row['content_review_score'] != "none" ? $row['content_review_score'] : "0";
             $newcontent_meta = "";
             $newcontent_layout = "";
             if (!is_object($sql5)) {
                 $sql5 = new db();
             }
             $sql5->db_Insert($plugintable, "'" . $row['content_id'] . "', '" . $newcontent_heading . "', '" . $newcontent_subheading . "', '" . $newcontent_summary . "', '" . $newcontent_text . "', '" . $newcontent_author . "', '" . $newcontent_icon . "', '" . $newcontent_attach . "', '" . $newcontent_images . "', '" . $newcontent_parent . "', '" . $newcontent_comment . "', '" . $newcontent_rate . "', '" . $newcontent_pe . "', '" . $newcontent_refer . "', '" . $newcontent_starttime . "', '" . $newcontent_endtime . "', '" . $newcontent_class . "', '" . $newcontent_pref . "', '1." . $count . "', '" . $newcontent_score . "', '" . $newcontent_meta . "', '" . $newcontent_layout . "' ");
             if (!is_object($sql6)) {
                 $sql6 = new db();
             }
             if (!$sql6->db_Select($plugintable, "content_id, content_heading", "content_heading = '" . $newcontent_heading . "' ")) {
                 $bug_insert[] = $row['content_id'] . " " . $row['content_heading'];
             } else {
                 $valid_insert[] = $row['content_id'] . " " . $row['content_heading'];
                 $count = $count + 1;
             }
         }
     }
     $convert_row = array($check_present, $count, $valid_insert, $bug_insert, $bug_oldcat, $bug_newcat);
     return $convert_row;
 }
}
global $tp;
// Get language file (assume that the English language file is always present)
include_lan(e_PLUGIN . 'easyshop/languages/' . e_LANGUAGE . '.php');
// include define tables info
require_once e_PLUGIN . "easyshop/includes/config.php";
// It's important to point to the correct plugin folder!
require_once 'easyshop_class.php';
// $session_id = Security::get_session_id(); // Get the session id by using Singleton pattern
// Randomly pick an active product from an active product category (only pick categories that user is entitled to see)
// with an active discount that the user is entitled to see
$today = time();
$sql = new db();
$arg = "SELECT *\n      FROM #easyshop_items\n      LEFT JOIN #easyshop_item_categories\n      ON #easyshop_items.category_id = #easyshop_item_categories.category_id\n      LEFT JOIN #easyshop_discount\n      ON #easyshop_items.prod_discount_id = #easyshop_discount.discount_id\n      WHERE category_active_status = '2' AND item_active_status = '2' AND (category_class IN (" . USERCLASS_LIST . ")) AND prod_discount_id > 0\n            AND discount_valid_from < '" . $today . "'\n            AND (discount_valid_till > '" . $today . "' OR discount_valid_till = '0')\n            AND (discount_class IN (" . USERCLASS_LIST . "))\n      ORDER BY RAND()";
$sql->db_Select_gen($arg, false);
if ($row = $sql->db_Fetch() and $row["item_id"] > 0) {
    $category_id = $row["category_id"];
    $item_id = $row["item_id"];
    $item_name = $row["item_name"];
    $item_description = strip_tags($tp->toHTML($row["item_description"], true));
    $item_image = $row["item_image"];
    $item_active_status = $row["item_active_status"];
    $item_price = $row["item_price"];
    $discount_id = $row["discount_id"];
    $discount_class = $row["discount_class"];
    $discount_valid_from = $row["discount_valid_from"];
    $discount_valid_till = $row["discount_valid_till"];
    $discount_code = $row["discount_code"];
    $discount_flag = $row["discount_flag"];
    $discount_percentage = $row["discount_percentage"];
    $discount_price = $row["discount_price"];
Example #25
0
$cur_month = date("n");
$cur_day = date("j");
if (strstr(e_QUERY, "year")) {
    $tmp = explode(".", e_QUERY);
    if (is_numeric($tmp[1])) {
        $req_year = intval($tmp[1]);
    }
}
if (!isset($req_year)) {
    $req_year = $cur_year;
}
// --------------------------------
// look for the first and last year
// --------------------------------
$bcSql->db_Select_gen("SELECT news_id, news_datestamp from #news ORDER BY news_datestamp LIMIT 0,1");
$first_post = $bcSql->db_Fetch();
$start_year = date("Y", $first_post['news_datestamp']);
$end_year = $cur_year;
// ----------------------
// build the yearselector
// ----------------------
$year_selector = "<div class='forumheader' style='text-align: center; margin-bottom: 2px;'>";
$year_selector .= "" . BLOGCAL_ARCHIV1 . ": <select name='activate' onchange='urljump(this.options[selectedIndex].value)' class='tbox'>\n";
for ($i = $start_year; $i <= $end_year; $i++) {
    $start = mktime(0, 0, 0, 1, 1, intval($req_year));
    $end = mktime(23, 59, 59, 12, 31, intval($req_year));
    // create the option entry
    $year_link = $prefix . "/archive.php?year." . $i;
    $year_selector .= "<option value='" . $year_link . "'";
    if ($i == $req_year) {
        $year_selector .= " selected='selected'";
Example #26
0
 function getPDFPrefs()
 {
     global $sql, $eArrayStorage;
     if (!is_object($eArrayStorage)) {
         e107_require_once(e_HANDLER . 'arraystorage_class.php');
         $eArrayStorage = new ArrayData();
     }
     if (!is_object($sql)) {
         $sql = new db();
     }
     $num_rows = $sql->db_Select('core', '*', "e107_name='pdf' ");
     if ($num_rows == 0) {
         $tmp = $this->getDefaultPDFPrefs();
         $tmp2 = $eArrayStorage->WriteArray($tmp);
         $sql->db_Insert('core', "'pdf', '" . $tmp2 . "' ");
         $sql->db_Select('core', '*', "e107_name='pdf' ");
     }
     $row = $sql->db_Fetch();
     $pdfPref = $eArrayStorage->ReadArray($row['e107_value']);
     return $pdfPref;
 }
Example #27
0
 function show_ipn_checkout($p_session_id)
 {
     // Parameter $p_session_id is used to check the users' current session ID to prevent XSS vulnarabilities
     //if ($p_session_id != session_id()) { // Get out of here: incoming session id is not equal than current session id
     //	header("Location: ".e_BASE); // Redirect to the home page
     //	exit();
     //}
     // Check query
     if (e_QUERY) {
         $tmp = explode(".", e_QUERY);
         $action = $tmp[0];
         unset($tmp);
     }
     $sql2 = new db();
     $sql2->db_Select(DB_TABLE_SHOP_PREFERENCES, "*", "store_id=1");
     while ($row2 = $sql2->db_Fetch()) {
         $sandbox = $row2['sandbox'];
         $paypal_email = $row2['paypal_email'];
         $payment_page_style = $row2['payment_page_style'];
         $paypal_currency_code = $row2['paypal_currency_code'];
         $set_currency_behind = $row2['set_currency_behind'];
         $minimum_amount = intval($row2['minimum_amount']);
         $always_show_checkout = $row2['always_show_checkout'];
         $email_order = $row2['email_order'];
     }
     $sql3 = new db();
     $sql3->db_Select(DB_TABLE_SHOP_CURRENCY, "*", "currency_active=2");
     while ($row3 = $sql3->db_Fetch()) {
         $unicode_character = $row3['unicode_character'];
         $paypal_currency_code = $row3['paypal_currency_code'];
     }
     // Determine currency before or after amount
     if ($set_currency_behind == 1) {
         // Print currency after amount
         $unicode_character_before = "";
         $unicode_character_after = "&nbsp;" . $unicode_character;
     } else {
         $unicode_character_before = "&nbsp;" . $unicode_character . "&nbsp;";
         $unicode_character_after = "";
         // Print currency before amount in all other cases
     }
     if ($sandbox == 2) {
         $paypalDomain = "https://www.sandbox.paypal.com";
     } else {
         $paypalDomain = "https://www.paypal.com";
     }
     // Display check out button
     // <form target='_blank' action='$paypalDomain/cgi-bin/webscr' method='post'> leads to XHTML incompatible caused by target
     $f_text .= "\r\n  \t<form action='{$paypalDomain}/cgi-bin/webscr' method='post'>\r\n\t\t<div>\r\n\t\t\t<input type='hidden' name='cmd' value='_xclick' />\r\n\t\t\t<input type='hidden' name='upload' value='1' />\r\n\t\t\t<input type='hidden' name='business' value='{$paypal_email}' />\r\n\t\t\t<input type='hidden' name='page_style' value='{$payment_page_style}' />";
     // Fill the Cart with products from the basket
     $count_items = count($_SESSION['shopping_cart']);
     // Count number of different products in basket
     $array = $_SESSION['shopping_cart'];
     // PayPal requires to pass multiple products in a sequence starting at 1
     $cart_count = 1;
     // Set thanks page to correct value
     $thanks_page = str_replace('easyshop.php', 'thank_you.php', e_SELF);
     $cancel_page = str_replace('easyshop.php', 'cancelled.php', e_SELF);
     $ipn_notify_page = str_replace('easyshop.php', 'ipn_notify.php', e_SELF);
     // For each product in the shopping cart array write PayPal details
     foreach ($array as $id => $item) {
         $f_text .= "\r\n\t\t\t<input type='hidden' name='item_name_" . $cart_count . "' value='" . $item['item_name'] . "' />\r\n\t\t\t<input type='hidden' name='item_number_" . $cart_count . "' value='" . $item['sku_number'] . "' />\r\n\t\t\t<input type='hidden' name='amount_" . $cart_count . "' value='" . $item['item_price'] . "' />\r\n\t\t\t<input type='hidden' name='quantity_" . $cart_count . "' value='" . $item['quantity'] . "' />\r\n\t\t\t<input type='hidden' name='shipping_" . $cart_count . "' value='" . $item['shipping'] . "' />\r\n\t\t\t<input type='hidden' name='shipping2_" . $cart_count . "' value='" . $item['shipping2'] . "' />\r\n\t\t\t<input type='hidden' name='handling_" . $cart_count . "' value='" . $item['handling'] . "' />\r\n\t\t\t<input type='hidden' name='db_id_" . $cart_count . "' value='" . $item['db_id'] . "' />";
         $cart_count++;
     }
     $f_text .= "\r\n        <input type='hidden' name='currency_code' value='{$paypal_currency_code}' />\r\n        <input type='hidden' name='no_note' value='1' />\r\n        <input type='hidden' name='lc' value='US' />\r\n        <input type='hidden' name='bn' value='PP-ShopCartBF' />\r\n        <input type='hidden' name='rm' value='1' />\r\n        <input type='hidden' name='notify_url' value='{$ipn_notify_page}' />\r\n        <input type='hidden' name='return' value='" . $thanks_page . "' />\r\n        <input type='hidden' name='cancel_return' value='" . $cancel_page . "' />\r\n    ";
     if (USER) {
         // If user is logged in we also include the user id
         $f_text .= "<input type='hidden' name='custom' value='" . USERID . "' />";
     }
     if ($email_order == 0) {
         // in case setting always show checkout button is off
         if ($always_show_checkout == 0) {
             // When there are items in the shopping cart, display 'Go to checkout' button
             if ($_SESSION['sc_total']['items'] > 0) {
                 // Only show 'Go to checkout' if total amount is above minimum amount
                 if ($_SESSION['sc_total']['sum'] > $minimum_amount) {
                     $f_text .= "\r\n              <input class='button' type='submit' value='" . EASYSHOP_SHOP_09 . "'/>\r\n            </div>\r\n  \t\t\t\t\t</form>\r\n  \t\t\t\t\t<br />";
                 } else {
                     // Minimum amount has not been reached; inform the shopper
                     $f_text .= EASYSHOP_SHOP_36 . " : " . $unicode_character_before . number_format($minimum_amount, 2, '.', '') . $unicode_character_after . " <br />\r\n            " . EASYSHOP_SHOP_37 . " : " . $unicode_character_before . number_format($minimum_amount - $_SESSION['sc_total']['sum'], 2, '.', '') . $unicode_character_after . " <br />";
                 }
             }
         } else {
             // RC6 Fix for proper closing the form tag
             $f_text .= "</div></form><br />";
         }
     } else {
         // e-mail the order to admin
         $f_text .= "<a class='button' href='function MailOrder({$array})'>" . EASYSHOP_SHOP_79 . "</a></form><br />";
     }
     // in case setting always display checkout button is on
     //else
     if ($always_show_checkout == 1) {
         $f_text .= "\r\n\t\t\t<input class='button' type='submit' value='" . EASYSHOP_SHOP_09 . "'/>\r\n  \t\t\t</form>\r\n  \t\t\t<br />";
     }
     // Show 'Manage your basket link'
     if ($_SESSION['sc_total']['items'] > 0 and $action != "edit") {
         $f_text .= "\r\n      <div style='text-align:center;'><a href='easyshop.php?edit'>" . EASYSHOP_SHOP_35 . "</a></div>\r\n    \t";
     } else {
         $f_text .= "\r\n\t\t</div>\r\n\t\t</form>\r\n\t\t<br />";
     }
     /* // Some debug info
        print_r($_SESSION['shopping_cart']);
        print ("<br />");
        print_r($_SESSION['sc_total']);
        print ("<br />");
        print_r($_SESSION['sc_total']['shipping']);
        print ("<br />");
        print_r($_SESSION['sc_total']['shipping2']);
        print ("<br />");
        print_r($_SESSION['sc_total']['handling']);
        print ("<br />");
        */
     return $f_text;
 }
Example #28
0
function step4()
{
    global $pref;
    $e107 = e107::getInstance();
    $stepCaption = 'Step 4: Move user specific forum data and forum prefs';
    if (!isset($_POST['move_user_data'])) {
        $text = "\n\t\tThis step will move the main forum preferences into its own table row.  It will also move all user_viewed data from user table into the user extended table.<br />\n\t\tThe user_forum field data will not be moved, as it will be recalculated later.<br />\n\t\t<br />\n\t\tDepending on the size of your user table, this step could take a while.\n\t\t<br /><br />\n\t\t<form method='post'>\n\t\t<input class='button' type='submit' name='move_user_data' value='Proceed with user data move' />\n\t\t</form>\n\t\t";
        $e107->ns->tablerender($stepCaption, $text);
        return;
    }
    /** Convert forum prefs to their own row **/
    $fconf = e107::getPlugConfig('forum', '', false);
    $coreConfig = e107::getConfig();
    $old_prefs = array();
    foreach ($pref as $k => $v) {
        if (substr($k, 0, 6) == 'forum_') {
            $nk = substr($k, 6);
            echo "Converting {$k} to {$nk}<br />";
            $old_prefs[$nk] = $v;
            $coreConfig->remove($k);
        }
    }
    $forumPrefList = array('reported_post_email', 'email_notify', 'email_notify_on');
    foreach ($forumPrefList as $_fp) {
        echo "converting {$_fp} to {$_fp}<br />";
        $old_prefs[$_fp] = $coreConfig->get($_fp);
        $coreConfig->remove($_fp);
    }
    $fconf->setPref($old_prefs)->save(false, true);
    $coreConfig->save(false, true);
    $result = array('usercount' => 0, 'viewcount' => 0, 'trackcount' => 0);
    $db = new db();
    if ($db->db_Select('user', 'user_id, user_viewed, user_realm', "user_viewed != '' OR user_realm != ''")) {
        require_once e_HANDLER . 'user_extended_class.php';
        $ue = new e107_user_extended();
        while ($row = $db->db_Fetch(MYSQL_ASSOC)) {
            $result['usercount']++;
            $userId = (int) $row['user_id'];
            $viewed = $row['user_viewed'];
            $viewed = trim($viewed, '.');
            $tmp = preg_split('#\\.+#', $viewed);
            $viewed = implode(',', $tmp);
            $realm = $row['user_realm'];
            $realm = str_replace('USERREALM', '', $realm);
            $realm = trim($realm, '-.');
            $trackList = preg_split('#\\D+#', $realm);
            //			echo 'user_id = '.$userId.'<br />';
            //			echo 'viewed = '.$viewed.'<br />';
            //			echo 'realm = '.$realm.'<br />';
            //			echo 'tracking = ' . implode(',', $trackList).'<br />';
            //			print_a($trackList);
            //			echo "<br /><br />";
            if ($viewed != '') {
                $ue->user_extended_setvalue($userId, 'plugin_forum_viewed', mysql_real_escape_string($viewed));
                $result['viewcount']++;
            }
            if (is_array($trackList) && count($trackList)) {
                foreach ($trackList as $threadId) {
                    $result['trackcount']++;
                    $threadId = (int) $threadId;
                    if ($threadId > 0) {
                        $tmp = array();
                        $tmp['track_userid'] = $userId;
                        $tmp['track_thread'] = $threadId;
                        $e107->sql->db_Insert('forum_track', $tmp);
                    }
                }
            }
        }
    }
    $text .= "\n\tUser data move results:<br />\n\tNumber of users processed: {$result['usercount']} <br />\n\tNumber of viewed data processed: {$result['viewcount']} <br />\n\tNumber of tracked records added: {$result['trackcount']} <br />\n\t<br /><br />\n\t<form method='post'>\n\t<input class='button' type='submit' name='nextStep[5]' value='Proceed to step 5' />\n\t</form>\n\t";
    $e107->ns->tablerender($stepCaption, $text);
}
Example #29
0
 function rssadminimport()
 {
     $sql = e107::getDb();
     $ns = e107::getRender();
     $mes = e107::getMessage();
     $tp = e107::getParser();
     global $i, $rss_shortcodes, $feed, $pref;
     global $RSS_ADMIN_IMPORT_HEADER, $RSS_ADMIN_IMPORT_TABLE, $RSS_ADMIN_IMPORT_FOOTER;
     $sqli = new db();
     $feedlist = array();
     // News
     $feed['name'] = ADLAN_0;
     $feed['url'] = 'news';
     // The identifier for the rss feed url
     $feed['topic_id'] = '';
     // The topic_id, empty on default (to select a certain category)
     $feed['path'] = 'news';
     // This is the plugin path location
     $feed['text'] = RSS_PLUGIN_LAN_7;
     $feed['class'] = '0';
     $feed['limit'] = '9';
     $feedlist[] = $feed;
     // News categories
     if ($sqli->db_Select("news_category", "*", "category_id!='' ORDER BY category_name ")) {
         while ($rowi = $sqli->db_Fetch()) {
             $feed['name'] = ADLAN_0 . ' > ' . $rowi['category_name'];
             $feed['url'] = 'news';
             $feed['topic_id'] = $rowi['category_id'];
             $feed['path'] = 'news';
             $feed['text'] = RSS_PLUGIN_LAN_10 . ' ' . $rowi['category_name'];
             $feed['class'] = '0';
             $feed['limit'] = '9';
             //	$feed['exclude_class'] = '';
             $feedlist[] = $feed;
         }
     }
     /*		// Download
     		$feed['name']		= ADLAN_24;
     		$feed['url']		= 'download';
     		$feed['topic_id']	= '';
     		$feed['path']		= 'download';
     		$feed['text']		= RSS_PLUGIN_LAN_8;
     		$feed['class']		= '0';
     		$feed['limit']		= '9';
     		$feedlist[]			= $feed;
     
     		// Download categories
     		if($sqli -> db_Select("download_category", "*","download_category_id!='' ORDER BY download_category_order "))
     		{
     			while($rowi = $sqli -> db_Fetch())
     			{
     				$feed['name']		= ADLAN_24.' > '.$rowi['download_category_name'];
     				$feed['url']		= 'download';
     				$feed['topic_id']	= $rowi['download_category_id'];
     				$feed['path']		= 'download';
     				$feed['text']		= RSS_PLUGIN_LAN_11.' '.$rowi['download_category_name'];
     				$feed['class']		= '0';
     				$feed['limit']		= '9';
     				$feedlist[]			= $feed;
     			}
     		}
     */
     // Comments
     $feed['name'] = LAN_COMMENTS;
     $feed['url'] = 'comments';
     $feed['topic_id'] = '';
     $feed['path'] = 'comments';
     $feed['text'] = RSS_PLUGIN_LAN_9;
     $feed['class'] = '0';
     $feed['limit'] = '9';
     $feedlist[] = $feed;
     // Plugin rss feed, using e_rss.php in plugin folder
     $plugin_feedlist = array();
     foreach ($pref['e_rss_list'] as $val) {
         $eplug_rss_feed = array();
         if (is_readable(e_PLUGIN . $val . "/e_rss.php")) {
             require_once e_PLUGIN . $val . "/e_rss.php";
             $className = $val . "_rss";
             $data = false;
             if (!($data = e107::callMethod($className, 'config'))) {
                 $data = $eplug_rss_feed;
             }
             foreach ($data as $v) {
                 $v['path'] = $val;
                 array_push($plugin_feedlist, $v);
             }
         }
     }
     $feedlist = array_merge($feedlist, $plugin_feedlist);
     //		print_a($feedlist);
     $render = FALSE;
     $i = 0;
     $text = $RSS_ADMIN_IMPORT_HEADER;
     foreach ($feedlist as $k => $feed) {
         $feed['topic_id'] = $tp->toDB($feed['topic_id']);
         $feed['url'] = $tp->toDB($feed['url']);
         // Check if feed is not yet present
         if (!$sql->select("rss", "*", "rss_path='" . $feed['path'] . "' AND rss_url='" . $feed['url'] . "' AND rss_topicid='" . $feed['topic_id'] . "' ")) {
             $render = TRUE;
             $text .= $tp->parseTemplate($RSS_ADMIN_IMPORT_TABLE, FALSE, $rss_shortcodes);
             $i++;
         }
     }
     $text .= $tp->parseTemplate($RSS_ADMIN_IMPORT_FOOTER, FALSE, $rss_shortcodes);
     if (!$render) {
         $this->show_message(RSS_LAN_ADMIN_11, RSS_LAN_ERROR_6);
     } else {
         $ns->tablerender(RSS_LAN_ADMIN_11, $mes->render() . $text);
     }
 }
Example #30
0
 function sc_admin_nav($parm)
 {
     if (ADMIN) {
         global $ns, $pref, $array_functions, $tp;
         $e107_var = array();
         if (strstr(e_SELF, '/admin.php')) {
             $active_page = 'x';
         } else {
             $active_page = time();
         }
         $e107_var['x']['text'] = ADLAN_52;
         $e107_var['x']['link'] = e_ADMIN_ABS . 'admin.php';
         $e107_var['y']['text'] = ADLAN_53;
         $e107_var['y']['link'] = e_HTTP . "index.php";
         //$text .= show_admin_menu("",$active_page,$e107_var);
         $e107_var['afuncs']['text'] = ADLAN_93;
         $e107_var['afuncs']['link'] = '';
         /* SUBLINKS */
         $tmp = array();
         foreach ($array_functions as $links_key => $links_value) {
             $tmp[$links_key]['text'] = $links_value[1];
             $tmp[$links_key]['link'] = $links_value[0];
         }
         $e107_var['afuncs']['sub'] = $tmp;
         /* SUBLINKS END */
         // Plugin links menu
         $xml = e107::getXml();
         $xml->filter = array('@attributes' => FALSE, 'administration' => FALSE);
         // .. and they're all going to need the same filter
         $nav_sql = new db();
         if ($nav_sql->db_Select('plugin', '*', 'plugin_installflag=1')) {
             $tmp = array();
             $e107_var['plugm']['text'] = ADLAN_95;
             $e107_var['plugm']['link'] = '';
             /* SUBLINKS */
             //Link Plugin Manager
             $tmp['plugm']['text'] = '<strong>' . ADLAN_98 . '</strong>';
             $tmp['plugm']['link'] = e_ADMIN . 'plugin.php';
             $tmp['plugm']['perm'] = 'P';
             while ($rowplug = $nav_sql->db_Fetch()) {
                 $plugin_id = $rowplug['plugin_id'];
                 $plugin_path = $rowplug['plugin_path'];
                 if (is_readable(e_PLUGIN . $plugin_path . '/plugin.xml')) {
                     $readFile = $xml->loadXMLfile(e_PLUGIN . $plugin_path . '/plugin.xml', true, true);
                     //	e107::loadLanFiles($plugin_path, 'admin');
                     $eplug_caption = $tp->toHTML($readFile['@attributes']['name'], FALSE, 'defs, emotes_off');
                     $eplug_conffile = $readFile['administration']['configFile'];
                 } elseif (is_readable(e_PLUGIN . $plugin_path . '/plugin.php')) {
                     include e_PLUGIN . $plugin_path . '/plugin.php';
                 }
                 // Links Plugins
                 if ($eplug_conffile) {
                     $tmp['plug_' . $plugin_id]['text'] = $eplug_caption;
                     $tmp['plug_' . $plugin_id]['link'] = e_PLUGIN . $plugin_path . '/' . $eplug_conffile;
                     $tmp['plug_' . $plugin_id]['perm'] = 'P' . $plugin_id;
                 }
                 unset($eplug_conffile, $eplug_name, $eplug_caption);
             }
             $e107_var['plugm']['sub'] = $tmp;
             $e107_var['plugm']['sort'] = true;
             /* SUBLINKS END */
             //$text .= show_admin_menu(ADLAN_95, time(), $e107_var, FALSE, TRUE, TRUE);
             unset($tmp);
         }
         $e107_var['lout']['text'] = LAN_LOGOUT;
         $e107_var['lout']['link'] = e_ADMIN_ABS . 'admin.php?logout';
         $text = e_admin_menu('', '', $e107_var);
         return $ns->tablerender(LAN_HEADER_01, $text, array('id' => 'admin_nav', 'style' => 'button_menu'), TRUE);
     }
 }