/**
  * Các phần tử ở phía góc top-right so với phần tử ($i,$j)
  * @param $i
  * @param $j
  */
 public function group_top_right_items($i, $j)
 {
     if ($i >= 1) {
         $ds = array('max', true);
         $res = array();
         for ($q = 0; $q < $i + 1; $q++) {
             $ds_ = $this->get_row_items($q);
             shift($ds_, $j + 1);
             if (count($ds_)) {
                 $ds[] = $ds_;
             }
         }
         //if($i==1&&$j==2) out1($ds);
         if (count($ds) > 2) {
             $res = cross_array($ds);
             if (!count($res)) {
                 $ds[0] = 'min';
                 $res = cross_array($ds);
             }
             return $res;
         } else {
             return false;
         }
     }
     return false;
 }
Пример #2
0
function decode($encryptedText, $key)
{
    $newString = "";
    for ($i = 0; $i < strlen($encryptedText); $i++) {
        $newString .= shift($encryptedText[$i], -$key);
    }
    return $newString;
}
Пример #3
0
function encrypt_message($str, $sh)
{
    $length = strlen($str);
    for ($i = 0; $i < $length; $i++) {
        $res[$i] = shift($str[$i], $sh);
    }
    $tmp['result'] = implode($res);
    echo json_encode($tmp);
}
Пример #4
0
 function getUser()
 {
     if(!isset($_SESSION['user_id']))
         return false;
     
     $where = "user_id = '".$_SESSION['user_id']."' ";
     $user = shift(select('*', 'users', $where));
     
     return $user;
 }
Пример #5
0
function encrypt_message($str)
{
    $sh = getFrequencyShift($str);
    $length = strlen($str);
    for ($i = 0; $i < $length; $i++) {
        $res[$i] = shift($str[$i], $sh);
    }
    $tmp['result'] = implode($res);
    $tmp['shift'] = $sh;
    echo json_encode($tmp);
}
Пример #6
0
 function array_map()
 {
     $arrays = get_func_args();
     $callback = shift($arrays);
     $r =& $arrays[0];
     foreach ($r as $key => $val) {
         $val = call_user_func_array($callback, $arrays);
         $r[$key] = $val;
     }
     return $r;
 }
