Ejemplo n.º 1
0
 function get_external_list($sort = true)
 {
     require_once e_HANDLER . 'file_class.php';
     $fl = new e_file();
     $list = array();
     $list_arr = $fl->get_files(e_PLUGIN, "e_loginbox\\.php\$", "standard", 1);
     if ($list_arr) {
         foreach ($list_arr as $item) {
             $tmp = end(explode('/', trim($item['path'], '/.')));
             if (e107::isInstalled($tmp)) {
                 $list[] = $tmp;
             }
         }
     }
     if ($sort && $this->loginPrefs['external_links']) {
         $tmp = array_flip(explode(',', $this->loginPrefs['external_links']));
         $cnt = count($tmp);
         foreach ($list as $value) {
             $list_ord[$value] = varset($tmp[$value], $cnt++);
         }
         asort($list_ord);
         $list = array_keys($list_ord);
         unset($list_ord);
     }
     return $list;
 }
Ejemplo n.º 2
0
        if ($f[1] == USERID) {
            $path = e_UPLOAD . $fname;
            if (unlink($path) == TRUE) {
                $msg = LAN_FORUM_7002 . ": {$path}";
            } else {
                $msg = LAN_FORUM_7003 . ": {$path}";
            }
        }
    }
}
include_once e_HANDLER . "file_class.php";
include_once HEADERF;
if ($msg) {
    $ns->tablerender(LAN_FORUM_7004, $msg);
}
$fi = new e_file();
$mask = ".*_" . USERID . "_FT.*";
$fileList = $fi->get_files(e_UPLOAD, $mask);
if ($sql->db_Select('forum_thread', 'thread_id, thread_thread, thread_parent', "thread_thread REGEXP '.*_" . USERID . "_FT.*'")) {
    $threadList = $sql->db_getList();
}
$filecount = 0;
if (is_array($fileList)) {
    $txt = "\n\t<form method='post' action='" . e_SELF . "'>\n\t<table style='width:98%'>\n\t<tr>\n\t\t<td class='fcaption'>" . FRMUP_5 . "</td>\n\t\t<td class='fcaption'>" . LAN_FORUM_7006 . "</td>\n\t</tr>";
    foreach ($fileList as $finfo) {
        if ($finfo['fname']) {
            $filecount++;
            $txt .= "<tr><td class='forumheader3'><a href='" . e_UPLOAD . $finfo['fname'] . "'>{$finfo['fname']}</a></td>";
            $found = FALSE;
            if (is_array($threadList)) {
                foreach ($threadList as $tinfo) {
Ejemplo n.º 3
0
Archivo: db.php Proyecto: notzen/e107
 /**
  * Preferences Editor
  * @return none
  */
 private function scan_override()
 {
     global $pref, $emessage;
     require_once e_HANDLER . 'file_class.php';
     $f = new e_file();
     $scList = '';
     $fList = $f->get_files(e_CORE . 'override/shortcodes', '\\.sc$');
     if (count($fList)) {
         $tmp = array();
         foreach ($fList as $file) {
             $tmp[] = strtoupper(substr($file['fname'], 0, -3));
         }
         $scList = implode(',', $tmp);
         unset($tmp);
     }
     $pref['sc_override'] = $scList;
     save_prefs();
     //	$emessage->add(DBLAN_57.':<br />'.$pref['sc_override'], E_MESSAGE_SUCCESS);
     e107::getRender()->tablerender(DBLAN_56, DBLAN_57 . ':<br />' . $pref['sc_override']);
 }
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
0
 function get_comp_lan_phrases($comp_dir, $lang, $depth = 0)
 {
     if (!is_dir($comp_dir)) {
         return array();
     }
     require_once e_HANDLER . "file_class.php";
     $fl = new e_file();
     $ret = array();
     if ($lang_array = $fl->get_files($comp_dir, ".php\$", "standard", $depth)) {
         sort($lang_array);
     }
     $regexp = strpos($comp_dir, e_LANGUAGEDIR) !== FALSE ? "#.php#" : "#" . $lang . "#";
     foreach ($lang_array as $f) {
         if (preg_match($regexp, $f['path'] . $f['fname']) && is_file($f['path'] . $f['fname'])) {
             $allData = file_get_contents($f['path'] . $f['fname']);
             $data = explode("\n", $allData);
             // $data = file($f['path'].$f['fname']);
             $relpath = str_replace($comp_dir, "", $f['path']);
             $key = str_replace(".php", "", $relpath . $f['fname']);
             if (substr($data[0], 0, 5) != "<?php") {
                 $ret['bom'][$key] = $f['fname'];
             }
             $end_of_file = 0;
             foreach ($data as $line) {
                 if ($end_of_file == 1) {
                     $ret['bom'][$key] = $f['fname'];
                 }
                 $line = trim($line);
                 if ($line == "?>") {
                     $end_of_file = 1;
                 }
             }
             if ($f['path'] . $f['fname'] == e_LANGUAGEDIR . $lang . "/" . $lang . ".php") {
                 $f['fname'] = "English.php";
                 // change the key for the main language file.
             }
             if ($f['path'] . $f['fname'] == e_LANGUAGEDIR . $lang . "/" . $lang . "_custom.php") {
                 $f['fname'] = "English_custom.php";
                 // change the key for the main language file.
             }
             $ret = $ret + $this->fill_phrases_array($allData, $relpath . $f['fname']);
         }
     }
     return $ret;
 }
Ejemplo n.º 6
0
 function pluginUninstall()
 {
     $pref = e107::getPref();
     $admin_log = e107::getAdminLog();
     $plugin = e107::getPlugin();
     $tp = e107::getParser();
     $sql = e107::getDb();
     $eplug_folder = '';
     if (!isset($_POST['uninstall_confirm'])) {
         // $id is already an integer
         $this->pluginConfirmUninstall($this->id);
         return;
     }
     $plug = $plugin->getinfo($this->id);
     $text = '';
     //Uninstall Plugin
     if ($plug['plugin_installflag'] == TRUE) {
         $eplug_folder = $plug['plugin_path'];
         $_path = e_PLUGIN . $plug['plugin_path'] . '/';
         if (file_exists($_path . 'plugin.xml')) {
             unset($_POST['uninstall_confirm']);
             $text .= $plugin->install_plugin_xml($this->id, 'uninstall', $_POST);
             //$_POST must be used.
         } else {
             // Deprecated - plugin uses plugin.php
             include e_PLUGIN . $plug['plugin_path'] . '/plugin.php';
             $func = $eplug_folder . '_uninstall';
             if (function_exists($func)) {
                 $text .= call_user_func($func);
             }
             if ($_POST['delete_tables']) {
                 if (is_array($eplug_table_names)) {
                     $result = $plugin->manage_tables('remove', $eplug_table_names);
                     if ($result !== TRUE) {
                         $text .= EPL_ADLAN_27 . ' <b>' . $mySQLprefix . $result . '</b> - ' . EPL_ADLAN_30 . '<br />';
                     } else {
                         $text .= EPL_ADLAN_28 . "<br />";
                     }
                 }
             } else {
                 $text .= EPL_ADLAN_49 . "<br />";
             }
             if (is_array($eplug_prefs)) {
                 $plugin->manage_prefs('remove', $eplug_prefs);
                 $text .= EPL_ADLAN_29 . "<br />";
             }
             if (is_array($eplug_comment_ids)) {
                 $text .= $plugin->manage_comments('remove', $eplug_comment_ids) ? EPL_ADLAN_50 . "<br />" : "";
             }
             if (is_array($eplug_array_pref)) {
                 foreach ($eplug_array_pref as $key => $val) {
                     $plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val);
                 }
             }
             if ($eplug_menu_name) {
                 $sql->db_Delete('menus', "menu_name='{$eplug_menu_name}' ");
             }
             if ($eplug_link) {
                 $plugin->manage_link('remove', $eplug_link_url, $eplug_link_name);
             }
             if ($eplug_userclass) {
                 $plugin->manage_userclass('remove', $eplug_userclass);
             }
             $sql->update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$this->id}' ");
             $plugin->manage_search('remove', $eplug_folder);
             $plugin->manage_notify('remove', $eplug_folder);
             // it's done inside install_plugin_xml(), required only here
             if (isset($pref['plug_installed'][$plug['plugin_path']])) {
                 unset($pref['plug_installed'][$plug['plugin_path']]);
             }
             e107::getConfig('core')->setPref($pref);
             $plugin->rebuildUrlConfig();
             e107::getConfig('core')->save();
         }
         $logInfo = deftrue($plug['plugin_name'], $plug['plugin_name']) . " v" . $plug['plugin_version'] . " ({e_PLUGIN}" . $plug['plugin_path'] . ")";
         e107::getLog()->add('PLUGMAN_03', $logInfo, E_LOG_INFORMATIVE, '');
     }
     if ($_POST['delete_files']) {
         include_once e_HANDLER . 'file_class.php';
         $fi = new e_file();
         $result = $fi->rmtree(e_PLUGIN . $eplug_folder);
         $text .= $result ? '<br />' . EPL_ADLAN_86 . e_PLUGIN . $eplug_folder : '<br />' . EPL_ADLAN_87 . '<br />' . EPL_ADLAN_31 . ' <b>' . e_PLUGIN . $eplug_folder . '</b> ' . EPL_ADLAN_32;
     } else {
         $text .= '<br />' . EPL_ADLAN_31 . ' <b>' . e_PLUGIN . $eplug_folder . '</b> ' . EPL_ADLAN_32;
     }
     $plugin->save_addon_prefs('update');
     $this->show_message($text, E_MESSAGE_SUCCESS);
     //	$ns->tablerender(EPL_ADLAN_1.' '.$tp->toHtml($plug['plugin_name'], "", "defs,emotes_off,no_make_clickable"), $text);
     $text = '';
     $this->action = 'installed';
     return;
 }
Ejemplo n.º 7
0
Archivo: docs.php Proyecto: notzen/e107
 * $Source: /cvs_backup/e107_0.8/e107_admin/docs.php,v $
 * $Revision$
 * $Date$
 * $Author$
 *
*/
require_once "../class2.php";
if (!ADMIN) {
    header("location:" . e_BASE . "index.php");
    exit;
}
include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/admin/lan_' . e_PAGE);
$e_sub_cat = 'docs';
require_once "auth.php";
require_once e_HANDLER . 'file_class.php';
$fl = new e_file();
$doc_fpath = e_DOCS . e_LANGUAGE . '/';
$doc_fpath_alt = e_DOCS . 'English/';
$helplist_all = $fl->get_files($doc_fpath_alt);
if (!is_dir($doc_fpath) || $doc_fpath == $doc_fpath_alt) {
    $helplist = $helplist_all;
} else {
    $helplist = $fl->get_files($doc_fpath);
}
//Titles in Admin Area are requested by the community
define('e_PAGETITLE', LAN_DOCS);
if (e_QUERY) {
    $i = intval(e_QUERY) - 1;
    $filename = $doc_fpath . $helplist[$i]['fname'];
    $filename_alt = $doc_fpath_alt . $helplist[$i]['fname'];
    if (is_readable($filename)) {
Ejemplo n.º 8
0
    function showMaint()
    {
        $mes = e107::getMessage();
        $mes->addInfo("Deprecated Area - please use filter instead under 'Manage' ");
        global $pref;
        $ns = e107::getRender();
        $sql = e107::getDb();
        $frm = e107::getForm();
        $tp = e107::getParser();
        if (isset($_POST['dl_maint'])) {
            switch ($_POST['dl_maint']) {
                case 'duplicates':
                    $title = DOWLAN_166;
                    $query = 'SELECT GROUP_CONCAT(d.download_id SEPARATOR ",") as gc, d.download_id, d.download_name, d.download_url, dc.download_category_name
		                      FROM #download as d
		                      LEFT JOIN #download_category AS dc ON dc.download_category_id=d.download_category
		                      GROUP BY d.download_url
		                      HAVING COUNT(d.download_id) > 1
		               ';
                    $text = "";
                    $count = $sql->gen($query);
                    $foundSome = false;
                    if ($count) {
                        $currentURL = "";
                        while ($row = $sql->fetch()) {
                            if (!$foundSome) {
                                //  $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
                                $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform">
		                     			<table class="table adminform">';
                                $text .= '<tr>';
                                $text .= '<th>' . DOWLAN_13 . '</th>';
                                $text .= '<th>' . LAN_ID . '</th>';
                                $text .= '<th>' . DOWLAN_27 . '</th>';
                                $text .= '<th>' . DOWLAN_11 . '</th>';
                                $text .= '<th>' . LAN_OPTIONS . '</th>';
                                $text .= '</tr>';
                                $foundSome = true;
                            }
                            $query = "SELECT d.*, dc.* FROM `#download` AS d\n\t\t                     LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category\n\t\t                     WHERE download_id IN (" . $row['gc'] . ")\n\t\t                     ORDER BY download_id ASC";
                            $count = $sql2->gen($query);
                            while ($row = $sql2->fetch()) {
                                $text .= '<tr>';
                                if ($currentURL != $row['download_url']) {
                                    $text .= '<td>' . $tp->toHTML($row['download_url']) . '</td>';
                                    $currentURL = $row['download_url'];
                                } else {
                                    $text .= '<td>*</td>';
                                }
                                $text .= '<td>' . $row['download_id'] . '</td>';
                                $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $e107->tp->toHTML($row['download_name']) . '</a></td>';
                                $text .= '<td>' . $tp->toHTML($row['download_category_name']) . '</td>';
                                $text .= '<td>
		                                 <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.duplicates">' . ADMIN_EDIT_ICON . '</a>
		   				                  <input type="image" title="' . LAN_DELETE . '" name="delete[main_' . $row["download_id"] . ']" src="' . ADMIN_DELETE_ICON_PATH . '" onclick=\'return jsconfirm("' . $tp->toJS(DOWLAN_33 . ' [ID: ' . $row["download_id"] . ' ]') . '") \'/>
		   				               </td>';
                                $text .= '</tr>';
                            }
                        }
                    }
                    if ($foundSome) {
                        $text .= '</table></form>';
                    } else {
                        e107::getMessage()->addInfo(DOWLAN_172);
                    }
                    break;
                case 'orphans':
                    $title = DOWLAN_167;
                    $text = "";
                    require_once e_HANDLER . "file_class.php";
                    $efile = new e_file();
                    $files = $efile->get_files(e_DOWNLOAD);
                    $foundSome = false;
                    foreach ($files as $file) {
                        if (0 == $sql->db_Count('download', '(*)', " WHERE download_url='" . $file['fname'] . "'")) {
                            if (!$foundSome) {
                                // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
                                $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform">
		                     <table class="table adminform">';
                                $text .= '<tr>';
                                $text .= '<th>' . DOWLAN_13 . '</th>';
                                $text .= '<th>' . DOWLAN_182 . '</th>';
                                $text .= '<th>' . DOWLAN_66 . '</th>';
                                $text .= '<th>' . LAN_OPTIONS . '</th>';
                                $text .= '</tr>';
                                $foundSome = true;
                            }
                            $filesize = is_readable(e_DOWNLOAD . $row['download_url']) ? $e107->parseMemorySize(filesize(e_DOWNLOAD . $file['fname'])) : DOWLAN_181;
                            $filets = is_readable(e_DOWNLOAD . $row['download_url']) ? $gen->convert_date(filectime(e_DOWNLOAD . $file['fname']), "long") : DOWLAN_181;
                            $text .= '<tr>';
                            $text .= '<td>' . $tp->toHTML($file['fname']) . '</td>';
                            $text .= '<td>' . $filets . '</td>';
                            $text .= '<td>' . $filesize . '</td>';
                            //TODO               $text .= '<td>
                            //TODO                           <a href="'.e_SELF.'?create.add.'. urlencode($file["fname"]).'">'.E_16_CREATE.'</a>
                            //TODO					            <input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$file["fname"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_173.' [ '.$file["fname"].' ]').'") \'/>
                            //TODO					         </td>';
                            $text .= '</tr>';
                        }
                    }
                    if ($foundSome) {
                        $text .= '</table></form>';
                    } else {
                        e107::getMessage()->addInfo(DOWLAN_174);
                    }
                    break;
                case 'missing':
                    $title = DOWLAN_168;
                    $text = "";
                    $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category";
                    $count = $sql->gen($query);
                    $foundSome = false;
                    if ($count) {
                        while ($row = $sql->fetch()) {
                            if (!is_readable(e_DOWNLOAD . $row['download_url'])) {
                                if (!$foundSome) {
                                    // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
                                    $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform">
		                        		<table class="adminlist">';
                                    $text .= '<tr>';
                                    $text .= '<th>' . LAN_ID . '</th>';
                                    $text .= '<th>' . DOWLAN_27 . '</th>';
                                    $text .= '<th>' . DOWLAN_11 . '</th>';
                                    $text .= '<th>' . DOWLAN_13 . '</th>';
                                    $text .= '<th>' . LAN_OPTIONS . '</th>';
                                    $text .= '</tr>';
                                    $foundSome = true;
                                }
                                $text .= '<tr>';
                                $text .= '<td>' . $row['download_id'] . '</td>';
                                $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $tp->toHTML($row['download_name']) . '</a></td>';
                                $text .= '<td>' . $tp->toHTML($row['download_category_name']) . '</td>';
                                $text .= '<td>' . $tp->toHTML($row['download_url']) . '</td>';
                                $text .= '<td>
		                                 <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.missing">' . ADMIN_EDIT_ICON . '</a>
		   					               <input type="image" title="' . LAN_DELETE . '" name="delete[main_' . $row["download_id"] . ']" src="' . ADMIN_DELETE_ICON_PATH . '" onclick=\'return jsconfirm("' . $tp->toJS(DOWLAN_33 . ' [ID: ' . $row["download_id"] . ' ]') . '") \'/>
		   					            </td>';
                                $text .= '</tr>';
                            }
                        }
                    }
                    if ($foundSome) {
                        $text .= '</table></form>';
                    } else {
                        e107::getMessage()->addInfo(DOWLAN_172);
                        //  $text = DOWLAN_172;
                    }
                    break;
                case 'inactive':
                    $title = DOWLAN_169;
                    $text = "";
                    $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category WHERE download_active=0";
                    $count = $sql->gen($query);
                    $foundSome = false;
                    if ($count) {
                        while ($row = $sql->fetch()) {
                            if (!$foundSome) {
                                // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
                                $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform">
		                     		<table class="table adminform">';
                                $text .= '<tr>';
                                $text .= '<th>' . LAN_ID . '</th>';
                                $text .= '<th>' . DOWLAN_27 . '</th>';
                                $text .= '<th>' . DOWLAN_11 . '</th>';
                                $text .= '<th>' . DOWLAN_13 . '</th>';
                                $text .= '<th>' . LAN_OPTIONS . '</th>';
                                $text .= '</tr>';
                                $foundSome = true;
                            }
                            $text .= '<tr>';
                            $text .= '<td>' . $row['download_id'] . '</td>';
                            $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $e107->tp->toHTML($row['download_name']) . '</a></td>';
                            $text .= '<td>' . $e107->tp->toHTML($row['download_category_name']) . '</td>';
                            if (strlen($row['download_url']) > 0) {
                                $text .= '<td>' . $row['download_url'] . '</td>';
                            } else {
                                $mirrorArray = download::makeMirrorArray($row['download_mirror'], TRUE);
                                $text .= '<td>';
                                foreach ($mirrorArray as $mirror) {
                                    $text .= $mirror['url'] . '<br/>';
                                }
                                $text .= '</td>';
                            }
                            $text .= '<td>
		                              <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.inactive">' . ADMIN_EDIT_ICON . '</a>
		   				               <input type="image" title="' . LAN_DELETE . '" name="delete[main_' . $row["download_id"] . ']" src="' . ADMIN_DELETE_ICON_PATH . '" onclick=\'return jsconfirm("' . $tp->toJS(DOWLAN_33 . ' [ID: ' . $row["download_id"] . ' ]') . '") \'/>
		   				            </td>';
                            $text .= '</tr>';
                        }
                    }
                    if ($foundSome) {
                        $text .= '</table></form>';
                    } else {
                        e107::getMessage()->addInfo(DOWLAN_172);
                        // $text = DOWLAN_172;
                    }
                    break;
                case 'nocategory':
                    $title = DOWLAN_178;
                    $text = "";
                    $query = "SELECT * FROM `#download` WHERE download_category=0";
                    $count = $sql->gen($query);
                    $foundSome = false;
                    if ($count) {
                        while ($row = $sql->fetch()) {
                            if (!$foundSome) {
                                //  $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
                                $text .= '
		                     <form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform">
		                     <table class="table adminlist">';
                                $text .= '<tr>';
                                $text .= '<th>' . LAN_ID . '</th>';
                                $text .= '<th>' . DOWLAN_27 . '</th>';
                                $text .= '<th>' . DOWLAN_13 . '</th>';
                                $text .= '<th>' . LAN_OPTIONS . '</th>';
                                $text .= '</tr>';
                                $foundSome = true;
                            }
                            $text .= '<tr>';
                            $text .= '<td>' . $row['download_id'] . '</td>';
                            $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $e107->tp->toHTML($row['download_name']) . '</a></td>';
                            if (strlen($row['download_url']) > 0) {
                                $text .= '<td>' . $e107->tp->toHTML($row['download_url']) . '</td>';
                            } else {
                                $mirrorArray = download::makeMirrorArray($row['download_mirror'], TRUE);
                                $text .= '<td>';
                                foreach ($mirrorArray as $mirror) {
                                    $text .= $mirror['url'] . '<br/>';
                                }
                                $text .= '</td>';
                            }
                            $text .= '<td>
		                              <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.nocategory">' . ADMIN_EDIT_ICON . '</a>
		   				               <input type="image" title="' . LAN_DELETE . '" name="delete[main_' . $row["download_id"] . ']" src="' . ADMIN_DELETE_ICON_PATH . '" onclick=\'return jsconfirm("' . $tp->toJS(DOWLAN_33 . ' [ID: ' . $row["download_id"] . ' ]') . '") \'/>
		   				            </td>';
                            $text .= '</tr>';
                        }
                    }
                    if ($foundSome) {
                        $text .= '</table></form>';
                    } else {
                        e107::getMessage()->addInfo(DOWLAN_172);
                        // $text = DOWLAN_172;
                    }
                    break;
                case 'filesize':
                    $title = DOWLAN_66;
                    $text = "";
                    $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category WHERE d.download_url<>''";
                    $count = $sql->gen($query);
                    $foundSome = false;
                    if ($count) {
                        while ($row = $sql->fetch()) {
                            if (is_readable(e_DOWNLOAD . $row['download_url'])) {
                                $filesize = filesize(e_DOWNLOAD . $row['download_url']);
                                if ($filesize != $row['download_filesize']) {
                                    if (!$foundSome) {
                                        // $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
                                        $text .= '<form method="post" action="' . e_SELF . '?' . e_QUERY . '" id="myform">
		                           		<table class="table adminlist">';
                                        $text .= '<tr>';
                                        $text .= '<th>' . LAN_ID . '</th>';
                                        $text .= '<th>' . DOWLAN_27 . '</th>';
                                        $text .= '<th>' . DOWLAN_11 . '</th>';
                                        $text .= '<th>' . DOWLAN_13 . '</th>';
                                        $text .= '<th>' . DOWLAN_180 . '</th>';
                                        $text .= '<th>' . LAN_OPTIONS . '</th>';
                                        $text .= '</tr>';
                                        $foundSome = true;
                                    }
                                    $text .= '<tr>';
                                    $text .= '<td>' . $row['download_id'] . '</td>';
                                    $text .= "<td><a href='" . e_PLUGIN . "download/download.php?view." . $row['download_id'] . "'>" . $e107->tp->toHTML($row['download_name']) . '</a></td>';
                                    $text .= '<td>' . $e107->tp->toHTML($row['download_category_name']) . '</td>';
                                    $text .= '<td>' . $e107->tp->toHTML($row['download_url']) . '</td>';
                                    $text .= '<td>' . $row['download_filesize'] . ' / ';
                                    $text .= $filesize;
                                    $text .= '</td>';
                                    $text .= '<td>
		                                    <a href="' . e_SELF . '?create.edit.' . $row["download_id"] . '.maint.filesize">' . ADMIN_EDIT_ICON . '</a>
		   					                  <input type="image" title="' . LAN_DELETE . '" name="delete[main_' . $row["download_id"] . ']" src="' . ADMIN_DELETE_ICON_PATH . '" onclick=\'return jsconfirm("' . $tp->toJS(DOWLAN_33 . ' [ID: ' . $row["download_id"] . ' ]') . '") \'/>
		   					               </td>';
                                    $text .= '</tr>';
                                }
                            }
                        }
                    }
                    if ($foundSome) {
                        $text .= '</table></form>';
                    } else {
                        e107::getMessage()->addInfo(DOWLAN_172);
                        // $text = DOWLAN_172;
                    }
                    break;
                case 'log':
                    $text = "log - view manage download history log";
                    header('location: ' . e_ADMIN . 'admin_log.php?downlog');
                    exit;
                    break;
            }
        } else {
            $title = DOWLAN_193;
            $text = DOWLAN_179;
            $eform = new e_form();
            $text = "\n\t\t      \t<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='core-db-main-form'>\n\t\t      \t\t<fieldset id='core-db-plugin-scan'>\n\t\t      \t\t<legend class='e-hideme'>" . DOWLAN_10 . "</legend>\n\t\t      \t\t\t<table class='table adminform'>\n\t\t      \t\t\t<colgroup span='2'>\n\t\t      \t\t\t\t<col style='width: 40%'></col>\n\t\t      \t\t\t\t<col style='width: 60%'></col>\n\t\t      \t\t\t</colgroup>\n\t\t      \t\t\t<tbody>\n\t\t      \t\t\t\t<tr>\n\t\t      \t\t\t\t\t<td>" . DOWLAN_166 . "</td>\n\t\t      \t\t\t\t\t<td>\n\t\t      \t\t\t\t\t\t" . $eform->radio('dl_maint', 'duplicates') . $eform->label(DOWLAN_185, 'dl_maint', 'duplicates') . "\n\t\t      \t\t\t\t\t</td>\n\t\t      \t\t\t\t</tr>\n\t\t      \t\t\t\t<tr>\n\t\t      \t\t\t\t\t<td>" . DOWLAN_167 . "</td>\n\t\t      \t\t\t\t\t<td>\n\t\t      \t\t\t\t\t\t" . $eform->radio('dl_maint', 'orphans') . $eform->label(DOWLAN_186, 'dl_maint', 'orphans') . "\n\t\t      \t\t\t\t\t</td>\n\t\t      \t\t\t\t</tr>\n\t\t      \t\t\t\t<tr>\n\t\t      \t\t\t\t\t<td>" . DOWLAN_168 . "</td>\n\t\t      \t\t\t\t\t<td>\n\t\t      \t\t\t\t\t\t" . $eform->radio('dl_maint', 'missing') . $eform->label(DOWLAN_187, 'dl_maint', 'missing') . "\n\t\t      \t\t\t\t\t</td>\n\t\t      \t\t\t\t</tr>\n\t\t      \t\t\t\t<tr>\n\t\t      \t\t\t\t\t<td>" . DOWLAN_169 . "</td>\n\t\t      \t\t\t\t\t<td>\n\t\t      \t\t\t\t\t\t" . $eform->radio('dl_maint', 'inactive') . $eform->label(DOWLAN_188, 'dl_maint', 'inactive') . "\n\t\t      \t\t\t\t\t</td>\n\t\t      \t\t\t\t</tr>\n\t\t      \t\t\t\t<tr>\n\t\t      \t\t\t\t\t<td>" . DOWLAN_178 . "</td>\n\t\t      \t\t\t\t\t<td>\n\t\t      \t\t\t\t\t\t" . $eform->radio('dl_maint', 'nocategory') . $eform->label(DOWLAN_189, 'dl_maint', 'nocategory') . "\n\t\t      \t\t\t\t\t</td>\n\t\t      \t\t\t\t</tr>\n\t\t      \t\t\t\t<tr>\n\t\t      \t\t\t\t\t<td>" . DOWLAN_66 . "</td>\n\t\t      \t\t\t\t\t<td>\n\t\t      \t\t\t\t\t\t" . $eform->radio('dl_maint', 'filesize') . $eform->label(DOWLAN_190, 'dl_maint', 'filesize') . "\n\t\t      \t\t\t\t\t</td>\n\t\t      \t\t\t\t</tr>\n\t\t      \t\t\t\t<tr>\n\t\t      \t\t\t\t\t<td>" . DOWLAN_171 . "</td>\n\t\t      \t\t\t\t\t<td>\n\t\t      \t\t\t\t\t\t" . $eform->radio('dl_maint', 'log') . $eform->label(DOWLAN_191, 'dl_maint', 'log') . "\n\t\t      \t\t\t\t\t</td>\n\t\t      \t\t\t\t</tr>\n\t\t\n\t\t      \t\t\t\t</tbody>\n\t\t      \t\t\t</table>\n\t\t      \t\t\t<div class='buttons-bar center'>\n\t\t      \t\t\t\t" . $eform->admin_button('trigger_db_execute', DOWLAN_192, 'execute') . "\n\t\t      \t\t\t</div>\n\t\t      \t\t</fieldset>\n\t\t      \t</form>\n\t\t      \t";
        }
        echo $text;
        // 	$ns->tablerender(DOWLAN_165.$title, $text);
    }
Ejemplo n.º 9
0
 function menuScanMenus()
 {
     global $sql2;
     $sql = e107::getDb();
     $efile = new e_file();
     $efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
     $fileList = $efile->get_files(e_PLUGIN, "_menu\\.php\$", 'standard', 2);
     $this->menuAddMessage('Scanning for new menus', E_MESSAGE_DEBUG);
     $menuList = array();
     // existing menus in table.
     if ($result = $sql->retrieve('menus', 'menu_name', null, true)) {
         foreach ($result as $mn) {
             if ($mn['menu_name']) {
                 $menuList[] = $mn['menu_name'];
             }
         }
     }
     //v2.x Scan Custom Page Menus.
     $pageMenus = $sql->retrieve('page', 'page_id, menu_name, menu_title', "menu_name !='' ", true);
     foreach ($pageMenus as $row) {
         if (!in_array($row['menu_name'], $menuList)) {
             $insert = array('menu_id' => 0, 'menu_name' => $row['menu_name'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $row['page_id'], 'menu_layout' => '', 'menu_parms' => '');
             if ($sql->insert("menus", $insert)) {
                 $this->menuAddMessage(MENLAN_10 . " - " . $row['menu_name'], E_MESSAGE_DEBUG);
             }
         }
     }
     foreach ($fileList as $file) {
         list($parent_dir) = explode('/', str_replace(e_PLUGIN, "", $file['path']));
         $file['path'] = str_replace(e_PLUGIN, "", $file['path']);
         $file['fname'] = str_replace(".php", "", $file['fname']);
         $valid_menu = FALSE;
         $existing_menu = in_array($file['fname'], $menuList);
         // $sql->count("menus", "(*)", "WHERE menu_name='{$file['fname']}'");
         if (file_exists(e_PLUGIN . $parent_dir . '/plugin.xml') || file_exists(e_PLUGIN . $parent_dir . '/plugin.php')) {
             if (e107::isInstalled($parent_dir)) {
                 // Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed
                 $valid_menu = TRUE;
                 // Whether new or existing, include in list
                 //						echo "Include {$parent_dir}:{$file['fname']}<br />";
             }
         } else {
             $valid_menu = TRUE;
             //					echo "Default Include {$parent_dir}:{$file['fname']}<br />";
         }
         if ($valid_menu) {
             $menustr .= "&" . str_replace(".php", "", $file['fname']);
             if (!$existing_menu) {
                 $insert = array('menu_id' => 0, 'menu_name' => $file['fname'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $file['path'], 'menu_layout' => '', 'menu_parms' => '');
                 if ($sql->insert("menus", $insert)) {
                     // Could do admin logging here - but probably not needed
                     $message .= MENLAN_10 . " - " . $file['fname'] . "<br />";
                     //FIXME
                 } else {
                     $this->menuAddMessage("Couldn't add menu: " . $file['fname'] . " to table ", E_MESSAGE_DEBUG);
                 }
             }
         }
     }
     //Reorder all menus into 1...x order
     if (!is_object($sql2)) {
         $sql2 = new db();
     }
     // Shouldn't be needed
     if (!is_object($sql3)) {
         $sql3 = new db();
     }
     $location_count = $sql3->select("menus", "menu_location", "menu_location>0 GROUP BY menu_location");
     while ($location_count) {
         if ($sql->select("menus", "menu_id", "menu_location={$location_count} ORDER BY menu_order ASC")) {
             $c = 1;
             while ($row = $sql->fetch()) {
                 $sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=" . $row['menu_id']);
                 $c++;
             }
         }
         $location_count--;
     }
     $sql->select("menus", "*", "menu_path NOT REGEXP('[0-9]+') ");
     while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->fetch(MYSQL_NUM)) {
         if (stristr($menustr, $menu_name) === FALSE) {
             $sql2->db_Delete("menus", "menu_name='{$menu_name}'");
             $message .= MENLAN_11 . " - " . $menu_name . "<br />";
         }
     }
     $this->menuAddMessage(vartrue($message), E_MESSAGE_DEBUG);
 }
Ejemplo n.º 10
0
        $i++;
    }
    $ns->tablerender($pref['newsposts_archive_title'], $textnewsarchive, 'news_archive');
}
// #### END -----------------------------------------------------------------------------------------------------------
if ($action != "item") {
    if (is_numeric($action)) {
        $action = "";
    }
    $parms = $news_total . "," . ITEMVIEW . "," . $from . "," . e_SELF . '?' . "[FROM]." . $action . (isset($sub_action) ? "." . $sub_action : "");
    $nextprev = $news_total > ITEMVIEW ? LAN_NEWS_22 . "&nbsp;" . $tp->parseTemplate("{NEXTPREV={$parms}}") : "";
    echo $nextprev ? "<div class='nextprev'>" . $nextprev . "</div>" : "";
}
if (is_dir("remotefile")) {
    require_once e_HANDLER . "file_class.php";
    $file = new e_file();
    $reject = array('$.', '$..', '/', 'CVS', 'thumbs.db', '*._$', 'index', 'null*', 'Readme.txt');
    $crem = $file->get_files(e_BASE . "remotefile", "", $reject);
    if (count($crem)) {
        foreach ($crem as $loadrem) {
            if (strstr($loadrem['fname'], "load_")) {
                require_once e_BASE . "remotefile/" . $loadrem['fname'];
            }
        }
    }
}
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 2) {
    require_once e_PLUGIN . "newforumposts_main/newforumposts_main.php";
}
render_newscats();
require_once FOOTERF;
Ejemplo n.º 11
0
function getFontList($match = '')
{
    require_once e_HANDLER . 'file_class.php';
    $fl = new e_file();
    if (!$match) {
        $match = '~^uni2cid';
    }
    $fileList = $fl->get_files(e_PLUGIN . 'pdf/font/', $match, 'standard', 1);
    $fontList = array();
    $intList = array();
    foreach ($fileList as $v) {
        if (isset($v['fname']) && substr($v['fname'], -4) == '.php') {
            $intList[] = substr($v['fname'], 0, -4);
        }
    }
    unset($fileList);
    sort($intList);
    // This will guarantee that base font names appear before bold, italic etc
    foreach ($intList as $f) {
        if (substr($f, -2) == 'bi') {
            $fontList[substr($f, 0, -2)]['bi'] = $f . '.php';
        } elseif (substr($f, -1) == 'i') {
            $fontList[substr($f, 0, -1)]['i'] = $f . '.php';
        } elseif (substr($f, -1) == 'b') {
            $fontList[substr($f, 0, -1)]['b'] = $f . '.php';
        } else {
            // Must be base font name
            $fontList[$f]['base'] = $f . '.php';
        }
    }
    // Now get the info on each font.
    foreach ($fontList as $font => $info) {
        $fontList[$font]['info'] = getFontInfo($info['base']);
    }
    //print_a($fontList);
    return $fontList;
}
Ejemplo n.º 12
0
 function user_extended_edit($struct, $curval)
 {
     global $tp;
     if (trim($curval) == "" && $struct['user_extended_struct_default'] != "") {
         $curval = $struct['user_extended_struct_default'];
     }
     $choices = explode(",", $struct['user_extended_struct_values']);
     foreach ($choices as $k => $v) {
         $choices[$k] = str_replace("[E_COMMA]", ",", $choices[$k]);
     }
     $parms = explode("^,^", $struct['user_extended_struct_parms']);
     $include = preg_replace("/\n/", " ", $tp->toHtml($parms[0]));
     $regex = $tp->toText($parms[1]);
     $regexfail = $tp->toText($parms[2]);
     $fname = "ue[user_" . $struct['user_extended_struct_name'] . "]";
     if (strpos($include, 'class') === FALSE) {
         $include .= " class='tbox' ";
     }
     switch ($struct['user_extended_struct_type']) {
         case EUF_TEXT:
             //textbox
         //textbox
         case EUF_INTEGER:
             //integer
             $ret = "<input name='{$fname}' value='{$curval}' {$include} />";
             return $ret;
             break;
         case EUF_RADIO:
             //radio
             $ret = '';
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 $choice = deftrue($choice, $choice);
                 $chk = $curval == $choice ? " checked='checked' " : "";
                 $ret .= "<input {$include} type='radio' name='{$fname}' value='{$choice}' {$chk} /> {$choice}";
             }
             return $ret;
             break;
         case EUF_CHECKBOX:
             //checkboxes
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 if (strpos($choice, "|") !== FALSE) {
                     list($val, $label) = explode("|", $choice);
                 } else {
                     $val = $choice;
                     $label = $choice;
                 }
                 $label = deftrue($label, $label);
                 $chk = $curval == $val ? " checked='checked' " : "";
                 $ret .= "<input {$include} type='checkbox' name='{$fname}[]' value='{$val}' {$chk} /> {$label}<br />";
             }
             return $ret;
             break;
         case EUF_DROPDOWN:
             //dropdown
             $ret = "<select {$include} name='{$fname}'>\n";
             $ret .= "<option value=''>&nbsp;</option>\n";
             // ensures that the user chose it.
             foreach ($choices as $choice) {
                 $choice = trim($choice);
                 $choice = deftrue($choice, $choice);
                 $sel = $curval == $choice ? " selected='selected' " : "";
                 $ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n";
             }
             $ret .= "</select>\n";
             return $ret;
             break;
         case EUF_PREDEFINED:
             // predefined list, shown in dropdown
             $filename = e_ADMIN . 'sql/extended_' . trim($struct['user_extended_struct_values']) . '.php';
             if (!is_readable($filename)) {
                 return 'No file: ' . $filename;
             }
             require $filename;
             $list_name = $struct['user_extended_struct_values'] . '_list';
             $display_func = $struct['user_extended_struct_values'] . '_value';
             if (!function_exists($display_func)) {
                 $display_func = '';
             }
             $source_data = ${$list_name};
             $ret = "<select {$include} name='{$fname}'>\n";
             $ret .= "<option value=''>&nbsp;</option>\n";
             // ensures that the user chose it.
             foreach ($source_data as $v) {
                 $val = $v[0];
                 $choice = trim($v[1]);
                 if ($display_func) {
                     $choice = $display_func($val, $choice);
                 }
                 $sel = $curval == $val ? " selected='selected' " : "";
                 $ret .= "<option value='{$val}' {$sel}>{$choice}</option>\n";
             }
             $ret .= "</select>\n";
             return $ret;
             break;
         case EUF_DB_FIELD:
             //db_field
             global $sql;
             $order = $choices[3] ? "ORDER BY " . $tp->toDB($choices[3], true) : "";
             if ($sql->db_Select($tp->toDB($choices[0], true), $tp->toDB($choices[1], true) . "," . $tp->toDB($choices[2], true), "1 {$order}")) {
                 $choiceList = $sql->db_getList('ALL', FALSE);
                 $ret = "<select {$include} name='{$fname}'  >\n";
                 $ret .= "<option value=''>&nbsp;</option>\n";
                 // ensures that the user chose it.
                 foreach ($choiceList as $cArray) {
                     $cID = trim($cArray[$choices[1]]);
                     $cText = trim($cArray[$choices[2]]);
                     $sel = $curval == $cID ? " selected='selected' " : "";
                     $ret .= "<option value='{$cID}' {$sel}>{$cText}</option>\n";
                 }
                 $ret .= "</select>\n";
                 return $ret;
             } else {
                 return "";
             }
             break;
         case EUF_TEXTAREA:
             //textarea
             return "<textarea {$include} name='{$fname}' >{$curval}</textarea>";
             break;
         case EUF_DATE:
             //date
             return e107::getForm()->datepicker($fname, $curval, 'dateformat=yy-mm-dd');
             break;
         case EUF_LANGUAGE:
             // language
             require_once e_HANDLER . "file_class.php";
             $fl = new e_file();
             $lanlist = $fl->get_dirs(e_LANGUAGEDIR);
             sort($lanlist);
             $ret = "<select {$include} name='{$fname}'>\n";
             $ret .= "<option value=''>&nbsp;</option>\n";
             // ensures that the user chose it.
             foreach ($lanlist as $choice) {
                 $choice = trim($choice);
                 $sel = $curval == $choice || !USER && $choice == e_LANGUAGE ? " selected='selected' " : "";
                 $ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n";
             }
             $ret .= "</select>\n";
             break;
     }
     return $ret;
 }
Ejemplo n.º 13
0
|	$Revision$
|	$Date$
|	$Author$
+----------------------------------------------------------------------------+
*/
/*
Doesn't (can't) do everything, but sorts what it can.
Intended to be run from e107_files/utilities directory.
Usage: Just browse to this file and follow the prompts.
*/
require '../../class2.php';
require_once e_HANDLER . "file_class.php";
if (!check_class(e_UC_MAINADMIN)) {
    exit;
}
$fl = new e_file();
if ($pluginList = $fl->get_files(e_PLUGIN, "^plugin\\.php\$", "standard", 1)) {
    sort($pluginList);
}
foreach ($pluginList as $k => $p) {
    $pluginList[$k]['shortpath'] = substr(str_replace(e_PLUGIN, "", $p['path']), 0, -1);
}
function genFileSelect($name, $fl)
{
    $ret = "<select name='{$name}' class='tbox'>\n<option value=''>----</option>\n";
    foreach ($fl as $k => $f) {
        $ret .= "<option value='{$f['shortpath']}'>{$f['shortpath']}</option>\n";
    }
    $ret .= "</select>\n";
    return $ret;
}
Ejemplo n.º 14
0
require_once e_HANDLER . 'message_handler.php';
$emessage =& eMessage::getInstance();
//nothing wrong with doing it twice
include_lan(e_PLUGIN . 'import/languages/' . e_LANGUAGE . '_admin_import.php');
// Source DB types (i.e. CMS types) supported. Key of each element is the 'short code' for the type
$import_class_names = array();
// Title
$import_class_comment = array();
// Descriptive comment
$import_class_support = array();
// Array of data types supported
// Definitions of available areas to import
$db_import_blocks = array('users' => array('message' => LAN_CONVERT_25, 'classfile' => 'import_user_class.php', 'classname' => 'user_import'), 'news' => array('message' => LAN_CONVERT_28, 'classfile' => 'import_news_class.php', 'classname' => 'news_import'), 'page' => array('message' => "Pages", 'classfile' => 'import_page_class.php', 'classname' => 'page_import'), 'links' => array('message' => "Links", 'classfile' => 'import_links_class.php', 'classname' => 'links_import'), 'media' => array('message' => "Media", 'classfile' => 'import_media_class.php', 'classname' => 'media_import'), 'comments' => array('message' => "Comments"));
// See what DB-based imports are available (don't really want it here, but gets it into the header script)
require_once e_HANDLER . 'file_class.php';
$fl = new e_file();
$importClassList = $fl->get_files(e_PLUGIN . 'import/providers', "^.+?_import_class\\.php\$", "standard", 1);
foreach ($importClassList as $file) {
    $tag = str_replace('_class.php', '', $file['fname']);
    include_once $file['path'] . $file['fname'];
    // This will set up the variables
}
unset($importClassList);
unset($fl);
asort($import_class_names);
if (varset($_POST['import_source'])) {
    $import_source = varset($_POST['import_source'], 'csv');
    if (varset($_POST['classes_select'])) {
        $checked_class_list = implode(',', $_POST['classes_select']);
    }
    $import_delete_existing_data = varset($_POST['import_delete_existing_data'], 0);
Ejemplo n.º 15
0
$shop_pref = shop_pref();
// Display number of images header
// Build array with all images to choose from
$store_image_path = $shop_pref['store_image_path'];
require_once e_HANDLER . 'file_class.php';
$fl = new e_file();
if ($image_array = $fl->get_files(e_PLUGIN . "easyshop/" . $store_image_path, ".gif|.jpg|.png|.GIF|.JPG|.PNG", "standard", 2)) {
    sort($image_array);
}
$image_count = count($image_array);
$text .= "<tr>\r\n\t\t\t\t<td class='forumheader'>\r\n\t\t\t\t" . EASYSHOP_MONITOR_20 . "\t" . $store_image_path . "\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class='forumheader2'>";
// Display count number of images
$text .= $image_count;
$text .= "</td>\r\n\t\t\t</tr>";
// Display number of files in downloads folder
$fl = new e_file();
if ($downloads_array = $fl->get_files(e_PLUGIN . "easyshop/downloads", ".*", "standard", 2)) {
    sort($downloads_array);
}
$downloads_count = count($downloads_array);
$text .= "<tr>\r\n\t\t\t\t<td class='forumheader'>\r\n        " . EASYSHOP_MONITOR_41 . "\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class='forumheader2'>";
// Display count number of images
$text .= $downloads_count;
$text .= "</td>\r\n\t\t\t</tr>\r\n      </table>";
// Close the HTML wrap table
$text .= "</center></td></tr></table>";
// IPN addition - introduce basic reporting
$enable_ipn = $shop_pref['enable_ipn'];
if ($enable_ipn == '2') {
    // Only show report if IPN is activated
    $result_text = "";
Ejemplo n.º 16
0
$c = 0;
while ($files[$c]) {
    $img = strtolower(substr(strrchr($files[$c], "."), 1, 3));
    if (!$img || !preg_match("/css|exe|gif|htm|jpg|js|php|png|txt|xml|zip/i", $img)) {
        $img = "def";
    }
    $size = eHelper::parseMemorySize(filesize(e_BASE . $path . "/" . $files[$c]));
    $gen = new convert();
    $filedate = e107::getDate()->convert_date(filemtime(e_BASE . $path . "/" . $files[$c]), "forum");
    $text .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='center middle autocheck'>\n\t\t\t\t\t\t\t" . $frm->checkbox("selectedfile[{$c}]", 1, false, array('id' => false)) . "\n\t\t\t\t\t\t\t<input type='hidden' name='deleteconfirm[{$c}]' value='" . $path . $files[$c] . "' />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<img class='icon' src='" . $imagedir . $img . ".png' alt='" . $files[$c] . "' />\n\t\t\t\t\t\t\t<a href='" . e_SELF . "?" . $path . $files[$c] . "'>" . $files[$c] . "</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='right'>" . $size . "</td>\n\t\t\t\t\t\t<td class='right'>" . $filedate . "</td>\n\t\t\t\t\t</tr>\n\t";
    $c++;
}
$text .= "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<div class='buttons-bar left'>\n\t\t\t\t" . $frm->admin_button('check_all', 'jstarget:selectedfile', 'action', LAN_CHECKALL, array('id' => false)) . "\n\t\t\t\t" . $frm->admin_button('uncheck_all', 'jstarget:selectedfile', 'action', LAN_UNCHECKALL, array('id' => false)) . "\n\t";
if ($pubfolder || e_QUERY == "") {
    require_once e_HANDLER . "file_class.php";
    $fl = new e_file();
    $dl_dirlist = $fl->get_dirs(e_DOWNLOAD);
    $movechoice = array();
    $movechoice[] = e_DOWNLOAD;
    foreach ($dl_dirlist as $dirs) {
        $movechoice[] = e_DOWNLOAD . $dirs . "/";
    }
    sort($movechoice);
    $movechoice[] = e_FILE . "downloadimages/";
    if (e_QUERY != str_replace("../", "", e_UPLOAD)) {
        $movechoice[] = e_UPLOAD;
    }
    if (e_QUERY != str_replace("../", "", e_FILE . "downloadthumbs/")) {
        $movechoice[] = e_FILE . "downloadthumbs/";
    }
    if (e_QUERY != str_replace("../", "", e_FILE . "misc/")) {
Ejemplo n.º 17
0
 function menuScanMenus()
 {
     global $sql, $sql2;
     $efile = new e_file();
     $efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
     $fileList = $efile->get_files(e_PLUGIN, "_menu\\.php\$", 'standard', 2);
     foreach ($fileList as $file) {
         list($parent_dir) = explode('/', str_replace(e_PLUGIN, "", $file['path']));
         $file['path'] = str_replace(e_PLUGIN, "", $file['path']);
         $file['fname'] = str_replace(".php", "", $file['fname']);
         $valid_menu = FALSE;
         $existing_menu = $sql->db_Count("menus", "(*)", "WHERE menu_name='{$file['fname']}'");
         if (file_exists(e_PLUGIN . $parent_dir . '/plugin.xml') || file_exists(e_PLUGIN . $parent_dir . '/plugin.php')) {
             if (e107::isInstalled($parent_dir)) {
                 // Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed
                 $valid_menu = TRUE;
                 // Whether new or existing, include in list
                 //						echo "Include {$parent_dir}:{$file['fname']}<br />";
             }
         } else {
             $valid_menu = TRUE;
             //					echo "Default Include {$parent_dir}:{$file['fname']}<br />";
         }
         if ($valid_menu) {
             $menustr .= "&" . str_replace(".php", "", $file['fname']);
             if (!$existing_menu) {
                 $insert = array('menu_id' => 0, 'menu_name' => $file['fname'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $file['path'], 'menu_layout' => '', 'menu_parms' => '');
                 if ($sql->db_Insert("menus", $insert)) {
                     // Could do admin logging here - but probably not needed
                     $message .= MENLAN_10 . " - " . $file['fname'] . "<br />";
                 }
             }
         }
     }
     //Reorder all menus into 1...x order
     if (!is_object($sql2)) {
         $sql2 = new db();
     }
     // Shouldn't be needed
     foreach ($this->menu_areas as $menu_act) {
         if ($sql->db_Select("menus", "menu_id", "menu_location={$menu_act} ORDER BY menu_order ASC")) {
             $c = 1;
             while ($row = $sql->db_Fetch()) {
                 $sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=" . $row['menu_id']);
                 $c++;
             }
         }
     }
     $sql->db_Select("menus", "*", "menu_path NOT REGEXP('[0-9]+') ");
     while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch(MYSQL_NUM)) {
         if (stristr($menustr, $menu_name) === FALSE) {
             $sql2->db_Delete("menus", "menu_name='{$menu_name}'");
             $message .= MENLAN_11 . " - " . $menu_name . "<br />";
         }
     }
     $this->menuAddMessage($message, E_MESSAGE_INFO);
 }
Ejemplo n.º 18
0
function step11()
{
    $ns = e107::getRender();
    $stepCaption = 'Step 11: Delete old attachments';
    if (!isset($_POST['delete_orphans'])) {
        $text = "\n\t\tThe previous versions of the forum had difficulty deleting attachment files when posts or threads were deleted.\n\t\t<br />\n\t\tAs a result of this, there is a potential for numerous files to exist that do not point to anything. In this step\n\t\twe will try to identify these files and delete them.\n\t\t<br /><br />\n\t\t<form method='post'>\n\t\t<input class='btn btn-success' data-loading-text='Please wait...' type='submit' name='delete_orphans' value='Proceed with attachment deletion' />\n\t\t</form>\n\t\t<form method='post' action='" . e_SELF . "?step=12'>\n\t\t\t<input class='btn btn-primary' type='submit' name='nextStep[12]' value='Skip this step' />\n\t\t</form>\n\t\t";
        e107::getRender()->tablerender($stepCaption, $text);
        return;
    }
    global $forum;
    require_once e_HANDLER . 'file_class.php';
    $f = new e_file();
    $flist = $f->get_files(e_FILE . 'public', '_\\d+_FT\\d+_');
    $numFiles = count($flist);
    if ($numFiles) {
        if ($_POST['delete_orphans'] == 'Delete files') {
            //Do the deletion
            $success = 0;
            $failText = '';
            foreach ($flist as $file) {
                $fileName = e_FILE . 'public/' . $file['fname'];
                $r = unlink($fileName);
                if ($r) {
                    $success++;
                } else {
                    $failText .= "Deletion failed: {$file['fname']}<br />";
                }
            }
            if ($failText) {
                $failText = "<br /><br />The following failures occured: <br />" . $failText;
            }
            $text .= "\n\t\t\t\tSuccessfully removed {$success} orphaned files <br />\n\t\t\t\t{$failText}\n\t\t\t\t<br /><br />\n\t\t\t\t<form method='post' action='" . e_SELF . "?step=12'>\n\t\t\t\t<input class='btn' type='submit' name='nextStep[12]' value='Proceed to step 12' />\n\t\t\t\t</form>\n\t\t\t";
            $ns->tablerender($stepCaption, $text);
            return;
        }
        $text = "There were {$numFiles} orphaned files found<br /><br />";
        if ($_POST['delete_orphans'] == 'Show files' || $numFiles < 31) {
            $i = 1;
            foreach ($flist as $file) {
                $text .= $i++ . ') ' . $file['fname'] . '<br />';
            }
            $extra = '';
        } else {
            $extra = "<input class='btn' type='submit' name='delete_orphans' value='Show files' />&nbsp; &nbsp; &nbsp; &nbsp;";
        }
        $text .= "\n\t\t\t<br /><br />\n\t\t\t<form method='post'>\n\t\t\t{$extra}\n\t\t\t<input class='btn' type='submit' name='delete_orphans' value='Delete files' />\n\t\t\t</form>\n\t\t\t\n\t\t";
        $ns->tablerender($stepCaption, $text);
        return;
    } else {
        $text .= "\n\t\t\tThere were no orphaned files found <br />\n\t\t\t<br /><br />\n\t\t\t<form method='post' action='" . e_SELF . "?step=12'>\n\t\t\t<input class='btn' type='submit' name='nextStep[12]' value='Proceed to step 12' />\n\t\t\t</form>\n\t\t";
        $ns->tablerender($stepCaption, $text);
        return;
    }
}
Ejemplo n.º 19
0
function product_table($category_id, $item_id, $item_name, $item_description, $item_price, $sku_number, $shipping_first_item, $shipping_additional_item, $handling_override, $item_image, $item_active_status, $item_order, $prod_prop_1_id, $prod_prop_2_id, $prod_prop_3_id, $prod_prop_4_id, $prod_prop_5_id, $prod_discount_id, $image_array, $icon_width, $item_instock, $item_track_stock, $enable_ipn, $download_product, $download_filename, $store_image_path, $prod_promo_class, $item_minimum, $download_datasheet, $download_datasheet_filename, $item_quotation)
{
    $text .= "\n\t<table border='0' cellspacing='15' width='100%'>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<b>" . EASYSHOP_CONF_ITM_05 . ":</b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select class='tbox' name='category_id'>";
    $sql2 = new db();
    $sql2->db_Select(DB_TABLE_SHOP_ITEM_CATEGORIES, "*", "WHERE category_active_status = '2' ORDER BY category_order", false);
    // Select only active categories
    while ($row2 = $sql2->db_Fetch()) {
        if ($row2['category_id'] == $category_id) {
            $text .= "\n                    <option value='" . $row2['category_id'] . "' selected='selected'>" . $row2['category_name'] . "</option>";
        } else {
            $text .= "\n                    <option value='" . $row2['category_id'] . "'>" . $row2['category_name'] . "</option>";
        }
    }
    $text .= "\n        </select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<b>" . EASYSHOP_CONF_ITM_06 . ":</b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input class='tbox' size='25' type='text' name='item_name' value='" . $item_name . "' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='top'>\n\t\t\t\t<b>" . EASYSHOP_CONF_ITM_07 . ":</b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<textarea class='tbox' cols='50' rows='7' name='item_description' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>" . $item_description . "</textarea><br />" . display_help('helpa') . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<b>" . EASYSHOP_CONF_ITM_08 . ": <img src='" . e_IMAGE . "admin_images/docs_16.png' title='" . EASYSHOP_CONF_ITM_09 . "' alt='" . EASYSHOP_CONF_ITM_09 . "' /></b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input class='tbox' size='25' type='text' name='sku_number' value='" . $sku_number . "' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<b>" . EASYSHOP_CONF_ITM_10 . ":</b>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input class='tbox' size='7' type='text' name='item_price' value='" . $item_price . "' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<b>" . EASYSHOP_CONF_ITM_11 . ":</b>\n\t\t\t</td>\n\t\t\t<td valign='top'>\n\t\t\t\t<input class='tbox' size='7' type='text' name='shipping_first_item' value='" . $shipping_first_item . "' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2>\n\t\t\t\t<img src='" . e_IMAGE . "admin_images/docs_16.png' title='' alt='' /> " . EASYSHOP_CONF_ITM_12 . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<b>" . EASYSHOP_CONF_ITM_13 . ":</b>\n\t\t\t</td>\n\t\t\t<td valign='top'>\n\t\t\t\t<input class='tbox' size='7' type='text' name='shipping_additional_item' value='" . $shipping_additional_item . "' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2>\n\t\t\t\t<img src='" . e_IMAGE . "admin_images/docs_16.png' title='' alt='' /> " . EASYSHOP_CONF_ITM_12 . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<b>" . EASYSHOP_CONF_ITM_14 . ":</b>\n\t\t\t</td>\n\t\t\t<td valign='top'>\n\t\t\t\t<input class='tbox' size='7' type='text' name='handling_override' value='" . $handling_override . "' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>";
    // Show all available images
    $item_image = explode(",", $item_image);
    $arrayLength = count($item_image);
    $j = 1;
    for ($i = 0; $i < $arrayLength; $i++) {
        $text .= "\n  \t\t\t<td valign='top'>\n  \t\t\t\t<b>" . EASYSHOP_CONF_ITM_15 . " " . $j . ":</b>\n  \t\t\t</td>\n  \t\t\t<td valign='top'>\n\t\t\t\t<input type='text' size='25' class='tbox' id='item_image" . $i . "' name='item_image[]' value='" . $item_image[$i] . "' /> " . EASYSHOP_CONF_ITM_16 . "<br />";
        // Show icons with width 16 of the array of images and put name in variable $category_image
        foreach ($image_array as $icon) {
            $text .= "<a href=\"javascript:insertext('" . $icon['fname'] . "','item_image" . $i . "','itmimg')\"><img src='" . $icon['path'] . $icon['fname'] . "' style='border:0' alt='' width='" . $icon_width . "' /></a> ";
        }
        $text .= "</td></tr>";
        $j++;
    }
    // Add a blank input image field on top of the current list
    $j = $arrayLength + 1;
    $text .= "\n      \t\t<td valign='top'>\n  \t\t\t\t<b>" . EASYSHOP_CONF_ITM_15 . " " . $j . ":</b>\n  \t\t\t</td>\n  \t\t\t<td valign='top'>\n\t\t\t\t<input type='text' size='25' class='tbox' id='item_image" . $j . "' name='item_image[]' value='" . $item_image[$j] . "' /> " . EASYSHOP_CONF_ITM_16 . "<br />";
    // Show icons with width 16 of the array of images and put name in variable $category_image
    foreach ($image_array as $icon) {
        $text .= "<a href=\"javascript:insertext('" . $icon['fname'] . "','item_image" . $j . "','itmimg')\"><img src='" . $icon['path'] . $icon['fname'] . "' style='border:0' alt='' width='" . $icon_width . "' /></a> ";
    }
    $text .= "</td></tr>";
    // Show upload button
    $imgdirname = e_PLUGIN . "easyshop/" . $store_image_path;
    $text .= "<tr><td></td><td><br /><input class=\"button\" type=\"button\" name=\"request\" value=\"" . EASYSHOP_CONF_ITM_43 . "\" onclick=\"expandit(this)\" />\n  \t\t\t<div style=\"display:none;\">\n  \t\t\t<input class=\"tbox\" type=\"file\" name=\"file_userfile[]\" size=\"50\" />\n  \t\t\t<input class=\"button\" type=\"submit\" name=\"upload\" value=\"" . EASYSHOP_CONF_ITM_38 . "\" />\n  \t\t\t<input type=\"hidden\" name=\"upload_dir[]\" value=\"" . $imgdirname . "\" />\n  \t\t\t</div></td></tr>";
    $text .= "\n\t\t\t<tr>\n\t\t\t\t<td colspan=2>\n\t\t\t\t\t<img src='" . e_IMAGE . "admin_images/docs_16.png' title='' alt='' /> " . EASYSHOP_CONF_ITM_17 . "\n\t\t\t\t</td>\n\t\t\t</tr>\n    <tr>\n      <td>\n        <b>" . EASYSHOP_CONF_ITM_18 . "</b>\n      </td>\n      <td>";
    // Display the check box for active status (active = 2)
    if ($item_active_status == 2) {
        $text .= "<input type='checkbox' name='item_active_status' value='2' checked='checked' />";
    } else {
        $text .= "<input type='checkbox' name='item_active_status' value='1' />";
    }
    $text .= "\n      </td>\n    </tr>";
    for ($n = 1; $n < 6; $n++) {
        $fpropname = "prod_prop_" . $n . "_id";
        $text .= "\n    <tr>\n      <td>\n        <b>" . EASYSHOP_CONF_ITM_28 . " " . $n . "</b>\n      </td>\n      <td>\n\t\t<select class='tbox' name='{$fpropname}'>\n        <option value='' selected='selected'></option>";
        $sql3 = new db();
        $sql3->db_Select(DB_TABLE_SHOP_PROPERTIES, "*", " ORDER BY prop_display_name", false);
        // Select all properties
        while ($row3 = $sql3->db_Fetch()) {
            //$positioner = ${"prod_prop_".$n."_id"};
            // Show display_name and first 10 characters of the string; so it is no problem to select from same name e.g. 'Color' with different property list
            if ($row3['property_id'] == ${"prod_prop_" . $n . "_id"}) {
                $text .= "<option value='" . $row3['property_id'] . "' selected='selected'>" . $row3['prop_display_name'] . ": " . substr($row3['prop_list'], 0, 10) . (strlen($row3['prop_list']) ? "..." : "") . "</option>";
            } else {
                $text .= "<option value='" . $row3['property_id'] . "'>" . $row3['prop_display_name'] . ": " . substr($row3['prop_list'], 0, 10) . (strlen($row3['prop_list']) ? "..." : "") . "</option>";
            }
        }
        $text .= "\n\t\t</select>\n\t  </td>\n    </tr>";
    }
    // End of For loop for properties
    // Display discount
    $text .= "\n    <tr>\n      <td>\n        <b>" . EASYSHOP_CONF_ITM_29 . "</b>\n      </td>\n      <td>\n\t\t<select class='tbox' name='prod_discount_id'>\n        <option value='' selected='selected'></option>";
    $sql4 = new db();
    $sql4->db_Select(DB_TABLE_SHOP_DISCOUNT, "*", " ORDER BY discount_name", false);
    // Select all discounts
    while ($row4 = $sql4->db_Fetch()) {
        if ($row4['discount_id'] == $prod_discount_id) {
            $text .= "<option value='" . $row4['discount_id'] . "' selected='selected'>" . $row4['discount_name'] . "</option>";
        } else {
            $text .= "<option value='" . $row4['discount_id'] . "'>" . $row4['discount_name'] . "</option>";
        }
    }
    $text .= "\n        </select>";
    if (trim($prod_discount_id) > "") {
        $sql5 = new db();
        $sql5->db_Select(DB_TABLE_SHOP_DISCOUNT, "*", "discount_id = " . $prod_discount_id);
        // Select the selected discount
        if ($row5 = $sql5->db_Fetch()) {
            if ($row5['discount_valid_till'] == 0) {
                // Set the end date to maximum if not filled in
                $row5['discount_valid_till'] = 9999999999.0;
            }
            $today = time();
            // $text .= "-- Today = $today Discount_valid_till = ".$row5['discount_valid_till']." Discount_valid_from = ".$row5['discount_valid_from']."--"; // Some debug info
            if ($today > $row5['discount_valid_till']) {
                $text .= "&nbsp;" . EASYSHOP_CONF_ITM_30 . " (" . date("Y/m/d", $row5['discount_valid_till']) . ")";
            }
            if ($today < $row5['discount_valid_from']) {
                $text .= "&nbsp;" . EASYSHOP_CONF_ITM_31 . " (" . date("Y/m/d", $row5['discount_valid_from']) . ")";
            }
        }
    }
    $text .= "\n      </td></tr>";
    // IPN addition - include track stock option in form
    $item_track_stock != '2' ? $trackstock_text = " value = '1' " : ($trackstock_text = " value = '2' checked='checked' ");
    $enable_ipn != '2' ? $enabled_text = " disabled = 'true' " : ($enabled_text = "");
    $text .= "\n    <tr>\n        <td>\n            <b>" . EASYSHOP_CONF_ITM_33 . "</b><br />";
    if ($enable_ipn != '2') {
        $text .= EASYSHOP_CONF_ITM_34;
    }
    $text .= "\n        </td>\n\n        <td valign='top'>\n            <input type='checkbox' name='item_track_stock' {$trackstock_text} {$enabled_text} />\n        </td>\n        </tr>\n        <tr>\n        <td>\n            <b>" . EASYSHOP_CONF_ITM_35 . "</b><br />";
    if ($enable_ipn != '2') {
        $text .= EASYSHOP_CONF_ITM_34;
    }
    $text .= "\n        </td>\n        <td valign='top'>\n            <input class='tbox' size='7' type='text' name='item_instock' value='" . $item_instock . "' {$enabled_text} />\n        </td>\n    </tr>\n\t<tr>\n        <td>\n            <b>" . EASYSHOP_CONF_ITM_47 . "</b><br />";
    if ($enable_ipn != '2') {
        $text .= EASYSHOP_CONF_ITM_34;
    }
    $text .= "\n        </td>\n        <td valign='top'>\n            <input class='tbox' size='7' type='text' name='item_minimum' value='" . $item_minimum . "' {$enabled_text} />\n        </td>\n    </tr>";
    // Download product: only if IPN is activated
    $text .= "\n    <tr><td>\n    <b>" . EASYSHOP_CONF_ITM_36 . "</b><br />\n    ";
    if ($enable_ipn != '2') {
        $text .= EASYSHOP_CONF_ITM_34;
    }
    $download_product != '2' ? $download_product_text = " value = '1' " : ($download_product_text = " value = '2' checked='checked' ");
    $text .= "\n    </td><td>\n           <input type='checkbox' name='download_product' {$download_product_text} {$enabled_text} />\n    </td></tr>";
    if (strlen(trim($download_filename)) == 0) {
        // Show upload button and select box when no download file is stored yet
        $text .= "\n      <tr><td>\n      </td><td>";
        $dirname = e_PLUGIN . "easyshop/downloads";
        $text .= "<input class=\"button\" type=\"button\" name=\"request\" value=\"" . EASYSHOP_CONF_ITM_37 . "\" onclick=\"expandit(this)\" />\n  \t\t\t<div style=\"display:none;\">\n  \t\t\t<input class=\"tbox\" type=\"file\" name=\"file_userfile[]\" size=\"50\" />\n  \t\t\t<input class=\"button\" type=\"submit\" name=\"upload\" value=\"" . EASYSHOP_CONF_ITM_38 . "\" />\n  \t\t\t<input type=\"hidden\" name=\"upload_dir[]\" value=\"" . $dirname . "\" />\n  \t\t\t</div>";
        $text .= "\n      </td></tr>";
        // Show select box when no download file is stored yet
        require_once e_HANDLER . 'file_class.php';
        $dl = new e_file();
        $rejecfiles = array('$.', '$..', '/', 'CVS', 'thumbs.db', '*._$', "thumb_", 'index', 'null*');
        $downloadlist = $dl->get_files(e_PLUGIN . "easyshop/downloads", $rejecthumb);
        $text .= "\n      <tr><td>\n           <b>" . EASYSHOP_CONF_ITM_39 . "</b>\n      </td><td>\n  \t\t   <select name='download_filename' class='tbox'>\n  \t\t\t<option value=''>&nbsp;</option>\n  \t\t\t";
        foreach ($downloadlist as $file) {
            $extension = strrpos($file['fname'], ".") ? substr($file['fname'], strrpos($file['fname'], ".")) : "";
            if (strlen($extension) > 0) {
                // Suppress files without extension
                if ($file['fname'] == $download_filename) {
                    $selected_text = "selected='selected'";
                } else {
                    $selected_text = "";
                }
                $text .= "<option value='" . $file['fname'] . "' {$selected_text}>" . $file['fname'] . "</option>";
            }
        }
        $text .= "</select>";
    } else {
        // Show stored download file
        $text .= "\n      <tr><td>\n           <b>" . EASYSHOP_CONF_ITM_40 . "</b><br />\n           " . EASYSHOP_CONF_ITM_41 . "\n      </td><td>\n        <input name='download_filename' value='" . $download_filename . "' disabled = 'true' />\n      ";
    }
    // Show scramled file info
    if (strlen($download_filename) > 0) {
        $scramled_name = $item_id . $download_filename;
        $text .= "<br />\n  \t\t" . EASYSHOP_CONF_ITM_42 . ": " . md5($scramled_name) . "<br />";
    }
    $text .= "<input type='hidden' name='stored_download_filename' value='" . $download_filename . "' />\n    </td></tr>\n    ";
    // Promotion class: only if IPN is activated
    $text .= "\n    <tr><td>\n    <b>" . EASYSHOP_CONF_ITM_45 . "</b><br />\n    ";
    if ($enable_ipn != '2') {
        $text .= EASYSHOP_CONF_ITM_34;
    }
    $download_product != '2' ? $download_product_text = " value = '1' " : ($download_product_text = " value = '2' checked='checked' ");
    require_once e_HANDLER . 'userclass_class.php';
    $text .= "\n    </td><td>\n\t\t\t" . r_userclass("prod_promo_class", $prod_promo_class, "off", "nobody,classes") . "\t\t   \n   </td></tr>";
    // NEW: START v1.6m
    // Datasheet functionality
    $text .= "\n    <tr><td>\n\t\t<b>" . EASYSHOP_CONF_ITM_56 . "</b><br /> ";
    $download_datasheet != '2' ? $download_datasheet_text = " value = '1' " : ($download_datasheet_text = " value = '2' checked='checked' ");
    $text .= "\n    </td><td>\n\t\t<input type='checkbox' name='download_datasheet' {$download_datasheet_text} />\n    </td></tr>";
    if (strlen(trim($download_datasheet_filename)) == 0) {
        // Show upload button and select box when no datasheet file is stored yet
        $text .= "\n\t<tr><td>\n\t</td><td>";
        $dirname = e_PLUGIN . "easyshop/datasheets";
        $text .= "<input class=\"button\" type=\"button\" name=\"request\" value=\"" . EASYSHOP_CONF_ITM_57 . "\" onclick=\"expandit(this)\" />\n  \t\t\t<div style=\"display:none;\">\n  \t\t\t<input class=\"tbox\" type=\"file\" name=\"file_userfile[]\" size=\"50\" />\n  \t\t\t<input class=\"button\" type=\"submit\" name=\"upload\" value=\"" . EASYSHOP_CONF_ITM_58 . "\" />\n  \t\t\t<input type=\"hidden\" name=\"upload_dir[]\" value=\"" . $dirname . "\" />\n  \t\t\t</div>";
        $text .= "\n\t</td></tr>";
        // Show select box when no datasheet file is stored yet
        require_once e_HANDLER . 'file_class.php';
        $dl = new e_file();
        $rejecfiles = array('$.', '$..', '/', 'CVS', 'thumbs.db', '*._$', "thumb_", 'index', 'null*');
        $datasheetlist = $dl->get_files(e_PLUGIN . "easyshop/datasheets", $rejecthumb);
        $text .= "\n\t<tr><td>\n\t\t<b>" . EASYSHOP_CONF_ITM_59 . "</b>\n\t</td><td>\n\t\t<select name='download_datasheet_filename' class='tbox'>\n\t\t\t<option value=''>&nbsp;</option>";
        foreach ($datasheetlist as $file) {
            $extension = strrpos($file['fname'], ".") ? substr($file['fname'], strrpos($file['fname'], ".")) : "";
            if (strlen($extension) > 0) {
                // Suppress files without extension
                if ($file['fname'] == $download_datasheet_filename) {
                    $download_datasheet_selected_text = "selected='selected'";
                } else {
                    $download_datasheet_selected_text = "";
                }
                $text .= "<option value='" . $file['fname'] . "' {$download_datasheet_selected_text}>" . $file['fname'] . "</option>";
            }
        }
        $text .= "\n\t\t</select>\n\t</td></tr>";
    } else {
        // Show stored datasheet file
        $text .= "\n\t<tr><td>\n\t\t<b>" . EASYSHOP_CONF_ITM_60 . "</b><br />\n\t\t" . EASYSHOP_CONF_ITM_61 . "\n\t</td><td>\n\t\t<input name='download_datasheet_filename' value='" . $download_datasheet_filename . "' disabled = 'true' />\n\t</td></tr>";
    }
    // Display item_quotation checkbox
    $text .= "\n    <tr><td>\n\t\t<b>" . EASYSHOP_CONF_ITM_62 . "</b><br /> ";
    $item_quotation != '2' ? $item_quotation_text = " value = '1' " : ($item_quotation_text = " value = '2' checked='checked' ");
    $text .= "\n    </td><td>\n\t\t<input type='checkbox' name='item_quotation' {$item_quotation_text} />\n    </td></tr>";
    // NEW: END v1.6m
    $text .= "\n\t</table>";
    return $text;
}
Ejemplo n.º 20
0
                        exit;
                    }
                }
            }
        }
    }
}
// Build array with all images to choose from
$sql = new db();
$sql->db_Select(DB_TABLE_SHOP_PREFERENCES);
while ($row = $sql->db_Fetch()) {
    $store_image_path = $row['store_image_path'];
    $icon_width = $row['icon_width'];
}
require_once e_HANDLER . 'file_class.php';
$fl = new e_file();
if ($image_array = $fl->get_files(e_PLUGIN . "easyshop/" . $store_image_path, ".gif|.jpg|.png|.GIF|.JPG|.PNG", "standard", 2)) {
    sort($image_array);
}
if ($icon_width == '' or $icon_width < 1) {
    $icon_width = 16;
}
// Default of icon width is 16 pixels width
// Edit or Maintain a single category
if ($_GET['edit_main_category'] == 1) {
    //*
    $sql->db_Select(DB_TABLE_SHOP_MAIN_CATEGORIES, "*", "main_category_id=" . intval($_GET['main_category_id']));
    while ($row = $sql->db_Fetch()) {
        $main_category_id = $row['main_category_id'];
        $main_category_name = $row['main_category_name'];
        $main_category_description = $row['main_category_description'];
Ejemplo n.º 21
0
 function show_existing_mirrors()
 {
     global $sql, $ns, $tp, $sub_action, $id, $delete, $del_id, $admin_log;
     if ($delete == "mirror") {
         admin_update($sql->db_Delete("download_mirror", "mirror_id=" . $del_id), delete, DOWLAN_135);
         $admin_log->log_event('DOWNL_14', 'ID: ' . $del_id, E_LOG_INFORMATIVE, '');
     }
     if (!$sql->db_Select("download_mirror")) {
         $text = "<div style='text-align:center;'>" . DOWLAN_144 . "</div>";
         // No mirrors defined yet
     } else {
         $text = "<div style='text-align:center'>\n\t\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "'>\n\t\t\t<table style='" . ADMIN_WIDTH . "' class='fborder'>\n\t\t\t<tr>\n\t\t\t<td style='width: 10%; text-align: center;' class='forumheader'>ID</td>\n\t\t\t<td style='width: 30%;' class='forumheader'>" . DOWLAN_12 . "</td>\n\t\t\t<td style='width: 30%;' class='forumheader'>" . DOWLAN_136 . "</td>\n\t\t\t<td style='width: 30%; text-align: center;' class='forumheader'>" . LAN_OPTIONS . "</td>\n\t\t\t</tr>\n\t\t\t";
         $mirrorList = $sql->db_getList();
         foreach ($mirrorList as $mirror) {
             extract($mirror);
             $text .= "\n\n\t\t\t\t<tr>\n\t\t\t\t<td style='width: 10%; text-align: center;' class='forumheader3'>{$mirror_id}</td>\n\t\t\t\t<td style='width: 30%;' class='forumheader3'>" . $tp->toHTML($mirror_name) . "</td>\n\t\t\t\t<td style='width: 30%;' class='forumheader3'>" . ($mirror_image ? "<img src='" . e_FILE . "downloadimages/" . $mirror_image . "' alt='' />" : DOWLAN_28) . "</td>\n\t\t\t\t<td style='width: 30%; text-align: center;' class='forumheader3'>\n\t\t\t\t<a href='" . e_SELF . "?mirror.edit.{$mirror_id}'>" . ADMIN_EDIT_ICON . "</a>\n\t\t\t\t<input type='image' title='" . LAN_DELETE . "' name='delete[mirror_{$mirror_id}]' src='" . ADMIN_DELETE_ICON_PATH . "' onclick=\"return jsconfirm('" . DOWLAN_137 . " [ID: {$mirror_id} ]')\"/>\n\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t";
         }
         $text .= "</table></form></div>";
     }
     $ns->tablerender(DOWLAN_138, $text);
     require_once e_HANDLER . "file_class.php";
     $fl = new e_file();
     $imagelist = $fl->get_files(e_FILE . 'downloadimages/');
     if ($sub_action == "edit" && !defined("SUBMITTED")) {
         $sql->db_Select("download_mirror", "*", "mirror_id='" . intval($id) . "' ");
         $mirror = $sql->db_Fetch();
         extract($mirror);
         $edit = TRUE;
     } else {
         unset($mirror_name, $mirror_url, $mirror_image, $mirror_location, $mirror_description);
         $edit = FALSE;
     }
     $text = "<div style='text-align:center'>\n\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='dataform'>\n\n\t\t<table style='" . ADMIN_WIDTH . "' class='fborder'>\n\n\t\t<tr>\n\t\t<td style='width: 30%;' class='forumheader3'>" . DOWLAN_12 . "</td>\n\t\t<td style='width: 70%;' class='forumheader3'>\n\t\t<input class='tbox' type='text' name='mirror_name' size='60' value='{$mirror_name}' maxlength='200' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width: 30%;' class='forumheader3'>" . DOWLAN_139 . "</td>\n\t\t<td style='width: 70%;' class='forumheader3'>\n\t\t<input class='tbox' type='text' name='mirror_url' size='70' value='{$mirror_url}' maxlength='255' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width: 30%;' class='forumheader3'>" . DOWLAN_136 . "</td>\n\t\t<td style='width: 70%;' class='forumheader3'>\n\t\t<input class='tbox' type='text' id='mirror_image' name='mirror_image' size='60' value='{$mirror_image}' maxlength='200' />\n\n\n\t\t<br /><input class='button' type ='button' style='cursor:pointer' size='30' value='" . DOWLAN_42 . "' onclick='expandit(this)' />\n\t\t<div id='imagefile' style='display:none;{head}'>";
     $text .= DOWLAN_140 . "<br /><br />";
     foreach ($imagelist as $file) {
         $text .= "<a href=\"javascript:insertext('" . $file['fname'] . "','mirror_image','imagefile')\"><img src='" . e_FILE . "downloadimages/" . $file['fname'] . "' alt='' /></a> ";
     }
     $text .= "</div>\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width: 30%;' class='forumheader3'>" . DOWLAN_141 . "</td>\n\t\t<td style='width: 70%;' class='forumheader3'>\n\t\t<input class='tbox' type='text' name='mirror_location' size='60' value='{$mirror_location}' maxlength='200' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width: 30%;' class='forumheader3'>" . DOWLAN_18 . "</td>\n\t\t<td style='width: 70%;' class='forumheader3'>\n\t\t<textarea class='tbox' name=' mirror_description' cols='70' rows='6'>{$mirror_description}</textarea>\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td colspan='2' class='forumheader' style='text-align:center;'>\n\t\t" . ($edit ? "<input class='button' type='submit' name='submit_mirror' value='" . DOWLAN_142 . "' /><input type='hidden' name='id' value='{$mirror_id}' />" : "<input class='button' type='submit' name='submit_mirror' value='" . DOWLAN_143 . "' />") . "\n\t\t</td>\n\t\t</tr>\n\n\t\t</table>\n\t\t</form>\n\t\t</div>";
     $caption = $edit ? DOWLAN_142 : DOWLAN_143;
     $ns->tablerender($caption, $text);
 }
Ejemplo n.º 22
0
// #### new: news archive ---------------------------------------------------------------------------------------------
if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) {
    show_newsarchive($newsAr, $interval);
}
// #### END -----------------------------------------------------------------------------------------------------------
if ($action != "item") {
    if (is_numeric($action)) {
        $action = "";
    }
    //	$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
    //	$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
    //	echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
}
if (is_dir("remotefile")) {
    require_once e_HANDLER . "file_class.php";
    $file = new e_file();
    //	$reject = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*', 'Readme.txt');
    //	$crem = $file -> get_files(e_BASE."remotefile", "", $reject);
    $crem = $file->get_files(e_BASE . "remotefile", '~Readme\\.txt');
    if (count($crem)) {
        foreach ($crem as $loadrem) {
            if (strstr($loadrem['fname'], "load_")) {
                require_once e_BASE . "remotefile/" . $loadrem['fname'];
            }
        }
    }
}
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 2) {
    require_once e_PLUGIN . "newforumposts_main/newforumposts_main.php";
}
render_newscats();
Ejemplo n.º 23
0
 *	@version 	$Id$;
 *
 *	@todo language file issues to resolve
 */
