• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP lcm_fetch_array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中lcm_fetch_array函数的典型用法代码示例。如果您正苦于以下问题:PHP lcm_fetch_array函数的具体用法?PHP lcm_fetch_array怎么用?PHP lcm_fetch_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了lcm_fetch_array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: create_groups

function create_groups($keyword_groups)
{
    foreach ($keyword_groups as $skwg) {
        // Insert keyword group data into database table
        $q = "INSERT INTO lcm_keyword_group \n\t\t\t\t(name, title, description, type, policy, quantity, suggest, ac_admin, ac_author) \n\t\t\tVALUES (" . "'" . addslashes($skwg['name']) . "', " . "'" . addslashes($skwg['title']) . "', " . "'" . addslashes($skwg['description']) . "', " . "'" . addslashes($skwg['type']) . "', " . "'" . addslashes($skwg['policy']) . "', " . "'" . addslashes($skwg['quantity']) . "', " . "'" . addslashes($skwg['suggest']) . "', " . "'" . addslashes($skwg['ac_admin']) . "', " . "'" . addslashes($skwg['ac_author']) . "')";
        $result = lcm_query($q, true);
        // Ignore if keyword exists (has unique key)
        // Findout under what ID is this group stored
        // Note: Do this instead of lcm_insert_id() because the keyword might not have been
        // inserted, so using lcm_insert_id() would re-create ALL keywords using the latest kwg id...
        $q = "SELECT id_group,name FROM lcm_keyword_group WHERE name='" . addslashes($skwg['name']) . "'";
        $result = lcm_query($q);
        $row = lcm_fetch_array($result);
        $kwg_id = $row['id_group'];
        // If group is not successfully created or its ID is not found, report error
        // [ML] Failed SQL insert generates lcm_panic(), so this becomes useless.
        if ($kwg_id < 1) {
            lcm_log("create_groups: creation of keyword group seems to have failed. Aborting.");
            lcm_log("-> Query was: " . $q);
            return;
        }
        // Insert keywords data into database table
        foreach ($skwg['keywords'] as $k) {
            if (!isset($k['hasvalue'])) {
                $k['hasvalue'] = 'N';
            }
            $q = "INSERT INTO lcm_keyword\n\t\t\t\t\t(id_group, name, title, description, hasvalue, ac_author)\n\t\t\t\tVALUES (" . $kwg_id . ", " . "'" . addslashes($k['name']) . "', " . "'" . addslashes($k['title']) . "', " . "'" . addslashes($k['description']) . "', " . "'" . addslashes($k['hasvalue']) . "', " . "'" . addslashes($k['ac_author']) . "')";
            $result = lcm_query($q, true);
            // Ignore if keyword exists (has unique key)
        }
    }
}
开发者ID:nyimbi,项目名称:legalcase,代码行数:32,代码来源:inc_keywords_default.php


示例2: read_author_data

function read_author_data($id_author)
{
    $q = "SELECT * FROM lcm_author WHERE id_author=" . $id_author;
    $result = lcm_query($q);
    if (!($usr = lcm_fetch_array($result))) {
        lcm_panic("The user #{$id_author} does not exist in the database.");
    }
    return $usr;
}
开发者ID:nyimbi,项目名称:legalcase,代码行数:9,代码来源:config_author.php


示例3: get_contact_by_id

function get_contact_by_id($id_contact)
{
    if (!$id_contact) {
        return NULL;
    }
    $query = "SELECT *\n\t\t\t\tFROM lcm_contact\n\t\t\t\tWHERE id_contact = " . intval($id_contact);
    $result = lcm_query($query);
    if ($row = lcm_fetch_array($result)) {
        return $row;
    } else {
        return NULL;
    }
}
开发者ID:nyimbi,项目名称:legalcase,代码行数:13,代码来源:inc_contacts.php


示例4: write_meta

function write_meta($name, $value)
{
    // Escape $value
    $value = addslashes($value);
    // PostgreSQL does not support "REPLACE foo" syntax
    $query = "SELECT name, value FROM lcm_meta WHERE name = '{$name}'";
    $result = lcm_query($query);
    if ($row = lcm_fetch_array($result)) {
        lcm_query("UPDATE lcm_meta \n\t\t\t\tSET value = '{$value}'\n\t\t\t\tWHERE name = '{$name}'");
    } else {
        lcm_query("INSERT INTO lcm_meta (name, value) VALUES  ('{$name}', '{$value}')");
    }
    // Refresh cache (inc_meta_cache.php)
    write_metas();
}
开发者ID:nyimbi,项目名称:legalcase,代码行数:15,代码来源:inc_meta.php


示例5: create_repfields

