/**
  * Module API wrapper function
  *
  * @since 1.0
  * @return string
  */
 public static function WYSIWYGTextarea($name = 'textarea', $columns = '80', $rows = '15', $encoding = '', $content = '', $stylesheet = '', $addtext = '')
 {
     $mod = cms_utils::get_module('MicroTiny');
     // Check if we are in object instance
     if (!is_object($mod)) {
         return false;
     }
     // TODO: some error message?
     // Force WYSIWYG on
     $mod->wysiwygactive = true;
     // Stikki: calling this before TODO cause whole thing failing, check this Silmarillion.
     if ($stylesheet != '') {
         $_SESSION["microtiny_live_templateid"] = substr($stylesheet, strpos($stylesheet, "=") + 1);
     } else {
         $tplops = cmsms()->GetTemplateOperations();
         $templateid = $tplops->LoadDefaultTemplate();
         $mod->templateid = $templateid->id;
     }
     self::add_textarea($name);
     $output = '<textarea id="' . $name . '" name="' . $name . '" cols="' . $columns . '" rows="' . ($rows + 5) . '" ' . $addtext . '>' . cms_htmlentities($content, ENT_NOQUOTES, get_encoding($encoding)) . '</textarea>';
     global $CMS_ADMIN_PAGE;
     if ($CMS_ADMIN_PAGE && $mod->CheckPermission('MicroTiny View HTML Source')) {
         $output .= '<span style="display:block; margin-top:10px;"><input type="checkbox" id="toggle_' . $name . '" onclick="toggleMicroTiny(\'' . $name . '\');"/><label for="toggle_' . $name . '">' . $mod->Lang('view_html') . '</label></span>';
     }
     return $output;
 }
Exemple #2
0
 function cms_admin_sendheaders($content_type = 'text/html', $charset = '')
 {
     if (!$charset) {
         $charset = get_encoding();
     }
     // Date in the past
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     // always modified
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     // HTTP/1.1
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     // HTTP/1.0
     header("Pragma: no-cache");
     // Language shizzle
     header("Content-Type: {$content_type}; charset={$charset}");
 }
Exemple #3
0
<?php

