Esempio n. 1
0
function mailqueue_callback($args)
{
    if (!$args) {
        echo "NOT ARGS IN CALLBACK:";
        pr($args);
        die;
        //return false;
    }
    global $container_options;
    $log = array();
    $log['args'] = $args;
    $contanier = new Mail_Queue_Container_db($container_options);
    $obj = $contanier->getMailById($args['id']);
    if (!$obj) {
        echo "NOT OBJ IN CALLBACK:";
        pr($obj);
        die;
        //return false;
    }
    $log['mailObject'] = (array) $obj;
    $headers = $obj->headers;
    $subject = $obj->headers['Subject'];
    $body = $obj->body;
    $mail_headers = '';
    foreach ($headers as $key => $value) {
        $mail_headers .= "{$key}:{$value}\n";
    }
    $mail = $mail_headers . "\n" . $body;
    $decoder = new Mail_mimeDecode($mail);
    if (!$decoder) {
        echo "NOT DECODER IN CALLBACK";
        pr($decoder);
        die;
        //return false;
    }
    $decoded = $decoder->decode(array('include_bodies' => TRUE, 'decode_bodies' => TRUE, 'decode_headers' => TRUE));
    $body = $decoded->body;
    $esmtp_id = $args['queued_as'];
    if (isset($args['greeting'])) {
        $greeting = $args['greeting'];
        $greets = explode(' ', $greeting);
        $server = $greets[0];
    } else {
        $server = 'localhost';
    }
    $log['serverResponse'] = compact('server', 'esmtp_id');
    $res = sq("update mail_queue set log = '" . serialize($log) . "' where id = " . $args['id']);
    if (!$res) {
        echo "NOT RES IN CALLBACK";
        pr($res);
        die;
        //return false;
    }
    if (CRON) {
        echo "Email ID " . $args['id'] . "\n";
        echo "Log:\n\n";
        print_r($log);
        echo "\n\n";
    }
}
Esempio n. 2
0
 public function testSequences()
 {
     $module = new \Codeception\Module\Sequence(make_container());
     $this->assertNotEquals(sq(), sq());
     $this->assertNotEquals(sq(1), sq(2));
     $this->assertEquals(sq(1), sq(1));
     $old = sq(1);
     $module->_after($this);
     $this->assertNotEquals($old, sq(1));
 }