Пример #7
0
    /**
     * Get the director decisions for a review round of a paper.
     * @param $paperId int
     * @param $round int
     */
    function getDirectorDecisions($paperId, $round = null)
    {
        $decisions = array();
        $args = array($paperId);
        if ($round) {
            $args[] = $round;
        }
        $result =& $this->retrieve('
			SELECT edit_decision_id, director_id, decision, date_decided
			FROM edit_decisions
			WHERE paper_id = ?' . ($round ? ' AND round = ?' : '') . ' ORDER BY edit_decision_id ASC', count($args) == 1 ? shift($args) : $args);
        while (!$result->EOF) {
            $decisions[] = array('editDecisionId' => $result->fields['edit_decision_id'], 'directorId' => $result->fields['director_id'], 'decision' => $result->fields['decision'], 'dateDecided' => $this->datetimeFromDB($result->fields['date_decided']));
            $result->moveNext();
        }
        $result->Close();
        unset($result);
        return $decisions;
    }
							?>
                        </td>
                        
                        <!-- segunda columna, noticias xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
                        <td width="927" valign="top" style="padding-left:10px; padding-right:10px;">
                        	
                            
                            <?php
                            	switch($transaccion){
								
									default:
									
										$idusuario=$sql->uncampo("SELECT id_usuario FROM usuario WHERE login='******'");
										$tpl->leer_plantilla("html/auth_refund.html");
										$tpl->reemplazar("{shift}",$sh);
										$tpl->reemplazar("{idshift}",shift());
										$tpl->reemplazar("{date}",$f->fechadehoy());
										$tpl->reemplazar("{idagent}",$idusuario);
										$tpl->reemplazar("{agent}",$sql->uncampo("SELECT nombre FROM usuario WHERE id_usuario='".$idusuario."'"));
										$tpl->reemplazar("{url}","authRefund.php?tipo=$tipo&usuario=$usuario&transaccion=save");
										$tpl->mostrarplantilla();
										break;
										
									case "save":
										if($sql->consulta("INSERT INTO auth_refunds(id,id_agent,fecha,shift,member_id,fullname,email,amount,status,comment) 
										values(Null,'".$_POST["idagent"]."','".$_POST["date"]."','".$_POST["shift"]."','".$_POST["memberid"]."',
										'".$_POST["fullname"]."','".$_POST["email"]."','".$_POST["amount"]."','0','".$_POST["comment"]."')")){
										
										echo "Datos grabados<br><br>";
										
										include("correo.php");
Пример #9
0
 function call($method)
 {
     $params = func_get_args();
     shift($params);
     $r = xmlrpc_request($this->serverm, $method, $params, $this->plus, $this->gzip);
     return $r;
 }
Пример #10
0
 /**
  * Delete all roles for a specified conference.
  * @param $userId int
  * @param $conferenceId int optional, include roles only in this conference
  * @param $roleId int optional, include only this role
  */
 function deleteRoleByUserId($userId, $conferenceId = null, $roleId = null, $schedConfId = null)
 {
     $args = array((int) $userId);
     if (isset($conferenceId)) {
         $args[] = (int) $conferenceId;
     }
     if (isset($roleId)) {
         $args[] = (int) $roleId;
     }
     if (isset($schedConfId)) {
         $args[] = (int) $schedConfId;
     }
     return $this->update('DELETE FROM roles WHERE user_id = ?' . (isset($conferenceId) ? ' AND conference_id = ?' : '') . (isset($roleId) ? ' AND role_id = ?' : '') . (isset($schedConfId) ? ' AND sched_conf_id = ?' : ''), count($args) ? $args : shift($args));
 }
Пример #11
0
 function trim($t = '')
 {
     $a = optimize_args(func_get_args());
     if (isNum($a[0])) {
         $b = shift($a);
     } else {
         $b = 0;
     }
     trim($this->O);
     for ($i = 0; $i < count($a); $i++) {
         foreach ($a as $v) {
             if (isStr($v)) {
                 if ($v == 'number') {
                     $c = '\\d';
                 } else {
                     $c = $v;
                 }
                 $lef = '^(\\/?(\\s+|)(' . $c . '+))';
                 $rig = '(' . $c . '+)?(\\s+|)$';
                 $this->O = preg_replace('/' . (!isDrw($b) ? $lef . '|' . $rig : ($b[1] < 0 ? $lef : $rig)) . '/', '', $this->O);
             }
         }
     }
     return $this;
 }
Пример #12
0
                    break;
                } else {
                    $result = $result . $alph[($j + $key) % $N];
                    break;
                }
            }
            if ($text[$i] == $alph2[$j]) {
                if (($j + $key) % $N < 0) {
                    $result = $result . $alph2[$N + ($j + $key) % $N];
                    break;
                } else {
                    $result = $result . $alph2[($j + $key) % $N];
                    break;
                }
            }
            if ($text[$i] != $alph2[$j] && $text[$i] != $alph[$j] && $j == $N - 1) {
                //перенос всех остальных букв и символов без изменений
                $result = $result . $text[$i];
            }
        }
    }
    $fp = fopen('data.txt', 'a+');
    //открытие и запись в файл
    fwrite($fp, "Step: " . $key . "\r\n");
    fwrite($fp, "Input: " . $text . "\r\n");
    fwrite($fp, "Ouput: " . $result . "\r\n\r\n");
    fclose($fp);
    return $result;
}
$result = shift($_REQUEST['input'], $_REQUEST['step']);
echo json_encode($result);
Пример #13
0
$text = false;
while ($text === false) {
    echo 'Enter some text:', "\n";
    $text = trim(fgets(STDIN));
    if ($text === "") {
        $text = false;
    }
}
$default = mb_strlen($text) + 1;
$count = false;
while ($count === false) {
    echo 'Enter line amount (-1 for ∞, default: ', $default, '):', "\n";
    $count = intval(trim(fgets(STDIN)));
    if ($count === 0) {
        $count = $default;
    }
    if ($count === -1) {
        $count = PHP_INT_MAX;
    }
    if ($count < -1) {
        $count = false;
    }
}
for ($i = 0; $i < $count; $i++) {
    echo $text, "\n";
    $text = shift($text);
    if ($i === PHP_INT_MAX) {
        $i = 0;
    }
}
exit(0);