require "../global.php";
require "../cache/s_cate_array.php";
require_once "global.func.php";
require_once "search.class.php";
$s = intval($_GET["s"]);
$wd = $_GET["wd"];
$from_host = str_replace("http://", "", GetSiteUrl($_SERVER['HTTP_REFERER']));
if ($from_host != $_SERVER['HTTP_HOST']) {
    $wd = get_encoding($wd, "GB2312");
}
$old_wd = $wd;
$wd = FilterSearch($wd);
if (strlen($wd) <= 0) {
    header("location:" . $config["url"]);
}
$wd_en = urlencode($wd);
$is_site = false;
//////////////////////
class runtime
{
    var $StartTime = 0;
    var $StopTime = 0;
    function get_microtime()
    {
        list($usec, $sec) = explode(' ', microtime());
        return (double) $usec + (double) $sec;
    }
    function start()
    {
Exemple #4
0
 $themeName = get_preference(get_userid(), 'admintheme', 'default');
 $themeObjectName = $themeName . "Theme";
 $userid = get_userid();
 debug_buffer('before theme load');
 if (file_exists(dirname(__FILE__) . "/themes/{$themeName}/{$themeObjectName}.php")) {
     include dirname(__FILE__) . "/themes/{$themeName}/{$themeObjectName}.php";
     $themeObject = new $themeObjectName($gCms, $userid, $themeName);
 } else {
     $themeObject = new AdminTheme($gCms, $userid, $themeName);
 }
 debug_buffer('after theme load');
 $gCms->variables['admintheme'] =& $themeObject;
 if (isset($gCms->config['admin_encoding']) && $gCms->config['admin_encoding'] != '') {
     $themeObject->SendHeaders(isset($charsetsent), $gCms->config['admin_encoding']);
 } else {
     $themeObject->SendHeaders(isset($charsetsent), get_encoding('', false));
 }
 debug_buffer('before populate admin navigation');
 $themeObject->PopulateAdminNavigation(isset($CMS_ADMIN_SUBTITLE) ? $CMS_ADMIN_SUBTITLE : '');
 debug_buffer('after populate admin navigation');
 debug_buffer('before theme-y stuff');
 $themeObject->DisplayDocType();
 $themeObject->DisplayHTMLStartTag();
 $themeObject->DisplayHTMLHeader(false, isset($headtext) ? $headtext : '');
 $themeObject->DisplayBodyTag();
 $themeObject->DoTopMenu();
 $themeObject->DisplayMainDivStart();
 debug_buffer('after theme-y stuff');
 // Display notification stuff from modules
 // should be controlled by preferences or something
 $ignoredmodules = explode(',', get_preference($userid, 'ignoredmodules'));
function createtmpfname(&$contentobj)
{
    $gCms = cmsms();
    $config = $gCms->GetConfig();
    $templateops = $gCms->GetTemplateOperations();
    $data["content_id"] = $contentobj->Id();
    $data['content_type'] = $contentobj->Type();
    $data["title"] = $contentobj->Name();
    $data["menutext"] = $contentobj->MenuText();
    $data["content"] = $contentobj->Show();
    $data["template_id"] = $contentobj->TemplateId();
    $data["hierarchy"] = $contentobj->Hierarchy();
    $templateobj = $templateops->LoadTemplateById($contentobj->TemplateId());
    $data['template'] = $templateobj->content;
    $data['encoding'] = get_encoding();
    $data['serialized_content'] = serialize($contentobj);
    $tmpfname = '';
    if (is_writable($config["previews_path"])) {
        $tmpfname = tempnam($config["previews_path"], "cmspreview");
    } else {
        $tmpfname = tempnam(TMP_CACHE_LOCATION, "cmspreview");
    }
    $handle = fopen($tmpfname, "w");
    fwrite($handle, serialize($data));
    fclose($handle);
    return $tmpfname;
}
/**
 * A method to return a translation for a specific string in a specific realm.
 * called with the realm first, followed by the key, this method will attempt
 * to load the specific realm data if necessary before doing translation.
 *
 * This method accepts a variable number of arguments.  Any arguments after
 * the realm and the key are passed to the key via vsprintf
 *
 * i.e: lang_by_realm('tasks','my_string');
 *
 * @since 1.8
 * @param string The realm
 * @param string The lang key
 * @return string
 */
function lang_by_realm_en()
{
    $gCms = cmsms();
    global $lang;
    $name = '';
    $realm = 'admin';
    $params = array();
    $result = '';
    $num = func_num_args();
    if ($num == 0) {
        return '';
    }
    $name = func_get_arg(0);
    if ($num > 1) {
        $realm = func_get_arg(1);
        if ($num > 2 && is_array(func_get_arg(2))) {
            $params = func_get_arg(2);
        } else {
            if ($num > 2) {
                $params = array_slice(func_get_args(), 2);
            }
        }
    }
    // we now have a name, a realm, and possible additonal arguments.
    if (!isset($lang[$realm])) {
        $saved_lang = $lang;
        $lang = array();
        cms_load_lang_realm($realm, NULL, NULL, NULL, NULL, NULL, 'en_US');
    }
    // do processing.
    if (isset($lang[$realm][$name])) {
        if (count($params)) {
            $result = vsprintf($lang[$realm][$name], $params);
        } else {
            $result = $lang[$realm][$name];
        }
    } else {
        $result = "--Add Me - {$name} --";
    }
    // conversion.
    if (isset($gCms->config['admin_encoding']) && isset($gCms->variables['convertclass'])) {
        if (strcasecmp(get_encoding('', false), $gCms->config['admin_encoding'])) {
            $class =& $gCms->variables['convertclass'];
            $result = $class->Convert($result, get_encoding('', false), $gCms->config['admin_encoding']);
        }
    }
    $lang = $saved_lang;
    return $result;
}
function db_store_html($seed, $strHTML, $strURL)
{
    /*!! TODO: Encoding Issues, pull date from header*/
    #store strHTML and current datetime
    #echo "start db_store_html(....)\n";
    #echo "$strHTML";
    //ENCODING!!!!!!!!!!
    try {
        $enc = get_encoding($strHTML, true);
        if (strlen($enc) > 0) {
            $enc = $enc . ",";
        }
        $enc = $enc . "x-euc-jp,EUC-JP,JIS,SJIS,iso-8859-1,ASCII";
        #mb_detect_encoding($strHTML,$enc)
        $strHTML = mb_convert_encoding($strHTML, "UTF-8", $enc);
        //$strHTML = html_entity_decode( $strHTML, ENT_QUOTES, "UTF-8" );
        //$strHTML = remove($strHTML,"<script","</script>");//strip JavaScript
        //$strHTML=strip_tags($strHTML);//Remove html tags
        $strHTML = strtolower_utf8($strHTML);
        $return = $strHTML;
        try {
            $strHTML = $strHTML;
            if ($strURL && clean_url($strURL) != clean_url($seed["strURL"])) {
                $domain = get_domain($strURL);
                $cleanURL = clean_url($strURL);
                $url = $strURL;
                $strSQL = "UPDATE tblPages SET strURL=?, strCleanURL=?, strHTML=? WHERE iPageID=?";
                $params = array($url, $cleanURL, $strHTML, $seed["iPageID"]);
            } else {
                $strSQL = "UPDATE tblPages SET strHTML=? WHERE iPageID=?";
                $params = array($strHTML, $seed["iPageID"]);
            }
            db_run_query($strSQL, $params);
            #echo "end db_store_html(...)\n";
            #'" . date("YmdHi___NEED SECONDS__") . "'"
            #e.g. '20100131000000' 2010-01-31 00:00:00
            #CurDate(), CurTime, Now()
        } catch (Exception $e) {
            //ignore
        }
        return $return;
    } catch (Exception $e) {
        print "Exeception {$e}\n";
        return null;
    }
}
Exemple #8
0
            header("HTTP/1.0 404 Not Found");
            header("Status: 404 Not Found");
        } else {
            // no 404 error page.
            ErrorHandler404();
            return;
        }
    }
}
// while trycount
Events::SendEvent('Core', 'ContentPostRender', array('content' => &$html));
$ct = cmsms()->get_variable('content-type');
if (!$ct) {
    $ct = 'text/html';
}
header("Content-Type: {$ct}; charset=" . get_encoding());
echo $html;
@ob_flush();
$endtime = microtime();
$db =& cmsms()->GetDb();
if ($config['debug'] == TRUE || isset($config['show_performance_info']) && $showtemplate == true) {
    $memory = function_exists('memory_get_usage') ? memory_get_usage() : 0;
    $memory = $memory - $orig_memory;
    $memory_peak = function_exists('memory_get_peak_usage') ? memory_get_peak_usage() : 0;
    if (!is_sitedown() && $config["debug"] == true) {
        echo "<p>Generated in " . microtime_diff($starttime, $endtime) . " seconds by CMS Made Simple using " . (isset($db->query_count) ? $db->query_count : '') . " SQL queries and {$memory} bytes of memory (peak memory usage was {$memory_peak})</p>";
    } else {
        if (isset($config['show_performance_info']) && $showtemplate == true) {
            $txt = microtime_diff($starttime, $endtime) . " / " . (isset($db->query_count) ? $db->query_count : '') . " / {$memory} / {$memory_peak}";
            debug_display($txt);
            echo '<!-- ' . $txt . " -->\n";
Exemple #9
0
$content =& $contentops->LoadContentFromId($pageid);
$title = $content->Name();
$templateid = $content->TemplateId();
$menutext = $content->MenuText();
$this->smarty->assign("title", $title);
$this->smarty->assign("content", $showcontent);
$this->smarty->assign("url", $url);
$encoding = $config['default_encoding'];
// kill any output that may have happened already.
$handlers = ob_list_handlers();
for ($cnt = 0; $cnt < sizeof($handlers); $cnt++) {
    ob_end_clean();
}
//Printing-specific assignments
$smarty->assign("templateid", $templateid);
$smarty->assign("overridestylesheet", $this->GetPreference("overridestyle"));
$smarty->assign("encoding", $encoding);
$smarty->assign("rooturl", $config["root_url"] . "/");
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header("Content-Type: " . cmsms()->get_variable('content-type') . "; charset=" . get_encoding());
if ($script) {
    $smarty->assign("printscript", '<script type="text/javascript">window.print();</script>');
} else {
    $smarty->assign("printscript", '');
}
$str = $this->ProcessTemplateFromDatabase("printtemplate");
echo $str;
exit;
/**
 * A method to create a text area control
 *
 * @internal
 * @access private
 * @param boolean Wether the currently selected wysiwyg area should be enabled (depends on user, and site preferences
 * @param string  The contents of the text area
 * @param string  The name of the text area
 * @param string  An optional class name
 * @param string  An optional ID (HTML ID) value
 * @param string  The optional encoding
 * @param string  Optional style information
 * @param integer Width (the number of columns) (CSS can and will override this)
 * @param integer Hieght (the number of rows) (CSS can and will override this)
 * @param string  A flag to indicate that the wysiwyg should be forced to a different type independant of user settings
 * @param string  The name of the syntax hilighter to use (if empty it is assumed that a wysiwyg text area is requested instead of a syntax hiliter)
 * @param string  Optional additional text to include in the textarea tag
 * @return string
 */
function create_textarea($enablewysiwyg, $text, $name, $classname = '', $id = '', $encoding = '', $stylesheet = '', $width = '80', $height = '15', $forcewysiwyg = '', $wantedsyntax = '', $addtext = '')
{
    $gCms = cmsms();
    $result = '';
    $uid = get_userid(false);
    if ($enablewysiwyg == true) {
        $module = cms_utils::get_wysiwyg_module($forcewysiwyg);
        if ($module) {
            $result = $module->WYSIWYGTextArea($name, $width, $height, $encoding, $text, $stylesheet, $addtext);
        }
    }
    if (!$result && $wantedsyntax) {
        $module = cms_utils::get_syntax_highlighter_module();
        if ($module) {
            $result = $module->SyntaxTextArea($name, $wantedsyntax, $width, $height, $encoding, $text, $addtext);
        }
    }
    if ($result == '') {
        $result = '<textarea name="' . $name . '" cols="' . $width . '" rows="' . $height . '"';
        if ($classname != '') {
            $result .= ' class="' . $classname . '"';
        } else {
            $result .= ' class="cms_textarea"';
        }
        if ($id != '') {
            $result .= ' id="' . $id . '"';
        }
        if (!empty($addtext)) {
            $result .= ' ' . $addtext;
        }
        $result .= '>' . cms_htmlentities($text, ENT_NOQUOTES, get_encoding($encoding)) . '</textarea>';
    }
    return $result;
}
Exemple #11
0
//Events::SendEvent('Core', 'ContentPostRenderNonCached', array(&$html));
#}
#Perform the content postrender callback
#reset($gCms->modules);
#while (list($key) = each($gCms->modules))
#{
#	$value =& $gCms->modules[$key];
#	if ( isset($gCms->modules[$key]['installed']) &&
#	     $gCms->modules[$key]['installed'] == true &&
#		$gCms->modules[$key]['active'] == true)
#	{
#		$gCms->modules[$key]['object']->ContentPostRender($html);
#	}
#}
Events::SendEvent('Core', 'ContentPostRender', array('content' => &$html));
header("Content-Type: " . $gCms->variables['content-type'] . "; charset=" . (isset($pageinfo->template_encoding) && $pageinfo->template_encoding != '' ? $pageinfo->template_encoding : get_encoding()));
echo $html;
@ob_flush();
$endtime = microtime();
$db =& $gCms->GetDb();
$memory = function_exists('memory_get_usage') ? memory_get_usage() : 0;
$memory = $memory - $orig_memory;
$memory_peak = function_exists('memory_get_peak_usage') ? memory_get_peak_usage() : 0;
if (!is_sitedown() && $config["debug"] == true) {
    echo "<p>Generated in " . microtime_diff($starttime, $endtime) . " seconds by CMS Made Simple using " . (isset($db->query_count) ? $db->query_count : '') . " SQL queries and {$memory} bytes of memory (peak memory usage was {$memory_peak})</p>";
} else {
    if (isset($config['show_performance_info']) && $showtemplate == true) {
        echo "<!-- " . microtime_diff($starttime, $endtime) . " / " . (isset($db->query_count) ? $db->query_count : '') . " / {$memory} / {$memory_peak} -->\n";
    }
}
if (is_sitedown() || $config['debug'] == true) {
 /**
  * Retrieve output from a module.
  * This method grabs parameters from the request, and given the module name
  * will call the module with the specified parameters to retrieve the module output.
  * This is used to replace the contents of the {content} tag when a module action is
  * called in a non inline manner.
  *
  * @access private
  * @param string The module name.
  * @param  string (returned) The moduleoutput.
  * @param  object The smarty object.
  * @return boolean
  */
 function module_get_template($tpl_name, &$tpl_source, &$smarty_obj)
 {
     $gCms = cmsms();
     $contentobj = $gCms->variables['content_obj'];
     $config = $gCms->config;
     #Run the execute_user function and replace {content} with it's output
     $obj = cms_utils::get_module($tpl_name);
     if (is_object($obj)) {
         @ob_start();
         $id = $smarty_obj->id;
         $returnid = is_object($contentobj) ? $contentobj->Id() : '';
         $params = GetModuleParameters($id);
         $action = 'default';
         if (isset($params['action'])) {
             $action = $params['action'];
         }
         echo $obj->DoActionBase($action, $id, $params, is_object($contentobj) ? $contentobj->Id() : '');
         $modoutput = @ob_get_contents();
         @ob_end_clean();
         $tpl_source = $modoutput;
     }
     header("Content-Type: " . $gCms->variables['content-type'] . "; charset=" . get_encoding());
     if (isset($gCms->variables['content-filename']) && $gCms->variables['content-filename'] != '') {
         header('Content-Disposition: attachment; filename="' . $gCms->variables['content-filename'] . '"');
         header("Pragma: public");
     }
     #So no one can do anything nasty, take out the php smarty tags.  Use a user
     #defined plugin instead.
     if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true)) {
         $tpl_source = preg_replace("/\\{\\/?php\\}/", "", $tpl_source);
     }
     return true;
 }
    $params['errors'] = $this->Lang('error_insufficientparams');
    $this->Redirect($id, $the_action, $returnid, $params);
    return;
}
if (isset($params['cancel'])) {
    $module->_current_tab = $this->_current_tab;
    $module->RedirectToTab($id, $this->_current_tab, '', $the_action);
}
if (!isset($params['templatecontent'])) {
    $params['errors'] = $this->Lang('error_insufficientparams');
    $module->Redirect($id, $params['origaction'], '', $params);
    return;
}
if (!isset($params['template'])) {
    $params['errors'] = $this->Lang('error_insufficientparams');
    $module->Redirect($id, $params['origaction'], '', $params);
    return;
}
$module->SetTemplate($params['prefix'] . $params['template'], cms_html_entity_decode($params['templatecontent'], ENT_QUOTES, get_encoding()));
audit('', $module->GetName(), 'Edited Tempalte ' . $params['prefix'] . $params['template']);
if (isset($params['applybutton'])) {
    unset($params['applybutton']);
    $_SESSION['cge_edittemplate'] = $params;
    $this->Redirect($id, 'edittemplate', $returnid);
}
if ($this->_current_tab != '') {
    $module->_current_tab = $this->_current_tab;
    $module->RedirectToTab($id, '', '', $the_action);
    return;
}
$module->Redirect($id, $the_action);
Exemple #14
0
/**
 * A method to create a text area control
 *
 * @internal
 * @access private
 * @param boolean Wether the currently selected wysiwyg area should be enabled (depends on user, and site preferences
 * @param string  The contents of the text area
 * @param string  The name of the text area
 * @param string  An optional class name
 * @param string  An optional ID (HTML ID) value
 * @param string  The optional encoding
 * @param string  Optional style information
 * @param integer Width (the number of columns) (CSS can and will override this)
 * @param integer Hieght (the number of rows) (CSS can and will override this)
 * @param string  A flag to indicate that the wysiwyg should be forced to a different type independant of user settings
 * @param string  The name of the syntax hilighter to use (if empty it is assumed that a wysiwyg text area is requested instead of a syntax hiliter)
 * @param string  Optional additional text to include in the textarea tag
 * @return string
 */
function create_textarea($enablewysiwyg, $text, $name, $classname = '', $id = '', $encoding = '', $stylesheet = '', $width = '80', $height = '15', $forcewysiwyg = '', $wantedsyntax = '', $addtext = '')
{
    global $gCms;
    $result = '';
    if ($enablewysiwyg == true) {
        reset($gCms->modules);
        while (list($key) = each($gCms->modules)) {
            $value =& $gCms->modules[$key];
            if ($gCms->modules[$key]['installed'] == true && $gCms->modules[$key]['active'] == true && $gCms->modules[$key]['object']->IsWYSIWYG()) {
                if ($forcewysiwyg == '') {
                    if (get_userid(false) == false) {
                        //echo "admin";
                        //get_preference(get_userid(), 'wysiwyg')!="" && //not needed as it won't match the wisiwyg anyway
                        if ($gCms->modules[$key]['object']->GetName() == get_site_preference('frontendwysiwyg')) {
                            $result = $gCms->modules[$key]['object']->WYSIWYGTextarea($name, $width, $height, $encoding, $text, $stylesheet, $addtext);
                        }
                    } else {
                        if ($gCms->modules[$key]['object']->GetName() == get_preference(get_userid(false), 'wysiwyg')) {
                            $result = $gCms->modules[$key]['object']->WYSIWYGTextarea($name, $width, $height, $encoding, $text, $stylesheet, $addtext);
                        }
                    }
                } else {
                    if ($gCms->modules[$key]['object']->GetName() == $forcewysiwyg) {
                        $result = $gCms->modules[$key]['object']->WYSIWYGTextarea($name, $width, $height, $encoding, $text, $stylesheet, $addtext);
                    }
                }
            }
        }
    }
    if ($result == "" && $wantedsyntax != '') {
        reset($gCms->modules);
        while (list($key) = each($gCms->modules)) {
            $value =& $gCms->modules[$key];
            if ($gCms->modules[$key]['installed'] == true && $gCms->modules[$key]['active'] == true && $gCms->modules[$key]['object']->IsSyntaxHighlighter()) {
                if ($forcewysiwyg == '') {
                    //get_preference(get_userid(), 'wysiwyg')!="" && //not needed as it won't match the wisiwyg anyway
                    if ($gCms->modules[$key]['object']->GetName() == get_preference(get_userid(false), 'syntaxhighlighter')) {
                        $result = $gCms->modules[$key]['object']->SyntaxTextarea($name, $wantedsyntax, $width, $height, $encoding, $text, $addtext);
                    }
                } else {
                    if ($gCms->modules[$key]['object']->GetName() == $forcewysiwyg) {
                        $result = $gCms->modules[$key]['object']->SyntaxTextarea($name, $wantedsyntax, $width, $height, $encoding, $text, $addtext);
                    }
                }
            }
        }
    }
    if ($result == '') {
        $result = '<textarea name="' . $name . '" cols="' . $width . '" rows="' . $height . '"';
        if ($classname != '') {
            $result .= ' class="' . $classname . '"';
        } else {
            $result .= ' class="cms_textarea"';
        }
        if ($id != '') {
            $result .= ' id="' . $id . '"';
        }
        if (!empty($addtext)) {
            $result .= ' ' . $addtext;
        }
        $result .= '>' . cms_htmlentities($text, ENT_NOQUOTES, get_encoding($encoding)) . '</textarea>';
    }
    return $result;
}
Exemple #15
0
/**
 * A method to create a text area control
 *
 * @internal
 * @access private
 * @param boolean Wether or not we are enabling a wysiwyg.  If false, and forcewysiwyg is not empty then a syntax area is used.
 * @param string  The contents of the text area
 * @param string  The name of the text area
 * @param string  An optional class name
 * @param string  An optional ID (HTML ID) value
 * @param string  The optional encoding
 * @param string  Optional style information
 * @param integer Width (the number of columns) (CSS can and will override this)
 * @param integer Hieght (the number of rows) (CSS can and will override this)
 * @param string  Optional name of the syntax hilighter or wysiwyg to use.  If empty, preferences indicate which a syntax editor or wysiwyg should be used.
 * @param string  Optional name of the language used.  If non empty it indicates that a syntax highlihter will be used.
 * @param string  Optional additional text to include in the textarea tag
 * @return string
 */
function create_textarea($enablewysiwyg, $text, $name, $classname = '', $id = '', $encoding = '', $stylesheet = '', $width = '80', $height = '15', $forcewysiwyg = '', $wantedsyntax = '', $addtext = '')
{
    // todo: rewrite me with var args... to accept a numeric array of arguments, or a hash.
    $gCms = cmsms();
    $result = '';
    $uid = get_userid(false);
    if ($enablewysiwyg == true || $forcewysiwyg) {
        $module = cms_utils::get_wysiwyg_module($forcewysiwyg);
        if ($module) {
            $result = $module->WYSIWYGTextArea($name, $width, $height, $encoding, $text, $stylesheet, $addtext);
        }
    }
    if (!$result && $wantedsyntax) {
        // here we should get a list of installed/available modules.
        $module = cmsms()->GetModuleOperations()->GetSyntaxHighlighter($forcewysiwyg);
        if ($module) {
            $result = $module->SyntaxTextArea($name, $wantedsyntax, $width, $height, $encoding, $text, $addtext);
        }
    }
    if ($result == '') {
        $result = '<textarea name="' . $name . '" cols="' . $width . '" rows="' . $height . '"';
        if ($classname != '') {
            $result .= ' class="' . $classname . '"';
        } else {
            $result .= ' class="cms_textarea"';
        }
        if ($id != '') {
            $result .= ' id="' . $id . '"';
        }
        if (!empty($addtext)) {
            $result .= ' ' . $addtext;
        }
        $result .= '>' . cms_htmlentities($text, ENT_NOQUOTES, get_encoding($encoding)) . '</textarea>';
    }
    return $result;
}
Exemple #16
0
function insert_url_temp($site_id, $url, $level)
{
    global $db;
    $url_htmlcode = get_url_content($url);
    $url_htmlcode = get_encoding($url_htmlcode, "GB2312");
    $links = get_links($url_htmlcode, $url, 1, $url);
    //echo $url;
    // print_r ($links);
    foreach ($links as $key => $value) {
        $array = array('no_id' => $key, 'site_id' => $site_id, 'updatetime' => $level, 'url' => $value);
        $query = $db->query("select * from ve123_links_temp where url='" . $value . "'");
        $num = $db->num_rows($query);
        if ($num == 0) {
            $db->insert("ve123_links_temp", $array);
        } else {
            $db->update("ve123_links_temp", $array, "url='" . $value . "'");
        }
    }
}
Exemple #17
0
        if (isset($_POST['loginsubmit'])) {
            //No error if changing languages
            $error .= lang('usernameincorrect');
            debug_buffer("Login failed.  Error is: " . $error);
            audit($username, $username, 'User Login Failed');
            #Now call the event
            Events::SendEvent('Core', 'LoginPost', $username);
        } else {
            debug_buffer($_POST["loginsubmit"]);
        }
    }
}
// Language shizzle
//header("Content-Encoding: " . get_encoding());
header("Content-Language: " . $current_language);
header("Content-Type: text/html; charset=" . get_encoding());
//CHANGED
$theme = get_site_preference('logintheme', 'default');
//echo "theme:$theme";
debug_buffer('debug is:' . $error);
if (file_exists(dirname(__FILE__) . "/themes/{$theme}/login.php")) {
    include dirname(__FILE__) . "/themes/{$theme}/login.php";
} else {
    include dirname(__FILE__) . "/themes/default/login.php";
}
//STOP
?>

<?php 
if (isset($gCms->config) and $gCms->config['debug'] == true) {
    foreach ($gCms->errors as $globalerror) {
Exemple #18
0
function convert_string($string, $source_encoding = null, $target_encoding = null)
{
    if ($source_encoding == null or strtolower($source_encoding) == "auto") {
        $source_encoding = get_encoding($string);
    }
    if ($target_encoding == null or strtolower($target_encoding) == "auto") {
        $target_encoding = iconv_get_encoding("internal_encoding");
    }
    //echo "$source_encoding - $target_encoding -  ". iconv($source_encoding, $target_encoding , $string)."<br>\n";
    if ($source_encoding != $target_encoding) {
        return iconv($source_encoding, $target_encoding, $string);
    } else {
        //Keine Änderung des Zeichensatz
        return $string;
    }
}
 private function _display_text_block($blockInfo, $value, $adding)
 {
     $ret = '';
     $oneline = isset($blockInfo['oneline']) && cms_to_bool($blockInfo['oneline']);
     if ($oneline) {
         $size = isset($blockInfo['size']) ? $blockInfo['size'] : 50;
         $maxlength = isset($blockInfo['maxlength']) ? $blockInfo['maxlength'] : 255;
         $ret = '<input type="text" size="' . $size . '" maxlength="' . $maxlength . '" name="' . $blockInfo['id'] . '" value="' . cms_htmlentities($value, ENT_NOQUOTES, get_encoding('')) . '" />';
     } else {
         $block_wysiwyg = true;
         $hide_wysiwyg = $this->GetPropertyValue('disable_wysiwyg');
         if ($hide_wysiwyg) {
             $block_wysiwyg = false;
         } else {
             $block_wysiwyg = $blockInfo['usewysiwyg'] == 'false' ? false : true;
         }
         $ret = create_textarea($block_wysiwyg, $value, $blockInfo['id'], '', $blockInfo['id'], '', $this->stylesheet);
     }
     return $ret;
 }
Exemple #20
0
function add_links($url, $is_index_page = true, $num = '')
{
    global $db;
    $new_links = array();
    $j = 1;
    $url_htmlcode = get_url_content($url);
    $url_htmlcode = get_encoding($url_htmlcode, "GB2312");
    $links = get_links($url_htmlcode, $url, 1, $url);
    echo "<br><b>url=";
    print_r($url);
    echo "<br></b>";
    if ($is_index_page) {
        foreach ($links as $value) {
            $new_links[] = GetSiteUrl($value);
        }
    } else {
        $new_links = $links;
    }
    $new_links = distinct_array($new_links);
    foreach ($new_links as $value) {
        //echo $value."<br>";
        //ob_flush();
        //flush();
        $query = $db->query("select * from ve123_links where url='{$value}'");
        $num = $db->num_rows($query);
        if ($num == 0) {
            echo "<font color=#C60A00><b>抓取到:</b></font>" . $value . "<br>";
            if (!add_update_link($value, "", "", "add")) {
                continue;
            }
            $j++;
            if (!empty($num)) {
                if ($j >= $num) {
                    exit;
                }
            }
        } else {
            echo "<b>已存在了:</b>";
            echo "<a href=" . $value . " target=_blank>" . $value . "</a>";
            echo "<br>";
        }
        ob_flush();
        flush();
    }
}
Exemple #21
0
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
$gCms = cmsms();
$config = $gCms->GetConfig();
$smarty = $gCms->GetSmarty();
debug_buffer('Debug in the page is: ' . $error);
if (isset($error) && $error != '') {
    $smarty->assign('error', $error);
} else {
    if (isset($warningLogin) && $warningLogin != '') {
        $smarty->assign('warninglogin', $warningLogin);
    } else {
        if (isset($acceptLogin) && $acceptLogin != '') {
            $smarty->assign('acceptlogin', $acceptLogin);
        }
    }
}
if ($changepwhash != '') {
    $smarty->assign('changepwhash', $changepwhash);
}
$smarty->assign('encoding', get_encoding());
$smarty->assign('config', $gCms->GetConfig());
Exemple #22
0
<?php

#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://www.cmsmadesimple.org
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program 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 this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#$Id: login.php 4251 2007-11-15 21:34:40Z calguy1000 $
$CMS_ADMIN_PAGE = 1;
require_once "../include.php";
require_once "../lib/classes/class.user.inc.php";
$themeObject = cms_utils::get_theme_object();
$theme = $themeObject->themeName;
header("Content-type: text/css; charset=" . get_encoding());
if (file_exists(dirname(__FILE__) . "/themes/{$theme}/css/style.css")) {
    echo file_get_contents(dirname(__FILE__) . "/themes/{$theme}/css/style.css");
} else {
    echo file_get_contents(dirname(__FILE__) . "/themes/default/css/style.css");
}
Exemple #23
0
function add_links($url, $is_index_page = true, $num = '')
{
    global $db;
    $new_links = array();
    $j = 1;
    $url_htmlcode = get_url_content($url);
    $url_htmlcode = get_encoding($url_htmlcode, "GB2312");
    $links = get_links($url_htmlcode, $url, 1, $url);
    if ($is_index_page) {
        foreach ($links as $value) {
            $new_links[] = GetSiteUrl($value);
        }
    } else {
        $new_links = $links;
    }
    $new_links = distinct_array($new_links);
    foreach ($new_links as $value) {
        echo $value . "<br>";
        flush();
        $query = $db->query("select * from ve123_links where url='{$value}'");
        $num = $db->num_rows($query);
        if ($num == 0) {
            if (!add_update_link($value, "", "", "add")) {
                continue;
            }
            $j++;
            if (!empty($num)) {
                if ($j >= $num) {
                    exit;
                }
            }
        }
    }
}
if (isset($params['prefix'])) {
    $prefix = trim($params['prefix']);
}
if (!isset($params['templatecontent'])) {
    $params['errors'] = $this->Lang('error_insufficientparams');
    $module->Redirect($id, $params['origaction'], '', $params);
    return;
}
if ($template == "" || $prefix == "") {
    $params['errors'] = $this->Lang('error_insufficientparams');
    $module->Redirect($id, $params['origaction'], '', $params);
    return;
}
$newtemplate = $prefix . $template;
// check if this template already exists
$txt = trim($module->GetTemplate($newtemplate));
if ($txt != "") {
    $params['errors'] = $this->Lang('error_templatenameexists');
    $this->Redirect($id, $params['origaction'], '', $params);
    return;
}
// we're ready to set it
$txt = cms_html_entity_decode($params['templatecontent'], ENT_QUOTES, get_encoding());
$module->SetTemplate($newtemplate, $txt);
audit('', $module->GetName(), 'Added Template ' . $newtemplate);
if ($this->_current_tab != '') {
    $module->_current_tab = $this->_current_tab;
    $module->RedirectToTab($id, '', '', $the_action);
    return;
}
$module->Redirect($id, $the_action);
Exemple #25
0
/**
 * Loads appropriate language file if necessary. Returns translated string value for a module string.
 * Included in the module class when needed.
 *
 * @param mixed $modinstance pointer to the module instance
 * @since		1.0
 * @return string translated 
 */
function cms_module_Lang(&$modinstance)
{
    global $gCms;
    $name = '';
    $params = array();
    if (func_num_args() > 0) {
        $name = func_get_arg(1);
        if (func_num_args() == 3 && is_array(func_get_arg(2))) {
            $params = func_get_arg(2);
        } else {
            if (func_num_args() > 2) {
                $params = array_slice(func_get_args(), 2);
            }
        }
    } else {
        return '';
    }
    if ($modinstance->curlang == '') {
        $modinstance->curlang = cms_current_language();
    }
    $ourlang = $modinstance->curlang;
    #Load the language if it's not loaded
    if (!isset($modinstance->langhash[$ourlang]) || !is_array($modinstance->langhash[$ourlang]) || is_array($modinstance->langhash[$ourlang]) && count(array_keys($modinstance->langhash[$ourlang])) == 0) {
        $dir = $gCms->config['root_path'];
        $lang = array();
        //First load the default language to remove any "Add Me's"
        if (@is_file("{$dir}/modules/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . "/" . $modinstance->DefaultLanguage() . ".php")) {
            include "{$dir}/modules/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . "/" . $modinstance->DefaultLanguage() . ".php";
        } else {
            if (@is_file("{$dir}/modules/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . ".php")) {
                include "{$dir}/modules/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . ".php";
            }
        }
        //Now load the other language if necessary
        if (count($lang) == 0 || $modinstance->DefaultLanguage() != $ourlang) {
            if (@is_file("{$dir}/modules/" . $modinstance->GetName() . "/lang/{$ourlang}/{$ourlang}.php")) {
                include "{$dir}/modules/" . $modinstance->GetName() . "/lang/{$ourlang}/{$ourlang}.php";
            } else {
                if (@is_file("{$dir}/modules/" . $modinstance->GetName() . "/lang/ext/{$ourlang}.php")) {
                    include "{$dir}/modules/" . $modinstance->GetName() . "/lang/ext/{$ourlang}.php";
                } else {
                    if (@is_file("{$dir}/modules/" . $modinstance->GetName() . "/lang/{$ourlang}.php")) {
                        include "{$dir}/modules/" . $modinstance->GetName() . "/lang/{$ourlang}.php";
                    } else {
                        if (count($lang) == 0) {
                            if (@is_file("{$dir}/modules/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . "/" . $modinstance->DefaultLanguage() . ".php")) {
                                include "{$dir}/modules/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . "/" . $modinstance->DefaultLanguage() . ".php";
                            } else {
                                if (@is_file("{$dir}/modules/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . ".php")) {
                                    include "{$dir}/modules/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . ".php";
                                }
                            }
                        } else {
                            # Sucks to be here...  Don't use Lang unless there are language files...
                            # Get ready for a lot of Add Me's
                        }
                    }
                }
            }
        }
        # try to load an admin modifiable version of the lang file if one exists
        if (@is_file("{$dir}/module_custom/" . $modinstance->GetName() . "/lang/{$ourlang}.php")) {
            include "{$dir}/module_custom/" . $modinstance->GetName() . "/lang/{$ourlang}.php";
        } else {
            if (@is_file("{$dir}/module_custom/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . ".php")) {
                include "{$dir}/module_custom/" . $modinstance->GetName() . "/lang/" . $modinstance->DefaultLanguage() . ".php";
            }
        }
        $modinstance->langhash[$ourlang] =& $lang;
    }
    $result = '';
    if (isset($modinstance->langhash[$ourlang][$name])) {
        if (count($params)) {
            $result = @vsprintf($modinstance->langhash[$ourlang][$name], $params);
        } else {
            $result = $modinstance->langhash[$ourlang][$name];
        }
    } else {
        $result = "--Add Me - module:" . $modinstance->GetName() . " string:{$name}--";
    }
    if (isset($gCms->config['admin_encoding']) && isset($gCms->variables['convertclass'])) {
        if (strtolower(get_encoding('', false)) != strtolower($gCms->config['admin_encoding'])) {
            $class =& $gCms->variables['convertclass'];
            $result = $class->Convert($result, get_encoding('', false), $gCms->config['admin_encoding']);
        }
    }
    return $result;
}
Exemple #26
0
 //Einbauen!!!!
 if ($dateityp == "zip") {
     if ($_FILES["file"]['size'] < 102400000) {
         $zip_path = $path . "/" . $_FILES["file"]['name'];
         move_uploaded_file($_FILES["file"]['tmp_name'], $zip_path);
         //====== Entpacken
         $zip = new ZipArchive();
         $res = $zip->open($zip_path);
         if ($res === TRUE) {
             //Dateinamen Kodierung aller Dateien ermitteln
             $f_enc = array();
             $filenr = 0;
             while (false !== $zip->statIndex($filenr)) {
                 $stat = $zip->statIndex($filenr);
                 $filename = $stat['name'];
                 $filename_enc = get_encoding($filename, $zipencsource);
                 if ($filename_enc != 'ASCII' and $filename_enc != $zipenctarget) {
                     $f = array();
                     $f["filename_org"] = $filename;
                     $f["encoding"] = $filename_enc;
                     $f["filename_new"] = convert_string($filename, $filename_enc, $zipenctarget);
                     $f_enc[] = $f;
                 }
                 $filenr++;
             }
             $zip->extractTo($path);
             $zip->close();
             echo "Das Zip-Archiv wurde nach {$path} entpackt. Es wurden {$filenr} Dateien entpackt!<br>\n";
             //Encoding anpassen
             foreach ($f_enc as $f) {
                 //echo "rename: ".$path.$f["filename_org"]." to:". $path.$f["filename_new"]." encoding: ".$f["encoding"]."<br>\n";
Exemple #27
0
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#
#$Id: login.php 5517 2009-04-02 16:42:15Z nuno $
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php 
echo lang('logintitle');
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo get_encoding();
?>
" />
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="themes/NCleanGrey/images/layout/ncleangrey-favicon.ico" />
<link rel="Bookmark" href="themes/NCleanGrey/images/layout/ncleangrey-favicon.ico" />
<script src="themes/NCleanGrey/includes/standard.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="screen, projection" href="loginstyle.php" />
<base href="<?php 
$config = cmsms()->GetConfig();
echo $config['admin_url'] . '/';
?>
" />
</head>
<body class="body-login">
<div class="login-all clear">
Exemple #28
0
 function WYSIWYGTextarea($name = 'textarea', $columns = '80', $rows = '15', $encoding = '', $content = '', $stylesheet = '', $addtext = '')
 {
     if (!$this->wysiwygactive && isset($_SESSION["tiny_live_textareas"])) {
         $_SESSION["tiny_live_textareas"] = "";
         unset($_SESSION["tiny_live_textareas"]);
     }
     $this->wysiwygactive = true;
     global $gCms;
     $variables =& $gCms->variables;
     if ($stylesheet != '') {
         //$_SESSION["tiny_live_templateid"]=substr($stylesheet, strpos($stylesheet,"=")+1);
         $this->templateid = substr($stylesheet, strpos($stylesheet, "=") + 1);
     } else {
         $tplops = $gCms->GetTemplateOperations();
         $template = $tplops->LoadDefaultTemplate();
         //$_SESSION["tiny_live_templateid"]=$template->id;
         $this->templateid = $template->id;
     }
     if (!isset($_SESSION["tiny_live_textareas"])) {
         $_SESSION["tiny_live_textareas"] = $name;
     } else {
         $_SESSION["tiny_live_textareas"] .= "," . $name;
     }
     $result = '<textarea id="' . $name . '" name="' . $name . '" cols="' . $columns . '" rows="' . ($rows + 5) . '" ' . $addtext . '>' . cms_htmlentities($content, ENT_NOQUOTES, get_encoding($encoding)) . '</textarea>';
     $checked = "";
     if ($this->GetPreference("startenabled", "1") == "1") {
         $checked = 'checked="checked"';
     }
     //Handle togglebutton
     $showtoggle = false;
     //Having profile-decided toggle button is simply not possible presently as we cannot at this point
     //know if we're in frontend or not and CheckPermission forces admin-login
     /* if (isset($_SESSION["tiny_live_frontend"]) && $_SESSION["tiny_live_frontend"]!="") {
           $showtoggle=($this->GetPreference("front_showtogglebutton",0)==1);
           } else {
           //die();
           if ($this->CheckPermission('allowadvancedprofile')) {
           $showtoggle=($this->GetPreference("advanced_showtogglebutton",0)==1);
           } else {
     
           }
           } */
     $showtoggle = $this->GetPreference("showtogglebutton", 0) == 1;
     if ($showtoggle) {
         $result .= '<br/><input type="checkbox" ' . $checked . ' onclick="toggleEditor(\'' . $name . '\');" id="check_' . $name . '" /><label for="check_' . $name . '">' . $this->Lang("togglewysiwyg") . '</label>';
     }
     return $result;
 }