コード例 #1
0
function Modes()
{
    $mode = getMode();
    $output = "<option value=\"0\">S&eacute;lectionner</option>";
    switch ($mode) {
        case "1":
        case "15":
            $output .= "<option value=\"22cf\">CF 100% CPS</option>";
            break;
        case "3":
        case "17":
            $output .= "<option value=\"22bc\">2/2 Bourse Commune</option>";
            break;
        case "2":
        case "16":
            $output .= "<option value=\"num\">Num&eacute;raire</option>";
            $output .= "<option value=\"chq\">Ch&egrave;que</option>";
            $output .= "<option value=\"vir\">Virement</option>";
            $output .= "<option value=\"tsr\">Tr&eacute;sor</option>";
            $output .= "<option value=\"mnd\">Mandat</option>";
            $output .= "<option value=\"tpe\">TPE</option>";
            $output .= "<option value=\"12cf\">CF 50% CPS</option>";
            break;
        case "4":
        case "18":
            $output .= "<option value=\"num\">Num&eacute;raire</option>";
            $output .= "<option value=\"chq\">Ch&egrave;que</option>";
            $output .= "<option value=\"vir\">Virement</option>";
            $output .= "<option value=\"tsr\">Tr&eacute;sor</option>";
            $output .= "<option value=\"mnd\">Mandat</option>";
            $output .= "<option value=\"tpe\">TPE</option>";
            $output .= "<option value=\"12bc\">1/2 Bourse Commune</option>";
            break;
        default:
            $output .= "<option value=\"num\">Num&eacute;raire</option>";
            $output .= "<option value=\"chq\">Ch&egrave;que</option>";
            $output .= "<option value=\"vir\">Virement</option>";
            $output .= "<option value=\"tsr\">Tr&eacute;sor</option>";
            $output .= "<option value=\"mnd\">Mandat</option>";
            $output .= "<option value=\"tpe\">TPE</option>";
    }
    return $output;
}
コード例 #2
0
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Kermert is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Kermert; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# ***** END LICENSE BLOCK *****
include_once dirname(__FILE__) . '/includes/prepend.php';
include_once dirname(__FILE__) . '/includes/layout.php';
$photoblog = new xkermert($con);
if (km_varmode == 'path_info') {
    $params = $_SERVER['PATH_INFO'];
} else {
    $params = $_SERVER['QUERY_STRING'];
}
$params = explode('/', $params);
array_shift($params);
//print_r($params);
$page_mode = getMode($params);
print_r($page_mode);
$mode = $page_mode['page'];
$comments_allowed = $page_mode['comments'];
$photoblog->init($page_mode);
include_once km_appdir . km_themesdir . km_theme . '/template.php';
//phpinfo();
コード例 #3
0
ファイル: index.php プロジェクト: casan/eccube-2_13
/**
 * モジュール一覧を出力するテストスクリプト
 *
 * 新しいモジュールを管理画面に表示する場合は、下の配列の値を書き換える.
 * 追加する際には、新しく配列を追加すればよい.
 *
 * installed_flgとdownload_flgを1にすると「設定」ボタンが出るので、
 * data/downloads/module/mdl_***にモジュールが設置してあれば、
 * ダウンロードしなくてもすぐに使用可能な状態となります.
 * (codeがモジュールファイル設定先になります)
 *
 * product_idは重複しない値を設定してください.
 * 本番商品との重複を避けるためにも大きめの値を設定しておくとよいかもしれません.
 */
$GLOBALS['productsList'] = array(array('name' => 'サンプルモジュール', 'code' => 'mdl_sample', 'main_list_comment' => 'モジュール開発テスト用です。', 'main_list_image' => 'no_image.jpg', 'version' => '開発版', 'last_update_date' => '9999/99/99 00:00:00', 'product_id' => '100', 'status' => '使用可能です', 'installed_flg' => '1', 'installed_version' => '開発版', 'download_flg' => '1', 'version_up_flg' => '0'));
switch (getMode()) {
    case 'products_list':
        displayProductsList();
        break;
    default:
        displayProductsList();
        break;
}
/**
 * モード取得.
 *
 * @return string
 */