function create_repfields($rep_fields)
{
    foreach ($rep_fields as $f) {
        $q = "SELECT * \n\t\t\t\tFROM lcm_fields \n\t\t\t\tWHERE table_name = '" . $f['table_name'] . "'\n\t\t\t\t  AND field_name = '" . $f['field_name'] . "'";
        $result = lcm_query($q);
        if ($row = lcm_fetch_array($result)) {
            // check if update necessary
            $needs_update = false;
            foreach ($f as $key => $val) {
                if ($row[$key] != $val) {
                    $needs_update = true;
                }
            }
            if ($needs_update) {
                $all_fields_tmp = array();
                $all_fields = "";
                foreach ($f as $key => $val) {
                    $all_fields_tmp[] = "{$key} = '{$val}'";
                }
                $all_fields = implode(", ", $all_fields_tmp);
                $q2 = "UPDATE lcm_fields\n\t\t\t\t\t\tSET " . $all_fields . "\n\t\t\t\t\t\tWHERE table_name = '" . $f['table_name'] . "'\n\t\t\t\t\t\t  AND field_name = '" . $f['field_name'] . "'";
                lcm_query($q2);
            }
        } else {
            // insert new field
            $field_list = "";
            $values_list = "";
            foreach ($f as $key => $val) {
                $field_list .= "{$key},";
                $values_list .= "'{$val}',";
            }
            $field_list = preg_replace("/,\$/", "", $field_list);
            $values_list = preg_replace("/,\$/", "", $values_list);
            $q2 = "INSERT INTO lcm_fields ({$field_list})\n\t\t\t\t\t\tVALUES (" . $values_list . ")";
            lcm_query($q2);
        }
    }
}
开发者ID:nyimbi,项目名称:legalcase,代码行数:38,代码来源:inc_repfields_defaults.php