Esempio n. 3
0
function lang($keyword, $esDinamico = false, $divisor = '[div]')
{
    global $lang;
    if (!trim($keyword)) {
        return;
    }
    $keyword = utf8_strtolower($keyword);
    $config = Initialize::obtain()->config;
    // TEXTOS ESTATICOS ////////////////////////////////////////////////////////////
    if ($esDinamico === false) {
        $exist = false;
        // SI NO EXISTE EN EL ARRAY LANG, AGREGA A LA DB
        if (!isset($lang[$keyword])) {
            // VERIFY IF EXIST KEYWORD IN DB
            if ($config['siteUseDb']) {
                $exist = c("select keyword from static_lang_keys where keyword = '" . $keyword . "' and lang = '" . $_SESSION['lang'] . "' ");
            }
            // IF NOT EXIST, ADD TO DB
            if (!$exist) {
                if ($config['siteUseDb']) {
                    sq("insert into static_lang_keys set dateLastUpdate = NOW(), dateInsert=NOW(), keyword = '" . $keyword . "', lang = '" . $_SESSION['lang'] . "', keyvalue = '" . $keyword . "' ");
                }
            }
            return utf8_ucfirst($keyword);
        } else {
            return utf8_ucfirst($lang[$keyword]);
        }
    }
    // TEXTOS DINAMICOS ////////////////////////////////////////////////////////////////
    if ($esDinamico === true) {
        $keyOfSelectedLang = array_search($_SESSION['lang'], $config['lang']);
        $keyword = explode($divisor, $keyword);
        // SI EXISTE, DEVUELVE VALOR
        if (isset($keyword[$keyOfSelectedLang])) {
            return $keyword[$keyOfSelectedLang];
        } else {
            return $keyword[0];
        }
    }
}
Esempio n. 4
0
} else {
    $ordr = $_SESSION["prmb"][9];
}
if ($_GET["req"]) {
    $r = make_list_arts($_GET["req"]);
    $plg .= 'req=' . $_GET["req"] . '&';
    //echo 'req=cat=futur|present|dream|politic~from=01-01-11~until=31-12-12';
    if ($r) {
        foreach ($r as $k => $v) {
            $sq .= 'id=' . $k . ' OR ';
        }
    }
    $sq = substr($sq, 0, -4);
    $rq = sq('id,day,mail,frm,suj,img,nod,thm,re,lu,host', 'qda', 'WHERE ' . $sq);
} else {
    $rq = sq('id,day,mail,frm,suj,img,nod,thm,re,lu,host', 'qda', 'WHERE nod="' . $_SESSION['qb'] . '" and day < ' . $daya . ' and day > ' . $daybb . ' ' . $cate . ' ORDER BY ' . $ordr . '');
}
$rqt = tri_cache($rq);
//print_r($rqt);
if ($_GET["tej"]) {
    $_SESSION["keep"][$_GET["tej"]] = 1;
}
if ($_GET["rec"]) {
    $_SESSION["keep"][$_GET["rec"]] = "";
}
if ($_GET["all"]) {
    $_SESSION["keep"] = "";
}
echo lkc("txtbox", $plg . 'all==', "all_arts") . ' | ';
if ($_SESSION["auth"] > 4) {
}
function makeUpdateQuery($arrayCampos, $id, $execute = true, $table = '', $mediaUpdate = false)
{
    $db = Database::obtain();
    $sql = '';
    foreach ($arrayCampos as $campo) {
        if ($mediaUpdate) {
            $c = split("_", $campo);
            $sql .= $c[0] . "='" . $_POST[$campo] . "', ";
        } else {
            // SI EL POST VALUE NO ES EMPTY
            if (isset($_POST[$campo['name']])) {
                // POST ARRAY
                if (is_array($_POST[$campo['name']])) {
                    $_POST[$campo['name']] = implode('[div]', $_POST[$campo['name']]);
                    $sql .= $campo['name'] . "='" . trim($_POST[$campo['name']]) . "', ";
                } else {
                    // MD5 FOR PASSWORD
                    if (isset($campo['inputType']) && $campo['inputType'] == 'password') {
                        $sql .= $campo['name'] . "=MD5('" . trim($_POST[$campo['name']]) . "'), ";
                    } elseif (isset($campo['inputType']) && $campo['inputType'] == 'tags') {
                        $sql .= "";
                    } elseif (isset($campo['inputType']) && $campo['inputType'] == 'displayfield') {
                        $sql .= "";
                    } elseif (isset($campo['selectIsFlag']) && $campo['selectIsFlag'] && $campo['uniqueValue']) {
                        $sql .= $campo['name'] . "='" . trim($_POST[$campo['name']]) . "', ";
                        sq("update " . $table . " set " . $campo['name'] . " = 0");
                    } else {
                        $sql .= $campo['name'] . "='" . trim($_POST[$campo['name']]) . "', ";
                    }
                }
            } else {
                if ($campo['allowBlank']) {
                    if ($campo['submitValue'] && !$campo['disabled']) {
                        $sql .= $campo['name'] . "='', ";
                    } else {
                        $sql .= "";
                    }
                }
            }
        }
    }
    $sql = substr($sql, 0, strlen($sql) - 2);
    $sql = "UPDATE " . $table . " SET " . $sql . ", dateLastUpdate=NOW() WHERE id=" . $id;
    if ($execute) {
        return $db->query($sql);
    } else {
        pr("warning! executeQuerys = false");
        die(pr($sql));
    }
}
Esempio n. 6
0
File: mod.php Progetto: philum/cms
function search_conn($ra, $min, $cn)
{
    $req = sq('id,msg', 'qdm', 'where id>="' . $min . '" AND msg LIKE "%' . $cn . '%" ORDER BY id DESC');
    while ($rq = mysql_fetch_row($req)) {
        if (in_array($rq[0], $ra)) {
            $r = explode($cn, $rq[1]);
            $n = count($r);
            if (!$r[1]) {
                return;
            } else {
                for ($i = 0; $i < $n - 1; $i++) {
                    $s = strrpos($r[$i], '[');
                    if ($s !== false) {
                        $ret[] = array($rq[0], substr($r[$i], $s + 1));
                    }
                }
            }
        }
    }
    return $ret;
}
Esempio n. 7
0
function selectRow()
{
    global $dbutils_selstack;
    $qq = count($dbutils_selstack) - 1;
    if ($qq >= 0) {
        $dbutils_selstack[$qq][2] = true;
        if (isset($dbutils_selstack[$qq][1])) {
            $f = $dbutils_selstack[$qq][1];
            unset($GLOBALS['dbutils_selstack'][$qq][1]);
            // remove preloaded item
            return $f;
        } else {
            $f = sq($GLOBALS['dbutils_selstack'][$qq][0]);
            return $f;
        }
    } else {
        return false;
    }
}
Esempio n. 8
0
 private function savePredominantColors()
 {
     // ALREADY SAVED
     $exist = q("select hex from predominantcolors where file_id = " . $this->itemId . " order by id");
     if (!$exist) {
         // GET COLORS
         $delta = 16;
         $reduce_brightness = true;
         $reduce_gradients = true;
         $num_results = 10;
         $ex = new GetMostCommonColors();
         $colors = $ex->Get_Color($this->RelPath, $num_results, $reduce_brightness, $reduce_gradients, $delta);
         $keys = array_keys($colors);
         // SAVE COLORS
         foreach ($keys as $color) {
             sq("insert into predominantcolors set file_id = " . $this->itemId . ", hex = '" . $color . "'");
             $out[] = '<div class="predominantColors" style="float: left; margin: 4px; padding: 4px; border: 1px solid #000; width: 15px; height: 11px; background: #' . $color . '"></div>';
         }
     } else {
         //$out[] = '<div style="clear: both;"></div>';
         $out[] = '<div class="predominantColorsContainer">';
         foreach ($exist as $color) {
             $out[] = '<div class="predominantColors" style="float: left; margin: 4px; padding: 4px; border: 1px solid #000; width: 15px; height: 11px; background: #' . $color['hex'] . '"></div>';
         }
         $out[] = '</div>';
     }
     return join('', $out);
 }
