예제 #1
0
function GetCalendarsByRange()
{
    $ret = array();
    $view_Type = getPref('viewtype');
    // week,month,day
    $str_show_day = getPref('showdate');
    // 当前是那一天
    $clientzone = getPref('timezone');
    $serverzone = TIMEZONE_INDEX;
    $zonediff = $serverzone - $clientzone;
    $showday = strtodate($str_show_day);
    if (($timestamp = date_timestamp_get($showday)) === false) {
        echo 1;
        $ret["error"] = array("ErrorCode" => "NotVolidDateTimeFormat", "ErrorMsg" => msg("notvoliddatetimeformat"));
        //替换成
    } else {
        $dataformat = GetCalendarViewFormat($view_Type, $timestamp);
        $qstart = $dataformat['start_date'] + $zonediff * 3600;
        $qend = $dataformat['end_date'] + $zonediff * 3600;
        //查询数据库 GetClientIP();
        // {"start":start,"end":end,"error":error,"issort":issort,"events":jsonlist}
        $ret["start"] = TimestampToJsonTime($dataformat['start_date']);
        $ret["end"] = TimestampToJsonTime($dataformat['end_date']);
        $ret["error"] = NUll;
        $ret["issort"] = TRUE;
        //print_r($ret);
        $ret["events"] = DbQueryCalendars(date("Y-m-d H:i:s", $qstart), date("Y-m-d H:i:s", $qend), GetClientIP(), $zonediff);
    }
    echo json_encode($ret);
}
예제 #2
0
 $user_editor = retrieve(POST, 'user_editor', '');
 $user_timezone = retrieve(POST, 'user_timezone', 0);
 $user_avatar = retrieve(POST, 'user_avatar', '');
 $user_local = retrieve(POST, 'user_local', '');
 $user_occupation = retrieve(POST, 'user_occupation', '');
 $user_hobbies = retrieve(POST, 'user_hobbies', '');
 $user_desc = retrieve(POST, 'user_desc', '', TSTRING_PARSE);
 $user_sex = retrieve(POST, 'user_sex', 0);
 $user_sign = retrieve(POST, 'user_sign', '', TSTRING_PARSE);
 $user_msn = retrieve(POST, 'user_msn', '');
 $user_yahoo = retrieve(POST, 'user_yahoo', '');
 $user_web = retrieve(POST, 'user_web', '');
 if (!empty($user_web) && strpos($user_web, '://') === false) {
     $user_web = 'http://' . $user_web;
 }
 $user_born = strtodate(retrieve(POST, 'user_born', '0'), $LANG['date_birth_parse']);
 import('util/captcha');
 $Captcha = new Captcha();
 $Captcha->set_difficulty($CONFIG_USER['verif_code_difficulty']);
 if (!($CONFIG_USER['verif_code'] == '1') || $Captcha->is_valid()) {
     if (strlen($login) >= 3 && strlen($password) >= 6 && strlen($password_bis) >= 6) {
         if (!empty($login) && !empty($user_mail) && $password_hash === $password_bis_hash) {
             ####Vérification de la validité de l'avatar####
             $user_avatar = '';
             //Gestion upload d'avatar.
             $dir = '../images/avatars/';
             import('io/upload');
             $Upload = new Upload($dir);
             if (is_writable($dir) && $CONFIG_USER['activ_up_avatar'] == 1) {
                 if ($_FILES['avatars']['size'] > 0) {
                     $Upload->file('avatars', '`([a-z0-9()_-])+\\.(jpg|gif|png|bmp)+$`i', UNIQ_NAME, $CONFIG_USER['weight_max'] * 1024);
 protected static function __parseXmlToObject($node, $node_class, $parse_attributes)
 {
     if ($node_class != null) {
         if ($node_class == 'array') {
             $obj = array();
         } else {
             $obj = new $node_class();
         }
     } else {
         $obj = new RecurlyObject();
     }
     while ($node) {
         if ($node->nodeType == XML_TEXT_NODE) {
             if ($node->wholeText != null) {
                 $text = trim($node->wholeText);
                 if (strlen($text) > 0) {
                     $obj->message = $text;
                 }
             }
         } else {
             if ($node->nodeType == XML_ELEMENT_NODE) {
                 $nodeName = str_replace("-", "_", $node->nodeName);
                 if (is_array($obj)) {
                     $child_node_class = RecurlyClient::$class_map[$nodeName];
                     $new_obj = RecurlyClient::__parseXmlToObject($node->childNodes->item(0), $child_node_class, $parse_attributes);
                     if ($parse_attributes) {
                         foreach ($node->attributes as $attrName => $attrNode) {
                             $nodeName = str_replace("-", "_", $attrName);
                             $nodeValue = $attrNode->nodeValue;
                             if (!is_numeric($nodeValue) && ($tmp = strtotime($nodeValue))) {
                                 $new_obj->{$nodeName} = $tmp;
                             } else {
                                 if ($nodeValue == "false") {
                                     $new_obj->{$nodeName} = false;
                                 } else {
                                     if ($nodeValue == "true") {
                                         $new_obj->{$nodeName} = true;
                                     } else {
                                         $new_obj->{$nodeName} = $nodeValue;
                                     }
                                 }
                             }
                         }
                     }
                     $obj[] = $new_obj;
                     $node = $node->nextSibling;
                     continue;
                 }
                 if ($node->getAttribute('nil')) {
                     $obj->{$nodeName} = null;
                 } else {
                     switch ($node->getAttribute('type')) {
                         case 'boolean':
                             $obj->{$nodeName} = $node->nodeValue == 'true';
                             break;
                         case 'date':
                             $obj->{$nodeName} = strtodate($node->nodeValue);
                             break;
                         case 'datetime':
                             $obj->{$nodeName} = strtotime($node->nodeValue);
                             break;
                         case 'float':
                             $obj->{$nodeName} = (double) $node->nodeValue;
                             break;
                         case 'integer':
                             $obj->{$nodeName} = (int) $node->nodeValue;
                             break;
                         default:
                             $obj->{$nodeName} = $node->nodeValue;
                     }
                 }
                 if ($node->childNodes->length > 1) {
                     $child_node_class = RecurlyClient::$class_map[$nodeName];
                     if ($child_node_class != '') {
                         $obj->{$nodeName} = RecurlyClient::__parseXmlToObject($node->childNodes->item(0), $child_node_class, $parse_attributes);
                     }
                 }
                 if ($parse_attributes) {
                     foreach ($node->attributes as $attrName => $attrNode) {
                         $nodeName = str_replace("-", "_", $attrName);
                         $nodeValue = $attrNode->nodeValue;
                         if (!is_numeric($nodeValue) && ($tmp = strtotime($nodeValue))) {
                             $obj->{$nodeName} = $tmp;
                         } else {
                             if ($nodeValue == "false") {
                                 $obj->{$nodeName} = false;
                             } else {
                                 if ($nodeValue == "true") {
                                     $obj->{$nodeName} = true;
                                 } else {
                                     $obj->{$nodeName} = $nodeValue;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $node = $node->nextSibling;
     }
     return $obj;
 }
예제 #4
0
파일: submit.php 프로젝트: rasomu/chuza
function link_errors($linkres) {
	$error = false;

	// Errors

  $start_date = strtodate($linkres->start_date);
  $end_date = strtodate($linkres->end_date);

  if ($start_date>$end_date) {
		print_form_submit_error(_("A segunda data non pode ser anterior á primeira"));
		$error = true;
  }

	if(! check_link_key() || intval($_POST['randkey']) != $linkres->randkey) {
		print_form_submit_error(_("clave incorrecta"));
		$error = true;
	}
	if($linkres->status != 'discard') {
		//echo '<br style="clear: both;" />';
		print_form_submit_error(_("la historia ya está en cola").": $linkres->status");
		$error = true;
	}
	if(strlen($linkres->title) < 10  || strlen($linkres->content) < 30 ) {
		print_form_submit_error(_("título o texto incompletos"));
		$error = true;
	}
	if(get_uppercase_ratio($linkres->title) > 0.25  || get_uppercase_ratio($linkres->content) > 0.25 ) {
		print_form_submit_error(_("demasiadas mayúsculas en el título o texto"));
		$error = true;
	}
	if(mb_strlen(html_entity_decode($linkres->title, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 120  || mb_strlen(html_entity_decode($linkres->content, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 550 ) {
		print_form_submit_error(_("título o texto demasiado largos"));
		$error = true;
	}
	if(strlen($linkres->tags) < 3 ) {
		print_form_submit_error(_("no has puesto etiquetas"));
		$error = true;
	}

	if(preg_match('/.*http:\//', $linkres->title)) {
		//echo '<br style="clear: both;" />';
		print_form_submit_error(_("por favor, no pongas URLs en el título, no ofrece información"));
		$error = true;
	}
	if(!$linkres->category > 0) {
		//echo '<br style="clear: both;" />';
		print_form_submit_error(_("categoría no seleccionada"));
		$error = true;
	}
	return $error;
}
예제 #5
0
 $user_sex = retrieve(POST, 'user_sex', 0);
 $user_sign = retrieve(POST, 'user_sign', '', TSTRING_PARSE);
 $user_msn = retrieve(POST, 'user_msn', '');
 $user_yahoo = retrieve(POST, 'user_yahoo', '');
 $user_warning = retrieve(POST, 'user_warning', 0);
 $user_readonly = retrieve(POST, 'user_readonly', 0);
 $user_readonly = $user_readonly > 0 ? time() + $user_readonly : 0;
 $user_ban = retrieve(POST, 'user_ban', 0);
 $user_ban = $user_ban > 0 ? time() + $user_ban : 0;
 $user_web = retrieve(POST, 'user_web', '');
 if (!empty($user_web) && substr($user_web, 0, 7) != 'http://' && substr($user_web, 0, 6) != 'ftp://' && substr($user_web, 0, 8) != 'https://') {
     $user_web = 'http://' . $user_web;
 }
 $array_user_groups = isset($_POST['user_groups']) ? $_POST['user_groups'] : array();
 $Group->edit_member($id_post, $array_user_groups);
 $user_born = strtodate($_POST['user_born'], $LANG['date_birth_parse']);
 if (!empty($_POST['delete_avatar'])) {
     $user_avatar_path = $Sql->query("SELECT user_avatar FROM " . DB_TABLE_MEMBER . " WHERE user_id = '" . $id_post . "'", __LINE__, __FILE__);
     if (!empty($user_avatar_path)) {
         $user_avatar_path = str_replace('../images/avatars/', '', $user_avatar_path);
         $user_avatar_path = str_replace('/', '', $user_avatar_path);
         @unlink('../images/avatars/' . $user_avatar_path);
     }
     $Sql->query_inject("UPDATE " . DB_TABLE_MEMBER . " SET user_avatar = '' WHERE user_id = '" . $id_post . "'", __LINE__, __FILE__);
 }
 $user_avatar = '';
 $dir = '../images/avatars/';
 import('io/upload');
 $Upload = new Upload($dir);
 if (is_writable($dir)) {
     if ($_FILES['avatars']['size'] > 0) {
예제 #6
0
 /**
  * @brief after a qeustion is created in the popup window, register the question during the save time
  */
 function procPollInsert()
 {
     $stop_date = intval(Context::get('stop_date'));
     // mobile input date format can be different
     if ($stop_date != Context::get('stop_date')) {
         $stop_date = date('Ymd', strtodate(Context::get('stop_date')));
     }
     if ($stop_date < date('Ymd')) {
         $stop_date = date('YmdHis', $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 30);
     }
     $logged_info = Context::get('logged_info');
     $vars = Context::getRequestVars();
     $args = new stdClass();
     $tmp_args = array();
     unset($vars->_filter);
     unset($vars->error_return_url);
     unset($vars->stop_date);
     foreach ($vars as $key => $val) {
         if (stripos($key, 'tidx')) {
             continue;
         }
         $tmp_arr = explode('_', $key);
         $poll_index = $tmp_arr[1];
         if (!$poll_index) {
             continue;
         }
         if (!trim($val)) {
             continue;
         }
         if ($tmp_args[$poll_index] == NULL) {
             $tmp_args[$poll_index] = new stdClass();
         }
         if (!is_array($tmp_args[$poll_index]->item)) {
             $tmp_args[$poll_index]->item = array();
         }
         if ($logged_info->is_admin != 'Y') {
             $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
         }
         switch ($tmp_arr[0]) {
             case 'title':
                 $tmp_args[$poll_index]->title = $val;
                 break;
             case 'checkcount':
                 $tmp_args[$poll_index]->checkcount = $val;
                 break;
             case 'item':
                 $tmp_args[$poll_index]->item[] = $val;
                 break;
         }
     }
     foreach ($tmp_args as $key => $val) {
         if (!$val->checkcount) {
             $val->checkcount = 1;
         }
         if ($val->title && count($val->item)) {
             $args->poll[] = $val;
         }
     }
     if (!count($args->poll)) {
         return new Object(-1, 'cmd_null_item');
     }
     $args->stop_date = $stop_date;
     // Configure the variables
     $poll_srl = getNextSequence();
     $member_srl = $logged_info->member_srl ? $logged_info->member_srl : 0;
     $oDB =& DB::getInstance();
     $oDB->begin();
     // Register the poll
     $poll_args = new stdClass();
     $poll_args->poll_srl = $poll_srl;
     $poll_args->member_srl = $member_srl;
     $poll_args->list_order = $poll_srl * -1;
     $poll_args->stop_date = $args->stop_date;
     $poll_args->poll_count = 0;
     $poll_args->poll_type = $vars->show_vote + $vars->add_item;
     $output = executeQuery('poll.insertPoll', $poll_args);
     if (!$output->toBool()) {
         $oDB->rollback();
         return $output;
     }
     // Individual poll registration
     foreach ($args->poll as $key => $val) {
         $title_args = new stdClass();
         $title_args->poll_srl = $poll_srl;
         $title_args->poll_index_srl = getNextSequence();
         $title_args->title = $val->title;
         $title_args->checkcount = $val->checkcount;
         $title_args->poll_count = 0;
         $title_args->list_order = $title_args->poll_index_srl * -1;
         $title_args->member_srl = $member_srl;
         $title_args->upload_target_srl = $vars->upload_target_srl;
         $output = executeQuery('poll.insertPollTitle', $title_args);
         if (!$output->toBool()) {
             $oDB->rollback();
             return $output;
         }
         // Add the individual survey items
         foreach ($val->item as $k => $v) {
             $item_args = new stdClass();
             $item_args->poll_srl = $poll_srl;
             $item_args->poll_index_srl = $title_args->poll_index_srl;
             $item_args->title = $v;
             $item_args->poll_count = 0;
             $item_args->upload_target_srl = $vars->upload_target_srl;
             $output = executeQuery('poll.insertPollItem', $item_args);
             if (!$output->toBool()) {
                 $oDB->rollback();
                 return $output;
             }
         }
     }
     $oDB->commit();
     $this->add('poll_srl', $poll_srl);
     $this->setMessage('success_registed');
 }
예제 #7
0
파일: scrape.php 프로젝트: hubgit/ecsstract
function parse_item($node, $defs, $fix)
{
    $d = new DOMDocument();
    $d->appendChild($d->importNode($node, TRUE));
    $zend = new Zend_Dom_Query($d->saveHTML());
    //debug($d->saveHTML());
    $properties = array();
    foreach ($defs->properties as $property => $def) {
        if (is_string($def)) {
            $def = (object) array('selector' => $def);
        }
        //debug($def);
        if ($def->selector) {
            $t = array();
            foreach ($zend->query($def->selector) as $selected) {
                $t[] = $selected;
            }
            $item = $t[0];
        } else {
            $item = $node;
        }
        if (!$item) {
            continue;
        }
        if ($def->derived) {
            $data = $properties[$def->derived];
        } else {
            $data = format($item, $def);
        }
        if (function_exists($fix)) {
            $data = call_user_func($fix, $property, $data);
        }
        if ($def->date) {
            $data = strtodate($def->date, $data);
        }
        $properties[$property] = $data;
    }
    if (!($properties['dc:identifier'] && $properties['dc:date'] && $properties['dc:title'])) {
        return FALSE;
    }
    $properties['dc:identifier'] = base_url($properties['dc:identifier']);
    if (!$properties['start']) {
        $properties['start'] = strtotime($properties['dc:date']);
    }
    if (!$properties['end'] && is_numeric($properties['start'])) {
        $properties['end'] = $properties['start'] + 3600;
    }
    // 1hr
    return $properties;
}
예제 #8
0
include 'inc/php_functions.inc.php';
include 'inc/dbconnect.inc.php';
$result = FALSE;
/*
 * Check $_GET['param'] */
if (!ctype_digit($_GET['param'])) {
    exit('Error: param');
}
if ($_POST) {
    /* 
     * Check input */
    $post_date = strtodate($_POST['date']);
    if ($post_date == false || $post_date == 'NULL') {
        exit('Fehler: Buchungsdatum');
    }
    $post_for_date = strtodate('00.' . $_POST['for_month'] . '.' . $_POST['for_year']);
    if ($post_for_date == false) {
        exit('Fehler: Datum');
    }
    if (!ctype_digit($_POST['amount_kind'])) {
        exit('Fehler: Art');
    }
    if (!is_numeric($_POST['amount'])) {
        if (ctype_digit(str_replace(',', '', $_POST['amount']))) {
            $amount = str_replace(',', '.', $_POST['amount']);
        } else {
            exit('Fehler: Kosten');
        }
    } else {
        $amount = $_POST['amount'];
    }
예제 #9
0
function sd($format, $datetime = null)
{
    return strtodate($format, $datetime);
}
예제 #10
0
  <?php 
include 'inc/php_functions.inc.php';
include 'inc/dbconnect.inc.php';
$result = FALSE;
if ($_POST) {
    /* 
     * Check input */
    $post_name = mysqli_real_escape_string($db, $_POST['name']);
    if (!ctype_digit($_POST['persons']) || !($_POST['persons'] < 11)) {
        exit('Fehler: Personen');
    }
    $post_entry = strtodate($_POST['entry']);
    if ($post_entry == false || $post_entry == 'NULL') {
        exit('Fehler: Einzugsdatum');
    }
    $post_extract = strtodate($_POST['extract']);
    if ($post_extract == false) {
        exit('Fehler: Auszugsdatum');
    }
    if (!ctype_digit($_POST['apartment_id'])) {
        exit('Fehler: Wohnung');
    }
    /*
     * Put in database */
    $query = 'INSERT INTO
                  tenant
                VALUES (\'\',\'' . $post_name . '\',\'' . $_POST['persons'] . '\',' . $post_entry . ',' . $post_extract . ',\'' . $_POST['apartment_id'] . '\')';
    $result = mysqli_real_query($db, $query);
}
/*
 * Check $_GET['param'] */