function generate_smilies($form = 'post', $field = 'message')
{
    $smilies = get_smilies_table2();
    $html = '<table width="100%" border="0" cellspacing="0" cellpadding="0">' . "\n" . '        <tr align="center" valign="middle">' . "\n";
    foreach ($smilies as $smiley) {
        $caption = $smiley[2] . " " . $smiley[0];
        $html .= '                <td width="5%"><a href="javascript:emoticon_' . $form . '(\'' . $smiley[0] . '\')"><img src="images/smiles/' . $smiley[1] . '" alt="' . $caption . '" width="15" height="15" border="0" title="' . $caption . '"></a></td>' . "\n";
    }
    $html .= '        </tr>' . "\n" . '</table>' . "\n";
    $html .= <<<EOT

<script language="JavaScript" type="text/javascript">
<!--
function emoticon_{$form}(text) {
        text = ' ' + text + ' ';
        if (document.{$form}.{$field}.createTextRange && document.post.message.caretPos) {
                var caretPos = document.{$form}.{$field}.caretPos;
                caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
                document.{$form}.{$field}.focus();
        } else {
                document.{$form}.{$field}.value  += text;
                document.{$form}.{$field}.focus();
        }
}

function storeCaret_{$form}(textEl) {
        if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
//-->

EOT;
    $html .= "</script>\n";
    return $html;
}
function generate_smilies($form = 'post', $field = 'message')
{
    global $THEME_DIR, $LINEBREAK;
    $smilies = get_smilies_table2();
    $paths = array($THEME_DIR . 'smiles/', 'images/smiles/');
    if (function_exists('theme_generate_smilies')) {
        $html = theme_generate_smilies($smilies, $form);
    } else {
        $html = '<table width="100%" border="0" cellspacing="0" cellpadding="0">' . $LINEBREAK . '        <tr align="center" valign="middle">' . $LINEBREAK;
        foreach ($smilies as $smiley) {
            $smile_path = file_exists($paths[0] . $smiley[1]) ? $paths[0] : $paths[1];
            $caption = $smiley[2] . " " . $smiley[0];
            if (file_exists($smile_path . $smiley[1]) == TRUE) {
                $html .= '                <td width="5%"><img src="' . $smile_path . $smiley[1] . '" alt="' . $caption . '" border="0" style="cursor:pointer;" title="' . $caption . '" onclick="javascript:emot' . $form . '(\'' . $smiley[0] . '\')" /></td>' . $LINEBREAK;
            }
        }
        $html .= '        </tr>' . $LINEBREAK . '</table>' . $LINEBREAK;
    }
    $html .= <<<EOT

<script language="JavaScript" type="text/javascript">
<!--
function emot{$form}(text) {
        text = ' ' + text + ' ';
        if (document.{$form}.{$field}.createTextRange && document.{$form}.{$field}.caretPos) {
                var caretPos = document.{$form}.{$field}.caretPos;
                caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
                document.{$form}.{$field}.focus();
        } else {
                document.{$form}.{$field}.value  += text;
                document.{$form}.{$field}.focus();
        }
}

function storeCaret_{$form}(textEl) {
        if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
//-->

EOT;
    $html .= '</script>' . $LINEBREAK;
    return $html;
}
예제 #3
0
function theme_minicms_edit_editor(&$cms)
{
    global $MINICMS, $referer, $lang_minicms, $CONFIG, $THEME_DIR;
    ob_start();
    echo '<SELECT name="type">';
    foreach ($MINICMS['conType'] as $key => $conType) {
        if ($key == $cms['type']) {
            echo "<OPTION selected value=\"{$key}\">{$conType}</OPTION>";
        } else {
            echo "<OPTION value=\"{$key}\">{$conType}</OPTION>";
        }
    }
    echo '</SELECT>';
    $cms['select_type'] = ob_get_clean();
    print <<<EOT
        <form name="post" method="post" action="index.php?file=minicms/cms_edit&amp;referer={$referer}">
EOT;
    starttable("100%", $cms['title'], 3);
    print <<<EOT
        <tr>
            <td colspan="3" align="center">
                <h2>{$cms['message']}</h2>
            </td>
        </tr>
        <tr>
            <td>{$lang_minicms['title']}</td>
            <td>{$lang_minicms['type']}</td>
            <td>{$lang_minicms['content']}</td>
        </tr>
        <tr valign="top">
            <td class="row2">
                <input value="{$cms['ID']}" type="hidden" name="id" >
                <input type="text" value="{$cms['title']}" class="post" tabindex="1" style="width: 450px;" maxlength="60" size="45" name="title" />
            </td>
            <td class="row2">
                {$cms['select_type']}
            </td>
            <td class="row2">
                <input type="text" value="{$cms['conid']}" class="post" tabindex="3" style="width: 50px;" maxlength="5" name="conid" />
            </td>
        </tr>
        <tr valign="top">
            <td class="row2" colspan="3">
EOT;
    foreach (get_smilies_table2() as $smiley) {
        $smilies[] = $smiley[1];
    }
    //$smilies="['".implode("','",$smilies)."']";
    //$smilies=implode(",",$smilies);
    //echo "<br>$smilies";
    $superCage = Inspekt::makeSuperCage();
    $cmpath = str_replace('index.php', '', $superCage->server->getRaw('PHP_SELF'));
    $userfilespath = $cmpath . $CONFIG['fullpath'];
    $basepath = $cmpath . 'plugins/minicms/fckeditor/';
    $oFCKeditor = new FCKeditor('minicms_content');
    $oFCKeditor->BasePath = $basepath;
    $oFCKeditor->Width = '100%';
    $oFCKeditor->Height = '350';
    $oFCKeditor->Value = $cms['content'];
    $oFCKeditor->Config['BaseHref'] = $CONFIG['ecards_more_pic_target'];
    $oFCKeditor->Config['CustomConfigurationsPath'] = $basepath . 'minicms_config.js';
    //  $oFCKeditor->Config['SmileyPath']      = $cmpath . 'images/smiles/';  //couldn't get the smilies to work
    //  $oFCKeditor->Config['SmileyImages']    = $smilies;          //I posted the problem of FCK's project site
    $oFCKeditor->Config['EditorAreaCSS'] = $cmpath . $THEME_DIR . 'style.css';
    $oFCKeditor->Config['StylesXmlPath'] = $basepath . 'style.xml';
    //  $oFCKeditor->Config['UseBROnCarriageReturn'] = true;  I don't think we wan't this option.
    //  $oFCKeditor->Config['LinkBrowserURL']  = $basepath . 'editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&ServerPath='.$userfilespath;
    //  $oFCKeditor->Config['ImageBrowserURL'] = $basepath . 'editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php&ServerPath='.$userfilespath;
    //  $oFCKeditor->Config['FlashBrowserURL'] = $basepath . 'editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/php/connector.php&ServerPath='.$userfilespath;
    // 	$oFCKeditor->Config['MediaBrowserURL'] = $basepath . 'editor/filemanager/browser/default/browser.html?Type=Media&Connector=connectors/php/connector.php&ServerPath='.$userfilespath;
    //	$oFCKeditor->Config['LinkUploadURL']   = $basepath . 'editor/filemanager/upload/php/upload.php&ServerPath='.$userfilespath;
    //	$oFCKeditor->Config['ImageUploadURL']  = $basepath . 'editor/filemanager/upload/php/upload.php?Type=Image&ServerPath='.$userfilespath;
    //	$oFCKeditor->Config['FlashUploadURL']  = $basepath . 'editor/filemanager/upload/php/upload.php?Type=Flash&ServerPath='.$userfilespath;
    //	$oFCKeditor->Config['MediaUploadURL']  = $basepath . 'editor/filemanager/upload/php/upload.php?Type=Media&ServerPath='.$userfilespath;
    //  $oFCKeditor->Config['PluginsPath'] = $basepath . 'editor/plugins/';
    //  $oFCKeditor->Config['SkinPath'] = $basepath . 'editor/skins/silver/';
    //  $oFCKeditor->Config['Debug'] = true;
    //  $oFCKeditor->Config['UserFilesPath'] = $userfilespath;
    $oFCKeditor->Create();
    print <<<EOT
            </td>
        </tr>
        <tr>
            <td align="center" colspan="3" class="catBottom">
                <input value="{$lang_minicms['preview']}" class="mainoption" name="submit" tabindex="5" type="submit">&nbsp;
                <input value="{$lang_minicms['submit']}" class="mainoption" name="submit" tabindex="6" accesskey="s" type="submit">
            </td>
        </tr>
    </form>
EOT;
    endtable();
}