Esempio n. 9
0
<?php

require_once '_init.php';
$out = array();
if ($_POST['item'] && is_array($_POST['item'])) {
    $i = 1;
    foreach ($_POST['item'] as $a) {
        $sql = "UPDATE " . $_POST['tabla'] . " SET orden = " . $i . " WHERE id = " . $a;
        if (sq($sql)) {
            $out[] = array('mode' => 'query update sort order', 'success' => 'true', 'sql' => $sql);
        } else {
            $out[] = array('mode' => 'query update sort order', 'success' => 'false', 'sql' => $sql);
        }
        $i++;
    }
} else {
    $out[] = array('mode' => 'items array not found', 'success' => 'false');
}
echo json_encode($out);
Esempio n. 10
0
File: tarim.php Progetto: philum/cms
function tarim_jb($p, $o, $res = '')
{
    $length = ses('tilen');
    $min = $p * $length;
    $max = $min + $length;
    $rq = sq('msg', 'qdm', 'where id>' . $min . ' and id<' . $max);
    while ($r = mysql_fetch_row($rq)) {
        $rb = tarim_findim($r[0], '.jpg');
        if ($rb) {
            foreach ($rb as $vb) {
                if ($vb) {
                    if (is_file($vb)) {
                        $rc[] = $vb;
                    }
                }
            }
        }
        $rb = tarim_findim($r[0], '.gif');
        if ($rb) {
            foreach ($rb as $vb) {
                if ($vb) {
                    if (is_file($vb)) {
                        $rc[] = $vb;
                    }
                }
            }
        }
        $rb = tarim_findim($r[0], '.png');
        if ($rb) {
            foreach ($rb as $vb) {
                if ($vb) {
                    if (is_file($vb)) {
                        $rc[] = $vb;
                    }
                }
            }
        }
    }
    //p($rc);
    $ret = $min . '-' . $max . ' (' . count($rc) . ') ';
    $f = '_backup/img_' . $min . '-' . $max . '.tar';
    //rmdir_r('_backup/');
    //return tarim_copy($rc);
    return tarim_tar($f, $rc);
}
Esempio n. 11
0
File: boot.php Progetto: philum/cms
function cache_arts()
{
    $nod = $_SESSION['qb'] . '_cache';
    $main = msql_read_b('', $nod, '', 1);
    if ($main) {
        $last = current($main);
    }
    $lastart = last_art($last[0]);
    if (!is_array($main[$lastart]) && $lastart or get('refresh')) {
        $ret['_menus_'] = array('date', 'cat', 'title', 'img', 'hub', 'tag', 'lu', 'author', 'length', 'url', 'ib', 're');
        //if(!ses('dayb'))ses('dayb',calc_date(ses('nbj')));
        $slct = 'id,day,frm,suj,img,nod,thm,lu,name,host,mail,ib,re';
        if (ses('dayb')) {
            $wh = ' and day>"' . ses('dayb') . '"';
        }
        $r = sq($slct, 'qda', 'where nod="' . ses('qb') . '"' . $wh . ' and substring(frm,1,1)!="_" and re>"0" order by ' . prmb(9));
        if ($r) {
            while ($rb = mysql_fetch_row($r)) {
                $k = array_shift($rb);
                $rb[3] = first_img($rb[3]);
                $rtb[$k] = $rb;
                if ($rtb) {
                    $ret += $rtb;
                }
            }
        }
        $ok = 'cache reloaded';
        msql_save('', $nod, $ret);
        $_SESSION['rqt'] = $rtb;
    } else {
        $_SESSION['rqt'] = $main;
    }
    return lka('/reload/' . ses('qb'), 'reload');
}
Esempio n. 12
0
} else {
    if ($emailQueueType == 'sent') {
        $allmq = q("select * from mail_queue where sent_time is not null");
        foreach ($allmq as $mq) {
            $sql = array();
            $sql[] = "insert into mail_queue set id = ''";
            foreach ($mq as $k => $v) {
                if ($k != 'id') {
                    if ($k == 'sent_time') {
                        $sql[] = $k . " = NULL";
                    } elseif ($k == 'try_sent') {
                        $sql[] = $k . " = '0'";
                    } elseif ($k == 'log') {
                        $sql[] = $k . " = ''";
                    } else {
                        $sql[] = $k . " = '" . $v . "'";
                    }
                }
            }
            $duplicateQueueRow = sq(join(", ", $sql));
            $updateSeq = sq("update mail_queue_seq set id = id+1");
        }
    }
    if ($emailQueueType == 'bounced') {
        $allmq = q("select * from mail_queue where sent_time is null and try_sent = " . $mail_options['how_many_trys']);
        foreach ($allmq as $mq) {
            $result = a("update mail_queue set sent_time = null, try_sent = 0 where id = " . $mq['id']);
        }
    }
    header("Location: ../index.php");
}
Esempio n. 13
0
<?php

