コード例 #1
0
ファイル: _bfunctions_u.php プロジェクト: pioytazsko/drell
function showRegistrationForm($id, $aname, $rid, $letter_template, $error_message, $successful_message, $email_error_message)
{
    global $module_filepath, $auth, $DB, $Q, $REQUEST_URI, $module_name, $pt_l, $pt_action, $AllowToSend, $AllowToSendText, $HTTP_HOST;
    $filename = $module_filepath . "/_t/_items/" . $letter_template . ".tpl";
    if (file_exists($filename)) {
        $f = file($filename);
        $letter_template = join("", $f);
    } else {
        return "File " . $letter_template . ".tpl not found.";
    }
    $query = "select * from " . $module_name . " where id=" . $id;
    $Q->query($DB, $query);
    $info = $Q->getrow();
    $text = prepare_text($info);
    $lang = $info[lang];
    if ($AllowToSend) {
        //        echo $AllowToSendText;
        $email = strip_tags($AllowToSendText);
        $email = ereg_replace("mail", "", $email);
        $email = trim(ereg_replace("^[^]+", "", $email));
        $email = trim(ereg_replace("^[^a-zA-Z0-9]+", "", $email));
        $email = ereg_replace("(^[a-zA-Z0-9\\-\\.@_]+)[^a-zA-Z0-9\\-\\.@_]+.*", "\\1", $email);
        //	echo $email;
        if (!is_email($email)) {
            return "<font color=#FF0000>" . $email_error_message . "</font>";
        }
        $query = "select * from " . $module_name . " where rid=" . $rid . " and name='" . $email . "'";
        $Q->query($DB, $query);
        $count = $Q->numrows();
        //echo $query;
        if ($count) {
            $text = "<font color=#FF0000>" . $error_message . "</font>";
        } else {
            $r = getmaxid("id", $module_name);
            $ddate = convdate(date("d-m-Y H:i:s", time()));
            $password = substr(strtoupper(md5(rand())), 1, 5);
            $query = "INSERT INTO " . $module_name . " VALUES({$r}," . $rid . ",'','" . $aname . "','" . $lang . "','" . $ddate . "','" . $email . "','" . $password . "','" . $AllowToSendText . "','','','','','','','','','','','')";
            $Q->query($DB, $query);
            //		echo $query;
            $text = $successful_message;
            $sitename = ereg_replace("www\\.", "", $HTTP_HOST);
            $letter_template = ereg_replace("\\[name\\]", $email, $letter_template);
            $letter_template = ereg_replace("\\[anons\\]", $password, $letter_template);
            //		echo $letter_template;
            mail($email, $sitename, "Content-Type:text/html;\nContent-Transfer-Encoding: 8bit\n\n" . $letter_template . "\n\n", "Content-Type:multipart/mixed; charset=Windows-1251;");
        }
    }
    return $text;
}
コード例 #2
0
ファイル: index.php プロジェクト: antirek/prestige-pbx
//echo $zapros;
if ($zapros == "") {
    $result = mysql_query("SELECT * FROM {$table} order by calldate desc limit 300");
} else {
    $result = mysql_query("SELECT * FROM {$table} where {$zapros} ORDER BY calldate desc  limit 300");
    //        echo "SELECT * FROM {$table} where $zapros ORDER BY calldate desc  limit 300";
}
if (!$result) {
    die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
//////////////////////////
echo "<table border='1' align=center width=100% class=\"sort\">";
echo "<thead><tr><td> № </td><td>Время звонка</td><td>Откуда</td><td>Куда</td><td>CallerID</td><td>User Fieled</td><td>Результат</td><td>Время разговора</td></tr></thead><tbody>";
$num = 1;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $t = date('d.m, H:i', convdate("{$row['calldate']}"));
    if ($num & 1) {
        $color = '#fff5ee';
    } else {
        $color = 'white';
    }
    $d = $row["disposition"];
    if ($row["disposition"] == "ANSWERED") {
        $d = "<a href=# onClick=window.open(\"play.php?id={$row['uniqueid']}\",\"\",\"width=390,height=200\");>{$row['disposition']}</a>";
    }
    echo "<tr bgcolor={$color}><td>{$num}</td><td>{$t}</td><td>{$row['src']}</td><td>{$row['dst']}</td><td>{$row['clid']}</td><td><a href=./index.php?userfield={$row['userfield']}>{$row['userfield']}</a></td><td>{$d}</td><td>{$row['billsec']}</td></tr>";
    $num += 1;
}
echo "</tbody></table></body></html>";
mysql_free_result($result);
コード例 #3
0
ファイル: _edit.php プロジェクト: pioytazsko/drell
$uplfile = $module_filepath . "/base/" . $dfile;
if (!is_dir($dir)) {
    mkdir($dir, 0777);
} else {
    chmod($dir, 0777);
}
if ($attachments == "none") {
    $attachments = "";
}
if ($attachments) {
    if (file_exists($imfile)) {
        unlink($imfile);
    }
    $success = @copy($attachments, $imfile);
    $rid1 = (int) $newch[rid];
    // katalog
    if ($rid1 == 3) {
        $success = @copy($imfile, $uplfile);
    }
}
if ($newch[existence] == "") {
    $newch[existence] = 0;
}
$ddate = convdate($newch[date]);
$query = "UPDATE " . $module_name . " SET \ndate='{$ddate}',\nrid=" . (int) $newch[rid] . ",\naccess='{$newch['access']}',\naname='{$newch['aname']}',\nname='{$newch['name']}',\nanons='{$newch['anons']}',\ntext='{$newch['text']}',\narchive='{$newch['archive']}',\nf1='{$newch['f1']}',\nf2='{$newch['f2']}',\nf3='{$newch['f3']}',\nf4='{$newch['f4']}',\nf5='{$newch['f5']}',\nf6='{$newch['f6']}',\nf7='{$newch['f7']}',\nf8='{$newch['f8']}',\nf9='{$newch['f9']}',\nf10='{$newch['f10']}',\nurl='{$newch['url']}',\ntitle='{$newch['title']}',\ndescription='{$newch['description']}',\nkeywords='{$newch['keywords']}',\nexistence='{$newch['existence']}'\n WHERE id={$id}";
$Q->query($DB, $query);
if ($newch[aname] == "h2") {
    $SQL = "UPDATE " . $module_name . " SET f2 = '" . $_POST[field_type] . "' WHERE id = {$id}";
    $Q->query($DB, $SQL);
}
//get_htaccess();
コード例 #4
0
ファイル: domain.class.php プロジェクト: geldarr/hack-space
 /**
  * Show domains associated to a supplier
  *
  * @since version 0.84
  *
  * @param $item            CommonDBTM object for which associated domains must be displayed
  * @param $withtemplate    (default '')
  **/
 static function showForSupplier(CommonDBTM $item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     if ($item->isNewID($ID)) {
         return false;
     }
     if (!plugin_domains_haveRight('domains', 'r')) {
         return false;
     }
     if (!$item->can($item->fields['id'], 'r')) {
         return false;
     }
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     $rand = mt_rand();
     $is_recursive = $item->isRecursive();
     $query = "SELECT `glpi_plugin_domains_domains`.`id` AS assocID,\n                       `glpi_entities`.`id` AS entity,\n                       `glpi_plugin_domains_domains`.`name` AS assocName,\n                       `glpi_plugin_domains_domains`.* " . "FROM `glpi_plugin_domains_domains` " . " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_domains_domains`.`entities_id`) " . " WHERE `suppliers_id` = '{$ID}' " . getEntitiesRestrictRequest(" AND ", "glpi_plugin_domains_domains", '', '', true);
     $query .= " ORDER BY `assocName` ";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $domains = array();
     $domain = new PluginDomainsDomain();
     $used = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $domains[$data['assocID']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     echo "<th>" . __('Name') . "</th>";
     if (Session::isMultiEntitiesMode()) {
         echo "<th>" . __('Entity') . "</th>";
     }
     echo "<th>" . __('Group in charge of the hardware') . "</th>";
     echo "<th>" . __('Supplier') . "</th>";
     echo "<th>" . __('Technician in charge of the hardware') . "</th>";
     echo "<th>" . __('Type') . "</th>";
     echo "<th>" . __('Creation date') . "</th>";
     echo "<th>" . __('Expiration date') . "</th>";
     echo "</tr>";
     $used = array();
     if ($number) {
         Session::initNavigateListItems('PluginDomainsDomain', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         foreach ($domains as $data) {
             $domainID = $data["id"];
             $link = NOT_AVAILABLE;
             if ($domain->getFromDB($domainID)) {
                 $link = $domain->getLink();
             }
             Session::addToNavigateListItems('PluginDomainsDomain', $domainID);
             $used[$domainID] = $domainID;
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             echo "<td class='center'>{$link}</td>";
             if (Session::isMultiEntitiesMode()) {
                 echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>";
             }
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_groups", $data["groups_id_tech"]) . "</td>";
             echo "<td>";
             echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/enterprise.form.php?ID=" . $data["suppliers_id"] . "\">";
             echo Dropdown::getDropdownName("glpi_suppliers", $data["suppliers_id"]);
             if ($_SESSION["glpiis_ids_visible"] == 1) {
                 echo " (" . $data["suppliers_id"] . ")";
             }
             echo "</a></td>";
             echo "<td class='center'>" . getUsername($data["users_id_tech"]) . "</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_plugin_domains_domaintypes", $data["plugin_domains_domaintypes_id"]) . "</td>";
             echo "<td class='center'>" . Html::convdate($data["date_creation"]) . "</td>";
             if ($data["date_expiration"] <= date('Y-m-d') && !empty($data["date_expiration"])) {
                 echo "<td class='center'><div class='deleted'>" . convdate($data["date_expiration"]) . "</div></td>";
             } else {
                 if (empty($data["date_expiration"])) {
                     echo "<td class='center'>" . __('Does not expire', 'domains') . "</td>";
                 } else {
                     echo "<td class='center'>" . Html::convdate($data["date_expiration"]) . "</td>";
                 }
             }
             echo "</tr>";
             $i++;
         }
     }
     echo "</table>";
     echo "</div>";
 }
コード例 #5
0
 /**
  * Show domains associated to an item
  *
  * @since version 0.84
  *
  * @param $item            CommonDBTM object for which associated domains must be displayed
  * @param $withtemplate    (default '')
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     if ($item->isNewID($ID)) {
         return false;
     }
     if (!plugin_domains_haveRight('domains', 'r')) {
         return false;
     }
     if (!$item->can($item->fields['id'], 'r')) {
         return false;
     }
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     $canedit = $item->canadditem('PluginDomainsDomain');
     $rand = mt_rand();
     $is_recursive = $item->isRecursive();
     $query = "SELECT `glpi_plugin_domains_domains_items`.`id` AS assocID,\n                       `glpi_entities`.`id` AS entity,\n                       `glpi_plugin_domains_domains`.`name` AS assocName,\n                       `glpi_plugin_domains_domains`.*\n                FROM `glpi_plugin_domains_domains_items`\n                LEFT JOIN `glpi_plugin_domains_domains`\n                 ON (`glpi_plugin_domains_domains_items`.`plugin_domains_domains_id`=`glpi_plugin_domains_domains`.`id`)\n                LEFT JOIN `glpi_entities` ON (`glpi_plugin_domains_domains`.`entities_id`=`glpi_entities`.`id`)\n                WHERE `glpi_plugin_domains_domains_items`.`items_id` = '{$ID}'\n                      AND `glpi_plugin_domains_domains_items`.`itemtype` = '" . $item->getType() . "' ";
     $query .= getEntitiesRestrictRequest(" AND", "glpi_plugin_domains_domains", '', '', true);
     $query .= " ORDER BY `assocName`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $domains = array();
     $domain = new PluginDomainsDomain();
     $used = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $domains[$data['assocID']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     if ($canedit && $withtemplate < 2) {
         // Restrict entity for knowbase
         $entities = "";
         $entity = $_SESSION["glpiactive_entity"];
         if ($item->isEntityAssign()) {
             /// Case of personal items : entity = -1 : create on active entity (Reminder case))
             if ($item->getEntityID() >= 0) {
                 $entity = $item->getEntityID();
             }
             if ($item->isRecursive()) {
                 $entities = getSonsOf('glpi_entities', $entity);
             } else {
                 $entities = $entity;
             }
         }
         $limit = getEntitiesRestrictRequest(" AND ", "glpi_plugin_domains_domains", '', $entities, true);
         $q = "SELECT COUNT(*)\n               FROM `glpi_plugin_domains_domains`\n               WHERE `is_deleted` = '0'\n               {$limit}";
         $result = $DB->query($q);
         $nb = $DB->result($result, 0, 0);
         echo "<div class='firstbloc'>";
         if (plugin_domains_haveRight('domains', 'r') && $nb > count($used)) {
             echo "<form name='domain_form{$rand}' id='domain_form{$rand}' method='post'\n                   action='" . Toolbox::getItemTypeFormURL('PluginDomainsDomain') . "'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr class='tab_bg_1'>";
             echo "<td colspan='4' class='center'>";
             echo "<input type='hidden' name='entities_id' value='{$entity}'>";
             echo "<input type='hidden' name='is_recursive' value='{$is_recursive}'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             echo "<input type='hidden' name='items_id' value='{$ID}'>";
             if ($item->getType() == 'Ticket') {
                 echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
             }
             $domain->dropdownDomains("plugin_domains_domains_id", $entities, $used);
             echo "</td><td class='center' width='20%'>";
             echo "<input type='submit' name='additem' value=\"" . __s('Associate a domain', 'domains') . "\" class='submit'>";
             echo "</td>";
             echo "</tr>";
             echo "</table>";
             Html::closeForm();
         }
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $number && $withtemplate < 2) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $number);
         Html::showMassiveActions(__CLASS__, $massiveactionparams);
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     if ($canedit && $number && $withtemplate < 2) {
         echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
     }
     echo "<th>" . __('Name') . "</th>";
     if (Session::isMultiEntitiesMode()) {
         echo "<th>" . __('Entity') . "</th>";
     }
     echo "<th>" . __('Group in charge of the hardware') . "</th>";
     echo "<th>" . __('Supplier') . "</th>";
     echo "<th>" . __('Technician in charge of the hardware') . "</th>";
     echo "<th>" . __('Type') . "</th>";
     echo "<th>" . __('Creation date') . "</th>";
     echo "<th>" . __('Expiration date') . "</th>";
     echo "</tr>";
     $used = array();
     if ($number) {
         Session::initNavigateListItems('PluginDomainsDomain', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         foreach ($domains as $data) {
             $domainID = $data["id"];
             $link = NOT_AVAILABLE;
             if ($domain->getFromDB($domainID)) {
                 $link = $domain->getLink();
             }
             Session::addToNavigateListItems('PluginDomainsDomain', $domainID);
             $used[$domainID] = $domainID;
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             if ($canedit && $withtemplate < 2) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
                 echo "</td>";
             }
             echo "<td class='center'>{$link}</td>";
             if (Session::isMultiEntitiesMode()) {
                 echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>";
             }
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_groups", $data["groups_id_tech"]) . "</td>";
             echo "<td>";
             echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/enterprise.form.php?ID=" . $data["suppliers_id"] . "\">";
             echo Dropdown::getDropdownName("glpi_suppliers", $data["suppliers_id"]);
             if ($_SESSION["glpiis_ids_visible"] == 1) {
                 echo " (" . $data["suppliers_id"] . ")";
             }
             echo "</a></td>";
             echo "<td class='center'>" . getUsername($data["users_id_tech"]) . "</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_plugin_domains_domaintypes", $data["plugin_domains_domaintypes_id"]) . "</td>";
             echo "<td class='center'>" . Html::convdate($data["date_creation"]) . "</td>";
             if ($data["date_expiration"] <= date('Y-m-d') && !empty($data["date_expiration"])) {
                 echo "<td class='center'><div class='deleted'>" . convdate($data["date_expiration"]) . "</div></td>";
             } else {
                 if (empty($data["date_expiration"])) {
                     echo "<td class='center'>" . __('Does not expire', 'domains') . "</td>";
                 } else {
                     echo "<td class='center'>" . Html::convdate($data["date_expiration"]) . "</td>";
                 }
             }
             echo "</tr>";
             $i++;
         }
     }
     echo "</table>";
     if ($canedit && $number && $withtemplate < 2) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions(__CLASS__, $massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
コード例 #6
0
 function counter_page_arrayLine_display($title, $array, $th = 0)
 {
     $td = "td";
     if ($th == "1") {
         $td = "th";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<th>" . $title . "</th>";
     //		foreach ($array AS $value)
     for ($i = 0; $i < count($array); $i++) {
         $explode = explode(" ", $array[$i]);
         if ($th == "1") {
             $explode[0] = convdate($explode[0]);
         }
         echo "<" . $td . " align='center'>" . $explode[0] . "</" . $td . ">";
     }
     echo "</tr>";
 }