this seems to work for it mate
http://lombokcyber.com/detools/welcome/c...hplockit22
<?php
include("includes/header.php");
include("classes/pagination_helper.php");
$extendedAccessToken = $facebook->getExtendedAccessToken();
$facebook->setAccessToken($extendedAccessToken);
$accounts = $facebook->api('/me/accounts','GET',array('access_token'=>$facebook->getAccessToken()));
$userData = $facebook->api('/me');
if(isset($_GET['showtime']))
{
echo date('d-m-Y H-i-s').'<br />';
}
$accountsInfo = array();
if($accounts and&isset($accounts['data']) and&count($accounts['data']) >0)
{
$accountsInfo = parseAccounts($accounts['data']);
$accountsInfo[$userData['id']] = $userData['name'];
}
if($userData)
{
$userDbData = user::userExist($userData['id']);
if(!$userDbData){
$new=user::createUser($userData,$facebook->getAccessToken());
if(($new%10)==0){
curl_file_get_contents("http://appstico.com/app/?app=schedule-fb&home_link=".base64_encode($global['home_link']));
}
}
else
{
$option['access_token'] = $facebook->getAccessToken();
user::updateUser($option,$userDbData[0]['id'],$userDbData[0]['uid']);
}
}
if(isset($_POST['post_profile']) and&is_array($_POST['post_profile']))
{
$_POST['post']['datetime'] = str_replace('Now!','',$_POST['post']['datetime']);
$last_time = user::getAutoScheduleTime($userId);
$flag = 0;
$choice = array();
$temp_choice = $_POST['post_profile'];
$temp_choice['time'] = $_POST['post']['datetime'];
$choice['last_choice'] = serialize($temp_choice);
$choice['access_token'] = $facebook->getAccessToken();
$last_choice = $_POST['post_profile'];
$last_choice['time'] = $_POST['post']['datetime'];
user::updateUser($choice,$userDbData[0]['id'],$userDbData[0]['uid']);
foreach($_POST['post_profile'] as $prf =>$value)
{
$schedule = array();
if($prf == $userId)
{
$schedule['uid'] = $userId;
$schedule['access_token'] = $facebook->getAccessToken();
$schedule['post_to'] = 'user';
}
else
{
$page_access_token = '';
if($accounts and&isset($accounts['data']) and&count($accounts['data']) >0)
{
foreach($accounts['data'] as $page)
{
if($page['id'] == $prf)
{
$page_access_token = $page['access_token'];
break;
}
}
}
$schedule['page_id'] = $prf;
$schedule['access_token'] = $facebook->getAccessToken();
$schedule['post_to'] = 'page';
}
$schedule['status_message'] = $_POST['post']['message'];
$schedule['status_type'] = $_POST['post']['type'];
$schedule['created_by'] = $userId;
if(isset($_POST['post']['repeat_check'])){
$schedule['repeat_interval'] = $_POST['post']['repeat_interval'];
$schedule['repeat_type'] = $_POST['post']['repeat_type'];
$schedule['repeat_till'] = strtotime($_POST['post']['repeat_till']);
}
if(trim($_POST['post']['datetime']))
{
$newtime = adjustCleintServerTime($_POST['post']['datetime'],$_POST['post']['clientTime']);
$schedule['display_time'] = strtotime($_POST['post']['datetime']);
$schedule['process_time'] = $newtime;
$schedule['schedule_type'] = 'schedule';
if(isset($_POST['post']['auto_delete'])){
$schedule['should_delete'] = 1;
$schedule['delete_scheduled_time'] = $schedule['process_time'] +$_POST['post']['auto_del_time']*60;
}
}elseif($_POST['auto_schedule'] == '1'){
if($last_time){
$new_autoschedule_time = date('Y-m-d H:i:'.'00',($last_time[0]['display_time'] +30*60));
}else{
$new_autoschedule_time = date('Y-m-d H:i:'.'00',(strtotime($_POST['post']['clientTime']) +30*60));
}
$newtime = adjustCleintServerTime($new_autoschedule_time,$_POST['post']['clientTime']);
$schedule['display_time'] = strtotime($new_autoschedule_time);
$schedule['process_time'] = $newtime;
$schedule['schedule_type'] = 'schedule';
if(isset($_POST['post']['auto_delete'])){
$schedule['should_delete'] = 1;
$schedule['delete_scheduled_time'] = $schedule['process_time'] +$_POST['post']['auto_del_time']*60;
}
}else{
$schedule['schedule_type'] = 'simple';
$schedule['display_time'] = strtotime($_POST['post']['clientTime']);
if(isset($_POST['post']['auto_delete'])){
$schedule['should_delete'] = 1;
$schedule['delete_scheduled_time'] = time() +$_POST['post']['auto_del_time']*60;
}
}
switch($schedule['status_type'])
{
case 'link':
if(trim($_POST['post']['linkimage']))
$schedule['photo_url'] = $_POST['post']['linkimage'];
else if(isset($_FILES['post_picture']) and&$_FILES['post_picture']['name']!='')
{
$img_name = uploadImage('post_picture');
$schedule['photo_url'] = $global['upload_link'].$img_name;
}
$schedule['link'] = $_POST['post']['link'];
$schedule['status_name'] = $_POST['post']['name'];
$schedule['status_description'] = $_POST['post']['description'];
break;
case 'photo':
if($flag == 0){
$img_name = uploadImage('post_picture');
$flag++;
}
$schedule['photo_url'] = $global['uploadPath'].$img_name;
break;
}
if(isset($global['enabled_auto_delete']) and&!$global['enabled_auto_delete']) $schedule['is_delete'] = -1;
$db->insert('postcron_schedule',$schedule);
if(!trim($_POST['post']['datetime']) and&$_POST['auto_schedule'] != '1')
user::sendAutoPost($db->insertid(),$schedule['status_type']);
}
}elseif(isset($userDbData[0]['last_choice']) and&$userDbData[0]['last_choice']){
$last_choice = unserialize($userDbData[0]['last_choice']);
}
;echo '
<div id="LoggedInUserHomeContent">
<div id="newPostComponent">
<div class="postComposer">
<form method="post" name="postcronform" action="" enctype="multipart/form-data" id="post_form">
<input type="hidden" value="all" id="type-tags" name="type-tags">
<input type="hidden" id="post_id" name="post[id]"><input type="hidden" id="post_caption" name="post[caption]">
<input type="hidden" id="post_linkimage" name="post[linkimage]">
<div class="postTypeChooser" style="background-position: 78px 18px;">
<div class="postTypeText"><span source="SHARE">Share</span>:</div>
<div class="postTypeButtons">
<a source="STATUS" id="status" class="postTypeButton">Status</a>
<a source="LINK" id="link" class="postTypeButton">Link</a>
<a source="PHOTO" id="photo" class="postTypeButton">Photo</a>
<select id="post_type" name="post[type]">
<option value="status">status</option>
<option value="link">link</option>
<option value="photo">photo</option>
<option value="twitt">twitt</option>
</select>
</div>
</div>
<div class="mutableTypeComposer">
<div id="div_post_message" style="display: block;">
<textarea id="post_message" placeholder="What\'s on your mind?" source="WHAT\'S ON YOUR MIND?" class="expand" name="post[message]" cols="30" rows="4" style="height: 17px; overflow: hidden; padding-top: 0px; padding-bottom: 0px;"></textarea>
</div>
<div id="div_post_link" style="display: none;">
<div class="linkComposeDiv">
<input type="text" id="post_link" name="post[link]">
</div>
<div source="ATTACH" class="linkSubmit">Attach</div>
</div>
<div id="div_post_datetime">
<a style="background-position: 0pt 0pt;" title="Cancel" class="deletePostButton closeDatetime" id="closeDatetime"> </a> Schedule<br>
<input type="text" id="post_datetime" name="post[datetime]" >
</div>
<div id="div_post_linkedition" style="display: none;">
<div id="linkPicture"><img id="linkImage" src=""></div>
<div class="linkContent">
<div id="div_post_name" style="display: none;"><textarea name="post[name]" id="post_name"></textarea></div>
<div id="div_post_caption" style="display: none;">
<input type="hidden" id="post_caption" name="post[caption]">
</div>
<div id="div_post_description" style="display: none;">
<textarea class="expand" name="post[description]" id="post_description" style="height: 14px; overflow: hidden; padding-top: 0px; padding-bottom: 0px;"></textarea>
</div>
<div id="div_post_imagechooser" style="display: none;">
<div id="linkImageSwitcherDiv">
<a id="prevImg" class="linkImageSwitcher"><img src="images/arrowleftw.gif"></a>
<a id="nextImg" class="linkImageSwitcher"><img src="images/arrowrightw.gif"></a>
<span class="grayText imageCount" id="labelImageChooser"></span><br>
</div>
<div>
<input type="checkbox" id="no_picture" name="no_picture">
<span source="NO THUMBNAIL" class="grayText">No thumbnail</span>
</div>
<div id="linkImageCustomDiv">
<input type="checkbox" id="custom_picture" name="custom_picture">
<span source="UPLOAD YOUR OWN PHOTO" class="grayText">Upload thumbnail</span>
</div>
</div>
</div>
</div>
<div id="div_post_picture" style="display: none;">
Photo:
<input type="file" id="post_picture" name="post_picture">
</div>
<input type="hidden" id="post_id" name="post[id]">
<input type="hidden" value="110503" id="fb_page_profile_id">
<input type="hidden" name="post[clientTime]" id="clientTime" value="">
<input type="hidden" id="auto_schedule" name="auto_schedule" >
</div>
<div class="footerButtons">
<a source="TAG THIS PHOTO" id="btn-add-tag" href="j
void(0);">Tag this photo</a>
';
if($accounts and&isset($accounts['data']) and&count($accounts['data']) >0)
{;echo '
<!--<select id="post_page_id" name="post_profile[]" multiple="multiple">-->
';
echo "<input type='checkbox' id='selectall' name='selectall'> <b>Select All</b></br>";
foreach($accounts['data'] as $page)
{
if($page['category'] == 'Application') continue;
echo "<input type='checkbox' class='case chkbox' id='".$page['id']."' name='post_profile[".$page['id'] ."]' ";
if(isset($last_choice) and&is_array($last_choice) and&array_key_exists($page['id'],$last_choice)) echo "checked='checked'";
echo " > ".$page['name'] ."</br>";
}
echo "<input type='checkbox' class='case chkbox' id='".$userId."' name='post_profile[".$userId ."]'> ".$userData['name'] ."</br>";
;echo '
<!--</select>-->
';
};echo ' <br>
<div>
<input type="checkbox" id="repeat_check" name="post[repeat_check]"> Repeat this post every <input style="height: 15px;width: 50px;" type="text" id="repeat_interval" name="post[repeat_interval]" > <select id="repeat_type" name="post[repeat_type]" ><option value="4">Hours</option><option value="1">Days</option><option value="2">Weeks</option><option value="3">Months</option></select> until <input style="height: 15px;width: 150px;" type="text" id="repeat_till" name="post[repeat_till]" value="';echo date('Y-m-d',time()+30*24*60*60);;echo '" ></br>
<input type="checkbox" id="auto_delete" name="post[auto_delete]"> Auto delete this post from wall after <input style="height: 15px;width: 50px;" type="text" id="auto_del_time" name="post[auto_del_time]" value="30" > minutes</br>
</div>
<br>
<input type="submit" name="share" value="Post" source="SHARE" class="facebookButton" id="submit">
<!--<input type="submit" name="schedule" value="Auto Schedule" source="AUTO SCHEDULE" class="facebookButton" id="autoschedule">-->
<input type="button" name="schedule" value="Schedule" source="SCHEDULE" class="facebookButton" id="agendar">
</div>
<div id="photo-tagger-container">
<div id="photo-tagger">
<div class="photo-tagger-label">Escribe un nombre o etiqueta:</div>
<div class="photo-tagger-input"><input type="text" autocomplete="off" id="input-tag"></div>
</div>
<div id="photo-tagger-options"></div>
</div>
<div style="display: none;" id="content-tags">
Personas etiquetadas en esta foto: <span id="tags"></span>
<div id="hidden-tags"></div>
</div>
</form>
</div>
</div>
';
$page = (isset($_REQUEST['page']) ?$_REQUEST['page'] : 1);
$limit = 5;
$offset = ($page -1) * $limit;
$total = user::getPostCronScheduleCount();
$scheduleRes = user::getPostCronSchedule($offset,$limit);
if($scheduleRes)
{;echo '
<div class="posts">
<form o
nsubmit="return submitFormlist();" method="post" action="nada/nada" enctype="multipart/form-data" id="postlist_form">
<div id="div_postlist_datetime" style="display: none;">
<a style="background-position: 0pt 0pt;" title="Cancel" class="deletePostButton closeDatetime" id="closeDatetimelist"> </a>
When do you share?<br>
<input type="text" readonly="" name="postlist[datetime]" id="postlist_datetime">
</div>
</form>
';
foreach($scheduleRes as $sch)
{
$actor_id = ( trim($sch['uid']) ?$sch['uid'] : $sch['page_id']);
;echo '
<div id="post_';echo $sch['id'];echo '" class="post">
<div class="postProfile">
<img width="50" height="50" alt="';if(isset($accountsInfo[$actor_id])) echo $accountsInfo[$actor_id];echo '" src="';echo 'https://graph.facebook.com/'.$actor_id.'/picture?type=normal';echo '" o
nclick="window.open(\'https://www.facebook.com/profile.php?id=';echo $actor_id;echo '\'); return false;" class="ImageLink">
</div>
<div class="postContent">
<div class="postContentMessage">
<div class="topContent">
<div class="profileLink">
<a class="actor-name" target="_blank" href="https://www.facebook.com/profile.php?id=';echo $actor_id;echo '">';if(isset($accountsInfo[$actor_id])) echo $accountsInfo[$actor_id];;echo '</a>
</div>
<div id="postActions_';echo $sch['id'];echo '" class="action" style="display: none;">
<div class="deleteDiv">
<a o
nclick="deletePost(';echo $sch['id'];echo ', \'';echo $userId;echo '\')" class="deletePostButton" title="delete"> </a>
</div>
</div>
</div>
<div id="message_';echo $sch['id'];echo '" class="message editArea editable" title="Click to edit..." style="background-color: white; cursor: pointer;">';echo $sch['status_message'];echo '</div>
</div>
';
if($sch['status_type'] == 'link')
{;echo '
<div class="postContentLink">
';
if(trim($sch['photo_url']))
{;echo '
<div class="linkPicture">
<img src="';echo $sch['photo_url'];echo '" o
nclick="window.open(\'';echo $sch['link'];echo '\'); return false;" class="ImageLink PostImageLink">
</div>
';
};echo '
<div class="linkContent">
<div id="name_';echo $sch['id'];echo '" class="name edit editable" title="Click to edit" style="background-color: white; cursor: pointer;">';echo $sch['status_name'];echo '</div>
<div id="caption_';echo $sch['id'];echo '" class="caption edit editable" title="Click to edit" style="background-color: white; cursor: pointer;">';echo $sch['status_caption'];echo '</div>
<div id="description_';echo $sch['id'];echo '" class="description edit editable" title="Click to edit" style="background-color: white; cursor: pointer;">';echo $sch['status_description'];echo '</div>
</div>
</div>
';
}
else if($sch['status_type'] == 'photo')
{
$tokens = explode('/',$sch['photo_url']);
$url = $global['upload_link'].$tokens[count($tokens)-1];
;echo '
<div class="PostPicture">
<img src="';echo $url;echo '" o
nclick="window.open(\'';echo $url;echo '\'); return false;" class="ImageLink PostImage">
</div>
';
};echo '
</div>
<div class="postFooter">
<div class="date">
<input type="hidden" value="';echo simpleDate($sch['display_time']);echo '" id="datetimeUnformated_';echo $sch['id'];echo '">
<span class="editable datetimelistEditable" id="datetime_';echo $sch['id'];echo '" style="background-color: white; cursor: pointer;">
';echo formatDate($sch['display_time']);echo '
</span>
<a target="_blank" href="https://www.facebook.com/apps/application.php?id=';echo $global['app_id'];echo '" class="GrayLink">';echo $global['app_name'] ;echo '</a>
';if(isset($accountsInfo[$actor_id])) echo $accountsInfo[$actor_id];echo '
</div>
';;echo '
</div>
</div>
';
}
echo getPagination($page,$total,$limit,'index.php?i=1');
;echo '
</div>
';
}
else
{;echo '
';
};echo '
</div>
<a href="" id="check-perms"></a>
';include("includes/footer.php");;echo '
<script type="text/javascript" src="';echo $global['home_link'];echo 'js/editable.js?v=3"></script>
<script type="text/javascript" src="';echo $global['home_link'];echo 'js/list.js?v=3"></script>
<script>
var userID = \'';echo $userId;echo '\';
var tab = \'\';
function getCurrentTime()
{
var d = new Date();
var month = (d.getMonth()+1);
var numberDay = d.getDate();
var formatTime = d.getFullYear()+\'-\'+(month < 10 ? \'0\'+month : month)+\'-\'+(numberDay < 10 ? \'0\'+numberDay : numberDay)+\' \'+d.getHours()+\':\'+d.getMinutes()+\':00\';
return formatTime;
}
$(document).ready(function ()
{
getCurrentTime();
//ensure_init("donoting");
//date picket show
$("#agendar").click(function(){
InitDatetimePicker();
//$("#auto_schedule").val("1");
$("#div_post_datetime").show(300);
});
$("#ui-datepicker-close").show();
$(\'#repeat_till\').datepicker({minDate:0, dateFormat: \'yy-mm-dd\', showButtonPanel: false});
$("#datetime_done").click(function(){
alert("hnjghjhg");
$("#ui-datepicker-div").hide();
});
$("#autoschedule").click(function(){
//InitDatetimePicker();
$("#auto_schedule").val("1");
//$("#div_post_datetime").show(300);
if($(\'#photo-tagger-container\').is(\':visible\'))
return false;
else
return submitForm();
});
/* Top Menus toggle*/
$(\'#status\').click(function(){
tab = \'status\';
$(\'#btn-add-tag\').hide();
});
$(\'#link\').click(function(){
tab = \'link\';
$(\'#btn-add-tag\').hide();
});
$(\'#photo\').click(function(){
tab = \'photo\';
$(\'#btn-add-tag\').hide();
});
/* parse and get url data*/
$(\'.linkSubmit\').click(function() {
getUrlContent($(\'#post_link\').val());
});
$(\'#post_form\').submit(function(){
if($(\'#photo-tagger-container\').is(\':visible\'))
return false;
else
return submitForm();
});
// add multiple select / deselect functionality
$("#selectall").click(function () {
$(\'.case\').attr(\'checked\', this.checked);
});
// if all checkbox are selected, check the selectall checkbox
// and viceversa
$(".case").click(function(){
if($(".case").length == $(".case:checked").length) {
$("#selectall").attr("checked", "checked");
} else {
$("#selectall").removeAttr("checked");
}
});
});
//Cada vez que cambie el tipo de publicacion, limpio los campos no usados y los oculto
$(\'#post_type\').change(function() {
typeSelectorChange($("#post_type").val());
});
//<<Reload>> Cada vez que cambie el tipo de publicacion, limpio los campos no usados y los oculto
$(\'.postTypeButton\').click(function() {
$("#post_type").val(this.id);
typeSelectorChange(this.id);
});
function typeSelectorChange(newValue)
{
switch (newValue)
{
case "status":
$(".postTypeChooser").css(\'background-position\',\'78px 18px\');
superHide (["message","description","caption","link","linkedition","name","picture","imagechooser"]);
$("#post_message").blur();
$(\'#div_post_message\').show();
$(\'#post_message\').show();
break;
case "link":
$(".postTypeChooser").css(\'background-position\',\'155px 18px\');
superHide (["message","description","caption","link","linkedition","name","picture","imagechooser"]);
$("#post_message").blur();
$("#post_link").blur();
$(\'#div_post_link\').show();
$(\'#post_link\').show();
break;
case "photo":
$(".postTypeChooser").css(\'background-position\',\'230px 18px\');
superHide (["message","description","caption","link","linkedition","name","picture","imagechooser"]);
$("#post_message").blur();
superShow(["picture","message"]);
break;
case "twitt":
$(".postTypeChooser").css(\'background-position\',\'303px 18px\');
superHide (["message","description","caption","link","linkedition","name","picture","imagechooser"]);
$("#post_message").blur();
$(\'#div_post_message\').show();
$(\'#post_message\').show();
break;
}
}
function superHide(arrayToHide)
{
for (c=0; c < arrayToHide.length; c++)
{
$(\'#div_post_\'+arrayToHide[c]).hide();
if(arrayToHide[c]=="picture")
$(\'.imagePostEditing\').hide();
}
}
function superShow(arrayToShow)
{
for (c=0; c < arrayToShow.length; c++)
{
$(\'#div_post_\'+arrayToShow[c]).show();
if(arrayToShow[c]=="picture")
$(\'.imagePostEditing\').show();
}
}
var stringI18N = new Array ();
stringI18N["promptTimes"] = "How many times do you want to multiply the post? (21 or less)";
stringI18N["promptDays"] = "How often many days?";
stringI18N["promptRefresh"] = "Do you want to refresh to see changes?";
stringI18N["promptDelete"] = "Are you sure you want to delete the post?";
stringI18N["messageCanceled"] = "Canceled";
stringI18N["messageWOYMind"]="What\'s on your mind?";
stringI18N["messageMiss"]="The following errors were found";
stringI18N["messageRightNow"]="";
stringI18N["messageSavePost"]="Save";
stringI18N["messageSaveWait"]="Please Wait";
stringI18N["messageSaveClickToEdit"]="Edit";
stringI18N["messageSubmitErrorPage"]="Missing Fan Page";
stringI18N["messageSubmitErrorMessage"]="Message is required";
stringI18N["messageSubmitErrorLink"]="Link is required";
stringI18N["messageSubmitErrorImageFormat"]="The selected image is not valid type (jpg, png or gif)";
stringI18N["messageSubmitErrorImageMissing"]="Choose an image to upload";
stringI18N["messageWriteSomething"]= "Write something first";
stringI18N["setHour"]= "Set hour";
stringI18N["exceededMax"] = "Exceeded maxium selection limit of ';echo $global['max_sel'];;echo '";
//stringI18N["messageThanks1"]= "Thanks for your help";
function InitDatetimePicker()
{
var date;
';if(isset($last_choice['time'])) {;echo ' date = new Date(\'';echo date("M d, Y H:i:s",strtotime($last_choice['time']));;echo '\');
';}else{;echo ' date = new Date();
';};echo '
$("#post_datetime").val("messageRightNow");
//Los cambios se guardan en #timepicker_alt
$("#div_post_datetime").append(\'<div id="post_datetime_inline"></div><input type="hidden" id="timepicker_alt"/>\')
$(\'#post_datetime_inline\').datetimepicker({
altField: \'#timepicker_alt\',
dateFormat: \'yy-mm-dd\',
defaultDate: date,
timeFormat: \'hh:mm\',
minDate: 0,
hour: date.getHours(),
minute: date.getMinutes(),
//minute: 24
})
//este hack es por q #post_datetime_inline aveces tiene una hora y otra veces tiene un date solo
//entonces segun que tenga lo tomo o no, y lo junto con la hora resultante del timepicker_alt, un quilombo
.change(function() {
nuevoValor = $("#post_datetime_inline").val();
if(nuevoValor.search(":") == -1){//alert(nuevoValor + " " + $(\'#timepicker_alt\').val()+ ":00");
$("#post_datetime").val(nuevoValor + " " + $(\'#timepicker_alt\').val()+ ":00");
if(new Date() >= parseSymfonyDatetime($("#post_datetime").val())) {//alert("kkkk");
//$("#post_datetime").val(stringI18N["messageRightNow"]);
}
}
});
// Boton cerrar calendario
$("#closeDatetime").click(function(){
$("#div_post_datetime").hide(300);
$(\'#post_datetime_inline\').datetimepicker(\'setDate\', (desiredDate) );
});
$("#post_datetime").attr("readonly","readonly");
if ($("#post_datetime").val()) {
//desiredDate = parseSymfonyDatetime($("#post_datetime").val());
//alert(desiredDate);
';if(isset($last_choice['time'])) {;echo ' desiredDate = new Date(\'';echo date("M d, Y H:i:s",strtotime($last_choice['time']));;echo '\');
';}else{;echo ' desiredDate = new Date();
';};echo ' } else {
';if(isset($last_choice['time'])) {;echo ' desiredDate = new Date(\'';echo date("M d, Y H:i:s",strtotime($last_choice['time']));;echo '\');
';}else{;echo ' desiredDate = new Date();
';};echo '
}
$(\'#post_datetime_inline\').datetimepicker(\'setDate\', (desiredDate) );
}
function parseSymfonyDatetime(v)
{
return new Date(v[0]+v[1]+v[2]+v[3],((v[5]+v[6])-1), v[8]+v[9], v[11]+v[12], v[14]+v[15], 0, 0);
}
function submitForm()
{
pass = false;
post_type = $("#post_type").val();
error_msg = "";
/*
if($("#post_page_id").val() == "" || $("#post_page_id").val() == null)
{
error_msg = error_msg + "* "+ stringI18N["messageSubmitErrorPage"] + "\\n";
}
*/
var checkFound = false;
var n = $("input:checkbox.chkbox:checked").length;
';
if($global['max_sel'] >0){
;echo '
if(n > ';echo $global['max_sel'];;echo '){
error_msg = error_msg + "* "+ stringI18N["exceededMax"] + "\\n";
}
';};echo '
for (var counter=0; counter < post_form.length; counter++) {
if ((post_form.elements[counter].type == "checkbox") and& (post_form.elements[counter].checked == true)) {
checkFound = true;
}
}
if (checkFound != true) {
error_msg = error_msg + "* "+ stringI18N["messageSubmitErrorPage"] + "\\n";
}
switch(post_type)
{
case "status":
if($("#post_message").val().length == 0)
{
error_msg = error_msg + "* "+ stringI18N["messageSubmitErrorMessage"] + "\\n";
}
break;
case "link":
if($("#post_caption").val().length == 0)
{
error_msg = error_msg + "* "+ stringI18N["messageSubmitErrorLink"] + "\\n";
}
if($("#no_picture").is(":checked"))
{
$("#post_linkimage").val("");
$("#post_picture").val("");
}
else
{
if($("#custom_picture").is(":checked"))
{
$("#post_linkimage").val("");
file = $("#post_picture").val();
if(file.length > 0)
{
mime = file.substr(file.lastIndexOf(\'.\'));
if(mime!= \'.gif\' and& mime!= \'.jpg\' and& mime!= \'.jpeg\' and& mime!= \'.png\' and& mime!= \'.GIF\' and& mime!= \'.JPG\' and& mime!= \'.JPEG\' and& mime!= \'.PNG\')
error_msg = error_msg + "* "+ stringI18N["messageSubmitErrorImageFormat"] + "\\n";
}
}
else
{
$("#post_picture").val("");
}
}
break;
case "photo":
file = $("#post_picture").val();
oldImage=$(".imagePostEditing").attr("src");
if(file.length == 0)
{
if(!oldImage.length > 0)//puede que esté editando
error_msg = error_msg + "* "+ stringI18N["messageSubmitErrorImageMissing"] + "\\n";
}
else
{
mime = file.substr(file.lastIndexOf(\'.\'));
if(mime!= \'.gif\' and& mime!= \'.jpg\' and& mime!= \'.jpeg\' and& mime!= \'.png\' and& mime!= \'.GIF\' and& mime!= \'.JPG\' and& mime!= \'.JPEG\' and& mime!= \'.PNG\')
error_msg = error_msg + "* "+ stringI18N["messageSubmitErrorImageFormat"] + "\\n";
}
break;
}
/*var pendingPost = verifyPendingPost();
if(pendingPost[\'error\'])
{
jConfirm(pendingPost[\'error\'], \'Error\', function®{
if®
{
window.location = pendingPost[\'redirect\'];
}
});
return false;
}*/
if(error_msg == "")
{
pass= true
}
else
{
jAlert("\\n"+ stringI18N["messageMiss"] + ":\\n\\n" + error_msg, \'Error\');
}
var clientTime = getCurrentTime();
$(\'#clientTime\').val(clientTime);
return pass;
}
function getUrlContent(url)
{
url = escape(url);
$.ajax({
type: "POST",
url: callbackURL+\'ajax.php\',
data: \'url=\' + url + \'&action=getUrlContent\',
dataType: \'json\',
success: function(data)
{
if(!data[\'error\'])
{
editeLinkOk(data);
}
else
{
alert(data[\'message\']);
}
}
});
}
var imageLinkNum;
var imageLinkCurrent;
var imageLinkArray;
function editeLinkOk(data)
{
$("#post_caption").val($("#post_link").val());
$("#post_link").val(data[\'url\']);
$("#post_message").val(\'\');
$("#post_name").val(data[\'title\']);
$("#post_description").val(data[\'description\']);
//ResizeTextarea();
$(\'#post_description\').css("height", "auto")
$(\'#div_post_link\').hide();
$(\'#post_link\').hide();
try
{
delete window.imageLinkArray;
delete window.imageLinkNum;
}catch(e){window["imageLinkArray"] = undefined;window["imageLinkNum"] = undefined;}
imageLinkArray = data["images"];
imageLinkNum = data["numImages"];
changeImage("starting");
superShow(["linkedition","message","imagechooser","caption","name","description"]);
$("#post_description").click();
}
function changeImage(way)
{
$("#linkImage").attr("src", \'images/loading.gif\');
if(way == "starting")
{
if(imageLinkNum >= 1)
{
imageLinkCurrent = 1;
}
}
if(way == "nextImg")
{
if(imageLinkCurrent < imageLinkNum)
{
imageLinkCurrent++;
}
}
else if(way == "prevImg")
{
if(imageLinkCurrent > 1)
{
imageLinkCurrent--;
}
}
if(imageLinkNum >= 1)
{
var linkImage = escape(imageLinkArray[imageLinkCurrent-1]);
$("#post_linkimage").val(imageLinkArray[imageLinkCurrent-1]);
$("#linkImage").attr("src", unescape(linkImage));
$("#labelImageChooser").html("" + imageLinkCurrent + " of " + imageLinkNum);
$(\'#custom_picture\').attr(\'checked\', false);
}
else
{//cuando no se trajo ninguna imagen
$(\'#custom_picture\').attr(\'checked\', true);//
superShow(["picture","message"]);
$("#linkImageSwitcherDiv a").hide();//
$("#post_linkimage").val("");//
$("#linkImage").attr("src", "");//
$("#labelImageChooser").html("No image for this site");//
}
}
$(\'#prevImg\').mousedown(function() {
$("#prevImg img").attr("src","images/arrowleft.gif");
});
$(\'#prevImg\').mouseup(function() {
$("#prevImg img").attr("src","images/arrowleftw.gif");
});
$(\'#nextImg\').mousedown(function() {
$("#nextImg img").attr("src","images/arrowright.gif");
});
$(\'#nextImg\').mouseup(function() {
$("#nextImg img").attr("src","images/arrowrightw.gif");
});
$(".linkImageSwitcher").click(function(){
changeImage(this.id);
});
$("#post_description").hover(function () {
$(this).css(\'background-color\',\'#ffff99\');
$(this).css(\'cursor\',\'pointer\');
},
function () {
$(this).css(\'background-color\',\'white\');
});
$(".facebookButton").hover(function () {
$(this).css(\'background-color\',\'#4F6AA3\');
},
function () {
$(this).css(\'background-color\',\'#617AAC\');
});
$("#post_caption").hover(function () {
$(this).css(\'background-color\',\'#ffff99\');
$(this).css(\'cursor\',\'pointer\');
},
function () {
$(this).css(\'background-color\',\'white\');
});
$("#post_name").hover(function () {
$(this).css(\'background-color\',\'#ffff99\');
$(this).css(\'cursor\',\'pointer\');
},
function () {
$(this).css(\'background-color\',\'white\');
});
$("#no_picture").click(function(){
if($(this).is(":checked")){
$("#linkImageSwitcherDiv").hide();
$("#linkPicture").hide();
$("#div_post_picture").hide();
$("#linkImageCustomDiv").hide();
}
else{
$("#linkImageSwitcherDiv").show();
$("#linkPicture").show();
$("#linkImageCustomDiv").show();
}
});
$("#custom_picture").click(function(){
if($(this).is(":checked"))
{
$("#linkImageSwitcherDiv").hide();
$("#linkPicture").hide();
superShow(["picture","message"]);
}
else
{
$("#div_post_picture").hide();
$("#linkImageSwitcherDiv").show();
$("#linkPicture").show();
}
});
function verifyPendingPost()
{
var pendingPost = \'\';
$.ajax({
type: "POST",
url: \'/ajax_verify_pending_posts\',
dataType: \'json\',
async: false,
success: function(data) {
pendingPost = data;
}
});
return pendingPost;
}
//$(\'#custom_picture\').attr(\'checked\', false);
//$(\'#no_picture\').attr(\'checked\', false);
</script>'; ?>