require_once '_init.php';
define('ID', sprintf('%d', $_POST['itemId']));
$cords = $_POST['cords'];
$sql = "UPDATE files SET cropCords = '" . $cords . "' WHERE id = " . ID;
$update = sq($sql);
if ($update) {
    $out[] = array('mode' => 'query update cropCords', 'success' => 'true', 'sql' => $sql);
} else {
    $out[] = array('mode' => 'query update cropCords', 'success' => 'false', 'sql' => $sql);
}
echo json_encode($out);
Esempio n. 14
0
File: ajxf.php Progetto: philum/cms
function exportation($pub, $node, $topic, $sub)
{
    $USE = $_SESSION['USE'];
    $go = 'popup_export__pop_';
    if ($USE != "") {
        if ($part != "" or $pub != "") {
            if ($node != $USE) {
                $ret .= lj("popw", $go . $pub, "export:");
            } else {
                $ret .= btn("popw", "import:");
            }
            if ($node) {
                $ret .= lj("popbt", $go . $pub . '_' . $node, $node);
            }
            if ($topic) {
                $ret .= lj("popbt", $go . $pub . '_' . $node . '_' . $topic, $topic) . ' :: ';
            }
            if (!$node) {
                //menus:hubs && count($_SESSION['mn'])>1
                $ret .= slctmenusj($_SESSION['mn'], $go . $pub . '_', $_SESSION['qb'], ' ');
            }
        }
        $lineb = sql('frm', 'qda', 'k', "nod='{$node}' AND day>" . calc_date(360) . ' ORDER BY frm');
        if (count($_SESSION['mn']) > 1 && $lineb) {
            $ret .= slctmenusj($lineb, $go . $pub . '_' . $node . '_', '', ' ');
        }
    }
    if ($topic != "" && !$sub) {
        //topic
        $lk = $go . $pub . '_' . $node . '_' . $topic . '_';
        $ret .= lj("popdel", $lk . 'ok', 'save in: ' . $topic);
        if ($_SESSION['dayb']) {
            $sqlt = 'AND day>' . $_SESSION['dayb'] . '';
        }
        $req = sq('id,suj', 'qda', 'where nod="' . $node . '" AND frm="' . $topic . ' ' . $sqlt . ' ORDER BY id DESC LIMIT 100');
        if ($req) {
            while ($data = mysql_fetch_array($req)) {
                $rte .= lj('', $lk . $data["id"], $data["suj"]) . br();
            }
        }
        if ($rte) {
            $ret .= ' ' . btn('txtx', 'or affiliate to:') . br() . divc('nbp', $rte);
        }
    }
    if ($sub != "") {
        $tosave = import($node, $pub, $USE, $topic, $_SESSION['qb'], $sub);
        //sub
        $ret = lkc("popw", '/?read=' . $tosave, 'saved in ' . $node . '/' . $topic . '/' . $tosave);
    }
    return $ret;
}
Esempio n. 15
0
$pi_rxkbps = 0;
if ($pi1 > 0) {
    $pi_rxkbps = $pi1 / $pi_interval / 1024 * 8;
}
nq($conn2, "update tbl_conf set VALUESTR=" . $pi_rxkbps . " where PARAM='TXKBPS'");
//=================================================================================================================
printlog("обновляем даты по максимальному пингу");
//Выясняем - нужно ли обновлять?
$pi1 = time() - 3600;
$pi2 = date("Y-m-d H:i:s", $pi1);
$rs = sqa($conn2, "select DATESTAT from tbl_pingtable where DATESTAT>'" . $pi2 . "'");
$pi_count = sizeof($rs);
//Если нужно - обновляем
if ($pi_count < 1) {
    //Вычисляем сколько активных сейчас
    $rs = sq($conn2, "select CODE from tbl_base where LASTPING>='" . $ps_activetime2 . "'");
    $pi_count2 = sizeof($rs);
    //Фиксируем данные
    nq($conn2, "insert into tbl_pingtable (DATESTAT,COUNT) values (NOW()," . $pi_count2 . ")");
}
//=================================================================================================================
printlog("записываем дату обновления");
nq($conn2, "update tbl_conf set VALUEDATE=NOW() where PARAM='LASTUPDSCET'");
//=================================================================================================================
//=================================================================================================================
printlog("делаем запись в истории про обновление");
nq($conn2, "insert into tbl_operhist (OPERCODE,DATEOPER,TYPER,PAR1,PAR2,VAL_OLD,VAL_NEW) values (0,NOW(),3,'','','','')");
//=================================================================================================================
printlog("системные операции. ОКОНЧАНИЕ");
printlog("ставим отметку в базе, что обновление завершено");
nq($conn2, "update tbl_conf set VALUEINT=0 where PARAM='ISUPDATEDO'");
Esempio n. 16
0
function delete_item()
{
    /*if(TABLA=='noticias'){
          mysql_query("DELETE FROM tags_rel WHERE tabla= '".TABLA."' AND item_id=".ID);
      }
      
      if(TABLA=='files'){
          $item_files = q("SELECT * FROM files WHERE id = ".ID." AND tabla = '".PERTENECE."' AND tipo = '".TIPO."' ");
          mysql_query("DELETE FROM tags_rel WHERE tabla= '".TABLA."' AND item_id=".ID);
      }
      
      else {
          $item_files = q("SELECT * FROM files WHERE item_id = ".ID." AND tabla = '".TABLA."' ");
      }*/
    $out = '';
    // GET FILES
    $item_files = q("SELECT * FROM files WHERE item_id = " . ID . " AND tabla = '" . TABLA . "' ");
    // IF FILES; BORRARLAS
    if ($item_files) {
        foreach ($item_files as $row) {
            // UNLINK imagenes, videos, fotos
            if (file_exists(DELETEPATH . $row['nombre']) && $row['nombre'] != '' && $row['relacionado'] == 0) {
                if (unlink(DELETEPATH . $row['nombre'])) {
                    $out[] = array('mode' => 'unlink file', 'success' => 'true', 'file' => DELETEPATH . $row['nombre']);
                } else {
                    $out[] = array('mode' => 'unlink file', 'success' => 'false', 'file' => DELETEPATH . $row['nombre']);
                }
            }
            // TRY UNLINK AUDIO CONVERTED
            $converted_a = substr(trim($row['nombre']), 0, strlen(trim($row['nombre'])) - 4) . '-converted.mp3';
            if (file_exists(DELETEPATH . $converted_a) && $converted_a != '' && $row['relacionado'] == 0) {
                if (unlink(DELETEPATH . $converted_a)) {
                    $out[] = array('mode' => 'unlink audio converted file', 'success' => 'true', 'file' => DELETEPATH . $row['nombre']);
                } else {
                    $out[] = array('mode' => 'unlink audio converted file', 'success' => 'false', 'file' => DELETEPATH . $row['nombre']);
                }
            }
            // TRY UNLINK VIDEO CONVERTED
            $converted_v = substr(trim($row['nombre']), 0, strlen(trim($row['nombre'])) - 4) . '-converted.flv';
            if (file_exists(DELETEPATH . $converted_v) && $converted_v != '' && $row['relacionado'] == 0) {
                if (unlink(DELETEPATH . $converted_v)) {
                    $out[] = array('mode' => 'unlink video converted file', 'success' => 'true', 'file' => DELETEPATH . $row['nombre']);
                } else {
                    $out[] = array('mode' => 'unlink video converted file', 'success' => 'false', 'file' => DELETEPATH . $row['nombre']);
                }
            }
            // TRY UNLINK PREVIEW VIDEO
            $preview = substr(trim($row['nombre']), 0, strlen(trim($row['nombre'])) - 4) . '-converted.flv1.jpg';
            if (file_exists(DELETEPATH . $preview) && $preview != '' && $row['relacionado'] == 0) {
                if (unlink(DELETEPATH . $row['tabla'] . '/' . $preview)) {
                    $out[] = array('mode' => 'unlink video preview file', 'success' => 'true', 'file' => DELETEPATH . $row['nombre']);
                } else {
                    $out[] = array('mode' => 'unlink video preview file', 'success' => 'false', 'file' => DELETEPATH . $row['nombre']);
                }
            }
        }
    } else {
        $out[] = array('mode' => 'media not found', 'success' => 'false');
    }
    // DELETE FROM DB
    $sql = 'DELETE FROM ' . TABLA . ' WHERE id=' . ID;
    $result = sq($sql);
    if (is_bool($result) == true) {
        $out[] = array('mode' => 'query item delete', 'success' => 'true', 'sql' => $sql);
    } else {
        $out[] = array('mode' => 'query item delete', 'success' => 'false', 'sql' => $sql);
    }
    // DELETE FROM FILES DB
    $sql2 = 'DELETE FROM files WHERE tabla = "' . TABLA . '" and item_id=' . ID;
    $result2 = sq($sql2);
    if (is_bool($result2) == true) {
        $out[] = array('mode' => 'query files delete', 'success' => 'true', 'sql' => $sql2);
    } else {
        $out[] = array('mode' => 'query files delete', 'success' => 'false', 'sql' => $sql2);
    }
    echo json_encode($out);
}
Esempio n. 17
0
 private function removeFiles()
 {
     // IF NO CHANGES TO FILE FIELD; RETURN
     if ($_FILES[$this->campo]['size'][0] == "0") {
         //die(pr($_FILES[$this->campo]));
         return false;
     }
     // IF FILE FIELD IS DISABLED; RETURN
     if (!$_FILES[$this->campo]) {
         //die(pr($_FILES[$this->campo]));
         return false;
     }
     $item_files = q("SELECT * FROM files WHERE item_id = " . $this->id . " AND tabla = '" . $this->tabla . "' AND tipo = '" . $this->campo . "' ");
     //die(var_dump($item_files));
     // IF FILES; BORRARLAS
     if ($item_files) {
         $path = $_SERVER['DOCUMENT_ROOT'] . ROOT . 'admin/uploads/' . $this->tabla . '/';
         foreach ($item_files as $row) {
             // UNLINK imagenes, videos, fotos
             if (file_exists($path . $row['nombre']) && $row['nombre'] != '' && $row['relacionado'] == 0) {
                 if (unlink($path . $row['nombre'])) {
                     $sql = "DELETE FROM files WHERE id=" . $row['id'];
                     $result = sq($sql);
                     if ($result) {
                         //
                     } else {
                         die("fallo al borrar de la db. " . $sql);
                     }
                 } else {
                     die("fallo al borrar el archivo. " . $path . $row['nombre']);
                 }
             }
             // TRY UNLINK AUDIO CONVERTED
             /*$converted_a = substr(trim($row['nombre']), 0, strlen(trim($row['nombre']))-4).'-converted.mp3';
               if(file_exists(PATH.$converted_a) && $converted_a != '' && $row['relacionado'] == 0) {
                   if(unlink(PATH.$converted_a)) {
                       $out[] = array('mode'=>'unlink audio converted file','success'=>'true','file'=>PATH.$row['nombre']);
                   }else {
                       $out[] = array('mode'=>'unlink audio converted file','success'=>'false','file'=>PATH.$row['nombre']);
                   }
               }*/
             // TRY UNLINK VIDEO CONVERTED
             /*$converted_v = substr(trim($row['nombre']), 0, strlen(trim($row['nombre']))-4).'-converted.flv';
               if(file_exists(PATH.$converted_v) && $converted_v != '' && $row['relacionado'] == 0) {
                   if(unlink(PATH.$converted_v)) {
                       $out[] = array('mode'=>'unlink video converted file','success'=>'true','file'=>PATH.$row['nombre']);
                   }else {
                       $out[] = array('mode'=>'unlink video converted file','success'=>'false','file'=>PATH.$row['nombre']);
                   }
               }*/
             // TRY UNLINK PREVIEW VIDEO
             /*$preview = substr(trim($row['nombre']), 0, strlen(trim($row['nombre']))-4).'-converted.flv1.jpg';
               if(file_exists(PATH.$preview) && $preview != '' && $row['relacionado'] == 0) {
                   if(unlink(PATH.$row['tabla'].'/'.$preview)) {
                       $out[] = array('mode'=>'unlink video preview file','success'=>'true','file'=>PATH.$row['nombre']);
                   }else {
                       $out[] = array('mode'=>'unlink video preview file','success'=>'false','file'=>PATH.$row['nombre']);
                   }
               }*/
         }
     }
 }