require_once '../../class2.php';
if (!getperms('D')) {
    header('location:' . e_BASE . 'index.php');
    exit;
}
$e_sub_cat = 'banner';
require_once e_ADMIN . 'auth.php';
require_once e_HANDLER . 'form_handler.php';
$frm = new e_form();
require_once e_HANDLER . 'userclass_class.php';
require_once e_HANDLER . 'file_class.php';
$fl = new e_file();
require_once e_HANDLER . 'message_handler.php';
$emessage = eMessage::getInstance();
//@FIXME mix up in banner language files
//include_//lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_menus.php');
include_lan(e_PLUGIN . 'banner/languages/' . e_LANGUAGE . '_admin_banner.php');
include_lan(e_PLUGIN . 'banner/languages/' . e_LANGUAGE . '_menu_banner.php');
if (e_QUERY) {
    list($action, $sub_action, $id) = explode('.', e_QUERY);
}
$images = $fl->get_files(e_IMAGE . 'banners/', '', 'standard');
$menu_pref = e107::getConfig('menu')->getPref('');
if (isset($_POST['update_menu'])) {
    $temp['banner_caption'] = $e107->tp->toDB($_POST['banner_caption']);
    $temp['banner_amount'] = intval($_POST['banner_amount']);
    $temp['banner_rendertype'] = intval($_POST['banner_rendertype']);