function Execute()
 {
     $objectName = get_class($this->sourceObject);
     $fcv_array = $this->argv[0];
     $sql = 'select count(*) as mycount from `' . strtolower($objectName) . '`';
     if (sizeof($fcv_array) > 0) {
         $sql .= " where ";
         for ($i = 0, $c = sizeof($fcv_array); $i < $c; $i++) {
             if (sizeof($fcv_array[$i]) == 1) {
                 $sql .= " " . $fcv_array[$i][0] . " ";
                 continue;
             } else {
                 if ($i > 0 && sizeof($fcv_array[$i - 1]) != 1) {
                     $sql .= " AND ";
                 }
                 $fieldAttributes = $this->sourceObject->GetFieldAttribute($fcv_array[$i][0], 'db_attributes');
                 if ($fieldAttributes != null && $fieldAttributes[0] != 'NUMERIC' && $fieldAttributes[0] != 'SET') {
                     if ($GLOBALS['configuration']['db_encoding'] == 1) {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? "BASE64_DECODE(" . $fcv_array[$i][2] . ")" : "'" . $fcv_array[$i][2] . "'";
                         $sql .= "BASE64_DECODE(`" . $fcv_array[$i][0] . "`) " . $fcv_array[$i][1] . " " . $value;
                     } else {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $this->Escape($fcv_array[$i][2]) . "'";
                         $sql .= "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                     }
                 } else {
                     $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $fcv_array[$i][2] . "'";
                     $sql .= "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                 }
             }
         }
     }
     $connection = Database::Connect();
     $cursor = Database::Reader($sql, $connection);
     while ($row = Database::Read($cursor)) {
         $count = $row['mycount'];
     }
     return $count;
 }
 /**
  * Returns a sorted array of objects that match given conditions
  * @param multidimensional array {("field", "comparator", "value"), ("field", "comparator", "value"), ...} 
  * @param string $sortBy 
  * @param boolean $ascending 
  * @param int limit 
  * @return array $parent_List
  */
 function GetList($fcv_array = array(), $sortBy = '', $ascending = true, $limit = '')
 {
     $connection = Database::Connect();
     $sqlLimit = $limit != '' ? "LIMIT {$limit}" : '';
     $this->pog_query = "select * from `parent_` ";
     $parent_List = array();
     if (sizeof($fcv_array) > 0) {
         $this->pog_query .= " where ";
         for ($i = 0, $c = sizeof($fcv_array); $i < $c; $i++) {
             if (sizeof($fcv_array[$i]) == 1) {
                 $this->pog_query .= " " . $fcv_array[$i][0] . " ";
                 continue;
             } else {
                 if ($i > 0 && sizeof($fcv_array[$i - 1]) != 1) {
                     $this->pog_query .= " AND ";
                 }
                 if (isset($this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes']) && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'SET') {
                     if ($GLOBALS['configuration']['db_encoding'] == 1) {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? "BASE64_DECODE(" . $fcv_array[$i][2] . ")" : "'" . $fcv_array[$i][2] . "'";
                         $this->pog_query .= "BASE64_DECODE(`" . $fcv_array[$i][0] . "`) " . $fcv_array[$i][1] . " " . $value;
                     } else {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $this->Escape($fcv_array[$i][2]) . "'";
                         $this->pog_query .= "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                     }
                 } else {
                     $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $fcv_array[$i][2] . "'";
                     $this->pog_query .= "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                 }
             }
         }
     }
     if ($sortBy != '') {
         if (isset($this->pog_attribute_type[$sortBy]['db_attributes']) && $this->pog_attribute_type[$sortBy]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$sortBy]['db_attributes'][0] != 'SET') {
             if ($GLOBALS['configuration']['db_encoding'] == 1) {
                 $sortBy = "BASE64_DECODE({$sortBy}) ";
             } else {
                 $sortBy = "{$sortBy} ";
             }
         } else {
             $sortBy = "{$sortBy} ";
         }
     } else {
         $sortBy = "parent_id";
     }
     $this->pog_query .= " order by " . $sortBy . " " . ($ascending ? "asc" : "desc") . " {$sqlLimit}";
     $thisObjectName = get_class($this);
     $cursor = Database::Reader($this->pog_query, $connection);
     while ($row = Database::Read($cursor)) {
         $parent_ = new $thisObjectName();
         $parent_->parent_Id = $row['parent_id'];
         $parent_->attribute = $this->Unescape($row['attribute']);
         $parent_List[] = $parent_;
     }
     return $parent_List;
 }
 /**
  * Returns a sorted array of objects that match given conditions
  * @param multidimensional array {("field", "comparator", "value"), ("field", "comparator", "value"), ..}
  * @param string $sortBy
  * @param boolean $ascending
  * @param int limit
  * @return array $pluginList
  */
 function GetList($fcv_array = array(), $sortBy = '', $ascending = true, $limit = '')
 {
     $connection = Database::Connect();
     $sqlLimit = $limit != '' ? "LIMIT {$limit}" : '';
     $this->pog_query = "select * from `plugin` ";
     $pluginList = array();
     if (sizeof($fcv_array) > 0) {
         $this->pog_query = $this->pog_query . " where ";
         for ($i = 0, $c = sizeof($fcv_array); $i < $c; $i++) {
             if (sizeof($fcv_array[$i]) == 1) {
                 $this->pog_query = $this->pog_query . " " . $fcv_array[$i][0] . " ";
                 continue;
             } else {
                 if ($i > 0 && sizeof($fcv_array[$i - 1]) != 1) {
                     $this->pog_query = $this->pog_query . " AND ";
                 }
                 if (isset($this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes']) && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'SET') {
                     if ($GLOBALS['configuration']['db_encoding'] == 1) {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? "BASE64_DECODE(" . $fcv_array[$i][2] . ")" : "'" . $fcv_array[$i][2] . "'";
                         $this->pog_query = $this->pog_query . "BASE64_DECODE(`" . $fcv_array[$i][0] . "`) " . $fcv_array[$i][1] . " " . $value;
                     } else {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $this->Escape($fcv_array[$i][2]) . "'";
                         $this->pog_query = $this->pog_query . "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                     }
                 } else {
                     $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $fcv_array[$i][2] . "'";
                     $this->pog_query = $this->pog_query . "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                 }
             }
         }
     }
     if ($sortBy != '') {
         if (isset($this->pog_attribute_type[$sortBy]['db_attributes']) && $this->pog_attribute_type[$sortBy]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$sortBy]['db_attributes'][0] != 'SET') {
             if ($GLOBALS['configuration']['db_encoding'] == 1) {
                 $sortBy = "BASE64_DECODE({$sortBy}) ";
             } else {
                 $sortBy = "{$sortBy} ";
             }
         } else {
             $sortBy = "{$sortBy} ";
         }
     } else {
         $sortBy = "pluginid";
     }
     $this->pog_query = $this->pog_query . " order by " . $sortBy . " " . ($ascending ? "asc" : "desc") . " {$sqlLimit}";
     $thisObjectName = get_class($this);
     $cursor = Database::Reader($this->pog_query, $connection);
     while ($row = Database::Read($cursor)) {
         $plugin = new $thisObjectName();
         $plugin->pluginId = $row['pluginid'];
         $plugin->name = $this->Unescape($row['name']);
         $plugin->author = $this->Unescape($row['author']);
         $plugin->description = $this->Unescape($row['description']);
         $plugin->code = $this->Unescape($row['code']);
         $plugin->version = $this->Unescape($row['version']);
         $plugin->emailAddress = $this->Unescape($row['emailaddress']);
         $plugin->password = $this->Unescape($row['password']);
         $plugin->active = $this->Unescape($row['active']);
         $plugin->mysql = $this->Unescape($row['mysql']);
         $plugin->php = $this->Unescape($row['php']);
         $pluginList[] = $plugin;
     }
     return $pluginList;
 }
 /**
  * Returns a sorted array of objects that match given conditions
  * @param multidimensional array {("field", "comparator", "value"), ("field", "comparator", "value"), ..} 
  * @param string $sortBy 
  * @param boolean $ascending 
  * @param int limit 
  * @return array $siblingList
  */
 function GetObjectList($fcv_array = array(), $sortBy = '', $ascending = true, $limit = '')
 {
     $sqlLimit = $limit != '' ? "LIMIT {$limit}" : '';
     $connection = Database::Connect();
     $object = new object();
     $objectList = array();
     $this->pog_query = "select distinct * from `object` a INNER JOIN `objectsiblingmap` m ON m.objectid = a.objectid where m.siblingid = '{$this->siblingId}' ";
     if (sizeof($fcv_array) > 0) {
         $this->pog_query = $this->pog_query . " AND ";
         for ($i = 0, $c = sizeof($fcv_array); $i < $c; $i++) {
             if (sizeof($fcv_array[$i]) == 1) {
                 $this->pog_query = $this->pog_query . " " . $fcv_array[$i][0] . " ";
                 continue;
             } else {
                 if ($i > 0 && sizeof($fcv_array[$i - 1]) != 1) {
                     $this->pog_query = $this->pog_query . " AND ";
                 }
                 if (isset($object->pog_attribute_type[$fcv_array[$i][0]]['db_attributes']) && $object->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'NUMERIC' && $object->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'SET') {
                     if ($GLOBALS['configuration']['db_encoding'] == 1) {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? "BASE64_DECODE(" . $fcv_array[$i][2] . ")" : "'" . $fcv_array[$i][2] . "'";
                         $this->pog_query = $this->pog_query . "BASE64_DECODE(`" . $fcv_array[$i][0] . "`) " . $fcv_array[$i][1] . " " . $value;
                     } else {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $this->Escape($fcv_array[$i][2]) . "'";
                         $this->pog_query = $this->pog_query . "a.`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                     }
                 } else {
                     $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $fcv_array[$i][2] . "'";
                     $this->pog_query = $this->pog_query . "a.`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                 }
             }
         }
     }
     if ($sortBy != '') {
         if (isset($object->pog_attribute_type[$sortBy]['db_attributes']) && $object->pog_attribute_type[$sortBy]['db_attributes'][0] != 'NUMERIC' && $object->pog_attribute_type[$sortBy]['db_attributes'][0] != 'SET') {
             if ($GLOBALS['configuration']['db_encoding'] == 1) {
                 $sortBy = "BASE64_DECODE(a.{$sortBy}) ";
             } else {
                 $sortBy = "a.{$sortBy} ";
             }
         } else {
             $sortBy = "a.{$sortBy} ";
         }
     } else {
         $sortBy = "a.objectid";
     }
     $this->pog_query = $this->pog_query . " order by " . $sortBy . " " . ($ascending ? "asc" : "desc") . " {$sqlLimit}";
     $cursor = Database::Reader($this->pog_query, $connection);
     while ($row = Database::Read($cursor)) {
         $object = new object();
         foreach ($object->pog_attribute_type as $attribute_name => $attrubute_type) {
             if ($attrubute_type['db_attributes'][1] != "HASMANY" && $attrubute_type['db_attributes'][1] != "JOIN") {
                 if ($attrubute_type['db_attributes'][1] == "BELONGSTO") {
                     $object->{strtolower($attribute_name) . 'Id'} = $row[strtolower($attribute_name) . 'id'];
                     continue;
                 }
                 $object->{$attribute_name} = $this->Unescape($row[strtolower($attribute_name)]);
             }
         }
         $objectList[] = $object;
     }
     return $objectList;
 }
 /**
  * Returns a sorted array of objects that match given conditions
  * @param multidimensional array {("field", "comparator", "value"), ("field", "comparator", "value"), ...} 
  * @param string $sortBy 
  * @param boolean $ascending 
  * @param int limit 
  * @return array $onetimepasswordList
  */
 function GetList($fcv_array = array(), $sortBy = '', $ascending = true, $limit = '')
 {
     $connection = Database::Connect();
     $sqlLimit = $limit != '' ? "LIMIT {$limit}" : '';
     $this->pog_query = "select * from `onetimepassword` ";
     $onetimepasswordList = array();
     if (sizeof($fcv_array) > 0) {
         $this->pog_query .= " where ";
         for ($i = 0, $c = sizeof($fcv_array); $i < $c; $i++) {
             if (sizeof($fcv_array[$i]) == 1) {
                 $this->pog_query .= " " . $fcv_array[$i][0] . " ";
                 continue;
             } else {
                 if ($i > 0 && sizeof($fcv_array[$i - 1]) != 1) {
                     $this->pog_query .= " AND ";
                 }
                 if (isset($this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes']) && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'SET') {
                     if ($GLOBALS['configuration']['db_encoding'] == 1) {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? "BASE64_DECODE(" . $fcv_array[$i][2] . ")" : "'" . $fcv_array[$i][2] . "'";
                         $this->pog_query .= "BASE64_DECODE(`" . $fcv_array[$i][0] . "`) " . $fcv_array[$i][1] . " " . $value;
                     } else {
                         $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $this->Escape($fcv_array[$i][2]) . "'";
                         $this->pog_query .= "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                     }
                 } else {
                     $value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'" . $fcv_array[$i][2] . "'";
                     $this->pog_query .= "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " " . $value;
                 }
             }
         }
     }
     if ($sortBy != '') {
         if (isset($this->pog_attribute_type[$sortBy]['db_attributes']) && $this->pog_attribute_type[$sortBy]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$sortBy]['db_attributes'][0] != 'SET') {
             if ($GLOBALS['configuration']['db_encoding'] == 1) {
                 $sortBy = "BASE64_DECODE({$sortBy}) ";
             } else {
                 $sortBy = "{$sortBy} ";
             }
         } else {
             $sortBy = "{$sortBy} ";
         }
     } else {
         $sortBy = "onetimepasswordid";
     }
     $this->pog_query .= " order by " . $sortBy . " " . ($ascending ? "asc" : "desc") . " {$sqlLimit}";
     $thisObjectName = get_class($this);
     $cursor = Database::Reader($this->pog_query, $connection);
     while ($row = Database::Read($cursor)) {
         $onetimepassword = new $thisObjectName();
         $onetimepassword->onetimepasswordId = $row['onetimepasswordid'];
         $onetimepassword->userId = $row['userid'];
         $onetimepassword->onetimepasswordstatusId = $row['onetimepasswordstatusid'];
         $onetimepassword->reference = $this->Unescape($row['reference']);
         $onetimepassword->key = $this->Unescape($row['key']);
         $onetimepassword->key_checksum = $this->Unescape($row['key_checksum']);
         $onetimepassword->data = $this->Unescape($row['data']);
         $onetimepassword->version = $this->Unescape($row['version']);
         $onetimepassword->creation_date = $row['creation_date'];
         $onetimepassword->request_date = $row['request_date'];
         $onetimepassword->usage_date = $row['usage_date'];
         $onetimepasswordList[] = $onetimepassword;
     }
     return $onetimepasswordList;
 }