Esempio n. 18
0
    ?>
';
  text = text_intro + (text != ''?(': '+text):'');	
  var story_attrs = {
    picture : '<?php 
    echo S3Voota::getImagesUrl();
    ?>
/<?php 
    echo $entity->getImagePath();
    ?>
/cc_s_<?php 
    echo $entity->getImagen();
    ?>
',
		name    : '<?php 
    echo sq(__('Opiniones a favor y en contra de %2% en Voota', array('%2%' => $entity)));
    ?>
',
		link    : '<?php 
    echo url_for($entity->getModule() . '/show?id=' . $entity->getVanity(), true);
    ?>
',
    message : text
  };
<?php 
}
?>
	

if (this.fb_publish.checked) { facebookPublishStory(story_attrs); }
<?php

require_once '_init.php';
$out = array();
$sql = "INSERT INTO files SET item_id=" . $_POST['item_id'] . ", tipo='youtube', youtube_id='" . $_POST['url_youtube'] . "', tabla='" . $_POST['tabla'] . "', type='video/x-flv', dateLastUpdate=NOW(), dateInsert=NOW() ";
$result = sq($sql);
if (is_bool($result) == true) {
    $out[] = array('mode' => 'add youtube video to files', 'success' => 'true', 'sql' => $sql, 'id' => mysql_insert_id());
} else {
    $out[] = array('mode' => 'add youtube video to files', 'success' => 'false', 'sql' => $sql);
}
echo json_encode($out);
Esempio n. 20
0
File: pdf.php Progetto: philum/cms
function data_arts($r)
{
    $wh = implode('" or id="', array_keys_b($r));
    //echo
    $rq = sq('id,suj,day,frm,thm', 'qda', 'where id="' . $wh . '"');
    while ($data = mysql_fetch_array($rq)) {
        $ret[$data['id']] = array($data['suj'], date('ymd', $data['day']), $data['frm'], $data['thm']);
    }
    //p($ret);
    return make_table($ret, '', '');
}
Esempio n. 21
0
?>
',
	'<?php 