示例6: addslashes

        if ($ok) {
            break;
        }
    }
    if ($ok) {
        $ok = $auth->lire();
    }
    if ($ok) {
        $auth->activate();
        // Force cookies for admins
        if ($auth->username and $auth->status == 'admin') {
            $cookie_admin = "@" . $auth->username;
        }
        $query = "SELECT * \n\t\t\t\t\tFROM lcm_author\n\t\t\t\t\tWHERE username='" . addslashes($auth->username) . "'";
        $result = lcm_query($query);
        if ($row_author = lcm_fetch_array($result)) {
            $cookie_session = creer_cookie_session($row_author);
        }
        $cible->addVar('privet', 'yes');
    } else {
        $cible = new Link("lcm_login.php");
        $cible->addVar('var_login', $login);
        $cible->addVar('var_url', urldecode($url));
        if ($session_password || $session_password_md5) {
            $cible->addVar('var_erreur', 'pass');
        }
    }
}
// Set a session cookie?
if ($cookie_session) {
    if ($session_remember == 'yes') {
开发者ID:nyimbi,项目名称:legalcase,代码行数:31,代码来源:lcm_cookie.php


示例7: printList

 function printList()
 {
     global $prefs;
     // Select cases of which the current user is author
     $q = "SELECT e.id_expense, e.id_case, e.id_author, e.status, e.type, \n\t\t\t\te.description, e.date_creation, e.date_update, e.pub_read,\n\t\t\t\te.pub_write, a.name_first, a.name_middle, a.name_last,\n\t\t\t\tcount(ec.id_expense) as nb_comments, c.title as case_title\n\t\t\tFROM lcm_expense as e\n\t\t\tLEFT JOIN lcm_expense_comment as ec ON (ec.id_expense = e.id_expense)\n\t\t\tLEFT JOIN lcm_author as a ON (a.id_author = e.id_author) \n\t\t\tLEFT JOIN lcm_case as c ON (c.id_case = e.id_case) ";
     $q .= " WHERE (1=1 ";
     if ($this->search) {
         $q .= " AND (";
         if (is_numeric($this->search)) {
             $q .= " e.id_expense = " . $this->search . " OR ";
         }
         $q .= " e.description LIKE '%" . $this->search . "%' ";
         $q .= " )";
     }
     if ($this->id_case) {
         $q .= " AND e.id_case = " . $this->id_case;
     }
     $q .= ")";
     //
     // Apply filters to SQL
     //
     // Case owner TODO
     // $q .= " AND " . $q_owner;
     // Period (date_creation) to show
     if ($prefs['case_period'] < 1900) {
         // since X days
         // $q .= " AND TO_DAYS(NOW()) - TO_DAYS(date_creation) < " . $prefs['case_period'];
         $q .= " AND " . lcm_query_subst_time('e.date_creation', 'NOW()') . ' < ' . $prefs['case_period'] * 3600 * 24;
     } else {
         // for year X
         $q .= " AND " . lcm_query_trunc_field('e.date_creation', 'year') . ' = ' . $prefs['case_period'];
     }
     $q .= " GROUP BY e.id_expense, e.id_case, e.id_author, e.status, e.type, e.description, e.date_creation, e.date_update, e.pub_read, e.pub_write, a.name_first, a.name_middle, a.name_last, c.title ";
     //
     // Sort
     //
     $sort_clauses = array();
     $sort_allow = array('ASC' => 1, 'DESC' => 1);
     // Sort by request type
     if ($sort_allow[_request('type_order')]) {
         $sort_clauses[] = "type " . _request('type_order');
     }
     if ($sort_allow[_request('status_order')]) {
         $sort_clauses[] = "status " . _request('status_order');
     }
     // Sort cases by creation or update date
     if ($sort_allow[_request('date_order')]) {
         $sort_clauses[] = "date_creation " . _request('date_order');
     } elseif ($sort_allow[_request('upddate_order')]) {
         $sort_clauses[] = "date_update " . _request('upddate_order');
     }
     if (count($sort_clauses)) {
         $q .= " ORDER BY " . implode(', ', $sort_clauses);
     } else {
         $q .= " ORDER BY date_creation DESC";
     }
     // default sort
     $result = lcm_query($q);
     // Check for correct start position of the list
     $this->number_of_rows = lcm_num_rows($result);
     if ($this->list_pos >= $this->number_of_rows) {
         $this->list_pos = 0;
     }
     // Position to the page info start
     if ($this->list_pos > 0) {
         if (!lcm_data_seek($result, $this->list_pos)) {
             lcm_panic("Error seeking position " . $this->list_pos . " in the result");
         }
     }
     for ($i = 0; $i < $prefs['page_rows'] && ($row = lcm_fetch_array($result)); $i++) {
         $css = $i % 2 ? "dark" : "light";
         echo "<tr>\n";
         // Expense ID
         echo "<td class='tbl_cont_" . $css . "'>";
         echo highlight_matches($row['id_expense'], $this->search);
         echo "</td>\n";
         // Author
         echo "<td class='tbl_cont_" . $css . "'>";
         echo get_person_initials($row);
         echo "</td>\n";
         // Attached to case..
         echo "<td class='tbl_cont_" . $css . "'>";
         if ($row['id_case']) {
             echo '<abbr title="' . $row['case_title'] . '">' . $row['id_case'] . '</a>';
         }
         echo "</td>\n";
         // Date creation
         echo "<td class='tbl_cont_" . $css . "'>";
         echo format_date($row['date_creation'], 'short');
         echo "</td>\n";
         // Type
         echo "<td class='tbl_cont_" . $css . "'>";
         echo _Tkw('_exptypes', $row['type']);
         echo "</td>\n";
         // Description
         global $fu_desc_len;
         // configure via my_options.php with $GLOBALS['fu_desc_len'] = NNN;
         $more_desc = _request('more_desc', 0);
         $desc_length = isset($fu_desc_len) && $fu_desc_len > 0 ? $fu_desc_len : 256;
         $description = $row['description'];
//.........这里部分代码省略.........
开发者ID:nyimbi,项目名称:legalcase,代码行数:101,代码来源:inc_obj_exp.php


示例8: while

while ($row = lcm_fetch_array($result)) {
    // $q .= ($q ? ', ' : '');
    $q .= get_person_name($row) . ($row['name'] ? " of " . $row['name'] : '');
    // TRAD
    $q .= '&nbsp;(<label for="id_rem_client' . $row['id_client'] . ':' . $row['id_org'] . '">';
    $q .= '<img src="images/jimmac/stock_trash-16.png" width="16" height="16" alt="Remove?" title="Remove?" /></label>&nbsp;';
    $q .= '<input type="checkbox" id="id_rem_client' . $row['id_client'] . ':' . $row['id_org'] . '" name="rem_client[]" value="' . $row['id_client'] . ':' . $row['id_org'] . '"/>)<br />';
    // TRAD
}
echo "\t\t\t{$q}\n";
// List rest of the clients to add
$q = "SELECT c.id_client, c.name_first, c.name_last, co.id_org, o.name\n\t\t\tFROM lcm_client AS c\n\t\t\tLEFT JOIN lcm_client_org AS co USING (id_client)\n\t\t\tLEFT JOIN lcm_org AS o ON (co.id_org = o.id_org)\n\t\t\tLEFT JOIN lcm_app_client_org AS aco ON (aco.id_client = c.id_client AND aco.id_app = " . _session('id_app', 0) . ")\n\t\t\tWHERE id_app IS NULL\n\t\t\tORDER BY c.name_first, c.name_last, o.name";
$result = lcm_query($q);
echo '<select name="client">' . "\n";
echo '<option selected="selected" value="0"> ... </option>' . "\n";
while ($row = lcm_fetch_array($result)) {
    echo '<option value="' . $row['id_client'] . ':' . $row['id_org'] . '">' . get_person_name($row) . ($row['name'] ? ' of ' . $row['name'] : '') . "</option>\n";
}
echo "</select>\n";
echo "<button name=\"submit\" type=\"submit\" value=\"add_client\" class=\"simple_form_btn\">" . 'Add' . "</button>\n";
// TRAD
echo "</td></tr>\n";
echo "</table>\n";
// Delete appointment
if (_session('id_app', 0)) {
    // $checked = ($this->getDataString('hidden') == 'Y' ? ' checked="checked" ' : '');
    $checked = $_SESSION['form_data']['hidden'] == 'Y' ? ' checked="checked" ' : '';
    echo '<p class="normal_text">';
    echo '<input type="checkbox"' . $checked . ' name="hidden" id="box_delete" />';
    echo '<label for="box_delete">' . _T('app_info_delete') . '</label>';
    echo "</p>\n";
开发者ID:nyimbi,项目名称:legalcase,代码行数:31,代码来源:edit_app.php


示例9: save

 function save()
 {
     $errors = $this->validate();
     if (count($errors)) {
         return $errors;
     }
     //
     // Update
     //
     $fl = " date_start = '" . $this->getDataString('date_start') . "',\n\t\t\t\tdate_end   = '" . $this->getDataString('date_end') . "',\n\t\t\t\ttype       = '" . $this->getDataString('type') . "',\n\t\t\t\tsumbilled  = " . $this->getDataFloat('sumbilled', 0.0);
     if ($this->getDataString('type') == 'stage_change') {
         // [ML] To be honest, we should "assert" most of the
         // following values, but "new_stage" is the most important.
         lcm_assert_value($this->getDataString('new_stage', '__ASSERT__'));
         $desc = array('description' => $this->getDataString('description'), 'result' => $this->getDataString('result'), 'conclusion' => $this->getDataString('conclusion'), 'sentence' => $this->getDataString('sentence'), 'sentence_val' => $this->getDataString('sentence_val'), 'new_stage' => $this->getDataString('new_stage'));
         $fl .= ", description = '" . serialize($desc) . "'";
     } elseif (is_status_change($this->getDataString('type'))) {
         $desc = array('description' => $this->getDataString('description'), 'result' => $this->getDataString('result'), 'conclusion' => $this->getDataString('conclusion'), 'sentence' => $this->getDataString('sentence'), 'sentence_val' => $this->getDataString('sentence_val'));
         $fl .= ", description = '" . serialize($desc) . "'";
     } else {
         $fl .= ", description  = '" . $this->getDataString('description') . "'";
     }
     if ($this->getDataInt('id_followup') > 0) {
         // Edit of existing follow-up
         $id_followup = $this->getDataInt('id_followup');
         if (!allowed($this->getDataInt('id_case'), 'e')) {
             lcm_panic("You don't have permission to modify this case's information. (" . $this->getDataInt('id_case') . ")");
         }
         // TODO: check if hiding this FU is allowed
         if (allowed($this->getDataInt('id_case'), 'a') && !(is_status_change($this->getDataString('type')) || $this->getDataString('type') == 'assignment' || $this->getDataString('type') == 'unassignment')) {
             if ($this->getDataString('delete')) {
                 $fl .= ", hidden = 'Y'";
             } else {
                 $fl .= ", hidden = 'N'";
             }
         } else {
             $fl .= ", hidden = 'N'";
         }
         $q = "UPDATE lcm_followup SET {$fl} WHERE id_followup = {$id_followup}";
         $result = lcm_query($q);
         // Get stage of the follow-up entry
         $q = "SELECT id_stage, case_stage FROM lcm_followup WHERE id_followup = {$id_followup}";
         $result = lcm_query($q);
         if ($row = lcm_fetch_array($result)) {
             $case_stage = lcm_assert_value($row['case_stage']);
         } else {
             lcm_panic("There is no such follow-up (" . $id_followup . ")");
         }
         // Update the related lcm_stage entry
         $q = "UPDATE lcm_stage SET\n\t\t\t\t\tdate_conclusion = '" . $this->getDataString('date_end') . "',\n\t\t\t\t\tkw_result = '" . $this->getDataString('result') . "',\n\t\t\t\t\tkw_conclusion = '" . $this->getDataString('conclusion') . "',\n\t\t\t\t\tkw_sentence = '" . $this->getDataString('sentence') . "',\n\t\t\t\t\tsentence_val = '" . $this->getDataString('sentence_val') . "',\n\t\t\t\t\tdate_agreement = '" . $this->getDataString('date_end') . "'\n\t\t\t\tWHERE id_case = " . $this->getDataInt('id_case') . "\n\t\t\t\t  AND kw_case_stage = '" . $case_stage . "'";
         lcm_query($q);
     } else {
         // New follow-up
         if (!allowed($this->getDataInt('id_case'), 'w')) {
             lcm_panic("You don't have permission to add information to this case. (" . $this->getDataInt('id_case') . ")");
         }
         // Get the current case stage
         $q = "SELECT id_stage, stage FROM lcm_case WHERE id_case=" . $this->getDataInt('id_case', '__ASSERT__');
         $result = lcm_query($q);
         if ($row = lcm_fetch_array($result)) {
             $case_stage = lcm_assert_value($row['stage']);
             $case_stage_id = lcm_assert_value($row['id_stage']);
         } else {
             lcm_panic("There is no such case (" . $this->getDataInt('id_case') . ")");
         }
         // Add the new follow-up
         $q = "INSERT INTO lcm_followup\n\t\t\t\t\tSET id_case=" . $this->getDataInt('id_case') . ",\n\t\t\t\t\t\tid_author=" . $GLOBALS['author_session']['id_author'] . ",\n\t\t\t\t\t\t{$fl},\n\t\t\t\t\t\tid_stage = {$case_stage_id},\n\t\t\t\t\t\tcase_stage='{$case_stage}'";
         lcm_query($q);
         $this->data['id_followup'] = lcm_insert_id('lcm_followup', 'id_followup');
         // Set relation to the parent appointment, if any
         if ($this->getDataInt('id_app')) {
             $q = "INSERT INTO lcm_app_fu \n\t\t\t\t\t\tSET id_app=" . $this->getDataInt('id_app') . ",\n\t\t\t\t\t\t\tid_followup=" . $this->getDataInt('id_followup', '__ASSERT__') . ",\n\t\t\t\t\t\t\trelation='child'";
             $result = lcm_query($q);
         }
         // Update case status
         $status = '';
         $stage = '';
         switch ($this->getDataString('type')) {
             case 'conclusion':
                 $status = 'closed';
                 break;
             case 'suspension':
                 $status = 'suspended';
                 break;
             case 'opening':
             case 'resumption':
             case 'reopening':
                 $status = 'open';
                 break;
             case 'merge':
                 $status = 'merged';
                 break;
             case 'deletion':
                 $status = 'deleted';
                 break;
             case 'stage_change':
                 $stage = lcm_assert_value($this->getDataString('new_stage'));
                 break;
         }
         if ($status || $stage) {
//.........这里部分代码省略.........
开发者ID:nyimbi,项目名称:legalcase,代码行数:101,代码来源:inc_obj_fu.php


示例10: get_keywords_applied_to

function get_keywords_applied_to($type, $id, $id_sec = 0)
{
    if (!$GLOBALS['legal_obj'][$type]) {
        lcm_panic("Unknown type: " . $type);
    }
    if ($type == 'stage') {
        $query = "SELECT kwlist.*, kwinfo.*, kwg.title as kwg_title, kwg.name as kwg_name\n\t\t\t\tFROM lcm_keyword_case as kwlist, lcm_keyword as kwinfo, lcm_keyword_group as kwg\n\t\t\t\tWHERE id_case = " . $id . " \n\t\t\t\t  AND kwinfo.id_keyword = kwlist.id_keyword\n\t\t\t\t  AND kwg.id_group = kwinfo.id_group\n\t\t\t\t  AND kwlist.id_stage = " . $id_sec;
    } else {
        $query = "SELECT kwlist.*, kwinfo.*, kwg.title as kwg_title, kwg.name as kwg_name\n\t\t\t\tFROM lcm_keyword_" . $type . " as kwlist, lcm_keyword as kwinfo, lcm_keyword_group as kwg\n\t\t\t\tWHERE id_" . $type . " = " . $id . " \n\t\t\t\t  AND kwinfo.id_keyword = kwlist.id_keyword\n\t\t\t\t  AND kwg.id_group = kwinfo.id_group";
        if ($type == 'case') {
            $query .= " AND kwlist.id_stage = 0";
        }
    }
    $result = lcm_query($query);
    $ret = array();
    while ($row = lcm_fetch_array($result)) {
        array_push($ret, $row);
    }
    return $ret;
}
开发者ID:nyimbi,项目名称:legalcase,代码行数:20,代码来源:inc_keywords.php


示例11: printList

 function printList()
 {
     global $prefs;
     // Select cases of which the current user is author
     $q = "SELECT DISTINCT c.id_case, title, status, public, pub_write, date_creation\n\t\t\tFROM lcm_case as c NATURAL JOIN lcm_case_author as a ";
     if ($this->search) {
         $q .= " NATURAL LEFT JOIN lcm_keyword_case as kc ";
     }
     //
     // Apply filters to SELECT output
     //
     $q .= " WHERE 1=1 ";
     // Add search criteria, if any
     if ($this->search) {
         $q .= " AND (";
         if (is_numeric($this->search)) {
             $q .= " (c.id_case = {$this->search}) OR ";
         }
         $q .= " (kc.value LIKE '%" . $this->search . "%') OR " . " (c.title LIKE '%" . $this->search . "%') ";
         $q .= " )";
     }
     //
     // Case owner: may be used by listcases.php, archives.php, author_det.php, etc.
     // Also, it may be a user checking another user's profile (in that case, show only public cases)
     // or it may be an admin checking another user's profile. etc.
     //
     global $author_session;
     $owner_filter = $this->getDataString('owner', $prefs['case_owner']);
     $owner_id = $this->getDataInt('id_author', $author_session['id_author']);
     $q_owner = " (a.id_author = " . $owner_id;
     if ($owner_id == $author_session['id_author']) {
         // Either in listcases, or user looking at his page in author_det
         if ($owner_filter == 'public') {
             $q_owner .= " OR c.public = 1";
         }
         if ($author_session['status'] == 'admin' && $owner_filter == 'all') {
             $q_owner .= " OR 1=1 ";
         }
     } else {
         // If not an admin, show only public cases of that user
         if ($author_session['status'] != 'admin') {
             $q_owner .= " AND c.public = 1";
         }
     }
     $q_owner .= " ) ";
     $q .= " AND " . $q_owner;
     // Period (date_creation) to show
     if ($this->date_start || $this->date_end) {
         if ($this->date_start) {
             $q .= " AND date_creation >= '" . $this->date_start . "'";
         }
         if ($this->date_end) {
             $q .= " AND date_creation <= '" . $this->date_end . "'";
         }
     } else {
         if ($prefs['case_period'] < 1900) {
             // since X days
             $q .= " AND " . lcm_query_subst_time('date_creation', 'NOW()') . ' < ' . $prefs['case_period'] * 3600 * 24;
         } else {
             // for year X
             $q .= " AND " . lcm_query_trunc_field('date_creation', 'year') . ' = ' . $prefs['case_period'];
         }
     }
     //
     // Sort results
     //
     $sort_clauses = array();
     $sort_allow = array('ASC' => 1, 'DESC' => 1);
     // Sort cases by creation date
     if ($sort_allow[_request('status_order')]) {
         $sort_clauses[] = "status " . _request('status_order');
     }
     if ($sort_allow[_request('case_order')]) {
         $sort_clauses[] = 'date_creation ' . _request('case_order');
     } elseif ($sort_allow[_request('upddate_order')]) {
         $sort_clauses[] = "date_update " . _request('upddate_order');
     } else {
         $sort_clauses[] = 'date_creation DESC';
     }
     // default
     $q .= " ORDER BY " . implode(', ', $sort_clauses);
     $result = lcm_query($q);
     // Check for correct start position of the list
     $this->number_of_rows = lcm_num_rows($result);
     if ($this->list_pos >= $this->number_of_rows) {
         $this->list_pos = 0;
     }
     // Position to the page info start
     if ($this->list_pos > 0) {
         if (!lcm_data_seek($result, $this->list_pos)) {
             lcm_panic("Error seeking position " . $this->list_pos . " in the result");
         }
     }
     for ($i = 0; $i < $prefs['page_rows'] && ($row = lcm_fetch_array($result)); $i++) {
         show_listcase_item($row, $i, $this->search);
     }
 }
开发者ID:nyimbi,项目名称:legalcase,代码行数:97,代码来源:inc_obj_case.php


示例12: install_step_3

function install_step_3()
{
    $db_address = _request('db_address');
    $db_login = _request('db_login');
    $db_password = _request('db_password');
    global $lcm_db_version;
    $install_log = "";
    $upgrade_log = "";
    // Possible errors will get trapped in the output buffer and displayed later,
    // so that they don't mess up with headers/html.
    ob_start();
    if (_request('db_choice') == "__manual__") {
        $sel_db = _request('manual_db');
    } else {
        $sel_db = _request('db_choice');
    }
    $link = lcm_connect_db($db_address, 0, $db_login, $db_password, $sel_db);
    $io_output = ob_get_contents();
    ob_end_clean();
    if (!$link) {
        install_html_start('AUTO', '', 3);
        lcm_panic("connection denied: " . lcm_sql_error());
    }
    //
    // TEMPORARY (used by testing the installer)
    /*
    lcm_query("DROP TABLE lcm_case", true);
    lcm_query("DROP TABLE lcm_case_attachment", true);
    lcm_query("DROP TABLE lcm_stage", true);
    lcm_query("DROP TABLE lcm_followup", true);
    lcm_query("DROP TABLE lcm_author", true);
    lcm_query("DROP TABLE lcm_client", true);
    lcm_query("DROP TABLE lcm_client_attachment", true);
    lcm_query("DROP TABLE lcm_org", true);
    lcm_query("DROP TABLE lcm_org_attachment", true);
    lcm_query("DROP TABLE lcm_contact", true);
    lcm_query("DROP TABLE lcm_keyword", true);
    lcm_query("DROP TABLE lcm_keyword_case", true);
    lcm_query("DROP TABLE lcm_keyword_client", true);
    lcm_query("DROP TABLE lcm_keyword_org", true);
    lcm_query("DROP TABLE lcm_keyword_group", true);
    lcm_query("DROP TABLE lcm_report", true);
    lcm_query("DROP TABLE lcm_fields", true);
    lcm_query("DROP TABLE lcm_filter", true);
    lcm_query("DROP TABLE lcm_app", true);
    lcm_query("DROP TABLE lcm_app_client_org", true);
    lcm_query("DROP TABLE lcm_app_fu", true);
    lcm_query("DROP TABLE lcm_author_app", true);
    lcm_query("DROP TABLE lcm_case_client_org", true);
    lcm_query("DROP TABLE lcm_case_author", true);
    lcm_query("DROP TABLE lcm_client_org", true);
    lcm_query("DROP TABLE lcm_rep_col", true);
    lcm_query("DROP TABLE lcm_rep_line", true);
    lcm_query("DROP TABLE lcm_rep_filters", true);
    lcm_query("DROP TABLE lcm_filter_conds", true);
    lcm_query("DROP TABLE lcm_rep_filter", true);
    lcm_query("DROP TABLE lcm_meta", true);
    */
    // Test if the software was already installed
    $result = lcm_query("SELECT * FROM lcm_meta", true);
    $already_installed = !lcm_sql_errno() && lcm_num_rows($result);
    $old_lcm_version = 'NONE';
    if ($already_installed) {
        lcm_log("LCM already installed", 'install');
        // Find the current database version
        $old_lcm_db_version = 0;
        $query = "SELECT value FROM lcm_meta WHERE name = 'lcm_db_version'";
        $result = lcm_query_db($query);
        while ($row = lcm_fetch_array($result)) {
            $old_lcm_db_version = $row['value'];
        }
        lcm_log("LCM version installed is {$old_lcm_db_version}", 'install');
        // Check if upgrade is needed
        if ($old_lcm_db_version < $lcm_db_version) {
            lcm_log("Calling the upgrade procedure (since < {$lcm_db_version})", 'install');
            include_lcm('inc_db_upgrade');
            $upgrade_log = upgrade_database($old_lcm_db_version);
        } else {
            lcm_log("Upgrade _not_ called, looks OK (= {$lcm_db_version})", 'install');
        }
    } else {
        lcm_log("Creating the database from scratch", 'install');
        include_lcm('inc_db_create');
        $install_log .= create_database();
        lcm_log("DB creation complete", 'install');
    }
    // Create default meta + keywords
    include_lcm('inc_meta');
    include_lcm('inc_keywords_default');
    include_lcm('inc_meta_defaults');
    init_default_config();
    init_languages();
    $skwg = get_default_keywords();
    create_groups($skwg);
    write_metas();
    // regenerate inc/data/inc_meta_cache.php
    // Test DB: not used for now..
    include_lcm('inc_db_test');
    $structure_ok = lcm_structure_test();
    if (!empty($install_log)) {
//.........这里部分代码省略.........
开发者ID:nyimbi,项目名称:legalcase,代码行数:101,代码来源:install.php


示例13: lire

 function lire()
 {
     // read
     global $ldap_link, $ldap_base, $flag_utf8_decode;
     $this->nom = $this->email = $this->pass = $this->statut = '';
     if (!$this->login) {
         return false;
     }
     // If the author exists in the database, fetch his infos
     $query = "SELECT * FROM spip_auteurs WHERE login='" . addslashes($this->login) . "' AND source='ldap'";
     $result = lcm_query($query);
     if ($row = lcm_fetch_array($result)) {
         $this->nom = $row['nom'];
         $this->email = $row['email'];
         $this->statut = $row['statut'];
         $this->bio = $row['bio'];
         return true;
     }
     // Read the info on the author from LDAP
     $result = @ldap_read($ldap_link, $this->user_dn, "objectClass=*", array("uid", "cn", "mail", "description"));
     // If the user cannot read his informations, reconnect with the main account
     if (!$result) {
         if (spip_connect_ldap()) {
             $result = @ldap_read($ldap_link, $this->user_dn, "objectClass=*", array("uid", "cn", "mail", "description"));
         } else {
             return false;
         }
     }
     if (!$result) {
         return false;
     }
     // Fetch the author's data
     $info = @ldap_get_entries($ldap_link, $result);
     if (!is_array($info)) {
         return false;
     }
     for ($i = 0; $i < $info["count"]; $i++) {
         $val = $info[$i];
         if (is_array($val)) {
             if (!$this->nom) {
                 $this->nom = $val['cn'][0];
             }
             if (!$this->email) {
                 $this->email = $val['mail'][0];
             }
             if (!$this->login) {
                 $this->login = $val['uid'][0];
             }
             if (!$this->bio) {
                 $this->bio = $val['description'][0];
             }
         }
     }
     // Convert from UTF-8 (default encoding)
     if ($flag_utf8_decode) {
         $this->nom = utf8_decode($this->nom);
         $this->email = utf8_decode($this->email);
         $this->login = utf8_decode($this->login);
         $this->bio = utf8_decode($this->bio);
     }
     return true;
 }
开发者ID:nyimbi,项目名称:legalcase,代码行数:62,代码来源:inc_auth_ldap.php


示例14: spip_fetch_array

function spip_fetch_array($r)
{
    lcm_log("use of deprecated function: spip_fetch_array, use lcm_fetch_array instead");
    return lcm_fetch_array($r);
}
开发者ID:nyimbi,项目名称:legalcase,代码行数:5,代码来源:inc_db_pgsql.php


示例15: setupReportLines

 function setupReportLines()
 {
     $this->addComment("setupReportLines() called.");
     $q = "SELECT *\n\t\t\t\tFROM lcm_rep_line as l, lcm_fields as f\n\t\t\t\tWHERE id_report = " . $this->getId() . "\n\t\t\t\tAND l.id_field = f.id_field\n\t\t\t\tORDER BY col_order, id_line ASC";
     $result = lcm_query($q);
     while ($row = lcm_fetch_array($result)) {
         $my_line_table = $row['table_name'];
         $this->addLine(prefix_field($row['table_name'], $row['field_name']));
         $this->addHeader(_Th($row['description']), $row['filter'], $row['enum_type'], '', $row['field_name']);
         if ($row['field_name'] == 'count(*)') {
             $this->setOption('do_grouping', 'yes');
         }
         // $do_grouping = true;
     }
     if (count($this->getLines())) {
         return;
     }
     //
     // No fields were specified: show them all (avoids errors)
     //
     if ($this->rep_info['line_src_type'] == 'table') {
         $q = "SELECT * \n\t\t\t\t\tFROM lcm_fields \n\t\t\t\t\tWHERE table_name = 'lcm_" . $this->rep_info['line_src_name'] . "'\n\t\t\t\t\t  AND field_name != 'count(*)'";
         $result = lcm_query($q);
         while ($row = lcm_fetch_array($result)) {
             $this->addLine(prefix_field($row['table_name'], $row['field_name']));
             $this->addHeader(_Th($row['description']), $row['filter'], $row['enum_type'], '', $row['field_name']);
         }
     } elseif ($this->rep_info['line_src_type'] == 'keyword') {
         $kwg = get_kwg_from_name($this->rep_info['line_src_name']);
         $this->addLine("k.title as 'TRAD'");
         $this->addHeader(_Th(remove_number_prefix($kwg['title'])), $kwg['filter'], $kwg['enum_type'], '', 'k.id_keyword');
         // XXX not sure about id_keyword
     }
 }
开发者ID:nyimbi,项目名称:legalcase,代码行数:34,代码来源:inc_obj_reportgen.php


示例16: lcm_query

 // Show parent followup ([ML] fu.type necessary for short-desc)
 $q = "SELECT a.id_followup, fu.description, fu.type\n\t\t\t\tFROM lcm_app_fu as a, lcm_followup as fu\n\t\t\t\tWHERE a.id_app = " . $row['id_app'] . "\n\t\t\t  \t  AND a.id_followup = fu.id_followup\n\t\t\t\t  AND a.relation = 'parent'";
 $res_fu = lcm_query($q);
 if (lcm_num_rows($res_fu) > 0) {
     // Show parent followup title
     $fu = lcm_fetch_array($res_fu);
     $short_description = get_fu_description($fu);
     echo '<br />Consequent to:' . ' <a class="content_link" href="fu_det.php?followup=' . $fu['id_followup'] . '">' . $short_description . "</a><br />\n";
     // TRAD
 }
 // Show child followup
 $q = "SELECT lcm_app_fu.id_followup,lcm_followup.description FROM lcm_app_fu,lcm_followup\n\t\t\tWHERE lcm_app_fu.id_app=" . $row['id_app'] . "\n\t\t\t\tAND lcm_app_fu.id_followup=lcm_followup.id_followup\n\t\t\t\tAND lcm_app_fu.relation='child'";
 $res_fu = lcm_query($q);
 if (lcm_num_rows($res_fu) > 0) {
     // Show child followup title
     $fu = lcm_fetch_array($res_fu);
     $title_length = $prefs['screen'] == "wide" ? 48 : 115;
     if (strlen(lcm_utf8_decode($fu['description'])) < $title_length) {
         $short_description = $fu['description'];
     } else {
         $short_description = substr($fu['description'], 0, $title_length) . '...';
     }
     echo '<br />Resulting followup:' . ' <a href="fu_det.php?followup=' . $fu['id_followup'] . '">' . $short_description;
     // TRAD
 } else {
     if ($ac['w']) {
         // Show create followup from appointment
         echo '<br /><a href="edit_fu.php?case=' . $row['id_case'] . '&amp;app=' . $row['id_app'] . '" class="create_new_lnk">Create new followup from this appointment';
         // TRAD
     }
 }
开发者ID:nyimbi,项目名称:legalcase,代码行数:31,代码来源:app_det.php


示例17: send_registration_by_email

function send_registration_by_email()
{
    global $lcm_lang_left;
    $_SESSION['form_data'] = array();
    $_SESSION['errors'] = array();
    $kwg_email = get_kwg_from_name('+email_main');
    $form_items = array('name_first' => 'person_input_name_first', 'name_last' => 'person_input_name_last', 'email' => 'input_email', 'username' => 'authoredit_input_username');
    foreach ($form_items as $field => $trad) {
        $_SESSION['form_data'][$field] = _request($field);
        if (!_session($field)) {
            $_SESSION['errors'][$field] = _Ti($trad) . _T('warning_field_mandatory');
        }
    }
    if (count($_SESSION['errors'])) {
        lcm_header("Location: lcm_pass.php?register=yes");
        exit;
    }
    install_html_start(_T('pass_title_register'), 'login');
    // There is a risk that an author changes his e-mail after his account
    // is created, to the e-mail of another person, and therefore block the
    // other person from registering. But then.. this would allow the other
    // person to hijack the account, so it would be a stupid DoS.
    $query = "SELECT id_of_person, status FROM lcm_contact as c, lcm_author as a\n\t\tWHERE c.id_of_person = a.id_author\n\t\tAND value = '" . _session('email') . "'\n\t\tAND type_person = 'author'\n\t\tAND type_contact = " . $kwg_email['id_group'];
    $result = lcm_query($query);
    // Test if the user already exists
    if ($row = lcm_fetch_array($result)) {
        $id_author = $row['id_of_person'];
        $status = $row['status'];
        // TODO: if status = 'pending for validation by admin', show message
        if ($status == 'trash') {
            echo "<br />\n";
            echo "<div class='box_error'>" . _T('pass_registration_denied') . "</div>\n";
        } else {
            echo "<br />\n";
            echo "<div class=\"box_error\" align=\"{$lcm_lang_left}\">" . _T('pass_warning_already_registered') . "</div>\n";
            return;
        }
    }
    //
    // Send identifiers by e-mail
    //
    include_lcm('inc_access');
    include_lcm('inc_mail');
    $username = get_unique_username(_session('username'));
    $pass = create_random_password(8, $username);
    $mdpass = md5($pass);
    $open_subscription = read_meta("site_open_subscription");
    if (!($open_subscription == 'yes' || $open_subscription == 'moderated')) {
        lcm_panic("Subscriptions not permitted.");
    }
    $status = 'waiting';
    if ($open_subscription == 'yes') {
        $status = 'normal';
    }
    lcm_query("INSERT INTO lcm_author (name_first, name_last, username, password, status, date_creation, date_update) " . "VALUES ('" . _session('name_first') . "', '" . _session('name_last') . "', '{$username}', '{$mdpass}', 'normal', NOW(), NOW())");
    $id_author = lcm_insert_id('lcm_author', 'id_author');
    // Add e-mail to lcm_contact
    lcm_query("INSERT INTO lcm_contact (type_person, type_contact, id_of_person, value)\n\t\t\tVALUES ('author', " . $kwg_email['id_group'] . ", {$id_author}, '" . _session('email') . "')");
    // Prepare the e-mail to send to the user
    $site_name = _T(read_meta('site_name'));
    $site_address = read_meta('site_address');
    $message = _T('info_greetings') . ",\n\n";
    $message .= _T('pass_info_here_info', ar 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP lcm_panic函数代码示例发布时间:2022-05-15
下一篇:
PHP lchown函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap