119 lines
4.3 KiB
PHP
119 lines
4.3 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Project: astat - simple site engine
|
||
|
* File: /modules/text/add.apnl.php
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2.1 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library 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
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with this library; if not, write to the Free Software
|
||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
*
|
||
|
* @link http://www.astat.org SVN: $URL$
|
||
|
* @copyright 2009 becast.at
|
||
|
* @author Bernhard Jaud <bernhard at becast dot at>
|
||
|
* @package astat core
|
||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||
|
* @version $Id$
|
||
|
*/
|
||
|
If (!defined("in_BL_ADMIN")) {
|
||
|
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
|
||
|
}
|
||
|
$session->page_begin("tweet", True);
|
||
|
include '/var/www/virtual/ponytopia.net/htdocs/thirdparty/twitter/twitter.class.php';
|
||
|
|
||
|
|
||
|
class add_twitter_panel extends admin_module{
|
||
|
|
||
|
function output(){
|
||
|
global $config, $db,$panel, $session;
|
||
|
$fail=FALSE;
|
||
|
$twitter = new Twitter('uVApPPv2zWXu8dWBwkbLw', 'kNHU7pia5ikY22No8gHU8ucXLd0z3IpnOUn0MA5SvQ', '563736788-UhHJUIJXlSdu3iFPaaqZQDmI9FExJOBW1e7ceZpM', 'FTHmLz1Gwa0pkgH5riN5mui4v3m83BaVVpXju4Bqlc');
|
||
|
if(isset($_POST['send'])&& $_POST['send']==1){
|
||
|
if(isset($_POST['tweet'])&& $_POST['tweet']!=""){
|
||
|
try{
|
||
|
$ret=$twitter->send(utf8_encode($_POST['tweet']));
|
||
|
|
||
|
}catch(Exception $e){
|
||
|
var_dump($e);
|
||
|
}
|
||
|
if($ret){
|
||
|
$panel->admin_message("Sent", "The Tweet has been sent!.",TRUE,"add_twitter");
|
||
|
}else{
|
||
|
var_dump($ret);
|
||
|
}
|
||
|
}
|
||
|
}elseif(!isset($_POST['send']) || $fail){
|
||
|
$panel->title="Tweet";
|
||
|
$panel->form(array("action"=>$config["path"]."/admin/index.php?panel=add_twitter"));
|
||
|
if($fail){
|
||
|
$panel->content.=$fail;
|
||
|
}
|
||
|
$panel->content.="<h3>Tweet:</h3>";
|
||
|
$panel->textarea(array("name"=>"tweet","value"=>$_POST["tweet"],"rows"=>"20","cols"=>"60"),"onkeyup=\"countChar(this)\"");
|
||
|
$panel->content.="<br />";
|
||
|
$panel->content.="Chars remaining: <div id=\"charNum\"></div>";
|
||
|
$panel->field(array("name"=>"send","typ"=>"hidden","value"=>"1"));
|
||
|
$panel->content.="<br />";
|
||
|
$panel->submit();
|
||
|
$panel->formClose();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function meta(){
|
||
|
global $config;
|
||
|
$meta="<script type=\"text/javascript\" src=\"".$config["path"]."/js/jquery/jquery.min.js\"></script>
|
||
|
<script type=\"text/javascript\">
|
||
|
function countChar(val){
|
||
|
var len = val.value.length;
|
||
|
if (len >= 140) {
|
||
|
val.value = val.value.substring(0, 140);
|
||
|
}else {
|
||
|
$('#charNum').text(140 - len);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
</script>";
|
||
|
$meta.='<script type="text/javascript" src="'.$config["path"].'/thirdparty/tiny/tiny_mce_gzip.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
tinyMCE_GZ.init({
|
||
|
theme : "advanced",
|
||
|
mode : "textareas",
|
||
|
language : "de",
|
||
|
plugins : "table,advhr,advimage,advlink,insertdatetime,searchreplace",
|
||
|
disk_cache : true,
|
||
|
debug : false
|
||
|
});
|
||
|
</script>
|
||
|
<script type="text/javascript" src="'.$config["path"].'/thirdparty/tiny/tiny_mce.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
tinyMCE.init({
|
||
|
theme : "advanced",
|
||
|
mode : "textareas",
|
||
|
language : "de",
|
||
|
plugins : "table,advhr,advimage,advlink,insertdatetime,searchreplace",
|
||
|
theme_advanced_disable : "styleselect,formatselect ",
|
||
|
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
|
||
|
theme_advanced_buttons2_add : "seperator,forecolor,removeformat,advhr",
|
||
|
theme_advanced_buttons3 : "tablecontrols,seperator",
|
||
|
theme_advanced_toolbar_location : "top",
|
||
|
theme_advanced_toolbar_align : "center",
|
||
|
remove_linebreaks : false,
|
||
|
convert_urls : false,
|
||
|
editor_selector : "mceEditor",
|
||
|
editor_deselector : "mceNoEditor"
|
||
|
});
|
||
|
</script>';
|
||
|
return $meta;
|
||
|
}
|
||
|
}
|
||
|
?>
|