echo $politico;
?>
',
	'<?php 
echo cutToLength(sq(formatBio($politico->getBio())), 255, '');
?>
',
	'<?php 
echo url_for('politico/show?id=' . $politico->getVanity(), true);
?>
',
	'<?php 
echo S3Voota::getImagesUrl() . '/' . $politico->getImagePath() . '/cc_s_' . $politico->getImagen();
?>
', 
	'0',
	{
		'categoria': 'Político',
		'partido': '<?php 
echo sq($politico->getPartido());
?>
'
	}
	);
</script>


Esempio n. 22
0
require_once '_init.php';
$emailQueueId = cleanRequest('id');
$emailQueueType = cleanRequest('type', '%s');
if (!$emailQueueId && !$emailQueueType) {
    die("REQUEST = NULL");
} else {
    $mq = a("select * from mail_queue where id = " . $emailQueueId);
    if ($emailQueueType == 'sent') {
        $sql[] = "insert into mail_queue set id = ''";
        foreach ($mq as $k => $v) {
            if ($k != 'id') {
                if ($k == 'sent_time') {
                    $sql[] = $k . " = NULL";
                } elseif ($k == 'try_sent') {
                    $sql[] = $k . " = '0'";
                } elseif ($k == 'log') {
                    $sql[] = $k . " = ''";
                } else {
                    $sql[] = $k . " = '" . $v . "'";
                }
            }
        }
        $duplicateQueueRow = sq(join(", ", $sql));
        $updateSeq = sq("update mail_queue_seq set id = id+1");
    }
    if ($emailQueueType == 'bounced') {
        $result = sq("update mail_queue set sent_time = null, try_sent = 0 where id = " . $mq['id']);
    }
    header("Location: ../index.php");
}
Esempio n. 23
0
<script type="text/javascript">
  <!--
  $(document).ready(function(){	  
	  $('#back').click(function(){
		  $('#op').val( 'n' );
		  $('#nueva_propuesta_frm').submit();
		  return false;
	  });

	  $('#nueva_propuesta_frm').submit(function(){
			if ($('#publicar_propuesta_en_facebook').is(':checked')){
		    facebookConnect_promptPermission("publish_stream", function(perms) {
		    	if (perms) {
		  		  var attachment = { 
						  'name': '<?php 
echo sq(__('Opiniones a favor y en contra de la propuesta \\"%2%\\" en Voota', array('%2%' => $form['titulo']->getValue())));
?>
',
							'href': '<?php 
echo url_for('propuesta/show?id=' . SfVoUtil::fixVanityChars($form['titulo']->getValue()), true);
?>
',
						  'media': [{
				  			'type': 'image',
				  			'src': '<?php 
echo S3Voota::getImagesUrl();
?>
/propuestas/cc_s_<?php 
echo $form['imagen']->getValue();
?>
',
Esempio n. 24
0
File: admin.php Progetto: philum/cms
function make_artlist($qr)
{
    $admin = $_GET['admin'];
    $dig = $_GET['dig'] ? $_GET['dig'] : $_SESSION['nbj'];
    if ($dig) {
        $sqlm = 'AND day>"' . calc_date($dig) . '" AND day<"' . calc_date(time_prev($dig)) . '"';
    } else {
        $sqlm = 'AND day<' . $_SESSION['daya'] . ' ';
    }
    if ($admin == 'all_arts') {
        $wh = '';
    } elseif ($admin == 'my_arts') {
        $wh .= 'AND name="' . $_SESSION['USE'] . '"';
    } elseif ($admin == 'users_arts') {
        $wh .= 'AND name!="' . $_SESSION['USE'] . '"';
    } elseif ($admin == 'sys_arts') {
        $wh .= 'AND frm="_system"';
        $sqlm = '';
    } elseif ($admin == 'trash') {
        $wh .= 'AND frm="_trash"';
        $sqlm = '';
    } elseif ($admin == 'not_published') {
        $wh .= 'AND re="0"';
    }
    if ($_GET['cat']) {
        $wh = ' AND frm="' . $_GET['cat'] . '" AND re>="1"';
    }
    if ($_GET['triart']) {
        $tri = $_GET['triart'];
    } else {
        $tri = 'id';
    }
    if ($_GET['triorder'] == 1) {
        $tri .= ' ASC';
    } elseif ($_GET['triorder'] == 2) {
        $tri .= ' DESC';
    } else {
        $tri .= ' DESC';
    }
    $ordr = $tri ? ' ORDER BY ' . $tri : '';
    if ($admin == 'categories') {
        $sqlm = '';
        $ordr = '';
    }
    $sql = 'nod="' . ses('qb') . '" ' . $wh . ' ' . $sqlm . $ordr;
    $req = sq(implode(',', $qr), 'qda', 'where ' . $sql);
    while ($data = mysql_fetch_array($req)) {
        foreach ($qr as $v) {
            $ret[$data['id']][$v] = $data[$v];
        }
    }
    return $ret;
}