function getMode()
{
    if (isset($_GET['mode'])) {
コード例 #4
0
    protected function docs()
    {
        if ($this->method == 'GET') {
            if (!array_key_exists('token', $this->request)) {
                logApiRequests('endpoint: ' . $this->request['request'] . ';  No UserIDHash povided; Api Key : ' . (array_key_exists('apiKey', $this->request) ? $this->request['apiKey'] : 'No API key given') . '; App version : ' . (array_key_exists('appVersion', $this->request) ? $this->request['appVersion'] : 'No App version given') . '; App platform : ' . (array_key_exists('appPlatform', $this->request) ? $this->request['appPlatform'] : 'No App plattform given'));
                throw new Exception('No User Token provided');
            }
            $u = getHash('SELECT * FROM ' . CUSTOMER_TABLE . ' WHERE Password!="" AND LoginDenied=0 AND App_UserIDHash="' . $GLOBALS['DB_WE']->escape($this->request['token']) . '"', null, MYSQL_ASSOC);
            if (empty($u)) {
                logApiRequests('endpoint: ' . $this->request['request'] . ';  Token : Invalid User Token; apiKey : ' . (array_key_exists('apiKey', $this->request) ? $this->request['apiKey'] : 'No API key given') . '; App version : ' . (array_key_exists('appVersion', $this->request) ? $this->request['appVersion'] : 'No App version given') . '; App platform : ' . (array_key_exists('appPlatform', $this->request) ? $this->request['appPlatform'] : 'No App plattform given'));
                throw new Exception('Invalid User Token');
            }
            $_SESSION['webuser'] = $u;
            $_SESSION['webuser']['registered'] = true;
            switch ($this->verb) {
                case 'list':
                    we_tag('navigation', array('navigationname' => 'bookList', 'parentid' => 69));
                    $GLOBALS['books'] = array();
                    we_tag('navigationEntry', array('type' => 'folder', 'navigationname' => 'bookList'));
                    we_tag('navigationEntry', array('type' => 'item', 'navigationname' => 'bookList'));
                    we_tag('navigationEntry', array('type' => 'folder', 'navigationname' => 'bookList', 'level' => 1), "<?php \n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'id','to'=>'global','nameto'=>'bookID')));\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'text','to'=>'global','nameto'=>'bookName')));\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'position','to'=>'global','nameto'=>'bookPosition')));\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'href','to'=>'global','nameto'=>'bookHref')));\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'icon','to'=>'global','nameto'=>'bookCover')));\n\t\t\t\t\t\t\t\tif(!empty(\$GLOBALS['bookHref'])){\n\t\t\t\t\t\t\t\t\t\$GLOBALS['books'][\$GLOBALS['bookID']]['name'] = \$GLOBALS['bookName'];\n\t\t\t\t\t\t\t\t\t\$GLOBALS['books'][\$GLOBALS['bookID']]['position'] = \$GLOBALS['bookPosition'];\n\t\t\t\t\t\t\t\t\t\$GLOBALS['books'][\$GLOBALS['bookID']]['cover'] = \$GLOBALS['bookCover'];\n\t\t\t\t\t\t\t\t}\n\t?>");
                    we_tag('navigationWrite', array('navigationname' => 'bookList'));
                    if (count($GLOBALS['books']) < 1) {
                        logApiRequests('endpoint: ' . $this->request['request'] . ';  No training material found; Token : ' . (!array_key_exists('token', $this->request) ? 'No UserIDHash given' : $this->request['token']) . '; apiKey : ' . (array_key_exists('apiKey', $this->request) ? $this->request['apiKey'] : 'No API key given') . '; App version : ' . (array_key_exists('appVersion', $this->request) ? $this->request['appVersion'] : 'No App version given') . '; App platform : ' . (array_key_exists('appPlatform', $this->request) ? $this->request['appPlatform'] : 'No App plattform given'));
                        throw new Exception('No training material found');
                    }
                    $bookList = array();
                    $cnt = 0;
                    foreach ($GLOBALS['books'] as $bookID => $bookArray) {
                        $bookList[$cnt]['bookid'] = $bookID;
                        $bookList[$cnt]['title'] = $bookArray['name'];
                        $bookList[$cnt]['cover'] = isset($_SERVER['HTTP_HOST']) && !empty($bookArray['cover']) && $bookArray['cover'] != '/' ? 'http://' . $_SERVER['HTTP_HOST'] . $bookArray['cover'] : '';
                        $bookList[$cnt]['position'] = $bookArray['position'];
                        $bookList[$cnt]['lastmodified'] = getLastModifiedTimestamp($bookID);
                        $cnt++;
                    }
                    logApiRequests('endpoint: ' . $this->request['request'] . '; Token : ' . (!array_key_exists('token', $this->request) ? 'No UserIDHash given' : $this->request['token']) . '; User : '******'webuser']['Username'] . '; List of training material' . implode(',', $bookList) . '; apiKey : ' . (array_key_exists('apiKey', $this->request) ? $this->request['apiKey'] : 'No API key given') . '; App version : ' . (array_key_exists('appVersion', $this->request) ? $this->request['appVersion'] : 'No App version given') . '; App platform : ' . (array_key_exists('appPlatform', $this->request) ? $this->request['appPlatform'] : 'No App plattform given'));
                    unset($GLOBALS['books']);
                    unset($_SESSION['webuser']);
                    return $bookList;
                    /**
                     * return content training material
                     * @param $this->args[0] = ID of specific training material (ID from navigation modul)
                     */
                /**
                 * return content training material
                 * @param $this->args[0] = ID of specific training material (ID from navigation modul)
                 */
                case 'get':
                    ini_set('memory_limit', '256M');
                    if (empty($this->args[0]) || !is_numeric($this->args[0])) {
                        logApiRequests('endpoint: ' . $this->request['request'] . '; Invalid DocID; Token' . (!array_key_exists('token', $this->request) ? 'No UserIDHash given' : $this->request['token']) . '; apiKey : ' . (array_key_exists('apiKey', $this->request) ? $this->request['apiKey'] : 'No API key given') . '; App version : ' . (array_key_exists('appVersion', $this->request) ? $this->request['appVersion'] : 'No App version given') . '; App platform : ' . (array_key_exists('appPlatform', $this->request) ? $this->request['appPlatform'] : 'No App plattform given'));
                        throw new Exception('Invalid Doc ID');
                    }
                    $this->user->initUserByHash($this->request['token']);
                    logApiRequests('endpoint: ' . $this->request['request'] . '; Token : ' . (!array_key_exists('token', $this->request) ? 'No UserIDHash given' : $this->request['token']) . '; User : '******'; apiKey : ' . (array_key_exists('apiKey', $this->request) ? $this->request['apiKey'] : 'No API key given') . '; App version : ' . (array_key_exists('appVersion', $this->request) ? $this->request['appVersion'] : 'No App version given') . '; App platform : ' . (array_key_exists('appPlatform', $this->request) ? $this->request['appPlatform'] : 'No App plattform given'));
                    /**
                     *first, we create temp file for JSON Objet
                     * TEMP_DIR = webEdition Temp-Dir
                     */
                    $tempDir = is_dir($_SERVER['DOCUMENT_ROOT'] . TEMP_DIR) ? $_SERVER['DOCUMENT_ROOT'] . TEMP_DIR : sys_get_temp_dir();
                    $tempFile = tempnam($tempDir, $this->user->Surname . "_" . $this->args[0] . "_");
                    //create user specific temp file for JSON Object
                    we_tag('navigation', array('navigationname' => 'book', 'parentid' => $this->args[0]));
                    $GLOBALS['books'] = array();
                    we_tag('navigationEntry', array('type' => 'folder', 'navigationname' => 'book'), "<?php\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'id','to'=>'global','nameto'=>'bookID')));\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'text','to'=>'global','nameto'=>'bookName')));\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'position','to'=>'global','nameto'=>'bookPosition')));\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'level','to'=>'global','nameto'=>'bookLevel')));\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationField',array('name'=>'href','to'=>'global','nameto'=>'bookLink')));\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\$GLOBALS['books'][\$GLOBALS['bookID']]['title'] = \$GLOBALS['bookName']; \n\t\t\t\t\t\t\t\t\$GLOBALS['books'][\$GLOBALS['bookID']]['position'] = \$GLOBALS['bookPosition'];\n\t\t\t\t\t\t\t\t\$GLOBALS['books'][\$GLOBALS['bookID']]['level'] = \$GLOBALS['bookLevel'];\n\t\t\t\t\t\t\t\t\$GLOBALS['books'][\$GLOBALS['bookID']]['link'] = \$GLOBALS['bookLink'];\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tprintElement(we_tag('navigationEntries'));\n\t\t\t\t\t?>");
                    we_tag('navigationWrite', array('navigationname' => 'book'));
                    unset($GLOBALS['we_navigation']);
                    $cnt = 0;
                    file_put_contents($tempFile, serialize(array()));
                    foreach ($GLOBALS['books'] as $bookID => $bookArray) {
                        //$book[$cnt]['bookid'] = $bookID;
                        $book = array();
                        $book[$cnt]['title'] = $bookArray['title'];
                        $book[$cnt]['level'] = $bookArray['level'];
                        $book[$cnt]['position'] = $bookArray['position'];
                        if (!empty($bookArray['link'])) {
                            //if hidedireindex is activated for navi tool, we have zo put 'index.php' to the url for function path_to_id
                            $completeLink = $bookArray['link'] . (stripos($bookArray['link'], ".php") ? '' : 'index.php');
                            //mode: treat and/or learn
                            $book[$cnt]['mode'] = getMode($completeLink);
                            //the real content
                            $GLOBALS['weDocumentID'] = path_to_id($completeLink);
                            ?>
<we:include type="template" id="48"/><?php 
                            $book[$cnt]['content'] = $GLOBALS['content'];
                            //$book[$cnt]['content'] = storeInBuffer($bookArray['link']);
                            //url without prefix '/app/' and file type e.g. '.php'
                            $book[$cnt]['url'] = str_replace("/app/", "", strrpos($bookArray['link'], '.') ? substr($bookArray['link'], 0, strrpos($bookArray['link'], '.')) : $bookArray['link']);
                        }
                        $fileArray = unserialize(file_get_contents($tempFile));
                        $fileArray = array_merge($fileArray, $book);
                        file_put_contents($tempFile, serialize($fileArray));
                        unset($fileArray);
                        $cnt++;
                    }
                    unset($GLOBALS['books']);
                    unset($_SESSION['webuser']);
                    unset($user);
                    $completeBook = unserialize(file_get_contents($tempFile));
                    return $completeBook;
                    /**
                    header("Cache-Control: ", true);
                    header("Content-Type: application/json");
                    header('Content-Type: application/force-download');
                    header('Content-Length: '.filesize($tempFile));
                    ob_clean();
                    flush();
                    readfile($tempFile);
                    exit();
                    */
                /**
                header("Cache-Control: ", true);
                header("Content-Type: application/json");
                header('Content-Type: application/force-download');
                header('Content-Length: '.filesize($tempFile));
                ob_clean();
                flush();
                readfile($tempFile);
                exit();
                */
                default:
                    unset($_SESSION['webuser']);
                    return "Request not allowed";
            }
        }
        return "Only accepts GET requests";
    }